askui 0.26.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/cjs/core/ai-element/ai-element-collection.d.ts +1 -0
  2. package/dist/cjs/core/ai-element/ai-element-collection.js +3 -0
  3. package/dist/cjs/core/models/anthropic/askui-agent.d.ts +2 -0
  4. package/dist/cjs/core/models/anthropic/askui-agent.js +7 -0
  5. package/dist/cjs/core/models/anthropic/claude-agent.js +1 -1
  6. package/dist/cjs/core/models/anthropic/index.d.ts +1 -1
  7. package/dist/cjs/core/models/anthropic/tools/askui-api-tools.d.ts +19 -0
  8. package/dist/cjs/core/models/anthropic/tools/askui-api-tools.js +81 -0
  9. package/dist/cjs/core/models/anthropic/tools/base.d.ts +2 -0
  10. package/dist/cjs/core/models/anthropic/tools/os-agent-tools.d.ts +11 -1
  11. package/dist/cjs/core/models/anthropic/tools/os-agent-tools.js +54 -10
  12. package/dist/cjs/core/runner-protocol/request/get-starting-arguments-request.d.ts +5 -0
  13. package/dist/cjs/core/runner-protocol/request/get-starting-arguments-request.js +10 -0
  14. package/dist/cjs/core/runner-protocol/request/index.d.ts +1 -0
  15. package/dist/cjs/core/runner-protocol/request/index.js +3 -1
  16. package/dist/cjs/core/runner-protocol/response/index.d.ts +7 -0
  17. package/dist/cjs/execution/execution-runtime.d.ts +1 -0
  18. package/dist/cjs/execution/execution-runtime.js +6 -0
  19. package/dist/cjs/execution/ui-control-client.d.ts +76 -0
  20. package/dist/cjs/execution/ui-control-client.js +161 -6
  21. package/dist/cjs/execution/ui-controller-client.d.ts +2 -1
  22. package/dist/cjs/execution/ui-controller-client.js +3 -0
  23. package/dist/cjs/lib/interactive_cli/create-example-project.js +1 -1
  24. package/dist/cjs/main.d.ts +1 -1
  25. package/dist/esm/core/ai-element/ai-element-collection.d.ts +1 -0
  26. package/dist/esm/core/ai-element/ai-element-collection.js +3 -0
  27. package/dist/esm/core/models/anthropic/askui-agent.d.ts +2 -0
  28. package/dist/esm/core/models/anthropic/askui-agent.js +8 -1
  29. package/dist/esm/core/models/anthropic/claude-agent.js +1 -1
  30. package/dist/esm/core/models/anthropic/index.d.ts +1 -1
  31. package/dist/esm/core/models/anthropic/index.js +1 -1
  32. package/dist/esm/core/models/anthropic/tools/askui-api-tools.d.ts +19 -0
  33. package/dist/esm/core/models/anthropic/tools/askui-api-tools.js +76 -0
  34. package/dist/esm/core/models/anthropic/tools/base.d.ts +2 -0
  35. package/dist/esm/core/models/anthropic/tools/os-agent-tools.d.ts +11 -1
  36. package/dist/esm/core/models/anthropic/tools/os-agent-tools.js +52 -9
  37. package/dist/esm/core/runner-protocol/request/get-starting-arguments-request.d.ts +5 -0
  38. package/dist/esm/core/runner-protocol/request/get-starting-arguments-request.js +6 -0
  39. package/dist/esm/core/runner-protocol/request/index.d.ts +1 -0
  40. package/dist/esm/core/runner-protocol/request/index.js +1 -0
  41. package/dist/esm/core/runner-protocol/response/index.d.ts +7 -0
  42. package/dist/esm/execution/execution-runtime.d.ts +1 -0
  43. package/dist/esm/execution/execution-runtime.js +6 -0
  44. package/dist/esm/execution/ui-control-client.d.ts +76 -0
  45. package/dist/esm/execution/ui-control-client.js +161 -6
  46. package/dist/esm/execution/ui-controller-client.d.ts +2 -1
  47. package/dist/esm/execution/ui-controller-client.js +4 -1
  48. package/dist/esm/lib/interactive_cli/create-example-project.js +1 -1
  49. package/dist/esm/main.d.ts +1 -1
  50. package/dist/esm/main.js +1 -1
  51. package/package.json +1 -1
@@ -8,5 +8,6 @@ export declare class AIElementCollection {
8
8
  static collectAIElements(workspaceId: string | undefined, aiElementArgs: AIElementArgs): Promise<AIElementCollection>;
9
9
  getByName(name: string): CustomElementJson[];
10
10
  getByNames(names: string[]): CustomElementJson[];
11
+ getNames(): string[];
11
12
  private static CollectAiElementsFromLocation;
12
13
  }
@@ -73,6 +73,9 @@ class AIElementCollection {
73
73
  }
74
74
  return names.flatMap((name) => this.getByName(name));
75
75
  }
76
+ getNames() {
77
+ return [...new Set(this.elements.map((element) => element.name))];
78
+ }
76
79
  static CollectAiElementsFromLocation(aiElementLocation) {
77
80
  const files = fs_extra_1.default.readdirSync(aiElementLocation);
78
81
  if (files.length === 0) {
@@ -1,3 +1,4 @@
1
+ import { OsAgentHandler } from './tools/os-agent-tools';
1
2
  import { ClaudeAgent } from './claude-agent';
2
3
  import { ExecutionRuntime } from '../../../execution/execution-runtime';
3
4
  export declare class AskUIAgent extends ClaudeAgent {
@@ -6,6 +7,7 @@ export declare class AskUIAgent extends ClaudeAgent {
6
7
  constructor(executionRuntime: ExecutionRuntime);
7
8
  isConnected(): boolean;
8
9
  initializeOsAgentHandler(): Promise<void>;
10
+ getOsAgentHandler(): OsAgentHandler;
9
11
  configureAsDesktopAgent(): Promise<void>;
10
12
  configureAsAndroidAgent(): Promise<void>;
11
13
  private static DesktopSystemPrompt;
@@ -26,6 +26,12 @@ class AskUIAgent extends claude_agent_1.ClaudeAgent {
26
26
  this.osAgentHandler = yield os_agent_tools_1.OsAgentHandler.createInstance(this.executionRuntime);
27
27
  });
28
28
  }
29
+ getOsAgentHandler() {
30
+ if (!this.osAgentHandler) {
31
+ throw new Error('Agent OS client is not connected');
32
+ }
33
+ return this.osAgentHandler;
34
+ }
29
35
  configureAsDesktopAgent() {
30
36
  return __awaiter(this, void 0, void 0, function* () {
31
37
  if (!this.osAgentHandler) {
@@ -33,6 +39,7 @@ class AskUIAgent extends claude_agent_1.ClaudeAgent {
33
39
  }
34
40
  const tools = [
35
41
  new os_agent_tools_1.AgentErrorTool(),
42
+ new os_agent_tools_1.PrintTool(),
36
43
  new os_agent_tools_1.ScreenShotTool(this.osAgentHandler),
37
44
  new os_agent_tools_1.MouseMoveTool(this.osAgentHandler),
38
45
  new os_agent_tools_1.MouseClickTool(this.osAgentHandler),
@@ -26,7 +26,7 @@ class ClaudeAgent {
26
26
  this.tools = [];
27
27
  this.history = {};
28
28
  this.toolChoice = {
29
- type: 'any',
29
+ type: 'auto',
30
30
  };
31
31
  }
32
32
  setToolChoice(toolChoice) {
@@ -1,3 +1,3 @@
1
1
  export { AskUIAgent } from './askui-agent';
2
- export { ToolFailure, ToolError, BaseAgentTool } from './tools/base';
2
+ export { ToolFailure, ToolError, BaseAgentTool, BetaTool, ToolResult, } from './tools/base';
3
3
  export { AgentHistory, ActOptions } from './claude-agent';
@@ -0,0 +1,19 @@
1
+ import { DetectedElement } from '../../../model/annotation-result/detected-element';
2
+ import { BaseAgentTool, ToolResult, BetaTool } from './base';
3
+ import { OsAgentHandler } from './os-agent-tools';
4
+ export declare class AskUIGetAskUIElementTool extends BaseAgentTool {
5
+ private osAgentHandler;
6
+ private locatorFunction;
7
+ private elementType;
8
+ constructor(osAgentHandler: OsAgentHandler, locatorFunction: (aiElementName: string) => Promise<DetectedElement[]>, elementType: string);
9
+ execute(params: {
10
+ elementName: string;
11
+ }): Promise<ToolResult>;
12
+ toParams(): BetaTool;
13
+ }
14
+ export declare class AskUIListAIElementTool extends BaseAgentTool {
15
+ private listFunction;
16
+ constructor(listFunction: () => Promise<string[]>);
17
+ execute(): Promise<ToolResult>;
18
+ toParams(): BetaTool;
19
+ }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AskUIListAIElementTool = exports.AskUIGetAskUIElementTool = void 0;
13
+ const base_1 = require("./base");
14
+ class AskUIGetAskUIElementTool extends base_1.BaseAgentTool {
15
+ constructor(osAgentHandler, locatorFunction, elementType) {
16
+ super();
17
+ this.osAgentHandler = osAgentHandler;
18
+ this.locatorFunction = locatorFunction;
19
+ this.elementType = elementType;
20
+ }
21
+ execute(params) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ const { elementName } = params;
24
+ const detectedElements = yield this.locatorFunction(elementName);
25
+ const scaledElementsBoundingBoxes = detectedElements.map((element) => {
26
+ const xMid = (element.bndbox.xmin + element.bndbox.xmax) / 2;
27
+ const yMid = (element.bndbox.ymin + element.bndbox.ymax) / 2;
28
+ const [x, y] = this.osAgentHandler.scaleCoordinates('computer', xMid, yMid);
29
+ return {
30
+ x, y,
31
+ };
32
+ });
33
+ return {
34
+ output: `Found ${scaledElementsBoundingBoxes.length} elements of type ${this.elementType}. center coordinates: ${JSON.stringify(scaledElementsBoundingBoxes)}`,
35
+ };
36
+ });
37
+ }
38
+ toParams() {
39
+ return {
40
+ description: `Locates and retrieves the bounding box coordinates of AskUI ${this.elementType} elements on the screen. ` +
41
+ `This tool is essential for UI automation as it provides the exact pixel coordinates needed to interact with UI elements. ` +
42
+ `The coordinates returned can be used for clicking, hovering, or other mouse interactions. ` +
43
+ `Use this tool when you need to find and interact with specific ${this.elementType} UI elements by their semantic names.`,
44
+ input_schema: {
45
+ properties: {
46
+ elementName: {
47
+ type: 'string',
48
+ description: `The semantic name or identifier of the ${this.elementType} element to locate on the screen. `
49
+ },
50
+ },
51
+ required: ['elementName'],
52
+ type: 'object',
53
+ },
54
+ name: `get_askui_${this.elementType}_element_tool`,
55
+ };
56
+ }
57
+ }
58
+ exports.AskUIGetAskUIElementTool = AskUIGetAskUIElementTool;
59
+ class AskUIListAIElementTool extends base_1.BaseAgentTool {
60
+ constructor(listFunction) {
61
+ super();
62
+ this.listFunction = listFunction;
63
+ }
64
+ execute() {
65
+ return __awaiter(this, void 0, void 0, function* () {
66
+ const elementNames = yield this.listFunction();
67
+ return {
68
+ output: `Found ${elementNames.length} element names that can be used to retrieve bounding boxes. Names: ${JSON.stringify(elementNames)}`,
69
+ };
70
+ });
71
+ }
72
+ toParams() {
73
+ return {
74
+ description: 'Retrieves a comprehensive list of all valid AskUI AI element names that can be used for element location and interaction. ' +
75
+ 'The returned names can be used as input for the get_askui_aiElement_element_tool to locate specific ai elements. ',
76
+ input_schema: { type: 'object', properties: {}, required: [] },
77
+ name: 'list_ai_element_names_tool',
78
+ };
79
+ }
80
+ }
81
+ exports.AskUIListAIElementTool = AskUIListAIElementTool;
@@ -1,3 +1,5 @@
1
+ import { BetaTool as AnthropicBetaTool } from '@anthropic-ai/sdk/resources/beta/messages/messages';
2
+ export type BetaTool = AnthropicBetaTool;
1
3
  export interface ToolResult {
2
4
  output?: string;
3
5
  error?: string;
@@ -24,7 +24,7 @@ export declare class OsAgentHandler {
24
24
  };
25
25
  setTargetResolution(width: number, height: number): void;
26
26
  takeScreenshot(): Promise<string>;
27
- private scaleCoordinates;
27
+ scaleCoordinates(source: 'api' | 'computer', x: number, y: number): [number, number];
28
28
  requestControl(controlCommand: ControlCommand): Promise<void>;
29
29
  mouseMove(x: number, y: number): Promise<void>;
30
30
  mouseClick(button: "left" | "right" | "middle", doubleClick: boolean): Promise<void>;
@@ -35,6 +35,9 @@ export declare class OsAgentHandler {
35
35
  desktopKeyHoldDown(key: PC_AND_MODIFIER_KEY, modifiers?: MODIFIER_KEY[]): Promise<void>;
36
36
  desktopKeyRelease(key: PC_AND_MODIFIER_KEY, modifiers?: MODIFIER_KEY[]): Promise<void>;
37
37
  typeText(text: string): Promise<void>;
38
+ androidKeyPress(key: ANDROID_KEY): Promise<void>;
39
+ androidKeySequencePress(keys: ANDROID_KEY[]): Promise<void>;
40
+ executeShellCommand(command: string): Promise<void>;
38
41
  }
39
42
  export declare class ScreenShotTool extends BaseAgentTool {
40
43
  private osAgentHandler;
@@ -165,3 +168,10 @@ export declare class WaitTool extends BaseAgentTool {
165
168
  }): Promise<ToolResult>;
166
169
  toParams(): BetaTool;
167
170
  }
171
+ export declare class PrintTool extends BaseAgentTool {
172
+ constructor();
173
+ execute(command: {
174
+ text: string;
175
+ }): Promise<ToolResult>;
176
+ toParams(): BetaTool;
177
+ }
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.WaitTool = exports.ExecuteShellCommandTool = exports.AgentErrorTool = exports.AndroidSequenceKeyPressTool = exports.AndroidSingleKeyPressTool = exports.TypeTool = exports.DesktopKeyReleaseTool = exports.DesktopKeyHoldDownTool = exports.DesktopPressAndReleaseKeysTool = exports.MouseReleaseLeftButtonTool = exports.MouseHoldLeftButtonDownTool = exports.MouseDragAndDropTool = exports.MouseScrollTool = exports.MouseClickTool = exports.MouseMoveTool = exports.ScreenShotTool = exports.OsAgentHandler = void 0;
12
+ exports.PrintTool = exports.WaitTool = exports.ExecuteShellCommandTool = exports.AgentErrorTool = exports.AndroidSequenceKeyPressTool = exports.AndroidSingleKeyPressTool = exports.TypeTool = exports.DesktopKeyReleaseTool = exports.DesktopKeyHoldDownTool = exports.DesktopPressAndReleaseKeysTool = exports.MouseReleaseLeftButtonTool = exports.MouseHoldLeftButtonDownTool = exports.MouseDragAndDropTool = exports.MouseScrollTool = exports.MouseClickTool = exports.MouseMoveTool = exports.ScreenShotTool = exports.OsAgentHandler = void 0;
13
13
  const dsl_1 = require("../../../../execution/dsl");
14
14
  const base_1 = require("./base");
15
15
  const ui_control_commands_1 = require("../../../ui-control-commands");
@@ -205,6 +205,24 @@ class OsAgentHandler {
205
205
  yield this.requestControl(controlCommand);
206
206
  });
207
207
  }
208
+ androidKeyPress(key) {
209
+ return __awaiter(this, void 0, void 0, function* () {
210
+ const controlCommand = new ui_control_commands_1.ControlCommand(ui_control_commands_1.ControlCommandCode.OK, [new ui_control_commands_1.Action(ui_control_commands_1.InputEvent.PRESS_ANDROID_SINGLE_KEY, { x: 0, y: 0 }, key, {})]);
211
+ yield this.requestControl(controlCommand);
212
+ });
213
+ }
214
+ androidKeySequencePress(keys) {
215
+ return __awaiter(this, void 0, void 0, function* () {
216
+ const controlCommand = new ui_control_commands_1.ControlCommand(ui_control_commands_1.ControlCommandCode.OK, [new ui_control_commands_1.Action(ui_control_commands_1.InputEvent.PRESS_ANDROID_KEY_SEQUENCE, { x: 0, y: 0 }, keys.join(' '), {})]);
217
+ yield this.requestControl(controlCommand);
218
+ });
219
+ }
220
+ executeShellCommand(command) {
221
+ return __awaiter(this, void 0, void 0, function* () {
222
+ const controlCommand = new ui_control_commands_1.ControlCommand(ui_control_commands_1.ControlCommandCode.OK, [new ui_control_commands_1.Action(ui_control_commands_1.InputEvent.EXECUTE_COMMAND, { x: 0, y: 0 }, command, {})]);
223
+ yield this.requestControl(controlCommand);
224
+ });
225
+ }
208
226
  }
209
227
  exports.OsAgentHandler = OsAgentHandler;
210
228
  class ScreenShotTool extends base_1.BaseAgentTool {
@@ -556,8 +574,7 @@ class TypeTool extends base_1.BaseAgentTool {
556
574
  }
557
575
  execute(command) {
558
576
  return __awaiter(this, void 0, void 0, function* () {
559
- const controlCommand = new ui_control_commands_1.ControlCommand(ui_control_commands_1.ControlCommandCode.OK, [new ui_control_commands_1.Action(ui_control_commands_1.InputEvent.TYPE, { x: 0, y: 0 }, command.text, {})]);
560
- yield this.osAgentHandler.requestControl(controlCommand);
577
+ yield this.osAgentHandler.typeText(command.text);
561
578
  return {
562
579
  output: `Typed text: ${command.text}`,
563
580
  };
@@ -588,8 +605,7 @@ class AndroidSingleKeyPressTool extends base_1.BaseAgentTool {
588
605
  }
589
606
  execute(command) {
590
607
  return __awaiter(this, void 0, void 0, function* () {
591
- const controlCommand = new ui_control_commands_1.ControlCommand(ui_control_commands_1.ControlCommandCode.OK, [new ui_control_commands_1.Action(ui_control_commands_1.InputEvent.PRESS_KEY_SEQUENCE, { x: 0, y: 0 }, command.key, {})]);
592
- yield this.osAgentHandler.requestControl(controlCommand);
608
+ yield this.osAgentHandler.androidKeyPress(command.key);
593
609
  return {
594
610
  output: `Pressed Android key ${command.key}`,
595
611
  };
@@ -621,8 +637,7 @@ class AndroidSequenceKeyPressTool extends base_1.BaseAgentTool {
621
637
  }
622
638
  execute(command) {
623
639
  return __awaiter(this, void 0, void 0, function* () {
624
- const controlCommand = new ui_control_commands_1.ControlCommand(ui_control_commands_1.ControlCommandCode.OK, [new ui_control_commands_1.Action(ui_control_commands_1.InputEvent.PRESS_KEY_SEQUENCE, { x: 0, y: 0 }, command.keys.join(' '), {})]);
625
- yield this.osAgentHandler.requestControl(controlCommand);
640
+ yield this.osAgentHandler.androidKeySequencePress(command.keys);
626
641
  return {
627
642
  output: `Pressed Android keys: ${command.keys.join(', ')}`,
628
643
  };
@@ -662,7 +677,7 @@ class AgentErrorTool extends base_1.BaseAgentTool {
662
677
  toParams() {
663
678
  return {
664
679
  name: 'agent_error_tool',
665
- description: 'Raises an error in the agent',
680
+ description: 'Intentionally raises an error to signal that the agent cannot proceed with the current task. Use this when the agent encounters an unsolvable problem, gets stuck in a loop, or needs to communicate a critical failure that prevents further automation.',
666
681
  input_schema: {
667
682
  type: 'object',
668
683
  properties: {
@@ -684,8 +699,7 @@ class ExecuteShellCommandTool extends base_1.BaseAgentTool {
684
699
  }
685
700
  execute(command) {
686
701
  return __awaiter(this, void 0, void 0, function* () {
687
- const controlCommand = new ui_control_commands_1.ControlCommand(ui_control_commands_1.ControlCommandCode.OK, [new ui_control_commands_1.Action(ui_control_commands_1.InputEvent.EXECUTE_COMMAND, { x: 0, y: 0 }, command.command, {})]);
688
- yield this.osAgentHandler.requestControl(controlCommand);
702
+ yield this.osAgentHandler.executeShellCommand(command.command);
689
703
  return {
690
704
  output: `Executed shell command: ${command.command}`,
691
705
  };
@@ -739,3 +753,33 @@ class WaitTool extends base_1.BaseAgentTool {
739
753
  }
740
754
  }
741
755
  exports.WaitTool = WaitTool;
756
+ class PrintTool extends base_1.BaseAgentTool {
757
+ constructor() {
758
+ super();
759
+ }
760
+ execute(command) {
761
+ return __awaiter(this, void 0, void 0, function* () {
762
+ console.log(command.text);
763
+ return {
764
+ output: `Printed text: ${command.text}`,
765
+ };
766
+ });
767
+ }
768
+ toParams() {
769
+ return {
770
+ name: 'print_tool',
771
+ description: 'Outputs text to the console for debugging, status updates, or user communication. Useful for providing feedback about automation progress, errors, or important information during test execution.',
772
+ input_schema: {
773
+ type: 'object',
774
+ properties: {
775
+ text: {
776
+ type: 'string',
777
+ description: 'The text to output to the console.',
778
+ },
779
+ },
780
+ required: ['text'],
781
+ },
782
+ };
783
+ }
784
+ }
785
+ exports.PrintTool = PrintTool;
@@ -0,0 +1,5 @@
1
+ import { RunnerProtocolRequest } from './runner-protocol-request';
2
+ export declare class GetStartingArgumentsRequest implements RunnerProtocolRequest {
3
+ static msgName: string;
4
+ msgName: string;
5
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetStartingArgumentsRequest = void 0;
4
+ class GetStartingArgumentsRequest {
5
+ constructor() {
6
+ this.msgName = GetStartingArgumentsRequest.msgName;
7
+ }
8
+ }
9
+ exports.GetStartingArgumentsRequest = GetStartingArgumentsRequest;
10
+ GetStartingArgumentsRequest.msgName = 'GET_STARTING_ARGUMENTS_REQUEST';
@@ -6,3 +6,4 @@ export { RunnerProtocolRequest } from './runner-protocol-request';
6
6
  export { StartRecordingRequest } from './start-recording-request';
7
7
  export { StopRecordingRequest } from './stop-recording-request';
8
8
  export { GetProcessPidRequest } from './get-server-process-pid';
9
+ export { GetStartingArgumentsRequest } from './get-starting-arguments-request';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GetProcessPidRequest = exports.StopRecordingRequest = exports.StartRecordingRequest = exports.ReadRecordingRequest = exports.InteractiveAnnotationRequest = exports.ControlRequest = exports.CaptureScreenshotRequest = void 0;
3
+ exports.GetStartingArgumentsRequest = exports.GetProcessPidRequest = exports.StopRecordingRequest = exports.StartRecordingRequest = exports.ReadRecordingRequest = exports.InteractiveAnnotationRequest = exports.ControlRequest = exports.CaptureScreenshotRequest = void 0;
4
4
  var capture_screenshot_request_1 = require("./capture-screenshot-request");
5
5
  Object.defineProperty(exports, "CaptureScreenshotRequest", { enumerable: true, get: function () { return capture_screenshot_request_1.CaptureScreenshotRequest; } });
6
6
  var control_request_1 = require("./control-request");
@@ -15,3 +15,5 @@ var stop_recording_request_1 = require("./stop-recording-request");
15
15
  Object.defineProperty(exports, "StopRecordingRequest", { enumerable: true, get: function () { return stop_recording_request_1.StopRecordingRequest; } });
16
16
  var get_server_process_pid_1 = require("./get-server-process-pid");
17
17
  Object.defineProperty(exports, "GetProcessPidRequest", { enumerable: true, get: function () { return get_server_process_pid_1.GetProcessPidRequest; } });
18
+ var get_starting_arguments_request_1 = require("./get-starting-arguments-request");
19
+ Object.defineProperty(exports, "GetStartingArgumentsRequest", { enumerable: true, get: function () { return get_starting_arguments_request_1.GetStartingArgumentsRequest; } });
@@ -100,3 +100,10 @@ export interface GetProcessPidResponse {
100
100
  };
101
101
  msgName: 'GET_PROCESS_PID_RESPONSE';
102
102
  }
103
+ export interface GetStartingArgumentsResponse {
104
+ data: {
105
+ error?: string;
106
+ arguments: Record<string, string>;
107
+ };
108
+ msgName: 'GET_STARTING_ARGUMENTS_RESPONSE';
109
+ }
@@ -37,6 +37,7 @@ export declare class ExecutionRuntime {
37
37
  private predictCommand;
38
38
  annotateInteractively(): Promise<void>;
39
39
  takeScreenshotIfImageisNotProvided(imagePath?: string): Promise<string>;
40
+ getStartingArguments(): Promise<Record<string, string | number | boolean>>;
40
41
  getDetectedElements(instruction: string, customElementJson?: CustomElementJson[]): Promise<DetectedElement[]>;
41
42
  annotateImage(imagePath?: string, customElementJson?: CustomElementJson[], elements?: DetectedElement[]): Promise<Annotation>;
42
43
  predictVQA(prompt: string, config?: object): Promise<any>;
@@ -183,6 +183,12 @@ class ExecutionRuntime {
183
183
  return base64Image;
184
184
  });
185
185
  }
186
+ getStartingArguments() {
187
+ return __awaiter(this, void 0, void 0, function* () {
188
+ const startingArgumentsResponse = yield this.uiControllerClient.getStartingArguments();
189
+ return startingArgumentsResponse.data.arguments;
190
+ });
191
+ }
186
192
  getDetectedElements(instruction, customElementJson) {
187
193
  return __awaiter(this, void 0, void 0, function* () {
188
194
  let customElements = [];
@@ -55,6 +55,7 @@ export declare class UiControlClient extends ApiCommands {
55
55
  stopVideoRecording(): Promise<void>;
56
56
  readVideoRecording(): Promise<string>;
57
57
  private shouldAnnotateAfterCommandExecution;
58
+ private beforeNoneInferenceCallCommandExecution;
58
59
  private afterCommandExecution;
59
60
  annotate(annotationRequest?: AnnotationRequest): Promise<Annotation>;
60
61
  annotateInteractively(): Promise<void>;
@@ -475,6 +476,28 @@ export declare class UiControlClient extends ApiCommands {
475
476
  * @returns {ExpectAllExistResult.elements} - ExpectExistenceElement[].
476
477
  */
477
478
  expectAllExist(query: ElementExistsQuery[]): Promise<ExpectAllExistResult>;
479
+ /**
480
+ * Holds down a key on the keyboard.
481
+ *
482
+ * **Examples:**
483
+ * ```typescript
484
+ * await aui.keyDown('a').exec();
485
+ * ```
486
+ *
487
+ * @param {PC_AND_MODIFIER_KEY} key - The key to hold down.
488
+ */
489
+ keyDown(key: PC_AND_MODIFIER_KEY): Executable;
490
+ /**
491
+ * Releases a key up that was previously held down.
492
+ *
493
+ * **Examples:**
494
+ * ```typescript
495
+ * await aui.keyUp('a').exec();
496
+ * ```
497
+ *
498
+ * @param {PC_AND_MODIFIER_KEY} key - The key to release up.
499
+ */
500
+ keyUp(key: PC_AND_MODIFIER_KEY): Executable;
478
501
  /**
479
502
  * Instructs the agent to autonomously achieve a specified goal through UI interactions.
480
503
  *
@@ -573,4 +596,57 @@ export declare class UiControlClient extends ApiCommands {
573
596
  */
574
597
  act(goal: string, options?: ActOptions): Promise<AgentHistory>;
575
598
  act(goal: string, imagePathOrBase64String: string, options?: ActOptions): Promise<AgentHistory>;
599
+ /**
600
+ * Adds tools to the agent that allow it to interact with AI elements.
601
+ *
602
+ * @returns {Promise<void>} - A promise that resolves when the tools are added to the agent.
603
+ */
604
+ addAIElementsToolsToAgent(): Promise<void>;
605
+ /**
606
+ * Retrieves the starting arguments used when the controller server was initialized.
607
+ *
608
+ * Useful for debugging, logging, or verifying the current server configuration.
609
+ *
610
+ * @property {string} displayNum - Display number controlled by the controller
611
+ * @property {boolean} minimize - Whether controller starts minimized
612
+ * @property {string} runtime - Runtime type ("desktop" or "android")
613
+ * @property {number} port - Communication port
614
+ * @property {number} actionWaitTime - Action wait time
615
+ * @property {string} host - Host address
616
+ * @property {string} logFile - Log file path
617
+ * @property {boolean} hideOverlay - Whether overlay is hidden
618
+ * @property {boolean} debugDraw - Whether debug drawing is enabled
619
+ * @property {string} deviceId - Android device ID
620
+ * @property {string} configFile - Configuration file path
621
+ * @property {string} logLevel - Logging level
622
+ *
623
+ * @example
624
+ * ```typescript
625
+ * const startingArguments = await aui.getControllerStartingArguments();
626
+ * console.log(startingArguments);
627
+ * // Output example:
628
+ * // {
629
+ * // displayNum: 0,
630
+ * // minimize: true,
631
+ * // runtime: 'desktop',
632
+ * // port: 5000,
633
+ * // actionWaitTime: 1000,
634
+ * // host: '127.0.0.1',
635
+ * // logFile: '/tmp/askui/askui-server.log',
636
+ * // hideOverlay: false,
637
+ * // debugDraw: false,
638
+ * // deviceId: 'emulator-5554',
639
+ * // configFile: '/tmp/askui/askui-config.json',
640
+ * // logLevel: 'info',
641
+ * // }
642
+ * ```
643
+ *
644
+ * @example Retrieving Android device ID:
645
+ * ```typescript
646
+ * const startingArguments = await aui.getControllerStartingArguments();
647
+ * console.log(startingArguments.deviceId);
648
+ * // Output example: "emulator-5554"
649
+ * ```
650
+ */
651
+ getControllerStartingArguments(): Promise<Record<'displayNum' | 'minimize' | 'runtime' | 'port' | 'actionWaitTime' | 'host' | 'logFile' | 'hideOverlay' | 'debugDraw' | 'deviceId' | 'configFile' | 'logLevel', string | number | boolean>>;
576
652
  }