@gameslate/sdk 0.3.27 → 0.3.29

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.
@@ -13,7 +13,9 @@ import { initPlugin } from '../build/init-plugin.mjs';
13
13
  * Scaffolds a new plugin repository: an example plugin, a sandbox test, CI.
14
14
  * gameslate-plugin validate <builtDir> [--core-version <version>]
15
15
  * Checks a built plugin exactly as the core does before running it: manifest, contract,
16
- * hashes, then its live and asset code loaded in the core's own sandbox.
16
+ * hashes, then its live and asset code loaded in the core's own sandbox. Then the author's
17
+ * own checks, which the core doesn't refuse a plugin over: registry pins in a category their
18
+ * pack doesn't declare (src/host/validate.ts).
17
19
  * gameslate-plugin verify <verify.json>
18
20
  * Runs the game to a known moment (RetroArch on a save state) and checks what a local
19
21
  * GameSlate daemon reports, and the emulator's own memory reads, against the file.
@@ -48,29 +50,6 @@ const USAGE = [
48
50
  ' gameslate-plugin names <map or symbol file> … does the decomp name the game? (triage)',
49
51
  ].join('\n');
50
52
 
51
- async function validate(builtDir) {
52
- const { inspectPlugin, loadQuickJs, readPluginManifest } = await import('../lib/host/index.js');
53
- const read = readPluginManifest(builtDir);
54
- if ('problem' in read) return [read.problem];
55
- const { manifest } = read;
56
- const coreVersion = values['core-version'] ?? manifest.testedWith[0] ?? '0.0.0';
57
- const result = inspectPlugin(await loadQuickJs(), builtDir, manifest, {
58
- coreVersion,
59
- log: line => console.error(line),
60
- });
61
- if (typeof result === 'string') return [result];
62
- const { live, assets, registryGames, warnings } = result;
63
- console.log(`${manifest.id} ${manifest.version} (contract ${manifest.sdkApi}): OK`);
64
- console.log(` packs: ${live.packs.map(p => p.id).join(', ') || 'none'}`);
65
- console.log(
66
- ` sources: ${live.sources.map(s => `${s.gameId} (${s.supportedBuildIds.size} builds)`).join(', ') || 'none'}`,
67
- );
68
- console.log(` assets: ${assets?.games.join(', ') || 'none'}`);
69
- console.log(` registry: ${registryGames.join(', ') || 'none'}`);
70
- for (const w of warnings) console.log(` warning: ${w}`);
71
- return [];
72
- }
73
-
74
53
  if (command === 'build' && dir && values.out) {
75
54
  const built = await buildPlugin({
76
55
  srcDir: path.resolve(dir),
@@ -93,8 +72,13 @@ if (command === 'build' && dir && values.out) {
93
72
  });
94
73
  console.log(`created ${dir}: yarn install && yarn check`);
95
74
  } else if (command === 'validate' && dir) {
96
- const problems = await validate(path.resolve(dir));
97
- for (const p of problems) console.error(`refused: ${p}`);
75
+ const { validatePlugin } = await import('../lib/host/index.js');
76
+ const { report, problems } = await validatePlugin(path.resolve(dir), {
77
+ coreVersion: values['core-version'],
78
+ log: line => console.error(line),
79
+ });
80
+ for (const line of report) console.log(line);
81
+ for (const p of problems) console.error(p);
98
82
  process.exit(problems.length ? 1 : 0);
99
83
  } else if (command === 'verify' && dir) {
100
84
  const { expandEnv, runVerify, VerifySpecSchema } = await import('../lib/host/index.js');
@@ -198,7 +182,7 @@ if (command === 'build' && dir && values.out) {
198
182
  console.error(`refused: ${inspected}`);
199
183
  process.exit(1);
200
184
  }
201
- codeByGame = supportContextsFromPlugin(inspected);
185
+ codeByGame = supportContextsFromPlugin(inspected, builtDir);
202
186
  }
203
187
  const { entries, problems } = verifyOrWriteSupportDocs({
204
188
  gamesDir,
@@ -571,16 +571,24 @@ export declare const PinCategorySchema: z.ZodObject<{
571
571
  shownByDefault: z.ZodBoolean;
572
572
  /** the map glyph for its pins: key, weapon, health, armor, ammo, powerup, bonus, secret, door, switch, item */
573
573
  icon: z.ZodOptional<z.ZodString>;
574
+ /**
575
+ * How many leading sentences of a pin's `context` its spot card shows, so a spoiler (how a
576
+ * secret opens) waits until the player asks the AI, which gets all of it. Absent: the whole
577
+ * context.
578
+ */
579
+ cardSentences: z.ZodOptional<z.ZodNumber>;
574
580
  }, "strip", z.ZodTypeAny, {
575
581
  label: string;
576
582
  id: string;
577
583
  shownByDefault: boolean;
578
584
  icon?: string | undefined;
585
+ cardSentences?: number | undefined;
579
586
  }, {
580
587
  label: string;
581
588
  id: string;
582
589
  shownByDefault: boolean;
583
590
  icon?: string | undefined;
591
+ cardSentences?: number | undefined;
584
592
  }>;
585
593
  export type PinCategory = z.infer<typeof PinCategorySchema>;
586
594
  export declare const CatalogueSchema: z.ZodObject<{
@@ -1042,16 +1050,24 @@ export declare const CatalogueSchema: z.ZodObject<{
1042
1050
  shownByDefault: z.ZodBoolean;
1043
1051
  /** the map glyph for its pins: key, weapon, health, armor, ammo, powerup, bonus, secret, door, switch, item */
1044
1052
  icon: z.ZodOptional<z.ZodString>;
1053
+ /**
1054
+ * How many leading sentences of a pin's `context` its spot card shows, so a spoiler (how a
1055
+ * secret opens) waits until the player asks the AI, which gets all of it. Absent: the whole
1056
+ * context.
1057
+ */
1058
+ cardSentences: z.ZodOptional<z.ZodNumber>;
1045
1059
  }, "strip", z.ZodTypeAny, {
1046
1060
  label: string;
1047
1061
  id: string;
1048
1062
  shownByDefault: boolean;
1049
1063
  icon?: string | undefined;
1064
+ cardSentences?: number | undefined;
1050
1065
  }, {
1051
1066
  label: string;
1052
1067
  id: string;
1053
1068
  shownByDefault: boolean;
1054
1069
  icon?: string | undefined;
1070
+ cardSentences?: number | undefined;
1055
1071
  }>, "many">>;
1056
1072
  /** the variants `state.variant` may name (vanilla, master quest, randomizer, …) */
1057
1073
  variants: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -1183,6 +1199,7 @@ export declare const CatalogueSchema: z.ZodObject<{
1183
1199
  id: string;
1184
1200
  shownByDefault: boolean;
1185
1201
  icon?: string | undefined;
1202
+ cardSentences?: number | undefined;
1186
1203
  }[] | undefined;
1187
1204
  variants?: {
1188
1205
  label: string;
@@ -1304,6 +1321,7 @@ export declare const CatalogueSchema: z.ZodObject<{
1304
1321
  id: string;
1305
1322
  shownByDefault: boolean;
1306
1323
  icon?: string | undefined;
1324
+ cardSentences?: number | undefined;
1307
1325
  }[] | undefined;
1308
1326
  variants?: {
1309
1327
  label: string;
package/lib/catalogue.js CHANGED
@@ -191,6 +191,12 @@ export const PinCategorySchema = z.object({
191
191
  shownByDefault: z.boolean(),
192
192
  /** the map glyph for its pins: key, weapon, health, armor, ammo, powerup, bonus, secret, door, switch, item */
193
193
  icon: z.string().optional(),
194
+ /**
195
+ * How many leading sentences of a pin's `context` its spot card shows, so a spoiler (how a
196
+ * secret opens) waits until the player asks the AI, which gets all of it. Absent: the whole
197
+ * context.
198
+ */
199
+ cardSentences: z.number().int().positive().optional(),
194
200
  });
195
201
  export const CatalogueSchema = z
196
202
  .object({
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import type { GameCapability } from './types.js';
3
3
  import type { GamePack } from './pack.js';
4
+ import { type GameManifest } from './registry.js';
4
5
  export declare const SUPPORT_TABLE_START = "<!-- gameslate:support-table:start -->";
5
6
  export declare const SUPPORT_TABLE_END = "<!-- gameslate:support-table:end -->";
6
7
  export declare const REQUIRED_SUPPORT_HEADINGS: readonly ["## Builds & Asset Extraction", "## Map", "## Vitals, Inventory, Missions & Reference", "## Known Gaps", "## Verification"];
@@ -81,6 +82,7 @@ export declare const GameSupportSchema: z.ZodObject<{
81
82
  exits: z.ZodBoolean;
82
83
  collectiblesOrItems: z.ZodBoolean;
83
84
  objectives: z.ZodBoolean;
85
+ pointsOfInterest: z.ZodBoolean;
84
86
  autoHideCollected: z.ZodBoolean;
85
87
  customNotes: z.ZodBoolean;
86
88
  wayfinding: z.ZodBoolean;
@@ -88,6 +90,7 @@ export declare const GameSupportSchema: z.ZodObject<{
88
90
  objectives: boolean;
89
91
  exits: boolean;
90
92
  collectiblesOrItems: boolean;
93
+ pointsOfInterest: boolean;
91
94
  autoHideCollected: boolean;
92
95
  customNotes: boolean;
93
96
  wayfinding: boolean;
@@ -95,6 +98,7 @@ export declare const GameSupportSchema: z.ZodObject<{
95
98
  objectives: boolean;
96
99
  exits: boolean;
97
100
  collectiblesOrItems: boolean;
101
+ pointsOfInterest: boolean;
98
102
  autoHideCollected: boolean;
99
103
  customNotes: boolean;
100
104
  wayfinding: boolean;
@@ -123,6 +127,7 @@ export declare const GameSupportSchema: z.ZodObject<{
123
127
  objectives: boolean;
124
128
  exits: boolean;
125
129
  collectiblesOrItems: boolean;
130
+ pointsOfInterest: boolean;
126
131
  autoHideCollected: boolean;
127
132
  customNotes: boolean;
128
133
  wayfinding: boolean;
@@ -151,6 +156,7 @@ export declare const GameSupportSchema: z.ZodObject<{
151
156
  objectives: boolean;
152
157
  exits: boolean;
153
158
  collectiblesOrItems: boolean;
159
+ pointsOfInterest: boolean;
154
160
  autoHideCollected: boolean;
155
161
  customNotes: boolean;
156
162
  wayfinding: boolean;
@@ -273,6 +279,7 @@ export declare const GameSupportSchema: z.ZodObject<{
273
279
  objectives: boolean;
274
280
  exits: boolean;
275
281
  collectiblesOrItems: boolean;
282
+ pointsOfInterest: boolean;
276
283
  autoHideCollected: boolean;
277
284
  customNotes: boolean;
278
285
  wayfinding: boolean;
@@ -332,6 +339,7 @@ export declare const GameSupportSchema: z.ZodObject<{
332
339
  objectives: boolean;
333
340
  exits: boolean;
334
341
  collectiblesOrItems: boolean;
342
+ pointsOfInterest: boolean;
335
343
  autoHideCollected: boolean;
336
344
  customNotes: boolean;
337
345
  wayfinding: boolean;
@@ -385,6 +393,8 @@ export interface SupportCodeContext {
385
393
  hasAssetExtractor: boolean;
386
394
  /** Optional explicit timeline check (omitted for sandboxed packs whose `ui.timelines` is a host proxy). */
387
395
  hasTimelines?: boolean;
396
+ /** The game's registry locations from the built plugin; omitted when it carries none. */
397
+ registryLocations?: GameManifest['locations'];
388
398
  }
389
399
  /** Verifies that a game's README support spec agrees with its actual pack, sources, and extractor. */
390
400
  export declare function checkSupportAgainstCode(support: GameSupport, ctx: SupportCodeContext): string[];
@@ -1,5 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { parseSupportYaml } from './game-support-yaml.js';
3
+ import { pinRuleMatchesAt } from './pins.js';
4
+ import { effectiveLandmarkKind } from './registry.js';
3
5
  /*
4
6
  * Per-game README support specification: YAML frontmatter + required Markdown sections, validated
5
7
  * against the schema and cross-checked against the game's actual pack, live sources and asset
@@ -60,6 +62,9 @@ export const GameSupportSchema = z.object({
60
62
  exits: z.boolean(),
61
63
  collectiblesOrItems: z.boolean(),
62
64
  objectives: z.boolean(),
65
+ /* plain `kind: 'poi'` pins with no done state (vehicles, signposts, shops): required, so
66
+ * a pack upgrading the sdk says whether it has them rather than reading as "no" */
67
+ pointsOfInterest: z.boolean(),
63
68
  autoHideCollected: z.boolean(),
64
69
  customNotes: z.boolean(),
65
70
  wayfinding: z.boolean(),
@@ -118,6 +123,36 @@ export function parseGameSupportReadme(markdown) {
118
123
  }
119
124
  return { support: parsed.data, body, problems };
120
125
  }
126
+ /* a pin the app can mark collected or done from its own fields (web llm.ts `isLandmarkCollected`) */
127
+ const isTrackedPin = (pin) => pin.collectedBy !== undefined ||
128
+ pin.requiresObjective !== undefined ||
129
+ pin.chestFlag !== undefined ||
130
+ pin.gsFlag !== undefined;
131
+ /*
132
+ * One way only: pins extracted on the player's PC never reach the built plugin, so a game with no
133
+ * plain poi pin in its registry may still have them and `pointsOfInterest: true` can't be refused.
134
+ */
135
+ function checkPinsAgainstRegistry(support, ctx, problems) {
136
+ if (support.map.pins.pointsOfInterest || !ctx.registryLocations)
137
+ return;
138
+ const rules = ctx.pack.catalogue.pinRules.filter(r => r.collectedBy !== undefined);
139
+ const plain = [];
140
+ for (const [locationId, location] of Object.entries(ctx.registryLocations)) {
141
+ for (const layer of location.map?.layers ?? []) {
142
+ for (const pin of layer.landmarks) {
143
+ if (effectiveLandmarkKind(pin) !== 'poi' || isTrackedPin(pin))
144
+ continue;
145
+ /* the raw pin, as the app's collected check gets it (web llm.ts) */
146
+ if (rules.some(r => pinRuleMatchesAt(r, pin, locationId)))
147
+ continue;
148
+ plain.push(`"${pin.label}" (${pin.id}) in ${locationId}/${layer.id}`);
149
+ }
150
+ }
151
+ }
152
+ if (plain.length > 0) {
153
+ problems.push(`map.pins.pointsOfInterest is false but the registry has ${plain.length} poi pin${plain.length === 1 ? '' : 's'} with nothing to mark them collected or done (first: ${plain[0]})`);
154
+ }
155
+ }
121
156
  function checkMapAgainstCode(support, ctx, problems) {
122
157
  const hasMapCap = ctx.sources.some(s => s.capabilities.includes('map_2d'));
123
158
  const drawn = support.map.status === 'done' || support.map.status === 'partial';
@@ -192,6 +227,7 @@ export function checkSupportAgainstCode(support, ctx) {
192
227
  problems.push(`README build "${b}" is not in supportedBuildIds`);
193
228
  }
194
229
  checkMapAgainstCode(support, ctx, problems);
230
+ checkPinsAgainstRegistry(support, ctx, problems);
195
231
  checkPanelsAgainstCode(support, ctx, problems);
196
232
  return problems;
197
233
  }
@@ -242,15 +278,21 @@ function liveMapCell(m) {
242
278
  parts.push('rivals/players');
243
279
  return parts.length > 0 ? parts.join(', ') : '—';
244
280
  }
281
+ /* every flag, in the order the cell lists them */
282
+ const PIN_LABEL = {
283
+ exits: 'exits',
284
+ collectiblesOrItems: 'items',
285
+ objectives: 'objectives',
286
+ pointsOfInterest: 'POIs',
287
+ autoHideCollected: 'auto-hide',
288
+ wayfinding: 'wayfind',
289
+ customNotes: 'notes',
290
+ };
291
+ const isPinFlag = (key) => key in PIN_LABEL;
245
292
  function pinsCell(p) {
246
- const parts = [
247
- p.exits ? 'exits' : '',
248
- p.collectiblesOrItems ? 'items' : '',
249
- p.objectives ? 'objectives' : '',
250
- p.autoHideCollected ? 'auto-hide' : '',
251
- p.wayfinding ? 'wayfind' : '',
252
- p.customNotes ? 'notes' : '',
253
- ].filter(Boolean);
293
+ const parts = Object.entries(PIN_LABEL)
294
+ .filter(([flag]) => isPinFlag(flag) && p[flag])
295
+ .map(([, label]) => label);
254
296
  return parts.length > 0 ? parts.join(', ') : '—';
255
297
  }
256
298
  function invMissionsCell(panels) {
@@ -18,8 +18,9 @@ export interface VerifySupportOptions {
18
18
  /** When true, writes the updated table to `topReadmePath` instead of failing if out of date. */
19
19
  write?: boolean;
20
20
  }
21
- /** Builds `SupportCodeContext` map from an `InspectedPlugin` loaded by `inspectPlugin`. */
22
- export declare function supportContextsFromPlugin(inspected: InspectedPlugin): Map<string, SupportCodeContext>;
21
+ /** Builds `SupportCodeContext` map from an `InspectedPlugin` that `inspectPlugin` loaded from
22
+ * `builtDir`. */
23
+ export declare function supportContextsFromPlugin(inspected: Pick<InspectedPlugin, 'live' | 'assets' | 'registryGames'>, builtDir: string): Map<string, SupportCodeContext>;
23
24
  /** Validates every per-game README under `gamesDir` and checks or updates `topReadmePath`. */
24
25
  export declare function verifyOrWriteSupportDocs(opts: VerifySupportOptions): {
25
26
  entries: LoadedSupportEntry[];
@@ -1,6 +1,7 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import { checkSupportAgainstCode, parseGameSupportReadme, spliceSupportTable, } from '../game-support.js';
4
+ import { readRegistryManifest } from './plugin-registry.js';
4
5
  function locateGameReadme(gamesDir, gameId, singleFallback) {
5
6
  const sub = path.join(gamesDir, gameId, 'README.md');
6
7
  if (fs.existsSync(sub))
@@ -19,9 +20,11 @@ function discoverGameIds(gamesDir) {
19
20
  .map(d => d.name)
20
21
  .sort();
21
22
  }
22
- /** Builds `SupportCodeContext` map from an `InspectedPlugin` loaded by `inspectPlugin`. */
23
- export function supportContextsFromPlugin(inspected) {
23
+ /** Builds `SupportCodeContext` map from an `InspectedPlugin` that `inspectPlugin` loaded from
24
+ * `builtDir`. */
25
+ export function supportContextsFromPlugin(inspected, builtDir) {
24
26
  const assetGames = new Set(inspected.assets?.games ?? []);
27
+ const registryGames = new Set(inspected.registryGames);
25
28
  const map = new Map();
26
29
  for (const pack of inspected.live.packs) {
27
30
  const sources = inspected.live.sources.filter(s => s.gameId === pack.id);
@@ -29,6 +32,9 @@ export function supportContextsFromPlugin(inspected) {
29
32
  pack,
30
33
  sources,
31
34
  hasAssetExtractor: assetGames.has(pack.id),
35
+ ...(registryGames.has(pack.id) && {
36
+ registryLocations: readRegistryManifest(builtDir, pack.id).locations,
37
+ }),
32
38
  });
33
39
  }
34
40
  return map;
@@ -8,3 +8,4 @@ export * from './addresses.js';
8
8
  export * from './udp-ports.js';
9
9
  export * from './game-support.js';
10
10
  export * from './wasm-host.js';
11
+ export * from './validate.js';
package/lib/host/index.js CHANGED
@@ -12,3 +12,4 @@ export * from './addresses.js';
12
12
  export * from './udp-ports.js';
13
13
  export * from './game-support.js';
14
14
  export * from './wasm-host.js';
15
+ export * from './validate.js';
@@ -1,4 +1,6 @@
1
+ import type { GamePack } from '../pack.js';
1
2
  import type { PluginManifest } from '../plugin-manifest.js';
3
+ import { type GameManifest } from '../registry.js';
2
4
  export declare const REGISTRY_DIR = "registry";
3
5
  /** Why an SVG can't be served (a tag outside the set, a script hook, a bare `&`), or null. */
4
6
  export declare function svgProblem(text: string): string | null;
@@ -9,3 +11,13 @@ export declare function svgProblem(text: string): string | null;
9
11
  export declare function inspectPluginRegistry(dir: string, manifest: PluginManifest): {
10
12
  games: string[];
11
13
  } | string;
14
+ /** A game's registry manifest from a plugin folder `inspectPluginRegistry` passed; throws if it
15
+ * no longer parses. */
16
+ export declare function readRegistryManifest(dir: string, gameId: string): GameManifest;
17
+ /**
18
+ * Registry pins in a category their game's pack doesn't declare, one line per category
19
+ * (`undeclaredPinCategories`), for `gameslate-plugin validate`. `games` are the ones
20
+ * `inspectPluginRegistry` passed. The core's loader doesn't refuse these (the pins still draw,
21
+ * and a whole plugin shouldn't fail to load over a toggle), so the author hears it here.
22
+ */
23
+ export declare function registryPinCategoryProblems(dir: string, games: readonly string[], packs: readonly Pick<GamePack, 'id' | 'catalogue'>[]): string[];
@@ -1,5 +1,6 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
+ import { declaredPinCategories, undeclaredPinCategories } from '../pin-categories.js';
3
4
  import { GameManifestSchema, HintGraphSchema } from '../registry.js';
4
5
  /*
5
6
  * A plugin's registry data: the committed, simplified map data for its games, served by the core
@@ -128,3 +129,25 @@ export function inspectPluginRegistry(dir, manifest) {
128
129
  }
129
130
  return { games: games.sort() };
130
131
  }
132
+ /** A game's registry manifest from a plugin folder `inspectPluginRegistry` passed; throws if it
133
+ * no longer parses. */
134
+ export function readRegistryManifest(dir, gameId) {
135
+ const file = path.join(dir, REGISTRY_DIR, 'games', gameId, 'manifest.json');
136
+ const manifest = readJson(file, GameManifestSchema);
137
+ if (typeof manifest === 'string')
138
+ throw new Error(`${file}: ${manifest}`);
139
+ return manifest;
140
+ }
141
+ /**
142
+ * Registry pins in a category their game's pack doesn't declare, one line per category
143
+ * (`undeclaredPinCategories`), for `gameslate-plugin validate`. `games` are the ones
144
+ * `inspectPluginRegistry` passed. The core's loader doesn't refuse these (the pins still draw,
145
+ * and a whole plugin shouldn't fail to load over a toggle), so the author hears it here.
146
+ */
147
+ export function registryPinCategoryProblems(dir, games, packs) {
148
+ return games.flatMap(gameId => {
149
+ const manifest = readRegistryManifest(dir, gameId);
150
+ const declared = declaredPinCategories(packs, gameId);
151
+ return undeclaredPinCategories(gameId, manifest.locations, declared);
152
+ });
153
+ }
@@ -0,0 +1,10 @@
1
+ export interface Validation {
2
+ /** what the core makes of the plugin, and its warnings (empty when the core refuses it) */
3
+ report: string[];
4
+ /** each labelled: `refused: …` (the core won't load it), `pin category: …` */
5
+ problems: string[];
6
+ }
7
+ export declare function validatePlugin(builtDir: string, opts: {
8
+ coreVersion?: string;
9
+ log: (line: string) => void;
10
+ }): Promise<Validation>;
@@ -0,0 +1,36 @@
1
+ import { inspectPlugin, readPluginManifest } from './inspect.js';
2
+ import { loadQuickJs } from './quickjs-guest.js';
3
+ import { registryPinCategoryProblems } from './plugin-registry.js';
4
+ export async function validatePlugin(builtDir, opts) {
5
+ const read = readPluginManifest(builtDir);
6
+ if ('problem' in read)
7
+ return { report: [], problems: [`refused: ${read.problem}`] };
8
+ const { manifest } = read;
9
+ const coreVersion = opts.coreVersion ?? manifest.testedWith[0] ?? '0.0.0';
10
+ const result = inspectPlugin(await loadQuickJs(), builtDir, manifest, {
11
+ coreVersion,
12
+ log: opts.log,
13
+ });
14
+ if (typeof result === 'string')
15
+ return { report: [], problems: [`refused: ${result}`] };
16
+ try {
17
+ const { live, assets, registryGames, warnings } = result;
18
+ const problems = registryPinCategoryProblems(builtDir, registryGames, live.packs).map(p => `pin category: ${p}`);
19
+ const sources = live.sources.map(s => `${s.gameId} (${s.supportedBuildIds.size} builds)`);
20
+ const verdict = problems.length ? 'loads, with the problems below' : 'OK';
21
+ return {
22
+ report: [
23
+ `${manifest.id} ${manifest.version} (contract ${manifest.sdkApi}): ${verdict}`,
24
+ ` packs: ${live.packs.map(p => p.id).join(', ') || 'none'}`,
25
+ ` sources: ${sources.join(', ') || 'none'}`,
26
+ ` assets: ${assets?.games.join(', ') || 'none'}`,
27
+ ` registry: ${registryGames.join(', ') || 'none'}`,
28
+ ...warnings.map(w => ` warning: ${w}`),
29
+ ],
30
+ problems,
31
+ };
32
+ }
33
+ finally {
34
+ result.dispose();
35
+ }
36
+ }
@@ -1045,6 +1045,13 @@ export declare const VerifySpecSchema: z.ZodObject<{
1045
1045
  variant?: string | undefined;
1046
1046
  equipped?: string | null | undefined;
1047
1047
  };
1048
+ ui?: {
1049
+ url: string;
1050
+ tabs: ("Map" | "Inventory" | "Missions" | "Ref")[];
1051
+ } | {
1052
+ url: string;
1053
+ tabs: string[];
1054
+ } | undefined;
1048
1055
  gameslate?: string | undefined;
1049
1056
  retroarch?: {
1050
1057
  binary: string;
@@ -1059,13 +1066,6 @@ export declare const VerifySpecSchema: z.ZodObject<{
1059
1066
  launchPrefix: string[];
1060
1067
  command: string[];
1061
1068
  } | undefined;
1062
- ui?: {
1063
- url: string;
1064
- tabs: ("Map" | "Inventory" | "Missions" | "Ref")[];
1065
- } | {
1066
- url: string;
1067
- tabs: string[];
1068
- } | undefined;
1069
1069
  }, {
1070
1070
  game: string;
1071
1071
  expect: {
@@ -1149,6 +1149,10 @@ export declare const VerifySpecSchema: z.ZodObject<{
1149
1149
  } | {
1150
1150
  waitMs: number;
1151
1151
  })[] | undefined;
1152
+ ui?: string | {
1153
+ url: string;
1154
+ tabs?: string[] | undefined;
1155
+ } | undefined;
1152
1156
  memory?: {
1153
1157
  counter: string;
1154
1158
  size: 2 | 1 | 4;
@@ -1173,10 +1177,6 @@ export declare const VerifySpecSchema: z.ZodObject<{
1173
1177
  daemon?: {
1174
1178
  url?: string | undefined;
1175
1179
  } | undefined;
1176
- ui?: string | {
1177
- url: string;
1178
- tabs?: string[] | undefined;
1179
- } | undefined;
1180
1180
  settleMs?: number | undefined;
1181
1181
  }>;
1182
1182
  export type VerifySpec = z.infer<typeof VerifySpecSchema>;
package/lib/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from './condition.js';
5
5
  export * from './catalogue.js';
6
6
  export * from './status.js';
7
7
  export * from './pins.js';
8
+ export * from './pin-categories.js';
8
9
  export * from './chips.js';
9
10
  export * from './pack.js';
10
11
  export * from './views.js';
package/lib/index.js CHANGED
@@ -5,6 +5,7 @@ export * from './condition.js';
5
5
  export * from './catalogue.js';
6
6
  export * from './status.js';
7
7
  export * from './pins.js';
8
+ export * from './pin-categories.js';
8
9
  export * from './chips.js';
9
10
  export * from './pack.js';
10
11
  export * from './views.js';
package/lib/pack.d.ts CHANGED
@@ -435,16 +435,19 @@ export declare const PackDataSchema: z.ZodObject<{
435
435
  label: z.ZodString;
436
436
  shownByDefault: z.ZodBoolean;
437
437
  icon: z.ZodOptional<z.ZodString>;
438
+ cardSentences: z.ZodOptional<z.ZodNumber>;
438
439
  }, "strip", z.ZodTypeAny, {
439
440
  label: string;
440
441
  id: string;
441
442
  shownByDefault: boolean;
442
443
  icon?: string | undefined;
444
+ cardSentences?: number | undefined;
443
445
  }, {
444
446
  label: string;
445
447
  id: string;
446
448
  shownByDefault: boolean;
447
449
  icon?: string | undefined;
450
+ cardSentences?: number | undefined;
448
451
  }>, "many">>;
449
452
  variants: z.ZodOptional<z.ZodArray<z.ZodObject<{
450
453
  id: z.ZodString;
@@ -574,6 +577,7 @@ export declare const PackDataSchema: z.ZodObject<{
574
577
  id: string;
575
578
  shownByDefault: boolean;
576
579
  icon?: string | undefined;
580
+ cardSentences?: number | undefined;
577
581
  }[] | undefined;
578
582
  variants?: {
579
583
  label: string;
@@ -695,6 +699,7 @@ export declare const PackDataSchema: z.ZodObject<{
695
699
  id: string;
696
700
  shownByDefault: boolean;
697
701
  icon?: string | undefined;
702
+ cardSentences?: number | undefined;
698
703
  }[] | undefined;
699
704
  variants?: {
700
705
  label: string;
@@ -845,6 +850,7 @@ export declare const PackDataSchema: z.ZodObject<{
845
850
  id: string;
846
851
  shownByDefault: boolean;
847
852
  icon?: string | undefined;
853
+ cardSentences?: number | undefined;
848
854
  }[] | undefined;
849
855
  variants?: {
850
856
  label: string;
@@ -977,6 +983,7 @@ export declare const PackDataSchema: z.ZodObject<{
977
983
  id: string;
978
984
  shownByDefault: boolean;
979
985
  icon?: string | undefined;
986
+ cardSentences?: number | undefined;
980
987
  }[] | undefined;
981
988
  variants?: {
982
989
  label: string;
@@ -1420,16 +1427,19 @@ export declare const ServedPackDataSchema: z.ZodObject<{
1420
1427
  label: z.ZodString;
1421
1428
  shownByDefault: z.ZodBoolean;
1422
1429
  icon: z.ZodOptional<z.ZodString>;
1430
+ cardSentences: z.ZodOptional<z.ZodNumber>;
1423
1431
  }, "strip", z.ZodTypeAny, {
1424
1432
  label: string;
1425
1433
  id: string;
1426
1434
  shownByDefault: boolean;
1427
1435
  icon?: string | undefined;
1436
+ cardSentences?: number | undefined;
1428
1437
  }, {
1429
1438
  label: string;
1430
1439
  id: string;
1431
1440
  shownByDefault: boolean;
1432
1441
  icon?: string | undefined;
1442
+ cardSentences?: number | undefined;
1433
1443
  }>, "many">>;
1434
1444
  variants: z.ZodOptional<z.ZodArray<z.ZodObject<{
1435
1445
  id: z.ZodString;
@@ -1559,6 +1569,7 @@ export declare const ServedPackDataSchema: z.ZodObject<{
1559
1569
  id: string;
1560
1570
  shownByDefault: boolean;
1561
1571
  icon?: string | undefined;
1572
+ cardSentences?: number | undefined;
1562
1573
  }[] | undefined;
1563
1574
  variants?: {
1564
1575
  label: string;
@@ -1680,6 +1691,7 @@ export declare const ServedPackDataSchema: z.ZodObject<{
1680
1691
  id: string;
1681
1692
  shownByDefault: boolean;
1682
1693
  icon?: string | undefined;
1694
+ cardSentences?: number | undefined;
1683
1695
  }[] | undefined;
1684
1696
  variants?: {
1685
1697
  label: string;
@@ -1834,6 +1846,7 @@ export declare const ServedPackDataSchema: z.ZodObject<{
1834
1846
  id: string;
1835
1847
  shownByDefault: boolean;
1836
1848
  icon?: string | undefined;
1849
+ cardSentences?: number | undefined;
1837
1850
  }[] | undefined;
1838
1851
  variants?: {
1839
1852
  label: string;
@@ -1967,6 +1980,7 @@ export declare const ServedPackDataSchema: z.ZodObject<{
1967
1980
  id: string;
1968
1981
  shownByDefault: boolean;
1969
1982
  icon?: string | undefined;
1983
+ cardSentences?: number | undefined;
1970
1984
  }[] | undefined;
1971
1985
  variants?: {
1972
1986
  label: string;
@@ -0,0 +1,12 @@
1
+ import type { PinCategory } from './catalogue.js';
2
+ import type { GamePack } from './pack.js';
3
+ import type { GameManifest } from './registry.js';
4
+ /** The pin categories a game declares: its pack's (a pack without `pinCategories` declares
5
+ * none), or 'no pack' when no loaded pack is for the game. */
6
+ export type DeclaredPinCategories = readonly PinCategory[] | 'no pack';
7
+ export declare function declaredPinCategories(packs: readonly Pick<GamePack, 'id' | 'catalogue'>[], gameId: string): DeclaredPinCategories;
8
+ /**
9
+ * One line per category that `locations`' pins name and the game doesn't declare, naming the
10
+ * game, how many pins and the first.
11
+ */
12
+ export declare function undeclaredPinCategories(gameId: string, locations: GameManifest['locations'], declared: DeclaredPinCategories): string[];
@@ -0,0 +1,32 @@
1
+ export function declaredPinCategories(packs, gameId) {
2
+ const pack = packs.find(p => p.id === gameId);
3
+ return pack ? (pack.catalogue.pinCategories ?? []) : 'no pack';
4
+ }
5
+ /**
6
+ * One line per category that `locations`' pins name and the game doesn't declare, naming the
7
+ * game, how many pins and the first.
8
+ */
9
+ export function undeclaredPinCategories(gameId, locations, declared) {
10
+ const known = new Set(declared === 'no pack' ? [] : declared.map(c => c.id));
11
+ const found = new Map();
12
+ for (const [locationId, location] of Object.entries(locations)) {
13
+ for (const layer of location.map?.layers ?? []) {
14
+ for (const pin of layer.landmarks) {
15
+ if (pin.category === undefined || known.has(pin.category))
16
+ continue;
17
+ const seen = found.get(pin.category);
18
+ if (seen)
19
+ seen.count++;
20
+ else
21
+ found.set(pin.category, {
22
+ count: 1,
23
+ first: `"${pin.label}" (${pin.id}) in ${locationId}/${layer.id}`,
24
+ });
25
+ }
26
+ }
27
+ }
28
+ const why = declared === 'no pack'
29
+ ? 'but no loaded pack is for this game to declare it'
30
+ : "which the pack's catalogue.pinCategories doesn't declare";
31
+ return [...found].map(([category, { count, first }]) => `${gameId}: ${count} pin${count === 1 ? '' : 's'} in category "${category}", ${why}, so the player can't hide them (first: ${first})`);
32
+ }
package/lib/pins.d.ts CHANGED
@@ -11,6 +11,9 @@ export interface PinRef {
11
11
  /** registry-declared absence (e.g. a Doom thing that only spawns on some skills) */
12
12
  hiddenWhen?: Condition;
13
13
  }
14
+ /** Whether `rule` matches `pin` while the player is at `locationId` (a pin's own location, for
15
+ * a check that has no live state). */
16
+ export declare function pinRuleMatchesAt(rule: PinRule, pin: PinRef, locationId: string): boolean;
14
17
  /** Only a definite `met` counts: an unstreamed flag must not mark a pin collected. */
15
18
  export declare function isPinCollected(pin: PinRef, rules: readonly PinRule[], state: GameState): boolean;
16
19
  /** Hidden only on a definite `met`: when unsure, show the pin. */
package/lib/pins.js CHANGED
@@ -1,7 +1,9 @@
1
1
  import { evaluate } from './condition.js';
2
- function ruleMatches(rule, pin, state) {
2
+ /** Whether `rule` matches `pin` while the player is at `locationId` (a pin's own location, for
3
+ * a check that has no live state). */
4
+ export function pinRuleMatchesAt(rule, pin, locationId) {
3
5
  const { at, kind, ids, label, labelContains } = rule.match;
4
- if (at !== undefined && state.locationId !== at)
6
+ if (at !== undefined && locationId !== at)
5
7
  return false;
6
8
  if (kind !== undefined && pin.kind !== kind)
7
9
  return false;
@@ -13,6 +15,9 @@ function ruleMatches(rule, pin, state) {
13
15
  return false;
14
16
  return true;
15
17
  }
18
+ function ruleMatches(rule, pin, state) {
19
+ return pinRuleMatchesAt(rule, pin, state.locationId);
20
+ }
16
21
  /** Only a definite `met` counts: an unstreamed flag must not mark a pin collected. */
17
22
  export function isPinCollected(pin, rules, state) {
18
23
  if (pin.collectedBy && evaluate(pin.collectedBy, state) === 'met')
package/lib/registry.d.ts CHANGED
@@ -1,6 +1,14 @@
1
1
  import { z } from 'zod';
2
2
  export declare const LandmarkKindSchema: z.ZodEnum<["calibration", "entry", "objective", "poi", "npc", "enemy", "exit", "note"]>;
3
3
  export type LandmarkKind = z.infer<typeof LandmarkKindSchema>;
4
+ /**
5
+ * A pin's kind with the registry default applied, as the map draws it (the web's `pinKind` in
6
+ * pinVisibility.ts, the first to move onto this): `ref_` ids are calibration points, then a pin
7
+ * that waits on an objective is an objective, a spoiler-free one an entry, the rest points of
8
+ * interest. The chat and reply copies (chat-chips, system-prompt, map-focus, reply-actions) skip
9
+ * the objective and entry steps, so they disagree with the map for those pins.
10
+ */
11
+ export declare function effectiveLandmarkKind(pin: Pick<MapLandmark, 'id' | 'kind' | 'requiresObjective' | 'spoilerFree'>): LandmarkKind;
4
12
  export declare const LandmarkSchema: z.ZodObject<{
5
13
  id: z.ZodString;
6
14
  label: z.ZodString;
package/lib/registry.js CHANGED
@@ -12,6 +12,22 @@ export const LandmarkKindSchema = z.enum([
12
12
  'exit',
13
13
  'note',
14
14
  ]);
15
+ /**
16
+ * A pin's kind with the registry default applied, as the map draws it (the web's `pinKind` in
17
+ * pinVisibility.ts, the first to move onto this): `ref_` ids are calibration points, then a pin
18
+ * that waits on an objective is an objective, a spoiler-free one an entry, the rest points of
19
+ * interest. The chat and reply copies (chat-chips, system-prompt, map-focus, reply-actions) skip
20
+ * the objective and entry steps, so they disagree with the map for those pins.
21
+ */
22
+ export function effectiveLandmarkKind(pin) {
23
+ if (pin.kind)
24
+ return pin.kind;
25
+ if (pin.id.startsWith('ref_'))
26
+ return 'calibration';
27
+ if (pin.requiresObjective)
28
+ return 'objective';
29
+ return pin.spoilerFree ? 'entry' : 'poi';
30
+ }
15
31
  export const LandmarkSchema = z.object({
16
32
  id: z.string(),
17
33
  label: z.string(),
@@ -509,16 +509,19 @@ export declare const SandboxDescriptionSchema: z.ZodObject<{
509
509
  label: z.ZodString;
510
510
  shownByDefault: z.ZodBoolean;
511
511
  icon: z.ZodOptional<z.ZodString>;
512
+ cardSentences: z.ZodOptional<z.ZodNumber>;
512
513
  }, "strip", z.ZodTypeAny, {
513
514
  label: string;
514
515
  id: string;
515
516
  shownByDefault: boolean;
516
517
  icon?: string | undefined;
518
+ cardSentences?: number | undefined;
517
519
  }, {
518
520
  label: string;
519
521
  id: string;
520
522
  shownByDefault: boolean;
521
523
  icon?: string | undefined;
524
+ cardSentences?: number | undefined;
522
525
  }>, "many">>;
523
526
  variants: z.ZodOptional<z.ZodArray<z.ZodObject<{
524
527
  id: z.ZodString;
@@ -648,6 +651,7 @@ export declare const SandboxDescriptionSchema: z.ZodObject<{
648
651
  id: string;
649
652
  shownByDefault: boolean;
650
653
  icon?: string | undefined;
654
+ cardSentences?: number | undefined;
651
655
  }[] | undefined;
652
656
  variants?: {
653
657
  label: string;
@@ -769,6 +773,7 @@ export declare const SandboxDescriptionSchema: z.ZodObject<{
769
773
  id: string;
770
774
  shownByDefault: boolean;
771
775
  icon?: string | undefined;
776
+ cardSentences?: number | undefined;
772
777
  }[] | undefined;
773
778
  variants?: {
774
779
  label: string;
@@ -915,6 +920,7 @@ export declare const SandboxDescriptionSchema: z.ZodObject<{
915
920
  id: string;
916
921
  shownByDefault: boolean;
917
922
  icon?: string | undefined;
923
+ cardSentences?: number | undefined;
918
924
  }[] | undefined;
919
925
  variants?: {
920
926
  label: string;
@@ -1047,6 +1053,7 @@ export declare const SandboxDescriptionSchema: z.ZodObject<{
1047
1053
  id: string;
1048
1054
  shownByDefault: boolean;
1049
1055
  icon?: string | undefined;
1056
+ cardSentences?: number | undefined;
1050
1057
  }[] | undefined;
1051
1058
  variants?: {
1052
1059
  label: string;
@@ -1258,6 +1265,7 @@ export declare const SandboxDescriptionSchema: z.ZodObject<{
1258
1265
  id: string;
1259
1266
  shownByDefault: boolean;
1260
1267
  icon?: string | undefined;
1268
+ cardSentences?: number | undefined;
1261
1269
  }[] | undefined;
1262
1270
  variants?: {
1263
1271
  label: string;
@@ -1411,6 +1419,7 @@ export declare const SandboxDescriptionSchema: z.ZodObject<{
1411
1419
  id: string;
1412
1420
  shownByDefault: boolean;
1413
1421
  icon?: string | undefined;
1422
+ cardSentences?: number | undefined;
1414
1423
  }[] | undefined;
1415
1424
  variants?: {
1416
1425
  label: string;
package/lib/types.d.ts CHANGED
@@ -304,6 +304,8 @@ export declare const GameStateSchema: z.ZodObject<{
304
304
  }> | undefined;
305
305
  }>;
306
306
  export type GameState = z.infer<typeof GameStateSchema>;
307
+ export declare const OptionalStateFieldSchema: z.ZodEnum<["difficulty", "variant", "enemies", "npcs", "stats", "counters", "flagSets", "equipped", "objectiveProgress"]>;
308
+ export type OptionalStateField = z.infer<typeof OptionalStateFieldSchema>;
307
309
  export declare const SessionEventSchema: z.ZodObject<{
308
310
  id: z.ZodString;
309
311
  timestamp: z.ZodNumber;
@@ -2285,6 +2287,8 @@ export declare const ServerWsMessageSchema: z.ZodDiscriminatedUnion<"type", [z.Z
2285
2287
  }> | undefined;
2286
2288
  flags?: Record<string, boolean> | undefined;
2287
2289
  }>;
2290
+ /** fields the pack stopped reporting: the client deletes them (absent = none removed) */
2291
+ removed: z.ZodOptional<z.ZodArray<z.ZodEnum<["difficulty", "variant", "enemies", "npcs", "stats", "counters", "flagSets", "equipped", "objectiveProgress"]>, "many">>;
2288
2292
  }, "strip", z.ZodTypeAny, {
2289
2293
  type: "state:patch";
2290
2294
  timestamp: number;
@@ -2339,6 +2343,7 @@ export declare const ServerWsMessageSchema: z.ZodDiscriminatedUnion<"type", [z.Z
2339
2343
  }> | undefined;
2340
2344
  flags?: Record<string, boolean> | undefined;
2341
2345
  };
2346
+ removed?: ("stats" | "difficulty" | "variant" | "enemies" | "npcs" | "counters" | "flagSets" | "equipped" | "objectiveProgress")[] | undefined;
2342
2347
  }, {
2343
2348
  type: "state:patch";
2344
2349
  timestamp: number;
@@ -2393,6 +2398,7 @@ export declare const ServerWsMessageSchema: z.ZodDiscriminatedUnion<"type", [z.Z
2393
2398
  }> | undefined;
2394
2399
  flags?: Record<string, boolean> | undefined;
2395
2400
  };
2401
+ removed?: ("stats" | "difficulty" | "variant" | "enemies" | "npcs" | "counters" | "flagSets" | "equipped" | "objectiveProgress")[] | undefined;
2396
2402
  }>, z.ZodObject<{
2397
2403
  type: z.ZodLiteral<"event">;
2398
2404
  sessionId: z.ZodString;
package/lib/types.js CHANGED
@@ -65,6 +65,22 @@ export const GameStateSchema = z.object({
65
65
  objectiveProgress: z.record(z.string(), ObjectiveProgressSchema).optional(),
66
66
  flags: z.record(z.string(), z.boolean()),
67
67
  });
68
+ /*
69
+ * The GameState fields a pack may leave out ("not tracked / not streamed"). A state:patch names the
70
+ * ones that went from present to absent in `removed`, since JSON has no way to send `undefined`.
71
+ * Mirrors the schema's optional fields; types.test.ts fails when they drift.
72
+ */
73
+ export const OptionalStateFieldSchema = z.enum([
74
+ 'difficulty',
75
+ 'variant',
76
+ 'enemies',
77
+ 'npcs',
78
+ 'stats',
79
+ 'counters',
80
+ 'flagSets',
81
+ 'equipped',
82
+ 'objectiveProgress',
83
+ ]);
68
84
  export const SessionEventSchema = z.object({
69
85
  id: z.string(),
70
86
  timestamp: z.number(),
@@ -230,6 +246,8 @@ export const ServerWsMessageSchema = z.discriminatedUnion('type', [
230
246
  timestamp: z.number(),
231
247
  gameId: z.string(),
232
248
  patch: GameStateSchema.partial(),
249
+ /** fields the pack stopped reporting: the client deletes them (absent = none removed) */
250
+ removed: z.array(OptionalStateFieldSchema).optional(),
233
251
  }),
234
252
  z.object({
235
253
  type: z.literal('event'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gameslate/sdk",
3
- "version": "0.3.27",
3
+ "version": "0.3.29",
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",
@@ -353,7 +353,12 @@ Images have a `purpose` (`atlas`, `map`, `icon`, `actor`, which picks the folder
353
353
  - `{ format: 'webp', lossless: true }`;
354
354
  - `{ format: 'webp', quality: 88 }`.
355
355
 
356
- Every image of a game uses one format. In the sandbox:
356
+ Every image of a game uses one format. A mesh may link to an atlas another asset builds (one
357
+ atlas per campaign): the core writes the mesh once the atlas is written, whatever order the builder
358
+ threads finish in. Test a first build into an empty out-dir: `extract-assets` exits 1 if any asset
359
+ failed, so a race or a missing atlas can't pass as a partial success.
360
+
361
+ In the sandbox:
357
362
 
358
363
  - **No `TextDecoder`, `TextEncoder` or `Buffer`.** Decode Latin-1 and ASCII with `new
359
364
  Bytes(data).toString('latin1', start, end)` (sdk >= 0.3.26 is fast at any length), and UTF-8 by
@@ -570,7 +575,22 @@ Every game ships a `<game>/README.md` (`plugin/<game-id>/README.md` in a multi-g
570
575
  `@gameslate/sdk`'s `GameSupportSchema` (pinned `builds` + verification tier; `map` status,
571
576
  `assetSource`, `geometry`, `layers`, `controls`, live `player`/`actors`, `pins`; and `panels` for
572
577
  vitals, inventory, missions, reference, timelines, and AI) followed by the five required headings
573
- in order:
578
+ in order. Four `map.pins` flags each name a kind of pin, so set the one that fits rather than
579
+ the nearest: `exits` (`kind: 'exit'` pins), `collectiblesOrItems` (pins the app can mark
580
+ collected: a `collectedBy`, a `chestFlag` or `gsFlag`, or a pack `pinRules` entry with a
581
+ `collectedBy` that matches the pin), `objectives` (`kind: 'objective'` pins) and
582
+ `pointsOfInterest` (`kind: 'poi'` pins with none of those and no `requiresObjective`, such as
583
+ vehicles, signposts and shops; required from sdk 0.3.29). A pin with no `kind` takes the one the
584
+ map draws it as (`effectiveLandmarkKind`): calibration for a `ref_` id, else objective with a
585
+ `requiresObjective`, else entry when `spoilerFree`, else poi. A pack rule matching on `kind`
586
+ sees only a kind the pin states, so it misses kind-less pins. `npc`, `enemy`, `entry` and
587
+ `note` pins have no pins flag. The other three, `autoHideCollected`, `customNotes` and
588
+ `wayfinding`, are map features, not kinds of pin. The support check refuses
589
+ `pointsOfInterest: false` when the built plugin's registry has such a poi pin; otherwise the
590
+ flags are self-declared, because pins extracted on the player's PC never reach the built plugin.
591
+ Until 0.3.29 there was no flag for plain points of interest, and
592
+ Mario Party 3 filed them under `collectiblesOrItems` and Body Harvest under `objectives`
593
+ (2026-12-06). The headings:
574
594
 
575
595
  1. `## Builds & Asset Extraction`
576
596
  2. `## Map`
@@ -751,6 +771,13 @@ the plugin repos) in the same change as the fix. The next game should not have t
751
771
  its byte (6 bits in BK's setup files), so refuse larger values. offsetof can't pin a
752
772
  bitfield: confirm it by disassembling the accessor (`llvm-objdump -d`) and place it relative
753
773
  to a pinned neighbouring field (BK, 2026-12-05).
774
+ - **One save, two bit orders; and a C shift past 31 wraps.** Banjo-Kazooie's jiggies sit at
775
+ byte `(id - 1) / 8`, bit `id & 7`, but its progress bits at byte `index / 8`, bit `index & 7`:
776
+ take each array's indexing from its own accessor, and test a bit that only the right one
777
+ passes. Multi-bit fields in a bit array (`getNBits`) can straddle bytes: test one that does.
778
+ And `1 << (marker->id + 6)` for a Jinjo is a shift by 96..100, which MIPS `sllv` takes mod 32
779
+ (C calls it undefined): read the compiled shift with `objdump -dr` before mapping a value to a
780
+ bit (BK, 2026-12-06).
754
781
  - **Exit pins: read the spawn function first.** Some exits never place the player (BK's 0x65),
755
782
  some use hard-coded positions (0x80 and up): neither gets a pin. Keep duplicate exit nodes
756
783
  with unique ids (a `Map` keeps the last, not the one the game uses). Many exits drop the
@@ -849,6 +876,115 @@ the plugin repos) in the same change as the fix. The next game should not have t
849
876
  (`@gameslate/sdk/host`). After a change that grows the geometry, run `gameslate extract-assets
850
877
  <game> --input <rom> --out-dir <scratch>` (the core's `dist/gameslate.mjs` with
851
878
  `GAMESLATE_PLUGINS_DIR=<plugin>/dist`).
879
+ - **Reading a game's actor list.** A list that grows with `realloc` has no fixed size: cap the read
880
+ at a pool every entry must take from (Banjo-Kazooie's 0xE0-entry marker pool, one per actor) and
881
+ refuse a count above it. Read only the used slots, and test the size of every read by wrapping
882
+ `memory.read` (a mutation that read the whole capacity passed every result-based test; a guard
883
+ that only skips a big read outside play survives the same way). Check
884
+ an id → name table against the ROM's placements (count the setup files' props by id) to catch a
885
+ wrong id and find ids only code spawns. When the game removes an actor by moving its last one
886
+ into the freed slot, a slot index isn't a stable id: key on something that stays put (the
887
+ actor's pooled marker pointer). The pointer, header and slot reads aren't one instant: the game
888
+ bumps the count before it writes the new slot and can `realloc` the array between your reads.
889
+ Re-read the pointer and header after the slots and retry a few times; if it never settles, leave
890
+ `enemies`/`npcs` out for that tick (unknown, not none) rather than throw away the whole poll.
891
+ A header that matches before and after doesn't catch a slot the game hasn't written yet, so
892
+ retry on an impossible value too (a bad count, a NaN position, an id past the enum). Throw only
893
+ when it stays impossible across steady samples: that's not a tear. Read the game's remove
894
+ routine as well as its add: Banjo-Kazooie's `__actor_free` copies the last actor into the freed
895
+ slot before lowering the count and never clears the old one, so a just-counted slot can hold a
896
+ stale copy of a live actor under an unchanged header. Treat two used slots that share a unique
897
+ field (the marker pointer) as a torn sample. Log a give-up with `GameMemory.log`: plugin code
898
+ can't import `debug`. A fixed array with no count (Conker's `movement_obj[26]`) is one read of
899
+ its declared size: confirm the size from the linker (the next symbol's address), not from a
900
+ loop's literal. When the spawn code writes the model last and the clear starts at `type`, a torn
901
+ slot can't show a named actor in a stale place, so the name table is itself the guard. Throw
902
+ only after impossible samples on several polls in a row: an emulator paused mid-routine shows
903
+ the same half-written slot to every retry within one poll; a poll that skips the read (a menu)
904
+ ends the run. A used slot isn't a live character: read the kill, split and remove paths and
905
+ drop the dying states (Conker's `effect_killAndSplitActor` leaves a spinning-down victim plus
906
+ a copy, two dots for one kill), attached parts, and a mount while it's ridden. Check the loops'
907
+ bound against the array's size: Conker's last slot is an overflow scratch slot that never gets
908
+ cleared. The daemon holds a list that's
909
+ absent for a single poll, so a one-poll give-up doesn't blink the dots.
910
+ In play with nothing there, send empty lists: a missing list reads as "not tracked".
911
+ - **A decomp's enum can name the wrong actor.** DK64's `ACTOR_DOGADON` (294) is K. Rool's Tiny
912
+ round; Dogadon is 236, and its boss overlay names and boss model enums are shuffled too. Settle
913
+ each name by where the ROM's placements put it (a boss sits only on its own map), and check
914
+ every lead's names (ScriptHawk's too) the same way.
915
+ - **Two compressed members back to back.** DK64's global segment is code then data, packed one
916
+ after the other: inflate the whole ROM range and check the size equals VRAM to BSS start.
917
+ Inflating only the first member silently drops `.data`.
918
+ - **`at += readThatMovesAt()` loses the call's own advance:** JavaScript reads `at` before the
919
+ call runs. Assign the result first.
920
+ - **Collision that isn't a display list.** A game can collide with more than the level mesh: read
921
+ the function that builds its collision maps (Conker's `level_buildCollisionTris` builds map 2
922
+ from every placed object's model), not a "list N" label in notes. Port each filter it applies
923
+ (status bits, inactive flags), and take the placement matrix from the collision code even when
924
+ it's hand-written asm; it should multiply out to the render path's C matrix. When a placement
925
+ defers a field to a table in the game's data segment (Conker's `gGroupedObjectDefaults`),
926
+ unpack that segment from the player's ROM, check its size against the linker layout, confirm
927
+ every entry once in a scratch test against the decomp's table, and never commit it. Check the
928
+ new geometry by counting spawn points on a drawn floor with and without it: the count should
929
+ rise. Pin it exactly rather than asserting that a wrong rotation lowers it: in SM64 a negated
930
+ yaw *raised* it (points from other acts landed on the misturned object). That count can also
931
+ be blind to rotation: markers
932
+ often sit at a prop's centre, where turning it moves nothing (a flipped roll left Banjo-Kazooie's
933
+ count unchanged). Pin the rotation with unit rows computed from the game's own matrix steps, and
934
+ pin which maps gain floors, not only the total. Look for code that moves placed props after load
935
+ (BK's `func_803515EC`): those are drawn only where they start. An object's collision pose can
936
+ come from its behaviour as well as its placement: walk the script's data commands (scale,
937
+ position and angle writes, a `GOTO` into the middle of another script), read every native init
938
+ function a collision behaviour calls (match it by linker-map address), and refuse a pose write
939
+ you can't follow, but only for objects that have a model. Two unnamed static tables from one
940
+ `.c` file sit back to back in its `.data`: find the one with sentinels by shape, take the other
941
+ by offset, and confirm against the `.o`'s `.data` size. Read every object map the loader
942
+ spawns and every spawner: most of DKR's solid objects come from its second map
943
+ (`collectables`) or are spawned by animation nodes, which hand them their own position, turn
944
+ and size (take that transform from the spawner, `obj_init_animobject`, not the child's init).
945
+ Paired doors make a ROM check that sees rotation: closed halves must meet, and a flipped sign,
946
+ the wrong angle unit or the wrong size opens a gap (DKR, 2026-12-06).
947
+ - **Declare every pin `category` in the pack's `catalogue.pinCategories`.** An undeclared one still
948
+ draws and is still offered by chips, the nudge and the AI, but the player gets no toggle for it,
949
+ so a spoiler can't be hidden. Write it as `PIN_CATEGORIES.<key>` from the game's
950
+ `pin-categories.ts`, which the pack's declarations read too, never as an expression; shared
951
+ builders (`topdown.ts`) set none. `plugin/pin-categories.test.ts` refuses anything else, and a
952
+ map test checks the built pins' categories. The core checks too: `gameslate-plugin validate`
953
+ (sdk 0.3.28) fails on registry pins in an undeclared category, and `extract-assets` writes
954
+ extracted ones but prints each category and exits 1 for pins your current asset code built
955
+ (pins in maps an earlier release left are reported, and a rebuild replaces them), so run it
956
+ on a real build before a release. Mark spoilers
957
+ `shownByDefault: false`. Renaming an id leaves maps built by earlier releases on the old id
958
+ until the player rebuilds them (gameslate-n64, 2026-12-06). When a category's pin `context`
959
+ ends with the answer (how a secret opens), set its `cardSentences` (sdk 0.3.28) to the leading
960
+ sentences the spot card may show; the AI still gets all of it. The core keys on no category
961
+ id (Doom's `secrets`, 2026-12-06). Emit those leading sentences for every pin, even when the
962
+ fact behind one is missing: a Doom secret with no pin to place it by dropped its "where"
963
+ sentence, so a two-sentence card showed how it opens. A sentence ends at `.`, `?` or `!`
964
+ before a space.
965
+ - **An "exit" node may be where the player arrives, not what sends them on.** Banjo-Kazooie's
966
+ numbered entrance markers are arrival spots; the ways out are separate trigger boxes whose
967
+ destination comes from the warp function table the box's id selects. Read the code that fires
968
+ the warp before labelling anything. Filter nodes by the game's own test: a node-prop bit can mean
969
+ the game never tests the node, and such nodes carry ids past the table (BK's bit0, 0x8000,
970
+ 2026-12-06).
971
+ - **Tables loaded back to back: walk them exactly as the loader does.** Body Harvest's
972
+ `loadLevelData` skips 4 bytes after one table and aligns to 16 before the packed blocks; apply
973
+ the loader's own sanity checks (a first byte, a magic word) at each step, and confirm the walk
974
+ against the decomp's published counts. A token-stream parser ends where the game's does:
975
+ Body Harvest's condition reader stops only at a command-list marker, so a fixture without one
976
+ hangs, while the real data always has one (2026-12-06).
977
+ - **Pointers into a segment loaded at run time** (SM64's behaviour scripts in segment 0x13): read
978
+ where the game's segment table says the segment was loaded and match offsets within it against
979
+ the map's segmented symbols, never fixed virtual addresses. When variants share one script
980
+ (Koopa and Koopa the Quick), read the init branch and test the parameter exactly: the tiny
981
+ Koopa's value is also above the race base.
982
+ - **Take a field's order from the code that uses the data**, not from the loader's names: SM64's
983
+ `load_environmental_regions` names unused fields loX, hiX, loZ, hiZ, but `find_water_level`
984
+ reads loX, loZ, hiX, hiZ.
985
+ - **A static table no symbol names** can be found in the player's ROM by its shape and sentinels
986
+ (null first and last entries): require exactly one match, keep the sentinels, and keep the first
987
+ entry for an id, as the game's own search does. Nothing from it is committed.
852
988
  - **Never build a long string with `+=` a piece at a time.** QuickJS copies the whole string on
853
989
  every `+=`, so it is quadratic where Node is linear: a 1 MB string a byte at a time took 147 s
854
990
  in the sandbox (the sdk's own `Bytes#toString` did this until 0.3.26). Push the pieces into an
@@ -927,7 +1063,12 @@ the plugin repos) in the same change as the fix. The next game should not have t
927
1063
  decomp's routine as a black-box test binary on the dev machine. A second agent, which never
928
1064
  opens the source, implements from the spec and must match the binary's output on every real
929
1065
  input. Why: on 2026-12-05 the Doom 64 decompressor was ported step by step from DOOM64-RE, and
930
- had to be rewritten clean before the repo could be published.
1066
+ had to be rewritten clean before the repo could be published. A parser for a data format counts
1067
+ too: if you read the game's parser to learn the format, you can't then write ours. On 2026-12-06
1068
+ Body Harvest's mission-stream reader, written by the agent that had read the unlicensed
1069
+ `missions.c` for "facts only", came out function by function and error by error from the C.
1070
+ Plan the split before anyone opens such code: it's the spec agent's, and someone else writes the
1071
+ reader.
931
1072
  - **Implement a game's decompressor at the game's widths, and check it on every file.** Doom 64's
932
1073
  map compression is adaptive Huffman whose counts are C `short`s, rescaled only when the root
933
1074
  count *equals* 2000. In MAP07 the root steps past 2000, the counts climb to 32767 and wrap, and