@openclaw/imessage 2026.9.8 → 2026.10.1-beta.1

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.
Files changed (33) hide show
  1. package/dist/.setup/{accounts-nzcU0cq2.mjs → accounts-evTpvJMv.mjs} +6 -12
  2. package/dist/.setup/{group-policy-90pw4tyG.mjs → actions-DJqbUmbN.mjs} +103 -269
  3. package/dist/.setup/{actions.runtime-DdBN29zj.mjs → actions.runtime-DL5i-Y4J.mjs} +49 -84
  4. package/dist/.setup/{api-B9Qx21G-.mjs → api-SAVMfMoY.mjs} +5 -5
  5. package/dist/.setup/{api-D2S6FhGw.mjs → api-oq_MryN7.mjs} +6 -6
  6. package/dist/.setup/{approval-handler.runtime-DKSq0DWq.mjs → approval-handler.runtime-Bj2NGNXF.mjs} +26 -62
  7. package/dist/.setup/{approval-reactions-Bp33xc83.mjs → approval-reactions-L9Ul7PAu.mjs} +3 -2
  8. package/dist/.setup/{channel-9fyvuN_p.mjs → channel-CL73qdMG.mjs} +134 -60
  9. package/dist/.setup/{monitor-fv9nRuTH.mjs → channel.runtime-DY7JJ0_9.mjs} +202 -206
  10. package/dist/.setup/{sanitize-outbound-3MLljgtY.mjs → client-12apu4Ip.mjs} +26 -635
  11. package/dist/.setup/{config-schema-4Q3_EqYt.mjs → config-schema-DXwa_3V5.mjs} +1 -1
  12. package/dist/.setup/{media-contract-CagwSMvo.mjs → media-contract-DjQGZlfl.mjs} +1 -1
  13. package/dist/.setup/{message-tool-api-D032l82H.mjs → message-tool-api-CqfRxLlT.mjs} +2 -2
  14. package/dist/.setup/{question-reactions-Cy-dmU_j.mjs → question-reactions-DJV-TnA8.mjs} +2 -1
  15. package/dist/.setup/{reaction-context-Br-vAJFp.mjs → reaction-context-By7kUMBC.mjs} +2 -7
  16. package/dist/.setup/{remote-file-DRPCaVmg.mjs → remote-file-BU7pA-Zi.mjs} +7 -11
  17. package/dist/.setup/sanitize-outbound-C0x4BPky.mjs +564 -0
  18. package/dist/.setup/{send-Cu9nl757.mjs → send-pkYwL6Rt.mjs} +56 -103
  19. package/dist/.setup/{setup-core-8MDdYHj5.mjs → setup-core-DqOBe-n0.mjs} +1 -1
  20. package/dist/.setup/{setup-surface-tGXFDdWh.mjs → setup-surface-zKhIinwY.mjs} +2 -2
  21. package/dist/api.js +6 -6
  22. package/dist/channel-config-api.js +1 -1
  23. package/dist/channel-plugin-api.js +1 -1
  24. package/dist/contract-api.js +1 -1
  25. package/dist/doctor-contract-api.js +29 -21
  26. package/dist/media-contract-api.js +1 -1
  27. package/dist/message-tool-api.js +1 -1
  28. package/dist/runtime-api.js +2 -24
  29. package/dist/setup-entry.js +1 -1
  30. package/openclaw.plugin.json +1 -1
  31. package/package.json +4 -4
  32. package/dist/.setup/channel.runtime-n-MPKL8k.mjs +0 -92
  33. package/dist/.setup/state-migrations-B-Q7bO0Y.mjs +0 -47
@@ -72,9 +72,8 @@ function isProvenLocalIMessageCliPath(params) {
72
72
  localCliPathCache.set(cacheKey, local);
73
73
  return local;
74
74
  }
75
- function isLikelyLocalIMessageCliPath(params) {
76
- if (params.remoteHost?.trim()) return false;
77
- const cliPath = params.cliPath.trim();
75
+ function isLikelyLocalIMessageCliPath(rawCliPath) {
76
+ const cliPath = rawCliPath.trim();
78
77
  if (cliPath === "imsg") return true;
79
78
  if (path.basename(cliPath) !== "imsg") return false;
80
79
  try {
@@ -91,10 +90,7 @@ function resolveIMessageChatDbLookupPath(params) {
91
90
  if (params.remoteHost?.trim()) return;
92
91
  const configured = params.dbPath?.trim();
93
92
  if (configured) return expandIMessageUserPath(configured);
94
- if (!isLikelyLocalIMessageCliPath({
95
- cliPath: params.cliPath,
96
- remoteHost: params.remoteHost
97
- })) return;
93
+ if (!isLikelyLocalIMessageCliPath(params.cliPath)) return;
98
94
  return defaultMessagesDbPath();
99
95
  }
100
96
  function resolveLocalIMessageChatDbPath(params) {
@@ -176,11 +172,9 @@ async function resolveIMessageRemoteHost(params) {
176
172
  detectedRemoteHosts.set(key, ambiguousSshWrapper);
177
173
  throwAmbiguousSshWrapper();
178
174
  }
179
- const normalized = normalizeScpRemoteHost(detected);
180
- if (detected && !normalized) logVerbose("imessage: ignoring unsafe auto-detected remoteHost from cliPath");
181
- else if (normalized) logVerbose(`imessage: detected remoteHost=${normalized} from cliPath`);
182
- detectedRemoteHosts.set(key, normalized ?? null);
183
- return normalized;
175
+ if (detected) logVerbose(`imessage: detected remoteHost=${detected} from cliPath`);
176
+ detectedRemoteHosts.set(key, detected ?? null);
177
+ return detected;
184
178
  })().finally(() => remoteHostLookups.delete(key));
185
179
  remoteHostLookups.set(key, lookup);
186
180
  return await lookup;
@@ -1,8 +1,8 @@
1
- import { c as parseIMessageTarget, o as normalizeIMessageHandle } from "./targets-BicBiYsM.mjs";
2
- import { l as resolveIMessageRemoteHost, n as hasExclusiveIMessageLocalDatabase, o as resolveIMessageAccount, u as expandIMessageUserPath } from "./accounts-nzcU0cq2.mjs";
3
- import { a as setCachedIMessagePrivateApiStatus, n as getCachedIMessagePrivateApiStatus, o as IMESSAGE_ACTIONS, r as imessageRpcSupportsMethod, s as IMESSAGE_ACTION_NAMES, t as describeIMessageMessageTool } from "./message-tool-api-D032l82H.mjs";
4
- import { c as findLatestIMessageEntryForChat, f as rememberIMessageReplyCache, l as isIMessageCurrentMessageInChat, o as createIMessageRpcClient, u as isIMessageCurrentMessageInChatAsync, w as chatContextFromIMessageTarget } from "./sanitize-outbound-3MLljgtY.mjs";
5
- import { l as isAutoManagedIMessageCliPath, n as IMESSAGE_UPDATE_COMMAND, t as IMESSAGE_INSTALL_COMMAND } from "./setup-core-8MDdYHj5.mjs";
1
+ import { c as parseIMessageTarget } from "./targets-BicBiYsM.mjs";
2
+ import { l as resolveIMessageRemoteHost, n as hasExclusiveIMessageLocalDatabase, o as resolveIMessageAccount, u as expandIMessageUserPath } from "./accounts-evTpvJMv.mjs";
3
+ import { a as setCachedIMessagePrivateApiStatus, n as getCachedIMessagePrivateApiStatus, o as IMESSAGE_ACTIONS, r as imessageRpcSupportsMethod, s as IMESSAGE_ACTION_NAMES, t as describeIMessageMessageTool } from "./message-tool-api-CqfRxLlT.mjs";
4
+ import { a as isIMessageCurrentMessageInChat, b as chatContextFromIMessageTarget, c as rememberIMessageReplyCache, i as findLatestIMessageEntryForChat, n as createIMessageRpcClient, o as isIMessageCurrentMessageInChatAsync } from "./client-12apu4Ip.mjs";
5
+ import { l as isAutoManagedIMessageCliPath, n as IMESSAGE_UPDATE_COMMAND, t as IMESSAGE_INSTALL_COMMAND } from "./setup-core-DqOBe-n0.mjs";
6
6
  import { filterStringEntries, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
7
7
  import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
8
8
  import path from "node:path";
@@ -17,8 +17,6 @@ import { runCommandWithTimeout } from "openclaw/plugin-sdk/process-runtime";
17
17
  import { getRuntimeConfig } from "openclaw/plugin-sdk/runtime-config-snapshot";
18
18
  import { detectBinary } from "openclaw/plugin-sdk/setup";
19
19
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
20
- import { createChannelApprovalAuth } from "openclaw/plugin-sdk/approval-auth-runtime";
21
- import { buildChannelGroupsScopeTree, resolveScopeRequireMention, resolveScopeToolsPolicy } from "openclaw/plugin-sdk/channel-policy";
22
20
  //#region extensions/imessage/src/message-action-reference.ts
23
21
  async function resolveAuthorizedIMessageActionReference(params) {
24
22
  const options = {
@@ -47,6 +45,17 @@ async function resolveAuthorizedIMessageActionReference(params) {
47
45
  };
48
46
  }
49
47
  //#endregion
48
+ //#region extensions/imessage/src/message-guid.ts
49
+ /** Strip the `p:<n>/` part prefix Messages puts on some GUIDs so keys match. */
50
+ function normalizeIMessageGuid(value) {
51
+ return value.trim().replace(/^p:\d+\//iu, "");
52
+ }
53
+ /** Bridge status placeholders are not identities for receipts or echo matching. */
54
+ function normalizeIMessageMessageId(value) {
55
+ const id = value?.trim();
56
+ return id && id !== "ok" && id !== "unknown" ? id : void 0;
57
+ }
58
+ //#endregion
50
59
  //#region extensions/imessage/src/probe.ts
51
60
  const RPC_SUPPORT_CACHE_TTL_MS = 3e5;
52
61
  const PRIVATE_API_NEGATIVE_TTL_MS = 1e4;
@@ -220,11 +229,6 @@ async function probeIMessagePrivateApi(cliPath, timeoutMs, options = {}) {
220
229
  return status;
221
230
  }
222
231
  }
223
- /**
224
- * Probe iMessage RPC availability.
225
- * @param timeoutMs - Explicit timeout in ms. If undefined, uses config or default.
226
- * @param opts - Additional options (cliPath, dbPath, runtime).
227
- */
228
232
  async function probeIMessage(timeoutMs, opts = {}) {
229
233
  const cfg = opts.cliPath || opts.dbPath ? void 0 : getRuntimeConfig();
230
234
  const explicitCliPath = opts.cliPath?.trim() || cfg?.channels?.imessage?.cliPath?.trim();
@@ -276,7 +280,7 @@ async function probeIMessage(timeoutMs, opts = {}) {
276
280
  }
277
281
  //#endregion
278
282
  //#region extensions/imessage/src/actions.ts
279
- const loadIMessageActionsRuntime = createLazyRuntimeNamedExport(() => import("./actions.runtime-DdBN29zj.mjs"), "imessageActionsRuntime");
283
+ const loadIMessageActionsRuntime = createLazyRuntimeNamedExport(() => import("./actions.runtime-DL5i-Y4J.mjs"), "imessageActionsRuntime");
280
284
  const log = createSubsystemLogger("channels/imessage");
281
285
  const providerId = "imessage";
282
286
  const SUPPORTED_ACTIONS = /* @__PURE__ */ new Set([...IMESSAGE_ACTION_NAMES, "upload-file"]);
@@ -344,24 +348,22 @@ function createIMessageTargetAliases(resourceAliases = []) {
344
348
  }
345
349
  };
346
350
  }
347
- async function rememberOutboundBridgeMessage(params) {
348
- const messageId = params.messageId?.trim();
349
- if (!messageId || messageId === "ok" || messageId === "unknown") return;
350
- await rememberIMessageReplyCache({
351
+ async function completeOutboundBridgeMessage(params) {
352
+ const messageId = normalizeIMessageMessageId(params.messageId);
353
+ if (messageId) await rememberIMessageReplyCache({
351
354
  accountId: params.accountId,
352
355
  messageId,
353
356
  chatGuid: params.chatGuid,
354
357
  timestamp: Date.now(),
355
358
  isFromMe: true
356
359
  });
360
+ return jsonResult({
361
+ ok: true,
362
+ messageId: params.messageId,
363
+ ...params.details
364
+ });
357
365
  }
358
- /**
359
- * Read messageId from the action params, falling back to the most recent
360
- * inbound in the same chat when the caller omitted it. The natural intent
361
- * for "react with 👍" or "tapback the last message" is the message that
362
- * just arrived in the current conversation; making the agent re-quote a
363
- * message id every time is friction the cache already has the answer for.
364
- */
366
+ /** An omitted action reference targets the most recent inbound in the same chat. */
365
367
  function readMessageIdWithChatFallback(params, chatContext) {
366
368
  const explicit = readStringParam(params, "messageId");
367
369
  if (explicit) return explicit;
@@ -371,33 +373,22 @@ function readMessageIdWithChatFallback(params, chatContext) {
371
373
  }
372
374
  async function resolveChatGuid(params) {
373
375
  const target = resolveIMessageActionTarget(params);
374
- if (target) {
375
- if (target.kind === "chat_guid") return target.chatGuid;
376
- if (target.kind === "chat_id" || target.kind === "chat_identifier") {
377
- const resolved = await params.runtime.resolveChatGuidForTarget({
378
- target,
379
- options: params.options,
380
- conversationReadOrigin: params.conversationReadOrigin
381
- });
382
- if (resolved) return resolved;
383
- throw new Error(`iMessage ${params.action} failed: chatGuid not found for ${formatUnresolvedTarget(target)}.`);
384
- }
385
- if (target.kind === "handle") {
386
- const synthesizedIdentifier = `${target.service === "sms" ? "SMS" : "iMessage"};-;${target.to}`;
387
- const resolved = await params.runtime.resolveChatGuidForTarget({
388
- target: {
389
- kind: "chat_identifier",
390
- chatIdentifier: synthesizedIdentifier
391
- },
392
- options: params.options,
393
- conversationReadOrigin: params.conversationReadOrigin
394
- });
395
- if (resolved) return resolved;
396
- if (params.action === "react" || params.action === "edit" || params.action === "unsend") throw new Error(`iMessage ${params.action} requires a known chat. No registered chat for the supplied target; send a message first or pass an explicit chatGuid.`);
397
- return synthesizedIdentifier;
398
- }
399
- }
400
- throw new Error(`iMessage ${params.action} requires chatGuid, chatId, chatIdentifier, or a chat target.`);
376
+ if (!target) throw new Error(`iMessage ${params.action} requires chatGuid, chatId, chatIdentifier, or a chat target.`);
377
+ if (target.kind === "chat_guid") return target.chatGuid;
378
+ const synthesizedIdentifier = target.kind === "handle" ? `${target.service === "sms" ? "SMS" : "iMessage"};-;${target.to}` : "";
379
+ const lookupTarget = target.kind === "handle" ? {
380
+ kind: "chat_identifier",
381
+ chatIdentifier: synthesizedIdentifier
382
+ } : target;
383
+ const resolved = await params.runtime.resolveChatGuidForTarget({
384
+ target: lookupTarget,
385
+ options: params.options,
386
+ conversationReadOrigin: params.conversationReadOrigin
387
+ });
388
+ if (resolved) return resolved;
389
+ if (target.kind !== "handle") throw new Error(`iMessage ${params.action} failed: chatGuid not found for ${formatUnresolvedTarget(target)}.`);
390
+ if (params.action === "react" || params.action === "edit" || params.action === "unsend") throw new Error(`iMessage ${params.action} requires a known chat. No registered chat for the supplied target; send a message first or pass an explicit chatGuid.`);
391
+ return synthesizedIdentifier;
401
392
  }
402
393
  function formatUnresolvedTarget(target) {
403
394
  return target.kind === "chat_id" ? "chat_id:<redacted>" : "chat_identifier:<redacted>";
@@ -408,43 +399,42 @@ function buildChatContextFromActionParams(params) {
408
399
  }
409
400
  function mapTapbackReaction(emoji) {
410
401
  const value = normalizeOptionalLowercaseString(emoji)?.replace(/\ufe0f/g, "");
411
- if (!value) return;
412
- if ([
413
- "love",
414
- "heart",
415
- "❤",
416
- "❤️"
417
- ].includes(value)) return "love";
418
- if ([
419
- "like",
420
- "+1",
421
- "thumbsup",
422
- "👍"
423
- ].includes(value)) return "like";
424
- if ([
425
- "dislike",
426
- "-1",
427
- "thumbsdown",
428
- "👎"
429
- ].includes(value)) return "dislike";
430
- if ([
431
- "laugh",
432
- "haha",
433
- "😂",
434
- "🤣"
435
- ].includes(value)) return "laugh";
436
- if ([
437
- "emphasize",
438
- "!!",
439
- "‼",
440
- "‼️"
441
- ].includes(value)) return "emphasize";
442
- if ([
443
- "question",
444
- "?",
445
- "?",
446
- "❓"
447
- ].includes(value)) return "question";
402
+ return value ? [
403
+ [
404
+ "love",
405
+ "heart",
406
+ "❤"
407
+ ],
408
+ [
409
+ "like",
410
+ "+1",
411
+ "thumbsup",
412
+ "👍"
413
+ ],
414
+ [
415
+ "dislike",
416
+ "-1",
417
+ "thumbsdown",
418
+ "👎"
419
+ ],
420
+ [
421
+ "laugh",
422
+ "haha",
423
+ "😂",
424
+ "🤣"
425
+ ],
426
+ [
427
+ "emphasize",
428
+ "!!",
429
+ "‼"
430
+ ],
431
+ [
432
+ "question",
433
+ "?",
434
+ "?",
435
+ "❓"
436
+ ]
437
+ ].find((aliases) => aliases.includes(value))?.[0] : void 0;
448
438
  }
449
439
  function decodeBase64Buffer(params, action) {
450
440
  const base64Buffer = readStringParam(params, "buffer");
@@ -558,8 +548,7 @@ const imessageMessageActions = {
558
548
  cliPath: account.config.cliPath?.trim() || "imsg",
559
549
  dbPath: account.config.dbPath?.trim() || void 0,
560
550
  remoteHost,
561
- timeoutMs: account.config.probeTimeoutMs,
562
- chatGuid: ""
551
+ timeoutMs: account.config.probeTimeoutMs
563
552
  };
564
553
  const attestedConversationReadOrigin = conversationReadOrigin ?? "delegated";
565
554
  const chatGuid = async () => await resolveChatGuid({
@@ -625,10 +614,7 @@ const imessageMessageActions = {
625
614
  reaction: kind,
626
615
  remove: remove || void 0,
627
616
  partIndex,
628
- options: {
629
- ...opts,
630
- chatGuid: reference.chatGuid
631
- }
617
+ options: opts
632
618
  });
633
619
  return jsonResult({
634
620
  ok: true,
@@ -647,10 +633,7 @@ const imessageMessageActions = {
647
633
  text,
648
634
  backwardsCompatMessage,
649
635
  partIndex,
650
- options: {
651
- ...opts,
652
- chatGuid: reference.chatGuid
653
- }
636
+ options: opts
654
637
  });
655
638
  return jsonResult({
656
639
  ok: true,
@@ -664,10 +647,7 @@ const imessageMessageActions = {
664
647
  chatGuid: reference.chatGuid,
665
648
  messageId: reference.messageId,
666
649
  partIndex,
667
- options: {
668
- ...opts,
669
- chatGuid: reference.chatGuid
670
- }
650
+ options: opts
671
651
  });
672
652
  return jsonResult({
673
653
  ok: true,
@@ -690,20 +670,13 @@ const imessageMessageActions = {
690
670
  replyToMessageId: reference.messageId,
691
671
  partIndex,
692
672
  attachment: attachment?.spec ?? void 0,
693
- options: {
694
- ...opts,
695
- chatGuid: reference.chatGuid
696
- }
673
+ options: opts
697
674
  });
698
- await rememberOutboundBridgeMessage({
675
+ return await completeOutboundBridgeMessage({
699
676
  accountId: account.accountId,
700
677
  messageId: result.messageId,
701
- chatGuid: reference.chatGuid
702
- });
703
- return jsonResult({
704
- ok: true,
705
- messageId: result.messageId,
706
- repliedTo: reference.messageId
678
+ chatGuid: reference.chatGuid,
679
+ details: { repliedTo: reference.messageId }
707
680
  });
708
681
  }
709
682
  if (action === "sendWithEffect") {
@@ -715,20 +688,13 @@ const imessageMessageActions = {
715
688
  chatGuid: resolvedChatGuid,
716
689
  text,
717
690
  effectId,
718
- options: {
719
- ...opts,
720
- chatGuid: resolvedChatGuid
721
- }
691
+ options: opts
722
692
  });
723
- await rememberOutboundBridgeMessage({
693
+ return await completeOutboundBridgeMessage({
724
694
  accountId: account.accountId,
725
695
  messageId: result.messageId,
726
- chatGuid: resolvedChatGuid
727
- });
728
- return jsonResult({
729
- ok: true,
730
- messageId: result.messageId,
731
- effect: effectId
696
+ chatGuid: resolvedChatGuid,
697
+ details: { effect: effectId }
732
698
  });
733
699
  }
734
700
  if (action === "renameGroup") {
@@ -738,10 +704,7 @@ const imessageMessageActions = {
738
704
  await runtime.renameGroup({
739
705
  chatGuid: resolvedChatGuid,
740
706
  displayName,
741
- options: {
742
- ...opts,
743
- chatGuid: resolvedChatGuid
744
- }
707
+ options: opts
745
708
  });
746
709
  return jsonResult({
747
710
  ok: true,
@@ -756,10 +719,7 @@ const imessageMessageActions = {
756
719
  chatGuid: resolvedChatGuid,
757
720
  buffer: decodeBase64Buffer(params, action),
758
721
  filename,
759
- options: {
760
- ...opts,
761
- chatGuid: resolvedChatGuid
762
- }
722
+ options: opts
763
723
  });
764
724
  return jsonResult({
765
725
  ok: true,
@@ -774,10 +734,7 @@ const imessageMessageActions = {
774
734
  await runtime[action]({
775
735
  chatGuid: resolvedChatGuid,
776
736
  address,
777
- options: {
778
- ...opts,
779
- chatGuid: resolvedChatGuid
780
- }
737
+ options: opts
781
738
  });
782
739
  return jsonResult({
783
740
  ok: true,
@@ -789,10 +746,7 @@ const imessageMessageActions = {
789
746
  const resolvedChatGuid = await chatGuid();
790
747
  await runtime.leaveGroup({
791
748
  chatGuid: resolvedChatGuid,
792
- options: {
793
- ...opts,
794
- chatGuid: resolvedChatGuid
795
- }
749
+ options: opts
796
750
  });
797
751
  return jsonResult({
798
752
  ok: true,
@@ -808,20 +762,13 @@ const imessageMessageActions = {
808
762
  buffer: decodeBase64Buffer(params, action),
809
763
  filename,
810
764
  asVoice: asVoice ?? void 0,
811
- options: {
812
- ...opts,
813
- chatGuid: resolvedChatGuid
814
- }
765
+ options: opts
815
766
  });
816
- await rememberOutboundBridgeMessage({
767
+ return await completeOutboundBridgeMessage({
817
768
  accountId: account.accountId,
818
769
  messageId: result.messageId,
819
770
  chatGuid: resolvedChatGuid
820
771
  });
821
- return jsonResult({
822
- ok: true,
823
- messageId: result.messageId
824
- });
825
772
  }
826
773
  if (action === "poll") {
827
774
  if (privateApiStatus?.selectors?.pollPayloadMessage !== true) await probePrivateApiStatus(true);
@@ -837,20 +784,13 @@ const imessageMessageActions = {
837
784
  chatGuid: resolvedChatGuid,
838
785
  question: poll.question,
839
786
  choices: poll.options,
840
- options: {
841
- ...opts,
842
- chatGuid: resolvedChatGuid
843
- }
787
+ options: opts
844
788
  });
845
- await rememberOutboundBridgeMessage({
789
+ return await completeOutboundBridgeMessage({
846
790
  accountId: account.accountId,
847
791
  messageId: result.messageId,
848
792
  chatGuid: resolvedChatGuid
849
793
  });
850
- return jsonResult({
851
- ok: true,
852
- messageId: result.messageId
853
- });
854
794
  }
855
795
  if (action === "poll-vote") {
856
796
  if (privateApiStatus?.selectors?.pollVoteMessage !== true || !imessageRpcSupportsMethod(privateApiStatus, "poll.vote")) await probePrivateApiStatus(true);
@@ -875,123 +815,17 @@ const imessageMessageActions = {
875
815
  optionIndex,
876
816
  optionId: optionId ?? void 0,
877
817
  optionText: optionText ?? void 0,
878
- options: {
879
- ...opts,
880
- chatGuid: pollReference.chatGuid
881
- }
818
+ options: opts
882
819
  });
883
- await rememberOutboundBridgeMessage({
820
+ return await completeOutboundBridgeMessage({
884
821
  accountId: account.accountId,
885
822
  messageId: result.messageId,
886
- chatGuid: pollReference.chatGuid
887
- });
888
- return jsonResult({
889
- ok: true,
890
- messageId: result.messageId,
891
- ...result.optionText ? { pollVotedOption: result.optionText } : {}
823
+ chatGuid: pollReference.chatGuid,
824
+ details: result.optionText ? { pollVotedOption: result.optionText } : void 0
892
825
  });
893
826
  }
894
827
  throw new Error(`Action ${action} is not supported for provider ${providerId}.`);
895
828
  }
896
829
  };
897
830
  //#endregion
898
- //#region extensions/imessage/src/approval-auth.ts
899
- function normalizeIMessageApproverId(value) {
900
- const raw = String(value).trim();
901
- if (!raw) return;
902
- const normalized = normalizeIMessageHandle(raw);
903
- if (!normalized || normalized.startsWith("chat_id:") || normalized.startsWith("chat_guid:") || normalized.startsWith("chat_identifier:")) return;
904
- return normalized;
905
- }
906
- function normalizeIMessageApproverEntry(value) {
907
- return String(value).trim() === "*" ? "*" : normalizeIMessageApproverId(value);
908
- }
909
- const imessageApproval = createChannelApprovalAuth({
910
- channelLabel: "iMessage",
911
- resolveInputs: ({ cfg, accountId }) => {
912
- return { allowFrom: resolveIMessageAccount({
913
- cfg,
914
- accountId
915
- }).config.allowFrom };
916
- },
917
- normalizeApprover: normalizeIMessageApproverEntry,
918
- normalizeSenderId: normalizeIMessageApproverId,
919
- isWildcardAuthorized: ({ purpose, approvers }) => purpose === "action" && approvers.includes("*")
920
- });
921
- const getIMessageApprovalApprovers = imessageApproval.resolveApprovers;
922
- const imessageApprovalAuth = imessageApproval.approvalAuth;
923
- //#endregion
924
- //#region extensions/imessage/src/conversation-id-core.ts
925
- function normalizeIMessageAcpConversationId(conversationId) {
926
- const trimmed = conversationId.trim();
927
- if (!trimmed) return null;
928
- try {
929
- const parsed = parseIMessageTarget(trimmed);
930
- if (parsed.kind === "handle") {
931
- const handle = normalizeIMessageHandle(parsed.to);
932
- return handle ? { conversationId: handle } : null;
933
- }
934
- if (parsed.kind === "chat_id") return { conversationId: String(parsed.chatId) };
935
- if (parsed.kind === "chat_guid") return { conversationId: parsed.chatGuid };
936
- return { conversationId: parsed.chatIdentifier };
937
- } catch {
938
- const handle = normalizeIMessageHandle(trimmed);
939
- return handle ? { conversationId: handle } : null;
940
- }
941
- }
942
- function matchIMessageAcpConversation(params) {
943
- const binding = normalizeIMessageAcpConversationId(params.bindingConversationId);
944
- const conversation = normalizeIMessageAcpConversationId(params.conversationId);
945
- if (!binding || !conversation) return null;
946
- if (binding.conversationId !== conversation.conversationId) return null;
947
- return {
948
- conversationId: conversation.conversationId,
949
- matchPriority: 2
950
- };
951
- }
952
- function resolveIMessageConversationIdFromTarget(target) {
953
- return normalizeIMessageAcpConversationId(target)?.conversationId;
954
- }
955
- //#endregion
956
- //#region extensions/imessage/src/conversation-id.ts
957
- function resolveIMessageInboundConversationId(params) {
958
- if (params.isGroup) return params.chatId != null && Number.isFinite(params.chatId) ? String(params.chatId) : void 0;
959
- return normalizeIMessageHandle(params.sender) || void 0;
960
- }
961
- //#endregion
962
- //#region extensions/imessage/src/group-policy.ts
963
- function resolveScopePath(params) {
964
- return params.groupId ? [params.groupId] : [];
965
- }
966
- function resolveIMessageGroupRequireMention(params) {
967
- return resolveScopeRequireMention({
968
- tree: buildChannelGroupsScopeTree(params.cfg, "imessage", params.accountId),
969
- path: resolveScopePath(params)
970
- });
971
- }
972
- function resolveIMessageGroupToolPolicy(params) {
973
- return resolveScopeToolsPolicy({
974
- ...params,
975
- tree: buildChannelGroupsScopeTree(params.cfg, "imessage", params.accountId),
976
- path: resolveScopePath(params),
977
- messageProvider: "imessage"
978
- });
979
- }
980
- /**
981
- * Per-group `systemPrompt` resolution. Mirrors `resolveWhatsAppGroupSystemPrompt`
982
- * in `extensions/whatsapp/src/system-prompt.ts`:
983
- *
984
- * 1. If the matched per-`chat_id` entry exists AND defines `systemPrompt` (key
985
- * is present, value is non-null), use it. Trim whitespace; if the trim
986
- * leaves an empty string, return `undefined` and DO NOT fall through to the
987
- * wildcard. This is how operators say "this specific group has no prompt"
988
- * without inheriting from `groups["*"]`.
989
- * 2. Otherwise, return the wildcard `groups["*"].systemPrompt` (trimmed; empty
990
- * after trim → `undefined`).
991
- */
992
- function resolveIMessageGroupSystemPrompt(params) {
993
- const prompt = params.groupConfig?.systemPrompt ?? params.defaultConfig?.systemPrompt;
994
- return typeof prompt === "string" ? prompt.trim() || void 0 : void 0;
995
- }
996
- //#endregion
997
- export { matchIMessageAcpConversation as a, getIMessageApprovalApprovers as c, probeIMessage as d, probeIMessagePrivateApi as f, resolveIMessageInboundConversationId as i, imessageApprovalAuth as l, resolveIMessageGroupSystemPrompt as n, normalizeIMessageAcpConversationId as o, resolveIMessageGroupToolPolicy as r, resolveIMessageConversationIdFromTarget as s, resolveIMessageGroupRequireMention as t, imessageMessageActions as u };
831
+ export { normalizeIMessageMessageId as a, normalizeIMessageGuid as i, probeIMessage as n, probeIMessagePrivateApi as r, imessageMessageActions as t };