loopforge 1.3.1 → 1.8.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 +64 -3
- package/dist/backends/fs.d.ts +5 -0
- package/dist/backends/fs.d.ts.map +1 -1
- package/dist/backends/fs.js +66 -16
- package/dist/backends/fs.js.map +1 -1
- package/dist/builder.d.ts +0 -1
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +14 -25
- package/dist/builder.js.map +1 -1
- package/dist/engine.d.ts +28 -5
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +303 -105
- package/dist/engine.js.map +1 -1
- package/dist/index.d.ts +9 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -10
- package/dist/index.js.map +1 -1
- package/dist/loop-compiler.d.ts +28 -2
- package/dist/loop-compiler.d.ts.map +1 -1
- package/dist/loop-compiler.js +718 -38
- package/dist/loop-compiler.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +6 -4
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/session.d.ts +24 -4
- package/dist/mcp/session.d.ts.map +1 -1
- package/dist/mcp/session.js +303 -34
- package/dist/mcp/session.js.map +1 -1
- package/dist/mcp/tools.d.ts +165 -1
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +144 -15
- package/dist/mcp/tools.js.map +1 -1
- package/dist/memory-bridge.d.ts +47 -0
- package/dist/memory-bridge.d.ts.map +1 -0
- package/dist/memory-bridge.js +290 -0
- package/dist/memory-bridge.js.map +1 -0
- package/dist/observability.d.ts +23 -0
- package/dist/observability.d.ts.map +1 -0
- package/dist/observability.js +29 -0
- package/dist/observability.js.map +1 -0
- package/dist/policy.d.ts +72 -0
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +44 -0
- package/dist/policy.js.map +1 -1
- package/dist/protocol.d.ts +197 -7
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +48 -5
- package/dist/protocol.js.map +1 -1
- package/dist/runtime.d.ts +19 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +446 -142
- package/dist/runtime.js.map +1 -1
- package/dist/tests/builder.test.js +1 -25
- package/dist/tests/builder.test.js.map +1 -1
- package/dist/tests/engine.test.js +213 -38
- package/dist/tests/engine.test.js.map +1 -1
- package/dist/tests/generate-schema.test.js +4 -4
- package/dist/tests/generate-schema.test.js.map +1 -1
- package/dist/tests/loop-compiler.test.js +427 -2
- package/dist/tests/loop-compiler.test.js.map +1 -1
- package/dist/tests/mcp.test.js +166 -79
- package/dist/tests/mcp.test.js.map +1 -1
- package/dist/tests/memory-bridge.test.d.ts +8 -0
- package/dist/tests/memory-bridge.test.d.ts.map +1 -0
- package/dist/tests/memory-bridge.test.js +384 -0
- package/dist/tests/memory-bridge.test.js.map +1 -0
- package/dist/tests/protocol.test.js +14 -5
- package/dist/tests/protocol.test.js.map +1 -1
- package/dist/tests/verification-gate.test.d.ts +2 -0
- package/dist/tests/verification-gate.test.d.ts.map +1 -0
- package/dist/tests/verification-gate.test.js +407 -0
- package/dist/tests/verification-gate.test.js.map +1 -0
- package/dist/verification-gate.d.ts +26 -0
- package/dist/verification-gate.d.ts.map +1 -0
- package/dist/verification-gate.js +232 -0
- package/dist/verification-gate.js.map +1 -0
- package/loop_policy.json +31 -0
- package/package.json +1 -2
- package/skills/perception/SKILL.md +147 -55
- package/dist/adapter.d.ts +0 -17
- package/dist/adapter.d.ts.map +0 -1
- package/dist/adapter.js +0 -228
- package/dist/adapter.js.map +0 -1
- package/dist/cli.d.ts +0 -7
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -458
- package/dist/cli.js.map +0 -1
- package/dist/tests/adapter.test.d.ts +0 -2
- package/dist/tests/adapter.test.d.ts.map +0 -1
- package/dist/tests/adapter.test.js +0 -104
- package/dist/tests/adapter.test.js.map +0 -1
package/dist/mcp/tools.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export declare const TOOL_SCHEMAS: ({
|
|
|
39
39
|
};
|
|
40
40
|
sessionId?: undefined;
|
|
41
41
|
output?: undefined;
|
|
42
|
+
evaluation?: undefined;
|
|
42
43
|
};
|
|
43
44
|
required: string[];
|
|
44
45
|
};
|
|
@@ -56,6 +57,166 @@ export declare const TOOL_SCHEMAS: ({
|
|
|
56
57
|
type: "string";
|
|
57
58
|
description: string;
|
|
58
59
|
};
|
|
60
|
+
evaluation: {
|
|
61
|
+
type: "object";
|
|
62
|
+
description: string;
|
|
63
|
+
required: string[];
|
|
64
|
+
properties: {
|
|
65
|
+
success: {
|
|
66
|
+
type: "boolean";
|
|
67
|
+
description: string;
|
|
68
|
+
};
|
|
69
|
+
output_summary: {
|
|
70
|
+
type: "string";
|
|
71
|
+
description: string;
|
|
72
|
+
};
|
|
73
|
+
should_continue: {
|
|
74
|
+
type: "boolean";
|
|
75
|
+
description: string;
|
|
76
|
+
};
|
|
77
|
+
constraint_violations: {
|
|
78
|
+
type: "array";
|
|
79
|
+
items: {
|
|
80
|
+
type: "string";
|
|
81
|
+
};
|
|
82
|
+
description: string;
|
|
83
|
+
};
|
|
84
|
+
discovered_constraints: {
|
|
85
|
+
type: "array";
|
|
86
|
+
items: {
|
|
87
|
+
type: "string";
|
|
88
|
+
};
|
|
89
|
+
description: string;
|
|
90
|
+
};
|
|
91
|
+
objective_refinement: {
|
|
92
|
+
type: "string";
|
|
93
|
+
description: string;
|
|
94
|
+
};
|
|
95
|
+
emerged_subtasks: {
|
|
96
|
+
type: "array";
|
|
97
|
+
items: {
|
|
98
|
+
type: "string";
|
|
99
|
+
};
|
|
100
|
+
description: string;
|
|
101
|
+
};
|
|
102
|
+
execution_evidence: {
|
|
103
|
+
type: "object";
|
|
104
|
+
description: string;
|
|
105
|
+
properties: {
|
|
106
|
+
files_changed: {
|
|
107
|
+
type: "array";
|
|
108
|
+
items: {
|
|
109
|
+
type: "string";
|
|
110
|
+
};
|
|
111
|
+
description: string;
|
|
112
|
+
};
|
|
113
|
+
test_results: {
|
|
114
|
+
type: "object";
|
|
115
|
+
description: string;
|
|
116
|
+
properties: {
|
|
117
|
+
passed: {
|
|
118
|
+
type: "integer";
|
|
119
|
+
minimum: number;
|
|
120
|
+
description: string;
|
|
121
|
+
};
|
|
122
|
+
failed: {
|
|
123
|
+
type: "integer";
|
|
124
|
+
minimum: number;
|
|
125
|
+
description: string;
|
|
126
|
+
};
|
|
127
|
+
skipped: {
|
|
128
|
+
type: "integer";
|
|
129
|
+
minimum: number;
|
|
130
|
+
description: string;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
success_criteria_met: {
|
|
135
|
+
type: "array";
|
|
136
|
+
items: {
|
|
137
|
+
type: "string";
|
|
138
|
+
};
|
|
139
|
+
description: string;
|
|
140
|
+
};
|
|
141
|
+
success_criteria_remaining: {
|
|
142
|
+
type: "array";
|
|
143
|
+
items: {
|
|
144
|
+
type: "string";
|
|
145
|
+
};
|
|
146
|
+
description: string;
|
|
147
|
+
};
|
|
148
|
+
progress_estimate: {
|
|
149
|
+
type: "number";
|
|
150
|
+
minimum: number;
|
|
151
|
+
maximum: number;
|
|
152
|
+
description: string;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
retracted_constraints: {
|
|
157
|
+
type: "array";
|
|
158
|
+
items: {
|
|
159
|
+
type: "string";
|
|
160
|
+
};
|
|
161
|
+
description: string;
|
|
162
|
+
};
|
|
163
|
+
revised_success_criteria: {
|
|
164
|
+
type: "array";
|
|
165
|
+
description: string;
|
|
166
|
+
items: {
|
|
167
|
+
type: "object";
|
|
168
|
+
properties: {
|
|
169
|
+
old: {
|
|
170
|
+
type: "string";
|
|
171
|
+
description: string;
|
|
172
|
+
};
|
|
173
|
+
new: {
|
|
174
|
+
type: "string";
|
|
175
|
+
description: string;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
wrong_assumptions: {
|
|
181
|
+
type: "array";
|
|
182
|
+
items: {
|
|
183
|
+
type: "string";
|
|
184
|
+
};
|
|
185
|
+
description: string;
|
|
186
|
+
};
|
|
187
|
+
worker_results: {
|
|
188
|
+
type: "array";
|
|
189
|
+
description: string;
|
|
190
|
+
items: {
|
|
191
|
+
type: "object";
|
|
192
|
+
properties: {
|
|
193
|
+
agentId: {
|
|
194
|
+
type: "string";
|
|
195
|
+
};
|
|
196
|
+
subAgentType: {
|
|
197
|
+
type: "string";
|
|
198
|
+
};
|
|
199
|
+
subTask: {
|
|
200
|
+
type: "string";
|
|
201
|
+
};
|
|
202
|
+
resultSummary: {
|
|
203
|
+
type: "string";
|
|
204
|
+
};
|
|
205
|
+
success: {
|
|
206
|
+
type: "boolean";
|
|
207
|
+
};
|
|
208
|
+
discoveredConstraints: {
|
|
209
|
+
type: "array";
|
|
210
|
+
items: {
|
|
211
|
+
type: "string";
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
required: string[];
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
};
|
|
59
220
|
task?: undefined;
|
|
60
221
|
loopId?: undefined;
|
|
61
222
|
maxRounds?: undefined;
|
|
@@ -82,6 +243,7 @@ export declare const TOOL_SCHEMAS: ({
|
|
|
82
243
|
planSource?: undefined;
|
|
83
244
|
constraints?: undefined;
|
|
84
245
|
output?: undefined;
|
|
246
|
+
evaluation?: undefined;
|
|
85
247
|
};
|
|
86
248
|
required: string[];
|
|
87
249
|
};
|
|
@@ -99,6 +261,7 @@ export declare const TOOL_SCHEMAS: ({
|
|
|
99
261
|
constraints?: undefined;
|
|
100
262
|
sessionId?: undefined;
|
|
101
263
|
output?: undefined;
|
|
264
|
+
evaluation?: undefined;
|
|
102
265
|
};
|
|
103
266
|
required: never[];
|
|
104
267
|
};
|
|
@@ -119,10 +282,11 @@ export declare const TOOL_SCHEMAS: ({
|
|
|
119
282
|
constraints?: undefined;
|
|
120
283
|
sessionId?: undefined;
|
|
121
284
|
output?: undefined;
|
|
285
|
+
evaluation?: undefined;
|
|
122
286
|
};
|
|
123
287
|
required: string[];
|
|
124
288
|
};
|
|
125
289
|
})[];
|
|
126
|
-
export type ToolHandler = (mgr: SessionManager, input: Record<string, unknown>) => Record<string, unknown
|
|
290
|
+
export type ToolHandler = (mgr: SessionManager, input: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
127
291
|
export declare const TOOL_HANDLERS: Record<string, ToolHandler>;
|
|
128
292
|
//# sourceMappingURL=tools.d.ts.map
|
package/dist/mcp/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,cAAc,CAAC;AAO/D,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA+PxB,CAAC;AAMF,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAEpH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CA0HrD,CAAC"}
|
package/dist/mcp/tools.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* 6 tools: start, next, status, stop, list, replay.
|
|
4
4
|
* Each handler receives SessionManager + parsed input, returns the output object.
|
|
5
5
|
*/
|
|
6
|
+
import { buildSelfEvaluation } from "../engine.js";
|
|
6
7
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
7
8
|
// Tool schemas (MCP JSON Schema format)
|
|
8
9
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -44,7 +45,7 @@ export const TOOL_SCHEMAS = [
|
|
|
44
45
|
},
|
|
45
46
|
{
|
|
46
47
|
name: "loopforge_next",
|
|
47
|
-
description: "Submit the output from the current round and advance to the next. Returns the next-round prompt, or null with a stopReason when the loop ends.",
|
|
48
|
+
description: "Submit the output from the current round and advance to the next. Returns the next-round prompt, or null with a stopReason when the loop ends. The evaluation parameter provides structured self-assessment — prefer this over embedding a ---loopforge-eval block in the output text.",
|
|
48
49
|
inputSchema: {
|
|
49
50
|
type: "object",
|
|
50
51
|
properties: {
|
|
@@ -54,10 +55,124 @@ export const TOOL_SCHEMAS = [
|
|
|
54
55
|
},
|
|
55
56
|
output: {
|
|
56
57
|
type: "string",
|
|
57
|
-
description: "The agent's full output from executing the current round's prompt.",
|
|
58
|
+
description: "Optional. The agent's full output from executing the current round's prompt. May be omitted if evaluation parameter is provided.",
|
|
59
|
+
},
|
|
60
|
+
evaluation: {
|
|
61
|
+
type: "object",
|
|
62
|
+
description: "Structured self-evaluation for this round. Required for the loop to continue. Preferred over embedding ---loopforge-eval blocks in output text.",
|
|
63
|
+
required: ["success", "output_summary", "should_continue", "constraint_violations"],
|
|
64
|
+
properties: {
|
|
65
|
+
success: {
|
|
66
|
+
type: "boolean",
|
|
67
|
+
description: "true ONLY if all hard constraints met AND the task goal achieved.",
|
|
68
|
+
},
|
|
69
|
+
output_summary: {
|
|
70
|
+
type: "string",
|
|
71
|
+
description: "Specific, actionable summary of what was DONE this round — not what was attempted.",
|
|
72
|
+
},
|
|
73
|
+
should_continue: {
|
|
74
|
+
type: "boolean",
|
|
75
|
+
description: "false ONLY when the ENTIRE task is complete. Partial progress = true.",
|
|
76
|
+
},
|
|
77
|
+
constraint_violations: {
|
|
78
|
+
type: "array",
|
|
79
|
+
items: { type: "string" },
|
|
80
|
+
description: "Constraints the agent actually violated this round. Be honest.",
|
|
81
|
+
},
|
|
82
|
+
discovered_constraints: {
|
|
83
|
+
type: "array",
|
|
84
|
+
items: { type: "string" },
|
|
85
|
+
description: "Optional. New constraints discovered this round.",
|
|
86
|
+
},
|
|
87
|
+
objective_refinement: {
|
|
88
|
+
type: "string",
|
|
89
|
+
description: "Optional. If this round deepened understanding of the task objective.",
|
|
90
|
+
},
|
|
91
|
+
emerged_subtasks: {
|
|
92
|
+
type: "array",
|
|
93
|
+
items: { type: "string" },
|
|
94
|
+
description: "Optional. Sub-problems that surfaced during execution.",
|
|
95
|
+
},
|
|
96
|
+
execution_evidence: {
|
|
97
|
+
type: "object",
|
|
98
|
+
description: "Optional. Structured record of what actually happened this round.",
|
|
99
|
+
properties: {
|
|
100
|
+
files_changed: {
|
|
101
|
+
type: "array",
|
|
102
|
+
items: { type: "string" },
|
|
103
|
+
description: "Files modified this round.",
|
|
104
|
+
},
|
|
105
|
+
test_results: {
|
|
106
|
+
type: "object",
|
|
107
|
+
description: "Test results from this round.",
|
|
108
|
+
properties: {
|
|
109
|
+
passed: { type: "integer", minimum: 0, description: "Number of passing tests." },
|
|
110
|
+
failed: { type: "integer", minimum: 0, description: "Number of failing tests." },
|
|
111
|
+
skipped: { type: "integer", minimum: 0, description: "Number of skipped tests." },
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
success_criteria_met: {
|
|
115
|
+
type: "array",
|
|
116
|
+
items: { type: "string" },
|
|
117
|
+
description: "Success criteria satisfied this round.",
|
|
118
|
+
},
|
|
119
|
+
success_criteria_remaining: {
|
|
120
|
+
type: "array",
|
|
121
|
+
items: { type: "string" },
|
|
122
|
+
description: "Success criteria still outstanding.",
|
|
123
|
+
},
|
|
124
|
+
progress_estimate: {
|
|
125
|
+
type: "number",
|
|
126
|
+
minimum: 0,
|
|
127
|
+
maximum: 1,
|
|
128
|
+
description: "Estimated progress toward task completion (0.0–1.0).",
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
retracted_constraints: {
|
|
133
|
+
type: "array",
|
|
134
|
+
items: { type: "string" },
|
|
135
|
+
description: "Optional. Constraints the agent now believes are wrong.",
|
|
136
|
+
},
|
|
137
|
+
revised_success_criteria: {
|
|
138
|
+
type: "array",
|
|
139
|
+
description: "Optional. Success criteria that need reformulation.",
|
|
140
|
+
items: {
|
|
141
|
+
type: "object",
|
|
142
|
+
properties: {
|
|
143
|
+
old: { type: "string", description: "Original criterion." },
|
|
144
|
+
new: { type: "string", description: "Revised criterion." },
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
wrong_assumptions: {
|
|
149
|
+
type: "array",
|
|
150
|
+
items: { type: "string" },
|
|
151
|
+
description: "Optional. Assumptions from earlier rounds that were incorrect.",
|
|
152
|
+
},
|
|
153
|
+
worker_results: {
|
|
154
|
+
type: "array",
|
|
155
|
+
description: "Optional. Results of sub-agent / Worker delegations this round.",
|
|
156
|
+
items: {
|
|
157
|
+
type: "object",
|
|
158
|
+
properties: {
|
|
159
|
+
agentId: { type: "string" },
|
|
160
|
+
subAgentType: { type: "string" },
|
|
161
|
+
subTask: { type: "string" },
|
|
162
|
+
resultSummary: { type: "string" },
|
|
163
|
+
success: { type: "boolean" },
|
|
164
|
+
discoveredConstraints: {
|
|
165
|
+
type: "array",
|
|
166
|
+
items: { type: "string" },
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
required: ["agentId", "subAgentType", "subTask", "resultSummary", "success"],
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
},
|
|
58
173
|
},
|
|
59
174
|
},
|
|
60
|
-
required: ["sessionId", "
|
|
175
|
+
required: ["sessionId", "evaluation"],
|
|
61
176
|
},
|
|
62
177
|
},
|
|
63
178
|
{
|
|
@@ -141,7 +256,7 @@ export const TOOL_SCHEMAS = [
|
|
|
141
256
|
},
|
|
142
257
|
];
|
|
143
258
|
export const TOOL_HANDLERS = {
|
|
144
|
-
loopforge_start(mgr, input) {
|
|
259
|
+
async loopforge_start(mgr, input) {
|
|
145
260
|
const startInput = {
|
|
146
261
|
task: String(input.task ?? ""),
|
|
147
262
|
loopId: input.loopId,
|
|
@@ -155,30 +270,36 @@ export const TOOL_HANDLERS = {
|
|
|
155
270
|
if (!startInput.task.trim()) {
|
|
156
271
|
return { error: "task is required and must be non-empty" };
|
|
157
272
|
}
|
|
158
|
-
const result = mgr.create(startInput);
|
|
273
|
+
const result = await mgr.create(startInput);
|
|
159
274
|
return { ...result };
|
|
160
275
|
},
|
|
161
|
-
loopforge_next(mgr, input) {
|
|
276
|
+
async loopforge_next(mgr, input) {
|
|
162
277
|
const sessionId = String(input.sessionId ?? "");
|
|
163
278
|
const output = String(input.output ?? "");
|
|
279
|
+
const rawEval = input.evaluation;
|
|
164
280
|
if (!sessionId)
|
|
165
281
|
return { error: "sessionId is required" };
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
282
|
+
// Build SelfEvaluation from structured evaluation parameter
|
|
283
|
+
const preExtractedEval = rawEval ? buildSelfEvaluation(rawEval) : undefined;
|
|
284
|
+
// Require at least one of: evaluation parameter or output with embedded eval block
|
|
285
|
+
if (!preExtractedEval && !output.trim()) {
|
|
286
|
+
return { error: "Either evaluation parameter or output with ---loopforge-eval block is required" };
|
|
287
|
+
}
|
|
288
|
+
const result = await mgr.advance(sessionId, output, preExtractedEval);
|
|
169
289
|
// Clean up finished sessions
|
|
170
290
|
if (result.prompt === null) {
|
|
171
291
|
mgr.delete(sessionId);
|
|
172
292
|
}
|
|
173
293
|
return { ...result };
|
|
174
294
|
},
|
|
175
|
-
loopforge_status(mgr, input) {
|
|
295
|
+
async loopforge_status(mgr, input) {
|
|
176
296
|
const sessionId = String(input.sessionId ?? "");
|
|
177
297
|
if (!sessionId)
|
|
178
298
|
return { error: "sessionId is required" };
|
|
179
299
|
const session = mgr.get(sessionId);
|
|
180
300
|
if (!session)
|
|
181
301
|
return { error: `session not found: ${sessionId}` };
|
|
302
|
+
const metrics = session.engine.getMetrics();
|
|
182
303
|
return {
|
|
183
304
|
sessionId: session.sessionId,
|
|
184
305
|
loopId: session.loopId,
|
|
@@ -187,9 +308,17 @@ export const TOOL_HANDLERS = {
|
|
|
187
308
|
status: session.status,
|
|
188
309
|
qualityTrajectory: session.qualityTrajectory,
|
|
189
310
|
technique: session.engine.state?.last_technique ?? null,
|
|
311
|
+
metrics: {
|
|
312
|
+
vaultWriteErrors: metrics.vaultWriteErrors,
|
|
313
|
+
vaultWriteBytes: metrics.vaultWriteBytes,
|
|
314
|
+
feedbackBufferFlushes: metrics.feedbackBufferFlushes,
|
|
315
|
+
feedbackBufferMaxSize: metrics.feedbackBufferMaxSize,
|
|
316
|
+
hydrateCacheMisses: metrics.hydrateCacheMisses,
|
|
317
|
+
silentAnalysisErrors: metrics.silentAnalysisErrors,
|
|
318
|
+
},
|
|
190
319
|
};
|
|
191
320
|
},
|
|
192
|
-
loopforge_stop(mgr, input) {
|
|
321
|
+
async loopforge_stop(mgr, input) {
|
|
193
322
|
const sessionId = String(input.sessionId ?? "");
|
|
194
323
|
if (!sessionId)
|
|
195
324
|
return { error: "sessionId is required" };
|
|
@@ -201,11 +330,11 @@ export const TOOL_HANDLERS = {
|
|
|
201
330
|
mgr.delete(sessionId);
|
|
202
331
|
return { success: true, roundsCompleted, qualityTrajectory };
|
|
203
332
|
},
|
|
204
|
-
loopforge_list(mgr, _input) {
|
|
333
|
+
async loopforge_list(mgr, _input) {
|
|
205
334
|
const sessions = mgr.list();
|
|
206
335
|
return { sessions };
|
|
207
336
|
},
|
|
208
|
-
loopforge_replay(mgr, input) {
|
|
337
|
+
async loopforge_replay(mgr, input) {
|
|
209
338
|
const sessionId = String(input.sessionId ?? "");
|
|
210
339
|
if (!sessionId)
|
|
211
340
|
return { error: "sessionId is required" };
|
|
@@ -215,7 +344,7 @@ export const TOOL_HANDLERS = {
|
|
|
215
344
|
const timeline = mgr.replayTimeline(sessionId) ?? [];
|
|
216
345
|
return { sessionId, loopId: session.loopId, timeline };
|
|
217
346
|
},
|
|
218
|
-
loopforge_resume(mgr, input) {
|
|
347
|
+
async loopforge_resume(mgr, input) {
|
|
219
348
|
const loopId = String(input.loopId ?? "");
|
|
220
349
|
if (!loopId)
|
|
221
350
|
return { error: "loopId is required" };
|
|
@@ -224,7 +353,7 @@ export const TOOL_HANDLERS = {
|
|
|
224
353
|
return { error: `no saved session found for loop "${loopId}"` };
|
|
225
354
|
return { ...result };
|
|
226
355
|
},
|
|
227
|
-
loopforge_health(mgr, input) {
|
|
356
|
+
async loopforge_health(mgr, input) {
|
|
228
357
|
const loopId = String(input.loopId ?? "");
|
|
229
358
|
if (!loopId)
|
|
230
359
|
return { error: "loopId is required" };
|
package/dist/mcp/tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,8EAA8E;AAC9E,wCAAwC;AACxC,8EAA8E;AAE9E,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B;QACE,IAAI,EAAE,iBAAiB;QACvB,WAAW,EACT,mLAAmL;QACrL,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,IA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ACvB,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,GAAG,EAAE,KAAK;QAC/B,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM;YAAE,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC;QAEpD,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,CAAC,MAAM;YAAE,OAAO,EAAE,KAAK,EAAE,2BAA2B,MAAM,GAAG,EAAE,CAAC;QAEpE,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** LoopForge — Memory Bridge (v1.8).
|
|
2
|
+
*
|
|
3
|
+
* Zero-config auto-detection bridge between LoopForge and claude-mem.
|
|
4
|
+
* Detects claude-mem via the local filesystem, provides memoryProvider
|
|
5
|
+
* (file-based retrieval) and memoryWriter (Markdown file writeback).
|
|
6
|
+
*
|
|
7
|
+
* Two integration paths:
|
|
8
|
+
* MCP: autoConfigureMemory(sessionMgr) — sets provider/writer on SessionManager
|
|
9
|
+
* Lib: tryAutoConfigure() → { memoryProvider?, memoryWriter? } — for resolveConfig()
|
|
10
|
+
*
|
|
11
|
+
* If claude-mem is not installed or the project has no memory directory,
|
|
12
|
+
* both functions return without side effects — silent graceful degradation.
|
|
13
|
+
*/
|
|
14
|
+
import type { MemoryProviderContext, LoopMemoryWriteback } from "./protocol.js";
|
|
15
|
+
import type { SessionManager } from "./mcp/session.js";
|
|
16
|
+
/** Compute the project directory name the same way claude-mem does:
|
|
17
|
+
* replace every non-alphanumeric character with `-`.
|
|
18
|
+
* e.g. `C:\Users\Dell\Desktop\LoopForge` → `C--Users-Dell-Desktop-LoopForge` */
|
|
19
|
+
export declare function computeProjectHash(gitRoot: string): string;
|
|
20
|
+
/** Walk upward from cwd looking for a `.git` directory.
|
|
21
|
+
* Returns the git root path, or null if not found within 20 levels. */
|
|
22
|
+
export declare function findGitRoot(): string | null;
|
|
23
|
+
/** Check whether claude-mem has a memory directory for the current project.
|
|
24
|
+
* Returns the memory directory path and MEMORY.md path, or null. */
|
|
25
|
+
export declare function detectClaudeMem(): {
|
|
26
|
+
memoryDir: string;
|
|
27
|
+
indexPath: string;
|
|
28
|
+
} | null;
|
|
29
|
+
/** Create a memoryProvider callback bound to a specific memory directory.
|
|
30
|
+
* Reads .md files directly — no REST API dependency. */
|
|
31
|
+
export declare function createMemoryProvider(memoryDir: string): (ctx: MemoryProviderContext) => Promise<string>;
|
|
32
|
+
/** Create a memoryWriter callback bound to a specific memory directory.
|
|
33
|
+
* Writes .md files directly + appends to MEMORY.md index. */
|
|
34
|
+
export declare function createMemoryWriter(memoryDir: string, indexPath: string): (payload: LoopMemoryWriteback) => Promise<void>;
|
|
35
|
+
/** Auto-detect claude-mem and wire memoryProvider / memoryWriter onto a
|
|
36
|
+
* SessionManager instance. Called once at MCP server startup.
|
|
37
|
+
* If claude-mem is not available, this is a no-op. */
|
|
38
|
+
export declare function autoConfigureMemory(mgr: SessionManager): void;
|
|
39
|
+
/** Auto-detect claude-mem and return provider/writer callbacks.
|
|
40
|
+
* Used by the runtime library path (resolveConfig). Callers should
|
|
41
|
+
* only invoke this when the user has NOT provided explicit callbacks —
|
|
42
|
+
* explicit callbacks always take precedence. */
|
|
43
|
+
export declare function tryAutoConfigure(): {
|
|
44
|
+
memoryProvider?: (ctx: MemoryProviderContext) => Promise<string>;
|
|
45
|
+
memoryWriter?: (payload: LoopMemoryWriteback) => Promise<void>;
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=memory-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-bridge.d.ts","sourceRoot":"","sources":["../src/memory-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAaH,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMvD;;iFAEiF;AACjF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;wEACwE;AACxE,wBAAgB,WAAW,IAAI,MAAM,GAAG,IAAI,CAS3C;AAED;qEACqE;AACrE,wBAAgB,eAAe,IAAI;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAQjF;AA8FD;yDACyD;AACzD,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,GAChB,CAAC,GAAG,EAAE,qBAAqB,KAAK,OAAO,CAAC,MAAM,CAAC,CAKjD;AAiDD;8DAC8D;AAC9D,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,IAAI,CAAC,CAuGjD;AAMD;;uDAEuD;AACvD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI,CAM7D;AAED;;;iDAGiD;AACjD,wBAAgB,gBAAgB,IAAI;IAClC,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,qBAAqB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACjE,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAChE,CAQA"}
|