@gameslate/sdk 0.3.28 → 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.
@@ -182,7 +182,7 @@ if (command === 'build' && dir && values.out) {
182
182
  console.error(`refused: ${inspected}`);
183
183
  process.exit(1);
184
184
  }
185
- codeByGame = supportContextsFromPlugin(inspected);
185
+ codeByGame = supportContextsFromPlugin(inspected, builtDir);
186
186
  }
187
187
  const { entries, problems } = verifyOrWriteSupportDocs({
188
188
  gamesDir,
@@ -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;
@@ -1,5 +1,6 @@
1
1
  import type { GamePack } from '../pack.js';
2
2
  import type { PluginManifest } from '../plugin-manifest.js';
3
+ import { type GameManifest } from '../registry.js';
3
4
  export declare const REGISTRY_DIR = "registry";
4
5
  /** Why an SVG can't be served (a tag outside the set, a script hook, a bare `&`), or null. */
5
6
  export declare function svgProblem(text: string): string | null;
@@ -10,6 +11,9 @@ export declare function svgProblem(text: string): string | null;
10
11
  export declare function inspectPluginRegistry(dir: string, manifest: PluginManifest): {
11
12
  games: string[];
12
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;
13
17
  /**
14
18
  * Registry pins in a category their game's pack doesn't declare, one line per category
15
19
  * (`undeclaredPinCategories`), for `gameslate-plugin validate`. `games` are the ones
@@ -129,6 +129,15 @@ export function inspectPluginRegistry(dir, manifest) {
129
129
  }
130
130
  return { games: games.sort() };
131
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
+ }
132
141
  /**
133
142
  * Registry pins in a category their game's pack doesn't declare, one line per category
134
143
  * (`undeclaredPinCategories`), for `gameslate-plugin validate`. `games` are the ones
@@ -137,10 +146,7 @@ export function inspectPluginRegistry(dir, manifest) {
137
146
  */
138
147
  export function registryPinCategoryProblems(dir, games, packs) {
139
148
  return games.flatMap(gameId => {
140
- const file = path.join(dir, REGISTRY_DIR, 'games', gameId, 'manifest.json');
141
- const manifest = readJson(file, GameManifestSchema);
142
- if (typeof manifest === 'string')
143
- throw new Error(`${file}: ${manifest}`);
149
+ const manifest = readRegistryManifest(dir, gameId);
144
150
  const declared = declaredPinCategories(packs, gameId);
145
151
  return undeclaredPinCategories(gameId, manifest.locations, declared);
146
152
  });
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(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gameslate/sdk",
3
- "version": "0.3.28",
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",
@@ -575,7 +575,22 @@ Every game ships a `<game>/README.md` (`plugin/<game-id>/README.md` in a multi-g
575
575
  `@gameslate/sdk`'s `GameSupportSchema` (pinned `builds` + verification tier; `map` status,
576
576
  `assetSource`, `geometry`, `layers`, `controls`, live `player`/`actors`, `pins`; and `panels` for
577
577
  vitals, inventory, missions, reference, timelines, and AI) followed by the five required headings
578
- 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:
579
594
 
580
595
  1. `## Builds & Asset Extraction`
581
596
  2. `## Map`
@@ -756,6 +771,13 @@ the plugin repos) in the same change as the fix. The next game should not have t
756
771
  its byte (6 bits in BK's setup files), so refuse larger values. offsetof can't pin a
757
772
  bitfield: confirm it by disassembling the accessor (`llvm-objdump -d`) and place it relative
758
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).
759
781
  - **Exit pins: read the spawn function first.** Some exits never place the player (BK's 0x65),
760
782
  some use hard-coded positions (0x80 and up): neither gets a pin. Keep duplicate exit nodes
761
783
  with unique ids (a `Map` keeps the last, not the one the game uses). Many exits drop the
@@ -940,6 +962,12 @@ the plugin repos) in the same change as the fix. The next game should not have t
940
962
  fact behind one is missing: a Doom secret with no pin to place it by dropped its "where"
941
963
  sentence, so a two-sentence card showed how it opens. A sentence ends at `.`, `?` or `!`
942
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).
943
971
  - **Tables loaded back to back: walk them exactly as the loader does.** Body Harvest's
944
972
  `loadLevelData` skips 4 bytes after one table and aligns to 16 before the packed blocks; apply
945
973
  the loader's own sanity checks (a first byte, a magic word) at each step, and confirm the walk