@wildshard/shard-format 0.79.3 → 0.80.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.
@@ -89,7 +89,8 @@ const NativeHuntSchema: v.GenericSchema<NativeHuntRowsInput, NativeHuntRows> = v
89
89
  limit: v.pipe(positive, v.integer(), v.maxValue(1024)), player: v.picklist(['host', 'origin']),
90
90
  fight: v.pipe(nativeFightFields, v.check<NativeHuntRows['fight'], 'matching legacy and exact incoming-cap policy'>(incomingCapPolicyAgrees, 'matching legacy and exact incoming-cap policy')),
91
91
  tuning: v.exactOptional(v.record(id, optionalTuning)),
92
- bands: v.strictObject({ states: names, scripted: v.exactOptional(v.boolean()), legacyKinds: names }),
92
+ // FORMAT-PRUNE FP20: `legacyKinds` is read by nothing; optional until no kept file carries it, then deleted
93
+ bands: v.strictObject({ states: names, scripted: v.exactOptional(v.boolean()), legacyKinds: v.exactOptional(names) }),
93
94
  hit: v.strictObject({ namespace: id, tags: v.pipe(v.array(tag), v.maxLength(32)) }), memoryFields: v.exactOptional(names),
94
95
  });
95
96
 
@@ -109,7 +110,7 @@ interface SpeciesData { capExempt?: boolean; harvest?: HarvestDrop[]; id: string
109
110
  type SpeciesProgramDataInput = unknown;
110
111
  interface SpeciesProgramData { species: ({ brain?: v.InferOutput<typeof SpeciesBrainSchema>; body?: v.InferOutput<typeof CreatureBodyRecipeSchema>; } & SpeciesData)[]; strikes: (v.InferOutput<typeof CreatureStrikeSchema>)[]; modules?: Record<string, string>; }
111
112
  type NativeHuntRowsInput = NativeHuntRows;
112
- interface NativeHuntRows { limit: number; player: 'host' | 'origin'; fight: { telegraphed?: boolean; attackers?: number; maxHitDamage?: number; capExempt?: (string)[]; capExemptTags?: (string)[]; input?: { bufferMs: number; coyoteMs: number; }; }; tuning?: Record<string, { hp?: number; sightRange?: number; sightRangeGraze?: number; sightCone?: number; hearStill?: number; hearCrouch?: number; hearWalk?: number; hearSprint?: number; noticeRate?: number; forgetRate?: number; alertAt?: number; boltAt?: number; freezeMin?: number; freezeMax?: number; relaxAfter?: number; panicDist?: number; runSpeed?: number; trotSpeed?: number; fleeMinTime?: number; fleeUntil?: number; fleeUntilMax?: number; fleeMaxTime?: number; lookBack?: number; waryTime?: number; waryBoost?: number; herdAlertRadius?: number; herdBoltDelayMin?: number; herdBoltDelayMax?: number; impactSpook?: number; impactAlert?: number; stalk?: { detect: number; speed: number; giveUp: number; rechargeCd: number; huffMin: number; huffMax: number; roar: string; fleeBelowHp: number; fleeChance: number; }; }>; bands: { states: (string)[]; scripted?: boolean; legacyKinds: (string)[]; }; hit: { namespace: string; tags: (`${string}.${string}`)[]; }; memoryFields?: (string)[]; }
113
+ interface NativeHuntRows { limit: number; player: 'host' | 'origin'; fight: { telegraphed?: boolean; attackers?: number; maxHitDamage?: number; capExempt?: (string)[]; capExemptTags?: (string)[]; input?: { bufferMs: number; coyoteMs: number; }; }; tuning?: Record<string, { hp?: number; sightRange?: number; sightRangeGraze?: number; sightCone?: number; hearStill?: number; hearCrouch?: number; hearWalk?: number; hearSprint?: number; noticeRate?: number; forgetRate?: number; alertAt?: number; boltAt?: number; freezeMin?: number; freezeMax?: number; relaxAfter?: number; panicDist?: number; runSpeed?: number; trotSpeed?: number; fleeMinTime?: number; fleeUntil?: number; fleeUntilMax?: number; fleeMaxTime?: number; lookBack?: number; waryTime?: number; waryBoost?: number; herdAlertRadius?: number; herdBoltDelayMin?: number; herdBoltDelayMax?: number; impactSpook?: number; impactAlert?: number; stalk?: { detect: number; speed: number; giveUp: number; rechargeCd: number; huffMin: number; huffMax: number; roar: string; fleeBelowHp: number; fleeChance: number; }; }>; bands: { states: (string)[]; scripted?: boolean; legacyKinds?: (string)[]; }; hit: { namespace: string; tags: (`${string}.${string}`)[]; }; memoryFields?: (string)[]; }
113
114
  type SpeciesProgramsInput = unknown;
114
115
  interface SpeciesPrograms { page: (SpeciesData)[]; native: (SpeciesData)[]; program?: SpeciesProgramData; spawns?: v.InferOutput<typeof SpawnTablesSchema>; hunt?: NativeHuntRows; }
115
116
 
@@ -1,6 +1,5 @@
1
1
  import type { LateFile } from './admissionLate.ts';
2
2
  import { parseWorldScenes, worldScenesForTier } from './worldScenes.ts';
3
- import { parseRiggedHullBook } from './riggedHulls.ts';
4
3
  import { PosedLibrarySchema } from './namedJsonContracts.ts';
5
4
  import { parseClientPlan } from './clientPlan.ts';
6
5
  import { skinTierOff } from './skin-tier.ts';
@@ -170,17 +169,6 @@ export function* tierLibrarySteps(source: TierSelectionSource, tier: 'phone' | '
170
169
  });
171
170
  sections.set('client/plan', { ...plan, features });
172
171
  }
173
- const hulls = sections.get('look/rigged-hulls');
174
- if (hulls !== undefined) {
175
- // The rigged-hull loader reads only its page tier's resources (looks/riggedHulls.ts).
176
- const book = parseRiggedHullBook(hulls);
177
- const off = (input: unknown): void => {
178
- if (typeof input === 'string') { const hash = names.get(input); if (hash !== undefined) inactive.add(hash); }
179
- else if (typeof input === 'object' && input !== null) for (const value of Object.values(input)) off(value);
180
- };
181
- off(book.tiers[tier === 'phone' ? 'desktop' : 'phone']);
182
- sections.set('look/rigged-hulls', { ...book, tiers: { [tier]: book.tiers[tier] } });
183
- }
184
172
  // Posed libraries (looks/posedInstances.ts) read only their page tier's geometry and atlas.
185
173
  // Only a small named JSON can be one; the strict schema, not a name, identifies it.
186
174
  if (assets !== undefined) for (const file of source.files) {
@@ -7,12 +7,8 @@ const ONE = 1
7
7
 
8
8
  const SHARDFILE_VERSION = '0.1.0.6'
9
9
  /** Formats whose `shard.json` names its version in `version`, beside the frozen layout marker `formatVersion: 2`.
10
- * Legacy 0.1 is the byte-preserving spelling of 0.1.0.0. */
11
- const LEGACY_INDEX_VERSIONS: readonly ['0.1', '0.1.0.0', '0.1.0.1'] = [
12
- '0.1',
13
- '0.1.0.0',
14
- '0.1.0.1',
15
- ] as const
10
+ * FORMAT-PRUNE FP24 (J508) deleted the two-part `0.1` and `0.1.0.0`: no kept original declares either. */
11
+ const LEGACY_INDEX_VERSIONS: readonly ['0.1.0.1'] = ['0.1.0.1'] as const
16
12
  /** Formats whose `shard.json` names its version in `formatVersion` (SHARD-COMPAT CP14, FORMAT-PRUNE FP25): the
17
13
  * layout marker and `version` are gone, so a reader tells the two envelopes apart by the field's type. */
18
14
  const INDEX_FORMAT_VERSIONS: readonly [
@@ -50,7 +46,9 @@ type FormatVersionParts = readonly [number, number, number, number]
50
46
  /** @deprecated SHARD-COMPAT SP10: use `FormatVersionParts`. */
51
47
  type ShardfileVersionParts = FormatVersionParts
52
48
 
53
- /** Read canonical bounded decimal components; the legacy two-part spelling has zero counters. */
49
+ /** Read canonical bounded decimal components. No shard file declares the two-part spelling any more (FORMAT-PRUNE
50
+ * FP24); it parses with zero counters only because the API's ledger keys a zero-counter format that way
51
+ * (`originalFormat`), until its stored rows move (SHARD-COMPAT CP16). */
54
52
  function parseShardfileVersion(input: unknown): FormatVersionParts {
55
53
  if (
56
54
  typeof input !== 'string' ||
@@ -79,29 +77,20 @@ function compareShardfileVersions(left: unknown, right: unknown): number {
79
77
  return ZERO
80
78
  }
81
79
 
82
- /** The oldest format a reader admits (J486). Below it a shard file needs the migration chain or a re-upload. */
83
- const SHARDFILE_FLOOR = '0.1.0.0'
80
+ /** The oldest format a reader admits (J486). Below it a shard file needs a re-upload. */
81
+ const SHARDFILE_FLOOR = '0.1.0.1'
84
82
 
85
- /** A reader admits every format at or below its own in the same breaking format, down to the floor (J486,
86
- * replacing WR11's N and N-1 window). Additive counters only add optional fields, so an older file is still a
87
- * valid file; a newer one can carry declarations the reader does not know, so it waits for a newer reader. */
88
- function compatibleShardfileVersion(
83
+ /** Whether a reader at `reader` reads `input`: a known format from the floor up to the reader's own (J486). FORMAT-PRUNE
84
+ * FP24 deleted WR11's N-1 test (`compatibleShardfileVersion`): every known format shares one breaking format, so the
85
+ * window is the known list cut at the reader. */
86
+ function readsFormat(
89
87
  input: unknown,
90
- reader: unknown = SHARDFILE_VERSION,
88
+ reader: string = SHARDFILE_VERSION,
91
89
  ): boolean {
92
- try {
93
- const [major, minor, breaking] = parseShardfileVersion(input)
94
- const [readMajor, readMinor, readBreaking] = parseShardfileVersion(reader)
95
- return (
96
- major === readMajor &&
97
- minor === readMinor &&
98
- breaking === readBreaking &&
99
- compareShardfileVersions(input, reader) <= ZERO &&
100
- compareShardfileVersions(input, SHARDFILE_FLOOR) >= ZERO
101
- )
102
- } catch {
103
- return false
104
- }
90
+ return (
91
+ SHARDFILE_VERSIONS.some((version: string): boolean => version === input) &&
92
+ compareShardfileVersions(input, reader) <= ZERO
93
+ )
105
94
  }
106
95
 
107
96
  /** The format version a `shard.json` declares: `formatVersion` when it is a version string (0.1.0.2 on), else the
@@ -281,5 +270,5 @@ export {
281
270
  type ShardfileVersionParts,
282
271
  parseShardfileVersion,
283
272
  compareShardfileVersions,
284
- compatibleShardfileVersion,
273
+ readsFormat,
285
274
  }
@@ -1,20 +1,11 @@
1
- // FORMAT-PRUNE FP22d: where a row names a held weapon (a loadout slot, a finish's weapon), it names an engine-native closed
2
- // name (until `items.legacySlot` goes, FP22e) or the declared item the weapon plays under, `declared.<equipment id>`.
3
- import { custom, picklist, union } from 'valibot'
1
+ // FORMAT-PRUNE FP22d/FP22e: where a row names a held weapon (a loadout slot, a finish's weapon), it names the declared
2
+ // item the weapon plays under, `declared.<equipment id>`. The engine-native closed names went with the closed item slot field.
3
+ import { custom } from 'valibot'
4
4
 
5
5
  import type { GenericSchema } from 'valibot'
6
6
 
7
7
  type DeclaredWeaponId = `declared.weapon.${string}`
8
- type WeaponSlot =
9
- | 'crossbow'
10
- | 'sword'
11
- | 'rifle'
12
- | 'sword-iron'
13
- | 'bow'
14
- | 'sabre'
15
- | 'spear'
16
- | 'empty'
17
- | DeclaredWeaponId
8
+ type WeaponSlot = DeclaredWeaponId
18
9
 
19
10
  const DECLARED_LIMIT = 256
20
11
  const DECLARED_PATTERN: string = String.raw`^declared\.weapon\.[a-z][a-zA-Z0-9.-]*$`
@@ -31,19 +22,7 @@ function isDeclaredWeapon(input: unknown): input is DeclaredWeaponId {
31
22
 
32
23
  const DeclaredWeaponSchema: GenericSchema<DeclaredWeaponId> =
33
24
  custom<DeclaredWeaponId>(isDeclaredWeapon, 'a declared weapon id')
34
- const WeaponSlotSchema: GenericSchema<WeaponSlot> = union([
35
- picklist([
36
- 'crossbow',
37
- 'sword',
38
- 'rifle',
39
- 'sword-iron',
40
- 'bow',
41
- 'sabre',
42
- 'spear',
43
- 'empty',
44
- ]),
45
- DeclaredWeaponSchema,
46
- ])
25
+ const WeaponSlotSchema: GenericSchema<WeaponSlot> = DeclaredWeaponSchema
47
26
 
48
27
  export {
49
28
  DECLARED_LIMIT,
@@ -26,10 +26,6 @@
26
26
  "actors/species": {
27
27
  "hosts": ["server speciesResolver", "page clientSpeciesLooks"]
28
28
  },
29
- "actors/species-programs": {
30
- "hosts": [],
31
- "note": "Metadata lent to existing page/native species and hunt owners."
32
- },
33
29
  "actors/strikes": {
34
30
  "hosts": [],
35
31
  "note": "Consumed by the runtime's explicitly imported creature host."
@@ -107,9 +103,6 @@
107
103
  "look/colour-functions": {
108
104
  "hosts": ["page materialColourGraph"]
109
105
  },
110
- "look/hull-book": {
111
- "hosts": ["page productHullBook"]
112
- },
113
106
  "look/keyed-sky": {
114
107
  "hosts": ["page keyedSkyBackdrop"]
115
108
  },
@@ -125,9 +118,6 @@
125
118
  "look/painted": {
126
119
  "hosts": ["page productPaintedLook"]
127
120
  },
128
- "look/rigged-hulls": {
129
- "hosts": ["page productRiggedHulls"]
130
- },
131
121
  "look/toon": {
132
122
  "hosts": ["page toonLook"]
133
123
  },
@@ -369,14 +359,6 @@
369
359
  "page": ["enterClientPlayer", "installClientPlayerEnter"],
370
360
  "reads": []
371
361
  },
372
- "population.hull-book": {
373
- "page": ["prepareDeclaredHullBookKit"],
374
- "reads": ["actors/species-programs", "explore/catalogue"]
375
- },
376
- "population.product-creatures": {
377
- "page": [],
378
- "reads": []
379
- },
380
362
  "population.wildlife": {
381
363
  "page": ["clientWildlife", "installClientWildlife"],
382
364
  "reads": []
@@ -425,10 +407,6 @@
425
407
  "page": ["installClientRiding"],
426
408
  "reads": []
427
409
  },
428
- "species.program": {
429
- "page": ["installClientSpeciesProgram", "prepareClientSpeciesCatalogue"],
430
- "reads": ["actors/species-programs", "sim/scripts", "sim/runtime-plan"]
431
- },
432
410
  "state.adventure": {
433
411
  "page": ["installClientAdventurePersistence"],
434
412
  "reads": []
@@ -1,79 +0,0 @@
1
- /** FORMAT-PRUNE FP15: the species-program family's page features. OF30's cut B leaves the `species.program` client row
2
- * and the `population.product-creatures` and `population.hull-book` plan features reading only what the family's
3
- * sections held; each creature is a declared row now (ONE-FORMAT OF5b2b). The sections themselves are FE7 rows in
4
- * `deprecations.ts`. No data migration exists: a shard drops the feature when it re-uploads (Track F), and FP20 deletes
5
- * it at zero users. `legacyKinds` sits inside `actors/species-programs`, so that section's row counts it. */
6
-
7
- /** The registry's row shape (`deprecations.ts`). */
8
- interface SpeciesFeatureDeprecation {
9
- readonly id: string
10
- readonly path: string
11
- readonly since: string
12
- readonly replacement: string
13
- readonly migration: undefined
14
- readonly uses: (
15
- shard: Readonly<{ sections: ReadonlyMap<string, unknown> }>,
16
- ) => boolean
17
- }
18
-
19
- /** The sections a page feature row can sit in. */
20
- const FEATURE_SECTIONS: readonly string[] = ['client/plan', 'sim/runtime-plan']
21
- const NONE = 0
22
-
23
- /** Whether any object under `value` is a row of `kind`. */
24
- function hasKind(value: unknown, kind: string): boolean {
25
- const pending: unknown[] = [value]
26
- while (pending.length > NONE) {
27
- const next = pending.pop()
28
- if (typeof next === 'object' && next !== null) {
29
- if (!Array.isArray(next) && Reflect.get(next, 'kind') === kind) {
30
- return true
31
- }
32
- const children: readonly unknown[] = Object.values(next)
33
- pending.push(...children)
34
- }
35
- }
36
- return false
37
- }
38
-
39
- function featureRow(kind: string): SpeciesFeatureDeprecation {
40
- return {
41
- id: `feature.${kind}`,
42
- path: `client/plan or sim/runtime-plan rows of kind ${kind} (the species-program family, FORMAT-PRUNE FP15)`,
43
- since: '0.1.0.4',
44
- replacement:
45
- 'declared creature rows (actors/creatures and their looks); the engine draws each from its row',
46
- migration: undefined,
47
- uses: (
48
- shard: Readonly<{ sections: ReadonlyMap<string, unknown> }>,
49
- ): boolean =>
50
- FEATURE_SECTIONS.some((name: string): boolean =>
51
- hasKind(shard.sections.get(name), kind),
52
- ),
53
- }
54
- }
55
-
56
- /** OF30 cut B leaves these sections as plain JSON nothing reads. Deprecated at 0.1.0.1 (format `cda6f63`). */
57
- const SPECIES_SECTION_DEPRECATIONS: readonly SpeciesFeatureDeprecation[] = [
58
- 'actors/species-programs',
59
- 'look/hull-book',
60
- 'look/rigged-hulls',
61
- ].map((name: string): SpeciesFeatureDeprecation => ({
62
- id: `section.${name}`,
63
- path: `sections/${name} (the species-program family, FORMAT-PRUNE FP15)`,
64
- since: '0.1.0.1',
65
- replacement:
66
- 'species rows and authored looks (actors/species); nothing reads it once OF30 lands',
67
- migration: undefined,
68
- uses: (
69
- shard: Readonly<{ sections: ReadonlyMap<string, unknown> }>,
70
- ): boolean => shard.sections.has(name),
71
- }))
72
-
73
- const SPECIES_FEATURE_DEPRECATIONS: readonly SpeciesFeatureDeprecation[] = [
74
- featureRow('species.program'),
75
- featureRow('population.product-creatures'),
76
- featureRow('population.hull-book'),
77
- ]
78
-
79
- export { SPECIES_FEATURE_DEPRECATIONS, SPECIES_SECTION_DEPRECATIONS }