@firefunc-agent/runner 0.9.14 → 0.9.34
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 +167 -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 +65 -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 +38 -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.js +19 -4
- package/dist/engines/claude.js +10 -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/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 +8 -1
- 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 +752 -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 +23 -2
- package/dist/network.js +3 -2
- 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 +41 -0
- package/dist/sign-in.js +239 -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 +4 -3
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# firefunc-runner
|
|
2
2
|
|
|
3
|
-
Run **your own** coding agent — Claude Code, OpenAI Codex, Gemini CLI
|
|
3
|
+
Run **your own** coding agent — Claude Code, OpenAI Codex, Gemini CLI, Cursor CLI, GitHub Copilot CLI or Google Antigravity — on work FireFunc routes to you, and open PRs automatically.
|
|
4
4
|
|
|
5
5
|
This is the **self-hosted runner** for FireFunc's _Claude Code Channel_ engine. It's a tiny always-on daemon on your machine (laptop, dev box, CI host) that:
|
|
6
6
|
|
|
7
7
|
1. **long-polls FireFunc** (outbound only — works behind NAT/VPN, no inbound ports),
|
|
8
8
|
2. **claims** a bug FireFunc dispatched to your project,
|
|
9
|
-
3. runs **your local coding agent** (`claude -p`, `codex exec`, `gemini`,
|
|
9
|
+
3. runs **your local coding agent** (`claude -p`, `codex exec`, `gemini`, `cursor-agent`, `copilot` or `agy` — whichever the work is routed to) in an isolated git worktree off a clean base branch,
|
|
10
10
|
4. opens a **draft PR** and reports the result back.
|
|
11
11
|
|
|
12
12
|
**Why this and not the cloud Routine?** No ~15/day cap (it uses _your_ Claude subscription's limits), your **code never reaches FireFunc** — it goes from this machine to your own repository, and nowhere else — and it has your full local context — running app, AWS creds, `gh`/`git` auth, MCP servers, `CLAUDE.md`. What the runner does send is listed, field by field, under [What leaves your machine](#what-leaves-your-machine).
|
|
@@ -60,10 +60,12 @@ That's it. When your QA files a bug (labeled for FireFunc), it appears here with
|
|
|
60
60
|
- **An agent's own environment variables and reference files** (0.9.8). When the agent carries them, the runner asks FireFunc for them for the run it holds (`POST /channel/runs/<id>/agent-env` and `/reference-files` — answered only while that run is live for this machine). The variables are set in the **engine's** environment only — your setup and background commands never see them — and every value FireFunc marks secret is replaced by `[secret NAME]` in everything the runner sends to FireFunc (events, steps, results, a result kept to deliver later) and everything it logs or keeps (the terminal, the session log, the local viewer); a push whose added lines contain one is refused (`agent_secret`). The files are downloaded from addresses signed for minutes, checked against the size and SHA-256 FireFunc recorded, and written to `.firefunc/reference/` in the worktree by the skills' rules: never into a folder the checkout already has, a `.gitignore` of `*` inside, excluded from staging and refused at the push. The brief tells the agent the variables' names (never a value) and where the files are.
|
|
61
61
|
- Runs Claude with `--permission-mode bypassPermissions` (the default; override with `permissionMode` in the config or per job) **without** `--dangerously-skip-permissions`, which hangs non-interactive daemons. Note what that mode means: the agent is not asked to confirm anything, so the bounds that matter are the ones passed alongside it — `--disallowedTools` for every tool the chain withheld, and `--strict-mcp-config` so the run's servers are the ones FireFunc chose rather than whatever the machine happens to have.
|
|
62
62
|
- **Claims no work an engine cannot run here** (0.9.6). Claude Code refuses that mode as root or under sudo — the default user of most containers — and exits before doing anything, so a runner started as root used to fail every run it claimed. The runner now asks at start (and whenever it finds a newly installed CLI) whether each engine can run unattended as its user: one that cannot is not offered to FireFunc, which hands this machine none of its work, the log and `firefunc-runner status` say why with the fix, and the Machines page in FireFunc shows it too. A run that reaches it anyway is answered at once, without starting the engine, as the machine not being ready — not as the task's failure. The fix: run the runner as a normal user.
|
|
63
|
+
- **Claims no work for an engine that is not signed in for its user** (0.9.16). A runner installed as a service may not see the sign-in of your desktop session, and every run it claimed failed at once ("could not authenticate"). At start and every two minutes the runner asks Claude Code's own status check, `claude auth status`, which reads the local sign-in and spends nothing; on a clear "not logged in" it offers FireFunc no Claude Code work, says so in the log, `firefunc-runner status` and the Machines page, and a run waiting for it keeps its place until you sign in (`claude auth login`, or `claude setup-token` and `--claude-oauth-token`). An answer it cannot read is never taken for "not signed in".
|
|
63
64
|
- A per-job timeout (default 20 min) prevents a stuck run from hanging the daemon. An agent's own time budget (FireFunc sends it as `maxMinutes`, 0.9.3) is honoured under the `jobTimeoutMinutes` you set, and in its place when you set none; the engine is told how long it has.
|
|
64
65
|
- **Nothing a session starts outlives its job** (0.9.3). The engine runs in a process group of its own, and before the worktree is removed — however the job ended — the runner stops that group and every process whose working directory or command line is inside the worktree, its scratch folders or the review skills' `ff-review-*-<checkout>` copies of it, with their descendants; the copies are removed with the worktree. A session's backgrounded test run can no longer go on for hours in a deleted directory.
|
|
65
66
|
- **Cleans up after a stopped runner, and only after itself** (0.9.3). Each run it claims is written to `held/` in its folder; the next process to start reports the runs a gone process held as lost (so FireFunc can run them again at once), stops what they left running and removes their worktrees. At start, and whenever `git worktree add` finds one of its own leftover worktrees still holding the run's branch, it removes that worktree and tries once more. Only its own — `<temp>/firefunc-XXXXXX` — never yours.
|
|
66
67
|
- **One heavy command at a time per repository** (0.9.3). Its own setup commands and dependency install take a per-repository lock (`locks/` in its folder), and the engine is offered `$FIREFUNC_HEAVY` — the brief asks it to run a whole-project build, type-check or test suite as `"$FIREFUNC_HEAVY" <command>` — which waits on the same lock. Sessions on different repositories are untouched. `heavyLock: false` in the config turns it off.
|
|
68
|
+
- **The device is lent, one session at a time** (`$FIREFUNC_DEVICE`, `device-lease.ts`). Device work runs as `"$FIREFUNC_DEVICE" <command>`; `--hold` / `--release` keep the device across a sequence (install, set up, test), `--boot <avd>` starts the emulator as the machine's own (never stopped by a run's end; the crash-report dialog off), `--status` says who holds it. A command or a hold keeps it at most 30 minutes (`FIREFUNC_DEVICE_TIMEOUT`), is stopped once no device has answered adb for 5 minutes (`FIREFUNC_DEVICE_GONE`), and the device's airplane mode, wifi, data and proxy are put back when it lets go. A machine running several emulators lists their adb serials as `devices` in the config (`["emulator-5554", "emulator-5556"]`); each is lent to one session, with `ANDROID_SERIAL` set.
|
|
67
69
|
- **A plan's usage limit is not a failure** (0.9.3). When the engine's own closing report says its plan stopped it (Claude Code's "You've hit your session limit · resets 3:50am"), the attempt is reported as stopped by the plan's usage limit with the reset time, the runner claims no work for that engine until then (`limits.json` in its folder keeps that across a restart), and it keeps the session's worktree: when FireFunc runs the task again after the reset, the same session continues where it stopped (`--resume`) instead of starting over. A kept worktree is removed a day after its reset if the task never comes back.
|
|
68
70
|
- **A session that ends before its result comes is continued once** (0.9.3). A headless session ends with the agent's turn, and a test it moved to the background is stopped with it. The brief says so; and when the engine's own stream shows a command it started still running at the close — or its closing words only promise a later check ("Waiting on the admission run.") — the runner continues the same session once to get the result. A session that ends that way again is reported as unfinished: its closing words are not sent as its answer and nothing it changed is pushed.
|
|
69
71
|
- **The GitHub MCP token is renewed as the run goes on** (0.9.3). FireFunc's token for the GitHub MCP server lasts an hour, and runs last longer, so the engine reaches that server through a relay on 127.0.0.1 (a random port and key) which adds the token itself and renews it through FireFunc before it is 55 minutes old or when GitHub answers 401. The token is then never written into the worktree. `mcpRelay: false` in the config writes it into the run's MCP config as before.
|
|
@@ -81,6 +83,7 @@ That's it. When your QA files a bug (labeled for FireFunc), it appears here with
|
|
|
81
83
|
| `firefunc-runner logs` | Recent runner output |
|
|
82
84
|
| `firefunc-runner uninstall` | Remove the background service |
|
|
83
85
|
| `firefunc-runner status` | Saved config, whether each engine can run unattended here, and the service |
|
|
86
|
+
| `firefunc-runner allow-commands` | Let automations run command steps here (`deny-commands` takes it back) |
|
|
84
87
|
| `firefunc-runner --version` | The version this build carries — the one it reports to FireFunc (`-v`) |
|
|
85
88
|
|
|
86
89
|
### `connect` flags
|
|
@@ -166,7 +169,11 @@ holds each (the runner's own or Claude Code's), never a token. From 0.9.3 also:
|
|
|
166
169
|
the runs it holds (working on, or keeping a result for), the ids of runs the runner process
|
|
167
170
|
before it held and lost, and the plan limits it is waiting out (engine and reset time).
|
|
168
171
|
From 0.9.6 also: the engines installed here that cannot run unattended as the runner's user,
|
|
169
|
-
each with a word for why (`blockedEngines`, e.g. Claude Code and `runs_as_root
|
|
172
|
+
each with a word for why (`blockedEngines`, e.g. Claude Code and `runs_as_root`; from 0.9.16
|
|
173
|
+
also `not_signed_in`).
|
|
174
|
+
From 0.9.25 also: each installed engine CLI's own version as `<cli> --version` prints it
|
|
175
|
+
(`engineVersions`, e.g. `{ "claude_code": "2.1.3" }`), and, while an upgrade FireFunc asked
|
|
176
|
+
for is going, how it is going (`upgrade`: started, refused or failed, with the reason).
|
|
170
177
|
While it is finishing its runs before stopping, waiting out a plan limit on every engine
|
|
171
178
|
it has, or has no engine that can run unattended, the same request goes every 30 seconds as
|
|
172
179
|
a heartbeat that asks for no work (`heartbeat`, and `draining` while it stops).
|
|
@@ -347,13 +354,14 @@ which machine needs `npm i -g @firefunc-agent/runner@latest`.
|
|
|
347
354
|
## `firefunc`: agents from a terminal, a script or Claude Code
|
|
348
355
|
|
|
349
356
|
The package installs a second command, `firefunc`, for the person who sets agents up
|
|
350
|
-
rather than the machine that runs them. It drives FireFunc's public API
|
|
351
|
-
**workspace API key** (`ffk_…`, made in
|
|
352
|
-
|
|
357
|
+
rather than the machine that runs them. It drives FireFunc's public API as **you**,
|
|
358
|
+
signed in through your browser (0.9.26), or with a **workspace API key** (`ffk_…`, made in
|
|
359
|
+
FireFunc → Settings → API keys) for scripts and CI. It is how Claude Code sets up
|
|
360
|
+
FireFunc agents for you.
|
|
353
361
|
|
|
354
362
|
```bash
|
|
355
363
|
npm install -g @firefunc-agent/runner@latest # firefunc arrived in 0.9.0: check with firefunc --version
|
|
356
|
-
firefunc login #
|
|
364
|
+
firefunc login # opens FireFunc in your browser: pick the workspace, press Allow
|
|
357
365
|
firefunc templates list # look before you create
|
|
358
366
|
firefunc projects list
|
|
359
367
|
firefunc connections list --project "Web app"
|
|
@@ -370,7 +378,7 @@ installs the curated skills that template names, as launching it from the galler
|
|
|
370
378
|
|
|
371
379
|
| Command | Needs | What it does |
|
|
372
380
|
| ------------------------------------------------------------------------------ | ------------------------------------- | ------------------------------------------------------------------------- |
|
|
373
|
-
| `firefunc login` / `logout` / `whoami` |
|
|
381
|
+
| `firefunc login` / `logout` / `whoami` | — | Sign in (browser, or `--with-key`), sign out, or show who this machine is |
|
|
374
382
|
| `firefunc templates list` | `agents:read` | Whole agents to start from |
|
|
375
383
|
| `firefunc projects list` | `agents:read` | Where an agent can live |
|
|
376
384
|
| `firefunc connections list [--project …]` | `agents:read` | The tool accounts a project can use |
|
|
@@ -404,8 +412,16 @@ Every command has `--help`, and each one takes:
|
|
|
404
412
|
checked against: pointed anywhere else, a command is refused (`api_url_mismatch`)
|
|
405
413
|
until you `firefunc login --api-url` there.
|
|
406
414
|
|
|
407
|
-
**
|
|
408
|
-
|
|
415
|
+
**Signing in through the browser (0.9.26).** `firefunc login` opens FireFunc's consent
|
|
416
|
+
page, the same one Claude, ChatGPT and Codex use. You pick the workspace and what the CLI
|
|
417
|
+
may do (Activate agents and Configure the workspace stay off unless you tick them), and
|
|
418
|
+
the browser hands the sign-in back to a one-off address on `127.0.0.1` (PKCE S256). The
|
|
419
|
+
sign-in is saved to `~/.firefunc/config.json` (0600), refreshes itself every hour, shows
|
|
420
|
+
in FireFunc → Settings → AI tools, and `firefunc logout` ends it there too. On a machine
|
|
421
|
+
with no browser, `--no-browser` prints the address instead; there, or in CI, use a key.
|
|
422
|
+
|
|
423
|
+
**Where the key lives.** `firefunc login --with-key` (or a piped key, or `--key`) checks
|
|
424
|
+
the key against the API before it saves it to `~/.firefunc/config.json`. The file is readable only by you (0600), in a
|
|
409
425
|
folder only you can open (0700) when `login` creates it; a folder that already existed
|
|
410
426
|
keeps its own mode. The CLI never prints the key. That file is
|
|
411
427
|
separate from the runner's `~/.firefunc-runner`, so `firefunc logout` cannot take a
|
|
@@ -426,6 +442,129 @@ you asked for that agent and the key has `agents:activate`. It never asks for a
|
|
|
426
442
|
in the chat, and it reports a refusal with the fix. `firefunc skill show` prints the
|
|
427
443
|
skill. A `SKILL.md` you have edited is kept unless you pass `--force`.
|
|
428
444
|
|
|
445
|
+
## Open harnesses (0.9.27)
|
|
446
|
+
|
|
447
|
+
Besides Claude Code, Codex, Gemini CLI, Cursor, Copilot CLI and Antigravity, the runner drives
|
|
448
|
+
the open-source harnesses **OpenCode** (`opencode`), **Pi** (`pi`), **Kilo Code** (`kilo`),
|
|
449
|
+
**Qwen Code** (`qwen`) and **Crush** (`crush`). They use many model providers, such as
|
|
450
|
+
OpenRouter, OpenCode Zen, Anthropic, OpenAI and DeepSeek. The model id names the provider:
|
|
451
|
+
`openrouter/deepseek/deepseek-v4-flash`.
|
|
452
|
+
|
|
453
|
+
Each harness reads a provider's key from the runner's environment (`OPENROUTER_API_KEY`,
|
|
454
|
+
`ANTHROPIC_API_KEY`, …) or from its own login. The runner reads no key. Every hour it asks each
|
|
455
|
+
harness which models it can run (`opencode models`, `pi --list-models`, …) and sends FireFunc the
|
|
456
|
+
model ids, plus the names of the key variables that are set. It never sends their values.
|
|
457
|
+
|
|
458
|
+
### OpenHands
|
|
459
|
+
|
|
460
|
+
The runner also drives the **OpenHands CLI** (`openhands`, runner id `openhands`). Install the
|
|
461
|
+
official package, pinned to its last release (it needs Python 3.12):
|
|
462
|
+
|
|
463
|
+
```
|
|
464
|
+
uv tool install openhands==1.16.0 --python 3.12
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
OpenHands uses your own LLM API key. There is no subscription sign-in. Either set `LLM_API_KEY`
|
|
468
|
+
(your model provider's key) in the runner's environment and pick the model in FireFunc, which
|
|
469
|
+
passes it as `LLM_MODEL` (a LiteLLM id such as `anthropic/claude-sonnet-4-5-20250929`), or run
|
|
470
|
+
`openhands` once as the user the runner runs as and save a model and key. With neither, the
|
|
471
|
+
machine does not offer OpenHands, and says why. The runner runs it as
|
|
472
|
+
`openhands --headless --json --override-with-envs -t <brief>`, on the host, with no Docker.
|
|
473
|
+
|
|
474
|
+
Know these before you pick it:
|
|
475
|
+
|
|
476
|
+
- Its CLI is no longer maintained upstream (since Aug 2026). 1.16.0 is the last release.
|
|
477
|
+
- It reports no usage, so FireFunc shows its runs' usage as not reported.
|
|
478
|
+
- It gets no per-run FireFunc tools (MCP). An agent that plans first, asks a person or works
|
|
479
|
+
only through its tools cannot run on it.
|
|
480
|
+
- It has no effort setting.
|
|
481
|
+
|
|
482
|
+
## Tool calls for automations (0.9.29)
|
|
483
|
+
|
|
484
|
+
A FireFunc automation can have a step that calls one tool of an MCP server your organization
|
|
485
|
+
lent to the workspace. When only your machine can reach that server (a command it launches, a
|
|
486
|
+
sign-in it holds from `firefunc-runner mcp login`, an address on your own network), the runner
|
|
487
|
+
makes the call. It starts no coding agent and asks no model. It clones nothing and writes no
|
|
488
|
+
file. It starts the one server, calls the one tool once with the step's fields, closes the
|
|
489
|
+
server, and sends back the tool's answer.
|
|
490
|
+
|
|
491
|
+
The server's own output (stderr) stays in the runner's log on your machine. A machine makes at
|
|
492
|
+
most two such calls at once, beside its runs. Windows: a server launched through a `.cmd` shim
|
|
493
|
+
(`npx`, `uvx`) is not started, because the runner launches the command without a shell; register
|
|
494
|
+
the program itself (`node path\to\server.js`).
|
|
495
|
+
|
|
496
|
+
## Command steps for automations (0.9.30)
|
|
497
|
+
|
|
498
|
+
A FireFunc automation can have a **command step**: one shell command (`go test ./...`,
|
|
499
|
+
`deadcode ./...`) run in a repository. Your machine runs it only after you allow it:
|
|
500
|
+
|
|
501
|
+
```
|
|
502
|
+
firefunc-runner allow-commands # deny-commands takes it back
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
It runs in the checkout this machine already has of that repository (mapped with `repo add`, or
|
|
506
|
+
under `--repos-dir`). Nothing is cloned. It starts no coding agent and asks no model. It runs with
|
|
507
|
+
the step's time limit (its whole process group is stopped then, or when the step is stopped in
|
|
508
|
+
FireFunc). What goes to FireFunc: the exit code, how many lines it printed, and its last 2,000
|
|
509
|
+
lines (code-stripped by FireFunc before they are kept). A machine runs at most two at once,
|
|
510
|
+
beside its runs.
|
|
511
|
+
|
|
512
|
+
## Where a run's folder is (0.9.31)
|
|
513
|
+
|
|
514
|
+
Each run tells FireFunc the absolute path of its worktree on this machine and whether it is still
|
|
515
|
+
there: **live** while the engine works in it, **kept** after the run when the runner keeps it (a cut
|
|
516
|
+
session, a change kept for approval, a parked session), and **gone** once it is removed. Only the
|
|
517
|
+
path is sent, never a file inside it. FireFunc shows the path only to you, the machine's owner, so
|
|
518
|
+
the task page and the editor extension can open the agent's own folder; everyone else sees only the
|
|
519
|
+
machine's name. Worktrees are kept and removed exactly as before.
|
|
520
|
+
|
|
521
|
+
## Open a run's folder from someone's editor (0.9.32)
|
|
522
|
+
|
|
523
|
+
**Off by default.** Turn it on, as the machine's owner:
|
|
524
|
+
|
|
525
|
+
```sh
|
|
526
|
+
firefunc-runner config set devMode.editor on # off: firefunc-runner config set devMode.editor off
|
|
527
|
+
firefunc-runner config get devMode.editor
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
Then a person who can read a task's code, whose editor (the FireFunc extension) is paired with
|
|
531
|
+
FireFunc, may open that run's folder here from their own computer:
|
|
532
|
+
|
|
533
|
+
- **Read-only.** The editor can list folders and read files of that one worktree. It cannot write,
|
|
534
|
+
run anything, or reach any other folder: paths are confined to the worktree (a symlink pointing
|
|
535
|
+
out of it is refused) and the repository's `.git` is never served.
|
|
536
|
+
- **One grant per open.** FireFunc gives a one-time grant for that task, this machine, that folder
|
|
537
|
+
and that editor. It ends when the task ends, when the editor closes, when the pairing is removed,
|
|
538
|
+
when you turn editors off, or after eight hours.
|
|
539
|
+
- **End-to-end encrypted.** The editor and this runner each make a fresh key for the session and
|
|
540
|
+
agree the session key between them (X25519, then ChaCha20-Poly1305). The runner signs its key with
|
|
541
|
+
this machine's trail key; the editor signs its own with its pairing key. FireFunc's relay passes
|
|
542
|
+
the encrypted messages and cannot read them. Both dial out: nothing listens on this machine.
|
|
543
|
+
- The runner's log says who opened which folder, and a six-digit **session check** the editor shows
|
|
544
|
+
too.
|
|
545
|
+
|
|
546
|
+
At most four sessions run at once. A runner older than 0.9.32 never takes one.
|
|
547
|
+
|
|
548
|
+
## Sign in with: the plan or an API key (0.9.34)
|
|
549
|
+
|
|
550
|
+
On every check-in the runner says, per engine it has, whether the vendor's plan is signed in and
|
|
551
|
+
whether an API key is found, and where (`environment: ANTHROPIC_API_KEY`, `runner folder key file`).
|
|
552
|
+
It never sends a key's value. FireFunc shows this on the machine's Engines.
|
|
553
|
+
|
|
554
|
+
The machine's owner, or a workspace admin, may choose in FireFunc how Claude Code and Codex sign
|
|
555
|
+
in here: the subscription or the API key. The runner reads the choice within a minute and lays it
|
|
556
|
+
over its local config (`claudeUseApiKey`, `codexUseApiKey`); with no choice made, the local config
|
|
557
|
+
decides as before. For Claude Code there are two fallbacks:
|
|
558
|
+
|
|
559
|
+
- **Plan limit hit: use the API key** (`claudeApiKeyFallback`, 0.9.13).
|
|
560
|
+
- **Key out of credit: use the plan** (`claudeKeyToPlan`, new): a session that billed the key and
|
|
561
|
+
closed on "Credit balance is too low" continues at once on the plan in the same worktree, and
|
|
562
|
+
Claude sessions bill the plan for six hours, then the key is tried again.
|
|
563
|
+
|
|
564
|
+
An agent's job may ask for one way. When this machine cannot honour it (no key, or the plan not
|
|
565
|
+
signed in) and no fallback allows the other way, the run ends at once with the reason and the fix,
|
|
566
|
+
for example "No Google key on dan-mbp. Set GEMINI_API_KEY on it, then run the engine check again."
|
|
567
|
+
|
|
429
568
|
## Licence
|
|
430
569
|
|
|
431
570
|
`@firefunc-agent/runner` is the **client** half of FireFunc, published so the machines
|
|
@@ -439,3 +578,21 @@ for, works on **your** checkouts, and reports results back. Your source code
|
|
|
439
578
|
does not need to reach FireFunc for any of it to work.
|
|
440
579
|
|
|
441
580
|
FireFunc is a product of SoftHawker LLC, which licenses this package.
|
|
581
|
+
|
|
582
|
+
## Managed as a fleet (0.9.25)
|
|
583
|
+
|
|
584
|
+
A workspace can manage its machines from Settings → Machines (or the API):
|
|
585
|
+
|
|
586
|
+
- **Minimum runner version.** A runner below the workspace's minimum is refused work, and
|
|
587
|
+
its log says which version is needed and how to upgrade.
|
|
588
|
+
- **Upgrade when idle.** Asked for a version, the runner finishes the runs it holds, takes
|
|
589
|
+
nothing new, runs `npm install -g @firefunc-agent/runner@<version>`, and exits with code 75
|
|
590
|
+
so its service starts the new version. It only does this as the installed service
|
|
591
|
+
(`firefunc-runner install`) and not from npx's cache; otherwise it says why and keeps running.
|
|
592
|
+
A failed install leaves the old version running and reports npm's last lines.
|
|
593
|
+
- **Token lifetime and rotation.** A workspace can give machine tokens a lifetime and a
|
|
594
|
+
pairing window. The runner replaces its token on its own when a third of its life is left,
|
|
595
|
+
or when a person asks; the old token works for one more hour. An expired token stops the
|
|
596
|
+
runner with the reason; pair it again with `firefunc-runner connect <token> --force`.
|
|
597
|
+
- **Labels.** Machines can carry labels (`gpu`, `mac`); an agent can take machines by labels
|
|
598
|
+
instead of naming each one.
|
package/dist/alive.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export type AliveRecord = {
|
|
2
|
+
pid: number;
|
|
3
|
+
user: string;
|
|
4
|
+
service: boolean;
|
|
5
|
+
windowless?: boolean;
|
|
6
|
+
version: string;
|
|
7
|
+
startedAt: string;
|
|
8
|
+
seenAt: string;
|
|
9
|
+
contactAt: string | null;
|
|
10
|
+
transport?: {
|
|
11
|
+
failingSince: string;
|
|
12
|
+
failures: number;
|
|
13
|
+
lastError: string | null;
|
|
14
|
+
rebuilds: number;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export declare function aliveFile(runnerDir: string): string;
|
|
18
|
+
export declare function writeAlive(runnerDir: string, rec: AliveRecord): void;
|
|
19
|
+
export declare function readAlive(runnerDir: string): AliveRecord | null;
|
|
20
|
+
export declare function clearAlive(runnerDir: string, pid?: number): void;
|
|
21
|
+
export declare function pidAlive(pid: number): boolean;
|
|
22
|
+
export declare const ALIVE_STALE_MS = 90000;
|
|
23
|
+
export type LiveRunner = {
|
|
24
|
+
state: 'running';
|
|
25
|
+
rec: AliveRecord;
|
|
26
|
+
} | {
|
|
27
|
+
state: 'stale';
|
|
28
|
+
rec: AliveRecord;
|
|
29
|
+
} | {
|
|
30
|
+
state: 'gone';
|
|
31
|
+
rec: AliveRecord;
|
|
32
|
+
} | {
|
|
33
|
+
state: 'none';
|
|
34
|
+
};
|
|
35
|
+
export declare function liveRunner(rec: AliveRecord | null, now?: number, alive?: (pid: number) => boolean): LiveRunner;
|
|
36
|
+
export declare function liveRunnerWords(live: LiveRunner, opts: {
|
|
37
|
+
now?: number;
|
|
38
|
+
logPath: string;
|
|
39
|
+
os?: string | null;
|
|
40
|
+
}): string;
|
package/dist/alive.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
export function aliveFile(runnerDir) {
|
|
4
|
+
return join(runnerDir, 'alive.json');
|
|
5
|
+
}
|
|
6
|
+
export function writeAlive(runnerDir, rec) {
|
|
7
|
+
const file = aliveFile(runnerDir);
|
|
8
|
+
const tmp = `${file}.${rec.pid}.tmp`;
|
|
9
|
+
try {
|
|
10
|
+
writeFileSync(tmp, `${JSON.stringify(rec, null, 2)}\n`, { mode: 0o600 });
|
|
11
|
+
renameSync(tmp, file);
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function readAlive(runnerDir) {
|
|
17
|
+
try {
|
|
18
|
+
const rec = JSON.parse(readFileSync(aliveFile(runnerDir), 'utf8'));
|
|
19
|
+
if (!Number.isInteger(rec.pid) || typeof rec.seenAt !== 'string')
|
|
20
|
+
return null;
|
|
21
|
+
return {
|
|
22
|
+
pid: rec.pid,
|
|
23
|
+
user: typeof rec.user === 'string' ? rec.user : '',
|
|
24
|
+
service: rec.service === true,
|
|
25
|
+
...(rec.windowless === true ? { windowless: true } : {}),
|
|
26
|
+
version: typeof rec.version === 'string' ? rec.version : '',
|
|
27
|
+
startedAt: typeof rec.startedAt === 'string' ? rec.startedAt : rec.seenAt,
|
|
28
|
+
seenAt: rec.seenAt,
|
|
29
|
+
contactAt: typeof rec.contactAt === 'string' ? rec.contactAt : null,
|
|
30
|
+
...(rec.transport &&
|
|
31
|
+
typeof rec.transport.failingSince === 'string' &&
|
|
32
|
+
Number.isInteger(rec.transport.failures) &&
|
|
33
|
+
rec.transport.failures > 0
|
|
34
|
+
? {
|
|
35
|
+
transport: {
|
|
36
|
+
failingSince: rec.transport.failingSince,
|
|
37
|
+
failures: rec.transport.failures,
|
|
38
|
+
lastError: typeof rec.transport.lastError === 'string' ? rec.transport.lastError : null,
|
|
39
|
+
rebuilds: Number.isInteger(rec.transport.rebuilds) ? rec.transport.rebuilds : 0,
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
: {}),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export function clearAlive(runnerDir, pid = process.pid) {
|
|
50
|
+
const rec = readAlive(runnerDir);
|
|
51
|
+
if (rec && rec.pid !== pid)
|
|
52
|
+
return;
|
|
53
|
+
try {
|
|
54
|
+
rmSync(aliveFile(runnerDir), { force: true });
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export function pidAlive(pid) {
|
|
60
|
+
if (!Number.isInteger(pid) || pid <= 0)
|
|
61
|
+
return false;
|
|
62
|
+
try {
|
|
63
|
+
process.kill(pid, 0);
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
catch (e) {
|
|
67
|
+
return e.code === 'EPERM';
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export const ALIVE_STALE_MS = 90_000;
|
|
71
|
+
export function liveRunner(rec, now = Date.now(), alive = pidAlive) {
|
|
72
|
+
if (!rec)
|
|
73
|
+
return { state: 'none' };
|
|
74
|
+
if (!alive(rec.pid))
|
|
75
|
+
return { state: 'gone', rec };
|
|
76
|
+
const seen = Date.parse(rec.seenAt);
|
|
77
|
+
if (Number.isNaN(seen) || now - seen > ALIVE_STALE_MS)
|
|
78
|
+
return { state: 'stale', rec };
|
|
79
|
+
return { state: 'running', rec };
|
|
80
|
+
}
|
|
81
|
+
function ago(iso, now) {
|
|
82
|
+
if (!iso)
|
|
83
|
+
return 'not yet';
|
|
84
|
+
const t = Date.parse(iso);
|
|
85
|
+
if (Number.isNaN(t))
|
|
86
|
+
return 'at an unknown time';
|
|
87
|
+
const s = Math.max(0, Math.round((now - t) / 1000));
|
|
88
|
+
if (s < 90)
|
|
89
|
+
return `${s}s ago`;
|
|
90
|
+
const m = Math.round(s / 60);
|
|
91
|
+
if (m < 90)
|
|
92
|
+
return `${m} min ago`;
|
|
93
|
+
return `${Math.round(m / 60)} h ago`;
|
|
94
|
+
}
|
|
95
|
+
function transportWords(r, now) {
|
|
96
|
+
const t = r.transport;
|
|
97
|
+
if (!t)
|
|
98
|
+
return '';
|
|
99
|
+
const since = ago(t.failingSince, now).replace(/ ago$/, '');
|
|
100
|
+
const rebuilt = t.rebuilds > 0
|
|
101
|
+
? `; the connection was rebuilt ${t.rebuilds} time${t.rebuilds === 1 ? '' : 's'}`
|
|
102
|
+
: '';
|
|
103
|
+
return (` failing: cannot reach FireFunc for ${since} — ${t.failures} poll${t.failures === 1 ? '' : 's'} in a row failed${t.lastError ? ` (last: ${t.lastError})` : ''}${rebuilt}\n` +
|
|
104
|
+
` If FireFunc answers from this machine (open its address in a browser), restart the runner: firefunc-runner stop, then firefunc-runner start-service\n`);
|
|
105
|
+
}
|
|
106
|
+
export function liveRunnerWords(live, opts) {
|
|
107
|
+
const now = opts.now ?? Date.now();
|
|
108
|
+
const logs = ` logs: ${opts.logPath} (firefunc-runner logs)\n`;
|
|
109
|
+
if (live.state === 'none') {
|
|
110
|
+
return (`runner: NOT RUNNING — no runner process has checked in on this machine\n` +
|
|
111
|
+
` Start it: firefunc-runner start-service (or "firefunc-runner start" in a terminal)\n`);
|
|
112
|
+
}
|
|
113
|
+
const r = live.rec;
|
|
114
|
+
const how = r.service
|
|
115
|
+
? opts.os === 'win32'
|
|
116
|
+
? r.windowless
|
|
117
|
+
? 'started by the background task, with no window'
|
|
118
|
+
: 'started by the background task in a console window (closing it stops the runner — run "firefunc-runner install" again to run it with no window)'
|
|
119
|
+
: 'started by the background service'
|
|
120
|
+
: 'started by hand in a terminal';
|
|
121
|
+
const who = r.user ? ` as ${r.user}` : '';
|
|
122
|
+
if (live.state === 'gone') {
|
|
123
|
+
return (`runner: NOT RUNNING — the last runner (pid ${r.pid}${who}) is gone; it was last seen ${ago(r.seenAt, now)}\n` +
|
|
124
|
+
logs +
|
|
125
|
+
` The log's last lines say why. Start it: firefunc-runner start-service\n`);
|
|
126
|
+
}
|
|
127
|
+
if (live.state === 'stale') {
|
|
128
|
+
return (`runner: NOT ANSWERING — pid ${r.pid}${who} is alive but has not checked in for ${ago(r.seenAt, now).replace(/ ago$/, '')}\n` +
|
|
129
|
+
logs +
|
|
130
|
+
` It may be stuck. Restart it: firefunc-runner stop, then firefunc-runner start-service\n`);
|
|
131
|
+
}
|
|
132
|
+
return (`runner: RUNNING — pid ${r.pid}${who}, ${how}${r.version ? `, runner ${r.version}` : ''}\n` +
|
|
133
|
+
` since: ${r.startedAt}\n` +
|
|
134
|
+
` FireFunc: last answered ${ago(r.contactAt, now)}\n` +
|
|
135
|
+
transportWords(r, now) +
|
|
136
|
+
logs);
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=alive.js.map
|
package/dist/api-fallback.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ export declare function apiKeyFile(cfg: Pick<RunnerConfig, 'claudeApiKeyFile'>,
|
|
|
3
3
|
export declare function fallbackKey(cfg: Pick<RunnerConfig, 'claudeApiKeyFallback' | 'claudeApiKeyFile'>, dir?: string): string | null;
|
|
4
4
|
export declare function fallbackUntil(dir?: string, now?: Date): Date | null;
|
|
5
5
|
export declare function startFallback(resetsAt: string | null, dir?: string, now?: Date): Date;
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function keySpentUntil(dir?: string, now?: Date): Date | null;
|
|
7
|
+
export declare function startKeySpent(dir?: string, now?: Date): Date;
|
|
8
|
+
export declare function claudeApiKeyNow(cfg: Pick<RunnerConfig, 'claudeUseApiKey' | 'claudeApiKeyFallback' | 'claudeApiKeyFile' | 'claudeKeyToPlan'>, dir?: string, now?: Date): {
|
|
7
9
|
key: string | null;
|
|
8
|
-
why: 'opted-in' | 'fallback' | null;
|
|
10
|
+
why: 'opted-in' | 'fallback' | 'key-spent' | null;
|
|
9
11
|
};
|
package/dist/api-fallback.js
CHANGED
|
@@ -44,9 +44,34 @@ export function startFallback(resetsAt, dir = runnerDir(), now = new Date()) {
|
|
|
44
44
|
writeFileSync(stateFile(dir), JSON.stringify({ until: end.toISOString() }), { mode: 0o600 });
|
|
45
45
|
return end;
|
|
46
46
|
}
|
|
47
|
+
function keyStateFile(dir) {
|
|
48
|
+
return join(dir, 'key-fallback.json');
|
|
49
|
+
}
|
|
50
|
+
export function keySpentUntil(dir = runnerDir(), now = new Date()) {
|
|
51
|
+
try {
|
|
52
|
+
const raw = JSON.parse(readFileSync(keyStateFile(dir), 'utf8'));
|
|
53
|
+
const until = raw.until ? new Date(raw.until) : null;
|
|
54
|
+
return until && !Number.isNaN(until.getTime()) && until.getTime() > now.getTime()
|
|
55
|
+
? until
|
|
56
|
+
: null;
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export function startKeySpent(dir = runnerDir(), now = new Date()) {
|
|
63
|
+
const until = new Date(now.getTime() + DEFAULT_WINDOW_MS);
|
|
64
|
+
writeFileSync(keyStateFile(dir), JSON.stringify({ until: until.toISOString() }), {
|
|
65
|
+
mode: 0o600,
|
|
66
|
+
});
|
|
67
|
+
return until;
|
|
68
|
+
}
|
|
47
69
|
export function claudeApiKeyNow(cfg, dir = runnerDir(), now = new Date()) {
|
|
48
|
-
if (cfg.claudeUseApiKey)
|
|
70
|
+
if (cfg.claudeUseApiKey) {
|
|
71
|
+
if (cfg.claudeKeyToPlan && keySpentUntil(dir, now))
|
|
72
|
+
return { key: null, why: 'key-spent' };
|
|
49
73
|
return { key: null, why: 'opted-in' };
|
|
74
|
+
}
|
|
50
75
|
const key = fallbackKey(cfg, dir);
|
|
51
76
|
if (key && fallbackUntil(dir, now))
|
|
52
77
|
return { key, why: 'fallback' };
|
package/dist/api.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import { type SignInPrefs, type SignInReport } from './sign-in.js';
|
|
2
|
+
import type { ReleaseOffer, ReleaseReport } from './release-draft.js';
|
|
3
|
+
import type { LocalChecksReport } from './local-checks.js';
|
|
1
4
|
import type { ChangeSummary } from './ask-first.js';
|
|
2
5
|
import type { RunUsage } from './usage.js';
|
|
6
|
+
import type { ResourcesReport } from './resources.js';
|
|
7
|
+
import type { RelayTicket } from './editor/sessions.js';
|
|
3
8
|
export type ClaimedJob = {
|
|
4
9
|
runId: string;
|
|
5
10
|
workItemId: string;
|
|
@@ -7,6 +12,15 @@ export type ClaimedJob = {
|
|
|
7
12
|
repo: string | null;
|
|
8
13
|
branch: string | null;
|
|
9
14
|
toolsOnly?: boolean;
|
|
15
|
+
checkpoint?: {
|
|
16
|
+
ref: string;
|
|
17
|
+
sha: string;
|
|
18
|
+
at?: string;
|
|
19
|
+
} | null;
|
|
20
|
+
checks?: Array<{
|
|
21
|
+
key: string;
|
|
22
|
+
command: string;
|
|
23
|
+
}>;
|
|
10
24
|
continuesBranch?: boolean;
|
|
11
25
|
review?: boolean;
|
|
12
26
|
askFirst?: boolean;
|
|
@@ -28,6 +42,8 @@ export type ClaimedJob = {
|
|
|
28
42
|
type: string;
|
|
29
43
|
engine?: string | null;
|
|
30
44
|
model?: string | null;
|
|
45
|
+
planModel?: string | null;
|
|
46
|
+
signIn?: 'plan' | 'key' | null;
|
|
31
47
|
effort?: string | null;
|
|
32
48
|
permissionMode?: string | null;
|
|
33
49
|
attachments?: {
|
|
@@ -62,11 +78,17 @@ export type ClaimedJob = {
|
|
|
62
78
|
detail?: string;
|
|
63
79
|
off?: boolean;
|
|
64
80
|
};
|
|
81
|
+
provenance?: {
|
|
82
|
+
runUrl?: string | null;
|
|
83
|
+
trailers?: string[];
|
|
84
|
+
prFooter?: string | null;
|
|
85
|
+
};
|
|
86
|
+
release?: ReleaseOffer;
|
|
65
87
|
contextPack?: unknown;
|
|
66
88
|
mcpConfig?: unknown;
|
|
67
89
|
maxMinutes?: number | null;
|
|
68
90
|
};
|
|
69
|
-
export type RunnerEvent = 'cloning' | 'fixing' | 'pushing' | 'pr_opened' | 'heartbeat' | 'log';
|
|
91
|
+
export type RunnerEvent = 'cloning' | 'fixing' | 'pushing' | 'pr_opened' | 'heartbeat' | 'log' | 'checkpoint' | 'worktree';
|
|
70
92
|
export type PlanLimitReport = {
|
|
71
93
|
kind: 'plan';
|
|
72
94
|
resetsAt: string | null;
|
|
@@ -138,20 +160,27 @@ export type ResultPayload = ({
|
|
|
138
160
|
summary?: string;
|
|
139
161
|
}) & {
|
|
140
162
|
secretScan?: SecretScanReport;
|
|
163
|
+
localChecks?: LocalChecksReport;
|
|
141
164
|
usage?: RunUsage;
|
|
142
165
|
limit?: PlanLimitReport | MachineLimitReport;
|
|
143
166
|
readHead?: string;
|
|
144
167
|
openCommandAtEnd?: true;
|
|
145
168
|
lost?: true;
|
|
169
|
+
release?: ReleaseReport;
|
|
146
170
|
};
|
|
147
171
|
export declare const REPORTED_SUMMARY_MAX = 65536;
|
|
148
172
|
export declare const OLDER_API_SUMMARY_MAX = 4000;
|
|
149
173
|
export declare function cutText(text: string, max: number): string;
|
|
150
|
-
export declare const RESULT_LADDER: readonly ["lost", "openCommandAtEnd", "readHead", "limit", "summary", "usage", "secretScan"];
|
|
174
|
+
export declare const RESULT_LADDER: readonly ["localChecks", "release", "lost", "openCommandAtEnd", "readHead", "limit", "summary", "usage", "secretScan"];
|
|
151
175
|
export declare class RunnerApi {
|
|
152
176
|
private readonly apiUrl;
|
|
153
|
-
private
|
|
177
|
+
private token;
|
|
154
178
|
constructor(apiUrl: string, token: string);
|
|
179
|
+
setToken(token: string): void;
|
|
180
|
+
rotateToken(): Promise<{
|
|
181
|
+
token: string;
|
|
182
|
+
expiresAt: string | null;
|
|
183
|
+
} | null>;
|
|
155
184
|
private headers;
|
|
156
185
|
claim(meta: {
|
|
157
186
|
version: string;
|
|
@@ -186,14 +215,47 @@ export declare class RunnerApi {
|
|
|
186
215
|
engine: string;
|
|
187
216
|
code: string;
|
|
188
217
|
}>;
|
|
218
|
+
resources?: ResourcesReport;
|
|
189
219
|
awaitingRuns?: string[];
|
|
220
|
+
toolCallSlots?: number;
|
|
221
|
+
allowsCommands?: boolean;
|
|
222
|
+
commandSlots?: number;
|
|
223
|
+
allowsEditors?: boolean;
|
|
224
|
+
signIn?: SignInReport;
|
|
190
225
|
}, opts?: {
|
|
191
226
|
onDiscard?: (runIds: string[]) => void;
|
|
227
|
+
onStop?: (runIds: string[]) => void;
|
|
228
|
+
onUpgrade?: (cmd: {
|
|
229
|
+
version: string;
|
|
230
|
+
requestedAt: string;
|
|
231
|
+
}) => void;
|
|
232
|
+
onToken?: (cmd: {
|
|
233
|
+
rotate: true;
|
|
234
|
+
why: string;
|
|
235
|
+
}) => void;
|
|
236
|
+
onToolCalls?: (calls: unknown[]) => void;
|
|
237
|
+
onCommands?: (commands: unknown[]) => void;
|
|
238
|
+
onStopCommands?: (ids: unknown[]) => void;
|
|
239
|
+
onEditorSessions?: (sessions: unknown[]) => void;
|
|
192
240
|
}): Promise<ClaimedJob | null>;
|
|
241
|
+
commandResult(id: string, report: unknown): Promise<boolean>;
|
|
242
|
+
private editorPost;
|
|
243
|
+
private static relayOf;
|
|
244
|
+
acceptEditorGrant(grantId: string, body: {
|
|
245
|
+
publicKey: string;
|
|
246
|
+
signature: string;
|
|
247
|
+
machineKey: string;
|
|
248
|
+
}): Promise<RelayTicket | null>;
|
|
249
|
+
editorTicket(grantId: string): Promise<RelayTicket | null>;
|
|
250
|
+
refuseEditorGrant(grantId: string, reason: 'editor_off' | 'no_folder' | 'bad_signature' | 'busy'): Promise<boolean>;
|
|
251
|
+
endEditorGrant(grantId: string, reason: 'runner_ended' | 'task_ended'): Promise<boolean>;
|
|
252
|
+
toolCallResult(id: string, report: unknown): Promise<boolean>;
|
|
193
253
|
repos(): Promise<string[]>;
|
|
194
254
|
probe(): Promise<boolean>;
|
|
195
255
|
config(): Promise<{
|
|
196
256
|
maxParallel: number;
|
|
257
|
+
requiredCommands: string[] | null;
|
|
258
|
+
signInPrefs: SignInPrefs | null;
|
|
197
259
|
} | null>;
|
|
198
260
|
gitCredential(runId: string): Promise<{
|
|
199
261
|
token: string;
|