@fundamental-engine/core 0.9.4 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/dist/engine/field.d.ts.map +1 -1
  2. package/dist/engine/field.js +10 -0
  3. package/dist/engine/field.js.map +1 -1
  4. package/dist/engine/types.d.ts +29 -0
  5. package/dist/engine/types.d.ts.map +1 -1
  6. package/dist/inspect/report.js +2 -2
  7. package/dist/inspect/report.js.map +1 -1
  8. package/dist/recipes/catalog.d.ts +14 -9
  9. package/dist/recipes/catalog.d.ts.map +1 -1
  10. package/dist/recipes/catalog.js +9 -5
  11. package/dist/recipes/catalog.js.map +1 -1
  12. package/dist/recipes/compile.d.ts +26 -16
  13. package/dist/recipes/compile.d.ts.map +1 -1
  14. package/dist/recipes/compile.js +14 -10
  15. package/dist/recipes/compile.js.map +1 -1
  16. package/dist/recipes/index.d.ts +2 -0
  17. package/dist/recipes/index.d.ts.map +1 -1
  18. package/dist/recipes/index.js +5 -3
  19. package/dist/recipes/index.js.map +1 -1
  20. package/dist/recipes/schema.d.ts +27 -17
  21. package/dist/recipes/schema.d.ts.map +1 -1
  22. package/dist/recipes/schema.js +11 -6
  23. package/dist/recipes/schema.js.map +1 -1
  24. package/dist/recipes/wayfinding.d.ts +1 -1
  25. package/dist/version.d.ts +1 -1
  26. package/dist/version.d.ts.map +1 -1
  27. package/dist/version.js +1 -1
  28. package/dist/version.js.map +1 -1
  29. package/dist/world/ablation/ablation.d.ts +39 -0
  30. package/dist/world/ablation/ablation.d.ts.map +1 -0
  31. package/dist/world/ablation/ablation.js +449 -0
  32. package/dist/world/ablation/ablation.js.map +1 -0
  33. package/dist/world/adapters/field-runtime.d.ts +56 -0
  34. package/dist/world/adapters/field-runtime.d.ts.map +1 -0
  35. package/dist/world/adapters/field-runtime.js +250 -0
  36. package/dist/world/adapters/field-runtime.js.map +1 -0
  37. package/dist/world/adapters/fsm-runtime.d.ts +18 -0
  38. package/dist/world/adapters/fsm-runtime.d.ts.map +1 -0
  39. package/dist/world/adapters/fsm-runtime.js +153 -0
  40. package/dist/world/adapters/fsm-runtime.js.map +1 -0
  41. package/dist/world/adapters/governor-runtime.d.ts +23 -0
  42. package/dist/world/adapters/governor-runtime.d.ts.map +1 -0
  43. package/dist/world/adapters/governor-runtime.js +185 -0
  44. package/dist/world/adapters/governor-runtime.js.map +1 -0
  45. package/dist/world/adapters/planner-runtime.d.ts +20 -0
  46. package/dist/world/adapters/planner-runtime.d.ts.map +1 -0
  47. package/dist/world/adapters/planner-runtime.js +144 -0
  48. package/dist/world/adapters/planner-runtime.js.map +1 -0
  49. package/dist/world/conformance/corpus.d.ts +89 -0
  50. package/dist/world/conformance/corpus.d.ts.map +1 -0
  51. package/dist/world/conformance/corpus.js +195 -0
  52. package/dist/world/conformance/corpus.js.map +1 -0
  53. package/dist/world/conformance/discoveries.d.ts +50 -0
  54. package/dist/world/conformance/discoveries.d.ts.map +1 -0
  55. package/dist/world/conformance/discoveries.js +71 -0
  56. package/dist/world/conformance/discoveries.js.map +1 -0
  57. package/dist/world/conformance/evidence.d.ts +37 -0
  58. package/dist/world/conformance/evidence.d.ts.map +1 -0
  59. package/dist/world/conformance/evidence.js +53 -0
  60. package/dist/world/conformance/evidence.js.map +1 -0
  61. package/dist/world/conformance/negative-results.d.ts +57 -0
  62. package/dist/world/conformance/negative-results.d.ts.map +1 -0
  63. package/dist/world/conformance/negative-results.js +73 -0
  64. package/dist/world/conformance/negative-results.js.map +1 -0
  65. package/dist/world/conformance/predictions.d.ts +66 -0
  66. package/dist/world/conformance/predictions.d.ts.map +1 -0
  67. package/dist/world/conformance/predictions.js +141 -0
  68. package/dist/world/conformance/predictions.js.map +1 -0
  69. package/dist/world/cross-substrate.d.ts +19 -0
  70. package/dist/world/cross-substrate.d.ts.map +1 -0
  71. package/dist/world/cross-substrate.js +123 -0
  72. package/dist/world/cross-substrate.js.map +1 -0
  73. package/dist/world/dynamics.d.ts +166 -0
  74. package/dist/world/dynamics.d.ts.map +1 -0
  75. package/dist/world/dynamics.js +30 -0
  76. package/dist/world/dynamics.js.map +1 -0
  77. package/dist/world/envelope.d.ts +44 -0
  78. package/dist/world/envelope.d.ts.map +1 -0
  79. package/dist/world/envelope.js +77 -0
  80. package/dist/world/envelope.js.map +1 -0
  81. package/dist/world/episodes/episodes.d.ts +64 -0
  82. package/dist/world/episodes/episodes.d.ts.map +1 -0
  83. package/dist/world/episodes/episodes.js +104 -0
  84. package/dist/world/episodes/episodes.js.map +1 -0
  85. package/dist/world/equivalence.d.ts +70 -0
  86. package/dist/world/equivalence.d.ts.map +1 -0
  87. package/dist/world/equivalence.js +205 -0
  88. package/dist/world/equivalence.js.map +1 -0
  89. package/dist/world/experiments/declarative-dynamics.d.ts +87 -0
  90. package/dist/world/experiments/declarative-dynamics.d.ts.map +1 -0
  91. package/dist/world/experiments/declarative-dynamics.js +153 -0
  92. package/dist/world/experiments/declarative-dynamics.js.map +1 -0
  93. package/dist/world/governor-equivalence.d.ts +51 -0
  94. package/dist/world/governor-equivalence.d.ts.map +1 -0
  95. package/dist/world/governor-equivalence.js +126 -0
  96. package/dist/world/governor-equivalence.js.map +1 -0
  97. package/dist/world/kernel.d.ts +49 -0
  98. package/dist/world/kernel.d.ts.map +1 -0
  99. package/dist/world/kernel.js +64 -0
  100. package/dist/world/kernel.js.map +1 -0
  101. package/dist/world/observatory/capture.d.ts +10 -0
  102. package/dist/world/observatory/capture.d.ts.map +1 -0
  103. package/dist/world/observatory/capture.js +371 -0
  104. package/dist/world/observatory/capture.js.map +1 -0
  105. package/dist/world/observatory/evidence-log.d.ts +131 -0
  106. package/dist/world/observatory/evidence-log.d.ts.map +1 -0
  107. package/dist/world/observatory/evidence-log.js +43 -0
  108. package/dist/world/observatory/evidence-log.js.map +1 -0
  109. package/dist/world/opportunity/opportunity.d.ts +85 -0
  110. package/dist/world/opportunity/opportunity.d.ts.map +1 -0
  111. package/dist/world/opportunity/opportunity.js +67 -0
  112. package/dist/world/opportunity/opportunity.js.map +1 -0
  113. package/dist/world/projection/evidence-profile.d.ts +51 -0
  114. package/dist/world/projection/evidence-profile.d.ts.map +1 -0
  115. package/dist/world/projection/evidence-profile.js +93 -0
  116. package/dist/world/projection/evidence-profile.js.map +1 -0
  117. package/dist/world/projection/projection.d.ts +162 -0
  118. package/dist/world/projection/projection.d.ts.map +1 -0
  119. package/dist/world/projection/projection.js +145 -0
  120. package/dist/world/projection/projection.js.map +1 -0
  121. package/dist/world/properties/properties.d.ts +87 -0
  122. package/dist/world/properties/properties.d.ts.map +1 -0
  123. package/dist/world/properties/properties.js +172 -0
  124. package/dist/world/properties/properties.js.map +1 -0
  125. package/dist/world/substrates/fsm.d.ts +59 -0
  126. package/dist/world/substrates/fsm.d.ts.map +1 -0
  127. package/dist/world/substrates/fsm.js +57 -0
  128. package/dist/world/substrates/fsm.js.map +1 -0
  129. package/dist/world/substrates/governor.d.ts +53 -0
  130. package/dist/world/substrates/governor.d.ts.map +1 -0
  131. package/dist/world/substrates/governor.js +73 -0
  132. package/dist/world/substrates/governor.js.map +1 -0
  133. package/dist/world/substrates/planner.d.ts +82 -0
  134. package/dist/world/substrates/planner.d.ts.map +1 -0
  135. package/dist/world/substrates/planner.js +114 -0
  136. package/dist/world/substrates/planner.js.map +1 -0
  137. package/dist/world/world.d.ts +73 -0
  138. package/dist/world/world.d.ts.map +1 -0
  139. package/dist/world/world.js +2 -0
  140. package/dist/world/world.js.map +1 -0
  141. package/package.json +1 -1
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Prediction registry and accuracy metric (EXPERIMENTAL, internal).
3
+ *
4
+ * Contract stability and predictive power are different things, and only one of them is evidence of
5
+ * maturity. A contract nobody ever changes might be stable because it is right, or because nobody is
6
+ * testing it hard. What distinguishes a maturing theory is that it **predicts where it will fail**, and
7
+ * is surprised only in specific, explainable ways.
8
+ *
9
+ * So every substrate adaptation registers its expectations BEFORE adapting, and they are graded
10
+ * afterwards whether or not they held.
11
+ *
12
+ * ## Two hazards this file is designed against
13
+ *
14
+ * **1. The slush bucket.** `partially-confirmed` is the grade that lets a wrong prediction feel
15
+ * half-right. It is therefore only available to predictions that declared **two or more independent
16
+ * components in advance**, each graded separately. A single-component prediction can only be confirmed
17
+ * or falsified. `gradingProblems()` enforces this.
18
+ *
19
+ * **2. Self-grading.** These predictions are written and graded by the same author who writes the
20
+ * contract, so the accuracy number is not independent evidence. The real guarantee is commit order:
21
+ * `registeredIn` names the commit that recorded the prediction, and it must predate the adaptation.
22
+ * The metric is a discipline, not a proof — stated here rather than in a footnote.
23
+ */
24
+ export type PredictionId = `P-${string}`;
25
+ export type PredictionGrade = 'confirmed' | 'partially-confirmed' | 'falsified' | 'pending';
26
+ export interface PredictionComponent {
27
+ readonly claim: string;
28
+ readonly held: boolean;
29
+ }
30
+ export interface Prediction {
31
+ readonly id: PredictionId;
32
+ readonly subject: string;
33
+ readonly statement: string;
34
+ /** The commit that registered this prediction. Must predate the adaptation that grades it. */
35
+ readonly registeredIn: string;
36
+ readonly grade: PredictionGrade;
37
+ /** Required for `partially-confirmed`; at least two, each independently graded. */
38
+ readonly components?: readonly PredictionComponent[];
39
+ /** What actually happened. Required for every graded prediction. */
40
+ readonly outcome?: string;
41
+ /** For falsified predictions: why the miss was informative. Falsifications are kept, never rewritten. */
42
+ readonly lesson?: string;
43
+ }
44
+ export declare function predictions(): Prediction[];
45
+ export interface PredictionProblem {
46
+ readonly id: PredictionId;
47
+ readonly rule: string;
48
+ readonly detail: string;
49
+ }
50
+ /** Enforces the grading discipline. A registry that cannot be audited is not evidence. */
51
+ export declare function gradingProblems(): PredictionProblem[];
52
+ export interface PredictionAccuracy {
53
+ readonly total: number;
54
+ readonly graded: number;
55
+ readonly confirmed: number;
56
+ readonly partiallyConfirmed: number;
57
+ readonly falsified: number;
58
+ readonly pending: number;
59
+ /** Confirmed / graded. Partial credit is NOT awarded — a partial is not most of a hit. */
60
+ readonly accuracy: number;
61
+ /** Falsified / graded. Tracked deliberately: a program with zero surprises is not being tested. */
62
+ readonly surpriseRate: number;
63
+ readonly auditable: boolean;
64
+ }
65
+ export declare function predictionAccuracy(): PredictionAccuracy;
66
+ //# sourceMappingURL=predictions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"predictions.d.ts","sourceRoot":"","sources":["../../../src/world/conformance/predictions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,MAAM,YAAY,GAAG,KAAK,MAAM,EAAE,CAAC;AAEzC,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,qBAAqB,GAAG,WAAW,GAAG,SAAS,CAAC;AAE5F,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,8FAA8F;IAC9F,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,mFAAmF;IACnF,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACrD,oEAAoE;IACpE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,yGAAyG;IACzG,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,WAAW,IAAI,UAAU,EAAE,CA8E1C;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,0FAA0F;AAC1F,wBAAgB,eAAe,IAAI,iBAAiB,EAAE,CAwBrD;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,0FAA0F;IAC1F,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,mGAAmG;IACnG,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAED,wBAAgB,kBAAkB,IAAI,kBAAkB,CAiBvD"}
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Prediction registry and accuracy metric (EXPERIMENTAL, internal).
3
+ *
4
+ * Contract stability and predictive power are different things, and only one of them is evidence of
5
+ * maturity. A contract nobody ever changes might be stable because it is right, or because nobody is
6
+ * testing it hard. What distinguishes a maturing theory is that it **predicts where it will fail**, and
7
+ * is surprised only in specific, explainable ways.
8
+ *
9
+ * So every substrate adaptation registers its expectations BEFORE adapting, and they are graded
10
+ * afterwards whether or not they held.
11
+ *
12
+ * ## Two hazards this file is designed against
13
+ *
14
+ * **1. The slush bucket.** `partially-confirmed` is the grade that lets a wrong prediction feel
15
+ * half-right. It is therefore only available to predictions that declared **two or more independent
16
+ * components in advance**, each graded separately. A single-component prediction can only be confirmed
17
+ * or falsified. `gradingProblems()` enforces this.
18
+ *
19
+ * **2. Self-grading.** These predictions are written and graded by the same author who writes the
20
+ * contract, so the accuracy number is not independent evidence. The real guarantee is commit order:
21
+ * `registeredIn` names the commit that recorded the prediction, and it must predate the adaptation.
22
+ * The metric is a discipline, not a proof — stated here rather than in a footnote.
23
+ */
24
+ export function predictions() {
25
+ return [
26
+ {
27
+ id: 'P-001',
28
+ subject: 'FiniteStateMachine',
29
+ statement: 'The FSM control will require zero contract change — it is the most contract-shaped substrate imaginable.',
30
+ registeredIn: 'd90b3bd2',
31
+ grade: 'falsified',
32
+ outcome: 'Churn 1. Accepting states finish, and the contract could not express termination without leaking substrate semantics.',
33
+ lesson: 'The miss was not about state machines. The contract lacked a concept that no prior substrate could exhibit, because neither the field nor the governor ever terminates. A control failing is the strongest available signal that a theory is incomplete rather than merely untested.',
34
+ },
35
+ {
36
+ id: 'P-002',
37
+ subject: 'SearchPlanner',
38
+ statement: 'The planner will expose a missing termination concept, classified structural rather than convenience.',
39
+ registeredIn: 'd90b3bd2',
40
+ grade: 'partially-confirmed',
41
+ components: [
42
+ { claim: 'a termination concept is missing from the contract', held: true },
43
+ { claim: 'the planner is the substrate that reveals it', held: false },
44
+ { claim: 'the change is structural, not a convenience', held: true },
45
+ ],
46
+ outcome: 'The gap was real and structural, but the FSM control reached it first, so the planner cost 0. Termination is general, not search-specific.',
47
+ },
48
+ {
49
+ id: 'P-003',
50
+ subject: 'SearchPlanner',
51
+ statement: "The planner's partially-declarable law will force executionKind 'hybrid', a variant declared in F1.3 but never exercised.",
52
+ registeredIn: 'd90b3bd2',
53
+ grade: 'confirmed',
54
+ outcome: "Confirmed. First substrate to use 'hybrid'. Weakened by author bias: the variant was known to exist while a planner with a computed heuristic was being chosen.",
55
+ },
56
+ {
57
+ id: 'P-004',
58
+ subject: 'EventSourcedAggregate',
59
+ statement: 'Churn 0: the existing replay / deterministicReplay split already separates log-replay from deterministic re-execution. If it does not, the distinction was cosmetic.',
60
+ registeredIn: 'd90b3bd2',
61
+ grade: 'pending',
62
+ },
63
+ // --- projection phase, registered before that phase begins
64
+ {
65
+ id: 'P-005',
66
+ subject: 'Projection / authority presentation',
67
+ statement: 'Authority presentation requires no new concept: presented-vs-effective already covers it, including delegated authority, which reduces to a grant with a different authoritySource.',
68
+ registeredIn: 'pending-registration',
69
+ grade: 'pending',
70
+ },
71
+ {
72
+ id: 'P-006',
73
+ subject: 'Projection / composition',
74
+ statement: 'Projecting a projection will expose a structural gap. The subtractive-power guarantee is proven only for one projection over a source; composition is untested, and evidence access in particular is expected not to compose.',
75
+ registeredIn: 'pending-registration',
76
+ grade: 'pending',
77
+ },
78
+ {
79
+ id: 'P-007',
80
+ subject: 'Projection / participant-relative state',
81
+ statement: 'Participant-relative state requires no participant model: it reduces to observation access plus scope, with belief remaining an unresolved obligation.',
82
+ registeredIn: 'pending-registration',
83
+ grade: 'pending',
84
+ },
85
+ {
86
+ id: 'P-008',
87
+ subject: 'Projection / invariant scope',
88
+ statement: 'Invariant scope needs one further distinction the current foundation lacks: an invariant that is unevaluable on a surface is not the same as one that is vacuously satisfied there.',
89
+ registeredIn: 'pending-registration',
90
+ grade: 'pending',
91
+ },
92
+ ];
93
+ }
94
+ /** Enforces the grading discipline. A registry that cannot be audited is not evidence. */
95
+ export function gradingProblems() {
96
+ const problems = [];
97
+ for (const p of predictions()) {
98
+ if (p.grade === 'partially-confirmed') {
99
+ const n = p.components?.length ?? 0;
100
+ if (n < 2) {
101
+ problems.push({ id: p.id, rule: 'partial-requires-components', detail: 'partially-confirmed requires >= 2 pre-declared components' });
102
+ }
103
+ else {
104
+ const held = p.components.filter((c) => c.held).length;
105
+ if (held === 0)
106
+ problems.push({ id: p.id, rule: 'partial-requires-a-hit', detail: 'no component held — this is falsified' });
107
+ if (held === n)
108
+ problems.push({ id: p.id, rule: 'partial-requires-a-miss', detail: 'every component held — this is confirmed' });
109
+ }
110
+ }
111
+ if (p.grade !== 'pending' && !p.outcome) {
112
+ problems.push({ id: p.id, rule: 'graded-requires-outcome', detail: 'a graded prediction must record what actually happened' });
113
+ }
114
+ if (p.grade === 'falsified' && !p.lesson) {
115
+ problems.push({ id: p.id, rule: 'falsified-requires-lesson', detail: 'falsifications are preserved with what they taught, never merely recorded' });
116
+ }
117
+ if (p.grade !== 'pending' && (p.registeredIn === 'pending-registration' || p.registeredIn.length === 0)) {
118
+ problems.push({ id: p.id, rule: 'graded-requires-registration', detail: 'a graded prediction must name the commit that registered it' });
119
+ }
120
+ }
121
+ return problems;
122
+ }
123
+ export function predictionAccuracy() {
124
+ const all = predictions();
125
+ const graded = all.filter((p) => p.grade !== 'pending');
126
+ const count = (g) => all.filter((p) => p.grade === g).length;
127
+ const confirmed = count('confirmed');
128
+ const falsified = count('falsified');
129
+ return {
130
+ total: all.length,
131
+ graded: graded.length,
132
+ confirmed,
133
+ partiallyConfirmed: count('partially-confirmed'),
134
+ falsified,
135
+ pending: count('pending'),
136
+ accuracy: graded.length === 0 ? 0 : confirmed / graded.length,
137
+ surpriseRate: graded.length === 0 ? 0 : falsified / graded.length,
138
+ auditable: gradingProblems().length === 0,
139
+ };
140
+ }
141
+ //# sourceMappingURL=predictions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"predictions.js","sourceRoot":"","sources":["../../../src/world/conformance/predictions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AA0BH,MAAM,UAAU,WAAW;IACzB,OAAO;QACL;YACE,EAAE,EAAE,OAAO;YACX,OAAO,EAAE,oBAAoB;YAC7B,SAAS,EAAE,0GAA0G;YACrH,YAAY,EAAE,UAAU;YACxB,KAAK,EAAE,WAAW;YAClB,OAAO,EAAE,uHAAuH;YAChI,MAAM,EACJ,sRAAsR;SACzR;QACD;YACE,EAAE,EAAE,OAAO;YACX,OAAO,EAAE,eAAe;YACxB,SAAS,EAAE,uGAAuG;YAClH,YAAY,EAAE,UAAU;YACxB,KAAK,EAAE,qBAAqB;YAC5B,UAAU,EAAE;gBACV,EAAE,KAAK,EAAE,oDAAoD,EAAE,IAAI,EAAE,IAAI,EAAE;gBAC3E,EAAE,KAAK,EAAE,8CAA8C,EAAE,IAAI,EAAE,KAAK,EAAE;gBACtE,EAAE,KAAK,EAAE,6CAA6C,EAAE,IAAI,EAAE,IAAI,EAAE;aACrE;YACD,OAAO,EACL,4IAA4I;SAC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specific-value' | 'field-biased' | 'second-substrate-biased' | 'missing-general-concept' | 'unnecessary-generalization' | 'unresolved';
2
+ export interface CrossSubstrateRow {
3
+ readonly dimension: string;
4
+ readonly field: string;
5
+ readonly governor: string;
6
+ readonly classification: ElementClassification;
7
+ readonly evidence: string;
8
+ }
9
+ export type GeneralizationOutcome = 'generalized' | 'generalized-with-refinement' | 'field-fitted' | 'inconclusive';
10
+ export interface CrossSubstrateResult {
11
+ readonly rows: readonly CrossSubstrateRow[];
12
+ readonly outcome: GeneralizationOutcome;
13
+ readonly refinements: readonly string[];
14
+ readonly rationale: string;
15
+ }
16
+ /** Builds the matrix by INSPECTING both live contracts, not from stored prose. */
17
+ export declare function crossSubstrateMatrix(): CrossSubstrateRow[];
18
+ export declare function crossSubstrateResult(): CrossSubstrateResult;
19
+ //# sourceMappingURL=cross-substrate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cross-substrate.d.ts","sourceRoot":"","sources":["../../src/world/cross-substrate.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,qBAAqB,GAC7B,mBAAmB,GACnB,0BAA0B,GAC1B,cAAc,GACd,yBAAyB,GACzB,yBAAyB,GACzB,4BAA4B,GAC5B,YAAY,CAAC;AAEjB,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,cAAc,EAAE,qBAAqB,CAAC;IAC/C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,MAAM,qBAAqB,GAC7B,aAAa,GACb,6BAA6B,GAC7B,cAAc,GACd,cAAc,CAAC;AAEnB,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAC5C,QAAQ,CAAC,OAAO,EAAE,qBAAqB,CAAC;IACxC,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAMD,kFAAkF;AAClF,wBAAgB,oBAAoB,IAAI,iBAAiB,EAAE,CA4F1D;AAED,wBAAgB,oBAAoB,IAAI,oBAAoB,CAmB3D"}
@@ -0,0 +1,123 @@
1
+ /**
2
+ * G3.3 — cross-substrate contract comparison (EXPERIMENTAL, internal).
3
+ *
4
+ * Compares the FieldRuntime substrate and the quality-governor substrate against the SAME
5
+ * `DynamicsContract`, dimension by dimension, and classifies each element. The question is whether the
6
+ * contract is substrate-neutral or quietly field-fitted.
7
+ *
8
+ * Every row is grounded in an executed fixture (G3.2 / F1.4), not in intent.
9
+ */
10
+ import { governorDynamics } from "./adapters/governor-runtime.js";
11
+ import { fieldRuntimeDynamics } from "./adapters/field-runtime.js";
12
+ import { createWorldEnvelope } from "./envelope.js";
13
+ function emptyWorld(id) {
14
+ return { envelope: createWorldEnvelope(id), entities: [], relations: [], invariants: [], projections: [] };
15
+ }
16
+ /** Builds the matrix by INSPECTING both live contracts, not from stored prose. */
17
+ export function crossSubstrateMatrix() {
18
+ const f = fieldRuntimeDynamics(emptyWorld('field-world'));
19
+ const g = governorDynamics(emptyWorld('governor-world'));
20
+ const caps = (c) => `snapshot=${c.capabilities.snapshot} restore=${c.capabilities.restore} replay=${c.capabilities.replay} inspect=${c.capabilities.inspectInternalState} law=${c.capabilities.declareTransitionLaw}`;
21
+ return [
22
+ {
23
+ dimension: 'state model', field: 'opaque handle + closure-scattered runtime state', governor: 'plain data record (tier, streaks, budget)',
24
+ classification: 'substrate-specific-value',
25
+ evidence: 'both threaded as opaque `State` by the kernel; neither leaked into World',
26
+ },
27
+ {
28
+ dimension: 'input model', field: '{ steps? }', governor: '{ durationMs }',
29
+ classification: 'substrate-specific-value', evidence: 'generic `Input` type parameter carried both',
30
+ },
31
+ {
32
+ dimension: 'output model', field: '{ steps }', governor: '{ tier, changed }',
33
+ classification: 'substrate-specific-value', evidence: 'generic `Output` type parameter carried both',
34
+ },
35
+ {
36
+ dimension: 'executionKind', field: f.executionKind, governor: g.executionKind,
37
+ classification: 'supported-by-both', evidence: 'the closed union expressed both extremes without extension',
38
+ },
39
+ {
40
+ dimension: 'determinism', field: `${f.determinism.classification} (uncontrolled: ${f.determinism.uncontrolledInputs.length})`,
41
+ governor: `${g.determinism.classification} (uncontrolled: ${g.determinism.uncontrolledInputs.length})`,
42
+ classification: 'supported-by-both',
43
+ evidence: 'the declaration form expressed conditional and exact determinism honestly; the validator rejects `deterministic` with uncontrolled inputs',
44
+ },
45
+ {
46
+ dimension: 'capabilities', field: caps(f), governor: caps(g),
47
+ classification: 'supported-by-both',
48
+ evidence: 'conservative flags distinguished a lossy snapshot-only substrate from a fully restorable one',
49
+ },
50
+ {
51
+ dimension: 'evidence shape', field: 'declaredInputs / substrateResponses / executionTrace / unresolvedInterpretations',
52
+ governor: 'same five channels; unresolvedInterpretations records "tier as perceived quality"',
53
+ classification: 'supported-by-both', evidence: 'neither substrate needed a channel the other lacked',
54
+ },
55
+ {
56
+ dimension: 'failure semantics', field: 'no in-run failure exercised; typed codes available',
57
+ governor: 'invalid-state on non-finite input; restore rejection',
58
+ classification: 'supported-by-both',
59
+ evidence: 'the 10-code taxonomy covered the governor without extension; native cause retained internally',
60
+ },
61
+ {
62
+ dimension: 'snapshot fidelity', field: 'partial-observable (lossy, non-restorable)', governor: 'complete-restorable',
63
+ classification: 'supported-by-both', evidence: 'the closed fidelity union covered both extremes',
64
+ },
65
+ {
66
+ dimension: 'replay', field: String(f.capabilities.replay), governor: String(g.capabilities.replay),
67
+ classification: 'supported-by-both', evidence: 'capability flag + deterministicReplay consistency rule',
68
+ },
69
+ {
70
+ dimension: 'restore', field: `${f.capabilities.restore} (method absent)`, governor: `${g.capabilities.restore} (method present)`,
71
+ classification: 'supported-by-both', evidence: 'optional method + capability flag; restore reconstructed governor state exactly',
72
+ },
73
+ {
74
+ dimension: 'lifecycle', field: 'initialize → advance* → snapshot', governor: 'initialize → advance* → snapshot → restore',
75
+ classification: 'supported-by-both', evidence: 'the optional-method design absorbed the longer lifecycle',
76
+ },
77
+ {
78
+ dimension: 'ordering', field: 'frame ordering; measurement cadence every 6th frame',
79
+ governor: 'strict input-sequence ordering (streak state is order-dependent)',
80
+ classification: 'supported-by-both', evidence: 'order-change negative fixture diverges in both harnesses',
81
+ },
82
+ {
83
+ dimension: 'environment dependence', field: 'host geometry, viewport, scroll', governor: 'none',
84
+ classification: 'substrate-specific-value',
85
+ evidence: 'governor conditions record clock/environment/host-geometry as NOT-APPLICABLE rather than claimed',
86
+ },
87
+ {
88
+ dimension: 'opaque vs declarative region', field: 'wholly opaque (force code)', governor: 'wholly declared (threshold table)',
89
+ classification: 'supported-by-both', evidence: 'executionKind captured the distinction; F1.5 established the field boundary',
90
+ },
91
+ {
92
+ dimension: 'host dependence', field: 'requires a FieldHost', governor: 'none',
93
+ classification: 'substrate-specific-value', evidence: 'the contract never mentions a host; both adapters own their own',
94
+ },
95
+ {
96
+ dimension: 'execution context (`now`)', field: 'unused — the field injects its own clock', governor: 'unused — no clock exists',
97
+ classification: 'unnecessary-generalization',
98
+ evidence: 'neither substrate read `DynamicsExecutionContext.now` in any fixture; only `step` was used',
99
+ },
100
+ {
101
+ dimension: 'transition-law access', field: 'declareTransitionLaw=false (opaque)', governor: 'declareTransitionLaw=true, but the contract offered NO accessor',
102
+ classification: 'missing-general-concept',
103
+ evidence: 'the governor can truthfully declare its law (a data table) yet no contract method could return it — a gap invisible while only the field existed',
104
+ },
105
+ ];
106
+ }
107
+ export function crossSubstrateResult() {
108
+ const rows = crossSubstrateMatrix();
109
+ const missing = rows.filter((r) => r.classification === 'missing-general-concept');
110
+ const fieldBiased = rows.filter((r) => r.classification === 'field-biased');
111
+ const outcome = fieldBiased.length > 0 ? 'field-fitted' : missing.length > 0 ? 'generalized-with-refinement' : 'generalized';
112
+ return {
113
+ rows,
114
+ outcome,
115
+ refinements: missing.map((r) => `${r.dimension}: ${r.evidence}`),
116
+ rationale: 'No dimension was classified field-biased: the second substrate adopted the contract unchanged in ' +
117
+ 'executionKind, determinism, capabilities, evidence, failures, fidelity, replay, restore, lifecycle and ' +
118
+ 'ordering. One genuine gap surfaced (transition-law access) and one over-generalization (`context.now`, ' +
119
+ 'unused by both). The gap is a missing general concept, not a substrate convenience: the contract already ' +
120
+ 'carries a `declareTransitionLaw` capability with no way to exercise it.',
121
+ };
122
+ }
123
+ //# sourceMappingURL=cross-substrate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cross-substrate.js","sourceRoot":"","sources":["../../src/world/cross-substrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAiCpD,SAAS,UAAU,CAAC,EAAU;IAC5B,OAAO,EAAE,QAAQ,EAAE,mBAAmB,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;AAC7G,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,oBAAoB;IAClC,MAAM,CAAC,GAAG,oBAAoB,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC;IAC1D,MAAM,CAAC,GAAG,gBAAgB,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAEzD,MAAM,IAAI,GAAG,CAAC,CAAsB,EAAU,EAAE,CAC9C,YAAY,CAAC,CAAC,YAAY,CAAC,QAAQ,YAAY,CAAC,CAAC,YAAY,CAAC,OAAO,WAAW,CAAC,CAAC,YAAY,CAAC,MAAM,YAAY,CAAC,CAAC,YAAY,CAAC,oBAAoB,QAAQ,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QAAQ,EAAE,CAAC;QAChE,SAAS,EACP,mGAAmG;YACnG,yGAAyG;YACzG,yGAAyG;YACzG,2GAA2G;YAC3G,yEAAyE;KAC5E,CAAC;AACJ,CAAC"}
@@ -0,0 +1,166 @@
1
+ /**
2
+ * DynamicsContract (F1.3) — the abstraction for lawful evolution: the plane-neutral execution boundary
3
+ * between a declared world and an execution substrate. The kernel executes a contract; it never
4
+ * understands the dynamics behind it, and asserts nothing about unobserved internal laws.
5
+ *
6
+ * World → DynamicsContract → ExecutionSubstrate (FieldRuntime is one, executionKind 'opaque-native')
7
+ *
8
+ * There is deliberately NO `declarative: boolean` — that would collapse independent properties into one
9
+ * flag. `executionKind`, `capabilities`, and `determinism` carry those claims separately. EXPERIMENTAL,
10
+ * field-free (enforced by `world/architecture.test.ts`).
11
+ */
12
+ import type { WorldStateSnapshot } from './world.ts';
13
+ export interface DynamicsIdentity {
14
+ readonly id: string;
15
+ readonly version: string;
16
+ }
17
+ /** Closed for the current stage. `FieldRuntime` declares `opaque-native`. */
18
+ export type DynamicsExecutionKind = 'declarative' | 'interpreted' | 'compiled' | 'opaque-native' | 'external' | 'nondeterministic' | 'hybrid';
19
+ /** Explicit, conservative. A lossy snapshot must NOT imply restore or replay. */
20
+ export interface DynamicsCapabilities {
21
+ readonly initialize: boolean;
22
+ readonly advance: true;
23
+ readonly snapshot: boolean;
24
+ readonly restore: boolean;
25
+ readonly replay: boolean;
26
+ readonly inspectInternalState: boolean;
27
+ readonly declareTransitionLaw: boolean;
28
+ readonly deterministicReplay: boolean;
29
+ }
30
+ export type DeterminismClassification = 'deterministic' | 'conditionally-deterministic' | 'nondeterministic' | 'unknown';
31
+ export interface DeterminismDeclaration {
32
+ readonly classification: DeterminismClassification;
33
+ readonly controlledInputs: readonly string[];
34
+ readonly uncontrolledInputs: readonly string[];
35
+ readonly requirements: readonly string[];
36
+ }
37
+ export interface EvidenceSource {
38
+ readonly kind: string;
39
+ readonly id: string;
40
+ }
41
+ /** No evidence entry may exist without source identity. */
42
+ export interface EvidenceRecord {
43
+ readonly id: string;
44
+ readonly kind: string;
45
+ readonly source: EvidenceSource;
46
+ readonly observedAt: string | number;
47
+ readonly payload: unknown;
48
+ }
49
+ export interface InvariantEvidence {
50
+ readonly id: string;
51
+ readonly held: boolean;
52
+ readonly detail: string;
53
+ readonly source: EvidenceSource;
54
+ }
55
+ export interface TransitionEvidence {
56
+ readonly id: string;
57
+ readonly step: number;
58
+ readonly source: EvidenceSource;
59
+ readonly summary: string;
60
+ }
61
+ /**
62
+ * An interpretation the runtime does NOT assert. It records that the claim is unresolved and which
63
+ * authority may discharge it — never that it is established.
64
+ */
65
+ export interface InterpretationObligation {
66
+ readonly id: string;
67
+ readonly claim: string;
68
+ readonly authority: string;
69
+ readonly status: 'unresolved';
70
+ }
71
+ export interface DynamicsEvidence {
72
+ readonly declaredInputs: readonly EvidenceRecord[];
73
+ readonly substrateResponses: readonly EvidenceRecord[];
74
+ readonly checkedInvariants: readonly InvariantEvidence[];
75
+ readonly executionTrace: readonly TransitionEvidence[];
76
+ readonly unresolvedInterpretations: readonly InterpretationObligation[];
77
+ }
78
+ export type DynamicsFailureCode = 'invalid-declaration' | 'invalid-state' | 'unsupported-operation' | 'capability-unavailable' | 'substrate-failure' | 'invariant-violation' | 'version-incompatible' | 'nondeterministic-result' | 'snapshot-unsupported' | 'restore-unsupported';
79
+ export interface DynamicsFailure {
80
+ readonly code: DynamicsFailureCode;
81
+ readonly message: string;
82
+ /** The original cause is retained internally; it is NOT a substrate-specific type on the generic surface. */
83
+ readonly cause?: unknown;
84
+ }
85
+ /** Typed results, not routine exceptions. Exceptions stay reserved for programmer errors. */
86
+ export type DynamicsResult<T, Evidence> = {
87
+ readonly ok: true;
88
+ readonly value: T;
89
+ readonly evidence: Evidence;
90
+ } | {
91
+ readonly ok: false;
92
+ readonly error: DynamicsFailure;
93
+ readonly evidence: Evidence;
94
+ };
95
+ /**
96
+ * Whether further transitions are defined from the resulting state (corpus finding C1).
97
+ *
98
+ * Added because the corpus introduced the first substrates that FINISH. The field and the governor run
99
+ * indefinitely, so no earlier substrate could reveal that a kernel driving a contract has no generic way
100
+ * to learn it should stop calling `advance`. Without this, a kernel must read substrate-specific output
101
+ * to decide whether to continue — which is exactly the abstraction leak the contract exists to prevent.
102
+ *
103
+ * Deliberately minimal: `terminal` does NOT distinguish "finished with a result" from "finished without
104
+ * one" (goal-reached vs exhausted). Both corpus substrates exhibit that distinction, but the evidence
105
+ * only forces "must the kernel keep going?", so the richer split stays in substrate-specific output
106
+ * until a third substrate needs it generically.
107
+ */
108
+ export type TransitionLifecycle = 'continuing' | 'terminal';
109
+ export interface Transition<State, Output> {
110
+ readonly state: State;
111
+ readonly output: Output;
112
+ /** Absent is read as `continuing` — the behaviour of every substrate that predates this concept. */
113
+ readonly lifecycle?: TransitionLifecycle;
114
+ }
115
+ export interface TransitionLawRule {
116
+ readonly [key: string]: number | string | boolean;
117
+ }
118
+ /**
119
+ * A substrate's declared transition law, expressed as DATA (G3.3 refinement).
120
+ *
121
+ * Added because the second substrate exposed a gap: `capabilities.declareTransitionLaw` could be set
122
+ * truthfully, yet the contract offered no way to obtain the law. An `opaque-native` substrate cannot
123
+ * provide one (and must leave the capability false); a substrate whose law IS a declared table can.
124
+ */
125
+ export interface TransitionLawDescription {
126
+ readonly kind: string;
127
+ readonly rules: readonly TransitionLawRule[];
128
+ readonly notes?: string;
129
+ }
130
+ export interface DynamicsSnapshot {
131
+ /** The generic readable projection the kernel may inspect (e.g. to check invariants). */
132
+ readonly reading: WorldStateSnapshot;
133
+ /** Whether this snapshot can reconstruct `State`. A lossy substrate sets false. */
134
+ readonly restorable: boolean;
135
+ /** Substrate-specific serialization — present ONLY when `restorable`. */
136
+ readonly payload?: unknown;
137
+ }
138
+ export interface InitializeRequest {
139
+ readonly declaration: unknown;
140
+ }
141
+ export interface DynamicsExecutionContext {
142
+ readonly step: number;
143
+ readonly now?: number;
144
+ }
145
+ export interface DynamicsContract<State, Input, Output, Evidence = DynamicsEvidence> {
146
+ readonly identity: DynamicsIdentity;
147
+ readonly executionKind: DynamicsExecutionKind;
148
+ readonly capabilities: DynamicsCapabilities;
149
+ readonly determinism: DeterminismDeclaration;
150
+ initialize(request: InitializeRequest): DynamicsResult<State, Evidence>;
151
+ advance(state: State, input: Input, context: DynamicsExecutionContext): DynamicsResult<Transition<State, Output>, Evidence>;
152
+ snapshot?(state: State, context: DynamicsExecutionContext): DynamicsResult<DynamicsSnapshot, Evidence>;
153
+ restore?(snapshot: DynamicsSnapshot, context: DynamicsExecutionContext): DynamicsResult<State, Evidence>;
154
+ /** Present iff `capabilities.declareTransitionLaw` is true. Returns the law as data. */
155
+ describeTransitionLaw?(): DynamicsResult<TransitionLawDescription, Evidence>;
156
+ }
157
+ export interface DynamicsContractProblem {
158
+ readonly rule: string;
159
+ readonly detail: string;
160
+ }
161
+ /**
162
+ * Static consistency check over a contract's declarations. Rejects contradictory capability /
163
+ * execution-kind / determinism combinations (F1.3 negative tests).
164
+ */
165
+ export declare function validateDynamicsContract(c: Pick<DynamicsContract<unknown, unknown, unknown, unknown>, 'executionKind' | 'capabilities' | 'determinism' | 'describeTransitionLaw'>): DynamicsContractProblem[];
166
+ //# sourceMappingURL=dynamics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamics.d.ts","sourceRoot":"","sources":["../../src/world/dynamics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,6EAA6E;AAC7E,MAAM,MAAM,qBAAqB,GAC7B,aAAa,GACb,aAAa,GACb,UAAU,GACV,eAAe,GACf,UAAU,GACV,kBAAkB,GAClB,QAAQ,CAAC;AAEb,iFAAiF;AACjF,MAAM,WAAW,oBAAoB;I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aAAa,GAAG,uBAAuB,CAAC,GACxI,uBAAuB,EAAE,CAwB3B"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Static consistency check over a contract's declarations. Rejects contradictory capability /
3
+ * execution-kind / determinism combinations (F1.3 negative tests).
4
+ */
5
+ export function validateDynamicsContract(c) {
6
+ const problems = [];
7
+ const caps = c.capabilities;
8
+ if (caps.deterministicReplay && !caps.replay) {
9
+ problems.push({ rule: 'deterministicReplay⇒replay', detail: 'deterministicReplay:true requires replay:true' });
10
+ }
11
+ if (caps.restore && !caps.snapshot) {
12
+ problems.push({ rule: 'restore⇒snapshot', detail: 'restore:true requires snapshot:true' });
13
+ }
14
+ if (caps.declareTransitionLaw && c.executionKind === 'opaque-native') {
15
+ problems.push({ rule: 'law∦opaque-native', detail: 'declareTransitionLaw:true is incompatible with executionKind opaque-native' });
16
+ }
17
+ if (c.determinism.classification === 'deterministic' && c.determinism.uncontrolledInputs.length > 0) {
18
+ problems.push({ rule: 'deterministic∦uncontrolled', detail: 'classification deterministic must not list uncontrolled inputs' });
19
+ }
20
+ // G3.3 refinement: the capability must be exercisable, and must not be claimed silently.
21
+ const hasLaw = typeof c.describeTransitionLaw === 'function';
22
+ if (caps.declareTransitionLaw && !hasLaw) {
23
+ problems.push({ rule: 'declareTransitionLaw⇒describeTransitionLaw', detail: 'declareTransitionLaw:true requires a describeTransitionLaw() method' });
24
+ }
25
+ if (!caps.declareTransitionLaw && hasLaw) {
26
+ problems.push({ rule: 'describeTransitionLaw⇒declareTransitionLaw', detail: 'describeTransitionLaw() present but declareTransitionLaw is false' });
27
+ }
28
+ return problems;
29
+ }
30
+ //# sourceMappingURL=dynamics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamics.js","sourceRoot":"","sources":["../../src/world/dynamics.ts"],"names":[],"mappings":"AAwMA;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CACtC,CAAyI;IAEzI,MAAM,QAAQ,GAA8B,EAAE,CAAC;IAC/C,MAAM,IA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E,MAAM,EAAE,mEAAmE,EAAE,CAAC,CAAC;IACrJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,44 @@
1
+ export interface WorldVersionEnvelope {
2
+ /** Which running world this is. */
3
+ readonly worldInstance: string;
4
+ /** Shape of this world's declared state / ontology. */
5
+ readonly worldSchema: string;
6
+ /** The K semantics that evolve it. */
7
+ readonly kernelSemantics: string;
8
+ /** Shape of the contracts in force. */
9
+ readonly contractSchema: string;
10
+ /** The projection(s) that produced any accompanying representation. */
11
+ readonly projectionContract: string;
12
+ /** Engine build + plane, e.g. `js@0.9.4`. */
13
+ readonly implementation: string;
14
+ /** Version of the golden vectors this was checked against. */
15
+ readonly conformanceVector: string;
16
+ /** Ordered history of schema migrations applied (identity only in F1; tooling in F4.4). */
17
+ readonly migrationChain: readonly string[];
18
+ }
19
+ export declare const WORLD_SCHEMA_VERSION = "0.1.0";
20
+ export declare const KERNEL_SEMANTICS_VERSION = "0.1.0";
21
+ export declare const CONTRACT_SCHEMA_VERSION = "0.1.0";
22
+ export declare const PROJECTION_CONTRACT_VERSION = "0.1.0";
23
+ export declare const CONFORMANCE_VECTOR_VERSION = "0.1.0";
24
+ /** The seven single-identity fields. `migrationChain` is compared as an ordered list, not a scalar. */
25
+ export declare const WORLD_ENVELOPE_IDENTITY_FIELDS: readonly ["worldInstance", "worldSchema", "kernelSemantics", "contractSchema", "projectionContract", "implementation", "conformanceVector"];
26
+ export type WorldEnvelopeIdentityField = (typeof WORLD_ENVELOPE_IDENTITY_FIELDS)[number];
27
+ export interface EnvelopeMismatch {
28
+ readonly field: WorldEnvelopeIdentityField | 'migrationChain';
29
+ readonly expected: string;
30
+ readonly actual: string;
31
+ }
32
+ /** Thrown when a loaded world/trace envelope is not identical to the current runtime's. */
33
+ export declare class IncompatibleWorldVersion extends Error {
34
+ readonly mismatches: readonly EnvelopeMismatch[];
35
+ constructor(mismatches: readonly EnvelopeMismatch[]);
36
+ }
37
+ /** Build an envelope for `worldInstance`, defaulting each layer to its current version. */
38
+ export declare function createWorldEnvelope(worldInstance: string, overrides?: Partial<Omit<WorldVersionEnvelope, 'worldInstance'>>): WorldVersionEnvelope;
39
+ /** Every field on which `loaded` differs from `current`. Empty ⇒ compatible. */
40
+ export declare function envelopeMismatches(loaded: WorldVersionEnvelope, current: WorldVersionEnvelope): EnvelopeMismatch[];
41
+ export declare function isCompatibleEnvelope(loaded: WorldVersionEnvelope, current: WorldVersionEnvelope): boolean;
42
+ /** Throw {@link IncompatibleWorldVersion} unless `loaded` is identical to `current`. No silent migration. */
43
+ export declare function assertCompatibleEnvelope(loaded: WorldVersionEnvelope, current: WorldVersionEnvelope): void;
44
+ //# sourceMappingURL=envelope.d.ts.map