@clemrig/flow 0.10.0 → 0.12.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 +3 -3
- package/dist/app/run.js +14 -23
- package/dist/app/run.js.map +1 -1
- package/dist/engine/profiles.d.ts +18 -2
- package/dist/engine/profiles.js +33 -10
- package/dist/engine/profiles.js.map +1 -1
- package/dist/engine/types.d.ts +15 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/system/process.d.ts +57 -10
- package/dist/system/process.js +212 -31
- package/dist/system/process.js.map +1 -1
- package/dist/system/runtimes/adapter.d.ts +31 -4
- package/dist/system/runtimes/adapter.js.map +1 -1
- package/dist/system/runtimes/agent-runtime.d.ts +8 -3
- package/dist/system/runtimes/agent-runtime.js +55 -6
- package/dist/system/runtimes/agent-runtime.js.map +1 -1
- package/dist/system/runtimes/claude-code.d.ts +5 -2
- package/dist/system/runtimes/claude-code.js +102 -10
- package/dist/system/runtimes/claude-code.js.map +1 -1
- package/dist/system/runtimes/inspect.js +10 -2
- package/dist/system/runtimes/inspect.js.map +1 -1
- package/package.json +1 -1
package/dist/system/process.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
1
|
+
import { execFile, execFileSync, spawn } from "node:child_process";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { open, readFile } from "node:fs/promises";
|
|
4
|
+
import { promisify } from "node:util";
|
|
2
5
|
const MAX_CAPTURE_BYTES = 2 * 1024 * 1024;
|
|
3
6
|
const MAX_LINE_BYTES = 32 * 1024 * 1024;
|
|
4
7
|
const KILL_GRACE_MS = 1_000;
|
|
@@ -100,7 +103,7 @@ function groupStillExists(child) {
|
|
|
100
103
|
return false;
|
|
101
104
|
}
|
|
102
105
|
}
|
|
103
|
-
/** Children still running, each with how to interrupt it. */
|
|
106
|
+
/** Children still running, each with how to interrupt it and where its commands register their groups. */
|
|
104
107
|
const running = new Map();
|
|
105
108
|
/** Called by the signal that interrupts the children: what else must stop with them. */
|
|
106
109
|
const interrupted = new Set();
|
|
@@ -118,17 +121,17 @@ export function whenInterrupted(handler) {
|
|
|
118
121
|
* all, so that none outlives an interrupted program.
|
|
119
122
|
*/
|
|
120
123
|
function onSignal(signal) {
|
|
121
|
-
for (const interrupt of running.values())
|
|
124
|
+
for (const { interrupt } of running.values())
|
|
122
125
|
interrupt(signal);
|
|
123
126
|
for (const handler of [...interrupted])
|
|
124
127
|
handler(signal);
|
|
125
128
|
}
|
|
126
|
-
function track(child, interrupt) {
|
|
129
|
+
function track(child, interrupt, groups) {
|
|
127
130
|
if (running.size === 0) {
|
|
128
131
|
process.on("SIGINT", onSignal);
|
|
129
132
|
process.on("SIGTERM", onSignal);
|
|
130
133
|
}
|
|
131
|
-
running.set(child, interrupt);
|
|
134
|
+
running.set(child, { interrupt, ...(groups ? { groups } : {}) });
|
|
132
135
|
}
|
|
133
136
|
function untrack(child) {
|
|
134
137
|
running.delete(child);
|
|
@@ -139,42 +142,189 @@ function untrack(child) {
|
|
|
139
142
|
}
|
|
140
143
|
/**
|
|
141
144
|
* Kills the process group of every child still running in this process, of
|
|
142
|
-
* every run, at once: for a program
|
|
145
|
+
* every run, and the groups their commands registered, at once: for a program
|
|
146
|
+
* about to quit.
|
|
143
147
|
*/
|
|
144
148
|
export function killChildProcesses() {
|
|
145
|
-
for (const child of running
|
|
149
|
+
for (const [child, { groups }] of running) {
|
|
146
150
|
signalGroup(child, "SIGKILL");
|
|
151
|
+
if (groups)
|
|
152
|
+
killRegistered(groups);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/** Lists every process with its group and start, dated in the C locale. */
|
|
156
|
+
const listing = () => [
|
|
157
|
+
"ps",
|
|
158
|
+
["-ax", "-o", "pid=,pgid=,lstart="],
|
|
159
|
+
{
|
|
160
|
+
env: { ...process.env, LC_ALL: "C" },
|
|
161
|
+
encoding: "utf8",
|
|
162
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
163
|
+
},
|
|
164
|
+
];
|
|
165
|
+
/** A line of the listing: pid, group and start. */
|
|
166
|
+
const listed = (line) => {
|
|
167
|
+
const [, pid = "", group = "", start = ""] = /^\s*(\d+)\s+(\d+)\s+(.+?)\s*$/.exec(line) ?? [];
|
|
168
|
+
return { pid, group, start };
|
|
169
|
+
};
|
|
170
|
+
const execFileAsync = promisify(execFile);
|
|
171
|
+
/**
|
|
172
|
+
* Why this machine cannot end the groups a program's commands register, if it
|
|
173
|
+
* cannot: `ps` must list every process with its group and start, as that of
|
|
174
|
+
* macOS and that of procps on Linux do.
|
|
175
|
+
*/
|
|
176
|
+
export async function groupsProblem() {
|
|
177
|
+
try {
|
|
178
|
+
const { stdout } = await execFileAsync(...listing());
|
|
179
|
+
const own = stdout
|
|
180
|
+
.split("\n")
|
|
181
|
+
.map(listed)
|
|
182
|
+
.find(({ pid }) => pid === String(process.pid));
|
|
183
|
+
if (own && !Number.isNaN(Date.parse(own.start)))
|
|
184
|
+
return undefined;
|
|
185
|
+
return "ps -ax -o pid=,pgid=,lstart= does not list this process with its group and start";
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
return `ps -ax -o pid=,pgid=,lstart= failed: ${error instanceof Error ? error.message : String(error)}`;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* The groups a registry names that still hold processes, each with how many.
|
|
193
|
+
* A registered group whose leader runs but started at another time is no
|
|
194
|
+
* longer the command's: once a group has emptied, the system may give its
|
|
195
|
+
* number to another, which it never does while the group holds a process.
|
|
196
|
+
*/
|
|
197
|
+
function registered(registry, processes) {
|
|
198
|
+
const startedAt = new Map();
|
|
199
|
+
for (const line of registry.split("\n")) {
|
|
200
|
+
const [group = Number.NaN, at = Number.NaN] = line
|
|
201
|
+
.trim()
|
|
202
|
+
.split(/\s+/)
|
|
203
|
+
.map(Number);
|
|
204
|
+
if (Number.isInteger(group) && group > 1 && Number.isFinite(at))
|
|
205
|
+
startedAt.set(group, at);
|
|
206
|
+
}
|
|
207
|
+
const held = new Map();
|
|
208
|
+
const replaced = new Set();
|
|
209
|
+
for (const line of processes.split("\n")) {
|
|
210
|
+
const { pid, group, start } = listed(line);
|
|
211
|
+
const at = startedAt.get(Number(group));
|
|
212
|
+
if (at === undefined)
|
|
213
|
+
continue;
|
|
214
|
+
held.set(Number(group), (held.get(Number(group)) ?? 0) + 1);
|
|
215
|
+
// Registered just after its leader started, to the second.
|
|
216
|
+
if (pid === group && Math.abs(Date.parse(start) / 1000 - at) > 2)
|
|
217
|
+
replaced.add(Number(group));
|
|
218
|
+
}
|
|
219
|
+
for (const group of replaced)
|
|
220
|
+
held.delete(group);
|
|
221
|
+
return held;
|
|
147
222
|
}
|
|
148
|
-
|
|
223
|
+
const signalled = (group, signal) => {
|
|
224
|
+
try {
|
|
225
|
+
process.kill(-group, signal);
|
|
226
|
+
return true;
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
// The group is gone.
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* Ends the groups a program's commands registered in `file` that still hold
|
|
235
|
+
* processes: SIGTERM, then SIGKILL for what remains after the grace period.
|
|
236
|
+
* Returns how many processes they held.
|
|
237
|
+
*/
|
|
238
|
+
async function endRegistered(file) {
|
|
239
|
+
const registry = await readFile(file, "utf8").catch((error) => {
|
|
240
|
+
// No command registered.
|
|
241
|
+
if (error.code === "ENOENT")
|
|
242
|
+
return "";
|
|
243
|
+
throw error;
|
|
244
|
+
});
|
|
245
|
+
if (!registry)
|
|
246
|
+
return 0;
|
|
247
|
+
const { stdout } = await execFileAsync(...listing());
|
|
248
|
+
const groups = registered(registry, stdout);
|
|
249
|
+
for (const group of groups.keys())
|
|
250
|
+
signalled(group, "SIGTERM");
|
|
251
|
+
const deadline = Date.now() + KILL_GRACE_MS;
|
|
252
|
+
while ([...groups.keys()].some((group) => signalled(group, 0)) &&
|
|
253
|
+
Date.now() < deadline)
|
|
254
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
255
|
+
for (const group of groups.keys())
|
|
256
|
+
signalled(group, "SIGKILL");
|
|
257
|
+
return [...groups.values()].reduce((sum, count) => sum + count, 0);
|
|
258
|
+
}
|
|
259
|
+
/** `endRegistered` at once, without waiting: for a program about to quit. */
|
|
260
|
+
function killRegistered(file) {
|
|
261
|
+
try {
|
|
262
|
+
const groups = registered(readFileSync(file, "utf8"), execFileSync(...listing()));
|
|
263
|
+
for (const group of groups.keys())
|
|
264
|
+
signalled(group, "SIGKILL");
|
|
265
|
+
}
|
|
266
|
+
catch {
|
|
267
|
+
// Nothing registered, or nothing left to list: the program quits anyway.
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* `runCommand` with its arguments in order: the form workflows use, whose line
|
|
272
|
+
* callback never stops the program.
|
|
273
|
+
*/
|
|
149
274
|
export async function runProcess(command, cwd, timeoutMs, onLine, stdin) {
|
|
150
|
-
return runCommand(command, {
|
|
275
|
+
return runCommand(command, {
|
|
276
|
+
cwd,
|
|
277
|
+
timeoutMs,
|
|
278
|
+
stdin,
|
|
279
|
+
...(onLine
|
|
280
|
+
? {
|
|
281
|
+
onLine: (line) => {
|
|
282
|
+
onLine(line);
|
|
283
|
+
},
|
|
284
|
+
}
|
|
285
|
+
: {}),
|
|
286
|
+
});
|
|
151
287
|
}
|
|
152
288
|
/**
|
|
153
|
-
* Runs an executable without a shell, in its own process group. A failure
|
|
154
|
-
* terminates the entire group
|
|
155
|
-
*
|
|
289
|
+
* Runs an executable without a shell, in its own process group. A failure, or
|
|
290
|
+
* the caller's stop, terminates the entire group with the program's stop
|
|
291
|
+
* signal, then SIGKILL for what remains once the program's time to stop has
|
|
292
|
+
* passed, and settles once the child has closed and its group is gone, after
|
|
293
|
+
* ending the groups its commands registered.
|
|
156
294
|
*/
|
|
157
295
|
export async function runCommand(command, options) {
|
|
158
|
-
const { cwd, timeoutMs, onLine, stdin, env, stopSignal = "SIGTERM", } = options;
|
|
296
|
+
const { cwd, timeoutMs, onLine, stdin, env, stopSignal = "SIGTERM", stopGraceMs = KILL_GRACE_MS, groups, signal, output, } = options;
|
|
159
297
|
if (command.length === 0 || !command[0])
|
|
160
298
|
throw new Error("Process command must include an executable");
|
|
161
|
-
if (
|
|
299
|
+
if (timeoutMs === undefined && !signal)
|
|
300
|
+
throw new Error("Process needs a timeout or its caller's signal");
|
|
301
|
+
if (timeoutMs !== undefined &&
|
|
302
|
+
(!Number.isFinite(timeoutMs) || timeoutMs <= 0))
|
|
162
303
|
throw new Error("Process timeout must be positive");
|
|
163
304
|
const executable = command[0];
|
|
305
|
+
const file = output === undefined ? undefined : await open(output, "a");
|
|
164
306
|
return new Promise((resolve, reject) => {
|
|
165
307
|
const child = spawn(executable, command.slice(1), {
|
|
166
308
|
cwd,
|
|
167
309
|
...(env ? { env: { ...process.env, ...env } } : {}),
|
|
168
310
|
detached: process.platform !== "win32",
|
|
169
311
|
shell: false,
|
|
170
|
-
stdio: [
|
|
312
|
+
stdio: [
|
|
313
|
+
stdin === undefined ? "ignore" : "pipe",
|
|
314
|
+
file?.fd ?? "pipe",
|
|
315
|
+
file?.fd ?? "pipe",
|
|
316
|
+
],
|
|
171
317
|
});
|
|
318
|
+
// The program has its own copy of the file.
|
|
319
|
+
void file?.close().catch(() => undefined);
|
|
172
320
|
const stdout = new BoundedCapture();
|
|
173
321
|
const stderr = new BoundedCapture();
|
|
174
322
|
let pending = Buffer.alloc(0);
|
|
175
323
|
let failure;
|
|
176
324
|
let closeResult;
|
|
177
325
|
let terminating = false;
|
|
326
|
+
/** The caller asked for the stop: it is no failure. */
|
|
327
|
+
let stopping = false;
|
|
178
328
|
let killSent = false;
|
|
179
329
|
let killTimer;
|
|
180
330
|
let settled = false;
|
|
@@ -184,13 +334,23 @@ export async function runCommand(command, options) {
|
|
|
184
334
|
const cleanup = () => {
|
|
185
335
|
untrack(child);
|
|
186
336
|
cancelTimeout();
|
|
337
|
+
signal?.removeEventListener("abort", requestStop);
|
|
187
338
|
if (killTimer)
|
|
188
339
|
clearTimeout(killTimer);
|
|
189
340
|
};
|
|
190
341
|
const settle = () => {
|
|
191
|
-
if (settled ||
|
|
342
|
+
if (settled ||
|
|
343
|
+
!closeResult ||
|
|
344
|
+
(terminating && !killSent && groupStillExists(child)))
|
|
192
345
|
return;
|
|
193
346
|
settled = true;
|
|
347
|
+
const { code, signal } = closeResult;
|
|
348
|
+
void (groups ? endRegistered(groups) : Promise.resolve(0)).then((left) => finish(code, signal, left), (error) => {
|
|
349
|
+
failure ??= new Error(`Could not end what the commands of ${executable} left running: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
350
|
+
finish(code, signal, 0);
|
|
351
|
+
});
|
|
352
|
+
};
|
|
353
|
+
const finish = (code, signal, left) => {
|
|
194
354
|
cleanup();
|
|
195
355
|
if (failure) {
|
|
196
356
|
if (failure instanceof ProcessTimeoutError) {
|
|
@@ -201,11 +361,13 @@ export async function runCommand(command, options) {
|
|
|
201
361
|
return;
|
|
202
362
|
}
|
|
203
363
|
resolve({
|
|
204
|
-
exitCode:
|
|
364
|
+
exitCode: code ?? (signal ? 1 : 0),
|
|
205
365
|
stdout: stdout.text(),
|
|
206
366
|
stderr: stderr.text(),
|
|
207
367
|
stdoutTruncated: stdout.truncated,
|
|
208
368
|
stderrTruncated: stderr.truncated,
|
|
369
|
+
stopped: stopping,
|
|
370
|
+
left,
|
|
209
371
|
});
|
|
210
372
|
};
|
|
211
373
|
const sendKill = () => {
|
|
@@ -214,17 +376,32 @@ export async function runCommand(command, options) {
|
|
|
214
376
|
signalGroup(child, "SIGKILL");
|
|
215
377
|
settle();
|
|
216
378
|
};
|
|
217
|
-
const
|
|
218
|
-
if (!failure || error instanceof ProcessInterruptedError)
|
|
219
|
-
failure = error;
|
|
379
|
+
const terminate = () => {
|
|
220
380
|
if (terminating)
|
|
221
381
|
return;
|
|
222
382
|
terminating = true;
|
|
383
|
+
// Its timeout bounds the program's work, not its stop.
|
|
384
|
+
cancelTimeout();
|
|
223
385
|
signalGroup(child, stopSignal);
|
|
224
|
-
killTimer = setTimeout(sendKill,
|
|
386
|
+
killTimer = setTimeout(sendKill, stopGraceMs);
|
|
225
387
|
};
|
|
226
|
-
const
|
|
227
|
-
|
|
388
|
+
const requestTermination = (error) => {
|
|
389
|
+
if (!failure || error instanceof ProcessInterruptedError)
|
|
390
|
+
failure = error;
|
|
391
|
+
terminate();
|
|
392
|
+
};
|
|
393
|
+
const requestStop = () => {
|
|
394
|
+
stopping = true;
|
|
395
|
+
terminate();
|
|
396
|
+
};
|
|
397
|
+
const cancelTimeout = timeoutMs === undefined
|
|
398
|
+
? () => { }
|
|
399
|
+
: after(timeoutMs, () => requestTermination(new ProcessTimeoutError(timeoutMs, executable)));
|
|
400
|
+
track(child, onParentSignal, groups);
|
|
401
|
+
if (signal?.aborted)
|
|
402
|
+
requestStop();
|
|
403
|
+
else
|
|
404
|
+
signal?.addEventListener("abort", requestStop, { once: true });
|
|
228
405
|
child.once("error", (error) => {
|
|
229
406
|
requestTermination(new ProcessStartError(executable, error));
|
|
230
407
|
});
|
|
@@ -240,14 +417,14 @@ export async function runCommand(command, options) {
|
|
|
240
417
|
child.stdin.end(stdin);
|
|
241
418
|
}
|
|
242
419
|
}
|
|
243
|
-
if (!child.stdout || !child.stderr)
|
|
420
|
+
if (!file && (!child.stdout || !child.stderr))
|
|
244
421
|
requestTermination(new Error("Process output streams are unavailable"));
|
|
245
422
|
child.stdout?.on("data", (chunk) => {
|
|
246
423
|
stdout.append(chunk);
|
|
247
|
-
if (!onLine || failure)
|
|
424
|
+
if (!onLine || failure || stopping)
|
|
248
425
|
return;
|
|
249
426
|
pending = Buffer.concat([pending, chunk]);
|
|
250
|
-
while (!failure) {
|
|
427
|
+
while (!failure && !stopping) {
|
|
251
428
|
const newline = pending.indexOf(0x0a);
|
|
252
429
|
if (newline < 0)
|
|
253
430
|
break;
|
|
@@ -261,26 +438,30 @@ export async function runCommand(command, options) {
|
|
|
261
438
|
break;
|
|
262
439
|
}
|
|
263
440
|
try {
|
|
264
|
-
onLine(line)
|
|
441
|
+
if (onLine(line) === "stop")
|
|
442
|
+
requestStop();
|
|
265
443
|
}
|
|
266
444
|
catch (error) {
|
|
267
445
|
requestTermination(error instanceof Error ? error : new Error(String(error)));
|
|
268
446
|
}
|
|
269
447
|
}
|
|
270
|
-
if (!failure && pending.length > MAX_LINE_BYTES)
|
|
448
|
+
if (!failure && !stopping && pending.length > MAX_LINE_BYTES)
|
|
271
449
|
requestTermination(new Error(`Process output line exceeded ${MAX_LINE_BYTES} byte limit`));
|
|
272
450
|
});
|
|
273
451
|
child.stderr?.on("data", (chunk) => stderr.append(chunk));
|
|
274
452
|
child.once("close", (code, signal) => {
|
|
275
453
|
closeResult = { code, signal };
|
|
276
|
-
|
|
454
|
+
// Done on time, however long its registered groups take to end.
|
|
455
|
+
cancelTimeout();
|
|
456
|
+
if (!failure && !stopping && groupStillExists(child))
|
|
277
457
|
requestTermination(new Error(`Process group remained after ${executable} exited`));
|
|
278
|
-
if (!failure && onLine && pending.length > 0) {
|
|
458
|
+
if (!failure && !stopping && onLine && pending.length > 0) {
|
|
279
459
|
if (pending.length > MAX_LINE_BYTES)
|
|
280
460
|
requestTermination(new Error(`Process output line exceeded ${MAX_LINE_BYTES} byte limit`));
|
|
281
461
|
else {
|
|
282
462
|
try {
|
|
283
|
-
onLine(pending.toString("utf8").replace(/\r$/, ""))
|
|
463
|
+
if (onLine(pending.toString("utf8").replace(/\r$/, "")) === "stop")
|
|
464
|
+
requestStop();
|
|
284
465
|
}
|
|
285
466
|
catch (error) {
|
|
286
467
|
requestTermination(error instanceof Error ? error : new Error(String(error)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../src/system/process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAA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AAQ,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,MAAM;4BAChE,WAAW,EAAE,CAAC;oBAClB,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBACf,kBAAkB,CAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAC1D,CAAC;oBACJ,CAAC;gBACH,CAAC;YACH,CAAC;YACD,MAAM,EAAE,CAAC;QACX,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -15,6 +15,12 @@ export interface RuntimeCall<R extends Runtime> {
|
|
|
15
15
|
runId: string;
|
|
16
16
|
directory: string;
|
|
17
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Where the call's commands register the process group each runs in, so
|
|
20
|
+
* that what they leave running ends with the call: an adapter that
|
|
21
|
+
* `registersGroups` has them do it.
|
|
22
|
+
*/
|
|
23
|
+
groups: string;
|
|
18
24
|
}
|
|
19
25
|
/** What an output line of a runtime means for the call, the same for every runtime. */
|
|
20
26
|
export type RuntimeEvent = {
|
|
@@ -71,20 +77,34 @@ export type RuntimeEvent = {
|
|
|
71
77
|
type: "failure";
|
|
72
78
|
message: string;
|
|
73
79
|
}
|
|
74
|
-
/**
|
|
80
|
+
/**
|
|
81
|
+
* The agent's final text. From a runtime that keeps running after it for
|
|
82
|
+
* its agent's background work, `background` comes with the latest turn's
|
|
83
|
+
* text and says what still runs.
|
|
84
|
+
*/
|
|
75
85
|
| {
|
|
76
86
|
type: "result";
|
|
77
87
|
text: string;
|
|
88
|
+
background?: Background;
|
|
78
89
|
};
|
|
90
|
+
/**
|
|
91
|
+
* How many tasks a runtime still runs for its agent as its latest turn ends:
|
|
92
|
+
* sub-agents, whose reports the answer may wait for, and commands, which it
|
|
93
|
+
* only uses.
|
|
94
|
+
*/
|
|
95
|
+
export interface Background {
|
|
96
|
+
agents: number;
|
|
97
|
+
commands: number;
|
|
98
|
+
}
|
|
79
99
|
/** What stands for the workflow's prompt in the arguments a call records. */
|
|
80
100
|
export declare const shownPrompt = "\u2039workflow prompt\u203A";
|
|
81
101
|
/** A prepared call: the arguments after the executable, and the reader of its output. */
|
|
82
102
|
export interface RuntimeProcess {
|
|
83
103
|
args: string[];
|
|
84
104
|
/**
|
|
85
|
-
* The same arguments as the run records them: the workflow's prompt, the
|
|
86
|
-
* servers' configuration and the machine's
|
|
87
|
-
* since a configuration can carry a secret.
|
|
105
|
+
* The same arguments as the run records them: the workflow's prompt, the
|
|
106
|
+
* sub-agents' definitions, the MCP servers' configuration and the machine's
|
|
107
|
+
* paths replaced by what names them, since a configuration can carry a secret.
|
|
88
108
|
*/
|
|
89
109
|
shown: string[];
|
|
90
110
|
/** Variables the call needs, added to the machine's environment. */
|
|
@@ -116,6 +136,13 @@ export interface RuntimeAdapter<R extends Runtime> {
|
|
|
116
136
|
minimumVersion: string;
|
|
117
137
|
/** The signal on which the runtime stops cleanly, its commands included. */
|
|
118
138
|
stopSignal: NodeJS.Signals;
|
|
139
|
+
/** How long its clean stop may take, when longer than the second a command has. */
|
|
140
|
+
stopGraceMs?: number;
|
|
141
|
+
/**
|
|
142
|
+
* Its commands register their process groups where the call says: the
|
|
143
|
+
* machine must then list processes as flow ends them, checked before a run.
|
|
144
|
+
*/
|
|
145
|
+
registersGroups?: true;
|
|
119
146
|
/**
|
|
120
147
|
* The environment variables the runtime reads, as its documentation names
|
|
121
148
|
* them: a launch records which ones are set, never their values.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../src/system/runtimes/adapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../src/system/runtimes/adapter.ts"],"names":[],"mappings":"AAoFA,6EAA6E;AAC7E,MAAM,CAAC,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAiE/C;;;GAGG;AACH,MAAM,UAAU,UAAU,CACxB,KAAa,EACb,MAAoB,EACpB,KAAc;IAEd,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACvC,IAAI,MAAM,CAAC,OAAO;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC;IACvC,MAAM,IAAI,GACR,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,IAAI,KAAK;QACf,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAC5B,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,GAAG;QAClB,CAAC,CAAC,EAAE,CAAC;IACT,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM;SAC/B,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;SACtE,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,0BAA0B,IAAI,UAAU,MAAM,EAAE,CAAC,CAAC;AAC5E,CAAC"}
|
|
@@ -17,15 +17,20 @@ export interface CallOptions {
|
|
|
17
17
|
/**
|
|
18
18
|
* One agent call, the same for every runtime: the request goes through standard
|
|
19
19
|
* input, the adapter reads each output line, and the final text is the result.
|
|
20
|
-
* The
|
|
21
|
-
*
|
|
20
|
+
* The agent's answer ends the call: the runtime is stopped with the background
|
|
21
|
+
* commands it still runs for the agent, which the journal counts. What the
|
|
22
|
+
* agent's commands leave running, once registered, ends with the call. The call's
|
|
23
|
+
* activity is recorded as it goes; a call that started always reports its
|
|
24
|
+
* measures, even when it fails. With `calls`, the call keeps a record of what
|
|
22
25
|
* flow sent before it starts, and of the agent's final text once it has it.
|
|
23
26
|
*/
|
|
24
|
-
export declare function runCall<R extends Runtime>(adapter: RuntimeAdapter<R>, call: RuntimeCall<R> & {
|
|
27
|
+
export declare function runCall<R extends Runtime>(adapter: RuntimeAdapter<R>, call: Omit<RuntimeCall<R>, "groups"> & {
|
|
25
28
|
context: unknown;
|
|
26
29
|
schema: Record<string, unknown>;
|
|
27
30
|
/** Why the run had stopped, when it was resumed at this call's stage. */
|
|
28
31
|
resumedAfter?: string;
|
|
32
|
+
/** Variables the request adds to the runtime's environment, under its own. */
|
|
33
|
+
env?: Record<string, string>;
|
|
29
34
|
/** Recorded when the call starts. */
|
|
30
35
|
settings: AgentSettings;
|
|
31
36
|
/** The workflow prompt's name, recorded with it. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { mkdir, readdir, rm, writeFile } from "node:fs/promises";
|
|
2
3
|
import { join } from "node:path";
|
|
3
4
|
import { sumUsage, } from "../../engine/metrics.js";
|
|
4
5
|
import { agentSettings, resolveProfile, } from "../../engine/profiles.js";
|
|
@@ -18,6 +19,23 @@ const keep = (path, record, flag = "w") => writeFile(path, `${JSON.stringify(rec
|
|
|
18
19
|
mode: 0o600,
|
|
19
20
|
flag,
|
|
20
21
|
});
|
|
22
|
+
/**
|
|
23
|
+
* Whether the latest turn's text ends the call: it is an answer, and no
|
|
24
|
+
* sub-agent, whose report the answer may wait for, still runs. What the
|
|
25
|
+
* runtime would still do after it is no longer the agent's answer.
|
|
26
|
+
*/
|
|
27
|
+
function answers(text, background) {
|
|
28
|
+
if (!background || background.agents > 0)
|
|
29
|
+
return false;
|
|
30
|
+
try {
|
|
31
|
+
parseAgentJson(text);
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// Not an answer yet: the agent may wait for a command it runs.
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
21
39
|
/** Far more calls than a stage makes at once. */
|
|
22
40
|
const concurrentCalls = 100;
|
|
23
41
|
/**
|
|
@@ -49,8 +67,11 @@ async function newRecord(directory, record) {
|
|
|
49
67
|
/**
|
|
50
68
|
* One agent call, the same for every runtime: the request goes through standard
|
|
51
69
|
* input, the adapter reads each output line, and the final text is the result.
|
|
52
|
-
* The
|
|
53
|
-
*
|
|
70
|
+
* The agent's answer ends the call: the runtime is stopped with the background
|
|
71
|
+
* commands it still runs for the agent, which the journal counts. What the
|
|
72
|
+
* agent's commands leave running, once registered, ends with the call. The call's
|
|
73
|
+
* activity is recorded as it goes; a call that started always reports its
|
|
74
|
+
* measures, even when it fails. With `calls`, the call keeps a record of what
|
|
54
75
|
* flow sent before it starts, and of the agent's final text once it has it.
|
|
55
76
|
*/
|
|
56
77
|
export async function runCall(adapter, call, options) {
|
|
@@ -58,9 +79,12 @@ export async function runCall(adapter, call, options) {
|
|
|
58
79
|
const { record, onUsage } = options;
|
|
59
80
|
const session = `${adapter.name}:${call.session}`;
|
|
60
81
|
await mkdir(call.sessions.directory, { recursive: true, mode: 0o700 });
|
|
61
|
-
const
|
|
82
|
+
const groups = join(call.sessions.directory, `${randomUUID()}.groups`);
|
|
83
|
+
const started = await adapter.start({ ...call, groups });
|
|
62
84
|
// A request that cannot be written fails before the call starts.
|
|
63
85
|
const request = agentPrompt(call);
|
|
86
|
+
const given = Object.keys(call.env ?? {}).sort();
|
|
87
|
+
const env = { ...call.env, ...started.env };
|
|
64
88
|
let kept;
|
|
65
89
|
if (options.calls) {
|
|
66
90
|
const sent = {
|
|
@@ -70,6 +94,7 @@ export async function runCall(adapter, call, options) {
|
|
|
70
94
|
executable: adapter.executable,
|
|
71
95
|
args: started.shown,
|
|
72
96
|
env: started.env ?? {},
|
|
97
|
+
...(given.length ? { given } : {}),
|
|
73
98
|
},
|
|
74
99
|
};
|
|
75
100
|
kept = { ...(await newRecord(options.calls, sent)), record: sent };
|
|
@@ -94,8 +119,10 @@ export async function runCall(adapter, call, options) {
|
|
|
94
119
|
cwd: options.dir,
|
|
95
120
|
timeoutMs: call.profile.timeoutMs,
|
|
96
121
|
stdin: request,
|
|
97
|
-
...(
|
|
122
|
+
...(Object.keys(env).length ? { env } : {}),
|
|
98
123
|
stopSignal: adapter.stopSignal,
|
|
124
|
+
...(adapter.stopGraceMs ? { stopGraceMs: adapter.stopGraceMs } : {}),
|
|
125
|
+
groups,
|
|
99
126
|
onLine: (line) => {
|
|
100
127
|
if (!line)
|
|
101
128
|
return;
|
|
@@ -106,6 +133,7 @@ export async function runCall(adapter, call, options) {
|
|
|
106
133
|
catch {
|
|
107
134
|
throw new Error(`${label} emitted invalid JSONL output`);
|
|
108
135
|
}
|
|
136
|
+
let ended;
|
|
109
137
|
for (const item of started.read(event))
|
|
110
138
|
switch (item.type) {
|
|
111
139
|
case "tool": {
|
|
@@ -167,10 +195,29 @@ export async function runCall(adapter, call, options) {
|
|
|
167
195
|
throw new Error(item.message);
|
|
168
196
|
case "result":
|
|
169
197
|
text = item.text;
|
|
198
|
+
if (answers(item.text, item.background))
|
|
199
|
+
ended = item.background;
|
|
170
200
|
}
|
|
201
|
+
if (!ended)
|
|
202
|
+
return;
|
|
203
|
+
const { commands } = ended;
|
|
204
|
+
if (commands)
|
|
205
|
+
record?.({
|
|
206
|
+
kind: "notice",
|
|
207
|
+
notice: "background",
|
|
208
|
+
message: `${label} still ran ${commands} background command${commands === 1 ? "" : "s"} after the agent answered, stopped with the call`,
|
|
209
|
+
});
|
|
210
|
+
return "stop";
|
|
171
211
|
},
|
|
172
212
|
});
|
|
173
|
-
if (exit.
|
|
213
|
+
if (exit.left)
|
|
214
|
+
record?.({
|
|
215
|
+
kind: "notice",
|
|
216
|
+
notice: "leftover",
|
|
217
|
+
message: `The agent's commands left ${exit.left} process${exit.left === 1 ? "" : "es"} running, stopped with the call`,
|
|
218
|
+
});
|
|
219
|
+
// Stopped once the agent had answered, the runtime exits as its stop signal makes it.
|
|
220
|
+
if (exit.exitCode !== 0 && !exit.stopped)
|
|
174
221
|
throw new Error(`${label} exited with code ${exit.exitCode}: ${exit.stderr.trim() || "no error output"}`);
|
|
175
222
|
if (text === undefined)
|
|
176
223
|
throw new Error(`${label} completed without a final result`);
|
|
@@ -194,6 +241,7 @@ export async function runCall(adapter, call, options) {
|
|
|
194
241
|
throw error;
|
|
195
242
|
}
|
|
196
243
|
finally {
|
|
244
|
+
await rm(groups, { force: true });
|
|
197
245
|
// What the agent answered, even when the engine cannot read it, before the
|
|
198
246
|
// call ends; a record that cannot take it changes neither its outcome nor its measures.
|
|
199
247
|
if (kept &&
|
|
@@ -255,6 +303,7 @@ export class AgentRuntime {
|
|
|
255
303
|
...(request.resumedAfter === undefined
|
|
256
304
|
? {}
|
|
257
305
|
: { resumedAfter: request.resumedAfter }),
|
|
306
|
+
...(request.env === undefined ? {} : { env: request.env }),
|
|
258
307
|
// Paths as the workflow declares them, not as resolved on this machine.
|
|
259
308
|
settings: agentSettings(declared),
|
|
260
309
|
prompt: request.prompt,
|