@ouro.bot/cli 0.1.0-alpha.1701 → 0.1.0-alpha.1702

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": "Each pull request writes its own change note under changes/; the release job on main gives each landed change its version and adds the notes here (scripts/release-version.cjs). On main this file stops at the last version set by hand; the published package has every release. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.1702",
6
+ "changes": [
7
+ "The house runtime the Butler's tools read on each turn (its Unraid reads, downloads and media clients, and the answer checks it opts in to) now comes from the Butler's product registration, so private turns, A2A turns and Telegram no longer build it themselves. On the Butler's image every turn gets the same context as before: a turn for one of its own house or Usenet events still fails when the house config is missing, and any other private turn still runs without it. That fallback is now logged as `daemon.product_hook_error` at warn level instead of `senses.sanctuary_tool_context_unavailable`, and a failed build on an A2A turn or a Telegram start logs the same event at error level before the turn or start fails as it did before. The Telegram sense now gets that context when it starts, before it builds its app, so a missing house config stops the sense's start as before. Agents no product runs never get the Butler's house runtime, even for a `sanctuary-*` event."
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.1701",
6
12
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1701",
2
+ "runtimeVersion": "0.1.0-alpha.1702",
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.1701</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1702</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.ESCALATION_CONFIRM_INTERVAL_MS = exports.A2A_TURN_TIMEOUT_MS = void 0;
37
+ exports.defaultTurnRunner = defaultTurnRunner;
37
38
  exports.a2aChatRelationship = a2aChatRelationship;
38
39
  exports.commandIdFor = commandIdFor;
39
40
  exports.startA2AServer = startA2AServer;
@@ -53,7 +54,7 @@ const pin_store_1 = require("./pin-store");
53
54
  const seen_ledger_1 = require("./seen-ledger");
54
55
  const did_resolution_1 = require("./did-resolution");
55
56
  const inbound_share_1 = require("./inbound-share");
56
- const sanctuary_runtime_1 = require("../senses/sanctuary-runtime");
57
+ const active_1 = require("../heart/product/active");
57
58
  const sealed_chat_1 = require("./sealed-chat");
58
59
  const relationship_authorization_1 = require("../repertoire/relationship-authorization");
59
60
  const mission_result_wire_1 = require("./mission-result-wire");
@@ -171,6 +172,7 @@ function headerString(req, key) {
171
172
  function storageKeyFor(peerExternalId) {
172
173
  return `a2a-${(0, node_crypto_1.createHash)("sha256").update(peerExternalId).digest("hex").slice(0, 24)}`;
173
174
  }
175
+ /** Runs an A2A turn through the shared sense pipeline: the runner the server uses unless it is given another. */
174
176
  async function defaultTurnRunner(input) {
175
177
  const result = await (0, shared_turn_1.runSenseTurn)({
176
178
  agentName: input.agentName,
@@ -189,12 +191,11 @@ async function defaultTurnRunner(input) {
189
191
  externalId: input.peerAgentId,
190
192
  displayName: input.peerName,
191
193
  },
192
- // The Butler's house tools read a typed Sanctuary runtime from the tool context; the
193
- // Telegram sense attaches it, and a verified A2A friend's turn needs it too (without it
194
- // every Unraid read answered "Sanctuary runtime is unavailable"). The relationship
195
- // profile still decides which of those tools the peer may call.
194
+ // A product's tools read its runtime from the tool context, and a verified A2A friend's turn needs it as a
195
+ // Telegram turn does (without it every Butler house read answered "Sanctuary runtime is unavailable"). The
196
+ // relationship profile still decides which of those tools the peer may call.
196
197
  toolContext: {
197
- ...((0, sanctuary_runtime_1.isSanctuaryAgent)(input.agentName) ? (0, sanctuary_runtime_1.createSanctuaryToolContext)(input.agentName) : {}),
198
+ ...(await (0, active_1.productTurnContext)({ agentName: input.agentName, channel: "a2a" })),
198
199
  ...(input.relationshipAuthorization ? { relationshipAuthorization: input.relationshipAuthorization } : {}),
199
200
  ...(input.delegatedCommand ? { delegatedCommand: input.delegatedCommand } : {}),
200
201
  },
@@ -173,7 +173,7 @@ async function runTelegramTurn(input) {
173
173
  credentials,
174
174
  identityKey,
175
175
  _agentRoot: agentRoot,
176
- _toolContext: { agentRoot, ...house.toolContext },
176
+ productContext: { agentRoot, ...house.toolContext },
177
177
  api,
178
178
  createLongPoll: (options) => {
179
179
  onMessage = options.onMessage;
@@ -7,6 +7,7 @@ exports.productFor = productFor;
7
7
  exports.productAgentAmong = productAgentAmong;
8
8
  exports.productHabit = productHabit;
9
9
  exports.productEventSource = productEventSource;
10
+ exports.productTurnContext = productTurnContext;
10
11
  const runtime_1 = require("../../nerves/runtime");
11
12
  const container_runtime_1 = require("../daemon/container-runtime");
12
13
  /** The seam version this harness runs. A product built for another stops the start. */
@@ -100,3 +101,27 @@ function productEventSource(agentName, source) {
100
101
  const sources = productFor(agentName)?.eventSources;
101
102
  return sources && Object.hasOwn(sources, source) ? sources[source] : null;
102
103
  }
104
+ /**
105
+ * The product's part of this turn's tool context (J4), or nothing when the agent has no product or the product adds none.
106
+ * A rejection from the product fails the turn. On a `tolerant` turn it runs without the product's part instead, and says so.
107
+ */
108
+ async function productTurnContext(input, options = {}) {
109
+ const product = productFor(input.agentName);
110
+ if (!product?.turnContext)
111
+ return {};
112
+ try {
113
+ return await product.turnContext(input);
114
+ }
115
+ catch (error) {
116
+ (0, runtime_1.emitNervesEvent)({
117
+ level: options.tolerant ? "warn" : "error",
118
+ component: "daemon",
119
+ event: "daemon.product_hook_error",
120
+ message: options.tolerant ? "the product's turn context failed, so this turn runs without it" : "the product's turn context failed, so the turn or sense start that asked for it fails",
121
+ meta: { productId: product.id, hook: "turnContext", agent: input.agentName, channel: input.channel, reason: error instanceof Error ? error.message : String(error) },
122
+ });
123
+ if (options.tolerant)
124
+ return {};
125
+ throw error;
126
+ }
127
+ }
@@ -42,11 +42,6 @@ const sanctuary_scheduler_liveness_1 = require("../heart/daemon/sanctuary-schedu
42
42
  const sanctuary_package_management_1 = require("../heart/daemon/sanctuary-package-management");
43
43
  const runtime_1 = require("../nerves/runtime");
44
44
  const telegram_identity_key_1 = require("../senses/telegram-identity-key");
45
- async function sanctuarySourceReady(agent, source) {
46
- // Loaded here, not with the product: it imports Sanctuary's tool registry.
47
- const { ensureSanctuarySourceRuntimeReady } = await Promise.resolve().then(() => __importStar(require("../senses/sanctuary-runtime")));
48
- await ensureSanctuarySourceRuntimeReady(agent, source);
49
- }
50
45
  /** The acceptance run that proves a cron fire reaches the health sweep (Unit 16f), when one is running. */
51
46
  function cronFingerprintScenario(agent) {
52
47
  const marker = (0, sanctuary_acceptance_marker_1.readSanctuaryAcceptanceMarker)(agent);
@@ -57,6 +52,11 @@ function cronFingerprintScenario(agent) {
57
52
  * Butler. During the cron-fingerprint acceptance run it also records the liveness receipt that proves the fire was the
58
53
  * scheduler's and did no paid work.
59
54
  */
55
+ // The Butler's runtime is loaded at its first use, not with the product: it imports Sanctuary's whole tool registry, and every
56
+ // process on the image (each CLI command, the scheduler's poke) loads the product.
57
+ async function sanctuaryRuntime() {
58
+ return Promise.resolve().then(() => __importStar(require("../senses/sanctuary-runtime")));
59
+ }
60
60
  async function runSanctuaryHealth(input) {
61
61
  const schedulerScenario = cronFingerprintScenario(input.agent);
62
62
  const agentRoot = path.join((0, identity_1.getAgentBundlesRoot)(), `${input.agent}.ouro`);
@@ -116,9 +116,11 @@ exports.product = {
116
116
  },
117
117
  // J5: events from the house check and the Usenet watch wake the Butler only once its machine credentials are complete.
118
118
  eventSources: {
119
- "sanctuary-health": { ready: (agent) => sanctuarySourceReady(agent, "sanctuary-health") },
120
- "sanctuary-usenet": { ready: (agent) => sanctuarySourceReady(agent, "sanctuary-usenet") },
119
+ "sanctuary-health": { ready: async (agent) => { await (await sanctuaryRuntime()).ensureSanctuarySourceRuntimeReady(agent, "sanctuary-health"); } },
120
+ "sanctuary-usenet": { ready: async (agent) => { await (await sanctuaryRuntime()).ensureSanctuarySourceRuntimeReady(agent, "sanctuary-usenet"); } },
121
121
  },
122
+ // J4: every turn gets the house runtime its tools read, and the answer gates the Butler opts in to.
123
+ turnContext: async ({ agentName }) => (await sanctuaryRuntime()).createSanctuaryToolContext(agentName),
122
124
  // J5: the house check runs in the daemon, and only Supercronic may fire it on its cron schedule.
123
125
  habits: {
124
126
  "sanctuary-health": {
@@ -46,7 +46,7 @@ exports.enrichDelegatedFromWithBridge = enrichDelegatedFromWithBridge;
46
46
  exports.routeDelegatedCompletion = routeDelegatedCompletion;
47
47
  exports.buildParseErrorNudge = buildParseErrorNudge;
48
48
  exports.buildHeldReturnWakeMessage = buildHeldReturnWakeMessage;
49
- exports.sanctuaryToolContextFor = sanctuaryToolContextFor;
49
+ exports.privateTurnProductContext = privateTurnProductContext;
50
50
  exports.runPrivateRuntimeTurn = runPrivateRuntimeTurn;
51
51
  const fs = __importStar(require("fs"));
52
52
  const path = __importStar(require("path"));
@@ -91,7 +91,7 @@ const habit_policy_1 = require("../rsvp/habit-policy");
91
91
  const daemon_health_1 = require("../heart/daemon/daemon-health");
92
92
  const flight_recorder_1 = require("../arc/flight-recorder");
93
93
  const desk_section_1 = require("../mind/desk-section");
94
- const sanctuary_runtime_1 = require("./sanctuary-runtime");
94
+ const active_1 = require("../heart/product/active");
95
95
  const shared_turn_1 = require("./shared-turn");
96
96
  const relationship_authorization_2 = require("../repertoire/relationship-authorization");
97
97
  const private_runtime_1 = require("../heart/private-runtime");
@@ -1025,27 +1025,14 @@ function reduceHabitSessionToNoSend(habitSession) {
1025
1025
  },
1026
1026
  };
1027
1027
  }
1028
- /** Sanctuary tool context for a private turn: always for the sanctuary agent, and for sanctuary external events.
1029
- * Sanctuary external events keep the strict behavior (a missing config fails the turn); other turns degrade to
1030
- * no context so a config gap cannot stop the agent from waking at all. */
1031
- function sanctuaryToolContextFor(agentName, externalEventSource) {
1032
- const sanctuaryEvent = externalEventSource === "sanctuary-health" || externalEventSource === "sanctuary-usenet";
1033
- if (sanctuaryEvent)
1034
- return (0, sanctuary_runtime_1.createSanctuaryToolContext)(agentName);
1035
- if (!(0, sanctuary_runtime_1.isSanctuaryAgent)(agentName))
1036
- return {};
1037
- try {
1038
- return (0, sanctuary_runtime_1.createSanctuaryToolContext)(agentName);
1039
- }
1040
- catch (error) {
1041
- (0, runtime_1.emitNervesEvent)({
1042
- component: "senses",
1043
- event: "senses.sanctuary_tool_context_unavailable",
1044
- message: "sanctuary tool context could not be built for a private turn",
1045
- meta: { agent: agentName, reason: String(error) },
1046
- });
1047
- return {};
1048
- }
1028
+ /**
1029
+ * The product's part of a private turn's tool context. A turn for one of the product's own events fails without it; any
1030
+ * other private turn (await, habit, instinct, another source's event) runs without it, so a gap in the product's config
1031
+ * can't stop the agent from waking at all.
1032
+ */
1033
+ async function privateTurnProductContext(agentName, externalEventSource) {
1034
+ const productEvent = externalEventSource !== undefined && (0, active_1.productEventSource)(agentName, externalEventSource) !== null;
1035
+ return (0, active_1.productTurnContext)({ agentName, channel: "inner", ...(externalEventSource !== undefined ? { externalEventSource } : {}) }, { tolerant: !productEvent });
1049
1036
  }
1050
1037
  async function runPrivateRuntimeTurn(options) {
1051
1038
  const now = options?.now ?? (() => new Date());
@@ -1553,9 +1540,8 @@ async function runPrivateRuntimeTurn(options) {
1553
1540
  autonomousTurnKind: options?.externalEvent ? "external-event"
1554
1541
  : reason === "await" || reason === "habit" || reason === "instinct" ? reason : "scheduler",
1555
1542
  ...(reason === "await" && options?.awaitName ? { autonomousAwaitName: options.awaitName } : {}),
1556
- // The Butler's Sanctuary read tools need the typed runtime on every private turn
1557
- // (await, habit, instinct, external-event), not only on sanctuary external events.
1558
- ...(sanctuaryToolContextFor(agentName, options?.externalEvent?.source)),
1543
+ // A product's tools need its runtime on every private turn (await, habit, instinct, external event).
1544
+ ...(await privateTurnProductContext(agentName, options?.externalEvent?.source)),
1559
1545
  ...(relationshipAwait ? {
1560
1546
  friendStore: relationshipAwait.store,
1561
1547
  context: relationshipAwait.context,
@@ -34,7 +34,6 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.SANCTUARY_ANSWER_GATES = void 0;
37
- exports.isSanctuaryAgent = isSanctuaryAgent;
38
37
  exports.runWithSanctuaryToolReceiptCollection = runWithSanctuaryToolReceiptCollection;
39
38
  exports.loadSanctuarySabApiKey = loadSanctuarySabApiKey;
40
39
  exports.sanctuaryJellyfinDeviceId = sanctuaryJellyfinDeviceId;
@@ -67,10 +66,6 @@ const bundle_manifest_1 = require("../mind/bundle-manifest");
67
66
  const sanctuaryToolReceipts = new node_async_hooks_1.AsyncLocalStorage();
68
67
  const sanctuaryToolGroundings = new node_async_hooks_1.AsyncLocalStorage();
69
68
  const acceptanceLedgerTails = new Map();
70
- /** The Butler agent whose private and A2A turns carry the Sanctuary tool context. */
71
- function isSanctuaryAgent(agentName) {
72
- return (0, butler_agent_1.isButlerAgent)(agentName);
73
- }
74
69
  function isSanctuaryExternalEventSource(source) {
75
70
  return source === "sanctuary-health" || source === "sanctuary-usenet";
76
71
  }
@@ -85,6 +85,7 @@ const inbound_journal_1 = require("./inbound-journal");
85
85
  const sanctuary_authority_resident_1 = require("./sanctuary-authority-resident");
86
86
  const root_host_approval_runtime_1 = require("./root-host-approval-runtime");
87
87
  const tools_sanctuary_host_1 = require("../repertoire/tools-sanctuary-host");
88
+ const active_1 = require("../heart/product/active");
88
89
  const sanctuary_runtime_2 = require("./sanctuary-runtime");
89
90
  const sanctuary_full_visibility_contract_1 = require("./sanctuary-full-visibility-contract");
90
91
  const sanctuary_install_state_contract_1 = require("./sanctuary-install-state-contract");
@@ -967,7 +968,7 @@ function createTelegramSenseApp(options) {
967
968
  let interactiveControl;
968
969
  let approvalRelayDoor;
969
970
  try {
970
- toolContext = useSanctuaryRuntime ? (options._toolContext ?? (0, sanctuary_runtime_2.createSanctuaryToolContext)(options.agentName)) : undefined;
971
+ toolContext = useSanctuaryRuntime ? (options.productContext ?? {}) : undefined;
971
972
  if (toolContext && options.telegramContactManager)
972
973
  toolContext.telegramContactManager = options.telegramContactManager;
973
974
  approvalRuntime = options.approvalRuntime ?? (useSanctuaryRuntime ? (options._createApprovalRuntime ?? telegram_approval_runtime_1.createTelegramApprovalRuntime)({
@@ -977,7 +978,8 @@ function createTelegramSenseApp(options) {
977
978
  authorizedChatId,
978
979
  subject,
979
980
  identityKey,
980
- toolContext: toolContext ?? {},
981
+ // Set above whenever this sense runs the Sanctuary runtime, which is the only time an approval runtime is built.
982
+ toolContext: toolContext,
981
983
  ...(options.resolveRelationshipAuthorization ? {
982
984
  resolveOwnerRelationship: (binding) => options.resolveRelationshipAuthorization({
983
985
  friendId: binding.friendId, requestId: binding.requestId, sessionEventId: binding.sessionEventId, sessionKey: binding.sessionKey,
@@ -2682,6 +2684,7 @@ async function startTelegramSenseApp(agentName, waitForAuthority = false) {
2682
2684
  agentName,
2683
2685
  credentials,
2684
2686
  authorityTransport,
2687
+ productContext: await (0, active_1.productTurnContext)({ agentName, channel: "telegram" }),
2685
2688
  // The owner is in Los Angeles; a container without TZ would otherwise run quiet hours on UTC.
2686
2689
  proactivePacing: { timeZone: process.env.TZ || "America/Los_Angeles" },
2687
2690
  ...(() => { const ownerRoute = (0, telegram_owner_route_1.ownerRouteForAgent)(agentName, (0, identity_1.getAgentRoot)(agentName)); return ownerRoute ? { ownerRoute } : {}; })(),
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1701",
3
+ "version": "0.1.0-alpha.1702",
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.1701",
9
+ "version": "0.1.0-alpha.1702",
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.1701",
3
+ "version": "0.1.0-alpha.1702",
4
4
  "description": "Ouroboros, the agent harness: agents with durable memory that live where you talk (terminal, Teams, iMessage, mail, voice) and use real tools. Start with npx ouro.bot@latest.",
5
5
  "homepage": "https://ouroboros.bot/",
6
6
  "engines": {