@fundamental-engine/core 0.9.1 → 0.9.2

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 (48) hide show
  1. package/dist/contracts/passport.d.ts +6 -0
  2. package/dist/contracts/passport.d.ts.map +1 -1
  3. package/dist/contracts/passport.js +3 -3
  4. package/dist/contracts/passport.js.map +1 -1
  5. package/dist/core/field-snapshot.d.ts +21 -0
  6. package/dist/core/field-snapshot.d.ts.map +1 -0
  7. package/dist/core/field-snapshot.js +0 -0
  8. package/dist/core/field-snapshot.js.map +1 -0
  9. package/dist/core/field.d.ts.map +1 -1
  10. package/dist/core/field.js +334 -1
  11. package/dist/core/field.js.map +1 -1
  12. package/dist/core/governance.d.ts +20 -0
  13. package/dist/core/governance.d.ts.map +1 -0
  14. package/dist/core/governance.js +77 -0
  15. package/dist/core/governance.js.map +1 -0
  16. package/dist/core/integrator.d.ts +20 -1
  17. package/dist/core/integrator.d.ts.map +1 -1
  18. package/dist/core/integrator.js +115 -16
  19. package/dist/core/integrator.js.map +1 -1
  20. package/dist/core/lane-registry.d.ts +14 -0
  21. package/dist/core/lane-registry.d.ts.map +1 -0
  22. package/dist/core/lane-registry.js +64 -0
  23. package/dist/core/lane-registry.js.map +1 -0
  24. package/dist/core/projection-agent-json.d.ts +12 -0
  25. package/dist/core/projection-agent-json.d.ts.map +1 -0
  26. package/dist/core/projection-agent-json.js +37 -0
  27. package/dist/core/projection-agent-json.js.map +1 -0
  28. package/dist/core/query-lens.d.ts +6 -0
  29. package/dist/core/query-lens.d.ts.map +1 -0
  30. package/dist/core/query-lens.js +24 -0
  31. package/dist/core/query-lens.js.map +1 -0
  32. package/dist/core/scanner.d.ts +1 -1
  33. package/dist/core/scanner.d.ts.map +1 -1
  34. package/dist/core/scanner.js +5 -0
  35. package/dist/core/scanner.js.map +1 -1
  36. package/dist/core/types.d.ts +459 -0
  37. package/dist/core/types.d.ts.map +1 -1
  38. package/dist/diagnostics/probes.d.ts +11 -1
  39. package/dist/diagnostics/probes.d.ts.map +1 -1
  40. package/dist/diagnostics/probes.js +48 -8
  41. package/dist/diagnostics/probes.js.map +1 -1
  42. package/dist/index.d.ts +5 -0
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +5 -0
  45. package/dist/index.js.map +1 -1
  46. package/dist/version.d.ts +1 -1
  47. package/dist/version.js +1 -1
  48. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../../src/core/scanner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAUvC,yEAAyE;AACzE,MAAM,WAAW,SAAS;IACxB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC7C,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED,yEAAyE;AACzE,MAAM,MAAM,UAAU,GAAG,IAAI,CAC3B,IAAI,EACF,QAAQ,GACR,UAAU,GACV,OAAO,GACP,SAAS,GACT,UAAU,GACV,MAAM,GACN,OAAO,GACP,IAAI,GACJ,IAAI,GACJ,MAAM,GACN,UAAU,GACV,QAAQ,GACR,SAAS,GACT,SAAS,GACT,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,WAAW,GACX,MAAM,GACN,KAAK,GACL,UAAU,GACV,WAAW,GACX,YAAY,GACZ,GAAG,CACN,CAAC;AAEF,4EAA4E;AAC5E,wBAAgB,eAAe,CAAC,CAAC,EAAE,SAAS,GAAG,UAAU,CAkExD;AAqBD;8EAC8E;AAC9E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,CAGvD;AAUD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,SAAW,GAAG,IAAI,CAYvE;AA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U,GACV,WAAW,GACX,YAAY,GACZ,GAAG,CACN,CAAC;AAEF,4EAA4E;AAC5E,wBAAgB,eAAe,CAAC,CAAC,EAAE,SAAS,GAAG,UAAU,CAuExD;AAqBD;8EAC8E;AAC9E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,CAGvD;AAUD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,SAAW,GAAG,IAAI,CAYvE;AA8BD;sFACsF;AACtF,wBAAgB,eAAe,CAAC,EAAE,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,IAAI,CAExE;AAgBD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CA6B/D;AAED;;;;;GAKG;AACH,eAAO,MAAM,aAAa,sHAC2F,CAAC;AAEtH;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,EAAE,CAExD;AAED;;+CAE+C;AAC/C,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,EAAE,CAkBnD;AA0CD,wBAAgB,aAAa,CAC3B,MAAM,EAAE,SAAS,IAAI,EAAE,EACvB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,OAAO,SAAI,EACX,OAAO,SAAI,GACV,IAAI,CAmBN"}
@@ -28,8 +28,13 @@ export function parseBodyParams(a) {
28
28
  const life = Number.parseFloat(lifeRaw ?? '');
29
29
  const cap = Number.parseFloat(capRaw ?? '');
30
30
  const budgeted = lifeRaw != null || capRaw != null || a.has('budget') || a.has('sink');
31
+ // body-authority (substrate doc 04): data-authority = anchored (default) | kinematic | dynamic.
32
+ // Anything else (incl. absent) ⇒ anchored. A declaration today — anchored/kinematic behave as before.
33
+ const authRaw = a.get('authority');
34
+ const authority = authRaw === 'kinematic' || authRaw === 'dynamic' ? authRaw : 'anchored';
31
35
  return {
32
36
  tokens,
37
+ authority,
33
38
  classified,
34
39
  ...(Number.isFinite(life) && life > 0 ? { life } : {}),
35
40
  ...(Number.isFinite(cap) && cap > 0 ? { cap } : {}),
@@ -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;AAuCrD,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,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;IAChD,MAAM,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,MAAM,IAAI,GACR,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAA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,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"}
@@ -27,6 +27,21 @@ export interface Vec2 {
27
27
  x: number;
28
28
  y: number;
29
29
  }
30
+ /** A 3D vector — the optional z lane (a `depth > 0` field) and the accumulator's linear channel. */
31
+ export interface Vec3 {
32
+ x: number;
33
+ y: number;
34
+ z: number;
35
+ }
36
+ /** An axis-aligned rectangle in field coordinates, `DOMRect`-shaped (x/y/width/height) so a caller
37
+ * can pass `el.getBoundingClientRect()` straight into a {@link FieldQuery}'s `at`. (Distinct from the
38
+ * engine-internal {@link Rect} in geometry, which is centre + half-extents.) */
39
+ export interface FieldRect {
40
+ x: number;
41
+ y: number;
42
+ width: number;
43
+ height: number;
44
+ }
30
45
  /** A force id. Open string so the registry can be extended (§20), but the
31
46
  * canonical set is enumerated in `config/forces.config.ts`. */
32
47
  export type Token = string;
@@ -60,6 +75,15 @@ export interface Particle {
60
75
  */
61
76
  z?: number;
62
77
  vz?: number;
78
+ /**
79
+ * OPTIONAL ORIENTATION LANE (substrate doc 04 §Step 6): `orient` is the particle's angle (radians,
80
+ * about the z axis) and `spin` its angular velocity. Undefined ⇒ no orientation ⇒ byte-identical to
81
+ * the spin-less engine — exactly the z-lane discipline. Only a `torque`-style force ever writes
82
+ * `spin`; the integrator advances `orient += spin · dt` (and damps) only when `spin` is defined.
83
+ * Renderers may ignore it; nothing in the base field depends on a particle facing a direction.
84
+ */
85
+ orient?: number;
86
+ spin?: number;
63
87
  /** inertial mass — 1 = nominal (§21). */
64
88
  m: number;
65
89
  /** ∈ [0,1]; drives color (toward accent), size, and glow (§2.2). */
@@ -102,6 +126,16 @@ export interface AtomPayload {
102
126
  readonly weight?: number;
103
127
  readonly [key: string]: unknown;
104
128
  }
129
+ /**
130
+ * Who owns a body's position (substrate doc 04 §body-authority). `anchored` (default) — the DOM/host
131
+ * rect is authoritative, re-measured each frame (today's behavior for all bodies). `kinematic` — the
132
+ * engine writes the body's visual transform while the DOM stays the rendered object (the shipped
133
+ * `data-move` / transform pattern). `dynamic` — the engine owns position/velocity: the body integrates
134
+ * under the net field each frame and moves (recoil / field-to-body coupling, doc 04 §Step 5). Anchored
135
+ * and kinematic behave exactly as before. (Literal momentum-recoil from the body's own emission, torque,
136
+ * and conservation are later refinements.)
137
+ */
138
+ export type BodyAuthority = 'anchored' | 'kinematic' | 'dynamic';
105
139
  /**
106
140
  * A registered DOM element acting as a force source (§3.1). Parsed from
107
141
  * `data-*` attributes; the runtime fields are refreshed each scan/frame.
@@ -110,6 +144,16 @@ export interface Body {
110
144
  el: HTMLElement;
111
145
  /** space-joined force ids from `data-body` (they compose, §4). */
112
146
  tokens: Token[];
147
+ /** who owns this body's position (`data-authority`); default `'anchored'`. See {@link BodyAuthority}. */
148
+ authority?: BodyAuthority;
149
+ /** engine-owned position + velocity for a `dynamic` body (substrate doc 04 §Step 5 — recoil). Lazily
150
+ * initialized from the body's first measured centre, then integrated under the net field each frame
151
+ * and written back to `cx`/`cy` (so `measureBodies`' per-frame rect overwrite doesn't reset it).
152
+ * Untouched for anchored/kinematic bodies. */
153
+ bx?: number;
154
+ by?: number;
155
+ bvx?: number;
156
+ bvy?: number;
113
157
  /** `tokens` split into `{ modifiers, forces, sources }` per the modifier contract
114
158
  * (workover v0.3). The scanner fills it at parse time; the integrator memoizes it
115
159
  * lazily for bodies built elsewhere (conformance, tests). Modifiers carry the
@@ -315,6 +359,78 @@ export interface Env {
315
359
  * follows under `fieldflow`. Set by the integrator each step from the live bodies; absent
316
360
  * in bare/probe envs, where a field-following force simply no-ops. */
317
361
  fieldAt?(x: number, y: number): Vec2;
362
+ /**
363
+ * OPT-IN impulse accumulator (substrate critical path, doc 04). When present, the
364
+ * integrator's central `applyForce` records each force's per-particle contribution here
365
+ * (net + per-force attribution) WITHOUT changing the integration math — the force still
366
+ * updates velocity as before. Absent on the default hot path (zero overhead, byte-identical
367
+ * behavior); a diagnostic / Field-Query probe sets it to read structured attribution. The
368
+ * shape is dimension-aware from day one so orientation/time/semantic channels are not painted
369
+ * into a corner, even though only `linear` is populated today. Read-only contract: setting
370
+ * `accum` never alters how matter moves. */
371
+ accum?: FieldImpulseAccumulator;
372
+ /** The integration scheme (substrate doc 04 §Step 3). `undefined`/`'legacy'` is the shipped
373
+ * semi-implicit Euler with per-frame decay (the default — unchanged). `'fixed'` is the opt-in
374
+ * fixed-timestep integrator: additive force impulses and the `FRICTION`/`HEAT_DECAY` decays scale
375
+ * 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. */
377
+ integrator?: IntegratorMode;
378
+ }
379
+ /** The integration scheme for the field (see {@link Env.integrator}). */
380
+ export type IntegratorMode = 'legacy' | 'fixed';
381
+ /**
382
+ * A single force's contribution to one agent in one step, in one channel (substrate doc 04).
383
+ * The unit the diagnostics (`causality`/`prediction`), Field Query, and Causal Replay consume:
384
+ * "this matter moved 0.42 in linear x because of `attract`."
385
+ */
386
+ export interface ForceAttribution {
387
+ /** the contributing force token (`Force.token`). */
388
+ force: Token;
389
+ /** which channel the contribution lands in. Only `linear` is populated today. */
390
+ channel: 'linear' | 'angular' | 'thermal' | 'temporal' | 'semantic' | 'constraint';
391
+ /** the contribution value — a `{x,y,z}` Δv for `linear`; a scalar for `thermal`. */
392
+ contribution: {
393
+ x: number;
394
+ y: number;
395
+ z: number;
396
+ } | number;
397
+ /** dimensions this force couples, if any (the coupling passport, doc 04 / dimensional-coupling). */
398
+ couplesDimensions?: string[];
399
+ }
400
+ /**
401
+ * A dimension-aware impulse accumulator (substrate doc 04). Collects per-force contributions for
402
+ * one agent so cause can be attributed before/independent of integration. `linear` is the running
403
+ * net Δv; `attribution` is the per-force breakdown. The optional channels (`angular`/`thermal`/
404
+ * `temporal`/`semantic`) are declared now so the contract does not assume all force is `vx/vy` —
405
+ * they are not populated until those dimensions are restored.
406
+ */
407
+ export interface FieldImpulseAccumulator {
408
+ /** running net linear Δv (x/y, plus z when the lane is engaged). */
409
+ linear: {
410
+ x: number;
411
+ y: number;
412
+ z: number;
413
+ };
414
+ /** angular Δω contribution (θx/θy/θz) — populated when a force writes `Particle.spin` (doc 04 §Step 6). */
415
+ angular?: {
416
+ x: number;
417
+ y: number;
418
+ z: number;
419
+ };
420
+ /** thermal (heat) contribution — populated when a force changes `Particle.heat` (doc 04 §Step 6). */
421
+ thermal?: number;
422
+ /** temporal contribution (delay/decay/phase) — `decay` populated when a force changes mortal matter's
423
+ * `Particle.age` (frames-to-live); delay/phase reserved (doc 04 §Step 6). */
424
+ temporal?: {
425
+ delay?: number;
426
+ decay?: number;
427
+ phase?: number;
428
+ };
429
+ /** semantic-channel contributions (attention/confidence/memory) — `attention` populated with the body's
430
+ * conserved-attention multiplier (`Body.attn`) when active; confidence/memory reserved (doc 04 §Step 6). */
431
+ semantic?: Record<string, number>;
432
+ /** per-force breakdown — preserves explainability (Paper 31 §6). */
433
+ attribution: ForceAttribution[];
318
434
  }
319
435
  /**
320
436
  * A force module (§4). The engine owns the loop and everything conserved; a
@@ -423,6 +539,10 @@ export interface FieldOptions {
423
539
  * render projects z as a size/alpha recession. Purely additive: no API requires z.
424
540
  */
425
541
  depth?: number;
542
+ /** 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}. */
545
+ integrator?: IntegratorMode;
426
546
  /** draw the background Currents (§24); default true. Set false for the bare
427
547
  * free-particle field with no carrier waves. */
428
548
  waves?: boolean;
@@ -588,6 +708,8 @@ export interface AgentHandle {
588
708
  export interface BodySpec {
589
709
  /** the force ids this body emits (space-joined string or array), e.g. `'attract swirl'`. */
590
710
  tokens: string | readonly string[];
711
+ /** who owns this body's position; default `'anchored'`. See {@link BodyAuthority}. */
712
+ authority?: BodyAuthority;
591
713
  /** overall force magnitude (scales every token). */
592
714
  strength?: number;
593
715
  /** radius of influence, in field px. */
@@ -659,6 +781,323 @@ export interface EdgeView {
659
781
  /** whether the relationship was exercised this tick (its source body was salient). */
660
782
  active: boolean;
661
783
  }
784
+ /** What a {@link FieldQuery} should return. Omitted ⇒ a sensible default (`bodies`, `metrics`,
785
+ * `relationships`, plus `influences` when the query targets a point/region). */
786
+ export type FieldQueryInclude = 'bodies' | 'metrics' | 'relationships' | 'influences';
787
+ /** A user-defined interpretation lens over a query/snapshot reading (substrate query phase 2) — a
788
+ * declarative scope, NOT an opinionated preset catalog: the caller supplies the lens, the field/`applyLens`
789
+ * filters by it. Each clause is an allow-list; omitting a clause keeps everything in that dimension.
790
+ * Pure metadata — a lens never changes field state. **EXPERIMENTAL.** */
791
+ export interface FieldLens {
792
+ /** lens id, echoed onto the result as `FieldQueryResult.lens`. */
793
+ id: string;
794
+ label?: string;
795
+ /** keep only these metric keys (applied to global metrics + each body's metrics/dimensions). */
796
+ metrics?: readonly string[];
797
+ /** keep only influences in these accumulator channels (a missing `channel` counts as `'linear'`). */
798
+ channels?: readonly ForceAttribution['channel'][];
799
+ /** keep only bodies carrying at least one of these tokens. */
800
+ tokens?: readonly Token[];
801
+ }
802
+ /** A structured question put to the live field (read-only; never mutates state). */
803
+ export interface FieldQuery {
804
+ /** where to look: a point (`{x, y}`) or a rectangle (`{x, y, width, height}` — `DOMRect`-shaped).
805
+ * Omitted ⇒ a global query over the whole field. */
806
+ at?: Vec2 | FieldRect;
807
+ /** for a point `at`, the query radius in field px (default 240). Ignored for a rect or global query. */
808
+ radius?: number;
809
+ /** which sections to include; omitted ⇒ the default set (see {@link FieldQueryInclude}). */
810
+ include?: readonly FieldQueryInclude[];
811
+ /** interpret the result through a lens (substrate query phase 2) — scopes metrics/influences/bodies.
812
+ * Equivalent to calling `applyLens(result, lens)` on the answer. **EXPERIMENTAL.** */
813
+ lens?: FieldLens;
814
+ }
815
+ /** A body as seen by a query — identity, box, active tokens, and its measured metrics/dimensions. */
816
+ export interface FieldBodyReading {
817
+ /** stable id: the element's `id` when present, else a per-field synthetic (`body-N`). */
818
+ id: string;
819
+ /** the body's box in field coordinates, when measured. */
820
+ rect?: FieldRect;
821
+ /** the composed force ids (the `data-body` tokens). */
822
+ tokens: Token[];
823
+ /** scalar readings (lane: metric) — e.g. `density`, `load`, `attention`, `engaged`. */
824
+ metrics: Record<string, number>;
825
+ /** measured field dimensions (lane: metric) — e.g. `entropy`, `coherence`, `temperature`. */
826
+ dimensions: Record<string, number>;
827
+ /** the Field Formation(s) biasing this body right now (the field's active formation). */
828
+ activeFormations?: string[];
829
+ /** who owns this body's position (see {@link BodyAuthority}); `'anchored'` by default. */
830
+ authority?: BodyAuthority;
831
+ }
832
+ /** A relationship (edge) as seen by a query. */
833
+ export interface FieldRelationshipReading {
834
+ /** source / target body ids (see {@link FieldBodyReading.id}). */
835
+ from: string;
836
+ to: string;
837
+ /** the relationship kind (`'related'` by default). */
838
+ type: string;
839
+ /** active coupling ∈ [0,1]. */
840
+ strength: number;
841
+ /** slow accumulated familiarity ∈ [0,1]. */
842
+ memory?: number;
843
+ /** exercised this tick. */
844
+ active: boolean;
845
+ /** whether the edge carried causal influence this frame (today: equal to `active`). */
846
+ causal: boolean;
847
+ }
848
+ /** A single force's influence at the query point/region — which body's which force contributed how
849
+ * much (from the impulse accumulator; lane: force). */
850
+ export interface FieldInfluenceReading {
851
+ /** the body whose force exerted the influence. */
852
+ source: string;
853
+ /** the influenced target, when the query has one (the query point/region). */
854
+ target?: string;
855
+ /** the contributing force token. */
856
+ force: Token;
857
+ /** which accumulator channel this contribution is in (`'linear'` Δv, `'thermal'` heat, …). Default
858
+ * `'linear'` for back-compat with readers written before the thermal channel (doc 04 §Step 6). */
859
+ channel?: ForceAttribution['channel'];
860
+ /** the contribution — a Δv vector for `'linear'`, a scalar heat delta for `'thermal'`. */
861
+ contribution: number | Vec2 | Vec3;
862
+ /** optional human-readable note (lane: diagnostic). */
863
+ reason?: string;
864
+ }
865
+ /** The structured answer to a {@link FieldQuery}. Plain data; safe to serialize. */
866
+ export interface FieldQueryResult {
867
+ /** the query that produced this reading (echoed back). */
868
+ query: FieldQuery;
869
+ /** the frame this reading was taken on. */
870
+ frame: number;
871
+ /** the field clock at read time. */
872
+ time: number;
873
+ /** the resolved region (for a point/rect query). */
874
+ region?: FieldRect;
875
+ bodies: FieldBodyReading[];
876
+ metrics: Record<string, number>;
877
+ relationships: FieldRelationshipReading[];
878
+ influences: FieldInfluenceReading[];
879
+ /** the projections registered on the field (substrate 05) — metadata only; read-only. */
880
+ projections: FieldProjectionInfo[];
881
+ /** the lens id this reading was scoped through, when a `lens` was supplied (substrate query phase 2). */
882
+ lens?: string;
883
+ }
884
+ /** Options for {@link FieldHandle.snapshot}. */
885
+ export interface FieldSnapshotOptions {
886
+ /** include the raw particle pool (heavier; off by default for lightweight exports). */
887
+ includeParticles?: boolean;
888
+ /** include the relationship (edge) graph (default true). */
889
+ includeRelationships?: boolean;
890
+ /** include each body's opaque `data` record (default false — privacy-preserving). */
891
+ includeData?: boolean;
892
+ /** include per-body force attribution (each body's own forces at its centre, via the impulse
893
+ * accumulator) so a later `replay()` can derive `cause: 'force'` steps. Off by default. */
894
+ includeInfluences?: boolean;
895
+ }
896
+ /** A body captured in a {@link FieldSnapshot}. */
897
+ export interface FieldBodySnapshot {
898
+ id: string;
899
+ /** who owns this body's position (see {@link BodyAuthority}); `'anchored'` by default. */
900
+ authority?: BodyAuthority;
901
+ /** the body's box in field coordinates (anchored bodies). */
902
+ rect?: FieldRect;
903
+ /** the body's centre in field coordinates (z = 0 for an anchored body). */
904
+ position?: Vec3;
905
+ tokens: Token[];
906
+ metrics: Record<string, number>;
907
+ dimensions: Record<string, number>;
908
+ /** the body's opaque record, only when `includeData` was set. */
909
+ data?: unknown;
910
+ }
911
+ /** One particle captured in a {@link FieldSnapshot} (only when `includeParticles`). */
912
+ export interface FieldParticleSnapshot {
913
+ x: number;
914
+ y: number;
915
+ z: number;
916
+ heat: number;
917
+ size: number;
918
+ }
919
+ /** A portable capture of field state at a moment in time — inspect, compare, test, export, or hand to
920
+ * an agent. Plain data; safe to serialize. Format is versioned via {@link FieldSnapshot.version}. */
921
+ export interface FieldSnapshot {
922
+ /** a per-field unique id (`snap-<frame>-<n>`). */
923
+ id: string;
924
+ /** the field clock at capture (`env.t`). */
925
+ createdAt: number;
926
+ /** the frame captured. */
927
+ frame: number;
928
+ /** the engine build (`FIELD_VERSION`) — the snapshot-format version. */
929
+ version: string;
930
+ /** the active Field Formation id(s) at capture. */
931
+ formations: string[];
932
+ bodies: FieldBodySnapshot[];
933
+ relationships: FieldRelationshipReading[];
934
+ metrics: Record<string, number>;
935
+ /** per-body force attribution at capture (only when `includeInfluences`) — each body's own forces at
936
+ * its centre, by channel; lets `replay()` derive `cause: 'force'` steps. */
937
+ influences?: FieldInfluenceReading[];
938
+ /** the projections registered on the field at capture (substrate 05) — metadata only. */
939
+ projections: FieldProjectionInfo[];
940
+ particles?: FieldParticleSnapshot[];
941
+ }
942
+ /** A change to one body between two snapshots. */
943
+ export interface BodyChange {
944
+ id: string;
945
+ kind: 'added' | 'removed' | 'changed';
946
+ /** per-metric `{ from, to }` for the metrics that changed (kind `'changed'`). */
947
+ metrics?: Record<string, {
948
+ from: number;
949
+ to: number;
950
+ }>;
951
+ }
952
+ /** A change to one relationship between two snapshots. */
953
+ export interface RelationshipChange {
954
+ from: string;
955
+ to: string;
956
+ type: string;
957
+ kind: 'added' | 'removed' | 'changed';
958
+ strength?: {
959
+ from: number;
960
+ to: number;
961
+ };
962
+ active?: {
963
+ from: boolean;
964
+ to: boolean;
965
+ };
966
+ }
967
+ /** A change to one field-level metric between two snapshots. */
968
+ export interface MetricChange {
969
+ key: string;
970
+ from: number;
971
+ to: number;
972
+ }
973
+ /** A Field Formation that activated or deactivated between two snapshots. */
974
+ export interface FormationChange {
975
+ id: string;
976
+ kind: 'activated' | 'deactivated';
977
+ }
978
+ /** The structured comparison of two {@link FieldSnapshot}s — what changed in the field, by lane. */
979
+ export interface FieldDiff {
980
+ /** the `id`s of the two snapshots compared. */
981
+ from: string;
982
+ to: string;
983
+ bodyChanges: BodyChange[];
984
+ relationshipChanges: RelationshipChange[];
985
+ metricChanges: MetricChange[];
986
+ formationChanges: FormationChange[];
987
+ }
988
+ /** The kinds of output surface a {@link FieldProjection} can target. */
989
+ export type FieldProjectionSurface = 'css' | 'dom-attribute' | 'svg' | 'canvas' | 'typography' | 'annotation' | 'sound' | 'haptic' | 'native' | 'spatial' | 'agent-json';
990
+ /** Where a projection writes — a minimal, DOM-shaped sink (an element's style / attributes), but open
991
+ * so non-DOM surfaces (native, agent-json) can pass their own target. */
992
+ export interface FieldProjectionTarget {
993
+ style?: {
994
+ setProperty(key: string, value: string): void;
995
+ };
996
+ setAttribute?(key: string, value: string): void;
997
+ [key: string]: unknown;
998
+ }
999
+ /** A named mapping from field state to an output surface. `apply` is the (optional) writer; the rest is
1000
+ * declarative metadata governance + tooling read. A projection must NOT change field state. */
1001
+ export interface FieldProjection {
1002
+ id: string;
1003
+ label: string;
1004
+ /** the field channels this projection reads (e.g. `['density','confidence']`). */
1005
+ channels: string[];
1006
+ /** the surface(s) it writes to. */
1007
+ surfaces: FieldProjectionSurface[];
1008
+ /** the non-motion equivalent, for `prefers-reduced-motion` (governance: motion must translate). */
1009
+ reducedMotionEquivalent?: string;
1010
+ /** the accessibility equivalent — an alternate projection of the same state, not a fallback. */
1011
+ accessibilityEquivalent?: string;
1012
+ /** write the reading onto the target (read-only w.r.t. the field). */
1013
+ apply?(reading: Record<string, number>, target: FieldProjectionTarget): void;
1014
+ }
1015
+ /** A live reading source for an auto-applied projection — called once per write phase to produce the
1016
+ * reading handed to the projection's `apply`. The field never reads it for simulation. */
1017
+ export type ProjectionSource = () => Record<string, number>;
1018
+ /** A {@link FieldProjectionTarget} for the `agent-json` surface: it captures the last reading written to
1019
+ * it as a plain object, serializable for agent / tooling consumption. Build one with `agentJsonTarget()`
1020
+ * and pair it with `agentJsonProjection()`. **EXPERIMENTAL.** */
1021
+ export interface AgentJsonTarget extends FieldProjectionTarget {
1022
+ /** receive a reading (called by the projection's `apply`). */
1023
+ receive(reading: Record<string, number>): void;
1024
+ /** the last received reading, or null before the first write. */
1025
+ value(): Record<string, number> | null;
1026
+ /** the last received reading serialized as JSON (`"null"` before the first write). */
1027
+ json(): string;
1028
+ }
1029
+ /** Serializable metadata about a registered projection (no `apply`) — what `query()`/`snapshot()` and
1030
+ * governance tooling read. */
1031
+ export interface FieldProjectionInfo {
1032
+ id: string;
1033
+ label: string;
1034
+ channels: string[];
1035
+ surfaces: FieldProjectionSurface[];
1036
+ reducedMotionEquivalent?: string;
1037
+ accessibilityEquivalent?: string;
1038
+ }
1039
+ /** The field's projection registry ({@link FieldHandle.projections}) — register named projections and
1040
+ * apply them. Read/output only; registering a projection never changes how matter moves. */
1041
+ export interface ProjectionRegistry {
1042
+ /** register a projection (replacing any with the same id); returns an unregister fn. */
1043
+ register(projection: FieldProjection): () => void;
1044
+ /** remove a registered projection by id. */
1045
+ unregister(id: string): void;
1046
+ /** the full projection (incl. `apply`) for an id, or undefined. */
1047
+ get(id: string): FieldProjection | undefined;
1048
+ /** serializable metadata for every registered projection. */
1049
+ list(): FieldProjectionInfo[];
1050
+ /** apply a registered projection's writer to a target (no-op if the id/`apply` is absent). */
1051
+ apply(id: string, reading: Record<string, number>, target: FieldProjectionTarget): void;
1052
+ /** bind a registered projection to a target + a live reading source — the field auto-applies it once
1053
+ * per write phase (after feedback), read-only w.r.t. the field. Returns an unbind fn. Multiple
1054
+ * bindings (even of the same id) coexist; binding an unknown/`apply`-less id is inert. **EXPERIMENTAL.** */
1055
+ bind(id: string, target: FieldProjectionTarget, source: ProjectionSource): () => void;
1056
+ /** governance lint over the registered projections (substrate 05 §governance) — flags accessibility
1057
+ * gaps (a motion-capable projection with no reduced-motion equivalent; any projection with no
1058
+ * accessibility equivalent). Pure; the standalone `lintProjections` is also exported. */
1059
+ lint(): GovernanceWarning[];
1060
+ }
1061
+ /** A governance lint finding. `rule` is a stable `field/...` id (see doc 05 §field-lint-rules). The
1062
+ * severity scale matches the visual `LintSeverity` (info / warning / error / fatal). */
1063
+ export interface GovernanceWarning {
1064
+ rule: string;
1065
+ severity: 'info' | 'warning' | 'error' | 'fatal';
1066
+ /** the offending subject — e.g. a projection id. */
1067
+ subject: string;
1068
+ message: string;
1069
+ }
1070
+ /** The lane a {@link CausalReplayStep} belongs to. */
1071
+ export type CausalCause = 'force' | 'relationship' | 'metric' | 'formation' | 'measurement';
1072
+ /** Options for {@link FieldHandle.replay}. */
1073
+ export interface ReplayOptions {
1074
+ /** restrict the replay to steps touching this body id (its metrics, or a relationship endpoint). */
1075
+ focus?: string;
1076
+ }
1077
+ /** One narrated cause in a {@link CausalReplay}. */
1078
+ export interface CausalReplayStep {
1079
+ frame: number;
1080
+ time: number;
1081
+ cause: CausalCause;
1082
+ /** the body/edge the cause originates from (a body id, or a relationship's `from`). */
1083
+ source?: string;
1084
+ /** the affected target, when the cause is a relationship. */
1085
+ target?: string;
1086
+ /** a human-readable account of the change (lane: diagnostic). */
1087
+ description: string;
1088
+ /** the structured before/after behind the description (e.g. `{ from, to }`). */
1089
+ contribution?: unknown;
1090
+ }
1091
+ /** An explanation of how the field changed between two snapshots — the ordered causal steps. Pure
1092
+ * (derived from the two snapshots); plain data, safe to serialize. */
1093
+ export interface CausalReplay {
1094
+ /** the `id`s of the two snapshots replayed. */
1095
+ from: string;
1096
+ to: string;
1097
+ /** the focus body id, if the replay was scoped to one. */
1098
+ focus?: string;
1099
+ steps: CausalReplayStep[];
1100
+ }
662
1101
  /** A registered **field channel** (`FieldHandle.addField`) — an external scalar field sampled on the
663
1102
  * engine's read path. The open *input* analog of the render surfaces. */
664
1103
  export interface FieldChannelHandle {
@@ -673,6 +1112,10 @@ export interface FieldChannelHandle {
673
1112
  export interface FieldHandle {
674
1113
  /** the running engine version (`FIELD_VERSION`) — which build this field is on. */
675
1114
  readonly version: string;
1115
+ /** the field's projection registry (substrate 05) — register named projections that reveal field
1116
+ * state on an output surface (CSS / annotation / agent-json / reduced-motion …). Read/output only:
1117
+ * a projection never changes how matter moves. See {@link ProjectionRegistry}. **EXPERIMENTAL.** */
1118
+ readonly projections: ProjectionRegistry;
676
1119
  /** (re)scan the document for `[data-body]` bodies after a layout change. */
677
1120
  scan(): void;
678
1121
  /** alias of `scan`. */
@@ -786,6 +1229,22 @@ export interface FieldHandle {
786
1229
  * consumer: each edge's endpoint `data`, type, live `strength`/`memory`, and whether it's active this
787
1230
  * tick. Pure, read-only. Shipped-but-unfrozen. */
788
1231
  readEdges(): ReadonlyArray<EdgeView>;
1232
+ /** Ask the live field a structured question and get back plain, serializable data — bodies,
1233
+ * metrics, relationships, and per-force influence — for a point, a rect, or the whole field.
1234
+ * Read-only and render-agnostic (works headless). The substrate's agent-/tool-readable surface;
1235
+ * see {@link FieldQuery}. **EXPERIMENTAL** — not yet in the frozen API set. */
1236
+ query(q?: FieldQuery): FieldQueryResult;
1237
+ /** Capture *what the field is doing* right now — a portable, serializable {@link FieldSnapshot}
1238
+ * (bodies, metrics, relationships, active formations; optionally particles). Read-only; works
1239
+ * headless. Pair with {@link FieldHandle.diff} to compare two snapshots. **EXPERIMENTAL.** */
1240
+ snapshot(opts?: FieldSnapshotOptions): FieldSnapshot;
1241
+ /** Compare two snapshots and report what changed in the field — body, relationship, metric, and
1242
+ * formation changes. Pure (takes two snapshots; ignores live state). **EXPERIMENTAL.** */
1243
+ diff(a: FieldSnapshot, b: FieldSnapshot): FieldDiff;
1244
+ /** Explain how the field changed between two snapshots — an ordered, narrated sequence of causes
1245
+ * (formation activations, relationship shifts, body measurements/metrics). Pure (derived from the
1246
+ * two snapshots). Pass `{ focus }` to scope it to one body. **EXPERIMENTAL.** */
1247
+ replay(a: FieldSnapshot, b: FieldSnapshot, opts?: ReplayOptions): CausalReplay;
789
1248
  /**
790
1249
  * Register a named **field channel** — a read-back substrate the host samples via `sampleField`; the
791
1250
  * engine does not (yet) couple it into forces. The open *input* analog of the render surfaces