@ouro.bot/cli 0.1.0-alpha.1315 → 0.1.0-alpha.1317

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,18 @@
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.1317",
6
+ "changes": [
7
+ "The A2A peer tools and bridge_manage now carry Ouro AX cards, and their refusals end with a code the card names."
8
+ ]
9
+ },
10
+ {
11
+ "version": "0.1.0-alpha.1316",
12
+ "changes": [
13
+ "restart_runtime, revive_sense, habit_cancel and steward_policy_manage carry Ouro AX cards, and their errors end with a code the card explains."
14
+ ]
15
+ },
4
16
  {
5
17
  "version": "0.1.0-alpha.1315",
6
18
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1315",
2
+ "runtimeVersion": "0.1.0-alpha.1317",
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.1315</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1317</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -47,6 +47,7 @@ const transport_1 = require("../a2a/transport");
47
47
  const relay_contacts_1 = require("../a2a/relay-contacts");
48
48
  const delegation_stores_1 = require("../a2a/delegation-stores");
49
49
  const mission_result_wire_1 = require("../a2a/mission-result-wire");
50
+ const tools_base_1 = require("./tools-base");
50
51
  const outboundTaskTokens = new Map();
51
52
  function tokenKey(ctx, friendId, taskId) {
52
53
  return `${ctx?.agentRoot ?? "ambient"}\n${friendId}\n${taskId}`;
@@ -86,9 +87,9 @@ function storeFor(ctx) {
86
87
  }
87
88
  function requireTrustedRequester(ctx) {
88
89
  if (!ctx?.context?.friend?.id)
89
- return "no friend context — cannot use A2A tools.";
90
+ return (0, tools_base_1.withCode)("no friend context — cannot use A2A tools.", "no-friend-context");
90
91
  if (!(0, friends_1.isTrustedLevel)(ctx.context.friend.trustLevel))
91
- return "A2A tools require friend or family trust.";
92
+ return (0, tools_base_1.withCode)("A2A tools require friend or family trust.", "untrusted-requester");
92
93
  return null;
93
94
  }
94
95
  function isA2APeer(friend) {
@@ -300,7 +301,7 @@ exports.a2aToolDefinitions = [
300
301
  message: "connect_to refused (non-owner management sense)",
301
302
  meta: { tool: "connect_to", senseType, reason: authorization.reason },
302
303
  });
303
- return `connect_to is available only from your own local management sense (the CLI you launched). This sense (${senseType}) is not permitted to link agents.`;
304
+ return (0, tools_base_1.withCode)(`connect_to is available only from your own local management sense (the CLI you launched). This sense (${senseType}) is not permitted to link agents.`, "not-local-sense");
304
305
  }
305
306
  const agentName = agentNameFromRoot(ctx?.agentRoot);
306
307
  // ONE store for both halves — the DID-keyed onboarding write and the
@@ -340,9 +341,15 @@ exports.a2aToolDefinitions = [
340
341
  return `connected ${result.record.name} (${did ?? result.record.id}) at family trust.`;
341
342
  }
342
343
  catch (error) {
343
- return `connect_to error: ${error instanceof Error ? error.message : /* v8 ignore next -- defensive non-Error failures @preserve */ String(error)}`;
344
+ return (0, tools_base_1.withCode)(`connect_to error: ${error instanceof Error ? error.message : /* v8 ignore next -- defensive non-Error failures @preserve */ String(error)}`, "connect-failed");
344
345
  }
345
346
  },
347
+ ax: { id: "tool:connect_to", group: "a2a", when: "Pick this when your owner, at their own terminal, hands you another agent's card link to add as a trusted peer you can then message.", effect: "write", errors: [
348
+ { code: "no-friend-context", means: "This turn has no friend behind it, so A2A tools can't tell who is asking.", fix: "Use A2A tools only on a turn that a known friend or family member started." },
349
+ { code: "untrusted-requester", means: "The person on this turn is below friend trust, and A2A tools need friend or family.", fix: "Tell them you can't reach other agents for them; your owner can raise their trust." },
350
+ { code: "not-local-sense", means: "Linking agents works only from the owner's own CLI session, and this turn came from another sense.", fix: "Ask your owner to make the link in a CLI session with you, where connect_to is allowed." },
351
+ { code: "connect-failed", means: "Fetching the card, checking its DID or saving the peer failed; the reason follows the colon.", fix: "Check card_url opens the agent's /.well-known/agent-card.json, then try once more." },
352
+ ] },
346
353
  summaryKeys: ["card_url", "name"],
347
354
  riskProfile: { mutates: "durable_state_write", risk: "high", reason: "links a new agent peer into the friend model at family trust" },
348
355
  },
@@ -371,7 +378,7 @@ exports.a2aToolDefinitions = [
371
378
  const store = storeFor(ctx);
372
379
  const listAll = store.listAll;
373
380
  if (!listAll)
374
- return "friend store does not support listing.";
381
+ return (0, tools_base_1.withCode)("friend store does not support listing.", "no-peer-listing");
375
382
  const peers = (await listAll.call(store)).filter(isA2APeer);
376
383
  return JSON.stringify(peers.map((peer) => ({
377
384
  id: peer.id,
@@ -381,6 +388,12 @@ exports.a2aToolDefinitions = [
381
388
  cardUrl: peer.agentMeta?.a2a?.cardUrl,
382
389
  })), null, 2);
383
390
  },
391
+ ax: { id: "tool:a2a_list_peers", group: "a2a", when: "Pick this first when you need another agent's friend_id, or to see which agents you are linked with and how far each is trusted.", effect: "read", idempotent: true, errors: [
392
+ { code: "no-friend-context", means: "This turn has no friend behind it, so A2A tools can't tell who is asking.", fix: "Use A2A tools only on a turn that a known friend or family member started." },
393
+ { code: "untrusted-requester", means: "The person on this turn is below friend trust, and A2A tools need friend or family.", fix: "Tell them you can't reach other agents for them; your owner can raise their trust." },
394
+ { code: "no-peer-listing", means: "This friend store can't list its records, so no peers can be shown.", fix: "Use a friend_id you already know, or ask your owner which agents are linked." },
395
+ ] },
396
+ riskProfile: { mutates: "none", risk: "low" },
384
397
  summaryKeys: [],
385
398
  },
386
399
  {
@@ -412,9 +425,9 @@ exports.a2aToolDefinitions = [
412
425
  return guard;
413
426
  const peer = await storeFor(ctx).get(args.friend_id);
414
427
  if (!peer || !isA2APeer(peer))
415
- return `A2A peer not found: ${args.friend_id}`;
428
+ return (0, tools_base_1.withCode)(`A2A peer not found: ${args.friend_id}`, "peer-not-found");
416
429
  if (!(0, friends_1.isTrustedLevel)(peer.trustLevel))
417
- return "target A2A peer must be friend or family trust before outbound messages.";
430
+ return (0, tools_base_1.withCode)("target A2A peer must be friend or family trust before outbound messages.", "untrusted-peer");
418
431
  // ROUTING (explicit, no impl judgment): a DID-keyed peer → seal+sign via
419
432
  // sendShare over the direct rung (E2E, verified-DID inbound). A legacy peer
420
433
  // with no pinned DID → the existing text send, byte-for-byte unchanged.
@@ -434,7 +447,7 @@ exports.a2aToolDefinitions = [
434
447
  return deliveryText(peer.name, did, delivery);
435
448
  }
436
449
  catch (error) {
437
- return `A2A sealed send error: ${error instanceof Error ? error.message : /* v8 ignore next -- defensive non-Error transport failures @preserve */ String(error)}`;
450
+ return (0, tools_base_1.withCode)(`A2A sealed send error: ${error instanceof Error ? error.message : /* v8 ignore next -- defensive non-Error transport failures @preserve */ String(error)}`, "send-failed");
438
451
  }
439
452
  }
440
453
  try {
@@ -451,9 +464,16 @@ exports.a2aToolDefinitions = [
451
464
  return JSON.stringify(redactTaskToken(task), null, 2);
452
465
  }
453
466
  catch (error) {
454
- return `A2A send error: ${error instanceof Error ? error.message : /* v8 ignore next -- defensive non-Error transport failures */ String(error)}`;
467
+ return (0, tools_base_1.withCode)(`A2A send error: ${error instanceof Error ? error.message : /* v8 ignore next -- defensive non-Error transport failures */ String(error)}`, "send-failed");
455
468
  }
456
469
  },
470
+ ax: { id: "tool:a2a_send_message", group: "a2a", when: "Pick this to say something to another agent or ask it a one-off favour; for tracked work on a shared mission, coordinate records the request.", effect: "write", errors: [
471
+ { code: "no-friend-context", means: "This turn has no friend behind it, so A2A tools can't tell who is asking.", fix: "Use A2A tools only on a turn that a known friend or family member started." },
472
+ { code: "untrusted-requester", means: "The person on this turn is below friend trust, and A2A tools need friend or family.", fix: "Tell them you can't reach other agents for them; your owner can raise their trust." },
473
+ { code: "peer-not-found", means: "friend_id names no onboarded A2A agent peer.", fix: "Call a2a_list_peers and pass one of the ids it shows." },
474
+ { code: "untrusted-peer", means: "That agent peer is below friend trust, so I won't talk to it.", fix: "Ask your owner to raise the peer's trust, or pick a trusted peer from a2a_list_peers." },
475
+ { code: "send-failed", means: "The message didn't reach the peer; the transport's reason follows the colon.", fix: "Try once more later; if it fails again, tell your owner that peer can't be reached." },
476
+ ] },
457
477
  summaryKeys: ["friend_id", "session_key"],
458
478
  riskProfile: { mutates: "external_side_effect", risk: "high", reason: "sends a message to a remote agent peer" },
459
479
  },
@@ -486,9 +506,9 @@ exports.a2aToolDefinitions = [
486
506
  return guard;
487
507
  const peer = await storeFor(ctx).get(args.friend_id);
488
508
  if (!peer || !isA2APeer(peer))
489
- return `A2A peer not found: ${args.friend_id}`;
509
+ return (0, tools_base_1.withCode)(`A2A peer not found: ${args.friend_id}`, "peer-not-found");
490
510
  if (!(0, friends_1.isTrustedLevel)(peer.trustLevel))
491
- return "target A2A peer must be friend or family trust before task lookup.";
511
+ return (0, tools_base_1.withCode)("target A2A peer must be friend or family trust before task lookup.", "untrusted-peer");
492
512
  try {
493
513
  const endpoint = await resolveA2AEndpoint(peer);
494
514
  const task = await (0, client_1.getA2ATask)({
@@ -503,9 +523,17 @@ exports.a2aToolDefinitions = [
503
523
  return JSON.stringify(redactTaskToken(task), null, 2);
504
524
  }
505
525
  catch (error) {
506
- return `A2A task error: ${error instanceof Error ? error.message : /* v8 ignore next -- defensive non-Error transport failures */ String(error)}`;
526
+ return (0, tools_base_1.withCode)(`A2A task error: ${error instanceof Error ? error.message : /* v8 ignore next -- defensive non-Error transport failures */ String(error)}`, "task-fetch-failed");
507
527
  }
508
528
  },
529
+ ax: { id: "tool:a2a_get_task", group: "a2a", when: "Pick this after a2a_send_message gave you a task id, to see whether the other agent has finished it and what it answered.", effect: "read", idempotent: true, errors: [
530
+ { code: "no-friend-context", means: "This turn has no friend behind it, so A2A tools can't tell who is asking.", fix: "Use A2A tools only on a turn that a known friend or family member started." },
531
+ { code: "untrusted-requester", means: "The person on this turn is below friend trust, and A2A tools need friend or family.", fix: "Tell them you can't reach other agents for them; your owner can raise their trust." },
532
+ { code: "peer-not-found", means: "friend_id names no onboarded A2A agent peer.", fix: "Call a2a_list_peers and pass one of the ids it shows." },
533
+ { code: "untrusted-peer", means: "That agent peer is below friend trust, so I won't talk to it.", fix: "Ask your owner to raise the peer's trust, or pick a trusted peer from a2a_list_peers." },
534
+ { code: "task-fetch-failed", means: "The peer didn't return the task; its reason follows the colon.", fix: "Check task_id came from that same peer's reply; pass access_token if an outside agent gave you one." },
535
+ ] },
536
+ riskProfile: { mutates: "none", risk: "low" },
509
537
  summaryKeys: ["friend_id", "task_id"],
510
538
  },
511
539
  {
@@ -539,12 +567,12 @@ exports.a2aToolDefinitions = [
539
567
  return guard;
540
568
  const peer = await storeFor(ctx).get(args.friend_id);
541
569
  if (!peer || !isA2APeer(peer))
542
- return `A2A peer not found: ${args.friend_id}`;
570
+ return (0, tools_base_1.withCode)(`A2A peer not found: ${args.friend_id}`, "peer-not-found");
543
571
  if (!(0, friends_1.isTrustedLevel)(peer.trustLevel))
544
- return "target A2A peer must be friend or family trust before delegating.";
572
+ return (0, tools_base_1.withCode)("target A2A peer must be friend or family trust before delegating.", "untrusted-peer");
545
573
  const did = peerDid(peer);
546
574
  if (!did)
547
- return "coordinate requires a DID-keyed peer (connect_to it first to pin its did:key).";
575
+ return (0, tools_base_1.withCode)("coordinate requires a DID-keyed peer (connect_to it first to pin its did:key).", "peer-not-did-keyed");
548
576
  /* v8 ignore next -- in-turn coordinate always carries a bundle agentRoot; the ambient-name fallback is defensive (same pattern as connect_to) @preserve */
549
577
  const agentName = agentNameFromRoot(ctx?.agentRoot) ?? "ouro-agent";
550
578
  const store = storeFor(ctx);
@@ -587,9 +615,17 @@ exports.a2aToolDefinitions = [
587
615
  return `coordinated: delegated "${args.task_summary}" to ${peer.name} on mission ${args.mission_key} (requestId ${requestId}).${queued}`;
588
616
  }
589
617
  catch (error) {
590
- return `coordinate error: ${error instanceof Error ? error.message : /* v8 ignore next -- defensive non-Error failures @preserve */ String(error)}`;
618
+ return (0, tools_base_1.withCode)(`coordinate error: ${error instanceof Error ? error.message : /* v8 ignore next -- defensive non-Error failures @preserve */ String(error)}`, "coordinate-failed");
591
619
  }
592
620
  },
621
+ ax: { id: "tool:coordinate", group: "a2a", when: "Pick this to hand a piece of work on a named shared mission to another agent and track it until it answers with send_result.", effect: "write", errors: [
622
+ { code: "no-friend-context", means: "This turn has no friend behind it, so A2A tools can't tell who is asking.", fix: "Use A2A tools only on a turn that a known friend or family member started." },
623
+ { code: "untrusted-requester", means: "The person on this turn is below friend trust, and A2A tools need friend or family.", fix: "Tell them you can't reach other agents for them; your owner can raise their trust." },
624
+ { code: "peer-not-found", means: "friend_id names no onboarded A2A agent peer.", fix: "Call a2a_list_peers and pass one of the ids it shows." },
625
+ { code: "untrusted-peer", means: "That agent peer is below friend trust, so I won't talk to it.", fix: "Ask your owner to raise the peer's trust, or pick a trusted peer from a2a_list_peers." },
626
+ { code: "peer-not-did-keyed", means: "The peer has no pinned did:key, so the request can't be sealed to it.", fix: "Ask your owner to link the peer again with connect_to, which pins its DID." },
627
+ { code: "coordinate-failed", means: "Recording or sealing the delegation failed; the reason follows the colon.", fix: "Read the reason, fix what it names, and call coordinate again with the same mission_key." },
628
+ ] },
593
629
  summaryKeys: ["friend_id", "mission_key"],
594
630
  riskProfile: { mutates: "external_side_effect", risk: "high", reason: "delegates a task to a remote agent peer" },
595
631
  },
@@ -633,6 +669,11 @@ exports.a2aToolDefinitions = [
633
669
  }
634
670
  return JSON.stringify(rows, null, 2);
635
671
  },
672
+ ax: { id: "tool:list_delegations", group: "a2a", when: "Pick this to check for jobs peers handed you before you start on them, and to find the requestId to answer with.", effect: "read", idempotent: true, errors: [
673
+ { code: "no-friend-context", means: "This turn has no friend behind it, so A2A tools can't tell who is asking.", fix: "Use A2A tools only on a turn that a known friend or family member started." },
674
+ { code: "untrusted-requester", means: "The person on this turn is below friend trust, and A2A tools need friend or family.", fix: "Tell them you can't reach other agents for them; your owner can raise their trust." },
675
+ ] },
676
+ riskProfile: { mutates: "none", risk: "low" },
636
677
  summaryKeys: [],
637
678
  },
638
679
  {
@@ -670,24 +711,24 @@ exports.a2aToolDefinitions = [
670
711
  const missions = missionStore.listAll ? await missionStore.listAll() : [];
671
712
  const found = findImportedDelegation(missions, args.request_id);
672
713
  if (!found)
673
- return `no imported delegation found for requestId ${args.request_id} (check list_delegations).`;
714
+ return (0, tools_base_1.withCode)(`no imported delegation found for requestId ${args.request_id} (check list_delegations).`, "delegation-not-found");
674
715
  // The delegator (the recipient of the result) must be a trusted, reachable,
675
716
  // DID-keyed peer in our store.
676
717
  const delegator = await (0, friends_1.findFriendByDid)(store, found.fromAgentId);
677
718
  if (!delegator || !isA2APeer(delegator))
678
- return `delegating peer not found for ${found.fromAgentId}.`;
719
+ return (0, tools_base_1.withCode)(`delegating peer not found for ${found.fromAgentId}.`, "delegator-not-found");
679
720
  if (!(0, friends_1.isTrustedLevel)(delegator.trustLevel))
680
- return "delegating peer must be friend or family trust to return a result.";
721
+ return (0, tools_base_1.withCode)("delegating peer must be friend or family trust to return a result.", "untrusted-peer");
681
722
  const delegatorDid = peerDid(delegator);
682
723
  /* v8 ignore next -- unreachable: findFriendByDid matched this record BY its DID (via resolveAgentIdentity, which omits empty DIDs), so a2a.did is always present here. Defensive. @preserve */
683
724
  if (!delegatorDid)
684
725
  return "delegating peer is not DID-keyed (cannot seal the result).";
685
726
  const parsedDelegator = (0, a2a_client_1.parseDidKey)(delegatorDid);
686
727
  if (!parsedDelegator)
687
- return `cannot seal: delegating peer DID is unparseable (${delegatorDid}).`;
728
+ return (0, tools_base_1.withCode)(`cannot seal: delegating peer DID is unparseable (${delegatorDid}).`, "delegator-unreachable");
688
729
  const endpointUrl = delegator.agentMeta?.a2a?.endpointUrl;
689
730
  if (!endpointUrl)
690
- return "delegating peer has no reachable A2A endpoint to return the result to.";
731
+ return (0, tools_base_1.withCode)("delegating peer has no reachable A2A endpoint to return the result to.", "delegator-unreachable");
691
732
  /* v8 ignore next -- in-turn send_result always carries a bundle agentRoot; the ambient-name fallback is defensive (same pattern as connect_to) @preserve */
692
733
  const agentName = agentNameFromRoot(ctx?.agentRoot) ?? "ouro-agent";
693
734
  try {
@@ -733,9 +774,18 @@ exports.a2aToolDefinitions = [
733
774
  : `${deliveryText(delegator.name, delegatorDid, delivery, "result")} (requestId ${args.request_id})`;
734
775
  }
735
776
  catch (error) {
736
- return `send_result error: ${error instanceof Error ? error.message : /* v8 ignore next -- defensive non-Error failures @preserve */ String(error)}`;
777
+ return (0, tools_base_1.withCode)(`send_result error: ${error instanceof Error ? error.message : /* v8 ignore next -- defensive non-Error failures @preserve */ String(error)}`, "send-result-failed");
737
778
  }
738
779
  },
780
+ ax: { id: "tool:send_result", group: "a2a", when: "Pick this once you have finished work another agent delegated to you, to deliver the outcome back against its requestId.", effect: "write", errors: [
781
+ { code: "no-friend-context", means: "This turn has no friend behind it, so A2A tools can't tell who is asking.", fix: "Use A2A tools only on a turn that a known friend or family member started." },
782
+ { code: "untrusted-requester", means: "The person on this turn is below friend trust, and A2A tools need friend or family.", fix: "Tell them you can't reach other agents for them; your owner can raise their trust." },
783
+ { code: "delegation-not-found", means: "No delegation sent to you has that request_id.", fix: "Call list_delegations and pass the requestId it shows." },
784
+ { code: "delegator-not-found", means: "The agent that sent the delegation isn't a linked peer any more.", fix: "Ask your owner to link that agent again with connect_to, then send the result." },
785
+ { code: "untrusted-peer", means: "The delegating agent is below friend trust, so I won't send it the result.", fix: "Ask your owner whether to raise its trust before you send." },
786
+ { code: "delegator-unreachable", means: "The delegating agent's DID can't be read or it has no A2A endpoint, so the result can't be delivered.", fix: "Ask your owner to link that agent again with connect_to, which refreshes its DID and endpoint." },
787
+ { code: "send-result-failed", means: "Sealing or delivering the result failed; the reason follows the colon.", fix: "Try send_result once more; if it fails again, tell your owner the result is ready but undelivered." },
788
+ ] },
739
789
  summaryKeys: ["request_id"],
740
790
  riskProfile: { mutates: "external_side_effect", risk: "high", reason: "returns a result to a remote agent peer" },
741
791
  },
@@ -5,6 +5,7 @@ const config_1 = require("../heart/config");
5
5
  const manager_1 = require("../heart/bridges/manager");
6
6
  const runtime_1 = require("../nerves/runtime");
7
7
  const session_transcript_1 = require("../heart/session-transcript");
8
+ const tools_base_1 = require("./tools-base");
8
9
  const NO_SESSION_FOUND_MESSAGE = "no session found for that friend/channel/key combination.";
9
10
  const EMPTY_SESSION_MESSAGE = "session exists but has no non-system messages.";
10
11
  async function summarizeSessionTailSafely(options) {
@@ -72,11 +73,11 @@ exports.bridgeToolDefinitions = [
72
73
  const action = (args.action || "").trim();
73
74
  if (action === "begin") {
74
75
  if (!ctx?.currentSession) {
75
- return "bridge_manage begin requires an active session context.";
76
+ return (0, tools_base_1.withCode)("bridge_manage begin requires an active session context.", "no-active-session");
76
77
  }
77
78
  const objective = (args.objective || "").trim();
78
79
  if (!objective)
79
- return "objective is required for bridge begin.";
80
+ return (0, tools_base_1.withCode)("objective is required for bridge begin.", "missing-objective");
80
81
  return (0, manager_1.formatBridgeStatus)(manager.beginBridge({
81
82
  objective,
82
83
  summary: (args.summary || objective).trim(),
@@ -85,14 +86,14 @@ exports.bridgeToolDefinitions = [
85
86
  }
86
87
  const bridgeId = (args.bridgeId || "").trim();
87
88
  if (!bridgeId) {
88
- return "bridgeId is required for this bridge action.";
89
+ return (0, tools_base_1.withCode)("bridgeId is required for this bridge action.", "missing-bridge-id");
89
90
  }
90
91
  if (action === "attach") {
91
92
  const friendId = (args.friendId || "").trim();
92
93
  const channel = (args.channel || "").trim();
93
94
  const key = (args.key || "session").trim();
94
95
  if (!friendId || !channel) {
95
- return "friendId and channel are required for bridge attach.";
96
+ return (0, tools_base_1.withCode)("friendId and channel are required for bridge attach.", "missing-attach-target");
96
97
  }
97
98
  const sessionPath = (0, config_1.resolveSessionPath)(friendId, channel, key);
98
99
  const sessionTail = await summarizeSessionTailSafely({
@@ -105,7 +106,7 @@ exports.bridgeToolDefinitions = [
105
106
  summarize: ctx?.summarize,
106
107
  });
107
108
  if (sessionTail.kind === "missing") {
108
- return NO_SESSION_FOUND_MESSAGE;
109
+ return (0, tools_base_1.withCode)(NO_SESSION_FOUND_MESSAGE, "session-not-found");
109
110
  }
110
111
  return (0, manager_1.formatBridgeStatus)(manager.attachSession(bridgeId, {
111
112
  friendId,
@@ -118,7 +119,7 @@ exports.bridgeToolDefinitions = [
118
119
  if (action === "status") {
119
120
  const bridge = manager.getBridge(bridgeId);
120
121
  if (!bridge)
121
- return `bridge not found: ${bridgeId}`;
122
+ return (0, tools_base_1.withCode)(`bridge not found: ${bridgeId}`, "bridge-not-found");
122
123
  return (0, manager_1.formatBridgeStatus)(bridge);
123
124
  }
124
125
  if (action === "promote_task") {
@@ -136,6 +137,14 @@ exports.bridgeToolDefinitions = [
136
137
  }
137
138
  return `unknown bridge action: ${action}`;
138
139
  },
140
+ ax: { id: "tool:bridge_manage", group: "turn-sessions", when: "Pick this when one piece of work spans conversations already under way, such as two friends' chats, so each can share its status and progress.", effect: "write", errors: [
141
+ { code: "no-active-session", means: "begin needs the conversation you're in, and this turn has none.", fix: "Start the bridge from a turn inside one of the conversations it should join." },
142
+ { code: "missing-objective", means: "begin came without an objective.", fix: "Call begin again with objective set to the shared goal in one line." },
143
+ { code: "missing-bridge-id", means: "Every action but begin needs bridgeId.", fix: "Pass the bridge id that begin returned." },
144
+ { code: "missing-attach-target", means: "attach needs both friendId and channel.", fix: "Call attach again with the friend's id and the channel of their session, plus key if it isn't 'session'." },
145
+ { code: "session-not-found", means: "No saved session matches that friendId, channel and key.", fix: "Check the friend, channel and key with query_session, then attach again." },
146
+ { code: "bridge-not-found", means: "No bridge has that bridgeId.", fix: "Check the id from begin's reply, or begin a new bridge." },
147
+ ] },
139
148
  summaryKeys: ["action", "bridgeId", "objective", "friendId", "channel", "key"],
140
149
  riskProfile: (args) => args.action === "status"
141
150
  ? { mutates: "none", risk: "low", reason: "bridge status is read-only" }
@@ -5,21 +5,22 @@ const friends_1 = require("@ouro.bot/friends");
5
5
  const runtime_1 = require("../nerves/runtime");
6
6
  const habit_cancel_1 = require("../heart/habits/habit-cancel");
7
7
  const semantic_receipts_1 = require("../senses/bluebubbles/semantic-receipts");
8
+ const tools_base_1 = require("./tools-base");
8
9
  const CAPTURE_LOCATOR_PATTERN = /^capture:([a-f0-9]{64})$/;
9
10
  const ACTOR_AUTHORITY_ERROR = "habit_cancel requires trusted current-ingress actor authority";
10
11
  async function requireTrustedCurrentIngressActor(agentRoot, captureKeyHash, context) {
11
12
  const capture = (0, semantic_receipts_1.readBlueBubblesSemanticCaptureAtRoot)(agentRoot, captureKeyHash);
12
13
  const actor = capture?.event.actor;
13
14
  if (!actor || !context?.friendStore)
14
- throw new Error(ACTOR_AUTHORITY_ERROR);
15
+ throw new Error((0, tools_base_1.withCode)(ACTOR_AUTHORITY_ERROR, "actor-not-trusted"));
15
16
  try {
16
17
  const friend = await context.friendStore.findByExternalId(actor.provider, actor.externalId);
17
18
  if (!friends_1.TRUSTED_LEVELS.has(friend?.trustLevel ?? "stranger")) {
18
- throw new Error(ACTOR_AUTHORITY_ERROR);
19
+ throw new Error((0, tools_base_1.withCode)(ACTOR_AUTHORITY_ERROR, "actor-not-trusted"));
19
20
  }
20
21
  }
21
22
  catch {
22
- throw new Error(ACTOR_AUTHORITY_ERROR);
23
+ throw new Error((0, tools_base_1.withCode)(ACTOR_AUTHORITY_ERROR, "actor-not-trusted"));
23
24
  }
24
25
  }
25
26
  exports.habitToolDefinitions = [
@@ -67,13 +68,13 @@ exports.habitToolDefinitions = [
67
68
  const keys = Object.keys(args);
68
69
  const unexpected = keys.find((key) => key !== "habit" && key !== "evidence");
69
70
  if (unexpected)
70
- throw new Error(`unexpected habit_cancel argument: ${unexpected}`);
71
+ throw new Error((0, tools_base_1.withCode)(`unexpected habit_cancel argument: ${unexpected}`, "bad-argument"));
71
72
  if (keys.length !== 2 || typeof args.habit !== "string" || args.habit.trim().length === 0) {
72
- throw new Error("habit_cancel requires exactly habit and evidence");
73
+ throw new Error((0, tools_base_1.withCode)("habit_cancel requires exactly habit and evidence", "bad-argument"));
73
74
  }
74
75
  const match = CAPTURE_LOCATOR_PATTERN.exec(args.evidence);
75
76
  if (!match)
76
- throw new Error("habit_cancel evidence must use capture:<sha256>");
77
+ throw new Error((0, tools_base_1.withCode)("habit_cancel evidence must use capture:<sha256>", "bad-argument"));
77
78
  const currentIngressEvidence = context?.currentIngressEvidence;
78
79
  if (!currentIngressEvidence
79
80
  || Object.keys(currentIngressEvidence).length !== 3
@@ -81,12 +82,12 @@ exports.habitToolDefinitions = [
81
82
  || currentIngressEvidence.schemaVersion !== 1
82
83
  || currentIngressEvidence.provider !== "bluebubbles"
83
84
  || !/^[a-f0-9]{64}$/.test(currentIngressEvidence.captureKeyHash))
84
- throw new Error("habit_cancel requires authoritative current ingress evidence");
85
+ throw new Error((0, tools_base_1.withCode)("habit_cancel requires authoritative current ingress evidence", "no-ingress-evidence"));
85
86
  if (currentIngressEvidence.captureKeyHash !== match[1]) {
86
- throw new Error("habit_cancel evidence mismatch with current ingress evidence");
87
+ throw new Error((0, tools_base_1.withCode)("habit_cancel evidence mismatch with current ingress evidence", "evidence-mismatch"));
87
88
  }
88
89
  if (!context?.agentRoot)
89
- throw new Error("habit_cancel requires an agent root");
90
+ throw new Error((0, tools_base_1.withCode)("habit_cancel requires an agent root", "no-agent-root"));
90
91
  await requireTrustedCurrentIngressActor(context.agentRoot, currentIngressEvidence.captureKeyHash, context);
91
92
  const receipt = await (0, habit_cancel_1.cancelHabit)({
92
93
  agentRoot: context.agentRoot,
@@ -99,5 +100,12 @@ exports.habitToolDefinitions = [
99
100
  });
100
101
  return receipt.acknowledgement;
101
102
  },
103
+ ax: { id: "tool:habit_cancel", group: "turn-habits", when: "Pick this when the message that started this turn asks to stop a named habit for good, citing that message's own capture.", effect: "write", destructive: true, errors: [
104
+ { code: "bad-argument", means: "An argument other than habit and evidence was passed, habit is empty, or evidence isn't capture:<sha256>.", fix: "Call again with only habit and evidence, with evidence set to this turn's capture locator." },
105
+ { code: "no-ingress-evidence", means: "This turn didn't start from a captured BlueBubbles message, so nobody's request can authorize it.", fix: "Don't retry; a habit is cancelled only from the person's own message asking for it." },
106
+ { code: "evidence-mismatch", means: "evidence names a different capture from the message that started this turn.", fix: "Pass this turn's own capture locator; an older message can't authorize a cancel." },
107
+ { code: "actor-not-trusted", means: "The person who sent the message isn't a trusted friend, or can't be found.", fix: "Don't retry; tell them a trusted friend has to ask for it." },
108
+ { code: "no-agent-root", means: "The runtime gave this turn no agent home, so no habit can be found.", fix: "Report it to the owner; this is a runtime fault, not something to retry." },
109
+ ] },
102
110
  },
103
111
  ];
@@ -40,6 +40,7 @@ const node_crypto_1 = require("node:crypto");
40
40
  const identity_1 = require("../heart/identity");
41
41
  const runtime_1 = require("../nerves/runtime");
42
42
  const socket_client_1 = require("../heart/daemon/socket-client");
43
+ const tools_base_1 = require("./tools-base");
43
44
  exports.RESTART_COOLDOWN_MS = 6 * 60 * 60 * 1000;
44
45
  function restartCooldownPath(agentName) {
45
46
  return path.join((0, identity_1.getAgentStateRoot)(agentName), "daemon", "restart-runtime-cooldown.json");
@@ -68,7 +69,7 @@ function recordRestart(agentName, nowMs) {
68
69
  }
69
70
  async function restartRuntime(args, agentName, ctx) {
70
71
  if (typeof args.reason !== "string" || args.reason.trim().length === 0) {
71
- return JSON.stringify({ error: "reason is required (one-line audit string)" });
72
+ return JSON.stringify({ error: "reason is required (one-line audit string)", code: "missing-reason" });
72
73
  }
73
74
  const reason = args.reason.trim();
74
75
  if (ctx?.autonomousTurnKind) {
@@ -80,7 +81,7 @@ async function restartRuntime(args, agentName, ctx) {
80
81
  });
81
82
  return JSON.stringify({
82
83
  refused: true,
83
- code: "autonomous_turn_restart_refused",
84
+ code: "autonomous-restart-refused",
84
85
  error: `restart_runtime is not allowed from an autonomous ${ctx.autonomousTurnKind} turn: restarting the daemon kills in-flight work for every agent and habit. A tool error or missing capability is not evidence of a dead runtime. Record or report the problem (note it, surface it to the owner) instead of restarting.`,
85
86
  });
86
87
  }
@@ -89,7 +90,7 @@ async function restartRuntime(args, agentName, ctx) {
89
90
  if (lastMs !== null && lastMs <= nowMs && nowMs - lastMs < exports.RESTART_COOLDOWN_MS) {
90
91
  return JSON.stringify({
91
92
  refused: true,
92
- code: "restart_cooldown",
93
+ code: "restart-cooldown",
93
94
  error: `a restart was already requested ${Math.round((nowMs - lastMs) / 60000)} minutes ago; agent-requested restarts are limited to one per 6 hours. Record or report the problem instead.`,
94
95
  retryAfterMs: exports.RESTART_COOLDOWN_MS - (nowMs - lastMs),
95
96
  });
@@ -118,19 +119,20 @@ async function restartRuntime(args, agentName, ctx) {
118
119
  catch (error) {
119
120
  return JSON.stringify({
120
121
  error: "failed to reach daemon socket",
122
+ code: "daemon-unreachable",
121
123
  detail: error instanceof Error ? error.message : String(error),
122
124
  });
123
125
  }
124
126
  }
125
127
  async function reviveSense(args, agentName) {
126
128
  if (args.agent !== undefined) {
127
- return "cross-agent revive is unsupported; revive_sense can only revive this agent's own senses.";
129
+ return (0, tools_base_1.withCode)("cross-agent revive is unsupported; revive_sense can only revive this agent's own senses.", "cross-agent-unsupported");
128
130
  }
129
131
  if (typeof args.sense !== "string" || args.sense.trim().length === 0) {
130
- return JSON.stringify({ error: "sense is required (for example, 'bluebubbles')" });
132
+ return JSON.stringify({ error: "sense is required (for example, 'bluebubbles')", code: "missing-sense" });
131
133
  }
132
134
  if (typeof args.reason !== "string" || args.reason.trim().length === 0) {
133
- return JSON.stringify({ error: "reason is required (one-line audit string)" });
135
+ return JSON.stringify({ error: "reason is required (one-line audit string)", code: "missing-reason" });
134
136
  }
135
137
  const sense = args.sense.trim();
136
138
  const reason = args.reason.trim();
@@ -151,6 +153,7 @@ async function reviveSense(args, agentName) {
151
153
  if (response.error === "Unknown daemon command kind 'daemon.sense_revive'.") {
152
154
  return JSON.stringify({
153
155
  error: "daemon does not support this command; try restart_runtime",
156
+ code: "revive-unsupported",
154
157
  detail: response.error,
155
158
  agent: agentName,
156
159
  sense,
@@ -158,6 +161,7 @@ async function reviveSense(args, agentName) {
158
161
  }
159
162
  return JSON.stringify({
160
163
  error: response.error ?? "daemon failed to revive sense",
164
+ code: "revive-failed",
161
165
  agent: agentName,
162
166
  sense,
163
167
  });
@@ -173,12 +177,15 @@ async function reviveSense(args, agentName) {
173
177
  catch (error) {
174
178
  return JSON.stringify({
175
179
  error: "failed to reach daemon socket",
180
+ code: "daemon-unreachable",
176
181
  detail: error instanceof Error ? error.message : String(error),
177
182
  agent: agentName,
178
183
  sense,
179
184
  });
180
185
  }
181
186
  }
187
+ const MISSING_REASON_ERROR = { code: "missing-reason", means: "reason is empty; every restart or revive needs a one-line reason for the audit log.", fix: "Call again with reason saying what is wedged and since when." };
188
+ const DAEMON_UNREACHABLE_ERROR = { code: "daemon-unreachable", means: "The daemon's socket didn't answer, so no command reached it.", fix: "Don't retry in a loop; note the problem for the owner, since the daemon may already be down or restarting." };
182
189
  exports.runtimeToolDefinitions = [
183
190
  {
184
191
  tool: {
@@ -203,6 +210,12 @@ exports.runtimeToolDefinitions = [
203
210
  return restartRuntime({ reason: args.reason }, agentName, ctx);
204
211
  },
205
212
  riskProfile: { mutates: "external_side_effect", risk: "high", reason: "restarts the hosting runtime" },
213
+ ax: { id: "tool:restart_runtime", group: "turn-runtime", when: "Pick this only when the daemon itself is wedged for every chat, such as a jammed recovery queue; never for one failing tool.", effect: "write", errors: [
214
+ MISSING_REASON_ERROR,
215
+ { code: "autonomous-restart-refused", means: "This is an autonomous turn, such as a habit, and a restart would kill every agent's in-flight work.", fix: "Don't restart; note the problem and surface it to the owner, who can restart from a conversation." },
216
+ { code: "restart-cooldown", means: "A restart was already requested in the last 6 hours; retryAfterMs says how long is left.", fix: "Don't restart again; note what is still wrong and report it to the owner instead." },
217
+ DAEMON_UNREACHABLE_ERROR,
218
+ ] },
206
219
  },
207
220
  {
208
221
  tool: {
@@ -228,11 +241,20 @@ exports.runtimeToolDefinitions = [
228
241
  },
229
242
  handler: async (args, ctx) => {
230
243
  if (ctx?.context?.friend?.trustLevel !== "family") {
231
- return "revive_sense requires family trust before I can revive runtime senses.";
244
+ return (0, tools_base_1.withCode)("revive_sense requires family trust before I can revive runtime senses.", "family-required");
232
245
  }
233
246
  const agentName = (0, identity_1.getAgentName)();
234
247
  return reviveSense({ agent: args.agent, sense: args.sense, reason: args.reason }, agentName);
235
248
  },
236
249
  riskProfile: { mutates: "external_side_effect", risk: "high", reason: "revives a managed runtime sense" },
250
+ ax: { id: "tool:revive_sense", group: "turn-runtime", when: "Pick this when one of your own senses, such as bluebubbles, is stuck or failed while the rest of the daemon is fine.", effect: "write", errors: [
251
+ { code: "family-required", means: "The person in this conversation isn't family, and only family may revive senses.", fix: "Don't retry; tell the person a family member has to ask for this." },
252
+ { code: "cross-agent-unsupported", means: "agent was passed, but revive_sense only revives this agent's own senses.", fix: "Call again without agent; another agent's sense is revived from that agent." },
253
+ { code: "missing-sense", means: "sense is empty.", fix: "Call again with the sense's name, such as bluebubbles." },
254
+ MISSING_REASON_ERROR,
255
+ { code: "revive-unsupported", means: "The running daemon is too old to revive one sense.", fix: "Use restart_runtime instead, if a restart is justified." },
256
+ { code: "revive-failed", means: "The daemon refused the revive; error gives its reason, such as no sense by that name.", fix: "Check the sense's name in the error and the daemon's status, then report it if the name is right." },
257
+ DAEMON_UNREACHABLE_ERROR,
258
+ ] },
237
259
  },
238
260
  ];
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.stewardPolicyToolDefinition = void 0;
4
+ const tools_base_1 = require("./tools-base");
4
5
  const steward_policy_1 = require("../heart/steward-policy");
5
6
  const runtime_1 = require("../nerves/runtime");
6
7
  function arrayArgument(raw, label) {
7
8
  if (!raw)
8
- throw new Error(`${label} is required`);
9
+ throw new Error((0, tools_base_1.withCode)(`${label} is required`, "bad-argument"));
9
10
  const value = JSON.parse(raw);
10
11
  if (!Array.isArray(value) || value.some((entry) => typeof entry !== "string"))
11
- throw new Error(`${label} must be a JSON string array`);
12
+ throw new Error((0, tools_base_1.withCode)(`${label} must be a JSON string array`, "bad-argument"));
12
13
  return value;
13
14
  }
14
15
  exports.stewardPolicyToolDefinition = {
@@ -42,9 +43,9 @@ exports.stewardPolicyToolDefinition = {
42
43
  },
43
44
  handler: (args, ctx) => {
44
45
  if (!ctx?.agentRoot)
45
- throw new Error("steward policy runtime is unavailable");
46
+ throw new Error((0, tools_base_1.withCode)("steward policy runtime is unavailable", "runtime-unavailable"));
46
47
  if (!ctx.relationshipAuthorization)
47
- throw new Error("steward policy access requires authenticated relationship authority");
48
+ throw new Error((0, tools_base_1.withCode)("steward policy access requires authenticated relationship authority", "relationship-authority-required"));
48
49
  if (args.action === "read") {
49
50
  (0, runtime_1.emitNervesEvent)({ component: "repertoire", event: "repertoire.steward_policy_tool_call", message: "read steward policy", meta: { action: "read" } });
50
51
  return JSON.stringify((0, steward_policy_1.readStewardPolicy)(ctx.agentRoot));
@@ -52,7 +53,7 @@ exports.stewardPolicyToolDefinition = {
52
53
  const relationship = ctx.relationshipAuthorization;
53
54
  const actor = relationship.actor;
54
55
  if (!actor)
55
- throw new Error("steward policy mutation requires authenticated relationship authority");
56
+ throw new Error((0, tools_base_1.withCode)("steward policy mutation requires authenticated relationship authority", "relationship-authority-required"));
56
57
  const { friendId, trustLevel, sessionEventId } = actor;
57
58
  const { profileId, requestId } = relationship;
58
59
  (0, steward_policy_1.assertNotReplayIdentity)(ctx.agentRoot, [friendId, ctx.delegatedCommand?.delegateFriendId]);
@@ -68,20 +69,20 @@ exports.stewardPolicyToolDefinition = {
68
69
  if (trustLevel !== "family" || profileId !== "sanctuary-owner" || typeof requestId !== "string" || !requestId.trim()
69
70
  || typeof sessionKey !== "string" || !sessionKey.trim() || !sessionEventId.trim()
70
71
  || !sessionMatches() || ctx.currentExternalEvent) {
71
- throw new Error(delegated
72
+ throw new Error((0, tools_base_1.withCode)(delegated
72
73
  ? "steward policy mutation requires a current admitted delegated owner command"
73
- : "steward policy mutation requires a current authenticated owner Telegram request and session");
74
+ : "steward policy mutation requires a current authenticated owner Telegram request and session", "owner-request-required"));
74
75
  }
75
76
  const sourceFor = (raw) => delegated
76
77
  ? `${delegated.principalName} via ${delegated.delegateName} (delegated)${raw?.trim() ? `: ${raw.trim()}` : ""}`
77
78
  : raw ?? "";
78
79
  const expectedVersion = args.expectedVersion === undefined ? undefined : Number(args.expectedVersion);
79
80
  if (expectedVersion !== undefined && (!Number.isSafeInteger(expectedVersion) || expectedVersion < 0))
80
- throw new Error("expectedVersion must be a nonnegative integer");
81
+ throw new Error((0, tools_base_1.withCode)("expectedVersion must be a nonnegative integer", "bad-argument"));
81
82
  let mutation;
82
83
  if (args.action === "set_desired_state") {
83
84
  if (args.provenance !== "stated" && args.provenance !== "observed" && args.provenance !== "default")
84
- throw new Error("desired state provenance is invalid");
85
+ throw new Error((0, tools_base_1.withCode)("desired state provenance is invalid", "bad-argument"));
85
86
  mutation = { kind: "set_desired_state", key: args.key ?? "", value: args.value ?? "", provenance: args.provenance, source: sourceFor(args.source), ...(args.expiresAt ? { expiresAt: args.expiresAt } : {}) };
86
87
  }
87
88
  else if (args.action === "correct_provenance") {
@@ -89,12 +90,12 @@ exports.stewardPolicyToolDefinition = {
89
90
  }
90
91
  else if (args.action === "grant_routine_action") {
91
92
  if (args.provenance !== "stated" && args.provenance !== "installed_explicit_policy")
92
- throw new Error("routine action provenance is invalid");
93
+ throw new Error((0, tools_base_1.withCode)("routine action provenance is invalid", "bad-argument"));
93
94
  const targets = arrayArgument(args.targetsJson, "targetsJson");
94
95
  const exclusions = arrayArgument(args.exclusionsJson, "exclusionsJson");
95
96
  const verificationRequired = args.verificationRequired;
96
97
  if (verificationRequired !== true)
97
- throw new Error("verificationRequired must be true");
98
+ throw new Error((0, tools_base_1.withCode)("verificationRequired must be true", "bad-argument"));
98
99
  mutation = {
99
100
  kind: "grant_routine_action",
100
101
  key: args.key ?? "",
@@ -109,18 +110,18 @@ exports.stewardPolicyToolDefinition = {
109
110
  };
110
111
  }
111
112
  else
112
- throw new Error("steward policy action is invalid");
113
+ throw new Error((0, tools_base_1.withCode)("steward policy action is invalid", "bad-argument"));
113
114
  const agentRoot = ctx.agentRoot;
114
115
  return Promise.resolve(relationship.authorizeTool("steward_policy_manage", args)).then((authorization) => {
115
116
  if (!authorization.allowed)
116
- throw new Error(`steward policy authorization denied: ${authorization.reason}`);
117
+ throw new Error((0, tools_base_1.withCode)(`steward policy authorization denied: ${authorization.reason}`, "authorization-denied"));
117
118
  if (typeof authorization.profileVersion !== "number" || !Number.isSafeInteger(authorization.profileVersion) || authorization.profileVersion < 1 || !authorization.receiptId.trim()) {
118
- throw new Error("steward policy owner authorization is not versioned");
119
+ throw new Error((0, tools_base_1.withCode)("steward policy owner authorization is not versioned", "authorization-unversioned"));
119
120
  }
120
121
  if (ctx.relationshipAuthorization !== relationship || relationship.profileId !== profileId || relationship.requestId !== requestId
121
122
  || relationship.actor?.friendId !== friendId || relationship.actor.trustLevel !== trustLevel || relationship.actor.sessionEventId !== sessionEventId
122
123
  || ctx.currentSession?.key !== sessionKey || !sessionMatches() || ctx.currentExternalEvent) {
123
- throw new Error("steward policy owner authorization or session changed before mutation");
124
+ throw new Error((0, tools_base_1.withCode)("steward policy owner authorization or session changed before mutation", "authorization-changed"));
124
125
  }
125
126
  const versionBefore = (0, steward_policy_1.readStewardPolicy)(agentRoot).version;
126
127
  const result = (0, steward_policy_1.updateStewardPolicy)(agentRoot, {
@@ -141,6 +142,15 @@ exports.stewardPolicyToolDefinition = {
141
142
  return JSON.stringify(result);
142
143
  });
143
144
  },
145
+ ax: { id: "tool:steward_policy_manage", group: "turn-steward", when: "Pick this to read or change what the household steward keeps on or may restart, when the owner states it in this turn.", effect: "write", errors: [
146
+ { code: "runtime-unavailable", means: "The runtime gave this turn no agent home, so there is no policy to open.", fix: "Report it to the owner; this is a runtime fault, not something to retry." },
147
+ { code: "relationship-authority-required", means: "This turn has no authenticated relationship, such as the owner's Telegram chat, behind it.", fix: "Don't retry here; the policy is read or changed only in an authenticated owner conversation." },
148
+ { code: "owner-request-required", means: "A change needs the owner's own current Telegram request, or an admitted delegated command, and this turn is neither.", fix: "Read the policy instead, or ask the owner to state the change in their Telegram chat." },
149
+ { code: "bad-argument", means: "action, provenance, expectedVersion, a JSON list or verificationRequired isn't an allowed value; the text names it.", fix: "Correct the argument the text names; send targetsJson and exclusionsJson as JSON arrays of names." },
150
+ { code: "authorization-denied", means: "The owner's authorization for this exact change was refused; the text gives the reason.", fix: "Tell the owner what was refused and why, and change nothing." },
151
+ { code: "authorization-unversioned", means: "The authorization came back without a profile version or receipt, so the change can't be audited.", fix: "Report it to the owner; don't retry the change." },
152
+ { code: "authorization-changed", means: "The owner's session or authorization changed while the change was being checked.", fix: "Read the policy again and redo the change in the owner's current turn." },
153
+ ] },
144
154
  riskProfile: (args) => args.action === "read"
145
155
  ? { mutates: "none", risk: "low" }
146
156
  : { mutates: "durable_state_write", risk: "high", reason: "updates typed household steward policy under current authenticated owner authority" },
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1315",
3
+ "version": "0.1.0-alpha.1317",
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.1315",
9
+ "version": "0.1.0-alpha.1317",
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.1315",
3
+ "version": "0.1.0-alpha.1317",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },