@firefunc-agent/runner 0.9.14 → 0.9.35
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 +184 -10
- package/dist/alive.d.ts +40 -0
- package/dist/alive.js +138 -0
- package/dist/api-fallback.d.ts +4 -2
- package/dist/api-fallback.js +26 -1
- package/dist/api.d.ts +66 -3
- package/dist/api.js +164 -3
- package/dist/brief-file.d.ts +15 -0
- package/dist/brief-file.js +36 -0
- package/dist/brief.d.ts +3 -0
- package/dist/brief.js +14 -4
- package/dist/build-caches.d.ts +7 -0
- package/dist/build-caches.js +63 -0
- package/dist/build-info.json +2 -2
- package/dist/checkpoint.d.ts +40 -0
- package/dist/checkpoint.js +98 -0
- package/dist/cli.js +184 -18
- package/dist/cloud-boot.d.ts +41 -0
- package/dist/cloud-boot.js +239 -0
- package/dist/command-activity.d.ts +23 -0
- package/dist/command-activity.js +89 -0
- package/dist/command-step.d.ts +58 -0
- package/dist/command-step.js +248 -0
- package/dist/config.d.ts +39 -0
- package/dist/config.js +23 -0
- package/dist/cut.d.ts +1 -1
- package/dist/cut.js +13 -3
- package/dist/daemon.js +364 -15
- package/dist/device-lease.d.ts +15 -0
- package/dist/device-lease.js +608 -0
- package/dist/editor/fs-server.d.ts +31 -0
- package/dist/editor/fs-server.js +159 -0
- package/dist/editor/relay-crypto.d.ts +68 -0
- package/dist/editor/relay-crypto.js +191 -0
- package/dist/editor/sessions.d.ts +50 -0
- package/dist/editor/sessions.js +279 -0
- package/dist/editor/worktree-of.d.ts +1 -0
- package/dist/editor/worktree-of.js +23 -0
- package/dist/editor/ws-client.d.ts +26 -0
- package/dist/editor/ws-client.js +227 -0
- package/dist/engine-account.d.ts +24 -0
- package/dist/engine-account.js +118 -0
- package/dist/engine-login.d.ts +12 -0
- package/dist/engine-login.js +88 -0
- package/dist/engine-models.d.ts +13 -0
- package/dist/engine-models.js +71 -0
- package/dist/engine-watch.d.ts +1 -0
- package/dist/engine-watch.js +22 -6
- package/dist/engines/antigravity.d.ts +2 -0
- package/dist/engines/antigravity.js +74 -4
- package/dist/engines/claude.js +22 -9
- package/dist/engines/codex.js +16 -2
- package/dist/engines/copilot.js +12 -0
- package/dist/engines/crush.d.ts +2 -0
- package/dist/engines/crush.js +58 -0
- package/dist/engines/cursor.js +12 -0
- package/dist/engines/gemini.js +14 -9
- package/dist/engines/index.d.ts +8 -0
- package/dist/engines/index.js +73 -1
- package/dist/engines/kilo.d.ts +2 -0
- package/dist/engines/kilo.js +63 -0
- package/dist/engines/opencode.d.ts +9 -0
- package/dist/engines/opencode.js +234 -0
- package/dist/engines/openhands.d.ts +10 -0
- package/dist/engines/openhands.js +271 -0
- package/dist/engines/pi.d.ts +10 -0
- package/dist/engines/pi.js +248 -0
- package/dist/engines/qwen.d.ts +8 -0
- package/dist/engines/qwen.js +153 -0
- package/dist/engines/sessions.d.ts +6 -0
- package/dist/engines/sessions.js +68 -0
- package/dist/engines/types.d.ts +3 -3
- package/dist/exec.d.ts +1 -0
- package/dist/exec.js +10 -4
- package/dist/firefunc/agents.d.ts +8 -1
- package/dist/firefunc/agents.js +53 -3
- package/dist/firefunc/auth.js +72 -19
- package/dist/firefunc/automations.d.ts +2 -0
- package/dist/firefunc/automations.js +290 -0
- package/dist/firefunc/cli.js +25 -0
- package/dist/firefunc/client.d.ts +5 -1
- package/dist/firefunc/client.js +12 -2
- package/dist/firefunc/config.d.ts +11 -1
- package/dist/firefunc/config.js +6 -4
- package/dist/firefunc/io.d.ts +1 -0
- package/dist/firefunc/main.js +34 -2
- package/dist/firefunc/oauth-login.d.ts +23 -0
- package/dist/firefunc/oauth-login.js +304 -0
- package/dist/firefunc/tasks.d.ts +4 -0
- package/dist/firefunc/tasks.js +89 -2
- package/dist/fleet-words.d.ts +2 -0
- package/dist/fleet-words.js +7 -0
- package/dist/git-auth.d.ts +15 -0
- package/dist/git-auth.js +39 -1
- package/dist/held.d.ts +3 -0
- package/dist/job.d.ts +26 -3
- package/dist/job.js +763 -152
- package/dist/keep-awake.d.ts +17 -0
- package/dist/keep-awake.js +90 -0
- package/dist/keep-local.d.ts +1 -1
- package/dist/keep-local.js +5 -3
- package/dist/limit.d.ts +9 -1
- package/dist/limit.js +260 -3
- package/dist/local-checks.d.ts +19 -0
- package/dist/local-checks.js +79 -0
- package/dist/locks.d.ts +18 -1
- package/dist/locks.js +249 -69
- package/dist/machine-commands.d.ts +21 -0
- package/dist/machine-commands.js +107 -0
- package/dist/machine-profile.d.ts +18 -0
- package/dist/machine-profile.js +69 -0
- package/dist/mcp-init.d.ts +2 -0
- package/dist/mcp-init.js +28 -0
- package/dist/mcp.d.ts +13 -1
- package/dist/mcp.js +48 -4
- package/dist/network.js +3 -2
- package/dist/openrouter.d.ts +15 -0
- package/dist/openrouter.js +39 -0
- package/dist/orphans.d.ts +4 -0
- package/dist/orphans.js +96 -4
- package/dist/pool.d.ts +1 -0
- package/dist/pool.js +25 -2
- package/dist/pr-title.d.ts +10 -0
- package/dist/pr-title.js +15 -0
- package/dist/recover.d.ts +3 -1
- package/dist/recover.js +27 -7
- package/dist/release-draft.d.ts +79 -0
- package/dist/release-draft.js +301 -0
- package/dist/resources.d.ts +86 -0
- package/dist/resources.js +217 -0
- package/dist/restart-idle.d.ts +23 -0
- package/dist/restart-idle.js +67 -0
- package/dist/run-attachments.d.ts +5 -0
- package/dist/run-attachments.js +14 -9
- package/dist/run-stops.d.ts +15 -0
- package/dist/run-stops.js +90 -0
- package/dist/run-temp.d.ts +12 -0
- package/dist/run-temp.js +57 -0
- package/dist/secret-scan.d.ts +5 -0
- package/dist/secret-scan.js +30 -0
- package/dist/self-upgrade.d.ts +36 -0
- package/dist/self-upgrade.js +78 -0
- package/dist/service.d.ts +7 -1
- package/dist/service.js +50 -7
- package/dist/sign-in.d.ts +42 -0
- package/dist/sign-in.js +243 -0
- package/dist/tool-call.d.ts +59 -0
- package/dist/tool-call.js +375 -0
- package/dist/transport.d.ts +26 -0
- package/dist/transport.js +118 -0
- package/dist/work-dir.d.ts +11 -0
- package/dist/work-dir.js +69 -0
- package/dist/worktree-report.d.ts +10 -0
- package/dist/worktree-report.js +17 -0
- package/dist/worktrees.d.ts +16 -1
- package/dist/worktrees.js +62 -17
- package/package.json +4 -4
- package/skill/firefunc/SKILL.md +22 -3
package/dist/cli.js
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { expandHome, loadConfig, saveConfig,
|
|
2
|
+
import { configPath, drainSetting, expandHome, isDraining, loadConfig, runnerDir, saveConfig, editorsAllowed, } from './config.js';
|
|
3
3
|
import { startDaemon } from './daemon.js';
|
|
4
|
+
import { restartWhenIdle } from './restart-idle.js';
|
|
5
|
+
import { heldByLiveProcesses } from './held.js';
|
|
4
6
|
import { runBrief } from './brief.js';
|
|
5
7
|
import { runMcpList, runMcpLogin, runMcpLogout } from './mcp-login.js';
|
|
6
8
|
import { RUNNER_VERSION } from './version.js';
|
|
7
9
|
import { availableEngines, getAdapter } from './engines/index.js';
|
|
8
10
|
import { engineBlocks, unattendedContext } from './unattended.js';
|
|
9
|
-
import {
|
|
11
|
+
import { engineLoginBlock } from './engine-login.js';
|
|
12
|
+
import { liveRunner, liveRunnerWords, readAlive } from './alive.js';
|
|
13
|
+
import { setWorkDir, workDirFailure, workDirWords } from './work-dir.js';
|
|
14
|
+
import { diskOf } from './resources.js';
|
|
15
|
+
import { currentPlatform, defaultServiceDeps, EPHEMERAL_INSTALL_MESSAGE, installService, isEphemeralInstall, readLogTail, renderLaunchdPlist, renderSystemdUnit, renderWindowsLauncher, renderWindowsTaskXml, serviceStatus, serviceWords, servicePaths, startService, stopService, uninstallService, } from './service.js';
|
|
10
16
|
const HELP = `firefunc-runner — run YOUR local coding agent on work FireFunc routes to you.
|
|
11
|
-
(Claude Code, OpenAI Codex, Gemini CLI
|
|
17
|
+
(Claude Code, OpenAI Codex, Gemini CLI, Cursor CLI, GitHub Copilot CLI, Google
|
|
18
|
+
Antigravity, or the open harnesses OpenCode, Pi, Kilo Code, Qwen Code and Crush —
|
|
19
|
+
whichever you have installed.)
|
|
12
20
|
|
|
13
21
|
Usage:
|
|
14
22
|
firefunc-runner connect <token> [options] Save your runner token + settings
|
|
@@ -19,12 +27,30 @@ Usage:
|
|
|
19
27
|
firefunc-runner stop Stop the background service
|
|
20
28
|
firefunc-runner start-service Start the background service again
|
|
21
29
|
firefunc-runner logs Show recent runner output
|
|
30
|
+
firefunc-runner allow-commands Let automations run command steps here (deny-commands: stop)
|
|
31
|
+
firefunc-runner config set devMode.editor on|off
|
|
32
|
+
Let a paired editor open a run's folder here,
|
|
33
|
+
read-only, end-to-end encrypted through FireFunc's
|
|
34
|
+
relay (off by default)
|
|
35
|
+
firefunc-runner config get devMode.editor Whether editors may open runs' folders here
|
|
36
|
+
firefunc-runner drain Finish the runs in flight and take nothing new
|
|
37
|
+
(the machine stays online); safe to update or
|
|
38
|
+
restart once the log says "drained"
|
|
39
|
+
firefunc-runner resume Take work again after a drain
|
|
40
|
+
firefunc-runner restart --when-idle Drain, wait until no run is held, restart the
|
|
41
|
+
service, then take work again
|
|
42
|
+
(--max-wait <minutes> gives up after that)
|
|
22
43
|
firefunc-runner uninstall Remove the background service
|
|
23
44
|
firefunc-runner status Show the saved config, whether each engine can
|
|
24
45
|
run unattended here, and the service state
|
|
25
46
|
firefunc-runner mcp login <tool> Sign THIS machine in to a tool's MCP server
|
|
26
47
|
firefunc-runner mcp list Which MCP servers this machine is signed in to
|
|
27
48
|
firefunc-runner mcp logout <tool> Forget one MCP sign-in
|
|
49
|
+
firefunc-runner cloud-boot --provider <aws|azure|gcp> --api <url> --connection <id>
|
|
50
|
+
Run by a VM FireFunc started in Your cloud:
|
|
51
|
+
proves which VM it is, reads its engine keys
|
|
52
|
+
from your secret store (memory only), and takes
|
|
53
|
+
one task at a time. Not run by hand.
|
|
28
54
|
firefunc-runner --version Print this runner's version (also -v)
|
|
29
55
|
firefunc-runner --help
|
|
30
56
|
|
|
@@ -39,6 +65,8 @@ connect options:
|
|
|
39
65
|
command from the Engines screen; it fills this in.
|
|
40
66
|
--name <name> Friendly runner name (default: this hostname)
|
|
41
67
|
--repos-dir <dir> Base directory where your checkouts live (matched by repo name)
|
|
68
|
+
--work-dir <dir> Where each run's worktree and build copies go (default: the
|
|
69
|
+
OS temp folder) — e.g. D:\\firefunc on a small C: drive
|
|
42
70
|
--repo <owner/repo=/path> Map one repo to an exact local checkout (repeatable)
|
|
43
71
|
--claude-bin <bin> Claude Code binary (default: claude)
|
|
44
72
|
--claude-oauth-token <tok> Subscription token from "claude setup-token". Usually NOT
|
|
@@ -56,7 +84,25 @@ engine (the runner drives whatever agent CLI each job asks for — Claude Code b
|
|
|
56
84
|
default; the per-project Engine setting in FireFunc picks one, or set a local
|
|
57
85
|
fallback + each engine's auth here):
|
|
58
86
|
--engine <id> Default engine when a job doesn't pin one:
|
|
59
|
-
claude_code | codex_cli | gemini_cli | cursor_cli
|
|
87
|
+
claude_code | codex_cli | gemini_cli | cursor_cli | copilot_cli |
|
|
88
|
+
antigravity | opencode | pi | kilo | qwen_code | crush |
|
|
89
|
+
openhands
|
|
90
|
+
(default claude_code). Copilot signs in with "copilot
|
|
91
|
+
login" and Antigravity through its own app; their binaries
|
|
92
|
+
are "copilot" and "agy" ("copilotBin" / "antigravityBin" in
|
|
93
|
+
the config file change them). The open harnesses read each
|
|
94
|
+
model provider's key from this machine's environment
|
|
95
|
+
(OPENROUTER_API_KEY, ANTHROPIC_API_KEY, …) or their own
|
|
96
|
+
login ("opencode auth login", Pi's /login, "kilo auth");
|
|
97
|
+
FireFunc never holds the key ("opencodeBin", "piBin",
|
|
98
|
+
"kiloBin", "qwenBin", "crushBin", "openhandsBin" change the
|
|
99
|
+
binaries). OpenHands (uv tool install openhands==1.16.0
|
|
100
|
+
--python 3.12) uses your own LLM API key: LLM_API_KEY and
|
|
101
|
+
LLM_MODEL in this machine's environment, or run "openhands"
|
|
102
|
+
once to save them; no subscription sign-in. Its CLI is no
|
|
103
|
+
longer maintained upstream (since Aug 2026), it reports no
|
|
104
|
+
usage, takes no effort setting and gets no per-run FireFunc
|
|
105
|
+
tools (MCP).
|
|
60
106
|
--codex-bin <bin> OpenAI Codex binary (default: codex). Uses your "codex login"
|
|
61
107
|
(ChatGPT plan); API keys are hidden unless --codex-use-api-key.
|
|
62
108
|
--codex-use-api-key Bill OpenAI API credits via OPENAI_API_KEY instead of the ChatGPT plan.
|
|
@@ -177,6 +223,7 @@ async function main() {
|
|
|
177
223
|
token,
|
|
178
224
|
name: f.name?.[0],
|
|
179
225
|
reposDir: f['repos-dir']?.[0] ? expandHome(f['repos-dir'][0]) : undefined,
|
|
226
|
+
workDir: f['work-dir']?.[0] ? expandHome(f['work-dir'][0]) : undefined,
|
|
180
227
|
repos: Object.keys(repos).length ? repos : undefined,
|
|
181
228
|
claudeBin: f['claude-bin']?.[0],
|
|
182
229
|
quiet: f.quiet ? true : undefined,
|
|
@@ -280,15 +327,119 @@ async function main() {
|
|
|
280
327
|
process.exitCode = 1;
|
|
281
328
|
return;
|
|
282
329
|
}
|
|
330
|
+
if (cmd === 'config') {
|
|
331
|
+
const [verb, key, value] = rest;
|
|
332
|
+
const usage = 'Usage: firefunc-runner config set devMode.editor on|off · firefunc-runner config get devMode.editor\n';
|
|
333
|
+
if (key !== 'devMode.editor' || (verb !== 'get' && verb !== 'set')) {
|
|
334
|
+
process.stdout.write(key && key !== 'devMode.editor'
|
|
335
|
+
? `"${key}" is not a setting "config" changes. ${usage}`
|
|
336
|
+
: usage);
|
|
337
|
+
process.exitCode = 1;
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
const cfg = loadConfig();
|
|
341
|
+
if (!cfg) {
|
|
342
|
+
process.stdout.write('Not connected. Run "firefunc-runner connect <token>".\n');
|
|
343
|
+
process.exitCode = 1;
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
if (verb === 'get') {
|
|
347
|
+
process.stdout.write(`${editorsAllowed(cfg) ? 'on' : 'off'}\n`);
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
const on = value === 'on' || value === 'true';
|
|
351
|
+
if (!on && value !== 'off' && value !== 'false') {
|
|
352
|
+
process.stdout.write(`Say on or off. ${usage}`);
|
|
353
|
+
process.exitCode = 1;
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
saveConfig({ ...cfg, devMode: { ...(cfg.devMode ?? {}), editor: on } });
|
|
357
|
+
process.stdout.write(on
|
|
358
|
+
? "Editors on: a person who can read a task's code, and whose editor is paired with FireFunc, may open that run's folder on this machine — read-only, end-to-end encrypted through FireFunc's relay, for that task only, until the task or the editor ends. A running runner picks this up within a minute. \"firefunc-runner config set devMode.editor off\" stops it and closes open sessions.\n"
|
|
359
|
+
: "Editors off: no editor opens a run's folder on this machine; open sessions close within a minute.\n");
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
if (cmd === 'allow-commands' || cmd === 'deny-commands') {
|
|
363
|
+
const cfg = loadConfig();
|
|
364
|
+
if (!cfg) {
|
|
365
|
+
process.stdout.write('Not connected. Run "firefunc-runner connect <token>".\n');
|
|
366
|
+
process.exitCode = 1;
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
const on = cmd === 'allow-commands';
|
|
370
|
+
saveConfig({ ...cfg, allowCommands: on });
|
|
371
|
+
process.stdout.write(on
|
|
372
|
+
? 'Commands allowed: automations of the projects this machine serves may run a command step here, in the repository\'s checkout on this machine (nothing is cloned). Each runs with its time limit; its exit code and last 2,000 lines of output go to FireFunc. Run "firefunc-runner deny-commands" to stop.\n'
|
|
373
|
+
: 'Commands denied: this machine runs no automation command step. A step that asks it is told why.\n');
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
if (cmd === 'drain' || cmd === 'resume') {
|
|
377
|
+
const cfg = loadConfig();
|
|
378
|
+
if (!cfg) {
|
|
379
|
+
process.stdout.write('Not connected. Run "firefunc-runner connect <token>".\n');
|
|
380
|
+
process.exitCode = 1;
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
saveConfig(drainSetting(cfg, cmd === 'drain'));
|
|
384
|
+
process.stdout.write(cmd === 'drain'
|
|
385
|
+
? 'Draining: the runner finishes the runs it holds and takes nothing new; the machine stays online. ' +
|
|
386
|
+
'Its log says "drained — safe to update or restart" once nothing is left (within a minute of the last run ending). ' +
|
|
387
|
+
'Run "firefunc-runner resume" to take work again.\n'
|
|
388
|
+
: 'Resumed: the runner takes work again within a minute.\n');
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
if (cmd === 'restart') {
|
|
392
|
+
if (!rest.includes('--when-idle')) {
|
|
393
|
+
process.stderr.write('Usage: firefunc-runner restart --when-idle [--max-wait <minutes>]\n' +
|
|
394
|
+
' Drains the runner, waits until it holds no run, restarts the service and takes work again.\n' +
|
|
395
|
+
' To restart at once, cutting the runs in flight short (their work is kept for the next run): firefunc-runner start-service\n');
|
|
396
|
+
process.exitCode = 1;
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
const at = rest.indexOf('--max-wait');
|
|
400
|
+
const minutes = at >= 0 ? Number(rest[at + 1]) : null;
|
|
401
|
+
if (at >= 0 && !(minutes != null && Number.isFinite(minutes) && minutes > 0)) {
|
|
402
|
+
process.stderr.write('--max-wait takes a number of minutes, such as --max-wait 60.\n');
|
|
403
|
+
process.exitCode = 1;
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
const os = currentPlatform();
|
|
407
|
+
const deps = defaultServiceDeps('', os);
|
|
408
|
+
const res = await restartWhenIdle({
|
|
409
|
+
load: loadConfig,
|
|
410
|
+
save: saveConfig,
|
|
411
|
+
held: () => heldByLiveProcesses(runnerDir()),
|
|
412
|
+
restart: async () => {
|
|
413
|
+
const installed = (await serviceStatus(deps)).installed;
|
|
414
|
+
if (!installed)
|
|
415
|
+
return { ok: false, installed, message: '' };
|
|
416
|
+
const stopped = await stopService(deps);
|
|
417
|
+
if (!stopped.ok)
|
|
418
|
+
return { ...stopped, installed };
|
|
419
|
+
return { ...(await startService(deps)), installed };
|
|
420
|
+
},
|
|
421
|
+
sleep: (ms) => new Promise((r) => setTimeout(r, ms)),
|
|
422
|
+
now: () => Date.now(),
|
|
423
|
+
log: (line) => process.stdout.write(`${line}\n`),
|
|
424
|
+
maxWaitMs: minutes != null ? minutes * 60_000 : null,
|
|
425
|
+
});
|
|
426
|
+
process.stdout.write(`${res.message}\n`);
|
|
427
|
+
if (!res.ok)
|
|
428
|
+
process.exitCode = 1;
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
283
431
|
if (cmd === 'status') {
|
|
284
432
|
const cfg = loadConfig();
|
|
285
433
|
if (!cfg) {
|
|
286
434
|
process.stdout.write('Not connected. Run "firefunc-runner connect <token>".\n');
|
|
287
435
|
return;
|
|
288
436
|
}
|
|
437
|
+
setWorkDir(cfg.workDir);
|
|
438
|
+
const workDirWhy = workDirFailure();
|
|
289
439
|
process.stdout.write(`Connected to ${cfg.apiUrl}\n` +
|
|
290
440
|
` name: ${cfg.name ?? '(hostname)'}\n` +
|
|
291
441
|
` reposDir: ${cfg.reposDir ?? '(none)'}\n` +
|
|
442
|
+
` workDir: ${workDirWords(cfg.workDir, diskOf, workDirWhy)}\n` +
|
|
292
443
|
` repos: ${cfg.repos ? Object.keys(cfg.repos).join(', ') : '(auto by name)'}\n` +
|
|
293
444
|
` engine: ${cfg.engine ?? 'claude_code'} (default; per-project setting wins)\n` +
|
|
294
445
|
` claudeBin: ${cfg.claudeBin ?? 'claude'}\n` +
|
|
@@ -296,7 +447,7 @@ async function main() {
|
|
|
296
447
|
` gemini: ${cfg.geminiBin ?? 'gemini'}${cfg.geminiApiKey ? ' (API key set)' : ' (env auth)'}\n` +
|
|
297
448
|
` cursor: ${cfg.cursorAgentBin ?? 'cursor-agent'}${cfg.cursorApiKey ? ' (API key set)' : ' (no key — set --cursor-api-key)'}\n` +
|
|
298
449
|
` liveViewer:${cfg.viewerEnabled === false ? ' off' : ` http://127.0.0.1:${cfg.viewerPort ?? 8787} (local only)`}\n` +
|
|
299
|
-
` maxParallel:${cfg.maxParallel ? ` ${cfg.maxParallel} at once (set here — overrides FireFunc)` : ' from FireFunc (the highest "Runs at once" among the projects this machine serves)'}\n` +
|
|
450
|
+
` maxParallel:${isDraining(cfg) ? ' 0 — draining: finishing what it holds, taking nothing new ("firefunc-runner resume" takes work again)' : cfg.maxParallel ? ` ${cfg.maxParallel} at once (set here — overrides FireFunc)` : ' from FireFunc (the highest "Runs at once" among the projects this machine serves)'}\n` +
|
|
300
451
|
` claudeAuth:${cfg.claudeUseApiKey
|
|
301
452
|
? ' ANTHROPIC_API_KEY (API billing — opted in)'
|
|
302
453
|
: cfg.claudeCodeOAuthToken
|
|
@@ -306,7 +457,8 @@ async function main() {
|
|
|
306
457
|
` setup: ${cfg.setupCommands?.length ? cfg.setupCommands.join(' ; ') : '(none)'}\n` +
|
|
307
458
|
` autoInstall:${cfg.autoInstall === false ? ' off' : ' on (when no setup)'}\n` +
|
|
308
459
|
` background:${cfg.backgroundCommands?.length ? ' ' + cfg.backgroundCommands.join(' ; ') : ' (none)'}\n` +
|
|
309
|
-
` envFile: ${cfg.envFile ?? '(none)'}\n`
|
|
460
|
+
` envFile: ${cfg.envFile ?? '(none)'}\n` +
|
|
461
|
+
` editors: ${editorsAllowed(cfg) ? "on — a paired editor may open a run's folder here, read-only, end-to-end encrypted" : 'off ("firefunc-runner config set devMode.editor on" lets paired editors open runs\' folders here)'}\n`);
|
|
310
462
|
const installed = availableEngines(cfg);
|
|
311
463
|
const blocks = engineBlocks(installed, unattendedContext(cfg));
|
|
312
464
|
process.stdout.write(`\nengines: ${installed.length ? '' : 'none found on PATH — install one (e.g. claude), or set --claude-bin'}\n` +
|
|
@@ -314,24 +466,37 @@ async function main() {
|
|
|
314
466
|
.map((e) => {
|
|
315
467
|
const b = blocks.find((x) => x.engine === e);
|
|
316
468
|
const name = getAdapter(e).displayName;
|
|
469
|
+
const login = b ? null : engineLoginBlock(e, cfg);
|
|
317
470
|
return b
|
|
318
471
|
? ` ${e}: CANNOT RUN UNATTENDED as this user — ${b.reason}\n Fix: ${b.fix}\n The runner claims no ${name} work until then.\n`
|
|
319
|
-
:
|
|
472
|
+
: login
|
|
473
|
+
? ` ${e}: NOT SIGNED IN for this user — ${login.reason}\n Fix: ${login.fix}\n The runner claims no ${name} work until then.\n`
|
|
474
|
+
: ` ${e}: ready (${name})\n`;
|
|
320
475
|
})
|
|
321
476
|
.join(''));
|
|
322
477
|
const os = currentPlatform();
|
|
323
478
|
const deps = defaultServiceDeps('', os);
|
|
324
479
|
const svc = await serviceStatus(deps);
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
480
|
+
const live = liveRunner(readAlive(runnerDir()));
|
|
481
|
+
process.stdout.write(`\n${liveRunnerWords(live, { logPath: svc.log, os })}`);
|
|
482
|
+
process.stdout.write(serviceWords(svc, os, live.state === 'running'));
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
if (cmd === 'cloud-boot') {
|
|
486
|
+
const f = parseFlags(rest);
|
|
487
|
+
const provider = f.provider?.[0];
|
|
488
|
+
const apiUrl = f.api?.[0]?.trim() ?? '';
|
|
489
|
+
const connectionId = f.connection?.[0]?.trim() ?? '';
|
|
490
|
+
if ((provider !== 'aws' && provider !== 'azure' && provider !== 'gcp') ||
|
|
491
|
+
!/^https:\/\//.test(apiUrl) ||
|
|
492
|
+
!/^[0-9a-f-]{36}$/.test(connectionId)) {
|
|
493
|
+
process.stderr.write('Usage: firefunc-runner cloud-boot --provider aws|azure|gcp --api https://… --connection <id>\n' +
|
|
494
|
+
'It is run by the VM FireFunc starts in your cloud, not by hand.\n');
|
|
495
|
+
process.exitCode = 2;
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
const { cloudBoot } = await import('./cloud-boot.js');
|
|
499
|
+
await cloudBoot({ provider, apiUrl, connectionId }, { start: startDaemon });
|
|
335
500
|
return;
|
|
336
501
|
}
|
|
337
502
|
if (cmd === 'start') {
|
|
@@ -371,12 +536,13 @@ async function main() {
|
|
|
371
536
|
: os === 'win32'
|
|
372
537
|
? renderWindowsTaskXml({
|
|
373
538
|
...unitInput,
|
|
539
|
+
launcherPath: paths.launcher ?? '',
|
|
374
540
|
userId: process.env.USERDOMAIN
|
|
375
541
|
? `${process.env.USERDOMAIN}\\${process.env.USERNAME ?? ''}`
|
|
376
542
|
: (process.env.USERNAME ?? ''),
|
|
377
543
|
})
|
|
378
544
|
: renderSystemdUnit(unitInput);
|
|
379
|
-
const deps = defaultServiceDeps(unitBody, os);
|
|
545
|
+
const deps = defaultServiceDeps(unitBody, os, os === 'win32' ? renderWindowsLauncher(unitInput) : undefined);
|
|
380
546
|
if (cmd === 'install') {
|
|
381
547
|
if (!loadConfig()) {
|
|
382
548
|
process.stderr.write('Not connected. Run "firefunc-runner connect <token>" first.\n');
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type RunnerConfig } from './config.js';
|
|
2
|
+
export type CloudProvider = 'aws' | 'azure' | 'gcp';
|
|
3
|
+
export type Fetch = (url: string, init?: RequestInit) => Promise<Response>;
|
|
4
|
+
export declare const runnerAudience: (connectionId: string) => string;
|
|
5
|
+
export type CloudBootConfig = NonNullable<RunnerConfig['cloud']>;
|
|
6
|
+
export type AwsCreds = {
|
|
7
|
+
accessKeyId: string;
|
|
8
|
+
secretAccessKey: string;
|
|
9
|
+
sessionToken?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function signAws(input: {
|
|
12
|
+
url: string;
|
|
13
|
+
headers: Record<string, string>;
|
|
14
|
+
body: string;
|
|
15
|
+
region: string;
|
|
16
|
+
service: string;
|
|
17
|
+
creds: AwsCreds;
|
|
18
|
+
now?: Date;
|
|
19
|
+
}): Record<string, string>;
|
|
20
|
+
export declare function awsInstance(fetchFn: Fetch): Promise<{
|
|
21
|
+
creds: AwsCreds;
|
|
22
|
+
region: string;
|
|
23
|
+
}>;
|
|
24
|
+
export declare function identityProof(provider: CloudProvider, connectionId: string, fetchFn: Fetch, ctx?: {
|
|
25
|
+
azureClientId?: string | null;
|
|
26
|
+
now?: Date;
|
|
27
|
+
}): Promise<Record<string, unknown>>;
|
|
28
|
+
export declare function readSecret(boot: CloudBootConfig, name: string, fetchFn: Fetch): Promise<string | null>;
|
|
29
|
+
export declare function loadEngineKeys(boot: CloudBootConfig, fetchFn: Fetch, env?: NodeJS.ProcessEnv): Promise<Record<string, 'found' | 'missing'>>;
|
|
30
|
+
export declare function cloudRunnerConfig(base: RunnerConfig, keys: Record<string, 'found' | 'missing'>): RunnerConfig;
|
|
31
|
+
export declare function cloudBoot(input: {
|
|
32
|
+
provider: CloudProvider;
|
|
33
|
+
apiUrl: string;
|
|
34
|
+
connectionId: string;
|
|
35
|
+
}, deps: {
|
|
36
|
+
fetchFn?: Fetch;
|
|
37
|
+
start: (cfg: RunnerConfig) => Promise<void>;
|
|
38
|
+
log?: (s: string) => void;
|
|
39
|
+
load?: () => RunnerConfig | null;
|
|
40
|
+
save?: (c: RunnerConfig) => void;
|
|
41
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { createHash, createHmac } from 'node:crypto';
|
|
2
|
+
import { hostname } from 'node:os';
|
|
3
|
+
import { loadConfig, saveConfig } from './config.js';
|
|
4
|
+
export const runnerAudience = (connectionId) => `firefunc-runner:${connectionId}`;
|
|
5
|
+
const ENGINE_ENV = {
|
|
6
|
+
claude_code_channel: 'ANTHROPIC_API_KEY',
|
|
7
|
+
codex_cli_channel: 'OPENAI_API_KEY',
|
|
8
|
+
gemini_cli_channel: 'GEMINI_API_KEY',
|
|
9
|
+
};
|
|
10
|
+
const sha256Hex = (s) => createHash('sha256').update(s, 'utf8').digest('hex');
|
|
11
|
+
const hmac = (k, s) => createHmac('sha256', k).update(s, 'utf8').digest();
|
|
12
|
+
export function signAws(input) {
|
|
13
|
+
const u = new URL(input.url);
|
|
14
|
+
const amzDate = (input.now ?? new Date()).toISOString().replace(/[:-]|\.\d{3}/g, '');
|
|
15
|
+
const day = amzDate.slice(0, 8);
|
|
16
|
+
const h = {};
|
|
17
|
+
for (const [k, v] of Object.entries(input.headers))
|
|
18
|
+
h[k.toLowerCase()] = v.trim();
|
|
19
|
+
h.host = u.host;
|
|
20
|
+
h['x-amz-date'] = amzDate;
|
|
21
|
+
if (input.creds.sessionToken)
|
|
22
|
+
h['x-amz-security-token'] = input.creds.sessionToken;
|
|
23
|
+
const names = Object.keys(h).sort();
|
|
24
|
+
const canonical = [
|
|
25
|
+
'POST',
|
|
26
|
+
u.pathname || '/',
|
|
27
|
+
'',
|
|
28
|
+
names.map((k) => `${k}:${h[k]}\n`).join(''),
|
|
29
|
+
names.join(';'),
|
|
30
|
+
sha256Hex(input.body),
|
|
31
|
+
].join('\n');
|
|
32
|
+
const scope = `${day}/${input.region}/${input.service}/aws4_request`;
|
|
33
|
+
const toSign = ['AWS4-HMAC-SHA256', amzDate, scope, sha256Hex(canonical)].join('\n');
|
|
34
|
+
const kSign = hmac(hmac(hmac(hmac(`AWS4${input.creds.secretAccessKey}`, day), input.region), input.service), 'aws4_request');
|
|
35
|
+
const sig = createHmac('sha256', kSign).update(toSign, 'utf8').digest('hex');
|
|
36
|
+
const out = { ...h };
|
|
37
|
+
delete out.host;
|
|
38
|
+
out.authorization = `AWS4-HMAC-SHA256 Credential=${input.creds.accessKeyId}/${scope}, SignedHeaders=${names.join(';')}, Signature=${sig}`;
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
const IMDS = 'http://169.254.169.254';
|
|
42
|
+
export async function awsInstance(fetchFn) {
|
|
43
|
+
const tok = await fetchFn(`${IMDS}/latest/api/token`, {
|
|
44
|
+
method: 'PUT',
|
|
45
|
+
headers: { 'x-aws-ec2-metadata-token-ttl-seconds': '300' },
|
|
46
|
+
});
|
|
47
|
+
if (!tok.ok)
|
|
48
|
+
throw new Error('IMDSv2 gave no token');
|
|
49
|
+
const t = await tok.text();
|
|
50
|
+
const get = async (path) => {
|
|
51
|
+
const r = await fetchFn(`${IMDS}${path}`, { headers: { 'x-aws-ec2-metadata-token': t } });
|
|
52
|
+
if (!r.ok)
|
|
53
|
+
throw new Error(`IMDS ${path} answered ${r.status}`);
|
|
54
|
+
return r.text();
|
|
55
|
+
};
|
|
56
|
+
const role = (await get('/latest/meta-data/iam/security-credentials/')).split('\n')[0].trim();
|
|
57
|
+
const c = JSON.parse(await get(`/latest/meta-data/iam/security-credentials/${role}`));
|
|
58
|
+
const region = (await get('/latest/meta-data/placement/region')).trim();
|
|
59
|
+
return {
|
|
60
|
+
creds: {
|
|
61
|
+
accessKeyId: c.AccessKeyId,
|
|
62
|
+
secretAccessKey: c.SecretAccessKey,
|
|
63
|
+
sessionToken: c.Token,
|
|
64
|
+
},
|
|
65
|
+
region,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export async function identityProof(provider, connectionId, fetchFn, ctx = {}) {
|
|
69
|
+
const aud = runnerAudience(connectionId);
|
|
70
|
+
if (provider === 'aws') {
|
|
71
|
+
const { creds, region } = await awsInstance(fetchFn);
|
|
72
|
+
const url = `https://sts.${region}.amazonaws.com/`;
|
|
73
|
+
const body = 'Action=GetCallerIdentity&Version=2011-06-15';
|
|
74
|
+
const headers = signAws({
|
|
75
|
+
url,
|
|
76
|
+
headers: {
|
|
77
|
+
'content-type': 'application/x-www-form-urlencoded; charset=utf-8',
|
|
78
|
+
'x-firefunc-audience': aud,
|
|
79
|
+
},
|
|
80
|
+
body,
|
|
81
|
+
region,
|
|
82
|
+
service: 'sts',
|
|
83
|
+
creds,
|
|
84
|
+
...(ctx.now ? { now: ctx.now } : {}),
|
|
85
|
+
});
|
|
86
|
+
return { url, headers, body };
|
|
87
|
+
}
|
|
88
|
+
if (provider === 'gcp') {
|
|
89
|
+
const r = await fetchFn(`http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/identity?audience=${encodeURIComponent(aud)}&format=full`, { headers: { 'metadata-flavor': 'Google' } });
|
|
90
|
+
if (!r.ok)
|
|
91
|
+
throw new Error(`the metadata server answered ${r.status}`);
|
|
92
|
+
return { token: (await r.text()).trim() };
|
|
93
|
+
}
|
|
94
|
+
if (!ctx.azureClientId)
|
|
95
|
+
throw new Error('FireFunc did not say its app id');
|
|
96
|
+
const r = await fetchFn(`${IMDS}/metadata/identity/oauth2/token?api-version=2018-02-01&resource=${encodeURIComponent(ctx.azureClientId)}`, { headers: { metadata: 'true' } });
|
|
97
|
+
if (!r.ok)
|
|
98
|
+
throw new Error(`IMDS answered ${r.status}`);
|
|
99
|
+
return { token: (await r.json()).access_token };
|
|
100
|
+
}
|
|
101
|
+
export async function readSecret(boot, name, fetchFn) {
|
|
102
|
+
try {
|
|
103
|
+
if (boot.provider === 'aws') {
|
|
104
|
+
const { creds } = await awsInstance(fetchFn);
|
|
105
|
+
const region = boot.store.region ?? 'us-east-1';
|
|
106
|
+
const url = `https://secretsmanager.${region}.amazonaws.com/`;
|
|
107
|
+
const body = JSON.stringify({ SecretId: name });
|
|
108
|
+
const headers = signAws({
|
|
109
|
+
url,
|
|
110
|
+
headers: {
|
|
111
|
+
'content-type': 'application/x-amz-json-1.1',
|
|
112
|
+
'x-amz-target': 'secretsmanager.GetSecretValue',
|
|
113
|
+
},
|
|
114
|
+
body,
|
|
115
|
+
region,
|
|
116
|
+
service: 'secretsmanager',
|
|
117
|
+
creds,
|
|
118
|
+
});
|
|
119
|
+
const r = await fetchFn(url, { method: 'POST', headers, body });
|
|
120
|
+
if (!r.ok)
|
|
121
|
+
return null;
|
|
122
|
+
const v = (await r.json()).SecretString;
|
|
123
|
+
return v?.trim() || null;
|
|
124
|
+
}
|
|
125
|
+
if (boot.provider === 'gcp') {
|
|
126
|
+
const t = await fetchFn('http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token', { headers: { 'metadata-flavor': 'Google' } });
|
|
127
|
+
if (!t.ok)
|
|
128
|
+
return null;
|
|
129
|
+
const token = (await t.json()).access_token;
|
|
130
|
+
const r = await fetchFn(`https://secretmanager.googleapis.com/v1/projects/${encodeURIComponent(boot.store.projectId ?? '')}/secrets/${encodeURIComponent(name)}/versions/latest:access`, { headers: { authorization: `Bearer ${token}` } });
|
|
131
|
+
if (!r.ok)
|
|
132
|
+
return null;
|
|
133
|
+
const data = (await r.json()).payload?.data;
|
|
134
|
+
return data ? Buffer.from(data, 'base64').toString('utf8').trim() || null : null;
|
|
135
|
+
}
|
|
136
|
+
const t = await fetchFn(`${IMDS}/metadata/identity/oauth2/token?api-version=2018-02-01&resource=${encodeURIComponent('https://vault.azure.net')}&msi_res_id=${encodeURIComponent(boot.store.keyIdentityId ?? '')}`, { headers: { metadata: 'true' } });
|
|
137
|
+
if (!t.ok)
|
|
138
|
+
return null;
|
|
139
|
+
const token = (await t.json()).access_token;
|
|
140
|
+
const r = await fetchFn(`https://${boot.store.vaultName}.vault.azure.net/secrets/${encodeURIComponent(name)}?api-version=7.4`, { headers: { authorization: `Bearer ${token}` } });
|
|
141
|
+
if (!r.ok)
|
|
142
|
+
return null;
|
|
143
|
+
return (await r.json()).value?.trim() || null;
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
export async function loadEngineKeys(boot, fetchFn, env = process.env) {
|
|
150
|
+
const out = {};
|
|
151
|
+
for (const [engine, name] of Object.entries(boot.engineSecrets)) {
|
|
152
|
+
const v = ENGINE_ENV[engine] ? await readSecret(boot, name, fetchFn) : null;
|
|
153
|
+
if (v && ENGINE_ENV[engine]) {
|
|
154
|
+
env[ENGINE_ENV[engine]] = v;
|
|
155
|
+
out[engine] = 'found';
|
|
156
|
+
}
|
|
157
|
+
else
|
|
158
|
+
out[engine] = 'missing';
|
|
159
|
+
}
|
|
160
|
+
return out;
|
|
161
|
+
}
|
|
162
|
+
export function cloudRunnerConfig(base, keys) {
|
|
163
|
+
const engine = keys.claude_code_channel === 'found'
|
|
164
|
+
? 'claude_code'
|
|
165
|
+
: keys.codex_cli_channel === 'found'
|
|
166
|
+
? 'codex_cli'
|
|
167
|
+
: keys.gemini_cli_channel === 'found'
|
|
168
|
+
? 'gemini_cli'
|
|
169
|
+
: base.engine;
|
|
170
|
+
return {
|
|
171
|
+
...base,
|
|
172
|
+
maxParallel: 1,
|
|
173
|
+
claudeUseApiKey: keys.claude_code_channel === 'found' ? true : base.claudeUseApiKey,
|
|
174
|
+
codexUseApiKey: keys.codex_cli_channel === 'found' ? true : base.codexUseApiKey,
|
|
175
|
+
...(engine ? { engine } : {}),
|
|
176
|
+
viewerEnabled: false,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
export async function cloudBoot(input, deps) {
|
|
180
|
+
const fetchFn = deps.fetchFn ?? fetch;
|
|
181
|
+
const log = deps.log ?? ((s) => process.stdout.write(`${s}\n`));
|
|
182
|
+
const load = deps.load ?? loadConfig;
|
|
183
|
+
const save = deps.save ?? saveConfig;
|
|
184
|
+
const api = input.apiUrl.replace(/\/+$/, '');
|
|
185
|
+
let cfg = load();
|
|
186
|
+
if (!cfg?.token || cfg.cloud?.connectionId !== input.connectionId) {
|
|
187
|
+
let azureClientId = null;
|
|
188
|
+
if (input.provider === 'azure') {
|
|
189
|
+
const a = await fetchFn(`${api}/channel/cloud/audience`);
|
|
190
|
+
azureClientId = a.ok
|
|
191
|
+
? (await a.json()).azureClientId
|
|
192
|
+
: null;
|
|
193
|
+
}
|
|
194
|
+
const proof = await identityProof(input.provider, input.connectionId, fetchFn, {
|
|
195
|
+
azureClientId,
|
|
196
|
+
});
|
|
197
|
+
const res = await fetchFn(`${api}/channel/cloud/identify`, {
|
|
198
|
+
method: 'POST',
|
|
199
|
+
headers: { 'content-type': 'application/json' },
|
|
200
|
+
body: JSON.stringify({
|
|
201
|
+
provider: input.provider,
|
|
202
|
+
connectionId: input.connectionId,
|
|
203
|
+
proof,
|
|
204
|
+
hostname: hostname(),
|
|
205
|
+
}),
|
|
206
|
+
});
|
|
207
|
+
if (!res.ok) {
|
|
208
|
+
const j = (await res.json().catch(() => ({})));
|
|
209
|
+
throw new Error(`FireFunc did not issue this runner a token: ${j.error?.message ?? res.status}. ${j.error?.details?.fix ?? ''}`);
|
|
210
|
+
}
|
|
211
|
+
const j = (await res.json());
|
|
212
|
+
cfg = {
|
|
213
|
+
...(cfg ?? {}),
|
|
214
|
+
apiUrl: j.apiUrl ?? api,
|
|
215
|
+
token: j.token,
|
|
216
|
+
name: j.runner.name,
|
|
217
|
+
maxParallel: 1,
|
|
218
|
+
cloud: {
|
|
219
|
+
provider: input.provider,
|
|
220
|
+
connectionId: input.connectionId,
|
|
221
|
+
engineSecrets: j.engineSecrets,
|
|
222
|
+
store: j.store,
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
save(cfg);
|
|
226
|
+
log(`Joined FireFunc as ${j.runner.name}.`);
|
|
227
|
+
}
|
|
228
|
+
const boot = cfg.cloud;
|
|
229
|
+
const keys = await loadEngineKeys(boot, fetchFn);
|
|
230
|
+
await fetchFn(`${cfg.apiUrl}/channel/cloud/keys`, {
|
|
231
|
+
method: 'POST',
|
|
232
|
+
headers: { 'content-type': 'application/json', authorization: `Bearer ${cfg.token}` },
|
|
233
|
+
body: JSON.stringify({ keys }),
|
|
234
|
+
}).catch(() => undefined);
|
|
235
|
+
for (const [e, s] of Object.entries(keys))
|
|
236
|
+
log(`${e}: key ${s}`);
|
|
237
|
+
await deps.start(cloudRunnerConfig(cfg, keys));
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=cloud-boot.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ProcessRow } from './orphans.js';
|
|
2
|
+
export declare const BUSY_CPU_MS = 2000;
|
|
3
|
+
export declare const BUSY_REPORT_MS: number;
|
|
4
|
+
export type CpuRow = ProcessRow & {
|
|
5
|
+
cpuMs: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function parseCpuTime(text: string): number | null;
|
|
8
|
+
export declare function parseCpuRows(stdout: string): CpuRow[];
|
|
9
|
+
export declare function commandCpuByGroup(rows: CpuRow[], groups: ReadonlySet<number>): Map<number, number>;
|
|
10
|
+
export type CommandActivityReport = {
|
|
11
|
+
runId: string;
|
|
12
|
+
at: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function commandActivityWatch(deps?: {
|
|
15
|
+
ps?: () => Promise<string | null>;
|
|
16
|
+
now?: () => number;
|
|
17
|
+
}): {
|
|
18
|
+
sample: (held: ReadonlyArray<{
|
|
19
|
+
runId: string;
|
|
20
|
+
engineGroup?: number;
|
|
21
|
+
}>) => Promise<void>;
|
|
22
|
+
report: () => CommandActivityReport[];
|
|
23
|
+
};
|