@seriousgaming/sdk-tools 0.0.0-stage → 1.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +93 -0
- package/README.md +36 -2
- package/dist/bundling/logic-exports.d.ts +34 -0
- package/dist/bundling/node-builtins.d.ts +21 -0
- package/dist/bundling/transpiler.d.ts +7 -0
- package/dist/cli.js +27368 -0
- package/dist/client/dev-server.d.ts +59 -0
- package/dist/client/index.d.ts +28 -0
- package/dist/client/stub-services.d.ts +32 -0
- package/dist/client/test-session.d.ts +195 -0
- package/dist/client.js +16884 -0
- package/dist/core/asset-reference-translator.d.ts +46 -0
- package/dist/core/clock.d.ts +57 -0
- package/dist/core/faults.d.ts +65 -0
- package/dist/core/game-settings.d.ts +65 -0
- package/dist/core/history.d.ts +89 -0
- package/dist/core/listen-with-fallback.d.ts +30 -0
- package/dist/core/mutation-queue.d.ts +61 -0
- package/dist/core/package-scenario.d.ts +89 -0
- package/dist/core/participant-registry.d.ts +109 -0
- package/dist/core/pending-changes.d.ts +14 -0
- package/dist/core/protocol.d.ts +83 -0
- package/dist/core/scenario-drafts.d.ts +32 -0
- package/dist/core/session-endpoints.d.ts +108 -0
- package/dist/core/session-gates.d.ts +75 -0
- package/dist/core/session-host.d.ts +94 -0
- package/dist/core/session-refusals.d.ts +56 -0
- package/dist/core/session-rewind.d.ts +32 -0
- package/dist/core/session-roster.d.ts +128 -0
- package/dist/core/session-surfaces.d.ts +32 -0
- package/dist/core/session-ticks.d.ts +18 -0
- package/dist/core/session-timers.d.ts +84 -0
- package/dist/core/session-writes.d.ts +40 -0
- package/dist/core/session.d.ts +385 -0
- package/dist/core/settings-locks.d.ts +22 -0
- package/dist/core/team-names.d.ts +52 -0
- package/dist/core/team-state-store.d.ts +209 -0
- package/dist/core/tick-timer.d.ts +75 -0
- package/dist/dev/blob-links.d.ts +10 -0
- package/dist/dev/console/assets/index-DgFglsnA.js +204 -0
- package/dist/dev/console/index.html +12 -0
- package/dist/dev/console-path.d.ts +19 -0
- package/dist/dev/lockfile.d.ts +124 -0
- package/dist/dev/package-watcher.d.ts +21 -0
- package/dist/dev/routes.d.ts +67 -0
- package/dist/dev/shell.d.ts +260 -0
- package/dist/dev/surfaces.d.ts +41 -0
- package/dist/dev/tools-identity.d.ts +23 -0
- package/dist/dev/view/batch.d.ts +172 -0
- package/dist/dev/view/commands.d.ts +75 -0
- package/dist/dev/view/route.d.ts +58 -0
- package/dist/dev/view/view.d.ts +78 -0
- package/dist/dev/view/viewer.d.ts +32 -0
- package/dist/discovery/config.d.ts +9 -0
- package/dist/discovery/manifest-paths.d.ts +21 -0
- package/dist/discovery/removed-fields.d.ts +90 -0
- package/dist/docs/api/deck.md +386 -0
- package/dist/docs/api/index.md +67 -0
- package/dist/docs/api/sdk-commands.md +286 -0
- package/dist/docs/api/sdk-e2e.md +433 -0
- package/dist/docs/api/sdk-projection.md +207 -0
- package/dist/docs/api/sdk-testing.md +214 -0
- package/dist/docs/api/sdk-tools-client.md +560 -0
- package/dist/docs/api/sdk-ui-testing.md +231 -0
- package/dist/docs/api/sdk-ui.md +1269 -0
- package/dist/docs/api/sdk.md +2140 -0
- package/dist/docs/changelog-0.x.md +1156 -0
- package/dist/docs/changelog.md +236 -0
- package/dist/docs/cli-and-dev-server.md +217 -0
- package/dist/docs/cli-error-codes.md +154 -0
- package/dist/docs/cli-reference.md +2488 -0
- package/dist/docs/cli-simulation-testing.md +222 -0
- package/dist/docs/concepts/index.md +46 -0
- package/dist/docs/concepts/terminology.md +322 -0
- package/dist/docs/environment-variables.md +102 -0
- package/dist/docs/getting-started.md +145 -0
- package/dist/docs/guides/ai-facilitation.md +220 -0
- package/dist/docs/guides/capabilities.md +460 -0
- package/dist/docs/guides/endpoints.md +335 -0
- package/dist/docs/guides/engine-testing.md +477 -0
- package/dist/docs/guides/engine.md +527 -0
- package/dist/docs/guides/file-handling.md +405 -0
- package/dist/docs/guides/games.md +176 -0
- package/dist/docs/guides/global-settings.md +94 -0
- package/dist/docs/guides/guide.md +123 -0
- package/dist/docs/guides/hooks.md +183 -0
- package/dist/docs/guides/index.md +51 -0
- package/dist/docs/guides/internationalization.md +288 -0
- package/dist/docs/guides/llm-integration.md +635 -0
- package/dist/docs/guides/multi-team-games.md +586 -0
- package/dist/docs/guides/patterns.md +391 -0
- package/dist/docs/guides/presentation.md +196 -0
- package/dist/docs/guides/production-constraints.md +130 -0
- package/dist/docs/guides/scenario-editor.md +143 -0
- package/dist/docs/guides/scenarios.md +515 -0
- package/dist/docs/guides/session.md +972 -0
- package/dist/docs/guides/settings.md +458 -0
- package/dist/docs/guides/setup.md +193 -0
- package/dist/docs/guides/speech-generation.md +233 -0
- package/dist/docs/guides/starter-game.md +164 -0
- package/dist/docs/guides/testing.md +575 -0
- package/dist/docs/guides/tick-controller.md +569 -0
- package/dist/docs/guides/type-safety.md +516 -0
- package/dist/docs/guides/ui.md +1389 -0
- package/dist/docs/guides/upgrading.md +636 -0
- package/dist/docs/guides/validators.md +217 -0
- package/dist/docs/guides/waiting-room.md +244 -0
- package/dist/docs/index.md +41 -0
- package/dist/docs/recipes/act-on-the-session-from-an-endpoint.md +95 -0
- package/dist/docs/recipes/adapt-a-game-for-walkthroughs.md +133 -0
- package/dist/docs/recipes/adapt-ui-for-observers.md +74 -0
- package/dist/docs/recipes/call-endpoint-from-ui.md +109 -0
- package/dist/docs/recipes/check-a-package-from-a-script.md +117 -0
- package/dist/docs/recipes/create-capability.md +66 -0
- package/dist/docs/recipes/create-endpoint.md +127 -0
- package/dist/docs/recipes/create-engine.md +111 -0
- package/dist/docs/recipes/create-game.md +70 -0
- package/dist/docs/recipes/create-guide.md +75 -0
- package/dist/docs/recipes/create-hook.md +80 -0
- package/dist/docs/recipes/create-presentation.md +142 -0
- package/dist/docs/recipes/create-scenario-editor.md +102 -0
- package/dist/docs/recipes/create-scenario.md +98 -0
- package/dist/docs/recipes/create-session-ui.md +116 -0
- package/dist/docs/recipes/create-settings.md +88 -0
- package/dist/docs/recipes/create-setup.md +115 -0
- package/dist/docs/recipes/create-tick-controller.md +65 -0
- package/dist/docs/recipes/create-user-interface.md +96 -0
- package/dist/docs/recipes/create-validator.md +67 -0
- package/dist/docs/recipes/create-waiting-room-ui.md +109 -0
- package/dist/docs/recipes/declare-api-uses.md +67 -0
- package/dist/docs/recipes/design-state-for-concurrent-writes.md +96 -0
- package/dist/docs/recipes/distribute-package.md +80 -0
- package/dist/docs/recipes/e2e-testing.md +116 -0
- package/dist/docs/recipes/end-game-on-condition.md +154 -0
- package/dist/docs/recipes/fix-duplicate-packages.md +101 -0
- package/dist/docs/recipes/index.md +86 -0
- package/dist/docs/recipes/make-an-endpoint-external.md +101 -0
- package/dist/docs/recipes/negotiate-across-teams.md +164 -0
- package/dist/docs/recipes/observe-other-teams-state.md +119 -0
- package/dist/docs/recipes/publish-a-package.md +139 -0
- package/dist/docs/recipes/remember-a-viewers-choice.md +55 -0
- package/dist/docs/recipes/review-a-past-day.md +73 -0
- package/dist/docs/recipes/share-assets-across-scenarios.md +120 -0
- package/dist/docs/recipes/share-logic-between-engine-and-ui.md +130 -0
- package/dist/docs/recipes/show-all-teams-participants.md +109 -0
- package/dist/docs/recipes/start-from-an-empty-package.md +169 -0
- package/dist/docs/recipes/take-a-file-in-an-endpoint.md +82 -0
- package/dist/docs/recipes/test-a-multi-role-game.md +51 -0
- package/dist/docs/recipes/test-user-interface.md +95 -0
- package/dist/docs/recipes/test-with-engine.md +115 -0
- package/dist/docs/recipes/upload-and-display-files.md +148 -0
- package/dist/docs/recipes/use-request-play.md +65 -0
- package/dist/docs/recipes/use-request-tick.md +75 -0
- package/dist/docs/troubleshooting.md +816 -0
- package/dist/execution/blob-inputs.d.ts +57 -0
- package/dist/execution/bundle-reload.d.ts +42 -0
- package/dist/execution/config-resolver.d.ts +127 -0
- package/dist/execution/configuration-builder.d.ts +66 -0
- package/dist/execution/context-composition.d.ts +161 -0
- package/dist/execution/endpoint-actions.d.ts +9 -0
- package/dist/execution/endpoint-payloads.d.ts +32 -0
- package/dist/execution/endpoint-runner.d.ts +129 -0
- package/dist/execution/engine-state.d.ts +40 -0
- package/dist/execution/executor-callbacks.d.ts +56 -0
- package/dist/execution/executor.d.ts +436 -0
- package/dist/execution/gates.d.ts +45 -0
- package/dist/execution/hook-chain.d.ts +25 -0
- package/dist/execution/logic-calls.d.ts +190 -0
- package/dist/execution/logic-failure.d.ts +84 -0
- package/dist/execution/logic-loader.d.ts +54 -0
- package/dist/execution/logic-result.d.ts +76 -0
- package/dist/execution/tick-controller-call.d.ts +32 -0
- package/dist/execution/types.d.ts +48 -0
- package/dist/generation/ts-type.d.ts +39 -0
- package/dist/guide/locale.d.ts +12 -0
- package/dist/guide/video-registry.d.ts +42 -0
- package/dist/help-examples.d.ts +125 -0
- package/dist/host/adapter.d.ts +67 -0
- package/dist/host/host-channel.d.ts +222 -0
- package/dist/host/index.d.ts +20 -0
- package/dist/host/protocol.d.ts +783 -0
- package/dist/host/surfaces.d.ts +42 -0
- package/dist/host/theme.d.ts +55 -0
- package/dist/host.js +583 -0
- package/dist/prompts/index.d.ts +7 -0
- package/dist/prompts/schema-builder.d.ts +29 -0
- package/dist/prompts/types.d.ts +108 -0
- package/dist/prompts/validators.d.ts +32 -0
- package/dist/runtime/capability-scope.d.ts +6 -0
- package/dist/runtime/context-merge.d.ts +29 -0
- package/dist/runtime/context-projection.d.ts +41 -0
- package/dist/runtime/guarded-callbacks.d.ts +15 -0
- package/dist/runtime/index.d.ts +27 -0
- package/dist/runtime/manifest-version.d.ts +55 -0
- package/dist/runtime/tick-validation.d.ts +25 -0
- package/dist/runtime.js +346 -0
- package/dist/schema.json +1546 -0
- package/dist/server/vite-plugin.d.ts +46 -0
- package/dist/services/tts/client.d.ts +51 -0
- package/dist/services/tts/elevenlabs.d.ts +24 -0
- package/dist/services/tts/types.d.ts +44 -0
- package/dist/storage/asset-resolver.d.ts +49 -0
- package/dist/storage/blob-store.d.ts +41 -0
- package/dist/templates/endpoint/logic.test.ts.liquid +61 -0
- package/dist/templates/endpoint/logic.ts.liquid +25 -0
- package/dist/templates/engine/init.json.liquid +7 -0
- package/dist/templates/engine/logic-aggregate.test.ts.liquid +90 -0
- package/dist/templates/engine/logic-aggregate.ts.liquid +46 -0
- package/dist/templates/engine/logic.test.ts.liquid +61 -0
- package/dist/templates/engine/logic.ts.liquid +32 -0
- package/dist/templates/engine/run.json.liquid +7 -0
- package/dist/templates/guide/01-at-a-glance.md.liquid +19 -0
- package/dist/templates/guide/02-preparation.md.liquid +18 -0
- package/dist/templates/guide/03-running-the-session.md.liquid +37 -0
- package/dist/templates/hook/logic.test.ts.liquid +46 -0
- package/dist/templates/hook/logic.ts.liquid +12 -0
- package/dist/templates/package/CLAUDE.md.template +338 -0
- package/dist/templates/package/DESIGN.md.liquid +144 -0
- package/dist/templates/package/README.md.liquid +143 -0
- package/dist/templates/package/claude/rules/workflow-create-capability.md +26 -0
- package/dist/templates/package/claude/rules/workflow-create-endpoint.md +35 -0
- package/dist/templates/package/claude/rules/workflow-create-engine.md +35 -0
- package/dist/templates/package/claude/rules/workflow-create-guide.md +40 -0
- package/dist/templates/package/claude/rules/workflow-create-presentation.md +37 -0
- package/dist/templates/package/claude/rules/workflow-create-user-interface.md +31 -0
- package/dist/templates/package/claude/rules/workflow-publish-package.md +54 -0
- package/dist/templates/package/claude/rules/workflow-test-engine-or-ui.md +30 -0
- package/dist/templates/package/claude/rules/workflow-update-sdk-version.md +43 -0
- package/dist/templates/package/claude/settings.json.template +16 -0
- package/dist/templates/package/gitignore.template +15 -0
- package/dist/templates/package/global-setup.ts.template +21 -0
- package/dist/templates/package/globals.d.ts.template +2 -0
- package/dist/templates/package/oxfmtrc.json.template +14 -0
- package/dist/templates/package/oxlintrc.json.template +238 -0
- package/dist/templates/package/package.json.liquid +65 -0
- package/dist/templates/package/playwright.config.ts.liquid +19 -0
- package/dist/templates/package/pnpm-workspace.yaml.template +27 -0
- package/dist/templates/package/test-setup.ts.liquid +7 -0
- package/dist/templates/package/tsconfig.json.liquid +15 -0
- package/dist/templates/package/vite.config.ts.liquid +19 -0
- package/dist/templates/package/vitest.config.ts.liquid +25 -0
- package/dist/templates/package/vitest.engine.config.ts.liquid +12 -0
- package/dist/templates/presentation/index.html.liquid +20 -0
- package/dist/templates/presentation/src/App.tsx.liquid +49 -0
- package/dist/templates/presentation/src/Slides.tsx.liquid +81 -0
- package/dist/templates/presentation/src/i18n.ts.liquid +54 -0
- package/dist/templates/presentation/src/main.tsx.liquid +14 -0
- package/dist/templates/scenario_editor/src/App.test.tsx.liquid +30 -0
- package/dist/templates/scenario_editor/src/App.tsx.liquid +95 -0
- package/dist/templates/scenario_editor/src/i18n.ts.liquid +44 -0
- package/dist/templates/session/src/App.test.tsx.liquid +60 -0
- package/dist/templates/session/src/App.tsx.liquid +128 -0
- package/dist/templates/session/src/i18n.ts.liquid +53 -0
- package/dist/templates/session/src/main.tsx.liquid +48 -0
- package/dist/templates/session/src/theme.ts.liquid +46 -0
- package/dist/templates/settings-editor/index.html.liquid +12 -0
- package/dist/templates/settings-editor/src/main.tsx.liquid +48 -0
- package/dist/templates/settings-editor/src/theme.ts.liquid +24 -0
- package/dist/templates/setup/src/App.test.tsx.liquid +39 -0
- package/dist/templates/setup/src/App.tsx.liquid +102 -0
- package/dist/templates/setup/src/i18n.ts.liquid +47 -0
- package/dist/templates/starter-game/capabilities/briefing/capability.sdk.json +18 -0
- package/dist/templates/starter-game/capabilities/plan/capability.sdk.json +17 -0
- package/dist/templates/starter-game/capabilities/results/capability.sdk.json +61 -0
- package/dist/templates/starter-game/capabilities/roles/capability.sdk.json +17 -0
- package/dist/templates/starter-game/capabilities/weather/capability.sdk.json +23 -0
- package/dist/templates/starter-game/engine/defaults.ts +81 -0
- package/dist/templates/starter-game/engine/engine.sdk.json +12 -0
- package/dist/templates/starter-game/engine/logic.test.ts +221 -0
- package/dist/templates/starter-game/engine/logic.ts +149 -0
- package/dist/templates/starter-game/engine/test-helpers.ts +74 -0
- package/dist/templates/starter-game/engine/types.ts +139 -0
- package/dist/templates/starter-game/guide/content/en/01-at-a-glance.md +51 -0
- package/dist/templates/starter-game/guide/content/en/02-preparation.md +35 -0
- package/dist/templates/starter-game/guide/content/en/03-running-the-day.md +58 -0
- package/dist/templates/starter-game/guide/guide.sdk.json +10 -0
- package/dist/templates/starter-game/guide/guide.test.ts +108 -0
- package/dist/templates/starter-game/hooks/assignproducts/defaults.ts +37 -0
- package/dist/templates/starter-game/hooks/assignproducts/hook.sdk.json +13 -0
- package/dist/templates/starter-game/hooks/assignproducts/logic/logic.test.ts +77 -0
- package/dist/templates/starter-game/hooks/assignproducts/logic/logic.ts +47 -0
- package/dist/templates/starter-game/hooks/assignproducts/types.ts +55 -0
- package/dist/templates/starter-game/package.json +68 -0
- package/dist/templates/starter-game/playwright.config.ts +19 -0
- package/dist/templates/starter-game/scenarios/heatwave/scenario.sdk.json +20 -0
- package/dist/templates/starter-game/scenarios/ordinary_week/scenario.sdk.json +12 -0
- package/dist/templates/starter-game/seriousgaming.sdk.json +23 -0
- package/dist/templates/starter-game/session/defaults.ts +80 -0
- package/dist/templates/starter-game/session/index.html +12 -0
- package/dist/templates/starter-game/session/session.sdk.json +11 -0
- package/dist/templates/starter-game/session/src/App.test.tsx +307 -0
- package/dist/templates/starter-game/session/src/App.tsx +309 -0
- package/dist/templates/starter-game/session/src/Section.tsx +37 -0
- package/dist/templates/starter-game/session/src/TeamDoor.tsx +96 -0
- package/dist/templates/starter-game/session/src/format.ts +8 -0
- package/dist/templates/starter-game/session/src/i18n.ts +51 -0
- package/dist/templates/starter-game/session/src/main.tsx +48 -0
- package/dist/templates/starter-game/session/src/theme.ts +45 -0
- package/dist/templates/starter-game/session/types.ts +135 -0
- package/dist/templates/starter-game/settings/engine/settings.sdk.json +50 -0
- package/dist/templates/starter-game/settings/menu/settings.sdk.json +78 -0
- package/dist/templates/starter-game/settings/session/settings.sdk.json +23 -0
- package/dist/templates/starter-game/settings/ui/settings.sdk.json +25 -0
- package/dist/templates/starter-game/test-setup.ts +7 -0
- package/dist/templates/starter-game/testing/e2e/game.spec.ts +139 -0
- package/dist/templates/starter-game/testing/e2e/global-setup.ts +21 -0
- package/dist/templates/starter-game/testing/engine/game.engine.test.ts +171 -0
- package/dist/templates/starter-game/tsconfig.json +19 -0
- package/dist/templates/starter-game/ui/defaults.ts +60 -0
- package/dist/templates/starter-game/ui/index.html +12 -0
- package/dist/templates/starter-game/ui/src/App.test.tsx +138 -0
- package/dist/templates/starter-game/ui/src/App.tsx +175 -0
- package/dist/templates/starter-game/ui/src/DayBar.test.tsx +78 -0
- package/dist/templates/starter-game/ui/src/DayBar.tsx +72 -0
- package/dist/templates/starter-game/ui/src/HistoryPanel.test.tsx +74 -0
- package/dist/templates/starter-game/ui/src/HistoryPanel.tsx +120 -0
- package/dist/templates/starter-game/ui/src/MakeRow.tsx +129 -0
- package/dist/templates/starter-game/ui/src/Section.tsx +37 -0
- package/dist/templates/starter-game/ui/src/ThemeToggle.tsx +49 -0
- package/dist/templates/starter-game/ui/src/TodayPanel.test.tsx +179 -0
- package/dist/templates/starter-game/ui/src/TodayPanel.tsx +92 -0
- package/dist/templates/starter-game/ui/src/YesterdayPanel.tsx +142 -0
- package/dist/templates/starter-game/ui/src/format.ts +12 -0
- package/dist/templates/starter-game/ui/src/i18n.ts +95 -0
- package/dist/templates/starter-game/ui/src/main.tsx +48 -0
- package/dist/templates/starter-game/ui/src/menu.ts +18 -0
- package/dist/templates/starter-game/ui/src/test-helpers.ts +58 -0
- package/dist/templates/starter-game/ui/src/theme.ts +45 -0
- package/dist/templates/starter-game/ui/src/writes.ts +43 -0
- package/dist/templates/starter-game/ui/types.ts +137 -0
- package/dist/templates/starter-game/ui/ui.sdk.json +11 -0
- package/dist/templates/starter-game/validators/capacity/defaults.ts +37 -0
- package/dist/templates/starter-game/validators/capacity/logic/logic.test.ts +96 -0
- package/dist/templates/starter-game/validators/capacity/logic/logic.ts +45 -0
- package/dist/templates/starter-game/validators/capacity/types.ts +55 -0
- package/dist/templates/starter-game/validators/capacity/validator.sdk.json +11 -0
- package/dist/templates/starter-game/vite.config.ts +19 -0
- package/dist/templates/starter-game/vitest.config.ts +15 -0
- package/dist/templates/starter-game/vitest.engine.config.ts +19 -0
- package/dist/templates/starter-game/waiting_room/defaults.ts +40 -0
- package/dist/templates/starter-game/waiting_room/index.html +12 -0
- package/dist/templates/starter-game/waiting_room/src/App.test.tsx +102 -0
- package/dist/templates/starter-game/waiting_room/src/App.tsx +194 -0
- package/dist/templates/starter-game/waiting_room/src/i18n.ts +33 -0
- package/dist/templates/starter-game/waiting_room/src/main.tsx +48 -0
- package/dist/templates/starter-game/waiting_room/src/theme.ts +45 -0
- package/dist/templates/starter-game/waiting_room/types.ts +59 -0
- package/dist/templates/starter-game/waiting_room/waiting_room.sdk.json +10 -0
- package/dist/templates/tick-controller/logic.ts.liquid +8 -0
- package/dist/templates/ui/index.html.liquid +12 -0
- package/dist/templates/ui/src/App.test.tsx.liquid +41 -0
- package/dist/templates/ui/src/App.tsx.liquid +103 -0
- package/dist/templates/ui/src/i18n.ts.liquid +47 -0
- package/dist/templates/ui/src/main.tsx.liquid +48 -0
- package/dist/templates/ui/src/theme.ts.liquid +46 -0
- package/dist/templates/validator/logic.test.ts.liquid +42 -0
- package/dist/templates/validator/logic.ts.liquid +21 -0
- package/dist/templates/waiting-room/index.html.liquid +12 -0
- package/dist/templates/waiting-room/src/App.test.tsx.liquid +57 -0
- package/dist/templates/waiting-room/src/App.tsx.liquid +118 -0
- package/dist/templates/waiting-room/src/i18n.ts.liquid +44 -0
- package/dist/templates/waiting-room/src/main.tsx.liquid +48 -0
- package/dist/templates/waiting-room/src/theme.ts.liquid +46 -0
- package/dist/templating/resource-metadata.d.ts +131 -0
- package/dist/types.d.ts +14 -0
- package/dist/utils/atomic-write.d.ts +40 -0
- package/dist/utils/cli-error.d.ts +64 -0
- package/dist/utils/document-parser-client.d.ts +20 -0
- package/dist/utils/env-loader.d.ts +40 -0
- package/dist/utils/error-codes.d.ts +335 -0
- package/dist/utils/errors.d.ts +19 -0
- package/dist/utils/global-settings.d.ts +65 -0
- package/dist/utils/llm-client.d.ts +34 -0
- package/dist/utils/logger.d.ts +36 -0
- package/dist/utils/output.d.ts +109 -0
- package/dist/utils/platform.d.ts +14 -0
- package/dist/utils/prompt.d.ts +36 -0
- package/dist/utils/real-path.d.ts +6 -0
- package/dist/utils/schema-properties.d.ts +35 -0
- package/dist/validation/ajv.d.ts +17 -0
- package/dist/validation/facilitator-guide-validator.d.ts +27 -0
- package/dist/validation/findings.d.ts +40 -0
- package/dist/validation/game-constraints.d.ts +10 -0
- package/dist/validation/game-validator.d.ts +34 -0
- package/dist/validation/package-validation.d.ts +41 -0
- package/dist/validation/package-validator.d.ts +19 -0
- package/dist/validation/resource-validator.d.ts +79 -0
- package/dist/validation/schema-defaults-validator.d.ts +29 -0
- package/dist/validation/schema-validation.d.ts +115 -0
- package/dist/validation/semver.d.ts +9 -0
- package/package.json +122 -3
|
@@ -0,0 +1,2140 @@
|
|
|
1
|
+
<!-- Generated by `pnpm docs:generate` from the exports of `@seriousgaming/sdk`. Edit those, not this file. -->
|
|
2
|
+
|
|
3
|
+
# `@seriousgaming/sdk`
|
|
4
|
+
|
|
5
|
+
Every export of `@seriousgaming/sdk`, with the declaration it is published with. Anything tagged `@internal` is left out: it ships in the declarations, but is not part of the supported API and may change without a major release. For how the pieces fit together, see the [API reference](./index.md) and the guides it links to.
|
|
6
|
+
|
|
7
|
+
## Functions
|
|
8
|
+
|
|
9
|
+
### decodeUtf8
|
|
10
|
+
|
|
11
|
+
Decode a UTF-8 byte sequence to a string.
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
function decodeUtf8(bytes: Uint8Array): string;
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### deriveSeed
|
|
18
|
+
|
|
19
|
+
Derive a stable seed from a session seed and whatever identifies the thing being seeded.
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
function deriveSeed(...parts: (string | number)[]): string;
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### encodeUtf8
|
|
26
|
+
|
|
27
|
+
Encode a string to its UTF-8 byte sequence.
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
function encodeUtf8(input: string): Uint8Array;
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### getText
|
|
34
|
+
|
|
35
|
+
Helper for the common case where a caller just wants the assistant's text. Returns the concatenation of every `text` block in the response; `toolUse` blocks are skipped.
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
function getText(response: LLMResponse): string;
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### intervalTick
|
|
42
|
+
|
|
43
|
+
Convenience builder that creates a `TickControllerResult` for interval-based (cadence) ticking — the sanctioned way to return an interval result.
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
function intervalTick(
|
|
47
|
+
intervalMs: number,
|
|
48
|
+
options?: {
|
|
49
|
+
complete?: boolean;
|
|
50
|
+
}
|
|
51
|
+
): TickControllerResult;
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### nextDailyAt
|
|
55
|
+
|
|
56
|
+
Compute the next occurrence of a daily time.
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
function nextDailyAt(hours: number, minutes: number, options?: ScheduleOptions): number;
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### nextDailyFromSchedule
|
|
63
|
+
|
|
64
|
+
Pick the soonest future time from a list of daily times.
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
function nextDailyFromSchedule(
|
|
68
|
+
times: Array<{
|
|
69
|
+
hours: number;
|
|
70
|
+
minutes: number;
|
|
71
|
+
}>,
|
|
72
|
+
options?: ScheduleOptions
|
|
73
|
+
): number;
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### nextWeeklyAt
|
|
77
|
+
|
|
78
|
+
Compute the next occurrence of a weekly time.
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
function nextWeeklyAt(
|
|
82
|
+
dayOfWeek: number,
|
|
83
|
+
hours: number,
|
|
84
|
+
minutes: number,
|
|
85
|
+
options?: ScheduleOptions
|
|
86
|
+
): number;
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### scheduledTick
|
|
90
|
+
|
|
91
|
+
Convenience builder that creates a `TickControllerResult` for scheduled (absolute-time) ticking.
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
function scheduledTick(
|
|
95
|
+
nextTickAt: number,
|
|
96
|
+
options?: {
|
|
97
|
+
complete?: boolean;
|
|
98
|
+
}
|
|
99
|
+
): TickControllerResult;
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### seededRandom
|
|
103
|
+
|
|
104
|
+
A seeded pseudo-random generator: call it for the next value in `[0, 1)`, like `Math.random()`.
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
function seededRandom(seed: string): () => number;
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Classes
|
|
111
|
+
|
|
112
|
+
### EndpointError
|
|
113
|
+
|
|
114
|
+
Error a surface's endpoint call (`callbacks.endpoints.<id>(request)`) rejects with. Inspect `outcome` (or the shorthand `kind`) for why, and `applied` for what had already changed.
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
class EndpointError extends Error {
|
|
118
|
+
readonly outcome: EndpointFailureOutcome;
|
|
119
|
+
readonly applied: EffectStep[];
|
|
120
|
+
readonly failedStep?: EffectStep;
|
|
121
|
+
constructor(failure: EndpointFailure);
|
|
122
|
+
get kind(): EndpointFailureOutcome['kind'];
|
|
123
|
+
get failure(): EndpointFailure;
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### UndeclaredApiUseError
|
|
128
|
+
|
|
129
|
+
Error thrown when a resource invokes a callback it did not declare in its bundle's `uses` array. Carries the offending resource identifier and the callback name so a runtime can surface both to the operator.
|
|
130
|
+
|
|
131
|
+
```ts
|
|
132
|
+
class UndeclaredApiUseError extends Error {
|
|
133
|
+
readonly resourceIdentifier: string;
|
|
134
|
+
readonly api: ApiUse;
|
|
135
|
+
constructor(resourceIdentifier: string, api: ApiUse);
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Interfaces
|
|
140
|
+
|
|
141
|
+
### AggregateFunctionShared
|
|
142
|
+
|
|
143
|
+
The session's shared store, as an aggregate function sees it: one value per shared-scope capability the engine declared, whatever the number of teams.
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
interface AggregateFunctionShared<TSharedContext, TSharedState = never> {
|
|
147
|
+
context: TSharedContext;
|
|
148
|
+
state?: TSharedState;
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### AggregateFunctionTeam
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
interface AggregateFunctionTeam<TTeamContext, TTeamState = never> {
|
|
156
|
+
teamId: string;
|
|
157
|
+
index: number;
|
|
158
|
+
context: TTeamContext;
|
|
159
|
+
state?: TTeamState;
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### CapabilityDefinition
|
|
164
|
+
|
|
165
|
+
Definition of a capability
|
|
166
|
+
|
|
167
|
+
```ts
|
|
168
|
+
interface CapabilityDefinition {
|
|
169
|
+
identifier: string;
|
|
170
|
+
variablesSchema: {
|
|
171
|
+
[k: string]: unknown;
|
|
172
|
+
};
|
|
173
|
+
scope?: 'team' | 'team-readable' | 'shared' | 'private';
|
|
174
|
+
lifetime?: 'tick' | 'session';
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### EndpointBaseArgs
|
|
179
|
+
|
|
180
|
+
The arguments every endpoint receives, whatever its scope.
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
interface EndpointBaseArgs<
|
|
184
|
+
TRequest,
|
|
185
|
+
TContext,
|
|
186
|
+
TCallbacks = SignatureCallbacks,
|
|
187
|
+
TSettings = Record<string, never>,
|
|
188
|
+
> {
|
|
189
|
+
request: TRequest;
|
|
190
|
+
context: TContext;
|
|
191
|
+
callbacks: TCallbacks;
|
|
192
|
+
caller: EndpointCaller;
|
|
193
|
+
settings: TSettings;
|
|
194
|
+
meta: LogicMeta;
|
|
195
|
+
participants: readonly Readonly<Participant>[];
|
|
196
|
+
session: EndpointSession;
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### EndpointCaller
|
|
201
|
+
|
|
202
|
+
Host-issued identity of the caller invoking an endpoint. Every field is set by the host from session bookkeeping — iframe-supplied values are never part of the trust chain.
|
|
203
|
+
|
|
204
|
+
```ts
|
|
205
|
+
interface EndpointCaller {
|
|
206
|
+
sessionId?: string;
|
|
207
|
+
teamId?: string;
|
|
208
|
+
playerId?: string;
|
|
209
|
+
role: EndpointCallerRole;
|
|
210
|
+
userInterfaceIdentifier?: string;
|
|
211
|
+
principal?: EndpointPrincipal;
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### EndpointDefinition
|
|
216
|
+
|
|
217
|
+
Definition of an endpoint — a named, server-side handler that user interfaces, and callers outside the game when its visibility is external, invoke by identifier. Endpoints validate structured requests and responses against declared schemas, and operate strictly within the bounds of their declared `reads`, `writes` and `uses`.
|
|
218
|
+
|
|
219
|
+
```ts
|
|
220
|
+
interface EndpointDefinition {
|
|
221
|
+
identifier: string;
|
|
222
|
+
displayName?: string;
|
|
223
|
+
description?: string;
|
|
224
|
+
scope?: 'session' | 'team';
|
|
225
|
+
requestSchema: {
|
|
226
|
+
[k: string]: unknown;
|
|
227
|
+
};
|
|
228
|
+
responseSchema: {
|
|
229
|
+
[k: string]: unknown;
|
|
230
|
+
};
|
|
231
|
+
reads?: string[];
|
|
232
|
+
settings?: string[];
|
|
233
|
+
writes?: string[];
|
|
234
|
+
uses?: ApiUse[];
|
|
235
|
+
actions?: EndpointActionType[];
|
|
236
|
+
responds?: boolean;
|
|
237
|
+
roster?: boolean;
|
|
238
|
+
visibility?: 'internal' | 'external';
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### EndpointFailure
|
|
243
|
+
|
|
244
|
+
A failed endpoint call, itemised so a caller can tell 'nothing happened' from 'the writes landed, then an action failed'.
|
|
245
|
+
|
|
246
|
+
```ts
|
|
247
|
+
interface EndpointFailure {
|
|
248
|
+
outcome: EndpointFailureOutcome;
|
|
249
|
+
applied: EffectStep[];
|
|
250
|
+
failedStep?: EffectStep;
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### EndpointOutcome
|
|
255
|
+
|
|
256
|
+
What one of `Plan`'s actions came to, for `Respond`.
|
|
257
|
+
|
|
258
|
+
```ts
|
|
259
|
+
interface EndpointOutcome {
|
|
260
|
+
type: EndpointActionType;
|
|
261
|
+
committedAtTick?: number;
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### EndpointPrincipal
|
|
266
|
+
|
|
267
|
+
The host's account of who made an `external` call.
|
|
268
|
+
|
|
269
|
+
```ts
|
|
270
|
+
interface EndpointPrincipal {
|
|
271
|
+
kind: string;
|
|
272
|
+
id: string;
|
|
273
|
+
name?: string;
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### EndpointResult
|
|
278
|
+
|
|
279
|
+
What an endpoint that declares `actions`, or a session-scoped endpoint that writes team capabilities, returns.
|
|
280
|
+
|
|
281
|
+
```ts
|
|
282
|
+
interface EndpointResult<
|
|
283
|
+
TResponse,
|
|
284
|
+
TWrites = never,
|
|
285
|
+
TAction extends EndpointAction = never,
|
|
286
|
+
TTeamWrites = never,
|
|
287
|
+
> {
|
|
288
|
+
response: TResponse;
|
|
289
|
+
capabilities?: TWrites;
|
|
290
|
+
deletes?: ContextDeletePath[];
|
|
291
|
+
teams?: Record<string, TTeamWrites>;
|
|
292
|
+
actions?: TAction[];
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### EndpointSession
|
|
297
|
+
|
|
298
|
+
Where the session stands when an endpoint is called.
|
|
299
|
+
|
|
300
|
+
```ts
|
|
301
|
+
interface EndpointSession {
|
|
302
|
+
mode: SessionMode;
|
|
303
|
+
completedTicks: number;
|
|
304
|
+
maxTicks: number | null;
|
|
305
|
+
waitingRoomOpen: boolean;
|
|
306
|
+
complete: boolean;
|
|
307
|
+
teams: EndpointTeamStatus[];
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### EndpointTeamEntry
|
|
312
|
+
|
|
313
|
+
One team's values, for a session-scoped endpoint.
|
|
314
|
+
|
|
315
|
+
```ts
|
|
316
|
+
interface EndpointTeamEntry<TContext> extends TeamInfo {
|
|
317
|
+
context: TContext;
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### EndpointTeamStatus
|
|
322
|
+
|
|
323
|
+
One team's standing, for `EndpointSession`.
|
|
324
|
+
|
|
325
|
+
```ts
|
|
326
|
+
interface EndpointTeamStatus extends TeamInfo {
|
|
327
|
+
completedTicks: number;
|
|
328
|
+
complete: boolean;
|
|
329
|
+
timer: TimerState | null;
|
|
330
|
+
participants?: Participant[];
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### EndpointWriteResult
|
|
335
|
+
|
|
336
|
+
What an endpoint that declares `writes` returns: the response its caller receives, and the state it changes.
|
|
337
|
+
|
|
338
|
+
```ts
|
|
339
|
+
interface EndpointWriteResult<TResponse, TWrites> {
|
|
340
|
+
response: TResponse;
|
|
341
|
+
capabilities: TWrites;
|
|
342
|
+
deletes?: ContextDeletePath[];
|
|
343
|
+
}
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### EngineDefinition
|
|
347
|
+
|
|
348
|
+
Definition of a game's engine: the logic that computes each tick
|
|
349
|
+
|
|
350
|
+
```ts
|
|
351
|
+
interface EngineDefinition {
|
|
352
|
+
identifier: string;
|
|
353
|
+
reads?: string[];
|
|
354
|
+
writes?: string[];
|
|
355
|
+
uses?: ApiUse[];
|
|
356
|
+
settings?: string[];
|
|
357
|
+
aggregate?: boolean;
|
|
358
|
+
}
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
### EngineFunctionArgs
|
|
362
|
+
|
|
363
|
+
The arguments of the engine's own functions: everything logic receives, plus the engine's private memory.
|
|
364
|
+
|
|
365
|
+
```ts
|
|
366
|
+
interface EngineFunctionArgs<
|
|
367
|
+
TContext,
|
|
368
|
+
TSettings,
|
|
369
|
+
TCallbacks = SignatureCallbacks,
|
|
370
|
+
TState = never,
|
|
371
|
+
> extends LogicFunctionArgs<TContext, TSettings, TCallbacks> {
|
|
372
|
+
state?: TState;
|
|
373
|
+
}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### EngineResult
|
|
377
|
+
|
|
378
|
+
What the engine's `Init` and `Run` return: the capabilities they write and, optionally, the engine's private memory.
|
|
379
|
+
|
|
380
|
+
```ts
|
|
381
|
+
interface EngineResult<TContext, TState = never> extends LogicResult<TContext> {
|
|
382
|
+
state?: TState;
|
|
383
|
+
}
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
### ExtractTextResponse
|
|
387
|
+
|
|
388
|
+
Response from extracting text from a document
|
|
389
|
+
|
|
390
|
+
```ts
|
|
391
|
+
interface ExtractTextResponse {
|
|
392
|
+
content: string;
|
|
393
|
+
mimeType: string;
|
|
394
|
+
}
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
### FacilitatorGuideDefinition
|
|
398
|
+
|
|
399
|
+
Definition of a facilitator guide — bundled markdown content rendered natively by the host on the facilitator's page
|
|
400
|
+
|
|
401
|
+
```ts
|
|
402
|
+
interface FacilitatorGuideDefinition {
|
|
403
|
+
identifier: string;
|
|
404
|
+
locales: {
|
|
405
|
+
[k: string]: {
|
|
406
|
+
name: string;
|
|
407
|
+
};
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### GameDefinition
|
|
413
|
+
|
|
414
|
+
Definition of a game with internationalization support
|
|
415
|
+
|
|
416
|
+
```ts
|
|
417
|
+
interface GameDefinition {
|
|
418
|
+
identifier: string;
|
|
419
|
+
supportedLocales: GameSupportedLocales;
|
|
420
|
+
locales: GameLocales;
|
|
421
|
+
customScenarios?: GameCustomScenarios;
|
|
422
|
+
teams?: {
|
|
423
|
+
mode?: GameTeamMode;
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
### GameSettingConstraint
|
|
429
|
+
|
|
430
|
+
How a game narrows one of its `game` settings. Each keyword may only narrow the SDK's schema: a `minimum` or `maximum` applies to a number and also rules out null, an `enum` lists values the SDK's schema accepts, and `readOnly` fixes the value at the game's own, so no scenario or session may change it.
|
|
431
|
+
|
|
432
|
+
```ts
|
|
433
|
+
interface GameSettingConstraint {
|
|
434
|
+
minimum?: number;
|
|
435
|
+
maximum?: number;
|
|
436
|
+
enum?: [unknown, ...unknown[]];
|
|
437
|
+
readOnly?: boolean;
|
|
438
|
+
}
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
### GameSettings
|
|
442
|
+
|
|
443
|
+
The values of the built-in `game` settings resource: the game-level settings every game has. Its schema is the SDK's, not the game's: a game sets its own values in its manifest, which become this resource's defaults, and a scenario or a session overrides them under the identifier `game` like any other settings resource. Null means 'no limit' or 'no guidance'. A new game-level setting joins as a new optional property with a default.
|
|
444
|
+
|
|
445
|
+
```ts
|
|
446
|
+
interface GameSettings {
|
|
447
|
+
maxTicks?: number | null;
|
|
448
|
+
teams?: {
|
|
449
|
+
min?: number | null;
|
|
450
|
+
max?: number | null;
|
|
451
|
+
perTeam?: {
|
|
452
|
+
minParticipants?: number | null;
|
|
453
|
+
maxParticipants?: number | null;
|
|
454
|
+
};
|
|
455
|
+
defaultNames?: {
|
|
456
|
+
[k: string]: {
|
|
457
|
+
name: string;
|
|
458
|
+
};
|
|
459
|
+
}[];
|
|
460
|
+
};
|
|
461
|
+
waitingRoom?: {
|
|
462
|
+
openOnStart?: boolean;
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
### GameSettingsConstraints
|
|
468
|
+
|
|
469
|
+
Narrowing for the built-in `game` settings, in their shape. The build merges each constraint into the `game` settings schema it emits, so a runtime sees one ordinary schema. Adding a constraint is a scenario-format change.
|
|
470
|
+
|
|
471
|
+
```ts
|
|
472
|
+
interface GameSettingsConstraints {
|
|
473
|
+
maxTicks?: GameSettingConstraint;
|
|
474
|
+
teams?: {
|
|
475
|
+
min?: GameSettingConstraint;
|
|
476
|
+
max?: GameSettingConstraint;
|
|
477
|
+
perTeam?: {
|
|
478
|
+
minParticipants?: GameSettingConstraint;
|
|
479
|
+
maxParticipants?: GameSettingConstraint;
|
|
480
|
+
};
|
|
481
|
+
defaultNames?: GameSettingConstraint;
|
|
482
|
+
};
|
|
483
|
+
waitingRoom?: {
|
|
484
|
+
openOnStart?: GameSettingConstraint;
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
### GenerateSpeechRequest
|
|
490
|
+
|
|
491
|
+
Options for synthesising speech.
|
|
492
|
+
|
|
493
|
+
```ts
|
|
494
|
+
interface GenerateSpeechRequest {
|
|
495
|
+
text: string;
|
|
496
|
+
voice?: GenerateSpeechVoice | string;
|
|
497
|
+
tier?: LLMTier;
|
|
498
|
+
format?: GenerateSpeechFormat;
|
|
499
|
+
languageHint?: string;
|
|
500
|
+
speed?: number;
|
|
501
|
+
}
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
### GenerateSpeechResponse
|
|
505
|
+
|
|
506
|
+
Response from a speech-synthesis call. The audio bytes are persisted as a blob; play them from a UI via `<audio src={callbacks.getAssetUrl(reference)} />` or read the raw bytes in the engine via `callbacks.readAsset(reference)`.
|
|
507
|
+
|
|
508
|
+
```ts
|
|
509
|
+
interface GenerateSpeechResponse {
|
|
510
|
+
reference: string;
|
|
511
|
+
mimeType: string;
|
|
512
|
+
durationMs?: number;
|
|
513
|
+
charactersBilled?: number;
|
|
514
|
+
}
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
### GlobalSettings
|
|
518
|
+
|
|
519
|
+
User-owned global settings file (~/.seriousgaming-sdk/config.json). Stores API keys and defaults once so every project picks them up. This is the lowest-priority configuration source: .env files, environment variables, and CLI flags all override it. The file is plaintext and must not be committed to git.
|
|
520
|
+
|
|
521
|
+
```ts
|
|
522
|
+
interface GlobalSettings {
|
|
523
|
+
elevenLabs?: {
|
|
524
|
+
apiKey?: string;
|
|
525
|
+
};
|
|
526
|
+
platform?: {
|
|
527
|
+
apiHost?: string;
|
|
528
|
+
apiKey?: string;
|
|
529
|
+
defaultPublisher?: string;
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
### HookDefinition
|
|
535
|
+
|
|
536
|
+
Definition of a hook — a single-signal handler that runs in response to an out-of-tick lifecycle event
|
|
537
|
+
|
|
538
|
+
```ts
|
|
539
|
+
interface HookDefinition {
|
|
540
|
+
identifier: string;
|
|
541
|
+
signal: 'participantJoin' | 'participantMove';
|
|
542
|
+
reads?: string[];
|
|
543
|
+
writes?: string[];
|
|
544
|
+
uses?: ApiUse[];
|
|
545
|
+
settings?: string[];
|
|
546
|
+
}
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
### HookPayloadMap
|
|
550
|
+
|
|
551
|
+
Maps each hook signal to its payload shape. Adding a new signal extends this map; the `HookFunction` type then surfaces the new payload fields automatically.
|
|
552
|
+
|
|
553
|
+
```ts
|
|
554
|
+
interface HookPayloadMap {
|
|
555
|
+
participantJoin: {
|
|
556
|
+
participant: Participant;
|
|
557
|
+
};
|
|
558
|
+
participantMove: {
|
|
559
|
+
participant: Participant;
|
|
560
|
+
fromTeamId: string;
|
|
561
|
+
toTeamId: string;
|
|
562
|
+
phase: 'departure' | 'arrival';
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
### JSONSchema
|
|
568
|
+
|
|
569
|
+
JSON Schema for requesting structured responses from the LLM Follows the JSON Schema specification
|
|
570
|
+
|
|
571
|
+
```ts
|
|
572
|
+
interface JSONSchema {
|
|
573
|
+
type?: 'object' | 'string' | 'number' | 'integer' | 'boolean' | 'array' | string;
|
|
574
|
+
properties?: Record<string, JSONSchema>;
|
|
575
|
+
required?: string[];
|
|
576
|
+
description?: string;
|
|
577
|
+
items?: JSONSchema;
|
|
578
|
+
enum?: unknown[];
|
|
579
|
+
default?: unknown;
|
|
580
|
+
[key: string]: unknown;
|
|
581
|
+
}
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
### LLMGenerateOptions
|
|
585
|
+
|
|
586
|
+
Options for generating text with an LLM
|
|
587
|
+
|
|
588
|
+
```ts
|
|
589
|
+
interface LLMGenerateOptions {
|
|
590
|
+
prompt?: string;
|
|
591
|
+
messages?: LLMMessage[];
|
|
592
|
+
systemPrompt?: string;
|
|
593
|
+
jsonSchema?: JSONSchema;
|
|
594
|
+
tier?: LLMTier;
|
|
595
|
+
tools?: LLMTool[];
|
|
596
|
+
}
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
### LLMMessage
|
|
600
|
+
|
|
601
|
+
A message in a conversation with an LLM.
|
|
602
|
+
|
|
603
|
+
```ts
|
|
604
|
+
interface LLMMessage {
|
|
605
|
+
role: 'user' | 'assistant';
|
|
606
|
+
content: string | ContentBlock[];
|
|
607
|
+
}
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
### LLMResponse
|
|
611
|
+
|
|
612
|
+
Response from the LLM.
|
|
613
|
+
|
|
614
|
+
```ts
|
|
615
|
+
interface LLMResponse {
|
|
616
|
+
content: ContentBlock[];
|
|
617
|
+
stopReason: LLMStopReason;
|
|
618
|
+
usage?: LLMUsage;
|
|
619
|
+
}
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
### LLMTool
|
|
623
|
+
|
|
624
|
+
A tool the model may invoke. The model never executes anything itself — when it emits a `toolUse` content block, the caller runs the tool in its own code and feeds the result back via a `toolResult` block on the next turn.
|
|
625
|
+
|
|
626
|
+
```ts
|
|
627
|
+
interface LLMTool {
|
|
628
|
+
name: string;
|
|
629
|
+
description: string;
|
|
630
|
+
inputSchema: JSONSchema;
|
|
631
|
+
}
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
### LLMUsage
|
|
635
|
+
|
|
636
|
+
Token usage reported by the LLM provider for one generation call.
|
|
637
|
+
|
|
638
|
+
```ts
|
|
639
|
+
interface LLMUsage {
|
|
640
|
+
inputTokens: number;
|
|
641
|
+
outputTokens: number;
|
|
642
|
+
}
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
### LogicFunctionArgs
|
|
646
|
+
|
|
647
|
+
```ts
|
|
648
|
+
interface LogicFunctionArgs<TContext, TSettings, TCallbacks = SignatureCallbacks> {
|
|
649
|
+
context: TContext;
|
|
650
|
+
settings: TSettings;
|
|
651
|
+
meta: TeamRunMeta;
|
|
652
|
+
participants: readonly Readonly<Participant>[];
|
|
653
|
+
callbacks: TCallbacks;
|
|
654
|
+
}
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
### LogicLayout
|
|
658
|
+
|
|
659
|
+
Where a logic-bearing resource keeps its code, and what its entrypoint is called
|
|
660
|
+
|
|
661
|
+
```ts
|
|
662
|
+
interface LogicLayout {
|
|
663
|
+
directory: string;
|
|
664
|
+
entrypoint: string;
|
|
665
|
+
}
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
### LogicMeta
|
|
669
|
+
|
|
670
|
+
The facts true of the whole run, delivered to every call into game logic whether it runs inside the tick loop or outside it.
|
|
671
|
+
|
|
672
|
+
```ts
|
|
673
|
+
interface LogicMeta {
|
|
674
|
+
locale: string;
|
|
675
|
+
seed: string;
|
|
676
|
+
runKind: RunKind;
|
|
677
|
+
now: number;
|
|
678
|
+
}
|
|
679
|
+
```
|
|
680
|
+
|
|
681
|
+
### LogicResult
|
|
682
|
+
|
|
683
|
+
What engine and hook logic returns: the state it writes, named by kind.
|
|
684
|
+
|
|
685
|
+
```ts
|
|
686
|
+
interface LogicResult<TContext> {
|
|
687
|
+
capabilities: TContext;
|
|
688
|
+
deletes?: ContextDeletePath[];
|
|
689
|
+
}
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
### PackageDefinition
|
|
693
|
+
|
|
694
|
+
Definition of a package
|
|
695
|
+
|
|
696
|
+
```ts
|
|
697
|
+
interface PackageDefinition {
|
|
698
|
+
identifier: string;
|
|
699
|
+
name: string;
|
|
700
|
+
version: string;
|
|
701
|
+
}
|
|
702
|
+
```
|
|
703
|
+
|
|
704
|
+
### PackageManifest
|
|
705
|
+
|
|
706
|
+
A package, which is a game: its identifier and the game's settings. What it declares are the resources on disk under the conventional directories beside this file. The version comes from package.json, and the game's identifier is the package identifier with `.game` appended.
|
|
707
|
+
|
|
708
|
+
```ts
|
|
709
|
+
interface PackageManifest {
|
|
710
|
+
identifier: string;
|
|
711
|
+
requires?: RequiredFeatures;
|
|
712
|
+
scenarioFormat?: ScenarioFormat;
|
|
713
|
+
supportedLocales: GameSupportedLocales;
|
|
714
|
+
locales: GameLocales;
|
|
715
|
+
maxTicks?: number;
|
|
716
|
+
teams?: GameTeams;
|
|
717
|
+
waitingRoom?: GameWaitingRoomSettings;
|
|
718
|
+
gameSettingsConstraints?: GameSettingsConstraints;
|
|
719
|
+
customScenarios?: GameCustomScenarios;
|
|
720
|
+
}
|
|
721
|
+
```
|
|
722
|
+
|
|
723
|
+
### Participant
|
|
724
|
+
|
|
725
|
+
A participant the platform tracks for some team in the session.
|
|
726
|
+
|
|
727
|
+
```ts
|
|
728
|
+
interface Participant {
|
|
729
|
+
id: string;
|
|
730
|
+
name: string;
|
|
731
|
+
index: number;
|
|
732
|
+
connected: boolean;
|
|
733
|
+
teamId: string;
|
|
734
|
+
}
|
|
735
|
+
```
|
|
736
|
+
|
|
737
|
+
### PastStateEntry
|
|
738
|
+
|
|
739
|
+
```ts
|
|
740
|
+
interface PastStateEntry<T = Record<string, unknown>> extends TeamStateEntry<T> {
|
|
741
|
+
tick: number;
|
|
742
|
+
recordedAt: number;
|
|
743
|
+
complete: boolean;
|
|
744
|
+
}
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
### PastStateQuery
|
|
748
|
+
|
|
749
|
+
What to read from the past.
|
|
750
|
+
|
|
751
|
+
```ts
|
|
752
|
+
interface PastStateQuery<T = Record<string, unknown>> {
|
|
753
|
+
fromTick: number;
|
|
754
|
+
toTick?: number;
|
|
755
|
+
teams?: 'own' | 'all' | string;
|
|
756
|
+
capabilityIds?: (keyof T & string)[];
|
|
757
|
+
}
|
|
758
|
+
```
|
|
759
|
+
|
|
760
|
+
### PresentationDefinition
|
|
761
|
+
|
|
762
|
+
Definition of a presentation: the slides a facilitator shows the room, rendered from a UI bundle of the game's own. Read-only by construction: it declares no writes, no endpoints and no callback uses, and it may be shown with no session at all
|
|
763
|
+
|
|
764
|
+
```ts
|
|
765
|
+
interface PresentationDefinition {
|
|
766
|
+
identifier: string;
|
|
767
|
+
locales?: {
|
|
768
|
+
[k: string]: {
|
|
769
|
+
name: string;
|
|
770
|
+
};
|
|
771
|
+
};
|
|
772
|
+
reads?: string[];
|
|
773
|
+
settings?: string[];
|
|
774
|
+
}
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
### ReadAssetResponse
|
|
778
|
+
|
|
779
|
+
Shape returned by `readAsset` for both `asset:` and `blob:` references.
|
|
780
|
+
|
|
781
|
+
```ts
|
|
782
|
+
interface ReadAssetResponse {
|
|
783
|
+
data: Uint8Array;
|
|
784
|
+
mimeType: string;
|
|
785
|
+
name: string;
|
|
786
|
+
}
|
|
787
|
+
```
|
|
788
|
+
|
|
789
|
+
### RequestTickFunctionArgs
|
|
790
|
+
|
|
791
|
+
Arguments of a validator's `RequestTick` gate.
|
|
792
|
+
|
|
793
|
+
```ts
|
|
794
|
+
interface RequestTickFunctionArgs<TContext, TSettings> {
|
|
795
|
+
context: TContext;
|
|
796
|
+
requestedTick: number;
|
|
797
|
+
actor: ValidatorActor;
|
|
798
|
+
settings: TSettings;
|
|
799
|
+
meta: LogicMeta;
|
|
800
|
+
participants: readonly Readonly<Participant>[];
|
|
801
|
+
}
|
|
802
|
+
```
|
|
803
|
+
|
|
804
|
+
### ResolvedPackageManifest
|
|
805
|
+
|
|
806
|
+
Every resource a package holds: the shape the loader builds from disk and the shape the build writes to seriousgaming.json. A game holds one of nine kinds, each in its own field; everything a package may hold more than one of is an array.
|
|
807
|
+
|
|
808
|
+
```ts
|
|
809
|
+
interface ResolvedPackageManifest {
|
|
810
|
+
manifestVersion?: number;
|
|
811
|
+
requires?: RequiredFeatures;
|
|
812
|
+
scenarioFormat?: ScenarioFormat;
|
|
813
|
+
package: SDKPackage;
|
|
814
|
+
game: SDKGame;
|
|
815
|
+
engine?: SDKEngine;
|
|
816
|
+
ui?: SDKUserInterface;
|
|
817
|
+
session?: SDKSessionUserInterface;
|
|
818
|
+
waiting_room?: SDKWaitingRoomUserInterface;
|
|
819
|
+
presentation?: SDKPresentation;
|
|
820
|
+
setup?: SDKSetup;
|
|
821
|
+
scenario_editor?: SDKScenarioEditor;
|
|
822
|
+
tick_controller?: SDKTickController;
|
|
823
|
+
guide?: SDKFacilitatorGuide;
|
|
824
|
+
capabilities?: SDKCapability[];
|
|
825
|
+
settings?: SDKSettings[];
|
|
826
|
+
scenarios?: SDKScenario[];
|
|
827
|
+
hooks?: SDKHook[];
|
|
828
|
+
validators?: SDKValidator[];
|
|
829
|
+
endpoints?: SDKEndpoint[];
|
|
830
|
+
}
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
### RunAggregateFunctionArgs
|
|
834
|
+
|
|
835
|
+
```ts
|
|
836
|
+
interface RunAggregateFunctionArgs<
|
|
837
|
+
TTeamContext,
|
|
838
|
+
TSharedContext,
|
|
839
|
+
TSettings,
|
|
840
|
+
TCallbacks = SignatureCallbacks,
|
|
841
|
+
TTeamState = never,
|
|
842
|
+
TSharedState = never,
|
|
843
|
+
> {
|
|
844
|
+
shared: AggregateFunctionShared<TSharedContext, TSharedState>;
|
|
845
|
+
teams: AggregateFunctionTeam<TTeamContext, TTeamState>[];
|
|
846
|
+
settings: TSettings;
|
|
847
|
+
meta: RunMeta;
|
|
848
|
+
participants: readonly Readonly<Participant>[];
|
|
849
|
+
callbacks: TCallbacks;
|
|
850
|
+
}
|
|
851
|
+
```
|
|
852
|
+
|
|
853
|
+
### RunAggregateResult
|
|
854
|
+
|
|
855
|
+
An aggregate engine's result. Each level names what it writes the same way a team's `Run` does: every `teams` entry has the shape of a `Run` result, in the order the teams were passed, and `shared` carries the session's shared-scope capabilities. A shared capability is written through `shared` alone; one in a `teams` entry fails the call.
|
|
856
|
+
|
|
857
|
+
```ts
|
|
858
|
+
interface RunAggregateResult<
|
|
859
|
+
TTeamContext,
|
|
860
|
+
TSharedContext,
|
|
861
|
+
TTeamState = never,
|
|
862
|
+
TSharedState = never,
|
|
863
|
+
> {
|
|
864
|
+
shared: EngineResult<Partial<TSharedContext>, TSharedState>;
|
|
865
|
+
teams: EngineResult<TTeamContext, TTeamState>[];
|
|
866
|
+
}
|
|
867
|
+
```
|
|
868
|
+
|
|
869
|
+
### RunAggregateTickResult
|
|
870
|
+
|
|
871
|
+
`RunAggregate`'s result: each level may also report completion, as `Run`'s `complete` does. A `teams` entry's ends the game for that team; `shared`'s for every team at once.
|
|
872
|
+
|
|
873
|
+
```ts
|
|
874
|
+
interface RunAggregateTickResult<
|
|
875
|
+
TTeamContext,
|
|
876
|
+
TSharedContext,
|
|
877
|
+
TTeamState = never,
|
|
878
|
+
TSharedState = never,
|
|
879
|
+
> {
|
|
880
|
+
shared: RunResult<Partial<TSharedContext>, TSharedState>;
|
|
881
|
+
teams: RunResult<TTeamContext, TTeamState>[];
|
|
882
|
+
}
|
|
883
|
+
```
|
|
884
|
+
|
|
885
|
+
### RunMeta
|
|
886
|
+
|
|
887
|
+
`meta` for logic that runs as part of a tick: the engine's `Init` and `Run`, the aggregate forms of both, and tick-controller logic.
|
|
888
|
+
|
|
889
|
+
```ts
|
|
890
|
+
interface RunMeta extends LogicMeta {
|
|
891
|
+
tick: number;
|
|
892
|
+
}
|
|
893
|
+
```
|
|
894
|
+
|
|
895
|
+
### RunResult
|
|
896
|
+
|
|
897
|
+
What the engine's `Run` returns: an `EngineResult`, plus whether the game is now over for this team.
|
|
898
|
+
|
|
899
|
+
```ts
|
|
900
|
+
interface RunResult<TContext, TState = never> extends EngineResult<TContext, TState> {
|
|
901
|
+
complete?: boolean;
|
|
902
|
+
}
|
|
903
|
+
```
|
|
904
|
+
|
|
905
|
+
### ScenarioDefinition
|
|
906
|
+
|
|
907
|
+
Definition of a scenario — a named flavour of a game bundling settings overrides and static assets
|
|
908
|
+
|
|
909
|
+
```ts
|
|
910
|
+
interface ScenarioDefinition {
|
|
911
|
+
identifier: string;
|
|
912
|
+
locales: {
|
|
913
|
+
[k: string]: {
|
|
914
|
+
name: string;
|
|
915
|
+
description?: string;
|
|
916
|
+
};
|
|
917
|
+
};
|
|
918
|
+
default?: boolean;
|
|
919
|
+
restricted?: boolean;
|
|
920
|
+
settings?: {
|
|
921
|
+
[k: string]: {
|
|
922
|
+
[k: string]: unknown;
|
|
923
|
+
};
|
|
924
|
+
};
|
|
925
|
+
}
|
|
926
|
+
```
|
|
927
|
+
|
|
928
|
+
### ScenarioEditorDefinition
|
|
929
|
+
|
|
930
|
+
Definition of the game's scenario editor: an authoring screen, used at any time and with no session, whose output is a lasting scenario. Optional: `customScenarios.supported` is what switches custom scenarios on
|
|
931
|
+
|
|
932
|
+
```ts
|
|
933
|
+
interface ScenarioEditorDefinition {
|
|
934
|
+
identifier: string;
|
|
935
|
+
configures?: string[];
|
|
936
|
+
endpoints?: string[];
|
|
937
|
+
}
|
|
938
|
+
```
|
|
939
|
+
|
|
940
|
+
### ScheduleOptions
|
|
941
|
+
|
|
942
|
+
Options accepted by all schedule-computation helpers.
|
|
943
|
+
|
|
944
|
+
```ts
|
|
945
|
+
interface ScheduleOptions {
|
|
946
|
+
timezone?: string;
|
|
947
|
+
now?: number;
|
|
948
|
+
}
|
|
949
|
+
```
|
|
950
|
+
|
|
951
|
+
### Schema
|
|
952
|
+
|
|
953
|
+
```ts
|
|
954
|
+
interface Schema {
|
|
955
|
+
PackageDefinition?: PackageDefinition;
|
|
956
|
+
EngineDefinition?: EngineDefinition;
|
|
957
|
+
CapabilityDefinition?: CapabilityDefinition;
|
|
958
|
+
SettingsDefinition?: SettingsDefinition;
|
|
959
|
+
SDKSettings?: SDKSettings;
|
|
960
|
+
SetupDefinition?: SetupDefinition;
|
|
961
|
+
ScenarioEditorDefinition?: ScenarioEditorDefinition;
|
|
962
|
+
ScenarioDefinition?: ScenarioDefinition;
|
|
963
|
+
UserInterfaceDefinition?: UserInterfaceDefinition;
|
|
964
|
+
GameDefinition?: GameDefinition;
|
|
965
|
+
SessionUserInterfaceDefinition?: SessionUserInterfaceDefinition;
|
|
966
|
+
SDKSessionUserInterface?: SDKSessionUserInterface;
|
|
967
|
+
WaitingRoomUserInterfaceDefinition?: WaitingRoomUserInterfaceDefinition;
|
|
968
|
+
SDKWaitingRoomUserInterface?: SDKWaitingRoomUserInterface;
|
|
969
|
+
PresentationDefinition?: PresentationDefinition;
|
|
970
|
+
SDKPresentation?: SDKPresentation;
|
|
971
|
+
GameSupportedLocales?: GameSupportedLocales;
|
|
972
|
+
GameLocales?: GameLocales;
|
|
973
|
+
GameCustomScenarios?: GameCustomScenarios;
|
|
974
|
+
GameTeams?: GameTeams;
|
|
975
|
+
GameTeamMode?: GameTeamMode;
|
|
976
|
+
GameSettings?: GameSettings;
|
|
977
|
+
GameSettingConstraint?: GameSettingConstraint;
|
|
978
|
+
GameSettingsConstraints?: GameSettingsConstraints;
|
|
979
|
+
GameWaitingRoomOpenOnStart?: GameWaitingRoomOpenOnStart;
|
|
980
|
+
GameWaitingRoomSettings?: GameWaitingRoomSettings;
|
|
981
|
+
FacilitatorGuideDefinition?: FacilitatorGuideDefinition;
|
|
982
|
+
SDKFacilitatorGuide?: SDKFacilitatorGuide;
|
|
983
|
+
ResolvedPackageManifest?: ResolvedPackageManifest;
|
|
984
|
+
LogicLayout?: LogicLayout;
|
|
985
|
+
SDKPackage?: SDKPackage;
|
|
986
|
+
SDKEngine?: SDKEngine;
|
|
987
|
+
SDKCapability?: SDKCapability;
|
|
988
|
+
SDKScenario?: SDKScenario;
|
|
989
|
+
SDKUserInterface?: SDKUserInterface;
|
|
990
|
+
SDKSetup?: SDKSetup;
|
|
991
|
+
SDKScenarioEditor?: SDKScenarioEditor;
|
|
992
|
+
SDKGame?: SDKGame;
|
|
993
|
+
PackageManifest?: PackageManifest;
|
|
994
|
+
TickControllerDefinition?: TickControllerDefinition;
|
|
995
|
+
SDKTickController?: SDKTickController;
|
|
996
|
+
ApiUse?: ApiUse;
|
|
997
|
+
EndpointActionType?: EndpointActionType;
|
|
998
|
+
GlobalSettings?: GlobalSettings;
|
|
999
|
+
HookSignal?: HookSignal;
|
|
1000
|
+
HookDefinition?: HookDefinition;
|
|
1001
|
+
SDKHook?: SDKHook;
|
|
1002
|
+
ValidatorDefinition?: ValidatorDefinition;
|
|
1003
|
+
SDKValidator?: SDKValidator;
|
|
1004
|
+
EndpointDefinition?: EndpointDefinition;
|
|
1005
|
+
SDKEndpoint?: SDKEndpoint;
|
|
1006
|
+
}
|
|
1007
|
+
```
|
|
1008
|
+
|
|
1009
|
+
### SDKCapability
|
|
1010
|
+
|
|
1011
|
+
Bundle containing a capability definition
|
|
1012
|
+
|
|
1013
|
+
```ts
|
|
1014
|
+
interface SDKCapability {
|
|
1015
|
+
definition: CapabilityDefinition;
|
|
1016
|
+
}
|
|
1017
|
+
```
|
|
1018
|
+
|
|
1019
|
+
### SDKEndpoint
|
|
1020
|
+
|
|
1021
|
+
Bundle containing an endpoint definition and its logic layout
|
|
1022
|
+
|
|
1023
|
+
```ts
|
|
1024
|
+
interface SDKEndpoint {
|
|
1025
|
+
definition: EndpointDefinition;
|
|
1026
|
+
logic: LogicLayout;
|
|
1027
|
+
rootDirectory: string;
|
|
1028
|
+
}
|
|
1029
|
+
```
|
|
1030
|
+
|
|
1031
|
+
### SDKEngine
|
|
1032
|
+
|
|
1033
|
+
Bundle containing an engine definition and its logic layout
|
|
1034
|
+
|
|
1035
|
+
```ts
|
|
1036
|
+
interface SDKEngine {
|
|
1037
|
+
definition: EngineDefinition;
|
|
1038
|
+
logic: LogicLayout;
|
|
1039
|
+
rootDirectory: string;
|
|
1040
|
+
}
|
|
1041
|
+
```
|
|
1042
|
+
|
|
1043
|
+
### SDKFacilitatorGuide
|
|
1044
|
+
|
|
1045
|
+
Bundle containing a facilitator guide definition and root directory for content and assets
|
|
1046
|
+
|
|
1047
|
+
```ts
|
|
1048
|
+
interface SDKFacilitatorGuide {
|
|
1049
|
+
definition: FacilitatorGuideDefinition;
|
|
1050
|
+
rootDirectory: string;
|
|
1051
|
+
}
|
|
1052
|
+
```
|
|
1053
|
+
|
|
1054
|
+
### SDKGame
|
|
1055
|
+
|
|
1056
|
+
Bundle containing a game definition
|
|
1057
|
+
|
|
1058
|
+
```ts
|
|
1059
|
+
interface SDKGame {
|
|
1060
|
+
definition: GameDefinition;
|
|
1061
|
+
rootDirectory: string;
|
|
1062
|
+
}
|
|
1063
|
+
```
|
|
1064
|
+
|
|
1065
|
+
### SDKHook
|
|
1066
|
+
|
|
1067
|
+
Bundle containing a hook definition and its logic layout
|
|
1068
|
+
|
|
1069
|
+
```ts
|
|
1070
|
+
interface SDKHook {
|
|
1071
|
+
definition: HookDefinition;
|
|
1072
|
+
logic: LogicLayout;
|
|
1073
|
+
rootDirectory: string;
|
|
1074
|
+
}
|
|
1075
|
+
```
|
|
1076
|
+
|
|
1077
|
+
### SDKPackage
|
|
1078
|
+
|
|
1079
|
+
Bundle containing a package definition
|
|
1080
|
+
|
|
1081
|
+
```ts
|
|
1082
|
+
interface SDKPackage {
|
|
1083
|
+
definition: PackageDefinition;
|
|
1084
|
+
}
|
|
1085
|
+
```
|
|
1086
|
+
|
|
1087
|
+
### SDKPresentation
|
|
1088
|
+
|
|
1089
|
+
Bundle containing a presentation definition and entrypoint
|
|
1090
|
+
|
|
1091
|
+
```ts
|
|
1092
|
+
interface SDKPresentation {
|
|
1093
|
+
definition: PresentationDefinition;
|
|
1094
|
+
rootDirectory: string;
|
|
1095
|
+
ui: {
|
|
1096
|
+
entrypoint: string;
|
|
1097
|
+
};
|
|
1098
|
+
}
|
|
1099
|
+
```
|
|
1100
|
+
|
|
1101
|
+
### SDKScenario
|
|
1102
|
+
|
|
1103
|
+
Bundle containing a scenario definition and root directory for assets
|
|
1104
|
+
|
|
1105
|
+
```ts
|
|
1106
|
+
interface SDKScenario {
|
|
1107
|
+
definition: ScenarioDefinition;
|
|
1108
|
+
rootDirectory: string;
|
|
1109
|
+
}
|
|
1110
|
+
```
|
|
1111
|
+
|
|
1112
|
+
### SDKScenarioEditor
|
|
1113
|
+
|
|
1114
|
+
Bundle containing the scenario editor definition and entrypoint
|
|
1115
|
+
|
|
1116
|
+
```ts
|
|
1117
|
+
interface SDKScenarioEditor {
|
|
1118
|
+
definition: ScenarioEditorDefinition;
|
|
1119
|
+
rootDirectory: string;
|
|
1120
|
+
ui: {
|
|
1121
|
+
entrypoint: string;
|
|
1122
|
+
};
|
|
1123
|
+
}
|
|
1124
|
+
```
|
|
1125
|
+
|
|
1126
|
+
### SDKSessionUserInterface
|
|
1127
|
+
|
|
1128
|
+
Bundle containing a session user interface definition and entrypoint
|
|
1129
|
+
|
|
1130
|
+
```ts
|
|
1131
|
+
interface SDKSessionUserInterface {
|
|
1132
|
+
definition: SessionUserInterfaceDefinition;
|
|
1133
|
+
rootDirectory: string;
|
|
1134
|
+
ui: {
|
|
1135
|
+
entrypoint: string;
|
|
1136
|
+
};
|
|
1137
|
+
}
|
|
1138
|
+
```
|
|
1139
|
+
|
|
1140
|
+
### SDKSettings
|
|
1141
|
+
|
|
1142
|
+
Bundle containing a settings definition
|
|
1143
|
+
|
|
1144
|
+
```ts
|
|
1145
|
+
interface SDKSettings {
|
|
1146
|
+
definition: SettingsDefinition;
|
|
1147
|
+
}
|
|
1148
|
+
```
|
|
1149
|
+
|
|
1150
|
+
### SDKSetup
|
|
1151
|
+
|
|
1152
|
+
Bundle containing the setup user interface definition and entrypoint
|
|
1153
|
+
|
|
1154
|
+
```ts
|
|
1155
|
+
interface SDKSetup {
|
|
1156
|
+
definition: SetupDefinition;
|
|
1157
|
+
rootDirectory: string;
|
|
1158
|
+
ui: {
|
|
1159
|
+
entrypoint: string;
|
|
1160
|
+
};
|
|
1161
|
+
}
|
|
1162
|
+
```
|
|
1163
|
+
|
|
1164
|
+
### SDKTickController
|
|
1165
|
+
|
|
1166
|
+
Bundle containing a tick controller definition and its logic layout
|
|
1167
|
+
|
|
1168
|
+
```ts
|
|
1169
|
+
interface SDKTickController {
|
|
1170
|
+
definition: TickControllerDefinition;
|
|
1171
|
+
logic: LogicLayout;
|
|
1172
|
+
rootDirectory: string;
|
|
1173
|
+
}
|
|
1174
|
+
```
|
|
1175
|
+
|
|
1176
|
+
### SDKUserInterface
|
|
1177
|
+
|
|
1178
|
+
Bundle containing a user interface definition and entrypoint
|
|
1179
|
+
|
|
1180
|
+
```ts
|
|
1181
|
+
interface SDKUserInterface {
|
|
1182
|
+
definition: UserInterfaceDefinition;
|
|
1183
|
+
rootDirectory: string;
|
|
1184
|
+
ui: {
|
|
1185
|
+
entrypoint: string;
|
|
1186
|
+
};
|
|
1187
|
+
}
|
|
1188
|
+
```
|
|
1189
|
+
|
|
1190
|
+
### SDKValidator
|
|
1191
|
+
|
|
1192
|
+
Bundle containing a validator definition and its logic layout
|
|
1193
|
+
|
|
1194
|
+
```ts
|
|
1195
|
+
interface SDKValidator {
|
|
1196
|
+
definition: ValidatorDefinition;
|
|
1197
|
+
logic: LogicLayout;
|
|
1198
|
+
rootDirectory: string;
|
|
1199
|
+
}
|
|
1200
|
+
```
|
|
1201
|
+
|
|
1202
|
+
### SDKWaitingRoomUserInterface
|
|
1203
|
+
|
|
1204
|
+
Bundle containing a waiting room user interface definition and entrypoint
|
|
1205
|
+
|
|
1206
|
+
```ts
|
|
1207
|
+
interface SDKWaitingRoomUserInterface {
|
|
1208
|
+
definition: WaitingRoomUserInterfaceDefinition;
|
|
1209
|
+
rootDirectory: string;
|
|
1210
|
+
ui: {
|
|
1211
|
+
entrypoint: string;
|
|
1212
|
+
};
|
|
1213
|
+
}
|
|
1214
|
+
```
|
|
1215
|
+
|
|
1216
|
+
### SessionEndpointArgs
|
|
1217
|
+
|
|
1218
|
+
What a session-scoped endpoint receives beyond the base arguments.
|
|
1219
|
+
|
|
1220
|
+
```ts
|
|
1221
|
+
interface SessionEndpointArgs<TTeamContext> {
|
|
1222
|
+
teams?: EndpointTeamEntry<TTeamContext>[];
|
|
1223
|
+
}
|
|
1224
|
+
```
|
|
1225
|
+
|
|
1226
|
+
### SessionUserInterfaceCallbacks
|
|
1227
|
+
|
|
1228
|
+
Callbacks available to session user interface components.
|
|
1229
|
+
|
|
1230
|
+
```ts
|
|
1231
|
+
interface SessionUserInterfaceCallbacks {
|
|
1232
|
+
uploadBlob: (file: File) => Promise<string>;
|
|
1233
|
+
getAssetUrl: (reference: string) => string;
|
|
1234
|
+
readAsset: (reference: string) => Promise<ReadAssetResponse>;
|
|
1235
|
+
getPastState: <T = Record<string, unknown>>(
|
|
1236
|
+
query: PastStateQuery<T>
|
|
1237
|
+
) => Promise<PastStateEntry<T>[]>;
|
|
1238
|
+
requestTick: (teamId?: string) => Promise<void>;
|
|
1239
|
+
pauseTimer: (teamId?: string) => Promise<void>;
|
|
1240
|
+
resumeTimer: (teamId?: string) => Promise<void>;
|
|
1241
|
+
resetGame: (teamId?: string) => Promise<void>;
|
|
1242
|
+
undoTick: (teamId?: string) => Promise<void>;
|
|
1243
|
+
extendTick: (byMs: number, teamId?: string) => Promise<void>;
|
|
1244
|
+
openHostOverlay: (overlay: HostOverlay, target?: string) => Promise<void>;
|
|
1245
|
+
setWaitingRoom: (open: boolean) => Promise<void>;
|
|
1246
|
+
resetWalkthrough: () => Promise<void>;
|
|
1247
|
+
createTeam: (name?: string) => Promise<void>;
|
|
1248
|
+
renameTeam: (teamId: string, name: string) => Promise<void>;
|
|
1249
|
+
renameParticipant: (participantId: string, name: string) => Promise<void>;
|
|
1250
|
+
moveParticipant: (participantId: string, teamId: string) => Promise<void>;
|
|
1251
|
+
deleteTeam: (teamId: string) => Promise<void>;
|
|
1252
|
+
endpoints: Record<string, (request: unknown) => Promise<unknown>>;
|
|
1253
|
+
setThemePreference: (preference: ThemePreference) => void;
|
|
1254
|
+
}
|
|
1255
|
+
```
|
|
1256
|
+
|
|
1257
|
+
### SessionUserInterfaceDefinition
|
|
1258
|
+
|
|
1259
|
+
Definition of a session user interface with internationalization support
|
|
1260
|
+
|
|
1261
|
+
```ts
|
|
1262
|
+
interface SessionUserInterfaceDefinition {
|
|
1263
|
+
identifier: string;
|
|
1264
|
+
reads?: string[];
|
|
1265
|
+
writes?: string[];
|
|
1266
|
+
endpoints?: string[];
|
|
1267
|
+
settings?: string[];
|
|
1268
|
+
}
|
|
1269
|
+
```
|
|
1270
|
+
|
|
1271
|
+
### SettingsDefinition
|
|
1272
|
+
|
|
1273
|
+
Definition of a settings resource: named, read-only parameters a game declares once and any resource may read by listing it in its settings. Overridden only by the active scenario and by the session's setup step, and fixed when play starts.
|
|
1274
|
+
|
|
1275
|
+
```ts
|
|
1276
|
+
interface SettingsDefinition {
|
|
1277
|
+
identifier: string;
|
|
1278
|
+
settingsSchema: {
|
|
1279
|
+
[k: string]: unknown;
|
|
1280
|
+
};
|
|
1281
|
+
}
|
|
1282
|
+
```
|
|
1283
|
+
|
|
1284
|
+
### SettingsEditorCallbacks
|
|
1285
|
+
|
|
1286
|
+
Callbacks available to a settings editor: the `setup` and `scenario_editor` slots, which share one wrapper.
|
|
1287
|
+
|
|
1288
|
+
```ts
|
|
1289
|
+
interface SettingsEditorCallbacks {
|
|
1290
|
+
uploadBlob: (file: File) => Promise<string>;
|
|
1291
|
+
getAssetUrl: (reference: string) => string;
|
|
1292
|
+
readAsset: (reference: string) => Promise<ReadAssetResponse>;
|
|
1293
|
+
requestPlay: () => void;
|
|
1294
|
+
endpoints: Record<string, (request: unknown) => Promise<unknown>>;
|
|
1295
|
+
setThemePreference: (preference: ThemePreference) => void;
|
|
1296
|
+
}
|
|
1297
|
+
```
|
|
1298
|
+
|
|
1299
|
+
### SetupDefinition
|
|
1300
|
+
|
|
1301
|
+
Definition of the game's setup user interface: a small form shown at session creation, whose changes become session overrides for that session only. Its presence is what gives a session its configuration step
|
|
1302
|
+
|
|
1303
|
+
```ts
|
|
1304
|
+
interface SetupDefinition {
|
|
1305
|
+
identifier: string;
|
|
1306
|
+
configures?: string[];
|
|
1307
|
+
endpoints?: string[];
|
|
1308
|
+
}
|
|
1309
|
+
```
|
|
1310
|
+
|
|
1311
|
+
### SignatureCallbacks
|
|
1312
|
+
|
|
1313
|
+
Every callback a runtime may offer logic: the engine, hooks, tick controllers and endpoints.
|
|
1314
|
+
|
|
1315
|
+
```ts
|
|
1316
|
+
interface SignatureCallbacks {
|
|
1317
|
+
generateText: LLMGenerateFunction;
|
|
1318
|
+
readAsset: (reference: string) => Promise<ReadAssetResponse>;
|
|
1319
|
+
getPastState: <T = Record<string, unknown>>(
|
|
1320
|
+
query: PastStateQuery<T>
|
|
1321
|
+
) => Promise<PastStateEntry<T>[]>;
|
|
1322
|
+
extractText?: ExtractTextFunction;
|
|
1323
|
+
generateSpeech?: GenerateSpeechFunction;
|
|
1324
|
+
writeBlob?: (
|
|
1325
|
+
data: Uint8Array | ArrayBuffer,
|
|
1326
|
+
options: {
|
|
1327
|
+
name: string;
|
|
1328
|
+
mimeType: string;
|
|
1329
|
+
retention?: 'settings' | 'game';
|
|
1330
|
+
}
|
|
1331
|
+
) => Promise<string>;
|
|
1332
|
+
}
|
|
1333
|
+
```
|
|
1334
|
+
|
|
1335
|
+
### TeamEndpointArgs
|
|
1336
|
+
|
|
1337
|
+
What a team-scoped endpoint receives beyond the base arguments.
|
|
1338
|
+
|
|
1339
|
+
```ts
|
|
1340
|
+
interface TeamEndpointArgs {
|
|
1341
|
+
team: TeamInfo;
|
|
1342
|
+
}
|
|
1343
|
+
```
|
|
1344
|
+
|
|
1345
|
+
### TeamInfo
|
|
1346
|
+
|
|
1347
|
+
Who a team is: the fields every team entry in the SDK carries.
|
|
1348
|
+
|
|
1349
|
+
```ts
|
|
1350
|
+
interface TeamInfo {
|
|
1351
|
+
teamId: string;
|
|
1352
|
+
index: number;
|
|
1353
|
+
name: string;
|
|
1354
|
+
}
|
|
1355
|
+
```
|
|
1356
|
+
|
|
1357
|
+
### TeamRunMeta
|
|
1358
|
+
|
|
1359
|
+
`meta` for a function that runs against one team's context: `Init`, `Run`, and tick-controller logic.
|
|
1360
|
+
|
|
1361
|
+
```ts
|
|
1362
|
+
interface TeamRunMeta extends RunMeta {
|
|
1363
|
+
teamId: string;
|
|
1364
|
+
index: number;
|
|
1365
|
+
}
|
|
1366
|
+
```
|
|
1367
|
+
|
|
1368
|
+
### TeamStateEntry
|
|
1369
|
+
|
|
1370
|
+
One team's state at one committed past tick, as returned by `getPastState`.
|
|
1371
|
+
|
|
1372
|
+
```ts
|
|
1373
|
+
interface TeamStateEntry<T = Record<string, unknown>> extends TeamInfo {
|
|
1374
|
+
context: T;
|
|
1375
|
+
}
|
|
1376
|
+
```
|
|
1377
|
+
|
|
1378
|
+
### TickControllerDefinition
|
|
1379
|
+
|
|
1380
|
+
Definition of a tick controller that determines automatic tick timing
|
|
1381
|
+
|
|
1382
|
+
```ts
|
|
1383
|
+
interface TickControllerDefinition {
|
|
1384
|
+
identifier: string;
|
|
1385
|
+
reads?: string[];
|
|
1386
|
+
uses?: ApiUse[];
|
|
1387
|
+
settings?: string[];
|
|
1388
|
+
}
|
|
1389
|
+
```
|
|
1390
|
+
|
|
1391
|
+
### TickControllerFunctionArgs
|
|
1392
|
+
|
|
1393
|
+
```ts
|
|
1394
|
+
interface TickControllerFunctionArgs<
|
|
1395
|
+
TContext,
|
|
1396
|
+
TSettings,
|
|
1397
|
+
TCallbacks = SignatureCallbacks,
|
|
1398
|
+
> extends LogicFunctionArgs<TContext, TSettings, TCallbacks> {
|
|
1399
|
+
teams: AggregateFunctionTeam<TContext>[];
|
|
1400
|
+
waitingRoomOpen: boolean;
|
|
1401
|
+
}
|
|
1402
|
+
```
|
|
1403
|
+
|
|
1404
|
+
### TickControllerResult
|
|
1405
|
+
|
|
1406
|
+
```ts
|
|
1407
|
+
interface TickControllerResult {
|
|
1408
|
+
enabled: boolean;
|
|
1409
|
+
intervalMs?: number;
|
|
1410
|
+
nextTickAt?: number;
|
|
1411
|
+
complete?: boolean;
|
|
1412
|
+
}
|
|
1413
|
+
```
|
|
1414
|
+
|
|
1415
|
+
### TimerState
|
|
1416
|
+
|
|
1417
|
+
The host's automatic tick timer, as every reader sees it.
|
|
1418
|
+
|
|
1419
|
+
```ts
|
|
1420
|
+
interface TimerState {
|
|
1421
|
+
enabled: boolean;
|
|
1422
|
+
paused: boolean;
|
|
1423
|
+
nextTickAt: number | null;
|
|
1424
|
+
intervalMs: number | null;
|
|
1425
|
+
pausedAt: number | null;
|
|
1426
|
+
pausedMs: number;
|
|
1427
|
+
extendedMs: number;
|
|
1428
|
+
scheduleStartedAt: number | null;
|
|
1429
|
+
}
|
|
1430
|
+
```
|
|
1431
|
+
|
|
1432
|
+
### UserInterfaceCallbacks
|
|
1433
|
+
|
|
1434
|
+
Callbacks available to user interface components
|
|
1435
|
+
|
|
1436
|
+
```ts
|
|
1437
|
+
interface UserInterfaceCallbacks {
|
|
1438
|
+
requestTick: () => Promise<void>;
|
|
1439
|
+
renameOwnTeam: (name: string) => Promise<void>;
|
|
1440
|
+
uploadBlob: (file: File) => Promise<string>;
|
|
1441
|
+
getAssetUrl: (reference: string) => string;
|
|
1442
|
+
readAsset: (reference: string) => Promise<ReadAssetResponse>;
|
|
1443
|
+
getPastState: <T = Record<string, unknown>>(
|
|
1444
|
+
query: PastStateQuery<T>
|
|
1445
|
+
) => Promise<PastStateEntry<T>[]>;
|
|
1446
|
+
getAllTeamsParticipants: () => Promise<Participant[]>;
|
|
1447
|
+
endpoints: Record<string, (request: unknown) => Promise<unknown>>;
|
|
1448
|
+
setThemePreference: (preference: ThemePreference) => void;
|
|
1449
|
+
}
|
|
1450
|
+
```
|
|
1451
|
+
|
|
1452
|
+
### UserInterfaceDefinition
|
|
1453
|
+
|
|
1454
|
+
Definition of a user interface with internationalization support
|
|
1455
|
+
|
|
1456
|
+
```ts
|
|
1457
|
+
interface UserInterfaceDefinition {
|
|
1458
|
+
identifier: string;
|
|
1459
|
+
reads?: string[];
|
|
1460
|
+
crossTeamReads?: string[];
|
|
1461
|
+
writes?: string[];
|
|
1462
|
+
endpoints?: string[];
|
|
1463
|
+
crossTeamParticipants?: boolean;
|
|
1464
|
+
settings?: string[];
|
|
1465
|
+
}
|
|
1466
|
+
```
|
|
1467
|
+
|
|
1468
|
+
### ValidationRejection
|
|
1469
|
+
|
|
1470
|
+
A single validator rejection returned to the caller. The runtime collects every rejection (form-style UX) rather than short-circuiting on the first.
|
|
1471
|
+
|
|
1472
|
+
```ts
|
|
1473
|
+
interface ValidationRejection {
|
|
1474
|
+
validatorIdentifier: string;
|
|
1475
|
+
message: string;
|
|
1476
|
+
}
|
|
1477
|
+
```
|
|
1478
|
+
|
|
1479
|
+
### ValidatorDefinition
|
|
1480
|
+
|
|
1481
|
+
Definition of a validator — a standalone, read-only gate on what a participant does from a player surface: a context write, or a request for the next tick. Reject-only; never modifies state.
|
|
1482
|
+
|
|
1483
|
+
```ts
|
|
1484
|
+
interface ValidatorDefinition {
|
|
1485
|
+
identifier: string;
|
|
1486
|
+
reads?: string[];
|
|
1487
|
+
gates?: ValidatorGate[];
|
|
1488
|
+
settings?: string[];
|
|
1489
|
+
}
|
|
1490
|
+
```
|
|
1491
|
+
|
|
1492
|
+
### ValidatorFunctionArgs
|
|
1493
|
+
|
|
1494
|
+
Arguments of a validator's `UpdateData` gate, which judges a participant's context write. `previous` is the state before the write; `next` is the proposed state after it. Validators are read-only: they return a verdict, never modify the proposed state.
|
|
1495
|
+
|
|
1496
|
+
```ts
|
|
1497
|
+
interface ValidatorFunctionArgs<TContext, TSettings> {
|
|
1498
|
+
previous: TContext;
|
|
1499
|
+
next: TContext;
|
|
1500
|
+
actor: ValidatorActor;
|
|
1501
|
+
settings: TSettings;
|
|
1502
|
+
meta: LogicMeta;
|
|
1503
|
+
participants: readonly Readonly<Participant>[];
|
|
1504
|
+
}
|
|
1505
|
+
```
|
|
1506
|
+
|
|
1507
|
+
### WaitingRoomUserInterfaceDefinition
|
|
1508
|
+
|
|
1509
|
+
Definition of a waiting room user interface (the holding screen shown to players while the session's waiting room is open)
|
|
1510
|
+
|
|
1511
|
+
```ts
|
|
1512
|
+
interface WaitingRoomUserInterfaceDefinition {
|
|
1513
|
+
identifier: string;
|
|
1514
|
+
reads?: string[];
|
|
1515
|
+
crossTeamReads?: string[];
|
|
1516
|
+
writes?: string[];
|
|
1517
|
+
endpoints?: string[];
|
|
1518
|
+
crossTeamParticipants?: boolean;
|
|
1519
|
+
settings?: string[];
|
|
1520
|
+
}
|
|
1521
|
+
```
|
|
1522
|
+
|
|
1523
|
+
## Types
|
|
1524
|
+
|
|
1525
|
+
### ApiUse
|
|
1526
|
+
|
|
1527
|
+
Runtime callback API (a service) a logic-bearing resource is permitted to invoke. A declared API is always present for that resource, and a runtime that cannot provide one a package declares refuses the package at load. Calling an undeclared API throws at runtime, in both dev and production. Resources that omit `uses` (or declare an empty array) cannot call any callbacks.
|
|
1528
|
+
|
|
1529
|
+
```ts
|
|
1530
|
+
type ApiUse = 'generateText' | 'extractText' | 'generateSpeech' | 'writeBlob';
|
|
1531
|
+
```
|
|
1532
|
+
|
|
1533
|
+
### ContentBlock
|
|
1534
|
+
|
|
1535
|
+
A content block inside an LLM message or response.
|
|
1536
|
+
|
|
1537
|
+
```ts
|
|
1538
|
+
type ContentBlock =
|
|
1539
|
+
| {
|
|
1540
|
+
type: 'text';
|
|
1541
|
+
text: string;
|
|
1542
|
+
}
|
|
1543
|
+
| {
|
|
1544
|
+
type: 'toolUse';
|
|
1545
|
+
id: string;
|
|
1546
|
+
name: string;
|
|
1547
|
+
input: unknown;
|
|
1548
|
+
}
|
|
1549
|
+
| {
|
|
1550
|
+
type: 'toolResult';
|
|
1551
|
+
toolUseId: string;
|
|
1552
|
+
content: string;
|
|
1553
|
+
isError?: boolean;
|
|
1554
|
+
};
|
|
1555
|
+
```
|
|
1556
|
+
|
|
1557
|
+
### ContextDeletePath
|
|
1558
|
+
|
|
1559
|
+
Where to remove a key, as a path from the root of the context.
|
|
1560
|
+
|
|
1561
|
+
```ts
|
|
1562
|
+
type ContextDeletePath = string | readonly string[];
|
|
1563
|
+
```
|
|
1564
|
+
|
|
1565
|
+
### ContextUpdate
|
|
1566
|
+
|
|
1567
|
+
A partial update accepted by `setData` and merged with `deepMergeContext`. Mirrors the merge semantics at the type level: object values may be given partially (they merge), while arrays and scalars must be given whole (they replace).
|
|
1568
|
+
|
|
1569
|
+
```ts
|
|
1570
|
+
type ContextUpdate<T> = {
|
|
1571
|
+
[K in keyof T]?: T[K] extends ReadonlyArray<unknown>
|
|
1572
|
+
? T[K]
|
|
1573
|
+
: T[K] extends Record<string, unknown>
|
|
1574
|
+
? ContextUpdate<T[K]>
|
|
1575
|
+
: T[K];
|
|
1576
|
+
};
|
|
1577
|
+
```
|
|
1578
|
+
|
|
1579
|
+
### EffectfulEndpointHandler
|
|
1580
|
+
|
|
1581
|
+
Function signature for an endpoint that returns an `EndpointResult`: one that declares `actions`, or a session-scoped one that writes team capabilities.
|
|
1582
|
+
|
|
1583
|
+
```ts
|
|
1584
|
+
type EffectfulEndpointHandler<
|
|
1585
|
+
TRequest = unknown,
|
|
1586
|
+
TResponse = unknown,
|
|
1587
|
+
TContext = unknown,
|
|
1588
|
+
TCallbacks = SignatureCallbacks,
|
|
1589
|
+
TTeamContext = never,
|
|
1590
|
+
TScope extends EndpointScope = 'team',
|
|
1591
|
+
TSettings = Record<string, never>,
|
|
1592
|
+
TWrites = never,
|
|
1593
|
+
TAction extends EndpointAction = never,
|
|
1594
|
+
TTeamWrites = never,
|
|
1595
|
+
> = (
|
|
1596
|
+
args: EndpointHandlerArgs<TRequest, TContext, TCallbacks, TTeamContext, TScope, TSettings>
|
|
1597
|
+
) => Promise<EndpointResult<TResponse, TWrites, TAction, TTeamWrites>>;
|
|
1598
|
+
```
|
|
1599
|
+
|
|
1600
|
+
### EffectStep
|
|
1601
|
+
|
|
1602
|
+
One effect of an endpoint's result, in the order the runtime applies them: the endpoint's own `capabilities`, then each team's patch under `teams`, then each action by its position in `actions`.
|
|
1603
|
+
|
|
1604
|
+
```ts
|
|
1605
|
+
type EffectStep =
|
|
1606
|
+
| {
|
|
1607
|
+
kind: 'capabilities';
|
|
1608
|
+
}
|
|
1609
|
+
| {
|
|
1610
|
+
kind: 'teams';
|
|
1611
|
+
teamId: string;
|
|
1612
|
+
}
|
|
1613
|
+
| {
|
|
1614
|
+
kind: 'action';
|
|
1615
|
+
index: number;
|
|
1616
|
+
type: EndpointActionType;
|
|
1617
|
+
};
|
|
1618
|
+
```
|
|
1619
|
+
|
|
1620
|
+
### EndpointAction
|
|
1621
|
+
|
|
1622
|
+
A session action an endpoint returns for the runtime to carry out.
|
|
1623
|
+
|
|
1624
|
+
```ts
|
|
1625
|
+
type EndpointAction =
|
|
1626
|
+
| {
|
|
1627
|
+
type: 'tick';
|
|
1628
|
+
teamId?: string;
|
|
1629
|
+
}
|
|
1630
|
+
| {
|
|
1631
|
+
type: 'setWaitingRoom';
|
|
1632
|
+
open: boolean;
|
|
1633
|
+
}
|
|
1634
|
+
| {
|
|
1635
|
+
type: 'pauseTimer';
|
|
1636
|
+
teamId?: string;
|
|
1637
|
+
}
|
|
1638
|
+
| {
|
|
1639
|
+
type: 'resumeTimer';
|
|
1640
|
+
teamId?: string;
|
|
1641
|
+
}
|
|
1642
|
+
| {
|
|
1643
|
+
type: 'extendTick';
|
|
1644
|
+
byMs: number;
|
|
1645
|
+
teamId?: string;
|
|
1646
|
+
}
|
|
1647
|
+
| {
|
|
1648
|
+
type: 'renameTeam';
|
|
1649
|
+
name: string;
|
|
1650
|
+
teamId?: string;
|
|
1651
|
+
}
|
|
1652
|
+
| {
|
|
1653
|
+
type: 'moveParticipant';
|
|
1654
|
+
participantId: string;
|
|
1655
|
+
teamId: string;
|
|
1656
|
+
}
|
|
1657
|
+
| {
|
|
1658
|
+
type: 'addTeam';
|
|
1659
|
+
name?: string;
|
|
1660
|
+
}
|
|
1661
|
+
| {
|
|
1662
|
+
type: 'setLocale';
|
|
1663
|
+
locale: string;
|
|
1664
|
+
};
|
|
1665
|
+
```
|
|
1666
|
+
|
|
1667
|
+
### EndpointActionType
|
|
1668
|
+
|
|
1669
|
+
A session action an endpoint may return for the runtime to carry out after its write. Each is the operation a facilitator's session surface can perform, held to the same rules; an endpoint may return only the actions it declares.
|
|
1670
|
+
|
|
1671
|
+
```ts
|
|
1672
|
+
type EndpointActionType =
|
|
1673
|
+
| 'tick'
|
|
1674
|
+
| 'setWaitingRoom'
|
|
1675
|
+
| 'pauseTimer'
|
|
1676
|
+
| 'resumeTimer'
|
|
1677
|
+
| 'extendTick'
|
|
1678
|
+
| 'renameTeam'
|
|
1679
|
+
| 'moveParticipant'
|
|
1680
|
+
| 'addTeam'
|
|
1681
|
+
| 'setLocale';
|
|
1682
|
+
```
|
|
1683
|
+
|
|
1684
|
+
### EndpointCallerRole
|
|
1685
|
+
|
|
1686
|
+
Who is calling an endpoint.
|
|
1687
|
+
|
|
1688
|
+
```ts
|
|
1689
|
+
type EndpointCallerRole = ViewerRole | 'facilitator' | 'author' | 'external';
|
|
1690
|
+
```
|
|
1691
|
+
|
|
1692
|
+
### EndpointCallResult
|
|
1693
|
+
|
|
1694
|
+
How an endpoint call settled: its response, or an `EndpointFailure`.
|
|
1695
|
+
|
|
1696
|
+
```ts
|
|
1697
|
+
type EndpointCallResult =
|
|
1698
|
+
| {
|
|
1699
|
+
ok: true;
|
|
1700
|
+
response: unknown;
|
|
1701
|
+
}
|
|
1702
|
+
| ({
|
|
1703
|
+
ok: false;
|
|
1704
|
+
} & EndpointFailure);
|
|
1705
|
+
```
|
|
1706
|
+
|
|
1707
|
+
### EndpointFailureOutcome
|
|
1708
|
+
|
|
1709
|
+
Why an endpoint call failed.
|
|
1710
|
+
|
|
1711
|
+
```ts
|
|
1712
|
+
type EndpointFailureOutcome =
|
|
1713
|
+
| MutationOutcome
|
|
1714
|
+
| {
|
|
1715
|
+
kind: 'invalid-request';
|
|
1716
|
+
message: string;
|
|
1717
|
+
}
|
|
1718
|
+
| {
|
|
1719
|
+
kind: 'handler-error';
|
|
1720
|
+
message: string;
|
|
1721
|
+
}
|
|
1722
|
+
| {
|
|
1723
|
+
kind: 'invalid-response';
|
|
1724
|
+
message: string;
|
|
1725
|
+
};
|
|
1726
|
+
```
|
|
1727
|
+
|
|
1728
|
+
### EndpointHandler
|
|
1729
|
+
|
|
1730
|
+
Function signature for an endpoint that declares no `writes`. The runtime never persists anything on its behalf: the returned value is validated against the endpoint's `responseSchema` and surfaced to the caller as-is.
|
|
1731
|
+
|
|
1732
|
+
```ts
|
|
1733
|
+
type EndpointHandler<
|
|
1734
|
+
TRequest = unknown,
|
|
1735
|
+
TResponse = unknown,
|
|
1736
|
+
TContext = unknown,
|
|
1737
|
+
TCallbacks = SignatureCallbacks,
|
|
1738
|
+
TTeamContext = never,
|
|
1739
|
+
TScope extends EndpointScope = 'team',
|
|
1740
|
+
TSettings = Record<string, never>,
|
|
1741
|
+
> = (
|
|
1742
|
+
args: EndpointHandlerArgs<TRequest, TContext, TCallbacks, TTeamContext, TScope, TSettings>
|
|
1743
|
+
) => Promise<TResponse>;
|
|
1744
|
+
```
|
|
1745
|
+
|
|
1746
|
+
### EndpointHandlerArgs
|
|
1747
|
+
|
|
1748
|
+
Argument shape passed to an endpoint handler. The handler's input is the entire surface: nothing else leaks in — no headers, no cookies, no fetch.
|
|
1749
|
+
|
|
1750
|
+
```ts
|
|
1751
|
+
type EndpointHandlerArgs<
|
|
1752
|
+
TRequest,
|
|
1753
|
+
TContext,
|
|
1754
|
+
TCallbacks = SignatureCallbacks,
|
|
1755
|
+
TTeamContext = never,
|
|
1756
|
+
TScope extends EndpointScope = 'team',
|
|
1757
|
+
TSettings = Record<string, never>,
|
|
1758
|
+
> = EndpointBaseArgs<TRequest, TContext, TCallbacks, TSettings> &
|
|
1759
|
+
(TScope extends 'session' ? SessionEndpointArgs<TTeamContext> : TeamEndpointArgs);
|
|
1760
|
+
```
|
|
1761
|
+
|
|
1762
|
+
### EndpointPlan
|
|
1763
|
+
|
|
1764
|
+
What `Plan` returns, for an endpoint that answers in two phases: its effects alone. The response is `Respond`'s to write, once they have landed.
|
|
1765
|
+
|
|
1766
|
+
```ts
|
|
1767
|
+
type EndpointPlan<
|
|
1768
|
+
TWrites = never,
|
|
1769
|
+
TAction extends EndpointAction = never,
|
|
1770
|
+
TTeamWrites = never,
|
|
1771
|
+
> = Omit<EndpointResult<never, TWrites, TAction, TTeamWrites>, 'response'>;
|
|
1772
|
+
```
|
|
1773
|
+
|
|
1774
|
+
### EndpointPlanner
|
|
1775
|
+
|
|
1776
|
+
`Plan`: the first phase of an endpoint that answers in two. It decides what happens and returns no response; `Respond` writes that once the effects have landed. An endpoint that answers in one exports `Handle` instead.
|
|
1777
|
+
|
|
1778
|
+
```ts
|
|
1779
|
+
type EndpointPlanner<
|
|
1780
|
+
TRequest = unknown,
|
|
1781
|
+
TContext = unknown,
|
|
1782
|
+
TCallbacks = SignatureCallbacks,
|
|
1783
|
+
TTeamContext = never,
|
|
1784
|
+
TScope extends EndpointScope = 'team',
|
|
1785
|
+
TSettings = Record<string, never>,
|
|
1786
|
+
TWrites = never,
|
|
1787
|
+
TAction extends EndpointAction = never,
|
|
1788
|
+
TTeamWrites = never,
|
|
1789
|
+
> = (
|
|
1790
|
+
args: EndpointHandlerArgs<TRequest, TContext, TCallbacks, TTeamContext, TScope, TSettings>
|
|
1791
|
+
) => Promise<EndpointPlan<TWrites, TAction, TTeamWrites>>;
|
|
1792
|
+
```
|
|
1793
|
+
|
|
1794
|
+
### EndpointResponder
|
|
1795
|
+
|
|
1796
|
+
`Respond`: the second phase, called once `Plan`'s effects have landed. It receives every argument `Plan` did, read afresh, plus what `Plan` returned and what each action came to. Its return is the response, validated against `responseSchema`. It changes nothing.
|
|
1797
|
+
|
|
1798
|
+
```ts
|
|
1799
|
+
type EndpointResponder<
|
|
1800
|
+
TRequest = unknown,
|
|
1801
|
+
TResponse = unknown,
|
|
1802
|
+
TContext = unknown,
|
|
1803
|
+
TCallbacks = SignatureCallbacks,
|
|
1804
|
+
TTeamContext = never,
|
|
1805
|
+
TScope extends EndpointScope = 'team',
|
|
1806
|
+
TSettings = Record<string, never>,
|
|
1807
|
+
TWrites = never,
|
|
1808
|
+
TAction extends EndpointAction = never,
|
|
1809
|
+
TTeamWrites = never,
|
|
1810
|
+
> = (
|
|
1811
|
+
args: EndpointHandlerArgs<TRequest, TContext, TCallbacks, TTeamContext, TScope, TSettings> & {
|
|
1812
|
+
plan: EndpointPlan<TWrites, TAction, TTeamWrites>;
|
|
1813
|
+
outcomes: EndpointOutcome[];
|
|
1814
|
+
}
|
|
1815
|
+
) => Promise<TResponse>;
|
|
1816
|
+
```
|
|
1817
|
+
|
|
1818
|
+
### EndpointScope
|
|
1819
|
+
|
|
1820
|
+
What an endpoint call acts on. Absent in a bundle means `team`.
|
|
1821
|
+
|
|
1822
|
+
```ts
|
|
1823
|
+
type EndpointScope = NonNullable<EndpointDefinition['scope']>;
|
|
1824
|
+
```
|
|
1825
|
+
|
|
1826
|
+
### ExtractTextFunction
|
|
1827
|
+
|
|
1828
|
+
Function for extracting text from a document referenced under the unified asset URI scheme.
|
|
1829
|
+
|
|
1830
|
+
```ts
|
|
1831
|
+
type ExtractTextFunction = (reference: string) => Promise<ExtractTextResponse>;
|
|
1832
|
+
```
|
|
1833
|
+
|
|
1834
|
+
### GenerateSpeechFormat
|
|
1835
|
+
|
|
1836
|
+
Audio container format for synthesised speech.
|
|
1837
|
+
|
|
1838
|
+
```ts
|
|
1839
|
+
type GenerateSpeechFormat = 'mp3' | 'wav' | 'opus';
|
|
1840
|
+
```
|
|
1841
|
+
|
|
1842
|
+
### GenerateSpeechFunction
|
|
1843
|
+
|
|
1844
|
+
Function for synthesising speech.
|
|
1845
|
+
|
|
1846
|
+
```ts
|
|
1847
|
+
type GenerateSpeechFunction = (
|
|
1848
|
+
request: GenerateSpeechRequest | string
|
|
1849
|
+
) => Promise<GenerateSpeechResponse>;
|
|
1850
|
+
```
|
|
1851
|
+
|
|
1852
|
+
### GenerateSpeechVoice
|
|
1853
|
+
|
|
1854
|
+
Role-based voice preset. The runtime maps the preset to a concrete provider voice. Game code only ever passes the preset name. The five values below are the recommended starting set; runtimes may accept additional preset names.
|
|
1855
|
+
|
|
1856
|
+
```ts
|
|
1857
|
+
type GenerateSpeechVoice = 'neutral' | 'narrator' | 'announcer' | 'executive' | 'coach';
|
|
1858
|
+
```
|
|
1859
|
+
|
|
1860
|
+
### GetTickControllerFunction
|
|
1861
|
+
|
|
1862
|
+
```ts
|
|
1863
|
+
type GetTickControllerFunction<TContext, TSettings, TCallbacks = SignatureCallbacks> = (
|
|
1864
|
+
args: TickControllerFunctionArgs<TContext, TSettings, TCallbacks>
|
|
1865
|
+
) => Promise<TickControllerResult>;
|
|
1866
|
+
```
|
|
1867
|
+
|
|
1868
|
+
### HookFunction
|
|
1869
|
+
|
|
1870
|
+
Function signature for a hook. Returns its writes under `capabilities`, the same shape an engine returns: hooks fire after the runtime applies the lifecycle change, then the runtime merges and persists what they return.
|
|
1871
|
+
|
|
1872
|
+
```ts
|
|
1873
|
+
type HookFunction<
|
|
1874
|
+
S extends HookSignal = HookSignal,
|
|
1875
|
+
TContext = unknown,
|
|
1876
|
+
TSettings = unknown,
|
|
1877
|
+
TCallbacks = SignatureCallbacks,
|
|
1878
|
+
> = (args: HookFunctionArgs<S, TContext, TSettings, TCallbacks>) => Promise<LogicResult<TContext>>;
|
|
1879
|
+
```
|
|
1880
|
+
|
|
1881
|
+
### HookFunctionArgs
|
|
1882
|
+
|
|
1883
|
+
Argument shape passed to a hook function. The signal-specific payload fields are spread alongside `context`, `settings`, and `callbacks` so consumers can destructure them directly (e.g. `({ context, participant }) => ...`).
|
|
1884
|
+
|
|
1885
|
+
```ts
|
|
1886
|
+
type HookFunctionArgs<
|
|
1887
|
+
S extends HookSignal,
|
|
1888
|
+
TContext,
|
|
1889
|
+
TSettings,
|
|
1890
|
+
TCallbacks = SignatureCallbacks,
|
|
1891
|
+
> = HookPayload<S> & {
|
|
1892
|
+
context: TContext;
|
|
1893
|
+
settings: TSettings;
|
|
1894
|
+
callbacks: TCallbacks;
|
|
1895
|
+
meta: LogicMeta;
|
|
1896
|
+
participants: readonly Readonly<Participant>[];
|
|
1897
|
+
};
|
|
1898
|
+
```
|
|
1899
|
+
|
|
1900
|
+
### HookPayload
|
|
1901
|
+
|
|
1902
|
+
Payload for a hook subscribed to signal `S`. Defaults to the union across all signals so callers that haven't pinned a signal still get a valid type.
|
|
1903
|
+
|
|
1904
|
+
```ts
|
|
1905
|
+
type HookPayload<S extends HookSignal = HookSignal> = HookPayloadMap[S];
|
|
1906
|
+
```
|
|
1907
|
+
|
|
1908
|
+
### HookSignal
|
|
1909
|
+
|
|
1910
|
+
Lifecycle signal a hook subscribes to. Hooks fire on out-of-tick events emitted by the runtime, after the runtime applies the change.
|
|
1911
|
+
|
|
1912
|
+
```ts
|
|
1913
|
+
type HookSignal = 'participantJoin' | 'participantMove';
|
|
1914
|
+
```
|
|
1915
|
+
|
|
1916
|
+
### HostOverlay
|
|
1917
|
+
|
|
1918
|
+
A host-rendered overlay a session surface may ask the host to open.
|
|
1919
|
+
|
|
1920
|
+
```ts
|
|
1921
|
+
type HostOverlay = 'facilitator-guide' | 'print-sheets';
|
|
1922
|
+
```
|
|
1923
|
+
|
|
1924
|
+
### InitAggregateFunction
|
|
1925
|
+
|
|
1926
|
+
```ts
|
|
1927
|
+
type InitAggregateFunction<
|
|
1928
|
+
TTeamContext,
|
|
1929
|
+
TSharedContext,
|
|
1930
|
+
TSettings,
|
|
1931
|
+
TCallbacks = SignatureCallbacks,
|
|
1932
|
+
TTeamState = never,
|
|
1933
|
+
TSharedState = never,
|
|
1934
|
+
> = (
|
|
1935
|
+
args: RunAggregateFunctionArgs<
|
|
1936
|
+
TTeamContext,
|
|
1937
|
+
TSharedContext,
|
|
1938
|
+
TSettings,
|
|
1939
|
+
TCallbacks,
|
|
1940
|
+
TTeamState,
|
|
1941
|
+
TSharedState
|
|
1942
|
+
>
|
|
1943
|
+
) => Promise<RunAggregateResult<TTeamContext, TSharedContext, TTeamState, TSharedState>>;
|
|
1944
|
+
```
|
|
1945
|
+
|
|
1946
|
+
### InitializationFunction
|
|
1947
|
+
|
|
1948
|
+
```ts
|
|
1949
|
+
type InitializationFunction<
|
|
1950
|
+
TContext,
|
|
1951
|
+
TSettings,
|
|
1952
|
+
TCallbacks = SignatureCallbacks,
|
|
1953
|
+
TState = never,
|
|
1954
|
+
> = (
|
|
1955
|
+
args: EngineFunctionArgs<TContext, TSettings, TCallbacks, TState>
|
|
1956
|
+
) => Promise<EngineResult<TContext, TState>>;
|
|
1957
|
+
```
|
|
1958
|
+
|
|
1959
|
+
### LLMGenerateFunction
|
|
1960
|
+
|
|
1961
|
+
Function for generating text with an LLM The actual endpoint and model are determined by the platform
|
|
1962
|
+
|
|
1963
|
+
```ts
|
|
1964
|
+
type LLMGenerateFunction = (options: LLMGenerateOptions | string) => Promise<LLMResponse>;
|
|
1965
|
+
```
|
|
1966
|
+
|
|
1967
|
+
### LLMStopReason
|
|
1968
|
+
|
|
1969
|
+
Why the LLM stopped generating.
|
|
1970
|
+
|
|
1971
|
+
```ts
|
|
1972
|
+
type LLMStopReason = 'endTurn' | 'toolUse' | 'maxTokens' | 'refusal';
|
|
1973
|
+
```
|
|
1974
|
+
|
|
1975
|
+
### LLMTier
|
|
1976
|
+
|
|
1977
|
+
LLM capability tier for a generateText call.
|
|
1978
|
+
|
|
1979
|
+
```ts
|
|
1980
|
+
type LLMTier = 'quick' | 'standard' | 'expert';
|
|
1981
|
+
```
|
|
1982
|
+
|
|
1983
|
+
### LogicCallbacks
|
|
1984
|
+
|
|
1985
|
+
The callbacks a logic-bearing resource actually receives: the gated ones it declared in `uses`, plus the ungated ones it gets regardless.
|
|
1986
|
+
|
|
1987
|
+
```ts
|
|
1988
|
+
type LogicCallbacks<Uses extends ApiUse = never> = Required<Pick<SignatureCallbacks, Uses>> &
|
|
1989
|
+
UngatedSignatureCallbacks;
|
|
1990
|
+
```
|
|
1991
|
+
|
|
1992
|
+
### RequestTickFunction
|
|
1993
|
+
|
|
1994
|
+
A validator's `RequestTick` export: the gate on a participant's request for the next tick. Only a player surface's request reaches it; the facilitator's ticks, the timer's and every system-trusted caller's pass straight through.
|
|
1995
|
+
|
|
1996
|
+
```ts
|
|
1997
|
+
type RequestTickFunction<TContext = unknown, TSettings = unknown> = (
|
|
1998
|
+
args: RequestTickFunctionArgs<TContext, TSettings>
|
|
1999
|
+
) => Promise<ValidationResult>;
|
|
2000
|
+
```
|
|
2001
|
+
|
|
2002
|
+
### RunAggregateFunction
|
|
2003
|
+
|
|
2004
|
+
```ts
|
|
2005
|
+
type RunAggregateFunction<
|
|
2006
|
+
TTeamContext,
|
|
2007
|
+
TSharedContext,
|
|
2008
|
+
TSettings,
|
|
2009
|
+
TCallbacks = SignatureCallbacks,
|
|
2010
|
+
TTeamState = never,
|
|
2011
|
+
TSharedState = never,
|
|
2012
|
+
> = (
|
|
2013
|
+
args: RunAggregateFunctionArgs<
|
|
2014
|
+
TTeamContext,
|
|
2015
|
+
TSharedContext,
|
|
2016
|
+
TSettings,
|
|
2017
|
+
TCallbacks,
|
|
2018
|
+
TTeamState,
|
|
2019
|
+
TSharedState
|
|
2020
|
+
>
|
|
2021
|
+
) => Promise<RunAggregateTickResult<TTeamContext, TSharedContext, TTeamState, TSharedState>>;
|
|
2022
|
+
```
|
|
2023
|
+
|
|
2024
|
+
### RunFunction
|
|
2025
|
+
|
|
2026
|
+
```ts
|
|
2027
|
+
type RunFunction<TContext, TSettings, TCallbacks = SignatureCallbacks, TState = never> = (
|
|
2028
|
+
args: EngineFunctionArgs<TContext, TSettings, TCallbacks, TState>
|
|
2029
|
+
) => Promise<RunResult<TContext, TState>>;
|
|
2030
|
+
```
|
|
2031
|
+
|
|
2032
|
+
### RunKind
|
|
2033
|
+
|
|
2034
|
+
Which kind of run a function is executing in.
|
|
2035
|
+
|
|
2036
|
+
```ts
|
|
2037
|
+
type RunKind = 'session' | 'walkthrough';
|
|
2038
|
+
```
|
|
2039
|
+
|
|
2040
|
+
### StepFunction
|
|
2041
|
+
|
|
2042
|
+
One step of an engine that splits its `Init` or `Run` into several functions.
|
|
2043
|
+
|
|
2044
|
+
```ts
|
|
2045
|
+
type StepFunction<TContext, TSettings, TCallbacks = SignatureCallbacks, TState = unknown> = (
|
|
2046
|
+
args: EngineFunctionArgs<TContext, TSettings, TCallbacks, TState>
|
|
2047
|
+
) => Promise<TContext>;
|
|
2048
|
+
```
|
|
2049
|
+
|
|
2050
|
+
### ThemePreference
|
|
2051
|
+
|
|
2052
|
+
The host's theme preference. `'system'` means the host follows the operating system's colour scheme; `'light'` and `'dark'` are explicit choices. Distinct from the resolved palette delivered to UIs through the theme channel — a UI reading `'system'` knows the host has not overridden the OS, which the resolved light/dark mode alone cannot tell it.
|
|
2053
|
+
|
|
2054
|
+
```ts
|
|
2055
|
+
type ThemePreference = 'light' | 'dark' | 'system';
|
|
2056
|
+
```
|
|
2057
|
+
|
|
2058
|
+
### UngatedSignatureCallbacks
|
|
2059
|
+
|
|
2060
|
+
The `SignatureCallbacks` members that `uses` does not gate.
|
|
2061
|
+
|
|
2062
|
+
```ts
|
|
2063
|
+
type UngatedSignatureCallbacks = Pick<SignatureCallbacks, 'readAsset' | 'getPastState'>;
|
|
2064
|
+
```
|
|
2065
|
+
|
|
2066
|
+
### ValidationResult
|
|
2067
|
+
|
|
2068
|
+
Verdict returned by a validator. `ok: true` means the proposed state passes this check; `ok: false` rejects it and the runtime returns the message to the caller. The message is free-form — games encode structured data (locale key, JSON blob, etc.) inside it if they need to.
|
|
2069
|
+
|
|
2070
|
+
```ts
|
|
2071
|
+
type ValidationResult =
|
|
2072
|
+
| {
|
|
2073
|
+
ok: true;
|
|
2074
|
+
}
|
|
2075
|
+
| {
|
|
2076
|
+
ok: false;
|
|
2077
|
+
message: string;
|
|
2078
|
+
};
|
|
2079
|
+
```
|
|
2080
|
+
|
|
2081
|
+
### ValidatorActor
|
|
2082
|
+
|
|
2083
|
+
Who submitted the mutation a validator is gating.
|
|
2084
|
+
|
|
2085
|
+
```ts
|
|
2086
|
+
type ValidatorActor =
|
|
2087
|
+
| {
|
|
2088
|
+
role: 'participant';
|
|
2089
|
+
participant: Participant;
|
|
2090
|
+
}
|
|
2091
|
+
| {
|
|
2092
|
+
role: 'observer';
|
|
2093
|
+
teamId: string;
|
|
2094
|
+
};
|
|
2095
|
+
```
|
|
2096
|
+
|
|
2097
|
+
### ValidatorFunction
|
|
2098
|
+
|
|
2099
|
+
A validator's `UpdateData` export: the gate on a participant's context write. Engines, hooks, endpoints and a session surface bypass it (system-trusted).
|
|
2100
|
+
|
|
2101
|
+
```ts
|
|
2102
|
+
type ValidatorFunction<TContext = unknown, TSettings = unknown> = (
|
|
2103
|
+
args: ValidatorFunctionArgs<TContext, TSettings>
|
|
2104
|
+
) => Promise<ValidationResult>;
|
|
2105
|
+
```
|
|
2106
|
+
|
|
2107
|
+
### ValidatorGate
|
|
2108
|
+
|
|
2109
|
+
A participant action a validator can gate, named after the surface message it gates: a context write, or a request for the next tick
|
|
2110
|
+
|
|
2111
|
+
```ts
|
|
2112
|
+
type ValidatorGate = 'updateData' | 'requestTick';
|
|
2113
|
+
```
|
|
2114
|
+
|
|
2115
|
+
### WaitingRoomUserInterfaceCallbacks
|
|
2116
|
+
|
|
2117
|
+
Callbacks available to waiting room user interface components.
|
|
2118
|
+
|
|
2119
|
+
```ts
|
|
2120
|
+
type WaitingRoomUserInterfaceCallbacks = UserInterfaceCallbacks;
|
|
2121
|
+
```
|
|
2122
|
+
|
|
2123
|
+
### WritingEndpointHandler
|
|
2124
|
+
|
|
2125
|
+
Function signature for an endpoint that declares `writes`.
|
|
2126
|
+
|
|
2127
|
+
```ts
|
|
2128
|
+
type WritingEndpointHandler<
|
|
2129
|
+
TRequest = unknown,
|
|
2130
|
+
TResponse = unknown,
|
|
2131
|
+
TWrites = unknown,
|
|
2132
|
+
TContext = unknown,
|
|
2133
|
+
TCallbacks = SignatureCallbacks,
|
|
2134
|
+
TTeamContext = never,
|
|
2135
|
+
TScope extends EndpointScope = 'team',
|
|
2136
|
+
TSettings = Record<string, never>,
|
|
2137
|
+
> = (
|
|
2138
|
+
args: EndpointHandlerArgs<TRequest, TContext, TCallbacks, TTeamContext, TScope, TSettings>
|
|
2139
|
+
) => Promise<EndpointWriteResult<TResponse, TWrites>>;
|
|
2140
|
+
```
|