@droconnell/agent-inbox-cli 2.2.0 → 2.4.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/agent-inbox.mjs +37 -3
- package/package.json +1 -1
package/agent-inbox.mjs
CHANGED
|
@@ -34,7 +34,7 @@ import { basename, dirname, isAbsolute, join, relative, sep } from "node:path";
|
|
|
34
34
|
import { spawn } from "node:child_process";
|
|
35
35
|
import { fileURLToPath } from "node:url";
|
|
36
36
|
|
|
37
|
-
export const VERSION = "2.
|
|
37
|
+
export const VERSION = "2.4.0";
|
|
38
38
|
/** The npm package; its command is agent-inbox. (The name agent-inbox itself belongs to someone else on npm.) */
|
|
39
39
|
export const PACKAGE = "@droconnell/agent-inbox-cli";
|
|
40
40
|
const DIR = join(process.env.XDG_CONFIG_HOME || join(homedir(), ".config"), "agent-inbox");
|
|
@@ -217,7 +217,8 @@ async function waitJobs(jobs) {
|
|
|
217
217
|
const lines = [];
|
|
218
218
|
let ok = true;
|
|
219
219
|
for (const { job, agent } of jobs) {
|
|
220
|
-
|
|
220
|
+
// A whole day's replay can take a while (a few hundred conversations, twice each); the rest within minutes.
|
|
221
|
+
const until = Date.now() + (/ on \d{4}-/.test(agent) ? 60 : 15) * 60_000;
|
|
221
222
|
let s;
|
|
222
223
|
for (;;) {
|
|
223
224
|
s = await tool("check_status", { job });
|
|
@@ -566,12 +567,15 @@ const USAGE = [
|
|
|
566
567
|
["test", "run the agents' tests and wait (exit 0 all pass, 1 some fail)"],
|
|
567
568
|
["rehearse <file>", "rehearse the agents the file adds or changes on past conversations and wait"],
|
|
568
569
|
["rehearse [plan] [--on 20] [--topic refund]", "show me before it goes live: past conversations and the tests, with a plan and without"],
|
|
570
|
+
["rehearse [plan] --day [yesterday|2026-11-30] [--yes]", "replay a whole day's conversations, as things are and with the plan: the price first, --yes runs it"],
|
|
569
571
|
["", "(both cost money, and need Tests and rehearsals from CI turned on)"],
|
|
570
572
|
["login <address> --token", "sign in without a browser: paste a personal access token (or pipe it in, or --token <value>)"],
|
|
571
573
|
["login <address> --read", "sign in to look only"],
|
|
572
574
|
["whoami", "the workspace, person and token this runs as"],
|
|
573
575
|
["policy pull [policy.yaml]", "write what every agent may do (apps, tools, limits, guards) to a file to keep in git"],
|
|
574
576
|
["policy check [policy.yaml]", "fail (exit 1) when the workspace no longer matches the file: for CI"],
|
|
577
|
+
["policy plan [policy.yaml]", "what an edited policy file would change: agents on or off, at_most, model, daily limit, apps, limits, tools, inbox ceilings"],
|
|
578
|
+
["policy push [policy.yaml]", "send those changes to Decisions, where an admin applies them (nothing changes from here)"],
|
|
575
579
|
["policy", "print what every agent may do"],
|
|
576
580
|
["audit [--from 2026-11-01] [--to 2026-11-30] [--area access] [--csv] [--out file]", "the audit log and how much each token was used, for a date range (the last 30 days if none): admins only"],
|
|
577
581
|
["events [--only conversation,apps]", "changes as they happen, one per line (--json: one JSON object per line), until Ctrl+C"],
|
|
@@ -964,7 +968,28 @@ switch (cmd) {
|
|
|
964
968
|
say(markdown && !ok ? `### What the agents may do has changed\n\n${(got.data?.differences ?? []).map((d) => `- ${d}`).join("\n")}\n\nIf it was meant, run \`${ME} policy pull\` and commit ${file}.` : got.text);
|
|
965
969
|
process.exit(ok ? 0 : 1);
|
|
966
970
|
}
|
|
967
|
-
|
|
971
|
+
if (sub === "plan" || sub === "push") {
|
|
972
|
+
// Edited by hand, the file becomes a plan to make the workspace match it (src/lib/policy.ts, policyToSetup); push
|
|
973
|
+
// sends it to Decisions, where an admin applies it. Nothing changes from here.
|
|
974
|
+
if (!existsSync(file)) stop(`There is no ${file} here. Make it with ${ME} policy pull${file === "policy.yaml" ? "" : ` ${file}`}, change it, then ${ME} policy ${sub}.`);
|
|
975
|
+
const got = await tool("plan_policy", { file: readFileSync(file, "utf8") });
|
|
976
|
+
const d = got.data ?? {};
|
|
977
|
+
const notes = (d.notes ?? []).length ? `\n\nNot changed by the file:\n${d.notes.map((n) => `- ${n}`).join("\n")}` : "";
|
|
978
|
+
if (!d.ok) { if (asJson) report("", { ok: false, problems: d.problems ?? [], notes: d.notes ?? [] }); else say(got.text); process.exit(1); }
|
|
979
|
+
if (!d.changes) { if (asJson) report("", { ok: true, changes: 0, plan: null, notes: d.notes ?? [] }); else say(`No changes: what the agents may do already matches ${file}.${notes}`); process.exit(0); }
|
|
980
|
+
if (sub === "plan") {
|
|
981
|
+
const body = got.text.replace(/\n*(Nothing has changed|This token can only look)[\s\S]*?(?=\n\nNot changed by the file|$)/, "").trim();
|
|
982
|
+
if (asJson) { report("", { ok: true, changes: d.changes, plan: d.plan, notes: d.notes ?? [], text: body }); process.exit(2); }
|
|
983
|
+
say(markdown ? `### ${d.changes === 1 ? "1 change" : `${d.changes} changes`} to what the agents may do\n\n${fence(body)}\n\nMerging proposes these; an admin applies them in Decisions.` : `${body}\n\n${ME} policy push${file === "policy.yaml" ? "" : ` ${file}`} sends this to Decisions, where an admin applies it.`);
|
|
984
|
+
process.exit(2);
|
|
985
|
+
}
|
|
986
|
+
const sent = await tool("submit_plan", { plan: d.plan });
|
|
987
|
+
if (sent.isError) stop(sent.text);
|
|
988
|
+
if (asJson) { report("", { proposed: true, changes: d.changes, plan: d.plan, notes: d.notes ?? [], text: sent.text }); break; }
|
|
989
|
+
say(`${sent.text}${notes}\nOnce it is applied, ${ME} policy pull${file === "policy.yaml" ? "" : ` ${file}`} brings the file in line, and ${ME} policy check passes.`);
|
|
990
|
+
break;
|
|
991
|
+
}
|
|
992
|
+
stop(`Say what to do: ${ME} policy, ${ME} policy pull [file], ${ME} policy check [file], ${ME} policy plan [file] or ${ME} policy push [file].`);
|
|
968
993
|
}
|
|
969
994
|
case "audit": {
|
|
970
995
|
// The audit log and token use for a date range (src/lib/audit-export.ts): a table here, or --csv / --json / --out.
|
|
@@ -1138,6 +1163,15 @@ Then:
|
|
|
1138
1163
|
const plan = rest[0] && !rest[0].startsWith("--") ? rest[0] : undefined;
|
|
1139
1164
|
const flag = (name) => { const i = rest.indexOf(`--${name}`); return i >= 0 ? rest[i + 1] : undefined; };
|
|
1140
1165
|
const on = flag("on"), topic = flag("topic") ?? (/^topic=(.+)$/i.exec(on ?? "") ?? [])[1];
|
|
1166
|
+
if (rest.includes("--day")) {
|
|
1167
|
+
// A whole day, as things are and with the plan: the price first; --yes starts it (it is charged as tests).
|
|
1168
|
+
const day = flag("day") && !flag("day").startsWith("--") ? flag("day") : "yesterday";
|
|
1169
|
+
const yes = rest.includes("--yes");
|
|
1170
|
+
started = await tool("replay_day", { ...(plan ? { plan } : {}), day, ...(yes ? { confirm: true } : {}) });
|
|
1171
|
+
if (started.isError) stop(started.text);
|
|
1172
|
+
if (!yes) { say(`${started.text.replace(/ Call again with confirm: true to start it\.$/, "")}\nRun it again with --yes to start it.`); break; }
|
|
1173
|
+
started = { ...started, data: { jobs: [{ job: started.data.job, agent: `plan ${plan ?? "(latest)"} on ${started.data.day}` }] } };
|
|
1174
|
+
} else
|
|
1141
1175
|
started = await tool("rehearse", { ...(plan ? { plan } : {}), ...(/^\d+$/.test(on ?? "") ? { conversations: Number(on) } : {}), ...(topic ? { topic } : {}) });
|
|
1142
1176
|
if (!started.isError && started.data?.job) started = { ...started, data: { jobs: [{ job: started.data.job, agent: `plan ${plan ?? "(latest)"}` }] } };
|
|
1143
1177
|
if (!started.isError) say(started.text);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@droconnell/agent-inbox-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "The Next CLI, built for agents: JSON on every command, an MCP server for any AI tool, live events, apps and webhooks from the terminal, and a support workspace's setup as files in git.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|