@seriousgaming/sdk-tools 1.6.1 → 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 (126) hide show
  1. package/dist/{cli-7A6MKCUJ.js → cli-2DQJACAH.js} +20 -12
  2. package/dist/{cli-R2MUZQE2.js → cli-3PIJLSRQ.js} +5 -5
  3. package/dist/{cli-64AB62PM.js → cli-4CHKF4DQ.js} +1 -1
  4. package/dist/{cli-5IAW3LIF.js → cli-4VZIJYKU.js} +1 -1
  5. package/dist/{cli-72XDEFU3.js → cli-4XCQUM3E.js} +2 -2
  6. package/dist/{cli-2GZYGRVL.js → cli-57C72YKJ.js} +14 -14
  7. package/dist/{cli-OXAUOWCN.js → cli-57V4ARER.js} +1 -1
  8. package/dist/{cli-N24OHSAN.js → cli-5G7TZHD3.js} +14 -14
  9. package/dist/{cli-DOXRQ3S5.js → cli-64AA7367.js} +8 -8
  10. package/dist/{cli-VPRRICZA.js → cli-6HB6HTC6.js} +47 -47
  11. package/dist/{cli-ZDUADFBY.js → cli-6ZSMW4HR.js} +10 -10
  12. package/dist/{cli-RCIWBCXD.js → cli-7MBLH4M3.js} +14 -14
  13. package/dist/{cli-4PXNOJQX.js → cli-7RYIEKMB.js} +10 -10
  14. package/dist/{cli-6UTPHWRQ.js → cli-7TOLC62D.js} +14 -14
  15. package/dist/{cli-N45DREM4.js → cli-ATI6OLJU.js} +12 -12
  16. package/dist/{cli-PGCIHPU7.js → cli-BOXXMDSX.js} +11 -11
  17. package/dist/{cli-ZDOTXEKL.js → cli-C3OERMIR.js} +1 -1
  18. package/dist/{cli-OMWC75CC.js → cli-C6G65H6S.js} +2 -2
  19. package/dist/{cli-ZJFQ7EEA.js → cli-CV4JGVJR.js} +13 -13
  20. package/dist/{cli-KGM6RRQW.js → cli-CXCL7VRK.js} +13 -13
  21. package/dist/{cli-O5ABH2WK.js → cli-DEBCP7UH.js} +10 -10
  22. package/dist/{cli-KOGRWFN7.js → cli-DHOWZCXT.js} +10 -10
  23. package/dist/{cli-MU5LB43S.js → cli-EDCAH2TC.js} +13 -13
  24. package/dist/{cli-XSLNH5PR.js → cli-EJVAQCMQ.js} +30 -3
  25. package/dist/{cli-JZCLIT3O.js → cli-ESA6YNPF.js} +13 -13
  26. package/dist/{cli-XAT25PRU.js → cli-FP32D3T6.js} +10 -10
  27. package/dist/{cli-NROTDF5Y.js → cli-FXWWYBYU.js} +11 -11
  28. package/dist/{cli-TT36JCU5.js → cli-FXY3DKPW.js} +2 -2
  29. package/dist/{cli-Y3O5F4JN.js → cli-FZ7QAZZP.js} +11 -11
  30. package/dist/{cli-XOTNXEJA.js → cli-G5DQGZ2E.js} +13 -13
  31. package/dist/{cli-HSIHDN6K.js → cli-GEQUJF4L.js} +11 -11
  32. package/dist/{cli-CD5CIJZI.js → cli-GHLILDH7.js} +9 -9
  33. package/dist/{cli-L7VYSXQK.js → cli-GPAN6XK2.js} +3 -3
  34. package/dist/{cli-UZZFNXRX.js → cli-GTWEGYSU.js} +12 -12
  35. package/dist/{cli-LQOHATY2.js → cli-H3J3ICCQ.js} +2 -2
  36. package/dist/{cli-5ACDPCXI.js → cli-HHPMAV4F.js} +1 -1
  37. package/dist/{cli-QUSCIUOM.js → cli-HM7CD4VU.js} +13 -13
  38. package/dist/{cli-HFX3YPUL.js → cli-HYEU3QS6.js} +1 -1
  39. package/dist/{cli-3BRC32CP.js → cli-IPP5FDCH.js} +12 -12
  40. package/dist/{cli-KSGB2ZLK.js → cli-JGFJWZFU.js} +1 -1
  41. package/dist/{cli-RLEGRWFM.js → cli-JIZTQVL2.js} +8 -8
  42. package/dist/{cli-45OCBG53.js → cli-JPAXKLVT.js} +8 -8
  43. package/dist/{cli-4VFZHLDG.js → cli-JR5AZLLK.js} +1 -1
  44. package/dist/{cli-6SGCYEEC.js → cli-JRIIAZ33.js} +8 -8
  45. package/dist/{cli-3D3ZXWOV.js → cli-JRMHSMYT.js} +13 -13
  46. package/dist/{cli-DDJYUKQG.js → cli-L5IG7MY2.js} +14 -14
  47. package/dist/{cli-4SIWLHQO.js → cli-LE5ICDAF.js} +2 -2
  48. package/dist/{cli-FQRVFGN6.js → cli-LQ4VSM5R.js} +0 -0
  49. package/dist/{cli-HKORECAG.js → cli-LQERHJFE.js} +2 -2
  50. package/dist/{cli-JVI24FI6.js → cli-LRQDF3ZO.js} +7 -7
  51. package/dist/{cli-BJMS3VX3.js → cli-M7WEAIRF.js} +5 -5
  52. package/dist/{cli-KGT5L7VZ.js → cli-MM3A4SPH.js} +1 -1
  53. package/dist/{cli-3ZKWV3PN.js → cli-MULKSLA4.js} +10 -10
  54. package/dist/{cli-C6ZLPK2U.js → cli-MYJGGLC5.js} +2 -2
  55. package/dist/{cli-Z56ZIVA6.js → cli-NEOLMC2P.js} +12 -12
  56. package/dist/{cli-ZBN5KAIB.js → cli-NOQBWJQN.js} +1 -1
  57. package/dist/{cli-EVI36HEM.js → cli-NPPY557S.js} +10 -10
  58. package/dist/{cli-6K3VQQUS.js → cli-OANH3BTQ.js} +1 -1
  59. package/dist/{cli-VDBW23SS.js → cli-OQG3Y4RU.js} +10 -10
  60. package/dist/{cli-6QB2VFPY.js → cli-PIO7NWMH.js} +10 -10
  61. package/dist/{cli-ILFDANBR.js → cli-PKQNOGBO.js} +7 -7
  62. package/dist/{cli-RSW6EBBD.js → cli-PVA52RC2.js} +11 -11
  63. package/dist/{cli-C3CMJSNL.js → cli-R7RG2VMW.js} +10 -10
  64. package/dist/{cli-JJSWBW4H.js → cli-SOFCTQAL.js} +10 -10
  65. package/dist/{cli-QY5NZAR7.js → cli-SOMIB4B4.js} +12 -12
  66. package/dist/{cli-WR3NOY74.js → cli-SPGUVL6Z.js} +14 -14
  67. package/dist/{cli-IEMKI7J7.js → cli-SWZY7L7K.js} +3 -3
  68. package/dist/{cli-BUQI5UU4.js → cli-SX3ULO5P.js} +8 -8
  69. package/dist/{cli-IDVUHGKG.js → cli-T4HWGMY4.js} +7 -7
  70. package/dist/{cli-Y3DDNMPX.js → cli-TDYKRXUA.js} +12 -12
  71. package/dist/{cli-HW53ICZC.js → cli-TFMNNVJ7.js} +10 -10
  72. package/dist/{cli-JZOZOEZM.js → cli-TFZ53OA2.js} +12 -12
  73. package/dist/{cli-G6CANSPL.js → cli-TJ3PLRHF.js} +10 -10
  74. package/dist/{cli-7XLHO2FE.js → cli-TPNQLYPC.js} +1 -1
  75. package/dist/{cli-DFBTZEBX.js → cli-UBQCSUDH.js} +11 -11
  76. package/dist/{cli-BYCHKSSH.js → cli-UTM4QU67.js} +1 -1
  77. package/dist/{cli-5SM367K7.js → cli-UY4VDI7W.js} +8 -8
  78. package/dist/{cli-GFNDW2DL.js → cli-VPON5HGB.js} +12 -12
  79. package/dist/{cli-XZCJIKIV.js → cli-VYR326C6.js} +13 -13
  80. package/dist/{cli-MOPSZ3CS.js → cli-WAZD75KE.js} +10 -10
  81. package/dist/{cli-TTMBBEJC.js → cli-WG36UJRK.js} +12 -12
  82. package/dist/{cli-UMEBPAZQ.js → cli-WM6SQJ6Q.js} +5 -5
  83. package/dist/{cli-IP4RXGHM.js → cli-X7E3637I.js} +84 -17
  84. package/dist/{cli-AV2FYC5G.js → cli-XR2XSWQN.js} +7 -7
  85. package/dist/{cli-Q6ZBZYK2.js → cli-XTANOFQR.js} +2 -2
  86. package/dist/{cli-J4UBELKF.js → cli-YSPZZQCP.js} +2 -2
  87. package/dist/{cli-MJV47HKI.js → cli-Z5HWENER.js} +13 -13
  88. package/dist/{cli-LK3V4RI5.js → cli-ZBTFLZUL.js} +14 -14
  89. package/dist/{cli-VQ6HVQW4.js → cli-ZF7IFB54.js} +20 -4
  90. package/dist/{cli-HOE3WLFH.js → cli-ZKG3OPZ6.js} +9 -9
  91. package/dist/{cli-TTKICM5P.js → cli-ZQ2Y3U7F.js} +7 -7
  92. package/dist/{cli-6VNKQ3OX.js → cli-ZRPWZOCW.js} +15 -7
  93. package/dist/{cli-2NU2LPEE.js → cli-ZTZ5H55T.js} +12 -12
  94. package/dist/cli.js +36 -34
  95. package/dist/client.js +178 -69
  96. package/dist/core/game-settings.d.ts +5 -3
  97. package/dist/core/session-roster.d.ts +10 -0
  98. package/dist/dev/console/assets/{index-CuMOOH9m.js → index-CnXlPeLX.js} +47 -47
  99. package/dist/dev/console/index.html +1 -1
  100. package/dist/dev/routes.d.ts +5 -2
  101. package/dist/dev/shell.d.ts +9 -1
  102. package/dist/dev/view/batch.d.ts +11 -1
  103. package/dist/dev/view/route.d.ts +18 -1
  104. package/dist/dev/view/view.d.ts +9 -0
  105. package/dist/docs/api/index.md +1 -1
  106. package/dist/docs/api/sdk-commands.md +4 -0
  107. package/dist/docs/api/sdk-e2e.md +5 -0
  108. package/dist/docs/api/sdk-tools-client.md +4 -0
  109. package/dist/docs/api/sdk-ui-testing.md +1 -0
  110. package/dist/docs/api/sdk-ui.md +28 -0
  111. package/dist/docs/api/sdk.md +2 -0
  112. package/dist/docs/changelog.md +11 -0
  113. package/dist/docs/cli-and-dev-server.md +4 -0
  114. package/dist/docs/cli-reference.md +17 -2
  115. package/dist/docs/guides/presentation.md +11 -10
  116. package/dist/docs/guides/session-hooks.md +16 -0
  117. package/dist/docs/guides/settings.md +4 -2
  118. package/dist/docs/guides/upgrading.md +12 -0
  119. package/dist/docs/page-index.md +5 -5
  120. package/dist/host/protocol.d.ts +10 -1
  121. package/dist/host.js +1 -0
  122. package/dist/playwright.js +178 -69
  123. package/dist/runtime/manifest-version.d.ts +1 -1
  124. package/dist/runtime.js +1 -1
  125. package/dist/schema.json +10 -1
  126. package/package.json +3 -3
@@ -1,39 +1,39 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  resolvePatchedDefinition
4
- } from "./cli-5IAW3LIF.js";
4
+ } from "./cli-4VZIJYKU.js";
5
5
  import "./cli-S5IVGDDD.js";
6
6
  import {
7
7
  readAuthoredBundle
8
- } from "./cli-4VFZHLDG.js";
8
+ } from "./cli-JR5AZLLK.js";
9
9
  import {
10
10
  resolveInputSource
11
11
  } from "./cli-4UWFQNGF.js";
12
12
  import {
13
13
  updateWaitingRoomUserInterfaceFiles
14
- } from "./cli-4SIWLHQO.js";
14
+ } from "./cli-LE5ICDAF.js";
15
15
  import "./cli-IUS2YCD3.js";
16
16
  import "./cli-QUNIRH7A.js";
17
- import "./cli-J4UBELKF.js";
17
+ import "./cli-YSPZZQCP.js";
18
18
  import {
19
19
  loadPackageContext
20
20
  } from "./cli-XSVGKI3R.js";
21
- import "./cli-TT36JCU5.js";
22
- import "./cli-OXAUOWCN.js";
21
+ import "./cli-FXY3DKPW.js";
22
+ import "./cli-57V4ARER.js";
23
23
  import {
24
24
  operationError,
25
25
  printOperationResult,
26
26
  regenerateTypes
27
- } from "./cli-KSGB2ZLK.js";
28
- import "./cli-LQOHATY2.js";
29
- import "./cli-IEMKI7J7.js";
30
- import "./cli-OMWC75CC.js";
31
- import "./cli-BYCHKSSH.js";
27
+ } from "./cli-JGFJWZFU.js";
28
+ import "./cli-H3J3ICCQ.js";
29
+ import "./cli-SWZY7L7K.js";
30
+ import "./cli-C6G65H6S.js";
31
+ import "./cli-UTM4QU67.js";
32
32
  import "./cli-25RWY5BQ.js";
33
33
  import "./cli-QWQMPCL6.js";
34
34
  import {
35
35
  validateSDKWaitingRoomUserInterface
36
- } from "./cli-VQ6HVQW4.js";
36
+ } from "./cli-ZF7IFB54.js";
37
37
  import "./cli-F2D4GGUA.js";
38
38
  import {
39
39
  logger
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  RESOURCE_DESCRIPTORS,
4
4
  lazy
5
- } from "./cli-VPRRICZA.js";
5
+ } from "./cli-6HB6HTC6.js";
6
6
  import {
7
7
  DEV_PORT_ENV_VAR,
8
8
  ERROR_OVERLAY_ENV_VAR,
@@ -139,27 +139,27 @@ function newFileHelp(spec) {
139
139
 
140
140
  // cli/program.ts
141
141
  var blobUploadCommand = lazy(() => import("./cli-FWFRKQNE.js"), "blobUploadCommand");
142
- var buildCommand = lazy(() => import("./cli-6SGCYEEC.js"), "buildCommand");
143
- var buildEngineCommand = lazy(() => import("./cli-72XDEFU3.js"), "buildEngineCommand");
142
+ var buildCommand = lazy(() => import("./cli-JRIIAZ33.js"), "buildCommand");
143
+ var buildEngineCommand = lazy(() => import("./cli-4XCQUM3E.js"), "buildEngineCommand");
144
144
  var configGetCommand = lazy(() => import("./cli-VL2P354N.js"), "configGetCommand");
145
145
  var configPathCommand = lazy(() => import("./cli-VL2P354N.js"), "configPathCommand");
146
146
  var configSetCommand = lazy(() => import("./cli-VL2P354N.js"), "configSetCommand");
147
- var configureCommand = lazy(() => import("./cli-ILFDANBR.js"), "configureCommand");
148
- var deleteCommand = lazy(() => import("./cli-45OCBG53.js"), "deleteCommand");
149
- var devCommand = lazy(() => import("./cli-O5ABH2WK.js"), "devCommand");
147
+ var configureCommand = lazy(() => import("./cli-PKQNOGBO.js"), "configureCommand");
148
+ var deleteCommand = lazy(() => import("./cli-JPAXKLVT.js"), "deleteCommand");
149
+ var devCommand = lazy(() => import("./cli-DEBCP7UH.js"), "devCommand");
150
150
  var devStatusCommand = lazy(() => import("./cli-C47GJATR.js"), "devStatusCommand");
151
151
  var devStopCommand = lazy(() => import("./cli-C47GJATR.js"), "devStopCommand");
152
152
  var docsCommand = lazy(() => import("./cli-TIDQ4WUE.js"), "docsCommand");
153
153
  var docsExportCommand = lazy(() => import("./cli-MYJGMA6U.js"), "docsExportCommand");
154
154
  var endpointAuditCommand = lazy(
155
- () => import("./cli-R2MUZQE2.js"),
155
+ () => import("./cli-3PIJLSRQ.js"),
156
156
  "endpointAuditCommand"
157
157
  );
158
- var endpointCallCommand = lazy(() => import("./cli-IDVUHGKG.js"), "endpointCallCommand");
159
- var endpointListCommand = lazy(() => import("./cli-ZBN5KAIB.js"), "endpointListCommand");
160
- var generateCommand = lazy(() => import("./cli-UMEBPAZQ.js"), "generateCommand");
161
- var initCommand = lazy(() => import("./cli-JVI24FI6.js"), "initCommand");
162
- var newCommand = lazy(() => import("./cli-BUQI5UU4.js"), "newCommand");
158
+ var endpointCallCommand = lazy(() => import("./cli-T4HWGMY4.js"), "endpointCallCommand");
159
+ var endpointListCommand = lazy(() => import("./cli-NOQBWJQN.js"), "endpointListCommand");
160
+ var generateCommand = lazy(() => import("./cli-WM6SQJ6Q.js"), "generateCommand");
161
+ var initCommand = lazy(() => import("./cli-LRQDF3ZO.js"), "initCommand");
162
+ var newCommand = lazy(() => import("./cli-SX3ULO5P.js"), "newCommand");
163
163
  var packageBundleCommand = lazy(
164
164
  () => import("./cli-MJUYJIEP.js"),
165
165
  "packageBundleCommand"
@@ -172,32 +172,33 @@ var packageVersionCommand = lazy(
172
172
  () => import("./cli-QVASWX2A.js"),
173
173
  "packageVersionCommand"
174
174
  );
175
- var patchCommand = lazy(() => import("./cli-RLEGRWFM.js"), "patchCommand");
176
- var resolveCommand = lazy(() => import("./cli-5ACDPCXI.js"), "resolveCommand");
177
- var screenshotCommand = lazy(() => import("./cli-7A6MKCUJ.js"), "screenshotCommand");
178
- var clockAdvanceCommand = lazy(() => import("./cli-6VNKQ3OX.js"), "clockAdvanceCommand");
179
- var faultCommand = lazy(() => import("./cli-6VNKQ3OX.js"), "faultCommand");
180
- var localeCommand = lazy(() => import("./cli-6VNKQ3OX.js"), "localeCommand");
181
- var participantAddCommand = lazy(() => import("./cli-6VNKQ3OX.js"), "participantAddCommand");
182
- var participantMoveCommand = lazy(() => import("./cli-6VNKQ3OX.js"), "participantMoveCommand");
175
+ var patchCommand = lazy(() => import("./cli-JIZTQVL2.js"), "patchCommand");
176
+ var resolveCommand = lazy(() => import("./cli-HHPMAV4F.js"), "resolveCommand");
177
+ var screenshotCommand = lazy(() => import("./cli-2DQJACAH.js"), "screenshotCommand");
178
+ var clockAdvanceCommand = lazy(() => import("./cli-ZRPWZOCW.js"), "clockAdvanceCommand");
179
+ var faultCommand = lazy(() => import("./cli-ZRPWZOCW.js"), "faultCommand");
180
+ var localeCommand = lazy(() => import("./cli-ZRPWZOCW.js"), "localeCommand");
181
+ var participantAddCommand = lazy(() => import("./cli-ZRPWZOCW.js"), "participantAddCommand");
182
+ var participantJoinCommand = lazy(() => import("./cli-ZRPWZOCW.js"), "participantJoinCommand");
183
+ var participantMoveCommand = lazy(() => import("./cli-ZRPWZOCW.js"), "participantMoveCommand");
183
184
  var participantRenameCommand = lazy(
184
- () => import("./cli-6VNKQ3OX.js"),
185
+ () => import("./cli-ZRPWZOCW.js"),
185
186
  "participantRenameCommand"
186
187
  );
187
- var playCommand = lazy(() => import("./cli-6VNKQ3OX.js"), "playCommand");
188
- var reconfigureCommand = lazy(() => import("./cli-6VNKQ3OX.js"), "reconfigureCommand");
189
- var resetCommand = lazy(() => import("./cli-6VNKQ3OX.js"), "resetCommand");
190
- var scenarioCommand = lazy(() => import("./cli-6VNKQ3OX.js"), "scenarioCommand");
191
- var teamAddCommand = lazy(() => import("./cli-6VNKQ3OX.js"), "teamAddCommand");
192
- var teamRemoveCommand = lazy(() => import("./cli-6VNKQ3OX.js"), "teamRemoveCommand");
193
- var teamRenameCommand = lazy(() => import("./cli-6VNKQ3OX.js"), "teamRenameCommand");
194
- var timerCommand = lazy(() => import("./cli-6VNKQ3OX.js"), "timerCommand");
195
- var undoCommand = lazy(() => import("./cli-6VNKQ3OX.js"), "undoCommand");
196
- var waitingRoomCommand = lazy(() => import("./cli-6VNKQ3OX.js"), "waitingRoomCommand");
197
- var tickCommand = lazy(() => import("./cli-5SM367K7.js"), "tickCommand");
198
- var updateCommand = lazy(() => import("./cli-DOXRQ3S5.js"), "updateCommand");
188
+ var playCommand = lazy(() => import("./cli-ZRPWZOCW.js"), "playCommand");
189
+ var reconfigureCommand = lazy(() => import("./cli-ZRPWZOCW.js"), "reconfigureCommand");
190
+ var resetCommand = lazy(() => import("./cli-ZRPWZOCW.js"), "resetCommand");
191
+ var scenarioCommand = lazy(() => import("./cli-ZRPWZOCW.js"), "scenarioCommand");
192
+ var teamAddCommand = lazy(() => import("./cli-ZRPWZOCW.js"), "teamAddCommand");
193
+ var teamRemoveCommand = lazy(() => import("./cli-ZRPWZOCW.js"), "teamRemoveCommand");
194
+ var teamRenameCommand = lazy(() => import("./cli-ZRPWZOCW.js"), "teamRenameCommand");
195
+ var timerCommand = lazy(() => import("./cli-ZRPWZOCW.js"), "timerCommand");
196
+ var undoCommand = lazy(() => import("./cli-ZRPWZOCW.js"), "undoCommand");
197
+ var waitingRoomCommand = lazy(() => import("./cli-ZRPWZOCW.js"), "waitingRoomCommand");
198
+ var tickCommand = lazy(() => import("./cli-UY4VDI7W.js"), "tickCommand");
199
+ var updateCommand = lazy(() => import("./cli-64AA7367.js"), "updateCommand");
199
200
  var versionCommand = lazy(() => import("./cli-HCRTYQQS.js"), "versionCommand");
200
- var viewCommand = lazy(() => import("./cli-TTKICM5P.js"), "viewCommand");
201
+ var viewCommand = lazy(() => import("./cli-ZQ2Y3U7F.js"), "viewCommand");
201
202
  function commandPath(command) {
202
203
  const names = [];
203
204
  for (let current = command; current?.parent; current = current.parent) {
@@ -450,6 +451,7 @@ Examples:
450
451
  teamCmd.command("rename <team> <name>").description("Rename a team (1-based)").option(WORKING_DIR[0], WORKING_DIR[1], cwd()).option("--no-server", "run in this process instead of starting a dev server").action(teamRenameCommand);
451
452
  const participantCmd = program.command("participant").description("Add, rename, and move participants");
452
453
  participantCmd.command("add [name]").description("Add a participant to a team").option(WORKING_DIR[0], WORKING_DIR[1], cwd()).option("--team [NUMBER]", "team to add them to (1-based, defaults to 1)").option("--no-server", "run in this process instead of starting a dev server").action(participantAddCommand);
454
+ participantCmd.command("join [name]").description("Join through the session link, letting the session choose the team").option(WORKING_DIR[0], WORKING_DIR[1], cwd()).option("--no-server", "run in this process instead of starting a dev server").action(participantJoinCommand);
453
455
  participantCmd.command("rename <participantId> <name>").description("Rename a participant").option(WORKING_DIR[0], WORKING_DIR[1], cwd()).option("--no-server", "run in this process instead of starting a dev server").action(participantRenameCommand);
454
456
  participantCmd.command("move <participantId> <team>").description("Move a participant to another team (1-based)").option(WORKING_DIR[0], WORKING_DIR[1], cwd()).option("--no-server", "run in this process instead of starting a dev server").action(participantMoveCommand);
455
457
  program.command("waiting-room <action>").description("Open or close the session waiting room").option(WORKING_DIR[0], WORKING_DIR[1], cwd()).option("--no-server", "run in this process instead of starting a dev server").action(waitingRoomCommand);
package/dist/client.js CHANGED
@@ -261,6 +261,7 @@ var COMMAND_FIELDS = {
261
261
  renameOwnTeam: { name: "string", "participantId?": "string", "teamId?": "string" },
262
262
  renameSelf: { name: "string", "participantId?": "string", "teamId?": "string" },
263
263
  addParticipant: { teamId: "string", "name?": "string" },
264
+ joinSession: { "name?": "string" },
264
265
  renameParticipant: { participantId: "string", name: "string" },
265
266
  moveParticipant: { participantId: "string", teamId: "string" },
266
267
  setWaitingRoom: { open: "boolean" },
@@ -1690,6 +1691,10 @@ var schema_default = {
1690
1691
  minProperties: 1,
1691
1692
  additionalProperties: false
1692
1693
  }
1694
+ },
1695
+ sessionJoin: {
1696
+ type: "boolean",
1697
+ description: "Whether a session may offer one join link for the whole session, through which the host places each person in a team of its choosing. Defaults to true. Set it false when a game depends on who is in which team, such as one role per team, and hand out team links instead. The default for the `game` settings' `teams.sessionJoin`"
1693
1698
  }
1694
1699
  },
1695
1700
  additionalProperties: false
@@ -1742,7 +1747,8 @@ var schema_default = {
1742
1747
  },
1743
1748
  additionalProperties: false
1744
1749
  },
1745
- defaultNames: { $ref: "#/$defs/GameSettingConstraint" }
1750
+ defaultNames: { $ref: "#/$defs/GameSettingConstraint" },
1751
+ sessionJoin: { $ref: "#/$defs/GameSettingConstraint" }
1746
1752
  },
1747
1753
  additionalProperties: false
1748
1754
  },
@@ -1819,6 +1825,10 @@ var schema_default = {
1819
1825
  minProperties: 1,
1820
1826
  additionalProperties: false
1821
1827
  }
1828
+ },
1829
+ sessionJoin: {
1830
+ type: "boolean",
1831
+ description: "Whether the host may offer one join link for the whole session, placing each person in a team of its choosing. Read once as the session is created, so only the game and its scenarios set it"
1822
1832
  }
1823
1833
  },
1824
1834
  additionalProperties: false
@@ -2590,6 +2600,7 @@ var TITLES = {
2590
2600
  "teams.perTeam.minParticipants": "Minimum participants per team",
2591
2601
  "teams.perTeam.maxParticipants": "Maximum participants per team",
2592
2602
  "teams.defaultNames": "Default team names",
2603
+ "teams.sessionJoin": "Offer a session join link",
2593
2604
  "waitingRoom.openOnStart": "Open the waiting room on start"
2594
2605
  };
2595
2606
  function gameSettingsDefaults(manifest) {
@@ -2603,7 +2614,8 @@ function gameSettingsDefaults(manifest) {
2603
2614
  minParticipants: teams?.perTeam?.minParticipants ?? null,
2604
2615
  maxParticipants: teams?.perTeam?.maxParticipants ?? null
2605
2616
  },
2606
- defaultNames: teams?.defaultNames ?? []
2617
+ defaultNames: teams?.defaultNames ?? [],
2618
+ sessionJoin: teams?.sessionJoin !== false
2607
2619
  },
2608
2620
  waitingRoom: { openOnStart: manifest.waitingRoom?.openOnStart === true }
2609
2621
  };
@@ -2685,7 +2697,8 @@ function gameSettingsOf(resolved) {
2685
2697
  minParticipants: game.teams?.perTeam?.minParticipants ?? null,
2686
2698
  maxParticipants: game.teams?.perTeam?.maxParticipants ?? null
2687
2699
  },
2688
- defaultNames: game.teams?.defaultNames ?? neutral.teams.defaultNames
2700
+ defaultNames: game.teams?.defaultNames ?? neutral.teams.defaultNames,
2701
+ sessionJoin: game.teams?.sessionJoin !== false
2689
2702
  },
2690
2703
  waitingRoom: { openOnStart: game.waitingRoom?.openOnStart === true }
2691
2704
  };
@@ -2707,6 +2720,10 @@ function gameOverrideRefusal(overrides) {
2707
2720
  if ("waitingRoom" in game) {
2708
2721
  return "game.waitingRoom.openOnStart cannot be set for a session: it seeds the waiting room as the session is created, before setup. Set it in the manifest or a scenario instead";
2709
2722
  }
2723
+ const teams = game.teams;
2724
+ if (teams !== null && typeof teams === "object" && "sessionJoin" in teams) {
2725
+ return "game.teams.sessionJoin cannot be set for a session: it is read as the session is created, before setup, so the session link cannot switch on and off while people are arriving. Set it in the manifest or a scenario instead";
2726
+ }
2710
2727
  return null;
2711
2728
  }
2712
2729
 
@@ -24116,6 +24133,29 @@ var SessionRoster = class {
24116
24133
  await this.fireHook("participantJoin", record2);
24117
24134
  return void 0;
24118
24135
  }
24136
+ /**
24137
+ * Join through the session link (§13.4).
24138
+ *
24139
+ * Which team is this host's own choice, and nothing a game may rely on:
24140
+ * the one with the fewest participants, the lowest index on a tie, so a
24141
+ * room scanning one code fills its teams evenly. It creates an ordinary
24142
+ * participant with an ordinary `participantJoin`, exactly as a team link
24143
+ * does.
24144
+ */
24145
+ async joinSession(name) {
24146
+ if (this.host.runKind === "walkthrough") {
24147
+ throw new DeniedError("A walkthrough holds one participant, so it has no session link");
24148
+ }
24149
+ if (!this.host.settings().teams.sessionJoin) {
24150
+ throw new DeniedError(
24151
+ "This game offers no session link: its teams.sessionJoin is false. Join through a team link instead"
24152
+ );
24153
+ }
24154
+ const { state: state2, participants } = this.host;
24155
+ const placement = state2.getTeamIndexes().map((index3) => ({ index: index3, held: participants.list(`team-${index3 + 1}`).length })).sort((a, b) => a.held - b.held || a.index - b.index)[0];
24156
+ if (!placement) throw new DeniedError("The session has no team to join");
24157
+ return this.addParticipant(`team-${placement.index + 1}`, name);
24158
+ }
24119
24159
  renameParticipant(participantId, name) {
24120
24160
  const teamId = this.findParticipantTeam(participantId);
24121
24161
  if (!teamId) throw new DeniedError(`Unknown participant "${participantId}"`);
@@ -25546,6 +25586,7 @@ var PLAY_STAGE = /* @__PURE__ */ new Set([
25546
25586
  "updateContext",
25547
25587
  "updateSharedContext",
25548
25588
  "addParticipant",
25589
+ "joinSession",
25549
25590
  "renameParticipant",
25550
25591
  "moveParticipant",
25551
25592
  "renameOwnTeam",
@@ -26222,6 +26263,8 @@ var Session = class {
26222
26263
  return this.roster.renameSelf(command);
26223
26264
  case "addParticipant":
26224
26265
  return this.roster.addParticipant(command.teamId, command.name);
26266
+ case "joinSession":
26267
+ return this.roster.joinSession(command.name);
26225
26268
  case "renameParticipant":
26226
26269
  return this.roster.renameParticipant(command.participantId, command.name);
26227
26270
  case "moveParticipant":
@@ -30468,6 +30511,7 @@ function sessionBatch({
30468
30511
  participants: participantList(state2)
30469
30512
  },
30470
30513
  { type: "setTeamLinks", payload: teamLinks(state2, origin) },
30514
+ { type: "setSessionJoinLink", payload: sessionJoinLink(state2, origin) },
30471
30515
  { type: "setWalkthroughLink", payload: walkthroughLink(origin) },
30472
30516
  { type: "setRunKind", runKind: state2.session.runKind },
30473
30517
  { type: "setScenarioName", scenarioName: state2.game.scenarioName },
@@ -30510,7 +30554,8 @@ function presentationBatch({
30510
30554
  teamId,
30511
30555
  joinUrl: joinUrl2
30512
30556
  })),
30513
- joinPin: null
30557
+ joinPin: null,
30558
+ sessionJoinLink: sessionJoinLink(state2, origin)
30514
30559
  }
30515
30560
  }
30516
30561
  },
@@ -30552,6 +30597,11 @@ function teamLinks(state2, origin) {
30552
30597
  observeUrl: `${origin}/team/${team.index + 1}/observe`
30553
30598
  }));
30554
30599
  }
30600
+ function sessionJoinLink(state2, origin) {
30601
+ if (state2.session.runKind === "walkthrough") return null;
30602
+ if (!gameSettingsOf(state2.settings).teams.sessionJoin) return null;
30603
+ return { joinUrl: `${origin}/join?bare` };
30604
+ }
30555
30605
  function teamConfiguration(state2) {
30556
30606
  return {
30557
30607
  mode: state2.session.mode,
@@ -30586,17 +30636,82 @@ function sessionData(state2, surface) {
30586
30636
  };
30587
30637
  }
30588
30638
 
30639
+ // cli/dev/view/route.ts
30640
+ var PATTERNS = [
30641
+ [/^\/walkthrough\/?$/, () => ({ kind: "player", teamIndex: 0, participant: 1 })],
30642
+ [/^\/team\/(\d+)\/player\/(\d+)\/?$/, (m) => player(m[1], m[2])],
30643
+ [/^\/team\/(\d+)\/player\/?$/, (m) => player(m[1], "1")],
30644
+ [/^\/team\/(\d+)\/observe\/?$/, (m) => ({ kind: "observer", teamIndex: index2(m[1]) })],
30645
+ [/^\/team\/(\d+)\/join\/?$/, (m) => ({ kind: "join", teamIndex: index2(m[1]) })],
30646
+ [/^\/team\/(\d+)\/waiting-room\/?$/, (m) => ({ kind: "waiting-room", teamIndex: index2(m[1]) })],
30647
+ [/^\/join\/?$/, () => ({ kind: "session-join" })],
30648
+ [/^\/setup\/?$/, () => ({ kind: "setup" })],
30649
+ [/^\/scenario-editor\/?$/, () => ({ kind: "scenario-editor" })],
30650
+ [/^\/guide\/?$/, () => ({ kind: "guide" })],
30651
+ [/^\/print\/?$/, () => ({ kind: "print" })],
30652
+ [/^\/presentation\/?$/, () => ({ kind: "presentation" })]
30653
+ ];
30654
+ function player(team, participant) {
30655
+ return {
30656
+ kind: "player",
30657
+ teamIndex: index2(team),
30658
+ participant: Math.max(1, Number(participant))
30659
+ };
30660
+ }
30661
+ function index2(team) {
30662
+ return Math.max(0, Number(team) - 1);
30663
+ }
30664
+ var LOCAL_ORIGINS_FLAG = "local-origins";
30665
+ function wantsLocalOrigins(search2) {
30666
+ return new URLSearchParams(search2).has(LOCAL_ORIGINS_FLAG);
30667
+ }
30668
+ function parseRoute(pathname, search2) {
30669
+ const query = new URLSearchParams(search2);
30670
+ const bare = query.has("bare");
30671
+ const preview = query.has("preview");
30672
+ const scenario = query.get("scenario");
30673
+ const run = /^\/walkthrough(\/|$)/.test(pathname) ? "walkthrough" : "session";
30674
+ for (const [pattern, build2] of PATTERNS) {
30675
+ const match2 = pathname.match(pattern);
30676
+ if (match2) {
30677
+ return {
30678
+ ...build2(match2),
30679
+ bare,
30680
+ run,
30681
+ ...scenario === null ? {} : { scenario },
30682
+ ...preview ? { preview } : {}
30683
+ };
30684
+ }
30685
+ }
30686
+ return { kind: "console", bare, run };
30687
+ }
30688
+ function routeHref(route) {
30689
+ const team = (route.teamIndex ?? 0) + 1;
30690
+ const path3 = 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}`;
30691
+ const query = new URLSearchParams();
30692
+ if (route.scenario !== void 0) query.set("scenario", route.scenario);
30693
+ if (route.preview) query.set("preview", "");
30694
+ if (route.bare) query.set("bare", "");
30695
+ const search2 = query.toString().replace(/(bare|preview)=(?=&|$)/g, "$1");
30696
+ return search2 ? `${path3}?${search2}` : path3;
30697
+ }
30698
+
30589
30699
  // cli/dev/routes.ts
30590
30700
  function runOf(req) {
30591
30701
  return req.query.run === "walkthrough" ? "walkthrough" : "session";
30592
30702
  }
30703
+ function localOrigins(req, res) {
30704
+ if (req.query[LOCAL_ORIGINS_FLAG] === void 0) return false;
30705
+ res.setHeader("Cache-Control", "no-store");
30706
+ return true;
30707
+ }
30593
30708
  function registerRoutes(app, deps) {
30594
30709
  const { session, packagePath, runFor } = deps;
30595
30710
  app.get("/api/state", async (req, res) => {
30596
30711
  res.json((await runFor(runOf(req))).project());
30597
30712
  });
30598
30713
  app.get("/api/surfaces", (req, res) => {
30599
- const origin = deps.assetOrigin(req.headers.host);
30714
+ const origin = deps.assetOrigin(req.headers.host, localOrigins(req, res));
30600
30715
  res.json(
30601
30716
  mountableSurfaces(session.packageConfiguration()).map((mountable) => ({
30602
30717
  ...mountable,
@@ -30661,7 +30776,7 @@ function registerRoutes(app, deps) {
30661
30776
  });
30662
30777
  });
30663
30778
  app.get("/api/brands", (req, res) => {
30664
- const assetOrigin = deps.assetOrigin(req.headers.host);
30779
+ const assetOrigin = deps.assetOrigin(req.headers.host, localOrigins(req, res));
30665
30780
  res.json({ brands: deps.brands().map((brand) => summarise(brand, assetOrigin)) });
30666
30781
  });
30667
30782
  app.get("/api/locales", (_req, res) => {
@@ -31132,61 +31247,6 @@ function queryFor(message, surface, viewer) {
31132
31247
  }
31133
31248
  }
31134
31249
 
31135
- // cli/dev/view/route.ts
31136
- var PATTERNS = [
31137
- [/^\/walkthrough\/?$/, () => ({ kind: "player", teamIndex: 0, participant: 1 })],
31138
- [/^\/team\/(\d+)\/player\/(\d+)\/?$/, (m) => player(m[1], m[2])],
31139
- [/^\/team\/(\d+)\/player\/?$/, (m) => player(m[1], "1")],
31140
- [/^\/team\/(\d+)\/observe\/?$/, (m) => ({ kind: "observer", teamIndex: index2(m[1]) })],
31141
- [/^\/team\/(\d+)\/join\/?$/, (m) => ({ kind: "join", teamIndex: index2(m[1]) })],
31142
- [/^\/team\/(\d+)\/waiting-room\/?$/, (m) => ({ kind: "waiting-room", teamIndex: index2(m[1]) })],
31143
- [/^\/setup\/?$/, () => ({ kind: "setup" })],
31144
- [/^\/scenario-editor\/?$/, () => ({ kind: "scenario-editor" })],
31145
- [/^\/guide\/?$/, () => ({ kind: "guide" })],
31146
- [/^\/print\/?$/, () => ({ kind: "print" })],
31147
- [/^\/presentation\/?$/, () => ({ kind: "presentation" })]
31148
- ];
31149
- function player(team, participant) {
31150
- return {
31151
- kind: "player",
31152
- teamIndex: index2(team),
31153
- participant: Math.max(1, Number(participant))
31154
- };
31155
- }
31156
- function index2(team) {
31157
- return Math.max(0, Number(team) - 1);
31158
- }
31159
- function parseRoute(pathname, search2) {
31160
- const query = new URLSearchParams(search2);
31161
- const bare = query.has("bare");
31162
- const preview = query.has("preview");
31163
- const scenario = query.get("scenario");
31164
- const run = /^\/walkthrough(\/|$)/.test(pathname) ? "walkthrough" : "session";
31165
- for (const [pattern, build2] of PATTERNS) {
31166
- const match2 = pathname.match(pattern);
31167
- if (match2) {
31168
- return {
31169
- ...build2(match2),
31170
- bare,
31171
- run,
31172
- ...scenario === null ? {} : { scenario },
31173
- ...preview ? { preview } : {}
31174
- };
31175
- }
31176
- }
31177
- return { kind: "console", bare, run };
31178
- }
31179
- function routeHref(route) {
31180
- const team = (route.teamIndex ?? 0) + 1;
31181
- const path3 = 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}`;
31182
- const query = new URLSearchParams();
31183
- if (route.scenario !== void 0) query.set("scenario", route.scenario);
31184
- if (route.preview) query.set("preview", "");
31185
- if (route.bare) query.set("bare", "");
31186
- const search2 = query.toString().replace(/(bare|preview)=(?=&|$)/g, "$1");
31187
- return search2 ? `${path3}?${search2}` : path3;
31188
- }
31189
-
31190
31250
  // cli/dev/view/viewer.ts
31191
31251
  function resolveViewer(state2, route) {
31192
31252
  const base = {
@@ -31230,6 +31290,7 @@ var VIEW_ROUTES = /* @__PURE__ */ new Set([
31230
31290
  "observer",
31231
31291
  "waiting-room",
31232
31292
  "join",
31293
+ "session-join",
31233
31294
  "setup"
31234
31295
  ]);
31235
31296
  function isViewRoute(route) {
@@ -31244,6 +31305,12 @@ function resolveView(state2, route, surfaces) {
31244
31305
  if (!inSetup && effective.kind === "setup") {
31245
31306
  return { status: "closed", configurable };
31246
31307
  }
31308
+ if (effective.kind === "session-join") {
31309
+ return {
31310
+ status: "session-join",
31311
+ offered: state2.session.runKind !== "walkthrough" && gameSettingsOf(state2.settings).teams.sessionJoin
31312
+ };
31313
+ }
31247
31314
  if (effective.kind === "join") {
31248
31315
  const team = state2.teams.find((candidate) => candidate.index === effective.teamIndex);
31249
31316
  if (!team) return { status: "join", team: null };
@@ -31315,7 +31382,7 @@ var REINITIALISING_CAUSES = /* @__PURE__ */ new Set([
31315
31382
  "selectScenario",
31316
31383
  REINITIALISED_ON_CHANGE
31317
31384
  ]);
31318
- var CONSOLE_ROUTE = /^\/(?:$|team\/\d+(?:\/(?:player(?:\/\d+)?|observe|join|waiting-room))?\/?$|walkthrough\/?$|setup\/?$|scenario-editor\/?$|guide\/?$|print\/?$|presentation\/?$)/;
31385
+ var CONSOLE_ROUTE = /^\/(?:$|team\/\d+(?:\/(?:player(?:\/\d+)?|observe|join|waiting-room))?\/?$|join\/?$|walkthrough\/?$|setup\/?$|scenario-editor\/?$|guide\/?$|print\/?$|presentation\/?$)/;
31319
31386
  var DELEGATED_FEATURES = [
31320
31387
  "clipboard-write",
31321
31388
  "autoplay",
@@ -31610,9 +31677,12 @@ var DevShell = class {
31610
31677
  * public one where given, else the same host on the asset port. A browser
31611
31678
  * on another machine reached us by an address `localhost` would not
31612
31679
  * resolve to on its side.
31680
+ *
31681
+ * `local` skips the public one, for a client that has said it runs here
31682
+ * (`?local-origins`): it may not reach the proxy in front of us at all.
31613
31683
  */
31614
- assetOrigin(host) {
31615
- const configured = this.publicAssetUrl;
31684
+ assetOrigin(host, local = false) {
31685
+ const configured = local ? null : this.publicAssetUrl;
31616
31686
  if (configured) return configured;
31617
31687
  const name = (host ?? "localhost").replace(/:\d+$/, "") || "localhost";
31618
31688
  return `http://${name}:${this.assetPort}`;
@@ -31726,7 +31796,7 @@ var DevShell = class {
31726
31796
  settleWalkthroughReset: (command) => this.settleWalkthroughReset(command),
31727
31797
  packagePath: this.options.packagePath,
31728
31798
  vitePort: () => this.vitePort,
31729
- assetOrigin: (host) => this.assetOrigin(host),
31799
+ assetOrigin: (host, local) => this.assetOrigin(host, local),
31730
31800
  instanceId: this.instanceId,
31731
31801
  notices: (run) => this.notices(run),
31732
31802
  brands: () => this.currentBrands()
@@ -31744,10 +31814,12 @@ ${MISSING_CONSOLE_MESSAGE}
31744
31814
  res.status(503).type("text/plain").send(MISSING_CONSOLE_MESSAGE);
31745
31815
  return;
31746
31816
  }
31817
+ const local = wantsLocalOrigins(req.url.split("?")[1] ?? "");
31747
31818
  res.setHeader(
31748
31819
  "Permissions-Policy",
31749
- delegatedFeatures(this.assetOrigin(req.headers.host))
31820
+ delegatedFeatures(this.assetOrigin(req.headers.host, local))
31750
31821
  );
31822
+ if (local) res.setHeader("Cache-Control", "no-store");
31751
31823
  res.sendFile("index.html", { root: console_.path });
31752
31824
  });
31753
31825
  this.app.use(express2.static(console_.path));
@@ -31947,7 +32019,11 @@ Install the package's dependencies to serve its surfaces.
31947
32019
  socket.close(4e3, "Not a viewer page");
31948
32020
  return;
31949
32021
  }
31950
- this.views.set(socket, { route, host: request.headers.host });
32022
+ this.views.set(socket, {
32023
+ route,
32024
+ host: request.headers.host,
32025
+ localOrigins: wantsLocalOrigins(location.search)
32026
+ });
31951
32027
  void this.sendView(socket).then(() => this.syncPresence(route.run));
31952
32028
  socket.on("message", (raw) => void this.receiveView(socket, raw));
31953
32029
  socket.on("close", () => {
@@ -32007,7 +32083,10 @@ Install the package's dependencies to serve its surfaces.
32007
32083
  // -----------------------------------------------------------------------
32008
32084
  /** What one viewer page is owed, now. */
32009
32085
  viewOf(session, view, state2 = session.project()) {
32010
- const origin = this.assetOrigin(view.host);
32086
+ if (view.joined !== void 0) {
32087
+ return { page: { status: "redirect", href: view.joined }, messages: [] };
32088
+ }
32089
+ const origin = this.assetOrigin(view.host, view.localOrigins);
32011
32090
  const surfaces = mountableSurfaces(session.packageConfiguration()).map(
32012
32091
  (surface) => ({ ...surface, origin })
32013
32092
  );
@@ -32148,7 +32227,9 @@ Install the package's dependencies to serve its surfaces.
32148
32227
  try {
32149
32228
  const session = await this.runFor(view.route.run);
32150
32229
  const { page } = this.viewOf(session, view);
32151
- if (page.status === "surface") {
32230
+ if (page.status === "session-join" && frameMessage.type === "joinSession") {
32231
+ result = await this.joinThroughSessionLink(session, view, socket, frameMessage);
32232
+ } else if (page.status === "surface") {
32152
32233
  const command = queryFor(frameMessage, page.surface, page.viewer) ?? commandFor(frameMessage, page.surface, page.viewer);
32153
32234
  if (isFrameRefusal(command)) {
32154
32235
  result = { ok: false, outcome: { kind: "denied", message: command.refused } };
@@ -32164,6 +32245,34 @@ Install the package's dependencies to serve its surfaces.
32164
32245
  }
32165
32246
  if (requestId) send(socket, { type: "result", requestId, result });
32166
32247
  }
32248
+ /**
32249
+ * Join from the session link's page (§13.4): the session places the
32250
+ * newcomer, and the page is sent on to the participant it made.
32251
+ */
32252
+ async joinThroughSessionLink(session, view, socket, message) {
32253
+ const before = new Set(
32254
+ session.project().teams.flatMap((t) => t.participants.map((p) => p.id))
32255
+ );
32256
+ const name = typeof message.name === "string" ? message.name : void 0;
32257
+ const result = await session.submit({
32258
+ type: "joinSession",
32259
+ ...name === void 0 ? {} : { name }
32260
+ });
32261
+ if (!result.ok) return result;
32262
+ for (const team of session.project().teams) {
32263
+ const position2 = team.participants.findIndex((p) => !before.has(p.id));
32264
+ if (position2 === -1) continue;
32265
+ view.joined = routeHref({
32266
+ kind: "player",
32267
+ teamIndex: team.index,
32268
+ participant: position2 + 1,
32269
+ bare: true
32270
+ });
32271
+ await this.sendView(socket, session);
32272
+ break;
32273
+ }
32274
+ return result;
32275
+ }
32167
32276
  broadcast(event, run) {
32168
32277
  let payload = null;
32169
32278
  this.sockets?.clients.forEach((client) => {
@@ -57,9 +57,11 @@ export declare function declaredGameSettings(schema: unknown): ResolvedGameSetti
57
57
  /**
58
58
  * Why a session-layer override of the `game` settings is refused, or null
59
59
  * when it is not. `waitingRoom.openOnStart` seeds the waiting-room flag as
60
- * the session is created, before any setup step runs, so a session-layer
61
- * value would be read by nothing; refusing it says so where an inert override
62
- * would read as applied (§6.14.4, §8.2).
60
+ * the session is created, before any setup step runs, and
61
+ * `teams.sessionJoin` is read at the same moment, because people may follow
62
+ * the session link before play starts. A session-layer value of either would
63
+ * be read by nothing; refusing it says so where an inert override would read
64
+ * as applied (§6.10.1, §6.14.4, §8.2).
63
65
  */
64
66
  export declare function gameOverrideRefusal(overrides: unknown): string | null;
65
67
  export {};
@@ -109,6 +109,16 @@ export declare class SessionRoster {
109
109
  type: 'renameSelf';
110
110
  }>): undefined;
111
111
  addParticipant(teamId: string, name?: string): Promise<undefined>;
112
+ /**
113
+ * Join through the session link (§13.4).
114
+ *
115
+ * Which team is this host's own choice, and nothing a game may rely on:
116
+ * the one with the fewest participants, the lowest index on a tie, so a
117
+ * room scanning one code fills its teams evenly. It creates an ordinary
118
+ * participant with an ordinary `participantJoin`, exactly as a team link
119
+ * does.
120
+ */
121
+ joinSession(name?: string): Promise<undefined>;
112
122
  renameParticipant(participantId: string, name: string): undefined;
113
123
  moveParticipant(participantId: string, toTeamId: string): Promise<undefined>;
114
124
  findParticipantTeam(participantId: string): string | undefined;