@ouro.bot/cli 0.1.0-alpha.1460 → 0.1.0-alpha.1461

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,13 +1,24 @@
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.1461",
6
+ "changes": [
7
+ "When someone reacts to a message on iMessage, Telegram or Teams, the agent now reads what that message said (\"loved your message: \"are voice notes working?\"\") instead of a bare id. All three apps use one shared lookup: iMessage asks the BlueBubbles server for the message, Telegram reads the agent's own sent-message journal, and Teams reads a small new record of the agent's sent messages. When the message still can't be found, the agent is told so plainly and can ask."
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.1460",
12
+ "changes": [
13
+ "The container build compiles native dependencies against the Node headers already installed on the runner, so one timed-out download from nodejs.org no longer stops a release."
14
+ ]
15
+ },
16
+ {
17
+ "version": "0.1.0-alpha.1459",
6
18
  "changes": [
7
19
  "When a coding session the agent started finishes, fails, is stopped, stalls or waits for input, the agent is woken right away with a message saying which session it was, who it was for, what it ended with, and to tell that person now with `send_message` instead of waiting for a check-back. This works whatever chat started the session (iMessage, Telegram, Teams, the CLI or the agent's own private turn), and for Orca, local and Workbench sessions alike. Before, only sessions started from the CLI tried to wake the agent, and the private-runtime policy refused even those.",
8
20
  "Orca and Workbench sessions are now checked every 30 seconds while any is still open, not only while someone is watching one, and a local session found dead after a restart is reported once.",
9
- "Copilot app session replies and finished coding work now reach the agent through one shared path: a message queued for the private runtime, then a wake.",
10
- "The container build compiles native dependencies against the Node headers already installed on the runner, so one timed-out download from nodejs.org no longer stops a release."
21
+ "Copilot app session replies and finished coding work now reach the agent through one shared path: a message queued for the private runtime, then a wake."
11
22
  ]
12
23
  },
13
24
  {
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1460",
2
+ "runtimeVersion": "0.1.0-alpha.1461",
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.1460</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1461</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveChatMessageRef = resolveChatMessageRef;
4
+ exports.resolveChatInteractionTarget = resolveChatInteractionTarget;
3
5
  exports.renderChatInteraction = renderChatInteraction;
4
6
  const runtime_1 = require("../nerves/runtime");
5
7
  const EXCERPT_MAX_LENGTH = 80;
@@ -19,6 +21,35 @@ function targetPhrase(target, eventName) {
19
21
  ? `an unidentified message (target ${target.id}; its text could not be resolved)`
20
22
  : `an unidentified message (the ${eventName} carried no target message reference)`;
21
23
  }
24
+ /**
25
+ * Fill in the message a reaction or edit points at, so the agent reads what was reacted to instead of a bare id.
26
+ * Every sense calls this with its own lookup; what the sense already knows wins over the lookup. A lookup that fails
27
+ * leaves the target as it was, and the renderer then says plainly that the message could not be found.
28
+ */
29
+ async function resolveChatMessageRef(target, lookup,
30
+ /** The id to look up when it differs from the one shown to the agent (BlueBubbles shows "guid X"). */
31
+ lookupId = target.id) {
32
+ if (target.text?.trim() || !lookupId)
33
+ return target;
34
+ let found = null;
35
+ try {
36
+ found = await lookup(lookupId);
37
+ }
38
+ catch (error) {
39
+ (0, runtime_1.emitNervesEvent)({ level: "warn", component: "senses", event: "senses.chat_interaction_target_lookup_failed", message: "could not look up the message a reaction or edit points at", meta: { reason: error instanceof Error ? error.message : String(error) } });
40
+ }
41
+ const text = found?.text?.trim();
42
+ (0, runtime_1.emitNervesEvent)({ component: "senses", event: "senses.chat_interaction_target_resolved", message: "looked up the message a reaction or edit points at", meta: { found: Boolean(text) } });
43
+ if (!text)
44
+ return target;
45
+ const fromAgent = target.fromAgent ?? found?.fromAgent;
46
+ return { ...target, text, ...(typeof fromAgent === "boolean" ? { fromAgent } : {}) };
47
+ }
48
+ /** `resolveChatMessageRef` for a whole interaction; returns the same object when nothing was found. */
49
+ async function resolveChatInteractionTarget(interaction, lookup, lookupId) {
50
+ const target = await resolveChatMessageRef(interaction.target, lookup, lookupId ?? interaction.target.id);
51
+ return target === interaction.target ? interaction : { ...interaction, target };
52
+ }
22
53
  /** The words the agent reads for an edit or a reaction. */
23
54
  function renderChatInteraction(interaction) {
24
55
  (0, runtime_1.emitNervesEvent)({ component: "senses", event: "senses.chat_interaction_rendered", message: "chat interaction rendered for the agent", meta: { kind: interaction.kind } });
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.SENT_MESSAGE_LEDGER_MAX_TEXT = exports.SENT_MESSAGE_LEDGER_MAX_ENTRIES = void 0;
37
+ exports.recordSentMessage = recordSentMessage;
38
+ exports.sentMessageLookup = sentMessageLookup;
39
+ const fs = __importStar(require("node:fs"));
40
+ const path = __importStar(require("node:path"));
41
+ const node_crypto_1 = require("node:crypto");
42
+ const runtime_1 = require("../nerves/runtime");
43
+ const atomic_file_1 = require("./atomic-file");
44
+ /**
45
+ * The messages the agent sent on a chat app that keeps no history the agent can read back, keyed by the id the app gave
46
+ * each one. When someone reacts to one of them the app sends only that id, and this is how the agent learns what it said.
47
+ * A sense whose app or journal already answers that (BlueBubbles' server, Telegram's effect journal) uses its own record
48
+ * instead, so no message is kept twice. Lives under the agent's ignored `state/`, newest entries kept, text excerpted.
49
+ */
50
+ exports.SENT_MESSAGE_LEDGER_MAX_ENTRIES = 500;
51
+ exports.SENT_MESSAGE_LEDGER_MAX_TEXT = 500;
52
+ function ledgerPath(agentRoot, channel) {
53
+ return path.join(agentRoot, "state", "senses", "sent-messages", `${channel.replace(/[^\w.-]/g, "_")}.json`);
54
+ }
55
+ function entryKey(conversationId, messageId) {
56
+ return (0, node_crypto_1.createHash)("sha256").update(`${conversationId}\0${messageId}`).digest("hex");
57
+ }
58
+ function readLedger(file) {
59
+ try {
60
+ const parsed = JSON.parse(fs.readFileSync(file, "utf8"));
61
+ return Array.isArray(parsed.entries)
62
+ ? parsed.entries.filter((entry) => typeof entry?.key === "string" && typeof entry.text === "string")
63
+ : [];
64
+ }
65
+ catch {
66
+ return [];
67
+ }
68
+ }
69
+ /** Note a message the agent sent. Never throws: losing one entry only means a later reaction to it reads as unidentified. */
70
+ function recordSentMessage(scope, messageId, text, now = new Date()) {
71
+ const trimmed = text.trim();
72
+ if (!messageId || !trimmed)
73
+ return;
74
+ let channel = "unknown";
75
+ try {
76
+ // A scope can be computed lazily (finding the agent root can fail), and that failure is caught here too.
77
+ const resolved = typeof scope === "function" ? scope() : scope;
78
+ channel = resolved.channel;
79
+ const file = ledgerPath(resolved.agentRoot, resolved.channel);
80
+ const key = entryKey(resolved.conversationId, messageId);
81
+ const entries = readLedger(file).filter((entry) => entry.key !== key);
82
+ entries.push({ key, text: trimmed.slice(0, exports.SENT_MESSAGE_LEDGER_MAX_TEXT), sentAt: now.toISOString() });
83
+ const body = { version: 1, entries: entries.slice(-exports.SENT_MESSAGE_LEDGER_MAX_ENTRIES) };
84
+ (0, atomic_file_1.writeFileAtomicSync)(file, `${JSON.stringify(body)}\n`);
85
+ (0, runtime_1.emitNervesEvent)({ component: "senses", event: "senses.sent_message_recorded", message: "noted a sent message for later reactions", meta: { channel } });
86
+ }
87
+ catch (error) {
88
+ (0, runtime_1.emitNervesEvent)({ level: "warn", component: "senses", event: "senses.sent_message_record_failed", message: "could not note a sent message", meta: { channel, reason: String(error) } });
89
+ }
90
+ }
91
+ /** A lookup for `resolveChatInteractionTarget` over this ledger: messages found here are always the agent's. */
92
+ function sentMessageLookup(scope) {
93
+ return (messageId) => {
94
+ const key = entryKey(scope.conversationId, messageId);
95
+ const entry = readLedger(ledgerPath(scope.agentRoot, scope.channel)).find((candidate) => candidate.key === key);
96
+ return entry ? { text: entry.text, fromAgent: true } : null;
97
+ };
98
+ }
@@ -48,6 +48,7 @@ exports.isAgentSelfHandle = isAgentSelfHandle;
48
48
  exports.getDiscoveredOwnHandles = getDiscoveredOwnHandles;
49
49
  exports.clearDiscoveredOwnHandles = clearDiscoveredOwnHandles;
50
50
  exports.recordDiscoveredOwnHandle = recordDiscoveredOwnHandle;
51
+ exports.nameBlueBubblesReactionTarget = nameBlueBubblesReactionTarget;
51
52
  exports.seedBlueBubblesStartupSemanticObservations = seedBlueBubblesStartupSemanticObservations;
52
53
  exports.handleBlueBubblesEvent = handleBlueBubblesEvent;
53
54
  exports.recoverQueuedBlueBubblesMessages = recoverQueuedBlueBubblesMessages;
@@ -83,6 +84,7 @@ const proactive_content_guard_1 = require("../proactive-content-guard");
83
84
  const bluebubbles_meta_guard_1 = require("../bluebubbles-meta-guard");
84
85
  const model_1 = require("./model");
85
86
  const client_1 = require("./client");
87
+ const chat_interaction_1 = require("../../heart/chat-interaction");
86
88
  const reactions_1 = require("./reactions");
87
89
  const send_file_1 = require("./send-file");
88
90
  const tools_chat_1 = require("../../repertoire/tools-chat");
@@ -2630,6 +2632,24 @@ function isCaptureOnlyBlueBubblesMutation(capture) {
2630
2632
  return capture.event.kind === "unsend";
2631
2633
  }
2632
2634
  /** A reaction or an edit is speech to the agent: it arrives as a message carrying the shared rendering, aimed at the message it changes. */
2635
+ /**
2636
+ * A tapback names only the guid it points at. Ask the BlueBubbles server for that message (the agent's own sent
2637
+ * history and the person's), through the reaction resolver every sense shares, so the agent reads what was reacted to.
2638
+ */
2639
+ async function nameBlueBubblesReactionTarget(event, client) {
2640
+ if (event.mutationType !== "reaction" || !event.reaction || !event.targetMessageGuid)
2641
+ return event;
2642
+ const interaction = (0, model_1.blueBubblesReactionInteraction)(event.reaction, { guid: event.targetMessageGuid });
2643
+ const named = await (0, chat_interaction_1.resolveChatInteractionTarget)(interaction, async (guid) => {
2644
+ if (client.getRepliedMessage) {
2645
+ const replied = await client.getRepliedMessage(guid);
2646
+ return replied ? { text: replied.text, fromAgent: replied.fromMe } : null;
2647
+ }
2648
+ const text = await client.getMessageText(guid);
2649
+ return text ? { text } : null;
2650
+ }, event.targetMessageGuid);
2651
+ return named === interaction ? event : { ...event, textForAgent: (0, chat_interaction_1.renderChatInteraction)(named) };
2652
+ }
2633
2653
  function blueBubblesInteractionAsMessage(event) {
2634
2654
  return {
2635
2655
  kind: "message",
@@ -3018,7 +3038,9 @@ async function handleCapturedBlueBubblesSemanticEvent(captured, resolvedDeps, so
3018
3038
  && (identityGroundedRepaired.mutationType === "reaction" || identityGroundedRepaired.mutationType === "edit")
3019
3039
  ? identityGroundedRepaired
3020
3040
  : null;
3021
- const turnEvent = interaction ? blueBubblesInteractionAsMessage(interaction) : identityGroundedRepaired;
3041
+ const turnEvent = interaction
3042
+ ? blueBubblesInteractionAsMessage(await nameBlueBubblesReactionTarget(interaction, resolvedDeps.createClient()))
3043
+ : identityGroundedRepaired;
3022
3044
  if (turnEvent.kind === "mutation") {
3023
3045
  const outcome = auditOnlyHandledOutcome(turnEvent.mutationType);
3024
3046
  publishTerminalReceipt(outcome);
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BlueBubblesIgnoredEventError = void 0;
4
4
  exports.describeBlueBubblesReaction = describeBlueBubblesReaction;
5
5
  exports.renderBlueBubblesReactionText = renderBlueBubblesReactionText;
6
+ exports.blueBubblesReactionInteraction = blueBubblesReactionInteraction;
6
7
  exports.renderBlueBubblesEditText = renderBlueBubblesEditText;
7
8
  exports.normalizeBlueBubblesEvent = normalizeBlueBubblesEvent;
8
9
  const chat_interaction_1 = require("../../heart/chat-interaction");
@@ -203,13 +204,17 @@ function describeBlueBubblesReaction(raw, rawTransportValue = raw) {
203
204
  * it was added or removed, and which message it points at.
204
205
  */
205
206
  function renderBlueBubblesReactionText(reaction, target) {
206
- return (0, chat_interaction_1.renderChatInteraction)({
207
+ return (0, chat_interaction_1.renderChatInteraction)(blueBubblesReactionInteraction(reaction, target));
208
+ }
209
+ /** A tapback as the shared reaction every sense speaks; BlueBubbles only maps its wire values. */
210
+ function blueBubblesReactionInteraction(reaction, target) {
211
+ return {
207
212
  kind: "reaction",
208
213
  label: reaction.action === "remove" ? reaction.noun ?? reaction.raw.replace(/^-/, "") : reaction.raw,
209
214
  ...(reaction.verb ? { verb: reaction.verb } : {}),
210
215
  removed: reaction.action === "remove",
211
216
  target: { ...(target.guid ? { id: `guid ${target.guid}` } : {}), ...(target.text ? { text: target.text } : {}), ...(typeof target.fromMe === "boolean" ? { fromAgent: target.fromMe } : {}) },
212
- });
217
+ };
213
218
  }
214
219
  function stripPartPrefix(guid) {
215
220
  if (!guid)
@@ -38,8 +38,10 @@ exports.aiLabelEntities = aiLabelEntities;
38
38
  exports.stripMentions = stripMentions;
39
39
  exports.splitMessage = splitMessage;
40
40
  exports.sanitizeFeedbackComment = sanitizeFeedbackComment;
41
+ exports.noteTeamsSentMessage = noteTeamsSentMessage;
41
42
  exports.buildFeedbackSyntheticText = buildFeedbackSyntheticText;
42
43
  exports.buildReactionSyntheticText = buildReactionSyntheticText;
44
+ exports.resolveTeamsReactionText = resolveTeamsReactionText;
43
45
  exports.buildEditSyntheticText = buildEditSyntheticText;
44
46
  exports.buildWelcomeCard = buildWelcomeCard;
45
47
  exports.createTeamsCallbacks = createTeamsCallbacks;
@@ -73,6 +75,7 @@ const commands_1 = require("./commands");
73
75
  const nerves_1 = require("../nerves");
74
76
  const runtime_1 = require("../nerves/runtime");
75
77
  const chat_interaction_1 = require("../heart/chat-interaction");
78
+ const sent_message_ledger_1 = require("../heart/sent-message-ledger");
76
79
  const proactive_content_guard_1 = require("./proactive-content-guard");
77
80
  const turn_coordinator_1 = require("../heart/turn-coordinator");
78
81
  const identity_1 = require("../heart/identity");
@@ -171,8 +174,18 @@ function sanitizeFeedbackComment(comment) {
171
174
  }
172
175
  // Teams names its reactions; the agent reads the emoji the person tapped.
173
176
  const TEAMS_REACTION_EMOJI = { like: "👍", dislike: "👎", heart: "❤️", laugh: "😆", surprised: "😮", sad: "😢", angry: "😠" };
174
- function teamsReaction(type, removed) {
175
- return (0, chat_interaction_1.renderChatInteraction)({ kind: "reaction", label: TEAMS_REACTION_EMOJI[type] ?? type, removed, target: { fromAgent: true } });
177
+ function teamsReaction(type, removed, target = { fromAgent: true }) {
178
+ return (0, chat_interaction_1.renderChatInteraction)({ kind: "reaction", label: TEAMS_REACTION_EMOJI[type] ?? type, removed, target });
179
+ }
180
+ /** Where the agent's Teams messages are noted, so a reaction (which carries only the message id) can say what was reacted to. */
181
+ function teamsSentScope(conversationId) {
182
+ return { agentRoot: (0, identity_1.getAgentRoot)(), channel: "teams", conversationId };
183
+ }
184
+ /** Note a Teams message the agent sent, from the receipt Teams returned for it. */
185
+ function noteTeamsSentMessage(conversationId, receipt, text) {
186
+ const id = receipt && typeof receipt === "object" && "id" in receipt && typeof receipt.id === "string" ? receipt.id : undefined;
187
+ if (id)
188
+ (0, sent_message_ledger_1.recordSentMessage)(() => teamsSentScope(conversationId), id, text);
176
189
  }
177
190
  // Build synthetic message text from a Teams feedback reaction (the thumbs on an AI-labeled reply).
178
191
  function buildFeedbackSyntheticText(reaction, comment) {
@@ -180,9 +193,17 @@ function buildFeedbackSyntheticText(reaction, comment) {
180
193
  return `[${teamsReaction(reaction === "like" ? "like" : "dislike", false)}${said}]`;
181
194
  }
182
195
  // Teams only tells a bot about reactions on the bot's own messages, so the target is always the agent's.
183
- function buildReactionSyntheticText(added, removed) {
196
+ function buildReactionSyntheticText(added, removed, target) {
184
197
  const change = added?.[0] ? { type: added[0].type, removed: false } : removed?.[0] ? { type: removed[0].type, removed: true } : null;
185
- return change ? `[${teamsReaction(change.type, change.removed)}]` : null;
198
+ return change ? `[${teamsReaction(change.type, change.removed, target)}]` : null;
199
+ }
200
+ /** A Teams reaction names the message by id (`replyToId`); the shared resolver finds what the agent said in it. */
201
+ async function resolveTeamsReactionText(activity) {
202
+ const conversationId = activity.conversation?.id;
203
+ if (!activity.replyToId || !conversationId)
204
+ return buildReactionSyntheticText(activity.reactionsAdded, activity.reactionsRemoved);
205
+ const target = await (0, chat_interaction_1.resolveChatMessageRef)({ fromAgent: true }, (0, sent_message_ledger_1.sentMessageLookup)(teamsSentScope(conversationId)), activity.replyToId);
206
+ return buildReactionSyntheticText(activity.reactionsAdded, activity.reactionsRemoved, target);
186
207
  }
187
208
  function buildEditSyntheticText(newText) {
188
209
  return `[${(0, chat_interaction_1.renderChatInteraction)({ kind: "edit", newText, target: { fromAgent: false } })}]`;
@@ -1413,7 +1434,7 @@ function registerBotHandlers(app, label) {
1413
1434
  }
1414
1435
  };
1415
1436
  const ctxSend = (t) => {
1416
- const sending = noted(t, () => ctx.send({ type: "message", text: t, replyToId: activity.replyToId, entities: aiLabelEntities(), channelData: { feedbackLoopEnabled: true } }));
1437
+ const sending = noted(t, async () => noteTeamsSentMessage(convId, await ctx.send({ type: "message", text: t, replyToId: activity.replyToId, entities: aiLabelEntities(), channelData: { feedbackLoopEnabled: true } }), t));
1417
1438
  inbound.track(sending);
1418
1439
  return sending;
1419
1440
  };
@@ -1451,7 +1472,7 @@ function registerBotHandlers(app, label) {
1451
1472
  return undefined;
1452
1473
  });
1453
1474
  app.on("messageReaction", async (ctx) => {
1454
- const text = buildReactionSyntheticText(ctx.activity.reactionsAdded, ctx.activity.reactionsRemoved);
1475
+ const text = await resolveTeamsReactionText(ctx.activity);
1455
1476
  if (text)
1456
1477
  await runInteractionTurn(ctx, text, true);
1457
1478
  return undefined;
@@ -1502,6 +1523,7 @@ function registerBotHandlers(app, label) {
1502
1523
  try {
1503
1524
  const receipt = await send({ type: "message", text, replyToId: inboundActivityId, entities: aiLabelEntities(), channelData: { feedbackLoopEnabled: true } });
1504
1525
  inbound().noteSent(true);
1526
+ noteTeamsSentMessage(convId, receipt, text);
1505
1527
  const messageId = receipt && typeof receipt === "object" && "id" in receipt && typeof receipt.id === "string" ? receipt.id : undefined;
1506
1528
  reportTeamsRequest(messageId ? "replied" : "reply_emitted", convId, requestContext, { delivery: messageId ? "accepted" : "unconfirmed", ...(messageId ? { outboundActivityId: messageId } : {}) });
1507
1529
  }
@@ -1963,6 +1985,7 @@ async function sendProactiveTeamsMessageToSession(params, deps) {
1963
1985
  meta: { friendId: params.friendId, aadObjectId: aadInfo.aadObjectId, sessionKey: params.sessionKey },
1964
1986
  });
1965
1987
  const messageId = activity && typeof activity === "object" && "id" in activity && typeof activity.id === "string" ? activity.id : undefined;
1988
+ noteTeamsSentMessage(conversation.id, activity, params.text);
1966
1989
  // Saved into the conversation it was sent into, so the friend's reply there carries it.
1967
1990
  const origin = params.origin ?? "proactive";
1968
1991
  // Recording never changes the result of a send that already went out.
@@ -1894,15 +1894,15 @@ function createTelegramSenseApp(options) {
1894
1894
  }
1895
1895
  };
1896
1896
  // Telegram tells the bot which message was reacted to, not what it said. The journal knows the agent's own messages.
1897
- const nameReactionTarget = (message) => {
1897
+ const nameReactionTarget = async (message) => {
1898
1898
  const interaction = message.interaction;
1899
- if (interaction?.kind !== "reaction" || !interaction.target.id)
1899
+ if (interaction?.kind !== "reaction")
1900
1900
  return message;
1901
- const sent = (0, telegram_effect_adapter_1.resolveTelegramReply)(getEffectJournal(), { messageId: Number(interaction.target.id), friendId: configuredOwnerFriendId, sessionKey: configuredOwnerSessionKey });
1902
- if (!sent?.text)
1903
- return message;
1904
- const named = { ...interaction, target: { ...interaction.target, text: sent.text, fromAgent: true } };
1905
- return { ...message, interaction: named, text: (0, chat_interaction_1.renderChatInteraction)(named) };
1901
+ const named = await (0, chat_interaction_1.resolveChatInteractionTarget)(interaction, (id) => {
1902
+ const sent = (0, telegram_effect_adapter_1.resolveTelegramReply)(getEffectJournal(), { messageId: Number(id), friendId: configuredOwnerFriendId, sessionKey: configuredOwnerSessionKey });
1903
+ return sent?.text ? { text: sent.text, fromAgent: true } : null;
1904
+ });
1905
+ return named === interaction ? message : { ...message, interaction: named, text: (0, chat_interaction_1.renderChatInteraction)(named) };
1906
1906
  };
1907
1907
  /** Write a message's entry before its turn, or null when it must not run: it has an outcome, or a stopped turn left it unsafe to run again. */
1908
1908
  const beginInbound = (id) => {
@@ -2023,7 +2023,7 @@ function createTelegramSenseApp(options) {
2023
2023
  }
2024
2024
  };
2025
2025
  const onMessage = (inbound) => runWithAcceptanceAuditOwner(async () => {
2026
- const message = nameReactionTarget(inbound);
2026
+ const message = await nameReactionTarget(inbound);
2027
2027
  const turn = beginInbound(inboundIdFor(message.updateId));
2028
2028
  if (!turn)
2029
2029
  return;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1460",
3
+ "version": "0.1.0-alpha.1461",
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.1460",
9
+ "version": "0.1.0-alpha.1461",
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.1460",
3
+ "version": "0.1.0-alpha.1461",
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": {