@wildshard/shard-format 0.66.1 → 0.68.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.
Files changed (43) hide show
  1. package/package.json +7 -19
  2. package/src/cli/corpus-deprecations.ts +41 -0
  3. package/src/cli/corpus.ts +300 -0
  4. package/src/cli/main.ts +32 -0
  5. package/src/format/cook-preparation.ts +22 -6
  6. package/src/format/deprecations.ts +132 -0
  7. package/src/format/empty-shardfile.json +56 -0
  8. package/src/format/empty-shardfile.ts +43 -0
  9. package/src/format/format-migrate-inventory.ts +142 -0
  10. package/src/format/format-migrate-rebuild.ts +269 -0
  11. package/src/format/format-migrate.ts +290 -0
  12. package/src/format/format-migration-journal.ts +129 -0
  13. package/src/format/format-migration-ops.ts +230 -0
  14. package/src/format/format-migration-prune.ts +106 -0
  15. package/src/format/format-migrations.ts +124 -0
  16. package/src/format/issue-codes.ts +3 -1
  17. package/src/format/items.ts +21 -3
  18. package/src/format/journal-glyphs.json +12 -0
  19. package/src/format/lootEconomy.ts +9 -1
  20. package/src/format/memory-armed.json +1 -39
  21. package/src/format/memory-armed.ts +41 -8
  22. package/src/format/memory-epoch.ts +2 -2
  23. package/src/format/memory-line.ts +4 -3
  24. package/src/format/memoryAdmission.ts +1 -1
  25. package/src/format/policy-verdict.ts +95 -0
  26. package/src/format/runtime-tier.ts +3 -3
  27. package/src/format/shardSections.ts +11 -1
  28. package/src/format/shardfile-assets.ts +12 -8
  29. package/src/format/shardfile-stream-admit.ts +41 -16
  30. package/src/format/shardfile-stream-rows.ts +3 -1
  31. package/src/format/shardfile-stream.ts +12 -9
  32. package/src/format/shardfileValidation.ts +30 -18
  33. package/src/format/stateLineage.ts +1 -1
  34. package/src/format/version.ts +11 -13
  35. package/src/format/baked-terrain.golden.json +0 -2760
  36. package/src/format/colliders.golden.json +0 -1619
  37. package/src/format/forest-placement.golden.json +0 -4588
  38. package/src/format/geometry-layout.golden.json +0 -180
  39. package/src/format/interact-table.golden.json +0 -340
  40. package/src/format/item-catalogue.golden.json +0 -2310
  41. package/src/format/memory-ratchet.ts +0 -107
  42. package/src/format/small-laws.golden.json +0 -57
  43. package/src/format/terrain-field.golden.json +0 -3998
@@ -0,0 +1,106 @@
1
+ // oxlint-disable typescript/prefer-readonly-parameter-types -- a step edits the shard it is handed, in place
2
+ /** FORMAT-PRUNE's same-version chain steps (J486): each writes the one way a 0.1.0.1 reader already admits, so writers
3
+ * can stop writing the other way with no format bump. Both are repairs: they also run on 0.1.0.1 files that still carry
4
+ * the old shape. Refusing the old shape in new uploads waits until the API and engine read migrated copies (CP2, FE9). */
5
+ import type { FormatMigration, MigratingShard } from './format-migrations.ts'
6
+
7
+ type JsonRecord = Record<string, unknown>
8
+
9
+ const OLD_POINTER = 'gridShardfile'
10
+ const POINTER = 'shardfile'
11
+ const CURRENT = '0.1.0.1'
12
+ const NONE = 0
13
+
14
+ function isRecord(value: unknown): value is JsonRecord {
15
+ return typeof value === 'object' && value !== null && !Array.isArray(value)
16
+ }
17
+
18
+ /** Each object under `value`, depth first. */
19
+ function objects(value: unknown, found: JsonRecord[]): JsonRecord[] {
20
+ if (Array.isArray(value)) {
21
+ for (const item of value) {
22
+ objects(item, found)
23
+ }
24
+ } else if (isRecord(value)) {
25
+ found.push(value)
26
+ for (const item of Object.values(value)) {
27
+ objects(item, found)
28
+ }
29
+ }
30
+ return found
31
+ }
32
+
33
+ /** Every object holding the old pointer, in each section and each JSON cook mount. */
34
+ function pointerObjects(
35
+ shard: Readonly<MigratingShard>,
36
+ ): readonly JsonRecord[] {
37
+ const found: JsonRecord[] = []
38
+ for (const value of [...shard.sections.values(), ...shard.mounts.values()]) {
39
+ objects(value, found)
40
+ }
41
+ return found.filter((row: Readonly<JsonRecord>): boolean =>
42
+ Object.hasOwn(row, OLD_POINTER),
43
+ )
44
+ }
45
+
46
+ /** Rename the old pointer key in place, keeping its position; naming two different files is refused, as the engine's
47
+ * lift refuses it (`legacyPointer.ts`). */
48
+ function renamePointer(row: JsonRecord): void {
49
+ const { [OLD_POINTER]: old, [POINTER]: now } = row
50
+ if (now !== undefined && old !== undefined && now !== old) {
51
+ throw new Error('A manifest names its shardfile once')
52
+ }
53
+ const entries = Object.entries(row)
54
+ for (const [key] of entries) {
55
+ Reflect.deleteProperty(row, key)
56
+ }
57
+ for (const [key, value] of entries) {
58
+ if (key !== OLD_POINTER) {
59
+ row[key] = value
60
+ } else if (now === undefined && old !== undefined) {
61
+ row[POINTER] = value
62
+ }
63
+ }
64
+ }
65
+
66
+ /** FORMAT-PRUNE FP8: `gridShardfile` becomes `shardfile`, in the level manifest and the discovery mount alike. */
67
+ const shardfilePointer: FormatMigration = {
68
+ id: 'fp8-shardfile-pointer',
69
+ to: CURRENT,
70
+ touches: 'data',
71
+ affects: [],
72
+ apply: (shard: MigratingShard): void => {
73
+ for (const row of pointerObjects(shard)) {
74
+ renamePointer(row)
75
+ }
76
+ },
77
+ repairs: (shard: Readonly<MigratingShard>): boolean =>
78
+ pointerObjects(shard).length > NONE,
79
+ }
80
+
81
+ function runtimeOf(shard: Readonly<MigratingShard>): JsonRecord | undefined {
82
+ const { runtime } = shard.index
83
+ return isRecord(runtime) ? runtime : undefined
84
+ }
85
+
86
+ function carriesTrust(shard: Readonly<MigratingShard>): boolean {
87
+ const runtime = runtimeOf(shard)
88
+ return runtime !== undefined && Object.hasOwn(runtime, 'trust')
89
+ }
90
+
91
+ /** FORMAT-PRUNE FP3: `runtime.trust` has no reader in any repo; the copy drops it. */
92
+ const dropRuntimeTrust: FormatMigration = {
93
+ id: 'fp3-drop-runtime-trust',
94
+ to: CURRENT,
95
+ touches: 'data',
96
+ affects: [],
97
+ apply: (shard: MigratingShard): void => {
98
+ const runtime = runtimeOf(shard)
99
+ if (runtime !== undefined) {
100
+ Reflect.deleteProperty(runtime, 'trust')
101
+ }
102
+ },
103
+ repairs: carriesTrust,
104
+ }
105
+
106
+ export { dropRuntimeTrust, shardfilePointer }
@@ -0,0 +1,124 @@
1
+ // oxlint-disable typescript/prefer-readonly-parameter-types -- a step edits the shard it is handed, in place
2
+ /** The migration chain's registry (SHARD-COMPAT CP1, J486). A migration is one pure, data-only step that rewrites an
3
+ * older shard file's JSON to a newer format version. It is not a save migration (`migrations.ts`) and not a catalogue
4
+ * schema change (api-server). The change's author adds its migration here in the same release (J486, Q49). */
5
+ import { journalGlyphImages } from './format-migration-journal.ts'
6
+ import { dropRuntimeTrust, shardfilePointer } from './format-migration-prune.ts'
7
+ import {
8
+ SHARDFILE_VERSIONS,
9
+ compareShardfileVersions,
10
+ parseShardfileVersion,
11
+ } from './version.ts'
12
+
13
+ /** What a migration may read and rewrite: the parsed `shard.json`, each section by name and each JSON cook mount under
14
+ * `mounts/` by path. */
15
+ interface MigratingShard {
16
+ readonly index: Record<string, unknown>
17
+ readonly sections: Map<string, unknown>
18
+ readonly mounts: Map<string, unknown>
19
+ }
20
+
21
+ /** One step of the chain. `to` is the format version the step writes; it runs on every file below it. A repair step
22
+ * (`repairs`) also runs on a file already at `to` when `repairs` finds the old shape there: a break that shipped
23
+ * inside `to`, or a second way `to` still admits. */
24
+ interface FormatMigration {
25
+ readonly id: string
26
+ readonly to: string
27
+ /** `data` edits JSON the preparation does not fence; `files` reaches what it does (named JSON blobs, programs), so
28
+ * like `affects: render` the copy's author preparation is stale and the box's cook prepares again (SP1b). */
29
+ readonly touches: 'data' | 'files'
30
+ /** `render` leaves the author preparation stale for the box's cook (SP1b); `save` needs a save migration (J197). */
31
+ readonly affects: readonly ('render' | 'save')[]
32
+ /** The save migration a step that `affects: save` ships with (J197): what players' saved state does across it. */
33
+ readonly saveMigration?: string
34
+ readonly apply: (shard: MigratingShard) => void
35
+ readonly repairs?: (shard: Readonly<MigratingShard>) => boolean
36
+ }
37
+
38
+ const TWO_PART = 2
39
+ const ZERO = 0
40
+ const ONE = 1
41
+ const LEGACY_SPELLING = '0.1'
42
+ const FOUR_PART_ZERO = '0.1.0.0'
43
+
44
+ /** FORMAT-PRUNE FP6: the two-part spelling `0.1` becomes `0.1.0.0`, the same format written the one way. */
45
+ const fourPartVersion: FormatMigration = {
46
+ id: 'fp6-four-part-version',
47
+ to: FOUR_PART_ZERO,
48
+ touches: 'data',
49
+ affects: [],
50
+ apply: (shard: Readonly<MigratingShard>): void => {
51
+ const { requires } = shard.index
52
+ if (
53
+ typeof requires === 'object' &&
54
+ requires !== null &&
55
+ Reflect.get(requires, 'sdk') === LEGACY_SPELLING
56
+ ) {
57
+ Reflect.set(requires, 'sdk', FOUR_PART_ZERO)
58
+ }
59
+ },
60
+ }
61
+
62
+ /** Every migration, oldest first. */
63
+ const FORMAT_MIGRATIONS: readonly FormatMigration[] = [
64
+ fourPartVersion,
65
+ journalGlyphImages,
66
+ shardfilePointer,
67
+ dropRuntimeTrust,
68
+ ]
69
+
70
+ /** Whether a file at `version` still needs a step that writes `to`. The legacy two-part spelling sits just below its
71
+ * four-part twin, so the spelling step runs once and never again. */
72
+ function versionBelow(version: string, to: string): boolean {
73
+ const left = parseShardfileVersion(version)
74
+ const right = parseShardfileVersion(to)
75
+ for (let index = ZERO; index < left.length; index += ONE) {
76
+ const difference = (left[index] ?? ZERO) - (right[index] ?? ZERO)
77
+ if (difference !== ZERO) {
78
+ return difference < ZERO
79
+ }
80
+ }
81
+ return (
82
+ version.split('.').length === TWO_PART && to.split('.').length > TWO_PART
83
+ )
84
+ }
85
+
86
+ /** Refuse one step: a `to` that is no format version, out of version order after `last`, or a save-affecting step with
87
+ * no save migration. */
88
+ function checkStep(step: Readonly<FormatMigration>, last: string): void {
89
+ if (
90
+ !SHARDFILE_VERSIONS.some((version: string): boolean => version === step.to)
91
+ ) {
92
+ throw new Error(`Migration ${step.id} writes ${step.to}, no format version`)
93
+ }
94
+ if (compareShardfileVersions(step.to, last) < ZERO) {
95
+ throw new Error(`Migration ${step.id} is out of version order`)
96
+ }
97
+ if (step.affects.includes('save') && step.saveMigration === undefined) {
98
+ throw new Error(
99
+ `Migration ${step.id} affects saves without a save migration`,
100
+ )
101
+ }
102
+ }
103
+
104
+ /** Refuse a registry the chain cannot run as written (FE8): a repeated id, or a step `checkStep` refuses. */
105
+ function checkMigrations(migrations: readonly FormatMigration[]): void {
106
+ const ids = new Set<string>()
107
+ let last: string = LEGACY_SPELLING
108
+ for (const step of migrations) {
109
+ if (ids.has(step.id)) {
110
+ throw new Error(`Migration ${step.id} is registered twice`)
111
+ }
112
+ ids.add(step.id)
113
+ checkStep(step, last)
114
+ last = step.to
115
+ }
116
+ }
117
+
118
+ export {
119
+ FORMAT_MIGRATIONS,
120
+ checkMigrations,
121
+ type FormatMigration,
122
+ type MigratingShard,
123
+ versionBelow,
124
+ }
@@ -36,7 +36,9 @@ const VALIDATE_CODES = {
36
36
  'pack-invalid':
37
37
  "A pack is missing a member, or a member or the pack's hash differs.",
38
38
  'cook-invalid':
39
- 'The cook file, its preparation, or a mount (path or bytes) is invalid (C0, J137).',
39
+ 'The cook file or a mount (path or bytes) is invalid (C0, J137).',
40
+ 'preparation-invalid':
41
+ "The author's preparation is missing, stale or invalid: its inputHash, fence or programs mount (J487, SHARD-COMPAT PR3; docs/preparation.md).",
40
42
  'runtime-files':
41
43
  'Copied runtime files are present without a runtime import checker, or fail it.',
42
44
  'unlisted-file': 'A file in the product is not listed in `shard.json`.',
@@ -7,6 +7,18 @@ import type { LevelLoadout } from './level-start-rows.ts';
7
7
  import { MeleeContactsSchema, NativeMeleeRowSchema, WeaponProfileSchema, type MeleeContactRow } from './weaponProfiles.ts';
8
8
  import { isJsonData } from './json.ts';
9
9
 
10
+ interface KeptItemRowsInput { id: ItemFamilyNameRowsInput; kind: 'upgrade' | 'cosmetic' | 'charm' | 'trophy' | 'gear'; label: string; gauge?: { name: 'sharpen' | 'hearts' | 'charms'; level: number; }; }
11
+ interface KeptItemRows { id: ItemFamilyNameRows; kind: 'upgrade' | 'cosmetic' | 'charm' | 'trophy' | 'gear'; label: string; gauge?: { name: 'sharpen' | 'hearts' | 'charms'; level: number; }; }
12
+ /** OF31f1: kept ids are unique, and so is each gauge level (ids never hold a colon). */
13
+ function keptUnique(rows: readonly { readonly id: string; readonly gauge?: { readonly name: string; readonly level: number } }[]): boolean {
14
+ const seen = new Set<string>();
15
+ for (const row of rows) {
16
+ const keys = row.gauge === undefined ? [row.id] : [row.id, `gauge:${row.gauge.name}.${String(row.gauge.level)}`];
17
+ for (const key of keys) { if (seen.has(key)) { return false; } seen.add(key); }
18
+ }
19
+ return true;
20
+ }
21
+
10
22
  /** The bounded authored family/context name, also checked by the native family installer. */
11
23
  export const ItemFamilyNameSchema: v.GenericSchema<ItemFamilyNameRowsInput, ItemFamilyNameRows> = v.pipe(v.string(), v.regex(/^[a-z][a-zA-Z0-9.-]*$/u), v.maxLength(128));
12
24
  const name = ItemFamilyNameSchema;
@@ -72,8 +84,14 @@ const inventory = v.pipe(v.strictObject({ kinds: v.pipe(v.array(name), v.minLeng
72
84
  quantity: v.picklist(['unchecked', 'positive-safe-integer']), snapshot: v.picklist(['order', 'roster']),
73
85
  stackLimit: v.exactOptional(v.pipe(finite, v.minValue(0), v.maxValue(Number.MAX_SAFE_INTEGER))), restoreError: text }),
74
86
  v.check(row => new Set(row.kinds).size === row.kinds.length && row.counts.min <= row.counts.max, 'Unique inventory kinds and ordered count bounds'));
87
+ /** ONE-FORMAT OF31f1 (Q37): what a player keeps for good in this shard: upgrades, looks, charms, trophies and found gear.
88
+ * A save keeps exactly these ids; `gauge` feeds the Bag's sharpening, sturdy-heart and charm pips (the highest level owned). */
89
+ const GAUGE_MAX = 8, GAUGE_MIN = 1, KEPT_MAX = 256;
90
+ const gauge = v.strictObject({ name: v.picklist(['sharpen', 'hearts', 'charms']), level: v.pipe(finite, v.integer(), v.minValue(GAUGE_MIN), v.maxValue(GAUGE_MAX)) });
91
+ const keptItem: v.GenericSchema<KeptItemRowsInput, KeptItemRows> = v.strictObject({ id: name, kind: v.picklist(['upgrade', 'cosmetic', 'charm', 'trophy', 'gear']), label: text, gauge: v.exactOptional(gauge) });
92
+ const kept = v.pipe(v.array(keptItem), v.maxLength(KEPT_MAX), v.check<KeptItemRows[], 'unique kept ids and gauge levels'>(keptUnique, 'unique kept ids and gauge levels'));
75
93
  const catalogue = v.pipe(v.array(v.strictObject({ id: name, label: text, icon: CatalogueIconSchema, travels: v.boolean() })), v.maxLength(256));
76
- const raw: v.StrictObjectSchema<{ readonly version: v.GenericSchema<ShardItemsInput['version'], ShardItems['version']>; readonly catalogue: v.ExactOptionalSchema<v.GenericSchema<Exclude<ShardItemsInput['catalogue'], undefined>, Exclude<ShardItems['catalogue'], undefined>>, undefined>; readonly rows: v.SchemaWithPipe<readonly [v.ArraySchema<v.VariantSchema<'kind', readonly [typeof weapon, typeof tool], undefined>, undefined>, v.MaxLengthAction<(WeaponItemRows | ToolItemRows)[], 64, undefined>]>; readonly launches: v.ExactOptionalSchema<v.GenericSchema<Exclude<ShardItemsInput['launches'], undefined>, Exclude<ShardItems['launches'], undefined>>, undefined>; readonly pickups: v.ExactOptionalSchema<v.GenericSchema<Exclude<ShardItemsInput['pickups'], undefined>, Exclude<ShardItems['pickups'], undefined>>, undefined>; readonly contexts: v.GenericSchema<ShardItemsInput['contexts'], ShardItems['contexts']>; readonly runtimeContexts: v.ExactOptionalSchema<v.GenericSchema<Exclude<ShardItemsInput['runtimeContexts'], undefined>, Exclude<ShardItems['runtimeContexts'], undefined>>, undefined>; readonly loadout: v.GenericSchema<ShardItemsInput['loadout'], ShardItems['loadout']>; }, undefined> = v.strictObject({ version: v.literal(1), catalogue: v.exactOptional(catalogue), rows: v.pipe(v.array(v.variant('kind', [weapon, tool])), v.maxLength(64)),
94
+ const raw: v.StrictObjectSchema<{ readonly version: v.GenericSchema<ShardItemsInput['version'], ShardItems['version']>; readonly catalogue: v.ExactOptionalSchema<v.GenericSchema<Exclude<ShardItemsInput['catalogue'], undefined>, Exclude<ShardItems['catalogue'], undefined>>, undefined>; readonly kept: v.ExactOptionalSchema<v.GenericSchema<Exclude<ShardItemsInput['kept'], undefined>, Exclude<ShardItems['kept'], undefined>>, undefined>; readonly rows: v.SchemaWithPipe<readonly [v.ArraySchema<v.VariantSchema<'kind', readonly [typeof weapon, typeof tool], undefined>, undefined>, v.MaxLengthAction<(WeaponItemRows | ToolItemRows)[], 64, undefined>]>; readonly launches: v.ExactOptionalSchema<v.GenericSchema<Exclude<ShardItemsInput['launches'], undefined>, Exclude<ShardItems['launches'], undefined>>, undefined>; readonly pickups: v.ExactOptionalSchema<v.GenericSchema<Exclude<ShardItemsInput['pickups'], undefined>, Exclude<ShardItems['pickups'], undefined>>, undefined>; readonly contexts: v.GenericSchema<ShardItemsInput['contexts'], ShardItems['contexts']>; readonly runtimeContexts: v.ExactOptionalSchema<v.GenericSchema<Exclude<ShardItemsInput['runtimeContexts'], undefined>, Exclude<ShardItems['runtimeContexts'], undefined>>, undefined>; readonly loadout: v.GenericSchema<ShardItemsInput['loadout'], ShardItems['loadout']>; }, undefined> = v.strictObject({ version: v.literal(1), catalogue: v.exactOptional(catalogue), kept: v.exactOptional(kept), rows: v.pipe(v.array(v.variant('kind', [weapon, tool])), v.maxLength(64)),
77
95
  launches: v.exactOptional(v.pipe(v.record(name, BodyLaunchSchema), v.maxEntries(64))),
78
96
  pickups: v.exactOptional(v.pipe(v.record(name, ClaimedPickupSchema), v.maxEntries(128))),
79
97
  contexts: v.pipe(v.array(ItemContextSchema), v.maxLength(64)),
@@ -227,8 +245,8 @@ export interface ToolItemRowsInput { id: `tool.${string}`; kind: 'tool'; family:
227
245
  export interface ToolItemRows { id: `tool.${string}`; kind: 'tool'; family: ItemFamilyNameRows; ui: { name: string; icon: ItemFamilyNameRows; swapIcon: string; blurb: string; }; view: { asset?: string; recipe: ItemFamilyNameRows; colour: string; position: [number, number, number]; rotation: [number, number, number]; }; hook: ({ module: string; entity: number; event: number; }) | null; equipment?: { id: `tool.${string}`; meta: { category: string; } & Omit<v.InferOutput<typeof equipment.entries.meta>, "category">; } & Omit<ItemEquipmentRows, "id" | "meta">; action: (`${string}.${string}`) | null; fuelSeconds: number; intensity: number; }
228
246
  export interface ItemAttackRowsInput { id: ItemFamilyNameRowsInput; damage: number; cooldown: number; range: number; width: number; tags: (`${string}.${string}`)[]; effect: (`effect.${string}`) | null; }
229
247
  export interface ItemAttackRows { id: ItemFamilyNameRows; damage: number; cooldown: number; range: number; width: number; tags: (`${string}.${string}`)[]; effect: (`effect.${string}`) | null; }
230
- export interface ShardItemsInput { version: 1; catalogue?: ({ id: ItemFamilyNameRowsInput; label: string; icon: CatalogueIconNameInput; travels: boolean; })[]; rows: ((WeaponItemRowsInput) | (ToolItemRowsInput))[]; launches?: Record<string, v.InferInput<typeof BodyLaunchSchema>>; pickups?: Record<string, v.InferInput<typeof ClaimedPickupSchema>>; contexts: (ItemContextRowsInput)[]; runtimeContexts?: (ItemFamilyNameRowsInput)[]; loadout: { effects?: { statuses: boolean; player: v.InferInput<typeof LootEconomySchema.entries.grants.entries.player>; worn: v.InferInput<typeof LootEconomySchema.entries.grants.entries.worn>; weapons: ({ items: (`weapon.${string}`)[]; grants: v.InferInput<typeof LootEconomySchema.entries.grants.entries.weapons>; })[]; hitCap?: `effect.${string}`; }; runtime?: { pause: boolean; sliceMs?: number; owners: ({ item: `weapon.${string}`; slot: 'primary' | 'rifle' | 'secondary' | 'extra'; row: 'native' | 'declared'; presentation?: boolean; })[]; }; native?: v.InferInput<typeof NativeLoadoutRowSchema>; inventory?: { kinds: (ItemFamilyNameRowsInput)[]; slots: number; counts: { min: number; max: number; integer: boolean; complete: boolean; }; quantity: 'unchecked' | 'positive-safe-integer'; snapshot: 'order' | 'roster'; stackLimit?: number; restoreError: string; }; primary: (`weapon.${string}`) | null; secondary: (`weapon.${string}`) | null; tools: (`tool.${string}`)[]; level?: LevelLoadout; }; }
231
- export interface ShardItems { version: 1; catalogue?: ({ id: ItemFamilyNameRows; label: string; icon: CatalogueIconName; travels: boolean; })[]; rows: ((WeaponItemRows) | (ToolItemRows))[]; launches?: Record<string, v.InferOutput<typeof BodyLaunchSchema>>; pickups?: Record<string, v.InferOutput<typeof ClaimedPickupSchema>>; contexts: (ItemContextRows)[]; runtimeContexts?: (ItemFamilyNameRows)[]; loadout: { effects?: { statuses: boolean; player: v.InferOutput<typeof LootEconomySchema.entries.grants.entries.player>; worn: v.InferOutput<typeof LootEconomySchema.entries.grants.entries.worn>; weapons: ({ items: (`weapon.${string}`)[]; grants: v.InferOutput<typeof LootEconomySchema.entries.grants.entries.weapons>; })[]; hitCap?: `effect.${string}`; }; runtime?: { pause: boolean; sliceMs?: number; owners: ({ item: `weapon.${string}`; slot: 'primary' | 'rifle' | 'secondary' | 'extra'; row: 'native' | 'declared'; presentation?: boolean; })[]; }; native?: v.InferOutput<typeof NativeLoadoutRowSchema>; inventory?: { kinds: (ItemFamilyNameRows)[]; slots: number; counts: { min: number; max: number; integer: boolean; complete: boolean; }; quantity: 'unchecked' | 'positive-safe-integer'; snapshot: 'order' | 'roster'; stackLimit?: number; restoreError: string; }; primary: (`weapon.${string}`) | null; secondary: (`weapon.${string}`) | null; tools: (`tool.${string}`)[]; level?: LevelLoadout; }; }
248
+ export interface ShardItemsInput { version: 1; catalogue?: ({ id: ItemFamilyNameRowsInput; label: string; icon: CatalogueIconNameInput; travels: boolean; })[]; kept?: KeptItemRowsInput[]; rows: ((WeaponItemRowsInput) | (ToolItemRowsInput))[]; launches?: Record<string, v.InferInput<typeof BodyLaunchSchema>>; pickups?: Record<string, v.InferInput<typeof ClaimedPickupSchema>>; contexts: (ItemContextRowsInput)[]; runtimeContexts?: (ItemFamilyNameRowsInput)[]; loadout: { effects?: { statuses: boolean; player: v.InferInput<typeof LootEconomySchema.entries.grants.entries.player>; worn: v.InferInput<typeof LootEconomySchema.entries.grants.entries.worn>; weapons: ({ items: (`weapon.${string}`)[]; grants: v.InferInput<typeof LootEconomySchema.entries.grants.entries.weapons>; })[]; hitCap?: `effect.${string}`; }; runtime?: { pause: boolean; sliceMs?: number; owners: ({ item: `weapon.${string}`; slot: 'primary' | 'rifle' | 'secondary' | 'extra'; row: 'native' | 'declared'; presentation?: boolean; })[]; }; native?: v.InferInput<typeof NativeLoadoutRowSchema>; inventory?: { kinds: (ItemFamilyNameRowsInput)[]; slots: number; counts: { min: number; max: number; integer: boolean; complete: boolean; }; quantity: 'unchecked' | 'positive-safe-integer'; snapshot: 'order' | 'roster'; stackLimit?: number; restoreError: string; }; primary: (`weapon.${string}`) | null; secondary: (`weapon.${string}`) | null; tools: (`tool.${string}`)[]; level?: LevelLoadout; }; }
249
+ export interface ShardItems { version: 1; catalogue?: ({ id: ItemFamilyNameRows; label: string; icon: CatalogueIconName; travels: boolean; })[]; kept?: KeptItemRows[]; rows: ((WeaponItemRows) | (ToolItemRows))[]; launches?: Record<string, v.InferOutput<typeof BodyLaunchSchema>>; pickups?: Record<string, v.InferOutput<typeof ClaimedPickupSchema>>; contexts: (ItemContextRows)[]; runtimeContexts?: (ItemFamilyNameRows)[]; loadout: { effects?: { statuses: boolean; player: v.InferOutput<typeof LootEconomySchema.entries.grants.entries.player>; worn: v.InferOutput<typeof LootEconomySchema.entries.grants.entries.worn>; weapons: ({ items: (`weapon.${string}`)[]; grants: v.InferOutput<typeof LootEconomySchema.entries.grants.entries.weapons>; })[]; hitCap?: `effect.${string}`; }; runtime?: { pause: boolean; sliceMs?: number; owners: ({ item: `weapon.${string}`; slot: 'primary' | 'rifle' | 'secondary' | 'extra'; row: 'native' | 'declared'; presentation?: boolean; })[]; }; native?: v.InferOutput<typeof NativeLoadoutRowSchema>; inventory?: { kinds: (ItemFamilyNameRows)[]; slots: number; counts: { min: number; max: number; integer: boolean; complete: boolean; }; quantity: 'unchecked' | 'positive-safe-integer'; snapshot: 'order' | 'roster'; stackLimit?: number; restoreError: string; }; primary: (`weapon.${string}`) | null; secondary: (`weapon.${string}`) | null; tools: (`tool.${string}`)[]; level?: LevelLoadout; }; }
232
250
  export interface NativeSweptPolicyRowsInput { kind: 'swept'; step: ItemFamilyNameRowsInput; selection?: v.InferInput<typeof NativeLoadoutRowSchema>; eye: number; initial: number; source: 'env' | 'owner'; slots: ({ item: `weapon.${string}`; weapon: `weapon.${string}`; tags: (`${string}.${string}`)[]; combo: (ItemFamilyNameRowsInput)[]; heavy: ItemFamilyNameRowsInput; })[]; contact: { slack: number; direction: [number, number, number]; push: [number, number]; running: number; }; lunge: { maxHeight: number; minDistance: number; minRadius: number; lengthScale: number; }; }
233
251
  export interface NativeSweptPolicyRows { kind: 'swept'; step: ItemFamilyNameRows; selection?: v.InferOutput<typeof NativeLoadoutRowSchema>; eye: number; initial: number; source: 'env' | 'owner'; slots: ({ item: `weapon.${string}`; weapon: `weapon.${string}`; tags: (`${string}.${string}`)[]; combo: (ItemFamilyNameRows)[]; heavy: ItemFamilyNameRows; })[]; contact: { slack: number; direction: [number, number, number]; push: [number, number]; running: number; }; lunge: { maxHeight: number; minDistance: number; minRadius: number; lengthScale: number; }; }
234
252
  export interface ItemEquipmentRowsInput { id: string; legacySlot?: 'crossbow' | 'sword' | 'rifle' | 'sword-iron' | 'bow' | 'sabre' | 'spear' | 'empty'; ui: { name: string; icon: CatalogueIconNameInput; swapIcon: string; touch: 'melee' | 'bow' | 'ranged' | 'throwing'; lockOn: boolean; melee: boolean; tracers: boolean; inputContext?: ItemFamilyNameRowsInput; swapName?: string; huntersEye?: boolean; ammo?: { label: string; segments: number; magazine?: boolean; bagLabel?: string; bagLabelFor?: string; }; }; meta: { name: string; icon: CatalogueIconNameInput; blurb: string; category: ItemFamilyNameRowsInput; }; cues?: { fire: string; reload: string; impact: string; dry?: string; hit?: string; heavy?: string; charge?: Record<string, string>; }; hitStop?: { body: number; head: number; kill: number; }; rangedFeel?: { kick: { body: number; head: number; kill: number; side: number; killSide: number; }; trauma: { kill: number; head: number; killKinds: (ItemFamilyNameRowsInput)[]; headKinds: (ItemFamilyNameRowsInput)[]; }; }; tags?: (`${string}.${string}`)[]; }
@@ -0,0 +1,12 @@
1
+ {
2
+ "about": "Frozen engine table (SHARD-COMPAT CP1, design Q17): the seven journal glyphs a compendium icon could name before shard-format 036b383 made icons image-only, drawn as engine src/client/game/icons.ts drew them (64x64, currentColor; ghost without its glow filter, strokes without caps). The journal-glyph-images chain step writes each as an inert SVG image.",
3
+ "glyphs": {
4
+ "deer": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2264%22%20height%3D%2264%22%20viewBox%3D%220%200%2064%2064%22%20fill%3D%22currentColor%22%20stroke%3D%22none%22%3E%3Cellipse%20cx%3D%2237%22%20cy%3D%2235%22%20rx%3D%2216%22%20ry%3D%228.5%22%2F%3E%20%3Cpath%20d%3D%22M25%2031%20L20%2016%20L27%2015%20L31%2030%20Z%22%2F%3E%20%3Cellipse%20cx%3D%2220%22%20cy%3D%2215%22%20rx%3D%226.5%22%20ry%3D%224%22%2F%3E%20%3Cpath%20d%3D%22M15%2013%20L12%206%20L17%2011%20Z%22%2F%3E%20%3Cpath%20d%3D%22M25%2012%20L27%207%20L29%2012%20Z%22%2F%3E%20%3Cpath%20d%3D%22M20%2012%20L17%203%20M20%2012%20L23%202%20M17%203%20L14%204%20M18.5%207%20L15%206%20M23%202%20L26%201%20M21.5%206%20L25%205%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%221.8%22%2F%3E%20%3Cpath%20d%3D%22M52%2030%20L56%2026%20L55%2031%20Z%22%2F%3E%20%3Crect%20x%3D%2224%22%20y%3D%2240%22%20width%3D%223.2%22%20height%3D%2217%22%20rx%3D%221%22%2F%3E%3Crect%20x%3D%2230%22%20y%3D%2240%22%20width%3D%223.2%22%20height%3D%2217%22%20rx%3D%221%22%2F%3E%3Crect%20x%3D%2243%22%20y%3D%2240%22%20width%3D%223.2%22%20height%3D%2217%22%20rx%3D%221%22%2F%3E%3Crect%20x%3D%2249%22%20y%3D%2240%22%20width%3D%223.2%22%20height%3D%2217%22%20rx%3D%221%22%2F%3E%3C%2Fsvg%3E",
5
+ "elk": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2264%22%20height%3D%2264%22%20viewBox%3D%220%200%2064%2064%22%20fill%3D%22currentColor%22%20stroke%3D%22none%22%3E%3Cellipse%20cx%3D%2238%22%20cy%3D%2236%22%20rx%3D%2217%22%20ry%3D%229.5%22%2F%3E%20%3Cpath%20d%3D%22M24%2032%20L18%2015%20L27%2013%20L32%2030%20Z%22%2F%3E%20%3Cpath%20d%3D%22M22%2026%20L19%2034%20L26%2031%20Z%22%2F%3E%20%3Cellipse%20cx%3D%2219%22%20cy%3D%2214%22%20rx%3D%227%22%20ry%3D%224.5%22%2F%3E%20%3Cpath%20d%3D%22M13%2012%20L9%206%20L15%2010%20Z%22%2F%3E%20%3Cpath%20d%3D%22M18%2011%20C12%208%208%203%206%20-2%20M18%2011%20C15%205%2013%201%2014%20-3%20M18%2011%20L24%20-1%20M20%205%20L17%202%20M22%202%20L19%20-1%20M13%205%20L9%204%20M11%208%20L6%208%20M22%204%20L25%201%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222.2%22%2F%3E%20%3Crect%20x%3D%2223%22%20y%3D%2242%22%20width%3D%223.6%22%20height%3D%2217%22%20rx%3D%221%22%2F%3E%3Crect%20x%3D%2230%22%20y%3D%2242%22%20width%3D%223.6%22%20height%3D%2217%22%20rx%3D%221%22%2F%3E%3Crect%20x%3D%2245%22%20y%3D%2242%22%20width%3D%223.6%22%20height%3D%2217%22%20rx%3D%221%22%2F%3E%3Crect%20x%3D%2252%22%20y%3D%2242%22%20width%3D%223.6%22%20height%3D%2217%22%20rx%3D%221%22%2F%3E%3C%2Fsvg%3E",
6
+ "boar": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2264%22%20height%3D%2264%22%20viewBox%3D%220%200%2064%2064%22%20fill%3D%22currentColor%22%20stroke%3D%22none%22%3E%3Cpath%20d%3D%22M14%2034%20C12%2024%2024%2020%2036%2020%20C50%2020%2058%2026%2057%2036%20C56%2044%2048%2046%2036%2046%20C24%2046%2015%2044%2014%2034%20Z%22%2F%3E%20%3Cpath%20d%3D%22M15%2030%20L6%2035%20L8%2042%20L16%2042%20Z%22%2F%3E%20%3Cpath%20d%3D%22M7%2040%20L3%2044%20L6%2044.5%20Z%22%2F%3E%20%3Cpath%20d%3D%22M30%2020%20L33%2016%20L36%2020%20Z%20M40%2020%20L43%2016%20L46%2020%20Z%22%2F%3E%20%3Cpath%20d%3D%22M8%2043.5%20C9%2046.5%2012%2047%2014%2045%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%2F%3E%20%3Cpath%20d%3D%22M57%2030%20L61%2026%20L60%2033%20Z%22%2F%3E%20%3Crect%20x%3D%2218%22%20y%3D%2243%22%20width%3D%223.4%22%20height%3D%2214%22%20rx%3D%221%22%2F%3E%3Crect%20x%3D%2225%22%20y%3D%2243%22%20width%3D%223.4%22%20height%3D%2214%22%20rx%3D%221%22%2F%3E%3Crect%20x%3D%2241%22%20y%3D%2243%22%20width%3D%223.4%22%20height%3D%2214%22%20rx%3D%221%22%2F%3E%3Crect%20x%3D%2248%22%20y%3D%2243%22%20width%3D%223.4%22%20height%3D%2214%22%20rx%3D%221%22%2F%3E%3C%2Fsvg%3E",
7
+ "bear": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2264%22%20height%3D%2264%22%20viewBox%3D%220%200%2064%2064%22%20fill%3D%22currentColor%22%20stroke%3D%22none%22%3E%3Cpath%20d%3D%22M8%2030%20C6%2024%2010%2020%2016%2020%20L20%2020%20C24%2014%2034%2012%2044%2014%20C54%2016%2060%2024%2058%2034%20C57%2042%2052%2046%2044%2046%20L20%2046%20C12%2046%208%2040%208%2030%20Z%22%2F%3E%20%3Cpath%20d%3D%22M10%2022%20C6%2022%204%2026%205%2030%20C7%2033%2012%2033%2014%2030%20L20%2030%20L20%2036%20C16%2040%2010%2038%208%2034%20Z%22%2F%3E%20%3Cpath%20d%3D%22M4%2032%20L1%2036%20L5%2036.5%20Z%22%2F%3E%20%3Ccircle%20cx%3D%2214%22%20cy%3D%2218%22%20r%3D%223.2%22%2F%3E%3Ccircle%20cx%3D%2221%22%20cy%3D%2215%22%20r%3D%223%22%2F%3E%20%3Crect%20x%3D%2216%22%20y%3D%2244%22%20width%3D%225.2%22%20height%3D%2213%22%20rx%3D%221%22%2F%3E%3Crect%20x%3D%2224%22%20y%3D%2244%22%20width%3D%225.2%22%20height%3D%2213%22%20rx%3D%221%22%2F%3E%3Crect%20x%3D%2240%22%20y%3D%2244%22%20width%3D%225.2%22%20height%3D%2213%22%20rx%3D%221%22%2F%3E%3Crect%20x%3D%2248%22%20y%3D%2244%22%20width%3D%225.2%22%20height%3D%2213%22%20rx%3D%221%22%2F%3E%3C%2Fsvg%3E",
8
+ "antlers": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2264%22%20height%3D%2264%22%20viewBox%3D%220%200%2064%2064%22%20fill%3D%22currentColor%22%20stroke%3D%22none%22%3E%3Cpath%20d%3D%22M32%2058%20L32%2030%20M32%2030%20C22%2028%2014%2020%2012%208%20M32%2030%20C42%2028%2050%2020%2052%208%20M22%2026%20L16%2018%20M42%2026%20L48%2018%20M18%2016%20L10%2014%20M46%2016%20L54%2014%20M27%2029%20L24%2036%20M37%2029%20L40%2036%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%223.5%22%2F%3E%3C%2Fsvg%3E",
9
+ "ghost": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2264%22%20height%3D%2264%22%20viewBox%3D%220%200%2064%2064%22%20fill%3D%22currentColor%22%20stroke%3D%22none%22%3E%3Cg%20opacity%3D%220.7%22%3E%3Cellipse%20cx%3D%2237%22%20cy%3D%2235%22%20rx%3D%2216%22%20ry%3D%228.5%22%2F%3E%20%3Cpath%20d%3D%22M25%2031%20L20%2016%20L27%2015%20L31%2030%20Z%22%2F%3E%20%3Cellipse%20cx%3D%2220%22%20cy%3D%2215%22%20rx%3D%226.5%22%20ry%3D%224%22%2F%3E%20%3Cpath%20d%3D%22M15%2013%20L12%206%20L17%2011%20Z%22%2F%3E%20%3Cpath%20d%3D%22M25%2012%20L27%207%20L29%2012%20Z%22%2F%3E%20%3Cpath%20d%3D%22M20%2012%20L17%203%20M20%2012%20L23%202%20M17%203%20L14%204%20M18.5%207%20L15%206%20M23%202%20L26%201%20M21.5%206%20L25%205%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%221.8%22%2F%3E%20%3Cpath%20d%3D%22M52%2030%20L56%2026%20L55%2031%20Z%22%2F%3E%20%3Crect%20x%3D%2224%22%20y%3D%2240%22%20width%3D%223.2%22%20height%3D%2217%22%20rx%3D%221%22%2F%3E%3Crect%20x%3D%2230%22%20y%3D%2240%22%20width%3D%223.2%22%20height%3D%2217%22%20rx%3D%221%22%2F%3E%3Crect%20x%3D%2243%22%20y%3D%2240%22%20width%3D%223.2%22%20height%3D%2217%22%20rx%3D%221%22%2F%3E%3Crect%20x%3D%2249%22%20y%3D%2240%22%20width%3D%223.2%22%20height%3D%2217%22%20rx%3D%221%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E",
10
+ "ironhide": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2264%22%20height%3D%2264%22%20viewBox%3D%220%200%2064%2064%22%20fill%3D%22currentColor%22%20stroke%3D%22none%22%3E%3Cg%20transform%3D%22translate(-4%20-6)%20scale(1.14)%22%3E%3Cpath%20d%3D%22M14%2034%20C12%2024%2024%2020%2036%2020%20C50%2020%2058%2026%2057%2036%20C56%2044%2048%2046%2036%2046%20C24%2046%2015%2044%2014%2034%20Z%22%2F%3E%20%3Cpath%20d%3D%22M15%2030%20L6%2035%20L8%2042%20L16%2042%20Z%22%2F%3E%20%3Cpath%20d%3D%22M7%2040%20L3%2044%20L6%2044.5%20Z%22%2F%3E%20%3Cpath%20d%3D%22M30%2020%20L33%2016%20L36%2020%20Z%20M40%2020%20L43%2016%20L46%2020%20Z%22%2F%3E%20%3Cpath%20d%3D%22M8%2043.5%20C9%2046.5%2012%2047%2014%2045%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%2F%3E%20%3Cpath%20d%3D%22M57%2030%20L61%2026%20L60%2033%20Z%22%2F%3E%20%3Crect%20x%3D%2218%22%20y%3D%2243%22%20width%3D%223.4%22%20height%3D%2214%22%20rx%3D%221%22%2F%3E%3Crect%20x%3D%2225%22%20y%3D%2243%22%20width%3D%223.4%22%20height%3D%2214%22%20rx%3D%221%22%2F%3E%3Crect%20x%3D%2241%22%20y%3D%2243%22%20width%3D%223.4%22%20height%3D%2214%22%20rx%3D%221%22%2F%3E%3Crect%20x%3D%2248%22%20y%3D%2243%22%20width%3D%223.4%22%20height%3D%2214%22%20rx%3D%221%22%2F%3E%3Cpath%20d%3D%22M4%2046%20L-2%2052%20L5%2050%20Z%22%20transform%3D%22translate(4%20-4)%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E"
11
+ }
12
+ }
@@ -19,6 +19,9 @@ export const ClaimedPickupSchema: v.GenericSchema<ClaimedPickupRowsInput, Claime
19
19
  towardPlayer: v.exactOptional(v.strictObject({ distance: v.pipe(finite, v.minValue(0)), epsilon: v.pipe(finite, v.minValue(0)) })) })),
20
20
  toast: v.exactOptional(text),
21
21
  });
22
+ /** ONE-FORMAT OF31g1 (Q37): the shard's one currency: what its coin is called, the pickup model a kill bursts and the Bag icon. */
23
+ const currency: v.GenericSchema<CurrencyRowsInput, CurrencyRows> = v.strictObject({ id: key, name: v.pipe(text, v.nonEmpty()),
24
+ model: v.pipe(v.string(), v.regex(/^(?=.{1,128}$)[a-z][a-z0-9-]*(?:\/[a-z0-9][a-z0-9-]*)*$/u)), icon: key });
22
25
  const grantSchema = v.strictObject({ id: effectId, key, unless: v.exactOptional(v.pipe(v.array(key), v.maxLength(32))), stacks: v.exactOptional(v.pipe(positive, v.maxValue(1024))) });
23
26
  const grants = v.pipe(v.array(grantSchema), v.maxLength(128));
24
27
  /** Bounded data selectors lower to the existing weighted-table predicate and count laws. */
@@ -42,7 +45,8 @@ export function parseLootTables(input: unknown): v.InferOutput<typeof LootTables
42
45
  return rows;
43
46
  }
44
47
  /** Inert economy content; ownership, transactions, attributes and menu lifetimes stay with their existing services. */
45
- export const LootEconomySchema: v.StrictObjectSchema<{ readonly presentation: v.ExactOptionalSchema<v.GenericSchema<Exclude<LootEconomyInput['presentation'], undefined>, Exclude<LootEconomy['presentation'], undefined>>, undefined>; readonly exchange: v.ExactOptionalSchema<v.GenericSchema<Exclude<LootEconomyInput['exchange'], undefined>, Exclude<LootEconomy['exchange'], undefined>>, undefined>; readonly pickups: v.ExactOptionalSchema<v.GenericSchema<Exclude<LootEconomyInput['pickups'], undefined>, Exclude<LootEconomy['pickups'], undefined>>, undefined>; readonly tables: v.ExactOptionalSchema<v.GenericSchema<Exclude<LootEconomyInput['tables'], undefined>, Exclude<LootEconomy['tables'], undefined>>, undefined>; readonly progression: v.ExactOptionalSchema<v.GenericSchema<Exclude<LootEconomyInput['progression'], undefined>, Exclude<LootEconomy['progression'], undefined>>, undefined>; readonly effects: v.GenericSchema<LootEconomyInput['effects'], LootEconomy['effects']>; readonly goods: v.GenericSchema<LootEconomyInput['goods'], LootEconomy['goods']>; readonly grants: v.StrictObjectSchema<{ readonly player: v.GenericSchema<LootEconomyInput['grants']['player'], LootEconomy['grants']['player']>; readonly worn: v.GenericSchema<LootEconomyInput['grants']['worn'], LootEconomy['grants']['worn']>; readonly weapons: v.GenericSchema<LootEconomyInput['grants']['weapons'], LootEconomy['grants']['weapons']>; }, undefined>; readonly finds: v.GenericSchema<LootEconomyInput['finds'], LootEconomy['finds']>; readonly marks: v.GenericSchema<LootEconomyInput['marks'], LootEconomy['marks']>; }, undefined> = v.strictObject({
48
+ export const LootEconomySchema: v.StrictObjectSchema<{ readonly currency: v.ExactOptionalSchema<v.GenericSchema<CurrencyRowsInput, CurrencyRows>, undefined>; readonly presentation: v.ExactOptionalSchema<v.GenericSchema<Exclude<LootEconomyInput['presentation'], undefined>, Exclude<LootEconomy['presentation'], undefined>>, undefined>; readonly exchange: v.ExactOptionalSchema<v.GenericSchema<Exclude<LootEconomyInput['exchange'], undefined>, Exclude<LootEconomy['exchange'], undefined>>, undefined>; readonly pickups: v.ExactOptionalSchema<v.GenericSchema<Exclude<LootEconomyInput['pickups'], undefined>, Exclude<LootEconomy['pickups'], undefined>>, undefined>; readonly tables: v.ExactOptionalSchema<v.GenericSchema<Exclude<LootEconomyInput['tables'], undefined>, Exclude<LootEconomy['tables'], undefined>>, undefined>; readonly progression: v.ExactOptionalSchema<v.GenericSchema<Exclude<LootEconomyInput['progression'], undefined>, Exclude<LootEconomy['progression'], undefined>>, undefined>; readonly effects: v.GenericSchema<LootEconomyInput['effects'], LootEconomy['effects']>; readonly goods: v.GenericSchema<LootEconomyInput['goods'], LootEconomy['goods']>; readonly grants: v.StrictObjectSchema<{ readonly player: v.GenericSchema<LootEconomyInput['grants']['player'], LootEconomy['grants']['player']>; readonly worn: v.GenericSchema<LootEconomyInput['grants']['worn'], LootEconomy['grants']['worn']>; readonly weapons: v.GenericSchema<LootEconomyInput['grants']['weapons'], LootEconomy['grants']['weapons']>; }, undefined>; readonly finds: v.GenericSchema<LootEconomyInput['finds'], LootEconomy['finds']>; readonly marks: v.GenericSchema<LootEconomyInput['marks'], LootEconomy['marks']>; }, undefined> = v.strictObject({
49
+ currency: v.exactOptional(currency),
46
50
  presentation:v.exactOptional(LootPresentationSchema),
47
51
  exchange: v.exactOptional(ExchangeSchema),
48
52
  pickups: v.exactOptional(v.pipe(v.record(key, ClaimedPickupSchema), v.maxEntries(128))),
@@ -141,7 +145,10 @@ export type LootTablesRows = ({
141
145
  })[];
142
146
  };
143
147
  })[];
148
+ interface CurrencyRowsInput { id: string; name: string; model: string; icon: string; }
149
+ interface CurrencyRows { id: string; name: string; model: string; icon: string; }
144
150
  interface LootEconomyInputFields {
151
+ currency?: CurrencyRowsInput;
145
152
  presentation?: v.InferInput<typeof LootPresentationSchema>;
146
153
  exchange?: v.InferInput<typeof ExchangeSchema>;
147
154
  pickups?: Record<string, ClaimedPickupRowsInput>;
@@ -174,6 +181,7 @@ interface LootEconomyInputFields {
174
181
  }
175
182
  export type LootEconomyInput = { [Key in keyof LootEconomyInputFields]: LootEconomyInputFields[Key] };
176
183
  interface LootEconomyFields {
184
+ currency?: CurrencyRows;
177
185
  presentation?: v.InferOutput<typeof LootPresentationSchema>;
178
186
  exchange?: v.InferOutput<typeof ExchangeSchema>;
179
187
  pickups?: Record<string, ClaimedPickupRows>;
@@ -1,5 +1,5 @@
1
1
  {
2
- "$doc": "J426 (Jake, 2026-11-18): the one armed-zone list. A zone named here has done the work to get under the J410 lines, and from then on every memory gate refuses it back over them, with no override flag and no report-only fallback: the format's offline estimate over lines.playingBytes / lines.loadingBytes (check, validate, cook, upload), the declared worst-location total over the J408 1.5 GB line, the runtime tier and a stale runtime reading; engine's ledger, footprint and boot-line guards read the same list. A zone not named here reports only (J424). Each zone's playingBytes / loadingBytes are its offline estimate when it was armed (memory epoch in `epoch`); the offline estimate refuses over the larger of the line and that reading plus 0.5% (memory-armed.ts ARMED_ALLOWANCE), so a zone EM11 measured under the line whose conservative estimate reads over it (Nine's playing) is locked at its armed state. Decimal bytes. Format memory-armed.ts reads this; engine reads @wildshard/format/src/format/memory-armed.json. `held` (J424): zones armed once but moved out of `zones` because engine pins an older product of theirs that reads over the line; a held zone reports only, and moves back to `zones` (re-armed) when its engine re-pin lands. Its readings stay so re-arming changes nothing else.",
2
+ "$doc": "J426 (Jake, 2026-11-18): the one armed-zone list. A zone named here has done the work to get under the J410 lines, and from then on every memory gate refuses it back over them, with no override flag and no report-only fallback: the format's offline estimate over lines.playingBytes / lines.loadingBytes (check, validate, cook, upload), the declared worst-location total over the J408 1.5 GB line, the runtime tier and a stale runtime reading; engine's ledger, footprint and boot-line guards read the same list. A zone not named here reports only (J424). Each zone's playingBytes / loadingBytes are its offline estimate when it was armed (memory epoch in `epoch`); the offline estimate refuses over the larger of the line and that reading plus 0.5% (memory-armed.ts ARMED_ALLOWANCE), so a zone EM11 measured under the line whose conservative estimate reads over it (Nine's playing) is locked at its armed state. Decimal bytes. Format memory-armed.ts reads this; engine reads @wildshard/format/src/format/memory-armed.json. The four zones once held here (Driftwood, Nalati, Nine Dragon, Pine) are simply not armed: CP10 judges a stored original by its stored verdict, so no pinned product needs a hold (FORMAT-PRUNE FP12); arming moves to the API catalogue at FP27.",
3
3
  "lines": {
4
4
  "playingBytes": 1000000000,
5
5
  "loadingBytes": 1500000000
@@ -181,43 +181,5 @@
181
181
  "loadingBytes": 1108011593,
182
182
  "evidence": "engine-pinned product revision 2 (tar f4a1d611cccc), a shard with no runtime reading; epoch-8 golden estimate; mini-resweep reads every light zone under both J410 lines standalone"
183
183
  }
184
- },
185
- "held": {
186
- "driftwood-isle": {
187
- "armed": "2026-11-18",
188
- "by": "mini-pinemem5",
189
- "epoch": 8,
190
- "playingBytes": 820905616,
191
- "loadingBytes": 1157545785,
192
- "evidence": "shard-driftwood e736730 built with format 0.37 (epoch 8); codex-nalati locked pairs on the EM11 upper read 990.5 / 1,344.7 MB (meta MEMORY-GATES)",
193
- "held": "2026-11-18 opus-pin (J424, QA 11-18 row 29): engine pins an older product of this zone that reads over its line; re-arm (move back to zones) when engine's pin reaches the armed build"
194
- },
195
- "nalati-grasslands": {
196
- "armed": "2026-11-18",
197
- "by": "mini-pinemem5",
198
- "epoch": 8,
199
- "playingBytes": 945736154,
200
- "loadingBytes": 1328901899,
201
- "evidence": "shard-nalati 1d5014e8 built with format 0.37 (epoch 8); mini-resweep EM11 upper on the J420 stand-in: playing 0.940 GB less the worker, loading 1.470 GB (meta MEMORY-GATES)",
202
- "held": "2026-11-18 opus-pin (J424, QA 11-18 row 29): engine pins an older product of this zone that reads over its line; re-arm (move back to zones) when engine's pin reaches the armed build"
203
- },
204
- "nine-dragon-stack": {
205
- "armed": "2026-11-18",
206
- "by": "mini-pinemem5",
207
- "epoch": 8,
208
- "playingBytes": 1023504847,
209
- "loadingBytes": 1434692360,
210
- "evidence": "shard-nine-dragon 8779b872 built with format 0.37 (epoch 8); mini-pinemem6 prepared online boot on engine d0fd6e62, 9 pairs: playing upper 0.938 GB, loading upper 1.435 GB (meta 1677f091). The estimate's playing (1,023.5 MB) is over the 1.0 GB line, so it locks at that reading",
211
- "held": "2026-11-18 opus-pin (J424, QA 11-18 row 29): engine pins an older product of this zone that reads over its line; re-arm (move back to zones) when engine's pin reaches the armed build"
212
- },
213
- "pine-hollow": {
214
- "armed": "2026-11-18",
215
- "by": "mini-pinemem5",
216
- "epoch": 8,
217
- "playingBytes": 920666659,
218
- "loadingBytes": 1298769921,
219
- "evidence": "shard-pine-hollow 400ed4b7 built with format 0.37 (epoch 8); mini-pinemem6 prepared online boot on engine f0a96518, 9 pairs: playing upper 0.969 GB, loading upper 1.407 GB (meta 118a2b13)",
220
- "held": "2026-11-18 opus-pin (J424, QA 11-18 row 29): engine pins an older product of this zone that reads over its line; re-arm (move back to zones) when engine's pin reaches the armed build"
221
- }
222
184
  }
223
185
  }
@@ -24,12 +24,6 @@ const ARMED_ZONES: Readonly<Record<string, ArmedZone>> = Object.freeze(
24
24
 
25
25
  /** J424 (QA 11-18 row 29): a zone armed once but held out of `ARMED_ZONES` while engine pins an older product of it
26
26
  * that reads over its line. It reports only; it moves back to `zones` (re-armed) when its engine re-pin lands. */
27
- interface HeldZone extends ArmedZone {
28
- readonly held: string
29
- }
30
-
31
- const HELD_ZONES: Readonly<Record<string, HeldZone>> = Object.freeze(armed.held)
32
-
33
27
  /** True when `slug` is in the armed list (J426). */
34
28
  function zoneArmed(slug?: string): boolean {
35
29
  return slug !== undefined && Object.hasOwn(ARMED_ZONES, slug)
@@ -44,13 +38,52 @@ function armedLine(
44
38
  return zoneArmed(slug) ? ARMED_LINES[kind] : undefined
45
39
  }
46
40
 
41
+ type RatchetMetric = 'playing' | 'loading' | 'runtime'
42
+
43
+ /** J445: only the common loading ceiling can refuse an armed shard. Playing and runtime tier overages are reported. */
44
+ function ratchetLimit(
45
+ slug: string | undefined,
46
+ metric: RatchetMetric,
47
+ line: number,
48
+ ): number {
49
+ return metric === 'loading' && zoneArmed(slug)
50
+ ? line
51
+ : Number.POSITIVE_INFINITY
52
+ }
53
+
54
+ /** Describe the offline decision for a measured overage. */
55
+ function ratchetSeverity(
56
+ slug: string | undefined,
57
+ metric: RatchetMetric,
58
+ reading: Readonly<{ line: number; actual: number }>,
59
+ ): 'refusal' | 'warning' {
60
+ return reading.actual > ratchetLimit(slug, metric, reading.line)
61
+ ? 'refusal'
62
+ : 'warning'
63
+ }
64
+
65
+ /** The words a reported (not refused) issue carries: why it only reports (J424). */
66
+ function ratchetNote(slug: string | undefined): string {
67
+ return zoneArmed(slug)
68
+ ? ''
69
+ : ` (report-only, J424: ${slug ?? 'this shard'} is not armed)`
70
+ }
71
+
72
+ /** True when a stale runtime reading only reports: J424, every zone not armed (J426). */
73
+ function staleReadingAdmitted(slug: string | undefined): boolean {
74
+ return !zoneArmed(slug)
75
+ }
76
+
47
77
  export {
48
78
  ARMED_LINES,
49
79
  ARMED_ZONES,
50
80
  type ArmedKind,
51
81
  type ArmedZone,
52
82
  armedLine,
53
- HELD_ZONES,
54
- type HeldZone,
83
+ type RatchetMetric,
84
+ ratchetLimit,
85
+ ratchetNote,
86
+ ratchetSeverity,
87
+ staleReadingAdmitted,
55
88
  zoneArmed,
56
89
  }
@@ -1,4 +1,4 @@
1
- import { staleReadingAdmitted } from './memory-ratchet.ts'
1
+ import { staleReadingAdmitted } from './memory-armed.ts'
2
2
 
3
3
  /** MEMORY-GATES MG5 (J408, Jake 2026-11-17: "a stale runtimeCost is refused"): the memory model a runtime home's
4
4
  * `runtimeCost` reading must have been taken against. It rises when the model changes what it charges (MG6 adds shader
@@ -46,7 +46,7 @@ function staleRuntimeIssues(
46
46
  current: number = OLDEST_CURRENT_EPOCH,
47
47
  identity?: Readonly<{ slug: string; revision: number }>,
48
48
  ): StaleRuntimeIssue[] {
49
- const admitted = staleReadingAdmitted(identity?.slug, identity?.revision)
49
+ const admitted = staleReadingAdmitted(identity?.slug)
50
50
  const rows: EpochRow[] = []
51
51
  const cost = runtime === null ? undefined : runtime.cost
52
52
  if (cost !== undefined) {
@@ -2,8 +2,7 @@ import { parse } from 'valibot'
2
2
 
3
3
  import { bootMemoryCosts } from './boot-memory-cost.ts'
4
4
  import { worstContentCost } from './budget.ts'
5
- import { ARMED_LINES } from './memory-armed.ts'
6
- import { ratchetNote, ratchetSeverity } from './memory-ratchet.ts'
5
+ import { ARMED_LINES, ratchetNote, ratchetSeverity } from './memory-armed.ts'
7
6
  import { runtimeAccountedBytes, RuntimeCostSchema } from './runtimeCost.ts'
8
7
 
9
8
  import type { TierIndex } from './phone-files.ts'
@@ -45,7 +44,7 @@ function hardLineIssue(
45
44
  : overHardLine(bytes)
46
45
  return {
47
46
  code: `perf-${kind}-memory`,
48
- metric: `worst ${kind} total bytes${over}${severity === 'warning' ? ratchetNote(slug, kind) : ''}`,
47
+ metric: `worst ${kind} total bytes${over}${severity === 'warning' ? ratchetNote(slug) : ''}`,
49
48
  actual: bytes,
50
49
  limit: line,
51
50
  severity,
@@ -87,12 +86,14 @@ type MemoryContext =
87
86
  sections: ReadonlyMap<string, unknown>
88
87
  mountedImages: number
89
88
  index?: TierIndex
89
+ judged?: 'upload' | 'stored'
90
90
  }>
91
91
 
92
92
  function memoryContext(context: MemoryContext): Readonly<{
93
93
  sections: ReadonlyMap<string, unknown>
94
94
  mountedImages: number
95
95
  index?: TierIndex
96
+ judged?: 'upload' | 'stored'
96
97
  }> {
97
98
  return context instanceof Map
98
99
  ? { sections: context, mountedImages: EMPTY_BYTES }
@@ -35,7 +35,7 @@ export class MemoryAdmission {
35
35
  private readonly developer: () => boolean;
36
36
  private readonly hardBytes: number | ((owner: string, kind: 'playing' | 'loading') => number);
37
37
  /** `hardBytes` (J408): applies to playing and loading even with an override; a function gives each owner its own
38
- * line (J412's ratchet, `memory-ratchet.ts`). */
38
+ * line (J412's ratchet, `memory-armed.ts`). */
39
39
  constructor(developer: () => boolean = () => false, hardBytes: number | ((owner: string, kind: 'playing' | 'loading') => number) = Number.POSITIVE_INFINITY) { this.developer = developer; this.hardBytes = hardBytes; }
40
40
 
41
41
  /** True for an in-envelope request or a Developer override. False means the caller retains its original refusal path. */