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
506 lines (505 loc) • 14.6 kB
TypeScript
/**
* Type definitions for Smooth Operator Agent Tools
*/
/**
* Specifies the mechanism to use for AI-based UI element interaction.
*/
export declare enum MechanismType {
ScreenGrasp2 = "screengrasp2",
ScreenGrasp2Low = "screengrasp2-low",
ScreenGraspMedium = "screengrasp-medium",
ScreenGraspHigh = "screengrasp-high",
LLabs = "llabs",
AnthropicComputerUse = "anthropic-computer-use",
OpenAIComputerUse = "openai-computer-use",
Qwen25Vl72b = "qwen25-vl-72b"
}
/**
* Strategy to use when an existing Chrome instance is already running with the same user profile.
* Mirrors the C# enum.
*/
export declare enum ExistingChromeInstanceStrategy {
/** Throw an error if an existing Chrome instance is using the same user profile. */
ThrowError = 0,
/** Force close any existing Chrome instances before starting a new one. */
ForceClose = 1,
/** Start a Playwright-managed Chrome without using the user profile. */
StartWithoutUserProfile = 2
}
type ControlDTOPlain = {
id: string;
name: string | null;
creationDate: string;
controlType: string | null;
supportsSetValue: boolean | null;
supportsInvoke: boolean | null;
currentValue: string | null;
children: (ControlDTOPlain | null)[] | null;
isSmoothOperator: boolean;
};
/**
* Response from the screenshot endpoint
*/
export declare class ScreenshotResponse {
/** Whether the operation was successful */
success: boolean;
/** Base64-encoded image data */
imageBase64: string;
/** Timestamp of when the screenshot was taken (ISO 8601 format) */
timestamp: string;
/** Message describing the result */
message: string | null;
constructor(data: {
success: boolean;
imageBase64: string;
timestamp: string;
message?: string | null;
});
/** Raw image bytes */
get imageBytes(): Buffer;
/** Mime type of the image */
get imageMimeType(): string;
toJSON(): any;
}
/**
* Represents a point on the screen with X and Y coordinates
*/
export declare class Point {
/** X coordinate */
x: number;
/** Y coordinate */
y: number;
constructor(data: {
x: number;
y: number;
});
toJSON(): any;
}
/**
* Generic response for action endpoints
*/
export declare class ActionResponse {
/** Whether the operation was successful */
success: boolean;
/** Message describing the result */
message: string | null;
/** Additional result data (if applicable), typically a string for simple results, can be a json string for more complex results */
resultValue: string | null;
constructor(data: {
success: boolean;
message?: string | null;
resultValue?: string | null;
});
toJSON(): any;
}
/**
* Response from the ScreenGrasp2 endpoint (find-ui-element-by-description)
*/
export declare class ScreenGrasp2Response extends ActionResponse {
/** X coordinate of the found element (if applicable) */
x: number | null;
/** Y coordinate of the found element (if applicable) */
y: number | null;
/** Status message from the underlying service */
status: string | null;
constructor(data: {
success: boolean;
message?: string | null;
x?: number | null;
y?: number | null;
status?: string | null;
});
toJSON(): any;
}
/**
* Information about a Chrome browser tab
*/
export declare class ChromeTab {
/** Tab ID */
id: string;
/** Tab title */
title: string;
/** Tab URL */
url: string;
/** Whether the tab is active */
isActive: boolean;
constructor(data: {
id: string;
title: string;
url: string;
isActive: boolean;
});
toJSON(): any;
}
/**
* Detailed information about a Chrome tab
*/
export declare class ChromeTabDetails {
/** Current tab title */
currentTabTitle: string;
/** Current tab index */
currentTabIndex: number;
/** Most relevant elements in the current Chrome tab */
currentChromeTabMostRelevantElements: ChromeElementInfo[];
/** Other Chrome instances */
chromeInstances: ChromeOverview[];
/** Optional note */
note: string | null;
constructor(data: {
currentTabTitle: string;
currentTabIndex: number;
currentChromeTabMostRelevantElements: ChromeElementInfo[];
chromeInstances: ChromeOverview[];
note?: string | null;
});
toJSON(): any;
}
/**
* Response from Chrome script execution
*/
export declare class ChromeScriptResponse extends ActionResponse {
/** Result of the script execution */
result: string | null;
constructor(data: {
success: boolean;
message?: string | null;
result?: string | null;
});
toJSON(): any;
}
/**
* Response from C# code execution
*/
export declare class CSharpCodeResponse extends ActionResponse {
/** Result of the code execution */
result: string | null;
constructor(data: {
success: boolean;
message?: string | null;
data?: Record<string, any> | null;
result?: string | null;
});
toJSON(): any;
}
/**
* Simple response with a message
*/
export declare class SimpleResponse {
/** Whether the operation was successful */
success: boolean;
/** Message describing the result */
message: string | null;
/** Internal message (not usually exposed to users) */
internalMessage: string | null;
constructor(data: {
success?: boolean;
message?: string | null;
internalMessage?: string | null;
});
toJSON(): any;
}
/**
* Information about a desktop icon
*/
export declare class DesktopIconDTO {
/** Icon name */
name: string;
/** Path to the icon's target */
path: string;
constructor(data: {
name: string;
path: string;
});
toJSON(): any;
}
/**
* Information about a taskbar icon
*/
export declare class TaskbarIconDTO {
/** Icon name */
name: string;
/** Path to the icon's target */
path: string;
constructor(data: {
name: string;
path: string;
});
toJSON(): any;
}
/**
* Information about an installed program
*/
export declare class InstalledProgramDTO {
/** Program name */
name: string;
/** Path to the executable */
executablePath: string;
constructor(data: {
name: string;
executablePath: string;
});
toJSON(): any;
}
/**
* Information about a UI control
*/
export declare class ControlDTO {
/** Control ID */
id: string;
/** Control name */
name: string | null;
/** Creation date (ISO 8601 format) */
creationDate: string;
/** Control type */
controlType: string | null;
/** Whether the control supports setting a value */
supportsSetValue: boolean | null;
/** Whether the control supports invoking */
supportsInvoke: boolean | null;
/** Current value of the control */
currentValue: string | null;
/** Child controls */
children: ControlDTO[] | null;
/** Parent control */
parent: ControlDTO | null;
/** Whether this is a Smooth Operator control */
isSmoothOperator: boolean;
constructor(data: {
id: string;
creationDate: string;
isSmoothOperator: boolean;
name?: string | null;
controlType?: string | null;
supportsSetValue?: boolean | null;
supportsInvoke?: boolean | null;
currentValue?: string | null;
children?: ControlDTO[] | null;
parent?: ControlDTO | null;
});
/** Recursively get all descendant controls. */
get childrenRecursive(): ControlDTO[];
/** Get all ancestor controls. */
get parentsRecursive(): ControlDTO[];
/** Find the closest ancestor control that is a Window. */
get parentWindow(): ControlDTO | null;
/** Custom serialization to avoid circular references and large payloads */
toJSON(): ControlDTOPlain;
}
/**
* Information about a window
*/
export declare class WindowInfoDTO {
/** Window ID */
id: string;
/** Window title */
title: string | null;
/** Path to the executable */
executablePath: string | null;
/** Whether the window is in the foreground */
isForeground: boolean | null;
/** Process name */
processName: string | null;
/** Whether the window is minimized */
isMinimized: boolean | null;
/** Detailed information (if requested) */
detailInfos: WindowDetailResponse | null;
constructor(data: {
id: string;
title?: string | null;
executablePath?: string | null;
isForeground?: boolean | null;
processName?: string | null;
isMinimized?: boolean | null;
detailInfos?: WindowDetailResponse | null;
});
toJSON(): any;
}
/**
* Wrapper for WindowDetailInfosDTO, potentially from older API versions
*/
export declare class WindowDetailResponse {
/** Detailed information */
details: WindowDetailInfosDTO | null;
/** Message describing the result */
message: string | null;
constructor(data: {
details?: WindowDetailInfosDTO | null;
message?: string | null;
});
toJSON(): any;
}
/**
* Detailed UI automation information for a window
*/
export declare class WindowDetailInfosDTO {
/** Note about the details */
note: string | null;
/** Information about the window */
window: WindowInfoDTO | null;
/** Root UI element */
userInterfaceElements: ControlDTO | null;
constructor(data: {
note?: string | null;
window?: WindowInfoDTO | null;
userInterfaceElements?: ControlDTO | null;
});
toJSON(): any;
}
/**
* Overview information about a single Chrome instance
*/
export declare class ChromeOverview {
/** Instance ID */
instanceId: string;
/** List of tabs */
tabs: TabData[];
/** Last update time (ISO 8601 format) */
lastUpdate: string;
constructor(data: {
instanceId: string;
tabs: TabData[];
lastUpdate: string;
});
toJSON(): any;
}
/**
* Data for a single tab within a Chrome instance
*/
export declare class TabData {
/** Tab ID */
id: string;
/** Tab URL */
url: string;
/** Whether the tab is active */
isActive: boolean;
/** HTML content (if requested) */
html: string | null;
/** Text content (if requested) */
text: string | null;
/** ID string (seems redundant?) */
idString: string | null;
/** Tab number */
tabNr: number;
constructor(data: {
id: string;
url: string;
isActive: boolean;
tabNr: number;
html?: string | null;
text?: string | null;
idString?: string | null;
});
toJSON(): any;
}
/**
* Information about the currently focused element
*/
export declare class FocusInformation {
/** Focused UI element */
focusedElement: ControlDTO | null;
/** Parent window of the focused element */
focusedElementParentWindow: WindowInfoDTO | null;
/** Other relevant elements in the same window */
someOtherElementsInSameWindowThatMightBeRelevant: ControlDTO[] | null;
/** Relevant elements in the current Chrome tab */
currentChromeTabMostRelevantElements: ChromeElementInfo[] | null;
/** Whether the focus is within Chrome */
isChrome: boolean;
/** Note about the focus */
note: string | null;
constructor(data: {
isChrome: boolean;
focusedElement?: ControlDTO | null;
focusedElementParentWindow?: WindowInfoDTO | null;
someOtherElementsInSameWindowThatMightBeRelevant?: ControlDTO[] | null;
currentChromeTabMostRelevantElements?: ChromeElementInfo[] | null;
note?: string | null;
});
toJSON(): any;
}
/**
* Detailed information about an element within a Chrome tab
*/
export declare class ChromeElementInfo {
/** Smooth Operator ID */
smoothOpId: string | null;
/** HTML tag name */
tagName: string | null;
/** CSS selector */
cssSelector: string | null;
/** Inner text */
innerText: string | null;
/** Whether the element is visible */
isVisible: boolean | null;
/** Relevance score */
score: number | null;
/** ARIA role */
role: string | null;
/** Element value */
value: string | null;
/** Element type attribute */
type: string | null;
/** Element name attribute */
name: string | null;
/** Element class attribute */
className: string | null;
/** Semantic meaning */
semantic: string | null;
/** Data attributes */
dataAttributes: string | null;
/** Truncated HTML */
truncatedHtml: string | null;
/** Bounding rectangle [x, y, width, height] */
boundingRect: number[] | null;
/** Center point */
centerPoint: Point | null;
constructor(data: {
smoothOpId?: string | null;
tagName?: string | null;
cssSelector?: string | null;
innerText?: string | null;
isVisible?: boolean | null;
score?: number | null;
role?: string | null;
value?: string | null;
type?: string | null;
name?: string | null;
className?: string | null;
semantic?: string | null;
dataAttributes?: string | null;
truncatedHtml?: string | null;
boundingRect?: number[] | null;
centerPoint?: Point | null;
});
toJSON(): any;
}
/**
* Response from the system overview endpoint
*/
export declare class OverviewResponse {
/** List of open windows */
windows: WindowInfoDTO[] | null;
/** Information about the focused element */
focusInfo: FocusInformation | null;
/** List of Chrome instances */
chromeInstances: ChromeOverview[] | null;
/** List of taskbar icons */
taskbarIcons: TaskbarIconDTO[] | null;
/** List of desktop icons */
desktopIcons: DesktopIconDTO[] | null;
/** List of installed programs */
installedPrograms: InstalledProgramDTO[] | null;
/** Important note */
importantNote: string | null;
constructor(data: {
windows?: WindowInfoDTO[] | null;
focusInfo?: FocusInformation | null;
chromeInstances?: ChromeOverview[] | null;
taskbarIcons?: TaskbarIconDTO[] | null;
desktopIcons?: DesktopIconDTO[] | null;
installedPrograms?: InstalledProgramDTO[] | null;
importantNote?: string | null;
});
toJSON(): any;
}
export {};