loopforge 1.1.1 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +2 -0
- package/dist/backends/fs.d.ts.map +1 -1
- package/dist/backends/fs.js +1 -0
- package/dist/backends/fs.js.map +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +69 -180
- package/dist/cli.js.map +1 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +6 -2
- package/dist/engine.js.map +1 -1
- package/dist/generate-schema.js +56 -4
- package/dist/generate-schema.js.map +1 -1
- package/dist/index.d.ts +17 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -7
- package/dist/index.js.map +1 -1
- package/dist/loop-compiler.js +1 -1
- package/dist/loop-compiler.js.map +1 -1
- package/dist/mcp/server.d.ts +14 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +93 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/session.d.ts +68 -0
- package/dist/mcp/session.d.ts.map +1 -0
- package/dist/mcp/session.js +343 -0
- package/dist/mcp/session.js.map +1 -0
- package/dist/mcp/tools.d.ts +128 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +237 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/mcp-server.d.ts +12 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +14 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/policy.d.ts +8 -0
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +7 -0
- package/dist/policy.js.map +1 -1
- package/dist/protocol.d.ts +68 -1
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +9 -1
- package/dist/protocol.js.map +1 -1
- package/dist/runtime.d.ts +57 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +414 -0
- package/dist/runtime.js.map +1 -0
- package/dist/tests/_helpers.d.ts +25 -0
- package/dist/tests/_helpers.d.ts.map +1 -0
- package/dist/tests/_helpers.js +47 -0
- package/dist/tests/_helpers.js.map +1 -0
- package/dist/tests/generate-schema.test.js +2 -2
- package/dist/tests/generate-schema.test.js.map +1 -1
- package/dist/tests/loop-compiler.test.js +21 -0
- package/dist/tests/loop-compiler.test.js.map +1 -1
- package/dist/tests/mcp.test.d.ts +7 -0
- package/dist/tests/mcp.test.d.ts.map +1 -0
- package/dist/tests/mcp.test.js +398 -0
- package/dist/tests/mcp.test.js.map +1 -0
- package/dist/tests/replay.test.js +69 -41
- package/dist/tests/replay.test.js.map +1 -1
- package/dist/tests/runtime.test.d.ts +7 -0
- package/dist/tests/runtime.test.d.ts.map +1 -0
- package/dist/tests/runtime.test.js +323 -0
- package/dist/tests/runtime.test.js.map +1 -0
- package/loop_policy.json +7 -0
- package/package.json +8 -6
- package/skills/perception/SKILL.md +194 -0
- package/skills/prompt-techniques/SKILL.md +52 -0
- package/skills/prompt-techniques/references/chain-of-thought.md +207 -0
- package/skills/prompt-techniques/references/few-shot.md +174 -0
- package/skills/prompt-techniques/references/least-to-most.md +182 -0
- package/skills/prompt-techniques/references/step-back.md +160 -0
- package/skills/prompt-techniques/references/tree-of-thought.md +191 -0
- package/skills/prompt-techniques/references/zero-shot.md +97 -0
- package/dist/autonomous.d.ts +0 -84
- package/dist/autonomous.d.ts.map +0 -1
- package/dist/autonomous.js +0 -250
- package/dist/autonomous.js.map +0 -1
- package/dist/backends/ai.d.ts +0 -37
- package/dist/backends/ai.d.ts.map +0 -1
- package/dist/backends/ai.js +0 -98
- package/dist/backends/ai.js.map +0 -1
- package/dist/tests/autonomous.test.d.ts +0 -7
- package/dist/tests/autonomous.test.d.ts.map +0 -1
- package/dist/tests/autonomous.test.js +0 -294
- package/dist/tests/autonomous.test.js.map +0 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/** LoopForge MCP — JSON-RPC transport over stdio.
|
|
2
|
+
*
|
|
3
|
+
* Implements the MCP protocol: initialize → tools/list → tools/call.
|
|
4
|
+
* Uses node:readline for stdin, writes JSON-RPC responses to stdout.
|
|
5
|
+
* All logging goes to stderr to keep stdout clean.
|
|
6
|
+
*/
|
|
7
|
+
import { createInterface } from "node:readline";
|
|
8
|
+
import { SessionManager } from "./session.js";
|
|
9
|
+
import { TOOL_SCHEMAS, TOOL_HANDLERS } from "./tools.js";
|
|
10
|
+
const SERVER_INFO = {
|
|
11
|
+
name: "loopforge-mcp",
|
|
12
|
+
version: "1.3.0",
|
|
13
|
+
};
|
|
14
|
+
function errorResponse(id, code, message) {
|
|
15
|
+
return JSON.stringify({
|
|
16
|
+
jsonrpc: "2.0",
|
|
17
|
+
id: id ?? null,
|
|
18
|
+
error: { code, message },
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function okResponse(id, result) {
|
|
22
|
+
if (id === undefined)
|
|
23
|
+
return ""; // notification — no response
|
|
24
|
+
return JSON.stringify({ jsonrpc: "2.0", id, result });
|
|
25
|
+
}
|
|
26
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
27
|
+
// Server
|
|
28
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
29
|
+
export class McpServer {
|
|
30
|
+
mgr;
|
|
31
|
+
constructor(backend) {
|
|
32
|
+
this.mgr = new SessionManager(backend);
|
|
33
|
+
}
|
|
34
|
+
start() {
|
|
35
|
+
const rl = createInterface({ input: process.stdin });
|
|
36
|
+
rl.on("line", (line) => {
|
|
37
|
+
let req;
|
|
38
|
+
try {
|
|
39
|
+
req = JSON.parse(line);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
process.stderr.write(`[loopforge-mcp] bad JSON: ${line.slice(0, 80)}\n`);
|
|
43
|
+
process.stdout.write(errorResponse(undefined, -32700, "Parse error") + "\n");
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
// Notifications (no id) — ignore
|
|
47
|
+
if (req.id === undefined) {
|
|
48
|
+
process.stderr.write(`[loopforge-mcp] notification: ${req.method}\n`);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
const result = this.dispatch(req);
|
|
53
|
+
if (result !== null) {
|
|
54
|
+
process.stdout.write(okResponse(req.id, result) + "\n");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
59
|
+
process.stderr.write(`[loopforge-mcp] dispatch error: ${msg}\n`);
|
|
60
|
+
process.stdout.write(errorResponse(req.id, -32603, msg) + "\n");
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
process.stderr.write(`[loopforge-mcp] v${SERVER_INFO.version} started\n`);
|
|
64
|
+
}
|
|
65
|
+
dispatch(req) {
|
|
66
|
+
switch (req.method) {
|
|
67
|
+
case "initialize":
|
|
68
|
+
return {
|
|
69
|
+
protocolVersion: "2024-11-05",
|
|
70
|
+
capabilities: { tools: {} },
|
|
71
|
+
serverInfo: SERVER_INFO,
|
|
72
|
+
};
|
|
73
|
+
case "tools/list":
|
|
74
|
+
return { tools: TOOL_SCHEMAS };
|
|
75
|
+
case "tools/call": {
|
|
76
|
+
const params = req.params ?? {};
|
|
77
|
+
const name = String(params.name ?? "");
|
|
78
|
+
const args = params.arguments ?? {};
|
|
79
|
+
const handler = TOOL_HANDLERS[name];
|
|
80
|
+
if (!handler) {
|
|
81
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
82
|
+
}
|
|
83
|
+
const output = handler(this.mgr, args);
|
|
84
|
+
return {
|
|
85
|
+
content: [{ type: "text", text: JSON.stringify(output) }],
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
default:
|
|
89
|
+
throw new Error(`Unknown method: ${req.method}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources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AmB;QAClC,QAAQ,GAAG,CAAC,MAAM,EAAE,CAAC;YACnB,KAAK,YAAY;gBACf,OAAO;oBACL,eAAe,EAAE,YAAY;oBAC7B,YAAY,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;oBAC3B,UAAU,EAAE,WAAW;iBACxB,CAAC;YAEJ,KAAK,YAAY;gBACf,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;YAEjC,KAAK,YAAY,CAAC,CAAC,CAAC;gBAClB,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC;gBAChC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;gBACvC,MAAM,IAAI,GAAI,MAAM,CAAC,SAAqC,IAAI,EAAE,CAAC;gBAEjE,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;gBACpC,IAAI,CAAC,OAAO,EAAE,CAAC;oBACb,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;gBAC3C,CAAC;gBAED,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;gBACvC,OAAO;oBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;iBAC1D,CAAC;YACJ,CAAC;YAED;gBACE,MAAM,IAAI,KAAK,CAAC,mBAAmB,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** LoopForge MCP — Session manager.
|
|
2
|
+
*
|
|
3
|
+
* Each McpSession = one complete multi-round loop.
|
|
4
|
+
* SessionManager holds Map<sessionId, McpSession> and drives
|
|
5
|
+
* the advance() cycle: extract → feedback → check stop → compile next.
|
|
6
|
+
*/
|
|
7
|
+
import { LoopForgeEngine } from "../engine.js";
|
|
8
|
+
import type { VaultBackend } from "../backends/interface.js";
|
|
9
|
+
export interface McpSession {
|
|
10
|
+
sessionId: string;
|
|
11
|
+
loopId: string;
|
|
12
|
+
task: string;
|
|
13
|
+
engine: LoopForgeEngine;
|
|
14
|
+
currentRound: number;
|
|
15
|
+
maxRounds: number;
|
|
16
|
+
qualityTrajectory: number[];
|
|
17
|
+
status: "running" | "stopped" | "stalled";
|
|
18
|
+
createdAt: number;
|
|
19
|
+
}
|
|
20
|
+
export interface McpSessionSummary {
|
|
21
|
+
sessionId: string;
|
|
22
|
+
loopId: string;
|
|
23
|
+
round: number;
|
|
24
|
+
status: "running" | "stopped" | "stalled";
|
|
25
|
+
}
|
|
26
|
+
export interface StartInput {
|
|
27
|
+
task: string;
|
|
28
|
+
loopId?: string;
|
|
29
|
+
maxRounds?: number;
|
|
30
|
+
domain?: string;
|
|
31
|
+
planSource?: string;
|
|
32
|
+
constraints?: string[];
|
|
33
|
+
}
|
|
34
|
+
export interface AdvanceResult {
|
|
35
|
+
sessionId: string;
|
|
36
|
+
round: number;
|
|
37
|
+
prompt: string | null;
|
|
38
|
+
stopReason?: string;
|
|
39
|
+
technique?: string;
|
|
40
|
+
level?: string;
|
|
41
|
+
quality?: number;
|
|
42
|
+
warnings?: string[];
|
|
43
|
+
}
|
|
44
|
+
export declare class SessionManager {
|
|
45
|
+
private sessions;
|
|
46
|
+
private backend;
|
|
47
|
+
constructor(backend?: VaultBackend);
|
|
48
|
+
create(input: StartInput): AdvanceResult;
|
|
49
|
+
get(sessionId: string): McpSession | undefined;
|
|
50
|
+
delete(sessionId: string): boolean;
|
|
51
|
+
/** Persist session state to vault for cross-process recovery.
|
|
52
|
+
* Uses upsert: removes any previous session_state entry for this loop,
|
|
53
|
+
* then appends a new one with current state. */
|
|
54
|
+
save(session: McpSession): void;
|
|
55
|
+
/** Resume a loop from vault state.
|
|
56
|
+
* Reconstructs the session and compiles the prompt for the next round.
|
|
57
|
+
* Returns null if no session_state entry exists for this loopId. */
|
|
58
|
+
resume(loopId: string): AdvanceResult | null;
|
|
59
|
+
list(): McpSessionSummary[];
|
|
60
|
+
/** Get loop health for a loop (in-memory or vault).
|
|
61
|
+
* Computes goal alignment, constraint integrity, drift, strategy stability. */
|
|
62
|
+
getHealth(loopId: string): Record<string, unknown> | null;
|
|
63
|
+
/** Core cycle: extract self-eval → record feedback → check stop → compile next. */
|
|
64
|
+
advance(sessionId: string, output: string): AdvanceResult;
|
|
65
|
+
/** Replay timeline for a session — creates ReplayBackend from the stored backend. */
|
|
66
|
+
replayTimeline(sessionId: string): Record<string, unknown>[] | null;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/mcp/session.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,eAAe,EAAkD,MAAM,cAAc,CAAC;AAM/F,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,0BAA0B,CAAC;AAKzE,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;IAC1C,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;CAC3C;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM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CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,IAAI;CAQpE"}
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
/** LoopForge MCP — Session manager.
|
|
2
|
+
*
|
|
3
|
+
* Each McpSession = one complete multi-round loop.
|
|
4
|
+
* SessionManager holds Map<sessionId, McpSession> and drives
|
|
5
|
+
* the advance() cycle: extract → feedback → check stop → compile next.
|
|
6
|
+
*/
|
|
7
|
+
import { randomUUID } from "node:crypto";
|
|
8
|
+
import { LoopForgeEngine, extractSelfEvaluation, heuristicSelfEvaluation } from "../engine.js";
|
|
9
|
+
import { checkLoopHealth } from "../loop-compiler.js";
|
|
10
|
+
import { getPolicy } from "../policy.js";
|
|
11
|
+
import { Mode, makeLoopCompileRequest, makeVaultConfig } from "../protocol.js";
|
|
12
|
+
import { ReplayBackend } from "../replay.js";
|
|
13
|
+
import { FSBackend } from "../backends/fs.js";
|
|
14
|
+
// ── Helpers ────────────────────────────────────────────────────────────────
|
|
15
|
+
function buildLoopRequest(session, lastEval, lastQuality) {
|
|
16
|
+
const req = {
|
|
17
|
+
task: session.task,
|
|
18
|
+
mode: Mode.LOOP_COMPILE,
|
|
19
|
+
vault_config: makeVaultConfig(),
|
|
20
|
+
feedback: null,
|
|
21
|
+
skill_name: null,
|
|
22
|
+
task_id: null,
|
|
23
|
+
loop_id: session.loopId,
|
|
24
|
+
round: session.currentRound,
|
|
25
|
+
};
|
|
26
|
+
if (lastEval && lastQuality !== undefined) {
|
|
27
|
+
req.last_round_result = {
|
|
28
|
+
round: session.currentRound - 1,
|
|
29
|
+
success: lastEval.success,
|
|
30
|
+
output_summary: lastEval.output_summary,
|
|
31
|
+
constraint_violations: lastEval.constraint_violations,
|
|
32
|
+
manual_fixes_needed: "",
|
|
33
|
+
quality_score: lastQuality,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return req;
|
|
37
|
+
}
|
|
38
|
+
function parseLevel(rationale) {
|
|
39
|
+
if (!rationale)
|
|
40
|
+
return "l2";
|
|
41
|
+
if (rationale.includes("l0"))
|
|
42
|
+
return "l0";
|
|
43
|
+
if (rationale.includes("l1"))
|
|
44
|
+
return "l1";
|
|
45
|
+
return "l2";
|
|
46
|
+
}
|
|
47
|
+
function parseWarnings(prompt) {
|
|
48
|
+
if (!prompt)
|
|
49
|
+
return [];
|
|
50
|
+
const warnings = [];
|
|
51
|
+
const warnSection = prompt.match(/### Warnings\n([\s\S]*?)(?=\n###|\n\*\*|$)/);
|
|
52
|
+
if (warnSection) {
|
|
53
|
+
for (const line of warnSection[1].split("\n")) {
|
|
54
|
+
const m = line.match(/- ⚠️\s*(.+)/);
|
|
55
|
+
if (m)
|
|
56
|
+
warnings.push(m[1]);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return warnings;
|
|
60
|
+
}
|
|
61
|
+
// ── SessionManager ─────────────────────────────────────────────────────────
|
|
62
|
+
export class SessionManager {
|
|
63
|
+
sessions = new Map();
|
|
64
|
+
backend;
|
|
65
|
+
constructor(backend) {
|
|
66
|
+
this.backend = backend;
|
|
67
|
+
}
|
|
68
|
+
create(input) {
|
|
69
|
+
const sessionId = randomUUID();
|
|
70
|
+
const loopId = input.loopId ?? randomUUID();
|
|
71
|
+
const engine = new LoopForgeEngine("skills", this.backend);
|
|
72
|
+
const maxRounds = input.maxRounds ?? getPolicy().runtime.max_rounds;
|
|
73
|
+
// Populate extra fields for the first round
|
|
74
|
+
const request = buildLoopRequest({
|
|
75
|
+
sessionId, loopId, task: input.task, engine, currentRound: 1,
|
|
76
|
+
maxRounds, qualityTrajectory: [], status: "running", createdAt: Date.now(),
|
|
77
|
+
});
|
|
78
|
+
request.domain = input.domain ?? "";
|
|
79
|
+
request.plan_source = input.planSource ?? null;
|
|
80
|
+
request.constraints_from_plan = input.constraints ?? [];
|
|
81
|
+
const result = engine.invokeLoopCompile(request);
|
|
82
|
+
const session = {
|
|
83
|
+
sessionId, loopId, task: input.task, engine,
|
|
84
|
+
currentRound: 1, maxRounds, qualityTrajectory: [],
|
|
85
|
+
status: "running", createdAt: Date.now(),
|
|
86
|
+
};
|
|
87
|
+
this.sessions.set(sessionId, session);
|
|
88
|
+
// Persist to vault for cross-process recovery
|
|
89
|
+
this.save(session);
|
|
90
|
+
return {
|
|
91
|
+
sessionId,
|
|
92
|
+
round: 1,
|
|
93
|
+
prompt: result.response?.prompt ?? null,
|
|
94
|
+
technique: result.response?.analysis?.technique ?? "zero-shot",
|
|
95
|
+
level: parseLevel(result.response?.analysis?.rationale),
|
|
96
|
+
quality: 0,
|
|
97
|
+
warnings: parseWarnings(result.response?.prompt ?? null),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
get(sessionId) {
|
|
101
|
+
return this.sessions.get(sessionId);
|
|
102
|
+
}
|
|
103
|
+
delete(sessionId) {
|
|
104
|
+
const session = this.sessions.get(sessionId);
|
|
105
|
+
if (!session)
|
|
106
|
+
return false;
|
|
107
|
+
session.status = "stopped";
|
|
108
|
+
this.sessions.delete(sessionId);
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
/** Persist session state to vault for cross-process recovery.
|
|
112
|
+
* Uses upsert: removes any previous session_state entry for this loop,
|
|
113
|
+
* then appends a new one with current state. */
|
|
114
|
+
save(session) {
|
|
115
|
+
if (!this.backend)
|
|
116
|
+
return;
|
|
117
|
+
// Upsert: remove old session_state entries for this loop
|
|
118
|
+
const vault = this.backend.readVault();
|
|
119
|
+
const entries = vault.entries || [];
|
|
120
|
+
vault.entries = entries.filter((e) => !(e.task_type === "session_state" && e.loop_id === session.loopId));
|
|
121
|
+
this.backend.writeVault(vault);
|
|
122
|
+
// Append fresh session state
|
|
123
|
+
this.backend.appendEntry({
|
|
124
|
+
task_id: `loop:${session.loopId}:session`,
|
|
125
|
+
task_type: "session_state",
|
|
126
|
+
timestamp: new Date().toISOString(),
|
|
127
|
+
loop_id: session.loopId,
|
|
128
|
+
task: session.task,
|
|
129
|
+
loop_lineage: {
|
|
130
|
+
session_id: session.sessionId,
|
|
131
|
+
current_round: session.currentRound,
|
|
132
|
+
max_rounds: session.maxRounds,
|
|
133
|
+
quality_trajectory: session.qualityTrajectory,
|
|
134
|
+
status: session.status,
|
|
135
|
+
created_at: session.createdAt,
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
/** Resume a loop from vault state.
|
|
140
|
+
* Reconstructs the session and compiles the prompt for the next round.
|
|
141
|
+
* Returns null if no session_state entry exists for this loopId. */
|
|
142
|
+
resume(loopId) {
|
|
143
|
+
if (!this.backend)
|
|
144
|
+
return null;
|
|
145
|
+
const entries = this.backend.queryEntries({
|
|
146
|
+
prefix: `loop:${loopId}:session`,
|
|
147
|
+
});
|
|
148
|
+
const sessionEntry = entries.find((e) => e.task_type === "session_state");
|
|
149
|
+
if (!sessionEntry)
|
|
150
|
+
return null;
|
|
151
|
+
const lineage = (sessionEntry.loop_lineage ?? {});
|
|
152
|
+
const status = lineage.status ?? "running";
|
|
153
|
+
const currentRound = lineage.current_round ?? 1;
|
|
154
|
+
const qualityTrajectory = lineage.quality_trajectory ?? [];
|
|
155
|
+
const task = sessionEntry.task ?? "";
|
|
156
|
+
const maxRounds = lineage.max_rounds ?? getPolicy().runtime.max_rounds;
|
|
157
|
+
// If the loop was already stopped or stalled, return immediately
|
|
158
|
+
if (status !== "running") {
|
|
159
|
+
return {
|
|
160
|
+
sessionId: "",
|
|
161
|
+
round: currentRound,
|
|
162
|
+
prompt: null,
|
|
163
|
+
stopReason: status,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
// Reconstruct session with a fresh engine
|
|
167
|
+
const engine = new LoopForgeEngine("skills", this.backend);
|
|
168
|
+
const sessionId = randomUUID();
|
|
169
|
+
const session = {
|
|
170
|
+
sessionId,
|
|
171
|
+
loopId,
|
|
172
|
+
task,
|
|
173
|
+
engine,
|
|
174
|
+
currentRound,
|
|
175
|
+
maxRounds,
|
|
176
|
+
qualityTrajectory,
|
|
177
|
+
status: "running",
|
|
178
|
+
createdAt: lineage.created_at ?? Date.now(),
|
|
179
|
+
};
|
|
180
|
+
this.sessions.set(sessionId, session);
|
|
181
|
+
// Compile the next round's prompt from vault lineage
|
|
182
|
+
const request = buildLoopRequest(session);
|
|
183
|
+
const result = engine.invokeLoopCompile(request);
|
|
184
|
+
return {
|
|
185
|
+
sessionId,
|
|
186
|
+
round: currentRound,
|
|
187
|
+
prompt: result.response?.prompt ?? null,
|
|
188
|
+
technique: result.response?.analysis?.technique ?? "zero-shot",
|
|
189
|
+
level: parseLevel(result.response?.analysis?.rationale),
|
|
190
|
+
quality: 0,
|
|
191
|
+
warnings: parseWarnings(result.response?.prompt ?? null),
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
list() {
|
|
195
|
+
const seen = new Set();
|
|
196
|
+
const result = [];
|
|
197
|
+
// In-memory sessions first (take priority)
|
|
198
|
+
for (const s of this.sessions.values()) {
|
|
199
|
+
seen.add(s.loopId);
|
|
200
|
+
result.push({
|
|
201
|
+
sessionId: s.sessionId,
|
|
202
|
+
loopId: s.loopId,
|
|
203
|
+
round: s.currentRound,
|
|
204
|
+
status: s.status,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
// Merge vault-persisted sessions not already in memory
|
|
208
|
+
if (this.backend) {
|
|
209
|
+
const vault = this.backend.readVault();
|
|
210
|
+
const entries = vault.entries ?? [];
|
|
211
|
+
for (const e of entries) {
|
|
212
|
+
if (e.task_type !== "session_state")
|
|
213
|
+
continue;
|
|
214
|
+
const lid = e.loop_id ?? "";
|
|
215
|
+
if (!lid || seen.has(lid))
|
|
216
|
+
continue;
|
|
217
|
+
seen.add(lid);
|
|
218
|
+
const lineage = (e.loop_lineage ?? {});
|
|
219
|
+
result.push({
|
|
220
|
+
sessionId: "",
|
|
221
|
+
loopId: lid,
|
|
222
|
+
round: lineage.current_round ?? 1,
|
|
223
|
+
status: (lineage.status || "running"),
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return result;
|
|
228
|
+
}
|
|
229
|
+
/** Get loop health for a loop (in-memory or vault).
|
|
230
|
+
* Computes goal alignment, constraint integrity, drift, strategy stability. */
|
|
231
|
+
getHealth(loopId) {
|
|
232
|
+
// Find the task — check in-memory sessions first, then vault
|
|
233
|
+
let task = "";
|
|
234
|
+
let goalId = loopId;
|
|
235
|
+
for (const s of this.sessions.values()) {
|
|
236
|
+
if (s.loopId === loopId) {
|
|
237
|
+
task = s.task;
|
|
238
|
+
if (s.engine.state?.task_id) {
|
|
239
|
+
goalId = s.engine.state.task_id;
|
|
240
|
+
}
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
// Fall back to vault for task
|
|
245
|
+
if (!task && this.backend) {
|
|
246
|
+
const entries = this.backend.queryEntries({
|
|
247
|
+
prefix: `loop:${loopId}:session`,
|
|
248
|
+
});
|
|
249
|
+
const sessionEntry = entries.find((e) => e.task_type === "session_state");
|
|
250
|
+
if (sessionEntry) {
|
|
251
|
+
task = sessionEntry.task ?? "";
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (!task)
|
|
255
|
+
return null;
|
|
256
|
+
// Hydrate vault context
|
|
257
|
+
const engine = new LoopForgeEngine("skills", this.backend);
|
|
258
|
+
const vaultContext = engine.hydrateLoopContext(loopId);
|
|
259
|
+
// Build a minimal request for health check
|
|
260
|
+
const request = makeLoopCompileRequest({
|
|
261
|
+
task,
|
|
262
|
+
loop_id: loopId,
|
|
263
|
+
goal_id: goalId,
|
|
264
|
+
round: 1, // round doesn't matter for health check
|
|
265
|
+
});
|
|
266
|
+
const health = checkLoopHealth(loopId, request, vaultContext);
|
|
267
|
+
return {
|
|
268
|
+
loopId,
|
|
269
|
+
goal_alignment: health.goal_alignment,
|
|
270
|
+
constraint_integrity: health.constraint_integrity,
|
|
271
|
+
drift_detected: health.drift_detected,
|
|
272
|
+
strategy_stability: health.strategy_stability,
|
|
273
|
+
task_continuity: health.task_continuity,
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
/** Core cycle: extract self-eval → record feedback → check stop → compile next. */
|
|
277
|
+
advance(sessionId, output) {
|
|
278
|
+
const session = this.sessions.get(sessionId);
|
|
279
|
+
if (!session)
|
|
280
|
+
return { sessionId, round: 0, prompt: null, stopReason: "session_not_found" };
|
|
281
|
+
if (session.status !== "running") {
|
|
282
|
+
return { sessionId, round: session.currentRound, prompt: null, stopReason: session.status };
|
|
283
|
+
}
|
|
284
|
+
// 1. Extract self-evaluation
|
|
285
|
+
const structured = extractSelfEvaluation(output);
|
|
286
|
+
const extractionFailed = structured === null;
|
|
287
|
+
const selfEval = structured ?? heuristicSelfEvaluation(output);
|
|
288
|
+
// Guard: if both extraction methods returned null, stop
|
|
289
|
+
if (!selfEval) {
|
|
290
|
+
session.status = "stalled";
|
|
291
|
+
this.save(session);
|
|
292
|
+
return { sessionId, round: session.currentRound, prompt: null, stopReason: "stalled", quality: 0 };
|
|
293
|
+
}
|
|
294
|
+
// 2. Record feedback (flushes immediately so next compile sees scores)
|
|
295
|
+
const quality = session.engine.autoFeedback(selfEval, session.loopId, session.currentRound, session.task);
|
|
296
|
+
session.qualityTrajectory.push(quality);
|
|
297
|
+
// 3. Stop conditions (extraction-first order — see memory)
|
|
298
|
+
if (extractionFailed) {
|
|
299
|
+
session.status = "stalled";
|
|
300
|
+
this.save(session);
|
|
301
|
+
return { sessionId, round: session.currentRound, prompt: null, stopReason: "stalled", quality };
|
|
302
|
+
}
|
|
303
|
+
if (!selfEval.should_continue) {
|
|
304
|
+
session.status = "stopped";
|
|
305
|
+
this.save(session);
|
|
306
|
+
return { sessionId, round: session.currentRound, prompt: null, stopReason: "task_complete", quality };
|
|
307
|
+
}
|
|
308
|
+
if (session.engine.shouldBreak()) {
|
|
309
|
+
session.status = "stopped";
|
|
310
|
+
this.save(session);
|
|
311
|
+
return { sessionId, round: session.currentRound, prompt: null, stopReason: "circuit_breaker", quality };
|
|
312
|
+
}
|
|
313
|
+
if (session.currentRound >= session.maxRounds) {
|
|
314
|
+
session.status = "stopped";
|
|
315
|
+
this.save(session);
|
|
316
|
+
return { sessionId, round: session.currentRound, prompt: null, stopReason: "max_rounds", quality };
|
|
317
|
+
}
|
|
318
|
+
// 4. Compile next round
|
|
319
|
+
session.currentRound++;
|
|
320
|
+
const request = buildLoopRequest(session, selfEval, quality);
|
|
321
|
+
const result = session.engine.invokeLoopCompile(request);
|
|
322
|
+
this.save(session);
|
|
323
|
+
return {
|
|
324
|
+
sessionId,
|
|
325
|
+
round: session.currentRound,
|
|
326
|
+
prompt: result.response?.prompt ?? null,
|
|
327
|
+
technique: result.response?.analysis?.technique ?? "zero-shot",
|
|
328
|
+
level: parseLevel(result.response?.analysis?.rationale),
|
|
329
|
+
quality,
|
|
330
|
+
warnings: parseWarnings(result.response?.prompt ?? null),
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
/** Replay timeline for a session — creates ReplayBackend from the stored backend. */
|
|
334
|
+
replayTimeline(sessionId) {
|
|
335
|
+
const session = this.sessions.get(sessionId);
|
|
336
|
+
if (!session)
|
|
337
|
+
return null;
|
|
338
|
+
const vaultBackend = this.backend ?? new FSBackend();
|
|
339
|
+
const replay = new ReplayBackend(vaultBackend);
|
|
340
|
+
return replay.timeline(session.loopId);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/mcp/session.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC/F,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,sBAA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CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEnB,OAAO;YACL,SAAS;YACT,KAAK,EAAE,OAAO,CAAC,YAAY;YAC3B,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,IAAI,IAAI;YACvC,SAAS,EAAE,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,IAAI,WAAW;YAC9D,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC;YACvD,OAAO;YACP,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,IAAI,IAAI,CAAC;SACzD,CAAC;IACJ,CAAC;IAED,qFAAqF;IACrF,cAAc,CAAC,SAAiB;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC7C,IAAI,CAAC,OAAO;YAAE,OAAO,IAAI,CAAC;QAE1B,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,SAAS,EAAE,CAAC;QACrD,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,YAAY,CAAC,CAAC;QAC/C,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;CACF"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/** LoopForge MCP — Tool definitions and handlers.
|
|
2
|
+
*
|
|
3
|
+
* 6 tools: start, next, status, stop, list, replay.
|
|
4
|
+
* Each handler receives SessionManager + parsed input, returns the output object.
|
|
5
|
+
*/
|
|
6
|
+
import type { SessionManager } from "./session.js";
|
|
7
|
+
export declare const TOOL_SCHEMAS: ({
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: "object";
|
|
12
|
+
properties: {
|
|
13
|
+
task: {
|
|
14
|
+
type: "string";
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
loopId: {
|
|
18
|
+
type: "string";
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
maxRounds: {
|
|
22
|
+
type: "number";
|
|
23
|
+
description: string;
|
|
24
|
+
};
|
|
25
|
+
domain: {
|
|
26
|
+
type: "string";
|
|
27
|
+
description: string;
|
|
28
|
+
};
|
|
29
|
+
planSource: {
|
|
30
|
+
type: "string";
|
|
31
|
+
description: string;
|
|
32
|
+
};
|
|
33
|
+
constraints: {
|
|
34
|
+
type: "array";
|
|
35
|
+
items: {
|
|
36
|
+
type: "string";
|
|
37
|
+
};
|
|
38
|
+
description: string;
|
|
39
|
+
};
|
|
40
|
+
sessionId?: undefined;
|
|
41
|
+
output?: undefined;
|
|
42
|
+
};
|
|
43
|
+
required: string[];
|
|
44
|
+
};
|
|
45
|
+
} | {
|
|
46
|
+
name: string;
|
|
47
|
+
description: string;
|
|
48
|
+
inputSchema: {
|
|
49
|
+
type: "object";
|
|
50
|
+
properties: {
|
|
51
|
+
sessionId: {
|
|
52
|
+
type: "string";
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
55
|
+
output: {
|
|
56
|
+
type: "string";
|
|
57
|
+
description: string;
|
|
58
|
+
};
|
|
59
|
+
task?: undefined;
|
|
60
|
+
loopId?: undefined;
|
|
61
|
+
maxRounds?: undefined;
|
|
62
|
+
domain?: undefined;
|
|
63
|
+
planSource?: undefined;
|
|
64
|
+
constraints?: undefined;
|
|
65
|
+
};
|
|
66
|
+
required: string[];
|
|
67
|
+
};
|
|
68
|
+
} | {
|
|
69
|
+
name: string;
|
|
70
|
+
description: string;
|
|
71
|
+
inputSchema: {
|
|
72
|
+
type: "object";
|
|
73
|
+
properties: {
|
|
74
|
+
sessionId: {
|
|
75
|
+
type: "string";
|
|
76
|
+
description: string;
|
|
77
|
+
};
|
|
78
|
+
task?: undefined;
|
|
79
|
+
loopId?: undefined;
|
|
80
|
+
maxRounds?: undefined;
|
|
81
|
+
domain?: undefined;
|
|
82
|
+
planSource?: undefined;
|
|
83
|
+
constraints?: undefined;
|
|
84
|
+
output?: undefined;
|
|
85
|
+
};
|
|
86
|
+
required: string[];
|
|
87
|
+
};
|
|
88
|
+
} | {
|
|
89
|
+
name: string;
|
|
90
|
+
description: string;
|
|
91
|
+
inputSchema: {
|
|
92
|
+
type: "object";
|
|
93
|
+
properties: {
|
|
94
|
+
task?: undefined;
|
|
95
|
+
loopId?: undefined;
|
|
96
|
+
maxRounds?: undefined;
|
|
97
|
+
domain?: undefined;
|
|
98
|
+
planSource?: undefined;
|
|
99
|
+
constraints?: undefined;
|
|
100
|
+
sessionId?: undefined;
|
|
101
|
+
output?: undefined;
|
|
102
|
+
};
|
|
103
|
+
required: never[];
|
|
104
|
+
};
|
|
105
|
+
} | {
|
|
106
|
+
name: string;
|
|
107
|
+
description: string;
|
|
108
|
+
inputSchema: {
|
|
109
|
+
type: "object";
|
|
110
|
+
properties: {
|
|
111
|
+
loopId: {
|
|
112
|
+
type: "string";
|
|
113
|
+
description: string;
|
|
114
|
+
};
|
|
115
|
+
task?: undefined;
|
|
116
|
+
maxRounds?: undefined;
|
|
117
|
+
domain?: undefined;
|
|
118
|
+
planSource?: undefined;
|
|
119
|
+
constraints?: undefined;
|
|
120
|
+
sessionId?: undefined;
|
|
121
|
+
output?: undefined;
|
|
122
|
+
};
|
|
123
|
+
required: string[];
|
|
124
|
+
};
|
|
125
|
+
})[];
|
|
126
|
+
export type ToolHandler = (mgr: SessionManager, input: Record<string, unknown>) => Record<string, unknown>;
|
|
127
|
+
export declare const TOOL_HANDLERS: Record<string, ToolHandler>;
|
|
128
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +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;AAM/D,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6IxB,CAAC;AAMF,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE3G,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAyGrD,CAAC"}
|