@rfany/rf 0.20.8 → 0.21.1
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 +62 -30
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rfany/rf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.1",
|
|
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,27 +373,28 @@ 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
|
|
|
384
386
|
async function find(path ) {
|
|
385
387
|
const [w, s, l, more] = path.replace(/\/+$/, '').split('/');
|
|
386
|
-
const
|
|
388
|
+
const ws = s !== undefined && more === undefined ? (await get('/api')).find(x => x.name === w) : undefined;
|
|
389
|
+
const series = ws?.series.find(x => x.name === s);
|
|
387
390
|
const inst = l === undefined ? undefined : series?.instances.find(i => i.label === l);
|
|
388
391
|
if (!series || (l !== undefined && !inst)) throw new Error(`nothing you can see at ${path}`);
|
|
389
|
-
return { series, inst, at: inst ? `/api/instances/${inst.id}` : '' };
|
|
392
|
+
return { ws, series, inst, at: inst ? `/api/instances/${inst.id}` : '' };
|
|
390
393
|
}
|
|
391
394
|
async function instanceAt(path ) {
|
|
392
|
-
const { series, inst, at } = await find(path);
|
|
395
|
+
const { ws, series, inst, at } = await find(path);
|
|
393
396
|
if (!inst) throw new Error(`${path} is a series: name one of its instances, as rf ls lists them`);
|
|
394
|
-
return { series, inst, at };
|
|
397
|
+
return { ws, series, inst, at };
|
|
395
398
|
}
|
|
396
399
|
async function seriesAt(path ) {
|
|
397
400
|
const { series, inst } = await find(path);
|
|
@@ -405,6 +408,7 @@ async function workspaceNamed(name ) {
|
|
|
405
408
|
}
|
|
406
409
|
// An instance's path as rf ls prints it, by its id.
|
|
407
410
|
const pathOf = async (id ) => (await get('/api')).flatMap(w => w.series.flatMap(s => s.instances.filter(i => i.id === id).map(i => `${w.name}/${s.name}/${i.label}`)))[0];
|
|
411
|
+
const shQuote = (s ) => `'${s.replace(/'/g, `'\\''`)}'`;
|
|
408
412
|
// Explicit series-wide offer selection.
|
|
409
413
|
const ticks = () => flags.clear ? [] : String(flags.creds ?? flags.set ?? '').split(',').map(o => o.trim()).filter(Boolean);
|
|
410
414
|
const consent = (offers ) => `, series credentials: ${offers.join(', ') || 'no credentials'}; you explicitly consent to agents acting as you`;
|
|
@@ -684,7 +688,7 @@ if (cmd === 'login' && url) {
|
|
|
684
688
|
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
689
|
text: `run ${r.run}'s browser on ${r.login}'s ${r.site} was refused ${meta ? `${r.host} (${meta})` : r.host}` };
|
|
686
690
|
}),
|
|
687
|
-
...all.filter(w => !w.archived).flatMap(w => w.series.filter(x => !x.archived).flatMap(x => x.instances.filter(i => i.
|
|
691
|
+
...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
692
|
...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
693
|
];
|
|
690
694
|
if (flags.json) console.log(JSON.stringify(rows, null, 1));
|
|
@@ -692,15 +696,27 @@ if (cmd === 'login' && url) {
|
|
|
692
696
|
? `note ${r.kind} ${r.path}#${r.id} by ${r.by} at ${when(r.at)}: ${gist(r.text, 120)}`
|
|
693
697
|
: `${r.kind} ${r.path ?? r.login}${r.since ? ` since ${when(r.since)}` : ''}${r.id ? `, ${r.kind === 'grant' ? 'grant' : 'request'} ${r.id}` : ''}: ${r.kind === 'grant' ? r.text : r.text.split('\n')[0].slice(0, 120)}`).join('\n') || 'Nothing waits on you.');
|
|
694
698
|
} else if (cmd === 'show' && args.length === 1) {
|
|
695
|
-
const { inst, at } = await instanceAt(args[0]), { doc, log, run, queued, owner, waiting: w } = await get(at);
|
|
699
|
+
const { ws, series, inst, at } = await instanceAt(args[0]), { doc, log, run, queued, owner, waiting: w } = await get(at);
|
|
696
700
|
const waiting = w.map(({ who, seq }) => {
|
|
697
701
|
const e = log[seq - 1], first = log.find(x => `c${x.seq}` === e.thread);
|
|
698
702
|
return { comment: `c${seq}`, thread: e.thread, kind: e.ask === true ? 'ask' : e.ask ?? 'note', for: who, by: e.by, item: first.item, ref: first.ref, text: e.text };
|
|
699
703
|
});
|
|
700
704
|
const done = log.findLast(e => e.op === 'done'), last = done ? { run: done.run, cost: done.cost, ...(done.estimated && { estimated: true }), error: done.error ?? null } : null;
|
|
701
|
-
|
|
705
|
+
const seriesPath = args[0].replace(/\/+$/, '').split('/').slice(0, 2).join('/');
|
|
706
|
+
if (flags.json) console.log(JSON.stringify({ path: args[0], id: inst.id, status: doc.status, owner: owner.by, consent: !!owner.consent, running: run, queued, items: doc.items, waiting, last_run: last, ...(doc.status === 'deleted' && { deleted: { by: log[0].by, at: log[0].at } }) }, null, 1));
|
|
702
707
|
else {
|
|
703
|
-
|
|
708
|
+
let noConsent = '';
|
|
709
|
+
if (doc.status === 'open' && !ws?.archived && !series.archived && !owner.consent) {
|
|
710
|
+
if (!owner.by) noConsent = ', no series owner';
|
|
711
|
+
else {
|
|
712
|
+
const me = await get('/me');
|
|
713
|
+
noConsent = me.email === owner.by
|
|
714
|
+
? `, no execution consent (run: rf series credentials ${shQuote(seriesPath)})`
|
|
715
|
+
: `, no execution consent (${owner.by} must select series credentials)`;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
const ownerLabel = owner.by ? `series owner ${owner.by}` : 'no series owner';
|
|
719
|
+
console.log(doc.status === 'deleted' ? `${args[0]} deleted by ${log[0].by} ${when(log[0].at)}` : `${args[0]} ${doc.status}, ${ownerLabel}${owner.by ? noConsent : ''}${run ? `, run ${run.n} going, ${usdNote(run.cost, run.estimated)}` : queued ? ', queued' : ''}`);
|
|
704
720
|
for (const i of doc.items) console.log(` ${i.kind.padEnd(6)} ${i.id} ${i.name} ${i.file ?? 'no file yet'}${i.from?.length ? ` from ${i.from.join(', ')}` : ''}${i.headline ? ` ${i.headline}` : ''}`);
|
|
705
721
|
for (const w of waiting) console.log(`${w.comment} ${w.kind} for ${w.for}${w.comment === w.thread ? '' : ` in ${w.thread}`}${w.item ? `, on ${w.item}${w.ref ? ` at ${w.ref}` : ''}` : ''}: ${w.text.split('\n')[0].slice(0, 160)}`);
|
|
706
722
|
if (last) console.log(`last run ${last.run} ${usdNote(last.cost ?? 0, last.estimated)}${last.error ? ` ${last.error}` : ''}`);
|
|
@@ -765,7 +781,17 @@ else if (cmd === 'comment' && args.length < 2) {
|
|
|
765
781
|
if (!inst) console.log(`noted ${(await posted.json()).id} on ${path}: it starts no run, and its runs read it`);
|
|
766
782
|
else {
|
|
767
783
|
const seq = Number(posted.headers.get('X-RF-Comment-Seq')), { doc, log, owner, starts, standing } = await get(at), note = log.find(e => e.seq === seq)?.note;
|
|
768
|
-
if (!starts && standing?.[seq] !== 'answer')
|
|
784
|
+
if (!starts && standing?.[seq] !== 'answer') {
|
|
785
|
+
if (!owner.consent) {
|
|
786
|
+
if (!owner.by) console.log(`kept as a note, seq ${seq}: no run starts because this series has no owner`);
|
|
787
|
+
else {
|
|
788
|
+
const [me, livePath] = await Promise.all([get('/me'), pathOf(inst.id)]);
|
|
789
|
+
const seriesPath = (livePath ?? path).replace(/\/+$/, '').split('/').slice(0, 2).join('/');
|
|
790
|
+
if (me.email === owner.by) console.log(`kept as a note, seq ${seq}: no run starts because you have no execution consent on this series (run: rf series credentials ${shQuote(seriesPath)})`);
|
|
791
|
+
else console.log(`recorded for the series owner, ${owner.by}, seq ${seq}: no run starts until ${owner.by} selects series credentials`);
|
|
792
|
+
}
|
|
793
|
+
} else console.log(`recorded for the series owner, ${owner.by}, seq ${seq}: no run starts`);
|
|
794
|
+
}
|
|
769
795
|
else if (!wait) console.log(`${note ? `a note for the series owner, ${owner.by}` : 'commented'}, seq ${seq}`);
|
|
770
796
|
else if (doc.status !== 'open') console.log(`The instance was ${doc.status}.`);
|
|
771
797
|
else for (;;) {
|
|
@@ -808,11 +834,11 @@ else if (cmd === 'comment' && args.length < 2) {
|
|
|
808
834
|
const { inst } = await instanceAt(args[0]);
|
|
809
835
|
await post('/api/messages', { instance: inst.id, id: args[1], how: cmd, text: args[2], quiet: !flags.wake });
|
|
810
836
|
console.log(`${cmd === 'approve' ? 'approved' : 'rejected'} ${args[1]}`);
|
|
811
|
-
} else if (['close', '
|
|
837
|
+
} else if (['close', 'interrupt'].includes(cmd) && args.length === 1) {
|
|
812
838
|
const { series, at } = await instanceAt(args[0]);
|
|
813
839
|
await post(`${at}/${cmd}`, { quiet: !flags.wake });
|
|
814
840
|
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' :
|
|
841
|
+
console.log(`${cmd === 'close' ? 'closed' : 'interrupted'} ${args[0]}`);
|
|
816
842
|
} else if (cmd === 'delete' && args.length === 1) {
|
|
817
843
|
// One confirm, which says it can't be undone and what stays outside the server.
|
|
818
844
|
const { at } = await instanceAt(args[0]);
|
|
@@ -984,10 +1010,12 @@ else if (cmd === 'comment' && args.length < 2) {
|
|
|
984
1010
|
} else if (cmd === 'logins' && args[0] === 'signout' && args.length === 2) {
|
|
985
1011
|
await api(`/logins/${encodeURIComponent(args[1])}`, { method: 'DELETE' });
|
|
986
1012
|
console.log(`signed out of ${args[1]}`);
|
|
987
|
-
} else if (cmd === '
|
|
1013
|
+
} else if (cmd === 'outcome' && args.length >= 2) {
|
|
1014
|
+
const text = args.slice(1).join(' ');
|
|
1015
|
+
if (!text.trim()) throw new Error('an outcome needs text');
|
|
988
1016
|
const { series, at } = await instanceAt(args[0]), see = flags.see === undefined ? undefined : series.instances.find(i => i.label === flags.see);
|
|
989
1017
|
if (flags.see !== undefined && !see) throw new Error(`no instance ${flags.see} in its series`);
|
|
990
|
-
console.log(await (await post(`${at}/
|
|
1018
|
+
console.log(await (await post(`${at}/outcome`, { text, item: flags.item, ref: flags.ref, see: see?.id })).text());
|
|
991
1019
|
} else if (cmd === 'upload' && args.length === 2) {
|
|
992
1020
|
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
1021
|
await api(`${(await instanceAt(args[0])).at}/upload?${q}`, { method: 'POST', body: readFileSync(args[1]) });
|
|
@@ -1219,7 +1247,11 @@ else if (cmd === 'kill' && args.length === 1 && /^\d+$/.test(args[0])) {
|
|
|
1219
1247
|
else for (const b of blocks) {
|
|
1220
1248
|
console.log(b.path);
|
|
1221
1249
|
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)}`
|
|
1250
|
+
: `${e.by} ${e.op === 'comment' ? `says: ${e.text.split('\n')[0].slice(0, 200)}`
|
|
1251
|
+
: e.op === 'upload' ? `uploads ${e.file}`
|
|
1252
|
+
: e.op === 'outcome' ? `records outcome: ${String(e.text ?? '').split('\n')[0].slice(0, 200)}`
|
|
1253
|
+
: e.op === 'correction' ? `marks ${e.kind ?? 'outcome'}: ${String(e.text ?? '').split('\n')[0].slice(0, 200)}`
|
|
1254
|
+
: `${{ close: 'closes', abandon: 'abandons', delete: 'deletes' }[e.op] ?? e.op} it`}`}`);
|
|
1223
1255
|
}
|
|
1224
1256
|
} else if (cmd === 'egress' && (!args.length || (args.length === 2 && ['add', 'remove'].includes(args[0])))) {
|
|
1225
1257
|
let hosts = await (await api('/egress')).json();
|