@seriousgaming/sdk-tools 1.7.0 → 1.9.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 (188) hide show
  1. package/dist/agent/guidance.md +1 -0
  2. package/dist/{cli-SOFCTQAL.js → cli-2BF7KBBJ.js} +15 -15
  3. package/dist/cli-2CSI2UU2.js +110 -0
  4. package/dist/{cli-2BH7FX27.js → cli-2FXZZLCL.js} +1 -1
  5. package/dist/{cli-H3J3ICCQ.js → cli-2I6UN6C3.js} +3 -3
  6. package/dist/{cli-MYJGGLC5.js → cli-2JEICVMA.js} +3 -3
  7. package/dist/{cli-7RYIEKMB.js → cli-2PMLR6WG.js} +15 -15
  8. package/dist/{cli-JRIIAZ33.js → cli-2UOUIVHW.js} +53 -38
  9. package/dist/{cli-OQG3Y4RU.js → cli-2VV5IPSY.js} +15 -15
  10. package/dist/{cli-ZRPWZOCW.js → cli-35K37SYY.js} +20 -16
  11. package/dist/cli-3I6AI4AA.js +36 -0
  12. package/dist/{cli-YSPZZQCP.js → cli-3RMP4HKZ.js} +2 -2
  13. package/dist/{cli-4UWFQNGF.js → cli-3VV2JLHX.js} +1 -1
  14. package/dist/cli-3YGNWZC6.js +30 -0
  15. package/dist/{cli-TPNQLYPC.js → cli-4L7S27XO.js} +1 -1
  16. package/dist/cli-4X3X4HB2.js +16 -0
  17. package/dist/{cli-TJ3PLRHF.js → cli-5BPQ73OM.js} +15 -15
  18. package/dist/{cli-UTM4QU67.js → cli-5PTCQTS6.js} +282 -96
  19. package/dist/{cli-ZTZ5H55T.js → cli-6COAU7JR.js} +17 -17
  20. package/dist/{cli-QVASWX2A.js → cli-6GDPO5VU.js} +2 -2
  21. package/dist/{cli-TFMNNVJ7.js → cli-6KL5B7EC.js} +15 -15
  22. package/dist/{cli-NOQBWJQN.js → cli-6Y4XIVQS.js} +3 -3
  23. package/dist/cli-6ZBQELF2.js +36 -0
  24. package/dist/{cli-MMN4BPO4.js → cli-7CW2BBJG.js} +1 -1
  25. package/dist/{cli-LQ4VSM5R.js → cli-7N7WFRWA.js} +0 -0
  26. package/dist/{cli-JR5AZLLK.js → cli-7OCEVQQN.js} +2 -2
  27. package/dist/{cli-Z5HWENER.js → cli-7RLZIWFP.js} +19 -19
  28. package/dist/{cli-J4DKUUTK.js → cli-7V6GUIIS.js} +2 -2
  29. package/dist/{cli-6ZSMW4HR.js → cli-A3P3PO6Z.js} +15 -15
  30. package/dist/{cli-4VZIJYKU.js → cli-A7PITFRR.js} +2 -2
  31. package/dist/{cli-4XCQUM3E.js → cli-AA5GMEUL.js} +4 -4
  32. package/dist/{cli-N6H6T2E2.js → cli-AEAFLZGY.js} +12 -0
  33. package/dist/{cli-C47GJATR.js → cli-AGYCXRPR.js} +3 -3
  34. package/dist/{cli-T4HWGMY4.js → cli-AJ5CABGJ.js} +15 -15
  35. package/dist/{cli-FZ7QAZZP.js → cli-B5LZEFLU.js} +15 -15
  36. package/dist/{cli-XSVGKI3R.js → cli-BC4KKNLA.js} +1 -1
  37. package/dist/{cli-EJVAQCMQ.js → cli-BF6L37O3.js} +114 -5
  38. package/dist/{cli-ZQ2Y3U7F.js → cli-BNN36WZJ.js} +13 -13
  39. package/dist/{cli-FXY3DKPW.js → cli-BT47H36C.js} +2 -2
  40. package/dist/{cli-XTANOFQR.js → cli-BV7MX7JE.js} +3 -3
  41. package/dist/{cli-PVA52RC2.js → cli-BYXNPBVG.js} +15 -15
  42. package/dist/{cli-MJUYJIEP.js → cli-C45A5VX6.js} +3 -3
  43. package/dist/{cli-HM7CD4VU.js → cli-CKV44U7P.js} +19 -19
  44. package/dist/{cli-LQERHJFE.js → cli-CL3KF5KS.js} +2 -2
  45. package/dist/{cli-SX3ULO5P.js → cli-CPX4YA3P.js} +11 -11
  46. package/dist/{cli-CV4JGVJR.js → cli-CQUSM3SF.js} +19 -19
  47. package/dist/cli-CUZUIYCQ.js +36 -0
  48. package/dist/{cli-YOTGR3NB.js → cli-CVOLMK3Z.js} +1 -1
  49. package/dist/{cli-TFZ53OA2.js → cli-D6AC3ZCX.js} +18 -18
  50. package/dist/{cli-PIO7NWMH.js → cli-DJCQ5XFR.js} +15 -15
  51. package/dist/{cli-4YB3ROVR.js → cli-DMKRP33X.js} +1 -1
  52. package/dist/cli-DNCJURUU.js +36 -0
  53. package/dist/{cli-TIDQ4WUE.js → cli-DXHPYN4N.js} +1 -1
  54. package/dist/{cli-FP32D3T6.js → cli-E77R7ZYB.js} +15 -15
  55. package/dist/{cli-PKQNOGBO.js → cli-EDZF5Q2E.js} +63 -17
  56. package/dist/{cli-IPP5FDCH.js → cli-G54355N5.js} +18 -18
  57. package/dist/{cli-SWZY7L7K.js → cli-G7JTIP5G.js} +6 -6
  58. package/dist/{cli-C5QOJJWX.js → cli-GHIMH6JU.js} +1 -1
  59. package/dist/{cli-LE5ICDAF.js → cli-GHQIATHP.js} +4 -4
  60. package/dist/{cli-ESA6YNPF.js → cli-GZE4V7RC.js} +19 -19
  61. package/dist/{cli-4CHKF4DQ.js → cli-H7T6E7OA.js} +2 -2
  62. package/dist/{cli-TDYKRXUA.js → cli-HCMVZXWK.js} +17 -17
  63. package/dist/{cli-WU43JT4T.js → cli-HJPNNORV.js} +2 -2
  64. package/dist/{cli-MYJGMA6U.js → cli-IC5FOT2J.js} +1 -1
  65. package/dist/{cli-VYR326C6.js → cli-ICLCA6VD.js} +19 -19
  66. package/dist/{cli-CXCL7VRK.js → cli-IJPRZSJ5.js} +20 -20
  67. package/dist/{cli-VL2P354N.js → cli-IVZ7AHUJ.js} +3 -3
  68. package/dist/{cli-B6YHEKIJ.js → cli-J2OTL6JH.js} +5 -5
  69. package/dist/{cli-SOMIB4B4.js → cli-J75EBRAJ.js} +17 -17
  70. package/dist/{cli-WAZD75KE.js → cli-JEMWAIAA.js} +15 -15
  71. package/dist/{cli-TDSQSCX4.js → cli-K6M6YB67.js} +1 -1
  72. package/dist/{cli-WG36UJRK.js → cli-KD2RQS35.js} +18 -18
  73. package/dist/{cli-GTWEGYSU.js → cli-KGJHEDR2.js} +19 -19
  74. package/dist/{cli-EDCAH2TC.js → cli-KINJAQTJ.js} +19 -19
  75. package/dist/cli-KJV3GGBA.js +1973 -0
  76. package/dist/{cli-X7E3637I.js → cli-KO26S2CL.js} +50 -26
  77. package/dist/{cli-MULKSLA4.js → cli-L5ZKQNMI.js} +15 -15
  78. package/dist/{cli-ATI6OLJU.js → cli-LFUKHLHI.js} +17 -17
  79. package/dist/{cli-GHLILDH7.js → cli-LZFUSEJT.js} +13 -13
  80. package/dist/{cli-RZITKPJX.js → cli-MN7X4UG2.js} +1 -1
  81. package/dist/{cli-HCRTYQQS.js → cli-MPWTXNF6.js} +2 -2
  82. package/dist/{cli-HHPMAV4F.js → cli-MSSJLABW.js} +3 -3
  83. package/dist/{cli-DHOWZCXT.js → cli-MTAGL3QE.js} +15 -15
  84. package/dist/{cli-JIZTQVL2.js → cli-MX7GFQ6N.js} +14 -14
  85. package/dist/{cli-7TOLC62D.js → cli-MYBDWJP7.js} +20 -20
  86. package/dist/{cli-VPON5HGB.js → cli-MZM4MW7C.js} +19 -19
  87. package/dist/{cli-UBQCSUDH.js → cli-NTI22MRE.js} +16 -16
  88. package/dist/{cli-ZTWOE3ZT.js → cli-NU4SCD5D.js} +1 -1
  89. package/dist/{cli-DEBCP7UH.js → cli-OK6XWVIN.js} +17 -17
  90. package/dist/{cli-6HB6HTC6.js → cli-OOTGO3KW.js} +47 -47
  91. package/dist/{cli-2DQJACAH.js → cli-OX3254NS.js} +17 -17
  92. package/dist/{cli-GEQUJF4L.js → cli-PJO4BKSV.js} +16 -16
  93. package/dist/{cli-R7RG2VMW.js → cli-QIHVXDMW.js} +15 -15
  94. package/dist/{cli-57V4ARER.js → cli-QK2OD24J.js} +1 -1
  95. package/dist/{cli-OANH3BTQ.js → cli-QRAYIXNE.js} +5 -5
  96. package/dist/{cli-GPAN6XK2.js → cli-QWO3XJR3.js} +4 -4
  97. package/dist/{cli-JRMHSMYT.js → cli-R6YAZP6E.js} +19 -19
  98. package/dist/{cli-FXWWYBYU.js → cli-RHYQYXE2.js} +18 -18
  99. package/dist/{cli-C3OERMIR.js → cli-RL5EBZL7.js} +3 -3
  100. package/dist/{cli-XR2XSWQN.js → cli-S3YIYAXC.js} +12 -12
  101. package/dist/{cli-NPPY557S.js → cli-S7PLSPGE.js} +15 -15
  102. package/dist/{cli-NEOLMC2P.js → cli-SBKTGFY4.js} +17 -17
  103. package/dist/{cli-BOXXMDSX.js → cli-TLRTLTGK.js} +18 -18
  104. package/dist/cli-UKC7KXWU.js +36 -0
  105. package/dist/{cli-FWFRKQNE.js → cli-UR63LFVK.js} +2 -2
  106. package/dist/{cli-ZKG3OPZ6.js → cli-USBJQAYI.js} +13 -13
  107. package/dist/{cli-M7WEAIRF.js → cli-VRGVHSXH.js} +106 -28
  108. package/dist/{cli-IUS2YCD3.js → cli-VTLFQHDO.js} +1 -1
  109. package/dist/{cli-JGFJWZFU.js → cli-W4BHSBAX.js} +3 -3
  110. package/dist/cli-WA2PDQUB.js +36 -0
  111. package/dist/{cli-HYEU3QS6.js → cli-WJO75KP7.js} +3 -3
  112. package/dist/{cli-3PIJLSRQ.js → cli-XA4IL7IM.js} +11 -11
  113. package/dist/{cli-LRQDF3ZO.js → cli-XRVH5WV6.js} +13 -13
  114. package/dist/{cli-SRHBXZCN.js → cli-Y33ULHYO.js} +1 -1
  115. package/dist/{cli-G5DQGZ2E.js → cli-YD4SBAHQ.js} +19 -19
  116. package/dist/{cli-64AA7367.js → cli-YI3WZF3C.js} +11 -11
  117. package/dist/{cli-JPAXKLVT.js → cli-ZHFHOWJI.js} +11 -11
  118. package/dist/{cli-MM3A4SPH.js → cli-ZZSPFLTK.js} +7265 -4467
  119. package/dist/cli.js +52 -52
  120. package/dist/client.js +17518 -16558
  121. package/dist/core/save-scenario.d.ts +1 -0
  122. package/dist/core/session-start-gate.d.ts +25 -0
  123. package/dist/core/session.d.ts +4 -0
  124. package/dist/dev/console/assets/{index-CnXlPeLX.js → index-CVNjiRUh.js} +31 -27
  125. package/dist/dev/console/index.html +1 -1
  126. package/dist/docs/api/deck.md +1 -1
  127. package/dist/docs/api/index.md +1 -1
  128. package/dist/docs/api/sdk-e2e.md +7 -6
  129. package/dist/docs/api/sdk-projection.md +1 -0
  130. package/dist/docs/api/sdk-tools-client.md +3 -1
  131. package/dist/docs/api/sdk-tools-playwright.md +1 -8
  132. package/dist/docs/api/sdk-ui.md +40 -64
  133. package/dist/docs/api/sdk.md +10 -1
  134. package/dist/docs/changelog.md +25 -0
  135. package/dist/docs/cli-error-codes.md +7 -1
  136. package/dist/docs/cli-reference.md +3 -0
  137. package/dist/docs/concepts/index.md +1 -0
  138. package/dist/docs/guides/engine.md +5 -0
  139. package/dist/docs/guides/file-handling.md +4 -1
  140. package/dist/docs/guides/llm-integration.md +3 -2
  141. package/dist/docs/guides/multi-team-games.md +2 -0
  142. package/dist/docs/guides/patterns.md +5 -0
  143. package/dist/docs/guides/session.md +1 -1
  144. package/dist/docs/guides/settings.md +2 -0
  145. package/dist/docs/guides/setup.md +67 -6
  146. package/dist/docs/guides/speech-generation.md +1 -0
  147. package/dist/docs/guides/testing.md +2 -0
  148. package/dist/docs/guides/tick-controller.md +2 -0
  149. package/dist/docs/guides/type-safety.md +2 -1
  150. package/dist/docs/guides/ui-files-and-llms.md +3 -1
  151. package/dist/docs/guides/upgrading.md +4 -0
  152. package/dist/docs/guides/validators.md +27 -4
  153. package/dist/docs/guides/waiting-room.md +2 -0
  154. package/dist/docs/page-index.md +10 -7
  155. package/dist/docs/recipes/call-endpoint-from-ui.md +1 -0
  156. package/dist/docs/recipes/create-scenario-editor.md +2 -1
  157. package/dist/docs/recipes/create-setup.md +19 -10
  158. package/dist/docs/recipes/declare-api-uses.md +1 -0
  159. package/dist/docs/recipes/describe-setup-with-endpoint.md +69 -0
  160. package/dist/docs/recipes/give-setup-a-menu.md +90 -0
  161. package/dist/docs/recipes/index.md +4 -1
  162. package/dist/docs/recipes/share-logic-between-engine-and-ui.md +2 -2
  163. package/dist/docs/recipes/test-user-interface.md +1 -1
  164. package/dist/docs/recipes/validate-scenarios.md +9 -3
  165. package/dist/docs/recipes/write-setup-notes.md +57 -0
  166. package/dist/docs/troubleshooting.md +2 -1
  167. package/dist/execution/executor.d.ts +12 -0
  168. package/dist/execution/scenario-gates.d.ts +40 -0
  169. package/dist/host.js +1082 -467
  170. package/dist/playwright.js +17529 -16569
  171. package/dist/runtime/manifest-version.d.ts +1 -1
  172. package/dist/runtime.js +4 -2
  173. package/dist/setup/setup-notes.d.ts +42 -0
  174. package/dist/templates/package/package.json.liquid +15 -15
  175. package/dist/templates/starter-game/package.json +13 -13
  176. package/dist/utils/error-codes.d.ts +13 -1
  177. package/dist/validation/package-validation.d.ts +1 -1
  178. package/package.json +22 -23
  179. package/dist/cli-57C72YKJ.js +0 -36
  180. package/dist/cli-5G7TZHD3.js +0 -36
  181. package/dist/cli-7MBLH4M3.js +0 -36
  182. package/dist/cli-C6G65H6S.js +0 -256
  183. package/dist/cli-L5IG7MY2.js +0 -36
  184. package/dist/cli-SPGUVL6Z.js +0 -36
  185. package/dist/cli-UY4VDI7W.js +0 -30
  186. package/dist/cli-WM6SQJ6Q.js +0 -16
  187. package/dist/cli-ZBTFLZUL.js +0 -36
  188. package/dist/cli-ZF7IFB54.js +0 -4026
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ submitPatch,
4
+ submitSharedPatch,
5
+ tickCommand
6
+ } from "./cli-2JEICVMA.js";
7
+ import "./cli-QRAYIXNE.js";
8
+ import "./cli-HJPNNORV.js";
9
+ import "./cli-QWO3XJR3.js";
10
+ import "./cli-7N7WFRWA.js";
11
+ import "./cli-BF6L37O3.js";
12
+ import "./cli-K6M6YB67.js";
13
+ import "./cli-Y33ULHYO.js";
14
+ import "./cli-KJV3GGBA.js";
15
+ import "./cli-4LKXZQ2B.js";
16
+ import "./cli-7CW2BBJG.js";
17
+ import "./cli-S5IVGDDD.js";
18
+ import "./cli-QUNIRH7A.js";
19
+ import "./cli-5PTCQTS6.js";
20
+ import "./cli-25RWY5BQ.js";
21
+ import "./cli-QWQMPCL6.js";
22
+ import "./cli-ZZSPFLTK.js";
23
+ import "./cli-F2D4GGUA.js";
24
+ import "./cli-DMKRP33X.js";
25
+ import "./cli-AEAFLZGY.js";
26
+ export {
27
+ submitPatch,
28
+ submitSharedPatch,
29
+ tickCommand
30
+ };
@@ -8,7 +8,7 @@ import {
8
8
  didYouMean,
9
9
  pointerOf,
10
10
  readLogicExports
11
- } from "./cli-ZF7IFB54.js";
11
+ } from "./cli-ZZSPFLTK.js";
12
12
 
13
13
  // cli/validation/resource-validator.ts
14
14
  import { existsSync } from "fs";
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ generateCommand
4
+ } from "./cli-2I6UN6C3.js";
5
+ import "./cli-G7JTIP5G.js";
6
+ import "./cli-2CSI2UU2.js";
7
+ import "./cli-5PTCQTS6.js";
8
+ import "./cli-25RWY5BQ.js";
9
+ import "./cli-QWQMPCL6.js";
10
+ import "./cli-ZZSPFLTK.js";
11
+ import "./cli-F2D4GGUA.js";
12
+ import "./cli-DMKRP33X.js";
13
+ import "./cli-AEAFLZGY.js";
14
+ export {
15
+ generateCommand
16
+ };
@@ -2,36 +2,36 @@
2
2
  import {
3
3
  deleteEndpointFiles,
4
4
  findEndpointReferences
5
- } from "./cli-LE5ICDAF.js";
6
- import "./cli-IUS2YCD3.js";
5
+ } from "./cli-GHQIATHP.js";
6
+ import "./cli-VTLFQHDO.js";
7
7
  import "./cli-QUNIRH7A.js";
8
- import "./cli-YSPZZQCP.js";
8
+ import "./cli-3RMP4HKZ.js";
9
9
  import {
10
10
  loadPackageContext
11
- } from "./cli-XSVGKI3R.js";
12
- import "./cli-FXY3DKPW.js";
13
- import "./cli-57V4ARER.js";
11
+ } from "./cli-BC4KKNLA.js";
12
+ import "./cli-BT47H36C.js";
13
+ import "./cli-QK2OD24J.js";
14
14
  import {
15
15
  operationError,
16
16
  recordOperationResult
17
- } from "./cli-JGFJWZFU.js";
17
+ } from "./cli-W4BHSBAX.js";
18
18
  import {
19
19
  confirmAction
20
- } from "./cli-ZTWOE3ZT.js";
20
+ } from "./cli-NU4SCD5D.js";
21
21
  import {
22
22
  generateCommand
23
- } from "./cli-H3J3ICCQ.js";
24
- import "./cli-SWZY7L7K.js";
25
- import "./cli-C6G65H6S.js";
26
- import "./cli-UTM4QU67.js";
23
+ } from "./cli-2I6UN6C3.js";
24
+ import "./cli-G7JTIP5G.js";
25
+ import "./cli-2CSI2UU2.js";
26
+ import "./cli-5PTCQTS6.js";
27
27
  import "./cli-25RWY5BQ.js";
28
28
  import "./cli-QWQMPCL6.js";
29
- import "./cli-ZF7IFB54.js";
29
+ import "./cli-ZZSPFLTK.js";
30
30
  import "./cli-F2D4GGUA.js";
31
31
  import {
32
32
  logger
33
- } from "./cli-4YB3ROVR.js";
34
- import "./cli-N6H6T2E2.js";
33
+ } from "./cli-DMKRP33X.js";
34
+ import "./cli-AEAFLZGY.js";
35
35
 
36
36
  // cli/commands/resources/endpoint/delete.ts
37
37
  async function deleteEndpoint(identifier, options) {
@@ -6,17 +6,22 @@ import {
6
6
  } from "./cli-25RWY5BQ.js";
7
7
  import {
8
8
  describeAssetByReference,
9
+ describeBlob,
9
10
  readAssetByReference,
10
11
  storeBlob
11
12
  } from "./cli-QWQMPCL6.js";
12
13
  import {
13
14
  DeniedError,
15
+ SCENARIO_GATE_READ_LIMIT_BYTES,
16
+ ScenarioAssetTooLargeError,
17
+ Transpile,
14
18
  UndeclaredApiUseError,
19
+ errorMessage,
15
20
  realPath,
16
21
  settingsSchemas,
17
22
  validateSessionOverrides,
18
23
  validateSettingsOverrides
19
- } from "./cli-ZF7IFB54.js";
24
+ } from "./cli-ZZSPFLTK.js";
20
25
 
21
26
  // cli/execution/logic-failure.ts
22
27
  import { SourceMap } from "node:module";
@@ -250,100 +255,9 @@ function describeLogicFailure(error, origin, maps, packagePath) {
250
255
  };
251
256
  }
252
257
 
253
- // cli/execution/logic-loader.ts
254
- import { isAbsolute as isAbsolute2, join } from "node:path";
255
- import { compileFunction, createContext } from "node:vm";
256
- var LogicLoader = class {
257
- constructor(packagePath, deps) {
258
- this.packagePath = packagePath;
259
- this.deps = deps;
260
- }
261
- packagePath;
262
- deps;
263
- caches = {
264
- engine: /* @__PURE__ */ new Map(),
265
- tickController: /* @__PURE__ */ new Map(),
266
- hook: /* @__PURE__ */ new Map(),
267
- validator: /* @__PURE__ */ new Map(),
268
- endpoint: /* @__PURE__ */ new Map()
269
- };
270
- logicContext;
271
- /** Each evaluated bundle's source map, to read a thrown stack back to source. */
272
- sourceMaps = new SourceMapRegistry();
273
- /**
274
- * Load the logic exports for `identifier` of the given `kind`, from cache
275
- * when present. `resource` is the bundle whose logic to compile; a missing
276
- * resource throws `notFoundMessage`.
277
- */
278
- async load(kind, identifier, resource, notFoundMessage) {
279
- const cache = this.caches[kind];
280
- const cached = cache.get(identifier);
281
- if (cached) {
282
- return cached;
283
- }
284
- if (!resource) {
285
- throw new Error(notFoundMessage);
286
- }
287
- const logicDirectory = resolveResourceDirectory(
288
- this.packagePath,
289
- resource.rootDirectory,
290
- resource.logic.directory
291
- );
292
- const logicPath = join(logicDirectory, resource.logic.entrypoint);
293
- const bundledCode = isPrecompiled(resource.rootDirectory, resource.logic.entrypoint) ? await this.deps.fs.readFile(logicPath, "utf-8") : await this.deps.transpile({
294
- entrypoint: logicPath,
295
- sourcemap: true,
296
- packageRoot: this.packagePath
297
- });
298
- this.sourceMaps.register(logicPath, bundledCode);
299
- const moduleObj = { exports: {} };
300
- const func = compileFunction(bundledCode, ["module", "exports"], {
301
- filename: logicPath,
302
- parsingContext: this.getLogicContext()
303
- });
304
- func(moduleObj, moduleObj.exports);
305
- const exports = moduleObj.exports;
306
- cache.set(identifier, exports);
307
- return exports;
308
- }
309
- /** Drop every cached bundle (used when configuration or code reloads). */
310
- clearAll() {
311
- for (const cache of Object.values(this.caches)) {
312
- cache.clear();
313
- }
314
- this.sourceMaps.clear();
315
- }
316
- /** Drop a single cached bundle so its next load re-transpiles it. */
317
- invalidate(kind, identifier) {
318
- this.caches[kind].delete(identifier);
319
- }
320
- /**
321
- * The shared bare-V8 global scope every logic bundle is evaluated in.
322
- *
323
- * A fresh vm context exposes only the ECMAScript intrinsics — the
324
- * environment the production runtime guarantees (SPECIFICATION.md §3.2).
325
- * Host globals such as `structuredClone`, `fetch`, `setTimeout`,
326
- * `TextEncoder`, and `process` are absent, so logic that reaches for one
327
- * throws a `ReferenceError` here exactly as it would in production, instead
328
- * of silently working against Node's globals and only failing on deploy.
329
- * (`console` is provided by a shim the transpiler compiles into each bundle.)
330
- */
331
- getLogicContext() {
332
- if (!this.logicContext) {
333
- this.logicContext = createContext({});
334
- }
335
- return this.logicContext;
336
- }
337
- };
338
- function resolveResourceDirectory(packagePath, rootDirectory, logicDirectory) {
339
- if (isAbsolute2(rootDirectory)) {
340
- return join(rootDirectory, logicDirectory);
341
- }
342
- return join(packagePath, rootDirectory, logicDirectory);
343
- }
344
- function isPrecompiled(rootDirectory, entrypoint) {
345
- return isAbsolute2(rootDirectory) && entrypoint.endsWith(".js");
346
- }
258
+ // cli/execution/scenario-gates.ts
259
+ import { existsSync } from "fs";
260
+ import { readFile } from "fs/promises";
347
261
 
348
262
  // cli/runtime/context-merge.ts
349
263
  var UNSAFE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
@@ -1304,6 +1218,269 @@ var LogicCalls = class {
1304
1218
  }
1305
1219
  };
1306
1220
 
1221
+ // cli/execution/logic-loader.ts
1222
+ import { isAbsolute as isAbsolute2, join } from "node:path";
1223
+ import { compileFunction, createContext } from "node:vm";
1224
+ var LogicLoader = class {
1225
+ constructor(packagePath, deps) {
1226
+ this.packagePath = packagePath;
1227
+ this.deps = deps;
1228
+ }
1229
+ packagePath;
1230
+ deps;
1231
+ caches = {
1232
+ engine: /* @__PURE__ */ new Map(),
1233
+ tickController: /* @__PURE__ */ new Map(),
1234
+ hook: /* @__PURE__ */ new Map(),
1235
+ validator: /* @__PURE__ */ new Map(),
1236
+ endpoint: /* @__PURE__ */ new Map()
1237
+ };
1238
+ logicContext;
1239
+ /** Each evaluated bundle's source map, to read a thrown stack back to source. */
1240
+ sourceMaps = new SourceMapRegistry();
1241
+ /**
1242
+ * Load the logic exports for `identifier` of the given `kind`, from cache
1243
+ * when present. `resource` is the bundle whose logic to compile; a missing
1244
+ * resource throws `notFoundMessage`.
1245
+ */
1246
+ async load(kind, identifier, resource, notFoundMessage) {
1247
+ const cache = this.caches[kind];
1248
+ const cached = cache.get(identifier);
1249
+ if (cached) {
1250
+ return cached;
1251
+ }
1252
+ if (!resource) {
1253
+ throw new Error(notFoundMessage);
1254
+ }
1255
+ const logicDirectory = resolveResourceDirectory(
1256
+ this.packagePath,
1257
+ resource.rootDirectory,
1258
+ resource.logic.directory
1259
+ );
1260
+ const logicPath = join(logicDirectory, resource.logic.entrypoint);
1261
+ const bundledCode = isPrecompiled(resource.rootDirectory, resource.logic.entrypoint) ? await this.deps.fs.readFile(logicPath, "utf-8") : await this.deps.transpile({
1262
+ entrypoint: logicPath,
1263
+ sourcemap: true,
1264
+ packageRoot: this.packagePath
1265
+ });
1266
+ this.sourceMaps.register(logicPath, bundledCode);
1267
+ const moduleObj = { exports: {} };
1268
+ const func = compileFunction(bundledCode, ["module", "exports"], {
1269
+ filename: logicPath,
1270
+ parsingContext: this.getLogicContext()
1271
+ });
1272
+ func(moduleObj, moduleObj.exports);
1273
+ const exports = moduleObj.exports;
1274
+ cache.set(identifier, exports);
1275
+ return exports;
1276
+ }
1277
+ /** Drop every cached bundle (used when configuration or code reloads). */
1278
+ clearAll() {
1279
+ for (const cache of Object.values(this.caches)) {
1280
+ cache.clear();
1281
+ }
1282
+ this.sourceMaps.clear();
1283
+ }
1284
+ /** Drop a single cached bundle so its next load re-transpiles it. */
1285
+ invalidate(kind, identifier) {
1286
+ this.caches[kind].delete(identifier);
1287
+ }
1288
+ /**
1289
+ * The shared bare-V8 global scope every logic bundle is evaluated in.
1290
+ *
1291
+ * A fresh vm context exposes only the ECMAScript intrinsics — the
1292
+ * environment the production runtime guarantees (SPECIFICATION.md §3.2).
1293
+ * Host globals such as `structuredClone`, `fetch`, `setTimeout`,
1294
+ * `TextEncoder`, and `process` are absent, so logic that reaches for one
1295
+ * throws a `ReferenceError` here exactly as it would in production, instead
1296
+ * of silently working against Node's globals and only failing on deploy.
1297
+ * (`console` is provided by a shim the transpiler compiles into each bundle.)
1298
+ */
1299
+ getLogicContext() {
1300
+ if (!this.logicContext) {
1301
+ this.logicContext = createContext({});
1302
+ }
1303
+ return this.logicContext;
1304
+ }
1305
+ };
1306
+ function resolveResourceDirectory(packagePath, rootDirectory, logicDirectory) {
1307
+ if (isAbsolute2(rootDirectory)) {
1308
+ return join(rootDirectory, logicDirectory);
1309
+ }
1310
+ return join(packagePath, rootDirectory, logicDirectory);
1311
+ }
1312
+ function isPrecompiled(rootDirectory, entrypoint) {
1313
+ return isAbsolute2(rootDirectory) && entrypoint.endsWith(".js");
1314
+ }
1315
+
1316
+ // cli/execution/scenario-gates.ts
1317
+ var SCENARIO_VALIDATION = "scenario-validation";
1318
+ var SCENARIO_FILES = "scenario-files";
1319
+ var SESSION_VALIDATION = "session-validation";
1320
+ function isBlocking(problem) {
1321
+ return problem.failed === true || problem.level !== "warning";
1322
+ }
1323
+ var OVERRUN_RETRIES = 1;
1324
+ function onlyOverran(problems) {
1325
+ const blocking = problems.filter(isBlocking);
1326
+ return blocking.length > 0 && blocking.every((problem) => problem.overran === true);
1327
+ }
1328
+ async function withOverrunRetry(judge) {
1329
+ let problems = await judge();
1330
+ for (let retry = 0; retry < OVERRUN_RETRIES && onlyOverran(problems); retry += 1) {
1331
+ problems = await judge();
1332
+ }
1333
+ return problems;
1334
+ }
1335
+ function partitionProblems(problems) {
1336
+ return {
1337
+ blocking: problems.filter(isBlocking),
1338
+ warnings: problems.filter((problem) => !isBlocking(problem))
1339
+ };
1340
+ }
1341
+ function hasScenarioGate(config) {
1342
+ return (config.validators ?? []).some((v) => v.definition.gates?.includes("scenario"));
1343
+ }
1344
+ async function runScenarioGates(options) {
1345
+ const { config } = options;
1346
+ if (!hasScenarioGate(config)) return [];
1347
+ const loader = options.loader ?? new LogicLoader(options.packagePath, {
1348
+ transpile: Transpile,
1349
+ fs: { existsSync, readFile }
1350
+ });
1351
+ const resolved = resolveSettingsLayers(
1352
+ config,
1353
+ options.scenarioSettings,
1354
+ options.sessionOverrides ?? null
1355
+ );
1356
+ const locale = options.locale ?? config.game?.definition.supportedLocales?.[0] ?? "en";
1357
+ const readsFiles = (config.requires ?? []).includes(SCENARIO_FILES);
1358
+ const problems = [];
1359
+ for (const validator of config.validators ?? []) {
1360
+ if (!validator.definition.gates?.includes("scenario")) continue;
1361
+ const identifier = validator.definition.identifier;
1362
+ const declared = validator.definition.settings ?? [];
1363
+ const pick = (values) => Object.fromEntries(
1364
+ declared.filter((id) => values[id] !== void 0).map((id) => [id, values[id]])
1365
+ );
1366
+ try {
1367
+ const exports = await loader.load(
1368
+ "validator",
1369
+ identifier,
1370
+ validator,
1371
+ `Validator ${identifier} not found in configuration`
1372
+ );
1373
+ const gate = exports.Scenario;
1374
+ if (!gate) {
1375
+ problems.push({
1376
+ validatorIdentifier: identifier,
1377
+ failed: true,
1378
+ message: `Validator ${identifier} does not export Scenario`
1379
+ });
1380
+ continue;
1381
+ }
1382
+ const found = await withBound(
1383
+ gate({
1384
+ settings: structuredClone(pick(resolved)),
1385
+ locale,
1386
+ callbacks: readsFiles ? scenarioCallbacks(
1387
+ options.packagePath,
1388
+ options.files ?? { scenarioRoot: null, blobs: "none" }
1389
+ ) : withoutScenarioFiles(identifier)
1390
+ }),
1391
+ options.boundMs ?? DEFAULT_LOGIC_EXECUTION_BOUND_MS
1392
+ );
1393
+ if (!Array.isArray(found)) {
1394
+ problems.push({
1395
+ validatorIdentifier: identifier,
1396
+ failed: true,
1397
+ message: `Validator ${identifier}'s Scenario returned ${JSON.stringify(found)}, not an array of problems (an empty array passes)`
1398
+ });
1399
+ continue;
1400
+ }
1401
+ for (const problem of found) {
1402
+ problems.push({
1403
+ validatorIdentifier: identifier,
1404
+ message: problem.message,
1405
+ ...problem.path === void 0 ? {} : { path: problem.path },
1406
+ ...problem.level === "warning" ? { level: "warning" } : {}
1407
+ });
1408
+ }
1409
+ } catch (error) {
1410
+ problems.push(
1411
+ error instanceof GateOverrun ? {
1412
+ validatorIdentifier: identifier,
1413
+ failed: true,
1414
+ overran: true,
1415
+ message: `Validator ${identifier} ${error.message}`
1416
+ } : {
1417
+ validatorIdentifier: identifier,
1418
+ failed: true,
1419
+ message: `Validator ${identifier} threw: ${errorMessage(error, String(error))}`
1420
+ }
1421
+ );
1422
+ }
1423
+ }
1424
+ return problems;
1425
+ }
1426
+ function scenarioCallbacks(packagePath, files) {
1427
+ const unreadable = async (reference) => {
1428
+ if (!reference.startsWith("blob:") || files.blobs === "all") return false;
1429
+ if (files.blobs === "none") return true;
1430
+ const blob = await describeBlob(packagePath, reference.slice("blob:".length));
1431
+ return blob !== void 0 && blob.retention !== "scenario";
1432
+ };
1433
+ return {
1434
+ readAsset: async (reference) => {
1435
+ if (await unreadable(reference)) {
1436
+ throw new Error(`Cannot read "${reference}": the scenario cannot name that file`);
1437
+ }
1438
+ const described = await describeAssetByReference(
1439
+ packagePath,
1440
+ files.scenarioRoot,
1441
+ reference
1442
+ );
1443
+ if (described && described.size > SCENARIO_GATE_READ_LIMIT_BYTES) {
1444
+ throw new ScenarioAssetTooLargeError(reference, described.size);
1445
+ }
1446
+ const asset = await readAssetByReference(packagePath, files.scenarioRoot, reference);
1447
+ return { data: new Uint8Array(asset.data), mimeType: asset.mimeType, name: asset.name };
1448
+ },
1449
+ describeAsset: async (reference) => await unreadable(reference) ? void 0 : describeAssetByReference(packagePath, files.scenarioRoot, reference)
1450
+ };
1451
+ }
1452
+ function withoutScenarioFiles(identifier) {
1453
+ const refuse = (callback) => async () => {
1454
+ throw new Error(
1455
+ `Validator "${identifier}" called ${callback} in its Scenario gate, which needs the "${SCENARIO_FILES}" feature, but requires does not list it. Add "${SCENARIO_FILES}" to requires in seriousgaming.sdk.json.`
1456
+ );
1457
+ };
1458
+ return { readAsset: refuse("readAsset"), describeAsset: refuse("describeAsset") };
1459
+ }
1460
+ var GateOverrun = class extends Error {
1461
+ };
1462
+ async function withBound(run, boundMs) {
1463
+ let timer;
1464
+ try {
1465
+ return await Promise.race([
1466
+ run,
1467
+ new Promise((_, reject) => {
1468
+ timer = setTimeout(
1469
+ () => reject(new GateOverrun(`did not finish within ${boundMs}ms`)),
1470
+ boundMs
1471
+ );
1472
+ })
1473
+ ]);
1474
+ } finally {
1475
+ if (timer) clearTimeout(timer);
1476
+ }
1477
+ }
1478
+ function describeScenarioProblems(problems) {
1479
+ return problems.map(
1480
+ (p) => `${p.level === "warning" ? "Warning: " : ""}${p.path ? `${p.path}: ` : ""}${p.message} (validator "${p.validatorIdentifier}")`
1481
+ );
1482
+ }
1483
+
1307
1484
  // cli/runtime/capability-scope.ts
1308
1485
  function resolveCapabilityScope(definition) {
1309
1486
  return definition.scope ?? "team";
@@ -1313,7 +1490,6 @@ export {
1313
1490
  deepMergeContext,
1314
1491
  applyContextUpdate,
1315
1492
  ConfigResolver,
1316
- resolveSettingsLayers,
1317
1493
  applySchemaDefaults,
1318
1494
  TtsClient,
1319
1495
  DocumentParserClient,
@@ -1327,5 +1503,15 @@ export {
1327
1503
  DEFAULT_TICK_EXECUTION_BOUND_MS,
1328
1504
  LogicCalls,
1329
1505
  LogicLoader,
1506
+ SCENARIO_VALIDATION,
1507
+ SCENARIO_FILES,
1508
+ SESSION_VALIDATION,
1509
+ isBlocking,
1510
+ onlyOverran,
1511
+ withOverrunRetry,
1512
+ partitionProblems,
1513
+ hasScenarioGate,
1514
+ runScenarioGates,
1515
+ describeScenarioProblems,
1330
1516
  resolveCapabilityScope
1331
1517
  };
@@ -1,46 +1,46 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  resolvePatchedDefinition
4
- } from "./cli-4VZIJYKU.js";
4
+ } from "./cli-A7PITFRR.js";
5
5
  import "./cli-S5IVGDDD.js";
6
6
  import {
7
7
  readAuthoredBundle
8
- } from "./cli-JR5AZLLK.js";
8
+ } from "./cli-7OCEVQQN.js";
9
9
  import {
10
10
  resolveInputSource
11
- } from "./cli-4UWFQNGF.js";
11
+ } from "./cli-3VV2JLHX.js";
12
12
  import {
13
13
  updateWaitingRoomUserInterfaceFiles
14
- } from "./cli-LE5ICDAF.js";
15
- import "./cli-IUS2YCD3.js";
14
+ } from "./cli-GHQIATHP.js";
15
+ import "./cli-VTLFQHDO.js";
16
16
  import "./cli-QUNIRH7A.js";
17
- import "./cli-YSPZZQCP.js";
17
+ import "./cli-3RMP4HKZ.js";
18
18
  import {
19
19
  loadPackageContext
20
- } from "./cli-XSVGKI3R.js";
21
- import "./cli-FXY3DKPW.js";
22
- import "./cli-57V4ARER.js";
20
+ } from "./cli-BC4KKNLA.js";
21
+ import "./cli-BT47H36C.js";
22
+ import "./cli-QK2OD24J.js";
23
23
  import {
24
24
  operationError,
25
25
  printOperationResult,
26
26
  regenerateTypes
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";
27
+ } from "./cli-W4BHSBAX.js";
28
+ import "./cli-2I6UN6C3.js";
29
+ import "./cli-G7JTIP5G.js";
30
+ import "./cli-2CSI2UU2.js";
31
+ import "./cli-5PTCQTS6.js";
32
32
  import "./cli-25RWY5BQ.js";
33
33
  import "./cli-QWQMPCL6.js";
34
34
  import {
35
35
  validateSDKWaitingRoomUserInterface
36
- } from "./cli-ZF7IFB54.js";
36
+ } from "./cli-ZZSPFLTK.js";
37
37
  import "./cli-F2D4GGUA.js";
38
38
  import {
39
39
  logger
40
- } from "./cli-4YB3ROVR.js";
40
+ } from "./cli-DMKRP33X.js";
41
41
  import {
42
42
  CliError
43
- } from "./cli-N6H6T2E2.js";
43
+ } from "./cli-AEAFLZGY.js";
44
44
 
45
45
  // cli/commands/resources/waiting-room/update.ts
46
46
  async function updateWaitingRoomUserInterface(definitionInput, options) {
@@ -4,11 +4,11 @@ import {
4
4
  } from "./cli-ILKCQNM6.js";
5
5
  import {
6
6
  logger
7
- } from "./cli-4YB3ROVR.js";
7
+ } from "./cli-DMKRP33X.js";
8
8
  import {
9
9
  CliError,
10
10
  reportResult
11
- } from "./cli-N6H6T2E2.js";
11
+ } from "./cli-AEAFLZGY.js";
12
12
 
13
13
  // cli/commands/package-version.ts
14
14
  import { existsSync, readFileSync, writeFileSync } from "fs";
@@ -2,36 +2,36 @@
2
2
  import {
3
3
  deletePresentationFiles,
4
4
  findPresentationReferences
5
- } from "./cli-LE5ICDAF.js";
6
- import "./cli-IUS2YCD3.js";
5
+ } from "./cli-GHQIATHP.js";
6
+ import "./cli-VTLFQHDO.js";
7
7
  import "./cli-QUNIRH7A.js";
8
- import "./cli-YSPZZQCP.js";
8
+ import "./cli-3RMP4HKZ.js";
9
9
  import {
10
10
  loadPackageContext
11
- } from "./cli-XSVGKI3R.js";
12
- import "./cli-FXY3DKPW.js";
13
- import "./cli-57V4ARER.js";
11
+ } from "./cli-BC4KKNLA.js";
12
+ import "./cli-BT47H36C.js";
13
+ import "./cli-QK2OD24J.js";
14
14
  import {
15
15
  operationError,
16
16
  recordOperationResult
17
- } from "./cli-JGFJWZFU.js";
17
+ } from "./cli-W4BHSBAX.js";
18
18
  import {
19
19
  confirmAction
20
- } from "./cli-ZTWOE3ZT.js";
20
+ } from "./cli-NU4SCD5D.js";
21
21
  import {
22
22
  generateCommand
23
- } from "./cli-H3J3ICCQ.js";
24
- import "./cli-SWZY7L7K.js";
25
- import "./cli-C6G65H6S.js";
26
- import "./cli-UTM4QU67.js";
23
+ } from "./cli-2I6UN6C3.js";
24
+ import "./cli-G7JTIP5G.js";
25
+ import "./cli-2CSI2UU2.js";
26
+ import "./cli-5PTCQTS6.js";
27
27
  import "./cli-25RWY5BQ.js";
28
28
  import "./cli-QWQMPCL6.js";
29
- import "./cli-ZF7IFB54.js";
29
+ import "./cli-ZZSPFLTK.js";
30
30
  import "./cli-F2D4GGUA.js";
31
31
  import {
32
32
  logger
33
- } from "./cli-4YB3ROVR.js";
34
- import "./cli-N6H6T2E2.js";
33
+ } from "./cli-DMKRP33X.js";
34
+ import "./cli-AEAFLZGY.js";
35
35
 
36
36
  // cli/commands/resources/presentation/delete.ts
37
37
  async function deletePresentation(options) {
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  loadConfig
4
- } from "./cli-ZF7IFB54.js";
4
+ } from "./cli-ZZSPFLTK.js";
5
5
  import "./cli-F2D4GGUA.js";
6
- import "./cli-4YB3ROVR.js";
6
+ import "./cli-DMKRP33X.js";
7
7
  import {
8
8
  reportResult
9
- } from "./cli-N6H6T2E2.js";
9
+ } from "./cli-AEAFLZGY.js";
10
10
 
11
11
  // cli/commands/endpoint-list.ts
12
12
  import { resolve } from "path";