@autotest/agent 0.0.4 → 0.0.6
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 +3 -0
- package/dist/api/agent_api.d.ts +2 -2
- package/dist/api/agent_api.js +7 -7
- package/dist/autotest-cli.js +44 -44
- package/dist/common/config/config.yaml +1 -0
- package/dist/common/config/config_validator.js +1 -1
- package/dist/common/config/manager.d.ts +10 -10
- package/dist/common/config/manager.js +12 -12
- package/dist/common/config/output.js +1 -1
- package/dist/common/config/types.d.ts +28 -1
- package/dist/common/config/types.js +12 -11
- package/dist/common/dfx/recording_fetch.js +1 -1
- package/dist/common/dfx/source.js +1 -1
- package/dist/common/image_helper.d.ts +2 -2
- package/dist/common/image_helper.js +2 -2
- package/dist/common/llm_cache/cache_transport.d.ts +1 -1
- package/dist/common/llm_cache/cache_transport.js +1 -1
- package/dist/common/llm_cache/prompt_cache.d.ts +2 -2
- package/dist/common/llm_cache/prompt_cache.js +2 -2
- package/dist/common/model/custom_model.js +5 -4
- package/dist/common/utils.d.ts +5 -5
- package/dist/common/utils.js +5 -5
- package/dist/core/agent/layered_agent/agent_registry.d.ts +3 -1
- package/dist/core/agent/layered_agent/agent_registry.js +12 -5
- package/dist/core/agent/layered_agent/decision.js +3 -1
- package/dist/core/agent/layered_agent/execute_agent/general_agent.js +1 -1
- package/dist/core/agent/layered_agent/execute_agent/mcp_prompts.d.ts +1 -1
- package/dist/core/agent/layered_agent/execute_agent/mcp_prompts.js +34 -34
- package/dist/core/agent/layered_agent/execute_agent/prompts.d.ts +1 -1
- package/dist/core/agent/layered_agent/execute_agent/prompts.js +8 -8
- package/dist/core/agent/report_analyzer_agent/agent.js +4 -4
- package/dist/core/agent/report_analyzer_agent/prompt.d.ts +1 -1
- package/dist/core/agent/report_analyzer_agent/prompt.js +11 -11
- package/dist/core/agent/report_analyzer_agent/report_writer.js +139 -139
- package/dist/core/agent/report_analyzer_agent/tools.d.ts +1 -1
- package/dist/core/agent/report_analyzer_agent/tools.js +2 -2
- package/dist/core/agent/report_analyzer_agent/types.js +2 -2
- package/dist/core/agent/rewrite_agent/agent.d.ts +5 -5
- package/dist/core/agent/rewrite_agent/agent.js +5 -5
- package/dist/core/agent/rewrite_agent/guardrails.d.ts +1 -1
- package/dist/core/agent/rewrite_agent/guardrails.js +1 -1
- package/dist/core/agent/rewrite_agent/mapping.d.ts +1 -1
- package/dist/core/agent/rewrite_agent/mapping.js +3 -3
- package/dist/core/agent/rewrite_agent/parse.d.ts +1 -1
- package/dist/core/agent/rewrite_agent/parse.js +1 -1
- package/dist/core/agent/rewrite_agent/types.d.ts +1 -1
- package/dist/core/agent/rewrite_agent/types.js +1 -1
- package/dist/core/agent/single_agent/agent.d.ts +1 -2
- package/dist/core/agent/single_agent/agent.js +29 -26
- package/dist/core/agent/single_agent/hook_manager.d.ts +1 -2
- package/dist/core/agent/single_agent/hook_manager.js +1 -2
- package/dist/core/agent/single_agent/image_utils.d.ts +1 -2
- package/dist/core/agent/single_agent/image_utils.js +1 -2
- package/dist/core/agent/single_agent/scroll_search_agent.d.ts +5 -5
- package/dist/core/agent/single_agent/scroll_search_agent.js +39 -10
- package/dist/core/agent/single_agent/subagent_manager.d.ts +1 -2
- package/dist/core/agent/single_agent/subagent_manager.js +2 -3
- package/dist/core/agent/single_agent/tool_recorder_hook.d.ts +3 -3
- package/dist/core/agent/single_agent/tool_recorder_hook.js +3 -3
- package/dist/core/device/hdc/apps.js +1 -1
- package/dist/core/device/hdc/device.d.ts +1 -1
- package/dist/core/device/hdc/device.js +1 -1
- package/dist/core/device/hdc/screenshot.js +1 -1
- package/dist/core/device/index.d.ts +2 -2
- package/dist/core/device/index.js +2 -2
- package/dist/core/knowledge/knowledge_manager.d.ts +3 -3
- package/dist/core/knowledge/knowledge_manager.js +3 -3
- package/dist/core/knowledge/vectordb.d.ts +5 -5
- package/dist/core/knowledge/vectordb.js +5 -5
- package/dist/core/mcp/harmony_hdc_adapter.js +21 -5
- package/dist/core/mcp/mcp_tools.d.ts +10 -2
- package/dist/core/mcp/mcp_tools.js +69 -6
- package/dist/core/memory/_utils.d.ts +1 -1
- package/dist/core/memory/_utils.js +1 -1
- package/dist/core/memory/context_compressor.js +2 -2
- package/dist/core/memory/index.d.ts +1 -1
- package/dist/core/memory/index.js +1 -1
- package/dist/core/memory/memory_manager.d.ts +1 -1
- package/dist/core/memory/memory_manager.js +1 -1
- package/dist/core/memory/replan_manager.d.ts +1 -1
- package/dist/core/memory/replan_manager.js +1 -1
- package/dist/core/memory/tool_player.d.ts +5 -5
- package/dist/core/memory/tool_player.js +5 -5
- package/dist/core/memory/tool_player_popup.d.ts +1 -1
- package/dist/core/memory/tool_player_popup.js +12 -12
- package/dist/core/memory/tool_player_replan.d.ts +1 -1
- package/dist/core/memory/tool_player_replan.js +2 -2
- package/dist/core/memory/tool_player_xpath.d.ts +3 -3
- package/dist/core/memory/tool_player_xpath.js +3 -3
- package/dist/core/prompt/prompt_loader.d.ts +1 -1
- package/dist/core/prompt/prompt_loader.js +3 -3
- package/dist/core/skill/skill_manager.d.ts +2 -2
- package/dist/core/skill/skill_manager.js +1 -1
- package/dist/data_types/case.js +1 -1
- package/dist/data_types/screen.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -2
- package/dist/loop/cli.d.ts +4 -4
- package/dist/loop/cli.js +4 -4
- package/dist/loop/orchestrator.d.ts +6 -6
- package/dist/loop/orchestrator.js +7 -7
- package/dist/loop/result_writer.d.ts +1 -1
- package/dist/loop/result_writer.js +36 -36
- package/dist/loop/types.d.ts +1 -1
- package/dist/loop/types.js +1 -1
- package/dist/reporter/html_template/index.js +14 -9
- package/dist/tools/batch_runner.js +11 -3
- package/dist/tools/case_runner/report.d.ts +1 -1
- package/dist/tools/case_runner/report.js +59 -59
- package/dist/tools/case_runner/runner.d.ts +3 -3
- package/dist/tools/case_runner/runner.js +8 -8
- package/dist/tools/config/config_tool.d.ts +6 -6
- package/dist/tools/config/config_tool.js +27 -27
- package/dist/tools/prompt_compare/compare_runner.d.ts +2 -2
- package/dist/tools/prompt_compare/compare_runner.js +16 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -472,6 +472,7 @@ Commands:
|
|
|
472
472
|
list-devices List connected devices
|
|
473
473
|
analyze Analyze a failed task
|
|
474
474
|
config Show or update configuration
|
|
475
|
+
--version Show version (alias: -v, version)
|
|
475
476
|
|
|
476
477
|
Run options:
|
|
477
478
|
--task <desc> Task description
|
|
@@ -642,11 +643,13 @@ const agent = new AutoTestAgent({
|
|
|
642
643
|
```bash
|
|
643
644
|
cd AutoTest-nodejs
|
|
644
645
|
npm run build # 两步构建:tsc --noCheck 生成 JS + tsc -p tsconfig.emit.json 生成 .d.ts
|
|
646
|
+
npm run setup # 生成 config.yaml 配置文件(首次使用前执行)
|
|
645
647
|
npm run caseTest # 单用例运行(自动增量构建,推荐)
|
|
646
648
|
npm run batchCaseTest # 批量用例运行(自动增量构建)
|
|
647
649
|
npm test # 运行单元测试(vitest run)
|
|
648
650
|
npm run test:watch # 监听模式单元测试
|
|
649
651
|
npm run typecheck # 类型检查(tsc --noEmit)
|
|
652
|
+
autotest --version # 查看版本号
|
|
650
653
|
```
|
|
651
654
|
|
|
652
655
|
> **构建说明**:由于 `ai` SDK 的深层泛型类型会导致 tsc OOM,构建拆分为两步:
|
package/dist/api/agent_api.d.ts
CHANGED
|
@@ -11,10 +11,10 @@ export declare class AgentAPIImpl {
|
|
|
11
11
|
stopTask(): void;
|
|
12
12
|
runTask(task: string, options: TaskOptions): Promise<TaskResult>;
|
|
13
13
|
/**
|
|
14
|
-
|
|
14
|
+
* 鍗曟 agent 鎵ц锛坙oop 缂栨帓鍣ㄧ殑 execute 鍘熻锛夈€? * 鍋囧畾 adapter 宸茶繛鎺ワ紙鐢?runTaskLoop 鍦ㄥ惊鐜墠缁熶竴杩炴帴锛夛紝鍦ㄧ粰瀹?reportDir 璺戜竴杞€? */
|
|
15
15
|
private executeOnce;
|
|
16
16
|
/**
|
|
17
|
-
|
|
17
|
+
* Loop 闂幆鎵ц鍏ュ彛锛堢Щ妞嶈嚜 loop/orchestrator.run锛夈€? * 杩炴帴 adapter 涓€娆★紝娉ㄥ叆 execute/analyze/rewrite 涓変釜鍘熻锛岃窇闂幆鐘舵€佹満銆? */
|
|
18
18
|
private runTaskLoop;
|
|
19
19
|
resumeTask(taskId: string, startIndex?: number): Promise<TaskResult>;
|
|
20
20
|
listDevices(): Promise<DeviceInfo[]>;
|
package/dist/api/agent_api.js
CHANGED
|
@@ -62,8 +62,7 @@ class AgentAPIImpl {
|
|
|
62
62
|
this.configManager = configManager;
|
|
63
63
|
if (adapter) {
|
|
64
64
|
this.adapter = adapter;
|
|
65
|
-
// Register adapter in the hybrid-style agent registry
|
|
66
|
-
// agent_registry.set_tool_manager 鈥?enables mcp_tools to get device directly)
|
|
65
|
+
// Register adapter in the hybrid-style agent registry
|
|
67
66
|
agent_registry_1.agentRegistry.setToolManager(adapter);
|
|
68
67
|
}
|
|
69
68
|
}
|
|
@@ -89,7 +88,7 @@ class AgentAPIImpl {
|
|
|
89
88
|
if (options.configOverrides) {
|
|
90
89
|
this.configManager.updateConfig(options.configOverrides);
|
|
91
90
|
}
|
|
92
|
-
// --prompt-name / --app-config
|
|
91
|
+
// --prompt-name / --app-config 折入配置(
|
|
93
92
|
if (options.promptName) {
|
|
94
93
|
this.configManager.updateConfig({ agent: { promptName: options.promptName } });
|
|
95
94
|
}
|
|
@@ -188,7 +187,7 @@ class AgentAPIImpl {
|
|
|
188
187
|
return taskResult;
|
|
189
188
|
}
|
|
190
189
|
/**
|
|
191
|
-
|
|
190
|
+
* 鍗曟 agent 鎵ц锛坙oop 缂栨帓鍣ㄧ殑 execute 鍘熻锛夈€? * 鍋囧畾 adapter 宸茶繛鎺ワ紙鐢?runTaskLoop 鍦ㄥ惊鐜墠缁熶竴杩炴帴锛夛紝鍦ㄧ粰瀹?reportDir 璺戜竴杞€? */
|
|
192
191
|
async executeOnce(task, reportDir, runId, agentMode) {
|
|
193
192
|
const effectiveConfig = this.configManager.getEffectiveConfig();
|
|
194
193
|
fs.mkdirSync(reportDir, { recursive: true });
|
|
@@ -205,7 +204,7 @@ class AgentAPIImpl {
|
|
|
205
204
|
return { reportDir, status: agentResult.status };
|
|
206
205
|
}
|
|
207
206
|
/**
|
|
208
|
-
|
|
207
|
+
* Loop 闂幆鎵ц鍏ュ彛锛堢Щ妞嶈嚜 loop/orchestrator.run锛夈€? * 杩炴帴 adapter 涓€娆★紝娉ㄥ叆 execute/analyze/rewrite 涓変釜鍘熻锛岃窇闂幆鐘舵€佹満銆? */
|
|
209
208
|
async runTaskLoop(task, options) {
|
|
210
209
|
const taskId = this.generateTaskId();
|
|
211
210
|
const taskResult = {
|
|
@@ -245,7 +244,7 @@ class AgentAPIImpl {
|
|
|
245
244
|
throw new common_errors_1.AgentError('DEVICE_NOT_CONNECTED', 'No device adapter configured');
|
|
246
245
|
}
|
|
247
246
|
const agentMode = options.agentMode ?? effectiveConfig.agent.unified.mode;
|
|
248
|
-
// 鏀瑰啓妯″瀷锛氭棤鐙珛 loop 妯″瀷缁勶紝鍥為€€ unified锛堢Щ妞?
|
|
247
|
+
// 鏀瑰啓妯″瀷锛氭棤鐙珛 loop 妯″瀷缁勶紝鍥為€€ unified锛堢Щ妞? resolve_model_config("loop") 鐨?loop鈫抲nified 鍏滃簳锛? const rewriteModelConfig = effectiveConfig.model.unified;
|
|
249
248
|
const cfgAnalyzeAfter = Boolean(effectiveConfig.analyze?.analyzeAfterTask);
|
|
250
249
|
const resolved = (0, cli_1.resolveMode)({
|
|
251
250
|
task,
|
|
@@ -496,9 +495,10 @@ class AgentAPIImpl {
|
|
|
496
495
|
this.tasks.set(taskId, task);
|
|
497
496
|
}
|
|
498
497
|
createAgent(mode, adapter, config, reportGenerator, hooks, llmCaller) {
|
|
499
|
-
// Register shared state in hybrid agent registry
|
|
498
|
+
// Register shared state in hybrid agent registry
|
|
500
499
|
agent_registry_1.agentRegistry.setReportGenerator(reportGenerator);
|
|
501
500
|
agent_registry_1.agentRegistry.setToolManager(adapter);
|
|
501
|
+
agent_registry_1.agentRegistry.setAppConfig(config);
|
|
502
502
|
switch (mode) {
|
|
503
503
|
case 'hypium':
|
|
504
504
|
throw new common_errors_1.AgentError('CONFIG_VALIDATION_FAILED', "hypium agent package has been removed; use 'single' or 'layered' mode");
|
package/dist/autotest-cli.js
CHANGED
|
@@ -49,27 +49,27 @@ function maskKey(key) {
|
|
|
49
49
|
return key ? '***' : '(not set)';
|
|
50
50
|
return `${key.slice(0, 6)}...${key.slice(-4)}`;
|
|
51
51
|
}
|
|
52
|
-
/** Print startup banner with effective config
|
|
52
|
+
/** Print startup banner with effective config. */
|
|
53
53
|
function printBanner(config) {
|
|
54
54
|
const m = config.model.unified;
|
|
55
55
|
const a = config.agent.unified;
|
|
56
56
|
const d = config.device;
|
|
57
57
|
logger_1.logger.info('════════════════════════════════════════════');
|
|
58
|
-
logger_1.logger.info(
|
|
58
|
+
logger_1.logger.info(` AutoTestAgent v${require('../package.json').version}`);
|
|
59
59
|
logger_1.logger.info('════════════════════════════════════════════');
|
|
60
|
-
logger_1.logger.info(`
|
|
61
|
-
logger_1.logger.info(`
|
|
62
|
-
logger_1.logger.info(`
|
|
63
|
-
logger_1.logger.info(`
|
|
64
|
-
logger_1.logger.info(`
|
|
65
|
-
logger_1.logger.info(`
|
|
66
|
-
logger_1.logger.info(`
|
|
67
|
-
logger_1.logger.info(`
|
|
68
|
-
logger_1.logger.info(`
|
|
69
|
-
logger_1.logger.info(`
|
|
70
|
-
logger_1.logger.info(`
|
|
71
|
-
logger_1.logger.info(`
|
|
72
|
-
logger_1.logger.info(`
|
|
60
|
+
logger_1.logger.info(` Model: ${m.name} @ ${m.baseUrl || '(default)'}`);
|
|
61
|
+
logger_1.logger.info(` API Key: ${maskKey(m.apiKey)}`);
|
|
62
|
+
logger_1.logger.info(` Provider: ${m.provider}, thinking=${m.enableThinking ?? 'skip'}`);
|
|
63
|
+
logger_1.logger.info(` Agent: mode=${a.mode}, maxSteps=${a.maxSteps}, parseMode=${a.parseMode}`);
|
|
64
|
+
logger_1.logger.info(` Tools: provider=${a.toolProvider}`);
|
|
65
|
+
logger_1.logger.info(` Prompt: name=${a.promptName || '(default)'}, version=${a.promptVersion || '(default)'}`);
|
|
66
|
+
logger_1.logger.info(` Session: type=${a.sessionType}, actionInterval=${a.actionInterval}s`);
|
|
67
|
+
logger_1.logger.info(` History: maxActions=${a.maxHistoryActions}, maxImages=${a.maxHistoryImage}`);
|
|
68
|
+
logger_1.logger.info(` Screenshots: onToolEnd=${a.screenshotOnToolEnd}, includePrev=${a.includePreviousScreenshot}`);
|
|
69
|
+
logger_1.logger.info(` Cache: enable=${a.enableCache}, apirec=${a.apirec}`);
|
|
70
|
+
logger_1.logger.info(` Device: impl=${d.deviceImpl}, sn=${d.deviceSn ?? '(auto)'}`);
|
|
71
|
+
logger_1.logger.info(` reset=${d.resetDevice}, alwaysOn=${d.screenAlwaysOn}, mode=${d.operationMode}`);
|
|
72
|
+
logger_1.logger.info(` Output: root=${config.output.rootDir}`);
|
|
73
73
|
logger_1.logger.info('════════════════════════════════════════════');
|
|
74
74
|
}
|
|
75
75
|
async function main() {
|
|
@@ -87,13 +87,13 @@ async function main() {
|
|
|
87
87
|
configManager.loadFileConfig(explicitConfig);
|
|
88
88
|
}
|
|
89
89
|
const config = configManager.getEffectiveConfig();
|
|
90
|
-
// Startup banner + config validation
|
|
90
|
+
// Startup banner + config validation
|
|
91
91
|
printBanner(config);
|
|
92
92
|
const issues = (0, config_validator_1.validateConfig)(config);
|
|
93
93
|
if (issues.length > 0) {
|
|
94
94
|
logger_1.logger.warn(`Config validation found ${issues.length} issue(s) — see warnings above. Continuing with potential problems.`);
|
|
95
95
|
}
|
|
96
|
-
// Apply network no_proxy if configured
|
|
96
|
+
// Apply network no_proxy if configured
|
|
97
97
|
if (config.network.noProxy && !process.env.NO_PROXY) {
|
|
98
98
|
process.env.NO_PROXY = config.network.noProxy;
|
|
99
99
|
process.env.no_proxy = config.network.noProxy;
|
|
@@ -159,7 +159,7 @@ async function main() {
|
|
|
159
159
|
logger_1.logger.info(`Root cause: ${result.rootCause}`);
|
|
160
160
|
if (result.suggestedActions.length > 0) {
|
|
161
161
|
logger_1.logger.info('Suggested actions:');
|
|
162
|
-
result.suggestedActions.forEach((a, i) => logger_1.logger.info(`
|
|
162
|
+
result.suggestedActions.forEach((a, i) => logger_1.logger.info(` ${i + 1}. ${a}`));
|
|
163
163
|
}
|
|
164
164
|
break;
|
|
165
165
|
}
|
|
@@ -195,35 +195,35 @@ function printUsage() {
|
|
|
195
195
|
Usage: autotest <command> [options]
|
|
196
196
|
|
|
197
197
|
Commands:
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
198
|
+
run Run a test task
|
|
199
|
+
list-devices List connected devices
|
|
200
|
+
analyze Analyze a failed task
|
|
201
|
+
config Show or update configuration
|
|
202
202
|
|
|
203
203
|
Run options:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
204
|
+
--task <desc> Task description
|
|
205
|
+
--case-file <path> Path to a JSON case file (use with --case-index)
|
|
206
|
+
--case-index <n> 1-based case index in the file (e.g. 10 for the 10th case)
|
|
207
|
+
--device <sn> Device serial number
|
|
208
|
+
--platform <p> Platform: harmony | android | ios
|
|
209
|
+
--ip <addr> Device IP address
|
|
210
|
+
--port <num> Device port number
|
|
211
|
+
--task-name <name> Test case name
|
|
212
|
+
--case-num <num> Case number
|
|
213
|
+
--report-dir <dir> Report output directory
|
|
214
|
+
--prompt-version <v> Prompt version
|
|
215
|
+
--prompt-name <name> Load prompt by name (priority over --prompt-version)
|
|
216
|
+
--app-config <path> App→bundle mapping config file path
|
|
217
|
+
--config <path> Path to config.yaml (default: bundled config.yaml)
|
|
218
|
+
--loop Enable self-healing loop (execute→analyze→rewrite→re-execute), default 3 iterations
|
|
219
|
+
--max-loops <n> Max loop iterations (>=2 enables FULL_LOOP; 0 disables)
|
|
220
|
+
--analyze-after Auto-analyze after task execution (requires --task)
|
|
221
|
+
--analyze <dir> Analyze-only: attribute an existing report dir (alias: --analyze-dir)
|
|
222
|
+
--rewrite <dir> Rewrite-only: rewrite from an existing analysis (alias: --rewrite-dir)
|
|
223
223
|
|
|
224
224
|
Analyze options:
|
|
225
|
-
|
|
226
|
-
|
|
225
|
+
--task-id <id> Task ID to analyze
|
|
226
|
+
--case-idx <n> Case index within the task
|
|
227
227
|
`);
|
|
228
228
|
}
|
|
229
229
|
function parseRunArgs(args) {
|
|
@@ -332,7 +332,7 @@ function assertRunReadiness(config, mode, adapter) {
|
|
|
332
332
|
}
|
|
333
333
|
if (!adapter) {
|
|
334
334
|
throw new Error(`设备未连接或未识别,任务无法创建。\n` +
|
|
335
|
-
`请检查:\n
|
|
335
|
+
`请检查:\n 1) 运行 hdc list targets 确认设备在线\n 2) 在 config.yaml 的 device.device_sn 填入正确设备序列号`);
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
338
|
async function resolveTask(parsed) {
|
|
@@ -22,7 +22,7 @@ function validateConfig(config) {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
if (issues.length > 0) {
|
|
25
|
-
logger_1.logger.warning(`Config validation issues found:\n${issues.map((i) => `
|
|
25
|
+
logger_1.logger.warning(`Config validation issues found:\n${issues.map((i) => ` ${i.field}: ${i.message}`).join('\n')}`);
|
|
26
26
|
}
|
|
27
27
|
return issues;
|
|
28
28
|
}
|
|
@@ -6,10 +6,10 @@ export declare class ConfigManager {
|
|
|
6
6
|
loadYamlFile(filePath: string): void;
|
|
7
7
|
loadDefaultConfig(): void;
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
* Layer 4: Load a --config override file (highest priority,
|
|
10
|
+
* ConfigManager Layer 4). Merges after loadDefaultConfig, prints loaded file,
|
|
11
|
+
* and validates.
|
|
12
|
+
*/
|
|
13
13
|
loadFileConfig(configFile: string): void;
|
|
14
14
|
private convertKeysToCamel;
|
|
15
15
|
deepMerge<T extends Record<string, unknown>>(target: T, source: Record<string, unknown>): T;
|
|
@@ -19,11 +19,11 @@ export declare class ConfigManager {
|
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Resolve a model config by agent name with unified fallback.
|
|
22
|
-
* Mirrors
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
22
|
+
* Mirrors ModelGroupConfig.get_model:
|
|
23
|
+
* 1. direct slot match (unified/execute/decision/verify/reflection/analyze)
|
|
24
|
+
* 2. `_agent` suffix aliasing (e.g. `execute_agent` → `execute` slot)
|
|
25
|
+
* 3. extra_models[name]
|
|
26
|
+
* 4. fallback to `unified`
|
|
27
27
|
*/
|
|
28
28
|
export declare function getModel(group: ModelGroupConfig, name: string): ModelConfig;
|
|
29
29
|
/** Resolve a model config for an agent name from the app config. */
|
|
@@ -31,7 +31,7 @@ export declare function resolveModelConfig(config: AppConfig, agentName: string)
|
|
|
31
31
|
/**
|
|
32
32
|
* Resolve an agent config by name. Node's config.agent is currently a flat
|
|
33
33
|
* AgentConfig (AgentGroupConfig restructure deferred), so this returns the
|
|
34
|
-
* flat config for any name — kept for API parity with
|
|
34
|
+
* flat config for any name — kept for API parity with
|
|
35
35
|
* resolve_agent_config until extra_agents support lands.
|
|
36
36
|
*/
|
|
37
37
|
export declare function resolveAgentConfig(config: AppConfig, _agentName: string): AgentConfig;
|
|
@@ -94,7 +94,7 @@ class ConfigManager {
|
|
|
94
94
|
if (layers.length > 0) {
|
|
95
95
|
console.log(`Loaded config files: ${layers.join(', ')}`);
|
|
96
96
|
}
|
|
97
|
-
// Run validation
|
|
97
|
+
// Run validation
|
|
98
98
|
const { validateConfig } = require('./config_validator');
|
|
99
99
|
const issues = validateConfig(this.config);
|
|
100
100
|
if (issues.length > 0) {
|
|
@@ -102,10 +102,10 @@ class ConfigManager {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
* Layer 4: Load a --config override file (highest priority,
|
|
106
|
+
* ConfigManager Layer 4). Merges after loadDefaultConfig, prints loaded file,
|
|
107
|
+
* and validates.
|
|
108
|
+
*/
|
|
109
109
|
loadFileConfig(configFile) {
|
|
110
110
|
if (!(0, fs_1.existsSync)(configFile)) {
|
|
111
111
|
console.warn(`Config file not found: ${configFile}`);
|
|
@@ -205,7 +205,7 @@ class ConfigManager {
|
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
exports.ConfigManager = ConfigManager;
|
|
208
|
-
// ---- Per-agent config resolvers
|
|
208
|
+
// ---- Per-agent config resolvers ----
|
|
209
209
|
const MODEL_SLOTS = ['unified', 'execute', 'decision', 'verify', 'reflection', 'analyze'];
|
|
210
210
|
/** A ModelConfig is "configured" if it carries a name/baseUrl/apiKey (not pure defaults). */
|
|
211
211
|
function isModelConfigured(m) {
|
|
@@ -213,11 +213,11 @@ function isModelConfigured(m) {
|
|
|
213
213
|
}
|
|
214
214
|
/**
|
|
215
215
|
* Resolve a model config by agent name with unified fallback.
|
|
216
|
-
* Mirrors
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
216
|
+
* Mirrors ModelGroupConfig.get_model:
|
|
217
|
+
* 1. direct slot match (unified/execute/decision/verify/reflection/analyze)
|
|
218
|
+
* 2. `_agent` suffix aliasing (e.g. `execute_agent` → `execute` slot)
|
|
219
|
+
* 3. extra_models[name]
|
|
220
|
+
* 4. fallback to `unified`
|
|
221
221
|
*/
|
|
222
222
|
function getModel(group, name) {
|
|
223
223
|
const trySlot = (slot) => {
|
|
@@ -249,7 +249,7 @@ function resolveModelConfig(config, agentName) {
|
|
|
249
249
|
/**
|
|
250
250
|
* Resolve an agent config by name. Node's config.agent is currently a flat
|
|
251
251
|
* AgentConfig (AgentGroupConfig restructure deferred), so this returns the
|
|
252
|
-
* flat config for any name — kept for API parity with
|
|
252
|
+
* flat config for any name — kept for API parity with
|
|
253
253
|
* resolve_agent_config until extra_agents support lands.
|
|
254
254
|
*/
|
|
255
255
|
function resolveAgentConfig(config, _agentName) {
|
|
@@ -43,7 +43,7 @@ function initOutputDir(taskName, config) {
|
|
|
43
43
|
const now = new Date();
|
|
44
44
|
const dateStr = `${now.getFullYear()}${String(now.getMonth() + 1).padStart(2, '0')}${String(now.getDate()).padStart(2, '0')}`;
|
|
45
45
|
const timeStr = `${String(now.getHours()).padStart(2, '0')}${String(now.getMinutes()).padStart(2, '0')}${String(now.getSeconds()).padStart(2, '0')}`;
|
|
46
|
-
//
|
|
46
|
+
//
|
|
47
47
|
const sanitizedTask = taskName.replace(/[^a-zA-Z0-9_]/g, '_').slice(0, 50);
|
|
48
48
|
const reportDir = path.join(rootDir, 'web_tasks', dateStr, `${timeStr}_${sanitizedTask}`);
|
|
49
49
|
const screenPath = path.join(reportDir, 'screenPath');
|
|
@@ -732,6 +732,7 @@ export declare const AgentConfigSchema: z.ZodObject<{
|
|
|
732
732
|
maxResultRetries: z.ZodDefault<z.ZodNumber>;
|
|
733
733
|
includePreviousScreenshot: z.ZodDefault<z.ZodBoolean>;
|
|
734
734
|
previousScreenshotCompressRatio: z.ZodDefault<z.ZodNumber>;
|
|
735
|
+
actionMarkers: z.ZodDefault<z.ZodBoolean>;
|
|
735
736
|
enableCache: z.ZodDefault<z.ZodBoolean>;
|
|
736
737
|
parseMode: z.ZodDefault<z.ZodString>;
|
|
737
738
|
toolProvider: z.ZodDefault<z.ZodString>;
|
|
@@ -765,6 +766,7 @@ export declare const AgentConfigSchema: z.ZodObject<{
|
|
|
765
766
|
maxResultRetries?: number;
|
|
766
767
|
includePreviousScreenshot?: boolean;
|
|
767
768
|
previousScreenshotCompressRatio?: number;
|
|
769
|
+
actionMarkers?: boolean;
|
|
768
770
|
enableCache?: boolean;
|
|
769
771
|
parseMode?: string;
|
|
770
772
|
toolProvider?: string;
|
|
@@ -798,6 +800,7 @@ export declare const AgentConfigSchema: z.ZodObject<{
|
|
|
798
800
|
maxResultRetries?: number;
|
|
799
801
|
includePreviousScreenshot?: boolean;
|
|
800
802
|
previousScreenshotCompressRatio?: number;
|
|
803
|
+
actionMarkers?: boolean;
|
|
801
804
|
enableCache?: boolean;
|
|
802
805
|
parseMode?: string;
|
|
803
806
|
toolProvider?: string;
|
|
@@ -813,7 +816,7 @@ export declare const AgentConfigSchema: z.ZodObject<{
|
|
|
813
816
|
}>;
|
|
814
817
|
export type AgentConfig = z.infer<typeof AgentConfigSchema>;
|
|
815
818
|
/**
|
|
816
|
-
* Agent group config
|
|
819
|
+
* Agent group config.
|
|
817
820
|
* `unified` is the default agent config; `extraAgents` are per-role overrides.
|
|
818
821
|
* Backward compat: old flat `agent: { mode: ... }` config is auto-migrated
|
|
819
822
|
* to `{ unified: { mode: ... } }` by ConfigManager.
|
|
@@ -840,6 +843,7 @@ declare const AgentGroupConfigSchema: z.ZodObject<{
|
|
|
840
843
|
maxResultRetries: z.ZodDefault<z.ZodNumber>;
|
|
841
844
|
includePreviousScreenshot: z.ZodDefault<z.ZodBoolean>;
|
|
842
845
|
previousScreenshotCompressRatio: z.ZodDefault<z.ZodNumber>;
|
|
846
|
+
actionMarkers: z.ZodDefault<z.ZodBoolean>;
|
|
843
847
|
enableCache: z.ZodDefault<z.ZodBoolean>;
|
|
844
848
|
parseMode: z.ZodDefault<z.ZodString>;
|
|
845
849
|
toolProvider: z.ZodDefault<z.ZodString>;
|
|
@@ -873,6 +877,7 @@ declare const AgentGroupConfigSchema: z.ZodObject<{
|
|
|
873
877
|
maxResultRetries?: number;
|
|
874
878
|
includePreviousScreenshot?: boolean;
|
|
875
879
|
previousScreenshotCompressRatio?: number;
|
|
880
|
+
actionMarkers?: boolean;
|
|
876
881
|
enableCache?: boolean;
|
|
877
882
|
parseMode?: string;
|
|
878
883
|
toolProvider?: string;
|
|
@@ -906,6 +911,7 @@ declare const AgentGroupConfigSchema: z.ZodObject<{
|
|
|
906
911
|
maxResultRetries?: number;
|
|
907
912
|
includePreviousScreenshot?: boolean;
|
|
908
913
|
previousScreenshotCompressRatio?: number;
|
|
914
|
+
actionMarkers?: boolean;
|
|
909
915
|
enableCache?: boolean;
|
|
910
916
|
parseMode?: string;
|
|
911
917
|
toolProvider?: string;
|
|
@@ -940,6 +946,7 @@ declare const AgentGroupConfigSchema: z.ZodObject<{
|
|
|
940
946
|
maxResultRetries: z.ZodDefault<z.ZodNumber>;
|
|
941
947
|
includePreviousScreenshot: z.ZodDefault<z.ZodBoolean>;
|
|
942
948
|
previousScreenshotCompressRatio: z.ZodDefault<z.ZodNumber>;
|
|
949
|
+
actionMarkers: z.ZodDefault<z.ZodBoolean>;
|
|
943
950
|
enableCache: z.ZodDefault<z.ZodBoolean>;
|
|
944
951
|
parseMode: z.ZodDefault<z.ZodString>;
|
|
945
952
|
toolProvider: z.ZodDefault<z.ZodString>;
|
|
@@ -973,6 +980,7 @@ declare const AgentGroupConfigSchema: z.ZodObject<{
|
|
|
973
980
|
maxResultRetries?: number;
|
|
974
981
|
includePreviousScreenshot?: boolean;
|
|
975
982
|
previousScreenshotCompressRatio?: number;
|
|
983
|
+
actionMarkers?: boolean;
|
|
976
984
|
enableCache?: boolean;
|
|
977
985
|
parseMode?: string;
|
|
978
986
|
toolProvider?: string;
|
|
@@ -1006,6 +1014,7 @@ declare const AgentGroupConfigSchema: z.ZodObject<{
|
|
|
1006
1014
|
maxResultRetries?: number;
|
|
1007
1015
|
includePreviousScreenshot?: boolean;
|
|
1008
1016
|
previousScreenshotCompressRatio?: number;
|
|
1017
|
+
actionMarkers?: boolean;
|
|
1009
1018
|
enableCache?: boolean;
|
|
1010
1019
|
parseMode?: string;
|
|
1011
1020
|
toolProvider?: string;
|
|
@@ -1041,6 +1050,7 @@ declare const AgentGroupConfigSchema: z.ZodObject<{
|
|
|
1041
1050
|
maxResultRetries?: number;
|
|
1042
1051
|
includePreviousScreenshot?: boolean;
|
|
1043
1052
|
previousScreenshotCompressRatio?: number;
|
|
1053
|
+
actionMarkers?: boolean;
|
|
1044
1054
|
enableCache?: boolean;
|
|
1045
1055
|
parseMode?: string;
|
|
1046
1056
|
toolProvider?: string;
|
|
@@ -1075,6 +1085,7 @@ declare const AgentGroupConfigSchema: z.ZodObject<{
|
|
|
1075
1085
|
maxResultRetries?: number;
|
|
1076
1086
|
includePreviousScreenshot?: boolean;
|
|
1077
1087
|
previousScreenshotCompressRatio?: number;
|
|
1088
|
+
actionMarkers?: boolean;
|
|
1078
1089
|
enableCache?: boolean;
|
|
1079
1090
|
parseMode?: string;
|
|
1080
1091
|
toolProvider?: string;
|
|
@@ -1110,6 +1121,7 @@ declare const AgentGroupConfigSchema: z.ZodObject<{
|
|
|
1110
1121
|
maxResultRetries?: number;
|
|
1111
1122
|
includePreviousScreenshot?: boolean;
|
|
1112
1123
|
previousScreenshotCompressRatio?: number;
|
|
1124
|
+
actionMarkers?: boolean;
|
|
1113
1125
|
enableCache?: boolean;
|
|
1114
1126
|
parseMode?: string;
|
|
1115
1127
|
toolProvider?: string;
|
|
@@ -1144,6 +1156,7 @@ declare const AgentGroupConfigSchema: z.ZodObject<{
|
|
|
1144
1156
|
maxResultRetries?: number;
|
|
1145
1157
|
includePreviousScreenshot?: boolean;
|
|
1146
1158
|
previousScreenshotCompressRatio?: number;
|
|
1159
|
+
actionMarkers?: boolean;
|
|
1147
1160
|
enableCache?: boolean;
|
|
1148
1161
|
parseMode?: string;
|
|
1149
1162
|
toolProvider?: string;
|
|
@@ -1878,6 +1891,7 @@ export declare const AppConfigSchema: z.ZodObject<{
|
|
|
1878
1891
|
maxResultRetries: z.ZodDefault<z.ZodNumber>;
|
|
1879
1892
|
includePreviousScreenshot: z.ZodDefault<z.ZodBoolean>;
|
|
1880
1893
|
previousScreenshotCompressRatio: z.ZodDefault<z.ZodNumber>;
|
|
1894
|
+
actionMarkers: z.ZodDefault<z.ZodBoolean>;
|
|
1881
1895
|
enableCache: z.ZodDefault<z.ZodBoolean>;
|
|
1882
1896
|
parseMode: z.ZodDefault<z.ZodString>;
|
|
1883
1897
|
toolProvider: z.ZodDefault<z.ZodString>;
|
|
@@ -1911,6 +1925,7 @@ export declare const AppConfigSchema: z.ZodObject<{
|
|
|
1911
1925
|
maxResultRetries?: number;
|
|
1912
1926
|
includePreviousScreenshot?: boolean;
|
|
1913
1927
|
previousScreenshotCompressRatio?: number;
|
|
1928
|
+
actionMarkers?: boolean;
|
|
1914
1929
|
enableCache?: boolean;
|
|
1915
1930
|
parseMode?: string;
|
|
1916
1931
|
toolProvider?: string;
|
|
@@ -1944,6 +1959,7 @@ export declare const AppConfigSchema: z.ZodObject<{
|
|
|
1944
1959
|
maxResultRetries?: number;
|
|
1945
1960
|
includePreviousScreenshot?: boolean;
|
|
1946
1961
|
previousScreenshotCompressRatio?: number;
|
|
1962
|
+
actionMarkers?: boolean;
|
|
1947
1963
|
enableCache?: boolean;
|
|
1948
1964
|
parseMode?: string;
|
|
1949
1965
|
toolProvider?: string;
|
|
@@ -1978,6 +1994,7 @@ export declare const AppConfigSchema: z.ZodObject<{
|
|
|
1978
1994
|
maxResultRetries: z.ZodDefault<z.ZodNumber>;
|
|
1979
1995
|
includePreviousScreenshot: z.ZodDefault<z.ZodBoolean>;
|
|
1980
1996
|
previousScreenshotCompressRatio: z.ZodDefault<z.ZodNumber>;
|
|
1997
|
+
actionMarkers: z.ZodDefault<z.ZodBoolean>;
|
|
1981
1998
|
enableCache: z.ZodDefault<z.ZodBoolean>;
|
|
1982
1999
|
parseMode: z.ZodDefault<z.ZodString>;
|
|
1983
2000
|
toolProvider: z.ZodDefault<z.ZodString>;
|
|
@@ -2011,6 +2028,7 @@ export declare const AppConfigSchema: z.ZodObject<{
|
|
|
2011
2028
|
maxResultRetries?: number;
|
|
2012
2029
|
includePreviousScreenshot?: boolean;
|
|
2013
2030
|
previousScreenshotCompressRatio?: number;
|
|
2031
|
+
actionMarkers?: boolean;
|
|
2014
2032
|
enableCache?: boolean;
|
|
2015
2033
|
parseMode?: string;
|
|
2016
2034
|
toolProvider?: string;
|
|
@@ -2044,6 +2062,7 @@ export declare const AppConfigSchema: z.ZodObject<{
|
|
|
2044
2062
|
maxResultRetries?: number;
|
|
2045
2063
|
includePreviousScreenshot?: boolean;
|
|
2046
2064
|
previousScreenshotCompressRatio?: number;
|
|
2065
|
+
actionMarkers?: boolean;
|
|
2047
2066
|
enableCache?: boolean;
|
|
2048
2067
|
parseMode?: string;
|
|
2049
2068
|
toolProvider?: string;
|
|
@@ -2079,6 +2098,7 @@ export declare const AppConfigSchema: z.ZodObject<{
|
|
|
2079
2098
|
maxResultRetries?: number;
|
|
2080
2099
|
includePreviousScreenshot?: boolean;
|
|
2081
2100
|
previousScreenshotCompressRatio?: number;
|
|
2101
|
+
actionMarkers?: boolean;
|
|
2082
2102
|
enableCache?: boolean;
|
|
2083
2103
|
parseMode?: string;
|
|
2084
2104
|
toolProvider?: string;
|
|
@@ -2113,6 +2133,7 @@ export declare const AppConfigSchema: z.ZodObject<{
|
|
|
2113
2133
|
maxResultRetries?: number;
|
|
2114
2134
|
includePreviousScreenshot?: boolean;
|
|
2115
2135
|
previousScreenshotCompressRatio?: number;
|
|
2136
|
+
actionMarkers?: boolean;
|
|
2116
2137
|
enableCache?: boolean;
|
|
2117
2138
|
parseMode?: string;
|
|
2118
2139
|
toolProvider?: string;
|
|
@@ -2148,6 +2169,7 @@ export declare const AppConfigSchema: z.ZodObject<{
|
|
|
2148
2169
|
maxResultRetries?: number;
|
|
2149
2170
|
includePreviousScreenshot?: boolean;
|
|
2150
2171
|
previousScreenshotCompressRatio?: number;
|
|
2172
|
+
actionMarkers?: boolean;
|
|
2151
2173
|
enableCache?: boolean;
|
|
2152
2174
|
parseMode?: string;
|
|
2153
2175
|
toolProvider?: string;
|
|
@@ -2182,6 +2204,7 @@ export declare const AppConfigSchema: z.ZodObject<{
|
|
|
2182
2204
|
maxResultRetries?: number;
|
|
2183
2205
|
includePreviousScreenshot?: boolean;
|
|
2184
2206
|
previousScreenshotCompressRatio?: number;
|
|
2207
|
+
actionMarkers?: boolean;
|
|
2185
2208
|
enableCache?: boolean;
|
|
2186
2209
|
parseMode?: string;
|
|
2187
2210
|
toolProvider?: string;
|
|
@@ -2588,6 +2611,7 @@ export declare const AppConfigSchema: z.ZodObject<{
|
|
|
2588
2611
|
maxResultRetries?: number;
|
|
2589
2612
|
includePreviousScreenshot?: boolean;
|
|
2590
2613
|
previousScreenshotCompressRatio?: number;
|
|
2614
|
+
actionMarkers?: boolean;
|
|
2591
2615
|
enableCache?: boolean;
|
|
2592
2616
|
parseMode?: string;
|
|
2593
2617
|
toolProvider?: string;
|
|
@@ -2622,6 +2646,7 @@ export declare const AppConfigSchema: z.ZodObject<{
|
|
|
2622
2646
|
maxResultRetries?: number;
|
|
2623
2647
|
includePreviousScreenshot?: boolean;
|
|
2624
2648
|
previousScreenshotCompressRatio?: number;
|
|
2649
|
+
actionMarkers?: boolean;
|
|
2625
2650
|
enableCache?: boolean;
|
|
2626
2651
|
parseMode?: string;
|
|
2627
2652
|
toolProvider?: string;
|
|
@@ -2867,6 +2892,7 @@ export declare const AppConfigSchema: z.ZodObject<{
|
|
|
2867
2892
|
maxResultRetries?: number;
|
|
2868
2893
|
includePreviousScreenshot?: boolean;
|
|
2869
2894
|
previousScreenshotCompressRatio?: number;
|
|
2895
|
+
actionMarkers?: boolean;
|
|
2870
2896
|
enableCache?: boolean;
|
|
2871
2897
|
parseMode?: string;
|
|
2872
2898
|
toolProvider?: string;
|
|
@@ -2901,6 +2927,7 @@ export declare const AppConfigSchema: z.ZodObject<{
|
|
|
2901
2927
|
maxResultRetries?: number;
|
|
2902
2928
|
includePreviousScreenshot?: boolean;
|
|
2903
2929
|
previousScreenshotCompressRatio?: number;
|
|
2930
|
+
actionMarkers?: boolean;
|
|
2904
2931
|
enableCache?: boolean;
|
|
2905
2932
|
parseMode?: string;
|
|
2906
2933
|
toolProvider?: string;
|