@seriousgaming/sdk-tools 1.10.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 (219) hide show
  1. package/dist/agent/guidance.md +35 -23
  2. package/dist/{cli-F2D4GGUA.js → cli-2BKEIIA3.js} +66 -0
  3. package/dist/{cli-NQSL2CIH.js → cli-2QGTDHRX.js} +21 -21
  4. package/dist/{cli-33MZSPPK.js → cli-2SDG3SZ7.js} +21 -21
  5. package/dist/{cli-CLO7HKEQ.js → cli-2VXP34R5.js} +5 -3
  6. package/dist/{cli-P3NUTOPK.js → cli-2W4B6PD5.js} +1 -1
  7. package/dist/{cli-SOO6SEIS.js → cli-2X7DKSXN.js} +28 -25
  8. package/dist/{cli-LNEZ6KDW.js → cli-2ZP4N7HK.js} +19 -19
  9. package/dist/{cli-5O7XENQY.js → cli-3GJYZH4C.js} +5 -5
  10. package/dist/{cli-NAZTYKZT.js → cli-3GO3M2MX.js} +30 -14
  11. package/dist/{cli-YZJBFKRI.js → cli-3LDLUNME.js} +17 -17
  12. package/dist/{cli-J42N4PJG.js → cli-3WY6L2WP.js} +31 -29
  13. package/dist/{cli-WG7MAOCS.js → cli-44MBABRD.js} +25 -25
  14. package/dist/{cli-MGZYQDCH.js → cli-4IO7MKLR.js} +20 -20
  15. package/dist/{cli-HNDFANQG.js → cli-4U2PY7W3.js} +1 -1
  16. package/dist/{cli-4JNF3O5N.js → cli-4WI4LTBI.js} +2 -2
  17. package/dist/{cli-OTBCA54D.js → cli-55EIGGZK.js} +1 -1
  18. package/dist/{cli-5TKPT3CY.js → cli-5AQV6FTL.js} +18 -18
  19. package/dist/{cli-KNXY43YV.js → cli-5CW7BEU7.js} +3 -3
  20. package/dist/{cli-5V4N4BR4.js → cli-5JUVHNZF.js} +12 -12
  21. package/dist/{cli-F3YJKP6D.js → cli-5KERL6HV.js} +9 -4
  22. package/dist/{cli-HN442ZVK.js → cli-5KSA24NQ.js} +24 -24
  23. package/dist/{cli-5VZBFMCK.js → cli-5PIFO3EN.js} +8 -0
  24. package/dist/{cli-IQBY7Z7Q.js → cli-5QN2Z43X.js} +20 -20
  25. package/dist/cli-5XSPAA5X.js +69 -0
  26. package/dist/{cli-QW7VXL2V.js → cli-62KAYGXO.js} +20 -20
  27. package/dist/{cli-TDLIPYKT.js → cli-6IMV5ZZU.js} +26 -26
  28. package/dist/{cli-UULZSQBV.js → cli-6KWCIAN2.js} +764 -66
  29. package/dist/{cli-2ANX6E3A.js → cli-6NWETIX5.js} +20 -20
  30. package/dist/{cli-EXUPHPDJ.js → cli-774W3MN5.js} +26 -26
  31. package/dist/cli-7BUD3VAD.js +16 -0
  32. package/dist/{cli-7NUFHMGE.js → cli-7KEP57S7.js} +12 -12
  33. package/dist/{cli-6CYAOUYT.js → cli-7OYFJMA6.js} +18 -18
  34. package/dist/{cli-ILHHJR2S.js → cli-7ZNEDQ3G.js} +20 -20
  35. package/dist/{cli-5RRPUL6V.js → cli-AFK6OUID.js} +12 -12
  36. package/dist/{cli-A3AJQZEN.js → cli-AIYQFWXN.js} +25 -25
  37. package/dist/{cli-B5DWKRZ4.js → cli-ARAAEWIQ.js} +2 -2
  38. package/dist/cli-AVQYV3N4.js +36 -0
  39. package/dist/{cli-35GV2F6R.js → cli-B54Z6CXH.js} +16 -16
  40. package/dist/{cli-467VRXGP.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-XR3O2YTV.js → cli-BPS2JG74.js} +20 -20
  44. package/dist/{cli-W3RG2MRI.js → cli-BVO55SR2.js} +2 -2
  45. package/dist/{cli-PYAST3G5.js → cli-CFH3JZP5.js} +21 -21
  46. package/dist/{cli-VZVHS5AP.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-GRSQRFRG.js → cli-DZCLRZXJ.js} +9 -2
  54. package/dist/{cli-RSF5R3HC.js → cli-EJ47IE45.js} +28 -25
  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-MUOLHQNL.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-HHRP6FP6.js → cli-HCXS5EXU.js} +25 -25
  65. package/dist/cli-HEUNNHDH.js +36 -0
  66. package/dist/{cli-36GABN2A.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-JMNPMDXH.js → cli-IO32YA5N.js} +26 -26
  70. package/dist/cli-IPTGZDBB.js +36 -0
  71. package/dist/{cli-L54SXUK6.js → cli-J25TYFKB.js} +19 -19
  72. package/dist/{cli-CQ4ZR3ZQ.js → cli-J7XYMEMX.js} +20 -20
  73. package/dist/{cli-5DWR7RPQ.js → cli-JC5OJRID.js} +2 -2
  74. package/dist/{cli-25SJZI7N.js → cli-JD563OF4.js} +126 -27
  75. package/dist/{cli-JAVMRERQ.js → cli-JRJF2WHU.js} +20 -20
  76. package/dist/{cli-UQC46YSV.js → cli-JTFLIMIG.js} +3 -3
  77. package/dist/{cli-2AH6D32V.js → cli-K2BSJ2PK.js} +2 -2
  78. package/dist/{cli-XB5PI2XT.js → cli-K4QTYMN2.js} +25 -25
  79. package/dist/{cli-5SHG2M7E.js → cli-KFJDD4C4.js} +20 -20
  80. package/dist/{cli-WW54THXN.js → cli-KVQ2JPVD.js} +1 -1
  81. package/dist/{cli-O5WYATAI.js → cli-L6AHMW2Z.js} +4 -2
  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-HNG6PZW2.js → cli-LI6G7GND.js} +27 -27
  85. package/dist/{cli-2AVPNSAX.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-OXU6TTEN.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-VALLLE6Y.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-Z3DITVBE.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-267QJ2DS.js → cli-OMG4E53H.js} +20 -20
  100. package/dist/{cli-C32Q5E5I.js → cli-P6V3NSU4.js} +1 -1
  101. package/dist/{cli-PBSLPO6G.js → cli-PAMQMTHK.js} +21 -21
  102. package/dist/{cli-RUEPTOWG.js → cli-PKTHOCT3.js} +26 -26
  103. package/dist/{cli-PTXOKO2Y.js → cli-QK7QAP5H.js} +18 -18
  104. package/dist/cli-QQ432JEN.js +36 -0
  105. package/dist/{cli-YFLQ7XOO.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-M6AZFIMV.js → cli-RQISHMJF.js} +88 -23
  109. package/dist/{cli-X64BNBQH.js → cli-RVZH462G.js} +585 -8
  110. package/dist/{cli-LLJQI2QP.js → cli-SEEOQVUL.js} +12 -12
  111. package/dist/{cli-QTCTWYCM.js → cli-SO354HPI.js} +3 -3
  112. package/dist/{cli-URCHZDTS.js → cli-T76HDH7F.js} +90 -5
  113. package/dist/{cli-ZJW6HQ6N.js → cli-TIS7DWRR.js} +7 -7
  114. package/dist/{cli-WOFYI7HZ.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-4A7RWFNO.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-IPTHJT3J.js → cli-XCG33I77.js} +28 -25
  121. package/dist/{cli-WLSACMYA.js → cli-YHLSG5HB.js} +30 -28
  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/index.d.ts +1 -1
  128. package/dist/client/test-session.d.ts +44 -6
  129. package/dist/client.js +1934 -286
  130. package/dist/core/assessment-moves.d.ts +32 -0
  131. package/dist/core/assessment-reports.d.ts +38 -0
  132. package/dist/core/assessment-settings.d.ts +15 -0
  133. package/dist/core/benchmark-samples.d.ts +28 -0
  134. package/dist/core/session-host.d.ts +4 -0
  135. package/dist/core/session-roster.d.ts +6 -0
  136. package/dist/core/session-timers.d.ts +40 -0
  137. package/dist/core/session.d.ts +14 -1
  138. package/dist/core/tick-timer.d.ts +18 -0
  139. package/dist/dev/console/assets/{index-Ch6HHb2T.js → index-zd--5H1f.js} +26 -26
  140. package/dist/dev/console/index.html +1 -1
  141. package/dist/dev/shell.d.ts +8 -0
  142. package/dist/dev/view/commands.d.ts +3 -1
  143. package/dist/docs/api/index.md +4 -2
  144. package/dist/docs/api/sdk-commands.md +29 -0
  145. package/dist/docs/api/sdk-e2e.md +30 -0
  146. package/dist/docs/api/sdk-projection.md +5 -0
  147. package/dist/docs/api/sdk-tools-client.md +68 -6
  148. package/dist/docs/api/sdk-tools-vite.md +21 -0
  149. package/dist/docs/api/sdk-ui.md +7 -0
  150. package/dist/docs/api/sdk.md +834 -19
  151. package/dist/docs/changelog.md +67 -0
  152. package/dist/docs/cli-error-codes.md +5 -1
  153. package/dist/docs/cli-reference.md +76 -2
  154. package/dist/docs/concepts/index.md +2 -0
  155. package/dist/docs/concepts/terminology.md +12 -0
  156. package/dist/docs/guides/assessments.md +248 -0
  157. package/dist/docs/guides/benchmarks.md +241 -0
  158. package/dist/docs/guides/endpoints.md +1 -1
  159. package/dist/docs/guides/engine-testing.md +49 -14
  160. package/dist/docs/guides/engine.md +10 -2
  161. package/dist/docs/guides/index.md +2 -0
  162. package/dist/docs/guides/presentation.md +11 -9
  163. package/dist/docs/guides/session-hooks.md +24 -22
  164. package/dist/docs/guides/testing.md +3 -8
  165. package/dist/docs/guides/tick-controller.md +22 -1
  166. package/dist/docs/guides/ui.md +24 -0
  167. package/dist/docs/guides/upgrading.md +36 -0
  168. package/dist/docs/page-index.md +18 -13
  169. package/dist/docs/recipes/create-assessment.md +124 -0
  170. package/dist/docs/recipes/create-benchmark.md +115 -0
  171. package/dist/docs/recipes/create-game.md +1 -1
  172. package/dist/docs/recipes/fix-duplicate-packages.md +8 -19
  173. package/dist/docs/recipes/index.md +2 -0
  174. package/dist/execution/context-composition.d.ts +39 -4
  175. package/dist/execution/engine-state.d.ts +13 -0
  176. package/dist/execution/executor.d.ts +16 -0
  177. package/dist/execution/logic-result.d.ts +13 -2
  178. package/dist/help-examples.d.ts +12 -0
  179. package/dist/host/adapter.d.ts +24 -1
  180. package/dist/host/protocol.d.ts +115 -1
  181. package/dist/host.js +29 -1
  182. package/dist/oxlint/logic.json +184 -0
  183. package/dist/playwright.js +1928 -280
  184. package/dist/runtime/index.d.ts +3 -1
  185. package/dist/runtime/manifest-version.d.ts +1 -1
  186. package/dist/runtime.js +298 -16
  187. package/dist/schema.json +189 -0
  188. package/dist/templates/package/README.md.liquid +1 -0
  189. package/dist/templates/package/claude/rules/workflow-create-engine.md +1 -1
  190. package/dist/templates/package/claude/rules/workflow-create-user-interface.md +1 -1
  191. package/dist/templates/package/claude/rules/workflow-test-engine-or-ui.md +1 -1
  192. package/dist/templates/package/claude/rules/workflow-update-sdk-version.md +2 -2
  193. package/dist/templates/package/claude/settings.json.template +1 -0
  194. package/dist/templates/package/oxfmtrc.json.template +8 -1
  195. package/dist/templates/package/oxlintrc.json.template +1 -180
  196. package/dist/templates/package/package.json.liquid +1 -0
  197. package/dist/templates/package/vite.config.ts.liquid +2 -8
  198. package/dist/templates/package/vitest.config.ts.liquid +2 -8
  199. package/dist/templates/starter-game/package.json +2 -1
  200. package/dist/templates/starter-game/testing/engine/game.engine.test.ts +62 -37
  201. package/dist/templates/starter-game/vite.config.ts +2 -8
  202. package/dist/templates/starter-game/vitest.config.ts +4 -3
  203. package/dist/templating/resource-metadata.d.ts +1 -1
  204. package/dist/utils/error-codes.d.ts +9 -1
  205. package/dist/utils/resource-scan.d.ts +5 -0
  206. package/dist/validation/assessment-validation.d.ts +34 -0
  207. package/dist/validation/benchmark-validation.d.ts +20 -0
  208. package/dist/validation/schema-validation.d.ts +4 -0
  209. package/dist/vite/index.d.ts +30 -0
  210. package/dist/vite.js +12 -0
  211. package/package.json +12 -4
  212. package/dist/cli-27Z5T52R.js +0 -30
  213. package/dist/cli-5XE4OMFL.js +0 -36
  214. package/dist/cli-BB6CU4ZC.js +0 -36
  215. package/dist/cli-FGP6YYM7.js +0 -36
  216. package/dist/cli-I3ZAZYWP.js +0 -36
  217. package/dist/cli-RFAPPYXK.js +0 -36
  218. package/dist/cli-WZNIW6ZO.js +0 -16
  219. package/dist/cli-XEEOJGBL.js +0 -36
@@ -0,0 +1,32 @@
1
+ /**
2
+ * A participant's participant-level results follow them between teams
3
+ * (§6.17.2).
4
+ *
5
+ * Results live in each team's state, so a move would otherwise leave a
6
+ * participant's record behind on the team they left: the new team's engine
7
+ * would start them again from nothing, and what had built up over the session
8
+ * would be lost to a move the facilitator made. Team-level results stay with
9
+ * the team, since they belong to it.
10
+ */
11
+ import type { SDKAssessment } from '@seriousgaming/sdk';
12
+ import type { GameContext } from '../execution/types';
13
+ /** The identifiers of the assessments scored per participant. */
14
+ export declare function participantLevelAssessments(assessments: readonly SDKAssessment[]): string[];
15
+ /**
16
+ * Move results recorded for participants on a team they are no longer on to
17
+ * the team they are on now. `prefer` names the one participant whose moving
18
+ * record replaces one their new team already holds, which is the case on a
19
+ * move: the team they just left holds the latest. Any other stray record
20
+ * joins a team that holds none for them, and is dropped where it does, so
21
+ * there is one record per participant afterwards. A participant who has left
22
+ * the session keeps their records where they are.
23
+ *
24
+ * Returns the contexts unchanged (the same array) when nothing moved.
25
+ */
26
+ export declare function settleAssessmentRecords(input: {
27
+ contexts: readonly GameContext[];
28
+ teamIds: readonly string[];
29
+ teamOf: (participantId: string) => string | undefined;
30
+ identifiers: readonly string[];
31
+ prefer?: string;
32
+ }): GameContext[];
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Answering `getAssessment` (§6.17.3): which results a caller may see, and
3
+ * the report built from the session's state.
4
+ *
5
+ * Kept apart from the session so the audience rule, the one part a host gets
6
+ * wrong at a cost to somebody's privacy, is tested on its own.
7
+ */
8
+ import { type AssessmentAudience, type SDKAssessment } from '@seriousgaming/sdk';
9
+ import type { GameContext } from '../execution/types';
10
+ import type { QueryCommand, QueryResult } from './protocol';
11
+ type AssessmentQuery = Extract<QueryCommand, {
12
+ type: 'getAssessment';
13
+ }>;
14
+ /**
15
+ * Whose results a read may see, or null when it may see none.
16
+ *
17
+ * A facilitator surface, the CLI and a test read everyone's. A player surface
18
+ * reads `'own'`: the participant the host resolved it to, or the team an
19
+ * observer watches. A player read that resolved to neither is refused rather
20
+ * than widened, as an unattributed write is (§13.2).
21
+ */
22
+ export declare function assessmentAudience(query: AssessmentQuery): AssessmentAudience | null;
23
+ /** Answer a `getAssessment` from the session as it stands. */
24
+ export declare function answerAssessment(input: {
25
+ query: AssessmentQuery;
26
+ assessments: readonly SDKAssessment[];
27
+ teams: readonly {
28
+ teamId: string;
29
+ context: GameContext | undefined;
30
+ complete: boolean;
31
+ }[];
32
+ participants: readonly {
33
+ id: string;
34
+ teamId: string;
35
+ }[];
36
+ settings: Record<string, unknown>;
37
+ }): QueryResult;
38
+ export {};
@@ -0,0 +1,15 @@
1
+ import { type SDKAssessment, type SDKSettings } from '@seriousgaming/sdk';
2
+ /**
3
+ * The built-in `assessments` settings resource (§6.17): every assessment's
4
+ * band thresholds and passes, with the bundles' values as defaults.
5
+ *
6
+ * Bands are the game's defaults for what a score means, and a client who
7
+ * wants a tougher pass mark should not need a new release. Making them
8
+ * settings puts them through the one resolver every setting goes through
9
+ * (§8.2), so a scenario or a session overrides them as it overrides anything
10
+ * else, and a runtime reads them where it reads every other setting.
11
+ *
12
+ * Present only when an assessment declares bands: a game without any has
13
+ * nothing to override, and its settings stay as they were.
14
+ */
15
+ export declare function assessmentSettingsResource(assessments: readonly SDKAssessment[]): SDKSettings | null;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * How the dev server answers `getBenchmark` (§6.16): from figures the author
3
+ * writes by hand, since a dev server has no other sessions to pool.
4
+ *
5
+ * The sample lives at `benchmarks/<identifier>/sample.json` beside the bundle
6
+ * and is read fresh on every call, so an edit shows on the next read without
7
+ * a restart. It answers every query alike, with `matched` set to the first
8
+ * filter tried.
9
+ */
10
+ import type { BenchmarkFilter, BenchmarkStatistics } from '@seriousgaming/sdk';
11
+ /** Where a benchmark's sample sits, relative to the package. */
12
+ export declare function benchmarkSamplePath(identifier: string): string;
13
+ /** The first problem with a parsed sample, or null when it has the right shape. */
14
+ export declare function benchmarkSampleProblem(sample: unknown): string | null;
15
+ /**
16
+ * Answer one `getBenchmark` from the package's sample.
17
+ *
18
+ * Resolves `null` when the benchmark has no `sample.json`, as a runtime with
19
+ * too few results would. Throws, naming the file, when the sample is not
20
+ * valid JSON or not the right shape, and when the package declares no such
21
+ * benchmark.
22
+ */
23
+ export declare function answerBenchmarkFromSample(options: {
24
+ packagePath: string;
25
+ identifier: string;
26
+ where: BenchmarkFilter[];
27
+ declared: readonly string[] | undefined;
28
+ }): Promise<BenchmarkStatistics | null>;
@@ -97,6 +97,10 @@ export interface SessionHost {
97
97
  enqueue<T>(work: () => Promise<T>): Promise<T>;
98
98
  /** Run one command now, inside whatever job is already running. */
99
99
  apply(command: MutationCommand): Promise<MutationResult>;
100
+ /**
101
+ * Queue a command the host issues on its own behalf, such as an automatic
102
+ * tick. Not activity (§11.4a), so it never keeps a session awake.
103
+ */
100
104
  submit(command: MutationCommand): Promise<MutationResult>;
101
105
  report(message: string, source: string, teamId?: string): void;
102
106
  emit(event: Event): void;
@@ -121,6 +121,12 @@ export declare class SessionRoster {
121
121
  joinSession(name?: string): Promise<undefined>;
122
122
  renameParticipant(participantId: string, name: string): undefined;
123
123
  moveParticipant(participantId: string, toTeamId: string): Promise<undefined>;
124
+ /**
125
+ * Move participant-level assessment results to the team each participant
126
+ * is on now (§6.17.2): after a move, with `prefer` the one who moved, and
127
+ * after an undo, which restores results to the teams that held them then.
128
+ */
129
+ settleAssessments(prefer?: string): void;
124
130
  findParticipantTeam(participantId: string): string | undefined;
125
131
  /**
126
132
  * How many participants a team is seeded with.
@@ -13,6 +13,10 @@
13
13
  import type { TimerState } from '@seriousgaming/sdk';
14
14
  import type { MutationCommand, TeamScope } from './protocol';
15
15
  import type { SessionHost } from './session-host';
16
+ /** How long a session goes unused before it may go dormant (§11.4a). */
17
+ export declare const DORMANT_AFTER_MS: number;
18
+ /** How many automatic ticks it has run unused before it may go dormant (§11.4a). */
19
+ export declare const DORMANT_AFTER_TICKS = 100;
16
20
  type TimerHost = Pick<SessionHost, 'clock' | 'executor' | 'state' | 'mode' | 'teamBounds' | 'inSetup' | 'tickLimit' | 'positionOf' | 'report' | 'submit' | 'enqueue' | 'emitState'>;
17
21
  export declare class SessionTimers {
18
22
  private readonly host;
@@ -20,7 +24,37 @@ export declare class SessionTimers {
20
24
  ticking: boolean;
21
25
  /** Automatic tick timers, keyed by team index, or {@link COHORT} (§11). */
22
26
  private readonly timers;
27
+ /** When the session went dormant (§11.4a), or null while it is not. */
28
+ private dormantAt;
29
+ /** When anything outside the host last used the session (§11.4a). */
30
+ private lastActivityAt;
31
+ /** Automatic ticks since then, every team's together (§11.4a). */
32
+ private unattendedTicks;
33
+ /** Surfaces and console pages open on the session, which keep it awake. */
34
+ private openSurfaces;
23
35
  constructor(host: TimerHost);
36
+ /** Whether automatic ticking is suspended because the session was unattended. */
37
+ get dormant(): boolean;
38
+ /**
39
+ * Something outside the host used the session (§11.4a): restart the
40
+ * clock, and wake the session if it is dormant. Interval-mode timers pick
41
+ * up at once; what is returned re-asks the controller for scheduled-mode
42
+ * ones, for the caller to queue ahead of the activity itself. Null when
43
+ * nothing woke.
44
+ */
45
+ noteActivity(): (() => Promise<void>) | null;
46
+ /**
47
+ * How many surfaces are open on the session. Opening one is activity, and
48
+ * while any is open the session stays awake: the dev server counts an
49
+ * idle open surface as use, which the specification leaves to the host.
50
+ */
51
+ surfacesOpen(count: number): (() => Promise<void>) | null;
52
+ /**
53
+ * Suspend automatic ticking now (§11.4a), whether or not the minimums
54
+ * have passed: the dev server's way to show an author a dormant session
55
+ * without waiting a day.
56
+ */
57
+ suspend(): void;
24
58
  /** Cancel every timer, for a session that is stopping. */
25
59
  stop(): void;
26
60
  /** The timer serving the team at `position`, idle when it has none. */
@@ -80,5 +114,11 @@ export declare class SessionTimers {
80
114
  * timer is re-armed, or stopped when the group can no longer tick.
81
115
  */
82
116
  private onFired;
117
+ /**
118
+ * Go dormant once nothing has used the session for both minimums, and no
119
+ * surface is open (§11.4a). Judged after an automatic tick, since nothing
120
+ * else happens to a session nobody is using.
121
+ */
122
+ private suspendIfUnattended;
83
123
  }
84
124
  export {};
@@ -25,7 +25,7 @@
25
25
  * (`session-rewind`). What stays here is the queue, the dispatch, the
26
26
  * lifecycle and the projection.
27
27
  */
28
- import type { ResolvedPackageManifest, RunKind, SDKFacilitatorGuide, SDKScenario, SignatureCallbacks } from '@seriousgaming/sdk';
28
+ import { type ResolvedPackageManifest, type RunKind, type SDKFacilitatorGuide, type SDKScenario, type SignatureCallbacks } from '@seriousgaming/sdk';
29
29
  import { type EndpointAuditEntry, type MutationResult, type ResolvedSettings, type StateProjection } from '@seriousgaming/sdk/projection';
30
30
  import { type EffectiveGuide } from '../guide/effective-guide';
31
31
  import { type Clock } from './clock';
@@ -165,6 +165,13 @@ export declare class Session {
165
165
  stop(): Promise<void>;
166
166
  /** Submit a state-changing command. Queued, in order, one at a time. */
167
167
  submit(command: MutationCommand): Promise<MutationResult>;
168
+ /**
169
+ * Something outside the host used the session (§11.4a). A dormant session
170
+ * wakes before the activity is handled: the re-evaluation waking needs is
171
+ * queued ahead of it.
172
+ */
173
+ private noteActivity;
174
+ private finishWaking;
168
175
  /**
169
176
  * Queue `work` as one operation: every logic call it makes reads the same
170
177
  * `meta.now`, taken as it starts rather than as it was submitted (§10.2).
@@ -231,6 +238,12 @@ export declare class Session {
231
238
  * is put right by the next call, with nothing to reconcile.
232
239
  */
233
240
  syncPresence(connected: ReadonlySet<string>): void;
241
+ /**
242
+ * How many surfaces and console pages are open on this session, which the
243
+ * host observes as it does presence. Opening one is activity, and while
244
+ * any is open the session does not go dormant (§11.4a).
245
+ */
246
+ syncOpenSurfaces(count: number): void;
234
247
  /** Edits on disk this session has not applied, each list empty when none is. */
235
248
  pendingChanges(): PendingChanges;
236
249
  /** True while the session is in its setup state, still owed a Play (§8.3, §9.0). */
@@ -42,6 +42,8 @@ export declare class TickTimer {
42
42
  private pausedMs;
43
43
  private scheduleStartedAt;
44
44
  private extendedMs;
45
+ /** When the session went dormant (§11.4a), or null while it is not. */
46
+ private dormantAt;
45
47
  /** The answer the current schedule was built from, to tell a re-evaluation that changed nothing. */
46
48
  private answer;
47
49
  constructor(clock: Clock, fire: () => void);
@@ -56,12 +58,26 @@ export declare class TickTimer {
56
58
  */
57
59
  apply(result: TickControllerResult | null, canTick: boolean, reevaluation?: boolean): string | null;
58
60
  pause(): void;
61
+ /**
62
+ * Suspend automatic ticking because the session was left unattended
63
+ * (§11.4a). Held like a pause, but separate from one: waking never ends a
64
+ * facilitator's pause.
65
+ */
66
+ suspend(): void;
67
+ /**
68
+ * Wake from dormancy (§11.4a), resuming as from a pause (§11.4). The
69
+ * dormant time joins `pausedMs`, except where a facilitator's pause
70
+ * already covers it. A timer the facilitator paused stays paused.
71
+ */
72
+ wake(): ResumeOutcome;
59
73
  /**
60
74
  * Resume (§11.4). Interval mode continues from the time that was left;
61
75
  * scheduled mode tells the caller to re-evaluate, because the target may
62
76
  * have passed during the pause and the missed tick is not fired.
63
77
  */
64
78
  resume(): ResumeOutcome;
79
+ /** Pick a held schedule back up, after a pause or dormancy. */
80
+ private continue;
65
81
  /**
66
82
  * Move the scheduled tick by `ms` (§12.5): only this window, clamped at
67
83
  * now, and never bounded by §11.8. Returns why it was refused, or null.
@@ -70,6 +86,8 @@ export declare class TickTimer {
70
86
  /** Stop everything, as when the team is removed or the session stops. */
71
87
  cancel(): void;
72
88
  state(): TimerState;
89
+ /** Keep what is left of this window, and stop the pending tick. */
90
+ private hold;
73
91
  private arm;
74
92
  private cancelPending;
75
93
  }