@firefunc-agent/runner 0.7.1 → 0.9.3

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.
Files changed (114) hide show
  1. package/LICENSE +7 -3
  2. package/README.md +296 -4
  3. package/dist/activity.d.ts +32 -0
  4. package/dist/activity.js +295 -0
  5. package/dist/api.d.ts +69 -1
  6. package/dist/api.js +114 -3
  7. package/dist/brief.d.ts +11 -0
  8. package/dist/brief.js +278 -0
  9. package/dist/build-info.json +4 -0
  10. package/dist/cli.js +59 -2
  11. package/dist/config.d.ts +7 -0
  12. package/dist/config.js +3 -0
  13. package/dist/cut.d.ts +45 -0
  14. package/dist/cut.js +105 -0
  15. package/dist/daemon.d.ts +16 -0
  16. package/dist/daemon.js +196 -7
  17. package/dist/declined.d.ts +11 -0
  18. package/dist/declined.js +27 -0
  19. package/dist/engines/antigravity.d.ts +2 -0
  20. package/dist/engines/antigravity.js +102 -0
  21. package/dist/engines/claude-budget.d.ts +1 -1
  22. package/dist/engines/claude-budget.js +2 -72
  23. package/dist/engines/claude.js +139 -2
  24. package/dist/engines/codex.js +10 -3
  25. package/dist/engines/copilot.d.ts +2 -0
  26. package/dist/engines/copilot.js +117 -0
  27. package/dist/engines/cursor.js +4 -0
  28. package/dist/engines/gemini.js +6 -1
  29. package/dist/engines/index.d.ts +2 -0
  30. package/dist/engines/index.js +22 -4
  31. package/dist/engines/types.d.ts +12 -1
  32. package/dist/exec.d.ts +3 -0
  33. package/dist/exec.js +48 -5
  34. package/dist/firefunc/agents.d.ts +2 -0
  35. package/dist/firefunc/agents.js +343 -0
  36. package/dist/firefunc/args.d.ts +18 -0
  37. package/dist/firefunc/args.js +82 -0
  38. package/dist/firefunc/auth.d.ts +21 -0
  39. package/dist/firefunc/auth.js +129 -0
  40. package/dist/firefunc/catalog.d.ts +10 -0
  41. package/dist/firefunc/catalog.js +201 -0
  42. package/dist/firefunc/cli.d.ts +2 -0
  43. package/dist/firefunc/cli.js +24 -0
  44. package/dist/firefunc/client.d.ts +36 -0
  45. package/dist/firefunc/client.js +177 -0
  46. package/dist/firefunc/command.d.ts +28 -0
  47. package/dist/firefunc/command.js +35 -0
  48. package/dist/firefunc/config.d.ts +29 -0
  49. package/dist/firefunc/config.js +111 -0
  50. package/dist/firefunc/configure.d.ts +6 -0
  51. package/dist/firefunc/configure.js +409 -0
  52. package/dist/firefunc/io.d.ts +25 -0
  53. package/dist/firefunc/io.js +14 -0
  54. package/dist/firefunc/main.d.ts +4 -0
  55. package/dist/firefunc/main.js +259 -0
  56. package/dist/firefunc/output.d.ts +29 -0
  57. package/dist/firefunc/output.js +131 -0
  58. package/dist/firefunc/prompt.d.ts +14 -0
  59. package/dist/firefunc/prompt.js +58 -0
  60. package/dist/firefunc/skill.d.ts +3 -0
  61. package/dist/firefunc/skill.js +80 -0
  62. package/dist/firefunc/tasks.d.ts +2 -0
  63. package/dist/firefunc/tasks.js +279 -0
  64. package/dist/firefunc/version.d.ts +2 -0
  65. package/dist/firefunc/version.js +8 -0
  66. package/dist/git-auth.d.ts +4 -1
  67. package/dist/git-auth.js +6 -2
  68. package/dist/held.d.ts +18 -0
  69. package/dist/held.js +95 -0
  70. package/dist/job.d.ts +3 -0
  71. package/dist/job.js +818 -102
  72. package/dist/keep-local.d.ts +12 -0
  73. package/dist/keep-local.js +651 -0
  74. package/dist/limit.d.ts +30 -0
  75. package/dist/limit.js +258 -0
  76. package/dist/locks.d.ts +14 -0
  77. package/dist/locks.js +164 -0
  78. package/dist/machine-logins.d.ts +19 -0
  79. package/dist/machine-logins.js +187 -0
  80. package/dist/mcp-login.d.ts +24 -0
  81. package/dist/mcp-login.js +993 -0
  82. package/dist/mcp-proxy.d.ts +21 -0
  83. package/dist/mcp-proxy.js +180 -0
  84. package/dist/mcp.d.ts +62 -0
  85. package/dist/mcp.js +611 -0
  86. package/dist/network.d.ts +20 -0
  87. package/dist/network.js +76 -0
  88. package/dist/orphans.d.ts +40 -0
  89. package/dist/orphans.js +235 -0
  90. package/dist/pending.d.ts +14 -0
  91. package/dist/pending.js +56 -0
  92. package/dist/pool.d.ts +7 -0
  93. package/dist/pool.js +57 -9
  94. package/dist/pr-title.d.ts +11 -0
  95. package/dist/pr-title.js +63 -0
  96. package/dist/recover.d.ts +10 -0
  97. package/dist/recover.js +104 -0
  98. package/dist/secret-scan.d.ts +19 -0
  99. package/dist/secret-scan.js +161 -0
  100. package/dist/session-stream.d.ts +9 -1
  101. package/dist/session-stream.js +20 -2
  102. package/dist/skills.d.ts +11 -0
  103. package/dist/skills.js +164 -0
  104. package/dist/stopped.d.ts +3 -0
  105. package/dist/stopped.js +10 -0
  106. package/dist/usage.d.ts +49 -0
  107. package/dist/usage.js +389 -0
  108. package/dist/version.d.ts +1 -0
  109. package/dist/version.js +17 -0
  110. package/dist/viewer.js +7 -1
  111. package/dist/worktrees.d.ts +15 -0
  112. package/dist/worktrees.js +96 -0
  113. package/package.json +8 -5
  114. package/skill/firefunc/SKILL.md +222 -0
package/LICENSE CHANGED
@@ -1,8 +1,12 @@
1
1
  FireFunc Runner — Client Software Licence
2
- Copyright (c) 2026 FireFunc. All rights reserved.
2
+ Copyright (c) 2026 SoftHawker LLC. All rights reserved.
3
3
 
4
- This licence covers ONLY the `@firefunc/runner` package (the "Runner") — the
5
- client daemon that runs on your own machine, invokes coding agents you have
4
+ FireFunc is a product of SoftHawker LLC ("SoftHawker"). SoftHawker is the
5
+ licensor of the Runner and grants this licence; "FireFunc" below names the
6
+ product and the service SoftHawker operates under that name.
7
+
8
+ This licence covers ONLY the `@firefunc-agent/runner` package (the "Runner") —
9
+ the client daemon that runs on your own machine, invokes coding agents you have
6
10
  installed and licensed yourself, and connects to the FireFunc service.
7
11
 
8
12
  It does NOT cover the FireFunc service, its API, its web applications, its
package/README.md CHANGED
@@ -9,7 +9,10 @@ This is the **self-hosted runner** for FireFunc's _Claude Code Channel_ engine.
9
9
  3. runs **your local coding agent** (`claude -p`, `codex exec`, `gemini`, or `cursor-agent` — 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
- **Why this and not the cloud Routine?** No ~15/day cap (it uses _your_ Claude subscription's limits), your **code never leaves your machine**, and it has your full local context — running app, AWS creds, `gh`/`git` auth, MCP servers, `CLAUDE.md`.
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).
13
+
14
+ From 0.9.0 the package also installs **`firefunc`**, the command line (and Claude Code
15
+ skill) for setting agents up. See [`firefunc`: agents from a terminal, a script or Claude Code](#firefunc-agents-from-a-terminal-a-script-or-claude-code).
13
16
 
14
17
  ## Requirements
15
18
 
@@ -48,9 +51,20 @@ That's it. When your QA files a bug (labeled for FireFunc), it appears here with
48
51
 
49
52
  - Works in a throwaway **git worktree** off a clean base — it **never touches your working tree or current branch**.
50
53
  - Opens a PR **only when there's a real diff** (no phantom PRs).
51
- - Pushes a **deterministic branch** with `--force-with-lease`, so a duplicate dispatch converges to one PR.
52
- - Runs Claude with `--permission-mode acceptEdits` (autonomous file edits) **without** `--dangerously-skip-permissions` (which hangs non-interactive daemons).
53
- - A per-job timeout (default 20 min) prevents a stuck run from hanging the daemon.
54
+ - Titles the commit and the draft PR with **one** conventional prefix (0.9.2): `test:` when every path the change touches is a test (a test file, a test folder's content, a test runner's config — a reproducer's failing test, a test writer's suite), otherwise `fix:`. The `fix:`, `feat:`, `chore:`, `refactor:`, `docs:` and `test:` prefixes the task's title already carried are taken off first, so a pull request raised from a FireFunc pull request is never titled "fix: fix: …".
55
+ - Pushes a **deterministic branch** with `--force-with-lease`, so a duplicate dispatch converges to one PR. A run that revises an existing pull request (0.8.1+) starts from that pull request's own branch and pushes **without** force, so git refuses rather than replace commits pushed while it worked.
56
+ - **Scans what it is about to push for secrets, on this machine**, and refuses the push on a key, a token or a private key (0.8.3+) — see [The secret scan before a push](#the-secret-scan-before-a-push).
57
+ - Refuses to push a commit that contains a `.env` file or the run's MCP config, whatever the agent committed.
58
+ - Writes the agent's skills to `.claude/skills/<slug>/SKILL.md` and keeps them out of every commit **by their real path** (0.9.1+): when the repository keeps `.claude/skills` as a link into a folder it tracks (`.claude/skills -> ../.agents/skills`), the skill lands in that folder and is kept out there — by a `.gitignore` inside each skill folder (that worktree only; your clone's `.git/info/exclude` is not written), in what the runner stages, and at the push, which is refused if the agent committed one anyway. A folder already in the checkout under the same name — in any case, on a disk that ignores case — is never written into (the run sees the repository's, and the log names it), and a link that leads out of the checkout is refused: nothing is written outside the worktree. Runners before 0.9.1 appended `.claude/skills/` to your clone's `.git/info/exclude`; that line can be deleted.
59
+ - 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.
60
+ - 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.
61
+ - **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.
62
+ - **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.
63
+ - **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.
64
+ - **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.
65
+ - **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.
66
+ - **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.
67
+ - **Stopping finishes the runs in flight** (0.9.3). The first Ctrl-C or SIGTERM stops claiming and lets the runs finish — the machine keeps telling FireFunc it is alive and draining meanwhile, so it does not look offline; a second one stops their engines now, and each run reports how it ended. Under the background service, which is killed soon after its SIGTERM, the engines are stopped after ten seconds so every run can report first.
54
68
 
55
69
  ## Commands
56
70
 
@@ -64,6 +78,7 @@ That's it. When your QA files a bug (labeled for FireFunc), it appears here with
64
78
  | `firefunc-runner logs` | Recent runner output |
65
79
  | `firefunc-runner uninstall` | Remove the background service |
66
80
  | `firefunc-runner status` | Saved config **and** whether the service is installed + running |
81
+ | `firefunc-runner --version` | The version this build carries — the one it reports to FireFunc (`-v`) |
67
82
 
68
83
  ### `connect` flags
69
84
 
@@ -131,6 +146,281 @@ find their own logins). If you install a new agent CLI somewhere new, re-run
131
146
  > `schtasks` verb) but have **not** yet been run on a real machine of either
132
147
  > kind. Please report anything that misbehaves.
133
148
 
149
+ ## What leaves your machine
150
+
151
+ FireFunc never clones, fetches or stores your repository. The change goes from this
152
+ machine to **your** repository on GitHub — the push and the draft pull request — and
153
+ nowhere else. This is everything runner **0.9.3** sends to the FireFunc API you connected
154
+ it to:
155
+
156
+ **While it waits for work** (`POST /channel/claim`, every few seconds): its version,
157
+ hostname and platform; the engines it can run; the port of its local viewer; how many
158
+ sessions it runs at once (0.9.1+ — what FireFunc offered it, the largest "Runs at once"
159
+ among the projects it serves, or your `--max-parallel`, which overrides that); the
160
+ subscription usage its engines can read (percent used and when each window resets); and
161
+ the MCP servers this machine is signed in to — names, states, expiries and which login
162
+ holds each (the runner's own or Claude Code's), never a token. From 0.9.3 also: the ids of
163
+ the runs it holds (working on, or keeping a result for), the ids of runs the runner process
164
+ before it held and lost, and the plan limits it is waiting out (engine and reset time).
165
+ While it is finishing its runs before stopping, or waiting out a plan limit on every engine
166
+ it has, the same request goes every 30 seconds as a heartbeat that asks for no work
167
+ (`heartbeat`, and `draining` while it stops).
168
+
169
+ **While a run works** (`/channel/runs/<id>/events` and `/activity`): the stage it is at
170
+ (`cloning`, `fixing`, `pushing`, `pr_opened`, a heartbeat every five minutes) with the
171
+ repository, the branch, the task's title FireFunc sent it or the pull request's URL, and
172
+ one line per step the engine takes — a verb and a name:
173
+
174
+ | The engine… | The step says |
175
+ | ------------------------------- | --------------------------------------------------------------------------------------- |
176
+ | reads or edits a file | its path, relative to the checkout (`src/domain/orders.ts`) |
177
+ | runs a command | its programs and subcommands only — `npm test`, `git status`, `sed` — never an argument |
178
+ | searches | where it looked (`src/orders`, `src/**/*.test.ts`), never the pattern |
179
+ | calls an MCP tool | the server and the action (`Jira · get issue`) |
180
+ | fetches from the web | the host, or the words of a web search |
181
+ | uses a skill | the skill's name |
182
+ | starts a sub-agent | the task it gave it, with code taken out |
183
+ | updates its to-do list | "updated its plan" |
184
+ | uses any other tool | the tool's name and, when it was given a path, the path |
185
+ | says what it is doing, finishes | its own words on one line, with code taken out |
186
+
187
+ A command's arguments are where a `sed` expression, a `python -c` body or a heredoc
188
+ lives, so they stay here; so does a search pattern, which is often a line of code. Every
189
+ step is cut to one line and has anything shaped like a credential redacted. The files, the
190
+ commands' output and the transcript never leave: the local viewer and
191
+ `firefunc-runner logs` show them. From 0.9.3 a step also says whether the engine marked
192
+ the call's result an error (`failed` — never what it returned) and whether an MCP tool it
193
+ called is one the run's config declares a write (`write`).
194
+
195
+ **When it finishes** (`POST /channel/runs/<id>/result`): the outcome; the pull request's
196
+ repository, number, URL, branch and title; the agent's closing summary (from 0.9.3 also
197
+ beside a change agent's "no code change" result, so its findings can be posted); a
198
+ failure's reason; and the secret scan (next section). From 0.9.3 also: the full id of the
199
+ commit the run started from (`readHead`); when a plan's limit stopped the engine, that and
200
+ when it resets (`limit`); that the session ended with its own command still running
201
+ (`openCommandAtEnd`); and, for a run the previous runner process lost, `lost`. A FireFunc
202
+ API older than one of these fields refuses a result that carries it; the runner then sends
203
+ the result again without the newest field, and the next, so an older API costs the new
204
+ fields and never the result.
205
+
206
+ - **The summary** keeps its prose, its lists and short inline names (`parseDate`,
207
+ `src/a.ts:14`). A fenced or indented code block, a diff, a run of statements pasted
208
+ without a fence, a `<pre>` block and an inline span that is a statement rather than a
209
+ name are each replaced by a note, which names the file and line when the block said
210
+ which:
211
+
212
+ ````text
213
+ Fixed the rounding in src/total.ts:3.
214
+
215
+ ```ts src/total.ts:3
216
+ return items.reduce((a, i) => a + i.price, 0);
217
+ ```
218
+ ````
219
+
220
+ is sent as
221
+
222
+ ```text
223
+ Fixed the rounding in src/total.ts:3.
224
+
225
+ [code kept on the machine — see src/total.ts:3]
226
+ ```
227
+
228
+ - **A failure's reason** is the runner's own sentence and, at most, the one line of a
229
+ tool's output that says what went wrong. A failed setup command is named by its program
230
+ (`Setup command failed (exit 2): npm run build — src/total.ts:3:10 - error TS2322: …`),
231
+ and from 0.9.2 by the file name of the script an interpreter ran (`zsh night-setup.sh`,
232
+ never its folder); when no line of its output reads like an error — a script's own "free
233
+ disk is below the floor" — the last line it printed that is not code and carries nothing
234
+ shaped like a credential is sent instead, with the machine's home folder written as `~`. An engine ended by a signal from outside —
235
+ SIGTERM (exit 143) or SIGKILL (exit 137): a person, the operating system or a time limit
236
+ on the machine — is sent as that (0.9.2), not as a crash: the runner stages, commits and
237
+ pushes nothing for it, opens no pull request, and does not start the session again. A refused push by
238
+ git's own `error:`, `fatal:` and `hint:` lines — what a pre-push hook printed stays
239
+ here; a crashed engine by its error line, never the source line a stack quotes. The
240
+ whole output is in the runner's log. A session the model's safety system declined
241
+ (0.9.1+ — Claude Code's "safeguards flagged" / usage-policy API error) is sent as that,
242
+ in the runner's own words, and neither the runner nor FireFunc runs it again. It is read
243
+ from how the engine ended — Claude Code's closing report says it closed on an error
244
+ and called it a refusal — never from what the agent wrote, so an answer that quotes a
245
+ refusal or links the usage policy is sent as the answer.
246
+
247
+ - **What the run spent** (0.9.1 and newer), read from the engine's own closing
248
+ report — Claude Code's `result` event: the tokens by class (input, output, thinking,
249
+ cache read, cache written) in total and per model id, the turns, the time the session's
250
+ main loop was working and the time in model requests (summed over concurrent requests,
251
+ so it can be longer), the engine's own estimate of those tokens at the API's list prices
252
+ or at the organization's managed rates (not a bill; none is sent when the engine guessed
253
+ the price), whether the engine was signed in with a plan or an API key, whether the plan
254
+ drew on its billed extra usage, and its version. Numbers and names only, nothing the
255
+ agent wrote; an engine that keeps no such count sends none, and a crash's zeroed
256
+ report is not sent as a count. A session whose sub-agents run in the background closes
257
+ once per stretch of its main loop: from 0.9.2 the turns and the working time are added
258
+ over every stretch (0.9.1 sent the last stretch's alone), and the session's totals are
259
+ read once. The plan's 5-hour and weekly percentages are not sent: today's Claude Code
260
+ carries them only in an undocumented field.
261
+
262
+ - **Credentials it asks for** (`/git-credential`, `/mcp-credential`) carry the run's id
263
+ and, for MCP, the server's name — nothing else. FireFunc works out the repository and
264
+ the account from the run. From 0.9.3 the GitHub MCP credential is asked for again as it
265
+ nears its hour, or when GitHub refuses it, the same way.
266
+
267
+ FireFunc applies the same rules again when it stores what an older runner sent, so a
268
+ machine you have not updated yet is held to them too.
269
+
270
+ ## The secret scan before a push
271
+
272
+ Before it pushes (0.8.3+), the runner reads what the push adds — the change as a whole
273
+ **and** each commit on the branch, because a key committed and then taken out is still
274
+ published by the push — with the same patterns FireFunc's Trust Engine uses. Every file
275
+ is read as the text that is pushed, including one `.gitattributes` marks as binary, and
276
+ no replace ref or graft in the checkout can show the scan a different commit:
277
+
278
+ | Kind | What it matches | The push |
279
+ | ----------------------- | ------------------------------------------------------------------------------------------------------------------ | ---------- |
280
+ | `aws_access_key_id` | `AKIA…` / `ASIA…` access key ids | refused |
281
+ | `aws_secret_access_key` | `aws_secret_access_key = …` with a 40-character value | refused |
282
+ | `github_token` | `ghp_`, `gho_`, `ghu_`, `ghs_`, `ghr_` tokens and `github_pat_` fine-grained tokens | refused |
283
+ | `slack_token` | `xoxb-`, `xoxa-`, `xoxp-`, `xoxr-`, `xoxs-` tokens | refused |
284
+ | `google_api_key` | `AIza…` keys | refused |
285
+ | `stripe_secret_key` | `sk_live_…` / `sk_test_…` | refused |
286
+ | `private_key_block` | `-----BEGIN … PRIVATE KEY-----` | refused |
287
+ | `jwt` | three-part `eyJ….eyJ….…` tokens | refused |
288
+ | `generic_assignment` | `password`, `passwd`, `secret`, `api_key`, `access_token` or `private_key` set to a quoted value of 12+ characters | goes ahead |
289
+
290
+ AWS's two documented example keys (`AKIAIOSFODNN7EXAMPLE` and its example secret) are
291
+ nobody's credential and are let through.
292
+
293
+ - **A refused push** leaves nothing on GitHub: the commit stays on the local branch, and
294
+ the run fails with what was found, where, and what to do — rotate a real credential and
295
+ have the agent read it from the environment or your secret store, or ask for a
296
+ placeholder that does not look like a live key — then run the task again.
297
+ - **A `generic_assignment`** does not stop the push — a test fixture takes that shape as
298
+ often as a live value does — but it is reported, and FireFunc does not auto-merge a pull
299
+ request with any finding: a person decides.
300
+ - **A run that continues a pull request** (a revision of one that is already open) is
301
+ refused only for what it adds itself: the commits already on the branch are on GitHub,
302
+ and refusing this push would not take them back. The pull request is read whole as
303
+ well, from the base branch, and what that finds is reported with the result — so a key
304
+ in the author's commits, or in one pushed between two runs, still keeps FireFunc from
305
+ merging it. If the pull request cannot be read from the base branch, the scan is
306
+ reported without `head` (below).
307
+ - **A change the runner cannot read** is pushed unscanned and reported without a scan,
308
+ which FireFunc treats as "nothing has looked", never as clean.
309
+
310
+ The result carries the scan as a path, a kind and a line per finding — never a character
311
+ of the secret — and the commit it covers:
312
+
313
+ ```json
314
+ {
315
+ "status": "pr_opened",
316
+ "secretScan": {
317
+ "scanned": true,
318
+ "hits": [{ "path": "test/login.test.ts", "kind": "generic_assignment", "line": 12 }],
319
+ "head": "<the full id of the commit the push sent>"
320
+ }
321
+ }
322
+ ```
323
+
324
+ `head` says the scan read the whole pull request, from the base branch to that commit. It
325
+ is left out when nothing was pushed, when the branch no longer pointed at the scanned
326
+ commit after the push, and when a continued pull request could not be read whole.
327
+ FireFunc takes the scan as covering a pull request only while the pull request's head is
328
+ that commit: a commit pushed after the run — by a person, a bot or GitHub's **Update
329
+ branch** — was never scanned, and FireFunc does not auto-merge the pull request then
330
+ either. A runner older than 0.8.3 sends no scan at all, with the same
331
+ result.
332
+
333
+ ## Agents with no repository
334
+
335
+ An agent whose **Works in** is "No repository" arrives at the runner with no repo to clone.
336
+ The runner (0.8.0 and newer) runs the engine in a throwaway directory with the agent's MCP
337
+ servers, opens no branch and no pull request, and reports the summary the engine finished
338
+ with — that summary, and the agent's declared deliverables, are the run's result. An older
339
+ runner never sees such a run: FireFunc keeps it for a machine that can take it, and says
340
+ which machine needs `npm i -g @firefunc-agent/runner@latest`.
341
+
342
+ ## `firefunc`: agents from a terminal, a script or Claude Code
343
+
344
+ The package installs a second command, `firefunc`, for the person who sets agents up
345
+ rather than the machine that runs them. It drives FireFunc's public API with a
346
+ **workspace API key** (`ffk_…`, made in FireFunc → Settings → API keys), and it is how
347
+ Claude Code sets up FireFunc agents for you.
348
+
349
+ ```bash
350
+ npm install -g @firefunc-agent/runner@latest # firefunc arrived in 0.9.0: check with firefunc --version
351
+ firefunc login # paste the key at the prompt — nothing you type is shown
352
+ firefunc templates list # look before you create
353
+ firefunc projects list
354
+ firefunc connections list --project "Web app"
355
+ firefunc agents create --project "Web app" --template sentry-fix-pr --name "Sentry fixer"
356
+ ```
357
+
358
+ **Agents are created as drafts.** `agents create` answers with the draft and a link that
359
+ opens it in the composer; a person reviews it there and activates it. `firefunc agents
360
+ activate` works only with a key made with the `agents:activate` scope. Without that
361
+ scope the API refuses it and says why. Installing or writing skills and setting a
362
+ project's standing instructions, repositories or claims likewise need a key made with
363
+ `workspace:configure`, which is off unless ticked — except that `agents create --template`
364
+ installs the curated skills that template names, as launching it from the gallery does.
365
+
366
+ | Command | Needs | What it does |
367
+ | ------------------------------------------------------------------------------ | ------------------------------------- | ------------------------------------------------------------------------- |
368
+ | `firefunc login` / `logout` / `whoami` | any key | Save, forget, or show the key this machine uses |
369
+ | `firefunc templates list` | `agents:read` | Whole agents to start from |
370
+ | `firefunc projects list` | `agents:read` | Where an agent can live |
371
+ | `firefunc connections list [--project …]` | `agents:read` | The tool accounts a project can use |
372
+ | `firefunc skills list` | `agents:read` | Skills an agent can carry |
373
+ | `firefunc agents list \| get <id or @handle>` | `agents:read` | Agents, one or all |
374
+ | `firefunc agents create --project … [--template …] [--name …] [--spec f.json]` | `agents:write` | A **draft**, and its composer link |
375
+ | `firefunc agents update <agent> --spec f.json` | `agents:write` | Change only the fields passed (a live agent also needs `agents:activate`) |
376
+ | `firefunc agents pause \| resume <agent>` | `agents:write` | Stop or restart an agent taking work |
377
+ | `firefunc agents activate <agent>` | `agents:activate` | Switch a draft on |
378
+ | `firefunc run <agent> --title … [--body …] [--watch]` | `tasks:write` | Start a task on an active agent (what "Run now" does) |
379
+ | `firefunc tasks list \| get <id> \| watch <id> \| states` | `tasks:read` | Follow tasks; `watch` stops when the agent's part is over |
380
+ | `firefunc skills directory` | `agents:read` | The curated skills, and which are installed here |
381
+ | `firefunc skills install <slug>` | `workspace:configure` | Install a directory skill so agents may carry it |
382
+ | `firefunc skills create --file SKILL.md` / `update <slug> --file …` | `workspace:configure` | Write or change a skill of the workspace's own |
383
+ | `firefunc projects instructions get \| set <project> --file f.json` | `agents:read` / `workspace:configure` | A project's standing instructions (set replaces all five fields) |
384
+ | `firefunc projects sources get \| set <project> --file f.json` | `agents:read` / `workspace:configure` | What work a project claims (set merges kind by kind) |
385
+ | `firefunc projects repos get \| set <project> --file f.json` | `agents:read` / `workspace:configure` | A project's repositories (set adds only ones its GitHub account can see) |
386
+ | `firefunc skill install [--dir …]` | — | Write the Claude Code skill (below) |
387
+
388
+ Every command has `--help`, and each one takes:
389
+
390
+ - `--json` prints the API's answer as it arrived, for scripts and agents. A refusal
391
+ goes to stderr as `{"error":{"status","code","message","fix","issues","details"}}`:
392
+ `code` is the API's stable reason (`missing_scope`, `unknown_agent`, `not_ready`…)
393
+ and `details` its specifics.
394
+ - Exit codes: `0` done; `1` refused or failed, with the reason and the fix on stderr;
395
+ `2` the command line was wrong.
396
+ - `--api-url` sets the API address (default `https://api.firefunc.com`, or
397
+ `FIREFUNC_API_URL`). Plain `http` is refused except to `localhost`, because every
398
+ request carries the key. The key `login` saved is sent only to the address it was
399
+ checked against: pointed anywhere else, a command is refused (`api_url_mismatch`)
400
+ until you `firefunc login --api-url` there.
401
+
402
+ **Where the key lives.** `firefunc login` checks the key against the API before it
403
+ saves it to `~/.firefunc/config.json`. The file is readable only by you (0600), in a
404
+ folder only you can open (0700) when `login` creates it; a folder that already existed
405
+ keeps its own mode. The CLI never prints the key. That file is
406
+ separate from the runner's `~/.firefunc-runner`, so `firefunc logout` cannot take a
407
+ machine offline. `logout` forgets the key on this machine only: the key works until
408
+ it is revoked in Settings → API keys. In CI, set `FIREFUNC_API_KEY` instead of
409
+ logging in. It takes precedence over the saved key.
410
+
411
+ ### The Claude Code skill
412
+
413
+ ```bash
414
+ firefunc skill install # writes ~/.claude/skills/firefunc/SKILL.md
415
+ ```
416
+
417
+ The skill tells Claude Code when to use `firefunc` and how. It looks before it
418
+ creates anything (templates, projects, connections and agents that already exist),
419
+ creates a draft, and hands you the composer link. It activates an agent only when
420
+ you asked for that agent and the key has `agents:activate`. It never asks for a key
421
+ in the chat, and it reports a refusal with the fix. `firefunc skill show` prints the
422
+ skill. A `SKILL.md` you have edited is kept unless you pass `--force`.
423
+
134
424
  ## Licence
135
425
 
136
426
  `@firefunc-agent/runner` is the **client** half of FireFunc, published so the machines
@@ -142,3 +432,5 @@ proprietary and is not distributed here. This package contains only the daemon
142
432
  that runs on your machine: it invokes coding agents **you** installed and pay
143
433
  for, works on **your** checkouts, and reports results back. Your source code
144
434
  does not need to reach FireFunc for any of it to work.
435
+
436
+ FireFunc is a product of SoftHawker LLC, which licenses this package.
@@ -0,0 +1,32 @@
1
+ import type { SessionEvent } from './session-stream.js';
2
+ export type ActivityKind = 'read' | 'edit' | 'run' | 'search' | 'skill' | 'tool' | 'web' | 'agent' | 'plan' | 'say' | 'done';
3
+ export type ActivityStep = {
4
+ seq: number;
5
+ at: string;
6
+ kind: ActivityKind;
7
+ label: string;
8
+ detail?: Record<string, unknown>;
9
+ };
10
+ export declare function redact(text: string, max?: number): string;
11
+ export declare function relativePath(p: string, worktree: string): string;
12
+ export declare function stripWorktree(command: string, worktree: string): string;
13
+ export declare function stepOf(ev: SessionEvent, ctx: {
14
+ worktree: string;
15
+ seq: number;
16
+ now: () => Date;
17
+ writeTools?: ReadonlySet<string>;
18
+ }): ActivityStep | null;
19
+ export declare function createActivityReporter(opts: {
20
+ worktree: string;
21
+ post: (steps: ActivityStep[]) => Promise<void>;
22
+ intervalMs?: number;
23
+ cap?: number;
24
+ now?: () => Date;
25
+ writeTools?: ReadonlySet<string>;
26
+ holdMs?: number;
27
+ }): {
28
+ push: (ev: SessionEvent) => void;
29
+ flush: (final?: boolean) => Promise<void>;
30
+ readonly sent: number;
31
+ readonly seen: number;
32
+ };