@firefunc-agent/runner 0.9.3 → 0.9.4
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 +1 -1
- package/dist/build-info.json +2 -2
- package/dist/firefunc/output.d.ts +1 -0
- package/dist/firefunc/output.js +20 -0
- package/dist/firefunc/tasks.js +32 -4
- package/package.json +1 -1
- package/skill/firefunc/SKILL.md +6 -0
package/README.md
CHANGED
|
@@ -376,7 +376,7 @@ installs the curated skills that template names, as launching it from the galler
|
|
|
376
376
|
| `firefunc agents pause \| resume <agent>` | `agents:write` | Stop or restart an agent taking work |
|
|
377
377
|
| `firefunc agents activate <agent>` | `agents:activate` | Switch a draft on |
|
|
378
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`
|
|
379
|
+
| `firefunc tasks list \| get <id> \| watch <id> \| states` | `tasks:read` | Follow tasks; `get` and `watch` print the agent's answer (0.9.4) |
|
|
380
380
|
| `firefunc skills directory` | `agents:read` | The curated skills, and which are installed here |
|
|
381
381
|
| `firefunc skills install <slug>` | `workspace:configure` | Install a directory skill so agents may carry it |
|
|
382
382
|
| `firefunc skills create --file SKILL.md` / `update <slug> --file …` | `workspace:configure` | Write or change a skill of the workspace's own |
|
package/dist/build-info.json
CHANGED
|
@@ -3,6 +3,7 @@ export declare function quietWhenReaderLeaves(stdout: NodeJS.EventEmitter, stder
|
|
|
3
3
|
export declare function printJson(io: Io, value: unknown): void;
|
|
4
4
|
export declare const dash = "\u2014";
|
|
5
5
|
export declare function text(v: unknown): string;
|
|
6
|
+
export declare function wrap(paragraph: string, width: number, first?: string, rest?: string): string[];
|
|
6
7
|
export type Column<T> = {
|
|
7
8
|
head: string;
|
|
8
9
|
get: (row: T) => unknown;
|
package/dist/firefunc/output.js
CHANGED
|
@@ -31,6 +31,26 @@ export function text(v) {
|
|
|
31
31
|
return v.length ? v.map(text).join(', ') : dash;
|
|
32
32
|
return JSON.stringify(v);
|
|
33
33
|
}
|
|
34
|
+
export function wrap(paragraph, width, first = '', rest = first) {
|
|
35
|
+
const indent = /^\s*/.exec(paragraph)?.[0] ?? '';
|
|
36
|
+
const words = paragraph.trim().split(/\s+/).filter(Boolean);
|
|
37
|
+
const out = [];
|
|
38
|
+
let line = '';
|
|
39
|
+
let lead = first + indent;
|
|
40
|
+
for (const word of words) {
|
|
41
|
+
if (line && lead.length + line.length + 1 + word.length > width) {
|
|
42
|
+
out.push(lead + line);
|
|
43
|
+
line = word;
|
|
44
|
+
lead = rest + indent;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
line = line ? `${line} ${word}` : word;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (line || !out.length)
|
|
51
|
+
out.push(lead + line);
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
34
54
|
function clip(s, max) {
|
|
35
55
|
const one = s.replace(/\s+/g, ' ').trim();
|
|
36
56
|
return one.length > max ? `${one.slice(0, max - 1)}…` : one;
|
package/dist/firefunc/tasks.js
CHANGED
|
@@ -3,7 +3,7 @@ import { pick, listIn } from './catalog.js';
|
|
|
3
3
|
import { ApiRefusal, ApiUnreachable } from './client.js';
|
|
4
4
|
import { enc, readInputFile } from './command.js';
|
|
5
5
|
import { Refusal } from './io.js';
|
|
6
|
-
import { printJson, table, text } from './output.js';
|
|
6
|
+
import { printJson, table, text, wrap } from './output.js';
|
|
7
7
|
const TASK_TYPES = ['task', 'feature', 'refactor', 'chore', 'bug'];
|
|
8
8
|
const STOPS_FOR_A_PERSON = [
|
|
9
9
|
'resolved',
|
|
@@ -34,15 +34,42 @@ function printTask(ctx, t) {
|
|
|
34
34
|
lines.push(` pull request: ${text(pr.url)} (${text(pr.state)})`);
|
|
35
35
|
if (t.externalUrl)
|
|
36
36
|
lines.push(` source: ${text(t.externalUrl)}`);
|
|
37
|
+
const verdict = verdictWord(t.verdict);
|
|
38
|
+
if (verdict)
|
|
39
|
+
lines.push(` verdict: ${verdict}`);
|
|
37
40
|
const runs = Array.isArray(t.runs) ? t.runs : [];
|
|
38
41
|
if (runs.length) {
|
|
39
42
|
lines.push(` runs: ${runs.length}`);
|
|
40
43
|
for (const r of runs.slice(0, 5)) {
|
|
41
|
-
|
|
44
|
+
const word = verdictWord(r.verdict);
|
|
45
|
+
lines.push(` ${text(r.id)} ${text(r.state)} ${text(r.engine)}${word ? ` ${word}` : ''}${r.error ? ` ${text(r.error)}` : ''}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const findings = Array.isArray(t.findings) ? t.findings : [];
|
|
49
|
+
if (findings.length) {
|
|
50
|
+
lines.push(` findings: ${findings.length}`);
|
|
51
|
+
for (const f of findings) {
|
|
52
|
+
const severity = typeof f.severity === 'string' && f.severity ? `[${f.severity}] ` : '';
|
|
53
|
+
const beyond = f.beyondTask === true ? ' (beyond the task)' : '';
|
|
54
|
+
lines.push(...wrap(`${severity}${text(f.title)}${beyond}`, 76, ' - ', ' '));
|
|
55
|
+
if (typeof f.url === 'string' && f.url)
|
|
56
|
+
lines.push(` ${f.url}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (typeof t.answer === 'string' && t.answer.trim()) {
|
|
60
|
+
lines.push('', 'Answer:');
|
|
61
|
+
for (const para of t.answer.replace(/\r\n/g, '\n').split('\n')) {
|
|
62
|
+
lines.push(...(para.trim() ? wrap(para, 78, ' ', ' ') : ['']));
|
|
42
63
|
}
|
|
43
64
|
}
|
|
44
65
|
ctx.io.stdout.write(`${lines.join('\n')}\n`);
|
|
45
66
|
}
|
|
67
|
+
function verdictWord(v) {
|
|
68
|
+
const word = v?.word;
|
|
69
|
+
if (typeof word !== 'string' || !word)
|
|
70
|
+
return null;
|
|
71
|
+
return v.blocking === true ? `${word} (blocking)` : word;
|
|
72
|
+
}
|
|
46
73
|
async function stopStates(api) {
|
|
47
74
|
const stops = new Set(STOPS_FOR_A_PERSON);
|
|
48
75
|
try {
|
|
@@ -97,7 +124,7 @@ async function watchTask(ctx, id, opts) {
|
|
|
97
124
|
io.stdout.write(`${mmss(io.now() - started)} ${state}\n`);
|
|
98
125
|
last = state;
|
|
99
126
|
}
|
|
100
|
-
if (state && (stops.has(state) || isFailure(state)))
|
|
127
|
+
if (state && (task?.settled === true || stops.has(state) || isFailure(state)))
|
|
101
128
|
break;
|
|
102
129
|
if (io.now() - started >= opts.timeoutMs) {
|
|
103
130
|
throw new Refusal(`Task ${id} is still ${state ?? 'unread'} after ${Math.round(opts.timeoutMs / 60_000)} min of watching` +
|
|
@@ -233,7 +260,7 @@ export const taskCommands = [
|
|
|
233
260
|
},
|
|
234
261
|
{
|
|
235
262
|
path: ['tasks', 'get'],
|
|
236
|
-
summary: 'One task: its state, runs and
|
|
263
|
+
summary: 'One task: its state, runs, pull requests, and what the agent answered',
|
|
237
264
|
usage: 'tasks get <task id>',
|
|
238
265
|
positional: { min: 1, max: 1 },
|
|
239
266
|
async run(ctx) {
|
|
@@ -249,6 +276,7 @@ export const taskCommands = [
|
|
|
249
276
|
usage: 'tasks watch <task id> [--interval <seconds>] [--timeout <minutes>]',
|
|
250
277
|
details: "Stops when the agent's part is over: resolved, a pull request open for review, parked\n" +
|
|
251
278
|
'for a person (needs_human, requires_human, quota_exceeded), rejected, or failed.\n' +
|
|
279
|
+
"When it stops, prints the task with the agent's answer, its verdict and its findings.\n" +
|
|
252
280
|
'Exit 0 when it stopped, 1 when it failed (the state ends in _failed) or the watch ran\n' +
|
|
253
281
|
'out of time. Network loss is waited out; a refusal ends the watch.\n' +
|
|
254
282
|
'Under --json, prints only the final { task } — nothing while it waits.',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firefunc-agent/runner",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
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.",
|
package/skill/firefunc/SKILL.md
CHANGED
|
@@ -220,3 +220,9 @@ for a longer watch, set the Bash call's timeout to 600000 and pass
|
|
|
220
220
|
`--timeout 9`. A timeout exits 1 with `watch_timeout`, and the task carries on
|
|
221
221
|
regardless: check it again later with `tasks get`. Report the state the API gave, with the pull request URL when
|
|
222
222
|
there is one. Do not describe work the task has not reached.
|
|
223
|
+
|
|
224
|
+
A task carries what the agent said and concluded: `answer` (its closing words —
|
|
225
|
+
for an agent that reads and reports, that is the work), `verdict` (`{id, word}`,
|
|
226
|
+
only for an agent that declares verdicts) and `findings` (one line each, with a
|
|
227
|
+
severity). Each is null or empty when nothing was recorded; say so rather than
|
|
228
|
+
guessing. Quote the answer as it came.
|