@openclaw/imessage 2026.9.1-beta.1 → 2026.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/{accounts-DIpGOIiN.js → accounts-CCirBEIm.js} +2 -3
  2. package/dist/{actions.runtime-BhggncbG.js → actions.runtime-DCjNT81u.js} +5 -5
  3. package/dist/api.js +5 -5
  4. package/dist/{approval-handler.runtime-BC-YsgAf.js → approval-handler.runtime-BReeID1z.js} +14 -9
  5. package/dist/{approval-reactions-Cvwmdlev.js → approval-reactions-DcLRPx7O.js} +6 -10
  6. package/dist/channel-config-api.js +1 -1
  7. package/dist/channel-plugin-api.js +1 -1
  8. package/dist/{channel-CnKQ2MVB.js → channel-zDmMTHWD.js} +16 -12
  9. package/dist/{channel.runtime-BQLCh7bE.js → channel.runtime-qQBHCle8.js} +59 -14
  10. package/dist/{config-schema-DV0KP5nC.js → config-schema-DuGbA8Kp.js} +8 -7
  11. package/dist/contract-api.js +1 -1
  12. package/dist/doctor-contract-api.js +8 -281
  13. package/dist/{group-policy-BipELT2x.js → group-policy-BWqG2esy.js} +18 -12
  14. package/dist/media-contract-api.js +1 -1
  15. package/dist/{media-contract-BVXuQHG2.js → media-contract-pns3TSS5.js} +3 -2
  16. package/dist/{message-tool-api-BwIxJDoz.js → message-tool-api-CUoFESHj.js} +11 -6
  17. package/dist/message-tool-api.js +1 -1
  18. package/dist/{monitor-DRD_Dnp9.js → monitor-AmSj6QIH.js} +293 -27
  19. package/dist/{remote-file-CyTTuRAt.js → remote-file-COTN7196.js} +9 -8
  20. package/dist/runtime-Cza4CY5T.js +8 -0
  21. package/dist/runtime-api.js +7 -7
  22. package/dist/{sanitize-outbound-g651fIhi.js → sanitize-outbound-CN3Hxbjy.js} +393 -82
  23. package/dist/{send-DVQY6M5M.js → send-v0blZfaI.js} +145 -23
  24. package/dist/state-contract-DvahEY4X.js +56 -0
  25. package/dist/state-migrations-D-fyHVcb.js +277 -0
  26. package/node_modules/typebox/build/format/email.mjs +1 -1
  27. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
  28. package/node_modules/typebox/package.json +1 -1
  29. package/openclaw.plugin.json +0 -6
  30. package/package.json +5 -5
  31. package/dist/catchup-Dh-Rv4Ur.js +0 -294
  32. package/dist/monitor-reply-cache-BdeUQaHO.js +0 -353
  33. package/dist/persisted-echo-cache-DGxy-J4t.js +0 -143
@@ -1,9 +1,8 @@
1
1
  import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
2
- import { resolveAccountEntry } from "openclaw/plugin-sdk/routing";
3
2
  import { accessSync, constants, readFileSync, realpathSync, statSync } from "node:fs";
4
3
  import path from "node:path";
5
4
  import { createAccountListHelpers } from "openclaw/plugin-sdk/account-helpers";
6
- import { normalizeAccountId as normalizeAccountId$1 } from "openclaw/plugin-sdk/account-resolution";
5
+ import { normalizeAccountId, resolveAccountEntry } from "openclaw/plugin-sdk/account-resolution";
7
6
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
8
7
  import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
9
8
  import os from "node:os";
@@ -224,7 +223,7 @@ function mergeIMessageAccountConfig(cfg, accountId) {
224
223
  } : merged;
225
224
  }
226
225
  function resolveIMessageAccount(params) {
227
- const accountId = normalizeAccountId$1(params.accountId ?? resolveDefaultIMessageAccountId(params.cfg));
226
+ const accountId = normalizeAccountId(params.accountId ?? resolveDefaultIMessageAccountId(params.cfg));
228
227
  const baseEnabled = params.cfg.channels?.imessage?.enabled !== false;
229
228
  const merged = mergeIMessageAccountConfig(params.cfg, accountId);
230
229
  const accountEnabled = merged.enabled !== false;
@@ -1,6 +1,5 @@
1
- import { _ as normalizeDirectChatIdentifier, u as resolveIMessageMessageId } from "./monitor-reply-cache-BdeUQaHO.js";
2
- import { n as sanitizeIMessageFinalOutboundText, o as createIMessageRpcClient } from "./sanitize-outbound-g651fIhi.js";
3
- import { i as runIMessageCliJsonCommand, n as authorizeIMessageResourceReference, t as withIMessageRemoteFile } from "./remote-file-CyTTuRAt.js";
1
+ import { _ as normalizeDirectChatIdentifier, f as resolveIMessageMessageId, n as sanitizeIMessageFinalOutboundText, o as createIMessageRpcClient } from "./sanitize-outbound-CN3Hxbjy.js";
2
+ import { i as runIMessageCliJsonCommand, n as authorizeIMessageResourceReference, t as withIMessageRemoteFile } from "./remote-file-COTN7196.js";
4
3
  import { basename, parse, win32 } from "node:path";
5
4
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
6
5
  import { asDateTimestampMs, parseStrictInteger, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
@@ -8,7 +7,7 @@ import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
8
7
  import { sanitizeUntrustedFileName } from "openclaw/plugin-sdk/security-runtime";
9
8
  import { resolvePreferredOpenClawTmpDir, withTempWorkspace } from "openclaw/plugin-sdk/temp-path";
10
9
  //#region extensions/imessage/src/actions-chat-guid.ts
11
- const CHAT_LIST_CACHE_TTL_MS = 30 * 1e3;
10
+ const CHAT_LIST_CACHE_TTL_MS = 3e4;
12
11
  const chatListCache = /* @__PURE__ */ new Map();
13
12
  function asChatList(value) {
14
13
  if (!value || typeof value !== "object" || Array.isArray(value)) return [];
@@ -130,7 +129,8 @@ async function withTempFile(input, fn) {
130
129
  rootDir: resolvePreferredOpenClawTmpDir(),
131
130
  prefix: "openclaw-imessage-"
132
131
  }, async (workspace) => {
133
- const { name, ext: safeExtension } = parse(sanitizeUntrustedFileName(input.filename, "upload.bin"));
132
+ const safeFilename = sanitizeUntrustedFileName(input.filename, "upload.bin");
133
+ const { name, ext: safeExtension } = parse(safeFilename);
134
134
  const originalExtension = parse(win32.basename(basename(input.filename))).ext;
135
135
  const extension = truncateUtf16Safe(sanitizeUntrustedFileName(originalExtension, safeExtension), 16);
136
136
  const filename = `${truncateUtf16Safe(name, 80 - extension.length)}${extension}`;
package/dist/api.js CHANGED
@@ -1,8 +1,8 @@
1
- import { a as resolveDefaultIMessageAccountId, i as listIMessageAccountIds, o as resolveIMessageAccount, r as listEnabledIMessageAccounts } from "./accounts-DIpGOIiN.js";
2
- import { a as isAllowedIMessageSender, c as parseIMessageAllowTarget, g as IMESSAGE_ACTION_NAMES, h as IMESSAGE_ACTIONS, l as parseIMessageTarget, n as formatIMessageChatTarget, o as looksLikeIMessageExplicitTargetId, r as inferIMessageTargetChatType, s as normalizeIMessageHandle } from "./message-tool-api-BwIxJDoz.js";
3
- import { s as DEFAULT_IMESSAGE_PROBE_TIMEOUT_MS } from "./sanitize-outbound-g651fIhi.js";
4
- import { a as normalizeIMessageAcpConversationId, c as normalizeIMessageMessagingTarget, f as probeIMessage, i as matchIMessageAcpConversation, n as resolveIMessageGroupToolPolicy, o as resolveIMessageConversationIdFromTarget, r as resolveIMessageInboundConversationId, s as looksLikeIMessageTargetId, t as resolveIMessageGroupRequireMention, v as imessageSetupContract } from "./group-policy-BipELT2x.js";
5
- import { n as createIMessagePluginBase, r as imessageSetupWizard, t as imessagePlugin } from "./channel-CnKQ2MVB.js";
1
+ import { a as resolveDefaultIMessageAccountId, i as listIMessageAccountIds, o as resolveIMessageAccount, r as listEnabledIMessageAccounts } from "./accounts-CCirBEIm.js";
2
+ import { _ as IMESSAGE_ACTION_NAMES, a as isAllowedIMessageSender, c as parseIMessageAllowTarget, g as IMESSAGE_ACTIONS, l as parseIMessageTarget, n as formatIMessageChatTarget, o as looksLikeIMessageExplicitTargetId, r as inferIMessageTargetChatType, s as normalizeIMessageHandle } from "./message-tool-api-CUoFESHj.js";
3
+ import { p as DEFAULT_IMESSAGE_PROBE_TIMEOUT_MS } from "./sanitize-outbound-CN3Hxbjy.js";
4
+ import { a as normalizeIMessageAcpConversationId, c as normalizeIMessageMessagingTarget, f as probeIMessage, i as matchIMessageAcpConversation, n as resolveIMessageGroupToolPolicy, o as resolveIMessageConversationIdFromTarget, r as resolveIMessageInboundConversationId, s as looksLikeIMessageTargetId, t as resolveIMessageGroupRequireMention, v as imessageSetupContract } from "./group-policy-BWqG2esy.js";
5
+ import { n as createIMessagePluginBase, r as imessageSetupWizard, t as imessagePlugin } from "./channel-zDmMTHWD.js";
6
6
  import { t as createIMessageConversationBindingManager } from "./conversation-bindings-GDQ_Laxj.js";
7
7
  import { t as IMESSAGE_LEGACY_OUTBOUND_SEND_DEP_KEYS } from "./outbound-send-deps-B-QEsLSM.js";
8
8
  import { createAllowedChatSenderMatcher, parseChatAllowTargetPrefixes, parseChatTargetPrefixesOrThrow, resolveServicePrefixedAllowTarget, resolveServicePrefixedChatTarget, resolveServicePrefixedOrChatAllowTarget, resolveServicePrefixedTarget } from "openclaw/plugin-sdk/channel-targets";
@@ -1,9 +1,9 @@
1
- import { o as resolveIMessageAccount } from "./accounts-DIpGOIiN.js";
2
- import { f as getCachedIMessagePrivateApiStatus, l as parseIMessageTarget } from "./message-tool-api-BwIxJDoz.js";
3
- import { i as extractMarkdownFormatRuns } from "./sanitize-outbound-g651fIhi.js";
4
- import { c as normalizeIMessageMessagingTarget, l as getIMessageApprovalApprovers } from "./group-policy-BipELT2x.js";
5
- import { a as unregisterIMessageApprovalReactionTarget, c as buildIMessageApprovalConversationKeyForTarget, i as registerIMessageApprovalReactionTarget } from "./approval-reactions-Cvwmdlev.js";
6
- import { i as mapSentPollOptionsToDecisions, n as buildApprovalPollOptions, o as iMessageApprovalControlBindings, r as iMessageApprovalPollTargets, t as sendMessageIMessage } from "./send-DVQY6M5M.js";
1
+ import { o as resolveIMessageAccount } from "./accounts-CCirBEIm.js";
2
+ import { f as getCachedIMessagePrivateApiStatus, l as parseIMessageTarget } from "./message-tool-api-CUoFESHj.js";
3
+ import { i as extractMarkdownFormatRuns } from "./sanitize-outbound-CN3Hxbjy.js";
4
+ import { c as normalizeIMessageMessagingTarget, l as getIMessageApprovalApprovers } from "./group-policy-BWqG2esy.js";
5
+ import { a as unregisterIMessageApprovalReactionTarget, c as buildIMessageApprovalConversationKeyForTarget, i as registerIMessageApprovalReactionTarget } from "./approval-reactions-DcLRPx7O.js";
6
+ import { a as iMessageApprovalPollTargets, c as iMessageApprovalControlBindings, i as buildApprovalPollOptions, o as mapSentPollOptionsToDecisions, t as sendMessageIMessage } from "./send-v0blZfaI.js";
7
7
  import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
8
8
  import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
9
9
  import { createActionGate } from "openclaw/plugin-sdk/channel-actions";
@@ -13,7 +13,7 @@ import { buildChannelApprovalExpiredText, buildChannelApprovalResolvedText, crea
13
13
  import { setTimeout } from "node:timers/promises";
14
14
  //#region extensions/imessage/src/approval-handler.runtime.ts
15
15
  const log = createSubsystemLogger("imessage/approvals");
16
- const loadIMessageActionsRuntime = createLazyRuntimeNamedExport(() => import("./actions.runtime-BhggncbG.js"), "imessageActionsRuntime");
16
+ const loadIMessageActionsRuntime = createLazyRuntimeNamedExport(() => import("./actions.runtime-DCjNT81u.js"), "imessageActionsRuntime");
17
17
  const DEFAULT_PROBE_TIMEOUT_MS = 5e3;
18
18
  const APPROVAL_POLL_ORDERING_DELAY_MS = 1100;
19
19
  function buildPendingPayload(params) {
@@ -69,7 +69,8 @@ function canIMessageApprovalUsePoll(params) {
69
69
  cfg: params.cfg,
70
70
  accountId: account.accountId
71
71
  }).length === 0) return false;
72
- const status = getCachedIMessagePrivateApiStatus(account.config.cliPath?.trim() || "imsg");
72
+ const cliPath = account.config.cliPath?.trim() || "imsg";
73
+ const status = getCachedIMessagePrivateApiStatus(cliPath);
73
74
  return status?.available === true && status?.selectors?.pollPayloadMessage === true && status.cliCapabilities?.pollSendSupportsNoComment === true;
74
75
  } catch {
75
76
  return false;
@@ -274,7 +275,11 @@ function bindIMessageApprovalEntry(params) {
274
275
  return reactionBound || pollBound ? true : null;
275
276
  }
276
277
  const imessageApprovalNativeRuntime = createChannelApprovalNativeRuntimeAdapter({
277
- eventKinds: ["exec", "plugin"],
278
+ eventKinds: [
279
+ "exec",
280
+ "plugin",
281
+ "system-agent"
282
+ ],
278
283
  availability: {
279
284
  isConfigured: ({ context }) => Boolean(context),
280
285
  shouldHandle: ({ context }) => Boolean(context)
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { l as parseIMessageTarget, s as normalizeIMessageHandle } from "./message-tool-api-BwIxJDoz.js";
3
- import { p as getOptionalIMessageRuntime } from "./monitor-reply-cache-BdeUQaHO.js";
4
- import { l as getIMessageApprovalApprovers, u as imessageApprovalAuth } from "./group-policy-BipELT2x.js";
2
+ import { l as parseIMessageTarget, s as normalizeIMessageHandle } from "./message-tool-api-CUoFESHj.js";
3
+ import { l as getIMessageApprovalApprovers, u as imessageApprovalAuth } from "./group-policy-BWqG2esy.js";
4
+ import { n as getOptionalIMessageRuntime } from "./runtime-Cza4CY5T.js";
5
5
  import { t as resolveIMessageReactionContext } from "./reaction-context-BAYI7pz0.js";
6
6
  import { createLazyRuntimeSurface } from "openclaw/plugin-sdk/lazy-runtime";
7
7
  import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -72,7 +72,7 @@ function buildIMessageApprovalConversationKeyForInbound(params) {
72
72
  //#region extensions/imessage/src/approval-reaction-poll-targets.ts
73
73
  const PERSISTENT_POLL_TARGET_NAMESPACE = "imessage.approval-reaction-poll-targets";
74
74
  const PERSISTENT_MAX_ENTRIES$1 = 1e3;
75
- const DEFAULT_REACTION_TARGET_TTL_MS$1 = 1440 * 60 * 1e3;
75
+ const DEFAULT_REACTION_TARGET_TTL_MS$1 = 864e5;
76
76
  const pendingReactionPollTargets = /* @__PURE__ */ new Map();
77
77
  function prunePendingReactionPollTargets(nowMs = Date.now()) {
78
78
  for (const [key, target] of pendingReactionPollTargets.entries()) if (!isFutureDateTimestampMs(target.expiresAtMs, { nowMs })) pendingReactionPollTargets.delete(key);
@@ -226,7 +226,7 @@ var approval_reactions_exports = /* @__PURE__ */ __exportAll({
226
226
  });
227
227
  const PERSISTENT_NAMESPACE = "imessage.approval-reactions";
228
228
  const PERSISTENT_MAX_ENTRIES = 1e3;
229
- const DEFAULT_REACTION_TARGET_TTL_MS = 1440 * 60 * 1e3;
229
+ const DEFAULT_REACTION_TARGET_TTL_MS = 864e5;
230
230
  const loadResolveApprovalOverGateway = createLazyRuntimeSurface(() => import("openclaw/plugin-sdk/approval-gateway-runtime"), (runtime) => runtime.resolveApprovalOverGateway);
231
231
  const reportPersistentApprovalReactionError = createPluginStateErrorReporter(getOptionalIMessageRuntime, "imessage", "approval-reaction-state", "iMessage persistent approval reaction state failed");
232
232
  function reportApprovalBindingCorrelationMismatch(binding) {
@@ -547,11 +547,7 @@ async function handleIMessageApprovalReaction(params) {
547
547
  });
548
548
  } catch {}
549
549
  params.logVerboseMessage?.(`imessage: approval reaction failed id=${target.approvalId} sender=${event.actorHandle}: ${String(error)}`);
550
- return {
551
- handled: true,
552
- stopPolling: true,
553
- stopPollingReason: "resolver-error"
554
- };
550
+ throw error;
555
551
  }
556
552
  }
557
553
  async function maybeResolveIMessageApprovalReaction(params) {
@@ -1,2 +1,2 @@
1
- import { t as IMessageChannelConfigSchema } from "./config-schema-DV0KP5nC.js";
1
+ import { t as IMessageChannelConfigSchema } from "./config-schema-DuGbA8Kp.js";
2
2
  export { IMessageChannelConfigSchema };
@@ -1,2 +1,2 @@
1
- import { t as imessagePlugin } from "./channel-CnKQ2MVB.js";
1
+ import { t as imessagePlugin } from "./channel-zDmMTHWD.js";
2
2
  export { imessagePlugin };
@@ -1,11 +1,10 @@
1
- import { a as resolveDefaultIMessageAccountId, i as listIMessageAccountIds, o as resolveIMessageAccount, t as collectIMessageDuplicateAccountSourceWarnings } from "./accounts-DIpGOIiN.js";
2
- import { l as parseIMessageTarget, o as looksLikeIMessageExplicitTargetId, r as inferIMessageTargetChatType, s as normalizeIMessageHandle, u as isIMessagePhoneLikeHandle } from "./message-tool-api-BwIxJDoz.js";
3
- import { v as resolveIMessageDirectChatService } from "./monitor-reply-cache-BdeUQaHO.js";
4
- import { n as sanitizeIMessageFinalOutboundText, r as sanitizeOutboundText } from "./sanitize-outbound-g651fIhi.js";
5
- import { a as normalizeIMessageAcpConversationId, c as normalizeIMessageMessagingTarget, d as imessageMessageActions, h as createIMessageSetupWizardProxy, i as matchIMessageAcpConversation, l as getIMessageApprovalApprovers, n as resolveIMessageGroupToolPolicy, o as resolveIMessageConversationIdFromTarget, t as resolveIMessageGroupRequireMention, u as imessageApprovalAuth, v as imessageSetupContract } from "./group-policy-BipELT2x.js";
1
+ import { a as resolveDefaultIMessageAccountId, i as listIMessageAccountIds, o as resolveIMessageAccount, t as collectIMessageDuplicateAccountSourceWarnings } from "./accounts-CCirBEIm.js";
2
+ import { l as parseIMessageTarget, o as looksLikeIMessageExplicitTargetId, r as inferIMessageTargetChatType, s as normalizeIMessageHandle, u as isIMessagePhoneLikeHandle } from "./message-tool-api-CUoFESHj.js";
3
+ import { n as sanitizeIMessageFinalOutboundText, r as sanitizeOutboundText, v as resolveIMessageDirectChatService } from "./sanitize-outbound-CN3Hxbjy.js";
4
+ import { a as normalizeIMessageAcpConversationId, c as normalizeIMessageMessagingTarget, d as imessageMessageActions, h as createIMessageSetupWizardProxy, i as matchIMessageAcpConversation, l as getIMessageApprovalApprovers, n as resolveIMessageGroupToolPolicy, o as resolveIMessageConversationIdFromTarget, t as resolveIMessageGroupRequireMention, u as imessageApprovalAuth, v as imessageSetupContract } from "./group-policy-BWqG2esy.js";
6
5
  import { t as createIMessageConversationBindingManager } from "./conversation-bindings-GDQ_Laxj.js";
7
- import { t as IMessageChannelConfigSchema } from "./config-schema-DV0KP5nC.js";
8
- import { n as resolveIMessageAttachmentRoots, r as resolveIMessageRemoteAttachmentRoots } from "./media-contract-BVXuQHG2.js";
6
+ import { t as IMessageChannelConfigSchema } from "./config-schema-DuGbA8Kp.js";
7
+ import { n as resolveIMessageAttachmentRoots, r as resolveIMessageRemoteAttachmentRoots } from "./media-contract-pns3TSS5.js";
9
8
  import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
10
9
  import { buildDmGroupAccountAllowlistAdapter } from "openclaw/plugin-sdk/allowlist-config-edit";
11
10
  import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter, formatTrimmedAllowFromEntries } from "openclaw/plugin-sdk/channel-config-helpers";
@@ -75,7 +74,11 @@ const imessageApproval = createApproverRestrictedNativeApprovalCapabilityFromFor
75
74
  }) }
76
75
  },
77
76
  createNativeRuntime: (routing) => createLazyChannelApprovalNativeRuntimeAdapter({
78
- eventKinds: ["exec", "plugin"],
77
+ eventKinds: [
78
+ "exec",
79
+ "plugin",
80
+ "system-agent"
81
+ ],
79
82
  isConfigured: ({ cfg, accountId, context }) => Boolean(context) && routing.canAnyApprovalPotentiallyRouteToChannel({
80
83
  cfg,
81
84
  accountId,
@@ -87,7 +90,7 @@ const imessageApproval = createApproverRestrictedNativeApprovalCapabilityFromFor
87
90
  approvalKind,
88
91
  request
89
92
  }),
90
- load: async () => (await import("./approval-handler.runtime-BC-YsgAf.js")).imessageApprovalNativeRuntime
93
+ load: async () => (await import("./approval-handler.runtime-BReeID1z.js")).imessageApprovalNativeRuntime
91
94
  })
92
95
  });
93
96
  const imessageApprovalRouting = imessageApproval.routing;
@@ -202,7 +205,7 @@ const imessageDoctor = {
202
205
  //#region extensions/imessage/src/shared.ts
203
206
  const IMESSAGE_CHANNEL = "imessage";
204
207
  async function loadIMessageChannelRuntime$1() {
205
- return await import("./channel.runtime-BQLCh7bE.js");
208
+ return await import("./channel.runtime-qQBHCle8.js");
206
209
  }
207
210
  const imessageSetupWizard = createIMessageSetupWizardProxy(async () => (await loadIMessageChannelRuntime$1()).imessageSetupWizard);
208
211
  const imessageConfigAdapter = createScopedChannelConfigAdapter({
@@ -301,7 +304,7 @@ async function probeIMessageStatusAccount(params) {
301
304
  }
302
305
  //#endregion
303
306
  //#region extensions/imessage/src/channel.ts
304
- const loadIMessageChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-BQLCh7bE.js"));
307
+ const loadIMessageChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-qQBHCle8.js"));
305
308
  function toIMessageMessageSendResult(result, kind, replyToId) {
306
309
  const receipt = result.receipt ?? createMessageReceiptFromOutboundResults({
307
310
  results: result.messageId ? [{
@@ -317,7 +320,7 @@ function toIMessageMessageSendResult(result, kind, replyToId) {
317
320
  ...result.meta && Object.keys(result.meta).length > 0 ? { meta: result.meta } : {}
318
321
  };
319
322
  }
320
- const loadIMessageApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-Cvwmdlev.js").then((n) => n.t));
323
+ const loadIMessageApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-DcLRPx7O.js").then((n) => n.t));
321
324
  const loadIMessageQuestionReactionsModule = createLazyRuntimeModule(() => import("./question-reactions-viP7ZcyG.js").then((n) => n.r));
322
325
  async function prepareForwardedIMessageApprovalPayload(params) {
323
326
  const prepared = (await loadIMessageApprovalReactionsModule()).addIMessageApprovalReactionHintToStructuredPayload(params);
@@ -466,6 +469,7 @@ const imessagePlugin = createChatChannelPlugin({
466
469
  resolveRequireMention: resolveIMessageGroupRequireMention,
467
470
  resolveToolPolicy: resolveIMessageGroupToolPolicy
468
471
  },
472
+ agentPrompt: { messageToolHints: () => ["- iMessage current conversation: omit target, to, chatId, chatGuid, and chatIdentifier. OpenClaw resolves the trusted current chat server-side; never copy a redacted display value such as `***` into message actions."] },
469
473
  doctor: imessageDoctor,
470
474
  conversationBindings: {
471
475
  supportsCurrentConversationBinding: true,
@@ -1,28 +1,66 @@
1
- import { l as resolveIMessageRemoteHost, o as resolveIMessageAccount, r as listEnabledIMessageAccounts, s as resolveIMessageDuplicateSourceOwner } from "./accounts-DIpGOIiN.js";
2
- import { _ as imessageDmPolicy, b as isAutoManagedIMessageCliPath, f as probeIMessage, g as imessageCompletionNote, m as createIMessageCliPathTextInput, p as IMESSAGE_INSTALL_COMMAND, x as normalizeIMessageCliPathForSetup, y as imessageSetupStatusBase } from "./group-policy-BipELT2x.js";
1
+ import { l as resolveIMessageRemoteHost, o as resolveIMessageAccount, r as listEnabledIMessageAccounts, s as resolveIMessageDuplicateSourceOwner } from "./accounts-CCirBEIm.js";
2
+ import { _ as imessageDmPolicy, b as isAutoManagedIMessageCliPath, f as probeIMessage, g as imessageCompletionNote, m as createIMessageCliPathTextInput, p as IMESSAGE_INSTALL_COMMAND, x as normalizeIMessageCliPathForSetup, y as imessageSetupStatusBase } from "./group-policy-BWqG2esy.js";
3
3
  import { t as IMESSAGE_LEGACY_OUTBOUND_SEND_DEP_KEYS } from "./outbound-send-deps-B-QEsLSM.js";
4
- import { t as sendMessageIMessage } from "./send-DVQY6M5M.js";
5
- import { t as monitorIMessageProvider } from "./monitor-DRD_Dnp9.js";
4
+ import { t as sendMessageIMessage } from "./send-v0blZfaI.js";
5
+ import { t as monitorIMessageProvider } from "./monitor-AmSj6QIH.js";
6
6
  import { createAccountStatusSink, resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-outbound";
7
7
  import path from "node:path";
8
+ import { resolveChannelMediaMaxBytes } from "openclaw/plugin-sdk/account-helpers";
8
9
  import fs from "node:fs/promises";
9
- import { resolveChannelMediaMaxBytes } from "openclaw/plugin-sdk/media-runtime";
10
10
  import { createDetectedBinaryStatus, setSetupChannelEnabled } from "openclaw/plugin-sdk/setup";
11
11
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
12
12
  import { detectBinary as detectBinary$1, resolveBrewExecutable } from "openclaw/plugin-sdk/setup-tools";
13
13
  import { PAIRING_APPROVED_MESSAGE } from "openclaw/plugin-sdk/channel-status";
14
14
  import { runPluginCommandWithTimeout } from "openclaw/plugin-sdk/run-command";
15
15
  //#region extensions/imessage/src/install-imsg.ts
16
- async function resolveBrewIMessageCliPath(brewExe) {
16
+ const IMESSAGE_BREW_FORMULA = "steipete/tap/imsg";
17
+ function isPathInside(parentPath, candidatePath) {
18
+ const relative = path.relative(parentPath, candidatePath);
19
+ return relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative);
20
+ }
21
+ async function resolveBrewManagedIMessageCliPath(brewExe, cliPath) {
17
22
  try {
18
- const result = await runPluginCommandWithTimeout({
23
+ const formulae = await runPluginCommandWithTimeout({
19
24
  argv: [
20
25
  brewExe,
21
- "--prefix",
22
- "imsg"
26
+ "list",
27
+ "--formula",
28
+ "--full-name"
23
29
  ],
24
30
  timeoutMs: 1e4
25
31
  });
32
+ const installed = formulae.stdout.split(/\r?\n/u).some((formula) => formula.trim() === IMESSAGE_BREW_FORMULA);
33
+ if (formulae.code !== 0 || !installed) return null;
34
+ let resolvedCliPath = cliPath;
35
+ if (!path.isAbsolute(resolvedCliPath)) {
36
+ const resolved = await runPluginCommandWithTimeout({
37
+ argv: [
38
+ "/usr/bin/env",
39
+ "which",
40
+ resolvedCliPath
41
+ ],
42
+ timeoutMs: 1e4
43
+ });
44
+ resolvedCliPath = resolved.code === 0 ? resolved.stdout.split(/\r?\n/u)[0]?.trim() ?? "" : "";
45
+ }
46
+ if (!resolvedCliPath) return null;
47
+ const cellar = await runPluginCommandWithTimeout({
48
+ argv: [brewExe, "--cellar"],
49
+ timeoutMs: 1e4
50
+ });
51
+ if (cellar.code !== 0 || !cellar.stdout.trim()) return null;
52
+ const [realCliPath, realFormulaPath] = await Promise.all([fs.realpath(resolvedCliPath), fs.realpath(path.join(cellar.stdout.trim(), "imsg"))]);
53
+ return isPathInside(realFormulaPath, realCliPath) ? resolvedCliPath : null;
54
+ } catch {
55
+ return null;
56
+ }
57
+ }
58
+ async function resolveBrewIMessageCliPath(brewExe) {
59
+ try {
60
+ const result = await runPluginCommandWithTimeout({
61
+ argv: [brewExe, "--prefix"],
62
+ timeoutMs: 1e4
63
+ });
26
64
  if (result.code !== 0 || !result.stdout.trim()) return null;
27
65
  const candidate = path.join(result.stdout.trim(), "bin", "imsg");
28
66
  await fs.access(candidate);
@@ -43,9 +81,13 @@ async function installIMessageCli(runtime, opts) {
43
81
  };
44
82
  runtime.log(`${opts?.upgrade ? "Updating" : "Installing"} imsg via Homebrew (${brewExe})...`);
45
83
  if (opts?.upgrade) {
84
+ if (!await resolveBrewManagedIMessageCliPath(brewExe, opts.cliPath ?? "imsg")) {
85
+ runtime.log("Keeping the detected imsg binary because Homebrew does not manage it.");
86
+ return { ok: true };
87
+ }
46
88
  const update = await runPluginCommandWithTimeout({
47
89
  argv: [brewExe, "update"],
48
- timeoutMs: 5 * 6e4
90
+ timeoutMs: 3e5
49
91
  });
50
92
  if (update.code !== 0) return {
51
93
  ok: false,
@@ -55,7 +97,7 @@ async function installIMessageCli(runtime, opts) {
55
97
  const command = opts?.upgrade ? ["upgrade", "imsg"] : ["install", "steipete/tap/imsg"];
56
98
  const result = await runPluginCommandWithTimeout({
57
99
  argv: [brewExe, ...command],
58
- timeoutMs: 15 * 6e4
100
+ timeoutMs: 9e5
59
101
  });
60
102
  if (result.code !== 0) return {
61
103
  ok: false,
@@ -131,11 +173,15 @@ const imessageSetupWizard = {
131
173
  })) return;
132
174
  try {
133
175
  await options?.beforePersistentEffect?.();
134
- const result = await installIMessageCli(runtime, { upgrade: cliDetected });
176
+ const result = await installIMessageCli(runtime, {
177
+ upgrade: cliDetected,
178
+ cliPath: normalizedCliPath
179
+ });
135
180
  if (result.ok && result.cliPath) {
136
181
  await prompter.note(`Installed imsg at ${result.cliPath}`, "iMessage");
137
182
  return { credentialValues: { cliPath: result.cliPath } };
138
183
  }
184
+ if (result.ok) await prompter.note(`Using existing imsg at ${normalizedCliPath}; Homebrew does not manage this binary.`, "iMessage");
139
185
  if (!result.ok) await prompter.note(result.error ?? "imsg install failed.", "iMessage");
140
186
  } catch (error) {
141
187
  await prompter.note(`imsg install failed: ${String(error)}`, "iMessage");
@@ -155,8 +201,7 @@ async function sendIMessageOutbound(params) {
155
201
  const send = resolveOutboundSendDep(params.deps, "imessage", { legacyKeys: IMESSAGE_LEGACY_OUTBOUND_SEND_DEP_KEYS }) ?? sendMessageIMessage;
156
202
  const maxBytes = resolveChannelMediaMaxBytes({
157
203
  cfg: params.cfg,
158
- resolveChannelLimitMb: ({ cfg, accountId }) => cfg.channels?.imessage?.accounts?.[accountId]?.mediaMaxMb ?? cfg.channels?.imessage?.mediaMaxMb,
159
- accountId: params.accountId
204
+ resolveChannelLimitMb: () => resolveIMessageAccount(params).config.mediaMaxMb
160
205
  });
161
206
  const result = await send(params.to, params.text, {
162
207
  config: params.cfg,
@@ -1,5 +1,5 @@
1
1
  import { createChannelConfigUiHints } from "openclaw/plugin-sdk/channel-core";
2
- import { ChannelDeliveryStreamingConfigSchema, ChannelSendReadReceiptsSchema, ExecutableTokenSchema, buildChannelConfigSchema, buildChannelReactionShape, buildCommonChannelAccountShape, buildGroupEntrySchema, isSafeScpRemoteHost, isValidInboundPathRootPattern, requireAllowlistAllowFrom, requireOpenAllowFrom } from "openclaw/plugin-sdk/channel-config-schema";
2
+ import { ChannelDeliveryStreamingConfigSchema, ChannelSendReadReceiptsSchema, ExecutableTokenSchema, buildChannelAccountSchemaParts, buildChannelConfigSchema, buildChannelReactionShape, buildGroupEntrySchema, isSafeScpRemoteHost, isValidInboundPathRootPattern, requireAllowlistAllowFrom, requireOpenAllowFrom } from "openclaw/plugin-sdk/channel-config-schema";
3
3
  import { z } from "zod";
4
4
  //#region extensions/imessage/src/config-ui-hints.ts
5
5
  const iMessageChannelConfigUiHints = {
@@ -43,13 +43,13 @@ const IMessageActionSchema = z.object({
43
43
  sendAttachment: z.boolean().optional(),
44
44
  polls: z.boolean().optional()
45
45
  }).strict().optional();
46
+ const { accountShape, rootPolicyShape } = buildChannelAccountSchemaParts({
47
+ omit: ["mentionPatterns", "replyToMode"],
48
+ streaming: ChannelDeliveryStreamingConfigSchema.optional(),
49
+ mediaMaxMb: z.number().int().positive().optional()
50
+ });
46
51
  const IMessageAccountSchemaBase = z.object({
47
- ...buildCommonChannelAccountShape({
48
- useDefaults: true,
49
- omit: ["mentionPatterns", "replyToMode"],
50
- streaming: ChannelDeliveryStreamingConfigSchema.optional(),
51
- mediaMaxMb: z.number().int().positive().optional()
52
- }),
52
+ ...accountShape,
53
53
  cliPath: ExecutableTokenSchema.optional(),
54
54
  dbPath: z.string().optional(),
55
55
  remoteHost: z.string().refine(isSafeScpRemoteHost, "expected SSH host or user@host (no spaces/options)").optional(),
@@ -89,6 +89,7 @@ const IMessageAccountSchemaBase = z.object({
89
89
  ] }).optional()).optional()
90
90
  }).strict();
91
91
  const IMessageConfigSchema = IMessageAccountSchemaBase.extend({
92
+ ...rootPolicyShape,
92
93
  accounts: z.record(z.string(), IMessageAccountSchemaBase.optional()).optional(),
93
94
  defaultAccount: z.string().optional()
94
95
  }).superRefine((value, ctx) => {
@@ -1,3 +1,3 @@
1
- import { n as resolveIMessageAttachmentRoots, r as resolveIMessageRemoteAttachmentRoots, t as DEFAULT_IMESSAGE_ATTACHMENT_ROOTS } from "./media-contract-BVXuQHG2.js";
1
+ import { n as resolveIMessageAttachmentRoots, r as resolveIMessageRemoteAttachmentRoots, t as DEFAULT_IMESSAGE_ATTACHMENT_ROOTS } from "./media-contract-pns3TSS5.js";
2
2
  import "./media-contract-api.js";
3
3
  export { DEFAULT_IMESSAGE_ATTACHMENT_ROOTS, resolveIMessageAttachmentRoots, resolveIMessageAttachmentRoots as resolveInboundAttachmentRoots, resolveIMessageRemoteAttachmentRoots, resolveIMessageRemoteAttachmentRoots as resolveRemoteInboundAttachmentRoots };