@wildshard/shard-format 0.74.1 → 0.75.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.74.1",
3
+ "version": "0.75.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": {
@@ -4,8 +4,6 @@ import { MarkedBossPresentationSchema } from './bossProfiles.ts';
4
4
 
5
5
  const finite = v.pipe(v.number(), v.finite());
6
6
  const id = v.pipe(v.string(), v.minLength(1), v.maxLength(128));
7
- const count = v.pipe(finite, v.integer(), v.minValue(0), v.maxValue(4096));
8
- const ids = v.pipe(v.array(id), v.maxLength(1024), v.check(rows => new Set(rows).size === rows.length, 'Unique owner ids'));
9
7
  const home = v.strictObject({ x: finite, y: finite, z: finite, r: v.pipe(finite, v.minValue(Number.MIN_VALUE)) });
10
8
  const capture = v.union([
11
9
  v.strictObject({ flag: id }), v.strictObject({ action: id }),
@@ -41,17 +39,6 @@ export const ClientQuestPageSchema: v.StrictObjectSchema<{ readonly kind: v.Gene
41
39
  endpoints: v.optional(v.pipe(v.array(v.strictObject({ mover: id, stage: id, toast: v.exactOptional(v.pipe(v.string(), v.maxLength(4096))) })), v.maxLength(64)), []),
42
40
  capture: v.optional(v.pipe(v.record(id, v.pipe(v.array(capture), v.maxLength(64))), v.maxEntries(64)), {}),
43
41
  });
44
- /** Native body allocation/refill policy; placement rows retain their original
45
- * identities in sim/runtime-plan rather than introducing a second roster. */
46
- export const ClientPopulationSchema: v.StrictObjectSchema<{ readonly kind: v.GenericSchema<ClientPopulationRowsInput['kind'], ClientPopulationRows['kind']>; readonly system: v.GenericSchema<ClientPopulationRowsInput['system'], ClientPopulationRows['system']>; readonly held: v.ExactOptionalSchema<v.GenericSchema<Exclude<ClientPopulationRowsInput['held'], undefined>, Exclude<ClientPopulationRows['held'], undefined>>, undefined>; readonly bodyHomes: v.OptionalSchema<v.GenericSchema<Exclude<ClientPopulationRowsInput['bodyHomes'], undefined>, Exclude<ClientPopulationRows['bodyHomes'], undefined>>, readonly []>; readonly holds: v.ExactOptionalSchema<v.GenericSchema<Exclude<ClientPopulationRowsInput['holds'], undefined>, Exclude<ClientPopulationRows['holds'], undefined>>, undefined>; readonly groups: v.OptionalSchema<v.GenericSchema<Exclude<ClientPopulationRowsInput['groups'], undefined>, Exclude<ClientPopulationRows['groups'], undefined>>, Record<never, never>>; readonly witness: v.GenericSchema<ClientPopulationRowsInput['witness'], ClientPopulationRows['witness']>; }, undefined> = v.strictObject({ kind: v.literal('population.homes'), system: id,
47
- held: v.exactOptional(v.strictObject({ order: ids, settle: id,
48
- placements: v.optional(v.pipe(v.array(v.strictObject({ id, fromY: finite, y: finite })), v.maxLength(1024)), []),
49
- })),
50
- bodyHomes: v.optional(v.pipe(v.array(v.strictObject({ id, home })), v.maxLength(1024)), []),
51
- holds: v.exactOptional(v.strictObject({ system: id, rows: v.pipe(v.array(v.strictObject({ home: count, field: id, until: id })), v.maxLength(1024)) })),
52
- groups: v.optional(v.pipe(v.record(id, ids), v.maxEntries(64)), {}),
53
- witness: v.union([v.strictObject({ groups: ids }), v.strictObject({ kinds: ids })]),
54
- });
55
42
  /** Browser presentation borrows the actual encounter definition, profile,
56
43
  * director and victory policy already admitted by sim/runtime-plan. */
57
44
  const bossFight = { actor: id,
@@ -200,80 +187,6 @@ interface ClientQuestPageRowsFields {
200
187
  }))[]>;
201
188
  }
202
189
  export type ClientQuestPageRows = { [Key in keyof ClientQuestPageRowsFields]: ClientQuestPageRowsFields[Key] };
203
- interface ClientPopulationRowsInputFields {
204
- kind: 'population.homes';
205
- system: string;
206
- held?: {
207
- order: (string)[];
208
- settle: string;
209
- placements?: ({
210
- id: string;
211
- fromY: number;
212
- y: number;
213
- })[] | undefined;
214
- };
215
- bodyHomes?: ({
216
- id: string;
217
- home: {
218
- x: number;
219
- y: number;
220
- z: number;
221
- r: number;
222
- };
223
- })[] | undefined;
224
- holds?: {
225
- system: string;
226
- rows: ({
227
- home: number;
228
- field: string;
229
- until: string;
230
- })[];
231
- };
232
- groups?: Record<string, (string)[]> | undefined;
233
- witness: ({
234
- groups: (string)[];
235
- }) | ({
236
- kinds: (string)[];
237
- });
238
- }
239
- export type ClientPopulationRowsInput = { [Key in keyof ClientPopulationRowsInputFields]: ClientPopulationRowsInputFields[Key] };
240
- interface ClientPopulationRowsFields {
241
- kind: 'population.homes';
242
- system: string;
243
- held?: {
244
- order: (string)[];
245
- settle: string;
246
- placements: ({
247
- id: string;
248
- fromY: number;
249
- y: number;
250
- })[];
251
- };
252
- bodyHomes: ({
253
- id: string;
254
- home: {
255
- x: number;
256
- y: number;
257
- z: number;
258
- r: number;
259
- };
260
- })[];
261
- holds?: {
262
- system: string;
263
- rows: ({
264
- home: number;
265
- field: string;
266
- until: string;
267
- })[];
268
- };
269
- groups: Record<string, (string)[]>;
270
- witness: ({
271
- groups: (string)[];
272
- }) | ({
273
- kinds: (string)[];
274
- });
275
- }
276
- export type ClientPopulationRows = { [Key in keyof ClientPopulationRowsFields]: ClientPopulationRowsFields[Key] };
277
190
  interface ClientBossTelegraphRowsInputFields {
278
191
  kind: 'boss.telegraph';
279
192
  actor: string;
@@ -9,11 +9,11 @@ import { pageDrawsDeclaredLooks, rigLookRules } from './rig-looks.ts';
9
9
  export function clientOwnershipRules(source: Shardfile, sections: ReadonlyMap<string, unknown>): readonly string[] {
10
10
  const raw = sections.get('client/plan'), rigs = rigLookRules(source.rows.looks, sections);
11
11
  const features = raw === undefined ? [] : parseClientPlan(raw).features;
12
- const page = hasDeclaredClientPage(source), native = features.some(row => row.kind === 'population.homes');
13
- if (!page && !native) return rigs;
12
+ const page = hasDeclaredClientPage(source);
13
+ if (!page) return rigs;
14
14
  // OF19d1: a page drawing its declared bodies from their looks needs no species program
15
15
  const errors: string[] = [...rigs], program = !pageDrawsDeclaredLooks(source, sections.get('sim/runtime-plan'), features);
16
- if (!page || source.runtime !== null) errors.push('Native client features require their typed data page owner');
16
+ if (source.runtime !== null) errors.push('Native client features require their typed data page owner');
17
17
  for (const kind of ['world.scenes', 'motion.channels', ...program ? ['species.program'] as const : [], 'held.melee', 'quest.page'] as const)
18
18
  if (!features.some(row => row.kind === kind)) errors.push(`Data page requires ${kind}`);
19
19
  const quest = features.find(row => row.kind === 'quest.page'), held = features.find(row => row.kind === 'held.melee');
@@ -17,7 +17,7 @@ import { isJsonData } from './json.ts';
17
17
  import { LightEmittersSchema } from './lightEmitters.ts';
18
18
  import { EasedFieldsSchema } from './easedFields.ts';
19
19
  import { SceneMotionSchema } from './sceneMotion.ts';
20
- import { ClientHeldMeleeSchema, ClientSpeciesProgramSchema, ClientQuestPageSchema, ClientPopulationSchema, ClientHeldBossSchema, ClientSpawnedBossSchema, ClientPlayerEnterSchema, ClientBossTelegraphSchema } from './clientNative.ts';
20
+ import { ClientHeldMeleeSchema, ClientSpeciesProgramSchema, ClientQuestPageSchema, ClientHeldBossSchema, ClientSpawnedBossSchema, ClientPlayerEnterSchema, ClientBossTelegraphSchema } from './clientNative.ts';
21
21
 
22
22
  const finite=v.pipe(v.number(),v.finite()),rgb=v.tuple([finite,finite,finite]);
23
23
  const label=v.pipe(v.string(),v.minLength(1),v.maxLength(512));
@@ -135,7 +135,7 @@ export const ClientFeatureSchema: v.GenericSchema<ClientFeatureInput, ClientFeat
135
135
  v.strictObject({ kind: v.literal('world.scenes') }),
136
136
  v.strictObject({ kind: v.literal('world.baked'), rows: v.pipe(v.array(BakedTilesSchema), v.minLength(1), v.maxLength(4), v.check(rows => new Set(rows.map(row => row.id)).size === rows.length, 'unique baked tile ids')) }),
137
137
  v.strictObject({ kind: v.literal('motion.channels'), rows: SceneMotionSchema }),
138
- ClientHeldMeleeSchema, ClientSpeciesProgramSchema, ClientQuestPageSchema, ClientPopulationSchema, ClientTrailsSchema, ClientCuesSchema,
138
+ ClientHeldMeleeSchema, ClientSpeciesProgramSchema, ClientQuestPageSchema, ClientTrailsSchema, ClientCuesSchema,
139
139
  ClientHeldBossSchema, ClientSpawnedBossSchema, ClientPlayerEnterSchema, ClientBossTelegraphSchema,
140
140
  v.strictObject({ kind: v.literal('light.emitters'), rows: LightEmittersSchema }),
141
141
  v.strictObject({ kind: v.literal('weather.fields'), rows: EasedFieldsSchema, quest: id }),
@@ -207,7 +207,7 @@ export type ClientFeatureInput = { kind: 'strings.register'; } | { kind: 'conten
207
207
  | { kind: 'world.scenes'; } | { kind: 'world.baked'; rows: (v.InferInput<typeof BakedTilesSchema>)[]; } | {
208
208
  kind: 'motion.channels'; rows: v.InferInput<typeof SceneMotionSchema>; } | v.InferInput<typeof
209
209
  ClientHeldMeleeSchema> | v.InferInput<typeof ClientSpeciesProgramSchema> | v.InferInput<typeof
210
- ClientQuestPageSchema> | v.InferInput<typeof ClientPopulationSchema> | v.InferInput<typeof ClientTrailsSchema>
210
+ ClientQuestPageSchema> | v.InferInput<typeof ClientTrailsSchema>
211
211
  | v.InferInput<typeof ClientCuesSchema> | v.InferInput<typeof ClientHeldBossSchema> | v.InferInput<typeof
212
212
  ClientSpawnedBossSchema> | v.InferInput<typeof ClientPlayerEnterSchema> | v.InferInput<typeof
213
213
  ClientBossTelegraphSchema> | { kind: 'light.emitters'; rows: v.InferInput<typeof LightEmittersSchema>; } | {
@@ -271,7 +271,7 @@ export type ClientFeatureRow = { kind: 'strings.register'; } | { kind: 'content.
271
271
  boolean; }; })[]; } | { kind: 'world.scenes'; } | { kind: 'world.baked'; rows: (v.InferOutput<typeof
272
272
  BakedTilesSchema>)[]; } | { kind: 'motion.channels'; rows: v.InferOutput<typeof SceneMotionSchema>; } |
273
273
  v.InferOutput<typeof ClientHeldMeleeSchema> | v.InferOutput<typeof ClientSpeciesProgramSchema> |
274
- v.InferOutput<typeof ClientQuestPageSchema> | v.InferOutput<typeof ClientPopulationSchema> |
274
+ v.InferOutput<typeof ClientQuestPageSchema> |
275
275
  v.InferOutput<typeof ClientTrailsSchema> | v.InferOutput<typeof ClientCuesSchema> | v.InferOutput<typeof
276
276
  ClientHeldBossSchema> | v.InferOutput<typeof ClientSpawnedBossSchema> | v.InferOutput<typeof
277
277
  ClientPlayerEnterSchema> | v.InferOutput<typeof ClientBossTelegraphSchema> | { kind: 'light.emitters'; rows:
@@ -6,9 +6,10 @@ const id = v.pipe(v.string(), v.minLength(1), v.maxLength(128))
6
6
  const real = v.pipe(v.number(), v.minValue(0), v.maxValue(10000))
7
7
  const FEWEST_MEMBERS = 1
8
8
  const MOST_MEMBERS = 256
9
- const group = v.exactOptional(id)
10
- const members = v.exactOptional(
11
- v.pipe(v.array(id), v.minLength(FEWEST_MEMBERS), v.maxLength(MOST_MEMBERS)),
9
+ const members = v.pipe(
10
+ v.array(id),
11
+ v.minLength(FEWEST_MEMBERS),
12
+ v.maxLength(MOST_MEMBERS),
12
13
  )
13
14
  /** Whether no two trail rows share a system id. */
14
15
  function uniqueIds(rows: readonly Readonly<{ id: string }>[]): boolean {
@@ -17,21 +18,10 @@ function uniqueIds(rows: readonly Readonly<{ id: string }>[]): boolean {
17
18
  .size === rows.length
18
19
  )
19
20
  }
20
- /** Whether every trail row names exactly one of its group and its members. */
21
- function oneSource(
22
- rows: readonly Partial<Readonly<Record<'group' | 'members', unknown>>>[],
23
- ): boolean {
24
- for (const row of rows) {
25
- if ((row.group === undefined) === (row.members === undefined)) {
26
- return false
27
- }
28
- }
29
- return true
30
- }
31
- /** Client-only trails follow actual native population groups in their local
32
- * world frame. Looks and timing are data; there are no owner callbacks. A row
33
- * names a page population's group, or (ONE-FORMAT OF29e7a) the declared spawns
34
- * it follows as `members`; exactly one. */
21
+ /** Client-only trails follow actual native bodies in their local world frame.
22
+ * Looks and timing are data; there are no owner callbacks. A row names the
23
+ * declared spawns it follows as `members` (ONE-FORMAT OF29e7a); the page
24
+ * population group went with `population.homes` (FORMAT-PRUNE FP43). */
35
25
  export const ClientTrailsSchema: v.StrictObjectSchema<
36
26
  {
37
27
  readonly kind: v.GenericSchema<
@@ -50,7 +40,6 @@ export const ClientTrailsSchema: v.StrictObjectSchema<
50
40
  v.array(
51
41
  v.strictObject({
52
42
  id,
53
- group,
54
43
  members,
55
44
  library: id,
56
45
  look: id,
@@ -72,10 +61,6 @@ export const ClientTrailsSchema: v.StrictObjectSchema<
72
61
  uniqueIds,
73
62
  'Unique trail systems',
74
63
  ),
75
- v.check<ClientTrailsRows['rows'], string>(
76
- oneSource,
77
- 'A trail names its group or its members',
78
- ),
79
64
  ),
80
65
  })
81
66
 
@@ -102,8 +87,7 @@ interface ClientTrailsRowsFields {
102
87
  kind: 'fx.trail'
103
88
  rows: {
104
89
  id: string
105
- group?: string
106
- members?: string[]
90
+ members: string[]
107
91
  library: string
108
92
  look: string
109
93
  name: string
@@ -29,7 +29,10 @@ import type { GenericSchema } from 'valibot'
29
29
  // `mounts` are the shard's own files that its sections and boot tables
30
30
  // name by a public URL: the bytes travel in the product under `mounts/`
31
31
  // and the cook publishes each one at its URL. `packs` and `fence` are
32
- // optional only on legacy version 1. Version 2 requires J198 preparation.
32
+ // optional only on legacy version 1, which only an unprepared draft writes
33
+ // (`wildshard build` before `wildshard prepare`). Version 2 is gone
34
+ // (FORMAT-PRUNE FP23: no kept original or engine pin used it); version 3
35
+ // on requires J198 preparation.
33
36
 
34
37
  interface CookMount {
35
38
  readonly url: string
@@ -115,36 +118,15 @@ const SpecCookDataSchema = strictObject({
115
118
  ...CookSpecPreparationSchema.entries,
116
119
  mounts: mountRows,
117
120
  })
118
- const PREVIOUS_COOK_VERSION = 2
119
- const PreviousCookDataSchema = strictObject({
120
- version: literal(PREVIOUS_COOK_VERSION),
121
- inputHash: CookPreparationSchema.entries.inputHash,
122
- packs: CookPreparationSchema.entries.packs,
123
- fence: CookPreparationSchema.entries.fence,
124
- programs: CookPreparationSchema.entries.programs,
125
- mounts: mountRows,
126
- })
127
- interface PreviousCookData extends Omit<
128
- CookPreparation,
129
- 'version' | 'renderer'
130
- > {
131
- readonly version: typeof PREVIOUS_COOK_VERSION
132
- readonly mounts: readonly CookMount[]
133
- }
134
121
  interface PreparedCookData extends CookPreparation {
135
122
  readonly mounts: readonly CookMount[]
136
123
  }
137
124
  interface SpecCookData extends CookSpecPreparation {
138
125
  readonly mounts: readonly CookMount[]
139
126
  }
140
- type CookData =
141
- | LegacyCookData
142
- | PreviousCookData
143
- | PreparedCookData
144
- | SpecCookData
127
+ type CookData = LegacyCookData | PreparedCookData | SpecCookData
145
128
  const CookDataSchema: GenericSchema<unknown, CookData> = variant('version', [
146
129
  LegacyCookDataSchema,
147
- PreviousCookDataSchema,
148
130
  PreparedCookDataSchema,
149
131
  SpecCookDataSchema,
150
132
  ])
@@ -129,8 +129,8 @@ const RULES: readonly DeprecationRule[] = [
129
129
  path: 'shard.json requires.sdk (SHARD-COMPAT CP8): a copy of the format version',
130
130
  since: ENVELOPE,
131
131
  replacement:
132
- 'nothing: formatVersion names the format; writers stop sourcing it, then it goes at zero users',
133
- migration: undefined,
132
+ 'nothing: formatVersion names the format; format 0.1.0.5 refuses it and the chain drops it (FORMAT-PRUNE FP33)',
133
+ migration: 'fp33-drop-requires-sdk',
134
134
  uses: (shard: Readonly<DeprecationInput>): boolean =>
135
135
  field(field(shard.index, 'requires'), 'sdk') !== undefined,
136
136
  },
@@ -57,7 +57,6 @@ const CLIENT_FEATURE_SIDES: Readonly<Record<ClientFeatureKind, SideEntry>> =
57
57
  'motion.channels': VIEW,
58
58
  'page.life': VIEW,
59
59
  'player.enter': both('fallFloor'),
60
- 'population.homes': VIEW,
61
60
  'population.hull-book': VIEW,
62
61
  'population.product-creatures': VIEW,
63
62
  'population.wildlife': VIEW,
@@ -13,6 +13,7 @@ type JsonRecord = Record<string, unknown>
13
13
  const ENVELOPE = '0.1.0.2'
14
14
  const PREPARATION_MARKER = '0.1.0.3'
15
15
  const SAVE_REVISION = '0.1.0.4'
16
+ const NO_REQUIRES_SDK = '0.1.0.5'
16
17
 
17
18
  function isRecord(value: unknown): value is JsonRecord {
18
19
  return typeof value === 'object' && value !== null && !Array.isArray(value)
@@ -74,6 +75,21 @@ const dropRequiresCapabilities: FormatMigration = {
74
75
  repairs: carriesCapabilities,
75
76
  }
76
77
 
78
+ /** FORMAT-PRUNE FP33 (SHARD-COMPAT CP8's last clause): `requires.sdk`, a copy of the format version nothing reads. Data
79
+ * only; the copy's declared source hash is re-sealed over the new index, as for `requires.capabilities`. */
80
+ const dropRequiresSdk: FormatMigration = {
81
+ id: 'fp33-drop-requires-sdk',
82
+ to: NO_REQUIRES_SDK,
83
+ touches: 'data',
84
+ affects: [],
85
+ apply: (shard: MigratingShard): void => {
86
+ const requires = requiresOf(shard)
87
+ if (requires !== undefined) {
88
+ Reflect.deleteProperty(requires, 'sdk')
89
+ }
90
+ },
91
+ }
92
+
77
93
  /** SHARD-COMPAT PR4 (J487, FORMAT-PRUNE FP5 folded in): the `sdk` marker becomes `preparation`, the spec version the
78
94
  * file was prepared to. `'0.3'` (prepared) is spec 3, the only spec that marker ever meant; `'0.2'` (built, not
79
95
  * prepared) leaves no field. Data only: the copy's `cook.json` stays spec 3 and its input hash is re-sealed over the
@@ -133,6 +149,7 @@ export {
133
149
  declaredShardfileFormat,
134
150
  dropEmptyIndexFields,
135
151
  dropRequiresCapabilities,
152
+ dropRequiresSdk,
136
153
  formatVersionField,
137
154
  preparationMarker,
138
155
  saveRevisionName,
@@ -0,0 +1,103 @@
1
+ // oxlint-disable typescript/prefer-readonly-parameter-types -- a step edits the shard it is handed, in place
2
+ /** FORMAT-PRUNE FP43's chain step (J486, CP16): `population.homes` left the client plan (engine `8848e8930` refuses it at
3
+ * runtime), but kept originals still carry it (Far Reach r1 and r3 to r6, Sunscar Dunes r1, r2 and r5), so the format
4
+ * refused them as stored with no step to mend them. The copy drops the row, and a trail row that followed one of its
5
+ * groups names that group's members instead, the spawn ids the homes row listed, as FP38 did by hand in Sky Reach. */
6
+ import type { FormatMigration, MigratingShard } from './format-migrations.ts'
7
+
8
+ type JsonRecord = Record<string, unknown>
9
+
10
+ const HOMES = 'population.homes'
11
+ const TRAIL = 'fx.trail'
12
+ const PLANS = ['client/plan', 'server/plan'] as const
13
+ /** The format that first refuses the row (FP43 rides format 0.1.0.5 with FP33). */
14
+ const HOMES_GONE = '0.1.0.5'
15
+
16
+ function isRecord(value: unknown): value is JsonRecord {
17
+ return typeof value === 'object' && value !== null && !Array.isArray(value)
18
+ }
19
+
20
+ /** A plan's feature rows, or none. */
21
+ function featuresOf(plan: unknown): unknown[] {
22
+ if (!isRecord(plan)) {
23
+ return []
24
+ }
25
+ const { features } = plan
26
+ return Array.isArray(features) ? features : []
27
+ }
28
+
29
+ function kindIs(row: unknown, kind: string): row is JsonRecord {
30
+ return isRecord(row) && row['kind'] === kind
31
+ }
32
+
33
+ /** Every group the plan's homes rows declare, by name: the spawn ids in it. */
34
+ function homeGroups(features: readonly unknown[]): Map<string, unknown> {
35
+ const groups = new Map<string, unknown>()
36
+ for (const row of features) {
37
+ if (kindIs(row, HOMES) && isRecord(row['groups'])) {
38
+ for (const [name, members] of Object.entries(row['groups'])) {
39
+ groups.set(name, members)
40
+ }
41
+ }
42
+ }
43
+ return groups
44
+ }
45
+
46
+ /** A trail row that names `group` names that group's `members` in the same place; one naming no known group stays as it is
47
+ * and the copy's validator names it. */
48
+ function trailMembers(
49
+ row: JsonRecord,
50
+ groups: ReadonlyMap<string, unknown>,
51
+ ): void {
52
+ const { group } = row
53
+ if (typeof group !== 'string' || !groups.has(group)) {
54
+ return
55
+ }
56
+ const entries = Object.entries(row)
57
+ for (const [key] of entries) {
58
+ Reflect.deleteProperty(row, key)
59
+ }
60
+ for (const [key, value] of entries) {
61
+ if (key === 'group') {
62
+ row['members'] = groups.get(group)
63
+ } else {
64
+ row[key] = value
65
+ }
66
+ }
67
+ }
68
+
69
+ /** One plan: trails first take their members from the homes rows, then the homes rows go. */
70
+ function migratePlan(plan: unknown): void {
71
+ if (!isRecord(plan) || !Array.isArray(plan['features'])) {
72
+ return
73
+ }
74
+ const features = featuresOf(plan)
75
+ const groups = homeGroups(features)
76
+ for (const feature of features) {
77
+ if (kindIs(feature, TRAIL) && Array.isArray(feature['rows'])) {
78
+ for (const row of feature['rows']) {
79
+ if (isRecord(row)) {
80
+ trailMembers(row, groups)
81
+ }
82
+ }
83
+ }
84
+ }
85
+ plan['features'] = features.filter(
86
+ (row: unknown): boolean => !kindIs(row, HOMES),
87
+ )
88
+ }
89
+
90
+ /** FORMAT-PRUNE FP43: the copy carries no `population.homes` row, and its trails name their members. */
91
+ const homesToMembers: FormatMigration = {
92
+ id: 'fp43-homes-to-members',
93
+ to: HOMES_GONE,
94
+ touches: 'data',
95
+ affects: [],
96
+ apply: (shard: MigratingShard): void => {
97
+ for (const name of PLANS) {
98
+ migratePlan(shard.sections.get(name))
99
+ }
100
+ },
101
+ }
102
+
103
+ export { homesToMembers }
@@ -5,10 +5,12 @@
5
5
  import {
6
6
  dropEmptyIndexFields,
7
7
  dropRequiresCapabilities,
8
+ dropRequiresSdk,
8
9
  formatVersionField,
9
10
  preparationMarker,
10
11
  saveRevisionName,
11
12
  } from './format-migration-envelope.ts'
13
+ import { homesToMembers } from './format-migration-homes.ts'
12
14
  import { journalGlyphImages } from './format-migration-journal.ts'
13
15
  import {
14
16
  dropRuntimeTrust,
@@ -82,6 +84,8 @@ const FORMAT_MIGRATIONS: readonly FormatMigration[] = [
82
84
  saveRevisionName,
83
85
  schemaSource,
84
86
  dropRequiresCapabilities,
87
+ dropRequiresSdk,
88
+ homesToMembers,
85
89
  ]
86
90
 
87
91
  /** Whether a file at `version` still needs a step that writes `to`. The legacy two-part spelling sits just below its
@@ -18,6 +18,8 @@ export const HEADLESS_CONTEXT_SECTIONS = [
18
18
  'sim/bodies',
19
19
  // The offline simulation reads the ordinary portal ride from this plan.
20
20
  'client/plan',
21
+ // SHARD-COMPAT HS6: the server reads its feature rows (the portal ride among them) from its own plan only.
22
+ 'server/plan',
21
23
  ] as const
22
24
 
23
25
  /** Explicit admitted decision/move context crossing the worker boundary; no ABI is inferred from bytes. */
@@ -17,7 +17,7 @@ import { ClientPlanRuntimeSchema } from './runtime.ts';
17
17
  import { RuntimeSpawnsSchema } from './runtimeSpawns.ts';
18
18
  import { RowsSchema } from './rows.ts';
19
19
  import { ShardHashSchema, ShardNaturalSchema, IdentitySchema, RequiresSchema, FilesSchema, type ShardIdentityInput, type ShardRequiresInput, type ShardReferencesInput, type ShardIdentity, type ShardRequires, type ShardReferences } from './shardSections.ts';
20
- import { LEGACY_LAYOUT, writesPreparationMarker, writesSaveRevision } from './version.ts';
20
+ import { LEGACY_LAYOUT, writesNoRequiresSdk, writesPreparationMarker, writesSaveRevision } from './version.ts';
21
21
  import { IndexFormatVersionSchema, LegacyIndexVersionSchema } from './index-format-version.ts';
22
22
  import type { IndexFormatVersion, LegacyIndexVersion } from './version.ts';
23
23
  import { isJsonData, isJsonDataWithFileSchemas } from './json.ts';
@@ -132,10 +132,17 @@ function checkSaveRevisionSpelling(input: unknown, index: OutputIndex): void {
132
132
  // Only the old spelling in a new format refuses: a parsed index (any version) already reads back as `saveRevision`.
133
133
  if (spelled === 'revision' && version !== undefined && writesSaveRevision(version)) { throw new Error(`Format ${version} names the save lineage identity.saveRevision (shard.json)`); }
134
134
  }
135
+ /** FP33: 0.1.0.5 on carries no `requires.sdk`; an older file keeps it as written, so its source hash still matches. */
136
+ // oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- valibot output, only read
137
+ function checkNoRequiresSdk(index: OutputIndex): void {
138
+ const version = index.formatVersion === LEGACY_LAYOUT ? undefined : index.formatVersion;
139
+ if (version !== undefined && writesNoRequiresSdk(version) && index.requires.sdk !== undefined) { throw new Error(`Format ${version} carries no requires.sdk (shard.json; FORMAT-PRUNE FP33)`); }
140
+ }
135
141
  function parseOutputIndexRows(input: unknown): OutputIndex {
136
142
  const index = v.parse(OutputIndexSchema, input);
137
143
  checkIndexEnvelope(index);
138
144
  checkSaveRevisionSpelling(input, index);
145
+ checkNoRequiresSdk(index);
139
146
  const prepared = preparationSpecOf(index) !== undefined || unreadPreparationSpec(index) !== undefined;
140
147
  if (prepared && index.cook === undefined) { throw new Error(`Missing cook preparation: run wildshard prepare <folder> --base <exact-preview-url> (${index.identity.slug})`); }
141
148
  if (prepared && index.cook !== undefined && index.cook.bytes > MAX_COOK_BYTES) { throw new Error('Cook preparation exceeds byte cap'); }
@@ -58,7 +58,6 @@ const TABLE: readonly Primitive[] = [
58
58
  'population.poses',
59
59
  'population.reactions',
60
60
  'population.settle',
61
- 'population.homes',
62
61
  'population.wildlife',
63
62
  ],
64
63
  },
@@ -5,7 +5,7 @@ import { LEGACY_PREPARATION_SPEC, PREPARED_SDK } from './preparation-spec.ts'
5
5
  const ZERO = 0
6
6
  const ONE = 1
7
7
 
8
- const SHARDFILE_VERSION = '0.1.0.4'
8
+ const SHARDFILE_VERSION = '0.1.0.5'
9
9
  /** Formats whose `shard.json` names its version in `version`, beside the frozen layout marker `formatVersion: 2`.
10
10
  * Legacy 0.1 is the byte-preserving spelling of 0.1.0.0. */
11
11
  const LEGACY_INDEX_VERSIONS: readonly ['0.1', '0.1.0.0', '0.1.0.1'] = [
@@ -18,8 +18,9 @@ const LEGACY_INDEX_VERSIONS: readonly ['0.1', '0.1.0.0', '0.1.0.1'] = [
18
18
  const INDEX_FORMAT_VERSIONS: readonly [
19
19
  '0.1.0.2',
20
20
  '0.1.0.3',
21
+ '0.1.0.4',
21
22
  typeof SHARDFILE_VERSION,
22
- ] = ['0.1.0.2', '0.1.0.3', SHARDFILE_VERSION] as const
23
+ ] = ['0.1.0.2', '0.1.0.3', '0.1.0.4', SHARDFILE_VERSION] as const
23
24
  const SHARDFILE_VERSIONS: readonly [
24
25
  ...typeof LEGACY_INDEX_VERSIONS,
25
26
  ...typeof INDEX_FORMAT_VERSIONS,
@@ -40,6 +41,9 @@ const SHARDFILE_VERSION_PREPARATION = '0.1.0.3'
40
41
  /** The first format whose `shard.json` names the save lineage `identity.saveRevision` instead of `identity.revision`
41
42
  * (FORMAT-PRUNE FP26, J493): the number keys saves and only ever rises; it is not the API's shard revision. */
42
43
  const SHARDFILE_VERSION_SAVE_REVISION = '0.1.0.4'
44
+ /** The first format whose `shard.json` carries no `requires.sdk` (FORMAT-PRUNE FP33, SHARD-COMPAT CP8): it only ever
45
+ * copied the format version, and nothing reads it. */
46
+ const SHARDFILE_VERSION_NO_REQUIRES_SDK = '0.1.0.5'
43
47
  /** A format version's four parts. */
44
48
  type FormatVersionParts = readonly [number, number, number, number]
45
49
  /** @deprecated SHARD-COMPAT SP10: use `FormatVersionParts`. */
@@ -141,6 +145,13 @@ function writesSaveRevision(version: string): boolean {
141
145
  )
142
146
  }
143
147
 
148
+ /** Whether a format version writes no `requires.sdk` (0.1.0.5 on, FP33). */
149
+ function writesNoRequiresSdk(version: string): boolean {
150
+ return (
151
+ compareShardfileVersions(version, SHARDFILE_VERSION_NO_REQUIRES_SDK) >= ZERO
152
+ )
153
+ }
154
+
144
155
  /** FP26: a copy of an identity row with `revision` spelled `saveRevision`; anything else as it is. */
145
156
  function withSaveRevision(identity: unknown): unknown {
146
157
  if (
@@ -160,7 +171,20 @@ function withSaveRevision(identity: unknown): unknown {
160
171
  return Object.fromEntries(renamed)
161
172
  }
162
173
 
163
- /** The rows a version from 0.1.0.3 on changes in place: PR4's preparation marker, then FP26's save lineage. */
174
+ /** A copy of a JSON object without `keys`; anything else as it is. */
175
+ function withoutKeys(value: unknown, keys: readonly string[]): unknown {
176
+ if (typeof value !== 'object' || value === null || Array.isArray(value)) {
177
+ return value
178
+ }
179
+ return Object.fromEntries(
180
+ Object.entries(value).filter(
181
+ ([key]: readonly [string, unknown]): boolean => !keys.includes(key),
182
+ ),
183
+ )
184
+ }
185
+
186
+ /** The rows a version from 0.1.0.3 on changes in place: PR4's preparation marker, FP26's save lineage, then FP33's
187
+ * `requires.sdk`. */
164
188
  function laterEnvelopeRows(
165
189
  // oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- it changes the writer's envelope in place
166
190
  envelope: Record<string, unknown>,
@@ -179,18 +203,10 @@ function laterEnvelopeRows(
179
203
  if (writesSaveRevision(version)) {
180
204
  envelope['identity'] = withSaveRevision(envelope['identity'])
181
205
  }
182
- }
183
-
184
- /** A copy of a JSON object without `keys`; anything else as it is. */
185
- function withoutKeys(value: unknown, keys: readonly string[]): unknown {
186
- if (typeof value !== 'object' || value === null || Array.isArray(value)) {
187
- return value
206
+ // FORMAT-PRUNE FP33: from 0.1.0.5 `requires` carries no `sdk`.
207
+ if (writesNoRequiresSdk(version)) {
208
+ envelope['requires'] = withoutKeys(envelope['requires'], ['sdk'])
188
209
  }
189
- return Object.fromEntries(
190
- Object.entries(value).filter(
191
- ([key]: readonly [string, unknown]): boolean => !keys.includes(key),
192
- ),
193
- )
194
210
  }
195
211
 
196
212
  /** The rows `outputIndexEnvelope` returns: the writer's own rows, typed so it keeps reading them, with `version` and
@@ -245,8 +261,10 @@ export {
245
261
  writesIndexFormatVersion,
246
262
  writesPreparationMarker,
247
263
  writesSaveRevision,
264
+ writesNoRequiresSdk,
248
265
  SHARDFILE_VERSION_PREPARATION,
249
266
  SHARDFILE_VERSION_SAVE_REVISION,
267
+ SHARDFILE_VERSION_NO_REQUIRES_SDK,
250
268
  SHARDFILE_FLOOR,
251
269
  type FormatVersion,
252
270
  type FormatVersionParts,
@@ -369,10 +369,6 @@
369
369
  "page": ["enterClientPlayer", "installClientPlayerEnter"],
370
370
  "reads": []
371
371
  },
372
- "population.homes": {
373
- "page": ["installClientPopulation"],
374
- "reads": ["sim/runtime-plan", "sim/scripts"]
375
- },
376
372
  "population.hull-book": {
377
373
  "page": ["prepareDeclaredHullBookKit"],
378
374
  "reads": ["actors/species-programs", "explore/catalogue"]