@openclaw/imessage 2026.10.10-beta.5 → 2026.11.5-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 (142) hide show
  1. package/dist/.setup/{accounts-DacCvDBt.mjs → accounts-C1Ypv3Wn.mjs} +9 -13
  2. package/dist/.setup/{actions-762Azi-J.mjs → actions-qOuKy8To.mjs} +364 -116
  3. package/dist/.setup/{actions.runtime-DHiRiPHe.mjs → actions.runtime-Ccg9CARL.mjs} +12 -61
  4. package/dist/.setup/{api-Deyo8NDs.mjs → api-BXXuQQCS.mjs} +8 -9
  5. package/dist/.setup/{api-BFGXDHiC.mjs → api-DTbxSOPc.mjs} +9 -9
  6. package/dist/.setup/{approval-handler.runtime-fsSBf2jf.mjs → approval-handler.runtime-B6vrFfZx.mjs} +113 -133
  7. package/dist/.setup/{approval-reactions-CoAkCiwf.mjs → approval-reactions-DBBsqbRC.mjs} +156 -79
  8. package/dist/.setup/{channel-C61YdcZR.mjs → channel-CLaN4mQn.mjs} +151 -137
  9. package/dist/.setup/{channel.runtime-B5jle0g3.mjs → channel.runtime-XJGx1MIH.mjs} +236 -425
  10. package/dist/.setup/chat-context-fTfJVqAi.mjs +77 -0
  11. package/dist/.setup/chat-lookup-xtPsOBkl.mjs +50 -0
  12. package/dist/.setup/client-D_BaG8sC.mjs +367 -0
  13. package/dist/.setup/{config-schema-DXwa_3V5.mjs → config-schema-BjkQV5P5.mjs} +1 -4
  14. package/dist/.setup/{conversation-bindings-DR-dbHjs.mjs → conversation-bindings-8DjxoIYU.mjs} +10 -8
  15. package/dist/.setup/{media-contract-BwWs5PM7.mjs → media-contract-BErFBKV9.mjs} +2 -3
  16. package/dist/.setup/{message-tool-api-B5NfPnFL.mjs → message-tool-api-DtZ1wKbT.mjs} +6 -12
  17. package/dist/.setup/{outbound-send-deps-B-QEsLSM.mjs → outbound-send-deps-_da8jqeo.mjs} +1 -2
  18. package/dist/.setup/{remote-file-B94a787O.mjs → remote-file-DpK3GQFD.mjs} +12 -30
  19. package/dist/.setup/{rolldown-runtime-BBjsoOtd.mjs → rolldown-runtime-782esTHO.mjs} +1 -2
  20. package/dist/.setup/{sanitize-outbound-BtEY324R.mjs → sanitize-outbound-Dhjhz0a-.mjs} +25 -31
  21. package/dist/.setup/{send-BvxKNWzF.mjs → send-DhEW0gfe.mjs} +155 -236
  22. package/dist/.setup/{setup-core-BHyLkAEJ.mjs → setup-core-B1_P_t4T.mjs} +3 -4
  23. package/dist/.setup/{setup-surface-DPqiLGy0.mjs → setup-surface-CD28mXWK.mjs} +13 -29
  24. package/dist/.setup/{targets-B4oU7n-v.mjs → targets-C7CIWJ0k.mjs} +15 -9
  25. package/dist/.source-module-urls/929c518fa2986b0f85f66bceefead22868db0ab452dee914dc6a2bb86b2e60ad.json +1 -1
  26. package/dist/api.js +9 -9
  27. package/dist/channel-config-api.js +1 -1
  28. package/dist/channel-plugin-api.js +1 -1
  29. package/dist/contract-api.js +1 -1
  30. package/dist/doctor-contract-api.js +7 -13
  31. package/dist/index.js +1 -2
  32. package/dist/media-contract-api.js +1 -1
  33. package/dist/message-tool-api.js +1 -1
  34. package/dist/runtime-api.js +1 -3
  35. package/dist/secret-contract-api.js +1 -2
  36. package/dist/session-binding-contract-api.js +1 -1
  37. package/dist/setup-entry.js +2 -3
  38. package/dist/src/chat-db.worker.js +2 -3
  39. package/node_modules/typebox/build/format/duration.d.mts +2 -2
  40. package/node_modules/typebox/build/format/duration.mjs +2 -2
  41. package/node_modules/typebox/build/format/idn_email.d.mts +1 -0
  42. package/node_modules/typebox/build/format/idn_email.mjs +1 -0
  43. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
  44. package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
  45. package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
  46. package/node_modules/typebox/build/format/ipv4.mjs +2 -2
  47. package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
  48. package/node_modules/typebox/build/format/ipv6.mjs +1 -1
  49. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
  50. package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
  51. package/node_modules/typebox/build/schema/build.mjs +1 -0
  52. package/node_modules/typebox/build/schema/engine/_unique.d.mts +4 -2
  53. package/node_modules/typebox/build/schema/engine/_unique.mjs +7 -3
  54. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
  55. package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +0 -3
  56. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +15 -17
  57. package/node_modules/typebox/build/schema/engine/contains.mjs +3 -3
  58. package/node_modules/typebox/build/schema/engine/index.d.mts +1 -0
  59. package/node_modules/typebox/build/schema/engine/index.mjs +1 -0
  60. package/node_modules/typebox/build/schema/engine/items.mjs +7 -4
  61. package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -2
  62. package/node_modules/typebox/build/schema/engine/minContains.mjs +3 -3
  63. package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
  64. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +2 -2
  65. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -2
  66. package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
  67. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
  68. package/node_modules/typebox/build/system/hashing/hash.mjs +63 -34
  69. package/node_modules/typebox/build/system/locale/en_US.mjs +2 -1
  70. package/node_modules/typebox/build/system/memory/assign.d.mts +2 -8
  71. package/node_modules/typebox/build/system/memory/assign.mjs +13 -6
  72. package/node_modules/typebox/build/system/memory/clone.d.mts +4 -5
  73. package/node_modules/typebox/build/system/memory/clone.mjs +8 -96
  74. package/node_modules/typebox/build/system/memory/create.d.mts +1 -5
  75. package/node_modules/typebox/build/system/memory/create.mjs +18 -13
  76. package/node_modules/typebox/build/system/memory/deep.d.mts +2 -0
  77. package/node_modules/typebox/build/system/memory/deep.mjs +108 -0
  78. package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
  79. package/node_modules/typebox/build/system/memory/discard.mjs +9 -8
  80. package/node_modules/typebox/build/system/memory/finalize.d.mts +4 -0
  81. package/node_modules/typebox/build/system/memory/finalize.mjs +30 -0
  82. package/node_modules/typebox/build/system/memory/keys.d.mts +2 -0
  83. package/node_modules/typebox/build/system/memory/keys.mjs +8 -0
  84. package/node_modules/typebox/build/system/memory/update.d.mts +1 -4
  85. package/node_modules/typebox/build/system/memory/update.mjs +43 -16
  86. package/node_modules/typebox/build/type/engine/call/index.d.mts +1 -0
  87. package/node_modules/typebox/build/type/engine/call/index.mjs +1 -0
  88. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +2 -24
  89. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +2 -29
  90. package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +1 -0
  91. package/node_modules/typebox/build/type/engine/evaluate/index.mjs +1 -0
  92. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -1
  93. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +6 -1
  94. package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +30 -0
  95. package/node_modules/typebox/build/type/engine/evaluate/property.mjs +29 -0
  96. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +1 -3
  97. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +1 -4
  98. package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
  99. package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
  100. package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
  101. package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  102. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +1 -3
  103. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +1 -4
  104. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +1 -3
  105. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +1 -4
  106. package/node_modules/typebox/build/type/engine/this/index.d.mts +1 -0
  107. package/node_modules/typebox/build/type/engine/this/index.mjs +1 -0
  108. package/node_modules/typebox/build/value/clone/clone.d.mts +4 -3
  109. package/node_modules/typebox/build/value/clone/clone.mjs +5 -7
  110. package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +2 -0
  111. package/node_modules/typebox/build/value/repair/from_cyclic.mjs +6 -0
  112. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +25 -14
  113. package/node_modules/typebox/package.json +1 -1
  114. package/node_modules/typebox/readme.md +1 -1
  115. package/node_modules/zod/package.json +1 -1
  116. package/node_modules/zod/src/v4/classic/tests/array.test.ts +27 -0
  117. package/node_modules/zod/src/v4/classic/tests/map.test.ts +7 -0
  118. package/node_modules/zod/src/v4/classic/tests/set.test.ts +6 -0
  119. package/node_modules/zod/src/v4/core/compile.ts +9 -0
  120. package/node_modules/zod/src/v4/core/schemas.ts +35 -1
  121. package/node_modules/zod/src/v4/core/util.ts +13 -0
  122. package/node_modules/zod/src/v4/core/versions.ts +1 -1
  123. package/node_modules/zod/v4/core/compile.cjs +8 -0
  124. package/node_modules/zod/v4/core/compile.js +8 -0
  125. package/node_modules/zod/v4/core/schemas.cjs +30 -0
  126. package/node_modules/zod/v4/core/schemas.d.cts +3 -1
  127. package/node_modules/zod/v4/core/schemas.d.ts +3 -1
  128. package/node_modules/zod/v4/core/schemas.js +30 -0
  129. package/node_modules/zod/v4/core/util.cjs +15 -0
  130. package/node_modules/zod/v4/core/util.d.cts +2 -0
  131. package/node_modules/zod/v4/core/util.d.ts +2 -0
  132. package/node_modules/zod/v4/core/util.js +14 -0
  133. package/node_modules/zod/v4/core/versions.cjs +1 -1
  134. package/node_modules/zod/v4/core/versions.js +1 -1
  135. package/openclaw.plugin.json +0 -30
  136. package/package.json +6 -6
  137. package/dist/.setup/client-CcROCvRq.mjs +0 -746
  138. package/dist/.setup/question-reactions-BD06B1Lx.mjs +0 -68
  139. package/dist/.setup/reaction-context-Q26DYzQH.mjs +0 -106
  140. package/dist/.setup/runtime-Cza4CY5T.mjs +0 -8
  141. package/node_modules/typebox/build/system/memory/freeze.d.mts +0 -4
  142. package/node_modules/typebox/build/system/memory/freeze.mjs +0 -6
@@ -1,22 +1,22 @@
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
- import { a as resolveDefaultIMessageAccountId, i as listIMessageAccountIds, o as resolveIMessageAccount, t as collectIMessageDuplicateAccountSourceWarnings } from "./accounts-DacCvDBt.mjs";
3
- import { S as resolveIMessageDirectChatService } from "./client-CcROCvRq.mjs";
4
- import { t as imessageMessageActions } from "./actions-762Azi-J.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
- import { t as IMessageChannelConfigSchema } from "./config-schema-DXwa_3V5.mjs";
9
- import { n as resolveIMessageAttachmentRoots, r as resolveIMessageRemoteAttachmentRoots } from "./media-contract-BwWs5PM7.mjs";
1
+ import { f as normalizeIMessageMessagingTarget, l as parseIMessageTarget, o as looksLikeIMessageExplicitTargetId, p as isIMessagePhoneLikeHandle, r as inferIMessageTargetChatType, s as normalizeIMessageHandle } from "./targets-C7CIWJ0k.mjs";
2
+ import { a as resolveDefaultIMessageAccountId, i as listIMessageAccountIds, o as resolveIMessageAccount, t as collectIMessageDuplicateAccountSourceWarnings } from "./accounts-C1Ypv3Wn.mjs";
3
+ import { a as resolveIMessageDirectChatService, r as normalizeDirectChatIdentifier } from "./chat-context-fTfJVqAi.mjs";
4
+ import { t as imessageMessageActions } from "./actions-qOuKy8To.mjs";
5
+ import { i as createIMessageSetupWizardProxy, s as imessageSetupContract } from "./setup-core-B1_P_t4T.mjs";
6
+ import { n as createIMessageConversationBindingManagerV2 } from "./conversation-bindings-8DjxoIYU.mjs";
7
+ import { n as sanitizeIMessageFinalOutboundText, r as sanitizeOutboundText } from "./sanitize-outbound-Dhjhz0a-.mjs";
8
+ import { t as IMessageChannelConfigSchema } from "./config-schema-BjkQV5P5.mjs";
9
+ import { n as resolveIMessageAttachmentRoots, r as resolveIMessageRemoteAttachmentRoots } from "./media-contract-BErFBKV9.mjs";
10
10
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
11
11
  import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
12
12
  import { buildDmGroupAccountAllowlistAdapter } from "openclaw/plugin-sdk/allowlist-config-edit";
13
13
  import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter, formatTrimmedAllowFromEntries } from "openclaw/plugin-sdk/channel-config-helpers";
14
14
  import { createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
15
15
  import { createMessageReceiptFromOutboundResults, defineChannelMessageAdapter, sanitizeForPlainText } from "openclaw/plugin-sdk/channel-outbound";
16
+ import { buildChannelGroupsScopeTree, createRestrictSendersChannelSecurity, resolveChannelGroupPolicy, resolveScopeRequireMention, resolveScopeToolsPolicy } from "openclaw/plugin-sdk/channel-policy";
16
17
  import { PAIRING_APPROVED_MESSAGE } from "openclaw/plugin-sdk/channel-status";
17
18
  import { buildPassiveProbedChannelStatusSummary } from "openclaw/plugin-sdk/extension-shared";
18
19
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
19
- import { questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
20
20
  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";
@@ -28,9 +28,8 @@ import { addApprovalReactionHintToText } from "openclaw/plugin-sdk/approval-reac
28
28
  import { buildTypedExecApprovalPendingReplyPayload, buildTypedPluginApprovalPendingReplyPayload } from "openclaw/plugin-sdk/approval-reply-runtime";
29
29
  import { getExecApprovalReplyMetadata, resolveExecApprovalCommandDisplay, resolveExecApprovalRequestAllowedDecisions } from "openclaw/plugin-sdk/approval-runtime";
30
30
  import { createChannelApprovalAuth } from "openclaw/plugin-sdk/approval-auth-runtime";
31
- import { buildChannelGroupsScopeTree, createRestrictSendersChannelSecurity, resolveScopeRequireMention, resolveScopeToolsPolicy } from "openclaw/plugin-sdk/channel-policy";
32
31
  import { createChannelPluginBase, getChatChannelMeta } from "openclaw/plugin-sdk/core";
33
- //#region extensions/imessage/src/approval-auth.ts
32
+ // extensions/imessage/src/approval-auth.ts
34
33
  function normalizeIMessageApproverId(value) {
35
34
  const normalized = normalizeIMessageHandle(String(value));
36
35
  if (!normalized || normalized.startsWith("chat_id:") || normalized.startsWith("chat_guid:") || normalized.startsWith("chat_identifier:")) return;
@@ -53,13 +52,11 @@ const imessageApproval$1 = createChannelApprovalAuth({
53
52
  });
54
53
  const getIMessageApprovalApprovers = imessageApproval$1.resolveApprovers;
55
54
  const imessageApprovalAuth = imessageApproval$1.approvalAuth;
56
- //#endregion
57
- //#region extensions/imessage/src/approval-text.ts
55
+ // extensions/imessage/src/approval-text.ts
58
56
  function replaceApprovalIdPlaceholder(text, approvalId) {
59
57
  return (text ?? "").replace(/\/approve\s+<id>/g, () => `/approve ${approvalId}`);
60
58
  }
61
- //#endregion
62
- //#region extensions/imessage/src/approval-native.ts
59
+ // extensions/imessage/src/approval-native.ts
63
60
  const DEFAULT_PLUGIN_APPROVAL_DECISIONS = [
64
61
  "allow-once",
65
62
  "allow-always",
@@ -71,6 +68,13 @@ function isIMessageApprovalTransportEnabled(params) {
71
68
  accountId: params.accountId
72
69
  }).enabled;
73
70
  }
71
+ function isDirectHandleTarget(to) {
72
+ try {
73
+ return parseIMessageTarget(to).kind === "handle";
74
+ } catch {
75
+ return false;
76
+ }
77
+ }
74
78
  const imessageApproval = createApproverRestrictedNativeApprovalCapabilityFromForwardingRoutesAsync({
75
79
  channel: "imessage",
76
80
  channelLabel: "iMessage",
@@ -82,7 +86,7 @@ const imessageApproval = createApproverRestrictedNativeApprovalCapabilityFromFor
82
86
  resolveDefaultAccountId: resolveDefaultIMessageAccountId,
83
87
  normalizeTo: normalizeIMessageMessagingTarget,
84
88
  resolveApprovers: getIMessageApprovalApprovers,
85
- isOriginTargetAllowed: ({ cfg, accountId, target }) => inferIMessageTargetChatType(target.to) !== "group" || getIMessageApprovalApprovers({
89
+ isOriginTargetAllowed: ({ cfg, accountId, target }) => isDirectHandleTarget(target.to) || getIMessageApprovalApprovers({
86
90
  cfg,
87
91
  accountId
88
92
  }).length > 0
@@ -91,14 +95,50 @@ const imessageApproval = createApproverRestrictedNativeApprovalCapabilityFromFor
91
95
  return `iMessage supports native exec approvals for this account when \`approvals.exec.enabled\` is true and the route allows iMessage. Keep the macOS imsg bridge running and configure \`${accountId && accountId !== "default" ? `channels.imessage.accounts.${accountId}` : "channels.imessage"}.allowFrom\` to restrict approvers.`;
92
96
  },
93
97
  render: {
94
- exec: { buildPendingPayload: ({ request, nowMs }) => buildIMessageExecPendingPayload({
95
- request,
96
- nowMs
97
- }) },
98
- plugin: { buildPendingPayload: ({ request, nowMs }) => buildIMessagePluginPendingPayload({
99
- request,
100
- nowMs
101
- }) }
98
+ exec: { buildPendingPayload: ({ request, nowMs }) => {
99
+ const allowedDecisions = resolveExecApprovalRequestAllowedDecisions(request.request);
100
+ const command = resolveExecApprovalCommandDisplay(request.request).commandText;
101
+ const payload = buildTypedExecApprovalPendingReplyPayload({
102
+ approvalId: request.id,
103
+ approvalSlug: request.id.slice(0, 8),
104
+ approvalCommandId: request.id,
105
+ warningText: request.request.warningText ?? void 0,
106
+ ask: request.request.ask ?? null,
107
+ agentId: request.request.agentId ?? null,
108
+ allowedDecisions,
109
+ command,
110
+ cwd: request.request.cwd ?? void 0,
111
+ host: request.request.host === "node" ? "node" : "gateway",
112
+ nodeId: request.request.nodeId ?? void 0,
113
+ scope: request.request.scope ?? void 0,
114
+ sessionKey: request.request.sessionKey ?? null,
115
+ expiresAtMs: request.expiresAtMs,
116
+ nowMs
117
+ });
118
+ return {
119
+ ...payload,
120
+ text: addApprovalReactionHintToText({
121
+ text: replaceApprovalIdPlaceholder(payload.text, request.id),
122
+ allowedDecisions
123
+ })
124
+ };
125
+ } },
126
+ plugin: { buildPendingPayload: ({ request, nowMs }) => {
127
+ const configuredDecisions = request.request.allowedDecisions;
128
+ const allowedDecisions = configuredDecisions && configuredDecisions.length > 0 ? configuredDecisions : DEFAULT_PLUGIN_APPROVAL_DECISIONS;
129
+ const payload = buildTypedPluginApprovalPendingReplyPayload({
130
+ request,
131
+ nowMs,
132
+ allowedDecisions
133
+ });
134
+ return {
135
+ ...payload,
136
+ text: addApprovalReactionHintToText({
137
+ text: replaceApprovalIdPlaceholder(payload.text, request.id),
138
+ allowedDecisions
139
+ })
140
+ };
141
+ } }
102
142
  },
103
143
  createNativeRuntime: (routing) => createLazyChannelApprovalNativeRuntimeAdapterAsync({
104
144
  capabilityBoundary: true,
@@ -118,7 +158,7 @@ const imessageApproval = createApproverRestrictedNativeApprovalCapabilityFromFor
118
158
  approvalKind,
119
159
  request
120
160
  }),
121
- load: async () => (await import("./approval-handler.runtime-fsSBf2jf.mjs")).imessageApprovalNativeRuntime
161
+ load: async () => (await import("./approval-handler.runtime-B6vrFfZx.mjs")).imessageApprovalNativeRuntime
122
162
  })
123
163
  });
124
164
  const imessageApprovalRouting = imessageApproval.routing;
@@ -141,7 +181,7 @@ function resolveIMessageSessionTargetFromSessionKey(sessionKey) {
141
181
  } : null;
142
182
  }
143
183
  const to = normalizeIMessageMessagingTarget(route);
144
- if (!to || inferIMessageTargetChatType(to) !== "direct") return null;
184
+ if (!to || !isDirectHandleTarget(to)) return null;
145
185
  return { to };
146
186
  }
147
187
  function shouldSuppressLocalIMessageExecApprovalPrompt(params) {
@@ -154,7 +194,7 @@ function shouldSuppressLocalIMessageExecApprovalPrompt(params) {
154
194
  accountId
155
195
  }).length > 0) return true;
156
196
  const sessionTarget = resolveIMessageSessionTargetFromSessionKey(metadata.sessionKey);
157
- if (!sessionTarget || inferIMessageTargetChatType(sessionTarget.to) !== "direct") return false;
197
+ if (!sessionTarget || !isDirectHandleTarget(sessionTarget.to)) return false;
158
198
  const targetAccountId = normalizeOptionalString(sessionTarget.accountId);
159
199
  return !targetAccountId || !accountId || normalizeAccountId(targetAccountId) === normalizeAccountId(accountId);
160
200
  }
@@ -172,53 +212,8 @@ function shouldSuppressLocalIMessageExecApprovalPrompt(params) {
172
212
  nativeSessionOnly: true
173
213
  });
174
214
  }
175
- function buildIMessageExecPendingPayload(params) {
176
- const allowedDecisions = resolveExecApprovalRequestAllowedDecisions(params.request.request);
177
- const command = resolveExecApprovalCommandDisplay(params.request.request).commandText;
178
- const payload = buildTypedExecApprovalPendingReplyPayload({
179
- approvalId: params.request.id,
180
- approvalSlug: params.request.id.slice(0, 8),
181
- approvalCommandId: params.request.id,
182
- warningText: params.request.request.warningText ?? void 0,
183
- ask: params.request.request.ask ?? null,
184
- agentId: params.request.request.agentId ?? null,
185
- allowedDecisions,
186
- command,
187
- cwd: params.request.request.cwd ?? void 0,
188
- host: params.request.request.host === "node" ? "node" : "gateway",
189
- nodeId: params.request.request.nodeId ?? void 0,
190
- scope: params.request.request.scope ?? void 0,
191
- sessionKey: params.request.request.sessionKey ?? null,
192
- expiresAtMs: params.request.expiresAtMs,
193
- nowMs: params.nowMs
194
- });
195
- return {
196
- ...payload,
197
- text: addApprovalReactionHintToText({
198
- text: replaceApprovalIdPlaceholder(payload.text, params.request.id),
199
- allowedDecisions
200
- })
201
- };
202
- }
203
- function buildIMessagePluginPendingPayload(params) {
204
- const configuredDecisions = params.request.request.allowedDecisions;
205
- const allowedDecisions = configuredDecisions && configuredDecisions.length > 0 ? configuredDecisions : DEFAULT_PLUGIN_APPROVAL_DECISIONS;
206
- const payload = buildTypedPluginApprovalPendingReplyPayload({
207
- request: params.request,
208
- nowMs: params.nowMs,
209
- allowedDecisions
210
- });
211
- return {
212
- ...payload,
213
- text: addApprovalReactionHintToText({
214
- text: replaceApprovalIdPlaceholder(payload.text, params.request.id),
215
- allowedDecisions
216
- })
217
- };
218
- }
219
215
  const imessageApprovalCapability = imessageApproval.capability;
220
- //#endregion
221
- //#region extensions/imessage/src/conversation-id-core.ts
216
+ // extensions/imessage/src/conversation-id-core.ts
222
217
  function normalizeIMessageAcpConversationId(conversationId) {
223
218
  const trimmed = conversationId.trim();
224
219
  if (!trimmed) return null;
@@ -249,20 +244,17 @@ function matchIMessageAcpConversation(params) {
249
244
  function resolveIMessageConversationIdFromTarget(target) {
250
245
  return normalizeIMessageAcpConversationId(target)?.conversationId;
251
246
  }
252
- //#endregion
253
- //#region extensions/imessage/src/conversation-id.ts
247
+ // extensions/imessage/src/conversation-id.ts
254
248
  function resolveIMessageInboundConversationId(params) {
255
249
  if (params.isGroup) return params.chatId != null && Number.isFinite(params.chatId) ? String(params.chatId) : void 0;
256
250
  return normalizeIMessageHandle(params.sender) || void 0;
257
251
  }
258
- //#endregion
259
- //#region extensions/imessage/src/doctor.ts
252
+ // extensions/imessage/src/doctor.ts
260
253
  const imessageDoctor = {
261
254
  groupAllowFromFallbackToAllowFrom: false,
262
255
  collectPreviewWarnings: ({ cfg }) => collectIMessageDuplicateAccountSourceWarnings({ cfg })
263
256
  };
264
- //#endregion
265
- //#region extensions/imessage/src/group-policy.ts
257
+ // extensions/imessage/src/group-policy.ts
266
258
  function resolveScopePath(params) {
267
259
  return params.groupId ? [params.groupId] : [];
268
260
  }
@@ -284,10 +276,9 @@ function resolveIMessageGroupSystemPrompt(params) {
284
276
  const prompt = params.groupConfig?.systemPrompt ?? params.defaultConfig?.systemPrompt;
285
277
  return typeof prompt === "string" ? prompt.trim() || void 0 : void 0;
286
278
  }
287
- //#endregion
288
- //#region extensions/imessage/src/shared.ts
279
+ // extensions/imessage/src/shared.ts
289
280
  const IMESSAGE_CHANNEL = "imessage";
290
- const imessageSetupWizard = createIMessageSetupWizardProxy(async () => (await import("./setup-surface-DPqiLGy0.mjs")).imessageSetupWizard);
281
+ const imessageSetupWizard = createIMessageSetupWizardProxy(async () => (await import("./setup-surface-CD28mXWK.mjs")).imessageSetupWizard);
291
282
  const imessageConfigAdapter = createScopedChannelConfigAdapter({
292
283
  sectionKey: IMESSAGE_CHANNEL,
293
284
  listAccountIds: listIMessageAccountIds,
@@ -369,9 +360,9 @@ function createIMessagePluginBase(params) {
369
360
  }
370
361
  };
371
362
  }
372
- //#endregion
373
- //#region extensions/imessage/src/channel.ts
374
- const loadIMessageChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-B5jle0g3.mjs"));
363
+ // extensions/imessage/src/channel.ts
364
+ const loadIMessageChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-XJGx1MIH.mjs"));
365
+ const loadIMessageChatLookup = createLazyRuntimeModule(() => import("./chat-lookup-xtPsOBkl.mjs"));
375
366
  async function sendIMessageOutbound(ctx, kind, options = {}) {
376
367
  return await (await loadIMessageChannelRuntime()).sendIMessageOutbound({
377
368
  cfg: ctx.cfg,
@@ -407,8 +398,7 @@ function toIMessageMessageSendResult(result, kind, replyToId) {
407
398
  ...result.meta && Object.keys(result.meta).length > 0 ? { meta: result.meta } : {}
408
399
  };
409
400
  }
410
- const loadIMessageApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-CoAkCiwf.mjs").then((n) => n.t));
411
- const loadIMessageQuestionReactionsModule = createLazyRuntimeModule(() => import("./question-reactions-BD06B1Lx.mjs").then((n) => n.r));
401
+ const loadIMessageApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-DBBsqbRC.mjs").then((n) => n.t));
412
402
  const imessageMessageAdapter = defineChannelMessageAdapter({
413
403
  id: "imessage",
414
404
  durableFinal: { capabilities: {
@@ -437,50 +427,60 @@ function isCanonicalIMessageDirectHandle(raw, normalized) {
437
427
  if (normalized.startsWith("+")) return isIMessagePhoneLikeHandle(trimmed);
438
428
  return /^[^\s@<>()[\]`]+@[^\s@<>()[\]`]+\.[^\s@<>()[\]`]+$/.test(trimmed);
439
429
  }
440
- function resolveIMessageOutboundSessionRoute(params) {
441
- const parsed = parseIMessageTarget(params.target);
442
- let peer;
443
- let from;
444
- let to;
445
- let recipientSessionExact = false;
446
- if (parsed.kind === "handle") {
447
- const handle = normalizeIMessageHandle(parsed.to);
448
- if (!handle) return null;
449
- const account = resolveIMessageAccount({
450
- cfg: params.cfg,
451
- accountId: params.accountId
430
+ async function resolveIMessageConversationTarget(params) {
431
+ let parsed = parseIMessageTarget(params.target);
432
+ const account = resolveIMessageAccount({
433
+ cfg: params.cfg,
434
+ accountId: params.accountId
435
+ });
436
+ const deliveryTarget = parsed.kind === "handle" ? void 0 : params.target;
437
+ if (parsed.kind !== "handle") {
438
+ const chat = await (await loadIMessageChatLookup()).resolveIMessageChat({
439
+ target: parsed,
440
+ options: {
441
+ cliPath: account.config.cliPath?.trim() || "imsg",
442
+ dbPath: account.config.dbPath,
443
+ remoteHost: account.config.remoteHost
444
+ },
445
+ conversationReadOrigin: "delegated"
452
446
  });
453
- from = to = `${resolveIMessageDirectChatService(parsed.serviceExplicit ? parsed.service : account.config.service) ?? "auto"}:${handle}`;
454
- peer = {
455
- kind: "direct",
456
- id: handle
447
+ if (!chat) return null;
448
+ const chatType = resolveChannelGroupPolicy({
449
+ cfg: params.cfg,
450
+ channel: "imessage",
451
+ accountId: account.accountId,
452
+ groupId: String(chat.id)
453
+ }).groupConfig ? "group" : inferIMessageTargetChatType(`chat_guid:${chat.guid}`);
454
+ if (!chatType) return null;
455
+ if (chatType === "group") return {
456
+ accountId: account.accountId,
457
+ peer: {
458
+ kind: "group",
459
+ id: String(chat.id)
460
+ },
461
+ from: `imessage:group:${chat.id}`,
462
+ to: params.target,
463
+ recipientSessionExact: false
457
464
  };
458
- recipientSessionExact = isCanonicalIMessageDirectHandle(parsed.to, handle);
459
- } else {
460
- const peerId = parsed.kind === "chat_id" ? String(parsed.chatId) : parsed.kind === "chat_guid" ? parsed.chatGuid : parsed.chatIdentifier;
461
- if (!peerId) return null;
462
- peer = {
463
- kind: "group",
464
- id: peerId
465
+ parsed = {
466
+ kind: "handle",
467
+ to: normalizeDirectChatIdentifier(chat.guid),
468
+ service: resolveIMessageDirectChatService(account.config.service, chat.guid) ?? "auto",
469
+ serviceExplicit: true
465
470
  };
466
- from = `imessage:group:${peerId}`;
467
- to = `${parsed.kind}:${peerId}`;
468
471
  }
469
- const baseSessionKey = buildOutboundBaseSessionKey({
470
- cfg: params.cfg,
471
- channel: "imessage",
472
- agentId: params.agentId,
473
- accountId: params.accountId,
474
- peer
475
- });
472
+ const handle = normalizeIMessageHandle(parsed.to);
473
+ if (!handle) return null;
474
+ const from = `${resolveIMessageDirectChatService(parsed.serviceExplicit ? parsed.service : account.config.service) ?? "auto"}:${handle}`;
476
475
  return {
477
- sessionKey: baseSessionKey,
478
- baseSessionKey,
479
- recipientSessionExact,
480
- peer,
481
- chatType: peer.kind,
476
+ accountId: account.accountId,
477
+ peer: {
478
+ kind: "direct",
479
+ id: handle
480
+ },
482
481
  from,
483
- to
482
+ to: deliveryTarget ?? from,
483
+ recipientSessionExact: isCanonicalIMessageDirectHandle(parsed.to, handle)
484
484
  };
485
485
  }
486
486
  const imessagePlugin = createChatChannelPlugin({
@@ -526,20 +526,40 @@ const imessagePlugin = createChatChannelPlugin({
526
526
  messaging: {
527
527
  normalizeTarget: normalizeIMessageMessagingTarget,
528
528
  inferTargetChatType: ({ to }) => inferIMessageTargetChatType(to),
529
- resolveOutboundSessionRoute: resolveIMessageOutboundSessionRoute,
529
+ resolveOutboundSessionRoute: async (params) => {
530
+ const target = await resolveIMessageConversationTarget(params);
531
+ if (!target) return null;
532
+ const { accountId, ...route } = target;
533
+ const baseSessionKey = buildOutboundBaseSessionKey({
534
+ ...params,
535
+ accountId,
536
+ channel: "imessage",
537
+ peer: route.peer
538
+ });
539
+ return {
540
+ sessionKey: baseSessionKey,
541
+ baseSessionKey,
542
+ ...route,
543
+ chatType: route.peer.kind
544
+ };
545
+ },
530
546
  targetResolver: {
531
547
  looksLikeId: looksLikeIMessageExplicitTargetId,
532
548
  hint: "<phone|email|chat_id:ID|auto:contact|imessage:contact|sms:contact>",
533
- resolveTarget: async ({ input }) => {
549
+ resolveTarget: async ({ cfg, accountId, input }) => {
534
550
  const to = normalizeIMessageMessagingTarget(input);
535
551
  if (!to) return null;
536
- const chatType = inferIMessageTargetChatType(to);
537
- if (!chatType) return null;
552
+ const target = await resolveIMessageConversationTarget({
553
+ cfg,
554
+ accountId,
555
+ target: to
556
+ });
557
+ if (!target) return null;
538
558
  const parsed = parseIMessageTarget(to);
539
559
  const display = parsed.kind === "handle" && !isCanonicalIMessageDirectHandle(parsed.to, normalizeIMessageHandle(parsed.to)) ? parsed.to.trim() : void 0;
540
560
  return {
541
561
  to,
542
- kind: chatType === "direct" ? "user" : "group",
562
+ kind: target.peer.kind === "direct" ? "user" : "group",
543
563
  ...display ? { display } : {},
544
564
  source: "normalized"
545
565
  };
@@ -638,10 +658,6 @@ const imessagePlugin = createChatChannelPlugin({
638
658
  });
639
659
  if (prepared) Object.assign(payload, prepared);
640
660
  },
641
- renderPresentation: ({ payload, presentation }) => questionGatewayRuntime.prepareReactionPayloadForDelivery({
642
- payload,
643
- presentation
644
- }),
645
661
  afterDeliverPayload: async ({ cfg, target, payload, results }) => {
646
662
  const delivery = {
647
663
  accountId: resolveIMessageAccount({
@@ -652,7 +668,6 @@ const imessagePlugin = createChatChannelPlugin({
652
668
  payload,
653
669
  results
654
670
  };
655
- (await loadIMessageQuestionReactionsModule()).registerIMessageQuestionReactionTargetForDeliveredPayload(delivery);
656
671
  await (await loadIMessageApprovalReactionsModule()).registerIMessageApprovalReactionTargetForDeliveredPayload(delivery);
657
672
  },
658
673
  deliveryCapabilities: { durableFinal: {
@@ -675,5 +690,4 @@ const imessagePlugin = createChatChannelPlugin({
675
690
  }
676
691
  }
677
692
  });
678
- //#endregion
679
693
  export { resolveIMessageGroupSystemPrompt as a, matchIMessageAcpConversation as c, getIMessageApprovalApprovers as d, imessageApprovalAuth as f, resolveIMessageGroupRequireMention as i, normalizeIMessageAcpConversationId as l, createIMessagePluginBase as n, resolveIMessageGroupToolPolicy as o, imessageSetupWizard as r, resolveIMessageInboundConversationId as s, imessagePlugin as t, resolveIMessageConversationIdFromTarget as u };