@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,85 @@
1
+ /**
2
+ * F1.6 — system-relative opportunity `Ω_sys` (RUNTIME-DERIVED only). Evaluates one (participant,
3
+ * operation, state, projection, history) context and returns per-predicate results with evidence.
4
+ *
5
+ * It NEVER includes belief, perceived availability, interpretation, expectation, confidence, experience,
6
+ * or human strategy — those are empirically inferred (M1.5-01) and out of scope. Capability and authority
7
+ * stay separate: `Capable(...)` = can execution occur; `Permitted(...)` = may it occur under governance,
8
+ * and every permission requires an `authoritySource`. Field-free; internal; not exported.
9
+ */
10
+ import type { WorldVersionEnvelope } from '../envelope.ts';
11
+ export interface OperationDecl {
12
+ readonly id: string;
13
+ readonly reversible: boolean;
14
+ /** operation ids that recover from this one (empty ⇒ no recovery path). */
15
+ readonly recoveryPaths: readonly string[];
16
+ }
17
+ export interface AuthorityGrant {
18
+ readonly operation: string;
19
+ readonly scope: string;
20
+ /** REQUIRED provenance of the permission. Empty or 'unknown' ⇒ not a valid grant. */
21
+ readonly authoritySource: string;
22
+ }
23
+ export interface OpportunityProjection {
24
+ readonly id: string;
25
+ readonly exposed: readonly string[];
26
+ readonly signaled: readonly string[];
27
+ }
28
+ export interface OpportunityState {
29
+ readonly enabled: readonly string[];
30
+ readonly reachableOutcomes: readonly string[];
31
+ }
32
+ export interface OpportunityWorld {
33
+ readonly envelope: WorldVersionEnvelope;
34
+ readonly operations: readonly OperationDecl[];
35
+ }
36
+ export interface OpportunityContext {
37
+ readonly world: OpportunityWorld;
38
+ readonly participant: string;
39
+ readonly state: OpportunityState;
40
+ readonly projection: OpportunityProjection;
41
+ readonly history: readonly string[];
42
+ /** operations this participant can effectively execute (capability, NOT permission). */
43
+ readonly capabilities: readonly string[];
44
+ readonly authority: readonly AuthorityGrant[];
45
+ }
46
+ export type PredicateName = 'domain-valid' | 'capable' | 'permitted' | 'enabled' | 'reachable' | 'exposed' | 'signaled' | 'reversible-or-recoverable';
47
+ export type PredicateFailureReason = 'unsupported-operation' | 'not-capable' | 'no-authority' | 'unknown-authority-source' | 'preconditions-unmet' | 'unreachable' | 'not-exposed' | 'not-signaled' | 'irreversible-no-recovery';
48
+ export interface PredicateFailure {
49
+ readonly predicate: PredicateName;
50
+ readonly reason: PredicateFailureReason;
51
+ }
52
+ export interface PredicateEvidence {
53
+ readonly predicate: PredicateName;
54
+ readonly value: boolean;
55
+ readonly basis: string;
56
+ readonly authoritySource?: string;
57
+ }
58
+ export interface OpportunityEvidence {
59
+ /** Retains the world/version envelope so the result can be reconstructed. */
60
+ readonly envelope: WorldVersionEnvelope;
61
+ readonly participant: string;
62
+ readonly operation: string;
63
+ readonly projection: string;
64
+ readonly historyLength: number;
65
+ readonly predicates: readonly PredicateEvidence[];
66
+ }
67
+ export interface OpportunityResult {
68
+ readonly operation: string;
69
+ readonly participant: string;
70
+ readonly domainValid: boolean;
71
+ readonly capable: boolean;
72
+ readonly permitted: boolean;
73
+ readonly enabled: boolean;
74
+ readonly reachable: boolean;
75
+ readonly exposed: boolean;
76
+ readonly signaled: boolean;
77
+ readonly reversible: boolean;
78
+ readonly recoveryPaths: readonly string[];
79
+ /** The system-relative availability conjunction — ALWAYS accompanied by predicate-level evidence. */
80
+ readonly available: boolean;
81
+ readonly failedPredicates: readonly PredicateFailure[];
82
+ readonly evidence: OpportunityEvidence;
83
+ }
84
+ export declare function evaluateOpportunity(context: OpportunityContext, operation: string): OpportunityResult;
85
+ //# sourceMappingURL=opportunity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opportunity.d.ts","sourceRoot":"","sources":["../../../src/world/opportunity/opportunity.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,2EAA2E;IAC3E,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3C;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,qFAAqF;IACrF,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,E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BAAiB,CA8DrG"}
@@ -0,0 +1,67 @@
1
+ function validGrant(g) {
2
+ return g.authoritySource.length > 0 && g.authoritySource !== 'unknown';
3
+ }
4
+ export function evaluateOpportunity(context, operation) {
5
+ const decl = context.world.operations.find((o) => o.id === operation);
6
+ const domainValid = decl !== undefined;
7
+ const capable = context.capabilities.includes(operation);
8
+ const grants = context.authority.filter((g) => g.operation === operation);
9
+ const validGrants = grants.filter(validGrant);
10
+ const permitted = validGrants.length > 0;
11
+ const hasUnknownSourceGrant = grants.length > 0 && validGrants.length === 0;
12
+ const enabled = context.state.enabled.includes(operation);
13
+ const reachable = context.state.reachableOutcomes.includes(operation);
14
+ const exposed = context.projection.exposed.includes(operation);
15
+ const signaled = context.projection.signaled.includes(operation);
16
+ const reversible = decl?.reversible ?? false;
17
+ const recoveryPaths = decl?.recoveryPaths ?? [];
18
+ const reversibleOrRecoverable = reversible || recoveryPaths.length > 0;
19
+ const failedPredicates = [];
20
+ if (!domainValid)
21
+ failedPredicates.push({ predicate: 'domain-valid', reason: 'unsupported-operation' });
22
+ if (!capable)
23
+ failedPredicates.push({ predicate: 'capable', reason: 'not-capable' });
24
+ if (!permitted)
25
+ failedPredicates.push({ predicate: 'permitted', reason: hasUnknownSourceGrant ? 'unknown-authority-source' : 'no-authority' });
26
+ if (!enabled)
27
+ failedPredicates.push({ predicate: 'enabled', reason: 'preconditions-unmet' });
28
+ if (!reachable)
29
+ failedPredicates.push({ predicate: 'reachable', reason: 'unreachable' });
30
+ if (!exposed)
31
+ failedPredicates.push({ predicate: 'exposed', reason: 'not-exposed' });
32
+ if (!signaled)
33
+ failedPredicates.push({ predicate: 'signaled', reason: 'not-signaled' });
34
+ if (!reversibleOrRecoverable)
35
+ failedPredicates.push({ predicate: 'reversible-or-recoverable', reason: 'irreversible-no-recovery' });
36
+ const authoritySource = validGrants[0]?.authoritySource ?? (hasUnknownSourceGrant ? grants[0]?.authoritySource : undefined);
37
+ const predicates = [
38
+ { predicate: 'domain-valid', value: domainValid, basis: `operation ${domainValid ? 'in' : 'not in'} world vocabulary` },
39
+ { predicate: 'capable', value: capable, basis: `participant ${context.participant} capabilities` },
40
+ { predicate: 'permitted', value: permitted, basis: `${validGrants.length} valid grant(s) of ${grants.length}`, authoritySource },
41
+ { predicate: 'enabled', value: enabled, basis: `preconditions under state (history len ${context.history.length})` },
42
+ { predicate: 'reachable', value: reachable, basis: 'reachable outcomes' },
43
+ { predicate: 'exposed', value: exposed, basis: `projection ${context.projection.id}` },
44
+ { predicate: 'signaled', value: signaled, basis: `projection ${context.projection.id}` },
45
+ { predicate: 'reversible-or-recoverable', value: reversibleOrRecoverable, basis: `reversible=${reversible}, recovery=${recoveryPaths.length}` },
46
+ ];
47
+ // system-relative availability: can be invoked to effect NOW. (signaled = discoverability, reported
48
+ // separately; reversibility = a safety property, reported separately.)
49
+ const available = domainValid && capable && permitted && enabled && reachable && exposed;
50
+ return {
51
+ operation,
52
+ participant: context.participant,
53
+ domainValid, capable, permitted, enabled, reachable, exposed, signaled, reversible,
54
+ recoveryPaths,
55
+ available,
56
+ failedPredicates,
57
+ evidence: {
58
+ envelope: context.world.envelope,
59
+ participant: context.participant,
60
+ operation,
61
+ projection: context.projection.id,
62
+ historyLength: context.history.length,
63
+ predicates,
64
+ },
65
+ };
66
+ }
67
+ //# sourceMappingURL=opportunity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opportunity.js","sourceRoot":"","sources":["../../../src/world/opportunity/opportunity.ts"],"names":[],"mappings":"AAiHA,SAAS,UAAU,CAAC,CAAiB;IACnC,OAAO,CAAC,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,eAAe,KAAK,SAAS,CAAC;AACzE,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,OAA2B,EAAE,SAAiB;IAChF,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,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QAAQ,EAAE;YACR,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ;YAChC,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,SAAS;YACT,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE;YACjC,aAAa,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM;YACrC,UAAU;SACX;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Projection evidence profile (EXPERIMENTAL, internal).
3
+ *
4
+ * `ProjectionContract` currently carries more explanatory weight than any other Stage-2 concept, and
5
+ * its claims are NOT equally supported. This file grades each one, because a clean API plus a passing
6
+ * fixture reads exactly like evidence while often being neither.
7
+ *
8
+ * The grade that matters is the middle one:
9
+ *
10
+ * experimentally-grounded — supported by a result produced by an INDEPENDENTLY built component,
11
+ * or by an ablation that changed an outcome
12
+ * fixture-supported — a test I wrote passes against an API I designed. This is a consistency
13
+ * check, not evidence. It cannot falsify the design it was written from
14
+ * architectural-hypothesis — asserted by the design, untested. Currently indistinguishable from
15
+ * a good guess
16
+ *
17
+ * Most projection fixtures are `fixture-supported`. Saying so is the point: Stage 1 treated Opportunity
18
+ * this way and it is why `Ω_sys` is trustworthy now.
19
+ */
20
+ import type { PredictionId } from '../conformance/predictions.ts';
21
+ import type { EvidenceGrade, EvidenceProvenance, Independence } from '../conformance/evidence.ts';
22
+ export type { EvidenceGrade } from '../conformance/evidence.ts';
23
+ export interface ProjectionClaim {
24
+ readonly id: string;
25
+ readonly claim: string;
26
+ readonly grade: EvidenceGrade;
27
+ /** WHERE the support comes from - a separate dimension from how settled the claim is. */
28
+ readonly provenance: EvidenceProvenance;
29
+ readonly basis: string;
30
+ /** The experiment that would move this claim up a grade. Every ungrounded claim must name one. */
31
+ readonly wouldBeGroundedBy: string;
32
+ /** The registered prediction that will test it, once one exists. */
33
+ readonly prediction?: PredictionId;
34
+ }
35
+ export declare function projectionClaims(): ProjectionClaim[];
36
+ export interface EvidenceProfile {
37
+ readonly grounded: number;
38
+ readonly fixtureSupported: number;
39
+ readonly hypotheses: number;
40
+ /** Ratio of claims backed by something that could have come out otherwise. */
41
+ readonly groundedFraction: number;
42
+ /** Every ungrounded claim names the experiment that would ground it. */
43
+ readonly allUngroundedHaveAPath: boolean;
44
+ /** Claims whose support has high or medium independence - could have come out otherwise. */
45
+ readonly independentlySupported: number;
46
+ readonly byIndependence: Readonly<Record<Independence, number>>;
47
+ /** Maturity never outruns provenance. */
48
+ readonly consistent: boolean;
49
+ }
50
+ export declare function projectionEvidenceProfile(): EvidenceProfile;
51
+ //# sourceMappingURL=evidence-profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evidence-profile.d.ts","sourceRoot":"","sources":["../../../src/world/projection/evidence-profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAElG,YAAY,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,yFAAyF;IACzF,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,kGAAkG;IAClG,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,oEAAoE;IACpE,QAAQ,CAAC,UAAU,CAAC,EAAE,YAAY,CAAC;CACpC;AAED,wBAAgB,gBAAgB,IAAI,eAAe,EAAE,CA4EpD;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,8EAA8E;IAC9E,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,wEAAwE;IACxE,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;IACzC,4FAA4F;IAC5F,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;IACxC,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;IAChE,yCAAyC;IACzC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B;AAED,wBAAgB,yBAAyB,IAAI,eAAe,CAgB3D"}
@@ -0,0 +1,93 @@
1
+ import { independenceOf, gradeProvenanceProblems } from "../conformance/evidence.js";
2
+ export function projectionClaims() {
3
+ return [
4
+ {
5
+ id: 'existence',
6
+ claim: 'projection is not observation — it is a distinct concept',
7
+ grade: 'experimentally-grounded',
8
+ provenance: 'emerged-from-prior-mechanism',
9
+ basis: 'F1.8 ablation: substituting observation for projection materially changed Ω_sys over identical state. The Ω_sys evaluator was built independently, in F1.6, before ProjectionContract existed — so it could have failed to show a difference',
10
+ wouldBeGroundedBy: 'already grounded; replication with a second opportunity model would strengthen it',
11
+ },
12
+ {
13
+ id: 'omega-coupling',
14
+ claim: 'a projection changes Ω_sys without changing world state',
15
+ grade: 'experimentally-grounded',
16
+ provenance: 'emerged-from-prior-mechanism',
17
+ basis: 'two surfaces over one identical snapshot produced different `signaled` and identical `available`, measured through the F1.6 evaluator rather than through projection code',
18
+ wouldBeGroundedBy: 'already grounded',
19
+ },
20
+ {
21
+ id: 'boundary',
22
+ claim: 'hidden state remains in the world but is absent from the surface, and cannot be reached through it',
23
+ grade: 'fixture-supported',
24
+ provenance: 'fixture-against-same-implementation',
25
+ basis: 'projection-relative invariants reading hidden state return unevaluable-outside-surface — but the check and the surface were designed together',
26
+ wouldBeGroundedBy: 'an adversarial probe written against the surface WITHOUT knowledge of its implementation, attempting to recover a hidden value through any exposed path (evidence, invariants, anomalies, operation records)',
27
+ },
28
+ {
29
+ id: 'power-restriction',
30
+ claim: 'a projection cannot manufacture capability or silently grant permission',
31
+ grade: 'fixture-supported',
32
+ provenance: 'fixture-against-same-implementation',
33
+ basis: 'exposure never adds to effectiveCapabilities and presentation never adds to effectiveAuthority — proven only for the definitions I wrote, over a single projection layer',
34
+ wouldBeGroundedBy: 'projection composition: whether the guarantee survives projecting a projection, where a second layer might launder what the first withheld',
35
+ prediction: 'P-006',
36
+ },
37
+ {
38
+ id: 'authority-presentation',
39
+ claim: 'presented authority is fully separable from effective authority, including delegation',
40
+ grade: 'architectural-hypothesis',
41
+ provenance: 'architectural-argument',
42
+ basis: 'only understatement and overstatement over direct grants have been exercised; delegated and derived authority are untested',
43
+ wouldBeGroundedBy: 'a substrate or scenario with real delegated authority, where the grant chain has more than one link',
44
+ prediction: 'P-005',
45
+ },
46
+ {
47
+ id: 'evidence-visibility',
48
+ claim: 'evidence access is a projection-relative property that composes correctly',
49
+ grade: 'architectural-hypothesis',
50
+ provenance: 'architectural-argument',
51
+ basis: 'accessible/withheld is honoured for one projection over one source; nothing tests chained access or provenance survival',
52
+ wouldBeGroundedBy: 'chained projections where the second layer requests evidence the first withheld',
53
+ prediction: 'P-006',
54
+ },
55
+ {
56
+ id: 'participant-relative-state',
57
+ claim: 'participant-relative state needs no participant model — it reduces to observation access plus scope',
58
+ grade: 'architectural-hypothesis',
59
+ provenance: 'architectural-argument',
60
+ basis: 'scope is currently a label carried through the surface; no result depends on it',
61
+ wouldBeGroundedBy: 'a scenario where two participants share a projection definition but must see different state, forcing scope to do real work',
62
+ prediction: 'P-007',
63
+ },
64
+ {
65
+ id: 'invariant-scope',
66
+ claim: 'projection-relative invariants are correctly scoped to the surface',
67
+ grade: 'architectural-hypothesis',
68
+ provenance: 'architectural-argument',
69
+ basis: 'unevaluable-outside-surface is enforced, but the foundation does not distinguish unevaluable from vacuously satisfied — a claim over an empty surface is currently indistinguishable from one that genuinely holds',
70
+ wouldBeGroundedBy: 'invariants over surfaces that expose none of the keys they read, checked against a model that knows the true answer',
71
+ prediction: 'P-008',
72
+ },
73
+ ];
74
+ }
75
+ export function projectionEvidenceProfile() {
76
+ const claims = projectionClaims();
77
+ const by = (g) => claims.filter((c) => c.grade === g).length;
78
+ const ungrounded = claims.filter((c) => c.grade !== 'experimentally-grounded');
79
+ const byIndependence = { high: 0, medium: 0, low: 0, none: 0 };
80
+ for (const c of claims)
81
+ byIndependence[independenceOf(c.provenance)] += 1;
82
+ return {
83
+ grounded: by('experimentally-grounded'),
84
+ fixtureSupported: by('fixture-supported'),
85
+ hypotheses: by('architectural-hypothesis'),
86
+ groundedFraction: by('experimentally-grounded') / claims.length,
87
+ allUngroundedHaveAPath: ungrounded.every((c) => c.wouldBeGroundedBy.length > 0),
88
+ independentlySupported: byIndependence.high + byIndependence.medium,
89
+ byIndependence,
90
+ consistent: claims.every((c) => gradeProvenanceProblems(c.grade, c.provenance).length === 0),
91
+ };
92
+ }
93
+ //# sourceMappingURL=evidence-profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evidence-profile.js","sourceRoot":"","sources":["../../../src/world/projection/evidence-profile.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAkBrF,MAAM,UAAU,gBAAgB;IAC9B,OAAO;QACL;YACE,EAAE,EAAE,WAAW;YACf,KAAK,EAAE,0DAA0D;YACjE,KAAK,EAAE,yBAAyB;YAChC,UAAU,EAAE,8BAA8B;YAC1C,KAAK,EACH,8OAA8O;YAChP,iBAAiB,EAAE,mFAAmF;SACvG;QACD;YACE,EAAE,EAAE,gBAAgB;YACpB,KAAK,EAAE,yDAAyD;YAChE,KAAK,EAAE,yBAAyB;YAChC,UAAU,EAAE,8BAA8B;YAC1C,KAAK,EAAE,2KAA2K;YAClL,iBA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ation — `ProjectionContract` (EXPERIMENTAL, internal, not exported from the package entry).
3
+ *
4
+ * A projection is how a world is PRESENTED to a participant or consumer. It is deliberately kept
5
+ * distinct from six neighbouring concepts that are easy to collapse:
6
+ *
7
+ * observation — what state can be read (≠ what operations are offered)
8
+ * snapshot — a serialized reading of state (≠ a presentation of a world)
9
+ * evidence — the record of what was observed (≠ access to that record)
10
+ * capability — what execution CAN occur (a projection can never create it)
11
+ * authority — what MAY occur, and by whose say (a projection can never grant it)
12
+ * operation availability — whether an operation can be invoked to effect NOW
13
+ *
14
+ * The load-bearing rule: **a projection is subtractive with respect to power**. It may hide, withhold,
15
+ * relabel and understate; it may never manufacture a capability or silently grant permission. Where a
16
+ * definition claims more than the source holds, the surface still reflects the SOURCE and the excess is
17
+ * reported as an anomaly — never resolved in the projection's favour.
18
+ *
19
+ * A projection CAN change Ω_sys (system-relative opportunity) without changing world state, because
20
+ * `exposed` and `signaled` are projection-relative predicates. That is the point, not a defect.
21
+ *
22
+ * Participant belief, perception, interpretation and understanding are NOT modelled here — they are
23
+ * empirically inferred (M1.5-01). Where a claim would require them, an unresolved obligation is emitted.
24
+ */
25
+ import type { WorldVersionEnvelope } from '../envelope.ts';
26
+ import type { WorldStateSnapshot } from '../world.ts';
27
+ import type { AuthorityGrant, OperationDecl, OpportunityProjection } from '../opportunity/opportunity.ts';
28
+ export interface ProjectionIdentity {
29
+ readonly id: string;
30
+ readonly version: string;
31
+ }
32
+ /** Who the projection is FOR. A consumer need not be a person. */
33
+ export interface ProjectionScope {
34
+ readonly consumer: string;
35
+ readonly kind: 'participant' | 'agent' | 'diagnostic' | 'external-system';
36
+ }
37
+ /** What state may be READ. Distinct from {@link OperationExposure} — reading is not acting. */
38
+ export interface ObservationAccess {
39
+ readonly observable: readonly string[];
40
+ /** Present in the world, deliberately withheld from this surface. NOT the same as absent. */
41
+ readonly hidden: readonly string[];
42
+ }
43
+ /**
44
+ * Three genuinely different states:
45
+ * exposed — offered on this surface
46
+ * hidden — exists in the world, deliberately not offered here
47
+ * unavailable — does not exist in the world at all
48
+ * Collapsing `hidden` into `unavailable` would let a projection misrepresent the world's vocabulary.
49
+ */
50
+ export type OperationExposureState = 'exposed' | 'hidden' | 'unavailable';
51
+ export interface OperationExposure {
52
+ readonly exposed: readonly string[];
53
+ readonly hidden: readonly string[];
54
+ /** Discoverability. A subset of `exposed`: nothing can be signaled that is not offered. */
55
+ readonly signaled: readonly string[];
56
+ }
57
+ /** Access to the evidence record — distinct from the evidence itself. */
58
+ export interface EvidenceAccess {
59
+ readonly accessible: readonly string[];
60
+ readonly withheld: readonly string[];
61
+ }
62
+ /**
63
+ * What the surface PRESENTS about permission. Presenting less than the source holds is a legitimate
64
+ * projection choice (understatement). Presenting more is an anomaly and never takes effect.
65
+ */
66
+ export interface AuthorityPresentation {
67
+ readonly presented: readonly string[];
68
+ }
69
+ export interface ProjectionTransform {
70
+ readonly id: string;
71
+ readonly kind: 'filter' | 'rename' | 'aggregate' | 'derive' | 'redact';
72
+ readonly detail: string;
73
+ }
74
+ /** An invariant evaluated against the SURFACE, never against hidden world state. */
75
+ export interface ProjectionInvariant {
76
+ readonly id: string;
77
+ readonly statement: string;
78
+ /** Surface keys the claim reads. Anything outside the surface makes it unevaluable here. */
79
+ readonly reads: readonly string[];
80
+ }
81
+ export interface ProjectionDefinition {
82
+ readonly identity: ProjectionIdentity;
83
+ readonly sourceEnvelope: WorldVersionEnvelope;
84
+ readonly scope: ProjectionScope;
85
+ readonly observation: ObservationAccess;
86
+ readonly operations: OperationExposure;
87
+ readonly evidence: EvidenceAccess;
88
+ readonly authority: AuthorityPresentation;
89
+ readonly invariants: readonly ProjectionInvariant[];
90
+ readonly provenance: readonly ProjectionTransform[];
91
+ }
92
+ /** The ground truth a projection is taken OF. The projection never writes back to it. */
93
+ export interface ProjectionSource {
94
+ readonly envelope: WorldVersionEnvelope;
95
+ readonly operations: readonly OperationDecl[];
96
+ readonly snapshot: WorldStateSnapshot;
97
+ /** What execution can actually occur (capability, NOT permission). */
98
+ readonly capabilities: readonly string[];
99
+ readonly authority: readonly AuthorityGrant[];
100
+ readonly evidenceIds: readonly string[];
101
+ }
102
+ export type ProjectionAnomalyCode = 'capability-not-manufacturable' | 'authority-overstated' | 'exposed-operation-absent-from-world' | 'exposed-and-hidden-conflict' | 'signaled-without-exposure' | 'observation-key-absent-from-world' | 'envelope-mismatch';
103
+ export interface ProjectionAnomaly {
104
+ readonly code: ProjectionAnomalyCode;
105
+ readonly subject: string;
106
+ readonly detail: string;
107
+ }
108
+ /** Something the runtime cannot decide. Never silently discharged. */
109
+ export interface ProjectionObligation {
110
+ readonly id: string;
111
+ readonly claim: string;
112
+ readonly authority: string;
113
+ readonly status: 'unresolved';
114
+ }
115
+ export interface OperationExposureRecord {
116
+ readonly operation: string;
117
+ readonly exposure: OperationExposureState;
118
+ readonly signaled: boolean;
119
+ }
120
+ export interface ProjectionSurface {
121
+ readonly identity: ProjectionIdentity;
122
+ readonly sourceEnvelope: WorldVersionEnvelope;
123
+ readonly scope: ProjectionScope;
124
+ /** Filtered state. Hidden keys are ABSENT here while remaining present in the world. */
125
+ readonly observedState: Readonly<Record<string, number>>;
126
+ readonly hiddenStateKeys: readonly string[];
127
+ readonly operations: readonly OperationExposureRecord[];
128
+ /** Always a subset of the source's capabilities — the subtractive rule, enforced. */
129
+ readonly effectiveCapabilities: readonly string[];
130
+ /** Always a subset of the source's valid grants — a projection cannot grant. */
131
+ readonly effectiveAuthority: readonly AuthorityGrant[];
132
+ /** What the surface CLAIMS about permission; may differ from `effectiveAuthority`. */
133
+ readonly presentedAuthority: readonly string[];
134
+ readonly accessibleEvidence: readonly string[];
135
+ readonly invariants: readonly ProjectionInvariant[];
136
+ readonly provenance: readonly ProjectionTransform[];
137
+ }
138
+ export interface ProjectionResult {
139
+ readonly surface: ProjectionSurface;
140
+ readonly anomalies: readonly ProjectionAnomaly[];
141
+ readonly obligations: readonly ProjectionObligation[];
142
+ }
143
+ /**
144
+ * Apply a definition to a source. Pure: returns a surface plus every discrepancy found, and never
145
+ * mutates or "repairs" the source in the projection's favour.
146
+ */
147
+ export declare function project(definition: ProjectionDefinition, source: ProjectionSource): ProjectionResult;
148
+ /** Bridge to Ω_sys (F1.6): the projection-relative half of opportunity, derived from the surface. */
149
+ export declare function toOpportunityProjection(surface: ProjectionSurface): OpportunityProjection;
150
+ export type ProjectionInvariantStatus = 'satisfied' | 'violated' | 'unevaluable-outside-surface';
151
+ export interface ProjectionInvariantResult {
152
+ readonly id: string;
153
+ readonly status: ProjectionInvariantStatus;
154
+ readonly reason: string;
155
+ }
156
+ /**
157
+ * Evaluate projection-relative invariants against the SURFACE only. A claim that reads a key which is
158
+ * not on the surface is `unevaluable-outside-surface` — it is never silently satisfied by reaching into
159
+ * hidden world state.
160
+ */
161
+ export declare function checkProjectionInvariants(surface: ProjectionSurface, predicate: (id: string, observed: Readonly<Record<string, number>>) => boolean): ProjectionInvariantResult[];
162
+ //# sourceMappingURL=projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../../src/world/projection/projection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAE1G,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,kEAAkE;AAClE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,GAAG,YAAY,GAAG,iBAAiB,CAAC;CAC3E;AAID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AAC,UAAU,EAAE,oBAAoB,EAAE,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAsHpG;AAED,qGAAqG;AACrG,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,iBAAiB,GAAG,qBAAqB,CAMzF;AAED,MAAM,MAAM,yBAAyB,GAAG,WAAW,GAAG,UAAU,GAAG,6BAA6B,CAAC;AAEjG,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC;IAC3C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,iBAAiB,EAC1B,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK,OAAO,GAC7E,yBAAyB,EAAE,CAc7B"}
@@ -0,0 +1,145 @@
1
+ function validGrant(g) {
2
+ return g.authoritySource.length > 0 && g.authoritySource !== 'unknown';
3
+ }
4
+ /**
5
+ * Apply a definition to a source. Pure: returns a surface plus every discrepancy found, and never
6
+ * mutates or "repairs" the source in the projection's favour.
7
+ */
8
+ export function project(definition, source) {
9
+ const anomalies = [];
10
+ const obligations = [];
11
+ if (definition.sourceEnvelope.worldInstance !== source.envelope.worldInstance) {
12
+ anomalies.push({
13
+ code: 'envelope-mismatch',
14
+ subject: definition.identity.id,
15
+ detail: `definition targets ${definition.sourceEnvelope.worldInstance}, source is ${source.envelope.worldInstance}`,
16
+ });
17
+ }
18
+ // --- observation: hidden keys are removed from the surface but remain in the world snapshot
19
+ const worldMetrics = source.snapshot.metrics;
20
+ const hiddenSet = new Set(definition.observation.hidden);
21
+ const observedState = {};
22
+ for (const key of definition.observation.observable) {
23
+ if (!(key in worldMetrics)) {
24
+ anomalies.push({ code: 'observation-key-absent-from-world', subject: key, detail: 'observable key is not present in the source snapshot' });
25
+ continue;
26
+ }
27
+ if (hiddenSet.has(key)) {
28
+ anomalies.push({ code: 'exposed-and-hidden-conflict', subject: key, detail: 'key declared both observable and hidden' });
29
+ continue;
30
+ }
31
+ observedState[key] = worldMetrics[key];
32
+ }
33
+ // --- operations: exposed / hidden / unavailable are kept genuinely distinct
34
+ const worldOps = new Set(source.operations.map((o) => o.id));
35
+ const exposedSet = new Set(definition.operations.exposed);
36
+ const hiddenOps = new Set(definition.operations.hidden);
37
+ const signaledSet = new Set(definition.operations.signaled);
38
+ for (const op of exposedSet) {
39
+ if (!worldOps.has(op)) {
40
+ anomalies.push({ code: 'exposed-operation-absent-from-world', subject: op, detail: 'projection exposes an operation the world does not declare' });
41
+ }
42
+ if (hiddenOps.has(op)) {
43
+ anomalies.push({ code: 'exposed-and-hidden-conflict', subject: op, detail: 'operation declared both exposed and hidden' });
44
+ }
45
+ }
46
+ for (const op of signaledSet) {
47
+ if (!exposedSet.has(op)) {
48
+ anomalies.push({ code: 'signaled-without-exposure', subject: op, detail: 'an operation cannot be signaled without being exposed' });
49
+ }
50
+ }
51
+ const allOps = new Set([...worldOps, ...exposedSet, ...hiddenOps]);
52
+ const operations = [...allOps].sort().map((op) => {
53
+ const exposure = !worldOps.has(op)
54
+ ? 'unavailable' // not in the world at all — distinct from being hidden
55
+ : hiddenOps.has(op)
56
+ ? 'hidden' // exists, deliberately not offered here
57
+ : exposedSet.has(op)
58
+ ? 'exposed'
59
+ : 'hidden'; // not offered on this surface ⇒ hidden, never "unavailable"
60
+ return { operation: op, exposure, signaled: exposure === 'exposed' && signaledSet.has(op) };
61
+ });
62
+ // --- capability: strictly subtractive. Exposure never creates the ability to execute.
63
+ const effectiveCapabilities = source.capabilities.filter((c) => exposedSet.has(c));
64
+ for (const op of exposedSet) {
65
+ if (!source.capabilities.includes(op)) {
66
+ anomalies.push({
67
+ code: 'capability-not-manufacturable',
68
+ subject: op,
69
+ detail: 'operation is exposed but the source holds no capability for it; exposure does not create one',
70
+ });
71
+ }
72
+ }
73
+ // --- authority: presenting less is legitimate; presenting more is reported and never takes effect
74
+ const validGrants = source.authority.filter(validGrant);
75
+ const grantedOps = new Set(validGrants.map((g) => g.operation));
76
+ const effectiveAuthority = validGrants.filter((g) => exposedSet.has(g.operation));
77
+ for (const op of definition.authority.presented) {
78
+ if (!grantedOps.has(op)) {
79
+ anomalies.push({
80
+ code: 'authority-overstated',
81
+ subject: op,
82
+ detail: 'projection presents permission the source does not grant; presentation does not confer permission',
83
+ });
84
+ }
85
+ }
86
+ // --- evidence access
87
+ const withheld = new Set(definition.evidence.withheld);
88
+ const accessibleEvidence = definition.evidence.accessible.filter((e) => source.evidenceIds.includes(e) && !withheld.has(e));
89
+ // The runtime reports what is signaled; it must NOT claim the consumer perceived or understood it.
90
+ if (signaledSet.size > 0) {
91
+ obligations.push({
92
+ id: `perception:${definition.identity.id}`,
93
+ claim: 'signaled operations are perceived, understood, or expected by the consumer',
94
+ authority: 'empirical',
95
+ status: 'unresolved',
96
+ });
97
+ }
98
+ return {
99
+ surface: {
100
+ identity: definition.identity,
101
+ sourceEnvelope: source.envelope,
102
+ scope: definition.scope,
103
+ observedState,
104
+ hiddenStateKeys: [...hiddenSet].filter((k) => k in worldMetrics),
105
+ operations,
106
+ effectiveCapabilities,
107
+ effectiveAuthority,
108
+ presentedAuthority: definition.authority.presented,
109
+ accessibleEvidence,
110
+ invariants: definition.invariants,
111
+ provenance: definition.provenance,
112
+ },
113
+ anomalies,
114
+ obligations,
115
+ };
116
+ }
117
+ /** Bridge to Ω_sys (F1.6): the projection-relative half of opportunity, derived from the surface. */
118
+ export function toOpportunityProjection(surface) {
119
+ return {
120
+ id: surface.identity.id,
121
+ exposed: surface.operations.filter((o) => o.exposure === 'exposed').map((o) => o.operation),
122
+ signaled: surface.operations.filter((o) => o.signaled).map((o) => o.operation),
123
+ };
124
+ }
125
+ /**
126
+ * Evaluate projection-relative invariants against the SURFACE only. A claim that reads a key which is
127
+ * not on the surface is `unevaluable-outside-surface` — it is never silently satisfied by reaching into
128
+ * hidden world state.
129
+ */
130
+ export function checkProjectionInvariants(surface, predicate) {
131
+ return surface.invariants.map((inv) => {
132
+ const missing = inv.reads.filter((k) => !(k in surface.observedState));
133
+ if (missing.length > 0) {
134
+ return {
135
+ id: inv.id,
136
+ status: 'unevaluable-outside-surface',
137
+ reason: `reads ${missing.join(', ')} which are not on this surface`,
138
+ };
139
+ }
140
+ return predicate(inv.id, surface.observedState)
141
+ ? { id: inv.id, status: 'satisfied', reason: 'holds against the projection surface' }
142
+ : { id: inv.id, status: 'violated', reason: 'fails against the projection surface' };
143
+ });
144
+ }
145
+ //# sourceMappingURL=projection.js.map