loopforge 3.7.0 → 3.8.1

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 (151) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +171 -157
  3. package/dist/audit.d.ts +53 -1
  4. package/dist/audit.d.ts.map +1 -1
  5. package/dist/audit.js +106 -22
  6. package/dist/audit.js.map +1 -1
  7. package/dist/canonical-state.d.ts +75 -69
  8. package/dist/canonical-state.d.ts.map +1 -1
  9. package/dist/canonical-state.js +276 -168
  10. package/dist/canonical-state.js.map +1 -1
  11. package/dist/cli.d.ts.map +1 -1
  12. package/dist/cli.js +111 -12
  13. package/dist/cli.js.map +1 -1
  14. package/dist/cognitive-facts.d.ts +13 -0
  15. package/dist/cognitive-facts.d.ts.map +1 -1
  16. package/dist/cognitive-facts.js +30 -16
  17. package/dist/cognitive-facts.js.map +1 -1
  18. package/dist/cognitive-governance.d.ts +30 -6
  19. package/dist/cognitive-governance.d.ts.map +1 -1
  20. package/dist/cognitive-governance.js +74 -18
  21. package/dist/cognitive-governance.js.map +1 -1
  22. package/dist/committed-round.d.ts +109 -24
  23. package/dist/committed-round.d.ts.map +1 -1
  24. package/dist/committed-round.js +235 -52
  25. package/dist/committed-round.js.map +1 -1
  26. package/dist/contract-items.d.ts +55 -0
  27. package/dist/contract-items.d.ts.map +1 -0
  28. package/dist/contract-items.js +180 -0
  29. package/dist/contract-items.js.map +1 -0
  30. package/dist/enforcement-gate.d.ts +43 -20
  31. package/dist/enforcement-gate.d.ts.map +1 -1
  32. package/dist/enforcement-gate.js +269 -378
  33. package/dist/enforcement-gate.js.map +1 -1
  34. package/dist/engine.d.ts +11 -6
  35. package/dist/engine.d.ts.map +1 -1
  36. package/dist/engine.js +102 -67
  37. package/dist/engine.js.map +1 -1
  38. package/dist/evidence-claims.d.ts +4 -4
  39. package/dist/evidence-claims.d.ts.map +1 -1
  40. package/dist/evidence-claims.js +16 -14
  41. package/dist/evidence-claims.js.map +1 -1
  42. package/dist/evidence-provider.d.ts +91 -90
  43. package/dist/evidence-provider.d.ts.map +1 -1
  44. package/dist/evidence-provider.js +349 -160
  45. package/dist/evidence-provider.js.map +1 -1
  46. package/dist/explain.d.ts +76 -0
  47. package/dist/explain.d.ts.map +1 -0
  48. package/dist/explain.js +127 -0
  49. package/dist/explain.js.map +1 -0
  50. package/dist/generate-schema.js +250 -53
  51. package/dist/generate-schema.js.map +1 -1
  52. package/dist/index.d.ts +8 -7
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +7 -6
  55. package/dist/index.js.map +1 -1
  56. package/dist/loop-compiler.d.ts +41 -40
  57. package/dist/loop-compiler.d.ts.map +1 -1
  58. package/dist/loop-compiler.js +275 -515
  59. package/dist/loop-compiler.js.map +1 -1
  60. package/dist/loop-extras-parser.d.ts +0 -1
  61. package/dist/loop-extras-parser.d.ts.map +1 -1
  62. package/dist/loop-extras-parser.js +0 -4
  63. package/dist/loop-extras-parser.js.map +1 -1
  64. package/dist/loop-projection.d.ts.map +1 -1
  65. package/dist/loop-projection.js +3 -1
  66. package/dist/loop-projection.js.map +1 -1
  67. package/dist/mcp/round-lifecycle.d.ts +40 -21
  68. package/dist/mcp/round-lifecycle.d.ts.map +1 -1
  69. package/dist/mcp/round-lifecycle.js +173 -120
  70. package/dist/mcp/round-lifecycle.js.map +1 -1
  71. package/dist/mcp/server.d.ts.map +1 -1
  72. package/dist/mcp/server.js +63 -10
  73. package/dist/mcp/server.js.map +1 -1
  74. package/dist/mcp/session.d.ts +53 -7
  75. package/dist/mcp/session.d.ts.map +1 -1
  76. package/dist/mcp/session.js +240 -139
  77. package/dist/mcp/session.js.map +1 -1
  78. package/dist/mcp/submission-boundary.d.ts +89 -0
  79. package/dist/mcp/submission-boundary.d.ts.map +1 -0
  80. package/dist/mcp/submission-boundary.js +203 -0
  81. package/dist/mcp/submission-boundary.js.map +1 -0
  82. package/dist/mcp/tools.d.ts.map +1 -1
  83. package/dist/mcp/tools.js +377 -125
  84. package/dist/mcp/tools.js.map +1 -1
  85. package/dist/policy-metrics.js +2 -2
  86. package/dist/policy-metrics.js.map +1 -1
  87. package/dist/policy.d.ts +65 -95
  88. package/dist/policy.d.ts.map +1 -1
  89. package/dist/policy.js +151 -39
  90. package/dist/policy.js.map +1 -1
  91. package/dist/prompt-assembler.d.ts +7 -33
  92. package/dist/prompt-assembler.d.ts.map +1 -1
  93. package/dist/prompt-assembler.js +313 -473
  94. package/dist/prompt-assembler.js.map +1 -1
  95. package/dist/prompt-policy.d.ts +1 -4
  96. package/dist/prompt-policy.d.ts.map +1 -1
  97. package/dist/prompt-policy.js +6 -7
  98. package/dist/prompt-policy.js.map +1 -1
  99. package/dist/protocol.d.ts +411 -168
  100. package/dist/protocol.d.ts.map +1 -1
  101. package/dist/protocol.js +23 -69
  102. package/dist/protocol.js.map +1 -1
  103. package/dist/replay.js +2 -2
  104. package/dist/replay.js.map +1 -1
  105. package/dist/round-contract.d.ts +69 -57
  106. package/dist/round-contract.d.ts.map +1 -1
  107. package/dist/round-contract.js +104 -64
  108. package/dist/round-contract.js.map +1 -1
  109. package/dist/round-coordinator.d.ts +55 -16
  110. package/dist/round-coordinator.d.ts.map +1 -1
  111. package/dist/round-coordinator.js +179 -57
  112. package/dist/round-coordinator.js.map +1 -1
  113. package/dist/round-driver.d.ts +7 -5
  114. package/dist/round-driver.d.ts.map +1 -1
  115. package/dist/round-driver.js +2 -1
  116. package/dist/round-driver.js.map +1 -1
  117. package/dist/round-facts.d.ts +96 -0
  118. package/dist/round-facts.d.ts.map +1 -0
  119. package/dist/round-facts.js +216 -0
  120. package/dist/round-facts.js.map +1 -0
  121. package/dist/round-transaction.d.ts +23 -9
  122. package/dist/round-transaction.d.ts.map +1 -1
  123. package/dist/round-transaction.js +99 -22
  124. package/dist/round-transaction.js.map +1 -1
  125. package/dist/self-eval.d.ts +127 -11
  126. package/dist/self-eval.d.ts.map +1 -1
  127. package/dist/self-eval.js +517 -36
  128. package/dist/self-eval.js.map +1 -1
  129. package/dist/subgoal-state.d.ts +77 -0
  130. package/dist/subgoal-state.d.ts.map +1 -0
  131. package/dist/subgoal-state.js +198 -0
  132. package/dist/subgoal-state.js.map +1 -0
  133. package/dist/token-utils.d.ts +52 -19
  134. package/dist/token-utils.d.ts.map +1 -1
  135. package/dist/token-utils.js +83 -72
  136. package/dist/token-utils.js.map +1 -1
  137. package/dist/verification-gate.d.ts +27 -46
  138. package/dist/verification-gate.d.ts.map +1 -1
  139. package/dist/verification-gate.js +308 -557
  140. package/dist/verification-gate.js.map +1 -1
  141. package/dist/version.d.ts +5 -0
  142. package/dist/version.d.ts.map +1 -0
  143. package/dist/version.js +5 -0
  144. package/dist/version.js.map +1 -0
  145. package/dist/workspace.d.ts +9 -0
  146. package/dist/workspace.d.ts.map +1 -1
  147. package/dist/workspace.js +17 -0
  148. package/dist/workspace.js.map +1 -1
  149. package/loop_policy.json +17 -25
  150. package/package.json +7 -7
  151. package/skills/perception/SKILL.md +266 -64
@@ -1,10 +1,12 @@
1
- /** v2.12: User/Agent gate classification and governance helpers.
1
+ /** v2.12/v3.7.1: User/Agent gate classification and governance helpers.
2
2
  *
3
- * Ported from the 3.x line with the V2 flat-contract adaptation: the MCP
4
- * surface works with a flat gate text (the agent's blocker description),
5
- * while the structured GateActionDescriptor stays an internal type for
6
- * audit display. Only decisions are persisted — gate state is always
7
- * re-derivable via deriveGate, so the vault never holds a second truth.
3
+ * v3.7.1: loopforge_gate_check is a STRUCTURED preflight over
4
+ * GateActionDescriptor (preflightStructuredGate — the single classifier
5
+ * behind both the tool and the round-blocking check). The flat-text
6
+ * classifier (deriveGate / USER_RISK) survives only for blocked-round
7
+ * auto-records, which stay a record-layer convenience that never blocks.
8
+ * Only decisions are persisted; gate state is always re-derivable from
9
+ * the canonical action, so the vault never holds a second truth.
8
10
  */
9
11
  import { createHash } from "node:crypto";
10
12
  import { computeGoalTextHash } from "./loop-compiler.js";
@@ -42,28 +44,82 @@ export function gateActionHash(action) {
42
44
  }
43
45
  /** Classify a structured action descriptor (internal use; audit display). */
44
46
  export function deriveStructuredGate(action) {
47
+ const verdict = preflightStructuredGate(action);
48
+ return {
49
+ id: verdict.gateId,
50
+ actionHash: verdict.actionHash,
51
+ gate: verdict.kind === "user"
52
+ ? {
53
+ kind: "user",
54
+ question: verdict.approvalQuestion,
55
+ blockedScope: verdict.blockedScope,
56
+ allowedWork: verdict.allowedBeforeApproval,
57
+ }
58
+ : {
59
+ kind: "agent",
60
+ problem: action.description,
61
+ requiredEvidence: verdict.requiredEvidence,
62
+ suggestedResolution: verdict.suggestedResolution,
63
+ },
64
+ };
65
+ }
66
+ /** v3.7.1: the structured gate preflight — the SINGLE classifier behind
67
+ * loopforge_gate_check and the round-blocking check. Conservative by
68
+ * default: anything that cannot be proven safe is user_required, with
69
+ * stable reason codes instead of keyword guessing. `gateId` binds the
70
+ * canonical action, so any field change produces a new id and expires old
71
+ * approvals. */
72
+ export function preflightStructuredGate(action) {
45
73
  const actionHash = gateActionHash(action);
46
- const highRisk = action.authorization === "user_required" ||
74
+ const gateId = `gate-${actionHash}`;
75
+ const reasonCodes = [];
76
+ const highRiskEffects = action.effects.filter((effect) => USER_EFFECTS.has(effect));
77
+ for (const effect of highRiskEffects)
78
+ reasonCodes.push(`effects:${effect}`);
79
+ if (action.reversibility === "irreversible")
80
+ reasonCodes.push("reversibility:irreversible");
81
+ if (action.reversibility === "unknown")
82
+ reasonCodes.push("reversibility:unknown");
83
+ if (action.authorization === "user_required")
84
+ reasonCodes.push("authorization:user_required");
85
+ if (action.authorization === "unknown")
86
+ reasonCodes.push("authorization:unknown");
87
+ if (action.effects.length === 0)
88
+ reasonCodes.push("effects_empty");
89
+ if (action.scope.length === 0)
90
+ reasonCodes.push("scope_empty");
91
+ const explicitHighRisk = action.authorization === "user_required" ||
47
92
  action.reversibility === "irreversible" ||
48
93
  action.reversibility === "unknown" ||
49
- action.effects.some((effect) => USER_EFFECTS.has(effect));
50
- const userGate = highRisk || action.authorization === "unknown" || action.effects.length === 0;
94
+ highRiskEffects.length > 0;
95
+ // Conservative default: unknown authorization or an empty effects list
96
+ // cannot be proven safe → user_required (risk unknown, not low).
97
+ const userRequired = explicitHighRisk || action.authorization === "unknown" ||
98
+ action.effects.length === 0;
99
+ const risk = userRequired
100
+ ? (explicitHighRisk ? "high" : "unknown")
101
+ : "low";
51
102
  return {
52
- id: `gate-${actionHash}`,
103
+ gateId,
53
104
  actionHash,
54
- gate: userGate
105
+ kind: userRequired ? "user" : "agent",
106
+ risk,
107
+ decision: userRequired ? "user_required" : "agent_allowed",
108
+ reasonCodes,
109
+ ...(userRequired
55
110
  ? {
56
- kind: "user",
57
- question: `Authorize this action: ${action.description}`,
111
+ approvalQuestion: `Authorize this action: ${action.description}`,
58
112
  blockedScope: action.scope.length ? action.scope : [action.description],
59
- allowedWork: ["Read-only investigation", "Local dry-run", "Prepare verification and rollback evidence"],
113
+ allowedBeforeApproval: [
114
+ "Read-only investigation",
115
+ "Local dry-run",
116
+ "Prepare verification and rollback evidence",
117
+ ],
60
118
  }
61
119
  : {
62
- kind: "agent",
63
- problem: action.description,
64
120
  requiredEvidence: action.scope,
65
- suggestedResolution: "Resolve the technical blocker and submit concrete evidence in RoundReport.",
66
- },
121
+ suggestedResolution: "Resolve the technical blocker and submit concrete evidence in the round evaluation.",
122
+ }),
67
123
  };
68
124
  }
69
125
  /** Classify a flat gate text (MCP surface). The id embeds the canonicalized
@@ -1 +1 @@
1
- {"version":3,"file":"cognitive-governance.js","sourceRoot":"","sources":["../src/cognitive-governance.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,uDAAuD;AACvD,MAAM,YAAY,GAAG,IAAI,GAAG,CAA0C;IACpE,YAAY,EAAE,aAAa,EAAE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QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;SACpE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACb,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAChE,OAAO,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAC5D,CAAC,CAAC;SACD,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC"}
@@ -4,11 +4,30 @@
4
4
  * place that interprets their transaction envelope or the compiler's merged
5
5
  * lineage representation. Consumers receive one stable, read-only view.
6
6
  */
7
- import type { ProviderSnapshot } from "./evidence-provider.js";
7
+ import type { MachineObservation } from "./protocol.js";
8
8
  import type { VaultEntry } from "./loop-store.js";
9
- import type { ExecutionEvidence, PromptArtifact, RoundContract, RoundOutcome, SelfEvaluation, VerificationFlag } from "./protocol.js";
9
+ import type { ContractBinding, ExecutionReport, PromptArtifact, RoundContractProposal, RoundOutcome, SelfEvaluation, SubGoalUpdate, VerificationFlag } from "./protocol.js";
10
10
  import type { RoundProcessResult } from "./round-coordinator.js";
11
11
  export type CommittedAction = "continue" | "stop" | "backtrack";
12
+ /** v3.8.1: the rolled-back branch's facts, decoded from a committed rollback
13
+ * directive. One shape for the compile-side Recovery Brief, the state file's
14
+ * Recent tier and the rollback prompt — these were three renderers over two
15
+ * independent derivations (the committed record and an in-memory walk).
16
+ *
17
+ * Note the target is a RESTORE POINT, not an upper bound: the redo re-commits
18
+ * the same round numbers the abandoned rounds occupied (round-lifecycle.ts
19
+ * sets `currentRound = backtrackTarget + 1`), so this is never a window
20
+ * fence. Abandonment is temporal, not numeric. */
21
+ export interface BacktrackRecoveryRecord {
22
+ readonly target: number;
23
+ readonly triggerRule: string;
24
+ readonly failedRounds: number[];
25
+ readonly approaches: string[];
26
+ readonly wrongAssumptions: string[];
27
+ readonly skippedFiles: string[];
28
+ readonly skippedFingerprints: Record<string, string>;
29
+ readonly targetGitHead?: string;
30
+ }
12
31
  export interface CommittedRoundView {
13
32
  readonly source: "feedback" | "merged";
14
33
  readonly sourceEntry: VaultEntry | Record<string, unknown>;
@@ -19,16 +38,24 @@ export interface CommittedRoundView {
19
38
  readonly attempt: number;
20
39
  readonly promptArtifact: PromptArtifact | null;
21
40
  readonly evaluation: SelfEvaluation | null;
22
- readonly executionEvidence: ExecutionEvidence | null;
41
+ readonly executionReport: ExecutionReport | null;
23
42
  readonly verificationFlags: VerificationFlag[];
24
43
  readonly result: RoundProcessResult | null;
25
44
  readonly action: CommittedAction;
26
45
  readonly success: boolean;
27
46
  readonly outcome: RoundOutcome | null;
28
- readonly contractProposal: RoundContract | null;
29
- readonly beforeEvidence: ProviderSnapshot[];
30
- readonly afterEvidence: ProviderSnapshot[];
31
- readonly roundEvidence: ProviderSnapshot[];
47
+ readonly contractProposal: RoundContractProposal | null;
48
+ /** v3.8: the machine binding stamped when the declaring round committed. */
49
+ readonly contractBinding: ContractBinding | null;
50
+ readonly beforeEvidence: MachineObservation[];
51
+ readonly afterEvidence: MachineObservation[];
52
+ /** v3.8: derived before→after delta — never persisted (transaction
53
+ * schema 2 stores only the two factual collections). */
54
+ readonly observationDelta: MachineObservation[];
55
+ /** v3.8: true when the round committed without after-phase observations —
56
+ * its machine evidence is incomplete and must never be substituted with
57
+ * the before baseline. */
58
+ readonly evidenceIncomplete: boolean;
32
59
  /** Normalized round-level declarations used by compiler projections. */
33
60
  readonly outputSummary?: string;
34
61
  readonly constraintViolations?: string[];
@@ -36,10 +63,17 @@ export interface CommittedRoundView {
36
63
  readonly activeConstraints?: string[];
37
64
  readonly retractedConstraints?: string[];
38
65
  readonly emergedSubtasks?: string[];
39
- readonly completedSubtasks?: string[];
40
- readonly blockedSubtasks?: string[];
41
- readonly canceledSubtasks?: string[];
66
+ readonly subgoalUpdates?: SubGoalUpdate[];
67
+ /** v3.8.1: present only on a committed rollback directive, null elsewhere.
68
+ * Decoded from `result.*` on the durable feedback entry and from the
69
+ * `lineage.backtrack*` stamps on a hydrated merged entry. */
70
+ readonly backtrack: BacktrackRecoveryRecord | null;
42
71
  }
72
+ /** v3.8.1: decode a rollback directive's facts from either carrier —
73
+ * `result.*` on a durable :feedback entry, `lineage.*` on a hydrated merged
74
+ * entry. Returns null when no restore point is recorded, which is also the
75
+ * signal that the record cannot serve as recovery guidance. */
76
+ export declare function decodeBacktrackRecord(source: unknown): BacktrackRecoveryRecord | null;
43
77
  /** Decode a durable :feedback entry. Reject/terminate/in-flight envelopes are
44
78
  * not committed history and therefore do not produce a view. */
45
79
  export declare function decodeCommittedRound(entry: VaultEntry): CommittedRoundView | null;
@@ -57,42 +91,93 @@ export declare function decodeRound(entry: unknown): CommittedRoundView | null;
57
91
  /** Lineage sub-object of an entry (`loop_lineage`; v3.7: the legacy
58
92
  * top-level `lineage` alias was removed), or {} when absent. */
59
93
  export declare function entryLineage(entry: unknown): Record<string, unknown>;
60
- /** Extract execution_evidence from an entry, handling both direct-field and
94
+ /** Extract execution_report from an entry, handling both direct-field and
61
95
  * lineage-nested shapes. The decoded committed view wins when the entry is
62
96
  * a committed round. Returns null when absent. Moved from loop-compiler so
63
97
  * field-shape interpretation lives in this module only. */
64
- export declare function entryExecutionEvidence(entry: unknown): Record<string, unknown> | null;
65
- /** Read success_criteria_met from an entry's execution_evidence. */
98
+ export declare function entryExecutionReport(entry: unknown): Record<string, unknown> | null;
99
+ /** Read the criteria the agent claimed met from an entry's execution_report. */
66
100
  export declare function entryCriteriaMet(entry: unknown): string[];
67
- /** Read success_criteria_remaining from an entry's execution_evidence. */
101
+ /** Read the criteria the agent declared outstanding from an entry. */
68
102
  export declare function entryCriteriaRemaining(entry: unknown): string[];
69
103
  /** Read constraints_active from an entry's lineage. */
70
104
  export declare function entryActiveConstraints(entry: unknown): string[];
71
105
  /** Read retracted_constraints from an entry (direct field, else nested in
72
106
  * the lineage). */
73
107
  export declare function entryRetractedConstraints(entry: unknown): string[];
74
- /** Read progress_estimate from an entry's execution_evidence (0 when
108
+ /** Read progress_estimate from an entry's execution_report (0 when
75
109
  * absent). */
76
110
  export declare function entryProgressEstimate(entry: unknown): number;
77
111
  /** Read emerged_subtasks from an entry (handles direct + lineage nesting). */
78
112
  export declare function entryEmergedSubtasks(entry: unknown): string[];
113
+ /** Read subgoal_updates from an entry (handles direct + lineage nesting).
114
+ * v3.7.1: committed status transitions are replayed in round order by the
115
+ * compiler — every derivation replays ALL committed rounds, not just the
116
+ * last one. */
117
+ export declare function entrySubGoalUpdates(entry: unknown): SubGoalUpdate[];
79
118
  /** Read constraint_violations from an entry (entry-level, stored from the
80
119
  * previous round's last_round_result at persist time — distinct from the
81
120
  * evaluation-level violations on the committed view). Moved from
82
121
  * verification-gate so lineage-shape reads live in this module only. */
83
122
  export declare function entryViolations(entry: unknown): string[];
84
123
  export declare function historyRounds(views: Iterable<CommittedRoundView | null>, beforeRound?: number): CommittedRoundView[];
85
- export declare function committedRoundsFromEntries(entries: VaultEntry[], beforeRound?: number): CommittedRoundView[];
124
+ /** v3.8.1: the ONE committed-history window every derivation reads.
125
+ *
126
+ * `decodeRound` (hydrated merged lineage first, then the durable feedback
127
+ * entry) plus the rollback handling in `historyRounds` — so the compile path,
128
+ * the projection, the live coordinator, audit and explain can no longer
129
+ * disagree about which rounds are this branch's history, nor about how their
130
+ * envelope was interpreted.
131
+ *
132
+ * `currentRound` bounds the window exactly as before (default: unbounded). It
133
+ * is NOT a rollback fence: the redo re-commits the round numbers the abandoned
134
+ * rounds occupied, so abandonment is temporal, not numeric, and cannot be
135
+ * expressed as a bound here. */
136
+ export declare function derivationRounds(entries: ReadonlyArray<unknown>, currentRound?: number): CommittedRoundView[];
137
+ /** v3.8.1: the loop's durable round frontier — the session document's
138
+ * `current_round`. Null when no session document is in the entry set, so
139
+ * callers fail OPEN rather than inventing a bound. */
140
+ export declare function persistedFrontier(entries: ReadonlyArray<unknown>): number | null;
141
+ /** v3.8.1: THE window for a READ-ONLY view of a loop — audit, explain, replay,
142
+ * the projection, the metrics replay. Same decoder and same rollback handling
143
+ * as `derivationRounds`, plus the bound those callers cannot compute
144
+ * themselves.
145
+ *
146
+ * The live paths bound their window at the round being compiled, and that
147
+ * bound is what keeps a backtracked branch out of this branch's history. A
148
+ * read-only view has no compile round, so it reads the SAME frontier from the
149
+ * durable session document and applies it only while a committed rollback
150
+ * directive is still in effect — a directive stops being history the moment
151
+ * the redo commit replaces its round's record, which is exactly when the
152
+ * abandoned rounds have been re-committed and must count again.
153
+ *
154
+ * With no directive in effect the window stays UNBOUNDED on purpose: after a
155
+ * stop, terminate or max_rounds the session's `current_round` sits ON the
156
+ * round it just committed, so bounding there would silently drop the loop's
157
+ * final round. An unobservable frontier fails open the same way — a read-only
158
+ * view never invents a fence, it only applies the one the runtime recorded. */
159
+ export declare function readOnlyRounds(entries: ReadonlyArray<unknown>): CommittedRoundView[];
86
160
  /** The machine-evidence set that best represents a committed round: the
87
- * after-phase evidence (captured post-execution), else the round's committed
88
- * diff evidence, else the pre-round baseline. Shared selector for the
161
+ * after-phase observations (captured post-execution), else the derived round
162
+ * delta, else the pre-round baseline. Shared selector for the
89
163
  * evidence-fallback chains that audit, claims, and backtrack-restore each
90
- * used to inline with subtly different tiers — the enforcement-gate variant
91
- * previously skipped roundEvidence entirely. Distinct from
92
- * machineGitMotionSeries, which deliberately reads roundEvidence alone for
93
- * the diffed motion signal. */
94
- export declare function machineEvidenceForRound(view: CommittedRoundView): ProviderSnapshot[];
95
- export declare function mergedRoundsFromEntries(entries: unknown[], beforeRound?: number): CommittedRoundView[];
164
+ * used to inline with subtly different tiers. Distinct from
165
+ * machineGitMotionSeries, which deliberately reads the delta alone for the
166
+ * motion signal. */
167
+ export declare function machineEvidenceForRound(view: CommittedRoundView): MachineObservation[];
168
+ /** v3.8: Rounds whose persisted transaction carries a LEGACY schema version.
169
+ * A hard version break must be visible, not silent: these rounds drop out of
170
+ * history views, so audit/status surface them here instead of letting the
171
+ * loop look complete while rounds are missing. */
172
+ export interface LegacyRound {
173
+ round: number;
174
+ schemaVersion: number;
175
+ /** v3.8.1: which versioned envelope rejected the round. Both are hard
176
+ * breaks — a round that fails either check is not committed history — so
177
+ * both must be REPORTED, not just the transaction one. */
178
+ envelope: "transaction" | "prompt_artifact";
179
+ }
180
+ export declare function legacyTransactionRounds(entries: unknown[]): LegacyRound[];
96
181
  /** Machine-observed git motion for the most recent contiguous window.
97
182
  * Consumers must decode durable or hydrated entries before calling this;
98
183
  * transaction-envelope interpretation stays confined to this module. */
@@ -1 +1 @@
1
- {"version":3,"file":"committed-round.d.ts","sourceRoot":"","sources":["../src/committed-round.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,cAAc,EACd,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAKjE,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,MAAM,GAAG,WAAW,CAAC;AAEhE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,QAAQ,CAAC;IACvC,QAAQ,CAAC,WAAW,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAA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