@nodetool-ai/protocol 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 +56 -0
- package/dist/.nodetool-build-stamp +1 -0
- package/dist/ai-video-production.d.ts +276 -0
- package/dist/ai-video-production.d.ts.map +1 -0
- package/dist/ai-video-production.js +131 -0
- package/dist/ai-video-production.js.map +1 -0
- package/dist/api-schemas/agent-access.d.ts +134 -0
- package/dist/api-schemas/agent-access.d.ts.map +1 -0
- package/dist/api-schemas/agent-access.js +93 -0
- package/dist/api-schemas/agent-access.js.map +1 -0
- package/dist/api-schemas/api-error-code.d.ts +11 -1
- package/dist/api-schemas/api-error-code.d.ts.map +1 -1
- package/dist/api-schemas/api-error-code.js +10 -0
- package/dist/api-schemas/api-error-code.js.map +1 -1
- package/dist/api-schemas/app-runs.d.ts +1410 -0
- package/dist/api-schemas/app-runs.d.ts.map +1 -0
- package/dist/api-schemas/app-runs.js +105 -0
- package/dist/api-schemas/app-runs.js.map +1 -0
- package/dist/api-schemas/applications.d.ts +3216 -0
- package/dist/api-schemas/applications.d.ts.map +1 -0
- package/dist/api-schemas/applications.js +487 -0
- package/dist/api-schemas/applications.js.map +1 -0
- package/dist/api-schemas/assets.d.ts +239 -0
- package/dist/api-schemas/assets.d.ts.map +1 -1
- package/dist/api-schemas/assets.js +136 -5
- package/dist/api-schemas/assets.js.map +1 -1
- package/dist/api-schemas/bug-reports.d.ts +38 -0
- package/dist/api-schemas/bug-reports.d.ts.map +1 -0
- package/dist/api-schemas/bug-reports.js +34 -0
- package/dist/api-schemas/bug-reports.js.map +1 -0
- package/dist/api-schemas/code-gen.d.ts +176 -0
- package/dist/api-schemas/code-gen.d.ts.map +1 -0
- package/dist/api-schemas/code-gen.js +205 -0
- package/dist/api-schemas/code-gen.js.map +1 -0
- package/dist/api-schemas/collections.d.ts.map +1 -1
- package/dist/api-schemas/collections.js +3 -4
- package/dist/api-schemas/collections.js.map +1 -1
- package/dist/api-schemas/costs.d.ts +179 -0
- package/dist/api-schemas/costs.d.ts.map +1 -1
- package/dist/api-schemas/costs.js +100 -4
- package/dist/api-schemas/costs.js.map +1 -1
- package/dist/api-schemas/credits.d.ts +42 -0
- package/dist/api-schemas/credits.d.ts.map +1 -0
- package/dist/api-schemas/credits.js +43 -0
- package/dist/api-schemas/credits.js.map +1 -0
- package/dist/api-schemas/documents.d.ts +163 -0
- package/dist/api-schemas/documents.d.ts.map +1 -0
- package/dist/api-schemas/documents.js +75 -0
- package/dist/api-schemas/documents.js.map +1 -0
- package/dist/api-schemas/error-traces.d.ts +249 -0
- package/dist/api-schemas/error-traces.d.ts.map +1 -0
- package/dist/api-schemas/error-traces.js +112 -0
- package/dist/api-schemas/error-traces.js.map +1 -0
- package/dist/api-schemas/files.d.ts +13 -0
- package/dist/api-schemas/files.d.ts.map +1 -1
- package/dist/api-schemas/files.js +8 -0
- package/dist/api-schemas/files.js.map +1 -1
- package/dist/api-schemas/fonts.d.ts +17 -1
- package/dist/api-schemas/fonts.d.ts.map +1 -1
- package/dist/api-schemas/fonts.js +19 -3
- package/dist/api-schemas/fonts.js.map +1 -1
- package/dist/api-schemas/index.d.ts +27 -1
- package/dist/api-schemas/index.d.ts.map +1 -1
- package/dist/api-schemas/index.js +27 -1
- package/dist/api-schemas/index.js.map +1 -1
- package/dist/api-schemas/jobs.d.ts +44 -0
- package/dist/api-schemas/jobs.d.ts.map +1 -1
- package/dist/api-schemas/jobs.js +26 -2
- package/dist/api-schemas/jobs.js.map +1 -1
- package/dist/api-schemas/js-scripts.d.ts +367 -0
- package/dist/api-schemas/js-scripts.d.ts.map +1 -0
- package/dist/api-schemas/js-scripts.js +341 -0
- package/dist/api-schemas/js-scripts.js.map +1 -0
- package/dist/api-schemas/mcp-config.d.ts +4 -1
- package/dist/api-schemas/mcp-config.d.ts.map +1 -1
- package/dist/api-schemas/mcp-config.js +10 -3
- package/dist/api-schemas/mcp-config.js.map +1 -1
- package/dist/api-schemas/memories.d.ts +84 -0
- package/dist/api-schemas/memories.d.ts.map +1 -0
- package/dist/api-schemas/memories.js +54 -0
- package/dist/api-schemas/memories.js.map +1 -0
- package/dist/api-schemas/messages.d.ts +1 -0
- package/dist/api-schemas/messages.d.ts.map +1 -1
- package/dist/api-schemas/messages.js +4 -4
- package/dist/api-schemas/messages.js.map +1 -1
- package/dist/api-schemas/models.d.ts +164 -0
- package/dist/api-schemas/models.d.ts.map +1 -1
- package/dist/api-schemas/models.js +53 -6
- package/dist/api-schemas/models.js.map +1 -1
- package/dist/api-schemas/nodes.d.ts +97 -0
- package/dist/api-schemas/nodes.d.ts.map +1 -1
- package/dist/api-schemas/nodes.js +89 -0
- package/dist/api-schemas/nodes.js.map +1 -1
- package/dist/api-schemas/projects.d.ts +427 -0
- package/dist/api-schemas/projects.d.ts.map +1 -0
- package/dist/api-schemas/projects.js +224 -0
- package/dist/api-schemas/projects.js.map +1 -0
- package/dist/api-schemas/recipes.d.ts +172 -0
- package/dist/api-schemas/recipes.d.ts.map +1 -0
- package/dist/api-schemas/recipes.js +144 -0
- package/dist/api-schemas/recipes.js.map +1 -0
- package/dist/api-schemas/resources.d.ts +112 -0
- package/dist/api-schemas/resources.d.ts.map +1 -0
- package/dist/api-schemas/resources.js +44 -0
- package/dist/api-schemas/resources.js.map +1 -0
- package/dist/api-schemas/runs.d.ts +6 -0
- package/dist/api-schemas/runs.d.ts.map +1 -0
- package/dist/api-schemas/runs.js +4 -0
- package/dist/api-schemas/runs.js.map +1 -0
- package/dist/api-schemas/scripts.d.ts +1571 -0
- package/dist/api-schemas/scripts.d.ts.map +1 -0
- package/dist/api-schemas/scripts.js +153 -0
- package/dist/api-schemas/scripts.js.map +1 -0
- package/dist/api-schemas/sdk-execution-v1.d.ts +468 -0
- package/dist/api-schemas/sdk-execution-v1.d.ts.map +1 -0
- package/dist/api-schemas/sdk-execution-v1.js +115 -0
- package/dist/api-schemas/sdk-execution-v1.js.map +1 -0
- package/dist/api-schemas/sdk-lifecycle-v1.d.ts +217 -0
- package/dist/api-schemas/sdk-lifecycle-v1.d.ts.map +1 -0
- package/dist/api-schemas/sdk-lifecycle-v1.js +117 -0
- package/dist/api-schemas/sdk-lifecycle-v1.js.map +1 -0
- package/dist/api-schemas/sdk-models-v1.d.ts +181 -0
- package/dist/api-schemas/sdk-models-v1.d.ts.map +1 -0
- package/dist/api-schemas/sdk-models-v1.js +108 -0
- package/dist/api-schemas/sdk-models-v1.js.map +1 -0
- package/dist/api-schemas/sdk-v1-http-operations.d.ts +941 -0
- package/dist/api-schemas/sdk-v1-http-operations.d.ts.map +1 -0
- package/dist/api-schemas/sdk-v1-http-operations.js +465 -0
- package/dist/api-schemas/sdk-v1-http-operations.js.map +1 -0
- package/dist/api-schemas/sdk-v1-operations.d.ts +151 -0
- package/dist/api-schemas/sdk-v1-operations.d.ts.map +1 -0
- package/dist/api-schemas/sdk-v1-operations.js +97 -0
- package/dist/api-schemas/sdk-v1-operations.js.map +1 -0
- package/dist/api-schemas/sdk-v1-websocket-operations.d.ts +97 -0
- package/dist/api-schemas/sdk-v1-websocket-operations.d.ts.map +1 -0
- package/dist/api-schemas/sdk-v1-websocket-operations.js +96 -0
- package/dist/api-schemas/sdk-v1-websocket-operations.js.map +1 -0
- package/dist/api-schemas/sdk-v1.d.ts +15 -0
- package/dist/api-schemas/sdk-v1.d.ts.map +1 -0
- package/dist/api-schemas/sdk-v1.js +22 -0
- package/dist/api-schemas/sdk-v1.js.map +1 -0
- package/dist/api-schemas/segmentation.d.ts +75 -0
- package/dist/api-schemas/segmentation.d.ts.map +1 -0
- package/dist/api-schemas/segmentation.js +54 -0
- package/dist/api-schemas/segmentation.js.map +1 -0
- package/dist/api-schemas/settings.d.ts +162 -0
- package/dist/api-schemas/settings.d.ts.map +1 -1
- package/dist/api-schemas/settings.js +71 -0
- package/dist/api-schemas/settings.js.map +1 -1
- package/dist/api-schemas/sketch.d.ts +858 -0
- package/dist/api-schemas/sketch.d.ts.map +1 -0
- package/dist/api-schemas/sketch.js +546 -0
- package/dist/api-schemas/sketch.js.map +1 -0
- package/dist/api-schemas/skills.d.ts +27 -14
- package/dist/api-schemas/skills.d.ts.map +1 -1
- package/dist/api-schemas/skills.js +64 -11
- package/dist/api-schemas/skills.js.map +1 -1
- package/dist/api-schemas/storage.d.ts +8 -0
- package/dist/api-schemas/storage.d.ts.map +1 -1
- package/dist/api-schemas/storage.js +7 -0
- package/dist/api-schemas/storage.js.map +1 -1
- package/dist/api-schemas/storyboards.d.ts +8595 -0
- package/dist/api-schemas/storyboards.d.ts.map +1 -0
- package/dist/api-schemas/storyboards.js +524 -0
- package/dist/api-schemas/storyboards.js.map +1 -0
- package/dist/api-schemas/threads.d.ts +12 -4
- package/dist/api-schemas/threads.d.ts.map +1 -1
- package/dist/api-schemas/threads.js +12 -4
- package/dist/api-schemas/threads.js.map +1 -1
- package/dist/api-schemas/timeline-tool-contracts.d.ts +1687 -0
- package/dist/api-schemas/timeline-tool-contracts.d.ts.map +1 -0
- package/dist/api-schemas/timeline-tool-contracts.js +725 -0
- package/dist/api-schemas/timeline-tool-contracts.js.map +1 -0
- package/dist/api-schemas/timeline-tool-params.d.ts +1270 -0
- package/dist/api-schemas/timeline-tool-params.d.ts.map +1 -0
- package/dist/api-schemas/timeline-tool-params.js +1529 -0
- package/dist/api-schemas/timeline-tool-params.js.map +1 -0
- package/dist/api-schemas/timeline.d.ts +13740 -0
- package/dist/api-schemas/timeline.d.ts.map +1 -0
- package/dist/api-schemas/timeline.js +1928 -0
- package/dist/api-schemas/timeline.js.map +1 -0
- package/dist/api-schemas/ui-tool-contract.d.ts +35 -0
- package/dist/api-schemas/ui-tool-contract.d.ts.map +1 -0
- package/dist/api-schemas/ui-tool-contract.js +31 -0
- package/dist/api-schemas/ui-tool-contract.js.map +1 -0
- package/dist/api-schemas/workflows.d.ts +904 -18
- package/dist/api-schemas/workflows.d.ts.map +1 -1
- package/dist/api-schemas/workflows.js +507 -6
- package/dist/api-schemas/workflows.js.map +1 -1
- package/dist/api-schemas/workspace.d.ts +45 -0
- package/dist/api-schemas/workspace.d.ts.map +1 -1
- package/dist/api-schemas/workspace.js +47 -1
- package/dist/api-schemas/workspace.js.map +1 -1
- package/dist/api-types.d.ts +651 -27
- package/dist/api-types.d.ts.map +1 -1
- package/dist/api-types.js +252 -1
- package/dist/api-types.js.map +1 -1
- package/dist/app-deployment.d.ts +37 -0
- package/dist/app-deployment.d.ts.map +1 -0
- package/dist/app-deployment.js +42 -0
- package/dist/app-deployment.js.map +1 -0
- package/dist/asset-file-name.d.ts +15 -0
- package/dist/asset-file-name.d.ts.map +1 -0
- package/dist/asset-file-name.js +61 -0
- package/dist/asset-file-name.js.map +1 -0
- package/dist/asset-generation.d.ts +58 -0
- package/dist/asset-generation.d.ts.map +1 -0
- package/dist/asset-generation.js +147 -0
- package/dist/asset-generation.js.map +1 -0
- package/dist/blend-modes.d.ts +20 -0
- package/dist/blend-modes.d.ts.map +1 -0
- package/dist/blend-modes.js +33 -0
- package/dist/blend-modes.js.map +1 -0
- package/dist/bridge-frames.d.ts +654 -0
- package/dist/bridge-frames.d.ts.map +1 -0
- package/dist/bridge-frames.js +448 -0
- package/dist/bridge-frames.js.map +1 -0
- package/dist/bridge-frames.schema.json +862 -0
- package/dist/bridge-protocol.d.ts +57 -20
- package/dist/bridge-protocol.d.ts.map +1 -1
- package/dist/bridge-protocol.js +57 -20
- package/dist/bridge-protocol.js.map +1 -1
- package/dist/browser-run-traces.d.ts +102 -0
- package/dist/browser-run-traces.d.ts.map +1 -0
- package/dist/browser-run-traces.js +30 -0
- package/dist/browser-run-traces.js.map +1 -0
- package/dist/builtin-packs.d.ts +45 -0
- package/dist/builtin-packs.d.ts.map +1 -0
- package/dist/builtin-packs.js +121 -0
- package/dist/builtin-packs.js.map +1 -0
- package/dist/caption-word.d.ts +15 -0
- package/dist/caption-word.d.ts.map +1 -0
- package/dist/caption-word.js +10 -0
- package/dist/caption-word.js.map +1 -0
- package/dist/cloud-profile.d.ts +187 -0
- package/dist/cloud-profile.d.ts.map +1 -0
- package/dist/cloud-profile.js +286 -0
- package/dist/cloud-profile.js.map +1 -0
- package/dist/creative.d.ts +580 -0
- package/dist/creative.d.ts.map +1 -0
- package/dist/creative.js +274 -0
- package/dist/creative.js.map +1 -0
- package/dist/custom-providers.d.ts +70 -0
- package/dist/custom-providers.d.ts.map +1 -0
- package/dist/custom-providers.js +125 -0
- package/dist/custom-providers.js.map +1 -0
- package/dist/document-ops.d.ts +15 -0
- package/dist/document-ops.d.ts.map +1 -0
- package/dist/document-ops.js +2 -0
- package/dist/document-ops.js.map +1 -0
- package/dist/game-assets.d.ts +344 -0
- package/dist/game-assets.d.ts.map +1 -0
- package/dist/game-assets.js +297 -0
- package/dist/game-assets.js.map +1 -0
- package/dist/game-authoring.d.ts +113 -0
- package/dist/game-authoring.d.ts.map +1 -0
- package/dist/game-authoring.js +37 -0
- package/dist/game-authoring.js.map +1 -0
- package/dist/game-design.d.ts +90 -0
- package/dist/game-design.d.ts.map +1 -0
- package/dist/game-design.js +417 -0
- package/dist/game-design.js.map +1 -0
- package/dist/game-flow-prompt.d.ts +68 -0
- package/dist/game-flow-prompt.d.ts.map +1 -0
- package/dist/game-flow-prompt.js +121 -0
- package/dist/game-flow-prompt.js.map +1 -0
- package/dist/game-graph.d.ts +96 -0
- package/dist/game-graph.d.ts.map +1 -0
- package/dist/game-graph.js +481 -0
- package/dist/game-graph.js.map +1 -0
- package/dist/game-migration.d.ts +4 -0
- package/dist/game-migration.d.ts.map +1 -0
- package/dist/game-migration.js +6 -0
- package/dist/game-migration.js.map +1 -0
- package/dist/game-slot-prompt.d.ts +90 -0
- package/dist/game-slot-prompt.d.ts.map +1 -0
- package/dist/game-slot-prompt.js +237 -0
- package/dist/game-slot-prompt.js.map +1 -0
- package/dist/game-step.d.ts +10 -0
- package/dist/game-step.d.ts.map +1 -0
- package/dist/game-step.js +2 -0
- package/dist/game-step.js.map +1 -0
- package/dist/game.d.ts +2 -0
- package/dist/game.d.ts.map +1 -0
- package/dist/game.js +2 -0
- package/dist/game.js.map +1 -0
- package/dist/game2d/components/animator.d.ts +22 -0
- package/dist/game2d/components/animator.d.ts.map +1 -0
- package/dist/game2d/components/animator.js +6 -0
- package/dist/game2d/components/animator.js.map +1 -0
- package/dist/game2d/components/assets.d.ts +132 -0
- package/dist/game2d/components/assets.d.ts.map +1 -0
- package/dist/game2d/components/assets.js +52 -0
- package/dist/game2d/components/assets.js.map +1 -0
- package/dist/game2d/components/audioSource.d.ts +7 -0
- package/dist/game2d/components/audioSource.d.ts.map +1 -0
- package/dist/game2d/components/audioSource.js +4 -0
- package/dist/game2d/components/audioSource.js.map +1 -0
- package/dist/game2d/components/background.d.ts +38 -0
- package/dist/game2d/components/background.d.ts.map +1 -0
- package/dist/game2d/components/background.js +10 -0
- package/dist/game2d/components/background.js.map +1 -0
- package/dist/game2d/components/behaviors.d.ts +50 -0
- package/dist/game2d/components/behaviors.d.ts.map +1 -0
- package/dist/game2d/components/behaviors.js +15 -0
- package/dist/game2d/components/behaviors.js.map +1 -0
- package/dist/game2d/components/body2d.d.ts +13 -0
- package/dist/game2d/components/body2d.d.ts.map +1 -0
- package/dist/game2d/components/body2d.js +4 -0
- package/dist/game2d/components/body2d.js.map +1 -0
- package/dist/game2d/components/camera2d.d.ts +7 -0
- package/dist/game2d/components/camera2d.d.ts.map +1 -0
- package/dist/game2d/components/camera2d.js +4 -0
- package/dist/game2d/components/camera2d.js.map +1 -0
- package/dist/game2d/components/collider2d.d.ts +10 -0
- package/dist/game2d/components/collider2d.d.ts.map +1 -0
- package/dist/game2d/components/collider2d.js +5 -0
- package/dist/game2d/components/collider2d.js.map +1 -0
- package/dist/game2d/components/common.d.ts +16 -0
- package/dist/game2d/components/common.d.ts.map +1 -0
- package/dist/game2d/components/common.js +13 -0
- package/dist/game2d/components/common.js.map +1 -0
- package/dist/game2d/components/entity-components.d.ts +181 -0
- package/dist/game2d/components/entity-components.d.ts.map +1 -0
- package/dist/game2d/components/entity-components.js +21 -0
- package/dist/game2d/components/entity-components.js.map +1 -0
- package/dist/game2d/components/light2d.d.ts +12 -0
- package/dist/game2d/components/light2d.d.ts.map +1 -0
- package/dist/game2d/components/light2d.js +5 -0
- package/dist/game2d/components/light2d.js.map +1 -0
- package/dist/game2d/components/lighting.d.ts +17 -0
- package/dist/game2d/components/lighting.d.ts.map +1 -0
- package/dist/game2d/components/lighting.js +6 -0
- package/dist/game2d/components/lighting.js.map +1 -0
- package/dist/game2d/components/music.d.ts +8 -0
- package/dist/game2d/components/music.d.ts.map +1 -0
- package/dist/game2d/components/music.js +4 -0
- package/dist/game2d/components/music.js.map +1 -0
- package/dist/game2d/components/sprite.d.ts +26 -0
- package/dist/game2d/components/sprite.d.ts.map +1 -0
- package/dist/game2d/components/sprite.js +6 -0
- package/dist/game2d/components/sprite.js.map +1 -0
- package/dist/game2d/components/tilemap.d.ts +23 -0
- package/dist/game2d/components/tilemap.d.ts.map +1 -0
- package/dist/game2d/components/tilemap.js +6 -0
- package/dist/game2d/components/tilemap.js.map +1 -0
- package/dist/game2d/components/transform.d.ts +10 -0
- package/dist/game2d/components/transform.d.ts.map +1 -0
- package/dist/game2d/components/transform.js +10 -0
- package/dist/game2d/components/transform.js.map +1 -0
- package/dist/game2d/components/visual-animation.d.ts +148 -0
- package/dist/game2d/components/visual-animation.d.ts.map +1 -0
- package/dist/game2d/components/visual-animation.js +10 -0
- package/dist/game2d/components/visual-animation.js.map +1 -0
- package/dist/game2d/index.d.ts +1426 -0
- package/dist/game2d/index.d.ts.map +1 -0
- package/dist/game2d/index.js +135 -0
- package/dist/game2d/index.js.map +1 -0
- package/dist/game3d/components/animator.d.ts +9 -0
- package/dist/game3d/components/animator.d.ts.map +1 -0
- package/dist/game3d/components/animator.js +7 -0
- package/dist/game3d/components/animator.js.map +1 -0
- package/dist/game3d/components/assets.d.ts +261 -0
- package/dist/game3d/components/assets.d.ts.map +1 -0
- package/dist/game3d/components/assets.js +21 -0
- package/dist/game3d/components/assets.js.map +1 -0
- package/dist/game3d/components/behaviors.d.ts +66 -0
- package/dist/game3d/components/behaviors.d.ts.map +1 -0
- package/dist/game3d/components/behaviors.js +9 -0
- package/dist/game3d/components/behaviors.js.map +1 -0
- package/dist/game3d/components/body.d.ts +53 -0
- package/dist/game3d/components/body.d.ts.map +1 -0
- package/dist/game3d/components/body.js +15 -0
- package/dist/game3d/components/body.js.map +1 -0
- package/dist/game3d/components/camera.d.ts +49 -0
- package/dist/game3d/components/camera.d.ts.map +1 -0
- package/dist/game3d/components/camera.js +20 -0
- package/dist/game3d/components/camera.js.map +1 -0
- package/dist/game3d/components/character.d.ts +16 -0
- package/dist/game3d/components/character.d.ts.map +1 -0
- package/dist/game3d/components/character.js +10 -0
- package/dist/game3d/components/character.js.map +1 -0
- package/dist/game3d/components/collider-geometry.d.ts +7 -0
- package/dist/game3d/components/collider-geometry.d.ts.map +1 -0
- package/dist/game3d/components/collider-geometry.js +13 -0
- package/dist/game3d/components/collider-geometry.js.map +1 -0
- package/dist/game3d/components/collider.d.ts +79 -0
- package/dist/game3d/components/collider.d.ts.map +1 -0
- package/dist/game3d/components/collider.js +16 -0
- package/dist/game3d/components/collider.js.map +1 -0
- package/dist/game3d/components/common.d.ts +8 -0
- package/dist/game3d/components/common.d.ts.map +1 -0
- package/dist/game3d/components/common.js +8 -0
- package/dist/game3d/components/common.js.map +1 -0
- package/dist/game3d/components/environment.d.ts +20 -0
- package/dist/game3d/components/environment.d.ts.map +1 -0
- package/dist/game3d/components/environment.js +8 -0
- package/dist/game3d/components/environment.js.map +1 -0
- package/dist/game3d/components/interaction-actor.d.ts +6 -0
- package/dist/game3d/components/interaction-actor.d.ts.map +1 -0
- package/dist/game3d/components/interaction-actor.js +3 -0
- package/dist/game3d/components/interaction-actor.js.map +1 -0
- package/dist/game3d/components/light.d.ts +23 -0
- package/dist/game3d/components/light.d.ts.map +1 -0
- package/dist/game3d/components/light.js +9 -0
- package/dist/game3d/components/light.js.map +1 -0
- package/dist/game3d/components/material.d.ts +15 -0
- package/dist/game3d/components/material.d.ts.map +1 -0
- package/dist/game3d/components/material.js +9 -0
- package/dist/game3d/components/material.js.map +1 -0
- package/dist/game3d/components/model.d.ts +22 -0
- package/dist/game3d/components/model.d.ts.map +1 -0
- package/dist/game3d/components/model.js +8 -0
- package/dist/game3d/components/model.js.map +1 -0
- package/dist/game3d/components/primitive.d.ts +31 -0
- package/dist/game3d/components/primitive.d.ts.map +1 -0
- package/dist/game3d/components/primitive.js +10 -0
- package/dist/game3d/components/primitive.js.map +1 -0
- package/dist/game3d/components/transform.d.ts +24 -0
- package/dist/game3d/components/transform.d.ts.map +1 -0
- package/dist/game3d/components/transform.js +10 -0
- package/dist/game3d/components/transform.js.map +1 -0
- package/dist/game3d/index.d.ts +4045 -0
- package/dist/game3d/index.d.ts.map +1 -0
- package/dist/game3d/index.js +159 -0
- package/dist/game3d/index.js.map +1 -0
- package/dist/game3d.d.ts +2 -0
- package/dist/game3d.d.ts.map +1 -0
- package/dist/game3d.js +2 -0
- package/dist/game3d.js.map +1 -0
- package/dist/graph.d.ts +192 -5
- package/dist/graph.d.ts.map +1 -1
- package/dist/graph.js +515 -0
- package/dist/graph.js.map +1 -1
- package/dist/index.d.ts +59 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +57 -2
- package/dist/index.js.map +1 -1
- package/dist/loop.d.ts +38 -0
- package/dist/loop.d.ts.map +1 -0
- package/dist/loop.js +69 -0
- package/dist/loop.js.map +1 -0
- package/dist/mcp-server-config.d.ts +113 -0
- package/dist/mcp-server-config.d.ts.map +1 -0
- package/dist/mcp-server-config.js +147 -0
- package/dist/mcp-server-config.js.map +1 -0
- package/dist/messages.d.ts +1577 -243
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +718 -22
- package/dist/messages.js.map +1 -1
- package/dist/missing-runtime-package.d.ts +23 -0
- package/dist/missing-runtime-package.d.ts.map +1 -0
- package/dist/missing-runtime-package.js +34 -0
- package/dist/missing-runtime-package.js.map +1 -0
- package/dist/model-selection.d.ts +20 -0
- package/dist/model-selection.d.ts.map +1 -0
- package/dist/model-selection.js +27 -0
- package/dist/model-selection.js.map +1 -0
- package/dist/nodetool-models.d.ts +71 -0
- package/dist/nodetool-models.d.ts.map +1 -0
- package/dist/nodetool-models.js +138 -0
- package/dist/nodetool-models.js.map +1 -0
- package/dist/package-assets.d.ts +39 -0
- package/dist/package-assets.d.ts.map +1 -0
- package/dist/package-assets.js +63 -0
- package/dist/package-assets.js.map +1 -0
- package/dist/platform.d.ts +66 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.js +68 -0
- package/dist/platform.js.map +1 -0
- package/dist/predicates.d.ts +43 -0
- package/dist/predicates.d.ts.map +1 -0
- package/dist/predicates.js +65 -0
- package/dist/predicates.js.map +1 -0
- package/dist/processing-messages.schema.json +2545 -0
- package/dist/production-authoring.d.ts +931 -0
- package/dist/production-authoring.d.ts.map +1 -0
- package/dist/production-authoring.js +931 -0
- package/dist/production-authoring.js.map +1 -0
- package/dist/python-packs.d.ts +25 -0
- package/dist/python-packs.d.ts.map +1 -0
- package/dist/python-packs.js +51 -0
- package/dist/python-packs.js.map +1 -0
- package/dist/render-record.d.ts +228 -0
- package/dist/render-record.d.ts.map +1 -0
- package/dist/render-record.js +212 -0
- package/dist/render-record.js.map +1 -0
- package/dist/resource-id.d.ts +22 -0
- package/dist/resource-id.d.ts.map +1 -0
- package/dist/resource-id.js +32 -0
- package/dist/resource-id.js.map +1 -0
- package/dist/resource-uri.d.ts +15 -0
- package/dist/resource-uri.d.ts.map +1 -0
- package/dist/resource-uri.js +91 -0
- package/dist/resource-uri.js.map +1 -0
- package/dist/run-readers.d.ts +760 -0
- package/dist/run-readers.d.ts.map +1 -0
- package/dist/run-readers.js +153 -0
- package/dist/run-readers.js.map +1 -0
- package/dist/run-trace.d.ts +206 -0
- package/dist/run-trace.d.ts.map +1 -0
- package/dist/run-trace.js +177 -0
- package/dist/run-trace.js.map +1 -0
- package/dist/sandbox-capability.d.ts +86 -0
- package/dist/sandbox-capability.d.ts.map +1 -0
- package/dist/sandbox-capability.js +106 -0
- package/dist/sandbox-capability.js.map +1 -0
- package/dist/sandbox-host.d.ts +98 -0
- package/dist/sandbox-host.d.ts.map +1 -0
- package/dist/sandbox-host.js +311 -0
- package/dist/sandbox-host.js.map +1 -0
- package/dist/sandbox-package.d.ts +674 -0
- package/dist/sandbox-package.d.ts.map +1 -0
- package/dist/sandbox-package.js +622 -0
- package/dist/sandbox-package.js.map +1 -0
- package/dist/sandbox-wasm.d.ts +84 -0
- package/dist/sandbox-wasm.d.ts.map +1 -0
- package/dist/sandbox-wasm.js +139 -0
- package/dist/sandbox-wasm.js.map +1 -0
- package/dist/screenplay-authoring.d.ts +69 -0
- package/dist/screenplay-authoring.d.ts.map +1 -0
- package/dist/screenplay-authoring.js +352 -0
- package/dist/screenplay-authoring.js.map +1 -0
- package/dist/script-authoring.d.ts +161 -0
- package/dist/script-authoring.d.ts.map +1 -0
- package/dist/script-authoring.js +503 -0
- package/dist/script-authoring.js.map +1 -0
- package/dist/script-fill.d.ts +39 -0
- package/dist/script-fill.d.ts.map +1 -0
- package/dist/script-fill.js +67 -0
- package/dist/script-fill.js.map +1 -0
- package/dist/script-link.d.ts +110 -0
- package/dist/script-link.d.ts.map +1 -0
- package/dist/script-link.js +252 -0
- package/dist/script-link.js.map +1 -0
- package/dist/script-pace.d.ts +4 -0
- package/dist/script-pace.d.ts.map +1 -0
- package/dist/script-pace.js +11 -0
- package/dist/script-pace.js.map +1 -0
- package/dist/sha256.d.ts +11 -0
- package/dist/sha256.d.ts.map +1 -0
- package/dist/sha256.js +110 -0
- package/dist/sha256.js.map +1 -0
- package/dist/shot-prompt.d.ts +78 -0
- package/dist/shot-prompt.d.ts.map +1 -0
- package/dist/shot-prompt.js +120 -0
- package/dist/shot-prompt.js.map +1 -0
- package/dist/skill-document.d.ts +36 -0
- package/dist/skill-document.d.ts.map +1 -0
- package/dist/skill-document.js +140 -0
- package/dist/skill-document.js.map +1 -0
- package/dist/storyboard-render-spec.d.ts +4 -0
- package/dist/storyboard-render-spec.d.ts.map +1 -0
- package/dist/storyboard-render-spec.js +4 -0
- package/dist/storyboard-render-spec.js.map +1 -0
- package/dist/style-presets.d.ts +73 -0
- package/dist/style-presets.d.ts.map +1 -0
- package/dist/style-presets.js +147 -0
- package/dist/style-presets.js.map +1 -0
- package/dist/supervisor.d.ts +227 -0
- package/dist/supervisor.d.ts.map +1 -0
- package/dist/supervisor.js +116 -0
- package/dist/supervisor.js.map +1 -0
- package/dist/token-providers.d.ts +31 -0
- package/dist/token-providers.d.ts.map +1 -0
- package/dist/token-providers.js +52 -0
- package/dist/token-providers.js.map +1 -0
- package/dist/toolSchemas.d.ts +18 -14
- package/dist/toolSchemas.d.ts.map +1 -1
- package/dist/toolSchemas.js +30 -31
- package/dist/toolSchemas.js.map +1 -1
- package/dist/triggers.d.ts +41 -0
- package/dist/triggers.d.ts.map +1 -0
- package/dist/triggers.js +50 -0
- package/dist/triggers.js.map +1 -0
- package/dist/trpc-policy.d.ts +3 -0
- package/dist/trpc-policy.d.ts.map +1 -0
- package/dist/trpc-policy.js +3 -0
- package/dist/trpc-policy.js.map +1 -0
- package/dist/type-metadata.d.ts +5 -0
- package/dist/type-metadata.d.ts.map +1 -1
- package/dist/type-metadata.js +17 -8
- package/dist/type-metadata.js.map +1 -1
- package/dist/typecheck.d.ts.map +1 -1
- package/dist/typecheck.js +5 -4
- package/dist/typecheck.js.map +1 -1
- package/dist/wasm-binary.d.ts +61 -0
- package/dist/wasm-binary.d.ts.map +1 -0
- package/dist/wasm-binary.js +215 -0
- package/dist/wasm-binary.js.map +1 -0
- package/dist/workflow-document-revision.d.ts +4 -0
- package/dist/workflow-document-revision.d.ts.map +1 -0
- package/dist/workflow-document-revision.js +111 -0
- package/dist/workflow-document-revision.js.map +1 -0
- package/dist/workflow-plan.d.ts +274 -0
- package/dist/workflow-plan.d.ts.map +1 -0
- package/dist/workflow-plan.js +667 -0
- package/dist/workflow-plan.js.map +1 -0
- package/dist/wrap-primitives.d.ts +0 -11
- package/dist/wrap-primitives.d.ts.map +1 -1
- package/dist/wrap-primitives.js +3 -9
- package/dist/wrap-primitives.js.map +1 -1
- package/dist/ws-commands.d.ts +770 -0
- package/dist/ws-commands.d.ts.map +1 -0
- package/dist/ws-commands.js +624 -0
- package/dist/ws-commands.js.map +1 -0
- package/dist/zod-schema.d.ts +20 -0
- package/dist/zod-schema.d.ts.map +1 -0
- package/dist/zod-schema.js +298 -0
- package/dist/zod-schema.js.map +1 -0
- package/package.json +96 -7
- package/schema/sdk-v1.asyncapi.implemented.json +65 -0
- package/schema/sdk-v1.asyncapi.json +65 -0
- package/schema/sdk-v1.discovery.schema.json +1218 -0
- package/schema/sdk-v1.execution.schema.json +2792 -0
- package/schema/sdk-v1.lifecycle.schema.json +1031 -0
- package/schema/sdk-v1.manifest.json +71 -0
- package/schema/sdk-v1.openapi.implemented.json +730 -0
- package/schema/sdk-v1.openapi.json +730 -0
- package/schema/sdk-v1.operations.json +732 -0
- package/dist/agent-protocol.d.ts +0 -217
- package/dist/agent-protocol.d.ts.map +0 -1
- package/dist/agent-protocol.js +0 -85
- package/dist/agent-protocol.js.map +0 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The scalar call contract for sandbox WASM modules, and the facade generator
|
|
3
|
+
* that expresses it as guest JavaScript.
|
|
4
|
+
*
|
|
5
|
+
* Everything here is pure and browser-safe. It sits in `protocol` because the
|
|
6
|
+
* same answers are needed in three places that must not disagree: `node-sdk`
|
|
7
|
+
* validates a pack's binary and folds the facade into the module digest,
|
|
8
|
+
* `agents` mounts the facade and validates every call, and any host that
|
|
9
|
+
* reports a skipped export quotes the reason from here.
|
|
10
|
+
*/
|
|
11
|
+
import type { SandboxWasmContract } from "./sandbox-package.js";
|
|
12
|
+
import { type WasmExportEntry, type WasmSignature } from "./wasm-binary.js";
|
|
13
|
+
/**
|
|
14
|
+
* Budget ceilings for host WASM execution.
|
|
15
|
+
*
|
|
16
|
+
* Each number is both the default and the maximum: a pack manifest may lower
|
|
17
|
+
* any of them, never raise one. `workerPoolSize` is process-wide and is not
|
|
18
|
+
* manifest-configurable at all — it is a property of the host, not of a pack.
|
|
19
|
+
*/
|
|
20
|
+
export declare const SANDBOX_WASM_BUDGETS: {
|
|
21
|
+
/** Workers shared by every invocation in the process. */
|
|
22
|
+
readonly workerPoolSize: 4;
|
|
23
|
+
/** Calls one invocation may have in flight at once. */
|
|
24
|
+
readonly callConcurrency: 2;
|
|
25
|
+
/** Calls one invocation may make in total. */
|
|
26
|
+
readonly callsPerInvocation: 256;
|
|
27
|
+
/** Aggregate WASM wall clock one invocation may spend, in milliseconds. */
|
|
28
|
+
readonly wallClockMs: 30000;
|
|
29
|
+
/** Wall clock one call may spend before its worker is killed, in milliseconds. */
|
|
30
|
+
readonly callTimeoutMs: 5000;
|
|
31
|
+
};
|
|
32
|
+
/** Longest parameter list the scalar contract accepts. */
|
|
33
|
+
export declare const SANDBOX_WASM_MAX_ARITY = 8;
|
|
34
|
+
/** Value types the scalar contract accepts, in argument and result position. */
|
|
35
|
+
export declare const SANDBOX_WASM_VALUE_TYPES: readonly number[];
|
|
36
|
+
/**
|
|
37
|
+
* Why an export falls outside the scalar contract, or `undefined` when it does
|
|
38
|
+
* not. The text completes the sentence "export `foo` …", so a caller reads
|
|
39
|
+
* `${specifier}: export ${name} ${reason}`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function wasmExportContractViolation(entry: WasmExportEntry | undefined, signature: WasmSignature | undefined): string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* The facade generator's version.
|
|
44
|
+
*
|
|
45
|
+
* It joins a WASM module's content digest, so a change to the generated guest
|
|
46
|
+
* surface invalidates a workflow's pinned digest the same way a change to the
|
|
47
|
+
* binary does. Bump it whenever {@link generateSandboxWasmFacade} or
|
|
48
|
+
* {@link SANDBOX_WASM_BRIDGE_SOURCE} changes what the guest sees.
|
|
49
|
+
*/
|
|
50
|
+
export declare const SANDBOX_WASM_FACADE_VERSION = 1;
|
|
51
|
+
/**
|
|
52
|
+
* The guest-visible name the host parks the dispatcher on.
|
|
53
|
+
*
|
|
54
|
+
* It exists only between the init prelude and the entry module's first
|
|
55
|
+
* statement — long enough for the bridge module to capture it while the static
|
|
56
|
+
* graph evaluates, then deleted. The hiding is convenience; the dispatcher's
|
|
57
|
+
* own checks are the boundary.
|
|
58
|
+
*/
|
|
59
|
+
export declare const SANDBOX_WASM_DISPATCH_GLOBAL = "__nodetoolWasmDispatch";
|
|
60
|
+
/**
|
|
61
|
+
* The private bridge module every facade imports.
|
|
62
|
+
*
|
|
63
|
+
* Guest code cannot import it: the loader refuses the specifier from any
|
|
64
|
+
* module that is not a generated facade, and the static analyzer refuses it in
|
|
65
|
+
* authored source.
|
|
66
|
+
*/
|
|
67
|
+
export declare const SANDBOX_WASM_BRIDGE_SPECIFIER = "nodetool:wasm-bridge";
|
|
68
|
+
/**
|
|
69
|
+
* The bridge module's source.
|
|
70
|
+
*
|
|
71
|
+
* It reads the dispatcher once, at module-evaluation time — which happens
|
|
72
|
+
* while the entry module's static graph links, before the entry body deletes
|
|
73
|
+
* the binding.
|
|
74
|
+
*/
|
|
75
|
+
export declare const SANDBOX_WASM_BRIDGE_SOURCE = "const __dispatch = globalThis.__nodetoolWasmDispatch;\nexport const __call = (moduleKey, exportName, args) => {\n if (typeof __dispatch !== \"function\") {\n throw new Error(\"the sandbox WASM bridge is unavailable in this run\");\n }\n return __dispatch(moduleKey, exportName, args);\n};\n";
|
|
76
|
+
/**
|
|
77
|
+
* Generate the ESM facade for one WASM module.
|
|
78
|
+
*
|
|
79
|
+
* One named async export per manifest export, under the export's JavaScript
|
|
80
|
+
* alias. Nothing else is exposed: no instance, no memory, no way to name a
|
|
81
|
+
* module other than this one.
|
|
82
|
+
*/
|
|
83
|
+
export declare function generateSandboxWasmFacade(moduleKey: string, contract: SandboxWasmContract): string;
|
|
84
|
+
//# sourceMappingURL=sandbox-wasm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-wasm.d.ts","sourceRoot":"","sources":["../src/sandbox-wasm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;IAC/B,yDAAyD;aACzD,cAAc,EAAE,CAAC;IACjB,uDAAuD;aACvD,eAAe,EAAE,CAAC;IAClB,8CAA8C;aAC9C,kBAAkB,EAAE,GAAG;IACvB,2EAA2E;aAC3E,WAAW,EAAE,KAAM;IACnB,kFAAkF;aAClF,aAAa,EAAE,IAAK;CACZ,CAAC;AAEX,0DAA0D;AAC1D,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,gFAAgF;AAChF,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAIrD,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,eAAe,GAAG,SAAS,EAClC,SAAS,EAAE,aAAa,GAAG,SAAS,GACnC,MAAM,GAAG,SAAS,CAqBpB;AAcD;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,2BAA2B,CAAC;AAErE;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,yBAAyB,CAAC;AAEpE;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,6SAOtC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,mBAAmB,GAC5B,MAAM,CAUR"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The scalar call contract for sandbox WASM modules, and the facade generator
|
|
3
|
+
* that expresses it as guest JavaScript.
|
|
4
|
+
*
|
|
5
|
+
* Everything here is pure and browser-safe. It sits in `protocol` because the
|
|
6
|
+
* same answers are needed in three places that must not disagree: `node-sdk`
|
|
7
|
+
* validates a pack's binary and folds the facade into the module digest,
|
|
8
|
+
* `agents` mounts the facade and validates every call, and any host that
|
|
9
|
+
* reports a skipped export quotes the reason from here.
|
|
10
|
+
*/
|
|
11
|
+
import { WASM_EXPORT_KIND, WASM_VALUE_TYPE, wasmExportKindName, wasmValueTypeName } from "./wasm-binary.js";
|
|
12
|
+
/**
|
|
13
|
+
* Budget ceilings for host WASM execution.
|
|
14
|
+
*
|
|
15
|
+
* Each number is both the default and the maximum: a pack manifest may lower
|
|
16
|
+
* any of them, never raise one. `workerPoolSize` is process-wide and is not
|
|
17
|
+
* manifest-configurable at all — it is a property of the host, not of a pack.
|
|
18
|
+
*/
|
|
19
|
+
export const SANDBOX_WASM_BUDGETS = {
|
|
20
|
+
/** Workers shared by every invocation in the process. */
|
|
21
|
+
workerPoolSize: 4,
|
|
22
|
+
/** Calls one invocation may have in flight at once. */
|
|
23
|
+
callConcurrency: 2,
|
|
24
|
+
/** Calls one invocation may make in total. */
|
|
25
|
+
callsPerInvocation: 256,
|
|
26
|
+
/** Aggregate WASM wall clock one invocation may spend, in milliseconds. */
|
|
27
|
+
wallClockMs: 30_000,
|
|
28
|
+
/** Wall clock one call may spend before its worker is killed, in milliseconds. */
|
|
29
|
+
callTimeoutMs: 5_000
|
|
30
|
+
};
|
|
31
|
+
/** Longest parameter list the scalar contract accepts. */
|
|
32
|
+
export const SANDBOX_WASM_MAX_ARITY = 8;
|
|
33
|
+
/** Value types the scalar contract accepts, in argument and result position. */
|
|
34
|
+
export const SANDBOX_WASM_VALUE_TYPES = [
|
|
35
|
+
WASM_VALUE_TYPE.I32,
|
|
36
|
+
WASM_VALUE_TYPE.F32,
|
|
37
|
+
WASM_VALUE_TYPE.F64
|
|
38
|
+
];
|
|
39
|
+
/**
|
|
40
|
+
* Why an export falls outside the scalar contract, or `undefined` when it does
|
|
41
|
+
* not. The text completes the sentence "export `foo` …", so a caller reads
|
|
42
|
+
* `${specifier}: export ${name} ${reason}`.
|
|
43
|
+
*/
|
|
44
|
+
export function wasmExportContractViolation(entry, signature) {
|
|
45
|
+
if (entry === undefined)
|
|
46
|
+
return "is missing from the binary";
|
|
47
|
+
if (entry.kind !== WASM_EXPORT_KIND.FUNCTION) {
|
|
48
|
+
return `is a ${wasmExportKindName(entry.kind)}, not a function`;
|
|
49
|
+
}
|
|
50
|
+
if (signature === undefined)
|
|
51
|
+
return "has no signature in the binary";
|
|
52
|
+
if (signature.parameters.length > SANDBOX_WASM_MAX_ARITY) {
|
|
53
|
+
return `takes ${signature.parameters.length} parameters, above the ${SANDBOX_WASM_MAX_ARITY} the scalar contract allows`;
|
|
54
|
+
}
|
|
55
|
+
if (signature.results.length > 1) {
|
|
56
|
+
return `returns ${signature.results.length} values (multi-value), and the scalar contract allows at most one`;
|
|
57
|
+
}
|
|
58
|
+
for (const [position, type] of signature.parameters.entries()) {
|
|
59
|
+
const reason = valueTypeViolation(type);
|
|
60
|
+
if (reason !== undefined)
|
|
61
|
+
return `takes parameter ${position} that ${reason}`;
|
|
62
|
+
}
|
|
63
|
+
for (const type of signature.results) {
|
|
64
|
+
const reason = valueTypeViolation(type);
|
|
65
|
+
if (reason !== undefined)
|
|
66
|
+
return `returns a value that ${reason}`;
|
|
67
|
+
}
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
function valueTypeViolation(type) {
|
|
71
|
+
if (SANDBOX_WASM_VALUE_TYPES.includes(type))
|
|
72
|
+
return undefined;
|
|
73
|
+
if (type === WASM_VALUE_TYPE.I64) {
|
|
74
|
+
return "uses i64, which maps to bigint rather than number";
|
|
75
|
+
}
|
|
76
|
+
if (type === WASM_VALUE_TYPE.V128)
|
|
77
|
+
return "uses v128, a vector type";
|
|
78
|
+
if (type === WASM_VALUE_TYPE.FUNCREF || type === WASM_VALUE_TYPE.EXTERNREF) {
|
|
79
|
+
return `uses the reference type ${wasmValueTypeName(type)}`;
|
|
80
|
+
}
|
|
81
|
+
return `uses ${wasmValueTypeName(type)}, which is not i32, f32, or f64`;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The facade generator's version.
|
|
85
|
+
*
|
|
86
|
+
* It joins a WASM module's content digest, so a change to the generated guest
|
|
87
|
+
* surface invalidates a workflow's pinned digest the same way a change to the
|
|
88
|
+
* binary does. Bump it whenever {@link generateSandboxWasmFacade} or
|
|
89
|
+
* {@link SANDBOX_WASM_BRIDGE_SOURCE} changes what the guest sees.
|
|
90
|
+
*/
|
|
91
|
+
export const SANDBOX_WASM_FACADE_VERSION = 1;
|
|
92
|
+
/**
|
|
93
|
+
* The guest-visible name the host parks the dispatcher on.
|
|
94
|
+
*
|
|
95
|
+
* It exists only between the init prelude and the entry module's first
|
|
96
|
+
* statement — long enough for the bridge module to capture it while the static
|
|
97
|
+
* graph evaluates, then deleted. The hiding is convenience; the dispatcher's
|
|
98
|
+
* own checks are the boundary.
|
|
99
|
+
*/
|
|
100
|
+
export const SANDBOX_WASM_DISPATCH_GLOBAL = "__nodetoolWasmDispatch";
|
|
101
|
+
/**
|
|
102
|
+
* The private bridge module every facade imports.
|
|
103
|
+
*
|
|
104
|
+
* Guest code cannot import it: the loader refuses the specifier from any
|
|
105
|
+
* module that is not a generated facade, and the static analyzer refuses it in
|
|
106
|
+
* authored source.
|
|
107
|
+
*/
|
|
108
|
+
export const SANDBOX_WASM_BRIDGE_SPECIFIER = "nodetool:wasm-bridge";
|
|
109
|
+
/**
|
|
110
|
+
* The bridge module's source.
|
|
111
|
+
*
|
|
112
|
+
* It reads the dispatcher once, at module-evaluation time — which happens
|
|
113
|
+
* while the entry module's static graph links, before the entry body deletes
|
|
114
|
+
* the binding.
|
|
115
|
+
*/
|
|
116
|
+
export const SANDBOX_WASM_BRIDGE_SOURCE = `const __dispatch = globalThis.${SANDBOX_WASM_DISPATCH_GLOBAL};
|
|
117
|
+
export const __call = (moduleKey, exportName, args) => {
|
|
118
|
+
if (typeof __dispatch !== "function") {
|
|
119
|
+
throw new Error("the sandbox WASM bridge is unavailable in this run");
|
|
120
|
+
}
|
|
121
|
+
return __dispatch(moduleKey, exportName, args);
|
|
122
|
+
};
|
|
123
|
+
`;
|
|
124
|
+
/**
|
|
125
|
+
* Generate the ESM facade for one WASM module.
|
|
126
|
+
*
|
|
127
|
+
* One named async export per manifest export, under the export's JavaScript
|
|
128
|
+
* alias. Nothing else is exposed: no instance, no memory, no way to name a
|
|
129
|
+
* module other than this one.
|
|
130
|
+
*/
|
|
131
|
+
export function generateSandboxWasmFacade(moduleKey, contract) {
|
|
132
|
+
const body = contract.exports
|
|
133
|
+
.map((exported) => `export async function ${exported.as}(...args) {\n return __call(${JSON.stringify(moduleKey)}, ${JSON.stringify(exported.as)}, args);\n}`)
|
|
134
|
+
.join("\n");
|
|
135
|
+
return `import { __call } from ${JSON.stringify(SANDBOX_WASM_BRIDGE_SPECIFIER)};
|
|
136
|
+
${body}
|
|
137
|
+
`;
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=sandbox-wasm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-wasm.js","sourceRoot":"","sources":["../src/sandbox-wasm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EAGlB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,yDAAyD;IACzD,cAAc,EAAE,CAAC;IACjB,uDAAuD;IACvD,eAAe,EAAE,CAAC;IAClB,8CAA8C;IAC9C,kBAAkB,EAAE,GAAG;IACvB,2EAA2E;IAC3E,WAAW,EAAE,MAAM;IACnB,kFAAkF;IAClF,aAAa,EAAE,KAAK;CACZ,CAAC;AAEX,0DAA0D;AAC1D,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAExC,gFAAgF;AAChF,MAAM,CAAC,MAAM,wBAAwB,GAAsB;IACzD,eAAe,CAAC,GAAG;IACnB,eAAe,CAAC,GAAG;IACnB,eAAe,CAAC,GAAG;CACpB,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CACzC,KAAkC,EAClC,SAAoC;IAEpC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,4BAA4B,CAAC;IAC7D,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB,CAAC,QAAQ,EAAE,CAAC;QAC7C,OAAO,QAAQ,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC;IAClE,CAAC;IACD,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,gCAAgC,CAAC;IACrE,IAAI,SAAS,CAAC,UAAU,CAAC,MAAM,GAAG,sBAAsB,EAAE,CAAC;QACzD,OAAO,SAAS,SAAS,CAAC,UAAU,CAAC,MAAM,0BAA0B,sBAAsB,6BAA6B,CAAC;IAC3H,CAAC;IACD,IAAI,SAAS,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjC,OAAO,WAAW,SAAS,CAAC,OAAO,CAAC,MAAM,mEAAmE,CAAC;IAChH,CAAC;IACD,KAAK,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC;QAC9D,MAAM,MAAM,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,mBAAmB,QAAQ,SAAS,MAAM,EAAE,CAAC;IAChF,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;QACrC,MAAM,MAAM,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,wBAAwB,MAAM,EAAE,CAAC;IACpE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAY;IACtC,IAAI,wBAAwB,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IAC9D,IAAI,IAAI,KAAK,eAAe,CAAC,GAAG,EAAE,CAAC;QACjC,OAAO,mDAAmD,CAAC;IAC7D,CAAC;IACD,IAAI,IAAI,KAAK,eAAe,CAAC,IAAI;QAAE,OAAO,0BAA0B,CAAC;IACrE,IAAI,IAAI,KAAK,eAAe,CAAC,OAAO,IAAI,IAAI,KAAK,eAAe,CAAC,SAAS,EAAE,CAAC;QAC3E,OAAO,2BAA2B,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC9D,CAAC;IACD,OAAO,QAAQ,iBAAiB,CAAC,IAAI,CAAC,iCAAiC,CAAC;AAC1E,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAE7C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,wBAAwB,CAAC;AAErE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,sBAAsB,CAAC;AAEpE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,iCAAiC,4BAA4B;;;;;;;CAOtG,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CACvC,SAAiB,EACjB,QAA6B;IAE7B,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO;SAC1B,GAAG,CACF,CAAC,QAAQ,EAAE,EAAE,CACX,yBAAyB,QAAQ,CAAC,EAAE,gCAAgC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,aAAa,CAC7I;SACA,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,OAAO,0BAA0B,IAAI,CAAC,SAAS,CAAC,6BAA6B,CAAC;EAC9E,IAAI;CACL,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @nodetool-ai/protocol — Screenplay authoring rules
|
|
3
|
+
*
|
|
4
|
+
* What a Director asks a model for, and how its answer becomes a typed
|
|
5
|
+
* {@link Screenplay}: the system prompt, the brief-to-prompt shaping, the JSON
|
|
6
|
+
* schema the structured call is forced into, the parse that assigns ids and
|
|
7
|
+
* clamps the shot list, and the deterministic fallback.
|
|
8
|
+
*
|
|
9
|
+
* Pure, and shared: the `nodetool.creative.Director` node and the storyboard's
|
|
10
|
+
* own direct `generate_text` request both author through this, so a screenplay
|
|
11
|
+
* does not depend on which surface asked for it.
|
|
12
|
+
*/
|
|
13
|
+
import type { Screenplay } from "./creative.js";
|
|
14
|
+
export declare const DIRECTOR_SYSTEM_PROMPT: string;
|
|
15
|
+
/** The tool a structured screenplay call is forced into. */
|
|
16
|
+
export declare const SCREENPLAY_TOOL_NAME = "screenplay";
|
|
17
|
+
export declare const SCREENPLAY_TOOL_DESCRIPTION = "Submit the finished screenplay with exactly the requested number of shots.";
|
|
18
|
+
/** Clamp a requested shot count to what the Director accepts (1–20). */
|
|
19
|
+
export declare function clampShotCount(value: unknown): number;
|
|
20
|
+
/**
|
|
21
|
+
* Coerce raw model output (a parsed object, a JSON string, or a fenced ```json
|
|
22
|
+
* block) into a validated {@link Screenplay}: assign ids, default missing
|
|
23
|
+
* fields, clamp the shot list to `shotCount`, and stamp every shot with
|
|
24
|
+
* `status: "planned"` and a sequential `index`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function parseScreenplay(raw: unknown, opts: {
|
|
27
|
+
shotCount: number;
|
|
28
|
+
title?: string;
|
|
29
|
+
aspectRatio?: string;
|
|
30
|
+
genre?: string;
|
|
31
|
+
}): Screenplay;
|
|
32
|
+
/**
|
|
33
|
+
* Deterministic screenplay used when the model returns no usable screenplay
|
|
34
|
+
* tool call (e.g. providers without tool support and the fake e2e provider).
|
|
35
|
+
* Mirrors DataGenerator's synthetic-rows fallback: the pipeline keeps flowing
|
|
36
|
+
* with placeholder shots derived from the brief instead of failing the run.
|
|
37
|
+
* Real provider errors still throw — this only covers an empty/unusable result.
|
|
38
|
+
*/
|
|
39
|
+
export declare function fallbackScreenplay(opts: {
|
|
40
|
+
brief: string;
|
|
41
|
+
style: string;
|
|
42
|
+
shotCount: number;
|
|
43
|
+
aspectRatio: string;
|
|
44
|
+
}): Screenplay;
|
|
45
|
+
/** Coerce any screenplay-shaped input to a {@link Screenplay}, keeping its shots. */
|
|
46
|
+
export declare function toScreenplay(raw: unknown): Screenplay;
|
|
47
|
+
/**
|
|
48
|
+
* The JSON schema the screenplay tool call is validated against.
|
|
49
|
+
*
|
|
50
|
+
* The shot count is contracted, so `shots` is pinned to it. No scene count is,
|
|
51
|
+
* so `scenes` only has to be non-empty — how many scenes a brief wants is the
|
|
52
|
+
* director's call.
|
|
53
|
+
*
|
|
54
|
+
* One rule this cannot carry: that every `shot.scene_id` names a returned
|
|
55
|
+
* scene. JSON Schema has no cross-reference between sibling arrays, and the
|
|
56
|
+
* `$data` extension that would come closest is not accepted by the providers'
|
|
57
|
+
* structured-output validators. {@link parseScreenplay} enforces it instead.
|
|
58
|
+
*/
|
|
59
|
+
export declare function buildScreenplaySchema(shotCount: number): Record<string, unknown>;
|
|
60
|
+
/**
|
|
61
|
+
* The user turn: the brief, the genre, the style, and what the shot list must
|
|
62
|
+
* contain.
|
|
63
|
+
*
|
|
64
|
+
* `genre` is a trailing optional argument rather than an options object because
|
|
65
|
+
* both call sites — the Director node and the storyboard's direct
|
|
66
|
+
* `generate_text` request — pass positionally and are owned elsewhere.
|
|
67
|
+
*/
|
|
68
|
+
export declare function buildDirectorPrompt(brief: string, style: string, shotCount: number, aspectRatio: string, genre?: string): string;
|
|
69
|
+
//# sourceMappingURL=screenplay-authoring.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screenplay-authoring.d.ts","sourceRoot":"","sources":["../src/screenplay-authoring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAA0B,UAAU,EAAQ,MAAM,eAAe,CAAC;AAQ9E,eAAO,MAAM,sBAAsB,QAQxB,CAAC;AAEZ,4DAA4D;AAC5D,eAAO,MAAM,oBAAoB,eAAe,CAAC;AACjD,eAAO,MAAM,2BAA2B,+EACsC,CAAC;AAyI/E,wEAAwE;AACxE,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAKrD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE;IACJ,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GACA,UAAU,CAgCZ;AAKD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,UAAU,CAkCb;AAED,qFAAqF;AACrF,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,UAAU,CAIrD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,MAAM,GAChB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA0DzB;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,KAAK,CAAC,EAAE,MAAM,GACb,MAAM,CAYR"}
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @nodetool-ai/protocol — Screenplay authoring rules
|
|
3
|
+
*
|
|
4
|
+
* What a Director asks a model for, and how its answer becomes a typed
|
|
5
|
+
* {@link Screenplay}: the system prompt, the brief-to-prompt shaping, the JSON
|
|
6
|
+
* schema the structured call is forced into, the parse that assigns ids and
|
|
7
|
+
* clamps the shot list, and the deterministic fallback.
|
|
8
|
+
*
|
|
9
|
+
* Pure, and shared: the `nodetool.creative.Director` node and the storyboard's
|
|
10
|
+
* own direct `generate_text` request both author through this, so a screenplay
|
|
11
|
+
* does not depend on which surface asked for it.
|
|
12
|
+
*/
|
|
13
|
+
import { isNonBlankString, isNumber, isRecord, isString } from "./predicates.js";
|
|
14
|
+
export const DIRECTOR_SYSTEM_PROMPT = [
|
|
15
|
+
"You are a film director. Turn the user's brief into a structured screenplay.",
|
|
16
|
+
"Break the piece into scenes. Give each a slugline in screenplay form",
|
|
17
|
+
"(INT./EXT. LOCATION — TIME) and a lighting note that holds for every shot in",
|
|
18
|
+
"it. Then write the shots, each with a concrete visual action, camera",
|
|
19
|
+
"direction, and the scene_id of exactly one scene you returned. Shots of the",
|
|
20
|
+
"same scene must be consecutive. Apply one consistent style across every",
|
|
21
|
+
"shot. Call the screenplay tool exactly once with the result."
|
|
22
|
+
].join(" ");
|
|
23
|
+
/** The tool a structured screenplay call is forced into. */
|
|
24
|
+
export const SCREENPLAY_TOOL_NAME = "screenplay";
|
|
25
|
+
export const SCREENPLAY_TOOL_DESCRIPTION = "Submit the finished screenplay with exactly the requested number of shots.";
|
|
26
|
+
const str = (value) => (isString(value) ? value : "");
|
|
27
|
+
const optionalStr = (value) => {
|
|
28
|
+
const s = str(value).trim();
|
|
29
|
+
return s.length > 0 ? s : undefined;
|
|
30
|
+
};
|
|
31
|
+
const optionalNumber = (value) => {
|
|
32
|
+
const n = isNumber(value) ? value : Number(value);
|
|
33
|
+
return Number.isFinite(n) ? n : undefined;
|
|
34
|
+
};
|
|
35
|
+
/** Strip a leading/trailing ```json … ``` fence, if present. */
|
|
36
|
+
function stripFences(text) {
|
|
37
|
+
const trimmed = text.trim();
|
|
38
|
+
const match = trimmed.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/i);
|
|
39
|
+
return match ? match[1].trim() : trimmed;
|
|
40
|
+
}
|
|
41
|
+
/** Coerce a parsed object, a JSON string, or a fenced JSON block to a record. */
|
|
42
|
+
function coerceObject(raw) {
|
|
43
|
+
if (isRecord(raw)) {
|
|
44
|
+
return raw;
|
|
45
|
+
}
|
|
46
|
+
if (isString(raw)) {
|
|
47
|
+
try {
|
|
48
|
+
const parsed = JSON.parse(stripFences(raw));
|
|
49
|
+
if (isRecord(parsed)) {
|
|
50
|
+
return parsed;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
// Not valid JSON — fall through to an empty record.
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return {};
|
|
58
|
+
}
|
|
59
|
+
function coerceCamera(raw) {
|
|
60
|
+
if (!isRecord(raw))
|
|
61
|
+
return undefined;
|
|
62
|
+
const camera = {};
|
|
63
|
+
const framing = optionalStr(raw.framing);
|
|
64
|
+
const lens = optionalStr(raw.lens);
|
|
65
|
+
const angle = optionalStr(raw.angle);
|
|
66
|
+
const movement = optionalStr(raw.movement);
|
|
67
|
+
const equipment = optionalStr(raw.equipment);
|
|
68
|
+
if (framing)
|
|
69
|
+
camera.framing = framing;
|
|
70
|
+
if (lens)
|
|
71
|
+
camera.lens = lens;
|
|
72
|
+
if (angle)
|
|
73
|
+
camera.angle = angle;
|
|
74
|
+
if (movement)
|
|
75
|
+
camera.movement = movement;
|
|
76
|
+
if (equipment)
|
|
77
|
+
camera.equipment = equipment;
|
|
78
|
+
return Object.keys(camera).length > 0 ? camera : undefined;
|
|
79
|
+
}
|
|
80
|
+
function coerceShot(raw, index) {
|
|
81
|
+
const obj = isRecord(raw) ? raw : {};
|
|
82
|
+
const shot = {
|
|
83
|
+
type: "shot",
|
|
84
|
+
id: `shot-${index}`,
|
|
85
|
+
index,
|
|
86
|
+
action: str(obj.action),
|
|
87
|
+
status: "planned"
|
|
88
|
+
};
|
|
89
|
+
const slug = optionalStr(obj.slug);
|
|
90
|
+
if (slug)
|
|
91
|
+
shot.slug = slug;
|
|
92
|
+
// The model's own scene id. parseScreenplay rewrites it to the assigned
|
|
93
|
+
// `scene-N`; nothing else calls coerceShot with a foreign id.
|
|
94
|
+
const sceneId = optionalStr(obj.scene_id);
|
|
95
|
+
if (sceneId)
|
|
96
|
+
shot.scene_id = sceneId;
|
|
97
|
+
const camera = coerceCamera(obj.camera);
|
|
98
|
+
if (camera)
|
|
99
|
+
shot.camera = camera;
|
|
100
|
+
const motion = optionalStr(obj.motion);
|
|
101
|
+
if (motion)
|
|
102
|
+
shot.motion = motion;
|
|
103
|
+
const dialogue = optionalStr(obj.dialogue);
|
|
104
|
+
if (dialogue)
|
|
105
|
+
shot.dialogue = dialogue;
|
|
106
|
+
const narration = optionalStr(obj.narration);
|
|
107
|
+
if (narration)
|
|
108
|
+
shot.narration = narration;
|
|
109
|
+
const duration = optionalNumber(obj.duration_seconds);
|
|
110
|
+
if (duration !== undefined)
|
|
111
|
+
shot.duration_seconds = duration;
|
|
112
|
+
return shot;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Coerce the returned scene list, assigning `scene-N` ids the way shots get
|
|
116
|
+
* `shot-N`, and report where each model-supplied id landed so the shots can be
|
|
117
|
+
* remapped onto it. Model ids never reach a stored document.
|
|
118
|
+
*/
|
|
119
|
+
function coerceScenes(raw) {
|
|
120
|
+
const assigned = new Map();
|
|
121
|
+
if (!Array.isArray(raw))
|
|
122
|
+
return { scenes: [], assigned };
|
|
123
|
+
const scenes = raw.map((entry, index) => {
|
|
124
|
+
const obj = isRecord(entry) ? entry : {};
|
|
125
|
+
const id = `scene-${index}`;
|
|
126
|
+
const modelId = optionalStr(obj.id);
|
|
127
|
+
// First writer wins, so two scenes sharing one id cannot steal each
|
|
128
|
+
// other's shots.
|
|
129
|
+
if (modelId && !assigned.has(modelId))
|
|
130
|
+
assigned.set(modelId, id);
|
|
131
|
+
const scene = { type: "scene", id, slugline: str(obj.slugline) };
|
|
132
|
+
const lighting = optionalStr(obj.lighting);
|
|
133
|
+
if (lighting)
|
|
134
|
+
scene.lighting = lighting;
|
|
135
|
+
return scene;
|
|
136
|
+
});
|
|
137
|
+
return { scenes, assigned };
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Rewrite each shot's model-supplied `scene_id` to the assigned `scene-N`.
|
|
141
|
+
*
|
|
142
|
+
* A shot naming a scene that was not returned inherits the scene of the shot
|
|
143
|
+
* before it (the first shot falls to the first returned scene) instead of
|
|
144
|
+
* losing its id. § 7.7.3 requires the shots of a scene to be contiguous in
|
|
145
|
+
* `index`: extending the run above keeps that, where an unscened shot in the
|
|
146
|
+
* middle would split its scene in two. With no scenes returned at all there is
|
|
147
|
+
* nothing to name, so the id is dropped and the shots read as legacy.
|
|
148
|
+
*/
|
|
149
|
+
function resolveSceneIds(shots, scenes, assigned) {
|
|
150
|
+
let previous = scenes[0]?.id;
|
|
151
|
+
for (const shot of shots) {
|
|
152
|
+
const mapped = shot.scene_id ? assigned.get(shot.scene_id) : undefined;
|
|
153
|
+
const resolved = mapped ?? previous;
|
|
154
|
+
if (resolved) {
|
|
155
|
+
shot.scene_id = resolved;
|
|
156
|
+
previous = resolved;
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
delete shot.scene_id;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/** Clamp a requested shot count to what the Director accepts (1–20). */
|
|
164
|
+
export function clampShotCount(value) {
|
|
165
|
+
const isRequest = isNumber(value) || isNonBlankString(value);
|
|
166
|
+
const n = isRequest ? Math.floor(Number(value)) : Number.NaN;
|
|
167
|
+
if (!Number.isFinite(n))
|
|
168
|
+
return 5;
|
|
169
|
+
return Math.max(1, Math.min(20, n));
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Coerce raw model output (a parsed object, a JSON string, or a fenced ```json
|
|
173
|
+
* block) into a validated {@link Screenplay}: assign ids, default missing
|
|
174
|
+
* fields, clamp the shot list to `shotCount`, and stamp every shot with
|
|
175
|
+
* `status: "planned"` and a sequential `index`.
|
|
176
|
+
*/
|
|
177
|
+
export function parseScreenplay(raw, opts) {
|
|
178
|
+
const obj = coerceObject(raw);
|
|
179
|
+
const shotCount = Math.max(0, Math.floor(opts.shotCount));
|
|
180
|
+
const rawShots = Array.isArray(obj.shots) ? obj.shots : [];
|
|
181
|
+
const shots = rawShots
|
|
182
|
+
.slice(0, shotCount)
|
|
183
|
+
.map((rawShot, i) => coerceShot(rawShot, i));
|
|
184
|
+
const { scenes, assigned } = coerceScenes(obj.scenes);
|
|
185
|
+
resolveSceneIds(shots, scenes, assigned);
|
|
186
|
+
const screenplay = {
|
|
187
|
+
type: "screenplay",
|
|
188
|
+
id: "screenplay-1",
|
|
189
|
+
title: optionalStr(obj.title) ?? opts.title ?? "Untitled Screenplay",
|
|
190
|
+
aspect_ratio: optionalStr(obj.aspect_ratio) ?? opts.aspectRatio ?? "16:9",
|
|
191
|
+
shots
|
|
192
|
+
};
|
|
193
|
+
const logline = optionalStr(obj.logline);
|
|
194
|
+
if (logline)
|
|
195
|
+
screenplay.logline = logline;
|
|
196
|
+
const styleBible = optionalStr(obj.style_bible);
|
|
197
|
+
if (styleBible)
|
|
198
|
+
screenplay.style_bible = styleBible;
|
|
199
|
+
const narration = optionalStr(obj.narration);
|
|
200
|
+
if (narration)
|
|
201
|
+
screenplay.narration = narration;
|
|
202
|
+
const musicPrompt = optionalStr(obj.music_prompt);
|
|
203
|
+
if (musicPrompt)
|
|
204
|
+
screenplay.music_prompt = musicPrompt;
|
|
205
|
+
// Genre is an input, so the caller's value stands unless the payload already
|
|
206
|
+
// carries one — which is the round-trip case (toScreenplay on a stored
|
|
207
|
+
// screenplay), not a Director answer.
|
|
208
|
+
const genre = optionalStr(obj.genre) ?? optionalStr(opts.genre);
|
|
209
|
+
if (genre)
|
|
210
|
+
screenplay.genre = genre;
|
|
211
|
+
if (scenes.length > 0)
|
|
212
|
+
screenplay.scenes = scenes;
|
|
213
|
+
return screenplay;
|
|
214
|
+
}
|
|
215
|
+
const FALLBACK_FRAMINGS = ["establishing wide", "medium", "close-up"];
|
|
216
|
+
const FALLBACK_SCENE_ID = "scene-0";
|
|
217
|
+
/**
|
|
218
|
+
* Deterministic screenplay used when the model returns no usable screenplay
|
|
219
|
+
* tool call (e.g. providers without tool support and the fake e2e provider).
|
|
220
|
+
* Mirrors DataGenerator's synthetic-rows fallback: the pipeline keeps flowing
|
|
221
|
+
* with placeholder shots derived from the brief instead of failing the run.
|
|
222
|
+
* Real provider errors still throw — this only covers an empty/unusable result.
|
|
223
|
+
*/
|
|
224
|
+
export function fallbackScreenplay(opts) {
|
|
225
|
+
const brief = opts.brief.trim() || "Untitled film";
|
|
226
|
+
const style = opts.style.trim();
|
|
227
|
+
const shotCount = Math.max(1, Math.floor(opts.shotCount));
|
|
228
|
+
const shots = Array.from({ length: shotCount }, (_, i) => coerceShot({
|
|
229
|
+
slug: `Shot ${i + 1}`,
|
|
230
|
+
action: `${brief} — beat ${i + 1} of ${shotCount}`,
|
|
231
|
+
camera: { framing: FALLBACK_FRAMINGS[i % FALLBACK_FRAMINGS.length] },
|
|
232
|
+
motion: "slow push in",
|
|
233
|
+
scene_id: FALLBACK_SCENE_ID
|
|
234
|
+
}, i));
|
|
235
|
+
const title = brief.length > 60 ? `${brief.slice(0, 60)}…` : brief;
|
|
236
|
+
const screenplay = {
|
|
237
|
+
type: "screenplay",
|
|
238
|
+
id: "screenplay-1",
|
|
239
|
+
title,
|
|
240
|
+
aspect_ratio: opts.aspectRatio,
|
|
241
|
+
shots,
|
|
242
|
+
// One scene holding every shot, so the deterministic path satisfies the
|
|
243
|
+
// same contract as a parsed answer. The brief names no location, so the
|
|
244
|
+
// slugline names the piece rather than inventing an INT./EXT. line.
|
|
245
|
+
scenes: [{ type: "scene", id: FALLBACK_SCENE_ID, slugline: title }],
|
|
246
|
+
narration: brief
|
|
247
|
+
};
|
|
248
|
+
if (style) {
|
|
249
|
+
screenplay.style_bible = style;
|
|
250
|
+
screenplay.music_prompt = `instrumental score to match: ${style}`;
|
|
251
|
+
}
|
|
252
|
+
return screenplay;
|
|
253
|
+
}
|
|
254
|
+
/** Coerce any screenplay-shaped input to a {@link Screenplay}, keeping its shots. */
|
|
255
|
+
export function toScreenplay(raw) {
|
|
256
|
+
const obj = coerceObject(raw);
|
|
257
|
+
const shotCount = Array.isArray(obj.shots) ? obj.shots.length : 0;
|
|
258
|
+
return parseScreenplay(obj, { shotCount });
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* The JSON schema the screenplay tool call is validated against.
|
|
262
|
+
*
|
|
263
|
+
* The shot count is contracted, so `shots` is pinned to it. No scene count is,
|
|
264
|
+
* so `scenes` only has to be non-empty — how many scenes a brief wants is the
|
|
265
|
+
* director's call.
|
|
266
|
+
*
|
|
267
|
+
* One rule this cannot carry: that every `shot.scene_id` names a returned
|
|
268
|
+
* scene. JSON Schema has no cross-reference between sibling arrays, and the
|
|
269
|
+
* `$data` extension that would come closest is not accepted by the providers'
|
|
270
|
+
* structured-output validators. {@link parseScreenplay} enforces it instead.
|
|
271
|
+
*/
|
|
272
|
+
export function buildScreenplaySchema(shotCount) {
|
|
273
|
+
return {
|
|
274
|
+
type: "object",
|
|
275
|
+
additionalProperties: false,
|
|
276
|
+
required: ["title", "scenes", "shots"],
|
|
277
|
+
properties: {
|
|
278
|
+
title: { type: "string" },
|
|
279
|
+
logline: { type: "string" },
|
|
280
|
+
style_bible: { type: "string" },
|
|
281
|
+
aspect_ratio: { type: "string" },
|
|
282
|
+
narration: { type: "string" },
|
|
283
|
+
music_prompt: { type: "string" },
|
|
284
|
+
scenes: {
|
|
285
|
+
type: "array",
|
|
286
|
+
minItems: 1,
|
|
287
|
+
items: {
|
|
288
|
+
type: "object",
|
|
289
|
+
additionalProperties: false,
|
|
290
|
+
required: ["id", "slugline"],
|
|
291
|
+
properties: {
|
|
292
|
+
id: { type: "string" },
|
|
293
|
+
slugline: { type: "string" },
|
|
294
|
+
lighting: { type: "string" }
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
shots: {
|
|
299
|
+
type: "array",
|
|
300
|
+
minItems: shotCount,
|
|
301
|
+
maxItems: shotCount,
|
|
302
|
+
items: {
|
|
303
|
+
type: "object",
|
|
304
|
+
additionalProperties: false,
|
|
305
|
+
required: ["scene_id", "action"],
|
|
306
|
+
properties: {
|
|
307
|
+
scene_id: { type: "string" },
|
|
308
|
+
slug: { type: "string" },
|
|
309
|
+
action: { type: "string" },
|
|
310
|
+
motion: { type: "string" },
|
|
311
|
+
dialogue: { type: "string" },
|
|
312
|
+
narration: { type: "string" },
|
|
313
|
+
duration_seconds: { type: "number" },
|
|
314
|
+
camera: {
|
|
315
|
+
type: "object",
|
|
316
|
+
additionalProperties: false,
|
|
317
|
+
properties: {
|
|
318
|
+
framing: { type: "string" },
|
|
319
|
+
lens: { type: "string" },
|
|
320
|
+
angle: { type: "string" },
|
|
321
|
+
movement: { type: "string" },
|
|
322
|
+
equipment: { type: "string" }
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* The user turn: the brief, the genre, the style, and what the shot list must
|
|
333
|
+
* contain.
|
|
334
|
+
*
|
|
335
|
+
* `genre` is a trailing optional argument rather than an options object because
|
|
336
|
+
* both call sites — the Director node and the storyboard's direct
|
|
337
|
+
* `generate_text` request — pass positionally and are owned elsewhere.
|
|
338
|
+
*/
|
|
339
|
+
export function buildDirectorPrompt(brief, style, shotCount, aspectRatio, genre) {
|
|
340
|
+
const lines = [
|
|
341
|
+
`Brief:\n${brief}`,
|
|
342
|
+
genre?.trim()
|
|
343
|
+
? `Genre:\n${genre.trim()} — let its tone, pacing and framing carry the piece.`
|
|
344
|
+
: "",
|
|
345
|
+
style.trim() ? `Style:\n${style}` : "",
|
|
346
|
+
`Produce exactly ${shotCount} shots for a ${aspectRatio} piece.`,
|
|
347
|
+
"Group them into scenes. Give each scene an id, a slugline and a lighting note, and give every shot the scene_id of the one scene it belongs to.",
|
|
348
|
+
"Give each shot a concrete visual action and camera direction, and set a style_bible describing the palette, light, lens, and texture applied to all shots."
|
|
349
|
+
];
|
|
350
|
+
return lines.filter((line) => line.length > 0).join("\n\n");
|
|
351
|
+
}
|
|
352
|
+
//# sourceMappingURL=screenplay-authoring.js.map
|