@openclaw/imessage 2026.9.3 → 2026.9.5

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 (662) hide show
  1. package/assets/activity.svg +40 -0
  2. package/assets/icon.png +0 -0
  3. package/dist/{actions.runtime-CzvR20qT.js → .setup/actions.runtime-B-qGAkYG.mjs} +106 -176
  4. package/dist/.setup/api-DcUWvBmD.mjs +10 -0
  5. package/dist/.setup/api-_NoJAo2x.mjs +14 -0
  6. package/dist/{approval-handler.runtime-B6JGnxQf.js → .setup/approval-handler.runtime-CkG235P7.mjs} +27 -27
  7. package/dist/{approval-reactions-BM_AwHPq.js → .setup/approval-reactions-CX1-6KeG.mjs} +32 -32
  8. package/dist/{channel-B6qtBfCj.js → .setup/channel-CCbYCQiN.mjs} +29 -17
  9. package/dist/{channel.runtime-C2lcFXWn.js → .setup/channel.runtime-Kw4iCQax.mjs} +7 -5
  10. package/dist/{group-policy-Duro87b4.js → .setup/group-policy-BoOAkmoQ.mjs} +35 -75
  11. package/dist/{media-contract-pns3TSS5.js → .setup/media-contract-BpPh5Oh1.mjs} +1 -1
  12. package/dist/.setup/message-tool-api-DZSH-2gY.mjs +148 -0
  13. package/dist/{monitor-Dj3TAimI.js → .setup/monitor-CSeWJ3Qh.mjs} +231 -154
  14. package/dist/{question-reactions-9tBYB1_F.js → .setup/question-reactions-lm8OxWbb.mjs} +2 -2
  15. package/dist/{remote-file-5n5LznCa.js → .setup/remote-file-4RbwiXYh.mjs} +11 -8
  16. package/dist/{sanitize-outbound-C6UF2cvr.js → .setup/sanitize-outbound-o1ePXajW.mjs} +83 -47
  17. package/dist/{send-CIHiLtcY.js → .setup/send-DXiUWygv.mjs} +157 -173
  18. package/dist/{state-migrations-D-fyHVcb.js → .setup/state-migrations-CIwg07l5.mjs} +3 -3
  19. package/dist/{message-tool-api-CUoFESHj.js → .setup/targets-Cc9vthzI.mjs} +53 -155
  20. package/dist/api.js +9 -14
  21. package/dist/channel-config-api.js +1 -1
  22. package/dist/channel-plugin-api.js +1 -1
  23. package/dist/contract-api.js +1 -1
  24. package/dist/doctor-contract-api.js +1 -1
  25. package/dist/media-contract-api.js +1 -1
  26. package/dist/message-tool-api.js +1 -1
  27. package/dist/runtime-api.js +7 -6
  28. package/dist/session-binding-contract-api.js +1 -1
  29. package/dist/setup-entry.js +2 -1
  30. package/dist/src/send-receipt-db.worker.js +35 -0
  31. package/node_modules/typebox/build/compile/validator.d.mts +1 -1
  32. package/node_modules/typebox/build/compile/validator.mjs +1 -1
  33. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +7 -5
  34. package/node_modules/typebox/build/format/iri.mjs +5 -1
  35. package/node_modules/typebox/build/guard/emit.mjs +2 -4
  36. package/node_modules/typebox/build/guard/guard.mjs +6 -18
  37. package/node_modules/typebox/build/guard/string.mjs +16 -24
  38. package/node_modules/typebox/build/schema/build.mjs +2 -2
  39. package/node_modules/typebox/build/schema/check.mjs +1 -1
  40. package/node_modules/typebox/build/schema/compile.d.mts +3 -2
  41. package/node_modules/typebox/build/schema/compile.mjs +8 -8
  42. package/node_modules/typebox/build/schema/engine/_context.d.mts +6 -7
  43. package/node_modules/typebox/build/schema/engine/_context.mjs +23 -15
  44. package/node_modules/typebox/build/schema/engine/_functions.d.mts +2 -2
  45. package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -1
  46. package/node_modules/typebox/build/schema/engine/_reducer.d.mts +3 -3
  47. package/node_modules/typebox/build/schema/engine/_refine.d.mts +5 -5
  48. package/node_modules/typebox/build/schema/engine/_refine.mjs +4 -7
  49. package/node_modules/typebox/build/schema/engine/_stack.d.mts +34 -16
  50. package/node_modules/typebox/build/schema/engine/_stack.mjs +148 -104
  51. package/node_modules/typebox/build/schema/engine/additionalItems.d.mts +4 -4
  52. package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +8 -8
  53. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +26 -18
  54. package/node_modules/typebox/build/schema/engine/allOf.d.mts +4 -4
  55. package/node_modules/typebox/build/schema/engine/allOf.mjs +3 -3
  56. package/node_modules/typebox/build/schema/engine/anyOf.d.mts +4 -4
  57. package/node_modules/typebox/build/schema/engine/anyOf.mjs +5 -10
  58. package/node_modules/typebox/build/schema/engine/boolean.d.mts +4 -4
  59. package/node_modules/typebox/build/schema/engine/boolean.mjs +2 -6
  60. package/node_modules/typebox/build/schema/engine/const.d.mts +4 -4
  61. package/node_modules/typebox/build/schema/engine/const.mjs +2 -6
  62. package/node_modules/typebox/build/schema/engine/contains.d.mts +4 -4
  63. package/node_modules/typebox/build/schema/engine/contains.mjs +2 -6
  64. package/node_modules/typebox/build/schema/engine/dependencies.d.mts +4 -4
  65. package/node_modules/typebox/build/schema/engine/dependencies.mjs +3 -6
  66. package/node_modules/typebox/build/schema/engine/dependentRequired.d.mts +4 -4
  67. package/node_modules/typebox/build/schema/engine/dependentRequired.mjs +2 -6
  68. package/node_modules/typebox/build/schema/engine/dependentSchemas.d.mts +4 -4
  69. package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +4 -4
  70. package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +11 -7
  71. package/node_modules/typebox/build/schema/engine/enum.d.mts +4 -4
  72. package/node_modules/typebox/build/schema/engine/enum.mjs +2 -6
  73. package/node_modules/typebox/build/schema/engine/exclusiveMaximum.d.mts +4 -4
  74. package/node_modules/typebox/build/schema/engine/exclusiveMaximum.mjs +2 -6
  75. package/node_modules/typebox/build/schema/engine/exclusiveMinimum.d.mts +4 -4
  76. package/node_modules/typebox/build/schema/engine/exclusiveMinimum.mjs +2 -6
  77. package/node_modules/typebox/build/schema/engine/format.d.mts +4 -4
  78. package/node_modules/typebox/build/schema/engine/format.mjs +2 -6
  79. package/node_modules/typebox/build/schema/engine/if.d.mts +4 -4
  80. package/node_modules/typebox/build/schema/engine/if.mjs +7 -15
  81. package/node_modules/typebox/build/schema/engine/items.d.mts +4 -4
  82. package/node_modules/typebox/build/schema/engine/items.mjs +1 -1
  83. package/node_modules/typebox/build/schema/engine/maxContains.d.mts +4 -4
  84. package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -6
  85. package/node_modules/typebox/build/schema/engine/maxItems.d.mts +4 -4
  86. package/node_modules/typebox/build/schema/engine/maxItems.mjs +2 -6
  87. package/node_modules/typebox/build/schema/engine/maxLength.d.mts +4 -4
  88. package/node_modules/typebox/build/schema/engine/maxLength.mjs +2 -6
  89. package/node_modules/typebox/build/schema/engine/maxProperties.d.mts +4 -4
  90. package/node_modules/typebox/build/schema/engine/maxProperties.mjs +2 -6
  91. package/node_modules/typebox/build/schema/engine/maximum.d.mts +4 -4
  92. package/node_modules/typebox/build/schema/engine/maximum.mjs +2 -6
  93. package/node_modules/typebox/build/schema/engine/minContains.d.mts +4 -4
  94. package/node_modules/typebox/build/schema/engine/minContains.mjs +2 -6
  95. package/node_modules/typebox/build/schema/engine/minItems.d.mts +5 -5
  96. package/node_modules/typebox/build/schema/engine/minItems.mjs +2 -6
  97. package/node_modules/typebox/build/schema/engine/minLength.d.mts +4 -4
  98. package/node_modules/typebox/build/schema/engine/minLength.mjs +2 -6
  99. package/node_modules/typebox/build/schema/engine/minProperties.d.mts +4 -4
  100. package/node_modules/typebox/build/schema/engine/minProperties.mjs +2 -6
  101. package/node_modules/typebox/build/schema/engine/minimum.d.mts +4 -4
  102. package/node_modules/typebox/build/schema/engine/minimum.mjs +2 -6
  103. package/node_modules/typebox/build/schema/engine/multipleOf.d.mts +4 -4
  104. package/node_modules/typebox/build/schema/engine/multipleOf.mjs +2 -6
  105. package/node_modules/typebox/build/schema/engine/not.d.mts +4 -4
  106. package/node_modules/typebox/build/schema/engine/not.mjs +4 -8
  107. package/node_modules/typebox/build/schema/engine/oneOf.d.mts +4 -4
  108. package/node_modules/typebox/build/schema/engine/oneOf.mjs +6 -11
  109. package/node_modules/typebox/build/schema/engine/pattern.d.mts +4 -4
  110. package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -7
  111. package/node_modules/typebox/build/schema/engine/patternProperties.d.mts +4 -4
  112. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +1 -1
  113. package/node_modules/typebox/build/schema/engine/prefixItems.d.mts +4 -4
  114. package/node_modules/typebox/build/schema/engine/prefixItems.mjs +1 -1
  115. package/node_modules/typebox/build/schema/engine/properties.d.mts +4 -4
  116. package/node_modules/typebox/build/schema/engine/properties.mjs +1 -1
  117. package/node_modules/typebox/build/schema/engine/propertyNames.d.mts +4 -4
  118. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +4 -10
  119. package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +4 -4
  120. package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +11 -7
  121. package/node_modules/typebox/build/schema/engine/ref.d.mts +4 -4
  122. package/node_modules/typebox/build/schema/engine/ref.mjs +19 -15
  123. package/node_modules/typebox/build/schema/engine/required.d.mts +4 -4
  124. package/node_modules/typebox/build/schema/engine/required.mjs +2 -6
  125. package/node_modules/typebox/build/schema/engine/schema.d.mts +7 -7
  126. package/node_modules/typebox/build/schema/engine/schema.mjs +137 -133
  127. package/node_modules/typebox/build/schema/engine/type.d.mts +4 -4
  128. package/node_modules/typebox/build/schema/engine/type.mjs +2 -6
  129. package/node_modules/typebox/build/schema/engine/unevaluatedItems.d.mts +4 -4
  130. package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +5 -9
  131. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.d.mts +4 -4
  132. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +5 -9
  133. package/node_modules/typebox/build/schema/engine/uniqueItems.d.mts +4 -4
  134. package/node_modules/typebox/build/schema/engine/uniqueItems.mjs +2 -6
  135. package/node_modules/typebox/build/schema/errors.d.mts +2 -2
  136. package/node_modules/typebox/build/schema/errors.mjs +8 -14
  137. package/node_modules/typebox/build/schema/intern/index.d.mts +1 -0
  138. package/node_modules/typebox/build/schema/intern/index.mjs +1 -0
  139. package/node_modules/typebox/build/schema/intern/intern.d.mts +11 -0
  140. package/node_modules/typebox/build/schema/intern/intern.mjs +293 -0
  141. package/node_modules/typebox/build/schema/meta/draft_2019_09.d.mts +2 -0
  142. package/node_modules/typebox/build/schema/meta/draft_2019_09.mjs +288 -0
  143. package/node_modules/typebox/build/schema/meta/draft_2020_12.d.mts +2 -0
  144. package/node_modules/typebox/build/schema/meta/draft_2020_12.mjs +300 -0
  145. package/node_modules/typebox/build/schema/meta/draft_3.d.mts +2 -0
  146. package/node_modules/typebox/build/schema/meta/draft_3.mjs +143 -0
  147. package/node_modules/typebox/build/schema/meta/draft_4.d.mts +2 -0
  148. package/node_modules/typebox/build/schema/meta/draft_4.mjs +149 -0
  149. package/node_modules/typebox/build/schema/meta/draft_6.d.mts +2 -0
  150. package/node_modules/typebox/build/schema/meta/draft_6.mjs +155 -0
  151. package/node_modules/typebox/build/schema/meta/draft_7.d.mts +2 -0
  152. package/node_modules/typebox/build/schema/meta/draft_7.mjs +172 -0
  153. package/node_modules/typebox/build/schema/meta/index.d.mts +2 -0
  154. package/node_modules/typebox/build/schema/meta/index.mjs +2 -0
  155. package/node_modules/typebox/build/schema/meta/meta.d.mts +9 -0
  156. package/node_modules/typebox/build/schema/meta/meta.mjs +15 -0
  157. package/node_modules/typebox/build/schema/meta/schema.d.mts +6 -0
  158. package/node_modules/typebox/build/schema/meta/schema.mjs +1 -0
  159. package/node_modules/typebox/build/schema/parse.d.mts +1 -0
  160. package/node_modules/typebox/build/schema/parse.mjs +10 -5
  161. package/node_modules/typebox/build/schema/resolve/resolve.d.mts +8 -3
  162. package/node_modules/typebox/build/schema/resolve/resolve.mjs +268 -139
  163. package/node_modules/typebox/build/schema/schema.d.mts +2 -0
  164. package/node_modules/typebox/build/schema/schema.mjs +2 -0
  165. package/node_modules/typebox/build/value/errors/errors.d.mts +2 -12
  166. package/node_modules/typebox/build/value/errors/errors.mjs +2 -7
  167. package/node_modules/typebox/package.json +1 -1
  168. package/node_modules/typebox/readme.md +59 -89
  169. package/node_modules/zod/README.md +27 -0
  170. package/node_modules/zod/compile.cjs +77 -0
  171. package/node_modules/zod/compile.d.cts +1 -0
  172. package/node_modules/zod/compile.d.ts +1 -0
  173. package/node_modules/zod/compile.js +52 -0
  174. package/node_modules/zod/index.cjs +2 -2
  175. package/node_modules/zod/index.d.cts +1 -2
  176. package/node_modules/zod/index.d.ts +1 -2
  177. package/node_modules/zod/index.js +5 -2
  178. package/node_modules/zod/package.json +13 -2
  179. package/node_modules/zod/src/compile.ts +56 -0
  180. package/node_modules/zod/src/index.ts +5 -2
  181. package/node_modules/zod/src/v3/ZodError.ts +22 -12
  182. package/node_modules/zod/src/v3/tests/error.test.ts +35 -0
  183. package/node_modules/zod/src/v3/tests/intersection.test.ts +18 -0
  184. package/node_modules/zod/src/v3/tests/language-server.test.ts +1 -2
  185. package/node_modules/zod/src/v3/tests/object.test.ts +3 -6
  186. package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -80
  187. package/node_modules/zod/src/v3/tests/string.test.ts +6 -0
  188. package/node_modules/zod/src/v3/types.ts +5 -5
  189. package/node_modules/zod/src/v4/classic/checks.ts +1 -0
  190. package/node_modules/zod/src/v4/classic/compat.ts +26 -18
  191. package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
  192. package/node_modules/zod/src/v4/classic/errors.ts +59 -44
  193. package/node_modules/zod/src/v4/classic/external.ts +12 -9
  194. package/node_modules/zod/src/v4/classic/from-json-schema.ts +140 -78
  195. package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
  196. package/node_modules/zod/src/v4/classic/index.ts +2 -2
  197. package/node_modules/zod/src/v4/classic/iso.ts +2 -72
  198. package/node_modules/zod/src/v4/classic/parse.ts +10 -4
  199. package/node_modules/zod/src/v4/classic/schemas.ts +452 -262
  200. package/node_modules/zod/src/v4/classic/tests/apply.test.ts +27 -0
  201. package/node_modules/zod/src/v4/classic/tests/array.test.ts +2 -2
  202. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +135 -0
  203. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +30 -1
  204. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +278 -0
  205. package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +1 -2
  206. package/node_modules/zod/src/v4/classic/tests/codec.test.ts +2 -1
  207. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +2 -2
  208. package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -0
  209. package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +720 -0
  210. package/node_modules/zod/src/v4/classic/tests/date.test.ts +30 -0
  211. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +32 -18
  212. package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +380 -0
  213. package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +32 -0
  214. package/node_modules/zod/src/v4/classic/tests/default.test.ts +46 -0
  215. package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +31 -7
  216. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +155 -13
  217. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +11 -0
  218. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +112 -2
  219. package/node_modules/zod/src/v4/classic/tests/error.test.ts +274 -6
  220. package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +425 -10
  221. package/node_modules/zod/src/v4/classic/tests/function.test.ts +31 -0
  222. package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +2 -9
  223. package/node_modules/zod/src/v4/classic/tests/hash.test.ts +1 -2
  224. package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +159 -0
  225. package/node_modules/zod/src/v4/classic/tests/index.test.ts +21 -2
  226. package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +281 -0
  227. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +47 -0
  228. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +136 -0
  229. package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +183 -0
  230. package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +3 -10
  231. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +36 -1
  232. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +12 -1
  233. package/node_modules/zod/src/v4/classic/tests/map.test.ts +12 -0
  234. package/node_modules/zod/src/v4/classic/tests/number.test.ts +46 -9
  235. package/node_modules/zod/src/v4/classic/tests/object.test.ts +245 -12
  236. package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +234 -0
  237. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +49 -16
  238. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +51 -4
  239. package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +20 -2
  240. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -68
  241. package/node_modules/zod/src/v4/classic/tests/record.test.ts +186 -18
  242. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +33 -2
  243. package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
  244. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +60 -0
  245. package/node_modules/zod/src/v4/classic/tests/set.test.ts +9 -0
  246. package/node_modules/zod/src/v4/classic/tests/string.test.ts +127 -5
  247. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +18 -0
  248. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +11 -2
  249. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +1585 -173
  250. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +45 -30
  251. package/node_modules/zod/src/v4/classic/tests/union.test.ts +39 -2
  252. package/node_modules/zod/src/v4/classic/tests/validate.test.ts +76 -0
  253. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +2 -2
  254. package/node_modules/zod/src/v4/core/api.ts +48 -12
  255. package/node_modules/zod/src/v4/core/checks.ts +57 -44
  256. package/node_modules/zod/src/v4/core/compile.ts +2188 -0
  257. package/node_modules/zod/src/v4/core/core.ts +98 -19
  258. package/node_modules/zod/src/v4/core/doc.ts +11 -7
  259. package/node_modules/zod/src/v4/core/errors.ts +115 -24
  260. package/node_modules/zod/src/v4/core/index.ts +3 -0
  261. package/node_modules/zod/src/v4/core/json-schema-generator.ts +6 -1
  262. package/node_modules/zod/src/v4/core/json-schema-processors.ts +257 -93
  263. package/node_modules/zod/src/v4/core/json-schema.ts +2 -1
  264. package/node_modules/zod/src/v4/core/memoizer.ts +284 -0
  265. package/node_modules/zod/src/v4/core/parse.ts +131 -38
  266. package/node_modules/zod/src/v4/core/regexes.ts +30 -13
  267. package/node_modules/zod/src/v4/core/registries.ts +2 -2
  268. package/node_modules/zod/src/v4/core/schemas.ts +759 -461
  269. package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +969 -0
  270. package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +89 -0
  271. package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
  272. package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +34 -0
  273. package/node_modules/zod/src/v4/core/tests/compile.test.ts +1639 -0
  274. package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +1 -2
  275. package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +1 -2
  276. package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +3 -3
  277. package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -0
  278. package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
  279. package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +51 -0
  280. package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +31 -0
  281. package/node_modules/zod/src/v4/core/to-json-schema.ts +275 -42
  282. package/node_modules/zod/src/v4/core/util.ts +268 -42
  283. package/node_modules/zod/src/v4/core/versions.ts +2 -2
  284. package/node_modules/zod/src/v4/core/visit.ts +193 -0
  285. package/node_modules/zod/src/v4/index.ts +3 -3
  286. package/node_modules/zod/src/v4/locales/ar.ts +3 -0
  287. package/node_modules/zod/src/v4/locales/az.ts +3 -0
  288. package/node_modules/zod/src/v4/locales/be.ts +10 -0
  289. package/node_modules/zod/src/v4/locales/bg.ts +3 -0
  290. package/node_modules/zod/src/v4/locales/bn.ts +121 -0
  291. package/node_modules/zod/src/v4/locales/ca.ts +3 -0
  292. package/node_modules/zod/src/v4/locales/ckb.ts +138 -0
  293. package/node_modules/zod/src/v4/locales/cs.ts +3 -0
  294. package/node_modules/zod/src/v4/locales/da.ts +5 -2
  295. package/node_modules/zod/src/v4/locales/de.ts +3 -0
  296. package/node_modules/zod/src/v4/locales/el.ts +1 -0
  297. package/node_modules/zod/src/v4/locales/en.ts +15 -4
  298. package/node_modules/zod/src/v4/locales/eo.ts +3 -0
  299. package/node_modules/zod/src/v4/locales/es.ts +2 -0
  300. package/node_modules/zod/src/v4/locales/fa.ts +3 -0
  301. package/node_modules/zod/src/v4/locales/fi.ts +3 -0
  302. package/node_modules/zod/src/v4/locales/fr-CA.ts +3 -0
  303. package/node_modules/zod/src/v4/locales/fr.ts +19 -14
  304. package/node_modules/zod/src/v4/locales/gu.ts +121 -0
  305. package/node_modules/zod/src/v4/locales/he.ts +6 -1
  306. package/node_modules/zod/src/v4/locales/hi.ts +124 -0
  307. package/node_modules/zod/src/v4/locales/hr.ts +2 -0
  308. package/node_modules/zod/src/v4/locales/hu.ts +3 -0
  309. package/node_modules/zod/src/v4/locales/hy.ts +9 -0
  310. package/node_modules/zod/src/v4/locales/id.ts +3 -0
  311. package/node_modules/zod/src/v4/locales/index.ts +10 -0
  312. package/node_modules/zod/src/v4/locales/is.ts +3 -0
  313. package/node_modules/zod/src/v4/locales/it.ts +3 -0
  314. package/node_modules/zod/src/v4/locales/ja.ts +3 -0
  315. package/node_modules/zod/src/v4/locales/ka.ts +3 -0
  316. package/node_modules/zod/src/v4/locales/km.ts +3 -0
  317. package/node_modules/zod/src/v4/locales/kn.ts +124 -0
  318. package/node_modules/zod/src/v4/locales/ko.ts +3 -0
  319. package/node_modules/zod/src/v4/locales/lt.ts +2 -0
  320. package/node_modules/zod/src/v4/locales/mk.ts +3 -0
  321. package/node_modules/zod/src/v4/locales/ms.ts +3 -0
  322. package/node_modules/zod/src/v4/locales/ne.ts +126 -0
  323. package/node_modules/zod/src/v4/locales/nl.ts +3 -0
  324. package/node_modules/zod/src/v4/locales/nn.ts +119 -0
  325. package/node_modules/zod/src/v4/locales/no.ts +5 -2
  326. package/node_modules/zod/src/v4/locales/ota.ts +3 -0
  327. package/node_modules/zod/src/v4/locales/pl.ts +3 -0
  328. package/node_modules/zod/src/v4/locales/ps.ts +3 -0
  329. package/node_modules/zod/src/v4/locales/pt-BR.ts +159 -0
  330. package/node_modules/zod/src/v4/locales/pt.ts +99 -58
  331. package/node_modules/zod/src/v4/locales/ro.ts +1 -0
  332. package/node_modules/zod/src/v4/locales/ru.ts +10 -0
  333. package/node_modules/zod/src/v4/locales/sk.ts +121 -0
  334. package/node_modules/zod/src/v4/locales/sl.ts +3 -0
  335. package/node_modules/zod/src/v4/locales/sv.ts +5 -2
  336. package/node_modules/zod/src/v4/locales/ta.ts +3 -0
  337. package/node_modules/zod/src/v4/locales/th.ts +3 -0
  338. package/node_modules/zod/src/v4/locales/tk.ts +111 -0
  339. package/node_modules/zod/src/v4/locales/tr.ts +3 -0
  340. package/node_modules/zod/src/v4/locales/uk.ts +3 -0
  341. package/node_modules/zod/src/v4/locales/ur.ts +3 -0
  342. package/node_modules/zod/src/v4/locales/uz.ts +1 -0
  343. package/node_modules/zod/src/v4/locales/vi.ts +3 -0
  344. package/node_modules/zod/src/v4/locales/yo.ts +3 -0
  345. package/node_modules/zod/src/v4/locales/zh-CN.ts +3 -0
  346. package/node_modules/zod/src/v4/locales/zh-TW.ts +3 -0
  347. package/node_modules/zod/src/v4/mini/checks.ts +1 -0
  348. package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
  349. package/node_modules/zod/src/v4/mini/external.ts +10 -1
  350. package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
  351. package/node_modules/zod/src/v4/mini/parse.ts +2 -0
  352. package/node_modules/zod/src/v4/mini/schemas.ts +135 -56
  353. package/node_modules/zod/src/v4/mini/tests/apply.test.ts +33 -0
  354. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +62 -1
  355. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +14 -0
  356. package/node_modules/zod/src/v4/mini/tests/codec.test.ts +35 -1
  357. package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +84 -0
  358. package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +54 -0
  359. package/node_modules/zod/src/v4/mini/tests/error.test.ts +23 -4
  360. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +9 -0
  361. package/node_modules/zod/src/v4/mini/tests/index.test.ts +72 -5
  362. package/node_modules/zod/src/v4/mini/tests/number.test.ts +14 -0
  363. package/node_modules/zod/src/v4/mini/tests/object.test.ts +65 -0
  364. package/node_modules/zod/src/v4/mini/tests/string.test.ts +21 -0
  365. package/node_modules/zod/v3/ZodError.cjs +22 -12
  366. package/node_modules/zod/v3/ZodError.d.cts +1 -1
  367. package/node_modules/zod/v3/ZodError.d.ts +1 -1
  368. package/node_modules/zod/v3/ZodError.js +22 -12
  369. package/node_modules/zod/v3/types.cjs +7 -5
  370. package/node_modules/zod/v3/types.js +7 -5
  371. package/node_modules/zod/v4/classic/checks.cjs +2 -1
  372. package/node_modules/zod/v4/classic/checks.d.cts +1 -1
  373. package/node_modules/zod/v4/classic/checks.d.ts +1 -1
  374. package/node_modules/zod/v4/classic/checks.js +1 -1
  375. package/node_modules/zod/v4/classic/compat.d.cts +9 -11
  376. package/node_modules/zod/v4/classic/compat.d.ts +9 -11
  377. package/node_modules/zod/v4/classic/deep-partial.cjs +39 -0
  378. package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
  379. package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
  380. package/node_modules/zod/v4/classic/deep-partial.js +13 -0
  381. package/node_modules/zod/v4/classic/errors.cjs +43 -34
  382. package/node_modules/zod/v4/classic/errors.d.cts +3 -4
  383. package/node_modules/zod/v4/classic/errors.d.ts +3 -4
  384. package/node_modules/zod/v4/classic/errors.js +43 -34
  385. package/node_modules/zod/v4/classic/external.cjs +30 -27
  386. package/node_modules/zod/v4/classic/external.d.cts +5 -2
  387. package/node_modules/zod/v4/classic/external.d.ts +5 -2
  388. package/node_modules/zod/v4/classic/external.js +5 -8
  389. package/node_modules/zod/v4/classic/from-json-schema.cjs +136 -75
  390. package/node_modules/zod/v4/classic/from-json-schema.js +136 -75
  391. package/node_modules/zod/v4/classic/in-out.cjs +63 -0
  392. package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
  393. package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
  394. package/node_modules/zod/v4/classic/in-out.js +36 -0
  395. package/node_modules/zod/v4/classic/index.cjs +2 -2
  396. package/node_modules/zod/v4/classic/index.d.cts +1 -2
  397. package/node_modules/zod/v4/classic/index.d.ts +1 -2
  398. package/node_modules/zod/v4/classic/index.js +2 -2
  399. package/node_modules/zod/v4/classic/iso.cjs +11 -22
  400. package/node_modules/zod/v4/classic/iso.d.cts +2 -17
  401. package/node_modules/zod/v4/classic/iso.d.ts +2 -17
  402. package/node_modules/zod/v4/classic/iso.js +2 -17
  403. package/node_modules/zod/v4/classic/parse.cjs +4 -1
  404. package/node_modules/zod/v4/classic/parse.d.cts +17 -4
  405. package/node_modules/zod/v4/classic/parse.d.ts +17 -4
  406. package/node_modules/zod/v4/classic/parse.js +1 -0
  407. package/node_modules/zod/v4/classic/schemas.cjs +498 -398
  408. package/node_modules/zod/v4/classic/schemas.d.cts +53 -18
  409. package/node_modules/zod/v4/classic/schemas.d.ts +53 -18
  410. package/node_modules/zod/v4/classic/schemas.js +492 -396
  411. package/node_modules/zod/v4/core/api.cjs +23 -4
  412. package/node_modules/zod/v4/core/api.d.cts +13 -9
  413. package/node_modules/zod/v4/core/api.d.ts +13 -9
  414. package/node_modules/zod/v4/core/api.js +21 -4
  415. package/node_modules/zod/v4/core/checks.cjs +37 -31
  416. package/node_modules/zod/v4/core/checks.d.cts +13 -13
  417. package/node_modules/zod/v4/core/checks.d.ts +13 -13
  418. package/node_modules/zod/v4/core/checks.js +37 -31
  419. package/node_modules/zod/v4/core/compile.cjs +1813 -0
  420. package/node_modules/zod/v4/core/compile.d.cts +51 -0
  421. package/node_modules/zod/v4/core/compile.d.ts +51 -0
  422. package/node_modules/zod/v4/core/compile.js +1783 -0
  423. package/node_modules/zod/v4/core/core.cjs +81 -18
  424. package/node_modules/zod/v4/core/core.d.cts +16 -4
  425. package/node_modules/zod/v4/core/core.d.ts +16 -4
  426. package/node_modules/zod/v4/core/core.js +82 -19
  427. package/node_modules/zod/v4/core/doc.cjs +5 -7
  428. package/node_modules/zod/v4/core/doc.d.cts +3 -1
  429. package/node_modules/zod/v4/core/doc.d.ts +3 -1
  430. package/node_modules/zod/v4/core/doc.js +5 -7
  431. package/node_modules/zod/v4/core/errors.cjs +110 -25
  432. package/node_modules/zod/v4/core/errors.d.cts +4 -0
  433. package/node_modules/zod/v4/core/errors.d.ts +4 -0
  434. package/node_modules/zod/v4/core/errors.js +110 -25
  435. package/node_modules/zod/v4/core/index.cjs +5 -1
  436. package/node_modules/zod/v4/core/index.d.cts +3 -0
  437. package/node_modules/zod/v4/core/index.d.ts +3 -0
  438. package/node_modules/zod/v4/core/index.js +3 -0
  439. package/node_modules/zod/v4/core/json-schema-generator.cjs +4 -0
  440. package/node_modules/zod/v4/core/json-schema-generator.d.cts +2 -2
  441. package/node_modules/zod/v4/core/json-schema-generator.d.ts +2 -2
  442. package/node_modules/zod/v4/core/json-schema-generator.js +4 -0
  443. package/node_modules/zod/v4/core/json-schema-processors.cjs +264 -95
  444. package/node_modules/zod/v4/core/json-schema-processors.js +243 -97
  445. package/node_modules/zod/v4/core/json-schema.d.cts +2 -1
  446. package/node_modules/zod/v4/core/json-schema.d.ts +2 -1
  447. package/node_modules/zod/v4/core/memoizer.cjs +272 -0
  448. package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
  449. package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
  450. package/node_modules/zod/v4/core/memoizer.js +265 -0
  451. package/node_modules/zod/v4/core/parse.cjs +96 -34
  452. package/node_modules/zod/v4/core/parse.d.cts +14 -11
  453. package/node_modules/zod/v4/core/parse.d.ts +14 -11
  454. package/node_modules/zod/v4/core/parse.js +94 -33
  455. package/node_modules/zod/v4/core/regexes.cjs +27 -15
  456. package/node_modules/zod/v4/core/regexes.d.cts +2 -0
  457. package/node_modules/zod/v4/core/regexes.d.ts +2 -0
  458. package/node_modules/zod/v4/core/regexes.js +24 -13
  459. package/node_modules/zod/v4/core/registries.js +2 -2
  460. package/node_modules/zod/v4/core/schemas.cjs +537 -326
  461. package/node_modules/zod/v4/core/schemas.d.cts +100 -31
  462. package/node_modules/zod/v4/core/schemas.d.ts +100 -31
  463. package/node_modules/zod/v4/core/schemas.js +526 -325
  464. package/node_modules/zod/v4/core/to-json-schema.cjs +242 -39
  465. package/node_modules/zod/v4/core/to-json-schema.d.cts +42 -3
  466. package/node_modules/zod/v4/core/to-json-schema.d.ts +42 -3
  467. package/node_modules/zod/v4/core/to-json-schema.js +241 -39
  468. package/node_modules/zod/v4/core/util.cjs +212 -31
  469. package/node_modules/zod/v4/core/util.d.cts +58 -1
  470. package/node_modules/zod/v4/core/util.d.ts +58 -1
  471. package/node_modules/zod/v4/core/util.js +202 -30
  472. package/node_modules/zod/v4/core/versions.cjs +2 -2
  473. package/node_modules/zod/v4/core/versions.d.cts +1 -1
  474. package/node_modules/zod/v4/core/versions.d.ts +1 -1
  475. package/node_modules/zod/v4/core/versions.js +2 -2
  476. package/node_modules/zod/v4/core/visit.cjs +195 -0
  477. package/node_modules/zod/v4/core/visit.d.cts +30 -0
  478. package/node_modules/zod/v4/core/visit.d.ts +30 -0
  479. package/node_modules/zod/v4/core/visit.js +169 -0
  480. package/node_modules/zod/v4/index.cjs +15 -5
  481. package/node_modules/zod/v4/index.d.cts +2 -2
  482. package/node_modules/zod/v4/index.d.ts +2 -2
  483. package/node_modules/zod/v4/index.js +3 -2
  484. package/node_modules/zod/v4/locales/ar.cjs +3 -0
  485. package/node_modules/zod/v4/locales/ar.js +3 -0
  486. package/node_modules/zod/v4/locales/az.cjs +3 -0
  487. package/node_modules/zod/v4/locales/az.js +3 -0
  488. package/node_modules/zod/v4/locales/be.cjs +10 -0
  489. package/node_modules/zod/v4/locales/be.js +10 -0
  490. package/node_modules/zod/v4/locales/bg.cjs +3 -0
  491. package/node_modules/zod/v4/locales/bg.js +3 -0
  492. package/node_modules/zod/v4/locales/bn.cjs +138 -0
  493. package/node_modules/zod/v4/locales/bn.d.cts +5 -0
  494. package/node_modules/zod/v4/locales/bn.d.ts +4 -0
  495. package/node_modules/zod/v4/locales/bn.js +111 -0
  496. package/node_modules/zod/v4/locales/ca.cjs +3 -0
  497. package/node_modules/zod/v4/locales/ca.js +3 -0
  498. package/node_modules/zod/v4/locales/ckb.cjs +158 -0
  499. package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
  500. package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
  501. package/node_modules/zod/v4/locales/ckb.js +131 -0
  502. package/node_modules/zod/v4/locales/cs.cjs +3 -0
  503. package/node_modules/zod/v4/locales/cs.js +3 -0
  504. package/node_modules/zod/v4/locales/da.cjs +5 -2
  505. package/node_modules/zod/v4/locales/da.js +5 -2
  506. package/node_modules/zod/v4/locales/de.cjs +3 -0
  507. package/node_modules/zod/v4/locales/de.js +3 -0
  508. package/node_modules/zod/v4/locales/el.cjs +1 -0
  509. package/node_modules/zod/v4/locales/el.js +1 -0
  510. package/node_modules/zod/v4/locales/en.cjs +14 -4
  511. package/node_modules/zod/v4/locales/en.js +14 -4
  512. package/node_modules/zod/v4/locales/eo.cjs +3 -0
  513. package/node_modules/zod/v4/locales/eo.js +3 -0
  514. package/node_modules/zod/v4/locales/es.cjs +2 -0
  515. package/node_modules/zod/v4/locales/es.js +2 -0
  516. package/node_modules/zod/v4/locales/fa.cjs +3 -0
  517. package/node_modules/zod/v4/locales/fa.js +3 -0
  518. package/node_modules/zod/v4/locales/fi.cjs +3 -0
  519. package/node_modules/zod/v4/locales/fi.js +3 -0
  520. package/node_modules/zod/v4/locales/fr-CA.cjs +3 -0
  521. package/node_modules/zod/v4/locales/fr-CA.js +3 -0
  522. package/node_modules/zod/v4/locales/fr.cjs +16 -14
  523. package/node_modules/zod/v4/locales/fr.js +16 -14
  524. package/node_modules/zod/v4/locales/gu.cjs +138 -0
  525. package/node_modules/zod/v4/locales/gu.d.cts +5 -0
  526. package/node_modules/zod/v4/locales/gu.d.ts +4 -0
  527. package/node_modules/zod/v4/locales/gu.js +111 -0
  528. package/node_modules/zod/v4/locales/he.cjs +5 -0
  529. package/node_modules/zod/v4/locales/he.js +5 -0
  530. package/node_modules/zod/v4/locales/hi.cjs +136 -0
  531. package/node_modules/zod/v4/locales/hi.d.cts +5 -0
  532. package/node_modules/zod/v4/locales/hi.d.ts +4 -0
  533. package/node_modules/zod/v4/locales/hi.js +109 -0
  534. package/node_modules/zod/v4/locales/hr.cjs +2 -0
  535. package/node_modules/zod/v4/locales/hr.js +2 -0
  536. package/node_modules/zod/v4/locales/hu.cjs +3 -0
  537. package/node_modules/zod/v4/locales/hu.js +3 -0
  538. package/node_modules/zod/v4/locales/hy.cjs +9 -0
  539. package/node_modules/zod/v4/locales/hy.js +9 -0
  540. package/node_modules/zod/v4/locales/id.cjs +3 -0
  541. package/node_modules/zod/v4/locales/id.js +3 -0
  542. package/node_modules/zod/v4/locales/index.cjs +22 -2
  543. package/node_modules/zod/v4/locales/index.d.cts +10 -0
  544. package/node_modules/zod/v4/locales/index.d.ts +10 -0
  545. package/node_modules/zod/v4/locales/index.js +10 -0
  546. package/node_modules/zod/v4/locales/is.cjs +3 -0
  547. package/node_modules/zod/v4/locales/is.js +3 -0
  548. package/node_modules/zod/v4/locales/it.cjs +3 -0
  549. package/node_modules/zod/v4/locales/it.js +3 -0
  550. package/node_modules/zod/v4/locales/ja.cjs +3 -0
  551. package/node_modules/zod/v4/locales/ja.js +3 -0
  552. package/node_modules/zod/v4/locales/ka.cjs +3 -0
  553. package/node_modules/zod/v4/locales/ka.js +3 -0
  554. package/node_modules/zod/v4/locales/km.cjs +3 -0
  555. package/node_modules/zod/v4/locales/km.js +3 -0
  556. package/node_modules/zod/v4/locales/kn.cjs +141 -0
  557. package/node_modules/zod/v4/locales/kn.d.cts +5 -0
  558. package/node_modules/zod/v4/locales/kn.d.ts +4 -0
  559. package/node_modules/zod/v4/locales/kn.js +114 -0
  560. package/node_modules/zod/v4/locales/ko.cjs +3 -0
  561. package/node_modules/zod/v4/locales/ko.js +3 -0
  562. package/node_modules/zod/v4/locales/lt.cjs +2 -0
  563. package/node_modules/zod/v4/locales/lt.js +2 -0
  564. package/node_modules/zod/v4/locales/mk.cjs +3 -0
  565. package/node_modules/zod/v4/locales/mk.js +3 -0
  566. package/node_modules/zod/v4/locales/ms.cjs +3 -0
  567. package/node_modules/zod/v4/locales/ms.js +3 -0
  568. package/node_modules/zod/v4/locales/ne.cjs +136 -0
  569. package/node_modules/zod/v4/locales/ne.d.cts +5 -0
  570. package/node_modules/zod/v4/locales/ne.d.ts +4 -0
  571. package/node_modules/zod/v4/locales/ne.js +109 -0
  572. package/node_modules/zod/v4/locales/nl.cjs +3 -0
  573. package/node_modules/zod/v4/locales/nl.js +3 -0
  574. package/node_modules/zod/v4/locales/nn.cjs +138 -0
  575. package/node_modules/zod/v4/locales/nn.d.cts +5 -0
  576. package/node_modules/zod/v4/locales/nn.d.ts +4 -0
  577. package/node_modules/zod/v4/locales/nn.js +111 -0
  578. package/node_modules/zod/v4/locales/no.cjs +5 -2
  579. package/node_modules/zod/v4/locales/no.js +5 -2
  580. package/node_modules/zod/v4/locales/ota.cjs +3 -0
  581. package/node_modules/zod/v4/locales/ota.js +3 -0
  582. package/node_modules/zod/v4/locales/pl.cjs +3 -0
  583. package/node_modules/zod/v4/locales/pl.js +3 -0
  584. package/node_modules/zod/v4/locales/ps.cjs +3 -0
  585. package/node_modules/zod/v4/locales/ps.js +3 -0
  586. package/node_modules/zod/v4/locales/pt-BR.cjs +168 -0
  587. package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
  588. package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
  589. package/node_modules/zod/v4/locales/pt-BR.js +141 -0
  590. package/node_modules/zod/v4/locales/pt.cjs +87 -55
  591. package/node_modules/zod/v4/locales/pt.js +87 -55
  592. package/node_modules/zod/v4/locales/ro.cjs +1 -0
  593. package/node_modules/zod/v4/locales/ro.js +1 -0
  594. package/node_modules/zod/v4/locales/ru.cjs +10 -0
  595. package/node_modules/zod/v4/locales/ru.js +10 -0
  596. package/node_modules/zod/v4/locales/sk.cjs +141 -0
  597. package/node_modules/zod/v4/locales/sk.d.cts +5 -0
  598. package/node_modules/zod/v4/locales/sk.d.ts +4 -0
  599. package/node_modules/zod/v4/locales/sk.js +114 -0
  600. package/node_modules/zod/v4/locales/sl.cjs +3 -0
  601. package/node_modules/zod/v4/locales/sl.js +3 -0
  602. package/node_modules/zod/v4/locales/sv.cjs +5 -2
  603. package/node_modules/zod/v4/locales/sv.js +5 -2
  604. package/node_modules/zod/v4/locales/ta.cjs +3 -0
  605. package/node_modules/zod/v4/locales/ta.js +3 -0
  606. package/node_modules/zod/v4/locales/th.cjs +3 -0
  607. package/node_modules/zod/v4/locales/th.js +3 -0
  608. package/node_modules/zod/v4/locales/tk.cjs +132 -0
  609. package/node_modules/zod/v4/locales/tk.d.cts +5 -0
  610. package/node_modules/zod/v4/locales/tk.d.ts +4 -0
  611. package/node_modules/zod/v4/locales/tk.js +105 -0
  612. package/node_modules/zod/v4/locales/tr.cjs +3 -0
  613. package/node_modules/zod/v4/locales/tr.js +3 -0
  614. package/node_modules/zod/v4/locales/uk.cjs +3 -0
  615. package/node_modules/zod/v4/locales/uk.js +3 -0
  616. package/node_modules/zod/v4/locales/ur.cjs +3 -0
  617. package/node_modules/zod/v4/locales/ur.js +3 -0
  618. package/node_modules/zod/v4/locales/uz.cjs +1 -0
  619. package/node_modules/zod/v4/locales/uz.js +1 -0
  620. package/node_modules/zod/v4/locales/vi.cjs +3 -0
  621. package/node_modules/zod/v4/locales/vi.js +3 -0
  622. package/node_modules/zod/v4/locales/yo.cjs +3 -0
  623. package/node_modules/zod/v4/locales/yo.js +3 -0
  624. package/node_modules/zod/v4/locales/zh-CN.cjs +3 -0
  625. package/node_modules/zod/v4/locales/zh-CN.js +3 -0
  626. package/node_modules/zod/v4/locales/zh-TW.cjs +3 -0
  627. package/node_modules/zod/v4/locales/zh-TW.js +3 -0
  628. package/node_modules/zod/v4/mini/checks.cjs +2 -1
  629. package/node_modules/zod/v4/mini/checks.d.cts +1 -1
  630. package/node_modules/zod/v4/mini/checks.d.ts +1 -1
  631. package/node_modules/zod/v4/mini/checks.js +1 -1
  632. package/node_modules/zod/v4/mini/deep-partial.cjs +39 -0
  633. package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
  634. package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
  635. package/node_modules/zod/v4/mini/deep-partial.js +13 -0
  636. package/node_modules/zod/v4/mini/external.cjs +12 -1
  637. package/node_modules/zod/v4/mini/external.d.cts +5 -2
  638. package/node_modules/zod/v4/mini/external.d.ts +5 -2
  639. package/node_modules/zod/v4/mini/external.js +3 -1
  640. package/node_modules/zod/v4/mini/in-out.cjs +63 -0
  641. package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
  642. package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
  643. package/node_modules/zod/v4/mini/in-out.js +36 -0
  644. package/node_modules/zod/v4/mini/parse.cjs +3 -1
  645. package/node_modules/zod/v4/mini/parse.d.cts +1 -1
  646. package/node_modules/zod/v4/mini/parse.d.ts +1 -1
  647. package/node_modules/zod/v4/mini/parse.js +1 -1
  648. package/node_modules/zod/v4/mini/schemas.cjs +75 -47
  649. package/node_modules/zod/v4/mini/schemas.d.cts +43 -13
  650. package/node_modules/zod/v4/mini/schemas.d.ts +43 -13
  651. package/node_modules/zod/v4/mini/schemas.js +71 -45
  652. package/openclaw.plugin.json +15 -28
  653. package/package.json +12 -7
  654. package/node_modules/zod/src/v4/core/config.ts +0 -15
  655. package/dist/{accounts-CCirBEIm.js → .setup/accounts-Dv0uksBG.mjs} +2 -2
  656. /package/dist/{config-schema-CCbTcJEV.js → .setup/config-schema-CCbTcJEV.mjs} +0 -0
  657. /package/dist/{conversation-bindings-GDQ_Laxj.js → .setup/conversation-bindings-GDQ_Laxj.mjs} +0 -0
  658. /package/dist/{outbound-send-deps-B-QEsLSM.js → .setup/outbound-send-deps-B-QEsLSM.mjs} +0 -0
  659. /package/dist/{reaction-context-Br-vAJFp.js → .setup/reaction-context-Br-vAJFp.mjs} +0 -0
  660. /package/dist/{rolldown-runtime-D7D4PA-g.js → .setup/rolldown-runtime-D7D4PA-g.mjs} +0 -0
  661. /package/dist/{runtime-Cza4CY5T.js → .setup/runtime-Cza4CY5T.mjs} +0 -0
  662. /package/dist/{state-contract-DvahEY4X.js → .setup/state-contract-DvahEY4X.mjs} +0 -0
@@ -1,20 +1,21 @@
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-Dv0uksBG.mjs";
3
+ import { r as imessageRpcSupportsMethod } from "./message-tool-api-DZSH-2gY.mjs";
4
+ import { b as resolveIMessageDirectChatService, d as isKnownFromMeIMessageMessageId, f as rememberIMessageReplyCache, o as createIMessageRpcClient, r as sanitizeOutboundText } from "./sanitize-outbound-o1ePXajW.mjs";
5
+ import { d as probeIMessagePrivateApi, r as resolveIMessageInboundConversationId, u as probeIMessage } from "./group-policy-BoOAkmoQ.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-BpPh5Oh1.mjs";
9
+ import { i as registerIMessageApprovalReactionTarget, n as handleIMessageApprovalReaction, o as listPendingIMessageApprovalReactionPollTargets, r as maybeResolveIMessageApprovalReaction, s as buildIMessageApprovalConversationKeyForInbound } from "./approval-reactions-CX1-6KeG.mjs";
10
+ import { c as iMessageApprovalControlBindings, n as hasPersistedIMessageEcho, r as stripLeadingEchoTextCorruptionMarkers, s as maybeResolveIMessageApprovalPollVote, t as sendMessageIMessage } from "./send-DXiUWygv.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
20
  import { createNonExitingRuntime, danger, logVerbose, shouldLogVerbose, warn } from "openclaw/plugin-sdk/runtime-env";
20
21
  import { isInboundPathAllowed, kindFromMime } from "openclaw/plugin-sdk/media-runtime";
@@ -37,7 +38,7 @@ import { channelReadyPatch } from "openclaw/plugin-sdk/gateway-runtime";
37
38
  import { redactIdentifier } from "openclaw/plugin-sdk/logging-core";
38
39
  import { DEFAULT_GROUP_HISTORY_LIMIT, createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
39
40
  import { resolveDefaultGroupPolicy, resolveOpenProviderRuntimeGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
40
- import { openLocalFileSafely, resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime";
41
+ import { FsSafeError, openLocalFileSafely, resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime";
41
42
  import { getSessionEntry, readSessionUpdatedAt, resolveSendPolicy, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
42
43
  import { openNodeSqliteDatabase } from "openclaw/plugin-sdk/sqlite-runtime";
43
44
  import { waitForTransportReady } from "openclaw/plugin-sdk/transport-ready-runtime";
@@ -46,16 +47,18 @@ import { resolveMarkdownTableMode as resolveMarkdownTableMode$1 } from "openclaw
46
47
  import { resolvePreferredOpenClawTmpDir, withTempWorkspace } from "openclaw/plugin-sdk/temp-path";
47
48
  import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
48
49
  import { deliverTextOrMediaReply, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
50
+ import { chunkMarkdownTextWithMode as chunkTextWithMode, resolveChunkMode } from "openclaw/plugin-sdk/reply-chunking";
49
51
  import { createDedupeCache } from "openclaw/plugin-sdk/dedupe-runtime";
50
52
  import { hasControlCommand } from "openclaw/plugin-sdk/command-auth-native";
51
53
  import { resolveChannelContextVisibilityMode } from "openclaw/plugin-sdk/context-visibility-runtime";
52
54
  import { isRecord as isRecord$1 } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
55
+ import { readFileHandleBounded } from "openclaw/plugin-sdk/file-access-runtime";
53
56
  import { saveMediaBuffer } from "openclaw/plugin-sdk/media-store";
54
57
  import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
55
58
  import { enqueueSystemEvent } from "openclaw/plugin-sdk/system-event-runtime";
56
59
  //#region extensions/imessage/src/approval-reaction-poller.ts
57
60
  const RECENT_CHAT_LIMIT = 50;
58
- const PER_CHAT_HISTORY_LIMIT = 30;
61
+ const PER_CHAT_HISTORY_LIMIT$1 = 30;
59
62
  function normalizeChatId(value) {
60
63
  return asPositiveFiniteNumber(value) ?? null;
61
64
  }
@@ -89,7 +92,7 @@ async function listRecentChatIds(client) {
89
92
  async function fetchRecentHistory(params) {
90
93
  return ((await params.client.request("messages.history", {
91
94
  chat_id: params.chatId,
92
- limit: PER_CHAT_HISTORY_LIMIT
95
+ limit: PER_CHAT_HISTORY_LIMIT$1
93
96
  }, { timeoutMs: 1e4 })).messages ?? []).filter((message) => Boolean(message && typeof message === "object"));
94
97
  }
95
98
  function buildReactionPayload(params) {
@@ -129,14 +132,14 @@ function buildConversationKeyFromMessage(message) {
129
132
  ...normalizeChatId(message.chat_id) !== null ? { chatId: message.chat_id } : {}
130
133
  };
131
134
  }
132
- function bindObservedConversation(params) {
135
+ async function bindObservedConversation(params) {
133
136
  const nowMs = asDateTimestampMs(Date.now());
134
137
  const expiresAtMs = asDateTimestampMs(params.target.expiresAtMs);
135
138
  if (nowMs === void 0 || expiresAtMs === void 0 || expiresAtMs <= nowMs) return;
136
139
  const ttlMs = expiresAtMs - nowMs;
137
140
  const conversation = buildConversationKeyFromMessage(params.message);
138
141
  const messageIds = /* @__PURE__ */ new Set([...enumerateMessageGuidCandidates(params.target.messageId), ...enumerateMessageGuidCandidates(params.message.guid ?? "")]);
139
- for (const messageId of messageIds) registerIMessageApprovalReactionTarget({
142
+ await Promise.all([...messageIds].map((messageId) => registerIMessageApprovalReactionTarget({
140
143
  accountId: params.target.accountId,
141
144
  conversation,
142
145
  messageId,
@@ -144,7 +147,7 @@ function bindObservedConversation(params) {
144
147
  approvalKind: params.target.approvalKind,
145
148
  allowedDecisions: params.target.allowedDecisions,
146
149
  ttlMs
147
- });
150
+ })));
148
151
  }
149
152
  async function pollPendingIMessageApprovalReactions(params) {
150
153
  const targets = await listPendingIMessageApprovalReactionPollTargets({ accountId: params.accountId });
@@ -169,7 +172,7 @@ async function pollPendingIMessageApprovalReactions(params) {
169
172
  if (!targetGuid) continue;
170
173
  const target = pendingByMessageId.get(targetGuid) ?? pendingByMessageId.get(normalizeIMessageGuid(targetGuid));
171
174
  if (!target) continue;
172
- bindObservedConversation({
175
+ await bindObservedConversation({
173
176
  target,
174
177
  message
175
178
  });
@@ -270,16 +273,11 @@ const DEFAULT_MAX_FAILURE_RETRIES = 10;
270
273
  const MAX_MAX_FAILURE_RETRIES = 1e3;
271
274
  const cursorWriteQueue = new KeyedAsyncQueue();
272
275
  function openCatchupCursorStore() {
273
- return getIMessageRuntime().state.openSyncKeyedStore({
276
+ return getIMessageRuntime().state.openKeyedStore({
274
277
  namespace: IMESSAGE_CATCHUP_CURSOR_NAMESPACE,
275
278
  maxEntries: 256
276
279
  });
277
280
  }
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
281
  function enqueueCursorWrite(accountId, fn) {
284
282
  const key = resolveIMessageCatchupCursorKey(accountId);
285
283
  return cursorWriteQueue.enqueue(key, fn);
@@ -308,39 +306,58 @@ function normalizeIMessageCatchupCursor(value) {
308
306
  ...hasRetries ? { failureRetries } : {}
309
307
  };
310
308
  }
311
- function readIMessageCatchupCursor(accountId) {
312
- return normalizeIMessageCatchupCursor(openCatchupCursorStore().lookup(resolveIMessageCatchupCursorKey(accountId)));
313
- }
314
309
  async function loadIMessageCatchupCursor(accountId) {
315
- return readIMessageCatchupCursor(accountId);
310
+ return normalizeIMessageCatchupCursor(await openCatchupCursorStore().lookup(resolveIMessageCatchupCursorKey(accountId)));
316
311
  }
317
- function buildIMessageCatchupCursor(next) {
312
+ function buildIMessageCatchupCursor(next, updatedAt) {
318
313
  const sanitized = sanitizeFailureRetriesInput(next.failureRetries);
319
314
  const hasRetries = Object.keys(sanitized).length > 0;
320
315
  return {
321
316
  lastSeenMs: next.lastSeenMs,
322
317
  lastSeenRowid: next.lastSeenRowid,
323
- updatedAt: Date.now(),
318
+ updatedAt,
324
319
  ...hasRetries ? { failureRetries: sanitized } : {}
325
320
  };
326
321
  }
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({
322
+ function decideCatchupCursorSave(existingValue, cursor, allowCursorRewindForRetries) {
323
+ const existing = normalizeIMessageCatchupCursor(existingValue);
324
+ if (existing && cursor.lastSeenRowid < existing.lastSeenRowid) {
325
+ if (!allowCursorRewindForRetries) return {
326
+ operation: "update",
327
+ action: "keep"
328
+ };
329
+ return {
330
+ operation: "update",
331
+ action: "set",
332
+ value: buildIMessageCatchupCursor({
334
333
  lastSeenMs: cursor.lastSeenMs,
335
334
  lastSeenRowid: cursor.lastSeenRowid,
336
335
  failureRetries: {
337
336
  ...existing.failureRetries,
338
337
  ...cursor.failureRetries
339
338
  }
340
- });
341
- }
342
- return cursor;
343
- });
339
+ }, cursor.updatedAt)
340
+ };
341
+ }
342
+ return {
343
+ operation: "update",
344
+ action: "set",
345
+ value: cursor
346
+ };
347
+ }
348
+ async function saveIMessageCatchupCursor(accountId, next, options = {}) {
349
+ const cursor = buildIMessageCatchupCursor(next, Date.now());
350
+ const allowCursorRewindForRetries = options.allowCursorRewindForRetries === true;
351
+ const store = openCatchupCursorStore();
352
+ if (!store.observe || !store.compareAndApply) throw new Error("iMessage catchup cursor persistence requires plugin-state comparison support.");
353
+ const key = resolveIMessageCatchupCursorKey(accountId);
354
+ let observation = await store.observe(key);
355
+ for (;;) {
356
+ const intent = decideCatchupCursorSave(observation.value, cursor, allowCursorRewindForRetries);
357
+ const result = await store.compareAndApply(key, observation.comparison, intent);
358
+ if (result.status !== "conflict") return;
359
+ observation = result.current;
360
+ }
344
361
  }
345
362
  function clampInt(value, min, max, fallback) {
346
363
  return resolveIntegerOption(value, fallback, {
@@ -357,22 +374,41 @@ function resolveCatchupConfig(raw) {
357
374
  maxFailureRetries: clampInt(raw?.maxFailureRetries, 1, MAX_MAX_FAILURE_RETRIES, DEFAULT_MAX_FAILURE_RETRIES)
358
375
  };
359
376
  }
377
+ function decideLiveCatchupCursorAdvance(existingValue, next, maxFailureRetries) {
378
+ const cursor = normalizeIMessageCatchupCursor(existingValue);
379
+ if (cursor && next.lastSeenRowid <= cursor.lastSeenRowid) return {
380
+ operation: "update",
381
+ action: "keep"
382
+ };
383
+ if (Object.values(cursor?.failureRetries ?? {}).some((count) => count < maxFailureRetries)) return {
384
+ operation: "update",
385
+ action: "keep"
386
+ };
387
+ return {
388
+ operation: "update",
389
+ action: "set",
390
+ value: buildIMessageCatchupCursor({
391
+ lastSeenMs: Math.max(cursor?.lastSeenMs ?? next.lastSeenMs, next.lastSeenMs),
392
+ lastSeenRowid: next.lastSeenRowid,
393
+ failureRetries: cursor?.failureRetries
394
+ }, next.updatedAt)
395
+ };
396
+ }
360
397
  async function advanceIMessageCatchupCursor(accountId, next, config) {
361
398
  if (!Number.isFinite(next.lastSeenMs) || !Number.isFinite(next.lastSeenRowid)) return false;
362
399
  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;
400
+ const cursor = buildIMessageCatchupCursor(next, Date.now());
401
+ const maxFailureRetries = config.maxFailureRetries;
402
+ const store = openCatchupCursorStore();
403
+ if (!store.observe || !store.compareAndApply) throw new Error("iMessage catchup cursor persistence requires plugin-state comparison support.");
404
+ const key = resolveIMessageCatchupCursorKey(accountId);
405
+ let observation = await store.observe(key);
406
+ for (;;) {
407
+ const intent = decideLiveCatchupCursorAdvance(observation.value, cursor, maxFailureRetries);
408
+ const result = await store.compareAndApply(key, observation.comparison, intent);
409
+ if (result.status !== "conflict") return result.status === "applied";
410
+ observation = result.current;
411
+ }
376
412
  });
377
413
  }
378
414
  /**
@@ -585,7 +621,7 @@ function parseIMessageNotification(raw) {
585
621
  const maybeMessage = raw.message;
586
622
  if (!isRecord(maybeMessage)) return null;
587
623
  const message = maybeMessage;
588
- if (!isOptionalNumber(message.id) || !isOptionalString(message.guid) || !isOptionalNumber(message.chat_id) || !isOptionalString(message.sender) || !isOptionalString(message.destination_caller_id) || !isOptionalBoolean(message.is_from_me) || !isOptionalString(message.text) || !isOptionalString(message.thread_originator_guid) || !isOptionalString(message.reply_to_guid) || !isOptionalString(message.reply_to_text) || !isOptionalString(message.reply_to_sender) || !isOptionalString(message.created_at) || !isOptionalBoolean(message.is_reaction) || !isOptionalBoolean(message.is_tapback) || !isOptionalString(message.associated_message_guid) || !isOptionalNumber(message.associated_message_type) || !isOptionalString(message.reaction_type) || !isOptionalString(message.reaction_emoji) || !isOptionalBoolean(message.is_reaction_add) || !isOptionalString(message.reacted_to_guid) || !isOptionalAttachments(message.attachments) || !isOptionalString(message.chat_identifier) || !isOptionalString(message.chat_guid) || !isOptionalString(message.chat_name) || !isOptionalStringArray(message.participants) || !isOptionalBoolean(message.is_group)) return null;
624
+ if (!isOptionalNumber(message.id) || !isOptionalString(message.guid) || !isOptionalNumber(message.chat_id) || !isOptionalString(message.sender) || !isOptionalString(message.sender_name) || !isOptionalString(message.destination_caller_id) || !isOptionalBoolean(message.is_from_me) || !isOptionalString(message.text) || !isOptionalString(message.thread_originator_guid) || !isOptionalString(message.reply_to_guid) || !isOptionalString(message.reply_to_text) || !isOptionalString(message.reply_to_sender) || !isOptionalString(message.created_at) || !isOptionalBoolean(message.is_reaction) || !isOptionalBoolean(message.is_tapback) || !isOptionalString(message.associated_message_guid) || !isOptionalNumber(message.associated_message_type) || !isOptionalString(message.reaction_type) || !isOptionalString(message.reaction_emoji) || !isOptionalBoolean(message.is_reaction_add) || !isOptionalString(message.reacted_to_guid) || !isOptionalAttachments(message.attachments) || !isOptionalString(message.chat_identifier) || !isOptionalString(message.chat_guid) || !isOptionalString(message.chat_name) || !isOptionalStringArray(message.participants) || !isOptionalBoolean(message.is_group)) return null;
589
625
  return {
590
626
  ...message,
591
627
  text: typeof message.text === "string" ? stripImessageLengthPrefixedUtf8Text(message.text) : message.text,
@@ -594,7 +630,7 @@ function parseIMessageNotification(raw) {
594
630
  }
595
631
  //#endregion
596
632
  //#region extensions/imessage/src/monitor/catchup-bridge.ts
597
- const PER_CHAT_HISTORY_LIMIT_CAP = 500;
633
+ const PER_CHAT_HISTORY_LIMIT = 500;
598
634
  const CATCHUP_CHATS_LIST_LIMIT = 200;
599
635
  const CATCHUP_RPC_TIMEOUT_MS = 3e4;
600
636
  /**
@@ -638,7 +674,6 @@ async function runIMessageCatchup(params) {
638
674
  }
639
675
  const chats = chatsResult?.chats ?? [];
640
676
  const collected = [];
641
- const perChatLimit = Math.min(limit, PER_CHAT_HISTORY_LIMIT_CAP);
642
677
  let historyFetchFailed = false;
643
678
  let rawWatermarkRowid = -Infinity;
644
679
  let rawWatermarkMs = -Infinity;
@@ -651,7 +686,7 @@ async function runIMessageCatchup(params) {
651
686
  try {
652
687
  historyResult = await client.request("messages.history", {
653
688
  chat_id: chatId,
654
- limit: perChatLimit,
689
+ limit: PER_CHAT_HISTORY_LIMIT,
655
690
  start: sinceISO,
656
691
  attachments: includeAttachments
657
692
  }, { timeoutMs: CATCHUP_RPC_TIMEOUT_MS });
@@ -758,7 +793,6 @@ async function runIMessageCatchup(params) {
758
793
  */
759
794
  const MAX_COALESCED_TEXT_CHARS = 4e3;
760
795
  const MAX_COALESCED_ATTACHMENTS = 20;
761
- const MAX_COALESCED_ENTRIES = 10;
762
796
  /**
763
797
  * Combine consecutive same-sender iMessage payloads into a single payload for
764
798
  * downstream dispatch. Used for the general inbound debounce
@@ -773,44 +807,56 @@ function combineIMessagePayloads(payloads) {
773
807
  if (payloads.length === 0) throw new Error("combineIMessagePayloads: cannot combine empty payloads");
774
808
  const first = expectDefined(payloads[0], "first iMessage payload to coalesce");
775
809
  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
810
  const seenTexts = /* @__PURE__ */ new Set();
779
811
  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;
812
+ const allAttachments = [];
813
+ const seenGuids = /* @__PURE__ */ new Set();
814
+ const coalescedMessageGuids = [];
815
+ let textLength = 0;
816
+ let latestCreatedAt;
793
817
  let maxRowid = -Infinity;
794
818
  let maxDateMs = -Infinity;
819
+ let reply;
820
+ let payloadIndex = 0;
795
821
  for (const payload of payloads) {
822
+ const keepContent = payloadIndex < 9 || payloadIndex === payloads.length - 1;
823
+ payloadIndex += 1;
824
+ const createdAt = payload.created_at;
825
+ if (typeof createdAt === "string" && createdAt.length > 0 && (latestCreatedAt === void 0 || createdAt > latestCreatedAt)) latestCreatedAt = createdAt;
796
826
  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;
827
+ const dateMs = typeof createdAt === "string" ? Date.parse(createdAt) : NaN;
798
828
  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
829
  const guid = payload.guid?.trim();
804
- if (!guid || seenGuids.has(guid)) continue;
805
- seenGuids.add(guid);
806
- coalescedMessageGuids.push(guid);
830
+ if (guid && !seenGuids.has(guid)) {
831
+ seenGuids.add(guid);
832
+ coalescedMessageGuids.push(guid);
833
+ }
834
+ if (!reply && (payload.thread_originator_guid != null || payload.reply_to_guid != null)) reply = payload;
835
+ if (!keepContent) continue;
836
+ const text = textLength <= MAX_COALESCED_TEXT_CHARS ? (payload.text ?? "").trim() : "";
837
+ if (text) {
838
+ const normalized = seenTexts.size > 0 ? text.toLowerCase() : void 0;
839
+ if (normalized === void 0 || !seenTexts.has(normalized)) {
840
+ const separatorLength = textParts.length > 0 ? 1 : 0;
841
+ const part = text.slice(0, 4001 - textLength - separatorLength);
842
+ textParts.push(part);
843
+ textLength += separatorLength + part.length;
844
+ if (textLength <= MAX_COALESCED_TEXT_CHARS) seenTexts.add(normalized ?? text.toLowerCase());
845
+ }
846
+ }
847
+ if (allAttachments.length < MAX_COALESCED_ATTACHMENTS) for (const attachment of payload.attachments ?? []) {
848
+ allAttachments.push(attachment);
849
+ if (allAttachments.length === MAX_COALESCED_ATTACHMENTS) break;
850
+ }
807
851
  }
808
- const reply = payloads.find((payload) => payload.thread_originator_guid != null || payload.reply_to_guid != null) ?? first;
852
+ let combinedText = textParts.join(" ");
853
+ if (textLength > MAX_COALESCED_TEXT_CHARS) combinedText = `${sliceUtf16Safe(combinedText, 0, MAX_COALESCED_TEXT_CHARS)}…[truncated]`;
854
+ reply ??= first;
809
855
  return {
810
856
  ...first,
811
857
  text: combinedText,
812
858
  attachments: allAttachments.length > 0 ? allAttachments : null,
813
- created_at: latestCreatedAt,
859
+ created_at: latestCreatedAt ?? first.created_at,
814
860
  thread_originator_guid: reply.thread_originator_guid ?? null,
815
861
  reply_to_guid: reply.reply_to_guid ?? null,
816
862
  reply_to_text: reply.reply_to_text ?? null,
@@ -1140,10 +1186,10 @@ var DefaultSentMessageCache = class {
1140
1186
  }
1141
1187
  this.cleanup();
1142
1188
  }
1143
- has(scope, lookup, options = false) {
1189
+ async has(scope, lookup, options = false) {
1144
1190
  this.cleanup();
1145
1191
  const resolvedOptions = typeof options === "boolean" ? { skipIdShortCircuit: options } : options;
1146
- if (hasPersistedIMessageEcho({
1192
+ if (await hasPersistedIMessageEcho({
1147
1193
  scope,
1148
1194
  text: lookup.text,
1149
1195
  media: lookup.media,
@@ -1467,14 +1513,14 @@ function rememberIMessageSkippedFromMeForSelfChatDedupe(params) {
1467
1513
  });
1468
1514
  else if (isAmbiguousSelfThread) params.selfChatCache?.remember(lookup);
1469
1515
  }
1470
- function hasIMessageEchoMatch(params) {
1516
+ async function hasIMessageEchoMatch(params) {
1471
1517
  const scopes = typeof params.scope === "string" ? [params.scope] : params.scope;
1472
1518
  for (const scope of scopes) {
1473
1519
  if (!scope) continue;
1474
- for (const messageId of params.messageIds) if (params.echoCache.has(scope, { messageId })) return true;
1520
+ for (const messageId of params.messageIds) if (await params.echoCache.has(scope, { messageId })) return true;
1475
1521
  const fallbackMessageId = params.messageIds[0];
1476
1522
  if (!params.text && !params.media && !fallbackMessageId) continue;
1477
- if (params.echoCache.has(scope, {
1523
+ if (await params.echoCache.has(scope, {
1478
1524
  text: params.text,
1479
1525
  media: params.media,
1480
1526
  messageId: fallbackMessageId
@@ -1485,16 +1531,17 @@ function hasIMessageEchoMatch(params) {
1485
1531
  }
1486
1532
  return false;
1487
1533
  }
1488
- function isKnownFromMeIMessageReactionTarget(params) {
1489
- const { messageId, accountId, chatId, chatGuid, chatIdentifier } = params;
1534
+ async function isKnownFromMeIMessageReactionTarget(params) {
1535
+ const { accountId, chatId, chatGuid, chatIdentifier } = params;
1490
1536
  const ctx = {
1491
1537
  accountId,
1492
1538
  chatId,
1493
1539
  chatGuid,
1494
1540
  chatIdentifier
1495
1541
  };
1496
- if (params.isKnownFromMeMessageId) return params.isKnownFromMeMessageId(messageId, ctx);
1497
- return isKnownFromMeIMessageMessageId(messageId, ctx);
1542
+ const isKnownFromMe = params.isKnownFromMeMessageId ?? isKnownFromMeIMessageMessageId;
1543
+ for (const messageId of params.messageIds) if (await isKnownFromMe(messageId, ctx)) return true;
1544
+ return false;
1498
1545
  }
1499
1546
  /**
1500
1547
  * Per-group `systemPrompt` resolution. Mirrors `resolveWhatsAppGroupSystemPrompt`
@@ -1581,7 +1628,7 @@ async function resolveIMessageInboundDecision(params) {
1581
1628
  chatIdentifier,
1582
1629
  sender
1583
1630
  });
1584
- if (params.echoCache && (bodyText || inboundMessageId || mediaFacts.length > 0) && hasIMessageEchoMatch({
1631
+ if (params.echoCache && (bodyText || inboundMessageId || mediaFacts.length > 0) && await hasIMessageEchoMatch({
1585
1632
  echoCache: params.echoCache,
1586
1633
  scope: echoScope,
1587
1634
  text: bodyText || void 0,
@@ -1709,7 +1756,7 @@ async function resolveIMessageInboundDecision(params) {
1709
1756
  };
1710
1757
  const targetGuid = reactionContext.targetGuid;
1711
1758
  const targetGuids = reactionContext.targetGuids ?? (targetGuid ? [targetGuid] : []);
1712
- const targetIsOwn = Boolean(targetGuid && (params.echoCache && hasIMessageEchoMatch({
1759
+ const targetIsOwn = Boolean(targetGuid && (params.echoCache && await hasIMessageEchoMatch({
1713
1760
  echoCache: params.echoCache,
1714
1761
  scope: buildIMessageEchoScope({
1715
1762
  accountId: params.accountId,
@@ -1720,14 +1767,14 @@ async function resolveIMessageInboundDecision(params) {
1720
1767
  sender
1721
1768
  }),
1722
1769
  messageIds: targetGuids
1723
- }) || targetGuids.some((messageId) => isKnownFromMeIMessageReactionTarget({
1724
- messageId,
1770
+ }) || await isKnownFromMeIMessageReactionTarget({
1771
+ messageIds: targetGuids,
1725
1772
  accountId: params.accountId,
1726
1773
  chatId,
1727
1774
  chatGuid,
1728
1775
  chatIdentifier,
1729
1776
  isKnownFromMeMessageId: params.isKnownFromMeMessageId
1730
- }))));
1777
+ })));
1731
1778
  if (notificationMode === "own" && !targetIsOwn) return {
1732
1779
  kind: "drop",
1733
1780
  reason: "reaction target not sent by agent"
@@ -1780,7 +1827,7 @@ async function resolveIMessageInboundDecision(params) {
1780
1827
  chatIdentifier,
1781
1828
  sender
1782
1829
  });
1783
- if (hasIMessageEchoMatch({
1830
+ if (await hasIMessageEchoMatch({
1784
1831
  echoCache: params.echoCache,
1785
1832
  scope: echoScope,
1786
1833
  text: bodyText || void 0,
@@ -1924,7 +1971,7 @@ async function buildIMessageInboundContext(params) {
1924
1971
  const chatId = decision.chatId;
1925
1972
  const chatTarget = decision.isGroup && chatId != null ? formatIMessageChatTarget(chatId) : void 0;
1926
1973
  const messageGuid = normalizeReplyField(params.message.guid);
1927
- const messageSid = (messageGuid ? rememberIMessageReplyCache({
1974
+ const messageSid = (messageGuid ? await rememberIMessageReplyCache({
1928
1975
  accountId: decision.route.accountId,
1929
1976
  messageId: messageGuid,
1930
1977
  chatGuid: decision.chatGuid,
@@ -1934,12 +1981,15 @@ async function buildIMessageInboundContext(params) {
1934
1981
  isFromMe: false
1935
1982
  }) : null)?.shortId || void 0;
1936
1983
  const replySuffix = decision.replyContext ? `\n\n[Replying to ${decision.replyContext.sender ?? "unknown sender"}${decision.replyContext.id ? ` id:${decision.replyContext.id}` : ""}]\n${decision.replyContext.body}\n[/Replying]` : "";
1984
+ const senderDisplayName = normalizeNonEmpty(params.message.sender_name ?? "");
1985
+ const directConversationName = senderDisplayName ?? normalizeNonEmpty(params.message.chat_name ?? "") ?? decision.senderNormalized;
1986
+ const conversationName = decision.isGroup ? normalizeNonEmpty(params.message.chat_name ?? "") ?? void 0 : directConversationName;
1937
1987
  const fromLabel = formatInboundFromLabel({
1938
1988
  isGroup: decision.isGroup,
1939
1989
  groupLabel: params.message.chat_name ?? void 0,
1940
1990
  groupId: chatId !== void 0 ? String(chatId) : "unknown",
1941
1991
  groupFallback: "Group",
1942
- directLabel: decision.senderNormalized,
1992
+ directLabel: directConversationName,
1943
1993
  directId: decision.sender
1944
1994
  });
1945
1995
  let combinedBody = formatInboundEnvelope({
@@ -1949,7 +1999,7 @@ async function buildIMessageInboundContext(params) {
1949
1999
  body: `${decision.agentBodyText ?? decision.bodyText}${replySuffix}`,
1950
2000
  chatType: decision.isGroup ? "group" : "direct",
1951
2001
  sender: {
1952
- name: decision.senderNormalized,
2002
+ name: senderDisplayName ?? decision.senderNormalized,
1953
2003
  id: decision.sender
1954
2004
  },
1955
2005
  previousTimestamp: params.previousTimestamp,
@@ -2001,7 +2051,7 @@ async function buildIMessageInboundContext(params) {
2001
2051
  from: imessageFrom,
2002
2052
  sender: {
2003
2053
  id: decision.sender,
2004
- name: decision.senderNormalized,
2054
+ name: senderDisplayName ?? decision.senderNormalized,
2005
2055
  isSelf: params.message.is_from_me === true
2006
2056
  },
2007
2057
  conversation: {
@@ -2011,7 +2061,7 @@ async function buildIMessageInboundContext(params) {
2011
2061
  kind: decision.isGroup ? "group" : "direct",
2012
2062
  id: decision.isGroup ? String(chatId) : decision.senderNormalized
2013
2063
  } },
2014
- label: fromLabel
2064
+ label: conversationName
2015
2065
  },
2016
2066
  route: {
2017
2067
  agentId: decision.route.agentId,
@@ -2299,19 +2349,6 @@ async function assertAllowedCanonicalAttachmentPath(params) {
2299
2349
  roots: canonicalRoots
2300
2350
  })) throw new Error("attachment path resolves outside allowed roots");
2301
2351
  }
2302
- async function readPinnedAttachmentBytes(handle, maxBytes) {
2303
- const chunks = [];
2304
- let totalBytes = 0;
2305
- while (totalBytes <= maxBytes) {
2306
- const remaining = maxBytes + 1 - totalBytes;
2307
- const chunk = Buffer.allocUnsafe(Math.min(65536, remaining));
2308
- const { bytesRead } = await handle.read(chunk, 0, chunk.length, null);
2309
- if (bytesRead === 0) return Buffer.concat(chunks, totalBytes);
2310
- chunks.push(chunk.subarray(0, bytesRead));
2311
- totalBytes += bytesRead;
2312
- }
2313
- throw new Error(`attachment exceeds ${Math.round(maxBytes / 1048576)}MB limit`);
2314
- }
2315
2352
  async function readAttachmentBuffer(params) {
2316
2353
  const opened = await (params.deps.openLocalFileSafely ?? openLocalFileSafely)({ filePath: params.attachmentPath });
2317
2354
  try {
@@ -2320,7 +2357,10 @@ async function readAttachmentBuffer(params) {
2320
2357
  canonicalPath: opened.realPath,
2321
2358
  allowedRoots: params.allowedRoots
2322
2359
  });
2323
- const buffer = await readPinnedAttachmentBytes(opened.handle, params.maxBytes);
2360
+ const buffer = await readFileHandleBounded(opened.handle, params.maxBytes).catch((error) => {
2361
+ if (error instanceof FsSafeError && error.code === "too-large") throw new Error(`attachment exceeds ${Math.round(params.maxBytes / 1048576)}MB limit`);
2362
+ throw error;
2363
+ });
2324
2364
  if (isHeicAttachment(params.attachmentPath, params.mimeType)) try {
2325
2365
  const convert = params.deps.convertHeicToJpeg;
2326
2366
  return {
@@ -2478,15 +2518,14 @@ function enqueueIMessageReactionSystemEvent(params) {
2478
2518
  }
2479
2519
  //#endregion
2480
2520
  //#region extensions/imessage/src/monitor/recovery-cursor.ts
2481
- const IMESSAGE_RECOVERY_CURSOR_NAMESPACE = "imessage.recovery-cursor";
2482
- const IMESSAGE_RECOVERY_CURSOR_MAX_ENTRIES = 64;
2521
+ const RECOVERY_CURSOR_STORE_OPTIONS = {
2522
+ namespace: "imessage.recovery-cursor",
2523
+ maxEntries: 64
2524
+ };
2483
2525
  const LEGACY_CATCHUP_CURSOR_NAMESPACE = "imessage.catchup-cursors";
2484
2526
  const LEGACY_CATCHUP_CURSOR_MAX_ENTRIES = 256;
2485
2527
  function openRecoveryCursorStore() {
2486
- return getIMessageRuntime().state.openSyncKeyedStore({
2487
- namespace: IMESSAGE_RECOVERY_CURSOR_NAMESPACE,
2488
- maxEntries: IMESSAGE_RECOVERY_CURSOR_MAX_ENTRIES
2489
- });
2528
+ return getIMessageRuntime().state.openKeyedStore(RECOVERY_CURSOR_STORE_OPTIONS);
2490
2529
  }
2491
2530
  function normalizeLocalDbPath(dbPath) {
2492
2531
  let resolved = dbPath.trim();
@@ -2518,67 +2557,105 @@ function resolveIMessageRecoveryCursorDbIdentity(params) {
2518
2557
  function recoveryCursorStoreKey(accountId, dbIdentity) {
2519
2558
  return `${accountId}\u0000${dbIdentity}`;
2520
2559
  }
2521
- function readRecoveryCursor(accountId, dbIdentity) {
2560
+ function decideRecoveryCursorUpdate(current, update) {
2561
+ if (update.kind === "rewind") {
2562
+ if (current?.lastRowid !== update.expectedRowid) return;
2563
+ } else if (current && current.lastRowid >= update.rowid) return;
2564
+ return { lastRowid: update.rowid };
2565
+ }
2566
+ async function applyRecoveryCursorUpdate(key, update) {
2567
+ const state = getIMessageRuntime().state;
2568
+ const store = state.openKeyedStore(RECOVERY_CURSOR_STORE_OPTIONS);
2569
+ if (!store.observe || !store.compareAndApply) {
2570
+ const legacy = state.openSyncKeyedStore(RECOVERY_CURSOR_STORE_OPTIONS);
2571
+ if (!legacy.update) throw new Error("iMessage recovery cursor persistence requires atomic update support.");
2572
+ let result;
2573
+ legacy.update(key, (current) => {
2574
+ const next = decideRecoveryCursorUpdate(current, update);
2575
+ result = next ?? current;
2576
+ return next;
2577
+ });
2578
+ return result;
2579
+ }
2580
+ const observe = store.observe.bind(store);
2581
+ const compareAndApply = store.compareAndApply.bind(store);
2582
+ let observation = await observe(key);
2583
+ for (;;) {
2584
+ const next = decideRecoveryCursorUpdate(observation.value, update);
2585
+ if (!next) return observation.value;
2586
+ const result = await compareAndApply(key, observation.comparison, {
2587
+ operation: "update",
2588
+ action: "set",
2589
+ value: next
2590
+ });
2591
+ if (result.status !== "conflict") return next;
2592
+ observation = result.current;
2593
+ }
2594
+ }
2595
+ async function readRecoveryCursor(accountId, dbIdentity) {
2522
2596
  try {
2523
2597
  const store = openRecoveryCursorStore();
2524
2598
  const key = recoveryCursorStoreKey(accountId, dbIdentity);
2525
- const value = store.lookup(key);
2599
+ const value = await store.lookup(key);
2526
2600
  if (value) return Number.isFinite(value.lastRowid) ? value.lastRowid : null;
2527
- const legacy = store.consume(accountId);
2601
+ const legacy = await store.consume(accountId);
2528
2602
  if (legacy && Number.isFinite(legacy.lastRowid)) {
2529
- store.register(key, { lastRowid: legacy.lastRowid });
2530
- return legacy.lastRowid;
2603
+ await store.registerIfAbsent(key, { lastRowid: legacy.lastRowid });
2604
+ const adopted = await store.lookup(key);
2605
+ return adopted && Number.isFinite(adopted.lastRowid) ? adopted.lastRowid : null;
2531
2606
  }
2532
2607
  return null;
2533
2608
  } catch {
2534
2609
  return null;
2535
2610
  }
2536
2611
  }
2537
- function migrateLegacyCatchupCursor(accountId, dbIdentity) {
2612
+ async function migrateLegacyCatchupCursor(accountId, dbIdentity) {
2538
2613
  try {
2539
- const legacy = getIMessageRuntime().state.openSyncKeyedStore({
2614
+ const legacy = getIMessageRuntime().state.openKeyedStore({
2540
2615
  namespace: LEGACY_CATCHUP_CURSOR_NAMESPACE,
2541
2616
  maxEntries: LEGACY_CATCHUP_CURSOR_MAX_ENTRIES
2542
2617
  });
2543
2618
  const key = createHash("sha256").update(accountId, "utf8").digest("hex").slice(0, 32);
2544
- const value = legacy.consume(key);
2619
+ const value = await legacy.consume(key);
2545
2620
  const rowid = typeof value?.lastSeenRowid === "number" && Number.isFinite(value.lastSeenRowid) ? value.lastSeenRowid : null;
2546
- if (rowid !== null) advanceIMessageRecoveryCursor(accountId, dbIdentity, rowid);
2621
+ if (rowid !== null) await advanceIMessageRecoveryCursor(accountId, dbIdentity, rowid);
2547
2622
  return rowid;
2548
2623
  } catch {
2549
2624
  return null;
2550
2625
  }
2551
2626
  }
2552
- function reconcileRecoveryCursorToWatermark(accountId, dbIdentity, cursorRowid, watermarkRowid) {
2627
+ async function reconcileRecoveryCursorToWatermark(accountId, dbIdentity, cursorRowid, watermarkRowid) {
2553
2628
  if (cursorRowid === null || watermarkRowid === null || cursorRowid <= watermarkRowid) return cursorRowid;
2554
2629
  try {
2555
- openRecoveryCursorStore().register(recoveryCursorStoreKey(accountId, dbIdentity), { lastRowid: watermarkRowid });
2630
+ return (await applyRecoveryCursorUpdate(recoveryCursorStoreKey(accountId, dbIdentity), {
2631
+ kind: "rewind",
2632
+ rowid: watermarkRowid,
2633
+ expectedRowid: cursorRowid
2634
+ }))?.lastRowid ?? watermarkRowid;
2556
2635
  } catch {
2557
2636
  return watermarkRowid;
2558
2637
  }
2559
- return watermarkRowid;
2560
2638
  }
2561
2639
  /**
2562
2640
  * Last durably admitted rowid for this account on `dbIdentity`, or null when
2563
2641
  * none is recorded yet (including when the only stored cursor belongs to a
2564
2642
  * different database).
2565
2643
  */
2566
- function loadIMessageRecoveryCursor(accountId, dbIdentity, options = {}) {
2644
+ async function loadIMessageRecoveryCursor(accountId, dbIdentity, options = {}) {
2567
2645
  const watermarkRowid = typeof options.watermarkRowid === "number" && Number.isFinite(options.watermarkRowid) ? options.watermarkRowid : null;
2568
- const current = readRecoveryCursor(accountId, dbIdentity);
2569
- if (current !== null) return reconcileRecoveryCursorToWatermark(accountId, dbIdentity, current, watermarkRowid);
2646
+ const current = await readRecoveryCursor(accountId, dbIdentity);
2647
+ if (current !== null) return await reconcileRecoveryCursorToWatermark(accountId, dbIdentity, current, watermarkRowid);
2570
2648
  if (options.migrateLegacyCatchup === false) return null;
2571
- return reconcileRecoveryCursorToWatermark(accountId, dbIdentity, migrateLegacyCatchupCursor(accountId, dbIdentity), watermarkRowid);
2649
+ return await reconcileRecoveryCursorToWatermark(accountId, dbIdentity, await migrateLegacyCatchupCursor(accountId, dbIdentity), watermarkRowid);
2572
2650
  }
2573
2651
  /** Advance the cursor forward to `rowid` (monotonic per database; never rewinds). */
2574
- function advanceIMessageRecoveryCursor(accountId, dbIdentity, rowid) {
2652
+ async function advanceIMessageRecoveryCursor(accountId, dbIdentity, rowid) {
2575
2653
  if (!Number.isFinite(rowid)) return;
2576
2654
  try {
2577
- const store = openRecoveryCursorStore();
2578
- const key = recoveryCursorStoreKey(accountId, dbIdentity);
2579
- const current = store.lookup(key);
2580
- if (current && current.lastRowid >= rowid) return;
2581
- store.register(key, { lastRowid: rowid });
2655
+ await applyRecoveryCursorUpdate(recoveryCursorStoreKey(accountId, dbIdentity), {
2656
+ kind: "advance",
2657
+ rowid
2658
+ });
2582
2659
  } catch {}
2583
2660
  }
2584
2661
  //#endregion
@@ -2902,7 +2979,7 @@ async function monitorIMessageProvider(opts = {}) {
2902
2979
  dbPath,
2903
2980
  remoteHost
2904
2981
  });
2905
- const recoveryCursorRowid = loadIMessageRecoveryCursor(accountInfo.accountId, recoveryCursorDbIdentity, {
2982
+ const recoveryCursorRowid = await loadIMessageRecoveryCursor(accountInfo.accountId, recoveryCursorDbIdentity, {
2906
2983
  migrateLegacyCatchup: !catchupCfg.enabled,
2907
2984
  watermarkRowid: recoveryBoundaryRowid
2908
2985
  });
@@ -2916,7 +2993,7 @@ async function monitorIMessageProvider(opts = {}) {
2916
2993
  for (const value of values) min = min === null ? value : Math.min(min, value);
2917
2994
  return min;
2918
2995
  }
2919
- function advanceRecoveryCursorAfterDurableEnqueue(rowid) {
2996
+ async function advanceRecoveryCursorAfterDurableEnqueue(rowid) {
2920
2997
  if (catchupCfg.enabled) return;
2921
2998
  failedRecoveryCursorRowids.delete(rowid);
2922
2999
  durableRecoveryCursorRowids.add(rowid);
@@ -2924,7 +3001,7 @@ async function monitorIMessageProvider(opts = {}) {
2924
3001
  const holdFloor = minSetValue(failedRecoveryCursorRowids);
2925
3002
  const nextCursorRowid = holdFloor !== null && maxDurableRowid >= holdFloor ? holdFloor - 1 : maxDurableRowid;
2926
3003
  if (nextCursorRowid >= 0 && nextCursorRowid > latestAdvancedRecoveryCursorRowid) {
2927
- advanceIMessageRecoveryCursor(accountInfo.accountId, recoveryCursorDbIdentity, nextCursorRowid);
3004
+ await advanceIMessageRecoveryCursor(accountInfo.accountId, recoveryCursorDbIdentity, nextCursorRowid);
2928
3005
  latestAdvancedRecoveryCursorRowid = nextCursorRowid;
2929
3006
  for (const durableRowid of durableRecoveryCursorRowids) if (durableRowid <= nextCursorRowid) durableRecoveryCursorRowids.delete(durableRowid);
2930
3007
  }
@@ -3187,10 +3264,10 @@ async function monitorIMessageProvider(opts = {}) {
3187
3264
  }
3188
3265
  }
3189
3266
  const storePath = resolveStorePath(cfg.session?.store, { agentId: decision.route.agentId });
3190
- const privateApiStatus = getCachedIMessagePrivateApiStatus(cliPath);
3267
+ const privateApiStatus = await probeIMessagePrivateApi(cliPath, probeTimeoutMs);
3191
3268
  const supportsTyping = imessageRpcSupportsMethod(privateApiStatus, "typing");
3192
3269
  const supportsRead = imessageRpcSupportsMethod(privateApiStatus, "read");
3193
- if (privateApiStatus?.available === true) {
3270
+ if (privateApiStatus.available) {
3194
3271
  if (!supportsTyping || !supportsRead) warnIfImsgUpgradeNeeded.fireOnce(privateApiStatus.rpcMethods, runtime);
3195
3272
  }
3196
3273
  const configuredTypingMode = resolveConfiguredIMessageTypingMode(cfg, decision.route.agentId);
@@ -3563,7 +3640,7 @@ async function monitorIMessageProvider(opts = {}) {
3563
3640
  return { kind: "deferred" };
3564
3641
  },
3565
3642
  onDurableEnqueue: async (facts) => {
3566
- advanceRecoveryCursorAfterDurableEnqueue(facts.rowid);
3643
+ await advanceRecoveryCursorAfterDurableEnqueue(facts.rowid);
3567
3644
  await maybeAdvanceLiveCatchupCursor({
3568
3645
  id: facts.rowid,
3569
3646
  created_at: facts.createdAt