@fundamental-engine/core 0.9.2 → 0.9.3

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 (97) hide show
  1. package/README.md +12 -11
  2. package/dist/agents/event-agent.d.ts.map +1 -1
  3. package/dist/agents/event-agent.js +13 -9
  4. package/dist/agents/event-agent.js.map +1 -1
  5. package/dist/config/forces.config.js +2 -2
  6. package/dist/config/forces.config.js.map +1 -1
  7. package/dist/conformance/run.d.ts +2 -2
  8. package/dist/conformance/run.d.ts.map +1 -1
  9. package/dist/conformance/run.js +30 -27
  10. package/dist/conformance/run.js.map +1 -1
  11. package/dist/conformance/types.d.ts +3 -0
  12. package/dist/conformance/types.d.ts.map +1 -1
  13. package/dist/contracts/guards.d.ts +3 -1
  14. package/dist/contracts/guards.d.ts.map +1 -1
  15. package/dist/contracts/guards.js.map +1 -1
  16. package/dist/contracts/passport.d.ts.map +1 -1
  17. package/dist/contracts/passport.js +9 -0
  18. package/dist/contracts/passport.js.map +1 -1
  19. package/dist/core/accretion.d.ts +1 -1
  20. package/dist/core/accretion.d.ts.map +1 -1
  21. package/dist/core/accretion.js +1 -1
  22. package/dist/core/accretion.js.map +1 -1
  23. package/dist/core/events.d.ts +3 -3
  24. package/dist/core/events.d.ts.map +1 -1
  25. package/dist/core/events.js +1 -1
  26. package/dist/core/feedback-sink.d.ts +1 -1
  27. package/dist/core/feedback-sink.d.ts.map +1 -1
  28. package/dist/core/feedback-sink.js +1 -2
  29. package/dist/core/feedback-sink.js.map +1 -1
  30. package/dist/core/field.d.ts.map +1 -1
  31. package/dist/core/field.js +697 -82
  32. package/dist/core/field.js.map +1 -1
  33. package/dist/core/frame-harness.d.ts +2 -2
  34. package/dist/core/frame-harness.d.ts.map +1 -1
  35. package/dist/core/frame-harness.js +2 -2
  36. package/dist/core/frame-harness.js.map +1 -1
  37. package/dist/core/geometry.d.ts +9 -0
  38. package/dist/core/geometry.d.ts.map +1 -1
  39. package/dist/core/geometry.js +16 -0
  40. package/dist/core/geometry.js.map +1 -1
  41. package/dist/core/host.d.ts +95 -21
  42. package/dist/core/host.d.ts.map +1 -1
  43. package/dist/core/host.js +53 -1
  44. package/dist/core/host.js.map +1 -1
  45. package/dist/core/integrator.d.ts +22 -0
  46. package/dist/core/integrator.d.ts.map +1 -1
  47. package/dist/core/integrator.js +118 -15
  48. package/dist/core/integrator.js.map +1 -1
  49. package/dist/core/reactions.d.ts +7 -0
  50. package/dist/core/reactions.d.ts.map +1 -1
  51. package/dist/core/reactions.js +7 -0
  52. package/dist/core/reactions.js.map +1 -1
  53. package/dist/core/render-modes.d.ts +64 -0
  54. package/dist/core/render-modes.d.ts.map +1 -1
  55. package/dist/core/render-modes.js +165 -0
  56. package/dist/core/render-modes.js.map +1 -1
  57. package/dist/core/scanner.d.ts +29 -3
  58. package/dist/core/scanner.d.ts.map +1 -1
  59. package/dist/core/scanner.js +41 -3
  60. package/dist/core/scanner.js.map +1 -1
  61. package/dist/core/spatial-hash.d.ts +8 -0
  62. package/dist/core/spatial-hash.d.ts.map +1 -1
  63. package/dist/core/spatial-hash.js +26 -3
  64. package/dist/core/spatial-hash.js.map +1 -1
  65. package/dist/core/types.d.ts +308 -13
  66. package/dist/core/types.d.ts.map +1 -1
  67. package/dist/forces/extended.d.ts.map +1 -1
  68. package/dist/forces/extended.js +8 -2
  69. package/dist/forces/extended.js.map +1 -1
  70. package/dist/forces/natural.d.ts.map +1 -1
  71. package/dist/forces/natural.js +11 -12
  72. package/dist/forces/natural.js.map +1 -1
  73. package/dist/index.d.ts +1 -1
  74. package/dist/index.js +1 -1
  75. package/dist/recipes/compile.d.ts.map +1 -1
  76. package/dist/recipes/compile.js +3 -1
  77. package/dist/recipes/compile.js.map +1 -1
  78. package/dist/recipes/schema.d.ts +1 -1
  79. package/dist/recipes/schema.d.ts.map +1 -1
  80. package/dist/recipes/schema.js +1 -0
  81. package/dist/recipes/schema.js.map +1 -1
  82. package/dist/record/record.d.ts +1 -1
  83. package/dist/record/record.d.ts.map +1 -1
  84. package/dist/semantic/layers.d.ts +16 -2
  85. package/dist/semantic/layers.d.ts.map +1 -1
  86. package/dist/semantic/layers.js +20 -3
  87. package/dist/semantic/layers.js.map +1 -1
  88. package/dist/semantic/materials.js +3 -3
  89. package/dist/semantic/materials.js.map +1 -1
  90. package/dist/semantic/states.js +1 -1
  91. package/dist/semantic/states.js.map +1 -1
  92. package/dist/version.d.ts +1 -1
  93. package/dist/version.js +1 -1
  94. package/dist/visual/visualization.d.ts.map +1 -1
  95. package/dist/visual/visualization.js +4 -0
  96. package/dist/visual/visualization.js.map +1 -1
  97. package/package.json +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"scanner.js","sourceRoot":"","sources":["../../src/core/scanner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,OAAO,EAAoB,MAAM,sBAAsB,CAAC;AACjE,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAwCrD,4EAA4E;AAC5E,MAAM,UAAU,eAAe,CAAC,CAAY;IAC1C,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,GAAW,EAAU,EAAE;QAChD,MAAM,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAC/C,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACtC,CAAC,CAAC;IACF,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,IAAI,CA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,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,KAAK,GAAG,CAAC;QACnC,CAAC,CAAC,GAAG;YACH,GAAG,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,MAAM,IAAI,IAAI,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,MAAM,IAAI,IAAI,GAAG,CAAC,GAAG,MAAM,CAAC;QAChG,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,0CAA0C;IAClE,CAAC;AACH,CAAC"}
@@ -14,6 +14,14 @@ export interface Point {
14
14
  export declare class SpatialHash<T extends Point> {
15
15
  private readonly cell;
16
16
  private readonly bins;
17
+ /**
18
+ * Bin arrays retired by `clear()` — held for reuse so a `rebuild()` that re-populates the same
19
+ * (or a similar) set of cells does not allocate a fresh array per cell every frame. The index is
20
+ * rebuilt each frame (field-store `reindex`), so without this the GC churns one array per non-empty
21
+ * cell per frame at high particle counts. Query behaviour is unchanged: a bin is only ever exposed
22
+ * once it holds live items, and `clear()` empties every live bin before any are handed out.
23
+ */
24
+ private readonly freeBins;
17
25
  constructor(cellSize?: number);
18
26
  private key;
19
27
  clear(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"spatial-hash.d.ts","sourceRoot":"","sources":["../../src/core/spatial-hash.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,2EAA2E;IAC3E,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ;AAED,qBAAa,WAAW,CAAC,CAAC,SAAS,KAAK;IACtC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA0B;gBAEnC,QAAQ,SAAK;IAIzB,OAAO,CAAC,GAAG;IAKX,KAAK,IAAI,IAAI;IAIb,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI;IAUrB,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,IAAI;IAKlC;;;;;OAKG;IACH,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,SAAI,GAAG,CAAC,EAAE;CAqBlD"}
1
+ {"version":3,"file":"spatial-hash.d.ts","sourceRoot":"","sources":["../../src/core/spatial-hash.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,2EAA2E;IAC3E,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ;AAED,qBAAa,WAAW,CAAC,CAAC,SAAS,KAAK;IACtC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA0B;IAC/C;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAa;gBAE1B,QAAQ,SAAK;IAIzB,OAAO,CAAC,GAAG;IAKX,KAAK,IAAI,IAAI;IAUb,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI;IAmBrB,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,IAAI;IAKlC;;;;;OAKG;IACH,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,SAAI,GAAG,CAAC,EAAE;CAqBlD"}
@@ -8,6 +8,14 @@
8
8
  export class SpatialHash {
9
9
  cell;
10
10
  bins = new Map();
11
+ /**
12
+ * Bin arrays retired by `clear()` — held for reuse so a `rebuild()` that re-populates the same
13
+ * (or a similar) set of cells does not allocate a fresh array per cell every frame. The index is
14
+ * rebuilt each frame (field-store `reindex`), so without this the GC churns one array per non-empty
15
+ * cell per frame at high particle counts. Query behaviour is unchanged: a bin is only ever exposed
16
+ * once it holds live items, and `clear()` empties every live bin before any are handed out.
17
+ */
18
+ freeBins = [];
11
19
  constructor(cellSize = 64) {
12
20
  this.cell = cellSize > 0 ? cellSize : 64;
13
21
  }
@@ -16,15 +24,30 @@ export class SpatialHash {
16
24
  return (cx + 0x8000) * 0x10000 + (cy + 0x8000);
17
25
  }
18
26
  clear() {
27
+ // Retain the arrays: empty each live bin (length = 0 keeps the backing store) and move it to the
28
+ // free-list, then drop the map entries. Next rebuild pulls from the free-list before allocating.
29
+ for (const bin of this.bins.values()) {
30
+ bin.length = 0;
31
+ this.freeBins.push(bin);
32
+ }
19
33
  this.bins.clear();
20
34
  }
21
35
  insert(item) {
22
36
  const k = this.key(Math.floor(item.x / this.cell), Math.floor(item.y / this.cell));
23
37
  const bin = this.bins.get(k);
24
- if (bin)
38
+ if (bin) {
25
39
  bin.push(item);
26
- else
27
- this.bins.set(k, [item]);
40
+ }
41
+ else {
42
+ const fresh = this.freeBins.pop();
43
+ if (fresh) {
44
+ fresh.push(item);
45
+ this.bins.set(k, fresh);
46
+ }
47
+ else {
48
+ this.bins.set(k, [item]);
49
+ }
50
+ }
28
51
  }
29
52
  rebuild(items) {
30
53
  this.clear();
@@ -1 +1 @@
1
- {"version":3,"file":"spatial-hash.js","sourceRoot":"","sources":["../../src/core/spatial-hash.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,MAAM,OAAO,WAAW;IACL,IAAI,CAAS;IACb,IAAI,GAAG,IAAI,GAAG,EAAe,CAAC;IAE/C,YAAY,QAAQ,GAAG,EAAE;QACvB,IAAI,CAAC,IAAI,GAAG,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3C,CAAC;IAEO,GAAG,CAAC,EAAU,EAAE,EAAU;QAChC,6EAA6E;QAC7E,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC,GAAG,OAAO,GAAG,CAAC,EAAE,GA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ACnB,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;oBACrB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;oBACpB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;oBACpB,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;oBAC3B,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE;wBAAE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACtD,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
@@ -84,6 +84,16 @@ export interface Particle {
84
84
  */
85
85
  orient?: number;
86
86
  spin?: number;
87
+ /**
88
+ * OPTIONAL ACCELERATION LANE (velocity-Verlet, #659): the previous step's acceleration
89
+ * a(t) = Δv/dt, stored so the next position full-step can take `x += v·dt + ½·a·dt²` and the
90
+ * velocity half-step can average `½·(a + a′)·dt`. Only the `'velocity-verlet'` integrator ever
91
+ * writes these; undefined ⇒ 0 ⇒ the default engine never materializes them (the z-lane
92
+ * discipline — byte-identical when unused).
93
+ */
94
+ ax?: number;
95
+ ay?: number;
96
+ az?: number;
87
97
  /** inertial mass — 1 = nominal (§21). */
88
98
  m: number;
89
99
  /** ∈ [0,1]; drives color (toward accent), size, and glow (§2.2). */
@@ -136,12 +146,42 @@ export interface AtomPayload {
136
146
  * and conservation are later refinements.)
137
147
  */
138
148
  export type BodyAuthority = 'anchored' | 'kinematic' | 'dynamic';
149
+ /**
150
+ * A body's FIRST-CLASS IDENTITY (substrate critical path). A stable, structured handle for referring to
151
+ * a body across frames, snapshots, diffs, and relationships — decoupled from object reference and from
152
+ * display text. `id` is the stable primary key: it MUST be unique within a field and MUST NOT change for
153
+ * the life of the body. The rest is optional metadata that lets a consumer group / route bodies (e.g. a
154
+ * bridge keying host meshes off `host`, or an agent filtering by `kind`).
155
+ *
156
+ * DOCTRINE — identity is NOT:
157
+ * · display text (a heading's words are not its identity — they can change while identity holds);
158
+ * · necessarily a DOM `id` (a DOM id is one *source* of a stable id, not the concept);
159
+ * · an object reference (references don't survive a rescan or a serialize/replay round-trip).
160
+ * Snapshots, diffs, and relationships key on `identity.id`. When a body carries no supplied identity, the
161
+ * engine DERIVES a stable one deterministically (the element's DOM id, else a monotonic `body-N` counter —
162
+ * never `Math.random`, which is banned on the reproducible paths) so identity is always present and stable.
163
+ */
164
+ export interface FieldBodyIdentity {
165
+ /** the stable primary key — unique within the field, constant for the body's life. Equals the reading's
166
+ * top-level `id` (back-compat). Snapshot/diff/replay/relationships key on this. */
167
+ id: string;
168
+ /** optional grouping namespace (e.g. an app/module the body belongs to). Free-form; opaque to the engine. */
169
+ namespace?: string;
170
+ /** optional kind/type tag (e.g. `'card'`, `'heading'`, `'agent'`). Free-form; opaque to the engine. */
171
+ kind?: string;
172
+ /** optional host/owner tag (e.g. a renderer or view that owns the body's rendered object). Free-form. */
173
+ host?: string;
174
+ }
139
175
  /**
140
176
  * A registered DOM element acting as a force source (§3.1). Parsed from
141
177
  * `data-*` attributes; the runtime fields are refreshed each scan/frame.
142
178
  */
143
179
  export interface Body {
144
180
  el: HTMLElement;
181
+ /** FIRST-CLASS IDENTITY (see {@link FieldBodyIdentity}). Supplied via `addBody({ identity })` or the
182
+ * `identify` field option, else lazily DERIVED and cached the first time the body is keyed. Once
183
+ * resolved it is stable for the body's life; snapshots/diff/replay/relationships key on `identity.id`. */
184
+ identity?: FieldBodyIdentity;
145
185
  /** space-joined force ids from `data-body` (they compose, §4). */
146
186
  tokens: Token[];
147
187
  /** who owns this body's position (`data-authority`); default `'anchored'`. See {@link BodyAuthority}. */
@@ -183,6 +223,10 @@ export interface Body {
183
223
  * box, not its centre, so matter gathers in a shell around the shape (field-systems
184
224
  * Stage C). Undefined ⇒ point source (the default). */
185
225
  shaped?: boolean;
226
+ /** `data-charge-gated` (opt-in, #711) — restrict `fieldflow` to *charged* matter (`charge ≠ 0`),
227
+ * modelling magnetized plasma tied to the field line. Undefined/false ⇒ the default neutral-medium
228
+ * advection (fieldflow transports ALL matter). Only read by the `fieldflow` force. */
229
+ chargeGated?: boolean;
186
230
  /** `data-species` — the species tag this body stamps on matter it *emits* (a `spawn` source),
187
231
  * so multiple ecologies (pollen vs seeds vs spores) can share one field. Undefined ⇒ 0. */
188
232
  species?: number;
@@ -221,6 +265,10 @@ export interface Body {
221
265
  warpHas?: boolean;
222
266
  /** source mass M for `gravity`/`charge` (§20.10/§21). */
223
267
  M: number;
268
+ /** INERTIAL mass (substrate momentum, #872) — how hard the body is to *move*, distinct from `M` (how
269
+ * strongly it *emits*). Undefined ⇒ nominal 1 ⇒ byte-identical. Populated (∝ rendered area, clamped)
270
+ * only under `mass: 'area'`; the dynamic-body recoil integrator divides by `inertia ?? M`. */
271
+ inertia?: number;
224
272
  cx: number;
225
273
  cy: number;
226
274
  hw: number;
@@ -373,11 +421,22 @@ export interface Env {
373
421
  * semi-implicit Euler with per-frame decay (the default — unchanged). `'fixed'` is the opt-in
374
422
  * fixed-timestep integrator: additive force impulses and the `FRICTION`/`HEAT_DECAY` decays scale
375
423
  * with `dt`, so motion is frame-rate independent. At `dt === 1` (the reference rate, and every
376
- * golden/conformance run) the two are byte-identical, so opting in never moves the golden. */
424
+ * golden/conformance run) the two are byte-identical, so opting in never moves the golden.
425
+ * `'velocity-verlet'` (#659) is the opt-in second-order scheme: the position full-step uses the
426
+ * previous step's stored acceleration, the force pass evaluates a′ at the updated position, and
427
+ * the velocity takes the half-step average — see the integrator for the exact math and the
428
+ * velocity-dependence / kinematic-force approximations. It changes trajectories BY DESIGN once
429
+ * opted into; the default path never engages it. */
377
430
  integrator?: IntegratorMode;
431
+ /** INTERNAL (velocity-Verlet only): set by the central `applyForce` when a *kinematic*
432
+ * (velocity-REPLACING) force actually changed the current particle's velocity, and reset by the
433
+ * integrator at the top of each particle's force pass. A reflection / relaunch / teleport is a
434
+ * discontinuity, not an acceleration — the Verlet half-step average is skipped for that particle
435
+ * that step. Never touched on the `'legacy'`/`'fixed'` paths. */
436
+ kinTouch?: boolean;
378
437
  }
379
438
  /** The integration scheme for the field (see {@link Env.integrator}). */
380
- export type IntegratorMode = 'legacy' | 'fixed';
439
+ export type IntegratorMode = 'legacy' | 'fixed' | 'velocity-verlet';
381
440
  /**
382
441
  * A single force's contribution to one agent in one step, in one channel (substrate doc 04).
383
442
  * The unit the diagnostics (`causality`/`prediction`), Field Query, and Causal Replay consume:
@@ -526,6 +585,53 @@ export type ConditionRegistry = Record<string, Condition>;
526
585
  export type OverlayMode = 'off' | 'streamlines' | 'force-vectors' | 'field-lines' | 'grid' | 'temperature' | 'energy' | 'path' | 'data';
527
586
  /** One reading, or an additive stack of readings, for `setOverlay` / `FieldOptions.overlay`. */
528
587
  export type OverlayInput = OverlayMode | readonly OverlayMode[];
588
+ /**
589
+ * Consumable field-resource budgets — upper bounds a host/session/user/app sets on what the field is
590
+ * PERMITTED to spend, distinct from what doctrine *allows* (that is governance — static lint). Each is
591
+ * optional; an unset budget means "unbounded / engine default". Values are normalized `0..1` unless the
592
+ * one-line note says otherwise. Carried on {@link FieldPolicy.budgets}.
593
+ *
594
+ * WIRED today: `motion` (folds into the effective motion allowance alongside reduced-motion + perf
595
+ * pressure) and `privacy` (gates body `data` in snapshots). The rest are DECLARED-not-yet-enforced —
596
+ * accepted and carried on the policy for host/tooling introspection, wired as their consumers land.
597
+ */
598
+ export interface FieldBudgets {
599
+ /** WIRED. `0..1` cap on how much motion the field may express; `0` behaves as reduced-motion (frozen). */
600
+ motion?: number;
601
+ /** DECLARED. `0..1` cap on applied force magnitude — the share of the impulse budget matter may absorb. */
602
+ force?: number;
603
+ /** DECLARED. `0..1` cap on conserved-attention spend (§2.4) — the finite focus budget. */
604
+ attention?: number;
605
+ /** DECLARED. `0..1` cap on thermal/heat accumulation the field may carry. */
606
+ thermal?: number;
607
+ /** DECLARED. `0..1` cap on render cost the field may spend (draw layers / fill). */
608
+ render?: number;
609
+ /** WIRED. `0..1` privacy budget; below the `PRIVACY_DATA_THRESHOLD` (0.5) snapshots withhold body `data`. */
610
+ privacy?: number;
611
+ /** DECLARED. `0..1` accessibility floor — the minimum non-motion legibility the field must preserve. */
612
+ accessibility?: number;
613
+ /** DECLARED. `0..1` cap on how much field state agent readers (query/snapshot/agent-json) may consume. */
614
+ agentRead?: number;
615
+ }
616
+ /**
617
+ * Runtime FIELD POLICY — what THIS host / session / user / app PERMITS, evaluated live. Distinct lane
618
+ * from GOVERNANCE (what doctrine allows — static lint): policy can only tighten, never loosen, the
619
+ * accessibility floor (reduced-motion always wins; a policy can lower motion but never raise it above
620
+ * what the host/user reduced-motion state allows). Set at creation via {@link FieldOptions.policy} and
621
+ * live via {@link FieldHandle.setPolicy}; read via {@link FieldHandle.policy}. Purely additive — a field
622
+ * with no policy behaves exactly as before.
623
+ */
624
+ export interface FieldPolicy {
625
+ /** permit body `data` to appear in snapshots (default: fall through to `FieldSnapshotOptions.includeData`). */
626
+ allowBodyDataInSnapshots?: boolean;
627
+ /** permit motion-expressing projections/animation at all; `false` pins the effective motion budget to 0. */
628
+ allowMotionProjection?: boolean;
629
+ /** `0..1` host/session cap on motion; folded (via `min`) with reduced-motion + perf pressure into the
630
+ * effective motion allowance the integrator/easing path reads. Reduced-motion can only lower it. */
631
+ maxMotionBudget?: number;
632
+ /** consumable-resource budgets (see {@link FieldBudgets}). */
633
+ budgets?: Partial<FieldBudgets>;
634
+ }
529
635
  export interface FieldOptions {
530
636
  /** travelling accent color (§9). */
531
637
  accent?: string;
@@ -540,11 +646,14 @@ export interface FieldOptions {
540
646
  */
541
647
  depth?: number;
542
648
  /** the integration scheme (substrate doc 04 §Step 3); default `'legacy'`. `'fixed'` opts into the
543
- * frame-rate-independent fixed-timestep integrator (additive impulses and decay scale with `dt`).
544
- * Identical to legacy at the reference frame rate — see {@link Env.integrator}. */
649
+ * frame-rate-independent fixed-timestep integrator (additive impulses and decay scale with `dt`);
650
+ * identical to legacy at the reference frame rate. `'velocity-verlet'` (#659) opts into the
651
+ * second-order velocity-Verlet scheme (higher positional accuracy; trajectories differ by
652
+ * design). See {@link Env.integrator}. */
545
653
  integrator?: IntegratorMode;
546
- /** draw the background Currents (§24); default true. Set false for the bare
547
- * free-particle field with no carrier waves. */
654
+ /** draw the background Currents (§24); default **false** (opt-in, #979 — the signals-first
655
+ * companion to `render: 'none'`). A bare field has no carrier waves; set true for the ambient
656
+ * resting structure + the bound shimmer reservoir. */
548
657
  waves?: boolean;
549
658
  /** wave layout style: `'linear'` (default horizontal lines) or `'circular'` (concentric orbits around a center). */
550
659
  waveStyle?: 'linear' | 'circular';
@@ -571,13 +680,87 @@ export interface FieldOptions {
571
680
  * dots), 'streamlines' (draw the force field itself — diagnostic, REPLACES the dots),
572
681
  * 'flow' (the dots AND the streamlines drawn together in the one underlay canvas —
573
682
  * particles drifting along the visible flow, with no separate front surface and no
574
- * `mix-blend`, so it stays a single cheap layer). */
575
- render?: 'dots' | 'trails' | 'links' | 'metaballs' | 'voronoi' | 'streamlines' | 'flow' | 'none';
576
- /** first-class mass (§21.3): when true, particle mass ∝ size and body forces
577
- * accelerate by `a = F/m` (heavier matter moves less). Default false (unit mass). */
683
+ * `mix-blend`, so it stays a single cheap layer), 'knockout' (figure-ground inversion:
684
+ * an accent field wash with matter punched out as negative space — clip the canvas to
685
+ * type with a host CSS mask for the field-inside-letters treatment, #667), 'redshift'
686
+ * (dots tinted by spectral shift — Doppler from radial velocity + gravitational red
687
+ * near body wells, #668), 'blackbody' (dots tinted by energy on a thermal ramp, ember
688
+ * → white → blue-white, #669), 'depth' (the z lane made visible: far-to-near painter's
689
+ * sorting, perspective parallax, defocus with distance — pairs with `depth > 0`, #670). */
690
+ render?: 'dots' | 'trails' | 'links' | 'metaballs' | 'voronoi' | 'streamlines' | 'flow' | 'knockout' | 'redshift' | 'blackbody' | 'depth' | 'none';
691
+ /**
692
+ * DECLARED render reference point (Wallpaper Rule, #975): the center of the cool→warm heat
693
+ * vignette the `dots`/`depth` swarm is tinted against — a body far from this point reads warm,
694
+ * a body near it reads cool. Given as viewport FRACTIONS `{ x, y }` ∈ [0,1] (resolved to pixels
695
+ * against the live canvas each frame, so it tracks resize). Formerly a hardcoded `(W/2, H·0.4)`
696
+ * painted into the draw path (a content-independent "gray debt"): the default `{ x: 0.5, y: 0.4 }`
697
+ * reproduces it exactly, so the default render is byte-identical. Only affects the `dots`/`depth`
698
+ * render modes. **Experimental.** */
699
+ heatCenter?: {
700
+ x: number;
701
+ y: number;
702
+ };
703
+ /**
704
+ * DECLARED render reference point (Wallpaper Rule, #975): the OBSERVER the `redshift` mode
705
+ * measures each particle's radial velocity against — receding matter reddens, approaching matter
706
+ * blues, at-rest at the observer. Given as viewport FRACTIONS `{ x, y }` ∈ [0,1] (resolved to
707
+ * pixels against the live canvas each frame). Formerly a hardcoded `(W/2, H/2)` (a "gray debt"):
708
+ * the default `{ x: 0.5, y: 0.5 }` reproduces it exactly, so the `redshift` render is byte-identical.
709
+ * Only affects the `redshift` render mode. **Experimental.** */
710
+ redshiftObserver?: {
711
+ x: number;
712
+ y: number;
713
+ };
714
+ /**
715
+ * DECLARED render reference point (Wallpaper Rule, #975): the perspective focal length (in CSS px)
716
+ * of the `depth` mode's camera — the size/parallax recession the z lane is projected through. A
717
+ * larger focal flattens the perspective (a longer lens); a smaller one exaggerates it. Formerly a
718
+ * hardcoded `FOCAL = 480` (a "gray debt"): the default `480` reproduces it exactly, so the `depth`
719
+ * render is byte-identical. Only affects the `depth` render mode (pairs with `depth > 0`).
720
+ * **Experimental.** */
721
+ depthFocal?: number;
722
+ /**
723
+ * DECLARED page-layout reference (Wallpaper Rule, #975): how the density `heatmap` glow fades out
724
+ * as the page scrolls past the hero. `start` is the scroll position (in VIEWPORTS, `scrollY / H`)
725
+ * at which the fade begins, `span` is how many viewports it takes to reach fully transparent — the
726
+ * layer is full above `start·H` and gone by `(start + span)·H`. Formerly a hardcoded
727
+ * `(1.15 - scrollY/H)/0.85` baked into a core draw path — a "content = first viewport" assumption
728
+ * (a "gray debt"): the default `{ start: 0.3, span: 0.85 }` reproduces it exactly (the historical
729
+ * curve is full through `1.15 - 0.85 = 0.3` viewports and gone by `1.15`), so the heatmap glow is
730
+ * byte-identical. Set a large `span` to disable the scroll fade. Only affects the density `heatmap`
731
+ * layer. **Experimental.** */
732
+ heatmapFade?: {
733
+ start: number;
734
+ span: number;
735
+ };
736
+ /** first-class mass (§21.3): when true, particle mass ∝ size and body forces accelerate by `a = F/m`
737
+ * (heavier matter moves less). Also gives DYNAMIC bodies inertial mass ∝ rendered area (#872), so a
738
+ * big heading recoils slowly and a small tag snaps. Default false (unit mass, byte-identical). */
578
739
  mass?: boolean;
740
+ /** Newtonian own-emission reaction (substrate momentum, #873): when true, a DYNAMIC body feels the
741
+ * equal-and-opposite of the net impulse it imparts to nearby matter (a directional emitter recoils
742
+ * like a rocket; reciprocity closes through *motion*, not just feedback). Best paired with `mass`
743
+ * (recoil ÷ inertial mass). Default false ⇒ byte-identical. **Experimental.** */
744
+ reaction?: boolean;
579
745
  /** strength of particle-to-particle separation/repulsion force (0 to 1, default 0). */
580
746
  separation?: number;
747
+ /**
748
+ * DECLARED ambient bias (Wallpaper Rule, #978): the resting `ambient` formation's tangential
749
+ * swirl injected into `attract` bodies (`Formation.orbit`) — the gentle spiral free matter
750
+ * traces around a well at rest. Formerly a hardcoded `0.1` painted into the default formation
751
+ * preset (a "gray debt": a content-independent constant inside an honest feature). Now a
752
+ * documented, opt-in dial with the historical value as its default, so behavior is unchanged;
753
+ * set `0` for a purely radial resting attract (no spiral), or raise it for a stronger orbit.
754
+ * Applies to the `ambient` formation only (the section formations keep their authored presets);
755
+ * `<field-root ambient-orbit>`. Default `0.1`. */
756
+ ambientOrbit?: number;
757
+ /**
758
+ * DECLARED ambient bias (Wallpaper Rule, #978): the resting `ambient` formation's `wander`
759
+ * term — the per-particle drift that keeps resting matter alive rather than frozen. Formerly a
760
+ * hardcoded `1.0` in the default formation preset. Now a documented, opt-in dial defaulting to
761
+ * the historical value (behavior unchanged); lower it for a calmer rest, `0` to still the drift.
762
+ * Applies to the `ambient` formation only; `<field-root ambient-wander>`. Default `1.0`. */
763
+ ambientWander?: number;
581
764
  /** color template for the travelling accent (§9): a built-in name
582
765
  * (`'ours'` · `'heatmap'` · `'infrared'` · `'spectrum'`) or custom hex stops. */
583
766
  palette?: string | readonly string[];
@@ -613,6 +796,17 @@ export interface FieldOptions {
613
796
  * provides the canvas, core only draws. Default unset → no overlay surface.
614
797
  */
615
798
  overlayCanvas?: HTMLCanvasElement;
799
+ /**
800
+ * Field Surfaces (overlay placement, #676): a lazy alternative to `overlayCanvas`. When no
801
+ * `overlayCanvas` is bound, core calls this provider ONCE — the first time an overlay reading actually
802
+ * becomes active (a non-`off` `setOverlay`, or `setRender` leaving `'none'` with a reading already
803
+ * set) — to obtain the surface. This lets a host (e.g. `<field-root>`) defer creating its
804
+ * full-viewport, mix-blend light-DOM canvas until an overlay is switched on, so the common
805
+ * `overlay: off` path never puts a canvas into the compositing tree at boot. Return `null` to decline
806
+ * (stays surface-less). Ignored when `overlayCanvas` is set. Keeps core DOM-free — the host still owns
807
+ * the element and its CSS placement.
808
+ */
809
+ overlayCanvasProvider?: () => HTMLCanvasElement | null;
616
810
  /** initial overlay visualization mode (Field Surfaces); default `'off'`. */
617
811
  overlay?: OverlayInput;
618
812
  /**
@@ -658,6 +852,21 @@ export interface FieldOptions {
658
852
  * you; inject a custom host for a headless renderer / different document / tests.
659
853
  */
660
854
  host?: FieldHost;
855
+ /**
856
+ * Initial runtime {@link FieldPolicy} — what this host/session/user/app PERMITS (runtime rules),
857
+ * distinct from governance (what doctrine allows). Change it live with {@link FieldHandle.setPolicy}.
858
+ * Purely additive — omit for the unbounded default. */
859
+ policy?: FieldPolicy;
860
+ /**
861
+ * FIRST-CLASS IDENTITY resolver (substrate critical path): derive a {@link FieldBodyIdentity} for a
862
+ * DOM-scanned body from its element. Called once per body, the first time the body is keyed; the
863
+ * returned identity is cached and used for query/snapshot/diff/replay/relationship keying. Return
864
+ * `undefined` (or omit the option) to fall back to the default derivation (the element's DOM `id`,
865
+ * else a monotonic `body-N`). The `id` a resolver returns MUST be unique within the field and stable
866
+ * for the body's life. Programmatic `addBody({ identity })` overrides this. Purely additive — a field
867
+ * with no `identify` behaves exactly as before.
868
+ */
869
+ identify?: (el: HTMLElement) => FieldBodyIdentity | undefined;
661
870
  }
662
871
  /** Per-element feedback values the engine produces each frame (Phase D3 seam). */
663
872
  export interface FeedbackChannels {
@@ -665,7 +874,7 @@ export interface FeedbackChannels {
665
874
  density?: number;
666
875
  /** the ambient heatmap density at the body → `--field-heatmap-density`. */
667
876
  heatmapDensity?: number;
668
- /** sink accretion fill ∈ [0,1] → `--load` / `--mass`. */
877
+ /** sink accretion fill ∈ [0,1] → `--load`. */
669
878
  load?: number;
670
879
  /** cross-boundary lit signal ∈ [0,1] → `--lit` + thresholded `field:lit` / `field:dim`. */
671
880
  lit?: number;
@@ -708,6 +917,11 @@ export interface AgentHandle {
708
917
  export interface BodySpec {
709
918
  /** the force ids this body emits (space-joined string or array), e.g. `'attract swirl'`. */
710
919
  tokens: string | readonly string[];
920
+ /** FIRST-CLASS IDENTITY for this programmatic body (see {@link FieldBodyIdentity}). Supply a stable
921
+ * `id` (unique in the field) plus optional `namespace`/`kind`/`host`, so snapshots/diff/replay and a
922
+ * bridge can reference this body by identity rather than the returned handle. A bare string is shorthand
923
+ * for `{ id }`. Omitted ⇒ the engine derives a stable synthetic `body-N`. */
924
+ identity?: FieldBodyIdentity | string;
711
925
  /** who owns this body's position; default `'anchored'`. See {@link BodyAuthority}. */
712
926
  authority?: BodyAuthority;
713
927
  /** overall force magnitude (scales every token). */
@@ -814,8 +1028,12 @@ export interface FieldQuery {
814
1028
  }
815
1029
  /** A body as seen by a query — identity, box, active tokens, and its measured metrics/dimensions. */
816
1030
  export interface FieldBodyReading {
817
- /** stable id: the element's `id` when present, else a per-field synthetic (`body-N`). */
1031
+ /** stable id: the element's `id` when present, else a per-field synthetic (`body-N`). Equals
1032
+ * `identity.id`. Kept as the top-level field for back-compat; new consumers may read `identity`. */
818
1033
  id: string;
1034
+ /** the body's resolved FIRST-CLASS IDENTITY (see {@link FieldBodyIdentity}). `identity.id === id`;
1035
+ * `namespace`/`kind`/`host` carry any supplied structured metadata. Always present. */
1036
+ identity: FieldBodyIdentity;
819
1037
  /** the body's box in field coordinates, when measured. */
820
1038
  rect?: FieldRect;
821
1039
  /** the composed force ids (the `data-body` tokens). */
@@ -881,6 +1099,19 @@ export interface FieldQueryResult {
881
1099
  /** the lens id this reading was scoped through, when a `lens` was supplied (substrate query phase 2). */
882
1100
  lens?: string;
883
1101
  }
1102
+ /**
1103
+ * A named **snapshot profile** — a concrete inclusion preset for {@link FieldHandle.snapshot}, resolved
1104
+ * to the TIGHTEST (most private) combination of its base inclusions, any explicit `include*` flags, and
1105
+ * the runtime {@link FieldPolicy} privacy budget. A profile can only tighten a call; it never widens past
1106
+ * what policy allows.
1107
+ *
1108
+ * - `'debug'` — everything: particles, relationships, influences, and body `data` (still gated by policy).
1109
+ * - `'agent'` — the Software-Agent read: stable ids + metrics + relationships + influence attribution +
1110
+ * projections, but NO opaque body `data` (raw/user-identifying payloads withheld regardless of `includeData`).
1111
+ * - `'bug-report'` — structural + versions (relationships + influences), no user data.
1112
+ * - `'public'` — minimal: ids + shape (bodies/metrics/projections), no relationships, influences, or data.
1113
+ */
1114
+ export type SnapshotProfile = 'debug' | 'agent' | 'bug-report' | 'public';
884
1115
  /** Options for {@link FieldHandle.snapshot}. */
885
1116
  export interface FieldSnapshotOptions {
886
1117
  /** include the raw particle pool (heavier; off by default for lightweight exports). */
@@ -892,10 +1123,57 @@ export interface FieldSnapshotOptions {
892
1123
  /** include per-body force attribution (each body's own forces at its centre, via the impulse
893
1124
  * accumulator) so a later `replay()` can derive `cause: 'force'` steps. Off by default. */
894
1125
  includeInfluences?: boolean;
1126
+ /** apply a named {@link SnapshotProfile} preset. Composes with the explicit `include*` flags and the
1127
+ * {@link FieldPolicy} privacy budget, always resolving to the TIGHTEST (most private) result — a
1128
+ * profile can never widen past what policy or an explicit deny allows. */
1129
+ profile?: SnapshotProfile;
1130
+ }
1131
+ /**
1132
+ * A scoped read CAPABILITY an {@link AgentFieldView} grants. Each names one dimension of the field's
1133
+ * read surface; a capability set is an allow-list — a dimension the caps don't include is stripped from
1134
+ * every reading (it tightens, never widens). Read-only throughout — there is no write capability, because
1135
+ * *agent-readable is not agent-writable* (see `docs/canonical/agent-consumption-model.md`).
1136
+ */
1137
+ export type AgentCapability = 'read:metrics' | 'read:relationships' | 'read:influences' | 'read:snapshots' | 'read:body-data' | 'read:projections' | 'read:diagnostics' | 'read:replay';
1138
+ /** Options for {@link FieldHandle.forAgent} — the capability grant + optional redaction list. */
1139
+ export interface AgentViewOptions {
1140
+ /** the capabilities this agent view grants. An allow-list: any dimension not listed is stripped from
1141
+ * every reading. An empty set yields the most-restricted view (ids + shape only). */
1142
+ capabilities: AgentCapability[];
1143
+ /** dotted paths stripped from every reading AFTER capability scoping (e.g. `'body.data'`, `'host.user'`,
1144
+ * `'metrics.temperature'`). `body.*` / `relationship.*` / `influence.*` / `projection.*` prefixes address
1145
+ * the per-entry shape of each list; a bare top-level key addresses the result/snapshot itself. */
1146
+ redactions?: string[];
1147
+ }
1148
+ /**
1149
+ * A READ-ONLY facade over a field, scoped to a set of {@link AgentCapability}s — the surface a Software
1150
+ * Agent uses to read the field safely. It exposes ONLY scoped `query()` / `snapshot()` (and `replay()`
1151
+ * when `read:replay` is granted). It has NO mutation methods — no `applyForce`, no `addBody`, no
1152
+ * `setPolicy` — enforced by the facade's very shape: *agent-readable is not agent-writable*. Every
1153
+ * reading is tightened to the granted capabilities, then any `redactions` paths are stripped, and the
1154
+ * result can never widen past what the field's {@link FieldPolicy} already permits.
1155
+ */
1156
+ export interface AgentFieldView {
1157
+ /** the granted capabilities (a frozen copy). */
1158
+ readonly capabilities: readonly AgentCapability[];
1159
+ /** the redaction paths (a frozen copy). */
1160
+ readonly redactions: readonly string[];
1161
+ /** a capability-scoped, redacted {@link FieldQueryResult}. Dimensions the caps don't grant are absent
1162
+ * (no `read:influences` → no influences; no `read:relationships` → no relationships; etc.). */
1163
+ query(q?: FieldQuery): FieldQueryResult;
1164
+ /** a capability-scoped, redacted {@link FieldSnapshot}. Body `data` is withheld unless `read:body-data`
1165
+ * is granted (and policy permits it); a `profile`/`include*` request can only tighten from here. */
1166
+ snapshot(opts?: FieldSnapshotOptions): FieldSnapshot;
1167
+ /** narrate how the field changed between two snapshots — present ONLY when `read:replay` is granted
1168
+ * (otherwise `undefined`, so the facade's shape reflects the grant). */
1169
+ replay?(a: FieldSnapshot, b: FieldSnapshot, opts?: ReplayOptions): CausalReplay;
895
1170
  }
896
1171
  /** A body captured in a {@link FieldSnapshot}. */
897
1172
  export interface FieldBodySnapshot {
1173
+ /** stable id — equals `identity.id`; snapshot/diff/replay key on it. */
898
1174
  id: string;
1175
+ /** the body's resolved FIRST-CLASS IDENTITY (see {@link FieldBodyIdentity}). Always present. */
1176
+ identity: FieldBodyIdentity;
899
1177
  /** who owns this body's position (see {@link BodyAuthority}); `'anchored'` by default. */
900
1178
  authority?: BodyAuthority;
901
1179
  /** the body's box in field coordinates (anchored bodies). */
@@ -1154,6 +1432,23 @@ export interface FieldHandle {
1154
1432
  * quality. The platform runtime forwards the governor's tier automatically; call it directly for a
1155
1433
  * custom quality policy. */
1156
1434
  setQualityTier(tier: number): void;
1435
+ /** the field's current runtime {@link FieldPolicy} (a frozen copy). `{}` when none was set. */
1436
+ readonly policy: FieldPolicy;
1437
+ /** Replace the runtime {@link FieldPolicy} live — what this host/session/user/app PERMITS. This is a
1438
+ * REPLACE (not a merge): pass the full policy you want in effect (`{}` clears to the unbounded
1439
+ * default). Takes effect from the next frame. The motion budget it carries folds (via `min`) with
1440
+ * reduced-motion + perf pressure — reduced-motion always wins, so a policy can lower motion but never
1441
+ * raise it. The privacy budget gates body `data` in `snapshot()`. */
1442
+ setPolicy(policy: FieldPolicy): void;
1443
+ /**
1444
+ * Derive a READ-ONLY {@link AgentFieldView} scoped to a set of {@link AgentCapability}s — the safe
1445
+ * surface a Software Agent uses to read the field. The returned facade exposes ONLY scoped
1446
+ * `query()` / `snapshot()` (and `replay()` when `read:replay` is granted); it has NO mutation methods.
1447
+ * Readings are tightened to the granted capabilities, then any `redactions` paths are stripped, and the
1448
+ * result can never widen past what the field's {@link FieldPolicy} already permits. Purely additive —
1449
+ * `forAgent` reads the same live field; it does not fork or copy it.
1450
+ */
1451
+ forAgent(opts: AgentViewOptions): AgentFieldView;
1157
1452
  /**
1158
1453
  * Switch the underlay render mode (§20.6) live — the surface behind content. `'none'` is the
1159
1454
  * signals-only mode (§13.7 / #297): drawing stops from the next frame while the simulation and
@@ -1161,7 +1456,7 @@ export interface FieldHandle {
1161
1456
  * backing store (the no-allocation guarantee belongs to fields CREATED with `render: 'none'`);
1162
1457
  * switching FROM `'none'` acquires the context lazily and sizes the backing store at that moment.
1163
1458
  */
1164
- setRender(mode: 'dots' | 'trails' | 'links' | 'metaballs' | 'voronoi' | 'streamlines' | 'flow' | 'none'): void;
1459
+ setRender(mode: 'dots' | 'trails' | 'links' | 'metaballs' | 'voronoi' | 'streamlines' | 'flow' | 'knockout' | 'redshift' | 'blackbody' | 'depth' | 'none'): void;
1165
1460
  /**
1166
1461
  * Render field READINGS on the OVERLAY surface — in front of page content (Field Surfaces). Pairs
1167
1462
  * with `setRender` (the underlay); set both for an immersive look. No-op unless the field was created