@openclaw/imessage 2026.9.5 → 2026.9.7

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 (436) hide show
  1. package/assets/icon.png +0 -0
  2. package/dist/.setup/{accounts-Dv0uksBG.mjs → accounts-nzcU0cq2.mjs} +4 -7
  3. package/dist/.setup/{actions.runtime-B-qGAkYG.mjs → actions.runtime-DdBN29zj.mjs} +3 -5
  4. package/dist/.setup/{api-_NoJAo2x.mjs → api-B9Qx21G-.mjs} +6 -5
  5. package/dist/.setup/{api-DcUWvBmD.mjs → api-D2S6FhGw.mjs} +7 -7
  6. package/dist/.setup/{approval-handler.runtime-CkG235P7.mjs → approval-handler.runtime-DKSq0DWq.mjs} +9 -9
  7. package/dist/.setup/{approval-reactions-CX1-6KeG.mjs → approval-reactions-Bp33xc83.mjs} +5 -5
  8. package/dist/.setup/{channel-CCbYCQiN.mjs → channel-9fyvuN_p.mjs} +110 -152
  9. package/dist/.setup/channel.runtime-n-MPKL8k.mjs +92 -0
  10. package/dist/.setup/{config-schema-CCbTcJEV.mjs → config-schema-4Q3_EqYt.mjs} +9 -1
  11. package/dist/.setup/{group-policy-BoOAkmoQ.mjs → group-policy-90pw4tyG.mjs} +65 -335
  12. package/dist/.setup/{media-contract-BpPh5Oh1.mjs → media-contract-CagwSMvo.mjs} +1 -1
  13. package/dist/.setup/{message-tool-api-DZSH-2gY.mjs → message-tool-api-D032l82H.mjs} +3 -18
  14. package/dist/.setup/{monitor-CSeWJ3Qh.mjs → monitor-fv9nRuTH.mjs} +235 -344
  15. package/dist/.setup/{question-reactions-lm8OxWbb.mjs → question-reactions-Cy-dmU_j.mjs} +1 -1
  16. package/dist/.setup/{remote-file-4RbwiXYh.mjs → remote-file-DRPCaVmg.mjs} +70 -21
  17. package/dist/.setup/rolldown-runtime-BBjsoOtd.mjs +27 -0
  18. package/dist/.setup/{sanitize-outbound-o1ePXajW.mjs → sanitize-outbound-3MLljgtY.mjs} +86 -24
  19. package/dist/.setup/{send-DXiUWygv.mjs → send-Cu9nl757.mjs} +29 -94
  20. package/dist/.setup/setup-core-8MDdYHj5.mjs +226 -0
  21. package/dist/.setup/{channel.runtime-Kw4iCQax.mjs → setup-surface-tGXFDdWh.mjs} +6 -103
  22. package/dist/.setup/state-migrations-B-Q7bO0Y.mjs +47 -0
  23. package/dist/.setup/{targets-Cc9vthzI.mjs → targets-BicBiYsM.mjs} +10 -16
  24. package/dist/api.js +7 -7
  25. package/dist/channel-config-api.js +1 -1
  26. package/dist/channel-plugin-api.js +1 -1
  27. package/dist/contract-api.js +1 -1
  28. package/dist/doctor-contract-api.js +168 -7
  29. package/dist/media-contract-api.js +1 -1
  30. package/dist/message-tool-api.js +1 -1
  31. package/dist/runtime-api.js +6 -6
  32. package/dist/setup-entry.js +1 -1
  33. package/dist/src/{send-receipt-db.worker.js → chat-db.worker.js} +12 -2
  34. package/node_modules/typebox/build/compile/code.mjs +1 -2
  35. package/node_modules/typebox/build/compile/validator.mjs +5 -1
  36. package/node_modules/typebox/build/format/iri.mjs +16 -9
  37. package/node_modules/typebox/build/guard/emit.mjs +2 -2
  38. package/node_modules/typebox/build/guard/guard.d.mts +7 -5
  39. package/node_modules/typebox/build/guard/guard.mjs +14 -9
  40. package/node_modules/typebox/build/guard/index.mjs +6 -0
  41. package/node_modules/typebox/build/guard/unicode/unicode.d.mts +6 -0
  42. package/node_modules/typebox/build/guard/unicode/unicode.mjs +35 -0
  43. package/node_modules/typebox/build/guard/{string.mjs → unicode/unicode_segment.mjs} +16 -19
  44. package/node_modules/typebox/build/schema/build.mjs +2 -3
  45. package/node_modules/typebox/build/schema/engine/_pathing.d.mts +1 -0
  46. package/node_modules/typebox/build/schema/engine/_pathing.mjs +11 -0
  47. package/node_modules/typebox/build/schema/engine/_refine.mjs +13 -5
  48. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +2 -1
  49. package/node_modules/typebox/build/schema/engine/dependencies.mjs +2 -1
  50. package/node_modules/typebox/build/schema/engine/dependentSchemas.mjs +2 -1
  51. package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +1 -1
  52. package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +2 -2
  53. package/node_modules/typebox/build/schema/engine/format.mjs +9 -2
  54. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +3 -2
  55. package/node_modules/typebox/build/schema/engine/properties.mjs +3 -2
  56. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -1
  57. package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +1 -1
  58. package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +2 -2
  59. package/node_modules/typebox/build/schema/engine/ref.d.mts +1 -1
  60. package/node_modules/typebox/build/schema/engine/ref.mjs +2 -2
  61. package/node_modules/typebox/build/schema/engine/schema.mjs +24 -24
  62. package/node_modules/typebox/build/schema/parse.mjs +3 -0
  63. package/node_modules/typebox/build/schema/pointer/pointer.d.mts +1 -6
  64. package/node_modules/typebox/build/schema/pointer/pointer.mjs +47 -64
  65. package/node_modules/typebox/build/system/settings/internal.d.mts +2 -0
  66. package/node_modules/typebox/build/system/settings/internal.mjs +20 -0
  67. package/node_modules/typebox/build/system/settings/settings.d.mts +11 -0
  68. package/node_modules/typebox/build/system/settings/settings.mjs +14 -0
  69. package/node_modules/typebox/build/type/extends/inference.d.mts +1 -1
  70. package/node_modules/typebox/build/type/extends/inference.mjs +15 -2
  71. package/node_modules/typebox/build/type/extends/tuple.d.mts +2 -1
  72. package/node_modules/typebox/build/type/extends/tuple.mjs +21 -1
  73. package/node_modules/typebox/build/value/parse/parse.mjs +10 -4
  74. package/node_modules/typebox/package.json +1 -1
  75. package/node_modules/typebox/readme.md +3 -1
  76. package/node_modules/zod/README.md +2 -2
  77. package/node_modules/zod/compile.cjs +19 -0
  78. package/node_modules/zod/index.cjs +19 -0
  79. package/node_modules/zod/locales/index.cjs +19 -0
  80. package/node_modules/zod/mini/index.cjs +19 -0
  81. package/node_modules/zod/package.json +8 -7
  82. package/node_modules/zod/src/v3/helpers/errorUtil.ts +1 -1
  83. package/node_modules/zod/src/v4/classic/external.ts +2 -0
  84. package/node_modules/zod/src/v4/classic/from-json-schema.ts +248 -25
  85. package/node_modules/zod/src/v4/classic/schemas.ts +243 -168
  86. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +60 -9
  87. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +6 -0
  88. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +2 -2
  89. package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +265 -0
  90. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +112 -6
  91. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +9 -0
  92. package/node_modules/zod/src/v4/classic/tests/error.test.ts +130 -1
  93. package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +157 -0
  94. package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
  95. package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +40 -2
  96. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +27 -7
  97. package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +88 -56
  98. package/node_modules/zod/src/v4/classic/tests/number.test.ts +39 -0
  99. package/node_modules/zod/src/v4/classic/tests/object.test.ts +56 -0
  100. package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +3 -2
  101. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +70 -0
  102. package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
  103. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +46 -1
  104. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +19 -0
  105. package/node_modules/zod/src/v4/classic/tests/string.test.ts +95 -1
  106. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +33 -1
  107. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +234 -38
  108. package/node_modules/zod/src/v4/classic/tests/validate.test.ts +569 -0
  109. package/node_modules/zod/src/v4/core/api.ts +44 -28
  110. package/node_modules/zod/src/v4/core/checks.ts +62 -102
  111. package/node_modules/zod/src/v4/core/compile.ts +218 -93
  112. package/node_modules/zod/src/v4/core/core.ts +1 -3
  113. package/node_modules/zod/src/v4/core/doc.ts +6 -2
  114. package/node_modules/zod/src/v4/core/errors.ts +3 -6
  115. package/node_modules/zod/src/v4/core/json-schema-generator.ts +2 -2
  116. package/node_modules/zod/src/v4/core/json-schema-processors.ts +185 -81
  117. package/node_modules/zod/src/v4/core/memoizer.ts +75 -28
  118. package/node_modules/zod/src/v4/core/parse.ts +37 -16
  119. package/node_modules/zod/src/v4/core/regexes.ts +14 -4
  120. package/node_modules/zod/src/v4/core/schemas.ts +296 -132
  121. package/node_modules/zod/src/v4/core/tests/cached.test.ts +54 -0
  122. package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +35 -0
  123. package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
  124. package/node_modules/zod/src/v4/core/tests/compile.test.ts +399 -2
  125. package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
  126. package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
  127. package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
  128. package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +118 -16
  129. package/node_modules/zod/src/v4/core/to-json-schema.ts +9 -7
  130. package/node_modules/zod/src/v4/core/util.ts +218 -147
  131. package/node_modules/zod/src/v4/core/versions.ts +2 -2
  132. package/node_modules/zod/src/v4/locales/ar.ts +2 -0
  133. package/node_modules/zod/src/v4/locales/az.ts +2 -0
  134. package/node_modules/zod/src/v4/locales/be.ts +2 -0
  135. package/node_modules/zod/src/v4/locales/bg.ts +2 -0
  136. package/node_modules/zod/src/v4/locales/bn.ts +2 -0
  137. package/node_modules/zod/src/v4/locales/ca.ts +2 -0
  138. package/node_modules/zod/src/v4/locales/ckb.ts +2 -0
  139. package/node_modules/zod/src/v4/locales/cs.ts +2 -0
  140. package/node_modules/zod/src/v4/locales/da.ts +2 -0
  141. package/node_modules/zod/src/v4/locales/de.ts +2 -0
  142. package/node_modules/zod/src/v4/locales/el.ts +2 -0
  143. package/node_modules/zod/src/v4/locales/en.ts +2 -0
  144. package/node_modules/zod/src/v4/locales/eo.ts +2 -0
  145. package/node_modules/zod/src/v4/locales/es.ts +2 -0
  146. package/node_modules/zod/src/v4/locales/fa.ts +2 -0
  147. package/node_modules/zod/src/v4/locales/fi.ts +2 -0
  148. package/node_modules/zod/src/v4/locales/fr-CA.ts +2 -0
  149. package/node_modules/zod/src/v4/locales/fr.ts +2 -0
  150. package/node_modules/zod/src/v4/locales/gu.ts +2 -0
  151. package/node_modules/zod/src/v4/locales/he.ts +2 -0
  152. package/node_modules/zod/src/v4/locales/hi.ts +2 -0
  153. package/node_modules/zod/src/v4/locales/hr.ts +2 -0
  154. package/node_modules/zod/src/v4/locales/hu.ts +2 -0
  155. package/node_modules/zod/src/v4/locales/hy.ts +2 -0
  156. package/node_modules/zod/src/v4/locales/id.ts +2 -0
  157. package/node_modules/zod/src/v4/locales/index.ts +1 -0
  158. package/node_modules/zod/src/v4/locales/is.ts +2 -0
  159. package/node_modules/zod/src/v4/locales/it.ts +2 -0
  160. package/node_modules/zod/src/v4/locales/ja.ts +2 -0
  161. package/node_modules/zod/src/v4/locales/ka.ts +2 -0
  162. package/node_modules/zod/src/v4/locales/km.ts +2 -0
  163. package/node_modules/zod/src/v4/locales/kn.ts +2 -0
  164. package/node_modules/zod/src/v4/locales/ko.ts +2 -0
  165. package/node_modules/zod/src/v4/locales/lt.ts +2 -0
  166. package/node_modules/zod/src/v4/locales/mk.ts +2 -0
  167. package/node_modules/zod/src/v4/locales/ms.ts +2 -0
  168. package/node_modules/zod/src/v4/locales/ne.ts +2 -0
  169. package/node_modules/zod/src/v4/locales/nl.ts +2 -0
  170. package/node_modules/zod/src/v4/locales/nn.ts +2 -0
  171. package/node_modules/zod/src/v4/locales/no.ts +2 -0
  172. package/node_modules/zod/src/v4/locales/ota.ts +2 -0
  173. package/node_modules/zod/src/v4/locales/pl.ts +2 -0
  174. package/node_modules/zod/src/v4/locales/ps.ts +2 -0
  175. package/node_modules/zod/src/v4/locales/pt-BR.ts +2 -0
  176. package/node_modules/zod/src/v4/locales/pt.ts +2 -0
  177. package/node_modules/zod/src/v4/locales/ro.ts +2 -0
  178. package/node_modules/zod/src/v4/locales/ru.ts +2 -0
  179. package/node_modules/zod/src/v4/locales/sk.ts +2 -0
  180. package/node_modules/zod/src/v4/locales/sl.ts +2 -0
  181. package/node_modules/zod/src/v4/locales/sv.ts +2 -0
  182. package/node_modules/zod/src/v4/locales/ta.ts +2 -0
  183. package/node_modules/zod/src/v4/locales/tg.ts +135 -0
  184. package/node_modules/zod/src/v4/locales/th.ts +2 -0
  185. package/node_modules/zod/src/v4/locales/tk.ts +2 -0
  186. package/node_modules/zod/src/v4/locales/tr.ts +2 -0
  187. package/node_modules/zod/src/v4/locales/uk.ts +2 -0
  188. package/node_modules/zod/src/v4/locales/ur.ts +2 -0
  189. package/node_modules/zod/src/v4/locales/uz.ts +2 -0
  190. package/node_modules/zod/src/v4/locales/vi.ts +2 -0
  191. package/node_modules/zod/src/v4/locales/yo.ts +2 -0
  192. package/node_modules/zod/src/v4/locales/zh-CN.ts +2 -0
  193. package/node_modules/zod/src/v4/locales/zh-TW.ts +2 -0
  194. package/node_modules/zod/src/v4/mini/external.ts +2 -0
  195. package/node_modules/zod/src/v4/mini/schemas.ts +32 -7
  196. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +1 -1
  197. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +11 -17
  198. package/node_modules/zod/src/v4/mini/tests/index.test.ts +86 -0
  199. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +16 -0
  200. package/node_modules/zod/src/v4/mini/tests/string.test.ts +23 -0
  201. package/node_modules/zod/v3/ZodError.cjs +19 -0
  202. package/node_modules/zod/v3/errors.cjs +19 -0
  203. package/node_modules/zod/v3/external.cjs +19 -0
  204. package/node_modules/zod/v3/helpers/enumUtil.cjs +19 -0
  205. package/node_modules/zod/v3/helpers/errorUtil.cjs +20 -1
  206. package/node_modules/zod/v3/helpers/errorUtil.js +1 -1
  207. package/node_modules/zod/v3/helpers/parseUtil.cjs +19 -0
  208. package/node_modules/zod/v3/helpers/partialUtil.cjs +19 -0
  209. package/node_modules/zod/v3/helpers/typeAliases.cjs +19 -0
  210. package/node_modules/zod/v3/helpers/util.cjs +19 -0
  211. package/node_modules/zod/v3/index.cjs +19 -0
  212. package/node_modules/zod/v3/standard-schema.cjs +19 -0
  213. package/node_modules/zod/v3/types.cjs +19 -0
  214. package/node_modules/zod/v4/classic/checks.cjs +19 -0
  215. package/node_modules/zod/v4/classic/coerce.cjs +19 -0
  216. package/node_modules/zod/v4/classic/compat.cjs +19 -0
  217. package/node_modules/zod/v4/classic/deep-partial.cjs +19 -0
  218. package/node_modules/zod/v4/classic/errors.cjs +19 -0
  219. package/node_modules/zod/v4/classic/external.cjs +22 -1
  220. package/node_modules/zod/v4/classic/external.d.cts +1 -1
  221. package/node_modules/zod/v4/classic/external.d.ts +1 -1
  222. package/node_modules/zod/v4/classic/external.js +1 -1
  223. package/node_modules/zod/v4/classic/from-json-schema.cjs +264 -24
  224. package/node_modules/zod/v4/classic/from-json-schema.js +245 -24
  225. package/node_modules/zod/v4/classic/in-out.cjs +19 -0
  226. package/node_modules/zod/v4/classic/index.cjs +19 -0
  227. package/node_modules/zod/v4/classic/iso.cjs +19 -0
  228. package/node_modules/zod/v4/classic/parse.cjs +19 -0
  229. package/node_modules/zod/v4/classic/schemas.cjs +100 -35
  230. package/node_modules/zod/v4/classic/schemas.d.cts +15 -1
  231. package/node_modules/zod/v4/classic/schemas.d.ts +15 -1
  232. package/node_modules/zod/v4/classic/schemas.js +77 -33
  233. package/node_modules/zod/v4/core/api.cjs +45 -22
  234. package/node_modules/zod/v4/core/api.d.cts +12 -6
  235. package/node_modules/zod/v4/core/api.d.ts +12 -6
  236. package/node_modules/zod/v4/core/api.js +25 -22
  237. package/node_modules/zod/v4/core/checks.cjs +51 -97
  238. package/node_modules/zod/v4/core/checks.d.cts +17 -1
  239. package/node_modules/zod/v4/core/checks.d.ts +17 -1
  240. package/node_modules/zod/v4/core/checks.js +31 -96
  241. package/node_modules/zod/v4/core/compile.cjs +173 -78
  242. package/node_modules/zod/v4/core/compile.d.cts +18 -4
  243. package/node_modules/zod/v4/core/compile.d.ts +18 -4
  244. package/node_modules/zod/v4/core/compile.js +154 -79
  245. package/node_modules/zod/v4/core/core.cjs +20 -1
  246. package/node_modules/zod/v4/core/core.js +1 -1
  247. package/node_modules/zod/v4/core/doc.cjs +26 -2
  248. package/node_modules/zod/v4/core/doc.js +7 -2
  249. package/node_modules/zod/v4/core/errors.cjs +21 -5
  250. package/node_modules/zod/v4/core/errors.js +2 -5
  251. package/node_modules/zod/v4/core/index.cjs +19 -0
  252. package/node_modules/zod/v4/core/json-schema-generator.cjs +20 -1
  253. package/node_modules/zod/v4/core/json-schema-generator.js +2 -2
  254. package/node_modules/zod/v4/core/json-schema-processors.cjs +188 -72
  255. package/node_modules/zod/v4/core/json-schema-processors.d.cts +16 -0
  256. package/node_modules/zod/v4/core/json-schema-processors.d.ts +16 -0
  257. package/node_modules/zod/v4/core/json-schema-processors.js +170 -74
  258. package/node_modules/zod/v4/core/json-schema.cjs +19 -0
  259. package/node_modules/zod/v4/core/memoizer.cjs +111 -23
  260. package/node_modules/zod/v4/core/memoizer.js +69 -23
  261. package/node_modules/zod/v4/core/parse.cjs +56 -16
  262. package/node_modules/zod/v4/core/parse.js +37 -16
  263. package/node_modules/zod/v4/core/regexes.cjs +31 -6
  264. package/node_modules/zod/v4/core/regexes.d.cts +3 -0
  265. package/node_modules/zod/v4/core/regexes.d.ts +3 -0
  266. package/node_modules/zod/v4/core/regexes.js +10 -4
  267. package/node_modules/zod/v4/core/registries.cjs +19 -0
  268. package/node_modules/zod/v4/core/schemas.cjs +302 -114
  269. package/node_modules/zod/v4/core/schemas.d.cts +28 -8
  270. package/node_modules/zod/v4/core/schemas.d.ts +28 -8
  271. package/node_modules/zod/v4/core/schemas.js +279 -113
  272. package/node_modules/zod/v4/core/standard-schema.cjs +19 -0
  273. package/node_modules/zod/v4/core/to-json-schema.cjs +28 -7
  274. package/node_modules/zod/v4/core/to-json-schema.d.cts +4 -3
  275. package/node_modules/zod/v4/core/to-json-schema.d.ts +4 -3
  276. package/node_modules/zod/v4/core/to-json-schema.js +7 -6
  277. package/node_modules/zod/v4/core/util.cjs +177 -143
  278. package/node_modules/zod/v4/core/util.d.cts +25 -4
  279. package/node_modules/zod/v4/core/util.d.ts +25 -4
  280. package/node_modules/zod/v4/core/util.js +156 -143
  281. package/node_modules/zod/v4/core/versions.cjs +21 -2
  282. package/node_modules/zod/v4/core/versions.d.cts +1 -1
  283. package/node_modules/zod/v4/core/versions.d.ts +1 -1
  284. package/node_modules/zod/v4/core/versions.js +2 -2
  285. package/node_modules/zod/v4/core/visit.cjs +19 -0
  286. package/node_modules/zod/v4/index.cjs +19 -0
  287. package/node_modules/zod/v4/locales/ar.cjs +2 -0
  288. package/node_modules/zod/v4/locales/ar.js +2 -0
  289. package/node_modules/zod/v4/locales/az.cjs +2 -0
  290. package/node_modules/zod/v4/locales/az.js +2 -0
  291. package/node_modules/zod/v4/locales/be.cjs +2 -0
  292. package/node_modules/zod/v4/locales/be.js +2 -0
  293. package/node_modules/zod/v4/locales/bg.cjs +2 -0
  294. package/node_modules/zod/v4/locales/bg.js +2 -0
  295. package/node_modules/zod/v4/locales/bn.cjs +2 -0
  296. package/node_modules/zod/v4/locales/bn.js +2 -0
  297. package/node_modules/zod/v4/locales/ca.cjs +2 -0
  298. package/node_modules/zod/v4/locales/ca.js +2 -0
  299. package/node_modules/zod/v4/locales/ckb.cjs +2 -0
  300. package/node_modules/zod/v4/locales/ckb.js +2 -0
  301. package/node_modules/zod/v4/locales/cs.cjs +2 -0
  302. package/node_modules/zod/v4/locales/cs.js +2 -0
  303. package/node_modules/zod/v4/locales/da.cjs +2 -0
  304. package/node_modules/zod/v4/locales/da.js +2 -0
  305. package/node_modules/zod/v4/locales/de.cjs +2 -0
  306. package/node_modules/zod/v4/locales/de.js +2 -0
  307. package/node_modules/zod/v4/locales/el.cjs +2 -0
  308. package/node_modules/zod/v4/locales/el.js +2 -0
  309. package/node_modules/zod/v4/locales/en.cjs +2 -0
  310. package/node_modules/zod/v4/locales/en.js +2 -0
  311. package/node_modules/zod/v4/locales/eo.cjs +2 -0
  312. package/node_modules/zod/v4/locales/eo.js +2 -0
  313. package/node_modules/zod/v4/locales/es.cjs +2 -0
  314. package/node_modules/zod/v4/locales/es.js +2 -0
  315. package/node_modules/zod/v4/locales/fa.cjs +2 -0
  316. package/node_modules/zod/v4/locales/fa.js +2 -0
  317. package/node_modules/zod/v4/locales/fi.cjs +2 -0
  318. package/node_modules/zod/v4/locales/fi.js +2 -0
  319. package/node_modules/zod/v4/locales/fr-CA.cjs +2 -0
  320. package/node_modules/zod/v4/locales/fr-CA.js +2 -0
  321. package/node_modules/zod/v4/locales/fr.cjs +2 -0
  322. package/node_modules/zod/v4/locales/fr.js +2 -0
  323. package/node_modules/zod/v4/locales/gu.cjs +2 -0
  324. package/node_modules/zod/v4/locales/gu.js +2 -0
  325. package/node_modules/zod/v4/locales/he.cjs +2 -0
  326. package/node_modules/zod/v4/locales/he.js +2 -0
  327. package/node_modules/zod/v4/locales/hi.cjs +2 -0
  328. package/node_modules/zod/v4/locales/hi.js +2 -0
  329. package/node_modules/zod/v4/locales/hr.cjs +2 -0
  330. package/node_modules/zod/v4/locales/hr.js +2 -0
  331. package/node_modules/zod/v4/locales/hu.cjs +2 -0
  332. package/node_modules/zod/v4/locales/hu.js +2 -0
  333. package/node_modules/zod/v4/locales/hy.cjs +2 -0
  334. package/node_modules/zod/v4/locales/hy.js +2 -0
  335. package/node_modules/zod/v4/locales/id.cjs +2 -0
  336. package/node_modules/zod/v4/locales/id.js +2 -0
  337. package/node_modules/zod/v4/locales/index.cjs +22 -1
  338. package/node_modules/zod/v4/locales/index.d.cts +1 -0
  339. package/node_modules/zod/v4/locales/index.d.ts +1 -0
  340. package/node_modules/zod/v4/locales/index.js +1 -0
  341. package/node_modules/zod/v4/locales/is.cjs +2 -0
  342. package/node_modules/zod/v4/locales/is.js +2 -0
  343. package/node_modules/zod/v4/locales/it.cjs +2 -0
  344. package/node_modules/zod/v4/locales/it.js +2 -0
  345. package/node_modules/zod/v4/locales/ja.cjs +2 -0
  346. package/node_modules/zod/v4/locales/ja.js +2 -0
  347. package/node_modules/zod/v4/locales/ka.cjs +2 -0
  348. package/node_modules/zod/v4/locales/ka.js +2 -0
  349. package/node_modules/zod/v4/locales/km.cjs +2 -0
  350. package/node_modules/zod/v4/locales/km.js +2 -0
  351. package/node_modules/zod/v4/locales/kn.cjs +2 -0
  352. package/node_modules/zod/v4/locales/kn.js +2 -0
  353. package/node_modules/zod/v4/locales/ko.cjs +2 -0
  354. package/node_modules/zod/v4/locales/ko.js +2 -0
  355. package/node_modules/zod/v4/locales/lt.cjs +2 -0
  356. package/node_modules/zod/v4/locales/lt.js +2 -0
  357. package/node_modules/zod/v4/locales/mk.cjs +2 -0
  358. package/node_modules/zod/v4/locales/mk.js +2 -0
  359. package/node_modules/zod/v4/locales/ms.cjs +2 -0
  360. package/node_modules/zod/v4/locales/ms.js +2 -0
  361. package/node_modules/zod/v4/locales/ne.cjs +2 -0
  362. package/node_modules/zod/v4/locales/ne.js +2 -0
  363. package/node_modules/zod/v4/locales/nl.cjs +2 -0
  364. package/node_modules/zod/v4/locales/nl.js +2 -0
  365. package/node_modules/zod/v4/locales/nn.cjs +2 -0
  366. package/node_modules/zod/v4/locales/nn.js +2 -0
  367. package/node_modules/zod/v4/locales/no.cjs +2 -0
  368. package/node_modules/zod/v4/locales/no.js +2 -0
  369. package/node_modules/zod/v4/locales/ota.cjs +2 -0
  370. package/node_modules/zod/v4/locales/ota.js +2 -0
  371. package/node_modules/zod/v4/locales/pl.cjs +2 -0
  372. package/node_modules/zod/v4/locales/pl.js +2 -0
  373. package/node_modules/zod/v4/locales/ps.cjs +2 -0
  374. package/node_modules/zod/v4/locales/ps.js +2 -0
  375. package/node_modules/zod/v4/locales/pt-BR.cjs +2 -0
  376. package/node_modules/zod/v4/locales/pt-BR.js +2 -0
  377. package/node_modules/zod/v4/locales/pt.cjs +2 -0
  378. package/node_modules/zod/v4/locales/pt.js +2 -0
  379. package/node_modules/zod/v4/locales/ro.cjs +2 -0
  380. package/node_modules/zod/v4/locales/ro.js +2 -0
  381. package/node_modules/zod/v4/locales/ru.cjs +2 -0
  382. package/node_modules/zod/v4/locales/ru.js +2 -0
  383. package/node_modules/zod/v4/locales/sk.cjs +2 -0
  384. package/node_modules/zod/v4/locales/sk.js +2 -0
  385. package/node_modules/zod/v4/locales/sl.cjs +2 -0
  386. package/node_modules/zod/v4/locales/sl.js +2 -0
  387. package/node_modules/zod/v4/locales/sv.cjs +2 -0
  388. package/node_modules/zod/v4/locales/sv.js +2 -0
  389. package/node_modules/zod/v4/locales/ta.cjs +2 -0
  390. package/node_modules/zod/v4/locales/ta.js +2 -0
  391. package/node_modules/zod/v4/locales/tg.cjs +144 -0
  392. package/node_modules/zod/v4/locales/tg.d.cts +5 -0
  393. package/node_modules/zod/v4/locales/tg.d.ts +4 -0
  394. package/node_modules/zod/v4/locales/tg.js +117 -0
  395. package/node_modules/zod/v4/locales/th.cjs +2 -0
  396. package/node_modules/zod/v4/locales/th.js +2 -0
  397. package/node_modules/zod/v4/locales/tk.cjs +2 -0
  398. package/node_modules/zod/v4/locales/tk.js +2 -0
  399. package/node_modules/zod/v4/locales/tr.cjs +2 -0
  400. package/node_modules/zod/v4/locales/tr.js +2 -0
  401. package/node_modules/zod/v4/locales/uk.cjs +2 -0
  402. package/node_modules/zod/v4/locales/uk.js +2 -0
  403. package/node_modules/zod/v4/locales/ur.cjs +2 -0
  404. package/node_modules/zod/v4/locales/ur.js +2 -0
  405. package/node_modules/zod/v4/locales/uz.cjs +2 -0
  406. package/node_modules/zod/v4/locales/uz.js +2 -0
  407. package/node_modules/zod/v4/locales/vi.cjs +2 -0
  408. package/node_modules/zod/v4/locales/vi.js +2 -0
  409. package/node_modules/zod/v4/locales/yo.cjs +2 -0
  410. package/node_modules/zod/v4/locales/yo.js +2 -0
  411. package/node_modules/zod/v4/locales/zh-CN.cjs +2 -0
  412. package/node_modules/zod/v4/locales/zh-CN.js +2 -0
  413. package/node_modules/zod/v4/locales/zh-TW.cjs +2 -0
  414. package/node_modules/zod/v4/locales/zh-TW.js +2 -0
  415. package/node_modules/zod/v4/mini/checks.cjs +19 -0
  416. package/node_modules/zod/v4/mini/coerce.cjs +19 -0
  417. package/node_modules/zod/v4/mini/deep-partial.cjs +19 -0
  418. package/node_modules/zod/v4/mini/external.cjs +22 -1
  419. package/node_modules/zod/v4/mini/external.d.cts +1 -1
  420. package/node_modules/zod/v4/mini/external.d.ts +1 -1
  421. package/node_modules/zod/v4/mini/external.js +1 -1
  422. package/node_modules/zod/v4/mini/in-out.cjs +19 -0
  423. package/node_modules/zod/v4/mini/index.cjs +19 -0
  424. package/node_modules/zod/v4/mini/iso.cjs +19 -0
  425. package/node_modules/zod/v4/mini/parse.cjs +19 -0
  426. package/node_modules/zod/v4/mini/schemas.cjs +44 -8
  427. package/node_modules/zod/v4/mini/schemas.d.cts +6 -1
  428. package/node_modules/zod/v4/mini/schemas.d.ts +6 -1
  429. package/node_modules/zod/v4/mini/schemas.js +21 -6
  430. package/node_modules/zod/v4-mini/index.cjs +19 -0
  431. package/openclaw.plugin.json +14 -0
  432. package/package.json +7 -7
  433. package/dist/.setup/rolldown-runtime-D7D4PA-g.mjs +0 -13
  434. package/dist/.setup/state-contract-DvahEY4X.mjs +0 -56
  435. package/dist/.setup/state-migrations-CIwg07l5.mjs +0 -277
  436. /package/node_modules/typebox/build/guard/{string.d.mts → unicode/unicode_segment.d.mts} +0 -0
@@ -1,4 +1,4 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-BBjsoOtd.mjs";
2
2
  import { n as normalizeIMessageGuid, t as resolveIMessageReactionContext } from "./reaction-context-Br-vAJFp.mjs";
3
3
  import { createQuestionReactionTargetStore, questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
4
4
  //#region extensions/imessage/src/question-reactions.ts
@@ -1,13 +1,68 @@
1
- import { p as resolveLocalIMessageChatDbPath } from "./accounts-Dv0uksBG.mjs";
2
- import { _ as chatContextFromIMessageTarget, m as resolveIMessageMessageId, p as resolveIMessageCachedResourceBinding, v as isIMessageEmailChatIdentifier } from "./sanitize-outbound-o1ePXajW.mjs";
1
+ import { p as resolveLocalIMessageChatDbPath } from "./accounts-nzcU0cq2.mjs";
2
+ import { T as isIMessageEmailChatIdentifier, m as resolveIMessageMessageId, p as resolveIMessageCachedResourceBinding, w as chatContextFromIMessageTarget } from "./sanitize-outbound-3MLljgtY.mjs";
3
3
  import path from "node:path";
4
4
  import { normalizeScpRemoteHost } from "openclaw/plugin-sdk/host-runtime";
5
- import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
6
5
  import { createActionGate } from "openclaw/plugin-sdk/channel-actions";
6
+ import { createSubsystemLogger, logVerbose } from "openclaw/plugin-sdk/runtime-env";
7
7
  import { randomUUID } from "node:crypto";
8
- import { runCommandWithTimeout } from "openclaw/plugin-sdk/process-runtime";
9
- import { openNodeSqliteDatabase } from "openclaw/plugin-sdk/sqlite-runtime";
8
+ import { resolveRuntimeWorkerUrl, runCommandWithTimeout } from "openclaw/plugin-sdk/process-runtime";
9
+ import { openSqliteWorkerStore } from "openclaw/plugin-sdk/sqlite-runtime";
10
10
  import { sanitizeTempFileName } from "openclaw/plugin-sdk/temp-path";
11
+ //#region extensions/imessage/src/chat-db.ts
12
+ function openIMessageChatDbReader(databasePath) {
13
+ return openSqliteWorkerStore({
14
+ moduleUrl: resolveRuntimeWorkerUrl({
15
+ currentModuleUrl: import.meta.url,
16
+ sourceWorkerName: "chat-db.worker",
17
+ distWorkerPath: "extensions/imessage/src/chat-db.worker.js",
18
+ package: {
19
+ name: "@openclaw/imessage",
20
+ distWorkerPath: "src/chat-db.worker.js"
21
+ }
22
+ }),
23
+ databasePath,
24
+ existingOnly: true,
25
+ input: void 0
26
+ });
27
+ }
28
+ async function resolveIMessageStartupRowidWatermark(dbPath) {
29
+ let store;
30
+ try {
31
+ store = await openIMessageChatDbReader(dbPath);
32
+ if (!store) throw new Error("Messages database is unavailable");
33
+ return await store.execute({
34
+ type: "startupWatermark",
35
+ input: void 0
36
+ });
37
+ } catch (err) {
38
+ logVerbose(`imessage: startup rowid watermark unavailable for db=${dbPath}: ${String(err)}`);
39
+ return null;
40
+ } finally {
41
+ await store?.close();
42
+ }
43
+ }
44
+ async function withIMessageReceiptGuidReader(databasePath, use) {
45
+ let store;
46
+ let closed = false;
47
+ const read = async (command) => {
48
+ if (closed) throw new Error("iMessage receipt lookup is closed");
49
+ try {
50
+ store ??= await openIMessageChatDbReader(databasePath);
51
+ return store ? await store.execute(command) : null;
52
+ } catch {
53
+ return null;
54
+ }
55
+ };
56
+ try {
57
+ return await use(read);
58
+ } finally {
59
+ closed = true;
60
+ try {
61
+ await store?.close();
62
+ } catch {}
63
+ }
64
+ }
65
+ //#endregion
11
66
  //#region extensions/imessage/src/message-resource-db.ts
12
67
  function normalizeIMessageMessageGuidForLookup(messageId) {
13
68
  const trimmed = messageId.trim();
@@ -53,7 +108,7 @@ function matchesAnyChatCandidate(stored, candidates) {
53
108
  if (typeof stored !== "string") return false;
54
109
  return candidates.some((candidate) => matchesChatCandidate(stored, candidate));
55
110
  }
56
- function checkIMessageResourceBinding(params) {
111
+ async function checkIMessageResourceBinding(params) {
57
112
  const dbPath = resolveLocalIMessageChatDbPath(params);
58
113
  if (!dbPath) return "unavailable";
59
114
  const messageGuid = normalizeIMessageMessageGuidForLookup(params.messageId);
@@ -64,25 +119,19 @@ function checkIMessageResourceBinding(params) {
64
119
  const chatId = params.chatContext.chatId;
65
120
  const hasChatId = typeof chatId === "number" && Number.isSafeInteger(chatId) && chatId > 0;
66
121
  if (!hasChatId && expectedChatGuids.length === 0 && expectedChatIdentifiers.length === 0 && identifierChatGuids.length === 0) return "unavailable";
67
- let db;
122
+ let store;
68
123
  try {
69
- db = openNodeSqliteDatabase(dbPath, { readOnly: true });
70
- return db.prepare(`SELECT cmj.chat_id AS chatId,
71
- c.guid AS chatGuid,
72
- c.chat_identifier AS chatIdentifier
73
- FROM message m
74
- JOIN chat_message_join cmj ON cmj.message_id = m.ROWID
75
- JOIN chat c ON c.ROWID = cmj.chat_id
76
- WHERE m.guid = ?`).all(messageGuid).map((row) => ({
77
- chatId: row.chatId,
78
- chatGuid: row.chatGuid,
79
- chatIdentifier: row.chatIdentifier
124
+ store = await openIMessageChatDbReader(dbPath);
125
+ if (!store) return "unavailable";
126
+ return (await store.execute({
127
+ type: "messageChats",
128
+ input: { messageGuid }
80
129
  })).some((row) => (!hasChatId || row.chatId === chatId) && (expectedChatGuids.length === 0 || matchesAnyChatCandidate(row.chatGuid, expectedChatGuids)) && (expectedChatIdentifiers.length === 0 || matchesAnyChatCandidate(row.chatIdentifier, expectedChatIdentifiers)) && (identifierChatGuids.length === 0 || matchesAnyChatCandidate(row.chatGuid, identifierChatGuids))) ? "match" : "mismatch";
81
130
  } catch {
82
131
  return "unavailable";
83
132
  } finally {
84
133
  try {
85
- db?.close();
134
+ await store?.close();
86
135
  } catch {}
87
136
  }
88
137
  }
@@ -131,7 +180,7 @@ async function authorizeIMessageResourceReference(params) {
131
180
  if (cacheBinding === "unknown" && normalizedMessageId !== params.messageId.trim()) cacheBinding = await resolveIMessageCachedResourceBinding(normalizedMessageId, cacheContext);
132
181
  if (cacheBinding === "match") return;
133
182
  if (cacheBinding === "mismatch") throw new Error("iMessage message reference belongs to a different account or conversation.");
134
- const providerBinding = params.hasExclusiveLocalDatabase ? checkIMessageResourceBinding(params) : "unavailable";
183
+ const providerBinding = params.hasExclusiveLocalDatabase ? await checkIMessageResourceBinding(params) : "unavailable";
135
184
  if (providerBinding === "match") return;
136
185
  if (providerBinding === "mismatch") throw new Error("iMessage message reference does not belong to the selected conversation.");
137
186
  if (params.conversationReadOrigin === "direct-operator") return;
@@ -245,4 +294,4 @@ rm -rf -- ${remoteDir}
245
294
  }
246
295
  }
247
296
  //#endregion
248
- export { authorizeIMessageResourceReference as n, resolveAuthorizedIMessageReplyReference as r, withIMessageRemoteFile as t };
297
+ export { withIMessageReceiptGuidReader as a, resolveIMessageStartupRowidWatermark as i, authorizeIMessageResourceReference as n, resolveAuthorizedIMessageReplyReference as r, withIMessageRemoteFile as t };
@@ -0,0 +1,27 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __exportAll = (all, no_symbols) => {
7
+ let target = {};
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
13
+ return target;
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
17
+ key = keys[i];
18
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
+ get: ((k) => from[k]).bind(null, key),
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ }
23
+ return to;
24
+ };
25
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
26
+ //#endregion
27
+ export { __reExport as n, __exportAll as t };
@@ -1,10 +1,10 @@
1
- import { u as expandIMessageUserPath } from "./accounts-Dv0uksBG.mjs";
2
- import { i as invalidateCachedIMessagePrivateApiStatus } from "./message-tool-api-DZSH-2gY.mjs";
1
+ import { u as expandIMessageUserPath } from "./accounts-nzcU0cq2.mjs";
2
+ import { i as invalidateCachedIMessagePrivateApiStatus } from "./message-tool-api-D032l82H.mjs";
3
3
  import { t as getIMessageRuntime } from "./runtime-Cza4CY5T.mjs";
4
- import { a as IMESSAGE_REPLY_CACHE_NAMESPACE, f as resolveIMessageReplyCacheEntryKey, i as IMESSAGE_REPLY_CACHE_MAX_ENTRIES, n as IMESSAGE_REPLY_CACHE_COUNTER_KEY, o as IMESSAGE_REPLY_CACHE_TTL_MS, r as IMESSAGE_REPLY_CACHE_COUNTER_NAMESPACE } from "./state-contract-DvahEY4X.mjs";
5
4
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
6
5
  import { normalizeE164 } from "openclaw/plugin-sdk/account-resolution";
7
6
  import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
7
+ import { createHash } from "node:crypto";
8
8
  import { runCommandWithTimeout } from "openclaw/plugin-sdk/process-runtime";
9
9
  import { resolveUserPath } from "openclaw/plugin-sdk/text-utility-runtime";
10
10
  import { spawn } from "node:child_process";
@@ -98,6 +98,60 @@ function isPositiveIMessageChatMatch(cached, current) {
98
98
  const DEFAULT_IMESSAGE_PROBE_TIMEOUT_MS = 1e4;
99
99
  const DEFAULT_IMESSAGE_SEND_TIMEOUT_MS = 18e4;
100
100
  //#endregion
101
+ //#region extensions/imessage/src/state-contract.ts
102
+ const IMESSAGE_REPLY_CACHE_NAMESPACE = "imessage.reply-cache";
103
+ const IMESSAGE_REPLY_CACHE_MAX_ENTRIES = 2e3;
104
+ const IMESSAGE_REPLY_CACHE_COUNTER_NAMESPACE = "imessage.reply-cache-counter";
105
+ const IMESSAGE_REPLY_CACHE_COUNTER_KEY = "short-id-counter";
106
+ const IMESSAGE_REPLY_CACHE_TTL_MS = 216e5;
107
+ function resolveIMessageReplyCacheEntryKey(messageId) {
108
+ return createHash("sha256").update(messageId, "utf8").digest("hex").slice(0, 32);
109
+ }
110
+ const MAX_FAILURE_RETRY_MAP_SIZE = 512;
111
+ const MAX_FAILURE_RETRY_MAP_JSON_BYTES = 48e3;
112
+ const textEncoder = new TextEncoder();
113
+ const IMESSAGE_CATCHUP_CURSOR_NAMESPACE = "imessage.catchup-cursors";
114
+ function resolveIMessageCatchupCursorKey(accountId) {
115
+ return createHash("sha256").update(accountId, "utf8").digest("hex").slice(0, 32);
116
+ }
117
+ /**
118
+ * Bound the retry map so a pathological storm of unique failing GUIDs
119
+ * cannot grow the cursor value without limit. Keeps the `maxSize` entries
120
+ * with the highest counts (closest to give-up) when over the bound.
121
+ */
122
+ function capFailureRetriesMap(map, maxSize = MAX_FAILURE_RETRY_MAP_SIZE, maxBytes = MAX_FAILURE_RETRY_MAP_JSON_BYTES) {
123
+ const entries = Object.entries(map);
124
+ if (entries.length <= maxSize && textEncoder.encode(JSON.stringify(map)).byteLength <= maxBytes) return map;
125
+ entries.sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]));
126
+ const capped = {};
127
+ for (const [guid, count] of entries.slice(0, maxSize)) {
128
+ capped[guid] = count;
129
+ if (textEncoder.encode(JSON.stringify(capped)).byteLength > maxBytes) {
130
+ delete capped[guid];
131
+ break;
132
+ }
133
+ }
134
+ return capped;
135
+ }
136
+ const IMESSAGE_SENT_ECHOES_TTL_MS = 432e5;
137
+ const IMESSAGE_SENT_ECHOES_NAMESPACE = "imessage.sent-echoes";
138
+ function resolveIMessageSentEchoEntryKey(entry) {
139
+ return createHash("sha256").update(JSON.stringify([
140
+ entry.scope,
141
+ entry.text ?? "",
142
+ resolveIMessageEchoMediaKey(entry.media) ?? "",
143
+ entry.messageId ?? "",
144
+ entry.timestamp
145
+ ])).digest("hex").slice(0, 32);
146
+ }
147
+ function resolveIMessageEchoMediaKey(media) {
148
+ const contentType = media?.contentType?.trim().toLowerCase() || void 0;
149
+ const kind = media?.kind && media.kind !== "unknown" ? media.kind : void 0;
150
+ if (kind) return `kind:${kind}`;
151
+ const normalizedContentType = contentType?.split(";", 1)[0]?.trim();
152
+ return normalizedContentType ? `mime:${normalizedContentType}` : void 0;
153
+ }
154
+ //#endregion
101
155
  //#region extensions/imessage/src/monitor-reply-cache.ts
102
156
  /** Recency window for the "react to the latest message" fallback. */
103
157
  const LATEST_FALLBACK_MS = 6e5;
@@ -109,7 +163,6 @@ function reportPersistenceFailure(scope, err) {
109
163
  }
110
164
  const imessageReplyCacheByMessageId = /* @__PURE__ */ new Map();
111
165
  const imessageShortIdToUuid = /* @__PURE__ */ new Map();
112
- const imessageUuidToShortId = /* @__PURE__ */ new Map();
113
166
  let imessageShortIdCounter = 0;
114
167
  function openReplyCacheStore() {
115
168
  return getIMessageRuntime().state.openKeyedStore({
@@ -135,12 +188,11 @@ function hydrateCounter(counter) {
135
188
  }
136
189
  function hydrateRows(entries) {
137
190
  const cutoff = Date.now() - IMESSAGE_REPLY_CACHE_TTL_MS;
138
- for (const entry of entries.filter((cached) => cached.timestamp >= cutoff).toSorted((a, b) => a.timestamp - b.timestamp).slice(-IMESSAGE_REPLY_CACHE_MAX_ENTRIES)) {
191
+ for (const entry of entries.filter((cached) => cached.timestamp >= cutoff).toSorted((a, b) => a.timestamp - b.timestamp).slice(-2e3)) {
139
192
  const numeric = Number.parseInt(entry.shortId, 10);
140
193
  if (Number.isFinite(numeric) && numeric > imessageShortIdCounter) imessageShortIdCounter = numeric;
141
194
  imessageReplyCacheByMessageId.set(entry.messageId, entry);
142
195
  imessageShortIdToUuid.set(entry.shortId, entry.messageId);
143
- imessageUuidToShortId.set(entry.messageId, entry.shortId);
144
196
  }
145
197
  }
146
198
  async function hydrateFromStoreOnce() {
@@ -221,12 +273,11 @@ async function rememberIMessageReplyCache(entry) {
221
273
  ...entry,
222
274
  shortId: ""
223
275
  };
224
- let shortId = imessageUuidToShortId.get(messageId);
276
+ let shortId = imessageReplyCacheByMessageId.get(messageId)?.shortId;
225
277
  const isNewMessage = !shortId;
226
278
  if (!shortId) {
227
279
  shortId = generateShortId();
228
280
  imessageShortIdToUuid.set(shortId, messageId);
229
- imessageUuidToShortId.set(messageId, shortId);
230
281
  }
231
282
  const fullEntry = buildReplyCacheEntry(entry, messageId, shortId);
232
283
  imessageReplyCacheByMessageId.delete(messageId);
@@ -237,10 +288,7 @@ async function rememberIMessageReplyCache(entry) {
237
288
  if (value.timestamp >= cutoff) break;
238
289
  imessageReplyCacheByMessageId.delete(key);
239
290
  deletedMessageIds.push(key);
240
- if (value.shortId) {
241
- imessageShortIdToUuid.delete(value.shortId);
242
- imessageUuidToShortId.delete(key);
243
- }
291
+ if (value.shortId) imessageShortIdToUuid.delete(value.shortId);
244
292
  }
245
293
  while (imessageReplyCacheByMessageId.size > IMESSAGE_REPLY_CACHE_MAX_ENTRIES) {
246
294
  const oldest = imessageReplyCacheByMessageId.keys().next().value;
@@ -248,10 +296,7 @@ async function rememberIMessageReplyCache(entry) {
248
296
  const oldEntry = imessageReplyCacheByMessageId.get(oldest);
249
297
  imessageReplyCacheByMessageId.delete(oldest);
250
298
  deletedMessageIds.push(oldest);
251
- if (oldEntry?.shortId) {
252
- imessageShortIdToUuid.delete(oldEntry.shortId);
253
- imessageUuidToShortId.delete(oldest);
254
- }
299
+ if (oldEntry?.shortId) imessageShortIdToUuid.delete(oldEntry.shortId);
255
300
  }
256
301
  const counter = imessageShortIdCounter;
257
302
  persistence = persistence.then(async () => {
@@ -314,8 +359,23 @@ async function isKnownFromMeIMessageMessageId(messageId, ctx) {
314
359
  if (!trimmed || !ctx.accountId || !hasChatScope(ctx)) return false;
315
360
  await hydrateFromStoreOnce();
316
361
  const cached = imessageReplyCacheByMessageId.get(trimmed);
317
- if (!cached || cached.isFromMe !== true || cached.accountId !== ctx.accountId) return false;
318
- return isPositiveIMessageChatMatch(cached, ctx);
362
+ if (!cached || cached.isFromMe !== true) return false;
363
+ return resolveCachedResourceBinding(trimmed, {
364
+ ...ctx,
365
+ accountId: ctx.accountId
366
+ }) === "match";
367
+ }
368
+ async function isKnownFromMeIMessageTarget(params) {
369
+ const { accountId, chatId, chatGuid, chatIdentifier } = params;
370
+ const ctx = {
371
+ accountId,
372
+ chatId,
373
+ chatGuid,
374
+ chatIdentifier
375
+ };
376
+ const isKnownFromMe = params.isKnownFromMeMessageId ?? isKnownFromMeIMessageMessageId;
377
+ for (const messageId of params.messageIds) if (await isKnownFromMe(messageId, ctx)) return true;
378
+ return false;
319
379
  }
320
380
  function buildFromMeError(inputId, inputKind) {
321
381
  return /* @__PURE__ */ new Error(`iMessage message id ${describeMessageIdForError(inputId, inputKind)} is not one this agent sent. edit and unsend can only target messages the gateway delivered itself; messages received from other participants cannot be modified.`);
@@ -360,9 +420,7 @@ function resolveCachedResourceBinding(messageId, ctx) {
360
420
  if (!entry) return "unknown";
361
421
  if (Date.now() - entry.timestamp > 216e5) return "unknown";
362
422
  if (entry.accountId !== ctx.accountId) return "mismatch";
363
- const chatMatch = resolveIMessageChatMatch(entry, ctx);
364
- if (chatMatch !== "match") return chatMatch;
365
- return "match";
423
+ return resolveIMessageChatMatch(entry, ctx);
366
424
  }
367
425
  /** @deprecated Used only by hosts without asynchronous conversation matching. */
368
426
  function isIMessageCurrentMessageInChat(params) {
@@ -457,6 +515,7 @@ function recoverIMessageBridge(cliPath) {
457
515
  }
458
516
  //#endregion
459
517
  //#region extensions/imessage/src/client.ts
518
+ const IMSG_APPLE_FRAMEWORK_STDERR_PATTERN = /^(?:\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ imsg\[\d+:\d+\] )?Could not fetch group for change type \d+ with identifier [^:]+:ABGroup, making it a delete change type\.$/u;
460
519
  var IMessageRpcRequestError = class extends Error {
461
520
  constructor(message, code, data) {
462
521
  super(message);
@@ -466,8 +525,7 @@ var IMessageRpcRequestError = class extends Error {
466
525
  }
467
526
  };
468
527
  function isIMessageBridgeStall(error) {
469
- if (!(error instanceof Error)) return false;
470
- return error.message.includes("Timed out waiting for response");
528
+ return error instanceof Error && error.message.includes("Timed out waiting for response");
471
529
  }
472
530
  const BRIDGE_STALL_GUIDANCE = "The imsg private API bridge stopped responding. Run `imsg launch` to re-inject the dylib, then `openclaw channels status --probe` to refresh capability detection.";
473
531
  function describeIMessageBridgeStall(error) {
@@ -671,6 +729,10 @@ var IMessageRpcClient = class {
671
729
  const trimmed = line.trim();
672
730
  if (!trimmed) return;
673
731
  this.recordProcessDiagnostic(trimmed);
732
+ if (IMSG_APPLE_FRAMEWORK_STDERR_PATTERN.test(trimmed)) {
733
+ logVerbose(`imsg rpc: ${trimmed}`);
734
+ return;
735
+ }
674
736
  this.runtime?.error?.(`imsg rpc: ${trimmed}`);
675
737
  }
676
738
  handleLine(line) {
@@ -1313,4 +1375,4 @@ function sanitizeOutboundText(text) {
1313
1375
  return cleaned;
1314
1376
  }
1315
1377
  //#endregion
1316
- export { chatContextFromIMessageTarget as _, IMessageRpcRequestError as a, resolveIMessageDirectChatService as b, findLatestIMessageEntryForChat as c, isKnownFromMeIMessageMessageId as d, rememberIMessageReplyCache as f, DEFAULT_IMESSAGE_SEND_TIMEOUT_MS as g, DEFAULT_IMESSAGE_PROBE_TIMEOUT_MS as h, extractMarkdownFormatRuns as i, isIMessageCurrentMessageInChat as l, resolveIMessageMessageId as m, sanitizeIMessageFinalOutboundText as n, createIMessageRpcClient as o, resolveIMessageCachedResourceBinding as p, sanitizeOutboundText as r, runIMessageCliJsonCommand as s, protectIMessageFencedRoleMarkers as t, isIMessageCurrentMessageInChatAsync as u, isIMessageEmailChatIdentifier as v, normalizeDirectChatIdentifier as y };
1378
+ export { DEFAULT_IMESSAGE_SEND_TIMEOUT_MS as C, resolveIMessageDirectChatService as D, normalizeDirectChatIdentifier as E, DEFAULT_IMESSAGE_PROBE_TIMEOUT_MS as S, isIMessageEmailChatIdentifier as T, IMESSAGE_SENT_ECHOES_TTL_MS as _, IMessageRpcRequestError as a, resolveIMessageEchoMediaKey as b, findLatestIMessageEntryForChat as c, isKnownFromMeIMessageTarget as d, rememberIMessageReplyCache as f, IMESSAGE_SENT_ECHOES_NAMESPACE as g, IMESSAGE_CATCHUP_CURSOR_NAMESPACE as h, extractMarkdownFormatRuns as i, isIMessageCurrentMessageInChat as l, resolveIMessageMessageId as m, sanitizeIMessageFinalOutboundText as n, createIMessageRpcClient as o, resolveIMessageCachedResourceBinding as p, sanitizeOutboundText as r, runIMessageCliJsonCommand as s, protectIMessageFencedRoleMarkers as t, isIMessageCurrentMessageInChatAsync as u, capFailureRetriesMap as v, chatContextFromIMessageTarget as w, resolveIMessageSentEchoEntryKey as x, resolveIMessageCatchupCursorKey as y };
@@ -1,26 +1,23 @@
1
- import { c as parseIMessageTarget, o as normalizeIMessageHandle, t as formatIMessageChatTarget } from "./targets-Cc9vthzI.mjs";
2
- import { d as resolveIMessageChatDbLookupPath, l as resolveIMessageRemoteHost, n as hasExclusiveIMessageLocalDatabase, o as resolveIMessageAccount } from "./accounts-Dv0uksBG.mjs";
3
- import { _ as chatContextFromIMessageTarget, a as IMessageRpcRequestError, b as resolveIMessageDirectChatService, f as rememberIMessageReplyCache, n as sanitizeIMessageFinalOutboundText, o as createIMessageRpcClient, s as runIMessageCliJsonCommand, t as protectIMessageFencedRoleMarkers } from "./sanitize-outbound-o1ePXajW.mjs";
4
- import { c as imessageApprovalAuth, s as getIMessageApprovalApprovers } from "./group-policy-BoOAkmoQ.mjs";
1
+ import { c as parseIMessageTarget, o as normalizeIMessageHandle, t as formatIMessageChatTarget } from "./targets-BicBiYsM.mjs";
2
+ import { d as resolveIMessageChatDbLookupPath, l as resolveIMessageRemoteHost, n as hasExclusiveIMessageLocalDatabase, o as resolveIMessageAccount } from "./accounts-nzcU0cq2.mjs";
3
+ import { D as resolveIMessageDirectChatService, _ as IMESSAGE_SENT_ECHOES_TTL_MS, a as IMessageRpcRequestError, b as resolveIMessageEchoMediaKey, f as rememberIMessageReplyCache, g as IMESSAGE_SENT_ECHOES_NAMESPACE, n as sanitizeIMessageFinalOutboundText, o as createIMessageRpcClient, s as runIMessageCliJsonCommand, t as protectIMessageFencedRoleMarkers, w as chatContextFromIMessageTarget, x as resolveIMessageSentEchoEntryKey } from "./sanitize-outbound-3MLljgtY.mjs";
4
+ import { c as getIMessageApprovalApprovers, l as imessageApprovalAuth } from "./group-policy-90pw4tyG.mjs";
5
5
  import { n as getOptionalIMessageRuntime, t as getIMessageRuntime } from "./runtime-Cza4CY5T.mjs";
6
- import { c as IMESSAGE_SENT_ECHOES_TTL_MS, d as resolveIMessageEchoMediaKey, p as resolveIMessageSentEchoEntryKey, s as IMESSAGE_SENT_ECHOES_NAMESPACE } from "./state-contract-DvahEY4X.mjs";
7
- import { d as normalizeConversationKey, i as registerIMessageApprovalReactionTarget, l as enumerateApprovalTargetKeys, s as buildIMessageApprovalConversationKeyForInbound, u as enumerateConversationKeyForms } from "./approval-reactions-CX1-6KeG.mjs";
6
+ import { d as normalizeConversationKey, i as registerIMessageApprovalReactionTarget, l as enumerateApprovalTargetKeys, s as buildIMessageApprovalConversationKeyForInbound, u as enumerateConversationKeyForms } from "./approval-reactions-Bp33xc83.mjs";
8
7
  import { n as normalizeIMessageGuid } from "./reaction-context-Br-vAJFp.mjs";
9
- import { r as resolveAuthorizedIMessageReplyReference, t as withIMessageRemoteFile } from "./remote-file-4RbwiXYh.mjs";
8
+ import { a as withIMessageReceiptGuidReader, r as resolveAuthorizedIMessageReplyReference, t as withIMessageRemoteFile } from "./remote-file-DRPCaVmg.mjs";
10
9
  import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
11
10
  import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
12
11
  import { createLazyRuntimeSurface } from "openclaw/plugin-sdk/lazy-runtime";
13
12
  import { accessSync, constants } from "node:fs";
14
13
  import { basename } from "node:path";
15
- import { logVerbose, sleep } from "openclaw/plugin-sdk/runtime-env";
16
14
  import { extractOriginalFilename, kindFromMime, resolveOutboundAttachmentFromUrl } from "openclaw/plugin-sdk/media-runtime";
15
+ import { logVerbose, sleep } from "openclaw/plugin-sdk/runtime-env";
17
16
  import { asDateTimestampMs } from "openclaw/plugin-sdk/number-runtime";
18
- import { resolveRuntimeWorkerUrl } from "openclaw/plugin-sdk/process-runtime";
19
17
  import { PlatformMessageNotDispatchedError, isApprovalNotFoundError } from "openclaw/plugin-sdk/error-runtime";
20
18
  import { addApprovalReactionHintToText, createApprovalReactionTargetStore, listApprovalReactionBindings } from "openclaw/plugin-sdk/approval-reaction-runtime";
21
19
  import { convertMarkdownTables, stripInlineDirectiveTagsForDelivery } from "openclaw/plugin-sdk/text-chunking";
22
20
  import { createChannelPartialDeliveryError } from "openclaw/plugin-sdk/channel-inbound";
23
- import { openSqliteWorkerStore } from "openclaw/plugin-sdk/sqlite-runtime";
24
21
  import { createPluginStateErrorReporter } from "openclaw/plugin-sdk/plugin-state-runtime";
25
22
  import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
26
23
  import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
@@ -113,7 +110,7 @@ const loadResolveApprovalOverGateway = createLazyRuntimeSurface(() => import("op
113
110
  const reportPersistentError = createPluginStateErrorReporter(getOptionalIMessageRuntime, "imessage", "approval-poll-state", "iMessage persistent approval poll state failed");
114
111
  function readPersistedTarget(value) {
115
112
  const target = value;
116
- if (!target || typeof target.approvalId !== "string" || target.approvalKind !== "exec" && target.approvalKind !== "plugin" || !Array.isArray(target.optionDecisions)) return null;
113
+ if (!target || typeof target.approvalId !== "string" || target.approvalKind !== "exec" && target.approvalKind !== "plugin" && target.approvalKind !== "system-agent" || !Array.isArray(target.optionDecisions)) return null;
117
114
  const optionDecisions = target.optionDecisions.flatMap((pair) => {
118
115
  if (!Array.isArray(pair) || pair.length !== 2) return [];
119
116
  const [optionId, decision] = pair;
@@ -275,27 +272,18 @@ function readPollVoteEvent(message) {
275
272
  malformedVotes
276
273
  };
277
274
  }
278
- async function lookupPollTarget(params) {
275
+ async function lookupPollRecord(store, params) {
279
276
  for (const key of enumeratePollTargetKeys({
280
277
  accountId: params.accountId,
281
278
  conversation: params.conversation,
282
279
  pollGuid: params.pollGuid,
283
280
  optionIds: params.optionIds
284
281
  })) {
285
- const target = await pollTargets.lookup(key);
282
+ const target = await store.lookup(key);
286
283
  if (target) return target;
287
284
  }
288
285
  return null;
289
286
  }
290
- async function hasTombstone(params) {
291
- for (const key of enumeratePollTargetKeys({
292
- accountId: params.accountId,
293
- conversation: params.conversation,
294
- pollGuid: params.pollGuid,
295
- optionIds: params.optionIds
296
- })) if (await pollTombstones.lookup(key)) return true;
297
- return false;
298
- }
299
287
  /**
300
288
  * Outcomes for votes we own are logged at info, not verbose: an approval
301
289
  * decision is security-relevant, and diagnosing "the tap did nothing" must not
@@ -331,8 +319,8 @@ async function maybeResolveIMessageApprovalPollVote(params) {
331
319
  pollGuid: event.pollGuid,
332
320
  optionIds: event.votes.map((vote) => vote.optionId)
333
321
  };
334
- const target = await lookupPollTarget(lookupKey);
335
- if (!target) return await hasTombstone(lookupKey);
322
+ const target = await lookupPollRecord(pollTargets, lookupKey);
323
+ if (!target) return Boolean(await lookupPollRecord(pollTombstones, lookupKey));
336
324
  if (event.malformedVotes) {
337
325
  warn$1("approval poll vote ignored: malformed complete vote set", {
338
326
  approvalId: target.approvalId,
@@ -454,17 +442,15 @@ const iMessageApprovalPollTargets = {
454
442
  function isLeadingEchoTextCorruptionMarker(code) {
455
443
  return code === 0 || code === 65279 || code === 65533 || code === 65534 || code === 65535;
456
444
  }
457
- function stripLeadingEchoTextCorruptionMarkers(text) {
445
+ function normalizeIMessageEchoText(text) {
446
+ if (!text) return;
447
+ const normalized = text.replace(/\r\n?/g, "\n").trim();
458
448
  let offset = 0;
459
- while (offset < text.length && isLeadingEchoTextCorruptionMarker(text.charCodeAt(offset))) offset += 1;
460
- return offset === 0 ? text : text.slice(offset);
449
+ while (offset < normalized.length && isLeadingEchoTextCorruptionMarker(normalized.charCodeAt(offset))) offset += 1;
450
+ return normalized.slice(offset).trim() || void 0;
461
451
  }
462
452
  //#endregion
463
453
  //#region extensions/imessage/src/monitor/persisted-echo-cache.ts
464
- function normalizeText(text) {
465
- if (!text) return;
466
- return stripLeadingEchoTextCorruptionMarkers(text.replace(/\r\n?/g, "\n").trim()).trim() || void 0;
467
- }
468
454
  function normalizeMessageId(messageId) {
469
455
  const normalized = messageId?.trim();
470
456
  if (!normalized || normalized === "ok" || normalized === "unknown") return;
@@ -524,7 +510,7 @@ async function persistEntry(entry, ttlMs) {
524
510
  return key;
525
511
  }
526
512
  async function rememberPersistedIMessageEcho(params) {
527
- const text = normalizeText(params.text);
513
+ const text = normalizeIMessageEchoText(params.text);
528
514
  const media = normalizeMedia(params.media);
529
515
  const messageId = normalizeMessageId(params.messageId);
530
516
  const entry = {
@@ -548,7 +534,7 @@ async function forgetPersistedIMessageEchoKey(key) {
548
534
  }
549
535
  }
550
536
  async function hasPersistedIMessageEcho(params) {
551
- const text = normalizeText(params.text);
537
+ const text = normalizeIMessageEchoText(params.text);
552
538
  const mediaKey = resolveIMessageEchoMediaKey(params.media);
553
539
  const messageId = normalizeMessageId(params.messageId);
554
540
  if (!text && !mediaKey && !messageId) return false;
@@ -562,42 +548,6 @@ async function hasPersistedIMessageEcho(params) {
562
548
  return false;
563
549
  }
564
550
  //#endregion
565
- //#region extensions/imessage/src/send-receipt-db.ts
566
- async function withIMessageReceiptGuidReader(databasePath, use) {
567
- let store;
568
- let closed = false;
569
- const read = async (command) => {
570
- if (closed) throw new Error("iMessage receipt lookup is closed");
571
- try {
572
- store ??= await openSqliteWorkerStore({
573
- moduleUrl: resolveRuntimeWorkerUrl({
574
- currentModuleUrl: import.meta.url,
575
- sourceWorkerName: "send-receipt-db.worker",
576
- distWorkerPath: "extensions/imessage/src/send-receipt-db.worker.js",
577
- package: {
578
- name: "@openclaw/imessage",
579
- distWorkerPath: "src/send-receipt-db.worker.js"
580
- }
581
- }),
582
- databasePath,
583
- existingOnly: true,
584
- input: void 0
585
- });
586
- return store ? await store.execute(command) : null;
587
- } catch {
588
- return null;
589
- }
590
- };
591
- try {
592
- return await use(read);
593
- } finally {
594
- closed = true;
595
- try {
596
- await store?.close();
597
- } catch {}
598
- }
599
- }
600
- //#endregion
601
551
  //#region extensions/imessage/src/send-transport.ts
602
552
  function normalizeIMessageRpcSendError(error) {
603
553
  if (!(error instanceof IMessageRpcRequestError)) return error;
@@ -640,10 +590,6 @@ function resolveOutboundMessageGuid(result) {
640
590
  function isNumericMessageRowId(value) {
641
591
  return typeof value === "string" && /^\d+$/.test(value.trim());
642
592
  }
643
- function resolveTargetService(target) {
644
- if (target.kind !== "handle") return;
645
- if (target.serviceExplicit || target.service !== "auto") return target.service;
646
- }
647
593
  function normalizeResolvedMessageGuid(value) {
648
594
  if (typeof value !== "string") return null;
649
595
  const trimmed = value.trim();
@@ -713,9 +659,6 @@ function shouldRecoverApprovalPromptGuid(params) {
713
659
  function canCheckSentMessageAfterRpcTimeout(params) {
714
660
  return Boolean(params.resolveSentMessageGuidImpl) || canResolveLatestSentMessageGuidFromChatDb(params.dbPath);
715
661
  }
716
- function resolveOutboundEchoText(text) {
717
- return text.trim() || void 0;
718
- }
719
662
  function resolveOutboundEchoMedia(mediaContentType) {
720
663
  if (!mediaContentType) return;
721
664
  return {
@@ -843,7 +786,7 @@ async function trySendAttachmentForTarget(params) {
843
786
  let result;
844
787
  let pendingEchoKey;
845
788
  try {
846
- if (echoScope) pendingEchoKey = await rememberPersistedIMessageEcho({
789
+ pendingEchoKey = await rememberPersistedIMessageEcho({
847
790
  scope: echoScope,
848
791
  text: params.echoText,
849
792
  media: params.echoMedia,
@@ -907,7 +850,7 @@ async function trySendAttachmentForTarget(params) {
907
850
  resolveMessageGuidImpl: params.resolveMessageGuidImpl
908
851
  });
909
852
  const messageId = resolvedId ?? (result.ok || result.success ? "ok" : "unknown");
910
- if (echoScope) await rememberPersistedIMessageEcho({
853
+ await rememberPersistedIMessageEcho({
911
854
  scope: echoScope,
912
855
  text: params.echoText,
913
856
  media: params.echoMedia,
@@ -956,7 +899,7 @@ async function sendMessageIMessage(to, text, opts) {
956
899
  remoteHost
957
900
  });
958
901
  const target = parseIMessageTarget(opts.chatId ? formatIMessageChatTarget(opts.chatId) : to);
959
- const service = opts.service ?? resolveTargetService(target) ?? account.config.service;
902
+ const service = opts.service ?? (target.kind === "handle" && (target.serviceExplicit || target.service !== "auto") ? target.service : void 0) ?? account.config.service;
960
903
  const sendTransport = account.config.sendTransport ?? "auto";
961
904
  const resolvedReplyToId = await resolveAuthorizedIMessageReplyReference({
962
905
  account,
@@ -1019,7 +962,7 @@ async function sendMessageIMessage(to, text, opts) {
1019
962
  });
1020
963
  message = formatted.text;
1021
964
  if (!message.trim() && !filePath) throw new Error("iMessage send requires text or media");
1022
- const echoText = resolveOutboundEchoText(message);
965
+ const echoText = message.trim() || void 0;
1023
966
  const echoMedia = filePath ? resolveOutboundEchoMedia(mediaContentType) : void 0;
1024
967
  let effectiveReplyToId = resolvedReplyToId;
1025
968
  const runCli = opts.runCliJson ?? ((args) => runIMessageCliJsonCommand({
@@ -1034,11 +977,7 @@ async function sendMessageIMessage(to, text, opts) {
1034
977
  };
1035
978
  const requestOwnedRpc = async (method, rpcParams) => {
1036
979
  opts.assertDirectAdapterHandoff?.();
1037
- const rpcClient = opts.createClient ? await opts.createClient({
1038
- cliPath,
1039
- dbPath,
1040
- remoteHost
1041
- }) : await createIMessageRpcClient({
980
+ const rpcClient = await (opts.createClient ?? createIMessageRpcClient)({
1042
981
  cliPath,
1043
982
  dbPath,
1044
983
  remoteHost
@@ -1127,15 +1066,11 @@ async function sendMessageIMessage(to, text, opts) {
1127
1066
  target
1128
1067
  });
1129
1068
  opts.assertDirectAdapterHandoff?.();
1130
- const client = opts.client ?? (opts.createClient ? await opts.createClient({
1131
- cliPath,
1132
- dbPath,
1133
- remoteHost
1134
- }) : await createIMessageRpcClient({
1069
+ const client = opts.client ?? await (opts.createClient ?? createIMessageRpcClient)({
1135
1070
  cliPath,
1136
1071
  dbPath,
1137
1072
  remoteHost
1138
- }));
1073
+ });
1139
1074
  const shouldClose = !opts.client;
1140
1075
  const requestSuccessfulSend = async (sendParams) => {
1141
1076
  const request = async (nativeParams) => await requestIMessageRpcSend(client, "send", nativeParams, timeoutMs, opts);
@@ -1164,7 +1099,7 @@ async function sendMessageIMessage(to, text, opts) {
1164
1099
  let pendingEchoKey;
1165
1100
  try {
1166
1101
  try {
1167
- if (echoScope) pendingEchoKey = await rememberPersistedIMessageEcho({
1102
+ pendingEchoKey = await rememberPersistedIMessageEcho({
1168
1103
  scope: echoScope,
1169
1104
  text: echoText,
1170
1105
  media: echoMedia,
@@ -1221,7 +1156,7 @@ async function sendMessageIMessage(to, text, opts) {
1221
1156
  sentAfterMs: sendStartedAtMs,
1222
1157
  resolveSentMessageGuidImpl: opts.resolveSentMessageGuidImpl
1223
1158
  });
1224
- if (echoScope) await rememberPersistedIMessageEcho({
1159
+ await rememberPersistedIMessageEcho({
1225
1160
  scope: echoScope,
1226
1161
  text: echoText,
1227
1162
  media: echoMedia,
@@ -1280,4 +1215,4 @@ async function sendMessageIMessage(to, text, opts) {
1280
1215
  }
1281
1216
  }
1282
1217
  //#endregion
1283
- export { iMessageApprovalPollTargets as a, iMessageApprovalControlBindings as c, buildApprovalPollOptions as i, hasPersistedIMessageEcho as n, mapSentPollOptionsToDecisions as o, stripLeadingEchoTextCorruptionMarkers as r, maybeResolveIMessageApprovalPollVote as s, sendMessageIMessage as t };
1218
+ export { iMessageApprovalPollTargets as a, iMessageApprovalControlBindings as c, buildApprovalPollOptions as i, hasPersistedIMessageEcho as n, mapSentPollOptionsToDecisions as o, normalizeIMessageEchoText as r, maybeResolveIMessageApprovalPollVote as s, sendMessageIMessage as t };