jfl 0.9.9 → 0.9.11
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/dist/commands/init-from-service.d.ts.map +1 -1
- package/dist/commands/init-from-service.js +2 -2
- package/dist/commands/init-from-service.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +88 -23
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/peter.d.ts.map +1 -1
- package/dist/commands/peter.js +112 -35
- package/dist/commands/peter.js.map +1 -1
- package/dist/commands/repair.d.ts.map +1 -1
- package/dist/commands/repair.js +13 -11
- package/dist/commands/repair.js.map +1 -1
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +7 -40
- package/dist/commands/session.js.map +1 -1
- package/dist/commands/start.js +3 -3
- package/dist/commands/start.js.map +1 -1
- package/dist/lib/agent-config.d.ts +1 -0
- package/dist/lib/agent-config.d.ts.map +1 -1
- package/dist/lib/agent-config.js.map +1 -1
- package/dist/lib/agent-guards.d.ts +67 -0
- package/dist/lib/agent-guards.d.ts.map +1 -0
- package/dist/lib/agent-guards.js +229 -0
- package/dist/lib/agent-guards.js.map +1 -0
- package/dist/lib/agent-runtime-api.d.ts +32 -0
- package/dist/lib/agent-runtime-api.d.ts.map +1 -0
- package/dist/lib/agent-runtime-api.js +270 -0
- package/dist/lib/agent-runtime-api.js.map +1 -0
- package/dist/lib/agent-session.d.ts.map +1 -1
- package/dist/lib/agent-session.js +255 -25
- package/dist/lib/agent-session.js.map +1 -1
- package/dist/lib/gtm-generator.js +3 -1
- package/dist/lib/gtm-generator.js.map +1 -1
- package/dist/lib/memory-search.d.ts.map +1 -1
- package/dist/lib/memory-search.js +0 -8
- package/dist/lib/memory-search.js.map +1 -1
- package/dist/utils/jfl-paths.d.ts +9 -0
- package/dist/utils/jfl-paths.d.ts.map +1 -1
- package/dist/utils/jfl-paths.js +13 -0
- package/dist/utils/jfl-paths.js.map +1 -1
- package/package.json +1 -1
- package/packages/pi/dist/index.d.ts.map +1 -1
- package/packages/pi/dist/index.js +19 -1
- package/packages/pi/dist/index.js.map +1 -1
- package/packages/pi/dist/session.d.ts +5 -1
- package/packages/pi/dist/session.d.ts.map +1 -1
- package/packages/pi/dist/session.js +247 -116
- package/packages/pi/dist/session.js.map +1 -1
- package/packages/pi/extensions/index.ts +24 -1
- package/packages/pi/extensions/session.ts +256 -96
- package/packages/pi/skills/end/SKILL.md +8 -0
- package/scripts/session/session-cleanup.sh +19 -6
- package/template/.github/workflows/jfl-eval.yml +8 -1
- package/template/scripts/session/session-cleanup.sh +23 -8
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Guards
|
|
3
|
+
*
|
|
4
|
+
* Pre-flight checks that run before an agent session starts.
|
|
5
|
+
* Implements the TOCTOU guard pattern used elsewhere (hub-health.ts, planning-loop.ts)
|
|
6
|
+
* but scoped to the agent runner lifecycle.
|
|
7
|
+
*
|
|
8
|
+
* Guards are composable: each returns a GuardResult, and runGuards() aggregates them.
|
|
9
|
+
* Non-critical guards warn but don't block; critical guards abort the session.
|
|
10
|
+
*
|
|
11
|
+
* @purpose Pre-flight guard checks for scoped agent runner sessions
|
|
12
|
+
* @invariant HubRequiredForScheduling (SystemSpec.tla)
|
|
13
|
+
*/
|
|
14
|
+
import { existsSync, readFileSync, readdirSync } from "fs";
|
|
15
|
+
import { join } from "path";
|
|
16
|
+
import { spawnSync } from "child_process";
|
|
17
|
+
// ============================================================================
|
|
18
|
+
// Individual Guards
|
|
19
|
+
// ============================================================================
|
|
20
|
+
/**
|
|
21
|
+
* Guard: Hub must be reachable before starting an agent session.
|
|
22
|
+
* Critical: false — agents can run without hub, but results won't be tracked.
|
|
23
|
+
*
|
|
24
|
+
* Re-implements the TOCTOU pattern from hub-health.ts for the agent runner path.
|
|
25
|
+
*/
|
|
26
|
+
export async function guardHub(projectRoot) {
|
|
27
|
+
try {
|
|
28
|
+
const { checkHubHealth } = await import("./hub-health.js");
|
|
29
|
+
const status = await checkHubHealth(projectRoot);
|
|
30
|
+
if (status.available) {
|
|
31
|
+
return {
|
|
32
|
+
name: "hub",
|
|
33
|
+
passed: true,
|
|
34
|
+
critical: false,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
name: "hub",
|
|
39
|
+
passed: false,
|
|
40
|
+
critical: false,
|
|
41
|
+
reason: `Hub unavailable (${status.error}). Agent will run but results won't be tracked.`,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return {
|
|
46
|
+
name: "hub",
|
|
47
|
+
passed: false,
|
|
48
|
+
critical: false,
|
|
49
|
+
reason: "Hub health check unavailable. Agent will run but results won't be tracked.",
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Guard: No concurrent session for the same agent.
|
|
55
|
+
* Critical: true — running two sessions on the same agent causes git conflicts.
|
|
56
|
+
*/
|
|
57
|
+
export function guardNoConcurrentSession(projectRoot, agentName) {
|
|
58
|
+
const sessionsDir = join(projectRoot, ".jfl", "sessions");
|
|
59
|
+
if (!existsSync(sessionsDir)) {
|
|
60
|
+
return { name: "concurrent_session", passed: true, critical: true };
|
|
61
|
+
}
|
|
62
|
+
let entries;
|
|
63
|
+
try {
|
|
64
|
+
entries = readdirSync(sessionsDir);
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return { name: "concurrent_session", passed: true, critical: true };
|
|
68
|
+
}
|
|
69
|
+
for (const entry of entries) {
|
|
70
|
+
// Only check sessions for this specific agent
|
|
71
|
+
if (!entry.startsWith(`${agentName}-`))
|
|
72
|
+
continue;
|
|
73
|
+
const statePath = join(sessionsDir, entry, "state.json");
|
|
74
|
+
if (!existsSync(statePath))
|
|
75
|
+
continue;
|
|
76
|
+
try {
|
|
77
|
+
const state = JSON.parse(readFileSync(statePath, "utf-8"));
|
|
78
|
+
if (state.status === "active") {
|
|
79
|
+
// Check if the worktree still exists (session might be stale)
|
|
80
|
+
if (state.worktreePath && existsSync(state.worktreePath)) {
|
|
81
|
+
return {
|
|
82
|
+
name: "concurrent_session",
|
|
83
|
+
passed: false,
|
|
84
|
+
critical: true,
|
|
85
|
+
reason: `Agent "${agentName}" has an active session: ${entry}. ` +
|
|
86
|
+
`Worktree: ${state.worktreePath}. ` +
|
|
87
|
+
`If this is stale, remove it: rm -rf ${state.worktreePath} && rm -rf ${join(sessionsDir, entry)}`,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
// Worktree doesn't exist — session is stale, mark it as completed
|
|
91
|
+
// (don't block — just note it)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
// Corrupted state file — skip
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return { name: "concurrent_session", passed: true, critical: true };
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Guard: Eval script and data files must exist.
|
|
102
|
+
* Critical: true — agent can't measure improvement without eval.
|
|
103
|
+
*/
|
|
104
|
+
export function guardEvalReady(projectRoot, config) {
|
|
105
|
+
const errors = [];
|
|
106
|
+
const evalScriptPath = join(projectRoot, config.eval.script);
|
|
107
|
+
if (!existsSync(evalScriptPath)) {
|
|
108
|
+
errors.push(`Eval script not found: ${config.eval.script}`);
|
|
109
|
+
}
|
|
110
|
+
const evalDataPath = join(projectRoot, config.eval.data);
|
|
111
|
+
if (!existsSync(evalDataPath)) {
|
|
112
|
+
errors.push(`Eval data not found: ${config.eval.data}`);
|
|
113
|
+
}
|
|
114
|
+
if (errors.length > 0) {
|
|
115
|
+
return {
|
|
116
|
+
name: "eval_ready",
|
|
117
|
+
passed: false,
|
|
118
|
+
critical: true,
|
|
119
|
+
reason: errors.join("; "),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
return { name: "eval_ready", passed: true, critical: true };
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Guard: No stale worktree for this agent.
|
|
126
|
+
* Critical: true — stale worktrees cause git worktree add to fail.
|
|
127
|
+
*/
|
|
128
|
+
export function guardWorktreeClean(projectRoot, agentName) {
|
|
129
|
+
// Check for stale /tmp worktrees matching this agent
|
|
130
|
+
const result = spawnSync("git", ["worktree", "list", "--porcelain"], {
|
|
131
|
+
cwd: projectRoot,
|
|
132
|
+
encoding: "utf-8",
|
|
133
|
+
stdio: "pipe",
|
|
134
|
+
});
|
|
135
|
+
if (result.status !== 0) {
|
|
136
|
+
// Can't check worktrees — don't block
|
|
137
|
+
return { name: "worktree_clean", passed: true, critical: true };
|
|
138
|
+
}
|
|
139
|
+
const lines = (result.stdout || "").split("\n");
|
|
140
|
+
const staleWorktrees = [];
|
|
141
|
+
for (const line of lines) {
|
|
142
|
+
if (line.startsWith("worktree ")) {
|
|
143
|
+
const worktreePath = line.replace("worktree ", "").trim();
|
|
144
|
+
// Match agent worktrees in /tmp
|
|
145
|
+
if (worktreePath.includes(`jfl-agent-${agentName}-`)) {
|
|
146
|
+
// Check if the directory actually exists
|
|
147
|
+
if (!existsSync(worktreePath)) {
|
|
148
|
+
staleWorktrees.push(worktreePath);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (staleWorktrees.length > 0) {
|
|
154
|
+
// Auto-prune stale worktrees — they're just git bookkeeping for deleted /tmp dirs
|
|
155
|
+
spawnSync("git", ["worktree", "prune"], {
|
|
156
|
+
cwd: projectRoot,
|
|
157
|
+
stdio: "pipe",
|
|
158
|
+
});
|
|
159
|
+
// Re-check after pruning
|
|
160
|
+
const recheck = spawnSync("git", ["worktree", "list", "--porcelain"], {
|
|
161
|
+
cwd: projectRoot,
|
|
162
|
+
encoding: "utf-8",
|
|
163
|
+
stdio: "pipe",
|
|
164
|
+
});
|
|
165
|
+
const recheckLines = (recheck.stdout || "").split("\n");
|
|
166
|
+
const remaining = recheckLines.filter((l) => l.startsWith("worktree ") && l.includes(`jfl-agent-${agentName}-`));
|
|
167
|
+
if (remaining.length > 0) {
|
|
168
|
+
const paths = remaining.map((l) => l.replace("worktree ", "").trim());
|
|
169
|
+
return {
|
|
170
|
+
name: "worktree_clean",
|
|
171
|
+
passed: false,
|
|
172
|
+
critical: true,
|
|
173
|
+
reason: `Stale worktrees found for agent "${agentName}": ${paths.join(", ")}. ` +
|
|
174
|
+
`Clean up with: git worktree remove <path> --force`,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return { name: "worktree_clean", passed: true, critical: true };
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Guard: Git repo must be in a clean state for the base branch.
|
|
182
|
+
* Critical: false — uncommitted changes are stashed by agent-session.
|
|
183
|
+
*/
|
|
184
|
+
export function guardGitClean(projectRoot) {
|
|
185
|
+
const result = spawnSync("git", ["status", "--porcelain"], {
|
|
186
|
+
cwd: projectRoot,
|
|
187
|
+
encoding: "utf-8",
|
|
188
|
+
stdio: "pipe",
|
|
189
|
+
});
|
|
190
|
+
const output = (result.stdout || "").trim();
|
|
191
|
+
if (output) {
|
|
192
|
+
return {
|
|
193
|
+
name: "git_clean",
|
|
194
|
+
passed: false,
|
|
195
|
+
critical: false,
|
|
196
|
+
reason: `Uncommitted changes in working directory (${output.split("\n").length} files). ` +
|
|
197
|
+
`These may conflict with agent worktree creation.`,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
return { name: "git_clean", passed: true, critical: false };
|
|
201
|
+
}
|
|
202
|
+
// ============================================================================
|
|
203
|
+
// Guard Runner
|
|
204
|
+
// ============================================================================
|
|
205
|
+
/**
|
|
206
|
+
* Run all guards for an agent session.
|
|
207
|
+
* Returns a summary with proceed/blockers/warnings.
|
|
208
|
+
*/
|
|
209
|
+
export async function runGuards(projectRoot, agentName, config) {
|
|
210
|
+
const results = [];
|
|
211
|
+
// Run all guards (async hub guard + sync guards)
|
|
212
|
+
const [hubResult] = await Promise.all([
|
|
213
|
+
guardHub(projectRoot),
|
|
214
|
+
]);
|
|
215
|
+
results.push(hubResult);
|
|
216
|
+
results.push(guardNoConcurrentSession(projectRoot, agentName));
|
|
217
|
+
results.push(guardEvalReady(projectRoot, config));
|
|
218
|
+
results.push(guardWorktreeClean(projectRoot, agentName));
|
|
219
|
+
results.push(guardGitClean(projectRoot));
|
|
220
|
+
const blockers = results.filter((r) => !r.passed && r.critical);
|
|
221
|
+
const warnings = results.filter((r) => !r.passed && !r.critical);
|
|
222
|
+
return {
|
|
223
|
+
proceed: blockers.length === 0,
|
|
224
|
+
results,
|
|
225
|
+
blockers,
|
|
226
|
+
warnings,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=agent-guards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-guards.js","sourceRoot":"","sources":["../../src/lib/agent-guards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,IAAI,CAAA;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AA6BzC,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,WAAmB;IAChD,IAAI,CAAC;QACH,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAA;QAC1D,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,WAAW,CAAC,CAAA;QAEhD,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACrB,OAAO;gBACL,IAAI,EAAE,KAAK;gBACX,MAAM,EAAE,IAAI;gBACZ,QAAQ,EAAE,KAAK;aAChB,CAAA;QACH,CAAC;QAED,OAAO;YACL,IAAI,EAAE,KAAK;YACX,MAAM,EAAE,KAA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AC,cAAc,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAA;IACjD,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAA;IACxD,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAA;IAExC,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAA;IAC/D,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;IAEhE,OAAO;QACL,OAAO,EAAE,QAAQ,CAAC,MAAM,KAAK,CAAC;QAC9B,OAAO;QACP,QAAQ;QACR,QAAQ;KACT,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API-based agent runtime — replaces spawn('claude') with Anthropic API + tool_use.
|
|
3
|
+
*
|
|
4
|
+
* WHY: Every spawn('claude') creates a ~300MB node process. macOS compresses dead
|
|
5
|
+
* pages instead of freeing them. 20 rounds/night = 6GB compressed memory that's
|
|
6
|
+
* unreclaimable without reboot. This replaces N process spawns with N HTTP calls
|
|
7
|
+
* from a single long-lived process. Zero memory churn.
|
|
8
|
+
*
|
|
9
|
+
* Tools: read_file, write_file, list_files, bash (same capabilities as claude CLI)
|
|
10
|
+
* Model: claude-sonnet-4-20250514 (fast, cheap, good enough for focused edits)
|
|
11
|
+
*
|
|
12
|
+
* @purpose API-based agent runtime — zero memory churn replacement for spawn('claude')
|
|
13
|
+
*/
|
|
14
|
+
interface AgentRuntimeOptions {
|
|
15
|
+
task: string;
|
|
16
|
+
cwd: string;
|
|
17
|
+
timeoutMs: number;
|
|
18
|
+
maxTurns?: number;
|
|
19
|
+
model?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Run an agent round via Anthropic API with tool_use.
|
|
23
|
+
* Single HTTP conversation — no process spawning.
|
|
24
|
+
* Replaces spawnClaudeCli() and spawnAgentRuntime().
|
|
25
|
+
*
|
|
26
|
+
* Key priority: ANTHROPIC_API_KEY > OPENROUTER_API_KEY
|
|
27
|
+
* OpenRouter uses its own REST format (not Anthropic SDK compatible),
|
|
28
|
+
* so we call it directly via fetch when using OpenRouter.
|
|
29
|
+
*/
|
|
30
|
+
export declare function runAgentViaAPI(options: AgentRuntimeOptions): Promise<void>;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=agent-runtime-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-runtime-api.d.ts","sourceRoot":"","sources":["../../src/lib/agent-runtime-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AASH,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAmFD;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAahF"}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API-based agent runtime — replaces spawn('claude') with Anthropic API + tool_use.
|
|
3
|
+
*
|
|
4
|
+
* WHY: Every spawn('claude') creates a ~300MB node process. macOS compresses dead
|
|
5
|
+
* pages instead of freeing them. 20 rounds/night = 6GB compressed memory that's
|
|
6
|
+
* unreclaimable without reboot. This replaces N process spawns with N HTTP calls
|
|
7
|
+
* from a single long-lived process. Zero memory churn.
|
|
8
|
+
*
|
|
9
|
+
* Tools: read_file, write_file, list_files, bash (same capabilities as claude CLI)
|
|
10
|
+
* Model: claude-sonnet-4-20250514 (fast, cheap, good enough for focused edits)
|
|
11
|
+
*
|
|
12
|
+
* @purpose API-based agent runtime — zero memory churn replacement for spawn('claude')
|
|
13
|
+
*/
|
|
14
|
+
import Anthropic from "@anthropic-ai/sdk";
|
|
15
|
+
import { readFileSync, writeFileSync, existsSync } from "fs";
|
|
16
|
+
import { join } from "path";
|
|
17
|
+
import { execSync } from "child_process";
|
|
18
|
+
// ── Tool Definitions ───────────────────────────────────────────────────────
|
|
19
|
+
// Karpathy-style: minimal tools. bash handles everything — grep, sed, cat, python.
|
|
20
|
+
// edit_file kept but with line-number replacement (way more reliable than exact text match).
|
|
21
|
+
const TOOLS = [
|
|
22
|
+
{
|
|
23
|
+
name: "bash",
|
|
24
|
+
description: "Run a bash command. Use this for everything: reading files (cat, head, tail, sed -n), editing (sed -i, python -c), searching (grep, find), testing. Returns stdout+stderr.",
|
|
25
|
+
input_schema: {
|
|
26
|
+
type: "object",
|
|
27
|
+
properties: {
|
|
28
|
+
command: { type: "string", description: "Bash command to execute" },
|
|
29
|
+
},
|
|
30
|
+
required: ["command"],
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "write_file",
|
|
35
|
+
description: "Write full content to a file (create or overwrite). For small edits, prefer bash with sed -i.",
|
|
36
|
+
input_schema: {
|
|
37
|
+
type: "object",
|
|
38
|
+
properties: {
|
|
39
|
+
path: { type: "string", description: "Relative path to the file" },
|
|
40
|
+
content: { type: "string", description: "Full file content" },
|
|
41
|
+
},
|
|
42
|
+
required: ["path", "content"],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
// ── Tool Execution ─────────────────────────────────────────────────────────
|
|
47
|
+
function executeTool(name, input, cwd) {
|
|
48
|
+
try {
|
|
49
|
+
switch (name) {
|
|
50
|
+
case "bash": {
|
|
51
|
+
const command = input.command;
|
|
52
|
+
// Block dangerous commands
|
|
53
|
+
if (/rm\s+-rf\s+[/~]|mkfs|dd\s+if/.test(command)) {
|
|
54
|
+
return { content: "Error: Dangerous command blocked", is_error: true };
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
const result = execSync(command, {
|
|
58
|
+
cwd,
|
|
59
|
+
encoding: "utf-8",
|
|
60
|
+
timeout: 30000,
|
|
61
|
+
maxBuffer: 1024 * 1024, // 1MB
|
|
62
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
63
|
+
});
|
|
64
|
+
return { content: result.slice(0, 10000), is_error: false };
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
// Return stderr+stdout even on non-zero exit (useful for grep, test, etc)
|
|
68
|
+
const out = (err.stdout || "") + (err.stderr || "");
|
|
69
|
+
return { content: out.slice(0, 5000) || err.message, is_error: false };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
case "write_file": {
|
|
73
|
+
const filePath = join(cwd, input.path);
|
|
74
|
+
writeFileSync(filePath, input.content);
|
|
75
|
+
return { content: `Written: ${input.path}`, is_error: false };
|
|
76
|
+
}
|
|
77
|
+
default:
|
|
78
|
+
return { content: `Error: Unknown tool: ${name}`, is_error: true };
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
const msg = err.stderr || err.stdout || err.message || String(err);
|
|
83
|
+
return { content: `Error: ${msg.slice(0, 2000)}`, is_error: true };
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// ── Main Runtime ───────────────────────────────────────────────────────────
|
|
87
|
+
/**
|
|
88
|
+
* Run an agent round via Anthropic API with tool_use.
|
|
89
|
+
* Single HTTP conversation — no process spawning.
|
|
90
|
+
* Replaces spawnClaudeCli() and spawnAgentRuntime().
|
|
91
|
+
*
|
|
92
|
+
* Key priority: ANTHROPIC_API_KEY > OPENROUTER_API_KEY
|
|
93
|
+
* OpenRouter uses its own REST format (not Anthropic SDK compatible),
|
|
94
|
+
* so we call it directly via fetch when using OpenRouter.
|
|
95
|
+
*/
|
|
96
|
+
export async function runAgentViaAPI(options) {
|
|
97
|
+
const anthropicKey = process.env.ANTHROPIC_API_KEY;
|
|
98
|
+
const openrouterKey = process.env.OPENROUTER_API_KEY;
|
|
99
|
+
if (openrouterKey && !anthropicKey) {
|
|
100
|
+
console.log(" [api] Using OpenRouter (zero memory churn)");
|
|
101
|
+
return runViaOpenRouter(options, openrouterKey);
|
|
102
|
+
}
|
|
103
|
+
if (!anthropicKey) {
|
|
104
|
+
throw new Error("No API key: set ANTHROPIC_API_KEY or OPENROUTER_API_KEY");
|
|
105
|
+
}
|
|
106
|
+
return runViaAnthropic(options, anthropicKey);
|
|
107
|
+
}
|
|
108
|
+
async function runViaAnthropic(options, apiKey) {
|
|
109
|
+
const { task, cwd, timeoutMs, maxTurns = 15 } = options;
|
|
110
|
+
const model = options.model || "claude-sonnet-4-20250514";
|
|
111
|
+
console.log(" [api] Using Anthropic API (zero memory churn)");
|
|
112
|
+
const client = new Anthropic({ apiKey });
|
|
113
|
+
const deadline = Date.now() + timeoutMs;
|
|
114
|
+
// Read CLAUDE.md and EXPERIMENTS.md if they exist (written by writeAgentClaudeMd/writeExperimentHistory)
|
|
115
|
+
let systemPrompt = "You are a code improvement agent. Read the files in your working directory, make ONE targeted edit to improve the metric, then stop.";
|
|
116
|
+
const claudeMdPath = join(cwd, "CLAUDE.md");
|
|
117
|
+
if (existsSync(claudeMdPath)) {
|
|
118
|
+
systemPrompt = readFileSync(claudeMdPath, "utf-8");
|
|
119
|
+
}
|
|
120
|
+
const messages = [
|
|
121
|
+
{ role: "user", content: task },
|
|
122
|
+
];
|
|
123
|
+
let turns = 0;
|
|
124
|
+
while (turns < maxTurns && Date.now() < deadline) {
|
|
125
|
+
turns++;
|
|
126
|
+
console.log(` [api] Turn ${turns}/${maxTurns}...`);
|
|
127
|
+
const response = await client.messages.create({
|
|
128
|
+
model,
|
|
129
|
+
max_tokens: 4096,
|
|
130
|
+
system: systemPrompt,
|
|
131
|
+
tools: TOOLS,
|
|
132
|
+
messages,
|
|
133
|
+
});
|
|
134
|
+
// Collect text and tool_use blocks
|
|
135
|
+
const toolUses = [];
|
|
136
|
+
let hasText = false;
|
|
137
|
+
for (const block of response.content) {
|
|
138
|
+
if (block.type === "text") {
|
|
139
|
+
hasText = true;
|
|
140
|
+
// Only log first 200 chars to avoid noise
|
|
141
|
+
if (block.text.trim()) {
|
|
142
|
+
console.log(` [api] ${block.text.trim().slice(0, 200)}`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
else if (block.type === "tool_use") {
|
|
146
|
+
toolUses.push({ id: block.id, name: block.name, input: block.input });
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
// If no tool calls, agent is done
|
|
150
|
+
if (response.stop_reason === "end_turn" && toolUses.length === 0) {
|
|
151
|
+
console.log(" [api] Agent finished (no more tool calls)");
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
if (toolUses.length === 0) {
|
|
155
|
+
console.log(` [api] Agent stopped: ${response.stop_reason}`);
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
// Execute tools and collect results
|
|
159
|
+
const toolResults = [];
|
|
160
|
+
for (const tu of toolUses) {
|
|
161
|
+
console.log(` [api] tool: ${tu.name}(${JSON.stringify(tu.input).slice(0, 100)})`);
|
|
162
|
+
const { content, is_error } = executeTool(tu.name, tu.input, cwd);
|
|
163
|
+
toolResults.push({
|
|
164
|
+
type: "tool_result",
|
|
165
|
+
tool_use_id: tu.id,
|
|
166
|
+
content: content.slice(0, 10000), // Cap tool output
|
|
167
|
+
is_error,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
// Add assistant response + tool results to messages
|
|
171
|
+
messages.push({ role: "assistant", content: response.content });
|
|
172
|
+
messages.push({ role: "user", content: toolResults });
|
|
173
|
+
}
|
|
174
|
+
if (Date.now() >= deadline) {
|
|
175
|
+
console.log(" [api] Agent timed out");
|
|
176
|
+
}
|
|
177
|
+
if (turns >= maxTurns) {
|
|
178
|
+
console.log(" [api] Agent hit max turns");
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
// ── OpenRouter Implementation ──────────────────────────────────────────────
|
|
182
|
+
// OpenRouter exposes Anthropic models via its own REST API (not SDK-compatible).
|
|
183
|
+
// We call it directly with fetch using the messages format.
|
|
184
|
+
const OPENROUTER_TOOLS = TOOLS.map(t => ({
|
|
185
|
+
name: t.name,
|
|
186
|
+
description: t.description,
|
|
187
|
+
input_schema: t.input_schema,
|
|
188
|
+
}));
|
|
189
|
+
async function runViaOpenRouter(options, apiKey) {
|
|
190
|
+
const { task, cwd, timeoutMs, maxTurns = 15 } = options;
|
|
191
|
+
const model = options.model || "anthropic/claude-sonnet-4";
|
|
192
|
+
const deadline = Date.now() + timeoutMs;
|
|
193
|
+
const claudeMdPath = join(cwd, "CLAUDE.md");
|
|
194
|
+
let systemPrompt = "You are a code improvement agent. Read the files, make ONE targeted edit, then stop.";
|
|
195
|
+
if (existsSync(claudeMdPath)) {
|
|
196
|
+
systemPrompt = readFileSync(claudeMdPath, "utf-8");
|
|
197
|
+
}
|
|
198
|
+
// OpenRouter uses Anthropic's messages format
|
|
199
|
+
const messages = [
|
|
200
|
+
{ role: "user", content: task },
|
|
201
|
+
];
|
|
202
|
+
let turns = 0;
|
|
203
|
+
while (turns < maxTurns && Date.now() < deadline) {
|
|
204
|
+
turns++;
|
|
205
|
+
console.log(` [api] Turn ${turns}/${maxTurns}...`);
|
|
206
|
+
const response = await fetch("https://openrouter.ai/api/v1/chat/completions", {
|
|
207
|
+
method: "POST",
|
|
208
|
+
headers: {
|
|
209
|
+
"Authorization": `Bearer ${apiKey}`,
|
|
210
|
+
"Content-Type": "application/json",
|
|
211
|
+
"HTTP-Referer": "https://github.com/402goose/jfl",
|
|
212
|
+
"X-Title": "JFL Agent Runtime",
|
|
213
|
+
},
|
|
214
|
+
body: JSON.stringify({
|
|
215
|
+
model,
|
|
216
|
+
max_tokens: 4096,
|
|
217
|
+
messages: [
|
|
218
|
+
{ role: "system", content: systemPrompt },
|
|
219
|
+
...messages,
|
|
220
|
+
],
|
|
221
|
+
tools: OPENROUTER_TOOLS.map(t => ({ type: "function", function: t })),
|
|
222
|
+
tool_choice: "auto",
|
|
223
|
+
}),
|
|
224
|
+
});
|
|
225
|
+
if (!response.ok) {
|
|
226
|
+
const text = await response.text();
|
|
227
|
+
throw new Error(`OpenRouter ${response.status}: ${text.slice(0, 200)}`);
|
|
228
|
+
}
|
|
229
|
+
const data = await response.json();
|
|
230
|
+
const choice = data.choices?.[0];
|
|
231
|
+
if (!choice) {
|
|
232
|
+
console.log(" [api] No response from OpenRouter");
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
const msg = choice.message;
|
|
236
|
+
if (msg.content) {
|
|
237
|
+
console.log(` [api] ${String(msg.content).trim().slice(0, 200)}`);
|
|
238
|
+
}
|
|
239
|
+
const toolCalls = msg.tool_calls || [];
|
|
240
|
+
if (toolCalls.length === 0) {
|
|
241
|
+
console.log(` [api] Agent finished (finish_reason: ${choice.finish_reason})`);
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
// Add assistant message to history
|
|
245
|
+
messages.push({ role: "assistant", content: msg.content, ...(toolCalls.length > 0 ? { tool_calls: toolCalls } : {}) });
|
|
246
|
+
// Execute tools
|
|
247
|
+
for (const tc of toolCalls) {
|
|
248
|
+
const fnName = tc.function?.name || tc.name;
|
|
249
|
+
let fnArgs = {};
|
|
250
|
+
try {
|
|
251
|
+
fnArgs = JSON.parse(tc.function?.arguments || "{}");
|
|
252
|
+
}
|
|
253
|
+
catch { }
|
|
254
|
+
console.log(` [api] tool: ${fnName}(${JSON.stringify(fnArgs).slice(0, 100)})`);
|
|
255
|
+
const { content, is_error } = executeTool(fnName, fnArgs, cwd);
|
|
256
|
+
messages.push({
|
|
257
|
+
role: "tool",
|
|
258
|
+
content: is_error ? `Error: ${content.slice(0, 5000)}` : content.slice(0, 10000),
|
|
259
|
+
...(tc.id ? { tool_call_id: tc.id } : {}),
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
if (Date.now() >= deadline) {
|
|
264
|
+
console.log(" [api] Agent timed out");
|
|
265
|
+
}
|
|
266
|
+
if (turns >= maxTurns) {
|
|
267
|
+
console.log(" [api] Agent hit max turns");
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=agent-runtime-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-runtime-api.js","sourceRoot":"","sources":["../../src/lib/agent-runtime-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,SAAS,MAAM,mBAAmB,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAmBxC,8EAA8E;AAE9E,mFAAmF;AACnF,6FAA6F;AAC7F,MAAM,KAAK,GAAqB;IAC9B;QACE,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,4KAA4K;QACzL,YAAY,EAAE;YACZ,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,yBAAyB,EAAE;aACpE;YACD,QAAQ,EAAE,CAAC,SAAS,CAAC;SACtB;KACF;IACD;QACE,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,+FAA+F;QAC5G,YAAY,EAAE;YACZ,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2BAA2B,EAAE;gBAClE,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mBAAmB,EAAE;aAC9D;YACD,QAAQ,EA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