@gameslate/sdk 0.3.19 → 0.3.20

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.
@@ -20,6 +20,9 @@ export interface InspectedPlugin {
20
20
  registryGames: string[];
21
21
  /** things that don't stop it loading (built for other core versions) */
22
22
  warnings: string[];
23
+ /** frees the live code's sandbox (a few MB): call it once the plugin is no longer used, or
24
+ * right away when it was only inspected */
25
+ dispose: () => void;
23
26
  }
24
27
  export interface InspectOptions {
25
28
  /** the core version it will run in; others it was tested with become a warning */
@@ -45,7 +45,7 @@ function loadLive(quickJs, dir, manifest, log) {
45
45
  const description = sandbox.describe();
46
46
  const problem = describedProblem(manifest, description);
47
47
  if (!problem)
48
- return sandbox.module(description);
48
+ return { module: sandbox.module(description), sandbox };
49
49
  sandbox.dispose();
50
50
  return problem;
51
51
  }
@@ -94,8 +94,24 @@ export function inspectPlugin(quickJs, dir, manifest, opts) {
94
94
  const live = loadLive(quickJs, dir, manifest, opts.log);
95
95
  if (typeof live === 'string')
96
96
  return live;
97
- const assets = loadAssets(quickJs, dir, manifest, opts.log);
98
- if (typeof assets === 'string')
97
+ let assets;
98
+ try {
99
+ assets = loadAssets(quickJs, dir, manifest, opts.log);
100
+ }
101
+ catch (e) {
102
+ live.sandbox.dispose();
103
+ throw e;
104
+ }
105
+ if (typeof assets === 'string') {
106
+ live.sandbox.dispose();
99
107
  return assets;
100
- return { manifest, live, assets, registryGames: registry.games, warnings };
108
+ }
109
+ return {
110
+ manifest,
111
+ live: live.module,
112
+ assets,
113
+ registryGames: registry.games,
114
+ warnings,
115
+ dispose: () => live.sandbox.dispose(),
116
+ };
101
117
  }
package/lib/pack.d.ts CHANGED
@@ -989,6 +989,997 @@ export declare const PackDataSchema: z.ZodObject<{
989
989
  } | undefined;
990
990
  }>;
991
991
  export type PackData = z.infer<typeof PackDataSchema>;
992
+ /** A pack's data as the daemon serves it, with what the core knows about the game. */
993
+ export declare const ServedPackDataSchema: z.ZodObject<{
994
+ id: z.ZodString;
995
+ title: z.ZodString;
996
+ catalogue: z.ZodObject<{
997
+ items: z.ZodArray<z.ZodObject<{
998
+ id: z.ZodString;
999
+ label: z.ZodString;
1000
+ icon: z.ZodOptional<z.ZodString>;
1001
+ category: z.ZodOptional<z.ZodString>;
1002
+ short: z.ZodOptional<z.ZodString>;
1003
+ source: z.ZodOptional<z.ZodString>;
1004
+ count: z.ZodOptional<z.ZodString>;
1005
+ }, "strict", z.ZodTypeAny, {
1006
+ label: string;
1007
+ id: string;
1008
+ icon?: string | undefined;
1009
+ source?: string | undefined;
1010
+ category?: string | undefined;
1011
+ short?: string | undefined;
1012
+ count?: string | undefined;
1013
+ }, {
1014
+ label: string;
1015
+ id: string;
1016
+ icon?: string | undefined;
1017
+ source?: string | undefined;
1018
+ category?: string | undefined;
1019
+ short?: string | undefined;
1020
+ count?: string | undefined;
1021
+ }>, "many">;
1022
+ counters: z.ZodArray<z.ZodObject<{
1023
+ id: z.ZodString;
1024
+ label: z.ZodString;
1025
+ icon: z.ZodOptional<z.ZodString>;
1026
+ max: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
1027
+ display: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1028
+ role: z.ZodOptional<z.ZodEnum<["health", "magic", "armor", "keys"]>>;
1029
+ format: z.ZodOptional<z.ZodEnum<["number", "percent", "duration"]>>;
1030
+ }, "strict", z.ZodTypeAny, {
1031
+ label: string;
1032
+ id: string;
1033
+ icon?: string | undefined;
1034
+ max?: string | number | undefined;
1035
+ format?: "number" | "duration" | "percent" | undefined;
1036
+ display?: Record<string, string> | undefined;
1037
+ role?: "keys" | "health" | "magic" | "armor" | undefined;
1038
+ }, {
1039
+ label: string;
1040
+ id: string;
1041
+ icon?: string | undefined;
1042
+ max?: string | number | undefined;
1043
+ format?: "number" | "duration" | "percent" | undefined;
1044
+ display?: Record<string, string> | undefined;
1045
+ role?: "keys" | "health" | "magic" | "armor" | undefined;
1046
+ }>, "many">;
1047
+ flagSets: z.ZodArray<z.ZodString, "many">;
1048
+ inventoryLayouts: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1049
+ kind: z.ZodLiteral<"slotGrid">;
1050
+ id: z.ZodString;
1051
+ title: z.ZodString;
1052
+ columns: z.ZodNumber;
1053
+ slots: z.ZodArray<z.ZodString, "many">;
1054
+ }, "strict", z.ZodTypeAny, {
1055
+ id: string;
1056
+ title: string;
1057
+ kind: "slotGrid";
1058
+ columns: number;
1059
+ slots: string[];
1060
+ }, {
1061
+ id: string;
1062
+ title: string;
1063
+ kind: "slotGrid";
1064
+ columns: number;
1065
+ slots: string[];
1066
+ }>, z.ZodObject<{
1067
+ kind: z.ZodLiteral<"counters">;
1068
+ id: z.ZodString;
1069
+ title: z.ZodString;
1070
+ counters: z.ZodArray<z.ZodString, "many">;
1071
+ hideMissing: z.ZodOptional<z.ZodBoolean>;
1072
+ }, "strict", z.ZodTypeAny, {
1073
+ id: string;
1074
+ title: string;
1075
+ counters: string[];
1076
+ kind: "counters";
1077
+ hideMissing?: boolean | undefined;
1078
+ }, {
1079
+ id: string;
1080
+ title: string;
1081
+ counters: string[];
1082
+ kind: "counters";
1083
+ hideMissing?: boolean | undefined;
1084
+ }>]>, "many">;
1085
+ missions: z.ZodArray<z.ZodObject<{
1086
+ id: z.ZodString;
1087
+ title: z.ZodString;
1088
+ group: z.ZodEnum<["main", "side"]>;
1089
+ section: z.ZodOptional<z.ZodString>;
1090
+ location: z.ZodOptional<z.ZodString>;
1091
+ detail: z.ZodOptional<z.ZodString>;
1092
+ done: z.ZodType<import("./condition.js").Condition, z.ZodTypeDef, import("./condition.js").Condition>;
1093
+ availableWhen: z.ZodOptional<z.ZodType<import("./condition.js").Condition, z.ZodTypeDef, import("./condition.js").Condition>>;
1094
+ progress: z.ZodOptional<z.ZodObject<{
1095
+ counter: z.ZodString;
1096
+ target: z.ZodNumber;
1097
+ }, "strict", z.ZodTypeAny, {
1098
+ target: number;
1099
+ counter: string;
1100
+ }, {
1101
+ target: number;
1102
+ counter: string;
1103
+ }>>;
1104
+ steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
1105
+ id: z.ZodString;
1106
+ label: z.ZodString;
1107
+ done: z.ZodType<import("./condition.js").Condition, z.ZodTypeDef, import("./condition.js").Condition>;
1108
+ }, "strict", z.ZodTypeAny, {
1109
+ label: string;
1110
+ id: string;
1111
+ done: import("./condition.js").Condition;
1112
+ }, {
1113
+ label: string;
1114
+ id: string;
1115
+ done: import("./condition.js").Condition;
1116
+ }>, "many">>;
1117
+ ask: z.ZodOptional<z.ZodString>;
1118
+ }, "strict", z.ZodTypeAny, {
1119
+ id: string;
1120
+ title: string;
1121
+ done: import("./condition.js").Condition;
1122
+ group: "main" | "side";
1123
+ detail?: string | undefined;
1124
+ ask?: string | undefined;
1125
+ location?: string | undefined;
1126
+ section?: string | undefined;
1127
+ availableWhen?: import("./condition.js").Condition | undefined;
1128
+ progress?: {
1129
+ target: number;
1130
+ counter: string;
1131
+ } | undefined;
1132
+ steps?: {
1133
+ label: string;
1134
+ id: string;
1135
+ done: import("./condition.js").Condition;
1136
+ }[] | undefined;
1137
+ }, {
1138
+ id: string;
1139
+ title: string;
1140
+ done: import("./condition.js").Condition;
1141
+ group: "main" | "side";
1142
+ detail?: string | undefined;
1143
+ ask?: string | undefined;
1144
+ location?: string | undefined;
1145
+ section?: string | undefined;
1146
+ availableWhen?: import("./condition.js").Condition | undefined;
1147
+ progress?: {
1148
+ target: number;
1149
+ counter: string;
1150
+ } | undefined;
1151
+ steps?: {
1152
+ label: string;
1153
+ id: string;
1154
+ done: import("./condition.js").Condition;
1155
+ }[] | undefined;
1156
+ }>, "many">;
1157
+ collectibles: z.ZodArray<z.ZodObject<{
1158
+ id: z.ZodString;
1159
+ title: z.ZodString;
1160
+ noun: z.ZodString;
1161
+ icon: z.ZodOptional<z.ZodString>;
1162
+ counter: z.ZodOptional<z.ZodString>;
1163
+ entries: z.ZodOptional<z.ZodArray<z.ZodObject<{
1164
+ id: z.ZodString;
1165
+ name: z.ZodString;
1166
+ locationId: z.ZodOptional<z.ZodString>;
1167
+ locationName: z.ZodOptional<z.ZodString>;
1168
+ collectedBy: z.ZodOptional<z.ZodType<import("./condition.js").Condition, z.ZodTypeDef, import("./condition.js").Condition>>;
1169
+ needs: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString, "many">, "many">>;
1170
+ pinId: z.ZodOptional<z.ZodString>;
1171
+ }, "strict", z.ZodTypeAny, {
1172
+ id: string;
1173
+ name: string;
1174
+ locationId?: string | undefined;
1175
+ pinId?: string | undefined;
1176
+ collectedBy?: import("./condition.js").Condition | undefined;
1177
+ locationName?: string | undefined;
1178
+ needs?: string[][] | undefined;
1179
+ }, {
1180
+ id: string;
1181
+ name: string;
1182
+ locationId?: string | undefined;
1183
+ pinId?: string | undefined;
1184
+ collectedBy?: import("./condition.js").Condition | undefined;
1185
+ locationName?: string | undefined;
1186
+ needs?: string[][] | undefined;
1187
+ }>, "many">>;
1188
+ localSource: z.ZodOptional<z.ZodObject<{
1189
+ file: z.ZodString;
1190
+ key: z.ZodString;
1191
+ }, "strict", z.ZodTypeAny, {
1192
+ key: string;
1193
+ file: string;
1194
+ }, {
1195
+ key: string;
1196
+ file: string;
1197
+ }>>;
1198
+ }, "strict", z.ZodTypeAny, {
1199
+ id: string;
1200
+ title: string;
1201
+ noun: string;
1202
+ icon?: string | undefined;
1203
+ entries?: {
1204
+ id: string;
1205
+ name: string;
1206
+ locationId?: string | undefined;
1207
+ pinId?: string | undefined;
1208
+ collectedBy?: import("./condition.js").Condition | undefined;
1209
+ locationName?: string | undefined;
1210
+ needs?: string[][] | undefined;
1211
+ }[] | undefined;
1212
+ counter?: string | undefined;
1213
+ localSource?: {
1214
+ key: string;
1215
+ file: string;
1216
+ } | undefined;
1217
+ }, {
1218
+ id: string;
1219
+ title: string;
1220
+ noun: string;
1221
+ icon?: string | undefined;
1222
+ entries?: {
1223
+ id: string;
1224
+ name: string;
1225
+ locationId?: string | undefined;
1226
+ pinId?: string | undefined;
1227
+ collectedBy?: import("./condition.js").Condition | undefined;
1228
+ locationName?: string | undefined;
1229
+ needs?: string[][] | undefined;
1230
+ }[] | undefined;
1231
+ counter?: string | undefined;
1232
+ localSource?: {
1233
+ key: string;
1234
+ file: string;
1235
+ } | undefined;
1236
+ }>, "many">;
1237
+ reference: z.ZodArray<z.ZodObject<{
1238
+ id: z.ZodString;
1239
+ title: z.ZodString;
1240
+ badge: z.ZodOptional<z.ZodString>;
1241
+ defaultOpen: z.ZodOptional<z.ZodBoolean>;
1242
+ entries: z.ZodArray<z.ZodObject<{
1243
+ id: z.ZodString;
1244
+ title: z.ZodString;
1245
+ badge: z.ZodOptional<z.ZodString>;
1246
+ sequence: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1247
+ notes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1248
+ rows: z.ZodOptional<z.ZodArray<z.ZodObject<{
1249
+ label: z.ZodString;
1250
+ detail: z.ZodString;
1251
+ }, "strict", z.ZodTypeAny, {
1252
+ label: string;
1253
+ detail: string;
1254
+ }, {
1255
+ label: string;
1256
+ detail: string;
1257
+ }>, "many">>;
1258
+ revealWhen: z.ZodOptional<z.ZodType<import("./condition.js").Condition, z.ZodTypeDef, import("./condition.js").Condition>>;
1259
+ }, "strict", z.ZodTypeAny, {
1260
+ id: string;
1261
+ title: string;
1262
+ notes?: string[] | undefined;
1263
+ badge?: string | undefined;
1264
+ sequence?: string[] | undefined;
1265
+ rows?: {
1266
+ label: string;
1267
+ detail: string;
1268
+ }[] | undefined;
1269
+ revealWhen?: import("./condition.js").Condition | undefined;
1270
+ }, {
1271
+ id: string;
1272
+ title: string;
1273
+ notes?: string[] | undefined;
1274
+ badge?: string | undefined;
1275
+ sequence?: string[] | undefined;
1276
+ rows?: {
1277
+ label: string;
1278
+ detail: string;
1279
+ }[] | undefined;
1280
+ revealWhen?: import("./condition.js").Condition | undefined;
1281
+ }>, "many">;
1282
+ }, "strict", z.ZodTypeAny, {
1283
+ entries: {
1284
+ id: string;
1285
+ title: string;
1286
+ notes?: string[] | undefined;
1287
+ badge?: string | undefined;
1288
+ sequence?: string[] | undefined;
1289
+ rows?: {
1290
+ label: string;
1291
+ detail: string;
1292
+ }[] | undefined;
1293
+ revealWhen?: import("./condition.js").Condition | undefined;
1294
+ }[];
1295
+ id: string;
1296
+ title: string;
1297
+ badge?: string | undefined;
1298
+ defaultOpen?: boolean | undefined;
1299
+ }, {
1300
+ entries: {
1301
+ id: string;
1302
+ title: string;
1303
+ notes?: string[] | undefined;
1304
+ badge?: string | undefined;
1305
+ sequence?: string[] | undefined;
1306
+ rows?: {
1307
+ label: string;
1308
+ detail: string;
1309
+ }[] | undefined;
1310
+ revealWhen?: import("./condition.js").Condition | undefined;
1311
+ }[];
1312
+ id: string;
1313
+ title: string;
1314
+ badge?: string | undefined;
1315
+ defaultOpen?: boolean | undefined;
1316
+ }>, "many">;
1317
+ chips: z.ZodArray<z.ZodObject<{
1318
+ id: z.ZodString;
1319
+ label: z.ZodString;
1320
+ prompt: z.ZodString;
1321
+ when: z.ZodOptional<z.ZodType<import("./condition.js").Condition, z.ZodTypeDef, import("./condition.js").Condition>>;
1322
+ }, "strict", z.ZodTypeAny, {
1323
+ label: string;
1324
+ id: string;
1325
+ prompt: string;
1326
+ when?: import("./condition.js").Condition | undefined;
1327
+ }, {
1328
+ label: string;
1329
+ id: string;
1330
+ prompt: string;
1331
+ when?: import("./condition.js").Condition | undefined;
1332
+ }>, "many">;
1333
+ pinRules: z.ZodArray<z.ZodEffects<z.ZodObject<{
1334
+ id: z.ZodString;
1335
+ match: z.ZodEffects<z.ZodObject<{
1336
+ at: z.ZodOptional<z.ZodString>;
1337
+ kind: z.ZodOptional<z.ZodString>;
1338
+ ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1339
+ label: z.ZodOptional<z.ZodString>;
1340
+ labelContains: z.ZodOptional<z.ZodString>;
1341
+ }, "strict", z.ZodTypeAny, {
1342
+ label?: string | undefined;
1343
+ at?: string | undefined;
1344
+ kind?: string | undefined;
1345
+ ids?: string[] | undefined;
1346
+ labelContains?: string | undefined;
1347
+ }, {
1348
+ label?: string | undefined;
1349
+ at?: string | undefined;
1350
+ kind?: string | undefined;
1351
+ ids?: string[] | undefined;
1352
+ labelContains?: string | undefined;
1353
+ }>, {
1354
+ label?: string | undefined;
1355
+ at?: string | undefined;
1356
+ kind?: string | undefined;
1357
+ ids?: string[] | undefined;
1358
+ labelContains?: string | undefined;
1359
+ }, {
1360
+ label?: string | undefined;
1361
+ at?: string | undefined;
1362
+ kind?: string | undefined;
1363
+ ids?: string[] | undefined;
1364
+ labelContains?: string | undefined;
1365
+ }>;
1366
+ collectedBy: z.ZodOptional<z.ZodType<import("./condition.js").Condition, z.ZodTypeDef, import("./condition.js").Condition>>;
1367
+ hiddenWhen: z.ZodOptional<z.ZodType<import("./condition.js").Condition, z.ZodTypeDef, import("./condition.js").Condition>>;
1368
+ icon: z.ZodOptional<z.ZodString>;
1369
+ }, "strict", z.ZodTypeAny, {
1370
+ id: string;
1371
+ match: {
1372
+ label?: string | undefined;
1373
+ at?: string | undefined;
1374
+ kind?: string | undefined;
1375
+ ids?: string[] | undefined;
1376
+ labelContains?: string | undefined;
1377
+ };
1378
+ icon?: string | undefined;
1379
+ collectedBy?: import("./condition.js").Condition | undefined;
1380
+ hiddenWhen?: import("./condition.js").Condition | undefined;
1381
+ }, {
1382
+ id: string;
1383
+ match: {
1384
+ label?: string | undefined;
1385
+ at?: string | undefined;
1386
+ kind?: string | undefined;
1387
+ ids?: string[] | undefined;
1388
+ labelContains?: string | undefined;
1389
+ };
1390
+ icon?: string | undefined;
1391
+ collectedBy?: import("./condition.js").Condition | undefined;
1392
+ hiddenWhen?: import("./condition.js").Condition | undefined;
1393
+ }>, {
1394
+ id: string;
1395
+ match: {
1396
+ label?: string | undefined;
1397
+ at?: string | undefined;
1398
+ kind?: string | undefined;
1399
+ ids?: string[] | undefined;
1400
+ labelContains?: string | undefined;
1401
+ };
1402
+ icon?: string | undefined;
1403
+ collectedBy?: import("./condition.js").Condition | undefined;
1404
+ hiddenWhen?: import("./condition.js").Condition | undefined;
1405
+ }, {
1406
+ id: string;
1407
+ match: {
1408
+ label?: string | undefined;
1409
+ at?: string | undefined;
1410
+ kind?: string | undefined;
1411
+ ids?: string[] | undefined;
1412
+ labelContains?: string | undefined;
1413
+ };
1414
+ icon?: string | undefined;
1415
+ collectedBy?: import("./condition.js").Condition | undefined;
1416
+ hiddenWhen?: import("./condition.js").Condition | undefined;
1417
+ }>, "many">;
1418
+ pinCategories: z.ZodOptional<z.ZodArray<z.ZodObject<{
1419
+ id: z.ZodString;
1420
+ label: z.ZodString;
1421
+ shownByDefault: z.ZodBoolean;
1422
+ icon: z.ZodOptional<z.ZodString>;
1423
+ }, "strip", z.ZodTypeAny, {
1424
+ label: string;
1425
+ id: string;
1426
+ shownByDefault: boolean;
1427
+ icon?: string | undefined;
1428
+ }, {
1429
+ label: string;
1430
+ id: string;
1431
+ shownByDefault: boolean;
1432
+ icon?: string | undefined;
1433
+ }>, "many">>;
1434
+ variants: z.ZodOptional<z.ZodArray<z.ZodObject<{
1435
+ id: z.ZodString;
1436
+ label: z.ZodString;
1437
+ shuffled: z.ZodOptional<z.ZodBoolean>;
1438
+ }, "strict", z.ZodTypeAny, {
1439
+ label: string;
1440
+ id: string;
1441
+ shuffled?: boolean | undefined;
1442
+ }, {
1443
+ label: string;
1444
+ id: string;
1445
+ shuffled?: boolean | undefined;
1446
+ }>, "many">>;
1447
+ }, "strict", z.ZodTypeAny, {
1448
+ counters: {
1449
+ label: string;
1450
+ id: string;
1451
+ icon?: string | undefined;
1452
+ max?: string | number | undefined;
1453
+ format?: "number" | "duration" | "percent" | undefined;
1454
+ display?: Record<string, string> | undefined;
1455
+ role?: "keys" | "health" | "magic" | "armor" | undefined;
1456
+ }[];
1457
+ flagSets: string[];
1458
+ items: {
1459
+ label: string;
1460
+ id: string;
1461
+ icon?: string | undefined;
1462
+ source?: string | undefined;
1463
+ category?: string | undefined;
1464
+ short?: string | undefined;
1465
+ count?: string | undefined;
1466
+ }[];
1467
+ chips: {
1468
+ label: string;
1469
+ id: string;
1470
+ prompt: string;
1471
+ when?: import("./condition.js").Condition | undefined;
1472
+ }[];
1473
+ inventoryLayouts: ({
1474
+ id: string;
1475
+ title: string;
1476
+ kind: "slotGrid";
1477
+ columns: number;
1478
+ slots: string[];
1479
+ } | {
1480
+ id: string;
1481
+ title: string;
1482
+ counters: string[];
1483
+ kind: "counters";
1484
+ hideMissing?: boolean | undefined;
1485
+ })[];
1486
+ missions: {
1487
+ id: string;
1488
+ title: string;
1489
+ done: import("./condition.js").Condition;
1490
+ group: "main" | "side";
1491
+ detail?: string | undefined;
1492
+ ask?: string | undefined;
1493
+ location?: string | undefined;
1494
+ section?: string | undefined;
1495
+ availableWhen?: import("./condition.js").Condition | undefined;
1496
+ progress?: {
1497
+ target: number;
1498
+ counter: string;
1499
+ } | undefined;
1500
+ steps?: {
1501
+ label: string;
1502
+ id: string;
1503
+ done: import("./condition.js").Condition;
1504
+ }[] | undefined;
1505
+ }[];
1506
+ collectibles: {
1507
+ id: string;
1508
+ title: string;
1509
+ noun: string;
1510
+ icon?: string | undefined;
1511
+ entries?: {
1512
+ id: string;
1513
+ name: string;
1514
+ locationId?: string | undefined;
1515
+ pinId?: string | undefined;
1516
+ collectedBy?: import("./condition.js").Condition | undefined;
1517
+ locationName?: string | undefined;
1518
+ needs?: string[][] | undefined;
1519
+ }[] | undefined;
1520
+ counter?: string | undefined;
1521
+ localSource?: {
1522
+ key: string;
1523
+ file: string;
1524
+ } | undefined;
1525
+ }[];
1526
+ reference: {
1527
+ entries: {
1528
+ id: string;
1529
+ title: string;
1530
+ notes?: string[] | undefined;
1531
+ badge?: string | undefined;
1532
+ sequence?: string[] | undefined;
1533
+ rows?: {
1534
+ label: string;
1535
+ detail: string;
1536
+ }[] | undefined;
1537
+ revealWhen?: import("./condition.js").Condition | undefined;
1538
+ }[];
1539
+ id: string;
1540
+ title: string;
1541
+ badge?: string | undefined;
1542
+ defaultOpen?: boolean | undefined;
1543
+ }[];
1544
+ pinRules: {
1545
+ id: string;
1546
+ match: {
1547
+ label?: string | undefined;
1548
+ at?: string | undefined;
1549
+ kind?: string | undefined;
1550
+ ids?: string[] | undefined;
1551
+ labelContains?: string | undefined;
1552
+ };
1553
+ icon?: string | undefined;
1554
+ collectedBy?: import("./condition.js").Condition | undefined;
1555
+ hiddenWhen?: import("./condition.js").Condition | undefined;
1556
+ }[];
1557
+ pinCategories?: {
1558
+ label: string;
1559
+ id: string;
1560
+ shownByDefault: boolean;
1561
+ icon?: string | undefined;
1562
+ }[] | undefined;
1563
+ variants?: {
1564
+ label: string;
1565
+ id: string;
1566
+ shuffled?: boolean | undefined;
1567
+ }[] | undefined;
1568
+ }, {
1569
+ counters: {
1570
+ label: string;
1571
+ id: string;
1572
+ icon?: string | undefined;
1573
+ max?: string | number | undefined;
1574
+ format?: "number" | "duration" | "percent" | undefined;
1575
+ display?: Record<string, string> | undefined;
1576
+ role?: "keys" | "health" | "magic" | "armor" | undefined;
1577
+ }[];
1578
+ flagSets: string[];
1579
+ items: {
1580
+ label: string;
1581
+ id: string;
1582
+ icon?: string | undefined;
1583
+ source?: string | undefined;
1584
+ category?: string | undefined;
1585
+ short?: string | undefined;
1586
+ count?: string | undefined;
1587
+ }[];
1588
+ chips: {
1589
+ label: string;
1590
+ id: string;
1591
+ prompt: string;
1592
+ when?: import("./condition.js").Condition | undefined;
1593
+ }[];
1594
+ inventoryLayouts: ({
1595
+ id: string;
1596
+ title: string;
1597
+ kind: "slotGrid";
1598
+ columns: number;
1599
+ slots: string[];
1600
+ } | {
1601
+ id: string;
1602
+ title: string;
1603
+ counters: string[];
1604
+ kind: "counters";
1605
+ hideMissing?: boolean | undefined;
1606
+ })[];
1607
+ missions: {
1608
+ id: string;
1609
+ title: string;
1610
+ done: import("./condition.js").Condition;
1611
+ group: "main" | "side";
1612
+ detail?: string | undefined;
1613
+ ask?: string | undefined;
1614
+ location?: string | undefined;
1615
+ section?: string | undefined;
1616
+ availableWhen?: import("./condition.js").Condition | undefined;
1617
+ progress?: {
1618
+ target: number;
1619
+ counter: string;
1620
+ } | undefined;
1621
+ steps?: {
1622
+ label: string;
1623
+ id: string;
1624
+ done: import("./condition.js").Condition;
1625
+ }[] | undefined;
1626
+ }[];
1627
+ collectibles: {
1628
+ id: string;
1629
+ title: string;
1630
+ noun: string;
1631
+ icon?: string | undefined;
1632
+ entries?: {
1633
+ id: string;
1634
+ name: string;
1635
+ locationId?: string | undefined;
1636
+ pinId?: string | undefined;
1637
+ collectedBy?: import("./condition.js").Condition | undefined;
1638
+ locationName?: string | undefined;
1639
+ needs?: string[][] | undefined;
1640
+ }[] | undefined;
1641
+ counter?: string | undefined;
1642
+ localSource?: {
1643
+ key: string;
1644
+ file: string;
1645
+ } | undefined;
1646
+ }[];
1647
+ reference: {
1648
+ entries: {
1649
+ id: string;
1650
+ title: string;
1651
+ notes?: string[] | undefined;
1652
+ badge?: string | undefined;
1653
+ sequence?: string[] | undefined;
1654
+ rows?: {
1655
+ label: string;
1656
+ detail: string;
1657
+ }[] | undefined;
1658
+ revealWhen?: import("./condition.js").Condition | undefined;
1659
+ }[];
1660
+ id: string;
1661
+ title: string;
1662
+ badge?: string | undefined;
1663
+ defaultOpen?: boolean | undefined;
1664
+ }[];
1665
+ pinRules: {
1666
+ id: string;
1667
+ match: {
1668
+ label?: string | undefined;
1669
+ at?: string | undefined;
1670
+ kind?: string | undefined;
1671
+ ids?: string[] | undefined;
1672
+ labelContains?: string | undefined;
1673
+ };
1674
+ icon?: string | undefined;
1675
+ collectedBy?: import("./condition.js").Condition | undefined;
1676
+ hiddenWhen?: import("./condition.js").Condition | undefined;
1677
+ }[];
1678
+ pinCategories?: {
1679
+ label: string;
1680
+ id: string;
1681
+ shownByDefault: boolean;
1682
+ icon?: string | undefined;
1683
+ }[] | undefined;
1684
+ variants?: {
1685
+ label: string;
1686
+ id: string;
1687
+ shuffled?: boolean | undefined;
1688
+ }[] | undefined;
1689
+ }>;
1690
+ /** Scale of the game's world coordinates, for distances shown to the player and the AI. */
1691
+ world: z.ZodObject<{
1692
+ unitsPerMeter: z.ZodNumber;
1693
+ /** true when +Z points north (Doom); otherwise +Z points south (the Zelda ports). */
1694
+ northIsPositiveZ: z.ZodOptional<z.ZodBoolean>;
1695
+ }, "strip", z.ZodTypeAny, {
1696
+ unitsPerMeter: number;
1697
+ northIsPositiveZ?: boolean | undefined;
1698
+ }, {
1699
+ unitsPerMeter: number;
1700
+ northIsPositiveZ?: boolean | undefined;
1701
+ }>;
1702
+ /** Panels the game leaves out because they wouldn't help its player. */
1703
+ panels: z.ZodOptional<z.ZodObject<{
1704
+ /** false: play has no space to map (a single-screen puzzle); the map panel isn't offered */
1705
+ map: z.ZodOptional<z.ZodBoolean>;
1706
+ }, "strip", z.ZodTypeAny, {
1707
+ map?: boolean | undefined;
1708
+ }, {
1709
+ map?: boolean | undefined;
1710
+ }>>;
1711
+ } & {
1712
+ /** a loaded plugin's asset code builds this game's maps and assets from the player's own
1713
+ * files (the cog's build button) */
1714
+ buildsAssets: z.ZodBoolean;
1715
+ }, "strip", z.ZodTypeAny, {
1716
+ id: string;
1717
+ title: string;
1718
+ world: {
1719
+ unitsPerMeter: number;
1720
+ northIsPositiveZ?: boolean | undefined;
1721
+ };
1722
+ catalogue: {
1723
+ counters: {
1724
+ label: string;
1725
+ id: string;
1726
+ icon?: string | undefined;
1727
+ max?: string | number | undefined;
1728
+ format?: "number" | "duration" | "percent" | undefined;
1729
+ display?: Record<string, string> | undefined;
1730
+ role?: "keys" | "health" | "magic" | "armor" | undefined;
1731
+ }[];
1732
+ flagSets: string[];
1733
+ items: {
1734
+ label: string;
1735
+ id: string;
1736
+ icon?: string | undefined;
1737
+ source?: string | undefined;
1738
+ category?: string | undefined;
1739
+ short?: string | undefined;
1740
+ count?: string | undefined;
1741
+ }[];
1742
+ chips: {
1743
+ label: string;
1744
+ id: string;
1745
+ prompt: string;
1746
+ when?: import("./condition.js").Condition | undefined;
1747
+ }[];
1748
+ inventoryLayouts: ({
1749
+ id: string;
1750
+ title: string;
1751
+ kind: "slotGrid";
1752
+ columns: number;
1753
+ slots: string[];
1754
+ } | {
1755
+ id: string;
1756
+ title: string;
1757
+ counters: string[];
1758
+ kind: "counters";
1759
+ hideMissing?: boolean | undefined;
1760
+ })[];
1761
+ missions: {
1762
+ id: string;
1763
+ title: string;
1764
+ done: import("./condition.js").Condition;
1765
+ group: "main" | "side";
1766
+ detail?: string | undefined;
1767
+ ask?: string | undefined;
1768
+ location?: string | undefined;
1769
+ section?: string | undefined;
1770
+ availableWhen?: import("./condition.js").Condition | undefined;
1771
+ progress?: {
1772
+ target: number;
1773
+ counter: string;
1774
+ } | undefined;
1775
+ steps?: {
1776
+ label: string;
1777
+ id: string;
1778
+ done: import("./condition.js").Condition;
1779
+ }[] | undefined;
1780
+ }[];
1781
+ collectibles: {
1782
+ id: string;
1783
+ title: string;
1784
+ noun: string;
1785
+ icon?: string | undefined;
1786
+ entries?: {
1787
+ id: string;
1788
+ name: string;
1789
+ locationId?: string | undefined;
1790
+ pinId?: string | undefined;
1791
+ collectedBy?: import("./condition.js").Condition | undefined;
1792
+ locationName?: string | undefined;
1793
+ needs?: string[][] | undefined;
1794
+ }[] | undefined;
1795
+ counter?: string | undefined;
1796
+ localSource?: {
1797
+ key: string;
1798
+ file: string;
1799
+ } | undefined;
1800
+ }[];
1801
+ reference: {
1802
+ entries: {
1803
+ id: string;
1804
+ title: string;
1805
+ notes?: string[] | undefined;
1806
+ badge?: string | undefined;
1807
+ sequence?: string[] | undefined;
1808
+ rows?: {
1809
+ label: string;
1810
+ detail: string;
1811
+ }[] | undefined;
1812
+ revealWhen?: import("./condition.js").Condition | undefined;
1813
+ }[];
1814
+ id: string;
1815
+ title: string;
1816
+ badge?: string | undefined;
1817
+ defaultOpen?: boolean | undefined;
1818
+ }[];
1819
+ pinRules: {
1820
+ id: string;
1821
+ match: {
1822
+ label?: string | undefined;
1823
+ at?: string | undefined;
1824
+ kind?: string | undefined;
1825
+ ids?: string[] | undefined;
1826
+ labelContains?: string | undefined;
1827
+ };
1828
+ icon?: string | undefined;
1829
+ collectedBy?: import("./condition.js").Condition | undefined;
1830
+ hiddenWhen?: import("./condition.js").Condition | undefined;
1831
+ }[];
1832
+ pinCategories?: {
1833
+ label: string;
1834
+ id: string;
1835
+ shownByDefault: boolean;
1836
+ icon?: string | undefined;
1837
+ }[] | undefined;
1838
+ variants?: {
1839
+ label: string;
1840
+ id: string;
1841
+ shuffled?: boolean | undefined;
1842
+ }[] | undefined;
1843
+ };
1844
+ buildsAssets: boolean;
1845
+ panels?: {
1846
+ map?: boolean | undefined;
1847
+ } | undefined;
1848
+ }, {
1849
+ id: string;
1850
+ title: string;
1851
+ world: {
1852
+ unitsPerMeter: number;
1853
+ northIsPositiveZ?: boolean | undefined;
1854
+ };
1855
+ catalogue: {
1856
+ counters: {
1857
+ label: string;
1858
+ id: string;
1859
+ icon?: string | undefined;
1860
+ max?: string | number | undefined;
1861
+ format?: "number" | "duration" | "percent" | undefined;
1862
+ display?: Record<string, string> | undefined;
1863
+ role?: "keys" | "health" | "magic" | "armor" | undefined;
1864
+ }[];
1865
+ flagSets: string[];
1866
+ items: {
1867
+ label: string;
1868
+ id: string;
1869
+ icon?: string | undefined;
1870
+ source?: string | undefined;
1871
+ category?: string | undefined;
1872
+ short?: string | undefined;
1873
+ count?: string | undefined;
1874
+ }[];
1875
+ chips: {
1876
+ label: string;
1877
+ id: string;
1878
+ prompt: string;
1879
+ when?: import("./condition.js").Condition | undefined;
1880
+ }[];
1881
+ inventoryLayouts: ({
1882
+ id: string;
1883
+ title: string;
1884
+ kind: "slotGrid";
1885
+ columns: number;
1886
+ slots: string[];
1887
+ } | {
1888
+ id: string;
1889
+ title: string;
1890
+ counters: string[];
1891
+ kind: "counters";
1892
+ hideMissing?: boolean | undefined;
1893
+ })[];
1894
+ missions: {
1895
+ id: string;
1896
+ title: string;
1897
+ done: import("./condition.js").Condition;
1898
+ group: "main" | "side";
1899
+ detail?: string | undefined;
1900
+ ask?: string | undefined;
1901
+ location?: string | undefined;
1902
+ section?: string | undefined;
1903
+ availableWhen?: import("./condition.js").Condition | undefined;
1904
+ progress?: {
1905
+ target: number;
1906
+ counter: string;
1907
+ } | undefined;
1908
+ steps?: {
1909
+ label: string;
1910
+ id: string;
1911
+ done: import("./condition.js").Condition;
1912
+ }[] | undefined;
1913
+ }[];
1914
+ collectibles: {
1915
+ id: string;
1916
+ title: string;
1917
+ noun: string;
1918
+ icon?: string | undefined;
1919
+ entries?: {
1920
+ id: string;
1921
+ name: string;
1922
+ locationId?: string | undefined;
1923
+ pinId?: string | undefined;
1924
+ collectedBy?: import("./condition.js").Condition | undefined;
1925
+ locationName?: string | undefined;
1926
+ needs?: string[][] | undefined;
1927
+ }[] | undefined;
1928
+ counter?: string | undefined;
1929
+ localSource?: {
1930
+ key: string;
1931
+ file: string;
1932
+ } | undefined;
1933
+ }[];
1934
+ reference: {
1935
+ entries: {
1936
+ id: string;
1937
+ title: string;
1938
+ notes?: string[] | undefined;
1939
+ badge?: string | undefined;
1940
+ sequence?: string[] | undefined;
1941
+ rows?: {
1942
+ label: string;
1943
+ detail: string;
1944
+ }[] | undefined;
1945
+ revealWhen?: import("./condition.js").Condition | undefined;
1946
+ }[];
1947
+ id: string;
1948
+ title: string;
1949
+ badge?: string | undefined;
1950
+ defaultOpen?: boolean | undefined;
1951
+ }[];
1952
+ pinRules: {
1953
+ id: string;
1954
+ match: {
1955
+ label?: string | undefined;
1956
+ at?: string | undefined;
1957
+ kind?: string | undefined;
1958
+ ids?: string[] | undefined;
1959
+ labelContains?: string | undefined;
1960
+ };
1961
+ icon?: string | undefined;
1962
+ collectedBy?: import("./condition.js").Condition | undefined;
1963
+ hiddenWhen?: import("./condition.js").Condition | undefined;
1964
+ }[];
1965
+ pinCategories?: {
1966
+ label: string;
1967
+ id: string;
1968
+ shownByDefault: boolean;
1969
+ icon?: string | undefined;
1970
+ }[] | undefined;
1971
+ variants?: {
1972
+ label: string;
1973
+ id: string;
1974
+ shuffled?: boolean | undefined;
1975
+ }[] | undefined;
1976
+ };
1977
+ buildsAssets: boolean;
1978
+ panels?: {
1979
+ map?: boolean | undefined;
1980
+ } | undefined;
1981
+ }>;
1982
+ export type ServedPackData = z.infer<typeof ServedPackDataSchema>;
992
1983
  /**
993
1984
  * Everything about one game, as a plugin exports it from its live.ts: its data, plus code the
994
1985
  * daemon runs over the live state to produce `PackViews`.
package/lib/pack.js CHANGED
@@ -22,6 +22,12 @@ export const PackDataSchema = z.object({
22
22
  })
23
23
  .optional(),
24
24
  });
25
+ /** A pack's data as the daemon serves it, with what the core knows about the game. */
26
+ export const ServedPackDataSchema = PackDataSchema.extend({
27
+ /** a loaded plugin's asset code builds this game's maps and assets from the player's own
28
+ * files (the cog's build button) */
29
+ buildsAssets: z.boolean(),
30
+ });
25
31
  /** The data part of a pack, without its code. */
26
32
  export function packToData(pack) {
27
33
  return {
@@ -391,6 +391,23 @@ export declare const JobStatusSchema: z.ZodObject<{
391
391
  building?: string[] | undefined;
392
392
  }>;
393
393
  export type JobStatus = z.infer<typeof JobStatusSchema>;
394
+ /** A plugin the core found but refused to load (bad manifest, failed checks, a game another
395
+ * plugin already provides). */
396
+ export declare const RefusedPluginSchema: z.ZodObject<{
397
+ /** its id, or its folder's name when its manifest can't be read */
398
+ name: z.ZodString;
399
+ version: z.ZodNullable<z.ZodString>;
400
+ reason: z.ZodString;
401
+ }, "strip", z.ZodTypeAny, {
402
+ name: string;
403
+ version: string | null;
404
+ reason: string;
405
+ }, {
406
+ name: string;
407
+ version: string | null;
408
+ reason: string;
409
+ }>;
410
+ export type RefusedPlugin = z.infer<typeof RefusedPluginSchema>;
394
411
  export declare const PluginsResponseSchema: z.ZodObject<{
395
412
  plugins: z.ZodArray<z.ZodObject<{
396
413
  id: z.ZodString;
@@ -710,6 +727,21 @@ export declare const PluginsResponseSchema: z.ZodObject<{
710
727
  name: string;
711
728
  version: string;
712
729
  }>, "many">;
730
+ /** plugins found but not loaded, with the reason */
731
+ refused: z.ZodArray<z.ZodObject<{
732
+ /** its id, or its folder's name when its manifest can't be read */
733
+ name: z.ZodString;
734
+ version: z.ZodNullable<z.ZodString>;
735
+ reason: z.ZodString;
736
+ }, "strip", z.ZodTypeAny, {
737
+ name: string;
738
+ version: string | null;
739
+ reason: string;
740
+ }, {
741
+ name: string;
742
+ version: string | null;
743
+ reason: string;
744
+ }>, "many">;
713
745
  /** why plugins can't be added, updated or removed right now (the daemon's install record is
714
746
  * damaged), or null */
715
747
  installError: z.ZodNullable<z.ZodString>;
@@ -779,6 +811,11 @@ export declare const PluginsResponseSchema: z.ZodObject<{
779
811
  error?: string | undefined;
780
812
  building?: string[] | undefined;
781
813
  } | null;
814
+ refused: {
815
+ name: string;
816
+ version: string | null;
817
+ reason: string;
818
+ }[];
782
819
  installError: string | null;
783
820
  }, {
784
821
  hidden: {
@@ -846,6 +883,11 @@ export declare const PluginsResponseSchema: z.ZodObject<{
846
883
  error?: string | undefined;
847
884
  building?: string[] | undefined;
848
885
  } | null;
886
+ refused: {
887
+ name: string;
888
+ version: string | null;
889
+ reason: string;
890
+ }[];
849
891
  installError: string | null;
850
892
  }>;
851
893
  export type PluginsResponse = z.infer<typeof PluginsResponseSchema>;
@@ -69,11 +69,21 @@ export const JobStatusSchema = z.object({
69
69
  failures: z.array(z.object({ label: z.string(), error: z.string() })),
70
70
  error: z.string().optional(),
71
71
  });
72
+ /** A plugin the core found but refused to load (bad manifest, failed checks, a game another
73
+ * plugin already provides). */
74
+ export const RefusedPluginSchema = z.object({
75
+ /** its id, or its folder's name when its manifest can't be read */
76
+ name: z.string(),
77
+ version: z.string().nullable(),
78
+ reason: z.string(),
79
+ });
72
80
  export const PluginsResponseSchema = z.object({
73
81
  plugins: z.array(PluginViewSchema),
74
82
  job: JobStatusSchema.nullable(),
75
83
  /** presets the player hid: not loaded, offered to show again */
76
84
  hidden: z.array(z.object({ id: z.string(), name: z.string(), version: z.string() })),
85
+ /** plugins found but not loaded, with the reason */
86
+ refused: z.array(RefusedPluginSchema),
77
87
  /** why plugins can't be added, updated or removed right now (the daemon's install record is
78
88
  * damaged), or null */
79
89
  installError: z.string().nullable(),
package/lib/types.d.ts CHANGED
@@ -2673,14 +2673,15 @@ export declare const ServerWsMessageSchema: z.ZodDiscriminatedUnion<"type", [z.Z
2673
2673
  timestamp: number;
2674
2674
  }>, z.ZodObject<{
2675
2675
  type: z.ZodLiteral<"error">;
2676
- code: z.ZodEnum<["unauthorized", "bad_request"]>;
2676
+ /** not_paired: a screen that may view, without the pairing token, tried a change */
2677
+ code: z.ZodEnum<["unauthorized", "bad_request", "not_paired"]>;
2677
2678
  message: z.ZodString;
2678
2679
  }, "strip", z.ZodTypeAny, {
2679
- code: "unauthorized" | "bad_request";
2680
+ code: "unauthorized" | "bad_request" | "not_paired";
2680
2681
  message: string;
2681
2682
  type: "error";
2682
2683
  }, {
2683
- code: "unauthorized" | "bad_request";
2684
+ code: "unauthorized" | "bad_request" | "not_paired";
2684
2685
  message: string;
2685
2686
  type: "error";
2686
2687
  }>]>;
package/lib/types.js CHANGED
@@ -277,7 +277,8 @@ export const ServerWsMessageSchema = z.discriminatedUnion('type', [
277
277
  }),
278
278
  z.object({
279
279
  type: z.literal('error'),
280
- code: z.enum(['unauthorized', 'bad_request']),
280
+ /** not_paired: a screen that may view, without the pairing token, tried a change */
281
+ code: z.enum(['unauthorized', 'bad_request', 'not_paired']),
281
282
  message: z.string(),
282
283
  }),
283
284
  ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gameslate/sdk",
3
- "version": "0.3.19",
3
+ "version": "0.3.20",
4
4
  "description": "Build plugins for GameSlate, the second-screen companion for PC games: the plugin contract, game-state and catalogue schemas, and the plugin builder.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -334,8 +334,11 @@ A plugin carries its games' committed map data in `plugin/registry/games/<gameId
334
334
  into the bundle, and the core serves it at `/registry/games/<gameId>/…`. `gameslate-plugin
335
335
  validate` and the core's loader refuse a plugin whose registry carries a game its manifest doesn't
336
336
  list, a file outside that layout, a file failing its schema, a layer naming a missing SVG, or an
337
- SVG with anything but `svg g path polygon polyline rect circle line text title`. Two plugins
338
- carrying the same game stop the core.
337
+ SVG with anything but `svg g path polygon polyline rect circle line text title`. Of two plugins
338
+ carrying the same game (id or alias), the second is refused. Every refused plugin is listed in
339
+ the cog as "Not loaded: <id> <version>: <reason>": look there first when a deployed plugin is
340
+ missing. A game whose plugin has asset code tells the player, on a place without a map, that its
341
+ maps aren't built yet and to press "Build maps" in the cog, until an extraction has run.
339
342
 
340
343
  Commit only simplified data you produced: schematic SVGs, pins, affines, location and item names,
341
344
  your own hint prose. Game text (objective and dialogue strings from the game's language files) is