@seriousgaming/sdk-tools 1.11.0 → 1.12.1
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.
- package/dist/agent/guidance.md +4 -0
- package/dist/{cli-F2D4GGUA.js → cli-2BKEIIA3.js} +66 -0
- package/dist/{cli-ZGCG6C22.js → cli-2QGTDHRX.js} +21 -21
- package/dist/{cli-SRXDLMXY.js → cli-2SDG3SZ7.js} +21 -21
- package/dist/{cli-DH35TZ2Q.js → cli-2VXP34R5.js} +2 -2
- package/dist/{cli-P3NUTOPK.js → cli-2W4B6PD5.js} +1 -1
- package/dist/{cli-WJVPSVF2.js → cli-2X7DKSXN.js} +24 -24
- package/dist/{cli-ATAJSIXH.js → cli-2ZP4N7HK.js} +19 -19
- package/dist/{cli-5O7XENQY.js → cli-3GJYZH4C.js} +5 -5
- package/dist/{cli-H6PP2MZT.js → cli-3GO3M2MX.js} +17 -13
- package/dist/{cli-HMDYG6PS.js → cli-3LDLUNME.js} +17 -17
- package/dist/{cli-BZOKZ7LP.js → cli-3WY6L2WP.js} +27 -27
- package/dist/{cli-REAM7LSC.js → cli-44MBABRD.js} +25 -25
- package/dist/{cli-5TTJWM2R.js → cli-4IO7MKLR.js} +20 -20
- package/dist/{cli-HNDFANQG.js → cli-4U2PY7W3.js} +1 -1
- package/dist/{cli-WQ7JBZNW.js → cli-4WI4LTBI.js} +2 -2
- package/dist/{cli-OTBCA54D.js → cli-55EIGGZK.js} +1 -1
- package/dist/{cli-FYPW25VD.js → cli-5AQV6FTL.js} +18 -18
- package/dist/{cli-RKPQLB7J.js → cli-5CW7BEU7.js} +3 -3
- package/dist/{cli-27TQVLVF.js → cli-5JUVHNZF.js} +12 -12
- package/dist/{cli-F3YJKP6D.js → cli-5KERL6HV.js} +9 -4
- package/dist/{cli-MSNSXVGF.js → cli-5KSA24NQ.js} +24 -24
- package/dist/{cli-5VZBFMCK.js → cli-5PIFO3EN.js} +8 -0
- package/dist/{cli-FT3X3D4P.js → cli-5QN2Z43X.js} +20 -20
- package/dist/cli-5XSPAA5X.js +69 -0
- package/dist/{cli-B2QAJ5RQ.js → cli-62KAYGXO.js} +20 -20
- package/dist/{cli-QPV3TYOM.js → cli-6IMV5ZZU.js} +26 -26
- package/dist/{cli-UULZSQBV.js → cli-6KWCIAN2.js} +764 -66
- package/dist/{cli-DQE7ITIR.js → cli-6NWETIX5.js} +20 -20
- package/dist/{cli-UVIURDZC.js → cli-7224T6HG.js} +20 -20
- package/dist/{cli-L7F4XKCB.js → cli-774W3MN5.js} +26 -26
- package/dist/cli-7BUD3VAD.js +16 -0
- package/dist/{cli-XNOAO6DY.js → cli-7KEP57S7.js} +12 -12
- package/dist/{cli-5UKWX3IU.js → cli-7OYFJMA6.js} +18 -18
- package/dist/{cli-WNHMJM3Z.js → cli-7ZNEDQ3G.js} +20 -20
- package/dist/{cli-5RRPUL6V.js → cli-AFK6OUID.js} +12 -12
- package/dist/{cli-6P6V2EHY.js → cli-AIYQFWXN.js} +25 -25
- package/dist/{cli-ERJNDBDH.js → cli-ARAAEWIQ.js} +2 -2
- package/dist/cli-AVQYV3N4.js +36 -0
- package/dist/{cli-TI2FOFPA.js → cli-B54Z6CXH.js} +16 -16
- package/dist/{cli-EEO5ZPAZ.js → cli-B5TC4MEL.js} +5 -5
- package/dist/{cli-5Z4D3F6Y.js → cli-BCXGOLU3.js} +3 -3
- package/dist/{cli-G2GLW5Z4.js → cli-BHAODVTZ.js} +1 -1
- package/dist/{cli-4F24FUW6.js → cli-BPS2JG74.js} +20 -20
- package/dist/{cli-W3RG2MRI.js → cli-BVO55SR2.js} +2 -2
- package/dist/{cli-R5SNTPND.js → cli-CFH3JZP5.js} +21 -21
- package/dist/{cli-Q7QSWNY2.js → cli-CTK2OIK6.js} +20 -20
- package/dist/{cli-ATWJCB2G.js → cli-CW5MV4VX.js} +4 -4
- package/dist/{cli-TCQJL2GY.js → cli-D5VOSJZ7.js} +1 -1
- package/dist/{cli-KIZTASLL.js → cli-DAEPMK7A.js} +5 -5
- package/dist/{cli-44CM2AH2.js → cli-DAHR7PKB.js} +1 -1
- package/dist/{cli-XW3JLRSA.js → cli-DWDSBTYL.js} +1 -1
- package/dist/cli-DYSDPGXW.js +95 -0
- package/dist/{cli-QEFYDXMH.js → cli-DZCLRZXJ.js} +1 -1
- package/dist/{cli-TEBV2OIW.js → cli-EG2VP7IV.js} +116 -27
- package/dist/{cli-77T4LJQF.js → cli-EJ47IE45.js} +24 -24
- package/dist/{cli-QDBYFITU.js → cli-EK4OSJHA.js} +2 -2
- package/dist/{cli-GO64NABP.js → cli-FCJHNXDA.js} +1 -1
- package/dist/{cli-ZNQBF4Z3.js → cli-FNESSE3L.js} +1 -1
- package/dist/{cli-D3S7NJZ3.js → cli-FTLH4WCE.js} +17 -17
- package/dist/{cli-JHLWBRXB.js → cli-FYV77YS2.js} +18 -18
- package/dist/cli-GMJX6Q4Q.js +36 -0
- package/dist/{cli-7JUNA74L.js → cli-GRBVNGDW.js} +1 -1
- package/dist/{cli-XKAIDYIE.js → cli-HAFCFY77.js} +33 -19
- package/dist/{cli-OXLOGXT3.js → cli-HCJLYI24.js} +3 -3
- package/dist/{cli-XOYUTNER.js → cli-HCXS5EXU.js} +25 -25
- package/dist/cli-HEUNNHDH.js +36 -0
- package/dist/{cli-G3TU6CP6.js → cli-HNUTIWDZ.js} +19 -19
- package/dist/{cli-JXQLHJO2.js → cli-HXT25ETJ.js} +244 -243
- package/dist/{cli-5EH4WTH4.js → cli-IGEL7UJQ.js} +5 -5
- package/dist/{cli-TLSTSZAC.js → cli-IO32YA5N.js} +26 -26
- package/dist/cli-IPTGZDBB.js +36 -0
- package/dist/{cli-OBLEROSC.js → cli-J25TYFKB.js} +19 -19
- package/dist/{cli-5ATO27Z4.js → cli-J7XYMEMX.js} +20 -20
- package/dist/{cli-X3TSTTYI.js → cli-JC5OJRID.js} +2 -2
- package/dist/{cli-25SJZI7N.js → cli-JD563OF4.js} +126 -27
- package/dist/{cli-VXLHOZSO.js → cli-JRJF2WHU.js} +20 -20
- package/dist/{cli-UQC46YSV.js → cli-JTFLIMIG.js} +3 -3
- package/dist/{cli-K4HSQWXC.js → cli-K2BSJ2PK.js} +2 -2
- package/dist/{cli-OM32UURE.js → cli-K4QTYMN2.js} +25 -25
- package/dist/{cli-BJFYGVJV.js → cli-KFJDD4C4.js} +20 -20
- package/dist/{cli-WW54THXN.js → cli-KVQ2JPVD.js} +1 -1
- package/dist/{cli-LHMRUJVN.js → cli-L6AHMW2Z.js} +1 -1
- package/dist/{cli-IKSLPAZN.js → cli-LCYUBCVY.js} +4 -4
- package/dist/{cli-HGCOEL5T.js → cli-LEWSCDH5.js} +4 -4
- package/dist/{cli-XJ7JESC2.js → cli-LI6G7GND.js} +27 -27
- package/dist/{cli-OMTHTWYJ.js → cli-LU2GCWIU.js} +21 -21
- package/dist/{cli-UEQMK4WX.js → cli-M3Z2KOEB.js} +1 -1
- package/dist/{cli-226ZJ72R.js → cli-M6E3E3I2.js} +170 -3
- package/dist/{cli-NKKCDO6K.js → cli-MCRPA4Z6.js} +20 -20
- package/dist/{cli-BQ36DV5C.js → cli-MI2DEDMA.js} +3 -3
- package/dist/{cli-6O7YCK2M.js → cli-MITZ6SE7.js} +3 -3
- package/dist/{cli-LPFSJ625.js → cli-MTIYD3BX.js} +26 -26
- package/dist/{cli-5M6KDNVX.js → cli-MTZUJGBK.js} +2 -2
- package/dist/{cli-GSOV26O5.js → cli-NCLMUXLC.js} +14 -14
- package/dist/{cli-X52TXCNF.js → cli-NLS3DKWH.js} +26 -26
- package/dist/{cli-AH6AMAIB.js → cli-NMDGS7IE.js} +1 -1
- package/dist/cli-O3DJO2CS.js +30 -0
- package/dist/{cli-BC67QHD5.js → cli-O47D5BFN.js} +2 -2
- package/dist/{cli-MDVC5ZNM.js → cli-OBRZ36VP.js} +14 -14
- package/dist/{cli-C32Q5E5I.js → cli-P6V3NSU4.js} +1 -1
- package/dist/{cli-RMD5WSUQ.js → cli-PAMQMTHK.js} +21 -21
- package/dist/{cli-WNBP3LOD.js → cli-PKTHOCT3.js} +26 -26
- package/dist/cli-QQ432JEN.js +36 -0
- package/dist/{cli-YYXAGJQR.js → cli-QVNDPTBU.js} +20 -20
- package/dist/{cli-KJA6GLZI.js → cli-R2DFD6ZZ.js} +15 -15
- package/dist/{cli-6BLVI2JM.js → cli-RMVJMOWU.js} +111 -7
- package/dist/{cli-X64BNBQH.js → cli-RVZH462G.js} +585 -8
- package/dist/{cli-6AMK3DYS.js → cli-SEEOQVUL.js} +12 -12
- package/dist/{cli-QTCTWYCM.js → cli-SO354HPI.js} +3 -3
- package/dist/{cli-RHL4B4H7.js → cli-T76HDH7F.js} +88 -4
- package/dist/{cli-ZJW6HQ6N.js → cli-TIS7DWRR.js} +7 -7
- package/dist/{cli-6JWDFCUV.js → cli-TY3B6XS7.js} +21 -21
- package/dist/{cli-4FJL3KQZ.js → cli-UKEZJFIT.js} +2 -2
- package/dist/cli-VQAMW4RF.js +95 -0
- package/dist/{cli-ATHATKI5.js → cli-W4LMRVZT.js} +78 -47
- package/dist/cli-W7I5KGIB.js +84 -0
- package/dist/{cli-S3NHXAJM.js → cli-WCFZNEK2.js} +18 -18
- package/dist/{cli-B3EFE7ZF.js → cli-WXGJFA4F.js} +1 -1
- package/dist/{cli-PNS4KWWC.js → cli-XCG33I77.js} +24 -24
- package/dist/{cli-DBMEH4Y5.js → cli-YHLSG5HB.js} +26 -26
- package/dist/cli-YNH5DTHY.js +36 -0
- package/dist/cli-YPMJWPDA.js +69 -0
- package/dist/{cli-PXQYY6KM.js → cli-YSXIR7EM.js} +0 -0
- package/dist/cli-ZPFWO4VW.js +85 -0
- package/dist/cli.js +53 -53
- package/dist/client.js +1951 -289
- package/dist/core/assessment-moves.d.ts +32 -0
- package/dist/core/assessment-reports.d.ts +38 -0
- package/dist/core/assessment-settings.d.ts +15 -0
- package/dist/core/benchmark-samples.d.ts +28 -0
- package/dist/core/session-host.d.ts +4 -0
- package/dist/core/session-roster.d.ts +6 -0
- package/dist/core/session-timers.d.ts +40 -0
- package/dist/core/session.d.ts +14 -1
- package/dist/core/tick-timer.d.ts +18 -0
- package/dist/dev/console/assets/{index-Ch6HHb2T.js → index-zd--5H1f.js} +26 -26
- package/dist/dev/console/index.html +1 -1
- package/dist/dev/shell.d.ts +21 -0
- package/dist/dev/view/commands.d.ts +3 -1
- package/dist/docs/api/index.md +1 -1
- package/dist/docs/api/sdk-commands.md +29 -0
- package/dist/docs/api/sdk-e2e.md +30 -0
- package/dist/docs/api/sdk-projection.md +5 -0
- package/dist/docs/api/sdk-tools-client.md +30 -0
- package/dist/docs/api/sdk-ui.md +7 -0
- package/dist/docs/api/sdk.md +834 -19
- package/dist/docs/changelog.md +34 -0
- package/dist/docs/cli-error-codes.md +5 -1
- package/dist/docs/cli-reference.md +76 -2
- package/dist/docs/concepts/index.md +2 -0
- package/dist/docs/concepts/terminology.md +12 -0
- package/dist/docs/guides/assessments.md +248 -0
- package/dist/docs/guides/benchmarks.md +241 -0
- package/dist/docs/guides/engine.md +8 -0
- package/dist/docs/guides/index.md +2 -0
- package/dist/docs/guides/presentation.md +11 -9
- package/dist/docs/guides/session-hooks.md +24 -22
- package/dist/docs/guides/tick-controller.md +22 -1
- package/dist/docs/guides/ui.md +24 -0
- package/dist/docs/guides/upgrading.md +21 -0
- package/dist/docs/page-index.md +16 -12
- package/dist/docs/recipes/create-assessment.md +124 -0
- package/dist/docs/recipes/create-benchmark.md +115 -0
- package/dist/docs/recipes/index.md +2 -0
- package/dist/execution/context-composition.d.ts +39 -4
- package/dist/execution/engine-state.d.ts +13 -0
- package/dist/execution/executor.d.ts +16 -0
- package/dist/execution/logic-result.d.ts +13 -2
- package/dist/help-examples.d.ts +12 -0
- package/dist/host/adapter.d.ts +24 -1
- package/dist/host/protocol.d.ts +115 -1
- package/dist/host.js +29 -1
- package/dist/playwright.js +1945 -283
- package/dist/runtime/index.d.ts +3 -1
- package/dist/runtime/manifest-version.d.ts +1 -1
- package/dist/runtime.js +298 -16
- package/dist/schema.json +189 -0
- package/dist/templating/resource-metadata.d.ts +1 -1
- package/dist/utils/error-codes.d.ts +9 -1
- package/dist/validation/assessment-validation.d.ts +34 -0
- package/dist/validation/benchmark-validation.d.ts +20 -0
- package/dist/validation/schema-validation.d.ts +4 -0
- package/package.json +3 -3
- package/dist/cli-27Z5T52R.js +0 -30
- package/dist/cli-3VLBFWHN.js +0 -36
- package/dist/cli-BINVO5R7.js +0 -36
- package/dist/cli-HLI5UEKX.js +0 -36
- package/dist/cli-OF36EA62.js +0 -36
- package/dist/cli-OVIJRBFI.js +0 -36
- package/dist/cli-UIYKPSIY.js +0 -36
- package/dist/cli-WZNIW6ZO.js +0 -16
|
@@ -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 {};
|
package/dist/core/session.d.ts
CHANGED
|
@@ -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
|
|
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
|
}
|