@firefunc-agent/runner 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -3
- package/README.md +233 -3
- package/dist/activity.d.ts +29 -0
- package/dist/activity.js +209 -0
- package/dist/api.d.ts +45 -1
- package/dist/api.js +44 -2
- package/dist/brief.d.ts +6 -0
- package/dist/brief.js +257 -0
- package/dist/build-info.json +4 -0
- package/dist/cli.js +49 -0
- package/dist/config.d.ts +5 -0
- package/dist/config.js +3 -0
- package/dist/daemon.js +70 -2
- package/dist/engines/antigravity.d.ts +2 -0
- package/dist/engines/antigravity.js +102 -0
- package/dist/engines/claude-budget.d.ts +1 -1
- package/dist/engines/claude-budget.js +2 -72
- package/dist/engines/claude.js +10 -1
- package/dist/engines/codex.js +10 -3
- package/dist/engines/copilot.d.ts +2 -0
- package/dist/engines/copilot.js +117 -0
- package/dist/engines/cursor.js +4 -0
- package/dist/engines/gemini.js +6 -1
- package/dist/engines/index.d.ts +2 -0
- package/dist/engines/index.js +22 -4
- package/dist/engines/types.d.ts +2 -1
- package/dist/firefunc/agents.d.ts +2 -0
- package/dist/firefunc/agents.js +291 -0
- package/dist/firefunc/args.d.ts +18 -0
- package/dist/firefunc/args.js +82 -0
- package/dist/firefunc/auth.d.ts +21 -0
- package/dist/firefunc/auth.js +129 -0
- package/dist/firefunc/catalog.d.ts +10 -0
- package/dist/firefunc/catalog.js +201 -0
- package/dist/firefunc/cli.d.ts +2 -0
- package/dist/firefunc/cli.js +24 -0
- package/dist/firefunc/client.d.ts +35 -0
- package/dist/firefunc/client.js +174 -0
- package/dist/firefunc/command.d.ts +28 -0
- package/dist/firefunc/command.js +35 -0
- package/dist/firefunc/config.d.ts +29 -0
- package/dist/firefunc/config.js +111 -0
- package/dist/firefunc/io.d.ts +25 -0
- package/dist/firefunc/io.js +14 -0
- package/dist/firefunc/main.d.ts +4 -0
- package/dist/firefunc/main.js +221 -0
- package/dist/firefunc/output.d.ts +29 -0
- package/dist/firefunc/output.js +128 -0
- package/dist/firefunc/prompt.d.ts +14 -0
- package/dist/firefunc/prompt.js +58 -0
- package/dist/firefunc/skill.d.ts +3 -0
- package/dist/firefunc/skill.js +80 -0
- package/dist/firefunc/tasks.d.ts +2 -0
- package/dist/firefunc/tasks.js +279 -0
- package/dist/firefunc/version.d.ts +2 -0
- package/dist/firefunc/version.js +23 -0
- package/dist/git-auth.d.ts +4 -1
- package/dist/git-auth.js +6 -2
- package/dist/job.js +476 -83
- package/dist/keep-local.d.ts +7 -0
- package/dist/keep-local.js +484 -0
- package/dist/machine-logins.d.ts +19 -0
- package/dist/machine-logins.js +187 -0
- package/dist/mcp-login.d.ts +24 -0
- package/dist/mcp-login.js +993 -0
- package/dist/mcp.d.ts +60 -0
- package/dist/mcp.js +582 -0
- package/dist/network.d.ts +20 -0
- package/dist/network.js +76 -0
- package/dist/pending.d.ts +14 -0
- package/dist/pending.js +56 -0
- package/dist/secret-scan.d.ts +19 -0
- package/dist/secret-scan.js +161 -0
- package/dist/session-stream.d.ts +1 -0
- package/dist/session-stream.js +11 -1
- package/dist/viewer.js +11 -1
- package/package.json +7 -4
- package/skill/firefunc/SKILL.md +173 -0
package/LICENSE
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
FireFunc Runner — Client Software Licence
|
|
2
|
-
Copyright (c) 2026
|
|
2
|
+
Copyright (c) 2026 SoftHawker LLC. All rights reserved.
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
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
|
|
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,8 +51,10 @@ 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
|
-
-
|
|
54
|
+
- 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.
|
|
55
|
+
- **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).
|
|
56
|
+
- Refuses to push a commit that contains a `.env` file or the run's MCP config, whatever the agent committed.
|
|
57
|
+
- 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.
|
|
53
58
|
- A per-job timeout (default 20 min) prevents a stuck run from hanging the daemon.
|
|
54
59
|
|
|
55
60
|
## Commands
|
|
@@ -131,6 +136,229 @@ find their own logins). If you install a new agent CLI somewhere new, re-run
|
|
|
131
136
|
> `schtasks` verb) but have **not** yet been run on a real machine of either
|
|
132
137
|
> kind. Please report anything that misbehaves.
|
|
133
138
|
|
|
139
|
+
## What leaves your machine
|
|
140
|
+
|
|
141
|
+
FireFunc never clones, fetches or stores your repository. The change goes from this
|
|
142
|
+
machine to **your** repository on GitHub — the push and the draft pull request — and
|
|
143
|
+
nowhere else. This is everything runner **0.8.3** sends to the FireFunc API you connected
|
|
144
|
+
it to:
|
|
145
|
+
|
|
146
|
+
**While it waits for work** (`POST /channel/claim`, every few seconds): its version,
|
|
147
|
+
hostname and platform; the engines it can run; the port of its local viewer; the
|
|
148
|
+
subscription usage its engines can read (percent used and when each window resets); and
|
|
149
|
+
the MCP servers this machine is signed in to — names, states, expiries and which login
|
|
150
|
+
holds each (the runner's own or Claude Code's), never a token.
|
|
151
|
+
|
|
152
|
+
**While a run works** (`/channel/runs/<id>/events` and `/activity`): the stage it is at
|
|
153
|
+
(`cloning`, `fixing`, `pushing`, `pr_opened`, a heartbeat every five minutes) with the
|
|
154
|
+
repository, the branch, the task's title FireFunc sent it or the pull request's URL, and
|
|
155
|
+
one line per step the engine takes — a verb and a name:
|
|
156
|
+
|
|
157
|
+
| The engine… | The step says |
|
|
158
|
+
| ------------------------------- | --------------------------------------------------------------------------------------- |
|
|
159
|
+
| reads or edits a file | its path, relative to the checkout (`src/domain/orders.ts`) |
|
|
160
|
+
| runs a command | its programs and subcommands only — `npm test`, `git status`, `sed` — never an argument |
|
|
161
|
+
| searches | where it looked (`src/orders`, `src/**/*.test.ts`), never the pattern |
|
|
162
|
+
| calls an MCP tool | the server and the action (`Jira · get issue`) |
|
|
163
|
+
| fetches from the web | the host, or the words of a web search |
|
|
164
|
+
| uses a skill | the skill's name |
|
|
165
|
+
| starts a sub-agent | the task it gave it, with code taken out |
|
|
166
|
+
| updates its to-do list | "updated its plan" |
|
|
167
|
+
| uses any other tool | the tool's name and, when it was given a path, the path |
|
|
168
|
+
| says what it is doing, finishes | its own words on one line, with code taken out |
|
|
169
|
+
|
|
170
|
+
A command's arguments are where a `sed` expression, a `python -c` body or a heredoc
|
|
171
|
+
lives, so they stay here; so does a search pattern, which is often a line of code. Every
|
|
172
|
+
step is cut to one line and has anything shaped like a credential redacted. The files, the
|
|
173
|
+
commands' output and the transcript never leave: the local viewer and
|
|
174
|
+
`firefunc-runner logs` show them.
|
|
175
|
+
|
|
176
|
+
**When it finishes** (`POST /channel/runs/<id>/result`): the outcome; the pull request's
|
|
177
|
+
repository, number, URL, branch and title; the agent's closing summary; a failure's
|
|
178
|
+
reason; and the secret scan (next section).
|
|
179
|
+
|
|
180
|
+
- **The summary** keeps its prose, its lists and short inline names (`parseDate`,
|
|
181
|
+
`src/a.ts:14`). A fenced or indented code block, a diff, a run of statements pasted
|
|
182
|
+
without a fence, a `<pre>` block and an inline span that is a statement rather than a
|
|
183
|
+
name are each replaced by a note, which names the file and line when the block said
|
|
184
|
+
which:
|
|
185
|
+
|
|
186
|
+
````text
|
|
187
|
+
Fixed the rounding in src/total.ts:3.
|
|
188
|
+
|
|
189
|
+
```ts src/total.ts:3
|
|
190
|
+
return items.reduce((a, i) => a + i.price, 0);
|
|
191
|
+
```
|
|
192
|
+
````
|
|
193
|
+
|
|
194
|
+
is sent as
|
|
195
|
+
|
|
196
|
+
```text
|
|
197
|
+
Fixed the rounding in src/total.ts:3.
|
|
198
|
+
|
|
199
|
+
[code kept on the machine — see src/total.ts:3]
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
- **A failure's reason** is the runner's own sentence and, at most, the one line of a
|
|
203
|
+
tool's output that says what went wrong. A failed setup command is named by its program
|
|
204
|
+
(`Setup command failed (exit 2): npm run build — src/total.ts:3:10 - error TS2322: …`);
|
|
205
|
+
a refused push by
|
|
206
|
+
git's own `error:`, `fatal:` and `hint:` lines — what a pre-push hook printed stays
|
|
207
|
+
here; a crashed engine by its error line, never the source line a stack quotes. The
|
|
208
|
+
whole output is in the runner's log.
|
|
209
|
+
|
|
210
|
+
- **Credentials it asks for** (`/git-credential`, `/mcp-credential`) carry the run's id
|
|
211
|
+
and, for MCP, the server's name — nothing else. FireFunc works out the repository and
|
|
212
|
+
the account from the run.
|
|
213
|
+
|
|
214
|
+
FireFunc applies the same rules again when it stores what an older runner sent, so a
|
|
215
|
+
machine you have not updated yet is held to them too.
|
|
216
|
+
|
|
217
|
+
## The secret scan before a push
|
|
218
|
+
|
|
219
|
+
Before it pushes (0.8.3+), the runner reads what the push adds — the change as a whole
|
|
220
|
+
**and** each commit on the branch, because a key committed and then taken out is still
|
|
221
|
+
published by the push — with the same patterns FireFunc's Trust Engine uses. Every file
|
|
222
|
+
is read as the text that is pushed, including one `.gitattributes` marks as binary, and
|
|
223
|
+
no replace ref or graft in the checkout can show the scan a different commit:
|
|
224
|
+
|
|
225
|
+
| Kind | What it matches | The push |
|
|
226
|
+
| ----------------------- | ------------------------------------------------------------------------------------------------------------------ | ---------- |
|
|
227
|
+
| `aws_access_key_id` | `AKIA…` / `ASIA…` access key ids | refused |
|
|
228
|
+
| `aws_secret_access_key` | `aws_secret_access_key = …` with a 40-character value | refused |
|
|
229
|
+
| `github_token` | `ghp_`, `gho_`, `ghu_`, `ghs_`, `ghr_` tokens and `github_pat_` fine-grained tokens | refused |
|
|
230
|
+
| `slack_token` | `xoxb-`, `xoxa-`, `xoxp-`, `xoxr-`, `xoxs-` tokens | refused |
|
|
231
|
+
| `google_api_key` | `AIza…` keys | refused |
|
|
232
|
+
| `stripe_secret_key` | `sk_live_…` / `sk_test_…` | refused |
|
|
233
|
+
| `private_key_block` | `-----BEGIN … PRIVATE KEY-----` | refused |
|
|
234
|
+
| `jwt` | three-part `eyJ….eyJ….…` tokens | refused |
|
|
235
|
+
| `generic_assignment` | `password`, `passwd`, `secret`, `api_key`, `access_token` or `private_key` set to a quoted value of 12+ characters | goes ahead |
|
|
236
|
+
|
|
237
|
+
AWS's two documented example keys (`AKIAIOSFODNN7EXAMPLE` and its example secret) are
|
|
238
|
+
nobody's credential and are let through.
|
|
239
|
+
|
|
240
|
+
- **A refused push** leaves nothing on GitHub: the commit stays on the local branch, and
|
|
241
|
+
the run fails with what was found, where, and what to do — rotate a real credential and
|
|
242
|
+
have the agent read it from the environment or your secret store, or ask for a
|
|
243
|
+
placeholder that does not look like a live key — then run the task again.
|
|
244
|
+
- **A `generic_assignment`** does not stop the push — a test fixture takes that shape as
|
|
245
|
+
often as a live value does — but it is reported, and FireFunc does not auto-merge a pull
|
|
246
|
+
request with any finding: a person decides.
|
|
247
|
+
- **A run that continues a pull request** (a revision of one that is already open) is
|
|
248
|
+
refused only for what it adds itself: the commits already on the branch are on GitHub,
|
|
249
|
+
and refusing this push would not take them back. The pull request is read whole as
|
|
250
|
+
well, from the base branch, and what that finds is reported with the result — so a key
|
|
251
|
+
in the author's commits, or in one pushed between two runs, still keeps FireFunc from
|
|
252
|
+
merging it. If the pull request cannot be read from the base branch, the scan is
|
|
253
|
+
reported without `head` (below).
|
|
254
|
+
- **A change the runner cannot read** is pushed unscanned and reported without a scan,
|
|
255
|
+
which FireFunc treats as "nothing has looked", never as clean.
|
|
256
|
+
|
|
257
|
+
The result carries the scan as a path, a kind and a line per finding — never a character
|
|
258
|
+
of the secret — and the commit it covers:
|
|
259
|
+
|
|
260
|
+
```json
|
|
261
|
+
{
|
|
262
|
+
"status": "pr_opened",
|
|
263
|
+
"secretScan": {
|
|
264
|
+
"scanned": true,
|
|
265
|
+
"hits": [{ "path": "test/login.test.ts", "kind": "generic_assignment", "line": 12 }],
|
|
266
|
+
"head": "<the full id of the commit the push sent>"
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
`head` says the scan read the whole pull request, from the base branch to that commit. It
|
|
272
|
+
is left out when nothing was pushed, when the branch no longer pointed at the scanned
|
|
273
|
+
commit after the push, and when a continued pull request could not be read whole.
|
|
274
|
+
FireFunc takes the scan as covering a pull request only while the pull request's head is
|
|
275
|
+
that commit: a commit pushed after the run — by a person, a bot or GitHub's **Update
|
|
276
|
+
branch** — was never scanned, and FireFunc does not auto-merge the pull request then
|
|
277
|
+
either. A runner older than 0.8.3 sends no scan at all, with the same
|
|
278
|
+
result.
|
|
279
|
+
|
|
280
|
+
## Agents with no repository
|
|
281
|
+
|
|
282
|
+
An agent whose **Works in** is "No repository" arrives at the runner with no repo to clone.
|
|
283
|
+
The runner (0.8.0 and newer) runs the engine in a throwaway directory with the agent's MCP
|
|
284
|
+
servers, opens no branch and no pull request, and reports the summary the engine finished
|
|
285
|
+
with — that summary, and the agent's declared deliverables, are the run's result. An older
|
|
286
|
+
runner never sees such a run: FireFunc keeps it for a machine that can take it, and says
|
|
287
|
+
which machine needs `npm i -g @firefunc-agent/runner@latest`.
|
|
288
|
+
|
|
289
|
+
## `firefunc`: agents from a terminal, a script or Claude Code
|
|
290
|
+
|
|
291
|
+
The package installs a second command, `firefunc`, for the person who sets agents up
|
|
292
|
+
rather than the machine that runs them. It drives FireFunc's public API with a
|
|
293
|
+
**workspace API key** (`ffk_…`, made in FireFunc → Settings → API keys), and it is how
|
|
294
|
+
Claude Code sets up FireFunc agents for you.
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
npm install -g @firefunc-agent/runner@latest # firefunc arrived in 0.9.0: check with firefunc --version
|
|
298
|
+
firefunc login # paste the key at the prompt — nothing you type is shown
|
|
299
|
+
firefunc templates list # look before you create
|
|
300
|
+
firefunc projects list
|
|
301
|
+
firefunc connections list --project "Web app"
|
|
302
|
+
firefunc agents create --project "Web app" --template sentry-fix-pr --name "Sentry fixer"
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
**Agents are created as drafts.** `agents create` answers with the draft and a link that
|
|
306
|
+
opens it in the composer; a person reviews it there and activates it. `firefunc agents
|
|
307
|
+
activate` works only with a key made with the `agents:activate` scope. Without that
|
|
308
|
+
scope the API refuses it and says why.
|
|
309
|
+
|
|
310
|
+
| Command | Needs | What it does |
|
|
311
|
+
| ------------------------------------------------------------------------------ | ----------------- | ------------------------------------------------------------------------- |
|
|
312
|
+
| `firefunc login` / `logout` / `whoami` | any key | Save, forget, or show the key this machine uses |
|
|
313
|
+
| `firefunc templates list` | `agents:read` | Whole agents to start from |
|
|
314
|
+
| `firefunc projects list` | `agents:read` | Where an agent can live |
|
|
315
|
+
| `firefunc connections list [--project …]` | `agents:read` | The tool accounts a project can use |
|
|
316
|
+
| `firefunc skills list` | `agents:read` | Skills an agent can carry |
|
|
317
|
+
| `firefunc agents list \| get <id or @handle>` | `agents:read` | Agents, one or all |
|
|
318
|
+
| `firefunc agents create --project … [--template …] [--name …] [--spec f.json]` | `agents:write` | A **draft**, and its composer link |
|
|
319
|
+
| `firefunc agents update <agent> --spec f.json` | `agents:write` | Change only the fields passed (a live agent also needs `agents:activate`) |
|
|
320
|
+
| `firefunc agents pause \| resume <agent>` | `agents:write` | Stop or restart an agent taking work |
|
|
321
|
+
| `firefunc agents activate <agent>` | `agents:activate` | Switch a draft on |
|
|
322
|
+
| `firefunc run <agent> --title … [--body …] [--watch]` | `tasks:write` | Start a task on an active agent (what "Run now" does) |
|
|
323
|
+
| `firefunc tasks list \| get <id> \| watch <id> \| states` | `tasks:read` | Follow tasks; `watch` stops when the agent's part is over |
|
|
324
|
+
| `firefunc skill install [--dir …]` | — | Write the Claude Code skill (below) |
|
|
325
|
+
|
|
326
|
+
Every command has `--help`, and each one takes:
|
|
327
|
+
|
|
328
|
+
- `--json` prints the API's answer as it arrived, for scripts and agents. A refusal
|
|
329
|
+
goes to stderr as `{"error":{"status","code","message","fix","issues","details"}}`:
|
|
330
|
+
`code` is the API's stable reason (`missing_scope`, `unknown_agent`, `not_ready`…)
|
|
331
|
+
and `details` its specifics.
|
|
332
|
+
- Exit codes: `0` done; `1` refused or failed, with the reason and the fix on stderr;
|
|
333
|
+
`2` the command line was wrong.
|
|
334
|
+
- `--api-url` sets the API address (default `https://api.firefunc.com`, or
|
|
335
|
+
`FIREFUNC_API_URL`). Plain `http` is refused except to `localhost`, because every
|
|
336
|
+
request carries the key. The key `login` saved is sent only to the address it was
|
|
337
|
+
checked against: pointed anywhere else, a command is refused (`api_url_mismatch`)
|
|
338
|
+
until you `firefunc login --api-url` there.
|
|
339
|
+
|
|
340
|
+
**Where the key lives.** `firefunc login` checks the key against the API before it
|
|
341
|
+
saves it to `~/.firefunc/config.json`. The file is readable only by you (0600), in a
|
|
342
|
+
folder only you can open (0700) when `login` creates it; a folder that already existed
|
|
343
|
+
keeps its own mode. The CLI never prints the key. That file is
|
|
344
|
+
separate from the runner's `~/.firefunc-runner`, so `firefunc logout` cannot take a
|
|
345
|
+
machine offline. `logout` forgets the key on this machine only: the key works until
|
|
346
|
+
it is revoked in Settings → API keys. In CI, set `FIREFUNC_API_KEY` instead of
|
|
347
|
+
logging in. It takes precedence over the saved key.
|
|
348
|
+
|
|
349
|
+
### The Claude Code skill
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
firefunc skill install # writes ~/.claude/skills/firefunc/SKILL.md
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
The skill tells Claude Code when to use `firefunc` and how. It looks before it
|
|
356
|
+
creates anything (templates, projects, connections and agents that already exist),
|
|
357
|
+
creates a draft, and hands you the composer link. It activates an agent only when
|
|
358
|
+
you asked for that agent and the key has `agents:activate`. It never asks for a key
|
|
359
|
+
in the chat, and it reports a refusal with the fix. `firefunc skill show` prints the
|
|
360
|
+
skill. A `SKILL.md` you have edited is kept unless you pass `--force`.
|
|
361
|
+
|
|
134
362
|
## Licence
|
|
135
363
|
|
|
136
364
|
`@firefunc-agent/runner` is the **client** half of FireFunc, published so the machines
|
|
@@ -142,3 +370,5 @@ proprietary and is not distributed here. This package contains only the daemon
|
|
|
142
370
|
that runs on your machine: it invokes coding agents **you** installed and pay
|
|
143
371
|
for, works on **your** checkouts, and reports results back. Your source code
|
|
144
372
|
does not need to reach FireFunc for any of it to work.
|
|
373
|
+
|
|
374
|
+
FireFunc is a product of SoftHawker LLC, which licenses this package.
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
}): ActivityStep | null;
|
|
18
|
+
export declare function createActivityReporter(opts: {
|
|
19
|
+
worktree: string;
|
|
20
|
+
post: (steps: ActivityStep[]) => Promise<void>;
|
|
21
|
+
intervalMs?: number;
|
|
22
|
+
cap?: number;
|
|
23
|
+
now?: () => Date;
|
|
24
|
+
}): {
|
|
25
|
+
push: (ev: SessionEvent) => void;
|
|
26
|
+
flush: () => Promise<void>;
|
|
27
|
+
readonly sent: number;
|
|
28
|
+
readonly seen: number;
|
|
29
|
+
};
|
package/dist/activity.js
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { commandName, stripCode } from './keep-local.js';
|
|
2
|
+
const MAX_LABEL = 180;
|
|
3
|
+
const SECRET_PATTERNS = [
|
|
4
|
+
/\b(?:bearer|token|authorization)\s*[:=]?\s*[A-Za-z0-9._~+/-]{16,}=*/gi,
|
|
5
|
+
/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{20,}\b/g,
|
|
6
|
+
/\bgithub_pat_[A-Za-z0-9_]{20,}\b/g,
|
|
7
|
+
/\bxox[abprs]-[A-Za-z0-9-]{10,}\b/g,
|
|
8
|
+
/\bsk-[A-Za-z0-9_-]{16,}\b/g,
|
|
9
|
+
/\blin_(?:api|oauth)_[A-Za-z0-9]{16,}\b/g,
|
|
10
|
+
/\bsntry[su]_[A-Za-z0-9]{16,}\b/g,
|
|
11
|
+
/\bfigd_[A-Za-z0-9_-]{16,}\b/g,
|
|
12
|
+
/\bATATT3[A-Za-z0-9_-]{20,}\b/g,
|
|
13
|
+
/\bAKIA[0-9A-Z]{16}\b/g,
|
|
14
|
+
/\bffr_[A-Za-z0-9]{16,}\b/g,
|
|
15
|
+
/\b(?:password|passwd|secret|api[_-]?key|access[_-]?token|client[_-]?secret)\s*[:=]\s*\S+/gi,
|
|
16
|
+
/https?:\/\/[^\s/]*:[^\s@/]+@/g,
|
|
17
|
+
];
|
|
18
|
+
export function redact(text, max = MAX_LABEL) {
|
|
19
|
+
let out = text.replace(/\s+/g, ' ').trim();
|
|
20
|
+
for (const re of SECRET_PATTERNS)
|
|
21
|
+
out = out.replace(re, (m) => `${m.slice(0, 4)}…[redacted]`);
|
|
22
|
+
return out.length > max ? `${out.slice(0, max - 1)}…` : out;
|
|
23
|
+
}
|
|
24
|
+
export function relativePath(p, worktree) {
|
|
25
|
+
const norm = p.replace(/\\/g, '/');
|
|
26
|
+
const root = worktree.replace(/\\/g, '/').replace(/\/+$/, '');
|
|
27
|
+
const roots = new Set([root, root.replace(/^\/private(\/|$)/, '/'), `/private${root}`]);
|
|
28
|
+
for (const r of roots)
|
|
29
|
+
if (norm.startsWith(`${r}/`))
|
|
30
|
+
return norm.slice(r.length + 1);
|
|
31
|
+
const parts = norm.split('/').filter(Boolean);
|
|
32
|
+
return parts.length > 1 ? `…/${parts.slice(-2).join('/')}` : norm;
|
|
33
|
+
}
|
|
34
|
+
export function stripWorktree(command, worktree) {
|
|
35
|
+
const root = worktree.replace(/\\/g, '/').replace(/\/+$/, '');
|
|
36
|
+
const roots = [root, root.replace(/^\/private(\/|$)/, '/'), `/private${root}`]
|
|
37
|
+
.filter((r, i, all) => r && all.indexOf(r) === i)
|
|
38
|
+
.sort((a, b) => b.length - a.length);
|
|
39
|
+
let out = command;
|
|
40
|
+
for (const r of roots)
|
|
41
|
+
out = out.split(`${r}/`).join('./').split(r).join('.');
|
|
42
|
+
return out;
|
|
43
|
+
}
|
|
44
|
+
function mcpParts(name) {
|
|
45
|
+
const m = /^mcp__([^_]+(?:_[^_]+)*)__(.+)$/.exec(name);
|
|
46
|
+
return m ? { server: m[1], action: m[2] } : null;
|
|
47
|
+
}
|
|
48
|
+
const TOOL_LABELS = {
|
|
49
|
+
github: 'GitHub',
|
|
50
|
+
jira: 'Jira',
|
|
51
|
+
linear: 'Linear',
|
|
52
|
+
sentry: 'Sentry',
|
|
53
|
+
slack: 'Slack',
|
|
54
|
+
figma: 'Figma',
|
|
55
|
+
};
|
|
56
|
+
export function stepOf(ev, ctx) {
|
|
57
|
+
const base = { seq: ctx.seq, at: ctx.now().toISOString() };
|
|
58
|
+
if (ev.kind === 'text') {
|
|
59
|
+
const first = stripCode(ev.text).replace(/\s+/g, ' ').trim();
|
|
60
|
+
if (!first)
|
|
61
|
+
return null;
|
|
62
|
+
return { ...base, kind: 'say', label: redact(first, 220) };
|
|
63
|
+
}
|
|
64
|
+
if (ev.kind === 'result') {
|
|
65
|
+
return { ...base, kind: 'done', label: redact(stripCode(ev.text), 220) };
|
|
66
|
+
}
|
|
67
|
+
const name = ev.name;
|
|
68
|
+
const arg = ev.arg ?? '';
|
|
69
|
+
const mcp = mcpParts(name);
|
|
70
|
+
if (mcp) {
|
|
71
|
+
const viaFireFunc = mcp.server === 'firefunc' ? /^([a-z]+)_(.+)$/.exec(mcp.action) : null;
|
|
72
|
+
const tool = viaFireFunc ? viaFireFunc[1] : mcp.server;
|
|
73
|
+
const action = viaFireFunc ? viaFireFunc[2] : mcp.action;
|
|
74
|
+
const server = TOOL_LABELS[tool] ?? tool;
|
|
75
|
+
return {
|
|
76
|
+
...base,
|
|
77
|
+
kind: 'tool',
|
|
78
|
+
label: `${server} · ${action.replace(/_/g, ' ')}`,
|
|
79
|
+
detail: { tool, action, ...(viaFireFunc ? { via: 'firefunc' } : {}) },
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
switch (name) {
|
|
83
|
+
case 'Read':
|
|
84
|
+
case 'NotebookRead':
|
|
85
|
+
return { ...base, kind: 'read', label: fileLabel(arg, ctx.worktree) };
|
|
86
|
+
case 'Edit':
|
|
87
|
+
case 'MultiEdit':
|
|
88
|
+
case 'Write':
|
|
89
|
+
case 'NotebookEdit':
|
|
90
|
+
return {
|
|
91
|
+
...base,
|
|
92
|
+
kind: 'edit',
|
|
93
|
+
label: fileLabel(arg, ctx.worktree),
|
|
94
|
+
detail: { create: name === 'Write' },
|
|
95
|
+
};
|
|
96
|
+
case 'Bash':
|
|
97
|
+
return { ...base, kind: 'run', label: redact(commandName(arg), 140) };
|
|
98
|
+
case 'Grep':
|
|
99
|
+
case 'LS':
|
|
100
|
+
return {
|
|
101
|
+
...base,
|
|
102
|
+
kind: 'search',
|
|
103
|
+
label: redact(scopeOf(name === 'LS' ? arg : (ev.path ?? ''), ctx.worktree), 120),
|
|
104
|
+
detail: { how: name },
|
|
105
|
+
};
|
|
106
|
+
case 'Glob': {
|
|
107
|
+
const glob = inCheckout(arg, ctx.worktree);
|
|
108
|
+
const scope = scopeOf(ev.path ?? '', ctx.worktree);
|
|
109
|
+
const label = glob && GLOB.test(glob) ? (scope === CHECKOUT ? glob : `${scope}/${glob}`) : scope;
|
|
110
|
+
return { ...base, kind: 'search', label: redact(label, 120), detail: { how: name } };
|
|
111
|
+
}
|
|
112
|
+
case 'Skill':
|
|
113
|
+
return { ...base, kind: 'skill', label: redact(arg || 'a skill', 80) };
|
|
114
|
+
case 'WebFetch':
|
|
115
|
+
case 'WebSearch': {
|
|
116
|
+
let host = arg;
|
|
117
|
+
try {
|
|
118
|
+
host = new URL(arg).host;
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
}
|
|
122
|
+
return { ...base, kind: 'web', label: redact(host || 'the web', 120) };
|
|
123
|
+
}
|
|
124
|
+
case 'Task':
|
|
125
|
+
case 'Agent':
|
|
126
|
+
return { ...base, kind: 'agent', label: redact(stripCode(arg) || 'a sub-agent', 120) };
|
|
127
|
+
case 'TodoWrite':
|
|
128
|
+
return { ...base, kind: 'plan', label: 'updated its plan' };
|
|
129
|
+
default: {
|
|
130
|
+
const where = arg && PATH_ONLY.test(arg) ? ` ${relativePath(arg, ctx.worktree)}` : '';
|
|
131
|
+
return { ...base, kind: 'tool', label: redact(`${name}${where}`, 120) };
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function fileLabel(p, worktree) {
|
|
136
|
+
const rel = relativePath(p, worktree);
|
|
137
|
+
if (!rel)
|
|
138
|
+
return 'a file';
|
|
139
|
+
return rel.length > 200 ? `…${rel.slice(-199)}` : rel;
|
|
140
|
+
}
|
|
141
|
+
const CHECKOUT = 'the checkout';
|
|
142
|
+
const GLOB = /^[\w@.\/*?{},[\]!-]+$/;
|
|
143
|
+
const PATH_ONLY = /^[\w@.\/\\:~-]+$/;
|
|
144
|
+
function inCheckout(p, worktree) {
|
|
145
|
+
const norm = p.trim().replace(/\\/g, '/').replace(/\/+$/, '');
|
|
146
|
+
const folded = stripWorktree(norm, worktree).replace(/^\.(?:\/|$)/, '');
|
|
147
|
+
return /^(?:\/|[A-Za-z]:\/)/.test(folded) ? relativePath(folded, worktree) : folded;
|
|
148
|
+
}
|
|
149
|
+
function scopeOf(p, worktree) {
|
|
150
|
+
const where = PATH_ONLY.test(p.trim()) ? inCheckout(p, worktree) : '';
|
|
151
|
+
return where || CHECKOUT;
|
|
152
|
+
}
|
|
153
|
+
export function createActivityReporter(opts) {
|
|
154
|
+
const now = opts.now ?? (() => new Date());
|
|
155
|
+
const cap = opts.cap ?? 1500;
|
|
156
|
+
let seq = 0;
|
|
157
|
+
let sent = 0;
|
|
158
|
+
let pending = [];
|
|
159
|
+
let inflight = null;
|
|
160
|
+
let timer = null;
|
|
161
|
+
const push = (ev) => {
|
|
162
|
+
const step = stepOf(ev, { worktree: opts.worktree, seq: seq + 1, now });
|
|
163
|
+
if (!step || !step.label.trim())
|
|
164
|
+
return;
|
|
165
|
+
seq += 1;
|
|
166
|
+
if (seq + pending.length > cap && (step.kind === 'read' || step.kind === 'search')) {
|
|
167
|
+
if (seq % 5 !== 0)
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
pending.push(step);
|
|
171
|
+
if (!timer)
|
|
172
|
+
timer = setTimeout(() => void flush(), opts.intervalMs ?? 1500);
|
|
173
|
+
};
|
|
174
|
+
const flush = async () => {
|
|
175
|
+
if (timer) {
|
|
176
|
+
clearTimeout(timer);
|
|
177
|
+
timer = null;
|
|
178
|
+
}
|
|
179
|
+
if (inflight)
|
|
180
|
+
await inflight;
|
|
181
|
+
if (pending.length === 0)
|
|
182
|
+
return;
|
|
183
|
+
const batch = pending;
|
|
184
|
+
pending = [];
|
|
185
|
+
inflight = opts
|
|
186
|
+
.post(batch)
|
|
187
|
+
.then(() => {
|
|
188
|
+
sent += batch.length;
|
|
189
|
+
})
|
|
190
|
+
.catch(() => {
|
|
191
|
+
pending = [...batch, ...pending].slice(-cap);
|
|
192
|
+
})
|
|
193
|
+
.finally(() => {
|
|
194
|
+
inflight = null;
|
|
195
|
+
});
|
|
196
|
+
await inflight;
|
|
197
|
+
};
|
|
198
|
+
return {
|
|
199
|
+
push,
|
|
200
|
+
flush,
|
|
201
|
+
get sent() {
|
|
202
|
+
return sent;
|
|
203
|
+
},
|
|
204
|
+
get seen() {
|
|
205
|
+
return seq;
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=activity.js.map
|
package/dist/api.d.ts
CHANGED
|
@@ -4,6 +4,10 @@ export type ClaimedJob = {
|
|
|
4
4
|
prompt: string;
|
|
5
5
|
repo: string | null;
|
|
6
6
|
branch: string | null;
|
|
7
|
+
toolsOnly?: boolean;
|
|
8
|
+
continuesBranch?: boolean;
|
|
9
|
+
review?: boolean;
|
|
10
|
+
baseBranch?: string | null;
|
|
7
11
|
externalId: string | null;
|
|
8
12
|
title: string | null;
|
|
9
13
|
type: string;
|
|
@@ -16,9 +20,26 @@ export type ClaimedJob = {
|
|
|
16
20
|
contentType?: string | null;
|
|
17
21
|
dataB64: string;
|
|
18
22
|
}[];
|
|
23
|
+
skills?: {
|
|
24
|
+
slug: string;
|
|
25
|
+
name: string;
|
|
26
|
+
description?: string | null;
|
|
27
|
+
content: string;
|
|
28
|
+
}[];
|
|
29
|
+
contextPack?: unknown;
|
|
30
|
+
mcpConfig?: unknown;
|
|
19
31
|
};
|
|
20
32
|
export type RunnerEvent = 'cloning' | 'fixing' | 'pushing' | 'pr_opened' | 'heartbeat' | 'log';
|
|
21
|
-
export type
|
|
33
|
+
export type SecretScanReport = {
|
|
34
|
+
scanned: true;
|
|
35
|
+
hits: Array<{
|
|
36
|
+
path: string;
|
|
37
|
+
kind: string;
|
|
38
|
+
line: number;
|
|
39
|
+
}>;
|
|
40
|
+
head?: string;
|
|
41
|
+
};
|
|
42
|
+
export type ResultPayload = ({
|
|
22
43
|
status: 'pr_opened';
|
|
23
44
|
pr: {
|
|
24
45
|
repo?: string;
|
|
@@ -30,9 +51,12 @@ export type ResultPayload = {
|
|
|
30
51
|
} | {
|
|
31
52
|
status: 'no_pr';
|
|
32
53
|
error?: string;
|
|
54
|
+
summary?: string;
|
|
33
55
|
} | {
|
|
34
56
|
status: 'failed';
|
|
35
57
|
error: string;
|
|
58
|
+
}) & {
|
|
59
|
+
secretScan?: SecretScanReport;
|
|
36
60
|
};
|
|
37
61
|
export declare class RunnerApi {
|
|
38
62
|
private readonly apiUrl;
|
|
@@ -54,8 +78,17 @@ export declare class RunnerApi {
|
|
|
54
78
|
resetsAt: string | null;
|
|
55
79
|
}>;
|
|
56
80
|
}>;
|
|
81
|
+
mcpLogins?: Array<{
|
|
82
|
+
server: string;
|
|
83
|
+
state: 'logged_in' | 'expired' | 'error';
|
|
84
|
+
via: 'runner' | 'claude_code';
|
|
85
|
+
accountLabel: string | null;
|
|
86
|
+
expiresAt: string | null;
|
|
87
|
+
detail?: string;
|
|
88
|
+
}>;
|
|
57
89
|
}): Promise<ClaimedJob | null>;
|
|
58
90
|
repos(): Promise<string[]>;
|
|
91
|
+
probe(): Promise<boolean>;
|
|
59
92
|
config(): Promise<{
|
|
60
93
|
maxParallel: number;
|
|
61
94
|
} | null>;
|
|
@@ -64,6 +97,17 @@ export declare class RunnerApi {
|
|
|
64
97
|
expiresAt: string;
|
|
65
98
|
repo: string;
|
|
66
99
|
} | null>;
|
|
100
|
+
mcpCredential(runId: string, server: string): Promise<{
|
|
101
|
+
token: string;
|
|
102
|
+
expiresAt?: string;
|
|
103
|
+
} | null>;
|
|
67
104
|
event(runId: string, event: RunnerEvent, detail?: Record<string, unknown>): Promise<void>;
|
|
105
|
+
activity(runId: string, steps: Array<{
|
|
106
|
+
seq: number;
|
|
107
|
+
at: string;
|
|
108
|
+
kind: string;
|
|
109
|
+
label: string;
|
|
110
|
+
detail?: Record<string, unknown>;
|
|
111
|
+
}>): Promise<void>;
|
|
68
112
|
result(runId: string, payload: ResultPayload): Promise<void>;
|
|
69
113
|
}
|