@midscene/core 1.12.10-beta-20260920072249.0 → 1.13.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 +104 -8
- package/dist/es/agent/agent.mjs.map +1 -1
- package/dist/es/agent/index.mjs +4 -3
- package/dist/es/agent/tasks.mjs +9 -62
- package/dist/es/agent/tasks.mjs.map +1 -1
- package/dist/es/agent/test-runner-nodes.mjs +292 -42
- package/dist/es/agent/test-runner-nodes.mjs.map +1 -1
- package/dist/es/agent/utils.mjs +1 -1
- package/dist/es/device/index.mjs +15 -2
- package/dist/es/device/index.mjs.map +1 -1
- package/dist/es/dump/html-utils.mjs +37 -4
- package/dist/es/dump/html-utils.mjs.map +1 -1
- package/dist/es/dump/screenshot-store.mjs +8 -1
- package/dist/es/dump/screenshot-store.mjs.map +1 -1
- package/dist/es/report-cli.mjs +9 -4
- package/dist/es/report-cli.mjs.map +1 -1
- package/dist/es/report-generator.mjs +117 -4
- package/dist/es/report-generator.mjs.map +1 -1
- package/dist/es/report-html-template.mjs +1 -1
- package/dist/es/report.mjs +190 -41
- package/dist/es/report.mjs.map +1 -1
- package/dist/es/test-run-report.mjs.map +1 -1
- package/dist/es/test-runner/engine/case-runner.mjs +52 -0
- package/dist/es/test-runner/engine/case-runner.mjs.map +1 -0
- package/dist/es/test-runner/engine/document-runtime.mjs +273 -0
- package/dist/es/test-runner/engine/document-runtime.mjs.map +1 -0
- package/dist/es/test-runner/engine/execute-step.mjs +177 -0
- package/dist/es/test-runner/engine/execute-step.mjs.map +1 -0
- package/dist/es/test-runner/engine/execution-failure.mjs +39 -0
- package/dist/es/test-runner/engine/execution-failure.mjs.map +1 -0
- package/dist/es/test-runner/engine/index.mjs +12 -0
- package/dist/es/test-runner/engine/project-runtime.mjs +142 -0
- package/dist/es/test-runner/engine/project-runtime.mjs.map +1 -0
- package/dist/es/test-runner/engine/registry.mjs +61 -0
- package/dist/es/test-runner/engine/registry.mjs.map +1 -0
- package/dist/es/test-runner/engine/resource-operations.mjs +211 -0
- package/dist/es/test-runner/engine/resource-operations.mjs.map +1 -0
- package/dist/es/test-runner/engine/run-collected-case.mjs +193 -0
- package/dist/es/test-runner/engine/run-collected-case.mjs.map +1 -0
- package/dist/es/test-runner/engine/run-workflow-document.mjs +155 -0
- package/dist/es/test-runner/engine/run-workflow-document.mjs.map +1 -0
- package/dist/es/test-runner/engine/scheduler.mjs +27 -0
- package/dist/es/test-runner/engine/scheduler.mjs.map +1 -0
- package/dist/es/test-runner/engine/scope-teardown.mjs +16 -0
- package/dist/es/test-runner/engine/scope-teardown.mjs.map +1 -0
- package/dist/es/test-runner/engine/types.mjs +0 -0
- package/dist/es/test-runner/errors.mjs +201 -0
- package/dist/es/test-runner/errors.mjs.map +1 -0
- package/dist/es/test-runner/execution-record.mjs +83 -0
- package/dist/es/test-runner/execution-record.mjs.map +1 -0
- package/dist/es/test-runner/index.mjs +12 -0
- package/dist/es/test-runner/node/define-node.mjs +44 -0
- package/dist/es/test-runner/node/define-node.mjs.map +1 -0
- package/dist/es/test-runner/node/index.mjs +2 -0
- package/dist/es/test-runner/node/types.mjs +0 -0
- package/dist/es/test-runner/parser/document-format.mjs +21 -0
- package/dist/es/test-runner/parser/document-format.mjs.map +1 -0
- package/dist/es/test-runner/parser/normalize.mjs +87 -0
- package/dist/es/test-runner/parser/normalize.mjs.map +1 -0
- package/dist/es/test-runner/parser/types.mjs +0 -0
- package/dist/es/test-runner/project.mjs +0 -0
- package/dist/es/test-runner/reporting/agent-report.mjs +23 -0
- package/dist/es/test-runner/reporting/agent-report.mjs.map +1 -0
- package/dist/es/test-runner/reporting/execution-record.mjs +73 -0
- package/dist/es/test-runner/reporting/execution-record.mjs.map +1 -0
- package/dist/es/test-runner/reporting/merge-report.mjs +231 -0
- package/dist/es/test-runner/reporting/merge-report.mjs.map +1 -0
- package/dist/es/test-runner/reporting/sanitize.mjs +162 -0
- package/dist/es/test-runner/reporting/sanitize.mjs.map +1 -0
- package/dist/es/test-runner/reporting/test-run-report.mjs +327 -0
- package/dist/es/test-runner/reporting/test-run-report.mjs.map +1 -0
- package/dist/es/test-runner/reporting/types.mjs +0 -0
- package/dist/es/types.mjs.map +1 -1
- package/dist/es/utils.mjs +1 -1
- package/dist/es/yaml/execution-context.node.mjs +6 -0
- package/dist/es/yaml/execution-context.node.mjs.map +1 -0
- package/dist/es/yaml/execution-context.stub.mjs +8 -0
- package/dist/es/yaml/execution-context.stub.mjs.map +1 -0
- package/dist/es/yaml/execution-session.mjs +90 -0
- package/dist/es/yaml/execution-session.mjs.map +1 -0
- package/dist/es/yaml/index.mjs +2 -1
- package/dist/es/yaml/legacy-yaml-execution-record.mjs +47 -0
- package/dist/es/yaml/legacy-yaml-execution-record.mjs.map +1 -0
- package/dist/es/yaml/legacy-yaml-report.mjs +52 -0
- package/dist/es/yaml/legacy-yaml-report.mjs.map +1 -0
- package/dist/es/yaml/legacy-yaml-runtime.mjs +119 -0
- package/dist/es/yaml/legacy-yaml-runtime.mjs.map +1 -0
- package/dist/es/yaml/player-state.mjs +15 -0
- package/dist/es/yaml/player-state.mjs.map +1 -0
- package/dist/es/yaml/player.mjs +214 -348
- package/dist/es/yaml/player.mjs.map +1 -1
- package/dist/es/yaml/report-policy.mjs +7 -0
- package/dist/es/yaml/report-policy.mjs.map +1 -0
- package/dist/es/yaml/test-runner-compat.mjs +301 -0
- package/dist/es/yaml/test-runner-compat.mjs.map +1 -0
- package/dist/es/yaml/test-runner-nodes.mjs +147 -0
- package/dist/es/yaml/test-runner-nodes.mjs.map +1 -0
- package/dist/es/yaml/utils.mjs +12 -1
- package/dist/es/yaml/utils.mjs.map +1 -1
- package/dist/es/yaml-runtime.mjs +7 -0
- package/dist/es/yaml.mjs.map +1 -1
- package/dist/lib/agent/agent.js +104 -8
- package/dist/lib/agent/agent.js.map +1 -1
- package/dist/lib/agent/index.js +37 -3
- package/dist/lib/agent/tasks.js +9 -62
- package/dist/lib/agent/tasks.js.map +1 -1
- package/dist/lib/agent/test-runner-nodes.js +330 -47
- package/dist/lib/agent/test-runner-nodes.js.map +1 -1
- package/dist/lib/agent/utils.js +1 -1
- package/dist/lib/device/index.js +15 -2
- package/dist/lib/device/index.js.map +1 -1
- package/dist/lib/dump/html-utils.js +43 -4
- package/dist/lib/dump/html-utils.js.map +1 -1
- package/dist/lib/dump/screenshot-store.js +8 -1
- package/dist/lib/dump/screenshot-store.js.map +1 -1
- package/dist/lib/report-cli.js +8 -3
- package/dist/lib/report-cli.js.map +1 -1
- package/dist/lib/report-generator.js +114 -1
- package/dist/lib/report-generator.js.map +1 -1
- package/dist/lib/report-html-template.js +1 -1
- package/dist/lib/report.js +187 -38
- package/dist/lib/report.js.map +1 -1
- package/dist/lib/test-run-report.js.map +1 -1
- package/dist/lib/test-runner/engine/case-runner.js +89 -0
- package/dist/lib/test-runner/engine/case-runner.js.map +1 -0
- package/dist/lib/test-runner/engine/document-runtime.js +307 -0
- package/dist/lib/test-runner/engine/document-runtime.js.map +1 -0
- package/dist/lib/test-runner/engine/execute-step.js +211 -0
- package/dist/lib/test-runner/engine/execute-step.js.map +1 -0
- package/dist/lib/test-runner/engine/execution-failure.js +79 -0
- package/dist/lib/test-runner/engine/execution-failure.js.map +1 -0
- package/dist/lib/test-runner/engine/index.js +137 -0
- package/dist/lib/test-runner/engine/index.js.map +1 -0
- package/dist/lib/test-runner/engine/project-runtime.js +176 -0
- package/dist/lib/test-runner/engine/project-runtime.js.map +1 -0
- package/dist/lib/test-runner/engine/registry.js +95 -0
- package/dist/lib/test-runner/engine/registry.js.map +1 -0
- package/dist/lib/test-runner/engine/resource-operations.js +272 -0
- package/dist/lib/test-runner/engine/resource-operations.js.map +1 -0
- package/dist/lib/test-runner/engine/run-collected-case.js +227 -0
- package/dist/lib/test-runner/engine/run-collected-case.js.map +1 -0
- package/dist/lib/test-runner/engine/run-workflow-document.js +189 -0
- package/dist/lib/test-runner/engine/run-workflow-document.js.map +1 -0
- package/dist/lib/test-runner/engine/scheduler.js +64 -0
- package/dist/lib/test-runner/engine/scheduler.js.map +1 -0
- package/dist/lib/test-runner/engine/scope-teardown.js +50 -0
- package/dist/lib/test-runner/engine/scope-teardown.js.map +1 -0
- package/dist/lib/test-runner/engine/types.js +20 -0
- package/dist/lib/test-runner/engine/types.js.map +1 -0
- package/dist/lib/test-runner/errors.js +283 -0
- package/dist/lib/test-runner/errors.js.map +1 -0
- package/dist/lib/test-runner/execution-record.js +123 -0
- package/dist/lib/test-runner/execution-record.js.map +1 -0
- package/dist/lib/test-runner/index.js +137 -0
- package/dist/lib/test-runner/index.js.map +1 -0
- package/dist/lib/test-runner/node/define-node.js +78 -0
- package/dist/lib/test-runner/node/define-node.js.map +1 -0
- package/dist/lib/test-runner/node/index.js +67 -0
- package/dist/lib/test-runner/node/index.js.map +1 -0
- package/dist/lib/test-runner/node/types.js +20 -0
- package/dist/lib/test-runner/node/types.js.map +1 -0
- package/dist/lib/test-runner/parser/document-format.js +58 -0
- package/dist/lib/test-runner/parser/document-format.js.map +1 -0
- package/dist/lib/test-runner/parser/normalize.js +124 -0
- package/dist/lib/test-runner/parser/normalize.js.map +1 -0
- package/dist/lib/test-runner/parser/types.js +20 -0
- package/dist/lib/test-runner/parser/types.js.map +1 -0
- package/dist/lib/test-runner/project.js +20 -0
- package/dist/lib/test-runner/project.js.map +1 -0
- package/dist/lib/test-runner/reporting/agent-report.js +57 -0
- package/dist/lib/test-runner/reporting/agent-report.js.map +1 -0
- package/dist/lib/test-runner/reporting/execution-record.js +107 -0
- package/dist/lib/test-runner/reporting/execution-record.js.map +1 -0
- package/dist/lib/test-runner/reporting/merge-report.js +265 -0
- package/dist/lib/test-runner/reporting/merge-report.js.map +1 -0
- package/dist/lib/test-runner/reporting/sanitize.js +202 -0
- package/dist/lib/test-runner/reporting/sanitize.js.map +1 -0
- package/dist/lib/test-runner/reporting/test-run-report.js +364 -0
- package/dist/lib/test-runner/reporting/test-run-report.js.map +1 -0
- package/dist/lib/test-runner/reporting/types.js +20 -0
- package/dist/lib/test-runner/reporting/types.js.map +1 -0
- package/dist/lib/types.js.map +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/lib/yaml/execution-context.node.js +43 -0
- package/dist/lib/yaml/execution-context.node.js.map +1 -0
- package/dist/lib/yaml/execution-context.stub.js +45 -0
- package/dist/lib/yaml/execution-context.stub.js.map +1 -0
- package/dist/lib/yaml/execution-session.js +136 -0
- package/dist/lib/yaml/execution-session.js.map +1 -0
- package/dist/lib/yaml/index.js +49 -7
- package/dist/lib/yaml/legacy-yaml-execution-record.js +81 -0
- package/dist/lib/yaml/legacy-yaml-execution-record.js.map +1 -0
- package/dist/lib/yaml/legacy-yaml-report.js +86 -0
- package/dist/lib/yaml/legacy-yaml-report.js.map +1 -0
- package/dist/lib/yaml/legacy-yaml-runtime.js +156 -0
- package/dist/lib/yaml/legacy-yaml-runtime.js.map +1 -0
- package/dist/lib/yaml/player-state.js +52 -0
- package/dist/lib/yaml/player-state.js.map +1 -0
- package/dist/lib/yaml/player.js +213 -347
- package/dist/lib/yaml/player.js.map +1 -1
- package/dist/lib/yaml/report-policy.js +41 -0
- package/dist/lib/yaml/report-policy.js.map +1 -0
- package/dist/lib/yaml/test-runner-compat.js +344 -0
- package/dist/lib/yaml/test-runner-compat.js.map +1 -0
- package/dist/lib/yaml/test-runner-nodes.js +184 -0
- package/dist/lib/yaml/test-runner-nodes.js.map +1 -0
- package/dist/lib/yaml/utils.js +18 -1
- package/dist/lib/yaml/utils.js.map +1 -1
- package/dist/lib/yaml-runtime.js +67 -0
- package/dist/lib/yaml-runtime.js.map +1 -0
- package/dist/lib/yaml.js.map +1 -1
- package/dist/types/agent/agent.d.ts +14 -2
- package/dist/types/agent/agent.d.ts.map +1 -1
- package/dist/types/agent/index.d.ts +4 -3
- package/dist/types/agent/index.d.ts.map +1 -1
- package/dist/types/agent/tasks.d.ts +2 -2
- package/dist/types/agent/tasks.d.ts.map +1 -1
- package/dist/types/agent/test-runner-nodes.d.ts +228 -2
- package/dist/types/agent/test-runner-nodes.d.ts.map +1 -1
- package/dist/types/device/index.d.ts +1 -1
- package/dist/types/device/index.d.ts.map +1 -1
- package/dist/types/dump/html-utils.d.ts +4 -0
- package/dist/types/dump/html-utils.d.ts.map +1 -1
- package/dist/types/dump/screenshot-store.d.ts +2 -1
- package/dist/types/dump/screenshot-store.d.ts.map +1 -1
- package/dist/types/report-cli.d.ts.map +1 -1
- package/dist/types/report-generator.d.ts +10 -0
- package/dist/types/report-generator.d.ts.map +1 -1
- package/dist/types/report.d.ts +3 -1
- package/dist/types/report.d.ts.map +1 -1
- package/dist/types/test-run-report.d.ts +18 -2
- package/dist/types/test-run-report.d.ts.map +1 -1
- package/dist/types/test-runner/engine/case-runner.d.ts +13 -0
- package/dist/types/test-runner/engine/case-runner.d.ts.map +1 -0
- package/dist/types/test-runner/engine/document-runtime.d.ts +4 -0
- package/dist/types/test-runner/engine/document-runtime.d.ts.map +1 -0
- package/dist/types/test-runner/engine/execute-step.d.ts +17 -0
- package/dist/types/test-runner/engine/execute-step.d.ts.map +1 -0
- package/dist/types/test-runner/engine/execution-failure.d.ts +13 -0
- package/dist/types/test-runner/engine/execution-failure.d.ts.map +1 -0
- package/dist/types/test-runner/engine/index.d.ts +13 -0
- package/dist/types/test-runner/engine/index.d.ts.map +1 -0
- package/dist/types/test-runner/engine/project-runtime.d.ts +3 -0
- package/dist/types/test-runner/engine/project-runtime.d.ts.map +1 -0
- package/dist/types/test-runner/engine/registry.d.ts +12 -0
- package/dist/types/test-runner/engine/registry.d.ts.map +1 -0
- package/dist/types/test-runner/engine/resource-operations.d.ts +32 -0
- package/dist/types/test-runner/engine/resource-operations.d.ts.map +1 -0
- package/dist/types/test-runner/engine/run-collected-case.d.ts +4 -0
- package/dist/types/test-runner/engine/run-collected-case.d.ts.map +1 -0
- package/dist/types/test-runner/engine/run-workflow-document.d.ts +4 -0
- package/dist/types/test-runner/engine/run-workflow-document.d.ts.map +1 -0
- package/dist/types/test-runner/engine/scheduler.d.ts +12 -0
- package/dist/types/test-runner/engine/scheduler.d.ts.map +1 -0
- package/dist/types/test-runner/engine/scope-teardown.d.ts +3 -0
- package/dist/types/test-runner/engine/scope-teardown.d.ts.map +1 -0
- package/dist/types/test-runner/engine/types.d.ts +226 -0
- package/dist/types/test-runner/engine/types.d.ts.map +1 -0
- package/dist/types/test-runner/errors.d.ts +79 -0
- package/dist/types/test-runner/errors.d.ts.map +1 -0
- package/dist/types/test-runner/execution-record.d.ts +43 -0
- package/dist/types/test-runner/execution-record.d.ts.map +1 -0
- package/dist/types/test-runner/index.d.ts +20 -0
- package/dist/types/test-runner/index.d.ts.map +1 -0
- package/dist/types/test-runner/node/define-node.d.ts +4 -0
- package/dist/types/test-runner/node/define-node.d.ts.map +1 -0
- package/dist/types/test-runner/node/index.d.ts +3 -0
- package/dist/types/test-runner/node/index.d.ts.map +1 -0
- package/dist/types/test-runner/node/types.d.ts +66 -0
- package/dist/types/test-runner/node/types.d.ts.map +1 -0
- package/dist/types/test-runner/parser/document-format.d.ts +8 -0
- package/dist/types/test-runner/parser/document-format.d.ts.map +1 -0
- package/dist/types/test-runner/parser/normalize.d.ts +9 -0
- package/dist/types/test-runner/parser/normalize.d.ts.map +1 -0
- package/dist/types/test-runner/parser/types.d.ts +69 -0
- package/dist/types/test-runner/parser/types.d.ts.map +1 -0
- package/dist/types/test-runner/project.d.ts +75 -0
- package/dist/types/test-runner/project.d.ts.map +1 -0
- package/dist/types/test-runner/reporting/agent-report.d.ts +9 -0
- package/dist/types/test-runner/reporting/agent-report.d.ts.map +1 -0
- package/dist/types/test-runner/reporting/execution-record.d.ts +9 -0
- package/dist/types/test-runner/reporting/execution-record.d.ts.map +1 -0
- package/dist/types/test-runner/reporting/merge-report.d.ts +15 -0
- package/dist/types/test-runner/reporting/merge-report.d.ts.map +1 -0
- package/dist/types/test-runner/reporting/sanitize.d.ts +6 -0
- package/dist/types/test-runner/reporting/sanitize.d.ts.map +1 -0
- package/dist/types/test-runner/reporting/test-run-report.d.ts +5 -0
- package/dist/types/test-runner/reporting/test-run-report.d.ts.map +1 -0
- package/dist/types/test-runner/reporting/types.d.ts +34 -0
- package/dist/types/test-runner/reporting/types.d.ts.map +1 -0
- package/dist/types/types.d.ts +1 -1
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/yaml/execution-context.node.d.ts +4 -0
- package/dist/types/yaml/execution-context.node.d.ts.map +1 -0
- package/dist/types/yaml/execution-context.stub.d.ts +6 -0
- package/dist/types/yaml/execution-context.stub.d.ts.map +1 -0
- package/dist/types/yaml/execution-session.d.ts +17 -0
- package/dist/types/yaml/execution-session.d.ts.map +1 -0
- package/dist/types/yaml/index.d.ts +1 -1
- package/dist/types/yaml/index.d.ts.map +1 -1
- package/dist/types/yaml/legacy-yaml-execution-record.d.ts +24 -0
- package/dist/types/yaml/legacy-yaml-execution-record.d.ts.map +1 -0
- package/dist/types/yaml/legacy-yaml-report.d.ts +19 -0
- package/dist/types/yaml/legacy-yaml-report.d.ts.map +1 -0
- package/dist/types/yaml/legacy-yaml-runtime.d.ts +23 -0
- package/dist/types/yaml/legacy-yaml-runtime.d.ts.map +1 -0
- package/dist/types/yaml/player-state.d.ts +11 -0
- package/dist/types/yaml/player-state.d.ts.map +1 -0
- package/dist/types/yaml/player.d.ts +11 -3
- package/dist/types/yaml/player.d.ts.map +1 -1
- package/dist/types/yaml/report-policy.d.ts +4 -0
- package/dist/types/yaml/report-policy.d.ts.map +1 -0
- package/dist/types/yaml/test-runner-compat.d.ts +17 -0
- package/dist/types/yaml/test-runner-compat.d.ts.map +1 -0
- package/dist/types/yaml/test-runner-nodes.d.ts +6 -0
- package/dist/types/yaml/test-runner-nodes.d.ts.map +1 -0
- package/dist/types/yaml/utils.d.ts +9 -0
- package/dist/types/yaml/utils.d.ts.map +1 -1
- package/dist/types/yaml-runtime.d.ts +13 -0
- package/dist/types/yaml-runtime.d.ts.map +1 -0
- package/dist/types/yaml.d.ts +25 -7
- package/dist/types/yaml.d.ts.map +1 -1
- package/package.json +28 -2
- package/dist/es/ai-model/workflows/planning/auto-deep-think.mjs +0 -80
- package/dist/es/ai-model/workflows/planning/auto-deep-think.mjs.map +0 -1
- package/dist/lib/ai-model/workflows/planning/auto-deep-think.js +0 -114
- package/dist/lib/ai-model/workflows/planning/auto-deep-think.js.map +0 -1
- package/dist/types/ai-model/workflows/planning/auto-deep-think.d.ts +0 -20
- package/dist/types/ai-model/workflows/planning/auto-deep-think.d.ts.map +0 -1
package/dist/es/agent/agent.mjs
CHANGED
|
@@ -2,9 +2,14 @@ import { getModelRuntime } from "../ai-model/models/index.mjs";
|
|
|
2
2
|
import { INTERNAL_CALL_ID_FIELD } from "../ai-model/service-caller/index.mjs";
|
|
3
3
|
import { IS_REPORT_BUILD } from "../constants.mjs";
|
|
4
4
|
import js_yaml from "js-yaml";
|
|
5
|
+
import { generateTestRunReportScriptTag } from "../dump/html-utils.mjs";
|
|
5
6
|
import { ScreenshotItem } from "../screenshot-item.mjs";
|
|
6
7
|
import service from "../service/index.mjs";
|
|
8
|
+
import { waitForResourceIdle } from "../test-runner/engine/resource-operations.mjs";
|
|
9
|
+
import { buildAgentTestRunReportDump } from "../test-runner/reporting/agent-report.mjs";
|
|
10
|
+
import { executionRecordsToReportInput } from "../test-runner/reporting/execution-record.mjs";
|
|
7
11
|
import { ExecutionDump, ReportActionDump } from "../types.mjs";
|
|
12
|
+
import { YamlExecutionOwnershipError, enterYamlAction, enterYamlExecution, runInYamlExecutionContext } from "../yaml/execution-session.mjs";
|
|
8
13
|
import { ReportGenerator, assertReportGenerationOptions } from "../report-generator.mjs";
|
|
9
14
|
import { getVersion, processCacheConfig, reportHTMLContent } from "../utils.mjs";
|
|
10
15
|
import { ScriptPlayer, buildDetailedLocateParam, buildDetailedLocateParamAndRestParams, parseYamlScript } from "../yaml/index.mjs";
|
|
@@ -61,6 +66,60 @@ class Agent {
|
|
|
61
66
|
static getTestRunnerNodeDefinitions() {
|
|
62
67
|
return commonAgentTestRunnerNodeDefinitions;
|
|
63
68
|
}
|
|
69
|
+
_prepareForTestRunner() {
|
|
70
|
+
this.reportGenerator.enableSourceSnapshots?.();
|
|
71
|
+
}
|
|
72
|
+
async _createReportSource(scopeId) {
|
|
73
|
+
return this.reportGenerator.createSourceSnapshot?.(scopeId);
|
|
74
|
+
}
|
|
75
|
+
async _writeYamlExecutionReport(record) {
|
|
76
|
+
const existingIndex = this.yamlExecutionRecords.findIndex((entry)=>entry.runId === record.runId);
|
|
77
|
+
const recordIndex = existingIndex < 0 ? this.yamlExecutionRecords.length : existingIndex;
|
|
78
|
+
this.yamlExecutionRecords[recordIndex] = record;
|
|
79
|
+
try {
|
|
80
|
+
const path = await this.reportGenerator.writeRunnerReport?.(this.buildYamlReportInput(), this.yamlReportScopeId, this.getReportMeta());
|
|
81
|
+
this.reportFile = path ?? this.reportFile;
|
|
82
|
+
return path;
|
|
83
|
+
} catch (error) {
|
|
84
|
+
this.yamlExecutionRecords[recordIndex] = Object.freeze({
|
|
85
|
+
...record,
|
|
86
|
+
status: 'failed',
|
|
87
|
+
reportError: error
|
|
88
|
+
});
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
buildYamlReportInput() {
|
|
93
|
+
const scopedRecords = this.yamlExecutionRecords.map((entry)=>({
|
|
94
|
+
...entry,
|
|
95
|
+
...entry.execution ? {
|
|
96
|
+
execution: {
|
|
97
|
+
document: {
|
|
98
|
+
...entry.execution.document,
|
|
99
|
+
reportScopeId: this.yamlReportScopeId
|
|
100
|
+
},
|
|
101
|
+
cases: entry.execution.cases.map((outcome)=>({
|
|
102
|
+
...outcome,
|
|
103
|
+
...outcome.run ? {
|
|
104
|
+
run: {
|
|
105
|
+
...outcome.run,
|
|
106
|
+
reportScopeId: this.yamlReportScopeId
|
|
107
|
+
}
|
|
108
|
+
} : {},
|
|
109
|
+
...outcome.attempts ? {
|
|
110
|
+
attempts: outcome.attempts.map((attempt)=>({
|
|
111
|
+
...attempt,
|
|
112
|
+
reportScopeId: this.yamlReportScopeId
|
|
113
|
+
}))
|
|
114
|
+
} : {}
|
|
115
|
+
}))
|
|
116
|
+
}
|
|
117
|
+
} : {}
|
|
118
|
+
}));
|
|
119
|
+
return executionRecordsToReportInput(scopedRecords, {
|
|
120
|
+
runId: this.yamlReportScopeId
|
|
121
|
+
});
|
|
122
|
+
}
|
|
64
123
|
get onDumpUpdate() {
|
|
65
124
|
return this.dumpUpdateListeners[0];
|
|
66
125
|
}
|
|
@@ -247,7 +306,21 @@ class Agent {
|
|
|
247
306
|
}
|
|
248
307
|
reportHTMLString(opt) {
|
|
249
308
|
if (IS_REPORT_BUILD) return '';
|
|
250
|
-
|
|
309
|
+
const dumpString = this.dumpDataString(opt);
|
|
310
|
+
if (!this.yamlExecutionRecords.length) return reportHTMLContent(dumpString);
|
|
311
|
+
const reportId = this.yamlReportScopeId;
|
|
312
|
+
const runnerDump = buildAgentTestRunReportDump(this.buildYamlReportInput(), this.dump, {
|
|
313
|
+
reportId,
|
|
314
|
+
scopeId: this.yamlReportScopeId,
|
|
315
|
+
sourcePath: this.reportFile ?? '<inline-agent-report>'
|
|
316
|
+
});
|
|
317
|
+
return `${reportHTMLContent({
|
|
318
|
+
dumpString,
|
|
319
|
+
attributes: {
|
|
320
|
+
'data-group-id': reportId,
|
|
321
|
+
'data-report-id': reportId
|
|
322
|
+
}
|
|
323
|
+
})}\n${generateTestRunReportScriptTag(runnerDump)}`;
|
|
251
324
|
}
|
|
252
325
|
writeOutActionDumps(executionDump) {
|
|
253
326
|
const exec = executionDump || this.lastExecutionDump;
|
|
@@ -257,6 +330,11 @@ class Agent {
|
|
|
257
330
|
}
|
|
258
331
|
this.reportFile = this.reportGenerator.getReportPath();
|
|
259
332
|
}
|
|
333
|
+
async flushReport() {
|
|
334
|
+
this.writeOutActionDumps();
|
|
335
|
+
await this.reportGenerator.flush();
|
|
336
|
+
return this.lastExecutionDump ? this.reportFile ?? void 0 : void 0;
|
|
337
|
+
}
|
|
260
338
|
getReportMeta() {
|
|
261
339
|
return {
|
|
262
340
|
groupName: this.dump.groupName,
|
|
@@ -276,9 +354,12 @@ class Agent {
|
|
|
276
354
|
}
|
|
277
355
|
async callActionInActionSpace(type, opt) {
|
|
278
356
|
debug('callActionInActionSpace', type, ',', opt);
|
|
357
|
+
const clonedActionParam = opt && 'object' == typeof opt && !Array.isArray(opt) ? {
|
|
358
|
+
...opt
|
|
359
|
+
} : opt || {};
|
|
279
360
|
const actionPlan = {
|
|
280
361
|
type: type,
|
|
281
|
-
param:
|
|
362
|
+
param: clonedActionParam,
|
|
282
363
|
thought: ''
|
|
283
364
|
};
|
|
284
365
|
debug('actionPlan', actionPlan);
|
|
@@ -441,9 +522,8 @@ class Agent {
|
|
|
441
522
|
const aiActContext = this.resolveUserContext('aiAct', opt?.context);
|
|
442
523
|
const cachePrompt = buildPromptWithContext(taskPrompt, aiActContext);
|
|
443
524
|
const effort = (()=>{
|
|
444
|
-
const resolvedEffort = opt?.effort ?? (opt?.deepThink ===
|
|
445
|
-
if (opt?.effort !== void 0
|
|
446
|
-
if ('auto' === resolvedEffort && 'custom' === planningModel.adapter.planning.kind) throw new Error('deepThink: "auto" requires a standard planning adapter.');
|
|
525
|
+
const resolvedEffort = opt?.effort ?? (opt?.deepThink === true ? 'deepThink' : 'balance');
|
|
526
|
+
if (opt?.effort !== void 0 && void 0 !== opt.deepThink) warn('When both "effort" and "deepThink" are provided, "effort" takes precedence.');
|
|
447
527
|
if ('fast' === resolvedEffort && 'custom' === planningModel.adapter.planning.kind) throw new Error(`The "fast" aiAct effort is not supported with custom planning adapters (modelFamily: ${planningModel.config.modelFamily ?? 'unknown'}).`);
|
|
448
528
|
if ('deepThink' === resolvedEffort && 'custom' === planningModel.adapter.planning.kind) {
|
|
449
529
|
warn(`The "deepThink" aiAct effort is not supported with custom planning adapters (modelFamily: ${planningModel.config.modelFamily ?? 'unknown'}). It will be ignored.`);
|
|
@@ -466,9 +546,20 @@ class Agent {
|
|
|
466
546
|
try {
|
|
467
547
|
await this.taskExecutor.loadYamlFlowAsPlanning(taskPrompt, yaml, internalReportDisplay);
|
|
468
548
|
debug('matched cache, will call .runYaml to run the action');
|
|
469
|
-
await
|
|
549
|
+
await runInYamlExecutionContext(async ()=>{
|
|
550
|
+
const replay = enterYamlExecution(this);
|
|
551
|
+
const leaveAction = abortSignal ? enterYamlAction(this, abortSignal) : void 0;
|
|
552
|
+
try {
|
|
553
|
+
await this.runYaml(yaml);
|
|
554
|
+
} finally{
|
|
555
|
+
leaveAction?.();
|
|
556
|
+
replay.finish();
|
|
557
|
+
}
|
|
558
|
+
});
|
|
470
559
|
return;
|
|
471
560
|
} catch (error) {
|
|
561
|
+
if (error instanceof YamlExecutionOwnershipError) throw error;
|
|
562
|
+
abortSignal?.throwIfAborted();
|
|
472
563
|
cachedYamlFailed = true;
|
|
473
564
|
warn(`cached aiAct plan failed, will replan and disable the stale cache: ${error instanceof Error ? error.message : String(error)}`);
|
|
474
565
|
}
|
|
@@ -596,6 +687,7 @@ class Agent {
|
|
|
596
687
|
return this.aiAct(...args);
|
|
597
688
|
}
|
|
598
689
|
async runYaml(yamlScriptContent) {
|
|
690
|
+
if (this.destroyed) throw new Error('Cannot run YAML using a destroyed Agent.');
|
|
599
691
|
const script = parseYamlScript(yamlScriptContent, 'yaml');
|
|
600
692
|
const player = new ScriptPlayer(script, async ()=>({
|
|
601
693
|
agent: this,
|
|
@@ -647,6 +739,7 @@ class Agent {
|
|
|
647
739
|
async destroy() {
|
|
648
740
|
if (this.destroyed) return;
|
|
649
741
|
this.destroyed = true;
|
|
742
|
+
await waitForResourceIdle(this);
|
|
650
743
|
for (const observer of this.ownedObservers)try {
|
|
651
744
|
await observer.dispose();
|
|
652
745
|
} catch (error) {
|
|
@@ -666,8 +759,9 @@ class Agent {
|
|
|
666
759
|
this.resetDump();
|
|
667
760
|
if (interfaceDestroyError) throw interfaceDestroyError;
|
|
668
761
|
}
|
|
669
|
-
async sleep(ms) {
|
|
670
|
-
|
|
762
|
+
async sleep(ms, options) {
|
|
763
|
+
options?.abortSignal?.throwIfAborted();
|
|
764
|
+
await this.taskExecutor.sleep(ms, options?.abortSignal);
|
|
671
765
|
}
|
|
672
766
|
async recordToReport(title, opt) {
|
|
673
767
|
const now = Date.now();
|
|
@@ -831,6 +925,8 @@ class Agent {
|
|
|
831
925
|
_define_property(this, "dump", void 0);
|
|
832
926
|
_define_property(this, "reportFile", void 0);
|
|
833
927
|
_define_property(this, "reportFileName", void 0);
|
|
928
|
+
_define_property(this, "yamlReportScopeId", uuid());
|
|
929
|
+
_define_property(this, "yamlExecutionRecords", []);
|
|
834
930
|
_define_property(this, "taskExecutor", void 0);
|
|
835
931
|
_define_property(this, "opts", void 0);
|
|
836
932
|
_define_property(this, "dryMode", false);
|