@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,783 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host ↔ iframe MessagePort protocol (§12), as the host speaks it.
|
|
3
|
+
*
|
|
4
|
+
* Platform-facing, exported from
|
|
5
|
+
* `@seriousgaming/sdk-tools/host`. The guest half of the
|
|
6
|
+
* same protocol is private to the UI wrappers in
|
|
7
|
+
* `@seriousgaming/sdk/ui`: game code never sees a wire
|
|
8
|
+
* message, so the SDK does not export one. Each package therefore holds its
|
|
9
|
+
* own definition, and `protocol.parity.test.ts` fails to compile the moment
|
|
10
|
+
* the two disagree, so extending a union here without extending the guest's
|
|
11
|
+
* (or the reverse) is caught before either ships.
|
|
12
|
+
*/
|
|
13
|
+
import type { ContextDeletePath, EndpointFailure, HostOverlay, Participant, PastStateEntry, PastStateQuery, ThemePreference, TimerState, ValidationRejection } from '@seriousgaming/sdk';
|
|
14
|
+
import type { CrossTeamData, MutationOutcome, OwnTeamJoinLink, PresentationGame, PresentationSession, RunKind, SessionData, SessionHookFailure, SessionMeta, SharedState, TeamConfiguration, TeamInfo, TeamLinks, TeamState, UserInterfaceLocale, UserInterfaceTheme, ViewerRole, WalkthroughLink } from '@seriousgaming/sdk/ui';
|
|
15
|
+
/**
|
|
16
|
+
* Version of the host↔iframe handshake protocol. Both ends stamp it on the
|
|
17
|
+
* `ready`/`init` window messages and warn (without blocking) when the peer's
|
|
18
|
+
* declared version differs, so a host and an SDK build that have drifted apart
|
|
19
|
+
* surface a diagnostic instead of failing silently. Bump on any
|
|
20
|
+
* backwards-incompatible change to the handshake or port message contract.
|
|
21
|
+
*
|
|
22
|
+
* Version 2 adds `updateTeamState`: a host may deliver an ongoing session-data
|
|
23
|
+
* change as one team's state rather than the whole session's, and a session
|
|
24
|
+
* wrapper merges it. `setSessionData` remains the full snapshot on handshake
|
|
25
|
+
* and on resync, so a host that only ever sends the snapshot is still
|
|
26
|
+
* conformant.
|
|
27
|
+
*
|
|
28
|
+
* Version 3 gives shared state its own channel: `SessionData` carries the
|
|
29
|
+
* shared store once as `shared`, each team's `context` carries team scope
|
|
30
|
+
* only, and `updateSharedState` delivers a change to the store as one message
|
|
31
|
+
* rather than one per team.
|
|
32
|
+
*
|
|
33
|
+
* Version 4 gives each concept one name (#634): the context push `setData`
|
|
34
|
+
* becomes `stateChanged`, carrying `completedTicks` where it carried `tick`;
|
|
35
|
+
* `updateConfig` becomes `updateSettings`; a settings editor receives
|
|
36
|
+
* `setSettings` in place of `setResolvedConfiguration`; `extendTick` carries
|
|
37
|
+
* `byMs`; `pauseTimer` and `resumeTimer` carry a `requestId`; timers are one
|
|
38
|
+
* `TimerState` in milliseconds; participants and teams share one shape; and
|
|
39
|
+
* a failed `callEndpoint:response` carries an `EndpointFailure` (`outcome`,
|
|
40
|
+
* `applied`, `failedStep`) where it carried an `error` string (#636); and
|
|
41
|
+
* configuration UIs become the `setup` and `scenario_editor` slots, which are
|
|
42
|
+
* sent no `setConfigurationSurface` (#637). `init` carries the `sessionKey` a
|
|
43
|
+
* surface namespaces its own storage by, and every theme colour carries a
|
|
44
|
+
* `contrastText` (#638).
|
|
45
|
+
* Version 3 never shipped, so version 4 is the version that ships with
|
|
46
|
+
* manifest version 3, and a host serving an earlier package speaks the
|
|
47
|
+
* version that package was built for.
|
|
48
|
+
*
|
|
49
|
+
* There is deliberately no capability-negotiation list here. The version alone
|
|
50
|
+
* is the gate, and it can be, because no published package predates the
|
|
51
|
+
* feature: it ships in the same release as manifest version 2, and a host
|
|
52
|
+
* serving a version 1 package sends full snapshots to it.
|
|
53
|
+
*/
|
|
54
|
+
export declare const UI_PROTOCOL_VERSION = 4;
|
|
55
|
+
/** Window-level message: iframe → host. Signals the iframe is ready to establish a port. */
|
|
56
|
+
export type IFrameMessage = {
|
|
57
|
+
type: 'ready';
|
|
58
|
+
protocolVersion: number;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Window-level message: host → iframe. Carries port2 as a transfer.
|
|
62
|
+
*
|
|
63
|
+
* `sessionKey` is opaque, stable for the run, unique to it, and names nothing
|
|
64
|
+
* the host would act on: a namespace for the surface's own browser storage,
|
|
65
|
+
* never an address for the session (§12.2).
|
|
66
|
+
*/
|
|
67
|
+
export type HostWindowMessage = {
|
|
68
|
+
type: 'init';
|
|
69
|
+
protocolVersion: number;
|
|
70
|
+
sessionKey: string;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Absolute URL prefixes the runtime supplies to UI wrappers so they can build
|
|
74
|
+
* asset URLs synchronously from an asset reference. Wrappers strip the
|
|
75
|
+
* `asset:`, `shared:`, or `blob:` scheme from the reference and concatenate the
|
|
76
|
+
* remainder with the matching prefix. All prefixes MUST end with `/`. The
|
|
77
|
+
* runtime bakes any active scenario version into `scenarioAssetPrefix` and does
|
|
78
|
+
* not re-escape the path argument. `assetAuthRedeemUrl` is the absolute URL the
|
|
79
|
+
* iframe POSTs a token to (with `credentials: 'include'`) to refresh the
|
|
80
|
+
* asset-domain cookie when the host sends `refreshAssetAuth`.
|
|
81
|
+
*/
|
|
82
|
+
export interface AssetUrls {
|
|
83
|
+
/** Absolute prefix prepended to a `blob:<id>` reference's id. */
|
|
84
|
+
blobPrefix: string;
|
|
85
|
+
/** Absolute prefix prepended to an `asset:<path>` reference's path. */
|
|
86
|
+
scenarioAssetPrefix: string;
|
|
87
|
+
/** Absolute prefix prepended to a `shared:<path>` reference's path. */
|
|
88
|
+
sharedAssetPrefix: string;
|
|
89
|
+
/** Absolute URL the iframe POSTs to to redeem an asset-auth token. */
|
|
90
|
+
assetAuthRedeemUrl: string;
|
|
91
|
+
}
|
|
92
|
+
/** Port messages sent from host to game UI iframe */
|
|
93
|
+
export type HostPortMessage = {
|
|
94
|
+
type: 'ping';
|
|
95
|
+
} | {
|
|
96
|
+
type: 'stateChanged';
|
|
97
|
+
payload: Record<string, unknown>;
|
|
98
|
+
completedTicks: number;
|
|
99
|
+
} | {
|
|
100
|
+
type: 'setCrossTeamData';
|
|
101
|
+
payload: CrossTeamData;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The settings resources this surface declared, resolved and keyed by
|
|
105
|
+
* identifier (§8). Sent on load and whenever they change, never with a
|
|
106
|
+
* context write.
|
|
107
|
+
*/
|
|
108
|
+
| {
|
|
109
|
+
type: 'setSettings';
|
|
110
|
+
payload: Record<string, Record<string, unknown>>;
|
|
111
|
+
} | {
|
|
112
|
+
type: 'setTheme';
|
|
113
|
+
payload: UserInterfaceTheme;
|
|
114
|
+
} | {
|
|
115
|
+
type: 'setLocale';
|
|
116
|
+
payload: UserInterfaceLocale;
|
|
117
|
+
} | {
|
|
118
|
+
type: 'setParticipant';
|
|
119
|
+
payload: Participant;
|
|
120
|
+
} | {
|
|
121
|
+
type: 'setViewerRole';
|
|
122
|
+
role: ViewerRole;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Whether this surface belongs to the game being played or to a walkthrough
|
|
126
|
+
* beside it (§5.7). Sent in the initial batch and never again: the kind is
|
|
127
|
+
* fixed for a run's lifetime, and the value the engine reads is the same
|
|
128
|
+
* one delivered here.
|
|
129
|
+
*
|
|
130
|
+
* The wrapper's `'session'` default is a fallback for a host predating this
|
|
131
|
+
* message, not a licence to leave it out (§12.3).
|
|
132
|
+
*/
|
|
133
|
+
| {
|
|
134
|
+
type: 'setRunKind';
|
|
135
|
+
runKind: RunKind;
|
|
136
|
+
} | {
|
|
137
|
+
type: 'setTimer';
|
|
138
|
+
payload: TimerState;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Whether a tick is being processed right now.
|
|
142
|
+
*
|
|
143
|
+
* Writes are unaffected: they are queued and applied after the tick, as
|
|
144
|
+
* they always were (§9.7). This message exists so a participant surface can
|
|
145
|
+
* say what is happening instead of appearing to have stopped responding —
|
|
146
|
+
* at a large cohort a lockstep tick takes long enough to notice, and a
|
|
147
|
+
* participant did not press the button, so they have nothing else to
|
|
148
|
+
* attribute the pause to.
|
|
149
|
+
*/
|
|
150
|
+
| {
|
|
151
|
+
type: 'setRoundProcessing';
|
|
152
|
+
processing: boolean;
|
|
153
|
+
} | {
|
|
154
|
+
type: 'setParticipantList';
|
|
155
|
+
participants: Participant[];
|
|
156
|
+
} | {
|
|
157
|
+
type: 'setTeamList';
|
|
158
|
+
payload: TeamInfo[];
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* The team whose surface this iframe is rendering (#332). Sent to player
|
|
162
|
+
* surfaces, for observers as well as participants, since the host always
|
|
163
|
+
* knows which team it mounted and an observer has no participant to derive
|
|
164
|
+
* it from. Advisory rather than required: a wrapper that never
|
|
165
|
+
* receives it falls back to resolving `participant.teamId` against the team
|
|
166
|
+
* list, so a host predating this message still serves participants.
|
|
167
|
+
*/
|
|
168
|
+
| {
|
|
169
|
+
type: 'setOwnTeam';
|
|
170
|
+
payload: TeamInfo;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* How to join this surface's own team (#493). Sent to every player surface,
|
|
174
|
+
* observers included, since a kiosk showing a join code is most naturally
|
|
175
|
+
* opened as an observer and has no participant of its own.
|
|
176
|
+
*
|
|
177
|
+
* Not the facilitator's `setTeamLinks`: one team rather than all of them, no
|
|
178
|
+
* `observeUrl`, and never the session PIN. A join URL alone admits nobody to
|
|
179
|
+
* a session that requires a PIN.
|
|
180
|
+
*/
|
|
181
|
+
| {
|
|
182
|
+
type: 'setOwnTeamJoinLink';
|
|
183
|
+
payload: OwnTeamJoinLink;
|
|
184
|
+
} | {
|
|
185
|
+
type: 'setAssetUrls';
|
|
186
|
+
payload: AssetUrls;
|
|
187
|
+
} | {
|
|
188
|
+
type: 'refreshAssetAuth';
|
|
189
|
+
requestId: string;
|
|
190
|
+
token: string;
|
|
191
|
+
} | {
|
|
192
|
+
type: 'uploadBlob:response';
|
|
193
|
+
requestId: string;
|
|
194
|
+
ok: true;
|
|
195
|
+
reference: string;
|
|
196
|
+
} | {
|
|
197
|
+
type: 'uploadBlob:response';
|
|
198
|
+
requestId: string;
|
|
199
|
+
ok: false;
|
|
200
|
+
error: string;
|
|
201
|
+
} | {
|
|
202
|
+
type: 'callEndpoint:response';
|
|
203
|
+
requestId: string;
|
|
204
|
+
ok: true;
|
|
205
|
+
response: unknown;
|
|
206
|
+
} | ({
|
|
207
|
+
type: 'callEndpoint:response';
|
|
208
|
+
requestId: string;
|
|
209
|
+
ok: false;
|
|
210
|
+
} & EndpointFailure) | {
|
|
211
|
+
type: 'getPastState:response';
|
|
212
|
+
requestId: string;
|
|
213
|
+
ok: true;
|
|
214
|
+
entries: PastStateEntry[];
|
|
215
|
+
} | {
|
|
216
|
+
type: 'getPastState:response';
|
|
217
|
+
requestId: string;
|
|
218
|
+
ok: false;
|
|
219
|
+
error: string;
|
|
220
|
+
} | {
|
|
221
|
+
type: 'getAllTeamsParticipants:response';
|
|
222
|
+
requestId: string;
|
|
223
|
+
ok: true;
|
|
224
|
+
participants: Participant[];
|
|
225
|
+
} | {
|
|
226
|
+
type: 'getAllTeamsParticipants:response';
|
|
227
|
+
requestId: string;
|
|
228
|
+
ok: false;
|
|
229
|
+
error: string;
|
|
230
|
+
} | {
|
|
231
|
+
type: 'themePreferenceChanged';
|
|
232
|
+
preference: ThemePreference;
|
|
233
|
+
} | {
|
|
234
|
+
type: 'mutation:response';
|
|
235
|
+
requestId: string;
|
|
236
|
+
ok: true;
|
|
237
|
+
/**
|
|
238
|
+
* The tick the write committed into. The surface compares it
|
|
239
|
+
* against the tick it was showing when the write was composed: a
|
|
240
|
+
* higher value means the round advanced first, so the write belongs
|
|
241
|
+
* to the round after the one the participant was looking at (§9.5).
|
|
242
|
+
*/
|
|
243
|
+
committedAtTick?: number;
|
|
244
|
+
} | {
|
|
245
|
+
type: 'mutation:response';
|
|
246
|
+
requestId: string;
|
|
247
|
+
ok: false;
|
|
248
|
+
outcome: MutationOutcome;
|
|
249
|
+
} | {
|
|
250
|
+
type: 'validationRejected';
|
|
251
|
+
rejections: ValidationRejection[];
|
|
252
|
+
};
|
|
253
|
+
/** Port messages sent from game UI iframe to host */
|
|
254
|
+
export type IFramePortMessage = {
|
|
255
|
+
type: 'pong';
|
|
256
|
+
} | {
|
|
257
|
+
type: 'updateData';
|
|
258
|
+
requestId?: string;
|
|
259
|
+
payload: Record<string, unknown>;
|
|
260
|
+
/** Paths to remove, applied after the patch merges (§9.5). */
|
|
261
|
+
deletes?: ContextDeletePath[];
|
|
262
|
+
} | {
|
|
263
|
+
type: 'setThemePreference';
|
|
264
|
+
preference: ThemePreference;
|
|
265
|
+
} | {
|
|
266
|
+
type: 'refreshAssetAuth:response';
|
|
267
|
+
requestId: string;
|
|
268
|
+
ok: true;
|
|
269
|
+
} | {
|
|
270
|
+
type: 'refreshAssetAuth:response';
|
|
271
|
+
requestId: string;
|
|
272
|
+
ok: false;
|
|
273
|
+
error: string;
|
|
274
|
+
} | {
|
|
275
|
+
type: 'callEndpoint';
|
|
276
|
+
requestId: string;
|
|
277
|
+
endpointIdentifier: string;
|
|
278
|
+
request: unknown;
|
|
279
|
+
} | {
|
|
280
|
+
type: 'getPastState';
|
|
281
|
+
requestId: string;
|
|
282
|
+
query: PastStateQuery;
|
|
283
|
+
} | {
|
|
284
|
+
type: 'getAllTeamsParticipants';
|
|
285
|
+
requestId: string;
|
|
286
|
+
} | {
|
|
287
|
+
type: 'requestTick';
|
|
288
|
+
requestId?: string;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Rename the team this surface belongs to (#494). Carries no `teamId`: the
|
|
292
|
+
* host resolves the caller's team itself, so no surface can name another's.
|
|
293
|
+
*/
|
|
294
|
+
| {
|
|
295
|
+
type: 'renameOwnTeam';
|
|
296
|
+
requestId?: string;
|
|
297
|
+
name: string;
|
|
298
|
+
} | {
|
|
299
|
+
type: 'uploadBlob';
|
|
300
|
+
requestId: string;
|
|
301
|
+
data: ArrayBuffer;
|
|
302
|
+
name: string;
|
|
303
|
+
mimeType: string;
|
|
304
|
+
};
|
|
305
|
+
/** Port messages sent from host to session UI iframe */
|
|
306
|
+
export type HostSessionPortMessage = {
|
|
307
|
+
type: 'ping';
|
|
308
|
+
} | {
|
|
309
|
+
type: 'setSessionMeta';
|
|
310
|
+
payload: SessionMeta;
|
|
311
|
+
} | {
|
|
312
|
+
type: 'setSessionData';
|
|
313
|
+
payload: SessionData;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* One team's state, as an ongoing update in place of a whole-session
|
|
317
|
+
* `setSessionData`. Protocol version 2 and later.
|
|
318
|
+
*
|
|
319
|
+
* `SessionData` carries every team's context, so at a hundred teams a
|
|
320
|
+
* facilitator surface receives a hundred contexts every time one
|
|
321
|
+
* participant types. This delivers the team that changed. The wrapper
|
|
322
|
+
* merges it into the same `SessionData` the surface already reads, so a
|
|
323
|
+
* game sees no difference.
|
|
324
|
+
*
|
|
325
|
+
* `state.revision` is monotonic per team. A wrapper that receives a
|
|
326
|
+
* revision more than one ahead of what it holds has missed an update and
|
|
327
|
+
* asks for a fresh snapshot with `resyncSessionData`, which is what makes
|
|
328
|
+
* the scheme self-healing rather than dependent on ordered delivery.
|
|
329
|
+
*/
|
|
330
|
+
| {
|
|
331
|
+
type: 'updateTeamState';
|
|
332
|
+
teamId: string;
|
|
333
|
+
state: TeamState;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* The shared store, as an ongoing update in place of a whole-session
|
|
337
|
+
* `setSessionData`. Protocol version 3 and later. `state.revision` is
|
|
338
|
+
* monotonic, and a gap is repaired with `resyncSessionData` exactly as a
|
|
339
|
+
* per-team one is.
|
|
340
|
+
*/
|
|
341
|
+
| {
|
|
342
|
+
type: 'updateSharedState';
|
|
343
|
+
state: SharedState;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* The settings resources this surface declared, resolved and keyed by
|
|
347
|
+
* identifier (§8). Sent on load and whenever they change, never with a
|
|
348
|
+
* context write.
|
|
349
|
+
*/
|
|
350
|
+
| {
|
|
351
|
+
type: 'setSettings';
|
|
352
|
+
payload: Record<string, Record<string, unknown>>;
|
|
353
|
+
} | {
|
|
354
|
+
type: 'setTheme';
|
|
355
|
+
payload: UserInterfaceTheme;
|
|
356
|
+
} | {
|
|
357
|
+
type: 'setLocale';
|
|
358
|
+
payload: UserInterfaceLocale;
|
|
359
|
+
} | {
|
|
360
|
+
type: 'setTeamList';
|
|
361
|
+
payload: TeamInfo[];
|
|
362
|
+
} | {
|
|
363
|
+
type: 'setTeamConfiguration';
|
|
364
|
+
payload: TeamConfiguration;
|
|
365
|
+
} | {
|
|
366
|
+
type: 'setParticipantList';
|
|
367
|
+
participants: Participant[];
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Facilitator-only. A join URL plus the session PIN is joinable capability,
|
|
371
|
+
* so it travels on its own message to this surface alone rather than as a
|
|
372
|
+
* field on TeamInfo, which player surfaces also receive.
|
|
373
|
+
*/
|
|
374
|
+
| {
|
|
375
|
+
type: 'setTeamLinks';
|
|
376
|
+
payload: TeamLinks[];
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Whether this session surface belongs to the game being played or to a
|
|
380
|
+
* walkthrough beside it (§5.7). Sent in the initial batch and never again.
|
|
381
|
+
*/
|
|
382
|
+
| {
|
|
383
|
+
type: 'setRunKind';
|
|
384
|
+
runKind: RunKind;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Where to open the walkthrough run (§5.7). Every host offers one, so this
|
|
388
|
+
* always carries a link. Facilitator-only, and naming no team: a
|
|
389
|
+
* walkthrough holds one.
|
|
390
|
+
*/
|
|
391
|
+
| {
|
|
392
|
+
type: 'setWalkthroughLink';
|
|
393
|
+
payload: WalkthroughLink;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Which host-owned overlays (§6.4) this host offers, so a surface renders a
|
|
397
|
+
* control only for one that exists. Sent in the initial batch and re-sent
|
|
398
|
+
* whenever the set changes, e.g. when a scenario switch changes whether the
|
|
399
|
+
* active game declares a facilitator guide.
|
|
400
|
+
*/
|
|
401
|
+
| {
|
|
402
|
+
type: 'setAvailableOverlays';
|
|
403
|
+
overlays: HostOverlay[];
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* A hook chain threw. Reported after the fact rather than as a failed
|
|
407
|
+
* mutation: hooks fire after the change is applied, so the mutation that
|
|
408
|
+
* triggered them has already committed and settled.
|
|
409
|
+
*/
|
|
410
|
+
| {
|
|
411
|
+
type: 'hookFailed';
|
|
412
|
+
payload: SessionHookFailure;
|
|
413
|
+
} | {
|
|
414
|
+
type: 'setAssetUrls';
|
|
415
|
+
payload: AssetUrls;
|
|
416
|
+
} | {
|
|
417
|
+
type: 'refreshAssetAuth';
|
|
418
|
+
requestId: string;
|
|
419
|
+
token: string;
|
|
420
|
+
} | {
|
|
421
|
+
type: 'uploadBlob:response';
|
|
422
|
+
requestId: string;
|
|
423
|
+
ok: true;
|
|
424
|
+
reference: string;
|
|
425
|
+
} | {
|
|
426
|
+
type: 'uploadBlob:response';
|
|
427
|
+
requestId: string;
|
|
428
|
+
ok: false;
|
|
429
|
+
error: string;
|
|
430
|
+
} | {
|
|
431
|
+
type: 'callEndpoint:response';
|
|
432
|
+
requestId: string;
|
|
433
|
+
ok: true;
|
|
434
|
+
response: unknown;
|
|
435
|
+
} | ({
|
|
436
|
+
type: 'callEndpoint:response';
|
|
437
|
+
requestId: string;
|
|
438
|
+
ok: false;
|
|
439
|
+
} & EndpointFailure) | {
|
|
440
|
+
type: 'getPastState:response';
|
|
441
|
+
requestId: string;
|
|
442
|
+
ok: true;
|
|
443
|
+
entries: PastStateEntry[];
|
|
444
|
+
} | {
|
|
445
|
+
type: 'getPastState:response';
|
|
446
|
+
requestId: string;
|
|
447
|
+
ok: false;
|
|
448
|
+
error: string;
|
|
449
|
+
} | {
|
|
450
|
+
type: 'themePreferenceChanged';
|
|
451
|
+
preference: ThemePreference;
|
|
452
|
+
} | {
|
|
453
|
+
type: 'mutation:response';
|
|
454
|
+
requestId: string;
|
|
455
|
+
ok: true;
|
|
456
|
+
/**
|
|
457
|
+
* The tick the write committed into. The surface compares it
|
|
458
|
+
* against the tick it was showing when the write was composed: a
|
|
459
|
+
* higher value means the round advanced first, so the write belongs
|
|
460
|
+
* to the round after the one the participant was looking at (§9.5).
|
|
461
|
+
*/
|
|
462
|
+
committedAtTick?: number;
|
|
463
|
+
} | {
|
|
464
|
+
type: 'mutation:response';
|
|
465
|
+
requestId: string;
|
|
466
|
+
ok: false;
|
|
467
|
+
outcome: MutationOutcome;
|
|
468
|
+
} | {
|
|
469
|
+
type: 'validationRejected';
|
|
470
|
+
rejections: ValidationRejection[];
|
|
471
|
+
teamId?: string;
|
|
472
|
+
};
|
|
473
|
+
/** Port messages sent from session UI iframe to host */
|
|
474
|
+
export type IFrameSessionPortMessage = {
|
|
475
|
+
type: 'pong';
|
|
476
|
+
} | {
|
|
477
|
+
type: 'updateSessionData';
|
|
478
|
+
requestId?: string;
|
|
479
|
+
teamId: string;
|
|
480
|
+
payload: Record<string, unknown>;
|
|
481
|
+
/**
|
|
482
|
+
* Paths to remove from that team's context after the payload merges
|
|
483
|
+
* (§9.5), each under a team-scope capability the session UI declares
|
|
484
|
+
* in `writes`.
|
|
485
|
+
*/
|
|
486
|
+
deletes?: ContextDeletePath[];
|
|
487
|
+
} | {
|
|
488
|
+
type: 'updateSharedData';
|
|
489
|
+
requestId?: string;
|
|
490
|
+
payload: Record<string, unknown>;
|
|
491
|
+
/**
|
|
492
|
+
* Paths to remove from the shared store after the payload merges
|
|
493
|
+
* (§9.5.1), each under a shared capability the session UI declares in
|
|
494
|
+
* `writes`.
|
|
495
|
+
*/
|
|
496
|
+
deletes?: ContextDeletePath[];
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Ask the host for a fresh full `setSessionData`. Sent by the wrapper when
|
|
500
|
+
* a per-team revision arrives out of sequence, meaning an `updateTeamState`
|
|
501
|
+
* was lost, so the surface repairs itself rather than rendering a team's
|
|
502
|
+
* state indefinitely stale. Not a mutation: it carries no `requestId` and
|
|
503
|
+
* settles by the snapshot arriving.
|
|
504
|
+
*/
|
|
505
|
+
| {
|
|
506
|
+
type: 'resyncSessionData';
|
|
507
|
+
} | {
|
|
508
|
+
type: 'setThemePreference';
|
|
509
|
+
preference: ThemePreference;
|
|
510
|
+
} | {
|
|
511
|
+
type: 'refreshAssetAuth:response';
|
|
512
|
+
requestId: string;
|
|
513
|
+
ok: true;
|
|
514
|
+
} | {
|
|
515
|
+
type: 'refreshAssetAuth:response';
|
|
516
|
+
requestId: string;
|
|
517
|
+
ok: false;
|
|
518
|
+
error: string;
|
|
519
|
+
} | {
|
|
520
|
+
type: 'callEndpoint';
|
|
521
|
+
requestId: string;
|
|
522
|
+
endpointIdentifier: string;
|
|
523
|
+
request: unknown;
|
|
524
|
+
} | {
|
|
525
|
+
type: 'getPastState';
|
|
526
|
+
requestId: string;
|
|
527
|
+
query: PastStateQuery;
|
|
528
|
+
} | {
|
|
529
|
+
type: 'requestTick';
|
|
530
|
+
requestId?: string;
|
|
531
|
+
teamId?: string;
|
|
532
|
+
} | {
|
|
533
|
+
type: 'uploadBlob';
|
|
534
|
+
requestId: string;
|
|
535
|
+
data: ArrayBuffer;
|
|
536
|
+
name: string;
|
|
537
|
+
mimeType: string;
|
|
538
|
+
} | {
|
|
539
|
+
type: 'pauseTimer';
|
|
540
|
+
requestId?: string;
|
|
541
|
+
teamId?: string;
|
|
542
|
+
} | {
|
|
543
|
+
type: 'resumeTimer';
|
|
544
|
+
requestId?: string;
|
|
545
|
+
teamId?: string;
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Move the deadline of the *currently scheduled* tick, without changing the
|
|
549
|
+
* interval the tick controller returns for the ticks after it. Positive
|
|
550
|
+
* `byMs` (milliseconds) buys the room more time; negative brings the
|
|
551
|
+
* deadline forward, clamped at now rather than firing retroactively.
|
|
552
|
+
*/
|
|
553
|
+
| {
|
|
554
|
+
type: 'extendTick';
|
|
555
|
+
requestId?: string;
|
|
556
|
+
teamId?: string;
|
|
557
|
+
byMs: number;
|
|
558
|
+
} | {
|
|
559
|
+
type: 'resetGame';
|
|
560
|
+
requestId?: string;
|
|
561
|
+
teamId?: string;
|
|
562
|
+
} | {
|
|
563
|
+
type: 'undoTick';
|
|
564
|
+
requestId?: string;
|
|
565
|
+
teamId?: string;
|
|
566
|
+
} | {
|
|
567
|
+
type: 'setWaitingRoom';
|
|
568
|
+
requestId?: string;
|
|
569
|
+
open: boolean;
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Throw the walkthrough away and start it again at tick 0 (§5.7). Session-
|
|
573
|
+
* wide like `setWaitingRoom`, and settling the same way. Denied while
|
|
574
|
+
* there is no walkthrough yet: opening the link is what creates one.
|
|
575
|
+
*/
|
|
576
|
+
| {
|
|
577
|
+
type: 'resetWalkthrough';
|
|
578
|
+
requestId?: string;
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Ask the host to open one of its own overlays (§6.4). The host renders it;
|
|
582
|
+
* this delegates the trigger alone. `target` is the overlay's argument — a
|
|
583
|
+
* guide identifier for `facilitator-guide`, a team id for `print-sheets` —
|
|
584
|
+
* and omitting it means the whole thing (the first declared guide, every
|
|
585
|
+
* team). An overlay the host does not offer, or a `target` the active game
|
|
586
|
+
* does not declare, settles as denied.
|
|
587
|
+
*/
|
|
588
|
+
| {
|
|
589
|
+
type: 'openHostOverlay';
|
|
590
|
+
requestId?: string;
|
|
591
|
+
overlay: HostOverlay;
|
|
592
|
+
target?: string;
|
|
593
|
+
} | {
|
|
594
|
+
type: 'createTeam';
|
|
595
|
+
requestId?: string;
|
|
596
|
+
name?: string;
|
|
597
|
+
} | {
|
|
598
|
+
type: 'renameTeam';
|
|
599
|
+
requestId?: string;
|
|
600
|
+
teamId: string;
|
|
601
|
+
name: string;
|
|
602
|
+
} | {
|
|
603
|
+
type: 'renameParticipant';
|
|
604
|
+
requestId?: string;
|
|
605
|
+
participantId: string;
|
|
606
|
+
name: string;
|
|
607
|
+
} | {
|
|
608
|
+
type: 'moveParticipant';
|
|
609
|
+
requestId?: string;
|
|
610
|
+
participantId: string;
|
|
611
|
+
teamId: string;
|
|
612
|
+
} | {
|
|
613
|
+
type: 'deleteTeam';
|
|
614
|
+
requestId?: string;
|
|
615
|
+
teamId: string;
|
|
616
|
+
};
|
|
617
|
+
/** Port messages sent from host to a settings editor iframe (§6.5) */
|
|
618
|
+
export type HostSettingsEditorPortMessage = {
|
|
619
|
+
type: 'ping';
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* The **resolved** values of the settings this editor
|
|
623
|
+
* `configures`, keyed by settings identifier (§8.3): the same message,
|
|
624
|
+
* and the same shape, as every other surface's `setSettings`. Resolved
|
|
625
|
+
* rather than the sparse override layer, which for a fresh session is
|
|
626
|
+
* `{}` and would seed the form with nothing.
|
|
627
|
+
*/
|
|
628
|
+
| {
|
|
629
|
+
type: 'setSettings';
|
|
630
|
+
payload: Record<string, Record<string, unknown>>;
|
|
631
|
+
} | {
|
|
632
|
+
type: 'setTheme';
|
|
633
|
+
payload: UserInterfaceTheme;
|
|
634
|
+
} | {
|
|
635
|
+
type: 'setLocale';
|
|
636
|
+
payload: UserInterfaceLocale;
|
|
637
|
+
} | {
|
|
638
|
+
type: 'setAssetUrls';
|
|
639
|
+
payload: AssetUrls;
|
|
640
|
+
} | {
|
|
641
|
+
type: 'refreshAssetAuth';
|
|
642
|
+
requestId: string;
|
|
643
|
+
token: string;
|
|
644
|
+
} | {
|
|
645
|
+
type: 'uploadBlob:response';
|
|
646
|
+
requestId: string;
|
|
647
|
+
ok: true;
|
|
648
|
+
reference: string;
|
|
649
|
+
} | {
|
|
650
|
+
type: 'uploadBlob:response';
|
|
651
|
+
requestId: string;
|
|
652
|
+
ok: false;
|
|
653
|
+
error: string;
|
|
654
|
+
} | {
|
|
655
|
+
type: 'callEndpoint:response';
|
|
656
|
+
requestId: string;
|
|
657
|
+
ok: true;
|
|
658
|
+
response: unknown;
|
|
659
|
+
} | ({
|
|
660
|
+
type: 'callEndpoint:response';
|
|
661
|
+
requestId: string;
|
|
662
|
+
ok: false;
|
|
663
|
+
} & EndpointFailure) | {
|
|
664
|
+
type: 'mutation:response';
|
|
665
|
+
requestId: string;
|
|
666
|
+
ok: true;
|
|
667
|
+
/**
|
|
668
|
+
* The tick the write committed into. The surface compares it
|
|
669
|
+
* against the tick it was showing when the write was composed: a
|
|
670
|
+
* higher value means the round advanced first, so the write belongs
|
|
671
|
+
* to the round after the one the participant was looking at (§9.5).
|
|
672
|
+
*/
|
|
673
|
+
committedAtTick?: number;
|
|
674
|
+
} | {
|
|
675
|
+
type: 'mutation:response';
|
|
676
|
+
requestId: string;
|
|
677
|
+
ok: false;
|
|
678
|
+
outcome: MutationOutcome;
|
|
679
|
+
} | {
|
|
680
|
+
type: 'themePreferenceChanged';
|
|
681
|
+
preference: ThemePreference;
|
|
682
|
+
};
|
|
683
|
+
/**
|
|
684
|
+
* Port messages sent from a settings editor iframe to host. `requestPlay` is
|
|
685
|
+
* honoured from the `setup` slot only (§6.5).
|
|
686
|
+
*/
|
|
687
|
+
export type IFrameSettingsEditorPortMessage = {
|
|
688
|
+
type: 'pong';
|
|
689
|
+
} | {
|
|
690
|
+
type: 'updateSettings';
|
|
691
|
+
requestId?: string;
|
|
692
|
+
payload: unknown;
|
|
693
|
+
} | {
|
|
694
|
+
type: 'requestPlay';
|
|
695
|
+
} | {
|
|
696
|
+
type: 'setThemePreference';
|
|
697
|
+
preference: ThemePreference;
|
|
698
|
+
} | {
|
|
699
|
+
type: 'refreshAssetAuth:response';
|
|
700
|
+
requestId: string;
|
|
701
|
+
ok: true;
|
|
702
|
+
} | {
|
|
703
|
+
type: 'refreshAssetAuth:response';
|
|
704
|
+
requestId: string;
|
|
705
|
+
ok: false;
|
|
706
|
+
error: string;
|
|
707
|
+
} | {
|
|
708
|
+
type: 'callEndpoint';
|
|
709
|
+
requestId: string;
|
|
710
|
+
endpointIdentifier: string;
|
|
711
|
+
request: unknown;
|
|
712
|
+
} | {
|
|
713
|
+
type: 'uploadBlob';
|
|
714
|
+
requestId: string;
|
|
715
|
+
data: ArrayBuffer;
|
|
716
|
+
name: string;
|
|
717
|
+
mimeType: string;
|
|
718
|
+
};
|
|
719
|
+
/**
|
|
720
|
+
* Port messages sent from host to presentation iframe (§6.15).
|
|
721
|
+
*
|
|
722
|
+
* A presentation is read-only and may be shown with no session at all, so its
|
|
723
|
+
* channel is the session channel with every mutation taken away and one
|
|
724
|
+
* message in place of the session's several: `setPresentation` carries the
|
|
725
|
+
* game as the scenario resolves it, and the session, or `null` when there is
|
|
726
|
+
* none. The host re-sends it whole on every change; a deck changes slowly
|
|
727
|
+
* enough that deltas would buy nothing.
|
|
728
|
+
*/
|
|
729
|
+
export type HostPresentationPortMessage = {
|
|
730
|
+
type: 'ping';
|
|
731
|
+
} | {
|
|
732
|
+
type: 'setPresentation';
|
|
733
|
+
payload: {
|
|
734
|
+
game: PresentationGame;
|
|
735
|
+
session: PresentationSession | null;
|
|
736
|
+
};
|
|
737
|
+
} | {
|
|
738
|
+
type: 'setSettings';
|
|
739
|
+
payload: Record<string, Record<string, unknown>>;
|
|
740
|
+
} | {
|
|
741
|
+
type: 'setTheme';
|
|
742
|
+
payload: UserInterfaceTheme;
|
|
743
|
+
} | {
|
|
744
|
+
type: 'setLocale';
|
|
745
|
+
payload: UserInterfaceLocale;
|
|
746
|
+
} | {
|
|
747
|
+
type: 'setAssetUrls';
|
|
748
|
+
payload: AssetUrls;
|
|
749
|
+
} | {
|
|
750
|
+
type: 'refreshAssetAuth';
|
|
751
|
+
requestId: string;
|
|
752
|
+
token: string;
|
|
753
|
+
} | {
|
|
754
|
+
type: 'getPastState:response';
|
|
755
|
+
requestId: string;
|
|
756
|
+
ok: true;
|
|
757
|
+
entries: PastStateEntry[];
|
|
758
|
+
} | {
|
|
759
|
+
type: 'getPastState:response';
|
|
760
|
+
requestId: string;
|
|
761
|
+
ok: false;
|
|
762
|
+
error: string;
|
|
763
|
+
} | {
|
|
764
|
+
type: 'themePreferenceChanged';
|
|
765
|
+
preference: ThemePreference;
|
|
766
|
+
};
|
|
767
|
+
/** Port messages sent from presentation iframe to host. Reads only. */
|
|
768
|
+
export type IFramePresentationPortMessage = {
|
|
769
|
+
type: 'pong';
|
|
770
|
+
} | {
|
|
771
|
+
type: 'refreshAssetAuth:response';
|
|
772
|
+
requestId: string;
|
|
773
|
+
ok: true;
|
|
774
|
+
} | {
|
|
775
|
+
type: 'refreshAssetAuth:response';
|
|
776
|
+
requestId: string;
|
|
777
|
+
ok: false;
|
|
778
|
+
error: string;
|
|
779
|
+
} | {
|
|
780
|
+
type: 'getPastState';
|
|
781
|
+
requestId: string;
|
|
782
|
+
query: PastStateQuery;
|
|
783
|
+
};
|