@seriousgaming/sdk-tools 1.6.0 → 1.7.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.
Files changed (135) hide show
  1. package/dist/agent/guidance.md +350 -0
  2. package/dist/{cli-I355WTAF.js → cli-2DQJACAH.js} +20 -12
  3. package/dist/{cli-PTT5RGKO.js → cli-3PIJLSRQ.js} +5 -5
  4. package/dist/{cli-O6PWMJTZ.js → cli-4CHKF4DQ.js} +1 -1
  5. package/dist/{cli-UJ4UCL2Z.js → cli-4VZIJYKU.js} +1 -1
  6. package/dist/{cli-O5KP4OVN.js → cli-4XCQUM3E.js} +2 -2
  7. package/dist/{cli-6WXLXJVX.js → cli-57C72YKJ.js} +14 -14
  8. package/dist/{cli-GFBGYFYD.js → cli-57V4ARER.js} +1 -1
  9. package/dist/{cli-IRZ5KB7D.js → cli-5G7TZHD3.js} +14 -14
  10. package/dist/{cli-QEVDDBNO.js → cli-64AA7367.js} +8 -8
  11. package/dist/{cli-LMDJCHHD.js → cli-6HB6HTC6.js} +47 -47
  12. package/dist/{cli-TCY5LJ7E.js → cli-6ZSMW4HR.js} +10 -10
  13. package/dist/{cli-RN6IWTL2.js → cli-7MBLH4M3.js} +14 -14
  14. package/dist/{cli-K2B6WHKA.js → cli-7RYIEKMB.js} +10 -10
  15. package/dist/{cli-ZVSFYDPQ.js → cli-7TOLC62D.js} +16 -14
  16. package/dist/{cli-LXYPE3L5.js → cli-ATI6OLJU.js} +12 -12
  17. package/dist/{cli-ROT3DRKU.js → cli-BOXXMDSX.js} +16 -18
  18. package/dist/{cli-UKQYZYFK.js → cli-C3OERMIR.js} +1 -1
  19. package/dist/{cli-VCKOC2EV.js → cli-C6G65H6S.js} +2 -2
  20. package/dist/{cli-ORIG557O.js → cli-CV4JGVJR.js} +17 -27
  21. package/dist/{cli-HYY64SUD.js → cli-CXCL7VRK.js} +13 -13
  22. package/dist/{cli-FBTRTIZJ.js → cli-DEBCP7UH.js} +10 -10
  23. package/dist/{cli-BPYMTOUL.js → cli-DHOWZCXT.js} +10 -10
  24. package/dist/{cli-E6DJIMYD.js → cli-EDCAH2TC.js} +17 -23
  25. package/dist/{cli-C6TH5S7K.js → cli-EJVAQCMQ.js} +30 -3
  26. package/dist/{cli-DZW3XD5F.js → cli-ESA6YNPF.js} +17 -25
  27. package/dist/{cli-UTJU4IYG.js → cli-FP32D3T6.js} +10 -10
  28. package/dist/{cli-EVFS55WN.js → cli-FXWWYBYU.js} +22 -25
  29. package/dist/{cli-MBNMPVDC.js → cli-FXY3DKPW.js} +8 -5
  30. package/dist/{cli-G6UE5NL4.js → cli-FZ7QAZZP.js} +11 -11
  31. package/dist/{cli-KL3756X6.js → cli-G5DQGZ2E.js} +17 -19
  32. package/dist/{cli-JFU22EJ2.js → cli-GEQUJF4L.js} +11 -11
  33. package/dist/{cli-WAE26SVW.js → cli-GHLILDH7.js} +9 -9
  34. package/dist/{cli-PFFCNGHI.js → cli-GPAN6XK2.js} +3 -3
  35. package/dist/{cli-LFGRFIEO.js → cli-GTWEGYSU.js} +12 -12
  36. package/dist/{cli-4BV45LBH.js → cli-H3J3ICCQ.js} +2 -2
  37. package/dist/{cli-3E3MD5U4.js → cli-HHPMAV4F.js} +1 -1
  38. package/dist/{cli-M6BCQRID.js → cli-HM7CD4VU.js} +18 -29
  39. package/dist/{cli-DMW2OQIJ.js → cli-HYEU3QS6.js} +1 -1
  40. package/dist/{cli-TPU4TUR6.js → cli-IPP5FDCH.js} +12 -12
  41. package/dist/{cli-UELGBQG7.js → cli-JGFJWZFU.js} +1 -1
  42. package/dist/{cli-2GOFEW26.js → cli-JIZTQVL2.js} +8 -8
  43. package/dist/{cli-GXD36NF2.js → cli-JPAXKLVT.js} +8 -8
  44. package/dist/{cli-YVVXUD2G.js → cli-JR5AZLLK.js} +7 -2
  45. package/dist/{cli-PQBXVLEU.js → cli-JRIIAZ33.js} +8 -8
  46. package/dist/{cli-3HE4AVZG.js → cli-JRMHSMYT.js} +17 -21
  47. package/dist/{cli-SIPDUBFL.js → cli-L5IG7MY2.js} +14 -14
  48. package/dist/{cli-FYINNRML.js → cli-LE5ICDAF.js} +27 -70
  49. package/dist/{cli-LFM7GJHI.js → cli-LQ4VSM5R.js} +0 -0
  50. package/dist/{cli-RA673NGF.js → cli-LQERHJFE.js} +4 -4
  51. package/dist/{cli-ZWPYIXNI.js → cli-LRQDF3ZO.js} +7 -7
  52. package/dist/{cli-V4GHRWOV.js → cli-M7WEAIRF.js} +5 -5
  53. package/dist/{cli-GUXKQMJ7.js → cli-MM3A4SPH.js} +1 -1
  54. package/dist/{cli-5JEGTVTG.js → cli-MULKSLA4.js} +12 -12
  55. package/dist/{cli-B4TN6PJP.js → cli-MYJGGLC5.js} +2 -2
  56. package/dist/{cli-7OGYADZ3.js → cli-NEOLMC2P.js} +12 -12
  57. package/dist/{cli-IDKYF5XB.js → cli-NOQBWJQN.js} +1 -1
  58. package/dist/{cli-TLLA6KAP.js → cli-NPPY557S.js} +10 -10
  59. package/dist/{cli-GTSGLN3Z.js → cli-OANH3BTQ.js} +1 -1
  60. package/dist/{cli-UMFFURZ7.js → cli-OQG3Y4RU.js} +10 -10
  61. package/dist/{cli-6RRVEGFB.js → cli-PIO7NWMH.js} +10 -10
  62. package/dist/{cli-GDQ6ILJY.js → cli-PKQNOGBO.js} +7 -7
  63. package/dist/{cli-DL2CVMRF.js → cli-PVA52RC2.js} +11 -11
  64. package/dist/{cli-JZM7XTNV.js → cli-R7RG2VMW.js} +10 -10
  65. package/dist/{cli-ZISJ36MM.js → cli-SOFCTQAL.js} +10 -10
  66. package/dist/{cli-6AMT3BUO.js → cli-SOMIB4B4.js} +12 -12
  67. package/dist/{cli-E33CJRRQ.js → cli-SPGUVL6Z.js} +14 -14
  68. package/dist/{cli-4AKVLEC4.js → cli-SWZY7L7K.js} +3 -3
  69. package/dist/{cli-C3NVCKO6.js → cli-SX3ULO5P.js} +8 -8
  70. package/dist/{cli-S5QDONIQ.js → cli-T4HWGMY4.js} +7 -7
  71. package/dist/{cli-272KBNJH.js → cli-TDYKRXUA.js} +12 -12
  72. package/dist/{cli-UNJ5X6BU.js → cli-TFMNNVJ7.js} +10 -10
  73. package/dist/{cli-PNLYX6R6.js → cli-TFZ53OA2.js} +12 -12
  74. package/dist/{cli-KNOOKGYW.js → cli-TJ3PLRHF.js} +10 -10
  75. package/dist/{cli-JMZLT65J.js → cli-TPNQLYPC.js} +1 -1
  76. package/dist/{cli-QEVE5HUM.js → cli-UBQCSUDH.js} +11 -11
  77. package/dist/{cli-E2NLWIFE.js → cli-UTM4QU67.js} +1 -1
  78. package/dist/{cli-U2UE7I7J.js → cli-UY4VDI7W.js} +8 -8
  79. package/dist/{cli-XCO2VQOH.js → cli-VPON5HGB.js} +19 -17
  80. package/dist/{cli-Q2XJF5AS.js → cli-VYR326C6.js} +18 -21
  81. package/dist/{cli-G522CPRL.js → cli-WAZD75KE.js} +10 -10
  82. package/dist/{cli-R4PCG5YX.js → cli-WG36UJRK.js} +12 -12
  83. package/dist/{cli-GBFM76BF.js → cli-WM6SQJ6Q.js} +5 -5
  84. package/dist/{cli-G6KELFSX.js → cli-X7E3637I.js} +84 -17
  85. package/dist/{cli-AK7OIPWY.js → cli-XR2XSWQN.js} +13 -17
  86. package/dist/{cli-GGPDQNM3.js → cli-XTANOFQR.js} +2 -2
  87. package/dist/{cli-BYJWFFCF.js → cli-YSPZZQCP.js} +2 -2
  88. package/dist/{cli-EEFJKIGL.js → cli-Z5HWENER.js} +17 -25
  89. package/dist/{cli-57RXC3HQ.js → cli-ZBTFLZUL.js} +14 -14
  90. package/dist/{cli-SMFSZF2G.js → cli-ZF7IFB54.js} +21 -4
  91. package/dist/{cli-VCI3CG36.js → cli-ZKG3OPZ6.js} +9 -9
  92. package/dist/{cli-WOGIAU2E.js → cli-ZQ2Y3U7F.js} +7 -7
  93. package/dist/{cli-QUIJCBYB.js → cli-ZRPWZOCW.js} +15 -7
  94. package/dist/{cli-UHSZBKYO.js → cli-ZTZ5H55T.js} +12 -12
  95. package/dist/cli.js +36 -34
  96. package/dist/client.js +178 -69
  97. package/dist/core/game-settings.d.ts +5 -3
  98. package/dist/core/session-roster.d.ts +10 -0
  99. package/dist/dev/console/assets/{index-CuMOOH9m.js → index-CnXlPeLX.js} +47 -47
  100. package/dist/dev/console/index.html +1 -1
  101. package/dist/dev/routes.d.ts +5 -2
  102. package/dist/dev/shell.d.ts +9 -1
  103. package/dist/dev/view/batch.d.ts +11 -1
  104. package/dist/dev/view/route.d.ts +18 -1
  105. package/dist/dev/view/view.d.ts +9 -0
  106. package/dist/docs/ai-agents.md +1 -1
  107. package/dist/docs/api/index.md +1 -1
  108. package/dist/docs/api/sdk-commands.md +4 -0
  109. package/dist/docs/api/sdk-e2e.md +5 -0
  110. package/dist/docs/api/sdk-tools-client.md +4 -0
  111. package/dist/docs/api/sdk-ui-testing.md +1 -0
  112. package/dist/docs/api/sdk-ui.md +28 -0
  113. package/dist/docs/api/sdk.md +2 -0
  114. package/dist/docs/changelog.md +26 -0
  115. package/dist/docs/cli-and-dev-server.md +4 -0
  116. package/dist/docs/cli-reference.md +17 -2
  117. package/dist/docs/getting-started.md +1 -1
  118. package/dist/docs/guides/presentation.md +11 -10
  119. package/dist/docs/guides/session-hooks.md +16 -0
  120. package/dist/docs/guides/settings.md +4 -2
  121. package/dist/docs/guides/starter-game.md +1 -1
  122. package/dist/docs/guides/upgrading.md +31 -2
  123. package/dist/docs/page-index.md +6 -6
  124. package/dist/host/protocol.d.ts +10 -1
  125. package/dist/host.js +1 -0
  126. package/dist/playwright.js +178 -69
  127. package/dist/runtime/manifest-version.d.ts +1 -1
  128. package/dist/runtime.js +1 -1
  129. package/dist/schema.json +10 -1
  130. package/dist/templates/package/CLAUDE.md.template +7 -346
  131. package/dist/templates/package/claude/rules/workflow-create-engine.md +2 -2
  132. package/dist/templates/package/claude/rules/workflow-create-guide.md +2 -2
  133. package/dist/templates/package/claude/rules/workflow-create-user-interface.md +1 -1
  134. package/dist/templates/package/claude/rules/workflow-update-sdk-version.md +3 -3
  135. package/package.json +3 -3
@@ -1,46 +1,46 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  assertEveryPropertyHasDefault
4
- } from "./cli-O6PWMJTZ.js";
4
+ } from "./cli-4CHKF4DQ.js";
5
5
  import {
6
6
  promptForSchemaProperties
7
7
  } from "./cli-RZITKPJX.js";
8
8
  import {
9
9
  readAuthoredBundle
10
- } from "./cli-YVVXUD2G.js";
10
+ } from "./cli-JR5AZLLK.js";
11
11
  import {
12
12
  resolveInputSource
13
13
  } from "./cli-4UWFQNGF.js";
14
14
  import {
15
15
  createSettingsFiles
16
- } from "./cli-FYINNRML.js";
16
+ } from "./cli-LE5ICDAF.js";
17
17
  import "./cli-IUS2YCD3.js";
18
18
  import "./cli-QUNIRH7A.js";
19
- import "./cli-BYJWFFCF.js";
19
+ import "./cli-YSPZZQCP.js";
20
20
  import {
21
21
  loadPackageContext
22
22
  } from "./cli-XSVGKI3R.js";
23
- import "./cli-MBNMPVDC.js";
24
- import "./cli-GFBGYFYD.js";
23
+ import "./cli-FXY3DKPW.js";
24
+ import "./cli-57V4ARER.js";
25
25
  import {
26
26
  BUILD_COMMAND,
27
27
  generateTypes,
28
28
  operationError,
29
29
  printOperationResult
30
- } from "./cli-UELGBQG7.js";
30
+ } from "./cli-JGFJWZFU.js";
31
31
  import {
32
32
  input
33
33
  } from "./cli-ZTWOE3ZT.js";
34
- import "./cli-4BV45LBH.js";
35
- import "./cli-4AKVLEC4.js";
36
- import "./cli-VCKOC2EV.js";
37
- import "./cli-E2NLWIFE.js";
34
+ import "./cli-H3J3ICCQ.js";
35
+ import "./cli-SWZY7L7K.js";
36
+ import "./cli-C6G65H6S.js";
37
+ import "./cli-UTM4QU67.js";
38
38
  import "./cli-25RWY5BQ.js";
39
39
  import "./cli-QWQMPCL6.js";
40
40
  import {
41
41
  GAME_SETTINGS,
42
42
  validateSDKSettings
43
- } from "./cli-SMFSZF2G.js";
43
+ } from "./cli-ZF7IFB54.js";
44
44
  import "./cli-F2D4GGUA.js";
45
45
  import {
46
46
  logger
@@ -57,7 +57,7 @@ async function createSettings(definitionInput, options) {
57
57
  });
58
58
  const inputSource = await resolveInputSource(definitionInput, options.file);
59
59
  let identifier;
60
- let settingsSchema;
60
+ let definition;
61
61
  if (inputSource.kind === "json") {
62
62
  const settingsInput = readAuthoredBundle({
63
63
  json: inputSource.json,
@@ -66,7 +66,7 @@ async function createSettings(definitionInput, options) {
66
66
  validate: validateSDKSettings
67
67
  });
68
68
  identifier = settingsInput.definition.identifier;
69
- settingsSchema = settingsInput.definition.settingsSchema;
69
+ definition = settingsInput.definition;
70
70
  } else {
71
71
  logger.info("No JSON definition provided. Starting interactive mode...\n");
72
72
  const name = await input({
@@ -89,7 +89,9 @@ async function createSettings(definitionInput, options) {
89
89
  context: "setting",
90
90
  minProperties: 1
91
91
  });
92
- settingsSchema = { type: "object", properties, additionalProperties: false };
92
+ definition = {
93
+ settingsSchema: { type: "object", properties, additionalProperties: false }
94
+ };
93
95
  }
94
96
  if (identifier === GAME_SETTINGS) {
95
97
  throw new CliError(
@@ -100,12 +102,12 @@ async function createSettings(definitionInput, options) {
100
102
  }
101
103
  );
102
104
  }
103
- assertEveryPropertyHasDefault(settingsSchema);
105
+ assertEveryPropertyHasDefault(definition.settingsSchema);
104
106
  logger.info("Creating settings files...\n");
105
107
  const result = await createSettingsFiles({
106
108
  packagePath: options.workingDir,
107
109
  identifier,
108
- settingsSchema
110
+ definition
109
111
  });
110
112
  if (!result.success) {
111
113
  throw operationError(result, "Failed to create settings files");
@@ -1,46 +1,48 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  promptForSettings
4
- } from "./cli-UKQYZYFK.js";
4
+ } from "./cli-C3OERMIR.js";
5
5
  import {
6
6
  loadResourceIdentifiers
7
- } from "./cli-GGPDQNM3.js";
7
+ } from "./cli-XTANOFQR.js";
8
8
  import {
9
9
  readAuthoredBundle
10
- } from "./cli-YVVXUD2G.js";
10
+ } from "./cli-JR5AZLLK.js";
11
11
  import {
12
12
  resolveInputSource
13
13
  } from "./cli-4UWFQNGF.js";
14
14
  import {
15
15
  createValidatorFiles
16
- } from "./cli-FYINNRML.js";
16
+ } from "./cli-LE5ICDAF.js";
17
17
  import "./cli-IUS2YCD3.js";
18
18
  import "./cli-QUNIRH7A.js";
19
- import "./cli-BYJWFFCF.js";
19
+ import "./cli-YSPZZQCP.js";
20
20
  import {
21
21
  loadPackageContext
22
22
  } from "./cli-XSVGKI3R.js";
23
- import "./cli-MBNMPVDC.js";
24
- import "./cli-GFBGYFYD.js";
23
+ import {
24
+ presentFields
25
+ } from "./cli-FXY3DKPW.js";
26
+ import "./cli-57V4ARER.js";
25
27
  import {
26
28
  BUILD_COMMAND,
27
29
  generateTypes,
28
30
  operationError,
29
31
  printOperationResult
30
- } from "./cli-UELGBQG7.js";
32
+ } from "./cli-JGFJWZFU.js";
31
33
  import {
32
34
  checkbox,
33
35
  input
34
36
  } from "./cli-ZTWOE3ZT.js";
35
- import "./cli-4BV45LBH.js";
36
- import "./cli-4AKVLEC4.js";
37
- import "./cli-VCKOC2EV.js";
38
- import "./cli-E2NLWIFE.js";
37
+ import "./cli-H3J3ICCQ.js";
38
+ import "./cli-SWZY7L7K.js";
39
+ import "./cli-C6G65H6S.js";
40
+ import "./cli-UTM4QU67.js";
39
41
  import "./cli-25RWY5BQ.js";
40
42
  import "./cli-QWQMPCL6.js";
41
43
  import {
42
44
  validateSDKValidator
43
- } from "./cli-SMFSZF2G.js";
45
+ } from "./cli-ZF7IFB54.js";
44
46
  import "./cli-F2D4GGUA.js";
45
47
  import {
46
48
  logger
@@ -60,15 +62,11 @@ async function createValidator(definitionInput, options) {
60
62
  command: "new",
61
63
  validate: validateSDKValidator
62
64
  });
63
- const identifier2 = validatorInput.definition.identifier;
64
- const reads2 = validatorInput.definition.reads || [];
65
- const settings2 = validatorInput.definition.settings || [];
66
65
  logger.info("Creating validator files...\n");
67
66
  const result2 = await createValidatorFiles({
68
67
  packagePath: options.workingDir,
69
- identifier: identifier2,
70
- reads: reads2,
71
- settings: settings2
68
+ identifier: validatorInput.definition.identifier,
69
+ definition: validatorInput.definition
72
70
  });
73
71
  if (!result2.success) {
74
72
  throw operationError(result2, "Failed to create validator files");
@@ -109,8 +107,7 @@ async function createValidator(definitionInput, options) {
109
107
  const result = await createValidatorFiles({
110
108
  packagePath: options.workingDir,
111
109
  identifier,
112
- reads,
113
- settings
110
+ definition: presentFields({ reads, settings })
114
111
  });
115
112
  if (!result.success) {
116
113
  throw operationError(result, "Failed to create validator files");
@@ -2,31 +2,31 @@
2
2
  import {
3
3
  deleteValidatorFiles,
4
4
  findValidatorReferences
5
- } from "./cli-FYINNRML.js";
5
+ } from "./cli-LE5ICDAF.js";
6
6
  import "./cli-IUS2YCD3.js";
7
7
  import "./cli-QUNIRH7A.js";
8
- import "./cli-BYJWFFCF.js";
8
+ import "./cli-YSPZZQCP.js";
9
9
  import {
10
10
  loadPackageContext
11
11
  } from "./cli-XSVGKI3R.js";
12
- import "./cli-MBNMPVDC.js";
13
- import "./cli-GFBGYFYD.js";
12
+ import "./cli-FXY3DKPW.js";
13
+ import "./cli-57V4ARER.js";
14
14
  import {
15
15
  operationError,
16
16
  recordOperationResult
17
- } from "./cli-UELGBQG7.js";
17
+ } from "./cli-JGFJWZFU.js";
18
18
  import {
19
19
  confirmAction
20
20
  } from "./cli-ZTWOE3ZT.js";
21
21
  import {
22
22
  generateCommand
23
- } from "./cli-4BV45LBH.js";
24
- import "./cli-4AKVLEC4.js";
25
- import "./cli-VCKOC2EV.js";
26
- import "./cli-E2NLWIFE.js";
23
+ } from "./cli-H3J3ICCQ.js";
24
+ import "./cli-SWZY7L7K.js";
25
+ import "./cli-C6G65H6S.js";
26
+ import "./cli-UTM4QU67.js";
27
27
  import "./cli-25RWY5BQ.js";
28
28
  import "./cli-QWQMPCL6.js";
29
- import "./cli-SMFSZF2G.js";
29
+ import "./cli-ZF7IFB54.js";
30
30
  import "./cli-F2D4GGUA.js";
31
31
  import {
32
32
  logger
@@ -1,45 +1,45 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  resolvePatchedDefinition
4
- } from "./cli-UJ4UCL2Z.js";
4
+ } from "./cli-4VZIJYKU.js";
5
5
  import "./cli-S5IVGDDD.js";
6
6
  import {
7
7
  getResourceIdentifierError,
8
8
  readAuthoredBundle
9
- } from "./cli-YVVXUD2G.js";
9
+ } from "./cli-JR5AZLLK.js";
10
10
  import {
11
11
  resolveInputSource
12
12
  } from "./cli-4UWFQNGF.js";
13
13
  import {
14
14
  updateValidatorFiles
15
- } from "./cli-FYINNRML.js";
15
+ } from "./cli-LE5ICDAF.js";
16
16
  import "./cli-IUS2YCD3.js";
17
17
  import "./cli-QUNIRH7A.js";
18
- import "./cli-BYJWFFCF.js";
18
+ import "./cli-YSPZZQCP.js";
19
19
  import {
20
20
  loadPackageContext
21
21
  } from "./cli-XSVGKI3R.js";
22
- import "./cli-MBNMPVDC.js";
22
+ import "./cli-FXY3DKPW.js";
23
23
  import {
24
24
  findBundleFile
25
- } from "./cli-GFBGYFYD.js";
25
+ } from "./cli-57V4ARER.js";
26
26
  import {
27
27
  operationError,
28
28
  printOperationResult,
29
29
  regenerateTypes
30
- } from "./cli-UELGBQG7.js";
30
+ } from "./cli-JGFJWZFU.js";
31
31
  import {
32
32
  input
33
33
  } from "./cli-ZTWOE3ZT.js";
34
- import "./cli-4BV45LBH.js";
35
- import "./cli-4AKVLEC4.js";
36
- import "./cli-VCKOC2EV.js";
37
- import "./cli-E2NLWIFE.js";
34
+ import "./cli-H3J3ICCQ.js";
35
+ import "./cli-SWZY7L7K.js";
36
+ import "./cli-C6G65H6S.js";
37
+ import "./cli-UTM4QU67.js";
38
38
  import "./cli-25RWY5BQ.js";
39
39
  import "./cli-QWQMPCL6.js";
40
40
  import {
41
41
  validateSDKValidator
42
- } from "./cli-SMFSZF2G.js";
42
+ } from "./cli-ZF7IFB54.js";
43
43
  import "./cli-F2D4GGUA.js";
44
44
  import {
45
45
  logger
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  generateCommand
4
- } from "./cli-4BV45LBH.js";
5
- import "./cli-4AKVLEC4.js";
6
- import "./cli-VCKOC2EV.js";
7
- import "./cli-E2NLWIFE.js";
4
+ } from "./cli-H3J3ICCQ.js";
5
+ import "./cli-SWZY7L7K.js";
6
+ import "./cli-C6G65H6S.js";
7
+ import "./cli-UTM4QU67.js";
8
8
  import "./cli-25RWY5BQ.js";
9
9
  import "./cli-QWQMPCL6.js";
10
- import "./cli-SMFSZF2G.js";
10
+ import "./cli-ZF7IFB54.js";
11
11
  import "./cli-F2D4GGUA.js";
12
12
  import "./cli-4YB3ROVR.js";
13
13
  import "./cli-N6H6T2E2.js";
@@ -4,12 +4,12 @@ import {
4
4
  } from "./cli-BWX5E7TQ.js";
5
5
  import {
6
6
  validatePackage
7
- } from "./cli-V4GHRWOV.js";
7
+ } from "./cli-M7WEAIRF.js";
8
8
  import {
9
9
  PackageScenarioError,
10
10
  createPackageScenario,
11
11
  deletePackageScenario
12
- } from "./cli-LFM7GJHI.js";
12
+ } from "./cli-LQ4VSM5R.js";
13
13
  import {
14
14
  PENDING_CHANGES_HINT,
15
15
  REINITIALISED_ON_CHANGE,
@@ -20,7 +20,7 @@ import {
20
20
  isQuery,
21
21
  pendingHeadline,
22
22
  rebuildsWalkthrough
23
- } from "./cli-C6TH5S7K.js";
23
+ } from "./cli-EJVAQCMQ.js";
24
24
  import {
25
25
  newInstanceId,
26
26
  removeLockFile,
@@ -35,7 +35,7 @@ import {
35
35
  import {
36
36
  describeScenarioProblems,
37
37
  runScenarioGates
38
- } from "./cli-VCKOC2EV.js";
38
+ } from "./cli-C6G65H6S.js";
39
39
  import {
40
40
  mediaTypeOf,
41
41
  readBlob,
@@ -49,7 +49,7 @@ import {
49
49
  gameSettingsOf,
50
50
  settingsSchemas,
51
51
  withoutLockedDefaults
52
- } from "./cli-SMFSZF2G.js";
52
+ } from "./cli-ZF7IFB54.js";
53
53
  import {
54
54
  logger
55
55
  } from "./cli-4YB3ROVR.js";
@@ -66,6 +66,7 @@ var PATTERNS = [
66
66
  [/^\/team\/(\d+)\/observe\/?$/, (m) => ({ kind: "observer", teamIndex: index(m[1]) })],
67
67
  [/^\/team\/(\d+)\/join\/?$/, (m) => ({ kind: "join", teamIndex: index(m[1]) })],
68
68
  [/^\/team\/(\d+)\/waiting-room\/?$/, (m) => ({ kind: "waiting-room", teamIndex: index(m[1]) })],
69
+ [/^\/join\/?$/, () => ({ kind: "session-join" })],
69
70
  [/^\/setup\/?$/, () => ({ kind: "setup" })],
70
71
  [/^\/scenario-editor\/?$/, () => ({ kind: "scenario-editor" })],
71
72
  [/^\/guide\/?$/, () => ({ kind: "guide" })],
@@ -82,6 +83,10 @@ function player(team, participant) {
82
83
  function index(team) {
83
84
  return Math.max(0, Number(team) - 1);
84
85
  }
86
+ var LOCAL_ORIGINS_FLAG = "local-origins";
87
+ function wantsLocalOrigins(search) {
88
+ return new URLSearchParams(search).has(LOCAL_ORIGINS_FLAG);
89
+ }
85
90
  function parseRoute(pathname, search) {
86
91
  const query = new URLSearchParams(search);
87
92
  const bare = query.has("bare");
@@ -104,7 +109,7 @@ function parseRoute(pathname, search) {
104
109
  }
105
110
  function routeHref(route) {
106
111
  const team = (route.teamIndex ?? 0) + 1;
107
- const path = route.run === "walkthrough" ? "/walkthrough" : route.kind === "player" ? `/team/${team}/player/${route.participant ?? 1}` : route.kind === "observer" ? `/team/${team}/observe` : route.kind === "join" ? `/team/${team}/join` : route.kind === "waiting-room" ? `/team/${team}/waiting-room` : route.kind === "console" ? "/" : `/${route.kind}`;
112
+ const path = route.run === "walkthrough" ? "/walkthrough" : route.kind === "player" ? `/team/${team}/player/${route.participant ?? 1}` : route.kind === "observer" ? `/team/${team}/observe` : route.kind === "join" ? `/team/${team}/join` : route.kind === "session-join" ? "/join" : route.kind === "waiting-room" ? `/team/${team}/waiting-room` : route.kind === "console" ? "/" : `/${route.kind}`;
108
113
  const query = new URLSearchParams();
109
114
  if (route.scenario !== void 0) query.set("scenario", route.scenario);
110
115
  if (route.preview) query.set("preview", "");
@@ -1104,6 +1109,7 @@ function sessionBatch({
1104
1109
  participants: participantList(state)
1105
1110
  },
1106
1111
  { type: "setTeamLinks", payload: teamLinks(state, origin) },
1112
+ { type: "setSessionJoinLink", payload: sessionJoinLink(state, origin) },
1107
1113
  { type: "setWalkthroughLink", payload: walkthroughLink(origin) },
1108
1114
  { type: "setRunKind", runKind: state.session.runKind },
1109
1115
  { type: "setScenarioName", scenarioName: state.game.scenarioName },
@@ -1146,7 +1152,8 @@ function presentationBatch({
1146
1152
  teamId,
1147
1153
  joinUrl: joinUrl2
1148
1154
  })),
1149
- joinPin: null
1155
+ joinPin: null,
1156
+ sessionJoinLink: sessionJoinLink(state, origin)
1150
1157
  }
1151
1158
  }
1152
1159
  },
@@ -1188,6 +1195,11 @@ function teamLinks(state, origin) {
1188
1195
  observeUrl: `${origin}/team/${team.index + 1}/observe`
1189
1196
  }));
1190
1197
  }
1198
+ function sessionJoinLink(state, origin) {
1199
+ if (state.session.runKind === "walkthrough") return null;
1200
+ if (!gameSettingsOf(state.settings).teams.sessionJoin) return null;
1201
+ return { joinUrl: `${origin}/join?bare` };
1202
+ }
1191
1203
  function teamConfiguration(state) {
1192
1204
  return {
1193
1205
  mode: state.session.mode,
@@ -1226,13 +1238,18 @@ function sessionData(state, surface) {
1226
1238
  function runOf(req) {
1227
1239
  return req.query.run === "walkthrough" ? "walkthrough" : "session";
1228
1240
  }
1241
+ function localOrigins(req, res) {
1242
+ if (req.query[LOCAL_ORIGINS_FLAG] === void 0) return false;
1243
+ res.setHeader("Cache-Control", "no-store");
1244
+ return true;
1245
+ }
1229
1246
  function registerRoutes(app, deps) {
1230
1247
  const { session, packagePath, runFor } = deps;
1231
1248
  app.get("/api/state", async (req, res) => {
1232
1249
  res.json((await runFor(runOf(req))).project());
1233
1250
  });
1234
1251
  app.get("/api/surfaces", (req, res) => {
1235
- const origin = deps.assetOrigin(req.headers.host);
1252
+ const origin = deps.assetOrigin(req.headers.host, localOrigins(req, res));
1236
1253
  res.json(
1237
1254
  mountableSurfaces(session.packageConfiguration()).map((mountable) => ({
1238
1255
  ...mountable,
@@ -1297,7 +1314,7 @@ function registerRoutes(app, deps) {
1297
1314
  });
1298
1315
  });
1299
1316
  app.get("/api/brands", (req, res) => {
1300
- const assetOrigin = deps.assetOrigin(req.headers.host);
1317
+ const assetOrigin = deps.assetOrigin(req.headers.host, localOrigins(req, res));
1301
1318
  res.json({ brands: deps.brands().map((brand) => summarise(brand, assetOrigin)) });
1302
1319
  });
1303
1320
  app.get("/api/locales", (_req, res) => {
@@ -1811,6 +1828,7 @@ var VIEW_ROUTES = /* @__PURE__ */ new Set([
1811
1828
  "observer",
1812
1829
  "waiting-room",
1813
1830
  "join",
1831
+ "session-join",
1814
1832
  "setup"
1815
1833
  ]);
1816
1834
  function isViewRoute(route) {
@@ -1825,6 +1843,12 @@ function resolveView(state, route, surfaces) {
1825
1843
  if (!inSetup && effective.kind === "setup") {
1826
1844
  return { status: "closed", configurable };
1827
1845
  }
1846
+ if (effective.kind === "session-join") {
1847
+ return {
1848
+ status: "session-join",
1849
+ offered: state.session.runKind !== "walkthrough" && gameSettingsOf(state.settings).teams.sessionJoin
1850
+ };
1851
+ }
1828
1852
  if (effective.kind === "join") {
1829
1853
  const team = state.teams.find((candidate) => candidate.index === effective.teamIndex);
1830
1854
  if (!team) return { status: "join", team: null };
@@ -1896,7 +1920,7 @@ var REINITIALISING_CAUSES = /* @__PURE__ */ new Set([
1896
1920
  "selectScenario",
1897
1921
  REINITIALISED_ON_CHANGE
1898
1922
  ]);
1899
- var CONSOLE_ROUTE = /^\/(?:$|team\/\d+(?:\/(?:player(?:\/\d+)?|observe|join|waiting-room))?\/?$|walkthrough\/?$|setup\/?$|scenario-editor\/?$|guide\/?$|print\/?$|presentation\/?$)/;
1923
+ var CONSOLE_ROUTE = /^\/(?:$|team\/\d+(?:\/(?:player(?:\/\d+)?|observe|join|waiting-room))?\/?$|join\/?$|walkthrough\/?$|setup\/?$|scenario-editor\/?$|guide\/?$|print\/?$|presentation\/?$)/;
1900
1924
  var DELEGATED_FEATURES = [
1901
1925
  "clipboard-write",
1902
1926
  "autoplay",
@@ -2191,9 +2215,12 @@ var DevShell = class {
2191
2215
  * public one where given, else the same host on the asset port. A browser
2192
2216
  * on another machine reached us by an address `localhost` would not
2193
2217
  * resolve to on its side.
2218
+ *
2219
+ * `local` skips the public one, for a client that has said it runs here
2220
+ * (`?local-origins`): it may not reach the proxy in front of us at all.
2194
2221
  */
2195
- assetOrigin(host) {
2196
- const configured = this.publicAssetUrl;
2222
+ assetOrigin(host, local = false) {
2223
+ const configured = local ? null : this.publicAssetUrl;
2197
2224
  if (configured) return configured;
2198
2225
  const name = (host ?? "localhost").replace(/:\d+$/, "") || "localhost";
2199
2226
  return `http://${name}:${this.assetPort}`;
@@ -2307,7 +2334,7 @@ var DevShell = class {
2307
2334
  settleWalkthroughReset: (command) => this.settleWalkthroughReset(command),
2308
2335
  packagePath: this.options.packagePath,
2309
2336
  vitePort: () => this.vitePort,
2310
- assetOrigin: (host) => this.assetOrigin(host),
2337
+ assetOrigin: (host, local) => this.assetOrigin(host, local),
2311
2338
  instanceId: this.instanceId,
2312
2339
  notices: (run) => this.notices(run),
2313
2340
  brands: () => this.currentBrands()
@@ -2325,10 +2352,12 @@ ${MISSING_CONSOLE_MESSAGE}
2325
2352
  res.status(503).type("text/plain").send(MISSING_CONSOLE_MESSAGE);
2326
2353
  return;
2327
2354
  }
2355
+ const local = wantsLocalOrigins(req.url.split("?")[1] ?? "");
2328
2356
  res.setHeader(
2329
2357
  "Permissions-Policy",
2330
- delegatedFeatures(this.assetOrigin(req.headers.host))
2358
+ delegatedFeatures(this.assetOrigin(req.headers.host, local))
2331
2359
  );
2360
+ if (local) res.setHeader("Cache-Control", "no-store");
2332
2361
  res.sendFile("index.html", { root: console_.path });
2333
2362
  });
2334
2363
  this.app.use(express2.static(console_.path));
@@ -2528,7 +2557,11 @@ Install the package's dependencies to serve its surfaces.
2528
2557
  socket.close(4e3, "Not a viewer page");
2529
2558
  return;
2530
2559
  }
2531
- this.views.set(socket, { route, host: request.headers.host });
2560
+ this.views.set(socket, {
2561
+ route,
2562
+ host: request.headers.host,
2563
+ localOrigins: wantsLocalOrigins(location.search)
2564
+ });
2532
2565
  void this.sendView(socket).then(() => this.syncPresence(route.run));
2533
2566
  socket.on("message", (raw) => void this.receiveView(socket, raw));
2534
2567
  socket.on("close", () => {
@@ -2588,7 +2621,10 @@ Install the package's dependencies to serve its surfaces.
2588
2621
  // -----------------------------------------------------------------------
2589
2622
  /** What one viewer page is owed, now. */
2590
2623
  viewOf(session, view, state = session.project()) {
2591
- const origin = this.assetOrigin(view.host);
2624
+ if (view.joined !== void 0) {
2625
+ return { page: { status: "redirect", href: view.joined }, messages: [] };
2626
+ }
2627
+ const origin = this.assetOrigin(view.host, view.localOrigins);
2592
2628
  const surfaces = mountableSurfaces(session.packageConfiguration()).map(
2593
2629
  (surface) => ({ ...surface, origin })
2594
2630
  );
@@ -2729,7 +2765,9 @@ Install the package's dependencies to serve its surfaces.
2729
2765
  try {
2730
2766
  const session = await this.runFor(view.route.run);
2731
2767
  const { page } = this.viewOf(session, view);
2732
- if (page.status === "surface") {
2768
+ if (page.status === "session-join" && frameMessage.type === "joinSession") {
2769
+ result = await this.joinThroughSessionLink(session, view, socket, frameMessage);
2770
+ } else if (page.status === "surface") {
2733
2771
  const command = queryFor(frameMessage, page.surface, page.viewer) ?? commandFor(frameMessage, page.surface, page.viewer);
2734
2772
  if (isFrameRefusal(command)) {
2735
2773
  result = { ok: false, outcome: { kind: "denied", message: command.refused } };
@@ -2745,6 +2783,34 @@ Install the package's dependencies to serve its surfaces.
2745
2783
  }
2746
2784
  if (requestId) send(socket, { type: "result", requestId, result });
2747
2785
  }
2786
+ /**
2787
+ * Join from the session link's page (§13.4): the session places the
2788
+ * newcomer, and the page is sent on to the participant it made.
2789
+ */
2790
+ async joinThroughSessionLink(session, view, socket, message) {
2791
+ const before = new Set(
2792
+ session.project().teams.flatMap((t) => t.participants.map((p) => p.id))
2793
+ );
2794
+ const name = typeof message.name === "string" ? message.name : void 0;
2795
+ const result = await session.submit({
2796
+ type: "joinSession",
2797
+ ...name === void 0 ? {} : { name }
2798
+ });
2799
+ if (!result.ok) return result;
2800
+ for (const team of session.project().teams) {
2801
+ const position = team.participants.findIndex((p) => !before.has(p.id));
2802
+ if (position === -1) continue;
2803
+ view.joined = routeHref({
2804
+ kind: "player",
2805
+ teamIndex: team.index,
2806
+ participant: position + 1,
2807
+ bare: true
2808
+ });
2809
+ await this.sendView(socket, session);
2810
+ break;
2811
+ }
2812
+ return result;
2813
+ }
2748
2814
  broadcast(event, run) {
2749
2815
  let payload = null;
2750
2816
  this.sockets?.clients.forEach((client) => {
@@ -2842,6 +2908,7 @@ function hmrConnectSources(host, vitePort) {
2842
2908
  }
2843
2909
 
2844
2910
  export {
2911
+ LOCAL_ORIGINS_FLAG,
2845
2912
  parseRoute,
2846
2913
  DevShell
2847
2914
  };
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  loadResourceIdentifiers
4
- } from "./cli-GGPDQNM3.js";
4
+ } from "./cli-XTANOFQR.js";
5
5
  import {
6
6
  resolvePatchedDefinition
7
- } from "./cli-UJ4UCL2Z.js";
7
+ } from "./cli-4VZIJYKU.js";
8
8
  import {
9
9
  readAuthoredBundle
10
- } from "./cli-YVVXUD2G.js";
10
+ } from "./cli-JR5AZLLK.js";
11
11
  import {
12
12
  resolveInputSource
13
13
  } from "./cli-4UWFQNGF.js";
@@ -16,7 +16,7 @@ import {
16
16
  deleteSettingsEditorFiles,
17
17
  findSettingsEditorReferences,
18
18
  updateSettingsEditorFiles
19
- } from "./cli-FYINNRML.js";
19
+ } from "./cli-LE5ICDAF.js";
20
20
  import {
21
21
  loadPackageContext
22
22
  } from "./cli-XSVGKI3R.js";
@@ -27,19 +27,19 @@ import {
27
27
  printOperationResult,
28
28
  recordOperationResult,
29
29
  regenerateTypes
30
- } from "./cli-UELGBQG7.js";
30
+ } from "./cli-JGFJWZFU.js";
31
31
  import {
32
32
  checkbox,
33
33
  confirmAction
34
34
  } from "./cli-ZTWOE3ZT.js";
35
35
  import {
36
36
  generateCommand
37
- } from "./cli-4BV45LBH.js";
37
+ } from "./cli-H3J3ICCQ.js";
38
38
  import {
39
39
  getResourceMeta,
40
40
  validateSDKScenarioEditor,
41
41
  validateSDKSetup
42
- } from "./cli-SMFSZF2G.js";
42
+ } from "./cli-ZF7IFB54.js";
43
43
  import {
44
44
  resourceExample
45
45
  } from "./cli-F2D4GGUA.js";
@@ -69,22 +69,19 @@ Creating the ${label}...
69
69
  `);
70
70
  loadPackageContext(options.workingDir, { suggestNewPackage: true });
71
71
  const inputSource = await resolveInputSource(definitionInput, options.file);
72
- let configures;
73
- let endpoints;
72
+ let definition;
74
73
  if (inputSource.kind === "json") {
75
- const bundle = readAuthoredBundle({
74
+ definition = readAuthoredBundle({
76
75
  json: inputSource.json,
77
76
  type: slot,
78
77
  command: "new",
79
78
  validate: VALIDATORS[slot]
80
- });
81
- configures = bundle.definition.configures ?? [];
82
- endpoints = bundle.definition.endpoints ?? [];
79
+ }).definition;
83
80
  } else {
84
81
  logger.info("No JSON definition provided. Starting interactive mode...\n");
85
82
  const available = loadResourceIdentifiers(options.workingDir, "settings");
86
- configures = [];
87
- endpoints = [];
83
+ const configures = [];
84
+ definition = { configures };
88
85
  if (available.length > 0) {
89
86
  logger.info(`Select the settings the ${label} will edit.
90
87
  `);
@@ -107,8 +104,7 @@ Creating the ${label}...
107
104
  packagePath: options.workingDir,
108
105
  slot,
109
106
  name: TITLES[slot],
110
- configures,
111
- endpoints
107
+ definition
112
108
  });
113
109
  if (!result.success) {
114
110
  throw operationError(result, `Failed to create ${label} files`);