@openclaw/imessage 2026.9.4 → 2026.9.6

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 (703) hide show
  1. package/assets/activity.svg +40 -0
  2. package/assets/icon.png +0 -0
  3. package/dist/{accounts-CCirBEIm.js → .setup/accounts-CUxZrTcY.mjs} +3 -3
  4. package/dist/{actions.runtime-CzvR20qT.js → .setup/actions.runtime-D0zG_96v.mjs} +106 -176
  5. package/dist/.setup/api-RZv6yXul.mjs +14 -0
  6. package/dist/.setup/api-VLVcFh7r.mjs +10 -0
  7. package/dist/{approval-handler.runtime-B6JGnxQf.js → .setup/approval-handler.runtime-Bv5_XgNr.mjs} +28 -28
  8. package/dist/{approval-reactions-BM_AwHPq.js → .setup/approval-reactions-D6RFg6lU.mjs} +32 -32
  9. package/dist/{channel-BwKxE8Ge.js → .setup/channel-BLTaKdSK.mjs} +38 -17
  10. package/dist/{channel.runtime-BGwNkU9Z.js → .setup/channel.runtime---s2k4YN.mjs} +7 -5
  11. package/dist/{group-policy-Duro87b4.js → .setup/group-policy-Cjztkquv.mjs} +52 -76
  12. package/dist/{media-contract-pns3TSS5.js → .setup/media-contract-DKJK7rh3.mjs} +1 -1
  13. package/dist/.setup/message-tool-api-pvlcOJPG.mjs +148 -0
  14. package/dist/{monitor-xaD-9h0b.js → .setup/monitor-BJ3Ozi6I.mjs} +247 -213
  15. package/dist/{question-reactions-9tBYB1_F.js → .setup/question-reactions-lm8OxWbb.mjs} +2 -2
  16. package/dist/{remote-file-5n5LznCa.js → .setup/remote-file-Bye99O-C.mjs} +12 -9
  17. package/dist/{sanitize-outbound-C6UF2cvr.js → .setup/sanitize-outbound-sJPF2DVM.mjs} +83 -47
  18. package/dist/{send-CIHiLtcY.js → .setup/send-odAfTQ2J.mjs} +178 -175
  19. package/dist/{state-migrations-D-fyHVcb.js → .setup/state-migrations-DIDzI99d.mjs} +3 -3
  20. package/dist/{message-tool-api-CUoFESHj.js → .setup/targets-Cc9vthzI.mjs} +53 -155
  21. package/dist/api.js +9 -14
  22. package/dist/channel-config-api.js +1 -1
  23. package/dist/channel-plugin-api.js +1 -1
  24. package/dist/contract-api.js +1 -1
  25. package/dist/doctor-contract-api.js +1 -1
  26. package/dist/media-contract-api.js +1 -1
  27. package/dist/message-tool-api.js +1 -1
  28. package/dist/runtime-api.js +7 -6
  29. package/dist/session-binding-contract-api.js +1 -1
  30. package/dist/setup-entry.js +2 -1
  31. package/dist/src/chat-db.worker.js +40 -0
  32. package/node_modules/typebox/build/compile/validator.d.mts +1 -1
  33. package/node_modules/typebox/build/compile/validator.mjs +1 -1
  34. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +7 -5
  35. package/node_modules/typebox/build/format/iri.mjs +5 -1
  36. package/node_modules/typebox/build/guard/emit.mjs +2 -4
  37. package/node_modules/typebox/build/guard/guard.mjs +6 -18
  38. package/node_modules/typebox/build/guard/string.mjs +16 -24
  39. package/node_modules/typebox/build/schema/build.mjs +2 -2
  40. package/node_modules/typebox/build/schema/check.mjs +1 -1
  41. package/node_modules/typebox/build/schema/compile.d.mts +3 -2
  42. package/node_modules/typebox/build/schema/compile.mjs +8 -8
  43. package/node_modules/typebox/build/schema/engine/_context.d.mts +6 -7
  44. package/node_modules/typebox/build/schema/engine/_context.mjs +23 -15
  45. package/node_modules/typebox/build/schema/engine/_functions.d.mts +2 -2
  46. package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -1
  47. package/node_modules/typebox/build/schema/engine/_reducer.d.mts +3 -3
  48. package/node_modules/typebox/build/schema/engine/_refine.d.mts +5 -5
  49. package/node_modules/typebox/build/schema/engine/_refine.mjs +4 -7
  50. package/node_modules/typebox/build/schema/engine/_stack.d.mts +34 -16
  51. package/node_modules/typebox/build/schema/engine/_stack.mjs +148 -104
  52. package/node_modules/typebox/build/schema/engine/additionalItems.d.mts +4 -4
  53. package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +8 -8
  54. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +26 -18
  55. package/node_modules/typebox/build/schema/engine/allOf.d.mts +4 -4
  56. package/node_modules/typebox/build/schema/engine/allOf.mjs +3 -3
  57. package/node_modules/typebox/build/schema/engine/anyOf.d.mts +4 -4
  58. package/node_modules/typebox/build/schema/engine/anyOf.mjs +5 -10
  59. package/node_modules/typebox/build/schema/engine/boolean.d.mts +4 -4
  60. package/node_modules/typebox/build/schema/engine/boolean.mjs +2 -6
  61. package/node_modules/typebox/build/schema/engine/const.d.mts +4 -4
  62. package/node_modules/typebox/build/schema/engine/const.mjs +2 -6
  63. package/node_modules/typebox/build/schema/engine/contains.d.mts +4 -4
  64. package/node_modules/typebox/build/schema/engine/contains.mjs +2 -6
  65. package/node_modules/typebox/build/schema/engine/dependencies.d.mts +4 -4
  66. package/node_modules/typebox/build/schema/engine/dependencies.mjs +3 -6
  67. package/node_modules/typebox/build/schema/engine/dependentRequired.d.mts +4 -4
  68. package/node_modules/typebox/build/schema/engine/dependentRequired.mjs +2 -6
  69. package/node_modules/typebox/build/schema/engine/dependentSchemas.d.mts +4 -4
  70. package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +4 -4
  71. package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +11 -7
  72. package/node_modules/typebox/build/schema/engine/enum.d.mts +4 -4
  73. package/node_modules/typebox/build/schema/engine/enum.mjs +2 -6
  74. package/node_modules/typebox/build/schema/engine/exclusiveMaximum.d.mts +4 -4
  75. package/node_modules/typebox/build/schema/engine/exclusiveMaximum.mjs +2 -6
  76. package/node_modules/typebox/build/schema/engine/exclusiveMinimum.d.mts +4 -4
  77. package/node_modules/typebox/build/schema/engine/exclusiveMinimum.mjs +2 -6
  78. package/node_modules/typebox/build/schema/engine/format.d.mts +4 -4
  79. package/node_modules/typebox/build/schema/engine/format.mjs +2 -6
  80. package/node_modules/typebox/build/schema/engine/if.d.mts +4 -4
  81. package/node_modules/typebox/build/schema/engine/if.mjs +7 -15
  82. package/node_modules/typebox/build/schema/engine/items.d.mts +4 -4
  83. package/node_modules/typebox/build/schema/engine/items.mjs +1 -1
  84. package/node_modules/typebox/build/schema/engine/maxContains.d.mts +4 -4
  85. package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -6
  86. package/node_modules/typebox/build/schema/engine/maxItems.d.mts +4 -4
  87. package/node_modules/typebox/build/schema/engine/maxItems.mjs +2 -6
  88. package/node_modules/typebox/build/schema/engine/maxLength.d.mts +4 -4
  89. package/node_modules/typebox/build/schema/engine/maxLength.mjs +2 -6
  90. package/node_modules/typebox/build/schema/engine/maxProperties.d.mts +4 -4
  91. package/node_modules/typebox/build/schema/engine/maxProperties.mjs +2 -6
  92. package/node_modules/typebox/build/schema/engine/maximum.d.mts +4 -4
  93. package/node_modules/typebox/build/schema/engine/maximum.mjs +2 -6
  94. package/node_modules/typebox/build/schema/engine/minContains.d.mts +4 -4
  95. package/node_modules/typebox/build/schema/engine/minContains.mjs +2 -6
  96. package/node_modules/typebox/build/schema/engine/minItems.d.mts +5 -5
  97. package/node_modules/typebox/build/schema/engine/minItems.mjs +2 -6
  98. package/node_modules/typebox/build/schema/engine/minLength.d.mts +4 -4
  99. package/node_modules/typebox/build/schema/engine/minLength.mjs +2 -6
  100. package/node_modules/typebox/build/schema/engine/minProperties.d.mts +4 -4
  101. package/node_modules/typebox/build/schema/engine/minProperties.mjs +2 -6
  102. package/node_modules/typebox/build/schema/engine/minimum.d.mts +4 -4
  103. package/node_modules/typebox/build/schema/engine/minimum.mjs +2 -6
  104. package/node_modules/typebox/build/schema/engine/multipleOf.d.mts +4 -4
  105. package/node_modules/typebox/build/schema/engine/multipleOf.mjs +2 -6
  106. package/node_modules/typebox/build/schema/engine/not.d.mts +4 -4
  107. package/node_modules/typebox/build/schema/engine/not.mjs +4 -8
  108. package/node_modules/typebox/build/schema/engine/oneOf.d.mts +4 -4
  109. package/node_modules/typebox/build/schema/engine/oneOf.mjs +6 -11
  110. package/node_modules/typebox/build/schema/engine/pattern.d.mts +4 -4
  111. package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -7
  112. package/node_modules/typebox/build/schema/engine/patternProperties.d.mts +4 -4
  113. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +1 -1
  114. package/node_modules/typebox/build/schema/engine/prefixItems.d.mts +4 -4
  115. package/node_modules/typebox/build/schema/engine/prefixItems.mjs +1 -1
  116. package/node_modules/typebox/build/schema/engine/properties.d.mts +4 -4
  117. package/node_modules/typebox/build/schema/engine/properties.mjs +1 -1
  118. package/node_modules/typebox/build/schema/engine/propertyNames.d.mts +4 -4
  119. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +4 -10
  120. package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +4 -4
  121. package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +11 -7
  122. package/node_modules/typebox/build/schema/engine/ref.d.mts +4 -4
  123. package/node_modules/typebox/build/schema/engine/ref.mjs +19 -15
  124. package/node_modules/typebox/build/schema/engine/required.d.mts +4 -4
  125. package/node_modules/typebox/build/schema/engine/required.mjs +2 -6
  126. package/node_modules/typebox/build/schema/engine/schema.d.mts +7 -7
  127. package/node_modules/typebox/build/schema/engine/schema.mjs +137 -133
  128. package/node_modules/typebox/build/schema/engine/type.d.mts +4 -4
  129. package/node_modules/typebox/build/schema/engine/type.mjs +2 -6
  130. package/node_modules/typebox/build/schema/engine/unevaluatedItems.d.mts +4 -4
  131. package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +5 -9
  132. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.d.mts +4 -4
  133. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +5 -9
  134. package/node_modules/typebox/build/schema/engine/uniqueItems.d.mts +4 -4
  135. package/node_modules/typebox/build/schema/engine/uniqueItems.mjs +2 -6
  136. package/node_modules/typebox/build/schema/errors.d.mts +2 -2
  137. package/node_modules/typebox/build/schema/errors.mjs +8 -14
  138. package/node_modules/typebox/build/schema/intern/index.d.mts +1 -0
  139. package/node_modules/typebox/build/schema/intern/index.mjs +1 -0
  140. package/node_modules/typebox/build/schema/intern/intern.d.mts +11 -0
  141. package/node_modules/typebox/build/schema/intern/intern.mjs +293 -0
  142. package/node_modules/typebox/build/schema/meta/draft_2019_09.d.mts +2 -0
  143. package/node_modules/typebox/build/schema/meta/draft_2019_09.mjs +288 -0
  144. package/node_modules/typebox/build/schema/meta/draft_2020_12.d.mts +2 -0
  145. package/node_modules/typebox/build/schema/meta/draft_2020_12.mjs +300 -0
  146. package/node_modules/typebox/build/schema/meta/draft_3.d.mts +2 -0
  147. package/node_modules/typebox/build/schema/meta/draft_3.mjs +143 -0
  148. package/node_modules/typebox/build/schema/meta/draft_4.d.mts +2 -0
  149. package/node_modules/typebox/build/schema/meta/draft_4.mjs +149 -0
  150. package/node_modules/typebox/build/schema/meta/draft_6.d.mts +2 -0
  151. package/node_modules/typebox/build/schema/meta/draft_6.mjs +155 -0
  152. package/node_modules/typebox/build/schema/meta/draft_7.d.mts +2 -0
  153. package/node_modules/typebox/build/schema/meta/draft_7.mjs +172 -0
  154. package/node_modules/typebox/build/schema/meta/index.d.mts +2 -0
  155. package/node_modules/typebox/build/schema/meta/index.mjs +2 -0
  156. package/node_modules/typebox/build/schema/meta/meta.d.mts +9 -0
  157. package/node_modules/typebox/build/schema/meta/meta.mjs +15 -0
  158. package/node_modules/typebox/build/schema/meta/schema.d.mts +6 -0
  159. package/node_modules/typebox/build/schema/meta/schema.mjs +1 -0
  160. package/node_modules/typebox/build/schema/parse.d.mts +1 -0
  161. package/node_modules/typebox/build/schema/parse.mjs +10 -5
  162. package/node_modules/typebox/build/schema/resolve/resolve.d.mts +8 -3
  163. package/node_modules/typebox/build/schema/resolve/resolve.mjs +268 -139
  164. package/node_modules/typebox/build/schema/schema.d.mts +2 -0
  165. package/node_modules/typebox/build/schema/schema.mjs +2 -0
  166. package/node_modules/typebox/build/value/errors/errors.d.mts +2 -12
  167. package/node_modules/typebox/build/value/errors/errors.mjs +2 -7
  168. package/node_modules/typebox/package.json +1 -1
  169. package/node_modules/typebox/readme.md +59 -89
  170. package/node_modules/zod/README.md +29 -2
  171. package/node_modules/zod/compile.cjs +96 -0
  172. package/node_modules/zod/compile.d.cts +1 -0
  173. package/node_modules/zod/compile.d.ts +1 -0
  174. package/node_modules/zod/compile.js +52 -0
  175. package/node_modules/zod/index.cjs +21 -2
  176. package/node_modules/zod/index.d.cts +1 -2
  177. package/node_modules/zod/index.d.ts +1 -2
  178. package/node_modules/zod/index.js +5 -2
  179. package/node_modules/zod/locales/index.cjs +19 -0
  180. package/node_modules/zod/mini/index.cjs +19 -0
  181. package/node_modules/zod/package.json +20 -8
  182. package/node_modules/zod/src/compile.ts +56 -0
  183. package/node_modules/zod/src/index.ts +5 -2
  184. package/node_modules/zod/src/v3/ZodError.ts +22 -12
  185. package/node_modules/zod/src/v3/helpers/errorUtil.ts +1 -1
  186. package/node_modules/zod/src/v3/tests/error.test.ts +35 -0
  187. package/node_modules/zod/src/v3/tests/intersection.test.ts +18 -0
  188. package/node_modules/zod/src/v3/tests/language-server.test.ts +1 -2
  189. package/node_modules/zod/src/v3/tests/object.test.ts +3 -6
  190. package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -80
  191. package/node_modules/zod/src/v3/tests/string.test.ts +6 -0
  192. package/node_modules/zod/src/v3/types.ts +5 -5
  193. package/node_modules/zod/src/v4/classic/checks.ts +1 -0
  194. package/node_modules/zod/src/v4/classic/compat.ts +26 -18
  195. package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
  196. package/node_modules/zod/src/v4/classic/errors.ts +59 -44
  197. package/node_modules/zod/src/v4/classic/external.ts +14 -9
  198. package/node_modules/zod/src/v4/classic/from-json-schema.ts +363 -78
  199. package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
  200. package/node_modules/zod/src/v4/classic/index.ts +2 -2
  201. package/node_modules/zod/src/v4/classic/iso.ts +2 -72
  202. package/node_modules/zod/src/v4/classic/parse.ts +10 -4
  203. package/node_modules/zod/src/v4/classic/schemas.ts +640 -375
  204. package/node_modules/zod/src/v4/classic/tests/apply.test.ts +27 -0
  205. package/node_modules/zod/src/v4/classic/tests/array.test.ts +2 -2
  206. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +186 -0
  207. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +36 -1
  208. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +278 -0
  209. package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +1 -2
  210. package/node_modules/zod/src/v4/classic/tests/codec.test.ts +2 -1
  211. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +3 -3
  212. package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -0
  213. package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +985 -0
  214. package/node_modules/zod/src/v4/classic/tests/date.test.ts +30 -0
  215. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +32 -18
  216. package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +380 -0
  217. package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +32 -0
  218. package/node_modules/zod/src/v4/classic/tests/default.test.ts +46 -0
  219. package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +31 -7
  220. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +261 -13
  221. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +20 -0
  222. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +112 -2
  223. package/node_modules/zod/src/v4/classic/tests/error.test.ts +403 -6
  224. package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +582 -10
  225. package/node_modules/zod/src/v4/classic/tests/function.test.ts +31 -0
  226. package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +2 -9
  227. package/node_modules/zod/src/v4/classic/tests/hash.test.ts +1 -2
  228. package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
  229. package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +159 -0
  230. package/node_modules/zod/src/v4/classic/tests/index.test.ts +21 -2
  231. package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +319 -0
  232. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +67 -0
  233. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +136 -0
  234. package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +215 -0
  235. package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +3 -10
  236. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +36 -1
  237. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +12 -1
  238. package/node_modules/zod/src/v4/classic/tests/map.test.ts +12 -0
  239. package/node_modules/zod/src/v4/classic/tests/number.test.ts +85 -9
  240. package/node_modules/zod/src/v4/classic/tests/object.test.ts +301 -12
  241. package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +235 -0
  242. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +49 -16
  243. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +51 -4
  244. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +70 -0
  245. package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +20 -2
  246. package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
  247. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -68
  248. package/node_modules/zod/src/v4/classic/tests/record.test.ts +186 -18
  249. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +79 -3
  250. package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
  251. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +60 -0
  252. package/node_modules/zod/src/v4/classic/tests/set.test.ts +9 -0
  253. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +19 -0
  254. package/node_modules/zod/src/v4/classic/tests/string.test.ts +222 -6
  255. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +18 -0
  256. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +44 -3
  257. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +1812 -204
  258. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +45 -30
  259. package/node_modules/zod/src/v4/classic/tests/union.test.ts +39 -2
  260. package/node_modules/zod/src/v4/classic/tests/validate.test.ts +645 -0
  261. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +2 -2
  262. package/node_modules/zod/src/v4/core/api.ts +87 -35
  263. package/node_modules/zod/src/v4/core/checks.ts +119 -146
  264. package/node_modules/zod/src/v4/core/compile.ts +2313 -0
  265. package/node_modules/zod/src/v4/core/core.ts +99 -22
  266. package/node_modules/zod/src/v4/core/doc.ts +17 -9
  267. package/node_modules/zod/src/v4/core/errors.ts +113 -25
  268. package/node_modules/zod/src/v4/core/index.ts +3 -0
  269. package/node_modules/zod/src/v4/core/json-schema-generator.ts +8 -3
  270. package/node_modules/zod/src/v4/core/json-schema-processors.ts +424 -156
  271. package/node_modules/zod/src/v4/core/json-schema.ts +2 -1
  272. package/node_modules/zod/src/v4/core/memoizer.ts +331 -0
  273. package/node_modules/zod/src/v4/core/parse.ts +164 -50
  274. package/node_modules/zod/src/v4/core/regexes.ts +42 -15
  275. package/node_modules/zod/src/v4/core/registries.ts +2 -2
  276. package/node_modules/zod/src/v4/core/schemas.ts +1000 -538
  277. package/node_modules/zod/src/v4/core/tests/cached.test.ts +54 -0
  278. package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +1004 -0
  279. package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
  280. package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +89 -0
  281. package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
  282. package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +34 -0
  283. package/node_modules/zod/src/v4/core/tests/compile.test.ts +2036 -0
  284. package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
  285. package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +1 -2
  286. package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +1 -2
  287. package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +3 -3
  288. package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -0
  289. package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
  290. package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
  291. package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
  292. package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +51 -0
  293. package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +133 -0
  294. package/node_modules/zod/src/v4/core/to-json-schema.ts +283 -48
  295. package/node_modules/zod/src/v4/core/util.ts +454 -157
  296. package/node_modules/zod/src/v4/core/versions.ts +2 -2
  297. package/node_modules/zod/src/v4/core/visit.ts +193 -0
  298. package/node_modules/zod/src/v4/index.ts +3 -3
  299. package/node_modules/zod/src/v4/locales/ar.ts +5 -0
  300. package/node_modules/zod/src/v4/locales/az.ts +5 -0
  301. package/node_modules/zod/src/v4/locales/be.ts +12 -0
  302. package/node_modules/zod/src/v4/locales/bg.ts +5 -0
  303. package/node_modules/zod/src/v4/locales/bn.ts +123 -0
  304. package/node_modules/zod/src/v4/locales/ca.ts +5 -0
  305. package/node_modules/zod/src/v4/locales/ckb.ts +140 -0
  306. package/node_modules/zod/src/v4/locales/cs.ts +5 -0
  307. package/node_modules/zod/src/v4/locales/da.ts +7 -2
  308. package/node_modules/zod/src/v4/locales/de.ts +5 -0
  309. package/node_modules/zod/src/v4/locales/el.ts +3 -0
  310. package/node_modules/zod/src/v4/locales/en.ts +17 -4
  311. package/node_modules/zod/src/v4/locales/eo.ts +5 -0
  312. package/node_modules/zod/src/v4/locales/es.ts +4 -0
  313. package/node_modules/zod/src/v4/locales/fa.ts +5 -0
  314. package/node_modules/zod/src/v4/locales/fi.ts +5 -0
  315. package/node_modules/zod/src/v4/locales/fr-CA.ts +5 -0
  316. package/node_modules/zod/src/v4/locales/fr.ts +21 -14
  317. package/node_modules/zod/src/v4/locales/gu.ts +123 -0
  318. package/node_modules/zod/src/v4/locales/he.ts +8 -1
  319. package/node_modules/zod/src/v4/locales/hi.ts +126 -0
  320. package/node_modules/zod/src/v4/locales/hr.ts +4 -0
  321. package/node_modules/zod/src/v4/locales/hu.ts +5 -0
  322. package/node_modules/zod/src/v4/locales/hy.ts +11 -0
  323. package/node_modules/zod/src/v4/locales/id.ts +5 -0
  324. package/node_modules/zod/src/v4/locales/index.ts +11 -0
  325. package/node_modules/zod/src/v4/locales/is.ts +5 -0
  326. package/node_modules/zod/src/v4/locales/it.ts +5 -0
  327. package/node_modules/zod/src/v4/locales/ja.ts +5 -0
  328. package/node_modules/zod/src/v4/locales/ka.ts +5 -0
  329. package/node_modules/zod/src/v4/locales/km.ts +5 -0
  330. package/node_modules/zod/src/v4/locales/kn.ts +126 -0
  331. package/node_modules/zod/src/v4/locales/ko.ts +5 -0
  332. package/node_modules/zod/src/v4/locales/lt.ts +4 -0
  333. package/node_modules/zod/src/v4/locales/mk.ts +5 -0
  334. package/node_modules/zod/src/v4/locales/ms.ts +5 -0
  335. package/node_modules/zod/src/v4/locales/ne.ts +128 -0
  336. package/node_modules/zod/src/v4/locales/nl.ts +5 -0
  337. package/node_modules/zod/src/v4/locales/nn.ts +121 -0
  338. package/node_modules/zod/src/v4/locales/no.ts +7 -2
  339. package/node_modules/zod/src/v4/locales/ota.ts +5 -0
  340. package/node_modules/zod/src/v4/locales/pl.ts +5 -0
  341. package/node_modules/zod/src/v4/locales/ps.ts +5 -0
  342. package/node_modules/zod/src/v4/locales/pt-BR.ts +161 -0
  343. package/node_modules/zod/src/v4/locales/pt.ts +101 -58
  344. package/node_modules/zod/src/v4/locales/ro.ts +3 -0
  345. package/node_modules/zod/src/v4/locales/ru.ts +12 -0
  346. package/node_modules/zod/src/v4/locales/sk.ts +123 -0
  347. package/node_modules/zod/src/v4/locales/sl.ts +5 -0
  348. package/node_modules/zod/src/v4/locales/sv.ts +7 -2
  349. package/node_modules/zod/src/v4/locales/ta.ts +5 -0
  350. package/node_modules/zod/src/v4/locales/tg.ts +135 -0
  351. package/node_modules/zod/src/v4/locales/th.ts +5 -0
  352. package/node_modules/zod/src/v4/locales/tk.ts +113 -0
  353. package/node_modules/zod/src/v4/locales/tr.ts +5 -0
  354. package/node_modules/zod/src/v4/locales/uk.ts +5 -0
  355. package/node_modules/zod/src/v4/locales/ur.ts +5 -0
  356. package/node_modules/zod/src/v4/locales/uz.ts +3 -0
  357. package/node_modules/zod/src/v4/locales/vi.ts +5 -0
  358. package/node_modules/zod/src/v4/locales/yo.ts +5 -0
  359. package/node_modules/zod/src/v4/locales/zh-CN.ts +5 -0
  360. package/node_modules/zod/src/v4/locales/zh-TW.ts +5 -0
  361. package/node_modules/zod/src/v4/mini/checks.ts +1 -0
  362. package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
  363. package/node_modules/zod/src/v4/mini/external.ts +12 -1
  364. package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
  365. package/node_modules/zod/src/v4/mini/parse.ts +2 -0
  366. package/node_modules/zod/src/v4/mini/schemas.ts +167 -63
  367. package/node_modules/zod/src/v4/mini/tests/apply.test.ts +33 -0
  368. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +62 -1
  369. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +14 -0
  370. package/node_modules/zod/src/v4/mini/tests/codec.test.ts +35 -1
  371. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +11 -17
  372. package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +84 -0
  373. package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +54 -0
  374. package/node_modules/zod/src/v4/mini/tests/error.test.ts +23 -4
  375. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +9 -0
  376. package/node_modules/zod/src/v4/mini/tests/index.test.ts +158 -5
  377. package/node_modules/zod/src/v4/mini/tests/number.test.ts +14 -0
  378. package/node_modules/zod/src/v4/mini/tests/object.test.ts +65 -0
  379. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +16 -0
  380. package/node_modules/zod/src/v4/mini/tests/string.test.ts +44 -0
  381. package/node_modules/zod/v3/ZodError.cjs +41 -12
  382. package/node_modules/zod/v3/ZodError.d.cts +1 -1
  383. package/node_modules/zod/v3/ZodError.d.ts +1 -1
  384. package/node_modules/zod/v3/ZodError.js +22 -12
  385. package/node_modules/zod/v3/errors.cjs +19 -0
  386. package/node_modules/zod/v3/external.cjs +19 -0
  387. package/node_modules/zod/v3/helpers/enumUtil.cjs +19 -0
  388. package/node_modules/zod/v3/helpers/errorUtil.cjs +20 -1
  389. package/node_modules/zod/v3/helpers/errorUtil.js +1 -1
  390. package/node_modules/zod/v3/helpers/parseUtil.cjs +19 -0
  391. package/node_modules/zod/v3/helpers/partialUtil.cjs +19 -0
  392. package/node_modules/zod/v3/helpers/typeAliases.cjs +19 -0
  393. package/node_modules/zod/v3/helpers/util.cjs +19 -0
  394. package/node_modules/zod/v3/index.cjs +19 -0
  395. package/node_modules/zod/v3/standard-schema.cjs +19 -0
  396. package/node_modules/zod/v3/types.cjs +26 -5
  397. package/node_modules/zod/v3/types.js +7 -5
  398. package/node_modules/zod/v4/classic/checks.cjs +21 -1
  399. package/node_modules/zod/v4/classic/checks.d.cts +1 -1
  400. package/node_modules/zod/v4/classic/checks.d.ts +1 -1
  401. package/node_modules/zod/v4/classic/checks.js +1 -1
  402. package/node_modules/zod/v4/classic/coerce.cjs +19 -0
  403. package/node_modules/zod/v4/classic/compat.cjs +19 -0
  404. package/node_modules/zod/v4/classic/compat.d.cts +9 -11
  405. package/node_modules/zod/v4/classic/compat.d.ts +9 -11
  406. package/node_modules/zod/v4/classic/deep-partial.cjs +58 -0
  407. package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
  408. package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
  409. package/node_modules/zod/v4/classic/deep-partial.js +13 -0
  410. package/node_modules/zod/v4/classic/errors.cjs +62 -34
  411. package/node_modules/zod/v4/classic/errors.d.cts +3 -4
  412. package/node_modules/zod/v4/classic/errors.d.ts +3 -4
  413. package/node_modules/zod/v4/classic/errors.js +43 -34
  414. package/node_modules/zod/v4/classic/external.cjs +51 -27
  415. package/node_modules/zod/v4/classic/external.d.cts +5 -2
  416. package/node_modules/zod/v4/classic/external.d.ts +5 -2
  417. package/node_modules/zod/v4/classic/external.js +5 -8
  418. package/node_modules/zod/v4/classic/from-json-schema.cjs +376 -75
  419. package/node_modules/zod/v4/classic/from-json-schema.js +357 -75
  420. package/node_modules/zod/v4/classic/in-out.cjs +82 -0
  421. package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
  422. package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
  423. package/node_modules/zod/v4/classic/in-out.js +36 -0
  424. package/node_modules/zod/v4/classic/index.cjs +21 -2
  425. package/node_modules/zod/v4/classic/index.d.cts +1 -2
  426. package/node_modules/zod/v4/classic/index.d.ts +1 -2
  427. package/node_modules/zod/v4/classic/index.js +2 -2
  428. package/node_modules/zod/v4/classic/iso.cjs +30 -22
  429. package/node_modules/zod/v4/classic/iso.d.cts +2 -17
  430. package/node_modules/zod/v4/classic/iso.d.ts +2 -17
  431. package/node_modules/zod/v4/classic/iso.js +2 -17
  432. package/node_modules/zod/v4/classic/parse.cjs +23 -1
  433. package/node_modules/zod/v4/classic/parse.d.cts +17 -4
  434. package/node_modules/zod/v4/classic/parse.d.ts +17 -4
  435. package/node_modules/zod/v4/classic/parse.js +1 -0
  436. package/node_modules/zod/v4/classic/schemas.cjs +591 -426
  437. package/node_modules/zod/v4/classic/schemas.d.cts +68 -19
  438. package/node_modules/zod/v4/classic/schemas.d.ts +68 -19
  439. package/node_modules/zod/v4/classic/schemas.js +564 -424
  440. package/node_modules/zod/v4/core/api.cjs +66 -24
  441. package/node_modules/zod/v4/core/api.d.cts +22 -12
  442. package/node_modules/zod/v4/core/api.d.ts +22 -12
  443. package/node_modules/zod/v4/core/api.js +44 -24
  444. package/node_modules/zod/v4/core/checks.cjs +88 -128
  445. package/node_modules/zod/v4/core/checks.d.cts +29 -13
  446. package/node_modules/zod/v4/core/checks.d.ts +29 -13
  447. package/node_modules/zod/v4/core/checks.js +68 -127
  448. package/node_modules/zod/v4/core/compile.cjs +1908 -0
  449. package/node_modules/zod/v4/core/compile.d.cts +65 -0
  450. package/node_modules/zod/v4/core/compile.d.ts +65 -0
  451. package/node_modules/zod/v4/core/compile.js +1858 -0
  452. package/node_modules/zod/v4/core/core.cjs +101 -19
  453. package/node_modules/zod/v4/core/core.d.cts +16 -4
  454. package/node_modules/zod/v4/core/core.d.ts +16 -4
  455. package/node_modules/zod/v4/core/core.js +83 -20
  456. package/node_modules/zod/v4/core/doc.cjs +31 -9
  457. package/node_modules/zod/v4/core/doc.d.cts +3 -1
  458. package/node_modules/zod/v4/core/doc.d.ts +3 -1
  459. package/node_modules/zod/v4/core/doc.js +12 -9
  460. package/node_modules/zod/v4/core/errors.cjs +126 -25
  461. package/node_modules/zod/v4/core/errors.d.cts +4 -0
  462. package/node_modules/zod/v4/core/errors.d.ts +4 -0
  463. package/node_modules/zod/v4/core/errors.js +107 -25
  464. package/node_modules/zod/v4/core/index.cjs +24 -1
  465. package/node_modules/zod/v4/core/index.d.cts +3 -0
  466. package/node_modules/zod/v4/core/index.d.ts +3 -0
  467. package/node_modules/zod/v4/core/index.js +3 -0
  468. package/node_modules/zod/v4/core/json-schema-generator.cjs +24 -1
  469. package/node_modules/zod/v4/core/json-schema-generator.d.cts +2 -2
  470. package/node_modules/zod/v4/core/json-schema-generator.d.ts +2 -2
  471. package/node_modules/zod/v4/core/json-schema-generator.js +6 -2
  472. package/node_modules/zod/v4/core/json-schema-processors.cjs +441 -156
  473. package/node_modules/zod/v4/core/json-schema-processors.d.cts +16 -0
  474. package/node_modules/zod/v4/core/json-schema-processors.d.ts +16 -0
  475. package/node_modules/zod/v4/core/json-schema-processors.js +400 -158
  476. package/node_modules/zod/v4/core/json-schema.cjs +19 -0
  477. package/node_modules/zod/v4/core/json-schema.d.cts +2 -1
  478. package/node_modules/zod/v4/core/json-schema.d.ts +2 -1
  479. package/node_modules/zod/v4/core/memoizer.cjs +360 -0
  480. package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
  481. package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
  482. package/node_modules/zod/v4/core/memoizer.js +311 -0
  483. package/node_modules/zod/v4/core/parse.cjs +148 -46
  484. package/node_modules/zod/v4/core/parse.d.cts +14 -11
  485. package/node_modules/zod/v4/core/parse.d.ts +14 -11
  486. package/node_modules/zod/v4/core/parse.js +127 -45
  487. package/node_modules/zod/v4/core/regexes.cjs +54 -17
  488. package/node_modules/zod/v4/core/regexes.d.cts +5 -0
  489. package/node_modules/zod/v4/core/regexes.d.ts +5 -0
  490. package/node_modules/zod/v4/core/regexes.js +32 -15
  491. package/node_modules/zod/v4/core/registries.cjs +19 -0
  492. package/node_modules/zod/v4/core/registries.js +2 -2
  493. package/node_modules/zod/v4/core/schemas.cjs +785 -386
  494. package/node_modules/zod/v4/core/schemas.d.cts +123 -34
  495. package/node_modules/zod/v4/core/schemas.d.ts +123 -34
  496. package/node_modules/zod/v4/core/schemas.js +753 -386
  497. package/node_modules/zod/v4/core/standard-schema.cjs +19 -0
  498. package/node_modules/zod/v4/core/to-json-schema.cjs +269 -45
  499. package/node_modules/zod/v4/core/to-json-schema.d.cts +45 -5
  500. package/node_modules/zod/v4/core/to-json-schema.d.ts +45 -5
  501. package/node_modules/zod/v4/core/to-json-schema.js +247 -44
  502. package/node_modules/zod/v4/core/util.cjs +372 -157
  503. package/node_modules/zod/v4/core/util.d.cts +79 -1
  504. package/node_modules/zod/v4/core/util.d.ts +79 -1
  505. package/node_modules/zod/v4/core/util.js +341 -156
  506. package/node_modules/zod/v4/core/versions.cjs +21 -2
  507. package/node_modules/zod/v4/core/versions.d.cts +1 -1
  508. package/node_modules/zod/v4/core/versions.d.ts +1 -1
  509. package/node_modules/zod/v4/core/versions.js +2 -2
  510. package/node_modules/zod/v4/core/visit.cjs +214 -0
  511. package/node_modules/zod/v4/core/visit.d.cts +30 -0
  512. package/node_modules/zod/v4/core/visit.d.ts +30 -0
  513. package/node_modules/zod/v4/core/visit.js +169 -0
  514. package/node_modules/zod/v4/index.cjs +34 -5
  515. package/node_modules/zod/v4/index.d.cts +2 -2
  516. package/node_modules/zod/v4/index.d.ts +2 -2
  517. package/node_modules/zod/v4/index.js +3 -2
  518. package/node_modules/zod/v4/locales/ar.cjs +5 -0
  519. package/node_modules/zod/v4/locales/ar.js +5 -0
  520. package/node_modules/zod/v4/locales/az.cjs +5 -0
  521. package/node_modules/zod/v4/locales/az.js +5 -0
  522. package/node_modules/zod/v4/locales/be.cjs +12 -0
  523. package/node_modules/zod/v4/locales/be.js +12 -0
  524. package/node_modules/zod/v4/locales/bg.cjs +5 -0
  525. package/node_modules/zod/v4/locales/bg.js +5 -0
  526. package/node_modules/zod/v4/locales/bn.cjs +140 -0
  527. package/node_modules/zod/v4/locales/bn.d.cts +5 -0
  528. package/node_modules/zod/v4/locales/bn.d.ts +4 -0
  529. package/node_modules/zod/v4/locales/bn.js +113 -0
  530. package/node_modules/zod/v4/locales/ca.cjs +5 -0
  531. package/node_modules/zod/v4/locales/ca.js +5 -0
  532. package/node_modules/zod/v4/locales/ckb.cjs +160 -0
  533. package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
  534. package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
  535. package/node_modules/zod/v4/locales/ckb.js +133 -0
  536. package/node_modules/zod/v4/locales/cs.cjs +5 -0
  537. package/node_modules/zod/v4/locales/cs.js +5 -0
  538. package/node_modules/zod/v4/locales/da.cjs +7 -2
  539. package/node_modules/zod/v4/locales/da.js +7 -2
  540. package/node_modules/zod/v4/locales/de.cjs +5 -0
  541. package/node_modules/zod/v4/locales/de.js +5 -0
  542. package/node_modules/zod/v4/locales/el.cjs +3 -0
  543. package/node_modules/zod/v4/locales/el.js +3 -0
  544. package/node_modules/zod/v4/locales/en.cjs +16 -4
  545. package/node_modules/zod/v4/locales/en.js +16 -4
  546. package/node_modules/zod/v4/locales/eo.cjs +5 -0
  547. package/node_modules/zod/v4/locales/eo.js +5 -0
  548. package/node_modules/zod/v4/locales/es.cjs +4 -0
  549. package/node_modules/zod/v4/locales/es.js +4 -0
  550. package/node_modules/zod/v4/locales/fa.cjs +5 -0
  551. package/node_modules/zod/v4/locales/fa.js +5 -0
  552. package/node_modules/zod/v4/locales/fi.cjs +5 -0
  553. package/node_modules/zod/v4/locales/fi.js +5 -0
  554. package/node_modules/zod/v4/locales/fr-CA.cjs +5 -0
  555. package/node_modules/zod/v4/locales/fr-CA.js +5 -0
  556. package/node_modules/zod/v4/locales/fr.cjs +18 -14
  557. package/node_modules/zod/v4/locales/fr.js +18 -14
  558. package/node_modules/zod/v4/locales/gu.cjs +140 -0
  559. package/node_modules/zod/v4/locales/gu.d.cts +5 -0
  560. package/node_modules/zod/v4/locales/gu.d.ts +4 -0
  561. package/node_modules/zod/v4/locales/gu.js +113 -0
  562. package/node_modules/zod/v4/locales/he.cjs +7 -0
  563. package/node_modules/zod/v4/locales/he.js +7 -0
  564. package/node_modules/zod/v4/locales/hi.cjs +138 -0
  565. package/node_modules/zod/v4/locales/hi.d.cts +5 -0
  566. package/node_modules/zod/v4/locales/hi.d.ts +4 -0
  567. package/node_modules/zod/v4/locales/hi.js +111 -0
  568. package/node_modules/zod/v4/locales/hr.cjs +4 -0
  569. package/node_modules/zod/v4/locales/hr.js +4 -0
  570. package/node_modules/zod/v4/locales/hu.cjs +5 -0
  571. package/node_modules/zod/v4/locales/hu.js +5 -0
  572. package/node_modules/zod/v4/locales/hy.cjs +11 -0
  573. package/node_modules/zod/v4/locales/hy.js +11 -0
  574. package/node_modules/zod/v4/locales/id.cjs +5 -0
  575. package/node_modules/zod/v4/locales/id.js +5 -0
  576. package/node_modules/zod/v4/locales/index.cjs +43 -2
  577. package/node_modules/zod/v4/locales/index.d.cts +11 -0
  578. package/node_modules/zod/v4/locales/index.d.ts +11 -0
  579. package/node_modules/zod/v4/locales/index.js +11 -0
  580. package/node_modules/zod/v4/locales/is.cjs +5 -0
  581. package/node_modules/zod/v4/locales/is.js +5 -0
  582. package/node_modules/zod/v4/locales/it.cjs +5 -0
  583. package/node_modules/zod/v4/locales/it.js +5 -0
  584. package/node_modules/zod/v4/locales/ja.cjs +5 -0
  585. package/node_modules/zod/v4/locales/ja.js +5 -0
  586. package/node_modules/zod/v4/locales/ka.cjs +5 -0
  587. package/node_modules/zod/v4/locales/ka.js +5 -0
  588. package/node_modules/zod/v4/locales/km.cjs +5 -0
  589. package/node_modules/zod/v4/locales/km.js +5 -0
  590. package/node_modules/zod/v4/locales/kn.cjs +143 -0
  591. package/node_modules/zod/v4/locales/kn.d.cts +5 -0
  592. package/node_modules/zod/v4/locales/kn.d.ts +4 -0
  593. package/node_modules/zod/v4/locales/kn.js +116 -0
  594. package/node_modules/zod/v4/locales/ko.cjs +5 -0
  595. package/node_modules/zod/v4/locales/ko.js +5 -0
  596. package/node_modules/zod/v4/locales/lt.cjs +4 -0
  597. package/node_modules/zod/v4/locales/lt.js +4 -0
  598. package/node_modules/zod/v4/locales/mk.cjs +5 -0
  599. package/node_modules/zod/v4/locales/mk.js +5 -0
  600. package/node_modules/zod/v4/locales/ms.cjs +5 -0
  601. package/node_modules/zod/v4/locales/ms.js +5 -0
  602. package/node_modules/zod/v4/locales/ne.cjs +138 -0
  603. package/node_modules/zod/v4/locales/ne.d.cts +5 -0
  604. package/node_modules/zod/v4/locales/ne.d.ts +4 -0
  605. package/node_modules/zod/v4/locales/ne.js +111 -0
  606. package/node_modules/zod/v4/locales/nl.cjs +5 -0
  607. package/node_modules/zod/v4/locales/nl.js +5 -0
  608. package/node_modules/zod/v4/locales/nn.cjs +140 -0
  609. package/node_modules/zod/v4/locales/nn.d.cts +5 -0
  610. package/node_modules/zod/v4/locales/nn.d.ts +4 -0
  611. package/node_modules/zod/v4/locales/nn.js +113 -0
  612. package/node_modules/zod/v4/locales/no.cjs +7 -2
  613. package/node_modules/zod/v4/locales/no.js +7 -2
  614. package/node_modules/zod/v4/locales/ota.cjs +5 -0
  615. package/node_modules/zod/v4/locales/ota.js +5 -0
  616. package/node_modules/zod/v4/locales/pl.cjs +5 -0
  617. package/node_modules/zod/v4/locales/pl.js +5 -0
  618. package/node_modules/zod/v4/locales/ps.cjs +5 -0
  619. package/node_modules/zod/v4/locales/ps.js +5 -0
  620. package/node_modules/zod/v4/locales/pt-BR.cjs +170 -0
  621. package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
  622. package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
  623. package/node_modules/zod/v4/locales/pt-BR.js +143 -0
  624. package/node_modules/zod/v4/locales/pt.cjs +89 -55
  625. package/node_modules/zod/v4/locales/pt.js +89 -55
  626. package/node_modules/zod/v4/locales/ro.cjs +3 -0
  627. package/node_modules/zod/v4/locales/ro.js +3 -0
  628. package/node_modules/zod/v4/locales/ru.cjs +12 -0
  629. package/node_modules/zod/v4/locales/ru.js +12 -0
  630. package/node_modules/zod/v4/locales/sk.cjs +143 -0
  631. package/node_modules/zod/v4/locales/sk.d.cts +5 -0
  632. package/node_modules/zod/v4/locales/sk.d.ts +4 -0
  633. package/node_modules/zod/v4/locales/sk.js +116 -0
  634. package/node_modules/zod/v4/locales/sl.cjs +5 -0
  635. package/node_modules/zod/v4/locales/sl.js +5 -0
  636. package/node_modules/zod/v4/locales/sv.cjs +7 -2
  637. package/node_modules/zod/v4/locales/sv.js +7 -2
  638. package/node_modules/zod/v4/locales/ta.cjs +5 -0
  639. package/node_modules/zod/v4/locales/ta.js +5 -0
  640. package/node_modules/zod/v4/locales/tg.cjs +144 -0
  641. package/node_modules/zod/v4/locales/tg.d.cts +5 -0
  642. package/node_modules/zod/v4/locales/tg.d.ts +4 -0
  643. package/node_modules/zod/v4/locales/tg.js +117 -0
  644. package/node_modules/zod/v4/locales/th.cjs +5 -0
  645. package/node_modules/zod/v4/locales/th.js +5 -0
  646. package/node_modules/zod/v4/locales/tk.cjs +134 -0
  647. package/node_modules/zod/v4/locales/tk.d.cts +5 -0
  648. package/node_modules/zod/v4/locales/tk.d.ts +4 -0
  649. package/node_modules/zod/v4/locales/tk.js +107 -0
  650. package/node_modules/zod/v4/locales/tr.cjs +5 -0
  651. package/node_modules/zod/v4/locales/tr.js +5 -0
  652. package/node_modules/zod/v4/locales/uk.cjs +5 -0
  653. package/node_modules/zod/v4/locales/uk.js +5 -0
  654. package/node_modules/zod/v4/locales/ur.cjs +5 -0
  655. package/node_modules/zod/v4/locales/ur.js +5 -0
  656. package/node_modules/zod/v4/locales/uz.cjs +3 -0
  657. package/node_modules/zod/v4/locales/uz.js +3 -0
  658. package/node_modules/zod/v4/locales/vi.cjs +5 -0
  659. package/node_modules/zod/v4/locales/vi.js +5 -0
  660. package/node_modules/zod/v4/locales/yo.cjs +5 -0
  661. package/node_modules/zod/v4/locales/yo.js +5 -0
  662. package/node_modules/zod/v4/locales/zh-CN.cjs +5 -0
  663. package/node_modules/zod/v4/locales/zh-CN.js +5 -0
  664. package/node_modules/zod/v4/locales/zh-TW.cjs +5 -0
  665. package/node_modules/zod/v4/locales/zh-TW.js +5 -0
  666. package/node_modules/zod/v4/mini/checks.cjs +21 -1
  667. package/node_modules/zod/v4/mini/checks.d.cts +1 -1
  668. package/node_modules/zod/v4/mini/checks.d.ts +1 -1
  669. package/node_modules/zod/v4/mini/checks.js +1 -1
  670. package/node_modules/zod/v4/mini/coerce.cjs +19 -0
  671. package/node_modules/zod/v4/mini/deep-partial.cjs +58 -0
  672. package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
  673. package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
  674. package/node_modules/zod/v4/mini/deep-partial.js +13 -0
  675. package/node_modules/zod/v4/mini/external.cjs +33 -1
  676. package/node_modules/zod/v4/mini/external.d.cts +5 -2
  677. package/node_modules/zod/v4/mini/external.d.ts +5 -2
  678. package/node_modules/zod/v4/mini/external.js +3 -1
  679. package/node_modules/zod/v4/mini/in-out.cjs +82 -0
  680. package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
  681. package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
  682. package/node_modules/zod/v4/mini/in-out.js +36 -0
  683. package/node_modules/zod/v4/mini/index.cjs +19 -0
  684. package/node_modules/zod/v4/mini/iso.cjs +19 -0
  685. package/node_modules/zod/v4/mini/parse.cjs +22 -1
  686. package/node_modules/zod/v4/mini/parse.d.cts +1 -1
  687. package/node_modules/zod/v4/mini/parse.d.ts +1 -1
  688. package/node_modules/zod/v4/mini/parse.js +1 -1
  689. package/node_modules/zod/v4/mini/schemas.cjs +117 -53
  690. package/node_modules/zod/v4/mini/schemas.d.cts +49 -14
  691. package/node_modules/zod/v4/mini/schemas.d.ts +49 -14
  692. package/node_modules/zod/v4/mini/schemas.js +92 -51
  693. package/node_modules/zod/v4-mini/index.cjs +19 -0
  694. package/openclaw.plugin.json +12 -28
  695. package/package.json +12 -7
  696. package/node_modules/zod/src/v4/core/config.ts +0 -15
  697. /package/dist/{config-schema-CCbTcJEV.js → .setup/config-schema-CCbTcJEV.mjs} +0 -0
  698. /package/dist/{conversation-bindings-GDQ_Laxj.js → .setup/conversation-bindings-GDQ_Laxj.mjs} +0 -0
  699. /package/dist/{outbound-send-deps-B-QEsLSM.js → .setup/outbound-send-deps-B-QEsLSM.mjs} +0 -0
  700. /package/dist/{reaction-context-Br-vAJFp.js → .setup/reaction-context-Br-vAJFp.mjs} +0 -0
  701. /package/dist/{rolldown-runtime-D7D4PA-g.js → .setup/rolldown-runtime-D7D4PA-g.mjs} +0 -0
  702. /package/dist/{runtime-Cza4CY5T.js → .setup/runtime-Cza4CY5T.mjs} +0 -0
  703. /package/dist/{state-contract-DvahEY4X.js → .setup/state-contract-DvahEY4X.mjs} +0 -0
@@ -1,24 +1,25 @@
1
- import { d as resolveIMessageChatDbLookupPath, f as resolveIMessageHomeDir, l as resolveIMessageRemoteHost, o as resolveIMessageAccount } from "./accounts-CCirBEIm.js";
2
- import { c as parseIMessageAllowTarget, f as getCachedIMessagePrivateApiStatus, i as isAllowedIMessageReplyContextSender, l as parseIMessageTarget, n as formatIMessageChatTarget, p as imessageRpcSupportsMethod, s as normalizeIMessageHandle } from "./message-tool-api-CUoFESHj.js";
3
- import { d as rememberIMessageReplyCache, o as createIMessageRpcClient, r as sanitizeOutboundText, u as isKnownFromMeIMessageMessageId, y as resolveIMessageDirectChatService } from "./sanitize-outbound-C6UF2cvr.js";
4
- import { f as probeIMessage, r as resolveIMessageInboundConversationId } from "./group-policy-Duro87b4.js";
5
- import { t as getIMessageRuntime } from "./runtime-Cza4CY5T.js";
6
- import { d as resolveIMessageEchoMediaKey, l as capFailureRetriesMap, t as IMESSAGE_CATCHUP_CURSOR_NAMESPACE, u as resolveIMessageCatchupCursorKey } from "./state-contract-DvahEY4X.js";
7
- import { n as resolveIMessageAttachmentRoots, r as resolveIMessageRemoteAttachmentRoots } from "./media-contract-pns3TSS5.js";
8
- import { i as registerIMessageApprovalReactionTarget, n as handleIMessageApprovalReaction, o as listPendingIMessageApprovalReactionPollTargets, r as maybeResolveIMessageApprovalReaction, s as buildIMessageApprovalConversationKeyForInbound } from "./approval-reactions-BM_AwHPq.js";
9
- import { c as iMessageApprovalControlBindings, n as hasPersistedIMessageEcho, r as stripLeadingEchoTextCorruptionMarkers, s as maybeResolveIMessageApprovalPollVote, t as sendMessageIMessage } from "./send-CIHiLtcY.js";
10
- import { n as normalizeIMessageGuid, t as resolveIMessageReactionContext } from "./reaction-context-Br-vAJFp.js";
11
- import { n as maybeResolveIMessageQuestionReaction, t as hasIMessageQuestionReactionTarget } from "./question-reactions-9tBYB1_F.js";
1
+ import { c as parseIMessageTarget, o as normalizeIMessageHandle, r as isAllowedIMessageReplyContextSender, s as parseIMessageAllowTarget, t as formatIMessageChatTarget } from "./targets-Cc9vthzI.mjs";
2
+ import { d as resolveIMessageChatDbLookupPath, f as resolveIMessageHomeDir, l as resolveIMessageRemoteHost, o as resolveIMessageAccount } from "./accounts-CUxZrTcY.mjs";
3
+ import { r as imessageRpcSupportsMethod } from "./message-tool-api-pvlcOJPG.mjs";
4
+ import { b as resolveIMessageDirectChatService, d as isKnownFromMeIMessageMessageId, f as rememberIMessageReplyCache, o as createIMessageRpcClient, r as sanitizeOutboundText } from "./sanitize-outbound-sJPF2DVM.mjs";
5
+ import { d as probeIMessage, f as probeIMessagePrivateApi, i as resolveIMessageInboundConversationId, n as resolveIMessageGroupSystemPrompt } from "./group-policy-Cjztkquv.mjs";
6
+ import { t as getIMessageRuntime } from "./runtime-Cza4CY5T.mjs";
7
+ import { d as resolveIMessageEchoMediaKey, l as capFailureRetriesMap, t as IMESSAGE_CATCHUP_CURSOR_NAMESPACE, u as resolveIMessageCatchupCursorKey } from "./state-contract-DvahEY4X.mjs";
8
+ import { n as resolveIMessageAttachmentRoots, r as resolveIMessageRemoteAttachmentRoots } from "./media-contract-DKJK7rh3.mjs";
9
+ import { i as registerIMessageApprovalReactionTarget, n as handleIMessageApprovalReaction, o as listPendingIMessageApprovalReactionPollTargets, r as maybeResolveIMessageApprovalReaction, s as buildIMessageApprovalConversationKeyForInbound } from "./approval-reactions-D6RFg6lU.mjs";
10
+ import { c as maybeResolveIMessageApprovalPollVote, i as resolveIMessageStartupRowidWatermark, l as iMessageApprovalControlBindings, n as hasPersistedIMessageEcho, r as stripLeadingEchoTextCorruptionMarkers, t as sendMessageIMessage } from "./send-odAfTQ2J.mjs";
11
+ import { n as normalizeIMessageGuid, t as resolveIMessageReactionContext } from "./reaction-context-Br-vAJFp.mjs";
12
+ import { n as maybeResolveIMessageQuestionReaction, t as hasIMessageQuestionReactionTarget } from "./question-reactions-lm8OxWbb.mjs";
13
+ import { asSafeIntegerInRange, hasNonEmptyString, isRecord, normalizeOptionalString, normalizeStringEntries, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
12
14
  import { bindIngressLifecycleToReplyOptions, createChannelIngressError, createChannelIngressMonitor, createChannelMessageReplyPipeline, resolveChannelStreamingBlockEnabled } from "openclaw/plugin-sdk/channel-outbound";
13
- import { chunkMarkdownTextWithMode as chunkTextWithMode, resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-runtime";
15
+ import { resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-runtime";
14
16
  import { resolveAgentRoute, resolveInboundLastRouteSessionKey } from "openclaw/plugin-sdk/routing";
15
17
  import path from "node:path";
16
18
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
17
- import { asSafeIntegerInRange, hasNonEmptyString, isRecord, normalizeOptionalString, normalizeStringEntries, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
18
19
  import fs from "node:fs/promises";
19
- import { createNonExitingRuntime, danger, logVerbose, shouldLogVerbose, warn } from "openclaw/plugin-sdk/runtime-env";
20
20
  import { isInboundPathAllowed, kindFromMime } from "openclaw/plugin-sdk/media-runtime";
21
- import { asDateTimestampMs, asPositiveFiniteNumber, parseDateStringTimestampMs, resolveIntegerOption, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
21
+ import { createNonExitingRuntime, danger, logVerbose, shouldLogVerbose, warn } from "openclaw/plugin-sdk/runtime-env";
22
+ import { asDateTimestampMs, asPositiveFiniteNumber, parseDateStringTimestampMs, resolveIntegerOption, resolvePromptHistoryLimit, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
22
23
  import { createHash } from "node:crypto";
23
24
  import { createRuntimeConfigReader, getRuntimeConfig } from "openclaw/plugin-sdk/runtime-config-snapshot";
24
25
  import { sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
@@ -29,33 +30,34 @@ import { buildChannelInboundEventContext, buildMentionRegexes, createAcceptedCha
29
30
  import { resolveAgentConfig, resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
30
31
  import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plugin-sdk/approval-handler-runtime";
31
32
  import { logTypingFailure } from "openclaw/plugin-sdk/channel-feedback";
32
- import { createChannelIngressResolver, defineStableChannelIngressIdentity, fanInChannelIngressLifecycles } from "openclaw/plugin-sdk/channel-ingress-runtime";
33
+ import { defineStableChannelIngressIdentity, fanInChannelIngressLifecycles } from "openclaw/plugin-sdk/channel-ingress-runtime";
33
34
  import { createChannelPairingChallengeIssuer } from "openclaw/plugin-sdk/channel-pairing";
34
35
  import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runtime-context";
35
36
  import { ensureConfiguredBindingRouteReady, readChannelAllowFromStore, resolveConfiguredBindingRoute, resolveRuntimeConversationBindingRoute, upsertChannelPairingRequest } from "openclaw/plugin-sdk/conversation-runtime";
36
37
  import { channelReadyPatch } from "openclaw/plugin-sdk/gateway-runtime";
37
38
  import { redactIdentifier } from "openclaw/plugin-sdk/logging-core";
38
- import { DEFAULT_GROUP_HISTORY_LIMIT, createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
39
39
  import { resolveDefaultGroupPolicy, resolveOpenProviderRuntimeGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
40
- import { openLocalFileSafely, resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime";
40
+ import { FsSafeError, openLocalFileSafely, resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime";
41
41
  import { getSessionEntry, readSessionUpdatedAt, resolveSendPolicy, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
42
- import { openNodeSqliteDatabase } from "openclaw/plugin-sdk/sqlite-runtime";
43
42
  import { waitForTransportReady } from "openclaw/plugin-sdk/transport-ready-runtime";
44
43
  import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
45
44
  import { resolveMarkdownTableMode as resolveMarkdownTableMode$1 } from "openclaw/plugin-sdk/markdown-table-runtime";
46
45
  import { resolvePreferredOpenClawTmpDir, withTempWorkspace } from "openclaw/plugin-sdk/temp-path";
47
46
  import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
48
47
  import { deliverTextOrMediaReply, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
48
+ import { chunkMarkdownTextWithMode as chunkTextWithMode, resolveChunkMode } from "openclaw/plugin-sdk/reply-chunking";
49
49
  import { createDedupeCache } from "openclaw/plugin-sdk/dedupe-runtime";
50
50
  import { hasControlCommand } from "openclaw/plugin-sdk/command-auth-native";
51
51
  import { resolveChannelContextVisibilityMode } from "openclaw/plugin-sdk/context-visibility-runtime";
52
+ import { createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
52
53
  import { isRecord as isRecord$1 } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
54
+ import { readFileHandleBounded } from "openclaw/plugin-sdk/file-access-runtime";
53
55
  import { saveMediaBuffer } from "openclaw/plugin-sdk/media-store";
54
56
  import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
55
- import { enqueueSystemEvent } from "openclaw/plugin-sdk/system-event-runtime";
57
+ import { enqueueRoutedSystemEvent } from "openclaw/plugin-sdk/system-event-runtime";
56
58
  //#region extensions/imessage/src/approval-reaction-poller.ts
57
59
  const RECENT_CHAT_LIMIT = 50;
58
- const PER_CHAT_HISTORY_LIMIT = 30;
60
+ const PER_CHAT_HISTORY_LIMIT$1 = 30;
59
61
  function normalizeChatId(value) {
60
62
  return asPositiveFiniteNumber(value) ?? null;
61
63
  }
@@ -89,7 +91,7 @@ async function listRecentChatIds(client) {
89
91
  async function fetchRecentHistory(params) {
90
92
  return ((await params.client.request("messages.history", {
91
93
  chat_id: params.chatId,
92
- limit: PER_CHAT_HISTORY_LIMIT
94
+ limit: PER_CHAT_HISTORY_LIMIT$1
93
95
  }, { timeoutMs: 1e4 })).messages ?? []).filter((message) => Boolean(message && typeof message === "object"));
94
96
  }
95
97
  function buildReactionPayload(params) {
@@ -129,14 +131,14 @@ function buildConversationKeyFromMessage(message) {
129
131
  ...normalizeChatId(message.chat_id) !== null ? { chatId: message.chat_id } : {}
130
132
  };
131
133
  }
132
- function bindObservedConversation(params) {
134
+ async function bindObservedConversation(params) {
133
135
  const nowMs = asDateTimestampMs(Date.now());
134
136
  const expiresAtMs = asDateTimestampMs(params.target.expiresAtMs);
135
137
  if (nowMs === void 0 || expiresAtMs === void 0 || expiresAtMs <= nowMs) return;
136
138
  const ttlMs = expiresAtMs - nowMs;
137
139
  const conversation = buildConversationKeyFromMessage(params.message);
138
140
  const messageIds = /* @__PURE__ */ new Set([...enumerateMessageGuidCandidates(params.target.messageId), ...enumerateMessageGuidCandidates(params.message.guid ?? "")]);
139
- for (const messageId of messageIds) registerIMessageApprovalReactionTarget({
141
+ await Promise.all([...messageIds].map((messageId) => registerIMessageApprovalReactionTarget({
140
142
  accountId: params.target.accountId,
141
143
  conversation,
142
144
  messageId,
@@ -144,7 +146,7 @@ function bindObservedConversation(params) {
144
146
  approvalKind: params.target.approvalKind,
145
147
  allowedDecisions: params.target.allowedDecisions,
146
148
  ttlMs
147
- });
149
+ })));
148
150
  }
149
151
  async function pollPendingIMessageApprovalReactions(params) {
150
152
  const targets = await listPendingIMessageApprovalReactionPollTargets({ accountId: params.accountId });
@@ -169,7 +171,7 @@ async function pollPendingIMessageApprovalReactions(params) {
169
171
  if (!targetGuid) continue;
170
172
  const target = pendingByMessageId.get(targetGuid) ?? pendingByMessageId.get(normalizeIMessageGuid(targetGuid));
171
173
  if (!target) continue;
172
- bindObservedConversation({
174
+ await bindObservedConversation({
173
175
  target,
174
176
  message
175
177
  });
@@ -270,16 +272,11 @@ const DEFAULT_MAX_FAILURE_RETRIES = 10;
270
272
  const MAX_MAX_FAILURE_RETRIES = 1e3;
271
273
  const cursorWriteQueue = new KeyedAsyncQueue();
272
274
  function openCatchupCursorStore() {
273
- return getIMessageRuntime().state.openSyncKeyedStore({
275
+ return getIMessageRuntime().state.openKeyedStore({
274
276
  namespace: IMESSAGE_CATCHUP_CURSOR_NAMESPACE,
275
277
  maxEntries: 256
276
278
  });
277
279
  }
278
- function updateCatchupCursorStore(key, updateValue) {
279
- const store = openCatchupCursorStore();
280
- if (!store.update) throw new Error("iMessage catchup cursor persistence requires atomic plugin-state update.");
281
- return store.update(key, updateValue);
282
- }
283
280
  function enqueueCursorWrite(accountId, fn) {
284
281
  const key = resolveIMessageCatchupCursorKey(accountId);
285
282
  return cursorWriteQueue.enqueue(key, fn);
@@ -308,39 +305,58 @@ function normalizeIMessageCatchupCursor(value) {
308
305
  ...hasRetries ? { failureRetries } : {}
309
306
  };
310
307
  }
311
- function readIMessageCatchupCursor(accountId) {
312
- return normalizeIMessageCatchupCursor(openCatchupCursorStore().lookup(resolveIMessageCatchupCursorKey(accountId)));
313
- }
314
308
  async function loadIMessageCatchupCursor(accountId) {
315
- return readIMessageCatchupCursor(accountId);
309
+ return normalizeIMessageCatchupCursor(await openCatchupCursorStore().lookup(resolveIMessageCatchupCursorKey(accountId)));
316
310
  }
317
- function buildIMessageCatchupCursor(next) {
311
+ function buildIMessageCatchupCursor(next, updatedAt) {
318
312
  const sanitized = sanitizeFailureRetriesInput(next.failureRetries);
319
313
  const hasRetries = Object.keys(sanitized).length > 0;
320
314
  return {
321
315
  lastSeenMs: next.lastSeenMs,
322
316
  lastSeenRowid: next.lastSeenRowid,
323
- updatedAt: Date.now(),
317
+ updatedAt,
324
318
  ...hasRetries ? { failureRetries: sanitized } : {}
325
319
  };
326
320
  }
327
- async function saveIMessageCatchupCursor(accountId, next, options = {}) {
328
- const cursor = buildIMessageCatchupCursor(next);
329
- updateCatchupCursorStore(resolveIMessageCatchupCursorKey(accountId), (existingValue) => {
330
- const existing = normalizeIMessageCatchupCursor(existingValue);
331
- if (existing && cursor.lastSeenRowid < existing.lastSeenRowid) {
332
- if (!options.allowCursorRewindForRetries) return;
333
- return buildIMessageCatchupCursor({
321
+ function decideCatchupCursorSave(existingValue, cursor, allowCursorRewindForRetries) {
322
+ const existing = normalizeIMessageCatchupCursor(existingValue);
323
+ if (existing && cursor.lastSeenRowid < existing.lastSeenRowid) {
324
+ if (!allowCursorRewindForRetries) return {
325
+ operation: "update",
326
+ action: "keep"
327
+ };
328
+ return {
329
+ operation: "update",
330
+ action: "set",
331
+ value: buildIMessageCatchupCursor({
334
332
  lastSeenMs: cursor.lastSeenMs,
335
333
  lastSeenRowid: cursor.lastSeenRowid,
336
334
  failureRetries: {
337
335
  ...existing.failureRetries,
338
336
  ...cursor.failureRetries
339
337
  }
340
- });
341
- }
342
- return cursor;
343
- });
338
+ }, cursor.updatedAt)
339
+ };
340
+ }
341
+ return {
342
+ operation: "update",
343
+ action: "set",
344
+ value: cursor
345
+ };
346
+ }
347
+ async function saveIMessageCatchupCursor(accountId, next, options = {}) {
348
+ const cursor = buildIMessageCatchupCursor(next, Date.now());
349
+ const allowCursorRewindForRetries = options.allowCursorRewindForRetries === true;
350
+ const store = openCatchupCursorStore();
351
+ if (!store.observe || !store.compareAndApply) throw new Error("iMessage catchup cursor persistence requires plugin-state comparison support.");
352
+ const key = resolveIMessageCatchupCursorKey(accountId);
353
+ let observation = await store.observe(key);
354
+ for (;;) {
355
+ const intent = decideCatchupCursorSave(observation.value, cursor, allowCursorRewindForRetries);
356
+ const result = await store.compareAndApply(key, observation.comparison, intent);
357
+ if (result.status !== "conflict") return;
358
+ observation = result.current;
359
+ }
344
360
  }
345
361
  function clampInt(value, min, max, fallback) {
346
362
  return resolveIntegerOption(value, fallback, {
@@ -357,22 +373,41 @@ function resolveCatchupConfig(raw) {
357
373
  maxFailureRetries: clampInt(raw?.maxFailureRetries, 1, MAX_MAX_FAILURE_RETRIES, DEFAULT_MAX_FAILURE_RETRIES)
358
374
  };
359
375
  }
376
+ function decideLiveCatchupCursorAdvance(existingValue, next, maxFailureRetries) {
377
+ const cursor = normalizeIMessageCatchupCursor(existingValue);
378
+ if (cursor && next.lastSeenRowid <= cursor.lastSeenRowid) return {
379
+ operation: "update",
380
+ action: "keep"
381
+ };
382
+ if (Object.values(cursor?.failureRetries ?? {}).some((count) => count < maxFailureRetries)) return {
383
+ operation: "update",
384
+ action: "keep"
385
+ };
386
+ return {
387
+ operation: "update",
388
+ action: "set",
389
+ value: buildIMessageCatchupCursor({
390
+ lastSeenMs: Math.max(cursor?.lastSeenMs ?? next.lastSeenMs, next.lastSeenMs),
391
+ lastSeenRowid: next.lastSeenRowid,
392
+ failureRetries: cursor?.failureRetries
393
+ }, next.updatedAt)
394
+ };
395
+ }
360
396
  async function advanceIMessageCatchupCursor(accountId, next, config) {
361
397
  if (!Number.isFinite(next.lastSeenMs) || !Number.isFinite(next.lastSeenRowid)) return false;
362
398
  return await enqueueCursorWrite(accountId, async () => {
363
- let advanced = false;
364
- updateCatchupCursorStore(resolveIMessageCatchupCursorKey(accountId), (existingValue) => {
365
- const cursor = normalizeIMessageCatchupCursor(existingValue);
366
- if (cursor && next.lastSeenRowid <= cursor.lastSeenRowid) return;
367
- if (Object.values(cursor?.failureRetries ?? {}).some((count) => count < config.maxFailureRetries)) return;
368
- advanced = true;
369
- return buildIMessageCatchupCursor({
370
- lastSeenMs: Math.max(cursor?.lastSeenMs ?? next.lastSeenMs, next.lastSeenMs),
371
- lastSeenRowid: next.lastSeenRowid,
372
- failureRetries: cursor?.failureRetries
373
- });
374
- });
375
- return advanced;
399
+ const cursor = buildIMessageCatchupCursor(next, Date.now());
400
+ const maxFailureRetries = config.maxFailureRetries;
401
+ const store = openCatchupCursorStore();
402
+ if (!store.observe || !store.compareAndApply) throw new Error("iMessage catchup cursor persistence requires plugin-state comparison support.");
403
+ const key = resolveIMessageCatchupCursorKey(accountId);
404
+ let observation = await store.observe(key);
405
+ for (;;) {
406
+ const intent = decideLiveCatchupCursorAdvance(observation.value, cursor, maxFailureRetries);
407
+ const result = await store.compareAndApply(key, observation.comparison, intent);
408
+ if (result.status !== "conflict") return result.status === "applied";
409
+ observation = result.current;
410
+ }
376
411
  });
377
412
  }
378
413
  /**
@@ -594,7 +629,7 @@ function parseIMessageNotification(raw) {
594
629
  }
595
630
  //#endregion
596
631
  //#region extensions/imessage/src/monitor/catchup-bridge.ts
597
- const PER_CHAT_HISTORY_LIMIT_CAP = 500;
632
+ const PER_CHAT_HISTORY_LIMIT = 500;
598
633
  const CATCHUP_CHATS_LIST_LIMIT = 200;
599
634
  const CATCHUP_RPC_TIMEOUT_MS = 3e4;
600
635
  /**
@@ -638,7 +673,6 @@ async function runIMessageCatchup(params) {
638
673
  }
639
674
  const chats = chatsResult?.chats ?? [];
640
675
  const collected = [];
641
- const perChatLimit = Math.min(limit, PER_CHAT_HISTORY_LIMIT_CAP);
642
676
  let historyFetchFailed = false;
643
677
  let rawWatermarkRowid = -Infinity;
644
678
  let rawWatermarkMs = -Infinity;
@@ -651,7 +685,7 @@ async function runIMessageCatchup(params) {
651
685
  try {
652
686
  historyResult = await client.request("messages.history", {
653
687
  chat_id: chatId,
654
- limit: perChatLimit,
688
+ limit: PER_CHAT_HISTORY_LIMIT,
655
689
  start: sinceISO,
656
690
  attachments: includeAttachments
657
691
  }, { timeoutMs: CATCHUP_RPC_TIMEOUT_MS });
@@ -758,7 +792,6 @@ async function runIMessageCatchup(params) {
758
792
  */
759
793
  const MAX_COALESCED_TEXT_CHARS = 4e3;
760
794
  const MAX_COALESCED_ATTACHMENTS = 20;
761
- const MAX_COALESCED_ENTRIES = 10;
762
795
  /**
763
796
  * Combine consecutive same-sender iMessage payloads into a single payload for
764
797
  * downstream dispatch. Used for the general inbound debounce
@@ -773,44 +806,56 @@ function combineIMessagePayloads(payloads) {
773
806
  if (payloads.length === 0) throw new Error("combineIMessagePayloads: cannot combine empty payloads");
774
807
  const first = expectDefined(payloads[0], "first iMessage payload to coalesce");
775
808
  if (payloads.length === 1) return first;
776
- const last = expectDefined(payloads.at(-1), "last iMessage payload to coalesce");
777
- const boundedPayloads = payloads.length > MAX_COALESCED_ENTRIES ? [...payloads.slice(0, 9), last] : payloads;
778
809
  const seenTexts = /* @__PURE__ */ new Set();
779
810
  const textParts = [];
780
- for (const payload of boundedPayloads) {
781
- const text = (payload.text ?? "").trim();
782
- if (!text) continue;
783
- const normalized = text.toLowerCase();
784
- if (seenTexts.has(normalized)) continue;
785
- seenTexts.add(normalized);
786
- textParts.push(text);
787
- }
788
- let combinedText = textParts.join(" ");
789
- if (combinedText.length > MAX_COALESCED_TEXT_CHARS) combinedText = `${sliceUtf16Safe(combinedText, 0, MAX_COALESCED_TEXT_CHARS)}…[truncated]`;
790
- const allAttachments = boundedPayloads.flatMap((p) => p.attachments ?? []).slice(0, MAX_COALESCED_ATTACHMENTS);
791
- const createdAts = payloads.map((p) => p.created_at).filter((c) => typeof c === "string" && c.length > 0);
792
- const latestCreatedAt = createdAts.length > 0 ? createdAts.reduce((a, b) => a > b ? a : b) : first.created_at;
811
+ const allAttachments = [];
812
+ const seenGuids = /* @__PURE__ */ new Set();
813
+ const coalescedMessageGuids = [];
814
+ let textLength = 0;
815
+ let latestCreatedAt;
793
816
  let maxRowid = -Infinity;
794
817
  let maxDateMs = -Infinity;
818
+ let reply;
819
+ let payloadIndex = 0;
795
820
  for (const payload of payloads) {
821
+ const keepContent = payloadIndex < 9 || payloadIndex === payloads.length - 1;
822
+ payloadIndex += 1;
823
+ const createdAt = payload.created_at;
824
+ if (typeof createdAt === "string" && createdAt.length > 0 && (latestCreatedAt === void 0 || createdAt > latestCreatedAt)) latestCreatedAt = createdAt;
796
825
  if (typeof payload.id === "number" && Number.isFinite(payload.id)) maxRowid = Math.max(maxRowid, payload.id);
797
- const dateMs = typeof payload.created_at === "string" ? Date.parse(payload.created_at) : NaN;
826
+ const dateMs = typeof createdAt === "string" ? Date.parse(createdAt) : NaN;
798
827
  if (Number.isFinite(dateMs)) maxDateMs = Math.max(maxDateMs, dateMs);
799
- }
800
- const seenGuids = /* @__PURE__ */ new Set();
801
- const coalescedMessageGuids = [];
802
- for (const payload of payloads) {
803
828
  const guid = payload.guid?.trim();
804
- if (!guid || seenGuids.has(guid)) continue;
805
- seenGuids.add(guid);
806
- coalescedMessageGuids.push(guid);
829
+ if (guid && !seenGuids.has(guid)) {
830
+ seenGuids.add(guid);
831
+ coalescedMessageGuids.push(guid);
832
+ }
833
+ if (!reply && (payload.thread_originator_guid != null || payload.reply_to_guid != null)) reply = payload;
834
+ if (!keepContent) continue;
835
+ const text = textLength <= MAX_COALESCED_TEXT_CHARS ? (payload.text ?? "").trim() : "";
836
+ if (text) {
837
+ const normalized = seenTexts.size > 0 ? text.toLowerCase() : void 0;
838
+ if (normalized === void 0 || !seenTexts.has(normalized)) {
839
+ const separatorLength = textParts.length > 0 ? 1 : 0;
840
+ const part = text.slice(0, 4001 - textLength - separatorLength);
841
+ textParts.push(part);
842
+ textLength += separatorLength + part.length;
843
+ if (textLength <= MAX_COALESCED_TEXT_CHARS) seenTexts.add(normalized ?? text.toLowerCase());
844
+ }
845
+ }
846
+ if (allAttachments.length < MAX_COALESCED_ATTACHMENTS) for (const attachment of payload.attachments ?? []) {
847
+ allAttachments.push(attachment);
848
+ if (allAttachments.length === MAX_COALESCED_ATTACHMENTS) break;
849
+ }
807
850
  }
808
- const reply = payloads.find((payload) => payload.thread_originator_guid != null || payload.reply_to_guid != null) ?? first;
851
+ let combinedText = textParts.join(" ");
852
+ if (textLength > MAX_COALESCED_TEXT_CHARS) combinedText = `${sliceUtf16Safe(combinedText, 0, MAX_COALESCED_TEXT_CHARS)}…[truncated]`;
853
+ reply ??= first;
809
854
  return {
810
855
  ...first,
811
856
  text: combinedText,
812
857
  attachments: allAttachments.length > 0 ? allAttachments : null,
813
- created_at: latestCreatedAt,
858
+ created_at: latestCreatedAt ?? first.created_at,
814
859
  thread_originator_guid: reply.thread_originator_guid ?? null,
815
860
  reply_to_guid: reply.reply_to_guid ?? null,
816
861
  reply_to_text: reply.reply_to_text ?? null,
@@ -1140,10 +1185,10 @@ var DefaultSentMessageCache = class {
1140
1185
  }
1141
1186
  this.cleanup();
1142
1187
  }
1143
- has(scope, lookup, options = false) {
1188
+ async has(scope, lookup, options = false) {
1144
1189
  this.cleanup();
1145
1190
  const resolvedOptions = typeof options === "boolean" ? { skipIdShortCircuit: options } : options;
1146
- if (hasPersistedIMessageEcho({
1191
+ if (await hasPersistedIMessageEcho({
1147
1192
  scope,
1148
1193
  text: lookup.text,
1149
1194
  media: lookup.media,
@@ -1434,12 +1479,7 @@ function describeReplyContext(message) {
1434
1479
  }
1435
1480
  function resolveInboundEchoMessageIds(message) {
1436
1481
  const values = [message.id != null ? String(message.id) : void 0, normalizeReplyField(message.guid)];
1437
- const ids = [];
1438
- for (const value of values) {
1439
- if (!value || ids.includes(value)) continue;
1440
- ids.push(value);
1441
- }
1442
- return ids;
1482
+ return uniqueStrings(values.filter((value) => Boolean(value)));
1443
1483
  }
1444
1484
  function rememberIMessageSkippedFromMeForSelfChatDedupe(params) {
1445
1485
  if (params.message.is_from_me !== true) return;
@@ -1467,14 +1507,14 @@ function rememberIMessageSkippedFromMeForSelfChatDedupe(params) {
1467
1507
  });
1468
1508
  else if (isAmbiguousSelfThread) params.selfChatCache?.remember(lookup);
1469
1509
  }
1470
- function hasIMessageEchoMatch(params) {
1510
+ async function hasIMessageEchoMatch(params) {
1471
1511
  const scopes = typeof params.scope === "string" ? [params.scope] : params.scope;
1472
1512
  for (const scope of scopes) {
1473
1513
  if (!scope) continue;
1474
- for (const messageId of params.messageIds) if (params.echoCache.has(scope, { messageId })) return true;
1514
+ for (const messageId of params.messageIds) if (await params.echoCache.has(scope, { messageId })) return true;
1475
1515
  const fallbackMessageId = params.messageIds[0];
1476
1516
  if (!params.text && !params.media && !fallbackMessageId) continue;
1477
- if (params.echoCache.has(scope, {
1517
+ if (await params.echoCache.has(scope, {
1478
1518
  text: params.text,
1479
1519
  media: params.media,
1480
1520
  messageId: fallbackMessageId
@@ -1485,34 +1525,17 @@ function hasIMessageEchoMatch(params) {
1485
1525
  }
1486
1526
  return false;
1487
1527
  }
1488
- function isKnownFromMeIMessageReactionTarget(params) {
1489
- const { messageId, accountId, chatId, chatGuid, chatIdentifier } = params;
1528
+ async function isKnownFromMeIMessageReactionTarget(params) {
1529
+ const { accountId, chatId, chatGuid, chatIdentifier } = params;
1490
1530
  const ctx = {
1491
1531
  accountId,
1492
1532
  chatId,
1493
1533
  chatGuid,
1494
1534
  chatIdentifier
1495
1535
  };
1496
- if (params.isKnownFromMeMessageId) return params.isKnownFromMeMessageId(messageId, ctx);
1497
- return isKnownFromMeIMessageMessageId(messageId, ctx);
1498
- }
1499
- /**
1500
- * Per-group `systemPrompt` resolution. Mirrors `resolveWhatsAppGroupSystemPrompt`
1501
- * in `extensions/whatsapp/src/system-prompt.ts`:
1502
- *
1503
- * 1. If the matched per-`chat_id` entry exists AND defines `systemPrompt` (key
1504
- * is present, value is non-null), use it. Trim whitespace; if the trim
1505
- * leaves an empty string, return `undefined` and DO NOT fall through to the
1506
- * wildcard. This is how operators say "this specific group has no prompt"
1507
- * without inheriting from `groups["*"]`.
1508
- * 2. Otherwise, return the wildcard `groups["*"].systemPrompt` (trimmed; empty
1509
- * after trim → `undefined`).
1510
- */
1511
- function resolveIMessageGroupSystemPrompt(params) {
1512
- const specific = params.groupConfig;
1513
- if (specific != null && specific.systemPrompt != null) return specific.systemPrompt.trim() || void 0;
1514
- const wildcard = params.defaultConfig?.systemPrompt;
1515
- return wildcard != null ? wildcard.trim() || void 0 : void 0;
1536
+ const isKnownFromMe = params.isKnownFromMeMessageId ?? isKnownFromMeIMessageMessageId;
1537
+ for (const messageId of params.messageIds) if (await isKnownFromMe(messageId, ctx)) return true;
1538
+ return false;
1516
1539
  }
1517
1540
  async function resolveIMessageInboundDecision(params) {
1518
1541
  const sender = (params.message.sender ?? "").trim();
@@ -1581,7 +1604,7 @@ async function resolveIMessageInboundDecision(params) {
1581
1604
  chatIdentifier,
1582
1605
  sender
1583
1606
  });
1584
- if (params.echoCache && (bodyText || inboundMessageId || mediaFacts.length > 0) && hasIMessageEchoMatch({
1607
+ if (params.echoCache && (bodyText || inboundMessageId || mediaFacts.length > 0) && await hasIMessageEchoMatch({
1585
1608
  echoCache: params.echoCache,
1586
1609
  scope: echoScope,
1587
1610
  text: bodyText || void 0,
@@ -1614,13 +1637,14 @@ async function resolveIMessageInboundDecision(params) {
1614
1637
  sender,
1615
1638
  chatId
1616
1639
  });
1617
- const accessDecision = await createChannelIngressResolver({
1640
+ const ingressResolver = getIMessageRuntime().channel.inbound.ingress.createResolver({
1618
1641
  channelId: "imessage",
1619
1642
  accountId: params.accountId,
1620
1643
  identity: imessageIngressIdentity,
1621
1644
  cfg: params.cfg,
1622
1645
  readStoreAllowFrom: async () => params.storeAllowFrom
1623
- }).message({
1646
+ });
1647
+ const resolveChannelIngress = (contextBinding) => ingressResolver.message({
1624
1648
  subject: {
1625
1649
  stableId: sender,
1626
1650
  aliases: {
@@ -1631,13 +1655,9 @@ async function resolveIMessageInboundDecision(params) {
1631
1655
  },
1632
1656
  conversation: {
1633
1657
  kind: isGroup ? "group" : "direct",
1634
- id: isGroup ? String(chatId ?? chatGuid ?? chatIdentifier ?? "unknown") : normalizeIMessageHandle(sender)
1658
+ id: chatId != null ? String(chatId) : sender
1635
1659
  },
1636
- ...reactionContext ? {} : { contextBinding: {
1637
- agentId: route.agentId,
1638
- sessionKey: route.sessionKey,
1639
- inboundEventKind: "user_request"
1640
- } },
1660
+ contextBinding,
1641
1661
  dmPolicy: normalizeDmPolicy(params.dmPolicy),
1642
1662
  groupPolicy: normalizeGroupPolicy(params.groupPolicy),
1643
1663
  policy: { groupAllowFromFallbackToAllowFrom: false },
@@ -1649,7 +1669,7 @@ async function resolveIMessageInboundDecision(params) {
1649
1669
  directGroupAllowFrom: "effective"
1650
1670
  }
1651
1671
  });
1652
- const { commandAccess, senderAccess } = accessDecision;
1672
+ const { commandAccess, senderAccess } = await resolveChannelIngress();
1653
1673
  const effectiveGroupAllowFrom = senderAccess.effectiveGroupAllowFrom;
1654
1674
  if (senderAccess.decision !== "allow") {
1655
1675
  if (isGroup) {
@@ -1709,7 +1729,7 @@ async function resolveIMessageInboundDecision(params) {
1709
1729
  };
1710
1730
  const targetGuid = reactionContext.targetGuid;
1711
1731
  const targetGuids = reactionContext.targetGuids ?? (targetGuid ? [targetGuid] : []);
1712
- const targetIsOwn = Boolean(targetGuid && (params.echoCache && hasIMessageEchoMatch({
1732
+ const targetIsOwn = Boolean(targetGuid && (params.echoCache && await hasIMessageEchoMatch({
1713
1733
  echoCache: params.echoCache,
1714
1734
  scope: buildIMessageEchoScope({
1715
1735
  accountId: params.accountId,
@@ -1720,14 +1740,14 @@ async function resolveIMessageInboundDecision(params) {
1720
1740
  sender
1721
1741
  }),
1722
1742
  messageIds: targetGuids
1723
- }) || targetGuids.some((messageId) => isKnownFromMeIMessageReactionTarget({
1724
- messageId,
1743
+ }) || await isKnownFromMeIMessageReactionTarget({
1744
+ messageIds: targetGuids,
1725
1745
  accountId: params.accountId,
1726
1746
  chatId,
1727
1747
  chatGuid,
1728
1748
  chatIdentifier,
1729
1749
  isKnownFromMeMessageId: params.isKnownFromMeMessageId
1730
- }))));
1750
+ })));
1731
1751
  if (notificationMode === "own" && !targetIsOwn) return {
1732
1752
  kind: "drop",
1733
1753
  reason: "reaction target not sent by agent"
@@ -1780,7 +1800,7 @@ async function resolveIMessageInboundDecision(params) {
1780
1800
  chatIdentifier,
1781
1801
  sender
1782
1802
  });
1783
- if (hasIMessageEchoMatch({
1803
+ if (await hasIMessageEchoMatch({
1784
1804
  echoCache: params.echoCache,
1785
1805
  scope: echoScope,
1786
1806
  text: bodyText || void 0,
@@ -1894,7 +1914,7 @@ async function resolveIMessageInboundDecision(params) {
1894
1914
  }
1895
1915
  return {
1896
1916
  kind: "dispatch",
1897
- channelIngress: accessDecision,
1917
+ resolveChannelIngress,
1898
1918
  isGroup,
1899
1919
  chatId,
1900
1920
  chatGuid,
@@ -1924,7 +1944,7 @@ async function buildIMessageInboundContext(params) {
1924
1944
  const chatId = decision.chatId;
1925
1945
  const chatTarget = decision.isGroup && chatId != null ? formatIMessageChatTarget(chatId) : void 0;
1926
1946
  const messageGuid = normalizeReplyField(params.message.guid);
1927
- const messageSid = (messageGuid ? rememberIMessageReplyCache({
1947
+ const messageSid = (messageGuid ? await rememberIMessageReplyCache({
1928
1948
  accountId: decision.route.accountId,
1929
1949
  messageId: messageGuid,
1930
1950
  chatGuid: decision.chatGuid,
@@ -1985,9 +2005,15 @@ async function buildIMessageInboundContext(params) {
1985
2005
  ...entry,
1986
2006
  url: entry.url ?? entry.path
1987
2007
  })));
2008
+ const channelIngress = await decision.resolveChannelIngress({
2009
+ agentId: decision.route.agentId,
2010
+ sessionKey: decision.route.sessionKey,
2011
+ messageId: messageSid,
2012
+ inboundEventKind: "user_request"
2013
+ });
1988
2014
  return {
1989
- ctxPayload: (params.buildContext ?? buildChannelInboundEventContext)({
1990
- channelIngress: decision.channelIngress,
2015
+ ctxPayload: await (params.buildContext ?? buildChannelInboundEventContext)({
2016
+ channelIngress,
1991
2017
  channel: "imessage",
1992
2018
  supplemental: {
1993
2019
  quote: decision.replyContext ? {
@@ -2017,9 +2043,7 @@ async function buildIMessageInboundContext(params) {
2017
2043
  label: conversationName
2018
2044
  },
2019
2045
  route: {
2020
- agentId: decision.route.agentId,
2021
- dmScope: decision.route.dmScope,
2022
- accountId: decision.route.accountId,
2046
+ ...decision.route,
2023
2047
  routeSessionKey: decision.route.sessionKey
2024
2048
  },
2025
2049
  reply: { to: replyTarget },
@@ -2302,19 +2326,6 @@ async function assertAllowedCanonicalAttachmentPath(params) {
2302
2326
  roots: canonicalRoots
2303
2327
  })) throw new Error("attachment path resolves outside allowed roots");
2304
2328
  }
2305
- async function readPinnedAttachmentBytes(handle, maxBytes) {
2306
- const chunks = [];
2307
- let totalBytes = 0;
2308
- while (totalBytes <= maxBytes) {
2309
- const remaining = maxBytes + 1 - totalBytes;
2310
- const chunk = Buffer.allocUnsafe(Math.min(65536, remaining));
2311
- const { bytesRead } = await handle.read(chunk, 0, chunk.length, null);
2312
- if (bytesRead === 0) return Buffer.concat(chunks, totalBytes);
2313
- chunks.push(chunk.subarray(0, bytesRead));
2314
- totalBytes += bytesRead;
2315
- }
2316
- throw new Error(`attachment exceeds ${Math.round(maxBytes / 1048576)}MB limit`);
2317
- }
2318
2329
  async function readAttachmentBuffer(params) {
2319
2330
  const opened = await (params.deps.openLocalFileSafely ?? openLocalFileSafely)({ filePath: params.attachmentPath });
2320
2331
  try {
@@ -2323,7 +2334,10 @@ async function readAttachmentBuffer(params) {
2323
2334
  canonicalPath: opened.realPath,
2324
2335
  allowedRoots: params.allowedRoots
2325
2336
  });
2326
- const buffer = await readPinnedAttachmentBytes(opened.handle, params.maxBytes);
2337
+ const buffer = await readFileHandleBounded(opened.handle, params.maxBytes).catch((error) => {
2338
+ if (error instanceof FsSafeError && error.code === "too-large") throw new Error(`attachment exceeds ${Math.round(params.maxBytes / 1048576)}MB limit`);
2339
+ throw error;
2340
+ });
2327
2341
  if (isHeicAttachment(params.attachmentPath, params.mimeType)) try {
2328
2342
  const convert = params.deps.convertHeicToJpeg;
2329
2343
  return {
@@ -2471,25 +2485,21 @@ function renderIMessagePollBody(poll, sender, renderOptions) {
2471
2485
  //#region extensions/imessage/src/monitor/reaction-system-event.ts
2472
2486
  function enqueueIMessageReactionSystemEvent(params) {
2473
2487
  const { decision, runtime } = params;
2474
- const queued = enqueueSystemEvent(decision.text, {
2475
- sessionKey: decision.route.sessionKey,
2476
- contextKey: decision.contextKey
2477
- });
2488
+ const queued = enqueueRoutedSystemEvent(decision.text, decision.route, { contextKey: decision.contextKey });
2478
2489
  runtime.log?.(`imessage: reaction system event ${queued ? "queued" : "deduped"} session=${decision.route.sessionKey} target=${decision.reaction.targetGuid ?? "unknown"} action=${decision.reaction.action} emoji=${decision.reaction.emoji}`);
2479
2490
  params.logVerbose?.(`imessage: reaction event enqueued: ${decision.text}`);
2480
2491
  return queued;
2481
2492
  }
2482
2493
  //#endregion
2483
2494
  //#region extensions/imessage/src/monitor/recovery-cursor.ts
2484
- const IMESSAGE_RECOVERY_CURSOR_NAMESPACE = "imessage.recovery-cursor";
2485
- const IMESSAGE_RECOVERY_CURSOR_MAX_ENTRIES = 64;
2495
+ const RECOVERY_CURSOR_STORE_OPTIONS = {
2496
+ namespace: "imessage.recovery-cursor",
2497
+ maxEntries: 64
2498
+ };
2486
2499
  const LEGACY_CATCHUP_CURSOR_NAMESPACE = "imessage.catchup-cursors";
2487
2500
  const LEGACY_CATCHUP_CURSOR_MAX_ENTRIES = 256;
2488
2501
  function openRecoveryCursorStore() {
2489
- return getIMessageRuntime().state.openSyncKeyedStore({
2490
- namespace: IMESSAGE_RECOVERY_CURSOR_NAMESPACE,
2491
- maxEntries: IMESSAGE_RECOVERY_CURSOR_MAX_ENTRIES
2492
- });
2502
+ return getIMessageRuntime().state.openKeyedStore(RECOVERY_CURSOR_STORE_OPTIONS);
2493
2503
  }
2494
2504
  function normalizeLocalDbPath(dbPath) {
2495
2505
  let resolved = dbPath.trim();
@@ -2521,67 +2531,105 @@ function resolveIMessageRecoveryCursorDbIdentity(params) {
2521
2531
  function recoveryCursorStoreKey(accountId, dbIdentity) {
2522
2532
  return `${accountId}\u0000${dbIdentity}`;
2523
2533
  }
2524
- function readRecoveryCursor(accountId, dbIdentity) {
2534
+ function decideRecoveryCursorUpdate(current, update) {
2535
+ if (update.kind === "rewind") {
2536
+ if (current?.lastRowid !== update.expectedRowid) return;
2537
+ } else if (current && current.lastRowid >= update.rowid) return;
2538
+ return { lastRowid: update.rowid };
2539
+ }
2540
+ async function applyRecoveryCursorUpdate(key, update) {
2541
+ const state = getIMessageRuntime().state;
2542
+ const store = state.openKeyedStore(RECOVERY_CURSOR_STORE_OPTIONS);
2543
+ if (!store.observe || !store.compareAndApply) {
2544
+ const legacy = state.openSyncKeyedStore(RECOVERY_CURSOR_STORE_OPTIONS);
2545
+ if (!legacy.update) throw new Error("iMessage recovery cursor persistence requires atomic update support.");
2546
+ let result;
2547
+ legacy.update(key, (current) => {
2548
+ const next = decideRecoveryCursorUpdate(current, update);
2549
+ result = next ?? current;
2550
+ return next;
2551
+ });
2552
+ return result;
2553
+ }
2554
+ const observe = store.observe.bind(store);
2555
+ const compareAndApply = store.compareAndApply.bind(store);
2556
+ let observation = await observe(key);
2557
+ for (;;) {
2558
+ const next = decideRecoveryCursorUpdate(observation.value, update);
2559
+ if (!next) return observation.value;
2560
+ const result = await compareAndApply(key, observation.comparison, {
2561
+ operation: "update",
2562
+ action: "set",
2563
+ value: next
2564
+ });
2565
+ if (result.status !== "conflict") return next;
2566
+ observation = result.current;
2567
+ }
2568
+ }
2569
+ async function readRecoveryCursor(accountId, dbIdentity) {
2525
2570
  try {
2526
2571
  const store = openRecoveryCursorStore();
2527
2572
  const key = recoveryCursorStoreKey(accountId, dbIdentity);
2528
- const value = store.lookup(key);
2573
+ const value = await store.lookup(key);
2529
2574
  if (value) return Number.isFinite(value.lastRowid) ? value.lastRowid : null;
2530
- const legacy = store.consume(accountId);
2575
+ const legacy = await store.consume(accountId);
2531
2576
  if (legacy && Number.isFinite(legacy.lastRowid)) {
2532
- store.register(key, { lastRowid: legacy.lastRowid });
2533
- return legacy.lastRowid;
2577
+ await store.registerIfAbsent(key, { lastRowid: legacy.lastRowid });
2578
+ const adopted = await store.lookup(key);
2579
+ return adopted && Number.isFinite(adopted.lastRowid) ? adopted.lastRowid : null;
2534
2580
  }
2535
2581
  return null;
2536
2582
  } catch {
2537
2583
  return null;
2538
2584
  }
2539
2585
  }
2540
- function migrateLegacyCatchupCursor(accountId, dbIdentity) {
2586
+ async function migrateLegacyCatchupCursor(accountId, dbIdentity) {
2541
2587
  try {
2542
- const legacy = getIMessageRuntime().state.openSyncKeyedStore({
2588
+ const legacy = getIMessageRuntime().state.openKeyedStore({
2543
2589
  namespace: LEGACY_CATCHUP_CURSOR_NAMESPACE,
2544
2590
  maxEntries: LEGACY_CATCHUP_CURSOR_MAX_ENTRIES
2545
2591
  });
2546
2592
  const key = createHash("sha256").update(accountId, "utf8").digest("hex").slice(0, 32);
2547
- const value = legacy.consume(key);
2593
+ const value = await legacy.consume(key);
2548
2594
  const rowid = typeof value?.lastSeenRowid === "number" && Number.isFinite(value.lastSeenRowid) ? value.lastSeenRowid : null;
2549
- if (rowid !== null) advanceIMessageRecoveryCursor(accountId, dbIdentity, rowid);
2595
+ if (rowid !== null) await advanceIMessageRecoveryCursor(accountId, dbIdentity, rowid);
2550
2596
  return rowid;
2551
2597
  } catch {
2552
2598
  return null;
2553
2599
  }
2554
2600
  }
2555
- function reconcileRecoveryCursorToWatermark(accountId, dbIdentity, cursorRowid, watermarkRowid) {
2601
+ async function reconcileRecoveryCursorToWatermark(accountId, dbIdentity, cursorRowid, watermarkRowid) {
2556
2602
  if (cursorRowid === null || watermarkRowid === null || cursorRowid <= watermarkRowid) return cursorRowid;
2557
2603
  try {
2558
- openRecoveryCursorStore().register(recoveryCursorStoreKey(accountId, dbIdentity), { lastRowid: watermarkRowid });
2604
+ return (await applyRecoveryCursorUpdate(recoveryCursorStoreKey(accountId, dbIdentity), {
2605
+ kind: "rewind",
2606
+ rowid: watermarkRowid,
2607
+ expectedRowid: cursorRowid
2608
+ }))?.lastRowid ?? watermarkRowid;
2559
2609
  } catch {
2560
2610
  return watermarkRowid;
2561
2611
  }
2562
- return watermarkRowid;
2563
2612
  }
2564
2613
  /**
2565
2614
  * Last durably admitted rowid for this account on `dbIdentity`, or null when
2566
2615
  * none is recorded yet (including when the only stored cursor belongs to a
2567
2616
  * different database).
2568
2617
  */
2569
- function loadIMessageRecoveryCursor(accountId, dbIdentity, options = {}) {
2618
+ async function loadIMessageRecoveryCursor(accountId, dbIdentity, options = {}) {
2570
2619
  const watermarkRowid = typeof options.watermarkRowid === "number" && Number.isFinite(options.watermarkRowid) ? options.watermarkRowid : null;
2571
- const current = readRecoveryCursor(accountId, dbIdentity);
2572
- if (current !== null) return reconcileRecoveryCursorToWatermark(accountId, dbIdentity, current, watermarkRowid);
2620
+ const current = await readRecoveryCursor(accountId, dbIdentity);
2621
+ if (current !== null) return await reconcileRecoveryCursorToWatermark(accountId, dbIdentity, current, watermarkRowid);
2573
2622
  if (options.migrateLegacyCatchup === false) return null;
2574
- return reconcileRecoveryCursorToWatermark(accountId, dbIdentity, migrateLegacyCatchupCursor(accountId, dbIdentity), watermarkRowid);
2623
+ return await reconcileRecoveryCursorToWatermark(accountId, dbIdentity, await migrateLegacyCatchupCursor(accountId, dbIdentity), watermarkRowid);
2575
2624
  }
2576
2625
  /** Advance the cursor forward to `rowid` (monotonic per database; never rewinds). */
2577
- function advanceIMessageRecoveryCursor(accountId, dbIdentity, rowid) {
2626
+ async function advanceIMessageRecoveryCursor(accountId, dbIdentity, rowid) {
2578
2627
  if (!Number.isFinite(rowid)) return;
2579
2628
  try {
2580
- const store = openRecoveryCursorStore();
2581
- const key = recoveryCursorStoreKey(accountId, dbIdentity);
2582
- const current = store.lookup(key);
2583
- if (current && current.lastRowid >= rowid) return;
2584
- store.register(key, { lastRowid: rowid });
2629
+ await applyRecoveryCursorUpdate(recoveryCursorStoreKey(accountId, dbIdentity), {
2630
+ kind: "advance",
2631
+ rowid
2632
+ });
2585
2633
  } catch {}
2586
2634
  }
2587
2635
  //#endregion
@@ -2761,20 +2809,6 @@ function formatIMessageInboundMediaBody(params) {
2761
2809
  function resolveIMessageWatchSourceDbPath(params) {
2762
2810
  return resolveIMessageChatDbLookupPath(params);
2763
2811
  }
2764
- async function resolveIMessageStartupRowidWatermark(dbPath) {
2765
- let database;
2766
- try {
2767
- database = openNodeSqliteDatabase(dbPath, { readOnly: true });
2768
- const row = database.prepare("SELECT MAX(ROWID) AS maxRowid FROM message").get();
2769
- if (typeof row?.maxRowid === "number" && Number.isFinite(row.maxRowid)) return row.maxRowid;
2770
- return row?.maxRowid === null ? 0 : null;
2771
- } catch (err) {
2772
- logVerbose(`imessage: startup rowid watermark unavailable for db=${dbPath}: ${String(err)}`);
2773
- return null;
2774
- } finally {
2775
- database?.close();
2776
- }
2777
- }
2778
2812
  const warnIfImsgUpgradeNeeded = (() => {
2779
2813
  let fired = false;
2780
2814
  return { fireOnce: (rpcMethods, runtime) => {
@@ -2841,7 +2875,7 @@ async function monitorIMessageProvider(opts = {}) {
2841
2875
  capability: CHANNEL_APPROVAL_GATEWAY_RUNTIME_CONTEXT_CAPABILITY
2842
2876
  });
2843
2877
  const imessageCfg = accountInfo.config;
2844
- const historyLimit = Math.max(0, imessageCfg.historyLimit ?? cfg.messages?.groupChat?.historyLimit ?? DEFAULT_GROUP_HISTORY_LIMIT);
2878
+ const historyLimit = resolvePromptHistoryLimit(imessageCfg.historyLimit ?? cfg.messages?.groupChat?.historyLimit);
2845
2879
  const groupHistories = /* @__PURE__ */ new Map();
2846
2880
  const sentMessageCache = createSentMessageCache();
2847
2881
  const selfChatCache = createSelfChatCache();
@@ -2905,7 +2939,7 @@ async function monitorIMessageProvider(opts = {}) {
2905
2939
  dbPath,
2906
2940
  remoteHost
2907
2941
  });
2908
- const recoveryCursorRowid = loadIMessageRecoveryCursor(accountInfo.accountId, recoveryCursorDbIdentity, {
2942
+ const recoveryCursorRowid = await loadIMessageRecoveryCursor(accountInfo.accountId, recoveryCursorDbIdentity, {
2909
2943
  migrateLegacyCatchup: !catchupCfg.enabled,
2910
2944
  watermarkRowid: recoveryBoundaryRowid
2911
2945
  });
@@ -2919,7 +2953,7 @@ async function monitorIMessageProvider(opts = {}) {
2919
2953
  for (const value of values) min = min === null ? value : Math.min(min, value);
2920
2954
  return min;
2921
2955
  }
2922
- function advanceRecoveryCursorAfterDurableEnqueue(rowid) {
2956
+ async function advanceRecoveryCursorAfterDurableEnqueue(rowid) {
2923
2957
  if (catchupCfg.enabled) return;
2924
2958
  failedRecoveryCursorRowids.delete(rowid);
2925
2959
  durableRecoveryCursorRowids.add(rowid);
@@ -2927,7 +2961,7 @@ async function monitorIMessageProvider(opts = {}) {
2927
2961
  const holdFloor = minSetValue(failedRecoveryCursorRowids);
2928
2962
  const nextCursorRowid = holdFloor !== null && maxDurableRowid >= holdFloor ? holdFloor - 1 : maxDurableRowid;
2929
2963
  if (nextCursorRowid >= 0 && nextCursorRowid > latestAdvancedRecoveryCursorRowid) {
2930
- advanceIMessageRecoveryCursor(accountInfo.accountId, recoveryCursorDbIdentity, nextCursorRowid);
2964
+ await advanceIMessageRecoveryCursor(accountInfo.accountId, recoveryCursorDbIdentity, nextCursorRowid);
2931
2965
  latestAdvancedRecoveryCursorRowid = nextCursorRowid;
2932
2966
  for (const durableRowid of durableRecoveryCursorRowids) if (durableRowid <= nextCursorRowid) durableRecoveryCursorRowids.delete(durableRowid);
2933
2967
  }
@@ -3190,10 +3224,10 @@ async function monitorIMessageProvider(opts = {}) {
3190
3224
  }
3191
3225
  }
3192
3226
  const storePath = resolveStorePath(cfg.session?.store, { agentId: decision.route.agentId });
3193
- const privateApiStatus = getCachedIMessagePrivateApiStatus(cliPath);
3227
+ const privateApiStatus = await probeIMessagePrivateApi(cliPath, probeTimeoutMs);
3194
3228
  const supportsTyping = imessageRpcSupportsMethod(privateApiStatus, "typing");
3195
3229
  const supportsRead = imessageRpcSupportsMethod(privateApiStatus, "read");
3196
- if (privateApiStatus?.available === true) {
3230
+ if (privateApiStatus.available) {
3197
3231
  if (!supportsTyping || !supportsRead) warnIfImsgUpgradeNeeded.fireOnce(privateApiStatus.rpcMethods, runtime);
3198
3232
  }
3199
3233
  const configuredTypingMode = resolveConfiguredIMessageTypingMode(cfg, decision.route.agentId);
@@ -3566,7 +3600,7 @@ async function monitorIMessageProvider(opts = {}) {
3566
3600
  return { kind: "deferred" };
3567
3601
  },
3568
3602
  onDurableEnqueue: async (facts) => {
3569
- advanceRecoveryCursorAfterDurableEnqueue(facts.rowid);
3603
+ await advanceRecoveryCursorAfterDurableEnqueue(facts.rowid);
3570
3604
  await maybeAdvanceLiveCatchupCursor({
3571
3605
  id: facts.rowid,
3572
3606
  created_at: facts.createdAt