@wildshard/shard-format 0.74.0 → 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.0",
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. */
@@ -12,7 +12,8 @@ export const NATIVE_ASSEMBLY_DATA_SCHEMA = '@wildshard/format/nativeAssembly#Nat
12
12
  export type NativeAssemblyRead = { file: string; path?: string[] } | { section: string; path?: string[] } | { value: unknown };
13
13
  /** One host's rows: what it reads and its data-only settings, in the install order the plan lists. */
14
14
  export type NativeAssemblyFeature =
15
- | { host: 'decisions' | 'commands' | 'loadout' | 'quest.body-scripts' | 'population.elites-ready' | 'population.reactions' | 'population.settle' | 'riding.elites-ready' | 'water.field' }
15
+ | { host: 'quest.body-scripts' }
16
+ | { host: 'decisions' | 'commands' | 'loadout' | 'population.elites-ready' | 'population.reactions' | 'population.settle' | 'riding.elites-ready' | 'water.field' }
16
17
  | { host: 'collision'; skipOnRestore?: boolean } | { host: 'collision.pieces'; rows: NativeAssemblyRead }
17
18
  | { host: 'day.keyed-sky' } | { host: 'day.toon'; start: number; cycle: number; phases: Record<string, string> } | { host: 'day.declared'; clock: NativeAssemblyRead }
18
19
  | { host: 'water.sea'; id: string } | { host: 'combat.motion'; speed: number }
@@ -87,19 +88,25 @@ const heldInput = v.strictObject({ attack: key, swap: key, aim: key, pitch: key
87
88
  const arenaInput = v.strictObject({ use: key, skip: key });
88
89
  const grant = v.strictObject({ item: key, count: number });
89
90
  const grants = v.pipe(v.array(grant), v.maxLength(MAX_GRANTS));
90
- const feature = v.variant('host', [
91
- v.strictObject({ host: v.picklist(['decisions', 'commands', 'loadout', 'quest.body-scripts', 'population.elites-ready', 'population.reactions', 'population.settle', 'riding.elites-ready', 'water.field']) }),
92
- v.strictObject({ host: v.literal('collision'), skipOnRestore: flag }), v.strictObject({ host: v.literal('collision.pieces'), rows: read }),
93
- v.strictObject({ host: v.literal('day.keyed-sky') }), v.strictObject({ host: v.literal('day.toon'), start: number, cycle: number, phases: v.record(key, key) }), v.strictObject({ host: v.literal('day.declared'), clock: read }),
94
- v.strictObject({ host: v.literal('water.sea'), id: key }), v.strictObject({ host: v.literal('combat.motion'), speed: number }),
95
- v.strictObject({ host: v.literal('item.ranged'), kind: v.picklist(['bolt', 'cycle', 'bow']), weapon: key }), v.strictObject({ host: v.literal('item.swept'), policy: read }),
96
- v.strictObject({ host: v.literal('ammunition'), step: key, refill: key }), v.strictObject({ host: v.literal('boss.ground'), encounter: read, binding: v.unknown() }),
91
+ /** The quest family's four hosts (FORMAT-PRUNE FP16, ONE-FORMAT OF17b3); `quest-server.ts` admits the same rows for the
92
+ * `server/quest` section (`quest-server-section.test.ts` holds the two together), and outlives this plan (FP21). */
93
+ const QUEST_HOST_ROWS = [
97
94
  v.strictObject({ host: v.literal('quest.composition'), rows: read, spots: read, counters: read, document: v.exactOptional(read), table: v.exactOptional(read), contracts: v.exactOptional(read), props: v.exactOptional(read),
98
95
  readSpots: flag, nativeFeats: flag, barter: flag, director: flag, restoring: flag }),
99
96
  // ONE-FORMAT OF22c3: a chapter's wake names a declared boss fight; `population` named the retired mixed population and
100
97
  // stays optional only for writers that still send it
101
98
  v.strictObject({ host: v.literal('quest.chapter'), id: key, rows: read, wake: read, reward: v.unknown(), population: v.exactOptional(key) }),
102
99
  v.strictObject({ host: v.literal('quest.kill-steps'), rows: read, counters: read }),
100
+ v.strictObject({ host: v.literal('quest.body-scripts') }),
101
+ ] as const;
102
+ const feature = v.variant('host', [
103
+ v.strictObject({ host: v.picklist(['decisions', 'commands', 'loadout', 'population.elites-ready', 'population.reactions', 'population.settle', 'riding.elites-ready', 'water.field']) }),
104
+ v.strictObject({ host: v.literal('collision'), skipOnRestore: flag }), v.strictObject({ host: v.literal('collision.pieces'), rows: read }),
105
+ v.strictObject({ host: v.literal('day.keyed-sky') }), v.strictObject({ host: v.literal('day.toon'), start: number, cycle: number, phases: v.record(key, key) }), v.strictObject({ host: v.literal('day.declared'), clock: read }),
106
+ v.strictObject({ host: v.literal('water.sea'), id: key }), v.strictObject({ host: v.literal('combat.motion'), speed: number }),
107
+ v.strictObject({ host: v.literal('item.ranged'), kind: v.picklist(['bolt', 'cycle', 'bow']), weapon: key }), v.strictObject({ host: v.literal('item.swept'), policy: read }),
108
+ v.strictObject({ host: v.literal('ammunition'), step: key, refill: key }), v.strictObject({ host: v.literal('boss.ground'), encounter: read, binding: v.unknown() }),
109
+ ...QUEST_HOST_ROWS,
103
110
  v.strictObject({ host: v.literal('weather.program'), program: read }), v.strictObject({ host: v.literal('weather.native'), program: read, shelters: read, rows: read }),
104
111
  v.strictObject({ host: v.picklist(['population.environment', 'population.shelter', 'population.roster', 'riding.groups']), rows: read }),
105
112
  v.strictObject({ host: v.literal('population.elites'), file: key }),
@@ -135,7 +142,8 @@ export const NativeAssemblySchema: v.GenericSchema<unknown, NativeAssemblyPlan>
135
142
  collision: v.exactOptional(collisionSchema),
136
143
  entries: entriesSchema,
137
144
  boot: v.exactOptional(read), field: v.exactOptional(v.strictObject({ rows: read, pond: key })),
138
- features: v.pipe(v.array(feature), v.minLength(1), v.maxLength(64)),
145
+ // FORMAT-PRUNE FP16: a plan may name no host; each family stands from its `server/*` section
146
+ features: v.pipe(v.array(feature), v.maxLength(64)),
139
147
  }));
140
148
  /** A server JSON file's rows: plain bounded data, admitted by the host that reads them. */
141
149
  export const NativeAssemblyDataSchema: v.GenericSchema<unknown, unknown> = v.pipe(v.unknown(), v.check(isJsonData, 'Native assembly data must be plain bounded JSON'));
@@ -61,6 +61,11 @@ const DATA_SECTION_NAMES: Readonly<Record<keyof PlatformDataSections, true>> = {
61
61
  "look/keyed-sky": true,
62
62
  "client/plan": true,
63
63
  "server/plan": true,
64
+ "server/quest": true,
65
+ "server/riding": true,
66
+ "server/boss": true,
67
+ "server/patrol": true,
68
+ "server/world": true,
64
69
  "view/modules": true,
65
70
  "held/arms": true,
66
71
  "held/gear": true,
@@ -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'); }
@@ -11,6 +11,12 @@ import { ToonLookSchema, type ToonLookRow } from './toonLook.ts';
11
11
  import { KEYED_SKY, type KeyedSkyStyle } from './keyedSky.ts';
12
12
  import { ClientPlanSchema, type ClientPlan } from './clientPlan.ts';
13
13
  import { ServerPlanSchema } from './server-plan.ts';
14
+ import { QuestServerSchema } from './quest-server.ts';
15
+ import type { QuestServer } from './quest-server.ts';
16
+ import { ServerHostsSchema } from './server-hosts.ts';
17
+ import type { ServerHosts } from './server-hosts.ts';
18
+ import { ServerWorldSchema } from './server-world.ts';
19
+ import type { ServerWorld } from './server-world.ts';
14
20
  import type { ServerPlan } from './server-plan.ts';
15
21
  import { SpawnScriptsSchema, type SpawnScriptRows } from './spawnScripts.ts';
16
22
  import { WorldScenesSchema, type WorldScenesSection } from './worldScenes.ts';
@@ -57,6 +63,11 @@ export interface PlatformDataSections {
57
63
  'client/plan': ClientPlan;
58
64
  /** SHARD-COMPAT HS6b: the server's own copy of the feature rows, so `client/plan` stays the page's. */
59
65
  'server/plan': ServerPlan;
66
+ 'server/quest': QuestServer;
67
+ 'server/riding': ServerHosts;
68
+ 'server/boss': ServerHosts;
69
+ 'server/patrol': ServerHosts;
70
+ 'server/world': ServerWorld;
60
71
  'view/modules': ViewModuleRow[];
61
72
  'held/arms': HeldArmsRows;
62
73
  'held/gear': HeldGearRows;
@@ -99,6 +110,11 @@ export const PLATFORM_DATA_SECTIONS: Readonly<{ [Name in keyof PlatformDataSecti
99
110
  'look/keyed-sky': { schema: KEYED_SKY },
100
111
  'client/plan': { schema: ClientPlanSchema },
101
112
  'server/plan': { schema: ServerPlanSchema },
113
+ 'server/quest': { schema: QuestServerSchema },
114
+ 'server/riding': { schema: ServerHostsSchema },
115
+ 'server/boss': { schema: ServerHostsSchema },
116
+ 'server/patrol': { schema: ServerHostsSchema },
117
+ 'server/world': { schema: ServerWorldSchema },
102
118
  'view/modules': { schema: ViewModulesSchema },
103
119
  'held/arms': { schema: HeldArmsSchema },
104
120
  'held/gear': { schema: HeldGearSchema },
@@ -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
  },
@@ -203,6 +202,17 @@ const TABLE: readonly Primitive[] = [
203
202
  on: { section: 'world/field', path: [] },
204
203
  hosts: ['water.field'],
205
204
  },
205
+ {
206
+ name: 'quest',
207
+ row: 'FP16',
208
+ on: { section: 'server/quest', path: ['hosts'] },
209
+ hosts: [
210
+ 'quest.chapter',
211
+ 'quest.kill-steps',
212
+ 'quest.body-scripts',
213
+ 'quest.composition',
214
+ ],
215
+ },
206
216
  {
207
217
  name: 'grapple',
208
218
  row: 'OF41',
@@ -23,14 +23,9 @@ interface DerivedPrimitive {
23
23
  readonly version: number
24
24
  }
25
25
 
26
- /** Hosts HOSTS.md leaves out of the primitives: quest (Q-S5), opened as it is; Nalati's stealth entry (Q-S4). */
27
- const OUT_OF_SCOPE_HOSTS: readonly string[] = Object.freeze([
28
- 'quest.body-scripts',
29
- 'quest.composition',
30
- 'quest.chapter',
31
- 'quest.kill-steps',
32
- 'stealth.entry',
33
- ])
26
+ /** Hosts HOSTS.md leaves out of the primitives: Nalati's stealth entry (Q-S4). The quest hosts (Q-S5) joined the `quest`
27
+ * family when FORMAT-PRUNE FP16 gave them a home (`server/quest`, ONE-FORMAT OF17b3). */
28
+ const OUT_OF_SCOPE_HOSTS: readonly string[] = Object.freeze(['stealth.entry'])
34
29
 
35
30
  const HOST_FAMILY: ReadonlyMap<string, string> = new Map(
36
31
  PRIMITIVES.flatMap((row): (readonly [string, string])[] =>
@@ -0,0 +1,120 @@
1
+ /** FORMAT-PRUNE FP16 (meta; carries ONE-FORMAT OF17b3): `server/quest`, the home of the quest family's server hosts
2
+ * (`quest.chapter`, `quest.kill-steps`, `quest.body-scripts`, `quest.composition`). Its rows are the native plan's own
3
+ * quest rows, in install order (`nativeAssembly.ts` admits the same rows); the engine stands them where a plan names no
4
+ * quest host, so `server/native-assembly.json` no longer lists them. The rows name files and flags only; the
5
+ * server-class files they read stay server class. */
6
+ import {
7
+ array,
8
+ boolean,
9
+ exactOptional,
10
+ literal,
11
+ maxLength,
12
+ minLength,
13
+ pipe,
14
+ strictObject,
15
+ string,
16
+ union,
17
+ unknown,
18
+ variant,
19
+ } from 'valibot'
20
+
21
+ import type {
22
+ NativeAssemblyFeature,
23
+ NativeAssemblyRead,
24
+ } from './nativeAssembly.ts'
25
+ import type { GenericSchema } from 'valibot'
26
+
27
+ /** The section's only version. */
28
+ const VERSION = 1
29
+ /** One row per quest host, at most. */
30
+ const MAX_HOSTS = 4
31
+ /** The longest name a row holds, as the native plan bounds it. */
32
+ const MAX_KEY = 240
33
+ /** The deepest `path` a read walks, as the native plan bounds it. */
34
+ const MAX_PATH = 16
35
+ /** A name is never empty. */
36
+ const MIN_KEY = 1
37
+ /** A section holds at least one quest host. */
38
+ const MIN_HOSTS = 1
39
+
40
+ /** One quest host's row, as a plan or the section holds it. */
41
+ type NativeQuestHostRow = Extract<
42
+ NativeAssemblyFeature,
43
+ {
44
+ host:
45
+ | 'quest.composition'
46
+ | 'quest.chapter'
47
+ | 'quest.kill-steps'
48
+ | 'quest.body-scripts'
49
+ }
50
+ >
51
+
52
+ /** The section's value: the quest hosts in the order they install. */
53
+ interface QuestServer {
54
+ readonly version: typeof VERSION
55
+ readonly hosts: readonly NativeQuestHostRow[]
56
+ }
57
+
58
+ const key = pipe(string(), minLength(MIN_KEY), maxLength(MAX_KEY))
59
+ const path = pipe(array(key), maxLength(MAX_PATH))
60
+ const read: GenericSchema<unknown, NativeAssemblyRead> = union([
61
+ strictObject({ file: key, path: exactOptional(path) }),
62
+ strictObject({ section: key, path: exactOptional(path) }),
63
+ strictObject({ value: unknown() }),
64
+ ])
65
+ const flag = exactOptional(boolean())
66
+
67
+ /** The four quest host rows. */
68
+ const QUEST_HOST_ROWS = [
69
+ strictObject({
70
+ host: literal('quest.composition'),
71
+ rows: read,
72
+ spots: read,
73
+ counters: read,
74
+ document: exactOptional(read),
75
+ table: exactOptional(read),
76
+ contracts: exactOptional(read),
77
+ props: exactOptional(read),
78
+ readSpots: flag,
79
+ nativeFeats: flag,
80
+ barter: flag,
81
+ director: flag,
82
+ restoring: flag,
83
+ }),
84
+ // ONE-FORMAT OF22c3: a chapter's wake names a declared boss fight; `population` named the retired mixed population
85
+ // and stays optional only for writers that still send it
86
+ strictObject({
87
+ host: literal('quest.chapter'),
88
+ id: key,
89
+ rows: read,
90
+ wake: read,
91
+ reward: unknown(),
92
+ population: exactOptional(key),
93
+ }),
94
+ strictObject({
95
+ host: literal('quest.kill-steps'),
96
+ rows: read,
97
+ counters: read,
98
+ }),
99
+ strictObject({ host: literal('quest.body-scripts') }),
100
+ ] as const
101
+
102
+ const NativeQuestHostSchema: GenericSchema<unknown, NativeQuestHostRow> =
103
+ variant('host', QUEST_HOST_ROWS)
104
+
105
+ // A host named twice is refused where the engine stands the family (a `check` would not project to JSON Schema, FP9).
106
+ const QuestServerSchema: GenericSchema<unknown, QuestServer> = strictObject({
107
+ version: literal(VERSION),
108
+ hosts: pipe(
109
+ array(NativeQuestHostSchema),
110
+ minLength(MIN_HOSTS),
111
+ maxLength(MAX_HOSTS),
112
+ ),
113
+ })
114
+
115
+ export {
116
+ type NativeQuestHostRow,
117
+ type QuestServer,
118
+ NativeQuestHostSchema,
119
+ QuestServerSchema,
120
+ }
@@ -11,6 +11,9 @@ import type { KeyedSkyStyle } from './keyedSky.ts';
11
11
  import type { SpawnScriptRows } from './spawnScripts.ts';
12
12
  import type { ClientPlan } from './clientPlan.ts';
13
13
  import type { ServerPlan } from './server-plan.ts';
14
+ import type { QuestServer } from './quest-server.ts';
15
+ import type { ServerHosts } from './server-hosts.ts';
16
+ import type { ServerWorld } from './server-world.ts';
14
17
  import type { NativeSweptPolicyRows } from './items.ts';
15
18
  import type { ReturnModuleRow, ViewModuleRow } from './scriptContract.ts';
16
19
  import type { WorldScenesSection } from './worldScenes.ts';
@@ -65,6 +68,14 @@ export interface PlatformSections {
65
68
  'client/plan': ClientPlan;
66
69
  /** SHARD-COMPAT HS6b: the feature rows the server reads, written beside `client/plan` so the page's plan is the page's. */
67
70
  'server/plan': ServerPlan;
71
+ /** FORMAT-PRUNE FP16: the quest family's server hosts, read by a native world whose plan names none. */
72
+ 'server/quest': QuestServer;
73
+ /** FORMAT-PRUNE FP16d: the riding, boss and patrol families' server hosts, read by a native world whose plan names none. */
74
+ 'server/riding': ServerHosts;
75
+ 'server/boss': ServerHosts;
76
+ 'server/patrol': ServerHosts;
77
+ /** FORMAT-PRUNE FP21: a native world's own settings, beside its family sections; it ships no plan file. */
78
+ 'server/world': ServerWorld;
68
79
  'held/arms': HeldArmsRows;
69
80
  'held/gear': HeldGearRows;
70
81
  'held/finishes': HeldFinishesRows;
@@ -0,0 +1,50 @@
1
+ /** FORMAT-PRUNE FP16d (meta): a primitive family's server hosts, each family in its own section (`server/riding`,
2
+ * `server/boss`, `server/patrol`), so `server/native-assembly.json` lists none. Each row is the native plan's own row for
3
+ * that host, in install order. Here a row is held to the shape that projects to JSON Schema (FP9): it names its `host`;
4
+ * the engine admits each row with the plan's own row schema where it stands the family, as `server/plan` does (HS6b).
5
+ * The quest family's section (`server/quest`) is typed in full (`quest-server.ts`). */
6
+ import {
7
+ array,
8
+ literal,
9
+ looseObject,
10
+ maxLength,
11
+ minLength,
12
+ pipe,
13
+ strictObject,
14
+ string,
15
+ } from 'valibot'
16
+
17
+ import type { GenericSchema } from 'valibot'
18
+
19
+ /** The section's only version. */
20
+ const VERSION = 1
21
+ /** A family stands at least one host. */
22
+ const MIN_HOSTS = 1
23
+ /** The most hosts one family stands. */
24
+ const MAX_HOSTS = 16
25
+
26
+ /** One host's row as the section holds it: its host and its settings. */
27
+ interface ServerHostRow {
28
+ readonly host: string
29
+ readonly [key: string]: unknown
30
+ }
31
+
32
+ /** The section's value: the family's hosts in the order they install. */
33
+ interface ServerHosts {
34
+ readonly version: typeof VERSION
35
+ readonly hosts: readonly ServerHostRow[]
36
+ }
37
+
38
+ const RowSchema = looseObject({ host: string() })
39
+ const RowsSchema = pipe(
40
+ array(RowSchema),
41
+ minLength(MIN_HOSTS),
42
+ maxLength(MAX_HOSTS),
43
+ )
44
+
45
+ const ServerHostsSchema: GenericSchema<unknown, ServerHosts> = strictObject({
46
+ version: literal(VERSION),
47
+ hosts: RowsSchema,
48
+ })
49
+
50
+ export { type ServerHostRow, type ServerHosts, ServerHostsSchema }
@@ -0,0 +1,56 @@
1
+ /** FORMAT-PRUNE FP21 (meta): `server/world`, the native world's own settings that are not a host: its level, terrain,
2
+ * navigation, population bake, collision, entry walks, riding boot rows and field. With the family sections
3
+ * (`server-hosts.ts`, `quest-server.ts`) it replaces `server/native-assembly.json`: a world that holds it ships no plan
4
+ * file. Here the value is held to the shape that projects to JSON Schema (FP9); the engine admits it with the plan's own
5
+ * field schemas where it builds the world. The server-class files these settings name stay server class (FP21 default,
6
+ * coordinator 2026-11-24). */
7
+ import {
8
+ exactOptional,
9
+ literal,
10
+ looseObject,
11
+ string,
12
+ strictObject,
13
+ union,
14
+ } from 'valibot'
15
+
16
+ import type { GenericSchema } from 'valibot'
17
+
18
+ /** The section's only version. */
19
+ const VERSION = 1
20
+
21
+ /** One group of settings: an object the engine admits field by field. */
22
+ type Settings = Readonly<Record<string, unknown>>
23
+
24
+ /** The section's value. */
25
+ interface ServerWorld {
26
+ readonly version: typeof VERSION
27
+ readonly level: Settings
28
+ readonly terrain: Settings & { readonly kind: string }
29
+ readonly navigation: 'shard' | (Settings & { readonly file: string })
30
+ readonly bake?: Settings
31
+ readonly collision?: Settings
32
+ readonly entries: Settings
33
+ readonly boot?: Settings
34
+ readonly field?: Settings
35
+ }
36
+
37
+ const SettingsSchema = looseObject({})
38
+ const TerrainSchema = looseObject({ kind: string() })
39
+ const NavigationSchema = union([
40
+ literal('shard'),
41
+ looseObject({ file: string() }),
42
+ ])
43
+
44
+ const ServerWorldSchema: GenericSchema<unknown, ServerWorld> = strictObject({
45
+ version: literal(VERSION),
46
+ level: SettingsSchema,
47
+ terrain: TerrainSchema,
48
+ navigation: NavigationSchema,
49
+ bake: exactOptional(SettingsSchema),
50
+ collision: exactOptional(SettingsSchema),
51
+ entries: SettingsSchema,
52
+ boot: exactOptional(SettingsSchema),
53
+ field: exactOptional(SettingsSchema),
54
+ })
55
+
56
+ export { type ServerWorld, ServerWorldSchema }
@@ -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,
@@ -44,6 +44,26 @@
44
44
  "hosts": ["server serverPlan"],
45
45
  "note": "SHARD-COMPAT HS6b: the server's copy of the feature rows; engine's seam (`src/server/game/shardfile/serverPlan.ts`) reads it, falling back to `client/plan` for a file without one until the roll."
46
46
  },
47
+ "server/world": {
48
+ "hosts": ["server prepareNativeAssembly"],
49
+ "note": "FORMAT-PRUNE FP21: a native world's level, terrain, navigation, bake, collision, entry walks, boot and field; with the family sections it replaces server/native-assembly.json."
50
+ },
51
+ "server/riding": {
52
+ "hosts": ["server prepareNativeAssembly"],
53
+ "note": "FORMAT-PRUNE FP16d: the riding family's server hosts, the native plan's own rows; engine's native world stands them where its plan names none."
54
+ },
55
+ "server/boss": {
56
+ "hosts": ["server prepareNativeAssembly"],
57
+ "note": "FORMAT-PRUNE FP16d: the boss family's server hosts, the native plan's own rows; engine's native world stands them where its plan names none."
58
+ },
59
+ "server/patrol": {
60
+ "hosts": ["server prepareNativeAssembly"],
61
+ "note": "FORMAT-PRUNE FP16d: the patrol family's server hosts, the native plan's own rows; engine's native world stands them where its plan names none."
62
+ },
63
+ "server/quest": {
64
+ "hosts": ["server prepareNativeAssembly"],
65
+ "note": "FORMAT-PRUNE FP16: the quest family's server hosts (`quest.chapter`, `quest.kill-steps`, `quest.body-scripts`, `quest.composition`); engine's native world stands them where its plan names no quest host."
66
+ },
47
67
  "collections/displays": {
48
68
  "hosts": ["page CollectionCatalogue"]
49
69
  },
@@ -349,10 +369,6 @@
349
369
  "page": ["enterClientPlayer", "installClientPlayerEnter"],
350
370
  "reads": []
351
371
  },
352
- "population.homes": {
353
- "page": ["installClientPopulation"],
354
- "reads": ["sim/runtime-plan", "sim/scripts"]
355
- },
356
372
  "population.hull-book": {
357
373
  "page": ["prepareDeclaredHullBookKit"],
358
374
  "reads": ["actors/species-programs", "explore/catalogue"]