@midscene/core 1.12.10-beta-20260920031616.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 +103 -6
- package/dist/es/agent/agent.mjs.map +1 -1
- package/dist/es/agent/index.mjs +4 -3
- package/dist/es/agent/tasks.mjs +2 -2
- package/dist/es/agent/tasks.mjs.map +1 -1
- package/dist/es/agent/test-runner-nodes.mjs +291 -40
- 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/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 +103 -6
- package/dist/lib/agent/agent.js.map +1 -1
- package/dist/lib/agent/index.js +37 -3
- package/dist/lib/agent/tasks.js +2 -2
- package/dist/lib/agent/tasks.js.map +1 -1
- package/dist/lib/agent/test-runner-nodes.js +329 -45
- 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/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 -1
- 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 +1 -1
- package/dist/types/agent/tasks.d.ts.map +1 -1
- package/dist/types/agent/test-runner-nodes.d.ts +226 -0
- 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/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
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
3
|
+
value: value,
|
|
4
|
+
enumerable: true,
|
|
5
|
+
configurable: true,
|
|
6
|
+
writable: true
|
|
7
|
+
});
|
|
8
|
+
else obj[key] = value;
|
|
9
|
+
return obj;
|
|
10
|
+
}
|
|
11
|
+
class WorkflowError extends Error {
|
|
12
|
+
toJSON() {
|
|
13
|
+
return {
|
|
14
|
+
name: this.name,
|
|
15
|
+
message: this.message,
|
|
16
|
+
code: this.code,
|
|
17
|
+
...void 0 === this.details ? {} : {
|
|
18
|
+
details: this.details
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
constructor(message, options = {}){
|
|
23
|
+
super(message, {
|
|
24
|
+
cause: options.cause
|
|
25
|
+
}), _define_property(this, "code", void 0), _define_property(this, "details", void 0);
|
|
26
|
+
this.name = new.target.name;
|
|
27
|
+
this.code = options.code ?? 'WORKFLOW_ERROR';
|
|
28
|
+
this.details = options.details;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
class WorkflowParseError extends WorkflowError {
|
|
32
|
+
constructor(message, details, cause){
|
|
33
|
+
super(message, {
|
|
34
|
+
code: 'WORKFLOW_PARSE_ERROR',
|
|
35
|
+
details,
|
|
36
|
+
cause
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
class NodeDefinitionError extends WorkflowError {
|
|
41
|
+
constructor(message, details){
|
|
42
|
+
super(message, {
|
|
43
|
+
code: 'NODE_DEFINITION_ERROR',
|
|
44
|
+
details
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
class DuplicateNodeError extends WorkflowError {
|
|
49
|
+
constructor(node){
|
|
50
|
+
super(`Node "${node}" is already registered.`, {
|
|
51
|
+
code: 'DUPLICATE_NODE',
|
|
52
|
+
details: {
|
|
53
|
+
node
|
|
54
|
+
}
|
|
55
|
+
}), _define_property(this, "node", void 0);
|
|
56
|
+
this.node = node;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
class NodeNotFoundError extends WorkflowError {
|
|
60
|
+
constructor(node){
|
|
61
|
+
super(`Node "${node}" is not registered.`, {
|
|
62
|
+
code: 'NODE_NOT_FOUND',
|
|
63
|
+
details: {
|
|
64
|
+
node
|
|
65
|
+
}
|
|
66
|
+
}), _define_property(this, "node", void 0);
|
|
67
|
+
this.node = node;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
class NodeInputValidationError extends WorkflowError {
|
|
71
|
+
static fromZod(node, error) {
|
|
72
|
+
const issues = error.issues.map((issue)=>({
|
|
73
|
+
code: issue.code,
|
|
74
|
+
path: issue.path.map(String).join('.'),
|
|
75
|
+
message: issue.message
|
|
76
|
+
}));
|
|
77
|
+
const firstIssue = issues[0];
|
|
78
|
+
const path = firstIssue?.path || '<root>';
|
|
79
|
+
const message = firstIssue?.message ?? 'invalid input';
|
|
80
|
+
return new NodeInputValidationError(`Node "${node}" input validation failed at "${path}": ${message}`, {
|
|
81
|
+
node,
|
|
82
|
+
issues
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
constructor(message, details){
|
|
86
|
+
super(message, {
|
|
87
|
+
code: 'NODE_INPUT_VALIDATION_ERROR',
|
|
88
|
+
details
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
class StepTimeoutError extends WorkflowError {
|
|
93
|
+
constructor(timeoutMs, node){
|
|
94
|
+
super(node ? `Node "${node}" timed out after ${timeoutMs}ms.` : `Step timed out after ${timeoutMs}ms.`, {
|
|
95
|
+
code: 'STEP_TIMEOUT',
|
|
96
|
+
details: {
|
|
97
|
+
timeoutMs,
|
|
98
|
+
...void 0 === node ? {} : {
|
|
99
|
+
node
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}), _define_property(this, "timeoutMs", void 0), _define_property(this, "node", void 0);
|
|
103
|
+
this.timeoutMs = timeoutMs;
|
|
104
|
+
this.node = node;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
class NodeExecutionError extends WorkflowError {
|
|
108
|
+
constructor(node, cause, output){
|
|
109
|
+
const causeMessage = cause instanceof Error ? cause.message : String(cause ?? 'Unknown error');
|
|
110
|
+
super(`Node "${node}" failed: ${causeMessage}`, {
|
|
111
|
+
code: 'NODE_EXECUTION_ERROR',
|
|
112
|
+
details: {
|
|
113
|
+
node
|
|
114
|
+
},
|
|
115
|
+
cause
|
|
116
|
+
}), _define_property(this, "output", void 0), _define_property(this, "node", void 0), this.output = output;
|
|
117
|
+
this.node = node;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
class WorkflowLifecycleError extends WorkflowError {
|
|
121
|
+
constructor(message, details){
|
|
122
|
+
super(message, {
|
|
123
|
+
code: 'WORKFLOW_LIFECYCLE_ERROR',
|
|
124
|
+
details
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
class ProjectSetupError extends WorkflowError {
|
|
129
|
+
constructor(cause, details){
|
|
130
|
+
const causeMessage = cause instanceof Error ? cause.message : String(cause ?? 'Unknown error');
|
|
131
|
+
super(`Project "${details.projectName}" setup failed: ${causeMessage}`, {
|
|
132
|
+
code: 'PROJECT_SETUP_ERROR',
|
|
133
|
+
details,
|
|
134
|
+
cause
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
class ProjectTeardownError extends WorkflowError {
|
|
139
|
+
constructor(cause, details){
|
|
140
|
+
const causeMessage = cause instanceof Error ? cause.message : String(cause ?? 'Unknown error');
|
|
141
|
+
super(`Project "${details.projectName}" teardown failed: ${causeMessage}`, {
|
|
142
|
+
code: 'PROJECT_TEARDOWN_ERROR',
|
|
143
|
+
details,
|
|
144
|
+
cause
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
class NodeScopeTeardownError extends WorkflowError {
|
|
149
|
+
constructor(cause, details){
|
|
150
|
+
const causeMessage = cause instanceof Error ? cause.message : String(cause ?? 'Unknown error');
|
|
151
|
+
super(`${'case' === details.scope ? 'Case attempt' : 'Workflow document'} node teardown failed for "${details.node}": ${causeMessage}`, {
|
|
152
|
+
code: 'NODE_SCOPE_TEARDOWN_ERROR',
|
|
153
|
+
details,
|
|
154
|
+
cause
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
class FatalDeviceError extends WorkflowError {
|
|
159
|
+
constructor(message, cause){
|
|
160
|
+
super(message, {
|
|
161
|
+
code: 'FATAL_DEVICE_ERROR',
|
|
162
|
+
cause
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
const isFatalDeviceError = (error)=>{
|
|
167
|
+
if (error instanceof FatalDeviceError) return true;
|
|
168
|
+
if (error instanceof WorkflowError && 'FATAL_DEVICE_ERROR' === error.code) return true;
|
|
169
|
+
if (error instanceof Error && /device offline|device not found|(?:adb|bdc|device) connection (?:was )?closed/i.test(error.message)) return true;
|
|
170
|
+
return error instanceof Error && void 0 !== error.cause ? isFatalDeviceError(error.cause) : false;
|
|
171
|
+
};
|
|
172
|
+
class CaseExecutionError extends WorkflowError {
|
|
173
|
+
constructor(result){
|
|
174
|
+
super(`Case "${result.name}" failed.`, {
|
|
175
|
+
code: 'CASE_EXECUTION_FAILED',
|
|
176
|
+
details: {
|
|
177
|
+
caseId: result.caseId,
|
|
178
|
+
runId: result.runId
|
|
179
|
+
}
|
|
180
|
+
}), _define_property(this, "result", void 0);
|
|
181
|
+
this.result = result;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
class WorkflowDocumentExecutionError extends WorkflowError {
|
|
185
|
+
constructor(result){
|
|
186
|
+
super(`Workflow document "${result.sourcePath}" failed.`, {
|
|
187
|
+
code: 'WORKFLOW_DOCUMENT_EXECUTION_FAILED',
|
|
188
|
+
details: {
|
|
189
|
+
documentId: result.documentId,
|
|
190
|
+
documentRunId: result.documentRunId
|
|
191
|
+
}
|
|
192
|
+
}), _define_property(this, "result", void 0);
|
|
193
|
+
this.result = result;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function normalizeNodeExecutionError(error, node) {
|
|
197
|
+
return error instanceof WorkflowError ? error : new NodeExecutionError(node, error);
|
|
198
|
+
}
|
|
199
|
+
export { CaseExecutionError, DuplicateNodeError, FatalDeviceError, NodeDefinitionError, NodeExecutionError, NodeInputValidationError, NodeNotFoundError, NodeScopeTeardownError, ProjectSetupError, ProjectTeardownError, StepTimeoutError, WorkflowDocumentExecutionError, WorkflowError, WorkflowLifecycleError, WorkflowParseError, isFatalDeviceError, normalizeNodeExecutionError };
|
|
200
|
+
|
|
201
|
+
//# sourceMappingURL=errors.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-runner/errors.mjs","sources":["../../../src/test-runner/errors.ts"],"sourcesContent":["import type { z } from 'zod/v4';\n\nexport interface WorkflowErrorOptions {\n code?: string;\n details?: unknown;\n cause?: unknown;\n}\n\nexport class WorkflowError extends Error {\n readonly code: string;\n readonly details?: unknown;\n\n constructor(message: string, options: WorkflowErrorOptions = {}) {\n super(message, { cause: options.cause });\n this.name = new.target.name;\n this.code = options.code ?? 'WORKFLOW_ERROR';\n this.details = options.details;\n }\n\n toJSON(): Record<string, unknown> {\n return {\n name: this.name,\n message: this.message,\n code: this.code,\n ...(this.details === undefined ? {} : { details: this.details }),\n };\n }\n}\n\nexport class WorkflowParseError extends WorkflowError {\n constructor(message: string, details?: unknown, cause?: unknown) {\n super(message, { code: 'WORKFLOW_PARSE_ERROR', details, cause });\n }\n}\n\nexport class NodeDefinitionError extends WorkflowError {\n constructor(message: string, details?: unknown) {\n super(message, { code: 'NODE_DEFINITION_ERROR', details });\n }\n}\n\nexport class DuplicateNodeError extends WorkflowError {\n readonly node: string;\n\n constructor(node: string) {\n super(`Node \"${node}\" is already registered.`, {\n code: 'DUPLICATE_NODE',\n details: { node },\n });\n this.node = node;\n }\n}\n\nexport class NodeNotFoundError extends WorkflowError {\n readonly node: string;\n\n constructor(node: string) {\n super(`Node \"${node}\" is not registered.`, {\n code: 'NODE_NOT_FOUND',\n details: { node },\n });\n this.node = node;\n }\n}\n\nexport class NodeInputValidationError extends WorkflowError {\n constructor(message: string, details?: unknown) {\n super(message, { code: 'NODE_INPUT_VALIDATION_ERROR', details });\n }\n\n static fromZod(node: string, error: z.ZodError): NodeInputValidationError {\n const issues = error.issues.map((issue) => ({\n code: issue.code,\n path: issue.path.map(String).join('.'),\n message: issue.message,\n }));\n const firstIssue = issues[0];\n const path = firstIssue?.path || '<root>';\n const message = firstIssue?.message ?? 'invalid input';\n return new NodeInputValidationError(\n `Node \"${node}\" input validation failed at \"${path}\": ${message}`,\n { node, issues },\n );\n }\n}\n\nexport class StepTimeoutError extends WorkflowError {\n readonly timeoutMs: number;\n readonly node?: string;\n\n constructor(timeoutMs: number, node?: string) {\n super(\n node\n ? `Node \"${node}\" timed out after ${timeoutMs}ms.`\n : `Step timed out after ${timeoutMs}ms.`,\n {\n code: 'STEP_TIMEOUT',\n details: { timeoutMs, ...(node === undefined ? {} : { node }) },\n },\n );\n this.timeoutMs = timeoutMs;\n this.node = node;\n }\n}\n\nexport class NodeExecutionError extends WorkflowError {\n readonly node: string;\n\n constructor(\n node: string,\n cause: unknown,\n /** Failed actions can still produce useful, JSON-compatible diagnostic data. */\n readonly output?: import('./node/types').NodeResult,\n ) {\n const causeMessage =\n cause instanceof Error ? cause.message : String(cause ?? 'Unknown error');\n super(`Node \"${node}\" failed: ${causeMessage}`, {\n code: 'NODE_EXECUTION_ERROR',\n details: { node },\n cause,\n });\n this.node = node;\n }\n}\n\nexport class WorkflowLifecycleError extends WorkflowError {\n constructor(message: string, details?: unknown) {\n super(message, { code: 'WORKFLOW_LIFECYCLE_ERROR', details });\n }\n}\n\nexport class ProjectSetupError extends WorkflowError {\n constructor(cause: unknown, details: { projectName: string }) {\n const causeMessage =\n cause instanceof Error ? cause.message : String(cause ?? 'Unknown error');\n super(`Project \"${details.projectName}\" setup failed: ${causeMessage}`, {\n code: 'PROJECT_SETUP_ERROR',\n details,\n cause,\n });\n }\n}\n\nexport class ProjectTeardownError extends WorkflowError {\n constructor(\n cause: unknown,\n details: { projectName: string; registrationIndex: number },\n ) {\n const causeMessage =\n cause instanceof Error ? cause.message : String(cause ?? 'Unknown error');\n super(`Project \"${details.projectName}\" teardown failed: ${causeMessage}`, {\n code: 'PROJECT_TEARDOWN_ERROR',\n details,\n cause,\n });\n }\n}\n\nexport class NodeScopeTeardownError extends WorkflowError {\n constructor(\n cause: unknown,\n details: {\n scope: 'case' | 'document';\n scopeId: string;\n node: string;\n registrationIndex: number;\n },\n ) {\n const causeMessage =\n cause instanceof Error ? cause.message : String(cause ?? 'Unknown error');\n super(\n `${details.scope === 'case' ? 'Case attempt' : 'Workflow document'} node teardown failed for \"${details.node}\": ${causeMessage}`,\n { code: 'NODE_SCOPE_TEARDOWN_ERROR', details, cause },\n );\n }\n}\n\nexport class FatalDeviceError extends WorkflowError {\n constructor(message: string, cause?: unknown) {\n super(message, { code: 'FATAL_DEVICE_ERROR', cause });\n }\n}\n\nexport const isFatalDeviceError = (error: unknown): boolean => {\n if (error instanceof FatalDeviceError) return true;\n if (error instanceof WorkflowError && error.code === 'FATAL_DEVICE_ERROR') {\n return true;\n }\n if (\n error instanceof Error &&\n /device offline|device not found|(?:adb|bdc|device) connection (?:was )?closed/i.test(\n error.message,\n )\n ) {\n return true;\n }\n return error instanceof Error && error.cause !== undefined\n ? isFatalDeviceError(error.cause)\n : false;\n};\n\nexport class CaseExecutionError extends WorkflowError {\n readonly result: import('./engine/types').CaseRunResult;\n\n constructor(result: import('./engine/types').CaseRunResult) {\n super(`Case \"${result.name}\" failed.`, {\n code: 'CASE_EXECUTION_FAILED',\n details: { caseId: result.caseId, runId: result.runId },\n });\n this.result = result;\n }\n}\n\nexport class WorkflowDocumentExecutionError extends WorkflowError {\n readonly result: import('./engine/types').WorkflowDocumentRunResult;\n\n constructor(result: import('./engine/types').WorkflowDocumentRunResult) {\n super(`Workflow document \"${result.sourcePath}\" failed.`, {\n code: 'WORKFLOW_DOCUMENT_EXECUTION_FAILED',\n details: {\n documentId: result.documentId,\n documentRunId: result.documentRunId,\n },\n });\n this.result = result;\n }\n}\n\nexport function normalizeNodeExecutionError(\n error: unknown,\n node: string,\n): WorkflowError {\n return error instanceof WorkflowError\n ? error\n : new NodeExecutionError(node, error);\n}\n"],"names":["WorkflowError","Error","undefined","message","options","WorkflowParseError","details","cause","NodeDefinitionError","DuplicateNodeError","node","NodeNotFoundError","NodeInputValidationError","error","issues","issue","String","firstIssue","path","StepTimeoutError","timeoutMs","NodeExecutionError","output","causeMessage","WorkflowLifecycleError","ProjectSetupError","ProjectTeardownError","NodeScopeTeardownError","FatalDeviceError","isFatalDeviceError","CaseExecutionError","result","WorkflowDocumentExecutionError","normalizeNodeExecutionError"],"mappings":";;;;;;;;;;AAQO,MAAMA,sBAAsBC;IAWjC,SAAkC;QAChC,OAAO;YACL,MAAM,IAAI,CAAC,IAAI;YACf,SAAS,IAAI,CAAC,OAAO;YACrB,MAAM,IAAI,CAAC,IAAI;YACf,GAAI,AAAiBC,WAAjB,IAAI,CAAC,OAAO,GAAiB,CAAC,IAAI;gBAAE,SAAS,IAAI,CAAC,OAAO;YAAC,CAAC;QACjE;IACF;IAdA,YAAYC,OAAe,EAAEC,UAAgC,CAAC,CAAC,CAAE;QAC/D,KAAK,CAACD,SAAS;YAAE,OAAOC,QAAQ,KAAK;QAAC,IAJxC,uBAAS,QAAT,SACA,uBAAS,WAAT;QAIE,IAAI,CAAC,IAAI,GAAG,WAAW,IAAI;QAC3B,IAAI,CAAC,IAAI,GAAGA,QAAQ,IAAI,IAAI;QAC5B,IAAI,CAAC,OAAO,GAAGA,QAAQ,OAAO;IAChC;AAUF;AAEO,MAAMC,2BAA2BL;IACtC,YAAYG,OAAe,EAAEG,OAAiB,EAAEC,KAAe,CAAE;QAC/D,KAAK,CAACJ,SAAS;YAAE,MAAM;YAAwBG;YAASC;QAAM;IAChE;AACF;A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O,UAAU,CAAC,SAAS,CAAC,EAAE;YACxD,MAAM;YACN,SAAS;gBACP,YAAYA,OAAO,UAAU;gBAC7B,eAAeA,OAAO,aAAa;YACrC;QACF,IATF,uBAAS,UAAT;QAUE,IAAI,CAAC,MAAM,GAAGA;IAChB;AACF;AAEO,SAASE,4BACdpB,KAAc,EACdH,IAAY;IAEZ,OAAOG,iBAAiBb,gBACpBa,QACA,IAAIQ,mBAAmBX,MAAMG;AACnC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
function executionRecordToResult(record) {
|
|
2
|
+
const execution = record.execution?.document;
|
|
3
|
+
const hostErrors = [
|
|
4
|
+
...execution?.hostErrors ?? []
|
|
5
|
+
];
|
|
6
|
+
const add = (phase, error)=>{
|
|
7
|
+
if (void 0 !== error) hostErrors.push({
|
|
8
|
+
phase,
|
|
9
|
+
error
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
add('setup', record.setupError);
|
|
13
|
+
add('execution', record.executionError);
|
|
14
|
+
for (const error of record.cleanupErrors)add('cleanup', error);
|
|
15
|
+
add('report', record.reportError);
|
|
16
|
+
for (const error of record.publicationErrors ?? [])add('publication', error);
|
|
17
|
+
for (const error of record.observerErrors ?? [])add('observer', error);
|
|
18
|
+
const projectName = record.projectName ?? execution?.projectName ?? record.platform;
|
|
19
|
+
return {
|
|
20
|
+
document: {
|
|
21
|
+
documentId: record.document.documentId,
|
|
22
|
+
documentRunId: record.runId,
|
|
23
|
+
attemptIndex: record.attemptIndex,
|
|
24
|
+
projectId: record.document.projectId,
|
|
25
|
+
projectName,
|
|
26
|
+
sourcePath: record.sourcePath,
|
|
27
|
+
status: hostErrors.length || execution?.status === 'failed' ? 'failed' : 'success',
|
|
28
|
+
startedAt: record.startedAt,
|
|
29
|
+
endedAt: record.endedAt,
|
|
30
|
+
durationMs: record.durationMs,
|
|
31
|
+
beforeAll: execution?.beforeAll ?? [],
|
|
32
|
+
afterAll: execution?.afterAll ?? [],
|
|
33
|
+
...hostErrors.length ? {
|
|
34
|
+
hostErrors
|
|
35
|
+
} : {},
|
|
36
|
+
...execution?.executionErrors?.length ? {
|
|
37
|
+
executionErrors: execution.executionErrors
|
|
38
|
+
} : {},
|
|
39
|
+
...execution?.teardownErrors?.length ? {
|
|
40
|
+
teardownErrors: execution.teardownErrors
|
|
41
|
+
} : {},
|
|
42
|
+
reportScopeId: execution?.reportScopeId ?? record.runId,
|
|
43
|
+
reportPaths: [
|
|
44
|
+
...record.reportPaths
|
|
45
|
+
],
|
|
46
|
+
...record.reportSources?.length ? {
|
|
47
|
+
reportSources: [
|
|
48
|
+
...record.reportSources
|
|
49
|
+
]
|
|
50
|
+
} : {}
|
|
51
|
+
},
|
|
52
|
+
cases: record.execution?.cases ?? record.document.cases.map((item)=>({
|
|
53
|
+
caseId: item.caseId,
|
|
54
|
+
projectName,
|
|
55
|
+
name: item.definition.name,
|
|
56
|
+
sourcePath: item.sourcePath,
|
|
57
|
+
caseIndex: item.caseIndex,
|
|
58
|
+
status: 'not-run',
|
|
59
|
+
notRunReason: 'document-start-failed'
|
|
60
|
+
}))
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function serializeWorkflowExecutionRecord(record) {
|
|
64
|
+
return serializeWorkflowValue(record);
|
|
65
|
+
}
|
|
66
|
+
function serializeWorkflowValue(value) {
|
|
67
|
+
return JSON.stringify(value, (_key, value)=>value instanceof Error ? {
|
|
68
|
+
name: value.name,
|
|
69
|
+
message: value.message,
|
|
70
|
+
...'code' in value ? {
|
|
71
|
+
code: value.code
|
|
72
|
+
} : {},
|
|
73
|
+
...'details' in value ? {
|
|
74
|
+
details: value.details
|
|
75
|
+
} : {},
|
|
76
|
+
...value instanceof AggregateError ? {
|
|
77
|
+
errors: value.errors
|
|
78
|
+
} : {}
|
|
79
|
+
} : value, 2);
|
|
80
|
+
}
|
|
81
|
+
export { executionRecordToResult, serializeWorkflowExecutionRecord, serializeWorkflowValue };
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=execution-record.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-runner/execution-record.mjs","sources":["../../../src/test-runner/execution-record.ts"],"sourcesContent":["import type {\n WorkflowDocumentExecutionResult,\n WorkflowHostError,\n WorkflowReportSource,\n} from './engine/types';\nimport type { CollectedWorkflowDocument } from './parser/types';\n\n/**\n * One complete document invocation, including work outside the pure kernel.\n * The entry adapter owns resources and records their lifecycle here. A failed\n * setup has a record even though no document could be executed.\n *\n * runId identifies this invocation, not an Agent/report resource. File retries\n * create new records; they do not become per-Case retries. Report projection\n * must not mutate these records or redact the original API output.\n */\nexport interface WorkflowExecutionRecord {\n readonly runId: string;\n readonly attemptIndex: number;\n readonly sourcePath: string;\n readonly platform: string;\n readonly projectName?: string;\n readonly document: CollectedWorkflowDocument;\n readonly status: 'success' | 'failed';\n readonly startedAt: string;\n readonly endedAt: string;\n readonly durationMs: number;\n readonly execution?: WorkflowDocumentExecutionResult;\n readonly setupError?: unknown;\n readonly executionError?: unknown;\n readonly cleanupErrors: readonly unknown[];\n readonly outputs: Readonly<Record<string, unknown>>;\n readonly reportPaths: readonly string[];\n readonly reportSources?: readonly WorkflowReportSource[];\n readonly children?: readonly WorkflowExecutionRecord[];\n readonly reportError?: unknown;\n /** Entry-owned report copies or result files failed after execution finished. */\n readonly publicationErrors?: readonly unknown[];\n /** Entry progress/result observers failed, independently of action outcomes. */\n readonly observerErrors?: readonly unknown[];\n}\n\n/** Complete host facts as a kernel result. Report and summary consume this view. */\nexport function executionRecordToResult(\n record: WorkflowExecutionRecord,\n): WorkflowDocumentExecutionResult {\n const execution = record.execution?.document;\n const hostErrors: WorkflowHostError[] = [...(execution?.hostErrors ?? [])];\n const add = (phase: WorkflowHostError['phase'], error: unknown) => {\n if (error !== undefined) hostErrors.push({ phase, error });\n };\n add('setup', record.setupError);\n add('execution', record.executionError);\n for (const error of record.cleanupErrors) add('cleanup', error);\n add('report', record.reportError);\n for (const error of record.publicationErrors ?? []) add('publication', error);\n for (const error of record.observerErrors ?? []) add('observer', error);\n const projectName =\n record.projectName ?? execution?.projectName ?? record.platform;\n return {\n document: {\n documentId: record.document.documentId,\n documentRunId: record.runId,\n attemptIndex: record.attemptIndex,\n projectId: record.document.projectId,\n projectName,\n sourcePath: record.sourcePath,\n // Case failures are counted separately; host failures must not convert\n // successful Cases into retryable action failures.\n status:\n hostErrors.length || execution?.status === 'failed'\n ? 'failed'\n : 'success',\n startedAt: record.startedAt,\n endedAt: record.endedAt,\n durationMs: record.durationMs,\n beforeAll: execution?.beforeAll ?? [],\n afterAll: execution?.afterAll ?? [],\n ...(hostErrors.length ? { hostErrors } : {}),\n ...(execution?.executionErrors?.length\n ? { executionErrors: execution.executionErrors }\n : {}),\n ...(execution?.teardownErrors?.length\n ? { teardownErrors: execution.teardownErrors }\n : {}),\n reportScopeId: execution?.reportScopeId ?? record.runId,\n reportPaths: [...record.reportPaths],\n ...(record.reportSources?.length\n ? { reportSources: [...record.reportSources] }\n : {}),\n },\n cases:\n record.execution?.cases ??\n record.document.cases.map((item) => ({\n caseId: item.caseId,\n projectName,\n name: item.definition.name,\n sourcePath: item.sourcePath,\n caseIndex: item.caseIndex,\n status: 'not-run' as const,\n notRunReason: 'document-start-failed' as const,\n })),\n };\n}\n\n/** Persist execution facts across workers without dropping native Error fields. */\nexport function serializeWorkflowExecutionRecord(\n record: WorkflowExecutionRecord,\n): string {\n return serializeWorkflowValue(record);\n}\n\n/** The same error-preserving encoding for entry results and worker envelopes. */\nexport function serializeWorkflowValue(value: unknown): string {\n return JSON.stringify(\n value,\n (_key, value) =>\n value instanceof Error\n ? {\n name: value.name,\n message: value.message,\n ...('code' in value ? { code: value.code } : {}),\n ...('details' in value ? { details: value.details } : {}),\n ...(value instanceof AggregateError\n ? { errors: value.errors }\n : {}),\n }\n : value,\n 2,\n );\n}\n"],"names":["executionRecordToResult","record","execution","hostErrors","add","phase","error","undefined","projectName","item","serializeWorkflowExecutionRecord","serializeWorkflowValue","value","JSON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;YACN,eAAeA,WAAW,iBAAiBD,OAAO,KAAK;YACvD,aAAa;mBAAIA,OAAO,WAAW;aAAC;YACpC,GAAIA,OAAO,aAAa,EAAE,SACtB;gBAAE,eAAe;uBAAIA,OAAO,aAAa;iBAAC;YAAC,IAC3C,CAAC,CAAC;QACR;QACA,OACEA,OAAO,SAAS,EAAE,SAClBA,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAACQ,OAAU;gBACnC,QAAQA,KAAK,MAAM;gBACnBD;gBACA,MAAMC,KAAK,UAAU,CAAC,IAAI;gBAC1B,YAAYA,KAAK,UAAU;gBAC3B,WAAWA,KAAK,SAAS;gBACzB,QAAQ;gBACR,cAAc;YAChB;IACJ;AACF;AAGO,SAASC,iCACdT,MAA+B;IAE/B,OAAOU,uBAAuBV;AAChC;AAGO,SAASU,uBAAuBC,KAAc;IACnD,OAAOC,KAAK,SAAS,CACnBD,OACA,CAACE,MAAMF,QACLA,iBAAiBG,QACb;YACE,MAAMH,MAAM,IAAI;YAChB,SAASA,MAAM,OAAO;YACtB,GAAI,UAAUA,QAAQ;gBAAE,MAAMA,MAAM,IAAI;YAAC,IAAI,CAAC,CAAC;YAC/C,GAAI,aAAaA,QAAQ;gBAAE,SAASA,MAAM,OAAO;YAAC,IAAI,CAAC,CAAC;YACxD,GAAIA,iBAAiBI,iBACjB;gBAAE,QAAQJ,MAAM,MAAM;YAAC,IACvB,CAAC,CAAC;QACR,IACAA,OACN;AAEJ"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./engine/index.mjs";
|
|
2
|
+
export * from "./errors.mjs";
|
|
3
|
+
export * from "./execution-record.mjs";
|
|
4
|
+
export * from "./node/index.mjs";
|
|
5
|
+
export * from "./parser/normalize.mjs";
|
|
6
|
+
export * from "./parser/document-format.mjs";
|
|
7
|
+
export * from "./parser/types.mjs";
|
|
8
|
+
export * from "./project.mjs";
|
|
9
|
+
export * from "./reporting/types.mjs";
|
|
10
|
+
export * from "./reporting/sanitize.mjs";
|
|
11
|
+
export * from "./reporting/test-run-report.mjs";
|
|
12
|
+
export * from "./reporting/execution-record.mjs";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from "zod/v4";
|
|
2
|
+
import { NodeDefinitionError } from "../errors.mjs";
|
|
3
|
+
const validateOptionalText = (value, field, node)=>{
|
|
4
|
+
if (void 0 !== value && ('string' != typeof value || 0 === value.trim().length)) throw new NodeDefinitionError(`Node "${node}" ${field} must be a non-empty string.`, {
|
|
5
|
+
node,
|
|
6
|
+
field
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
const validateInputSchema = (schema, node)=>{
|
|
10
|
+
if (void 0 === schema) return;
|
|
11
|
+
if (!(schema instanceof z.ZodObject)) throw new NodeDefinitionError(`Node "${node}" inputSchema must be a Zod object schema.`, {
|
|
12
|
+
node,
|
|
13
|
+
field: 'inputSchema'
|
|
14
|
+
});
|
|
15
|
+
if ('$' in schema.shape) throw new NodeDefinitionError(`Node "${node}" inputSchema must not declare "$" as an input property.`, {
|
|
16
|
+
node,
|
|
17
|
+
field: 'inputSchema.$'
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
const validateDefinition = (options)=>{
|
|
21
|
+
if (!options || 'object' != typeof options) throw new NodeDefinitionError('Node definition must be an object.');
|
|
22
|
+
if ('string' != typeof options.name || 0 === options.name.trim().length) throw new NodeDefinitionError('Node name must be a non-empty string.');
|
|
23
|
+
validateOptionalText(options.title, 'title', options.name);
|
|
24
|
+
validateOptionalText(options.description, "description", options.name);
|
|
25
|
+
if (void 0 !== options.stringInputKey && false !== options.stringInputKey && ('string' != typeof options.stringInputKey || 0 === options.stringInputKey.trim().length)) throw new NodeDefinitionError(`Node "${options.name}" stringInputKey must be a non-empty string or false.`, {
|
|
26
|
+
node: options.name,
|
|
27
|
+
field: 'stringInputKey'
|
|
28
|
+
});
|
|
29
|
+
validateInputSchema(options.inputSchema, options.name);
|
|
30
|
+
if ('string' == typeof options.stringInputKey && options.inputSchema instanceof z.ZodObject && !(options.stringInputKey in options.inputSchema.shape)) throw new NodeDefinitionError(`Node "${options.name}" stringInputKey must reference a field in inputSchema.`, {
|
|
31
|
+
node: options.name,
|
|
32
|
+
field: 'stringInputKey'
|
|
33
|
+
});
|
|
34
|
+
if ('function' != typeof options.execute) throw new NodeDefinitionError(`Node "${options.name}" must provide an execute function.`, {
|
|
35
|
+
node: options.name
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
function defineNode(options) {
|
|
39
|
+
validateDefinition(options);
|
|
40
|
+
return options;
|
|
41
|
+
}
|
|
42
|
+
export { defineNode };
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=define-node.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-runner/node/define-node.mjs","sources":["../../../../src/test-runner/node/define-node.ts"],"sourcesContent":["import { z } from 'zod/v4';\nimport { NodeDefinitionError } from '../errors';\nimport type {\n DefineNodeOptions,\n DefineNodeWithSchemaOptions,\n NodeDefinition,\n NodeDefinitionWithSchema,\n NodeInputSchema,\n} from './types';\n\nconst validateOptionalText = (\n value: unknown,\n field: 'title' | 'description',\n node: string,\n): void => {\n if (\n value !== undefined &&\n (typeof value !== 'string' || value.trim().length === 0)\n ) {\n throw new NodeDefinitionError(\n `Node \"${node}\" ${field} must be a non-empty string.`,\n { node, field },\n );\n }\n};\n\nconst validateInputSchema = (schema: unknown, node: string): void => {\n if (schema === undefined) return;\n if (!(schema instanceof z.ZodObject)) {\n throw new NodeDefinitionError(\n `Node \"${node}\" inputSchema must be a Zod object schema.`,\n { node, field: 'inputSchema' },\n );\n }\n if ('$' in schema.shape) {\n throw new NodeDefinitionError(\n `Node \"${node}\" inputSchema must not declare \"$\" as an input property.`,\n { node, field: 'inputSchema.$' },\n );\n }\n};\n\nconst validateDefinition = (options: {\n name: string;\n title?: unknown;\n description?: unknown;\n stringInputKey?: unknown;\n inputSchema?: unknown;\n execute: unknown;\n}): void => {\n if (!options || typeof options !== 'object') {\n throw new NodeDefinitionError('Node definition must be an object.');\n }\n\n if (typeof options.name !== 'string' || options.name.trim().length === 0) {\n throw new NodeDefinitionError('Node name must be a non-empty string.');\n }\n\n validateOptionalText(options.title, 'title', options.name);\n validateOptionalText(options.description, 'description', options.name);\n if (\n options.stringInputKey !== undefined &&\n options.stringInputKey !== false &&\n (typeof options.stringInputKey !== 'string' ||\n options.stringInputKey.trim().length === 0)\n ) {\n throw new NodeDefinitionError(\n `Node \"${options.name}\" stringInputKey must be a non-empty string or false.`,\n { node: options.name, field: 'stringInputKey' },\n );\n }\n validateInputSchema(options.inputSchema, options.name);\n\n if (\n typeof options.stringInputKey === 'string' &&\n options.inputSchema instanceof z.ZodObject &&\n !(options.stringInputKey in options.inputSchema.shape)\n ) {\n throw new NodeDefinitionError(\n `Node \"${options.name}\" stringInputKey must reference a field in inputSchema.`,\n { node: options.name, field: 'stringInputKey' },\n );\n }\n\n if (typeof options.execute !== 'function') {\n throw new NodeDefinitionError(\n `Node \"${options.name}\" must provide an execute function.`,\n { node: options.name },\n );\n }\n};\n\nexport function defineNode<\n TSchema extends NodeInputSchema,\n TData = unknown,\n TContext = unknown,\n>(\n options: DefineNodeWithSchemaOptions<TSchema, TData, TContext>,\n): NodeDefinitionWithSchema<TSchema, TData, TContext>;\n\nexport function defineNode<\n TInput = unknown,\n TData = unknown,\n TContext = unknown,\n>(\n options: DefineNodeOptions<TInput, TData, TContext>,\n): NodeDefinition<TInput, TData, TContext>;\n\nexport function defineNode(\n options: DefineNodeOptions<any, any, any>,\n): NodeDefinition<any, any, any> {\n validateDefinition(options);\n return options;\n}\n"],"names":["validateOptionalText","value","field","node","undefined","NodeDefinitionError","validateInputSchema","schema","z","validateDefinition","options","defineNode"],"mappings":";;AAUA,MAAMA,uBAAuB,CAC3BC,OACAC,OACAC;IAEA,IACEF,AAAUG,WAAVH,SACC,CAAiB,YAAjB,OAAOA,SAAsBA,AAAwB,MAAxBA,MAAM,IAAI,GAAG,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lC,OAAOA,QAAQ,cAAc,IAC7BA,QAAQ,WAAW,YAAYF,EAAE,SAAS,IAC1C,CAAEE,CAAAA,QAAQ,cAAc,IAAIA,QAAQ,WAAW,CAAC,KAAI,GAEpD,MAAM,IAAIL,oBACR,CAAC,MAAM,EAAEK,QAAQ,IAAI,CAAC,uDAAuD,CAAC,EAC9E;QAAE,MAAMA,QAAQ,IAAI;QAAE,OAAO;IAAiB;IAIlD,IAAI,AAA2B,cAA3B,OAAOA,QAAQ,OAAO,EACxB,MAAM,IAAIL,oBACR,CAAC,MAAM,EAAEK,QAAQ,IAAI,CAAC,mCAAmC,CAAC,EAC1D;QAAE,MAAMA,QAAQ,IAAI;IAAC;AAG3B;AAkBO,SAASC,WACdD,OAAyC;IAEzCD,mBAAmBC;IACnB,OAAOA;AACT"}
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const nativeWorkflowRootKeys = [
|
|
2
|
+
'beforeAll',
|
|
3
|
+
'beforeEach',
|
|
4
|
+
'cases',
|
|
5
|
+
'afterEach',
|
|
6
|
+
'afterAll'
|
|
7
|
+
];
|
|
8
|
+
const isMapping = (value)=>'object' == typeof value && null !== value && !Array.isArray(value);
|
|
9
|
+
const classifyWorkflowDocumentFormat = (value)=>{
|
|
10
|
+
if (!isMapping(value)) return 'unknown';
|
|
11
|
+
const hasLegacyRoot = Object.hasOwn(value, 'tasks');
|
|
12
|
+
const hasNativeRoot = nativeWorkflowRootKeys.some((key)=>Object.hasOwn(value, key));
|
|
13
|
+
if (hasLegacyRoot && hasNativeRoot) return 'mixed';
|
|
14
|
+
if (hasLegacyRoot) return 'legacy';
|
|
15
|
+
if (hasNativeRoot) return 'native';
|
|
16
|
+
if (Array.isArray(value.files)) return 'legacy-batch';
|
|
17
|
+
return 'unknown';
|
|
18
|
+
};
|
|
19
|
+
export { classifyWorkflowDocumentFormat, nativeWorkflowRootKeys };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=document-format.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-runner/parser/document-format.mjs","sources":["../../../../src/test-runner/parser/document-format.ts"],"sourcesContent":["export const nativeWorkflowRootKeys = [\n 'beforeAll',\n 'beforeEach',\n 'cases',\n 'afterEach',\n 'afterAll',\n] as const;\n\nexport type WorkflowDocumentFormat =\n | 'legacy'\n | 'legacy-batch'\n | 'native'\n | 'mixed'\n | 'unknown';\n\nconst isMapping = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\n/**\n * Classify only the document envelope. Parsing and schema validation remain\n * owned by the selected command so this helper can never route execution.\n */\nexport const classifyWorkflowDocumentFormat = (\n value: unknown,\n): WorkflowDocumentFormat => {\n if (!isMapping(value)) return 'unknown';\n\n const hasLegacyRoot = Object.hasOwn(value, 'tasks');\n const hasNativeRoot = nativeWorkflowRootKeys.some((key) =>\n Object.hasOwn(value, key),\n );\n\n if (hasLegacyRoot && hasNativeRoot) return 'mixed';\n if (hasLegacyRoot) return 'legacy';\n if (hasNativeRoot) return 'native';\n if (Array.isArray(value.files)) return 'legacy-batch';\n return 'unknown';\n};\n"],"names":["nativeWorkflowRootKeys","isMapping","value","Array","classifyWorkflowDocumentFormat","hasLegacyRoot","Object","hasNativeRoot","key"],"mappings":"AAAO,MAAMA,yBAAyB;IACpC;IACA;IACA;IACA;IACA;CACD;AASD,MAAMC,YAAY,CAACC,QACjB,AAAiB,YAAjB,OAAOA,SAAsBA,AAAU,SAAVA,SAAkB,CAACC,MAAM,OAAO,CAACD;AAMzD,MAAME,iCAAiC,CAC5CF;IAEA,IAAI,CAACD,UAAUC,QAAQ,OAAO;IAE9B,MAAMG,gBAAgBC,OAAO,MAAM,CAACJ,OAAO;IAC3C,MAAMK,gBAAgBP,uBAAuB,IAAI,CAAC,CAACQ,MACjDF,OAAO,MAAM,CAACJ,OAAOM;IAGvB,IAAIH,iBAAiBE,eAAe,OAAO;IAC3C,IAAIF,eAAe,OAAO;IAC1B,IAAIE,eAAe,OAAO;IAC1B,IAAIJ,MAAM,OAAO,CAACD,MAAM,KAAK,GAAG,OAAO;IACvC,OAAO;AACT"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { WorkflowParseError } from "../errors.mjs";
|
|
2
|
+
const supportedMetaKeys = new Set([
|
|
3
|
+
'timeout',
|
|
4
|
+
'continue-on-error'
|
|
5
|
+
]);
|
|
6
|
+
function isMapping(value) {
|
|
7
|
+
return 'object' == typeof value && null !== value && !Array.isArray(value) && (Object.getPrototypeOf(value) === Object.prototype || null === Object.getPrototypeOf(value));
|
|
8
|
+
}
|
|
9
|
+
function formatStep(index) {
|
|
10
|
+
return `step ${index + 1}`;
|
|
11
|
+
}
|
|
12
|
+
function normalizeMeta(value, index) {
|
|
13
|
+
if (void 0 === value) return {
|
|
14
|
+
continueOnError: false
|
|
15
|
+
};
|
|
16
|
+
if (!isMapping(value)) throw new WorkflowParseError(`${formatStep(index)} "$" must be a mapping.`, {
|
|
17
|
+
index
|
|
18
|
+
});
|
|
19
|
+
for (const key of Object.keys(value))if (!supportedMetaKeys.has(key)) throw new WorkflowParseError(`${formatStep(index)} has unsupported engine metadata "${key}".`, {
|
|
20
|
+
index,
|
|
21
|
+
key
|
|
22
|
+
});
|
|
23
|
+
const timeout = value.timeout;
|
|
24
|
+
if (void 0 !== timeout && ('number' != typeof timeout || !Number.isFinite(timeout) || timeout <= 0)) throw new WorkflowParseError(`${formatStep(index)} "$.timeout" must be a positive number of milliseconds.`, {
|
|
25
|
+
index,
|
|
26
|
+
timeout
|
|
27
|
+
});
|
|
28
|
+
const continueOnError = value['continue-on-error'];
|
|
29
|
+
if (void 0 !== continueOnError && 'boolean' != typeof continueOnError) throw new WorkflowParseError(`${formatStep(index)} "$.continue-on-error" must be a boolean.`, {
|
|
30
|
+
index,
|
|
31
|
+
continueOnError
|
|
32
|
+
});
|
|
33
|
+
return {
|
|
34
|
+
...void 0 === timeout ? {} : {
|
|
35
|
+
timeoutMs: timeout
|
|
36
|
+
},
|
|
37
|
+
continueOnError: continueOnError ?? false
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function normalizeStep(value, index = 0, resolveNode) {
|
|
41
|
+
if (!isMapping(value)) throw new WorkflowParseError(`${formatStep(index)} must be a mapping.`, {
|
|
42
|
+
index
|
|
43
|
+
});
|
|
44
|
+
const entries = Object.entries(value);
|
|
45
|
+
if (1 !== entries.length) throw new WorkflowParseError(`${formatStep(index)} must contain exactly one node.`, {
|
|
46
|
+
index,
|
|
47
|
+
nodes: Object.keys(value)
|
|
48
|
+
});
|
|
49
|
+
const [node, rawValue] = entries[0];
|
|
50
|
+
if (0 === node.trim().length) throw new WorkflowParseError(`${formatStep(index)} node name must not be empty.`, {
|
|
51
|
+
index
|
|
52
|
+
});
|
|
53
|
+
if ('string' == typeof rawValue) {
|
|
54
|
+
const resolvedNode = resolveNode?.(node);
|
|
55
|
+
const stringInputKey = resolvedNode ? resolvedNode.stringInputKey : 'prompt';
|
|
56
|
+
if (false === stringInputKey || void 0 === stringInputKey) throw new WorkflowParseError(`${formatStep(index)} node "${node}" does not accept string shorthand.`, {
|
|
57
|
+
index,
|
|
58
|
+
node
|
|
59
|
+
});
|
|
60
|
+
return {
|
|
61
|
+
node,
|
|
62
|
+
input: {
|
|
63
|
+
[stringInputKey]: rawValue
|
|
64
|
+
},
|
|
65
|
+
meta: {
|
|
66
|
+
continueOnError: false
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
if (!isMapping(rawValue)) throw new WorkflowParseError(`${formatStep(index)} value must be a string shorthand or a mapping.`, {
|
|
71
|
+
index,
|
|
72
|
+
node
|
|
73
|
+
});
|
|
74
|
+
const { $: rawMeta, ...input } = rawValue;
|
|
75
|
+
return {
|
|
76
|
+
node,
|
|
77
|
+
input,
|
|
78
|
+
meta: normalizeMeta(rawMeta, index)
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function normalizeSteps(steps, resolveNode) {
|
|
82
|
+
if (!Array.isArray(steps)) throw new WorkflowParseError('Steps must be an array.');
|
|
83
|
+
return steps.map((step, index)=>normalizeStep(step, index, resolveNode));
|
|
84
|
+
}
|
|
85
|
+
export { normalizeStep, normalizeSteps };
|
|
86
|
+
|
|
87
|
+
//# sourceMappingURL=normalize.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-runner/parser/normalize.mjs","sources":["../../../../src/test-runner/parser/normalize.ts"],"sourcesContent":["import { WorkflowParseError } from '../errors';\nimport type { NormalizedStep, NormalizedStepMeta } from './types';\n\ninterface StringInputNodeDefinition {\n stringInputKey?: string | false;\n}\n\nexport type ResolveNodeForNormalization = (\n name: string,\n) => StringInputNodeDefinition | undefined;\n\nconst supportedMetaKeys = new Set(['timeout', 'continue-on-error']);\n\nfunction isMapping(value: unknown): value is Record<string, unknown> {\n return (\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n (Object.getPrototypeOf(value) === Object.prototype ||\n Object.getPrototypeOf(value) === null)\n );\n}\n\nfunction formatStep(index: number): string {\n return `step ${index + 1}`;\n}\n\nfunction normalizeMeta(value: unknown, index: number): NormalizedStepMeta {\n if (value === undefined) {\n return { continueOnError: false };\n }\n\n if (!isMapping(value)) {\n throw new WorkflowParseError(\n `${formatStep(index)} \"$\" must be a mapping.`,\n { index },\n );\n }\n\n for (const key of Object.keys(value)) {\n if (!supportedMetaKeys.has(key)) {\n throw new WorkflowParseError(\n `${formatStep(index)} has unsupported engine metadata \"${key}\".`,\n { index, key },\n );\n }\n }\n\n const timeout = value.timeout;\n if (\n timeout !== undefined &&\n (typeof timeout !== 'number' || !Number.isFinite(timeout) || timeout <= 0)\n ) {\n throw new WorkflowParseError(\n `${formatStep(index)} \"$.timeout\" must be a positive number of milliseconds.`,\n { index, timeout },\n );\n }\n\n const continueOnError = value['continue-on-error'];\n if (continueOnError !== undefined && typeof continueOnError !== 'boolean') {\n throw new WorkflowParseError(\n `${formatStep(index)} \"$.continue-on-error\" must be a boolean.`,\n { index, continueOnError },\n );\n }\n\n return {\n ...(timeout === undefined ? {} : { timeoutMs: timeout }),\n continueOnError: continueOnError ?? false,\n };\n}\n\nexport function normalizeStep(\n value: unknown,\n index = 0,\n resolveNode?: ResolveNodeForNormalization,\n): NormalizedStep {\n if (!isMapping(value)) {\n throw new WorkflowParseError(`${formatStep(index)} must be a mapping.`, {\n index,\n });\n }\n\n const entries = Object.entries(value);\n if (entries.length !== 1) {\n throw new WorkflowParseError(\n `${formatStep(index)} must contain exactly one node.`,\n { index, nodes: Object.keys(value) },\n );\n }\n\n const [node, rawValue] = entries[0];\n if (node.trim().length === 0) {\n throw new WorkflowParseError(\n `${formatStep(index)} node name must not be empty.`,\n { index },\n );\n }\n\n if (typeof rawValue === 'string') {\n const resolvedNode = resolveNode?.(node);\n const stringInputKey = resolvedNode\n ? resolvedNode.stringInputKey\n : 'prompt';\n if (stringInputKey === false || stringInputKey === undefined) {\n throw new WorkflowParseError(\n `${formatStep(index)} node \"${node}\" does not accept string shorthand.`,\n { index, node },\n );\n }\n return {\n node,\n input: { [stringInputKey]: rawValue },\n meta: { continueOnError: false },\n };\n }\n\n if (!isMapping(rawValue)) {\n throw new WorkflowParseError(\n `${formatStep(index)} value must be a string shorthand or a mapping.`,\n { index, node },\n );\n }\n\n const { $: rawMeta, ...input } = rawValue;\n\n return {\n node,\n input,\n meta: normalizeMeta(rawMeta, index),\n };\n}\n\nexport function normalizeSteps(\n steps: unknown,\n resolveNode?: ResolveNodeForNormalization,\n): NormalizedStep[] {\n if (!Array.isArray(steps)) {\n throw new WorkflowParseError('Steps must be an array.');\n }\n return steps.map((step, index) => normalizeStep(step, index, resolveNode));\n}\n"],"names":["supportedMetaKeys","Set","isMapping","value","Array","Object","formatStep","index","normalizeMeta","undefined","WorkflowParseError","key","timeout","Number","continueOnError","normalizeStep","resolveNode","entries","node","rawValue","resolvedNode","stringInputKey","rawMeta","input","normalizeSteps","steps","step"],"mappings":";AAWA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ASiB,eACdC,KAAc,EACdT,WAAyC;IAEzC,IAAI,CAACZ,MAAM,OAAO,CAACqB,QACjB,MAAM,IAAIf,mBAAmB;IAE/B,OAAOe,MAAM,GAAG,CAAC,CAACC,MAAMnB,QAAUQ,cAAcW,MAAMnB,OAAOS;AAC/D"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { collectReportSummary } from "../../report-stats.mjs";
|
|
2
|
+
import { buildTestRunReportDump } from "./test-run-report.mjs";
|
|
3
|
+
function buildAgentTestRunReportDump(input, agentDump, source) {
|
|
4
|
+
const summary = collectReportSummary(agentDump);
|
|
5
|
+
return buildTestRunReportDump(input, {
|
|
6
|
+
sources: agentDump.executions.length ? [
|
|
7
|
+
{
|
|
8
|
+
...source,
|
|
9
|
+
executionIds: agentDump.executions.flatMap((execution)=>execution.id ? [
|
|
10
|
+
execution.id
|
|
11
|
+
] : [])
|
|
12
|
+
}
|
|
13
|
+
] : [],
|
|
14
|
+
metrics: {
|
|
15
|
+
modelCallCount: summary.timing.modelCallCount,
|
|
16
|
+
modelTimeMs: summary.timing.modelCallTimeMs,
|
|
17
|
+
...summary.tokens
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export { buildAgentTestRunReportDump };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=agent-report.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-runner/reporting/agent-report.mjs","sources":["../../../../src/test-runner/reporting/agent-report.ts"],"sourcesContent":["import { collectReportSummary } from '../../report-stats';\nimport type { TestRunReportDump } from '../../test-run-report';\nimport type { ReportActionDump } from '../../types';\nimport { buildTestRunReportDump } from './test-run-report';\nimport type { RunReportInput } from './types';\n\nexport function buildAgentTestRunReportDump(\n input: RunReportInput,\n agentDump: ReportActionDump,\n source: { scopeId: string; reportId: string; sourcePath: string },\n): TestRunReportDump {\n const summary = collectReportSummary(agentDump);\n return buildTestRunReportDump(input, {\n sources: agentDump.executions.length\n ? [\n {\n ...source,\n executionIds: agentDump.executions.flatMap((execution) =>\n execution.id ? [execution.id] : [],\n ),\n },\n ]\n : [],\n metrics: {\n modelCallCount: summary.timing.modelCallCount,\n modelTimeMs: summary.timing.modelCallTimeMs,\n ...summary.tokens,\n },\n });\n}\n"],"names":["buildAgentTestRunReportDump","input","agentDump","source","summary","collectReportSummary","buildTestRunReportDump","execution"],"mappings":";;AAMO,SAASA,4BACdC,KAAqB,EACrBC,SAA2B,EAC3BC,MAAiE;IAEjE,MAAMC,UAAUC,qBAAqBH;IACrC,OAAOI,uBAAuBL,OAAO;QACnC,SAASC,UAAU,UAAU,CAAC,MAAM,GAChC;YACE;gBACE,GAAGC,MAAM;gBACT,cAAcD,UAAU,UAAU,CAAC,OAAO,CAAC,CAACK,YAC1CA,UAAU,EAAE,GAAG;wBAACA,UAAU,EAAE;qBAAC,GAAG,EAAE;YAEtC;SACD,GACD,EAAE;QACN,SAAS;YACP,gBAAgBH,QAAQ,MAAM,CAAC,cAAc;YAC7C,aAAaA,QAAQ,MAAM,CAAC,eAAe;YAC3C,GAAGA,QAAQ,MAAM;QACnB;IACF;AACF"}
|