@rfany/rf 0.20.8 → 0.21.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/package.json +1 -1
- package/rf.mjs +30 -22
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rfany/rf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "rollforward's command line for people: what its page does, from a shell or a desktop agent, as you",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": { "type": "git", "url": "git+https://github.com/spoj/rollforward.git", "directory": "cli" },
|
package/rf.mjs
CHANGED
|
@@ -50,10 +50,9 @@ rf approve PATH cN [TEXT] [--wake] records content approval of proposal cN, no
|
|
|
50
50
|
rf reject PATH cN [TEXT] [--wake] rejects the agent's proposal cN, with feedback on missing information or changes;
|
|
51
51
|
revised work takes a new proposal
|
|
52
52
|
rf react PATH [cN] up|down|none your thumbs up or down on comment cN, or on the instance, or none; quiet, open or closed
|
|
53
|
-
rf close PATH [--as-series NAME] the series owner
|
|
53
|
+
rf close PATH [--as-series NAME] the series owner freezes it as the record and an example,
|
|
54
54
|
approving nothing; a task closes as a one-off, or as the first instance of the series NAME it
|
|
55
55
|
becomes
|
|
56
|
-
rf abandon PATH the series owner leaves it as it is, neither an example nor a starting point
|
|
57
56
|
rf delete PATH [--yes] its workspace's owners and admins delete an instance, in any status, once they confirm, or
|
|
58
57
|
with --yes: a run for it is cut, and all the server holds of it goes but its label and place,
|
|
59
58
|
shown as deleted, by whom and when; it can't be undone, and copies outside the server stay
|
|
@@ -63,7 +62,7 @@ rf series owner SERIES [EMAIL] [--json] the whole series' owner; EMAIL transfe
|
|
|
63
62
|
rf series credentials SERIES [--set OFFER,...|--clear] [--autonomous true|false] [--json]
|
|
64
63
|
credentials for every instance; only the owner saves consent, explicitly including [] with
|
|
65
64
|
--clear; saving requires --autonomous true|false; no credentials transfer (schedules pause until opted in)
|
|
66
|
-
rf rename PATH NAME an instance, a series or a workspace, by its path
|
|
65
|
+
rf rename PATH NAME an open instance, a series or a workspace, by its path
|
|
67
66
|
rf new task WORKSPACE [LABEL] [--creds OFFER,...|--clear] [--autonomous true|false] [--comment TEXT [--wake]] a one-off task, Untitled until LABEL or its
|
|
68
67
|
first comment names it; --wake starts its run on the comment; without --creds or --clear,
|
|
69
68
|
no execution consent is granted; --clear explicitly permits work with no credentials
|
|
@@ -105,8 +104,8 @@ rf site ask NAME WORKSPACE REASON to use your login to NAME in WORKSPACE's runs,
|
|
|
105
104
|
rf grants [WORKSPACE] [--json] the grants to use websites, yours and those of the workspaces you own, with their states
|
|
106
105
|
rf grant approve|deny ID [TEXT] a request to use a website in a workspace you own, with TEXT for its asker
|
|
107
106
|
rf grant revoke ID a grant pending or approved, yours or in a workspace you own; its runs' browsers close
|
|
108
|
-
rf
|
|
109
|
-
|
|
107
|
+
rf outcome PATH TEXT [--item ID] [--ref REF] [--see LABEL] records a free-text outcome on a closed instance, or its item ID
|
|
108
|
+
at REF, optionally linking LABEL, another instance of its series; it can't be withdrawn
|
|
110
109
|
rf wake PATH AT [TEXT] [--label LABEL] [--days DAYS] [--check PATH [--deadline ISO] [--max-stale MIN] [--backstop-hours H]] | rf wake --cancel ID
|
|
111
110
|
AT now, +<n>m|h|d or a date; PATH an open instance, or a series with LABEL; TEXT a short
|
|
112
111
|
message for the run; the owner's now starts under current consent without autonomous opt-in;
|
|
@@ -136,8 +135,8 @@ rf runs [PATH] [--since DATE] [--failed] [--running] [--long MIN] [-d SECONDS] [
|
|
|
136
135
|
rf costs [PATH] [--since DATE] [--by workspace|series|person|day|outcome] [--daily] [--json] totals, runs and cost per run,
|
|
137
136
|
plus server calls and OpenRouter key usage for admins; --daily lists each day by workspace,
|
|
138
137
|
person, run and server; runs leave out those that were cut, as the next run carries each on
|
|
139
|
-
rf activity [PATH] [--since DATE] [--json] per instance, what people and the agent said, what people uploaded, closed
|
|
140
|
-
deleted, and each run that failed
|
|
138
|
+
rf activity [PATH] [--since DATE] [--json] per instance, what people and the agent said, what people uploaded, closed,
|
|
139
|
+
recorded outcomes on and deleted, and each run that failed
|
|
141
140
|
rf wakes [PATH] [--json] each series' pending wakes and requests to start an instance, and when a wake of it last
|
|
142
141
|
fired, and each instance's pending wakes
|
|
143
142
|
rf people WORKSPACE [--set FILE|-] [-n] [--force] its owners and admins: its people as lines of owner|member EMAIL-OR-GROUP,
|
|
@@ -185,7 +184,7 @@ What there is
|
|
|
185
184
|
- A workspace holds series, and its people. A series is one recurring job; an instance is one period of it, labelled such as
|
|
186
185
|
2026-08-23. A task is a one-off: a series of one instance, named by its label, until someone makes it a series. PATH is workspace/series/label, as rf ls prints it; for rf pull it may go deeper, into an instance's files.
|
|
187
186
|
- An instance's screen is its items: inputs, outputs and steps, each pointing at a file, with what it's made from. Only the series
|
|
188
|
-
owner starts new instances, uploads or attaches files, posts comments, reacts
|
|
187
|
+
owner starts new instances, uploads or attaches files, posts comments, reacts or closes inside an instance. Their acts
|
|
189
188
|
and answers or decisions by whom the agent's ask named (--ask --to / --propose --to) start runs under current consent. Runs use the
|
|
190
189
|
owner's selected credentials, across every instance. Without consent, nothing runs; selecting none permits work with no
|
|
191
190
|
credentials. Scheduled and autonomous runs need a separate opt-in. Other collaborators leave notes, files and requests at the
|
|
@@ -210,7 +209,7 @@ What rf pull copies, the folders as the agent sees them
|
|
|
210
209
|
log.jsonl every event, by seq: by is a person's email, "server" or "agent"; op is upload, comment (thread, item,
|
|
211
210
|
ref, parent, text, files, ask, question or proposal, to), signoff (an approval of the proposal it names, on,
|
|
212
211
|
with its commit), reject, withdraw (the agent's, of its question or proposal on), react,
|
|
213
|
-
commit, point and item (the screen changing), run, done (its cost, or error), close, and the rest
|
|
212
|
+
commit, point and item (the screen changing), run, done (its cost, or error), close, outcome, and the rest
|
|
214
213
|
upload/ what people uploaded, their comments' attachments in upload/attachments/
|
|
215
214
|
working/ what the agent made, its scripts, and process.md, how it does this series
|
|
216
215
|
session/ each run's transcript: every message and tool call
|
|
@@ -227,7 +226,7 @@ Usual work
|
|
|
227
226
|
- What waits on me: rf waiting, then rf show PATH, which names each comment that waits by its id. Note notices are FYI.
|
|
228
227
|
- Answer a question: rf comment PATH --in cN --wait TEXT, which prints what the agent says back. Decide a proposal:
|
|
229
228
|
rf approve PATH cN [TEXT] --wake, for the agent to go ahead, or rf reject PATH cN [TEXT] --wake. Close an
|
|
230
|
-
instance once it's the record: rf close PATH.
|
|
229
|
+
instance once it's the record: rf close PATH. Record a post-close outcome: rf outcome PATH TEXT.
|
|
231
230
|
- Transfer a whole series, as its current owner or workspace manager: rf series owner SERIES EMAIL. The incoming owner
|
|
232
231
|
selects credentials with rf series credentials SERIES --set OFFER,... --autonomous false, or --clear for none.
|
|
233
232
|
Every instance may use that selection: this is not an instance setting. No self-takeover right for collaborators.
|
|
@@ -272,6 +271,8 @@ const replacement = new Map([
|
|
|
272
271
|
['ask', 'rf comment TARGET --ask TEXT'],
|
|
273
272
|
['propose', 'rf comment TARGET --propose TEXT'],
|
|
274
273
|
['withdraw', 'rf settle TARGET#cN withdrawn TEXT'],
|
|
274
|
+
['correct', 'rf outcome PATH TEXT [--item ID] [--ref REF] [--see LABEL]'],
|
|
275
|
+
['abandon', 'rf close PATH (and optionally rf outcome PATH TEXT)'],
|
|
275
276
|
]).get(cmd === 'help' ? argv[0] : cmd);
|
|
276
277
|
if (replacement) throw new Error(`use ${replacement}`);
|
|
277
278
|
|
|
@@ -287,7 +288,7 @@ if (cmd === 'comment' || cmd === 'settle') {
|
|
|
287
288
|
} else for (let i = 0; i < argv.length; i++) {
|
|
288
289
|
const flag = argv[i] === '-n' ? 'dry-run' : argv[i] === '-d' ? 'delay' : argv[i].match(/^--(.+)$/)?.[1];
|
|
289
290
|
if (!flag) args.push(argv[i]);
|
|
290
|
-
else if (['wait', 'wake', 'output', 'delete', 'dry-run', 'force', 'json', 'failed', 'running', 'clear', 'follow', '
|
|
291
|
+
else if (['wait', 'wake', 'output', 'delete', 'dry-run', 'force', 'json', 'failed', 'running', 'clear', 'follow', 'undo', 'by-amount', 'yes', 'mine', 'daily', 'all', 'az', 'dismiss-settled'].includes(flag)) flags[flag] = true;
|
|
291
292
|
else if (argv[i + 1] === undefined) throw new Error(`--${flag} takes a value`);
|
|
292
293
|
else if (flag === 'exclude') excludes.push(argv[++i]);
|
|
293
294
|
else flags[flag] = argv[++i];
|
|
@@ -297,11 +298,12 @@ if (cmd === '--version') {
|
|
|
297
298
|
console.log(JSON.parse(readFileSync(new URL(import.meta.url.endsWith('.ts') ? '../cli/package.json' : 'package.json', import.meta.url), 'utf8')).version);
|
|
298
299
|
process.exit();
|
|
299
300
|
}
|
|
300
|
-
|
|
301
|
-
|
|
301
|
+
const isHelp = !cmd || cmd === 'help' || cmd === '--help' || cmd === '-h';
|
|
302
|
+
if (isHelp && !existsSync(config)) {
|
|
303
|
+
console.log(!cmd || cmd === '--help' || cmd === '-h' ? usage() : args[0] ? usage(args[0]) : GUIDE);
|
|
302
304
|
process.exit();
|
|
303
305
|
}
|
|
304
|
-
if (cmd !== 'login' && !existsSync(config)) throw new Error('sign in first: rf login URL');
|
|
306
|
+
if (cmd !== 'login' && !isHelp && !existsSync(config)) throw new Error('sign in first: rf login URL');
|
|
305
307
|
let { url, token, auth, resource } = cmd === 'login'
|
|
306
308
|
? { url: args[0]?.replace(/\/$/, ''), token: args[1], auth: flags.az ? 'az' : (typeof flags.auth === 'string' ? flags.auth : undefined), resource: typeof flags.resource === 'string' ? flags.resource : undefined }
|
|
307
309
|
: JSON.parse(readFileSync(config, 'utf8'));
|
|
@@ -371,13 +373,13 @@ async function api(path , init = {}, accept = [])
|
|
|
371
373
|
const get = async (path ) => (await api(path)).json();
|
|
372
374
|
const post = (path , body , method = 'POST') => api(path, { method, body: JSON.stringify(body) });
|
|
373
375
|
|
|
374
|
-
if (
|
|
376
|
+
if (isHelp) {
|
|
375
377
|
const me = await get('/me'), vpn = me.can.includes('vpn'), admin = me.role === 'admin';
|
|
376
378
|
const guide = GUIDE + (vpn ? `\n\nClient VPNs
|
|
377
379
|
${usage('vpns', vpn, admin)}
|
|
378
380
|
${admin ? `${usage('vpn', vpn, admin)}\n` : ''}rf site set NAME --via VPN uses your connection to that client VPN for this website; --via '' clears it.
|
|
379
381
|
Sign in to a VPN on the page. VPN access needs an explicit grant, even for admins.` : '');
|
|
380
|
-
console.log(!cmd || args[0] ? usage(args[0], vpn, admin) : guide);
|
|
382
|
+
console.log(!cmd || cmd === '--help' || cmd === '-h' || args[0] ? usage(args[0], vpn, admin) : guide);
|
|
381
383
|
process.exit();
|
|
382
384
|
}
|
|
383
385
|
|
|
@@ -684,7 +686,7 @@ if (cmd === 'login' && url) {
|
|
|
684
686
|
return { kind: 'refused', path: r.path, since: r.at, site: r.site, host: r.host, person: r.login, why: r.why, count: r.count, ...(r.rev && { rev: r.rev }),
|
|
685
687
|
text: `run ${r.run}'s browser on ${r.login}'s ${r.site} was refused ${meta ? `${r.host} (${meta})` : r.host}` };
|
|
686
688
|
}),
|
|
687
|
-
...all.filter(w => !w.archived).flatMap(w => w.series.filter(x => !x.archived).flatMap(x => x.instances.filter(i => i.
|
|
689
|
+
...all.filter(w => !w.archived).flatMap(w => w.series.filter(x => !x.archived).flatMap(x => x.instances.filter(i => i.recentOutcomes && i.owner === me.email).map(i => ({ kind: 'outcome', path: `${w.name}/${x.name}/${i.label}`, since: i.active, count: i.recentOutcomes, text: `${i.recentOutcomes} outcome${i.recentOutcomes === 1 ? '' : 's'} recorded` })))),
|
|
688
690
|
...all.filter(w => w.manage).flatMap(w => w.grants.filter(g => g.state === 'pending').map(g => ({ kind: 'grant', path: w.name, since: g.at, id: g.id, text: grantText(g) }))),
|
|
689
691
|
];
|
|
690
692
|
if (flags.json) console.log(JSON.stringify(rows, null, 1));
|
|
@@ -808,11 +810,11 @@ else if (cmd === 'comment' && args.length < 2) {
|
|
|
808
810
|
const { inst } = await instanceAt(args[0]);
|
|
809
811
|
await post('/api/messages', { instance: inst.id, id: args[1], how: cmd, text: args[2], quiet: !flags.wake });
|
|
810
812
|
console.log(`${cmd === 'approve' ? 'approved' : 'rejected'} ${args[1]}`);
|
|
811
|
-
} else if (['close', '
|
|
813
|
+
} else if (['close', 'interrupt'].includes(cmd) && args.length === 1) {
|
|
812
814
|
const { series, at } = await instanceAt(args[0]);
|
|
813
815
|
await post(`${at}/${cmd}`, { quiet: !flags.wake });
|
|
814
816
|
if (cmd === 'close' && typeof flags['as-series'] === 'string') await post(`/api/series/${series.id}/promote`, { name: flags['as-series'] });
|
|
815
|
-
console.log(`${cmd === 'close' ? 'closed' :
|
|
817
|
+
console.log(`${cmd === 'close' ? 'closed' : 'interrupted'} ${args[0]}`);
|
|
816
818
|
} else if (cmd === 'delete' && args.length === 1) {
|
|
817
819
|
// One confirm, which says it can't be undone and what stays outside the server.
|
|
818
820
|
const { at } = await instanceAt(args[0]);
|
|
@@ -984,10 +986,12 @@ else if (cmd === 'comment' && args.length < 2) {
|
|
|
984
986
|
} else if (cmd === 'logins' && args[0] === 'signout' && args.length === 2) {
|
|
985
987
|
await api(`/logins/${encodeURIComponent(args[1])}`, { method: 'DELETE' });
|
|
986
988
|
console.log(`signed out of ${args[1]}`);
|
|
987
|
-
} else if (cmd === '
|
|
989
|
+
} else if (cmd === 'outcome' && args.length >= 2) {
|
|
990
|
+
const text = args.slice(1).join(' ');
|
|
991
|
+
if (!text.trim()) throw new Error('an outcome needs text');
|
|
988
992
|
const { series, at } = await instanceAt(args[0]), see = flags.see === undefined ? undefined : series.instances.find(i => i.label === flags.see);
|
|
989
993
|
if (flags.see !== undefined && !see) throw new Error(`no instance ${flags.see} in its series`);
|
|
990
|
-
console.log(await (await post(`${at}/
|
|
994
|
+
console.log(await (await post(`${at}/outcome`, { text, item: flags.item, ref: flags.ref, see: see?.id })).text());
|
|
991
995
|
} else if (cmd === 'upload' && args.length === 2) {
|
|
992
996
|
const q = new URLSearchParams({ name: basename(args[1]), pane: flags.output ? 'out' : 'in', ...(typeof flags.onto === 'string' && { onto: flags.onto }), ...(!flags.wake && { quiet: '1' }) });
|
|
993
997
|
await api(`${(await instanceAt(args[0])).at}/upload?${q}`, { method: 'POST', body: readFileSync(args[1]) });
|
|
@@ -1219,7 +1223,11 @@ else if (cmd === 'kill' && args.length === 1 && /^\d+$/.test(args[0])) {
|
|
|
1219
1223
|
else for (const b of blocks) {
|
|
1220
1224
|
console.log(b.path);
|
|
1221
1225
|
for (const e of b.entries) console.log(` ${when(e.at)} ${e.op === 'done' ? `run ${e.run} failed: ${e.error}`
|
|
1222
|
-
: `${e.by} ${e.op === 'comment' ? `says: ${e.text.split('\n')[0].slice(0, 200)}`
|
|
1226
|
+
: `${e.by} ${e.op === 'comment' ? `says: ${e.text.split('\n')[0].slice(0, 200)}`
|
|
1227
|
+
: e.op === 'upload' ? `uploads ${e.file}`
|
|
1228
|
+
: e.op === 'outcome' ? `records outcome: ${String(e.text ?? '').split('\n')[0].slice(0, 200)}`
|
|
1229
|
+
: e.op === 'correction' ? `marks ${e.kind ?? 'outcome'}: ${String(e.text ?? '').split('\n')[0].slice(0, 200)}`
|
|
1230
|
+
: `${{ close: 'closes', abandon: 'abandons', delete: 'deletes' }[e.op] ?? e.op} it`}`}`);
|
|
1223
1231
|
}
|
|
1224
1232
|
} else if (cmd === 'egress' && (!args.length || (args.length === 2 && ['add', 'remove'].includes(args[0])))) {
|
|
1225
1233
|
let hosts = await (await api('/egress')).json();
|