@gameslate/sdk 0.3.28 → 0.3.30

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,37 @@ 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
+ /* rules see the effective kind, as the app's collected check passes it (web llm.ts) */
146
+ const ref = { ...pin, kind: effectiveLandmarkKind(pin) };
147
+ if (rules.some(r => pinRuleMatchesAt(r, ref, locationId)))
148
+ continue;
149
+ plain.push(`"${pin.label}" (${pin.id}) in ${locationId}/${layer.id}`);
150
+ }
151
+ }
152
+ }
153
+ if (plain.length > 0) {
154
+ 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]})`);
155
+ }
156
+ }
121
157
  function checkMapAgainstCode(support, ctx, problems) {
122
158
  const hasMapCap = ctx.sources.some(s => s.capabilities.includes('map_2d'));
123
159
  const drawn = support.map.status === 'done' || support.map.status === 'partial';
@@ -192,6 +228,7 @@ export function checkSupportAgainstCode(support, ctx) {
192
228
  problems.push(`README build "${b}" is not in supportedBuildIds`);
193
229
  }
194
230
  checkMapAgainstCode(support, ctx, problems);
231
+ checkPinsAgainstRegistry(support, ctx, problems);
195
232
  checkPanelsAgainstCode(support, ctx, problems);
196
233
  return problems;
197
234
  }
@@ -242,15 +279,21 @@ function liveMapCell(m) {
242
279
  parts.push('rivals/players');
243
280
  return parts.length > 0 ? parts.join(', ') : '—';
244
281
  }
282
+ /* every flag, in the order the cell lists them */
283
+ const PIN_LABEL = {
284
+ exits: 'exits',
285
+ collectiblesOrItems: 'items',
286
+ objectives: 'objectives',
287
+ pointsOfInterest: 'POIs',
288
+ autoHideCollected: 'auto-hide',
289
+ wayfinding: 'wayfind',
290
+ customNotes: 'notes',
291
+ };
292
+ const isPinFlag = (key) => key in PIN_LABEL;
245
293
  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);
294
+ const parts = Object.entries(PIN_LABEL)
295
+ .filter(([flag]) => isPinFlag(flag) && p[flag])
296
+ .map(([, label]) => label);
254
297
  return parts.length > 0 ? parts.join(', ') : '—';
255
298
  }
256
299
  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: the one default the map, chat, replies, pin
6
+ * rules and the support check all use. `ref_` ids are calibration points, then a pin that waits
7
+ * on an objective is an objective, a spoiler-free one an entry, the rest points of interest.
8
+ * One reader keeps the stated kind on purpose: the web's Map Nudge fallback (nudge.ts
9
+ * `pickNudgeTarget`), so a pin waiting on an inactive or complete objective isn't nudged to.
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: the one default the map, chat, replies, pin
17
+ * rules and the support check all use. `ref_` ids are calibration points, then a pin that waits
18
+ * on an objective is an objective, a spoiler-free one an entry, the rest points of interest.
19
+ * One reader keeps the stated kind on purpose: the web's Map Nudge fallback (nudge.ts
20
+ * `pickNudgeTarget`), so a pin waiting on an inactive or complete objective isn't nudged to.
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.30",
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,23 @@ 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 that effective kind too, in the app and the support check, so `match: { kind: 'poi' }`
587
+ covers kind-less poi pins. `npc`, `enemy`, `entry` and
588
+ `note` pins have no pins flag. The other three, `autoHideCollected`, `customNotes` and
589
+ `wayfinding`, are map features, not kinds of pin. The support check refuses
590
+ `pointsOfInterest: false` when the built plugin's registry has such a poi pin; otherwise the
591
+ flags are self-declared, because pins extracted on the player's PC never reach the built plugin.
592
+ Until 0.3.29 there was no flag for plain points of interest, and
593
+ Mario Party 3 filed them under `collectiblesOrItems` and Body Harvest under `objectives`
594
+ (2026-12-06). The headings:
579
595
 
580
596
  1. `## Builds & Asset Extraction`
581
597
  2. `## Map`
@@ -756,6 +772,13 @@ the plugin repos) in the same change as the fix. The next game should not have t
756
772
  its byte (6 bits in BK's setup files), so refuse larger values. offsetof can't pin a
757
773
  bitfield: confirm it by disassembling the accessor (`llvm-objdump -d`) and place it relative
758
774
  to a pinned neighbouring field (BK, 2026-12-05).
775
+ - **One save, two bit orders; and a C shift past 31 wraps.** Banjo-Kazooie's jiggies sit at
776
+ byte `(id - 1) / 8`, bit `id & 7`, but its progress bits at byte `index / 8`, bit `index & 7`:
777
+ take each array's indexing from its own accessor, and test a bit that only the right one
778
+ passes. Multi-bit fields in a bit array (`getNBits`) can straddle bytes: test one that does.
779
+ And `1 << (marker->id + 6)` for a Jinjo is a shift by 96..100, which MIPS `sllv` takes mod 32
780
+ (C calls it undefined): read the compiled shift with `objdump -dr` before mapping a value to a
781
+ bit (BK, 2026-12-06).
759
782
  - **Exit pins: read the spawn function first.** Some exits never place the player (BK's 0x65),
760
783
  some use hard-coded positions (0x80 and up): neither gets a pin. Keep duplicate exit nodes
761
784
  with unique ids (a `Map` keeps the last, not the one the game uses). Many exits drop the
@@ -940,6 +963,12 @@ the plugin repos) in the same change as the fix. The next game should not have t
940
963
  fact behind one is missing: a Doom secret with no pin to place it by dropped its "where"
941
964
  sentence, so a two-sentence card showed how it opens. A sentence ends at `.`, `?` or `!`
942
965
  before a space.
966
+ - **An "exit" node may be where the player arrives, not what sends them on.** Banjo-Kazooie's
967
+ numbered entrance markers are arrival spots; the ways out are separate trigger boxes whose
968
+ destination comes from the warp function table the box's id selects. Read the code that fires
969
+ the warp before labelling anything. Filter nodes by the game's own test: a node-prop bit can mean
970
+ the game never tests the node, and such nodes carry ids past the table (BK's bit0, 0x8000,
971
+ 2026-12-06).
943
972
  - **Tables loaded back to back: walk them exactly as the loader does.** Body Harvest's
944
973
  `loadLevelData` skips 4 bytes after one table and aligns to 16 before the packed blocks; apply
945
974
  the loader's own sanity checks (a first byte, a magic word) at each step, and confirm the walk