@seriousgaming/sdk-tools 1.9.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/guidance.md +31 -23
- package/dist/{cli-KJV3GGBA.js → cli-226ZJ72R.js} +1 -1
- package/dist/{cli-VRGVHSXH.js → cli-25SJZI7N.js} +44 -9
- package/dist/{cli-YI3WZF3C.js → cli-27TQVLVF.js} +11 -11
- package/dist/cli-27Z5T52R.js +30 -0
- package/dist/cli-3VLBFWHN.js +36 -0
- package/dist/{cli-DXHPYN4N.js → cli-44CM2AH2.js} +1 -1
- package/dist/{cli-2PMLR6WG.js → cli-4F24FUW6.js} +15 -15
- package/dist/{cli-6GDPO5VU.js → cli-4FJL3KQZ.js} +2 -2
- package/dist/{cli-2BF7KBBJ.js → cli-5ATO27Z4.js} +15 -15
- package/dist/{cli-AA5GMEUL.js → cli-5EH4WTH4.js} +4 -4
- package/dist/{cli-MPWTXNF6.js → cli-5M6KDNVX.js} +2 -2
- package/dist/{cli-J2OTL6JH.js → cli-5O7XENQY.js} +5 -5
- package/dist/{cli-XA4IL7IM.js → cli-5RRPUL6V.js} +11 -11
- package/dist/{cli-JEMWAIAA.js → cli-5TTJWM2R.js} +15 -15
- package/dist/{cli-S3YIYAXC.js → cli-5UKWX3IU.js} +12 -12
- package/dist/{cli-AEAFLZGY.js → cli-5VZBFMCK.js} +5 -1
- package/dist/{cli-AGYCXRPR.js → cli-5Z4D3F6Y.js} +3 -3
- package/dist/{cli-ZHFHOWJI.js → cli-6AMK3DYS.js} +11 -11
- package/dist/{cli-G7JTIP5G.js → cli-6BLVI2JM.js} +11 -7
- package/dist/{cli-SBKTGFY4.js → cli-6JWDFCUV.js} +17 -17
- package/dist/{cli-7OCEVQQN.js → cli-6O7YCK2M.js} +2 -2
- package/dist/{cli-GZE4V7RC.js → cli-6P6V2EHY.js} +19 -19
- package/dist/{cli-KD2RQS35.js → cli-77T4LJQF.js} +22 -19
- package/dist/{cli-IC5FOT2J.js → cli-7JUNA74L.js} +1 -1
- package/dist/{cli-2FXZZLCL.js → cli-AH6AMAIB.js} +1 -1
- package/dist/{cli-NTI22MRE.js → cli-ATAJSIXH.js} +16 -16
- package/dist/{cli-OOTGO3KW.js → cli-ATHATKI5.js} +49 -49
- package/dist/{cli-QWO3XJR3.js → cli-ATWJCB2G.js} +4 -4
- package/dist/{cli-QIHVXDMW.js → cli-B2QAJ5RQ.js} +15 -15
- package/dist/{cli-MN7X4UG2.js → cli-B3EFE7ZF.js} +1 -1
- package/dist/{cli-HJPNNORV.js → cli-BC67QHD5.js} +2 -2
- package/dist/cli-BINVO5R7.js +36 -0
- package/dist/{cli-PJO4BKSV.js → cli-BJFYGVJV.js} +16 -16
- package/dist/{cli-C45A5VX6.js → cli-BQ36DV5C.js} +3 -3
- package/dist/{cli-IJPRZSJ5.js → cli-BZOKZ7LP.js} +24 -22
- package/dist/{cli-GHIMH6JU.js → cli-C32Q5E5I.js} +1 -1
- package/dist/{cli-35K37SYY.js → cli-D3S7NJZ3.js} +14 -14
- package/dist/{cli-KGJHEDR2.js → cli-DBMEH4Y5.js} +23 -21
- package/dist/{cli-A7PITFRR.js → cli-DH35TZ2Q.js} +5 -3
- package/dist/{cli-A3P3PO6Z.js → cli-DQE7ITIR.js} +15 -15
- package/dist/{cli-BV7MX7JE.js → cli-EEO5ZPAZ.js} +3 -3
- package/dist/{cli-3RMP4HKZ.js → cli-ERJNDBDH.js} +2 -2
- package/dist/{cli-2JEICVMA.js → cli-F3YJKP6D.js} +3 -3
- package/dist/{cli-2VV5IPSY.js → cli-FT3X3D4P.js} +15 -15
- package/dist/{cli-LZFUSEJT.js → cli-FYPW25VD.js} +13 -13
- package/dist/{cli-CVOLMK3Z.js → cli-G2GLW5Z4.js} +1 -1
- package/dist/{cli-BYXNPBVG.js → cli-G3TU6CP6.js} +15 -15
- package/dist/{cli-4L7S27XO.js → cli-GO64NABP.js} +1 -1
- package/dist/{cli-XRVH5WV6.js → cli-GSOV26O5.js} +13 -13
- package/dist/{cli-2UOUIVHW.js → cli-H6PP2MZT.js} +24 -12
- package/dist/{cli-6Y4XIVQS.js → cli-HGCOEL5T.js} +3 -3
- package/dist/cli-HLI5UEKX.js +36 -0
- package/dist/{cli-B5LZEFLU.js → cli-HMDYG6PS.js} +15 -15
- package/dist/{cli-7CW2BBJG.js → cli-HNDFANQG.js} +1 -1
- package/dist/{cli-MSSJLABW.js → cli-IKSLPAZN.js} +3 -3
- package/dist/{cli-AJ5CABGJ.js → cli-JHLWBRXB.js} +15 -15
- package/dist/{cli-5PTCQTS6.js → cli-JXQLHJO2.js} +1 -1
- package/dist/{cli-H7T6E7OA.js → cli-K4HSQWXC.js} +2 -2
- package/dist/{cli-WJO75KP7.js → cli-KIZTASLL.js} +3 -3
- package/dist/{cli-MX7GFQ6N.js → cli-KJA6GLZI.js} +14 -14
- package/dist/{cli-KINJAQTJ.js → cli-L7F4XKCB.js} +19 -19
- package/dist/{cli-BC4KKNLA.js → cli-LHMRUJVN.js} +4 -2
- package/dist/{cli-CQUSM3SF.js → cli-LPFSJ625.js} +19 -19
- package/dist/{cli-BNN36WZJ.js → cli-MDVC5ZNM.js} +13 -13
- package/dist/{cli-TLRTLTGK.js → cli-MSNSXVGF.js} +18 -18
- package/dist/{cli-5BPQ73OM.js → cli-NKKCDO6K.js} +15 -15
- package/dist/{cli-L5ZKQNMI.js → cli-OBLEROSC.js} +15 -15
- package/dist/cli-OF36EA62.js +36 -0
- package/dist/{cli-MZM4MW7C.js → cli-OM32UURE.js} +19 -19
- package/dist/{cli-J75EBRAJ.js → cli-OMTHTWYJ.js} +17 -17
- package/dist/{cli-K6M6YB67.js → cli-OTBCA54D.js} +1 -1
- package/dist/cli-OVIJRBFI.js +36 -0
- package/dist/{cli-IVZ7AHUJ.js → cli-OXLOGXT3.js} +3 -3
- package/dist/{cli-NU4SCD5D.js → cli-P3NUTOPK.js} +1 -1
- package/dist/{cli-D6AC3ZCX.js → cli-PNS4KWWC.js} +22 -19
- package/dist/{cli-7N7WFRWA.js → cli-PXQYY6KM.js} +0 -0
- package/dist/{cli-MTAGL3QE.js → cli-Q7QSWNY2.js} +15 -15
- package/dist/{cli-7V6GUIIS.js → cli-QDBYFITU.js} +2 -2
- package/dist/{cli-QK2OD24J.js → cli-QEFYDXMH.js} +9 -2
- package/dist/{cli-MYBDWJP7.js → cli-QPV3TYOM.js} +20 -20
- package/dist/{cli-W4BHSBAX.js → cli-QTCTWYCM.js} +3 -3
- package/dist/{cli-HCMVZXWK.js → cli-R5SNTPND.js} +17 -17
- package/dist/{cli-RHYQYXE2.js → cli-REAM7LSC.js} +18 -18
- package/dist/{cli-GHQIATHP.js → cli-RHL4B4H7.js} +6 -5
- package/dist/{cli-RL5EBZL7.js → cli-RKPQLB7J.js} +3 -3
- package/dist/{cli-E77R7ZYB.js → cli-RMD5WSUQ.js} +15 -15
- package/dist/{cli-OX3254NS.js → cli-S3NHXAJM.js} +17 -17
- package/dist/{cli-6COAU7JR.js → cli-SRXDLMXY.js} +17 -17
- package/dist/{cli-DMKRP33X.js → cli-TCQJL2GY.js} +1 -1
- package/dist/{cli-KO26S2CL.js → cli-TEBV2OIW.js} +31 -14
- package/dist/{cli-USBJQAYI.js → cli-TI2FOFPA.js} +13 -13
- package/dist/{cli-7RLZIWFP.js → cli-TLSTSZAC.js} +19 -19
- package/dist/{cli-2CSI2UU2.js → cli-UEQMK4WX.js} +1 -1
- package/dist/cli-UIYKPSIY.js +36 -0
- package/dist/{cli-2I6UN6C3.js → cli-UQC46YSV.js} +3 -3
- package/dist/{cli-BF6L37O3.js → cli-UULZSQBV.js} +3 -3
- package/dist/{cli-OK6XWVIN.js → cli-UVIURDZC.js} +17 -17
- package/dist/{cli-6KL5B7EC.js → cli-VXLHOZSO.js} +15 -15
- package/dist/{cli-UR63LFVK.js → cli-W3RG2MRI.js} +2 -2
- package/dist/{cli-G54355N5.js → cli-WJVPSVF2.js} +22 -19
- package/dist/{cli-YD4SBAHQ.js → cli-WNBP3LOD.js} +19 -19
- package/dist/{cli-DJCQ5XFR.js → cli-WNHMJM3Z.js} +15 -15
- package/dist/{cli-CL3KF5KS.js → cli-WQ7JBZNW.js} +2 -2
- package/dist/{cli-VTLFQHDO.js → cli-WW54THXN.js} +1 -1
- package/dist/cli-WZNIW6ZO.js +16 -0
- package/dist/{cli-BT47H36C.js → cli-X3TSTTYI.js} +2 -2
- package/dist/{cli-ICLCA6VD.js → cli-X52TXCNF.js} +19 -19
- package/dist/{cli-ZZSPFLTK.js → cli-X64BNBQH.js} +26 -4
- package/dist/{cli-CKV44U7P.js → cli-XJ7JESC2.js} +19 -19
- package/dist/{cli-EDZF5Q2E.js → cli-XKAIDYIE.js} +14 -14
- package/dist/{cli-CPX4YA3P.js → cli-XNOAO6DY.js} +11 -11
- package/dist/{cli-R6YAZP6E.js → cli-XOYUTNER.js} +19 -19
- package/dist/{cli-3VV2JLHX.js → cli-XW3JLRSA.js} +1 -1
- package/dist/{cli-S7PLSPGE.js → cli-YYXAGJQR.js} +15 -15
- package/dist/{cli-LFUKHLHI.js → cli-ZGCG6C22.js} +17 -17
- package/dist/{cli-QRAYIXNE.js → cli-ZJW6HQ6N.js} +5 -5
- package/dist/{cli-Y33ULHYO.js → cli-ZNQBF4Z3.js} +1 -1
- package/dist/cli.js +52 -52
- package/dist/client/index.d.ts +1 -1
- package/dist/client/test-session.d.ts +44 -6
- package/dist/client.js +100 -12
- package/dist/dev/console/assets/{index-CVNjiRUh.js → index-Ch6HHb2T.js} +1 -1
- package/dist/dev/console/index.html +1 -1
- package/dist/dev/surfaces.d.ts +8 -2
- package/dist/docs/api/index.md +3 -1
- package/dist/docs/api/sdk-tools-client.md +38 -6
- package/dist/docs/api/sdk-tools-vite.md +21 -0
- package/dist/docs/api/sdk.md +2 -0
- package/dist/docs/changelog.md +49 -0
- package/dist/docs/cli-error-codes.md +41 -39
- package/dist/docs/cli-reference.md +2 -1
- package/dist/docs/guides/endpoints.md +1 -1
- package/dist/docs/guides/engine-testing.md +49 -14
- package/dist/docs/guides/engine.md +2 -2
- package/dist/docs/guides/scenario-editor.md +1 -1
- package/dist/docs/guides/setup.md +22 -5
- package/dist/docs/guides/testing.md +3 -8
- package/dist/docs/guides/upgrading.md +15 -0
- package/dist/docs/page-index.md +6 -5
- package/dist/docs/recipes/create-game.md +1 -1
- package/dist/docs/recipes/fix-duplicate-packages.md +8 -19
- package/dist/docs/recipes/give-setup-a-menu.md +7 -1
- package/dist/docs/recipes/write-setup-notes.md +2 -2
- package/dist/host/protocol.d.ts +8 -5
- package/dist/oxlint/logic.json +184 -0
- package/dist/playwright.js +100 -12
- package/dist/runtime/manifest-version.d.ts +1 -1
- package/dist/runtime.js +1 -1
- package/dist/schema.json +20 -0
- package/dist/templates/package/README.md.liquid +1 -0
- package/dist/templates/package/claude/rules/workflow-create-engine.md +1 -1
- package/dist/templates/package/claude/rules/workflow-create-user-interface.md +1 -1
- package/dist/templates/package/claude/rules/workflow-test-engine-or-ui.md +1 -1
- package/dist/templates/package/claude/rules/workflow-update-sdk-version.md +2 -2
- package/dist/templates/package/claude/settings.json.template +1 -0
- package/dist/templates/package/oxfmtrc.json.template +8 -1
- package/dist/templates/package/oxlintrc.json.template +1 -180
- package/dist/templates/package/package.json.liquid +1 -0
- package/dist/templates/package/vite.config.ts.liquid +2 -8
- package/dist/templates/package/vitest.config.ts.liquid +2 -8
- package/dist/templates/starter-game/package.json +2 -1
- package/dist/templates/starter-game/testing/engine/game.engine.test.ts +62 -37
- package/dist/templates/starter-game/vite.config.ts +2 -8
- package/dist/templates/starter-game/vitest.config.ts +4 -3
- package/dist/utils/error-codes.d.ts +6 -2
- package/dist/utils/resource-scan.d.ts +5 -0
- package/dist/vite/index.d.ts +30 -0
- package/dist/vite.js +12 -0
- package/package.json +12 -4
- package/dist/cli-3I6AI4AA.js +0 -36
- package/dist/cli-3YGNWZC6.js +0 -30
- package/dist/cli-4X3X4HB2.js +0 -16
- package/dist/cli-6ZBQELF2.js +0 -36
- package/dist/cli-CUZUIYCQ.js +0 -36
- package/dist/cli-DNCJURUU.js +0 -36
- package/dist/cli-UKC7KXWU.js +0 -36
- package/dist/cli-WA2PDQUB.js +0 -36
|
@@ -700,6 +700,21 @@ A host may now offer one join link for the whole session and put each person who
|
|
|
700
700
|
|
|
701
701
|
A game whose teams are interchangeable needs nothing. A test that builds the `game` settings by hand, rather than spreading the generated `defaultSettings`, adds `sessionJoin` to `teams`.
|
|
702
702
|
|
|
703
|
+
### 1.11: catch an older package's scaffold up
|
|
704
|
+
|
|
705
|
+
Nothing here is required. A package made by `sdk new package` at 1.11 has all of it, and from 1.11 each release's changelog lists what changed in the scaffold under **Scaffold changes**, one line per file, so a later upgrade only has to read those lines. An older package copies from `node_modules/@seriousgaming/sdk-tools/dist/templates/package/`, in this order:
|
|
706
|
+
|
|
707
|
+
1. **Replace `playwright.config.ts` first**, if it still names a port. Copy `global-setup.ts.template` to `testing/e2e/global-setup.ts` and replace `playwright.config.ts` from `playwright.config.ts.liquid`: and import `test` and `expect` from `@seriousgaming/sdk-tools/playwright` in each spec. Every worker then starts an isolated dev server on free ports, so two packages, or two checkouts of one, can run their browser tests at once
|
|
708
|
+
2. **Add the `check` script** to `package.json`, from `package.json.liquid`. It validates the package, typechecks, lints, and runs the unit and engine tests, stopping at the first that fails. Drop the `test:engine` step from it if the package has no engine tests
|
|
709
|
+
3. **Add an engine test that plays every scenario**, as [Playing every scenario](./engine-testing.md#playing-every-scenario) shows. Engine tests run logic in the restricted runtime, so this is what catches a scenario the engine cannot play
|
|
710
|
+
4. **Extend the SDK's lint rules for logic** in place of your copy. In `.oxlintrc.json`, add `"extends": ["./node_modules/@seriousgaming/sdk-tools/dist/oxlint/logic.json"]` and delete the override that lists `no-restricted-globals`, and the one that turns it off for tests. The list of globals the production runtime lacks then comes from the installed SDK
|
|
711
|
+
5. **Read the dedupe list from the SDK** in `vite.config.ts` and `vitest.config.ts`: `import { REACT_CONTEXT_PACKAGES } from '@seriousgaming/sdk-tools/vite'` and set `resolve.dedupe` to `[...REACT_CONTEXT_PACKAGES]`, followed by any package of your own that holds React context
|
|
712
|
+
6. **Keep build output out of the formatter.** Add `lib/`, `test-results/` and `playwright-report/` to `ignorePatterns` in `.oxfmtrc.json`
|
|
713
|
+
7. **Write the team mode down.** If `seriousgaming.sdk.json` has no `teams.mode`, add `"teams": { "mode": "independent" }`, which is what it has been running as, or `"shared-state"` if that is what the game needs
|
|
714
|
+
8. **Refresh the upgrade rule itself.** Replace `.claude/rules/workflow-update-sdk-version.md` from `claude/rules/`: the new one reads the **Scaffold changes** sections on every later upgrade
|
|
715
|
+
|
|
716
|
+
A workspace of several games applies each step to every game. The copies stay the game's own, so keep any local edit a template does not have.
|
|
717
|
+
|
|
703
718
|
### Optional: import the SDK's agent guidance in `CLAUDE.md`
|
|
704
719
|
|
|
705
720
|
A new package's `CLAUDE.md` no longer holds a copy of the SDK's guidance. Its first line imports the copy that ships with `@seriousgaming/sdk-tools`, so the guidance always matches the installed version, and the rest of the file is the package's own. An older package keeps the copy it was scaffolded with, which goes stale with every upgrade and, in a package that began as the starter game, describes the lemonade stand after a reskin.
|
package/dist/docs/page-index.md
CHANGED
|
@@ -25,7 +25,7 @@ This index lists pages; `--outline` lists a page's sections, each with its slug
|
|
|
25
25
|
- [`changelog-0.x.md`](changelog-0.x.md): Every release before 1.0, from 0.0.1 to 0.6.0, kept as history.
|
|
26
26
|
- [`changelog.md`](changelog.md): All notable changes to the Serious Gaming SDK are recorded here.
|
|
27
27
|
- [`cli-and-dev-server.md`](cli-and-dev-server.md), about 15k characters: The dev server runs your game on your own machine, with every screen in the browser, and the CLI plays and inspects the same session from the terminal.
|
|
28
|
-
- [`cli-error-codes.md`](cli-error-codes.md), about
|
|
28
|
+
- [`cli-error-codes.md`](cli-error-codes.md), about 33k characters: Every code a failed `seriousgaming-sdk` command can report.
|
|
29
29
|
- [`cli-reference.md`](cli-reference.md), about 163k characters: Every `seriousgaming-sdk` command and flag, in one place.
|
|
30
30
|
- [`cli-simulation-testing.md`](cli-simulation-testing.md), about 11k characters: Play a game from the terminal: configure it, start a session, make decisions, advance ticks, and read the state back as JSON.
|
|
31
31
|
- [`environment-variables.md`](environment-variables.md), about 10k characters: A single reference for every environment variable the dev server and CLI read.
|
|
@@ -45,7 +45,7 @@ This index lists pages; `--outline` lists a page's sections, each with its slug
|
|
|
45
45
|
- [`guides/designing-a-game.md`](guides/designing-a-game.md), about 13k characters: A serious game teaches by letting people act and then see what their actions caused.
|
|
46
46
|
- [`guides/designing-screens.md`](guides/designing-screens.md), about 12k characters: What a good simulation screen looks like, whatever the brand: how to decide what a screen should be before you build it, and how to check it afterwards.
|
|
47
47
|
- [`guides/endpoints.md`](guides/endpoints.md), about 29k characters: An endpoint is a named, server-side handler that a caller invokes by identifier: one of the game's own user interfaces, or a caller outside the game, such as a facilitator's AI agent or a platform API, when the endpoint allows it.
|
|
48
|
-
- [`guides/engine-testing.md`](guides/engine-testing.md), about
|
|
48
|
+
- [`guides/engine-testing.md`](guides/engine-testing.md), about 30k characters: Test your whole game in-process: no dev server, no browser, and no LLM API key required, because service callbacks are stubbed by default.
|
|
49
49
|
- [`guides/engine.md`](guides/engine.md), about 33k characters: The engine is the logic that moves your game forward: it sets up the board, then plays one round each tick.
|
|
50
50
|
- [`guides/file-handling.md`](guides/file-handling.md), about 28k characters: Ship files with your game or let participants upload them, then show them in any UI and read them in logic, all through one reference scheme.
|
|
51
51
|
- [`guides/games.md`](guides/games.md), about 7k characters: Shape the game as a whole: how many rounds it runs, how teams form, which languages it speaks, and where participants wait.
|
|
@@ -64,7 +64,7 @@ This index lists pages; `--outline` lists a page's sections, each with its slug
|
|
|
64
64
|
- [`guides/session-hooks.md`](guides/session-hooks.md), about 15k characters: Every hook a session UI reads its data and callbacks from, and the messages the host sends it.
|
|
65
65
|
- [`guides/session.md`](guides/session.md), about 23k characters: The session UI is the facilitator's view of the whole room: every team's position side by side, with the controls to run the session.
|
|
66
66
|
- [`guides/settings.md`](guides/settings.md), about 34k characters: Settings are a game's read-only parameters: a price, a difficulty, a round length, a menu, an answer key.
|
|
67
|
-
- [`guides/setup.md`](guides/setup.md), about
|
|
67
|
+
- [`guides/setup.md`](guides/setup.md), about 16k characters: The `setup` slot holds the small form a facilitator fills in when they create a session.
|
|
68
68
|
- [`guides/speech-generation.md`](guides/speech-generation.md), about 10k characters: Give characters and briefings a voice: generate speech from server-side logic and play it in any UI.
|
|
69
69
|
- [`guides/starter-game.md`](guides/starter-game.md), about 18k characters: `new package` hands you Lemonade Stand, a complete game rather than an empty shell.
|
|
70
70
|
- [`guides/testing.md`](guides/testing.md), about 34k characters: Test your engine's logic and your user interfaces, so a broken rule or a broken screen fails on your machine rather than in front of a room.
|
|
@@ -76,7 +76,7 @@ This index lists pages; `--outline` lists a page's sections, each with its slug
|
|
|
76
76
|
- [`guides/ui-styling.md`](guides/ui-styling.md), about 11k characters: How a game UI handles language, theme, and screen size, and how to customise the Vite build that serves and bundles it.
|
|
77
77
|
- [`guides/ui-ticks.md`](guides/ui-ticks.md), about 15k characters: How a game UI ends a round and shows the time left: requesting a tick, awaiting a write or tick and handling a `MutationError`, and driving a countdown from the tick timer.
|
|
78
78
|
- [`guides/ui.md`](guides/ui.md), about 17k characters: The game UI is what each participant sees and plays: where they read the situation, make decisions, and see what those decisions caused.
|
|
79
|
-
- [`guides/upgrading.md`](guides/upgrading.md), about
|
|
79
|
+
- [`guides/upgrading.md`](guides/upgrading.md), about 71k characters: This guide takes a game package on 0.6 to 1.0, in 13 steps.
|
|
80
80
|
- [`guides/validators.md`](guides/validators.md), about 25k characters: A validator is a read-only gate on what a participant does: a context write before it is applied, and a request for the next tick before it runs.
|
|
81
81
|
- [`guides/waiting-room.md`](guides/waiting-room.md), about 14k characters: The waiting room is the holding screen participants see while a session is parked, and you can replace the host's stock panel with your own.
|
|
82
82
|
|
|
@@ -142,8 +142,9 @@ This index lists pages; `--outline` lists a page's sections, each with its slug
|
|
|
142
142
|
- [`api/sdk-e2e.md`](api/sdk-e2e.md), about 11k characters: End-to-end testing helpers for Serious Gaming SDK consumers.
|
|
143
143
|
- [`api/sdk-projection.md`](api/sdk-projection.md), about 5k characters: The one documented shape of a session's observable state.
|
|
144
144
|
- [`api/sdk-testing.md`](api/sdk-testing.md), about 7k characters: Helpers for unit-testing a game's logic without a runtime.
|
|
145
|
-
- [`api/sdk-tools-client.md`](api/sdk-tools-client.md), about
|
|
145
|
+
- [`api/sdk-tools-client.md`](api/sdk-tools-client.md), about 15k characters: Programmatic API for testing a game in-process.
|
|
146
146
|
- [`api/sdk-tools-playwright.md`](api/sdk-tools-playwright.md), about 3k characters: Playwright for a game's browser tests: a dev server for each worker.
|
|
147
|
+
- [`api/sdk-tools-vite.md`](api/sdk-tools-vite.md), under 1k characters: What a game's Vite and Vitest configs need from the SDK.
|
|
147
148
|
- [`api/sdk-ui-testing.md`](api/sdk-ui-testing.md), about 8k characters: Every export of `@seriousgaming/sdk/ui/testing`, with the declaration it is published with.
|
|
148
149
|
- [`api/sdk-ui.md`](api/sdk-ui.md), about 36k characters: Every export of `@seriousgaming/sdk/ui`, with the declaration it is published with.
|
|
149
150
|
- [`api/sdk.md`](api/sdk.md), about 59k characters: Every export of `@seriousgaming/sdk`, with the declaration it is published with.
|
|
@@ -60,7 +60,7 @@ pnpm run sdk view
|
|
|
60
60
|
| The build reports no engine | Check `engine/engine.sdk.json` exists |
|
|
61
61
|
| The build warns that only the engine can end the game | There is no `maxTicks`; expected for a goal-based game |
|
|
62
62
|
| A patch fails on a missing path | Use `add` for a field the manifest does not have yet, `replace` for one it has |
|
|
63
|
-
| Detailed errors | Run `pnpm run sdk build --validate-only --json`
|
|
63
|
+
| Detailed errors | Run `pnpm run --silent sdk build --validate-only --json` |
|
|
64
64
|
|
|
65
65
|
## Related
|
|
66
66
|
|
|
@@ -21,24 +21,20 @@ Two copies of React in one page (a library that bundles its own, such as `@react
|
|
|
21
21
|
Create `vite.config.ts` alongside your `seriousgaming.sdk.json`:
|
|
22
22
|
|
|
23
23
|
```typescript
|
|
24
|
+
import { REACT_CONTEXT_PACKAGES } from '@seriousgaming/sdk-tools/vite';
|
|
24
25
|
import { defineConfig } from 'vite';
|
|
25
26
|
|
|
26
27
|
export default defineConfig({
|
|
27
28
|
resolve: {
|
|
28
|
-
dedupe: [
|
|
29
|
-
'react',
|
|
30
|
-
'react-dom',
|
|
31
|
-
'@emotion/react',
|
|
32
|
-
'@emotion/styled',
|
|
33
|
-
'@seriousgaming/sdk',
|
|
34
|
-
'@seriousgaming/deck',
|
|
35
|
-
],
|
|
29
|
+
dedupe: [...REACT_CONTEXT_PACKAGES],
|
|
36
30
|
},
|
|
37
31
|
});
|
|
38
32
|
```
|
|
39
33
|
|
|
40
34
|
`resolve.dedupe` tells Vite to resolve these packages to the single copy at the project root,
|
|
41
|
-
however many paths in the dependency tree lead to them.
|
|
35
|
+
however many paths in the dependency tree lead to them. `REACT_CONTEXT_PACKAGES` is the SDK's
|
|
36
|
+
list of every package that holds React context a surface reads: React, Emotion, the SDK and the
|
|
37
|
+
deck. Read it from the SDK rather than writing it out, so it keeps up when the SDK gains one.
|
|
42
38
|
|
|
43
39
|
If your package was created with `sdk new package` and already has a `vite.config.ts`, add
|
|
44
40
|
entries to its `dedupe` list rather than creating a second file.
|
|
@@ -59,24 +55,17 @@ Add a package to `dedupe` whenever you install a library that:
|
|
|
59
55
|
- Lists React (or Emotion) as a **peer dependency**, and
|
|
60
56
|
- Also `require()`s that peer internally in its own bundled code
|
|
61
57
|
|
|
62
|
-
Or any package that holds React context and that more than one path leads to, as the SDK does. A package created with `sdk new package`
|
|
58
|
+
Or any package that holds React context and that more than one path leads to, as the SDK does. A package created with `sdk new package` spreads `REACT_CONTEXT_PACKAGES` already, in both `vite.config.ts` and `vitest.config.ts`.
|
|
63
59
|
|
|
64
60
|
Example with additional libraries:
|
|
65
61
|
|
|
66
62
|
```typescript
|
|
63
|
+
import { REACT_CONTEXT_PACKAGES } from '@seriousgaming/sdk-tools/vite';
|
|
67
64
|
import { defineConfig } from 'vite';
|
|
68
65
|
|
|
69
66
|
export default defineConfig({
|
|
70
67
|
resolve: {
|
|
71
|
-
dedupe: [
|
|
72
|
-
'react',
|
|
73
|
-
'react-dom',
|
|
74
|
-
'@emotion/react',
|
|
75
|
-
'@emotion/styled',
|
|
76
|
-
'@seriousgaming/sdk',
|
|
77
|
-
'@seriousgaming/deck',
|
|
78
|
-
'@react-three/fiber',
|
|
79
|
-
],
|
|
68
|
+
dedupe: [...REACT_CONTEXT_PACKAGES, '@react-three/fiber'],
|
|
80
69
|
},
|
|
81
70
|
});
|
|
82
71
|
```
|
|
@@ -63,7 +63,13 @@ A settings resource at `settings/setup/` holding only your setup's choices, a se
|
|
|
63
63
|
|
|
64
64
|
6. Rewrite the setup screen's controls to write the menu with `updateSettings({ setup: { ... } })`, and remove any control for a setting the menu does not hold
|
|
65
65
|
|
|
66
|
-
7. Where what the menu offers depends on the scenario, such as an aid only some scenarios allow, keep that list in your other settings, where only a scenario can set it.
|
|
66
|
+
7. Where what the menu offers depends on the scenario, such as an aid only some scenarios allow, keep that list in your other settings, where only a scenario can set it. List that resource in the setup's `settings`, so the screen can hide or disable a choice the scenario does not allow:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pnpm run sdk update setup --patch '[{ "op": "add", "path": "/definition/settings", "value": ["ui"] }]'
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Say where it is in the menu setting's `description`, and refuse a choice the scenario does not allow in a [Scenario gate](validate-scenarios.md) that declares `setup` in its `settings`. List `session-validation` in `requires` so the gate runs as each session starts
|
|
67
73
|
|
|
68
74
|
8. Rewrite your [setup notes](write-setup-notes.md), if you have them, to name the menu's settings and say which requests need a scenario instead
|
|
69
75
|
|
|
@@ -34,7 +34,7 @@ A Markdown file at `setup/notes/en.md` that an assistant reads before setting a
|
|
|
34
34
|
- **Anything else**, such as cheaper materials: setup cannot do it. Suggest a scenario that does
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
2. Keep it short: the choices worth asking a facilitator about, what common requests mean as choices, and which requests need a scenario. Where a request matches one of your scenarios, say to pick that scenario instead. Where what the menu offers depends on the scenario, name the setting that says what it offers
|
|
37
|
+
2. Keep it short: the choices worth asking a facilitator about, what common requests mean as choices, and which requests need a scenario. Where a request matches one of your scenarios, say to pick that scenario instead. Where what the menu offers depends on the scenario, name the setting that says what it offers, and list its resource in your setup's `settings`: an assistant may be able to read it, though not change it
|
|
38
38
|
|
|
39
39
|
3. Add a file per locale you support, such as `setup/notes/it.md`. An assistant gets the notes in its locale, or `en`, or your first supported locale
|
|
40
40
|
|
|
@@ -46,7 +46,7 @@ A Markdown file at `setup/notes/en.md` that an assistant reads before setting a
|
|
|
46
46
|
## Troubleshooting
|
|
47
47
|
|
|
48
48
|
- _`SETTINGS_UNKNOWN` in `setup/notes/en.md`_: a code span names a setting your package does not declare, often a typo. Any code span starting with one of your settings identifiers is read as a setting path
|
|
49
|
-
- _`SETUP_NOTES_UNCONFIGURED`_: the notes name a setting your setup screen
|
|
49
|
+
- _`SETUP_NOTES_UNCONFIGURED`_: the notes name a setting your setup screen neither `configures` nor lists in `settings`, so a host refuses that change. If the notes name it only as where the menu's offer comes from, add its resource to the setup's `settings`. Otherwise leave the setting out and say which scenario does the job, or, if facilitators should choose it, add it to your [menu](give-setup-a-menu.md). Adding a whole settings resource such as `engine` to `configures` hands every setting in it to the assistant
|
|
50
50
|
- _A code span that is not a setting_, such as `requires`: fine. Only spans starting with a settings identifier are checked
|
|
51
51
|
|
|
52
52
|
## Related
|
package/dist/host/protocol.d.ts
CHANGED
|
@@ -689,15 +689,18 @@ export type HostSettingsEditorPortMessage = {
|
|
|
689
689
|
type: 'ping';
|
|
690
690
|
}
|
|
691
691
|
/**
|
|
692
|
-
* The **resolved** values of the settings this editor
|
|
693
|
-
* `
|
|
694
|
-
* and the same
|
|
695
|
-
* rather than the sparse override layer, which
|
|
696
|
-
* `{}` and would seed the form with nothing.
|
|
692
|
+
* The **resolved** values of the settings this editor `configures` and
|
|
693
|
+
* of those it lists in `settings`, keyed by settings identifier (§8.3):
|
|
694
|
+
* the same message, and the same payload, as every other surface's
|
|
695
|
+
* `setSettings`. Resolved rather than the sparse override layer, which
|
|
696
|
+
* for a fresh session is `{}` and would seed the form with nothing.
|
|
697
|
+
* `configures` names those of them the editor may change (§6.5); a host
|
|
698
|
+
* that predates it sends none, and then sends nothing it may not change.
|
|
697
699
|
*/
|
|
698
700
|
| {
|
|
699
701
|
type: 'setSettings';
|
|
700
702
|
payload: Record<string, Record<string, unknown>>;
|
|
703
|
+
configures?: string[];
|
|
701
704
|
} | {
|
|
702
705
|
type: 'setTheme';
|
|
703
706
|
payload: UserInterfaceTheme;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
{
|
|
2
|
+
"overrides": [
|
|
3
|
+
{
|
|
4
|
+
"files": [
|
|
5
|
+
"engine/**/*.ts",
|
|
6
|
+
"tick_controller/**/*.ts",
|
|
7
|
+
"**/hooks/*/logic/**/*.ts",
|
|
8
|
+
"**/validators/*/logic/**/*.ts",
|
|
9
|
+
"**/endpoints/*/logic/**/*.ts"
|
|
10
|
+
],
|
|
11
|
+
"rules": {
|
|
12
|
+
"no-restricted-globals": [
|
|
13
|
+
"error",
|
|
14
|
+
{
|
|
15
|
+
"name": "structuredClone",
|
|
16
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Context is JSON-serialisable, so JSON.parse(JSON.stringify(value)) is the portable equivalent."
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "TextEncoder",
|
|
20
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Import encodeUtf8 from @seriousgaming/sdk instead."
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "TextDecoder",
|
|
24
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Import decodeUtf8 from @seriousgaming/sdk instead."
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "fetch",
|
|
28
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Reach external services through the injected callbacks, or through an endpoint."
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "XMLHttpRequest",
|
|
32
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Reach external services through the injected callbacks, or through an endpoint."
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "setTimeout",
|
|
36
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Ticks are the scheduling primitive: logic must run to completion within one tick."
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "setInterval",
|
|
40
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Ticks are the scheduling primitive: logic must run to completion within one tick."
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "setImmediate",
|
|
44
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Ticks are the scheduling primitive: logic must run to completion within one tick."
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "queueMicrotask",
|
|
48
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Ticks are the scheduling primitive: logic must run to completion within one tick."
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "process",
|
|
52
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Settings reach logic through the `settings` argument."
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "Buffer",
|
|
56
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Use Uint8Array, with the SDK's encodeUtf8 / decodeUtf8 for string conversion."
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "URL",
|
|
60
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Build asset URLs from the references and callbacks the runtime injects."
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "clearTimeout",
|
|
64
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "clearInterval",
|
|
68
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "clearImmediate",
|
|
72
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"name": "URLSearchParams",
|
|
76
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"name": "crypto",
|
|
80
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "atob",
|
|
84
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"name": "btoa",
|
|
88
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"name": "performance",
|
|
92
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"name": "ReadableStream",
|
|
96
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"name": "WritableStream",
|
|
100
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "TransformStream",
|
|
104
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"name": "Blob",
|
|
108
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"name": "File",
|
|
112
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "FormData",
|
|
116
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"name": "Headers",
|
|
120
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"name": "Request",
|
|
124
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"name": "Response",
|
|
128
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"name": "AbortController",
|
|
132
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"name": "EventTarget",
|
|
136
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"name": "WebSocket",
|
|
140
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"name": "localStorage",
|
|
144
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"name": "sessionStorage",
|
|
148
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"name": "window",
|
|
152
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"name": "document",
|
|
156
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"name": "navigator",
|
|
160
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"name": "require",
|
|
164
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"name": "__dirname",
|
|
168
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"name": "__filename",
|
|
172
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"files": ["**/*.test.ts", "**/*.spec.ts"],
|
|
179
|
+
"rules": {
|
|
180
|
+
"no-restricted-globals": "off"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
}
|
package/dist/playwright.js
CHANGED
|
@@ -225,7 +225,7 @@ var BASES = [
|
|
|
225
225
|
sites: []
|
|
226
226
|
},
|
|
227
227
|
// The two settings editors (§6.5): one layout, both naming the settings
|
|
228
|
-
// they edit in `configures`. Neither ever lived under a plural directory;
|
|
228
|
+
// they edit in `configures` and those they only read in `settings`. Neither ever lived under a plural directory;
|
|
229
229
|
// the version 2 settings editors they replace did, and the loader refuses
|
|
230
230
|
// that directory with its own message.
|
|
231
231
|
{
|
|
@@ -237,6 +237,7 @@ var BASES = [
|
|
|
237
237
|
kind: "ui",
|
|
238
238
|
label: "Setup user interface",
|
|
239
239
|
declaresEndpoints: true,
|
|
240
|
+
readsSettings: true,
|
|
240
241
|
sites: []
|
|
241
242
|
},
|
|
242
243
|
{
|
|
@@ -248,6 +249,7 @@ var BASES = [
|
|
|
248
249
|
kind: "ui",
|
|
249
250
|
label: "Scenario editor",
|
|
250
251
|
declaresEndpoints: true,
|
|
252
|
+
readsSettings: true,
|
|
251
253
|
sites: []
|
|
252
254
|
},
|
|
253
255
|
{
|
|
@@ -601,7 +603,11 @@ var ERROR_CODES = {
|
|
|
601
603
|
},
|
|
602
604
|
SETUP_NOTES_UNCONFIGURED: {
|
|
603
605
|
category: "package",
|
|
604
|
-
description: "A warning: the setup notes name a setting the setup UI
|
|
606
|
+
description: "A warning: the setup notes name a setting the setup UI neither `configures` nor lists in `settings`, so a host refuses the change they describe and the setup UI cannot see it."
|
|
607
|
+
},
|
|
608
|
+
EDITOR_SETTINGS_CONFIGURED: {
|
|
609
|
+
category: "package",
|
|
610
|
+
description: "A warning: a settings editor lists a settings resource in both `configures` and `settings`. Configuring a resource already sends it, so the `settings` entry does nothing."
|
|
605
611
|
},
|
|
606
612
|
SETTINGS_UNGATED: {
|
|
607
613
|
category: "package",
|
|
@@ -887,6 +893,16 @@ function distPath(meta, identifier) {
|
|
|
887
893
|
return `${meta.pluralDir}/${identifier}`;
|
|
888
894
|
}
|
|
889
895
|
|
|
896
|
+
// cli/vite/index.ts
|
|
897
|
+
var REACT_CONTEXT_PACKAGES = [
|
|
898
|
+
"react",
|
|
899
|
+
"react-dom",
|
|
900
|
+
"@emotion/react",
|
|
901
|
+
"@emotion/styled",
|
|
902
|
+
"@seriousgaming/sdk",
|
|
903
|
+
"@seriousgaming/deck"
|
|
904
|
+
];
|
|
905
|
+
|
|
890
906
|
// cli/bundling/ui-bundler.ts
|
|
891
907
|
async function bundleUserInterface(ui, workingDir, buildDir, type) {
|
|
892
908
|
const uiOutputDir = join(buildDir, distPath(getResourceMeta(type), ui.definition.identifier));
|
|
@@ -912,7 +928,7 @@ async function bundleUserInterface(ui, workingDir, buildDir, type) {
|
|
|
912
928
|
configFile: false,
|
|
913
929
|
plugins: [react()],
|
|
914
930
|
resolve: {
|
|
915
|
-
dedupe: [
|
|
931
|
+
dedupe: [...REACT_CONTEXT_PACKAGES]
|
|
916
932
|
},
|
|
917
933
|
build: {
|
|
918
934
|
outDir: uiOutputDir,
|
|
@@ -1565,6 +1581,16 @@ var schema_default = {
|
|
|
1565
1581
|
uniqueItems: true,
|
|
1566
1582
|
default: []
|
|
1567
1583
|
},
|
|
1584
|
+
settings: {
|
|
1585
|
+
type: "array",
|
|
1586
|
+
description: "Identifiers of settings resources this setup user interface reads but does not edit, the built-in `game` included. It is sent their resolved values through `setSettings` beside those it configures, and a host refuses an `updateSettings` that names one. List a resource here, not in `configures`, when the screen only needs to see it, such as the list of what the scenario offers",
|
|
1587
|
+
items: {
|
|
1588
|
+
type: "string",
|
|
1589
|
+
pattern: "^[a-z][a-z0-9_]*$"
|
|
1590
|
+
},
|
|
1591
|
+
uniqueItems: true,
|
|
1592
|
+
default: []
|
|
1593
|
+
},
|
|
1568
1594
|
endpoints: {
|
|
1569
1595
|
type: "array",
|
|
1570
1596
|
description: "Endpoint identifiers this setup user interface is permitted to call via `callbacks.endpoints[<identifier>]`. The host throws when this UI requests an endpoint whose identifier is not listed here.",
|
|
@@ -1598,6 +1624,16 @@ var schema_default = {
|
|
|
1598
1624
|
uniqueItems: true,
|
|
1599
1625
|
default: []
|
|
1600
1626
|
},
|
|
1627
|
+
settings: {
|
|
1628
|
+
type: "array",
|
|
1629
|
+
description: "Identifiers of settings resources this scenario editor reads but does not edit, the built-in `game` included. It is sent their resolved values through `setSettings` beside those it configures, and a host refuses an `updateSettings` that names one. List a resource here, not in `configures`, when the screen only needs to see it, such as the list of what the scenario offers",
|
|
1630
|
+
items: {
|
|
1631
|
+
type: "string",
|
|
1632
|
+
pattern: "^[a-z][a-z0-9_]*$"
|
|
1633
|
+
},
|
|
1634
|
+
uniqueItems: true,
|
|
1635
|
+
default: []
|
|
1636
|
+
},
|
|
1601
1637
|
endpoints: {
|
|
1602
1638
|
type: "array",
|
|
1603
1639
|
description: "Endpoint identifiers this scenario editor is permitted to call via `callbacks.endpoints[<identifier>]`. The host throws when this UI requests an endpoint whose identifier is not listed here.",
|
|
@@ -17481,6 +17517,7 @@ import { WebSocketServer } from "ws";
|
|
|
17481
17517
|
|
|
17482
17518
|
// cli/core/listen-with-fallback.ts
|
|
17483
17519
|
import { createServer as createSocket } from "net";
|
|
17520
|
+
var PORT_IN_USE_HINT = "`sdk dev status` says whether a dev server is already running for this package. Pass --port auto to take any free port.";
|
|
17484
17521
|
async function listenWithPortFallback(server, startPort, options = {}) {
|
|
17485
17522
|
const maxAttempts = options.maxAttempts ?? 100;
|
|
17486
17523
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
@@ -17494,7 +17531,8 @@ async function listenWithPortFallback(server, startPort, options = {}) {
|
|
|
17494
17531
|
}
|
|
17495
17532
|
throw new CliError(
|
|
17496
17533
|
"PORT_IN_USE",
|
|
17497
|
-
`Could not find available port after ${maxAttempts} attempts
|
|
17534
|
+
`Could not find available port after ${maxAttempts} attempts`,
|
|
17535
|
+
{ hint: PORT_IN_USE_HINT }
|
|
17498
17536
|
);
|
|
17499
17537
|
}
|
|
17500
17538
|
function tryListen(server, port, host) {
|
|
@@ -17532,7 +17570,8 @@ async function findFreePort(startPort, maxAttempts = 100) {
|
|
|
17532
17570
|
}
|
|
17533
17571
|
throw new CliError(
|
|
17534
17572
|
"PORT_IN_USE",
|
|
17535
|
-
`Could not find available port after ${maxAttempts} attempts
|
|
17573
|
+
`Could not find available port after ${maxAttempts} attempts`,
|
|
17574
|
+
{ hint: PORT_IN_USE_HINT }
|
|
17536
17575
|
);
|
|
17537
17576
|
}
|
|
17538
17577
|
var PROBED_ADDRESSES = [void 0, "127.0.0.1", "::1"];
|
|
@@ -28830,6 +28869,16 @@ function collectUnknownSettingsReferences(config) {
|
|
|
28830
28869
|
const resources = [
|
|
28831
28870
|
{ label: 'Engine "engine"', type: "engine", definition: config.engine?.definition },
|
|
28832
28871
|
{ label: 'User Interface "ui"', type: "ui", definition: config.ui?.definition },
|
|
28872
|
+
{
|
|
28873
|
+
label: 'Setup User Interface "setup"',
|
|
28874
|
+
type: "setup",
|
|
28875
|
+
definition: config.setup?.definition
|
|
28876
|
+
},
|
|
28877
|
+
{
|
|
28878
|
+
label: 'Scenario Editor "scenario_editor"',
|
|
28879
|
+
type: "scenario_editor",
|
|
28880
|
+
definition: config.scenario_editor?.definition
|
|
28881
|
+
},
|
|
28833
28882
|
{
|
|
28834
28883
|
label: 'Session User Interface "session"',
|
|
28835
28884
|
type: "session",
|
|
@@ -29672,13 +29721,17 @@ var VALIDATION_DESCRIPTORS = [
|
|
|
29672
29721
|
type: "setup",
|
|
29673
29722
|
resources: (config) => slot(config.setup),
|
|
29674
29723
|
identify: named2,
|
|
29675
|
-
checks: [
|
|
29724
|
+
checks: [
|
|
29725
|
+
uiFiles,
|
|
29726
|
+
(setup, context) => setupNotesChecks(setup, context),
|
|
29727
|
+
editorSettingsChecks
|
|
29728
|
+
]
|
|
29676
29729
|
}),
|
|
29677
29730
|
descriptor({
|
|
29678
29731
|
type: "scenario_editor",
|
|
29679
29732
|
resources: (config) => slot(config.scenario_editor),
|
|
29680
29733
|
identify: named2,
|
|
29681
|
-
checks: [uiFiles]
|
|
29734
|
+
checks: [uiFiles, editorSettingsChecks]
|
|
29682
29735
|
}),
|
|
29683
29736
|
descriptor({
|
|
29684
29737
|
type: "tick_controller",
|
|
@@ -29962,11 +30015,32 @@ async function validateLoadedPackage(config, options) {
|
|
|
29962
30015
|
}
|
|
29963
30016
|
};
|
|
29964
30017
|
}
|
|
30018
|
+
function editorSettingsChecks(editor) {
|
|
30019
|
+
const slot2 = editor.definition.identifier;
|
|
30020
|
+
const configures = new Set(editor.definition.configures ?? []);
|
|
30021
|
+
const warnings = [];
|
|
30022
|
+
const findings = [];
|
|
30023
|
+
(editor.definition.settings ?? []).forEach((identifier, index3) => {
|
|
30024
|
+
if (!configures.has(identifier)) return;
|
|
30025
|
+
const message = `${slot2} lists "${identifier}" in both \`configures\` and \`settings\`. Configuring a resource already sends it to the screen, so remove it from \`settings\`, or from \`configures\` if the screen should only read it.`;
|
|
30026
|
+
warnings.push(message);
|
|
30027
|
+
findings.push({
|
|
30028
|
+
severity: "warning",
|
|
30029
|
+
code: "EDITOR_SETTINGS_CONFIGURED",
|
|
30030
|
+
message,
|
|
30031
|
+
file: bundleFileOf(slot2, slot2),
|
|
30032
|
+
pointer: pointerOf("definition", "settings", index3),
|
|
30033
|
+
resource: { type: slot2, identifier: slot2 }
|
|
30034
|
+
});
|
|
30035
|
+
});
|
|
30036
|
+
return { errors: [], warnings, findings };
|
|
30037
|
+
}
|
|
29965
30038
|
function setupNotesChecks(setup, context) {
|
|
29966
30039
|
const directory = resolve8(context.workingDir, setup.rootDirectory);
|
|
29967
30040
|
const schemas = settingsSchemas(context.config);
|
|
29968
30041
|
const identifiers = new Set(Object.keys(schemas));
|
|
29969
30042
|
const configures = new Set(setup.definition.configures ?? []);
|
|
30043
|
+
const reads = new Set(setup.definition.settings ?? []);
|
|
29970
30044
|
const resource = { type: "setup", identifier: "setup" };
|
|
29971
30045
|
const outcome = {
|
|
29972
30046
|
errors: [],
|
|
@@ -29982,8 +30056,8 @@ function setupNotesChecks(setup, context) {
|
|
|
29982
30056
|
for (const { path: path3, line } of notesSettingReferences(markdown, identifiers)) {
|
|
29983
30057
|
if (!settingPathDeclared(schemas, path3)) continue;
|
|
29984
30058
|
const identifier = parseSettingPath(path3)?.identifier ?? "";
|
|
29985
|
-
if (!configures.has(identifier)) {
|
|
29986
|
-
const message = `Setup notes ${file}, line ${line}, name \`${path3}\`, but the setup UI
|
|
30059
|
+
if (!configures.has(identifier) && !reads.has(identifier)) {
|
|
30060
|
+
const message = `Setup notes ${file}, line ${line}, name \`${path3}\`, but the setup UI neither configures nor reads "${identifier}", so a host refuses a change to it. Add "${identifier}" to its \`configures\` if setup may change it, or to its \`settings\` if the notes name it only as where the menu's offer is read from.`;
|
|
29987
30061
|
outcome.warnings.push(message);
|
|
29988
30062
|
outcome.findings.push({
|
|
29989
30063
|
severity: "warning",
|
|
@@ -30948,7 +31022,10 @@ function toSurface(kind2, bundle, hidden) {
|
|
|
30948
31022
|
endpoints: endpoints ?? [],
|
|
30949
31023
|
crossTeamReads: visible(crossTeamReads),
|
|
30950
31024
|
crossTeamParticipants: crossTeamParticipants === true,
|
|
30951
|
-
|
|
31025
|
+
...kind2 === "setup" || kind2 === "scenario-editor" ? {
|
|
31026
|
+
settings: [.../* @__PURE__ */ new Set([...configures ?? [], ...settings ?? []])],
|
|
31027
|
+
configures: configures ?? []
|
|
31028
|
+
} : { settings: settings ?? [] }
|
|
30952
31029
|
};
|
|
30953
31030
|
}
|
|
30954
31031
|
var SURFACE_SLOT = {
|
|
@@ -31055,10 +31132,21 @@ function buildBatch(options) {
|
|
|
31055
31132
|
// The two settings editors are sent the same batch (§12.3): neither is
|
|
31056
31133
|
// told which slot it fills, since each is its own bundle.
|
|
31057
31134
|
case "setup":
|
|
31058
|
-
return [
|
|
31135
|
+
return [
|
|
31136
|
+
{
|
|
31137
|
+
type: "setSettings",
|
|
31138
|
+
payload: settingsFor(state2, surface),
|
|
31139
|
+
configures: surface.configures ?? []
|
|
31140
|
+
},
|
|
31141
|
+
...common
|
|
31142
|
+
];
|
|
31059
31143
|
case "scenario-editor":
|
|
31060
31144
|
return [
|
|
31061
|
-
{
|
|
31145
|
+
{
|
|
31146
|
+
type: "setSettings",
|
|
31147
|
+
payload: draftSettingsFor(state2, surface, options.viewer),
|
|
31148
|
+
configures: surface.configures ?? []
|
|
31149
|
+
},
|
|
31062
31150
|
...common
|
|
31063
31151
|
];
|
|
31064
31152
|
case "presentation":
|
|
@@ -26,7 +26,7 @@ export declare const MANIFEST_VERSION = 3;
|
|
|
26
26
|
* section is stamped, it is the revision at the top of the appendix.
|
|
27
27
|
* `spec-revision.test.ts` holds the two together.
|
|
28
28
|
*/
|
|
29
|
-
export declare const SPEC_REVISION = "1.
|
|
29
|
+
export declare const SPEC_REVISION = "1.9";
|
|
30
30
|
/**
|
|
31
31
|
* Whether specification revision `revision` is later than `than`, both as
|
|
32
32
|
* `major.minor`. A runtime MAY warn when a package's `builtWith.specRevision`
|