@droconnell/agent-inbox-cli 2.2.0 → 2.3.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 +25 -2
- 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.3.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");
|
|
@@ -572,6 +572,8 @@ const USAGE = [
|
|
|
572
572
|
["whoami", "the workspace, person and token this runs as"],
|
|
573
573
|
["policy pull [policy.yaml]", "write what every agent may do (apps, tools, limits, guards) to a file to keep in git"],
|
|
574
574
|
["policy check [policy.yaml]", "fail (exit 1) when the workspace no longer matches the file: for CI"],
|
|
575
|
+
["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"],
|
|
576
|
+
["policy push [policy.yaml]", "send those changes to Decisions, where an admin applies them (nothing changes from here)"],
|
|
575
577
|
["policy", "print what every agent may do"],
|
|
576
578
|
["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
579
|
["events [--only conversation,apps]", "changes as they happen, one per line (--json: one JSON object per line), until Ctrl+C"],
|
|
@@ -964,7 +966,28 @@ switch (cmd) {
|
|
|
964
966
|
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
967
|
process.exit(ok ? 0 : 1);
|
|
966
968
|
}
|
|
967
|
-
|
|
969
|
+
if (sub === "plan" || sub === "push") {
|
|
970
|
+
// Edited by hand, the file becomes a plan to make the workspace match it (src/lib/policy.ts, policyToSetup); push
|
|
971
|
+
// sends it to Decisions, where an admin applies it. Nothing changes from here.
|
|
972
|
+
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}.`);
|
|
973
|
+
const got = await tool("plan_policy", { file: readFileSync(file, "utf8") });
|
|
974
|
+
const d = got.data ?? {};
|
|
975
|
+
const notes = (d.notes ?? []).length ? `\n\nNot changed by the file:\n${d.notes.map((n) => `- ${n}`).join("\n")}` : "";
|
|
976
|
+
if (!d.ok) { if (asJson) report("", { ok: false, problems: d.problems ?? [], notes: d.notes ?? [] }); else say(got.text); process.exit(1); }
|
|
977
|
+
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); }
|
|
978
|
+
if (sub === "plan") {
|
|
979
|
+
const body = got.text.replace(/\n*(Nothing has changed|This token can only look)[\s\S]*?(?=\n\nNot changed by the file|$)/, "").trim();
|
|
980
|
+
if (asJson) { report("", { ok: true, changes: d.changes, plan: d.plan, notes: d.notes ?? [], text: body }); process.exit(2); }
|
|
981
|
+
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.`);
|
|
982
|
+
process.exit(2);
|
|
983
|
+
}
|
|
984
|
+
const sent = await tool("submit_plan", { plan: d.plan });
|
|
985
|
+
if (sent.isError) stop(sent.text);
|
|
986
|
+
if (asJson) { report("", { proposed: true, changes: d.changes, plan: d.plan, notes: d.notes ?? [], text: sent.text }); break; }
|
|
987
|
+
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.`);
|
|
988
|
+
break;
|
|
989
|
+
}
|
|
990
|
+
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
991
|
}
|
|
969
992
|
case "audit": {
|
|
970
993
|
// The audit log and token use for a date range (src/lib/audit-export.ts): a table here, or --csv / --json / --out.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@droconnell/agent-inbox-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.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": {
|