@aiscene/core 8.1.2 → 9.0.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.
- package/dist/es/agent/agent.mjs +26 -11
- package/dist/es/agent/agent.mjs.map +1 -1
- package/dist/es/agent/task-builder.mjs +4 -2
- package/dist/es/agent/task-builder.mjs.map +1 -1
- package/dist/es/agent/tasks.mjs +21 -13
- package/dist/es/agent/tasks.mjs.map +1 -1
- package/dist/es/agent/ui-utils.mjs +13 -1
- package/dist/es/agent/ui-utils.mjs.map +1 -1
- package/dist/es/agent/usage-intent.mjs +18 -0
- package/dist/es/agent/usage-intent.mjs.map +1 -0
- package/dist/es/agent/utils.mjs +9 -26
- package/dist/es/agent/utils.mjs.map +1 -1
- package/dist/es/ai-model/auto-glm/planning.mjs.map +1 -1
- package/dist/es/ai-model/inspect.mjs +2 -4
- package/dist/es/ai-model/inspect.mjs.map +1 -1
- package/dist/es/ai-model/llm-planning.mjs +1 -3
- package/dist/es/ai-model/llm-planning.mjs.map +1 -1
- package/dist/es/ai-model/prompt/extraction.mjs +0 -2
- package/dist/es/ai-model/prompt/extraction.mjs.map +1 -1
- package/dist/es/ai-model/prompt/llm-planning.mjs +18 -0
- package/dist/es/ai-model/prompt/llm-planning.mjs.map +1 -1
- package/dist/es/ai-model/prompt/playwright-generator.mjs +4 -4
- package/dist/es/ai-model/prompt/playwright-generator.mjs.map +1 -1
- package/dist/es/ai-model/service-caller/codex-app-server.mjs +12 -12
- package/dist/es/ai-model/service-caller/codex-app-server.mjs.map +1 -1
- package/dist/es/ai-model/service-caller/index.mjs +148 -118
- package/dist/es/ai-model/service-caller/index.mjs.map +1 -1
- package/dist/es/ai-model/service-caller/request-timeout.mjs +49 -0
- package/dist/es/ai-model/service-caller/request-timeout.mjs.map +1 -0
- package/dist/es/ai-model/ui-tars-planning.mjs.map +1 -1
- package/dist/es/common.mjs +16 -3
- package/dist/es/common.mjs.map +1 -1
- package/dist/es/device/index.mjs +171 -30
- package/dist/es/device/index.mjs.map +1 -1
- package/dist/es/dump/screenshot-store.mjs +7 -6
- package/dist/es/dump/screenshot-store.mjs.map +1 -1
- package/dist/es/index.mjs.map +1 -1
- package/dist/es/report-generator.mjs +25 -25
- package/dist/es/report-generator.mjs.map +1 -1
- package/dist/es/report.mjs +20 -1
- package/dist/es/report.mjs.map +1 -1
- package/dist/es/skill/index.mjs +3 -4
- package/dist/es/skill/index.mjs.map +1 -1
- package/dist/es/types.mjs.map +1 -1
- package/dist/es/utils.mjs +2 -2
- package/dist/es/yaml/player.mjs +2 -17
- package/dist/es/yaml/player.mjs.map +1 -1
- package/dist/lib/agent/agent.js +27 -12
- package/dist/lib/agent/agent.js.map +1 -1
- package/dist/lib/agent/execution-session.js +1 -1
- package/dist/lib/agent/execution-session.js.map +1 -1
- package/dist/lib/agent/index.js +1 -1
- package/dist/lib/agent/index.js.map +1 -1
- package/dist/lib/agent/task-builder.js +5 -3
- package/dist/lib/agent/task-builder.js.map +1 -1
- package/dist/lib/agent/task-cache.js +1 -1
- package/dist/lib/agent/task-cache.js.map +1 -1
- package/dist/lib/agent/tasks.js +22 -14
- package/dist/lib/agent/tasks.js.map +1 -1
- package/dist/lib/agent/ui-utils.js +14 -2
- package/dist/lib/agent/ui-utils.js.map +1 -1
- package/dist/lib/agent/usage-intent.js +52 -0
- package/dist/lib/agent/usage-intent.js.map +1 -0
- package/dist/lib/agent/utils.js +10 -27
- package/dist/lib/agent/utils.js.map +1 -1
- package/dist/lib/ai-model/auto-glm/actions.js +1 -1
- package/dist/lib/ai-model/auto-glm/actions.js.map +1 -1
- package/dist/lib/ai-model/auto-glm/index.js +1 -1
- package/dist/lib/ai-model/auto-glm/index.js.map +1 -1
- package/dist/lib/ai-model/auto-glm/parser.js +1 -1
- package/dist/lib/ai-model/auto-glm/parser.js.map +1 -1
- package/dist/lib/ai-model/auto-glm/planning.js +1 -1
- package/dist/lib/ai-model/auto-glm/planning.js.map +1 -1
- package/dist/lib/ai-model/auto-glm/prompt.js +1 -1
- package/dist/lib/ai-model/auto-glm/prompt.js.map +1 -1
- package/dist/lib/ai-model/auto-glm/util.js +1 -1
- package/dist/lib/ai-model/auto-glm/util.js.map +1 -1
- package/dist/lib/ai-model/connectivity.js +1 -1
- package/dist/lib/ai-model/connectivity.js.map +1 -1
- package/dist/lib/ai-model/conversation-history.js +1 -1
- package/dist/lib/ai-model/conversation-history.js.map +1 -1
- package/dist/lib/ai-model/index.js +1 -1
- package/dist/lib/ai-model/index.js.map +1 -1
- package/dist/lib/ai-model/inspect.js +3 -5
- package/dist/lib/ai-model/inspect.js.map +1 -1
- package/dist/lib/ai-model/llm-planning.js +2 -4
- package/dist/lib/ai-model/llm-planning.js.map +1 -1
- package/dist/lib/ai-model/prompt/common.js +1 -1
- package/dist/lib/ai-model/prompt/common.js.map +1 -1
- package/dist/lib/ai-model/prompt/describe.js +1 -1
- package/dist/lib/ai-model/prompt/describe.js.map +1 -1
- package/dist/lib/ai-model/prompt/extraction.js +1 -3
- package/dist/lib/ai-model/prompt/extraction.js.map +1 -1
- package/dist/lib/ai-model/prompt/llm-locator.js +1 -1
- package/dist/lib/ai-model/prompt/llm-locator.js.map +1 -1
- package/dist/lib/ai-model/prompt/llm-planning.js +19 -1
- package/dist/lib/ai-model/prompt/llm-planning.js.map +1 -1
- package/dist/lib/ai-model/prompt/llm-section-locator.js +1 -1
- package/dist/lib/ai-model/prompt/llm-section-locator.js.map +1 -1
- package/dist/lib/ai-model/prompt/order-sensitive-judge.js +1 -1
- package/dist/lib/ai-model/prompt/order-sensitive-judge.js.map +1 -1
- package/dist/lib/ai-model/prompt/playwright-generator.js +5 -5
- package/dist/lib/ai-model/prompt/playwright-generator.js.map +1 -1
- package/dist/lib/ai-model/prompt/ui-tars-planning.js +1 -1
- package/dist/lib/ai-model/prompt/ui-tars-planning.js.map +1 -1
- package/dist/lib/ai-model/prompt/util.js +1 -1
- package/dist/lib/ai-model/prompt/util.js.map +1 -1
- package/dist/lib/ai-model/prompt/yaml-generator.js +1 -1
- package/dist/lib/ai-model/prompt/yaml-generator.js.map +1 -1
- package/dist/lib/ai-model/service-caller/codex-app-server.js +13 -13
- package/dist/lib/ai-model/service-caller/codex-app-server.js.map +1 -1
- package/dist/lib/ai-model/service-caller/image-detail.js +1 -1
- package/dist/lib/ai-model/service-caller/image-detail.js.map +1 -1
- package/dist/lib/ai-model/service-caller/index.js +149 -119
- package/dist/lib/ai-model/service-caller/index.js.map +1 -1
- package/dist/lib/ai-model/service-caller/request-timeout.js +95 -0
- package/dist/lib/ai-model/service-caller/request-timeout.js.map +1 -0
- package/dist/lib/ai-model/ui-tars-planning.js +1 -1
- package/dist/lib/ai-model/ui-tars-planning.js.map +1 -1
- package/dist/lib/common.js +17 -4
- package/dist/lib/common.js.map +1 -1
- package/dist/lib/device/device-options.js +1 -1
- package/dist/lib/device/device-options.js.map +1 -1
- package/dist/lib/device/index.js +177 -30
- package/dist/lib/device/index.js.map +1 -1
- package/dist/lib/dump/html-utils.js +1 -1
- package/dist/lib/dump/html-utils.js.map +1 -1
- package/dist/lib/dump/index.js +1 -1
- package/dist/lib/dump/index.js.map +1 -1
- package/dist/lib/dump/screenshot-restoration.js +1 -1
- package/dist/lib/dump/screenshot-restoration.js.map +1 -1
- package/dist/lib/dump/screenshot-store.js +7 -6
- package/dist/lib/dump/screenshot-store.js.map +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/report-cli.js +1 -1
- package/dist/lib/report-cli.js.map +1 -1
- package/dist/lib/report-generator.js +24 -24
- package/dist/lib/report-generator.js.map +1 -1
- package/dist/lib/report-markdown.js +1 -1
- package/dist/lib/report-markdown.js.map +1 -1
- package/dist/lib/report.js +20 -1
- package/dist/lib/report.js.map +1 -1
- package/dist/lib/screenshot-item.js +1 -1
- package/dist/lib/screenshot-item.js.map +1 -1
- package/dist/lib/service/index.js +1 -1
- package/dist/lib/service/index.js.map +1 -1
- package/dist/lib/service/utils.js +1 -1
- package/dist/lib/service/utils.js.map +1 -1
- package/dist/lib/skill/index.js +4 -5
- package/dist/lib/skill/index.js.map +1 -1
- package/dist/lib/task-runner.js +1 -1
- package/dist/lib/task-runner.js.map +1 -1
- package/dist/lib/task-timing.js +1 -1
- package/dist/lib/task-timing.js.map +1 -1
- package/dist/lib/tree.js +1 -1
- package/dist/lib/tree.js.map +1 -1
- package/dist/lib/types.js +3 -3
- package/dist/lib/types.js.map +1 -1
- package/dist/lib/utils.js +3 -3
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/yaml/builder.js +1 -1
- package/dist/lib/yaml/builder.js.map +1 -1
- package/dist/lib/yaml/index.js +1 -1
- package/dist/lib/yaml/index.js.map +1 -1
- package/dist/lib/yaml/player.js +3 -18
- package/dist/lib/yaml/player.js.map +1 -1
- package/dist/lib/yaml/utils.js +1 -1
- package/dist/lib/yaml/utils.js.map +1 -1
- package/dist/lib/yaml.js +1 -1
- package/dist/lib/yaml.js.map +1 -1
- package/dist/types/agent/agent.d.ts +4 -0
- package/dist/types/agent/tasks.d.ts +8 -7
- package/dist/types/agent/usage-intent.d.ts +3 -0
- package/dist/types/ai-model/llm-planning.d.ts +2 -2
- package/dist/types/ai-model/service-caller/codex-app-server.d.ts +5 -5
- package/dist/types/ai-model/service-caller/index.d.ts +1 -4
- package/dist/types/ai-model/service-caller/request-timeout.d.ts +32 -0
- package/dist/types/device/device-options.d.ts +11 -1
- package/dist/types/device/index.d.ts +195 -24
- package/dist/types/dump/screenshot-store.d.ts +2 -2
- package/dist/types/index.d.ts +0 -1
- package/dist/types/report-generator.d.ts +7 -0
- package/dist/types/types.d.ts +15 -4
- package/package.json +2 -2
|
@@ -3,8 +3,8 @@ import type { AbstractInterface } from '../device';
|
|
|
3
3
|
import type Service from '../service';
|
|
4
4
|
import type { TaskRunner } from '../task-runner';
|
|
5
5
|
import { TaskExecutionError } from '../task-runner';
|
|
6
|
-
import type {
|
|
7
|
-
import {
|
|
6
|
+
import type { DeviceAction, ExecutionTaskApply, ExecutionTaskProgressOptions, MidsceneYamlFlowItem, PlanningAction, PlanningActionParamWaitFor, ServiceExtractOption, ServiceExtractParam } from '../types';
|
|
7
|
+
import type { IModelConfig } from '@aiscene/shared/env';
|
|
8
8
|
import type { TaskCache } from './task-cache';
|
|
9
9
|
export { locatePlanForLocate } from './task-builder';
|
|
10
10
|
interface ExecutionResult<OutputType = any> {
|
|
@@ -26,22 +26,23 @@ export declare class TaskExecutor {
|
|
|
26
26
|
private readonly hooks?;
|
|
27
27
|
replanningCycleLimit?: number;
|
|
28
28
|
waitAfterAction?: number;
|
|
29
|
-
|
|
29
|
+
useDeviceTime?: boolean;
|
|
30
30
|
get page(): AbstractInterface;
|
|
31
31
|
constructor(interfaceInstance: AbstractInterface, service: Service, opts: {
|
|
32
32
|
taskCache?: TaskCache;
|
|
33
33
|
onTaskStart?: ExecutionTaskProgressOptions['onTaskStart'];
|
|
34
34
|
replanningCycleLimit?: number;
|
|
35
35
|
waitAfterAction?: number;
|
|
36
|
-
|
|
36
|
+
useDeviceTime?: boolean;
|
|
37
37
|
hooks?: TaskExecutorHooks;
|
|
38
38
|
actionSpace: DeviceAction[];
|
|
39
39
|
});
|
|
40
40
|
private createExecutionSession;
|
|
41
41
|
private getActionSpace;
|
|
42
42
|
/**
|
|
43
|
-
* Get a readable time string
|
|
44
|
-
*
|
|
43
|
+
* Get a readable time string. When device time is enabled, use the
|
|
44
|
+
* device-formatted wall-clock time directly so host timezone formatting does
|
|
45
|
+
* not reinterpret a device timestamp.
|
|
45
46
|
* @param format - Optional format string
|
|
46
47
|
* @returns A formatted time string
|
|
47
48
|
*/
|
|
@@ -57,7 +58,7 @@ export declare class TaskExecutor {
|
|
|
57
58
|
runner: TaskRunner;
|
|
58
59
|
}>;
|
|
59
60
|
runPlans(title: string, plans: PlanningAction[], modelConfigForPlanning: IModelConfig, modelConfigForDefaultIntent: IModelConfig): Promise<ExecutionResult>;
|
|
60
|
-
action(userPrompt: string, modelConfigForPlanning: IModelConfig, modelConfigForDefaultIntent: IModelConfig, includeBboxInPlanning: boolean, aiActContext?: string, cacheable?: boolean, replanningCycleLimitOverride?: number, imagesIncludeCount?: number,
|
|
61
|
+
action(userPrompt: string, modelConfigForPlanning: IModelConfig, modelConfigForDefaultIntent: IModelConfig, includeBboxInPlanning: boolean, aiActContext?: string, cacheable?: boolean, replanningCycleLimitOverride?: number, imagesIncludeCount?: number, planningModeDeepThink?: boolean, fileChooserAccept?: string[], deepLocate?: boolean, abortSignal?: AbortSignal): Promise<ExecutionResult<{
|
|
61
62
|
yamlFlow?: MidsceneYamlFlowItem[];
|
|
62
63
|
output?: string;
|
|
63
64
|
} | undefined>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DeviceAction, InterfaceType, PlanningAIResponse, RawResponsePlanningAIResponse, UIContext } from '../types';
|
|
2
2
|
import type { IModelConfig, TModelFamily } from '@aiscene/shared/env';
|
|
3
3
|
import type { ConversationHistory } from './conversation-history';
|
|
4
4
|
/**
|
|
@@ -14,6 +14,6 @@ export declare function plan(userInstruction: string, opts: {
|
|
|
14
14
|
conversationHistory: ConversationHistory;
|
|
15
15
|
includeBbox: boolean;
|
|
16
16
|
imagesIncludeCount?: number;
|
|
17
|
-
|
|
17
|
+
planningModeDeepThink?: boolean;
|
|
18
18
|
abortSignal?: AbortSignal;
|
|
19
19
|
}): Promise<PlanningAIResponse>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { AIUsageInfo,
|
|
1
|
+
import type { AIUsageInfo, StreamingCallback } from '../../types';
|
|
2
2
|
import type { IModelConfig } from '@aiscene/shared/env';
|
|
3
3
|
import type { ChatCompletionMessageParam } from 'openai/resources/index';
|
|
4
|
-
type CodexReasoningEffort = 'low' | 'medium' | 'high' | 'xhigh';
|
|
4
|
+
type CodexReasoningEffort = 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
5
5
|
type CodexTextInput = {
|
|
6
6
|
type: 'text';
|
|
7
7
|
text: string;
|
|
@@ -24,8 +24,8 @@ type CodexTurnResult = {
|
|
|
24
24
|
};
|
|
25
25
|
export declare const isCodexAppServerProvider: (baseURL?: string) => boolean;
|
|
26
26
|
export declare const normalizeCodexLocalImagePath: (imageUrl: string, platform?: NodeJS.Platform) => string;
|
|
27
|
-
export declare const resolveCodexReasoningEffort: ({
|
|
28
|
-
|
|
27
|
+
export declare const resolveCodexReasoningEffort: ({ reasoningEnabled, modelConfig, }: {
|
|
28
|
+
reasoningEnabled?: boolean;
|
|
29
29
|
modelConfig: IModelConfig;
|
|
30
30
|
}) => CodexReasoningEffort | undefined;
|
|
31
31
|
export declare const buildCodexTurnPayloadFromMessages: (messages: ChatCompletionMessageParam[]) => {
|
|
@@ -35,7 +35,7 @@ export declare const buildCodexTurnPayloadFromMessages: (messages: ChatCompletio
|
|
|
35
35
|
export declare function callAIWithCodexAppServer(messages: ChatCompletionMessageParam[], modelConfig: IModelConfig, options?: {
|
|
36
36
|
stream?: boolean;
|
|
37
37
|
onChunk?: StreamingCallback;
|
|
38
|
-
|
|
38
|
+
reasoningEnabled?: boolean;
|
|
39
39
|
abortSignal?: AbortSignal;
|
|
40
40
|
}): Promise<CodexTurnResult>;
|
|
41
41
|
export declare function __shutdownCodexAppServerForTests(): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AIUsageInfo
|
|
1
|
+
import type { AIUsageInfo } from '../../types';
|
|
2
2
|
import type { StreamingCallback } from '../../types';
|
|
3
3
|
export declare class AIResponseParseError extends Error {
|
|
4
4
|
usage?: AIUsageInfo;
|
|
@@ -11,7 +11,6 @@ import type { AIArgs } from '../../common';
|
|
|
11
11
|
export declare function callAI(messages: ChatCompletionMessageParam[], modelConfig: IModelConfig, options?: {
|
|
12
12
|
stream?: boolean;
|
|
13
13
|
onChunk?: StreamingCallback;
|
|
14
|
-
deepThink?: DeepThinkOption;
|
|
15
14
|
abortSignal?: AbortSignal;
|
|
16
15
|
}): Promise<{
|
|
17
16
|
content: string;
|
|
@@ -20,7 +19,6 @@ export declare function callAI(messages: ChatCompletionMessageParam[], modelConf
|
|
|
20
19
|
isStreamed: boolean;
|
|
21
20
|
}>;
|
|
22
21
|
export declare function callAIWithObjectResponse<T>(messages: ChatCompletionMessageParam[], modelConfig: IModelConfig, options?: {
|
|
23
|
-
deepThink?: DeepThinkOption;
|
|
24
22
|
abortSignal?: AbortSignal;
|
|
25
23
|
}): Promise<{
|
|
26
24
|
content: T;
|
|
@@ -44,6 +42,5 @@ export declare function resolveReasoningConfig({ reasoningEnabled, reasoningEffo
|
|
|
44
42
|
}): {
|
|
45
43
|
config: Record<string, unknown>;
|
|
46
44
|
debugMessage?: string;
|
|
47
|
-
warningMessage?: string;
|
|
48
45
|
};
|
|
49
46
|
export declare function safeParseJson(input: string, modelFamily: TModelFamily | undefined): any;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { IModelConfig } from '@aiscene/shared/env';
|
|
2
|
+
/**
|
|
3
|
+
* Default hard timeout (ms) applied to every AI HTTP call.
|
|
4
|
+
*
|
|
5
|
+
* We need an end-to-end timeout for the whole request lifecycle, not just the
|
|
6
|
+
* time until response headers arrive. Some providers can return headers
|
|
7
|
+
* quickly and then stall while the body is still being read.
|
|
8
|
+
*
|
|
9
|
+
* Override per intent via `MIDSCENE_MODEL_TIMEOUT`,
|
|
10
|
+
* `MIDSCENE_INSIGHT_MODEL_TIMEOUT`, or `MIDSCENE_PLANNING_MODEL_TIMEOUT`.
|
|
11
|
+
* Set the env var (or `modelConfig.timeout`) to `0` to disable the hard
|
|
12
|
+
* timeout entirely; only a caller-provided `abortSignal` will cancel the
|
|
13
|
+
* request in that case.
|
|
14
|
+
*/
|
|
15
|
+
export declare const DEFAULT_AI_CALL_TIMEOUT_MS = 180000;
|
|
16
|
+
/** Identifying code set on the AbortError raised by our hard timeout. */
|
|
17
|
+
export declare const AI_CALL_HARD_TIMEOUT_CODE = "AI_CALL_HARD_TIMEOUT";
|
|
18
|
+
/**
|
|
19
|
+
* Resolve the hard request timeout for an AI call.
|
|
20
|
+
* Returns `null` when the user explicitly opted out (`timeout === 0`).
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveEffectiveTimeoutMs(modelConfig: Pick<IModelConfig, 'timeout'>): number | null;
|
|
23
|
+
/**
|
|
24
|
+
* True if the error was raised by our hard-timeout AbortSignal (vs any other
|
|
25
|
+
* abort/network/HTTP error). Used to drive observability without having to
|
|
26
|
+
* string-match the message.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isHardTimeoutError(err: unknown): boolean;
|
|
29
|
+
export declare function buildRequestAbortSignal(timeoutMs: number | null, userSignal?: AbortSignal): {
|
|
30
|
+
signal: AbortSignal;
|
|
31
|
+
cleanup: () => void;
|
|
32
|
+
};
|
|
@@ -35,7 +35,12 @@ export type AndroidDeviceOpt = {
|
|
|
35
35
|
screenshotResizeScale?: number;
|
|
36
36
|
/** Always fetch screen info on each call; if false, cache the first result */
|
|
37
37
|
alwaysRefreshScreenInfo?: boolean;
|
|
38
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* Screenshot buffer size validation threshold in bytes. Buffers below this
|
|
40
|
+
* value are treated as failed or corrupted captures. Defaults to 1024 (1KB).
|
|
41
|
+
* Set to 0 to skip only this size check; empty-buffer and image-format
|
|
42
|
+
* validation still run.
|
|
43
|
+
*/
|
|
39
44
|
minScreenshotBufferSize?: number;
|
|
40
45
|
/**
|
|
41
46
|
* Scrcpy screenshot configuration for high-performance screen capture.
|
|
@@ -111,6 +116,11 @@ export type IOSDeviceInputOpt = {
|
|
|
111
116
|
export type IOSDeviceOpt = {
|
|
112
117
|
/** Device ID (UDID) to connect to */
|
|
113
118
|
deviceId?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Optional npm module path used to override the default iOS device implementation.
|
|
121
|
+
* The target module must export an `IOSDevice` class (or default export) compatible with Midscene's iOS device interface.
|
|
122
|
+
*/
|
|
123
|
+
iOSDeviceClassOverride?: string;
|
|
114
124
|
/** Custom device actions to register */
|
|
115
125
|
customActions?: DeviceAction<any>[];
|
|
116
126
|
/** WebDriverAgent port (default: 8100) */
|
|
@@ -6,6 +6,110 @@ import type { ElementCacheFeature, Rect, Size } from '../types';
|
|
|
6
6
|
export interface FileChooserHandler {
|
|
7
7
|
accept(files: string[]): Promise<void>;
|
|
8
8
|
}
|
|
9
|
+
export interface MjpegStreamFrame {
|
|
10
|
+
/** Raw base64-encoded image bytes WITHOUT a `data:image/...;base64,` prefix. */
|
|
11
|
+
data: string;
|
|
12
|
+
contentType?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface MjpegStreamHandle {
|
|
15
|
+
stop(): void | Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export interface MjpegStreamOptions {
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
onFrame(frame: MjpegStreamFrame): void;
|
|
20
|
+
onError?(error: unknown): void;
|
|
21
|
+
}
|
|
22
|
+
/** A point in device-pixel coordinates on the screen. */
|
|
23
|
+
export interface PointerPoint {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
}
|
|
27
|
+
export interface PointerInputPrimitives {
|
|
28
|
+
tap(p: PointerPoint, opts?: {
|
|
29
|
+
duration?: number;
|
|
30
|
+
}): Promise<void>;
|
|
31
|
+
doubleClick?(p: PointerPoint): Promise<void>;
|
|
32
|
+
rightClick?(p: PointerPoint): Promise<void>;
|
|
33
|
+
hover?(p: PointerPoint): Promise<void>;
|
|
34
|
+
longPress?(p: PointerPoint, opts?: {
|
|
35
|
+
duration?: number;
|
|
36
|
+
}): Promise<void>;
|
|
37
|
+
dragAndDrop?(from: PointerPoint, to: PointerPoint): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
export interface TouchInputPrimitives {
|
|
40
|
+
swipe(start: PointerPoint, end: PointerPoint, opts?: {
|
|
41
|
+
duration?: number;
|
|
42
|
+
repeat?: number;
|
|
43
|
+
}): Promise<void>;
|
|
44
|
+
pinch?(center: PointerPoint, opts: {
|
|
45
|
+
startDistance: number;
|
|
46
|
+
endDistance: number;
|
|
47
|
+
duration: number;
|
|
48
|
+
}): Promise<void>;
|
|
49
|
+
}
|
|
50
|
+
export interface KeyboardInputPrimitives {
|
|
51
|
+
keyboardPress(keyName: string, opts?: {
|
|
52
|
+
target?: unknown;
|
|
53
|
+
}): Promise<void>;
|
|
54
|
+
cursorMove?(direction: 'left' | 'right', times?: number): Promise<void>;
|
|
55
|
+
typeText(value: string, opts?: {
|
|
56
|
+
autoDismissKeyboard?: boolean;
|
|
57
|
+
target?: unknown;
|
|
58
|
+
replace?: boolean;
|
|
59
|
+
focusOnly?: boolean;
|
|
60
|
+
}): Promise<void>;
|
|
61
|
+
clearInput(target?: unknown): Promise<void>;
|
|
62
|
+
}
|
|
63
|
+
export interface ScrollInputPrimitives {
|
|
64
|
+
scroll(param: ActionScrollParam): Promise<void>;
|
|
65
|
+
}
|
|
66
|
+
export interface SystemInputPrimitives {
|
|
67
|
+
backButton?(): Promise<void>;
|
|
68
|
+
homeButton?(): Promise<void>;
|
|
69
|
+
recentAppsButton?(): Promise<void>;
|
|
70
|
+
}
|
|
71
|
+
export interface InputPrimitives {
|
|
72
|
+
pointer?: PointerInputPrimitives;
|
|
73
|
+
keyboard?: KeyboardInputPrimitives;
|
|
74
|
+
touch?: TouchInputPrimitives;
|
|
75
|
+
scroll?: ScrollInputPrimitives;
|
|
76
|
+
system?: SystemInputPrimitives;
|
|
77
|
+
}
|
|
78
|
+
export interface MobileInputPrimitives extends InputPrimitives {
|
|
79
|
+
pointer: PointerInputPrimitives & {
|
|
80
|
+
doubleClick(p: PointerPoint): Promise<void>;
|
|
81
|
+
longPress(p: PointerPoint, opts?: {
|
|
82
|
+
duration?: number;
|
|
83
|
+
}): Promise<void>;
|
|
84
|
+
dragAndDrop(from: PointerPoint, to: PointerPoint): Promise<void>;
|
|
85
|
+
};
|
|
86
|
+
keyboard: KeyboardInputPrimitives;
|
|
87
|
+
touch: TouchInputPrimitives;
|
|
88
|
+
}
|
|
89
|
+
export interface BrowserInputPrimitives extends InputPrimitives {
|
|
90
|
+
pointer: PointerInputPrimitives & {
|
|
91
|
+
doubleClick(p: PointerPoint): Promise<void>;
|
|
92
|
+
rightClick(p: PointerPoint): Promise<void>;
|
|
93
|
+
hover(p: PointerPoint): Promise<void>;
|
|
94
|
+
dragAndDrop(from: PointerPoint, to: PointerPoint): Promise<void>;
|
|
95
|
+
longPress(p: PointerPoint, opts?: {
|
|
96
|
+
duration?: number;
|
|
97
|
+
}): Promise<void>;
|
|
98
|
+
};
|
|
99
|
+
keyboard: KeyboardInputPrimitives;
|
|
100
|
+
scroll: ScrollInputPrimitives;
|
|
101
|
+
touch: TouchInputPrimitives;
|
|
102
|
+
}
|
|
103
|
+
export interface ComputerInputPrimitives extends InputPrimitives {
|
|
104
|
+
pointer: PointerInputPrimitives & {
|
|
105
|
+
doubleClick(p: PointerPoint): Promise<void>;
|
|
106
|
+
rightClick(p: PointerPoint): Promise<void>;
|
|
107
|
+
hover(p: PointerPoint): Promise<void>;
|
|
108
|
+
dragAndDrop(from: PointerPoint, to: PointerPoint): Promise<void>;
|
|
109
|
+
};
|
|
110
|
+
keyboard: KeyboardInputPrimitives;
|
|
111
|
+
scroll: ScrollInputPrimitives;
|
|
112
|
+
}
|
|
9
113
|
export declare abstract class AbstractInterface {
|
|
10
114
|
abstract interfaceType: string;
|
|
11
115
|
abstract screenshotBase64(): Promise<string>;
|
|
@@ -28,13 +132,39 @@ export declare abstract class AbstractInterface {
|
|
|
28
132
|
abstract url?: () => string | Promise<string>;
|
|
29
133
|
abstract evaluateJavaScript?<T = any>(script: string): Promise<T>;
|
|
30
134
|
/**
|
|
31
|
-
* Get the current time
|
|
32
|
-
*
|
|
33
|
-
*
|
|
135
|
+
* Get the current device-local time as a formatted string.
|
|
136
|
+
* Prefer this for user-visible time because timestamps alone do not preserve
|
|
137
|
+
* the target device's timezone when formatted on the host machine.
|
|
34
138
|
*/
|
|
35
|
-
|
|
139
|
+
getDeviceLocalTimeString?(format?: string): Promise<string>;
|
|
36
140
|
/** URL of native MJPEG stream for real-time screen preview (e.g. WDA MJPEG server) */
|
|
37
141
|
mjpegStreamUrl?: string;
|
|
142
|
+
/**
|
|
143
|
+
* Optional in-process MJPEG frame producer. Implementations can push raw
|
|
144
|
+
* base64 frames here when there is no standalone native MJPEG URL, e.g.
|
|
145
|
+
* Chromium CDP Page.startScreencast for web previews.
|
|
146
|
+
*/
|
|
147
|
+
startMjpegStream?(options: MjpegStreamOptions): MjpegStreamHandle | undefined | Promise<MjpegStreamHandle | undefined>;
|
|
148
|
+
/**
|
|
149
|
+
* Optional hook used after keyboard-only actions to force a fresh frame on
|
|
150
|
+
* the active MJPEG stream. Implementations should be a no-op when no stream
|
|
151
|
+
* is active.
|
|
152
|
+
*/
|
|
153
|
+
flushPendingVisualUpdate?(): Promise<void>;
|
|
154
|
+
/**
|
|
155
|
+
* Optional navigation state probe for browser-like interfaces, used to drive
|
|
156
|
+
* loading indicators in playground UIs. Returning `undefined` means the
|
|
157
|
+
* interface does not expose this concept.
|
|
158
|
+
*/
|
|
159
|
+
navigationState?(): Promise<{
|
|
160
|
+
isLoading: boolean;
|
|
161
|
+
}>;
|
|
162
|
+
/**
|
|
163
|
+
* Low-level device input surface. Platform implementations expose transport
|
|
164
|
+
* primitives here; higher-level AI actions and manual pointer dispatch should
|
|
165
|
+
* adapt to this instead of duplicating platform gesture logic.
|
|
166
|
+
*/
|
|
167
|
+
inputPrimitives?: InputPrimitives;
|
|
38
168
|
}
|
|
39
169
|
export declare const defineAction: <TSchema extends z.ZodType | undefined = undefined, TRuntime = TSchema extends z.ZodType ? z.infer<TSchema> : undefined, TReturn = any>(config: {
|
|
40
170
|
name: string;
|
|
@@ -193,7 +323,7 @@ export declare const actionTapParamSchema: z.ZodObject<{
|
|
|
193
323
|
export type ActionTapParam = {
|
|
194
324
|
locate: LocateResultElement;
|
|
195
325
|
};
|
|
196
|
-
export declare const defineActionTap: (
|
|
326
|
+
export declare const defineActionTap: (tap: PointerInputPrimitives["tap"]) => DeviceAction<ActionTapParam>;
|
|
197
327
|
export declare const actionRightClickParamSchema: z.ZodObject<{
|
|
198
328
|
locate: z.ZodObject<{
|
|
199
329
|
prompt: z.ZodUnion<[z.ZodString, z.ZodIntersection<z.ZodObject<{
|
|
@@ -344,7 +474,7 @@ export declare const actionRightClickParamSchema: z.ZodObject<{
|
|
|
344
474
|
export type ActionRightClickParam = {
|
|
345
475
|
locate: LocateResultElement;
|
|
346
476
|
};
|
|
347
|
-
export declare const defineActionRightClick: (
|
|
477
|
+
export declare const defineActionRightClick: (rightClick: NonNullable<PointerInputPrimitives["rightClick"]>) => DeviceAction<ActionRightClickParam>;
|
|
348
478
|
export declare const actionDoubleClickParamSchema: z.ZodObject<{
|
|
349
479
|
locate: z.ZodObject<{
|
|
350
480
|
prompt: z.ZodUnion<[z.ZodString, z.ZodIntersection<z.ZodObject<{
|
|
@@ -495,7 +625,7 @@ export declare const actionDoubleClickParamSchema: z.ZodObject<{
|
|
|
495
625
|
export type ActionDoubleClickParam = {
|
|
496
626
|
locate: LocateResultElement;
|
|
497
627
|
};
|
|
498
|
-
export declare const defineActionDoubleClick: (
|
|
628
|
+
export declare const defineActionDoubleClick: (doubleClick: NonNullable<PointerInputPrimitives["doubleClick"]>) => DeviceAction<ActionDoubleClickParam>;
|
|
499
629
|
export declare const actionHoverParamSchema: z.ZodObject<{
|
|
500
630
|
locate: z.ZodObject<{
|
|
501
631
|
prompt: z.ZodUnion<[z.ZodString, z.ZodIntersection<z.ZodObject<{
|
|
@@ -646,7 +776,7 @@ export declare const actionHoverParamSchema: z.ZodObject<{
|
|
|
646
776
|
export type ActionHoverParam = {
|
|
647
777
|
locate: LocateResultElement;
|
|
648
778
|
};
|
|
649
|
-
export declare const defineActionHover: (
|
|
779
|
+
export declare const defineActionHover: (hover: NonNullable<PointerInputPrimitives["hover"]>) => DeviceAction<ActionHoverParam>;
|
|
650
780
|
export declare const actionInputParamSchema: z.ZodObject<{
|
|
651
781
|
value: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, string, string | number>;
|
|
652
782
|
locate: z.ZodOptional<z.ZodObject<{
|
|
@@ -759,6 +889,7 @@ export declare const actionInputParamSchema: z.ZodObject<{
|
|
|
759
889
|
xpath: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
760
890
|
}, z.ZodTypeAny, "passthrough">>>;
|
|
761
891
|
mode: z.ZodDefault<z.ZodEnum<["replace", "clear", "typeOnly"]>>;
|
|
892
|
+
autoDismissKeyboard: z.ZodOptional<z.ZodBoolean>;
|
|
762
893
|
}, "strip", z.ZodTypeAny, {
|
|
763
894
|
value: string;
|
|
764
895
|
mode: "replace" | "clear" | "typeOnly";
|
|
@@ -799,6 +930,7 @@ export declare const actionInputParamSchema: z.ZodObject<{
|
|
|
799
930
|
cacheable: z.ZodOptional<z.ZodBoolean>;
|
|
800
931
|
xpath: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
801
932
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
933
|
+
autoDismissKeyboard?: boolean | undefined;
|
|
802
934
|
}, {
|
|
803
935
|
value: string | number;
|
|
804
936
|
locate?: z.objectInputType<{
|
|
@@ -839,13 +971,15 @@ export declare const actionInputParamSchema: z.ZodObject<{
|
|
|
839
971
|
xpath: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
840
972
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
841
973
|
mode?: "replace" | "clear" | "typeOnly" | undefined;
|
|
974
|
+
autoDismissKeyboard?: boolean | undefined;
|
|
842
975
|
}>;
|
|
843
976
|
export type ActionInputParam = {
|
|
844
977
|
value: string;
|
|
845
978
|
locate?: LocateResultElement;
|
|
846
979
|
mode?: 'replace' | 'clear' | 'typeOnly' | 'append';
|
|
980
|
+
autoDismissKeyboard?: boolean;
|
|
847
981
|
};
|
|
848
|
-
export declare const defineActionInput: (
|
|
982
|
+
export declare const defineActionInput: (keyboard: KeyboardInputPrimitives) => DeviceAction<ActionInputParam>;
|
|
849
983
|
export declare const actionKeyboardPressParamSchema: z.ZodObject<{
|
|
850
984
|
locate: z.ZodOptional<z.ZodObject<{
|
|
851
985
|
prompt: z.ZodUnion<[z.ZodString, z.ZodIntersection<z.ZodObject<{
|
|
@@ -1040,7 +1174,7 @@ export type ActionKeyboardPressParam = {
|
|
|
1040
1174
|
locate?: LocateResultElement;
|
|
1041
1175
|
keyName: string;
|
|
1042
1176
|
};
|
|
1043
|
-
export declare const defineActionKeyboardPress: (
|
|
1177
|
+
export declare const defineActionKeyboardPress: (keyboardPress: KeyboardInputPrimitives["keyboardPress"]) => DeviceAction<ActionKeyboardPressParam>;
|
|
1044
1178
|
export declare const actionScrollParamSchema: z.ZodObject<{
|
|
1045
1179
|
scrollType: z.ZodDefault<z.ZodEnum<["singleAction", "scrollToBottom", "scrollToTop", "scrollToRight", "scrollToLeft"]>>;
|
|
1046
1180
|
direction: z.ZodDefault<z.ZodEnum<["down", "up", "right", "left"]>>;
|
|
@@ -1156,7 +1290,7 @@ export declare const actionScrollParamSchema: z.ZodObject<{
|
|
|
1156
1290
|
}, z.ZodTypeAny, "passthrough">>>;
|
|
1157
1291
|
}, "strip", z.ZodTypeAny, {
|
|
1158
1292
|
scrollType: "singleAction" | "scrollToBottom" | "scrollToTop" | "scrollToRight" | "scrollToLeft";
|
|
1159
|
-
direction: "
|
|
1293
|
+
direction: "left" | "right" | "down" | "up";
|
|
1160
1294
|
locate?: z.objectOutputType<{
|
|
1161
1295
|
prompt: z.ZodUnion<[z.ZodString, z.ZodIntersection<z.ZodObject<{
|
|
1162
1296
|
prompt: z.ZodString;
|
|
@@ -1234,10 +1368,10 @@ export declare const actionScrollParamSchema: z.ZodObject<{
|
|
|
1234
1368
|
xpath: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
1235
1369
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1236
1370
|
scrollType?: "singleAction" | "scrollToBottom" | "scrollToTop" | "scrollToRight" | "scrollToLeft" | undefined;
|
|
1237
|
-
direction?: "
|
|
1371
|
+
direction?: "left" | "right" | "down" | "up" | undefined;
|
|
1238
1372
|
distance?: number | null | undefined;
|
|
1239
1373
|
}>;
|
|
1240
|
-
export declare const defineActionScroll: (
|
|
1374
|
+
export declare const defineActionScroll: (scroll: ScrollInputPrimitives["scroll"]) => DeviceAction<ActionScrollParam>;
|
|
1241
1375
|
export declare const actionDragAndDropParamSchema: z.ZodObject<{
|
|
1242
1376
|
from: z.ZodObject<{
|
|
1243
1377
|
prompt: z.ZodUnion<[z.ZodString, z.ZodIntersection<z.ZodObject<{
|
|
@@ -1532,7 +1666,7 @@ export type ActionDragAndDropParam = {
|
|
|
1532
1666
|
from: LocateResultElement;
|
|
1533
1667
|
to: LocateResultElement;
|
|
1534
1668
|
};
|
|
1535
|
-
export declare const defineActionDragAndDrop: (
|
|
1669
|
+
export declare const defineActionDragAndDrop: (dragAndDrop: NonNullable<PointerInputPrimitives["dragAndDrop"]>) => DeviceAction<ActionDragAndDropParam>;
|
|
1536
1670
|
export declare const ActionLongPressParamSchema: z.ZodObject<{
|
|
1537
1671
|
locate: z.ZodObject<{
|
|
1538
1672
|
prompt: z.ZodUnion<[z.ZodString, z.ZodIntersection<z.ZodObject<{
|
|
@@ -1643,7 +1777,7 @@ export declare const ActionLongPressParamSchema: z.ZodObject<{
|
|
|
1643
1777
|
cacheable: z.ZodOptional<z.ZodBoolean>;
|
|
1644
1778
|
xpath: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
1645
1779
|
}, z.ZodTypeAny, "passthrough">>;
|
|
1646
|
-
duration: z.ZodOptional<z.
|
|
1780
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
1647
1781
|
}, "strip", z.ZodTypeAny, {
|
|
1648
1782
|
locate: {
|
|
1649
1783
|
prompt: string | ({
|
|
@@ -1687,7 +1821,7 @@ export type ActionLongPressParam = {
|
|
|
1687
1821
|
locate: LocateResultElement;
|
|
1688
1822
|
duration?: number;
|
|
1689
1823
|
};
|
|
1690
|
-
export declare const defineActionLongPress: (
|
|
1824
|
+
export declare const defineActionLongPress: (longPress: NonNullable<PointerInputPrimitives["longPress"]>) => DeviceAction<ActionLongPressParam>;
|
|
1691
1825
|
export declare const ActionSwipeParamSchema: z.ZodObject<{
|
|
1692
1826
|
start: z.ZodOptional<z.ZodObject<{
|
|
1693
1827
|
prompt: z.ZodUnion<[z.ZodString, z.ZodIntersection<z.ZodObject<{
|
|
@@ -1913,7 +2047,7 @@ export declare const ActionSwipeParamSchema: z.ZodObject<{
|
|
|
1913
2047
|
repeat: z.ZodOptional<z.ZodNumber>;
|
|
1914
2048
|
}, "strip", z.ZodTypeAny, {
|
|
1915
2049
|
duration: number;
|
|
1916
|
-
direction?: "
|
|
2050
|
+
direction?: "left" | "right" | "down" | "up" | undefined;
|
|
1917
2051
|
distance?: number | undefined;
|
|
1918
2052
|
start?: z.objectOutputType<{
|
|
1919
2053
|
prompt: z.ZodUnion<[z.ZodString, z.ZodIntersection<z.ZodObject<{
|
|
@@ -1991,7 +2125,7 @@ export declare const ActionSwipeParamSchema: z.ZodObject<{
|
|
|
1991
2125
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1992
2126
|
repeat?: number | undefined;
|
|
1993
2127
|
}, {
|
|
1994
|
-
direction?: "
|
|
2128
|
+
direction?: "left" | "right" | "down" | "up" | undefined;
|
|
1995
2129
|
distance?: number | undefined;
|
|
1996
2130
|
duration?: number | undefined;
|
|
1997
2131
|
start?: z.objectInputType<{
|
|
@@ -2093,7 +2227,10 @@ export declare function normalizeMobileSwipeParam(param: ActionSwipeParam, scree
|
|
|
2093
2227
|
duration: number;
|
|
2094
2228
|
repeatCount: number;
|
|
2095
2229
|
};
|
|
2096
|
-
export declare const defineActionSwipe: (
|
|
2230
|
+
export declare const defineActionSwipe: (config: {
|
|
2231
|
+
swipe: TouchInputPrimitives["swipe"];
|
|
2232
|
+
size(): Promise<Size>;
|
|
2233
|
+
}) => DeviceAction<ActionSwipeParam>;
|
|
2097
2234
|
export declare const actionClearInputParamSchema: z.ZodObject<{
|
|
2098
2235
|
locate: z.ZodOptional<z.ZodObject<{
|
|
2099
2236
|
prompt: z.ZodUnion<[z.ZodString, z.ZodIntersection<z.ZodObject<{
|
|
@@ -2284,22 +2421,25 @@ export declare const actionClearInputParamSchema: z.ZodObject<{
|
|
|
2284
2421
|
export type ActionClearInputParam = {
|
|
2285
2422
|
locate?: LocateResultElement;
|
|
2286
2423
|
};
|
|
2287
|
-
export declare const defineActionClearInput: (
|
|
2424
|
+
export declare const defineActionClearInput: (clearInput: KeyboardInputPrimitives["clearInput"]) => DeviceAction<ActionClearInputParam>;
|
|
2288
2425
|
export declare const actionCursorMoveParamSchema: z.ZodObject<{
|
|
2289
2426
|
direction: z.ZodEnum<["left", "right"]>;
|
|
2290
2427
|
times: z.ZodDefault<z.ZodNumber>;
|
|
2291
2428
|
}, "strip", z.ZodTypeAny, {
|
|
2292
|
-
direction: "
|
|
2429
|
+
direction: "left" | "right";
|
|
2293
2430
|
times: number;
|
|
2294
2431
|
}, {
|
|
2295
|
-
direction: "
|
|
2432
|
+
direction: "left" | "right";
|
|
2296
2433
|
times?: number | undefined;
|
|
2297
2434
|
}>;
|
|
2298
2435
|
export type ActionCursorMoveParam = {
|
|
2299
2436
|
direction: 'left' | 'right';
|
|
2300
2437
|
times?: number;
|
|
2301
2438
|
};
|
|
2302
|
-
export declare const defineActionCursorMove: (
|
|
2439
|
+
export declare const defineActionCursorMove: (config: {
|
|
2440
|
+
keyboard: Pick<KeyboardInputPrimitives, "keyboardPress" | "cursorMove">;
|
|
2441
|
+
sleep?(timeMs: number): Promise<void>;
|
|
2442
|
+
}) => DeviceAction<ActionCursorMoveParam>;
|
|
2303
2443
|
export declare const ActionPinchParamSchema: z.ZodObject<{
|
|
2304
2444
|
locate: z.ZodOptional<z.ZodObject<{
|
|
2305
2445
|
prompt: z.ZodUnion<[z.ZodString, z.ZodIntersection<z.ZodObject<{
|
|
@@ -2502,7 +2642,10 @@ export type ActionPinchParam = {
|
|
|
2502
2642
|
distance?: number;
|
|
2503
2643
|
duration?: number;
|
|
2504
2644
|
};
|
|
2505
|
-
export declare const defineActionPinch: (
|
|
2645
|
+
export declare const defineActionPinch: (config: {
|
|
2646
|
+
pinch: TouchInputPrimitives["pinch"];
|
|
2647
|
+
size(): Promise<Size>;
|
|
2648
|
+
}) => DeviceAction<ActionPinchParam> | undefined;
|
|
2506
2649
|
export declare function normalizePinchParam(param: ActionPinchParam, screenSize: {
|
|
2507
2650
|
width: number;
|
|
2508
2651
|
height: number;
|
|
@@ -2513,6 +2656,34 @@ export declare function normalizePinchParam(param: ActionPinchParam, screenSize:
|
|
|
2513
2656
|
endDistance: number;
|
|
2514
2657
|
duration: number;
|
|
2515
2658
|
};
|
|
2659
|
+
export interface MobileInputActionContext {
|
|
2660
|
+
input: MobileInputPrimitives;
|
|
2661
|
+
size(): Promise<Size>;
|
|
2662
|
+
sleep?(timeMs: number): Promise<void>;
|
|
2663
|
+
getDefaultAutoDismissKeyboard?(): boolean | undefined;
|
|
2664
|
+
systemActions?: SystemInputActionOptions;
|
|
2665
|
+
}
|
|
2666
|
+
export interface SystemInputActionConfig {
|
|
2667
|
+
name: string;
|
|
2668
|
+
description: string;
|
|
2669
|
+
interfaceAlias?: string;
|
|
2670
|
+
delayBeforeRunner?: number;
|
|
2671
|
+
delayAfterRunner?: number;
|
|
2672
|
+
}
|
|
2673
|
+
export interface SystemInputActionOptions {
|
|
2674
|
+
backButton?: SystemInputActionConfig;
|
|
2675
|
+
homeButton?: SystemInputActionConfig;
|
|
2676
|
+
recentAppsButton?: SystemInputActionConfig;
|
|
2677
|
+
}
|
|
2678
|
+
export interface InputPrimitiveActionOptions {
|
|
2679
|
+
size?: () => Promise<Size>;
|
|
2680
|
+
sleep?: (timeMs: number) => Promise<void>;
|
|
2681
|
+
includeSwipe?: boolean;
|
|
2682
|
+
includePinch?: boolean;
|
|
2683
|
+
systemActions?: SystemInputActionOptions;
|
|
2684
|
+
}
|
|
2685
|
+
export declare function defineActionsFromInputPrimitives(input: InputPrimitives, options?: InputPrimitiveActionOptions): DeviceAction<any>[];
|
|
2686
|
+
export declare function createDefaultMobileActions(context: MobileInputActionContext): DeviceAction<any>[];
|
|
2516
2687
|
export declare const ActionSleepParamSchema: z.ZodObject<{
|
|
2517
2688
|
timeMs: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
2518
2689
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -36,12 +36,12 @@ export declare class ScreenshotStore {
|
|
|
36
36
|
mode: 'inline' | 'directory';
|
|
37
37
|
reportPath: string;
|
|
38
38
|
screenshotsDir?: string;
|
|
39
|
-
writeInlineImage?: (id: string, base64: string) => void
|
|
39
|
+
writeInlineImage?: (id: string, base64: string) => void | Promise<void>;
|
|
40
40
|
alsoWriteFileCopy?: boolean;
|
|
41
41
|
/** @deprecated Use alsoWriteFileCopy instead. */
|
|
42
42
|
ensureFileCopy?: boolean;
|
|
43
43
|
});
|
|
44
|
-
persist(screenshot: ScreenshotItem): ScreenshotRef
|
|
44
|
+
persist(screenshot: ScreenshotItem): Promise<ScreenshotRef>;
|
|
45
45
|
private persistToSharedFileIfNeeded;
|
|
46
46
|
loadBase64(refInput: unknown): string;
|
|
47
47
|
cleanup(): void;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { getVersion } from './utils';
|
|
|
5
5
|
export { plan, AiLocateElement, runConnectivityTest, getMidsceneLocationSchema, PointSchema, SizeSchema, RectSchema, TMultimodalPromptSchema, TUserPromptSchema, type TMultimodalPrompt, type TUserPrompt, type ConnectivityCheckResultItem, type ConnectivityTestConfig, type ConnectivityTestResult, } from './ai-model/index';
|
|
6
6
|
export { MIDSCENE_MODEL_NAME, type CreateOpenAIClientFn, } from '@aiscene/shared/env';
|
|
7
7
|
export type * from './types';
|
|
8
|
-
export type { DeviceAction, } from './types';
|
|
9
8
|
export { ServiceError, ExecutionDump, ReportActionDump, GroupedActionDump, type IExecutionDump, type IReportActionDump, type IGroupedActionDump, type ReportMeta, type GroupMeta, } from './types';
|
|
10
9
|
export { z };
|
|
11
10
|
export default Service;
|
|
@@ -49,12 +49,14 @@ export declare class ReportGenerator implements IReportGenerator {
|
|
|
49
49
|
screenshotMode: 'inline' | 'directory';
|
|
50
50
|
persistExecutionDump?: boolean;
|
|
51
51
|
autoPrint?: boolean;
|
|
52
|
+
reuseExistingReport?: boolean;
|
|
52
53
|
});
|
|
53
54
|
static create(reportFileName: string, opts: {
|
|
54
55
|
generateReport?: boolean;
|
|
55
56
|
persistExecutionDump?: boolean;
|
|
56
57
|
outputFormat?: 'single-html' | 'html-and-external-assets';
|
|
57
58
|
autoPrintReportMsg?: boolean;
|
|
59
|
+
reuseExistingReport?: boolean;
|
|
58
60
|
}): IReportGenerator;
|
|
59
61
|
onExecutionUpdate(execution: ExecutionDump, reportMeta: ReportMeta, attributes?: ReportAttributes): void;
|
|
60
62
|
flush(): Promise<void>;
|
|
@@ -73,6 +75,11 @@ export declare class ReportGenerator implements IReportGenerator {
|
|
|
73
75
|
* Append-only inline mode: write new screenshots and a dump tag on every call.
|
|
74
76
|
* The frontend deduplicates executions with the same id/name (keeps last).
|
|
75
77
|
* Duplicate dump JSON is acceptable; only screenshots are deduplicated.
|
|
78
|
+
*
|
|
79
|
+
* All writes go through `fs/promises` so they run on libuv's thread pool
|
|
80
|
+
* rather than blocking the Node event loop. A long agent run previously
|
|
81
|
+
* appended multi-MB dumps (screenshots + serialized tasks) per progress
|
|
82
|
+
* tick on the main thread, starving IPC and UI for >10s per stall.
|
|
76
83
|
*/
|
|
77
84
|
private writeInlineExecution;
|
|
78
85
|
private writeDirectoryExecution;
|