@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
@@ -4,12 +4,12 @@ import {
4
4
  } from "./cli-BWX5E7TQ.js";
5
5
  import {
6
6
  validatePackage
7
- } from "./cli-BJMS3VX3.js";
7
+ } from "./cli-M7WEAIRF.js";
8
8
  import {
9
9
  PackageScenarioError,
10
10
  createPackageScenario,
11
11
  deletePackageScenario
12
- } from "./cli-FQRVFGN6.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-XSLNH5PR.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-OMWC75CC.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-VQ6HVQW4.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-Q6ZBZYK2.js";
4
+ } from "./cli-XTANOFQR.js";
5
5
  import {
6
6
  resolvePatchedDefinition
7
- } from "./cli-5IAW3LIF.js";
7
+ } from "./cli-4VZIJYKU.js";
8
8
  import {
9
9
  readAuthoredBundle
10
- } from "./cli-4VFZHLDG.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-4SIWLHQO.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-KSGB2ZLK.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-LQOHATY2.js";
37
+ } from "./cli-H3J3ICCQ.js";
38
38
  import {
39
39
  getResourceMeta,
40
40
  validateSDKScenarioEditor,
41
41
  validateSDKSetup
42
- } from "./cli-VQ6HVQW4.js";
42
+ } from "./cli-ZF7IFB54.js";
43
43
  import {
44
44
  resourceExample
45
45
  } from "./cli-F2D4GGUA.js";
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  resourceNames
4
- } from "./cli-OXAUOWCN.js";
4
+ } from "./cli-57V4ARER.js";
5
5
  import {
6
6
  checkbox
7
7
  } from "./cli-ZTWOE3ZT.js";
8
8
  import {
9
9
  getResourceMeta
10
- } from "./cli-VQ6HVQW4.js";
10
+ } from "./cli-ZF7IFB54.js";
11
11
 
12
12
  // cli/utils/resource-discovery.ts
13
13
  function loadResourceIdentifiers(workingDir, type) {
@@ -4,10 +4,10 @@ import {
4
4
  deleteResourceFiles,
5
5
  findResourceReferences,
6
6
  updateResourceFiles
7
- } from "./cli-TT36JCU5.js";
7
+ } from "./cli-FXY3DKPW.js";
8
8
  import {
9
9
  getResourceMeta
10
- } from "./cli-VQ6HVQW4.js";
10
+ } from "./cli-ZF7IFB54.js";
11
11
 
12
12
  // cli/templating/scenario.ts
13
13
  var scenarioMeta = getResourceMeta("scenario");
@@ -1,48 +1,48 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  promptForSettings
4
- } from "./cli-ZDOTXEKL.js";
4
+ } from "./cli-C3OERMIR.js";
5
5
  import {
6
6
  loadResourceIdentifiers
7
- } from "./cli-Q6ZBZYK2.js";
7
+ } from "./cli-XTANOFQR.js";
8
8
  import {
9
9
  readAuthoredBundle
10
- } from "./cli-4VFZHLDG.js";
10
+ } from "./cli-JR5AZLLK.js";
11
11
  import {
12
12
  resolveInputSource
13
13
  } from "./cli-4UWFQNGF.js";
14
14
  import {
15
15
  createUserInterfaceFiles
16
- } from "./cli-4SIWLHQO.js";
16
+ } from "./cli-LE5ICDAF.js";
17
17
  import "./cli-IUS2YCD3.js";
18
18
  import "./cli-QUNIRH7A.js";
19
- import "./cli-J4UBELKF.js";
19
+ import "./cli-YSPZZQCP.js";
20
20
  import {
21
21
  loadPackageContext
22
22
  } from "./cli-XSVGKI3R.js";
23
23
  import {
24
24
  presentFields
25
- } from "./cli-TT36JCU5.js";
26
- import "./cli-OXAUOWCN.js";
25
+ } from "./cli-FXY3DKPW.js";
26
+ import "./cli-57V4ARER.js";
27
27
  import {
28
28
  BUILD_COMMAND,
29
29
  generateTypes,
30
30
  operationError,
31
31
  printOperationResult
32
- } from "./cli-KSGB2ZLK.js";
32
+ } from "./cli-JGFJWZFU.js";
33
33
  import {
34
34
  checkbox,
35
35
  input
36
36
  } from "./cli-ZTWOE3ZT.js";
37
- import "./cli-LQOHATY2.js";
38
- import "./cli-IEMKI7J7.js";
39
- import "./cli-OMWC75CC.js";
40
- import "./cli-BYCHKSSH.js";
37
+ import "./cli-H3J3ICCQ.js";
38
+ import "./cli-SWZY7L7K.js";
39
+ import "./cli-C6G65H6S.js";
40
+ import "./cli-UTM4QU67.js";
41
41
  import "./cli-25RWY5BQ.js";
42
42
  import "./cli-QWQMPCL6.js";
43
43
  import {
44
44
  validateSDKUserInterface
45
- } from "./cli-VQ6HVQW4.js";
45
+ } from "./cli-ZF7IFB54.js";
46
46
  import "./cli-F2D4GGUA.js";
47
47
  import {
48
48
  logger
@@ -1,28 +1,28 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  updateSettingsEditor
4
- } from "./cli-AV2FYC5G.js";
5
- import "./cli-Q6ZBZYK2.js";
6
- import "./cli-5IAW3LIF.js";
4
+ } from "./cli-XR2XSWQN.js";
5
+ import "./cli-XTANOFQR.js";
6
+ import "./cli-4VZIJYKU.js";
7
7
  import "./cli-S5IVGDDD.js";
8
- import "./cli-4VFZHLDG.js";
8
+ import "./cli-JR5AZLLK.js";
9
9
  import "./cli-4UWFQNGF.js";
10
- import "./cli-4SIWLHQO.js";
10
+ import "./cli-LE5ICDAF.js";
11
11
  import "./cli-IUS2YCD3.js";
12
12
  import "./cli-QUNIRH7A.js";
13
- import "./cli-J4UBELKF.js";
13
+ import "./cli-YSPZZQCP.js";
14
14
  import "./cli-XSVGKI3R.js";
15
- import "./cli-TT36JCU5.js";
16
- import "./cli-OXAUOWCN.js";
17
- import "./cli-KSGB2ZLK.js";
15
+ import "./cli-FXY3DKPW.js";
16
+ import "./cli-57V4ARER.js";
17
+ import "./cli-JGFJWZFU.js";
18
18
  import "./cli-ZTWOE3ZT.js";
19
- import "./cli-LQOHATY2.js";
20
- import "./cli-IEMKI7J7.js";
21
- import "./cli-OMWC75CC.js";
22
- import "./cli-BYCHKSSH.js";
19
+ import "./cli-H3J3ICCQ.js";
20
+ import "./cli-SWZY7L7K.js";
21
+ import "./cli-C6G65H6S.js";
22
+ import "./cli-UTM4QU67.js";
23
23
  import "./cli-25RWY5BQ.js";
24
24
  import "./cli-QWQMPCL6.js";
25
- import "./cli-VQ6HVQW4.js";
25
+ import "./cli-ZF7IFB54.js";
26
26
  import "./cli-F2D4GGUA.js";
27
27
  import "./cli-4YB3ROVR.js";
28
28
  import "./cli-N6H6T2E2.js";
@@ -694,6 +694,10 @@ var schema_default = {
694
694
  minProperties: 1,
695
695
  additionalProperties: false
696
696
  }
697
+ },
698
+ sessionJoin: {
699
+ type: "boolean",
700
+ 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`"
697
701
  }
698
702
  },
699
703
  additionalProperties: false
@@ -746,7 +750,8 @@ var schema_default = {
746
750
  },
747
751
  additionalProperties: false
748
752
  },
749
- defaultNames: { $ref: "#/$defs/GameSettingConstraint" }
753
+ defaultNames: { $ref: "#/$defs/GameSettingConstraint" },
754
+ sessionJoin: { $ref: "#/$defs/GameSettingConstraint" }
750
755
  },
751
756
  additionalProperties: false
752
757
  },
@@ -823,6 +828,10 @@ var schema_default = {
823
828
  minProperties: 1,
824
829
  additionalProperties: false
825
830
  }
831
+ },
832
+ sessionJoin: {
833
+ type: "boolean",
834
+ 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"
826
835
  }
827
836
  },
828
837
  additionalProperties: false
@@ -1594,6 +1603,7 @@ var TITLES = {
1594
1603
  "teams.perTeam.minParticipants": "Minimum participants per team",
1595
1604
  "teams.perTeam.maxParticipants": "Maximum participants per team",
1596
1605
  "teams.defaultNames": "Default team names",
1606
+ "teams.sessionJoin": "Offer a session join link",
1597
1607
  "waitingRoom.openOnStart": "Open the waiting room on start"
1598
1608
  };
1599
1609
  function gameSettingsDefaults(manifest) {
@@ -1607,7 +1617,8 @@ function gameSettingsDefaults(manifest) {
1607
1617
  minParticipants: teams?.perTeam?.minParticipants ?? null,
1608
1618
  maxParticipants: teams?.perTeam?.maxParticipants ?? null
1609
1619
  },
1610
- defaultNames: teams?.defaultNames ?? []
1620
+ defaultNames: teams?.defaultNames ?? [],
1621
+ sessionJoin: teams?.sessionJoin !== false
1611
1622
  },
1612
1623
  waitingRoom: { openOnStart: manifest.waitingRoom?.openOnStart === true }
1613
1624
  };
@@ -1689,7 +1700,8 @@ function gameSettingsOf(resolved) {
1689
1700
  minParticipants: game.teams?.perTeam?.minParticipants ?? null,
1690
1701
  maxParticipants: game.teams?.perTeam?.maxParticipants ?? null
1691
1702
  },
1692
- defaultNames: game.teams?.defaultNames ?? neutral.teams.defaultNames
1703
+ defaultNames: game.teams?.defaultNames ?? neutral.teams.defaultNames,
1704
+ sessionJoin: game.teams?.sessionJoin !== false
1693
1705
  },
1694
1706
  waitingRoom: { openOnStart: game.waitingRoom?.openOnStart === true }
1695
1707
  };
@@ -1711,6 +1723,10 @@ function gameOverrideRefusal(overrides) {
1711
1723
  if ("waitingRoom" in game) {
1712
1724
  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";
1713
1725
  }
1726
+ const teams = game.teams;
1727
+ if (teams !== null && typeof teams === "object" && "sessionJoin" in teams) {
1728
+ 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";
1729
+ }
1714
1730
  return null;
1715
1731
  }
1716
1732
 
@@ -3006,7 +3022,7 @@ function packageRelativePath(file, packageRoot) {
3006
3022
 
3007
3023
  // cli/runtime/manifest-version.ts
3008
3024
  var MANIFEST_VERSION = 3;
3009
- var SPEC_REVISION = "1.5";
3025
+ var SPEC_REVISION = "1.6";
3010
3026
  var SUPPORTED_FEATURES = [
3011
3027
  // A validator's `Scenario` gate (§15.8).
3012
3028
  "scenario-validation",
@@ -2,26 +2,26 @@
2
2
  import {
3
3
  deleteFacilitatorGuideFiles,
4
4
  findFacilitatorGuideReferences
5
- } from "./cli-HKORECAG.js";
5
+ } from "./cli-LQERHJFE.js";
6
6
  import {
7
7
  loadPackageContext
8
8
  } from "./cli-XSVGKI3R.js";
9
- import "./cli-TT36JCU5.js";
10
- import "./cli-OXAUOWCN.js";
9
+ import "./cli-FXY3DKPW.js";
10
+ import "./cli-57V4ARER.js";
11
11
  import {
12
12
  operationError,
13
13
  recordOperationResult
14
- } from "./cli-KSGB2ZLK.js";
14
+ } from "./cli-JGFJWZFU.js";
15
15
  import {
16
16
  confirmAction
17
17
  } from "./cli-ZTWOE3ZT.js";
18
- import "./cli-LQOHATY2.js";
19
- import "./cli-IEMKI7J7.js";
20
- import "./cli-OMWC75CC.js";
21
- import "./cli-BYCHKSSH.js";
18
+ import "./cli-H3J3ICCQ.js";
19
+ import "./cli-SWZY7L7K.js";
20
+ import "./cli-C6G65H6S.js";
21
+ import "./cli-UTM4QU67.js";
22
22
  import "./cli-25RWY5BQ.js";
23
23
  import "./cli-QWQMPCL6.js";
24
- import "./cli-VQ6HVQW4.js";
24
+ import "./cli-ZF7IFB54.js";
25
25
  import "./cli-F2D4GGUA.js";
26
26
  import {
27
27
  logger
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  resolveSession
4
- } from "./cli-6K3VQQUS.js";
4
+ } from "./cli-OANH3BTQ.js";
5
5
  import "./cli-WU43JT4T.js";
6
6
  import {
7
7
  emit,
@@ -9,19 +9,19 @@ import {
9
9
  viewReport,
10
10
  viewSummary,
11
11
  warnIfStale
12
- } from "./cli-L7VYSXQK.js";
13
- import "./cli-FQRVFGN6.js";
14
- import "./cli-XSLNH5PR.js";
12
+ } from "./cli-GPAN6XK2.js";
13
+ import "./cli-LQ4VSM5R.js";
14
+ import "./cli-EJVAQCMQ.js";
15
15
  import "./cli-TDSQSCX4.js";
16
16
  import "./cli-SRHBXZCN.js";
17
- import "./cli-KGT5L7VZ.js";
17
+ import "./cli-MM3A4SPH.js";
18
18
  import "./cli-4LKXZQ2B.js";
19
19
  import "./cli-MMN4BPO4.js";
20
20
  import "./cli-QUNIRH7A.js";
21
- import "./cli-BYCHKSSH.js";
21
+ import "./cli-UTM4QU67.js";
22
22
  import "./cli-25RWY5BQ.js";
23
23
  import "./cli-QWQMPCL6.js";
24
- import "./cli-VQ6HVQW4.js";
24
+ import "./cli-ZF7IFB54.js";
25
25
  import "./cli-F2D4GGUA.js";
26
26
  import "./cli-4YB3ROVR.js";
27
27
  import {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  resolveSession
4
- } from "./cli-6K3VQQUS.js";
4
+ } from "./cli-OANH3BTQ.js";
5
5
  import "./cli-WU43JT4T.js";
6
6
  import {
7
7
  emit,
@@ -10,26 +10,26 @@ import {
10
10
  teamIndexFromArgument,
11
11
  tickReport,
12
12
  wholeNumberFromFlag
13
- } from "./cli-L7VYSXQK.js";
14
- import "./cli-FQRVFGN6.js";
13
+ } from "./cli-GPAN6XK2.js";
14
+ import "./cli-LQ4VSM5R.js";
15
15
  import {
16
16
  IDLE_TIMER
17
- } from "./cli-XSLNH5PR.js";
17
+ } from "./cli-EJVAQCMQ.js";
18
18
  import "./cli-TDSQSCX4.js";
19
19
  import "./cli-SRHBXZCN.js";
20
- import "./cli-KGT5L7VZ.js";
20
+ import "./cli-MM3A4SPH.js";
21
21
  import "./cli-4LKXZQ2B.js";
22
22
  import "./cli-MMN4BPO4.js";
23
23
  import "./cli-QUNIRH7A.js";
24
24
  import {
25
25
  loadPackageContext
26
26
  } from "./cli-XSVGKI3R.js";
27
- import "./cli-BYCHKSSH.js";
27
+ import "./cli-UTM4QU67.js";
28
28
  import "./cli-25RWY5BQ.js";
29
29
  import "./cli-QWQMPCL6.js";
30
30
  import {
31
31
  loadConfig
32
- } from "./cli-VQ6HVQW4.js";
32
+ } from "./cli-ZF7IFB54.js";
33
33
  import "./cli-F2D4GGUA.js";
34
34
  import "./cli-4YB3ROVR.js";
35
35
  import {
@@ -158,6 +158,13 @@ async function participantAddCommand(name, options) {
158
158
  rosterOf
159
159
  );
160
160
  }
161
+ async function participantJoinCommand(name, options) {
162
+ await submit(
163
+ options,
164
+ () => ({ type: "joinSession", ...name === void 0 ? {} : { name } }),
165
+ rosterOf
166
+ );
167
+ }
161
168
  async function participantRenameCommand(participantId, name, options) {
162
169
  if (!name) {
163
170
  throw new CliError(
@@ -376,6 +383,7 @@ export {
376
383
  faultCommand,
377
384
  localeCommand,
378
385
  participantAddCommand,
386
+ participantJoinCommand,
379
387
  participantMoveCommand,
380
388
  participantRenameCommand,
381
389
  playCommand,