@firefunc-agent/runner 0.9.7 → 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.
Files changed (178) hide show
  1. package/README.md +169 -10
  2. package/dist/activity.d.ts +1 -0
  3. package/dist/activity.js +1 -1
  4. package/dist/alive.d.ts +40 -0
  5. package/dist/alive.js +138 -0
  6. package/dist/api-fallback.d.ts +11 -0
  7. package/dist/api-fallback.js +80 -0
  8. package/dist/api.d.ts +186 -3
  9. package/dist/api.js +311 -6
  10. package/dist/ask/index.d.ts +20 -0
  11. package/dist/ask/index.js +64 -0
  12. package/dist/ask-first.d.ts +8 -0
  13. package/dist/brief-file.d.ts +15 -0
  14. package/dist/brief-file.js +36 -0
  15. package/dist/brief.d.ts +5 -0
  16. package/dist/brief.js +19 -3
  17. package/dist/build-caches.d.ts +7 -0
  18. package/dist/build-caches.js +63 -0
  19. package/dist/build-info.json +2 -2
  20. package/dist/checkpoint.d.ts +40 -0
  21. package/dist/checkpoint.js +98 -0
  22. package/dist/cli.js +184 -18
  23. package/dist/cloud-boot.d.ts +41 -0
  24. package/dist/cloud-boot.js +239 -0
  25. package/dist/command-activity.d.ts +23 -0
  26. package/dist/command-activity.js +89 -0
  27. package/dist/command-step.d.ts +58 -0
  28. package/dist/command-step.js +248 -0
  29. package/dist/config.d.ts +40 -0
  30. package/dist/config.js +23 -0
  31. package/dist/cut.d.ts +2 -1
  32. package/dist/cut.js +19 -5
  33. package/dist/daemon.js +375 -14
  34. package/dist/device-lease.d.ts +15 -0
  35. package/dist/device-lease.js +608 -0
  36. package/dist/editor/fs-server.d.ts +31 -0
  37. package/dist/editor/fs-server.js +159 -0
  38. package/dist/editor/relay-crypto.d.ts +68 -0
  39. package/dist/editor/relay-crypto.js +191 -0
  40. package/dist/editor/sessions.d.ts +50 -0
  41. package/dist/editor/sessions.js +279 -0
  42. package/dist/editor/worktree-of.d.ts +1 -0
  43. package/dist/editor/worktree-of.js +23 -0
  44. package/dist/editor/ws-client.d.ts +26 -0
  45. package/dist/editor/ws-client.js +227 -0
  46. package/dist/engine-account.d.ts +24 -0
  47. package/dist/engine-account.js +118 -0
  48. package/dist/engine-login.d.ts +12 -0
  49. package/dist/engine-login.js +88 -0
  50. package/dist/engine-models.d.ts +13 -0
  51. package/dist/engine-models.js +71 -0
  52. package/dist/engine-watch.d.ts +1 -0
  53. package/dist/engine-watch.js +22 -6
  54. package/dist/engines/antigravity.js +19 -4
  55. package/dist/engines/claude.js +15 -8
  56. package/dist/engines/codex.js +16 -2
  57. package/dist/engines/copilot.js +12 -0
  58. package/dist/engines/crush.d.ts +2 -0
  59. package/dist/engines/crush.js +58 -0
  60. package/dist/engines/cursor.js +12 -0
  61. package/dist/engines/gemini.js +14 -9
  62. package/dist/engines/index.d.ts +8 -0
  63. package/dist/engines/index.js +73 -1
  64. package/dist/engines/kilo.d.ts +2 -0
  65. package/dist/engines/kilo.js +63 -0
  66. package/dist/engines/opencode.d.ts +9 -0
  67. package/dist/engines/opencode.js +234 -0
  68. package/dist/engines/openhands.d.ts +10 -0
  69. package/dist/engines/openhands.js +271 -0
  70. package/dist/engines/pi.d.ts +10 -0
  71. package/dist/engines/pi.js +248 -0
  72. package/dist/engines/qwen.d.ts +8 -0
  73. package/dist/engines/qwen.js +153 -0
  74. package/dist/engines/sessions.d.ts +6 -0
  75. package/dist/engines/sessions.js +68 -0
  76. package/dist/engines/types.d.ts +3 -3
  77. package/dist/exec.d.ts +1 -0
  78. package/dist/exec.js +10 -4
  79. package/dist/firefunc/agents.d.ts +8 -1
  80. package/dist/firefunc/agents.js +53 -3
  81. package/dist/firefunc/auth.js +72 -19
  82. package/dist/firefunc/cli.js +25 -0
  83. package/dist/firefunc/client.d.ts +5 -1
  84. package/dist/firefunc/client.js +12 -2
  85. package/dist/firefunc/config.d.ts +11 -1
  86. package/dist/firefunc/config.js +6 -4
  87. package/dist/firefunc/io.d.ts +1 -0
  88. package/dist/firefunc/main.js +8 -1
  89. package/dist/firefunc/oauth-login.d.ts +23 -0
  90. package/dist/firefunc/oauth-login.js +304 -0
  91. package/dist/firefunc/tasks.d.ts +4 -0
  92. package/dist/firefunc/tasks.js +89 -2
  93. package/dist/fleet-words.d.ts +2 -0
  94. package/dist/fleet-words.js +7 -0
  95. package/dist/git-auth.d.ts +16 -0
  96. package/dist/git-auth.js +48 -2
  97. package/dist/held.d.ts +3 -0
  98. package/dist/job.d.ts +26 -3
  99. package/dist/job.js +1109 -132
  100. package/dist/keep-awake.d.ts +17 -0
  101. package/dist/keep-awake.js +90 -0
  102. package/dist/keep-local.d.ts +2 -1
  103. package/dist/keep-local.js +8 -3
  104. package/dist/limit.d.ts +10 -1
  105. package/dist/limit.js +264 -4
  106. package/dist/local-checks.d.ts +19 -0
  107. package/dist/local-checks.js +79 -0
  108. package/dist/locks.d.ts +21 -1
  109. package/dist/locks.js +279 -66
  110. package/dist/machine-commands.d.ts +21 -0
  111. package/dist/machine-commands.js +107 -0
  112. package/dist/machine-profile.d.ts +18 -0
  113. package/dist/machine-profile.js +69 -0
  114. package/dist/mcp-init.d.ts +2 -0
  115. package/dist/mcp-init.js +28 -0
  116. package/dist/mcp.d.ts +13 -1
  117. package/dist/mcp.js +23 -2
  118. package/dist/network.js +3 -2
  119. package/dist/orphans.d.ts +4 -0
  120. package/dist/orphans.js +96 -4
  121. package/dist/plan-phase/index.d.ts +11 -0
  122. package/dist/plan-phase/index.js +46 -0
  123. package/dist/pool.d.ts +1 -0
  124. package/dist/pool.js +29 -4
  125. package/dist/pr-title.d.ts +15 -0
  126. package/dist/pr-title.js +33 -0
  127. package/dist/recover.d.ts +3 -1
  128. package/dist/recover.js +27 -7
  129. package/dist/reference-files.d.ts +27 -0
  130. package/dist/reference-files.js +202 -0
  131. package/dist/release-draft.d.ts +79 -0
  132. package/dist/release-draft.js +301 -0
  133. package/dist/resources.d.ts +86 -0
  134. package/dist/resources.js +217 -0
  135. package/dist/restart-idle.d.ts +23 -0
  136. package/dist/restart-idle.js +67 -0
  137. package/dist/run-attachments.d.ts +84 -0
  138. package/dist/run-attachments.js +281 -0
  139. package/dist/run-stops.d.ts +15 -0
  140. package/dist/run-stops.js +90 -0
  141. package/dist/run-temp.d.ts +12 -0
  142. package/dist/run-temp.js +57 -0
  143. package/dist/secret-scan.d.ts +6 -1
  144. package/dist/secret-scan.js +33 -0
  145. package/dist/secret-values.d.ts +17 -0
  146. package/dist/secret-values.js +81 -0
  147. package/dist/self-upgrade.d.ts +36 -0
  148. package/dist/self-upgrade.js +78 -0
  149. package/dist/service.d.ts +7 -1
  150. package/dist/service.js +50 -7
  151. package/dist/sign-in.d.ts +41 -0
  152. package/dist/sign-in.js +239 -0
  153. package/dist/tool-call.d.ts +59 -0
  154. package/dist/tool-call.js +375 -0
  155. package/dist/trail/chain.d.ts +12 -0
  156. package/dist/trail/chain.js +89 -0
  157. package/dist/trail/deltas.d.ts +34 -0
  158. package/dist/trail/deltas.js +206 -0
  159. package/dist/trail/index.d.ts +27 -0
  160. package/dist/trail/index.js +128 -0
  161. package/dist/trail/keys.d.ts +14 -0
  162. package/dist/trail/keys.js +61 -0
  163. package/dist/trail/recorder.d.ts +118 -0
  164. package/dist/trail/recorder.js +697 -0
  165. package/dist/trail/rules.d.ts +30 -0
  166. package/dist/trail/rules.js +158 -0
  167. package/dist/trail/stream.d.ts +41 -0
  168. package/dist/trail/stream.js +86 -0
  169. package/dist/transport.d.ts +26 -0
  170. package/dist/transport.js +118 -0
  171. package/dist/work-dir.d.ts +11 -0
  172. package/dist/work-dir.js +69 -0
  173. package/dist/worktree-report.d.ts +10 -0
  174. package/dist/worktree-report.js +17 -0
  175. package/dist/worktrees.d.ts +16 -1
  176. package/dist/worktrees.js +62 -17
  177. package/package.json +4 -4
  178. package/skill/firefunc/SKILL.md +4 -3
package/dist/worktrees.js CHANGED
@@ -1,27 +1,41 @@
1
1
  import { rmSync } from 'node:fs';
2
2
  import { tmpdir } from 'node:os';
3
- import { basename, dirname } from 'node:path';
3
+ import { workRoots } from './work-dir.js';
4
+ import { basename } from 'node:path';
4
5
  import { exec } from './exec.js';
5
- import { killOrphans, reviewCopiesOf } from './orphans.js';
6
+ import { isAlive, killOrphans, reviewCopiesOf } from './orphans.js';
7
+ import { listHeld } from './held.js';
8
+ import { listKept } from './ask-first.js';
6
9
  const RUNNER_WORKTREE_NAME = /^firefunc-[A-Za-z0-9]{6}$/;
7
- function tempRoots() {
8
- const t = tmpdir().replace(/\/+$/, '');
9
- const out = new Set([t]);
10
- if (t.startsWith('/private/'))
11
- out.add(t.slice('/private'.length));
12
- else if (t.startsWith('/var/'))
13
- out.add(`/private${t}`);
14
- out.add('/tmp');
15
- out.add('/private/tmp');
16
- return out;
17
- }
18
10
  export function canonicalPath(path) {
19
- const clean = path.replace(/\/+$/, '');
11
+ return canonicalPathOn(path, process.platform);
12
+ }
13
+ export function canonicalPathOn(path, platform) {
14
+ let clean = path;
15
+ if (platform === 'win32')
16
+ clean = clean.replace(/\\/g, '/').toLowerCase();
17
+ clean = clean.replace(/\/+$/, '');
20
18
  return /^\/private\/(?:var|tmp)(?:\/|$)/.test(clean) ? clean.slice('/private'.length) : clean;
21
19
  }
22
- export function isRunnerWorktree(path) {
23
- const clean = path.replace(/\/+$/, '');
24
- return RUNNER_WORKTREE_NAME.test(basename(clean)) && tempRoots().has(dirname(clean));
20
+ function tempRoots(platform, tmp, extra) {
21
+ return new Set([
22
+ canonicalPathOn(tmp, platform),
23
+ '/tmp',
24
+ ...extra.map((d) => canonicalPathOn(d, platform)),
25
+ ]);
26
+ }
27
+ export function isRunnerWorktree(path, opts = {}) {
28
+ const platform = opts.platform ?? process.platform;
29
+ const clean = canonicalPathOn(path, platform);
30
+ const cut = clean.lastIndexOf('/');
31
+ if (cut < 0)
32
+ return false;
33
+ const name = path
34
+ .replace(/[\\/]+$/, '')
35
+ .split(/[\\/]/)
36
+ .pop() ?? '';
37
+ return (RUNNER_WORKTREE_NAME.test(name) &&
38
+ tempRoots(platform, opts.tmp ?? tmpdir(), opts.roots ?? workRoots()).has(clean.slice(0, cut)));
25
39
  }
26
40
  export async function worktreesOf(checkout) {
27
41
  const r = await exec('git', ['-C', checkout, 'worktree', 'list', '--porcelain'], {
@@ -50,6 +64,37 @@ export function staleHolder(stderr) {
50
64
  const path = m?.[1];
51
65
  return path && isRunnerWorktree(path) ? path : null;
52
66
  }
67
+ export function branchHolderOf(runnerDir, worktree) {
68
+ const path = canonicalPath(worktree);
69
+ for (const r of listHeld(runnerDir)) {
70
+ if (!isAlive(r.pid))
71
+ continue;
72
+ const mine = [r.worktree, ...(r.scratch ?? [])].some((p) => p && canonicalPath(p) === path);
73
+ if (mine)
74
+ return { kind: 'live', runId: r.runId };
75
+ }
76
+ for (const k of listKept(runnerDir)) {
77
+ if (canonicalPath(k.worktree) === path) {
78
+ return { kind: 'kept', runId: k.runId, parked: !!k.park };
79
+ }
80
+ }
81
+ return null;
82
+ }
83
+ export function branchHeldSentence(branch, holder) {
84
+ return `git worktree add failed: ${heldWords(branch, holder)}`;
85
+ }
86
+ function heldWords(branch, holder) {
87
+ const which = holder.runId ? ` (run ${holder.runId.slice(0, 8)})` : '';
88
+ if (holder.kind === 'live') {
89
+ return (`another run on this machine${which} is still working on ${branch}, so this attempt could not start beside it. Nothing was changed. ` +
90
+ 'Fix: wait for that run to finish, or stop it on its task page, then Re-run this task.');
91
+ }
92
+ return holder.parked
93
+ ? `${branch} is held on this machine by a run waiting for a person's answer${which}, so this attempt could not start. Nothing was changed. ` +
94
+ 'Fix: answer or stop that run on its task page, then Re-run this task.'
95
+ : `${branch} is held on this machine by a change kept for a person's approval${which}, so this attempt could not start. Nothing was changed. ` +
96
+ 'Fix: approve, reject or ask for changes on that task, then Re-run this task.';
97
+ }
53
98
  export async function removeRunnerWorktree(checkout, path, log) {
54
99
  const copies = reviewCopiesOf(path);
55
100
  await killOrphans({ roots: [path, ...copies], reviewCopiesOf: basename(path) }, { log }).catch(() => { });
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@firefunc-agent/runner",
3
- "version": "0.9.7",
3
+ "version": "0.9.34",
4
4
  "private": false,
5
5
  "type": "module",
6
- "description": "FireFunc self-hosted runner — an always-on daemon that runs YOUR local coding agent (Claude Code, Codex, Gemini CLI, Cursor CLI) on work FireFunc routes to it, opens pull requests, and reports back. Your machine, your subscriptions.",
6
+ "description": "FireFunc self-hosted runner — an always-on daemon that runs YOUR local coding agent (Claude Code, Codex, Gemini CLI, Cursor CLI, Copilot CLI, Antigravity) on work FireFunc routes to it, opens pull requests, and reports back. Your machine, your subscriptions.",
7
7
  "keywords": [
8
8
  "firefunc",
9
9
  "runner",
@@ -17,8 +17,8 @@
17
17
  ],
18
18
  "license": "SEE LICENSE IN LICENSE",
19
19
  "bin": {
20
- "firefunc-runner": "./dist/cli.js",
21
- "firefunc": "./dist/firefunc/cli.js"
20
+ "firefunc-runner": "dist/cli.js",
21
+ "firefunc": "dist/firefunc/cli.js"
22
22
  },
23
23
  "files": [
24
24
  "dist",
@@ -23,9 +23,10 @@ with a composer link; the person opens it, reviews the agent and activates it.
23
23
  in 0.9.1; if npm still installs an older one, those are not on npm yet.
24
24
  Tell the person that, rather than retrying.
25
25
  2. Check the sign-in: `firefunc whoami --json`.
26
- - `not_signed_in`: ask the person to make a key in FireFunc → Settings → API keys
27
- and to run `firefunc login` **in their own terminal** (it asks for the key
28
- without showing it).
26
+ - `not_signed_in`: ask the person to run `firefunc login` **in their own
27
+ terminal**. It opens FireFunc in their browser, where they pick the workspace
28
+ and press Allow (runner 0.9.26; on an older one it asks for a workspace key
29
+ from Settings → API keys, without showing it).
29
30
  3. Read the `scopes` in that answer. `agents:read` lets you look,
30
31
  `agents:write` lets you create and edit drafts, `tasks:write` starts tasks,
31
32
  `tasks:read` reads them, `agents:activate` lets the key activate an agent,