@ouro.bot/cli 0.1.0-alpha.1120 → 0.1.0-alpha.1121
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 +6 -0
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.ouro/tool-profiles.json +12 -6
- package/deploy/unraid/sanctuary.xml +1 -1
- package/dist/heart/daemon/sanctuary-acceptance-harness.js +1 -1
- package/dist/heart/daemon/sanctuary-telegram-authority-service.js +21 -2
- package/dist/mind/prompt.js +1 -1
- package/dist/repertoire/tools-chat.js +127 -0
- package/dist/repertoire/tools.js +7 -4
- package/dist/senses/bluebubbles/client.js +17 -0
- package/dist/senses/bluebubbles/index.js +9 -6
- package/dist/senses/bluebubbles/reactions.js +18 -0
- package/dist/senses/telegram-chat-actions.js +34 -0
- package/dist/senses/telegram-client.js +3 -1
- package/dist/senses/telegram-effect-adapter.js +3 -1
- package/dist/senses/telegram.js +10 -9
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/repertoire/tools-bluebubbles.js +0 -95
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.1121",
|
|
6
|
+
"changes": [
|
|
7
|
+
"The agent can react to a message and choose which message its reply answers, with the same react and set_reply_target tools on iMessage and Telegram."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
4
10
|
{
|
|
5
11
|
"version": "0.1.0-alpha.1120",
|
|
6
12
|
"changes": [
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"version": 2,
|
|
3
3
|
"profiles": {
|
|
4
4
|
"sanctuary-owner": {
|
|
5
|
-
"version":
|
|
5
|
+
"version": 21,
|
|
6
6
|
"contextScopes": [
|
|
7
7
|
"household.status",
|
|
8
8
|
"household.policy",
|
|
@@ -85,7 +85,9 @@
|
|
|
85
85
|
"media_manual_import",
|
|
86
86
|
"media_quality_profile",
|
|
87
87
|
"media_release_profile",
|
|
88
|
-
"media_fill_missing"
|
|
88
|
+
"media_fill_missing",
|
|
89
|
+
"react",
|
|
90
|
+
"set_reply_target"
|
|
89
91
|
],
|
|
90
92
|
"effectScopes": [
|
|
91
93
|
"telegram.proactive",
|
|
@@ -94,7 +96,7 @@
|
|
|
94
96
|
]
|
|
95
97
|
},
|
|
96
98
|
"sanctuary-household": {
|
|
97
|
-
"version":
|
|
99
|
+
"version": 6,
|
|
98
100
|
"contextScopes": [
|
|
99
101
|
"household.status",
|
|
100
102
|
"own_requests"
|
|
@@ -115,7 +117,9 @@
|
|
|
115
117
|
"unraid_check_services",
|
|
116
118
|
"unraid_restart_container",
|
|
117
119
|
"settle",
|
|
118
|
-
"speak"
|
|
120
|
+
"speak",
|
|
121
|
+
"react",
|
|
122
|
+
"set_reply_target"
|
|
119
123
|
],
|
|
120
124
|
"effectScopes": [
|
|
121
125
|
"telegram.request_return"
|
|
@@ -153,7 +157,7 @@
|
|
|
153
157
|
]
|
|
154
158
|
},
|
|
155
159
|
"sanctuary-agent-peer": {
|
|
156
|
-
"version":
|
|
160
|
+
"version": 11,
|
|
157
161
|
"toolNames": [
|
|
158
162
|
"external_event_disposition",
|
|
159
163
|
"query_active_work",
|
|
@@ -224,7 +228,9 @@
|
|
|
224
228
|
"media_manual_import",
|
|
225
229
|
"media_quality_profile",
|
|
226
230
|
"media_release_profile",
|
|
227
|
-
"media_fill_missing"
|
|
231
|
+
"media_fill_missing",
|
|
232
|
+
"react",
|
|
233
|
+
"set_reply_target"
|
|
228
234
|
],
|
|
229
235
|
"contextScopes": [
|
|
230
236
|
"household.status",
|
|
@@ -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.
|
|
4
|
+
<Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1121</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
|
@@ -60,7 +60,7 @@ function exactSanctuaryContainmentProfileBoundaries(value) {
|
|
|
60
60
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
61
61
|
return false;
|
|
62
62
|
const boundaries = value;
|
|
63
|
-
const versions = { "sanctuary-owner":
|
|
63
|
+
const versions = { "sanctuary-owner": 21, "sanctuary-household": 6, "sanctuary-event": 4 };
|
|
64
64
|
if (!(0, node_util_1.isDeepStrictEqual)(Object.keys(boundaries).sort(), Object.keys(versions).sort()))
|
|
65
65
|
return false;
|
|
66
66
|
const packageRoot = path.resolve(__dirname, "../../../deploy/unraid/sanctuary.ouro");
|
|
@@ -209,12 +209,15 @@ class SanctuaryTelegramAuthorityService {
|
|
|
209
209
|
throw new Error("Sanctuary Telegram getMe body is invalid");
|
|
210
210
|
}
|
|
211
211
|
else if (requestMethod === "sendMessage") {
|
|
212
|
-
if (!exactBody(body, ["chat_id", "text"], ["parse_mode", "reply_markup"])) {
|
|
212
|
+
if (!exactBody(body, ["chat_id", "text"], ["parse_mode", "reply_markup", "reply_parameters"])) {
|
|
213
213
|
throw new Error("Sanctuary Telegram send body is invalid");
|
|
214
214
|
}
|
|
215
215
|
if (!boundedText(body.text, 4_096)
|
|
216
216
|
|| (body.parse_mode !== undefined && body.parse_mode !== "HTML")
|
|
217
|
-
|| (body.reply_markup !== undefined && !isObject(body.reply_markup))
|
|
217
|
+
|| (body.reply_markup !== undefined && !isObject(body.reply_markup))
|
|
218
|
+
// A reply names only the message it answers, so it cannot carry content of its own.
|
|
219
|
+
|| (body.reply_parameters !== undefined && !(isObject(body.reply_parameters) && exactKeys(body.reply_parameters, ["message_id"])
|
|
220
|
+
&& Number.isSafeInteger(body.reply_parameters.message_id) && body.reply_parameters.message_id > 0))) {
|
|
218
221
|
throw new Error("Sanctuary Telegram send body is invalid");
|
|
219
222
|
}
|
|
220
223
|
const chatId = String(body.chat_id);
|
|
@@ -285,6 +288,22 @@ class SanctuaryTelegramAuthorityService {
|
|
|
285
288
|
throw new Error("Sanctuary Telegram chat action target is invalid");
|
|
286
289
|
}
|
|
287
290
|
}
|
|
291
|
+
else if (requestMethod === "setMessageReaction") {
|
|
292
|
+
// A reaction is one emoji on a message in a chat the agent may already message; nothing else rides along.
|
|
293
|
+
if (!exactBody(body, ["chat_id", "message_id", "reaction"]))
|
|
294
|
+
throw new Error("Sanctuary Telegram reaction is invalid");
|
|
295
|
+
const reaction = body.reaction;
|
|
296
|
+
if (!Number.isSafeInteger(body.message_id) || body.message_id <= 0
|
|
297
|
+
|| !Array.isArray(reaction) || reaction.length !== 1
|
|
298
|
+
|| !isObject(reaction[0]) || !exactKeys(reaction[0], ["type", "emoji"])
|
|
299
|
+
|| reaction[0].type !== "emoji" || !boundedText(reaction[0].emoji, 16)) {
|
|
300
|
+
throw new Error("Sanctuary Telegram reaction is invalid");
|
|
301
|
+
}
|
|
302
|
+
const reactionChatId = String(body.chat_id);
|
|
303
|
+
if (reactionChatId !== ownerChatId && !this.#gateway.isAuthorizedChat(reactionChatId)) {
|
|
304
|
+
throw new Error("Sanctuary Telegram reaction target is invalid");
|
|
305
|
+
}
|
|
306
|
+
}
|
|
288
307
|
else if (requestMethod === "getFile") {
|
|
289
308
|
if (!exactBody(body, ["file_id"]) || !boundedText(body.file_id, 512)) {
|
|
290
309
|
throw new Error("Sanctuary Telegram file body is invalid");
|
package/dist/mind/prompt.js
CHANGED
|
@@ -558,7 +558,7 @@ function runtimeInfoSection(channel, options) {
|
|
|
558
558
|
else if (channel === "bluebubbles") {
|
|
559
559
|
lines.push("i am responding in iMessage through BlueBubbles. i keep replies short and phone-native. i do not use markdown. i do not introduce myself on boot.");
|
|
560
560
|
lines.push("during an active browser/tool/task flow, process comments from my friend are feedback to absorb, not a reason to settle. i speak once if useful, then keep working until complete, blocked, asked to stop/pause, or confirmation is required. timeout/recovery state is internal, not iMessage copy.");
|
|
561
|
-
lines.push("when a bluebubbles turn arrives from a thread, the harness tells me the current lane and any recent active thread ids. if widening back to top-level or routing into a different active thread is the better move, i use
|
|
561
|
+
lines.push("when a bluebubbles turn arrives from a thread, the harness tells me the current lane and any recent active thread ids. if widening back to top-level or routing into a different active thread is the better move, i use set_reply_target before settle.");
|
|
562
562
|
}
|
|
563
563
|
else if (channel === "mail") {
|
|
564
564
|
lines.push("i am responding from an agent mail session. i keep the response clear, auditable, and grounded in visible mail facts.");
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.chatToolDefinitions = exports.CHAT_ACTION_CHANNELS = exports.CHAT_ACTION_TOOL_NAMES = void 0;
|
|
4
|
+
exports.chatActionsForTurn = chatActionsForTurn;
|
|
5
|
+
exports.offTurnRefusal = offTurnRefusal;
|
|
6
|
+
const runtime_1 = require("../nerves/runtime");
|
|
7
|
+
// Every chat app lets you react to a message and reply to a specific one. These tools are the same on every
|
|
8
|
+
// sense; each sense binds `ctx.chatActions` to its own app, and a missing action means the app can't do it.
|
|
9
|
+
/** Tools that act in the chat the turn came from; offered only on chat senses and only when the turn may send. */
|
|
10
|
+
exports.CHAT_ACTION_TOOL_NAMES = new Set(["react", "set_reply_target"]);
|
|
11
|
+
/** Senses whose turns bind `chatActions`. */
|
|
12
|
+
exports.CHAT_ACTION_CHANNELS = new Set(["bluebubbles", "telegram"]);
|
|
13
|
+
/**
|
|
14
|
+
* Binds a sense's chat actions to the turn: a left-out message id means the message that started it. The id stays
|
|
15
|
+
* inside these closures, so it never sits in the tool context as data.
|
|
16
|
+
*/
|
|
17
|
+
function chatActionsForTurn(actions, inboundMessageId) {
|
|
18
|
+
const { react, setReplyTarget } = actions;
|
|
19
|
+
return {
|
|
20
|
+
...(react ? {
|
|
21
|
+
react: async (emoji, messageId) => {
|
|
22
|
+
const id = messageId ?? inboundMessageId;
|
|
23
|
+
return id ? react(emoji, id) : "there is no message to react to here; pass message_id.";
|
|
24
|
+
},
|
|
25
|
+
} : {}),
|
|
26
|
+
...(setReplyTarget ? {
|
|
27
|
+
setReplyTarget: (request) => {
|
|
28
|
+
if (request.target !== "thread")
|
|
29
|
+
return setReplyTarget(request);
|
|
30
|
+
const id = request.messageId ?? inboundMessageId;
|
|
31
|
+
return id ? setReplyTarget({ target: "thread", messageId: id }) : "there is no message to reply to here; pass message_id.";
|
|
32
|
+
},
|
|
33
|
+
} : {}),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/** Chat actions act in the chat the turn came from, so a turn that may not send can't take them, even when called directly. */
|
|
37
|
+
function offTurnRefusal(ctx) {
|
|
38
|
+
return ctx?.noSend || ctx?.habitSession || ctx?.autonomousTurnKind ? "I can't act in a chat on this turn." : undefined;
|
|
39
|
+
}
|
|
40
|
+
function argText(value) {
|
|
41
|
+
return typeof value === "string" ? value.trim() : "";
|
|
42
|
+
}
|
|
43
|
+
function ended(tool, success, result) {
|
|
44
|
+
if (success)
|
|
45
|
+
(0, runtime_1.emitNervesEvent)({ component: "tools", event: "tool.end", message: `${tool} done`, meta: { tool, success } });
|
|
46
|
+
else
|
|
47
|
+
(0, runtime_1.emitNervesEvent)({ level: "warn", component: "tools", event: "tool.error", message: `${tool} refused`, meta: { tool, success } });
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
exports.chatToolDefinitions = [
|
|
51
|
+
{
|
|
52
|
+
tool: {
|
|
53
|
+
type: "function",
|
|
54
|
+
function: {
|
|
55
|
+
name: "react",
|
|
56
|
+
description: "react to a message in this chat with an emoji. message_id defaults to the message that started this turn. a reaction can be the whole answer.",
|
|
57
|
+
parameters: {
|
|
58
|
+
type: "object",
|
|
59
|
+
properties: {
|
|
60
|
+
emoji: { type: "string", description: "one emoji, for example ❤️ or 👍." },
|
|
61
|
+
message_id: { type: "string", description: "the message to react to; leave out to react to the message that started this turn." },
|
|
62
|
+
},
|
|
63
|
+
required: ["emoji"],
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
handler: async (args, ctx) => {
|
|
68
|
+
const refusal = offTurnRefusal(ctx);
|
|
69
|
+
if (refusal)
|
|
70
|
+
return ended("react", false, refusal);
|
|
71
|
+
const emoji = argText(args.emoji);
|
|
72
|
+
if (!emoji)
|
|
73
|
+
return ended("react", false, "emoji is required.");
|
|
74
|
+
const actions = ctx?.chatActions;
|
|
75
|
+
if (!actions?.react)
|
|
76
|
+
return ended("react", false, "this chat doesn't take reactions from me.");
|
|
77
|
+
try {
|
|
78
|
+
return ended("react", true, await actions.react(emoji, argText(args.message_id) || undefined));
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
return ended("react", false, `the reaction didn't go through: ${error instanceof Error ? error.message : String(error)}`);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
summaryKeys: ["emoji", "message_id"],
|
|
85
|
+
riskProfile: { mutates: "external_side_effect", risk: "high", reason: "adds a reaction in the current chat" },
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
tool: {
|
|
89
|
+
type: "function",
|
|
90
|
+
function: {
|
|
91
|
+
name: "set_reply_target",
|
|
92
|
+
description: "choose where my reply in this chat lands: current_lane (the default for this chat), top_level (the main chat, not a reply), or thread (a reply to message_id, or to the message that started this turn).",
|
|
93
|
+
parameters: {
|
|
94
|
+
type: "object",
|
|
95
|
+
properties: {
|
|
96
|
+
target: { type: "string", enum: ["current_lane", "top_level", "thread"] },
|
|
97
|
+
message_id: { type: "string", description: "with target=thread: the message to reply to, from the ids shown in this chat's context; leave out to reply to the message that started this turn." },
|
|
98
|
+
},
|
|
99
|
+
required: ["target"],
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
handler: (args, ctx) => {
|
|
104
|
+
const refusal = offTurnRefusal(ctx);
|
|
105
|
+
if (refusal)
|
|
106
|
+
return ended("set_reply_target", false, refusal);
|
|
107
|
+
const target = argText(args.target);
|
|
108
|
+
const actions = ctx?.chatActions;
|
|
109
|
+
if (!actions?.setReplyTarget)
|
|
110
|
+
return ended("set_reply_target", false, "this chat doesn't let me choose where a reply lands.");
|
|
111
|
+
let request;
|
|
112
|
+
if (target === "current_lane" || target === "top_level") {
|
|
113
|
+
request = { target };
|
|
114
|
+
}
|
|
115
|
+
else if (target === "thread") {
|
|
116
|
+
const messageId = argText(args.message_id);
|
|
117
|
+
request = messageId ? { target, messageId } : { target };
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
return ended("set_reply_target", false, "target must be one of: current_lane, top_level, thread.");
|
|
121
|
+
}
|
|
122
|
+
return ended("set_reply_target", true, actions.setReplyTarget(request));
|
|
123
|
+
},
|
|
124
|
+
summaryKeys: ["target", "message_id"],
|
|
125
|
+
riskProfile: { mutates: "external_side_effect", risk: "high", reason: "changes where the reply in the current chat lands" },
|
|
126
|
+
},
|
|
127
|
+
];
|
package/dist/repertoire/tools.js
CHANGED
|
@@ -20,7 +20,7 @@ exports.buildToolResultSummary = buildToolResultSummary;
|
|
|
20
20
|
const node_util_1 = require("node:util");
|
|
21
21
|
const tools_base_1 = require("./tools-base");
|
|
22
22
|
const tools_teams_1 = require("./tools-teams");
|
|
23
|
-
const
|
|
23
|
+
const tools_chat_1 = require("./tools-chat");
|
|
24
24
|
const ado_semantic_1 = require("./ado-semantic");
|
|
25
25
|
const tools_github_1 = require("./tools-github");
|
|
26
26
|
const tools_bundle_1 = require("./tools-bundle");
|
|
@@ -102,7 +102,7 @@ Object.defineProperty(exports, "speakTool", { enumerable: true, get: function ()
|
|
|
102
102
|
var tools_surface_2 = require("./tools-surface");
|
|
103
103
|
Object.defineProperty(exports, "surfaceToolDef", { enumerable: true, get: function () { return tools_surface_2.surfaceToolDef; } });
|
|
104
104
|
// All tool definitions in a single registry
|
|
105
|
-
const additionalDefinitions = [...
|
|
105
|
+
const additionalDefinitions = [...tools_chat_1.chatToolDefinitions, ...tools_teams_1.teamsToolDefinitions, ...ado_semantic_1.adoSemanticToolDefinitions, ...tools_github_1.githubToolDefinitions, ...tools_bundle_1.bundleToolDefinitions, ...tools_voice_1.voiceToolDefinitions, ...tools_unraid_1.unraidToolDefinitions, tools_steward_policy_1.stewardPolicyToolDefinition, ...tools_house_care_1.houseCareToolDefinitions, tools_surface_1.surfaceToolDefinition, ...tools_shepherd_1.shepherdToolDefinitions, ...tools_app_sessions_1.appSessionsToolDefinitions];
|
|
106
106
|
const COMMERCE_AUTHORITY_TOOLS = new Set(["stripe_create_card", "flight_hold", "flight_book"]);
|
|
107
107
|
class ToolSelectionError extends Error {
|
|
108
108
|
}
|
|
@@ -162,7 +162,7 @@ function selectToolsForChannel(capabilities, toolPreferences, _context, provider
|
|
|
162
162
|
? [
|
|
163
163
|
...tools_base_1.baseToolDefinitions.filter((definition) => SANCTUARY_RELATIONSHIP_BASE_TOOLS.has(definition.tool.function.name)
|
|
164
164
|
|| (ownerLike && exports.SANCTUARY_OWNER_ADDITIONS.has(definition.tool.function.name))),
|
|
165
|
-
...tools_unraid_1.unraidToolDefinitions, tools_steward_policy_1.stewardPolicyToolDefinition, ...(ownerLike ? tools_house_care_1.houseCareToolDefinitions : []),
|
|
165
|
+
...tools_chat_1.chatToolDefinitions, ...tools_unraid_1.unraidToolDefinitions, tools_steward_policy_1.stewardPolicyToolDefinition, ...(ownerLike ? tools_house_care_1.houseCareToolDefinitions : []),
|
|
166
166
|
...(owner ? tools_bundle_1.bundleToolDefinitions.filter((definition) => SANCTUARY_OWNER_SYNC_TOOLS.has(definition.tool.function.name)) : []),
|
|
167
167
|
...(ownerLike ? mcp : []),
|
|
168
168
|
]
|
|
@@ -183,7 +183,7 @@ function selectToolsForChannel(capabilities, toolPreferences, _context, provider
|
|
|
183
183
|
...((0, tools_shepherd_1.shepherdToolsEnabled)(context?.agentRoot ?? safeGetAgentRoot()) ? tools_shepherd_1.shepherdToolDefinitions : []),
|
|
184
184
|
// The app-sessions tools exist only for an agent that turned the sense on in agent.json.
|
|
185
185
|
...((0, tools_app_sessions_1.appSessionsToolsEnabled)(context?.agentRoot ?? safeGetAgentRoot()) ? tools_app_sessions_1.appSessionsToolDefinitions : []),
|
|
186
|
-
...
|
|
186
|
+
...tools_chat_1.chatToolDefinitions,
|
|
187
187
|
...(capabilities?.channel === "voice" ? tools_voice_1.voiceToolDefinitions : []),
|
|
188
188
|
...((0, tools_voice_local_1.localAudioToolGate)({ ...context, context: _context }).ok ? [tools_voice_local_1.voiceLocalAudioToolDefinition] : []),
|
|
189
189
|
...integrations, ...mcp,
|
|
@@ -207,6 +207,9 @@ function selectToolsForChannel(capabilities, toolPreferences, _context, provider
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
ordinary = ordinary.filter((definition) => (definition.tool.function.name !== "teams_send_image" || (!context?.noSend && !context?.habitSession && !context?.autonomousTurnKind))
|
|
210
|
+
// Reacting and choosing a reply target act in the chat the turn came from, so they need a chat sense and a turn that may send.
|
|
211
|
+
&& (!tools_chat_1.CHAT_ACTION_TOOL_NAMES.has(definition.tool.function.name)
|
|
212
|
+
|| (tools_chat_1.CHAT_ACTION_CHANNELS.has(capabilities?.channel ?? "") && !context?.noSend && !context?.habitSession && !context?.autonomousTurnKind))
|
|
210
213
|
&&
|
|
211
214
|
(!relationship || relationship.advertisedToolNames.includes(definition.tool.function.name))
|
|
212
215
|
&& (!definition.requiredCapability || providerCapabilities?.has(definition.requiredCapability) === true));
|
|
@@ -395,6 +395,23 @@ function createBlueBubblesClient(config = (0, config_1.getBlueBubblesConfig)(),
|
|
|
395
395
|
});
|
|
396
396
|
return { messageGuid, chatGuid: resolvedChatGuid };
|
|
397
397
|
},
|
|
398
|
+
async react(params) {
|
|
399
|
+
await assertHostAccount();
|
|
400
|
+
const chatGuid = await resolveChatGuid(params.chat, config, channelConfig);
|
|
401
|
+
if (!chatGuid)
|
|
402
|
+
throw new Error("BlueBubbles could not find this chat.");
|
|
403
|
+
const url = buildBlueBubblesApiUrl(config.serverUrl, "/api/v1/message/react", config.password);
|
|
404
|
+
const response = await fetch(url, {
|
|
405
|
+
method: "POST",
|
|
406
|
+
headers: { "Content-Type": "application/json" },
|
|
407
|
+
body: JSON.stringify({ chatGuid, selectedMessageGuid: params.messageGuid, reaction: params.reaction, partIndex: 0 }),
|
|
408
|
+
signal: AbortSignal.timeout(channelConfig.requestTimeoutMs),
|
|
409
|
+
});
|
|
410
|
+
if (!response.ok) {
|
|
411
|
+
const errorText = await response.text().catch(() => "");
|
|
412
|
+
throw new Error(`BlueBubbles reaction failed (${response.status}): ${errorText || "unknown"}`);
|
|
413
|
+
}
|
|
414
|
+
},
|
|
398
415
|
async editMessage(params) {
|
|
399
416
|
await assertHostAccount();
|
|
400
417
|
const messageGuid = params.messageGuid.trim();
|
|
@@ -80,6 +80,8 @@ const proactive_content_guard_1 = require("../proactive-content-guard");
|
|
|
80
80
|
const bluebubbles_meta_guard_1 = require("../bluebubbles-meta-guard");
|
|
81
81
|
const model_1 = require("./model");
|
|
82
82
|
const client_1 = require("./client");
|
|
83
|
+
const reactions_1 = require("./reactions");
|
|
84
|
+
const tools_chat_1 = require("../../repertoire/tools-chat");
|
|
83
85
|
const host_account_verifier_1 = require("./host-account-verifier");
|
|
84
86
|
const webhook_registration_1 = require("./webhook-registration");
|
|
85
87
|
const inbound_log_1 = require("./inbound-log");
|
|
@@ -587,7 +589,7 @@ function buildBlueBubblesOrientationSource(event, existingMessages, evidence, co
|
|
|
587
589
|
...(repairNotice ? { repairNotice } : {}),
|
|
588
590
|
...(summaries.length > 0 ? { recentLanes: summaries } : {}),
|
|
589
591
|
...(hasThreadRoute
|
|
590
|
-
? { routingHint: "use
|
|
592
|
+
? { routingHint: "use set_reply_target to choose current_lane, top_level, or a listed thread before sending BlueBubbles-specific replies." }
|
|
591
593
|
: {}),
|
|
592
594
|
};
|
|
593
595
|
}
|
|
@@ -773,7 +775,7 @@ function createReplyTargetController(event) {
|
|
|
773
775
|
if (selection.target === "top_level")
|
|
774
776
|
return undefined;
|
|
775
777
|
if (selection.target === "thread")
|
|
776
|
-
return selection.
|
|
778
|
+
return selection.messageId.trim();
|
|
777
779
|
return event.threadOriginatorGuid?.trim() ? event.messageGuid : undefined;
|
|
778
780
|
},
|
|
779
781
|
setSelection(next) {
|
|
@@ -782,7 +784,7 @@ function createReplyTargetController(event) {
|
|
|
782
784
|
return "bluebubbles reply target override: top_level";
|
|
783
785
|
}
|
|
784
786
|
if (next.target === "thread") {
|
|
785
|
-
return `bluebubbles reply target override: thread:${next.
|
|
787
|
+
return `bluebubbles reply target override: thread:${next.messageId}`;
|
|
786
788
|
}
|
|
787
789
|
return `bluebubbles reply target: using default for this turn (${defaultTargetLabel})`;
|
|
788
790
|
},
|
|
@@ -1890,9 +1892,10 @@ async function handleBlueBubblesNormalizedEvent(event, resolvedDeps, source, opt
|
|
|
1890
1892
|
...safeToolContext,
|
|
1891
1893
|
...mcpOwner,
|
|
1892
1894
|
summarize,
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1895
|
+
chatActions: (0, tools_chat_1.chatActionsForTurn)({
|
|
1896
|
+
setReplyTarget: (selection) => replyTarget.setSelection(selection),
|
|
1897
|
+
react: (emoji, messageId) => (0, reactions_1.reactInBlueBubbles)(client, event.chat, emoji, messageId),
|
|
1898
|
+
}, event.messageGuid),
|
|
1896
1899
|
},
|
|
1897
1900
|
});
|
|
1898
1901
|
if (generatedMessages.length > 0) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reactInBlueBubbles = reactInBlueBubbles;
|
|
4
|
+
const runtime_1 = require("../../nerves/runtime");
|
|
5
|
+
// iMessage has six classic tapbacks. The agent asks with an emoji; this picks the tapback that emoji means.
|
|
6
|
+
const TAPBACKS = {
|
|
7
|
+
"❤️": "love", "❤": "love", "👍": "like", "👎": "dislike", "😂": "laugh", "‼️": "emphasize", "‼": "emphasize", "❓": "question",
|
|
8
|
+
};
|
|
9
|
+
async function reactInBlueBubbles(client, chat, emoji, messageGuid) {
|
|
10
|
+
const reaction = TAPBACKS[emoji] ?? (Object.values(TAPBACKS).includes(emoji) ? emoji : undefined);
|
|
11
|
+
if (!reaction)
|
|
12
|
+
return `iMessage reactions I can send are ❤️ 👍 👎 😂 ‼️ ❓; ${emoji} isn't one of them.`;
|
|
13
|
+
if (!client.react)
|
|
14
|
+
return "this iMessage connection can't send reactions.";
|
|
15
|
+
await client.react({ chat, messageGuid, reaction });
|
|
16
|
+
(0, runtime_1.emitNervesEvent)({ component: "senses", event: "senses.bluebubbles_reaction_sent", message: "sent an iMessage reaction", meta: { reaction } });
|
|
17
|
+
return `reacted with ${emoji}`;
|
|
18
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTelegramChatActions = createTelegramChatActions;
|
|
4
|
+
const runtime_1 = require("../nerves/runtime");
|
|
5
|
+
const tools_chat_1 = require("../repertoire/tools-chat");
|
|
6
|
+
function telegramMessageId(value) {
|
|
7
|
+
return /^[1-9][0-9]*$/u.test(value) && Number.isSafeInteger(Number(value)) ? Number(value) : undefined;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Telegram turns here are one-to-one chats, where a reply reads plainly without quoting, so the default posts plainly.
|
|
11
|
+
* The agent can still reply to a specific message.
|
|
12
|
+
*/
|
|
13
|
+
function createTelegramChatActions(api, chatId, inboundMessageId) {
|
|
14
|
+
let selection = { target: "current_lane" };
|
|
15
|
+
return {
|
|
16
|
+
actions: (0, tools_chat_1.chatActionsForTurn)({
|
|
17
|
+
react: async (emoji, messageId) => {
|
|
18
|
+
const id = telegramMessageId(messageId);
|
|
19
|
+
if (id === undefined)
|
|
20
|
+
return `${messageId} is not a Telegram message id.`;
|
|
21
|
+
await api.request("setMessageReaction", { chat_id: chatId, message_id: id, reaction: [{ type: "emoji", emoji }] });
|
|
22
|
+
(0, runtime_1.emitNervesEvent)({ component: "senses", event: "senses.telegram_reaction_sent", message: "sent a Telegram reaction", meta: {} });
|
|
23
|
+
return `reacted with ${emoji}`;
|
|
24
|
+
},
|
|
25
|
+
setReplyTarget: (next) => {
|
|
26
|
+
if (next.target === "thread" && telegramMessageId(next.messageId) === undefined)
|
|
27
|
+
return `${next.messageId} is not a Telegram message id.`;
|
|
28
|
+
selection = next;
|
|
29
|
+
return next.target === "thread" ? `my reply will answer message ${next.messageId}` : "my reply will post plainly in the chat";
|
|
30
|
+
},
|
|
31
|
+
}, inboundMessageId),
|
|
32
|
+
replyToMessageId: () => selection.target === "thread" ? telegramMessageId(selection.messageId) : undefined,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -1642,12 +1642,14 @@ async function sendTelegramText(api, chatId, text, options = {}) {
|
|
|
1642
1642
|
results.push(messageId);
|
|
1643
1643
|
options.onMessageDelivered?.(messageId, chunk);
|
|
1644
1644
|
};
|
|
1645
|
-
for (const chunk of splitTelegramText(text)) {
|
|
1645
|
+
for (const [index, chunk] of splitTelegramText(text).entries()) {
|
|
1646
|
+
const replyTo = index === 0 && options.replyToMessageId ? { reply_parameters: { message_id: options.replyToMessageId } } : {};
|
|
1646
1647
|
try {
|
|
1647
1648
|
recordMessageId(await api.request("sendMessage", {
|
|
1648
1649
|
chat_id: chatId,
|
|
1649
1650
|
text: renderHtml(chunk),
|
|
1650
1651
|
parse_mode: "HTML",
|
|
1652
|
+
...replyTo,
|
|
1651
1653
|
}, options.signal), chunk);
|
|
1652
1654
|
}
|
|
1653
1655
|
catch (error) {
|
|
@@ -163,6 +163,7 @@ function validateArtifact(artifact, expectedId) {
|
|
|
163
163
|
&& /^[1-9][0-9]*$/u.test(target.userId) && /^[1-9][0-9]*$/u.test(target.chatId);
|
|
164
164
|
const effectValid = effect?.kind === "text" || effect?.kind === "admission_ack"
|
|
165
165
|
? boundedText(effect.text, 150_000)
|
|
166
|
+
&& (effect.kind !== "text" || effect.replyToMessageId === undefined || (Number.isSafeInteger(effect.replyToMessageId) && effect.replyToMessageId > 0))
|
|
166
167
|
: effect?.kind === "card"
|
|
167
168
|
? boundedText(effect.text) && Array.isArray(effect.buttons) && effect.buttons.length > 0 && effect.buttons.length <= 20
|
|
168
169
|
&& effect.buttons.every((row) => Array.isArray(row) && row.length > 0 && row.length <= 8
|
|
@@ -416,7 +417,8 @@ async function executePart(api, artifact, part, chatId, signal) {
|
|
|
416
417
|
const effect = artifact.effect;
|
|
417
418
|
if (effect.kind === "text" || effect.kind === "admission_ack") {
|
|
418
419
|
const renderHtml = effect.kind === "text" && artifact.authorClass === "butler" ? renderTelegramButlerHtml : undefined;
|
|
419
|
-
const
|
|
420
|
+
const replyToMessageId = effect.kind === "text" && part.index === 0 ? effect.replyToMessageId : undefined;
|
|
421
|
+
const ids = await (0, telegram_client_1.sendTelegramText)(api, chatId, part.text, { ...(signal ? { signal } : {}), ...(renderHtml ? { renderHtml } : {}), ...(replyToMessageId ? { replyToMessageId } : {}) });
|
|
420
422
|
if (ids.length !== 1)
|
|
421
423
|
throw new Error("Telegram effect chunk renderer returned an unexpected message count");
|
|
422
424
|
return ids[0];
|
package/dist/senses/telegram.js
CHANGED
|
@@ -105,6 +105,7 @@ const pending_1 = require("../mind/pending");
|
|
|
105
105
|
const relationship_authorization_1 = require("../repertoire/relationship-authorization");
|
|
106
106
|
const telegram_admission_1 = require("./telegram-admission");
|
|
107
107
|
const telegram_effect_adapter_1 = require("./telegram-effect-adapter");
|
|
108
|
+
const telegram_chat_actions_1 = require("./telegram-chat-actions");
|
|
108
109
|
const atomic_file_1 = require("../heart/atomic-file");
|
|
109
110
|
const EMPTY_SHARED_TURN_DIAGNOSTIC = "(agent responded but response was empty)";
|
|
110
111
|
function hasUserVisibleTurnResponse(response) {
|
|
@@ -1019,13 +1020,13 @@ function createTelegramSenseApp(options) {
|
|
|
1019
1020
|
approvalReconciliationsInFlight.add(failsafe);
|
|
1020
1021
|
}, delay);
|
|
1021
1022
|
};
|
|
1022
|
-
const deliverButlerEffect = async (text, idempotencyKey, signal, onMessageDelivered, exactDownloadCreditQuestion = false) => {
|
|
1023
|
+
const deliverButlerEffect = async (text, idempotencyKey, signal, onMessageDelivered, exactDownloadCreditQuestion = false, replyToMessageId) => {
|
|
1023
1024
|
const presentedText = (0, sanctuary_download_credit_presentation_1.presentSanctuaryDownloadCreditReply)(options.agentName, exactDownloadCreditQuestion, text);
|
|
1024
1025
|
return executeAuthorizedEffect({
|
|
1025
1026
|
idempotencyKey,
|
|
1026
1027
|
target: configuredOwnerTarget(),
|
|
1027
1028
|
authorClass: "butler",
|
|
1028
|
-
effect: { kind: "text", text: presentedText },
|
|
1029
|
+
effect: { kind: "text", text: presentedText, ...(replyToMessageId ? { replyToMessageId } : {}) },
|
|
1029
1030
|
...(signal ? { signal } : {}),
|
|
1030
1031
|
...(onMessageDelivered ? { onMessageDelivered } : {}),
|
|
1031
1032
|
});
|
|
@@ -1255,6 +1256,7 @@ function createTelegramSenseApp(options) {
|
|
|
1255
1256
|
const dispatchResolvedRelationshipTurn = async (input) => {
|
|
1256
1257
|
const sessionPath = (0, shared_turn_1.getSenseSessionPath)(options.agentName, input.friendId, "telegram", input.sessionKey, agentRoot);
|
|
1257
1258
|
const effects = [];
|
|
1259
|
+
const chat = (0, telegram_chat_actions_1.createTelegramChatActions)(api, input.chatId, input.messageId);
|
|
1258
1260
|
let ordinal = 0;
|
|
1259
1261
|
const deliver = async (text, terminalReturn = false) => {
|
|
1260
1262
|
const obligation = terminalReturn ? (0, obligations_1.findPendingObligationForRequest)(agentRoot, {
|
|
@@ -1265,7 +1267,7 @@ function createTelegramSenseApp(options) {
|
|
|
1265
1267
|
idempotencyKey: `relationship-turn:${input.requestId}:delivery:${ordinal++}`,
|
|
1266
1268
|
target: { kind: "approved_relationship", friendId: input.friendId, sessionKey: input.sessionKey, requestId: input.requestId },
|
|
1267
1269
|
authorClass: "butler",
|
|
1268
|
-
effect: { kind: "text", text },
|
|
1270
|
+
effect: { kind: "text", text, ...(chat.replyToMessageId() ? { replyToMessageId: chat.replyToMessageId() } : {}) },
|
|
1269
1271
|
...(obligation?.returnReadyAt ? { obligationReturnId: obligation.id } : {}),
|
|
1270
1272
|
}));
|
|
1271
1273
|
};
|
|
@@ -1294,7 +1296,7 @@ function createTelegramSenseApp(options) {
|
|
|
1294
1296
|
ingressRelations: { replyToEventId: null, threadRootEventId: null, references: [input.reference] },
|
|
1295
1297
|
precommittedIngress: { eventId: input.eventId, reference: input.reference },
|
|
1296
1298
|
...(orientationFrame ? { orientationFrame } : {}),
|
|
1297
|
-
toolContext: { ...(toolContext ?? {}), attachmentIds: input.attachmentIds ?? [] },
|
|
1299
|
+
toolContext: { ...(toolContext ?? {}), chatActions: chat.actions, attachmentIds: input.attachmentIds ?? [] },
|
|
1298
1300
|
prepareRunAgentOptions: prepareRelationshipRunAgentOptions({ friendId: input.friendId, requestId: input.requestId,
|
|
1299
1301
|
sessionEventId: input.eventId, userId: input.userId, chatId: input.chatId, sessionKey: input.sessionKey, userMessage: input.text, fullVisibilityProgress: fullVisibility.progress }),
|
|
1300
1302
|
emptyResponseFallback: fullVisibility.emptyResponseFallback,
|
|
@@ -1494,6 +1496,7 @@ function createTelegramSenseApp(options) {
|
|
|
1494
1496
|
})
|
|
1495
1497
|
: null;
|
|
1496
1498
|
const fullVisibility = createFullVisibilityProgress();
|
|
1499
|
+
const chat = (0, telegram_chat_actions_1.createTelegramChatActions)(api, message.chatId, message.messageId);
|
|
1497
1500
|
const collected = await collectToolReceipts(() => runTurn({
|
|
1498
1501
|
agentName: options.agentName,
|
|
1499
1502
|
channel: "telegram",
|
|
@@ -1518,13 +1521,11 @@ function createTelegramSenseApp(options) {
|
|
|
1518
1521
|
bufferedGroundedDeliveries.push(delivery.kind);
|
|
1519
1522
|
}
|
|
1520
1523
|
else {
|
|
1521
|
-
turnEffects.push(await deliverButlerEffect(delivery.text, `turn:${subject}:${message.updateId}:delivery:${deliveryOrdinal++}`, undefined, (messageId, chunk) => { deliveredMessageIds.push(messageId); deliveredChunks.push(chunk); }, exactDownloadCreditQuestion));
|
|
1524
|
+
turnEffects.push(await deliverButlerEffect(delivery.text, `turn:${subject}:${message.updateId}:delivery:${deliveryOrdinal++}`, undefined, (messageId, chunk) => { deliveredMessageIds.push(messageId); deliveredChunks.push(chunk); }, exactDownloadCreditQuestion, chat.replyToMessageId()));
|
|
1522
1525
|
}
|
|
1523
1526
|
},
|
|
1524
1527
|
},
|
|
1525
|
-
...(toolContext
|
|
1526
|
-
toolContext: { ...(toolContext ?? {}), ...(options.resolveRelationshipAuthorization ? { attachmentIds: hydrated.attachmentIds } : {}) },
|
|
1527
|
-
} : {}),
|
|
1528
|
+
toolContext: { ...(toolContext ?? {}), chatActions: chat.actions, ...(options.resolveRelationshipAuthorization ? { attachmentIds: hydrated.attachmentIds } : {}) },
|
|
1528
1529
|
...(options.resolveRelationshipAuthorization ? {
|
|
1529
1530
|
prepareRunAgentOptions: prepareRelationshipRunAgentOptions({
|
|
1530
1531
|
friendId: currentFriendId,
|
|
@@ -1707,7 +1708,7 @@ function createTelegramSenseApp(options) {
|
|
|
1707
1708
|
const sessionPath = (0, shared_turn_1.getSenseSessionPath)(options.agentName, approved.friendId, "telegram", sessionKey, agentRoot);
|
|
1708
1709
|
const receipt = await (0, telegram_effect_adapter_1.recordTelegramEffectsInSession)({ store: getEffectJournal(), sessionPath, artifacts: [], inbound: { text: hydrated.text, reference, attachmentIds: hydrated.attachmentIds } });
|
|
1709
1710
|
await dispatchResolvedRelationshipTurn({ friendId: approved.friendId, sessionKey, requestId: reference, eventId: receipt.eventId,
|
|
1710
|
-
reference, text: hydrated.text, attachmentIds: hydrated.attachmentIds, userId: message.userId, chatId: message.chatId });
|
|
1711
|
+
reference, text: hydrated.text, attachmentIds: hydrated.attachmentIds, userId: message.userId, chatId: message.chatId, messageId: String(message.messageId) });
|
|
1711
1712
|
} : undefined;
|
|
1712
1713
|
const onUpdate = async (update) => {
|
|
1713
1714
|
const callback = update.callback_query;
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouro.bot/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.1121",
|
|
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.
|
|
9
|
+
"version": "0.1.0-alpha.1121",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sdk": "^0.78.0",
|
|
12
12
|
"@ouro.bot/friends": "0.1.0-alpha.18",
|
package/package.json
CHANGED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.bluebubblesToolDefinitions = void 0;
|
|
4
|
-
const runtime_1 = require("../nerves/runtime");
|
|
5
|
-
exports.bluebubblesToolDefinitions = [
|
|
6
|
-
{
|
|
7
|
-
tool: {
|
|
8
|
-
type: "function",
|
|
9
|
-
function: {
|
|
10
|
-
name: "bluebubbles_set_reply_target",
|
|
11
|
-
description: "choose where the current iMessage turn should land. use this when you want to widen back to top-level or route your update into a specific active thread in the same chat.",
|
|
12
|
-
parameters: {
|
|
13
|
-
type: "object",
|
|
14
|
-
properties: {
|
|
15
|
-
target: {
|
|
16
|
-
type: "string",
|
|
17
|
-
enum: ["current_lane", "top_level", "thread"],
|
|
18
|
-
description: "current_lane mirrors the current inbound lane, top_level answers in the main chat, and thread targets a specific active thread.",
|
|
19
|
-
},
|
|
20
|
-
threadOriginatorGuid: {
|
|
21
|
-
type: "string",
|
|
22
|
-
description: "required when target=thread; use one of the thread ids surfaced in the inbound iMessage context.",
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
required: ["target"],
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
handler: (args, ctx) => {
|
|
30
|
-
const target = typeof args.target === "string" ? args.target.trim() : "";
|
|
31
|
-
const controller = ctx?.bluebubblesReplyTarget;
|
|
32
|
-
if (!controller) {
|
|
33
|
-
(0, runtime_1.emitNervesEvent)({
|
|
34
|
-
level: "warn",
|
|
35
|
-
component: "tools",
|
|
36
|
-
event: "tool.error",
|
|
37
|
-
message: "bluebubbles reply target missing controller",
|
|
38
|
-
meta: { target },
|
|
39
|
-
});
|
|
40
|
-
return "bluebubbles reply targeting is not available in this context.";
|
|
41
|
-
}
|
|
42
|
-
if (target === "current_lane") {
|
|
43
|
-
const result = controller.setSelection({ target: "current_lane" });
|
|
44
|
-
(0, runtime_1.emitNervesEvent)({
|
|
45
|
-
component: "tools",
|
|
46
|
-
event: "tool.end",
|
|
47
|
-
message: "bluebubbles reply target updated",
|
|
48
|
-
meta: { target: "current_lane", success: true },
|
|
49
|
-
});
|
|
50
|
-
return result;
|
|
51
|
-
}
|
|
52
|
-
if (target === "top_level") {
|
|
53
|
-
const result = controller.setSelection({ target: "top_level" });
|
|
54
|
-
(0, runtime_1.emitNervesEvent)({
|
|
55
|
-
component: "tools",
|
|
56
|
-
event: "tool.end",
|
|
57
|
-
message: "bluebubbles reply target updated",
|
|
58
|
-
meta: { target: "top_level", success: true },
|
|
59
|
-
});
|
|
60
|
-
return result;
|
|
61
|
-
}
|
|
62
|
-
if (target === "thread") {
|
|
63
|
-
const threadOriginatorGuid = typeof args.threadOriginatorGuid === "string" ? args.threadOriginatorGuid.trim() : "";
|
|
64
|
-
if (!threadOriginatorGuid) {
|
|
65
|
-
(0, runtime_1.emitNervesEvent)({
|
|
66
|
-
level: "warn",
|
|
67
|
-
component: "tools",
|
|
68
|
-
event: "tool.error",
|
|
69
|
-
message: "bluebubbles reply target missing thread id",
|
|
70
|
-
meta: { target: "thread" },
|
|
71
|
-
});
|
|
72
|
-
return "threadOriginatorGuid is required when target=thread.";
|
|
73
|
-
}
|
|
74
|
-
const result = controller.setSelection({ target: "thread", threadOriginatorGuid });
|
|
75
|
-
(0, runtime_1.emitNervesEvent)({
|
|
76
|
-
component: "tools",
|
|
77
|
-
event: "tool.end",
|
|
78
|
-
message: "bluebubbles reply target updated",
|
|
79
|
-
meta: { target: "thread", success: true },
|
|
80
|
-
});
|
|
81
|
-
return result;
|
|
82
|
-
}
|
|
83
|
-
(0, runtime_1.emitNervesEvent)({
|
|
84
|
-
level: "warn",
|
|
85
|
-
component: "tools",
|
|
86
|
-
event: "tool.error",
|
|
87
|
-
message: "bluebubbles reply target invalid target",
|
|
88
|
-
meta: { target },
|
|
89
|
-
});
|
|
90
|
-
return "target must be one of: current_lane, top_level, thread.";
|
|
91
|
-
},
|
|
92
|
-
summaryKeys: ["target", "threadOriginatorGuid"],
|
|
93
|
-
riskProfile: { mutates: "external_side_effect", risk: "high", reason: "changes the outbound iMessage reply route" },
|
|
94
|
-
},
|
|
95
|
-
];
|