@rfany/rf 0.13.0 → 0.14.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 +17 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rfany/rf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.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
|
@@ -84,6 +84,9 @@ rf wake PATH AT [--label LABEL] [--days DAYS] | rf wake --cancel ID
|
|
|
84
84
|
AT now, +<n>m|h|d or a date; PATH an open instance, or a series with LABEL; DAYS, such as
|
|
85
85
|
mon-fri, repeats it weekly at AT's time; rf ls shows each wake's ID
|
|
86
86
|
rf agents [WORKSPACE] [--set FILE|-] the company's AGENTS.md, or a workspace's; setting the company's is for admins
|
|
87
|
+
rf readers WORKSPACE [add|remove OTHER] the workspaces whose agents read WORKSPACE and those its own read, as each one's
|
|
88
|
+
owners let them; its owners let OTHER's agents read it, one they see, and its owners or
|
|
89
|
+
OTHER's take that off; OTHER's people see what its agents read
|
|
87
90
|
rf skills
|
|
88
91
|
rf skill pull ID [DIR] [--version N] the newest version, or N, into DIR, ./ID by default, new or empty, as push reads it
|
|
89
92
|
rf skill versions ID
|
|
@@ -94,10 +97,10 @@ rf indexes [--json] each index of a source you index, all for admi
|
|
|
94
97
|
its phase, crawl or follow, pages read, when last caught up, and its error and next try
|
|
95
98
|
rf runs [PATH] [--since DATE] [--failed] [--running] [--long MIN] [--json]
|
|
96
99
|
a line per run: start, path, run, outcome, time, cost, what started it, and any error;
|
|
97
|
-
the outcome is done, interrupted by a person, cut by a restart
|
|
98
|
-
credits, policy, time limit or other
|
|
100
|
+
the outcome is done, interrupted by a person, cut, by a restart or a change that broke its
|
|
101
|
+
lease, running, or failed, for credits, policy, time limit or other
|
|
99
102
|
rf costs [PATH] [--since DATE] [--by workspace|series|person|day|outcome] [--json] totals, runs and cost per run; person
|
|
100
|
-
is the runner; runs leave out those
|
|
103
|
+
is the runner; runs leave out those that were cut, as the next run carries each on
|
|
101
104
|
rf activity [PATH] [--since DATE] [--json] per instance, what people and the agent said, what people uploaded and closed, and
|
|
102
105
|
each run that failed
|
|
103
106
|
rf wakes [PATH] [--json] each series' pending wakes and requests to start an instance, and when a wake of it last
|
|
@@ -561,6 +564,16 @@ else if (cmd === 'comment' && args.length === 2) {
|
|
|
561
564
|
await (ws ? post(`/api/workspaces/${ws.id}`, { agents: text }, 'PUT') : api('/agents', { method: 'PUT', body: text }));
|
|
562
565
|
console.log('saved');
|
|
563
566
|
}
|
|
567
|
+
} else if (cmd === 'readers' && args.length === 1) {
|
|
568
|
+
const ws = await workspaceNamed(args[0]);
|
|
569
|
+
if (flags.json) console.log(JSON.stringify({ readers: ws.readers, reads: ws.reads }, null, 1));
|
|
570
|
+
else console.log([...ws.readers.map(r => `${r.name} reads ${ws.name}`), ...ws.reads.map(r => `${ws.name} reads ${r.name}`)].join('\n') || `${ws.name} reads no other workspace, and none reads it`);
|
|
571
|
+
} else if (cmd === 'readers' && args.length === 3 && ['add', 'remove'].includes(args[1])) {
|
|
572
|
+
// A workspace you don't see, whose agents' reading of one of yours you take off, is found among what yours read.
|
|
573
|
+
const all = await get('/api'), [ws, other] = [args[0], args[2]].map(name => all.find(w => w.name === name) ?? all.flatMap(w => w.reads).find(r => r.name === name));
|
|
574
|
+
if (!ws || !other) throw new Error(`no workspace ${ws ? args[2] : args[0]}`);
|
|
575
|
+
await post(`/api/workspaces/${ws.id}/readers/${other.id}`, {}, args[1] === 'add' ? 'PUT' : 'DELETE');
|
|
576
|
+
console.log(args[1] === 'add' ? `${other.name}'s agents read ${ws.name} from their next run` : `${other.name}'s agents no longer read ${ws.name}`);
|
|
564
577
|
} else if (cmd === 'skill' && args[0] === 'push' && args[1]) {
|
|
565
578
|
const files = Object.fromEntries(readdirSync(args[1], { recursive: true, withFileTypes: true }).filter(d => d.isFile())
|
|
566
579
|
.map(d => [relative(args[1], join(d.parentPath, d.name)).split(sep).join('/'), readFileSync(join(d.parentPath, d.name)).toString('base64')]));
|
|
@@ -630,7 +643,7 @@ else if (cmd === 'comment' && args.length === 2) {
|
|
|
630
643
|
outcome: r => r.failure ? `failed, ${r.failure}` : r.outcome,
|
|
631
644
|
}[by];
|
|
632
645
|
if (!key) throw new Error('--by: workspace, series, person, day or outcome');
|
|
633
|
-
// A run
|
|
646
|
+
// A run that was cut is carried on by the next, so it adds its cost, not a run.
|
|
634
647
|
const sums = new Map (), rows = await runsIn(args[0]), counted = (r ) => r.outcome === 'cut' ? 0 : 1;
|
|
635
648
|
for (const r of rows) sums.set(key(r), { runs: (sums.get(key(r))?.runs ?? 0) + counted(r), cost: (sums.get(key(r))?.cost ?? 0) + r.cost });
|
|
636
649
|
const out = [...sums].map(([k, v]) => ({ [by]: k, runs: v.runs, cost: +v.cost.toFixed(4), per_run: v.runs ? +(v.cost / v.runs).toFixed(4) : null }))
|