@nodetool-ai/agents 0.8.1 → 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/dist/.nodetool-build-stamp +1 -1
- package/dist/analysis/audio-dsp.d.ts +3 -2
- package/dist/analysis/audio-dsp.d.ts.map +1 -1
- package/dist/analysis/audio-dsp.js +11 -8
- package/dist/analysis/audio-dsp.js.map +1 -1
- package/dist/analysis/media-decode.d.ts +13 -0
- package/dist/analysis/media-decode.d.ts.map +1 -1
- package/dist/analysis/media-decode.js +33 -6
- package/dist/analysis/media-decode.js.map +1 -1
- package/dist/author-graph.d.ts +2 -3
- package/dist/author-graph.d.ts.map +1 -1
- package/dist/author-graph.js +3 -5
- package/dist/author-graph.js.map +1 -1
- package/dist/browser-gate.d.ts +2 -2
- package/dist/browser-gate.js +2 -2
- package/dist/capabilities/GamePublishRequest.d.ts +14 -0
- package/dist/capabilities/GamePublishRequest.d.ts.map +1 -0
- package/dist/capabilities/GamePublishRequest.js +2 -0
- package/dist/capabilities/GamePublishRequest.js.map +1 -0
- package/dist/capabilities/adapters.d.ts +4 -13
- package/dist/capabilities/adapters.d.ts.map +1 -1
- package/dist/capabilities/adapters.js +9 -14
- package/dist/capabilities/adapters.js.map +1 -1
- package/dist/capabilities/agent-activity.d.ts +27 -0
- package/dist/capabilities/agent-activity.d.ts.map +1 -0
- package/dist/capabilities/agent-activity.js +103 -0
- package/dist/capabilities/agent-activity.js.map +1 -0
- package/dist/capabilities/agentic-storyboard-finish.d.ts +67 -0
- package/dist/capabilities/agentic-storyboard-finish.d.ts.map +1 -0
- package/dist/capabilities/agentic-storyboard-finish.js +1321 -0
- package/dist/capabilities/agentic-storyboard-finish.js.map +1 -0
- package/dist/capabilities/agents.d.ts +5 -2
- package/dist/capabilities/agents.d.ts.map +1 -1
- package/dist/capabilities/agents.js +14 -4
- package/dist/capabilities/agents.js.map +1 -1
- package/dist/capabilities/agents.specs.d.ts +3 -0
- package/dist/capabilities/agents.specs.d.ts.map +1 -1
- package/dist/capabilities/agents.specs.js +71 -1
- package/dist/capabilities/agents.specs.js.map +1 -1
- package/dist/capabilities/analysis.d.ts.map +1 -1
- package/dist/capabilities/analysis.js +33 -22
- package/dist/capabilities/analysis.js.map +1 -1
- package/dist/capabilities/analysis.specs.js +2 -2
- package/dist/capabilities/analysis.specs.js.map +1 -1
- package/dist/capabilities/apps.d.ts.map +1 -1
- package/dist/capabilities/apps.js +5 -3
- package/dist/capabilities/apps.js.map +1 -1
- package/dist/capabilities/args.d.ts +2 -5
- package/dist/capabilities/args.d.ts.map +1 -1
- package/dist/capabilities/args.js +2 -5
- package/dist/capabilities/args.js.map +1 -1
- package/dist/capabilities/browser.d.ts +1 -1
- package/dist/capabilities/browser.js +1 -1
- package/dist/capabilities/browser.specs.d.ts +1 -1
- package/dist/capabilities/browser.specs.js +1 -1
- package/dist/capabilities/code.d.ts +5 -0
- package/dist/capabilities/code.d.ts.map +1 -1
- package/dist/capabilities/code.js +128 -89
- package/dist/capabilities/code.js.map +1 -1
- package/dist/capabilities/errors.d.ts +19 -0
- package/dist/capabilities/errors.d.ts.map +1 -0
- package/dist/capabilities/errors.js +109 -0
- package/dist/capabilities/errors.js.map +1 -0
- package/dist/capabilities/errors.specs.d.ts +11 -0
- package/dist/capabilities/errors.specs.d.ts.map +1 -0
- package/dist/capabilities/errors.specs.js +100 -0
- package/dist/capabilities/errors.specs.js.map +1 -0
- package/dist/capabilities/example-timelines.d.ts.map +1 -1
- package/dist/capabilities/example-timelines.js +52 -10
- package/dist/capabilities/example-timelines.js.map +1 -1
- package/dist/capabilities/example-timelines.specs.d.ts +1 -0
- package/dist/capabilities/example-timelines.specs.d.ts.map +1 -1
- package/dist/capabilities/example-timelines.specs.js +21 -3
- package/dist/capabilities/example-timelines.specs.js.map +1 -1
- package/dist/capabilities/finish-storyboard.d.ts +5 -0
- package/dist/capabilities/finish-storyboard.d.ts.map +1 -0
- package/dist/capabilities/finish-storyboard.js +278 -0
- package/dist/capabilities/finish-storyboard.js.map +1 -0
- package/dist/capabilities/game-asset-source.js +1 -1
- package/dist/capabilities/game-asset-source.js.map +1 -1
- package/dist/capabilities/game.d.ts +14 -2
- package/dist/capabilities/game.d.ts.map +1 -1
- package/dist/capabilities/game.js +209 -39
- package/dist/capabilities/game.js.map +1 -1
- package/dist/capabilities/game.specs.d.ts +2 -0
- package/dist/capabilities/game.specs.d.ts.map +1 -1
- package/dist/capabilities/game.specs.js +25 -11
- package/dist/capabilities/game.specs.js.map +1 -1
- package/dist/capabilities/game3d.d.ts +17 -0
- package/dist/capabilities/game3d.d.ts.map +1 -0
- package/dist/capabilities/game3d.js +433 -0
- package/dist/capabilities/game3d.js.map +1 -0
- package/dist/capabilities/gate-from-context.d.ts +1 -1
- package/dist/capabilities/gate-from-context.js +1 -1
- package/dist/capabilities/generations.d.ts +2 -0
- package/dist/capabilities/generations.d.ts.map +1 -1
- package/dist/capabilities/generations.js +7 -2
- package/dist/capabilities/generations.js.map +1 -1
- package/dist/capabilities/index.d.ts +2 -2
- package/dist/capabilities/index.d.ts.map +1 -1
- package/dist/capabilities/index.js +2 -2
- package/dist/capabilities/index.js.map +1 -1
- package/dist/capabilities/invoke.d.ts +14 -25
- package/dist/capabilities/invoke.d.ts.map +1 -1
- package/dist/capabilities/invoke.js +72 -35
- package/dist/capabilities/invoke.js.map +1 -1
- package/dist/capabilities/jobs.d.ts.map +1 -1
- package/dist/capabilities/jobs.js +47 -3
- package/dist/capabilities/jobs.js.map +1 -1
- package/dist/capabilities/jobs.specs.d.ts.map +1 -1
- package/dist/capabilities/jobs.specs.js +3 -1
- package/dist/capabilities/jobs.specs.js.map +1 -1
- package/dist/capabilities/js-scripts.d.ts +19 -1
- package/dist/capabilities/js-scripts.d.ts.map +1 -1
- package/dist/capabilities/js-scripts.js +109 -2
- package/dist/capabilities/js-scripts.js.map +1 -1
- package/dist/capabilities/js-scripts.specs.d.ts +2 -0
- package/dist/capabilities/js-scripts.specs.d.ts.map +1 -1
- package/dist/capabilities/js-scripts.specs.js +50 -0
- package/dist/capabilities/js-scripts.specs.js.map +1 -1
- package/dist/capabilities/lazy-tool.d.ts +23 -24
- package/dist/capabilities/lazy-tool.d.ts.map +1 -1
- package/dist/capabilities/lazy-tool.js +29 -35
- package/dist/capabilities/lazy-tool.js.map +1 -1
- package/dist/capabilities/legacy-tools.d.ts +15 -0
- package/dist/capabilities/legacy-tools.d.ts.map +1 -0
- package/dist/capabilities/legacy-tools.js +98 -0
- package/dist/capabilities/legacy-tools.js.map +1 -0
- package/dist/capabilities/media.d.ts +0 -9
- package/dist/capabilities/media.d.ts.map +1 -1
- package/dist/capabilities/media.js +301 -260
- package/dist/capabilities/media.js.map +1 -1
- package/dist/capabilities/models.d.ts +2 -2
- package/dist/capabilities/models.d.ts.map +1 -1
- package/dist/capabilities/models.js +5 -3
- package/dist/capabilities/models.js.map +1 -1
- package/dist/capabilities/registry.d.ts +2 -0
- package/dist/capabilities/registry.d.ts.map +1 -1
- package/dist/capabilities/registry.js +28 -0
- package/dist/capabilities/registry.js.map +1 -1
- package/dist/capabilities/run-agent.d.ts +19 -0
- package/dist/capabilities/run-agent.d.ts.map +1 -0
- package/dist/capabilities/run-agent.js +183 -0
- package/dist/capabilities/run-agent.js.map +1 -0
- package/dist/capabilities/runs.d.ts +9 -0
- package/dist/capabilities/runs.d.ts.map +1 -0
- package/dist/capabilities/runs.js +46 -0
- package/dist/capabilities/runs.js.map +1 -0
- package/dist/capabilities/runs.specs.d.ts +39 -0
- package/dist/capabilities/runs.specs.d.ts.map +1 -0
- package/dist/capabilities/runs.specs.js +52 -0
- package/dist/capabilities/runs.specs.js.map +1 -0
- package/dist/capabilities/scripts.d.ts.map +1 -1
- package/dist/capabilities/scripts.js +11 -5
- package/dist/capabilities/scripts.js.map +1 -1
- package/dist/capabilities/sketches.d.ts.map +1 -1
- package/dist/capabilities/sketches.js +4 -2
- package/dist/capabilities/sketches.js.map +1 -1
- package/dist/capabilities/skills.d.ts.map +1 -1
- package/dist/capabilities/skills.js +22 -2
- package/dist/capabilities/skills.js.map +1 -1
- package/dist/capabilities/storyboard-layout-check.d.ts +33 -0
- package/dist/capabilities/storyboard-layout-check.d.ts.map +1 -0
- package/dist/capabilities/storyboard-layout-check.js +229 -0
- package/dist/capabilities/storyboard-layout-check.js.map +1 -0
- package/dist/capabilities/storyboard-measured-sources.d.ts +10 -0
- package/dist/capabilities/storyboard-measured-sources.d.ts.map +1 -0
- package/dist/capabilities/storyboard-measured-sources.js +67 -0
- package/dist/capabilities/storyboard-measured-sources.js.map +1 -0
- package/dist/capabilities/storyboard-review-times.d.ts +4 -0
- package/dist/capabilities/storyboard-review-times.d.ts.map +1 -0
- package/dist/capabilities/storyboard-review-times.js +39 -0
- package/dist/capabilities/storyboard-review-times.js.map +1 -0
- package/dist/capabilities/storyboards.d.ts +2 -18
- package/dist/capabilities/storyboards.d.ts.map +1 -1
- package/dist/capabilities/storyboards.js +315 -94
- package/dist/capabilities/storyboards.js.map +1 -1
- package/dist/capabilities/storyboards.specs.d.ts +3 -0
- package/dist/capabilities/storyboards.specs.d.ts.map +1 -1
- package/dist/capabilities/storyboards.specs.js +42 -3
- package/dist/capabilities/storyboards.specs.js.map +1 -1
- package/dist/capabilities/timeline-bridge.d.ts +359 -0
- package/dist/capabilities/timeline-bridge.d.ts.map +1 -0
- package/dist/capabilities/timeline-bridge.js +1016 -0
- package/dist/capabilities/timeline-bridge.js.map +1 -0
- package/dist/capabilities/timeline-clip-frames.d.ts +17 -0
- package/dist/capabilities/timeline-clip-frames.d.ts.map +1 -0
- package/dist/capabilities/timeline-clip-frames.js +84 -0
- package/dist/capabilities/timeline-clip-frames.js.map +1 -0
- package/dist/capabilities/timeline-media-edit.d.ts +8 -0
- package/dist/capabilities/timeline-media-edit.d.ts.map +1 -0
- package/dist/capabilities/timeline-media-edit.js +94 -0
- package/dist/capabilities/timeline-media-edit.js.map +1 -0
- package/dist/capabilities/timeline-native-media.d.ts.map +1 -1
- package/dist/capabilities/timeline-native-media.js +40 -0
- package/dist/capabilities/timeline-native-media.js.map +1 -1
- package/dist/capabilities/timelines.d.ts +64 -4
- package/dist/capabilities/timelines.d.ts.map +1 -1
- package/dist/capabilities/timelines.js +566 -67
- package/dist/capabilities/timelines.js.map +1 -1
- package/dist/capabilities/timelines.specs.d.ts +8 -0
- package/dist/capabilities/timelines.specs.d.ts.map +1 -1
- package/dist/capabilities/timelines.specs.js +173 -8
- package/dist/capabilities/timelines.specs.js.map +1 -1
- package/dist/capabilities/types.d.ts +3 -1
- package/dist/capabilities/types.d.ts.map +1 -1
- package/dist/capabilities/types.js.map +1 -1
- package/dist/capabilities/ui.d.ts.map +1 -1
- package/dist/capabilities/ui.js +24 -2
- package/dist/capabilities/ui.js.map +1 -1
- package/dist/capabilities/workflows.d.ts.map +1 -1
- package/dist/capabilities/workflows.js +53 -26
- package/dist/capabilities/workflows.js.map +1 -1
- package/dist/capabilities/workflows.specs.d.ts.map +1 -1
- package/dist/capabilities/workflows.specs.js +7 -1
- package/dist/capabilities/workflows.specs.js.map +1 -1
- package/dist/codeact/action-diagnostics.d.ts.map +1 -1
- package/dist/codeact/action-diagnostics.js +51 -1
- package/dist/codeact/action-diagnostics.js.map +1 -1
- package/dist/codeact/codeact-executor.d.ts.map +1 -1
- package/dist/codeact/codeact-executor.js +16 -8
- package/dist/codeact/codeact-executor.js.map +1 -1
- package/dist/codeact/compact-ids.d.ts.map +1 -1
- package/dist/codeact/compact-ids.js +5 -1
- package/dist/codeact/compact-ids.js.map +1 -1
- package/dist/codeact/graph-model.d.ts +1 -1
- package/dist/codeact/graph-model.d.ts.map +1 -1
- package/dist/codeact/graph-model.js +2 -3
- package/dist/codeact/graph-model.js.map +1 -1
- package/dist/codeact/nodetool-api.d.ts +1 -1
- package/dist/codeact/nodetool-api.d.ts.map +1 -1
- package/dist/codeact/nodetool-api.js +202 -284
- package/dist/codeact/nodetool-api.js.map +1 -1
- package/dist/codeact/tool-api.d.ts +6 -3
- package/dist/codeact/tool-api.d.ts.map +1 -1
- package/dist/codeact/tool-api.js +22 -15
- package/dist/codeact/tool-api.js.map +1 -1
- package/dist/evals/codeact-api-cases.d.ts.map +1 -1
- package/dist/evals/codeact-api-cases.js +2 -0
- package/dist/evals/codeact-api-cases.js.map +1 -1
- package/dist/evals/codeact-api-runs.d.ts +3 -0
- package/dist/evals/codeact-api-runs.d.ts.map +1 -0
- package/dist/evals/codeact-api-runs.js +33 -0
- package/dist/evals/codeact-api-runs.js.map +1 -0
- package/dist/evals/surfaces/sketch.d.ts +2 -0
- package/dist/evals/surfaces/sketch.d.ts.map +1 -1
- package/dist/evals/surfaces/sketch.js +11 -3
- package/dist/evals/surfaces/sketch.js.map +1 -1
- package/dist/evals/surfaces/timeline.d.ts +4 -357
- package/dist/evals/surfaces/timeline.d.ts.map +1 -1
- package/dist/evals/surfaces/timeline.js +9 -2621
- package/dist/evals/surfaces/timeline.js.map +1 -1
- package/dist/evals/tool-loop-bridge.d.ts +4 -0
- package/dist/evals/tool-loop-bridge.d.ts.map +1 -1
- package/dist/evals/tool-loop-bridge.js.map +1 -1
- package/dist/evals/tool-loop-eval.d.ts +2 -0
- package/dist/evals/tool-loop-eval.d.ts.map +1 -1
- package/dist/evals/tool-loop-eval.js +6 -1
- package/dist/evals/tool-loop-eval.js.map +1 -1
- package/dist/evals/tool-loop-permission.d.ts +1 -15
- package/dist/evals/tool-loop-permission.d.ts.map +1 -1
- package/dist/evals/tool-loop-permission.js +23 -41
- package/dist/evals/tool-loop-permission.js.map +1 -1
- package/dist/game-authoring.d.ts +4737 -0
- package/dist/game-authoring.d.ts.map +1 -0
- package/dist/game-authoring.js +146 -0
- package/dist/game-authoring.js.map +1 -0
- package/dist/game-code-bake.d.ts +26 -0
- package/dist/game-code-bake.d.ts.map +1 -0
- package/dist/game-code-bake.js +98 -0
- package/dist/game-code-bake.js.map +1 -0
- package/dist/game-examples.d.ts +872 -16
- package/dist/game-examples.d.ts.map +1 -1
- package/dist/game-examples.js +5 -4
- package/dist/game-examples.js.map +1 -1
- package/dist/index.d.ts +15 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/dist/js-sandbox-worker/engine.d.ts +4 -0
- package/dist/js-sandbox-worker/engine.d.ts.map +1 -0
- package/dist/js-sandbox-worker/engine.js +45 -0
- package/dist/js-sandbox-worker/engine.js.map +1 -0
- package/dist/js-sandbox-worker/host.js +1 -1
- package/dist/js-sandbox-worker/host.js.map +1 -1
- package/dist/js-sandbox-worker/interpreter.d.ts +1 -1
- package/dist/js-sandbox-worker/interpreter.d.ts.map +1 -1
- package/dist/js-sandbox-worker/interpreter.js +94 -2
- package/dist/js-sandbox-worker/interpreter.js.map +1 -1
- package/dist/js-sandbox-worker/worker-entry.d.ts.map +1 -1
- package/dist/js-sandbox-worker/worker-entry.js +3 -2
- package/dist/js-sandbox-worker/worker-entry.js.map +1 -1
- package/dist/js-sandbox.d.ts +2 -0
- package/dist/js-sandbox.d.ts.map +1 -1
- package/dist/js-sandbox.js +56 -11
- package/dist/js-sandbox.js.map +1 -1
- package/dist/js-script-app-runner.d.ts +2 -0
- package/dist/js-script-app-runner.d.ts.map +1 -1
- package/dist/js-script-app-runner.js +8 -3
- package/dist/js-script-app-runner.js.map +1 -1
- package/dist/js-script-sandbox.d.ts +12 -18
- package/dist/js-script-sandbox.d.ts.map +1 -1
- package/dist/js-script-sandbox.js +3 -49
- package/dist/js-script-sandbox.js.map +1 -1
- package/dist/prompts/product-knowledge.d.ts +1 -1
- package/dist/prompts/product-knowledge.d.ts.map +1 -1
- package/dist/prompts/product-knowledge.js +82 -41
- package/dist/prompts/product-knowledge.js.map +1 -1
- package/dist/sandbox-pack-resolution.d.ts +21 -0
- package/dist/sandbox-pack-resolution.d.ts.map +1 -0
- package/dist/sandbox-pack-resolution.js +42 -0
- package/dist/sandbox-pack-resolution.js.map +1 -0
- package/dist/sandbox-toolbelt.d.ts +3 -1
- package/dist/sandbox-toolbelt.d.ts.map +1 -1
- package/dist/sandbox-toolbelt.js +8 -2
- package/dist/sandbox-toolbelt.js.map +1 -1
- package/dist/skill-prompt.d.ts +11 -1
- package/dist/skill-prompt.d.ts.map +1 -1
- package/dist/skill-prompt.js +17 -6
- package/dist/skill-prompt.js.map +1 -1
- package/dist/system-skills.d.ts +7 -1
- package/dist/system-skills.d.ts.map +1 -1
- package/dist/system-skills.js +2 -2
- package/dist/system-skills.js.map +1 -1
- package/dist/timeline-capture.d.ts +21 -0
- package/dist/timeline-capture.d.ts.map +1 -0
- package/dist/timeline-capture.js +564 -0
- package/dist/timeline-capture.js.map +1 -0
- package/dist/timeline-code-bake.d.ts +75 -0
- package/dist/timeline-code-bake.d.ts.map +1 -0
- package/dist/timeline-code-bake.js +327 -0
- package/dist/timeline-code-bake.js.map +1 -0
- package/dist/timeline-preview/frames.d.ts +26 -0
- package/dist/timeline-preview/frames.d.ts.map +1 -1
- package/dist/timeline-preview/frames.js +155 -70
- package/dist/timeline-preview/frames.js.map +1 -1
- package/dist/tools/base-tool.d.ts +1 -0
- package/dist/tools/base-tool.d.ts.map +1 -1
- package/dist/tools/base-tool.js +1 -1
- package/dist/tools/base-tool.js.map +1 -1
- package/dist/tools/builtin-tools.d.ts.map +1 -1
- package/dist/tools/builtin-tools.js +13 -0
- package/dist/tools/builtin-tools.js.map +1 -1
- package/dist/tools/external-capability-tools.d.ts +1 -1
- package/dist/tools/external-capability-tools.js +1 -1
- package/dist/tools/mcp-tool-support.d.ts +10 -9
- package/dist/tools/mcp-tool-support.d.ts.map +1 -1
- package/dist/tools/mcp-tool-support.js +14 -13
- package/dist/tools/mcp-tool-support.js.map +1 -1
- package/dist/tools/mcp-tools.d.ts +6 -4
- package/dist/tools/mcp-tools.d.ts.map +1 -1
- package/dist/tools/mcp-tools.js +65 -62
- package/dist/tools/mcp-tools.js.map +1 -1
- package/dist/tools/tool-permissions.d.ts +1 -1
- package/dist/tools/tool-permissions.js +1 -1
- package/package.json +24 -22
- package/dist/capabilities/gate-tools.d.ts +0 -18
- package/dist/capabilities/gate-tools.d.ts.map +0 -1
- package/dist/capabilities/gate-tools.js +0 -66
- package/dist/capabilities/gate-tools.js.map +0 -1
- package/dist/tsconfig.tests.tmp.tsbuildinfo +0 -1
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { createHash, randomUUID } from "node:crypto";
|
|
2
2
|
import { mkdtemp, readFile, readdir, rm } from "node:fs/promises";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
import { getManagedWorkspaceDir, managedWorkspaceKey, workspaceStorageKind } from "@nodetool-ai/config";
|
|
4
|
+
import { createLogger, getManagedWorkspaceDir, managedWorkspaceKey, workspaceStorageKind } from "@nodetool-ai/config";
|
|
5
5
|
import { AmbiguousGameIdError, Asset, Game, Prediction, Project, Workspace } from "@nodetool-ai/models";
|
|
6
|
-
import { gameAssetBinding, gameDocument, gameInputFrame, shortResourceId } from "@nodetool-ai/protocol";
|
|
7
|
-
import { autoplayNativeGame, MAX_GAME_ROUTE_TICKS, createScriptedGameSession, createTopDownRoomGame,
|
|
6
|
+
import { anyGameAssetBinding as gameAssetBinding, gameAssetBinding as legacyAssetBinding, gameAssetBinding3D, anyGameDocument as gameDocument, gameInputFrame, shortResourceId } from "@nodetool-ai/protocol";
|
|
7
|
+
import { autoplayNativeGame, MAX_GAME_ROUTE_TICKS, createScriptedGameSession, createTopDownRoomGame, createNative3DGame, decodePreparedGameCollider3D, validateAnyGame, trackGameAuthoringEdits, anyGameDocumentOp as gameDocumentOp, GameOpError } from "@nodetool-ai/game-runtime";
|
|
8
8
|
import { workspaceFromRow } from "@nodetool-ai/execution/service";
|
|
9
9
|
import { assetKeyCandidates, assetObjectKey } from "@nodetool-ai/storage";
|
|
10
|
+
import { gameOutline3D, inputFrames3D, playtestGame3D, captureFrames3D, colliderBinding3D, stageModelGameAsset3D } from "./game3d.js";
|
|
10
11
|
import { gameSpecs } from "./game.specs.js";
|
|
11
12
|
import { persistOutput } from "../tools/asset-persist.js";
|
|
12
13
|
import { getExampleGameBundle, installExampleGameAssets, listExampleGames } from "../game-examples.js";
|
|
14
|
+
import { previewGameAuthoring, applyGameAuthoring } from "../game-authoring.js";
|
|
15
|
+
import { gameDocumentDigest } from "../game-code-bake.js";
|
|
16
|
+
import { previewGameAuthoringSpec, applyGameAuthoringSpec } from "./game.specs.js";
|
|
17
|
+
const log = createLogger("capabilities.game");
|
|
13
18
|
const MAX_PLAYTEST_TICKS = MAX_GAME_ROUTE_TICKS;
|
|
14
19
|
const MAX_CAPTURE_FRAMES = 8;
|
|
15
20
|
const MAX_BUILD_ASSETS = 128;
|
|
@@ -24,7 +29,9 @@ const MEDIA_EXTENSIONS = {
|
|
|
24
29
|
"audio/ogg": "ogg",
|
|
25
30
|
"audio/mpeg": "mp3",
|
|
26
31
|
"font/ttf": "ttf",
|
|
27
|
-
"font/otf": "otf"
|
|
32
|
+
"font/otf": "otf",
|
|
33
|
+
"model/gltf-binary": "glb",
|
|
34
|
+
"application/json": "json"
|
|
28
35
|
};
|
|
29
36
|
function userId(run) {
|
|
30
37
|
return run.context.userId ?? null;
|
|
@@ -102,6 +109,9 @@ async function readSource(workspace, game, source, revision) {
|
|
|
102
109
|
return draft?.document ?? null;
|
|
103
110
|
}
|
|
104
111
|
function outline(document) {
|
|
112
|
+
if (document.schemaVersion === 3) {
|
|
113
|
+
return gameOutline3D(document);
|
|
114
|
+
}
|
|
105
115
|
return {
|
|
106
116
|
settings: {
|
|
107
117
|
schemaVersion: document.schemaVersion,
|
|
@@ -308,8 +318,8 @@ function validateSource(source, gameId, revision) {
|
|
|
308
318
|
const parsed = gameDocument.safeParse(source);
|
|
309
319
|
if (!parsed.success)
|
|
310
320
|
return { error: parsed.error.message };
|
|
311
|
-
const result =
|
|
312
|
-
return result.document
|
|
321
|
+
const result = validateAnyGame({ ...parsed.data, id: gameId, revision });
|
|
322
|
+
return result.valid ? result.document : { error: result.diagnostics.map((issue) => `${issue.code} ${issue.path.join(".")}: ${issue.message}`).join("; ") };
|
|
313
323
|
}
|
|
314
324
|
function summary(game) {
|
|
315
325
|
return {
|
|
@@ -319,25 +329,52 @@ function summary(game) {
|
|
|
319
329
|
workspace_id: game.workspace_id
|
|
320
330
|
};
|
|
321
331
|
}
|
|
322
|
-
async function publish(user, game,
|
|
332
|
+
async function publish(user, game, request) {
|
|
333
|
+
const baseRevision = request.base_revision;
|
|
323
334
|
if (game.current_revision !== baseRevision)
|
|
324
335
|
return { error: "Game was modified concurrently", current_revision: game.current_revision };
|
|
325
336
|
const revision = randomUUID().replace(/-/g, "");
|
|
326
|
-
const document = validateSource(source, game.id, revision);
|
|
327
|
-
if ("error" in document)
|
|
328
|
-
return document;
|
|
329
337
|
const workspace = await workspaceOf(user, game);
|
|
330
338
|
if (!workspace)
|
|
331
339
|
return { error: "Game workspace is unavailable" };
|
|
332
340
|
const draft = await Game.readDraft(user, game.id, workspace);
|
|
333
341
|
if (!draft)
|
|
334
342
|
return { error: "Game draft not found" };
|
|
343
|
+
const draftToken = request.document ? request.base_updated_at : draft.game.draft_updated_at;
|
|
344
|
+
if (draftToken !== draft.game.draft_updated_at) {
|
|
345
|
+
return { error: "Game draft was modified concurrently" };
|
|
346
|
+
}
|
|
347
|
+
let document = validateSource(request.document ?? draft.document, game.id, revision);
|
|
348
|
+
if ("error" in document)
|
|
349
|
+
return document;
|
|
350
|
+
if ((document.schemaVersion === 3) !== (draft.document.schemaVersion === 3)) {
|
|
351
|
+
return { error: "A game cannot change dimension" };
|
|
352
|
+
}
|
|
353
|
+
if (gameDocumentDigest(document.authoring) !== gameDocumentDigest(draft.document.authoring)) {
|
|
354
|
+
return { error: "Retained authoring metadata must be updated through construction preview and apply" };
|
|
355
|
+
}
|
|
356
|
+
document = trackGameAuthoringEdits(draft.document, document);
|
|
357
|
+
const checked = validateAnyGame(document);
|
|
358
|
+
if (!checked.valid) {
|
|
359
|
+
return { error: "Game publication rejected", diagnostics: checked.diagnostics };
|
|
360
|
+
}
|
|
335
361
|
await workspace.write(revisionPath(game, revision), JSON.stringify(document), "application/json");
|
|
336
|
-
const updated = await Game.publish(user, game.id, baseRevision, revision,
|
|
337
|
-
if (!updated)
|
|
362
|
+
const updated = await Game.publish(user, game.id, baseRevision, revision, draftToken, workspace, request.message);
|
|
363
|
+
if (!updated) {
|
|
364
|
+
try {
|
|
365
|
+
await workspace.delete(revisionPath(game, revision));
|
|
366
|
+
}
|
|
367
|
+
catch (error) {
|
|
368
|
+
log.error("Losing game publication revision cleanup failed", { gameId: game.id, revision, error: String(error) });
|
|
369
|
+
}
|
|
338
370
|
return { error: "Game was modified concurrently" };
|
|
339
|
-
|
|
340
|
-
|
|
371
|
+
}
|
|
372
|
+
try {
|
|
373
|
+
await Game.pruneRevisionFiles(user, game.id, workspace);
|
|
374
|
+
}
|
|
375
|
+
catch (error) {
|
|
376
|
+
log.error("Game publication revision cleanup failed", { gameId: game.id, error: String(error) });
|
|
377
|
+
}
|
|
341
378
|
return { game: summary(updated), document };
|
|
342
379
|
}
|
|
343
380
|
const create = {
|
|
@@ -349,14 +386,26 @@ const create = {
|
|
|
349
386
|
if (!user || typeof projectId !== "string" || typeof name !== "string" || !name.trim()) {
|
|
350
387
|
return { error: "project_id and name are required in a user session" };
|
|
351
388
|
}
|
|
352
|
-
const
|
|
389
|
+
const dimension = args["dimension"];
|
|
390
|
+
if (dimension !== undefined && dimension !== "2d" && dimension !== "3d") {
|
|
391
|
+
return { error: "dimension must be 2d or 3d" };
|
|
392
|
+
}
|
|
393
|
+
if (args["template"] !== undefined && args["template"] !== "exploration" && args["template"] !== "topdown") {
|
|
394
|
+
return { error: "Unknown native game template" };
|
|
395
|
+
}
|
|
396
|
+
if (args["template"] !== undefined && args["template"] !== (dimension === "3d" ? "exploration" : "topdown")) {
|
|
397
|
+
return { error: "Template does not match the requested dimension" };
|
|
398
|
+
}
|
|
399
|
+
const created = await createNativeGame(user, projectId, name.trim(), undefined, dimension ?? "2d");
|
|
353
400
|
return "error" in created
|
|
354
401
|
? created
|
|
355
402
|
: { game: summary(created.game), document: created.document };
|
|
356
403
|
}
|
|
357
404
|
};
|
|
358
|
-
|
|
359
|
-
|
|
405
|
+
export async function createNativeGame(user, projectId, name, source, dimension = "2d") {
|
|
406
|
+
if (source?.authoring) {
|
|
407
|
+
return { error: "Attach retained construction through preview and apply after creating the game" };
|
|
408
|
+
}
|
|
360
409
|
const project = await Project.findOwned(user, projectId);
|
|
361
410
|
if (!project)
|
|
362
411
|
return { error: "Project not found" };
|
|
@@ -366,9 +415,12 @@ export async function createNativeGame(user, projectId, name, source) {
|
|
|
366
415
|
return { error: "Project workspace is unavailable" };
|
|
367
416
|
const id = randomUUID().replace(/-/g, "");
|
|
368
417
|
const revision = randomUUID().replace(/-/g, "");
|
|
369
|
-
const document = validateSource(source ?? { ...createTopDownRoomGame(id), schemaVersion: 2 }, id, revision);
|
|
418
|
+
const document = validateSource(source ?? (dimension === "3d" ? createNative3DGame(id) : { ...createTopDownRoomGame(id), schemaVersion: 2 }), id, revision);
|
|
370
419
|
if ("error" in document)
|
|
371
420
|
return document;
|
|
421
|
+
if (source && ((document.schemaVersion === 3) !== (dimension === "3d"))) {
|
|
422
|
+
return { error: "Supplied document does not match the requested dimension" };
|
|
423
|
+
}
|
|
372
424
|
const game = new Game({
|
|
373
425
|
id,
|
|
374
426
|
user_id: user,
|
|
@@ -395,13 +447,18 @@ const get = {
|
|
|
395
447
|
const id = args["game_id"];
|
|
396
448
|
if (!user || typeof id !== "string")
|
|
397
449
|
return { error: "game_id is required in a user session" };
|
|
398
|
-
|
|
450
|
+
let game = await ownedGame(user, id);
|
|
399
451
|
if (!game)
|
|
400
452
|
return { error: "Game not found" };
|
|
401
453
|
const workspace = await workspaceOf(user, game);
|
|
402
454
|
if (!workspace)
|
|
403
455
|
return { error: "Game workspace is unavailable" };
|
|
404
|
-
const
|
|
456
|
+
const readsDraft = (args["source"] === undefined || args["source"] === "draft") && args["revision"] === undefined;
|
|
457
|
+
const draft = readsDraft ? await Game.readDraft(user, game.id, workspace) : null;
|
|
458
|
+
const document = readsDraft ? draft?.document : await readSource(workspace, game, args["source"], args["revision"]);
|
|
459
|
+
if (draft) {
|
|
460
|
+
game = draft.game;
|
|
461
|
+
}
|
|
405
462
|
if (!document)
|
|
406
463
|
return { error: "Game source not found" };
|
|
407
464
|
const view = args["view"] ?? "outline";
|
|
@@ -430,11 +487,19 @@ const save = {
|
|
|
430
487
|
const game = await ownedGame(user, id);
|
|
431
488
|
if (!game)
|
|
432
489
|
return { error: "Game not found" };
|
|
433
|
-
const
|
|
434
|
-
if (
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
490
|
+
const request = { game_id: id, base_revision: base, message: typeof args["message"] === "string" ? args["message"] : undefined };
|
|
491
|
+
if (args["document"] !== undefined) {
|
|
492
|
+
const token = args["base_updated_at"];
|
|
493
|
+
if (typeof token !== "string" || !token) {
|
|
494
|
+
return { error: "base_updated_at is required with an explicit document" };
|
|
495
|
+
}
|
|
496
|
+
const parsed = gameDocument.safeParse(args["document"]);
|
|
497
|
+
if (!parsed.success) {
|
|
498
|
+
return { error: parsed.error.message };
|
|
499
|
+
}
|
|
500
|
+
return publish(user, game, { ...request, document: parsed.data, base_updated_at: token });
|
|
501
|
+
}
|
|
502
|
+
return publish(user, game, request);
|
|
438
503
|
}
|
|
439
504
|
};
|
|
440
505
|
const edit = {
|
|
@@ -510,11 +575,13 @@ const install = {
|
|
|
510
575
|
return { error: "Candidate workspace is unavailable" };
|
|
511
576
|
candidateWorkspace = resolved;
|
|
512
577
|
}
|
|
513
|
-
const formats = parsed.data.mediaKind === "
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
578
|
+
const formats = parsed.data.mediaKind === "model" ? [["glb", "model/gltf-binary"]]
|
|
579
|
+
: parsed.data.mediaKind === "collider" ? [["json", "application/json"]]
|
|
580
|
+
: parsed.data.mediaKind === "audio"
|
|
581
|
+
? [["wav", "audio/wav"], ["mp3", "audio/mpeg"], ["ogg", "audio/ogg"]]
|
|
582
|
+
: parsed.data.mediaKind === "font"
|
|
583
|
+
? [[parsed.data.fontFormat, `font/${parsed.data.fontFormat}`]]
|
|
584
|
+
: [["png", "image/png"], ["jpg", "image/jpeg"], ["webp", "image/webp"]];
|
|
518
585
|
let candidate = null;
|
|
519
586
|
for (const [extension, contentType] of formats) {
|
|
520
587
|
if (!extension)
|
|
@@ -536,6 +603,45 @@ const install = {
|
|
|
536
603
|
if (!draft)
|
|
537
604
|
return { error: "Game draft is missing" };
|
|
538
605
|
const expectedUpdatedAt = typeof args["base_updated_at"] === "string" ? args["base_updated_at"] : draft.game.draft_updated_at;
|
|
606
|
+
let binding = parsed.data;
|
|
607
|
+
try {
|
|
608
|
+
if (binding.mediaKind === "model") {
|
|
609
|
+
const { prepareGameModelBinding3D } = await import("@nodetool-ai/game-renderer/preparation3d");
|
|
610
|
+
const prepared = await prepareGameModelBinding3D(bytes, { assetId: binding.assetId, expectedDigest: binding.digest, signal: run.context.signal });
|
|
611
|
+
if (!prepared.ok) {
|
|
612
|
+
return { error: "Model preparation failed", diagnostics: prepared.diagnostics };
|
|
613
|
+
}
|
|
614
|
+
const sourceAsset = binding.sourceAssetId ? await Asset.find(user, binding.sourceAssetId) : null;
|
|
615
|
+
if (binding.sourceAssetId && !sourceAsset) {
|
|
616
|
+
return { error: "Model source asset is not owned" };
|
|
617
|
+
}
|
|
618
|
+
const canonical = { ...prepared.binding, required: binding.required };
|
|
619
|
+
if (binding.provenance) {
|
|
620
|
+
canonical.provenance = binding.provenance;
|
|
621
|
+
}
|
|
622
|
+
if (binding.importSettings) {
|
|
623
|
+
canonical.importSettings = binding.importSettings;
|
|
624
|
+
}
|
|
625
|
+
if (binding.sourceDigest) {
|
|
626
|
+
canonical.sourceDigest = binding.sourceDigest;
|
|
627
|
+
}
|
|
628
|
+
if (sourceAsset) {
|
|
629
|
+
canonical.sourceAssetId = sourceAsset.id;
|
|
630
|
+
}
|
|
631
|
+
binding = canonical;
|
|
632
|
+
}
|
|
633
|
+
else if (binding.mediaKind === "collider") {
|
|
634
|
+
binding = colliderBinding3D(bytes, binding);
|
|
635
|
+
await decodePreparedGameCollider3D(bytes, gameAssetBinding3D.options[1].parse(binding));
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
catch (error) {
|
|
639
|
+
return { error: error instanceof Error ? error.message : String(error) };
|
|
640
|
+
}
|
|
641
|
+
const targetBinding = draft.document.schemaVersion === 3 ? gameAssetBinding3D.safeParse(binding) : legacyAssetBinding.safeParse(binding);
|
|
642
|
+
if (!targetBinding.success) {
|
|
643
|
+
return { error: "Asset binding does not match the game dimension" };
|
|
644
|
+
}
|
|
539
645
|
const storage = run.context.assetStorage;
|
|
540
646
|
if (!storage)
|
|
541
647
|
return { error: "Asset storage is unavailable" };
|
|
@@ -558,7 +664,8 @@ const install = {
|
|
|
558
664
|
uri = await storage.store(key, bytes, contentType);
|
|
559
665
|
let result;
|
|
560
666
|
try {
|
|
561
|
-
const
|
|
667
|
+
const op = gameDocumentOp.parse({ op: "bind_asset", slot, binding: { ...targetBinding.data, assetId: installed.id } });
|
|
668
|
+
const updated = await Game.updateDraft(user, game.id, expectedUpdatedAt, [op], workspace, { actor: "agent", threadId: run.context.threadId ?? undefined, messageId: run.context.get?.("chat_message_id") ?? undefined });
|
|
562
669
|
result = updated ? { game: summary(updated.game), draft_updated_at: updated.game.draft_updated_at, document: updated.document } : { error: "Game draft was modified concurrently" };
|
|
563
670
|
}
|
|
564
671
|
catch (error) {
|
|
@@ -597,6 +704,15 @@ const playtest = {
|
|
|
597
704
|
const document = await readSource(workspace, game, args["source"], args["revision"]);
|
|
598
705
|
if (!document)
|
|
599
706
|
return { error: "Game source not found" };
|
|
707
|
+
if (document.schemaVersion === 3) {
|
|
708
|
+
try {
|
|
709
|
+
return await playtestGame3D(run, user, document, args);
|
|
710
|
+
}
|
|
711
|
+
catch (error) {
|
|
712
|
+
run.context.signal?.throwIfAborted();
|
|
713
|
+
return { error: error instanceof Error ? error.message : String(error), code: "game3d_preparation_failed" };
|
|
714
|
+
}
|
|
715
|
+
}
|
|
600
716
|
const captures = captureTicks(args["capture_ticks"], []);
|
|
601
717
|
if ("error" in captures)
|
|
602
718
|
return captures;
|
|
@@ -732,6 +848,20 @@ const capture = {
|
|
|
732
848
|
const ticks = captureTicks(args["ticks"], [0]);
|
|
733
849
|
if ("error" in ticks)
|
|
734
850
|
return ticks;
|
|
851
|
+
if (document.schemaVersion === 3) {
|
|
852
|
+
const inputs = inputFrames3D(args["inputs"], Math.max(0, ...ticks));
|
|
853
|
+
if ("error" in inputs) {
|
|
854
|
+
return inputs;
|
|
855
|
+
}
|
|
856
|
+
const seed = typeof args["seed"] === "number" && Number.isSafeInteger(args["seed"]) ? args["seed"] : 1;
|
|
857
|
+
try {
|
|
858
|
+
return await captureFrames3D(run, user, document, ticks, inputs, seed, args);
|
|
859
|
+
}
|
|
860
|
+
catch (error) {
|
|
861
|
+
run.context.signal?.throwIfAborted();
|
|
862
|
+
return { error: error instanceof Error ? error.message : String(error), code: "game3d_capture_failed" };
|
|
863
|
+
}
|
|
864
|
+
}
|
|
735
865
|
const inputs = inputFrames(args["inputs"], Math.max(0, ...ticks));
|
|
736
866
|
if ("error" in inputs)
|
|
737
867
|
return inputs;
|
|
@@ -754,7 +884,7 @@ const generateAsset = {
|
|
|
754
884
|
const kind = args["kind"];
|
|
755
885
|
const prompt = args["prompt"];
|
|
756
886
|
const inputFile = args["input_file"];
|
|
757
|
-
if (!user || typeof id !== "string" || typeof slot !== "string" || !slot || !["image", "audio", "music", "sfx", "font"].includes(String(kind))) {
|
|
887
|
+
if (!user || typeof id !== "string" || typeof slot !== "string" || !slot || !["image", "audio", "music", "sfx", "font", "model", "collider"].includes(String(kind))) {
|
|
758
888
|
return { error: "game_id, slot, and kind are required" };
|
|
759
889
|
}
|
|
760
890
|
if (inputFile !== undefined && (typeof inputFile !== "string" || !inputFile.trim())) {
|
|
@@ -772,6 +902,21 @@ const generateAsset = {
|
|
|
772
902
|
if (!draft) {
|
|
773
903
|
return { error: "Game draft not found" };
|
|
774
904
|
}
|
|
905
|
+
if (kind === "model" || kind === "collider") {
|
|
906
|
+
if (draft.document.schemaVersion !== 3) {
|
|
907
|
+
return { error: "Model and collider assets require a 3D game" };
|
|
908
|
+
}
|
|
909
|
+
try {
|
|
910
|
+
return await stageModelGameAsset3D(run, game, workspace, draft.document, args);
|
|
911
|
+
}
|
|
912
|
+
catch (error) {
|
|
913
|
+
run.context.signal?.throwIfAborted();
|
|
914
|
+
return { error: error instanceof Error ? error.message : String(error) };
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
if (draft.document.schemaVersion === 3 && kind === "image") {
|
|
918
|
+
return { error: "3D games use model assets with embedded textures" };
|
|
919
|
+
}
|
|
775
920
|
const reference = typeof args["reference_slot"] === "string" ? draft.document.assets[args["reference_slot"]] : undefined;
|
|
776
921
|
if (args["reference_slot"] !== undefined && !reference) {
|
|
777
922
|
return { error: "reference_slot is not bound" };
|
|
@@ -791,7 +936,7 @@ const generateAsset = {
|
|
|
791
936
|
let provider = args["provider"];
|
|
792
937
|
let model = args["model"];
|
|
793
938
|
let generated = {};
|
|
794
|
-
let sourceBytes
|
|
939
|
+
let sourceBytes;
|
|
795
940
|
const makeLut = settings?.success && settings.data.lut !== undefined;
|
|
796
941
|
if (makeLut && (inputFile !== undefined || reference || args["generation_id"] !== undefined)) {
|
|
797
942
|
return { error: "LUT preparation creates a color cube directly and cannot use input_file, reference_slot or generation_id" };
|
|
@@ -908,7 +1053,7 @@ const generateAsset = {
|
|
|
908
1053
|
let height = 1;
|
|
909
1054
|
const previous = draft.document.assets[slot];
|
|
910
1055
|
const binding = {
|
|
911
|
-
width, height, pivot: previous
|
|
1056
|
+
width, height, pivot: previous && "pivot" in previous ? previous.pivot : { x: 0.5, y: 0.5 }, sampling: previous && "sampling" in previous ? previous.sampling : "nearest"
|
|
912
1057
|
};
|
|
913
1058
|
let frames;
|
|
914
1059
|
let tiles;
|
|
@@ -982,6 +1127,18 @@ const generateAsset = {
|
|
|
982
1127
|
binding.provenance = typeof inputFile === "string" ? `import:${inputFile}`
|
|
983
1128
|
: makeLut ? "generated:color-cube" : kind === "sfx" ? `node:${args["node_type"]}` : `${provider}:${model}:${generated.generation_id ?? ""}`;
|
|
984
1129
|
}
|
|
1130
|
+
if (draft.document.schemaVersion === 3) {
|
|
1131
|
+
delete binding.width;
|
|
1132
|
+
delete binding.height;
|
|
1133
|
+
delete binding.pivot;
|
|
1134
|
+
delete binding.sampling;
|
|
1135
|
+
const parsedBinding = gameAssetBinding3D.safeParse(binding);
|
|
1136
|
+
if (!parsedBinding.success) {
|
|
1137
|
+
return { error: "Invalid 3D asset binding", diagnostics: parsedBinding.error.issues };
|
|
1138
|
+
}
|
|
1139
|
+
return { game_id: shortResourceId(game.id), slot, binding: parsedBinding.data, candidate_workspace_id: game.workspace_id,
|
|
1140
|
+
draft_updated_at: draft.game.draft_updated_at, installed: false, next: "Call install_native_game_asset with this binding to install the candidate." };
|
|
1141
|
+
}
|
|
985
1142
|
const installed = await install.impl(run, { game_id: game.id, slot, binding, base_updated_at: draft.game.draft_updated_at });
|
|
986
1143
|
if (typeof installed !== "object" || installed === null) {
|
|
987
1144
|
return { generation_id: generated.generation_id, result: installed };
|
|
@@ -1083,8 +1240,14 @@ const buildGame = {
|
|
|
1083
1240
|
const scratch = await workspace.scratchDir();
|
|
1084
1241
|
const staging = await mkdtemp(join(scratch, ".native-game-build-"));
|
|
1085
1242
|
try {
|
|
1086
|
-
|
|
1087
|
-
|
|
1243
|
+
if (document.schemaVersion === 3) {
|
|
1244
|
+
const { buildStandaloneGame3D } = await import("@nodetool-ai/game-renderer/build3d");
|
|
1245
|
+
await buildStandaloneGame3D({ document, outputDir: join(staging, "player"), resolveAsset, signal: run.context.signal });
|
|
1246
|
+
}
|
|
1247
|
+
else {
|
|
1248
|
+
const { buildStandaloneGame } = await import("@nodetool-ai/game-renderer/build");
|
|
1249
|
+
await buildStandaloneGame({ document, outputDir: join(staging, "player"), resolveAsset });
|
|
1250
|
+
}
|
|
1088
1251
|
const files = [];
|
|
1089
1252
|
const pending = [""];
|
|
1090
1253
|
let totalBytes = 0;
|
|
@@ -1120,7 +1283,9 @@ const buildGame = {
|
|
|
1120
1283
|
: file.path.endsWith(".mp3") ? "audio/mpeg"
|
|
1121
1284
|
: file.path.endsWith(".ttf") ? "font/ttf"
|
|
1122
1285
|
: file.path.endsWith(".otf") ? "font/otf"
|
|
1123
|
-
: "
|
|
1286
|
+
: file.path.endsWith(".glb") ? "model/gltf-binary"
|
|
1287
|
+
: file.path.endsWith(".wasm") ? "application/wasm"
|
|
1288
|
+
: "application/octet-stream";
|
|
1124
1289
|
await workspace.write(`${buildPath}/${file.path}`, file.bytes, contentType);
|
|
1125
1290
|
}
|
|
1126
1291
|
const index = files.find((file) => file.path === "index.html");
|
|
@@ -1193,7 +1358,7 @@ const installExample = {
|
|
|
1193
1358
|
return { error: "Example game not found" };
|
|
1194
1359
|
const installed = await installExampleGameAssets(user, projectId, {}, slug, storage);
|
|
1195
1360
|
try {
|
|
1196
|
-
const created = await createNativeGame(user, projectId, typeof name === "string" ? name.trim() : installed.bundle.name, installed.document);
|
|
1361
|
+
const created = await createNativeGame(user, projectId, typeof name === "string" ? name.trim() : installed.bundle.name, installed.document, installed.document.schemaVersion === 3 ? "3d" : "2d");
|
|
1197
1362
|
if ("error" in created) {
|
|
1198
1363
|
await installed.rollback();
|
|
1199
1364
|
return created;
|
|
@@ -1222,6 +1387,9 @@ const autoplay = {
|
|
|
1222
1387
|
const document = await readSource(workspace, game, args["source"], args["revision"]);
|
|
1223
1388
|
if (!document)
|
|
1224
1389
|
return { error: "Game source not found" };
|
|
1390
|
+
if (document.schemaVersion === 3) {
|
|
1391
|
+
return { status: "unsupported", dimension: "3d", code: "autoplay_3d_unsupported", message: "Use playtest_native_game with a recorded 3D route" };
|
|
1392
|
+
}
|
|
1225
1393
|
const targetPrefix = args["target_prefix"];
|
|
1226
1394
|
const playerId = args["player_id"];
|
|
1227
1395
|
const win = args["win"];
|
|
@@ -1257,6 +1425,8 @@ const autoplay = {
|
|
|
1257
1425
|
};
|
|
1258
1426
|
export const module = {
|
|
1259
1427
|
module: "game",
|
|
1260
|
-
exports: [create, get, save, install, playtest, buildGame, edit, capture, generateAsset, listExamples, getExample, installExample, autoplay
|
|
1428
|
+
exports: [create, get, save, install, playtest, buildGame, edit, capture, generateAsset, listExamples, getExample, installExample, autoplay,
|
|
1429
|
+
{ spec: previewGameAuthoringSpec, impl: previewGameAuthoring },
|
|
1430
|
+
{ spec: applyGameAuthoringSpec, impl: applyGameAuthoring }]
|
|
1261
1431
|
};
|
|
1262
1432
|
//# sourceMappingURL=game.js.map
|