@nodetool-ai/cli 0.7.0-rc.23 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -0
- package/dist/.nodetool-build-stamp +1 -0
- package/dist/ExecutionTree.d.ts +2 -1
- package/dist/ExecutionTree.d.ts.map +1 -1
- package/dist/ExecutionTree.js +1 -1
- package/dist/ExecutionTree.js.map +1 -1
- package/dist/affected/affected.d.ts +50 -0
- package/dist/affected/affected.d.ts.map +1 -0
- package/dist/affected/affected.js +118 -0
- package/dist/affected/affected.js.map +1 -0
- package/dist/agent-toolbelt.d.ts +15 -0
- package/dist/agent-toolbelt.d.ts.map +1 -0
- package/dist/agent-toolbelt.js +28 -0
- package/dist/agent-toolbelt.js.map +1 -0
- package/dist/api-client.d.ts +12 -0
- package/dist/api-client.d.ts.map +1 -0
- package/dist/api-client.js +21 -0
- package/dist/api-client.js.map +1 -0
- package/dist/app-build/bundle.d.ts +15 -0
- package/dist/app-build/bundle.d.ts.map +1 -0
- package/dist/app-build/bundle.js +45 -0
- package/dist/app-build/bundle.js.map +1 -0
- package/dist/app-build/watch.d.ts +13 -0
- package/dist/app-build/watch.d.ts.map +1 -0
- package/dist/app-build/watch.js +25 -0
- package/dist/app-build/watch.js.map +1 -0
- package/dist/app-debug/app-target.d.ts +14 -0
- package/dist/app-debug/app-target.d.ts.map +1 -0
- package/dist/app-debug/app-target.js +120 -0
- package/dist/app-debug/app-target.js.map +1 -0
- package/dist/app-debug/harness.d.ts +27 -0
- package/dist/app-debug/harness.d.ts.map +1 -0
- package/dist/app-debug/harness.js +93 -0
- package/dist/app-debug/harness.js.map +1 -0
- package/dist/app-debug/index.d.ts +12 -0
- package/dist/app-debug/index.d.ts.map +1 -0
- package/dist/app-debug/index.js +9 -0
- package/dist/app-debug/index.js.map +1 -0
- package/dist/app.d.ts +38 -48
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +979 -677
- package/dist/app.js.map +1 -1
- package/dist/bash-tool.d.ts +13 -0
- package/dist/bash-tool.d.ts.map +1 -0
- package/dist/bash-tool.js +85 -0
- package/dist/bash-tool.js.map +1 -0
- package/dist/chat-codeact.d.ts +85 -0
- package/dist/chat-codeact.d.ts.map +1 -0
- package/dist/chat-codeact.js +141 -0
- package/dist/chat-codeact.js.map +1 -0
- package/dist/chat-context.d.ts +18 -0
- package/dist/chat-context.d.ts.map +1 -0
- package/dist/chat-context.js +27 -0
- package/dist/chat-context.js.map +1 -0
- package/dist/chat-media.d.ts +3 -0
- package/dist/chat-media.d.ts.map +1 -0
- package/dist/chat-media.js +46 -0
- package/dist/chat-media.js.map +1 -0
- package/dist/chat-prompts.d.ts +20 -0
- package/dist/chat-prompts.d.ts.map +1 -0
- package/dist/chat-prompts.js +42 -0
- package/dist/chat-prompts.js.map +1 -0
- package/dist/chat-sessions.d.ts +25 -0
- package/dist/chat-sessions.d.ts.map +1 -0
- package/dist/chat-sessions.js +153 -0
- package/dist/chat-sessions.js.map +1 -0
- package/dist/command-errors.d.ts +10 -0
- package/dist/command-errors.d.ts.map +1 -0
- package/dist/command-errors.js +15 -0
- package/dist/command-errors.js.map +1 -0
- package/dist/commands/__tests__/jtbd.test.d.ts +2 -0
- package/dist/commands/__tests__/jtbd.test.d.ts.map +1 -0
- package/dist/commands/__tests__/jtbd.test.js +120 -0
- package/dist/commands/__tests__/jtbd.test.js.map +1 -0
- package/dist/commands/__tests__/timeline-render-audio.test.d.ts +2 -0
- package/dist/commands/__tests__/timeline-render-audio.test.d.ts.map +1 -0
- package/dist/commands/__tests__/timeline-render-audio.test.js +53 -0
- package/dist/commands/__tests__/timeline-render-audio.test.js.map +1 -0
- package/dist/commands/__tests__/timeline-render.test.d.ts +2 -0
- package/dist/commands/__tests__/timeline-render.test.d.ts.map +1 -0
- package/dist/commands/__tests__/timeline-render.test.js +115 -0
- package/dist/commands/__tests__/timeline-render.test.js.map +1 -0
- package/dist/commands/affected.d.ts +9 -0
- package/dist/commands/affected.d.ts.map +1 -0
- package/dist/commands/affected.js +122 -0
- package/dist/commands/affected.js.map +1 -0
- package/dist/commands/agent.d.ts +26 -4
- package/dist/commands/agent.d.ts.map +1 -1
- package/dist/commands/agent.js +327 -306
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/app.d.ts +3 -0
- package/dist/commands/app.d.ts.map +1 -0
- package/dist/commands/app.js +381 -0
- package/dist/commands/app.js.map +1 -0
- package/dist/commands/apps.d.ts +15 -0
- package/dist/commands/apps.d.ts.map +1 -0
- package/dist/commands/apps.js +180 -0
- package/dist/commands/apps.js.map +1 -0
- package/dist/commands/auth.d.ts +12 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +154 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/collections.d.ts +10 -0
- package/dist/commands/collections.d.ts.map +1 -0
- package/dist/commands/collections.js +257 -0
- package/dist/commands/collections.js.map +1 -0
- package/dist/commands/costs.d.ts +15 -0
- package/dist/commands/costs.d.ts.map +1 -0
- package/dist/commands/costs.js +201 -0
- package/dist/commands/costs.js.map +1 -0
- package/dist/commands/db.d.ts +3 -0
- package/dist/commands/db.d.ts.map +1 -0
- package/dist/commands/db.js +176 -0
- package/dist/commands/db.js.map +1 -0
- package/dist/commands/debug.d.ts +13 -0
- package/dist/commands/debug.d.ts.map +1 -0
- package/dist/commands/debug.js +138 -0
- package/dist/commands/debug.js.map +1 -0
- package/dist/commands/deploy-helpers.d.ts +49 -18
- package/dist/commands/deploy-helpers.d.ts.map +1 -1
- package/dist/commands/deploy-helpers.js +10 -276
- package/dist/commands/deploy-helpers.js.map +1 -1
- package/dist/commands/deploy.d.ts +0 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +21 -217
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/eval.d.ts +152 -0
- package/dist/commands/eval.d.ts.map +1 -0
- package/dist/commands/eval.js +688 -0
- package/dist/commands/eval.js.map +1 -0
- package/dist/commands/game.d.ts +4 -0
- package/dist/commands/game.d.ts.map +1 -0
- package/dist/commands/game.js +395 -0
- package/dist/commands/game.js.map +1 -0
- package/dist/commands/generate.d.ts +17 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +324 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/generations.d.ts +17 -0
- package/dist/commands/generations.d.ts.map +1 -0
- package/dist/commands/generations.js +408 -0
- package/dist/commands/generations.js.map +1 -0
- package/dist/commands/harness.d.ts +19 -0
- package/dist/commands/harness.d.ts.map +1 -0
- package/dist/commands/harness.js +361 -0
- package/dist/commands/harness.js.map +1 -0
- package/dist/commands/js-script-validation-output.d.ts +7 -0
- package/dist/commands/js-script-validation-output.d.ts.map +1 -0
- package/dist/commands/js-script-validation-output.js +5 -0
- package/dist/commands/js-script-validation-output.js.map +1 -0
- package/dist/commands/js-script-versions.d.ts +53 -0
- package/dist/commands/js-script-versions.d.ts.map +1 -0
- package/dist/commands/js-script-versions.js +89 -0
- package/dist/commands/js-script-versions.js.map +1 -0
- package/dist/commands/js-script.d.ts +29 -0
- package/dist/commands/js-script.d.ts.map +1 -0
- package/dist/commands/js-script.js +227 -0
- package/dist/commands/js-script.js.map +1 -0
- package/dist/commands/jtbd.d.ts +38 -0
- package/dist/commands/jtbd.d.ts.map +1 -0
- package/dist/commands/jtbd.js +261 -0
- package/dist/commands/jtbd.js.map +1 -0
- package/dist/commands/local-db.d.ts +16 -0
- package/dist/commands/local-db.d.ts.map +1 -0
- package/dist/commands/local-db.js +33 -0
- package/dist/commands/local-db.js.map +1 -0
- package/dist/commands/migrate-code-inputs.d.ts +24 -0
- package/dist/commands/migrate-code-inputs.d.ts.map +1 -0
- package/dist/commands/migrate-code-inputs.js +120 -0
- package/dist/commands/migrate-code-inputs.js.map +1 -0
- package/dist/commands/models-hf.js +4 -4
- package/dist/commands/models-hf.js.map +1 -1
- package/dist/commands/models-recommended.d.ts.map +1 -1
- package/dist/commands/models-recommended.js +16 -24
- package/dist/commands/models-recommended.js.map +1 -1
- package/dist/commands/node.d.ts +10 -0
- package/dist/commands/node.d.ts.map +1 -0
- package/dist/commands/node.js +72 -0
- package/dist/commands/node.js.map +1 -0
- package/dist/commands/output.d.ts +24 -0
- package/dist/commands/output.d.ts.map +1 -0
- package/dist/commands/output.js +132 -0
- package/dist/commands/output.js.map +1 -0
- package/dist/commands/package-helpers.d.ts +1 -7
- package/dist/commands/package-helpers.d.ts.map +1 -1
- package/dist/commands/package-helpers.js +3 -26
- package/dist/commands/package-helpers.js.map +1 -1
- package/dist/commands/package.js +2 -2
- package/dist/commands/package.js.map +1 -1
- package/dist/commands/packs.d.ts +13 -0
- package/dist/commands/packs.d.ts.map +1 -0
- package/dist/commands/packs.js +60 -0
- package/dist/commands/packs.js.map +1 -0
- package/dist/commands/reliability.d.ts +14 -0
- package/dist/commands/reliability.d.ts.map +1 -0
- package/dist/commands/reliability.js +80 -0
- package/dist/commands/reliability.js.map +1 -0
- package/dist/commands/resource-read.d.ts +28 -0
- package/dist/commands/resource-read.d.ts.map +1 -0
- package/dist/commands/resource-read.js +316 -0
- package/dist/commands/resource-read.js.map +1 -0
- package/dist/commands/sketch-validation-output.d.ts +7 -0
- package/dist/commands/sketch-validation-output.d.ts.map +1 -0
- package/dist/commands/sketch-validation-output.js +5 -0
- package/dist/commands/sketch-validation-output.js.map +1 -0
- package/dist/commands/sketch-versions.d.ts +66 -0
- package/dist/commands/sketch-versions.d.ts.map +1 -0
- package/dist/commands/sketch-versions.js +108 -0
- package/dist/commands/sketch-versions.js.map +1 -0
- package/dist/commands/sketch.d.ts +21 -0
- package/dist/commands/sketch.d.ts.map +1 -0
- package/dist/commands/sketch.js +117 -0
- package/dist/commands/sketch.js.map +1 -0
- package/dist/commands/storage.d.ts +24 -0
- package/dist/commands/storage.d.ts.map +1 -0
- package/dist/commands/storage.js +112 -0
- package/dist/commands/storage.js.map +1 -0
- package/dist/commands/telegram.d.ts +11 -0
- package/dist/commands/telegram.d.ts.map +1 -0
- package/dist/commands/telegram.js +66 -0
- package/dist/commands/telegram.js.map +1 -0
- package/dist/commands/timeline-render.d.ts +80 -0
- package/dist/commands/timeline-render.d.ts.map +1 -0
- package/dist/commands/timeline-render.js +465 -0
- package/dist/commands/timeline-render.js.map +1 -0
- package/dist/commands/timeline-validation-output.d.ts +7 -0
- package/dist/commands/timeline-validation-output.d.ts.map +1 -0
- package/dist/commands/timeline-validation-output.js +9 -0
- package/dist/commands/timeline-validation-output.js.map +1 -0
- package/dist/commands/timeline-versions.d.ts +72 -0
- package/dist/commands/timeline-versions.d.ts.map +1 -0
- package/dist/commands/timeline-versions.js +108 -0
- package/dist/commands/timeline-versions.js.map +1 -0
- package/dist/commands/timeline.d.ts +22 -0
- package/dist/commands/timeline.d.ts.map +1 -0
- package/dist/commands/timeline.js +119 -0
- package/dist/commands/timeline.js.map +1 -0
- package/dist/commands/validate.d.ts +22 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +127 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/commands/validation-output.d.ts +25 -0
- package/dist/commands/validation-output.d.ts.map +1 -0
- package/dist/commands/validation-output.js +29 -0
- package/dist/commands/validation-output.js.map +1 -0
- package/dist/commands/version-commands.d.ts +94 -0
- package/dist/commands/version-commands.d.ts.map +1 -0
- package/dist/commands/version-commands.js +227 -0
- package/dist/commands/version-commands.js.map +1 -0
- package/dist/commands/worker-models.d.ts +13 -0
- package/dist/commands/worker-models.d.ts.map +1 -0
- package/dist/commands/worker-models.js +207 -0
- package/dist/commands/worker-models.js.map +1 -0
- package/dist/commands/worker.d.ts +23 -0
- package/dist/commands/worker.d.ts.map +1 -0
- package/dist/commands/worker.js +374 -0
- package/dist/commands/worker.js.map +1 -0
- package/dist/debug/browser-runner.d.ts +21 -0
- package/dist/debug/browser-runner.d.ts.map +1 -0
- package/dist/debug/browser-runner.js +196 -0
- package/dist/debug/browser-runner.js.map +1 -0
- package/dist/debug/collector.d.ts +9 -0
- package/dist/debug/collector.d.ts.map +1 -0
- package/dist/debug/collector.js +9 -0
- package/dist/debug/collector.js.map +1 -0
- package/dist/debug/diff.d.ts +48 -0
- package/dist/debug/diff.d.ts.map +1 -0
- package/dist/debug/diff.js +68 -0
- package/dist/debug/diff.js.map +1 -0
- package/dist/debug/harness.d.ts +11 -0
- package/dist/debug/harness.d.ts.map +1 -0
- package/dist/debug/harness.js +103 -0
- package/dist/debug/harness.js.map +1 -0
- package/dist/debug/index.d.ts +17 -0
- package/dist/debug/index.d.ts.map +1 -0
- package/dist/debug/index.js +16 -0
- package/dist/debug/index.js.map +1 -0
- package/dist/debug/markdown.d.ts +3 -0
- package/dist/debug/markdown.d.ts.map +1 -0
- package/dist/debug/markdown.js +127 -0
- package/dist/debug/markdown.js.map +1 -0
- package/dist/debug/server-runner.d.ts +22 -0
- package/dist/debug/server-runner.d.ts.map +1 -0
- package/dist/debug/server-runner.js +164 -0
- package/dist/debug/server-runner.js.map +1 -0
- package/dist/debug/target.d.ts +34 -0
- package/dist/debug/target.d.ts.map +1 -0
- package/dist/debug/target.js +104 -0
- package/dist/debug/target.js.map +1 -0
- package/dist/debug/trace.d.ts +30 -0
- package/dist/debug/trace.d.ts.map +1 -0
- package/dist/debug/trace.js +87 -0
- package/dist/debug/trace.js.map +1 -0
- package/dist/debug/types.d.ts +82 -0
- package/dist/debug/types.d.ts.map +1 -0
- package/dist/debug/types.js +13 -0
- package/dist/debug/types.js.map +1 -0
- package/dist/debug/verdict.d.ts +3 -0
- package/dist/debug/verdict.d.ts.map +1 -0
- package/dist/debug/verdict.js +78 -0
- package/dist/debug/verdict.js.map +1 -0
- package/dist/debug/watch.d.ts +23 -0
- package/dist/debug/watch.d.ts.map +1 -0
- package/dist/debug/watch.js +68 -0
- package/dist/debug/watch.js.map +1 -0
- package/dist/diagnose.d.ts +139 -0
- package/dist/diagnose.d.ts.map +1 -0
- package/dist/diagnose.js +418 -0
- package/dist/diagnose.js.map +1 -0
- package/dist/evals/graph-runner.d.ts +8 -0
- package/dist/evals/graph-runner.d.ts.map +1 -0
- package/dist/evals/graph-runner.js +136 -0
- package/dist/evals/graph-runner.js.map +1 -0
- package/dist/harness/capability-coverage.d.ts +161 -0
- package/dist/harness/capability-coverage.d.ts.map +1 -0
- package/dist/harness/capability-coverage.js +266 -0
- package/dist/harness/capability-coverage.js.map +1 -0
- package/dist/harness/capability-table.d.ts +17 -0
- package/dist/harness/capability-table.d.ts.map +1 -0
- package/dist/harness/capability-table.js +3576 -0
- package/dist/harness/capability-table.js.map +1 -0
- package/dist/harness/changed-files.d.ts +18 -0
- package/dist/harness/changed-files.d.ts.map +1 -0
- package/dist/harness/changed-files.js +76 -0
- package/dist/harness/changed-files.js.map +1 -0
- package/dist/harness/declared-capabilities.d.ts +12 -0
- package/dist/harness/declared-capabilities.d.ts.map +1 -0
- package/dist/harness/declared-capabilities.js +21 -0
- package/dist/harness/declared-capabilities.js.map +1 -0
- package/dist/harness/registry.d.ts +162 -0
- package/dist/harness/registry.d.ts.map +1 -0
- package/dist/harness/registry.js +1738 -0
- package/dist/harness/registry.js.map +1 -0
- package/dist/index.js +121 -130
- package/dist/index.js.map +1 -1
- package/dist/interaction-script.d.ts +17 -0
- package/dist/interaction-script.d.ts.map +1 -0
- package/dist/interaction-script.js +47 -0
- package/dist/interaction-script.js.map +1 -0
- package/dist/js-script-debug/harness.d.ts +114 -0
- package/dist/js-script-debug/harness.d.ts.map +1 -0
- package/dist/js-script-debug/harness.js +252 -0
- package/dist/js-script-debug/harness.js.map +1 -0
- package/dist/js-script-debug/index.d.ts +9 -0
- package/dist/js-script-debug/index.d.ts.map +1 -0
- package/dist/js-script-debug/index.js +9 -0
- package/dist/js-script-debug/index.js.map +1 -0
- package/dist/js-script-debug/interactions.d.ts +19 -0
- package/dist/js-script-debug/interactions.d.ts.map +1 -0
- package/dist/js-script-debug/interactions.js +17 -0
- package/dist/js-script-debug/interactions.js.map +1 -0
- package/dist/js-script-debug/target.d.ts +20 -0
- package/dist/js-script-debug/target.d.ts.map +1 -0
- package/dist/js-script-debug/target.js +78 -0
- package/dist/js-script-debug/target.js.map +1 -0
- package/dist/local-model-interfaces.d.ts +20 -0
- package/dist/local-model-interfaces.d.ts.map +1 -0
- package/dist/local-model-interfaces.js +64 -0
- package/dist/local-model-interfaces.js.map +1 -0
- package/dist/local-secrets.d.ts +3 -0
- package/dist/local-secrets.d.ts.map +1 -0
- package/dist/local-secrets.js +16 -0
- package/dist/local-secrets.js.map +1 -0
- package/dist/markdown.d.ts.map +1 -1
- package/dist/markdown.js +7 -2
- package/dist/markdown.js.map +1 -1
- package/dist/node/run-node.d.ts +28 -0
- package/dist/node/run-node.d.ts.map +1 -0
- package/dist/node/run-node.js +76 -0
- package/dist/node/run-node.js.map +1 -0
- package/dist/node-registry.d.ts +13 -0
- package/dist/node-registry.d.ts.map +1 -0
- package/dist/node-registry.js +36 -0
- package/dist/node-registry.js.map +1 -0
- package/dist/nodetool.js +845 -309
- package/dist/nodetool.js.map +1 -1
- package/dist/numeric-options.d.ts +22 -0
- package/dist/numeric-options.d.ts.map +1 -0
- package/dist/numeric-options.js +45 -0
- package/dist/numeric-options.js.map +1 -0
- package/dist/permission-gate.d.ts +55 -0
- package/dist/permission-gate.d.ts.map +1 -0
- package/dist/permission-gate.js +118 -0
- package/dist/permission-gate.js.map +1 -0
- package/dist/predicates.d.ts +6 -0
- package/dist/predicates.d.ts.map +1 -0
- package/dist/predicates.js +6 -0
- package/dist/predicates.js.map +1 -0
- package/dist/providers.d.ts +73 -10
- package/dist/providers.d.ts.map +1 -1
- package/dist/providers.js +329 -97
- package/dist/providers.js.map +1 -1
- package/dist/readline-input.d.ts +13 -19
- package/dist/readline-input.d.ts.map +1 -1
- package/dist/readline-input.js +201 -190
- package/dist/readline-input.js.map +1 -1
- package/dist/run-budget.d.ts +40 -0
- package/dist/run-budget.d.ts.map +1 -0
- package/dist/run-budget.js +119 -0
- package/dist/run-budget.js.map +1 -0
- package/dist/run-dsl-supervised.d.ts +11 -0
- package/dist/run-dsl-supervised.d.ts.map +1 -0
- package/dist/run-dsl-supervised.js +82 -0
- package/dist/run-dsl-supervised.js.map +1 -0
- package/dist/run-dsl.d.ts +23 -0
- package/dist/run-dsl.d.ts.map +1 -1
- package/dist/run-dsl.js +40 -9
- package/dist/run-dsl.js.map +1 -1
- package/dist/run-json.d.ts +24 -0
- package/dist/run-json.d.ts.map +1 -0
- package/dist/run-json.js +132 -0
- package/dist/run-json.js.map +1 -0
- package/dist/sandbox-catalog.d.ts +12 -0
- package/dist/sandbox-catalog.d.ts.map +1 -0
- package/dist/sandbox-catalog.js +27 -0
- package/dist/sandbox-catalog.js.map +1 -0
- package/dist/settings.d.ts +11 -10
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +71 -13
- package/dist/settings.js.map +1 -1
- package/dist/sketch-debug/harness.d.ts +87 -0
- package/dist/sketch-debug/harness.d.ts.map +1 -0
- package/dist/sketch-debug/harness.js +178 -0
- package/dist/sketch-debug/harness.js.map +1 -0
- package/dist/sketch-debug/index.d.ts +9 -0
- package/dist/sketch-debug/index.d.ts.map +1 -0
- package/dist/sketch-debug/index.js +9 -0
- package/dist/sketch-debug/index.js.map +1 -0
- package/dist/sketch-debug/interactions.d.ts +19 -0
- package/dist/sketch-debug/interactions.d.ts.map +1 -0
- package/dist/sketch-debug/interactions.js +17 -0
- package/dist/sketch-debug/interactions.js.map +1 -0
- package/dist/sketch-debug/target.d.ts +48 -0
- package/dist/sketch-debug/target.d.ts.map +1 -0
- package/dist/sketch-debug/target.js +138 -0
- package/dist/sketch-debug/target.js.map +1 -0
- package/dist/stdin.d.ts +18 -19
- package/dist/stdin.d.ts.map +1 -1
- package/dist/stdin.js +159 -157
- package/dist/stdin.js.map +1 -1
- package/dist/supervisor.d.ts +97 -0
- package/dist/supervisor.d.ts.map +1 -0
- package/dist/supervisor.js +194 -0
- package/dist/supervisor.js.map +1 -0
- package/dist/terminal-clipboard.d.ts +3 -0
- package/dist/terminal-clipboard.d.ts.map +1 -0
- package/dist/terminal-clipboard.js +24 -0
- package/dist/terminal-clipboard.js.map +1 -0
- package/dist/terminal-mouse.d.ts +24 -0
- package/dist/terminal-mouse.d.ts.map +1 -0
- package/dist/terminal-mouse.js +84 -0
- package/dist/terminal-mouse.js.map +1 -0
- package/dist/terminal-screen.d.ts +41 -0
- package/dist/terminal-screen.d.ts.map +1 -0
- package/dist/terminal-screen.js +228 -0
- package/dist/terminal-screen.js.map +1 -0
- package/dist/timeline-debug/harness.d.ts +79 -0
- package/dist/timeline-debug/harness.d.ts.map +1 -0
- package/dist/timeline-debug/harness.js +155 -0
- package/dist/timeline-debug/harness.js.map +1 -0
- package/dist/timeline-debug/index.d.ts +9 -0
- package/dist/timeline-debug/index.d.ts.map +1 -0
- package/dist/timeline-debug/index.js +9 -0
- package/dist/timeline-debug/index.js.map +1 -0
- package/dist/timeline-debug/interactions.d.ts +19 -0
- package/dist/timeline-debug/interactions.d.ts.map +1 -0
- package/dist/timeline-debug/interactions.js +17 -0
- package/dist/timeline-debug/interactions.js.map +1 -0
- package/dist/timeline-debug/target.d.ts +34 -0
- package/dist/timeline-debug/target.d.ts.map +1 -0
- package/dist/timeline-debug/target.js +132 -0
- package/dist/timeline-debug/target.js.map +1 -0
- package/dist/tool-format.d.ts +54 -0
- package/dist/tool-format.d.ts.map +1 -0
- package/dist/tool-format.js +360 -0
- package/dist/tool-format.js.map +1 -0
- package/dist/useExecutionState.d.ts.map +1 -1
- package/dist/useExecutionState.js +8 -4
- package/dist/useExecutionState.js.map +1 -1
- package/dist/validate/index.d.ts +28 -0
- package/dist/validate/index.d.ts.map +1 -0
- package/dist/validate/index.js +51 -0
- package/dist/validate/index.js.map +1 -0
- package/dist/websocket-client.d.ts +78 -15
- package/dist/websocket-client.d.ts.map +1 -1
- package/dist/websocket-client.js +497 -171
- package/dist/websocket-client.js.map +1 -1
- package/package.json +62 -31
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Headless ("server") debug surface: runs a workflow through
|
|
3
|
+
* `@nodetool-ai/execution`'s `ExecutionSession` exactly as
|
|
4
|
+
* `nodetool workflows run` does, but captures the full processing-message
|
|
5
|
+
* stream and the OpenTelemetry trace instead of just the final outputs.
|
|
6
|
+
*
|
|
7
|
+
* This is integration code — it pulls in the node registries, runtime context,
|
|
8
|
+
* and Python bridge — so it is exercised end-to-end rather than unit-tested.
|
|
9
|
+
*/
|
|
10
|
+
import { getDefaultAssetsPath } from "@nodetool-ai/config";
|
|
11
|
+
import { getSecret } from "@nodetool-ai/models";
|
|
12
|
+
import { ExecutionSession, isExecutionPreflightError } from "@nodetool-ai/execution";
|
|
13
|
+
import { ProcessingContext } from "@nodetool-ai/runtime";
|
|
14
|
+
import { FileStorageAdapter } from "@nodetool-ai/storage";
|
|
15
|
+
import { summarizeInterventions } from "@nodetool-ai/execution/debug";
|
|
16
|
+
import { createGraphNodeTypeResolver } from "@nodetool-ai/node-sdk";
|
|
17
|
+
import { buildFullRegistry } from "../node-registry.js";
|
|
18
|
+
import { createSupervisorHandle, recordSupervisorCost, streamInterventionLines } from "../supervisor.js";
|
|
19
|
+
import { collectExecutionSummary } from "./collector.js";
|
|
20
|
+
import { readTraceSummary } from "./trace.js";
|
|
21
|
+
export async function runOnServer(input) {
|
|
22
|
+
const { graph, workflowId, params } = input;
|
|
23
|
+
const startedAt = Date.now();
|
|
24
|
+
const registry = buildFullRegistry();
|
|
25
|
+
const jobId = `debug-${Date.now()}`;
|
|
26
|
+
// Match a server run's workspace assignment so file/workspace nodes land in
|
|
27
|
+
// the same place a real run would.
|
|
28
|
+
const { resolveWorkflowWorkspace } = await import("@nodetool-ai/websocket");
|
|
29
|
+
const workspace = await resolveWorkflowWorkspace(workflowId ?? null, "1");
|
|
30
|
+
const context = new ProcessingContext({
|
|
31
|
+
jobId,
|
|
32
|
+
workflowId,
|
|
33
|
+
userId: "1",
|
|
34
|
+
secretResolver: getSecret,
|
|
35
|
+
storage: new FileStorageAdapter(getDefaultAssetsPath()),
|
|
36
|
+
workspace,
|
|
37
|
+
// The debug bundle crosses a JSON boundary. Store generated media so raw
|
|
38
|
+
// RGBA frames and image collections remain encoded, compact references.
|
|
39
|
+
assetOutputMode: "storage_url"
|
|
40
|
+
});
|
|
41
|
+
// ExecutionSession owns editor-only-node pruning (Comment/Group/Reroute —
|
|
42
|
+
// the web editor prunes them at serialize time; without this every
|
|
43
|
+
// commented example would die with "Unknown node type"), graph hydration,
|
|
44
|
+
// Python-bridge connection, and executor resolution (registry → Python
|
|
45
|
+
// bridge → throw) — the three steps this surface used to hand-roll.
|
|
46
|
+
// `limits.runTimeoutMs` replaces the old `withTimeout` race: instead of
|
|
47
|
+
// resolving a synthetic result while abandoning a still-running kernel, the
|
|
48
|
+
// facade calls `session.cancel("timeout")`, which actually tears the run
|
|
49
|
+
// down, and `session.result` only settles once that teardown completes.
|
|
50
|
+
// Supervision plumbs through the facade — the one integration point every
|
|
51
|
+
// surface shares (docs/workflow-supervisor-design.md §7).
|
|
52
|
+
const supervisor = input.supervisor
|
|
53
|
+
? await createSupervisorHandle({ config: input.supervisor, context })
|
|
54
|
+
: null;
|
|
55
|
+
const sessionOptions = {
|
|
56
|
+
graph,
|
|
57
|
+
registry,
|
|
58
|
+
// Registry alone hydrates node flags but not `propertyTypes`, and
|
|
59
|
+
// correlation analysis reads list-ness only from that map — so every
|
|
60
|
+
// `list[...]` handle read as non-list here and a stream arriving on one
|
|
61
|
+
// collapsed to empty scope, keeping the last value. `Directed Film to
|
|
62
|
+
// Timeline` animated one shot of N under `debug` and all N under
|
|
63
|
+
// `workflows run`, which is backwards for a harness whose whole job is
|
|
64
|
+
// to reproduce a run. Same resolver `workflows run` and the websocket
|
|
65
|
+
// runner already pass.
|
|
66
|
+
resolveNodeType: createGraphNodeTypeResolver(registry).resolveNodeType,
|
|
67
|
+
jobId,
|
|
68
|
+
workflowId,
|
|
69
|
+
params,
|
|
70
|
+
context,
|
|
71
|
+
limits: { runTimeoutMs: input.timeoutMs }
|
|
72
|
+
};
|
|
73
|
+
// Capture is retention, so it stays off unless a supervised run needs the
|
|
74
|
+
// stream to print its `⛨` lines as they happen.
|
|
75
|
+
if (supervisor) {
|
|
76
|
+
sessionOptions.supervisor = supervisor.handle;
|
|
77
|
+
sessionOptions.captureMessages = true;
|
|
78
|
+
}
|
|
79
|
+
// A run this runtime cannot honour (unknown model, unregistered provider,
|
|
80
|
+
// missing credential) is refused by `create()` before the kernel starts.
|
|
81
|
+
// The harness's job is to report why a run did not happen, so the refusal
|
|
82
|
+
// becomes a failed report rather than a thrown stack.
|
|
83
|
+
let session;
|
|
84
|
+
try {
|
|
85
|
+
session = await ExecutionSession.create(sessionOptions);
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
if (!isExecutionPreflightError(err))
|
|
89
|
+
throw err;
|
|
90
|
+
supervisor?.handle.close();
|
|
91
|
+
const summary = collectExecutionSummary([]);
|
|
92
|
+
summary.status = "failed";
|
|
93
|
+
summary.error = err.message;
|
|
94
|
+
return {
|
|
95
|
+
report: {
|
|
96
|
+
surface: "server",
|
|
97
|
+
ok: false,
|
|
98
|
+
status: "failed",
|
|
99
|
+
error: err.message,
|
|
100
|
+
durationMs: Date.now() - startedAt,
|
|
101
|
+
summary,
|
|
102
|
+
trace: null
|
|
103
|
+
},
|
|
104
|
+
rawMessages: []
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const interventionLines = supervisor
|
|
108
|
+
? streamInterventionLines(session.messages, input.onInterventionLine ?? ((line) => console.error(line)))
|
|
109
|
+
: Promise.resolve();
|
|
110
|
+
// `session.result` never rejects — kernel failures (including an unknown
|
|
111
|
+
// node type surfaced during executor resolution) resolve as `status:
|
|
112
|
+
// "failed"` instead of throwing, so no try/catch is needed here.
|
|
113
|
+
const result = await session.result;
|
|
114
|
+
await interventionLines;
|
|
115
|
+
supervisor?.handle.close();
|
|
116
|
+
const timedOut = session.cancelReason === "timeout";
|
|
117
|
+
const messages = result.messages ?? [];
|
|
118
|
+
const summary = collectExecutionSummary(messages);
|
|
119
|
+
// The runner's RunResult status is authoritative; fall back to the message
|
|
120
|
+
// stream's view if it's missing.
|
|
121
|
+
summary.status = result.status ?? summary.status;
|
|
122
|
+
const error = result.error ??
|
|
123
|
+
(timedOut
|
|
124
|
+
? `Debug server run exceeded timeout (${input.timeoutMs}ms)`
|
|
125
|
+
: undefined);
|
|
126
|
+
if (error && !summary.error)
|
|
127
|
+
summary.error = error;
|
|
128
|
+
// Spans are written eagerly via SimpleSpanProcessor, but the underlying
|
|
129
|
+
// WriteStream flushes async — give it a beat before reading the file back.
|
|
130
|
+
let trace = null;
|
|
131
|
+
if (input.tracePath) {
|
|
132
|
+
await new Promise((r) => setTimeout(r, 250));
|
|
133
|
+
trace = await readTraceSummary(input.tracePath);
|
|
134
|
+
}
|
|
135
|
+
const interventions = result.interventions ?? [];
|
|
136
|
+
if (supervisor && interventions.length > 0) {
|
|
137
|
+
await recordSupervisorCost({
|
|
138
|
+
interventions,
|
|
139
|
+
jobId,
|
|
140
|
+
workflowId,
|
|
141
|
+
userId: "1",
|
|
142
|
+
providerId: supervisor.providerId,
|
|
143
|
+
model: supervisor.model
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
const report = {
|
|
147
|
+
surface: "server",
|
|
148
|
+
ok: result.status === "completed",
|
|
149
|
+
status: result.status ?? summary.status,
|
|
150
|
+
error: error ?? summary.error,
|
|
151
|
+
durationMs: Date.now() - startedAt,
|
|
152
|
+
summary,
|
|
153
|
+
trace
|
|
154
|
+
};
|
|
155
|
+
if (supervisor) {
|
|
156
|
+
report.supervised = {
|
|
157
|
+
provider: supervisor.providerId,
|
|
158
|
+
model: supervisor.model,
|
|
159
|
+
summary: summarizeInterventions(interventions)
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
return { report, rawMessages: messages };
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=server-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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AI,UAAU,EAAE,CAAC;QACf,MAAM,CAAC,UAAU,GAAG;YAClB,QAAQ,EAAE,UAAU,CAAC,UAAU;YAC/B,KAAK,EAAE,UAAU,CAAC,KAAK;YACvB,OAAO,EAAE,sBAAsB,CAAC,aAAa,CAAC;SAC/C,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { DebugGraph, DebugTargetInfo } from "./types.js";
|
|
2
|
+
export interface ResolvedTarget {
|
|
3
|
+
info: DebugTargetInfo;
|
|
4
|
+
graph: DebugGraph;
|
|
5
|
+
/** Params discovered in a file's `params` field, merged under caller params. */
|
|
6
|
+
fileParams: Record<string, unknown>;
|
|
7
|
+
/** The workflow's app-builder document (`app_doc`), when present. */
|
|
8
|
+
appDoc: unknown;
|
|
9
|
+
}
|
|
10
|
+
/** A path-shaped ref, as opposed to a database id. */
|
|
11
|
+
export declare function looksLikeFile(ref: string): boolean;
|
|
12
|
+
/** A DSL ref, which has to be executed rather than read. */
|
|
13
|
+
export declare function looksLikeDsl(ref: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Read a file target's JSON: a `.json` file straight off disk, or the JSON a
|
|
16
|
+
* DSL file prints when executed.
|
|
17
|
+
*/
|
|
18
|
+
export declare function readFileTarget(ref: string): Promise<{
|
|
19
|
+
raw: unknown;
|
|
20
|
+
source: "json" | "dsl";
|
|
21
|
+
}>;
|
|
22
|
+
/** Convert ReactFlow `node.data` to kernel `node.properties` in place. */
|
|
23
|
+
export declare function normalizeGraph(graph: DebugGraph): DebugGraph;
|
|
24
|
+
/**
|
|
25
|
+
* Load a workflow from a file (JSON or DSL) or the local DB.
|
|
26
|
+
*
|
|
27
|
+
* `loadFromDb` is injected so this module stays free of a hard `@nodetool-ai/models`
|
|
28
|
+
* import at module load (keeps it light for the command-registration test path).
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolveTarget(ref: string, loadFromDb: (id: string) => Promise<{
|
|
31
|
+
graph: DebugGraph;
|
|
32
|
+
app_doc?: unknown;
|
|
33
|
+
} | null>): Promise<ResolvedTarget>;
|
|
34
|
+
//# sourceMappingURL=target.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../src/debug/target.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE9D,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,EAAE,UAAU,CAAC;IAClB,gFAAgF;IAChF,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,qEAAqE;IACrE,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,sDAAsD;AACtD,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAQlD;AAED,4DAA4D;AAC5D,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAA;CAAE,CAAC,CAcnD;AAED,0EAA0E;AAC1E,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAW5D;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAAC,GACnF,OAAO,CAAC,cAAc,CAAC,CA2CzB"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves a workflow debug target (DB id, JSON file, or TypeScript DSL file)
|
|
3
|
+
* into a normalized runner-shape graph plus metadata.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors the resolution + normalization the `workflows run` command does so the
|
|
6
|
+
* debug harness executes the exact same graph the runner would.
|
|
7
|
+
*/
|
|
8
|
+
import { readFileSync } from "node:fs";
|
|
9
|
+
import { dirname, resolve } from "node:path";
|
|
10
|
+
/** A path-shaped ref, as opposed to a database id. */
|
|
11
|
+
export function looksLikeFile(ref) {
|
|
12
|
+
return (ref.endsWith(".json") ||
|
|
13
|
+
ref.endsWith(".ts") ||
|
|
14
|
+
ref.endsWith(".tsx") ||
|
|
15
|
+
ref.includes("/") ||
|
|
16
|
+
ref.includes("\\"));
|
|
17
|
+
}
|
|
18
|
+
/** A DSL ref, which has to be executed rather than read. */
|
|
19
|
+
export function looksLikeDsl(ref) {
|
|
20
|
+
return ref.endsWith(".ts") || ref.endsWith(".tsx");
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Read a file target's JSON: a `.json` file straight off disk, or the JSON a
|
|
24
|
+
* DSL file prints when executed.
|
|
25
|
+
*/
|
|
26
|
+
export async function readFileTarget(ref) {
|
|
27
|
+
if (looksLikeDsl(ref)) {
|
|
28
|
+
// DSL file: execute via tsx and capture the emitted JSON workflow.
|
|
29
|
+
// execFileSync, not execSync: the path goes through argv, so quotes or
|
|
30
|
+
// `$(...)` in a file name stay a file name instead of becoming shell.
|
|
31
|
+
const { execFileSync } = await import("node:child_process");
|
|
32
|
+
const output = execFileSync("npx", ["tsx", resolve(ref)], {
|
|
33
|
+
encoding: "utf8",
|
|
34
|
+
cwd: dirname(resolve(ref)),
|
|
35
|
+
timeout: 30000
|
|
36
|
+
});
|
|
37
|
+
return { raw: JSON.parse(output.trim()), source: "dsl" };
|
|
38
|
+
}
|
|
39
|
+
return { raw: JSON.parse(readFileSync(ref, "utf8")), source: "json" };
|
|
40
|
+
}
|
|
41
|
+
/** Convert ReactFlow `node.data` to kernel `node.properties` in place. */
|
|
42
|
+
export function normalizeGraph(graph) {
|
|
43
|
+
return {
|
|
44
|
+
nodes: (graph.nodes ?? []).map((n) => {
|
|
45
|
+
if (n.properties === undefined && n.data !== undefined) {
|
|
46
|
+
const { data, ...rest } = n;
|
|
47
|
+
return { ...rest, properties: data };
|
|
48
|
+
}
|
|
49
|
+
return n;
|
|
50
|
+
}),
|
|
51
|
+
edges: graph.edges ?? []
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Load a workflow from a file (JSON or DSL) or the local DB.
|
|
56
|
+
*
|
|
57
|
+
* `loadFromDb` is injected so this module stays free of a hard `@nodetool-ai/models`
|
|
58
|
+
* import at module load (keeps it light for the command-registration test path).
|
|
59
|
+
*/
|
|
60
|
+
export async function resolveTarget(ref, loadFromDb) {
|
|
61
|
+
let raw;
|
|
62
|
+
let source;
|
|
63
|
+
let workflowId;
|
|
64
|
+
const fileParams = {};
|
|
65
|
+
if (looksLikeFile(ref)) {
|
|
66
|
+
const file = await readFileTarget(ref);
|
|
67
|
+
raw = file.raw;
|
|
68
|
+
source = file.source;
|
|
69
|
+
workflowId = raw.workflow_id ?? raw.id ?? null;
|
|
70
|
+
if (raw.params)
|
|
71
|
+
Object.assign(fileParams, raw.params);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
const wf = await loadFromDb(ref);
|
|
75
|
+
if (!wf)
|
|
76
|
+
throw new Error(`Workflow not found: ${ref}`);
|
|
77
|
+
raw = wf;
|
|
78
|
+
workflowId = ref;
|
|
79
|
+
source = "id";
|
|
80
|
+
}
|
|
81
|
+
const rawGraph = raw.graph ?? raw;
|
|
82
|
+
if (!rawGraph?.nodes || !rawGraph?.edges) {
|
|
83
|
+
throw new Error("Invalid workflow: missing nodes or edges");
|
|
84
|
+
}
|
|
85
|
+
// A truthy non-array (`"nodes": 3`, `"edges": {}`) clears the check above and
|
|
86
|
+
// used to reach `.map()` below as a raw TypeError.
|
|
87
|
+
if (!Array.isArray(rawGraph.nodes) || !Array.isArray(rawGraph.edges)) {
|
|
88
|
+
throw new Error("Invalid workflow: nodes and edges must be arrays");
|
|
89
|
+
}
|
|
90
|
+
const graph = normalizeGraph(rawGraph);
|
|
91
|
+
return {
|
|
92
|
+
info: {
|
|
93
|
+
ref,
|
|
94
|
+
source,
|
|
95
|
+
workflowId,
|
|
96
|
+
nodeCount: graph.nodes.length,
|
|
97
|
+
edgeCount: graph.edges.length
|
|
98
|
+
},
|
|
99
|
+
graph,
|
|
100
|
+
fileParams,
|
|
101
|
+
appDoc: raw.app_doc ?? null
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=target.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target.js","sourceRoot":"","sources":["../../src/debug/target.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAY7C,sDAAsD;AACtD,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,OAAO,CACL,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC;QACrB,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC;QACnB,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC;QACpB,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC;QACjB,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CACnB,CAAC;AACJ,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,OAAO,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACrD,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,GAAW;IAEX,IAAI,YAAY,CAAC,GAAG,CAA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AAC,QAAQ,CAAC,CAAC;IAEvC,OAAO;QACL,IAAI,EAAE;YACJ,GAAG;YACH,MAAM;YACN,UAAU;YACV,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM;YAC7B,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM;SAC9B;QACD,KAAK;QACL,UAAU;QACV,MAAM,EAAE,GAAG,CAAC,OAAO,IAAI,IAAI;KAC5B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { TraceSummary } from "./types.js";
|
|
2
|
+
/** One span as serialized by the JSONL trace exporter. */
|
|
3
|
+
export interface TraceSpan {
|
|
4
|
+
trace_id: string;
|
|
5
|
+
span_id: string;
|
|
6
|
+
parent_span_id: string | null;
|
|
7
|
+
name: string;
|
|
8
|
+
kind: string;
|
|
9
|
+
start_time_ms: number;
|
|
10
|
+
end_time_ms: number;
|
|
11
|
+
duration_ms: number;
|
|
12
|
+
status: {
|
|
13
|
+
code: string;
|
|
14
|
+
message?: string;
|
|
15
|
+
};
|
|
16
|
+
attributes: Record<string, unknown>;
|
|
17
|
+
events: Array<{
|
|
18
|
+
name: string;
|
|
19
|
+
time_ms: number;
|
|
20
|
+
attributes?: Record<string, unknown>;
|
|
21
|
+
}>;
|
|
22
|
+
resource: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
/** Parse a JSONL trace file body, skipping blank/corrupt lines. */
|
|
25
|
+
export declare function parseTraceJsonl(text: string): TraceSpan[];
|
|
26
|
+
/** Roll spans up into a `TraceSummary`. */
|
|
27
|
+
export declare function summarizeSpans(spans: TraceSpan[]): TraceSummary;
|
|
28
|
+
/** Read + summarize a trace file. Returns null when the file is missing/empty. */
|
|
29
|
+
export declare function readTraceSummary(path: string): Promise<TraceSummary | null>;
|
|
30
|
+
//# sourceMappingURL=trace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../src/debug/trace.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,0DAA0D;AAC1D,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;IACvF,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAID,mEAAmE;AACnE,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,CAYzD;AAOD,2CAA2C;AAC3C,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,YAAY,CA2C/D;AAED,kFAAkF;AAClF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAUjF"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads and summarizes the OpenTelemetry JSONL trace a debug run produces.
|
|
3
|
+
*
|
|
4
|
+
* The runtime's `JsonlFileSpanExporter` writes one span per line in the shape
|
|
5
|
+
* documented in AGENTS.md (workflow.run → node.process → agent.* → llm.*). We
|
|
6
|
+
* roll those up into per-name timing plus token/cost totals from the
|
|
7
|
+
* `gen_ai.usage.*` attributes carried by every llm.chat / llm.stream span.
|
|
8
|
+
*/
|
|
9
|
+
import { readFile } from "node:fs/promises";
|
|
10
|
+
import { isNumber } from "../predicates.js";
|
|
11
|
+
const SLOWEST_LIMIT = 10;
|
|
12
|
+
/** Parse a JSONL trace file body, skipping blank/corrupt lines. */
|
|
13
|
+
export function parseTraceJsonl(text) {
|
|
14
|
+
const spans = [];
|
|
15
|
+
for (const line of text.split("\n")) {
|
|
16
|
+
const trimmed = line.trim();
|
|
17
|
+
if (!trimmed)
|
|
18
|
+
continue;
|
|
19
|
+
try {
|
|
20
|
+
spans.push(JSON.parse(trimmed));
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
// Ignore partial/corrupt lines (e.g. a crash mid-write).
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return spans;
|
|
27
|
+
}
|
|
28
|
+
function numAttr(attrs, key) {
|
|
29
|
+
const v = attrs[key];
|
|
30
|
+
return isNumber(v) ? v : 0;
|
|
31
|
+
}
|
|
32
|
+
/** Roll spans up into a `TraceSummary`. */
|
|
33
|
+
export function summarizeSpans(spans) {
|
|
34
|
+
const byName = {};
|
|
35
|
+
let inputTokens = 0;
|
|
36
|
+
let outputTokens = 0;
|
|
37
|
+
let totalTokens = 0;
|
|
38
|
+
let costUsd = 0;
|
|
39
|
+
let minStart = Number.POSITIVE_INFINITY;
|
|
40
|
+
let maxEnd = Number.NEGATIVE_INFINITY;
|
|
41
|
+
for (const span of spans) {
|
|
42
|
+
const bucket = (byName[span.name] ??= { count: 0, totalDurationMs: 0 });
|
|
43
|
+
bucket.count += 1;
|
|
44
|
+
bucket.totalDurationMs += span.duration_ms;
|
|
45
|
+
if (Number.isFinite(span.start_time_ms))
|
|
46
|
+
minStart = Math.min(minStart, span.start_time_ms);
|
|
47
|
+
if (Number.isFinite(span.end_time_ms))
|
|
48
|
+
maxEnd = Math.max(maxEnd, span.end_time_ms);
|
|
49
|
+
const a = span.attributes ?? {};
|
|
50
|
+
inputTokens += numAttr(a, "gen_ai.usage.input_tokens");
|
|
51
|
+
outputTokens += numAttr(a, "gen_ai.usage.output_tokens");
|
|
52
|
+
totalTokens += numAttr(a, "gen_ai.usage.total_tokens");
|
|
53
|
+
costUsd += numAttr(a, "gen_ai.usage.cost_usd");
|
|
54
|
+
}
|
|
55
|
+
const slowest = spans
|
|
56
|
+
.slice()
|
|
57
|
+
.sort((x, y) => y.duration_ms - x.duration_ms)
|
|
58
|
+
.slice(0, SLOWEST_LIMIT)
|
|
59
|
+
.map((s) => ({ name: s.name, durationMs: s.duration_ms, status: s.status?.code ?? "UNSET" }));
|
|
60
|
+
return {
|
|
61
|
+
spanCount: spans.length,
|
|
62
|
+
totalDurationMs: spans.length > 0 && minStart !== Number.POSITIVE_INFINITY ? maxEnd - minStart : null,
|
|
63
|
+
tokens: {
|
|
64
|
+
input: inputTokens,
|
|
65
|
+
output: outputTokens,
|
|
66
|
+
total: totalTokens || inputTokens + outputTokens
|
|
67
|
+
},
|
|
68
|
+
costUsd,
|
|
69
|
+
byName,
|
|
70
|
+
slowest
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/** Read + summarize a trace file. Returns null when the file is missing/empty. */
|
|
74
|
+
export async function readTraceSummary(path) {
|
|
75
|
+
let text;
|
|
76
|
+
try {
|
|
77
|
+
text = await readFile(path, "utf8");
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
const spans = parseTraceJsonl(text);
|
|
83
|
+
if (spans.length === 0)
|
|
84
|
+
return null;
|
|
85
|
+
return summarizeSpans(spans);
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=trace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.js","sourceRoot":"","sources":["../../src/debug/trace.ts"],"names":[],"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,CAAC,CAAC;IAEhG,OAAO;QACL,SAAS,EAAE,KAAK,CAAC,MAAM;QACvB,eAAe,EACb,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,KAAK,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI;QACtF,MAAM,EAAE;YACN,KAAK,EAAE,WAAW;YAClB,MAAM,EAAE,YAAY;YACpB,KAAK,EAAE,WAAW,IAAI,WAAW,GAAG,YAAY;SACjD;QACD,OAAO;QACP,MAAM;QACN,OAAO;KACR,CAAC;AACJ,CAAC;AAED,kFAAkF;AAClF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAAY;IACjD,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QACH,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACpC,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for the workflow debug harness.
|
|
3
|
+
*
|
|
4
|
+
* The harness runs a workflow end-to-end on two surfaces — the headless server
|
|
5
|
+
* (kernel `WorkflowRunner`) and a real browser (the `e2e_runner` page driven by
|
|
6
|
+
* Playwright) — and folds everything worth inspecting into a single
|
|
7
|
+
* `DebugReport`: the workflow graph JSON, every processing message (logs, node
|
|
8
|
+
* IO, outputs, edges, LLM calls), an OpenTelemetry span summary, browser console
|
|
9
|
+
* errors and a screenshot. The report is written to a bundle directory and also
|
|
10
|
+
* returned so an agent can iterate without re-parsing files.
|
|
11
|
+
*/
|
|
12
|
+
import type { DebugGraph, DebugTargetInfo, DebugVerdict, ExecutionSummary, ServerRunReport } from "@nodetool-ai/execution/debug";
|
|
13
|
+
import type { SupervisorRunConfig } from "../supervisor.js";
|
|
14
|
+
export type { DebugError, DebugGraph, DebugTargetInfo, DebugVerdict, EdgeDebug, ExecutionSummary, LlmCallDebug, LogEntry, NodeDebug, NodeOutput, RunVerdict, ServerRunReport, TraceSummary } from "@nodetool-ai/execution/debug";
|
|
15
|
+
/** A canvas screenshot captured at one stage of the browser run. */
|
|
16
|
+
interface BrowserStageShot {
|
|
17
|
+
/** 0-based capture order. */
|
|
18
|
+
index: number;
|
|
19
|
+
/** Run status at capture time (running until the final frame). */
|
|
20
|
+
status: string;
|
|
21
|
+
/** Bundle-relative path to the screenshot. */
|
|
22
|
+
file: string;
|
|
23
|
+
}
|
|
24
|
+
export interface BrowserRunReport {
|
|
25
|
+
surface: "browser";
|
|
26
|
+
ok: boolean;
|
|
27
|
+
status: string;
|
|
28
|
+
error: string | null;
|
|
29
|
+
durationMs: number | null;
|
|
30
|
+
summary: ExecutionSummary;
|
|
31
|
+
consoleErrors: string[];
|
|
32
|
+
/** Bundle-relative path to the final settled screenshot. */
|
|
33
|
+
screenshotFile?: string;
|
|
34
|
+
/** Canvas screenshots captured at successive stages of the run. */
|
|
35
|
+
stages?: BrowserStageShot[];
|
|
36
|
+
/** Bundle-relative path to the raw browser RunRecord JSON. */
|
|
37
|
+
recordFile?: string;
|
|
38
|
+
/** Set when the browser surface could not run (missing deps / browser). */
|
|
39
|
+
unavailableReason?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface DebugReport {
|
|
42
|
+
generatedAt: string;
|
|
43
|
+
target: DebugTargetInfo;
|
|
44
|
+
/** The workflow graph JSON (runner shape). */
|
|
45
|
+
workflow: DebugGraph;
|
|
46
|
+
server: ServerRunReport | null;
|
|
47
|
+
browser: BrowserRunReport | null;
|
|
48
|
+
verdict: DebugVerdict;
|
|
49
|
+
/** Absolute path to the on-disk bundle, when one was written. */
|
|
50
|
+
bundleDir: string | null;
|
|
51
|
+
}
|
|
52
|
+
/** Options that drive a debug run. */
|
|
53
|
+
export interface DebugOptions {
|
|
54
|
+
/** Run the headless server surface. Default true. */
|
|
55
|
+
server?: boolean;
|
|
56
|
+
/** Run the real-browser surface (Playwright). Expensive; default false. */
|
|
57
|
+
browser?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Capture an OpenTelemetry trace of the server run (timing/tokens/cost).
|
|
60
|
+
* Expensive — loads the OTel SDK and adds per-span overhead. Default false.
|
|
61
|
+
*/
|
|
62
|
+
trace?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* On the browser surface, capture a canvas screenshot at every stage of the
|
|
65
|
+
* run instead of only the final frame. Expensive; implies `browser`. Default
|
|
66
|
+
* false.
|
|
67
|
+
*/
|
|
68
|
+
stages?: boolean;
|
|
69
|
+
/** Input params keyed by input-node name. */
|
|
70
|
+
params?: Record<string, unknown>;
|
|
71
|
+
/** Bundle output directory. When omitted a timestamped dir is generated. */
|
|
72
|
+
outDir?: string;
|
|
73
|
+
/** Per-surface run timeout, ms. */
|
|
74
|
+
timeoutMs?: number;
|
|
75
|
+
/**
|
|
76
|
+
* Supervise the server surface (`--supervise` and its bounds). The browser
|
|
77
|
+
* surface runs the workflow through the web runtime, which has no supervisor
|
|
78
|
+
* of its own until the editor toggle ships, so it is unaffected.
|
|
79
|
+
*/
|
|
80
|
+
supervisor?: SupervisorRunConfig;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/debug/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,eAAe,EAChB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;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M,CAAC,EAAE,OAAO,CAAC;IACjB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,mBAAmB,CAAC;CAClC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for the workflow debug harness.
|
|
3
|
+
*
|
|
4
|
+
* The harness runs a workflow end-to-end on two surfaces — the headless server
|
|
5
|
+
* (kernel `WorkflowRunner`) and a real browser (the `e2e_runner` page driven by
|
|
6
|
+
* Playwright) — and folds everything worth inspecting into a single
|
|
7
|
+
* `DebugReport`: the workflow graph JSON, every processing message (logs, node
|
|
8
|
+
* IO, outputs, edges, LLM calls), an OpenTelemetry span summary, browser console
|
|
9
|
+
* errors and a screenshot. The report is written to a bundle directory and also
|
|
10
|
+
* returned so an agent can iterate without re-parsing files.
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/debug/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verdict.d.ts","sourceRoot":"","sources":["../../src/debug/verdict.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,eAAe,EAChB,MAAM,YAAY,CAAC;AAEpB,wBAAgB,YAAY,CAC1B,MAAM,EAAE,eAAe,GAAG,IAAI,EAC9B,OAAO,EAAE,gBAAgB,GAAG,IAAI,GAC/B,YAAY,CAgFd"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-surface triage: turns the server/browser run reports into a single
|
|
3
|
+
* pass/fail verdict plus an ordered list of concrete issues an agent can act on.
|
|
4
|
+
*
|
|
5
|
+
* The per-surface triage itself lives in `@nodetool-ai/execution` so the HTTP
|
|
6
|
+
* debug endpoint and the agent-facing `debug_workflow` tool reach the same
|
|
7
|
+
* verdict for the same run; this module only composes the two surfaces.
|
|
8
|
+
*/
|
|
9
|
+
import { collectInterventionWarnings, collectRunIssues, describeErrors } from "@nodetool-ai/execution/debug";
|
|
10
|
+
export function buildVerdict(server, browser) {
|
|
11
|
+
const issues = [];
|
|
12
|
+
if (server) {
|
|
13
|
+
issues.push(...collectRunIssues("Server", server.summary, {
|
|
14
|
+
ok: server.ok,
|
|
15
|
+
status: server.status,
|
|
16
|
+
error: server.error
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
if (browser) {
|
|
20
|
+
if (browser.unavailableReason) {
|
|
21
|
+
issues.push(`Browser run unavailable: ${browser.unavailableReason}`);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
if (!browser.ok) {
|
|
25
|
+
issues.push(`Browser run ended ${browser.status}${browser.error ? `: ${browser.error}` : ""}`);
|
|
26
|
+
}
|
|
27
|
+
issues.push(...describeErrors("Browser node", browser.summary.errors));
|
|
28
|
+
for (const err of browser.consoleErrors.slice(0, 5)) {
|
|
29
|
+
issues.push(`Browser console error: ${err.replace(/\s+/g, " ").slice(0, 200)}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// A surface that genuinely ran and completed is the bar for "ok"; an
|
|
34
|
+
// unavailable browser surface doesn't fail the verdict on its own.
|
|
35
|
+
const serverOk = server ? server.ok : true;
|
|
36
|
+
const browserRan = browser ? !browser.unavailableReason : true;
|
|
37
|
+
const browserOk = browser && browserRan ? browser.ok : true;
|
|
38
|
+
// At least one surface must have actually run. Zero surfaces means zero
|
|
39
|
+
// evidence, which is not the same as a clean run.
|
|
40
|
+
const ranSomewhere = Boolean(server) || (Boolean(browser) && browserRan);
|
|
41
|
+
if (!ranSomewhere) {
|
|
42
|
+
issues.unshift("No surface ran — nothing was executed, so nothing was verified");
|
|
43
|
+
}
|
|
44
|
+
const ok = ranSomewhere &&
|
|
45
|
+
serverOk &&
|
|
46
|
+
browserOk &&
|
|
47
|
+
issues.filter((i) => !i.startsWith("Browser run unavailable")).length === 0;
|
|
48
|
+
let headline;
|
|
49
|
+
if (ok) {
|
|
50
|
+
const surfaces = [
|
|
51
|
+
server && "server",
|
|
52
|
+
browser && !browser.unavailableReason && "browser"
|
|
53
|
+
]
|
|
54
|
+
.filter(Boolean)
|
|
55
|
+
.join(" + ");
|
|
56
|
+
headline = `Workflow ran clean on ${surfaces}.`;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
const first = issues[0] ?? "unknown failure";
|
|
60
|
+
headline = `Workflow has issues — ${first}`;
|
|
61
|
+
}
|
|
62
|
+
// Supervisor decisions are warnings, never issues: a run the supervisor
|
|
63
|
+
// rescued is still a run that completed, but a reader has to be told what
|
|
64
|
+
// was skipped or repaired to get there.
|
|
65
|
+
const warnings = server
|
|
66
|
+
? collectInterventionWarnings("Server", server.summary)
|
|
67
|
+
: [];
|
|
68
|
+
const verdict = {
|
|
69
|
+
ok,
|
|
70
|
+
headline: ok && warnings.length > 0 ? `${headline} (supervised)` : headline,
|
|
71
|
+
issues
|
|
72
|
+
};
|
|
73
|
+
if (warnings.length > 0) {
|
|
74
|
+
verdict.warnings = warnings;
|
|
75
|
+
}
|
|
76
|
+
return verdict;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=verdict.js.map
|