@seriousgaming/sdk-tools 1.11.0 → 1.12.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 (192) hide show
  1. package/dist/agent/guidance.md +4 -0
  2. package/dist/{cli-F2D4GGUA.js → cli-2BKEIIA3.js} +66 -0
  3. package/dist/{cli-ZGCG6C22.js → cli-2QGTDHRX.js} +21 -21
  4. package/dist/{cli-SRXDLMXY.js → cli-2SDG3SZ7.js} +21 -21
  5. package/dist/{cli-DH35TZ2Q.js → cli-2VXP34R5.js} +2 -2
  6. package/dist/{cli-P3NUTOPK.js → cli-2W4B6PD5.js} +1 -1
  7. package/dist/{cli-WJVPSVF2.js → cli-2X7DKSXN.js} +24 -24
  8. package/dist/{cli-ATAJSIXH.js → cli-2ZP4N7HK.js} +19 -19
  9. package/dist/{cli-5O7XENQY.js → cli-3GJYZH4C.js} +5 -5
  10. package/dist/{cli-H6PP2MZT.js → cli-3GO3M2MX.js} +17 -13
  11. package/dist/{cli-HMDYG6PS.js → cli-3LDLUNME.js} +17 -17
  12. package/dist/{cli-BZOKZ7LP.js → cli-3WY6L2WP.js} +27 -27
  13. package/dist/{cli-REAM7LSC.js → cli-44MBABRD.js} +25 -25
  14. package/dist/{cli-5TTJWM2R.js → cli-4IO7MKLR.js} +20 -20
  15. package/dist/{cli-HNDFANQG.js → cli-4U2PY7W3.js} +1 -1
  16. package/dist/{cli-WQ7JBZNW.js → cli-4WI4LTBI.js} +2 -2
  17. package/dist/{cli-OTBCA54D.js → cli-55EIGGZK.js} +1 -1
  18. package/dist/{cli-FYPW25VD.js → cli-5AQV6FTL.js} +18 -18
  19. package/dist/{cli-RKPQLB7J.js → cli-5CW7BEU7.js} +3 -3
  20. package/dist/{cli-27TQVLVF.js → cli-5JUVHNZF.js} +12 -12
  21. package/dist/{cli-F3YJKP6D.js → cli-5KERL6HV.js} +9 -4
  22. package/dist/{cli-MSNSXVGF.js → cli-5KSA24NQ.js} +24 -24
  23. package/dist/{cli-5VZBFMCK.js → cli-5PIFO3EN.js} +8 -0
  24. package/dist/{cli-FT3X3D4P.js → cli-5QN2Z43X.js} +20 -20
  25. package/dist/cli-5XSPAA5X.js +69 -0
  26. package/dist/{cli-B2QAJ5RQ.js → cli-62KAYGXO.js} +20 -20
  27. package/dist/{cli-QPV3TYOM.js → cli-6IMV5ZZU.js} +26 -26
  28. package/dist/{cli-UULZSQBV.js → cli-6KWCIAN2.js} +764 -66
  29. package/dist/{cli-DQE7ITIR.js → cli-6NWETIX5.js} +20 -20
  30. package/dist/{cli-L7F4XKCB.js → cli-774W3MN5.js} +26 -26
  31. package/dist/cli-7BUD3VAD.js +16 -0
  32. package/dist/{cli-XNOAO6DY.js → cli-7KEP57S7.js} +12 -12
  33. package/dist/{cli-5UKWX3IU.js → cli-7OYFJMA6.js} +18 -18
  34. package/dist/{cli-WNHMJM3Z.js → cli-7ZNEDQ3G.js} +20 -20
  35. package/dist/{cli-5RRPUL6V.js → cli-AFK6OUID.js} +12 -12
  36. package/dist/{cli-6P6V2EHY.js → cli-AIYQFWXN.js} +25 -25
  37. package/dist/{cli-ERJNDBDH.js → cli-ARAAEWIQ.js} +2 -2
  38. package/dist/cli-AVQYV3N4.js +36 -0
  39. package/dist/{cli-TI2FOFPA.js → cli-B54Z6CXH.js} +16 -16
  40. package/dist/{cli-EEO5ZPAZ.js → cli-B5TC4MEL.js} +5 -5
  41. package/dist/{cli-5Z4D3F6Y.js → cli-BCXGOLU3.js} +3 -3
  42. package/dist/{cli-G2GLW5Z4.js → cli-BHAODVTZ.js} +1 -1
  43. package/dist/{cli-4F24FUW6.js → cli-BPS2JG74.js} +20 -20
  44. package/dist/{cli-W3RG2MRI.js → cli-BVO55SR2.js} +2 -2
  45. package/dist/{cli-R5SNTPND.js → cli-CFH3JZP5.js} +21 -21
  46. package/dist/{cli-Q7QSWNY2.js → cli-CTK2OIK6.js} +20 -20
  47. package/dist/{cli-ATWJCB2G.js → cli-CW5MV4VX.js} +4 -4
  48. package/dist/{cli-TCQJL2GY.js → cli-D5VOSJZ7.js} +1 -1
  49. package/dist/{cli-KIZTASLL.js → cli-DAEPMK7A.js} +5 -5
  50. package/dist/{cli-44CM2AH2.js → cli-DAHR7PKB.js} +1 -1
  51. package/dist/{cli-XW3JLRSA.js → cli-DWDSBTYL.js} +1 -1
  52. package/dist/cli-DYSDPGXW.js +95 -0
  53. package/dist/{cli-QEFYDXMH.js → cli-DZCLRZXJ.js} +1 -1
  54. package/dist/{cli-77T4LJQF.js → cli-EJ47IE45.js} +24 -24
  55. package/dist/{cli-QDBYFITU.js → cli-EK4OSJHA.js} +2 -2
  56. package/dist/{cli-GO64NABP.js → cli-FCJHNXDA.js} +1 -1
  57. package/dist/{cli-ZNQBF4Z3.js → cli-FNESSE3L.js} +1 -1
  58. package/dist/{cli-D3S7NJZ3.js → cli-FTLH4WCE.js} +17 -17
  59. package/dist/{cli-JHLWBRXB.js → cli-FYV77YS2.js} +18 -18
  60. package/dist/cli-GMJX6Q4Q.js +36 -0
  61. package/dist/{cli-7JUNA74L.js → cli-GRBVNGDW.js} +1 -1
  62. package/dist/{cli-XKAIDYIE.js → cli-HAFCFY77.js} +33 -19
  63. package/dist/{cli-OXLOGXT3.js → cli-HCJLYI24.js} +3 -3
  64. package/dist/{cli-XOYUTNER.js → cli-HCXS5EXU.js} +25 -25
  65. package/dist/cli-HEUNNHDH.js +36 -0
  66. package/dist/{cli-G3TU6CP6.js → cli-HNUTIWDZ.js} +19 -19
  67. package/dist/{cli-JXQLHJO2.js → cli-HXT25ETJ.js} +244 -243
  68. package/dist/{cli-5EH4WTH4.js → cli-IGEL7UJQ.js} +5 -5
  69. package/dist/{cli-TLSTSZAC.js → cli-IO32YA5N.js} +26 -26
  70. package/dist/cli-IPTGZDBB.js +36 -0
  71. package/dist/{cli-OBLEROSC.js → cli-J25TYFKB.js} +19 -19
  72. package/dist/{cli-5ATO27Z4.js → cli-J7XYMEMX.js} +20 -20
  73. package/dist/{cli-X3TSTTYI.js → cli-JC5OJRID.js} +2 -2
  74. package/dist/{cli-25SJZI7N.js → cli-JD563OF4.js} +126 -27
  75. package/dist/{cli-VXLHOZSO.js → cli-JRJF2WHU.js} +20 -20
  76. package/dist/{cli-UQC46YSV.js → cli-JTFLIMIG.js} +3 -3
  77. package/dist/{cli-K4HSQWXC.js → cli-K2BSJ2PK.js} +2 -2
  78. package/dist/{cli-OM32UURE.js → cli-K4QTYMN2.js} +25 -25
  79. package/dist/{cli-BJFYGVJV.js → cli-KFJDD4C4.js} +20 -20
  80. package/dist/{cli-WW54THXN.js → cli-KVQ2JPVD.js} +1 -1
  81. package/dist/{cli-LHMRUJVN.js → cli-L6AHMW2Z.js} +1 -1
  82. package/dist/{cli-IKSLPAZN.js → cli-LCYUBCVY.js} +4 -4
  83. package/dist/{cli-HGCOEL5T.js → cli-LEWSCDH5.js} +4 -4
  84. package/dist/{cli-XJ7JESC2.js → cli-LI6G7GND.js} +27 -27
  85. package/dist/{cli-OMTHTWYJ.js → cli-LU2GCWIU.js} +21 -21
  86. package/dist/{cli-UEQMK4WX.js → cli-M3Z2KOEB.js} +1 -1
  87. package/dist/{cli-226ZJ72R.js → cli-M6E3E3I2.js} +170 -3
  88. package/dist/{cli-NKKCDO6K.js → cli-MCRPA4Z6.js} +20 -20
  89. package/dist/{cli-BQ36DV5C.js → cli-MI2DEDMA.js} +3 -3
  90. package/dist/{cli-6O7YCK2M.js → cli-MITZ6SE7.js} +3 -3
  91. package/dist/{cli-LPFSJ625.js → cli-MTIYD3BX.js} +26 -26
  92. package/dist/{cli-5M6KDNVX.js → cli-MTZUJGBK.js} +2 -2
  93. package/dist/{cli-GSOV26O5.js → cli-NCLMUXLC.js} +14 -14
  94. package/dist/{cli-X52TXCNF.js → cli-NLS3DKWH.js} +26 -26
  95. package/dist/{cli-AH6AMAIB.js → cli-NMDGS7IE.js} +1 -1
  96. package/dist/cli-O3DJO2CS.js +30 -0
  97. package/dist/{cli-BC67QHD5.js → cli-O47D5BFN.js} +2 -2
  98. package/dist/{cli-MDVC5ZNM.js → cli-OBRZ36VP.js} +14 -14
  99. package/dist/{cli-UVIURDZC.js → cli-OMG4E53H.js} +20 -20
  100. package/dist/{cli-C32Q5E5I.js → cli-P6V3NSU4.js} +1 -1
  101. package/dist/{cli-RMD5WSUQ.js → cli-PAMQMTHK.js} +21 -21
  102. package/dist/{cli-WNBP3LOD.js → cli-PKTHOCT3.js} +26 -26
  103. package/dist/{cli-S3NHXAJM.js → cli-QK7QAP5H.js} +18 -18
  104. package/dist/cli-QQ432JEN.js +36 -0
  105. package/dist/{cli-YYXAGJQR.js → cli-QVNDPTBU.js} +20 -20
  106. package/dist/{cli-KJA6GLZI.js → cli-R2DFD6ZZ.js} +15 -15
  107. package/dist/{cli-6BLVI2JM.js → cli-RMVJMOWU.js} +111 -7
  108. package/dist/{cli-TEBV2OIW.js → cli-RQISHMJF.js} +83 -21
  109. package/dist/{cli-X64BNBQH.js → cli-RVZH462G.js} +585 -8
  110. package/dist/{cli-6AMK3DYS.js → cli-SEEOQVUL.js} +12 -12
  111. package/dist/{cli-QTCTWYCM.js → cli-SO354HPI.js} +3 -3
  112. package/dist/{cli-RHL4B4H7.js → cli-T76HDH7F.js} +88 -4
  113. package/dist/{cli-ZJW6HQ6N.js → cli-TIS7DWRR.js} +7 -7
  114. package/dist/{cli-6JWDFCUV.js → cli-TY3B6XS7.js} +21 -21
  115. package/dist/{cli-4FJL3KQZ.js → cli-UKEZJFIT.js} +2 -2
  116. package/dist/cli-VQAMW4RF.js +95 -0
  117. package/dist/{cli-ATHATKI5.js → cli-W4LMRVZT.js} +78 -47
  118. package/dist/cli-W7I5KGIB.js +84 -0
  119. package/dist/{cli-B3EFE7ZF.js → cli-WXGJFA4F.js} +1 -1
  120. package/dist/{cli-PNS4KWWC.js → cli-XCG33I77.js} +24 -24
  121. package/dist/{cli-DBMEH4Y5.js → cli-YHLSG5HB.js} +26 -26
  122. package/dist/cli-YNH5DTHY.js +36 -0
  123. package/dist/cli-YPMJWPDA.js +69 -0
  124. package/dist/{cli-PXQYY6KM.js → cli-YSXIR7EM.js} +0 -0
  125. package/dist/cli-ZPFWO4VW.js +85 -0
  126. package/dist/cli.js +53 -53
  127. package/dist/client.js +1918 -283
  128. package/dist/core/assessment-moves.d.ts +32 -0
  129. package/dist/core/assessment-reports.d.ts +38 -0
  130. package/dist/core/assessment-settings.d.ts +15 -0
  131. package/dist/core/benchmark-samples.d.ts +28 -0
  132. package/dist/core/session-host.d.ts +4 -0
  133. package/dist/core/session-roster.d.ts +6 -0
  134. package/dist/core/session-timers.d.ts +40 -0
  135. package/dist/core/session.d.ts +14 -1
  136. package/dist/core/tick-timer.d.ts +18 -0
  137. package/dist/dev/console/assets/{index-Ch6HHb2T.js → index-zd--5H1f.js} +26 -26
  138. package/dist/dev/console/index.html +1 -1
  139. package/dist/dev/shell.d.ts +8 -0
  140. package/dist/dev/view/commands.d.ts +3 -1
  141. package/dist/docs/api/index.md +1 -1
  142. package/dist/docs/api/sdk-commands.md +29 -0
  143. package/dist/docs/api/sdk-e2e.md +30 -0
  144. package/dist/docs/api/sdk-projection.md +5 -0
  145. package/dist/docs/api/sdk-tools-client.md +30 -0
  146. package/dist/docs/api/sdk-ui.md +7 -0
  147. package/dist/docs/api/sdk.md +834 -19
  148. package/dist/docs/changelog.md +28 -0
  149. package/dist/docs/cli-error-codes.md +5 -1
  150. package/dist/docs/cli-reference.md +76 -2
  151. package/dist/docs/concepts/index.md +2 -0
  152. package/dist/docs/concepts/terminology.md +12 -0
  153. package/dist/docs/guides/assessments.md +248 -0
  154. package/dist/docs/guides/benchmarks.md +241 -0
  155. package/dist/docs/guides/engine.md +8 -0
  156. package/dist/docs/guides/index.md +2 -0
  157. package/dist/docs/guides/presentation.md +11 -9
  158. package/dist/docs/guides/session-hooks.md +24 -22
  159. package/dist/docs/guides/tick-controller.md +22 -1
  160. package/dist/docs/guides/ui.md +24 -0
  161. package/dist/docs/guides/upgrading.md +21 -0
  162. package/dist/docs/page-index.md +16 -12
  163. package/dist/docs/recipes/create-assessment.md +124 -0
  164. package/dist/docs/recipes/create-benchmark.md +115 -0
  165. package/dist/docs/recipes/index.md +2 -0
  166. package/dist/execution/context-composition.d.ts +39 -4
  167. package/dist/execution/engine-state.d.ts +13 -0
  168. package/dist/execution/executor.d.ts +16 -0
  169. package/dist/execution/logic-result.d.ts +13 -2
  170. package/dist/help-examples.d.ts +12 -0
  171. package/dist/host/adapter.d.ts +24 -1
  172. package/dist/host/protocol.d.ts +115 -1
  173. package/dist/host.js +29 -1
  174. package/dist/playwright.js +1912 -277
  175. package/dist/runtime/index.d.ts +3 -1
  176. package/dist/runtime/manifest-version.d.ts +1 -1
  177. package/dist/runtime.js +298 -16
  178. package/dist/schema.json +189 -0
  179. package/dist/templating/resource-metadata.d.ts +1 -1
  180. package/dist/utils/error-codes.d.ts +9 -1
  181. package/dist/validation/assessment-validation.d.ts +34 -0
  182. package/dist/validation/benchmark-validation.d.ts +20 -0
  183. package/dist/validation/schema-validation.d.ts +4 -0
  184. package/package.json +3 -3
  185. package/dist/cli-27Z5T52R.js +0 -30
  186. package/dist/cli-3VLBFWHN.js +0 -36
  187. package/dist/cli-BINVO5R7.js +0 -36
  188. package/dist/cli-HLI5UEKX.js +0 -36
  189. package/dist/cli-OF36EA62.js +0 -36
  190. package/dist/cli-OVIJRBFI.js +0 -36
  191. package/dist/cli-UIYKPSIY.js +0 -36
  192. package/dist/cli-WZNIW6ZO.js +0 -16
@@ -2,22 +2,23 @@
2
2
  import {
3
3
  absolutiseTsTypes,
4
4
  relativiseTsTypes
5
- } from "./cli-UEQMK4WX.js";
5
+ } from "./cli-M3Z2KOEB.js";
6
6
  import {
7
7
  SCENARIO_FILES,
8
8
  resolveCapabilityScope
9
- } from "./cli-JXQLHJO2.js";
9
+ } from "./cli-HXT25ETJ.js";
10
10
  import {
11
11
  dereference,
12
12
  isLocalRef,
13
+ resolveBenchmarkLevel,
13
14
  resolveLocalRef
14
- } from "./cli-X64BNBQH.js";
15
+ } from "./cli-RVZH462G.js";
15
16
  import {
16
17
  logger
17
- } from "./cli-TCQJL2GY.js";
18
+ } from "./cli-D5VOSJZ7.js";
18
19
  import {
19
20
  CliError
20
- } from "./cli-5VZBFMCK.js";
21
+ } from "./cli-5PIFO3EN.js";
21
22
 
22
23
  // cli/generation/endpoint-types.ts
23
24
  import { writeFile as writeFile3 } from "fs/promises";
@@ -924,7 +925,94 @@ ${scenarioScoped ? "" : contextTS}${teamContextTS}${writesTS}${teamWritesTS}${se
924
925
 
925
926
  // cli/generation/engine-types.ts
926
927
  import { join as join3 } from "path";
927
- async function generateEngineTypes(engine, capabilityMap, settingsMap, workingDir) {
928
+
929
+ // cli/generation/assessment-types.ts
930
+ var RESULT = "{ score: number; feedback?: string; final?: boolean }";
931
+ function escapeDoc(text) {
932
+ return text.replace(/\*\//g, "*\\/");
933
+ }
934
+ function assessmentTypesTrailer(declared, assessments) {
935
+ if (!declared || declared.length === 0) return "";
936
+ const byId = new Map(assessments.map((a) => [a.definition.identifier, a]));
937
+ const members = declared.flatMap((id) => {
938
+ const assessment = byId.get(id);
939
+ if (!assessment) return [];
940
+ const { description, level, min, max } = assessment.definition;
941
+ const lead = description ? escapeDoc(description).trim() : "";
942
+ const doc = `${lead === "" ? "" : `${lead}${/[.!?]$/.test(lead) ? "" : "."} `}Scored ${level === "team" ? "once per team" : "per participant id"}, from ${min} to ${max}.`;
943
+ const type = level === "team" ? RESULT : `Record<string, ${RESULT}>`;
944
+ return [` /** ${doc} */
945
+ ${id}: ${type};`];
946
+ });
947
+ if (members.length === 0) return "";
948
+ return `/** This team's assessment results, as \`Run\` receives and writes them. */
949
+ export interface Assessments {
950
+ ${members.join("\n")}
951
+ }
952
+ `;
953
+ }
954
+
955
+ // cli/generation/benchmark-types.ts
956
+ function recordType(benchmark) {
957
+ const { fields, tags } = benchmark.definition;
958
+ const lines = [];
959
+ for (const [name, field] of Object.entries(fields)) {
960
+ if (field.description)
961
+ lines.push(` /** ${field.description.replace(/\*\//g, "*\\/")} */`);
962
+ const type = "type" in field ? "number" : field.enum.map((option) => `'${option}'`).join(" | ");
963
+ lines.push(` ${name}?: ${type};`);
964
+ }
965
+ const tagNames = tags ?? [];
966
+ if (tagNames.length > 0) {
967
+ lines.push(" /** The values this record is grouped by. */");
968
+ lines.push(` tags?: { ${tagNames.map((tag) => `${tag}?: string`).join("; ")} };`);
969
+ }
970
+ lines.push(" /** `true` withdraws this record from the pool. */");
971
+ lines.push(" excluded?: boolean;");
972
+ return `{
973
+ ${lines.join("\n")}
974
+ }`;
975
+ }
976
+ function recordsInterface(name, doc, benchmarks) {
977
+ if (benchmarks.length === 0) {
978
+ return `/** ${doc} None are declared. */
979
+ export type ${name} = Record<string, never>;
980
+ `;
981
+ }
982
+ const members = benchmarks.map((benchmark) => ` ${benchmark.definition.identifier}: ${recordType(benchmark)};`).join("\n");
983
+ return `/** ${doc} */
984
+ export interface ${name} {
985
+ ${members}
986
+ }
987
+ `;
988
+ }
989
+ function benchmarkTypesTrailer(declared, benchmarks) {
990
+ if (!declared || declared.length === 0) return "";
991
+ const byId = new Map(benchmarks.map((b) => [b.definition.identifier, b]));
992
+ const engineBenchmarks = declared.flatMap((id) => {
993
+ const benchmark = byId.get(id);
994
+ return benchmark ? [benchmark] : [];
995
+ });
996
+ const team = engineBenchmarks.filter((b) => resolveBenchmarkLevel(b.definition) === "team");
997
+ const session = engineBenchmarks.filter(
998
+ (b) => resolveBenchmarkLevel(b.definition) === "session"
999
+ );
1000
+ return [
1001
+ recordsInterface(
1002
+ "Benchmarks",
1003
+ "Each team's benchmark records, as `Run` receives and writes them.",
1004
+ team
1005
+ ),
1006
+ recordsInterface(
1007
+ "SessionBenchmarks",
1008
+ "The session's own benchmark records, under an aggregate result's `shared`.",
1009
+ session
1010
+ )
1011
+ ].join("\n") + "\n";
1012
+ }
1013
+
1014
+ // cli/generation/engine-types.ts
1015
+ async function generateEngineTypes(engine, capabilityMap, settingsMap, workingDir, benchmarks = [], assessments = []) {
928
1016
  logger.debug(`Generating types for ${engine.definition.identifier}...`);
929
1017
  await generateCapabilityScopedTypes({
930
1018
  capabilityMap,
@@ -943,11 +1031,20 @@ async function generateEngineTypes(engine, capabilityMap, settingsMap, workingDi
943
1031
  sourceType: "SignatureCallbacks",
944
1032
  uses: engine.definition.uses ?? []
945
1033
  },
1034
+ trailer: joinTrailers([
1035
+ benchmarkTypesTrailer(engine.definition.benchmarks, benchmarks),
1036
+ assessmentTypesTrailer(engine.definition.assessments, assessments)
1037
+ ]),
946
1038
  owner: `Engine "${engine.definition.identifier}"`,
947
1039
  outputPath: join3(workingDir, engine.rootDirectory, "types.ts"),
948
1040
  headerComment: "// This file is auto-generated from the engine's capability definitions.\n// Do not edit this file directly. It will be regenerated on build."
949
1041
  });
950
1042
  }
1043
+ function joinTrailers(parts) {
1044
+ const kept = parts.map((part) => part.trimEnd()).filter((part) => part !== "");
1045
+ return kept.length > 0 ? `${kept.join("\n\n")}
1046
+ ` : void 0;
1047
+ }
951
1048
 
952
1049
  // cli/generation/hook-types.ts
953
1050
  import { appendFile } from "fs/promises";
@@ -1313,7 +1410,14 @@ async function generateAllTypes(config, options) {
1313
1410
  };
1314
1411
  if (config.engine) {
1315
1412
  note(` Generating types for engine ${config.engine.definition.identifier}`);
1316
- await generateEngineTypes(config.engine, maps.capabilityMap, maps.settingsMap, workingDir);
1413
+ await generateEngineTypes(
1414
+ config.engine,
1415
+ maps.capabilityMap,
1416
+ maps.settingsMap,
1417
+ workingDir,
1418
+ config.benchmarks ?? [],
1419
+ config.assessments ?? []
1420
+ );
1317
1421
  }
1318
1422
  if (config.ui) {
1319
1423
  note(` Generating types for UI ${config.ui.definition.identifier}`);
@@ -4,12 +4,12 @@ import {
4
4
  } from "./cli-BWX5E7TQ.js";
5
5
  import {
6
6
  validatePackage
7
- } from "./cli-25SJZI7N.js";
7
+ } from "./cli-JD563OF4.js";
8
8
  import {
9
9
  PackageScenarioError,
10
10
  createPackageScenario,
11
11
  deletePackageScenario
12
- } from "./cli-PXQYY6KM.js";
12
+ } from "./cli-YSXIR7EM.js";
13
13
  import {
14
14
  PENDING_CHANGES_HINT,
15
15
  REINITIALISED_ON_CHANGE,
@@ -20,31 +20,25 @@ import {
20
20
  isQuery,
21
21
  pendingHeadline,
22
22
  rebuildsWalkthrough
23
- } from "./cli-UULZSQBV.js";
23
+ } from "./cli-6KWCIAN2.js";
24
24
  import {
25
25
  newInstanceId,
26
26
  removeLockFile,
27
27
  writeLockFile
28
- } from "./cli-ZNQBF4Z3.js";
28
+ } from "./cli-FNESSE3L.js";
29
29
  import {
30
30
  hmrClientTarget,
31
31
  publicAssetOrigin,
32
32
  publicHmrOrigin,
33
33
  publicHostnames
34
- } from "./cli-G2GLW5Z4.js";
34
+ } from "./cli-BHAODVTZ.js";
35
35
  import {
36
36
  describeScenarioProblems,
37
37
  onlyOverran,
38
38
  partitionProblems,
39
39
  runScenarioGates,
40
40
  withOverrunRetry
41
- } from "./cli-JXQLHJO2.js";
42
- import {
43
- mediaTypeOf,
44
- readBlob,
45
- redirectBlobs,
46
- storeBlob
47
- } from "./cli-QWQMPCL6.js";
41
+ } from "./cli-HXT25ETJ.js";
48
42
  import {
49
43
  collectSettingsOverrideErrors,
50
44
  createAjv,
@@ -53,14 +47,20 @@ import {
53
47
  readSetupNotes,
54
48
  settingsSchemas,
55
49
  withoutLockedDefaults
56
- } from "./cli-X64BNBQH.js";
50
+ } from "./cli-RVZH462G.js";
51
+ import {
52
+ mediaTypeOf,
53
+ readBlob,
54
+ redirectBlobs,
55
+ storeBlob
56
+ } from "./cli-QWQMPCL6.js";
57
57
  import {
58
58
  logger
59
- } from "./cli-TCQJL2GY.js";
59
+ } from "./cli-D5VOSJZ7.js";
60
60
  import {
61
61
  CliError,
62
62
  diagnosticLocation
63
- } from "./cli-5VZBFMCK.js";
63
+ } from "./cli-5PIFO3EN.js";
64
64
 
65
65
  // cli/dev/view/route.ts
66
66
  var PATTERNS = [
@@ -1639,13 +1639,26 @@ var NO_TEAM_ID = {
1639
1639
  renameSelf: "renameSelf renames the caller, whom the host resolves; it takes no teamId"
1640
1640
  };
1641
1641
  var FRAME_QUERIES = {
1642
- game: /* @__PURE__ */ new Set(["callEndpoint", "getPastState", "getAllTeamsParticipants"]),
1643
- "waiting-room": /* @__PURE__ */ new Set(["callEndpoint", "getPastState", "getAllTeamsParticipants"]),
1644
- session: /* @__PURE__ */ new Set(["callEndpoint", "getPastState"]),
1642
+ game: /* @__PURE__ */ new Set([
1643
+ "callEndpoint",
1644
+ "getPastState",
1645
+ "getAllTeamsParticipants",
1646
+ "getBenchmark",
1647
+ "getAssessment"
1648
+ ]),
1649
+ "waiting-room": /* @__PURE__ */ new Set([
1650
+ "callEndpoint",
1651
+ "getPastState",
1652
+ "getAllTeamsParticipants",
1653
+ "getBenchmark",
1654
+ "getAssessment"
1655
+ ]),
1656
+ session: /* @__PURE__ */ new Set(["callEndpoint", "getPastState", "getBenchmark", "getAssessment"]),
1645
1657
  setup: /* @__PURE__ */ new Set(["callEndpoint"]),
1646
1658
  "scenario-editor": /* @__PURE__ */ new Set(["callEndpoint"]),
1647
- presentation: /* @__PURE__ */ new Set(["getPastState"])
1659
+ presentation: /* @__PURE__ */ new Set(["getPastState", "getBenchmark", "getAssessment"])
1648
1660
  };
1661
+ var PLAYER_SURFACES = /* @__PURE__ */ new Set(["game", "waiting-room"]);
1649
1662
  function teamScope(viewer) {
1650
1663
  return viewer.teamIndex === void 0 ? {} : { teamIndex: viewer.teamIndex };
1651
1664
  }
@@ -1794,7 +1807,7 @@ function commandFor(message, surface, viewer) {
1794
1807
  return null;
1795
1808
  }
1796
1809
  }
1797
- function queryFor(message, surface, viewer) {
1810
+ function queryFor(message, surface, viewer, { sessionless = false } = {}) {
1798
1811
  if (!FRAME_QUERIES[surface.kind].has(message.type)) return null;
1799
1812
  switch (message.type) {
1800
1813
  case "callEndpoint":
@@ -1821,6 +1834,28 @@ function queryFor(message, surface, viewer) {
1821
1834
  };
1822
1835
  case "getAllTeamsParticipants":
1823
1836
  return { type: "getAllTeamsParticipants", uiIdentifier: surface.identifier };
1837
+ case "getBenchmark":
1838
+ return {
1839
+ type: "getBenchmark",
1840
+ identifier: String(message.identifier),
1841
+ where: Array.isArray(message.where) ? message.where : []
1842
+ };
1843
+ // The audience is the host's to decide, from the surface and the viewer
1844
+ // it holds the render as, never from anything the page sends.
1845
+ case "getAssessment":
1846
+ if (sessionless) {
1847
+ return { refused: "A presentation shown without a session has no results to read" };
1848
+ }
1849
+ return {
1850
+ type: "getAssessment",
1851
+ identifier: String(message.identifier),
1852
+ ...PLAYER_SURFACES.has(surface.kind) ? {
1853
+ audience: "own",
1854
+ ...actorOf(viewer),
1855
+ ...roleOf(viewer),
1856
+ ...viewer.teamIndex === void 0 ? {} : { teamId: `team-${viewer.teamIndex + 1}` }
1857
+ } : { audience: "all" }
1858
+ };
1824
1859
  default:
1825
1860
  return null;
1826
1861
  }
@@ -2002,6 +2037,8 @@ var DevShell = class {
2002
2037
  socketRuns = /* @__PURE__ */ new WeakMap();
2003
2038
  /** The participant an operator page says it is showing, where it shows one. */
2004
2039
  socketPresence = /* @__PURE__ */ new Map();
2040
+ /** Console pages open, each of which keeps its run awake (§11.4a). */
2041
+ consoleSockets = /* @__PURE__ */ new Set();
2005
2042
  options;
2006
2043
  brands;
2007
2044
  server = null;
@@ -2603,22 +2640,30 @@ Install the package's dependencies to serve its surfaces.
2603
2640
  host: request.headers.host,
2604
2641
  localOrigins: wantsLocalOrigins(location.search)
2605
2642
  });
2606
- void this.sendView(socket).then(() => this.syncPresence(route.run));
2643
+ void this.sendView(socket).then(() => {
2644
+ this.syncPresence(route.run);
2645
+ this.syncOpenSurfaces(route.run);
2646
+ });
2607
2647
  socket.on("message", (raw) => void this.receiveView(socket, raw));
2608
2648
  socket.on("close", () => {
2609
2649
  this.views.delete(socket);
2610
2650
  this.syncPresence(route.run);
2651
+ this.syncOpenSurfaces(route.run);
2611
2652
  });
2612
2653
  });
2613
2654
  this.sockets.on("connection", (socket, request) => {
2614
2655
  const run = runFromUrl(request.url);
2615
2656
  this.socketRuns.set(socket, run);
2657
+ this.consoleSockets.add(socket);
2616
2658
  void this.runFor(run).then((session) => {
2617
2659
  send(socket, { type: "state", state: session.project(), cause: "connected" });
2660
+ this.syncOpenSurfaces(run);
2618
2661
  });
2619
2662
  socket.on("message", (raw) => void this.receive(socket, raw));
2620
2663
  socket.on("close", () => {
2664
+ this.consoleSockets.delete(socket);
2621
2665
  if (this.socketPresence.delete(socket)) this.syncPresence(run);
2666
+ this.syncOpenSurfaces(run);
2622
2667
  });
2623
2668
  });
2624
2669
  }
@@ -2748,6 +2793,23 @@ Install the package's dependencies to serve its surfaces.
2748
2793
  }
2749
2794
  session.syncPresence(present);
2750
2795
  }
2796
+ /**
2797
+ * Tell a run how many pages are open on it, console and viewer alike.
2798
+ * Opening one is activity, and the dev server keeps a run with any open
2799
+ * awake (§11.4a), which the specification leaves to the host.
2800
+ */
2801
+ syncOpenSurfaces(run) {
2802
+ const session = run === "walkthrough" ? this.walkthrough : this.session;
2803
+ if (!session) return;
2804
+ let count = 0;
2805
+ for (const socket of this.consoleSockets) {
2806
+ if ((this.socketRuns.get(socket) ?? "session") === run) count += 1;
2807
+ }
2808
+ for (const view of this.views.values()) {
2809
+ if (view.route.run === run) count += 1;
2810
+ }
2811
+ session.syncOpenSurfaces(count);
2812
+ }
2751
2813
  updateViews(event, run) {
2752
2814
  if (event.type === "round-processing") {
2753
2815
  const teams = this.processing.get(run) ?? /* @__PURE__ */ new Set();