loopforge 3.0.0 → 3.6.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 (194) hide show
  1. package/README.md +126 -143
  2. package/dist/audit.d.ts +50 -0
  3. package/dist/audit.d.ts.map +1 -0
  4. package/dist/audit.js +131 -0
  5. package/dist/audit.js.map +1 -0
  6. package/dist/canonical-state.d.ts +98 -23
  7. package/dist/canonical-state.d.ts.map +1 -1
  8. package/dist/canonical-state.js +257 -181
  9. package/dist/canonical-state.js.map +1 -1
  10. package/dist/cli.d.ts.map +1 -1
  11. package/dist/cli.js +40 -33
  12. package/dist/cli.js.map +1 -1
  13. package/dist/cognitive-facts.d.ts +17 -0
  14. package/dist/cognitive-facts.d.ts.map +1 -0
  15. package/dist/cognitive-facts.js +99 -0
  16. package/dist/cognitive-facts.js.map +1 -0
  17. package/dist/cognitive-governance.d.ts +25 -33
  18. package/dist/cognitive-governance.d.ts.map +1 -1
  19. package/dist/cognitive-governance.js +38 -138
  20. package/dist/cognitive-governance.js.map +1 -1
  21. package/dist/committed-round.d.ts +59 -0
  22. package/dist/committed-round.d.ts.map +1 -0
  23. package/dist/committed-round.js +222 -0
  24. package/dist/committed-round.js.map +1 -0
  25. package/dist/enforcement-gate.d.ts +78 -0
  26. package/dist/enforcement-gate.d.ts.map +1 -0
  27. package/dist/enforcement-gate.js +1109 -0
  28. package/dist/enforcement-gate.js.map +1 -0
  29. package/dist/engine.d.ts +111 -0
  30. package/dist/engine.d.ts.map +1 -0
  31. package/dist/engine.js +887 -0
  32. package/dist/engine.js.map +1 -0
  33. package/dist/evidence-claims.d.ts +50 -0
  34. package/dist/evidence-claims.d.ts.map +1 -0
  35. package/dist/evidence-claims.js +116 -0
  36. package/dist/evidence-claims.js.map +1 -0
  37. package/dist/evidence-provider.d.ts +50 -23
  38. package/dist/evidence-provider.d.ts.map +1 -1
  39. package/dist/evidence-provider.js +167 -50
  40. package/dist/evidence-provider.js.map +1 -1
  41. package/dist/generate-schema.js +1 -84
  42. package/dist/generate-schema.js.map +1 -1
  43. package/dist/index.d.ts +19 -22
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +16 -15
  46. package/dist/index.js.map +1 -1
  47. package/dist/loop-compiler.d.ts +58 -3
  48. package/dist/loop-compiler.d.ts.map +1 -1
  49. package/dist/loop-compiler.js +841 -304
  50. package/dist/loop-compiler.js.map +1 -1
  51. package/dist/loop-extras-parser.d.ts +2 -2
  52. package/dist/loop-extras-parser.d.ts.map +1 -1
  53. package/dist/loop-extras-parser.js +2 -2
  54. package/dist/loop-extras-parser.js.map +1 -1
  55. package/dist/loop-projection.d.ts +6 -0
  56. package/dist/loop-projection.d.ts.map +1 -0
  57. package/dist/loop-projection.js +26 -0
  58. package/dist/loop-projection.js.map +1 -0
  59. package/dist/loop-store.d.ts +115 -24
  60. package/dist/loop-store.d.ts.map +1 -1
  61. package/dist/loop-store.js +365 -218
  62. package/dist/loop-store.js.map +1 -1
  63. package/dist/mcp/round-lifecycle.d.ts +214 -0
  64. package/dist/mcp/round-lifecycle.d.ts.map +1 -0
  65. package/dist/mcp/round-lifecycle.js +935 -0
  66. package/dist/mcp/round-lifecycle.js.map +1 -0
  67. package/dist/mcp/server.d.ts +2 -1
  68. package/dist/mcp/server.d.ts.map +1 -1
  69. package/dist/mcp/server.js +29 -43
  70. package/dist/mcp/server.js.map +1 -1
  71. package/dist/mcp/session.d.ts +64 -101
  72. package/dist/mcp/session.d.ts.map +1 -1
  73. package/dist/mcp/session.js +433 -1110
  74. package/dist/mcp/session.js.map +1 -1
  75. package/dist/mcp/tools.d.ts +20 -11
  76. package/dist/mcp/tools.d.ts.map +1 -1
  77. package/dist/mcp/tools.js +587 -413
  78. package/dist/mcp/tools.js.map +1 -1
  79. package/dist/policy-metrics.d.ts +12 -24
  80. package/dist/policy-metrics.d.ts.map +1 -1
  81. package/dist/policy-metrics.js +78 -184
  82. package/dist/policy-metrics.js.map +1 -1
  83. package/dist/policy.d.ts +61 -50
  84. package/dist/policy.d.ts.map +1 -1
  85. package/dist/policy.js +48 -146
  86. package/dist/policy.js.map +1 -1
  87. package/dist/prompt-assembler.d.ts +37 -6
  88. package/dist/prompt-assembler.d.ts.map +1 -1
  89. package/dist/prompt-assembler.js +487 -278
  90. package/dist/prompt-assembler.js.map +1 -1
  91. package/dist/prompt-policy.d.ts +1 -8
  92. package/dist/prompt-policy.d.ts.map +1 -1
  93. package/dist/prompt-policy.js +8 -26
  94. package/dist/prompt-policy.js.map +1 -1
  95. package/dist/protocol.d.ts +398 -236
  96. package/dist/protocol.d.ts.map +1 -1
  97. package/dist/protocol.js +147 -17
  98. package/dist/protocol.js.map +1 -1
  99. package/dist/replay.d.ts +5 -13
  100. package/dist/replay.d.ts.map +1 -1
  101. package/dist/replay.js +32 -69
  102. package/dist/replay.js.map +1 -1
  103. package/dist/round-contract.d.ts +64 -0
  104. package/dist/round-contract.d.ts.map +1 -0
  105. package/dist/round-contract.js +80 -0
  106. package/dist/round-contract.js.map +1 -0
  107. package/dist/round-coordinator.d.ts +23 -25
  108. package/dist/round-coordinator.d.ts.map +1 -1
  109. package/dist/round-coordinator.js +103 -92
  110. package/dist/round-coordinator.js.map +1 -1
  111. package/dist/round-driver.d.ts +13 -13
  112. package/dist/round-driver.d.ts.map +1 -1
  113. package/dist/round-driver.js +25 -14
  114. package/dist/round-driver.js.map +1 -1
  115. package/dist/round-transaction.d.ts +14 -18
  116. package/dist/round-transaction.d.ts.map +1 -1
  117. package/dist/round-transaction.js +37 -47
  118. package/dist/round-transaction.js.map +1 -1
  119. package/dist/self-eval.d.ts +48 -0
  120. package/dist/self-eval.d.ts.map +1 -0
  121. package/dist/self-eval.js +248 -0
  122. package/dist/self-eval.js.map +1 -0
  123. package/dist/storage.d.ts +9 -4
  124. package/dist/storage.d.ts.map +1 -1
  125. package/dist/storage.js +18 -6
  126. package/dist/storage.js.map +1 -1
  127. package/dist/token-utils.d.ts +15 -3
  128. package/dist/token-utils.d.ts.map +1 -1
  129. package/dist/token-utils.js +24 -5
  130. package/dist/token-utils.js.map +1 -1
  131. package/dist/verification-gate.d.ts +149 -0
  132. package/dist/verification-gate.d.ts.map +1 -0
  133. package/dist/verification-gate.js +1343 -0
  134. package/dist/verification-gate.js.map +1 -0
  135. package/dist/workspace.d.ts +29 -0
  136. package/dist/workspace.d.ts.map +1 -0
  137. package/dist/workspace.js +61 -0
  138. package/dist/workspace.js.map +1 -0
  139. package/loop_policy.json +37 -16
  140. package/package.json +5 -10
  141. package/skills/perception/SKILL.md +184 -202
  142. package/dist/canonical-event-writer.d.ts +0 -20
  143. package/dist/canonical-event-writer.d.ts.map +0 -1
  144. package/dist/canonical-event-writer.js +0 -131
  145. package/dist/canonical-event-writer.js.map +0 -1
  146. package/dist/compiler-subgoals.d.ts +0 -7
  147. package/dist/compiler-subgoals.d.ts.map +0 -1
  148. package/dist/compiler-subgoals.js +0 -93
  149. package/dist/compiler-subgoals.js.map +0 -1
  150. package/dist/derive-id.d.ts +0 -12
  151. package/dist/derive-id.d.ts.map +0 -1
  152. package/dist/derive-id.js +0 -31
  153. package/dist/derive-id.js.map +0 -1
  154. package/dist/mcp/session-projection.d.ts +0 -5
  155. package/dist/mcp/session-projection.d.ts.map +0 -1
  156. package/dist/mcp/session-projection.js +0 -18
  157. package/dist/mcp/session-projection.js.map +0 -1
  158. package/dist/mcp/session-queue.d.ts +0 -3
  159. package/dist/mcp/session-queue.d.ts.map +0 -1
  160. package/dist/mcp/session-queue.js +0 -18
  161. package/dist/mcp/session-queue.js.map +0 -1
  162. package/dist/mcp/session-types.d.ts +0 -72
  163. package/dist/mcp/session-types.d.ts.map +0 -1
  164. package/dist/mcp/session-types.js +0 -2
  165. package/dist/mcp/session-types.js.map +0 -1
  166. package/dist/round-commit-store.d.ts +0 -12
  167. package/dist/round-commit-store.d.ts.map +0 -1
  168. package/dist/round-commit-store.js +0 -13
  169. package/dist/round-commit-store.js.map +0 -1
  170. package/dist/round-gate.d.ts +0 -31
  171. package/dist/round-gate.d.ts.map +0 -1
  172. package/dist/round-gate.js +0 -259
  173. package/dist/round-gate.js.map +0 -1
  174. package/dist/round-recovery.d.ts +0 -17
  175. package/dist/round-recovery.d.ts.map +0 -1
  176. package/dist/round-recovery.js +0 -117
  177. package/dist/round-recovery.js.map +0 -1
  178. package/dist/round-report.d.ts +0 -16
  179. package/dist/round-report.d.ts.map +0 -1
  180. package/dist/round-report.js +0 -401
  181. package/dist/round-report.js.map +0 -1
  182. package/dist/runtime-services.d.ts +0 -59
  183. package/dist/runtime-services.d.ts.map +0 -1
  184. package/dist/runtime-services.js +0 -460
  185. package/dist/runtime-services.js.map +0 -1
  186. package/dist/vault-format.d.ts +0 -4
  187. package/dist/vault-format.d.ts.map +0 -1
  188. package/dist/vault-format.js +0 -4
  189. package/dist/vault-format.js.map +0 -1
  190. package/dist/vault-types.d.ts +0 -24
  191. package/dist/vault-types.d.ts.map +0 -1
  192. package/dist/vault-types.js +0 -2
  193. package/dist/vault-types.js.map +0 -1
  194. package/loopforge-policy.json +0 -340
@@ -3,88 +3,261 @@
3
3
  * All types exchanged between the Main Agent and LoopForge flow through
4
4
  * these interfaces. This is the contract layer — no implementation logic.
5
5
  *
6
- * v1.15: 40 types — 4 enums + 35 interfaces + 1 type alias.
6
+ * v3.3: 41 types — 2 enums + 35 interfaces + 4 type aliases.
7
7
  */
8
8
  export declare enum Mode {
9
- LOOP_COMPILE = "loop_compile"
9
+ LOOP_COMPILE = "loop_compile",
10
+ FEEDBACK = "feedback"
10
11
  }
12
+ import type { PresentedStateSnapshot } from "./canonical-state.js";
11
13
  export declare enum AgentStatus {
12
14
  OK = "ok",
13
15
  ERROR = "error",
14
16
  STALLED = "stalled"
15
17
  }
16
- export type EvidenceStatus = "verified" | "claimed" | "contradicted" | "unavailable";
17
- export interface RoundCheckReport {
18
- name: string;
19
- status: "passed" | "failed" | "not_run";
20
- required?: boolean;
21
- summary?: string;
22
- counts?: {
23
- passed: number;
24
- failed: number;
25
- skipped: number;
26
- };
27
- }
28
- export interface RoundEvidenceClaim {
29
- id: string;
30
- targetId: string;
31
- evidenceRefs: string[];
32
- }
33
- export interface EvidenceProvenance {
34
- source: "agent" | "command" | "provider" | "verification";
35
- observedAt: string;
36
- status: EvidenceStatus;
37
- detail?: string;
38
- }
39
- export interface EvidenceEnvelope {
40
- files: string[];
41
- checks: RoundCheckReport[];
42
- claims: RoundEvidenceClaim[];
43
- provenance: Record<string, EvidenceProvenance>;
44
- noChangeReason?: string;
45
- }
46
- /** Runtime-derived evidence view. It is rebuilt from a RoundReport and
47
- * provider snapshots; it is never persisted as an independent fact. */
48
- export interface EvidenceDerivedView {
49
- reportedFiles: string[];
50
- observedFiles: string[];
51
- checks: RoundCheckReport[];
52
- verifiedClaims: string[];
53
- contradictedClaims: string[];
54
- unavailableClaims: string[];
55
- criteriaMet: string[];
56
- criteriaRemaining: string[];
57
- progressRatio: number | null;
58
- testCounts: {
18
+ export interface ExecutionFeedback {
19
+ output: string;
20
+ success: boolean;
21
+ constraint_violations: string[];
22
+ manual_fixes_needed: string;
23
+ }
24
+ export declare function makeExecutionFeedback(overrides?: Partial<ExecutionFeedback>): ExecutionFeedback;
25
+ /** P4: Structured execution evidence reported by the agent after each round.
26
+ * Gives LoopForge visibility into what actually happened — files changed,
27
+ * test results, success criteria met, and a subjective progress estimate.
28
+ * Enables the compiler to cross-validate agent claims and compute real progress. */
29
+ export interface ExecutionEvidence {
30
+ /** Files changed in this round. Empty if no files were modified. */
31
+ files_changed: string[];
32
+ /** Test results. null if no tests were run. */
33
+ test_results: {
59
34
  passed: number;
60
35
  failed: number;
61
36
  skipped: number;
62
37
  } | null;
63
- requiredCommandFailures: string[];
64
- /** Whether completion evidence came from a live provider. */
65
- providerStatus: "verified" | "unavailable" | "absent";
38
+ /** Success criteria from the Loop Objective that were MET this round. */
39
+ success_criteria_met: string[];
40
+ /** Success criteria from the Loop Objective that REMAIN unmet. */
41
+ success_criteria_remaining: string[];
42
+ /** Agent's own estimate of overall progress (0.0 to 1.0). */
43
+ progress_estimate: number;
44
+ }
45
+ export declare function makeExecutionEvidence(overrides?: Partial<ExecutionEvidence>): ExecutionEvidence;
46
+ /** P5: A revision to a success criterion — the old form and the new form.
47
+ * The agent proposes this when it discovers the original criterion was
48
+ * wrong, unrealistic, or needs refinement. */
49
+ export interface CriterionRevision {
50
+ old: string;
51
+ new: string;
66
52
  }
67
- /** Durable decision event for a derived user/agent gate. The gate itself is
68
- * rebuilt from canonical facts; only the decision is persisted. */
69
- export interface GateDecision {
70
- gateId: string;
71
- kind: "user" | "agent";
72
- approved: boolean;
53
+ /** v3.3: Round Contract. v3.4 semantics: the field on a submission is a
54
+ * PROPOSAL for the NEXT round — it becomes the ACTIVE contract (rendered
55
+ * as the Current Task and checked for execution conformance) only after
56
+ * the declaring round commits, and stays active until a committed eval
57
+ * lists every done_when item in success_criteria_met (complete) or
58
+ * reports outcome="blocked". While active it is restated unchanged each
59
+ * round; on completion or block, the next contract is declared instead.
60
+ * The ACTIVE contract is machine-derived from committed rounds
61
+ * (round-contract.ts) — never read from last_round_result. Optional:
62
+ * absent = no contract this round, all contract checks stay silent and
63
+ * rendering is identical to a contract-less round.
64
+ *
65
+ * Every field is machine-checkable:
66
+ * - done_when items are claimed satisfied by listing them in
67
+ * execution_evidence.success_criteria_met (verified per-round claim
68
+ * model); leaving them out while success is claimed is premature_boundary
69
+ * against the ACTIVE contract.
70
+ * - verification_plan names must reference configured, enabled
71
+ * evidence.commands (round_unverifiable otherwise).
72
+ * - scope lists the files/directories the round may touch; actual git
73
+ * changes outside it trigger round_scope_drift against the ACTIVE
74
+ * contract. */
75
+ export interface RoundContract {
76
+ /** Round focus, one line. Rendered as the Current Task's first line. */
77
+ work_item?: string;
78
+ /** Completion conditions: cr-XXXXXXXX criterion IDs or free text.
79
+ * Claimed met = listed in success_criteria_met; still open = listed in
80
+ * success_criteria_remaining. ≤ 20 items. */
81
+ done_when: string[];
82
+ /** Verification plan: names of configured, enabled evidence commands
83
+ * (policy.evidence.commands[].name). ≤ 20 items. */
84
+ verification_plan: string[];
85
+ /** Files/directories this round may touch (workspace-relative paths,
86
+ * forward or back slashes, "./" prefix and trailing slashes accepted).
87
+ * Out-of-scope git changes = round_scope_drift. ≤ 50 items. */
73
88
  scope: string[];
74
- note: string;
75
- decidedAt: string;
76
- /** Stable hash of the structured action that was approved. */
77
- actionHash: string;
78
- }
79
- export interface RegressionObligation {
80
- id: string;
81
- description: string;
82
- sourceRound: number;
83
- evidenceRefs: string[];
84
- status: "open" | "satisfied" | "contradicted";
85
89
  }
90
+ /** Structured self-evaluation submitted at the round boundary.
91
+ * The agent outputs this after completing each round.
92
+ * Every field is consumed by at least one downstream function.
93
+ *
94
+ * v1.4 (P0–P2): Three new optional fields enable cognitive evolution.
95
+ * v1.5 (P4–P5): Execution evidence, progress tracking, and self-correction. */
96
+ export interface SelfEvaluation {
97
+ /** true ONLY if all hard constraints were met and the task goal was achieved. */
98
+ success: boolean;
99
+ /** Specific, actionable summary of what was DONE this round.
100
+ * Feeds: buildRollingSummary (key_outcomes),
101
+ * computeConstraintRetirement (activity detection), vault lineage. */
102
+ output_summary: string;
103
+ /** Constraints the agent actually violated this round.
104
+ * Feeds: checkLoopHealth (constraint_integrity),
105
+ * buildRollingSummary (recurring_issues), computeConstraintRetirement. */
106
+ constraint_violations: string[];
107
+ /** false ONLY when the entire task is complete. Tells the autonomous
108
+ * runner to stop the loop. Not consumed by the compiler. */
109
+ should_continue: boolean;
110
+ /** P0: New constraints discovered during this round that were not
111
+ * known before. Merged into the active constraint set by the compiler.
112
+ * Omit or leave empty if none discovered. */
113
+ discovered_constraints?: string[];
114
+ /** P1: A refinement / deepening of the task objective based on this
115
+ * round's discoveries. Appended to (never replaces) the original
116
+ * objective. Omit if understanding is unchanged. */
117
+ objective_refinement?: string;
118
+ /** P2: Sub-problems that surfaced during execution and may need
119
+ * separate attention. Feed into the next-task suggestion.
120
+ * Omit or leave empty if none emerged. */
121
+ emerged_subtasks?: string[];
122
+ /** P4: Structured evidence of what was executed this round.
123
+ * Files changed, test results, criteria met/remaining, progress estimate.
124
+ * Enables the compiler to validate claims and compute real progress. */
125
+ execution_evidence?: ExecutionEvidence;
126
+ /** P5: Constraints that the agent now believes are wrong or irrelevant.
127
+ * Removed from the active constraint set by the compiler.
128
+ * Omit or leave empty if none. */
129
+ retracted_constraints?: string[];
130
+ /** P5: Success criteria that need revision. The agent discovered the
131
+ * original criterion was incorrect and proposes a new formulation.
132
+ * Applied to the Loop Objective by the compiler (version++). */
133
+ revised_success_criteria?: CriterionRevision[];
134
+ /** P5: Assumptions the agent made in earlier rounds that turned out to
135
+ * be wrong. Recorded in the rolling summary as key lessons.
136
+ * Omit or leave empty if none. */
137
+ wrong_assumptions?: string[];
138
+ /** v1.10: Agent declares a subtask boundary. When true, the compiler
139
+ * generates an agent_declared milestone. */
140
+ compression_checkpoint?: boolean;
141
+ /** v1.10: Human-readable label for this checkpoint (e.g. "数据模型层完成").
142
+ * Used as the checkpoint heading in subsequent prompts. */
143
+ checkpoint_label?: string;
144
+ /** Multi-agent: Results of sub-agent / Worker delegations this round.
145
+ * The main agent (or Coordinator) reports what it delegated.
146
+ * The engine automatically writes these to the delegation journal.
147
+ * Omit or leave empty if no delegations occurred. */
148
+ worker_results?: WorkerResult[];
149
+ /** v1.16: Agent's declared next action — what it plans to do in the
150
+ * following round. Stored as loop state and rendered in the next prompt
151
+ * so the agent's self-planning persists across rounds. Optional —
152
+ * no next_action means the compiler generates the next task as before. */
153
+ next_action?: string;
154
+ /** v2.2: Sub-tasks the agent completed this round. Each entry may be a
155
+ * sub-goal ID (e.g. "sg-a3f2b1c0" from the Sub-Goal Dashboard) for
156
+ * exact matching, or a natural-language description for Jaccard
157
+ * similarity fallback. Omit if none. */
158
+ completed_subtasks?: string[];
159
+ /** v2.2: Sub-tasks that are now blocked (cannot proceed). Same ID-or-
160
+ * description matching as completed_subtasks. Omit if none. */
161
+ blocked_subtasks?: string[];
162
+ /** v2.2: Sub-tasks the agent is canceling (no longer needed). Same ID-or-
163
+ * description matching as completed_subtasks. Omit if none. */
164
+ canceled_subtasks?: string[];
165
+ /** v2.5: Why the agent is stopping. Only meaningful when
166
+ * should_continue=false and success=false. Defaults to "gave_up"
167
+ * (current behavior) when absent. "blocked" means work cannot proceed
168
+ * under current constraints; "needs_human_input" requires intervention. */
169
+ stop_reason?: "gave_up" | "blocked" | "needs_human_input";
170
+ /** v2.12: Declared tri-state outcome. When absent, derived from success
171
+ * (true → "success", false → "failed"). "partial" and "blocked" can only
172
+ * be declared explicitly. A declared non-success outcome suppresses the
173
+ * success-class verification checks even when success=true. */
174
+ outcome?: RoundOutcome;
175
+ /** v2.12: Flat blocker description, meaningful only when outcome==="blocked".
176
+ * Also feeds the user/agent gate classification (P2). ≤ 500 chars. */
177
+ blocker?: string;
178
+ /** v2.12: Retroactive claims that a PRIOR round satisfied a criterion.
179
+ * The runtime verifies these against the prior round's git evidence.
180
+ * Max 20 entries. */
181
+ retroactiveClaims?: {
182
+ round: number;
183
+ claim: string;
184
+ }[];
185
+ /** v2.12: Declared reason for claiming success with no machine-verifiable
186
+ * evidence (e.g. "no code changes required — documentation-only round").
187
+ * Downgrades the success_without_verified_evidence check from error to
188
+ * info. Flat string, ≤ 200 chars. */
189
+ no_change_reason?: string;
190
+ /** v2.8: When the previous round's verification flagged intent_drift or
191
+ * subgoal_drift, the agent explains why its actions diverged from its
192
+ * stated plan. Populated from the self-eval block when the prompt
193
+ * injected the field. Empty or absent when no drift was flagged.
194
+ * Used by the enforcement gate R7 to distinguish intentional pivots
195
+ * from unacknowledged drift. */
196
+ drift_clarification?: string;
197
+ /** Model's information needs for the next round's prompt.
198
+ * Consumed by the Compiler — not durable across rounds. */
199
+ prompt_requests?: PromptRequests;
200
+ /** v3.3: Round Contract. v3.4: a PROPOSAL for the NEXT round's contract
201
+ * (restated unchanged while the current one is active; a new one after
202
+ * it completes or blocks). Becomes the ACTIVE contract only once this
203
+ * round commits; it is then derived at compile time from committed
204
+ * rounds — see round-contract.ts. Optional. */
205
+ round_contract?: RoundContract;
206
+ }
207
+ /** v2.12: Tri-state round outcome. Declared via SelfEvaluation.outcome;
208
+ * derived from `success` when absent. Shared by the dual gates, the stop
209
+ * mapping, and the audit view. */
86
210
  export type RoundOutcome = "success" | "partial" | "failed" | "blocked";
87
- export type RoundContinuation = "continue" | "stop";
211
+ /** v2.12: Typed cognitive state projection — runtime-derived facts shipped
212
+ * with advance/status outputs. All fields are derived, zero persistence.
213
+ * Consumers: advance output (main agent), status (human/tooling), resume
214
+ * handoff. The runtime provides facts; the agent decides actions. */
215
+ export interface LoopProjection {
216
+ /** Current focus — last non-failed round's output summary. */
217
+ focus: {
218
+ what: string;
219
+ since_round: number;
220
+ } | null;
221
+ /** Suggested next steps: agent-declared intent vs compiler-derived
222
+ * pending/blocked sub-goals. Non-authoritative. */
223
+ todo: Array<{
224
+ id: string;
225
+ item: string;
226
+ reason: string;
227
+ source: "derived" | "agent_intent";
228
+ priority: number;
229
+ }>;
230
+ /** Phase boundaries from milestone history. */
231
+ phase: {
232
+ current: string;
233
+ label: string;
234
+ boundaries: Array<{
235
+ label: string;
236
+ round: number;
237
+ }>;
238
+ } | null;
239
+ /** Record view of the main agent's reported delegation state — facts
240
+ * only, never a task book for sub-agents. */
241
+ delegation: {
242
+ pending: number;
243
+ last_results: Array<{
244
+ agentId: string;
245
+ outcome: string;
246
+ round: number;
247
+ summary: string;
248
+ }>;
249
+ };
250
+ /** Handoff capsule for resume / process handover. `verified` holds
251
+ * cr-IDs backed by the P0 provenance layer. */
252
+ handoff: {
253
+ summary: string;
254
+ verified: string[];
255
+ open_risks: string[];
256
+ };
257
+ }
258
+ export declare function makeLoopProjection(overrides?: Partial<LoopProjection>): LoopProjection;
259
+ /** v2.12: Structured high-risk action descriptor (internal — audit display
260
+ * and gate classification). The MCP surface uses a flat gate text instead. */
88
261
  export interface GateActionDescriptor {
89
262
  description: string;
90
263
  scope: string[];
@@ -92,122 +265,32 @@ export interface GateActionDescriptor {
92
265
  reversibility: "reversible" | "recoverable" | "irreversible" | "unknown";
93
266
  authorization: "agent_allowed" | "user_required" | "unknown";
94
267
  }
95
- export interface RoundReport {
96
- format: "loopforge.round-report";
97
- outcome: RoundOutcome;
98
- continuation: RoundContinuation;
99
- summary: string;
100
- violations: string[];
101
- evidence?: EvidenceEnvelope;
102
- blocker?: {
103
- kind: "dependency" | "external" | "needs_human_input" | "agent";
104
- reason: string;
105
- references: string[];
106
- action?: GateActionDescriptor;
107
- };
108
- discoveries?: {
109
- wrongAssumptions: string[];
110
- emergedWork: string[];
111
- facts: string[];
112
- newConstraints: string[];
113
- };
114
- subGoalEvents?: {
115
- completed: string[];
116
- blocked: string[];
117
- canceled: string[];
118
- };
119
- /** Irreducible Constraint facts; unlike Focus/Todo these cannot be derived. */
120
- constraintEvents?: {
121
- retired: string[];
122
- };
123
- /** Irreducible Goal facts for correcting a criterion without replacing it silently. */
124
- criterionRevisions?: CriterionRevision[];
125
- objectiveRefinement?: string;
126
- phaseBoundaryProposal?: {
127
- label: string;
128
- reason: string;
129
- };
130
- contextRequest?: PromptRequests;
131
- /** Agent suggestion only. Runtime-derived focus and todo always win. */
132
- agentIntent?: string;
133
- /** Structured explanation used only when the runtime detects intent drift. */
134
- driftClarification?: {
135
- explanation: string;
136
- anchors: string[];
137
- };
138
- }
139
- export interface PhaseHistoryEntry {
140
- id: string;
141
- label: string;
142
- status: "active" | "completed" | "abandoned";
143
- enteredAtRound: number;
144
- closedAtRound?: number;
145
- outcome: string;
146
- evidenceRefs: string[];
147
- }
148
- export interface TodoProjection {
149
- id: string;
150
- sourceType: "verification" | "criterion" | "sub_goal" | "blocker";
151
- sourceId: string;
152
- action: string;
153
- completionSignal: string;
154
- evidenceRequirements: string[];
155
- gate: "none" | "agent" | "user";
156
- }
157
- export type DerivedGate = {
158
- kind: "user";
159
- question: string;
160
- blockedScope: string[];
161
- allowedWork: string[];
162
- } | {
163
- kind: "agent";
164
- problem: string;
165
- requiredEvidence: string[];
166
- suggestedResolution: string;
167
- };
168
- export interface HandoffProjection {
169
- goalId: string;
170
- roundId: string;
171
- phaseId?: string;
172
- focus: string;
173
- verifiedFacts: string[];
174
- unresolvedBlockers: string[];
175
- carriedConstraints: string[];
176
- failedAttempts: string[];
177
- wrongAssumptions: string[];
178
- evidenceRefs: string[];
179
- regressionObligations: RegressionObligation[];
180
- suggestedNextAction?: string;
181
- gate?: DerivedGate;
182
- }
183
- /** Narrow compiler input derived from a verified canonical report. */
184
- export interface CompilerRoundProjection {
185
- round: number;
186
- outcome: RoundOutcome;
187
- continuation: RoundContinuation;
188
- summary: string;
189
- violations: string[];
190
- evidence: EvidenceDerivedView;
191
- discoveries?: RoundReport["discoveries"];
192
- subGoalEvents?: RoundReport["subGoalEvents"];
193
- constraintEvents?: RoundReport["constraintEvents"];
194
- criterionRevisions?: RoundReport["criterionRevisions"];
195
- objectiveRefinement?: string;
196
- phaseBoundaryProposal?: RoundReport["phaseBoundaryProposal"];
197
- agentIntent?: string;
198
- /** v2.9: Model-expressed information needs carried from the report
199
- * into the next prompt compilation. Transient — never persisted. */
200
- contextRequest?: PromptRequests;
201
- }
202
- /** P5: A revision to a success criterion — the old form and the new form.
203
- * The agent proposes this when it discovers the original criterion was
204
- * wrong, unrealistic, or needs refinement. */
205
- export interface CriterionRevision {
206
- old: string;
207
- new: string;
268
+ /** v2.12: Classified gate — user gates need human authorization, agent
269
+ * gates are resolved by the agent submitting verifiable evidence. */
270
+ export interface DerivedGate {
271
+ kind: "user" | "agent";
272
+ question?: string;
273
+ blockedScope?: string[];
274
+ allowedWork?: string[];
275
+ problem?: string;
276
+ requiredEvidence?: string[];
277
+ suggestedResolution?: string;
278
+ }
279
+ /** v2.12: A persisted user decision for a gate. The actionHash binds the
280
+ * approval to the exact canonicalized action — an edited action changes
281
+ * the hash, so stale approvals fail the gateId match automatically. */
282
+ export interface GateDecision {
283
+ gateId: string;
284
+ kind: "user" | "agent";
285
+ approved: boolean;
286
+ scope: string[];
287
+ note: string;
288
+ decidedAt: string;
289
+ actionHash: string;
208
290
  }
291
+ export declare function makeGateDecision(overrides?: Partial<GateDecision>): GateDecision;
209
292
  /** v2.9: Model-expressed information needs for the next round.
210
- * Submitted via RoundReport.contextRequest, consumed by the
293
+ * Submitted via SelfEvaluation.prompt_requests, consumed by the
211
294
  * Compiler when assembling the next prompt. Transient — each round's
212
295
  * requests apply to that round only. */
213
296
  export interface PromptRequests {
@@ -217,9 +300,6 @@ export interface PromptRequests {
217
300
  * only reordered. Max entries: policy-driven (L2: 5, L1: 3).
218
301
  * L0: ignored. */
219
302
  emphasize?: string[];
220
- /** Structured sections to expand to full detail.
221
- * L2: ignored (already expanded). L1: max 1 section. L0: ignored. */
222
- expand?: ("milestones" | "sub_goals" | "constraint_lifecycle" | "agent_trust" | "progress" | "loop_synthesis")[];
223
303
  /** Things the model is confused about. Rendered at the prompt top
224
304
  * as "Confusion Alerts" before the Objective section. Compiler
225
305
  * auto-matches each entry against state sections and provides
@@ -252,7 +332,7 @@ export interface MilestoneSummary {
252
332
  carried_constraints: string[];
253
333
  /** Constraints resolved during this phase. */
254
334
  resolved_constraints: string[];
255
- /** Runtime-derived verified progress at the milestone boundary. */
335
+ /** Agent's progress_estimate at the milestone boundary. */
256
336
  progress_at_boundary: number;
257
337
  /** How this milestone was created. */
258
338
  kind: "agent_declared" | "criteria_milestone" | "auto";
@@ -267,11 +347,17 @@ export interface WorkerResult {
267
347
  subTask: string;
268
348
  resultSummary: string;
269
349
  success: boolean;
350
+ /** v2.12: Declared worker outcome. When absent, derived from success
351
+ * (true → "success", false → "failed"). "partial" is explicit only. */
352
+ outcome?: "success" | "partial" | "failed";
270
353
  discoveredConstraints?: string[];
271
354
  }
355
+ export declare function makeSelfEvaluation(overrides?: Partial<SelfEvaluation>): SelfEvaluation;
356
+ /** Regex to extract a self-evaluation JSON block from agent output. */
272
357
  export interface LoopForgeRequest {
273
358
  task: string;
274
359
  mode: Mode;
360
+ feedback: ExecutionFeedback | null;
275
361
  skill_name: string | null;
276
362
  task_id: string | null;
277
363
  [key: string]: unknown;
@@ -289,6 +375,35 @@ export interface LoopObjective {
289
375
  * Each entry is the refinement text from a single round. */
290
376
  refinement_history?: string[];
291
377
  }
378
+ /** v3.2: Derived per-criterion status for the progress dashboard — the
379
+ * "goal → criteria → evidence" vertical view. Zero persistence: derived from
380
+ * vault entries each round (met/remaining reports + Jaccard sub-goal links). */
381
+ export interface CriterionStatus {
382
+ /** Stable ID derived from the criterion text (cr-XXXXXXXX). */
383
+ id: string;
384
+ /** The criterion text as declared in the objective. */
385
+ text: string;
386
+ status: "met" | "remaining" | "unknown";
387
+ /** Round when the criterion was first reported met (machine-backed). */
388
+ met_at_round?: number;
389
+ /** Sub-goals whose description matches this criterion (Jaccard). */
390
+ related_subgoal_ids: string[];
391
+ }
392
+ export declare function makeCriterionStatus(overrides?: Partial<CriterionStatus>): CriterionStatus;
393
+ /** v3.2: A deterministic "lesson learned" — a constraint or verification
394
+ * check that failed repeatedly across rounds. Rendered in the prompt to
395
+ * immunize the agent against repeating the same mistakes. Zero persistence:
396
+ * derived from vault entries each round; presentation only — never feeds
397
+ * the enforcement gate's decisions. */
398
+ export interface Lesson {
399
+ /** Constraint text or verification check name. */
400
+ text: string;
401
+ kind: "constraint_violation" | "verification_error" | "verification_warning";
402
+ /** How many rounds this lesson occurred in. */
403
+ count: number;
404
+ /** The rounds it occurred in, ascending. */
405
+ rounds: number[];
406
+ }
292
407
  export declare function makeLoopObjective(overrides?: Partial<LoopObjective>): LoopObjective;
293
408
  export interface LoopHealth {
294
409
  goal_alignment: number;
@@ -315,10 +430,6 @@ export interface RollingSummary {
315
430
  * (agent_declared > criteria_milestone > auto). Rendered in L2 prompts
316
431
  * and always written to the state file. */
317
432
  milestones?: MilestoneSummary[];
318
- /** v2.1: Single-paragraph structural synthesis of the entire loop.
319
- * Generated at L2 level. Formulaic, not NLP. Contains round count,
320
- * phase count, overall progress, and active constraint summary. */
321
- loop_synthesis?: string;
322
433
  }
323
434
  export declare function makeRollingSummary(overrides?: Partial<RollingSummary>): RollingSummary;
324
435
  /** v2.2: A structured sub-goal tracked by the compiler across rounds.
@@ -372,6 +483,62 @@ export interface TaskAlignment {
372
483
  escalation: string;
373
484
  }
374
485
  export declare function makeTaskAlignment(overrides?: Partial<TaskAlignment>): TaskAlignment;
486
+ export interface LoopRoundResult {
487
+ round: number;
488
+ success: boolean;
489
+ output_summary: string;
490
+ constraint_violations: string[];
491
+ manual_fixes_needed: string;
492
+ /** P0: Constraints discovered during this round. */
493
+ discovered_constraints?: string[];
494
+ /** P1: Objective refinement from this round. */
495
+ objective_refinement?: string;
496
+ /** P2: Sub-problems that emerged during this round. */
497
+ emerged_subtasks?: string[];
498
+ /** P4: Execution evidence from this round. */
499
+ execution_evidence?: ExecutionEvidence;
500
+ /** P5: Constraints retracted this round. */
501
+ retracted_constraints?: string[];
502
+ /** P5: Success criteria revised this round. */
503
+ revised_success_criteria?: CriterionRevision[];
504
+ /** P5: Wrong assumptions identified this round. */
505
+ wrong_assumptions?: string[];
506
+ /** Multi-agent: Delegation results from this round.
507
+ * Set from SelfEvaluation.worker_results during buildLoopRequest. */
508
+ worker_results?: WorkerResult[];
509
+ /** v1.10: Agent declared a subtask boundary in this round. */
510
+ compression_checkpoint?: boolean;
511
+ /** v1.10: Human-readable label for the checkpoint. */
512
+ checkpoint_label?: string;
513
+ /** v1.16: Agent's declared next action for the following round. */
514
+ next_action?: string;
515
+ /** v2.2: Sub-tasks completed this round. */
516
+ completed_subtasks?: string[];
517
+ /** v2.2: Sub-tasks blocked this round. */
518
+ blocked_subtasks?: string[];
519
+ /** v2.2: Sub-tasks canceled this round. */
520
+ canceled_subtasks?: string[];
521
+ /** v2.8: Agent's explanation for intent/subgoal drift detected in
522
+ * the previous round. Carried forward from SelfEvaluation. */
523
+ drift_clarification?: string;
524
+ /** Model's information needs for the next round's prompt.
525
+ * Carried forward from SelfEvaluation. Consumed by the Compiler. */
526
+ prompt_requests?: PromptRequests;
527
+ /** v2.12: Declared tri-state outcome. Carried forward from SelfEvaluation. */
528
+ outcome?: RoundOutcome;
529
+ /** v2.12: Flat blocker description (outcome==="blocked" only). */
530
+ blocker?: string;
531
+ /** v2.12: Retroactive claims against prior rounds. */
532
+ retroactiveClaims?: {
533
+ round: number;
534
+ claim: string;
535
+ }[];
536
+ /** v2.12: Declared reason for success without machine evidence.
537
+ * Carried forward from SelfEvaluation. */
538
+ no_change_reason?: string;
539
+ }
540
+ export declare function makeRoundContract(overrides?: Partial<RoundContract>): RoundContract;
541
+ export declare function makeLoopRoundResult(overrides?: Partial<LoopRoundResult>): LoopRoundResult;
375
542
  export interface LoopCompileRequest {
376
543
  mode: Mode;
377
544
  loop_id: string;
@@ -384,7 +551,7 @@ export interface LoopCompileRequest {
384
551
  plan_source: string | null;
385
552
  constraints_from_plan: string[];
386
553
  new_since_last_round: string;
387
- last_round_view: CompilerRoundProjection | null;
554
+ last_round_result: LoopRoundResult | null;
388
555
  force_level: string;
389
556
  health_check_interval: number;
390
557
  /** Optional context supplied explicitly by the embedding Agent. */
@@ -401,13 +568,13 @@ export interface LoopCompileRequest {
401
568
  attempt: number;
402
569
  /** Consecutive zero-commit enforcement rejections for this round. */
403
570
  consecutive_rejections: number;
404
- /** Structured enforcement guidance rendered into retry prompts. */
571
+ /** Structured enforcement feedback rendered into retry prompts. */
405
572
  rejection_notice: string;
406
573
  }
407
574
  export declare function makeLoopCompileRequest(overrides?: Partial<LoopCompileRequest>): LoopCompileRequest;
408
575
  /** Immutable record of the exact prompt delivered for one round attempt. */
409
576
  export interface PromptArtifact {
410
- format: "loopforge.prompt";
577
+ schemaVersion: 1;
411
578
  roundId: string;
412
579
  attempt: number;
413
580
  level: "l0" | "l1" | "l2";
@@ -417,19 +584,14 @@ export interface PromptArtifact {
417
584
  stateHash: string;
418
585
  basePromptVersion: string;
419
586
  includedSections: string[];
420
- omittedSections: string[];
421
587
  budgetChars: number;
422
588
  charCount: number;
423
589
  budgetExceeded: boolean;
424
- /** Vault-derived history (filled by the compiler from prior entries);
425
- * undefined when the compile path cannot resolve a value. */
426
- lastL2Round?: number;
427
- lastMeaningfulProgressRound?: number;
428
- stateAgeRounds?: number;
429
- phaseId?: string;
430
- focusId?: string;
431
- todoId?: string;
432
590
  generatedAt: number;
591
+ /** v3.2: What the rendered prompt actually presented (L1 only). Persisted
592
+ * on the lineage entry as the diff baseline for L1 collapse. Absent for
593
+ * L0/L2 compiles. */
594
+ presentedState?: PresentedStateSnapshot;
433
595
  }
434
596
  export interface LoopCompileResponse {
435
597
  status: AgentStatus;
@@ -461,40 +623,30 @@ export interface LoopCompileResponse {
461
623
  /** v2.5: Trust scores from the last 10 rounds, newest last. Empty for
462
624
  * round 1. Reconstructed from vault entries — zero new persistence. */
463
625
  agent_trust_trend?: number[];
464
- /** Rebuildable runtime projection. Kept together so derived fields cannot
465
- * be mistaken for independent response facts. */
466
- projection?: LoopCompileProjection;
626
+ /** v3.2: Derived per-criterion status (goal → criteria → evidence view).
627
+ * Zero persistence — re-derived from vault entries each round. */
628
+ criterion_statuses?: CriterionStatus[];
629
+ /** v3.2: Deterministic lessons learned (repeated violations / repeated
630
+ * verification failures). Presentation only — never feeds enforcement. */
631
+ lessons?: Lesson[];
632
+ suggested_next_task: string;
467
633
  plan_source: string | null;
468
634
  warnings: string[];
469
635
  error: string;
470
636
  /** v1.14: Content for the loop state file. Written by the caller
471
- * (SessionManager) to .loopforge/state/{loopId}-state.md.
472
- * Undefined for L0/L1 compilations — only L2 produces state file content. */
637
+ * (SessionManager or Runtime) to .loopforge/state/{loopId}-state.md.
638
+ * Present on every level when `state_file.enabled` (default true) —
639
+ * L0/L1/L2 all render it. Undefined only when the state file is
640
+ * disabled or the compile produced no prompt. */
473
641
  state_file_content?: string;
474
642
  /** Exact, hashed prompt record used by transaction replay and audit. */
475
643
  prompt_artifact?: PromptArtifact;
476
- /** Rebuildable canonical projection for status/replay consumers. */
477
- canonical_state?: Record<string, unknown>;
478
644
  }
479
645
  export declare function makeLoopCompileResponse(overrides?: Partial<LoopCompileResponse>): LoopCompileResponse;
480
- export interface LoopCompileProjection {
481
- suggestedNextAction: string;
482
- /** Accumulated, runtime-verified claim targets reconstructed from Vault. */
483
- verifiedFacts: string[];
484
- /** Evidence references supporting verifiedFacts. */
485
- verifiedEvidenceRefs: string[];
486
- /** Rebuildable regression checks accumulated from accepted evidence. */
487
- regressionObligations: RegressionObligation[];
488
- /** Claimed discoveries from the latest accepted RoundEvent. */
489
- discoveredFacts: string[];
490
- /** Current blocker facts from the latest accepted RoundEvent. */
491
- activeBlockers: string[];
492
- }
493
- export declare function makeLoopCompileProjection(overrides?: Partial<LoopCompileProjection>): LoopCompileProjection;
494
646
  /** Aggregated evidence snapshot for the state file Evidence section.
495
647
  * Four categories give the agent a clear picture of what's been confirmed,
496
648
  * what remains, what was wrong, and what's newly discovered — all derived
497
- * from accepted RoundReport events across rounds. */
649
+ * from accumulated SelfEvaluation data across rounds. */
498
650
  export interface EvidenceSnapshot {
499
651
  /** Criteria met + successful outcomes confirmed across rounds. */
500
652
  verified: string[];
@@ -516,26 +668,38 @@ export interface LoopForgeResponse {
516
668
  prompt_artifact?: PromptArtifact;
517
669
  /** Structured warnings from the compiler — preferred over parsing prompt text. */
518
670
  warnings?: string[];
519
- /** Rebuildable canonical projection for status consumers. */
520
- canonical_state?: Record<string, unknown>;
671
+ /** v2.12: Compiler-derived state passed through for typed projections
672
+ * (zero extra persistence — derived fresh each compile). */
673
+ loop_objective?: LoopObjective | null;
674
+ rolling_summary?: RollingSummary | null;
675
+ sub_goals?: SubGoal[];
676
+ criterion_statuses?: CriterionStatus[];
677
+ suggested_next_task?: string;
521
678
  }
522
679
  export interface SessionState {
523
680
  task_id: string;
681
+ call_count: number;
682
+ success_trend: boolean[];
683
+ current_version: string;
684
+ feedback_buffer: Record<string, unknown>[];
524
685
  }
525
686
  export declare function makeSessionState(taskId: string): SessionState;
526
687
  export interface AgentLoopResult {
527
688
  status: AgentStatus;
528
689
  response: LoopForgeResponse | null;
529
690
  }
530
- /** Why a loop stopped. Used by MCP session and vault persistence. */
531
- export type StopReason = "completed" | "failed" | "blocked" | "cancelled" | "max_rounds" | "circuit_breaker" | "stalled" | "executor_failure" | "enforcement_terminated"
532
- /** v1.18: Loop was paused by user or signal. */
691
+ /** Why a loop stopped. Used by MCP session and vault persistence.
692
+ * `completed` requires both success=true and should_continue=false.
693
+ * `failed` is success=false + should_continue=false (agent gave up).
694
+ * `cancelled` is manual stop via loopforge_stop. */
695
+ export type StopReason = "completed" | "failed" | "blocked" | "cancelled" | "max_rounds" | "stalled" | "enforcement_terminated"
696
+ /** Loop was paused by user or signal. */
533
697
  | "paused";
534
698
  /** Result of round-boundary enforcement. Decides whether to accept the round,
535
699
  * reject it (force the agent to redo the SAME round), or terminate the loop.
536
700
  *
537
701
  * accept: round passes; proceed to next round as normal.
538
- * reject: agent's round report or output is invalid; the agent receives
702
+ * reject: agent's self-evaluation or output is invalid; the agent receives
539
703
  * a rejection prompt and must redo the same round. Round counter
540
704
  * does NOT increment.
541
705
  * terminate: loop has reached an unrecoverable state; stop immediately with
@@ -555,8 +719,6 @@ export interface EnforcementResult {
555
719
  * drift_clarification waiver (R7). The caller uses this to track
556
720
  * clarification streaks independently of rejection streaks. */
557
721
  clarification_accepted?: boolean;
558
- /** True when a terminal rule was converted into one final escalated reject. */
559
- escalation_issued?: boolean;
560
722
  }
561
723
  export declare function makeEnforcementResult(overrides?: Partial<EnforcementResult>): EnforcementResult;
562
724
  /** Context supplied to an embedding-owned provider before compilation. */
@@ -565,8 +727,8 @@ export interface ExternalContextRequest {
565
727
  round: number;
566
728
  task: string;
567
729
  domain: string;
568
- /** The previously accepted compiler view, when one exists. */
569
- lastRoundView?: CompilerRoundProjection;
730
+ /** The previously accepted evaluation, when one exists. */
731
+ lastEvaluation?: SelfEvaluation;
570
732
  }
571
733
  export type ExternalContextProvider = (request: ExternalContextRequest) => Promise<string>;
572
734
  export interface LoopTerminalEvent {
@@ -576,16 +738,16 @@ export interface LoopTerminalEvent {
576
738
  successTrajectory: boolean[];
577
739
  loopId: string;
578
740
  task: string;
579
- lastRoundView?: CompilerRoundProjection;
741
+ lastEvaluation?: SelfEvaluation;
580
742
  }
581
743
  export type LoopTerminalSink = (event: LoopTerminalEvent) => Promise<void> | void;
582
- /** A single flag raised during round report verification.
744
+ /** A single flag raised during self-evaluation verification.
583
745
  * Each flag identifies a specific inconsistency between the agent's
584
746
  * self-reported data and the loop's cross-round lineage. */
585
747
  export interface VerificationFlag {
586
748
  /** info | warn | error — determines how aggressively the compiler reacts. */
587
749
  severity: "info" | "warn" | "error";
588
- /** Stable report or evidence path that triggered this flag. */
750
+ /** Which SelfEvaluation field triggered this flag (e.g. "progress_estimate"). */
589
751
  field: string;
590
752
  /** Check name for debugging / audit (e.g. "progress_regression"). */
591
753
  check: string;
@@ -593,7 +755,7 @@ export interface VerificationFlag {
593
755
  detail: string;
594
756
  }
595
757
  export declare function makeVerificationFlag(overrides?: Partial<VerificationFlag>): VerificationFlag;
596
- /** Result of cross-round round report verification.
758
+ /** Result of cross-round self-evaluation verification.
597
759
  *
598
760
  * Verdict semantics:
599
761
  * - trusted: all checks passed; flags are informational only.