@aiscene/shared 8.0.2 → 8.0.4

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 (177) hide show
  1. package/dist/es/agent-tools/agent-behavior-init-args.mjs +44 -0
  2. package/dist/es/agent-tools/base-tools.mjs +163 -0
  3. package/dist/es/agent-tools/chrome-path.mjs +50 -0
  4. package/dist/es/agent-tools/cli-report-session.mjs +78 -0
  5. package/dist/es/agent-tools/error-formatter.mjs +106 -0
  6. package/dist/es/agent-tools/index.mjs +9 -0
  7. package/dist/es/agent-tools/init-arg-utils.mjs +38 -0
  8. package/dist/es/agent-tools/observation-artifact.mjs +5 -0
  9. package/dist/es/agent-tools/observation-record.mjs +248 -0
  10. package/dist/es/agent-tools/tool-defaults.mjs +54 -0
  11. package/dist/es/agent-tools/tool-generator.mjs +529 -0
  12. package/dist/es/agent-tools/types.mjs +3 -0
  13. package/dist/es/agent-tools/user-prompt.mjs +66 -0
  14. package/dist/es/cli/cli-args.mjs +95 -0
  15. package/dist/es/cli/cli-error.mjs +24 -0
  16. package/dist/es/cli/cli-runner.mjs +10 -40
  17. package/dist/es/cli/index.mjs +4 -2
  18. package/dist/es/cli/interrupt.mjs +116 -0
  19. package/dist/es/cli/record-command.mjs +130 -0
  20. package/dist/es/cli/screenshot-file.mjs +24 -0
  21. package/dist/es/cli/verbose-ai-act.mjs +230 -0
  22. package/dist/es/cli/verbose-screenshot.mjs +134 -0
  23. package/dist/es/cli/verbose.mjs +404 -0
  24. package/dist/es/constants/example-code.mjs +2 -2
  25. package/dist/es/constants/index.mjs +6 -1
  26. package/dist/es/env/model-config-manager.mjs +3 -0
  27. package/dist/es/env/parse-model-config.mjs +6 -1
  28. package/dist/es/env/types.mjs +4 -1
  29. package/dist/es/env/utils.mjs +1 -9
  30. package/dist/es/extractor/index.mjs +2 -2
  31. package/dist/es/img/index.mjs +2 -2
  32. package/dist/es/img/info.mjs +58 -17
  33. package/dist/es/img/photon-loader.mjs +4 -0
  34. package/dist/es/key-alias-utils.mjs +19 -0
  35. package/dist/es/mcp/base-server.mjs +10 -9
  36. package/dist/es/mcp/base-tools.mjs +72 -4
  37. package/dist/es/mcp/cli-report-session.mjs +78 -0
  38. package/dist/es/mcp/error-formatter.mjs +19 -0
  39. package/dist/es/mcp/index.mjs +2 -0
  40. package/dist/es/mcp/init-arg-utils.mjs +38 -0
  41. package/dist/es/mcp/inject-report-html-plugin.mjs +1 -1
  42. package/dist/es/mcp/tool-generator.mjs +65 -17
  43. package/dist/es/node/fs.mjs +1 -1
  44. package/dist/es/recorder.mjs +249 -0
  45. package/dist/lib/agent-tools/agent-behavior-init-args.js +87 -0
  46. package/dist/lib/agent-tools/base-tools.js +197 -0
  47. package/dist/lib/agent-tools/chrome-path.js +87 -0
  48. package/dist/lib/agent-tools/cli-report-session.js +121 -0
  49. package/dist/lib/agent-tools/error-formatter.js +149 -0
  50. package/dist/lib/agent-tools/index.js +114 -0
  51. package/dist/lib/agent-tools/init-arg-utils.js +78 -0
  52. package/dist/lib/agent-tools/observation-artifact.js +42 -0
  53. package/dist/lib/agent-tools/observation-record.js +297 -0
  54. package/dist/lib/agent-tools/tool-defaults.js +97 -0
  55. package/dist/lib/agent-tools/tool-generator.js +569 -0
  56. package/dist/lib/agent-tools/types.js +40 -0
  57. package/dist/lib/agent-tools/user-prompt.js +103 -0
  58. package/dist/lib/cli/cli-args.js +138 -0
  59. package/dist/lib/cli/cli-error.js +61 -0
  60. package/dist/lib/cli/cli-runner.js +19 -46
  61. package/dist/lib/cli/index.js +8 -3
  62. package/dist/lib/cli/interrupt.js +156 -0
  63. package/dist/lib/cli/record-command.js +164 -0
  64. package/dist/lib/cli/screenshot-file.js +58 -0
  65. package/dist/lib/cli/verbose-ai-act.js +273 -0
  66. package/dist/lib/cli/verbose-screenshot.js +177 -0
  67. package/dist/lib/cli/verbose.js +465 -0
  68. package/dist/lib/constants/example-code.js +2 -2
  69. package/dist/lib/constants/index.js +23 -3
  70. package/dist/lib/env/model-config-manager.js +3 -0
  71. package/dist/lib/env/parse-model-config.js +6 -1
  72. package/dist/lib/env/types.js +9 -0
  73. package/dist/lib/env/utils.js +0 -11
  74. package/dist/lib/extractor/index.js +3 -0
  75. package/dist/lib/img/index.js +3 -0
  76. package/dist/lib/img/info.js +65 -18
  77. package/dist/lib/img/photon-loader.js +38 -0
  78. package/dist/lib/key-alias-utils.js +62 -0
  79. package/dist/lib/mcp/base-server.js +11 -10
  80. package/dist/lib/mcp/base-tools.js +74 -6
  81. package/dist/lib/mcp/cli-report-session.js +121 -0
  82. package/dist/lib/mcp/error-formatter.js +53 -0
  83. package/dist/lib/mcp/index.js +24 -10
  84. package/dist/lib/mcp/init-arg-utils.js +78 -0
  85. package/dist/lib/mcp/inject-report-html-plugin.js +1 -1
  86. package/dist/lib/mcp/tool-generator.js +74 -26
  87. package/dist/lib/node/fs.js +1 -1
  88. package/dist/lib/recorder.js +307 -0
  89. package/dist/types/agent-tools/agent-behavior-init-args.d.ts +17 -0
  90. package/dist/types/agent-tools/base-tools.d.ts +158 -0
  91. package/dist/types/agent-tools/chrome-path.d.ts +2 -0
  92. package/dist/types/agent-tools/cli-report-session.d.ts +12 -0
  93. package/dist/types/agent-tools/error-formatter.d.ts +30 -0
  94. package/dist/types/agent-tools/index.d.ts +9 -0
  95. package/dist/types/agent-tools/init-arg-utils.d.ts +13 -0
  96. package/dist/types/agent-tools/observation-artifact.d.ts +10 -0
  97. package/dist/types/agent-tools/observation-record.d.ts +38 -0
  98. package/dist/types/agent-tools/tool-defaults.d.ts +63 -0
  99. package/dist/types/agent-tools/tool-generator.d.ts +13 -0
  100. package/dist/types/agent-tools/types.d.ts +213 -0
  101. package/dist/types/agent-tools/user-prompt.d.ts +13 -0
  102. package/dist/types/cli/cli-args.d.ts +8 -0
  103. package/dist/types/cli/cli-error.d.ts +5 -0
  104. package/dist/types/cli/cli-runner.d.ts +4 -7
  105. package/dist/types/cli/index.d.ts +3 -1
  106. package/dist/types/cli/interrupt.d.ts +49 -0
  107. package/dist/types/cli/record-command.d.ts +3 -0
  108. package/dist/types/cli/screenshot-file.d.ts +10 -0
  109. package/dist/types/cli/verbose-ai-act.d.ts +44 -0
  110. package/dist/types/cli/verbose-screenshot.d.ts +10 -0
  111. package/dist/types/cli/verbose.d.ts +40 -0
  112. package/dist/types/constants/example-code.d.ts +1 -1
  113. package/dist/types/constants/index.d.ts +5 -0
  114. package/dist/types/env/types.d.ts +14 -5
  115. package/dist/types/env/utils.d.ts +0 -31
  116. package/dist/types/extractor/index.d.ts +1 -1
  117. package/dist/types/img/index.d.ts +1 -1
  118. package/dist/types/img/info.d.ts +7 -0
  119. package/dist/types/img/photon-loader.d.ts +2 -0
  120. package/dist/types/key-alias-utils.d.ts +9 -0
  121. package/dist/types/mcp/base-tools.d.ts +74 -5
  122. package/dist/types/mcp/cli-report-session.d.ts +12 -0
  123. package/dist/types/mcp/error-formatter.d.ts +12 -0
  124. package/dist/types/mcp/index.d.ts +2 -0
  125. package/dist/types/mcp/init-arg-utils.d.ts +13 -0
  126. package/dist/types/mcp/inject-report-html-plugin.d.ts +2 -2
  127. package/dist/types/mcp/launcher-helper.d.ts +3 -3
  128. package/dist/types/mcp/tool-generator.d.ts +3 -3
  129. package/dist/types/mcp/types.d.ts +10 -0
  130. package/dist/types/recorder.d.ts +113 -0
  131. package/package.json +1 -1
  132. package/src/agent-tools/agent-behavior-init-args.ts +109 -0
  133. package/src/agent-tools/base-tools.ts +399 -0
  134. package/src/agent-tools/chrome-path.ts +74 -0
  135. package/src/agent-tools/cli-report-session.ts +130 -0
  136. package/src/agent-tools/error-formatter.ts +177 -0
  137. package/src/agent-tools/index.ts +9 -0
  138. package/src/agent-tools/init-arg-utils.ts +105 -0
  139. package/src/agent-tools/observation-artifact.ts +29 -0
  140. package/src/agent-tools/observation-record.ts +331 -0
  141. package/src/agent-tools/tool-defaults.ts +119 -0
  142. package/src/agent-tools/tool-generator.ts +866 -0
  143. package/src/agent-tools/types.ts +250 -0
  144. package/src/agent-tools/user-prompt.ts +102 -0
  145. package/src/cli/cli-args.ts +173 -0
  146. package/src/cli/cli-error.ts +24 -0
  147. package/src/cli/cli-runner.ts +37 -56
  148. package/src/cli/index.ts +3 -7
  149. package/src/cli/interrupt.ts +207 -0
  150. package/src/cli/record-command.ts +177 -0
  151. package/src/cli/screenshot-file.ts +61 -0
  152. package/src/cli/verbose-ai-act.ts +387 -0
  153. package/src/cli/verbose-screenshot.ts +269 -0
  154. package/src/cli/verbose.ts +753 -0
  155. package/src/constants/example-code.ts +2 -2
  156. package/src/constants/index.ts +10 -0
  157. package/src/env/model-config-manager.ts +3 -0
  158. package/src/env/parse-model-config.ts +19 -1
  159. package/src/env/types.ts +13 -2
  160. package/src/env/utils.ts +0 -50
  161. package/src/extractor/index.ts +1 -1
  162. package/src/img/index.ts +14 -0
  163. package/src/img/info.ts +97 -45
  164. package/src/img/photon-loader.ts +5 -0
  165. package/src/img/transform.ts +261 -2
  166. package/src/key-alias-utils.ts +23 -0
  167. package/src/mcp/base-server.ts +10 -12
  168. package/src/mcp/base-tools.ts +218 -11
  169. package/src/mcp/cli-report-session.ts +130 -0
  170. package/src/mcp/error-formatter.ts +52 -0
  171. package/src/mcp/index.ts +2 -0
  172. package/src/mcp/init-arg-utils.ts +105 -0
  173. package/src/mcp/inject-report-html-plugin.ts +3 -3
  174. package/src/mcp/launcher-helper.ts +3 -3
  175. package/src/mcp/tool-generator.ts +98 -20
  176. package/src/mcp/types.ts +18 -1
  177. package/src/recorder.ts +625 -0
@@ -0,0 +1,13 @@
1
+ import type { ToolDefaults } from './tool-defaults';
2
+ import type { ActionSpaceItem, BaseAgent, ToolCliMetadata, ToolDefinition, ToolSchema } from './types';
3
+ import { composeUserPrompt } from './user-prompt';
4
+ export { composeUserPrompt };
5
+ /**
6
+ * Converts DeviceAction from actionSpace into ToolDefinition.
7
+ * This is the core logic that removes need for hardcoded tool definitions
8
+ */
9
+ export declare function generateToolsFromActionSpace(actionSpace: ActionSpaceItem[], getAgent: (args?: Record<string, unknown>) => Promise<BaseAgent>, sanitizeArgs?: (args: Record<string, unknown>) => Record<string, unknown>, initArgSchema?: ToolSchema, initArgCliMetadata?: ToolCliMetadata, toolDefaults?: ToolDefaults): ToolDefinition[];
10
+ /**
11
+ * Generate common tools (screenshot, act)
12
+ */
13
+ export declare function generateCommonTools(getAgent: (args?: Record<string, unknown>) => Promise<BaseAgent>, initArgSchema?: ToolSchema, initArgCliMetadata?: ToolCliMetadata, toolDefaults?: ToolDefaults): ToolDefinition[];
@@ -0,0 +1,213 @@
1
+ import type { z } from 'zod';
2
+ import type { ToolDefaults } from './tool-defaults';
3
+ /**
4
+ * Default timeout constants for app loading verification
5
+ */
6
+ export declare const defaultAppLoadingTimeoutMs = 10000;
7
+ export declare const defaultAppLoadingCheckIntervalMs = 2000;
8
+ /**
9
+ * Content item types for tool results.
10
+ */
11
+ export type ToolResultContent = {
12
+ type: 'text';
13
+ text: string;
14
+ } | {
15
+ type: 'image';
16
+ data: string;
17
+ mimeType: string;
18
+ } | {
19
+ type: 'audio';
20
+ data: string;
21
+ mimeType: string;
22
+ } | {
23
+ type: 'resource';
24
+ resource: {
25
+ text: string;
26
+ uri: string;
27
+ mimeType?: string;
28
+ } | {
29
+ uri: string;
30
+ blob: string;
31
+ mimeType?: string;
32
+ };
33
+ };
34
+ /**
35
+ * Result type for tool execution.
36
+ */
37
+ export interface ToolResult {
38
+ [x: string]: unknown;
39
+ content: ToolResultContent[];
40
+ isError?: boolean;
41
+ _meta?: Record<string, unknown>;
42
+ }
43
+ /**
44
+ * Tool handler function type
45
+ * Takes parsed arguments and returns a tool result
46
+ */
47
+ export type ToolHandler<T = Record<string, unknown>> = (args: T) => Promise<ToolResult>;
48
+ /**
49
+ * Tool schema type using Zod
50
+ */
51
+ export type ToolSchema = Record<string, z.ZodTypeAny>;
52
+ export interface ToolCliOption {
53
+ preferredName?: string;
54
+ aliases?: string[];
55
+ hidden?: boolean;
56
+ }
57
+ export interface ToolCliMetadata {
58
+ options?: Record<string, ToolCliOption>;
59
+ /** Schema keys populated from leading positional CLI arguments. */
60
+ positionals?: string[];
61
+ }
62
+ /**
63
+ * Tool definition for Midscene CLI and Skill surfaces.
64
+ */
65
+ export interface ToolDefinition<T = Record<string, unknown>> {
66
+ name: string;
67
+ description: string;
68
+ schema: ToolSchema;
69
+ handler: ToolHandler<T>;
70
+ cli?: ToolCliMetadata;
71
+ }
72
+ export type Tool = ToolDefinition;
73
+ /**
74
+ * Action space item definition
75
+ * Note: Intentionally no index signature to maintain compatibility with DeviceAction
76
+ */
77
+ export interface ActionSpaceItem {
78
+ name: string;
79
+ description?: string;
80
+ args?: Record<string, unknown>;
81
+ paramSchema?: z.ZodTypeAny;
82
+ }
83
+ /**
84
+ * Structural shape compatible with @aiscene/core `TUserPrompt`.
85
+ * Declared locally to avoid a circular dep on `@aiscene/core` from `@aiscene/shared`.
86
+ *
87
+ * Consumed by the `assert` and `act` tools in `generateCommonTools`, both of
88
+ * which forward reference images to core (`aiAssert` / `aiAct`). `aiWaitFor`
89
+ * stays string-only at the CLI surface because the tools generator does not
90
+ * yet expose a multimodal entry point for it.
91
+ */
92
+ export type UserPromptLike = string | {
93
+ prompt: string;
94
+ images?: Array<{
95
+ name: string;
96
+ url: string;
97
+ }>;
98
+ convertHttpImage2Base64?: boolean;
99
+ };
100
+ export interface RecordToReportScreenshot {
101
+ /**
102
+ * PNG/JPEG data URI, or raw PNG base64 body.
103
+ */
104
+ base64: string;
105
+ description?: string;
106
+ }
107
+ export interface RecordToReportOptions {
108
+ content?: string;
109
+ /**
110
+ * @deprecated Use `screenshots: [{ base64 }]` instead.
111
+ */
112
+ screenshotBase64?: string;
113
+ screenshots?: RecordToReportScreenshot[];
114
+ }
115
+ /** Generic progress-bus envelope as seen by tool consumers (all untrusted). */
116
+ export interface BaseAgentProgressEvent {
117
+ scope?: unknown;
118
+ phase?: unknown;
119
+ sequence?: unknown;
120
+ data?: unknown;
121
+ }
122
+ /** A single frame in a portable UI observation record. */
123
+ export interface UIObservationFrame {
124
+ /** Path to the captured image. Serialized manifests use relative paths. */
125
+ path: string;
126
+ /** MIME type of the captured image file. */
127
+ mimeType: 'image/png' | 'image/jpeg';
128
+ /** Capture timestamp in milliseconds. */
129
+ capturedAt: number;
130
+ }
131
+ /**
132
+ * Serializable observation window that can be persisted and loaded later.
133
+ * Frames are ordered from earliest to latest; the final frame represents the
134
+ * UI state at the end of the observation window.
135
+ */
136
+ export interface UIObservationRecord {
137
+ type: 'midscene_ui_observation';
138
+ version: 1;
139
+ /** Time when observation sampling started. */
140
+ startedAt: number;
141
+ /** Time when the final representative frame was captured. */
142
+ endedAt: number;
143
+ frames: UIObservationFrame[];
144
+ shotSize: {
145
+ width: number;
146
+ height: number;
147
+ };
148
+ shrunkShotToLogicalRatio: number;
149
+ }
150
+ /** Fixed observation window consumed by shared CLI surfaces. */
151
+ export interface BaseUIObservation {
152
+ readonly frameCount: number;
153
+ readonly startedAt: number;
154
+ readonly endedAt: number;
155
+ aiAssert(assertion: UserPromptLike, message?: string, options?: Record<string, unknown>): Promise<unknown>;
156
+ /** Release any resources owned by this observation. */
157
+ dispose?(): Promise<void>;
158
+ }
159
+ /** Minimal UI observation lifecycle required by shared tool surfaces. */
160
+ export interface BaseUIObserver {
161
+ readonly bufferedFrameCount: number;
162
+ /** Stop sampling and return the fixed observed window. */
163
+ stop(): Promise<BaseUIObservation>;
164
+ /** Release temporary backing files if observation does not complete. */
165
+ dispose?(): Promise<void>;
166
+ }
167
+ /** Options for {@link BaseAgent.startObserving}. */
168
+ export interface BaseUIObserverOptions {
169
+ /** Sampling interval in milliseconds. Defaults to 1000; minimum 200. */
170
+ intervalMs?: number;
171
+ /** Maximum number of buffered frames. Defaults to 30; minimum 2. */
172
+ maxFrames?: number;
173
+ /** Auto-stop timeout in milliseconds. Defaults to 300000; 0 disables it. */
174
+ watchdogMs?: number;
175
+ }
176
+ /**
177
+ * Base agent interface
178
+ * Represents a platform-specific agent (Android, iOS, Web)
179
+ * Note: Return types use `unknown` for compatibility with platform-specific implementations
180
+ */
181
+ export interface BaseAgent {
182
+ getActionSpace(): Promise<ActionSpaceItem[]>;
183
+ destroy?(): Promise<void>;
184
+ reportFile?: string | null;
185
+ page?: {
186
+ screenshotBase64(): Promise<string>;
187
+ };
188
+ addDumpUpdateListener?(listener: (dump: string, executionDump?: unknown) => void): () => void;
189
+ addProgressListener?(listener: (event: BaseAgentProgressEvent) => void): () => void;
190
+ recordToReport?(title?: string, opt?: RecordToReportOptions): Promise<void>;
191
+ callActionInActionSpace?(actionName: string, params?: unknown): Promise<unknown>;
192
+ aiAction?(description: UserPromptLike, params?: Record<string, unknown>): Promise<unknown>;
193
+ aiWaitFor?(assertion: string, options: Record<string, unknown>): Promise<unknown>;
194
+ aiAssert?(assertion: UserPromptLike, msg?: string, options?: Record<string, unknown>): Promise<unknown>;
195
+ /** Start a UI observation window and capture its baseline frame. */
196
+ startObserving?(options?: BaseUIObserverOptions): Promise<BaseUIObserver>;
197
+ }
198
+ /**
199
+ * Base device interface for temporary device instances
200
+ */
201
+ export interface BaseDevice {
202
+ actionSpace(): ActionSpaceItem[];
203
+ destroy?(): Promise<void>;
204
+ }
205
+ /**
206
+ * Interface for platform-specific tools manager.
207
+ */
208
+ export interface IMidsceneTools {
209
+ initTools(): Promise<void>;
210
+ destroy?(): Promise<void>;
211
+ getCliToolDefinitions?(): ToolDefinition[];
212
+ setToolDefaults?(toolDefaults: ToolDefaults): void;
213
+ }
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ import type { UserPromptLike } from './types';
3
+ export declare function composeUserPrompt(input: {
4
+ prompt: string;
5
+ image?: unknown;
6
+ imageName?: unknown;
7
+ convertHttpImage2Base64?: unknown;
8
+ }): UserPromptLike;
9
+ export declare const promptInputExtraSchema: {
10
+ image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
11
+ imageName: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
12
+ convertHttpImage2Base64: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString]>>;
13
+ };
@@ -0,0 +1,8 @@
1
+ import type { ToolCliOption, ToolDefinition } from '../mcp/types';
2
+ export declare function parseValue(raw: string): unknown;
3
+ export declare function parseCliArgs(args: string[]): Record<string, unknown>;
4
+ export declare function getCliOptionDisplay(key: string, cliOption?: ToolCliOption): {
5
+ label: string;
6
+ aliases: string[];
7
+ };
8
+ export declare function formatCliValidationError(scriptName: string, commandName: string, def: ToolDefinition, rawArgs: Record<string, unknown>): string | undefined;
@@ -0,0 +1,5 @@
1
+ export declare class CLIError extends Error {
2
+ exitCode: number;
3
+ constructor(message: string, exitCode?: number);
4
+ }
5
+ export declare function reportCLIError(error: unknown, log?: (message?: unknown, ...optionalParams: unknown[]) => void): number;
@@ -12,11 +12,8 @@ export interface CLIRunnerOptions {
12
12
  version?: string;
13
13
  extraCommands?: CLIExtraCommand[];
14
14
  }
15
- export declare class CLIError extends Error {
16
- exitCode: number;
17
- constructor(message: string, exitCode?: number);
18
- }
19
- export declare function parseValue(raw: string): unknown;
20
- export declare function parseCliArgs(args: string[]): Record<string, unknown>;
15
+ export { parseCliArgs, parseValue } from './cli-args';
16
+ export { CLIError, reportCLIError } from './cli-error';
21
17
  export declare function removePrefix(name: string, prefix?: string): string;
22
- export declare function runToolsCLI(tools: BaseMidsceneTools, scriptName: string, options?: CLIRunnerOptions): Promise<void>;
18
+ type AnyMidsceneTools = BaseMidsceneTools<any, any>;
19
+ export declare function runToolsCLI(tools: AnyMidsceneTools, scriptName: string, options?: CLIRunnerOptions): Promise<void>;
@@ -1,2 +1,4 @@
1
- export { runToolsCLI, CLIError, parseValue, parseCliArgs, removePrefix, } from './cli-runner';
1
+ export { CLIError, reportCLIError } from './cli-error';
2
+ export { parseCliArgs, parseValue } from './cli-args';
3
+ export { runToolsCLI, removePrefix } from './cli-runner';
2
4
  export type { CLIRunnerOptions, CLIExtraCommand } from './cli-runner';
@@ -0,0 +1,49 @@
1
+ export type CliInterruptReason = 'sigint' | 'sigterm' | 'sighup' | 'watchdog';
2
+ type CliInterruptSignal = 'SIGINT' | 'SIGTERM' | 'SIGHUP';
3
+ export interface CliInterruptSource {
4
+ on(event: CliInterruptSignal, listener: () => void): unknown;
5
+ removeListener(event: CliInterruptSignal, listener: () => void): unknown;
6
+ }
7
+ export interface CliInterruptInputSource {
8
+ readonly isTTY?: boolean;
9
+ readonly isRaw?: boolean;
10
+ readonly readableFlowing?: boolean | null;
11
+ on(event: 'data', listener: (chunk: unknown) => void): unknown;
12
+ removeListener(event: 'data', listener: (chunk: unknown) => void): unknown;
13
+ setRawMode?(enabled: boolean): unknown;
14
+ pause?(): unknown;
15
+ }
16
+ export interface CliInterruptWaiter {
17
+ /** Resolves on the first stop signal or watchdog timeout. */
18
+ readonly result: Promise<CliInterruptReason>;
19
+ /** Release signal handlers after asynchronous finalization has completed. */
20
+ dispose(): void;
21
+ }
22
+ export interface CliInterruptWaiterOptions {
23
+ source?: CliInterruptSource;
24
+ input?: CliInterruptInputSource;
25
+ /** Called after restoring the terminal when Ctrl+C is pressed again. */
26
+ forceExit?: (exitCode: number) => void;
27
+ }
28
+ /** Whether a foreground CLI command is currently waiting for this source. */
29
+ export declare function hasActiveCliInterruptWaiter(source?: CliInterruptSource): boolean;
30
+ /**
31
+ * Keep graceful-stop handlers installed until the caller has finished saving.
32
+ *
33
+ * Package runners such as pnpm can deliver SIGINT to the foreground child,
34
+ * immediately follow it with SIGTERM, then cause SIGHUP when the runner exits
35
+ * and its pseudo-terminal closes. Resolving on the first signal is not enough:
36
+ * removing any handler at that point lets a subsequent signal kill the child
37
+ * during asynchronous artifact finalization.
38
+ *
39
+ * On a TTY, Ctrl+C is captured as raw input so the package runner itself stays
40
+ * alive until the child has saved and restored the terminal. Signal handlers
41
+ * remain as the graceful-stop path for externally delivered termination.
42
+ */
43
+ export declare function createCliInterruptWaiter(watchdogMs: number, options?: CliInterruptWaiterOptions): CliInterruptWaiter;
44
+ /**
45
+ * Wait for one stop request and release the handlers immediately afterwards.
46
+ * Long-running finalizers should use {@link createCliInterruptWaiter} instead.
47
+ */
48
+ export declare function waitForCliInterrupt(watchdogMs: number, source?: CliInterruptSource, input?: CliInterruptInputSource | undefined): Promise<CliInterruptReason>;
49
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { BaseAgent, ToolCliMetadata, ToolDefinition, ToolSchema } from '../agent-tools/types';
2
+ /** Create the foreground recording command exposed only by Midscene CLIs. */
3
+ export declare function createRecordCliCommand(getAgent: (args?: Record<string, unknown>) => Promise<BaseAgent>, initArgSchema?: ToolSchema, initArgCliMetadata?: ToolCliMetadata): ToolDefinition;
@@ -0,0 +1,10 @@
1
+ export interface WriteCliScreenshotFileOptions {
2
+ id?: unknown;
3
+ mimeType?: unknown;
4
+ extension?: unknown;
5
+ directoryPath?: string;
6
+ directoryName?: string;
7
+ filenamePrefix?: string;
8
+ overwrite?: boolean;
9
+ }
10
+ export declare function writeCliScreenshotFile(rawBase64: string, options?: WriteCliScreenshotFileOptions): string;
@@ -0,0 +1,44 @@
1
+ import { type CliVerboseScreenshotCollectOptions } from './verbose-screenshot';
2
+ export interface CliVerboseLine {
3
+ key: string;
4
+ text: string;
5
+ }
6
+ /** Generic progress-bus envelope as seen by the CLI (all fields untrusted). */
7
+ export interface CliAgentProgressEvent {
8
+ scope?: unknown;
9
+ phase?: unknown;
10
+ sequence?: unknown;
11
+ data?: unknown;
12
+ }
13
+ /** Flattened, render-ready aiAct payload derived from the envelope. */
14
+ export interface CliAiActProgressPayload {
15
+ phase?: unknown;
16
+ sequence?: unknown;
17
+ prompt?: unknown;
18
+ planIndex?: unknown;
19
+ planLimit?: unknown;
20
+ action?: unknown;
21
+ thought?: unknown;
22
+ log?: unknown;
23
+ output?: unknown;
24
+ durationMs?: unknown;
25
+ error?: unknown;
26
+ screenshots?: Array<Record<string, unknown>>;
27
+ screenshotPath?: string;
28
+ [key: string]: unknown;
29
+ }
30
+ /** aiAct scope tag on the progress bus (mirrors core's `aiActProgressScope`). */
31
+ export declare const cliAiActProgressScope = "aiAct";
32
+ export declare function normalizeAiActProgressEventForCli(event: unknown, screenshotOptions?: CliVerboseScreenshotCollectOptions): CliAiActProgressPayload | undefined;
33
+ export declare function buildAiActProgressEventLines(event: CliAiActProgressPayload): CliVerboseLine[];
34
+ /**
35
+ * A producer-specific renderer for the generic CLI progress dispatcher: turn a
36
+ * raw progress envelope into a normalized payload, then that payload into
37
+ * verbose lines. New producers register their own renderer; the dispatcher core
38
+ * stays untouched.
39
+ */
40
+ export interface CliProgressRenderer {
41
+ normalize(event: unknown, screenshotOptions: CliVerboseScreenshotCollectOptions): Record<string, unknown> | undefined;
42
+ buildLines(payload: Record<string, unknown>): CliVerboseLine[];
43
+ }
44
+ export declare const aiActCliProgressRenderer: CliProgressRenderer;
@@ -0,0 +1,10 @@
1
+ export type CliVerboseScreenshotExportMode = 'none' | 'tmp' | 'report';
2
+ export interface CliVerboseScreenshotCollectOptions {
3
+ reportFile?: unknown;
4
+ exportMode?: CliVerboseScreenshotExportMode;
5
+ cache?: Map<string, string>;
6
+ }
7
+ export declare function collectScreenshotRefs(value: unknown, options?: CliVerboseScreenshotCollectOptions): Array<Record<string, unknown>>;
8
+ export declare function pathForReportScreenshot(path: string, reportFile?: unknown): string;
9
+ export declare function latestScreenshotPathForAiAct(value: unknown, options?: CliVerboseScreenshotCollectOptions): string;
10
+ export declare function renderScreenshotList(screenshots: unknown): string;
@@ -0,0 +1,40 @@
1
+ export declare const cliVerboseFlag = "verbose";
2
+ export type CliVerboseFormat = 'text' | 'jsonl';
3
+ export interface CliVerboseContext {
4
+ enabled: boolean;
5
+ format?: CliVerboseFormat;
6
+ scriptName?: string;
7
+ commandName?: string;
8
+ startedAt?: number;
9
+ renderedLineKeys?: Set<string>;
10
+ }
11
+ export interface CliVerboseEvent {
12
+ event: string;
13
+ scriptName?: string;
14
+ command?: string;
15
+ status?: 'ok' | 'error';
16
+ durationMs?: number;
17
+ error?: string;
18
+ [key: string]: unknown;
19
+ }
20
+ type DumpUpdateAgent = {
21
+ addDumpUpdateListener?: (listener: (dump: string, executionDump?: unknown) => void) => () => void;
22
+ addProgressListener?: (listener: (event: unknown) => void) => () => void;
23
+ reportFile?: string | null;
24
+ };
25
+ export declare function stripVerboseFlag(argv: readonly string[]): {
26
+ rawArgs: string[];
27
+ verbose: boolean;
28
+ format: CliVerboseFormat;
29
+ };
30
+ export declare function withCliVerboseContext<T>(context: CliVerboseContext, fn: () => Promise<T>): Promise<T>;
31
+ export declare function getCliVerboseContext(): CliVerboseContext;
32
+ export declare function isCliVerboseEnabled(): boolean;
33
+ export declare function emitCliVerboseEvent(event: CliVerboseEvent): void;
34
+ declare function errorMessageOf(error: unknown): string;
35
+ export declare function compactCliVerboseValue(value: unknown): unknown;
36
+ export declare function compactCliVerboseArgs(args: Record<string, unknown>): Record<string, unknown>;
37
+ export declare function attachCliVerboseDumpListener(agent: DumpUpdateAgent, options?: {
38
+ toolName?: string;
39
+ }): () => void;
40
+ export { errorMessageOf as cliVerboseErrorMessage };
@@ -1,2 +1,2 @@
1
- export declare const PLAYWRIGHT_EXAMPLE_CODE = "\n// Reference the following code to generate Midscene test cases\n// The following is test code for Midscene AI, for reference\n// The following is Playwright syntax, you can use Playwright to assist in test generation\nIMPORTANT: Follow these exact type signatures for AI functions:\n\n// Type signatures for AI functions:\naiAct(prompt: string, options?: { cacheable?: boolean, deepThink?: 'unset' | true | false }): Promise<void>\naiInput(text: string, locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>\naiTap(locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>\naiHover(locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>\naiDoubleClick(locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>\naiKeyboardPress(key: string, locate?: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>\naiScroll(locate: string | undefined, options: {\n direction?: 'up' | 'down' | 'left' | 'right',\n scrollType?: 'singleAction' | 'scrollToBottom' | 'scrollToTop' | 'scrollToRight' | 'scrollToLeft',\n distance?: number | null,\n deepLocate?: boolean,\n xpath?: string,\n cacheable?: boolean\n}): Promise<void>\naiAssert(assertion: string, options?: { errorMessage?: string }): Promise<void>\naiWaitFor(prompt: string, options?: { timeout?: number }): Promise<void>\naiQuery<T>(queryObject: Record<string, string>): Promise<T> // Extracts data from page based on descriptions\n\n// examples:\n// Reference the following code to generate Midscene test cases\n// The following is test code for Midscene AI, for reference\n// The following is Playwright syntax, you can use Playwright to assist in test generation\nimport { test as base } from '@playwright/test';\nimport type { PlayWrightAiFixtureType } from '@midscene/web/playwright';\nimport { PlaywrightAiFixture } from '@midscene/web/playwright';\n\nconst test = base.extend<PlayWrightAiFixtureType>(PlaywrightAiFixture({\n waitForNetworkIdleTimeout: 2000, // optional, the timeout for waiting for network idle between each action, default is 2000ms\n}));\n\n\ntest.beforeEach(async ({ page }) => {\n await page.goto('https://www.xxx.com/');\n await page.setViewportSize({ width: 1920, height: 1080 });\n});\n\ntest('ai shop', async ({\n aiAct,\n aiInput,\n aiAssert,\n aiQuery,\n aiKeyboardPress,\n aiHover,\n aiTap,\n aiWaitFor,\n agentForPage,\n page,\n}) => {\n // login\n await aiAssert('The page shows the login interface');\n await aiInput('user_name', 'in user name input');\n await aiInput('password', 'in password input');\n await aiKeyboardPress('Enter', 'Login Button');\n\n // check the login success\n await aiWaitFor('The page shows that the loading is complete');\n await aiAssert('The current page shows the product detail page');\n\n // check the product info\n const dataA = await aiQuery({\n userInfo: 'User information in the format {name: string}',\n theFirstProductInfo: 'The first product info in the format {name: string, price: number}',\n });\n expect(dataA.theFirstProductInfo.name).toBe('xxx');\n expect(dataA.theFirstProductInfo.price).toBe(100);\n\n\n // add to cart\n await aiTap('click add to cart button');\n \n await aiTap('click right top cart icon');\n await aiAssert('The cart icon shows the number 1');\n});\n";
1
+ export declare const PLAYWRIGHT_EXAMPLE_CODE = "\n// Reference the following code to generate Midscene test cases\n// The following is test code for Midscene AI, for reference\n// The following is Playwright syntax, you can use Playwright to assist in test generation\nIMPORTANT: Follow these exact type signatures for AI functions:\n\n// Type signatures for AI functions:\naiAct(prompt: string, options?: { cacheable?: boolean, deepThink?: 'unset' | true | false }): Promise<void>\naiInput(text: string, locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>\naiTap(locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>\naiHover(locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>\naiDoubleClick(locate: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>\naiKeyboardPress(key: string, locate?: string, options?: { deepLocate?: boolean, xpath?: string, cacheable?: boolean }): Promise<void>\naiScroll(locate: string | undefined, options: {\n direction?: 'up' | 'down' | 'left' | 'right',\n scrollType?: 'singleAction' | 'scrollToBottom' | 'scrollToTop' | 'scrollToRight' | 'scrollToLeft',\n distance?: number | null,\n deepLocate?: boolean,\n xpath?: string,\n cacheable?: boolean\n}): Promise<void>\naiAssert(assertion: string, options?: { errorMessage?: string }): Promise<void>\naiWaitFor(prompt: string, options?: { timeout?: number }): Promise<void>\naiQuery<T>(queryObject: Record<string, string>): Promise<T> // Extracts data from page based on descriptions\n\n// examples:\n// Reference the following code to generate Midscene test cases\n// The following is test code for Midscene AI, for reference\n// The following is Playwright syntax, you can use Playwright to assist in test generation\nimport { test as base } from '@playwright/test';\nimport type { PlayWrightAiFixtureType } from '@aiscene/web/playwright';\nimport { PlaywrightAiFixture } from '@aiscene/web/playwright';\n\nconst test = base.extend<PlayWrightAiFixtureType>(PlaywrightAiFixture({\n waitForNetworkIdleTimeout: 2000, // optional, the timeout for waiting for network idle between each action, default is 2000ms\n}));\n\n\ntest.beforeEach(async ({ page }) => {\n await page.goto('https://www.xxx.com/');\n await page.setViewportSize({ width: 1920, height: 1080 });\n});\n\ntest('ai shop', async ({\n aiAct,\n aiInput,\n aiAssert,\n aiQuery,\n aiKeyboardPress,\n aiHover,\n aiTap,\n aiWaitFor,\n agentForPage,\n page,\n}) => {\n // login\n await aiAssert('The page shows the login interface');\n await aiInput('user_name', 'in user name input');\n await aiInput('password', 'in password input');\n await aiKeyboardPress('Enter', 'Login Button');\n\n // check the login success\n await aiWaitFor('The page shows that the loading is complete');\n await aiAssert('The current page shows the product detail page');\n\n // check the product info\n const dataA = await aiQuery({\n userInfo: 'User information in the format {name: string}',\n theFirstProductInfo: 'The first product info in the format {name: string, price: number}',\n });\n expect(dataA.theFirstProductInfo.name).toBe('xxx');\n expect(dataA.theFirstProductInfo.price).toBe(100);\n\n\n // add to cart\n await aiTap('click add to cart button');\n \n await aiTap('click right top cart icon');\n await aiAssert('The cart icon shows the number 1');\n});\n";
2
2
  export declare const YAML_EXAMPLE_CODE = "\nCRITICAL - YAML Indentation Rules:\nFor actions with additional parameters (aiScroll, aiInput, aiKeyboardPress), the parameters must be SIBLING keys at the SAME indentation level as the action key, NOT nested children indented further.\nCORRECT (parameters align with the action key):\n - aiScroll:\n direction: 'down'\n scrollType: 'singleAction'\n distance: 500\n locate: \"main content area\"\n - aiInput: 'text value'\n locate: 'input field description'\nWRONG (parameters are indented further than the action key, DO NOT do this):\n - aiScroll:\n direction: 'down'\n scrollType: 'singleAction'\n - aiInput: 'text value'\n locate: 'input field description'\n\n1. Format:\n\nweb:\n url: \"starting_url\"\n viewportWidth: 1280\n viewportHeight: 960\n\ntasks:\n - name: \"descriptive task name\"\n flow:\n - aiTap: \"element description\"\n xpath: '/html/body/div[1]/button[1]'\n - aiInput: 'text value'\n locate: 'input field description'\n xpath: '/html/body/div[1]/input[1]'\n - aiScroll:\n direction: 'down'\n scrollType: 'singleAction'\n distance: 500\n locate: \"scrollable area description\"\n xpath: '/html/body/div[1]/main[1]'\n - aiAssert: \"expected state\"\n - sleep: 1000\n\n2. Action Types:\n- aiTap: for clicks (natural language targeting)\n- aiInput: for text input with 'locate' field\n- aiScroll: with direction and scrollType\n- aiAssert: for validations\n- sleep: for delays (milliseconds)\n\n\n\nYAML type\ntasks:\n - name: <name>\n continueOnError: <boolean> # Optional, whether to continue to the next task on error, defaults to false.\n flow:\n # Auto Planning (.ai)\n # ----------------\n\n # Perform an interaction. `ai` is a shorthand for `aiAct`.\n - ai: <prompt>\n cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.\n\n # This usage is the same as `ai`.\n - aiAct: <prompt>\n cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.\n\n # Instant Action (.aiTap, .aiDoubleClick, .aiHover, .aiInput, .aiKeyboardPress, .aiScroll)\n # ----------------\n\n # Tap an element described by a prompt.\n - aiTap: <prompt>\n deepLocate: <boolean> # Optional, whether to use deepLocate to precisely locate the element. Defaults to False.\n xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Midscene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.\n cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.\n\n # Double click an element described by a prompt.\n - aiDoubleClick: <prompt>\n deepLocate: <boolean> # Optional, whether to use deepLocate to precisely locate the element. Defaults to False.\n xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Midscene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.\n cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.\n\n # Hover over an element described by a prompt.\n - aiHover: <prompt>\n deepLocate: <boolean> # Optional, whether to use deepLocate to precisely locate the element. Defaults to False.\n xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Midscene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.\n cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.\n\n # Input text into an element described by a prompt.\n - aiInput: <final text content of the input>\n locate: <prompt>\n deepLocate: <boolean> # Optional, whether to use deepLocate to precisely locate the element. Defaults to False.\n xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Midscene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.\n cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.\n\n # Press a key (e.g., Enter, Tab, Escape) on an element described by a prompt.\n - aiKeyboardPress: <key>\n locate: <prompt>\n deepLocate: <boolean> # Optional, whether to use deepLocate to precisely locate the element. Defaults to False.\n xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Midscene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.\n cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.\n\n # Scroll globally or on an element described by a prompt.\n - aiScroll:\n direction: 'up' # or 'down' | 'left' | 'right'\n scrollType: 'singleAction' # or 'scrollToTop' | 'scrollToBottom' | 'scrollToLeft' | 'scrollToRight'\n distance: <number> # Optional, the scroll distance in pixels.\n locate: <prompt> # Optional, the element to scroll on.\n deepLocate: <boolean> # Optional, whether to use deepLocate to precisely locate the element. Defaults to False.\n xpath: <xpath> # Optional, the xpath of the target element for the operation. If provided, Midscene will prioritize this xpath to find the element before using the cache and the AI model. Defaults to empty.\n cacheable: <boolean> # Optional, whether to cache the result of this API call when the [caching feature](./caching.mdx) is enabled. Defaults to True.\n\n # Record the current screenshot with a description in the report file.\n - recordToReport: <title> # Optional, the title of the screenshot. If not provided, the title will be 'untitled'.\n content: <content> # Optional, the description of the screenshot.\n\n # Data Extraction\n # ----------------\n\n # Perform a query that returns a JSON object.\n - aiQuery: <prompt> # Remember to describe the format of the result in the prompt.\n name: <name> # The key for the query result in the JSON output.\n\n # More APIs\n # ----------------\n\n # Wait for a condition to be met, with a timeout (in ms, optional, defaults to 30000).\n - aiWaitFor: <prompt>\n timeout: <ms>\n\n # Perform an assertion.\n - aiAssert: <prompt>\n errorMessage: <error-message> # Optional, the error message to print if the assertion fails.\n\n # Wait for a specified amount of time.\n - sleep: <ms>\n\n # Execute a piece of JavaScript code in the web page context.\n - javascript: <javascript>\n name: <name> # Optional, assign a name to the return value, which will be used as a key in the JSON output.\n\n - name: <name>\n flow:\n # ...\n";
@@ -13,6 +13,11 @@ export declare enum NodeType {
13
13
  }
14
14
  export declare const PLAYGROUND_SERVER_PORT = 5800;
15
15
  export declare const SCRCPY_SERVER_PORT = 5700;
16
+ export declare const SCRCPY_ADB_CONNECT_TIMEOUT_MS = 10000;
17
+ export declare const SCRCPY_PUSH_TIMEOUT_MS = 10000;
18
+ export declare const SCRCPY_START_TIMEOUT_MS = 15000;
19
+ export declare const SCRCPY_VIDEO_STREAM_TIMEOUT_MS = 15000;
20
+ export declare const SCRCPY_PREVIEW_METADATA_TIMEOUT_MS: number;
16
21
  export declare const WEBDRIVER_ELEMENT_ID_KEY = "element-6066-11e4-a52e-4f735466cecf";
17
22
  export declare const DEFAULT_WDA_PORT = 8100;
18
23
  export declare const DEFAULT_WAIT_FOR_NAVIGATION_TIMEOUT = 5000;
@@ -6,6 +6,7 @@ export declare const MIDSCENE_DEBUG_MODEL_RESPONSE = "MIDSCENE_DEBUG_MODEL_RESPO
6
6
  export declare const MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG = "MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG";
7
7
  export declare const MIDSCENE_DEBUG_MODE = "MIDSCENE_DEBUG_MODE";
8
8
  export declare const MIDSCENE_MCP_USE_PUPPETEER_MODE = "MIDSCENE_MCP_USE_PUPPETEER_MODE";
9
+ export declare const MIDSCENE_CHROME_PATH = "MIDSCENE_CHROME_PATH";
9
10
  export declare const MIDSCENE_MCP_CHROME_PATH = "MIDSCENE_MCP_CHROME_PATH";
10
11
  export declare const MIDSCENE_MCP_ANDROID_MODE = "MIDSCENE_MCP_ANDROID_MODE";
11
12
  export declare const DOCKER_CONTAINER = "DOCKER_CONTAINER";
@@ -53,6 +54,7 @@ export declare const MIDSCENE_ADB_REMOTE_PORT = "MIDSCENE_ADB_REMOTE_PORT";
53
54
  export declare const MIDSCENE_ANDROID_IME_STRATEGY = "MIDSCENE_ANDROID_IME_STRATEGY";
54
55
  export declare const MIDSCENE_IOS_DEVICE_UDID = "MIDSCENE_IOS_DEVICE_UDID";
55
56
  export declare const MIDSCENE_IOS_SIMULATOR_UDID = "MIDSCENE_IOS_SIMULATOR_UDID";
57
+ export declare const MIDSCENE_IOS_DEVICE_CLASS_OVERRIDE = "MIDSCENE_IOS_DEVICE_CLASS_OVERRIDE";
56
58
  export declare const MIDSCENE_CACHE = "MIDSCENE_CACHE";
57
59
  export declare const MIDSCENE_USE_VLM_UI_TARS = "MIDSCENE_USE_VLM_UI_TARS";
58
60
  export declare const MIDSCENE_USE_QWEN_VL = "MIDSCENE_USE_QWEN_VL";
@@ -109,20 +111,20 @@ export declare const UNUSED_ENV_KEYS: string[];
109
111
  export declare const BASIC_ENV_KEYS: readonly ["MIDSCENE_DEBUG_MODE", "MIDSCENE_DEBUG_MODEL_PROFILE", "MIDSCENE_DEBUG_MODEL_RESPONSE", "MIDSCENE_RUN_DIR"];
110
112
  export declare const BOOLEAN_ENV_KEYS: readonly ["MIDSCENE_CACHE", "MIDSCENE_MCP_USE_PUPPETEER_MODE", "MIDSCENE_MCP_ANDROID_MODE", "MIDSCENE_LANGSMITH_DEBUG", "MIDSCENE_LANGFUSE_DEBUG", "MIDSCENE_REPORT_QUIET"];
111
113
  export declare const NUMBER_ENV_KEYS: readonly ["MIDSCENE_MODEL_MAX_TOKENS", "MIDSCENE_CACHE_MAX_FILENAME_LENGTH", "MIDSCENE_REPLANNING_CYCLE_LIMIT"];
112
- export declare const STRING_ENV_KEYS: readonly ["MIDSCENE_MODEL_MAX_TOKENS", "OPENAI_MAX_TOKENS", "MIDSCENE_ADB_PATH", "MIDSCENE_ADB_REMOTE_HOST", "MIDSCENE_ADB_REMOTE_PORT", "MIDSCENE_ANDROID_IME_STRATEGY", "MIDSCENE_IOS_DEVICE_UDID", "MIDSCENE_IOS_SIMULATOR_UDID", "MIDSCENE_REPORT_TAG_NAME", "MIDSCENE_PREFERRED_LANGUAGE", "MATCH_BY_POSITION", "MIDSCENE_MCP_CHROME_PATH", "DOCKER_CONTAINER"];
114
+ export declare const STRING_ENV_KEYS: readonly ["MIDSCENE_MODEL_MAX_TOKENS", "OPENAI_MAX_TOKENS", "MIDSCENE_ADB_PATH", "MIDSCENE_ADB_REMOTE_HOST", "MIDSCENE_ADB_REMOTE_PORT", "MIDSCENE_ANDROID_IME_STRATEGY", "MIDSCENE_IOS_DEVICE_UDID", "MIDSCENE_IOS_SIMULATOR_UDID", "MIDSCENE_REPORT_TAG_NAME", "MIDSCENE_PREFERRED_LANGUAGE", "MATCH_BY_POSITION", "MIDSCENE_CHROME_PATH", "MIDSCENE_MCP_CHROME_PATH", "DOCKER_CONTAINER"];
113
115
  /**
114
116
  * Non model related env keys, used for globally controlling the behavior of midscene
115
117
  * Can not be override by agent.modelConfig but can be override by overrideAIConfig
116
118
  * Can be access at any time
117
119
  */
118
- export declare const GLOBAL_ENV_KEYS: readonly ["MIDSCENE_CACHE", "MIDSCENE_MCP_USE_PUPPETEER_MODE", "MIDSCENE_MCP_ANDROID_MODE", "MIDSCENE_LANGSMITH_DEBUG", "MIDSCENE_LANGFUSE_DEBUG", "MIDSCENE_REPORT_QUIET", "MIDSCENE_MODEL_MAX_TOKENS", "MIDSCENE_CACHE_MAX_FILENAME_LENGTH", "MIDSCENE_REPLANNING_CYCLE_LIMIT", "MIDSCENE_MODEL_MAX_TOKENS", "OPENAI_MAX_TOKENS", "MIDSCENE_ADB_PATH", "MIDSCENE_ADB_REMOTE_HOST", "MIDSCENE_ADB_REMOTE_PORT", "MIDSCENE_ANDROID_IME_STRATEGY", "MIDSCENE_IOS_DEVICE_UDID", "MIDSCENE_IOS_SIMULATOR_UDID", "MIDSCENE_REPORT_TAG_NAME", "MIDSCENE_PREFERRED_LANGUAGE", "MATCH_BY_POSITION", "MIDSCENE_MCP_CHROME_PATH", "DOCKER_CONTAINER"];
120
+ export declare const GLOBAL_ENV_KEYS: readonly ["MIDSCENE_CACHE", "MIDSCENE_MCP_USE_PUPPETEER_MODE", "MIDSCENE_MCP_ANDROID_MODE", "MIDSCENE_LANGSMITH_DEBUG", "MIDSCENE_LANGFUSE_DEBUG", "MIDSCENE_REPORT_QUIET", "MIDSCENE_MODEL_MAX_TOKENS", "MIDSCENE_CACHE_MAX_FILENAME_LENGTH", "MIDSCENE_REPLANNING_CYCLE_LIMIT", "MIDSCENE_MODEL_MAX_TOKENS", "OPENAI_MAX_TOKENS", "MIDSCENE_ADB_PATH", "MIDSCENE_ADB_REMOTE_HOST", "MIDSCENE_ADB_REMOTE_PORT", "MIDSCENE_ANDROID_IME_STRATEGY", "MIDSCENE_IOS_DEVICE_UDID", "MIDSCENE_IOS_SIMULATOR_UDID", "MIDSCENE_REPORT_TAG_NAME", "MIDSCENE_PREFERRED_LANGUAGE", "MATCH_BY_POSITION", "MIDSCENE_CHROME_PATH", "MIDSCENE_MCP_CHROME_PATH", "DOCKER_CONTAINER"];
119
121
  /**
120
122
  * Model related eve keys, used for declare which model to use.
121
123
  * Can be override by both agent.modelConfig and overrideAIConfig
122
124
  * Can only be access after agent.constructor
123
125
  */
124
126
  export declare const MODEL_ENV_KEYS: readonly ["MIDSCENE_MODEL_NAME", "MIDSCENE_MODEL_INIT_CONFIG_JSON", "MIDSCENE_MODEL_EXTRA_BODY_JSON", "MIDSCENE_MODEL_API_KEY", "MIDSCENE_MODEL_BASE_URL", "MIDSCENE_MODEL_SOCKS_PROXY", "MIDSCENE_MODEL_HTTP_PROXY", "MIDSCENE_MODEL_TIMEOUT", "MIDSCENE_MODEL_TEMPERATURE", "MIDSCENE_MODEL_RETRY_COUNT", "MIDSCENE_MODEL_RETRY_INTERVAL", "MIDSCENE_MODEL_REASONING_EFFORT", "MIDSCENE_MODEL_REASONING_ENABLED", "MIDSCENE_MODEL_REASONING_BUDGET", "MIDSCENE_USE_VLM_UI_TARS", "MIDSCENE_USE_QWEN_VL", "MIDSCENE_USE_QWEN3_VL", "MIDSCENE_USE_DOUBAO_VISION", "MIDSCENE_USE_GEMINI", "MIDSCENE_USE_VL_MODEL", "OPENAI_API_KEY", "OPENAI_BASE_URL", "MIDSCENE_OPENAI_INIT_CONFIG_JSON", "MIDSCENE_OPENAI_HTTP_PROXY", "MIDSCENE_OPENAI_SOCKS_PROXY", "MIDSCENE_INSIGHT_MODEL_NAME", "MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY", "MIDSCENE_INSIGHT_MODEL_HTTP_PROXY", "MIDSCENE_INSIGHT_MODEL_BASE_URL", "MIDSCENE_INSIGHT_MODEL_API_KEY", "MIDSCENE_INSIGHT_MODEL_INIT_CONFIG_JSON", "MIDSCENE_INSIGHT_MODEL_EXTRA_BODY_JSON", "MIDSCENE_INSIGHT_MODEL_TIMEOUT", "MIDSCENE_INSIGHT_MODEL_TEMPERATURE", "MIDSCENE_INSIGHT_MODEL_RETRY_COUNT", "MIDSCENE_INSIGHT_MODEL_RETRY_INTERVAL", "MIDSCENE_INSIGHT_MODEL_FAMILY", "MIDSCENE_INSIGHT_MODEL_REASONING_EFFORT", "MIDSCENE_INSIGHT_MODEL_REASONING_ENABLED", "MIDSCENE_INSIGHT_MODEL_REASONING_BUDGET", "MIDSCENE_PLANNING_MODEL_NAME", "MIDSCENE_PLANNING_MODEL_SOCKS_PROXY", "MIDSCENE_PLANNING_MODEL_HTTP_PROXY", "MIDSCENE_PLANNING_MODEL_BASE_URL", "MIDSCENE_PLANNING_MODEL_API_KEY", "MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON", "MIDSCENE_PLANNING_MODEL_EXTRA_BODY_JSON", "MIDSCENE_PLANNING_MODEL_TIMEOUT", "MIDSCENE_PLANNING_MODEL_TEMPERATURE", "MIDSCENE_PLANNING_MODEL_RETRY_COUNT", "MIDSCENE_PLANNING_MODEL_RETRY_INTERVAL", "MIDSCENE_PLANNING_MODEL_FAMILY", "MIDSCENE_PLANNING_MODEL_REASONING_EFFORT", "MIDSCENE_PLANNING_MODEL_REASONING_ENABLED", "MIDSCENE_PLANNING_MODEL_REASONING_BUDGET", "MIDSCENE_MODEL_FAMILY"];
125
- export declare const ALL_ENV_KEYS: readonly [...string[], "MIDSCENE_DEBUG_MODE", "MIDSCENE_DEBUG_MODEL_PROFILE", "MIDSCENE_DEBUG_MODEL_RESPONSE", "MIDSCENE_RUN_DIR", "MIDSCENE_CACHE", "MIDSCENE_MCP_USE_PUPPETEER_MODE", "MIDSCENE_MCP_ANDROID_MODE", "MIDSCENE_LANGSMITH_DEBUG", "MIDSCENE_LANGFUSE_DEBUG", "MIDSCENE_REPORT_QUIET", "MIDSCENE_MODEL_MAX_TOKENS", "MIDSCENE_CACHE_MAX_FILENAME_LENGTH", "MIDSCENE_REPLANNING_CYCLE_LIMIT", "MIDSCENE_MODEL_MAX_TOKENS", "OPENAI_MAX_TOKENS", "MIDSCENE_ADB_PATH", "MIDSCENE_ADB_REMOTE_HOST", "MIDSCENE_ADB_REMOTE_PORT", "MIDSCENE_ANDROID_IME_STRATEGY", "MIDSCENE_IOS_DEVICE_UDID", "MIDSCENE_IOS_SIMULATOR_UDID", "MIDSCENE_REPORT_TAG_NAME", "MIDSCENE_PREFERRED_LANGUAGE", "MATCH_BY_POSITION", "MIDSCENE_MCP_CHROME_PATH", "DOCKER_CONTAINER", "MIDSCENE_MODEL_NAME", "MIDSCENE_MODEL_INIT_CONFIG_JSON", "MIDSCENE_MODEL_EXTRA_BODY_JSON", "MIDSCENE_MODEL_API_KEY", "MIDSCENE_MODEL_BASE_URL", "MIDSCENE_MODEL_SOCKS_PROXY", "MIDSCENE_MODEL_HTTP_PROXY", "MIDSCENE_MODEL_TIMEOUT", "MIDSCENE_MODEL_TEMPERATURE", "MIDSCENE_MODEL_RETRY_COUNT", "MIDSCENE_MODEL_RETRY_INTERVAL", "MIDSCENE_MODEL_REASONING_EFFORT", "MIDSCENE_MODEL_REASONING_ENABLED", "MIDSCENE_MODEL_REASONING_BUDGET", "MIDSCENE_USE_VLM_UI_TARS", "MIDSCENE_USE_QWEN_VL", "MIDSCENE_USE_QWEN3_VL", "MIDSCENE_USE_DOUBAO_VISION", "MIDSCENE_USE_GEMINI", "MIDSCENE_USE_VL_MODEL", "OPENAI_API_KEY", "OPENAI_BASE_URL", "MIDSCENE_OPENAI_INIT_CONFIG_JSON", "MIDSCENE_OPENAI_HTTP_PROXY", "MIDSCENE_OPENAI_SOCKS_PROXY", "MIDSCENE_INSIGHT_MODEL_NAME", "MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY", "MIDSCENE_INSIGHT_MODEL_HTTP_PROXY", "MIDSCENE_INSIGHT_MODEL_BASE_URL", "MIDSCENE_INSIGHT_MODEL_API_KEY", "MIDSCENE_INSIGHT_MODEL_INIT_CONFIG_JSON", "MIDSCENE_INSIGHT_MODEL_EXTRA_BODY_JSON", "MIDSCENE_INSIGHT_MODEL_TIMEOUT", "MIDSCENE_INSIGHT_MODEL_TEMPERATURE", "MIDSCENE_INSIGHT_MODEL_RETRY_COUNT", "MIDSCENE_INSIGHT_MODEL_RETRY_INTERVAL", "MIDSCENE_INSIGHT_MODEL_FAMILY", "MIDSCENE_INSIGHT_MODEL_REASONING_EFFORT", "MIDSCENE_INSIGHT_MODEL_REASONING_ENABLED", "MIDSCENE_INSIGHT_MODEL_REASONING_BUDGET", "MIDSCENE_PLANNING_MODEL_NAME", "MIDSCENE_PLANNING_MODEL_SOCKS_PROXY", "MIDSCENE_PLANNING_MODEL_HTTP_PROXY", "MIDSCENE_PLANNING_MODEL_BASE_URL", "MIDSCENE_PLANNING_MODEL_API_KEY", "MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON", "MIDSCENE_PLANNING_MODEL_EXTRA_BODY_JSON", "MIDSCENE_PLANNING_MODEL_TIMEOUT", "MIDSCENE_PLANNING_MODEL_TEMPERATURE", "MIDSCENE_PLANNING_MODEL_RETRY_COUNT", "MIDSCENE_PLANNING_MODEL_RETRY_INTERVAL", "MIDSCENE_PLANNING_MODEL_FAMILY", "MIDSCENE_PLANNING_MODEL_REASONING_EFFORT", "MIDSCENE_PLANNING_MODEL_REASONING_ENABLED", "MIDSCENE_PLANNING_MODEL_REASONING_BUDGET", "MIDSCENE_MODEL_FAMILY"];
127
+ export declare const ALL_ENV_KEYS: readonly [...string[], "MIDSCENE_DEBUG_MODE", "MIDSCENE_DEBUG_MODEL_PROFILE", "MIDSCENE_DEBUG_MODEL_RESPONSE", "MIDSCENE_RUN_DIR", "MIDSCENE_CACHE", "MIDSCENE_MCP_USE_PUPPETEER_MODE", "MIDSCENE_MCP_ANDROID_MODE", "MIDSCENE_LANGSMITH_DEBUG", "MIDSCENE_LANGFUSE_DEBUG", "MIDSCENE_REPORT_QUIET", "MIDSCENE_MODEL_MAX_TOKENS", "MIDSCENE_CACHE_MAX_FILENAME_LENGTH", "MIDSCENE_REPLANNING_CYCLE_LIMIT", "MIDSCENE_MODEL_MAX_TOKENS", "OPENAI_MAX_TOKENS", "MIDSCENE_ADB_PATH", "MIDSCENE_ADB_REMOTE_HOST", "MIDSCENE_ADB_REMOTE_PORT", "MIDSCENE_ANDROID_IME_STRATEGY", "MIDSCENE_IOS_DEVICE_UDID", "MIDSCENE_IOS_SIMULATOR_UDID", "MIDSCENE_REPORT_TAG_NAME", "MIDSCENE_PREFERRED_LANGUAGE", "MATCH_BY_POSITION", "MIDSCENE_CHROME_PATH", "MIDSCENE_MCP_CHROME_PATH", "DOCKER_CONTAINER", "MIDSCENE_MODEL_NAME", "MIDSCENE_MODEL_INIT_CONFIG_JSON", "MIDSCENE_MODEL_EXTRA_BODY_JSON", "MIDSCENE_MODEL_API_KEY", "MIDSCENE_MODEL_BASE_URL", "MIDSCENE_MODEL_SOCKS_PROXY", "MIDSCENE_MODEL_HTTP_PROXY", "MIDSCENE_MODEL_TIMEOUT", "MIDSCENE_MODEL_TEMPERATURE", "MIDSCENE_MODEL_RETRY_COUNT", "MIDSCENE_MODEL_RETRY_INTERVAL", "MIDSCENE_MODEL_REASONING_EFFORT", "MIDSCENE_MODEL_REASONING_ENABLED", "MIDSCENE_MODEL_REASONING_BUDGET", "MIDSCENE_USE_VLM_UI_TARS", "MIDSCENE_USE_QWEN_VL", "MIDSCENE_USE_QWEN3_VL", "MIDSCENE_USE_DOUBAO_VISION", "MIDSCENE_USE_GEMINI", "MIDSCENE_USE_VL_MODEL", "OPENAI_API_KEY", "OPENAI_BASE_URL", "MIDSCENE_OPENAI_INIT_CONFIG_JSON", "MIDSCENE_OPENAI_HTTP_PROXY", "MIDSCENE_OPENAI_SOCKS_PROXY", "MIDSCENE_INSIGHT_MODEL_NAME", "MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY", "MIDSCENE_INSIGHT_MODEL_HTTP_PROXY", "MIDSCENE_INSIGHT_MODEL_BASE_URL", "MIDSCENE_INSIGHT_MODEL_API_KEY", "MIDSCENE_INSIGHT_MODEL_INIT_CONFIG_JSON", "MIDSCENE_INSIGHT_MODEL_EXTRA_BODY_JSON", "MIDSCENE_INSIGHT_MODEL_TIMEOUT", "MIDSCENE_INSIGHT_MODEL_TEMPERATURE", "MIDSCENE_INSIGHT_MODEL_RETRY_COUNT", "MIDSCENE_INSIGHT_MODEL_RETRY_INTERVAL", "MIDSCENE_INSIGHT_MODEL_FAMILY", "MIDSCENE_INSIGHT_MODEL_REASONING_EFFORT", "MIDSCENE_INSIGHT_MODEL_REASONING_ENABLED", "MIDSCENE_INSIGHT_MODEL_REASONING_BUDGET", "MIDSCENE_PLANNING_MODEL_NAME", "MIDSCENE_PLANNING_MODEL_SOCKS_PROXY", "MIDSCENE_PLANNING_MODEL_HTTP_PROXY", "MIDSCENE_PLANNING_MODEL_BASE_URL", "MIDSCENE_PLANNING_MODEL_API_KEY", "MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON", "MIDSCENE_PLANNING_MODEL_EXTRA_BODY_JSON", "MIDSCENE_PLANNING_MODEL_TIMEOUT", "MIDSCENE_PLANNING_MODEL_TEMPERATURE", "MIDSCENE_PLANNING_MODEL_RETRY_COUNT", "MIDSCENE_PLANNING_MODEL_RETRY_INTERVAL", "MIDSCENE_PLANNING_MODEL_FAMILY", "MIDSCENE_PLANNING_MODEL_REASONING_EFFORT", "MIDSCENE_PLANNING_MODEL_REASONING_ENABLED", "MIDSCENE_PLANNING_MODEL_REASONING_BUDGET", "MIDSCENE_MODEL_FAMILY"];
126
128
  export type TEnvKeys = (typeof ALL_ENV_KEYS)[number];
127
129
  export type TGlobalConfig = Record<TEnvKeys, string | undefined>;
128
130
  /**
@@ -203,7 +205,7 @@ export declare enum UITarsModelVersion {
203
205
  }
204
206
  /**
205
207
  * Callback to create custom OpenAI client instance
206
- * @param config - Resolved model configuration including apiKey, baseURL, modelName, intent, etc.
208
+ * @param config - Resolved model configuration including apiKey, baseURL, modelName, intent, slot, etc.
207
209
  * @returns OpenAI client instance (can be wrapped with langsmith, langfuse, etc.)
208
210
  *
209
211
  * Note: Wrapper functions like langsmith's wrapOpenAI() return the same OpenAI instance
@@ -293,9 +295,16 @@ export interface IModelConfig {
293
295
  uiTarsModelVersion?: UITarsModelVersion;
294
296
  modelDescription: string;
295
297
  /**
296
- * original intent from the config
298
+ * The semantic intent this config is requested for.
299
+ * For example, getModelConfig('planning') always returns intent === 'planning'.
297
300
  */
298
301
  intent: TIntent;
302
+ /**
303
+ * The model-config slot this config was resolved from.
304
+ * For example, getModelConfig('planning') may resolve from slot === 'default'
305
+ * when MIDSCENE_PLANNING_MODEL_NAME is not configured.
306
+ */
307
+ slot: TIntent;
299
308
  /**
300
309
  * Custom OpenAI client factory function
301
310
  *
@@ -3,36 +3,5 @@ import { ModelConfigManager } from './model-config-manager';
3
3
  import { type GLOBAL_ENV_KEYS, type MODEL_ENV_KEYS } from './types';
4
4
  export declare const globalModelConfigManager: ModelConfigManager;
5
5
  export declare const globalConfigManager: GlobalConfigManager;
6
- /**
7
- * Interface for devices that support getTimestamp method.
8
- * This is a minimal interface to avoid circular dependencies with @midscene/core.
9
- */
10
- export interface DeviceWithTimestamp {
11
- getTimestamp?: () => Promise<number>;
12
- }
13
- /**
14
- * Get the current timestamp, optionally from the target device.
15
- *
16
- * When useDeviceTimestamp is enabled and a device with getTimestamp is provided,
17
- * this function will return the device's time. Otherwise, it returns the system time.
18
- *
19
- * This is useful when:
20
- * - Testing on devices with different time zones
21
- * - Debugging time-sensitive features
22
- * - The system clock and device clock are not synchronized
23
- *
24
- * @param device Optional device interface that supports getTimestamp
25
- * @param useDeviceTimestamp Whether to use device timestamp (from agent config)
26
- * @returns Timestamp in milliseconds
27
- *
28
- * @example
29
- * // Without device - always returns system time
30
- * const systemTime = await getCurrentTime();
31
- *
32
- * @example
33
- * // With device and config enabled - returns device time
34
- * const deviceTime = await getCurrentTime(androidDevice, true);
35
- */
36
- export declare function getCurrentTime(device?: DeviceWithTimestamp, useDeviceTimestamp?: boolean): Promise<number>;
37
6
  export declare const getPreferredLanguage: () => string;
38
7
  export declare const overrideAIConfig: (newConfig: Partial<Record<(typeof GLOBAL_ENV_KEYS)[number] | (typeof MODEL_ENV_KEYS)[number], string>>, extendMode?: boolean) => void;
@@ -28,5 +28,5 @@ export { extractTextWithPosition as webExtractTextWithPosition } from './web-ext
28
28
  export { extractTreeNode as webExtractNodeTree } from './web-extractor';
29
29
  export { extractTreeNodeAsString as webExtractNodeTreeAsString } from './web-extractor';
30
30
  export { getXpathsByPoint, getXpathsById, getNodeInfoByXpath, getElementInfoByXpath, getElementXpath, } from './locator';
31
- export { generateElementByRect } from './dom-util';
31
+ export { generateElementByPoint, generateElementByRect } from './dom-util';
32
32
  export { isNotContainerElement } from './dom-util';
@@ -1,3 +1,3 @@
1
- export { imageInfoOfBase64, isValidPNGImageBuffer, isValidJPEGImageBuffer, isValidImageBuffer, } from './info';
1
+ export { imageInfoOfBase64, isValidPNGImageBuffer, isValidJPEGImageBuffer, isValidImageBuffer, validateScreenshotBuffer, type ValidateScreenshotBufferOptions, } from './info';
2
2
  export { resizeAndConvertImgBuffer, resizeImgBase64, zoomForGPT4o, saveBase64Image, paddingToMatchBlockByBase64, cropByRect, scaleImage, localImg2Base64, httpImg2Base64, preProcessImageUrl, parseBase64, createImgBase64ByFormat, } from './transform';
3
3
  export { processImageElementInfo, compositeElementInfoImg, annotateRects, } from './box-select';