@openclaw/imessage 2026.9.1-beta.1 → 2026.9.2

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 (47) hide show
  1. package/dist/{accounts-DIpGOIiN.js → accounts-CCirBEIm.js} +2 -3
  2. package/dist/{actions.runtime-BhggncbG.js → actions.runtime-D5MAgeSs.js} +5 -5
  3. package/dist/api.js +5 -5
  4. package/dist/{approval-handler.runtime-BC-YsgAf.js → approval-handler.runtime-47rs6THN.js} +14 -9
  5. package/dist/{approval-reactions-Cvwmdlev.js → approval-reactions-sVpDno7d.js} +8 -16
  6. package/dist/{channel-CnKQ2MVB.js → channel-BxraMrmK.js} +21 -14
  7. package/dist/channel-config-api.js +1 -1
  8. package/dist/channel-plugin-api.js +1 -1
  9. package/dist/{channel.runtime-BQLCh7bE.js → channel.runtime-2jwkMPGR.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-Cp8SDG4G.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-CESwxMQ4.js} +319 -48
  19. package/dist/{question-reactions-viP7ZcyG.js → question-reactions-9tBYB1_F.js} +4 -7
  20. package/dist/{reaction-context-BAYI7pz0.js → reaction-context-Br-vAJFp.js} +9 -3
  21. package/dist/{remote-file-CyTTuRAt.js → remote-file-Biz5PjXi.js} +5 -53
  22. package/dist/runtime-Cza4CY5T.js +8 -0
  23. package/dist/runtime-api.js +7 -7
  24. package/dist/{sanitize-outbound-g651fIhi.js → sanitize-outbound-Bvo4g1Mp.js} +470 -82
  25. package/dist/{send-DVQY6M5M.js → send-DC981dqK.js} +146 -23
  26. package/dist/state-contract-DvahEY4X.js +56 -0
  27. package/dist/state-migrations-D-fyHVcb.js +277 -0
  28. package/node_modules/typebox/build/format/email.mjs +1 -1
  29. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
  30. package/node_modules/typebox/build/format/json_pointer.d.mts +2 -2
  31. package/node_modules/typebox/build/format/json_pointer.mjs +2 -2
  32. package/node_modules/typebox/build/format/json_pointer_uri_fragment.d.mts +2 -2
  33. package/node_modules/typebox/build/format/json_pointer_uri_fragment.mjs +2 -2
  34. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
  35. package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
  36. package/node_modules/typebox/build/system/memory/assign.mjs +2 -1
  37. package/node_modules/typebox/build/system/memory/create.mjs +3 -4
  38. package/node_modules/typebox/build/system/memory/discard.mjs +2 -2
  39. package/node_modules/typebox/build/system/memory/freeze.d.mts +4 -0
  40. package/node_modules/typebox/build/system/memory/freeze.mjs +6 -0
  41. package/node_modules/typebox/build/system/memory/update.mjs +3 -2
  42. package/node_modules/typebox/package.json +1 -1
  43. package/openclaw.plugin.json +2 -7
  44. package/package.json +5 -5
  45. package/dist/catchup-Dh-Rv4Ur.js +0 -294
  46. package/dist/monitor-reply-cache-BdeUQaHO.js +0 -353
  47. 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 { n as sanitizeIMessageFinalOutboundText, o as createIMessageRpcClient, p as resolveIMessageMessageId, s as runIMessageCliJsonCommand, v as normalizeDirectChatIdentifier } from "./sanitize-outbound-Bvo4g1Mp.js";
2
+ import { n as authorizeIMessageResourceReference, t as withIMessageRemoteFile } from "./remote-file-Biz5PjXi.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 { m as DEFAULT_IMESSAGE_PROBE_TIMEOUT_MS } from "./sanitize-outbound-Bvo4g1Mp.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-Cp8SDG4G.js";
5
+ import { n as createIMessagePluginBase, r as imessageSetupWizard, t as imessagePlugin } from "./channel-BxraMrmK.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-Bvo4g1Mp.js";
4
+ import { c as normalizeIMessageMessagingTarget, l as getIMessageApprovalApprovers } from "./group-policy-Cp8SDG4G.js";
5
+ import { a as unregisterIMessageApprovalReactionTarget, c as buildIMessageApprovalConversationKeyForTarget, i as registerIMessageApprovalReactionTarget } from "./approval-reactions-sVpDno7d.js";
6
+ import { a as iMessageApprovalPollTargets, c as iMessageApprovalControlBindings, i as buildApprovalPollOptions, o as mapSentPollOptionsToDecisions, t as sendMessageIMessage } from "./send-DC981dqK.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-D5MAgeSs.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,8 +1,8 @@
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";
5
- import { t as resolveIMessageReactionContext } from "./reaction-context-BAYI7pz0.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-Cp8SDG4G.js";
4
+ import { n as getOptionalIMessageRuntime } from "./runtime-Cza4CY5T.js";
5
+ import { n as normalizeIMessageGuid, t as resolveIMessageReactionContext } from "./reaction-context-Br-vAJFp.js";
6
6
  import { createLazyRuntimeSurface } from "openclaw/plugin-sdk/lazy-runtime";
7
7
  import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
8
8
  import { asDateTimestampMs, isFutureDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
@@ -10,10 +10,6 @@ import { isApprovalNotFoundError } from "openclaw/plugin-sdk/error-runtime";
10
10
  import { addApprovalReactionHintToText, approvalReactionDecisionSetsMatch, buildApprovalReactionDeliveredBindingMarker, buildApprovalReactionHint, createApprovalReactionTargetStore, listApprovalReactionBindings, normalizeApprovalReactionDecision, readApprovalReactionDecisionList, readApprovalReactionDeliveredBinding, readApprovalReactionPresentationBinding, resolveTypedApprovalReactionTarget } from "openclaw/plugin-sdk/approval-reaction-runtime";
11
11
  import { createPluginStateErrorReporter } from "openclaw/plugin-sdk/plugin-state-runtime";
12
12
  //#region extensions/imessage/src/approval-target-keys.ts
13
- /** Strip the `p:<n>/` part prefix Messages puts on some GUIDs so keys match. */
14
- function normalizeIMessageGuid(value) {
15
- return value.trim().replace(/^p:\d+\//iu, "");
16
- }
17
13
  function chatIdToKeyValue(chatId) {
18
14
  if (chatId == null || chatId === "") return null;
19
15
  if (typeof chatId === "number") return Number.isFinite(chatId) && chatId > 0 ? String(chatId) : null;
@@ -72,7 +68,7 @@ function buildIMessageApprovalConversationKeyForInbound(params) {
72
68
  //#region extensions/imessage/src/approval-reaction-poll-targets.ts
73
69
  const PERSISTENT_POLL_TARGET_NAMESPACE = "imessage.approval-reaction-poll-targets";
74
70
  const PERSISTENT_MAX_ENTRIES$1 = 1e3;
75
- const DEFAULT_REACTION_TARGET_TTL_MS$1 = 1440 * 60 * 1e3;
71
+ const DEFAULT_REACTION_TARGET_TTL_MS$1 = 864e5;
76
72
  const pendingReactionPollTargets = /* @__PURE__ */ new Map();
77
73
  function prunePendingReactionPollTargets(nowMs = Date.now()) {
78
74
  for (const [key, target] of pendingReactionPollTargets.entries()) if (!isFutureDateTimestampMs(target.expiresAtMs, { nowMs })) pendingReactionPollTargets.delete(key);
@@ -226,7 +222,7 @@ var approval_reactions_exports = /* @__PURE__ */ __exportAll({
226
222
  });
227
223
  const PERSISTENT_NAMESPACE = "imessage.approval-reactions";
228
224
  const PERSISTENT_MAX_ENTRIES = 1e3;
229
- const DEFAULT_REACTION_TARGET_TTL_MS = 1440 * 60 * 1e3;
225
+ const DEFAULT_REACTION_TARGET_TTL_MS = 864e5;
230
226
  const loadResolveApprovalOverGateway = createLazyRuntimeSurface(() => import("openclaw/plugin-sdk/approval-gateway-runtime"), (runtime) => runtime.resolveApprovalOverGateway);
231
227
  const reportPersistentApprovalReactionError = createPluginStateErrorReporter(getOptionalIMessageRuntime, "imessage", "approval-reaction-state", "iMessage persistent approval reaction state failed");
232
228
  function reportApprovalBindingCorrelationMismatch(binding) {
@@ -547,11 +543,7 @@ async function handleIMessageApprovalReaction(params) {
547
543
  });
548
544
  } catch {}
549
545
  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
- };
546
+ throw error;
555
547
  }
556
548
  }
557
549
  async function maybeResolveIMessageApprovalReaction(params) {
@@ -563,4 +555,4 @@ function clearIMessageApprovalReactionTargetsForTest() {
563
555
  loadResolveApprovalOverGateway.clear();
564
556
  }
565
557
  //#endregion
566
- export { unregisterIMessageApprovalReactionTarget as a, buildIMessageApprovalConversationKeyForTarget as c, normalizeConversationKey as d, normalizeIMessageGuid as f, registerIMessageApprovalReactionTarget as i, enumerateApprovalTargetKeys as l, handleIMessageApprovalReaction as n, listPendingIMessageApprovalReactionPollTargets as o, maybeResolveIMessageApprovalReaction as r, buildIMessageApprovalConversationKeyForInbound as s, approval_reactions_exports as t, enumerateConversationKeyForms as u };
558
+ export { unregisterIMessageApprovalReactionTarget as a, buildIMessageApprovalConversationKeyForTarget as c, normalizeConversationKey as d, registerIMessageApprovalReactionTarget as i, enumerateApprovalTargetKeys as l, handleIMessageApprovalReaction as n, listPendingIMessageApprovalReactionPollTargets as o, maybeResolveIMessageApprovalReaction as r, buildIMessageApprovalConversationKeyForInbound as s, approval_reactions_exports as t, enumerateConversationKeyForms as u };
@@ -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, y as resolveIMessageDirectChatService } from "./sanitize-outbound-Bvo4g1Mp.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-Cp8SDG4G.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-47rs6THN.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-2jwkMPGR.js");
206
209
  }
207
210
  const imessageSetupWizard = createIMessageSetupWizardProxy(async () => (await loadIMessageChannelRuntime$1()).imessageSetupWizard);
208
211
  const imessageConfigAdapter = createScopedChannelConfigAdapter({
@@ -264,7 +267,10 @@ function createIMessagePluginBase(params) {
264
267
  effects: true,
265
268
  groupManagement: true
266
269
  },
267
- reload: { configPrefixes: ["channels.imessage"] },
270
+ reload: {
271
+ configPrefixes: ["channels.imessage"],
272
+ noopPrefixes: ["messages.inbound"]
273
+ },
268
274
  configSchema: IMessageChannelConfigSchema,
269
275
  config: {
270
276
  ...imessageConfigAdapter,
@@ -301,7 +307,7 @@ async function probeIMessageStatusAccount(params) {
301
307
  }
302
308
  //#endregion
303
309
  //#region extensions/imessage/src/channel.ts
304
- const loadIMessageChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-BQLCh7bE.js"));
310
+ const loadIMessageChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-2jwkMPGR.js"));
305
311
  function toIMessageMessageSendResult(result, kind, replyToId) {
306
312
  const receipt = result.receipt ?? createMessageReceiptFromOutboundResults({
307
313
  results: result.messageId ? [{
@@ -317,8 +323,8 @@ function toIMessageMessageSendResult(result, kind, replyToId) {
317
323
  ...result.meta && Object.keys(result.meta).length > 0 ? { meta: result.meta } : {}
318
324
  };
319
325
  }
320
- const loadIMessageApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-Cvwmdlev.js").then((n) => n.t));
321
- const loadIMessageQuestionReactionsModule = createLazyRuntimeModule(() => import("./question-reactions-viP7ZcyG.js").then((n) => n.r));
326
+ const loadIMessageApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-sVpDno7d.js").then((n) => n.t));
327
+ const loadIMessageQuestionReactionsModule = createLazyRuntimeModule(() => import("./question-reactions-9tBYB1_F.js").then((n) => n.r));
322
328
  async function prepareForwardedIMessageApprovalPayload(params) {
323
329
  const prepared = (await loadIMessageApprovalReactionsModule()).addIMessageApprovalReactionHintToStructuredPayload(params);
324
330
  if (prepared) Object.assign(params.payload, prepared);
@@ -466,6 +472,7 @@ const imessagePlugin = createChatChannelPlugin({
466
472
  resolveRequireMention: resolveIMessageGroupRequireMention,
467
473
  resolveToolPolicy: resolveIMessageGroupToolPolicy
468
474
  },
475
+ 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
476
  doctor: imessageDoctor,
470
477
  conversationBindings: {
471
478
  supportsCurrentConversationBinding: true,
@@ -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-BxraMrmK.js";
2
2
  export { imessagePlugin };
@@ -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-Cp8SDG4G.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-DC981dqK.js";
5
+ import { t as monitorIMessageProvider } from "./monitor-CESwxMQ4.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 };