@ouro.bot/cli 0.1.0-alpha.1304 → 0.1.0-alpha.1305

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.1305",
6
+ "changes": [
7
+ "When the harness refuses a tool call before it runs (an unknown tool, bad arguments, a relationship or guardrail block, an orientation hold, a changed tool, missing commerce authority), the refusal now ends with a code, such as (code: invalid-arguments), that the tool's Ouro AX card can explain."
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.1304",
6
12
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1304",
2
+ "runtimeVersion": "0.1.0-alpha.1305",
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.1304</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1305</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -29,6 +29,7 @@ const shelf_claims_1 = require("./shelf-claims");
29
29
  const reply_style_1 = require("./reply-style");
30
30
  const deferred_tools_1 = require("../repertoire/deferred-tools");
31
31
  const tools_1 = require("../repertoire/tools");
32
+ const tools_base_1 = require("../repertoire/tools-base");
32
33
  const tool_images_1 = require("./tool-images");
33
34
  const tool_arguments_1 = require("../repertoire/tool-arguments");
34
35
  const session_events_1 = require("./session-events");
@@ -2049,8 +2050,8 @@ async function runAgent(messages, callbacks, channel, signal, options) {
2049
2050
  for (const entry of validatedCalls) {
2050
2051
  const detail = "error" in entry ? entry.error : "another call in this batch had invalid arguments";
2051
2052
  const rejection = unadvertisedCall
2052
- ? `rejected: ${entry.call.name} was not advertised for this channel; no handler was executed.`
2053
- : `invalid tool arguments: ${detail}`;
2053
+ ? (0, tools_base_1.withCode)(`rejected: ${entry.call.name} was not advertised for this channel; no handler was executed.`, "unknown-tool")
2054
+ : (0, tools_base_1.withCode)(`invalid tool arguments: ${detail}`, "invalid-arguments");
2054
2055
  rejections.push(rejection);
2055
2056
  options?.toolBoundaryObserver?.({
2056
2057
  name: entry.call.name,
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
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;
4
5
  exports.routineActionDenied = routineActionDenied;
5
6
  const runtime_1 = require("../nerves/runtime");
6
7
  const tools_files_1 = require("./tools-files");
@@ -47,6 +48,14 @@ var relationship_authorization_1 = require("./relationship-authorization");
47
48
  Object.defineProperty(exports, "routineActionRequester", { enumerable: true, get: function () { return relationship_authorization_1.routineActionRequester; } });
48
49
  /** The friend id of the agent talking to itself: every private-runtime turn (awaits and its own reflection) runs with this friend. */
49
50
  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
59
  function routineActionDenied(reason) {
51
60
  const message = reason.slice(0, 500);
52
61
  (0, runtime_1.emitNervesEvent)({ component: "repertoire", event: "repertoire.routine_action_denied", message: "routine action denied", meta: { reason: message } });
@@ -396,14 +396,14 @@ async function preflightToolCall(name, args, ctx) {
396
396
  const schema = def?.tool ?? selection?.engine.find((tool) => tool.function.name === name);
397
397
  if (!schema) {
398
398
  (0, runtime_1.emitNervesEvent)({ level: "error", event: "tool.error", component: "tools", message: "unknown or unselected tool requested", meta: { name } });
399
- return { kind: "rejected_before_handler", text: `unknown: ${name}` };
399
+ return { kind: "rejected_before_handler", text: (0, tools_base_1.withCode)(`unknown: ${name}`, "unknown-tool") };
400
400
  }
401
401
  if (name === tools_sanctuary_host_1.rootHostToolDefinition.tool.function.name)
402
402
  await (0, tools_sanctuary_host_1.authorizeRootHostToolInvocation)(ctx, def, args);
403
403
  if (selection || ctx?.relationshipAuthorization) {
404
404
  const validation = (0, tool_arguments_1.validateAdvertisedToolArguments)(JSON.stringify(args), schema.function.parameters ?? {});
405
405
  if (!validation.ok)
406
- return { kind: "rejected_before_handler", text: `invalid tool arguments: ${validation.reason}` };
406
+ return { kind: "rejected_before_handler", text: (0, tools_base_1.withCode)(`invalid tool arguments: ${validation.reason}`, "invalid-arguments") };
407
407
  }
408
408
  (0, tool_arguments_1.assertRelationshipToolOwner)(ctx);
409
409
  if (name === "unraid_restart_container" && ctx?.routineActionSelection?.kind === "denied") {
@@ -418,7 +418,7 @@ async function preflightToolCall(name, args, ctx) {
418
418
  level: "warn", event: "tool.relationship_authorization_block", component: "tools",
419
419
  message: "relationship authorization blocked tool execution", meta: { name, reason },
420
420
  });
421
- return { kind: "rejected_before_handler", text: `relationship authorization required: ${reason}` };
421
+ return { kind: "rejected_before_handler", text: (0, tools_base_1.withCode)(`relationship authorization required: ${reason}`, "not-allowed") };
422
422
  }
423
423
  const currentSelection = ctx?.selectCurrentTools?.()
424
424
  ?? (name === tools_sanctuary_host_1.rootHostToolDefinition.tool.function.name ? selection
@@ -436,7 +436,7 @@ async function preflightToolCall(name, args, ctx) {
436
436
  level: "warn", event: "tool.selection_rejected", component: "tools",
437
437
  message: "selected tool is no longer current", meta: { name },
438
438
  });
439
- return { kind: "rejected_before_handler", text: `rejected: ${name} changed or is no longer available in the current tool selection` };
439
+ return { kind: "rejected_before_handler", text: (0, tools_base_1.withCode)(`rejected: ${name} changed or is no longer available in the current tool selection`, "tool-changed") };
440
440
  }
441
441
  if (def?.mcpBinding) {
442
442
  if (!ctx?.agentName || !ctx.agentRoot)
@@ -455,7 +455,7 @@ async function preflightToolCall(name, args, ctx) {
455
455
  message: "orientation hold blocked high-risk tool execution",
456
456
  meta: { name, mutates: mutationKindsFor(risk), reason: orientationPolicy.reason },
457
457
  });
458
- return { kind: "rejected_before_handler", text: orientationHoldMessage(name, risk, orientationPolicy.reason) };
458
+ return { kind: "rejected_before_handler", text: (0, tools_base_1.withCode)(orientationHoldMessage(name, risk, orientationPolicy.reason), "orientation-hold") };
459
459
  }
460
460
  const group = ctx?.context && "isGroupChat" in ctx.context ? ctx.context.isGroupChat : undefined;
461
461
  const guardContext = {
@@ -471,7 +471,7 @@ async function preflightToolCall(name, args, ctx) {
471
471
  level: "warn", event: "tool.guardrail_block", component: "tools",
472
472
  message: "guardrail blocked tool execution", meta: { name, reason: guard.reason },
473
473
  });
474
- return { kind: "rejected_before_handler", text: guard.reason };
474
+ return { kind: "rejected_before_handler", text: (0, tools_base_1.withCode)(guard.reason, "guardrail-blocked") };
475
475
  }
476
476
  return { kind: "ready", definition: def, agentRoot: guardContext.agentRoot, friendId: guardContext.friendId };
477
477
  }
@@ -514,7 +514,7 @@ async function executeTool(name, args, ctx, executor) {
514
514
  message: "guardrail blocked tool execution",
515
515
  meta: { name, reason: commerceReservation.reason },
516
516
  });
517
- return { kind: "rejected_before_handler", text: `commerce authority required: ${commerceReservation.reason}` };
517
+ return { kind: "rejected_before_handler", text: (0, tools_base_1.withCode)(`commerce authority required: ${commerceReservation.reason}`, "commerce-authority-required") };
518
518
  }
519
519
  const authorizedContext = ctx;
520
520
  const toolContext = commerceReservation?.ok
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1304",
3
+ "version": "0.1.0-alpha.1305",
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.1304",
9
+ "version": "0.1.0-alpha.1305",
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.1304",
3
+ "version": "0.1.0-alpha.1305",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },