@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.
- package/dist/agent/guidance.md +35 -23
- package/dist/{cli-F2D4GGUA.js → cli-2BKEIIA3.js} +66 -0
- package/dist/{cli-NQSL2CIH.js → cli-2QGTDHRX.js} +21 -21
- package/dist/{cli-33MZSPPK.js → cli-2SDG3SZ7.js} +21 -21
- package/dist/{cli-CLO7HKEQ.js → cli-2VXP34R5.js} +5 -3
- package/dist/{cli-P3NUTOPK.js → cli-2W4B6PD5.js} +1 -1
- package/dist/{cli-SOO6SEIS.js → cli-2X7DKSXN.js} +28 -25
- package/dist/{cli-LNEZ6KDW.js → cli-2ZP4N7HK.js} +19 -19
- package/dist/{cli-5O7XENQY.js → cli-3GJYZH4C.js} +5 -5
- package/dist/{cli-NAZTYKZT.js → cli-3GO3M2MX.js} +30 -14
- package/dist/{cli-YZJBFKRI.js → cli-3LDLUNME.js} +17 -17
- package/dist/{cli-J42N4PJG.js → cli-3WY6L2WP.js} +31 -29
- package/dist/{cli-WG7MAOCS.js → cli-44MBABRD.js} +25 -25
- package/dist/{cli-MGZYQDCH.js → cli-4IO7MKLR.js} +20 -20
- package/dist/{cli-HNDFANQG.js → cli-4U2PY7W3.js} +1 -1
- package/dist/{cli-4JNF3O5N.js → cli-4WI4LTBI.js} +2 -2
- package/dist/{cli-OTBCA54D.js → cli-55EIGGZK.js} +1 -1
- package/dist/{cli-5TKPT3CY.js → cli-5AQV6FTL.js} +18 -18
- package/dist/{cli-KNXY43YV.js → cli-5CW7BEU7.js} +3 -3
- package/dist/{cli-5V4N4BR4.js → cli-5JUVHNZF.js} +12 -12
- package/dist/{cli-F3YJKP6D.js → cli-5KERL6HV.js} +9 -4
- package/dist/{cli-HN442ZVK.js → cli-5KSA24NQ.js} +24 -24
- package/dist/{cli-5VZBFMCK.js → cli-5PIFO3EN.js} +8 -0
- package/dist/{cli-IQBY7Z7Q.js → cli-5QN2Z43X.js} +20 -20
- package/dist/cli-5XSPAA5X.js +69 -0
- package/dist/{cli-QW7VXL2V.js → cli-62KAYGXO.js} +20 -20
- package/dist/{cli-TDLIPYKT.js → cli-6IMV5ZZU.js} +26 -26
- package/dist/{cli-UULZSQBV.js → cli-6KWCIAN2.js} +764 -66
- package/dist/{cli-2ANX6E3A.js → cli-6NWETIX5.js} +20 -20
- package/dist/{cli-EXUPHPDJ.js → cli-774W3MN5.js} +26 -26
- package/dist/cli-7BUD3VAD.js +16 -0
- package/dist/{cli-7NUFHMGE.js → cli-7KEP57S7.js} +12 -12
- package/dist/{cli-6CYAOUYT.js → cli-7OYFJMA6.js} +18 -18
- package/dist/{cli-ILHHJR2S.js → cli-7ZNEDQ3G.js} +20 -20
- package/dist/{cli-5RRPUL6V.js → cli-AFK6OUID.js} +12 -12
- package/dist/{cli-A3AJQZEN.js → cli-AIYQFWXN.js} +25 -25
- package/dist/{cli-B5DWKRZ4.js → cli-ARAAEWIQ.js} +2 -2
- package/dist/cli-AVQYV3N4.js +36 -0
- package/dist/{cli-35GV2F6R.js → cli-B54Z6CXH.js} +16 -16
- package/dist/{cli-467VRXGP.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-XR3O2YTV.js → cli-BPS2JG74.js} +20 -20
- package/dist/{cli-W3RG2MRI.js → cli-BVO55SR2.js} +2 -2
- package/dist/{cli-PYAST3G5.js → cli-CFH3JZP5.js} +21 -21
- package/dist/{cli-VZVHS5AP.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-GRSQRFRG.js → cli-DZCLRZXJ.js} +9 -2
- package/dist/{cli-RSF5R3HC.js → cli-EJ47IE45.js} +28 -25
- 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-MUOLHQNL.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-HHRP6FP6.js → cli-HCXS5EXU.js} +25 -25
- package/dist/cli-HEUNNHDH.js +36 -0
- package/dist/{cli-36GABN2A.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-JMNPMDXH.js → cli-IO32YA5N.js} +26 -26
- package/dist/cli-IPTGZDBB.js +36 -0
- package/dist/{cli-L54SXUK6.js → cli-J25TYFKB.js} +19 -19
- package/dist/{cli-CQ4ZR3ZQ.js → cli-J7XYMEMX.js} +20 -20
- package/dist/{cli-5DWR7RPQ.js → cli-JC5OJRID.js} +2 -2
- package/dist/{cli-25SJZI7N.js → cli-JD563OF4.js} +126 -27
- package/dist/{cli-JAVMRERQ.js → cli-JRJF2WHU.js} +20 -20
- package/dist/{cli-UQC46YSV.js → cli-JTFLIMIG.js} +3 -3
- package/dist/{cli-2AH6D32V.js → cli-K2BSJ2PK.js} +2 -2
- package/dist/{cli-XB5PI2XT.js → cli-K4QTYMN2.js} +25 -25
- package/dist/{cli-5SHG2M7E.js → cli-KFJDD4C4.js} +20 -20
- package/dist/{cli-WW54THXN.js → cli-KVQ2JPVD.js} +1 -1
- package/dist/{cli-O5WYATAI.js → cli-L6AHMW2Z.js} +4 -2
- package/dist/{cli-IKSLPAZN.js → cli-LCYUBCVY.js} +4 -4
- package/dist/{cli-HGCOEL5T.js → cli-LEWSCDH5.js} +4 -4
- package/dist/{cli-HNG6PZW2.js → cli-LI6G7GND.js} +27 -27
- package/dist/{cli-2AVPNSAX.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-OXU6TTEN.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-VALLLE6Y.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-Z3DITVBE.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-267QJ2DS.js → cli-OMG4E53H.js} +20 -20
- package/dist/{cli-C32Q5E5I.js → cli-P6V3NSU4.js} +1 -1
- package/dist/{cli-PBSLPO6G.js → cli-PAMQMTHK.js} +21 -21
- package/dist/{cli-RUEPTOWG.js → cli-PKTHOCT3.js} +26 -26
- package/dist/{cli-PTXOKO2Y.js → cli-QK7QAP5H.js} +18 -18
- package/dist/cli-QQ432JEN.js +36 -0
- package/dist/{cli-YFLQ7XOO.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-M6AZFIMV.js → cli-RQISHMJF.js} +88 -23
- package/dist/{cli-X64BNBQH.js → cli-RVZH462G.js} +585 -8
- package/dist/{cli-LLJQI2QP.js → cli-SEEOQVUL.js} +12 -12
- package/dist/{cli-QTCTWYCM.js → cli-SO354HPI.js} +3 -3
- package/dist/{cli-URCHZDTS.js → cli-T76HDH7F.js} +90 -5
- package/dist/{cli-ZJW6HQ6N.js → cli-TIS7DWRR.js} +7 -7
- package/dist/{cli-WOFYI7HZ.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-4A7RWFNO.js → cli-W4LMRVZT.js} +78 -47
- package/dist/cli-W7I5KGIB.js +84 -0
- package/dist/{cli-B3EFE7ZF.js → cli-WXGJFA4F.js} +1 -1
- package/dist/{cli-IPTHJT3J.js → cli-XCG33I77.js} +28 -25
- package/dist/{cli-WLSACMYA.js → cli-YHLSG5HB.js} +30 -28
- 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/index.d.ts +1 -1
- package/dist/client/test-session.d.ts +44 -6
- package/dist/client.js +1934 -286
- 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 +8 -0
- package/dist/dev/view/commands.d.ts +3 -1
- package/dist/docs/api/index.md +4 -2
- 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 +68 -6
- package/dist/docs/api/sdk-tools-vite.md +21 -0
- package/dist/docs/api/sdk-ui.md +7 -0
- package/dist/docs/api/sdk.md +834 -19
- package/dist/docs/changelog.md +67 -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/endpoints.md +1 -1
- package/dist/docs/guides/engine-testing.md +49 -14
- package/dist/docs/guides/engine.md +10 -2
- 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/testing.md +3 -8
- package/dist/docs/guides/tick-controller.md +22 -1
- package/dist/docs/guides/ui.md +24 -0
- package/dist/docs/guides/upgrading.md +36 -0
- package/dist/docs/page-index.md +18 -13
- package/dist/docs/recipes/create-assessment.md +124 -0
- package/dist/docs/recipes/create-benchmark.md +115 -0
- package/dist/docs/recipes/create-game.md +1 -1
- package/dist/docs/recipes/fix-duplicate-packages.md +8 -19
- 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/oxlint/logic.json +184 -0
- package/dist/playwright.js +1928 -280
- 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/templates/package/README.md.liquid +1 -0
- package/dist/templates/package/claude/rules/workflow-create-engine.md +1 -1
- package/dist/templates/package/claude/rules/workflow-create-user-interface.md +1 -1
- package/dist/templates/package/claude/rules/workflow-test-engine-or-ui.md +1 -1
- package/dist/templates/package/claude/rules/workflow-update-sdk-version.md +2 -2
- package/dist/templates/package/claude/settings.json.template +1 -0
- package/dist/templates/package/oxfmtrc.json.template +8 -1
- package/dist/templates/package/oxlintrc.json.template +1 -180
- package/dist/templates/package/package.json.liquid +1 -0
- package/dist/templates/package/vite.config.ts.liquid +2 -8
- package/dist/templates/package/vitest.config.ts.liquid +2 -8
- package/dist/templates/starter-game/package.json +2 -1
- package/dist/templates/starter-game/testing/engine/game.engine.test.ts +62 -37
- package/dist/templates/starter-game/vite.config.ts +2 -8
- package/dist/templates/starter-game/vitest.config.ts +4 -3
- package/dist/templating/resource-metadata.d.ts +1 -1
- package/dist/utils/error-codes.d.ts +9 -1
- package/dist/utils/resource-scan.d.ts +5 -0
- 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/dist/vite/index.d.ts +30 -0
- package/dist/vite.js +12 -0
- package/package.json +12 -4
- package/dist/cli-27Z5T52R.js +0 -30
- package/dist/cli-5XE4OMFL.js +0 -36
- package/dist/cli-BB6CU4ZC.js +0 -36
- package/dist/cli-FGP6YYM7.js +0 -36
- package/dist/cli-I3ZAZYWP.js +0 -36
- package/dist/cli-RFAPPYXK.js +0 -36
- package/dist/cli-WZNIW6ZO.js +0 -16
- package/dist/cli-XEEOJGBL.js +0 -36
|
@@ -52,18 +52,29 @@ export interface EngineResultRead {
|
|
|
52
52
|
state: unknown;
|
|
53
53
|
/** Whether a tick's result reported the game complete (§11). */
|
|
54
54
|
complete: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* The result's `benchmarks`, unchecked: each write is held to its
|
|
57
|
+
* benchmark, and dropped if it does not match, as it is folded (§6.16).
|
|
58
|
+
* `undefined` when the result carried none.
|
|
59
|
+
*/
|
|
60
|
+
benchmarks?: unknown;
|
|
61
|
+
/**
|
|
62
|
+
* The result's `assessments`, unchecked, as `benchmarks` is (§6.17).
|
|
63
|
+
* `undefined` when the result carried none.
|
|
64
|
+
*/
|
|
65
|
+
assessments?: unknown;
|
|
55
66
|
}
|
|
56
67
|
/**
|
|
57
68
|
* Read an engine result (`{ capabilities, deletes?, state? }`, and `complete?` from a
|
|
58
69
|
* tick's `Run` or `RunAggregate`). `Init` closes no round, so it has nothing to
|
|
59
70
|
* complete and `complete` there is an unknown key like any other.
|
|
60
71
|
*/
|
|
61
|
-
export declare function readEngineResult(label: string, result: unknown, phase?: 'init' | 'tick'): EngineResultRead;
|
|
72
|
+
export declare function readEngineResult(label: string, result: unknown, phase?: 'init' | 'tick', writesBenchmarks?: boolean, writesAssessments?: boolean): EngineResultRead;
|
|
62
73
|
/**
|
|
63
74
|
* Read an aggregate result (`{ shared: { capabilities }, teams: [{ capabilities }] }`)
|
|
64
75
|
* into the shared patch and one patch per team.
|
|
65
76
|
*/
|
|
66
|
-
export declare function readAggregateResult(label: string, result: unknown, teamCount: number, phase?: 'init' | 'tick'): {
|
|
77
|
+
export declare function readAggregateResult(label: string, result: unknown, teamCount: number, phase?: 'init' | 'tick', writesBenchmarks?: boolean, writesAssessments?: boolean): {
|
|
67
78
|
shared: EngineResultRead;
|
|
68
79
|
teams: EngineResultRead[];
|
|
69
80
|
};
|
package/dist/help-examples.d.ts
CHANGED
|
@@ -7,6 +7,10 @@ export declare function compact(example: string): string;
|
|
|
7
7
|
export declare function indent(block: string): string;
|
|
8
8
|
export declare const packageExample: string;
|
|
9
9
|
export declare const capabilityExample: string;
|
|
10
|
+
export declare const benchmarkExample: string;
|
|
11
|
+
export declare const benchmarkUpdateExample: string;
|
|
12
|
+
export declare const assessmentExample: string;
|
|
13
|
+
export declare const assessmentUpdateExample: string;
|
|
10
14
|
export declare const settingsExample: string;
|
|
11
15
|
export declare const settingsUpdateExample: string;
|
|
12
16
|
export declare const engineExample: string;
|
|
@@ -57,6 +61,14 @@ export declare const RESOURCE_EXAMPLES: {
|
|
|
57
61
|
readonly new: string;
|
|
58
62
|
readonly update: string;
|
|
59
63
|
};
|
|
64
|
+
readonly benchmark: {
|
|
65
|
+
readonly new: string;
|
|
66
|
+
readonly update: string;
|
|
67
|
+
};
|
|
68
|
+
readonly assessment: {
|
|
69
|
+
readonly new: string;
|
|
70
|
+
readonly update: string;
|
|
71
|
+
};
|
|
60
72
|
readonly settings: {
|
|
61
73
|
readonly new: string;
|
|
62
74
|
readonly update: string;
|
package/dist/host/adapter.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* protocol's `ok: false` response for that request, and keeps the port open: a
|
|
13
13
|
* failing endpoint must not take the surface down with it.
|
|
14
14
|
*/
|
|
15
|
-
import type { PastStateEntry, PastStateQuery, Participant } from '@seriousgaming/sdk';
|
|
15
|
+
import type { AssessmentReport, BenchmarkFilter, BenchmarkStatistics, PastStateEntry, PastStateQuery, Participant } from '@seriousgaming/sdk';
|
|
16
16
|
/** Who is asking. Supplied to every adapter call so it can authorise. */
|
|
17
17
|
export interface RequestOrigin {
|
|
18
18
|
/** Identifier of the UI bundle mounted in this frame. */
|
|
@@ -64,4 +64,27 @@ export interface HostAdapter {
|
|
|
64
64
|
* rather than an error.
|
|
65
65
|
*/
|
|
66
66
|
getAllTeamsParticipants?(origin: RequestOrigin): Promise<Participant[]>;
|
|
67
|
+
/**
|
|
68
|
+
* Pooled statistics for one of the game's benchmarks (§6.16).
|
|
69
|
+
*
|
|
70
|
+
* `where` is never empty: try each filter in order and answer with the
|
|
71
|
+
* first that has enough results, naming it as `matched`. Resolve `null`
|
|
72
|
+
* when there is nothing to show. Pooling, scope and thresholds are the
|
|
73
|
+
* adapter's. A host with no implementation answers `null`, since a
|
|
74
|
+
* missing benchmark is something a surface already shows without.
|
|
75
|
+
*/
|
|
76
|
+
getBenchmark?(identifier: string, where: BenchmarkFilter[], origin: RequestOrigin): Promise<BenchmarkStatistics | null>;
|
|
77
|
+
/**
|
|
78
|
+
* One assessment's results, placed in bands with the thresholds in force
|
|
79
|
+
* for the session (§6.17.3).
|
|
80
|
+
*
|
|
81
|
+
* The adapter decides which results the caller sees, from `origin` and from
|
|
82
|
+
* which surface it mounted this channel for: a player surface sees its own
|
|
83
|
+
* participant's and its own team's, an observer the team it watches, and a
|
|
84
|
+
* session UI or presentation everyone's. `buildAssessmentReport` from
|
|
85
|
+
* `@seriousgaming/sdk` assembles the answer. Throw for an identifier the
|
|
86
|
+
* package does not declare. A host with no implementation answers with an
|
|
87
|
+
* error.
|
|
88
|
+
*/
|
|
89
|
+
getAssessment?(identifier: string, origin: RequestOrigin): Promise<AssessmentReport>;
|
|
67
90
|
}
|
package/dist/host/protocol.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* the two disagree, so extending a union here without extending the guest's
|
|
11
11
|
* (or the reverse) is caught before either ships.
|
|
12
12
|
*/
|
|
13
|
-
import type { ContextDeletePath, EndpointFailure, HostOverlay, Participant, PastStateEntry, PastStateQuery, ThemePreference, TimerState, ValidationRejection } from '@seriousgaming/sdk';
|
|
13
|
+
import type { AssessmentReport, BenchmarkFilter, BenchmarkStatistics, ContextDeletePath, EndpointFailure, HostOverlay, Participant, PastStateEntry, PastStateQuery, ThemePreference, TimerState, ValidationRejection } from '@seriousgaming/sdk';
|
|
14
14
|
import type { CrossTeamData, MutationOutcome, OwnTeamJoinLink, PresentationGame, PresentationSession, RunKind, SessionData, SessionHookFailure, SessionMeta, SharedState, TeamConfiguration, TeamInfo, SessionJoinLink, TeamLinks, TeamState, UserInterfaceLocale, UserInterfaceTheme, ViewerRole, WalkthroughLink } from '@seriousgaming/sdk/ui';
|
|
15
15
|
/**
|
|
16
16
|
* Version of the host↔iframe handshake protocol. Both ends stamp it on the
|
|
@@ -243,6 +243,26 @@ export type HostPortMessage = {
|
|
|
243
243
|
requestId: string;
|
|
244
244
|
ok: false;
|
|
245
245
|
error: string;
|
|
246
|
+
} | {
|
|
247
|
+
type: 'getBenchmark:response';
|
|
248
|
+
requestId: string;
|
|
249
|
+
ok: true;
|
|
250
|
+
statistics: BenchmarkStatistics | null;
|
|
251
|
+
} | {
|
|
252
|
+
type: 'getBenchmark:response';
|
|
253
|
+
requestId: string;
|
|
254
|
+
ok: false;
|
|
255
|
+
error: string;
|
|
256
|
+
} | {
|
|
257
|
+
type: 'getAssessment:response';
|
|
258
|
+
requestId: string;
|
|
259
|
+
ok: true;
|
|
260
|
+
report: AssessmentReport;
|
|
261
|
+
} | {
|
|
262
|
+
type: 'getAssessment:response';
|
|
263
|
+
requestId: string;
|
|
264
|
+
ok: false;
|
|
265
|
+
error: string;
|
|
246
266
|
} | {
|
|
247
267
|
type: 'getAllTeamsParticipants:response';
|
|
248
268
|
requestId: string;
|
|
@@ -310,6 +330,25 @@ export type IFramePortMessage = {
|
|
|
310
330
|
type: 'getPastState';
|
|
311
331
|
requestId: string;
|
|
312
332
|
query: PastStateQuery;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Read a benchmark (§6.16). `where` is never empty: the wrapper turns an
|
|
336
|
+
* omitted filter into `[{}]` before it sends.
|
|
337
|
+
*/
|
|
338
|
+
| {
|
|
339
|
+
type: 'getBenchmark';
|
|
340
|
+
requestId: string;
|
|
341
|
+
identifier: string;
|
|
342
|
+
where: BenchmarkFilter[];
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Read an assessment's results (§6.17). The host decides which results the
|
|
346
|
+
* surface sees, from who it holds the surface as, never from the message.
|
|
347
|
+
*/
|
|
348
|
+
| {
|
|
349
|
+
type: 'getAssessment';
|
|
350
|
+
requestId: string;
|
|
351
|
+
identifier: string;
|
|
313
352
|
} | {
|
|
314
353
|
type: 'getAllTeamsParticipants';
|
|
315
354
|
requestId: string;
|
|
@@ -502,6 +541,26 @@ export type HostSessionPortMessage = {
|
|
|
502
541
|
requestId: string;
|
|
503
542
|
ok: false;
|
|
504
543
|
error: string;
|
|
544
|
+
} | {
|
|
545
|
+
type: 'getBenchmark:response';
|
|
546
|
+
requestId: string;
|
|
547
|
+
ok: true;
|
|
548
|
+
statistics: BenchmarkStatistics | null;
|
|
549
|
+
} | {
|
|
550
|
+
type: 'getBenchmark:response';
|
|
551
|
+
requestId: string;
|
|
552
|
+
ok: false;
|
|
553
|
+
error: string;
|
|
554
|
+
} | {
|
|
555
|
+
type: 'getAssessment:response';
|
|
556
|
+
requestId: string;
|
|
557
|
+
ok: true;
|
|
558
|
+
report: AssessmentReport;
|
|
559
|
+
} | {
|
|
560
|
+
type: 'getAssessment:response';
|
|
561
|
+
requestId: string;
|
|
562
|
+
ok: false;
|
|
563
|
+
error: string;
|
|
505
564
|
} | {
|
|
506
565
|
type: 'themePreferenceChanged';
|
|
507
566
|
preference: ThemePreference;
|
|
@@ -585,6 +644,25 @@ export type IFrameSessionPortMessage = {
|
|
|
585
644
|
type: 'getPastState';
|
|
586
645
|
requestId: string;
|
|
587
646
|
query: PastStateQuery;
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Read a benchmark (§6.16). `where` is never empty: the wrapper turns an
|
|
650
|
+
* omitted filter into `[{}]` before it sends.
|
|
651
|
+
*/
|
|
652
|
+
| {
|
|
653
|
+
type: 'getBenchmark';
|
|
654
|
+
requestId: string;
|
|
655
|
+
identifier: string;
|
|
656
|
+
where: BenchmarkFilter[];
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Read an assessment's results (§6.17). The host decides which results the
|
|
660
|
+
* surface sees, from who it holds the surface as, never from the message.
|
|
661
|
+
*/
|
|
662
|
+
| {
|
|
663
|
+
type: 'getAssessment';
|
|
664
|
+
requestId: string;
|
|
665
|
+
identifier: string;
|
|
588
666
|
} | {
|
|
589
667
|
type: 'requestTick';
|
|
590
668
|
requestId?: string;
|
|
@@ -837,6 +915,26 @@ export type HostPresentationPortMessage = {
|
|
|
837
915
|
requestId: string;
|
|
838
916
|
ok: false;
|
|
839
917
|
error: string;
|
|
918
|
+
} | {
|
|
919
|
+
type: 'getBenchmark:response';
|
|
920
|
+
requestId: string;
|
|
921
|
+
ok: true;
|
|
922
|
+
statistics: BenchmarkStatistics | null;
|
|
923
|
+
} | {
|
|
924
|
+
type: 'getBenchmark:response';
|
|
925
|
+
requestId: string;
|
|
926
|
+
ok: false;
|
|
927
|
+
error: string;
|
|
928
|
+
} | {
|
|
929
|
+
type: 'getAssessment:response';
|
|
930
|
+
requestId: string;
|
|
931
|
+
ok: true;
|
|
932
|
+
report: AssessmentReport;
|
|
933
|
+
} | {
|
|
934
|
+
type: 'getAssessment:response';
|
|
935
|
+
requestId: string;
|
|
936
|
+
ok: false;
|
|
937
|
+
error: string;
|
|
840
938
|
} | {
|
|
841
939
|
type: 'themePreferenceChanged';
|
|
842
940
|
preference: ThemePreference;
|
|
@@ -861,4 +959,20 @@ export type IFramePresentationPortMessage = {
|
|
|
861
959
|
type: 'getPastState';
|
|
862
960
|
requestId: string;
|
|
863
961
|
query: PastStateQuery;
|
|
962
|
+
}
|
|
963
|
+
/**
|
|
964
|
+
* Read a benchmark (§6.16). `where` is never empty: the wrapper turns an
|
|
965
|
+
* omitted filter into `[{}]` before it sends.
|
|
966
|
+
*/
|
|
967
|
+
| {
|
|
968
|
+
type: 'getBenchmark';
|
|
969
|
+
requestId: string;
|
|
970
|
+
identifier: string;
|
|
971
|
+
where: BenchmarkFilter[];
|
|
972
|
+
}
|
|
973
|
+
/** Read an assessment's results (§6.17): every one, for a deck with a session. */
|
|
974
|
+
| {
|
|
975
|
+
type: 'getAssessment';
|
|
976
|
+
requestId: string;
|
|
977
|
+
identifier: string;
|
|
864
978
|
};
|
package/dist/host.js
CHANGED
|
@@ -232,7 +232,9 @@ var ADAPTER_REQUESTS = /* @__PURE__ */ new Set([
|
|
|
232
232
|
"callEndpoint",
|
|
233
233
|
"uploadBlob",
|
|
234
234
|
"getPastState",
|
|
235
|
-
"getAllTeamsParticipants"
|
|
235
|
+
"getAllTeamsParticipants",
|
|
236
|
+
"getBenchmark",
|
|
237
|
+
"getAssessment"
|
|
236
238
|
]);
|
|
237
239
|
var HostChannel = class {
|
|
238
240
|
options;
|
|
@@ -586,11 +588,37 @@ var HostChannel = class {
|
|
|
586
588
|
const participants = await adapter?.getAllTeamsParticipants?.(origin) ?? [];
|
|
587
589
|
return { participants };
|
|
588
590
|
}
|
|
591
|
+
case "getBenchmark": {
|
|
592
|
+
const where = benchmarkWhere(message.where);
|
|
593
|
+
const statistics = await adapter?.getBenchmark?.(String(message.identifier), where, origin) ?? null;
|
|
594
|
+
return { statistics };
|
|
595
|
+
}
|
|
596
|
+
case "getAssessment": {
|
|
597
|
+
if (!adapter?.getAssessment) {
|
|
598
|
+
throw new Error("getAssessment: this host does not hold assessment results");
|
|
599
|
+
}
|
|
600
|
+
const report = await adapter.getAssessment(String(message.identifier), origin);
|
|
601
|
+
return { report };
|
|
602
|
+
}
|
|
589
603
|
default:
|
|
590
604
|
throw new Error(`Unroutable request "${message.type}"`);
|
|
591
605
|
}
|
|
592
606
|
}
|
|
593
607
|
};
|
|
608
|
+
function benchmarkWhere(where) {
|
|
609
|
+
if (!Array.isArray(where)) {
|
|
610
|
+
throw new Error('getBenchmark: "where" must be a list of filters');
|
|
611
|
+
}
|
|
612
|
+
if (where.length === 0) {
|
|
613
|
+
throw new Error('getBenchmark: "where" must hold at least one filter');
|
|
614
|
+
}
|
|
615
|
+
return where.map((filter) => {
|
|
616
|
+
if (typeof filter !== "object" || filter === null || Array.isArray(filter) || Object.values(filter).some((value) => typeof value !== "string")) {
|
|
617
|
+
throw new Error("getBenchmark: each filter must be an object of tag names to strings");
|
|
618
|
+
}
|
|
619
|
+
return { ...filter };
|
|
620
|
+
});
|
|
621
|
+
}
|
|
594
622
|
function stableStringify(value) {
|
|
595
623
|
if (value === null || typeof value !== "object") return JSON.stringify(value) ?? "undefined";
|
|
596
624
|
if (Array.isArray(value)) return `[${value.map(stableStringify).join(",")}]`;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
{
|
|
2
|
+
"overrides": [
|
|
3
|
+
{
|
|
4
|
+
"files": [
|
|
5
|
+
"engine/**/*.ts",
|
|
6
|
+
"tick_controller/**/*.ts",
|
|
7
|
+
"**/hooks/*/logic/**/*.ts",
|
|
8
|
+
"**/validators/*/logic/**/*.ts",
|
|
9
|
+
"**/endpoints/*/logic/**/*.ts"
|
|
10
|
+
],
|
|
11
|
+
"rules": {
|
|
12
|
+
"no-restricted-globals": [
|
|
13
|
+
"error",
|
|
14
|
+
{
|
|
15
|
+
"name": "structuredClone",
|
|
16
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Context is JSON-serialisable, so JSON.parse(JSON.stringify(value)) is the portable equivalent."
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "TextEncoder",
|
|
20
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Import encodeUtf8 from @seriousgaming/sdk instead."
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "TextDecoder",
|
|
24
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Import decodeUtf8 from @seriousgaming/sdk instead."
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "fetch",
|
|
28
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Reach external services through the injected callbacks, or through an endpoint."
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "XMLHttpRequest",
|
|
32
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Reach external services through the injected callbacks, or through an endpoint."
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "setTimeout",
|
|
36
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Ticks are the scheduling primitive: logic must run to completion within one tick."
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "setInterval",
|
|
40
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Ticks are the scheduling primitive: logic must run to completion within one tick."
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "setImmediate",
|
|
44
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Ticks are the scheduling primitive: logic must run to completion within one tick."
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "queueMicrotask",
|
|
48
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Ticks are the scheduling primitive: logic must run to completion within one tick."
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "process",
|
|
52
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Settings reach logic through the `settings` argument."
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "Buffer",
|
|
56
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Use Uint8Array, with the SDK's encodeUtf8 / decodeUtf8 for string conversion."
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "URL",
|
|
60
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Build asset URLs from the references and callbacks the runtime injects."
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "clearTimeout",
|
|
64
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "clearInterval",
|
|
68
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "clearImmediate",
|
|
72
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"name": "URLSearchParams",
|
|
76
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"name": "crypto",
|
|
80
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "atob",
|
|
84
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"name": "btoa",
|
|
88
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"name": "performance",
|
|
92
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"name": "ReadableStream",
|
|
96
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"name": "WritableStream",
|
|
100
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "TransformStream",
|
|
104
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"name": "Blob",
|
|
108
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"name": "File",
|
|
112
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "FormData",
|
|
116
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"name": "Headers",
|
|
120
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"name": "Request",
|
|
124
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"name": "Response",
|
|
128
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"name": "AbortController",
|
|
132
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"name": "EventTarget",
|
|
136
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"name": "WebSocket",
|
|
140
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"name": "localStorage",
|
|
144
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"name": "sessionStorage",
|
|
148
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"name": "window",
|
|
152
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"name": "document",
|
|
156
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"name": "navigator",
|
|
160
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"name": "require",
|
|
164
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"name": "__dirname",
|
|
168
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"name": "__filename",
|
|
172
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"files": ["**/*.test.ts", "**/*.spec.ts"],
|
|
179
|
+
"rules": {
|
|
180
|
+
"no-restricted-globals": "off"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
}
|