@autotest/agent 0.0.1
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/README.md +648 -0
- package/dist/api/agent_api.d.ts +37 -0
- package/dist/api/autotest_agent.d.ts +60 -0
- package/dist/api/types.d.ts +86 -0
- package/dist/autotest-cli.d.ts +2 -0
- package/dist/common/case_manager.d.ts +10 -0
- package/dist/common/collect_case.d.ts +29 -0
- package/dist/common/common_errors.d.ts +30 -0
- package/dist/common/config/config.yaml +113 -0
- package/dist/common/config/config_validator.d.ts +8 -0
- package/dist/common/config/manager.d.ts +38 -0
- package/dist/common/config/output.d.ts +11 -0
- package/dist/common/config/types.d.ts +2963 -0
- package/dist/common/dfx/client_factory.d.ts +23 -0
- package/dist/common/dfx/context.d.ts +4 -0
- package/dist/common/dfx/index.d.ts +6 -0
- package/dist/common/dfx/recorder.d.ts +59 -0
- package/dist/common/dfx/recording_fetch.d.ts +4 -0
- package/dist/common/dfx/source.d.ts +9 -0
- package/dist/common/image_cacher.d.ts +10 -0
- package/dist/common/image_helper.d.ts +19 -0
- package/dist/common/image_similarity.d.ts +7 -0
- package/dist/common/llm_cache/cache_transport.d.ts +10 -0
- package/dist/common/logger.d.ts +17 -0
- package/dist/common/model/custom_model.d.ts +52 -0
- package/dist/common/model/index.d.ts +3 -0
- package/dist/common/path_utils.d.ts +11 -0
- package/dist/common/result_parser.d.ts +10 -0
- package/dist/common/usage/token_usage.d.ts +23 -0
- package/dist/common/utils.d.ts +44 -0
- package/dist/core/agent/layered_agent/ability_helper.d.ts +36 -0
- package/dist/core/agent/layered_agent/agent.d.ts +15 -0
- package/dist/core/agent/layered_agent/agent_registry.d.ts +34 -0
- package/dist/core/agent/layered_agent/decision.d.ts +82 -0
- package/dist/core/agent/layered_agent/execute_agent/action_handler.d.ts +26 -0
- package/dist/core/agent/layered_agent/execute_agent/agent_factory.d.ts +24 -0
- package/dist/core/agent/layered_agent/execute_agent/base_agent.d.ts +83 -0
- package/dist/core/agent/layered_agent/execute_agent/general_agent.d.ts +33 -0
- package/dist/core/agent/layered_agent/execute_agent/glm_agent.d.ts +36 -0
- package/dist/core/agent/layered_agent/execute_agent/i18n.d.ts +26 -0
- package/dist/core/agent/layered_agent/execute_agent/index.d.ts +16 -0
- package/dist/core/agent/layered_agent/execute_agent/mai_ui_agent.d.ts +52 -0
- package/dist/core/agent/layered_agent/execute_agent/mcp_prompts.d.ts +4 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/general_parser.d.ts +22 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/glm_parser.d.ts +14 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/index.d.ts +7 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/mai_ui_parser.d.ts +17 -0
- package/dist/core/agent/layered_agent/execute_agent/prompts.d.ts +2 -0
- package/dist/core/agent/layered_agent/execute_agent/simple_reporter.d.ts +13 -0
- package/dist/core/agent/layered_agent/execute_agent/utils.d.ts +6 -0
- package/dist/core/agent/report_analyzer_agent/agent.d.ts +22 -0
- package/dist/core/agent/report_analyzer_agent/config.d.ts +5 -0
- package/dist/core/agent/report_analyzer_agent/data_loader.d.ts +26 -0
- package/dist/core/agent/report_analyzer_agent/guardrails.d.ts +9 -0
- package/dist/core/agent/report_analyzer_agent/hooks.d.ts +6 -0
- package/dist/core/agent/report_analyzer_agent/index.d.ts +17 -0
- package/dist/core/agent/report_analyzer_agent/key_steps_builder.d.ts +9 -0
- package/dist/core/agent/report_analyzer_agent/mapping.d.ts +6 -0
- package/dist/core/agent/report_analyzer_agent/parse.d.ts +4 -0
- package/dist/core/agent/report_analyzer_agent/prompt.d.ts +2 -0
- package/dist/core/agent/report_analyzer_agent/prompts/main_agent.md +198 -0
- package/dist/core/agent/report_analyzer_agent/prompts/main_agent_v2.0.md +420 -0
- package/dist/core/agent/report_analyzer_agent/report_writer.d.ts +8 -0
- package/dist/core/agent/report_analyzer_agent/tools.d.ts +26 -0
- package/dist/core/agent/report_analyzer_agent/types.d.ts +97 -0
- package/dist/core/agent/rewrite_agent/agent.d.ts +27 -0
- package/dist/core/agent/rewrite_agent/guardrails.d.ts +16 -0
- package/dist/core/agent/rewrite_agent/mapping.d.ts +25 -0
- package/dist/core/agent/rewrite_agent/parse.d.ts +14 -0
- package/dist/core/agent/rewrite_agent/prompts/rewriter_v1.0.md +168 -0
- package/dist/core/agent/rewrite_agent/types.d.ts +50 -0
- package/dist/core/agent/single_agent/agent.d.ts +43 -0
- package/dist/core/agent/single_agent/hook_manager.d.ts +43 -0
- package/dist/core/agent/single_agent/hooks.d.ts +23 -0
- package/dist/core/agent/single_agent/image_utils.d.ts +38 -0
- package/dist/core/agent/single_agent/scroll_search_agent.d.ts +58 -0
- package/dist/core/agent/single_agent/subagent_manager.d.ts +51 -0
- package/dist/core/agent/single_agent/tool_recorder_hook.d.ts +20 -0
- package/dist/core/agent/types.d.ts +43 -0
- package/dist/core/agent/utils/message_builder.d.ts +38 -0
- package/dist/core/device/device_protocol.d.ts +3 -0
- package/dist/core/device/hdc/apps.d.ts +38 -0
- package/dist/core/device/hdc/device.d.ts +59 -0
- package/dist/core/device/hdc/index.d.ts +9 -0
- package/dist/core/device/hdc/input.d.ts +20 -0
- package/dist/core/device/hdc/screenshot.d.ts +19 -0
- package/dist/core/device/index.d.ts +49 -0
- package/dist/core/device/types.d.ts +37 -0
- package/dist/core/knowledge/knowledge_manager.d.ts +22 -0
- package/dist/core/knowledge/vectordb.d.ts +44 -0
- package/dist/core/mcp/adapter_factory.d.ts +10 -0
- package/dist/core/mcp/android_adapter.d.ts +30 -0
- package/dist/core/mcp/base_adapter.d.ts +26 -0
- package/dist/core/mcp/harmony_hdc_adapter.d.ts +49 -0
- package/dist/core/mcp/ios_adapter.d.ts +30 -0
- package/dist/core/mcp/local_tools.d.ts +20 -0
- package/dist/core/mcp/mcp_tools.d.ts +51 -0
- package/dist/core/mcp/types.d.ts +24 -0
- package/dist/core/memory/compressed_session.d.ts +46 -0
- package/dist/core/memory/context_compressor.d.ts +24 -0
- package/dist/core/memory/index.d.ts +7 -0
- package/dist/core/memory/memory_manager.d.ts +21 -0
- package/dist/core/memory/reflector.d.ts +20 -0
- package/dist/core/memory/session_factory.d.ts +17 -0
- package/dist/core/memory/tool_player.d.ts +82 -0
- package/dist/core/memory/tool_recorder.d.ts +33 -0
- package/dist/core/preprocessor/task_splitter.d.ts +26 -0
- package/dist/core/prompt/prompt_loader.d.ts +24 -0
- package/dist/core/prompt/templates/debug/planner/planner_v0.0.md +290 -0
- package/dist/core/prompt/templates/debug/planner/planner_v1.0.md +221 -0
- package/dist/core/prompt/templates/debug/planner/planner_v1.1-dy.md +74 -0
- package/dist/core/prompt/templates/debug/planner/planner_v2.0.md +319 -0
- package/dist/core/prompt/templates/fast_action/fast_action_v1.0.md +46 -0
- package/dist/core/prompt/templates/hypium/hypium_v1.0.md +33 -0
- package/dist/core/prompt/templates/hypium/hypium_v2.0.md +285 -0
- package/dist/core/prompt/templates/planner/planner_v2.0.md +319 -0
- package/dist/core/prompt/templates/single/single_v1.0.md +452 -0
- package/dist/core/prompt/templates/single/single_v2.0.md +306 -0
- package/dist/core/prompt/templates/single/single_v2.0_eco.md +313 -0
- package/dist/core/prompt/templates/single/single_v3.0.md +200 -0
- package/dist/core/prompt/templates/splitter/task_splitter_v1.0.md +141 -0
- package/dist/core/skill/skill_manager.d.ts +54 -0
- package/dist/data_types/action.d.ts +2 -0
- package/dist/data_types/agent.d.ts +2 -0
- package/dist/data_types/device.d.ts +2 -0
- package/dist/data_types/index.d.ts +6 -0
- package/dist/data_types/report.d.ts +2 -0
- package/dist/data_types/task.d.ts +2 -0
- package/dist/hypium_generator/generator.d.ts +38 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.js +1 -0
- package/dist/loop/cli.d.ts +39 -0
- package/dist/loop/orchestrator.d.ts +47 -0
- package/dist/loop/result_writer.d.ts +12 -0
- package/dist/loop/types.d.ts +77 -0
- package/dist/mcp-server/server.d.ts +15 -0
- package/dist/mcp-server/types.d.ts +196 -0
- package/dist/reporter/batch_summary.d.ts +19 -0
- package/dist/reporter/generator.d.ts +46 -0
- package/dist/reporter/types.d.ts +88 -0
- package/dist/tools/batch_runner.d.ts +92 -0
- package/package.json +51 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ModelConfig, AgentConfig } from '../../../../common/config/types';
|
|
2
|
+
import { LLMCaller } from '../../../../common/model';
|
|
3
|
+
import type { ExecutorDevice, ExecuteReporter } from './base_agent';
|
|
4
|
+
import { BaseAgent } from './base_agent';
|
|
5
|
+
export declare class GeneralAgent extends BaseAgent {
|
|
6
|
+
private llmCaller;
|
|
7
|
+
private parser;
|
|
8
|
+
private actionHandler;
|
|
9
|
+
private _context;
|
|
10
|
+
private _screenshot;
|
|
11
|
+
private _stepCount;
|
|
12
|
+
private _isRunning;
|
|
13
|
+
constructor(opts: {
|
|
14
|
+
modelConfig: ModelConfig;
|
|
15
|
+
agentConfig: AgentConfig;
|
|
16
|
+
device: ExecutorDevice;
|
|
17
|
+
confirmationCallback?: (message: string) => boolean;
|
|
18
|
+
thinkingCallback?: (chunk: string) => void;
|
|
19
|
+
reportGenerator?: ExecuteReporter | null;
|
|
20
|
+
llmCaller?: LLMCaller;
|
|
21
|
+
});
|
|
22
|
+
run(task: string): Promise<string>;
|
|
23
|
+
reset(): void;
|
|
24
|
+
private streamRequest;
|
|
25
|
+
private executeStep;
|
|
26
|
+
private manageHistoryImages;
|
|
27
|
+
get stepCount(): number;
|
|
28
|
+
get screenshot(): unknown[];
|
|
29
|
+
get context(): Array<Record<string, unknown>>;
|
|
30
|
+
get isRunning(): boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare function getMessagesForAgent(lang: string): import("./i18n").UIMessages;
|
|
33
|
+
//# sourceMappingURL=general_agent.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ModelConfig, AgentConfig } from '../../../../common/config/types';
|
|
2
|
+
import type { StepResult } from '../../types';
|
|
3
|
+
import { LLMCaller } from '../../../../common/model';
|
|
4
|
+
import type { ExecutorDevice, ExecuteReporter } from './base_agent';
|
|
5
|
+
import { BaseAgent } from './base_agent';
|
|
6
|
+
export declare class GLMAgent extends BaseAgent {
|
|
7
|
+
private llmCaller;
|
|
8
|
+
private parser;
|
|
9
|
+
private actionHandler;
|
|
10
|
+
private _context;
|
|
11
|
+
private _screenshot;
|
|
12
|
+
private _stepCount;
|
|
13
|
+
private _isRunning;
|
|
14
|
+
constructor(opts: {
|
|
15
|
+
modelConfig: ModelConfig;
|
|
16
|
+
agentConfig: AgentConfig;
|
|
17
|
+
device: ExecutorDevice;
|
|
18
|
+
confirmationCallback?: (message: string) => boolean;
|
|
19
|
+
takeoverCallback?: (message: string) => void;
|
|
20
|
+
thinkingCallback?: (chunk: string) => void;
|
|
21
|
+
reportGenerator?: ExecuteReporter | null;
|
|
22
|
+
llmCaller?: LLMCaller;
|
|
23
|
+
});
|
|
24
|
+
run(task: string): Promise<string>;
|
|
25
|
+
step(task?: string): Promise<StepResult>;
|
|
26
|
+
reset(): void;
|
|
27
|
+
abort(): void;
|
|
28
|
+
private parseRawResponse;
|
|
29
|
+
private streamRequest;
|
|
30
|
+
private executeStep;
|
|
31
|
+
get context(): Array<Record<string, unknown>>;
|
|
32
|
+
get stepCount(): number;
|
|
33
|
+
get screenshot(): unknown[];
|
|
34
|
+
get isRunning(): boolean;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=glm_agent.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface UIMessages {
|
|
2
|
+
thinking: string;
|
|
3
|
+
action: string;
|
|
4
|
+
taskCompleted: string;
|
|
5
|
+
done: string;
|
|
6
|
+
startingTask: string;
|
|
7
|
+
finalResult: string;
|
|
8
|
+
taskResult: string;
|
|
9
|
+
confirmationRequired: string;
|
|
10
|
+
continuePrompt: string;
|
|
11
|
+
manualOperationRequired: string;
|
|
12
|
+
manualOperationHint: string;
|
|
13
|
+
pressEnterWhenDone: string;
|
|
14
|
+
connectionFailed: string;
|
|
15
|
+
connectionSuccessful: string;
|
|
16
|
+
step: string;
|
|
17
|
+
task: string;
|
|
18
|
+
result: string;
|
|
19
|
+
performanceMetrics: string;
|
|
20
|
+
timeToFirstToken: string;
|
|
21
|
+
timeToThinkingEnd: string;
|
|
22
|
+
totalInferenceTime: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function getMessages(lang?: string): UIMessages;
|
|
25
|
+
export declare function getMessage(key: keyof UIMessages, lang?: string): string;
|
|
26
|
+
//# sourceMappingURL=i18n.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { BaseAgent } from './base_agent';
|
|
2
|
+
export type { ExecutorDevice, ExecuteReporter, ConfirmationCallback, ThinkingCallback, TakeoverCallback, BaseAgentConstructorOptions, ExecutorStepResult, } from './base_agent';
|
|
3
|
+
export { AgentFactory, createAgent } from './agent_factory';
|
|
4
|
+
export type { AgentCreateOptions, AgentFactoryFn } from './agent_factory';
|
|
5
|
+
export { GeneralAgent } from './general_agent';
|
|
6
|
+
export { GLMAgent } from './glm_agent';
|
|
7
|
+
export { MaiUiAgent } from './mai_ui_agent';
|
|
8
|
+
export { ActionHandler } from './action_handler';
|
|
9
|
+
export { SimpleReporter } from './simple_reporter';
|
|
10
|
+
export { SYSTEM_PROMPT } from './prompts';
|
|
11
|
+
export { MCP_SYSTEM_PROMPT, MCP_SYSTEM_PROMPT_BASIC, MCP_SYSTEM_PROMPT_ALL } from './mcp_prompts';
|
|
12
|
+
export { getMessages, getMessage } from './i18n';
|
|
13
|
+
export type { UIMessages } from './i18n';
|
|
14
|
+
export { waitIfNotExceed, asyncWaitIfNotExceed, sleep, sleepSync, runAsyncFunc } from './utils';
|
|
15
|
+
export * as Parser from './parser';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ModelConfig, AgentConfig } from '../../../../common/config/types';
|
|
2
|
+
import type { StepResult } from '../../types';
|
|
3
|
+
import { LLMCaller } from '../../../../common/model';
|
|
4
|
+
import type { ExecutorDevice, ExecuteReporter } from './base_agent';
|
|
5
|
+
import { BaseAgent } from './base_agent';
|
|
6
|
+
export declare class MaiUiAgent extends BaseAgent {
|
|
7
|
+
private llmCaller;
|
|
8
|
+
private actionHandler;
|
|
9
|
+
private parser;
|
|
10
|
+
private _context;
|
|
11
|
+
private _screenshot;
|
|
12
|
+
private _stepCount;
|
|
13
|
+
private _isRunning;
|
|
14
|
+
constructor(opts: {
|
|
15
|
+
modelConfig: ModelConfig;
|
|
16
|
+
agentConfig: AgentConfig;
|
|
17
|
+
device: ExecutorDevice;
|
|
18
|
+
confirmationCallback?: (message: string) => boolean;
|
|
19
|
+
takeoverCallback?: (message: string) => void;
|
|
20
|
+
thinkingCallback?: (chunk: string) => void;
|
|
21
|
+
reportGenerator?: ExecuteReporter | null;
|
|
22
|
+
llmCaller?: LLMCaller;
|
|
23
|
+
});
|
|
24
|
+
run(task: string): Promise<string>;
|
|
25
|
+
private resetExecutionState;
|
|
26
|
+
private shouldContinue;
|
|
27
|
+
step(task?: string): Promise<StepResult>;
|
|
28
|
+
reset(): void;
|
|
29
|
+
abort(): void;
|
|
30
|
+
private parseOutput;
|
|
31
|
+
private getToolsListForLlm;
|
|
32
|
+
private captureStepState;
|
|
33
|
+
private prepareFirstStepMessages;
|
|
34
|
+
private prepareContinuationMessages;
|
|
35
|
+
private executeLlmRequest;
|
|
36
|
+
private parseAction;
|
|
37
|
+
private logThinkingAndAction;
|
|
38
|
+
private reportThinkingAndAction;
|
|
39
|
+
private executeAction;
|
|
40
|
+
private reportStepEnd;
|
|
41
|
+
private appendAssistantResponse;
|
|
42
|
+
private isActionFinished;
|
|
43
|
+
private reportStepStart;
|
|
44
|
+
private executeStep;
|
|
45
|
+
private streamRequest;
|
|
46
|
+
get context(): Array<Record<string, unknown>>;
|
|
47
|
+
get stepCount(): number;
|
|
48
|
+
get screenshot(): unknown[];
|
|
49
|
+
get isRunning(): boolean;
|
|
50
|
+
cleanUp(): Promise<void>;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=mai_ui_agent.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const MCP_SYSTEM_PROMPT_BASIC = "You are a GUI operation agent. You will receive a task description, an action history, a screen screenshot, and a set of tools used for device operations. You need to decide the next action to take to complete the task based on the current interface state. Please operate based on the current interface and the given task, do not speculate about user intent.\n\n# Output Format Requirements\n- Must include a thinking section that first summarizes the history of operations, especially repeatedly retried operations, the decision reason for the current operation step, and the operation description.\n- The thinking section should summarize in one sentence.\n\n# Notes\n## Decide based on screenshot and history\n - Please analyze the current interface content based on the provided screenshot and user instruction, and select the most appropriate operation from the tools. Your judgment must be based on visual recognition of the controls on the interface.\n## Retry principle\n - Please pay attention to the operation history; the same operation sequence should be retried at most 2 times. If the operation does not achieve the expected result, terminate execution directly and report the failure reason.\n## Execution conditions\n - Please confirm whether the execution conditions are met before execution. If the execution conditions are not met, terminate execution directly and report the failure reason.\n## Target description\n - Please confirm the operations required by the target description in the task list, and only complete the operations specified in the target description.\n## Expected result\n - Please confirm the expected result before execution. If the expected result has been achieved, report completion directly.\n## Swipe description\n - Swipe from left to right -> right\n - Swipe from top to bottom -> down\n - Swipe from bottom to top -> up\n - Swipe from right to left -> left\n## Coordinate description\n - The coordinate format is (x, y), the coordinate range is (0, 1000), do not exceed the coordinate range.\n\n## Supported MCP Tools\n";
|
|
2
|
+
export declare const MCP_SYSTEM_PROMPT_ALL: string;
|
|
3
|
+
export declare const MCP_SYSTEM_PROMPT: string;
|
|
4
|
+
//# sourceMappingURL=mcp_prompts.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type ActionDict = Record<string, unknown>;
|
|
2
|
+
export interface GeneralAction extends ActionDict {
|
|
3
|
+
_metadata?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class GeneralParser {
|
|
6
|
+
get coordinateScale(): number;
|
|
7
|
+
parse(rawResponse: string, screenWidth: number, screenHeight: number): GeneralAction;
|
|
8
|
+
private extractCompleteGoal;
|
|
9
|
+
private extractTagContent;
|
|
10
|
+
private parseParams;
|
|
11
|
+
private mapAction;
|
|
12
|
+
private resolvePoint;
|
|
13
|
+
private normalizeCoord;
|
|
14
|
+
private normalizeDistance;
|
|
15
|
+
buildSwipeByDirection(direction: string | null | undefined, distance: unknown, screenWidth: number, screenHeight: number): {
|
|
16
|
+
start: [number, number] | null;
|
|
17
|
+
end: [number, number] | null;
|
|
18
|
+
};
|
|
19
|
+
private clamp;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=general_parser.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type ActionDict = Record<string, unknown>;
|
|
2
|
+
export interface GLMAction extends ActionDict {
|
|
3
|
+
_metadata?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class GLMParser {
|
|
6
|
+
get coordinateScale(): number;
|
|
7
|
+
parse(rawResponse: string, screenWidth: number, screenHeight: number): GLMAction;
|
|
8
|
+
private parseFinish;
|
|
9
|
+
private parseDo;
|
|
10
|
+
convertRelativeToAbsolute(element: Array<number>, screenWidth: number, screenHeight: number): number[];
|
|
11
|
+
private extractParams;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=glm_parser.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { GeneralParser } from './general_parser';
|
|
2
|
+
export type { GeneralAction } from './general_parser';
|
|
3
|
+
export { GLMParser } from './glm_parser';
|
|
4
|
+
export type { GLMAction } from './glm_parser';
|
|
5
|
+
export { MaiUiParser } from './mai_ui_parser';
|
|
6
|
+
export type { ParsedToolCall, TaggedParseResult } from './mai_ui_parser';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ParsedToolCall {
|
|
2
|
+
name: string;
|
|
3
|
+
arguments: Record<string, unknown>;
|
|
4
|
+
}
|
|
5
|
+
export interface TaggedParseResult {
|
|
6
|
+
thinking: string | null;
|
|
7
|
+
toolCall: ParsedToolCall | null;
|
|
8
|
+
}
|
|
9
|
+
export declare class MaiUiParser {
|
|
10
|
+
get coordinateScale(): number;
|
|
11
|
+
parse(llmOutput: string, _screenWidth: number, _screenHeight: number): ParsedToolCall;
|
|
12
|
+
parseTaggedText(text: string): TaggedParseResult;
|
|
13
|
+
private extractJsonBlock;
|
|
14
|
+
private extractFirstJsonObject;
|
|
15
|
+
convertRelativeToAbsolute(element: Array<number>, screenWidth: number, screenHeight: number): number[];
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=mai_ui_parser.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const SYSTEM_PROMPT = "You are the execution-layer Agent, responsible for strictly executing instructions from the superior (decision layer).\n\n## Core Positioning (Highest Priority)\n\nYou are the execution layer, not the decision layer.\n- Your responsibility: execute instructions from the superior, do not judge whether the instruction is meaningful.\n- Your superior (Planner): responsible for decisions, judging whether the task is complete.\n- Your role: tool executor, not task decision-maker.\n\n---\n\n## Mandatory Execution Rules (Must Follow)\n\nMust execute:\n- Receive an instruction from the superior then must execute, do not judge whether it is meaningful.\n- The superior asks to swipe then must swipe, do not judge whether there is content.\n- The superior asks to click then must click, do not judge whether it is correct.\n\nForbidden autonomous behaviors:\n- Forbidden to autonomously terminate (task completion is judged by the superior).\n- Forbidden to autonomously go back (going back is decided by the superior).\n- Forbidden to autonomously explore (exploration is planned by the superior).\n- Forbidden to judge whether an operation is meaningful.\n- Forbidden to think about whether you should go back to the previous level.\n- Forbidden to think about whether the task is complete.\n\n---\n\n## Output Format\n\nEach operation must contain two parts:\n1. Thinking process: describe observation and localization inside thinking tags.\n2. Action instruction: return a JSON function call inside a json code fence.\n\nExample:\n\n<thinking>\n**Observation**: The current screen shows a short-video playback interface, the superior asks to swipe up.\n**Localization**: The superior asks to swipe in the middle area of the screen, the coordinate area is about [300-700, 400-600].\n**Execution**: Swipe from bottom to top in the middle of the screen.\n</thinking>\n```json\n{\"name\": \"swipe\", \"arguments\": {\"direction\": \"up\", \"coordinate\": [500, 500]}}\n```\n\n---\n\n## Action Space (Strictly Follow)\n\n### Basic Operations\n- Click: {\"name\": \"click\", \"arguments\": {\"coordinate\": [x, y]}}\n Used to click the UI element specified by the superior.\n\n- Long press: {\"name\": \"long_press\", \"arguments\": {\"coordinate\": [x, y]}}\n Used to long-press the element specified by the superior.\n\n- Type text: {\"name\": \"type\", \"arguments\": {\"text\": \"text to input\"}}\n You must click the input box to focus it first, then use this action to input text.\n\n### Swipe Operations\n- Swipe: {\"name\": \"swipe\", \"arguments\": {\"direction\": \"up|down|left|right\", \"coordinate\": [x, y]}}\n direction options: up (swipe up), down (swipe down), left (swipe left), right (swipe right).\n coordinate: specifies the swipe start point (the position specified by the superior).\n\n- Drag: {\"name\": \"drag\", \"arguments\": {\"start_coordinate\": [x1, y1], \"end_coordinate\": [x2, y2]}}\n Used to drag an element to a new position (the start and end points specified by the superior).\n\n### System Operations\n- Open app: {\"name\": \"open\", \"arguments\": {\"text\": \"app name\"}}\n Used to open the app specified by the superior.\n\n### Wait Operations\n- Wait: {\"name\": \"wait\", \"arguments\": {}}\n Used to wait for the page to load (only used when the superior instruction includes waiting).\n\n---\n\n## Coordinate System\n- Range: both x and y are between [0, 999].\n- Origin: (0, 0) is the top-left corner of the screen.\n- Boundary: (999, 999) is the bottom-right corner of the screen.\n- Precision: coordinates are normalized and will be automatically mapped to the actual screen resolution.\n\n---\n\n## Thinking Process Template (Strictly Follow)\n\nOnly three parts:\n1. Observation: What does the current screen show? What is the operation target requested by the superior?\n2. Localization: Where is the element the superior asks to operate on? What are the coordinates?\n3. Execution: Return the execution instruction.\n\nForbidden to include:\n- Whether this operation is meaningful.\n- Whether you should go back to the previous level.\n- Whether the task is complete.\n- What to do when the target element cannot be found.\n- Slide to view when the page content is not fully displayed.\n\n---\n\n## Mandatory Principles Reiteration (Must Strictly Follow)\n\n- Strict execution: receive the instruction and must execute, do not judge the meaning.\n- No autonomy: no terminate, no autonomous back, no autonomous explore.\n- Observe-Locate-Execute: the thinking process only includes the three steps of observation, localization, and execution.";
|
|
2
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReportEvent } from '../../../../reporter/types';
|
|
2
|
+
export declare class SimpleReporter {
|
|
3
|
+
addEvent(event: ReportEvent): void;
|
|
4
|
+
addTokenUsage(_usage: unknown, _source?: string, _stepNumber?: number): void;
|
|
5
|
+
setTask(_task: string): void;
|
|
6
|
+
setTestCase(_testCase: string): void;
|
|
7
|
+
startTask(): void;
|
|
8
|
+
endTask(_result: string, _status?: string): void;
|
|
9
|
+
saveScreenshot(_base64Data: string, _layoutData?: string, _prefix?: string): string;
|
|
10
|
+
saveAll(_baseFilename?: string): Promise<Record<string, string>>;
|
|
11
|
+
getReportDir(): string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=simple_reporter.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function sleep(seconds: number): Promise<void>;
|
|
2
|
+
export declare function sleepSync(seconds: number): void;
|
|
3
|
+
export declare function waitIfNotExceed(waitTime: number, startTimestamp?: number | null): number;
|
|
4
|
+
export declare function asyncWaitIfNotExceed(waitTime: number, startTimestamp?: number | null): Promise<number>;
|
|
5
|
+
export declare function runAsyncFunc<T>(fn: () => Promise<T>, timeout?: number): Promise<T>;
|
|
6
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ModelConfig, AppConfig } from '../../../common/config/types';
|
|
2
|
+
import { type ReportData } from './data_loader';
|
|
3
|
+
import { AnalyzerOutput } from './types';
|
|
4
|
+
export declare class ReportAnalyzerAgent {
|
|
5
|
+
private modelConfig;
|
|
6
|
+
private appConfig;
|
|
7
|
+
private dataLoader;
|
|
8
|
+
private reportWriter;
|
|
9
|
+
private hooks;
|
|
10
|
+
constructor(config: ModelConfig, appConfig?: AppConfig);
|
|
11
|
+
run(reportDir: string): Promise<AnalyzerOutput>;
|
|
12
|
+
runFromData(reportData: ReportData, reportDir?: string): Promise<AnalyzerOutput>;
|
|
13
|
+
private precheck;
|
|
14
|
+
private runAgentWithRetry;
|
|
15
|
+
private runAgentLoop;
|
|
16
|
+
private parseToolCallMarkers;
|
|
17
|
+
private buildInitialInput;
|
|
18
|
+
private formatPlannerOutput;
|
|
19
|
+
private formatStepInventory;
|
|
20
|
+
private buildScreenshotData;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ModelConfig } from '../../../common/config/types';
|
|
2
|
+
export type { AnalyzerConfig } from '../../../common/config/types';
|
|
3
|
+
import type { AnalyzerConfig } from '../../../common/config/types';
|
|
4
|
+
export declare function resolveModelConfig(config: AnalyzerConfig, unifiedModel: ModelConfig): AnalyzerConfig;
|
|
5
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface StepData {
|
|
2
|
+
stepNumber: number;
|
|
3
|
+
thinking: string;
|
|
4
|
+
toolCall: Record<string, unknown>;
|
|
5
|
+
toolResult: Record<string, unknown>;
|
|
6
|
+
screenshots: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare function createStepData(stepNumber: number): StepData;
|
|
9
|
+
export interface ReportData {
|
|
10
|
+
task: string;
|
|
11
|
+
status: string;
|
|
12
|
+
resultText: string;
|
|
13
|
+
steps: StepData[];
|
|
14
|
+
}
|
|
15
|
+
export declare function createReportData(): ReportData;
|
|
16
|
+
export declare class DataLoader {
|
|
17
|
+
constructor();
|
|
18
|
+
load(reportDir: string): ReportData;
|
|
19
|
+
loadFromEvents(data: Record<string, unknown>, screenshotDir?: string | null): ReportData;
|
|
20
|
+
private validateReportDir;
|
|
21
|
+
private groupEventsByStep;
|
|
22
|
+
private populateEvent;
|
|
23
|
+
private resolveScreenshots;
|
|
24
|
+
private extractStatusAndResult;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=data_loader.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type AnalyzerContext, type RootCauseResult } from './types';
|
|
2
|
+
export declare const SCREENSHOT_CLAIM_PATTERN: RegExp;
|
|
3
|
+
export interface GuardrailResult {
|
|
4
|
+
tripwireTriggered: boolean;
|
|
5
|
+
outputInfo: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
export declare function validateOutput(context: AnalyzerContext, output: RootCauseResult): Promise<GuardrailResult>;
|
|
8
|
+
export declare function validateProcess(context: AnalyzerContext, output: RootCauseResult): Promise<GuardrailResult>;
|
|
9
|
+
//# sourceMappingURL=guardrails.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { ReportAnalyzerAgent } from './agent';
|
|
2
|
+
export type { AnalyzerConfig } from './config';
|
|
3
|
+
export { resolveModelConfig } from './config';
|
|
4
|
+
export { DataLoader } from './data_loader';
|
|
5
|
+
export type { ReportData, StepData } from './data_loader';
|
|
6
|
+
export { ReportWriter } from './report_writer';
|
|
7
|
+
export { AnalyzerOutput, RootCauseClassification, RootCauseCategory, AccuracyVerdict, resolveSubCategory, createAnalyzerContext, createRootCauseResult, type AnalyzerContext, type RootCauseResult, type PendingImage, ANALYSIS_SUBDIR, CONSISTENCY_SEVERITY_INFO, CONSISTENCY_SEVERITY_WARNING, CONSISTENCY_SEVERITY_ERROR, EVIDENCE_COMPLETE, EVIDENCE_PARTIAL, EVIDENCE_MISSING, EVIDENCE_NONE, VALID_ACCURACY_VALUES, VALID_CATEGORY_LABELS, ROOT_CAUSE_CATEGORY_LABELS, ROOT_CAUSE_SUB_CATEGORIES, } from './types';
|
|
8
|
+
export { validateOutput, validateProcess, SCREENSHOT_CLAIM_PATTERN } from './guardrails';
|
|
9
|
+
export type { GuardrailResult } from './guardrails';
|
|
10
|
+
export { mapResultToOutput, createErrorOutput, createPrecheckOutput } from './mapping';
|
|
11
|
+
export { parseRootCauseResult, parseMarkdownToDict } from './parse';
|
|
12
|
+
export { getStepScreenshot } from './tools';
|
|
13
|
+
export type { ScreenshotToolResult } from './tools';
|
|
14
|
+
export { AnalyzerHooks } from './hooks';
|
|
15
|
+
export { MAIN_AGENT_PROMPT } from './prompt';
|
|
16
|
+
export { selectKeySteps, expandWithContext, type StepVerdict } from './key_steps_builder';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface StepVerdict {
|
|
2
|
+
stepNumber: number;
|
|
3
|
+
overallStepVerdict: 'correct' | 'problematic' | 'critical_failure' | 'unknown';
|
|
4
|
+
needsScreenshotRefine: boolean;
|
|
5
|
+
thinkingCorrect: 'correct' | 'incorrect' | 'unknown';
|
|
6
|
+
}
|
|
7
|
+
export declare function selectKeySteps(stepVerdicts: StepVerdict[], maxKeySteps?: number): number[];
|
|
8
|
+
export declare function expandWithContext(keySteps: number[], totalSteps: number): number[];
|
|
9
|
+
//# sourceMappingURL=key_steps_builder.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AnalyzerOutput, type RootCauseResult } from './types';
|
|
2
|
+
import type { ReportData } from './data_loader';
|
|
3
|
+
export declare function mapResultToOutput(result: RootCauseResult, reportData: ReportData, modelUsed: string, duration: number, llmCalls: number): AnalyzerOutput;
|
|
4
|
+
export declare function createErrorOutput(reportDir: string, errorMsg: string, modelUsed: string, duration: number): AnalyzerOutput;
|
|
5
|
+
export declare function createPrecheckOutput(reportData: ReportData, reason: string, modelUsed: string, duration: number): AnalyzerOutput;
|
|
6
|
+
//# sourceMappingURL=mapping.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const MAIN_AGENT_PROMPT = "# Role\n\nYou are a senior QA analyst responsible for reviewing automated test reports, judging whether the test Agent's PASS/FAIL conclusion is accurate, and determining who caused the failure.\n\n# Task\n\nReview the test report. By analyzing the Agent's execution process and viewing screenshots, determine who caused the test failure, and based on that judge whether the original conclusion is accurate.\n\n# Thinking Process\n\n**Hard constraint**: Complete each phase in one pass; do not oscillate between phases. Evaluate all 5 attribution layers at once; do not repeatedly reconsider with \"But wait/Actually\". Once you move to the next phase, do not modify the previous phase's conclusion.\n\n## Fact Analysis (no attribution conclusions allowed)\n\nFirst clarify the task intent, then record objective facts step by step. **This phase forbids any attribution conclusions** -- only record \"what was observed\", do not judge \"who caused it\".\n\n1. **Task intent**: One sentence summarizing what function/scenario the task is meant to verify.\n2. **Step-by-step facts**: Record objective observations per step, one sentence each referencing the step number/evidence:\n - What operation did the Agent perform at each step\n - What did the Agent observe at each step (quote key sentences from the thinking)\n - What did the App actually do at each step (what was shown on the interface)\n - What did the test case expect at each step\n - What causal relationships exist between steps; which step is the key turning point\n - Is the Agent's observation self-consistent (any contradictions)\n - Did the Agent ignore evidence contradicting the conclusion\n\n**In this phase, call get_step_screenshot to obtain screenshot evidence**:\n- First output the suspected issues and step numbers that need screenshot review in the text analysis\n- Then call the tool to verify the suspicions (each call returns two screenshots: observed = what the Agent saw at decision time, before_action = the page before execution; compare the two to detect whether the page changed after the Agent observed it, e.g. carousel auto-switch -> operation lag)\n- Append the facts observed from screenshots to the step-by-step facts\n\n**Screenshot element interpretation guide**:\nElements in a screenshot may be real UI (popups, buttons, tab bars) or part of the content (post covers, screenshots inside cards, video frames). When interpreting:\n1. Do not assume an element is one type -- first observe appearance features (position, style, relationship with surrounding elements) and context\n2. When an element \"looks like\" some UI but appears in an unusual location, consider whether it might be part of the content\n\n**Analysis should be concise and focused**: First locate the 1-2 most suspicious steps, then call the tool to verify; do not make lengthy derivations.\n\n**Forbidden**:\n- No attribution conclusions (\"this is an Agent issue\" / \"this is an App bug\", etc.)\n- No \"But wait/Actually\" repeated reconsideration\n- No cross-step jumping reasoning\n\n## 5-Layer Equal Attribution (one-time evaluation, no repetition)\n\nBased on the objective facts recorded in the fact analysis phase, evaluate all 5 layers equally at once, **with no preset priority**. Choose the root cause by **evidence strength**: objective evidence (screenshot directly confirms a layer is wrong) > inferred evidence (LLM speculation). Choose the layer with objective evidence; when multiple layers have objective evidence, choose the more direct/abundant one; when only inference with no objective evidence exists, judge \"Inconclusive\".\n\nEvaluate these 5 layers at once:\n\n1. **App behavior**: What the App \"should do\" vs \"actually did\". **Only look at whether the app functionality/behavior is correct** (not whether the Agent operated correctly, not whether the test case expectation is reasonable)\n2. **Test case expectation**: Whether the expectation itself is reasonable (unrealizable / expectation that should not exist). **Only look at expectation reasonableness** (not Agent/app)\n3. **Test case steps**: Whether the step description is clear (can it correspond to the interface). **Only look at description clarity** (not Agent understanding)\n4. **Environment**: Whether data/account/device/network are satisfied\n5. **Agent execution**: Whether the Agent's understanding/operation is correct (identified the right element / clicked the right position / followed the steps). **Only look at Agent behavior** (not app response)\n\n**Evaluate each layer independently (do not be biased by screenshots)**:\n1. Each layer must independently conclude \"problem / no problem\" -- regardless of whether there are screenshots, no layer can be skipped\n2. Screenshot evidence and logical reasoning are equal -- screenshots are one form of evidence, logical reasoning is also evidence. A layer with screenshots is not prioritized over one without\n3. Having screenshot evidence does not mean that layer is the root cause -- the phenomenon shown in the screenshot may be the result (app/Agent), the root cause may be a layer requiring logical reasoning (test case expectation / step reasonableness). After viewing screenshots still evaluate each layer independently\n\n**Phenomenon vs root cause**: Phenomena (app no response / wrong jump / not matching expectation) are results, not root causes. Root cause = the layer with objective evidence confirming \"this layer is wrong\". E.g.: screenshot confirms Agent coordinate offset (Agent objectively wrong) + app no response (phenomenon) -> Agent has objective evidence, judge Agent. Distinguish phenomenon from root cause by evidence strength, not layer order.\n\n**Key distinction**: Do not simply compare surface differences between \"thinking text\" and \"MCP call\" to judge operation errors. You must deeply understand the operation's contextual intent:\n- An Agent calling wait/swipe etc. inconsistent with the thinking text, if it is a reasonable strategic behavior (waiting for page load, swiping to find a target element), and the final direction is correct, this is a strategic operation, not an operation error\n- Only when the Agent's operation caused a clear, uncorrectable wrong result (clicked the wrong key position, skipped the core verification step, judgment logic has a flaw), judge it as an Agent issue\n\n**Select the main root cause at once**: Choose the main root cause by evidence strength (objective > inferred); when multiple objective evidences exist choose the more direct/abundant one. No \"medium\" leeway. If multiple layers all have problems, give the primary and secondary root causes.\n\n**Forbidden**:\n- No \"But wait/Actually\" repeated reconsideration (e.g. \"might be A... but wait could also be B... actually still A\")\n- No oscillating between the 5 layers -- evaluate all layers at once, select directly\n\n## Verification (one-time)\n\nReverse-verify the determined root cause, complete in one pass:\n\n- **Evidence sufficiency**:\n - Judge App issue -> does the screenshot or Agent observation directly show the bug? Does the bug appear in steps where the Agent operated correctly?\n - Judge Agent issue -> can you point out which specific step the Agent had cognition/operation/reasoning error? After fixing, can the task truly pass?\n - Judge test case issue -> can you give a specific test case fix plan (point out which step/which expectation is problematic, give the fixed text)? After fixing, can the task truly pass?\n - Judge environment issue -> can you point out which specific environment condition is not met? After satisfying, can the task truly pass?\n- **Fix plan feasibility**: Assuming the suggestions are applied, can the task truly pass? If not, the judgment or suggestions may be incomplete\n\n**Forbidden**: When verification finds problems, do not return to the attribution phase to reselect -- only record \"evidence insufficient\" or \"plan infeasible\" in the verification section; the final output's confidence is lowered accordingly.\n\n# Attribution Categories\n\nAttribution is divided into primary cause (4 categories) and secondary cause (specific type). Evaluate each layer independently; select by judgment criteria + boundaries:\n\n## Application Issue\n\nThe App \"should do\" vs \"actually did\" is inconsistent. Test case expectation reasonable + Agent operation correct, but the app did not implement / behaved wrong.\n\n**Functional Exception**: Function logic not implemented or abnormal. E.g. scoring calculation, search, submit etc. functions should exist but don't, or the function exists but works abnormally. Boundary: missing UI elements do not belong here (-> UI Display Bug); data not matching across pages does not belong here (-> Data Inconsistency).\n\n**UI Display Bug**: UI element missing / displayed incorrectly / layout broken. E.g. score label, icon, some UI element should exist but is not shown, or is displayed broken. Boundary: function logic not implemented does not belong here (-> Functional Exception).\n\n**Data Inconsistency**: The same data shows different values on different pages. E.g. list page shows 3 items but detail page shows 2. Boundary: single page data display error belongs to Functional Exception or UI Display Bug.\n\n**Interaction Logic Bug**: Behavior after operation does not match expectation. E.g. clicking product A jumps to product B's detail page. Boundary: Agent clicking wrong element causing abnormal app response -> judge Agent, not app.\n\n**Compatibility/Stability Bug**: Crash / blank screen / compatibility issues.\n\n## Agent Issue\n\nThe Agent's understanding/operation/reasoning is wrong. Test case expectation reasonable + app implementation correct, but the Agent did not do it right.\n\n**Operation Error**: Clicked wrong element / coordinate offset / swiped wrong direction. E.g. clicked the wrong button, swipe direction reversed.\n\n**Omitted Operation**: Skipped a necessary operation. E.g. skipped login and operated directly.\n\n**Cognition Error**: Observation/understanding error. E.g. hallucination (said it saw something that doesn't exist), missed (didn't see what should be seen), misread (misunderstood element meaning), screenshot understanding error.\n\n**Reasoning Error**: Cognition correct but conclusion derivation wrong. E.g. observed correctly but judgment logic has a flaw, over-literal interpretation of expectation.\n\n**Operation Lag**: Agent observation and decision correct, but the page state had changed by operation time (carousel auto-switch, loading delay etc.), causing abnormal operation result.\n\n**Repeated Operation**: Looping ineffective operations. E.g. repeatedly swiping but the list already reached the end.\n\n**Tool Exception**: Tool call failed / parameter error.\n\n## Test Case Issue\n\nThe test case expectation/steps themselves are unreasonable. App implementation correct + Agent operation correct, but the test case itself has problems.\n\n**Ambiguous Step**: Step description vague, causing Agent free exploration to deviate. E.g. only says \"click\" without specifying which element.\n\n**Ambiguous Expectation**: Expected result ambiguous/polysemous. E.g. \"consistency\" without specifying what compared to what.\n\n**Unexecutable**: The step itself cannot be executed. E.g. selecting the first item in an empty list.\n\n**Missing Prerequisite**: The test case did not state necessary preconditions. E.g. did not state login is required first.\n\n**Missing Step**: The test case skipped a necessary intermediate step. E.g. asked to click into the detail page but didn't say to enter the list page first.\n\n**Unreasonable Expectation**: Self-contradicting / requiring impossible behavior. E.g. expectation \"enlarge image\" but app design uses video playback.\n\n**External Dependency**: Expectation depends on external data that cannot be verified. E.g. expectation to show specific user data but not pre-provisioned.\n\n## Environment Issue\n\nData/account/device/network not satisfied.\n\n**Data Preparation**: Test data not prepared / business state not satisfied.\n**Account/Permission**: Account issue / insufficient permission.\n**Network Exception**: Network timeout / disconnection.\n**Device Exception**: Device hardware / system issue.\n**Configuration Error**: Environment config / framework init / app not installed.\n**Business Limitation**: Business state not satisfied / rules do not allow the operation.\n\n## Accuracy Judgment\n\nBased on the primary cause and the original conclusion, determine accuracy:\n\n| Primary Cause | Original Conclusion | Accuracy |\n|---------------|---------------------|----------|\n| Application Issue | FAIL | Correct |\n| Application Issue | PASS | Misjudged Pass |\n| Agent Issue | FAIL | Misjudged Fail |\n| Agent Issue | PASS | Misjudged Pass |\n| Test Case Issue | FAIL | Misjudged Fail |\n| Test Case Issue | PASS | Misjudged Pass |\n| Environment Issue | Any | Inconclusive |\n| No issue (test passed) | PASS | Correct |\n\n# Core Principles\n\n1. **Attribution must be evidence-based**: Attribution without evidence support is unreliable. Evidence sources: screenshot comparison, step operation data, judgment block content.\n2. **Agent-caused FAIL cannot be judged Correct**: When the Agent's operation error, cognition error, or reasoning error caused the expected result to not be achieved, you cannot judge FAIL as Correct just because \"the expectation was not met\". The expectation was not met because the Agent got it wrong, not because the app has a problem.\n3. **If the test case explicitly required it and it's missing, it's an Application Issue**: When the test case explicitly requires a function and the app actually lacks it, you cannot excuse the app just because \"this function is usually not here\" -- the test case explicitly required it, it's missing, it's an Application Issue.\n4. **Before judging Agent operation error, you must first view the screenshot to confirm whether the App really has a bug**: If the screenshot shows the App indeed has a bug (element does not exist / function abnormal), attribute to Application Issue not Agent Issue. Only when the screenshot confirms the App is normal and the Agent indeed got it wrong, attribute to Agent Issue.\n5. **Environment issues are not attributed to the app**: Data preparation incorrect, insufficient account permission and other environment issues causing FAIL, attribute to Environment Issue not Application Issue.\n\nRegarding findings outside checkpoints: Only when all checkpoints of the test case pass and the Agent found an additional issue outside checkpoints, you need to verify whether that issue is real. If the issue is real the Agent's finding is valid; if not real attribute to cognition error. This rule only applies when all checkpoints pass, not when checkpoints fail.\n\n# Tool\n\n**get_step_screenshot(step_number, desc)** -- Returns two screenshots for the specified step and the step's operation info. The desc parameter explains why you are viewing this screenshot. Use it in the fact analysis phase to locate key steps based on suspicions.\n\n**Efficiency requirement**:\n- You must call get_step_screenshot at least once to obtain screenshot evidence before attributing (pure text analysis cannot directly conclude).\n\n## Tool-calling protocol\n\nSince the runtime does not expose native function-calling, express tool requests as text markers. When you need to view a step's screenshot, output exactly one line in this format (each marker on its own line):\n\n```\n[TOOL_CALL] get_step_screenshot step_number=3 desc=\"reason for viewing this screenshot\"\n```\n\nYou may output multiple [TOOL_CALL] lines in a single response to view several steps at once. After the tool results are returned, continue your analysis in the next turn.\n\nWhen you have gathered enough evidence and are ready to give the final verdict, output the Markdown report with the `## Verdict` section and no [TOOL_CALL] lines.\n\n# Test Case Validity Guide\n\n- **Valid** -- The expected result is explicit and specific, and verifiable from the report.\n- **Unreasonable Expectation** -- The expectation itself is self-contradicting, or requires behavior the app cannot possibly implement. Note: just because a function \"is usually not on this page\" does not make it an unreasonable expectation -- if the test case explicitly required that function and the app lacks it, attribute to Application Issue.\n- **Unverifiable** -- The expectation depends on external state (server config, backend data, etc.) and cannot be observed from screenshots or layout.\n- **Ambiguous** -- The expectation is vague or polysemous, cannot be clearly judged as pass/fail.\n\n# Input\n\nYou will receive the following information:\n\n1. **Original conclusion** -- PASS or FAIL.\n2. **Test case** -- The original test case text, containing actions and expected results.\n3. **Agent execution process** -- The Agent's per-step thinking and reasoning chain.\n4. **Agent judgment block** -- The Agent's structured checkpoints, observed states, and final conclusion.\n5. **Step inventory** -- Screenshot numbers and corresponding operation descriptions, used to locate which screenshots to view.\n\n# Output Format\n\nOutput Markdown. First output the three thinking-process sections, then the structured verdict:\n\n```\n## Fact Analysis (no attribution conclusions allowed)\nStep-by-step facts:\n- step{N}: {objective observation} (no attribution, no \"But wait\")\n\n## 5-Layer Equal Attribution (one-time evaluation, no repetition)\nApp behavior: {evidence or \"no obvious issue\"}\nTest case expectation: {evidence or \"no obvious issue\"}\nTest case steps: {evidence or \"no obvious issue\"}\nEnvironment: {evidence or \"no obvious issue\"}\nAgent execution: {evidence or \"no obvious issue\"}\nMain root cause: {select the layer with most abundant evidence, no medium leeway}\n\n## Verification (one-time)\nEvidence sufficiency: {whether sufficient, if insufficient explain}\nFix plan feasibility: {whether feasible, if infeasible explain}\n\n## Verdict\n- Accuracy: Correct/Misjudged Pass/Misjudged Fail/Inconclusive\n- Primary Cause: Application Issue/Agent Issue/Test Case Issue/Environment Issue\n- Secondary Cause: Functional Exception/UI Display Bug/Data Inconsistency/Interaction Logic Bug/Compatibility/Stability Bug/Operation Error/Omitted Operation/Cognition Error/Reasoning Error/Operation Lag/Repeated Operation/Tool Exception/Ambiguous Step/Ambiguous Expectation/Unexecutable/Missing Prerequisite/Missing Step/Unreasonable Expectation/External Dependency/Network Exception/Device Exception/Configuration Error/Data Preparation/Business Limitation\n- Root Cause: specific description\n- Test Case Validity: Valid/Unreasonable Expectation/Unverifiable/Ambiguous\n- Confidence: High/Medium/Low\n\n## Task Intent\nYour understanding of the task intent (one sentence)\n\n## Analysis Summary\nNo more than 300 words of analysis\n\n## Evidence List\nEach item references the step number and specific observation\n\n## Improvement Suggestions\n1. {specific, actionable fix suggestion for the root cause}\n2. {specific, actionable fix suggestion for the root cause}\n3. {specific, actionable fix suggestion for the root cause}\nReverse verification: {Assuming the above suggestions are applied, can the task execute and pass normally? If not, the root cause judgment or suggestions may be incomplete}\n```\n\n## Examples\n\n### Example 1: Agent operation error -> FAIL\n\nInput: The Agent clicked a promotional banner instead of a product card, entering a promo page instead of the product detail page.\n\n- Primary Cause: Agent Issue\n- Secondary Cause: Operation Error\n- Root Cause: The Agent clicked the promotional banner instead of the product card; the app correctly jumped to the promo page; the failure was caused by the Agent's operation error\n- Accuracy: Misjudged Fail\n\n### Example 2: App function missing -> FAIL\n\nInput: The test case expects a \"Delivery Method\" menu on the product config page; the screenshot confirms it actually does not exist. The Agent operated correctly.\n\n- Primary Cause: Application Issue\n- Secondary Cause: Functional Exception\n- Root Cause: The product config page lacks the delivery method menu explicitly required by the test case; the Agent's operation and observation were both correct; the FAIL judgment is accurate\n- Accuracy: Correct\n\n### Example 3: Agent operation lag -> FAIL\n\nInput: The Agent observed the carousel showing product A; during thinking the carousel auto-switched to product B; clicking the same position entered product B's detail page. Two screenshots show the carousel switching between observation and operation.\n\n- Primary Cause: Agent Issue\n- Secondary Cause: Operation Lag\n- Root Cause: The carousel auto-switched between the Agent's observation and click; the page content had changed by the time of click; the app correctly jumped to the product detail page corresponding to the click at that time\n- Accuracy: Misjudged Fail\n\n### Example 4: Unreasonable test case expectation -> FAIL (do not judge app/Agent)\n\nInput: The test case expects \"enlarge image to view details\", but the app design uses video playback to display content (not a bug). The Agent operated correctly and correctly observed it is video not image enlargement.\n\n- Primary Cause: Test Case Issue\n- Secondary Cause: Unreasonable Expectation\n- Root Cause: The test case expectation \"enlarge image\" does not match the app design (video playback display); the app function works normally; the Agent's operation and observation were both correct. Superficially it looks like \"app interaction logic does not match expectation\", but the root cause is actually the unreasonable test case expectation\n- Accuracy: Misjudged Fail\n";
|
|
2
|
+
//# sourceMappingURL=prompt.d.ts.map
|