@ouro.bot/cli 0.1.0-alpha.1376 → 0.1.0-alpha.1377

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.1377",
6
+ "changes": [
7
+ "The Butler checks Slugger's card every 5 minutes. After 3 failed checks it tells the owner once on Telegram that Slugger is unreachable, and silently when he is back."
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.1376",
6
12
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1376",
2
+ "runtimeVersion": "0.1.0-alpha.1377",
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.1376</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1377</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -1621,7 +1621,10 @@ async function sendTelegramText(api, chatId, text, options = {}) {
1621
1621
  options.onMessageDelivered?.(messageId, chunk);
1622
1622
  };
1623
1623
  for (const [index, chunk] of (options.split ?? telegram_markdown_1.splitTelegramText)(text).entries()) {
1624
- const replyTo = index === 0 && options.replyToMessageId ? { reply_parameters: { message_id: options.replyToMessageId } } : {};
1624
+ const replyTo = {
1625
+ ...(index === 0 && options.replyToMessageId ? { reply_parameters: { message_id: options.replyToMessageId } } : {}),
1626
+ ...(options.silent ? { disable_notification: true } : {}),
1627
+ };
1625
1628
  try {
1626
1629
  recordMessageId(await api.request("sendMessage", {
1627
1630
  chat_id: chatId,
@@ -1644,7 +1647,7 @@ async function sendTelegramText(api, chatId, text, options = {}) {
1644
1647
  throw retry;
1645
1648
  }
1646
1649
  }
1647
- recordMessageId(await api.request("sendMessage", { chat_id: chatId, text: chunk }, options.signal), chunk);
1650
+ recordMessageId(await api.request("sendMessage", { chat_id: chatId, text: chunk, ...(options.silent ? { disable_notification: true } : {}) }, options.signal), chunk);
1648
1651
  }
1649
1652
  }
1650
1653
  return results;
@@ -117,6 +117,7 @@ function validateArtifact(artifact, expectedId) {
117
117
  const effectValid = effect?.kind === "text" || effect?.kind === "admission_ack"
118
118
  ? boundedText(effect.text, 150_000)
119
119
  && (effect.kind !== "text" || effect.replyToMessageId === undefined || (Number.isSafeInteger(effect.replyToMessageId) && effect.replyToMessageId > 0))
120
+ && (effect.kind !== "text" || effect.silent === undefined || effect.silent === true)
120
121
  : effect?.kind === "card"
121
122
  ? boundedText(effect.text) && (effect.silent === undefined || effect.silent === true) && Array.isArray(effect.buttons) && effect.buttons.length > 0 && effect.buttons.length <= 20
122
123
  && effect.buttons.every((row) => Array.isArray(row) && row.length > 0 && row.length <= 8
@@ -385,6 +386,7 @@ async function executePart(api, artifact, part, chatId, signal) {
385
386
  ...(signal ? { signal } : {}),
386
387
  ...(markdown ? { renderHtml: telegram_markdown_1.renderTelegramMarkdown, fallbackHtml: telegram_markdown_1.renderTelegramMarkdownSafe } : {}),
387
388
  ...(replyToMessageId ? { replyToMessageId } : {}),
389
+ ...(effect.kind === "text" && effect.silent ? { silent: true } : {}),
388
390
  });
389
391
  if (ids.length !== 1)
390
392
  throw new Error("Telegram effect chunk renderer returned an unexpected message count");
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OWNER_ROUTE_FALLBACK_PREFIX = void 0;
3
+ exports.OWNER_ROUTE_FALLBACK_PREFIX = exports.OWNER_ROUTE_BACK_TEXT = exports.OWNER_ROUTE_DOWN_TEXT = exports.OWNER_ROUTE_WATCH_FAILURES = exports.OWNER_ROUTE_WATCH_INTERVAL_MS = void 0;
4
4
  exports.ownerRouteUrgency = ownerRouteUrgency;
5
5
  exports.ownerRouteDedupeKey = ownerRouteDedupeKey;
6
6
  exports.ownerRouteItem = ownerRouteItem;
@@ -12,6 +12,11 @@ const client_1 = require("../a2a/client");
12
12
  const identity_1 = require("../a2a/identity");
13
13
  const identity_2 = require("../heart/identity");
14
14
  const runtime_1 = require("../nerves/runtime");
15
+ /** How often the Butler checks the peer, and how many failed checks in a row (15 minutes) count as down. */
16
+ exports.OWNER_ROUTE_WATCH_INTERVAL_MS = 5 * 60_000;
17
+ exports.OWNER_ROUTE_WATCH_FAILURES = 3;
18
+ exports.OWNER_ROUTE_DOWN_TEXT = "Slugger (your phone bot) has been unreachable for 15 min; agents can't reach you through him.";
19
+ exports.OWNER_ROUTE_BACK_TEXT = "Slugger is reachable again, so agents reach you through him as before.";
15
20
  exports.OWNER_ROUTE_FALLBACK_PREFIX = "Slugger can't be reached, so this comes to you directly.";
16
21
  function ownerRouteUrgency(key, critical) {
17
22
  if (critical)
@@ -65,14 +70,28 @@ const reason = (error) => error instanceof Error ? error.message : String(error)
65
70
  function createA2AOwnerRoute(options) {
66
71
  const fetchCard = options.fetchCard ?? client_1.fetchA2AAgentCard;
67
72
  const send = options.send ?? client_1.sendSealedA2AChat;
68
- return async (item) => {
73
+ /** null when the card at the address serves the pinned DID; otherwise why not. */
74
+ const pinned = async () => {
75
+ const served = (0, client_1.cardDid)(await fetchCard(options.cardUrl));
76
+ if (served === options.did)
77
+ return null;
78
+ (0, runtime_1.emitNervesEvent)({ level: "error", component: "senses", event: "senses.telegram_owner_route_pin_mismatch", message: "the owner route's peer card serves another DID", meta: { cardUrl: options.cardUrl, served: served ?? null, pinned: options.did } });
79
+ return `the card at ${options.cardUrl} serves ${served}, not the pinned ${options.did}`;
80
+ };
81
+ const probe = async () => {
82
+ try {
83
+ const detail = await pinned();
84
+ return detail ? { status: "unreachable", detail } : { status: "delivered" };
85
+ }
86
+ catch (error) {
87
+ return { status: "unreachable", detail: reason(error) };
88
+ }
89
+ };
90
+ const route = async (item) => {
69
91
  try {
70
- const served = (0, client_1.cardDid)(await fetchCard(options.cardUrl));
71
- if (served !== options.did) {
72
- const detail = `the card at ${options.cardUrl} serves ${served}, not the pinned ${options.did}`;
73
- (0, runtime_1.emitNervesEvent)({ level: "error", component: "senses", event: "senses.telegram_owner_route_pin_mismatch", message: "the owner route's peer card serves another DID", meta: { cardUrl: options.cardUrl, served: served ?? null, pinned: options.did } });
92
+ const detail = await pinned();
93
+ if (detail)
74
94
  return { status: "unreachable", detail };
75
- }
76
95
  await send({ cardUrl: options.cardUrl, text: formatOwnerRouteMessage(item), identity: await options.loadIdentity() });
77
96
  (0, runtime_1.emitNervesEvent)({ component: "senses", event: "senses.telegram_owner_route_delivered", message: "sent a self-started Butler message to the owner's primary agent", meta: { urgency: item.urgency, dedupeKey: item.dedupeKey } });
78
97
  return { status: "delivered" };
@@ -82,6 +101,7 @@ function createA2AOwnerRoute(options) {
82
101
  return { status: "unreachable", detail: reason(error) };
83
102
  }
84
103
  };
104
+ return Object.assign(route, { probe });
85
105
  }
86
106
  /** The owner route `agent.json` names (`senses.telegram.ownerNoticesTo`), signing as this agent's A2A identity; none when unset. */
87
107
  function ownerRouteForAgent(agentName, agentRoot) {
@@ -1104,6 +1104,45 @@ function createTelegramSenseApp(options) {
1104
1104
  (0, runtime_1.emitNervesEvent)({ component: "senses", event: "senses.telegram_notice_held_for_owner_route", message: "held a house notice until the owner's primary agent can be reached", meta: { agentName: options.agentName, dedupeKey: item.dedupeKey } });
1105
1105
  return null;
1106
1106
  };
1107
+ const ownerRouteWatchPath = path.join(agentRoot, "state", "telegram", "owner-route-watch.json");
1108
+ const readOwnerRouteWatch = () => {
1109
+ try {
1110
+ const parsed = JSON.parse((0, node_fs_1.readFileSync)(ownerRouteWatchPath, "utf8"));
1111
+ return { failures: Number.isSafeInteger(parsed.failures) ? parsed.failures : 0, alertedAt: typeof parsed.alertedAt === "string" ? parsed.alertedAt : null };
1112
+ }
1113
+ catch {
1114
+ return { failures: 0, alertedAt: null };
1115
+ }
1116
+ };
1117
+ const writeOwnerRouteWatch = (state) => {
1118
+ (0, node_fs_1.mkdirSync)(path.dirname(ownerRouteWatchPath), { recursive: true });
1119
+ (0, atomic_file_1.writeFileAtomicSync)(ownerRouteWatchPath, JSON.stringify(state));
1120
+ };
1121
+ const checkOwnerRoute = async () => {
1122
+ const probe = options.ownerRoute?.probe;
1123
+ if (!probe)
1124
+ return;
1125
+ const outcome = await probe();
1126
+ const state = readOwnerRouteWatch();
1127
+ if (outcome.status === "delivered") {
1128
+ if (state.alertedAt) {
1129
+ await executeAuthorizedEffect({ idempotencyKey: `owner-route-watch:back:${state.alertedAt}`, target: configuredOwnerTarget(), authorClass: "butler", effect: { kind: "text", text: telegram_owner_route_1.OWNER_ROUTE_BACK_TEXT, silent: true } });
1130
+ (0, runtime_1.emitNervesEvent)({ component: "senses", event: "senses.telegram_owner_route_back", message: "told the owner, silently, that the primary agent is reachable again", meta: { agentName: options.agentName, downSince: state.alertedAt } });
1131
+ }
1132
+ if (state.failures || state.alertedAt)
1133
+ writeOwnerRouteWatch({ failures: 0, alertedAt: null });
1134
+ return;
1135
+ }
1136
+ const failures = state.failures + 1;
1137
+ if (failures < telegram_owner_route_1.OWNER_ROUTE_WATCH_FAILURES || state.alertedAt) {
1138
+ writeOwnerRouteWatch({ failures, alertedAt: state.alertedAt });
1139
+ return;
1140
+ }
1141
+ const alertedAt = new Date().toISOString();
1142
+ await executeAuthorizedEffect({ idempotencyKey: `owner-route-watch:down:${alertedAt}`, target: configuredOwnerTarget(), authorClass: "butler", effect: { kind: "text", text: telegram_owner_route_1.OWNER_ROUTE_DOWN_TEXT } });
1143
+ writeOwnerRouteWatch({ failures, alertedAt });
1144
+ (0, runtime_1.emitNervesEvent)({ level: "warn", component: "senses", event: "senses.telegram_owner_route_down", message: "told the owner on Telegram that the primary agent has been unreachable for 15 minutes", meta: { agentName: options.agentName, detail: outcome.detail } });
1145
+ };
1107
1146
  /** With an owner route, held notices go to the peer one by one; a critical one it can't take goes to Telegram as a fallback. */
1108
1147
  const releaseHeldNoticesToRoute = async (route, signal) => {
1109
1148
  const sessionPath = (0, shared_turn_1.getSenseSessionPath)(options.agentName, configuredOwnerFriendId, "telegram", configuredOwnerSessionKey, agentRoot);
@@ -1867,6 +1906,7 @@ function createTelegramSenseApp(options) {
1867
1906
  retireAcceptanceAudit,
1868
1907
  ]);
1869
1908
  return {
1909
+ checkOwnerRoute,
1870
1910
  run(signal) {
1871
1911
  if (runPromise)
1872
1912
  return runPromise;
@@ -1907,10 +1947,16 @@ function createTelegramSenseApp(options) {
1907
1947
  approvalReconciliationActive = true;
1908
1948
  nextApprovalReconcileDeadline = undefined;
1909
1949
  scheduleApprovalReconcile();
1950
+ const ownerRouteWatch = options.ownerRoute?.probe
1951
+ ? setInterval(() => {
1952
+ void checkOwnerRoute().catch((error) => (0, runtime_1.emitNervesEvent)({ level: "error", component: "senses", event: "senses.telegram_owner_route_watch_error", message: "the check of the owner's primary agent failed", meta: { agentName: options.agentName, error: transportError(error) } }));
1953
+ }, telegram_owner_route_1.OWNER_ROUTE_WATCH_INTERVAL_MS)
1954
+ : undefined;
1910
1955
  try {
1911
1956
  await poll.run(signal);
1912
1957
  }
1913
1958
  finally {
1959
+ clearInterval(ownerRouteWatch);
1914
1960
  approvalReconciliationActive = false;
1915
1961
  nextApprovalReconcileDeadline = undefined;
1916
1962
  clearApprovalReconcileTimer();
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1376",
3
+ "version": "0.1.0-alpha.1377",
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.1376",
9
+ "version": "0.1.0-alpha.1377",
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.1376",
3
+ "version": "0.1.0-alpha.1377",
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": {