@ouro.bot/cli 0.1.0-alpha.1307 → 0.1.0-alpha.1308

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,12 @@
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.1308",
6
+ "changes": [
7
+ "shell, shell_status, shell_tail and fetch_url have Ouro AX cards, with shell's approval prompt declared; their failures end with a code (command-failed, command-timed-out, command-not-started, process-not-found, invalid-url, private-address, http-error, fetch-failed), and shell_status, shell_tail and fetch_url state a low-risk profile."
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.1307",
6
12
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1307",
2
+ "runtimeVersion": "0.1.0-alpha.1308",
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.1307</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1308</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -73,6 +73,8 @@ const DISPATCH_EXEMPT_PATTERNS = [
73
73
  "heart/mail-import-discovery",
74
74
  "repertoire/api-client",
75
75
  "repertoire/github-client",
76
+ // The suffix that ends a tool's coded error; each tool module that uses it owns its own observability.
77
+ "repertoire/tool-error-code",
76
78
  "mind/embedding-provider",
77
79
  // Commerce utility module: error classes and pure helpers (no independent side effects).
78
80
  "repertoire/commerce-errors",
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withCode = withCode;
4
+ /**
5
+ * An error text a tool or the dispatcher returns, ending with the code its Ouro AX card names, so a model can look up
6
+ * the card's fix. The message stays first and unchanged; the code is a suffix. Pass the code as a literal: the AX
7
+ * census counts a card's code as raised only where it appears in the handler's file.
8
+ *
9
+ * It lives apart from tools-base so a tool module can use it without importing tools-base, which imports every tool
10
+ * module and so can't be loaded from one.
11
+ */
12
+ function withCode(message, code) {
13
+ return `${message} (code: ${code})`;
14
+ }
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tools = exports.baseToolDefinitions = exports.editFileReadTracker = exports.SELF_FRIEND_ID = exports.routineActionRequester = exports.renderInnerProgressStatus = exports.speakTool = exports.restTool = exports.settleTool = exports.observeTool = exports.ponderTool = void 0;
4
- exports.withCode = withCode;
3
+ exports.tools = exports.baseToolDefinitions = exports.editFileReadTracker = exports.withCode = exports.SELF_FRIEND_ID = exports.routineActionRequester = exports.renderInnerProgressStatus = exports.speakTool = exports.restTool = exports.settleTool = exports.observeTool = exports.ponderTool = void 0;
5
4
  exports.routineActionDenied = routineActionDenied;
6
5
  const runtime_1 = require("../nerves/runtime");
7
6
  const tools_files_1 = require("./tools-files");
@@ -48,14 +47,8 @@ var relationship_authorization_1 = require("./relationship-authorization");
48
47
  Object.defineProperty(exports, "routineActionRequester", { enumerable: true, get: function () { return relationship_authorization_1.routineActionRequester; } });
49
48
  /** The friend id of the agent talking to itself: every private-runtime turn (awaits and its own reflection) runs with this friend. */
50
49
  exports.SELF_FRIEND_ID = "self";
51
- /**
52
- * An error text a tool or the dispatcher returns, ending with the code its Ouro AX card names, so a model can look up
53
- * the card's fix. The message stays first and unchanged; the code is a suffix. Pass the code as a literal: the AX
54
- * census counts a card's code as raised only where it appears in the handler's file.
55
- */
56
- function withCode(message, code) {
57
- return `${message} (code: ${code})`;
58
- }
50
+ var tool_error_code_1 = require("./tool-error-code");
51
+ Object.defineProperty(exports, "withCode", { enumerable: true, get: function () { return tool_error_code_1.withCode; } });
59
52
  function routineActionDenied(reason) {
60
53
  const message = reason.slice(0, 500);
61
54
  (0, runtime_1.emitNervesEvent)({ component: "repertoire", event: "repertoire.routine_action_denied", message: "routine action denied", meta: { reason: message } });
@@ -42,6 +42,7 @@ const path = __importStar(require("path"));
42
42
  const shell_sessions_1 = require("./shell-sessions");
43
43
  const identity_1 = require("../heart/identity");
44
44
  const runtime_1 = require("../nerves/runtime");
45
+ const tool_error_code_1 = require("./tool-error-code");
45
46
  const tool_arguments_1 = require("./tool-arguments");
46
47
  const tool_limits_1 = require("./tool-limits");
47
48
  const MAX_BUFFER = 16 * 1024 * 1024;
@@ -60,9 +61,10 @@ function shellHome(ctx) {
60
61
  */
61
62
  /** A failed command as one result: how it ended, then stdout and stderr, each only when it printed something. */
62
63
  function shellFailureText(error, timeout, stdout, stderr) {
64
+ // The code goes on the first line, so it survives when a long failure is cut to fit.
63
65
  const ended = error.killed && error.signal
64
- ? `the command was stopped after ${timeout} ms (${String(error.signal)}); pass a larger timeout_ms or background: true for long work`
65
- : typeof error.code === "number" ? `the command exited with code ${error.code}` : `the command could not start: ${String(error.code ?? "unknown error")}`;
66
+ ? (0, tool_error_code_1.withCode)(`the command was stopped after ${timeout} ms (${String(error.signal)}); pass a larger timeout_ms or background: true for long work`, "command-timed-out")
67
+ : typeof error.code === "number" ? (0, tool_error_code_1.withCode)(`the command exited with code ${error.code}`, "command-failed") : (0, tool_error_code_1.withCode)(`the command could not start: ${String(error.code ?? "unknown error")}`, "command-not-started");
66
68
  const parts = [ended];
67
69
  if (stdout.trim())
68
70
  parts.push(`stdout:\n${stdout.trimEnd()}`);
@@ -193,6 +195,13 @@ exports.shellToolDefinitions = [
193
195
  return output;
194
196
  },
195
197
  summaryKeys: ["command"],
198
+ ax: { id: "tool:shell", group: "turn-shell", when: "Pick this to run a program or script in your home; for plain file reads and searches, read_file, grep and glob are safer.", effect: "consequential", confirm: "Approve shell with exact arguments <the call's arguments as JSON>?", errors: [
199
+ { code: "command-failed", means: "The command ran and exited non-zero; its stdout and stderr follow the first line.", fix: "Read stderr, fix the command or its input, and run it again." },
200
+ { code: "command-timed-out", means: "The command ran past its timeout and was stopped; whatever it printed follows.", fix: "Run it again with a larger timeout_ms, at most 600000, or with background: true and watch it with shell_status." },
201
+ { code: "command-not-started", means: "The shell couldn't start the command at all, so nothing ran.", fix: "Check the program's name and that it is installed, then run it again." },
202
+ { code: "guardrail-blocked", means: "The line writes to a protected path, names the sync key's folder, or runs a command this person isn't trusted for.", fix: "Change the command so it stays off protected paths, or run it from a chat with your owner." },
203
+ { code: "orientation-hold", means: "This turn is on a correction hold and the command changes things, so it waits.", fix: "Call orientation_get, settle what the person meant, then run the command if it is still right." },
204
+ ] },
196
205
  },
197
206
  {
198
207
  tool: {
@@ -214,10 +223,15 @@ exports.shellToolDefinitions = [
214
223
  }
215
224
  const session = (0, shell_sessions_1.getShellSession)(a.id, shellOwner(ctx));
216
225
  if (!session)
217
- return `process not found: ${a.id}`;
226
+ return (0, tool_error_code_1.withCode)(`process not found: ${a.id}`, "process-not-found");
218
227
  return JSON.stringify(session);
219
228
  },
220
229
  summaryKeys: ["id"],
230
+ riskProfile: { mutates: "none", risk: "low" },
231
+ ax: { id: "tool:shell_status", group: "turn-shell", when: "Pick this to learn whether a background shell you started is still running or how it ended; shell_tail shows its output.", effect: "read", idempotent: true, errors: [
232
+ { code: "process-not-found", means: "No background shell with that id belongs to you; a runtime restart forgets them all.", fix: "Call shell_status with no id to list yours, or start the command again." },
233
+ { code: "invalid-arguments", means: "id isn't text.", fix: "Call shell_status again with the id shell returned, or with no id to list them." },
234
+ ] },
221
235
  },
222
236
  {
223
237
  tool: {
@@ -240,9 +254,14 @@ exports.shellToolDefinitions = [
240
254
  return "id is required";
241
255
  const output = (0, shell_sessions_1.tailShellSession)(a.id, shellOwner(ctx));
242
256
  if (output === undefined)
243
- return `process not found: ${a.id}`;
257
+ return (0, tool_error_code_1.withCode)(`process not found: ${a.id}`, "process-not-found");
244
258
  return output || "(no output yet)";
245
259
  },
246
260
  summaryKeys: ["id"],
261
+ riskProfile: { mutates: "none", risk: "low" },
262
+ ax: { id: "tool:shell_tail", group: "turn-shell", when: "Pick this to read the latest lines a background shell you started has printed; shell_status says only whether it still runs.", effect: "read", idempotent: true, errors: [
263
+ { code: "process-not-found", means: "That id names no background shell of yours, often because the runtime restarted since it began.", fix: "List yours with shell_status, or run the command in the background again." },
264
+ { code: "invalid-arguments", means: "id is missing or isn't text.", fix: "Call shell_tail again with the id shell returned." },
265
+ ] },
247
266
  },
248
267
  ];
@@ -42,6 +42,7 @@ const https = __importStar(require("node:https"));
42
42
  const node_net_1 = require("node:net");
43
43
  const runtime_1 = require("../nerves/runtime");
44
44
  const tool_limits_1 = require("./tool-limits");
45
+ const tool_error_code_1 = require("./tool-error-code");
45
46
  const MAX_REDIRECTS = 5;
46
47
  /** Test hook: the request deadline. */
47
48
  exports.webTestHooks = { timeoutMs: 20_000 };
@@ -150,22 +151,22 @@ async function fetchPage(rawUrl, offset, exempt) {
150
151
  url = new URL(rawUrl);
151
152
  }
152
153
  catch {
153
- return `error: not a valid URL: ${rawUrl}`;
154
+ return (0, tool_error_code_1.withCode)(`error: not a valid URL: ${rawUrl}`, "invalid-url");
154
155
  }
155
156
  const signal = AbortSignal.timeout(exports.webTestHooks.timeoutMs);
156
157
  for (let hop = 0;; hop++) {
157
158
  if (url.protocol !== "http:" && url.protocol !== "https:")
158
- return `error: only http and https URLs can be fetched, not ${url.protocol}`;
159
+ return (0, tool_error_code_1.withCode)(`error: only http and https URLs can be fetched, not ${url.protocol}`, "invalid-url");
159
160
  const literal = url.hostname.replace(/^\[|\]$/g, "");
160
161
  if (!exempt && (0, node_net_1.isIP)(literal) && isPrivateAddress(literal))
161
- return `error: ${new RefusedError(url.hostname, literal).message}`;
162
+ return (0, tool_error_code_1.withCode)(`error: ${new RefusedError(url.hostname, literal).message}`, "private-address");
162
163
  const response = await get(url, exempt, signal);
163
164
  const status = response.statusCode;
164
165
  const location = response.headers.location;
165
166
  if (status >= 300 && status < 400 && location) {
166
167
  response.destroy();
167
168
  if (hop >= MAX_REDIRECTS)
168
- return `error: more than ${MAX_REDIRECTS} redirects fetching ${rawUrl}`;
169
+ return (0, tool_error_code_1.withCode)(`error: more than ${MAX_REDIRECTS} redirects fetching ${rawUrl}`, "fetch-failed");
169
170
  url = new URL(location, url);
170
171
  continue;
171
172
  }
@@ -175,7 +176,7 @@ async function fetchPage(rawUrl, offset, exempt) {
175
176
  }
176
177
  if (status < 200 || status >= 300) {
177
178
  response.destroy();
178
- return `error: HTTP ${status} fetching ${url.href}`;
179
+ return (0, tool_error_code_1.withCode)(`error: HTTP ${status} fetching ${url.href}`, "http-error");
179
180
  }
180
181
  const type = (response.headers["content-type"] ?? "text/plain").split(";")[0].trim().toLowerCase();
181
182
  const isHtml = type === "text/html" || type === "application/xhtml+xml";
@@ -220,11 +221,18 @@ exports.webToolDefinitions = [
220
221
  }
221
222
  catch (error) {
222
223
  if (error instanceof RefusedError)
223
- return `error: ${error.message}`;
224
+ return (0, tool_error_code_1.withCode)(`error: ${error.message}`, "private-address");
224
225
  const timedOut = error instanceof Error && (error.name === "TimeoutError" || error.name === "AbortError");
225
- return timedOut ? `error: timed out after ${exports.webTestHooks.timeoutMs / 1000} seconds fetching ${a.url}` : `error: could not fetch ${a.url}: ${error instanceof Error ? error.message : String(error)}`;
226
+ return (0, tool_error_code_1.withCode)(timedOut ? `error: timed out after ${exports.webTestHooks.timeoutMs / 1000} seconds fetching ${a.url}` : `error: could not fetch ${a.url}: ${error instanceof Error ? error.message : String(error)}`, "fetch-failed");
226
227
  }
227
228
  },
228
229
  summaryKeys: ["url"],
230
+ riskProfile: { mutates: "none", risk: "low" },
231
+ ax: { id: "tool:fetch_url", group: "turn-web", when: "Pick this to read one web page whose address you already have; to find pages about a subject first, use web_search.", effect: "read", idempotent: true, errors: [
232
+ { code: "invalid-url", means: "url isn't a full http or https address.", fix: "Send the whole address, starting with https://; read a local file with read_file instead." },
233
+ { code: "private-address", means: "The address leads to this machine or a private network, which only a family member may have fetched.", fix: "Fetch a public address, or ask a family member to have you fetch this one." },
234
+ { code: "http-error", means: "The site answered with an error status such as 404 or 403, shown in the message.", fix: "Check the address; for a 404, search for where the page moved." },
235
+ { code: "fetch-failed", means: "The page didn't arrive: the connection failed, it took over 20 seconds, or it redirected more than 5 times.", fix: "Try again once; if it fails again, use another source for the same facts." },
236
+ ] },
229
237
  },
230
238
  ];
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1307",
3
+ "version": "0.1.0-alpha.1308",
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.1307",
9
+ "version": "0.1.0-alpha.1308",
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.1307",
3
+ "version": "0.1.0-alpha.1308",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },