@wildshard/shard-format 0.4.10 → 0.5.1

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 (46) hide show
  1. package/package.json +11 -8
  2. package/src/cli/main.ts +2 -2
  3. package/src/cli/pack.ts +3 -3
  4. package/src/cli/validate.ts +33 -27
  5. package/src/format/assembly-hosts.ts +77 -0
  6. package/src/format/assetAdmission.ts +5 -5
  7. package/src/format/cook-preparation.ts +2 -2
  8. package/src/format/deviceMemoryCost.ts +2 -2
  9. package/src/format/{directorProduct.ts → directorDocument.ts} +3 -3
  10. package/src/format/entryClearance.ts +1 -1
  11. package/src/format/glbCost.ts +1 -1
  12. package/src/format/immutable.ts +1 -1
  13. package/src/format/issue-codes.ts +1 -1
  14. package/src/format/ktx2Cost.ts +1 -1
  15. package/src/format/look-light.ts +31 -1
  16. package/src/format/look-render.ts +161 -0
  17. package/src/format/materials.ts +1 -1
  18. package/src/format/namedJsonContracts.ts +1 -1
  19. package/src/format/nearPlaceholderAssets.ts +1 -1
  20. package/src/format/outputDownload.ts +1 -1
  21. package/src/format/outputIndex.ts +1 -1
  22. package/src/format/platformFileFamilies.ts +3 -2
  23. package/src/format/pool-surface.ts +86 -0
  24. package/src/format/populationEnvironment.ts +8 -6
  25. package/src/format/receipt-cost.ts +3 -3
  26. package/src/format/registeredJson.ts +4 -4
  27. package/src/format/script-side-grandfather.ts +5 -5
  28. package/src/format/script-sides.ts +3 -3
  29. package/src/format/shardSchema.ts +7 -3
  30. package/src/format/{product-audio.ts → shardfile-audio.ts} +7 -7
  31. package/src/format/{product-stream-admit.ts → shardfile-stream-admit.ts} +11 -8
  32. package/src/format/{product-stream-assets.ts → shardfile-stream-assets.ts} +7 -7
  33. package/src/format/{product-stream-facts.ts → shardfile-stream-facts.ts} +3 -3
  34. package/src/format/{product-stream-node.ts → shardfile-stream-node.ts} +2 -2
  35. package/src/format/{product-stream-packs.ts → shardfile-stream-packs.ts} +1 -1
  36. package/src/format/{product-stream-rows.ts → shardfile-stream-rows.ts} +6 -6
  37. package/src/format/{product-stream.ts → shardfile-stream.ts} +25 -25
  38. package/src/format/{productValidation.ts → shardfileValidation.ts} +14 -14
  39. package/src/format/sourceResidency.ts +4 -4
  40. package/src/format/tar.ts +1 -1
  41. package/src/format/validationReceipt.ts +2 -2
  42. package/src/format/water.ts +6 -1
  43. /package/src/format/{product.ts → shardfile-assets.ts} +0 -0
  44. /package/src/format/{product-reads.ts → shardfile-reads.ts} +0 -0
  45. /package/src/format/{product-stream-miss.ts → shardfile-stream-miss.ts} +0 -0
  46. /package/src/format/{product-stream-tar.ts → shardfile-stream-tar.ts} +0 -0
@@ -0,0 +1,161 @@
1
+ /**
2
+ * The render-match settings of a look (meta TEMPLATES-CLEANROOM M4): what a cleanroom three.js scene sets that a shard
3
+ * could not say before. Each is off when absent, and no default is filled, so an older shard file keeps its bytes.
4
+ *
5
+ * - `look.light.shadow`: the sun's shadow look: `intensity` (0 none, 1 black), the filter `radius` (texels) and the
6
+ * `normalBias` (metres) that keeps faces from shadowing themselves.
7
+ * - a lamp's `decay` (absent 2: physical), `halo` (a soft additive glow `size` metres across at `opacity`, one instanced
8
+ * draw for every halo) and `flicker` (`amount` of its intensity at about `rate` hertz: a fire's unsteady light).
9
+ * - `look.light.motes`: fireflies, sparks or dust: `count` glowing points drifting in the box `min`..`max`, in linear
10
+ * `colour` × `gain` (over 1 blooms), `size` metres across, one additive draw; phones draw half.
11
+ * - `look.grade.vignette`: the frame's dark edge, from `offset` (0 centre, 1 corner) at `darkness` (0 none); absent is
12
+ * the engine's own vignette.
13
+ *
14
+ * Plain data and checks, no three.js.
15
+ */
16
+ import {
17
+ check,
18
+ exactOptional,
19
+ finite,
20
+ integer,
21
+ maxValue,
22
+ minValue,
23
+ number,
24
+ pipe,
25
+ strictObject,
26
+ tuple,
27
+ } from 'valibot'
28
+
29
+ import type { ExactOptionalSchema, GenericSchema } from 'valibot'
30
+
31
+ type Rgb = [number, number, number]
32
+ type Point = [number, number, number]
33
+
34
+ const NONE = 0
35
+ const FULL = 1
36
+ const SHADOW_RADIUS_MAX = 16
37
+ const SHADOW_NORMAL_BIAS_MAX = 0.5
38
+ const LAMP_DECAY_MAX = 2
39
+ const HALO_SIZE_MIN = 0.05
40
+ const HALO_SIZE_MAX = 8
41
+ const FLICKER_RATE_MAX = 30
42
+ /** At most this many motes in one look (one points draw). */
43
+ const LOOK_LIGHT_MOTES_MAX = 2048
44
+ const MOTE_GAIN_MAX = 8
45
+ const MOTE_SIZE_MIN = 0.005
46
+ const MOTE_SIZE_MAX = 1
47
+ const AXIS_X = 0
48
+ const AXIS_Y = 1
49
+ const AXIS_Z = 2
50
+
51
+ /** The sun's shadow look. */
52
+ interface LookShadow {
53
+ intensity: number
54
+ radius: number
55
+ normalBias: number
56
+ }
57
+ /** A lamp's glow: an additive halo `size` metres across at `opacity`. */
58
+ interface LookLampHalo {
59
+ size: number
60
+ opacity: number
61
+ }
62
+ /** A lamp's flicker: `amount` (0 to 1) of its intensity, at about `rate` hertz. */
63
+ interface LookLampFlicker {
64
+ rate: number
65
+ amount: number
66
+ }
67
+ /** Glowing motes drifting in the box `min`..`max`. */
68
+ interface LookMotes {
69
+ count: number
70
+ min: Point
71
+ max: Point
72
+ colour: Rgb
73
+ gain: number
74
+ size: number
75
+ }
76
+ /** `look.grade.vignette`: the frame's dark edge. */
77
+ interface LookVignette {
78
+ offset: number
79
+ darkness: number
80
+ }
81
+
82
+ const real = pipe(number(), finite())
83
+ const range = (low: number, high: number): GenericSchema<number, number> =>
84
+ pipe(real, minValue(low), maxValue(high))
85
+ const unit = range(NONE, FULL)
86
+ const colour: GenericSchema<Rgb, Rgb> = tuple([unit, unit, unit])
87
+ const point: GenericSchema<Point, Point> = tuple([real, real, real])
88
+ const moteCount = pipe(
89
+ real,
90
+ integer(),
91
+ minValue(FULL),
92
+ maxValue(LOOK_LIGHT_MOTES_MAX),
93
+ )
94
+
95
+ const LookShadowSchema: GenericSchema<LookShadow, LookShadow> = strictObject({
96
+ intensity: unit,
97
+ radius: range(NONE, SHADOW_RADIUS_MAX),
98
+ normalBias: range(NONE, SHADOW_NORMAL_BIAS_MAX),
99
+ })
100
+ const LookLampHaloSchema: GenericSchema<LookLampHalo, LookLampHalo> =
101
+ strictObject({ size: range(HALO_SIZE_MIN, HALO_SIZE_MAX), opacity: unit })
102
+ const LookLampFlickerSchema: GenericSchema<LookLampFlicker, LookLampFlicker> =
103
+ strictObject({ rate: range(NONE, FLICKER_RATE_MAX), amount: unit })
104
+ const lampDecay: ExactOptionalSchema<
105
+ GenericSchema<number, number>,
106
+ undefined
107
+ > = exactOptional(range(NONE, LAMP_DECAY_MAX))
108
+ const lampHalo: ExactOptionalSchema<
109
+ GenericSchema<LookLampHalo, LookLampHalo>,
110
+ undefined
111
+ > = exactOptional(LookLampHaloSchema)
112
+ const lampFlicker: ExactOptionalSchema<
113
+ GenericSchema<LookLampFlicker, LookLampFlicker>,
114
+ undefined
115
+ > = exactOptional(LookLampFlickerSchema)
116
+
117
+ /** A box's corners, read only. */
118
+ interface MotesBox {
119
+ readonly min: readonly [number, number, number]
120
+ readonly max: readonly [number, number, number]
121
+ }
122
+ function ordered(row: MotesBox): boolean {
123
+ return (
124
+ row.min[AXIS_X] <= row.max[AXIS_X] &&
125
+ row.min[AXIS_Y] <= row.max[AXIS_Y] &&
126
+ row.min[AXIS_Z] <= row.max[AXIS_Z]
127
+ )
128
+ }
129
+ const motesRow = strictObject({
130
+ count: moteCount,
131
+ min: point,
132
+ max: point,
133
+ colour,
134
+ gain: range(NONE, MOTE_GAIN_MAX),
135
+ size: range(MOTE_SIZE_MIN, MOTE_SIZE_MAX),
136
+ })
137
+ const LookMotesSchema: GenericSchema<LookMotes, LookMotes> = pipe(
138
+ motesRow,
139
+ check<LookMotes, string>(ordered, 'Motes box min must not exceed max'),
140
+ )
141
+ const LookVignetteSchema: GenericSchema<LookVignette, LookVignette> =
142
+ strictObject({ offset: unit, darkness: unit })
143
+
144
+ export {
145
+ LOOK_LIGHT_MOTES_MAX,
146
+ LookLampFlickerSchema,
147
+ LookLampHaloSchema,
148
+ LookMotesSchema,
149
+ LookShadowSchema,
150
+ LookVignetteSchema,
151
+ lampDecay,
152
+ lampFlicker,
153
+ lampHalo,
154
+ }
155
+ export type {
156
+ LookLampFlicker,
157
+ LookLampHalo,
158
+ LookMotes,
159
+ LookShadow,
160
+ LookVignette,
161
+ }
@@ -52,7 +52,7 @@ export function graphFileJson(hash: string, file: (hash: string) => Uint8Array |
52
52
  * preset reference or a missing or invalid file.
53
53
  */
54
54
  export function materialGraphIr(entry: MaterialEntry, file: (hash: string) => Uint8Array | undefined): GraphIr {
55
- if (entry.family !== 'graph' || !('file' in entry)) throw new Error('material graph IR needs a graph file (a built product carries no inline graph)');
55
+ if (entry.family !== 'graph' || !('file' in entry)) throw new Error('material graph IR needs a graph file (a built shard file carries no inline graph)');
56
56
  const checked = validateGraph(graphFileJson(entry.file, file), { trustedBudget: true });
57
57
  if (!checked.ok) throw new Error(`material graph file ${entry.file}: ${checked.errors.join('; ')}`);
58
58
  return checked.graph;
@@ -82,7 +82,7 @@ export const HEADLESS_ASSEMBLY_JSON_SCHEMA: { $schema: string; type: string; add
82
82
  ] } } } },
83
83
  },
84
84
  properties: { version: { const: 1 }, modules: { type: 'object', propertyNames: {
85
- type: 'string', pattern: '^(?:@wildshard/[a-z]+/|src/(?:shards|game|engine|sdk)/)[A-Za-z0-9_./-]+$',
85
+ type: 'string', pattern: '^src/(?:shards|game|engine|sdk)/[A-Za-z0-9_./-]+$',
86
86
  }, additionalProperties: { type: 'array', maxItems: 256, uniqueItems: true, items: { $ref: '#/definitions/key' } } },
87
87
  constants: { $ref: '#/definitions/value' }, prepare: { $ref: '#/definitions/rows' }, install: { $ref: '#/definitions/installRows' },
88
88
  level: { $ref: '#/definitions/value' }, ports: { $ref: '#/definitions/value' }, entries: { $ref: '#/definitions/value' } },
@@ -1,7 +1,7 @@
1
1
  import type { NearPlaceholder } from './nearPlaceholder.ts';
2
2
  import { decodeTerrainTile } from './terrainTileBytes.ts';
3
3
  import { CELL_ABOVE, CELL_BELOW, CHUNK_HALF } from './contentBounds.ts';
4
- import { visitGlbTriangles } from './product.ts';
4
+ import { visitGlbTriangles } from './shardfile-assets.ts';
5
5
 
6
6
  /** Validate actual visual payloads: exact L1 tiles and cell-local GLBs, with no collider-only terrain. */
7
7
  export function validateNearPlaceholderAssets(near: NearPlaceholder, assets: ReadonlyMap<string, Uint8Array>): void {
@@ -29,6 +29,6 @@ export function readOutputDownloadIndex(input: unknown): OutputDownloadIndex {
29
29
  packs: v.exactOptional(v.pipe(v.array(v.object({ ...measured, entries: v.pipe(v.array(v.object({ hash, offset: bytes, bytes })), v.maxLength(8192)) })), v.maxLength(64))),
30
30
  }), input);
31
31
  const paths = ['shard.json', 'validation.json', ...index.sections.map(row => row.path), ...index.schemas.map(row => row.path), ...index.files.map(row => row.path)];
32
- if (new Set(paths).size !== paths.length) throw new Error('Duplicate product download path');
32
+ if (new Set(paths).size !== paths.length) throw new Error('Duplicate shard file download path');
33
33
  return index;
34
34
  }
@@ -62,7 +62,7 @@ export function parseOutputDescriptorIndex(input: unknown): OutputIndex | null {
62
62
  }
63
63
  function parseOutputIndexRows(input: unknown): OutputIndex {
64
64
  const index = v.parse(OutputIndexSchema, input);
65
- if (index.sdk === '0.3' && index.cook === undefined) { throw new Error(`Missing cook preparation: run wildshard prepare <product-dir> --base <exact-preview-url> (${index.identity.slug})`); }
65
+ if (index.sdk === '0.3' && index.cook === undefined) { throw new Error(`Missing cook preparation: run wildshard prepare <folder> --base <exact-preview-url> (${index.identity.slug})`); }
66
66
  if (index.sdk === '0.3' && index.cook !== undefined && index.cook.bytes > MAX_COOK_BYTES) { throw new Error('Cook preparation exceeds byte cap'); }
67
67
  const paths = new Set(['shard.json', 'validation.json']), names = new Set<string>();
68
68
  if (index.ktx2Costs !== undefined) {
@@ -57,7 +57,7 @@ import { PageLifeSchema } from './pageLife.ts';
57
57
  import { ChapterDirectorSchema, ChapterWakeSchema } from './chapterDirector.ts';
58
58
  import { QuestPageInteractionsSchema } from './questInteractions.ts';
59
59
  import { QuestServiceActionsSchema, QuestHintRowsSchema, CarriedQuestSchema } from './questSteps.ts';
60
- import { DirectorProductSchema } from './directorProduct.ts';
60
+ import { DirectorDocumentSchema } from './directorDocument.ts';
61
61
  import { NativeAssemblySchema, NativeAssemblyDataSchema, NATIVE_ASSEMBLY_SCHEMA, NATIVE_ASSEMBLY_DATA_SCHEMA } from './nativeAssembly.ts';
62
62
  import { QuestPanelCatalogueSchema } from './panelTemplate.ts';
63
63
  import { ForestWeatherSchema } from './forestWeather.ts';
@@ -224,7 +224,8 @@ export const PLATFORM_FILE_FAMILIES: readonly PlatformFileFamily[] = [
224
224
  source: '@wildshard/format/questInteractions#QuestPageInteractionsSchema', reader: 'src/game/quest/pageComposition.ts' },
225
225
  { pattern: /^quests\/services\.json$/u, schema: QuestServiceActionsSchema,
226
226
  source: '@wildshard/format/questSteps#QuestServiceActionsSchema', reader: 'src/game/quest/effects.ts' },
227
- { pattern: /^directors\/main\.json$/u, schema: DirectorProductSchema,
227
+ // SA23: the source string is shard file data (each file's `jsonSchema.$comment`), so it keeps the old module name.
228
+ { pattern: /^directors\/main\.json$/u, schema: DirectorDocumentSchema,
228
229
  source: '@wildshard/format/directorProduct#DirectorProductSchema', reader: 'src/game/plugin/director.ts' },
229
230
  { pattern: /^quests\/panels\.json$/u, schema: QuestPanelCatalogueSchema,
230
231
  source: '@wildshard/format/panelTemplate#QuestPanelCatalogueSchema', reader: 'src/game/ui/dataPanels.ts' },
@@ -0,0 +1,86 @@
1
+ /**
2
+ * How a pool's surface draws (meta TEMPLATES-CLEANROOM M4.1), the optional `surface` of a `water.json` pool:
3
+ *
4
+ * - `reflect`: `planar` mirrors the scene (desktop; phones fall back to `sky`), `sky` reflects the look's sky only.
5
+ * - `tint` (linear): the colour looked straight down into.
6
+ * - `fresnel`: the reflection's share face-on, and the power it rises by toward grazing.
7
+ * - `ripple`: the surface's small waves, `scale` per metre, `amplitude` (screen-space offset), `speed`.
8
+ * - `resolution`: the mirror's texels on a side (absent: the engine's choice for the tier).
9
+ *
10
+ * Absent: the engine's default water, as before. Plain data and checks, no three.js.
11
+ */
12
+ import {
13
+ exactOptional,
14
+ finite,
15
+ integer,
16
+ maxValue,
17
+ minValue,
18
+ number,
19
+ picklist,
20
+ pipe,
21
+ strictObject,
22
+ tuple,
23
+ } from 'valibot'
24
+
25
+ import type { GenericSchema } from 'valibot'
26
+
27
+ type Rgb = [number, number, number]
28
+
29
+ const NONE = 0
30
+ const FULL = 1
31
+ const FRESNEL_POWER_MIN = 0.5
32
+ const FRESNEL_POWER_MAX = 8
33
+ const RIPPLE_SCALE_MAX = 20
34
+ const RIPPLE_AMPLITUDE_MAX = 0.05
35
+ const RIPPLE_SPEED_MAX = 8
36
+ const RESOLUTION_MIN = 128
37
+ const RESOLUTION_MAX = 2048
38
+
39
+ /** A pool's small waves. */
40
+ interface PoolRipple {
41
+ scale: number
42
+ amplitude: number
43
+ speed: number
44
+ }
45
+ /** A pool's drawn surface. */
46
+ interface PoolSurface {
47
+ reflect: 'planar' | 'sky'
48
+ tint: Rgb
49
+ fresnel: [number, number]
50
+ ripple: PoolRipple
51
+ resolution?: number
52
+ }
53
+
54
+ const real = pipe(number(), finite())
55
+ const range = (low: number, high: number): GenericSchema<number, number> =>
56
+ pipe(real, minValue(low), maxValue(high))
57
+ const unit = range(NONE, FULL)
58
+ const tint: GenericSchema<Rgb, Rgb> = tuple([unit, unit, unit])
59
+ const fresnelPower = range(FRESNEL_POWER_MIN, FRESNEL_POWER_MAX)
60
+ const fresnel: GenericSchema<[number, number], [number, number]> = tuple([
61
+ unit,
62
+ fresnelPower,
63
+ ])
64
+ const PoolRippleSchema: GenericSchema<PoolRipple, PoolRipple> = strictObject({
65
+ scale: range(NONE, RIPPLE_SCALE_MAX),
66
+ amplitude: range(NONE, RIPPLE_AMPLITUDE_MAX),
67
+ speed: range(NONE, RIPPLE_SPEED_MAX),
68
+ })
69
+ const texels = pipe(
70
+ real,
71
+ integer(),
72
+ minValue(RESOLUTION_MIN),
73
+ maxValue(RESOLUTION_MAX),
74
+ )
75
+ const PoolSurfaceSchema: GenericSchema<PoolSurface, PoolSurface> = strictObject(
76
+ {
77
+ reflect: picklist(['planar', 'sky']),
78
+ tint,
79
+ fresnel,
80
+ ripple: PoolRippleSchema,
81
+ resolution: exactOptional(texels),
82
+ },
83
+ )
84
+
85
+ export { PoolRippleSchema, PoolSurfaceSchema }
86
+ export type { PoolRipple, PoolSurface }
@@ -6,15 +6,17 @@ import { ForagerContinuation } from './ambientLife.ts';
6
6
  const finite = v.pipe(v.number(), v.finite());
7
7
  const key = v.pipe(v.string(), v.minLength(1), v.maxLength(128));
8
8
  const point = v.strictObject({ x: finite, z: finite });
9
- /** G1004/G872: this approved single-user native input has exactly 155 authored
10
- * canopy entries and at most six ledges. A changed source count refuses until
11
- * this contract is reviewed; the original author/native count checks remain. */
12
- export const PopulationHabitatSchema:v.GenericSchema<PopulationHabitatRows,PopulationHabitatRows>=v.strictObject({
13
- trees:v.pipe(v.array(v.tuple([finite,finite,v.pipe(finite,v.minValue(0))])),v.length(155)),
14
- tops:v.pipe(v.array(finite),v.length(155)),
9
+ /** The habitat's canopy (one top height per tree) and at most six ledges. G1004/G872 pinned the canopy at exactly 155
10
+ * rows, Nalati's frozen capture; its page now plants 146 (SERVER-PARITY SS10b), so the count follows the shard's own
11
+ * forest: any number up to 4096, one top per tree. */
12
+ const HabitatRows=v.strictObject({
13
+ trees:v.pipe(v.array(v.tuple([finite,finite,v.pipe(finite,v.minValue(0))])),v.maxLength(4096)),
14
+ tops:v.pipe(v.array(finite),v.maxLength(4096)),
15
15
  ledges:v.pipe(v.array(v.strictObject({x:finite,y:finite,z:finite,r:v.pipe(finite,v.minValue(0))})),v.maxLength(6)),
16
16
  marmots:ForagerContinuation,
17
17
  });
18
+ const oneTopPerTree=(rows:{readonly trees:readonly unknown[];readonly tops:readonly unknown[]}):boolean=>rows.tops.length===rows.trees.length;
19
+ export const PopulationHabitatSchema:v.GenericSchema<PopulationHabitatRows,PopulationHabitatRows>=v.pipe(HabitatRows,v.check<PopulationHabitatRows,string>(oneTopPerTree,'Habitat needs one canopy top per tree'));
18
20
  export interface PopulationHabitatRows {
19
21
  trees:[number,number,number][];tops:number[];ledges:{x:number;y:number;z:number;r:number}[];
20
22
  marmots:v.InferOutput<typeof ForagerContinuation>;
@@ -2,9 +2,9 @@
2
2
  import { preflightDeclaredCosts } from './assetAdmission.ts'
3
3
  import { structuralGridEvidence } from './gridReadiness.ts'
4
4
  import { postStackCost } from './postStack.ts'
5
- import { offlineMemoryAdmission } from './product.ts'
5
+ import { offlineMemoryAdmission } from './shardfile-assets.ts'
6
6
  import {
7
- productWireBytes,
7
+ shardfileWireBytes,
8
8
  publishedSourceResidency,
9
9
  } from './sourceResidency.ts'
10
10
 
@@ -59,7 +59,7 @@ function receiptResidencyShortfall(
59
59
  shard: Shardfile,
60
60
  ): string | undefined {
61
61
  const stamped = stampedResidency(receipt)
62
- const wire = productWireBytes(shard)
62
+ const wire = shardfileWireBytes(shard)
63
63
  if (stamped === undefined || stamped >= wire) {
64
64
  return undefined
65
65
  }
@@ -46,7 +46,7 @@ import { CaveFileSchema, CaveInteriorSchema } from './caveInterior.ts';
46
46
  import * as v from 'valibot';
47
47
  import { NativePopulationRowsSchema, parseNativePopulationRows, TamingPoseFileSchema } from './populationRoster.ts';
48
48
  import { EliteFeatureSchema, parseEliteFeature } from './eliteFeature.ts';
49
- import { DirectorProductSchema } from './directorProduct.ts';
49
+ import { DirectorDocumentSchema } from './directorDocument.ts';
50
50
  import { AudioSceneSchema } from './audioScene.ts';
51
51
  import { KitFigureCardsSchema } from './questFigures.ts';
52
52
  import {SceneBuffersSchema,parseSceneBuffers} from './sceneBuffers.ts';
@@ -128,7 +128,7 @@ export interface RegisteredJsonContracts {
128
128
  readonly 'world/dressing-phone.json':{readonly schema:typeof SceneDressingSchema;readonly source:'@wildshard/format/sceneDressing#SceneDressingSchema'};
129
129
  readonly 'world/building-sites.json':{readonly schema:typeof LivingPageSitesSchema;readonly source:'@wildshard/format/forestPage#LivingPageSitesSchema'};
130
130
  readonly 'models/shape-book.json':{readonly schema:typeof FixedDrawRowsSchema;readonly source:'@wildshard/format/fixedDraws#FixedDrawRowsSchema'};
131
- readonly 'directors/main.json':{readonly schema:typeof DirectorProductSchema;readonly source:'@wildshard/format/directorProduct#DirectorProductSchema'};
131
+ readonly 'directors/main.json':{readonly schema:typeof DirectorDocumentSchema;readonly source:'@wildshard/format/directorProduct#DirectorProductSchema'};
132
132
  readonly 'scenes/cascade.json':{readonly schema:typeof WorldSceneSchema;readonly source:'@wildshard/format/clientChannels#WorldSceneSchema'};
133
133
  readonly 'scenes/cove.json':{readonly schema:typeof WorldSceneSchema;readonly source:'@wildshard/format/clientChannels#WorldSceneSchema'};
134
134
  readonly 'scenes/hibiscus.json':{readonly schema:typeof WorldSceneSchema;readonly source:'@wildshard/format/clientChannels#WorldSceneSchema'};
@@ -250,7 +250,7 @@ export const REGISTERED_JSON:RegisteredJsonContracts = {
250
250
  'world/dressing-phone.json':{schema:SceneDressingSchema,source:'@wildshard/format/sceneDressing#SceneDressingSchema'},
251
251
  'world/building-sites.json':{schema:LivingPageSitesSchema,source:'@wildshard/format/forestPage#LivingPageSitesSchema'},
252
252
  'models/shape-book.json':{schema:FixedDrawRowsSchema,source:'@wildshard/format/fixedDraws#FixedDrawRowsSchema'},
253
- 'directors/main.json':{schema:DirectorProductSchema,source:'@wildshard/format/directorProduct#DirectorProductSchema'},
253
+ 'directors/main.json':{schema:DirectorDocumentSchema,source:'@wildshard/format/directorProduct#DirectorProductSchema'},
254
254
  'scenes/cascade.json':{schema:WorldSceneSchema,source:'@wildshard/format/clientChannels#WorldSceneSchema'},
255
255
  'scenes/cove.json':{schema:WorldSceneSchema,source:'@wildshard/format/clientChannels#WorldSceneSchema'},
256
256
  'scenes/hibiscus.json':{schema:WorldSceneSchema,source:'@wildshard/format/clientChannels#WorldSceneSchema'},
@@ -476,7 +476,7 @@ export function validateRegisteredJson(name:string,value:unknown):void {
476
476
  case 'world/weather-observations.json':v.parse(ForestWeatherObservationSchema,value);break;
477
477
  case 'look/post.json':parsePostGraphDocument(value);break;
478
478
  case 'people/cards.json':v.parse(KitFigureCardsSchema,value);break;
479
- case 'directors/main.json':v.parse(DirectorProductSchema,value);break;
479
+ case 'directors/main.json':v.parse(DirectorDocumentSchema,value);break;
480
480
  case 'actors/roster.json':parseNativePopulationRows(value);break;
481
481
  case 'actors/elites.json':parseEliteFeature(value);break;
482
482
  case 'sim/keeper.json':v.parse(PopulationKeeperRowsSchema,value);break;
@@ -3,13 +3,13 @@
3
3
 
4
4
  /** The product a validator is admitting: its slug and declared source hash. Both validators check that hash against
5
5
  * the admitted sections before they return, so a forged index cannot borrow a grandfathered product's. */
6
- interface ScriptSideProduct {
6
+ interface ScriptSideShardfile {
7
7
  readonly slug: string
8
8
  readonly sourceHash: string
9
9
  }
10
10
 
11
11
  /** One live product admitted with a warning in place of a script side refusal. */
12
- interface GrandfatheredScript extends ScriptSideProduct {
12
+ interface GrandfatheredScript extends ScriptSideShardfile {
13
13
  /** The script id the refusal names. */
14
14
  readonly script: string
15
15
  /** Why it still passes, and the row that removes it. */
@@ -29,7 +29,7 @@ const SCRIPT_SIDE_GRANDFATHER: readonly GrandfatheredScript[] = []
29
29
  /** The grandfather entry that covers one refusal line of this product, or `undefined`. */
30
30
  function grandfatherFor(
31
31
  line: string,
32
- product: ScriptSideProduct,
32
+ product: ScriptSideShardfile,
33
33
  ): GrandfatheredScript | undefined {
34
34
  return SCRIPT_SIDE_GRANDFATHER.find(
35
35
  (entry: GrandfatheredScript): boolean =>
@@ -42,7 +42,7 @@ function grandfatherFor(
42
42
  /** A product's side refusal lines, split: lines a grandfather entry covers become warnings, the rest stay refusals. */
43
43
  function splitGrandfathered(
44
44
  lines: readonly string[],
45
- product: ScriptSideProduct,
45
+ product: ScriptSideShardfile,
46
46
  ): { refused: string[]; warnings: string[] } {
47
47
  const refused: string[] = []
48
48
  const warnings: string[] = []
@@ -58,4 +58,4 @@ function splitGrandfathered(
58
58
  }
59
59
 
60
60
  export { SCRIPT_SIDE_GRANDFATHER, splitGrandfathered }
61
- export type { GrandfatheredScript, ScriptSideProduct }
61
+ export type { GrandfatheredScript, ScriptSideShardfile }
@@ -16,7 +16,7 @@ import {
16
16
 
17
17
  import type { FeatureSide } from './feature-sides.ts'
18
18
  import type { OutputIndex } from './outputIndex.ts'
19
- import type { ScriptSideProduct } from './script-side-grandfather.ts'
19
+ import type { ScriptSideShardfile } from './script-side-grandfather.ts'
20
20
  import type { NamedFiles } from './script-view-returns.ts'
21
21
  import type { ScriptV1CommandName } from './scriptAbiV1.ts'
22
22
  import type { V2Lane } from './scriptFuelV2.ts'
@@ -69,7 +69,7 @@ const PAGE_ONLY_PROGRAM_HOSTS: ReadonlyMap<string, readonly string[]> = new Map(
69
69
  type NamedJson = (name: string) => unknown
70
70
 
71
71
  /** The product files a validator reads before its inventory pass, and its hash check (`whole` as in
72
- * `ProductValidationPorts.verify`). */
72
+ * `ShardfileValidationPorts.verify`). */
73
73
  interface UncheckedFiles {
74
74
  readonly read: (path: string, bytes: number) => Uint8Array | undefined
75
75
  readonly paths: () => Iterable<string>
@@ -227,7 +227,7 @@ function namedJsonFiles(index: OutputIndex, files: UncheckedFiles): NamedFiles {
227
227
  function scriptSideVerdict(
228
228
  sections: ReadonlyMap<string, unknown>,
229
229
  files: NamedFiles,
230
- product: ScriptSideProduct,
230
+ product: ScriptSideShardfile,
231
231
  ): { refused: string[]; warnings: string[] } {
232
232
  return splitGrandfathered(
233
233
  scriptSideRefusals(sections, files.read, files.names),
@@ -9,7 +9,7 @@ import { CELL_ABOVE, CELL_BELOW, CHUNK_HALF, CONTENT_CAPS } from './contentBound
9
9
  import { jsonDataNodes } from './json.ts';
10
10
  import { SHARDFILE_ADMISSION_LIMITS as limits } from './admissionLimits.ts';
11
11
  import { preflightShardfile } from './preflight.ts';
12
- import { preflightAssetGraph } from './product.ts';
12
+ import { preflightAssetGraph } from './shardfile-assets.ts';
13
13
  import { SHARDFILE_VERSION } from './version.ts';
14
14
  import { UiSchema, uiRules } from './ui.ts';
15
15
  import { scriptBindingRules } from './scripts.ts';
@@ -54,7 +54,9 @@ import { skinLookRules } from './skinAssets.ts';
54
54
  import { MaterialsSchema, FamilyLooksSchema, MaterialCurvesSchema, TextureSamplersSchema, materialExists, materialTextureRefs, materialGraphRules, materialCurveRules, textureSamplerRules } from './materials.ts';
55
55
  import { PostStackSchema, postStackRules } from './postStack.ts';
56
56
  import { LookBloomSchema, LookLightSchema, LookToneSchema } from './look-light.ts';
57
+ import { LookVignetteSchema } from './look-render.ts';
57
58
  import type { LookBloom, LookBloomInput, LookLight, LookLightInput, LookTone } from './look-light.ts';
59
+ import type { LookVignette } from './look-render.ts';
58
60
 
59
61
  const channel = v.pipe(finite, v.minValue(0), v.maxValue(1));
60
62
  const colour = v.tuple([channel, channel, channel]);
@@ -62,7 +64,7 @@ const unsigned = v.pipe(finite, v.minValue(0));
62
64
  const key: v.GenericSchema<DayKeyRowsInput, DayKeyRows> = v.strictObject({ time: channel, sky: v.strictObject({ zenith: colour, horizon: colour }), fog: v.strictObject({ colour, density: unsigned, near: v.optional(unsigned), far: v.optional(unsigned) }), sun: v.strictObject({ colour, intensity: unsigned }), ambient: v.strictObject({ sky: colour, ground: colour, intensity: unsigned }) });
63
65
  const day: v.GenericSchema<DayRowsInput, DayRows> = v.strictObject({ minutes: v.pipe(finite, v.minValue(1), v.maxValue(1440)), start: channel, maxElevation: v.pipe(finite, v.minValue(0), v.maxValue(90)), azimuth: v.pipe(finite, v.minValue(-180), v.maxValue(180)) });
64
66
  const lookBloom = v.exactOptional(LookBloomSchema);
65
- const lookGrade = v.strictObject({ exposure: finite, saturation: v.pipe(finite, v.minValue(0)), contrast: v.pipe(finite, v.minValue(0)), lut: v.nullable(ref), bloom: lookBloom, tone: v.exactOptional(LookToneSchema) });
67
+ const lookGrade = v.strictObject({ exposure: finite, saturation: v.pipe(finite, v.minValue(0)), contrast: v.pipe(finite, v.minValue(0)), lut: v.nullable(ref), bloom: lookBloom, tone: v.exactOptional(LookToneSchema), vignette: v.exactOptional(LookVignetteSchema) });
66
68
  /** A colour LUT file's exact wire size: 33³ RGBA8 (the engine's render/lut format). */
67
69
  export const LOOK_LUT_BYTES: number = 33 ** 3 * 4;
68
70
  const rawSchema: v.GenericSchema<ShardfileRowsInput, ShardfileRows> & { readonly entries: { readonly [Key in keyof ShardfileRows]-?: v.GenericSchema<ShardfileRowsInput[Key], ShardfileRows[Key]> } } = v.strictObject({
@@ -184,7 +186,7 @@ export interface Shardfile {
184
186
  samplers?: v.InferOutput<typeof TextureSamplersSchema>;
185
187
  post?: v.InferOutput<typeof PostStackSchema>;
186
188
  light?: LookLight;
187
- grade: { exposure: number; saturation: number; contrast: number; lut: string | null; bloom?: LookBloom; tone?: LookTone };
189
+ grade: { exposure: number; saturation: number; contrast: number; lut: string | null; bloom?: LookBloom; tone?: LookTone; vignette?: LookVignette };
188
190
  clock: 'engine';
189
191
  day?: v.InferOutput<typeof day> | undefined;
190
192
  dayOverride: number | null;
@@ -398,6 +400,7 @@ interface ShardfileRowsInputFields {
398
400
  lut: (v.InferInput<typeof ref>) | null;
399
401
  bloom?: LookBloomInput;
400
402
  tone?: LookTone;
403
+ vignette?: LookVignette;
401
404
  };
402
405
  clock: 'engine';
403
406
  day?: DayRowsInput | undefined;
@@ -473,6 +476,7 @@ interface ShardfileRowsFields {
473
476
  lut: (v.InferOutput<typeof ref>) | null;
474
477
  bloom?: LookBloom;
475
478
  tone?: LookTone;
479
+ vignette?: LookVignette;
476
480
  };
477
481
  clock: 'engine';
478
482
  day?: DayRows | undefined;
@@ -20,8 +20,8 @@ import type { Shardfile } from './shardSchema.ts'
20
20
  // section's non-commons `recordings` blobs. Commons recordings are shared, so
21
21
  // they are not the shard's own.
22
22
 
23
- /** What `productRecordings` reads from a validated product. */
24
- interface ProductAudioInput {
23
+ /** What `shardfileRecordings` reads from a validated product. */
24
+ interface ShardfileAudioInput {
25
25
  readonly cook: CookData | undefined
26
26
  readonly read: (path: string, maxBytes: number) => Uint8Array
27
27
  readonly shard: Readonly<{
@@ -33,9 +33,9 @@ interface ProductAudioInput {
33
33
  const COMMONS = 'commons:'
34
34
 
35
35
  /** Every own recording in a validated product, measured from its bytes. */
36
- function productRecordings(
36
+ function shardfileRecordings(
37
37
  // oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- format's row types and a read port, only read
38
- input: Readonly<ProductAudioInput>,
38
+ input: Readonly<ShardfileAudioInput>,
39
39
  ): RecordingMeasure[] {
40
40
  const mounts = (input.cook?.mounts ?? [])
41
41
  .filter((mount: Readonly<CookMount>): boolean =>
@@ -58,7 +58,7 @@ function productRecordings(
58
58
 
59
59
  /** The product's audio against AU5's rules, its waiver read from `admission.audioWaiver`. A red report refuses only at
60
60
  * upload (`assertAudioAdmission`); pack prints it. `today` decides whether the waiver is still in date. */
61
- function productAudioReport(
61
+ function shardfileAudioReport(
62
62
  // oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- format's row types, only read
63
63
  product: Readonly<{ index: OutputIndex; audio: readonly RecordingMeasure[] }>,
64
64
  today: Readonly<Date>,
@@ -71,5 +71,5 @@ function productAudioReport(
71
71
  })
72
72
  }
73
73
 
74
- export type { ProductAudioInput }
75
- export { productAudioReport, productRecordings }
74
+ export type { ShardfileAudioInput }
75
+ export { shardfileAudioReport, shardfileRecordings }
@@ -1,4 +1,4 @@
1
- // `admitShardfileProduct`'s steps around `validateShardfileAssets` for the
1
+ // `admitShardfileFolder`'s steps around `validateShardfileAssets` for the
2
2
  // streaming validator (API-CLOUDFLARE AC6a): the schema, declared costs and
3
3
  // targets before it; the world targets and the source hash after it.
4
4
 
@@ -10,18 +10,21 @@ import {
10
10
  } from './assetAdmission.ts'
11
11
  import { issueError, withIssueCode } from './issue-codes.ts'
12
12
  import { assembleOutputShardfile } from './outputIndex.ts'
13
- import { offlineMemoryAdmission } from './product.ts'
14
- import { assertProductTargets, checkWorldTargets } from './productValidation.ts'
13
+ import { offlineMemoryAdmission } from './shardfile-assets.ts'
14
+ import {
15
+ assertShardfileTargets,
16
+ checkWorldTargets,
17
+ } from './shardfileValidation.ts'
15
18
  import { parseShardfile } from './shardSchema.ts'
16
19
  import { validationSourceBytes } from './validationReceipt.ts'
17
20
 
18
21
  import type { AssetAdmission } from './assetAdmission.ts'
19
22
  import type { OutputIndex } from './outputIndex.ts'
20
- import type { AssetPasses } from './product-stream-assets.ts'
21
23
  import type { ScriptAdmissionRows } from './scriptContract.ts'
24
+ import type { AssetPasses } from './shardfile-stream-assets.ts'
22
25
  import type { Shardfile } from './shardSchema.ts'
23
26
 
24
- /** `admitShardfileProduct`'s steps before `validateShardfileAssets`: the schema, declared costs and targets. */
27
+ /** `admitShardfileFolder`'s steps before `validateShardfileAssets`: the schema, declared costs and targets. */
25
28
  function admitHead(
26
29
  // oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- valibot's output type, only read
27
30
  index: OutputIndex,
@@ -34,13 +37,13 @@ function admitHead(
34
37
  preflightDeclaredCosts(shard, offlineMemoryAdmission('warn'))
35
38
  })
36
39
  withIssueCode('performance-targets', (): void => {
37
- assertProductTargets(shard, 'warn')
40
+ assertShardfileTargets(shard, 'warn')
38
41
  })
39
42
  return shard
40
43
  }
41
44
 
42
45
  /** The shard's head and its asset admission's first steps, or the refusal they gave: thrown only after the packs, the
43
- * cook and the inventory, as `validateShardfileProduct` orders them. */
46
+ * cook and the inventory, as `validateShardfileFolder` orders them. */
44
47
  function admitBeforeAssets(
45
48
  // oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- valibot's output type, only read
46
49
  index: OutputIndex,
@@ -88,7 +91,7 @@ function admitAssets(
88
91
  })
89
92
  }
90
93
 
91
- /** `validateShardfileProduct`'s steps after the assets: the world targets and the source hash. */
94
+ /** `validateShardfileFolder`'s steps after the assets: the world targets and the source hash. */
92
95
  function admitTail(
93
96
  // oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- valibot's output type, only read
94
97
  shard: Shardfile,
@@ -10,19 +10,19 @@
10
10
  // Wasm stay from the first read. A later check that asks for any other file
11
11
  // is refused, never answered from a guess (StreamMissError): the corpus and pin
12
12
  // tests prove no check does. Packs the reads' groups need come with them
13
- // (product-stream-packs.ts).
13
+ // (shardfile-stream-packs.ts).
14
14
 
15
15
  import { admitFileBytes } from './assetAdmission.ts'
16
16
  import { issueError, withIssueCodeAsync } from './issue-codes.ts'
17
- import { StreamMissError } from './product-stream-miss.ts'
18
- import { packGroups, packPass } from './product-stream-packs.ts'
19
- import { walkTar } from './product-stream-tar.ts'
17
+ import { StreamMissError } from './shardfile-stream-miss.ts'
18
+ import { packGroups, packPass } from './shardfile-stream-packs.ts'
19
+ import { walkTar } from './shardfile-stream-tar.ts'
20
20
 
21
21
  import type { AssetAdmission } from './assetAdmission.ts'
22
22
  import type { OutputIndex } from './outputIndex.ts'
23
- import type { PackPass, PackVerdicts } from './product-stream-packs.ts'
24
- import type { KeptMember } from './product-stream-rows.ts'
25
- import type { StreamHasher, StreamMember } from './product-stream-tar.ts'
23
+ import type { PackPass, PackVerdicts } from './shardfile-stream-packs.ts'
24
+ import type { KeptMember } from './shardfile-stream-rows.ts'
25
+ import type { StreamHasher, StreamMember } from './shardfile-stream-tar.ts'
26
26
 
27
27
  /** A stored object to read again: each call opens a fresh stream from its start. */
28
28
  type StoredSource = () =>