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
59 lines • 2.36 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SystemApi = void 0;
const models_1 = require("../models/models"); // Added ExistingChromeInstanceStrategy
/**
* API endpoints for system operations
*/
class SystemApi {
/**
* Creates a new instance of the SystemApi
* @param client The SmoothOperatorClient instance
*/
constructor(client) {
this.client = client;
}
/**
* Gets detailed overview of computer state including open applications and windows
* @returns OverviewResponse with FocusInfo, Windows array and Chrome details
*/
async getOverview() {
return this.client.post('/tools-api/system/overview', {});
}
/**
* 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 });
}
/**
* Opens Chrome browser (Playwright-managed instance).
* @param url Optional URL to navigate to immediately.
* @param strategy Strategy for handling existing Chrome instances. Defaults to ThrowError (0).
* Possible values: ThrowError (0), ForceClose (1), StartWithoutUserProfile (2).
* @returns SimpleResponse indicating success or failure.
*/
async openChrome(url, strategy = models_1.ExistingChromeInstanceStrategy.ThrowError) {
// Send the numeric value of the enum
return this.client.post('/tools-api/system/open-chrome', { url, strategy });
}
/**
* 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). For chrome don't use this, use openChrome instead.
* @returns SimpleResponse indicating success or failure
*/
async openApplication(appNameOrPath) {
return this.client.post('/tools-api/system/open-application', { appNameOrPath });
}
/**
* Returns a string representation of the SystemApi class.
* @returns The string "SystemApi".
*/
toString() {
return 'SystemApi';
}
}
exports.SystemApi = SystemApi;
//# sourceMappingURL=system-api.js.map