@openclaw/imessage 2026.10.10-beta.5 → 2026.11.5-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/dist/.setup/{accounts-DacCvDBt.mjs → accounts-C1Ypv3Wn.mjs} +9 -13
  2. package/dist/.setup/{actions-762Azi-J.mjs → actions-qOuKy8To.mjs} +364 -116
  3. package/dist/.setup/{actions.runtime-DHiRiPHe.mjs → actions.runtime-Ccg9CARL.mjs} +12 -61
  4. package/dist/.setup/{api-Deyo8NDs.mjs → api-BXXuQQCS.mjs} +8 -9
  5. package/dist/.setup/{api-BFGXDHiC.mjs → api-DTbxSOPc.mjs} +9 -9
  6. package/dist/.setup/{approval-handler.runtime-fsSBf2jf.mjs → approval-handler.runtime-B6vrFfZx.mjs} +113 -133
  7. package/dist/.setup/{approval-reactions-CoAkCiwf.mjs → approval-reactions-DBBsqbRC.mjs} +156 -79
  8. package/dist/.setup/{channel-C61YdcZR.mjs → channel-CLaN4mQn.mjs} +151 -137
  9. package/dist/.setup/{channel.runtime-B5jle0g3.mjs → channel.runtime-XJGx1MIH.mjs} +236 -425
  10. package/dist/.setup/chat-context-fTfJVqAi.mjs +77 -0
  11. package/dist/.setup/chat-lookup-xtPsOBkl.mjs +50 -0
  12. package/dist/.setup/client-D_BaG8sC.mjs +367 -0
  13. package/dist/.setup/{config-schema-DXwa_3V5.mjs → config-schema-BjkQV5P5.mjs} +1 -4
  14. package/dist/.setup/{conversation-bindings-DR-dbHjs.mjs → conversation-bindings-8DjxoIYU.mjs} +10 -8
  15. package/dist/.setup/{media-contract-BwWs5PM7.mjs → media-contract-BErFBKV9.mjs} +2 -3
  16. package/dist/.setup/{message-tool-api-B5NfPnFL.mjs → message-tool-api-DtZ1wKbT.mjs} +6 -12
  17. package/dist/.setup/{outbound-send-deps-B-QEsLSM.mjs → outbound-send-deps-_da8jqeo.mjs} +1 -2
  18. package/dist/.setup/{remote-file-B94a787O.mjs → remote-file-DpK3GQFD.mjs} +12 -30
  19. package/dist/.setup/{rolldown-runtime-BBjsoOtd.mjs → rolldown-runtime-782esTHO.mjs} +1 -2
  20. package/dist/.setup/{sanitize-outbound-BtEY324R.mjs → sanitize-outbound-Dhjhz0a-.mjs} +25 -31
  21. package/dist/.setup/{send-BvxKNWzF.mjs → send-DhEW0gfe.mjs} +155 -236
  22. package/dist/.setup/{setup-core-BHyLkAEJ.mjs → setup-core-B1_P_t4T.mjs} +3 -4
  23. package/dist/.setup/{setup-surface-DPqiLGy0.mjs → setup-surface-CD28mXWK.mjs} +13 -29
  24. package/dist/.setup/{targets-B4oU7n-v.mjs → targets-C7CIWJ0k.mjs} +15 -9
  25. package/dist/.source-module-urls/929c518fa2986b0f85f66bceefead22868db0ab452dee914dc6a2bb86b2e60ad.json +1 -1
  26. package/dist/api.js +9 -9
  27. package/dist/channel-config-api.js +1 -1
  28. package/dist/channel-plugin-api.js +1 -1
  29. package/dist/contract-api.js +1 -1
  30. package/dist/doctor-contract-api.js +7 -13
  31. package/dist/index.js +1 -2
  32. package/dist/media-contract-api.js +1 -1
  33. package/dist/message-tool-api.js +1 -1
  34. package/dist/runtime-api.js +1 -3
  35. package/dist/secret-contract-api.js +1 -2
  36. package/dist/session-binding-contract-api.js +1 -1
  37. package/dist/setup-entry.js +2 -3
  38. package/dist/src/chat-db.worker.js +2 -3
  39. package/node_modules/typebox/build/format/duration.d.mts +2 -2
  40. package/node_modules/typebox/build/format/duration.mjs +2 -2
  41. package/node_modules/typebox/build/format/idn_email.d.mts +1 -0
  42. package/node_modules/typebox/build/format/idn_email.mjs +1 -0
  43. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
  44. package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
  45. package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
  46. package/node_modules/typebox/build/format/ipv4.mjs +2 -2
  47. package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
  48. package/node_modules/typebox/build/format/ipv6.mjs +1 -1
  49. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
  50. package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
  51. package/node_modules/typebox/build/schema/build.mjs +1 -0
  52. package/node_modules/typebox/build/schema/engine/_unique.d.mts +4 -2
  53. package/node_modules/typebox/build/schema/engine/_unique.mjs +7 -3
  54. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
  55. package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +0 -3
  56. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +15 -17
  57. package/node_modules/typebox/build/schema/engine/contains.mjs +3 -3
  58. package/node_modules/typebox/build/schema/engine/index.d.mts +1 -0
  59. package/node_modules/typebox/build/schema/engine/index.mjs +1 -0
  60. package/node_modules/typebox/build/schema/engine/items.mjs +7 -4
  61. package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -2
  62. package/node_modules/typebox/build/schema/engine/minContains.mjs +3 -3
  63. package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
  64. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +2 -2
  65. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -2
  66. package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
  67. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
  68. package/node_modules/typebox/build/system/hashing/hash.mjs +63 -34
  69. package/node_modules/typebox/build/system/locale/en_US.mjs +2 -1
  70. package/node_modules/typebox/build/system/memory/assign.d.mts +2 -8
  71. package/node_modules/typebox/build/system/memory/assign.mjs +13 -6
  72. package/node_modules/typebox/build/system/memory/clone.d.mts +4 -5
  73. package/node_modules/typebox/build/system/memory/clone.mjs +8 -96
  74. package/node_modules/typebox/build/system/memory/create.d.mts +1 -5
  75. package/node_modules/typebox/build/system/memory/create.mjs +18 -13
  76. package/node_modules/typebox/build/system/memory/deep.d.mts +2 -0
  77. package/node_modules/typebox/build/system/memory/deep.mjs +108 -0
  78. package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
  79. package/node_modules/typebox/build/system/memory/discard.mjs +9 -8
  80. package/node_modules/typebox/build/system/memory/finalize.d.mts +4 -0
  81. package/node_modules/typebox/build/system/memory/finalize.mjs +30 -0
  82. package/node_modules/typebox/build/system/memory/keys.d.mts +2 -0
  83. package/node_modules/typebox/build/system/memory/keys.mjs +8 -0
  84. package/node_modules/typebox/build/system/memory/update.d.mts +1 -4
  85. package/node_modules/typebox/build/system/memory/update.mjs +43 -16
  86. package/node_modules/typebox/build/type/engine/call/index.d.mts +1 -0
  87. package/node_modules/typebox/build/type/engine/call/index.mjs +1 -0
  88. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +2 -24
  89. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +2 -29
  90. package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +1 -0
  91. package/node_modules/typebox/build/type/engine/evaluate/index.mjs +1 -0
  92. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -1
  93. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +6 -1
  94. package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +30 -0
  95. package/node_modules/typebox/build/type/engine/evaluate/property.mjs +29 -0
  96. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +1 -3
  97. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +1 -4
  98. package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
  99. package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
  100. package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
  101. package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  102. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +1 -3
  103. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +1 -4
  104. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +1 -3
  105. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +1 -4
  106. package/node_modules/typebox/build/type/engine/this/index.d.mts +1 -0
  107. package/node_modules/typebox/build/type/engine/this/index.mjs +1 -0
  108. package/node_modules/typebox/build/value/clone/clone.d.mts +4 -3
  109. package/node_modules/typebox/build/value/clone/clone.mjs +5 -7
  110. package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +2 -0
  111. package/node_modules/typebox/build/value/repair/from_cyclic.mjs +6 -0
  112. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +25 -14
  113. package/node_modules/typebox/package.json +1 -1
  114. package/node_modules/typebox/readme.md +1 -1
  115. package/node_modules/zod/package.json +1 -1
  116. package/node_modules/zod/src/v4/classic/tests/array.test.ts +27 -0
  117. package/node_modules/zod/src/v4/classic/tests/map.test.ts +7 -0
  118. package/node_modules/zod/src/v4/classic/tests/set.test.ts +6 -0
  119. package/node_modules/zod/src/v4/core/compile.ts +9 -0
  120. package/node_modules/zod/src/v4/core/schemas.ts +35 -1
  121. package/node_modules/zod/src/v4/core/util.ts +13 -0
  122. package/node_modules/zod/src/v4/core/versions.ts +1 -1
  123. package/node_modules/zod/v4/core/compile.cjs +8 -0
  124. package/node_modules/zod/v4/core/compile.js +8 -0
  125. package/node_modules/zod/v4/core/schemas.cjs +30 -0
  126. package/node_modules/zod/v4/core/schemas.d.cts +3 -1
  127. package/node_modules/zod/v4/core/schemas.d.ts +3 -1
  128. package/node_modules/zod/v4/core/schemas.js +30 -0
  129. package/node_modules/zod/v4/core/util.cjs +15 -0
  130. package/node_modules/zod/v4/core/util.d.cts +2 -0
  131. package/node_modules/zod/v4/core/util.d.ts +2 -0
  132. package/node_modules/zod/v4/core/util.js +14 -0
  133. package/node_modules/zod/v4/core/versions.cjs +1 -1
  134. package/node_modules/zod/v4/core/versions.js +1 -1
  135. package/openclaw.plugin.json +0 -30
  136. package/package.json +6 -6
  137. package/dist/.setup/client-CcROCvRq.mjs +0 -746
  138. package/dist/.setup/question-reactions-BD06B1Lx.mjs +0 -68
  139. package/dist/.setup/reaction-context-Q26DYzQH.mjs +0 -106
  140. package/dist/.setup/runtime-Cza4CY5T.mjs +0 -8
  141. package/node_modules/typebox/build/system/memory/freeze.d.mts +0 -4
  142. package/node_modules/typebox/build/system/memory/freeze.mjs +0 -6
@@ -1,15 +1,15 @@
1
- import { t as __exportAll } from "./rolldown-runtime-BBjsoOtd.mjs";
2
- import { c as parseIMessageTarget, o as normalizeIMessageHandle } from "./targets-B4oU7n-v.mjs";
3
- import { i as normalizeIMessageGuid } from "./actions-762Azi-J.mjs";
4
- import { n as getOptionalIMessageRuntime } from "./runtime-Cza4CY5T.mjs";
5
- import { d as getIMessageApprovalApprovers, f as imessageApprovalAuth } from "./channel-C61YdcZR.mjs";
6
- import { t as resolveIMessageReactionContext } from "./reaction-context-Q26DYzQH.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-782esTHO.mjs";
2
+ import { l as parseIMessageTarget, s as normalizeIMessageHandle } from "./targets-C7CIWJ0k.mjs";
3
+ import { t as chatContextFromIMessageTarget } from "./chat-context-fTfJVqAi.mjs";
4
+ import { g as getOptionalIMessageRuntime, y as normalizeIMessageGuid } from "./actions-qOuKy8To.mjs";
5
+ import { d as getIMessageApprovalApprovers, f as imessageApprovalAuth } from "./channel-CLaN4mQn.mjs";
7
6
  import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
8
7
  import { createLazyRuntimeSurface } from "openclaw/plugin-sdk/lazy-runtime";
9
- import { asDateTimestampMs, isFutureDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
8
+ import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
10
9
  import { addApprovalReactionHintToText, approvalReactionDecisionSetsMatch, buildApprovalReactionDeliveredBindingMarker, buildApprovalReactionHint, createApprovalReactionTargetStore, listApprovalReactionBindings, normalizeApprovalReactionDecision, readApprovalReactionDecisionList, readApprovalReactionDeliveredBinding, readApprovalReactionPresentationBinding, readApprovalReactionTargetRecord, resolveTypedApprovalReactionTarget, settleApprovalReaction } from "openclaw/plugin-sdk/approval-reaction-runtime";
10
+ import { asDateTimestampMs, isFutureDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
11
11
  import { createPluginStateErrorReporter } from "openclaw/plugin-sdk/plugin-state-runtime";
12
- //#region extensions/imessage/src/approval-target-keys.ts
12
+ // extensions/imessage/src/approval-target-keys.ts
13
13
  function chatIdToKeyValue(chatId) {
14
14
  if (chatId == null || chatId === "") return null;
15
15
  if (typeof chatId === "number") return Number.isFinite(chatId) && chatId > 0 ? String(chatId) : null;
@@ -46,9 +46,7 @@ function enumerateApprovalTargetKeys(params) {
46
46
  function buildIMessageApprovalConversationKeyForTarget(to) {
47
47
  try {
48
48
  const target = parseIMessageTarget(to);
49
- if (target.kind === "chat_id") return { chatId: target.chatId };
50
- if (target.kind === "chat_guid") return { chatGuid: target.chatGuid };
51
- if (target.kind === "chat_identifier") return { chatIdentifier: target.chatIdentifier };
49
+ if (target.kind !== "handle") return chatContextFromIMessageTarget(target);
52
50
  const handle = normalizeIMessageHandle(target.to);
53
51
  return handle ? { handle } : null;
54
52
  } catch {
@@ -69,8 +67,7 @@ function resolveIMessageApprovalControlActor(message) {
69
67
  const destination = normalizeIMessageHandle(message.destination_caller_id ?? "");
70
68
  return (message.is_from_me !== true && Boolean(sender) && sender === destination ? "" : sender) || (message.is_from_me === true ? destination : "");
71
69
  }
72
- //#endregion
73
- //#region extensions/imessage/src/approval-reaction-poll-targets.ts
70
+ // extensions/imessage/src/approval-reaction-poll-targets.ts
74
71
  const PERSISTENT_POLL_TARGET_NAMESPACE = "imessage.approval-reaction-poll-targets";
75
72
  const PERSISTENT_MAX_ENTRIES$1 = 1e3;
76
73
  const DEFAULT_REACTION_TARGET_TTL_MS$1 = 864e5;
@@ -206,18 +203,113 @@ async function listPendingIMessageApprovalReactionPollTargets(params) {
206
203
  }
207
204
  return [...targetByApprovalAndMessage.values()];
208
205
  }
209
- function clearIMessageApprovalReactionPollTargetsForTest() {
210
- pendingReactionPollTargets.clear();
211
- pendingReactionPollTargetStore = void 0;
206
+ // extensions/imessage/src/monitor/reaction-context.ts
207
+ const TAPBACK_TEXT_PATTERNS = [
208
+ {
209
+ prefix: "loved",
210
+ action: "added",
211
+ emoji: "❤️"
212
+ },
213
+ {
214
+ prefix: "liked",
215
+ action: "added",
216
+ emoji: "👍"
217
+ },
218
+ {
219
+ prefix: "disliked",
220
+ action: "added",
221
+ emoji: "👎"
222
+ },
223
+ {
224
+ prefix: "laughed at",
225
+ action: "added",
226
+ emoji: "😂"
227
+ },
228
+ {
229
+ prefix: "emphasized",
230
+ action: "added",
231
+ emoji: "‼️"
232
+ },
233
+ {
234
+ prefix: "questioned",
235
+ action: "added",
236
+ emoji: "❓"
237
+ },
238
+ {
239
+ prefix: "removed a heart from",
240
+ action: "removed",
241
+ emoji: "❤️"
242
+ },
243
+ {
244
+ prefix: "removed a like from",
245
+ action: "removed",
246
+ emoji: "👍"
247
+ },
248
+ {
249
+ prefix: "removed a dislike from",
250
+ action: "removed",
251
+ emoji: "👎"
252
+ },
253
+ {
254
+ prefix: "removed a laugh from",
255
+ action: "removed",
256
+ emoji: "😂"
257
+ },
258
+ {
259
+ prefix: "removed an emphasis from",
260
+ action: "removed",
261
+ emoji: "‼️"
262
+ },
263
+ {
264
+ prefix: "removed a question from",
265
+ action: "removed",
266
+ emoji: "❓"
267
+ }
268
+ ];
269
+ function normalizeReactionValue(value) {
270
+ return value ? normalizeIMessageGuid(value) || void 0 : void 0;
271
+ }
272
+ function resolveReactionTargetGuidCandidates(...values) {
273
+ const candidates = [];
274
+ for (const value of values) {
275
+ const raw = value?.trim();
276
+ if (!raw) continue;
277
+ const normalized = normalizeIMessageGuid(raw);
278
+ for (const candidate of [normalized, raw]) if (candidate && !candidates.includes(candidate)) candidates.push(candidate);
279
+ }
280
+ return candidates;
281
+ }
282
+ function resolveTapbackTextContext(bodyText) {
283
+ const lower = bodyText.toLowerCase();
284
+ for (const pattern of TAPBACK_TEXT_PATTERNS) {
285
+ if (!lower.startsWith(pattern.prefix)) continue;
286
+ const afterPrefix = bodyText.slice(pattern.prefix.length).trim();
287
+ if (!/^(?:"[\s\S]*"|“[\s\S]*”)$/u.test(afterPrefix)) continue;
288
+ return {
289
+ action: pattern.action,
290
+ emoji: pattern.emoji,
291
+ targetText: afterPrefix.slice(1, -1).trim()
292
+ };
293
+ }
294
+ return null;
295
+ }
296
+ function resolveIMessageReactionContext(message, bodyText) {
297
+ if (message.is_reaction === true || message.is_tapback === true || message.associated_message_type != null && Number.isFinite(message.associated_message_type) && message.associated_message_type >= 2e3 && message.associated_message_type < 4e3) {
298
+ const targetGuids = resolveReactionTargetGuidCandidates(message.reacted_to_guid, message.associated_message_guid);
299
+ return {
300
+ action: message.is_reaction_add === false ? "removed" : "added",
301
+ emoji: normalizeReactionValue(message.reaction_emoji) ?? normalizeReactionValue(message.reaction_type) ?? "reaction",
302
+ targetGuid: targetGuids[0],
303
+ targetGuids
304
+ };
305
+ }
306
+ return resolveTapbackTextContext(bodyText);
212
307
  }
213
- //#endregion
214
- //#region extensions/imessage/src/approval-reactions.ts
308
+ // extensions/imessage/src/approval-reactions.ts
215
309
  var approval_reactions_exports = /* @__PURE__ */ __exportAll({
216
310
  addIMessageApprovalReactionHintToStructuredPayload: () => addIMessageApprovalReactionHintToStructuredPayload,
217
311
  buildIMessageApprovalConversationKeyForTarget: () => buildIMessageApprovalConversationKeyForTarget,
218
- clearIMessageApprovalReactionTargetsForTest: () => clearIMessageApprovalReactionTargetsForTest,
219
312
  handleIMessageApprovalReaction: () => handleIMessageApprovalReaction,
220
- maybeResolveIMessageApprovalReaction: () => maybeResolveIMessageApprovalReaction,
221
313
  registerIMessageApprovalReactionTarget: () => registerIMessageApprovalReactionTarget,
222
314
  registerIMessageApprovalReactionTargetForDeliveredPayload: () => registerIMessageApprovalReactionTargetForDeliveredPayload,
223
315
  resolveIMessageApprovalReactionTargetWithPersistence: () => resolveIMessageApprovalReactionTargetWithPersistence,
@@ -449,65 +541,50 @@ async function handleIMessageApprovalReaction(params) {
449
541
  handled: false,
450
542
  stopPolling: false
451
543
  };
452
- const settlement = await settleApprovalReaction({
453
- request: {
454
- cfg: params.cfg,
455
- approvalId: target.approvalId,
456
- approvalKind: target.approvalKind,
457
- decision: target.decision,
458
- channel: "imessage",
459
- accountId: params.accountId,
460
- senderId: event.actorHandle,
461
- gatewayUrl: params.gatewayUrl,
462
- ...params.gatewayRuntime ? { gatewayRuntime: params.gatewayRuntime } : {}
463
- },
464
- approvers: getIMessageApprovalApprovers({
465
- cfg: params.cfg,
466
- accountId: params.accountId
467
- }),
468
- authorizeActorAction: (input) => imessageApprovalAuth.authorizeActorAction(input),
469
- loadResolver: loadResolveApprovalOverGateway,
470
- clearTarget: async () => {
471
- await Promise.all(event.messageIdCandidates.map((candidate) => unregisterIMessageApprovalReactionTarget({
472
- accountId: params.accountId,
473
- conversation: event.conversation,
474
- messageId: candidate
475
- })));
476
- },
477
- onResolved: (result) => {
478
- const outcome = result.applied ? "resolved" : "already resolved";
479
- params.logVerboseMessage?.(`imessage: approval reaction ${outcome} id=${target.approvalId} sender=${event.actorHandle} ${formatCanonicalApprovalTerminalState(result.approval)} via messageId=${matchedMessageId ?? event.messageId}`);
480
- },
481
- onError: (error) => {
482
- try {
483
- getOptionalIMessageRuntime()?.logging.getChildLogger({
484
- plugin: "imessage",
485
- feature: "approval-reactions"
486
- }).warn("approval reaction failed", {
487
- approvalId: target.approvalId,
488
- senderId: event.actorHandle,
489
- error: String(error)
490
- });
491
- } catch {}
492
- },
493
- logVerboseMessage: params.logVerboseMessage
494
- });
495
- return settlement === "denied" ? {
496
- handled: true,
497
- stopPolling: false
498
- } : {
544
+ return {
499
545
  handled: true,
500
- stopPolling: true,
501
- stopPollingReason: settlement
546
+ stopPolling: await settleApprovalReaction({
547
+ request: {
548
+ cfg: params.cfg,
549
+ approvalId: target.approvalId,
550
+ approvalKind: target.approvalKind,
551
+ decision: target.decision,
552
+ channel: "imessage",
553
+ accountId: params.accountId,
554
+ senderId: event.actorHandle,
555
+ ...params.gatewayRuntime ? { gatewayRuntime: params.gatewayRuntime } : {}
556
+ },
557
+ approvers: getIMessageApprovalApprovers({
558
+ cfg: params.cfg,
559
+ accountId: params.accountId
560
+ }),
561
+ authorizeActorAction: (input) => imessageApprovalAuth.authorizeActorAction(input),
562
+ loadResolver: loadResolveApprovalOverGateway,
563
+ clearTarget: async () => {
564
+ await Promise.all(event.messageIdCandidates.map((candidate) => unregisterIMessageApprovalReactionTarget({
565
+ accountId: params.accountId,
566
+ conversation: event.conversation,
567
+ messageId: candidate
568
+ })));
569
+ },
570
+ onResolved: (result) => {
571
+ const outcome = result.applied ? "resolved" : "already resolved";
572
+ logVerbose(`imessage: approval reaction ${outcome} id=${target.approvalId} sender=${event.actorHandle} ${formatCanonicalApprovalTerminalState(result.approval)} via messageId=${matchedMessageId ?? event.messageId}`);
573
+ },
574
+ onError: (error) => {
575
+ try {
576
+ getOptionalIMessageRuntime()?.logging.getChildLogger({
577
+ plugin: "imessage",
578
+ feature: "approval-reactions"
579
+ }).warn("approval reaction failed", {
580
+ approvalId: target.approvalId,
581
+ senderId: event.actorHandle,
582
+ error: String(error)
583
+ });
584
+ } catch {}
585
+ },
586
+ logVerboseMessage: logVerbose
587
+ }) !== "denied"
502
588
  };
503
589
  }
504
- async function maybeResolveIMessageApprovalReaction(params) {
505
- return (await handleIMessageApprovalReaction(params)).handled;
506
- }
507
- function clearIMessageApprovalReactionTargetsForTest() {
508
- imessageApprovalReactionTargets.clearForTest();
509
- clearIMessageApprovalReactionPollTargetsForTest();
510
- loadResolveApprovalOverGateway.clear();
511
- }
512
- //#endregion
513
- export { unregisterIMessageApprovalReactionTarget as a, buildIMessageApprovalConversationKeyForTarget as c, resolveIMessageApprovalControlActor as d, registerIMessageApprovalReactionTarget as i, enumerateApprovalTargetKeys as l, handleIMessageApprovalReaction as n, listPendingIMessageApprovalReactionPollTargets as o, maybeResolveIMessageApprovalReaction as r, buildIMessageApprovalConversationKeyForInbound as s, approval_reactions_exports as t, normalizeConversationKey as u };
590
+ export { resolveIMessageReactionContext as a, buildIMessageApprovalConversationKeyForTarget as c, resolveIMessageApprovalControlActor as d, unregisterIMessageApprovalReactionTarget as i, enumerateApprovalTargetKeys as l, handleIMessageApprovalReaction as n, listPendingIMessageApprovalReactionPollTargets as o, registerIMessageApprovalReactionTarget as r, buildIMessageApprovalConversationKeyForInbound as s, approval_reactions_exports as t, normalizeConversationKey as u };