@openclaw/imessage 2026.10.10 → 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 (137) hide show
  1. package/dist/.setup/{accounts-BH0coL46.mjs → accounts-C1Ypv3Wn.mjs} +6 -7
  2. package/dist/.setup/{actions-CW7XYYF4.mjs → actions-qOuKy8To.mjs} +360 -108
  3. package/dist/.setup/{actions.runtime-B2ZHQ3TJ.mjs → actions.runtime-Ccg9CARL.mjs} +10 -56
  4. package/dist/.setup/{api-6xi-NBrt.mjs → api-BXXuQQCS.mjs} +7 -7
  5. package/dist/.setup/{api-B0ih8Iof.mjs → api-DTbxSOPc.mjs} +8 -8
  6. package/dist/.setup/{approval-handler.runtime-BKmqba3L.mjs → approval-handler.runtime-B6vrFfZx.mjs} +112 -131
  7. package/dist/.setup/{approval-reactions-B9CJS0NT.mjs → approval-reactions-DBBsqbRC.mjs} +152 -72
  8. package/dist/.setup/{channel-6kcKpSRw.mjs → channel-CLaN4mQn.mjs} +142 -119
  9. package/dist/.setup/{channel.runtime-BW4A0m4h.mjs → channel.runtime-XJGx1MIH.mjs} +205 -363
  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-DRkdRC21.mjs → config-schema-BjkQV5P5.mjs} +1 -2
  14. package/dist/.setup/{conversation-bindings-vZFn6sN2.mjs → conversation-bindings-8DjxoIYU.mjs} +9 -6
  15. package/dist/.setup/{media-contract-CoixpXRX.mjs → media-contract-BErFBKV9.mjs} +1 -1
  16. package/dist/.setup/{message-tool-api-CxSY_rh7.mjs → message-tool-api-DtZ1wKbT.mjs} +3 -6
  17. package/dist/.setup/{remote-file-CCgMYZ-u.mjs → remote-file-DpK3GQFD.mjs} +8 -22
  18. package/dist/.setup/{sanitize-outbound-C02fJrn6.mjs → sanitize-outbound-Dhjhz0a-.mjs} +23 -27
  19. package/dist/.setup/{send-D98hQFdv.mjs → send-DhEW0gfe.mjs} +150 -226
  20. package/dist/.setup/{setup-core-BWnW0czE.mjs → setup-core-B1_P_t4T.mjs} +2 -2
  21. package/dist/.setup/{setup-surface-aRZhAzzQ.mjs → setup-surface-CD28mXWK.mjs} +11 -25
  22. package/dist/.setup/{targets-CIx4BKqL.mjs → targets-C7CIWJ0k.mjs} +12 -3
  23. package/dist/.source-module-urls/929c518fa2986b0f85f66bceefead22868db0ab452dee914dc6a2bb86b2e60ad.json +1 -1
  24. package/dist/api.js +8 -8
  25. package/dist/channel-config-api.js +1 -1
  26. package/dist/channel-plugin-api.js +1 -1
  27. package/dist/contract-api.js +1 -1
  28. package/dist/media-contract-api.js +1 -1
  29. package/dist/message-tool-api.js +1 -1
  30. package/dist/runtime-api.js +1 -3
  31. package/dist/session-binding-contract-api.js +1 -1
  32. package/dist/setup-entry.js +1 -1
  33. package/dist/src/chat-db.worker.js +1 -1
  34. package/node_modules/typebox/build/format/duration.d.mts +2 -2
  35. package/node_modules/typebox/build/format/duration.mjs +2 -2
  36. package/node_modules/typebox/build/format/idn_email.d.mts +1 -0
  37. package/node_modules/typebox/build/format/idn_email.mjs +1 -0
  38. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
  39. package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
  40. package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
  41. package/node_modules/typebox/build/format/ipv4.mjs +2 -2
  42. package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
  43. package/node_modules/typebox/build/format/ipv6.mjs +1 -1
  44. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
  45. package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
  46. package/node_modules/typebox/build/schema/build.mjs +1 -0
  47. package/node_modules/typebox/build/schema/engine/_unique.d.mts +4 -2
  48. package/node_modules/typebox/build/schema/engine/_unique.mjs +7 -3
  49. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
  50. package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +0 -3
  51. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +15 -17
  52. package/node_modules/typebox/build/schema/engine/contains.mjs +3 -3
  53. package/node_modules/typebox/build/schema/engine/index.d.mts +1 -0
  54. package/node_modules/typebox/build/schema/engine/index.mjs +1 -0
  55. package/node_modules/typebox/build/schema/engine/items.mjs +7 -4
  56. package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -2
  57. package/node_modules/typebox/build/schema/engine/minContains.mjs +3 -3
  58. package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
  59. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +2 -2
  60. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -2
  61. package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
  62. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
  63. package/node_modules/typebox/build/system/hashing/hash.mjs +63 -34
  64. package/node_modules/typebox/build/system/locale/en_US.mjs +2 -1
  65. package/node_modules/typebox/build/system/memory/assign.d.mts +2 -8
  66. package/node_modules/typebox/build/system/memory/assign.mjs +13 -6
  67. package/node_modules/typebox/build/system/memory/clone.d.mts +4 -5
  68. package/node_modules/typebox/build/system/memory/clone.mjs +8 -96
  69. package/node_modules/typebox/build/system/memory/create.d.mts +1 -5
  70. package/node_modules/typebox/build/system/memory/create.mjs +18 -13
  71. package/node_modules/typebox/build/system/memory/deep.d.mts +2 -0
  72. package/node_modules/typebox/build/system/memory/deep.mjs +108 -0
  73. package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
  74. package/node_modules/typebox/build/system/memory/discard.mjs +9 -8
  75. package/node_modules/typebox/build/system/memory/finalize.d.mts +4 -0
  76. package/node_modules/typebox/build/system/memory/finalize.mjs +30 -0
  77. package/node_modules/typebox/build/system/memory/keys.d.mts +2 -0
  78. package/node_modules/typebox/build/system/memory/keys.mjs +8 -0
  79. package/node_modules/typebox/build/system/memory/update.d.mts +1 -4
  80. package/node_modules/typebox/build/system/memory/update.mjs +43 -16
  81. package/node_modules/typebox/build/type/engine/call/index.d.mts +1 -0
  82. package/node_modules/typebox/build/type/engine/call/index.mjs +1 -0
  83. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +2 -24
  84. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +2 -29
  85. package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +1 -0
  86. package/node_modules/typebox/build/type/engine/evaluate/index.mjs +1 -0
  87. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -1
  88. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +6 -1
  89. package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +30 -0
  90. package/node_modules/typebox/build/type/engine/evaluate/property.mjs +29 -0
  91. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +1 -3
  92. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +1 -4
  93. package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
  94. package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
  95. package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
  96. package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  97. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +1 -3
  98. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +1 -4
  99. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +1 -3
  100. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +1 -4
  101. package/node_modules/typebox/build/type/engine/this/index.d.mts +1 -0
  102. package/node_modules/typebox/build/type/engine/this/index.mjs +1 -0
  103. package/node_modules/typebox/build/value/clone/clone.d.mts +4 -3
  104. package/node_modules/typebox/build/value/clone/clone.mjs +5 -7
  105. package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +2 -0
  106. package/node_modules/typebox/build/value/repair/from_cyclic.mjs +6 -0
  107. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +25 -14
  108. package/node_modules/typebox/package.json +1 -1
  109. package/node_modules/typebox/readme.md +1 -1
  110. package/node_modules/zod/package.json +1 -1
  111. package/node_modules/zod/src/v4/classic/tests/array.test.ts +27 -0
  112. package/node_modules/zod/src/v4/classic/tests/map.test.ts +7 -0
  113. package/node_modules/zod/src/v4/classic/tests/set.test.ts +6 -0
  114. package/node_modules/zod/src/v4/core/compile.ts +9 -0
  115. package/node_modules/zod/src/v4/core/schemas.ts +35 -1
  116. package/node_modules/zod/src/v4/core/util.ts +13 -0
  117. package/node_modules/zod/src/v4/core/versions.ts +1 -1
  118. package/node_modules/zod/v4/core/compile.cjs +8 -0
  119. package/node_modules/zod/v4/core/compile.js +8 -0
  120. package/node_modules/zod/v4/core/schemas.cjs +30 -0
  121. package/node_modules/zod/v4/core/schemas.d.cts +3 -1
  122. package/node_modules/zod/v4/core/schemas.d.ts +3 -1
  123. package/node_modules/zod/v4/core/schemas.js +30 -0
  124. package/node_modules/zod/v4/core/util.cjs +15 -0
  125. package/node_modules/zod/v4/core/util.d.cts +2 -0
  126. package/node_modules/zod/v4/core/util.d.ts +2 -0
  127. package/node_modules/zod/v4/core/util.js +14 -0
  128. package/node_modules/zod/v4/core/versions.cjs +1 -1
  129. package/node_modules/zod/v4/core/versions.js +1 -1
  130. package/openclaw.plugin.json +0 -30
  131. package/package.json +6 -6
  132. package/dist/.setup/client-C3e7ZLqA.mjs +0 -739
  133. package/dist/.setup/question-reactions-DTj-VH3N.mjs +0 -67
  134. package/dist/.setup/reaction-context-Bw00FkmU.mjs +0 -105
  135. package/dist/.setup/runtime-BRQCPuAD.mjs +0 -7
  136. package/node_modules/typebox/build/system/memory/freeze.d.mts +0 -4
  137. 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-CIx4BKqL.mjs";
2
- import { a as resolveDefaultIMessageAccountId, i as listIMessageAccountIds, o as resolveIMessageAccount, t as collectIMessageDuplicateAccountSourceWarnings } from "./accounts-BH0coL46.mjs";
3
- import { S as resolveIMessageDirectChatService } from "./client-C3e7ZLqA.mjs";
4
- import { t as imessageMessageActions } from "./actions-CW7XYYF4.mjs";
5
- import { i as createIMessageSetupWizardProxy, s as imessageSetupContract } from "./setup-core-BWnW0czE.mjs";
6
- import { n as createIMessageConversationBindingManagerV2 } from "./conversation-bindings-vZFn6sN2.mjs";
7
- import { n as sanitizeIMessageFinalOutboundText, r as sanitizeOutboundText } from "./sanitize-outbound-C02fJrn6.mjs";
8
- import { t as IMessageChannelConfigSchema } from "./config-schema-DRkdRC21.mjs";
9
- import { n as resolveIMessageAttachmentRoots, r as resolveIMessageRemoteAttachmentRoots } from "./media-contract-CoixpXRX.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,7 +28,6 @@ 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
32
  // extensions/imessage/src/approval-auth.ts
34
33
  function normalizeIMessageApproverId(value) {
@@ -69,6 +68,13 @@ function isIMessageApprovalTransportEnabled(params) {
69
68
  accountId: params.accountId
70
69
  }).enabled;
71
70
  }
71
+ function isDirectHandleTarget(to) {
72
+ try {
73
+ return parseIMessageTarget(to).kind === "handle";
74
+ } catch {
75
+ return false;
76
+ }
77
+ }
72
78
  const imessageApproval = createApproverRestrictedNativeApprovalCapabilityFromForwardingRoutesAsync({
73
79
  channel: "imessage",
74
80
  channelLabel: "iMessage",
@@ -80,7 +86,7 @@ const imessageApproval = createApproverRestrictedNativeApprovalCapabilityFromFor
80
86
  resolveDefaultAccountId: resolveDefaultIMessageAccountId,
81
87
  normalizeTo: normalizeIMessageMessagingTarget,
82
88
  resolveApprovers: getIMessageApprovalApprovers,
83
- isOriginTargetAllowed: ({ cfg, accountId, target }) => inferIMessageTargetChatType(target.to) !== "group" || getIMessageApprovalApprovers({
89
+ isOriginTargetAllowed: ({ cfg, accountId, target }) => isDirectHandleTarget(target.to) || getIMessageApprovalApprovers({
84
90
  cfg,
85
91
  accountId
86
92
  }).length > 0
@@ -89,14 +95,50 @@ const imessageApproval = createApproverRestrictedNativeApprovalCapabilityFromFor
89
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.`;
90
96
  },
91
97
  render: {
92
- exec: { buildPendingPayload: ({ request, nowMs }) => buildIMessageExecPendingPayload({
93
- request,
94
- nowMs
95
- }) },
96
- plugin: { buildPendingPayload: ({ request, nowMs }) => buildIMessagePluginPendingPayload({
97
- request,
98
- nowMs
99
- }) }
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
+ } }
100
142
  },
101
143
  createNativeRuntime: (routing) => createLazyChannelApprovalNativeRuntimeAdapterAsync({
102
144
  capabilityBoundary: true,
@@ -116,7 +158,7 @@ const imessageApproval = createApproverRestrictedNativeApprovalCapabilityFromFor
116
158
  approvalKind,
117
159
  request
118
160
  }),
119
- load: async () => (await import("./approval-handler.runtime-BKmqba3L.mjs")).imessageApprovalNativeRuntime
161
+ load: async () => (await import("./approval-handler.runtime-B6vrFfZx.mjs")).imessageApprovalNativeRuntime
120
162
  })
121
163
  });
122
164
  const imessageApprovalRouting = imessageApproval.routing;
@@ -139,7 +181,7 @@ function resolveIMessageSessionTargetFromSessionKey(sessionKey) {
139
181
  } : null;
140
182
  }
141
183
  const to = normalizeIMessageMessagingTarget(route);
142
- if (!to || inferIMessageTargetChatType(to) !== "direct") return null;
184
+ if (!to || !isDirectHandleTarget(to)) return null;
143
185
  return { to };
144
186
  }
145
187
  function shouldSuppressLocalIMessageExecApprovalPrompt(params) {
@@ -152,7 +194,7 @@ function shouldSuppressLocalIMessageExecApprovalPrompt(params) {
152
194
  accountId
153
195
  }).length > 0) return true;
154
196
  const sessionTarget = resolveIMessageSessionTargetFromSessionKey(metadata.sessionKey);
155
- if (!sessionTarget || inferIMessageTargetChatType(sessionTarget.to) !== "direct") return false;
197
+ if (!sessionTarget || !isDirectHandleTarget(sessionTarget.to)) return false;
156
198
  const targetAccountId = normalizeOptionalString(sessionTarget.accountId);
157
199
  return !targetAccountId || !accountId || normalizeAccountId(targetAccountId) === normalizeAccountId(accountId);
158
200
  }
@@ -170,50 +212,6 @@ function shouldSuppressLocalIMessageExecApprovalPrompt(params) {
170
212
  nativeSessionOnly: true
171
213
  });
172
214
  }
173
- function buildIMessageExecPendingPayload(params) {
174
- const allowedDecisions = resolveExecApprovalRequestAllowedDecisions(params.request.request);
175
- const command = resolveExecApprovalCommandDisplay(params.request.request).commandText;
176
- const payload = buildTypedExecApprovalPendingReplyPayload({
177
- approvalId: params.request.id,
178
- approvalSlug: params.request.id.slice(0, 8),
179
- approvalCommandId: params.request.id,
180
- warningText: params.request.request.warningText ?? void 0,
181
- ask: params.request.request.ask ?? null,
182
- agentId: params.request.request.agentId ?? null,
183
- allowedDecisions,
184
- command,
185
- cwd: params.request.request.cwd ?? void 0,
186
- host: params.request.request.host === "node" ? "node" : "gateway",
187
- nodeId: params.request.request.nodeId ?? void 0,
188
- scope: params.request.request.scope ?? void 0,
189
- sessionKey: params.request.request.sessionKey ?? null,
190
- expiresAtMs: params.request.expiresAtMs,
191
- nowMs: params.nowMs
192
- });
193
- return {
194
- ...payload,
195
- text: addApprovalReactionHintToText({
196
- text: replaceApprovalIdPlaceholder(payload.text, params.request.id),
197
- allowedDecisions
198
- })
199
- };
200
- }
201
- function buildIMessagePluginPendingPayload(params) {
202
- const configuredDecisions = params.request.request.allowedDecisions;
203
- const allowedDecisions = configuredDecisions && configuredDecisions.length > 0 ? configuredDecisions : DEFAULT_PLUGIN_APPROVAL_DECISIONS;
204
- const payload = buildTypedPluginApprovalPendingReplyPayload({
205
- request: params.request,
206
- nowMs: params.nowMs,
207
- allowedDecisions
208
- });
209
- return {
210
- ...payload,
211
- text: addApprovalReactionHintToText({
212
- text: replaceApprovalIdPlaceholder(payload.text, params.request.id),
213
- allowedDecisions
214
- })
215
- };
216
- }
217
215
  const imessageApprovalCapability = imessageApproval.capability;
218
216
  // extensions/imessage/src/conversation-id-core.ts
219
217
  function normalizeIMessageAcpConversationId(conversationId) {
@@ -280,7 +278,7 @@ function resolveIMessageGroupSystemPrompt(params) {
280
278
  }
281
279
  // extensions/imessage/src/shared.ts
282
280
  const IMESSAGE_CHANNEL = "imessage";
283
- const imessageSetupWizard = createIMessageSetupWizardProxy(async () => (await import("./setup-surface-aRZhAzzQ.mjs")).imessageSetupWizard);
281
+ const imessageSetupWizard = createIMessageSetupWizardProxy(async () => (await import("./setup-surface-CD28mXWK.mjs")).imessageSetupWizard);
284
282
  const imessageConfigAdapter = createScopedChannelConfigAdapter({
285
283
  sectionKey: IMESSAGE_CHANNEL,
286
284
  listAccountIds: listIMessageAccountIds,
@@ -363,7 +361,8 @@ function createIMessagePluginBase(params) {
363
361
  };
364
362
  }
365
363
  // extensions/imessage/src/channel.ts
366
- const loadIMessageChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-BW4A0m4h.mjs"));
364
+ const loadIMessageChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-XJGx1MIH.mjs"));
365
+ const loadIMessageChatLookup = createLazyRuntimeModule(() => import("./chat-lookup-xtPsOBkl.mjs"));
367
366
  async function sendIMessageOutbound(ctx, kind, options = {}) {
368
367
  return await (await loadIMessageChannelRuntime()).sendIMessageOutbound({
369
368
  cfg: ctx.cfg,
@@ -399,8 +398,7 @@ function toIMessageMessageSendResult(result, kind, replyToId) {
399
398
  ...result.meta && Object.keys(result.meta).length > 0 ? { meta: result.meta } : {}
400
399
  };
401
400
  }
402
- const loadIMessageApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-B9CJS0NT.mjs").then((n) => n.t));
403
- const loadIMessageQuestionReactionsModule = createLazyRuntimeModule(() => import("./question-reactions-DTj-VH3N.mjs").then((n) => n.r));
401
+ const loadIMessageApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-DBBsqbRC.mjs").then((n) => n.t));
404
402
  const imessageMessageAdapter = defineChannelMessageAdapter({
405
403
  id: "imessage",
406
404
  durableFinal: { capabilities: {
@@ -429,50 +427,60 @@ function isCanonicalIMessageDirectHandle(raw, normalized) {
429
427
  if (normalized.startsWith("+")) return isIMessagePhoneLikeHandle(trimmed);
430
428
  return /^[^\s@<>()[\]`]+@[^\s@<>()[\]`]+\.[^\s@<>()[\]`]+$/.test(trimmed);
431
429
  }
432
- function resolveIMessageOutboundSessionRoute(params) {
433
- const parsed = parseIMessageTarget(params.target);
434
- let peer;
435
- let from;
436
- let to;
437
- let recipientSessionExact = false;
438
- if (parsed.kind === "handle") {
439
- const handle = normalizeIMessageHandle(parsed.to);
440
- if (!handle) return null;
441
- const account = resolveIMessageAccount({
442
- cfg: params.cfg,
443
- 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"
444
446
  });
445
- from = to = `${resolveIMessageDirectChatService(parsed.serviceExplicit ? parsed.service : account.config.service) ?? "auto"}:${handle}`;
446
- peer = {
447
- kind: "direct",
448
- 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
449
464
  };
450
- recipientSessionExact = isCanonicalIMessageDirectHandle(parsed.to, handle);
451
- } else {
452
- const peerId = parsed.kind === "chat_id" ? String(parsed.chatId) : parsed.kind === "chat_guid" ? parsed.chatGuid : parsed.chatIdentifier;
453
- if (!peerId) return null;
454
- peer = {
455
- kind: "group",
456
- id: peerId
465
+ parsed = {
466
+ kind: "handle",
467
+ to: normalizeDirectChatIdentifier(chat.guid),
468
+ service: resolveIMessageDirectChatService(account.config.service, chat.guid) ?? "auto",
469
+ serviceExplicit: true
457
470
  };
458
- from = `imessage:group:${peerId}`;
459
- to = `${parsed.kind}:${peerId}`;
460
471
  }
461
- const baseSessionKey = buildOutboundBaseSessionKey({
462
- cfg: params.cfg,
463
- channel: "imessage",
464
- agentId: params.agentId,
465
- accountId: params.accountId,
466
- peer
467
- });
472
+ const handle = normalizeIMessageHandle(parsed.to);
473
+ if (!handle) return null;
474
+ const from = `${resolveIMessageDirectChatService(parsed.serviceExplicit ? parsed.service : account.config.service) ?? "auto"}:${handle}`;
468
475
  return {
469
- sessionKey: baseSessionKey,
470
- baseSessionKey,
471
- recipientSessionExact,
472
- peer,
473
- chatType: peer.kind,
476
+ accountId: account.accountId,
477
+ peer: {
478
+ kind: "direct",
479
+ id: handle
480
+ },
474
481
  from,
475
- to
482
+ to: deliveryTarget ?? from,
483
+ recipientSessionExact: isCanonicalIMessageDirectHandle(parsed.to, handle)
476
484
  };
477
485
  }
478
486
  const imessagePlugin = createChatChannelPlugin({
@@ -518,20 +526,40 @@ const imessagePlugin = createChatChannelPlugin({
518
526
  messaging: {
519
527
  normalizeTarget: normalizeIMessageMessagingTarget,
520
528
  inferTargetChatType: ({ to }) => inferIMessageTargetChatType(to),
521
- 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
+ },
522
546
  targetResolver: {
523
547
  looksLikeId: looksLikeIMessageExplicitTargetId,
524
548
  hint: "<phone|email|chat_id:ID|auto:contact|imessage:contact|sms:contact>",
525
- resolveTarget: async ({ input }) => {
549
+ resolveTarget: async ({ cfg, accountId, input }) => {
526
550
  const to = normalizeIMessageMessagingTarget(input);
527
551
  if (!to) return null;
528
- const chatType = inferIMessageTargetChatType(to);
529
- if (!chatType) return null;
552
+ const target = await resolveIMessageConversationTarget({
553
+ cfg,
554
+ accountId,
555
+ target: to
556
+ });
557
+ if (!target) return null;
530
558
  const parsed = parseIMessageTarget(to);
531
559
  const display = parsed.kind === "handle" && !isCanonicalIMessageDirectHandle(parsed.to, normalizeIMessageHandle(parsed.to)) ? parsed.to.trim() : void 0;
532
560
  return {
533
561
  to,
534
- kind: chatType === "direct" ? "user" : "group",
562
+ kind: target.peer.kind === "direct" ? "user" : "group",
535
563
  ...display ? { display } : {},
536
564
  source: "normalized"
537
565
  };
@@ -630,10 +658,6 @@ const imessagePlugin = createChatChannelPlugin({
630
658
  });
631
659
  if (prepared) Object.assign(payload, prepared);
632
660
  },
633
- renderPresentation: ({ payload, presentation }) => questionGatewayRuntime.prepareReactionPayloadForDelivery({
634
- payload,
635
- presentation
636
- }),
637
661
  afterDeliverPayload: async ({ cfg, target, payload, results }) => {
638
662
  const delivery = {
639
663
  accountId: resolveIMessageAccount({
@@ -644,7 +668,6 @@ const imessagePlugin = createChatChannelPlugin({
644
668
  payload,
645
669
  results
646
670
  };
647
- (await loadIMessageQuestionReactionsModule()).registerIMessageQuestionReactionTargetForDeliveredPayload(delivery);
648
671
  await (await loadIMessageApprovalReactionsModule()).registerIMessageApprovalReactionTargetForDeliveredPayload(delivery);
649
672
  },
650
673
  deliveryCapabilities: { durableFinal: {