@wildshard/shard-format 0.37.1 → 0.38.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.37.1",
3
+ "version": "0.38.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": {
@@ -20,6 +20,7 @@
20
20
  "!src/format/*.test.ts",
21
21
  "!src/format/*.golden-specs.ts",
22
22
  "src/format/memoryGates.json",
23
+ "src/format/memory-armed.json",
23
24
  "src/format/seeded-rng.golden.json",
24
25
  "src/format/terrain-field.golden.json",
25
26
  "src/format/baked-terrain.golden.json",
@@ -205,6 +206,8 @@
205
206
  "./materialGraph": "./src/format/materialGraph.ts",
206
207
  "./materials": "./src/format/materials.ts",
207
208
  "./memoryAdmission": "./src/format/memoryAdmission.ts",
209
+ "./memory-armed": "./src/format/memory-armed.ts",
210
+ "./memory-armed.json": "./src/format/memory-armed.json",
208
211
  "./memoryGates.json": "./src/format/memoryGates.json",
209
212
  "./runtime-hosts.json": "./src/tools/runtime-hosts.json",
210
213
  "./meshCollision": "./src/format/meshCollision.ts",
@@ -0,0 +1,126 @@
1
+ import {
2
+ array,
3
+ check,
4
+ exactOptional,
5
+ finite,
6
+ lazy,
7
+ literal,
8
+ maxLength,
9
+ minLength,
10
+ number,
11
+ picklist,
12
+ pipe,
13
+ regex,
14
+ strictObject,
15
+ string,
16
+ } from 'valibot'
17
+
18
+ import type { GenericSchema } from 'valibot'
19
+
20
+ /** The two held families a weapon belongs to (OF38): a strike in reach, or a shot. */
21
+ const WEAPON_CLASSES = ['melee', 'ranged'] as const
22
+ type WeaponClass = (typeof WEAPON_CLASSES)[number]
23
+ /** At most this many memory states shield one creature. */
24
+ const MAX_SHIELDS = 16
25
+ const MAX_FIELD = 64
26
+ const MIN_ONE = 1
27
+
28
+ /** A memory state that shields the creature while its field holds this value (Nalati's `hidden` and `owned`). */
29
+ interface AttackShield {
30
+ field: string
31
+ equals: number
32
+ }
33
+ /**
34
+ * ONE-FORMAT OF38a (J420 (2), Jake 2026-11-18: *"creatures themselves should define whether they can be attacked or
35
+ * not"*). A species row says whether its creatures can be attacked, and by what, if a shard needs that: `false` is
36
+ * never; `by` names the weapon classes that may hit it (default both); `unless` names the creature-memory states that
37
+ * shield it. A row without it can be attacked by anything, as before. The held primitives read it; no weapon carries a
38
+ * target list (Nalati's `combat.targets` goes, OF38c).
39
+ */
40
+ type CreatureAttackable =
41
+ | false
42
+ | {
43
+ by?: WeaponClass[]
44
+ unless?: AttackShield[]
45
+ }
46
+ /** The declaration as `attackableBy` reads it. */
47
+ type AttackableReading =
48
+ | false
49
+ | {
50
+ readonly by?: readonly WeaponClass[]
51
+ readonly unless?: readonly Readonly<AttackShield>[]
52
+ }
53
+
54
+ function distinct(values: readonly unknown[]): boolean {
55
+ return new Set(values).size === values.length
56
+ }
57
+ function distinctFields(rows: readonly Readonly<AttackShield>[]): boolean {
58
+ return distinct(rows.map((row: Readonly<AttackShield>): string => row.field))
59
+ }
60
+
61
+ const fieldName = regex(/^[a-z][A-Za-z0-9]*$/u, 'Unknown attackable field')
62
+ const field = pipe(
63
+ string(),
64
+ minLength(MIN_ONE),
65
+ maxLength(MAX_FIELD),
66
+ fieldName,
67
+ )
68
+ const equals = pipe(number(), finite())
69
+ const shield = strictObject(
70
+ { field, equals },
71
+ 'Unknown attackable shield field',
72
+ )
73
+ const weaponClass = picklist(WEAPON_CLASSES, 'Unknown attackable weapon class')
74
+ const byClasses = pipe(
75
+ array(weaponClass),
76
+ minLength(MIN_ONE, 'Attackable by needs a weapon class'),
77
+ check<WeaponClass[], string>(
78
+ distinct,
79
+ 'Attackable by repeats a weapon class',
80
+ ),
81
+ )
82
+ const shields = pipe(
83
+ array(shield),
84
+ maxLength(MAX_SHIELDS),
85
+ check<AttackShield[], string>(
86
+ distinctFields,
87
+ 'Attackable unless repeats a field',
88
+ ),
89
+ )
90
+ const never: GenericSchema<false> = literal(
91
+ false,
92
+ 'Attackable true is the default; omit it',
93
+ )
94
+ const declared: GenericSchema<{ by?: WeaponClass[]; unless?: AttackShield[] }> =
95
+ strictObject(
96
+ { by: exactOptional(byClasses), unless: exactOptional(shields) },
97
+ 'Unknown attackable field',
98
+ )
99
+ /** `false`, or the object form; the input's own type picks which, so a refusal names the field at fault. */
100
+ const CreatureAttackableSchema: GenericSchema<CreatureAttackable> = lazy(
101
+ (input: unknown): GenericSchema<CreatureAttackable> =>
102
+ typeof input === 'boolean' ? never : declared,
103
+ )
104
+
105
+ /** Whether a weapon of this class may hit a creature of this declaration, given its memory. */
106
+ function attackableBy(
107
+ declaration: AttackableReading | undefined,
108
+ weapon: WeaponClass,
109
+ memory: Readonly<Record<string, unknown>> = {},
110
+ ): boolean {
111
+ if (declaration === undefined) {
112
+ return true
113
+ }
114
+ if (declaration === false) {
115
+ return false
116
+ }
117
+ if (declaration.by !== undefined && !declaration.by.includes(weapon)) {
118
+ return false
119
+ }
120
+ return !(declaration.unless ?? []).some(
121
+ (row: Readonly<AttackShield>): boolean => memory[row.field] === row.equals,
122
+ )
123
+ }
124
+
125
+ export type { AttackShield, AttackableReading, CreatureAttackable, WeaponClass }
126
+ export { CreatureAttackableSchema, WEAPON_CLASSES, attackableBy }
@@ -26,6 +26,7 @@ import { CreatureSkinClipNameSchema } from './skinData.ts'
26
26
  import { StrikeTellKindSchema } from './spawnCombat.ts'
27
27
  import { HuntTuningSchema } from './speciesPrograms.ts'
28
28
 
29
+ import type { CreatureAttackable } from './creature-attackable.ts'
29
30
  import type { CreatureBody } from './creature-body.ts'
30
31
  import type { CreatureMount } from './creature-mount.ts'
31
32
  import type { CreatureProjectile } from './creature-projectile.ts'
@@ -115,6 +116,8 @@ interface CreatureLayers {
115
116
  presentation?: CreaturePresentation
116
117
  /** CC40a: rideable by the riding primitive. */
117
118
  mount?: CreatureMount
119
+ /** OF38a: whether its creatures can be attacked, and by what (J420 (2)); absent, by anything. */
120
+ attackable?: CreatureAttackable
118
121
  }
119
122
 
120
123
  const ZERO = 0
@@ -289,4 +292,9 @@ export type {
289
292
 
290
293
  export { CreatureBodySchema } from './creature-body.ts'
291
294
  export { CreatureMountSchema, creatureMountRules } from './creature-mount.ts'
295
+ export {
296
+ CreatureAttackableSchema,
297
+ attackableBy,
298
+ } from './creature-attackable.ts'
299
+ export type { CreatureAttackable } from './creature-attackable.ts'
292
300
  export type { CreatureBody } from './creature-body.ts'
@@ -0,0 +1,25 @@
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`), kept as the record, not as the limit. Decimal bytes. Format memory-armed.ts reads this; engine reads @wildshard/format/src/format/memory-armed.json.",
3
+ "lines": {
4
+ "playingBytes": 1000000000,
5
+ "loadingBytes": 1500000000
6
+ },
7
+ "zones": {
8
+ "driftwood-isle": {
9
+ "armed": "2026-11-18",
10
+ "by": "mini-pinemem5",
11
+ "epoch": 8,
12
+ "playingBytes": 820905616,
13
+ "loadingBytes": 1157545785,
14
+ "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)"
15
+ },
16
+ "nalati-grasslands": {
17
+ "armed": "2026-11-18",
18
+ "by": "mini-pinemem5",
19
+ "epoch": 8,
20
+ "playingBytes": 945736154,
21
+ "loadingBytes": 1328901899,
22
+ "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)"
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,49 @@
1
+ import armed from './memory-armed.json' with { type: 'json' }
2
+
3
+ /**
4
+ * J426 (Jake, 2026-11-18, "get the shard passing the memory gate and then to LOCK THE GATE IN. And make it fail hard /
5
+ * mandatory") on J424 ("the gates should only block once an agent has done the work to get it under the gate"): the
6
+ * one armed-zone list, `memory-armed.json`. Every memory gate refuses an armed zone over its line, whatever the policy
7
+ * or the report-only switch; it reports every other zone. Engine's guards read the same JSON.
8
+ */
9
+ interface ArmedZone {
10
+ readonly armed: string
11
+ readonly by: string
12
+ readonly epoch: number
13
+ readonly playingBytes: number
14
+ readonly loadingBytes: number
15
+ readonly evidence: string
16
+ }
17
+
18
+ type ArmedKind = 'playing' | 'loading'
19
+
20
+ const ARMED_LINES: Readonly<Record<ArmedKind, number>> = Object.freeze({
21
+ playing: armed.lines.playingBytes,
22
+ loading: armed.lines.loadingBytes,
23
+ })
24
+
25
+ const ARMED_ZONES: Readonly<Record<string, ArmedZone>> = Object.freeze(
26
+ armed.zones,
27
+ )
28
+
29
+ /** True when `slug` is in the armed list (J426). */
30
+ function zoneArmed(slug?: string): boolean {
31
+ return slug !== undefined && Object.hasOwn(ARMED_ZONES, slug)
32
+ }
33
+
34
+ /** The J410 line an armed zone's offline estimate refuses over, or undefined for a zone that only reports. */
35
+ function armedLine(
36
+ slug: string | undefined,
37
+ kind: ArmedKind,
38
+ ): number | undefined {
39
+ return zoneArmed(slug) ? ARMED_LINES[kind] : undefined
40
+ }
41
+
42
+ export {
43
+ ARMED_LINES,
44
+ ARMED_ZONES,
45
+ type ArmedKind,
46
+ type ArmedZone,
47
+ armedLine,
48
+ zoneArmed,
49
+ }
@@ -38,9 +38,9 @@ function staleRuntimeCost(
38
38
  return `native resident measurement is stale: memory epoch ${String(epoch)}, current ${String(current)} (J408): re-measure the runtime home`
39
39
  }
40
40
 
41
- /** A refusal, whatever the policy, for a runtime home's reading and for its images-first reading, each stale against
42
- * `current`. Takes the shard's `runtime` (null for a data-only shard). J412: a report instead for exactly the pinned
43
- * revision the ratchet names (`memory-ratchet.ts` `staleRevision`), given its `identity`. */
41
+ /** A refusal, whatever the policy, for an armed runtime home's reading and for its images-first reading, each stale against
42
+ * `current`. Takes the shard's `runtime` (null for a data-only shard). J424 / J426: a refusal only for an armed zone
43
+ * (`memory-armed.ts`), given its `identity`; every other shard reports. */
44
44
  function staleRuntimeIssues(
45
45
  runtime: Readonly<{ cost?: EpochRow | undefined }> | null,
46
46
  current: number = OLDEST_CURRENT_EPOCH,
@@ -59,7 +59,7 @@ function staleRuntimeIssues(
59
59
  .filter((row: EpochRow): boolean => staleRuntimeCost(row, current) !== '')
60
60
  .map((row: EpochRow): StaleRuntimeIssue => ({
61
61
  code: 'perf-native-resident-unmeasured',
62
- metric: `${staleRuntimeCost(row, current)}${admitted ? ' (report-only, J412 ratchet: the pinned revision)' : ''}`,
62
+ metric: `${staleRuntimeCost(row, current)}${admitted ? ' (report-only, J424: the zone is not armed)' : ''}`,
63
63
  actual: row.epoch ?? LEGACY_EPOCH,
64
64
  limit: current,
65
65
  severity: admitted ? 'warning' : 'refusal',
@@ -2,6 +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 { armedLine } from './memory-armed.ts'
5
6
  import { ratchetNote, ratchetSeverity } from './memory-ratchet.ts'
6
7
  import { runtimeAccountedBytes, RuntimeCostSchema } from './runtimeCost.ts'
7
8
 
@@ -24,12 +25,12 @@ function overHardLine(bytes: number): string {
24
25
  return ` (over the ${(MEMORY_HARD_BYTES / GB).toFixed(DIGITS)} GB phone line, J408: a phone would close the page)`
25
26
  }
26
27
 
27
- /** J408 (MG4): the issue for a worst-playing or loading estimate over the hard line. J412: a refusal only over the
28
- * zone's ratchet baseline (`memory-ratchet.ts`); at or under it, a report. */
28
+ /** J408 (MG4): the issue for a worst-playing or loading estimate over the hard line, or over `zone.line`. J424 /
29
+ * J426: a refusal only for an armed zone (`memory-armed.ts`); every other zone reports. */
29
30
  function hardLineIssue(
30
31
  kind: 'playing' | 'loading',
31
32
  bytes: number,
32
- slug?: string,
33
+ zone?: string | Readonly<{ slug: string; line: number }>,
33
34
  ): {
34
35
  readonly code: 'perf-playing-memory' | 'perf-loading-memory'
35
36
  readonly metric: string
@@ -37,15 +38,18 @@ function hardLineIssue(
37
38
  readonly limit: number
38
39
  readonly severity: 'refusal' | 'warning'
39
40
  } {
40
- const severity = ratchetSeverity(slug, kind, {
41
- line: MEMORY_HARD_BYTES,
42
- actual: bytes,
43
- })
41
+ const { slug, line } =
42
+ typeof zone === 'object' ? zone : { slug: zone, line: MEMORY_HARD_BYTES }
43
+ const severity = ratchetSeverity(slug, kind, { line, actual: bytes })
44
+ const over =
45
+ line === MEMORY_HARD_BYTES
46
+ ? overHardLine(bytes)
47
+ : ` (over the ${(line / GB).toFixed(DIGITS)} GB ${kind} line, J410; ${slug ?? ''} is armed, J426)`
44
48
  return {
45
49
  code: `perf-${kind}-memory`,
46
- metric: `worst ${kind} total bytes${overHardLine(bytes)}${severity === 'warning' ? ratchetNote(slug, kind) : ''}`,
50
+ metric: `worst ${kind} total bytes${over}${severity === 'warning' ? ratchetNote(slug, kind) : ''}`,
47
51
  actual: bytes,
48
- limit: MEMORY_HARD_BYTES,
52
+ limit: line,
49
53
  severity,
50
54
  }
51
55
  }
@@ -108,10 +112,14 @@ function offlineMemoryIssues(
108
112
  commons: runtime + commons,
109
113
  boot: bootMemoryCosts(source, sections, { mountedImages, index }),
110
114
  })
115
+ // J426: an armed zone's calibrated estimate answers to the J410 lines; every other zone's reports over J408's.
116
+ const { slug } = source.identity
117
+ const line = (kind: 'playing' | 'loading'): number =>
118
+ armedLine(slug, kind) ?? MEMORY_HARD_BYTES
111
119
  return (['playing', 'loading'] as const)
112
- .filter((kind): boolean => cost[kind] > MEMORY_HARD_BYTES)
120
+ .filter((kind): boolean => cost[kind] > line(kind))
113
121
  .map((kind): ReturnType<typeof hardLineIssue> =>
114
- hardLineIssue(kind, cost[kind], source.identity.slug),
122
+ hardLineIssue(kind, cost[kind], { slug, line: line(kind) }),
115
123
  )
116
124
  }
117
125
 
@@ -1,3 +1,5 @@
1
+ import { zoneArmed } from './memory-armed.ts'
2
+
1
3
  /**
2
4
  * J411 / J412 (Jake, 2026-11-18): memory gates are ratchets. "With these new gates we should definitely be landing
3
5
  * improvements even if they don't meet the new high standards." The J408 phone line (1.5 GB playing and loading), the
@@ -9,7 +11,8 @@
9
11
  * source's, in decimal bytes. Nine's and Pine's loading rows are engine's full-check performance report of the pinned
10
12
  * product (the offline estimate reads 1,667 and 1,697 MB); Pine's playing row is its declared admission. A cut ratchets
11
13
  * the row down; a zone
12
- * that passes a line loses that field, and the line refuses again. `staleRevision` is the pinned product's
14
+ * that passes a line loses that field. J424 / J426 (2026-11-18): the baselines only report now; a zone refuses only once
15
+ * it is armed (`memory-armed.ts`), and then over the line itself. `staleRevision` is the pinned product's
13
16
  * `identity.revision`: it admits that revision's pre-epoch-3 runtime reading; any later revision must carry a current one.
14
17
  */
15
18
  interface MemoryBaseline {
@@ -48,21 +51,17 @@ const RATCHET_ALLOWANCE = 0.005
48
51
 
49
52
  type RatchetMetric = 'playing' | 'loading' | 'runtime'
50
53
 
51
- /** The bytes over which `slug` refuses on `metric`: the line, or its baseline plus the allowance when that is higher. */
54
+ /** The bytes over which `slug` refuses on `metric`. J426 (on J424): an armed zone (`memory-armed.json`) refuses over
55
+ * `line`; every other zone reports only, so its limit is unbounded. The baselines above are kept for the report. */
52
56
  function ratchetLimit(
53
57
  slug: string | undefined,
54
- metric: RatchetMetric,
58
+ _metric: RatchetMetric,
55
59
  line: number,
56
60
  ): number {
57
- const baseline =
58
- slug === undefined ? undefined : MEMORY_RATCHET[slug]?.[metric]
59
- if (baseline === undefined) {
60
- return line
61
- }
62
- return Math.max(line, baseline + Math.floor(baseline * RATCHET_ALLOWANCE))
61
+ return zoneArmed(slug) ? line : Number.POSITIVE_INFINITY
63
62
  }
64
63
 
65
- /** 'refusal' over the ratchet, 'warning' over the line but within the zone's baseline. */
64
+ /** 'refusal' for an armed zone over the line, 'warning' for every other reading over it. */
66
65
  function ratchetSeverity(
67
66
  slug: string | undefined,
68
67
  metric: RatchetMetric,
@@ -73,25 +72,25 @@ function ratchetSeverity(
73
72
  : 'warning'
74
73
  }
75
74
 
76
- /** The words a reported (not refused) issue carries. */
75
+ /** The words a reported (not refused) issue carries: why it only reports, and the zone's J412 baseline if it has one. */
77
76
  function ratchetNote(slug: string | undefined, metric: RatchetMetric): string {
77
+ if (zoneArmed(slug)) {
78
+ return ''
79
+ }
78
80
  const baseline =
79
81
  slug === undefined ? undefined : MEMORY_RATCHET[slug]?.[metric]
82
+ const zone = slug ?? 'this shard'
80
83
  return baseline === undefined
81
- ? ''
82
- : ` (report-only, J412 ratchet: ${slug ?? ''} baseline ${String(baseline)})`
84
+ ? ` (report-only, J424: ${zone} is not armed)`
85
+ : ` (report-only, J424: ${zone} is not armed; J412 baseline ${String(baseline)})`
83
86
  }
84
87
 
85
- /** True when `revision` of `slug` is the pinned product whose stale reading the ratchet admits. */
88
+ /** True when a stale runtime reading only reports: J424, every zone not armed (J426). */
86
89
  function staleReadingAdmitted(
87
90
  slug: string | undefined,
88
- revision: number | undefined,
91
+ _revision: number | undefined,
89
92
  ): boolean {
90
- return (
91
- slug !== undefined &&
92
- revision !== undefined &&
93
- MEMORY_RATCHET[slug]?.staleRevision === revision
94
- )
93
+ return !zoneArmed(slug)
95
94
  }
96
95
 
97
96
  export {
@@ -0,0 +1,220 @@
1
+ /**
2
+ * ONE-FORMAT OF17a's primitive table: each family from meta `docs/plans/one-format/HOSTS.md` (approved, J420), the
3
+ * hosts it replaces and what switches it on. `primitives.ts` derives a product's list from it.
4
+ */
5
+ interface PrimitiveSwitch {
6
+ readonly section: string
7
+ readonly path: readonly string[]
8
+ /** When set, the family is on only if some row of the list at `path` has this key. */
9
+ readonly having?: string
10
+ /** With `having`: only a row whose `having` key holds this value counts. */
11
+ readonly equals?: string
12
+ /** Only a row without this key counts. */
13
+ readonly lacking?: string
14
+ }
15
+ interface Primitive {
16
+ readonly name: string
17
+ /** The ONE-FORMAT row that builds it. */
18
+ readonly row: string
19
+ /** The server hosts and page features it replaces (HOSTS.md). A host split across two families sits in the first. */
20
+ readonly hosts: readonly string[]
21
+ readonly on: PrimitiveSwitch | readonly PrimitiveSwitch[] | 'always' | 'later'
22
+ }
23
+ const TABLE: readonly Primitive[] = [
24
+ {
25
+ name: 'collision',
26
+ row: 'OF41',
27
+ on: 'always',
28
+ hosts: ['collision', 'collision.pieces'],
29
+ },
30
+ {
31
+ name: 'plumbing',
32
+ row: 'OF18',
33
+ on: 'always',
34
+ hosts: [
35
+ 'commands',
36
+ 'decisions',
37
+ 'engine.creatures.update',
38
+ 'strings.register',
39
+ 'content.catalogue',
40
+ 'debug.expose',
41
+ 'audio.cues',
42
+ 'audio.scene',
43
+ 'player.enter',
44
+ 'bag.finds',
45
+ 'state.adventure',
46
+ ],
47
+ },
48
+ {
49
+ name: 'population',
50
+ row: 'OF29',
51
+ on: { section: 'actors/creatures', path: ['creatures', 'spawns'] },
52
+ hosts: [
53
+ 'population.roster',
54
+ 'population.spawn-script',
55
+ 'population.shelter',
56
+ 'population.environment',
57
+ 'population.mixed',
58
+ 'population.poses',
59
+ 'population.reactions',
60
+ 'population.settle',
61
+ 'population.homes',
62
+ 'population.wildlife',
63
+ ],
64
+ },
65
+ {
66
+ name: 'elites',
67
+ row: 'OF33',
68
+ on: [
69
+ {
70
+ section: 'actors/creatures',
71
+ path: ['creatures', 'spawns'],
72
+ having: 'rank',
73
+ },
74
+ {
75
+ section: 'combat/encounters',
76
+ path: ['encounters'],
77
+ having: 'kind',
78
+ equals: 'elite',
79
+ },
80
+ ],
81
+ hosts: [
82
+ 'population.elites',
83
+ 'population.elites-ready',
84
+ 'riding.elites',
85
+ 'riding.elites-ready',
86
+ 'elite.entry',
87
+ 'elite.construct',
88
+ ],
89
+ },
90
+ {
91
+ name: 'boss',
92
+ row: 'OF34',
93
+ on: [
94
+ {
95
+ section: 'combat/encounters',
96
+ path: ['encounters'],
97
+ having: 'kind',
98
+ equals: 'boss',
99
+ },
100
+ { section: 'actors/spawns', path: ['runtime', 'spawns', 'bosses'] },
101
+ ],
102
+ hosts: ['boss.ground', 'boss.spawned', 'boss.held'],
103
+ },
104
+ {
105
+ name: 'boss.arena',
106
+ row: 'OF34',
107
+ on: 'later',
108
+ hosts: ['boss.arena', 'boss.open-arena'],
109
+ },
110
+ {
111
+ name: 'riding',
112
+ row: 'CC40',
113
+ on: {
114
+ section: 'actors/species',
115
+ path: ['rows', 'species'],
116
+ having: 'mount',
117
+ },
118
+ hosts: [
119
+ 'riding.mounted',
120
+ 'riding.roster',
121
+ 'riding.groups',
122
+ 'riding.hunt',
123
+ 'riding.trample',
124
+ 'riding.environment',
125
+ 'riding.taming',
126
+ 'riding.session',
127
+ 'taming.entry',
128
+ ],
129
+ },
130
+ {
131
+ name: 'patrol',
132
+ row: 'OF37',
133
+ on: 'later',
134
+ hosts: ['encounter.patrol', 'timed.encounters'],
135
+ },
136
+ {
137
+ name: 'held.melee',
138
+ row: 'OF38',
139
+ on: {
140
+ section: 'combat/items',
141
+ path: ['items', 'rows'],
142
+ having: 'kind',
143
+ equals: 'weapon',
144
+ lacking: 'ranged',
145
+ },
146
+ hosts: [
147
+ 'item.swept',
148
+ 'held.melee',
149
+ 'held.arms',
150
+ 'held.claims',
151
+ 'held.cosmetics',
152
+ ],
153
+ },
154
+ {
155
+ name: 'held.ranged',
156
+ row: 'OF38',
157
+ on: { section: 'combat/items', path: ['items', 'rows'], having: 'ranged' },
158
+ hosts: [
159
+ 'item.ranged',
160
+ 'combat.motion',
161
+ 'ammunition',
162
+ 'loadout',
163
+ 'held.ranged-feel',
164
+ 'held.ranged-page',
165
+ 'combat.targets',
166
+ ],
167
+ },
168
+ {
169
+ name: 'sky',
170
+ row: 'OF41',
171
+ on: { section: 'world/days', path: ['rows', 'days'] },
172
+ hosts: ['day.toon', 'day.keyed-sky', 'day.declared'],
173
+ },
174
+ {
175
+ name: 'weather',
176
+ row: 'OF41',
177
+ on: { section: 'world/weather', path: ['rows', 'weather'] },
178
+ hosts: [
179
+ 'weather.program',
180
+ 'weather.native',
181
+ 'weather.forest',
182
+ 'weather.fields',
183
+ ],
184
+ },
185
+ {
186
+ name: 'water.sea',
187
+ row: 'OF40',
188
+ on: {
189
+ section: 'world/water',
190
+ path: ['water'],
191
+ having: 'kind',
192
+ equals: 'sea',
193
+ },
194
+ hosts: ['water.sea', 'world.water'],
195
+ },
196
+ { name: 'water.field', row: 'OF40', on: 'later', hosts: ['water.field'] },
197
+ {
198
+ name: 'grapple',
199
+ row: 'OF41',
200
+ on: { section: 'state/modes', path: ['modes', 'grapple'] },
201
+ hosts: ['grapple'],
202
+ },
203
+ {
204
+ name: 'portal',
205
+ row: 'OF41',
206
+ on: {
207
+ section: 'world/edge',
208
+ path: ['entryways'],
209
+ having: 'kind',
210
+ equals: 'portalLink',
211
+ },
212
+ hosts: ['portal.ride'],
213
+ },
214
+ ]
215
+ const PRIMITIVES: readonly Primitive[] = Object.freeze(
216
+ TABLE.map((row): Primitive => Object.freeze(row)),
217
+ )
218
+
219
+ export type { Primitive, PrimitiveSwitch }
220
+ export { PRIMITIVES }
@@ -1,31 +1,21 @@
1
+ import { PRIMITIVES } from './primitive-table.ts'
1
2
  import { ACCEPTED_SECTION_VERSIONS, FIRST_VERSION } from './section-versions.ts'
2
3
 
4
+ import type { Primitive, PrimitiveSwitch } from './primitive-table.ts'
5
+
3
6
  /**
4
7
  * ONE-FORMAT OF17a (J365 (6), J367 (5), Q-T22 option (b), Q-T27 (a)): no host list ships. A section switches a primitive
5
8
  * on, and the server works out the list from the product's sections. The families and their hosts are the verdict
6
- * table, meta `docs/plans/one-format/HOSTS.md` (OF16a), pending Jake's corrections (OF16b).
9
+ * table, meta `docs/plans/one-format/HOSTS.md` (OF16a), approved by Jake (OF16b, J420).
7
10
  *
8
- * `on` says what turns a family on: `always` (every product has it), a section path whose value is a non-empty array or
9
- * object, or `later` while its row (`row`) has not given it a section yet. A family's version is its section's `@N`
10
- * (`ACCEPTED_SECTION_VERSIONS`): changes are additive, and a removal follows SHARD-COMPAT's rollout.
11
+ * `on` says what turns a family on: `always` (every product has it), one or more section paths whose value is a non-empty
12
+ * array or object (the first that matches names the section), or `later` while its row (`row`) has not given it a section
13
+ * yet. OF17d: a family a shard already declares in an existing section switches on from it. A family's version is its
14
+ * section's `@N` (`ACCEPTED_SECTION_VERSIONS`): changes are additive, and a removal follows SHARD-COMPAT's rollout.
11
15
  */
12
16
  /** An empty array or object switches nothing on. */
13
17
  const NONE = 0
14
18
 
15
- interface PrimitiveSwitch {
16
- readonly section: string
17
- readonly path: readonly string[]
18
- /** When set, the family is on only if some row of the list at `path` has this key. */
19
- readonly having?: string
20
- }
21
- interface Primitive {
22
- readonly name: string
23
- /** The ONE-FORMAT row that builds it. */
24
- readonly row: string
25
- /** The server hosts and page features it replaces (HOSTS.md). A host split across two families sits in the first. */
26
- readonly hosts: readonly string[]
27
- readonly on: PrimitiveSwitch | 'always' | 'later'
28
- }
29
19
  /** One family the server switched on, at the version of the section that switched it; no `section` for `always`. */
30
20
  interface DerivedPrimitive {
31
21
  readonly name: string
@@ -33,156 +23,6 @@ interface DerivedPrimitive {
33
23
  readonly version: number
34
24
  }
35
25
 
36
- const TABLE: readonly Primitive[] = [
37
- {
38
- name: 'collision',
39
- row: 'OF41',
40
- on: 'always',
41
- hosts: ['collision', 'collision.pieces'],
42
- },
43
- {
44
- name: 'plumbing',
45
- row: 'OF18',
46
- on: 'always',
47
- hosts: [
48
- 'commands',
49
- 'decisions',
50
- 'engine.creatures.update',
51
- 'strings.register',
52
- 'content.catalogue',
53
- 'debug.expose',
54
- 'audio.cues',
55
- 'audio.scene',
56
- 'player.enter',
57
- 'bag.finds',
58
- 'state.adventure',
59
- ],
60
- },
61
- {
62
- name: 'population',
63
- row: 'OF29',
64
- on: 'later',
65
- hosts: [
66
- 'population.roster',
67
- 'population.spawn-script',
68
- 'population.shelter',
69
- 'population.environment',
70
- 'population.mixed',
71
- 'population.poses',
72
- 'population.reactions',
73
- 'population.settle',
74
- 'population.homes',
75
- 'population.wildlife',
76
- ],
77
- },
78
- {
79
- name: 'elites',
80
- row: 'OF33',
81
- on: 'later',
82
- hosts: [
83
- 'population.elites',
84
- 'population.elites-ready',
85
- 'riding.elites',
86
- 'riding.elites-ready',
87
- 'elite.entry',
88
- 'elite.construct',
89
- ],
90
- },
91
- {
92
- name: 'boss',
93
- row: 'OF34',
94
- on: 'later',
95
- hosts: ['boss.ground', 'boss.spawned', 'boss.held'],
96
- },
97
- {
98
- name: 'boss.arena',
99
- row: 'OF34',
100
- on: 'later',
101
- hosts: ['boss.arena', 'boss.open-arena'],
102
- },
103
- {
104
- name: 'riding',
105
- row: 'CC40',
106
- on: {
107
- section: 'actors/species',
108
- path: ['rows', 'species'],
109
- having: 'mount',
110
- },
111
- hosts: [
112
- 'riding.mounted',
113
- 'riding.roster',
114
- 'riding.groups',
115
- 'riding.hunt',
116
- 'riding.trample',
117
- 'riding.environment',
118
- 'riding.taming',
119
- 'riding.session',
120
- 'taming.entry',
121
- ],
122
- },
123
- {
124
- name: 'patrol',
125
- row: 'OF37',
126
- on: 'later',
127
- hosts: ['encounter.patrol', 'timed.encounters'],
128
- },
129
- {
130
- name: 'held.melee',
131
- row: 'OF38',
132
- on: 'later',
133
- hosts: [
134
- 'item.swept',
135
- 'held.melee',
136
- 'held.arms',
137
- 'held.claims',
138
- 'held.cosmetics',
139
- ],
140
- },
141
- {
142
- name: 'held.ranged',
143
- row: 'OF38',
144
- on: 'later',
145
- hosts: [
146
- 'item.ranged',
147
- 'combat.motion',
148
- 'ammunition',
149
- 'loadout',
150
- 'held.ranged-feel',
151
- 'held.ranged-page',
152
- 'combat.targets',
153
- ],
154
- },
155
- {
156
- name: 'sky',
157
- row: 'OF41',
158
- on: { section: 'world/days', path: ['rows', 'days'] },
159
- hosts: ['day.toon', 'day.keyed-sky', 'day.declared'],
160
- },
161
- {
162
- name: 'weather',
163
- row: 'OF41',
164
- on: { section: 'world/weather', path: ['rows', 'weather'] },
165
- hosts: [
166
- 'weather.program',
167
- 'weather.native',
168
- 'weather.forest',
169
- 'weather.fields',
170
- ],
171
- },
172
- {
173
- name: 'water.sea',
174
- row: 'OF40',
175
- on: 'later',
176
- hosts: ['water.sea', 'world.water'],
177
- },
178
- { name: 'water.field', row: 'OF40', on: 'later', hosts: ['water.field'] },
179
- { name: 'grapple', row: 'OF41', on: 'later', hosts: ['grapple'] },
180
- { name: 'portal', row: 'OF41', on: 'later', hosts: ['portal.ride'] },
181
- ]
182
- const PRIMITIVES: readonly Primitive[] = Object.freeze(
183
- TABLE.map((row): Primitive => Object.freeze(row)),
184
- )
185
-
186
26
  /** Hosts HOSTS.md leaves out of the primitives: quest (Q-S5), opened as it is; Nalati's stealth entry (Q-S4). */
187
27
  const OUT_OF_SCOPE_HOSTS: readonly string[] = Object.freeze([
188
28
  'quest.body-scripts',
@@ -224,18 +64,41 @@ function filled(value: unknown): boolean {
224
64
  Object.keys(value).length > NONE
225
65
  )
226
66
  }
227
- function switchedOn(value: unknown, having: string | undefined): boolean {
67
+ function rowCounts(row: unknown, rule: PrimitiveSwitch): boolean {
68
+ if (typeof row !== 'object' || row === null) {
69
+ return false
70
+ }
71
+ const { having, equals, lacking } = rule
72
+ if (lacking !== undefined && Object.hasOwn(row, lacking)) {
73
+ return false
74
+ }
228
75
  if (having === undefined) {
76
+ return true
77
+ }
78
+ if (!Object.hasOwn(row, having)) {
79
+ return false
80
+ }
81
+ return (
82
+ equals === undefined ||
83
+ Object.getOwnPropertyDescriptor(row, having)?.value === equals
84
+ )
85
+ }
86
+ function switchedOn(value: unknown, rule: PrimitiveSwitch): boolean {
87
+ if (rule.having === undefined && rule.lacking === undefined) {
229
88
  return filled(value)
230
89
  }
231
90
  return (
232
91
  Array.isArray(value) &&
233
- value.some(
234
- (row: unknown): boolean =>
235
- typeof row === 'object' && row !== null && Object.hasOwn(row, having),
236
- )
92
+ value.some((row: unknown): boolean => rowCounts(row, rule))
237
93
  )
238
94
  }
95
+ /** A family's switches, as a list. */
96
+ function switchesOf(on: Primitive['on']): readonly PrimitiveSwitch[] {
97
+ if (on === 'always' || on === 'later') {
98
+ return []
99
+ }
100
+ return 'section' in on ? [on] : on
101
+ }
239
102
  function newest(section: string): number {
240
103
  return Math.max(...(ACCEPTED_SECTION_VERSIONS[section] ?? [FIRST_VERSION]))
241
104
  }
@@ -253,13 +116,13 @@ function derivePrimitives(
253
116
  if (row.on === 'always') {
254
117
  return [{ name: row.name, version: FIRST_VERSION }]
255
118
  }
256
- if (
257
- row.on === 'later' ||
258
- !switchedOn(at(sections.get(row.on.section), row.on.path), row.on.having)
259
- ) {
119
+ const hit = switchesOf(row.on).find((rule: PrimitiveSwitch): boolean =>
120
+ switchedOn(at(sections.get(rule.section), rule.path), rule),
121
+ )
122
+ if (hit === undefined) {
260
123
  return []
261
124
  }
262
- const { section } = row.on
125
+ const { section } = hit
263
126
  return [
264
127
  {
265
128
  name: row.name,
@@ -270,5 +133,7 @@ function derivePrimitives(
270
133
  })
271
134
  }
272
135
 
273
- export type { DerivedPrimitive, Primitive, PrimitiveSwitch }
274
- export { OUT_OF_SCOPE_HOSTS, PRIMITIVES, derivePrimitives, primitiveOfHost }
136
+ export type { DerivedPrimitive }
137
+ export type { Primitive, PrimitiveSwitch } from './primitive-table.ts'
138
+ export { PRIMITIVES } from './primitive-table.ts'
139
+ export { OUT_OF_SCOPE_HOSTS, derivePrimitives, primitiveOfHost, switchesOf }
@@ -7,7 +7,7 @@ import * as v from 'valibot';
7
7
  import { isJsonData } from './json.ts';
8
8
  import { sketchReference } from './sketch.ts';
9
9
  import { JournalRowSchema, journalRowRules } from './compendiumRows.ts';
10
- import { CreatureMountSchema, creatureMountRules, CreatureTypeSchema, CreatureBodySchema, CreatureTemperamentSchema, CreatureSensesSchema, CreatureAbilitySchema, CreaturePresentationSchema } from './creature-layers.ts';
10
+ import { CreatureAttackableSchema, CreatureMountSchema, creatureMountRules, CreatureTypeSchema, CreatureBodySchema, CreatureTemperamentSchema, CreatureSensesSchema, CreatureAbilitySchema, CreaturePresentationSchema } from './creature-layers.ts';
11
11
  import type { CreatureAbilityInput, CreatureLayers } from './creature-layers.ts';
12
12
  import { creatureSizeRules } from './creature-sizes.ts';
13
13
  import { SKIN_CLIPS_RECIPE, SkinClipMapSchema } from './skins.ts';
@@ -52,7 +52,8 @@ const species = v.strictObject({ id, kind: id, label: text, capExempt: v.exactOp
52
52
  variants: v.pipe(v.array(variant), v.minLength(1), v.maxLength(64)),
53
53
  type: v.exactOptional(CreatureTypeSchema), body: v.exactOptional(CreatureBodySchema),
54
54
  temperament: v.exactOptional(CreatureTemperamentSchema), senses: v.exactOptional(CreatureSensesSchema),
55
- abilities: v.exactOptional(abilities), presentation: v.exactOptional(CreaturePresentationSchema), mount: v.exactOptional(CreatureMountSchema) });
55
+ abilities: v.exactOptional(abilities), presentation: v.exactOptional(CreaturePresentationSchema), mount: v.exactOptional(CreatureMountSchema),
56
+ attackable: v.exactOptional(CreatureAttackableSchema) });
56
57
  const parameter = v.union([finite, v.boolean(), text, v.pipe(v.array(finite), v.maxLength(16))]);
57
58
  const animationParameters = v.record(id, parameter);
58
59
  const lookAnimation = v.strictObject({
@@ -376,6 +376,6 @@ export function performanceReportLines(report: PerformanceReport): string[] {
376
376
 
377
377
  /** Offline soft-cap policy and the fixed J408 line for playing and loading. */
378
378
  export function offlineMemoryAdmission(policy: 'warn' | 'refuse'): MemoryAdmission {
379
- // J412: the line holds each zone at its ratchet baseline when that is higher (`memory-ratchet.ts`).
379
+ // J424 / J426: the J408 line refuses only an armed zone (`memory-armed.ts`); every other zone reports.
380
380
  return new MemoryAdmission(() => policy === 'warn' || MEMORY_GATES.reportOnly, (owner, kind): number => ratchetLimit(owner, kind, MEMORY_HARD_BYTES));
381
381
  }
@@ -41,6 +41,7 @@ function skinLookParameters(
41
41
  ...(look.output.variants === undefined
42
42
  ? {}
43
43
  : { variants: look.output.variants }),
44
+ ...(look.output.phone === undefined ? {} : { phone: look.output.phone }),
44
45
  }
45
46
  }
46
47
 
@@ -20,6 +20,8 @@ interface ResolvedSkinFile {
20
20
  interface SkinLookFiles {
21
21
  readonly skin: ResolvedSkinFile
22
22
  readonly variants?: ReadonlyMap<string, ResolvedSkinFile>
23
+ /** The phone tier's lighter mesh (ONE-FORMAT CC51b): the same contract as `skin`, at most its triangles. */
24
+ readonly phone?: ResolvedSkinFile
23
25
  }
24
26
  type Source = Pick<Shardfile, 'rows' | 'files'>
25
27
  type Look = ShardRows['looks'][number]
@@ -166,6 +168,33 @@ function resolveVariants(
166
168
  return variants
167
169
  }
168
170
 
171
+ function phoneLook(
172
+ skin: ResolvedSkinFile,
173
+ {
174
+ phone: hash,
175
+ look,
176
+ read,
177
+ variants,
178
+ }: {
179
+ phone: string
180
+ look: Look
181
+ read: (hash: string) => ResolvedSkinFile
182
+ variants: string | undefined
183
+ },
184
+ ): SkinLookFiles {
185
+ if (variants !== undefined) {
186
+ throw new Error(`skin look ${look.id}: a variant look has no phone skin`)
187
+ }
188
+ const phone = read(hash)
189
+ if (skinContract(phone) !== skinContract(skin)) {
190
+ throw new Error(`skin look ${look.id}: phone skin rig or material differs`)
191
+ }
192
+ if (phone.row.cost.triangles > skin.row.cost.triangles) {
193
+ throw new Error(`skin look ${look.id}: phone skin draws more triangles`)
194
+ }
195
+ return { skin, phone }
196
+ }
197
+
169
198
  /** Resolve exact variant coverage and compatible rig/material declarations once at admission/load. */
170
199
  function resolveSkinLookFiles(
171
200
  source: Source,
@@ -175,6 +204,14 @@ function resolveSkinLookFiles(
175
204
  const parameters = skinLookParameters(look)
176
205
  const read = skinReader(source, assets)
177
206
  const skin = read(parameters.skin)
207
+ if (parameters.phone !== undefined) {
208
+ return phoneLook(skin, {
209
+ phone: parameters.phone,
210
+ look,
211
+ read,
212
+ variants: parameters.variants,
213
+ })
214
+ }
178
215
  if (parameters.variants === undefined) {
179
216
  return { skin }
180
217
  }
@@ -186,5 +223,14 @@ function resolveSkinLookFiles(
186
223
  return { skin, variants }
187
224
  }
188
225
 
189
- export { resolveSkinLookFiles }
226
+ /** Every skin file a look draws: its skin, each variant's and the phone tier's. */
227
+ function lookSkins(resolved: SkinLookFiles): ResolvedSkinFile[] {
228
+ return [
229
+ resolved.skin,
230
+ ...(resolved.variants?.values() ?? []),
231
+ ...(resolved.phone === undefined ? [] : [resolved.phone]),
232
+ ]
233
+ }
234
+
235
+ export { lookSkins, resolveSkinLookFiles }
190
236
  export type { ResolvedSkinFile, SkinLookFiles }
@@ -21,18 +21,25 @@ import { SkinGlbMaterialsSchema, SkinPrimitiveSchema, skinMaterialsFault, skinPa
21
21
 
22
22
  import { SKIN_LOOK_RECIPE, SKIN_CLIPS_RECIPE } from './skins.ts';
23
23
  import type { SkinLookParameters } from './skins.ts';
24
- import { resolveSkinLookFiles } from './skin-variants.ts';
24
+ import { lookSkins, resolveSkinLookFiles } from './skin-variants.ts';
25
25
  import { skinLookParameters } from './skin-file.ts';
26
26
 
27
+ /** An optional look reference names a library `json` file. */
28
+ function libraryJson(library: readonly string[], kinds: ReadonlyMap<string, string>, hash: string | undefined): boolean {
29
+ return hash === undefined || kinds.get(hash) === 'json' && library.includes(hash);
30
+ }
31
+
27
32
  /** Shardfile reference rules for skin looks: a library `json` file whose dependencies are exactly its row's `glb`. */
28
33
  function skinLookRules(source: Pick<Shardfile, 'rows' | 'files' | 'library'>): string[] {
29
34
  const errors: string[] = [], files = new Map(source.files.map((file) => [file.hash, file]));
35
+ const kinds = new Map<string, string>(); for (const file of source.files) {kinds.set(file.hash, file.kind);}
30
36
  for (const row of source.rows.looks) {
31
37
  if (row.recipe !== SKIN_LOOK_RECIPE) { if (row.animation.recipe === SKIN_CLIPS_RECIPE) {errors.push('skin clips without a skin look');} continue; }
32
38
  let parameters: SkinLookParameters; try { parameters = skinLookParameters(row); } catch { errors.push('skin look parameters'); continue; }
33
- const { skin, variants } = parameters, file = files.get(skin), glb = file?.dependencies.length === 1 ? files.get(file.dependencies[0] ?? '') : undefined;
39
+ const { skin, variants, phone } = parameters, file = files.get(skin), glb = file?.dependencies.length === 1 ? files.get(file.dependencies[0] ?? '') : undefined;
34
40
  if (file?.kind !== 'json' || glb?.kind !== 'glb' || !source.library.includes(skin)) {errors.push('skin look file references');}
35
- if (variants !== undefined && (files.get(variants)?.kind !== 'json' || !source.library.includes(variants))) {errors.push('skin variant table references');}
41
+ if (!libraryJson(source.library, kinds, variants)) {errors.push('skin variant table references');}
42
+ if (!libraryJson(source.library, kinds, phone)) {errors.push('skin phone file references');}
36
43
  }
37
44
  return errors;
38
45
  }
@@ -76,7 +83,7 @@ function validateSkinAssets(source: Pick<Shardfile, 'rows' | 'files'> & { readon
76
83
  for (const look of source.rows.looks) {
77
84
  if (look.recipe !== SKIN_LOOK_RECIPE) {continue;}
78
85
  const resolved = resolveSkinLookFiles(source, look, assets);
79
- const skins = new Map([resolved.skin, ...(resolved.variants?.values() ?? [])].map((skin): [string, typeof resolved.skin] => [skin.hash, skin]));
86
+ const skins = new Map(lookSkins(resolved).map((skin): [string, typeof resolved.skin] => [skin.hash, skin]));
80
87
  for (const { row, binding } of skins.values()) {
81
88
 
82
89
  validateCreatureBones(look.species, row.rig.sockets);
@@ -8,7 +8,7 @@ const SKIN_LOOK_RECIPE = 'platform.skin';
8
8
  const SKIN_CLIPS_RECIPE = 'platform.clips';
9
9
  const hash = v.pipe(v.string(), v.regex(/^[0-9a-f]{64}$/u));
10
10
  /** The look row's parameters. */
11
- const SkinLookParametersSchema: v.GenericSchema<SkinLookParametersRowsInput, SkinLookParametersRows> = v.strictObject({ skin: hash, variants: v.exactOptional(hash) });
11
+ const SkinLookParametersSchema: v.GenericSchema<SkinLookParametersRowsInput, SkinLookParametersRows> = v.strictObject({ skin: hash, variants: v.exactOptional(hash), phone: v.exactOptional(hash) });
12
12
  /** Complete variant-to-skin declarations in one ordinary content-addressed JSON file. */
13
13
  const VARIANTS_VERSION = 1;
14
14
  const MIN_VARIANTS = 1;
@@ -43,13 +43,15 @@ const SkinClipParametersSchema: v.GenericSchema<SkinClipParametersRowsInput, Ski
43
43
  const ShardSkinFileSchema: v.GenericSchema<ShardSkinFileRowsInput, ShardSkinFileRows> = v.strictObject({ row: v.unknown(), binding: v.unknown() });
44
44
 
45
45
  /** A parsed skin look: the file it names and the attack span its clip was sampled with. */
46
- interface SkinLookParameters { skin: string; variants?: string; attackSpan: number; clipMap?: SkinClipMap }
46
+ /** `phone` (ONE-FORMAT CC51b) names a lighter skin file the phone tier draws instead: same rig, clips, sockets and material. */
47
+ interface SkinLookParameters { skin: string; variants?: string; phone?: string; attackSpan: number; clipMap?: SkinClipMap }
47
48
 
48
49
  /** Admitted data contracts, independent of validator implementation metadata. */
49
50
  type SkinLookParametersRowsInput = SkinLookParametersRows;
50
51
  interface SkinLookParametersRowsFields {
51
52
  skin: string;
52
53
  variants?: string;
54
+ phone?: string;
53
55
  }
54
56
  type SkinLookParametersRows = { [Key in keyof SkinLookParametersRowsFields]: SkinLookParametersRowsFields[Key] };
55
57
  interface SkinClipParametersRowsInputFields {