@fundamental-engine/core 0.9.4 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/inspect/report.js +2 -2
- package/dist/inspect/report.js.map +1 -1
- package/dist/recipes/catalog.d.ts +14 -9
- package/dist/recipes/catalog.d.ts.map +1 -1
- package/dist/recipes/catalog.js +9 -5
- package/dist/recipes/catalog.js.map +1 -1
- package/dist/recipes/compile.d.ts +26 -16
- package/dist/recipes/compile.d.ts.map +1 -1
- package/dist/recipes/compile.js +14 -10
- package/dist/recipes/compile.js.map +1 -1
- package/dist/recipes/index.d.ts +2 -0
- package/dist/recipes/index.d.ts.map +1 -1
- package/dist/recipes/index.js +5 -3
- package/dist/recipes/index.js.map +1 -1
- package/dist/recipes/schema.d.ts +27 -17
- package/dist/recipes/schema.d.ts.map +1 -1
- package/dist/recipes/schema.js +11 -6
- package/dist/recipes/schema.js.map +1 -1
- package/dist/recipes/wayfinding.d.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/world/ablation/ablation.d.ts +39 -0
- package/dist/world/ablation/ablation.d.ts.map +1 -0
- package/dist/world/ablation/ablation.js +449 -0
- package/dist/world/ablation/ablation.js.map +1 -0
- package/dist/world/adapters/field-runtime.d.ts +56 -0
- package/dist/world/adapters/field-runtime.d.ts.map +1 -0
- package/dist/world/adapters/field-runtime.js +250 -0
- package/dist/world/adapters/field-runtime.js.map +1 -0
- package/dist/world/adapters/fsm-runtime.d.ts +18 -0
- package/dist/world/adapters/fsm-runtime.d.ts.map +1 -0
- package/dist/world/adapters/fsm-runtime.js +153 -0
- package/dist/world/adapters/fsm-runtime.js.map +1 -0
- package/dist/world/adapters/governor-runtime.d.ts +23 -0
- package/dist/world/adapters/governor-runtime.d.ts.map +1 -0
- package/dist/world/adapters/governor-runtime.js +185 -0
- package/dist/world/adapters/governor-runtime.js.map +1 -0
- package/dist/world/adapters/planner-runtime.d.ts +20 -0
- package/dist/world/adapters/planner-runtime.d.ts.map +1 -0
- package/dist/world/adapters/planner-runtime.js +144 -0
- package/dist/world/adapters/planner-runtime.js.map +1 -0
- package/dist/world/conformance/corpus.d.ts +89 -0
- package/dist/world/conformance/corpus.d.ts.map +1 -0
- package/dist/world/conformance/corpus.js +195 -0
- package/dist/world/conformance/corpus.js.map +1 -0
- package/dist/world/conformance/discoveries.d.ts +50 -0
- package/dist/world/conformance/discoveries.d.ts.map +1 -0
- package/dist/world/conformance/discoveries.js +71 -0
- package/dist/world/conformance/discoveries.js.map +1 -0
- package/dist/world/conformance/evidence.d.ts +37 -0
- package/dist/world/conformance/evidence.d.ts.map +1 -0
- package/dist/world/conformance/evidence.js +53 -0
- package/dist/world/conformance/evidence.js.map +1 -0
- package/dist/world/conformance/negative-results.d.ts +57 -0
- package/dist/world/conformance/negative-results.d.ts.map +1 -0
- package/dist/world/conformance/negative-results.js +73 -0
- package/dist/world/conformance/negative-results.js.map +1 -0
- package/dist/world/conformance/predictions.d.ts +66 -0
- package/dist/world/conformance/predictions.d.ts.map +1 -0
- package/dist/world/conformance/predictions.js +141 -0
- package/dist/world/conformance/predictions.js.map +1 -0
- package/dist/world/cross-substrate.d.ts +19 -0
- package/dist/world/cross-substrate.d.ts.map +1 -0
- package/dist/world/cross-substrate.js +123 -0
- package/dist/world/cross-substrate.js.map +1 -0
- package/dist/world/dynamics.d.ts +166 -0
- package/dist/world/dynamics.d.ts.map +1 -0
- package/dist/world/dynamics.js +30 -0
- package/dist/world/dynamics.js.map +1 -0
- package/dist/world/envelope.d.ts +44 -0
- package/dist/world/envelope.d.ts.map +1 -0
- package/dist/world/envelope.js +77 -0
- package/dist/world/envelope.js.map +1 -0
- package/dist/world/episodes/episodes.d.ts +64 -0
- package/dist/world/episodes/episodes.d.ts.map +1 -0
- package/dist/world/episodes/episodes.js +104 -0
- package/dist/world/episodes/episodes.js.map +1 -0
- package/dist/world/equivalence.d.ts +70 -0
- package/dist/world/equivalence.d.ts.map +1 -0
- package/dist/world/equivalence.js +205 -0
- package/dist/world/equivalence.js.map +1 -0
- package/dist/world/experiments/declarative-dynamics.d.ts +87 -0
- package/dist/world/experiments/declarative-dynamics.d.ts.map +1 -0
- package/dist/world/experiments/declarative-dynamics.js +153 -0
- package/dist/world/experiments/declarative-dynamics.js.map +1 -0
- package/dist/world/governor-equivalence.d.ts +51 -0
- package/dist/world/governor-equivalence.d.ts.map +1 -0
- package/dist/world/governor-equivalence.js +126 -0
- package/dist/world/governor-equivalence.js.map +1 -0
- package/dist/world/kernel.d.ts +49 -0
- package/dist/world/kernel.d.ts.map +1 -0
- package/dist/world/kernel.js +64 -0
- package/dist/world/kernel.js.map +1 -0
- package/dist/world/observatory/capture.d.ts +10 -0
- package/dist/world/observatory/capture.d.ts.map +1 -0
- package/dist/world/observatory/capture.js +371 -0
- package/dist/world/observatory/capture.js.map +1 -0
- package/dist/world/observatory/evidence-log.d.ts +131 -0
- package/dist/world/observatory/evidence-log.d.ts.map +1 -0
- package/dist/world/observatory/evidence-log.js +43 -0
- package/dist/world/observatory/evidence-log.js.map +1 -0
- package/dist/world/opportunity/opportunity.d.ts +85 -0
- package/dist/world/opportunity/opportunity.d.ts.map +1 -0
- package/dist/world/opportunity/opportunity.js +67 -0
- package/dist/world/opportunity/opportunity.js.map +1 -0
- package/dist/world/projection/evidence-profile.d.ts +51 -0
- package/dist/world/projection/evidence-profile.d.ts.map +1 -0
- package/dist/world/projection/evidence-profile.js +93 -0
- package/dist/world/projection/evidence-profile.js.map +1 -0
- package/dist/world/projection/projection.d.ts +162 -0
- package/dist/world/projection/projection.d.ts.map +1 -0
- package/dist/world/projection/projection.js +145 -0
- package/dist/world/projection/projection.js.map +1 -0
- package/dist/world/properties/properties.d.ts +87 -0
- package/dist/world/properties/properties.d.ts.map +1 -0
- package/dist/world/properties/properties.js +172 -0
- package/dist/world/properties/properties.js.map +1 -0
- package/dist/world/substrates/fsm.d.ts +59 -0
- package/dist/world/substrates/fsm.d.ts.map +1 -0
- package/dist/world/substrates/fsm.js +57 -0
- package/dist/world/substrates/fsm.js.map +1 -0
- package/dist/world/substrates/governor.d.ts +53 -0
- package/dist/world/substrates/governor.d.ts.map +1 -0
- package/dist/world/substrates/governor.js +73 -0
- package/dist/world/substrates/governor.js.map +1 -0
- package/dist/world/substrates/planner.d.ts +82 -0
- package/dist/world/substrates/planner.d.ts.map +1 -0
- package/dist/world/substrates/planner.js +114 -0
- package/dist/world/substrates/planner.js.map +1 -0
- package/dist/world/world.d.ts +73 -0
- package/dist/world/world.d.ts.map +1 -0
- package/dist/world/world.js +2 -0
- package/dist/world/world.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* F1.5 — Declarative FieldDynamics experiment (BOUNDED). Tests whether force laws can be represented as
|
|
3
|
+
* DATA (a typed expression IR) rather than executable code. This is a scientific experiment: a partial or
|
|
4
|
+
* negative result is valid. The IR is deliberately minimal — NO callbacks, script strings, eval,
|
|
5
|
+
* Function, or general-purpose language encoded as data. If a law needs any of those, it is classified
|
|
6
|
+
* `opaque-only`; the IR is NOT expanded to force success.
|
|
7
|
+
*
|
|
8
|
+
* Corpus: representative laws modeled on the engine's real force categories (attract/gravity =
|
|
9
|
+
* distance-dependent, cohesion = relation-dependent, gravity constant = environment-dependent, sink =
|
|
10
|
+
* stateful, etc. — see `forces/`). This experiment characterizes CATEGORY representability, not the exact
|
|
11
|
+
* 36 force functions. Field-free; internal; not exported from the package entry.
|
|
12
|
+
*/
|
|
13
|
+
export type Expr = {
|
|
14
|
+
readonly op: 'const';
|
|
15
|
+
readonly value: number;
|
|
16
|
+
} | {
|
|
17
|
+
readonly op: 'var';
|
|
18
|
+
readonly name: string;
|
|
19
|
+
} | {
|
|
20
|
+
readonly op: 'add' | 'sub' | 'mul' | 'div' | 'min' | 'max';
|
|
21
|
+
readonly a: Expr;
|
|
22
|
+
readonly b: Expr;
|
|
23
|
+
} | {
|
|
24
|
+
readonly op: 'neg';
|
|
25
|
+
readonly a: Expr;
|
|
26
|
+
} | {
|
|
27
|
+
readonly op: 'clamp';
|
|
28
|
+
readonly x: Expr;
|
|
29
|
+
readonly lo: Expr;
|
|
30
|
+
readonly hi: Expr;
|
|
31
|
+
} | {
|
|
32
|
+
readonly op: 'ifGte';
|
|
33
|
+
readonly x: Expr;
|
|
34
|
+
readonly threshold: Expr;
|
|
35
|
+
readonly then: Expr;
|
|
36
|
+
readonly otherwise: Expr;
|
|
37
|
+
};
|
|
38
|
+
export type ExprContext = Readonly<Record<string, number>>;
|
|
39
|
+
export declare function evalExpr(e: Expr, ctx: ExprContext): number;
|
|
40
|
+
export type ForceClass = 'declarative-expression' | 'declarative-stateful' | 'declarative-with-opaque-extension' | 'opaque-only';
|
|
41
|
+
export type OpaqueReason = 'unsupported-input' | 'hidden-mutable-state' | 'host-dependence' | 'callback-dependence' | 'dynamic-dispatch' | 'unbounded-computation' | 'semantic-mismatch' | 'excessive-representation-cost';
|
|
42
|
+
/** Fully-defined inputs for the imperative laws (avoids indexed-access `undefined`). */
|
|
43
|
+
export interface SampleInputs {
|
|
44
|
+
readonly strength: number;
|
|
45
|
+
readonly dist: number;
|
|
46
|
+
readonly range: number;
|
|
47
|
+
readonly relationStrength: number;
|
|
48
|
+
readonly envG: number;
|
|
49
|
+
readonly mass: number;
|
|
50
|
+
readonly t: number;
|
|
51
|
+
}
|
|
52
|
+
export interface ForceCase {
|
|
53
|
+
readonly id: string;
|
|
54
|
+
readonly category: string;
|
|
55
|
+
readonly modeledOn: string;
|
|
56
|
+
/** The "original apply(...)" analog — imperative core computation. `state` present only for stateful laws. */
|
|
57
|
+
readonly imperative: (ctx: SampleInputs, state: {
|
|
58
|
+
acc: number;
|
|
59
|
+
} | undefined) => number;
|
|
60
|
+
/** The declarative encoding, or null when the law is NOT representable in the pure IR. */
|
|
61
|
+
readonly declarative: Expr | null;
|
|
62
|
+
readonly classification: ForceClass;
|
|
63
|
+
readonly reason?: OpaqueReason;
|
|
64
|
+
/** For stateful laws: the input var that surfaces the prior state (declarative-stateful). */
|
|
65
|
+
readonly statePriorVar?: string;
|
|
66
|
+
}
|
|
67
|
+
export declare const FORCE_CORPUS: readonly ForceCase[];
|
|
68
|
+
export interface ForceCharacterization {
|
|
69
|
+
readonly id: string;
|
|
70
|
+
readonly category: string;
|
|
71
|
+
readonly classification: ForceClass;
|
|
72
|
+
readonly reason?: OpaqueReason;
|
|
73
|
+
/** For declarative laws: max abs difference imperative-vs-declarative over the samples. null if opaque. */
|
|
74
|
+
readonly maxDelta: number | null;
|
|
75
|
+
readonly matchesUnderTolerance: boolean | null;
|
|
76
|
+
}
|
|
77
|
+
export declare function characterize(force: ForceCase, tolerance: number): ForceCharacterization;
|
|
78
|
+
export interface ExperimentResult {
|
|
79
|
+
readonly outcome: 'complete-declarative' | 'partial-with-opaque-extensions' | 'negative';
|
|
80
|
+
readonly total: number;
|
|
81
|
+
readonly byClass: Readonly<Record<ForceClass, number>>;
|
|
82
|
+
readonly nonTrivialDeclarative: number;
|
|
83
|
+
readonly boundary: string;
|
|
84
|
+
readonly characterizations: readonly ForceCharacterization[];
|
|
85
|
+
}
|
|
86
|
+
export declare function runExperiment(tolerance: number): ExperimentResult;
|
|
87
|
+
//# sourceMappingURL=declarative-dynamics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declarative-dynamics.d.ts","sourceRoot":"","sources":["../../../src/world/experiments/declarative-dynamics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,MAAM,MAAM,IAAI,GACZ;IAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC7C;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,GAAG,KAAK,GAAG,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gBvF;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,gCAAgC,GAAG,UAAU,CAAC;IACzF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;IACvD,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,iBAAiB,EAAE,SAAS,qBAAqB,EAAE,CAAC;CAC9D;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,CAkBjE"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* F1.5 — Declarative FieldDynamics experiment (BOUNDED). Tests whether force laws can be represented as
|
|
3
|
+
* DATA (a typed expression IR) rather than executable code. This is a scientific experiment: a partial or
|
|
4
|
+
* negative result is valid. The IR is deliberately minimal — NO callbacks, script strings, eval,
|
|
5
|
+
* Function, or general-purpose language encoded as data. If a law needs any of those, it is classified
|
|
6
|
+
* `opaque-only`; the IR is NOT expanded to force success.
|
|
7
|
+
*
|
|
8
|
+
* Corpus: representative laws modeled on the engine's real force categories (attract/gravity =
|
|
9
|
+
* distance-dependent, cohesion = relation-dependent, gravity constant = environment-dependent, sink =
|
|
10
|
+
* stateful, etc. — see `forces/`). This experiment characterizes CATEGORY representability, not the exact
|
|
11
|
+
* 36 force functions. Field-free; internal; not exported from the package entry.
|
|
12
|
+
*/
|
|
13
|
+
export function evalExpr(e, ctx) {
|
|
14
|
+
switch (e.op) {
|
|
15
|
+
case 'const': return e.value;
|
|
16
|
+
case 'var': {
|
|
17
|
+
const v = ctx[e.name];
|
|
18
|
+
if (v === undefined)
|
|
19
|
+
throw new Error(`declarative-dynamics: unbound var "${e.name}"`);
|
|
20
|
+
return v;
|
|
21
|
+
}
|
|
22
|
+
case 'add': return evalExpr(e.a, ctx) + evalExpr(e.b, ctx);
|
|
23
|
+
case 'sub': return evalExpr(e.a, ctx) - evalExpr(e.b, ctx);
|
|
24
|
+
case 'mul': return evalExpr(e.a, ctx) * evalExpr(e.b, ctx);
|
|
25
|
+
case 'div': return evalExpr(e.a, ctx) / evalExpr(e.b, ctx);
|
|
26
|
+
case 'min': return Math.min(evalExpr(e.a, ctx), evalExpr(e.b, ctx));
|
|
27
|
+
case 'max': return Math.max(evalExpr(e.a, ctx), evalExpr(e.b, ctx));
|
|
28
|
+
case 'neg': return -evalExpr(e.a, ctx);
|
|
29
|
+
case 'clamp': return Math.min(Math.max(evalExpr(e.x, ctx), evalExpr(e.lo, ctx)), evalExpr(e.hi, ctx));
|
|
30
|
+
case 'ifGte': return evalExpr(e.x, ctx) >= evalExpr(e.threshold, ctx) ? evalExpr(e.then, ctx) : evalExpr(e.otherwise, ctx);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// small expression builders (readability)
|
|
34
|
+
const k = (value) => ({ op: 'const', value });
|
|
35
|
+
const v = (name) => ({ op: 'var', name });
|
|
36
|
+
const mul = (a, b) => ({ op: 'mul', a, b });
|
|
37
|
+
const sub = (a, b) => ({ op: 'sub', a, b });
|
|
38
|
+
const div = (a, b) => ({ op: 'div', a, b });
|
|
39
|
+
const add = (a, b) => ({ op: 'add', a, b });
|
|
40
|
+
const max = (a, b) => ({ op: 'max', a, b });
|
|
41
|
+
const ifGte = (x, threshold, then, otherwise) => ({ op: 'ifGte', x, threshold, then, otherwise });
|
|
42
|
+
// a closure-captured hidden accumulator — NOT surfaceable → opaque-only
|
|
43
|
+
function makeClosureStatefulLaw() {
|
|
44
|
+
let hidden = 0;
|
|
45
|
+
return (ctx) => {
|
|
46
|
+
hidden += ctx.strength;
|
|
47
|
+
return hidden;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
const closureLaw = makeClosureStatefulLaw();
|
|
51
|
+
// a host callback the IR cannot represent as data
|
|
52
|
+
function hostCallback() {
|
|
53
|
+
return 42; // stands in for host geometry / external query
|
|
54
|
+
}
|
|
55
|
+
export const FORCE_CORPUS = [
|
|
56
|
+
{
|
|
57
|
+
id: 'parameterized-constant', category: 'constant/parameterized', modeledOn: 'strength scalar',
|
|
58
|
+
imperative: (c) => c.strength, declarative: v('strength'), classification: 'declarative-expression',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: 'distance-falloff', category: 'distance-dependent', modeledOn: 'attract / gravity',
|
|
62
|
+
imperative: (c) => c.strength * Math.max(0, 1 - c.dist / c.range),
|
|
63
|
+
declarative: mul(v('strength'), max(k(0), sub(k(1), div(v('dist'), v('range'))))),
|
|
64
|
+
classification: 'declarative-expression',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: 'relation-scaled', category: 'relation-dependent', modeledOn: 'cohesion',
|
|
68
|
+
imperative: (c) => c.relationStrength * c.strength,
|
|
69
|
+
declarative: mul(v('relationStrength'), v('strength')), classification: 'declarative-expression',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: 'environment-constant', category: 'environment-dependent', modeledOn: 'gravity G',
|
|
73
|
+
imperative: (c) => c.envG * c.mass, declarative: mul(v('envG'), v('mass')), classification: 'declarative-expression',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: 'range-threshold', category: 'threshold/conditional', modeledOn: 'screen / cutoff',
|
|
77
|
+
imperative: (c) => (c.range >= c.dist ? c.strength : 0),
|
|
78
|
+
declarative: ifGte(v('range'), v('dist'), v('strength'), k(0)), classification: 'declarative-expression',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'composed', category: 'composition', modeledOn: 'attract + cohesion',
|
|
82
|
+
imperative: (c) => c.strength * Math.max(0, 1 - c.dist / c.range) + c.relationStrength * c.strength,
|
|
83
|
+
declarative: add(mul(v('strength'), max(k(0), sub(k(1), div(v('dist'), v('range'))))), mul(v('relationStrength'), v('strength'))),
|
|
84
|
+
classification: 'declarative-expression',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: 'time-linear', category: 'time-dependent (linear)', modeledOn: 'linear decay',
|
|
88
|
+
imperative: (c) => c.strength * c.t, declarative: mul(v('strength'), v('t')), classification: 'declarative-expression',
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: 'state-surfaced', category: 'mutable state (surfaced)', modeledOn: 'sink accretion (--load)',
|
|
92
|
+
imperative: (c, s) => { s.acc += c.strength; return s.acc; },
|
|
93
|
+
// surfaces prior state as an input var; output IS the next state: acc' = accPrior + strength
|
|
94
|
+
declarative: add(v('accPrior'), v('strength')), classification: 'declarative-stateful', statePriorVar: 'accPrior',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: 'time-sinusoidal', category: 'time-dependent (nonlinear)', modeledOn: 'oscillatory drift',
|
|
98
|
+
imperative: (c) => c.strength * Math.sin(c.t), declarative: null,
|
|
99
|
+
classification: 'opaque-only', reason: 'unsupported-input',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: 'closure-state', category: 'mutable state (closure-captured)', modeledOn: 'induced charge accumulation',
|
|
103
|
+
imperative: (c) => closureLaw(c), declarative: null,
|
|
104
|
+
classification: 'opaque-only', reason: 'hidden-mutable-state',
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
id: 'host-callback', category: 'host/callback dependence', modeledOn: 'host geometry / external query',
|
|
108
|
+
imperative: () => hostCallback(), declarative: null,
|
|
109
|
+
classification: 'opaque-only', reason: 'callback-dependence',
|
|
110
|
+
},
|
|
111
|
+
];
|
|
112
|
+
const SAMPLE_CONTEXTS = [
|
|
113
|
+
{ strength: 1, dist: 10, range: 200, relationStrength: 0.5, envG: 9.8, mass: 2, t: 0 },
|
|
114
|
+
{ strength: 0.5, dist: 150, range: 200, relationStrength: 0.8, envG: 9.8, mass: 1, t: 1 },
|
|
115
|
+
{ strength: 2, dist: 250, range: 200, relationStrength: 0.2, envG: 9.8, mass: 3, t: 2.5 },
|
|
116
|
+
];
|
|
117
|
+
export function characterize(force, tolerance) {
|
|
118
|
+
if (force.declarative === null) {
|
|
119
|
+
return { id: force.id, category: force.category, classification: force.classification, reason: force.reason, maxDelta: null, matchesUnderTolerance: null };
|
|
120
|
+
}
|
|
121
|
+
let maxDelta = 0;
|
|
122
|
+
// stateful laws thread prior-state through both paths so the comparison is per-step
|
|
123
|
+
const impState = { acc: 0 };
|
|
124
|
+
let declPriorAcc = 0;
|
|
125
|
+
for (const ctx of SAMPLE_CONTEXTS) {
|
|
126
|
+
const impOut = force.imperative(ctx, impState);
|
|
127
|
+
const declCtx = force.statePriorVar ? { ...ctx, [force.statePriorVar]: declPriorAcc } : { ...ctx };
|
|
128
|
+
const declOut = evalExpr(force.declarative, declCtx);
|
|
129
|
+
if (force.statePriorVar)
|
|
130
|
+
declPriorAcc = declOut; // thread the surfaced state forward
|
|
131
|
+
maxDelta = Math.max(maxDelta, Math.abs(impOut - declOut));
|
|
132
|
+
}
|
|
133
|
+
return { id: force.id, category: force.category, classification: force.classification, reason: force.reason, maxDelta, matchesUnderTolerance: maxDelta <= tolerance };
|
|
134
|
+
}
|
|
135
|
+
export function runExperiment(tolerance) {
|
|
136
|
+
const characterizations = FORCE_CORPUS.map((f) => characterize(f, tolerance));
|
|
137
|
+
const byClass = {
|
|
138
|
+
'declarative-expression': 0, 'declarative-stateful': 0, 'declarative-with-opaque-extension': 0, 'opaque-only': 0,
|
|
139
|
+
};
|
|
140
|
+
for (const f of FORCE_CORPUS)
|
|
141
|
+
byClass[f.classification] += 1;
|
|
142
|
+
const declarativeTotal = byClass['declarative-expression'] + byClass['declarative-stateful'] + byClass['declarative-with-opaque-extension'];
|
|
143
|
+
const nonTrivialDeclarative = FORCE_CORPUS.filter((f) => f.declarative !== null && f.category !== 'constant/parameterized').length;
|
|
144
|
+
const outcome = byClass['opaque-only'] === 0 ? 'complete-declarative'
|
|
145
|
+
: declarativeTotal === 0 || nonTrivialDeclarative === 0 ? 'negative'
|
|
146
|
+
: 'partial-with-opaque-extensions';
|
|
147
|
+
const boundary = 'Pure algebraic / threshold / composition / parameterized / distance / relation / environment / ' +
|
|
148
|
+
'linear-time laws, plus explicitly-surfaced state, are declarative. Nonlinear-time (needs functions ' +
|
|
149
|
+
'the IR does not carry), closure-captured hidden state, and host/callback dependence are opaque-only. ' +
|
|
150
|
+
'The IR was NOT expanded (no trig, callbacks, eval, or Function) to force representation.';
|
|
151
|
+
return { outcome, total: FORCE_CORPUS.length, byClass, nonTrivialDeclarative, boundary, characterizations };
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=declarative-dynamics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declarative-dynamics.js","sourceRoot":"","sources":["../../../src/world/experiments/declarative-dynamics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAcH,MAAM,UAAU,QAAQ,CAAC,CAAO,EAAE,GAAgB;IAChD,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC;QACb,KAAK,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;QAC7B,KAAK,KAAK,CAAC,CAAC,CAAC;YACX,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YACtB,IAAI,CAAC,KAAK,SAAS;gBAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;YACtF,OAAO,CAAC,CAAC;QACX,CAAC;QACD,KAAK,KAAK,CAAC,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAC3D,KAAK,KAAK,CAAC,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,EA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
|
2
|
+
import type { CoverageEntry, SnapshotFidelity } from './equivalence.ts';
|
|
3
|
+
export interface GovernorSemanticStep {
|
|
4
|
+
readonly step: number;
|
|
5
|
+
readonly tier: QualityTier;
|
|
6
|
+
readonly overrunStreak: number;
|
|
7
|
+
readonly cleanStreak: number;
|
|
8
|
+
readonly changed: boolean;
|
|
9
|
+
readonly failure?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Only the controls that exist for THIS substrate; the rest are recorded not-applicable. */
|
|
12
|
+
export interface GovernorEquivalenceConditions {
|
|
13
|
+
readonly initialStateControlled: boolean;
|
|
14
|
+
readonly operationOrderControlled: boolean;
|
|
15
|
+
readonly inputValuesControlled: boolean;
|
|
16
|
+
readonly transitionCountControlled: boolean;
|
|
17
|
+
readonly notApplicable: readonly string[];
|
|
18
|
+
}
|
|
19
|
+
export declare const GOVERNOR_CONDITIONS: GovernorEquivalenceConditions;
|
|
20
|
+
/** Complete: the payload reconstructs State exactly (contrast: the field is `partial-observable`). */
|
|
21
|
+
export declare const GOVERNOR_SNAPSHOT_FIDELITY: SnapshotFidelity;
|
|
22
|
+
/** Every construct is represented — nothing is substrate-owned, lossy, or unavailable. */
|
|
23
|
+
export declare function governorStructuralCoverage(): CoverageEntry[];
|
|
24
|
+
export interface GovernorFixture {
|
|
25
|
+
readonly durations: readonly number[];
|
|
26
|
+
readonly budgetMs: number;
|
|
27
|
+
readonly conditions: GovernorEquivalenceConditions;
|
|
28
|
+
}
|
|
29
|
+
export declare function governorFixture(durations: readonly number[], budgetMs?: number): GovernorFixture;
|
|
30
|
+
/** RAW path — the authority. Drives the substrate directly; never through the adapter. */
|
|
31
|
+
export declare function runRawGovernorPath(fixture: GovernorFixture): GovernorSemanticStep[];
|
|
32
|
+
/** ADAPTED path — identical fixture, routed through DynamicsContract + hostWorld. */
|
|
33
|
+
export declare function runAdaptedGovernorPath(fixture: GovernorFixture): GovernorSemanticStep[];
|
|
34
|
+
export interface GovernorDivergence {
|
|
35
|
+
readonly step: number;
|
|
36
|
+
readonly field: string;
|
|
37
|
+
readonly detail: string;
|
|
38
|
+
}
|
|
39
|
+
export interface GovernorEquivalenceResult {
|
|
40
|
+
readonly equivalent: boolean;
|
|
41
|
+
readonly divergences: readonly GovernorDivergence[];
|
|
42
|
+
readonly transitionsCompared: number;
|
|
43
|
+
readonly conditions: GovernorEquivalenceConditions;
|
|
44
|
+
readonly coverage: readonly CoverageEntry[];
|
|
45
|
+
readonly snapshotFidelity: SnapshotFidelity;
|
|
46
|
+
}
|
|
47
|
+
/** Compare at EVERY transition. All values are discrete → exact equality, no tolerance needed. */
|
|
48
|
+
export declare function compareGovernorTraces(raw: readonly GovernorSemanticStep[], adapted: readonly GovernorSemanticStep[], fixture: GovernorFixture): GovernorEquivalenceResult;
|
|
49
|
+
/** Final-state-only comparison — used ONLY to demonstrate it can false-pass. */
|
|
50
|
+
export declare function compareGovernorFinalOnly(raw: readonly GovernorSemanticStep[], adapted: readonly GovernorSemanticStep[], fixture: GovernorFixture): boolean;
|
|
51
|
+
//# sourceMappingURL=governor-equivalence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"governor-equivalence.d.ts","sourceRoot":"","sources":["../../src/world/governor-equivalence.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAiB,aAAa,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEvF,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,6FAA6F;A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AAC;IACrC,QAAQ,CAAC,UAAU,EAAE,6BAA6B,CAAC;IACnD,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAC;IAC5C,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;CAC7C;AAED,kGAAkG;AAClG,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,SAAS,oBAAoB,EAAE,EACpC,OAAO,EAAE,SAAS,oBAAoB,EAAE,EACxC,OAAO,EAAE,eAAe,GACvB,yBAAyB,CAuB3B;AAED,gFAAgF;AAChF,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,SAAS,oBAAoB,EAAE,EACpC,OAAO,EAAE,SAAS,oBAAoB,EAAE,EACxC,OAAO,EAAE,eAAe,GACvB,OAAO,CAKT"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* G3.2 — raw-vs-adapted equivalence for the SECOND substrate (the governor rule set).
|
|
3
|
+
*
|
|
4
|
+
* Same discipline as F1.4: the RAW substrate is the baseline authority (driven directly via
|
|
5
|
+
* `feedGovernor`), the adapted path routes the identical fixture through `DynamicsContract` +
|
|
6
|
+
* `hostWorld`, and equivalence is compared at EVERY transition — never final state alone.
|
|
7
|
+
*
|
|
8
|
+
* The controls differ from the field, and that difference is itself evidence: this substrate has no
|
|
9
|
+
* clock, no randomness, no queue, no environment, no retry policy and no external I/O, so those
|
|
10
|
+
* controls are recorded as NOT-APPLICABLE rather than silently claimed. Field-free at runtime (the
|
|
11
|
+
* shared vocabulary is imported type-only). Internal/experimental.
|
|
12
|
+
*/
|
|
13
|
+
import { hostWorld } from "./kernel.js";
|
|
14
|
+
import { createWorldEnvelope } from "./envelope.js";
|
|
15
|
+
import { governorDynamics } from "./adapters/governor-runtime.js";
|
|
16
|
+
import { feedGovernor, initialGovernorState, DEFAULT_BUDGET_MS } from "./substrates/governor.js";
|
|
17
|
+
export const GOVERNOR_CONDITIONS = {
|
|
18
|
+
initialStateControlled: true,
|
|
19
|
+
operationOrderControlled: true,
|
|
20
|
+
inputValuesControlled: true,
|
|
21
|
+
transitionCountControlled: true,
|
|
22
|
+
notApplicable: ['clock', 'randomness', 'queue-order', 'environment', 'retry-policy', 'external-response', 'host-geometry'],
|
|
23
|
+
};
|
|
24
|
+
/** Complete: the payload reconstructs State exactly (contrast: the field is `partial-observable`). */
|
|
25
|
+
export const GOVERNOR_SNAPSHOT_FIDELITY = 'complete-restorable';
|
|
26
|
+
/** Every construct is represented — nothing is substrate-owned, lossy, or unavailable. */
|
|
27
|
+
export function governorStructuralCoverage() {
|
|
28
|
+
const rep = (construct) => ({ construct, classification: 'represented' });
|
|
29
|
+
return [
|
|
30
|
+
rep('tier'),
|
|
31
|
+
rep('overrun streak'),
|
|
32
|
+
rep('clean streak'),
|
|
33
|
+
rep('budget'),
|
|
34
|
+
rep('transition law (declared escalation table)'),
|
|
35
|
+
rep('tier-change events'),
|
|
36
|
+
rep('snapshot state'),
|
|
37
|
+
rep('failure state'),
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
export function governorFixture(durations, budgetMs = DEFAULT_BUDGET_MS) {
|
|
41
|
+
return { durations, budgetMs, conditions: GOVERNOR_CONDITIONS };
|
|
42
|
+
}
|
|
43
|
+
function world() {
|
|
44
|
+
return { envelope: createWorldEnvelope('governor-world'), entities: [], relations: [], invariants: [], projections: [] };
|
|
45
|
+
}
|
|
46
|
+
/** RAW path — the authority. Drives the substrate directly; never through the adapter. */
|
|
47
|
+
export function runRawGovernorPath(fixture) {
|
|
48
|
+
let state = initialGovernorState(fixture.budgetMs);
|
|
49
|
+
const trace = [
|
|
50
|
+
{ step: 0, tier: state.tier, overrunStreak: state.overrunStreak, cleanStreak: state.cleanStreak, changed: false },
|
|
51
|
+
];
|
|
52
|
+
fixture.durations.forEach((d, i) => {
|
|
53
|
+
if (!Number.isFinite(d) || d < 0) {
|
|
54
|
+
trace.push({ step: i + 1, tier: state.tier, overrunStreak: state.overrunStreak, cleanStreak: state.cleanStreak, changed: false, failure: 'invalid-state' });
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const r = feedGovernor(state, d);
|
|
58
|
+
state = r.state;
|
|
59
|
+
trace.push({ step: i + 1, tier: state.tier, overrunStreak: state.overrunStreak, cleanStreak: state.cleanStreak, changed: r.changed !== undefined });
|
|
60
|
+
});
|
|
61
|
+
return trace;
|
|
62
|
+
}
|
|
63
|
+
/** ADAPTED path — identical fixture, routed through DynamicsContract + hostWorld. */
|
|
64
|
+
export function runAdaptedGovernorPath(fixture) {
|
|
65
|
+
const w = world();
|
|
66
|
+
const host = hostWorld(w, governorDynamics(w, fixture.budgetMs));
|
|
67
|
+
const trace = [];
|
|
68
|
+
const s0 = host.readState();
|
|
69
|
+
if (s0.ok) {
|
|
70
|
+
const m = s0.value.reading.metrics;
|
|
71
|
+
trace.push({ step: 0, tier: m.tier, overrunStreak: m.overrunStreak, cleanStreak: m.cleanStreak, changed: false });
|
|
72
|
+
}
|
|
73
|
+
fixture.durations.forEach((d, i) => {
|
|
74
|
+
const adv = host.advance({ durationMs: d });
|
|
75
|
+
if (!adv.ok) {
|
|
76
|
+
const rs = host.readState();
|
|
77
|
+
const m = rs.ok ? rs.value.reading.metrics : { tier: 0, overrunStreak: 0, cleanStreak: 0 };
|
|
78
|
+
trace.push({ step: i + 1, tier: m.tier, overrunStreak: m.overrunStreak, cleanStreak: m.cleanStreak, changed: false, failure: adv.error.code });
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const rs = host.readState();
|
|
82
|
+
const m = rs.ok ? rs.value.reading.metrics : { tier: 0, overrunStreak: 0, cleanStreak: 0 };
|
|
83
|
+
trace.push({ step: i + 1, tier: m.tier, overrunStreak: m.overrunStreak, cleanStreak: m.cleanStreak, changed: adv.value.changed });
|
|
84
|
+
});
|
|
85
|
+
host.dispose();
|
|
86
|
+
return trace;
|
|
87
|
+
}
|
|
88
|
+
/** Compare at EVERY transition. All values are discrete → exact equality, no tolerance needed. */
|
|
89
|
+
export function compareGovernorTraces(raw, adapted, fixture) {
|
|
90
|
+
const divergences = [];
|
|
91
|
+
if (raw.length !== adapted.length) {
|
|
92
|
+
divergences.push({ step: -1, field: 'step-count', detail: `raw ${raw.length} vs adapted ${adapted.length}` });
|
|
93
|
+
}
|
|
94
|
+
const n = Math.min(raw.length, adapted.length);
|
|
95
|
+
for (let i = 0; i < n; i++) {
|
|
96
|
+
const r = raw[i];
|
|
97
|
+
const a = adapted[i];
|
|
98
|
+
if (r.tier !== a.tier)
|
|
99
|
+
divergences.push({ step: i, field: 'tier', detail: `${r.tier} vs ${a.tier}` });
|
|
100
|
+
if (r.overrunStreak !== a.overrunStreak)
|
|
101
|
+
divergences.push({ step: i, field: 'overrunStreak', detail: `${r.overrunStreak} vs ${a.overrunStreak}` });
|
|
102
|
+
if (r.cleanStreak !== a.cleanStreak)
|
|
103
|
+
divergences.push({ step: i, field: 'cleanStreak', detail: `${r.cleanStreak} vs ${a.cleanStreak}` });
|
|
104
|
+
if (r.changed !== a.changed)
|
|
105
|
+
divergences.push({ step: i, field: 'changed(event)', detail: `${r.changed} vs ${a.changed}` });
|
|
106
|
+
if (r.failure !== a.failure)
|
|
107
|
+
divergences.push({ step: i, field: 'failure', detail: `${r.failure ?? 'none'} vs ${a.failure ?? 'none'}` });
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
equivalent: divergences.length === 0,
|
|
111
|
+
divergences,
|
|
112
|
+
transitionsCompared: n,
|
|
113
|
+
conditions: fixture.conditions,
|
|
114
|
+
coverage: governorStructuralCoverage(),
|
|
115
|
+
snapshotFidelity: GOVERNOR_SNAPSHOT_FIDELITY,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/** Final-state-only comparison — used ONLY to demonstrate it can false-pass. */
|
|
119
|
+
export function compareGovernorFinalOnly(raw, adapted, fixture) {
|
|
120
|
+
const r = raw[raw.length - 1];
|
|
121
|
+
const a = adapted[adapted.length - 1];
|
|
122
|
+
if (!r || !a)
|
|
123
|
+
return false;
|
|
124
|
+
return compareGovernorTraces([r], [a], fixture).equivalent;
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=governor-equivalence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"governor-equivalence.js","sourceRoot":"","sources":["../../src/world/governor-equivalence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAsBjG,MAAM,CAAC,MAAM,mBAAmB,GAAkC;IAChE,sBAAsB,EAAE,IAAI;IAC5B,wBAAwB,EAAE,IAAI;IAC9B,qBAAqB,EAAE,IAAI;IAC3B,yBAAyB,EAAE,IAAI;IAC/B,aAAa,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,mBAAmB,EAAE,eAAe,CAAC;CAC3H,CAAC;AAEF,sGAAsG;AACtG,MAAM,CAAC,MAAM,0BAA0B,GAAqB,qBAAqB,CAAC;AAElF,0FAA0F;AAC1F,MAAM,UAAU,0BAA0B;IACxC,MAAM,GAAG,GAAG,CAAC,SAAiB,EAAiB,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,aAA8B,EAAE,CAAC,CAAC;IAClH,OAAO;QACL,GAAG,CAAC,MAAM,CAAC;QACX,GAAG,CAAC,gBAAgB,CAAC;QACrB,GAAG,CAAC,cAAc,CAAC;QACnB,GAAG,CAAC,QAAQ,CAAC;QACb,GAAG,CAAC,4CAA4C,CAAC;QACjD,GAAG,CAAC,oBAAoB,CAAC;QACzB,GAAG,CAAC,gBAAgB,CAAC;QACrB,GAAG,CAAC,eAA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CAAC,OAAO;YAAE,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC5H,IAAI,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO;YAAE,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,IAAI,MAAM,OAAO,CAAC,CAAC,OAAO,IAAI,MAAM,EAAE,EAAE,CAAC,CAAC;IAC3I,CAAC;IACD,OAAO;QACL,UAAU,EAAE,WAAW,CAAC,MAAM,KAAK,CAAC;QACpC,WAAW;QACX,mBAAmB,EAAE,CAAC;QACtB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,QAAQ,EAAE,0BAA0B,EAAE;QACtC,gBAAgB,EAAE,0BAA0B;KAC7C,CAAC;AACJ,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,wBAAwB,CACtC,GAAoC,EACpC,OAAwC,EACxC,OAAwB;IAExB,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC9B,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACtC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3B,OAAO,qBAAqB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,UAAU,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The world kernel host (F1.3). Hosts a declared {@link World} with a {@link DynamicsContract} and
|
|
3
|
+
* ORCHESTRATES its execution: it initializes the contract, threads the opaque `State` through
|
|
4
|
+
* `advance`, and reads state through `snapshot` — WITHOUT understanding the dynamics and WITHOUT holding
|
|
5
|
+
* any substrate-specific reference (the field instance, if any, lives inside `State`, which the substrate
|
|
6
|
+
* created; the kernel treats `State` as opaque). OS/VM position: the kernel defines the contract under
|
|
7
|
+
* which substrates run; it does not encode any substrate's instruction set.
|
|
8
|
+
*
|
|
9
|
+
* EXPERIMENTAL, field-free (enforced by `world/architecture.test.ts`).
|
|
10
|
+
*/
|
|
11
|
+
import type { World, WorldInvariant, WorldStateSnapshot } from './world.ts';
|
|
12
|
+
import type { DynamicsContract, DynamicsEvidence, DynamicsResult, DynamicsSnapshot, TransitionLifecycle } from './dynamics.ts';
|
|
13
|
+
export interface InvariantResult {
|
|
14
|
+
readonly invariant: WorldInvariant;
|
|
15
|
+
readonly held: boolean;
|
|
16
|
+
readonly detail: string;
|
|
17
|
+
}
|
|
18
|
+
export interface KernelHost<State, Input, Output, Evidence = DynamicsEvidence> {
|
|
19
|
+
readonly world: World;
|
|
20
|
+
readonly dynamics: DynamicsContract<State, Input, Output, Evidence>;
|
|
21
|
+
/** True once `initialize` succeeded. */
|
|
22
|
+
readonly initialized: boolean;
|
|
23
|
+
/** Execute the contract once. The kernel threads `State`; it does not inspect it. */
|
|
24
|
+
advance(input: Input): DynamicsResult<Output, Evidence>;
|
|
25
|
+
/**
|
|
26
|
+
* Lifecycle reported by the most recent successful `advance` (corpus finding C1) — the generic signal
|
|
27
|
+
* that tells a kernel whether to keep advancing, without reading substrate-specific output.
|
|
28
|
+
* `'continuing'` before any transition, and for substrates that predate the concept.
|
|
29
|
+
*
|
|
30
|
+
* Deliberately a host reading rather than a field on `advance`'s result: carrying it in the result
|
|
31
|
+
* would change the shape every existing call site destructures, including the F1.4 equivalence
|
|
32
|
+
* harness that serves as the raw-vs-adapted authority. Perturbing that authority to improve an API
|
|
33
|
+
* shape is a bad trade mid-program. Folding it into the result is the better long-term design and is
|
|
34
|
+
* the natural move the next time this API is revised.
|
|
35
|
+
*/
|
|
36
|
+
readonly lastLifecycle: TransitionLifecycle;
|
|
37
|
+
/** Read state via the contract's snapshot (if the substrate advertises the capability). */
|
|
38
|
+
readState(): DynamicsResult<DynamicsSnapshot, Evidence> | {
|
|
39
|
+
readonly ok: false;
|
|
40
|
+
readonly reason: string;
|
|
41
|
+
};
|
|
42
|
+
/** Generic invariant check over a readable projection — no substrate knowledge. */
|
|
43
|
+
checkInvariants(reading: WorldStateSnapshot): InvariantResult[];
|
|
44
|
+
dispose(): void;
|
|
45
|
+
}
|
|
46
|
+
export declare function hostWorld<State, Input, Output, Evidence = DynamicsEvidence>(world: World, dynamics: DynamicsContract<State, Input, Output, Evidence>): KernelHost<State, Input, Output, Evidence>;
|
|
47
|
+
/** Generic invariant checking over a readable projection — NO substrate knowledge. */
|
|
48
|
+
export declare function checkInvariantsAgainst(world: World, reading: WorldStateSnapshot): InvariantResult[];
|
|
49
|
+
//# sourceMappingURL=kernel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../../src/world/kernel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAG,gBAAgB;IAC3E,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IACpE,wCAAwC;IACxC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,qFAAqF;IACrF,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,cAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACxD;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,aAAa,EAAE,mBAAmB,CAAC;IAC5C,2FAA2F;IAC3F,SAAS,IAAI,cAAc,CAAC,gBAAgB,EAAE,QAAQ,CAAC,GAAG;QAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1G,mFAAmF;IACnF,eAAe,CAAC,OAAO,EAAE,kBAAkB,GAAG,eAAe,EAAE,CAAC;IAChE,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAG,gBAAgB,EACzE,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,GACzD,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CA2C5C;AAED,sFAAsF;AACtF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,kBAAkB,GAAG,eAAe,EAAE,CAiBnG"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export function hostWorld(world, dynamics) {
|
|
2
|
+
const init = dynamics.initialize({ declaration: world });
|
|
3
|
+
let state = init.ok ? init.value : undefined;
|
|
4
|
+
let step = 0;
|
|
5
|
+
let lifecycle = 'continuing';
|
|
6
|
+
return {
|
|
7
|
+
world,
|
|
8
|
+
dynamics,
|
|
9
|
+
get initialized() {
|
|
10
|
+
return state !== undefined;
|
|
11
|
+
},
|
|
12
|
+
get lastLifecycle() {
|
|
13
|
+
return lifecycle;
|
|
14
|
+
},
|
|
15
|
+
advance(input) {
|
|
16
|
+
if (state === undefined) {
|
|
17
|
+
return { ok: false, error: { code: 'invalid-state', message: 'contract not initialized' }, evidence: init.evidence };
|
|
18
|
+
}
|
|
19
|
+
const result = dynamics.advance(state, input, { step });
|
|
20
|
+
if (result.ok) {
|
|
21
|
+
state = result.value.state;
|
|
22
|
+
step += 1;
|
|
23
|
+
// absent is read as continuing — substrates predating the concept are unaffected
|
|
24
|
+
lifecycle = result.value.lifecycle ?? 'continuing';
|
|
25
|
+
return { ok: true, value: result.value.output, evidence: result.evidence };
|
|
26
|
+
}
|
|
27
|
+
return { ok: false, error: result.error, evidence: result.evidence };
|
|
28
|
+
},
|
|
29
|
+
readState() {
|
|
30
|
+
if (state === undefined)
|
|
31
|
+
return { ok: false, reason: 'contract not initialized' };
|
|
32
|
+
if (!dynamics.capabilities.snapshot || !dynamics.snapshot) {
|
|
33
|
+
return { ok: false, reason: 'substrate does not advertise snapshot' };
|
|
34
|
+
}
|
|
35
|
+
return dynamics.snapshot(state, { step });
|
|
36
|
+
},
|
|
37
|
+
checkInvariants(reading) {
|
|
38
|
+
return checkInvariantsAgainst(world, reading);
|
|
39
|
+
},
|
|
40
|
+
dispose() {
|
|
41
|
+
state = undefined;
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/** Generic invariant checking over a readable projection — NO substrate knowledge. */
|
|
46
|
+
export function checkInvariantsAgainst(world, reading) {
|
|
47
|
+
return world.invariants.map((invariant) => {
|
|
48
|
+
if (invariant.kind === 'count') {
|
|
49
|
+
const metric = String(invariant.spec.metric ?? 'entities');
|
|
50
|
+
const expected = Number(invariant.spec.value);
|
|
51
|
+
const actual = metric === 'entities' ? reading.entities.length : (reading.metrics[metric] ?? Number.NaN);
|
|
52
|
+
return { invariant, held: actual === expected, detail: `${metric}=${actual}, expected ${expected}` };
|
|
53
|
+
}
|
|
54
|
+
if (invariant.kind === 'range') {
|
|
55
|
+
const metric = String(invariant.spec.metric);
|
|
56
|
+
const value = reading.metrics[metric] ?? Number.NaN;
|
|
57
|
+
const min = Number(invariant.spec.min);
|
|
58
|
+
const max = Number(invariant.spec.max);
|
|
59
|
+
return { invariant, held: value >= min && value <= max, detail: `${metric}=${value} in [${min},${max}]` };
|
|
60
|
+
}
|
|
61
|
+
return { invariant, held: true, detail: `unchecked kind "${invariant.kind}"` };
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=kernel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kernel.js","sourceRoot":"","sources":["../../src/world/kernel.ts"],"names":[],"mappings":"AAmDA,MAAM,UAAU,SAAS,CACvB,KAAY,EACZ,QAA0D;IAE1D,MAAM,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;IACzD,IAAI,KAAK,GAAsB,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAChE,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,SAAS,GAAwB,YAAY,CAAC;IAElD,OAAO;QACL,KAAK;QACL,QAAQ;QACR,IAAI,WAAW;YACb,OAAO,KAAK,KAAK,SAAS,CAAC;QAC7B,CAAC;QACD,IAAI,aAAa;YACf,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,CAAC,KAAY;YAClB,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,0BAA0B,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;YACvH,CAAC;YACD,MAAM,MAAM,GAA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BAAmB,SAAS,CAAC,IAAI,GAAG,EAAE,CAAC;IACjF,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ObservatoryBundle } from './evidence-log.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Assemble the whole bundle. Registry sections are passed through VERBATIM — a test asserts they
|
|
4
|
+
* deep-equal the live registries, so the Observatory cannot show a discovery the runtime does not hold.
|
|
5
|
+
*/
|
|
6
|
+
export declare function captureBundle(revision: {
|
|
7
|
+
commit: string;
|
|
8
|
+
coreVersion: string;
|
|
9
|
+
}): ObservatoryBundle;
|
|
10
|
+
//# sourceMappingURL=capture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../../src/world/observatory/capture.ts"],"names":[],"mappings":"AAqCA,OAAO,EAIL,KAAK,iBAAiB,EAMvB,MAAM,mBAAmB,CAAC;AA2S3B;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,iBAAiB,CAkFlG"}
|