@droconnell/agent-inbox-cli 2.1.0 → 2.2.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 +29 -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.2.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");
|
|
@@ -86,7 +86,7 @@ const urlArg = take("--url", true);
|
|
|
86
86
|
const tokenArg = take("--token", true);
|
|
87
87
|
/** The CLI's own commands. Anything else is a terminal command, sent as typed. */
|
|
88
88
|
export const OWN = new Set(["login", "logout", "update", "export", "pull", "plan", "diff", "push", "propose", "run", "tail", "script", "check", "ci", "test", "rehearse", "commands", "help", "submit",
|
|
89
|
-
"whoami", "policy", "mcp", "claude", "app", "events", "listen", "completion", "__complete", "--version", "-v", "--help", "-h"]);
|
|
89
|
+
"whoami", "policy", "audit", "mcp", "claude", "app", "events", "listen", "completion", "__complete", "--version", "-v", "--help", "-h"]);
|
|
90
90
|
const first = args[0];
|
|
91
91
|
// plan, diff and run are also terminal commands: the CLI's own only for a folder or file that is there (plan, diff) or
|
|
92
92
|
// a quoted command (run "ls unassigned"); otherwise they go to the terminal as typed (diff 40 42, run onboarding).
|
|
@@ -573,6 +573,7 @@ const USAGE = [
|
|
|
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
575
|
["policy", "print what every agent may do"],
|
|
576
|
+
["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"],
|
|
576
577
|
["events [--only conversation,apps]", "changes as they happen, one per line (--json: one JSON object per line), until Ctrl+C"],
|
|
577
578
|
["listen --forward <address> [--events a,b]", "Next's webhooks, signed as usual, sent to a server on this computer while it runs"],
|
|
578
579
|
["mcp", "an MCP server over stdio for any AI tool, using this computer's sign-in"],
|
|
@@ -965,6 +966,32 @@ switch (cmd) {
|
|
|
965
966
|
}
|
|
966
967
|
stop(`Say what to do: ${ME} policy, ${ME} policy pull [file] or ${ME} policy check [file].`);
|
|
967
968
|
}
|
|
969
|
+
case "audit": {
|
|
970
|
+
// The audit log and token use for a date range (src/lib/audit-export.ts): a table here, or --csv / --json / --out.
|
|
971
|
+
const opt = (name) => { const i = rest.indexOf(`--${name}`); return i >= 0 && rest[i + 1] && !rest[i + 1].startsWith("--") ? rest[i + 1] : undefined; };
|
|
972
|
+
const out = opt("out");
|
|
973
|
+
const csv = rest.includes("--csv") || Boolean(out && /\.csv$/i.test(out));
|
|
974
|
+
const got = await tool("get_audit", { ...(opt("from") ? { from: opt("from") } : {}), ...(opt("to") ? { to: opt("to") } : {}), ...(opt("area") ? { area: opt("area") } : {}), format: csv ? "csv" : "json" });
|
|
975
|
+
if (got.isError) stop(got.text || "The server did not send the audit log. Try again.");
|
|
976
|
+
const d = got.data ?? {};
|
|
977
|
+
if (out) {
|
|
978
|
+
writeFileSync(out, csv ? d.csv : `${JSON.stringify({ ...d, summary: undefined }, null, 2)}\n`);
|
|
979
|
+
report(`${d.summary} Wrote ${out}.`, { file: out, summary: d.summary });
|
|
980
|
+
break;
|
|
981
|
+
}
|
|
982
|
+
if (csv) { process.stdout.write(d.csv ?? ""); break; }
|
|
983
|
+
if (asJson) { report("", d); break; }
|
|
984
|
+
const pad = (s, n) => (String(s).length > n ? `${String(s).slice(0, n - 1)}…` : String(s).padEnd(n));
|
|
985
|
+
const lines = [`${d.workspace}: ${d.summary}`, ""];
|
|
986
|
+
for (const e of d.entries ?? []) lines.push(`${e.at.slice(0, 16).replace("T", " ")} ${pad(e.via ? `${e.who} via ${e.via}` : e.who, 28)} ${pad(e.area, 22)} ${e.what}`);
|
|
987
|
+
if ((d.tokens ?? []).length) {
|
|
988
|
+
lines.push("", "Token use (calls a day):");
|
|
989
|
+
for (const t of d.tokens) lines.push(`${t.day} ${pad(t.token, 24)} ${pad(t.owner, 20)} ${String(t.calls).padStart(6)}${t.revoked ? " (revoked)" : ""}`);
|
|
990
|
+
}
|
|
991
|
+
lines.push("", `Staff access: ${d.staff_access}`, `For a spreadsheet: ${ME} audit --csv --out audit.csv`);
|
|
992
|
+
say(lines.join("\n"));
|
|
993
|
+
break;
|
|
994
|
+
}
|
|
968
995
|
case "export": {
|
|
969
996
|
const { text, isError } = await tool("export_workspace");
|
|
970
997
|
if (isError) stop(text);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@droconnell/agent-inbox-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.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": {
|