@openclaw/imessage 2026.9.8 → 2026.10.1-beta.2
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/dist/.setup/{accounts-nzcU0cq2.mjs → accounts-evTpvJMv.mjs} +6 -12
- package/dist/.setup/{group-policy-90pw4tyG.mjs → actions-DJqbUmbN.mjs} +103 -269
- package/dist/.setup/{actions.runtime-DdBN29zj.mjs → actions.runtime-DL5i-Y4J.mjs} +49 -84
- package/dist/.setup/{api-B9Qx21G-.mjs → api-SAVMfMoY.mjs} +5 -5
- package/dist/.setup/{api-D2S6FhGw.mjs → api-oq_MryN7.mjs} +6 -6
- package/dist/.setup/{approval-handler.runtime-DKSq0DWq.mjs → approval-handler.runtime-Bj2NGNXF.mjs} +26 -62
- package/dist/.setup/{approval-reactions-Bp33xc83.mjs → approval-reactions-L9Ul7PAu.mjs} +3 -2
- package/dist/.setup/{channel-9fyvuN_p.mjs → channel-CL73qdMG.mjs} +134 -60
- package/dist/.setup/{monitor-fv9nRuTH.mjs → channel.runtime-DY7JJ0_9.mjs} +202 -206
- package/dist/.setup/{sanitize-outbound-3MLljgtY.mjs → client-12apu4Ip.mjs} +26 -635
- package/dist/.setup/{config-schema-4Q3_EqYt.mjs → config-schema-DXwa_3V5.mjs} +1 -1
- package/dist/.setup/{media-contract-CagwSMvo.mjs → media-contract-DjQGZlfl.mjs} +1 -1
- package/dist/.setup/{message-tool-api-D032l82H.mjs → message-tool-api-CqfRxLlT.mjs} +2 -2
- package/dist/.setup/{question-reactions-Cy-dmU_j.mjs → question-reactions-DJV-TnA8.mjs} +2 -1
- package/dist/.setup/{reaction-context-Br-vAJFp.mjs → reaction-context-By7kUMBC.mjs} +2 -7
- package/dist/.setup/{remote-file-DRPCaVmg.mjs → remote-file-BU7pA-Zi.mjs} +7 -11
- package/dist/.setup/sanitize-outbound-C0x4BPky.mjs +564 -0
- package/dist/.setup/{send-Cu9nl757.mjs → send-pkYwL6Rt.mjs} +56 -103
- package/dist/.setup/{setup-core-8MDdYHj5.mjs → setup-core-DqOBe-n0.mjs} +1 -1
- package/dist/.setup/{setup-surface-tGXFDdWh.mjs → setup-surface-zKhIinwY.mjs} +2 -2
- package/dist/api.js +6 -6
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/contract-api.js +1 -1
- package/dist/doctor-contract-api.js +29 -21
- package/dist/media-contract-api.js +1 -1
- package/dist/message-tool-api.js +1 -1
- package/dist/runtime-api.js +2 -24
- package/dist/setup-entry.js +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +4 -4
- package/dist/.setup/channel.runtime-n-MPKL8k.mjs +0 -92
- package/dist/.setup/state-migrations-B-Q7bO0Y.mjs +0 -47
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as
|
|
3
|
-
import {
|
|
1
|
+
import { S as normalizeDirectChatIdentifier, n as createIMessageRpcClient, r as runIMessageCliJsonCommand, u as resolveIMessageMessageId } from "./client-12apu4Ip.mjs";
|
|
2
|
+
import { n as sanitizeIMessageFinalOutboundText } from "./sanitize-outbound-C0x4BPky.mjs";
|
|
3
|
+
import { n as authorizeIMessageResourceReference, t as withIMessageRemoteFile } from "./remote-file-BU7pA-Zi.mjs";
|
|
4
|
+
import { isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
5
|
import { basename, parse, win32 } from "node:path";
|
|
5
6
|
import { asDateTimestampMs, parseStrictInteger, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
|
|
6
7
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
@@ -10,9 +11,8 @@ import { resolvePreferredOpenClawTmpDir, withTempWorkspace } from "openclaw/plug
|
|
|
10
11
|
const CHAT_LIST_CACHE_TTL_MS = 3e4;
|
|
11
12
|
const chatListCache = /* @__PURE__ */ new Map();
|
|
12
13
|
function asChatList(value) {
|
|
13
|
-
if (!
|
|
14
|
-
|
|
15
|
-
return Array.isArray(chats) ? chats.filter((chat) => chat != null && typeof chat === "object" && !Array.isArray(chat)) : [];
|
|
14
|
+
if (!isRecord(value)) return [];
|
|
15
|
+
return Array.isArray(value.chats) ? value.chats.filter(isRecord) : [];
|
|
16
16
|
}
|
|
17
17
|
function numberFromUnknown(value) {
|
|
18
18
|
return typeof value === "number" && Number.isFinite(value) ? value : parseStrictInteger(value);
|
|
@@ -142,68 +142,64 @@ async function withTempFile(input, options, fn) {
|
|
|
142
142
|
return await fn(filePath);
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
|
+
async function runMessageAction(params, method, command, fields = {}, args = [], trailingArgs = []) {
|
|
146
|
+
await runIMessageAction(params.options, method, {
|
|
147
|
+
chat_guid: params.chatGuid,
|
|
148
|
+
message_id: params.messageId,
|
|
149
|
+
part_index: params.partIndex ?? 0,
|
|
150
|
+
...fields
|
|
151
|
+
}, [
|
|
152
|
+
command,
|
|
153
|
+
"--chat",
|
|
154
|
+
params.chatGuid,
|
|
155
|
+
"--message",
|
|
156
|
+
params.messageId,
|
|
157
|
+
...args,
|
|
158
|
+
"--part",
|
|
159
|
+
String(params.partIndex ?? 0),
|
|
160
|
+
...trailingArgs
|
|
161
|
+
]);
|
|
162
|
+
}
|
|
163
|
+
function participantAction(method, command) {
|
|
164
|
+
return async (params) => {
|
|
165
|
+
await runIMessageAction(params.options, method, {
|
|
166
|
+
chat_guid: params.chatGuid,
|
|
167
|
+
address: params.address
|
|
168
|
+
}, [
|
|
169
|
+
command,
|
|
170
|
+
"--chat",
|
|
171
|
+
params.chatGuid,
|
|
172
|
+
"--address",
|
|
173
|
+
params.address
|
|
174
|
+
]);
|
|
175
|
+
};
|
|
176
|
+
}
|
|
145
177
|
const imessageActionsRuntime = {
|
|
146
178
|
resolveIMessageMessageId,
|
|
147
179
|
authorizeMessageReference: authorizeIMessageResourceReference,
|
|
148
180
|
resolveChatGuidForTarget: resolveIMessageActionChatGuid,
|
|
149
181
|
async sendReaction(params) {
|
|
150
|
-
await
|
|
151
|
-
chat_guid: params.chatGuid,
|
|
152
|
-
message_id: params.messageId,
|
|
182
|
+
await runMessageAction(params, "tapback", "tapback", {
|
|
153
183
|
reaction: params.reaction,
|
|
154
|
-
part_index: params.partIndex ?? 0,
|
|
155
184
|
...params.remove ? { remove: true } : {}
|
|
156
|
-
}, [
|
|
157
|
-
"tapback",
|
|
158
|
-
"--chat",
|
|
159
|
-
params.chatGuid,
|
|
160
|
-
"--message",
|
|
161
|
-
params.messageId,
|
|
162
|
-
"--kind",
|
|
163
|
-
params.reaction,
|
|
164
|
-
"--part",
|
|
165
|
-
String(params.partIndex ?? 0),
|
|
166
|
-
...params.remove ? ["--remove"] : []
|
|
167
|
-
]);
|
|
185
|
+
}, ["--kind", params.reaction], params.remove ? ["--remove"] : []);
|
|
168
186
|
},
|
|
169
187
|
async editMessage(params) {
|
|
170
188
|
const text = sanitizeIMessageFinalOutboundText(params.text).text;
|
|
171
189
|
const backwardsCompatMessage = sanitizeIMessageFinalOutboundText(params.backwardsCompatMessage ?? params.text).text;
|
|
172
190
|
if (!text.trim() || !backwardsCompatMessage.trim()) throw new Error("iMessage edit requires non-empty text after sanitization");
|
|
173
|
-
await
|
|
174
|
-
chat_guid: params.chatGuid,
|
|
175
|
-
message_id: params.messageId,
|
|
191
|
+
await runMessageAction(params, "message.edit", "edit", {
|
|
176
192
|
text,
|
|
177
|
-
backwards_compatibility_message: backwardsCompatMessage
|
|
178
|
-
part_index: params.partIndex ?? 0
|
|
193
|
+
backwards_compatibility_message: backwardsCompatMessage
|
|
179
194
|
}, [
|
|
180
|
-
"edit",
|
|
181
|
-
"--chat",
|
|
182
|
-
params.chatGuid,
|
|
183
|
-
"--message",
|
|
184
|
-
params.messageId,
|
|
185
195
|
"--new-text",
|
|
186
196
|
text,
|
|
187
197
|
"--bc-text",
|
|
188
|
-
backwardsCompatMessage
|
|
189
|
-
"--part",
|
|
190
|
-
String(params.partIndex ?? 0)
|
|
198
|
+
backwardsCompatMessage
|
|
191
199
|
]);
|
|
192
200
|
},
|
|
193
201
|
async unsendMessage(params) {
|
|
194
|
-
await
|
|
195
|
-
chat_guid: params.chatGuid,
|
|
196
|
-
message_id: params.messageId,
|
|
197
|
-
part_index: params.partIndex ?? 0
|
|
198
|
-
}, [
|
|
199
|
-
"unsend",
|
|
200
|
-
"--chat",
|
|
201
|
-
params.chatGuid,
|
|
202
|
-
"--message",
|
|
203
|
-
params.messageId,
|
|
204
|
-
"--part",
|
|
205
|
-
String(params.partIndex ?? 0)
|
|
206
|
-
]);
|
|
202
|
+
await runMessageAction(params, "message.unsend", "unsend");
|
|
207
203
|
},
|
|
208
204
|
async sendRichMessage(params) {
|
|
209
205
|
const formatted = sanitizeIMessageFinalOutboundText(params.text, { formatMarkdown: true });
|
|
@@ -240,10 +236,7 @@ const imessageActionsRuntime = {
|
|
|
240
236
|
...formatted.ranges.length > 0 ? filePath ? { formatting: formatted.ranges } : { text_formatting: formatted.ranges } : {}
|
|
241
237
|
}, buildArgs(filePath))) };
|
|
242
238
|
};
|
|
243
|
-
return params.attachment ? await withTempFile(
|
|
244
|
-
buffer: params.attachment.buffer,
|
|
245
|
-
filename: params.attachment.filename
|
|
246
|
-
}, params.options, send) : await send();
|
|
239
|
+
return params.attachment ? await withTempFile(params.attachment, params.options, send) : await send();
|
|
247
240
|
},
|
|
248
241
|
async renameGroup(params) {
|
|
249
242
|
await runIMessageAction(params.options, "group.rename", {
|
|
@@ -258,10 +251,7 @@ const imessageActionsRuntime = {
|
|
|
258
251
|
]);
|
|
259
252
|
},
|
|
260
253
|
async setGroupIcon(params) {
|
|
261
|
-
await withTempFile({
|
|
262
|
-
buffer: params.buffer,
|
|
263
|
-
filename: params.filename
|
|
264
|
-
}, params.options, async (filePath) => {
|
|
254
|
+
await withTempFile(params, params.options, async (filePath) => {
|
|
265
255
|
await runIMessageAction(params.options, "group.setIcon", {
|
|
266
256
|
chat_guid: params.chatGuid,
|
|
267
257
|
file: filePath
|
|
@@ -274,30 +264,8 @@ const imessageActionsRuntime = {
|
|
|
274
264
|
]);
|
|
275
265
|
});
|
|
276
266
|
},
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
chat_guid: params.chatGuid,
|
|
280
|
-
address: params.address
|
|
281
|
-
}, [
|
|
282
|
-
"chat-add-member",
|
|
283
|
-
"--chat",
|
|
284
|
-
params.chatGuid,
|
|
285
|
-
"--address",
|
|
286
|
-
params.address
|
|
287
|
-
]);
|
|
288
|
-
},
|
|
289
|
-
async removeParticipant(params) {
|
|
290
|
-
await runIMessageAction(params.options, "group.removeParticipant", {
|
|
291
|
-
chat_guid: params.chatGuid,
|
|
292
|
-
address: params.address
|
|
293
|
-
}, [
|
|
294
|
-
"chat-remove-member",
|
|
295
|
-
"--chat",
|
|
296
|
-
params.chatGuid,
|
|
297
|
-
"--address",
|
|
298
|
-
params.address
|
|
299
|
-
]);
|
|
300
|
-
},
|
|
267
|
+
addParticipant: participantAction("group.addParticipant", "chat-add-member"),
|
|
268
|
+
removeParticipant: participantAction("group.removeParticipant", "chat-remove-member"),
|
|
301
269
|
async leaveGroup(params) {
|
|
302
270
|
await runIMessageAction(params.options, "group.leave", { chat_guid: params.chatGuid }, [
|
|
303
271
|
"chat-leave",
|
|
@@ -356,10 +324,7 @@ const imessageActionsRuntime = {
|
|
|
356
324
|
};
|
|
357
325
|
},
|
|
358
326
|
async sendAttachment(params) {
|
|
359
|
-
return await withTempFile({
|
|
360
|
-
buffer: params.buffer,
|
|
361
|
-
filename: params.filename
|
|
362
|
-
}, params.options, async (filePath) => {
|
|
327
|
+
return await withTempFile(params, params.options, async (filePath) => {
|
|
363
328
|
return { messageId: resolveMessageId(await runIMessageAction(params.options, "send.attachment", {
|
|
364
329
|
chat_guid: params.chatGuid,
|
|
365
330
|
file: filePath,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./targets-BicBiYsM.mjs";
|
|
2
|
-
import "./accounts-
|
|
3
|
-
import "./message-tool-api-
|
|
4
|
-
import "./
|
|
5
|
-
import { s as imessageSetupContract } from "./setup-core-
|
|
6
|
-
import { n as createIMessagePluginBase, r as imessageSetupWizard } from "./channel-
|
|
2
|
+
import "./accounts-evTpvJMv.mjs";
|
|
3
|
+
import "./message-tool-api-CqfRxLlT.mjs";
|
|
4
|
+
import "./actions-DJqbUmbN.mjs";
|
|
5
|
+
import { s as imessageSetupContract } from "./setup-core-DqOBe-n0.mjs";
|
|
6
|
+
import { n as createIMessagePluginBase, r as imessageSetupWizard } from "./channel-CL73qdMG.mjs";
|
|
7
7
|
import "./conversation-bindings-GDQ_Laxj.mjs";
|
|
8
8
|
import { createAllowedChatSenderMatcher as createAllowedChatSenderMatcher$1, parseChatAllowTargetPrefixes, parseChatTargetPrefixesOrThrow as parseChatTargetPrefixesOrThrow$1, resolveServicePrefixedAllowTarget, resolveServicePrefixedChatTarget as resolveServicePrefixedChatTarget$1, resolveServicePrefixedOrChatAllowTarget as resolveServicePrefixedOrChatAllowTarget$1, resolveServicePrefixedTarget } from "openclaw/plugin-sdk/channel-targets";
|
|
9
9
|
//#region extensions/imessage/src/channel.setup.ts
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { a as looksLikeIMessageExplicitTargetId, c as parseIMessageTarget, i as isAllowedIMessageSender, l as looksLikeIMessageTargetId, n as inferIMessageTargetChatType, o as normalizeIMessageHandle, s as parseIMessageAllowTarget, t as formatIMessageChatTarget, u as normalizeIMessageMessagingTarget } from "./targets-BicBiYsM.mjs";
|
|
2
|
-
import { a as resolveDefaultIMessageAccountId, i as listIMessageAccountIds, o as resolveIMessageAccount, r as listEnabledIMessageAccounts } from "./accounts-
|
|
3
|
-
import { o as IMESSAGE_ACTIONS, s as IMESSAGE_ACTION_NAMES } from "./message-tool-api-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { t as imessagePlugin } from "./channel-
|
|
2
|
+
import { a as resolveDefaultIMessageAccountId, i as listIMessageAccountIds, o as resolveIMessageAccount, r as listEnabledIMessageAccounts } from "./accounts-evTpvJMv.mjs";
|
|
3
|
+
import { o as IMESSAGE_ACTIONS, s as IMESSAGE_ACTION_NAMES } from "./message-tool-api-CqfRxLlT.mjs";
|
|
4
|
+
import { v as DEFAULT_IMESSAGE_PROBE_TIMEOUT_MS } from "./client-12apu4Ip.mjs";
|
|
5
|
+
import { n as probeIMessage } from "./actions-DJqbUmbN.mjs";
|
|
6
|
+
import { c as matchIMessageAcpConversation, i as resolveIMessageGroupRequireMention, l as normalizeIMessageAcpConversationId, o as resolveIMessageGroupToolPolicy, s as resolveIMessageInboundConversationId, t as imessagePlugin, u as resolveIMessageConversationIdFromTarget } from "./channel-CL73qdMG.mjs";
|
|
7
7
|
import { t as createIMessageConversationBindingManager } from "./conversation-bindings-GDQ_Laxj.mjs";
|
|
8
|
-
import { a as resolveServicePrefixedChatTarget, c as imessageSetupPlugin, i as resolveServicePrefixedAllowTarget, n as parseChatAllowTargetPrefixes, o as resolveServicePrefixedOrChatAllowTarget, r as parseChatTargetPrefixesOrThrow, s as resolveServicePrefixedTarget, t as createAllowedChatSenderMatcher } from "./api-
|
|
8
|
+
import { a as resolveServicePrefixedChatTarget, c as imessageSetupPlugin, i as resolveServicePrefixedAllowTarget, n as parseChatAllowTargetPrefixes, o as resolveServicePrefixedOrChatAllowTarget, r as parseChatTargetPrefixesOrThrow, s as resolveServicePrefixedTarget, t as createAllowedChatSenderMatcher } from "./api-SAVMfMoY.mjs";
|
|
9
9
|
import { t as IMESSAGE_LEGACY_OUTBOUND_SEND_DEP_KEYS } from "./outbound-send-deps-B-QEsLSM.mjs";
|
|
10
10
|
export { DEFAULT_IMESSAGE_PROBE_TIMEOUT_MS, IMESSAGE_ACTIONS, IMESSAGE_ACTION_NAMES, IMESSAGE_LEGACY_OUTBOUND_SEND_DEP_KEYS, createAllowedChatSenderMatcher, createIMessageConversationBindingManager, formatIMessageChatTarget, imessagePlugin, imessageSetupPlugin, inferIMessageTargetChatType, isAllowedIMessageSender, listEnabledIMessageAccounts, listIMessageAccountIds, looksLikeIMessageExplicitTargetId, looksLikeIMessageTargetId, matchIMessageAcpConversation, normalizeIMessageAcpConversationId, normalizeIMessageHandle, normalizeIMessageMessagingTarget, parseChatAllowTargetPrefixes, parseChatTargetPrefixesOrThrow, parseIMessageAllowTarget, parseIMessageTarget, probeIMessage, resolveDefaultIMessageAccountId, resolveIMessageAccount, resolveIMessageConversationIdFromTarget, resolveIMessageGroupRequireMention, resolveIMessageGroupToolPolicy, resolveIMessageInboundConversationId, resolveServicePrefixedAllowTarget, resolveServicePrefixedChatTarget, resolveServicePrefixedOrChatAllowTarget, resolveServicePrefixedTarget };
|
package/dist/.setup/{approval-handler.runtime-DKSq0DWq.mjs → approval-handler.runtime-Bj2NGNXF.mjs}
RENAMED
|
@@ -1,37 +1,23 @@
|
|
|
1
1
|
import { c as parseIMessageTarget, u as normalizeIMessageMessagingTarget } from "./targets-BicBiYsM.mjs";
|
|
2
|
-
import { o as resolveIMessageAccount } from "./accounts-
|
|
3
|
-
import { n as getCachedIMessagePrivateApiStatus } from "./message-tool-api-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { a as
|
|
2
|
+
import { o as resolveIMessageAccount } from "./accounts-evTpvJMv.mjs";
|
|
3
|
+
import { n as getCachedIMessagePrivateApiStatus } from "./message-tool-api-CqfRxLlT.mjs";
|
|
4
|
+
import { a as normalizeIMessageMessageId } from "./actions-DJqbUmbN.mjs";
|
|
5
|
+
import { d as getIMessageApprovalApprovers } from "./channel-CL73qdMG.mjs";
|
|
6
|
+
import { i as extractMarkdownFormatRuns } from "./sanitize-outbound-C0x4BPky.mjs";
|
|
7
|
+
import { a as unregisterIMessageApprovalReactionTarget, c as buildIMessageApprovalConversationKeyForTarget, i as registerIMessageApprovalReactionTarget } from "./approval-reactions-L9Ul7PAu.mjs";
|
|
8
|
+
import { a as iMessageApprovalPollTargets, c as iMessageApprovalControlBindings, i as buildApprovalPollOptions, o as mapSentPollOptionsToDecisions, t as sendMessageIMessage } from "./send-pkYwL6Rt.mjs";
|
|
8
9
|
import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
|
|
9
10
|
import { createActionGate } from "openclaw/plugin-sdk/channel-actions";
|
|
10
11
|
import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
|
|
11
12
|
import { buildChannelApprovalNativeTargetKey } from "openclaw/plugin-sdk/approval-native-runtime";
|
|
12
13
|
import { buildApprovalNativeControlsPromptText, buildApprovalReactionPendingContent } from "openclaw/plugin-sdk/approval-reaction-runtime";
|
|
13
|
-
import { buildChannelApprovalExpiredText, buildChannelApprovalResolvedText, createChannelApprovalNativeRuntimeAdapter, resolvePreparedApprovalAccountId } from "openclaw/plugin-sdk/approval-handler-runtime";
|
|
14
14
|
import { setTimeout } from "node:timers/promises";
|
|
15
|
+
import { buildChannelApprovalExpiredText, buildChannelApprovalResolvedText, createChannelApprovalNativeRuntimeAdapter, resolvePreparedApprovalAccountId } from "openclaw/plugin-sdk/approval-handler-runtime";
|
|
15
16
|
//#region extensions/imessage/src/approval-handler.runtime.ts
|
|
16
17
|
const log = createSubsystemLogger("imessage/approvals");
|
|
17
|
-
const loadIMessageActionsRuntime = createLazyRuntimeNamedExport(() => import("./actions.runtime-
|
|
18
|
+
const loadIMessageActionsRuntime = createLazyRuntimeNamedExport(() => import("./actions.runtime-DL5i-Y4J.mjs"), "imessageActionsRuntime");
|
|
18
19
|
const DEFAULT_PROBE_TIMEOUT_MS = 5e3;
|
|
19
20
|
const APPROVAL_POLL_ORDERING_DELAY_MS = 1100;
|
|
20
|
-
function buildPendingPayload(params) {
|
|
21
|
-
const pendingContent = buildApprovalReactionPendingContent({
|
|
22
|
-
request: params.request,
|
|
23
|
-
view: params.view,
|
|
24
|
-
nowMs: params.nowMs
|
|
25
|
-
});
|
|
26
|
-
return {
|
|
27
|
-
text: pendingContent.reactionPayload.text ?? "",
|
|
28
|
-
pollText: buildApprovalNativeControlsPromptText({
|
|
29
|
-
view: params.view,
|
|
30
|
-
nowMs: params.nowMs
|
|
31
|
-
}),
|
|
32
|
-
allowedDecisions: pendingContent.reactionPayload.allowedDecisions
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
21
|
function classifyIMessageApprovalTargetTransport(params) {
|
|
36
22
|
const account = resolveIMessageAccount({
|
|
37
23
|
cfg: params.cfg,
|
|
@@ -47,13 +33,6 @@ function classifyIMessageApprovalTargetTransport(params) {
|
|
|
47
33
|
if (/^SMS;/i.test(conversationId)) return "sms";
|
|
48
34
|
return "unknown";
|
|
49
35
|
}
|
|
50
|
-
/**
|
|
51
|
-
* Cache-only capability check, run before the prompt is sent so the tapback hint
|
|
52
|
-
* can be omitted up front. Deliberately never probes: a probe spawns imsg and
|
|
53
|
-
* would put seconds of latency in front of an approval prompt. An available
|
|
54
|
-
* bridge status is cached for the process lifetime (see probe.ts), so the only
|
|
55
|
-
* cost of a cold cache is that the first approval after start uses tapbacks.
|
|
56
|
-
*/
|
|
57
36
|
function canIMessageApprovalUsePoll(params) {
|
|
58
37
|
if (params.plannedTarget.surface !== "origin" && params.plannedTarget.surface !== "approver-dm") return false;
|
|
59
38
|
if (buildApprovalPollOptions({ allowedDecisions: params.allowedDecisions }).length < 2) return false;
|
|
@@ -88,16 +67,6 @@ function resolveIMessageApprovalCliOptions(params) {
|
|
|
88
67
|
timeoutMs: account.config.probeTimeoutMs ?? DEFAULT_PROBE_TIMEOUT_MS
|
|
89
68
|
};
|
|
90
69
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Send the poll balloon after the approval details prompt. imsg normally echoes
|
|
93
|
-
* every poll question as a separate caption after the balloon; suppress that
|
|
94
|
-
* echo because OpenClaw already rendered the full context above the controls.
|
|
95
|
-
*
|
|
96
|
-
* Conversation-read authority: `chatGuid` is resolved from the approval's own
|
|
97
|
-
* routing target (origin session or a configured approver), so this read is
|
|
98
|
-
* host-originated and carries the server-owned direct-operator attestation.
|
|
99
|
-
*
|
|
100
|
-
*/
|
|
101
70
|
async function deliverIMessageApprovalPoll(params) {
|
|
102
71
|
const options = buildApprovalPollOptions({ allowedDecisions: params.allowedDecisions });
|
|
103
72
|
try {
|
|
@@ -116,13 +85,9 @@ async function deliverIMessageApprovalPoll(params) {
|
|
|
116
85
|
question: extractMarkdownFormatRuns(params.question).text,
|
|
117
86
|
choices: options.map((option) => option.text),
|
|
118
87
|
suppressComment: true,
|
|
119
|
-
options:
|
|
120
|
-
...cliOptions,
|
|
121
|
-
chatGuid
|
|
122
|
-
}
|
|
88
|
+
options: cliOptions
|
|
123
89
|
});
|
|
124
|
-
const
|
|
125
|
-
const pollGuid = reportedGuid && reportedGuid !== "ok" && reportedGuid !== "unknown" ? reportedGuid : void 0;
|
|
90
|
+
const pollGuid = normalizeIMessageMessageId(sent.messageId);
|
|
126
91
|
const optionDecisions = mapSentPollOptionsToDecisions({
|
|
127
92
|
requested: options,
|
|
128
93
|
sent: sent.pollOptions
|
|
@@ -174,11 +139,6 @@ async function deliverIMessageApprovalPoll(params) {
|
|
|
174
139
|
return null;
|
|
175
140
|
}
|
|
176
141
|
}
|
|
177
|
-
/**
|
|
178
|
-
* Polls must target a chat Messages already knows. Unlike send, we never
|
|
179
|
-
* synthesize an unregistered DM identifier here: the bridge would reject it and
|
|
180
|
-
* the poll would be lost.
|
|
181
|
-
*/
|
|
182
142
|
async function resolveIMessageApprovalChatGuid(params) {
|
|
183
143
|
const target = parseIMessageTarget(params.to);
|
|
184
144
|
if (target.kind === "chat_guid") return target.chatGuid;
|
|
@@ -199,11 +159,6 @@ async function resolveIMessageApprovalChatGuid(params) {
|
|
|
199
159
|
conversationReadOrigin: "direct-operator"
|
|
200
160
|
});
|
|
201
161
|
}
|
|
202
|
-
/**
|
|
203
|
-
* The prompt went out without its tapback hint because a poll was expected.
|
|
204
|
-
* If poll delivery fails, restore the complete reaction fallback while the
|
|
205
|
-
* original details message still carries every manual command.
|
|
206
|
-
*/
|
|
207
162
|
async function recoverIMessageApprovalTextFallback(params) {
|
|
208
163
|
try {
|
|
209
164
|
return (await sendMessageIMessage(params.target.to, params.fallbackText, {
|
|
@@ -289,12 +244,21 @@ const imessageApprovalNativeRuntime = createChannelApprovalNativeRuntimeAdapter(
|
|
|
289
244
|
shouldHandle: ({ context }) => Boolean(context)
|
|
290
245
|
},
|
|
291
246
|
presentation: {
|
|
292
|
-
buildPendingPayload: ({ request,
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
247
|
+
buildPendingPayload: ({ request, nowMs, view }) => {
|
|
248
|
+
const { reactionPayload } = buildApprovalReactionPendingContent({
|
|
249
|
+
request,
|
|
250
|
+
view,
|
|
251
|
+
nowMs
|
|
252
|
+
});
|
|
253
|
+
return {
|
|
254
|
+
text: reactionPayload.text ?? "",
|
|
255
|
+
pollText: buildApprovalNativeControlsPromptText({
|
|
256
|
+
view,
|
|
257
|
+
nowMs
|
|
258
|
+
}),
|
|
259
|
+
allowedDecisions: reactionPayload.allowedDecisions
|
|
260
|
+
};
|
|
261
|
+
},
|
|
298
262
|
buildResolvedResult: ({ request, resolved, view }) => ({
|
|
299
263
|
kind: "update",
|
|
300
264
|
payload: { text: buildChannelApprovalResolvedText({
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BBjsoOtd.mjs";
|
|
2
2
|
import { c as parseIMessageTarget, o as normalizeIMessageHandle } from "./targets-BicBiYsM.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { i as normalizeIMessageGuid } from "./actions-DJqbUmbN.mjs";
|
|
4
4
|
import { n as getOptionalIMessageRuntime } from "./runtime-Cza4CY5T.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { d as getIMessageApprovalApprovers, f as imessageApprovalAuth } from "./channel-CL73qdMG.mjs";
|
|
6
|
+
import { t as resolveIMessageReactionContext } from "./reaction-context-By7kUMBC.mjs";
|
|
6
7
|
import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
8
|
import { createLazyRuntimeSurface } from "openclaw/plugin-sdk/lazy-runtime";
|
|
8
9
|
import { asDateTimestampMs, isFutureDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
|