@nodetool-ai/cli 0.7.0-rc.23 → 0.8.2
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 +82 -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 +45 -0
- package/dist/affected/affected.d.ts.map +1 -0
- package/dist/affected/affected.js +160 -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 +29 -0
- package/dist/app-debug/harness.d.ts.map +1 -0
- package/dist/app-debug/harness.js +116 -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 +980 -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 +93 -0
- package/dist/chat-codeact.d.ts.map +1 -0
- package/dist/chat-codeact.js +179 -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 +32 -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-completeness.test.d.ts +2 -0
- package/dist/commands/__tests__/timeline-render-completeness.test.d.ts.map +1 -0
- package/dist/commands/__tests__/timeline-render-completeness.test.js +117 -0
- package/dist/commands/__tests__/timeline-render-completeness.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/__tests__/timeline-score.test.d.ts +2 -0
- package/dist/commands/__tests__/timeline-score.test.d.ts.map +1 -0
- package/dist/commands/__tests__/timeline-score.test.js +100 -0
- package/dist/commands/__tests__/timeline-score.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 +328 -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 +405 -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-summary-output.d.ts +22 -0
- package/dist/commands/debug-summary-output.d.ts.map +1 -0
- package/dist/commands/debug-summary-output.js +28 -0
- package/dist/commands/debug-summary-output.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/errors.d.ts +11 -0
- package/dist/commands/errors.d.ts.map +1 -0
- package/dist/commands/errors.js +177 -0
- package/dist/commands/errors.js.map +1 -0
- package/dist/commands/eval.d.ts +152 -0
- package/dist/commands/eval.d.ts.map +1 -0
- package/dist/commands/eval.js +690 -0
- package/dist/commands/eval.js.map +1 -0
- package/dist/commands/extension.d.ts +12 -0
- package/dist/commands/extension.d.ts.map +1 -0
- package/dist/commands/extension.js +30 -0
- package/dist/commands/extension.js.map +1 -0
- package/dist/commands/game-benchmark.d.ts +34 -0
- package/dist/commands/game-benchmark.d.ts.map +1 -0
- package/dist/commands/game-benchmark.js +95 -0
- package/dist/commands/game-benchmark.js.map +1 -0
- package/dist/commands/game-smoke.d.ts +3 -0
- package/dist/commands/game-smoke.d.ts.map +1 -0
- package/dist/commands/game-smoke.js +23 -0
- package/dist/commands/game-smoke.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 +624 -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 +69 -0
- package/dist/commands/harness.d.ts.map +1 -0
- package/dist/commands/harness.js +575 -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 +211 -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/mcp.d.ts +21 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +164 -0
- package/dist/commands/mcp.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.d.ts.map +1 -1
- package/dist/commands/package.js +14 -14
- 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/runs.d.ts +7 -0
- package/dist/commands/runs.d.ts.map +1 -0
- package/dist/commands/runs.js +302 -0
- package/dist/commands/runs.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 +101 -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 +85 -0
- package/dist/commands/timeline-render.d.ts.map +1 -0
- package/dist/commands/timeline-render.js +474 -0
- package/dist/commands/timeline-render.js.map +1 -0
- package/dist/commands/timeline-score.d.ts +16 -0
- package/dist/commands/timeline-score.d.ts.map +1 -0
- package/dist/commands/timeline-score.js +89 -0
- package/dist/commands/timeline-score.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 +105 -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 +24 -0
- package/dist/debug/server-runner.d.ts.map +1 -0
- package/dist/debug/server-runner.js +197 -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 +3844 -0
- package/dist/harness/capability-table.js.map +1 -0
- package/dist/harness/changed-files.d.ts +20 -0
- package/dist/harness/changed-files.d.ts.map +1 -0
- package/dist/harness/changed-files.js +90 -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 +190 -0
- package/dist/harness/registry.d.ts.map +1 -0
- package/dist/harness/registry.js +2034 -0
- package/dist/harness/registry.js.map +1 -0
- package/dist/index.js +122 -131
- package/dist/index.js.map +1 -1
- package/dist/interaction-script.d.ts +40 -0
- package/dist/interaction-script.d.ts.map +1 -0
- package/dist/interaction-script.js +96 -0
- package/dist/interaction-script.js.map +1 -0
- package/dist/js-script-debug/harness.d.ts +124 -0
- package/dist/js-script-debug/harness.d.ts.map +1 -0
- package/dist/js-script-debug/harness.js +230 -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 +41 -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 +27 -0
- package/dist/node-registry.d.ts.map +1 -0
- package/dist/node-registry.js +33 -0
- package/dist/node-registry.js.map +1 -0
- package/dist/nodetool-main.d.ts +15 -0
- package/dist/nodetool-main.d.ts.map +1 -0
- package/dist/nodetool-main.js +1368 -0
- package/dist/nodetool-main.js.map +1 -0
- package/dist/nodetool.d.ts +0 -13
- package/dist/nodetool.d.ts.map +1 -1
- package/dist/nodetool.js +17 -1147
- 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 +339 -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 +29 -0
- package/dist/run-dsl.d.ts.map +1 -1
- package/dist/run-dsl.js +44 -10
- 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 +24 -0
- package/dist/sandbox-catalog.d.ts.map +1 -0
- package/dist/sandbox-catalog.js +78 -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 +145 -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 +160 -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 +122 -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 +65 -31
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { JsScriptDebugReport, JsScriptInteractionRecord, JsScriptValidation } from "@nodetool-ai/execution/js-script-debug";
|
|
2
|
+
import type { JsScriptBridgeFinalState } from "@nodetool-ai/agents";
|
|
3
|
+
import type { JsScriptDocument } from "@nodetool-ai/protocol/api-schemas/js-scripts.js";
|
|
4
|
+
import type { JsScriptInteractionStep } from "./interactions.js";
|
|
5
|
+
import { type ResolvedJsScriptTarget, type JsScriptTargetDeps } from "./target.js";
|
|
6
|
+
/** What one sandboxed run reports. Mirrors the agents `HarnessRunResult`. */
|
|
7
|
+
export interface JsScriptRunResult {
|
|
8
|
+
ok: boolean;
|
|
9
|
+
outputs?: Record<string, unknown>;
|
|
10
|
+
streamed?: unknown[];
|
|
11
|
+
logs: string[];
|
|
12
|
+
error?: string;
|
|
13
|
+
duration_ms: number;
|
|
14
|
+
}
|
|
15
|
+
/** One graded case, as `test_code`/`test_js_script` report it. */
|
|
16
|
+
export interface JsScriptCaseResult {
|
|
17
|
+
name: string;
|
|
18
|
+
ok: boolean;
|
|
19
|
+
outputs?: Record<string, unknown>;
|
|
20
|
+
streamed?: unknown[];
|
|
21
|
+
logs: string[];
|
|
22
|
+
error?: string;
|
|
23
|
+
mismatches: {
|
|
24
|
+
output: string;
|
|
25
|
+
expected: unknown;
|
|
26
|
+
actual: unknown;
|
|
27
|
+
}[];
|
|
28
|
+
}
|
|
29
|
+
export interface JsScriptTestReport {
|
|
30
|
+
ok: boolean;
|
|
31
|
+
passed: number;
|
|
32
|
+
failed: number;
|
|
33
|
+
results: JsScriptCaseResult[];
|
|
34
|
+
}
|
|
35
|
+
/** The pieces of the shared core this host calls. */
|
|
36
|
+
export interface JsScriptDebugCore {
|
|
37
|
+
validateJsScriptDoc: (raw: unknown, options?: {
|
|
38
|
+
knownSecrets?: readonly string[];
|
|
39
|
+
packDtsSources?: ReadonlyMap<string, string>;
|
|
40
|
+
}) => Promise<JsScriptValidation>;
|
|
41
|
+
buildJsScriptDebugReport: (input: {
|
|
42
|
+
target: JsScriptDebugReport["target"];
|
|
43
|
+
document: unknown;
|
|
44
|
+
interactions?: JsScriptInteractionRecord[];
|
|
45
|
+
finalState?: unknown;
|
|
46
|
+
finalDocument?: unknown;
|
|
47
|
+
}) => Promise<JsScriptDebugReport>;
|
|
48
|
+
renderJsScriptReportMarkdown: (report: JsScriptDebugReport) => string;
|
|
49
|
+
}
|
|
50
|
+
/** Executes a script body in the sandbox. */
|
|
51
|
+
export type JsScriptExecutor = (document: JsScriptDocument, inputs: Record<string, unknown>, inputStreams?: Record<string, unknown[]>,
|
|
52
|
+
/**
|
|
53
|
+
* The script's own row id, for a target loaded from the database. Seeds
|
|
54
|
+
* the run's context with the same call-chain key `run_js_script` sets
|
|
55
|
+
* (`JS_SCRIPT_CHAIN_KEY`, via `enterJsScript`), so a body that runs
|
|
56
|
+
* another JS script sees this run in the chain the same way it would
|
|
57
|
+
* through the capability path — a cycle or the depth cap is refused the
|
|
58
|
+
* same way. Absent for a file target, which has no row to chain from.
|
|
59
|
+
*/
|
|
60
|
+
scriptId?: string) => Promise<JsScriptRunResult>;
|
|
61
|
+
/** The bridge surface this host drives — one tool per `ui_jsscript_*` name. */
|
|
62
|
+
export interface JsScriptBridgeTool {
|
|
63
|
+
name: string;
|
|
64
|
+
/**
|
|
65
|
+
* HOLDOUT (anti-slop/no-unknown-returns): a `ui_jsscript_*` tool answers in
|
|
66
|
+
* the open tool-result domain, and the bridge that implements this lives in
|
|
67
|
+
* `@nodetool-ai/agents`.
|
|
68
|
+
*/
|
|
69
|
+
execute: (args: Record<string, unknown>) => Promise<unknown>;
|
|
70
|
+
}
|
|
71
|
+
export interface JsScriptBridge {
|
|
72
|
+
tools: JsScriptBridgeTool[];
|
|
73
|
+
document: () => JsScriptDocument;
|
|
74
|
+
finalState: () => JsScriptBridgeFinalState;
|
|
75
|
+
}
|
|
76
|
+
export type CreateJsScriptBridge = (initial: {
|
|
77
|
+
name?: string;
|
|
78
|
+
document?: Partial<JsScriptDocument>;
|
|
79
|
+
}) => JsScriptBridge;
|
|
80
|
+
export interface JsScriptDebugDeps extends JsScriptTargetDeps {
|
|
81
|
+
/** Defaults to `@nodetool-ai/execution/js-script-debug`. */
|
|
82
|
+
core?: JsScriptDebugCore;
|
|
83
|
+
/** Defaults to `runCodeBody` from `@nodetool-ai/agents`. */
|
|
84
|
+
execute?: JsScriptExecutor;
|
|
85
|
+
/** Defaults to `createJsScriptToolBridge` from `@nodetool-ai/agents`. */
|
|
86
|
+
createBridge?: CreateJsScriptBridge;
|
|
87
|
+
/** Grades saved cases; defaults to `gradeCodeCases` from `@nodetool-ai/agents`. */
|
|
88
|
+
grade?: (document: JsScriptDocument, execute: JsScriptExecutor) => Promise<JsScriptTestReport>;
|
|
89
|
+
onLog?: (line: string) => void;
|
|
90
|
+
}
|
|
91
|
+
export interface JsScriptValidateResult {
|
|
92
|
+
target: ResolvedJsScriptTarget["target"];
|
|
93
|
+
validation: JsScriptValidation;
|
|
94
|
+
}
|
|
95
|
+
export interface JsScriptDebugResult {
|
|
96
|
+
report: JsScriptDebugReport;
|
|
97
|
+
bundleDir: string;
|
|
98
|
+
}
|
|
99
|
+
/** Load a script and validate it — no sandbox, no bundle. */
|
|
100
|
+
export declare function runJsScriptValidate(ref: string, deps: JsScriptDebugDeps): Promise<JsScriptValidateResult>;
|
|
101
|
+
export interface JsScriptRunOutcome {
|
|
102
|
+
target: ResolvedJsScriptTarget["target"];
|
|
103
|
+
result: JsScriptRunResult;
|
|
104
|
+
}
|
|
105
|
+
/** Run a script once with the given inputs. */
|
|
106
|
+
export declare function runJsScriptOnce(ref: string, inputs: Record<string, unknown>, deps: JsScriptDebugDeps, inputStreams?: Record<string, unknown[]>): Promise<JsScriptRunOutcome>;
|
|
107
|
+
export interface JsScriptTestOutcome {
|
|
108
|
+
target: ResolvedJsScriptTarget["target"];
|
|
109
|
+
report: JsScriptTestReport;
|
|
110
|
+
}
|
|
111
|
+
/** Run a script's saved cases and grade them. */
|
|
112
|
+
export declare function runJsScriptTests(ref: string, deps: JsScriptDebugDeps): Promise<JsScriptTestOutcome>;
|
|
113
|
+
/**
|
|
114
|
+
* Replay `--interact` against the headless bridge and write the bundle.
|
|
115
|
+
*
|
|
116
|
+
* A failing step is recorded and the script continues: a run that stops at the
|
|
117
|
+
* first error hides every problem behind it, and the report is what the caller
|
|
118
|
+
* came for.
|
|
119
|
+
*/
|
|
120
|
+
export declare function runJsScriptDebug(ref: string, options: {
|
|
121
|
+
interact?: JsScriptInteractionStep[];
|
|
122
|
+
outDir?: string;
|
|
123
|
+
}, deps: JsScriptDebugDeps): Promise<JsScriptDebugResult>;
|
|
124
|
+
//# sourceMappingURL=harness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harness.d.ts","sourceRoot":"","sources":["../../src/js-script-debug/harness.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iDAAiD,CAAC;AACxF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AAErB,6EAA6E;AAC7E,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,IAAI,EAAE,MAAM,EAAE,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
+
/**
|
|
2
|
+
* The JS-script harness: the CLI host around the shared validator and the
|
|
3
|
+
* sandbox.
|
|
4
|
+
*
|
|
5
|
+
* `runJsScriptValidate` is the cheap pre-flight — load a document, check it,
|
|
6
|
+
* report. `runJsScriptRun` and `runJsScriptTest` execute the body through
|
|
7
|
+
* `runCodeBody`, the same core the `run_js_script` capability and the run
|
|
8
|
+
* endpoint use. `runJsScriptDebug` additionally replays a scripted session
|
|
9
|
+
* against the headless `ui_jsscript_*` bridge (the one the tool-loop eval
|
|
10
|
+
* drives), validates the document the session left behind, and writes a
|
|
11
|
+
* self-contained bundle.
|
|
12
|
+
*
|
|
13
|
+
* Everything heavy is injected with a lazy default: the validator core
|
|
14
|
+
* (`@nodetool-ai/execution/js-script-debug`), the sandbox runner and the bridge
|
|
15
|
+
* factory (`@nodetool-ai/agents`). Tests supply their own and load neither.
|
|
16
|
+
*/
|
|
17
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
18
|
+
import { join, resolve } from "node:path";
|
|
19
|
+
import { runInteractionSteps } from "../interaction-script.js";
|
|
20
|
+
import { resolveJsScriptTarget } from "./target.js";
|
|
21
|
+
async function loadCore() {
|
|
22
|
+
const core = await import("@nodetool-ai/execution/js-script-debug");
|
|
23
|
+
return {
|
|
24
|
+
validateJsScriptDoc: (raw, options) => core.validateJsScriptDoc(raw, options),
|
|
25
|
+
buildJsScriptDebugReport: (input) => core.buildJsScriptDebugReport(input),
|
|
26
|
+
renderJsScriptReportMarkdown: (report) => core.renderJsScriptReportMarkdown(report)
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The default executor: one `ProcessingContext` per run, the document's own
|
|
31
|
+
* packages, secrets and timeout, and the Code-node toolbelt — the same
|
|
32
|
+
* envelope the `run_js_script` capability applies.
|
|
33
|
+
*
|
|
34
|
+
* The secret store is opened only when the document declares secrets, so a
|
|
35
|
+
* file target with none stays database-free.
|
|
36
|
+
*/
|
|
37
|
+
async function loadExecutor() {
|
|
38
|
+
const { runCodeBody } = await import("@nodetool-ai/agents");
|
|
39
|
+
const { PERMISSION_GATE_CONTEXT_KEY, ProcessingContext, headlessGate } = await import("@nodetool-ai/runtime");
|
|
40
|
+
const { FileStorageAdapter } = await import("@nodetool-ai/storage");
|
|
41
|
+
const { getDefaultAssetsPath } = await import("@nodetool-ai/config");
|
|
42
|
+
const { JS_SCRIPT_MAX_TIMEOUT_SECONDS } = await import("@nodetool-ai/protocol/api-schemas/js-scripts.js");
|
|
43
|
+
// The toolbelt's `nodetool.*` modules read and write the database, so a
|
|
44
|
+
// body that saves a timeline needs it even when it declares no secrets.
|
|
45
|
+
const { initDb, getSecret } = await import("@nodetool-ai/models");
|
|
46
|
+
const { getDefaultDbPath } = await import("@nodetool-ai/config");
|
|
47
|
+
initDb(getDefaultDbPath());
|
|
48
|
+
// A body imports installed sandbox packs by name, as it does on the server.
|
|
49
|
+
const { installSandboxCatalog } = await import("../sandbox-catalog.js");
|
|
50
|
+
installSandboxCatalog();
|
|
51
|
+
let seq = 0;
|
|
52
|
+
return async (document, inputs, inputStreams, scriptId) => {
|
|
53
|
+
let secretResolver;
|
|
54
|
+
if (document.secrets.length > 0) {
|
|
55
|
+
secretResolver = getSecret;
|
|
56
|
+
}
|
|
57
|
+
const contextInit = {
|
|
58
|
+
jobId: `jsscript-cli-${++seq}`,
|
|
59
|
+
userId: "1",
|
|
60
|
+
storage: new FileStorageAdapter(getDefaultAssetsPath())
|
|
61
|
+
};
|
|
62
|
+
if (secretResolver) {
|
|
63
|
+
contextInit.secretResolver = secretResolver;
|
|
64
|
+
}
|
|
65
|
+
const context = new ProcessingContext(contextInit);
|
|
66
|
+
context.set(PERMISSION_GATE_CONTEXT_KEY, headlessGate("JS script debug"));
|
|
67
|
+
if (scriptId) {
|
|
68
|
+
// Mirrors `enterJsScript` in the `run_js_script` capability: the same
|
|
69
|
+
// chain key, so a script this run invokes sees this CLI run as part
|
|
70
|
+
// of the call chain the way it would through the capability path.
|
|
71
|
+
const { JS_SCRIPT_CHAIN_KEY } = await import("@nodetool-ai/agents");
|
|
72
|
+
context.set(JS_SCRIPT_CHAIN_KEY, [scriptId]);
|
|
73
|
+
}
|
|
74
|
+
const runOptions = {
|
|
75
|
+
code: document.code,
|
|
76
|
+
inputs,
|
|
77
|
+
secrets: document.secrets,
|
|
78
|
+
timeoutSeconds: Math.min(document.timeoutSeconds, JS_SCRIPT_MAX_TIMEOUT_SECONDS),
|
|
79
|
+
withToolbelt: true
|
|
80
|
+
};
|
|
81
|
+
if (inputStreams) {
|
|
82
|
+
runOptions.inputStreams = inputStreams;
|
|
83
|
+
}
|
|
84
|
+
return runCodeBody(context, runOptions);
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
async function loadGrader() {
|
|
88
|
+
const { gradeCodeCases } = await import("@nodetool-ai/agents");
|
|
89
|
+
return async (document, execute) => {
|
|
90
|
+
const report = await gradeCodeCases(document.tests.map((testCase, index) => {
|
|
91
|
+
const graded = {
|
|
92
|
+
name: testCase.name.trim() !== "" ? testCase.name : `case ${index + 1}`,
|
|
93
|
+
inputs: testCase.inputs ?? {}
|
|
94
|
+
};
|
|
95
|
+
if (testCase.inputStreams) {
|
|
96
|
+
graded.inputStreams = testCase.inputStreams;
|
|
97
|
+
}
|
|
98
|
+
if (testCase.expect) {
|
|
99
|
+
graded.expect = testCase.expect;
|
|
100
|
+
}
|
|
101
|
+
if (testCase.expectedStreamed) {
|
|
102
|
+
graded.expectedStreamed = testCase.expectedStreamed;
|
|
103
|
+
}
|
|
104
|
+
return graded;
|
|
105
|
+
}), (testCase) => execute(document, testCase.inputs, testCase.inputStreams));
|
|
106
|
+
return report;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
async function loadBridgeFactory() {
|
|
110
|
+
const { createJsScriptToolBridge } = await import("@nodetool-ai/agents");
|
|
111
|
+
return (initial) =>
|
|
112
|
+
// SAFETY: the eval-surface bridge in @nodetool-ai/agents implements this
|
|
113
|
+
// exact tool list and snapshot — it is the bridge this type describes. The
|
|
114
|
+
// two packages declare the script document types independently, and that
|
|
115
|
+
// duplication is the only reason the structures do not line up.
|
|
116
|
+
createJsScriptToolBridge(initial);
|
|
117
|
+
}
|
|
118
|
+
function defaultOutDir(ref) {
|
|
119
|
+
const slug = ref
|
|
120
|
+
.replace(/[^a-zA-Z0-9_-]+/g, "-")
|
|
121
|
+
.replace(/^-+|-+$/g, "")
|
|
122
|
+
.slice(0, 40) || "jsscript";
|
|
123
|
+
const stamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
124
|
+
return resolve(`nodetool-debug/jsscript-${slug}-${stamp}`);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The document a target carries, parsed against the schema so the executor
|
|
128
|
+
* gets defaults for anything the file left out. A document that does not parse
|
|
129
|
+
* has already been reported by validation, so this is only reached on a sound
|
|
130
|
+
* one.
|
|
131
|
+
*/
|
|
132
|
+
async function asDocument(raw) {
|
|
133
|
+
const { jsScriptDocument } = await import("@nodetool-ai/protocol/api-schemas/js-scripts.js");
|
|
134
|
+
const parsed = jsScriptDocument.safeParse(raw);
|
|
135
|
+
if (!parsed.success) {
|
|
136
|
+
throw new Error(`The document does not parse: ${parsed.error.issues
|
|
137
|
+
.map((issue) => `${issue.path.join(".") || "document"}: ${issue.message}`)
|
|
138
|
+
.join("; ")}`);
|
|
139
|
+
}
|
|
140
|
+
return parsed.data;
|
|
141
|
+
}
|
|
142
|
+
/** Load a script and validate it — no sandbox, no bundle. */
|
|
143
|
+
export async function runJsScriptValidate(ref, deps) {
|
|
144
|
+
const resolved = await resolveJsScriptTarget(ref, deps);
|
|
145
|
+
const core = deps.core ?? (await loadCore());
|
|
146
|
+
const { discoverPackDtsSources } = await import("../sandbox-catalog.js");
|
|
147
|
+
const validation = await core.validateJsScriptDoc(resolved.raw, {
|
|
148
|
+
packDtsSources: discoverPackDtsSources()
|
|
149
|
+
});
|
|
150
|
+
return { target: resolved.target, validation };
|
|
151
|
+
}
|
|
152
|
+
/** Run a script once with the given inputs. */
|
|
153
|
+
export async function runJsScriptOnce(ref, inputs, deps, inputStreams) {
|
|
154
|
+
const resolved = await resolveJsScriptTarget(ref, deps);
|
|
155
|
+
const document = await asDocument(resolved.raw);
|
|
156
|
+
if (inputStreams) {
|
|
157
|
+
const declared = new Set(document.inputs.map((port) => port.name));
|
|
158
|
+
const undeclared = Object.keys(inputStreams).filter((handle) => !declared.has(handle));
|
|
159
|
+
if (undeclared.length > 0) {
|
|
160
|
+
throw new Error(`--input-streams names ${undeclared.join(", ")}, which the script does ` +
|
|
161
|
+
`not declare as inputs (declared: ${[...declared].join(", ") || "none"}).`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
const execute = deps.execute ?? (await loadExecutor());
|
|
165
|
+
const scriptId = resolved.target.kind === "id" ? resolved.target.ref : undefined;
|
|
166
|
+
return {
|
|
167
|
+
target: resolved.target,
|
|
168
|
+
result: await execute(document, inputs, inputStreams, scriptId)
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
/** Run a script's saved cases and grade them. */
|
|
172
|
+
export async function runJsScriptTests(ref, deps) {
|
|
173
|
+
const resolved = await resolveJsScriptTarget(ref, deps);
|
|
174
|
+
const document = await asDocument(resolved.raw);
|
|
175
|
+
if (document.tests.length === 0) {
|
|
176
|
+
throw new Error(`${ref} has no saved test cases; there is nothing to run. Add some to the document's \`tests\`.`);
|
|
177
|
+
}
|
|
178
|
+
const execute = deps.execute ?? (await loadExecutor());
|
|
179
|
+
const grade = deps.grade ?? (await loadGrader());
|
|
180
|
+
return { target: resolved.target, report: await grade(document, execute) };
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Replay `--interact` against the headless bridge and write the bundle.
|
|
184
|
+
*
|
|
185
|
+
* A failing step is recorded and the script continues: a run that stops at the
|
|
186
|
+
* first error hides every problem behind it, and the report is what the caller
|
|
187
|
+
* came for.
|
|
188
|
+
*/
|
|
189
|
+
export async function runJsScriptDebug(ref, options, deps) {
|
|
190
|
+
const resolved = await resolveJsScriptTarget(ref, deps);
|
|
191
|
+
const core = deps.core ?? (await loadCore());
|
|
192
|
+
const steps = options.interact ?? [];
|
|
193
|
+
const interactions = [];
|
|
194
|
+
let snapshot;
|
|
195
|
+
let finalDocument;
|
|
196
|
+
if (steps.length > 0) {
|
|
197
|
+
const createBridge = deps.createBridge ?? (await loadBridgeFactory());
|
|
198
|
+
const bridgeInit = {
|
|
199
|
+
document: await asDocument(resolved.raw)
|
|
200
|
+
};
|
|
201
|
+
if (resolved.target.name) {
|
|
202
|
+
bridgeInit.name = resolved.target.name;
|
|
203
|
+
}
|
|
204
|
+
const bridge = createBridge(bridgeInit);
|
|
205
|
+
interactions.push(...(await runInteractionSteps(steps, bridge.tools, "JS script", deps.onLog)));
|
|
206
|
+
snapshot = bridge.finalState();
|
|
207
|
+
finalDocument = bridge.document();
|
|
208
|
+
}
|
|
209
|
+
const reportInput = {
|
|
210
|
+
target: resolved.target,
|
|
211
|
+
document: resolved.raw,
|
|
212
|
+
interactions
|
|
213
|
+
};
|
|
214
|
+
if (snapshot !== undefined) {
|
|
215
|
+
reportInput.finalState = snapshot;
|
|
216
|
+
}
|
|
217
|
+
if (finalDocument !== undefined) {
|
|
218
|
+
reportInput.finalDocument = finalDocument;
|
|
219
|
+
}
|
|
220
|
+
const report = await core.buildJsScriptDebugReport(reportInput);
|
|
221
|
+
const bundleDir = options.outDir
|
|
222
|
+
? resolve(options.outDir)
|
|
223
|
+
: defaultOutDir(ref);
|
|
224
|
+
await mkdir(bundleDir, { recursive: true });
|
|
225
|
+
await writeFile(join(bundleDir, "jsscript.json"), JSON.stringify(resolved.raw, null, 2), "utf8");
|
|
226
|
+
await writeFile(join(bundleDir, "report.json"), JSON.stringify(report, null, 2), "utf8");
|
|
227
|
+
await writeFile(join(bundleDir, "report.md"), core.renderJsScriptReportMarkdown(report), "utf8");
|
|
228
|
+
return { report, bundleDir };
|
|
229
|
+
}
|
|
230
|
+
//# sourceMappingUR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|
|
1
|
+
/**
|
|
2
|
+
* The CLI host for the JS-script harness: target resolution, the `--interact`
|
|
3
|
+
* script, sandbox execution, and the bundle writer. The rules themselves live
|
|
4
|
+
* in `@nodetool-ai/execution/js-script-debug`.
|
|
5
|
+
*/
|
|
6
|
+
export { runJsScriptValidate, runJsScriptOnce, runJsScriptTests, runJsScriptDebug, type CreateJsScriptBridge, type JsScriptBridge, type JsScriptBridgeTool, type JsScriptCaseResult, type JsScriptDebugCore, type JsScriptDebugDeps, type JsScriptDebugResult, type JsScriptExecutor, type JsScriptRunOutcome, type JsScriptRunResult, type JsScriptTestOutcome, type JsScriptTestReport, type JsScriptValidateResult } from "./harness.js";
|
|
7
|
+
export { normalizeToolName, parseInteractionScript, type JsScriptInteractionStep } from "./interactions.js";
|
|
8
|
+
export { resolveJsScriptTarget, type JsScriptRecord, type JsScriptTargetDeps, type ResolvedJsScriptTarget } from "./target.js";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/js-script-debug/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC5B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,KAAK,uBAAuB,EAC7B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,qBAAqB,EACrB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC5B,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLI host for the JS-script harness: target resolution, the `--interact`
|
|
3
|
+
* script, sandbox execution, and the bundle writer. The rules themselves live
|
|
4
|
+
* in `@nodetool-ai/execution/js-script-debug`.
|
|
5
|
+
*/
|
|
6
|
+
export { runJsScriptValidate, runJsScriptOnce, runJsScriptTests, runJsScriptDebug } from "./harness.js";
|
|
7
|
+
export { normalizeToolName, parseInteractionScript } from "./interactions.js";
|
|
8
|
+
export { resolveJsScriptTarget } from "./target.js";
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/js-script-debug/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAcjB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EAEvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,qBAAqB,EAItB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `--interact` script for `nodetool jsscript debug`.
|
|
3
|
+
*
|
|
4
|
+
* A step names one JS-script tool and the input to call it with:
|
|
5
|
+
*
|
|
6
|
+
* ```json
|
|
7
|
+
* [{"tool": "set_ports", "input": {"outputs": [{"name": "total", "type": "int"}]}},
|
|
8
|
+
* {"tool": "ui_jsscript_set_code",
|
|
9
|
+
* "input": {"code": "await output(\"total\", 1);"}}]
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* Both spellings resolve to the same tool: the `ui_jsscript_` prefix is what
|
|
13
|
+
* the bridge and the browser call it, and typing it for every step is noise.
|
|
14
|
+
*/
|
|
15
|
+
import { type InteractionStep } from "../interaction-script.js";
|
|
16
|
+
/** One parsed step, with the tool name in its canonical `ui_jsscript_*` form. */
|
|
17
|
+
export type JsScriptInteractionStep = InteractionStep;
|
|
18
|
+
export declare const normalizeToolName: (name: string) => string, parseInteractionScript: (json: string) => InteractionStep[];
|
|
19
|
+
//# sourceMappingURL=interactions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactions.d.ts","sourceRoot":"","sources":["../../src/js-script-debug/interactions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,0BAA0B,CAAC;AAElC,iFAAiF;AACjF,MAAM,MAAM,uBAAuB,GAAG,eAAe,CAAC;AAEtD,eAAO,MAAQ,iBAAiB,4BAAE,sBAAsB,qCAIrD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `--interact` script for `nodetool jsscript debug`.
|
|
3
|
+
*
|
|
4
|
+
* A step names one JS-script tool and the input to call it with:
|
|
5
|
+
*
|
|
6
|
+
* ```json
|
|
7
|
+
* [{"tool": "set_ports", "input": {"outputs": [{"name": "total", "type": "int"}]}},
|
|
8
|
+
* {"tool": "ui_jsscript_set_code",
|
|
9
|
+
* "input": {"code": "await output(\"total\", 1);"}}]
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* Both spellings resolve to the same tool: the `ui_jsscript_` prefix is what
|
|
13
|
+
* the bridge and the browser call it, and typing it for every step is noise.
|
|
14
|
+
*/
|
|
15
|
+
import { createInteractionScript } from "../interaction-script.js";
|
|
16
|
+
export const { normalizeToolName, parseInteractionScript } = createInteractionScript("ui_jsscript_", '{"tool":"set_code","input":{"code":"..."}}');
|
|
17
|
+
//# sourceMappingURL=interactions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactions.js","sourceRoot":"","sources":["../../src/js-script-debug/interactions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EACL,uBAAuB,EAExB,MAAM,0BAA0B,CAAC;AAKlC,MAAM,CAAC,MAAM,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,GACxD,uBAAuB,CACrB,cAAc,EACd,4CAA4C,CAC7C,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { JsScriptDebugTarget } from "@nodetool-ai/execution/js-script-debug";
|
|
2
|
+
/** A `js_scripts` row as the harness needs it. */
|
|
3
|
+
export interface JsScriptRecord {
|
|
4
|
+
id: string;
|
|
5
|
+
name?: string | null;
|
|
6
|
+
/** The stored document — a JSON string or an already-parsed object. */
|
|
7
|
+
document: unknown;
|
|
8
|
+
}
|
|
9
|
+
export interface JsScriptTargetDeps {
|
|
10
|
+
/** Load a script by DB id. */
|
|
11
|
+
loadScript: (id: string) => Promise<JsScriptRecord | null>;
|
|
12
|
+
}
|
|
13
|
+
export interface ResolvedJsScriptTarget {
|
|
14
|
+
target: JsScriptDebugTarget;
|
|
15
|
+
/** The document exactly as loaded — validation's input, unrepaired. */
|
|
16
|
+
raw: unknown;
|
|
17
|
+
}
|
|
18
|
+
/** Resolve a JS-script target: a JSON file path or a `js_scripts` row id. */
|
|
19
|
+
export declare function resolveJsScriptTarget(ref: string, deps: JsScriptTargetDeps): Promise<ResolvedJsScriptTarget>;
|
|
20
|
+
//# sourceMappingURL=target.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../src/js-script-debug/target.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAelF,kDAAkD;AAClD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,uEAAuE;IACvE,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,8BAA8B;IAC9B,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;CAC5D;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,uEAAuE;IACvE,GAAG,EAAE,OAAO,CAAC;CACd;AA8BD,6EAA6E;AAC7E,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,sBAAsB,CAAC,CAkCjC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves a JS-script debug target into a document plus its name.
|
|
3
|
+
*
|
|
4
|
+
* A script is named two ways, and both end up in the same shape:
|
|
5
|
+
*
|
|
6
|
+
* - a **JSON file** — either a bare `JsScriptDocument` or a wrapper carrying
|
|
7
|
+
* one under `document`, as the `js_scripts` row and the `jsScripts.get`
|
|
8
|
+
* response do;
|
|
9
|
+
* - a **`js_scripts` row id**, read through an injected loader so this module
|
|
10
|
+
* needs no database.
|
|
11
|
+
*
|
|
12
|
+
* A path that exists on disk wins over an id, so a file named like an id is
|
|
13
|
+
* still readable.
|
|
14
|
+
*/
|
|
15
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
16
|
+
import { isRecord, isString } from "../predicates.js";
|
|
17
|
+
/**
|
|
18
|
+
* The document a target carries, unwrapping a `document` field (string or
|
|
19
|
+
* object) when there is one. Never throws — an unreadable document is a
|
|
20
|
+
* validation finding, not a crash.
|
|
21
|
+
*/
|
|
22
|
+
function documentOf(raw) {
|
|
23
|
+
// SAFETY: a target is read from a JSON file or a json column, so every
|
|
24
|
+
// branch below carries decoded JSON.
|
|
25
|
+
if (!isRecord(raw))
|
|
26
|
+
return raw;
|
|
27
|
+
const inner = raw.document;
|
|
28
|
+
if (isString(inner)) {
|
|
29
|
+
try {
|
|
30
|
+
return JSON.parse(inner);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return inner;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// SAFETY: same JSON provenance as the branch above.
|
|
37
|
+
if (inner !== undefined)
|
|
38
|
+
return inner;
|
|
39
|
+
return raw;
|
|
40
|
+
}
|
|
41
|
+
/** A document is anything carrying a `code` string and a `schemaVersion`. */
|
|
42
|
+
const looksLikeDocument = (value) => isRecord(value) &&
|
|
43
|
+
isString(value.code) &&
|
|
44
|
+
value.schemaVersion !== undefined;
|
|
45
|
+
/** Resolve a JS-script target: a JSON file path or a `js_scripts` row id. */
|
|
46
|
+
export async function resolveJsScriptTarget(ref, deps) {
|
|
47
|
+
if (existsSync(ref)) {
|
|
48
|
+
let parsed;
|
|
49
|
+
try {
|
|
50
|
+
parsed = JSON.parse(readFileSync(ref, "utf8"));
|
|
51
|
+
}
|
|
52
|
+
catch (e) {
|
|
53
|
+
throw new Error(`${ref} is not valid JSON: ${e.message}`);
|
|
54
|
+
}
|
|
55
|
+
const raw = documentOf(parsed);
|
|
56
|
+
if (!looksLikeDocument(raw)) {
|
|
57
|
+
throw new Error(`${ref} is not a JS script document (no \`schemaVersion\`/\`code\`, and no \`document\` field carrying them).`);
|
|
58
|
+
}
|
|
59
|
+
const name = isRecord(parsed) && isString(parsed.name)
|
|
60
|
+
? parsed.name
|
|
61
|
+
: undefined;
|
|
62
|
+
const target = { kind: "file", ref };
|
|
63
|
+
if (name) {
|
|
64
|
+
target.name = name;
|
|
65
|
+
}
|
|
66
|
+
return { target, raw };
|
|
67
|
+
}
|
|
68
|
+
const record = await deps.loadScript(ref);
|
|
69
|
+
if (!record) {
|
|
70
|
+
throw new Error(`JS script not found: ${ref}`);
|
|
71
|
+
}
|
|
72
|
+
const target = { kind: "id", ref };
|
|
73
|
+
if (record.name) {
|
|
74
|
+
target.name = record.name;
|
|
75
|
+
}
|
|
76
|
+
return { target, raw: documentOf(record) };
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=target.js.map
|
|
@@ -0,0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|
|
5
|
+
* Installed process-wide by each command that runs a graph, so every context
|
|
6
|
+
* built downstream answers the same way. Wiring it per-entrance is what let
|
|
7
|
+
* `nodetool debug` and `nodetool workflows run` disagree: a workflow that
|
|
8
|
+
* saved an image ran under one and threw "ProcessingContext model interface
|
|
9
|
+
* 'createAsset' is not configured" under the other.
|
|
10
|
+
*
|
|
11
|
+
* `createAsset` is the server's own implementation, imported rather than
|
|
12
|
+
* rewritten — the local copy this replaced wrote no thumbnail and left
|
|
13
|
+
* `parent_id` null, so a CLI-generated asset was invisible in every
|
|
14
|
+
* folder-scoped listing in the UI.
|
|
15
|
+
*/
|
|
16
|
+
import type { ProcessingContextModelInterfaces } from "@nodetool-ai/runtime";
|
|
17
|
+
export declare function localModelInterfaces(): Promise<ProcessingContextModelInterfaces>;
|
|
18
|
+
/** Install them as this process's default, once. */
|
|
19
|
+
export declare function installLocalModelInterfaces(): Promise<void>;
|
|
20
|
+
//# sourceMappingURL=local-model-interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-model-interfaces.d.ts","sourceRoot":"","sources":["../src/local-model-interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AAG7E,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,gCAAgC,CAAC,CAgBtF;AAID,oDAAoD;AACpD,wBAAgB,2BAA2B,IAAI,OAAO,CAAC,IAAI,CAAC,CAO3D"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The persistence a local (no-server) run gets: assets and timeline sequences,
|
|
3
|
+
* against the same database `setupDb()` opens.
|
|
4
|
+
*
|
|
5
|
+
* Installed process-wide by each command that runs a graph, so every context
|
|
6
|
+
* built downstream answers the same way. Wiring it per-entrance is what let
|
|
7
|
+
* `nodetool debug` and `nodetool workflows run` disagree: a workflow that
|
|
8
|
+
* saved an image ran under one and threw "ProcessingContext model interface
|
|
9
|
+
* 'createAsset' is not configured" under the other.
|
|
10
|
+
*
|
|
11
|
+
* `createAsset` is the server's own implementation, imported rather than
|
|
12
|
+
* rewritten — the local copy this replaced wrote no thumbnail and left
|
|
13
|
+
* `parent_id` null, so a CLI-generated asset was invisible in every
|
|
14
|
+
* folder-scoped listing in the UI.
|
|
15
|
+
*/
|
|
16
|
+
import { setDefaultModelInterfaces } from "@nodetool-ai/runtime";
|
|
17
|
+
export async function localModelInterfaces() {
|
|
18
|
+
// The `/assets` subpath, not the package root: the root entry pulls in the
|
|
19
|
+
// WebSocket runner and the HTTP server, which a local run does not need.
|
|
20
|
+
const { createAssetModelInterface, updateAssetBytesModelInterface } = await import("@nodetool-ai/websocket/assets");
|
|
21
|
+
// Storyboards, the entity library and the game templates, from the same
|
|
22
|
+
// module the server installs — a harness run has to write the rows a server
|
|
23
|
+
// run writes, or it proves nothing about the server.
|
|
24
|
+
const { documentModelInterfaces } = await import("@nodetool-ai/websocket/documents");
|
|
25
|
+
return {
|
|
26
|
+
createAsset: createAssetModelInterface,
|
|
27
|
+
updateAssetBytes: updateAssetBytesModelInterface,
|
|
28
|
+
...documentModelInterfaces()
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
let installed = null;
|
|
32
|
+
/** Install them as this process's default, once. */
|
|
33
|
+
export function installLocalModelInterfaces() {
|
|
34
|
+
if (!installed) {
|
|
35
|
+
installed = localModelInterfaces().then((interfaces) => {
|
|
36
|
+
setDefaultModelInterfaces(interfaces);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return installed;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=local-model-interfaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-model-interfaces.js","sourceRoot":"","sources":["../src/local-model-interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,MAAM,CAAC,KAAK,UAAU,oBAAoB;IACxC,2EAA2E;IAC3E,yEAAyE;IACzE,MAAM,EAAE,yBAAyB,EAAE,8BAA8B,EAAE,GACjE,MAAM,MAAM,CAAC,+BAA+B,CAAC,CAAC;IAChD,wEAAwE;IACxE,4EAA4E;IAC5E,qDAAqD;IACrD,MAAM,EAAE,uBAAuB,EAAE,GAAG,MAAM,MAAM,CAC9C,kCAAkC,CACnC,CAAC;IACF,OAAO;QACL,WAAW,EAAE,yBAAyB;QACtC,gBAAgB,EAAE,8BAA8B;QAChD,GAAG,uBAAuB,EAAE;KAC7B,CAAC;AACJ,CAAC;AAED,IAAI,SAAS,GAAyB,IAAI,CAAC;AAE3C,oDAAoD;AACpD,MAAM,UAAU,2BAA2B;IACzC,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,SAAS,GAAG,oBAAoB,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE;YACrD,yBAAyB,CAAC,UAAU,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-secrets.d.ts","sourceRoot":"","sources":["../src/local-secrets.ts"],"names":[],"mappings":"AAaA,4EAA4E;AAC5E,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAEtE"}
|