@openclaw/imessage 2026.10.5-beta.4 → 2026.10.10-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 (29) hide show
  1. package/dist/.setup/{actions-Hxh12myO.mjs → actions-CZHoxlpi.mjs} +6 -10
  2. package/dist/.setup/{actions.runtime-DOIX6Fkf.mjs → actions.runtime-B-OHCffC.mjs} +7 -9
  3. package/dist/.setup/{api-BV8qHfLl.mjs → api-BifRABgX.mjs} +6 -6
  4. package/dist/.setup/{api-DC1yHVGj.mjs → api-dHebtZYA.mjs} +4 -4
  5. package/dist/.setup/{approval-handler.runtime-Dc3KzakG.mjs → approval-handler.runtime-jO19jL0F.mjs} +68 -76
  6. package/dist/.setup/{approval-reactions-JvzJCJ4a.mjs → approval-reactions-DFgEJMz2.mjs} +11 -15
  7. package/dist/.setup/{channel-9TWBUDkP.mjs → channel-D-E9DvQL.mjs} +17 -17
  8. package/dist/.setup/{channel.runtime-DrLDEY4R.mjs → channel.runtime-Cx_lRd-J.mjs} +63 -121
  9. package/dist/.setup/{client-HixFQQWY.mjs → client-BEZ_gLk-.mjs} +4 -27
  10. package/dist/.setup/{conversation-bindings-GDQ_Laxj.mjs → conversation-bindings-DR-dbHjs.mjs} +14 -2
  11. package/dist/.setup/{question-reactions-9jrqVZgE.mjs → question-reactions-BUSvdHlF.mjs} +2 -2
  12. package/dist/.setup/{reaction-context-CRXpeYAr.mjs → reaction-context-DbYCapmR.mjs} +1 -1
  13. package/dist/.setup/{remote-file-Dq5Asi_F.mjs → remote-file-vdoCnZze.mjs} +1 -1
  14. package/dist/.setup/{sanitize-outbound-DpdQERYJ.mjs → sanitize-outbound-BtEY324R.mjs} +14 -14
  15. package/dist/.setup/{send-BZZzMbdi.mjs → send-Jaf5eIJS.mjs} +10 -63
  16. package/dist/.setup/{setup-core-CaRGbZOL.mjs → setup-core-BHyLkAEJ.mjs} +1 -1
  17. package/dist/.setup/{setup-surface-BMWS7VuY.mjs → setup-surface-DPqiLGy0.mjs} +1 -1
  18. package/dist/api.js +6 -6
  19. package/dist/channel-config-api.js +1 -2
  20. package/dist/channel-plugin-api.js +1 -2
  21. package/dist/contract-api.js +1 -2
  22. package/dist/media-contract-api.js +1 -2
  23. package/dist/message-tool-api.js +1 -2
  24. package/dist/runtime-api.js +1 -1
  25. package/dist/session-binding-contract-api.js +1 -2
  26. package/dist/setup-entry.js +1 -1
  27. package/node_modules/typebox/build/value/clean/from_object.mjs +1 -1
  28. package/node_modules/typebox/package.json +1 -1
  29. package/package.json +5 -5
@@ -1,8 +1,8 @@
1
1
  import { c as parseIMessageTarget } from "./targets-B4oU7n-v.mjs";
2
2
  import { l as resolveIMessageRemoteHost, n as hasExclusiveIMessageLocalDatabase, o as resolveIMessageAccount, u as expandIMessageUserPath } from "./accounts-DacCvDBt.mjs";
3
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-B5NfPnFL.mjs";
4
- import { a as isIMessageCurrentMessageInChat, b as chatContextFromIMessageTarget, c as rememberIMessageReplyCache, i as findLatestIMessageEntryForChat, n as createIMessageRpcClient, o as isIMessageCurrentMessageInChatAsync } from "./client-HixFQQWY.mjs";
5
- import { l as isAutoManagedIMessageCliPath, n as IMESSAGE_UPDATE_COMMAND, t as IMESSAGE_INSTALL_COMMAND } from "./setup-core-CaRGbZOL.mjs";
4
+ import { a as isIMessageCurrentMessageInChatAsync, i as findLatestIMessageEntryForChat, n as createIMessageRpcClient, s as rememberIMessageReplyCache, y as chatContextFromIMessageTarget } from "./client-BEZ_gLk-.mjs";
5
+ import { l as isAutoManagedIMessageCliPath, n as IMESSAGE_UPDATE_COMMAND, t as IMESSAGE_INSTALL_COMMAND } from "./setup-core-BHyLkAEJ.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";
@@ -14,7 +14,7 @@ import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
14
14
  import { extractToolSend } from "openclaw/plugin-sdk/tool-send";
15
15
  import { asDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
16
16
  import { runCommandWithTimeout } from "openclaw/plugin-sdk/process-runtime";
17
- import { getRuntimeConfig } from "openclaw/plugin-sdk/runtime-config-snapshot";
17
+ import { captureRuntimeConfigAsyncReader } 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
20
  //#region extensions/imessage/src/message-action-reference.ts
@@ -211,7 +211,7 @@ async function probeIMessagePrivateApi(cliPath, timeoutMs, options = {}) {
211
211
  }
212
212
  }
213
213
  async function probeIMessage(timeoutMs, opts = {}) {
214
- const cfg = opts.cliPath || opts.dbPath ? void 0 : getRuntimeConfig();
214
+ const cfg = opts.cliPath || opts.dbPath ? void 0 : await captureRuntimeConfigAsyncReader()();
215
215
  const explicitCliPath = opts.cliPath?.trim() || cfg?.channels?.imessage?.cliPath?.trim();
216
216
  const cliPath = explicitCliPath || "imsg";
217
217
  const dbPath = opts.dbPath?.trim() || cfg?.channels?.imessage?.dbPath?.trim();
@@ -260,7 +260,7 @@ async function probeIMessage(timeoutMs, opts = {}) {
260
260
  }
261
261
  //#endregion
262
262
  //#region extensions/imessage/src/actions.ts
263
- const loadIMessageActionsRuntime = createLazyRuntimeNamedExport(() => import("./actions.runtime-DOIX6Fkf.mjs"), "imessageActionsRuntime");
263
+ const loadIMessageActionsRuntime = createLazyRuntimeNamedExport(() => import("./actions.runtime-B-OHCffC.mjs"), "imessageActionsRuntime");
264
264
  const log = createSubsystemLogger("channels/imessage");
265
265
  const providerId = "imessage";
266
266
  const SUPPORTED_ACTIONS = /* @__PURE__ */ new Set([...IMESSAGE_ACTION_NAMES, "upload-file"]);
@@ -318,10 +318,6 @@ function createIMessageTargetAliases(resourceAliases = []) {
318
318
  aliases: [...IMESSAGE_DELIVERY_TARGET_ALIASES, ...resourceAliases],
319
319
  deliveryTargetAliases: [...IMESSAGE_DELIVERY_TARGET_ALIASES],
320
320
  resolveDeliveryTarget: ({ args }) => resolveIMessageDeliveryTarget(args),
321
- matchesCurrentConversation: (params) => {
322
- const match = currentConversationMatchParams(params);
323
- return match ? isIMessageCurrentMessageInChat(match) : false;
324
- },
325
321
  matchesCurrentConversationAsync: async (params) => {
326
322
  const match = currentConversationMatchParams(params);
327
323
  return match ? await isIMessageCurrentMessageInChatAsync(match) : false;
@@ -457,7 +453,7 @@ function effectIdFromParam(raw) {
457
453
  if (!value) return;
458
454
  const resolved = EFFECT_ALIASES[value] ?? raw;
459
455
  if (typeof resolved === "string" && KNOWN_EFFECT_IDS.has(resolved)) return resolved;
460
- throw new Error(`iMessage sendWithEffect rejected unknown effect "${raw}". Use one of: slam, loud, gentle, invisibleink, confetti, lasers, fireworks, balloon, heart, echo, happybirthday, shootingstar, sparkles, spotlight (or the canonical com.apple.MobileSMS.expressivesend.* / com.apple.messages.effect.* identifier).`);
456
+ throw new Error(`iMessage sendWithEffect rejected unknown effect "${raw}". Use one of: slam, loud, gentle, invisibleink, confetti, lasers, fireworks, balloon, heart, echo, happybirthday, shootingstar, sparkles, spotlight (or the full com.apple.MobileSMS.expressivesend.* / com.apple.messages.effect.* identifier).`);
461
457
  }
462
458
  function assertActionEnabled(action, actionsConfig) {
463
459
  const spec = IMESSAGE_ACTIONS[action === "upload-file" ? "sendAttachment" : action];
@@ -1,9 +1,9 @@
1
- import { S as normalizeDirectChatIdentifier, n as createIMessageRpcClient, r as runIMessageCliJsonCommand, u as resolveIMessageMessageId } from "./client-HixFQQWY.mjs";
2
- import { n as sanitizeIMessageFinalOutboundText } from "./sanitize-outbound-DpdQERYJ.mjs";
3
- import { n as authorizeIMessageResourceReference, t as withIMessageRemoteFile } from "./remote-file-Dq5Asi_F.mjs";
1
+ import { l as resolveIMessageMessageId, n as createIMessageRpcClient, r as runIMessageCliJsonCommand, x as normalizeDirectChatIdentifier } from "./client-BEZ_gLk-.mjs";
2
+ import { n as sanitizeIMessageFinalOutboundText } from "./sanitize-outbound-BtEY324R.mjs";
3
+ import { n as authorizeIMessageResourceReference, t as withIMessageRemoteFile } from "./remote-file-vdoCnZze.mjs";
4
4
  import { isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
5
5
  import { basename, parse, win32 } from "node:path";
6
- import { asDateTimestampMs, parseStrictInteger, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
6
+ import { parseStrictInteger } from "openclaw/plugin-sdk/number-runtime";
7
7
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
8
8
  import { captureChannelReadAuthority, captureEffectAuthority } from "openclaw/plugin-sdk/fetch-runtime";
9
9
  import { sanitizeUntrustedFileName } from "openclaw/plugin-sdk/security-runtime";
@@ -35,17 +35,15 @@ async function resolveIMessageActionChatGuid(params) {
35
35
  const { cliPath, dbPath, remoteHost } = params.options;
36
36
  const key = `${cliPath}\0${dbPath ?? ""}\0${remoteHost ?? ""}`;
37
37
  const cached = chatListCache.get(key);
38
- const now = asDateTimestampMs(Date.now());
39
- if (cached && now !== void 0 && cached.expiresAt > now) return findChatGuid(cached.list, params.target);
38
+ if (cached && cached.expiresAt > Date.now()) return findChatGuid(cached.list, params.target);
40
39
  chatListCache.delete(key);
41
40
  const client = await createIMessageRpcClient(params.options);
42
41
  try {
43
42
  const result = await client.request("chats.list", { limit: 1e3 }, { timeoutMs: params.options.timeoutMs });
44
43
  const list = isRecord(result) && Array.isArray(result.chats) ? result.chats.filter(isRecord) : [];
45
- const expiresAt = resolveExpiresAtMsFromDurationMs(CHAT_LIST_CACHE_TTL_MS);
46
- if (expiresAt !== void 0) chatListCache.set(key, {
44
+ chatListCache.set(key, {
47
45
  list,
48
- expiresAt
46
+ expiresAt: Date.now() + CHAT_LIST_CACHE_TTL_MS
49
47
  });
50
48
  return findChatGuid(list, params.target);
51
49
  } finally {
@@ -1,10 +1,10 @@
1
1
  import { a as looksLikeIMessageExplicitTargetId, c as parseIMessageTarget, d as normalizeIMessageMessagingTarget, i as isAllowedIMessageSender, n as inferIMessageTargetChatType, o as normalizeIMessageHandle, s as parseIMessageAllowTarget, t as formatIMessageChatTarget, u as looksLikeIMessageTargetId } from "./targets-B4oU7n-v.mjs";
2
2
  import { a as resolveDefaultIMessageAccountId, i as listIMessageAccountIds, o as resolveIMessageAccount, r as listEnabledIMessageAccounts } from "./accounts-DacCvDBt.mjs";
3
3
  import { o as IMESSAGE_ACTIONS, s as IMESSAGE_ACTION_NAMES } from "./message-tool-api-B5NfPnFL.mjs";
4
- import { v as DEFAULT_IMESSAGE_PROBE_TIMEOUT_MS } from "./client-HixFQQWY.mjs";
5
- import { n as probeIMessage } from "./actions-Hxh12myO.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-9TWBUDkP.mjs";
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-DC1yHVGj.mjs";
4
+ import { _ as DEFAULT_IMESSAGE_PROBE_TIMEOUT_MS } from "./client-BEZ_gLk-.mjs";
5
+ import { n as probeIMessage } from "./actions-CZHoxlpi.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-D-E9DvQL.mjs";
7
+ import { n as createIMessageConversationBindingManagerV2, t as createIMessageConversationBindingManager } from "./conversation-bindings-DR-dbHjs.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-dHebtZYA.mjs";
9
9
  import { t as IMESSAGE_LEGACY_OUTBOUND_SEND_DEP_KEYS } from "./outbound-send-deps-B-QEsLSM.mjs";
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 };
10
+ export { DEFAULT_IMESSAGE_PROBE_TIMEOUT_MS, IMESSAGE_ACTIONS, IMESSAGE_ACTION_NAMES, IMESSAGE_LEGACY_OUTBOUND_SEND_DEP_KEYS, createAllowedChatSenderMatcher, createIMessageConversationBindingManager, createIMessageConversationBindingManagerV2, 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 };
@@ -1,10 +1,10 @@
1
1
  import "./targets-B4oU7n-v.mjs";
2
2
  import "./accounts-DacCvDBt.mjs";
3
3
  import "./message-tool-api-B5NfPnFL.mjs";
4
- import "./actions-Hxh12myO.mjs";
5
- import { s as imessageSetupContract } from "./setup-core-CaRGbZOL.mjs";
6
- import { n as createIMessagePluginBase, r as imessageSetupWizard } from "./channel-9TWBUDkP.mjs";
7
- import "./conversation-bindings-GDQ_Laxj.mjs";
4
+ import "./actions-CZHoxlpi.mjs";
5
+ import { s as imessageSetupContract } from "./setup-core-BHyLkAEJ.mjs";
6
+ import { n as createIMessagePluginBase, r as imessageSetupWizard } from "./channel-D-E9DvQL.mjs";
7
+ import "./conversation-bindings-DR-dbHjs.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
10
10
  const imessageSetupPlugin = createIMessagePluginBase({
@@ -1,21 +1,21 @@
1
1
  import { c as parseIMessageTarget, d as normalizeIMessageMessagingTarget } from "./targets-B4oU7n-v.mjs";
2
2
  import { o as resolveIMessageAccount } from "./accounts-DacCvDBt.mjs";
3
3
  import { n as getCachedIMessagePrivateApiStatus } from "./message-tool-api-B5NfPnFL.mjs";
4
- import { a as normalizeIMessageMessageId } from "./actions-Hxh12myO.mjs";
5
- import { d as getIMessageApprovalApprovers } from "./channel-9TWBUDkP.mjs";
6
- import { i as extractMarkdownFormatRuns } from "./sanitize-outbound-DpdQERYJ.mjs";
7
- import { a as unregisterIMessageApprovalReactionTarget, c as buildIMessageApprovalConversationKeyForTarget, i as registerIMessageApprovalReactionTarget } from "./approval-reactions-JvzJCJ4a.mjs";
8
- import { a as iMessageApprovalPollTargets, c as iMessageApprovalControlBindings, i as buildApprovalPollOptions, o as mapSentPollOptionsToDecisions, t as sendMessageIMessage } from "./send-BZZzMbdi.mjs";
4
+ import { a as normalizeIMessageMessageId } from "./actions-CZHoxlpi.mjs";
5
+ import { d as getIMessageApprovalApprovers } from "./channel-D-E9DvQL.mjs";
6
+ import { i as extractMarkdownFormatRuns } from "./sanitize-outbound-BtEY324R.mjs";
7
+ import { a as unregisterIMessageApprovalReactionTarget, c as buildIMessageApprovalConversationKeyForTarget, i as registerIMessageApprovalReactionTarget } from "./approval-reactions-DFgEJMz2.mjs";
8
+ import { a as iMessageApprovalPollTargets, i as buildApprovalPollOptions, o as mapSentPollOptionsToDecisions, t as sendMessageIMessage } from "./send-Jaf5eIJS.mjs";
9
9
  import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
10
10
  import { createActionGate } from "openclaw/plugin-sdk/channel-actions";
11
11
  import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
12
12
  import { buildChannelApprovalNativeTargetKey } from "openclaw/plugin-sdk/approval-native-runtime";
13
13
  import { buildApprovalNativeControlsPromptText, buildApprovalReactionPendingContent } from "openclaw/plugin-sdk/approval-reaction-runtime";
14
14
  import { setTimeout } from "node:timers/promises";
15
- import { buildChannelApprovalExpiredText, buildChannelApprovalResolvedText, createChannelApprovalNativeRuntimeAdapter, resolvePreparedApprovalAccountId } from "openclaw/plugin-sdk/approval-handler-runtime";
15
+ import { buildChannelApprovalExpiredText, buildChannelApprovalResolvedText, createChannelApprovalNativeRuntimeAdapterAsync, resolvePreparedApprovalAccountId } from "openclaw/plugin-sdk/approval-handler-runtime";
16
16
  //#region extensions/imessage/src/approval-handler.runtime.ts
17
17
  const log = createSubsystemLogger("imessage/approvals");
18
- const loadIMessageActionsRuntime = createLazyRuntimeNamedExport(() => import("./actions.runtime-DOIX6Fkf.mjs"), "imessageActionsRuntime");
18
+ const loadIMessageActionsRuntime = createLazyRuntimeNamedExport(() => import("./actions.runtime-B-OHCffC.mjs"), "imessageActionsRuntime");
19
19
  const DEFAULT_PROBE_TIMEOUT_MS = 5e3;
20
20
  const APPROVAL_POLL_ORDERING_DELAY_MS = 1100;
21
21
  function classifyIMessageApprovalTargetTransport(params) {
@@ -200,7 +200,7 @@ async function bindIMessageApprovalEntry(params) {
200
200
  const [reactionTargets, pollBound] = await Promise.all([Promise.all(reactionRegistrations), pollRegistration]);
201
201
  return reactionTargets.some(Boolean) || pollBound ? true : null;
202
202
  }
203
- const imessageApprovalNativeRuntime = createChannelApprovalNativeRuntimeAdapter({
203
+ const imessageApprovalNativeRuntime = createChannelApprovalNativeRuntimeAdapterAsync({
204
204
  eventKinds: [
205
205
  "exec",
206
206
  "plugin",
@@ -271,78 +271,70 @@ const imessageApprovalNativeRuntime = createChannelApprovalNativeRuntimeAdapter(
271
271
  cfg,
272
272
  accountId: preparedTarget.accountId
273
273
  }).accountId;
274
- const bindingWindow = iMessageApprovalControlBindings.begin({
275
- accountId,
276
- conversation
274
+ const targetTransport = expectPoll ? classifyIMessageApprovalTargetTransport({
275
+ cfg,
276
+ target: preparedTarget
277
+ }) : "unknown";
278
+ const reactionFallbackVisible = !expectPoll || targetTransport !== "imessage";
279
+ const promptText = reactionFallbackVisible ? pendingPayload.text : pendingPayload.pollText;
280
+ const approvalPrompt = {
281
+ approvalId: view.approvalId,
282
+ approvalKind: view.approvalKind,
283
+ allowedDecisions: pendingPayload.allowedDecisions
284
+ };
285
+ const result = await sendMessageIMessage(preparedTarget.to, promptText, {
286
+ config: cfg,
287
+ ...reactionFallbackVisible ? { approvalPrompt } : {},
288
+ conversationReadOrigin: "direct-operator",
289
+ ...preparedTarget.accountId ? { accountId: preparedTarget.accountId } : {}
277
290
  });
278
- try {
279
- const targetTransport = expectPoll ? classifyIMessageApprovalTargetTransport({
280
- cfg,
281
- target: preparedTarget
282
- }) : "unknown";
283
- const reactionFallbackVisible = !expectPoll || targetTransport !== "imessage";
284
- const promptText = reactionFallbackVisible ? pendingPayload.text : pendingPayload.pollText;
285
- const approvalPrompt = {
286
- approvalId: view.approvalId,
287
- approvalKind: view.approvalKind,
288
- allowedDecisions: pendingPayload.allowedDecisions
289
- };
290
- const result = await sendMessageIMessage(preparedTarget.to, promptText, {
291
+ if (!result.guid) return null;
292
+ const confirmedTransport = result.service ?? (result.chatGuid && /^iMessage;/i.test(result.chatGuid) ? "imessage" : result.chatGuid && /^SMS;/i.test(result.chatGuid) ? "sms" : targetTransport);
293
+ const poll = expectPoll && confirmedTransport === "imessage" ? await deliverIMessageApprovalPoll({
294
+ cfg,
295
+ target: preparedTarget,
296
+ approvalId: view.approvalId,
297
+ approvalKind: view.approvalKind,
298
+ expiresAtMs: view.expiresAtMs,
299
+ question: pendingPayload.pollText,
300
+ allowedDecisions: pendingPayload.allowedDecisions
301
+ }) : null;
302
+ let hintMessageId;
303
+ if (expectPoll && !poll && !reactionFallbackVisible) try {
304
+ hintMessageId = (await sendMessageIMessage(preparedTarget.to, pendingPayload.text, {
291
305
  config: cfg,
292
- ...reactionFallbackVisible ? { approvalPrompt } : {},
306
+ approvalPrompt,
293
307
  conversationReadOrigin: "direct-operator",
294
- ...preparedTarget.accountId ? { accountId: preparedTarget.accountId } : {}
295
- });
296
- if (!result.guid) return null;
297
- const confirmedTransport = result.service ?? (result.chatGuid && /^iMessage;/i.test(result.chatGuid) ? "imessage" : result.chatGuid && /^SMS;/i.test(result.chatGuid) ? "sms" : targetTransport);
298
- const poll = expectPoll && confirmedTransport === "imessage" ? await deliverIMessageApprovalPoll({
299
- cfg,
300
- target: preparedTarget,
301
- approvalId: view.approvalId,
302
- approvalKind: view.approvalKind,
303
- expiresAtMs: view.expiresAtMs,
304
- question: pendingPayload.pollText,
305
- allowedDecisions: pendingPayload.allowedDecisions
306
- }) : null;
307
- let hintMessageId;
308
- if (expectPoll && !poll && !reactionFallbackVisible) try {
309
- hintMessageId = (await sendMessageIMessage(preparedTarget.to, pendingPayload.text, {
310
- config: cfg,
311
- approvalPrompt,
312
- conversationReadOrigin: "direct-operator",
313
- ...preparedTarget.accountId ? { accountId: preparedTarget.accountId } : {},
314
- replyToId: result.guid
315
- })).guid;
316
- } catch (error) {
317
- log.error(`imessage approvals: text-fallback recovery failed: ${String(error)}`);
318
- }
319
- const entry = {
320
- accountId,
321
- to: preparedTarget.to,
322
- conversation: poll ? {
323
- ...conversation,
324
- chatGuid: poll.chatGuid
325
- } : conversation,
326
- messageId: result.guid,
327
- ...hintMessageId ? { hintMessageId } : {},
328
- ...poll && reactionFallbackVisible ? { reactionFallbackVisible: true } : {},
329
- ...poll ? { poll: {
330
- ...poll.pollGuid ? { pollGuid: poll.pollGuid } : {},
331
- optionDecisions: poll.optionDecisions
332
- } } : {}
333
- };
334
- if (await bindIMessageApprovalEntry({
335
- entry,
336
- approvalId: view.approvalId,
337
- approvalKind: view.approvalKind,
338
- allowedDecisions: pendingPayload.allowedDecisions,
339
- expiresAtMs: view.expiresAtMs,
340
- pollTargetWasRegisteredDuringDelivery: Boolean(entry.poll)
341
- })) eagerlyBoundApprovalEntries.add(entry);
342
- return entry;
343
- } finally {
344
- bindingWindow.close();
308
+ ...preparedTarget.accountId ? { accountId: preparedTarget.accountId } : {},
309
+ replyToId: result.guid
310
+ })).guid;
311
+ } catch (error) {
312
+ log.error(`imessage approvals: text-fallback recovery failed: ${String(error)}`);
345
313
  }
314
+ const entry = {
315
+ accountId,
316
+ to: preparedTarget.to,
317
+ conversation: poll ? {
318
+ ...conversation,
319
+ chatGuid: poll.chatGuid
320
+ } : conversation,
321
+ messageId: result.guid,
322
+ ...hintMessageId ? { hintMessageId } : {},
323
+ ...poll && reactionFallbackVisible ? { reactionFallbackVisible: true } : {},
324
+ ...poll ? { poll: {
325
+ ...poll.pollGuid ? { pollGuid: poll.pollGuid } : {},
326
+ optionDecisions: poll.optionDecisions
327
+ } } : {}
328
+ };
329
+ if (await bindIMessageApprovalEntry({
330
+ entry,
331
+ approvalId: view.approvalId,
332
+ approvalKind: view.approvalKind,
333
+ allowedDecisions: pendingPayload.allowedDecisions,
334
+ expiresAtMs: view.expiresAtMs,
335
+ pollTargetWasRegisteredDuringDelivery: Boolean(entry.poll)
336
+ })) eagerlyBoundApprovalEntries.add(entry);
337
+ return entry;
346
338
  },
347
339
  updateEntry: async ({ cfg, entry, payload }) => {
348
340
  await sendMessageIMessage(entry.to, payload.text, {
@@ -1,9 +1,9 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BBjsoOtd.mjs";
2
2
  import { c as parseIMessageTarget, o as normalizeIMessageHandle } from "./targets-B4oU7n-v.mjs";
3
- import { i as normalizeIMessageGuid } from "./actions-Hxh12myO.mjs";
3
+ import { i as normalizeIMessageGuid } from "./actions-CZHoxlpi.mjs";
4
4
  import { n as getOptionalIMessageRuntime } from "./runtime-Cza4CY5T.mjs";
5
- import { d as getIMessageApprovalApprovers, f as imessageApprovalAuth } from "./channel-9TWBUDkP.mjs";
6
- import { t as resolveIMessageReactionContext } from "./reaction-context-CRXpeYAr.mjs";
5
+ import { d as getIMessageApprovalApprovers, f as imessageApprovalAuth } from "./channel-D-E9DvQL.mjs";
6
+ import { t as resolveIMessageReactionContext } from "./reaction-context-DbYCapmR.mjs";
7
7
  import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
8
8
  import { createLazyRuntimeSurface } from "openclaw/plugin-sdk/lazy-runtime";
9
9
  import { asDateTimestampMs, isFutureDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
@@ -98,24 +98,21 @@ function mergePollTargetConversation(left, right) {
98
98
  }
99
99
  const reportPersistentApprovalReactionError$1 = createPluginStateErrorReporter(getOptionalIMessageRuntime, "imessage", "approval-reaction-state", "iMessage persistent approval reaction state failed");
100
100
  let pendingReactionPollTargetStore;
101
- let pendingReactionPollTargetStoreDisabled = false;
102
- function disablePendingReactionPollTargetStore(error) {
103
- pendingReactionPollTargetStoreDisabled = true;
101
+ function invalidatePendingReactionPollTargetStore(error) {
104
102
  pendingReactionPollTargetStore = void 0;
105
103
  reportPersistentApprovalReactionError$1(error);
106
104
  }
107
105
  function getPendingReactionPollTargetStore() {
108
- if (pendingReactionPollTargetStoreDisabled) return;
109
106
  if (pendingReactionPollTargetStore) return pendingReactionPollTargetStore;
110
107
  try {
111
- pendingReactionPollTargetStore = getOptionalIMessageRuntime()?.state.openKeyedStore({
108
+ pendingReactionPollTargetStore = getOptionalIMessageRuntime()?.state.openKeyedStoreV2({
112
109
  namespace: PERSISTENT_POLL_TARGET_NAMESPACE,
113
110
  maxEntries: PERSISTENT_MAX_ENTRIES$1,
114
111
  defaultTtlMs: DEFAULT_REACTION_TARGET_TTL_MS$1
115
112
  });
116
113
  return pendingReactionPollTargetStore;
117
114
  } catch (error) {
118
- disablePendingReactionPollTargetStore(error);
115
+ invalidatePendingReactionPollTargetStore(error);
119
116
  return;
120
117
  }
121
118
  }
@@ -160,7 +157,7 @@ async function recordIMessageApprovalReactionPollTarget(params) {
160
157
  const writes = [];
161
158
  for (const key of params.keys) {
162
159
  pendingReactionPollTargets.set(key, target);
163
- if (store) writes.push(store.register(key, target, { ttlMs: expiry.ttlMs }).catch(disablePendingReactionPollTargetStore));
160
+ if (store) writes.push(store.register(key, target, { ttlMs: expiry.ttlMs }).catch(invalidatePendingReactionPollTargetStore));
164
161
  }
165
162
  prunePendingReactionPollTargets();
166
163
  await Promise.all(writes);
@@ -170,7 +167,7 @@ async function deleteIMessageApprovalReactionPollTargets(keys) {
170
167
  const deletions = [];
171
168
  for (const key of keys) {
172
169
  pendingReactionPollTargets.delete(key);
173
- if (store) deletions.push(store.delete(key).catch(disablePendingReactionPollTargetStore));
170
+ if (store) deletions.push(store.delete(key).catch(invalidatePendingReactionPollTargetStore));
174
171
  }
175
172
  await Promise.all(deletions);
176
173
  }
@@ -189,7 +186,7 @@ async function listPendingIMessageApprovalReactionPollTargets(params) {
189
186
  pendingReactionPollTargets.set(entry.key, target);
190
187
  }
191
188
  } catch (error) {
192
- disablePendingReactionPollTargetStore(error);
189
+ invalidatePendingReactionPollTargetStore(error);
193
190
  }
194
191
  prunePendingReactionPollTargets(nowMs);
195
192
  const targetByApprovalAndMessage = /* @__PURE__ */ new Map();
@@ -212,7 +209,6 @@ async function listPendingIMessageApprovalReactionPollTargets(params) {
212
209
  function clearIMessageApprovalReactionPollTargetsForTest() {
213
210
  pendingReactionPollTargets.clear();
214
211
  pendingReactionPollTargetStore = void 0;
215
- pendingReactionPollTargetStoreDisabled = false;
216
212
  }
217
213
  //#endregion
218
214
  //#region extensions/imessage/src/approval-reactions.ts
@@ -247,7 +243,7 @@ const imessageApprovalReactionTargets = createApprovalReactionTargetStore({
247
243
  namespace: PERSISTENT_NAMESPACE,
248
244
  maxEntries: PERSISTENT_MAX_ENTRIES,
249
245
  defaultTtlMs: DEFAULT_REACTION_TARGET_TTL_MS,
250
- openStore: (params) => getOptionalIMessageRuntime()?.state.openKeyedStore(params),
246
+ openStore: (params) => getOptionalIMessageRuntime()?.state.openKeyedStoreV2(params),
251
247
  logPersistentError: reportPersistentApprovalReactionError,
252
248
  readPersistedTarget: readApprovalReactionTargetRecord
253
249
  });
@@ -514,4 +510,4 @@ function clearIMessageApprovalReactionTargetsForTest() {
514
510
  loadResolveApprovalOverGateway.clear();
515
511
  }
516
512
  //#endregion
517
- export { unregisterIMessageApprovalReactionTarget as a, buildIMessageApprovalConversationKeyForTarget as c, normalizeConversationKey as d, resolveIMessageApprovalControlActor as f, registerIMessageApprovalReactionTarget as i, enumerateApprovalTargetKeys as l, handleIMessageApprovalReaction as n, listPendingIMessageApprovalReactionPollTargets as o, maybeResolveIMessageApprovalReaction as r, buildIMessageApprovalConversationKeyForInbound as s, approval_reactions_exports as t, enumerateConversationKeyForms as u };
513
+ export { unregisterIMessageApprovalReactionTarget as a, buildIMessageApprovalConversationKeyForTarget as c, resolveIMessageApprovalControlActor as d, registerIMessageApprovalReactionTarget as i, enumerateApprovalTargetKeys as l, handleIMessageApprovalReaction as n, listPendingIMessageApprovalReactionPollTargets as o, maybeResolveIMessageApprovalReaction as r, buildIMessageApprovalConversationKeyForInbound as s, approval_reactions_exports as t, normalizeConversationKey as u };
@@ -1,10 +1,10 @@
1
1
  import { a as looksLikeIMessageExplicitTargetId, c as parseIMessageTarget, d as normalizeIMessageMessagingTarget, f as isIMessagePhoneLikeHandle, n as inferIMessageTargetChatType, o as normalizeIMessageHandle } from "./targets-B4oU7n-v.mjs";
2
2
  import { a as resolveDefaultIMessageAccountId, i as listIMessageAccountIds, o as resolveIMessageAccount, t as collectIMessageDuplicateAccountSourceWarnings } from "./accounts-DacCvDBt.mjs";
3
- import { C as resolveIMessageDirectChatService } from "./client-HixFQQWY.mjs";
4
- import { t as imessageMessageActions } from "./actions-Hxh12myO.mjs";
5
- import { i as createIMessageSetupWizardProxy, s as imessageSetupContract } from "./setup-core-CaRGbZOL.mjs";
6
- import { t as createIMessageConversationBindingManager } from "./conversation-bindings-GDQ_Laxj.mjs";
7
- import { n as sanitizeIMessageFinalOutboundText, r as sanitizeOutboundText } from "./sanitize-outbound-DpdQERYJ.mjs";
3
+ import { S as resolveIMessageDirectChatService } from "./client-BEZ_gLk-.mjs";
4
+ import { t as imessageMessageActions } from "./actions-CZHoxlpi.mjs";
5
+ import { i as createIMessageSetupWizardProxy, s as imessageSetupContract } from "./setup-core-BHyLkAEJ.mjs";
6
+ import { n as createIMessageConversationBindingManagerV2 } from "./conversation-bindings-DR-dbHjs.mjs";
7
+ import { n as sanitizeIMessageFinalOutboundText, r as sanitizeOutboundText } from "./sanitize-outbound-BtEY324R.mjs";
8
8
  import { t as IMessageChannelConfigSchema } from "./config-schema-DXwa_3V5.mjs";
9
9
  import { n as resolveIMessageAttachmentRoots, r as resolveIMessageRemoteAttachmentRoots } from "./media-contract-BwWs5PM7.mjs";
10
10
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -21,8 +21,8 @@ import { chunkMarkdownText } from "openclaw/plugin-sdk/reply-runtime";
21
21
  import { buildOutboundBaseSessionKey, normalizeAccountId, parseAgentSessionKey } from "openclaw/plugin-sdk/routing";
22
22
  import { collectStatusIssuesFromLastError, createComputedAccountStatusAdapter, createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers";
23
23
  import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
24
- import { createApproverRestrictedNativeApprovalCapabilityFromForwardingRoutes } from "openclaw/plugin-sdk/approval-delivery-runtime";
25
- import { createLazyChannelApprovalNativeRuntimeAdapter } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
24
+ import { createApproverRestrictedNativeApprovalCapabilityFromForwardingRoutesAsync } from "openclaw/plugin-sdk/approval-delivery-runtime";
25
+ import { createLazyChannelApprovalNativeRuntimeAdapterAsync } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
26
26
  import { shouldSuppressLocalNativeExecApprovalPrompt } from "openclaw/plugin-sdk/approval-native-runtime";
27
27
  import { addApprovalReactionHintToText } from "openclaw/plugin-sdk/approval-reaction-runtime";
28
28
  import { buildTypedExecApprovalPendingReplyPayload, buildTypedPluginApprovalPendingReplyPayload } from "openclaw/plugin-sdk/approval-reply-runtime";
@@ -71,7 +71,7 @@ function isIMessageApprovalTransportEnabled(params) {
71
71
  accountId: params.accountId
72
72
  }).enabled;
73
73
  }
74
- const imessageApproval = createApproverRestrictedNativeApprovalCapabilityFromForwardingRoutes({
74
+ const imessageApproval = createApproverRestrictedNativeApprovalCapabilityFromForwardingRoutesAsync({
75
75
  channel: "imessage",
76
76
  channelLabel: "iMessage",
77
77
  authorizeActorAction: (params) => imessageApprovalAuth.authorizeActorAction(params),
@@ -100,7 +100,7 @@ const imessageApproval = createApproverRestrictedNativeApprovalCapabilityFromFor
100
100
  nowMs
101
101
  }) }
102
102
  },
103
- createNativeRuntime: (routing) => createLazyChannelApprovalNativeRuntimeAdapter({
103
+ createNativeRuntime: (routing) => createLazyChannelApprovalNativeRuntimeAdapterAsync({
104
104
  capabilityBoundary: true,
105
105
  eventKinds: [
106
106
  "exec",
@@ -112,13 +112,13 @@ const imessageApproval = createApproverRestrictedNativeApprovalCapabilityFromFor
112
112
  accountId,
113
113
  nativeSessionOnly: true
114
114
  }),
115
- shouldHandle: ({ cfg, accountId, context, approvalKind, request }) => Boolean(context) && routing.shouldHandleApprovalRequest({
115
+ shouldHandle: async ({ cfg, accountId, context, approvalKind, request }) => Boolean(context) && routing.shouldHandleApprovalRequest({
116
116
  cfg,
117
117
  accountId,
118
118
  approvalKind,
119
119
  request
120
120
  }),
121
- load: async () => (await import("./approval-handler.runtime-Dc3KzakG.mjs")).imessageApprovalNativeRuntime
121
+ load: async () => (await import("./approval-handler.runtime-jO19jL0F.mjs")).imessageApprovalNativeRuntime
122
122
  })
123
123
  });
124
124
  const imessageApprovalRouting = imessageApproval.routing;
@@ -287,7 +287,7 @@ function resolveIMessageGroupSystemPrompt(params) {
287
287
  //#endregion
288
288
  //#region extensions/imessage/src/shared.ts
289
289
  const IMESSAGE_CHANNEL = "imessage";
290
- const imessageSetupWizard = createIMessageSetupWizardProxy(async () => (await import("./setup-surface-BMWS7VuY.mjs")).imessageSetupWizard);
290
+ const imessageSetupWizard = createIMessageSetupWizardProxy(async () => (await import("./setup-surface-DPqiLGy0.mjs")).imessageSetupWizard);
291
291
  const imessageConfigAdapter = createScopedChannelConfigAdapter({
292
292
  sectionKey: IMESSAGE_CHANNEL,
293
293
  listAccountIds: listIMessageAccountIds,
@@ -371,7 +371,7 @@ function createIMessagePluginBase(params) {
371
371
  }
372
372
  //#endregion
373
373
  //#region extensions/imessage/src/channel.ts
374
- const loadIMessageChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-DrLDEY4R.mjs"));
374
+ const loadIMessageChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-Cx_lRd-J.mjs"));
375
375
  async function sendIMessageOutbound(ctx, kind, options = {}) {
376
376
  return await (await loadIMessageChannelRuntime()).sendIMessageOutbound({
377
377
  cfg: ctx.cfg,
@@ -407,8 +407,8 @@ function toIMessageMessageSendResult(result, kind, replyToId) {
407
407
  ...result.meta && Object.keys(result.meta).length > 0 ? { meta: result.meta } : {}
408
408
  };
409
409
  }
410
- const loadIMessageApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-JvzJCJ4a.mjs").then((n) => n.t));
411
- const loadIMessageQuestionReactionsModule = createLazyRuntimeModule(() => import("./question-reactions-9jrqVZgE.mjs").then((n) => n.r));
410
+ const loadIMessageApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-DFgEJMz2.mjs").then((n) => n.t));
411
+ const loadIMessageQuestionReactionsModule = createLazyRuntimeModule(() => import("./question-reactions-BUSvdHlF.mjs").then((n) => n.r));
412
412
  const imessageMessageAdapter = defineChannelMessageAdapter({
413
413
  id: "imessage",
414
414
  durableFinal: { capabilities: {
@@ -507,7 +507,7 @@ const imessagePlugin = createChatChannelPlugin({
507
507
  conversationBindings: {
508
508
  supportsCurrentConversationBinding: true,
509
509
  bindingStore: "adapter",
510
- createManager: ({ cfg, accountId }) => createIMessageConversationBindingManager({
510
+ createManager: ({ cfg, accountId }) => createIMessageConversationBindingManagerV2({
511
511
  cfg,
512
512
  accountId: accountId ?? void 0
513
513
  })
@@ -577,7 +577,7 @@ const imessagePlugin = createChatChannelPlugin({
577
577
  gateway: {
578
578
  apiVersion: 2,
579
579
  startAccount: async (ctx) => {
580
- const conversationBindings = createIMessageConversationBindingManager({
580
+ const conversationBindings = createIMessageConversationBindingManagerV2({
581
581
  cfg: ctx.cfg,
582
582
  accountId: ctx.accountId
583
583
  });