smooth-operator-agent-tools
Version:
Node.js client library for Smooth Operator Agent Tools - a toolkit for programmers developing Computer Use Agents on Windows systems
98 lines • 3.54 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.AutomationApi = void 0;
/**
* API endpoints for Windows automation operations
*/
class AutomationApi {
/**
* Creates a new instance of the AutomationApi
* @param client The SmoothOperatorClient instance
*/
constructor(client) {
this.client = client;
}
/**
* Launches an application by path or name
* @param appNameOrPath Full path to executable or application name, alternatively exe name if in path (e.g. notepad, calc)
* @returns SimpleResponse indicating success or failure
*/
async openApplication(appNameOrPath) {
return this.client.post('/tools-api/system/open-application', { appNameOrPath });
}
/**
* Invokes default action on Windows UI element (e.g. click button)
* @param elementId Element ID from getOverview/getWindowDetails
* @returns SimpleResponse indicating success or failure
*/
async invoke(elementId) {
return this.client.post('/tools-api/automation/invoke', { elementId });
}
/**
* Set the value of a UI element
* @param elementId ID of the UI element
* @param value Value to set
* @returns SimpleResponse indicating success or failure
*/
async setValue(elementId, value) {
return this.client.post('/tools-api/automation/set-value', { elementId, value });
}
/**
* Set focus to a UI element
* @param elementId ID of the UI element
* @returns SimpleResponse indicating success or failure
*/
async setFocus(elementId) {
return this.client.post('/tools-api/automation/set-focus', { elementId });
}
/**
* Gets detailed UI automation information for a window
* @param windowId Window ID from getOverview
* @returns WindowDetailInfosDTO with element hierarchy and properties
*/
async getWindowDetails(windowId) {
return this.client.post('/tools-api/automation/get-details', { windowId });
}
/**
* Bring a window to the front
* @param windowId ID of the window
* @returns SimpleResponse indicating success or failure
*/
async bringToFront(windowId) {
return this.client.post('/tools-api/automation/bring-to-front', { windowId });
}
/**
* Find and click a Windows UI element by description
* @param description Description of the UI element
* @returns Action response
*/
async clickElement(description) {
return this.client.post('/tools-api/automation/click-element', { description });
}
/**
* Find a Windows UI element by description and type text into it
* @param description Description of the UI element
* @param text Text to type
* @returns Action response
*/
async typeInElement(description, text) {
return this.client.post('/tools-api/automation/type-in-element', { description, text });
}
/**
* Get text from a Windows UI element by description
* @param description Description of the UI element
* @returns Action response with element text
*/
async getElementText(description) {
return this.client.post('/tools-api/automation/get-element-text', { description });
}
/**
* Returns a string representation of the AutomationApi class.
* @returns The string "AutomationApi".
*/
toString() {
return 'AutomationApi';
}
}
exports.AutomationApi = AutomationApi;
//# sourceMappingURL=automation-api.js.map
;