loopforge 1.15.1 → 2.0.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.
- package/README.md +172 -95
- package/dist/backends/interface.d.ts +3 -9
- package/dist/backends/interface.d.ts.map +1 -1
- package/dist/backends/interface.js +1 -5
- package/dist/backends/interface.js.map +1 -1
- package/dist/canonical-state.d.ts +53 -0
- package/dist/canonical-state.d.ts.map +1 -0
- package/dist/canonical-state.js +161 -0
- package/dist/canonical-state.js.map +1 -0
- package/dist/cli.d.ts +4 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +227 -0
- package/dist/cli.js.map +1 -0
- package/dist/enforcement-gate.d.ts.map +1 -1
- package/dist/enforcement-gate.js +28 -10
- package/dist/enforcement-gate.js.map +1 -1
- package/dist/engine.d.ts +7 -4
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +78 -138
- package/dist/engine.js.map +1 -1
- package/dist/evidence-provider.d.ts +113 -0
- package/dist/evidence-provider.d.ts.map +1 -0
- package/dist/evidence-provider.js +419 -0
- package/dist/evidence-provider.js.map +1 -0
- package/dist/index.d.ts +18 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -9
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +15 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +49 -0
- package/dist/init.js.map +1 -0
- package/dist/interop.d.ts +30 -0
- package/dist/interop.d.ts.map +1 -0
- package/dist/interop.js +29 -0
- package/dist/interop.js.map +1 -0
- package/dist/loop-compiler.d.ts +14 -64
- package/dist/loop-compiler.d.ts.map +1 -1
- package/dist/loop-compiler.js +303 -2206
- package/dist/loop-compiler.js.map +1 -1
- package/dist/loop-store.d.ts +82 -0
- package/dist/loop-store.d.ts.map +1 -0
- package/dist/loop-store.js +332 -0
- package/dist/loop-store.js.map +1 -0
- package/dist/mcp/server.d.ts +9 -6
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +109 -73
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/session.d.ts +75 -19
- package/dist/mcp/session.d.ts.map +1 -1
- package/dist/mcp/session.js +707 -361
- package/dist/mcp/session.js.map +1 -1
- package/dist/mcp/tools.d.ts +18 -268
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +225 -12
- package/dist/mcp/tools.js.map +1 -1
- package/dist/observability.d.ts +36 -16
- package/dist/observability.d.ts.map +1 -1
- package/dist/observability.js +82 -23
- package/dist/observability.js.map +1 -1
- package/dist/policy-metrics.d.ts +46 -0
- package/dist/policy-metrics.d.ts.map +1 -0
- package/dist/policy-metrics.js +146 -0
- package/dist/policy-metrics.js.map +1 -0
- package/dist/policy.d.ts +53 -140
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +119 -184
- package/dist/policy.js.map +1 -1
- package/dist/prompt-assembler.d.ts +30 -0
- package/dist/prompt-assembler.d.ts.map +1 -0
- package/dist/prompt-assembler.js +257 -0
- package/dist/prompt-assembler.js.map +1 -0
- package/dist/prompt-policy.d.ts +29 -0
- package/dist/prompt-policy.d.ts.map +1 -0
- package/dist/prompt-policy.js +51 -0
- package/dist/prompt-policy.js.map +1 -0
- package/dist/protocol.d.ts +88 -93
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +23 -39
- package/dist/protocol.js.map +1 -1
- package/dist/replay.d.ts.map +1 -1
- package/dist/replay.js +1 -27
- package/dist/replay.js.map +1 -1
- package/dist/round-coordinator.d.ts +90 -0
- package/dist/round-coordinator.d.ts.map +1 -0
- package/dist/round-coordinator.js +186 -0
- package/dist/round-coordinator.js.map +1 -0
- package/dist/round-driver.d.ts +53 -0
- package/dist/round-driver.d.ts.map +1 -0
- package/dist/round-driver.js +101 -0
- package/dist/round-driver.js.map +1 -0
- package/dist/round-transaction.d.ts +70 -0
- package/dist/round-transaction.d.ts.map +1 -0
- package/dist/round-transaction.js +290 -0
- package/dist/round-transaction.js.map +1 -0
- package/dist/runtime.d.ts +33 -19
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +355 -336
- package/dist/runtime.js.map +1 -1
- package/dist/storage.d.ts +38 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +201 -0
- package/dist/storage.js.map +1 -0
- package/dist/verification-gate.d.ts +33 -7
- package/dist/verification-gate.d.ts.map +1 -1
- package/dist/verification-gate.js +195 -7
- package/dist/verification-gate.js.map +1 -1
- package/loop_policy.json +22 -48
- package/package.json +13 -10
- package/skills/perception/SKILL.md +80 -267
- package/dist/backends/fs.d.ts +0 -36
- package/dist/backends/fs.d.ts.map +0 -1
- package/dist/backends/fs.js +0 -362
- package/dist/backends/fs.js.map +0 -1
- package/dist/builder.d.ts +0 -19
- package/dist/builder.d.ts.map +0 -1
- package/dist/builder.js +0 -215
- package/dist/builder.js.map +0 -1
- package/dist/mcp-server.d.ts +0 -12
- package/dist/mcp-server.d.ts.map +0 -1
- package/dist/mcp-server.js +0 -14
- package/dist/mcp-server.js.map +0 -1
- package/dist/memory-bridge.d.ts +0 -47
- package/dist/memory-bridge.d.ts.map +0 -1
- package/dist/memory-bridge.js +0 -290
- package/dist/memory-bridge.js.map +0 -1
- package/dist/tests/_helpers.d.ts +0 -25
- package/dist/tests/_helpers.d.ts.map +0 -1
- package/dist/tests/_helpers.js +0 -47
- package/dist/tests/_helpers.js.map +0 -1
- package/dist/tests/builder.test.d.ts +0 -2
- package/dist/tests/builder.test.d.ts.map +0 -1
- package/dist/tests/builder.test.js +0 -112
- package/dist/tests/builder.test.js.map +0 -1
- package/dist/tests/enforcement-gate.test.d.ts +0 -2
- package/dist/tests/enforcement-gate.test.d.ts.map +0 -1
- package/dist/tests/enforcement-gate.test.js +0 -328
- package/dist/tests/enforcement-gate.test.js.map +0 -1
- package/dist/tests/engine.test.d.ts +0 -2
- package/dist/tests/engine.test.d.ts.map +0 -1
- package/dist/tests/engine.test.js +0 -375
- package/dist/tests/engine.test.js.map +0 -1
- package/dist/tests/generate-schema.test.d.ts +0 -8
- package/dist/tests/generate-schema.test.d.ts.map +0 -1
- package/dist/tests/generate-schema.test.js +0 -199
- package/dist/tests/generate-schema.test.js.map +0 -1
- package/dist/tests/loop-compiler.test.d.ts +0 -2
- package/dist/tests/loop-compiler.test.d.ts.map +0 -1
- package/dist/tests/loop-compiler.test.js +0 -1059
- package/dist/tests/loop-compiler.test.js.map +0 -1
- package/dist/tests/mcp.test.d.ts +0 -7
- package/dist/tests/mcp.test.d.ts.map +0 -1
- package/dist/tests/mcp.test.js +0 -505
- package/dist/tests/mcp.test.js.map +0 -1
- package/dist/tests/memory-bridge.test.d.ts +0 -8
- package/dist/tests/memory-bridge.test.d.ts.map +0 -1
- package/dist/tests/memory-bridge.test.js +0 -383
- package/dist/tests/memory-bridge.test.js.map +0 -1
- package/dist/tests/policy.test.d.ts +0 -2
- package/dist/tests/policy.test.d.ts.map +0 -1
- package/dist/tests/policy.test.js +0 -49
- package/dist/tests/policy.test.js.map +0 -1
- package/dist/tests/protocol.test.d.ts +0 -2
- package/dist/tests/protocol.test.d.ts.map +0 -1
- package/dist/tests/protocol.test.js +0 -73
- package/dist/tests/protocol.test.js.map +0 -1
- package/dist/tests/replay.test.d.ts +0 -2
- package/dist/tests/replay.test.d.ts.map +0 -1
- package/dist/tests/replay.test.js +0 -222
- package/dist/tests/replay.test.js.map +0 -1
- package/dist/tests/runtime.test.d.ts +0 -7
- package/dist/tests/runtime.test.d.ts.map +0 -1
- package/dist/tests/runtime.test.js +0 -337
- package/dist/tests/runtime.test.js.map +0 -1
- package/dist/tests/verification-gate.test.d.ts +0 -2
- package/dist/tests/verification-gate.test.d.ts.map +0 -1
- package/dist/tests/verification-gate.test.js +0 -407
- package/dist/tests/verification-gate.test.js.map +0 -1
- package/skills/prompt-techniques/SKILL.md +0 -52
- package/skills/prompt-techniques/references/chain-of-thought.md +0 -207
- package/skills/prompt-techniques/references/few-shot.md +0 -174
- package/skills/prompt-techniques/references/least-to-most.md +0 -182
- package/skills/prompt-techniques/references/step-back.md +0 -160
- package/skills/prompt-techniques/references/tree-of-thought.md +0 -191
- package/skills/prompt-techniques/references/zero-shot.md +0 -97
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/** Single-pass prompt renderer for canonical LoopForge state.
|
|
2
|
+
*
|
|
3
|
+
* L0/L1/L2 control state density only. Reasoning strategy belongs to the
|
|
4
|
+
* external Agent. Mandatory task, hard-constraint, and verification sections
|
|
5
|
+
* are never truncated; budgets are soft and overflow is recorded.
|
|
6
|
+
*/
|
|
7
|
+
import { createHash } from "node:crypto";
|
|
8
|
+
import { hashCanonicalState } from "./canonical-state.js";
|
|
9
|
+
export const PROMPT_ARTIFACT_SCHEMA_VERSION = 1;
|
|
10
|
+
export const BASE_PROMPT_VERSION = "2.0.0";
|
|
11
|
+
export const DEFAULT_PROMPT_BUDGETS = {
|
|
12
|
+
l0: 3000,
|
|
13
|
+
l1: 7000,
|
|
14
|
+
l2: 18000,
|
|
15
|
+
};
|
|
16
|
+
function section(title, body) {
|
|
17
|
+
return body.trim() ? `### ${title}\n${body.trim()}\n\n` : "";
|
|
18
|
+
}
|
|
19
|
+
function bullets(values, prefix = "- ") {
|
|
20
|
+
return values.map((value) => `${prefix}${value}`).join("\n");
|
|
21
|
+
}
|
|
22
|
+
function verificationText(state) {
|
|
23
|
+
const lines = state.verificationFlags.map((flag) => {
|
|
24
|
+
const icon = flag.severity === "error"
|
|
25
|
+
? "🚫"
|
|
26
|
+
: flag.severity === "warn" ? "⚠️" : "ℹ️";
|
|
27
|
+
return `- ${icon} [${flag.check}] ${flag.detail}`;
|
|
28
|
+
});
|
|
29
|
+
if (state.verificationFlags.some((flag) => flag.severity === "error")) {
|
|
30
|
+
lines.push("- Gate Verdict: CONTRADICTED — resolve every error before claiming success.");
|
|
31
|
+
}
|
|
32
|
+
return lines.join("\n");
|
|
33
|
+
}
|
|
34
|
+
function activeNonHardConstraints(state) {
|
|
35
|
+
const hard = new Set(state.hardConstraints);
|
|
36
|
+
return state.activeConstraints.filter((value) => !hard.has(value));
|
|
37
|
+
}
|
|
38
|
+
function commonMandatorySections(state) {
|
|
39
|
+
const sections = [
|
|
40
|
+
{
|
|
41
|
+
id: "objective",
|
|
42
|
+
text: section("Objective", state.objective),
|
|
43
|
+
mandatory: true,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: "current_task",
|
|
47
|
+
text: section("Current Task", state.currentTask),
|
|
48
|
+
mandatory: true,
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
if (state.hardConstraints.length > 0) {
|
|
52
|
+
sections.push({
|
|
53
|
+
id: "hard_constraints",
|
|
54
|
+
text: section("Active Hard Constraints", bullets(state.hardConstraints)),
|
|
55
|
+
mandatory: true,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (state.verificationFlags.length > 0) {
|
|
59
|
+
sections.push({
|
|
60
|
+
id: "verification",
|
|
61
|
+
text: section("Verification Gate", verificationText(state)),
|
|
62
|
+
mandatory: true,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return sections;
|
|
66
|
+
}
|
|
67
|
+
function l0Sections(state) {
|
|
68
|
+
const retryRequirements = [
|
|
69
|
+
...state.blockers,
|
|
70
|
+
...state.verificationFlags.map((flag) => flag.detail),
|
|
71
|
+
];
|
|
72
|
+
const sections = commonMandatorySections(state);
|
|
73
|
+
if (retryRequirements.length > 0) {
|
|
74
|
+
sections.push({
|
|
75
|
+
id: "retry_requirements",
|
|
76
|
+
text: section("Retry Requirements", bullets(retryRequirements)),
|
|
77
|
+
mandatory: true,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (state.changesSinceLastRound.length > 0) {
|
|
81
|
+
sections.push({
|
|
82
|
+
id: "changes",
|
|
83
|
+
text: section("New Evidence / Changes", bullets(state.changesSinceLastRound)),
|
|
84
|
+
mandatory: false,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return sections;
|
|
88
|
+
}
|
|
89
|
+
function l1Sections(state) {
|
|
90
|
+
const sections = commonMandatorySections(state);
|
|
91
|
+
const active = activeNonHardConstraints(state);
|
|
92
|
+
if (state.changesSinceLastRound.length > 0) {
|
|
93
|
+
sections.push({
|
|
94
|
+
id: "changes",
|
|
95
|
+
text: section("Changes Since Last Round", bullets(state.changesSinceLastRound)),
|
|
96
|
+
mandatory: false,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (active.length > 0) {
|
|
100
|
+
sections.push({
|
|
101
|
+
id: "active_constraints",
|
|
102
|
+
text: section("Active Constraints / Success Criteria", bullets(active)),
|
|
103
|
+
mandatory: false,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
if (state.remainingCriteria.length > 0) {
|
|
107
|
+
sections.push({
|
|
108
|
+
id: "remaining",
|
|
109
|
+
text: section("Remaining", bullets(state.remainingCriteria)),
|
|
110
|
+
mandatory: false,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
if (state.blockers.length > 0) {
|
|
114
|
+
sections.push({
|
|
115
|
+
id: "blockers",
|
|
116
|
+
text: section("Blockers", bullets(state.blockers)),
|
|
117
|
+
mandatory: false,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
if (state.discoveries.length > 0) {
|
|
121
|
+
sections.push({
|
|
122
|
+
id: "discoveries",
|
|
123
|
+
text: section("New Discoveries", bullets(state.discoveries)),
|
|
124
|
+
mandatory: false,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
if (state.nextAction) {
|
|
128
|
+
sections.push({
|
|
129
|
+
id: "next_action",
|
|
130
|
+
text: section("Next Action", state.nextAction),
|
|
131
|
+
mandatory: false,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
return sections;
|
|
135
|
+
}
|
|
136
|
+
function l2Sections(state, fullStateMarkdown) {
|
|
137
|
+
const sections = commonMandatorySections(state);
|
|
138
|
+
const fullState = fullStateMarkdown?.trim();
|
|
139
|
+
if (fullState) {
|
|
140
|
+
sections.push({
|
|
141
|
+
id: "full_state",
|
|
142
|
+
text: section("Full Rehydrated State", fullState),
|
|
143
|
+
mandatory: false,
|
|
144
|
+
});
|
|
145
|
+
return sections;
|
|
146
|
+
}
|
|
147
|
+
const groups = [
|
|
148
|
+
["success_criteria", "Success Criteria", state.successCriteria],
|
|
149
|
+
["active_constraints", "Active Constraints", activeNonHardConstraints(state)],
|
|
150
|
+
["changes", "Changes Since Last Round", state.changesSinceLastRound],
|
|
151
|
+
["remaining", "Remaining", state.remainingCriteria],
|
|
152
|
+
["blockers", "Blockers", state.blockers],
|
|
153
|
+
["discoveries", "Discoveries", state.discoveries],
|
|
154
|
+
["rolling_outcomes", "Cross-Round Outcomes", state.rollingOutcomes],
|
|
155
|
+
["recurring_issues", "Recurring Issues", state.recurringIssues],
|
|
156
|
+
["failed_patterns", "Failed Patterns", state.failedPatterns],
|
|
157
|
+
];
|
|
158
|
+
for (const [id, title, values] of groups) {
|
|
159
|
+
if (values.length > 0) {
|
|
160
|
+
sections.push({ id, text: section(title, bullets(values)), mandatory: false });
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (state.nextAction) {
|
|
164
|
+
sections.push({
|
|
165
|
+
id: "next_action",
|
|
166
|
+
text: section("Next Action", state.nextAction),
|
|
167
|
+
mandatory: false,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
if (state.externalContext) {
|
|
171
|
+
sections.push({
|
|
172
|
+
id: "external_context",
|
|
173
|
+
text: section("External Context", state.externalContext),
|
|
174
|
+
mandatory: false,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
return sections;
|
|
178
|
+
}
|
|
179
|
+
function selectSections(input) {
|
|
180
|
+
if (input.mode === "full") {
|
|
181
|
+
return l2Sections(input.state, input.fullStateMarkdown);
|
|
182
|
+
}
|
|
183
|
+
if (input.level === "l0")
|
|
184
|
+
return l0Sections(input.state);
|
|
185
|
+
if (input.level === "l1")
|
|
186
|
+
return l1Sections(input.state);
|
|
187
|
+
return l2Sections(input.state, input.fullStateMarkdown);
|
|
188
|
+
}
|
|
189
|
+
function renderWithinBudget(sections, fixedText, budget) {
|
|
190
|
+
const mandatory = sections.filter((item) => item.mandatory);
|
|
191
|
+
const optional = sections.filter((item) => !item.mandatory);
|
|
192
|
+
let rendered = fixedText + mandatory.map((item) => item.text).join("");
|
|
193
|
+
const included = mandatory.filter((item) => item.text).map((item) => item.id);
|
|
194
|
+
for (const item of optional) {
|
|
195
|
+
if (!item.text)
|
|
196
|
+
continue;
|
|
197
|
+
if (rendered.length + item.text.length <= budget) {
|
|
198
|
+
rendered += item.text;
|
|
199
|
+
included.push(item.id);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return { rendered, included };
|
|
203
|
+
}
|
|
204
|
+
export function assemblePromptArtifact(input) {
|
|
205
|
+
const mode = input.mode ?? "adaptive";
|
|
206
|
+
const budgets = { ...DEFAULT_PROMPT_BUDGETS, ...input.budgets };
|
|
207
|
+
const budget = budgets[input.level];
|
|
208
|
+
const stateHash = hashCanonicalState(input.state);
|
|
209
|
+
const attempt = Math.max(1, input.attempt ?? 1);
|
|
210
|
+
const header = [
|
|
211
|
+
`## LoopForge Round ${input.state.round}`,
|
|
212
|
+
`State: ${stateHash.slice(0, 12)} | Level: ${input.level.toUpperCase()} | Attempt: ${attempt}`,
|
|
213
|
+
"",
|
|
214
|
+
].join("\n");
|
|
215
|
+
const sections = selectSections(input);
|
|
216
|
+
const pointer = input.state.stateFilePath
|
|
217
|
+
? section("Full State", input.state.stateFilePath)
|
|
218
|
+
: "";
|
|
219
|
+
const evaluation = input.selfEvaluationBlock.trim()
|
|
220
|
+
? `${input.selfEvaluationBlock.trim()}\n`
|
|
221
|
+
: "";
|
|
222
|
+
const footer = [
|
|
223
|
+
pointer,
|
|
224
|
+
"Execute the current task now. Do not generate another prompt.",
|
|
225
|
+
"When this attempt is finished, submit the structured LoopForge evaluation.",
|
|
226
|
+
"",
|
|
227
|
+
evaluation,
|
|
228
|
+
].join("\n");
|
|
229
|
+
const fixedText = header;
|
|
230
|
+
const selected = mode === "pointer"
|
|
231
|
+
? renderWithinBudget(sections.filter((item) => item.mandatory), fixedText, budget)
|
|
232
|
+
: renderWithinBudget(sections, fixedText, budget - footer.length);
|
|
233
|
+
const renderedPrompt = selected.rendered + footer;
|
|
234
|
+
const includedSections = [
|
|
235
|
+
...selected.included,
|
|
236
|
+
...(pointer ? ["state_pointer"] : []),
|
|
237
|
+
...(evaluation ? ["self_evaluation"] : []),
|
|
238
|
+
];
|
|
239
|
+
const promptHash = createHash("sha256").update(renderedPrompt).digest("hex");
|
|
240
|
+
return {
|
|
241
|
+
schemaVersion: PROMPT_ARTIFACT_SCHEMA_VERSION,
|
|
242
|
+
roundId: `loop:${input.state.loopId}:round:${input.state.round}`,
|
|
243
|
+
attempt,
|
|
244
|
+
level: input.level,
|
|
245
|
+
levelReasons: [...input.reasons],
|
|
246
|
+
renderedPrompt,
|
|
247
|
+
promptHash,
|
|
248
|
+
stateHash,
|
|
249
|
+
basePromptVersion: BASE_PROMPT_VERSION,
|
|
250
|
+
includedSections,
|
|
251
|
+
budgetChars: budget,
|
|
252
|
+
charCount: renderedPrompt.length,
|
|
253
|
+
budgetExceeded: renderedPrompt.length > budget,
|
|
254
|
+
generatedAt: Date.now(),
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
//# sourceMappingURL=prompt-assembler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-assembler.js","sourceRoot":"","sources":["../src/prompt-assembler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAO1D,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAU,CAAC;AACzD,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAU3C,MAAM,CAAC,MAAM,sBAAsB,GAAkB;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GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAE7E,OAAO;QACL,aAAa,EAAE,8BAA8B;QAC7C,OAAO,EAAE,QAAQ,KAAK,CAAC,KAAK,CAAC,MAAM,UAAU,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE;QAChE,OAAO;QACP,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,YAAY,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC;QAChC,cAAc;QACd,UAAU;QACV,SAAS;QACT,iBAAiB,EAAE,mBAAmB;QACtC,gBAAgB;QAChB,WAAW,EAAE,MAAM;QACnB,SAAS,EAAE,cAAc,CAAC,MAAM;QAChC,cAAc,EAAE,cAAc,CAAC,MAAM,GAAG,MAAM;QAC9C,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE;KACxB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Pure L0/L1/L2 prompt-view policy.
|
|
2
|
+
*
|
|
3
|
+
* Levels describe how much canonical state is rendered. They do not select a
|
|
4
|
+
* reasoning technique; the external Agent owns its reasoning strategy.
|
|
5
|
+
*/
|
|
6
|
+
export type PromptLevel = "l0" | "l1" | "l2";
|
|
7
|
+
export type PromptLevelReason = "explicit_override" | "first_round" | "plan_boundary" | "checkpoint_boundary" | "goal_changed" | "missing_previous_state" | "verification_contradicted" | "retry_delta" | "rejection_rehydrate" | "recovery_boundary" | "state_drift" | "periodic_refresh" | "state_capsule";
|
|
8
|
+
export interface PromptLevelInput {
|
|
9
|
+
round: number;
|
|
10
|
+
attempt?: number;
|
|
11
|
+
forceLevel?: string;
|
|
12
|
+
hasPlanSource: boolean;
|
|
13
|
+
checkpointBoundary: boolean;
|
|
14
|
+
goalChanged: boolean;
|
|
15
|
+
previousStateMissing: boolean;
|
|
16
|
+
previousFailedWithoutNewInformation: boolean;
|
|
17
|
+
verificationContradicted: boolean;
|
|
18
|
+
consecutiveRejections?: number;
|
|
19
|
+
recoveryBoundary?: boolean;
|
|
20
|
+
stateDrift?: boolean;
|
|
21
|
+
fullRefreshInterval: number;
|
|
22
|
+
lastFullRound?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface PromptLevelDecision {
|
|
25
|
+
level: PromptLevel;
|
|
26
|
+
reasons: PromptLevelReason[];
|
|
27
|
+
}
|
|
28
|
+
export declare function decidePromptLevel(input: PromptLevelInput): PromptLevelDecision;
|
|
29
|
+
//# sourceMappingURL=prompt-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-policy.d.ts","sourceRoot":"","sources":["../src/prompt-policy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE7C,MAAM,MAAM,iBAAiB,GACzB,mBAAmB,GACnB,aAAa,GACb,eAAe,GACf,qBAAqB,GACrB,cAAc,GACd,wBAAwB,GACxB,2BAA2B,GAC3B,aAAa,GACb,qBAAqB,GACrB,mBAAmB,GACnB,aAAa,GACb,kBAAkB,GAClB,eAAe,CAAC;AAEpB,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,WAAW,EAAE,OAAO,CAAC;IACrB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,mCAAmC,EAAE,OAAO,CAAC;IAC7C,wBAAwB,EAAE,OAAO,CAAC;IAClC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,WAAW,CAAC;IACnB,OAAO,EAAE,iBAAiB,EAAE,CAAC;CAC9B;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG,mBAAmB,CA8C9E"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** Pure L0/L1/L2 prompt-view policy.
|
|
2
|
+
*
|
|
3
|
+
* Levels describe how much canonical state is rendered. They do not select a
|
|
4
|
+
* reasoning technique; the external Agent owns its reasoning strategy.
|
|
5
|
+
*/
|
|
6
|
+
export function decidePromptLevel(input) {
|
|
7
|
+
if ((input.consecutiveRejections ?? 0) >= 2) {
|
|
8
|
+
return { level: "l2", reasons: ["rejection_rehydrate"] };
|
|
9
|
+
}
|
|
10
|
+
if (input.recoveryBoundary) {
|
|
11
|
+
return { level: "l2", reasons: ["recovery_boundary"] };
|
|
12
|
+
}
|
|
13
|
+
if (input.stateDrift)
|
|
14
|
+
return { level: "l2", reasons: ["state_drift"] };
|
|
15
|
+
if ((input.attempt ?? 1) > 1) {
|
|
16
|
+
return { level: "l0", reasons: ["retry_delta"] };
|
|
17
|
+
}
|
|
18
|
+
if (input.verificationContradicted) {
|
|
19
|
+
return { level: "l2", reasons: ["verification_contradicted"] };
|
|
20
|
+
}
|
|
21
|
+
if (input.round === 1)
|
|
22
|
+
return { level: "l2", reasons: ["first_round"] };
|
|
23
|
+
if (input.hasPlanSource)
|
|
24
|
+
return { level: "l2", reasons: ["plan_boundary"] };
|
|
25
|
+
if (input.forceLevel &&
|
|
26
|
+
input.forceLevel !== "auto" &&
|
|
27
|
+
["l0", "l1", "l2"].includes(input.forceLevel)) {
|
|
28
|
+
return {
|
|
29
|
+
level: input.forceLevel,
|
|
30
|
+
reasons: ["explicit_override"],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
if (input.checkpointBoundary) {
|
|
34
|
+
return { level: "l2", reasons: ["checkpoint_boundary"] };
|
|
35
|
+
}
|
|
36
|
+
if (input.goalChanged)
|
|
37
|
+
return { level: "l2", reasons: ["goal_changed"] };
|
|
38
|
+
if (input.previousStateMissing) {
|
|
39
|
+
return { level: "l2", reasons: ["missing_previous_state"] };
|
|
40
|
+
}
|
|
41
|
+
if (input.previousFailedWithoutNewInformation) {
|
|
42
|
+
return { level: "l0", reasons: ["retry_delta"] };
|
|
43
|
+
}
|
|
44
|
+
const lastFullRound = input.lastFullRound ?? 1;
|
|
45
|
+
if (input.fullRefreshInterval > 0 &&
|
|
46
|
+
input.round - lastFullRound >= input.fullRefreshInterval) {
|
|
47
|
+
return { level: "l2", reasons: ["periodic_refresh"] };
|
|
48
|
+
}
|
|
49
|
+
return { level: "l1", reasons: ["state_capsule"] };
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=prompt-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-policy.js","sourceRoot":"","sources":["../src/prompt-policy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAyCH,MAAM,UAAU,iBAAiB,CAAC,KAAuB;IACvD,IAAI,CAAC,KAAK,CAAC,qBAAqB,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,qBAAqB,CAAC,EAAE,CAAC;IAC3D,CAAC;IACD,IAAI,KAAK,CAAC,gBAAgB,EAAE,CAAC;QAC3B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,mBAAmB,CAAC,EAAE,CAAC;IACzD,CAAC;IACD,IAAI,KAAK,CAAC,UAAU;QAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC;IACvE,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7B,OAAO,EAA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E,OAAO,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC;IACnD,CAAC;IAED,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,IAAI,CAAC,CAAC;IAC/C,IACE,KAAK,CAAC,mBAAmB,GAAG,CAAC;QAC7B,KAAK,CAAC,KAAK,GAAG,aAAa,IAAI,KAAK,CAAC,mBAAmB,EACxD,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,kBAAkB,CAAC,EAAE,CAAC;IACxD,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC;AACrD,CAAC"}
|
package/dist/protocol.d.ts
CHANGED
|
@@ -14,32 +14,6 @@ export declare enum AgentStatus {
|
|
|
14
14
|
ERROR = "error",
|
|
15
15
|
STALLED = "stalled"
|
|
16
16
|
}
|
|
17
|
-
export declare enum Technique {
|
|
18
|
-
ZERO_SHOT = "zero-shot",
|
|
19
|
-
FEW_SHOT = "few-shot",
|
|
20
|
-
ZERO_SHOT_COT = "zero-shot-cot",
|
|
21
|
-
FEW_SHOT_COT = "few-shot-cot",
|
|
22
|
-
STEP_BACK = "step-back",
|
|
23
|
-
LEAST_TO_MOST = "least-to-most",
|
|
24
|
-
TREE_OF_THOUGHT = "tree-of-thought"
|
|
25
|
-
}
|
|
26
|
-
export interface Analysis {
|
|
27
|
-
technique: string;
|
|
28
|
-
rationale: string;
|
|
29
|
-
independence: string;
|
|
30
|
-
cognitive_load: string;
|
|
31
|
-
reference_file: string;
|
|
32
|
-
/** @deprecated Since v4.0 — no technique rotation. Always false. */
|
|
33
|
-
was_rotated: boolean;
|
|
34
|
-
}
|
|
35
|
-
export declare function makeAnalysis(overrides?: Partial<Analysis>): Analysis;
|
|
36
|
-
export interface VaultConfig {
|
|
37
|
-
project_vault: string;
|
|
38
|
-
global_vault: string;
|
|
39
|
-
skills_dir: string;
|
|
40
|
-
no_global: boolean;
|
|
41
|
-
}
|
|
42
|
-
export declare function makeVaultConfig(overrides?: Partial<VaultConfig>): VaultConfig;
|
|
43
17
|
export interface ExecutionFeedback {
|
|
44
18
|
output: string;
|
|
45
19
|
success: boolean;
|
|
@@ -135,6 +109,11 @@ export interface SelfEvaluation {
|
|
|
135
109
|
* The engine automatically writes these to the delegation journal.
|
|
136
110
|
* Omit or leave empty if no delegations occurred. */
|
|
137
111
|
worker_results?: WorkerResult[];
|
|
112
|
+
/** v1.16: Agent's declared next action — what it plans to do in the
|
|
113
|
+
* following round. Stored as loop state and rendered in the next prompt
|
|
114
|
+
* so the agent's self-planning persists across rounds. Optional —
|
|
115
|
+
* no next_action means the compiler generates the next task as before. */
|
|
116
|
+
next_action?: string;
|
|
138
117
|
}
|
|
139
118
|
/** v1.10: Checkpoint summary — a compressed snapshot of loop state at a
|
|
140
119
|
* subtask boundary. Declared by the Agent via self-evaluation, built by
|
|
@@ -164,7 +143,6 @@ export declare const SELF_EVAL_REGEX: RegExp;
|
|
|
164
143
|
export interface LoopForgeRequest {
|
|
165
144
|
task: string;
|
|
166
145
|
mode: Mode;
|
|
167
|
-
vault_config: VaultConfig;
|
|
168
146
|
feedback: ExecutionFeedback | null;
|
|
169
147
|
skill_name: string | null;
|
|
170
148
|
task_id: string | null;
|
|
@@ -240,6 +218,8 @@ export interface LoopRoundResult {
|
|
|
240
218
|
compression_checkpoint?: boolean;
|
|
241
219
|
/** v1.10: Human-readable label for the checkpoint. */
|
|
242
220
|
checkpoint_label?: string;
|
|
221
|
+
/** v1.16: Agent's declared next action for the following round. */
|
|
222
|
+
next_action?: string;
|
|
243
223
|
}
|
|
244
224
|
export declare function makeLoopRoundResult(overrides?: Partial<LoopRoundResult>): LoopRoundResult;
|
|
245
225
|
export interface LoopCompileRequest {
|
|
@@ -257,17 +237,42 @@ export interface LoopCompileRequest {
|
|
|
257
237
|
last_round_result: LoopRoundResult | null;
|
|
258
238
|
force_level: string;
|
|
259
239
|
health_check_interval: number;
|
|
260
|
-
|
|
261
|
-
/** Optional external context from a long-term memory system (e.g. claude-mem).
|
|
262
|
-
* Injected into L2 prompts only. Ignored by L0/L1 compilers.
|
|
263
|
-
* Populated by the caller (runtime / MCP session) via a memoryProvider callback. */
|
|
240
|
+
/** Optional context supplied explicitly by the embedding Agent. */
|
|
264
241
|
external_context?: string;
|
|
265
242
|
/** Maximum rounds for this loop. Used by the state file header to show
|
|
266
243
|
* accurate progress (Round X / Y). Falls back to max_summary_rounds * 2
|
|
267
244
|
* when not provided (callers that don't track maxRounds). */
|
|
268
245
|
max_rounds?: number;
|
|
246
|
+
/** Verification findings from the previous attempt. Prompt compilation uses
|
|
247
|
+
* these to select a rehydrate view and render the gate findings exactly
|
|
248
|
+
* once as part of the final prompt. */
|
|
249
|
+
verification_flags?: VerificationFlag[];
|
|
250
|
+
/** One-based attempt within the same logical round. Enforcement rejection
|
|
251
|
+
* increments this without advancing `round`. */
|
|
252
|
+
attempt: number;
|
|
253
|
+
/** Consecutive zero-commit enforcement rejections for this round. */
|
|
254
|
+
consecutive_rejections: number;
|
|
255
|
+
/** Structured enforcement feedback rendered into retry prompts. */
|
|
256
|
+
rejection_notice: string;
|
|
269
257
|
}
|
|
270
258
|
export declare function makeLoopCompileRequest(overrides?: Partial<LoopCompileRequest>): LoopCompileRequest;
|
|
259
|
+
/** Immutable record of the exact prompt delivered for one round attempt. */
|
|
260
|
+
export interface PromptArtifact {
|
|
261
|
+
schemaVersion: 1;
|
|
262
|
+
roundId: string;
|
|
263
|
+
attempt: number;
|
|
264
|
+
level: "l0" | "l1" | "l2";
|
|
265
|
+
levelReasons: string[];
|
|
266
|
+
renderedPrompt: string;
|
|
267
|
+
promptHash: string;
|
|
268
|
+
stateHash: string;
|
|
269
|
+
basePromptVersion: string;
|
|
270
|
+
includedSections: string[];
|
|
271
|
+
budgetChars: number;
|
|
272
|
+
charCount: number;
|
|
273
|
+
budgetExceeded: boolean;
|
|
274
|
+
generatedAt: number;
|
|
275
|
+
}
|
|
271
276
|
export interface LoopCompileResponse {
|
|
272
277
|
status: AgentStatus;
|
|
273
278
|
prompt: string;
|
|
@@ -276,8 +281,6 @@ export interface LoopCompileResponse {
|
|
|
276
281
|
lineage: string[];
|
|
277
282
|
constraints_active: string[];
|
|
278
283
|
constraints_retired: string[];
|
|
279
|
-
technique_used: string;
|
|
280
|
-
reference_file: string;
|
|
281
284
|
loop_id: string;
|
|
282
285
|
round: number;
|
|
283
286
|
goal_id: string;
|
|
@@ -295,22 +298,39 @@ export interface LoopCompileResponse {
|
|
|
295
298
|
* (SessionManager or Runtime) to .loopforge/state/{loopId}-state.md.
|
|
296
299
|
* Undefined for L0/L1 compilations — only L2 produces state file content. */
|
|
297
300
|
state_file_content?: string;
|
|
301
|
+
/** Exact, hashed prompt record used by transaction replay and audit. */
|
|
302
|
+
prompt_artifact?: PromptArtifact;
|
|
298
303
|
}
|
|
299
304
|
export declare function makeLoopCompileResponse(overrides?: Partial<LoopCompileResponse>): LoopCompileResponse;
|
|
305
|
+
/** Aggregated evidence snapshot for the state file Evidence section.
|
|
306
|
+
* Four categories give the agent a clear picture of what's been confirmed,
|
|
307
|
+
* what remains, what was wrong, and what's newly discovered — all derived
|
|
308
|
+
* from accumulated SelfEvaluation data across rounds. */
|
|
309
|
+
export interface EvidenceSnapshot {
|
|
310
|
+
/** Criteria met + successful outcomes confirmed across rounds. */
|
|
311
|
+
verified: string[];
|
|
312
|
+
/** Criteria still unmet — work remaining. */
|
|
313
|
+
pending: string[];
|
|
314
|
+
/** Wrong assumptions + retracted constraints — things we were wrong about. */
|
|
315
|
+
invalidated: string[];
|
|
316
|
+
/** New constraints + emerged subtasks discovered this round. */
|
|
317
|
+
discovered: string[];
|
|
318
|
+
}
|
|
319
|
+
export declare function makeEvidenceSnapshot(overrides?: Partial<EvidenceSnapshot>): EvidenceSnapshot;
|
|
300
320
|
export interface LoopForgeResponse {
|
|
301
321
|
status: AgentStatus;
|
|
302
322
|
prompt: string | null;
|
|
303
|
-
analysis: Analysis | null;
|
|
304
323
|
error: string | null;
|
|
305
324
|
/** v1.14: State file content from the compiler. Written to disk by the caller. */
|
|
306
325
|
state_file_content?: string;
|
|
326
|
+
/** Exact prompt artifact produced by the compiler. */
|
|
327
|
+
prompt_artifact?: PromptArtifact;
|
|
307
328
|
}
|
|
308
329
|
export interface SessionState {
|
|
309
330
|
task_id: string;
|
|
310
331
|
call_count: number;
|
|
311
332
|
success_trend: boolean[];
|
|
312
333
|
current_version: string;
|
|
313
|
-
last_technique: string | null;
|
|
314
334
|
circuit_breaker_count: number;
|
|
315
335
|
feedback_buffer: Record<string, unknown>[];
|
|
316
336
|
}
|
|
@@ -323,20 +343,28 @@ export declare enum RuntimeStatus {
|
|
|
323
343
|
IDLE = "idle",
|
|
324
344
|
RUNNING = "running",
|
|
325
345
|
STOPPED = "stopped",
|
|
326
|
-
STALLED = "stalled"
|
|
346
|
+
STALLED = "stalled",
|
|
347
|
+
/** v1.18: Loop is suspended — can be resumed from currentRound. */
|
|
348
|
+
PAUSED = "paused"
|
|
327
349
|
}
|
|
328
350
|
export interface RoundContext {
|
|
329
351
|
round: number;
|
|
352
|
+
/** Stable identity for the logical round; unchanged across reject retries. */
|
|
353
|
+
roundId?: string;
|
|
330
354
|
signal: {
|
|
331
355
|
aborted: boolean;
|
|
332
356
|
};
|
|
333
357
|
reportProgress: (message: string) => void;
|
|
334
358
|
}
|
|
335
359
|
export type AgentExecutor = (prompt: string, ctx: RoundContext) => Promise<string>;
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
*
|
|
339
|
-
|
|
360
|
+
/** Why a loop stopped. Used by Runtime, MCP session, and vault persistence.
|
|
361
|
+
* `completed` requires both success=true and should_continue=false.
|
|
362
|
+
* `failed` is success=false + should_continue=false (agent gave up).
|
|
363
|
+
* `cancelled` is manual stop via loopforge_stop.
|
|
364
|
+
* Legacy aliases (backward-compat): `task_complete` → `completed`, `stopped` → `cancelled`. */
|
|
365
|
+
export type StopReason = "completed" | "failed" | "blocked" | "cancelled" | "max_rounds" | "circuit_breaker" | "stalled" | "executor_failure" | "enforcement_terminated"
|
|
366
|
+
/** v1.18: Loop was paused by user or signal. */
|
|
367
|
+
| "paused" | "task_complete" | "stopped";
|
|
340
368
|
/** Result of round-boundary enforcement. Decides whether to accept the round,
|
|
341
369
|
* reject it (force the agent to redo the SAME round), or terminate the loop.
|
|
342
370
|
*
|
|
@@ -353,16 +381,21 @@ export interface EnforcementResult {
|
|
|
353
381
|
/** For reject: concrete instructions the agent must follow.
|
|
354
382
|
* Empty for accept and terminate. */
|
|
355
383
|
fix_instructions: string;
|
|
384
|
+
/** Which enforcement rule fired. Empty for accept.
|
|
385
|
+
* Used by callers to track consecutive rejections per-rule
|
|
386
|
+
* so unrelated rejections don't accumulate toward the max. */
|
|
387
|
+
check?: string;
|
|
356
388
|
}
|
|
357
389
|
export declare function makeEnforcementResult(overrides?: Partial<EnforcementResult>): EnforcementResult;
|
|
358
390
|
export interface RoundStartInfo {
|
|
359
391
|
round: number;
|
|
392
|
+
roundId?: string;
|
|
360
393
|
level: string;
|
|
361
|
-
technique: string;
|
|
362
394
|
prompt: string;
|
|
363
395
|
}
|
|
364
396
|
export interface RoundCompleteInfo {
|
|
365
397
|
round: number;
|
|
398
|
+
roundId?: string;
|
|
366
399
|
roundSuccess: boolean;
|
|
367
400
|
selfEval: SelfEvaluation | null;
|
|
368
401
|
durationMs: number;
|
|
@@ -400,72 +433,34 @@ export interface RuntimeConfig {
|
|
|
400
433
|
onHeartbeat?: (info: HeartbeatInfo) => void;
|
|
401
434
|
onTimeout?: (info: TimeoutInfo) => void;
|
|
402
435
|
onHealthWarning?: (warning: HealthWarning) => void;
|
|
403
|
-
/**
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
* Receives a structured writeback payload with project/feedback/reference entries. */
|
|
411
|
-
memoryWriter?: (payload: LoopMemoryWriteback) => Promise<void>;
|
|
412
|
-
}
|
|
413
|
-
/** Context passed to the memoryProvider callback at each injection phase.
|
|
414
|
-
* Contains enough loop state to construct a targeted semantic query. */
|
|
415
|
-
export interface MemoryProviderContext {
|
|
436
|
+
/** Explicit provider for context owned by the embedding Agent. */
|
|
437
|
+
contextProvider?: ExternalContextProvider;
|
|
438
|
+
/** Explicit terminal observers; failures are isolated from the runtime. */
|
|
439
|
+
terminalSinks?: LoopTerminalSink[];
|
|
440
|
+
}
|
|
441
|
+
/** Context supplied to an embedding-owned provider before compilation. */
|
|
442
|
+
export interface ExternalContextRequest {
|
|
416
443
|
loopId: string;
|
|
417
444
|
round: number;
|
|
418
445
|
task: string;
|
|
419
446
|
domain: string;
|
|
420
|
-
/**
|
|
421
|
-
|
|
422
|
-
/** Current progress estimate (0.0–1.0), or -1 if unavailable. */
|
|
423
|
-
progressEstimate: number;
|
|
424
|
-
/** Accumulated loop knowledge for constructing a differential query. */
|
|
425
|
-
accumulatedContext: {
|
|
426
|
-
recurringIssues: string[];
|
|
427
|
-
failedPatterns: string[];
|
|
428
|
-
keyLessons: string[];
|
|
429
|
-
remainingCriteria: string[];
|
|
430
|
-
};
|
|
447
|
+
/** The previously accepted evaluation, when one exists. */
|
|
448
|
+
lastEvaluation?: SelfEvaluation;
|
|
431
449
|
}
|
|
450
|
+
export type ExternalContextProvider = (request: ExternalContextRequest) => Promise<string>;
|
|
432
451
|
export interface RunResult {
|
|
433
452
|
success: boolean;
|
|
434
453
|
stopReason: StopReason;
|
|
435
454
|
roundsCompleted: number;
|
|
436
455
|
successTrajectory: boolean[];
|
|
437
456
|
}
|
|
438
|
-
/**
|
|
439
|
-
|
|
440
|
-
* for cross-task reuse. */
|
|
441
|
-
export interface LoopMemoryWriteback {
|
|
457
|
+
/** Stable, provider-neutral terminal hook payload. */
|
|
458
|
+
export interface LoopTerminalEvent extends RunResult {
|
|
442
459
|
loopId: string;
|
|
443
460
|
task: string;
|
|
444
|
-
|
|
445
|
-
roundsCompleted: number;
|
|
446
|
-
/** Project-type memory entry — task outcome and key discoveries. */
|
|
447
|
-
projectEntry: LoopMemoryWritebackProjectEntry;
|
|
448
|
-
/** Feedback-type memory entries — tactical lessons learned. */
|
|
449
|
-
feedbackEntries: LoopMemoryWritebackFeedbackEntry[];
|
|
450
|
-
/** Reference-type memory entry — pointer to the vault for deep dives. */
|
|
451
|
-
referenceEntry: LoopMemoryWritebackReferenceEntry;
|
|
452
|
-
}
|
|
453
|
-
export interface LoopMemoryWritebackProjectEntry {
|
|
454
|
-
title: string;
|
|
455
|
-
objective: string;
|
|
456
|
-
keyOutcome: string;
|
|
457
|
-
keyDiscoveries: string[];
|
|
458
|
-
date: string;
|
|
459
|
-
}
|
|
460
|
-
export interface LoopMemoryWritebackFeedbackEntry {
|
|
461
|
-
rule: string;
|
|
462
|
-
why: string;
|
|
463
|
-
howToApply: string;
|
|
464
|
-
}
|
|
465
|
-
export interface LoopMemoryWritebackReferenceEntry {
|
|
466
|
-
description: string;
|
|
467
|
-
vaultLocation: string;
|
|
461
|
+
lastEvaluation?: SelfEvaluation;
|
|
468
462
|
}
|
|
463
|
+
export type LoopTerminalSink = (event: LoopTerminalEvent) => Promise<void> | void;
|
|
469
464
|
/** A single flag raised during self-evaluation verification.
|
|
470
465
|
* Each flag identifies a specific inconsistency between the agent's
|
|
471
466
|
* self-reported data and the loop's cross-round lineage. */
|