@nodetool-ai/cli 0.8.8 → 0.8.9-beta.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 +61 -109
- package/dist/.nodetool-build-stamp +1 -1
- package/dist/chat.d.ts +3 -0
- package/dist/chat.d.ts.map +1 -0
- package/dist/chat.js +8 -0
- package/dist/chat.js.map +1 -0
- package/dist/index.d.ts +1 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -231
- package/dist/index.js.map +1 -1
- package/dist/lean/commandFeatures.d.ts +3 -0
- package/dist/lean/commandFeatures.d.ts.map +1 -0
- package/dist/lean/commandFeatures.js +21 -0
- package/dist/lean/commandFeatures.js.map +1 -0
- package/dist/lean/errors.d.ts +19 -0
- package/dist/lean/errors.d.ts.map +1 -0
- package/dist/lean/errors.js +20 -0
- package/dist/lean/errors.js.map +1 -0
- package/dist/lean/program.d.ts +12 -0
- package/dist/lean/program.d.ts.map +1 -0
- package/dist/lean/program.js +398 -0
- package/dist/lean/program.js.map +1 -0
- package/dist/nodetool.js +6 -29
- package/dist/nodetool.js.map +1 -1
- package/package.json +14 -67
- package/dist/ExecutionTree.d.ts +0 -20
- package/dist/ExecutionTree.d.ts.map +0 -1
- package/dist/ExecutionTree.js +0 -100
- package/dist/ExecutionTree.js.map +0 -1
- package/dist/affected/affected.d.ts +0 -48
- package/dist/affected/affected.d.ts.map +0 -1
- package/dist/affected/affected.js +0 -167
- package/dist/affected/affected.js.map +0 -1
- package/dist/agent-toolbelt.d.ts +0 -15
- package/dist/agent-toolbelt.d.ts.map +0 -1
- package/dist/agent-toolbelt.js +0 -28
- package/dist/agent-toolbelt.js.map +0 -1
- package/dist/api-client.d.ts +0 -12
- package/dist/api-client.d.ts.map +0 -1
- package/dist/api-client.js +0 -21
- package/dist/api-client.js.map +0 -1
- package/dist/app-build/bundle.d.ts +0 -15
- package/dist/app-build/bundle.d.ts.map +0 -1
- package/dist/app-build/bundle.js +0 -45
- package/dist/app-build/bundle.js.map +0 -1
- package/dist/app-build/watch.d.ts +0 -13
- package/dist/app-build/watch.d.ts.map +0 -1
- package/dist/app-build/watch.js +0 -25
- package/dist/app-build/watch.js.map +0 -1
- package/dist/app-debug/app-target.d.ts +0 -14
- package/dist/app-debug/app-target.d.ts.map +0 -1
- package/dist/app-debug/app-target.js +0 -120
- package/dist/app-debug/app-target.js.map +0 -1
- package/dist/app-debug/harness.d.ts +0 -29
- package/dist/app-debug/harness.d.ts.map +0 -1
- package/dist/app-debug/harness.js +0 -116
- package/dist/app-debug/harness.js.map +0 -1
- package/dist/app-debug/index.d.ts +0 -12
- package/dist/app-debug/index.d.ts.map +0 -1
- package/dist/app-debug/index.js +0 -9
- package/dist/app-debug/index.js.map +0 -1
- package/dist/app.d.ts +0 -40
- package/dist/app.d.ts.map +0 -1
- package/dist/app.js +0 -1070
- package/dist/app.js.map +0 -1
- package/dist/bash-tool.d.ts +0 -13
- package/dist/bash-tool.d.ts.map +0 -1
- package/dist/bash-tool.js +0 -85
- package/dist/bash-tool.js.map +0 -1
- package/dist/chat-codeact.d.ts +0 -93
- package/dist/chat-codeact.d.ts.map +0 -1
- package/dist/chat-codeact.js +0 -179
- package/dist/chat-codeact.js.map +0 -1
- package/dist/chat-context.d.ts +0 -18
- package/dist/chat-context.d.ts.map +0 -1
- package/dist/chat-context.js +0 -32
- package/dist/chat-context.js.map +0 -1
- package/dist/chat-media.d.ts +0 -3
- package/dist/chat-media.d.ts.map +0 -1
- package/dist/chat-media.js +0 -46
- package/dist/chat-media.js.map +0 -1
- package/dist/chat-prompts.d.ts +0 -20
- package/dist/chat-prompts.d.ts.map +0 -1
- package/dist/chat-prompts.js +0 -42
- package/dist/chat-prompts.js.map +0 -1
- package/dist/chat-sessions.d.ts +0 -25
- package/dist/chat-sessions.d.ts.map +0 -1
- package/dist/chat-sessions.js +0 -153
- package/dist/chat-sessions.js.map +0 -1
- package/dist/child-exit.d.ts +0 -3
- package/dist/child-exit.d.ts.map +0 -1
- package/dist/child-exit.js +0 -17
- package/dist/child-exit.js.map +0 -1
- package/dist/command-errors.d.ts +0 -8
- package/dist/command-errors.d.ts.map +0 -1
- package/dist/command-errors.js +0 -49
- package/dist/command-errors.js.map +0 -1
- package/dist/commands/__tests__/jtbd.test.d.ts +0 -2
- package/dist/commands/__tests__/jtbd.test.d.ts.map +0 -1
- package/dist/commands/__tests__/jtbd.test.js +0 -120
- package/dist/commands/__tests__/jtbd.test.js.map +0 -1
- package/dist/commands/__tests__/runtime.test.d.ts +0 -2
- package/dist/commands/__tests__/runtime.test.d.ts.map +0 -1
- package/dist/commands/__tests__/runtime.test.js +0 -129
- package/dist/commands/__tests__/runtime.test.js.map +0 -1
- package/dist/commands/__tests__/timeline-render-audio.test.d.ts +0 -2
- package/dist/commands/__tests__/timeline-render-audio.test.d.ts.map +0 -1
- package/dist/commands/__tests__/timeline-render-audio.test.js +0 -53
- package/dist/commands/__tests__/timeline-render-audio.test.js.map +0 -1
- package/dist/commands/__tests__/timeline-render-completeness.test.d.ts +0 -2
- package/dist/commands/__tests__/timeline-render-completeness.test.d.ts.map +0 -1
- package/dist/commands/__tests__/timeline-render-completeness.test.js +0 -117
- package/dist/commands/__tests__/timeline-render-completeness.test.js.map +0 -1
- package/dist/commands/__tests__/timeline-render.test.d.ts +0 -2
- package/dist/commands/__tests__/timeline-render.test.d.ts.map +0 -1
- package/dist/commands/__tests__/timeline-render.test.js +0 -115
- package/dist/commands/__tests__/timeline-render.test.js.map +0 -1
- package/dist/commands/__tests__/timeline-score.test.d.ts +0 -2
- package/dist/commands/__tests__/timeline-score.test.d.ts.map +0 -1
- package/dist/commands/__tests__/timeline-score.test.js +0 -100
- package/dist/commands/__tests__/timeline-score.test.js.map +0 -1
- package/dist/commands/affected.d.ts +0 -9
- package/dist/commands/affected.d.ts.map +0 -1
- package/dist/commands/affected.js +0 -127
- package/dist/commands/affected.js.map +0 -1
- package/dist/commands/agent.d.ts +0 -33
- package/dist/commands/agent.d.ts.map +0 -1
- package/dist/commands/agent.js +0 -514
- package/dist/commands/agent.js.map +0 -1
- package/dist/commands/app.d.ts +0 -3
- package/dist/commands/app.d.ts.map +0 -1
- package/dist/commands/app.js +0 -406
- package/dist/commands/app.js.map +0 -1
- package/dist/commands/apps.d.ts +0 -15
- package/dist/commands/apps.d.ts.map +0 -1
- package/dist/commands/apps.js +0 -274
- package/dist/commands/apps.js.map +0 -1
- package/dist/commands/auth.d.ts +0 -12
- package/dist/commands/auth.d.ts.map +0 -1
- package/dist/commands/auth.js +0 -154
- package/dist/commands/auth.js.map +0 -1
- package/dist/commands/authorized-pack-install.d.ts +0 -7
- package/dist/commands/authorized-pack-install.d.ts.map +0 -1
- package/dist/commands/authorized-pack-install.js +0 -20
- package/dist/commands/authorized-pack-install.js.map +0 -1
- package/dist/commands/collections.d.ts +0 -10
- package/dist/commands/collections.d.ts.map +0 -1
- package/dist/commands/collections.js +0 -257
- package/dist/commands/collections.js.map +0 -1
- package/dist/commands/costs.d.ts +0 -15
- package/dist/commands/costs.d.ts.map +0 -1
- package/dist/commands/costs.js +0 -201
- package/dist/commands/costs.js.map +0 -1
- package/dist/commands/db.d.ts +0 -3
- package/dist/commands/db.d.ts.map +0 -1
- package/dist/commands/db.js +0 -176
- package/dist/commands/db.js.map +0 -1
- package/dist/commands/debug-summary-output.d.ts +0 -22
- package/dist/commands/debug-summary-output.d.ts.map +0 -1
- package/dist/commands/debug-summary-output.js +0 -28
- package/dist/commands/debug-summary-output.js.map +0 -1
- package/dist/commands/debug.d.ts +0 -13
- package/dist/commands/debug.d.ts.map +0 -1
- package/dist/commands/debug.js +0 -150
- package/dist/commands/debug.js.map +0 -1
- package/dist/commands/deploy-helpers.d.ts +0 -85
- package/dist/commands/deploy-helpers.d.ts.map +0 -1
- package/dist/commands/deploy-helpers.js +0 -217
- package/dist/commands/deploy-helpers.js.map +0 -1
- package/dist/commands/deploy.d.ts +0 -7
- package/dist/commands/deploy.d.ts.map +0 -1
- package/dist/commands/deploy.js +0 -449
- package/dist/commands/deploy.js.map +0 -1
- package/dist/commands/errors.d.ts +0 -11
- package/dist/commands/errors.d.ts.map +0 -1
- package/dist/commands/errors.js +0 -177
- package/dist/commands/errors.js.map +0 -1
- package/dist/commands/eval.d.ts +0 -152
- package/dist/commands/eval.d.ts.map +0 -1
- package/dist/commands/eval.js +0 -693
- package/dist/commands/eval.js.map +0 -1
- package/dist/commands/extension.d.ts +0 -12
- package/dist/commands/extension.d.ts.map +0 -1
- package/dist/commands/extension.js +0 -30
- package/dist/commands/extension.js.map +0 -1
- package/dist/commands/game-benchmark.d.ts +0 -48
- package/dist/commands/game-benchmark.d.ts.map +0 -1
- package/dist/commands/game-benchmark.js +0 -108
- package/dist/commands/game-benchmark.js.map +0 -1
- package/dist/commands/game-smoke.d.ts +0 -3
- package/dist/commands/game-smoke.d.ts.map +0 -1
- package/dist/commands/game-smoke.js +0 -23
- package/dist/commands/game-smoke.js.map +0 -1
- package/dist/commands/game.d.ts +0 -4
- package/dist/commands/game.d.ts.map +0 -1
- package/dist/commands/game.js +0 -856
- package/dist/commands/game.js.map +0 -1
- package/dist/commands/generate.d.ts +0 -17
- package/dist/commands/generate.d.ts.map +0 -1
- package/dist/commands/generate.js +0 -326
- package/dist/commands/generate.js.map +0 -1
- package/dist/commands/generations.d.ts +0 -17
- package/dist/commands/generations.d.ts.map +0 -1
- package/dist/commands/generations.js +0 -408
- package/dist/commands/generations.js.map +0 -1
- package/dist/commands/harness.d.ts +0 -90
- package/dist/commands/harness.d.ts.map +0 -1
- package/dist/commands/harness.js +0 -892
- package/dist/commands/harness.js.map +0 -1
- package/dist/commands/install-missing-packs.d.ts +0 -21
- package/dist/commands/install-missing-packs.d.ts.map +0 -1
- package/dist/commands/install-missing-packs.js +0 -48
- package/dist/commands/install-missing-packs.js.map +0 -1
- package/dist/commands/js-script-validation-output.d.ts +0 -7
- package/dist/commands/js-script-validation-output.d.ts.map +0 -1
- package/dist/commands/js-script-validation-output.js +0 -5
- package/dist/commands/js-script-validation-output.js.map +0 -1
- package/dist/commands/js-script-versions.d.ts +0 -53
- package/dist/commands/js-script-versions.d.ts.map +0 -1
- package/dist/commands/js-script-versions.js +0 -89
- package/dist/commands/js-script-versions.js.map +0 -1
- package/dist/commands/js-script.d.ts +0 -29
- package/dist/commands/js-script.d.ts.map +0 -1
- package/dist/commands/js-script.js +0 -240
- package/dist/commands/js-script.js.map +0 -1
- package/dist/commands/jtbd.d.ts +0 -38
- package/dist/commands/jtbd.d.ts.map +0 -1
- package/dist/commands/jtbd.js +0 -261
- package/dist/commands/jtbd.js.map +0 -1
- package/dist/commands/local-db.d.ts +0 -16
- package/dist/commands/local-db.d.ts.map +0 -1
- package/dist/commands/local-db.js +0 -33
- package/dist/commands/local-db.js.map +0 -1
- package/dist/commands/mcp.d.ts +0 -21
- package/dist/commands/mcp.d.ts.map +0 -1
- package/dist/commands/mcp.js +0 -166
- package/dist/commands/mcp.js.map +0 -1
- package/dist/commands/migrate-code-inputs.d.ts +0 -24
- package/dist/commands/migrate-code-inputs.d.ts.map +0 -1
- package/dist/commands/migrate-code-inputs.js +0 -120
- package/dist/commands/migrate-code-inputs.js.map +0 -1
- package/dist/commands/models-hf.d.ts +0 -9
- package/dist/commands/models-hf.d.ts.map +0 -1
- package/dist/commands/models-hf.js +0 -235
- package/dist/commands/models-hf.js.map +0 -1
- package/dist/commands/models-recommended.d.ts +0 -10
- package/dist/commands/models-recommended.d.ts.map +0 -1
- package/dist/commands/models-recommended.js +0 -120
- package/dist/commands/models-recommended.js.map +0 -1
- package/dist/commands/node.d.ts +0 -10
- package/dist/commands/node.d.ts.map +0 -1
- package/dist/commands/node.js +0 -130
- package/dist/commands/node.js.map +0 -1
- package/dist/commands/output.d.ts +0 -32
- package/dist/commands/output.d.ts.map +0 -1
- package/dist/commands/output.js +0 -150
- package/dist/commands/output.js.map +0 -1
- package/dist/commands/pack-install-authorization.d.ts +0 -40
- package/dist/commands/pack-install-authorization.d.ts.map +0 -1
- package/dist/commands/pack-install-authorization.js +0 -131
- package/dist/commands/pack-install-authorization.js.map +0 -1
- package/dist/commands/pack-management.d.ts +0 -26
- package/dist/commands/pack-management.d.ts.map +0 -1
- package/dist/commands/pack-management.js +0 -74
- package/dist/commands/pack-management.js.map +0 -1
- package/dist/commands/package-helpers.d.ts +0 -8
- package/dist/commands/package-helpers.d.ts.map +0 -1
- package/dist/commands/package-helpers.js +0 -53
- package/dist/commands/package-helpers.js.map +0 -1
- package/dist/commands/package.d.ts +0 -3
- package/dist/commands/package.d.ts.map +0 -1
- package/dist/commands/package.js +0 -258
- package/dist/commands/package.js.map +0 -1
- package/dist/commands/packs.d.ts +0 -14
- package/dist/commands/packs.d.ts.map +0 -1
- package/dist/commands/packs.js +0 -65
- package/dist/commands/packs.js.map +0 -1
- package/dist/commands/projects.d.ts +0 -11
- package/dist/commands/projects.d.ts.map +0 -1
- package/dist/commands/projects.js +0 -145
- package/dist/commands/projects.js.map +0 -1
- package/dist/commands/reliability.d.ts +0 -14
- package/dist/commands/reliability.d.ts.map +0 -1
- package/dist/commands/reliability.js +0 -81
- package/dist/commands/reliability.js.map +0 -1
- package/dist/commands/resource-read.d.ts +0 -28
- package/dist/commands/resource-read.d.ts.map +0 -1
- package/dist/commands/resource-read.js +0 -314
- package/dist/commands/resource-read.js.map +0 -1
- package/dist/commands/runs.d.ts +0 -7
- package/dist/commands/runs.d.ts.map +0 -1
- package/dist/commands/runs.js +0 -302
- package/dist/commands/runs.js.map +0 -1
- package/dist/commands/runtime.d.ts +0 -3
- package/dist/commands/runtime.d.ts.map +0 -1
- package/dist/commands/runtime.js +0 -169
- package/dist/commands/runtime.js.map +0 -1
- package/dist/commands/sketch-render.d.ts +0 -46
- package/dist/commands/sketch-render.d.ts.map +0 -1
- package/dist/commands/sketch-render.js +0 -131
- package/dist/commands/sketch-render.js.map +0 -1
- package/dist/commands/sketch-validation-output.d.ts +0 -7
- package/dist/commands/sketch-validation-output.d.ts.map +0 -1
- package/dist/commands/sketch-validation-output.js +0 -5
- package/dist/commands/sketch-validation-output.js.map +0 -1
- package/dist/commands/sketch-versions.d.ts +0 -66
- package/dist/commands/sketch-versions.d.ts.map +0 -1
- package/dist/commands/sketch-versions.js +0 -108
- package/dist/commands/sketch-versions.js.map +0 -1
- package/dist/commands/sketch.d.ts +0 -22
- package/dist/commands/sketch.d.ts.map +0 -1
- package/dist/commands/sketch.js +0 -101
- package/dist/commands/sketch.js.map +0 -1
- package/dist/commands/storage.d.ts +0 -24
- package/dist/commands/storage.d.ts.map +0 -1
- package/dist/commands/storage.js +0 -112
- package/dist/commands/storage.js.map +0 -1
- package/dist/commands/telegram.d.ts +0 -11
- package/dist/commands/telegram.d.ts.map +0 -1
- package/dist/commands/telegram.js +0 -66
- package/dist/commands/telegram.js.map +0 -1
- package/dist/commands/telemetry.d.ts +0 -24
- package/dist/commands/telemetry.d.ts.map +0 -1
- package/dist/commands/telemetry.js +0 -116
- package/dist/commands/telemetry.js.map +0 -1
- package/dist/commands/timeline-render.d.ts +0 -75
- package/dist/commands/timeline-render.d.ts.map +0 -1
- package/dist/commands/timeline-render.js +0 -465
- package/dist/commands/timeline-render.js.map +0 -1
- package/dist/commands/timeline-score.d.ts +0 -16
- package/dist/commands/timeline-score.d.ts.map +0 -1
- package/dist/commands/timeline-score.js +0 -89
- package/dist/commands/timeline-score.js.map +0 -1
- package/dist/commands/timeline-validation-output.d.ts +0 -7
- package/dist/commands/timeline-validation-output.d.ts.map +0 -1
- package/dist/commands/timeline-validation-output.js +0 -9
- package/dist/commands/timeline-validation-output.js.map +0 -1
- package/dist/commands/timeline-versions.d.ts +0 -72
- package/dist/commands/timeline-versions.d.ts.map +0 -1
- package/dist/commands/timeline-versions.js +0 -108
- package/dist/commands/timeline-versions.js.map +0 -1
- package/dist/commands/timeline.d.ts +0 -22
- package/dist/commands/timeline.d.ts.map +0 -1
- package/dist/commands/timeline.js +0 -103
- package/dist/commands/timeline.js.map +0 -1
- package/dist/commands/tools.d.ts +0 -11
- package/dist/commands/tools.d.ts.map +0 -1
- package/dist/commands/tools.js +0 -206
- package/dist/commands/tools.js.map +0 -1
- package/dist/commands/validate.d.ts +0 -24
- package/dist/commands/validate.d.ts.map +0 -1
- package/dist/commands/validate.js +0 -132
- package/dist/commands/validate.js.map +0 -1
- package/dist/commands/validation-output.d.ts +0 -25
- package/dist/commands/validation-output.d.ts.map +0 -1
- package/dist/commands/validation-output.js +0 -29
- package/dist/commands/validation-output.js.map +0 -1
- package/dist/commands/version-commands.d.ts +0 -91
- package/dist/commands/version-commands.d.ts.map +0 -1
- package/dist/commands/version-commands.js +0 -222
- package/dist/commands/version-commands.js.map +0 -1
- package/dist/commands/worker-models.d.ts +0 -13
- package/dist/commands/worker-models.d.ts.map +0 -1
- package/dist/commands/worker-models.js +0 -207
- package/dist/commands/worker-models.js.map +0 -1
- package/dist/commands/worker.d.ts +0 -23
- package/dist/commands/worker.d.ts.map +0 -1
- package/dist/commands/worker.js +0 -374
- package/dist/commands/worker.js.map +0 -1
- package/dist/debug/browser-runner.d.ts +0 -21
- package/dist/debug/browser-runner.d.ts.map +0 -1
- package/dist/debug/browser-runner.js +0 -196
- package/dist/debug/browser-runner.js.map +0 -1
- package/dist/debug/collector.d.ts +0 -9
- package/dist/debug/collector.d.ts.map +0 -1
- package/dist/debug/collector.js +0 -9
- package/dist/debug/collector.js.map +0 -1
- package/dist/debug/diff.d.ts +0 -48
- package/dist/debug/diff.d.ts.map +0 -1
- package/dist/debug/diff.js +0 -68
- package/dist/debug/diff.js.map +0 -1
- package/dist/debug/harness.d.ts +0 -11
- package/dist/debug/harness.d.ts.map +0 -1
- package/dist/debug/harness.js +0 -103
- package/dist/debug/harness.js.map +0 -1
- package/dist/debug/index.d.ts +0 -17
- package/dist/debug/index.d.ts.map +0 -1
- package/dist/debug/index.js +0 -16
- package/dist/debug/index.js.map +0 -1
- package/dist/debug/markdown.d.ts +0 -3
- package/dist/debug/markdown.d.ts.map +0 -1
- package/dist/debug/markdown.js +0 -127
- package/dist/debug/markdown.js.map +0 -1
- package/dist/debug/server-runner.d.ts +0 -24
- package/dist/debug/server-runner.d.ts.map +0 -1
- package/dist/debug/server-runner.js +0 -211
- package/dist/debug/server-runner.js.map +0 -1
- package/dist/debug/target.d.ts +0 -34
- package/dist/debug/target.d.ts.map +0 -1
- package/dist/debug/target.js +0 -95
- package/dist/debug/target.js.map +0 -1
- package/dist/debug/trace.d.ts +0 -30
- package/dist/debug/trace.d.ts.map +0 -1
- package/dist/debug/trace.js +0 -87
- package/dist/debug/trace.js.map +0 -1
- package/dist/debug/types.d.ts +0 -82
- package/dist/debug/types.d.ts.map +0 -1
- package/dist/debug/types.js +0 -13
- package/dist/debug/types.js.map +0 -1
- package/dist/debug/verdict.d.ts +0 -3
- package/dist/debug/verdict.d.ts.map +0 -1
- package/dist/debug/verdict.js +0 -78
- package/dist/debug/verdict.js.map +0 -1
- package/dist/debug/watch.d.ts +0 -23
- package/dist/debug/watch.d.ts.map +0 -1
- package/dist/debug/watch.js +0 -68
- package/dist/debug/watch.js.map +0 -1
- package/dist/debug-bundle.d.ts +0 -12
- package/dist/debug-bundle.d.ts.map +0 -1
- package/dist/debug-bundle.js +0 -23
- package/dist/debug-bundle.js.map +0 -1
- package/dist/diagnose.d.ts +0 -139
- package/dist/diagnose.d.ts.map +0 -1
- package/dist/diagnose.js +0 -418
- package/dist/diagnose.js.map +0 -1
- package/dist/document-json.d.ts +0 -11
- package/dist/document-json.d.ts.map +0 -1
- package/dist/document-json.js +0 -27
- package/dist/document-json.js.map +0 -1
- package/dist/evals/graph-runner.d.ts +0 -8
- package/dist/evals/graph-runner.d.ts.map +0 -1
- package/dist/evals/graph-runner.js +0 -136
- package/dist/evals/graph-runner.js.map +0 -1
- package/dist/harness/capability-coverage.d.ts +0 -163
- package/dist/harness/capability-coverage.d.ts.map +0 -1
- package/dist/harness/capability-coverage.js +0 -295
- package/dist/harness/capability-coverage.js.map +0 -1
- package/dist/harness/capability-table.d.ts +0 -17
- package/dist/harness/capability-table.d.ts.map +0 -1
- package/dist/harness/capability-table.js +0 -3925
- package/dist/harness/capability-table.js.map +0 -1
- package/dist/harness/changed-files.d.ts +0 -20
- package/dist/harness/changed-files.d.ts.map +0 -1
- package/dist/harness/changed-files.js +0 -90
- package/dist/harness/changed-files.js.map +0 -1
- package/dist/harness/declared-capabilities.d.ts +0 -12
- package/dist/harness/declared-capabilities.d.ts.map +0 -1
- package/dist/harness/declared-capabilities.js +0 -21
- package/dist/harness/declared-capabilities.js.map +0 -1
- package/dist/harness/registry.d.ts +0 -190
- package/dist/harness/registry.d.ts.map +0 -1
- package/dist/harness/registry.js +0 -2341
- package/dist/harness/registry.js.map +0 -1
- package/dist/install-lock.d.ts +0 -12
- package/dist/install-lock.d.ts.map +0 -1
- package/dist/install-lock.js +0 -139
- package/dist/install-lock.js.map +0 -1
- package/dist/interaction-script.d.ts +0 -40
- package/dist/interaction-script.d.ts.map +0 -1
- package/dist/interaction-script.js +0 -104
- package/dist/interaction-script.js.map +0 -1
- package/dist/js-script-debug/harness.d.ts +0 -146
- package/dist/js-script-debug/harness.d.ts.map +0 -1
- package/dist/js-script-debug/harness.js +0 -220
- package/dist/js-script-debug/harness.js.map +0 -1
- package/dist/js-script-debug/index.d.ts +0 -9
- package/dist/js-script-debug/index.d.ts.map +0 -1
- package/dist/js-script-debug/index.js +0 -9
- package/dist/js-script-debug/index.js.map +0 -1
- package/dist/js-script-debug/interactions.d.ts +0 -19
- package/dist/js-script-debug/interactions.d.ts.map +0 -1
- package/dist/js-script-debug/interactions.js +0 -17
- package/dist/js-script-debug/interactions.js.map +0 -1
- package/dist/js-script-debug/target.d.ts +0 -20
- package/dist/js-script-debug/target.d.ts.map +0 -1
- package/dist/js-script-debug/target.js +0 -55
- package/dist/js-script-debug/target.js.map +0 -1
- package/dist/local-model-interfaces.d.ts +0 -20
- package/dist/local-model-interfaces.d.ts.map +0 -1
- package/dist/local-model-interfaces.js +0 -41
- package/dist/local-model-interfaces.js.map +0 -1
- package/dist/local-secrets.d.ts +0 -3
- package/dist/local-secrets.d.ts.map +0 -1
- package/dist/local-secrets.js +0 -16
- package/dist/local-secrets.js.map +0 -1
- package/dist/markdown.d.ts +0 -9
- package/dist/markdown.d.ts.map +0 -1
- package/dist/markdown.js +0 -53
- package/dist/markdown.js.map +0 -1
- package/dist/node/run-node.d.ts +0 -31
- package/dist/node/run-node.d.ts.map +0 -1
- package/dist/node/run-node.js +0 -92
- package/dist/node/run-node.js.map +0 -1
- package/dist/node-registry.d.ts +0 -29
- package/dist/node-registry.d.ts.map +0 -1
- package/dist/node-registry.js +0 -38
- package/dist/node-registry.js.map +0 -1
- package/dist/nodetool-main.d.ts +0 -15
- package/dist/nodetool-main.d.ts.map +0 -1
- package/dist/nodetool-main.js +0 -1456
- package/dist/nodetool-main.js.map +0 -1
- package/dist/npm-runner.d.ts +0 -23
- package/dist/npm-runner.d.ts.map +0 -1
- package/dist/npm-runner.js +0 -160
- package/dist/npm-runner.js.map +0 -1
- package/dist/numeric-options.d.ts +0 -22
- package/dist/numeric-options.d.ts.map +0 -1
- package/dist/numeric-options.js +0 -45
- package/dist/numeric-options.js.map +0 -1
- package/dist/optional-node-root.d.ts +0 -10
- package/dist/optional-node-root.d.ts.map +0 -1
- package/dist/optional-node-root.js +0 -26
- package/dist/optional-node-root.js.map +0 -1
- package/dist/package-assets.d.ts +0 -8
- package/dist/package-assets.d.ts.map +0 -1
- package/dist/package-assets.js +0 -21
- package/dist/package-assets.js.map +0 -1
- package/dist/packs/command-service.d.ts +0 -14
- package/dist/packs/command-service.d.ts.map +0 -1
- package/dist/packs/command-service.js +0 -195
- package/dist/packs/command-service.js.map +0 -1
- package/dist/packs/doctor-lock.d.ts +0 -8
- package/dist/packs/doctor-lock.d.ts.map +0 -1
- package/dist/packs/doctor-lock.js +0 -50
- package/dist/packs/doctor-lock.js.map +0 -1
- package/dist/packs/doctor.d.ts +0 -25
- package/dist/packs/doctor.d.ts.map +0 -1
- package/dist/packs/doctor.js +0 -12
- package/dist/packs/doctor.js.map +0 -1
- package/dist/packs/global-bootstrap.d.ts +0 -11
- package/dist/packs/global-bootstrap.d.ts.map +0 -1
- package/dist/packs/global-bootstrap.js +0 -72
- package/dist/packs/global-bootstrap.js.map +0 -1
- package/dist/packs/host.d.ts +0 -17
- package/dist/packs/host.d.ts.map +0 -1
- package/dist/packs/host.js +0 -79
- package/dist/packs/host.js.map +0 -1
- package/dist/packs/install-manifests.d.ts +0 -2
- package/dist/packs/install-manifests.d.ts.map +0 -1
- package/dist/packs/install-manifests.js +0 -30
- package/dist/packs/install-manifests.js.map +0 -1
- package/dist/packs/install-process.d.ts +0 -4
- package/dist/packs/install-process.d.ts.map +0 -1
- package/dist/packs/install-process.js +0 -11
- package/dist/packs/install-process.js.map +0 -1
- package/dist/packs/install-selection.d.ts +0 -39
- package/dist/packs/install-selection.d.ts.map +0 -1
- package/dist/packs/install-selection.js +0 -67
- package/dist/packs/install-selection.js.map +0 -1
- package/dist/packs/install-state.d.ts +0 -21
- package/dist/packs/install-state.d.ts.map +0 -1
- package/dist/packs/install-state.js +0 -44
- package/dist/packs/install-state.js.map +0 -1
- package/dist/packs/install-tree.d.ts +0 -35
- package/dist/packs/install-tree.d.ts.map +0 -1
- package/dist/packs/install-tree.js +0 -253
- package/dist/packs/install-tree.js.map +0 -1
- package/dist/packs/install-verification.d.ts +0 -12
- package/dist/packs/install-verification.d.ts.map +0 -1
- package/dist/packs/install-verification.js +0 -76
- package/dist/packs/install-verification.js.map +0 -1
- package/dist/packs/installed.d.ts +0 -36
- package/dist/packs/installed.d.ts.map +0 -1
- package/dist/packs/installed.js +0 -87
- package/dist/packs/installed.js.map +0 -1
- package/dist/packs/installer-load-check.d.ts +0 -4
- package/dist/packs/installer-load-check.d.ts.map +0 -1
- package/dist/packs/installer-load-check.js +0 -52
- package/dist/packs/installer-load-check.js.map +0 -1
- package/dist/packs/installer.d.ts +0 -16
- package/dist/packs/installer.d.ts.map +0 -1
- package/dist/packs/installer.js +0 -142
- package/dist/packs/installer.js.map +0 -1
- package/dist/packs/management.d.ts +0 -51
- package/dist/packs/management.d.ts.map +0 -1
- package/dist/packs/management.js +0 -81
- package/dist/packs/management.js.map +0 -1
- package/dist/packs/mode.d.ts +0 -42
- package/dist/packs/mode.d.ts.map +0 -1
- package/dist/packs/mode.js +0 -215
- package/dist/packs/mode.js.map +0 -1
- package/dist/packs/owned-replay-plan.d.ts +0 -5
- package/dist/packs/owned-replay-plan.d.ts.map +0 -1
- package/dist/packs/owned-replay-plan.js +0 -68
- package/dist/packs/owned-replay-plan.js.map +0 -1
- package/dist/packs/removal-selection.d.ts +0 -12
- package/dist/packs/removal-selection.d.ts.map +0 -1
- package/dist/packs/removal-selection.js +0 -169
- package/dist/packs/removal-selection.js.map +0 -1
- package/dist/packs/removal.d.ts +0 -12
- package/dist/packs/removal.d.ts.map +0 -1
- package/dist/packs/removal.js +0 -138
- package/dist/packs/removal.js.map +0 -1
- package/dist/packs/repair.d.ts +0 -2
- package/dist/packs/repair.d.ts.map +0 -1
- package/dist/packs/repair.js +0 -2
- package/dist/packs/repair.js.map +0 -1
- package/dist/packs/serve.d.ts +0 -2
- package/dist/packs/serve.d.ts.map +0 -1
- package/dist/packs/serve.js +0 -14
- package/dist/packs/serve.js.map +0 -1
- package/dist/permission-gate.d.ts +0 -55
- package/dist/permission-gate.d.ts.map +0 -1
- package/dist/permission-gate.js +0 -118
- package/dist/permission-gate.js.map +0 -1
- package/dist/predicates.d.ts +0 -6
- package/dist/predicates.d.ts.map +0 -1
- package/dist/predicates.js +0 -6
- package/dist/predicates.js.map +0 -1
- package/dist/providers.d.ts +0 -117
- package/dist/providers.d.ts.map +0 -1
- package/dist/providers.js +0 -491
- package/dist/providers.js.map +0 -1
- package/dist/readline-input.d.ts +0 -23
- package/dist/readline-input.d.ts.map +0 -1
- package/dist/readline-input.js +0 -210
- package/dist/readline-input.js.map +0 -1
- package/dist/run-budget.d.ts +0 -40
- package/dist/run-budget.d.ts.map +0 -1
- package/dist/run-budget.js +0 -119
- package/dist/run-budget.js.map +0 -1
- package/dist/run-dsl-supervised.d.ts +0 -11
- package/dist/run-dsl-supervised.d.ts.map +0 -1
- package/dist/run-dsl-supervised.js +0 -89
- package/dist/run-dsl-supervised.js.map +0 -1
- package/dist/run-dsl.d.ts +0 -40
- package/dist/run-dsl.d.ts.map +0 -1
- package/dist/run-dsl.js +0 -65
- package/dist/run-dsl.js.map +0 -1
- package/dist/run-json.d.ts +0 -24
- package/dist/run-json.d.ts.map +0 -1
- package/dist/run-json.js +0 -132
- package/dist/run-json.js.map +0 -1
- package/dist/runtime-env.d.ts +0 -4
- package/dist/runtime-env.d.ts.map +0 -1
- package/dist/runtime-env.js +0 -31
- package/dist/runtime-env.js.map +0 -1
- package/dist/sandbox-catalog.d.ts +0 -26
- package/dist/sandbox-catalog.d.ts.map +0 -1
- package/dist/sandbox-catalog.js +0 -83
- package/dist/sandbox-catalog.js.map +0 -1
- package/dist/settings.d.ts +0 -19
- package/dist/settings.d.ts.map +0 -1
- package/dist/settings.js +0 -146
- package/dist/settings.js.map +0 -1
- package/dist/sketch-debug/harness.d.ts +0 -101
- package/dist/sketch-debug/harness.d.ts.map +0 -1
- package/dist/sketch-debug/harness.js +0 -118
- package/dist/sketch-debug/harness.js.map +0 -1
- package/dist/sketch-debug/index.d.ts +0 -9
- package/dist/sketch-debug/index.d.ts.map +0 -1
- package/dist/sketch-debug/index.js +0 -9
- package/dist/sketch-debug/index.js.map +0 -1
- package/dist/sketch-debug/interactions.d.ts +0 -19
- package/dist/sketch-debug/interactions.d.ts.map +0 -1
- package/dist/sketch-debug/interactions.js +0 -17
- package/dist/sketch-debug/interactions.js.map +0 -1
- package/dist/sketch-debug/target.d.ts +0 -48
- package/dist/sketch-debug/target.d.ts.map +0 -1
- package/dist/sketch-debug/target.js +0 -115
- package/dist/sketch-debug/target.js.map +0 -1
- package/dist/stdin.d.ts +0 -52
- package/dist/stdin.d.ts.map +0 -1
- package/dist/stdin.js +0 -363
- package/dist/stdin.js.map +0 -1
- package/dist/supervisor.d.ts +0 -97
- package/dist/supervisor.d.ts.map +0 -1
- package/dist/supervisor.js +0 -194
- package/dist/supervisor.js.map +0 -1
- package/dist/telemetry.d.ts +0 -38
- package/dist/telemetry.d.ts.map +0 -1
- package/dist/telemetry.js +0 -158
- package/dist/telemetry.js.map +0 -1
- package/dist/terminal-clipboard.d.ts +0 -3
- package/dist/terminal-clipboard.d.ts.map +0 -1
- package/dist/terminal-clipboard.js +0 -24
- package/dist/terminal-clipboard.js.map +0 -1
- package/dist/terminal-mouse.d.ts +0 -24
- package/dist/terminal-mouse.d.ts.map +0 -1
- package/dist/terminal-mouse.js +0 -84
- package/dist/terminal-mouse.js.map +0 -1
- package/dist/terminal-screen.d.ts +0 -41
- package/dist/terminal-screen.d.ts.map +0 -1
- package/dist/terminal-screen.js +0 -228
- package/dist/terminal-screen.js.map +0 -1
- package/dist/timeline-debug/harness.d.ts +0 -93
- package/dist/timeline-debug/harness.d.ts.map +0 -1
- package/dist/timeline-debug/harness.js +0 -100
- package/dist/timeline-debug/harness.js.map +0 -1
- package/dist/timeline-debug/index.d.ts +0 -9
- package/dist/timeline-debug/index.d.ts.map +0 -1
- package/dist/timeline-debug/index.js +0 -9
- package/dist/timeline-debug/index.js.map +0 -1
- package/dist/timeline-debug/interactions.d.ts +0 -19
- package/dist/timeline-debug/interactions.d.ts.map +0 -1
- package/dist/timeline-debug/interactions.js +0 -17
- package/dist/timeline-debug/interactions.js.map +0 -1
- package/dist/timeline-debug/target.d.ts +0 -34
- package/dist/timeline-debug/target.d.ts.map +0 -1
- package/dist/timeline-debug/target.js +0 -109
- package/dist/timeline-debug/target.js.map +0 -1
- package/dist/tool-format.d.ts +0 -54
- package/dist/tool-format.d.ts.map +0 -1
- package/dist/tool-format.js +0 -360
- package/dist/tool-format.js.map +0 -1
- package/dist/useExecutionState.d.ts +0 -44
- package/dist/useExecutionState.d.ts.map +0 -1
- package/dist/useExecutionState.js +0 -285
- package/dist/useExecutionState.js.map +0 -1
- package/dist/validate/index.d.ts +0 -29
- package/dist/validate/index.d.ts.map +0 -1
- package/dist/validate/index.js +0 -79
- package/dist/validate/index.js.map +0 -1
- package/dist/websocket-client.d.ts +0 -163
- package/dist/websocket-client.d.ts.map +0 -1
- package/dist/websocket-client.js +0 -677
- package/dist/websocket-client.js.map +0 -1
- package/dist/workflow-file.d.ts +0 -3
- package/dist/workflow-file.d.ts.map +0 -1
- package/dist/workflow-file.js +0 -176
- package/dist/workflow-file.js.map +0 -1
package/dist/commands/game.js
DELETED
|
@@ -1,856 +0,0 @@
|
|
|
1
|
-
import { importPack } from "@nodetool-ai/node-catalog";
|
|
2
|
-
import { mkdtemp, readFile, realpath, rm, writeFile } from "node:fs/promises";
|
|
3
|
-
import { tmpdir } from "node:os";
|
|
4
|
-
import { extname, join, resolve, sep } from "node:path";
|
|
5
|
-
import { isDeepStrictEqual } from "node:util";
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
import { gameEvent, gameInputFrame } from "@nodetool-ai/protocol/game.js";
|
|
8
|
-
import { gameEvent3D, gameInputFrame3D, parsePackageAssetUri } from "@nodetool-ai/protocol";
|
|
9
|
-
import { createMemoryGameSaveStorage, createScriptedGameSession, createGameSession3D, decodePreparedGameCollider3D, GamePlayerSaves, hashGameSnapshot3D, validateGame, validateAnyGame } from "@nodetool-ai/game-runtime";
|
|
10
|
-
import { benchmarkNativeGame } from "./game-benchmark.js";
|
|
11
|
-
import { printCommandError } from "../command-errors.js";
|
|
12
|
-
import { checkoutPackageAssetsDir } from "../package-assets.js";
|
|
13
|
-
import { registerGameSmokeCommand } from "./game-smoke.js";
|
|
14
|
-
const strictGameEvent = z.union(gameEvent.options.map((variant) => variant.strict()));
|
|
15
|
-
const jsonFields = z.record(z.string(), z.unknown());
|
|
16
|
-
const tickAssertion = z.strictObject({
|
|
17
|
-
tick: z.number().int().nonnegative(),
|
|
18
|
-
sceneId: z.string().min(1).optional(),
|
|
19
|
-
entities: z.array(z.strictObject({
|
|
20
|
-
id: z.string().min(1),
|
|
21
|
-
x: z.number().finite().optional(),
|
|
22
|
-
y: z.number().finite().optional(),
|
|
23
|
-
active: z.boolean().optional()
|
|
24
|
-
})).optional(),
|
|
25
|
-
events: z.array(strictGameEvent).optional()
|
|
26
|
-
});
|
|
27
|
-
const gameAssertions = z.strictObject({
|
|
28
|
-
tolerance: z.number().finite().nonnegative().default(1e-9),
|
|
29
|
-
ticks: z.array(tickAssertion)
|
|
30
|
-
});
|
|
31
|
-
const MEDIA_TYPES = {
|
|
32
|
-
png: "image/png",
|
|
33
|
-
jpg: "image/jpeg",
|
|
34
|
-
webp: "image/webp",
|
|
35
|
-
wav: "audio/wav",
|
|
36
|
-
ogg: "audio/ogg",
|
|
37
|
-
mp3: "audio/mpeg",
|
|
38
|
-
ttf: "font/ttf",
|
|
39
|
-
otf: "font/otf",
|
|
40
|
-
glb: "model/gltf-binary",
|
|
41
|
-
json: "application/json"
|
|
42
|
-
};
|
|
43
|
-
/** Reads a shipped `package://` asset from the package asset directory of this checkout or of NODETOOL_PACKAGE_ASSETS_DIR. */
|
|
44
|
-
async function readPackageAsset(uri) {
|
|
45
|
-
const ref = parsePackageAssetUri(uri);
|
|
46
|
-
const root = process.env.NODETOOL_PACKAGE_ASSETS_DIR || checkoutPackageAssetsDir();
|
|
47
|
-
if (!ref || !root)
|
|
48
|
-
return null;
|
|
49
|
-
const base = await realpath(root);
|
|
50
|
-
let path;
|
|
51
|
-
try {
|
|
52
|
-
path = await realpath(join(base, ref.packageName, ref.path));
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
if (error.code === "ENOENT")
|
|
56
|
-
return null;
|
|
57
|
-
throw error;
|
|
58
|
-
}
|
|
59
|
-
if (!path.startsWith(`${base}${sep}`)) {
|
|
60
|
-
throw new Error(`Package asset escapes the asset directory: ${uri}`);
|
|
61
|
-
} // key-boundary-ok: node:path sep anchors containment after realpath.
|
|
62
|
-
return { bytes: await readFile(path), mimeType: MEDIA_TYPES[extname(path).slice(1).toLowerCase()] ?? "application/octet-stream" };
|
|
63
|
-
}
|
|
64
|
-
async function readBuildAsset(directory, sourceAssetId) {
|
|
65
|
-
if (sourceAssetId.startsWith("builtin:"))
|
|
66
|
-
return null;
|
|
67
|
-
if (sourceAssetId.startsWith("package://"))
|
|
68
|
-
return readPackageAsset(sourceAssetId);
|
|
69
|
-
if (!directory)
|
|
70
|
-
return null;
|
|
71
|
-
if (!/^[a-f0-9]{32}$/.test(sourceAssetId)) {
|
|
72
|
-
throw new Error(`Asset ID must be a full 32-character resource ID: ${sourceAssetId}`);
|
|
73
|
-
}
|
|
74
|
-
for (const [extension, mimeType] of Object.entries(MEDIA_TYPES)) {
|
|
75
|
-
try {
|
|
76
|
-
return { bytes: await readFile(join(directory, `${sourceAssetId}.${extension}`)), mimeType };
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
if (error.code !== "ENOENT")
|
|
80
|
-
throw error;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
function nonnegativeInteger(value, name) {
|
|
86
|
-
const parsed = Number(value);
|
|
87
|
-
if (!Number.isSafeInteger(parsed) || parsed < 0) {
|
|
88
|
-
throw new Error(`${name} must be a nonnegative integer`);
|
|
89
|
-
}
|
|
90
|
-
return parsed;
|
|
91
|
-
}
|
|
92
|
-
async function readDocument(path) {
|
|
93
|
-
return JSON.parse(await readFile(path, "utf8"));
|
|
94
|
-
}
|
|
95
|
-
/** A shipped example file. A game document never has `name` and `document` without `schemaVersion`. */
|
|
96
|
-
const exampleWrapper = z.object({ name: z.string(), document: z.record(z.string(), z.unknown()), schemaVersion: z.never().optional() });
|
|
97
|
-
/** Reads a game document, or the `document` of a shipped example file `{name, document, …}`. */
|
|
98
|
-
async function readGameDocument(path) {
|
|
99
|
-
const raw = await readDocument(path);
|
|
100
|
-
const wrapped = exampleWrapper.safeParse(raw);
|
|
101
|
-
return wrapped.success ? wrapped.data.document : raw;
|
|
102
|
-
}
|
|
103
|
-
async function readInputs(path, schema) {
|
|
104
|
-
if (!path)
|
|
105
|
-
return [];
|
|
106
|
-
const raw = await readDocument(path);
|
|
107
|
-
if (!Array.isArray(raw)) {
|
|
108
|
-
throw new Error("Input recording must be an array of tick input frames");
|
|
109
|
-
}
|
|
110
|
-
return raw.map((input, index) => {
|
|
111
|
-
const parsed = schema.safeParse(input);
|
|
112
|
-
if (!parsed.success) {
|
|
113
|
-
throw new Error(`Invalid input at tick ${index}: ${parsed.error.message}`);
|
|
114
|
-
}
|
|
115
|
-
return parsed.data;
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
const savesFile = z.strictObject({ progress: z.record(z.string(), z.unknown()).optional(), settings: z.record(z.string(), z.unknown()).optional() });
|
|
119
|
-
/**
|
|
120
|
-
* In-memory saves for a headless run, seeded from `--saves`. Script loads read this storage only, so a run is
|
|
121
|
-
* repeatable. The report lists each slot's data after the run.
|
|
122
|
-
*/
|
|
123
|
-
async function headlessSaves(path) {
|
|
124
|
-
const storage = createMemoryGameSaveStorage();
|
|
125
|
-
const errors = [];
|
|
126
|
-
const saves = new GamePlayerSaves(storage, { onError: (error, request) => errors.push(`Tick ${request.tick} ${request.kind} ${request.scope}/${request.slot}: ${error.message}`) });
|
|
127
|
-
const seeded = path ? savesFile.parse(await readDocument(path)) : {};
|
|
128
|
-
for (const scope of ["progress", "settings"]) {
|
|
129
|
-
for (const [slot, data] of Object.entries(seeded[scope] ?? {})) {
|
|
130
|
-
await saves.save(scope, slot, data);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
let used = path !== undefined;
|
|
134
|
-
return {
|
|
135
|
-
saves,
|
|
136
|
-
/** Performs a step's requests before the next tick. */
|
|
137
|
-
async after(requests, snapshot) {
|
|
138
|
-
if (!requests) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
used = true;
|
|
142
|
-
saves.handle(requests, snapshot);
|
|
143
|
-
await saves.idle();
|
|
144
|
-
},
|
|
145
|
-
report() {
|
|
146
|
-
if (!used) {
|
|
147
|
-
return undefined;
|
|
148
|
-
}
|
|
149
|
-
const entries = storage.entries();
|
|
150
|
-
const data = (scope) => Object.fromEntries(Object.entries(entries[scope]).map(([slot, record]) => [slot, record.data]));
|
|
151
|
-
return { progress: data("progress"), settings: data("settings"), errors };
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
async function readAssertions(path, ticks) {
|
|
156
|
-
if (!path) {
|
|
157
|
-
return undefined;
|
|
158
|
-
}
|
|
159
|
-
const parsed = gameAssertions.safeParse(await readDocument(path));
|
|
160
|
-
if (!parsed.success) {
|
|
161
|
-
throw new Error(`Invalid game assertions: ${parsed.error.message}`);
|
|
162
|
-
}
|
|
163
|
-
const byTick = new Map();
|
|
164
|
-
for (const assertion of parsed.data.ticks) {
|
|
165
|
-
if (assertion.tick > ticks) {
|
|
166
|
-
throw new Error(`Assertion tick ${assertion.tick} exceeds requested ${ticks} ticks`);
|
|
167
|
-
}
|
|
168
|
-
if (byTick.has(assertion.tick)) {
|
|
169
|
-
throw new Error(`Duplicate assertion for tick ${assertion.tick}`);
|
|
170
|
-
}
|
|
171
|
-
byTick.set(assertion.tick, assertion);
|
|
172
|
-
}
|
|
173
|
-
return { byTick, tolerance: parsed.data.tolerance };
|
|
174
|
-
}
|
|
175
|
-
function firstDifference(expected, actual, path) {
|
|
176
|
-
if (isDeepStrictEqual(expected, actual)) {
|
|
177
|
-
return undefined;
|
|
178
|
-
}
|
|
179
|
-
if (Array.isArray(expected) && Array.isArray(actual)) {
|
|
180
|
-
if (expected.length !== actual.length) {
|
|
181
|
-
return { path: `${path}.length`, expected: expected.length, actual: actual.length };
|
|
182
|
-
}
|
|
183
|
-
for (let index = 0; index < expected.length; index += 1) {
|
|
184
|
-
const difference = firstDifference(expected[index], actual[index], `${path}[${index}]`);
|
|
185
|
-
if (difference) {
|
|
186
|
-
return difference;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
const expectedObject = jsonFields.safeParse(expected);
|
|
191
|
-
const actualObject = jsonFields.safeParse(actual);
|
|
192
|
-
if (expectedObject.success && actualObject.success) {
|
|
193
|
-
const expectedFields = expectedObject.data;
|
|
194
|
-
const actualFields = actualObject.data;
|
|
195
|
-
for (const key of new Set([...Object.keys(expectedFields), ...Object.keys(actualFields)])) {
|
|
196
|
-
const difference = firstDifference(expectedFields[key], actualFields[key], `${path}.${key}`);
|
|
197
|
-
if (difference) {
|
|
198
|
-
return difference;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
return { path, expected: expected ?? null, actual: actual ?? null };
|
|
203
|
-
}
|
|
204
|
-
function checkTick(assertion, snapshot, events, tolerance) {
|
|
205
|
-
if (!assertion) {
|
|
206
|
-
return [];
|
|
207
|
-
}
|
|
208
|
-
const failures = [];
|
|
209
|
-
const check = (path, expected, actual) => {
|
|
210
|
-
if (!isDeepStrictEqual(expected, actual)) {
|
|
211
|
-
failures.push({ tick: assertion.tick, path, expected, actual: actual ?? null });
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
if (assertion.sceneId !== undefined) {
|
|
215
|
-
check("sceneId", assertion.sceneId, snapshot.sceneId);
|
|
216
|
-
}
|
|
217
|
-
for (const entityAssertion of assertion.entities ?? []) {
|
|
218
|
-
const entity = snapshot.entities.find((candidate) => candidate.id === entityAssertion.id);
|
|
219
|
-
if (!entity) {
|
|
220
|
-
failures.push({ tick: assertion.tick, path: `entities.${entityAssertion.id}`, expected: "present", actual: "missing" });
|
|
221
|
-
continue;
|
|
222
|
-
}
|
|
223
|
-
for (const coordinate of ["x", "y"]) {
|
|
224
|
-
const expected = entityAssertion[coordinate];
|
|
225
|
-
if (expected !== undefined && Math.abs(entity[coordinate] - expected) > tolerance) {
|
|
226
|
-
failures.push({ tick: assertion.tick, path: `entities.${entity.id}.${coordinate}`, expected, actual: entity[coordinate] });
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
if (entityAssertion.active !== undefined) {
|
|
230
|
-
check(`entities.${entity.id}.active`, entityAssertion.active, entity.active);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
if (assertion.events !== undefined) {
|
|
234
|
-
const difference = firstDifference(assertion.events, events, "events");
|
|
235
|
-
if (difference) {
|
|
236
|
-
failures.push({ tick: assertion.tick, ...difference });
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
return failures;
|
|
240
|
-
}
|
|
241
|
-
function validateCliDocument(value) {
|
|
242
|
-
const legacyVersion = z.object({ schemaVersion: z.union([z.literal(1), z.literal(2)]) }).safeParse(value);
|
|
243
|
-
if (legacyVersion.success) {
|
|
244
|
-
return validateGame(value);
|
|
245
|
-
}
|
|
246
|
-
const result = validateAnyGame(value);
|
|
247
|
-
return { valid: result.valid, document: result.valid ? result.document : undefined, issues: result.diagnostics,
|
|
248
|
-
diagnostics: result.diagnostics, errors: result.diagnostics.map((issue) => `${issue.path.join(".")}: ${issue.message}`),
|
|
249
|
-
warnings: result.valid ? result.warnings : [] };
|
|
250
|
-
}
|
|
251
|
-
/** Register native game validation and deterministic simulation commands. */
|
|
252
|
-
export function registerGameCommands(program) {
|
|
253
|
-
const game = program.command("game").description("Validate and playtest native games");
|
|
254
|
-
registerGameSmokeCommand(game);
|
|
255
|
-
game
|
|
256
|
-
.command("validate <game_file>")
|
|
257
|
-
.description("Validate a native game document and its references")
|
|
258
|
-
.option("--json", "Print a machine-readable report")
|
|
259
|
-
.action(async (path, options) => {
|
|
260
|
-
try {
|
|
261
|
-
const report = validateCliDocument(await readGameDocument(path));
|
|
262
|
-
if (options.json) {
|
|
263
|
-
process.stdout.write(`${JSON.stringify(report)}\n`);
|
|
264
|
-
}
|
|
265
|
-
else {
|
|
266
|
-
process.stdout.write(report.valid
|
|
267
|
-
? "Game document is valid\n"
|
|
268
|
-
: `${report.errors.join("\n")}\n`);
|
|
269
|
-
for (const warning of report.warnings ?? []) {
|
|
270
|
-
process.stdout.write(`Warning ${warning.path.join(".")}: ${warning.message}\n`);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
if (!report.valid)
|
|
274
|
-
process.exitCode = 1;
|
|
275
|
-
}
|
|
276
|
-
catch (error) {
|
|
277
|
-
process.exitCode = printCommandError(error, options.json);
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
game.command("bench <game_file>")
|
|
281
|
-
.description("Measure headless native game tick, script and sampled allocation costs")
|
|
282
|
-
.option("--ticks <count>", "Measured ticks", "1200")
|
|
283
|
-
.option("--warmup <count>", "Warmup ticks", "300")
|
|
284
|
-
.option("--seed <integer>", "Random seed", "1")
|
|
285
|
-
.option("--inputs <file>", "JSON array of tick-indexed input frames from tick 0 (warmup included), so the bench measures play")
|
|
286
|
-
.option("--assets-dir <directory>", "Prepared 3D collider files named <full-asset-id>.json. Shipped package:// assets resolve without it")
|
|
287
|
-
.option("--fail-on-budget", "Exit 1 when the tick p95 exceeds performance.budgets.tickMs (default 4 ms)")
|
|
288
|
-
.option("--json", "Print a machine-readable report")
|
|
289
|
-
.action(async (path, options) => {
|
|
290
|
-
try {
|
|
291
|
-
const validated = validateCliDocument(await readGameDocument(path));
|
|
292
|
-
if (!validated.valid || !validated.document) {
|
|
293
|
-
throw new Error(validated.errors.join("\n"));
|
|
294
|
-
}
|
|
295
|
-
const document = validated.document;
|
|
296
|
-
const inputs = document.schemaVersion === 3 ? await readInputs(options.inputs, gameInputFrame3D) : await readInputs(options.inputs, gameInputFrame);
|
|
297
|
-
const report = await benchmarkNativeGame(document, Number(options.ticks), Number(options.warmup), Number(options.seed), { inputs, resolveCollider: sessionAssetOptions3D(options.assetsDir).resolveCollider });
|
|
298
|
-
const { formatGameTimeBudgetOverrun, gameTimeBudgetOverruns, resolveGameTimeBudgets } = await importPack("game", "@nodetool-ai/game-renderer");
|
|
299
|
-
const limits = resolveGameTimeBudgets(document.schemaVersion === 3 ? document.performance?.budgets : undefined);
|
|
300
|
-
const overruns = gameTimeBudgetOverruns({ tickMs: report.tickMs.p95 }, limits);
|
|
301
|
-
process.stdout.write(`${JSON.stringify({ ...report, budget: { limits: { tickMs: limits.tickMs }, overruns } }, null, options.json ? undefined : 2)}\n`);
|
|
302
|
-
if (!options.json) {
|
|
303
|
-
for (const overrun of overruns) {
|
|
304
|
-
process.stderr.write(`${formatGameTimeBudgetOverrun(overrun)}\n`);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
if (options.failOnBudget && overruns.length > 0) {
|
|
308
|
-
process.exitCode = 1;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
catch (error) {
|
|
312
|
-
process.exitCode = printCommandError(error, options.json);
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
game
|
|
316
|
-
.command("simulate <game_file>")
|
|
317
|
-
.description("Run a fixed number of game ticks without a renderer")
|
|
318
|
-
.requiredOption("--ticks <count>", "Number of ticks to run")
|
|
319
|
-
.option("--seed <integer>", "Random seed", "1")
|
|
320
|
-
.option("--inputs <file>", "JSON array of tick-indexed input frames")
|
|
321
|
-
.option("--assets-dir <directory>", "Prepared 3D collider files named <full-asset-id>.json")
|
|
322
|
-
.option("--expect-score <score>", "Fail if the final score differs")
|
|
323
|
-
.option("--expect-win", "Fail unless the win condition is reached")
|
|
324
|
-
.option("--assertions <file>", "JSON assertions for scene, entities, and ordered events at selected ticks")
|
|
325
|
-
.option("--verify-replay", "Resume at the midpoint and compare snapshots and events tick by tick")
|
|
326
|
-
.option("--saves <file>", "JSON {progress?, settings?} of slot data that script loads read. Saves stay in memory")
|
|
327
|
-
.option("--json", "Print a machine-readable report")
|
|
328
|
-
.action(async (path, options) => {
|
|
329
|
-
try {
|
|
330
|
-
const validated = validateCliDocument(await readGameDocument(path));
|
|
331
|
-
if (!validated.valid || !validated.document) {
|
|
332
|
-
throw new Error(validated.errors.join("\n"));
|
|
333
|
-
}
|
|
334
|
-
const document = validated.document;
|
|
335
|
-
if (document.schemaVersion === 3) {
|
|
336
|
-
await simulateGame3D(document, options);
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
const ticks = nonnegativeInteger(options.ticks, "ticks");
|
|
340
|
-
const seed = nonnegativeInteger(options.seed, "seed");
|
|
341
|
-
const expectedScore = options.expectScore === undefined
|
|
342
|
-
? undefined
|
|
343
|
-
: nonnegativeInteger(options.expectScore, "expect-score");
|
|
344
|
-
const inputs = await readInputs(options.inputs, gameInputFrame);
|
|
345
|
-
const contract = await readAssertions(options.assertions, ticks);
|
|
346
|
-
const storage = await headlessSaves(options.saves);
|
|
347
|
-
const session = await createScriptedGameSession(document, seed);
|
|
348
|
-
let resumed;
|
|
349
|
-
try {
|
|
350
|
-
const events = [];
|
|
351
|
-
const initialAssertion = contract?.byTick.get(0);
|
|
352
|
-
const failures = initialAssertion
|
|
353
|
-
? checkTick(initialAssertion, session.snapshot(), [], contract?.tolerance ?? 1e-9)
|
|
354
|
-
: [];
|
|
355
|
-
const resumeTick = Math.floor(ticks / 2);
|
|
356
|
-
let replayDivergence;
|
|
357
|
-
const startReplay = async (saved) => {
|
|
358
|
-
resumed = await createScriptedGameSession(document, seed, saved);
|
|
359
|
-
const difference = firstDifference(saved, resumed.snapshot(), "snapshot");
|
|
360
|
-
if (difference) {
|
|
361
|
-
replayDivergence = { tick: saved.tick, ...difference };
|
|
362
|
-
}
|
|
363
|
-
};
|
|
364
|
-
if (options.verifyReplay && resumeTick === 0) {
|
|
365
|
-
await startReplay(session.snapshot());
|
|
366
|
-
}
|
|
367
|
-
for (let tick = 0; tick < ticks; tick += 1) {
|
|
368
|
-
// The replay session steps the same frame, so a delivered load reaches both without storage.
|
|
369
|
-
const input = storage.saves.withLoaded(inputs[tick] ?? EMPTY_INPUT);
|
|
370
|
-
const result = session.step(input);
|
|
371
|
-
await storage.after(result.saveRequests, () => session.snapshot());
|
|
372
|
-
events.push(...result.events);
|
|
373
|
-
const assertion = contract?.byTick.get(result.tick);
|
|
374
|
-
const snapshot = assertion || (options.verifyReplay && result.tick >= resumeTick)
|
|
375
|
-
? session.snapshot()
|
|
376
|
-
: undefined;
|
|
377
|
-
if (assertion && snapshot) {
|
|
378
|
-
failures.push(...checkTick(assertion, snapshot, result.events, contract?.tolerance ?? 1e-9));
|
|
379
|
-
}
|
|
380
|
-
if (snapshot && options.verifyReplay && result.tick === resumeTick) {
|
|
381
|
-
await startReplay(snapshot);
|
|
382
|
-
}
|
|
383
|
-
if (resumed && snapshot && !replayDivergence && result.tick > resumeTick) {
|
|
384
|
-
const replayStep = resumed.step(input);
|
|
385
|
-
const difference = firstDifference(result.events, replayStep.events, "events")
|
|
386
|
-
?? firstDifference(snapshot, resumed.snapshot(), "snapshot");
|
|
387
|
-
if (difference) {
|
|
388
|
-
replayDivergence = { tick: result.tick, ...difference };
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
const snapshot = session.snapshot();
|
|
393
|
-
const assertions = {
|
|
394
|
-
score: expectedScore === undefined || snapshot.score === expectedScore,
|
|
395
|
-
win: options.expectWin !== true || snapshot.won,
|
|
396
|
-
ticks: failures.length === 0,
|
|
397
|
-
replay: !replayDivergence
|
|
398
|
-
};
|
|
399
|
-
const replay = options.verifyReplay
|
|
400
|
-
? { resumeTick, verified: !replayDivergence, divergence: replayDivergence }
|
|
401
|
-
: undefined;
|
|
402
|
-
const report = {
|
|
403
|
-
ticks, seed, snapshot, events, assertions, failures,
|
|
404
|
-
replay,
|
|
405
|
-
saves: storage.report(),
|
|
406
|
-
ok: Object.values(assertions).every(Boolean)
|
|
407
|
-
};
|
|
408
|
-
if (options.json) {
|
|
409
|
-
process.stdout.write(`${JSON.stringify(report)}\n`);
|
|
410
|
-
}
|
|
411
|
-
else {
|
|
412
|
-
process.stdout.write(`Tick ${snapshot.tick}: score ${snapshot.score}, won ${snapshot.won}\n`);
|
|
413
|
-
for (const failure of failures) {
|
|
414
|
-
process.stdout.write(`Tick ${failure.tick} ${failure.path}: expected ${JSON.stringify(failure.expected)}, got ${JSON.stringify(failure.actual)}\n`);
|
|
415
|
-
}
|
|
416
|
-
if (replayDivergence) {
|
|
417
|
-
process.stdout.write(`Replay diverged at tick ${replayDivergence.tick} ${replayDivergence.path}: expected ${JSON.stringify(replayDivergence.expected)}, got ${JSON.stringify(replayDivergence.actual)}\n`);
|
|
418
|
-
}
|
|
419
|
-
if (!assertions.score || !assertions.win) {
|
|
420
|
-
process.stdout.write("Game assertions failed\n");
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
if (!report.ok) {
|
|
424
|
-
process.exitCode = 1;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
finally {
|
|
428
|
-
resumed?.dispose();
|
|
429
|
-
session.dispose();
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
catch (error) {
|
|
433
|
-
process.exitCode = printCommandError(error, options.json);
|
|
434
|
-
}
|
|
435
|
-
});
|
|
436
|
-
game
|
|
437
|
-
.command("capture <game_file>")
|
|
438
|
-
.description("Capture one headless game frame as PNG")
|
|
439
|
-
.requiredOption("--ticks <count>", "Tick to capture")
|
|
440
|
-
.requiredOption("--out <file>", "PNG output path")
|
|
441
|
-
.option("--seed <integer>", "Random seed", "1")
|
|
442
|
-
.option("--inputs <file>", "JSON array of tick-indexed input frames")
|
|
443
|
-
.option("--scale <factor>", "Output scale", "1")
|
|
444
|
-
.option("--backend <canvas2d|webgpu|webgl2>", "Capture backend. Defaults to WebGL2 for 3D", "canvas2d")
|
|
445
|
-
.option("--assets-dir <directory>", "Local media files named <full-asset-id>.<extension>")
|
|
446
|
-
.option("--fail-on-budget", "3D only. Exit 1 when the frame exceeds a performance.budgets count (draw calls, triangles, particles)")
|
|
447
|
-
.option("--json", "Print a machine-readable report")
|
|
448
|
-
.action(async (path, options, command) => {
|
|
449
|
-
try {
|
|
450
|
-
const validated = validateCliDocument(await readGameDocument(path));
|
|
451
|
-
if (!validated.valid || !validated.document) {
|
|
452
|
-
throw new Error(validated.errors.join("\n"));
|
|
453
|
-
}
|
|
454
|
-
if (validated.document.schemaVersion === 3) {
|
|
455
|
-
const backend = command.getOptionValueSource("backend") === "default" ? "webgl2" : options.backend;
|
|
456
|
-
await captureGame3D(validated.document, { ...options, backend });
|
|
457
|
-
return;
|
|
458
|
-
}
|
|
459
|
-
if (options.failOnBudget) {
|
|
460
|
-
throw new Error("--fail-on-budget applies to 3D games. 2D capture reports no frame counters");
|
|
461
|
-
}
|
|
462
|
-
const ticks = nonnegativeInteger(options.ticks, "ticks");
|
|
463
|
-
if (ticks === 0)
|
|
464
|
-
throw new Error("ticks must be at least 1 for capture");
|
|
465
|
-
const seed = nonnegativeInteger(options.seed, "seed");
|
|
466
|
-
const scale = Number(options.scale);
|
|
467
|
-
if (!Number.isFinite(scale) || scale <= 0) {
|
|
468
|
-
throw new Error("scale must be a positive number");
|
|
469
|
-
}
|
|
470
|
-
if (options.backend !== "canvas2d" && options.backend !== "webgpu") {
|
|
471
|
-
throw new Error("backend must be canvas2d or webgpu");
|
|
472
|
-
}
|
|
473
|
-
const inputs = await readInputs(options.inputs, gameInputFrame);
|
|
474
|
-
const session = await createScriptedGameSession(validated.document, seed);
|
|
475
|
-
try {
|
|
476
|
-
const { captureGameFrame } = await importPack("game", "@nodetool-ai/game-renderer/node");
|
|
477
|
-
const { GameParticles2D } = await importPack("game", "@nodetool-ai/game-renderer");
|
|
478
|
-
const particles = new GameParticles2D(validated.document.tickRate);
|
|
479
|
-
let frame;
|
|
480
|
-
for (let tick = 0; tick < ticks; tick += 1) {
|
|
481
|
-
frame = session.step(inputs[tick] ?? EMPTY_INPUT).frame;
|
|
482
|
-
particles.tick(frame, session.takePresentationEvents());
|
|
483
|
-
}
|
|
484
|
-
if (!frame)
|
|
485
|
-
throw new Error("Game produced no render frame");
|
|
486
|
-
const diagnostics = [];
|
|
487
|
-
const png = await captureGameFrame(frame, {
|
|
488
|
-
scale,
|
|
489
|
-
particles,
|
|
490
|
-
backend: options.backend,
|
|
491
|
-
effects: validated.document.renderEffects,
|
|
492
|
-
hudEffectOrder: validated.document.hudEffectOrder,
|
|
493
|
-
onDiagnostic: (message) => diagnostics.push(message),
|
|
494
|
-
resolveAsset: async (key) => {
|
|
495
|
-
const sourceId = validated.document?.assets[key]?.assetId;
|
|
496
|
-
if (!sourceId)
|
|
497
|
-
return null;
|
|
498
|
-
return (await readBuildAsset(options.assetsDir, sourceId))?.bytes ?? null;
|
|
499
|
-
}
|
|
500
|
-
});
|
|
501
|
-
await writeFile(options.out, png);
|
|
502
|
-
const report = { path: options.out, tick: frame.tick, bytes: png.byteLength, diagnostics };
|
|
503
|
-
process.stdout.write(options.json ? `${JSON.stringify(report)}\n` : `Captured tick ${report.tick} to ${report.path}\n${diagnostics.map((message) => `${message}\n`).join("")}`);
|
|
504
|
-
}
|
|
505
|
-
finally {
|
|
506
|
-
session.dispose();
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
catch (error) {
|
|
510
|
-
process.exitCode = printCommandError(error, options.json);
|
|
511
|
-
}
|
|
512
|
-
});
|
|
513
|
-
game.command("perf <game_file>")
|
|
514
|
-
.description("Export a 3D game, play it in Chromium on the machine GPU and measure frame time, draw calls, triangles and shader program growth")
|
|
515
|
-
.option("--inputs <file>", "JSON array of input frames replayed with advance before live play")
|
|
516
|
-
.option("--seconds <seconds>", "Measured seconds of live play", "10")
|
|
517
|
-
.option("--warmup <seconds>", "Seconds of live play before the measurement", "2")
|
|
518
|
-
.option("--assets-dir <directory>", "Local media files named <full-asset-id>.<extension>. Shipped package:// assets resolve without it")
|
|
519
|
-
.option("--software", "Use SwiftShader instead of the machine GPU. Frame times then say nothing about real hardware")
|
|
520
|
-
.option("--vsync", "Keep vsync and Chromium's frame rate limit. By default frames are uncapped, so frame time shows the real cost")
|
|
521
|
-
.option("--keep-build <directory>", "Export into this directory and keep it, instead of a temporary directory")
|
|
522
|
-
.option("--profile <file>", "Write a Chrome CPU profile of the measured window and list its hottest functions. A source checkout keeps readable names")
|
|
523
|
-
.option("--fail-on-budget", "Exit 1 when frame p95 exceeds performance.budgets.frameMs (default 16.6), draw calls or triangles exceed their budgets, or shader programs grow during play")
|
|
524
|
-
.option("--json", "Print a machine-readable report")
|
|
525
|
-
.action(async (path, options) => {
|
|
526
|
-
let temporary;
|
|
527
|
-
try {
|
|
528
|
-
const validated = validateCliDocument(await readGameDocument(path));
|
|
529
|
-
if (!validated.valid || !validated.document) {
|
|
530
|
-
throw new Error(validated.errors.join("\n"));
|
|
531
|
-
}
|
|
532
|
-
const document = validated.document;
|
|
533
|
-
if (document.schemaVersion !== 3) {
|
|
534
|
-
throw new Error("game perf measures 3D games. Use game bench for 2D tick cost");
|
|
535
|
-
}
|
|
536
|
-
const inputs = await readInputs(options.inputs, gameInputFrame3D);
|
|
537
|
-
const outputDir = options.keepBuild ? resolve(options.keepBuild) : (temporary = await mkdtemp(join(tmpdir(), "nodetool-game-perf-")));
|
|
538
|
-
const { buildStandaloneGame3D } = await importPack("game", "@nodetool-ai/game-renderer/build3d");
|
|
539
|
-
await buildStandaloneGame3D({ document, outputDir, resolveAsset: (assetId) => readBuildAsset(options.assetsDir, assetId) });
|
|
540
|
-
const { measureStandaloneGame3D, formatGamePerfOverrun } = await importPack("game", "@nodetool-ai/game-renderer/perf");
|
|
541
|
-
// A recorded route never carries save loads, so the frames go to the page without them.
|
|
542
|
-
const report = await measureStandaloneGame3D(outputDir, { inputs: inputs.map(({ loaded: _loaded, ...frame }) => frame),
|
|
543
|
-
seconds: Number(options.seconds), warmupSeconds: Number(options.warmup), software: options.software, vsync: options.vsync,
|
|
544
|
-
profile: options.profile ? resolve(options.profile) : undefined });
|
|
545
|
-
if (options.json) {
|
|
546
|
-
process.stdout.write(`${JSON.stringify(report)}\n`);
|
|
547
|
-
}
|
|
548
|
-
else {
|
|
549
|
-
const round = (value) => Math.round(value * 100) / 100;
|
|
550
|
-
process.stdout.write([
|
|
551
|
-
`GPU ${report.gpu.renderer} (${report.gpu.adapterType}), canvas ${report.canvas.width}x${report.canvas.height}, ${report.vsync ? "vsync" : "uncapped"}`,
|
|
552
|
-
`${report.renderedFrames} frames in ${report.seconds} s: ${round(report.fps)} fps`,
|
|
553
|
-
`Frame ms p50 ${round(report.frameMs.p50)}, p95 ${round(report.frameMs.p95)}, p99 ${round(report.frameMs.p99)}, max ${round(report.frameMs.max)}`,
|
|
554
|
-
`Draw calls p95 ${report.drawCalls.p95}, triangles p95 ${report.triangles.p95}`,
|
|
555
|
-
`Shader programs ${report.programs.start} -> ${report.programs.end} (growth ${report.programs.growth})`,
|
|
556
|
-
...report.profile ? [`Profile ${report.profile.path}, ${round(report.profile.sampledMs)} ms sampled. Hottest self time:`,
|
|
557
|
-
...report.profile.top.slice(0, 10).map((entry) => ` ${entry.percent}% ${entry.functionName} ${entry.url}:${entry.line}`),
|
|
558
|
-
...report.profile.suspects.map((entry) => `Suspect in steady play: ${entry.functionName} ${entry.percent}%`)] : [],
|
|
559
|
-
...report.warnings, ...report.errors
|
|
560
|
-
].join("\n") + "\n");
|
|
561
|
-
for (const overrun of report.budget.overruns) {
|
|
562
|
-
process.stderr.write(`${formatGamePerfOverrun(overrun)}\n`);
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
if (!report.ok || (options.failOnBudget && report.budget.overruns.length > 0)) {
|
|
566
|
-
process.exitCode = 1;
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
catch (error) {
|
|
570
|
-
process.exitCode = printCommandError(error, options.json);
|
|
571
|
-
}
|
|
572
|
-
finally {
|
|
573
|
-
if (temporary) {
|
|
574
|
-
await rm(temporary, { recursive: true, force: true });
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
});
|
|
578
|
-
game
|
|
579
|
-
.command("build <game_file>")
|
|
580
|
-
.description("Build a standalone web player, a Tauri desktop app project or an Expo mobile app project, with local, content-addressed assets")
|
|
581
|
-
.requiredOption("--out <directory>", "Build output directory")
|
|
582
|
-
.option("--assets-dir <directory>", "Local media files named <full-asset-id>.<extension>")
|
|
583
|
-
.option("--target <target>", "web for a static web player, tauri for a desktop app project, expo for an iOS and Android app project", "web")
|
|
584
|
-
.option("--name <name>", "App name (tauri and expo targets)")
|
|
585
|
-
.option("--identifier <identifier>", "Reverse-DNS app identifier (tauri and expo targets)")
|
|
586
|
-
.option("--app-version <version>", "App version MAJOR.MINOR.PATCH (tauri and expo targets)")
|
|
587
|
-
.option("--icon <file>", "PNG, JPEG or WebP image for the app icon (tauri and expo targets)")
|
|
588
|
-
.option("--orientation <orientation>", "default, portrait or landscape screen lock (expo target)")
|
|
589
|
-
.option("--compile", "Also compile a release executable with cargo (tauri target)")
|
|
590
|
-
.option("--json", "Print a machine-readable report")
|
|
591
|
-
.action(async (path, options) => {
|
|
592
|
-
try {
|
|
593
|
-
const validated = validateCliDocument(await readGameDocument(path));
|
|
594
|
-
if (!validated.valid || !validated.document) {
|
|
595
|
-
throw new Error(validated.errors.join("\n"));
|
|
596
|
-
}
|
|
597
|
-
if (options.target !== "web" && options.target !== "tauri" && options.target !== "expo") {
|
|
598
|
-
throw new Error("--target must be web, tauri or expo");
|
|
599
|
-
}
|
|
600
|
-
if (options.target === "web" && (options.name || options.identifier || options.appVersion || options.icon || options.orientation || options.compile)) {
|
|
601
|
-
throw new Error("--name, --identifier, --app-version, --icon, --orientation and --compile apply to --target tauri or expo");
|
|
602
|
-
}
|
|
603
|
-
if (options.compile && options.target !== "tauri") {
|
|
604
|
-
throw new Error("--compile applies to --target tauri");
|
|
605
|
-
}
|
|
606
|
-
if (options.orientation && options.target !== "expo") {
|
|
607
|
-
throw new Error("--orientation applies to --target expo");
|
|
608
|
-
}
|
|
609
|
-
if (options.target === "expo") {
|
|
610
|
-
const orientation = options.orientation;
|
|
611
|
-
if (orientation !== undefined && orientation !== "default" && orientation !== "portrait" && orientation !== "landscape") {
|
|
612
|
-
throw new Error("--orientation must be default, portrait or landscape");
|
|
613
|
-
}
|
|
614
|
-
const { buildExpoGameProject } = await importPack("game", "@nodetool-ai/game-renderer/build-expo");
|
|
615
|
-
const project = await buildExpoGameProject({
|
|
616
|
-
document: validated.document, outputDir: resolve(options.out), resolveAsset: (assetId) => readBuildAsset(options.assetsDir, assetId),
|
|
617
|
-
app: { name: options.name, identifier: options.identifier, version: options.appVersion, orientation,
|
|
618
|
-
icon: options.icon ? await readFile(options.icon) : undefined }
|
|
619
|
-
});
|
|
620
|
-
process.stdout.write(options.json ? `${JSON.stringify(project)}\n`
|
|
621
|
-
: `Built mobile app project in ${project.outputDir}\nRun npm install && npx expo start there to play it on a phone.\n`);
|
|
622
|
-
return;
|
|
623
|
-
}
|
|
624
|
-
if (options.target === "tauri") {
|
|
625
|
-
const { buildTauriGameProject, compileTauriGameProject } = await importPack("game", "@nodetool-ai/game-renderer/build-tauri");
|
|
626
|
-
const project = await buildTauriGameProject({
|
|
627
|
-
document: validated.document, outputDir: resolve(options.out), resolveAsset: (assetId) => readBuildAsset(options.assetsDir, assetId),
|
|
628
|
-
app: { name: options.name, identifier: options.identifier, version: options.appVersion,
|
|
629
|
-
icon: options.icon ? await readFile(options.icon) : undefined }
|
|
630
|
-
});
|
|
631
|
-
const compiled = options.compile
|
|
632
|
-
? await compileTauriGameProject(project, { onOutput: options.json ? undefined : (chunk) => process.stderr.write(chunk) })
|
|
633
|
-
: undefined;
|
|
634
|
-
const report = { ...project };
|
|
635
|
-
if (compiled) {
|
|
636
|
-
report.binaryPath = compiled.binaryPath;
|
|
637
|
-
}
|
|
638
|
-
process.stdout.write(options.json ? `${JSON.stringify(report)}\n`
|
|
639
|
-
: `Built desktop app project in ${project.outputDir}\n${compiled ? `Compiled ${compiled.binaryPath}\n` : "Run npm install && npm run build there to make installers.\n"}`);
|
|
640
|
-
return;
|
|
641
|
-
}
|
|
642
|
-
const result = validated.document.schemaVersion === 3 ? await (await importPack("game", "@nodetool-ai/game-renderer/build3d")).buildStandaloneGame3D({
|
|
643
|
-
document: validated.document, outputDir: resolve(options.out), resolveAsset: (assetId) => readBuildAsset(options.assetsDir, assetId)
|
|
644
|
-
}) : await (await importPack("game", "@nodetool-ai/game-renderer/build")).buildStandaloneGame({
|
|
645
|
-
document: validated.document, outputDir: options.out, resolveAsset: (assetId) => readBuildAsset(options.assetsDir, assetId)
|
|
646
|
-
});
|
|
647
|
-
process.stdout.write(options.json ? `${JSON.stringify(result)}\n` : `Built game in ${result.outputDir}\n`);
|
|
648
|
-
}
|
|
649
|
-
catch (error) {
|
|
650
|
-
process.exitCode = printCommandError(error, options.json);
|
|
651
|
-
}
|
|
652
|
-
});
|
|
653
|
-
}
|
|
654
|
-
const EMPTY_INPUT = { pressed: [], justPressed: [] };
|
|
655
|
-
const tickAssertion3D = z.strictObject({
|
|
656
|
-
tick: z.number().int().nonnegative(), sceneId: z.string().min(1).optional(),
|
|
657
|
-
entities: z.array(z.strictObject({ id: z.string().min(1), x: z.number().finite().optional(), y: z.number().finite().optional(),
|
|
658
|
-
z: z.number().finite().optional(), active: z.boolean().optional(), grounded: z.boolean().optional() })).optional(),
|
|
659
|
-
events: z.array(z.union(gameEvent3D.options.map((variant) => variant.strict()))).optional()
|
|
660
|
-
});
|
|
661
|
-
async function readAssertions3D(path, ticks) {
|
|
662
|
-
if (!path) {
|
|
663
|
-
return undefined;
|
|
664
|
-
}
|
|
665
|
-
const parsed = gameAssertions.extend({ ticks: z.array(tickAssertion3D) }).safeParse(await readDocument(path));
|
|
666
|
-
if (!parsed.success) {
|
|
667
|
-
throw new Error(`Invalid 3D game assertions: ${parsed.error.message}`);
|
|
668
|
-
}
|
|
669
|
-
const byTick = new Map();
|
|
670
|
-
for (const assertion of parsed.data.ticks) {
|
|
671
|
-
if (assertion.tick > ticks) {
|
|
672
|
-
throw new Error(`Assertion tick ${assertion.tick} exceeds requested ${ticks} ticks`);
|
|
673
|
-
}
|
|
674
|
-
if (byTick.has(assertion.tick)) {
|
|
675
|
-
throw new Error(`Duplicate assertion for tick ${assertion.tick}`);
|
|
676
|
-
}
|
|
677
|
-
byTick.set(assertion.tick, assertion);
|
|
678
|
-
}
|
|
679
|
-
return { byTick, tolerance: parsed.data.tolerance };
|
|
680
|
-
}
|
|
681
|
-
function checkTick3D(assertion, snapshot, events, tolerance) {
|
|
682
|
-
const failures = [];
|
|
683
|
-
const check = (path, expected, actual) => {
|
|
684
|
-
if (!isDeepStrictEqual(expected, actual)) {
|
|
685
|
-
failures.push({ tick: assertion.tick, path, expected, actual: actual ?? null });
|
|
686
|
-
}
|
|
687
|
-
};
|
|
688
|
-
if (assertion.sceneId !== undefined) {
|
|
689
|
-
check("sceneId", assertion.sceneId, snapshot.sceneId);
|
|
690
|
-
}
|
|
691
|
-
for (const expected of assertion.entities ?? []) {
|
|
692
|
-
const entity = snapshot.entities.find((candidate) => candidate.id === expected.id);
|
|
693
|
-
if (!entity) {
|
|
694
|
-
check(`entities.${expected.id}`, "present", "missing");
|
|
695
|
-
continue;
|
|
696
|
-
}
|
|
697
|
-
for (const axis of ["x", "y", "z"]) {
|
|
698
|
-
if (expected[axis] !== undefined && Math.abs(entity.transform.position[axis] - expected[axis]) > tolerance) {
|
|
699
|
-
check(`entities.${entity.id}.${axis}`, expected[axis], entity.transform.position[axis]);
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
if (expected.active !== undefined) {
|
|
703
|
-
check(`entities.${entity.id}.active`, expected.active, entity.active);
|
|
704
|
-
}
|
|
705
|
-
if (expected.grounded !== undefined) {
|
|
706
|
-
check(`entities.${entity.id}.grounded`, expected.grounded, entity.grounded);
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
if (assertion.events !== undefined) {
|
|
710
|
-
const difference = firstDifference(assertion.events, events, "events");
|
|
711
|
-
if (difference) {
|
|
712
|
-
failures.push({ tick: assertion.tick, ...difference });
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
return failures;
|
|
716
|
-
}
|
|
717
|
-
function sessionAssetOptions3D(directory) {
|
|
718
|
-
return { resolveCollider: async (binding) => {
|
|
719
|
-
const asset = await readBuildAsset(directory, binding.assetId);
|
|
720
|
-
if (!asset) {
|
|
721
|
-
throw new Error(`Prepared collider ${binding.assetId} is unavailable. Pass --assets-dir.`);
|
|
722
|
-
}
|
|
723
|
-
return decodePreparedGameCollider3D(asset.bytes, binding);
|
|
724
|
-
} };
|
|
725
|
-
}
|
|
726
|
-
async function simulateGame3D(document, options) {
|
|
727
|
-
const ticks = nonnegativeInteger(options.ticks, "ticks");
|
|
728
|
-
const seed = nonnegativeInteger(options.seed, "seed");
|
|
729
|
-
const expectedScore = options.expectScore === undefined ? undefined : nonnegativeInteger(options.expectScore, "expect-score");
|
|
730
|
-
const inputs = await readInputs(options.inputs, gameInputFrame3D);
|
|
731
|
-
const contract = await readAssertions3D(options.assertions, ticks);
|
|
732
|
-
const storage = await headlessSaves(options.saves);
|
|
733
|
-
const sessionOptions = sessionAssetOptions3D(options.assetsDir);
|
|
734
|
-
const session = await createGameSession3D(document, seed, undefined, sessionOptions);
|
|
735
|
-
let resumed;
|
|
736
|
-
try {
|
|
737
|
-
const events = [];
|
|
738
|
-
const initialAssertion = contract?.byTick.get(0);
|
|
739
|
-
const failures = initialAssertion ? checkTick3D(initialAssertion, session.snapshot(), [], contract?.tolerance ?? 1e-9) : [];
|
|
740
|
-
const resumeTick = Math.floor(ticks / 2);
|
|
741
|
-
let replayDivergence;
|
|
742
|
-
const startReplay = async (snapshot) => {
|
|
743
|
-
resumed = await createGameSession3D(document, seed, snapshot, sessionOptions);
|
|
744
|
-
const difference = firstDifference(snapshot, resumed.snapshot(), "snapshot");
|
|
745
|
-
if (difference) {
|
|
746
|
-
replayDivergence = { tick: snapshot.tick, ...difference };
|
|
747
|
-
}
|
|
748
|
-
};
|
|
749
|
-
if (options.verifyReplay && resumeTick === 0) {
|
|
750
|
-
await startReplay(session.snapshot());
|
|
751
|
-
}
|
|
752
|
-
for (let tick = 0; tick < ticks; tick++) {
|
|
753
|
-
if (tick % 240 === 0) {
|
|
754
|
-
await new Promise((resolveTick) => setTimeout(resolveTick, 0));
|
|
755
|
-
}
|
|
756
|
-
const input = storage.saves.withLoaded(inputs[tick] ?? gameInputFrame3D.parse({ pressed: [] }));
|
|
757
|
-
const result = session.step(input);
|
|
758
|
-
await storage.after(result.saveRequests, () => session.snapshot());
|
|
759
|
-
events.push(...result.events);
|
|
760
|
-
const assertion = contract?.byTick.get(result.tick);
|
|
761
|
-
const snapshot = assertion || options.verifyReplay && result.tick >= resumeTick ? session.snapshot() : undefined;
|
|
762
|
-
if (assertion && snapshot) {
|
|
763
|
-
failures.push(...checkTick3D(assertion, snapshot, result.events, contract?.tolerance ?? 1e-9));
|
|
764
|
-
}
|
|
765
|
-
if (snapshot && options.verifyReplay && result.tick === resumeTick) {
|
|
766
|
-
await startReplay(snapshot);
|
|
767
|
-
}
|
|
768
|
-
if (snapshot && resumed && !replayDivergence && result.tick > resumeTick) {
|
|
769
|
-
const replayStep = resumed.step(input);
|
|
770
|
-
const difference = firstDifference(result.events, replayStep.events, "events") ?? firstDifference(snapshot, resumed.snapshot(), "snapshot");
|
|
771
|
-
if (difference) {
|
|
772
|
-
replayDivergence = { tick: result.tick, ...difference };
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
const snapshot = session.snapshot();
|
|
777
|
-
const assertions = { score: expectedScore === undefined || snapshot.score === expectedScore, win: options.expectWin !== true || snapshot.won,
|
|
778
|
-
ticks: failures.length === 0, replay: !replayDivergence };
|
|
779
|
-
const report = { dimension: "3d", ticks, seed, snapshot, state_hash: await hashGameSnapshot3D(snapshot), events, assertions, failures,
|
|
780
|
-
replay: options.verifyReplay ? { resumeTick, verified: !replayDivergence, divergence: replayDivergence } : undefined,
|
|
781
|
-
saves: storage.report(), ok: Object.values(assertions).every(Boolean) };
|
|
782
|
-
if (options.json) {
|
|
783
|
-
process.stdout.write(`${JSON.stringify(report)}\n`);
|
|
784
|
-
}
|
|
785
|
-
else {
|
|
786
|
-
process.stdout.write(`Tick ${snapshot.tick}: score ${snapshot.score}, won ${snapshot.won}\n`);
|
|
787
|
-
for (const failure of failures) {
|
|
788
|
-
process.stdout.write(`Tick ${failure.tick} ${failure.path}: expected ${JSON.stringify(failure.expected)}, got ${JSON.stringify(failure.actual)}\n`);
|
|
789
|
-
}
|
|
790
|
-
if (replayDivergence) {
|
|
791
|
-
process.stdout.write(`Replay diverged at tick ${replayDivergence.tick} ${replayDivergence.path}\n`);
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
if (!report.ok) {
|
|
795
|
-
process.exitCode = 1;
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
finally {
|
|
799
|
-
resumed?.dispose();
|
|
800
|
-
session.dispose();
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
async function captureGame3D(document, options) {
|
|
804
|
-
const ticks = nonnegativeInteger(options.ticks, "ticks");
|
|
805
|
-
if (ticks === 0) {
|
|
806
|
-
throw new Error("ticks must be at least 1 for capture");
|
|
807
|
-
}
|
|
808
|
-
const seed = nonnegativeInteger(options.seed, "seed");
|
|
809
|
-
const scale = Number(options.scale);
|
|
810
|
-
if (!Number.isFinite(scale) || scale <= 0 || scale > 4) {
|
|
811
|
-
throw new Error("3D capture scale must be greater than 0 and at most 4");
|
|
812
|
-
}
|
|
813
|
-
if (options.backend !== "webgl2") {
|
|
814
|
-
throw new Error("3D capture backend must be webgl2");
|
|
815
|
-
}
|
|
816
|
-
const inputs = await readInputs(options.inputs, gameInputFrame3D);
|
|
817
|
-
const session = await createGameSession3D(document, seed, undefined, sessionAssetOptions3D(options.assetsDir));
|
|
818
|
-
try {
|
|
819
|
-
const { GameParticles3D } = await importPack("game", "@nodetool-ai/game-renderer");
|
|
820
|
-
const particles = new GameParticles3D(document.tickRate);
|
|
821
|
-
for (let tick = 0; tick < ticks; tick++) {
|
|
822
|
-
const step = session.step(inputs[tick] ?? gameInputFrame3D.parse({ pressed: [] }));
|
|
823
|
-
particles.tick(step.frame, session.takePresentationEvents());
|
|
824
|
-
}
|
|
825
|
-
const frame = session.frame();
|
|
826
|
-
const stateHash = await hashGameSnapshot3D(session.snapshot());
|
|
827
|
-
const { captureGameFrame3D } = await importPack("game", "@nodetool-ai/game-renderer/node3d");
|
|
828
|
-
const captured = await captureGameFrame3D(frame, { stateHash, interpolation: 1, particles,
|
|
829
|
-
width: Math.round(document.presentation.hudWidth * scale), height: Math.round(document.presentation.hudHeight * scale),
|
|
830
|
-
resolveAsset: async (slot) => {
|
|
831
|
-
const binding = document.assets[slot];
|
|
832
|
-
const asset = binding ? await readBuildAsset(options.assetsDir, binding.assetId) : null;
|
|
833
|
-
return asset ? { bytes: asset.bytes, digest: binding.digest } : null;
|
|
834
|
-
} });
|
|
835
|
-
const path = resolve(options.out);
|
|
836
|
-
await writeFile(path, captured.png);
|
|
837
|
-
const { formatGameFrameBudgetOverrun, gameFrameBudgetOverruns, resolveGameFrameBudgets } = await importPack("game", "@nodetool-ai/game-renderer");
|
|
838
|
-
const limits = resolveGameFrameBudgets(document.performance?.budgets);
|
|
839
|
-
const overruns = gameFrameBudgetOverruns({ drawCalls: captured.stats.drawCalls, triangles: captured.stats.triangles, particles: particles.count }, limits);
|
|
840
|
-
const report = { dimension: "3d", path, tick: frame.tick, bytes: captured.png.byteLength, state_hash: stateHash,
|
|
841
|
-
capabilities: captured.capabilities, stats: captured.stats, budget: { limits, overruns }, projected_bounds: captured.projectedBounds, diagnostics: [] };
|
|
842
|
-
process.stdout.write(options.json ? `${JSON.stringify(report)}\n` : `Captured tick ${report.tick} to ${report.path}\n`);
|
|
843
|
-
if (!options.json) {
|
|
844
|
-
for (const overrun of overruns) {
|
|
845
|
-
process.stderr.write(`${formatGameFrameBudgetOverrun(overrun)}\n`);
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
if (options.failOnBudget && overruns.length > 0) {
|
|
849
|
-
process.exitCode = 1;
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
finally {
|
|
853
|
-
session.dispose();
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
//# sourceMappingURL=game.js.map
|