@wildshard/shard-format 0.41.1 → 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildshard/shard-format",
3
- "version": "0.41.1",
3
+ "version": "0.42.0",
4
4
  "description": "The raw shardfile format: the spec, the validator and a validate CLI. The public, versioned contract every other repo builds on.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -27,18 +27,18 @@ interface BootMemoryCosts {
27
27
  /** MG6 epoch 4: what the offline estimate reads of a product, in bytes; from epoch 5 only the files a phone fetches. */
28
28
  interface PhoneTerms {
29
29
  /** Every phone-tier client file's wire bytes plus its CPU-decoded bytes (audio aside), the commons the same way, and,
30
- * for a data shard, the decoded engine images the cook mounts: what a boot downloads and decodes. */
30
+ * for a shard with no runtime, the decoded engine images the cook mounts: what a boot downloads and decodes. */
31
31
  readonly content: number
32
32
  /** GPU texture bytes: image and KTX2 files, commons GPU and mounted images; zero for a runtime home, whose `gl` stands
33
33
  * in (its files carry every tier's variants: Pine ships 704 MB of texture bytes and holds 65 MB on a phone at Low). */
34
34
  readonly textures: number
35
- /** A runtime home's paired GL reading [L]; zero for a data shard. */
35
+ /** A runtime home's paired GL reading [L]; zero for a shard with no runtime. */
36
36
  readonly gl: number
37
37
  /** GPU geometry bytes: GLB and binary files. */
38
38
  readonly geometry: number
39
39
  /** The shard's own declared sim residency at its growth limit (`budgets.sim`, `serverBudget.memory`). */
40
40
  readonly sims: number
41
- /** A runtime home's paired Simulator WebContent + GL reading, whole; zero for a data shard. */
41
+ /** A runtime home's paired Simulator WebContent + GL reading, whole; zero for a shard with no runtime. */
42
42
  readonly runtimeReading: number
43
43
  }
44
44
 
@@ -11,7 +11,7 @@
11
11
  "epoch": 8,
12
12
  "playingBytes": 679221837,
13
13
  "loadingBytes": 984731013,
14
- "evidence": "engine-pinned product revision 6 (tar f42fe0449a93), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
14
+ "evidence": "engine-pinned product revision 6 (tar f42fe0449a93), a shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
15
15
  },
16
16
  "far-reach": {
17
17
  "armed": "2026-11-18",
@@ -19,7 +19,7 @@
19
19
  "epoch": 8,
20
20
  "playingBytes": 999952196,
21
21
  "loadingBytes": 1415754105,
22
- "evidence": "engine-pinned product revision 4 (tar 5bc5adcf764a), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
22
+ "evidence": "engine-pinned product revision 4 (tar 5bc5adcf764a), a shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
23
23
  },
24
24
  "ink-cel-valley": {
25
25
  "armed": "2026-11-18",
@@ -27,7 +27,7 @@
27
27
  "epoch": 8,
28
28
  "playingBytes": 636979847,
29
29
  "loadingBytes": 925290035,
30
- "evidence": "engine-pinned product revision 1 (tar 5764c86a258a), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
30
+ "evidence": "engine-pinned product revision 1 (tar 5764c86a258a), a shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
31
31
  },
32
32
  "open-plot-alien-plain": {
33
33
  "armed": "2026-11-18",
@@ -35,7 +35,7 @@
35
35
  "epoch": 8,
36
36
  "playingBytes": 665173554,
37
37
  "loadingBytes": 967392441,
38
- "evidence": "engine-pinned product revision 1 (tar c32cd9fb9229), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
38
+ "evidence": "engine-pinned product revision 1 (tar c32cd9fb9229), a shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
39
39
  },
40
40
  "open-plot-clockwork-canyon": {
41
41
  "armed": "2026-11-18",
@@ -43,7 +43,7 @@
43
43
  "epoch": 8,
44
44
  "playingBytes": 675751489,
45
45
  "loadingBytes": 982935896,
46
- "evidence": "engine-pinned product revision 1 (tar 3b322eccd99e), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
46
+ "evidence": "engine-pinned product revision 1 (tar 3b322eccd99e), a shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
47
47
  },
48
48
  "open-plot-coral-drift": {
49
49
  "armed": "2026-11-18",
@@ -51,7 +51,7 @@
51
51
  "epoch": 8,
52
52
  "playingBytes": 681768940,
53
53
  "loadingBytes": 992453778,
54
- "evidence": "engine-pinned product revision 1 (tar 87841749dc3f), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
54
+ "evidence": "engine-pinned product revision 1 (tar 87841749dc3f), a shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
55
55
  },
56
56
  "open-plot-desert-ruin": {
57
57
  "armed": "2026-11-18",
@@ -59,7 +59,7 @@
59
59
  "epoch": 8,
60
60
  "playingBytes": 686478807,
61
61
  "loadingBytes": 997958716,
62
- "evidence": "engine-pinned product revision 1 (tar 3b65bfef7275), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
62
+ "evidence": "engine-pinned product revision 1 (tar 3b65bfef7275), a shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
63
63
  },
64
64
  "open-plot-ember-forge": {
65
65
  "armed": "2026-11-18",
@@ -67,7 +67,7 @@
67
67
  "epoch": 8,
68
68
  "playingBytes": 679682616,
69
69
  "loadingBytes": 987005255,
70
- "evidence": "engine-pinned product revision 1 (tar e1a3a9325e8e), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
70
+ "evidence": "engine-pinned product revision 1 (tar e1a3a9325e8e), a shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
71
71
  },
72
72
  "open-plot-fossil-badlands": {
73
73
  "armed": "2026-11-18",
@@ -75,7 +75,7 @@
75
75
  "epoch": 8,
76
76
  "playingBytes": 671308241,
77
77
  "loadingBytes": 976533532,
78
- "evidence": "engine-pinned product revision 1 (tar 5bbdd51b8db9), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
78
+ "evidence": "engine-pinned product revision 1 (tar 5bbdd51b8db9), a shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
79
79
  },
80
80
  "open-plot-frostline-peaks": {
81
81
  "armed": "2026-11-18",
@@ -83,7 +83,7 @@
83
83
  "epoch": 8,
84
84
  "playingBytes": 694731191,
85
85
  "loadingBytes": 1007041500,
86
- "evidence": "engine-pinned product revision 1 (tar ec7b8879a343), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
86
+ "evidence": "engine-pinned product revision 1 (tar ec7b8879a343), a shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
87
87
  },
88
88
  "open-plot-jungle-ziggurat": {
89
89
  "armed": "2026-11-18",
@@ -91,7 +91,7 @@
91
91
  "epoch": 8,
92
92
  "playingBytes": 683128342,
93
93
  "loadingBytes": 992540003,
94
- "evidence": "engine-pinned product revision 1 (tar 62fdb3cc7e41), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
94
+ "evidence": "engine-pinned product revision 1 (tar 62fdb3cc7e41), a shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
95
95
  },
96
96
  "open-plot-lantern-bayou": {
97
97
  "armed": "2026-11-18",
@@ -99,7 +99,7 @@
99
99
  "epoch": 8,
100
100
  "playingBytes": 679945285,
101
101
  "loadingBytes": 989938627,
102
- "evidence": "engine-pinned product revision 1 (tar 1f9fb1cba098), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
102
+ "evidence": "engine-pinned product revision 1 (tar 1f9fb1cba098), a shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
103
103
  },
104
104
  "open-plot-mosslight-ruins": {
105
105
  "armed": "2026-11-18",
@@ -107,7 +107,7 @@
107
107
  "epoch": 8,
108
108
  "playingBytes": 693006386,
109
109
  "loadingBytes": 1006944516,
110
- "evidence": "engine-pinned product revision 1 (tar 19840339238b), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
110
+ "evidence": "engine-pinned product revision 1 (tar 19840339238b), a shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
111
111
  },
112
112
  "open-plot-night-market": {
113
113
  "armed": "2026-11-18",
@@ -115,7 +115,7 @@
115
115
  "epoch": 8,
116
116
  "playingBytes": 709180040,
117
117
  "loadingBytes": 1028237840,
118
- "evidence": "engine-pinned product revision 1 (tar d8fe11c2db67), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
118
+ "evidence": "engine-pinned product revision 1 (tar d8fe11c2db67), a shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
119
119
  },
120
120
  "open-plot-patchwork-fairground": {
121
121
  "armed": "2026-11-18",
@@ -123,7 +123,7 @@
123
123
  "epoch": 8,
124
124
  "playingBytes": 670516626,
125
125
  "loadingBytes": 974863462,
126
- "evidence": "engine-pinned product revision 1 (tar e517f4814ef6), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
126
+ "evidence": "engine-pinned product revision 1 (tar e517f4814ef6), a shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
127
127
  },
128
128
  "open-plot-saltwind-lighthouse": {
129
129
  "armed": "2026-11-18",
@@ -131,7 +131,7 @@
131
131
  "epoch": 8,
132
132
  "playingBytes": 657567209,
133
133
  "loadingBytes": 956173411,
134
- "evidence": "engine-pinned product revision 1 (tar 2e37a04b0c9e), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
134
+ "evidence": "engine-pinned product revision 1 (tar 2e37a04b0c9e), a shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
135
135
  },
136
136
  "open-plot-sky-harbor": {
137
137
  "armed": "2026-11-18",
@@ -139,7 +139,7 @@
139
139
  "epoch": 8,
140
140
  "playingBytes": 671985118,
141
141
  "loadingBytes": 977835231,
142
- "evidence": "engine-pinned product revision 1 (tar 9aa4a9839015), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
142
+ "evidence": "engine-pinned product revision 1 (tar 9aa4a9839015), a shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
143
143
  },
144
144
  "open-plot-sky-race": {
145
145
  "armed": "2026-11-18",
@@ -147,7 +147,7 @@
147
147
  "epoch": 8,
148
148
  "playingBytes": 671490214,
149
149
  "loadingBytes": 977159704,
150
- "evidence": "engine-pinned product revision 1 (tar a5633d8eee7f), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
150
+ "evidence": "engine-pinned product revision 1 (tar a5633d8eee7f), a shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
151
151
  },
152
152
  "open-plot-starfall-observatory": {
153
153
  "armed": "2026-11-18",
@@ -155,7 +155,7 @@
155
155
  "epoch": 8,
156
156
  "playingBytes": 674717033,
157
157
  "loadingBytes": 981241332,
158
- "evidence": "engine-pinned product revision 1 (tar 25331b613be1), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
158
+ "evidence": "engine-pinned product revision 1 (tar 25331b613be1), a shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
159
159
  },
160
160
  "open-plot-thin-ice": {
161
161
  "armed": "2026-11-18",
@@ -163,7 +163,7 @@
163
163
  "epoch": 8,
164
164
  "playingBytes": 657896658,
165
165
  "loadingBytes": 957357794,
166
- "evidence": "engine-pinned product revision 1 (tar 4546f70ddac2), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
166
+ "evidence": "engine-pinned product revision 1 (tar 4546f70ddac2), a shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
167
167
  },
168
168
  "pastel-plain": {
169
169
  "armed": "2026-11-18",
@@ -171,7 +171,7 @@
171
171
  "epoch": 8,
172
172
  "playingBytes": 636958876,
173
173
  "loadingBytes": 925256481,
174
- "evidence": "engine-pinned product revision 1 (tar e42e2f5f5793), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
174
+ "evidence": "engine-pinned product revision 1 (tar e42e2f5f5793), a shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
175
175
  },
176
176
  "sunscar-dunes": {
177
177
  "armed": "2026-11-18",
@@ -179,7 +179,7 @@
179
179
  "epoch": 8,
180
180
  "playingBytes": 772000529,
181
181
  "loadingBytes": 1108011593,
182
- "evidence": "engine-pinned product revision 2 (tar f4a1d611cccc), a data shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
182
+ "evidence": "engine-pinned product revision 2 (tar f4a1d611cccc), a shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
183
183
  }
184
184
  },
185
185
  "held": {
@@ -30,7 +30,8 @@ const section = v.strictObject({ ...measuredFile, name: sectionName, schema: v.p
30
30
  const cookRow = v.exactOptional(v.strictObject({ ...measuredFile, path: v.literal('cook.json') }));
31
31
  const costs = v.omit(FilesSchema.pipe[0].item, ['kind']).entries;
32
32
  const fileSchema = v.strictObject({ ...costs, path, kind: v.picklist(['glb', 'ktx2', 'audio', 'json', 'wasm', 'tile', 'bin', 'image']), name: v.exactOptional(v.pipe(v.string(), v.maxLength(240))), tier: v.exactOptional(v.picklist(['phone', 'desktop'])), variantOf: v.exactOptional(v.pipe(v.string(), v.minLength(1), v.maxLength(240))), commons: v.exactOptional(v.literal(true)), jsonSchema: v.exactOptional(v.record(v.string(), v.unknown())) });
33
- const runtime = v.strictObject({ ...v.omit(ClientPlanRuntimeSchema.pipe[0], ['spawns']).entries, trust: v.literal('first-party'), files: v.pipe(v.array(v.strictObject({ ...measuredFile, lines: ShardNaturalSchema })), v.maxLength(0)), lines: v.literal(0) });
33
+ /** `trust` is retired (OF1): new indexes omit it, old products still carry their value and nothing reads it. */
34
+ const runtime = v.strictObject({ ...v.omit(ClientPlanRuntimeSchema.pipe[0], ['spawns']).entries, trust: v.exactOptional(v.unknown()), files: v.pipe(v.array(v.strictObject({ ...measuredFile, lines: ShardNaturalSchema })), v.maxLength(0)), lines: v.literal(0) });
34
35
  /** Format 2 inventories every emitted byte except its index and validation receipt. */
35
36
  export const OutputIndexSchema: v.GenericSchema<OutputIndexRowsInput, OutputIndexRows> & { readonly entries: { readonly [Key in keyof OutputIndexRows]-?: v.GenericSchema<OutputIndexRowsInput[Key], OutputIndexRows[Key]> } } = v.strictObject({
36
37
  format: v.literal('wildshard.shardfile'), formatVersion: v.literal(2), sdk: v.picklist(['0.2', '0.3']), version: v.picklist(SHARDFILE_VERSIONS),
@@ -224,7 +225,7 @@ interface OutputIndexRowsInputFields {
224
225
  bytes: number;
225
226
  } | undefined;
226
227
  runtime: {
227
- trust: "first-party";
228
+ trust?: unknown;
228
229
  files: {
229
230
  lines: number;
230
231
  path: string;
@@ -322,7 +323,7 @@ interface OutputIndexRowsFields {
322
323
  bytes: number;
323
324
  } | undefined;
324
325
  runtime: {
325
- trust: "first-party";
326
+ trust?: unknown;
326
327
  files: {
327
328
  lines: number;
328
329
  path: string;
@@ -371,7 +371,7 @@ export function shardfileRules(s: Shardfile, sections?: ReadonlyMap<string, unkn
371
371
  if (s.crowds.some(row => Math.abs(row.x) > CHUNK_HALF || Math.abs(row.z) > CHUNK_HALF)) errors.push('declared crowd home in cell');
372
372
  if (spawnCapacity(s.creatures.spawns) + crowdMembers > s.serverBudget.entities) errors.push('declared entity capacity');
373
373
  errors.push(...creatureSizeRules(s.rows.species, s.creatures.spawns));
374
- for (const spawn of s.creatures.spawns) if (!species.get(spawn.species)?.variants.some((row) => row.id === spawn.variant) || (spawn.strike !== null && !strikes.has(spawn.strike))) errors.push('declared spawn species/variant/strike');
374
+ for (const spawn of s.creatures.spawns) if (!species.get(spawn.species)?.variants.some((row) => row.id === spawn.variant) || (spawn.strike !== null && !strikes.has(spawn.strike))) errors.push(`declared spawn species/variant/strike: ${spawn.id}`);
375
375
  errors.push(...encounterRules(s.encounters, s.creatures.spawns.map((spawn) => spawn.id), s.ui.filter((row) => row.kind === 'bossPanel')));
376
376
  const controlled = new Set(s.encounters.map((row) => row.entity));
377
377
  errors.push(...groupBrainRules(s.creatures.groups, s.creatures.spawns, s.creatures.brains.map((row) => row.id), [...controlled]));
@@ -391,6 +391,8 @@ export function shardfileRules(s: Shardfile, sections?: ReadonlyMap<string, unkn
391
391
  })) errors.push('exactly one declared creature controller');
392
392
  return [...new Set(errors)];
393
393
  }
394
+ /** How many failing semantic rules a refusal names before it counts the rest. */
395
+ const NAMED_RULES = 8;
394
396
  /** Strict schema for the public SDK format; rejects unknown fields and invalid references.
395
397
  * Keep the unknown-input/named-output boundary independent of the nested validator implementation. */
396
398
  function shardfileSchema(sections?: ReadonlyMap<string, unknown>): v.GenericSchema<unknown, Shardfile> { return v.pipe(v.unknown(), v.rawCheck(({ dataset, addIssue }) => {
@@ -408,7 +410,15 @@ function shardfileSchema(sections?: ReadonlyMap<string, unknown>): v.GenericSche
408
410
  }
409
411
  }), rawSchema,
410
412
  v.rawCheck(({ dataset, addIssue }) => { if (dataset.typed) { try { preflightAssetGraph(dataset.value); } catch (error) { addIssue({ message: error instanceof Error ? error.message : 'shardfile asset graph admission' }); } } }),
411
- v.check((s) => entrywayRules(s).length === 0, 'illegal shard: entryway openings must meet road height y=0'), v.check((s) => shardfileRules(s, sections).length === 0, 'shardfile semantic rules')); }
413
+ v.check((s) => entrywayRules(s).length === 0, 'illegal shard: entryway openings must meet road height y=0'), v.rawCheck(({ dataset, addIssue }) => {
414
+ // OF-NE21: the refusal names its rules (the first eight), so an author sees which row is at fault
415
+ if (!dataset.typed) { return; }
416
+ const rules = shardfileRules(dataset.value, sections);
417
+ if (rules.length === 0) { return; }
418
+ const named = rules.filter((_rule, index): boolean => index < NAMED_RULES);
419
+ const rest = rules.length > named.length ? `; and ${String(rules.length - named.length)} more` : '';
420
+ addIssue({ message: `shardfile semantic rules: ${named.join('; ')}${rest}` });
421
+ })); }
412
422
  export const ShardfileSchema: v.GenericSchema<unknown, Shardfile> = shardfileSchema();
413
423
  /** Parse JSON through every shard rule. Optional section payloads extend item target
414
424
  * references only through the defining species-program contract, never an id allowlist.