loopforge 2.7.0 → 2.11.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 (85) hide show
  1. package/README.md +103 -166
  2. package/dist/canonical-state.d.ts.map +1 -1
  3. package/dist/canonical-state.js +44 -6
  4. package/dist/canonical-state.js.map +1 -1
  5. package/dist/enforcement-gate.d.ts +22 -1
  6. package/dist/enforcement-gate.d.ts.map +1 -1
  7. package/dist/enforcement-gate.js +281 -38
  8. package/dist/enforcement-gate.js.map +1 -1
  9. package/dist/engine.d.ts.map +1 -1
  10. package/dist/engine.js +21 -3
  11. package/dist/engine.js.map +1 -1
  12. package/dist/evidence-provider.d.ts +3 -5
  13. package/dist/evidence-provider.d.ts.map +1 -1
  14. package/dist/evidence-provider.js +24 -10
  15. package/dist/evidence-provider.js.map +1 -1
  16. package/dist/index.d.ts +2 -11
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +2 -11
  19. package/dist/index.js.map +1 -1
  20. package/dist/loop-compiler.d.ts +2 -2
  21. package/dist/loop-compiler.d.ts.map +1 -1
  22. package/dist/loop-compiler.js +135 -42
  23. package/dist/loop-compiler.js.map +1 -1
  24. package/dist/loop-store.d.ts.map +1 -1
  25. package/dist/loop-store.js +3 -5
  26. package/dist/loop-store.js.map +1 -1
  27. package/dist/mcp/server.d.ts.map +1 -1
  28. package/dist/mcp/server.js +42 -8
  29. package/dist/mcp/server.js.map +1 -1
  30. package/dist/mcp/session.d.ts +27 -2
  31. package/dist/mcp/session.d.ts.map +1 -1
  32. package/dist/mcp/session.js +145 -1
  33. package/dist/mcp/session.js.map +1 -1
  34. package/dist/mcp/tools.d.ts.map +1 -1
  35. package/dist/mcp/tools.js +26 -4
  36. package/dist/mcp/tools.js.map +1 -1
  37. package/dist/policy-metrics.d.ts +8 -0
  38. package/dist/policy-metrics.d.ts.map +1 -1
  39. package/dist/policy-metrics.js +11 -0
  40. package/dist/policy-metrics.js.map +1 -1
  41. package/dist/policy.d.ts +46 -0
  42. package/dist/policy.d.ts.map +1 -1
  43. package/dist/policy.js +12 -2
  44. package/dist/policy.js.map +1 -1
  45. package/dist/prompt-assembler.d.ts +3 -1
  46. package/dist/prompt-assembler.d.ts.map +1 -1
  47. package/dist/prompt-assembler.js +427 -29
  48. package/dist/prompt-assembler.js.map +1 -1
  49. package/dist/protocol.d.ts +54 -8
  50. package/dist/protocol.d.ts.map +1 -1
  51. package/dist/protocol.js +7 -1
  52. package/dist/protocol.js.map +1 -1
  53. package/dist/round-coordinator.d.ts +28 -4
  54. package/dist/round-coordinator.d.ts.map +1 -1
  55. package/dist/round-coordinator.js +91 -7
  56. package/dist/round-coordinator.js.map +1 -1
  57. package/dist/round-driver.d.ts +4 -0
  58. package/dist/round-driver.d.ts.map +1 -1
  59. package/dist/round-driver.js +2 -0
  60. package/dist/round-driver.js.map +1 -1
  61. package/dist/round-transaction.d.ts +4 -0
  62. package/dist/round-transaction.d.ts.map +1 -1
  63. package/dist/round-transaction.js +4 -5
  64. package/dist/round-transaction.js.map +1 -1
  65. package/dist/self-eval.d.ts.map +1 -1
  66. package/dist/self-eval.js +30 -0
  67. package/dist/self-eval.js.map +1 -1
  68. package/dist/token-utils.d.ts +3 -0
  69. package/dist/token-utils.d.ts.map +1 -1
  70. package/dist/token-utils.js +6 -0
  71. package/dist/token-utils.js.map +1 -1
  72. package/dist/verification-gate.d.ts +6 -2
  73. package/dist/verification-gate.d.ts.map +1 -1
  74. package/dist/verification-gate.js +41 -5
  75. package/dist/verification-gate.js.map +1 -1
  76. package/package.json +2 -2
  77. package/skills/perception/SKILL.md +105 -30
  78. package/dist/interop.d.ts +0 -35
  79. package/dist/interop.d.ts.map +0 -1
  80. package/dist/interop.js +0 -34
  81. package/dist/interop.js.map +0 -1
  82. package/dist/run.d.ts +0 -51
  83. package/dist/run.d.ts.map +0 -1
  84. package/dist/run.js +0 -200
  85. package/dist/run.js.map +0 -1
@@ -30,6 +30,31 @@ Keep the returned `sessionId`, `roundId`, prompt, and level.
30
30
  3. Check actual evidence before claiming success.
31
31
  4. Call `loopforge_next` with `sessionId` and a structured `evaluation`.
32
32
 
33
+ ### Evaluation fields
34
+
35
+ | Field | Rule |
36
+ | --- | --- |
37
+ | `success` | `true` only when the whole objective and every hard constraint are satisfied. |
38
+ | `output_summary` | State what changed and what was verified this round. |
39
+ | `constraint_violations` | Report real violations. Use constraint IDs (`c-XXXXXXXX`) for exact matching. Do not hide violations to force progress. |
40
+ | `should_continue` | `false` only when the entire task is complete. |
41
+ | `execution_evidence` | `files_changed`, `test_results`, `success_criteria_met`, `success_criteria_remaining`, `progress_estimate`. Use criterion IDs (`cr-XXXXXXXX`) in `success_criteria_met`/`_remaining`. |
42
+ | `discovered_constraints` | New guardrails found this round. Will be assigned stable IDs by the compiler. |
43
+ | `objective_refinement` | Refine the objective when repository evidence changes its meaning. |
44
+ | `emerged_subtasks` | New sub-problems that surfaced. Use clear, distinct descriptions. |
45
+ | `completed_subtasks` | Sub-goal IDs (`sg-XXXXXXXX`) or descriptions you finished this round. |
46
+ | `blocked_subtasks` | Sub-goal IDs or descriptions that cannot proceed. |
47
+ | `canceled_subtasks` | Sub-goal IDs or descriptions that are no longer needed. |
48
+ | `retracted_constraints` | Constraints the agent now believes are wrong or irrelevant. |
49
+ | `revised_success_criteria` | Old → new revisions for criteria discovered to be incorrect. |
50
+ | `wrong_assumptions` | Assumptions disproved this round. |
51
+ | `next_action` | What you plan to do in the next round. Be specific — the verification gate compares this against your actual output. |
52
+ | `compression_checkpoint` | Set `true` and include `checkpoint_label` when you complete a major phase. |
53
+ | `drift_clarification` | Required when you pivot from your declared `next_action`. Must include specific constraint/criterion/sub-goal IDs or file paths. Filler text without concrete references will be rejected. |
54
+ | `prompt_requests` | `emphasize` (what to highlight next round), `expand` (sections to expand), `confusion_points` (what you're confused about). |
55
+ | `stop_reason` | When `should_continue=false` and `success=false`: `"gave_up"`, `"blocked"`, or `"needs_human_input"`. |
56
+ | `worker_results` | Record delegated subtask results and discoveries from sub-agents. |
57
+
33
58
  Minimal evaluation:
34
59
 
35
60
  ```json
@@ -37,26 +62,68 @@ Minimal evaluation:
37
62
  "success": false,
38
63
  "output_summary": "Implemented the parser and added 8 passing tests.",
39
64
  "constraint_violations": [],
40
- "should_continue": true
65
+ "should_continue": true,
66
+ "execution_evidence": {
67
+ "files_changed": ["src/parser.ts", "tests/parser.test.ts"],
68
+ "test_results": { "passed": 8, "failed": 0, "skipped": 0 },
69
+ "success_criteria_met": [],
70
+ "success_criteria_remaining": ["All parser edge cases covered"],
71
+ "progress_estimate": 0.4
72
+ }
41
73
  }
42
74
  ```
43
75
 
44
- Important fields:
76
+ ## Using stable IDs
45
77
 
46
- | Field | Rule |
47
- | --- | --- |
48
- | `success` | Use `true` only when the whole objective and every hard constraint are satisfied. |
49
- | `output_summary` | State what changed and what was verified. |
50
- | `constraint_violations` | Report real violations. Do not hide them to force progress. |
51
- | `should_continue` | Use `false` only when the entire task is complete. |
52
- | `execution_evidence` | Report changed files, test counts, met and remaining criteria, and progress when known. |
53
- | `discovered_constraints` | Add newly discovered guardrails. |
54
- | `objective_refinement` | Refine the objective when repository evidence changes its meaning. |
55
- | `wrong_assumptions` | Record assumptions disproved this round. |
56
- | `worker_results` | Record delegated subtask results and discoveries. |
78
+ The prompt renders stable IDs beside every constraint, criterion, and sub-goal:
79
+
80
+ - **Constraints:** `[c-a3f2b1c0] No plaintext passwords`
81
+ - **Criteria:** `[cr-b5a6c7d8] Unit test coverage ≥ 90%`
82
+ - **Sub-goals:** `[sg-f1e2d3c4] Add error handling to login`
83
+
84
+ **Prefer IDs over descriptions** in `constraint_violations`, `success_criteria_met`/`_remaining`, `completed_subtasks`, `blocked_subtasks`, `canceled_subtasks`, and `drift_clarification`. Exact ID matching eliminates ambiguity — Jaccard similarity is a fallback, not the primary path.
85
+
86
+ ## Backtrack — when the loop rewinds
57
87
 
58
- Do not embed an evaluation marker in ordinary output when the MCP client accepts
59
- the structured `evaluation` argument.
88
+ When progress stalls for multiple rounds, LoopForge triggers a **backtrack**:
89
+ the round counter rolls back to the last clean round, failed work is discarded,
90
+ and a diagnosis is injected into the prompt.
91
+
92
+ **When you receive a backtrack prompt:**
93
+
94
+ 1. **Restore your workspace first.** The prompt includes a "Workspace Restore
95
+ Required" section with exact `git checkout -- . && git clean -fd` commands.
96
+ Your working directory still contains changes from the failed rounds —
97
+ you MUST discard them before working.
98
+ 2. **Read the restored state.** The prompt reflects the clean round's vault
99
+ state. The state file shows the correct full picture.
100
+ 3. **Do NOT repeat the failed approach.** The diagnosis explains why the
101
+ previous path failed. Choose a different technique or decomposition.
102
+ 4. **Preserved discoveries** from skipped rounds are merged into the active
103
+ constraints — they remain valid even though the rounds were discarded.
104
+
105
+ If you skip the workspace restore and work on dirty files, the verification
106
+ gate will **reject** your next submission with a `backtrack_workspace_not_restored`
107
+ flag.
108
+
109
+ ## Drift — when you change direction
110
+
111
+ The verification gate compares your `next_action` from the previous round
112
+ against your actual `output_summary` this round. A mismatch triggers an
113
+ `intent_drift` flag.
114
+
115
+ **If you intentionally pivoted**, set `drift_clarification` with:
116
+ - A specific reason for the pivot.
117
+ - At least one concrete reference: a constraint ID (`c-XXXXXXXX`),
118
+ criterion ID (`cr-XXXXXXXX`), sub-goal ID (`sg-XXXXXXXX`), or changed
119
+ file path.
120
+
121
+ ✅ Good: `"Pivoted because constraint c-a3f2b1c0 was already satisfied by src/auth.ts. The CSS fix was higher priority."`
122
+
123
+ ❌ Rejected: `"I changed direction because I felt this approach was better."`
124
+
125
+ Three consecutive weak clarifications (no concrete references) will
126
+ **terminate the loop**.
60
127
 
61
128
  ## Interpret the result
62
129
 
@@ -66,22 +133,27 @@ If `enforcementAction` is `reject`, redo the same logical round. The round ID
66
133
  stays stable and the attempt number increases. Follow the retry requirements;
67
134
  the rejected attempt has not been committed.
68
135
 
136
+ If `enforcementAction` is `backtrack`, the loop has been rolled back. Restore
137
+ your workspace (see Backtrack section above), then work from the restored
138
+ prompt at the new round number.
139
+
69
140
  If `prompt` is null, inspect `stopReason`:
70
141
 
71
142
  | Reason | Meaning |
72
143
  | --- | --- |
73
- | `task_complete` | The complete objective was reported finished. |
74
- | `circuit_breaker` | Repeated failed rounds require a different approach or user input. |
144
+ | `completed` | The complete objective was reported finished. |
145
+ | `failed` | The agent gave up (`should_continue=false`, `success=false`). |
146
+ | `blocked` | Work cannot proceed under current constraints. Human input may be needed. |
75
147
  | `max_rounds` | The safety limit was reached. Summarize remaining work. |
76
148
  | `stalled` | Evaluation or execution did not produce a usable next state. |
77
- | `enforcement_terminated` | Repeated invalid claims or stalled progress terminated the loop. |
149
+ | `enforcement_terminated` | Repeated invalid claims, stalled progress, or weak clarifications terminated the loop. |
78
150
  | `paused` | The durable session remains available for resume. |
79
151
 
80
152
  ## Prompt levels
81
153
 
82
- - L0 is a same-round retry with the rejection reason and changed evidence.
83
- - L1 is the normal compact continuation view.
84
- - L2 is a full rehydration for the first round, a checkpoint, or a goal change.
154
+ - **L0** — Same-round retry with the rejection reason and changed evidence. ~3K chars.
155
+ - **L1** — Normal compact continuation. ~7K chars.
156
+ - **L2** — Full rehydration: first round, checkpoint, goal change, or recovery. In L2 pointer mode (default), the prompt shows a structured dashboard; the full state lives in `.loopforge/state/<loopId>-state.md`. Read it before acting.
85
157
 
86
158
  These levels control state density only. LoopForge does not choose a reasoning
87
159
  technique for you.
@@ -96,10 +168,9 @@ technique for you.
96
168
  - Use `loopforge_health` to inspect goal alignment and drift.
97
169
  - Use `loopforge_stop` only for an intentional terminal stop.
98
170
 
99
- The optional `.loopforge/state/<loopId>-state.md` file is a readable derived
100
- view. The typed JSON session and round documents are the recovery truth. If the
101
- state file exists, it can help you review the full state, but do not assume it is
102
- enabled.
171
+ The `.loopforge/state/<loopId>-state.md` file is the authoritative full-state
172
+ view in L2 pointer mode. Read it at the start of each L2 round — the prompt
173
+ dashboard is a summary, not the complete picture.
103
174
 
104
175
  ## Delegation
105
176
 
@@ -111,8 +182,12 @@ self-contained subtask and relevant hard constraints. Add the returned result to
111
182
 
112
183
  1. Execute the prompt instead of generating another prompt.
113
184
  2. Submit one honest structured evaluation after each attempt.
114
- 3. Treat required command evidence and verification errors as authoritative.
115
- 4. Keep one loop focused on one user objective.
116
- 5. Do not advance a paused or stopped session through another process.
117
- 6. Continue within the same Agent task when possible; LoopForge preserves state,
118
- but it does not create a background Agent.
185
+ 3. Use stable IDs (`c-`/`cr-`/`sg-XXXXXXXX`) for exact matching whenever possible.
186
+ 4. When backtrack occurs, restore the workspace before working.
187
+ 5. When you pivot from your `next_action`, explain with concrete references in `drift_clarification`.
188
+ 6. Treat required command evidence and verification errors as authoritative.
189
+ 7. Keep one loop focused on one user objective.
190
+ 8. Read the state file at the start of L2 rounds — it holds the complete picture.
191
+ 9. Do not advance a paused or stopped session through another process.
192
+ 10. Continue within the same Agent task when possible; LoopForge preserves state,
193
+ but it does not create a background Agent.
package/dist/interop.d.ts DELETED
@@ -1,35 +0,0 @@
1
- /** Dependency-free ecosystem checkpoint boundary.
2
- *
3
- * **@experimental** — This module is a lightweight stub (57 lines as of v2.0.0).
4
- * The checkpoint interface is stable but the integration surface (sinks, schema
5
- * versioning, external consumer contracts) has not been validated in production.
6
- * Use for prototyping; expect the envelope shape to evolve before v2.1.
7
- *
8
- * LangGraph checkpointers, workflow engines, databases, and agent SDKs can
9
- * consume this neutral envelope without LoopForge importing their packages.
10
- */
11
- import type { McpSession } from "./mcp/session.js";
12
- import type { RoundTransactionSnapshot } from "./round-transaction.js";
13
- import { getPolicyMetrics } from "./policy-metrics.js";
14
- export declare const COGNITIVE_CHECKPOINT_SCHEMA_VERSION: 1;
15
- export interface CognitiveStateCheckpoint {
16
- schemaVersion: typeof COGNITIVE_CHECKPOINT_SCHEMA_VERSION;
17
- checkpointId: string;
18
- loopId: string;
19
- sessionId: string;
20
- task: string;
21
- status: "running" | "stopped" | "stalled" | "paused";
22
- round: number;
23
- maxRounds: number;
24
- roundId?: string;
25
- prompt?: string | null;
26
- successTrajectory: boolean[];
27
- roundSnapshot?: RoundTransactionSnapshot;
28
- policyMetrics: ReturnType<typeof getPolicyMetrics>;
29
- updatedAt: string;
30
- }
31
- export interface CognitiveCheckpointSink {
32
- save(checkpoint: CognitiveStateCheckpoint): void | Promise<void>;
33
- }
34
- export declare function createCognitiveCheckpoint(session: McpSession, updatedAt?: string): CognitiveStateCheckpoint;
35
- //# sourceMappingURL=interop.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"interop.d.ts","sourceRoot":"","sources":["../src/interop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,eAAO,MAAM,mCAAmC,EAAG,CAAU,CAAC;AAE9D,MAAM,WAAW,wBAAwB;IACvC,aAAa,EAAE,OAAO,mCAAmC,CAAC;IAC1D,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,iBAAiB,EAAE,OAAO,EAAE,CAAC;IAC7B,aAAa,CAAC,EAAE,wBAAwB,CAAC;IACzC,aAAa,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;IACnD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,UAAU,EAAE,wBAAwB,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClE;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,UAAU,EACnB,SAAS,SAA2B,GACnC,wBAAwB,CAoB1B"}
package/dist/interop.js DELETED
@@ -1,34 +0,0 @@
1
- /** Dependency-free ecosystem checkpoint boundary.
2
- *
3
- * **@experimental** — This module is a lightweight stub (57 lines as of v2.0.0).
4
- * The checkpoint interface is stable but the integration surface (sinks, schema
5
- * versioning, external consumer contracts) has not been validated in production.
6
- * Use for prototyping; expect the envelope shape to evolve before v2.1.
7
- *
8
- * LangGraph checkpointers, workflow engines, databases, and agent SDKs can
9
- * consume this neutral envelope without LoopForge importing their packages.
10
- */
11
- import { getPolicyMetrics } from "./policy-metrics.js";
12
- export const COGNITIVE_CHECKPOINT_SCHEMA_VERSION = 1;
13
- export function createCognitiveCheckpoint(session, updatedAt = new Date().toISOString()) {
14
- const roundId = session.roundSnapshot?.roundId;
15
- return {
16
- schemaVersion: COGNITIVE_CHECKPOINT_SCHEMA_VERSION,
17
- checkpointId: roundId
18
- ? `${roundId}:session`
19
- : `loop:${session.loopId}:round:${session.currentRound}:session`,
20
- loopId: session.loopId,
21
- sessionId: session.sessionId,
22
- task: session.task,
23
- status: session.status,
24
- round: session.currentRound,
25
- maxRounds: session.maxRounds,
26
- roundId,
27
- prompt: session.currentPrompt,
28
- successTrajectory: [...session.successTrajectory],
29
- roundSnapshot: session.roundSnapshot,
30
- policyMetrics: getPolicyMetrics(session.loopId),
31
- updatedAt,
32
- };
33
- }
34
- //# sourceMappingURL=interop.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"interop.js","sourceRoot":"","sources":["../src/interop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAU,CAAC;AAuB9D,MAAM,UAAU,yBAAyB,CACvC,OAAmB,EACnB,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;IAEpC,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC;IAC/C,OAAO;QACL,aAAa,EAAE,mCAAmC;QAClD,YAAY,EAAE,OAAO;YACnB,CAAC,CAAC,GAAG,OAAO,UAAU;YACtB,CAAC,CAAC,QAAQ,OAAO,CAAC,MAAM,UAAU,OAAO,CAAC,YAAY,UAAU;QAClE,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,KAAK,EAAE,OAAO,CAAC,YAAY;QAC3B,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,OAAO;QACP,MAAM,EAAE,OAAO,CAAC,aAAa;QAC7B,iBAAiB,EAAE,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC;QACjD,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,aAAa,EAAE,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC;QAC/C,SAAS;KACV,CAAC;AACJ,CAAC"}
package/dist/run.d.ts DELETED
@@ -1,51 +0,0 @@
1
- /** Autonomous loop runner — Library API entry point (v2.6).
2
- *
3
- * Wires the engine, compiler, self-eval extraction, and feedback persistence
4
- * into a single call that the host controls end-to-end. The agent never gets
5
- * a chance to "skip" the loop — the host calls execute(), extracts the result,
6
- * and feeds it back to LoopForge in the same tick.
7
- */
8
- import { type SelfEvaluation } from "./protocol.js";
9
- import type { LoopStore } from "./loop-store.js";
10
- import type { ExternalContextProvider, LoopTerminalSink } from "./protocol.js";
11
- import type { PromptArtifact } from "./protocol.js";
12
- export interface RunInput {
13
- /** The task description — what the agent should accomplish. */
14
- task: string;
15
- /** Hard constraints that must not be violated across all rounds. */
16
- constraintsFromPlan?: string[];
17
- /** Maximum rounds before auto-stop. Falls back to policy default when omitted. */
18
- maxRounds?: number;
19
- /** The agent executor. Receives the compiled prompt and an AbortSignal.
20
- * Must return the agent's raw output (text). The runner extracts the
21
- * structured self-evaluation from it. */
22
- execute: (prompt: string, context: {
23
- signal: AbortSignal;
24
- }) => Promise<string>;
25
- /** Optional external context injected before each compile. */
26
- contextProvider?: ExternalContextProvider;
27
- /** Optional terminal event sinks (telemetry, logging, etc.). */
28
- terminalSinks?: LoopTerminalSink[];
29
- /** Optional typed store — falls back to .loopforge/ when omitted. */
30
- store?: LoopStore;
31
- /** Optional abort signal for cancelling the entire loop. */
32
- signal?: AbortSignal;
33
- }
34
- export interface RunResult {
35
- /** Whether the loop completed successfully (should_continue=false + success=true). */
36
- success: boolean;
37
- /** Why the loop stopped. */
38
- stopReason: string;
39
- /** Number of rounds completed. */
40
- roundsCompleted: number;
41
- /** True/false for each committed round. */
42
- successTrajectory: boolean[];
43
- /** The loop's stable identity — can be used to replay later. */
44
- loopId: string;
45
- /** The last self-evaluation submitted by the agent. */
46
- lastEvaluation?: SelfEvaluation;
47
- /** Prompt artifacts produced across the loop (for audit). */
48
- artifacts: PromptArtifact[];
49
- }
50
- export declare function run(input: RunInput): Promise<RunResult>;
51
- //# sourceMappingURL=run.d.ts.map
package/dist/run.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAA8B,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAEhF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,uBAAuB,EAAqB,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAElG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,MAAM,WAAW,QAAQ;IACvB,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;8CAE0C;IAC1C,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,MAAM,EAAE,WAAW,CAAA;KAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/E,8DAA8D;IAC9D,eAAe,CAAC,EAAE,uBAAuB,CAAC;IAC1C,gEAAgE;IAChE,aAAa,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACnC,qEAAqE;IACrE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,SAAS;IACxB,sFAAsF;IACtF,OAAO,EAAE,OAAO,CAAC;IACjB,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,eAAe,EAAE,MAAM,CAAC;IACxB,2CAA2C;IAC3C,iBAAiB,EAAE,OAAO,EAAE,CAAC;IAC7B,gEAAgE;IAChE,MAAM,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,6DAA6D;IAC7D,SAAS,EAAE,cAAc,EAAE,CAAC;CAC7B;AAkCD,wBAAsB,GAAG,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,CA6J7D"}
package/dist/run.js DELETED
@@ -1,200 +0,0 @@
1
- /** Autonomous loop runner — Library API entry point (v2.6).
2
- *
3
- * Wires the engine, compiler, self-eval extraction, and feedback persistence
4
- * into a single call that the host controls end-to-end. The agent never gets
5
- * a chance to "skip" the loop — the host calls execute(), extracts the result,
6
- * and feeds it back to LoopForge in the same tick.
7
- */
8
- import { LoopForgeEngine, extractSelfEvaluation } from "./engine.js";
9
- import { Mode } from "./protocol.js";
10
- import { FileLoopStore } from "./loop-store.js";
11
- import { logEvent } from "./observability.js";
12
- function makeRunResult(loopId, lastResponse, roundsCompleted, successTrajectory, lastEval, artifacts = []) {
13
- if (!lastResponse?.response) {
14
- return {
15
- success: false,
16
- stopReason: "executor_failure",
17
- roundsCompleted,
18
- successTrajectory,
19
- loopId,
20
- lastEvaluation: lastEval,
21
- artifacts,
22
- };
23
- }
24
- return {
25
- success: lastEval?.success === true && lastEval?.should_continue === false,
26
- stopReason: lastEval?.should_continue === false
27
- ? (lastEval?.success ? "completed" : "failed")
28
- : "max_rounds",
29
- roundsCompleted,
30
- successTrajectory,
31
- loopId,
32
- lastEvaluation: lastEval,
33
- artifacts,
34
- };
35
- }
36
- export async function run(input) {
37
- const store = input.store ?? new FileLoopStore();
38
- const engine = new LoopForgeEngine(store);
39
- const loopId = `run-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
40
- const maxRounds = input.maxRounds ?? 20;
41
- const artifacts = [];
42
- let round = 1;
43
- let lastEval;
44
- const successTrajectory = [];
45
- const task = input.task.trim();
46
- if (!task)
47
- throw new Error("run: task must be non-empty");
48
- while (round <= maxRounds) {
49
- // Check for external abort
50
- if (input.signal?.aborted) {
51
- return makeRunResult(loopId, null, round - 1, successTrajectory, lastEval, artifacts);
52
- }
53
- // ── 1. Compile prompt ──────────────────────────────────────────────
54
- const request = {
55
- task,
56
- mode: Mode.LOOP_COMPILE,
57
- feedback: null,
58
- skill_name: null,
59
- task_id: null,
60
- loop_id: loopId,
61
- round,
62
- max_rounds: maxRounds,
63
- constraints_from_plan: input.constraintsFromPlan ?? [],
64
- goal_id: loopId,
65
- domain: "",
66
- };
67
- // External context injection
68
- if (input.contextProvider) {
69
- try {
70
- const ctx = await input.contextProvider({
71
- loopId,
72
- round,
73
- task,
74
- domain: "",
75
- lastEvaluation: lastEval,
76
- });
77
- if (ctx?.trim())
78
- request.external_context = ctx.trim();
79
- }
80
- catch {
81
- logEvent("context_provider_error", { loopId, round });
82
- }
83
- }
84
- // Forward last round result
85
- if (lastEval) {
86
- request.last_round_result = {
87
- round: round - 1,
88
- success: lastEval.success,
89
- output_summary: lastEval.output_summary,
90
- constraint_violations: lastEval.constraint_violations,
91
- manual_fixes_needed: "",
92
- discovered_constraints: lastEval.discovered_constraints ?? [],
93
- objective_refinement: lastEval.objective_refinement ?? "",
94
- emerged_subtasks: lastEval.emerged_subtasks ?? [],
95
- execution_evidence: lastEval.execution_evidence,
96
- retracted_constraints: lastEval.retracted_constraints ?? [],
97
- revised_success_criteria: lastEval.revised_success_criteria ?? [],
98
- wrong_assumptions: lastEval.wrong_assumptions ?? [],
99
- worker_results: lastEval.worker_results ?? [],
100
- compression_checkpoint: lastEval.compression_checkpoint ?? false,
101
- checkpoint_label: lastEval.checkpoint_label ?? "",
102
- next_action: lastEval.next_action,
103
- completed_subtasks: lastEval.completed_subtasks ?? [],
104
- blocked_subtasks: lastEval.blocked_subtasks ?? [],
105
- canceled_subtasks: lastEval.canceled_subtasks ?? [],
106
- };
107
- }
108
- let response;
109
- try {
110
- response = engine.invokeLoopCompile(request);
111
- }
112
- catch (exc) {
113
- logEvent("compile_error", { loopId, round, error: String(exc) });
114
- return makeRunResult(loopId, null, round - 1, successTrajectory, lastEval, artifacts);
115
- }
116
- if (response.status !== "ok" || !response.response?.prompt) {
117
- return makeRunResult(loopId, response, round - 1, successTrajectory, lastEval, artifacts);
118
- }
119
- const artifact = response.response.prompt_artifact;
120
- if (artifact)
121
- artifacts.push(artifact);
122
- // ── 2. Execute agent ───────────────────────────────────────────────
123
- let output;
124
- try {
125
- output = await input.execute(response.response.prompt, {
126
- signal: input.signal ?? new AbortController().signal,
127
- });
128
- }
129
- catch (exc) {
130
- logEvent("execute_error", { loopId, round, error: String(exc) });
131
- // Persist terminal state before returning
132
- if (lastEval)
133
- engine.autoFeedback(lastEval, loopId, round - 1, task);
134
- void notifyTerminal(input.terminalSinks, {
135
- loopId, task, success: false, stopReason: "executor_failure",
136
- roundsCompleted: round - 1, successTrajectory, lastEvaluation: lastEval,
137
- });
138
- return {
139
- success: false,
140
- stopReason: "executor_failure",
141
- roundsCompleted: round - 1,
142
- successTrajectory,
143
- loopId,
144
- lastEvaluation: lastEval,
145
- artifacts,
146
- };
147
- }
148
- // ── 3. Extract self-evaluation ─────────────────────────────────────
149
- const selfEval = extractSelfEvaluation(output);
150
- if (!selfEval) {
151
- logEvent("extraction_failed", { loopId, round });
152
- return makeRunResult(loopId, response, round - 1, successTrajectory, lastEval, artifacts);
153
- }
154
- lastEval = selfEval;
155
- successTrajectory.push(selfEval.success);
156
- // ── 4. Persist feedback ────────────────────────────────────────────
157
- engine.autoFeedback(selfEval, loopId, round, task);
158
- // ── 5. Check stop ──────────────────────────────────────────────────
159
- if (!selfEval.should_continue) {
160
- const result = makeRunResult(loopId, response, round, successTrajectory, lastEval, artifacts);
161
- void notifyTerminal(input.terminalSinks, {
162
- loopId, task,
163
- success: result.success,
164
- stopReason: result.stopReason,
165
- roundsCompleted: round,
166
- successTrajectory,
167
- lastEvaluation: lastEval,
168
- });
169
- return result;
170
- }
171
- round++;
172
- }
173
- const result = makeRunResult(loopId, null, round - 1, successTrajectory, lastEval, artifacts);
174
- result.stopReason = "max_rounds";
175
- void notifyTerminal(input.terminalSinks, {
176
- loopId, task,
177
- success: false,
178
- stopReason: "max_rounds",
179
- roundsCompleted: round - 1,
180
- successTrajectory,
181
- lastEvaluation: lastEval,
182
- });
183
- return result;
184
- }
185
- function notifyTerminal(sinks, event) {
186
- if (!sinks?.length)
187
- return;
188
- for (const sink of sinks) {
189
- try {
190
- const pending = sink(event);
191
- if (pending && typeof pending.then === "function") {
192
- void pending.catch(() => undefined);
193
- }
194
- }
195
- catch {
196
- // Sink failures must never fail the loop.
197
- }
198
- }
199
- }
200
- //# sourceMappingURL=run.js.map
package/dist/run.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,IA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