@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,12 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Serious Gaming</title>
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-DgFglsnA.js"></script>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the built console is, from wherever the shell is running.
|
|
3
|
+
*
|
|
4
|
+
* One mode, not three. The old dev server could serve its UI from source
|
|
5
|
+
* through a second Vite, from a build, or from a build forced by `SG_E2E=1`,
|
|
6
|
+
* and the three disagreed: source mode duplicated React across the linked SDK
|
|
7
|
+
* boundary and died on its first hook, so the tests forced the built bundle and
|
|
8
|
+
* therefore never exercised what a developer saw. The console is always the
|
|
9
|
+
* build, so there is nothing to diverge.
|
|
10
|
+
*/
|
|
11
|
+
export interface ConsoleLocation {
|
|
12
|
+
/** Directory holding `index.html` and its assets. */
|
|
13
|
+
path: string;
|
|
14
|
+
/** False when nothing has been built yet. */
|
|
15
|
+
built: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function resolveConsolePath(dirname: string, filename: string, fileExists?: (path: string) => boolean): ConsoleLocation;
|
|
18
|
+
/** What to tell someone whose console has not been built. */
|
|
19
|
+
export declare const MISSING_CONSOLE_MESSAGE: string;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a CLI command finds the running session.
|
|
3
|
+
*
|
|
4
|
+
* A lock file, not a state file. It is written once at startup and removed at
|
|
5
|
+
* shutdown, never mutated while the server runs, and nothing watches it. That
|
|
6
|
+
* distinction is the whole point: `state.json` was two processes sharing a
|
|
7
|
+
* session through a mutable file, which is a shared-memory channel with no
|
|
8
|
+
* lock, and the own-write guards and debounced writers in the old dev server
|
|
9
|
+
* were patches over having two writers. Here the server owns the session and
|
|
10
|
+
* every other process is a client of it, so the only thing on disk is an
|
|
11
|
+
* address, and enough about who wrote it to tell whether it still holds.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Where runtime state goes instead of the package's `.seriousgaming-sdk/`.
|
|
15
|
+
*
|
|
16
|
+
* A lock is runtime state, not project content: a container restored from a
|
|
17
|
+
* snapshot brings back the package directory, and with it a lock naming a
|
|
18
|
+
* process from before the snapshot (#640).
|
|
19
|
+
*/
|
|
20
|
+
export declare const DEV_STATE_DIR_ENV_VAR = "SERIOUSGAMING_DEV_STATE_DIR";
|
|
21
|
+
export interface SessionLock {
|
|
22
|
+
/** Process holding the session. */
|
|
23
|
+
pid: number;
|
|
24
|
+
port: number;
|
|
25
|
+
/** ISO-8601, for a human reading a stale file. */
|
|
26
|
+
startedAt: string;
|
|
27
|
+
/** The tools version that started the server. */
|
|
28
|
+
toolsVersion: string;
|
|
29
|
+
/** The real path of the CLI entry point that started the server. */
|
|
30
|
+
toolsPath: string;
|
|
31
|
+
/** The machine the server runs on: a pid means nothing on another. */
|
|
32
|
+
hostname: string;
|
|
33
|
+
/** Answered by the server's `/api/session`, so a reused port is not taken for it. */
|
|
34
|
+
instanceId: string;
|
|
35
|
+
/** True when a CLI command started the server, rather than a person in a terminal. */
|
|
36
|
+
background: boolean;
|
|
37
|
+
}
|
|
38
|
+
/** Why a lock on disk does not name a running session. */
|
|
39
|
+
export type StaleReason = 'unreadable' | 'process-gone' | 'this-process' | 'other-host' | 'not-answering' | 'other-instance';
|
|
40
|
+
export type LockInspection = {
|
|
41
|
+
status: 'none';
|
|
42
|
+
} | {
|
|
43
|
+
status: 'live';
|
|
44
|
+
lock: SessionLock;
|
|
45
|
+
} | {
|
|
46
|
+
status: 'unresponsive';
|
|
47
|
+
lock: SessionLock;
|
|
48
|
+
} | {
|
|
49
|
+
status: 'stale';
|
|
50
|
+
reason: StaleReason;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* What a port answered when asked who it is: the instance id it reported,
|
|
54
|
+
* `null` for a server that answered without one, `'refused'` when nothing is
|
|
55
|
+
* listening, and `'unknown'` when it did not answer in time.
|
|
56
|
+
*/
|
|
57
|
+
export type ProbeAnswer = string | null | 'refused' | 'unknown';
|
|
58
|
+
export interface ReadLockOptions {
|
|
59
|
+
/** How to ask a port who it is. A real request to `/api/session` by default. */
|
|
60
|
+
probe?: (port: number) => Promise<ProbeAnswer>;
|
|
61
|
+
/**
|
|
62
|
+
* What to do with a server that holds the lock but does not answer:
|
|
63
|
+
* `'throw'` (the default) refuses with `DEV_SERVER_UNRESPONSIVE`, and
|
|
64
|
+
* `'accept'` returns its lock, for a caller that means to stop it or is
|
|
65
|
+
* waiting for it to come up.
|
|
66
|
+
*/
|
|
67
|
+
unresponsive?: 'throw' | 'accept';
|
|
68
|
+
}
|
|
69
|
+
export declare function lockFilePath(packagePath: string, env?: NodeJS.ProcessEnv): string;
|
|
70
|
+
export declare function writeLockFile(packagePath: string, details: {
|
|
71
|
+
port: number;
|
|
72
|
+
instanceId: string;
|
|
73
|
+
background?: boolean;
|
|
74
|
+
}): Promise<void>;
|
|
75
|
+
export declare function removeLockFile(packagePath: string, instanceId?: string): Promise<void>;
|
|
76
|
+
/** A fresh id for a server to write into its lock and answer with. */
|
|
77
|
+
export declare function newInstanceId(): string;
|
|
78
|
+
/**
|
|
79
|
+
* The running session, or null.
|
|
80
|
+
*
|
|
81
|
+
* A lock that names no running session is removed, so the next `sdk dev`
|
|
82
|
+
* starts rather than reporting a server that is not there: see
|
|
83
|
+
* {@link inspectLockFile} for what counts.
|
|
84
|
+
*/
|
|
85
|
+
export declare function readLockFile(packagePath: string, options?: ReadLockOptions): Promise<SessionLock | null>;
|
|
86
|
+
/**
|
|
87
|
+
* Whether the lock on disk names a running session, and if not, why not.
|
|
88
|
+
*
|
|
89
|
+
* A pid that exists is not enough. A server killed with SIGKILL never removed
|
|
90
|
+
* its file, and in a container restored from a snapshot the pid it names is
|
|
91
|
+
* often reused, frequently by the new dev server itself, which then reported
|
|
92
|
+
* itself as already running and exited (#640). So the lock is stale when:
|
|
93
|
+
*
|
|
94
|
+
* - its process is gone;
|
|
95
|
+
* - its pid is this process, and this process did not write it;
|
|
96
|
+
* - it was written on another machine;
|
|
97
|
+
* - its port refuses the connection, or answers as another instance.
|
|
98
|
+
*
|
|
99
|
+
* A port that accepts but does not answer in time is `unresponsive`, neither
|
|
100
|
+
* live nor stale. The probe is answered without waiting for the session's
|
|
101
|
+
* queue, so a server busy in a long tick still answers it; one that does not
|
|
102
|
+
* has its event loop blocked, almost always by logic stuck in synchronous
|
|
103
|
+
* code. Attaching to it would hang the command, and removing its lock would
|
|
104
|
+
* leave the next one starting a second server beside it, so the lock is kept
|
|
105
|
+
* for `sdk dev stop`.
|
|
106
|
+
*/
|
|
107
|
+
export declare function inspectLockFile(packagePath: string, options?: ReadLockOptions): Promise<LockInspection>;
|
|
108
|
+
/** Ask the server on `port` which instance it is. */
|
|
109
|
+
export declare function probeInstance(port: number, options?: {
|
|
110
|
+
timeoutMs?: number;
|
|
111
|
+
}): Promise<ProbeAnswer>;
|
|
112
|
+
/**
|
|
113
|
+
* The lock on disk as written, without asking whether it still holds: for a
|
|
114
|
+
* caller waiting on a particular server to let go of it.
|
|
115
|
+
*/
|
|
116
|
+
export declare function lockOnDisk(packagePath: string): Promise<SessionLock | null>;
|
|
117
|
+
/**
|
|
118
|
+
* Whether a process exists, without signalling it.
|
|
119
|
+
*
|
|
120
|
+
* `kill(pid, 0)` performs the permission checks and reports whether the target
|
|
121
|
+
* exists, and sends nothing. `EPERM` means it exists and belongs to somebody
|
|
122
|
+
* else, which still counts as alive.
|
|
123
|
+
*/
|
|
124
|
+
export declare function isAlive(pid: number): boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Watches a package for the edits a running session has to pick up.
|
|
3
|
+
*
|
|
4
|
+
* UI source is Vite's business and is hot-replaced there. What is left is the
|
|
5
|
+
* logic the executor caches and the bundle files configuration is resolved
|
|
6
|
+
* from, and neither reloads on its own.
|
|
7
|
+
*/
|
|
8
|
+
export type PackageChange = 'logic' | 'bundles' | 'manifest';
|
|
9
|
+
/** What an edit to `path` means for a running session, or null for nothing. */
|
|
10
|
+
export declare function classifyChange(packagePath: string, path: string): PackageChange | null;
|
|
11
|
+
/** Whether a new directory at `path` may hold something a session runs. */
|
|
12
|
+
export declare function classifyDirectory(packagePath: string, path: string): boolean;
|
|
13
|
+
export interface PackageWatcher {
|
|
14
|
+
close(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Watch `packagePath`, calling `onChange` once per kind of change after a burst
|
|
18
|
+
* of writes settles. Resolves once the watches are delivering events, so an
|
|
19
|
+
* edit made after it is always seen.
|
|
20
|
+
*/
|
|
21
|
+
export declare function watchPackage(packagePath: string, onChange: (change: PackageChange) => void, debounceMs?: number): Promise<PackageWatcher>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The HTTP surface: a state read, a command write, and the files a game needs.
|
|
3
|
+
*
|
|
4
|
+
* The server this replaces had 38 routes, most of which were one slice of
|
|
5
|
+
* session state each (`/api/context`, `/api/teams`, `/api/history`,
|
|
6
|
+
* `/api/locale`, `/api/configuration`, …) and each of which a client had to
|
|
7
|
+
* fetch and reassemble. There is one state route here, answering the §20
|
|
8
|
+
* projection, and one command route. What is left is genuinely files: bundles,
|
|
9
|
+
* blobs, scenario assets, shared assets, and guide content.
|
|
10
|
+
*/
|
|
11
|
+
import type { RunKind } from '@seriousgaming/sdk';
|
|
12
|
+
import type { MutationResult } from '@seriousgaming/sdk/projection';
|
|
13
|
+
import express from 'express';
|
|
14
|
+
import type { Command } from '../core/protocol';
|
|
15
|
+
import type { Session } from '../core/session';
|
|
16
|
+
export interface RouteDeps {
|
|
17
|
+
session: Session;
|
|
18
|
+
/**
|
|
19
|
+
* The run a request named, started if it is the walkthrough (§5.7).
|
|
20
|
+
*
|
|
21
|
+
* Only the run-scoped routes go through this. Everything about the
|
|
22
|
+
* *package* — its surfaces, scenarios, locales, guide and assets — is the
|
|
23
|
+
* same whichever run is asking, and reads `session` directly.
|
|
24
|
+
*/
|
|
25
|
+
runFor: (run: RunKind) => Promise<Session>;
|
|
26
|
+
/** Throw the walkthrough away and start it again at tick 0 (§5.7). */
|
|
27
|
+
resetWalkthrough: () => Promise<Session>;
|
|
28
|
+
/** A command that rebuilds the walkthrough, settled as a mutation (§12.5). */
|
|
29
|
+
settleWalkthroughReset: (command: Command) => Promise<MutationResult>;
|
|
30
|
+
packagePath: string;
|
|
31
|
+
vitePort: () => number;
|
|
32
|
+
/** The origin bundles are served from, as seen by a client that reached `host`. */
|
|
33
|
+
assetOrigin: (host: string | undefined) => string;
|
|
34
|
+
/** This server, as its lock names it, so a reused port is not taken for it. */
|
|
35
|
+
instanceId: string;
|
|
36
|
+
/** What the server could not apply live to a run, for the CLI to say (#640). */
|
|
37
|
+
notices: (run: Session) => Array<{
|
|
38
|
+
code: string;
|
|
39
|
+
message: string;
|
|
40
|
+
}>;
|
|
41
|
+
}
|
|
42
|
+
export declare function registerRoutes(app: express.Application, deps: RouteDeps): void;
|
|
43
|
+
/** Where the reads a frame makes are mounted, on one origin or the other. */
|
|
44
|
+
declare const ASSET_PATHS: {
|
|
45
|
+
readonly '/api': {
|
|
46
|
+
readonly blob: "/api/blobs/:blobId";
|
|
47
|
+
readonly scenario: "/api/scenario/assets/*path";
|
|
48
|
+
readonly shared: "/api/shared/assets/*path";
|
|
49
|
+
readonly redeem: "/api/asset-auth/redeem";
|
|
50
|
+
};
|
|
51
|
+
readonly '/assets': {
|
|
52
|
+
readonly blob: "/assets/blobs/:blobId";
|
|
53
|
+
readonly scenario: "/assets/scenario/*path";
|
|
54
|
+
readonly shared: "/assets/shared/*path";
|
|
55
|
+
readonly redeem: "/assets/auth/redeem";
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* The reads a frame makes directly: blobs, scenario assets, shared assets,
|
|
60
|
+
* and the §16.4 redeem.
|
|
61
|
+
*
|
|
62
|
+
* Mounted on the asset origin, beside the bundles, so a frame reaches them as
|
|
63
|
+
* its own origin under `connect-src 'self'` (§16.5). The same routes stay on
|
|
64
|
+
* the console's origin under `/api` for the CLI and for the console itself.
|
|
65
|
+
*/
|
|
66
|
+
export declare function registerAssetRoutes(app: express.Application, deps: Pick<RouteDeps, 'session' | 'packagePath'>, prefix: keyof typeof ASSET_PATHS): void;
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The transport around a {@link Session}, and no state of its own.
|
|
3
|
+
*
|
|
4
|
+
* Two origins. The console's serves the console, the API and two sockets: the
|
|
5
|
+
* operator feed, which carries the whole projection, and the viewer feed,
|
|
6
|
+
* which carries only what one person's page is owed. The asset origin serves
|
|
7
|
+
* game UI bundles, through Vite in middleware mode, and the files a frame
|
|
8
|
+
* reads. Keeping the bundles off the console's origin is what stops a game's
|
|
9
|
+
* own code from calling the API the console calls: `connect-src 'self'` would
|
|
10
|
+
* otherwise admit it, and a same-origin frame can reach into the page besides.
|
|
11
|
+
*
|
|
12
|
+
* Everything here is translation. A command arrives as JSON, goes to the
|
|
13
|
+
* session, and its result goes back; the session's events are broadcast as
|
|
14
|
+
* they come. Nothing in this file decides anything about a game, which is what
|
|
15
|
+
* makes the thing it wraps testable without it.
|
|
16
|
+
*/
|
|
17
|
+
import type { RunKind } from '@seriousgaming/sdk';
|
|
18
|
+
import type { MutationResult } from '@seriousgaming/sdk/projection';
|
|
19
|
+
import type { Command } from '../core/protocol';
|
|
20
|
+
import { Session, type SessionOptions } from '../core/session';
|
|
21
|
+
export interface ShellOptions extends SessionOptions {
|
|
22
|
+
port?: number;
|
|
23
|
+
/** Port the Vite HMR socket binds to. Defaults to `port + 1`. */
|
|
24
|
+
vitePort?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Port of the asset origin, which serves bundles and the files a frame
|
|
27
|
+
* reads. Defaults to the next free port after the HMR socket's.
|
|
28
|
+
*/
|
|
29
|
+
assetPort?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Skip the lock file: neither refuse to start beside a running server nor
|
|
32
|
+
* become the one CLI commands find. For tests, and `sdk dev --isolated`.
|
|
33
|
+
*/
|
|
34
|
+
anonymous?: boolean;
|
|
35
|
+
/** Recorded in the lock: a CLI command started this server, not a person. */
|
|
36
|
+
background?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Run beside the developer's own server without touching anything of
|
|
39
|
+
* theirs: no lock (`anonymous`), configuration from the package alone
|
|
40
|
+
* (`inMemory`), and blobs in a temporary directory removed at stop. For
|
|
41
|
+
* test runs and recordings (#640).
|
|
42
|
+
*/
|
|
43
|
+
isolated?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Listen on every interface, so a phone or tablet can open a surface.
|
|
46
|
+
* Loopback only otherwise: on a shared network, anyone on it could reach
|
|
47
|
+
* the session, its API and the package's files.
|
|
48
|
+
*/
|
|
49
|
+
lan?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Something the server could not apply live, kept until it no longer holds so
|
|
53
|
+
* the next CLI command can say it (#640). A log line alone was lost whenever
|
|
54
|
+
* nobody was reading the server's output, which for a server a command
|
|
55
|
+
* started in the background is always.
|
|
56
|
+
*/
|
|
57
|
+
export interface DevNotice {
|
|
58
|
+
/**
|
|
59
|
+
* `SETTINGS_STALE`, `RELOAD_FAILED` or `CAPABILITY_SEEDED`, or the code of
|
|
60
|
+
* an error `sdk build` would refuse the package for.
|
|
61
|
+
*/
|
|
62
|
+
code: string;
|
|
63
|
+
message: string;
|
|
64
|
+
/** Set on an error `sdk build` would refuse the package for. */
|
|
65
|
+
build?: true;
|
|
66
|
+
}
|
|
67
|
+
export declare class DevShell {
|
|
68
|
+
private readonly app;
|
|
69
|
+
/** The asset origin: bundles, and the files a frame reads (§16.4). */
|
|
70
|
+
private readonly assetApp;
|
|
71
|
+
private readonly session;
|
|
72
|
+
/**
|
|
73
|
+
* The walkthrough run (§5.7), built the first time somebody opens one.
|
|
74
|
+
*
|
|
75
|
+
* Lazy because a second `Session` builds a second `GameExecutor`, which
|
|
76
|
+
* loads the package again: a dev server nobody points at a walkthrough
|
|
77
|
+
* should not pay for one. The URL is always there regardless, which is what
|
|
78
|
+
* `/walkthrough` being addressable means.
|
|
79
|
+
*/
|
|
80
|
+
private walkthrough;
|
|
81
|
+
/** Serialises concurrent first opens so they share one run, not two. */
|
|
82
|
+
private walkthroughStarting;
|
|
83
|
+
/** The walkthrough's surface storage key, kept across a reset (§12.2). */
|
|
84
|
+
private walkthroughKey;
|
|
85
|
+
/** Which run each socket is watching, so an event reaches only its own. */
|
|
86
|
+
private readonly socketRuns;
|
|
87
|
+
/** The participant an operator page says it is showing, where it shows one. */
|
|
88
|
+
private readonly socketPresence;
|
|
89
|
+
private readonly options;
|
|
90
|
+
private server;
|
|
91
|
+
private assetServer;
|
|
92
|
+
private sockets;
|
|
93
|
+
/** One socket per viewer page, each carrying only what that page is owed. */
|
|
94
|
+
private viewSockets;
|
|
95
|
+
private readonly views;
|
|
96
|
+
/** Teams processing a round, per run (§12.4.4); `-1` is the cohort. */
|
|
97
|
+
private readonly processing;
|
|
98
|
+
private vite;
|
|
99
|
+
private watcher;
|
|
100
|
+
/** Why surfaces cannot be served, when Vite could not start. */
|
|
101
|
+
private viteFailure;
|
|
102
|
+
/** Serialises the first requests for a surface so they share one Vite. */
|
|
103
|
+
private viteStarting;
|
|
104
|
+
private port;
|
|
105
|
+
private vitePort;
|
|
106
|
+
private assetPort;
|
|
107
|
+
/** Written into the lock and answered by `/api/session`, so a reused port is not taken for this server. */
|
|
108
|
+
readonly instanceId: string;
|
|
109
|
+
/** Why the last edit could not be loaded, until an edit loads. */
|
|
110
|
+
private reloadFailure;
|
|
111
|
+
/** Capabilities adopted live with their schema defaults, until Init next runs. */
|
|
112
|
+
private readonly seeded;
|
|
113
|
+
/** The errors `sdk build` would refuse the package for, as it last stood on disk. */
|
|
114
|
+
private buildErrors;
|
|
115
|
+
/** Which validation is the latest, so an older one finishing late is dropped. */
|
|
116
|
+
private validations;
|
|
117
|
+
/** Where an isolated server keeps blobs, and how to stop doing so. */
|
|
118
|
+
private isolatedBlobs;
|
|
119
|
+
constructor(options: ShellOptions);
|
|
120
|
+
start(): Promise<void>;
|
|
121
|
+
private releaseIsolatedBlobs;
|
|
122
|
+
private listen;
|
|
123
|
+
stop(): Promise<void>;
|
|
124
|
+
/**
|
|
125
|
+
* Pick up an edit. The manifest is one more file the package is resolved
|
|
126
|
+
* from, so it reloads as a bundle does: what a running session can adopt
|
|
127
|
+
* it adopts, and the rest waits for a re-initialisation (#640).
|
|
128
|
+
*/
|
|
129
|
+
private onPackageChange;
|
|
130
|
+
private applyChange;
|
|
131
|
+
/**
|
|
132
|
+
* Run the static validation `sdk build --validate-only` runs, and say so
|
|
133
|
+
* when its errors change.
|
|
134
|
+
*
|
|
135
|
+
* A package `build` refuses still runs here: the session checks at run
|
|
136
|
+
* time what it cannot run correctly, and refusing play over the rest, an
|
|
137
|
+
* unresolved read or a missing entrypoint, would stop an author part way
|
|
138
|
+
* through an edit that spans several files. What it must not do is run
|
|
139
|
+
* silently, so the errors are printed, kept as notices every CLI command
|
|
140
|
+
* repeats, and shown on the console.
|
|
141
|
+
*/
|
|
142
|
+
private validate;
|
|
143
|
+
/** Keep what a reload could not apply, for the next command to be told. */
|
|
144
|
+
private record;
|
|
145
|
+
/**
|
|
146
|
+
* Everything this server could not apply live to `run`, as it stands now:
|
|
147
|
+
* edits waiting for a re-initialisation, an edit that did not load, and
|
|
148
|
+
* capabilities Init has not run for. Pending edits are the run's own; the
|
|
149
|
+
* other two are about the package, so only the session reports them.
|
|
150
|
+
*/
|
|
151
|
+
notices(run?: Session): DevNotice[];
|
|
152
|
+
/** Every interface with `lan`, loopback otherwise, as listen options. */
|
|
153
|
+
private get bindHost();
|
|
154
|
+
/** Whether other machines on the network can reach this server. */
|
|
155
|
+
get reachableFromNetwork(): boolean;
|
|
156
|
+
/** Where the console is, once listening. */
|
|
157
|
+
get url(): string;
|
|
158
|
+
/** Where bundles are served from, once listening. */
|
|
159
|
+
get assetUrl(): string;
|
|
160
|
+
/**
|
|
161
|
+
* The asset origin as a client that reached `host` must name it: the same
|
|
162
|
+
* host, the asset port. A browser on another machine reached us by an
|
|
163
|
+
* address `localhost` would not resolve to on its side.
|
|
164
|
+
*/
|
|
165
|
+
assetOrigin(host: string | undefined): string;
|
|
166
|
+
/** The console's own origin, as a client that reached `host` names it. */
|
|
167
|
+
private consoleOrigin;
|
|
168
|
+
/** The session this shell wraps, for tests and for the CLI in-process path. */
|
|
169
|
+
get runtime(): Session;
|
|
170
|
+
/**
|
|
171
|
+
* The walkthrough run, started on first use.
|
|
172
|
+
*
|
|
173
|
+
* One team and tick 0 are the walkthrough's shape (§5.7), not a default the
|
|
174
|
+
* caller may vary, so they are fixed here rather than taken from options.
|
|
175
|
+
*/
|
|
176
|
+
walkthroughRun(): Promise<Session>;
|
|
177
|
+
/**
|
|
178
|
+
* A command that rebuilds the walkthrough, as a settled mutation.
|
|
179
|
+
*
|
|
180
|
+
* The host owns it rather than a session, because it replaces the run a
|
|
181
|
+
* session command would have been addressed to. A `resetWalkthrough` with
|
|
182
|
+
* no walkthrough yet is denied rather than creating one (§12.5): opening
|
|
183
|
+
* the link is what creates the run, and a reset has nothing to rewind.
|
|
184
|
+
*/
|
|
185
|
+
settleWalkthroughReset(command: Command): Promise<MutationResult>;
|
|
186
|
+
/** The run a request or socket named, started if it is the walkthrough. */
|
|
187
|
+
runFor(run: RunKind): Promise<Session>;
|
|
188
|
+
/**
|
|
189
|
+
* Throw the walkthrough away and start a fresh one.
|
|
190
|
+
*
|
|
191
|
+
* A walkthrough always begins at tick 0 (§5.7), so replacing the run *is*
|
|
192
|
+
* the reset: there is no earlier state to rewind to and nothing to unpick.
|
|
193
|
+
*/
|
|
194
|
+
resetWalkthrough(): Promise<Session>;
|
|
195
|
+
private configure;
|
|
196
|
+
/**
|
|
197
|
+
* The asset origin: game bundles, through Vite, and the files a frame
|
|
198
|
+
* reads, all under the bundle policy and nothing under `/api`.
|
|
199
|
+
*/
|
|
200
|
+
private configureAssets;
|
|
201
|
+
/**
|
|
202
|
+
* Vite, started the first time something asks for a surface (#320).
|
|
203
|
+
*
|
|
204
|
+
* Not at start-up: a session a CLI command started in the background, and
|
|
205
|
+
* most of the servers the test suites start, never serve a surface, and a
|
|
206
|
+
* Vite server each was both the start-up cost and most of the exposure to
|
|
207
|
+
* rolldown's native crash.
|
|
208
|
+
*/
|
|
209
|
+
private ensureVite;
|
|
210
|
+
private createVite;
|
|
211
|
+
private attachSockets;
|
|
212
|
+
private receive;
|
|
213
|
+
/** What one viewer page is owed, now. */
|
|
214
|
+
private viewOf;
|
|
215
|
+
/**
|
|
216
|
+
* Send a viewer its page, unless it is exactly what the page already has.
|
|
217
|
+
*
|
|
218
|
+
* Most events change nothing a given page is owed: a write by one team, a
|
|
219
|
+
* round another team is processing, a tick's start and end on a page that
|
|
220
|
+
* shows neither. Re-sending the whole batch each time was most of the
|
|
221
|
+
* traffic, and every byte of it was discarded by the frame.
|
|
222
|
+
*/
|
|
223
|
+
private sendView;
|
|
224
|
+
/**
|
|
225
|
+
* Pass a session event on to the viewer pages it concerns, and no further.
|
|
226
|
+
*
|
|
227
|
+
* A viewer is never sent an operator error, a refusal meant for another
|
|
228
|
+
* team, or a round another team is processing (§12.4.4, §15).
|
|
229
|
+
*/
|
|
230
|
+
/**
|
|
231
|
+
* Tell a run who has a surface open (§13.2).
|
|
232
|
+
*
|
|
233
|
+
* A participant is connected while any page bound to them is: a viewer page
|
|
234
|
+
* the server resolved to them, or an operator page that said it shows them.
|
|
235
|
+
* Only a run that exists is told, since asking for the walkthrough is what
|
|
236
|
+
* builds it.
|
|
237
|
+
*/
|
|
238
|
+
private syncPresence;
|
|
239
|
+
private updateViews;
|
|
240
|
+
/**
|
|
241
|
+
* Act on a frame's request from a viewer page.
|
|
242
|
+
*
|
|
243
|
+
* The page forwards what its frame sent, unmapped, and the host maps it
|
|
244
|
+
* against its own resolution of who the page is for, so no page can name
|
|
245
|
+
* somebody else, another surface, or a command its surface may not send.
|
|
246
|
+
*/
|
|
247
|
+
private receiveView;
|
|
248
|
+
private broadcast;
|
|
249
|
+
/**
|
|
250
|
+
* Say what went wrong where the author is actually looking.
|
|
251
|
+
*
|
|
252
|
+
* Session errors used to reach the WebSocket and nothing else, so a refused
|
|
253
|
+
* tick left the console's drawer badge as the only sign: the clock did not
|
|
254
|
+
* move, the browser console was clean, and the message naming the cause sat
|
|
255
|
+
* behind a keystroke nobody had a reason to press. An undeclared write cost
|
|
256
|
+
* a reported hour of bisection for a one-line fix, and the message that
|
|
257
|
+
* would have ended it in a minute already existed.
|
|
258
|
+
*/
|
|
259
|
+
private report;
|
|
260
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the host knows about each surface it can mount.
|
|
3
|
+
*
|
|
4
|
+
* A table rather than a component per kind. The old dev server had four
|
|
5
|
+
* near-identical preview components and a route each; the difference between
|
|
6
|
+
* them is which bundle they mount, which declarations gate them, and which
|
|
7
|
+
* messages they are entitled to, all of which are data.
|
|
8
|
+
*/
|
|
9
|
+
import type { ResolvedPackageManifest } from '@seriousgaming/sdk';
|
|
10
|
+
import type { SurfaceKind } from '../host';
|
|
11
|
+
/** A bundle the host can serve, resolved from what the package declares. */
|
|
12
|
+
export interface MountableSurface {
|
|
13
|
+
kind: SurfaceKind;
|
|
14
|
+
/** Identifier of the bundle, which is the slot for a singular resource. */
|
|
15
|
+
identifier: string;
|
|
16
|
+
/** URL the iframe loads, relative to {@link MountableSurface.origin}. */
|
|
17
|
+
src: string;
|
|
18
|
+
/**
|
|
19
|
+
* Origin the bundle is served from. Set by the route that answers a
|
|
20
|
+
* client, since it depends on the host the client reached; absent, the
|
|
21
|
+
* bundle is on the page's own origin.
|
|
22
|
+
*/
|
|
23
|
+
origin?: string;
|
|
24
|
+
/** Capabilities the bundle reads, for the §7.4 projection. */
|
|
25
|
+
reads: string[];
|
|
26
|
+
/** Capabilities it writes. */
|
|
27
|
+
writes: string[];
|
|
28
|
+
/** Endpoints it may invoke (§6.12). */
|
|
29
|
+
endpoints: string[];
|
|
30
|
+
/** Capabilities it reads from every team, not only its own (§6.2, §12.4.1). */
|
|
31
|
+
crossTeamReads: string[];
|
|
32
|
+
/** Whether it may ask for every team's roster (§6.3, §12.5). */
|
|
33
|
+
crossTeamParticipants: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Settings resources it is sent (§8): those it lists in `settings`, or for
|
|
36
|
+
* the setup UI and the scenario editor, those it `configures`.
|
|
37
|
+
*/
|
|
38
|
+
settings: string[];
|
|
39
|
+
}
|
|
40
|
+
/** Every surface this package can mount: one per slot it fills. */
|
|
41
|
+
export declare function mountableSurfaces(config: ResolvedPackageManifest | null): MountableSurface[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which build of the tools this process is, so a CLI command can tell a dev
|
|
3
|
+
* server started by another build from one started by its own (#640).
|
|
4
|
+
*
|
|
5
|
+
* A server outlives the tools that started it: an upgrade, a rebuild of a
|
|
6
|
+
* linked checkout or a switch of branch leaves it running code the CLI no
|
|
7
|
+
* longer is, and its answers drift from what the files on disk say without
|
|
8
|
+
* either side noticing. The version alone cannot tell two builds of one
|
|
9
|
+
* checkout apart, so the entry point's real path is recorded beside it.
|
|
10
|
+
*/
|
|
11
|
+
export interface ToolsIdentity {
|
|
12
|
+
/** `version` from the tools' own package.json. */
|
|
13
|
+
version: string;
|
|
14
|
+
/** The real path of the CLI entry point: `dist/cli.js`, or `cli/cli.ts` from source. */
|
|
15
|
+
path: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function toolsIdentity(): ToolsIdentity;
|
|
18
|
+
/**
|
|
19
|
+
* From source this module sits at `cli/dev/`, two levels below the package
|
|
20
|
+
* root. Bundled, it is inlined into a file directly inside `dist/`, beside
|
|
21
|
+
* `cli.js`, with the package root one level up.
|
|
22
|
+
*/
|
|
23
|
+
export declare function readIdentity(filename: string): ToolsIdentity;
|