@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
|
@@ -2,22 +2,23 @@
|
|
|
2
2
|
import {
|
|
3
3
|
absolutiseTsTypes,
|
|
4
4
|
relativiseTsTypes
|
|
5
|
-
} from "./cli-
|
|
5
|
+
} from "./cli-M3Z2KOEB.js";
|
|
6
6
|
import {
|
|
7
7
|
SCENARIO_FILES,
|
|
8
8
|
resolveCapabilityScope
|
|
9
|
-
} from "./cli-
|
|
9
|
+
} from "./cli-HXT25ETJ.js";
|
|
10
10
|
import {
|
|
11
11
|
dereference,
|
|
12
12
|
isLocalRef,
|
|
13
|
+
resolveBenchmarkLevel,
|
|
13
14
|
resolveLocalRef
|
|
14
|
-
} from "./cli-
|
|
15
|
+
} from "./cli-RVZH462G.js";
|
|
15
16
|
import {
|
|
16
17
|
logger
|
|
17
|
-
} from "./cli-
|
|
18
|
+
} from "./cli-D5VOSJZ7.js";
|
|
18
19
|
import {
|
|
19
20
|
CliError
|
|
20
|
-
} from "./cli-
|
|
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
|
-
|
|
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(
|
|
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-
|
|
7
|
+
} from "./cli-JD563OF4.js";
|
|
8
8
|
import {
|
|
9
9
|
PackageScenarioError,
|
|
10
10
|
createPackageScenario,
|
|
11
11
|
deletePackageScenario
|
|
12
|
-
} from "./cli-
|
|
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-
|
|
23
|
+
} from "./cli-6KWCIAN2.js";
|
|
24
24
|
import {
|
|
25
25
|
newInstanceId,
|
|
26
26
|
removeLockFile,
|
|
27
27
|
writeLockFile
|
|
28
|
-
} from "./cli-
|
|
28
|
+
} from "./cli-FNESSE3L.js";
|
|
29
29
|
import {
|
|
30
30
|
hmrClientTarget,
|
|
31
31
|
publicAssetOrigin,
|
|
32
32
|
publicHmrOrigin,
|
|
33
33
|
publicHostnames
|
|
34
|
-
} from "./cli-
|
|
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-
|
|
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-
|
|
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-
|
|
59
|
+
} from "./cli-D5VOSJZ7.js";
|
|
60
60
|
import {
|
|
61
61
|
CliError,
|
|
62
62
|
diagnosticLocation
|
|
63
|
-
} from "./cli-
|
|
63
|
+
} from "./cli-5PIFO3EN.js";
|
|
64
64
|
|
|
65
65
|
// cli/dev/view/route.ts
|
|
66
66
|
var PATTERNS = [
|
|
@@ -136,6 +136,7 @@ import { WebSocketServer } from "ws";
|
|
|
136
136
|
|
|
137
137
|
// cli/core/listen-with-fallback.ts
|
|
138
138
|
import { createServer as createSocket } from "net";
|
|
139
|
+
var PORT_IN_USE_HINT = "`sdk dev status` says whether a dev server is already running for this package. Pass --port auto to take any free port.";
|
|
139
140
|
async function listenWithPortFallback(server, startPort, options = {}) {
|
|
140
141
|
const maxAttempts = options.maxAttempts ?? 100;
|
|
141
142
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
@@ -149,7 +150,8 @@ async function listenWithPortFallback(server, startPort, options = {}) {
|
|
|
149
150
|
}
|
|
150
151
|
throw new CliError(
|
|
151
152
|
"PORT_IN_USE",
|
|
152
|
-
`Could not find available port after ${maxAttempts} attempts
|
|
153
|
+
`Could not find available port after ${maxAttempts} attempts`,
|
|
154
|
+
{ hint: PORT_IN_USE_HINT }
|
|
153
155
|
);
|
|
154
156
|
}
|
|
155
157
|
function tryListen(server, port, host) {
|
|
@@ -187,7 +189,8 @@ async function findFreePort(startPort, maxAttempts = 100) {
|
|
|
187
189
|
}
|
|
188
190
|
throw new CliError(
|
|
189
191
|
"PORT_IN_USE",
|
|
190
|
-
`Could not find available port after ${maxAttempts} attempts
|
|
192
|
+
`Could not find available port after ${maxAttempts} attempts`,
|
|
193
|
+
{ hint: PORT_IN_USE_HINT }
|
|
191
194
|
);
|
|
192
195
|
}
|
|
193
196
|
var PROBED_ADDRESSES = [void 0, "127.0.0.1", "::1"];
|
|
@@ -1636,13 +1639,26 @@ var NO_TEAM_ID = {
|
|
|
1636
1639
|
renameSelf: "renameSelf renames the caller, whom the host resolves; it takes no teamId"
|
|
1637
1640
|
};
|
|
1638
1641
|
var FRAME_QUERIES = {
|
|
1639
|
-
game: /* @__PURE__ */ new Set([
|
|
1640
|
-
|
|
1641
|
-
|
|
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"]),
|
|
1642
1657
|
setup: /* @__PURE__ */ new Set(["callEndpoint"]),
|
|
1643
1658
|
"scenario-editor": /* @__PURE__ */ new Set(["callEndpoint"]),
|
|
1644
|
-
presentation: /* @__PURE__ */ new Set(["getPastState"])
|
|
1659
|
+
presentation: /* @__PURE__ */ new Set(["getPastState", "getBenchmark", "getAssessment"])
|
|
1645
1660
|
};
|
|
1661
|
+
var PLAYER_SURFACES = /* @__PURE__ */ new Set(["game", "waiting-room"]);
|
|
1646
1662
|
function teamScope(viewer) {
|
|
1647
1663
|
return viewer.teamIndex === void 0 ? {} : { teamIndex: viewer.teamIndex };
|
|
1648
1664
|
}
|
|
@@ -1791,7 +1807,7 @@ function commandFor(message, surface, viewer) {
|
|
|
1791
1807
|
return null;
|
|
1792
1808
|
}
|
|
1793
1809
|
}
|
|
1794
|
-
function queryFor(message, surface, viewer) {
|
|
1810
|
+
function queryFor(message, surface, viewer, { sessionless = false } = {}) {
|
|
1795
1811
|
if (!FRAME_QUERIES[surface.kind].has(message.type)) return null;
|
|
1796
1812
|
switch (message.type) {
|
|
1797
1813
|
case "callEndpoint":
|
|
@@ -1818,6 +1834,28 @@ function queryFor(message, surface, viewer) {
|
|
|
1818
1834
|
};
|
|
1819
1835
|
case "getAllTeamsParticipants":
|
|
1820
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
|
+
};
|
|
1821
1859
|
default:
|
|
1822
1860
|
return null;
|
|
1823
1861
|
}
|
|
@@ -1999,6 +2037,8 @@ var DevShell = class {
|
|
|
1999
2037
|
socketRuns = /* @__PURE__ */ new WeakMap();
|
|
2000
2038
|
/** The participant an operator page says it is showing, where it shows one. */
|
|
2001
2039
|
socketPresence = /* @__PURE__ */ new Map();
|
|
2040
|
+
/** Console pages open, each of which keeps its run awake (§11.4a). */
|
|
2041
|
+
consoleSockets = /* @__PURE__ */ new Set();
|
|
2002
2042
|
options;
|
|
2003
2043
|
brands;
|
|
2004
2044
|
server = null;
|
|
@@ -2600,22 +2640,30 @@ Install the package's dependencies to serve its surfaces.
|
|
|
2600
2640
|
host: request.headers.host,
|
|
2601
2641
|
localOrigins: wantsLocalOrigins(location.search)
|
|
2602
2642
|
});
|
|
2603
|
-
void this.sendView(socket).then(() =>
|
|
2643
|
+
void this.sendView(socket).then(() => {
|
|
2644
|
+
this.syncPresence(route.run);
|
|
2645
|
+
this.syncOpenSurfaces(route.run);
|
|
2646
|
+
});
|
|
2604
2647
|
socket.on("message", (raw) => void this.receiveView(socket, raw));
|
|
2605
2648
|
socket.on("close", () => {
|
|
2606
2649
|
this.views.delete(socket);
|
|
2607
2650
|
this.syncPresence(route.run);
|
|
2651
|
+
this.syncOpenSurfaces(route.run);
|
|
2608
2652
|
});
|
|
2609
2653
|
});
|
|
2610
2654
|
this.sockets.on("connection", (socket, request) => {
|
|
2611
2655
|
const run = runFromUrl(request.url);
|
|
2612
2656
|
this.socketRuns.set(socket, run);
|
|
2657
|
+
this.consoleSockets.add(socket);
|
|
2613
2658
|
void this.runFor(run).then((session) => {
|
|
2614
2659
|
send(socket, { type: "state", state: session.project(), cause: "connected" });
|
|
2660
|
+
this.syncOpenSurfaces(run);
|
|
2615
2661
|
});
|
|
2616
2662
|
socket.on("message", (raw) => void this.receive(socket, raw));
|
|
2617
2663
|
socket.on("close", () => {
|
|
2664
|
+
this.consoleSockets.delete(socket);
|
|
2618
2665
|
if (this.socketPresence.delete(socket)) this.syncPresence(run);
|
|
2666
|
+
this.syncOpenSurfaces(run);
|
|
2619
2667
|
});
|
|
2620
2668
|
});
|
|
2621
2669
|
}
|
|
@@ -2745,6 +2793,23 @@ Install the package's dependencies to serve its surfaces.
|
|
|
2745
2793
|
}
|
|
2746
2794
|
session.syncPresence(present);
|
|
2747
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
|
+
}
|
|
2748
2813
|
updateViews(event, run) {
|
|
2749
2814
|
if (event.type === "round-processing") {
|
|
2750
2815
|
const teams = this.processing.get(run) ?? /* @__PURE__ */ new Set();
|