@ouro.bot/cli 0.1.0-alpha.1290 → 0.1.0-alpha.1292

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/changelog.json CHANGED
@@ -1,6 +1,19 @@
1
1
  {
2
2
  "_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.1292",
6
+ "changes": [
7
+ "The ouro CLI's commands carry Ouro AX cards: `ouro help --json` gives each card's when line, consent class and errors, and the shell treats exactly the commands whose card says read as safe. Twenty commands have cards so far, including every command the shell already treated as read-only.",
8
+ "A failed ouro command prints its error code as the last stderr line, and a shell line that runs ouro beside other commands always asks for approval."
9
+ ]
10
+ },
11
+ {
12
+ "version": "0.1.0-alpha.1291",
13
+ "changes": [
14
+ "The replay eval has a provider proxy: inside the sandbox the agent's provider forwards every call to the host, which holds the one real provider and its credentials, takes one budget unit per call, and stops the run on the first 402 or 429 without a retry."
15
+ ]
16
+ },
4
17
  {
5
18
  "version": "0.1.0-alpha.1290",
6
19
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1290",
2
+ "runtimeVersion": "0.1.0-alpha.1292",
3
3
  "bundleSchemaVersion": 3,
4
4
  "lastUpdated": "2026-09-03T00:00:00.000Z"
5
5
  }
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0"?>
2
2
  <Container version="2">
3
3
  <Name>ouro-butler</Name>
4
- <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1290</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1292</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -0,0 +1,260 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createStreamChannel = createStreamChannel;
4
+ exports.createProxyRuntime = createProxyRuntime;
5
+ exports.serveProxyRuntime = serveProxyRuntime;
6
+ const runtime_1 = require("../../nerves/runtime");
7
+ /** The callback events a provider streams; anything else on the wire is ignored. */
8
+ const CALLBACK_EVENTS = new Set([
9
+ "onModelStart", "onModelStreamStart", "onTextChunk", "onReasoningChunk", "onToolStart", "onToolEnd", "onError", "onClearText", "onKick",
10
+ ]);
11
+ /** Stops the run, never retried: the budget is spent, or the provider says the account is out of credit or rate-limited. */
12
+ const STOPPING_STATUS = new Set([402, 429]);
13
+ const STOPPING_CLASSIFICATION = new Set(["usage-limit", "rate-limit"]);
14
+ class ProxiedProviderError extends Error {
15
+ classification;
16
+ reason;
17
+ retryable = false;
18
+ constructor(error, cause) {
19
+ super(error.message, { cause });
20
+ this.name = "ProxiedProviderError";
21
+ this.classification = error.classification;
22
+ if (error.status !== undefined)
23
+ this.status = error.status;
24
+ this.reason = error.reason;
25
+ }
26
+ }
27
+ const isObject = (value) => typeof value === "object" && value !== null;
28
+ const isTurn = (value) => Number.isInteger(value);
29
+ /** The shape each message type must have; the guest is untrusted, so anything else never reaches a listener. */
30
+ const SHAPES = {
31
+ hello: () => true,
32
+ capabilities: (msg) => typeof msg.id === "string" && typeof msg.model === "string" && Array.isArray(msg.capabilities),
33
+ streamTurn: (msg) => isTurn(msg.turn) && isObject(msg.request) && Array.isArray(msg.request.messages),
34
+ callback: (msg) => isTurn(msg.turn) && typeof msg.event === "string" && Array.isArray(msg.args),
35
+ turnResult: (msg) => isTurn(msg.turn) && isObject(msg.result),
36
+ appendToolOutput: (msg) => typeof msg.callId === "string" && typeof msg.output === "string",
37
+ resetTurnState: (msg) => Array.isArray(msg.messages),
38
+ error: (msg) => isTurn(msg.turn) && isObject(msg.error) && typeof msg.error.message === "string",
39
+ abort: (msg) => isTurn(msg.turn),
40
+ };
41
+ function isMessage(value) {
42
+ return isObject(value) && typeof value.type === "string" && Object.hasOwn(SHAPES, value.type) && SHAPES[value.type](value);
43
+ }
44
+ function parseLine(line) {
45
+ try {
46
+ const value = JSON.parse(line);
47
+ if (isMessage(value))
48
+ return value;
49
+ }
50
+ catch {
51
+ // Not JSON: reported below like any other line that is not a message.
52
+ }
53
+ return { type: "invalid", reason: `not a proxy message: ${line.slice(0, 80)}` };
54
+ }
55
+ /** Far above any real turn's transcript; past it a line is dropped, so a guest cannot grow the host's buffer without bound. */
56
+ const MAX_LINE_LENGTH = 64 * 1024 * 1024;
57
+ /** Newline-delimited JSON over a pair of byte streams, such as a container's stdin and stdout. */
58
+ function createStreamChannel(input, output, maxLineLength = MAX_LINE_LENGTH) {
59
+ const listeners = [];
60
+ const deliver = (msg) => {
61
+ for (const listener of listeners) {
62
+ try {
63
+ listener(msg);
64
+ }
65
+ catch (caught) {
66
+ // A throw here would escape the stream's data handler and end the process.
67
+ (0, runtime_1.emitNervesEvent)({ component: "eval", level: "error", event: "eval.proxy_channel_error", message: "a proxy message handler failed", meta: { type: msg.type, error: caught instanceof Error ? caught.message : String(caught) } });
68
+ }
69
+ }
70
+ };
71
+ const tooLong = { type: "invalid", reason: "line too long" };
72
+ let buffered = "";
73
+ let discarding = false;
74
+ let closed = false;
75
+ input.setEncoding("utf8");
76
+ input.on("data", (chunk) => {
77
+ let text = chunk;
78
+ if (discarding) {
79
+ const newline = text.indexOf("\n");
80
+ if (newline < 0)
81
+ return;
82
+ text = text.slice(newline + 1);
83
+ discarding = false;
84
+ }
85
+ buffered += text;
86
+ const lines = buffered.split("\n");
87
+ buffered = lines.pop();
88
+ for (const line of lines.filter(Boolean))
89
+ deliver(line.length > maxLineLength ? tooLong : parseLine(line));
90
+ if (buffered.length > maxLineLength) {
91
+ buffered = "";
92
+ discarding = true;
93
+ deliver(tooLong);
94
+ }
95
+ });
96
+ const close = () => { if (!closed) {
97
+ closed = true;
98
+ deliver({ type: "closed" });
99
+ } };
100
+ input.on("end", close);
101
+ input.on("close", close);
102
+ input.on("error", (error) => deliver({ type: "invalid", reason: `input failed: ${error.message}` }));
103
+ output.on("error", (error) => deliver({ type: "invalid", reason: `output failed: ${error.message}` }));
104
+ return {
105
+ send: (msg) => { output.write(`${JSON.stringify(msg)}\n`); },
106
+ onMessage: (fn) => { listeners.push(fn); },
107
+ };
108
+ }
109
+ /** Guest side: a runtime whose every call is served by the host. Resolves once the host has said what it is. */
110
+ function createProxyRuntime(channel) {
111
+ const turns = new Map();
112
+ let nextTurn = 1;
113
+ return new Promise((resolveRuntime) => {
114
+ channel.onMessage((msg) => {
115
+ if (msg.type === "capabilities") {
116
+ (0, runtime_1.emitNervesEvent)({ component: "eval", event: "eval.proxy_runtime_ready", message: "proxy provider runtime is ready", meta: { provider: msg.id, model: msg.model } });
117
+ resolveRuntime({
118
+ id: msg.id,
119
+ model: msg.model,
120
+ client: null,
121
+ capabilities: new Set(msg.capabilities),
122
+ ...(msg.supportedReasoningEfforts ? { supportedReasoningEfforts: msg.supportedReasoningEfforts } : {}),
123
+ streamTurn: (request) => new Promise((resolve, reject) => {
124
+ const turn = nextTurn++;
125
+ const { callbacks, signal, ...wire } = request;
126
+ if (signal?.aborted) {
127
+ (0, runtime_1.emitNervesEvent)({ component: "eval", level: "error", event: "eval.proxy_guest_turn_error", message: "proxied turn aborted before it started", meta: { turn, reason: "aborted" } });
128
+ return reject(new ProxiedProviderError({ message: "aborted before the provider call", classification: "unknown", reason: "aborted" }));
129
+ }
130
+ (0, runtime_1.emitNervesEvent)({ component: "eval", event: "eval.proxy_guest_turn_start", message: "sending a turn to the host provider", meta: { turn } });
131
+ const onAbort = () => channel.send({ type: "abort", turn });
132
+ const settle = () => { turns.delete(turn); signal?.removeEventListener("abort", onAbort); };
133
+ turns.set(turn, {
134
+ request,
135
+ resolve: (result) => { settle(); (0, runtime_1.emitNervesEvent)({ component: "eval", event: "eval.proxy_guest_turn_end", message: "host provider turn finished", meta: { turn } }); resolve(result); },
136
+ reject: (error) => { settle(); (0, runtime_1.emitNervesEvent)({ component: "eval", level: "error", event: "eval.proxy_guest_turn_error", message: "host provider turn failed", meta: { turn, error: error.message } }); reject(error); },
137
+ });
138
+ channel.send({ type: "streamTurn", turn, request: { ...wire, ...(callbacks.settleOutputMode ? { settleOutputMode: callbacks.settleOutputMode } : {}) } });
139
+ signal?.addEventListener("abort", onAbort, { once: true });
140
+ }),
141
+ appendToolOutput: (callId, output) => channel.send({ type: "appendToolOutput", callId, output }),
142
+ resetTurnState: (messages) => channel.send({ type: "resetTurnState", messages }),
143
+ ping: async () => undefined,
144
+ classifyError: (error) => error instanceof ProxiedProviderError ? error.classification : "unknown",
145
+ });
146
+ return;
147
+ }
148
+ if (msg.type === "invalid" || msg.type === "closed") {
149
+ const why = msg.type === "closed" ? "input closed" : msg.reason;
150
+ for (const [turn, pending] of [...turns]) {
151
+ channel.send({ type: "abort", turn });
152
+ pending.reject(new ProxiedProviderError({ message: `proxy channel failed: ${why}`, classification: "unknown", reason: "channel" }));
153
+ }
154
+ return;
155
+ }
156
+ const pending = "turn" in msg ? turns.get(msg.turn) : undefined;
157
+ if (!pending)
158
+ return;
159
+ if (msg.type === "callback" && CALLBACK_EVENTS.has(msg.event)) {
160
+ if (pending.callbackError)
161
+ return;
162
+ const args = msg.event === "onError" ? [new Error(String(msg.args[0])), msg.args[1]] : msg.args;
163
+ try {
164
+ ;
165
+ pending.request.callbacks[msg.event]?.(...args);
166
+ }
167
+ catch (caught) {
168
+ // In-process, a throwing callback fails the turn; here the host is told to stop, and the turn fails with it.
169
+ pending.callbackError = new ProxiedProviderError({ message: caught instanceof Error ? caught.message : String(caught), classification: "unknown", reason: "callback" }, caught);
170
+ channel.send({ type: "abort", turn: msg.turn });
171
+ }
172
+ }
173
+ else if (msg.type === "turnResult") {
174
+ if (pending.callbackError)
175
+ pending.reject(pending.callbackError);
176
+ else
177
+ pending.resolve(msg.result);
178
+ }
179
+ else if (msg.type === "error") {
180
+ pending.reject(pending.callbackError ?? new ProxiedProviderError(msg.error));
181
+ }
182
+ });
183
+ channel.send({ type: "hello" });
184
+ });
185
+ }
186
+ function streamingCallbacks(channel, turn, settleOutputMode) {
187
+ const forward = (event) => (...args) => {
188
+ channel.send({ type: "callback", turn, event, args: event === "onError" ? [args[0] instanceof Error ? args[0].message : String(args[0]), args[1]] : args });
189
+ };
190
+ const callbacks = Object.fromEntries([...CALLBACK_EVENTS].map((event) => [event, forward(event)]));
191
+ return settleOutputMode ? { ...callbacks, settleOutputMode } : callbacks;
192
+ }
193
+ /** Host side: serves one real runtime to the guest, taking one budget unit per turn. */
194
+ function serveProxyRuntime(channel, runtime, budget) {
195
+ const aborts = new Map();
196
+ let stopped;
197
+ channel.onMessage((msg) => {
198
+ if (msg.type === "closed") {
199
+ // The guest has gone away: its turn's call is wasted, so stop it.
200
+ for (const abort of aborts.values())
201
+ abort.abort();
202
+ }
203
+ else if (msg.type === "invalid") {
204
+ (0, runtime_1.emitNervesEvent)({ component: "eval", level: "error", event: "eval.proxy_channel_error", message: "ignored a line from the guest that is not a proxy message", meta: { reason: msg.reason } });
205
+ }
206
+ else if (msg.type === "hello") {
207
+ channel.send({
208
+ type: "capabilities", id: runtime.id, model: runtime.model, capabilities: [...runtime.capabilities],
209
+ ...(runtime.supportedReasoningEfforts ? { supportedReasoningEfforts: [...runtime.supportedReasoningEfforts] } : {}),
210
+ });
211
+ }
212
+ else if (msg.type === "appendToolOutput") {
213
+ runtime.appendToolOutput(msg.callId, msg.output);
214
+ }
215
+ else if (msg.type === "resetTurnState") {
216
+ runtime.resetTurnState(msg.messages);
217
+ }
218
+ else if (msg.type === "abort") {
219
+ aborts.get(msg.turn)?.abort();
220
+ }
221
+ else if (msg.type === "streamTurn") {
222
+ void serveTurn(msg.turn, msg.request);
223
+ }
224
+ });
225
+ function refuse(turn, error) {
226
+ (0, runtime_1.emitNervesEvent)({ component: "eval", level: "error", event: "eval.proxy_turn_error", message: "proxy turn refused without calling the provider", meta: { turn, reason: error.reason } });
227
+ channel.send({ type: "error", turn, error });
228
+ }
229
+ async function serveTurn(turn, request) {
230
+ if (stopped)
231
+ return refuse(turn, { ...stopped, message: `the provider stopped this run earlier: ${stopped.message}`, reason: "stopped" });
232
+ // One runtime keeps one turn's provider state, so a second turn in flight would corrupt the first.
233
+ if (aborts.size > 0)
234
+ return refuse(turn, { message: "another turn is still in flight", classification: "unknown", reason: "busy" });
235
+ if (!budget.take())
236
+ return refuse(turn, { message: "budget exhausted", classification: "usage-limit", reason: "budget" });
237
+ (0, runtime_1.emitNervesEvent)({ component: "eval", event: "eval.proxy_turn_start", message: "serving a proxied provider turn", meta: { turn, provider: runtime.id, model: runtime.model } });
238
+ const abort = new AbortController();
239
+ aborts.set(turn, abort);
240
+ try {
241
+ const { settleOutputMode, ...rest } = request;
242
+ const result = await runtime.streamTurn({ ...rest, callbacks: streamingCallbacks(channel, turn, settleOutputMode), signal: abort.signal });
243
+ channel.send({ type: "turnResult", turn, result });
244
+ (0, runtime_1.emitNervesEvent)({ component: "eval", event: "eval.proxy_turn_end", message: "proxied provider turn finished", meta: { turn } });
245
+ }
246
+ catch (caught) {
247
+ const error = caught instanceof Error ? caught : new Error(String(caught));
248
+ const classification = runtime.classifyError(error);
249
+ const status = error.status;
250
+ const wire = { message: error.message, classification, reason: "provider", ...(typeof status === "number" ? { status } : {}) };
251
+ if ((typeof status === "number" && STOPPING_STATUS.has(status)) || STOPPING_CLASSIFICATION.has(classification))
252
+ stopped = wire;
253
+ (0, runtime_1.emitNervesEvent)({ component: "eval", level: "error", event: "eval.proxy_turn_error", message: "proxied provider turn failed", meta: { turn, classification, status: wire.status ?? null, stopped: Boolean(stopped) } });
254
+ channel.send({ type: "error", turn, error: wire });
255
+ }
256
+ finally {
257
+ aborts.delete(turn);
258
+ }
259
+ }
260
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.A2A_COMMANDS = void 0;
4
+ exports.A2A_COMMANDS = [
5
+ { name: "gateway serve", effect: "others", summary: "Serve the gateway that other agents connect to." },
6
+ { name: "a2a card", effect: "private", readOnly: true, summary: "Show the agent's A2A card." },
7
+ { name: "a2a delegated-commands grant", effect: "others", summary: "Let a friend's agent run delegated commands." },
8
+ { name: "a2a delegated-commands list", effect: "private", readOnly: true, summary: "List the delegated command grants." },
9
+ { name: "a2a delegated-commands revoke", effect: "private", summary: "Revoke a delegated command grant." },
10
+ { name: "a2a escalation grant", effect: "others", summary: "Let a friend escalate to the person." },
11
+ { name: "a2a escalation list", effect: "private", readOnly: true, summary: "List escalation grants." },
12
+ { name: "a2a escalation revoke", effect: "private", summary: "Revoke an escalation grant." },
13
+ { name: "a2a identity", effect: "private", readOnly: true, summary: "Show the agent's A2A identity." },
14
+ { name: "a2a message", effect: "others", summary: "Send an A2A message to another agent." },
15
+ { name: "a2a onboard", effect: "private", summary: "Onboard another agent from its card." },
16
+ { name: "a2a outbox ack", effect: "others", summary: "Acknowledge messages another agent sent." },
17
+ { name: "a2a outbox list", effect: "private", readOnly: true, summary: "List the A2A outbox." },
18
+ { name: "a2a outbox resolve", effect: "others", summary: "Resolve a report another agent filed." },
19
+ { name: "a2a serve", effect: "others", summary: "Serve the agent's A2A endpoint to other agents." },
20
+ ];
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unknownFlag = unknownFlag;
4
+ exports.agentErrors = agentErrors;
5
+ exports.usageError = usageError;
6
+ exports.daemonDown = daemonDown;
7
+ /** The flag gate's refusal of a flag this command doesn't take. */
8
+ function unknownFlag(name) {
9
+ return {
10
+ code: "unknown-flag",
11
+ means: `ouro ${name} got a flag no ouro command takes; the refusal suggests the nearest known flag, which may belong to another command.`,
12
+ fix: `Read ouro ${name} --help for the flags this command takes, then retry with one of those.`,
13
+ };
14
+ }
15
+ /** No agent was named and the shell couldn't pick one: none on this machine, or several and no prompt. */
16
+ function agentErrors(name) {
17
+ return [
18
+ {
19
+ code: "no-agent",
20
+ means: `No agent bundle is on this machine, so ouro ${name} has no agent to read.`,
21
+ fix: "Hatch or clone an agent first, then run the command again.",
22
+ },
23
+ {
24
+ code: "which-agent",
25
+ means: `Several agents are on this machine and ouro ${name} can't ask which one from a script.`,
26
+ fix: `Name it: ouro ${name} --agent <name>.`,
27
+ },
28
+ ];
29
+ }
30
+ /** The parser refused the words: a required flag or value is missing or malformed. */
31
+ function usageError(name, needs, fix) {
32
+ return { code: "usage", means: `ouro ${name} ${needs}`, fix };
33
+ }
34
+ /** The command needs the running daemon and it isn't up. */
35
+ function daemonDown(name) {
36
+ return {
37
+ code: "daemon-down",
38
+ means: `ouro ${name} asks the daemon, and the daemon isn't running on this machine.`,
39
+ fix: `Start it with ouro up, then run ouro ${name} again.`,
40
+ };
41
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CODING_TOOLS_COMMANDS = void 0;
4
+ const cards_1 = require("./cards");
5
+ exports.CODING_TOOLS_COMMANDS = [
6
+ { name: "mcp call", effect: "private", summary: "Call a tool on an MCP server." },
7
+ { name: "mcp doctor", effect: "private", readOnly: true, summary: "Check an agent's MCP servers." },
8
+ { name: "mcp list", effect: "private", readOnly: true, summary: "List the MCP servers.", ax: { id: "cli:mcp list", group: "coding-tools", effect: "read", when: "Before mcp call, see which servers the agent has connected and the tools each offers.", errors: [(0, cards_1.unknownFlag)("mcp list"), (0, cards_1.daemonDown)("mcp list")] } },
9
+ ];
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DESK_COMMANDS = void 0;
4
+ exports.DESK_COMMANDS = [];
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DNS_COMMANDS = void 0;
4
+ exports.DNS_COMMANDS = [
5
+ { name: "dns backup", effect: "private", summary: "Back up the DNS records of a binding." },
6
+ { name: "dns plan", effect: "private", readOnly: true, summary: "Show the DNS changes a binding would make." },
7
+ { name: "dns apply", effect: "others", summary: "Apply DNS changes that other people on the internet can reach." },
8
+ { name: "dns verify", effect: "private", readOnly: true, summary: "Check that the DNS records are live." },
9
+ { name: "dns rollback", effect: "private", summary: "Restore the DNS records from a backup." },
10
+ { name: "dns certificate", effect: "private", summary: "Issue or check a certificate for a binding." },
11
+ ];
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FRIENDS_COMMANDS = void 0;
4
+ const cards_1 = require("./cards");
5
+ exports.FRIENDS_COMMANDS = [
6
+ { name: "friend create", effect: "private", summary: "Add a friend the agent knows." },
7
+ { name: "friend link", effect: "private", summary: "Link a friend to an external account." },
8
+ { name: "friend list", effect: "private", readOnly: true, summary: "List the friends this agent knows." },
9
+ { name: "friend show", effect: "private", readOnly: true, summary: "Show one friend." },
10
+ { name: "friend unlink", effect: "private", summary: "Remove a link between a friend and an external account." },
11
+ { name: "friend update", effect: "private", summary: "Change a friend's trust, admission or initiative." },
12
+ { name: "link", effect: "private", summary: "Link an agent to a friend's external account." },
13
+ { name: "session list", effect: "private", readOnly: true, summary: "List the agent's sessions.", ax: { id: "cli:session list", group: "friends", effect: "read", when: "Find who the agent talks with now, on which channel and how recently, before reaching someone.", errors: [(0, cards_1.unknownFlag)("session list")] } },
14
+ ];
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HABITS_COMMANDS = void 0;
4
+ exports.HABITS_COMMANDS = [
5
+ { name: "habit cancel", effect: "private", summary: "Cancel a habit's pending run." },
6
+ { name: "habit create", effect: "private", summary: "Create a habit that runs on a cadence." },
7
+ { name: "habit inspect", effect: "private", readOnly: true, summary: "Show one habit run." },
8
+ { name: "habit list", effect: "private", readOnly: true, summary: "List the agent's habits." },
9
+ { name: "habit probe", effect: "private", readOnly: true, summary: "Check a habit without sending anything." },
10
+ { name: "habit runs", effect: "private", readOnly: true, summary: "List recent habit runs." },
11
+ { name: "habit summary", effect: "private", readOnly: true, summary: "Summarise a habit run." },
12
+ { name: "poke", effect: "private", summary: "Wake an agent for a task or habit." },
13
+ ];
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LIFECYCLE_COMMANDS = void 0;
4
+ const cards_1 = require("./cards");
5
+ exports.LIFECYCLE_COMMANDS = [
6
+ { name: "clone", effect: "private", summary: "Clone an agent bundle from a remote." },
7
+ { name: "dev", effect: "private", summary: "Run the daemon from this checkout, rebuilding as it goes." },
8
+ { name: "doctor", effect: "private", readOnly: true, summary: "Check the health of this machine's Ouro install." },
9
+ { name: "down", effect: "private", summary: "Stop the daemon." },
10
+ { name: "hatch", effect: "private", summary: "Create a new agent." },
11
+ { name: "logs", effect: "private", readOnly: true, summary: "Show the daemon's recent logs." },
12
+ { name: "repair", effect: "private", summary: "Repair an agent's setup." },
13
+ { name: "rollback", effect: "private", summary: "Roll the install back to an earlier version." },
14
+ { name: "status", effect: "private", readOnly: true, summary: "Show the daemon and an agent's status.", ax: { id: "cli:status", group: "lifecycle", effect: "read", when: "Start here: learn whether the daemon runs, which agents it hosts and whether their senses are healthy.", errors: [(0, cards_1.unknownFlag)("status")] } },
15
+ { name: "stop", effect: "private", summary: "Stop the daemon." },
16
+ { name: "sync", effect: "private", summary: "Sync an agent bundle with its remote." },
17
+ { name: "versions", effect: "private", readOnly: true, summary: "List the installed and available versions.", ax: { id: "cli:versions", group: "lifecycle", effect: "read", when: "Before an update or rollback, see the releases installed here, the one running now and the pinned intent.", errors: [(0, cards_1.unknownFlag)("versions")] } },
18
+ { name: "whoami", effect: "private", readOnly: true, summary: "Show which agent this is.", ax: { id: "cli:whoami", group: "lifecycle", effect: "read", when: "Confirm which agent bundle and home folder this terminal speaks as before writing into either.", errors: [(0, cards_1.unknownFlag)("whoami")] } },
19
+ { name: "changelog", effect: "private", readOnly: true, summary: "Show the release notes.", ax: { id: "cli:changelog", group: "lifecycle", effect: "read", when: "Explain new behaviour after an update by reading release notes, limited to releases after --from.", errors: [(0, cards_1.unknownFlag)("changelog")] } },
20
+ { name: "help", effect: "private", readOnly: true, summary: "Show ouro's commands and how to use them.", ax: { id: "cli:help", group: "lifecycle", effect: "read", when: "Discover commands: help --json gives each one's consent class, errors and example, to choose from.", errors: [(0, cards_1.unknownFlag)("help")] } },
21
+ ];
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MAIL_COMMANDS = void 0;
4
+ const cards_1 = require("./cards");
5
+ exports.MAIL_COMMANDS = [
6
+ { name: "mail backfill-indexes", effect: "private", summary: "Rebuild the mail indexes for an agent." },
7
+ { name: "mail sweep-orphans", effect: "private", summary: "Delete unreferenced encrypted raw mail (dry run unless --live)." },
8
+ { name: "mail import-mbox", effect: "private", summary: "Import an MBOX export into the agent's mail." },
9
+ { name: "mailbox", effect: "private", readOnly: true, summary: "Show the agent's mailbox.", ax: { id: "cli:mailbox", group: "mail", effect: "read", when: "Get the local web address where a person can read the agent's mail in a browser.", errors: [(0, cards_1.unknownFlag)("mailbox"), (0, cards_1.daemonDown)("mailbox")], aliases: ["outlook"] } },
10
+ ];
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MIND_COMMANDS = void 0;
4
+ const cards_1 = require("./cards");
5
+ exports.MIND_COMMANDS = [
6
+ { name: "chat", effect: "private", summary: "Open an interactive chat with an agent." },
7
+ { name: "event submit", effect: "others", summary: "Submit an event that can wake the agent and reach other people." },
8
+ { name: "msg", effect: "others", summary: "Send a message to another agent." },
9
+ { name: "nerves-review", effect: "private", readOnly: true, summary: "Review the runtime's nerves events." },
10
+ { name: "private decisions", effect: "private", readOnly: true, summary: "List an agent's recent private decisions." },
11
+ { name: "private status", effect: "private", readOnly: true, summary: "Show an agent's private status.", ax: { id: "cli:private status", group: "mind", effect: "read", when: "See the inner runtime's cadence, its last wake, open return obligations and how much the diary holds.", errors: [(0, cards_1.unknownFlag)("private status")] } },
12
+ { name: "thoughts", effect: "private", readOnly: true, summary: "Show an agent's recent thoughts.", ax: { id: "cli:thoughts", group: "mind", effect: "read", when: "Read the private runtime's recent turns to understand what the agent is mulling; --follow streams new ones live.", errors: [(0, cards_1.unknownFlag)("thoughts")] } },
13
+ { name: "work card", effect: "private", readOnly: true, summary: "Show the agent's work card." },
14
+ { name: "work gauntlet", effect: "private", readOnly: true, summary: "Show the agent's work gauntlet." },
15
+ { name: "work sentinel", effect: "private", readOnly: true, summary: "Show the agent's work sentinel." },
16
+ { name: "inner", effect: "private", readOnly: true, hidden: true, summary: "The older name of private status.", ax: { id: "cli:inner", group: "mind", effect: "read", when: "Kept so existing scripts still run; it prints a note to use private status, then the same answer private status gives.", errors: [(0, cards_1.unknownFlag)("inner")] } },
17
+ ];
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PRESENCE_COMMANDS = void 0;
4
+ exports.PRESENCE_COMMANDS = [
5
+ { name: "voice join", effect: "others", summary: "Join a voice call as the agent." },
6
+ { name: "voice leave", effect: "others", summary: "Leave a voice call." },
7
+ { name: "voice status", effect: "private", readOnly: true, summary: "Show the agent's voice status." },
8
+ { name: "bluebubbles context-smoke", effect: "private", summary: "Check the context a BlueBubbles message would get." },
9
+ { name: "bluebubbles host", effect: "private", summary: "Install, check or repair the BlueBubbles host." },
10
+ { name: "bluebubbles replay", effect: "private", summary: "Replay a BlueBubbles message." },
11
+ ];
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PROVIDERS_COMMANDS = void 0;
4
+ const cards_1 = require("./cards");
5
+ exports.PROVIDERS_COMMANDS = [
6
+ { name: "auth", effect: "private", summary: "Store or check provider credentials for an agent." },
7
+ { name: "auth verify", effect: "private", readOnly: true, summary: "Check that an agent's provider credentials work.", ax: { id: "cli:auth verify", group: "providers", effect: "read", when: "After storing or rotating a key, test each credential live without changing any of them.", errors: [(0, cards_1.unknownFlag)("auth verify"), ...(0, cards_1.agentErrors)("auth verify")] } },
8
+ { name: "account ensure", effect: "private", summary: "Make sure an agent has its account and mail keys." },
9
+ { name: "check", effect: "private", readOnly: true, summary: "Check an agent's provider lane.", example: "check --lane inner", ax: { id: "cli:check", group: "providers", effect: "read", when: "Make one live call on the outward or inner lane to learn whether the agent can think right now; it records the result as that lane's readiness.", errors: [(0, cards_1.usageError)("check", "needs --lane outward or --lane inner.", "Add --lane outward for the person-facing lane or --lane inner for the agent's own."), (0, cards_1.unknownFlag)("check"), ...(0, cards_1.agentErrors)("check")] } },
10
+ { name: "connect", effect: "private", summary: "Guide setup of an integration or local sense." },
11
+ { name: "provider refresh", effect: "private", summary: "Refresh the daemon's cached provider credentials." },
12
+ { name: "use", effect: "private", summary: "Choose the provider and model for a lane." },
13
+ { name: "config models", effect: "private", readOnly: true, summary: "List the models the agent's provider offers.", ax: { id: "cli:config models", group: "providers", effect: "read", when: "Before choosing a model with config model, list the ids the GitHub Copilot account offers.", errors: [(0, cards_1.unknownFlag)("config models"), ...(0, cards_1.agentErrors)("config models")] } },
14
+ ];
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RSVP_COMMANDS = void 0;
4
+ exports.RSVP_COMMANDS = [
5
+ { name: "rsvp", effect: "private", summary: "Work with RSVP events." },
6
+ ];
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SHEPHERD_COMMANDS = void 0;
4
+ exports.SHEPHERD_COMMANDS = [];
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VAULT_COMMANDS = void 0;
4
+ const cards_1 = require("./cards");
5
+ exports.VAULT_COMMANDS = [
6
+ { name: "vault config set", effect: "private", summary: "Set a vault config value." },
7
+ { name: "vault config status", effect: "private", readOnly: true, summary: "Show the vault config.", ax: { id: "cli:vault config status", group: "vault", effect: "read", when: "See which config keys are set at agent or machine scope, values hidden, before changing one.", errors: [(0, cards_1.unknownFlag)("vault config status"), ...(0, cards_1.agentErrors)("vault config status")] } },
8
+ { name: "vault create", effect: "private", summary: "Create an agent's vault." },
9
+ { name: "vault item list", effect: "private", readOnly: true, summary: "List vault items.", ax: { id: "cli:vault item list", group: "vault", effect: "read", when: "Find stored item paths, optionally under a --prefix, to pass as --item to another vault command.", errors: [(0, cards_1.unknownFlag)("vault item list"), ...(0, cards_1.agentErrors)("vault item list")] } },
10
+ { name: "vault item set", effect: "private", summary: "Set a vault item's secret field." },
11
+ { name: "vault item status", effect: "private", readOnly: true, summary: "Show a vault item's status.", ax: { id: "cli:vault item status", group: "vault", effect: "read", when: "Check that one stored item exists and which field names it has, never revealing secret values.", errors: [(0, cards_1.usageError)("vault item status", "needs --item <path>, the item to look at.", "Find the path with ouro vault item list, then pass it as --item."), (0, cards_1.unknownFlag)("vault item status"), ...(0, cards_1.agentErrors)("vault item status")] } },
12
+ { name: "vault ops porkbun set", effect: "private", summary: "Store the Porkbun account for DNS work.", ax: { id: "cli:vault ops porkbun set", group: "vault", effect: "write", when: "Before DNS work on a Porkbun domain, save that registrar account's API key pair, entered at a hidden prompt.", errors: [(0, cards_1.usageError)("vault ops porkbun set", "needs --account <account>, the Porkbun account the key belongs to.", "Pass --account with the account name, such as the login email."), (0, cards_1.unknownFlag)("vault ops porkbun set"), ...(0, cards_1.agentErrors)("vault ops porkbun set")] } },
13
+ { name: "vault ops porkbun status", effect: "private", readOnly: true, summary: "Show the Porkbun account status.", ax: { id: "cli:vault ops porkbun status", group: "vault", effect: "read", when: "See which Porkbun registrar accounts have API keys saved, or with --account whether one does, secrets hidden.", errors: [(0, cards_1.usageError)("vault ops porkbun status", "takes only --agent and --account; another word follows it.", "Drop the extra word, or pass it as --account <account>."), (0, cards_1.unknownFlag)("vault ops porkbun status"), ...(0, cards_1.agentErrors)("vault ops porkbun status")] } },
14
+ { name: "vault recover", effect: "private", summary: "Recover an agent's vault from exported keys." },
15
+ { name: "vault replace", effect: "private", summary: "Replace an agent's vault." },
16
+ { name: "vault status", effect: "private", readOnly: true, summary: "Show the vault's status.", ax: { id: "cli:vault status", group: "vault", effect: "read", when: "Learn whether secrets can be read on this machine: unlocked or locked, and which local store holds the key.", errors: [(0, cards_1.unknownFlag)("vault status"), ...(0, cards_1.agentErrors)("vault status")] } },
17
+ { name: "vault unlock", effect: "private", summary: "Unlock an agent's vault." },
18
+ ];
@@ -593,13 +593,13 @@ async function resolveMissingAgentName(deps, failureMode, candidateOverride) {
593
593
  }
594
594
  const discoveredAgents = normalizeCliAgentNames(candidateOverride ?? await listCliAgents(deps));
595
595
  if (discoveredAgents.length === 0) {
596
- return { ok: false, message: noAgentsFoundMessage(), failureMode };
596
+ return { ok: false, code: "no-agent", message: noAgentsFoundMessage(), failureMode };
597
597
  }
598
598
  if (discoveredAgents.length === 1) {
599
599
  return { ok: true, agent: discoveredAgents[0] };
600
600
  }
601
601
  if (!deps.promptInput) {
602
- return { ok: false, message: multipleAgentsFoundMessage(discoveredAgents), failureMode };
602
+ return { ok: false, code: "which-agent", message: multipleAgentsFoundMessage(discoveredAgents), failureMode };
603
603
  }
604
604
  const answer = await deps.promptInput([
605
605
  "Which agent should this use?",
@@ -608,7 +608,7 @@ async function resolveMissingAgentName(deps, failureMode, candidateOverride) {
608
608
  ].join("\n"));
609
609
  const selectedAgent = resolveSelectedCliAgent(answer, discoveredAgents);
610
610
  if (!selectedAgent) {
611
- return { ok: false, message: invalidAgentSelectionMessage(discoveredAgents), failureMode };
611
+ return { ok: false, code: "which-agent", message: invalidAgentSelectionMessage(discoveredAgents), failureMode };
612
612
  }
613
613
  return { ok: true, agent: selectedAgent };
614
614
  }
@@ -706,6 +706,21 @@ function formatDaemonStatusJsonOutput(response) {
706
706
  ...(response.error ? { error: response.error } : {}),
707
707
  }, null, 2);
708
708
  }
709
+ /**
710
+ * The answer when a command needs the daemon and it isn't running: the `daemon-down` error its Ouro AX card names.
711
+ */
712
+ /** The command needs the running daemon and it isn't up: a failure (exit 1) with the `daemon-down` code its card names. */
713
+ function daemonDown(kind) {
714
+ const message = "daemon unavailable — start with `ouro up` first";
715
+ (0, runtime_1.emitNervesEvent)({
716
+ level: "warn",
717
+ component: "daemon",
718
+ event: "daemon.cli_daemon_down",
719
+ message: "a CLI command needed the daemon and it was not running",
720
+ meta: { command: kind, code: "daemon-down" },
721
+ });
722
+ throw Object.assign(new Error(message), { code: "daemon-down" });
723
+ }
709
724
  function daemonUnavailableStatusJsonOutput(socketPath, healthFilePath) {
710
725
  return JSON.stringify({
711
726
  ok: false,
@@ -6844,7 +6859,10 @@ async function runOuroCli(args, deps = (0, cli_defaults_1.createDefaultOuroCliDe
6844
6859
  return "";
6845
6860
  }
6846
6861
  }
6847
- throw parseError;
6862
+ // Every other error the parser throws is about the words it was given; the cards name it `usage`.
6863
+ const refusal = parseError;
6864
+ refusal.code ??= "usage";
6865
+ throw refusal;
6848
6866
  }
6849
6867
  const resolvedCommand = await resolveCommandAgent(parsedCommand, deps);
6850
6868
  if (!resolvedCommand.ok) {
@@ -6852,7 +6870,7 @@ async function runOuroCli(args, deps = (0, cli_defaults_1.createDefaultOuroCliDe
6852
6870
  deps.writeStdout(resolvedCommand.message);
6853
6871
  return resolvedCommand.message;
6854
6872
  }
6855
- throw new Error(resolvedCommand.message);
6873
+ throw Object.assign(new Error(resolvedCommand.message), { code: resolvedCommand.code });
6856
6874
  }
6857
6875
  let command = resolvedCommand.command;
6858
6876
  if (command.kind === "hook") {
@@ -7930,9 +7948,7 @@ async function runOuroCli(args, deps = (0, cli_defaults_1.createDefaultOuroCliDe
7930
7948
  /* v8 ignore start — error path: daemon not running */
7931
7949
  }
7932
7950
  catch {
7933
- const message = "daemon unavailable — start with `ouro up` first";
7934
- deps.writeStdout(message);
7935
- return message;
7951
+ daemonDown(command.kind);
7936
7952
  }
7937
7953
  /* v8 ignore stop */
7938
7954
  const payload = (0, cli_render_1.parseStatusPayload)(status.data);
@@ -8351,9 +8367,7 @@ async function runOuroCli(args, deps = (0, cli_defaults_1.createDefaultOuroCliDe
8351
8367
  });
8352
8368
  }
8353
8369
  catch {
8354
- const message = "daemon unavailable — start with `ouro up` first";
8355
- deps.writeStdout(message);
8356
- return message;
8370
+ daemonDown(command.kind);
8357
8371
  }
8358
8372
  if (!response.ok) {
8359
8373
  const message = response.error ?? "unknown error";
@@ -8375,9 +8389,7 @@ async function runOuroCli(args, deps = (0, cli_defaults_1.createDefaultOuroCliDe
8375
8389
  response = await deps.sendCommand(deps.socketPath, daemonCommand);
8376
8390
  }
8377
8391
  catch {
8378
- const message = "daemon unavailable — start with `ouro up` first";
8379
- deps.writeStdout(message);
8380
- return message;
8392
+ daemonDown(command.kind);
8381
8393
  }
8382
8394
  if (!response.ok) {
8383
8395
  const message = response.error ?? "unknown error";
@@ -84,15 +84,15 @@ function matchCommand(args) {
84
84
  const found = SHAPES.filter((shape) => shape.words.every((word, index) => args[index] === word)).sort((a, b) => b.words.length - a.words.length);
85
85
  return found.length > 0 ? found[0] : null;
86
86
  }
87
- function refuse(name, message) {
87
+ function refuse(name, code, message) {
88
88
  (0, runtime_1.emitNervesEvent)({
89
89
  level: "warn",
90
90
  component: "daemon",
91
91
  event: "daemon.cli_flag_gate_refused",
92
92
  message: "the flag gate refused a command",
93
- meta: { command: name },
93
+ meta: { command: name, code },
94
94
  });
95
- return { kind: "refuse", message };
95
+ return { kind: "refuse", code, message };
96
96
  }
97
97
  /** Checks a command line against its declaration; a pass returns the words the legacy dispatcher should read. */
98
98
  function gateCommandArgs(args) {
@@ -127,7 +127,7 @@ function gateCommandArgs(args) {
127
127
  const fix = suggestion
128
128
  ? `use ${suggestion}`
129
129
  : `drop ${token}; \`ouro ${name} --help\` lists its flags`;
130
- return refuse(name, `Unknown flag ${token} for "ouro ${name}". Fix: ${fix}.`);
130
+ return refuse(name, "unknown-flag", `Unknown flag ${token} for "ouro ${name}". Fix: ${fix}.`);
131
131
  }
132
132
  if (others) {
133
133
  const valued = new Set([...GLOBAL_VALUE_FLAGS, ...[...flags].filter(([, takes]) => takes).map(([flag]) => flag)]);
@@ -142,10 +142,10 @@ function gateCommandArgs(args) {
142
142
  extra++;
143
143
  }
144
144
  if (shape.positionals === 0 && extra > 0) {
145
- return refuse(name, `"ouro ${name}" takes no words after its command. Fix: run \`ouro ${name} --help\` and drop the extra words.`);
145
+ return refuse(name, "extra-words", `"ouro ${name}" takes no words after its command. Fix: run \`ouro ${name} --help\` and drop the extra words.`);
146
146
  }
147
147
  if (!rest.includes("--why") && !rest.includes("--why-file")) {
148
- return refuse(name, `ouro ${name} needs --why: other people will see this, so say who asked you and what they said. Fix: add --why "<who asked you, and what they said>" to the command.`);
148
+ return refuse(name, "needs-why", `ouro ${name} needs --why: other people will see this, so say who asked you and what they said. Fix: add --why "<who asked you, and what they said>" to the command.`);
149
149
  }
150
150
  if (rest.includes("--dry-run")) {
151
151
  const json = rest.includes("--json");
@@ -107,6 +107,12 @@ exports.COMMAND_REGISTRY = {
107
107
  usage: "ouro doctor",
108
108
  example: "ouro doctor",
109
109
  },
110
+ help: {
111
+ category: "Lifecycle",
112
+ description: "Show the commands, or one command's help; --json lists each with its card",
113
+ usage: "ouro help [<command>] [--json]",
114
+ example: "ouro help --json",
115
+ },
110
116
  mailbox: {
111
117
  category: "Agents",
112
118
  description: "Show the agent's current mailbox overview",
@@ -1,127 +1,96 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CLI_EXIT_CODES = exports.CLI_COMMANDS = void 0;
3
+ exports.CLI_EXIT_CODES = exports.CLI_ENTRY_POINTS = exports.CLI_COMMANDS = exports.serverErrors = void 0;
4
+ exports.helpEntry = helpEntry;
5
+ exports.entryPointHelp = entryPointHelp;
4
6
  exports.cliHelpJson = cliHelpJson;
5
7
  // The commands of the ouro CLI, declared once: the names `ouro help --json` lists and the X-ray's inventory reads.
6
8
  const runtime_1 = require("../../nerves/runtime");
7
- const PRIVATE = "private";
8
- const OTHERS = "others";
9
+ const lifecycle_1 = require("./cli-commands/lifecycle");
10
+ const providers_1 = require("./cli-commands/providers");
11
+ const vault_1 = require("./cli-commands/vault");
12
+ const friends_1 = require("./cli-commands/friends");
13
+ const habits_1 = require("./cli-commands/habits");
14
+ const mind_1 = require("./cli-commands/mind");
15
+ const mail_1 = require("./cli-commands/mail");
16
+ const coding_tools_1 = require("./cli-commands/coding-tools");
17
+ const a2a_1 = require("./cli-commands/a2a");
18
+ const desk_1 = require("./cli-commands/desk");
19
+ const presence_1 = require("./cli-commands/presence");
20
+ const shepherd_1 = require("./cli-commands/shepherd");
21
+ const rsvp_1 = require("./cli-commands/rsvp");
22
+ const dns_1 = require("./cli-commands/dns");
23
+ /** The CLI-level card: what words no command has answer. */
24
+ exports.serverErrors = [
25
+ { code: "unknown-door", means: "No ouro command starts with those words; the error suggests the nearest one.", fix: "Run the suggested command if it is the one you meant; otherwise run ouro help --json and pick by summary." },
26
+ ];
9
27
  exports.CLI_COMMANDS = [
10
- { name: "auth", effect: PRIVATE, summary: "Store or check provider credentials for an agent." },
11
- { name: "auth verify", effect: PRIVATE, readOnly: true, summary: "Check that an agent's provider credentials work." },
12
- { name: "account ensure", effect: PRIVATE, summary: "Make sure an agent has its account and mail keys." },
13
- { name: "chat", effect: PRIVATE, summary: "Open an interactive chat with an agent." },
14
- { name: "check", effect: PRIVATE, readOnly: true, summary: "Check an agent's provider lane." },
15
- { name: "clone", effect: PRIVATE, summary: "Clone an agent bundle from a remote." },
16
- { name: "connect", effect: PRIVATE, summary: "Guide setup of an integration or local sense." },
17
- { name: "dev", effect: PRIVATE, summary: "Run the daemon from this checkout, rebuilding as it goes." },
18
- { name: "dns backup", effect: PRIVATE, summary: "Back up the DNS records of a binding." },
19
- { name: "dns plan", effect: PRIVATE, readOnly: true, summary: "Show the DNS changes a binding would make." },
20
- { name: "dns apply", effect: OTHERS, summary: "Apply DNS changes that other people on the internet can reach." },
21
- { name: "dns verify", effect: PRIVATE, readOnly: true, summary: "Check that the DNS records are live." },
22
- { name: "dns rollback", effect: PRIVATE, summary: "Restore the DNS records from a backup." },
23
- { name: "dns certificate", effect: PRIVATE, summary: "Issue or check a certificate for a binding." },
24
- { name: "doctor", effect: PRIVATE, readOnly: true, summary: "Check the health of this machine's Ouro install." },
25
- { name: "down", effect: PRIVATE, summary: "Stop the daemon." },
26
- { name: "event submit", effect: OTHERS, summary: "Submit an event that can wake the agent and reach other people." },
27
- { name: "friend create", effect: PRIVATE, summary: "Add a friend the agent knows." },
28
- { name: "friend link", effect: PRIVATE, summary: "Link a friend to an external account." },
29
- { name: "friend list", effect: PRIVATE, readOnly: true, summary: "List the friends this agent knows." },
30
- { name: "friend show", effect: PRIVATE, readOnly: true, summary: "Show one friend." },
31
- { name: "friend unlink", effect: PRIVATE, summary: "Remove a link between a friend and an external account." },
32
- { name: "friend update", effect: PRIVATE, summary: "Change a friend's trust, admission or initiative." },
33
- { name: "gateway serve", effect: OTHERS, summary: "Serve the gateway that other agents connect to." },
34
- { name: "habit cancel", effect: PRIVATE, summary: "Cancel a habit's pending run." },
35
- { name: "habit create", effect: PRIVATE, summary: "Create a habit that runs on a cadence." },
36
- { name: "habit inspect", effect: PRIVATE, readOnly: true, summary: "Show one habit run." },
37
- { name: "habit list", effect: PRIVATE, readOnly: true, summary: "List the agent's habits." },
38
- { name: "habit probe", effect: PRIVATE, readOnly: true, summary: "Check a habit without sending anything." },
39
- { name: "habit runs", effect: PRIVATE, readOnly: true, summary: "List recent habit runs." },
40
- { name: "habit summary", effect: PRIVATE, readOnly: true, summary: "Summarise a habit run." },
41
- { name: "hatch", effect: PRIVATE, summary: "Create a new agent." },
42
- { name: "link", effect: PRIVATE, summary: "Link an agent to a friend's external account." },
43
- { name: "logs", effect: PRIVATE, readOnly: true, summary: "Show the daemon's recent logs." },
44
- { name: "mail backfill-indexes", effect: PRIVATE, summary: "Rebuild the mail indexes for an agent." },
45
- { name: "mail sweep-orphans", effect: PRIVATE, summary: "Delete unreferenced encrypted raw mail (dry run unless --live)." },
46
- { name: "mail import-mbox", effect: PRIVATE, summary: "Import an MBOX export into the agent's mail." },
47
- { name: "mailbox", effect: PRIVATE, readOnly: true, summary: "Show the agent's mailbox." },
48
- { name: "mcp call", effect: PRIVATE, summary: "Call a tool on an MCP server." },
49
- { name: "mcp doctor", effect: PRIVATE, readOnly: true, summary: "Check an agent's MCP servers." },
50
- { name: "mcp list", effect: PRIVATE, readOnly: true, summary: "List the MCP servers." },
51
- { name: "msg", effect: OTHERS, summary: "Send a message to another agent." },
52
- { name: "nerves-review", effect: PRIVATE, readOnly: true, summary: "Review the runtime's nerves events." },
53
- { name: "poke", effect: PRIVATE, summary: "Wake an agent for a task or habit." },
54
- { name: "private decisions", effect: PRIVATE, readOnly: true, summary: "List an agent's recent private decisions." },
55
- { name: "private status", effect: PRIVATE, readOnly: true, summary: "Show an agent's private status." },
56
- { name: "provider refresh", effect: PRIVATE, summary: "Refresh the daemon's cached provider credentials." },
57
- { name: "repair", effect: PRIVATE, summary: "Repair an agent's setup." },
58
- { name: "rollback", effect: PRIVATE, summary: "Roll the install back to an earlier version." },
59
- { name: "rsvp", effect: PRIVATE, summary: "Work with RSVP events." },
60
- { name: "session list", effect: PRIVATE, readOnly: true, summary: "List the agent's sessions." },
61
- { name: "status", effect: PRIVATE, readOnly: true, summary: "Show the daemon and an agent's status." },
62
- { name: "stop", effect: PRIVATE, summary: "Stop the daemon." },
63
- { name: "sync", effect: PRIVATE, summary: "Sync an agent bundle with its remote." },
64
- { name: "thoughts", effect: PRIVATE, readOnly: true, summary: "Show an agent's recent thoughts." },
65
- { name: "use", effect: PRIVATE, summary: "Choose the provider and model for a lane." },
66
- { name: "vault config set", effect: PRIVATE, summary: "Set a vault config value." },
67
- { name: "vault config status", effect: PRIVATE, readOnly: true, summary: "Show the vault config." },
68
- { name: "vault create", effect: PRIVATE, summary: "Create an agent's vault." },
69
- { name: "vault item list", effect: PRIVATE, readOnly: true, summary: "List vault items." },
70
- { name: "vault item set", effect: PRIVATE, summary: "Set a vault item's secret field." },
71
- { name: "vault item status", effect: PRIVATE, readOnly: true, summary: "Show a vault item's status." },
72
- { name: "vault ops porkbun set", effect: PRIVATE, summary: "Store the Porkbun account for DNS work." },
73
- { name: "vault ops porkbun status", effect: PRIVATE, readOnly: true, summary: "Show the Porkbun account status." },
74
- { name: "vault recover", effect: PRIVATE, summary: "Recover an agent's vault from exported keys." },
75
- { name: "vault replace", effect: PRIVATE, summary: "Replace an agent's vault." },
76
- { name: "vault status", effect: PRIVATE, readOnly: true, summary: "Show the vault's status." },
77
- { name: "vault unlock", effect: PRIVATE, summary: "Unlock an agent's vault." },
78
- { name: "versions", effect: PRIVATE, readOnly: true, summary: "List the installed and available versions." },
79
- { name: "voice join", effect: OTHERS, summary: "Join a voice call as the agent." },
80
- { name: "voice leave", effect: OTHERS, summary: "Leave a voice call." },
81
- { name: "voice status", effect: PRIVATE, readOnly: true, summary: "Show the agent's voice status." },
82
- { name: "whoami", effect: PRIVATE, readOnly: true, summary: "Show which agent this is." },
83
- { name: "work card", effect: PRIVATE, readOnly: true, summary: "Show the agent's work card." },
84
- { name: "work gauntlet", effect: PRIVATE, readOnly: true, summary: "Show the agent's work gauntlet." },
85
- { name: "work sentinel", effect: PRIVATE, readOnly: true, summary: "Show the agent's work sentinel." },
86
- { name: "a2a card", effect: PRIVATE, readOnly: true, summary: "Show the agent's A2A card." },
87
- { name: "a2a delegated-commands grant", effect: OTHERS, summary: "Let a friend's agent run delegated commands." },
88
- { name: "a2a delegated-commands list", effect: PRIVATE, readOnly: true, summary: "List the delegated command grants." },
89
- { name: "a2a delegated-commands revoke", effect: PRIVATE, summary: "Revoke a delegated command grant." },
90
- { name: "a2a escalation grant", effect: OTHERS, summary: "Let a friend escalate to the person." },
91
- { name: "a2a escalation list", effect: PRIVATE, readOnly: true, summary: "List escalation grants." },
92
- { name: "a2a escalation revoke", effect: PRIVATE, summary: "Revoke an escalation grant." },
93
- { name: "a2a identity", effect: PRIVATE, readOnly: true, summary: "Show the agent's A2A identity." },
94
- { name: "a2a message", effect: OTHERS, summary: "Send an A2A message to another agent." },
95
- { name: "a2a onboard", effect: PRIVATE, summary: "Onboard another agent from its card." },
96
- { name: "a2a outbox ack", effect: OTHERS, summary: "Acknowledge messages another agent sent." },
97
- { name: "a2a outbox list", effect: PRIVATE, readOnly: true, summary: "List the A2A outbox." },
98
- { name: "a2a outbox resolve", effect: OTHERS, summary: "Resolve a report another agent filed." },
99
- { name: "a2a serve", effect: OTHERS, summary: "Serve the agent's A2A endpoint to other agents." },
100
- { name: "bluebubbles context-smoke", effect: PRIVATE, summary: "Check the context a BlueBubbles message would get." },
101
- { name: "bluebubbles host", effect: PRIVATE, summary: "Install, check or repair the BlueBubbles host." },
102
- { name: "bluebubbles replay", effect: PRIVATE, summary: "Replay a BlueBubbles message." },
28
+ ...lifecycle_1.LIFECYCLE_COMMANDS,
29
+ ...providers_1.PROVIDERS_COMMANDS,
30
+ ...vault_1.VAULT_COMMANDS,
31
+ ...friends_1.FRIENDS_COMMANDS,
32
+ ...habits_1.HABITS_COMMANDS,
33
+ ...mind_1.MIND_COMMANDS,
34
+ ...mail_1.MAIL_COMMANDS,
35
+ ...coding_tools_1.CODING_TOOLS_COMMANDS,
36
+ ...a2a_1.A2A_COMMANDS,
37
+ ...desk_1.DESK_COMMANDS,
38
+ ...presence_1.PRESENCE_COMMANDS,
39
+ ...shepherd_1.SHEPHERD_COMMANDS,
40
+ ...rsvp_1.RSVP_COMMANDS,
41
+ ...dns_1.DNS_COMMANDS,
103
42
  ];
43
+ /**
44
+ * Programs an agent's shell can start as `node <path>` beside the ouro command, such as the daemon and the senses.
45
+ * The census finds them by their `process.argv` reads; each is declared here with its card. `help --json` lists them
46
+ * as `entryPoints`, apart from the commands, because they don't start with `ouro`.
47
+ */
48
+ exports.CLI_ENTRY_POINTS = [];
104
49
  exports.CLI_EXIT_CODES = [
105
50
  { code: 0, name: "ok", meaning: "The command did what it was asked." },
106
51
  { code: 1, name: "error", meaning: "The command failed or refused; the output says why and how to fix it." },
107
52
  ];
108
- /** The help as data: every declared command with its effect, and the exit codes. */
53
+ /**
54
+ * What `help --json` says about one declaration: the card's fields beside the name, effect and summary. A command's
55
+ * usage starts with `ouro`; an entry point's is its own command line.
56
+ */
57
+ function helpEntry(command, usage = `ouro ${command.name}`) {
58
+ return {
59
+ name: command.name,
60
+ effect: command.effect,
61
+ summary: command.summary,
62
+ usage: [usage],
63
+ ...(command.readOnly ? { readOnly: true } : {}),
64
+ ...(command.hidden ? { hidden: true } : {}),
65
+ ...(command.example ? { example: `ouro ${command.example}` } : {}),
66
+ ...(command.ax
67
+ ? {
68
+ group: command.ax.group,
69
+ when: command.ax.when,
70
+ consent: command.ax.effect,
71
+ errors: command.ax.errors,
72
+ ...(command.ax.aliases ? { aliases: command.ax.aliases } : {}),
73
+ }
74
+ : {}),
75
+ };
76
+ }
77
+ /** An entry point's help: its usage is its own command line, not an ouro command. */
78
+ function entryPointHelp(entry) {
79
+ return helpEntry(entry, entry.name);
80
+ }
81
+ /** The help as data: every declared command and entry point with its effect and card, and the exit codes. */
109
82
  function cliHelpJson() {
110
83
  (0, runtime_1.emitNervesEvent)({
111
84
  component: "daemon",
112
85
  event: "daemon.cli_help_json",
113
86
  message: "printing ouro help as data",
114
- meta: { commands: exports.CLI_COMMANDS.length },
87
+ meta: { commands: exports.CLI_COMMANDS.length, entryPoints: exports.CLI_ENTRY_POINTS.length },
115
88
  });
116
89
  return JSON.stringify({
117
90
  tool: "ouro",
118
- commands: exports.CLI_COMMANDS.map((command) => ({
119
- name: command.name,
120
- effect: command.effect,
121
- summary: command.summary,
122
- usage: [`ouro ${command.name}`],
123
- ...(command.readOnly ? { readOnly: true } : {}),
124
- })),
91
+ commands: exports.CLI_COMMANDS.map((command) => helpEntry(command)),
92
+ entryPoints: exports.CLI_ENTRY_POINTS.map(entryPointHelp),
125
93
  exitCodes: exports.CLI_EXIT_CODES,
94
+ errors: exports.serverErrors,
126
95
  }, null, 2);
127
96
  }
@@ -349,10 +349,14 @@ function usage() {
349
349
  " ouro stop|down|status|logs|hatch",
350
350
  " ouro status --agent <name>",
351
351
  " ouro use [--agent <name>] --lane outward|inner --provider <provider> --model <model> [--force]",
352
+ " ouro config model [--agent <name>] <model-name>",
353
+ " ouro config models [--agent <name>]",
352
354
  " ouro check [--agent <name>] --lane outward|inner",
353
355
  " ouro repair [--agent <name>]",
354
356
  " ouro provider refresh [--agent <name>]",
355
357
  " ouro mailbox [--json]",
358
+ " ouro help [<command>] [--json]",
359
+ " ouro changelog [--from <version>]",
356
360
  " ouro -v|--version",
357
361
  " ouro auth [--agent <name>] [--provider <provider>]",
358
362
  " ouro auth --agent <name> --provider anthropic --api-key-file <path> [--base-url <url>]",
@@ -3532,5 +3536,6 @@ function parseOuroCommand(args) {
3532
3536
  return parseRsvpCommand(args.slice(1));
3533
3537
  const suggestion = (0, cli_help_1.suggestCommand)(head);
3534
3538
  const hint = suggestion ? ` Did you mean '${suggestion}'?` : "";
3535
- throw new Error(`Unknown command '${args.join(" ")}'.${hint}\n${usage()}`);
3539
+ // The CLI's unknown-door card (cli-manifest.ts serverErrors) names this answer.
3540
+ throw Object.assign(new Error(`Unknown command '${args.join(" ")}'.${hint}\n${usage()}`), { code: "unknown-door" });
3536
3541
  }
@@ -21,8 +21,10 @@ else
21
21
  meta: { args: (0, cli_arg_redaction_1.redactCliArgs)(process.argv.slice(2)), compileCache: compile_cache_1.ouroCompileCacheDirectory },
22
22
  });
23
23
  const gate = (0, cli_gate_1.gateCommandArgs)(process.argv.slice(2));
24
+ // A failure ends with the code its Ouro AX card names (see `ouro help --json`), so an agent can look up the fix.
25
+ const withCode = (message, code) => (typeof code === "string" ? `${message}\ncode: ${code}\n` : `${message}\n`);
24
26
  if (gate.kind === "refuse") {
25
- process.stderr.write(`${gate.message}\n`);
27
+ process.stderr.write(withCode(gate.message, gate.code));
26
28
  process.exitCode = 1;
27
29
  }
28
30
  else if (gate.kind === "preview" || gate.kind === "help") {
@@ -31,13 +33,14 @@ else if (gate.kind === "preview" || gate.kind === "help") {
31
33
  else {
32
34
  void (0, daemon_cli_1.runOuroCli)(gate.args).catch((error) => {
33
35
  const message = error instanceof Error ? error.message : String(error);
34
- process.stderr.write(`${message}\n`);
36
+ const code = error instanceof Error ? error.code : undefined;
37
+ process.stderr.write(withCode(message, code));
35
38
  (0, runtime_1.emitNervesEvent)({
36
39
  level: "error",
37
40
  component: "daemon",
38
41
  event: "daemon.cli_entry_error",
39
42
  message: "ouro CLI entrypoint failed",
40
- meta: { error: message },
43
+ meta: typeof code === "string" ? { error: message, code } : { error: message },
41
44
  });
42
45
  process.exit(1);
43
46
  });
@@ -64,6 +64,8 @@ const DISPATCH_EXEMPT_PATTERNS = [
64
64
  "daemon/cli-render",
65
65
  "daemon/cli-help",
66
66
  "daemon/vault-items",
67
+ // The error-card builders the ouro commands' Ouro AX cards share: pure data, read by cli-manifest.
68
+ "daemon/cli-commands/cards",
67
69
  // Shared utility modules: pure helpers consumed by modules that own observability.
68
70
  "arc/json-store",
69
71
  "heart/mail-import-discovery",
@@ -9,6 +9,7 @@ exports.resolveToolDefinition = resolveToolDefinition;
9
9
  exports.approvalPolicyForToolName = approvalPolicyForToolName;
10
10
  exports.classifyApprovalForInvocation = classifyApprovalForInvocation;
11
11
  exports.approvalPolicyForInvocation = approvalPolicyForInvocation;
12
+ exports.readOnlyOuroShellCommands = readOnlyOuroShellCommands;
12
13
  exports.shellRiskProfile = shellRiskProfile;
13
14
  exports.riskProfileForTool = riskProfileForTool;
14
15
  exports.riskProfileForToolName = riskProfileForToolName;
@@ -45,6 +46,7 @@ const relationship_authorization_1 = require("./relationship-authorization");
45
46
  const tool_approval_1 = require("../heart/tool-approval");
46
47
  const tools_voice_local_1 = require("./tools-voice-local");
47
48
  const tools_sanctuary_host_1 = require("./tools-sanctuary-host");
49
+ const cli_manifest_1 = require("../heart/daemon/cli-manifest");
48
50
  function safeGetAgentRoot() {
49
51
  try {
50
52
  return (0, identity_1.getAgentRoot)();
@@ -289,44 +291,50 @@ async function approvalPolicyForInvocation(name, args, ctx) {
289
291
  return (await classifyApprovalForInvocation(name, args, ctx)).policy;
290
292
  }
291
293
  const findDefinition = resolveToolDefinition;
292
- const READ_ONLY_OURO_SHELL_COMMANDS = new Set([
293
- "help",
294
- "-h",
295
- "--help",
296
- "-v",
297
- "--version",
298
- "status",
299
- "whoami",
300
- "versions",
301
- "changelog",
302
- "mailbox",
303
- "inner",
304
- "thoughts",
305
- "check",
306
- "session list",
307
- "mcp list",
308
- "config models",
309
- "auth verify",
310
- "vault status",
311
- "vault config status",
312
- "vault item status",
313
- "vault item list",
314
- ]);
294
+ /** The flags that print ouro's help or version, which run nothing. */
295
+ const OURO_INFO_FLAGS = ["-h", "--help", "-v", "--version"];
296
+ /**
297
+ * The ouro commands a shell may run without an approval: those whose Ouro AX card in cli-manifest says
298
+ * `effect: "read"`, and the help and version flags. Generated from the cards, never kept by hand.
299
+ */
300
+ function readOnlyOuroShellCommands() {
301
+ return new Set([...cli_manifest_1.CLI_COMMANDS.filter((command) => command.ax?.effect === "read").map((command) => command.name), ...OURO_INFO_FLAGS]);
302
+ }
303
+ const READ_ONLY_OURO_SHELL_COMMANDS = readOnlyOuroShellCommands();
304
+ const DECLARED_OURO_COMMANDS = cli_manifest_1.CLI_COMMANDS.map((command) => command.name);
315
305
  function shellTokens(command) {
316
306
  return command.trim().split(/\s+/).filter(Boolean);
317
307
  }
308
+ /**
309
+ * The declared command a shell line names: the longest declaration whose words start it, as the CLI's gate reads it.
310
+ * A group's declaration (one with longer declarations under it) followed by another word names no command, since
311
+ * that word is an undeclared one under the group.
312
+ */
313
+ function declaredOuroCommand(words) {
314
+ for (let length = words.length; length > 0; length--) {
315
+ const name = words.slice(0, length).join(" ");
316
+ if (!DECLARED_OURO_COMMANDS.includes(name) && !OURO_INFO_FLAGS.includes(name))
317
+ continue;
318
+ const next = words[length];
319
+ const isGroup = DECLARED_OURO_COMMANDS.some((other) => other.startsWith(`${name} `));
320
+ return next !== undefined && !next.startsWith("-") && isGroup ? null : name;
321
+ }
322
+ return null;
323
+ }
324
+ /** Where a shell line starts another command: its start, after an operator, or inside a substitution. */
325
+ const OURO_AT_COMMAND_POSITION = /(^|&&|\|\||[;|`\n(])\s*ouro(\s|$)/;
326
+ const SHELL_CHAINING = /&&|\|\||[;|`\n]|\$\(/;
318
327
  function ouroShellRiskReason(command) {
328
+ // The read-only check below judges one ouro command; a line that also runs something else isn't one.
329
+ if (OURO_AT_COMMAND_POSITION.test(command) && SHELL_CHAINING.test(command)) {
330
+ return "shell line runs ouro beside other commands; run each ouro command alone so its own card decides.";
331
+ }
319
332
  const tokens = shellTokens(command);
320
333
  if (tokens[0] !== "ouro")
321
334
  return null;
322
335
  const first = tokens[1] ?? "";
323
- const second = tokens[2] ?? "";
324
- const third = tokens[3] ?? "";
325
- const twoWord = second ? `${first} ${second}` : first;
326
- const threeWord = third ? `${twoWord} ${third}` : twoWord;
327
- if (READ_ONLY_OURO_SHELL_COMMANDS.has(threeWord)
328
- || READ_ONLY_OURO_SHELL_COMMANDS.has(twoWord)
329
- || READ_ONLY_OURO_SHELL_COMMANDS.has(first)) {
336
+ const declared = declaredOuroCommand(tokens.slice(1));
337
+ if (declared && READ_ONLY_OURO_SHELL_COMMANDS.has(declared)) {
330
338
  return null;
331
339
  }
332
340
  const hint = first === "restart_runtime"
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1290",
3
+ "version": "0.1.0-alpha.1292",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@ouro.bot/cli",
9
- "version": "0.1.0-alpha.1290",
9
+ "version": "0.1.0-alpha.1292",
10
10
  "bundleDependencies": [
11
11
  "@ouro.bot/friends"
12
12
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1290",
3
+ "version": "0.1.0-alpha.1292",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },