@openclaw/imessage 0.0.0 → 2026.8.1-beta.3

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 (2123) hide show
  1. package/README.md +27 -1
  2. package/dist/accounts-D00Njxg2.js +368 -0
  3. package/dist/actions.runtime-B_xJiBXF.js +451 -0
  4. package/dist/api.js +14 -0
  5. package/dist/approval-handler.runtime-BKku8aUf.js +434 -0
  6. package/dist/approval-reactions-BME5eA6T.js +566 -0
  7. package/dist/catchup-Dh-Rv4Ur.js +294 -0
  8. package/dist/channel-BFQTpvrG.js +624 -0
  9. package/dist/channel-config-api.js +2 -0
  10. package/dist/channel-plugin-api.js +2 -0
  11. package/dist/channel.runtime-BjkXwX9_.js +236 -0
  12. package/dist/config-schema-DV0KP5nC.js +140 -0
  13. package/dist/contract-api.js +3 -0
  14. package/dist/conversation-bindings-GDQ_Laxj.js +24 -0
  15. package/dist/doctor-contract-api.js +357 -0
  16. package/dist/group-policy-Ca3c5KES.js +1305 -0
  17. package/dist/index.js +18 -0
  18. package/dist/media-contract-BEgdvYhW.js +13 -0
  19. package/dist/media-contract-api.js +2 -0
  20. package/dist/message-tool-api-TZiNYA17.js +318 -0
  21. package/dist/message-tool-api.js +2 -0
  22. package/dist/monitor-Uv5RaRTk.js +3521 -0
  23. package/dist/monitor-reply-cache-BdeUQaHO.js +353 -0
  24. package/dist/outbound-send-deps-B-QEsLSM.js +4 -0
  25. package/dist/persisted-echo-cache-DGxy-J4t.js +143 -0
  26. package/dist/question-reactions-to0i8vxE.js +75 -0
  27. package/dist/reaction-context-DaNrZqYo.js +105 -0
  28. package/dist/remote-file-CDuk0joc.js +293 -0
  29. package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  30. package/dist/runtime-api.js +23 -0
  31. package/dist/sanitize-outbound-DaLmdkbf.js +896 -0
  32. package/dist/secret-contract-api.js +5 -0
  33. package/dist/send-Dake4Awx.js +1176 -0
  34. package/dist/session-binding-contract-api.js +2 -0
  35. package/dist/setup-entry.js +11 -0
  36. package/node_modules/typebox/build/compile/code.d.mts +12 -0
  37. package/node_modules/typebox/build/compile/code.mjs +65 -0
  38. package/node_modules/typebox/build/compile/compile.d.mts +6 -0
  39. package/node_modules/typebox/build/compile/compile.mjs +12 -0
  40. package/node_modules/typebox/build/compile/index.d.mts +8 -0
  41. package/node_modules/typebox/build/compile/index.mjs +14 -0
  42. package/node_modules/typebox/build/compile/validator.d.mts +35 -0
  43. package/node_modules/typebox/build/compile/validator.mjs +91 -0
  44. package/node_modules/typebox/build/error/errors.d.mts +208 -0
  45. package/node_modules/typebox/build/error/errors.mjs +18 -0
  46. package/node_modules/typebox/build/error/index.d.mts +1 -0
  47. package/node_modules/typebox/build/error/index.mjs +1 -0
  48. package/node_modules/typebox/build/format/_idna.d.mts +2 -0
  49. package/node_modules/typebox/build/format/_idna.mjs +246 -0
  50. package/node_modules/typebox/build/format/_puny.d.mts +1 -0
  51. package/node_modules/typebox/build/format/_puny.mjs +77 -0
  52. package/node_modules/typebox/build/format/_registry.d.mts +15 -0
  53. package/node_modules/typebox/build/format/_registry.mjs +96 -0
  54. package/node_modules/typebox/build/format/date.d.mts +6 -0
  55. package/node_modules/typebox/build/format/date.mjs +19 -0
  56. package/node_modules/typebox/build/format/date_time.d.mts +6 -0
  57. package/node_modules/typebox/build/format/date_time.mjs +11 -0
  58. package/node_modules/typebox/build/format/duration.d.mts +5 -0
  59. package/node_modules/typebox/build/format/duration.mjs +8 -0
  60. package/node_modules/typebox/build/format/email.d.mts +5 -0
  61. package/node_modules/typebox/build/format/email.mjs +8 -0
  62. package/node_modules/typebox/build/format/format.d.mts +22 -0
  63. package/node_modules/typebox/build/format/format.mjs +22 -0
  64. package/node_modules/typebox/build/format/hostname.d.mts +7 -0
  65. package/node_modules/typebox/build/format/hostname.mjs +18 -0
  66. package/node_modules/typebox/build/format/idn_email.d.mts +5 -0
  67. package/node_modules/typebox/build/format/idn_email.mjs +8 -0
  68. package/node_modules/typebox/build/format/idn_hostname.d.mts +7 -0
  69. package/node_modules/typebox/build/format/idn_hostname.mjs +19 -0
  70. package/node_modules/typebox/build/format/index.d.mts +4 -0
  71. package/node_modules/typebox/build/format/index.mjs +4 -0
  72. package/node_modules/typebox/build/format/ipv4.d.mts +6 -0
  73. package/node_modules/typebox/build/format/ipv4.mjs +38 -0
  74. package/node_modules/typebox/build/format/ipv6.d.mts +5 -0
  75. package/node_modules/typebox/build/format/ipv6.mjs +67 -0
  76. package/node_modules/typebox/build/format/iri.d.mts +5 -0
  77. package/node_modules/typebox/build/format/iri.mjs +13 -0
  78. package/node_modules/typebox/build/format/iri_reference.d.mts +5 -0
  79. package/node_modules/typebox/build/format/iri_reference.mjs +60 -0
  80. package/node_modules/typebox/build/format/json_pointer.d.mts +6 -0
  81. package/node_modules/typebox/build/format/json_pointer.mjs +9 -0
  82. package/node_modules/typebox/build/format/json_pointer_uri_fragment.d.mts +6 -0
  83. package/node_modules/typebox/build/format/json_pointer_uri_fragment.mjs +9 -0
  84. package/node_modules/typebox/build/format/regex.d.mts +6 -0
  85. package/node_modules/typebox/build/format/regex.mjs +17 -0
  86. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +6 -0
  87. package/node_modules/typebox/build/format/relative_json_pointer.mjs +9 -0
  88. package/node_modules/typebox/build/format/time.d.mts +5 -0
  89. package/node_modules/typebox/build/format/time.mjs +27 -0
  90. package/node_modules/typebox/build/format/uri.d.mts +5 -0
  91. package/node_modules/typebox/build/format/uri.mjs +135 -0
  92. package/node_modules/typebox/build/format/uri_reference.d.mts +5 -0
  93. package/node_modules/typebox/build/format/uri_reference.mjs +9 -0
  94. package/node_modules/typebox/build/format/uri_template.d.mts +6 -0
  95. package/node_modules/typebox/build/format/uri_template.mjs +10 -0
  96. package/node_modules/typebox/build/format/url.d.mts +6 -0
  97. package/node_modules/typebox/build/format/url.mjs +9 -0
  98. package/node_modules/typebox/build/format/uuid.d.mts +6 -0
  99. package/node_modules/typebox/build/format/uuid.mjs +9 -0
  100. package/node_modules/typebox/build/guard/emit.d.mts +54 -0
  101. package/node_modules/typebox/build/guard/emit.mjs +186 -0
  102. package/node_modules/typebox/build/guard/globals.d.mts +35 -0
  103. package/node_modules/typebox/build/guard/globals.mjs +90 -0
  104. package/node_modules/typebox/build/guard/guard.d.mts +65 -0
  105. package/node_modules/typebox/build/guard/guard.mjs +212 -0
  106. package/node_modules/typebox/build/guard/index.d.mts +6 -0
  107. package/node_modules/typebox/build/guard/index.mjs +6 -0
  108. package/node_modules/typebox/build/guard/native.d.mts +20 -0
  109. package/node_modules/typebox/build/guard/native.mjs +60 -0
  110. package/node_modules/typebox/build/guard/string.d.mts +6 -0
  111. package/node_modules/typebox/build/guard/string.mjs +176 -0
  112. package/node_modules/typebox/build/index.d.mts +8 -0
  113. package/node_modules/typebox/build/index.mjs +14 -0
  114. package/node_modules/typebox/build/schema/build.d.mts +39 -0
  115. package/node_modules/typebox/build/schema/build.mjs +118 -0
  116. package/node_modules/typebox/build/schema/check.d.mts +6 -0
  117. package/node_modules/typebox/build/schema/check.mjs +14 -0
  118. package/node_modules/typebox/build/schema/compile.d.mts +22 -0
  119. package/node_modules/typebox/build/schema/compile.mjs +46 -0
  120. package/node_modules/typebox/build/schema/engine/_context.d.mts +35 -0
  121. package/node_modules/typebox/build/schema/engine/_context.mjs +129 -0
  122. package/node_modules/typebox/build/schema/engine/_exact_optional.d.mts +3 -0
  123. package/node_modules/typebox/build/schema/engine/_exact_optional.mjs +20 -0
  124. package/node_modules/typebox/build/schema/engine/_externals.d.mts +7 -0
  125. package/node_modules/typebox/build/schema/engine/_externals.mjs +25 -0
  126. package/node_modules/typebox/build/schema/engine/_functions.d.mts +6 -0
  127. package/node_modules/typebox/build/schema/engine/_functions.mjs +66 -0
  128. package/node_modules/typebox/build/schema/engine/_reducer.d.mts +4 -0
  129. package/node_modules/typebox/build/schema/engine/_reducer.mjs +45 -0
  130. package/node_modules/typebox/build/schema/engine/_refine.d.mts +6 -0
  131. package/node_modules/typebox/build/schema/engine/_refine.mjs +29 -0
  132. package/node_modules/typebox/build/schema/engine/_stack.d.mts +18 -0
  133. package/node_modules/typebox/build/schema/engine/_stack.mjs +107 -0
  134. package/node_modules/typebox/build/schema/engine/_unique.d.mts +2 -0
  135. package/node_modules/typebox/build/schema/engine/_unique.mjs +5 -0
  136. package/node_modules/typebox/build/schema/engine/additionalItems.d.mts +6 -0
  137. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +50 -0
  138. package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +9 -0
  139. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +110 -0
  140. package/node_modules/typebox/build/schema/engine/allOf.d.mts +6 -0
  141. package/node_modules/typebox/build/schema/engine/allOf.mjs +47 -0
  142. package/node_modules/typebox/build/schema/engine/anyOf.d.mts +6 -0
  143. package/node_modules/typebox/build/schema/engine/anyOf.mjs +52 -0
  144. package/node_modules/typebox/build/schema/engine/boolean.d.mts +5 -0
  145. package/node_modules/typebox/build/schema/engine/boolean.mjs +25 -0
  146. package/node_modules/typebox/build/schema/engine/const.d.mts +6 -0
  147. package/node_modules/typebox/build/schema/engine/const.mjs +30 -0
  148. package/node_modules/typebox/build/schema/engine/contains.d.mts +6 -0
  149. package/node_modules/typebox/build/schema/engine/contains.mjs +42 -0
  150. package/node_modules/typebox/build/schema/engine/dependencies.d.mts +6 -0
  151. package/node_modules/typebox/build/schema/engine/dependencies.mjs +45 -0
  152. package/node_modules/typebox/build/schema/engine/dependentRequired.d.mts +6 -0
  153. package/node_modules/typebox/build/schema/engine/dependentRequired.mjs +40 -0
  154. package/node_modules/typebox/build/schema/engine/dependentSchemas.d.mts +6 -0
  155. package/node_modules/typebox/build/schema/engine/dependentSchemas.mjs +38 -0
  156. package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +6 -0
  157. package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +25 -0
  158. package/node_modules/typebox/build/schema/engine/enum.d.mts +6 -0
  159. package/node_modules/typebox/build/schema/engine/enum.mjs +33 -0
  160. package/node_modules/typebox/build/schema/engine/exclusiveMaximum.d.mts +6 -0
  161. package/node_modules/typebox/build/schema/engine/exclusiveMaximum.mjs +25 -0
  162. package/node_modules/typebox/build/schema/engine/exclusiveMinimum.d.mts +6 -0
  163. package/node_modules/typebox/build/schema/engine/exclusiveMinimum.mjs +25 -0
  164. package/node_modules/typebox/build/schema/engine/format.d.mts +6 -0
  165. package/node_modules/typebox/build/schema/engine/format.mjs +26 -0
  166. package/node_modules/typebox/build/schema/engine/if.d.mts +6 -0
  167. package/node_modules/typebox/build/schema/engine/if.mjs +47 -0
  168. package/node_modules/typebox/build/schema/engine/index.d.mts +48 -0
  169. package/node_modules/typebox/build/schema/engine/index.mjs +54 -0
  170. package/node_modules/typebox/build/schema/engine/items.d.mts +6 -0
  171. package/node_modules/typebox/build/schema/engine/items.mjs +68 -0
  172. package/node_modules/typebox/build/schema/engine/maxContains.d.mts +6 -0
  173. package/node_modules/typebox/build/schema/engine/maxContains.mjs +42 -0
  174. package/node_modules/typebox/build/schema/engine/maxItems.d.mts +6 -0
  175. package/node_modules/typebox/build/schema/engine/maxItems.mjs +25 -0
  176. package/node_modules/typebox/build/schema/engine/maxLength.d.mts +6 -0
  177. package/node_modules/typebox/build/schema/engine/maxLength.mjs +25 -0
  178. package/node_modules/typebox/build/schema/engine/maxProperties.d.mts +6 -0
  179. package/node_modules/typebox/build/schema/engine/maxProperties.mjs +25 -0
  180. package/node_modules/typebox/build/schema/engine/maximum.d.mts +6 -0
  181. package/node_modules/typebox/build/schema/engine/maximum.mjs +25 -0
  182. package/node_modules/typebox/build/schema/engine/minContains.d.mts +6 -0
  183. package/node_modules/typebox/build/schema/engine/minContains.mjs +41 -0
  184. package/node_modules/typebox/build/schema/engine/minItems.d.mts +6 -0
  185. package/node_modules/typebox/build/schema/engine/minItems.mjs +25 -0
  186. package/node_modules/typebox/build/schema/engine/minLength.d.mts +6 -0
  187. package/node_modules/typebox/build/schema/engine/minLength.mjs +25 -0
  188. package/node_modules/typebox/build/schema/engine/minProperties.d.mts +6 -0
  189. package/node_modules/typebox/build/schema/engine/minProperties.mjs +25 -0
  190. package/node_modules/typebox/build/schema/engine/minimum.d.mts +6 -0
  191. package/node_modules/typebox/build/schema/engine/minimum.mjs +25 -0
  192. package/node_modules/typebox/build/schema/engine/multipleOf.d.mts +6 -0
  193. package/node_modules/typebox/build/schema/engine/multipleOf.mjs +25 -0
  194. package/node_modules/typebox/build/schema/engine/not.d.mts +6 -0
  195. package/node_modules/typebox/build/schema/engine/not.mjs +37 -0
  196. package/node_modules/typebox/build/schema/engine/oneOf.d.mts +6 -0
  197. package/node_modules/typebox/build/schema/engine/oneOf.mjs +58 -0
  198. package/node_modules/typebox/build/schema/engine/pattern.d.mts +6 -0
  199. package/node_modules/typebox/build/schema/engine/pattern.mjs +28 -0
  200. package/node_modules/typebox/build/schema/engine/patternProperties.d.mts +6 -0
  201. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +44 -0
  202. package/node_modules/typebox/build/schema/engine/prefixItems.d.mts +6 -0
  203. package/node_modules/typebox/build/schema/engine/prefixItems.mjs +35 -0
  204. package/node_modules/typebox/build/schema/engine/properties.d.mts +6 -0
  205. package/node_modules/typebox/build/schema/engine/properties.mjs +75 -0
  206. package/node_modules/typebox/build/schema/engine/propertyNames.d.mts +6 -0
  207. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +39 -0
  208. package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +6 -0
  209. package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +25 -0
  210. package/node_modules/typebox/build/schema/engine/ref.d.mts +6 -0
  211. package/node_modules/typebox/build/schema/engine/ref.mjs +58 -0
  212. package/node_modules/typebox/build/schema/engine/required.d.mts +6 -0
  213. package/node_modules/typebox/build/schema/engine/required.mjs +32 -0
  214. package/node_modules/typebox/build/schema/engine/schema.d.mts +9 -0
  215. package/node_modules/typebox/build/schema/engine/schema.mjs +347 -0
  216. package/node_modules/typebox/build/schema/engine/type.d.mts +6 -0
  217. package/node_modules/typebox/build/schema/engine/type.mjs +70 -0
  218. package/node_modules/typebox/build/schema/engine/unevaluatedItems.d.mts +6 -0
  219. package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +51 -0
  220. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.d.mts +6 -0
  221. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +51 -0
  222. package/node_modules/typebox/build/schema/engine/uniqueItems.d.mts +6 -0
  223. package/node_modules/typebox/build/schema/engine/uniqueItems.mjs +51 -0
  224. package/node_modules/typebox/build/schema/errors.d.mts +6 -0
  225. package/node_modules/typebox/build/schema/errors.mjs +24 -0
  226. package/node_modules/typebox/build/schema/index.d.mts +3 -0
  227. package/node_modules/typebox/build/schema/index.mjs +9 -0
  228. package/node_modules/typebox/build/schema/parse.d.mts +13 -0
  229. package/node_modules/typebox/build/schema/parse.mjs +27 -0
  230. package/node_modules/typebox/build/schema/pointer/index.d.mts +2 -0
  231. package/node_modules/typebox/build/schema/pointer/index.mjs +2 -0
  232. package/node_modules/typebox/build/schema/pointer/pointer.d.mts +10 -0
  233. package/node_modules/typebox/build/schema/pointer/pointer.mjs +106 -0
  234. package/node_modules/typebox/build/schema/pointer/pointer_get.d.mts +9 -0
  235. package/node_modules/typebox/build/schema/pointer/pointer_get.mjs +2 -0
  236. package/node_modules/typebox/build/schema/resolve/index.d.mts +1 -0
  237. package/node_modules/typebox/build/schema/resolve/index.mjs +1 -0
  238. package/node_modules/typebox/build/schema/resolve/ref.d.mts +3 -0
  239. package/node_modules/typebox/build/schema/resolve/ref.mjs +146 -0
  240. package/node_modules/typebox/build/schema/resolve/resolve.d.mts +1 -0
  241. package/node_modules/typebox/build/schema/resolve/resolve.mjs +1 -0
  242. package/node_modules/typebox/build/schema/schema.d.mts +10 -0
  243. package/node_modules/typebox/build/schema/schema.mjs +10 -0
  244. package/node_modules/typebox/build/schema/static/_canonical.d.mts +7 -0
  245. package/node_modules/typebox/build/schema/static/_canonical.mjs +2 -0
  246. package/node_modules/typebox/build/schema/static/_comparer.d.mts +6 -0
  247. package/node_modules/typebox/build/schema/static/_comparer.mjs +2 -0
  248. package/node_modules/typebox/build/schema/static/_elements.d.mts +18 -0
  249. package/node_modules/typebox/build/schema/static/_elements.mjs +2 -0
  250. package/node_modules/typebox/build/schema/static/additionalProperties.d.mts +7 -0
  251. package/node_modules/typebox/build/schema/static/additionalProperties.mjs +3 -0
  252. package/node_modules/typebox/build/schema/static/allOf.d.mts +3 -0
  253. package/node_modules/typebox/build/schema/static/allOf.mjs +2 -0
  254. package/node_modules/typebox/build/schema/static/anyOf.d.mts +3 -0
  255. package/node_modules/typebox/build/schema/static/anyOf.mjs +2 -0
  256. package/node_modules/typebox/build/schema/static/const.d.mts +1 -0
  257. package/node_modules/typebox/build/schema/static/const.mjs +2 -0
  258. package/node_modules/typebox/build/schema/static/enum.d.mts +1 -0
  259. package/node_modules/typebox/build/schema/static/enum.mjs +2 -0
  260. package/node_modules/typebox/build/schema/static/if.d.mts +15 -0
  261. package/node_modules/typebox/build/schema/static/if.mjs +2 -0
  262. package/node_modules/typebox/build/schema/static/index.d.mts +1 -0
  263. package/node_modules/typebox/build/schema/static/index.mjs +1 -0
  264. package/node_modules/typebox/build/schema/static/items.d.mts +7 -0
  265. package/node_modules/typebox/build/schema/static/items.mjs +2 -0
  266. package/node_modules/typebox/build/schema/static/oneOf.d.mts +3 -0
  267. package/node_modules/typebox/build/schema/static/oneOf.mjs +2 -0
  268. package/node_modules/typebox/build/schema/static/patternProperties.d.mts +7 -0
  269. package/node_modules/typebox/build/schema/static/patternProperties.mjs +2 -0
  270. package/node_modules/typebox/build/schema/static/prefixItems.d.mts +3 -0
  271. package/node_modules/typebox/build/schema/static/prefixItems.mjs +2 -0
  272. package/node_modules/typebox/build/schema/static/properties.d.mts +32 -0
  273. package/node_modules/typebox/build/schema/static/properties.mjs +2 -0
  274. package/node_modules/typebox/build/schema/static/ref.d.mts +8 -0
  275. package/node_modules/typebox/build/schema/static/ref.mjs +3 -0
  276. package/node_modules/typebox/build/schema/static/required.d.mts +3 -0
  277. package/node_modules/typebox/build/schema/static/required.mjs +3 -0
  278. package/node_modules/typebox/build/schema/static/schema.d.mts +56 -0
  279. package/node_modules/typebox/build/schema/static/schema.mjs +2 -0
  280. package/node_modules/typebox/build/schema/static/static.d.mts +4 -0
  281. package/node_modules/typebox/build/schema/static/static.mjs +3 -0
  282. package/node_modules/typebox/build/schema/static/type.d.mts +4 -0
  283. package/node_modules/typebox/build/schema/static/type.mjs +3 -0
  284. package/node_modules/typebox/build/schema/static/unevaluatedProperties.d.mts +7 -0
  285. package/node_modules/typebox/build/schema/static/unevaluatedProperties.mjs +3 -0
  286. package/node_modules/typebox/build/schema/types/_refine.d.mts +13 -0
  287. package/node_modules/typebox/build/schema/types/_refine.mjs +18 -0
  288. package/node_modules/typebox/build/schema/types/additionalItems.d.mts +9 -0
  289. package/node_modules/typebox/build/schema/types/additionalItems.mjs +14 -0
  290. package/node_modules/typebox/build/schema/types/additionalProperties.d.mts +9 -0
  291. package/node_modules/typebox/build/schema/types/additionalProperties.mjs +14 -0
  292. package/node_modules/typebox/build/schema/types/allOf.d.mts +9 -0
  293. package/node_modules/typebox/build/schema/types/allOf.mjs +15 -0
  294. package/node_modules/typebox/build/schema/types/anchor.d.mts +8 -0
  295. package/node_modules/typebox/build/schema/types/anchor.mjs +12 -0
  296. package/node_modules/typebox/build/schema/types/anyOf.d.mts +9 -0
  297. package/node_modules/typebox/build/schema/types/anyOf.mjs +15 -0
  298. package/node_modules/typebox/build/schema/types/const.d.mts +9 -0
  299. package/node_modules/typebox/build/schema/types/const.mjs +12 -0
  300. package/node_modules/typebox/build/schema/types/contains.d.mts +9 -0
  301. package/node_modules/typebox/build/schema/types/contains.mjs +14 -0
  302. package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +9 -0
  303. package/node_modules/typebox/build/schema/types/contentEncoding.mjs +13 -0
  304. package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +9 -0
  305. package/node_modules/typebox/build/schema/types/contentMediaType.mjs +13 -0
  306. package/node_modules/typebox/build/schema/types/default.d.mts +9 -0
  307. package/node_modules/typebox/build/schema/types/default.mjs +12 -0
  308. package/node_modules/typebox/build/schema/types/defs.d.mts +6 -0
  309. package/node_modules/typebox/build/schema/types/defs.mjs +12 -0
  310. package/node_modules/typebox/build/schema/types/dependencies.d.mts +11 -0
  311. package/node_modules/typebox/build/schema/types/dependencies.mjs +16 -0
  312. package/node_modules/typebox/build/schema/types/dependentRequired.d.mts +9 -0
  313. package/node_modules/typebox/build/schema/types/dependentRequired.mjs +15 -0
  314. package/node_modules/typebox/build/schema/types/dependentSchemas.d.mts +9 -0
  315. package/node_modules/typebox/build/schema/types/dependentSchemas.mjs +15 -0
  316. package/node_modules/typebox/build/schema/types/dynamicAnchor.d.mts +8 -0
  317. package/node_modules/typebox/build/schema/types/dynamicAnchor.mjs +12 -0
  318. package/node_modules/typebox/build/schema/types/dynamicRef.d.mts +8 -0
  319. package/node_modules/typebox/build/schema/types/dynamicRef.mjs +12 -0
  320. package/node_modules/typebox/build/schema/types/else.d.mts +9 -0
  321. package/node_modules/typebox/build/schema/types/else.mjs +14 -0
  322. package/node_modules/typebox/build/schema/types/enum.d.mts +9 -0
  323. package/node_modules/typebox/build/schema/types/enum.mjs +13 -0
  324. package/node_modules/typebox/build/schema/types/exclusiveMaximum.d.mts +9 -0
  325. package/node_modules/typebox/build/schema/types/exclusiveMaximum.mjs +13 -0
  326. package/node_modules/typebox/build/schema/types/exclusiveMinimum.d.mts +9 -0
  327. package/node_modules/typebox/build/schema/types/exclusiveMinimum.mjs +13 -0
  328. package/node_modules/typebox/build/schema/types/format.d.mts +9 -0
  329. package/node_modules/typebox/build/schema/types/format.mjs +13 -0
  330. package/node_modules/typebox/build/schema/types/id.d.mts +9 -0
  331. package/node_modules/typebox/build/schema/types/id.mjs +13 -0
  332. package/node_modules/typebox/build/schema/types/if.d.mts +9 -0
  333. package/node_modules/typebox/build/schema/types/if.mjs +14 -0
  334. package/node_modules/typebox/build/schema/types/index.d.mts +53 -0
  335. package/node_modules/typebox/build/schema/types/index.mjs +59 -0
  336. package/node_modules/typebox/build/schema/types/items.d.mts +19 -0
  337. package/node_modules/typebox/build/schema/types/items.mjs +26 -0
  338. package/node_modules/typebox/build/schema/types/maxContains.d.mts +9 -0
  339. package/node_modules/typebox/build/schema/types/maxContains.mjs +13 -0
  340. package/node_modules/typebox/build/schema/types/maxItems.d.mts +9 -0
  341. package/node_modules/typebox/build/schema/types/maxItems.mjs +13 -0
  342. package/node_modules/typebox/build/schema/types/maxLength.d.mts +9 -0
  343. package/node_modules/typebox/build/schema/types/maxLength.mjs +13 -0
  344. package/node_modules/typebox/build/schema/types/maxProperties.d.mts +9 -0
  345. package/node_modules/typebox/build/schema/types/maxProperties.mjs +13 -0
  346. package/node_modules/typebox/build/schema/types/maximum.d.mts +9 -0
  347. package/node_modules/typebox/build/schema/types/maximum.mjs +13 -0
  348. package/node_modules/typebox/build/schema/types/minContains.d.mts +9 -0
  349. package/node_modules/typebox/build/schema/types/minContains.mjs +13 -0
  350. package/node_modules/typebox/build/schema/types/minItems.d.mts +9 -0
  351. package/node_modules/typebox/build/schema/types/minItems.mjs +13 -0
  352. package/node_modules/typebox/build/schema/types/minLength.d.mts +9 -0
  353. package/node_modules/typebox/build/schema/types/minLength.mjs +13 -0
  354. package/node_modules/typebox/build/schema/types/minProperties.d.mts +9 -0
  355. package/node_modules/typebox/build/schema/types/minProperties.mjs +13 -0
  356. package/node_modules/typebox/build/schema/types/minimum.d.mts +9 -0
  357. package/node_modules/typebox/build/schema/types/minimum.mjs +13 -0
  358. package/node_modules/typebox/build/schema/types/multipleOf.d.mts +9 -0
  359. package/node_modules/typebox/build/schema/types/multipleOf.mjs +13 -0
  360. package/node_modules/typebox/build/schema/types/not.d.mts +9 -0
  361. package/node_modules/typebox/build/schema/types/not.mjs +14 -0
  362. package/node_modules/typebox/build/schema/types/oneOf.d.mts +9 -0
  363. package/node_modules/typebox/build/schema/types/oneOf.mjs +15 -0
  364. package/node_modules/typebox/build/schema/types/pattern.d.mts +9 -0
  365. package/node_modules/typebox/build/schema/types/pattern.mjs +14 -0
  366. package/node_modules/typebox/build/schema/types/patternProperties.d.mts +9 -0
  367. package/node_modules/typebox/build/schema/types/patternProperties.mjs +15 -0
  368. package/node_modules/typebox/build/schema/types/prefixItems.d.mts +8 -0
  369. package/node_modules/typebox/build/schema/types/prefixItems.mjs +14 -0
  370. package/node_modules/typebox/build/schema/types/properties.d.mts +9 -0
  371. package/node_modules/typebox/build/schema/types/properties.mjs +15 -0
  372. package/node_modules/typebox/build/schema/types/propertyNames.d.mts +9 -0
  373. package/node_modules/typebox/build/schema/types/propertyNames.mjs +15 -0
  374. package/node_modules/typebox/build/schema/types/recursiveAnchor.d.mts +12 -0
  375. package/node_modules/typebox/build/schema/types/recursiveAnchor.mjs +19 -0
  376. package/node_modules/typebox/build/schema/types/recursiveRef.d.mts +8 -0
  377. package/node_modules/typebox/build/schema/types/recursiveRef.mjs +12 -0
  378. package/node_modules/typebox/build/schema/types/ref.d.mts +9 -0
  379. package/node_modules/typebox/build/schema/types/ref.mjs +13 -0
  380. package/node_modules/typebox/build/schema/types/required.d.mts +9 -0
  381. package/node_modules/typebox/build/schema/types/required.mjs +14 -0
  382. package/node_modules/typebox/build/schema/types/schema.d.mts +9 -0
  383. package/node_modules/typebox/build/schema/types/schema.mjs +14 -0
  384. package/node_modules/typebox/build/schema/types/then.d.mts +9 -0
  385. package/node_modules/typebox/build/schema/types/then.mjs +14 -0
  386. package/node_modules/typebox/build/schema/types/type.d.mts +9 -0
  387. package/node_modules/typebox/build/schema/types/type.mjs +15 -0
  388. package/node_modules/typebox/build/schema/types/unevaluatedItems.d.mts +9 -0
  389. package/node_modules/typebox/build/schema/types/unevaluatedItems.mjs +14 -0
  390. package/node_modules/typebox/build/schema/types/unevaluatedProperties.d.mts +9 -0
  391. package/node_modules/typebox/build/schema/types/unevaluatedProperties.mjs +14 -0
  392. package/node_modules/typebox/build/schema/types/uniqueItems.d.mts +9 -0
  393. package/node_modules/typebox/build/schema/types/uniqueItems.mjs +13 -0
  394. package/node_modules/typebox/build/system/arguments/arguments.d.mts +5 -0
  395. package/node_modules/typebox/build/system/arguments/arguments.mjs +9 -0
  396. package/node_modules/typebox/build/system/arguments/index.d.mts +1 -0
  397. package/node_modules/typebox/build/system/arguments/index.mjs +1 -0
  398. package/node_modules/typebox/build/system/environment/environment.d.mts +1 -0
  399. package/node_modules/typebox/build/system/environment/environment.mjs +1 -0
  400. package/node_modules/typebox/build/system/environment/evaluate.d.mts +9 -0
  401. package/node_modules/typebox/build/system/environment/evaluate.mjs +37 -0
  402. package/node_modules/typebox/build/system/environment/index.d.mts +1 -0
  403. package/node_modules/typebox/build/system/environment/index.mjs +1 -0
  404. package/node_modules/typebox/build/system/hashing/hash.d.mts +4 -0
  405. package/node_modules/typebox/build/system/hashing/hash.mjs +232 -0
  406. package/node_modules/typebox/build/system/hashing/index.d.mts +1 -0
  407. package/node_modules/typebox/build/system/hashing/index.mjs +1 -0
  408. package/node_modules/typebox/build/system/index.d.mts +4 -0
  409. package/node_modules/typebox/build/system/index.mjs +4 -0
  410. package/node_modules/typebox/build/system/locale/_config.d.mts +7 -0
  411. package/node_modules/typebox/build/system/locale/_config.mjs +15 -0
  412. package/node_modules/typebox/build/system/locale/_locale.d.mts +40 -0
  413. package/node_modules/typebox/build/system/locale/_locale.mjs +40 -0
  414. package/node_modules/typebox/build/system/locale/ar_001.d.mts +3 -0
  415. package/node_modules/typebox/build/system/locale/ar_001.mjs +40 -0
  416. package/node_modules/typebox/build/system/locale/bn_BD.d.mts +3 -0
  417. package/node_modules/typebox/build/system/locale/bn_BD.mjs +40 -0
  418. package/node_modules/typebox/build/system/locale/cs_CZ.d.mts +3 -0
  419. package/node_modules/typebox/build/system/locale/cs_CZ.mjs +40 -0
  420. package/node_modules/typebox/build/system/locale/de_DE.d.mts +3 -0
  421. package/node_modules/typebox/build/system/locale/de_DE.mjs +40 -0
  422. package/node_modules/typebox/build/system/locale/el_GR.d.mts +3 -0
  423. package/node_modules/typebox/build/system/locale/el_GR.mjs +40 -0
  424. package/node_modules/typebox/build/system/locale/en_US.d.mts +3 -0
  425. package/node_modules/typebox/build/system/locale/en_US.mjs +39 -0
  426. package/node_modules/typebox/build/system/locale/es_419.d.mts +3 -0
  427. package/node_modules/typebox/build/system/locale/es_419.mjs +40 -0
  428. package/node_modules/typebox/build/system/locale/es_AR.d.mts +3 -0
  429. package/node_modules/typebox/build/system/locale/es_AR.mjs +40 -0
  430. package/node_modules/typebox/build/system/locale/es_ES.d.mts +3 -0
  431. package/node_modules/typebox/build/system/locale/es_ES.mjs +40 -0
  432. package/node_modules/typebox/build/system/locale/es_MX.d.mts +3 -0
  433. package/node_modules/typebox/build/system/locale/es_MX.mjs +40 -0
  434. package/node_modules/typebox/build/system/locale/fa_IR.d.mts +3 -0
  435. package/node_modules/typebox/build/system/locale/fa_IR.mjs +40 -0
  436. package/node_modules/typebox/build/system/locale/fil_PH.d.mts +3 -0
  437. package/node_modules/typebox/build/system/locale/fil_PH.mjs +40 -0
  438. package/node_modules/typebox/build/system/locale/fr_CA.d.mts +3 -0
  439. package/node_modules/typebox/build/system/locale/fr_CA.mjs +40 -0
  440. package/node_modules/typebox/build/system/locale/fr_FR.d.mts +3 -0
  441. package/node_modules/typebox/build/system/locale/fr_FR.mjs +40 -0
  442. package/node_modules/typebox/build/system/locale/ha_NG.d.mts +3 -0
  443. package/node_modules/typebox/build/system/locale/ha_NG.mjs +40 -0
  444. package/node_modules/typebox/build/system/locale/hi_IN.d.mts +3 -0
  445. package/node_modules/typebox/build/system/locale/hi_IN.mjs +40 -0
  446. package/node_modules/typebox/build/system/locale/hu_HU.d.mts +3 -0
  447. package/node_modules/typebox/build/system/locale/hu_HU.mjs +40 -0
  448. package/node_modules/typebox/build/system/locale/id_ID.d.mts +3 -0
  449. package/node_modules/typebox/build/system/locale/id_ID.mjs +40 -0
  450. package/node_modules/typebox/build/system/locale/index.d.mts +1 -0
  451. package/node_modules/typebox/build/system/locale/index.mjs +1 -0
  452. package/node_modules/typebox/build/system/locale/it_IT.d.mts +3 -0
  453. package/node_modules/typebox/build/system/locale/it_IT.mjs +40 -0
  454. package/node_modules/typebox/build/system/locale/ja_JP.d.mts +3 -0
  455. package/node_modules/typebox/build/system/locale/ja_JP.mjs +40 -0
  456. package/node_modules/typebox/build/system/locale/ko_KR.d.mts +3 -0
  457. package/node_modules/typebox/build/system/locale/ko_KR.mjs +40 -0
  458. package/node_modules/typebox/build/system/locale/ms_MY.d.mts +3 -0
  459. package/node_modules/typebox/build/system/locale/ms_MY.mjs +40 -0
  460. package/node_modules/typebox/build/system/locale/nl_NL.d.mts +3 -0
  461. package/node_modules/typebox/build/system/locale/nl_NL.mjs +40 -0
  462. package/node_modules/typebox/build/system/locale/pl_PL.d.mts +3 -0
  463. package/node_modules/typebox/build/system/locale/pl_PL.mjs +40 -0
  464. package/node_modules/typebox/build/system/locale/pt_BR.d.mts +3 -0
  465. package/node_modules/typebox/build/system/locale/pt_BR.mjs +40 -0
  466. package/node_modules/typebox/build/system/locale/pt_PT.d.mts +3 -0
  467. package/node_modules/typebox/build/system/locale/pt_PT.mjs +40 -0
  468. package/node_modules/typebox/build/system/locale/ro_RO.d.mts +3 -0
  469. package/node_modules/typebox/build/system/locale/ro_RO.mjs +40 -0
  470. package/node_modules/typebox/build/system/locale/ru_RU.d.mts +3 -0
  471. package/node_modules/typebox/build/system/locale/ru_RU.mjs +40 -0
  472. package/node_modules/typebox/build/system/locale/sv_SE.d.mts +3 -0
  473. package/node_modules/typebox/build/system/locale/sv_SE.mjs +40 -0
  474. package/node_modules/typebox/build/system/locale/sw_TZ.d.mts +3 -0
  475. package/node_modules/typebox/build/system/locale/sw_TZ.mjs +40 -0
  476. package/node_modules/typebox/build/system/locale/th_TH.d.mts +3 -0
  477. package/node_modules/typebox/build/system/locale/th_TH.mjs +40 -0
  478. package/node_modules/typebox/build/system/locale/tr_TR.d.mts +3 -0
  479. package/node_modules/typebox/build/system/locale/tr_TR.mjs +40 -0
  480. package/node_modules/typebox/build/system/locale/uk_UA.d.mts +3 -0
  481. package/node_modules/typebox/build/system/locale/uk_UA.mjs +40 -0
  482. package/node_modules/typebox/build/system/locale/ur_PK.d.mts +3 -0
  483. package/node_modules/typebox/build/system/locale/ur_PK.mjs +40 -0
  484. package/node_modules/typebox/build/system/locale/vi_VN.d.mts +3 -0
  485. package/node_modules/typebox/build/system/locale/vi_VN.mjs +40 -0
  486. package/node_modules/typebox/build/system/locale/yo_NG.d.mts +3 -0
  487. package/node_modules/typebox/build/system/locale/yo_NG.mjs +40 -0
  488. package/node_modules/typebox/build/system/locale/zh_Hans.d.mts +3 -0
  489. package/node_modules/typebox/build/system/locale/zh_Hans.mjs +40 -0
  490. package/node_modules/typebox/build/system/locale/zh_Hant.d.mts +3 -0
  491. package/node_modules/typebox/build/system/locale/zh_Hant.mjs +40 -0
  492. package/node_modules/typebox/build/system/memory/assign.d.mts +14 -0
  493. package/node_modules/typebox/build/system/memory/assign.mjs +11 -0
  494. package/node_modules/typebox/build/system/memory/clone.d.mts +5 -0
  495. package/node_modules/typebox/build/system/memory/clone.mjs +110 -0
  496. package/node_modules/typebox/build/system/memory/create.d.mts +8 -0
  497. package/node_modules/typebox/build/system/memory/create.mjs +30 -0
  498. package/node_modules/typebox/build/system/memory/discard.d.mts +4 -0
  499. package/node_modules/typebox/build/system/memory/discard.mjs +17 -0
  500. package/node_modules/typebox/build/system/memory/index.d.mts +1 -0
  501. package/node_modules/typebox/build/system/memory/index.mjs +1 -0
  502. package/node_modules/typebox/build/system/memory/memory.d.mts +6 -0
  503. package/node_modules/typebox/build/system/memory/memory.mjs +7 -0
  504. package/node_modules/typebox/build/system/memory/metrics.d.mts +14 -0
  505. package/node_modules/typebox/build/system/memory/metrics.mjs +8 -0
  506. package/node_modules/typebox/build/system/memory/update.d.mts +7 -0
  507. package/node_modules/typebox/build/system/memory/update.mjs +32 -0
  508. package/node_modules/typebox/build/system/settings/index.d.mts +1 -0
  509. package/node_modules/typebox/build/system/settings/index.mjs +1 -0
  510. package/node_modules/typebox/build/system/settings/settings.d.mts +71 -0
  511. package/node_modules/typebox/build/system/settings/settings.mjs +34 -0
  512. package/node_modules/typebox/build/system/system.d.mts +6 -0
  513. package/node_modules/typebox/build/system/system.mjs +6 -0
  514. package/node_modules/typebox/build/system/unreachable/index.d.mts +1 -0
  515. package/node_modules/typebox/build/system/unreachable/index.mjs +1 -0
  516. package/node_modules/typebox/build/system/unreachable/unreachable.d.mts +3 -0
  517. package/node_modules/typebox/build/system/unreachable/unreachable.mjs +6 -0
  518. package/node_modules/typebox/build/type/action/_add_immutable.d.mts +11 -0
  519. package/node_modules/typebox/build/type/action/_add_immutable.mjs +11 -0
  520. package/node_modules/typebox/build/type/action/_add_optional.d.mts +11 -0
  521. package/node_modules/typebox/build/type/action/_add_optional.mjs +11 -0
  522. package/node_modules/typebox/build/type/action/_add_readonly.d.mts +11 -0
  523. package/node_modules/typebox/build/type/action/_add_readonly.mjs +11 -0
  524. package/node_modules/typebox/build/type/action/_remove_immutable.d.mts +11 -0
  525. package/node_modules/typebox/build/type/action/_remove_immutable.mjs +11 -0
  526. package/node_modules/typebox/build/type/action/_remove_optional.d.mts +11 -0
  527. package/node_modules/typebox/build/type/action/_remove_optional.mjs +11 -0
  528. package/node_modules/typebox/build/type/action/_remove_readonly.d.mts +11 -0
  529. package/node_modules/typebox/build/type/action/_remove_readonly.mjs +11 -0
  530. package/node_modules/typebox/build/type/action/capitalize.d.mts +11 -0
  531. package/node_modules/typebox/build/type/action/capitalize.mjs +11 -0
  532. package/node_modules/typebox/build/type/action/conditional.d.mts +12 -0
  533. package/node_modules/typebox/build/type/action/conditional.mjs +13 -0
  534. package/node_modules/typebox/build/type/action/constructor_parameters.d.mts +11 -0
  535. package/node_modules/typebox/build/type/action/constructor_parameters.mjs +11 -0
  536. package/node_modules/typebox/build/type/action/evaluate.d.mts +11 -0
  537. package/node_modules/typebox/build/type/action/evaluate.mjs +11 -0
  538. package/node_modules/typebox/build/type/action/exclude.d.mts +11 -0
  539. package/node_modules/typebox/build/type/action/exclude.mjs +11 -0
  540. package/node_modules/typebox/build/type/action/extract.d.mts +11 -0
  541. package/node_modules/typebox/build/type/action/extract.mjs +11 -0
  542. package/node_modules/typebox/build/type/action/index.d.mts +30 -0
  543. package/node_modules/typebox/build/type/action/index.mjs +30 -0
  544. package/node_modules/typebox/build/type/action/indexed.d.mts +14 -0
  545. package/node_modules/typebox/build/type/action/indexed.mjs +14 -0
  546. package/node_modules/typebox/build/type/action/instance_type.d.mts +11 -0
  547. package/node_modules/typebox/build/type/action/instance_type.mjs +11 -0
  548. package/node_modules/typebox/build/type/action/interface.d.mts +14 -0
  549. package/node_modules/typebox/build/type/action/interface.mjs +22 -0
  550. package/node_modules/typebox/build/type/action/keyof.d.mts +11 -0
  551. package/node_modules/typebox/build/type/action/keyof.mjs +11 -0
  552. package/node_modules/typebox/build/type/action/lowercase.d.mts +11 -0
  553. package/node_modules/typebox/build/type/action/lowercase.mjs +11 -0
  554. package/node_modules/typebox/build/type/action/mapped.d.mts +13 -0
  555. package/node_modules/typebox/build/type/action/mapped.mjs +13 -0
  556. package/node_modules/typebox/build/type/action/module.d.mts +13 -0
  557. package/node_modules/typebox/build/type/action/module.mjs +13 -0
  558. package/node_modules/typebox/build/type/action/non_nullable.d.mts +11 -0
  559. package/node_modules/typebox/build/type/action/non_nullable.mjs +11 -0
  560. package/node_modules/typebox/build/type/action/omit.d.mts +14 -0
  561. package/node_modules/typebox/build/type/action/omit.mjs +14 -0
  562. package/node_modules/typebox/build/type/action/parameters.d.mts +11 -0
  563. package/node_modules/typebox/build/type/action/parameters.mjs +11 -0
  564. package/node_modules/typebox/build/type/action/partial.d.mts +11 -0
  565. package/node_modules/typebox/build/type/action/partial.mjs +11 -0
  566. package/node_modules/typebox/build/type/action/pick.d.mts +14 -0
  567. package/node_modules/typebox/build/type/action/pick.mjs +14 -0
  568. package/node_modules/typebox/build/type/action/readonly_object.d.mts +16 -0
  569. package/node_modules/typebox/build/type/action/readonly_object.mjs +19 -0
  570. package/node_modules/typebox/build/type/action/required.d.mts +11 -0
  571. package/node_modules/typebox/build/type/action/required.mjs +11 -0
  572. package/node_modules/typebox/build/type/action/return_type.d.mts +11 -0
  573. package/node_modules/typebox/build/type/action/return_type.mjs +11 -0
  574. package/node_modules/typebox/build/type/action/uncapitalize.d.mts +11 -0
  575. package/node_modules/typebox/build/type/action/uncapitalize.mjs +11 -0
  576. package/node_modules/typebox/build/type/action/uppercase.d.mts +11 -0
  577. package/node_modules/typebox/build/type/action/uppercase.mjs +11 -0
  578. package/node_modules/typebox/build/type/action/with.d.mts +11 -0
  579. package/node_modules/typebox/build/type/action/with.mjs +11 -0
  580. package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +15 -0
  581. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +53 -0
  582. package/node_modules/typebox/build/type/engine/call/instantiate.d.mts +21 -0
  583. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +49 -0
  584. package/node_modules/typebox/build/type/engine/call/resolve_arguments.d.mts +13 -0
  585. package/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs +33 -0
  586. package/node_modules/typebox/build/type/engine/call/resolve_target.d.mts +25 -0
  587. package/node_modules/typebox/build/type/engine/call/resolve_target.mjs +27 -0
  588. package/node_modules/typebox/build/type/engine/conditional/index.d.mts +1 -0
  589. package/node_modules/typebox/build/type/engine/conditional/index.mjs +1 -0
  590. package/node_modules/typebox/build/type/engine/conditional/instantiate.d.mts +12 -0
  591. package/node_modules/typebox/build/type/engine/conditional/instantiate.mjs +23 -0
  592. package/node_modules/typebox/build/type/engine/constructor_parameters/index.d.mts +1 -0
  593. package/node_modules/typebox/build/type/engine/constructor_parameters/index.mjs +1 -0
  594. package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.d.mts +14 -0
  595. package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs +25 -0
  596. package/node_modules/typebox/build/type/engine/cyclic/candidates.d.mts +8 -0
  597. package/node_modules/typebox/build/type/engine/cyclic/candidates.mjs +16 -0
  598. package/node_modules/typebox/build/type/engine/cyclic/check.d.mts +21 -0
  599. package/node_modules/typebox/build/type/engine/cyclic/check.mjs +45 -0
  600. package/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +22 -0
  601. package/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +47 -0
  602. package/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +28 -0
  603. package/node_modules/typebox/build/type/engine/cyclic/extends.mjs +47 -0
  604. package/node_modules/typebox/build/type/engine/cyclic/index.d.mts +6 -0
  605. package/node_modules/typebox/build/type/engine/cyclic/index.mjs +6 -0
  606. package/node_modules/typebox/build/type/engine/cyclic/instantiate.d.mts +17 -0
  607. package/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs +31 -0
  608. package/node_modules/typebox/build/type/engine/cyclic/target.d.mts +10 -0
  609. package/node_modules/typebox/build/type/engine/cyclic/target.mjs +16 -0
  610. package/node_modules/typebox/build/type/engine/enum/index.d.mts +1 -0
  611. package/node_modules/typebox/build/type/engine/enum/index.mjs +1 -0
  612. package/node_modules/typebox/build/type/engine/enum/typescript_enum_to_enum_values.d.mts +8 -0
  613. package/node_modules/typebox/build/type/engine/enum/typescript_enum_to_enum_values.mjs +9 -0
  614. package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +15 -0
  615. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +43 -0
  616. package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +15 -0
  617. package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +22 -0
  618. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +34 -0
  619. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +67 -0
  620. package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +28 -0
  621. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +45 -0
  622. package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +26 -0
  623. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +53 -0
  624. package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +6 -0
  625. package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +11 -0
  626. package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +8 -0
  627. package/node_modules/typebox/build/type/engine/evaluate/index.mjs +8 -0
  628. package/node_modules/typebox/build/type/engine/evaluate/instantiate.d.mts +8 -0
  629. package/node_modules/typebox/build/type/engine/evaluate/instantiate.mjs +12 -0
  630. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -0
  631. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +11 -0
  632. package/node_modules/typebox/build/type/engine/exclude/index.d.mts +1 -0
  633. package/node_modules/typebox/build/type/engine/exclude/index.mjs +1 -0
  634. package/node_modules/typebox/build/type/engine/exclude/instantiate.d.mts +9 -0
  635. package/node_modules/typebox/build/type/engine/exclude/instantiate.mjs +16 -0
  636. package/node_modules/typebox/build/type/engine/exclude/operation.d.mts +10 -0
  637. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +23 -0
  638. package/node_modules/typebox/build/type/engine/extract/index.d.mts +1 -0
  639. package/node_modules/typebox/build/type/engine/extract/index.mjs +1 -0
  640. package/node_modules/typebox/build/type/engine/extract/instantiate.d.mts +9 -0
  641. package/node_modules/typebox/build/type/engine/extract/instantiate.mjs +16 -0
  642. package/node_modules/typebox/build/type/engine/extract/operation.d.mts +10 -0
  643. package/node_modules/typebox/build/type/engine/extract/operation.mjs +23 -0
  644. package/node_modules/typebox/build/type/engine/helpers/index.d.mts +3 -0
  645. package/node_modules/typebox/build/type/engine/helpers/index.mjs +3 -0
  646. package/node_modules/typebox/build/type/engine/helpers/keys.d.mts +3 -0
  647. package/node_modules/typebox/build/type/engine/helpers/keys.mjs +8 -0
  648. package/node_modules/typebox/build/type/engine/helpers/keys_to_indexer.d.mts +7 -0
  649. package/node_modules/typebox/build/type/engine/helpers/keys_to_indexer.mjs +15 -0
  650. package/node_modules/typebox/build/type/engine/helpers/union.d.mts +7 -0
  651. package/node_modules/typebox/build/type/engine/helpers/union.mjs +3 -0
  652. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +10 -0
  653. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +14 -0
  654. package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.d.mts +10 -0
  655. package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs +14 -0
  656. package/node_modules/typebox/build/type/engine/index.d.mts +31 -0
  657. package/node_modules/typebox/build/type/engine/index.mjs +37 -0
  658. package/node_modules/typebox/build/type/engine/indexable/from_cyclic.d.mts +6 -0
  659. package/node_modules/typebox/build/type/engine/indexable/from_cyclic.mjs +8 -0
  660. package/node_modules/typebox/build/type/engine/indexable/from_dependent.d.mts +5 -0
  661. package/node_modules/typebox/build/type/engine/indexable/from_dependent.mjs +8 -0
  662. package/node_modules/typebox/build/type/engine/indexable/from_enum.d.mts +6 -0
  663. package/node_modules/typebox/build/type/engine/indexable/from_enum.mjs +8 -0
  664. package/node_modules/typebox/build/type/engine/indexable/from_intersect.d.mts +5 -0
  665. package/node_modules/typebox/build/type/engine/indexable/from_intersect.mjs +8 -0
  666. package/node_modules/typebox/build/type/engine/indexable/from_literal.d.mts +3 -0
  667. package/node_modules/typebox/build/type/engine/indexable/from_literal.mjs +5 -0
  668. package/node_modules/typebox/build/type/engine/indexable/from_template_literal.d.mts +5 -0
  669. package/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs +8 -0
  670. package/node_modules/typebox/build/type/engine/indexable/from_type.d.mts +19 -0
  671. package/node_modules/typebox/build/type/engine/indexable/from_type.mjs +25 -0
  672. package/node_modules/typebox/build/type/engine/indexable/from_union.d.mts +4 -0
  673. package/node_modules/typebox/build/type/engine/indexable/from_union.mjs +7 -0
  674. package/node_modules/typebox/build/type/engine/indexable/to_indexable.d.mts +9 -0
  675. package/node_modules/typebox/build/type/engine/indexable/to_indexable.mjs +14 -0
  676. package/node_modules/typebox/build/type/engine/indexable/to_indexable_keys.d.mts +10 -0
  677. package/node_modules/typebox/build/type/engine/indexable/to_indexable_keys.mjs +12 -0
  678. package/node_modules/typebox/build/type/engine/indexed/array_indexer.d.mts +12 -0
  679. package/node_modules/typebox/build/type/engine/indexed/array_indexer.mjs +18 -0
  680. package/node_modules/typebox/build/type/engine/indexed/from_array.d.mts +15 -0
  681. package/node_modules/typebox/build/type/engine/indexed/from_array.mjs +35 -0
  682. package/node_modules/typebox/build/type/engine/indexed/from_object.d.mts +16 -0
  683. package/node_modules/typebox/build/type/engine/indexed/from_object.mjs +40 -0
  684. package/node_modules/typebox/build/type/engine/indexed/from_tuple.d.mts +13 -0
  685. package/node_modules/typebox/build/type/engine/indexed/from_tuple.mjs +35 -0
  686. package/node_modules/typebox/build/type/engine/indexed/from_type.d.mts +11 -0
  687. package/node_modules/typebox/build/type/engine/indexed/from_type.mjs +14 -0
  688. package/node_modules/typebox/build/type/engine/indexed/index.d.mts +1 -0
  689. package/node_modules/typebox/build/type/engine/indexed/index.mjs +1 -0
  690. package/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +16 -0
  691. package/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +28 -0
  692. package/node_modules/typebox/build/type/engine/instance_type/index.d.mts +1 -0
  693. package/node_modules/typebox/build/type/engine/instance_type/index.mjs +1 -0
  694. package/node_modules/typebox/build/type/engine/instance_type/instantiate.d.mts +12 -0
  695. package/node_modules/typebox/build/type/engine/instance_type/instantiate.mjs +21 -0
  696. package/node_modules/typebox/build/type/engine/instantiate.d.mts +178 -0
  697. package/node_modules/typebox/build/type/engine/instantiate.mjs +158 -0
  698. package/node_modules/typebox/build/type/engine/interface/index.d.mts +1 -0
  699. package/node_modules/typebox/build/type/engine/interface/index.mjs +1 -0
  700. package/node_modules/typebox/build/type/engine/interface/instantiate.d.mts +15 -0
  701. package/node_modules/typebox/build/type/engine/interface/instantiate.mjs +23 -0
  702. package/node_modules/typebox/build/type/engine/intrinsics/from_literal.d.mts +5 -0
  703. package/node_modules/typebox/build/type/engine/intrinsics/from_literal.mjs +9 -0
  704. package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.d.mts +6 -0
  705. package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs +8 -0
  706. package/node_modules/typebox/build/type/engine/intrinsics/from_type.d.mts +10 -0
  707. package/node_modules/typebox/build/type/engine/intrinsics/from_type.mjs +13 -0
  708. package/node_modules/typebox/build/type/engine/intrinsics/from_union.d.mts +6 -0
  709. package/node_modules/typebox/build/type/engine/intrinsics/from_union.mjs +7 -0
  710. package/node_modules/typebox/build/type/engine/intrinsics/index.d.mts +1 -0
  711. package/node_modules/typebox/build/type/engine/intrinsics/index.mjs +1 -0
  712. package/node_modules/typebox/build/type/engine/intrinsics/instantiate.d.mts +38 -0
  713. package/node_modules/typebox/build/type/engine/intrinsics/instantiate.mjs +52 -0
  714. package/node_modules/typebox/build/type/engine/intrinsics/mapping.d.mts +9 -0
  715. package/node_modules/typebox/build/type/engine/intrinsics/mapping.mjs +4 -0
  716. package/node_modules/typebox/build/type/engine/keyof/from_any.d.mts +6 -0
  717. package/node_modules/typebox/build/type/engine/keyof/from_any.mjs +8 -0
  718. package/node_modules/typebox/build/type/engine/keyof/from_array.d.mts +4 -0
  719. package/node_modules/typebox/build/type/engine/keyof/from_array.mjs +5 -0
  720. package/node_modules/typebox/build/type/engine/keyof/from_object.d.mts +10 -0
  721. package/node_modules/typebox/build/type/engine/keyof/from_object.mjs +20 -0
  722. package/node_modules/typebox/build/type/engine/keyof/from_record.d.mts +4 -0
  723. package/node_modules/typebox/build/type/engine/keyof/from_record.mjs +5 -0
  724. package/node_modules/typebox/build/type/engine/keyof/from_tuple.d.mts +5 -0
  725. package/node_modules/typebox/build/type/engine/keyof/from_tuple.mjs +7 -0
  726. package/node_modules/typebox/build/type/engine/keyof/from_type.d.mts +15 -0
  727. package/node_modules/typebox/build/type/engine/keyof/from_type.mjs +23 -0
  728. package/node_modules/typebox/build/type/engine/keyof/index.d.mts +1 -0
  729. package/node_modules/typebox/build/type/engine/keyof/index.mjs +1 -0
  730. package/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +16 -0
  731. package/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +29 -0
  732. package/node_modules/typebox/build/type/engine/mapped/index.d.mts +1 -0
  733. package/node_modules/typebox/build/type/engine/mapped/index.mjs +1 -0
  734. package/node_modules/typebox/build/type/engine/mapped/instantiate.d.mts +10 -0
  735. package/node_modules/typebox/build/type/engine/mapped/instantiate.mjs +15 -0
  736. package/node_modules/typebox/build/type/engine/mapped/mapped_operation.d.mts +22 -0
  737. package/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs +42 -0
  738. package/node_modules/typebox/build/type/engine/mapped/mapped_variants.d.mts +17 -0
  739. package/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs +39 -0
  740. package/node_modules/typebox/build/type/engine/module/index.d.mts +1 -0
  741. package/node_modules/typebox/build/type/engine/module/index.mjs +1 -0
  742. package/node_modules/typebox/build/type/engine/module/instantiate.d.mts +19 -0
  743. package/node_modules/typebox/build/type/engine/module/instantiate.mjs +36 -0
  744. package/node_modules/typebox/build/type/engine/non_nullable/index.d.mts +1 -0
  745. package/node_modules/typebox/build/type/engine/non_nullable/index.mjs +1 -0
  746. package/node_modules/typebox/build/type/engine/non_nullable/instantiate.d.mts +14 -0
  747. package/node_modules/typebox/build/type/engine/non_nullable/instantiate.mjs +22 -0
  748. package/node_modules/typebox/build/type/engine/object/collapse.d.mts +12 -0
  749. package/node_modules/typebox/build/type/engine/object/collapse.mjs +14 -0
  750. package/node_modules/typebox/build/type/engine/object/from_cyclic.d.mts +6 -0
  751. package/node_modules/typebox/build/type/engine/object/from_cyclic.mjs +8 -0
  752. package/node_modules/typebox/build/type/engine/object/from_dependent.d.mts +5 -0
  753. package/node_modules/typebox/build/type/engine/object/from_dependent.mjs +8 -0
  754. package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +17 -0
  755. package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +22 -0
  756. package/node_modules/typebox/build/type/engine/object/from_object.d.mts +3 -0
  757. package/node_modules/typebox/build/type/engine/object/from_object.mjs +4 -0
  758. package/node_modules/typebox/build/type/engine/object/from_tuple.d.mts +6 -0
  759. package/node_modules/typebox/build/type/engine/object/from_tuple.mjs +9 -0
  760. package/node_modules/typebox/build/type/engine/object/from_type.d.mts +16 -0
  761. package/node_modules/typebox/build/type/engine/object/from_type.mjs +23 -0
  762. package/node_modules/typebox/build/type/engine/object/from_union.d.mts +12 -0
  763. package/node_modules/typebox/build/type/engine/object/from_union.mjs +19 -0
  764. package/node_modules/typebox/build/type/engine/object/index.d.mts +1 -0
  765. package/node_modules/typebox/build/type/engine/object/index.mjs +1 -0
  766. package/node_modules/typebox/build/type/engine/omit/from_type.d.mts +12 -0
  767. package/node_modules/typebox/build/type/engine/omit/from_type.mjs +18 -0
  768. package/node_modules/typebox/build/type/engine/omit/index.d.mts +1 -0
  769. package/node_modules/typebox/build/type/engine/omit/index.mjs +1 -0
  770. package/node_modules/typebox/build/type/engine/omit/instantiate.d.mts +9 -0
  771. package/node_modules/typebox/build/type/engine/omit/instantiate.mjs +16 -0
  772. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +10 -0
  773. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +14 -0
  774. package/node_modules/typebox/build/type/engine/optional/instantiate_remove.d.mts +10 -0
  775. package/node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs +14 -0
  776. package/node_modules/typebox/build/type/engine/parameters/index.d.mts +1 -0
  777. package/node_modules/typebox/build/type/engine/parameters/index.mjs +1 -0
  778. package/node_modules/typebox/build/type/engine/parameters/instantiate.d.mts +14 -0
  779. package/node_modules/typebox/build/type/engine/parameters/instantiate.mjs +25 -0
  780. package/node_modules/typebox/build/type/engine/partial/from_cyclic.d.mts +10 -0
  781. package/node_modules/typebox/build/type/engine/partial/from_cyclic.mjs +11 -0
  782. package/node_modules/typebox/build/type/engine/partial/from_dependent.d.mts +5 -0
  783. package/node_modules/typebox/build/type/engine/partial/from_dependent.mjs +8 -0
  784. package/node_modules/typebox/build/type/engine/partial/from_intersect.d.mts +5 -0
  785. package/node_modules/typebox/build/type/engine/partial/from_intersect.mjs +8 -0
  786. package/node_modules/typebox/build/type/engine/partial/from_object.d.mts +8 -0
  787. package/node_modules/typebox/build/type/engine/partial/from_object.mjs +11 -0
  788. package/node_modules/typebox/build/type/engine/partial/from_type.d.mts +14 -0
  789. package/node_modules/typebox/build/type/engine/partial/from_type.mjs +20 -0
  790. package/node_modules/typebox/build/type/engine/partial/from_union.d.mts +5 -0
  791. package/node_modules/typebox/build/type/engine/partial/from_union.mjs +7 -0
  792. package/node_modules/typebox/build/type/engine/partial/index.d.mts +1 -0
  793. package/node_modules/typebox/build/type/engine/partial/index.mjs +1 -0
  794. package/node_modules/typebox/build/type/engine/partial/instantiate.d.mts +9 -0
  795. package/node_modules/typebox/build/type/engine/partial/instantiate.mjs +15 -0
  796. package/node_modules/typebox/build/type/engine/patterns/index.d.mts +2 -0
  797. package/node_modules/typebox/build/type/engine/patterns/index.mjs +2 -0
  798. package/node_modules/typebox/build/type/engine/patterns/pattern.d.mts +6 -0
  799. package/node_modules/typebox/build/type/engine/patterns/pattern.mjs +11 -0
  800. package/node_modules/typebox/build/type/engine/patterns/template.d.mts +7 -0
  801. package/node_modules/typebox/build/type/engine/patterns/template.mjs +20 -0
  802. package/node_modules/typebox/build/type/engine/pick/from_type.d.mts +13 -0
  803. package/node_modules/typebox/build/type/engine/pick/from_type.mjs +20 -0
  804. package/node_modules/typebox/build/type/engine/pick/index.d.mts +1 -0
  805. package/node_modules/typebox/build/type/engine/pick/index.mjs +1 -0
  806. package/node_modules/typebox/build/type/engine/pick/instantiate.d.mts +9 -0
  807. package/node_modules/typebox/build/type/engine/pick/instantiate.mjs +16 -0
  808. package/node_modules/typebox/build/type/engine/priority/index.d.mts +1 -0
  809. package/node_modules/typebox/build/type/engine/priority/index.mjs +1 -0
  810. package/node_modules/typebox/build/type/engine/priority/priority.d.mts +20 -0
  811. package/node_modules/typebox/build/type/engine/priority/priority.mjs +28 -0
  812. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +10 -0
  813. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +14 -0
  814. package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.d.mts +10 -0
  815. package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs +14 -0
  816. package/node_modules/typebox/build/type/engine/readonly_object/from_array.d.mts +5 -0
  817. package/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs +7 -0
  818. package/node_modules/typebox/build/type/engine/readonly_object/from_cyclic.d.mts +10 -0
  819. package/node_modules/typebox/build/type/engine/readonly_object/from_cyclic.mjs +11 -0
  820. package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.d.mts +5 -0
  821. package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs +8 -0
  822. package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.d.mts +5 -0
  823. package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs +8 -0
  824. package/node_modules/typebox/build/type/engine/readonly_object/from_object.d.mts +8 -0
  825. package/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs +11 -0
  826. package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.d.mts +5 -0
  827. package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs +7 -0
  828. package/node_modules/typebox/build/type/engine/readonly_object/from_type.d.mts +18 -0
  829. package/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs +25 -0
  830. package/node_modules/typebox/build/type/engine/readonly_object/from_union.d.mts +5 -0
  831. package/node_modules/typebox/build/type/engine/readonly_object/from_union.mjs +7 -0
  832. package/node_modules/typebox/build/type/engine/readonly_object/index.d.mts +1 -0
  833. package/node_modules/typebox/build/type/engine/readonly_object/index.mjs +1 -0
  834. package/node_modules/typebox/build/type/engine/readonly_object/instantiate.d.mts +9 -0
  835. package/node_modules/typebox/build/type/engine/readonly_object/instantiate.mjs +15 -0
  836. package/node_modules/typebox/build/type/engine/record/from_key.d.mts +24 -0
  837. package/node_modules/typebox/build/type/engine/record/from_key.mjs +40 -0
  838. package/node_modules/typebox/build/type/engine/record/from_key_any.d.mts +4 -0
  839. package/node_modules/typebox/build/type/engine/record/from_key_any.mjs +6 -0
  840. package/node_modules/typebox/build/type/engine/record/from_key_boolean.d.mts +7 -0
  841. package/node_modules/typebox/build/type/engine/record/from_key_boolean.mjs +5 -0
  842. package/node_modules/typebox/build/type/engine/record/from_key_enum.d.mts +6 -0
  843. package/node_modules/typebox/build/type/engine/record/from_key_enum.mjs +8 -0
  844. package/node_modules/typebox/build/type/engine/record/from_key_integer.d.mts +5 -0
  845. package/node_modules/typebox/build/type/engine/record/from_key_integer.mjs +7 -0
  846. package/node_modules/typebox/build/type/engine/record/from_key_intersect.d.mts +5 -0
  847. package/node_modules/typebox/build/type/engine/record/from_key_intersect.mjs +8 -0
  848. package/node_modules/typebox/build/type/engine/record/from_key_literal.d.mts +11 -0
  849. package/node_modules/typebox/build/type/engine/record/from_key_literal.mjs +10 -0
  850. package/node_modules/typebox/build/type/engine/record/from_key_number.d.mts +5 -0
  851. package/node_modules/typebox/build/type/engine/record/from_key_number.mjs +7 -0
  852. package/node_modules/typebox/build/type/engine/record/from_key_string.d.mts +5 -0
  853. package/node_modules/typebox/build/type/engine/record/from_key_string.mjs +12 -0
  854. package/node_modules/typebox/build/type/engine/record/from_key_template_literal.d.mts +8 -0
  855. package/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs +12 -0
  856. package/node_modules/typebox/build/type/engine/record/from_key_union.d.mts +20 -0
  857. package/node_modules/typebox/build/type/engine/record/from_key_union.mjs +39 -0
  858. package/node_modules/typebox/build/type/engine/record/index.d.mts +1 -0
  859. package/node_modules/typebox/build/type/engine/record/index.mjs +1 -0
  860. package/node_modules/typebox/build/type/engine/record/instantiate.d.mts +9 -0
  861. package/node_modules/typebox/build/type/engine/record/instantiate.mjs +17 -0
  862. package/node_modules/typebox/build/type/engine/record/record_create.d.mts +3 -0
  863. package/node_modules/typebox/build/type/engine/record/record_create.mjs +7 -0
  864. package/node_modules/typebox/build/type/engine/ref/index.d.mts +1 -0
  865. package/node_modules/typebox/build/type/engine/ref/index.mjs +1 -0
  866. package/node_modules/typebox/build/type/engine/ref/instantiate.d.mts +6 -0
  867. package/node_modules/typebox/build/type/engine/ref/instantiate.mjs +10 -0
  868. package/node_modules/typebox/build/type/engine/required/from_cyclic.d.mts +10 -0
  869. package/node_modules/typebox/build/type/engine/required/from_cyclic.mjs +11 -0
  870. package/node_modules/typebox/build/type/engine/required/from_dependent.d.mts +5 -0
  871. package/node_modules/typebox/build/type/engine/required/from_dependent.mjs +8 -0
  872. package/node_modules/typebox/build/type/engine/required/from_intersect.d.mts +5 -0
  873. package/node_modules/typebox/build/type/engine/required/from_intersect.mjs +8 -0
  874. package/node_modules/typebox/build/type/engine/required/from_object.d.mts +8 -0
  875. package/node_modules/typebox/build/type/engine/required/from_object.mjs +11 -0
  876. package/node_modules/typebox/build/type/engine/required/from_type.d.mts +14 -0
  877. package/node_modules/typebox/build/type/engine/required/from_type.mjs +20 -0
  878. package/node_modules/typebox/build/type/engine/required/from_union.d.mts +5 -0
  879. package/node_modules/typebox/build/type/engine/required/from_union.mjs +7 -0
  880. package/node_modules/typebox/build/type/engine/required/index.d.mts +1 -0
  881. package/node_modules/typebox/build/type/engine/required/index.mjs +1 -0
  882. package/node_modules/typebox/build/type/engine/required/instantiate.d.mts +9 -0
  883. package/node_modules/typebox/build/type/engine/required/instantiate.mjs +15 -0
  884. package/node_modules/typebox/build/type/engine/rest/index.d.mts +1 -0
  885. package/node_modules/typebox/build/type/engine/rest/index.mjs +1 -0
  886. package/node_modules/typebox/build/type/engine/rest/spread.d.mts +12 -0
  887. package/node_modules/typebox/build/type/engine/rest/spread.mjs +19 -0
  888. package/node_modules/typebox/build/type/engine/return_type/index.d.mts +1 -0
  889. package/node_modules/typebox/build/type/engine/return_type/index.mjs +1 -0
  890. package/node_modules/typebox/build/type/engine/return_type/instantiate.d.mts +12 -0
  891. package/node_modules/typebox/build/type/engine/return_type/instantiate.mjs +21 -0
  892. package/node_modules/typebox/build/type/engine/template_literal/create.d.mts +1 -0
  893. package/node_modules/typebox/build/type/engine/template_literal/create.mjs +5 -0
  894. package/node_modules/typebox/build/type/engine/template_literal/decode.d.mts +30 -0
  895. package/node_modules/typebox/build/type/engine/template_literal/decode.mjs +81 -0
  896. package/node_modules/typebox/build/type/engine/template_literal/encode.d.mts +33 -0
  897. package/node_modules/typebox/build/type/engine/template_literal/encode.mjs +81 -0
  898. package/node_modules/typebox/build/type/engine/template_literal/index.d.mts +6 -0
  899. package/node_modules/typebox/build/type/engine/template_literal/index.mjs +6 -0
  900. package/node_modules/typebox/build/type/engine/template_literal/instantiate.d.mts +9 -0
  901. package/node_modules/typebox/build/type/engine/template_literal/instantiate.mjs +15 -0
  902. package/node_modules/typebox/build/type/engine/template_literal/is_finite.d.mts +12 -0
  903. package/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs +26 -0
  904. package/node_modules/typebox/build/type/engine/template_literal/is_pattern.d.mts +6 -0
  905. package/node_modules/typebox/build/type/engine/template_literal/is_pattern.mjs +10 -0
  906. package/node_modules/typebox/build/type/engine/template_literal/static.d.mts +18 -0
  907. package/node_modules/typebox/build/type/engine/template_literal/static.mjs +2 -0
  908. package/node_modules/typebox/build/type/engine/this/expand_this.d.mts +16 -0
  909. package/node_modules/typebox/build/type/engine/this/expand_this.mjs +26 -0
  910. package/node_modules/typebox/build/type/engine/tuple/to_object.d.mts +12 -0
  911. package/node_modules/typebox/build/type/engine/tuple/to_object.mjs +14 -0
  912. package/node_modules/typebox/build/type/engine/with/index.d.mts +1 -0
  913. package/node_modules/typebox/build/type/engine/with/index.mjs +1 -0
  914. package/node_modules/typebox/build/type/engine/with/instantiate.d.mts +8 -0
  915. package/node_modules/typebox/build/type/engine/with/instantiate.mjs +14 -0
  916. package/node_modules/typebox/build/type/extends/any.d.mts +9 -0
  917. package/node_modules/typebox/build/type/extends/any.mjs +12 -0
  918. package/node_modules/typebox/build/type/extends/array.d.mts +20 -0
  919. package/node_modules/typebox/build/type/extends/array.mjs +21 -0
  920. package/node_modules/typebox/build/type/extends/bigint.d.mts +7 -0
  921. package/node_modules/typebox/build/type/extends/bigint.mjs +9 -0
  922. package/node_modules/typebox/build/type/extends/boolean.d.mts +7 -0
  923. package/node_modules/typebox/build/type/extends/boolean.mjs +9 -0
  924. package/node_modules/typebox/build/type/extends/constructor.d.mts +10 -0
  925. package/node_modules/typebox/build/type/extends/constructor.mjs +17 -0
  926. package/node_modules/typebox/build/type/extends/dependent.d.mts +6 -0
  927. package/node_modules/typebox/build/type/extends/dependent.mjs +6 -0
  928. package/node_modules/typebox/build/type/extends/enum.d.mts +7 -0
  929. package/node_modules/typebox/build/type/extends/enum.mjs +7 -0
  930. package/node_modules/typebox/build/type/extends/extends.d.mts +13 -0
  931. package/node_modules/typebox/build/type/extends/extends.mjs +17 -0
  932. package/node_modules/typebox/build/type/extends/extends_left.d.mts +53 -0
  933. package/node_modules/typebox/build/type/extends/extends_left.mjs +80 -0
  934. package/node_modules/typebox/build/type/extends/extends_right.d.mts +27 -0
  935. package/node_modules/typebox/build/type/extends/extends_right.mjs +49 -0
  936. package/node_modules/typebox/build/type/extends/function.d.mts +10 -0
  937. package/node_modules/typebox/build/type/extends/function.mjs +17 -0
  938. package/node_modules/typebox/build/type/extends/index.d.mts +2 -0
  939. package/node_modules/typebox/build/type/extends/index.mjs +2 -0
  940. package/node_modules/typebox/build/type/extends/inference.d.mts +34 -0
  941. package/node_modules/typebox/build/type/extends/inference.mjs +62 -0
  942. package/node_modules/typebox/build/type/extends/integer.d.mts +8 -0
  943. package/node_modules/typebox/build/type/extends/integer.mjs +10 -0
  944. package/node_modules/typebox/build/type/extends/intersect.d.mts +6 -0
  945. package/node_modules/typebox/build/type/extends/intersect.mjs +15 -0
  946. package/node_modules/typebox/build/type/extends/literal.d.mts +18 -0
  947. package/node_modules/typebox/build/type/extends/literal.mjs +44 -0
  948. package/node_modules/typebox/build/type/extends/never.d.mts +8 -0
  949. package/node_modules/typebox/build/type/extends/never.mjs +9 -0
  950. package/node_modules/typebox/build/type/extends/null.d.mts +7 -0
  951. package/node_modules/typebox/build/type/extends/null.mjs +9 -0
  952. package/node_modules/typebox/build/type/extends/number.d.mts +7 -0
  953. package/node_modules/typebox/build/type/extends/number.mjs +9 -0
  954. package/node_modules/typebox/build/type/extends/object.d.mts +32 -0
  955. package/node_modules/typebox/build/type/extends/object.mjs +109 -0
  956. package/node_modules/typebox/build/type/extends/parameters.d.mts +15 -0
  957. package/node_modules/typebox/build/type/extends/parameters.mjs +28 -0
  958. package/node_modules/typebox/build/type/extends/record.d.mts +13 -0
  959. package/node_modules/typebox/build/type/extends/record.mjs +23 -0
  960. package/node_modules/typebox/build/type/extends/result.d.mts +24 -0
  961. package/node_modules/typebox/build/type/extends/result.mjs +36 -0
  962. package/node_modules/typebox/build/type/extends/return_type.d.mts +7 -0
  963. package/node_modules/typebox/build/type/extends/return_type.mjs +9 -0
  964. package/node_modules/typebox/build/type/extends/string.d.mts +7 -0
  965. package/node_modules/typebox/build/type/extends/string.mjs +9 -0
  966. package/node_modules/typebox/build/type/extends/symbol.d.mts +7 -0
  967. package/node_modules/typebox/build/type/extends/symbol.mjs +9 -0
  968. package/node_modules/typebox/build/type/extends/template_literal.d.mts +6 -0
  969. package/node_modules/typebox/build/type/extends/template_literal.mjs +7 -0
  970. package/node_modules/typebox/build/type/extends/tuple.d.mts +22 -0
  971. package/node_modules/typebox/build/type/extends/tuple.mjs +61 -0
  972. package/node_modules/typebox/build/type/extends/undefined.d.mts +8 -0
  973. package/node_modules/typebox/build/type/extends/undefined.mjs +10 -0
  974. package/node_modules/typebox/build/type/extends/union.d.mts +11 -0
  975. package/node_modules/typebox/build/type/extends/union.mjs +24 -0
  976. package/node_modules/typebox/build/type/extends/unknown.d.mts +9 -0
  977. package/node_modules/typebox/build/type/extends/unknown.mjs +12 -0
  978. package/node_modules/typebox/build/type/extends/void.d.mts +7 -0
  979. package/node_modules/typebox/build/type/extends/void.mjs +9 -0
  980. package/node_modules/typebox/build/type/index.d.mts +5 -0
  981. package/node_modules/typebox/build/type/index.mjs +5 -0
  982. package/node_modules/typebox/build/type/script/index.d.mts +1 -0
  983. package/node_modules/typebox/build/type/script/index.mjs +1 -0
  984. package/node_modules/typebox/build/type/script/mapping.d.mts +353 -0
  985. package/node_modules/typebox/build/type/script/mapping.mjs +535 -0
  986. package/node_modules/typebox/build/type/script/parser.d.mts +262 -0
  987. package/node_modules/typebox/build/type/script/parser.mjs +136 -0
  988. package/node_modules/typebox/build/type/script/script.d.mts +16 -0
  989. package/node_modules/typebox/build/type/script/script.mjs +22 -0
  990. package/node_modules/typebox/build/type/script/token/bigint.d.mts +8 -0
  991. package/node_modules/typebox/build/type/script/token/bigint.mjs +14 -0
  992. package/node_modules/typebox/build/type/script/token/const.d.mts +11 -0
  993. package/node_modules/typebox/build/type/script/token/const.mjs +18 -0
  994. package/node_modules/typebox/build/type/script/token/ident.d.mts +16 -0
  995. package/node_modules/typebox/build/type/script/token/ident.mjs +26 -0
  996. package/node_modules/typebox/build/type/script/token/index.d.mts +12 -0
  997. package/node_modules/typebox/build/type/script/token/index.mjs +12 -0
  998. package/node_modules/typebox/build/type/script/token/integer.d.mts +11 -0
  999. package/node_modules/typebox/build/type/script/token/integer.mjs +19 -0
  1000. package/node_modules/typebox/build/type/script/token/internal/char.d.mts +75 -0
  1001. package/node_modules/typebox/build/type/script/token/internal/char.mjs +26 -0
  1002. package/node_modules/typebox/build/type/script/token/internal/guard.d.mts +1 -0
  1003. package/node_modules/typebox/build/type/script/token/internal/guard.mjs +15 -0
  1004. package/node_modules/typebox/build/type/script/token/internal/many.d.mts +7 -0
  1005. package/node_modules/typebox/build/type/script/token/internal/many.mjs +14 -0
  1006. package/node_modules/typebox/build/type/script/token/internal/match.d.mts +6 -0
  1007. package/node_modules/typebox/build/type/script/token/internal/match.mjs +11 -0
  1008. package/node_modules/typebox/build/type/script/token/internal/optional.d.mts +5 -0
  1009. package/node_modules/typebox/build/type/script/token/internal/optional.mjs +9 -0
  1010. package/node_modules/typebox/build/type/script/token/internal/take.d.mts +6 -0
  1011. package/node_modules/typebox/build/type/script/token/internal/take.mjs +30 -0
  1012. package/node_modules/typebox/build/type/script/token/internal/trim.d.mts +19 -0
  1013. package/node_modules/typebox/build/type/script/token/internal/trim.mjs +34 -0
  1014. package/node_modules/typebox/build/type/script/token/number.d.mts +11 -0
  1015. package/node_modules/typebox/build/type/script/token/number.mjs +19 -0
  1016. package/node_modules/typebox/build/type/script/token/rest.d.mts +4 -0
  1017. package/node_modules/typebox/build/type/script/token/rest.mjs +9 -0
  1018. package/node_modules/typebox/build/type/script/token/span.d.mts +11 -0
  1019. package/node_modules/typebox/build/type/script/token/span.mjs +24 -0
  1020. package/node_modules/typebox/build/type/script/token/string.d.mts +11 -0
  1021. package/node_modules/typebox/build/type/script/token/string.mjs +20 -0
  1022. package/node_modules/typebox/build/type/script/token/unsigned_integer.d.mts +16 -0
  1023. package/node_modules/typebox/build/type/script/token/unsigned_integer.mjs +26 -0
  1024. package/node_modules/typebox/build/type/script/token/unsigned_number.d.mts +17 -0
  1025. package/node_modules/typebox/build/type/script/token/unsigned_number.mjs +38 -0
  1026. package/node_modules/typebox/build/type/script/token/until.d.mts +7 -0
  1027. package/node_modules/typebox/build/type/script/token/until.mjs +21 -0
  1028. package/node_modules/typebox/build/type/script/token/until_1.d.mts +5 -0
  1029. package/node_modules/typebox/build/type/script/token/until_1.mjs +12 -0
  1030. package/node_modules/typebox/build/type/types/_codec.d.mts +30 -0
  1031. package/node_modules/typebox/build/type/types/_codec.mjs +60 -0
  1032. package/node_modules/typebox/build/type/types/_immutable.d.mts +9 -0
  1033. package/node_modules/typebox/build/type/types/_immutable.mjs +18 -0
  1034. package/node_modules/typebox/build/type/types/_optional.d.mts +9 -0
  1035. package/node_modules/typebox/build/type/types/_optional.mjs +18 -0
  1036. package/node_modules/typebox/build/type/types/_readonly.d.mts +9 -0
  1037. package/node_modules/typebox/build/type/types/_readonly.mjs +18 -0
  1038. package/node_modules/typebox/build/type/types/_refine.d.mts +24 -0
  1039. package/node_modules/typebox/build/type/types/_refine.mjs +36 -0
  1040. package/node_modules/typebox/build/type/types/any.d.mts +10 -0
  1041. package/node_modules/typebox/build/type/types/any.mjs +18 -0
  1042. package/node_modules/typebox/build/type/types/array.d.mts +18 -0
  1043. package/node_modules/typebox/build/type/types/array.mjs +25 -0
  1044. package/node_modules/typebox/build/type/types/bigint.d.mts +12 -0
  1045. package/node_modules/typebox/build/type/types/bigint.mjs +21 -0
  1046. package/node_modules/typebox/build/type/types/boolean.d.mts +11 -0
  1047. package/node_modules/typebox/build/type/types/boolean.mjs +17 -0
  1048. package/node_modules/typebox/build/type/types/call.d.mts +16 -0
  1049. package/node_modules/typebox/build/type/types/call.mjs +23 -0
  1050. package/node_modules/typebox/build/type/types/constructor.d.mts +18 -0
  1051. package/node_modules/typebox/build/type/types/constructor.mjs +24 -0
  1052. package/node_modules/typebox/build/type/types/cyclic.d.mts +16 -0
  1053. package/node_modules/typebox/build/type/types/cyclic.mjs +29 -0
  1054. package/node_modules/typebox/build/type/types/deferred.d.mts +13 -0
  1055. package/node_modules/typebox/build/type/types/deferred.mjs +16 -0
  1056. package/node_modules/typebox/build/type/types/dependent.d.mts +17 -0
  1057. package/node_modules/typebox/build/type/types/dependent.mjs +24 -0
  1058. package/node_modules/typebox/build/type/types/enum.d.mts +18 -0
  1059. package/node_modules/typebox/build/type/types/enum.mjs +22 -0
  1060. package/node_modules/typebox/build/type/types/function.d.mts +21 -0
  1061. package/node_modules/typebox/build/type/types/function.mjs +25 -0
  1062. package/node_modules/typebox/build/type/types/generic.d.mts +13 -0
  1063. package/node_modules/typebox/build/type/types/generic.mjs +17 -0
  1064. package/node_modules/typebox/build/type/types/identifier.d.mts +11 -0
  1065. package/node_modules/typebox/build/type/types/identifier.mjs +17 -0
  1066. package/node_modules/typebox/build/type/types/index.d.mts +45 -0
  1067. package/node_modules/typebox/build/type/types/index.mjs +51 -0
  1068. package/node_modules/typebox/build/type/types/infer.d.mts +15 -0
  1069. package/node_modules/typebox/build/type/types/infer.mjs +20 -0
  1070. package/node_modules/typebox/build/type/types/integer.d.mts +12 -0
  1071. package/node_modules/typebox/build/type/types/integer.mjs +21 -0
  1072. package/node_modules/typebox/build/type/types/intersect.d.mts +15 -0
  1073. package/node_modules/typebox/build/type/types/intersect.mjs +24 -0
  1074. package/node_modules/typebox/build/type/types/literal.d.mts +31 -0
  1075. package/node_modules/typebox/build/type/types/literal.mjs +62 -0
  1076. package/node_modules/typebox/build/type/types/never.d.mts +12 -0
  1077. package/node_modules/typebox/build/type/types/never.mjs +22 -0
  1078. package/node_modules/typebox/build/type/types/null.d.mts +11 -0
  1079. package/node_modules/typebox/build/type/types/null.mjs +17 -0
  1080. package/node_modules/typebox/build/type/types/number.d.mts +12 -0
  1081. package/node_modules/typebox/build/type/types/number.mjs +21 -0
  1082. package/node_modules/typebox/build/type/types/object.d.mts +18 -0
  1083. package/node_modules/typebox/build/type/types/object.mjs +28 -0
  1084. package/node_modules/typebox/build/type/types/parameter.d.mts +17 -0
  1085. package/node_modules/typebox/build/type/types/parameter.mjs +21 -0
  1086. package/node_modules/typebox/build/type/types/properties.d.mts +43 -0
  1087. package/node_modules/typebox/build/type/types/properties.mjs +15 -0
  1088. package/node_modules/typebox/build/type/types/record.d.mts +52 -0
  1089. package/node_modules/typebox/build/type/types/record.mjs +66 -0
  1090. package/node_modules/typebox/build/type/types/ref.d.mts +19 -0
  1091. package/node_modules/typebox/build/type/types/ref.mjs +18 -0
  1092. package/node_modules/typebox/build/type/types/rest.d.mts +11 -0
  1093. package/node_modules/typebox/build/type/types/rest.mjs +17 -0
  1094. package/node_modules/typebox/build/type/types/schema.d.mts +176 -0
  1095. package/node_modules/typebox/build/type/types/schema.mjs +15 -0
  1096. package/node_modules/typebox/build/type/types/static.d.mts +45 -0
  1097. package/node_modules/typebox/build/type/types/static.mjs +3 -0
  1098. package/node_modules/typebox/build/type/types/string.d.mts +12 -0
  1099. package/node_modules/typebox/build/type/types/string.mjs +22 -0
  1100. package/node_modules/typebox/build/type/types/symbol.d.mts +11 -0
  1101. package/node_modules/typebox/build/type/types/symbol.mjs +17 -0
  1102. package/node_modules/typebox/build/type/types/template_literal.d.mts +28 -0
  1103. package/node_modules/typebox/build/type/types/template_literal.mjs +37 -0
  1104. package/node_modules/typebox/build/type/types/this.d.mts +14 -0
  1105. package/node_modules/typebox/build/type/types/this.mjs +17 -0
  1106. package/node_modules/typebox/build/type/types/tuple.d.mts +38 -0
  1107. package/node_modules/typebox/build/type/types/tuple.mjs +25 -0
  1108. package/node_modules/typebox/build/type/types/undefined.d.mts +11 -0
  1109. package/node_modules/typebox/build/type/types/undefined.mjs +17 -0
  1110. package/node_modules/typebox/build/type/types/union.d.mts +15 -0
  1111. package/node_modules/typebox/build/type/types/union.mjs +24 -0
  1112. package/node_modules/typebox/build/type/types/unknown.d.mts +10 -0
  1113. package/node_modules/typebox/build/type/types/unknown.mjs +17 -0
  1114. package/node_modules/typebox/build/type/types/unsafe.d.mts +10 -0
  1115. package/node_modules/typebox/build/type/types/unsafe.mjs +20 -0
  1116. package/node_modules/typebox/build/type/types/void.d.mts +11 -0
  1117. package/node_modules/typebox/build/type/types/void.mjs +17 -0
  1118. package/node_modules/typebox/build/typebox.d.mts +69 -0
  1119. package/node_modules/typebox/build/typebox.mjs +85 -0
  1120. package/node_modules/typebox/build/value/assert/assert.d.mts +14 -0
  1121. package/node_modules/typebox/build/value/assert/assert.mjs +28 -0
  1122. package/node_modules/typebox/build/value/assert/index.d.mts +1 -0
  1123. package/node_modules/typebox/build/value/assert/index.mjs +1 -0
  1124. package/node_modules/typebox/build/value/check/check.d.mts +5 -0
  1125. package/node_modules/typebox/build/value/check/check.mjs +11 -0
  1126. package/node_modules/typebox/build/value/check/index.d.mts +1 -0
  1127. package/node_modules/typebox/build/value/check/index.mjs +1 -0
  1128. package/node_modules/typebox/build/value/clean/additional.d.mts +2 -0
  1129. package/node_modules/typebox/build/value/clean/additional.mjs +6 -0
  1130. package/node_modules/typebox/build/value/clean/clean.d.mts +15 -0
  1131. package/node_modules/typebox/build/value/clean/clean.mjs +17 -0
  1132. package/node_modules/typebox/build/value/clean/from_array.d.mts +2 -0
  1133. package/node_modules/typebox/build/value/clean/from_array.mjs +8 -0
  1134. package/node_modules/typebox/build/value/clean/from_cyclic.d.mts +2 -0
  1135. package/node_modules/typebox/build/value/clean/from_cyclic.mjs +6 -0
  1136. package/node_modules/typebox/build/value/clean/from_intersect.d.mts +2 -0
  1137. package/node_modules/typebox/build/value/clean/from_intersect.mjs +26 -0
  1138. package/node_modules/typebox/build/value/clean/from_object.d.mts +2 -0
  1139. package/node_modules/typebox/build/value/clean/from_object.mjs +31 -0
  1140. package/node_modules/typebox/build/value/clean/from_record.d.mts +2 -0
  1141. package/node_modules/typebox/build/value/clean/from_record.mjs +32 -0
  1142. package/node_modules/typebox/build/value/clean/from_ref.d.mts +2 -0
  1143. package/node_modules/typebox/build/value/clean/from_ref.mjs +8 -0
  1144. package/node_modules/typebox/build/value/clean/from_tuple.d.mts +2 -0
  1145. package/node_modules/typebox/build/value/clean/from_tuple.mjs +14 -0
  1146. package/node_modules/typebox/build/value/clean/from_type.d.mts +2 -0
  1147. package/node_modules/typebox/build/value/clean/from_type.mjs +21 -0
  1148. package/node_modules/typebox/build/value/clean/from_union.d.mts +2 -0
  1149. package/node_modules/typebox/build/value/clean/from_union.mjs +12 -0
  1150. package/node_modules/typebox/build/value/clean/index.d.mts +1 -0
  1151. package/node_modules/typebox/build/value/clean/index.mjs +1 -0
  1152. package/node_modules/typebox/build/value/clone/clone.d.mts +5 -0
  1153. package/node_modules/typebox/build/value/clone/clone.mjs +12 -0
  1154. package/node_modules/typebox/build/value/clone/index.d.mts +1 -0
  1155. package/node_modules/typebox/build/value/clone/index.mjs +1 -0
  1156. package/node_modules/typebox/build/value/codec/callback.d.mts +2 -0
  1157. package/node_modules/typebox/build/value/codec/callback.mjs +25 -0
  1158. package/node_modules/typebox/build/value/codec/decode.d.mts +12 -0
  1159. package/node_modules/typebox/build/value/codec/decode.mjs +52 -0
  1160. package/node_modules/typebox/build/value/codec/encode.d.mts +12 -0
  1161. package/node_modules/typebox/build/value/codec/encode.mjs +52 -0
  1162. package/node_modules/typebox/build/value/codec/from_array.d.mts +2 -0
  1163. package/node_modules/typebox/build/value/codec/from_array.mjs +35 -0
  1164. package/node_modules/typebox/build/value/codec/from_cyclic.d.mts +2 -0
  1165. package/node_modules/typebox/build/value/codec/from_cyclic.mjs +8 -0
  1166. package/node_modules/typebox/build/value/codec/from_intersect.d.mts +2 -0
  1167. package/node_modules/typebox/build/value/codec/from_intersect.mjs +58 -0
  1168. package/node_modules/typebox/build/value/codec/from_object.d.mts +2 -0
  1169. package/node_modules/typebox/build/value/codec/from_object.mjs +42 -0
  1170. package/node_modules/typebox/build/value/codec/from_record.d.mts +2 -0
  1171. package/node_modules/typebox/build/value/codec/from_record.mjs +39 -0
  1172. package/node_modules/typebox/build/value/codec/from_ref.d.mts +2 -0
  1173. package/node_modules/typebox/build/value/codec/from_ref.mjs +31 -0
  1174. package/node_modules/typebox/build/value/codec/from_tuple.d.mts +2 -0
  1175. package/node_modules/typebox/build/value/codec/from_tuple.mjs +32 -0
  1176. package/node_modules/typebox/build/value/codec/from_type.d.mts +2 -0
  1177. package/node_modules/typebox/build/value/codec/from_type.mjs +22 -0
  1178. package/node_modules/typebox/build/value/codec/from_union.d.mts +2 -0
  1179. package/node_modules/typebox/build/value/codec/from_union.mjs +39 -0
  1180. package/node_modules/typebox/build/value/codec/has.d.mts +5 -0
  1181. package/node_modules/typebox/build/value/codec/has.mjs +93 -0
  1182. package/node_modules/typebox/build/value/codec/index.d.mts +3 -0
  1183. package/node_modules/typebox/build/value/codec/index.mjs +3 -0
  1184. package/node_modules/typebox/build/value/convert/convert.d.mts +13 -0
  1185. package/node_modules/typebox/build/value/convert/convert.mjs +15 -0
  1186. package/node_modules/typebox/build/value/convert/from_additional.d.mts +6 -0
  1187. package/node_modules/typebox/build/value/convert/from_additional.mjs +18 -0
  1188. package/node_modules/typebox/build/value/convert/from_array.d.mts +2 -0
  1189. package/node_modules/typebox/build/value/convert/from_array.mjs +7 -0
  1190. package/node_modules/typebox/build/value/convert/from_bigint.d.mts +2 -0
  1191. package/node_modules/typebox/build/value/convert/from_bigint.mjs +6 -0
  1192. package/node_modules/typebox/build/value/convert/from_boolean.d.mts +2 -0
  1193. package/node_modules/typebox/build/value/convert/from_boolean.mjs +6 -0
  1194. package/node_modules/typebox/build/value/convert/from_cyclic.d.mts +2 -0
  1195. package/node_modules/typebox/build/value/convert/from_cyclic.mjs +6 -0
  1196. package/node_modules/typebox/build/value/convert/from_enum.d.mts +2 -0
  1197. package/node_modules/typebox/build/value/convert/from_enum.mjs +6 -0
  1198. package/node_modules/typebox/build/value/convert/from_integer.d.mts +2 -0
  1199. package/node_modules/typebox/build/value/convert/from_integer.mjs +6 -0
  1200. package/node_modules/typebox/build/value/convert/from_intersect.d.mts +2 -0
  1201. package/node_modules/typebox/build/value/convert/from_intersect.mjs +8 -0
  1202. package/node_modules/typebox/build/value/convert/from_literal.d.mts +2 -0
  1203. package/node_modules/typebox/build/value/convert/from_literal.mjs +44 -0
  1204. package/node_modules/typebox/build/value/convert/from_null.d.mts +2 -0
  1205. package/node_modules/typebox/build/value/convert/from_null.mjs +6 -0
  1206. package/node_modules/typebox/build/value/convert/from_number.d.mts +2 -0
  1207. package/node_modules/typebox/build/value/convert/from_number.mjs +6 -0
  1208. package/node_modules/typebox/build/value/convert/from_object.d.mts +2 -0
  1209. package/node_modules/typebox/build/value/convert/from_object.mjs +28 -0
  1210. package/node_modules/typebox/build/value/convert/from_record.d.mts +2 -0
  1211. package/node_modules/typebox/build/value/convert/from_record.mjs +23 -0
  1212. package/node_modules/typebox/build/value/convert/from_ref.d.mts +2 -0
  1213. package/node_modules/typebox/build/value/convert/from_ref.mjs +8 -0
  1214. package/node_modules/typebox/build/value/convert/from_string.d.mts +2 -0
  1215. package/node_modules/typebox/build/value/convert/from_string.mjs +6 -0
  1216. package/node_modules/typebox/build/value/convert/from_template_literal.d.mts +2 -0
  1217. package/node_modules/typebox/build/value/convert/from_template_literal.mjs +6 -0
  1218. package/node_modules/typebox/build/value/convert/from_tuple.d.mts +2 -0
  1219. package/node_modules/typebox/build/value/convert/from_tuple.mjs +11 -0
  1220. package/node_modules/typebox/build/value/convert/from_type.d.mts +2 -0
  1221. package/node_modules/typebox/build/value/convert/from_type.mjs +43 -0
  1222. package/node_modules/typebox/build/value/convert/from_undefined.d.mts +2 -0
  1223. package/node_modules/typebox/build/value/convert/from_undefined.mjs +6 -0
  1224. package/node_modules/typebox/build/value/convert/from_union.d.mts +2 -0
  1225. package/node_modules/typebox/build/value/convert/from_union.mjs +13 -0
  1226. package/node_modules/typebox/build/value/convert/from_void.d.mts +2 -0
  1227. package/node_modules/typebox/build/value/convert/from_void.mjs +6 -0
  1228. package/node_modules/typebox/build/value/convert/index.d.mts +1 -0
  1229. package/node_modules/typebox/build/value/convert/index.mjs +1 -0
  1230. package/node_modules/typebox/build/value/convert/try/index.d.mts +1 -0
  1231. package/node_modules/typebox/build/value/convert/try/index.mjs +1 -0
  1232. package/node_modules/typebox/build/value/convert/try/try.d.mts +8 -0
  1233. package/node_modules/typebox/build/value/convert/try/try.mjs +8 -0
  1234. package/node_modules/typebox/build/value/convert/try/try_array.d.mts +2 -0
  1235. package/node_modules/typebox/build/value/convert/try/try_array.mjs +6 -0
  1236. package/node_modules/typebox/build/value/convert/try/try_bigint.d.mts +2 -0
  1237. package/node_modules/typebox/build/value/convert/try/try_bigint.mjs +45 -0
  1238. package/node_modules/typebox/build/value/convert/try/try_boolean.d.mts +2 -0
  1239. package/node_modules/typebox/build/value/convert/try/try_boolean.mjs +41 -0
  1240. package/node_modules/typebox/build/value/convert/try/try_null.d.mts +2 -0
  1241. package/node_modules/typebox/build/value/convert/try/try_null.mjs +44 -0
  1242. package/node_modules/typebox/build/value/convert/try/try_number.d.mts +2 -0
  1243. package/node_modules/typebox/build/value/convert/try/try_number.mjs +44 -0
  1244. package/node_modules/typebox/build/value/convert/try/try_result.d.mts +8 -0
  1245. package/node_modules/typebox/build/value/convert/try/try_result.mjs +17 -0
  1246. package/node_modules/typebox/build/value/convert/try/try_string.d.mts +2 -0
  1247. package/node_modules/typebox/build/value/convert/try/try_string.mjs +12 -0
  1248. package/node_modules/typebox/build/value/convert/try/try_undefined.d.mts +2 -0
  1249. package/node_modules/typebox/build/value/convert/try/try_undefined.mjs +44 -0
  1250. package/node_modules/typebox/build/value/create/create.d.mts +5 -0
  1251. package/node_modules/typebox/build/value/create/create.mjs +11 -0
  1252. package/node_modules/typebox/build/value/create/error.d.mts +5 -0
  1253. package/node_modules/typebox/build/value/create/error.mjs +7 -0
  1254. package/node_modules/typebox/build/value/create/from_array.d.mts +2 -0
  1255. package/node_modules/typebox/build/value/create/from_array.mjs +10 -0
  1256. package/node_modules/typebox/build/value/create/from_bigint.d.mts +2 -0
  1257. package/node_modules/typebox/build/value/create/from_bigint.mjs +7 -0
  1258. package/node_modules/typebox/build/value/create/from_boolean.d.mts +2 -0
  1259. package/node_modules/typebox/build/value/create/from_boolean.mjs +4 -0
  1260. package/node_modules/typebox/build/value/create/from_constructor.d.mts +2 -0
  1261. package/node_modules/typebox/build/value/create/from_constructor.mjs +10 -0
  1262. package/node_modules/typebox/build/value/create/from_cyclic.d.mts +2 -0
  1263. package/node_modules/typebox/build/value/create/from_cyclic.mjs +6 -0
  1264. package/node_modules/typebox/build/value/create/from_default.d.mts +3 -0
  1265. package/node_modules/typebox/build/value/create/from_default.mjs +10 -0
  1266. package/node_modules/typebox/build/value/create/from_enum.d.mts +2 -0
  1267. package/node_modules/typebox/build/value/create/from_enum.mjs +6 -0
  1268. package/node_modules/typebox/build/value/create/from_function.d.mts +2 -0
  1269. package/node_modules/typebox/build/value/create/from_function.mjs +6 -0
  1270. package/node_modules/typebox/build/value/create/from_integer.d.mts +2 -0
  1271. package/node_modules/typebox/build/value/create/from_integer.mjs +8 -0
  1272. package/node_modules/typebox/build/value/create/from_intersect.d.mts +2 -0
  1273. package/node_modules/typebox/build/value/create/from_intersect.mjs +8 -0
  1274. package/node_modules/typebox/build/value/create/from_literal.d.mts +2 -0
  1275. package/node_modules/typebox/build/value/create/from_literal.mjs +4 -0
  1276. package/node_modules/typebox/build/value/create/from_never.d.mts +2 -0
  1277. package/node_modules/typebox/build/value/create/from_never.mjs +5 -0
  1278. package/node_modules/typebox/build/value/create/from_null.d.mts +2 -0
  1279. package/node_modules/typebox/build/value/create/from_null.mjs +4 -0
  1280. package/node_modules/typebox/build/value/create/from_number.d.mts +2 -0
  1281. package/node_modules/typebox/build/value/create/from_number.mjs +8 -0
  1282. package/node_modules/typebox/build/value/create/from_object.d.mts +2 -0
  1283. package/node_modules/typebox/build/value/create/from_object.mjs +9 -0
  1284. package/node_modules/typebox/build/value/create/from_record.d.mts +2 -0
  1285. package/node_modules/typebox/build/value/create/from_record.mjs +8 -0
  1286. package/node_modules/typebox/build/value/create/from_ref.d.mts +2 -0
  1287. package/node_modules/typebox/build/value/create/from_ref.mjs +9 -0
  1288. package/node_modules/typebox/build/value/create/from_string.d.mts +2 -0
  1289. package/node_modules/typebox/build/value/create/from_string.mjs +9 -0
  1290. package/node_modules/typebox/build/value/create/from_symbol.d.mts +2 -0
  1291. package/node_modules/typebox/build/value/create/from_symbol.mjs +4 -0
  1292. package/node_modules/typebox/build/value/create/from_template_literal.d.mts +2 -0
  1293. package/node_modules/typebox/build/value/create/from_template_literal.mjs +11 -0
  1294. package/node_modules/typebox/build/value/create/from_tuple.d.mts +2 -0
  1295. package/node_modules/typebox/build/value/create/from_tuple.mjs +5 -0
  1296. package/node_modules/typebox/build/value/create/from_type.d.mts +2 -0
  1297. package/node_modules/typebox/build/value/create/from_type.mjs +61 -0
  1298. package/node_modules/typebox/build/value/create/from_undefined.d.mts +2 -0
  1299. package/node_modules/typebox/build/value/create/from_undefined.mjs +4 -0
  1300. package/node_modules/typebox/build/value/create/from_union.d.mts +2 -0
  1301. package/node_modules/typebox/build/value/create/from_union.mjs +9 -0
  1302. package/node_modules/typebox/build/value/create/from_void.d.mts +2 -0
  1303. package/node_modules/typebox/build/value/create/from_void.mjs +4 -0
  1304. package/node_modules/typebox/build/value/create/index.d.mts +2 -0
  1305. package/node_modules/typebox/build/value/create/index.mjs +2 -0
  1306. package/node_modules/typebox/build/value/default/default.d.mts +13 -0
  1307. package/node_modules/typebox/build/value/default/default.mjs +15 -0
  1308. package/node_modules/typebox/build/value/default/from_array.d.mts +2 -0
  1309. package/node_modules/typebox/build/value/default/from_array.mjs +12 -0
  1310. package/node_modules/typebox/build/value/default/from_cyclic.d.mts +2 -0
  1311. package/node_modules/typebox/build/value/default/from_cyclic.mjs +7 -0
  1312. package/node_modules/typebox/build/value/default/from_default.d.mts +3 -0
  1313. package/node_modules/typebox/build/value/default/from_default.mjs +13 -0
  1314. package/node_modules/typebox/build/value/default/from_intersect.d.mts +2 -0
  1315. package/node_modules/typebox/build/value/default/from_intersect.mjs +9 -0
  1316. package/node_modules/typebox/build/value/default/from_object.d.mts +2 -0
  1317. package/node_modules/typebox/build/value/default/from_object.mjs +32 -0
  1318. package/node_modules/typebox/build/value/default/from_record.d.mts +2 -0
  1319. package/node_modules/typebox/build/value/default/from_record.mjs +26 -0
  1320. package/node_modules/typebox/build/value/default/from_ref.d.mts +2 -0
  1321. package/node_modules/typebox/build/value/default/from_ref.mjs +9 -0
  1322. package/node_modules/typebox/build/value/default/from_tuple.d.mts +2 -0
  1323. package/node_modules/typebox/build/value/default/from_tuple.mjs +14 -0
  1324. package/node_modules/typebox/build/value/default/from_type.d.mts +2 -0
  1325. package/node_modules/typebox/build/value/default/from_type.mjs +25 -0
  1326. package/node_modules/typebox/build/value/default/from_union.d.mts +2 -0
  1327. package/node_modules/typebox/build/value/default/from_union.mjs +14 -0
  1328. package/node_modules/typebox/build/value/default/index.d.mts +1 -0
  1329. package/node_modules/typebox/build/value/default/index.mjs +1 -0
  1330. package/node_modules/typebox/build/value/delta/diff.d.mts +10 -0
  1331. package/node_modules/typebox/build/value/delta/diff.mjs +135 -0
  1332. package/node_modules/typebox/build/value/delta/edit.d.mts +24 -0
  1333. package/node_modules/typebox/build/value/delta/edit.mjs +17 -0
  1334. package/node_modules/typebox/build/value/delta/index.d.mts +3 -0
  1335. package/node_modules/typebox/build/value/delta/index.mjs +3 -0
  1336. package/node_modules/typebox/build/value/delta/patch.d.mts +8 -0
  1337. package/node_modules/typebox/build/value/delta/patch.mjs +42 -0
  1338. package/node_modules/typebox/build/value/equal/equal.d.mts +2 -0
  1339. package/node_modules/typebox/build/value/equal/equal.mjs +6 -0
  1340. package/node_modules/typebox/build/value/equal/index.d.mts +1 -0
  1341. package/node_modules/typebox/build/value/equal/index.mjs +1 -0
  1342. package/node_modules/typebox/build/value/errors/errors.d.mts +16 -0
  1343. package/node_modules/typebox/build/value/errors/errors.mjs +17 -0
  1344. package/node_modules/typebox/build/value/errors/index.d.mts +1 -0
  1345. package/node_modules/typebox/build/value/errors/index.mjs +1 -0
  1346. package/node_modules/typebox/build/value/hash/hash.d.mts +6 -0
  1347. package/node_modules/typebox/build/value/hash/hash.mjs +10 -0
  1348. package/node_modules/typebox/build/value/hash/index.d.mts +1 -0
  1349. package/node_modules/typebox/build/value/hash/index.mjs +1 -0
  1350. package/node_modules/typebox/build/value/index.d.mts +20 -0
  1351. package/node_modules/typebox/build/value/index.mjs +29 -0
  1352. package/node_modules/typebox/build/value/parse/index.d.mts +1 -0
  1353. package/node_modules/typebox/build/value/parse/index.mjs +1 -0
  1354. package/node_modules/typebox/build/value/parse/parse.d.mts +11 -0
  1355. package/node_modules/typebox/build/value/parse/parse.mjs +47 -0
  1356. package/node_modules/typebox/build/value/pipeline/index.d.mts +1 -0
  1357. package/node_modules/typebox/build/value/pipeline/index.mjs +1 -0
  1358. package/node_modules/typebox/build/value/pipeline/pipeline.d.mts +10 -0
  1359. package/node_modules/typebox/build/value/pipeline/pipeline.mjs +15 -0
  1360. package/node_modules/typebox/build/value/pointer/index.d.mts +1 -0
  1361. package/node_modules/typebox/build/value/pointer/index.mjs +1 -0
  1362. package/node_modules/typebox/build/value/repair/error.d.mts +7 -0
  1363. package/node_modules/typebox/build/value/repair/error.mjs +8 -0
  1364. package/node_modules/typebox/build/value/repair/from_array.d.mts +2 -0
  1365. package/node_modules/typebox/build/value/repair/from_array.mjs +39 -0
  1366. package/node_modules/typebox/build/value/repair/from_enum.d.mts +2 -0
  1367. package/node_modules/typebox/build/value/repair/from_enum.mjs +6 -0
  1368. package/node_modules/typebox/build/value/repair/from_intersect.d.mts +2 -0
  1369. package/node_modules/typebox/build/value/repair/from_intersect.mjs +8 -0
  1370. package/node_modules/typebox/build/value/repair/from_object.d.mts +2 -0
  1371. package/node_modules/typebox/build/value/repair/from_object.mjs +33 -0
  1372. package/node_modules/typebox/build/value/repair/from_record.d.mts +2 -0
  1373. package/node_modules/typebox/build/value/repair/from_record.mjs +33 -0
  1374. package/node_modules/typebox/build/value/repair/from_ref.d.mts +2 -0
  1375. package/node_modules/typebox/build/value/repair/from_ref.mjs +9 -0
  1376. package/node_modules/typebox/build/value/repair/from_template_literal.d.mts +2 -0
  1377. package/node_modules/typebox/build/value/repair/from_template_literal.mjs +7 -0
  1378. package/node_modules/typebox/build/value/repair/from_tuple.d.mts +2 -0
  1379. package/node_modules/typebox/build/value/repair/from_tuple.mjs +12 -0
  1380. package/node_modules/typebox/build/value/repair/from_type.d.mts +2 -0
  1381. package/node_modules/typebox/build/value/repair/from_type.mjs +88 -0
  1382. package/node_modules/typebox/build/value/repair/from_union.d.mts +2 -0
  1383. package/node_modules/typebox/build/value/repair/from_union.mjs +24 -0
  1384. package/node_modules/typebox/build/value/repair/from_unknown.d.mts +2 -0
  1385. package/node_modules/typebox/build/value/repair/from_unknown.mjs +12 -0
  1386. package/node_modules/typebox/build/value/repair/index.d.mts +1 -0
  1387. package/node_modules/typebox/build/value/repair/index.mjs +1 -0
  1388. package/node_modules/typebox/build/value/repair/repair.d.mts +17 -0
  1389. package/node_modules/typebox/build/value/repair/repair.mjs +20 -0
  1390. package/node_modules/typebox/build/value/shared/index.d.mts +3 -0
  1391. package/node_modules/typebox/build/value/shared/index.mjs +4 -0
  1392. package/node_modules/typebox/build/value/shared/optional_undefined.d.mts +2 -0
  1393. package/node_modules/typebox/build/value/shared/optional_undefined.mjs +15 -0
  1394. package/node_modules/typebox/build/value/shared/union_priority_sort.d.mts +7 -0
  1395. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +72 -0
  1396. package/node_modules/typebox/build/value/shared/union_score_select.d.mts +3 -0
  1397. package/node_modules/typebox/build/value/shared/union_score_select.mjs +51 -0
  1398. package/node_modules/typebox/build/value/value.d.mts +15 -0
  1399. package/node_modules/typebox/build/value/value.mjs +15 -0
  1400. package/node_modules/typebox/license +23 -0
  1401. package/node_modules/typebox/package.json +87 -0
  1402. package/node_modules/typebox/readme.md +370 -0
  1403. package/node_modules/zod/LICENSE +21 -0
  1404. package/node_modules/zod/README.md +191 -0
  1405. package/node_modules/zod/index.cjs +33 -0
  1406. package/node_modules/zod/index.d.cts +4 -0
  1407. package/node_modules/zod/index.d.ts +4 -0
  1408. package/node_modules/zod/index.js +4 -0
  1409. package/node_modules/zod/locales/index.cjs +17 -0
  1410. package/node_modules/zod/locales/index.d.cts +1 -0
  1411. package/node_modules/zod/locales/index.d.ts +1 -0
  1412. package/node_modules/zod/locales/index.js +1 -0
  1413. package/node_modules/zod/locales/package.json +7 -0
  1414. package/node_modules/zod/mini/index.cjs +32 -0
  1415. package/node_modules/zod/mini/index.d.cts +3 -0
  1416. package/node_modules/zod/mini/index.d.ts +3 -0
  1417. package/node_modules/zod/mini/index.js +3 -0
  1418. package/node_modules/zod/mini/package.json +7 -0
  1419. package/node_modules/zod/package.json +135 -0
  1420. package/node_modules/zod/src/index.ts +4 -0
  1421. package/node_modules/zod/src/locales/index.ts +1 -0
  1422. package/node_modules/zod/src/mini/index.ts +3 -0
  1423. package/node_modules/zod/src/v3/ZodError.ts +330 -0
  1424. package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
  1425. package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
  1426. package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
  1427. package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
  1428. package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
  1429. package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
  1430. package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
  1431. package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
  1432. package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
  1433. package/node_modules/zod/src/v3/errors.ts +13 -0
  1434. package/node_modules/zod/src/v3/external.ts +6 -0
  1435. package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
  1436. package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
  1437. package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
  1438. package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
  1439. package/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
  1440. package/node_modules/zod/src/v3/helpers/util.ts +224 -0
  1441. package/node_modules/zod/src/v3/index.ts +4 -0
  1442. package/node_modules/zod/src/v3/locales/en.ts +124 -0
  1443. package/node_modules/zod/src/v3/standard-schema.ts +113 -0
  1444. package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
  1445. package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
  1446. package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
  1447. package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
  1448. package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
  1449. package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
  1450. package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
  1451. package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
  1452. package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
  1453. package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
  1454. package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
  1455. package/node_modules/zod/src/v3/tests/complex.test.ts +70 -0
  1456. package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
  1457. package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
  1458. package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
  1459. package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
  1460. package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
  1461. package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
  1462. package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
  1463. package/node_modules/zod/src/v3/tests/error.test.ts +551 -0
  1464. package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
  1465. package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
  1466. package/node_modules/zod/src/v3/tests/function.test.ts +261 -0
  1467. package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
  1468. package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
  1469. package/node_modules/zod/src/v3/tests/intersection.test.ts +110 -0
  1470. package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
  1471. package/node_modules/zod/src/v3/tests/language-server.test.ts +207 -0
  1472. package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
  1473. package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
  1474. package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
  1475. package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
  1476. package/node_modules/zod/src/v3/tests/nan.test.ts +24 -0
  1477. package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
  1478. package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
  1479. package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
  1480. package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
  1481. package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
  1482. package/node_modules/zod/src/v3/tests/object.test.ts +434 -0
  1483. package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
  1484. package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
  1485. package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
  1486. package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
  1487. package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
  1488. package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
  1489. package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
  1490. package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
  1491. package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
  1492. package/node_modules/zod/src/v3/tests/readonly.test.ts +194 -0
  1493. package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
  1494. package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
  1495. package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
  1496. package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
  1497. package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
  1498. package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
  1499. package/node_modules/zod/src/v3/tests/string.test.ts +916 -0
  1500. package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
  1501. package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
  1502. package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
  1503. package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
  1504. package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
  1505. package/node_modules/zod/src/v3/types.ts +5138 -0
  1506. package/node_modules/zod/src/v4/classic/checks.ts +32 -0
  1507. package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
  1508. package/node_modules/zod/src/v4/classic/compat.ts +70 -0
  1509. package/node_modules/zod/src/v4/classic/errors.ts +82 -0
  1510. package/node_modules/zod/src/v4/classic/external.ts +52 -0
  1511. package/node_modules/zod/src/v4/classic/from-json-schema.ts +659 -0
  1512. package/node_modules/zod/src/v4/classic/index.ts +5 -0
  1513. package/node_modules/zod/src/v4/classic/iso.ts +90 -0
  1514. package/node_modules/zod/src/v4/classic/parse.ts +82 -0
  1515. package/node_modules/zod/src/v4/classic/schemas.ts +2672 -0
  1516. package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
  1517. package/node_modules/zod/src/v4/classic/tests/apply.test.ts +59 -0
  1518. package/node_modules/zod/src/v4/classic/tests/array.test.ts +264 -0
  1519. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +216 -0
  1520. package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
  1521. package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
  1522. package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
  1523. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +54 -0
  1524. package/node_modules/zod/src/v4/classic/tests/brand.test.ts +106 -0
  1525. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +326 -0
  1526. package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
  1527. package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +573 -0
  1528. package/node_modules/zod/src/v4/classic/tests/codec.test.ts +703 -0
  1529. package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
  1530. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +374 -0
  1531. package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
  1532. package/node_modules/zod/src/v4/classic/tests/date.test.ts +62 -0
  1533. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +302 -0
  1534. package/node_modules/zod/src/v4/classic/tests/default.test.ts +409 -0
  1535. package/node_modules/zod/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
  1536. package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
  1537. package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +197 -0
  1538. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +694 -0
  1539. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +285 -0
  1540. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +807 -0
  1541. package/node_modules/zod/src/v4/classic/tests/error.test.ts +711 -0
  1542. package/node_modules/zod/src/v4/classic/tests/file.test.ts +96 -0
  1543. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +179 -0
  1544. package/node_modules/zod/src/v4/classic/tests/fix-json-issue.test.ts +26 -0
  1545. package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +895 -0
  1546. package/node_modules/zod/src/v4/classic/tests/function.test.ts +360 -0
  1547. package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
  1548. package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +39 -0
  1549. package/node_modules/zod/src/v4/classic/tests/hash.test.ts +68 -0
  1550. package/node_modules/zod/src/v4/classic/tests/index.test.ts +939 -0
  1551. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +60 -0
  1552. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +198 -0
  1553. package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +46 -0
  1554. package/node_modules/zod/src/v4/classic/tests/json.test.ts +109 -0
  1555. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +227 -0
  1556. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +117 -0
  1557. package/node_modules/zod/src/v4/classic/tests/locales_ka.test.ts +29 -0
  1558. package/node_modules/zod/src/v4/classic/tests/locales_ro.test.ts +24 -0
  1559. package/node_modules/zod/src/v4/classic/tests/map.test.ts +330 -0
  1560. package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
  1561. package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
  1562. package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +101 -0
  1563. package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
  1564. package/node_modules/zod/src/v4/classic/tests/number.test.ts +325 -0
  1565. package/node_modules/zod/src/v4/classic/tests/object.test.ts +717 -0
  1566. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +333 -0
  1567. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +450 -0
  1568. package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +211 -0
  1569. package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +101 -0
  1570. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +74 -0
  1571. package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +26 -0
  1572. package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +351 -0
  1573. package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
  1574. package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
  1575. package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
  1576. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +252 -0
  1577. package/node_modules/zod/src/v4/classic/tests/record.test.ts +717 -0
  1578. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +631 -0
  1579. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +633 -0
  1580. package/node_modules/zod/src/v4/classic/tests/registries.test.ts +243 -0
  1581. package/node_modules/zod/src/v4/classic/tests/set.test.ts +181 -0
  1582. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +134 -0
  1583. package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +125 -0
  1584. package/node_modules/zod/src/v4/classic/tests/string.test.ts +1224 -0
  1585. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +106 -0
  1586. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +771 -0
  1587. package/node_modules/zod/src/v4/classic/tests/to-json-schema-methods.test.ts +438 -0
  1588. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +3125 -0
  1589. package/node_modules/zod/src/v4/classic/tests/transform.test.ts +378 -0
  1590. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +496 -0
  1591. package/node_modules/zod/src/v4/classic/tests/union.test.ts +273 -0
  1592. package/node_modules/zod/src/v4/classic/tests/url.test.ts +13 -0
  1593. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
  1594. package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
  1595. package/node_modules/zod/src/v4/core/api.ts +1823 -0
  1596. package/node_modules/zod/src/v4/core/checks.ts +1293 -0
  1597. package/node_modules/zod/src/v4/core/config.ts +15 -0
  1598. package/node_modules/zod/src/v4/core/core.ts +153 -0
  1599. package/node_modules/zod/src/v4/core/doc.ts +44 -0
  1600. package/node_modules/zod/src/v4/core/errors.ts +455 -0
  1601. package/node_modules/zod/src/v4/core/index.ts +16 -0
  1602. package/node_modules/zod/src/v4/core/json-schema-generator.ts +126 -0
  1603. package/node_modules/zod/src/v4/core/json-schema-processors.ts +666 -0
  1604. package/node_modules/zod/src/v4/core/json-schema.ts +147 -0
  1605. package/node_modules/zod/src/v4/core/parse.ts +195 -0
  1606. package/node_modules/zod/src/v4/core/regexes.ts +190 -0
  1607. package/node_modules/zod/src/v4/core/registries.ts +105 -0
  1608. package/node_modules/zod/src/v4/core/schemas.ts +4730 -0
  1609. package/node_modules/zod/src/v4/core/standard-schema.ts +159 -0
  1610. package/node_modules/zod/src/v4/core/tests/extend.test.ts +59 -0
  1611. package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
  1612. package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
  1613. package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +215 -0
  1614. package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
  1615. package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +181 -0
  1616. package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +72 -0
  1617. package/node_modules/zod/src/v4/core/tests/locales/he.test.ts +379 -0
  1618. package/node_modules/zod/src/v4/core/tests/locales/hr.test.ts +163 -0
  1619. package/node_modules/zod/src/v4/core/tests/locales/nl.test.ts +46 -0
  1620. package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
  1621. package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
  1622. package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +105 -0
  1623. package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +125 -0
  1624. package/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts +45 -0
  1625. package/node_modules/zod/src/v4/core/to-json-schema.ts +622 -0
  1626. package/node_modules/zod/src/v4/core/util.ts +983 -0
  1627. package/node_modules/zod/src/v4/core/versions.ts +5 -0
  1628. package/node_modules/zod/src/v4/core/zsf.ts +323 -0
  1629. package/node_modules/zod/src/v4/index.ts +4 -0
  1630. package/node_modules/zod/src/v4/locales/ar.ts +115 -0
  1631. package/node_modules/zod/src/v4/locales/az.ts +111 -0
  1632. package/node_modules/zod/src/v4/locales/be.ts +176 -0
  1633. package/node_modules/zod/src/v4/locales/bg.ts +128 -0
  1634. package/node_modules/zod/src/v4/locales/ca.ts +116 -0
  1635. package/node_modules/zod/src/v4/locales/cs.ts +118 -0
  1636. package/node_modules/zod/src/v4/locales/da.ts +123 -0
  1637. package/node_modules/zod/src/v4/locales/de.ts +116 -0
  1638. package/node_modules/zod/src/v4/locales/el.ts +121 -0
  1639. package/node_modules/zod/src/v4/locales/en.ts +123 -0
  1640. package/node_modules/zod/src/v4/locales/eo.ts +118 -0
  1641. package/node_modules/zod/src/v4/locales/es.ts +141 -0
  1642. package/node_modules/zod/src/v4/locales/fa.ts +126 -0
  1643. package/node_modules/zod/src/v4/locales/fi.ts +121 -0
  1644. package/node_modules/zod/src/v4/locales/fr-CA.ts +116 -0
  1645. package/node_modules/zod/src/v4/locales/fr.ts +132 -0
  1646. package/node_modules/zod/src/v4/locales/he.ts +246 -0
  1647. package/node_modules/zod/src/v4/locales/hr.ts +131 -0
  1648. package/node_modules/zod/src/v4/locales/hu.ts +117 -0
  1649. package/node_modules/zod/src/v4/locales/hy.ts +164 -0
  1650. package/node_modules/zod/src/v4/locales/id.ts +115 -0
  1651. package/node_modules/zod/src/v4/locales/index.ts +52 -0
  1652. package/node_modules/zod/src/v4/locales/is.ts +119 -0
  1653. package/node_modules/zod/src/v4/locales/it.ts +116 -0
  1654. package/node_modules/zod/src/v4/locales/ja.ts +114 -0
  1655. package/node_modules/zod/src/v4/locales/ka.ts +123 -0
  1656. package/node_modules/zod/src/v4/locales/kh.ts +7 -0
  1657. package/node_modules/zod/src/v4/locales/km.ts +119 -0
  1658. package/node_modules/zod/src/v4/locales/ko.ts +121 -0
  1659. package/node_modules/zod/src/v4/locales/lt.ts +239 -0
  1660. package/node_modules/zod/src/v4/locales/mk.ts +118 -0
  1661. package/node_modules/zod/src/v4/locales/ms.ts +115 -0
  1662. package/node_modules/zod/src/v4/locales/nl.ts +121 -0
  1663. package/node_modules/zod/src/v4/locales/no.ts +116 -0
  1664. package/node_modules/zod/src/v4/locales/ota.ts +117 -0
  1665. package/node_modules/zod/src/v4/locales/pl.ts +118 -0
  1666. package/node_modules/zod/src/v4/locales/ps.ts +126 -0
  1667. package/node_modules/zod/src/v4/locales/pt.ts +116 -0
  1668. package/node_modules/zod/src/v4/locales/ro.ts +129 -0
  1669. package/node_modules/zod/src/v4/locales/ru.ts +176 -0
  1670. package/node_modules/zod/src/v4/locales/sl.ts +118 -0
  1671. package/node_modules/zod/src/v4/locales/sv.ts +119 -0
  1672. package/node_modules/zod/src/v4/locales/ta.ts +118 -0
  1673. package/node_modules/zod/src/v4/locales/th.ts +119 -0
  1674. package/node_modules/zod/src/v4/locales/tr.ts +111 -0
  1675. package/node_modules/zod/src/v4/locales/ua.ts +7 -0
  1676. package/node_modules/zod/src/v4/locales/uk.ts +117 -0
  1677. package/node_modules/zod/src/v4/locales/ur.ts +119 -0
  1678. package/node_modules/zod/src/v4/locales/uz.ts +117 -0
  1679. package/node_modules/zod/src/v4/locales/vi.ts +117 -0
  1680. package/node_modules/zod/src/v4/locales/yo.ts +124 -0
  1681. package/node_modules/zod/src/v4/locales/zh-CN.ts +116 -0
  1682. package/node_modules/zod/src/v4/locales/zh-TW.ts +115 -0
  1683. package/node_modules/zod/src/v4/mini/checks.ts +32 -0
  1684. package/node_modules/zod/src/v4/mini/coerce.ts +27 -0
  1685. package/node_modules/zod/src/v4/mini/external.ts +41 -0
  1686. package/node_modules/zod/src/v4/mini/index.ts +3 -0
  1687. package/node_modules/zod/src/v4/mini/iso.ts +66 -0
  1688. package/node_modules/zod/src/v4/mini/parse.ts +14 -0
  1689. package/node_modules/zod/src/v4/mini/schemas.ts +1947 -0
  1690. package/node_modules/zod/src/v4/mini/tests/apply.test.ts +24 -0
  1691. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +129 -0
  1692. package/node_modules/zod/src/v4/mini/tests/brand.test.ts +94 -0
  1693. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +144 -0
  1694. package/node_modules/zod/src/v4/mini/tests/codec.test.ts +548 -0
  1695. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +36 -0
  1696. package/node_modules/zod/src/v4/mini/tests/error.test.ts +22 -0
  1697. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +5 -0
  1698. package/node_modules/zod/src/v4/mini/tests/index.test.ts +993 -0
  1699. package/node_modules/zod/src/v4/mini/tests/number.test.ts +95 -0
  1700. package/node_modules/zod/src/v4/mini/tests/object.test.ts +227 -0
  1701. package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
  1702. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +325 -0
  1703. package/node_modules/zod/src/v4/mini/tests/standard-schema.test.ts +50 -0
  1704. package/node_modules/zod/src/v4/mini/tests/string.test.ts +352 -0
  1705. package/node_modules/zod/src/v4-mini/index.ts +3 -0
  1706. package/node_modules/zod/v3/ZodError.cjs +138 -0
  1707. package/node_modules/zod/v3/ZodError.d.cts +164 -0
  1708. package/node_modules/zod/v3/ZodError.d.ts +164 -0
  1709. package/node_modules/zod/v3/ZodError.js +133 -0
  1710. package/node_modules/zod/v3/errors.cjs +17 -0
  1711. package/node_modules/zod/v3/errors.d.cts +5 -0
  1712. package/node_modules/zod/v3/errors.d.ts +5 -0
  1713. package/node_modules/zod/v3/errors.js +9 -0
  1714. package/node_modules/zod/v3/external.cjs +22 -0
  1715. package/node_modules/zod/v3/external.d.cts +6 -0
  1716. package/node_modules/zod/v3/external.d.ts +6 -0
  1717. package/node_modules/zod/v3/external.js +6 -0
  1718. package/node_modules/zod/v3/helpers/enumUtil.cjs +2 -0
  1719. package/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
  1720. package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
  1721. package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
  1722. package/node_modules/zod/v3/helpers/errorUtil.cjs +9 -0
  1723. package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
  1724. package/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
  1725. package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
  1726. package/node_modules/zod/v3/helpers/parseUtil.cjs +124 -0
  1727. package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
  1728. package/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
  1729. package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
  1730. package/node_modules/zod/v3/helpers/partialUtil.cjs +2 -0
  1731. package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
  1732. package/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
  1733. package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
  1734. package/node_modules/zod/v3/helpers/typeAliases.cjs +2 -0
  1735. package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
  1736. package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
  1737. package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
  1738. package/node_modules/zod/v3/helpers/util.cjs +137 -0
  1739. package/node_modules/zod/v3/helpers/util.d.cts +85 -0
  1740. package/node_modules/zod/v3/helpers/util.d.ts +85 -0
  1741. package/node_modules/zod/v3/helpers/util.js +133 -0
  1742. package/node_modules/zod/v3/index.cjs +33 -0
  1743. package/node_modules/zod/v3/index.d.cts +4 -0
  1744. package/node_modules/zod/v3/index.d.ts +4 -0
  1745. package/node_modules/zod/v3/index.js +4 -0
  1746. package/node_modules/zod/v3/locales/en.cjs +112 -0
  1747. package/node_modules/zod/v3/locales/en.d.cts +3 -0
  1748. package/node_modules/zod/v3/locales/en.d.ts +3 -0
  1749. package/node_modules/zod/v3/locales/en.js +109 -0
  1750. package/node_modules/zod/v3/package.json +7 -0
  1751. package/node_modules/zod/v3/standard-schema.cjs +2 -0
  1752. package/node_modules/zod/v3/standard-schema.d.cts +102 -0
  1753. package/node_modules/zod/v3/standard-schema.d.ts +102 -0
  1754. package/node_modules/zod/v3/standard-schema.js +1 -0
  1755. package/node_modules/zod/v3/types.cjs +3777 -0
  1756. package/node_modules/zod/v3/types.d.cts +1034 -0
  1757. package/node_modules/zod/v3/types.d.ts +1034 -0
  1758. package/node_modules/zod/v3/types.js +3695 -0
  1759. package/node_modules/zod/v4/classic/checks.cjs +33 -0
  1760. package/node_modules/zod/v4/classic/checks.d.cts +1 -0
  1761. package/node_modules/zod/v4/classic/checks.d.ts +1 -0
  1762. package/node_modules/zod/v4/classic/checks.js +1 -0
  1763. package/node_modules/zod/v4/classic/coerce.cjs +47 -0
  1764. package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
  1765. package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
  1766. package/node_modules/zod/v4/classic/coerce.js +17 -0
  1767. package/node_modules/zod/v4/classic/compat.cjs +61 -0
  1768. package/node_modules/zod/v4/classic/compat.d.cts +50 -0
  1769. package/node_modules/zod/v4/classic/compat.d.ts +50 -0
  1770. package/node_modules/zod/v4/classic/compat.js +31 -0
  1771. package/node_modules/zod/v4/classic/errors.cjs +74 -0
  1772. package/node_modules/zod/v4/classic/errors.d.cts +30 -0
  1773. package/node_modules/zod/v4/classic/errors.d.ts +30 -0
  1774. package/node_modules/zod/v4/classic/errors.js +48 -0
  1775. package/node_modules/zod/v4/classic/external.cjs +73 -0
  1776. package/node_modules/zod/v4/classic/external.d.cts +16 -0
  1777. package/node_modules/zod/v4/classic/external.d.ts +16 -0
  1778. package/node_modules/zod/v4/classic/external.js +20 -0
  1779. package/node_modules/zod/v4/classic/from-json-schema.cjs +625 -0
  1780. package/node_modules/zod/v4/classic/from-json-schema.d.cts +12 -0
  1781. package/node_modules/zod/v4/classic/from-json-schema.d.ts +12 -0
  1782. package/node_modules/zod/v4/classic/from-json-schema.js +599 -0
  1783. package/node_modules/zod/v4/classic/index.cjs +33 -0
  1784. package/node_modules/zod/v4/classic/index.d.cts +4 -0
  1785. package/node_modules/zod/v4/classic/index.d.ts +4 -0
  1786. package/node_modules/zod/v4/classic/index.js +4 -0
  1787. package/node_modules/zod/v4/classic/iso.cjs +60 -0
  1788. package/node_modules/zod/v4/classic/iso.d.cts +22 -0
  1789. package/node_modules/zod/v4/classic/iso.d.ts +22 -0
  1790. package/node_modules/zod/v4/classic/iso.js +30 -0
  1791. package/node_modules/zod/v4/classic/package.json +7 -0
  1792. package/node_modules/zod/v4/classic/parse.cjs +41 -0
  1793. package/node_modules/zod/v4/classic/parse.d.cts +31 -0
  1794. package/node_modules/zod/v4/classic/parse.d.ts +31 -0
  1795. package/node_modules/zod/v4/classic/parse.js +15 -0
  1796. package/node_modules/zod/v4/classic/schemas.cjs +1511 -0
  1797. package/node_modules/zod/v4/classic/schemas.d.cts +767 -0
  1798. package/node_modules/zod/v4/classic/schemas.d.ts +767 -0
  1799. package/node_modules/zod/v4/classic/schemas.js +1395 -0
  1800. package/node_modules/zod/v4/core/api.cjs +1227 -0
  1801. package/node_modules/zod/v4/core/api.d.cts +325 -0
  1802. package/node_modules/zod/v4/core/api.d.ts +325 -0
  1803. package/node_modules/zod/v4/core/api.js +1087 -0
  1804. package/node_modules/zod/v4/core/checks.cjs +601 -0
  1805. package/node_modules/zod/v4/core/checks.d.cts +278 -0
  1806. package/node_modules/zod/v4/core/checks.d.ts +278 -0
  1807. package/node_modules/zod/v4/core/checks.js +575 -0
  1808. package/node_modules/zod/v4/core/core.cjs +85 -0
  1809. package/node_modules/zod/v4/core/core.d.cts +70 -0
  1810. package/node_modules/zod/v4/core/core.d.ts +70 -0
  1811. package/node_modules/zod/v4/core/core.js +78 -0
  1812. package/node_modules/zod/v4/core/doc.cjs +39 -0
  1813. package/node_modules/zod/v4/core/doc.d.cts +14 -0
  1814. package/node_modules/zod/v4/core/doc.d.ts +14 -0
  1815. package/node_modules/zod/v4/core/doc.js +35 -0
  1816. package/node_modules/zod/v4/core/errors.cjs +216 -0
  1817. package/node_modules/zod/v4/core/errors.d.cts +221 -0
  1818. package/node_modules/zod/v4/core/errors.d.ts +221 -0
  1819. package/node_modules/zod/v4/core/errors.js +185 -0
  1820. package/node_modules/zod/v4/core/index.cjs +47 -0
  1821. package/node_modules/zod/v4/core/index.d.cts +16 -0
  1822. package/node_modules/zod/v4/core/index.d.ts +16 -0
  1823. package/node_modules/zod/v4/core/index.js +16 -0
  1824. package/node_modules/zod/v4/core/json-schema-generator.cjs +99 -0
  1825. package/node_modules/zod/v4/core/json-schema-generator.d.cts +65 -0
  1826. package/node_modules/zod/v4/core/json-schema-generator.d.ts +65 -0
  1827. package/node_modules/zod/v4/core/json-schema-generator.js +95 -0
  1828. package/node_modules/zod/v4/core/json-schema-processors.cjs +644 -0
  1829. package/node_modules/zod/v4/core/json-schema-processors.d.cts +49 -0
  1830. package/node_modules/zod/v4/core/json-schema-processors.d.ts +49 -0
  1831. package/node_modules/zod/v4/core/json-schema-processors.js +601 -0
  1832. package/node_modules/zod/v4/core/json-schema.cjs +2 -0
  1833. package/node_modules/zod/v4/core/json-schema.d.cts +88 -0
  1834. package/node_modules/zod/v4/core/json-schema.d.ts +88 -0
  1835. package/node_modules/zod/v4/core/json-schema.js +1 -0
  1836. package/node_modules/zod/v4/core/package.json +7 -0
  1837. package/node_modules/zod/v4/core/parse.cjs +131 -0
  1838. package/node_modules/zod/v4/core/parse.d.cts +49 -0
  1839. package/node_modules/zod/v4/core/parse.d.ts +49 -0
  1840. package/node_modules/zod/v4/core/parse.js +93 -0
  1841. package/node_modules/zod/v4/core/regexes.cjs +172 -0
  1842. package/node_modules/zod/v4/core/regexes.d.cts +85 -0
  1843. package/node_modules/zod/v4/core/regexes.d.ts +85 -0
  1844. package/node_modules/zod/v4/core/regexes.js +139 -0
  1845. package/node_modules/zod/v4/core/registries.cjs +56 -0
  1846. package/node_modules/zod/v4/core/registries.d.cts +35 -0
  1847. package/node_modules/zod/v4/core/registries.d.ts +35 -0
  1848. package/node_modules/zod/v4/core/registries.js +51 -0
  1849. package/node_modules/zod/v4/core/schemas.cjs +2270 -0
  1850. package/node_modules/zod/v4/core/schemas.d.cts +1184 -0
  1851. package/node_modules/zod/v4/core/schemas.d.ts +1184 -0
  1852. package/node_modules/zod/v4/core/schemas.js +2239 -0
  1853. package/node_modules/zod/v4/core/standard-schema.cjs +2 -0
  1854. package/node_modules/zod/v4/core/standard-schema.d.cts +126 -0
  1855. package/node_modules/zod/v4/core/standard-schema.d.ts +126 -0
  1856. package/node_modules/zod/v4/core/standard-schema.js +1 -0
  1857. package/node_modules/zod/v4/core/to-json-schema.cjs +457 -0
  1858. package/node_modules/zod/v4/core/to-json-schema.d.cts +114 -0
  1859. package/node_modules/zod/v4/core/to-json-schema.d.ts +114 -0
  1860. package/node_modules/zod/v4/core/to-json-schema.js +448 -0
  1861. package/node_modules/zod/v4/core/util.cjs +734 -0
  1862. package/node_modules/zod/v4/core/util.d.cts +200 -0
  1863. package/node_modules/zod/v4/core/util.d.ts +200 -0
  1864. package/node_modules/zod/v4/core/util.js +674 -0
  1865. package/node_modules/zod/v4/core/versions.cjs +8 -0
  1866. package/node_modules/zod/v4/core/versions.d.cts +5 -0
  1867. package/node_modules/zod/v4/core/versions.d.ts +5 -0
  1868. package/node_modules/zod/v4/core/versions.js +5 -0
  1869. package/node_modules/zod/v4/index.cjs +22 -0
  1870. package/node_modules/zod/v4/index.d.cts +3 -0
  1871. package/node_modules/zod/v4/index.d.ts +3 -0
  1872. package/node_modules/zod/v4/index.js +3 -0
  1873. package/node_modules/zod/v4/locales/ar.cjs +133 -0
  1874. package/node_modules/zod/v4/locales/ar.d.cts +5 -0
  1875. package/node_modules/zod/v4/locales/ar.d.ts +4 -0
  1876. package/node_modules/zod/v4/locales/ar.js +106 -0
  1877. package/node_modules/zod/v4/locales/az.cjs +132 -0
  1878. package/node_modules/zod/v4/locales/az.d.cts +5 -0
  1879. package/node_modules/zod/v4/locales/az.d.ts +4 -0
  1880. package/node_modules/zod/v4/locales/az.js +105 -0
  1881. package/node_modules/zod/v4/locales/be.cjs +183 -0
  1882. package/node_modules/zod/v4/locales/be.d.cts +5 -0
  1883. package/node_modules/zod/v4/locales/be.d.ts +4 -0
  1884. package/node_modules/zod/v4/locales/be.js +156 -0
  1885. package/node_modules/zod/v4/locales/bg.cjs +147 -0
  1886. package/node_modules/zod/v4/locales/bg.d.cts +5 -0
  1887. package/node_modules/zod/v4/locales/bg.d.ts +4 -0
  1888. package/node_modules/zod/v4/locales/bg.js +120 -0
  1889. package/node_modules/zod/v4/locales/ca.cjs +134 -0
  1890. package/node_modules/zod/v4/locales/ca.d.cts +5 -0
  1891. package/node_modules/zod/v4/locales/ca.d.ts +4 -0
  1892. package/node_modules/zod/v4/locales/ca.js +107 -0
  1893. package/node_modules/zod/v4/locales/cs.cjs +138 -0
  1894. package/node_modules/zod/v4/locales/cs.d.cts +5 -0
  1895. package/node_modules/zod/v4/locales/cs.d.ts +4 -0
  1896. package/node_modules/zod/v4/locales/cs.js +111 -0
  1897. package/node_modules/zod/v4/locales/da.cjs +142 -0
  1898. package/node_modules/zod/v4/locales/da.d.cts +5 -0
  1899. package/node_modules/zod/v4/locales/da.d.ts +4 -0
  1900. package/node_modules/zod/v4/locales/da.js +115 -0
  1901. package/node_modules/zod/v4/locales/de.cjs +135 -0
  1902. package/node_modules/zod/v4/locales/de.d.cts +5 -0
  1903. package/node_modules/zod/v4/locales/de.d.ts +4 -0
  1904. package/node_modules/zod/v4/locales/de.js +108 -0
  1905. package/node_modules/zod/v4/locales/el.cjs +136 -0
  1906. package/node_modules/zod/v4/locales/el.d.cts +5 -0
  1907. package/node_modules/zod/v4/locales/el.d.ts +4 -0
  1908. package/node_modules/zod/v4/locales/el.js +109 -0
  1909. package/node_modules/zod/v4/locales/en.cjs +140 -0
  1910. package/node_modules/zod/v4/locales/en.d.cts +5 -0
  1911. package/node_modules/zod/v4/locales/en.d.ts +4 -0
  1912. package/node_modules/zod/v4/locales/en.js +113 -0
  1913. package/node_modules/zod/v4/locales/eo.cjs +136 -0
  1914. package/node_modules/zod/v4/locales/eo.d.cts +5 -0
  1915. package/node_modules/zod/v4/locales/eo.d.ts +4 -0
  1916. package/node_modules/zod/v4/locales/eo.js +109 -0
  1917. package/node_modules/zod/v4/locales/es.cjs +159 -0
  1918. package/node_modules/zod/v4/locales/es.d.cts +5 -0
  1919. package/node_modules/zod/v4/locales/es.d.ts +4 -0
  1920. package/node_modules/zod/v4/locales/es.js +132 -0
  1921. package/node_modules/zod/v4/locales/fa.cjs +141 -0
  1922. package/node_modules/zod/v4/locales/fa.d.cts +5 -0
  1923. package/node_modules/zod/v4/locales/fa.d.ts +4 -0
  1924. package/node_modules/zod/v4/locales/fa.js +114 -0
  1925. package/node_modules/zod/v4/locales/fi.cjs +139 -0
  1926. package/node_modules/zod/v4/locales/fi.d.cts +5 -0
  1927. package/node_modules/zod/v4/locales/fi.d.ts +4 -0
  1928. package/node_modules/zod/v4/locales/fi.js +112 -0
  1929. package/node_modules/zod/v4/locales/fr-CA.cjs +134 -0
  1930. package/node_modules/zod/v4/locales/fr-CA.d.cts +5 -0
  1931. package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
  1932. package/node_modules/zod/v4/locales/fr-CA.js +107 -0
  1933. package/node_modules/zod/v4/locales/fr.cjs +152 -0
  1934. package/node_modules/zod/v4/locales/fr.d.cts +5 -0
  1935. package/node_modules/zod/v4/locales/fr.d.ts +4 -0
  1936. package/node_modules/zod/v4/locales/fr.js +125 -0
  1937. package/node_modules/zod/v4/locales/he.cjs +241 -0
  1938. package/node_modules/zod/v4/locales/he.d.cts +5 -0
  1939. package/node_modules/zod/v4/locales/he.d.ts +4 -0
  1940. package/node_modules/zod/v4/locales/he.js +214 -0
  1941. package/node_modules/zod/v4/locales/hr.cjs +149 -0
  1942. package/node_modules/zod/v4/locales/hr.d.cts +5 -0
  1943. package/node_modules/zod/v4/locales/hr.d.ts +4 -0
  1944. package/node_modules/zod/v4/locales/hr.js +122 -0
  1945. package/node_modules/zod/v4/locales/hu.cjs +135 -0
  1946. package/node_modules/zod/v4/locales/hu.d.cts +5 -0
  1947. package/node_modules/zod/v4/locales/hu.d.ts +4 -0
  1948. package/node_modules/zod/v4/locales/hu.js +108 -0
  1949. package/node_modules/zod/v4/locales/hy.cjs +174 -0
  1950. package/node_modules/zod/v4/locales/hy.d.cts +5 -0
  1951. package/node_modules/zod/v4/locales/hy.d.ts +4 -0
  1952. package/node_modules/zod/v4/locales/hy.js +147 -0
  1953. package/node_modules/zod/v4/locales/id.cjs +133 -0
  1954. package/node_modules/zod/v4/locales/id.d.cts +5 -0
  1955. package/node_modules/zod/v4/locales/id.d.ts +4 -0
  1956. package/node_modules/zod/v4/locales/id.js +106 -0
  1957. package/node_modules/zod/v4/locales/index.cjs +111 -0
  1958. package/node_modules/zod/v4/locales/index.d.cts +52 -0
  1959. package/node_modules/zod/v4/locales/index.d.ts +52 -0
  1960. package/node_modules/zod/v4/locales/index.js +52 -0
  1961. package/node_modules/zod/v4/locales/is.cjs +136 -0
  1962. package/node_modules/zod/v4/locales/is.d.cts +5 -0
  1963. package/node_modules/zod/v4/locales/is.d.ts +4 -0
  1964. package/node_modules/zod/v4/locales/is.js +109 -0
  1965. package/node_modules/zod/v4/locales/it.cjs +135 -0
  1966. package/node_modules/zod/v4/locales/it.d.cts +5 -0
  1967. package/node_modules/zod/v4/locales/it.d.ts +4 -0
  1968. package/node_modules/zod/v4/locales/it.js +108 -0
  1969. package/node_modules/zod/v4/locales/ja.cjs +134 -0
  1970. package/node_modules/zod/v4/locales/ja.d.cts +5 -0
  1971. package/node_modules/zod/v4/locales/ja.d.ts +4 -0
  1972. package/node_modules/zod/v4/locales/ja.js +107 -0
  1973. package/node_modules/zod/v4/locales/ka.cjs +139 -0
  1974. package/node_modules/zod/v4/locales/ka.d.cts +5 -0
  1975. package/node_modules/zod/v4/locales/ka.d.ts +4 -0
  1976. package/node_modules/zod/v4/locales/ka.js +112 -0
  1977. package/node_modules/zod/v4/locales/kh.cjs +12 -0
  1978. package/node_modules/zod/v4/locales/kh.d.cts +5 -0
  1979. package/node_modules/zod/v4/locales/kh.d.ts +5 -0
  1980. package/node_modules/zod/v4/locales/kh.js +5 -0
  1981. package/node_modules/zod/v4/locales/km.cjs +137 -0
  1982. package/node_modules/zod/v4/locales/km.d.cts +5 -0
  1983. package/node_modules/zod/v4/locales/km.d.ts +4 -0
  1984. package/node_modules/zod/v4/locales/km.js +110 -0
  1985. package/node_modules/zod/v4/locales/ko.cjs +138 -0
  1986. package/node_modules/zod/v4/locales/ko.d.cts +5 -0
  1987. package/node_modules/zod/v4/locales/ko.d.ts +4 -0
  1988. package/node_modules/zod/v4/locales/ko.js +111 -0
  1989. package/node_modules/zod/v4/locales/lt.cjs +230 -0
  1990. package/node_modules/zod/v4/locales/lt.d.cts +5 -0
  1991. package/node_modules/zod/v4/locales/lt.d.ts +4 -0
  1992. package/node_modules/zod/v4/locales/lt.js +203 -0
  1993. package/node_modules/zod/v4/locales/mk.cjs +136 -0
  1994. package/node_modules/zod/v4/locales/mk.d.cts +5 -0
  1995. package/node_modules/zod/v4/locales/mk.d.ts +4 -0
  1996. package/node_modules/zod/v4/locales/mk.js +109 -0
  1997. package/node_modules/zod/v4/locales/ms.cjs +134 -0
  1998. package/node_modules/zod/v4/locales/ms.d.cts +5 -0
  1999. package/node_modules/zod/v4/locales/ms.d.ts +4 -0
  2000. package/node_modules/zod/v4/locales/ms.js +107 -0
  2001. package/node_modules/zod/v4/locales/nl.cjs +137 -0
  2002. package/node_modules/zod/v4/locales/nl.d.cts +5 -0
  2003. package/node_modules/zod/v4/locales/nl.d.ts +4 -0
  2004. package/node_modules/zod/v4/locales/nl.js +110 -0
  2005. package/node_modules/zod/v4/locales/no.cjs +135 -0
  2006. package/node_modules/zod/v4/locales/no.d.cts +5 -0
  2007. package/node_modules/zod/v4/locales/no.d.ts +4 -0
  2008. package/node_modules/zod/v4/locales/no.js +108 -0
  2009. package/node_modules/zod/v4/locales/ota.cjs +136 -0
  2010. package/node_modules/zod/v4/locales/ota.d.cts +5 -0
  2011. package/node_modules/zod/v4/locales/ota.d.ts +4 -0
  2012. package/node_modules/zod/v4/locales/ota.js +109 -0
  2013. package/node_modules/zod/v4/locales/package.json +7 -0
  2014. package/node_modules/zod/v4/locales/pl.cjs +136 -0
  2015. package/node_modules/zod/v4/locales/pl.d.cts +5 -0
  2016. package/node_modules/zod/v4/locales/pl.d.ts +4 -0
  2017. package/node_modules/zod/v4/locales/pl.js +109 -0
  2018. package/node_modules/zod/v4/locales/ps.cjs +141 -0
  2019. package/node_modules/zod/v4/locales/ps.d.cts +5 -0
  2020. package/node_modules/zod/v4/locales/ps.d.ts +4 -0
  2021. package/node_modules/zod/v4/locales/ps.js +114 -0
  2022. package/node_modules/zod/v4/locales/pt.cjs +135 -0
  2023. package/node_modules/zod/v4/locales/pt.d.cts +5 -0
  2024. package/node_modules/zod/v4/locales/pt.d.ts +4 -0
  2025. package/node_modules/zod/v4/locales/pt.js +108 -0
  2026. package/node_modules/zod/v4/locales/ro.cjs +146 -0
  2027. package/node_modules/zod/v4/locales/ro.d.cts +5 -0
  2028. package/node_modules/zod/v4/locales/ro.d.ts +4 -0
  2029. package/node_modules/zod/v4/locales/ro.js +119 -0
  2030. package/node_modules/zod/v4/locales/ru.cjs +183 -0
  2031. package/node_modules/zod/v4/locales/ru.d.cts +5 -0
  2032. package/node_modules/zod/v4/locales/ru.d.ts +4 -0
  2033. package/node_modules/zod/v4/locales/ru.js +156 -0
  2034. package/node_modules/zod/v4/locales/sl.cjs +136 -0
  2035. package/node_modules/zod/v4/locales/sl.d.cts +5 -0
  2036. package/node_modules/zod/v4/locales/sl.d.ts +4 -0
  2037. package/node_modules/zod/v4/locales/sl.js +109 -0
  2038. package/node_modules/zod/v4/locales/sv.cjs +137 -0
  2039. package/node_modules/zod/v4/locales/sv.d.cts +5 -0
  2040. package/node_modules/zod/v4/locales/sv.d.ts +4 -0
  2041. package/node_modules/zod/v4/locales/sv.js +110 -0
  2042. package/node_modules/zod/v4/locales/ta.cjs +137 -0
  2043. package/node_modules/zod/v4/locales/ta.d.cts +5 -0
  2044. package/node_modules/zod/v4/locales/ta.d.ts +4 -0
  2045. package/node_modules/zod/v4/locales/ta.js +110 -0
  2046. package/node_modules/zod/v4/locales/th.cjs +137 -0
  2047. package/node_modules/zod/v4/locales/th.d.cts +5 -0
  2048. package/node_modules/zod/v4/locales/th.d.ts +4 -0
  2049. package/node_modules/zod/v4/locales/th.js +110 -0
  2050. package/node_modules/zod/v4/locales/tr.cjs +132 -0
  2051. package/node_modules/zod/v4/locales/tr.d.cts +5 -0
  2052. package/node_modules/zod/v4/locales/tr.d.ts +4 -0
  2053. package/node_modules/zod/v4/locales/tr.js +105 -0
  2054. package/node_modules/zod/v4/locales/ua.cjs +12 -0
  2055. package/node_modules/zod/v4/locales/ua.d.cts +5 -0
  2056. package/node_modules/zod/v4/locales/ua.d.ts +5 -0
  2057. package/node_modules/zod/v4/locales/ua.js +5 -0
  2058. package/node_modules/zod/v4/locales/uk.cjs +135 -0
  2059. package/node_modules/zod/v4/locales/uk.d.cts +5 -0
  2060. package/node_modules/zod/v4/locales/uk.d.ts +4 -0
  2061. package/node_modules/zod/v4/locales/uk.js +108 -0
  2062. package/node_modules/zod/v4/locales/ur.cjs +137 -0
  2063. package/node_modules/zod/v4/locales/ur.d.cts +5 -0
  2064. package/node_modules/zod/v4/locales/ur.d.ts +4 -0
  2065. package/node_modules/zod/v4/locales/ur.js +110 -0
  2066. package/node_modules/zod/v4/locales/uz.cjs +137 -0
  2067. package/node_modules/zod/v4/locales/uz.d.cts +5 -0
  2068. package/node_modules/zod/v4/locales/uz.d.ts +4 -0
  2069. package/node_modules/zod/v4/locales/uz.js +110 -0
  2070. package/node_modules/zod/v4/locales/vi.cjs +135 -0
  2071. package/node_modules/zod/v4/locales/vi.d.cts +5 -0
  2072. package/node_modules/zod/v4/locales/vi.d.ts +4 -0
  2073. package/node_modules/zod/v4/locales/vi.js +108 -0
  2074. package/node_modules/zod/v4/locales/yo.cjs +134 -0
  2075. package/node_modules/zod/v4/locales/yo.d.cts +5 -0
  2076. package/node_modules/zod/v4/locales/yo.d.ts +4 -0
  2077. package/node_modules/zod/v4/locales/yo.js +107 -0
  2078. package/node_modules/zod/v4/locales/zh-CN.cjs +136 -0
  2079. package/node_modules/zod/v4/locales/zh-CN.d.cts +5 -0
  2080. package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
  2081. package/node_modules/zod/v4/locales/zh-CN.js +109 -0
  2082. package/node_modules/zod/v4/locales/zh-TW.cjs +134 -0
  2083. package/node_modules/zod/v4/locales/zh-TW.d.cts +5 -0
  2084. package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
  2085. package/node_modules/zod/v4/locales/zh-TW.js +107 -0
  2086. package/node_modules/zod/v4/mini/checks.cjs +34 -0
  2087. package/node_modules/zod/v4/mini/checks.d.cts +1 -0
  2088. package/node_modules/zod/v4/mini/checks.d.ts +1 -0
  2089. package/node_modules/zod/v4/mini/checks.js +1 -0
  2090. package/node_modules/zod/v4/mini/coerce.cjs +52 -0
  2091. package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
  2092. package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
  2093. package/node_modules/zod/v4/mini/coerce.js +22 -0
  2094. package/node_modules/zod/v4/mini/external.cjs +63 -0
  2095. package/node_modules/zod/v4/mini/external.d.cts +13 -0
  2096. package/node_modules/zod/v4/mini/external.d.ts +13 -0
  2097. package/node_modules/zod/v4/mini/external.js +14 -0
  2098. package/node_modules/zod/v4/mini/index.cjs +32 -0
  2099. package/node_modules/zod/v4/mini/index.d.cts +3 -0
  2100. package/node_modules/zod/v4/mini/index.d.ts +3 -0
  2101. package/node_modules/zod/v4/mini/index.js +3 -0
  2102. package/node_modules/zod/v4/mini/iso.cjs +64 -0
  2103. package/node_modules/zod/v4/mini/iso.d.cts +22 -0
  2104. package/node_modules/zod/v4/mini/iso.d.ts +22 -0
  2105. package/node_modules/zod/v4/mini/iso.js +34 -0
  2106. package/node_modules/zod/v4/mini/package.json +7 -0
  2107. package/node_modules/zod/v4/mini/parse.cjs +16 -0
  2108. package/node_modules/zod/v4/mini/parse.d.cts +1 -0
  2109. package/node_modules/zod/v4/mini/parse.d.ts +1 -0
  2110. package/node_modules/zod/v4/mini/parse.js +1 -0
  2111. package/node_modules/zod/v4/mini/schemas.cjs +1083 -0
  2112. package/node_modules/zod/v4/mini/schemas.d.cts +445 -0
  2113. package/node_modules/zod/v4/mini/schemas.d.ts +445 -0
  2114. package/node_modules/zod/v4/mini/schemas.js +961 -0
  2115. package/node_modules/zod/v4/package.json +7 -0
  2116. package/node_modules/zod/v4-mini/index.cjs +32 -0
  2117. package/node_modules/zod/v4-mini/index.d.cts +3 -0
  2118. package/node_modules/zod/v4-mini/index.d.ts +3 -0
  2119. package/node_modules/zod/v4-mini/index.js +3 -0
  2120. package/node_modules/zod/v4-mini/package.json +7 -0
  2121. package/openclaw.plugin.json +904 -0
  2122. package/package.json +139 -8
  2123. package/skills/imsg/SKILL.md +250 -0
@@ -0,0 +1,3521 @@
1
+ import { d as resolveIMessageChatDbLookupPath, f as resolveIMessageHomeDir, l as resolveIMessageRemoteHost, o as resolveIMessageAccount } from "./accounts-D00Njxg2.js";
2
+ import { b as imessageRpcSupportsMethod, c as parseIMessageAllowTarget, i as isAllowedIMessageReplyContextSender, l as parseIMessageTarget, n as formatIMessageChatTarget, s as normalizeIMessageHandle, y as getCachedIMessagePrivateApiStatus } from "./message-tool-api-TZiNYA17.js";
3
+ import { c as rememberIMessageReplyCache, f as getIMessageRuntime, s as isKnownFromMeIMessageMessageId, v as resolveIMessageDirectChatService } from "./monitor-reply-cache-BdeUQaHO.js";
4
+ import { o as createIMessageRpcClient, r as sanitizeOutboundText } from "./sanitize-outbound-DaLmdkbf.js";
5
+ import { r as resolveIMessageInboundConversationId, y as probeIMessage } from "./group-policy-Ca3c5KES.js";
6
+ import { n as resolveIMessageAttachmentRoots, r as resolveIMessageRemoteAttachmentRoots } from "./media-contract-BEgdvYhW.js";
7
+ import { a as resolveCatchupConfig, i as performIMessageCatchup, n as advanceIMessageCatchupCursor } from "./catchup-Dh-Rv4Ur.js";
8
+ import { c as stripLeadingEchoTextCorruptionMarkers, i as hasPersistedIMessageEcho, o as resolveIMessageEchoMediaKey } from "./persisted-echo-cache-DGxy-J4t.js";
9
+ import { i as registerIMessageApprovalReactionTarget, n as handleIMessageApprovalReaction, o as listPendingIMessageApprovalReactionPollTargets, r as maybeResolveIMessageApprovalReaction, s as buildIMessageApprovalConversationKeyForInbound } from "./approval-reactions-BME5eA6T.js";
10
+ import { a as maybeResolveIMessageApprovalPollVote, o as iMessageApprovalControlBindings, t as sendMessageIMessage } from "./send-Dake4Awx.js";
11
+ import { t as resolveIMessageReactionContext } from "./reaction-context-DaNrZqYo.js";
12
+ import { n as maybeResolveIMessageQuestionReaction, t as hasIMessageQuestionReactionTarget } from "./question-reactions-to0i8vxE.js";
13
+ import { bindIngressLifecycleToReplyOptions, createChannelIngressError, createChannelIngressMonitor, createChannelMessageReplyPipeline, createMessageReceiptFromOutboundResults, listMessageReceiptPlatformIds, resolveChannelStreamingBlockEnabled } from "openclaw/plugin-sdk/channel-outbound";
14
+ import { chunkMarkdownTextWithMode as chunkTextWithMode, resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-runtime";
15
+ import { resolveAgentRoute, resolveInboundLastRouteSessionKey } from "openclaw/plugin-sdk/routing";
16
+ import path from "node:path";
17
+ import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
18
+ import { asSafeIntegerInRange, hasNonEmptyString, isRecord, normalizeOptionalString, normalizeStringEntries, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
19
+ import fs from "node:fs/promises";
20
+ import { createNonExitingRuntime, danger, logVerbose, shouldLogVerbose, warn } from "openclaw/plugin-sdk/runtime-env";
21
+ import { asDateTimestampMs, asPositiveFiniteNumber, parseDateStringTimestampMs, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
22
+ import { createHash } from "node:crypto";
23
+ import { getRuntimeConfig } from "openclaw/plugin-sdk/runtime-config-snapshot";
24
+ import { sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
25
+ import { collectErrorGraphCandidates, formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
26
+ import { isInboundPathAllowed, kindFromMime } from "openclaw/plugin-sdk/media-runtime";
27
+ import { convertMarkdownTables as convertMarkdownTables$1, findCodeRegions, isInsideCode, sanitizeTerminalText } from "openclaw/plugin-sdk/text-chunking";
28
+ import { buildChannelGroupsScopeTree, resolveChannelGroupPolicy, resolveScopeRequireMention } from "openclaw/plugin-sdk/channel-policy";
29
+ import { buildChannelInboundEventContext, buildMentionRegexes, createChannelInboundDebouncer, createChannelPartialDeliveryError, filterChannelInboundQuoteContext, formatInboundEnvelope, formatInboundFromLabel, formatInboundMediaUnavailableText, formatMediaPlaceholderText, isChannelPartialDeliveryError, logInboundDrop, matchesMentionPatterns, resolveEnvelopeFormatOptions, resolveInboundMentionDecision, resolveInboundSupplementalSenderAllowed, runChannelInboundEvent, shouldDebounceTextInbound, toInboundMediaFactsWithMetadata } from "openclaw/plugin-sdk/channel-inbound";
30
+ import { openLocalFileSafely, resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime";
31
+ import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
32
+ import { resolveAgentConfig, resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
33
+ import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plugin-sdk/approval-handler-runtime";
34
+ import { logTypingFailure } from "openclaw/plugin-sdk/channel-feedback";
35
+ import { createChannelIngressResolver, defineStableChannelIngressIdentity, fanInChannelIngressLifecycles } from "openclaw/plugin-sdk/channel-ingress-runtime";
36
+ import { createChannelPairingChallengeIssuer } from "openclaw/plugin-sdk/channel-pairing";
37
+ import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runtime-context";
38
+ import { ensureConfiguredBindingRouteReady, readChannelAllowFromStore, resolveConfiguredBindingRoute, resolveRuntimeConversationBindingRoute, upsertChannelPairingRequest } from "openclaw/plugin-sdk/conversation-runtime";
39
+ import { channelReadyPatch } from "openclaw/plugin-sdk/gateway-runtime";
40
+ import { redactIdentifier } from "openclaw/plugin-sdk/logging-core";
41
+ import { DEFAULT_GROUP_HISTORY_LIMIT, createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
42
+ import { resolveDefaultGroupPolicy, resolveOpenProviderRuntimeGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
43
+ import { getSessionEntry, readSessionUpdatedAt, resolveSendPolicy, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
44
+ import { openNodeSqliteDatabase } from "openclaw/plugin-sdk/sqlite-runtime";
45
+ import { waitForTransportReady } from "openclaw/plugin-sdk/transport-ready-runtime";
46
+ import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
47
+ import { resolveMarkdownTableMode as resolveMarkdownTableMode$1 } from "openclaw/plugin-sdk/markdown-table-runtime";
48
+ import { resolvePreferredOpenClawTmpDir, withTempWorkspace } from "openclaw/plugin-sdk/temp-path";
49
+ import { deliverTextOrMediaReply, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
50
+ import { createDedupeCache } from "openclaw/plugin-sdk/dedupe-runtime";
51
+ import { hasControlCommand } from "openclaw/plugin-sdk/command-auth-native";
52
+ import { resolveChannelContextVisibilityMode } from "openclaw/plugin-sdk/context-visibility-runtime";
53
+ import { isRecord as isRecord$1 } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
54
+ import { saveMediaBuffer } from "openclaw/plugin-sdk/media-store";
55
+ import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
56
+ import { enqueueSystemEvent } from "openclaw/plugin-sdk/system-event-runtime";
57
+ //#region extensions/imessage/src/approval-reaction-poller.ts
58
+ const RECENT_CHAT_LIMIT = 50;
59
+ const PER_CHAT_HISTORY_LIMIT = 30;
60
+ function normalizeChatId(value) {
61
+ return asPositiveFiniteNumber(value) ?? null;
62
+ }
63
+ function listTargetChatIds(targets) {
64
+ const chatIds = /* @__PURE__ */ new Set();
65
+ for (const target of targets) {
66
+ const chatId = normalizeChatId(target.conversation.chatId);
67
+ if (chatId !== null) chatIds.add(chatId);
68
+ }
69
+ return [...chatIds];
70
+ }
71
+ function hasUnscopedTarget(targets) {
72
+ return targets.some((target) => normalizeChatId(target.conversation.chatId) === null);
73
+ }
74
+ function uniqueChatIds(chatIds) {
75
+ return [...new Set(chatIds)];
76
+ }
77
+ function normalizeMessageGuid(value) {
78
+ return value.trim().replace(/^p:\d+\//iu, "");
79
+ }
80
+ function enumerateMessageGuidCandidates(value) {
81
+ const trimmed = value.trim();
82
+ if (!trimmed) return [];
83
+ return [trimmed, normalizeMessageGuid(trimmed)].filter((candidate, index, candidates) => candidate.length > 0 && candidates.indexOf(candidate) === index);
84
+ }
85
+ function buildPendingTargetsByMessageId(targets) {
86
+ const pendingByMessageId = /* @__PURE__ */ new Map();
87
+ for (const target of targets) for (const candidate of enumerateMessageGuidCandidates(target.messageId)) pendingByMessageId.set(candidate, target);
88
+ return pendingByMessageId;
89
+ }
90
+ async function listRecentChatIds(client) {
91
+ return ((await client.request("chats.list", { limit: RECENT_CHAT_LIMIT }, { timeoutMs: 1e4 })).chats ?? []).map((chat) => normalizeChatId(chat.id)).filter((chatId) => chatId !== null);
92
+ }
93
+ async function fetchRecentHistory(params) {
94
+ return ((await params.client.request("messages.history", {
95
+ chat_id: params.chatId,
96
+ limit: PER_CHAT_HISTORY_LIMIT
97
+ }, { timeoutMs: 1e4 })).messages ?? []).filter((message) => Boolean(message && typeof message === "object"));
98
+ }
99
+ function buildReactionPayload(params) {
100
+ const emoji = params.reaction.emoji?.trim();
101
+ const sender = params.reaction.sender?.trim();
102
+ const targetGuid = params.targetMessage.guid?.trim();
103
+ if (!emoji || !sender || !targetGuid) return null;
104
+ const reactionId = normalizeChatId(params.reaction.id);
105
+ return {
106
+ ...reactionId !== null ? { id: reactionId } : {},
107
+ guid: `reaction:${targetGuid}:${sender}:${emoji}:${params.reaction.created_at ?? ""}`,
108
+ chat_id: params.targetMessage.chat_id,
109
+ chat_guid: params.targetMessage.chat_guid,
110
+ chat_identifier: params.targetMessage.chat_identifier,
111
+ chat_name: params.targetMessage.chat_name,
112
+ participants: params.targetMessage.participants,
113
+ is_group: params.targetMessage.is_group,
114
+ sender,
115
+ destination_caller_id: params.targetMessage.destination_caller_id,
116
+ is_from_me: params.reaction.is_from_me,
117
+ text: `${params.reaction.type ?? "reaction"} "${params.targetMessage.text ?? ""}"`,
118
+ created_at: params.reaction.created_at,
119
+ is_reaction: true,
120
+ is_tapback: true,
121
+ associated_message_guid: targetGuid,
122
+ associated_message_type: 2e3,
123
+ reaction_type: params.reaction.type ?? void 0,
124
+ reaction_emoji: emoji,
125
+ is_reaction_add: true,
126
+ reacted_to_guid: targetGuid
127
+ };
128
+ }
129
+ function buildConversationKeyFromMessage(message) {
130
+ return {
131
+ ...message.chat_guid?.trim() ? { chatGuid: message.chat_guid.trim() } : {},
132
+ ...message.chat_identifier?.trim() ? { chatIdentifier: message.chat_identifier.trim() } : {},
133
+ ...normalizeChatId(message.chat_id) !== null ? { chatId: message.chat_id } : {}
134
+ };
135
+ }
136
+ function bindObservedConversation(params) {
137
+ const nowMs = asDateTimestampMs(Date.now());
138
+ const expiresAtMs = asDateTimestampMs(params.target.expiresAtMs);
139
+ if (nowMs === void 0 || expiresAtMs === void 0 || expiresAtMs <= nowMs) return;
140
+ const ttlMs = expiresAtMs - nowMs;
141
+ const conversation = buildConversationKeyFromMessage(params.message);
142
+ const messageIds = /* @__PURE__ */ new Set([...enumerateMessageGuidCandidates(params.target.messageId), ...enumerateMessageGuidCandidates(params.message.guid ?? "")]);
143
+ for (const messageId of messageIds) registerIMessageApprovalReactionTarget({
144
+ accountId: params.target.accountId,
145
+ conversation,
146
+ messageId,
147
+ approvalId: params.target.approvalId,
148
+ approvalKind: params.target.approvalKind,
149
+ allowedDecisions: params.target.allowedDecisions,
150
+ ttlMs
151
+ });
152
+ }
153
+ async function pollPendingIMessageApprovalReactions(params) {
154
+ const targets = await listPendingIMessageApprovalReactionPollTargets({ accountId: params.accountId });
155
+ if (targets.length === 0) return;
156
+ const pendingByMessageId = buildPendingTargetsByMessageId(targets);
157
+ const explicitChatIds = listTargetChatIds(targets);
158
+ const chatIds = params.allowRecentChatDiscovery === true && targets.length > 0 && hasUnscopedTarget(targets) ? uniqueChatIds([...explicitChatIds, ...await listRecentChatIds(params.client)]) : explicitChatIds;
159
+ if (chatIds.length === 0) return;
160
+ for (const chatId of chatIds) {
161
+ let messages;
162
+ try {
163
+ messages = await fetchRecentHistory({
164
+ client: params.client,
165
+ chatId
166
+ });
167
+ } catch (err) {
168
+ params.logVerboseMessage?.(`imessage: approval reaction poll skipped chat_id=${chatId}: ${String(err)}`);
169
+ continue;
170
+ }
171
+ for (const message of messages) {
172
+ const targetGuid = message.guid?.trim();
173
+ if (!targetGuid) continue;
174
+ const target = pendingByMessageId.get(targetGuid) ?? pendingByMessageId.get(normalizeMessageGuid(targetGuid));
175
+ if (!target) continue;
176
+ bindObservedConversation({
177
+ target,
178
+ message
179
+ });
180
+ for (const reaction of message.reactions ?? []) {
181
+ const reactionPayload = buildReactionPayload({
182
+ targetMessage: message,
183
+ reaction
184
+ });
185
+ if (!reactionPayload) continue;
186
+ if ((await handleIMessageApprovalReaction({
187
+ cfg: params.cfg,
188
+ accountId: params.accountId,
189
+ message: reactionPayload,
190
+ bodyText: reactionPayload.text ?? "",
191
+ gatewayRuntime: params.gatewayRuntime,
192
+ logVerboseMessage: params.logVerboseMessage
193
+ })).stopPolling) return;
194
+ }
195
+ }
196
+ }
197
+ }
198
+ //#endregion
199
+ //#region extensions/imessage/src/chat.ts
200
+ function buildChatTargetParams(to, opts) {
201
+ const cfg = requireRuntimeConfig(opts.cfg, "iMessage chat action");
202
+ const account = opts.account ?? resolveIMessageAccount({
203
+ cfg,
204
+ accountId: opts.accountId
205
+ });
206
+ const target = parseIMessageTarget(opts.chatId ? formatIMessageChatTarget(opts.chatId) : to);
207
+ const params = {};
208
+ if (target.kind === "chat_id") params.chat_id = target.chatId;
209
+ else if (target.kind === "chat_guid") params.chat_guid = target.chatGuid;
210
+ else if (target.kind === "chat_identifier") params.chat_identifier = target.chatIdentifier;
211
+ else params.to = target.to;
212
+ return {
213
+ params,
214
+ service: opts.service ?? (target.kind === "handle" ? target.service : void 0) ?? account.config.service,
215
+ region: opts.region?.trim() || account.config.region?.trim() || "US",
216
+ account
217
+ };
218
+ }
219
+ async function runChatAction(method, params, opts) {
220
+ const cfg = requireRuntimeConfig(opts.cfg, "iMessage chat action");
221
+ const account = opts.account ?? resolveIMessageAccount({
222
+ cfg,
223
+ accountId: opts.accountId
224
+ });
225
+ const cliPath = opts.cliPath?.trim() || account.config.cliPath?.trim() || "imsg";
226
+ const dbPath = opts.dbPath?.trim() || account.config.dbPath?.trim();
227
+ const remoteHost = await resolveIMessageRemoteHost({
228
+ cliPath,
229
+ remoteHost: opts.remoteHost ?? account.config.remoteHost
230
+ });
231
+ const client = opts.client ?? await createIMessageRpcClient({
232
+ cliPath,
233
+ dbPath,
234
+ remoteHost
235
+ });
236
+ const shouldClose = !opts.client;
237
+ try {
238
+ return await client.request(method, params, { timeoutMs: opts.timeoutMs });
239
+ } finally {
240
+ if (shouldClose) await client.stop();
241
+ }
242
+ }
243
+ async function sendIMessageTyping(to, isTyping, opts) {
244
+ const { params, service } = buildChatTargetParams(to, opts);
245
+ params.typing = isTyping;
246
+ if (service) params.service = service;
247
+ await runChatAction("typing", params, opts);
248
+ }
249
+ async function markIMessageChatRead(to, opts) {
250
+ const { params } = buildChatTargetParams(to, opts);
251
+ await runChatAction("read", params, opts);
252
+ }
253
+ //#endregion
254
+ //#region extensions/imessage/src/monitor/abort-handler.ts
255
+ function attachIMessageMonitorAbortHandler(params) {
256
+ const abort = params.abortSignal;
257
+ if (!abort) return () => {};
258
+ const onAbort = () => {
259
+ const subscriptionId = params.getSubscriptionId();
260
+ if (subscriptionId) params.client.request("watch.unsubscribe", { subscription: subscriptionId }).catch(() => {});
261
+ params.client.stop().catch(() => {});
262
+ };
263
+ abort.addEventListener("abort", onAbort, { once: true });
264
+ return () => abort.removeEventListener("abort", onAbort);
265
+ }
266
+ //#endregion
267
+ //#region extensions/imessage/src/monitor/strip-imsg-length-prefixed-text.ts
268
+ const utf8Decoder = new TextDecoder();
269
+ function readVarint(buf, start) {
270
+ let offset = start;
271
+ let value = 0;
272
+ let shift = 0;
273
+ while (offset < buf.length && shift <= 28) {
274
+ const byte = buf[offset];
275
+ if (byte === void 0) return null;
276
+ offset += 1;
277
+ value |= (byte & 127) << shift;
278
+ if ((byte & 128) === 0) return {
279
+ nextOffset: offset,
280
+ value
281
+ };
282
+ shift += 7;
283
+ }
284
+ return null;
285
+ }
286
+ function tryStripImessageLengthPrefixedUtf8Buffer(buf) {
287
+ const key = readVarint(buf, 0);
288
+ if (!key || key.nextOffset >= buf.length) return null;
289
+ if (key.value !== 10) return null;
290
+ const length = readVarint(buf, key.nextOffset);
291
+ if (!length || length.value === 0) return null;
292
+ if (length.nextOffset + length.value !== buf.length) return null;
293
+ return buf.subarray(length.nextOffset, buf.length);
294
+ }
295
+ function stripImessageLengthPrefixedUtf8Text(text) {
296
+ if (!text) return text;
297
+ const stripped = tryStripImessageLengthPrefixedUtf8Buffer(Buffer.from(text, "utf8"));
298
+ if (!stripped) return text;
299
+ const inner = utf8Decoder.decode(stripped);
300
+ return inner.length > 0 ? inner : text;
301
+ }
302
+ //#endregion
303
+ //#region extensions/imessage/src/monitor/parse-notification.ts
304
+ function isOptionalString(value) {
305
+ return value === void 0 || value === null || typeof value === "string";
306
+ }
307
+ function isOptionalStringOrNumber(value) {
308
+ return value === void 0 || value === null || typeof value === "string" || typeof value === "number";
309
+ }
310
+ function isOptionalNumber(value) {
311
+ return value === void 0 || value === null || typeof value === "number";
312
+ }
313
+ function isOptionalBoolean(value) {
314
+ return value === void 0 || value === null || typeof value === "boolean";
315
+ }
316
+ function isOptionalStringArray(value) {
317
+ return value === void 0 || value === null || Array.isArray(value) && value.every((entry) => typeof entry === "string");
318
+ }
319
+ function isOptionalAttachments(value) {
320
+ if (value === void 0 || value === null) return true;
321
+ if (!Array.isArray(value)) return false;
322
+ return value.every((attachment) => {
323
+ if (!isRecord(attachment)) return false;
324
+ return isOptionalString(attachment.original_path) && isOptionalString(attachment.mime_type) && isOptionalBoolean(attachment.missing) && isOptionalString(attachment.transfer_name) && isOptionalString(attachment.uti);
325
+ });
326
+ }
327
+ function parseIMessageNotification(raw) {
328
+ if (!isRecord(raw)) return null;
329
+ const maybeMessage = raw.message;
330
+ if (!isRecord(maybeMessage)) return null;
331
+ const message = maybeMessage;
332
+ 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) || !isOptionalStringOrNumber(message.reply_to_id) || !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;
333
+ return {
334
+ ...message,
335
+ text: typeof message.text === "string" ? stripImessageLengthPrefixedUtf8Text(message.text) : message.text,
336
+ reply_to_text: typeof message.reply_to_text === "string" ? stripImessageLengthPrefixedUtf8Text(message.reply_to_text) : message.reply_to_text
337
+ };
338
+ }
339
+ //#endregion
340
+ //#region extensions/imessage/src/monitor/catchup-bridge.ts
341
+ const PER_CHAT_HISTORY_LIMIT_CAP = 500;
342
+ const CATCHUP_CHATS_LIST_LIMIT = 200;
343
+ const CATCHUP_RPC_TIMEOUT_MS = 3e4;
344
+ /**
345
+ * Wire `performIMessageCatchup` against the live `imsg` JSON-RPC client.
346
+ *
347
+ * Catchup recovers messages that landed in `chat.db` while the gateway was
348
+ * offline (crash, restart, mac sleep) by:
349
+ * 1. listing recently-active chats via `chats.list`,
350
+ * 2. fetching per-chat history since the cursor via `messages.history`,
351
+ * 3. sorting cross-chat by `rowid`, capping at `perRunLimit`,
352
+ * 4. admitting each row through the same durable GUID queue used by live
353
+ * notifications, so replay, coalescing, echo, and receipt behavior match.
354
+ *
355
+ * Runs at most once per `monitorIMessageProvider` invocation, between
356
+ * `watch.subscribe` and the live dispatch loop. Anything that arrives during
357
+ * catchup itself flows through live admission; queue tombstones reject overlap.
358
+ */
359
+ async function runIMessageCatchup(params) {
360
+ const { client, accountId, config, includeAttachments, dispatchPayload, runtime } = params;
361
+ const log = (msg) => runtime?.log?.(msg);
362
+ const warnLog = (msg) => runtime?.log?.(warn(msg));
363
+ const payloadByGuid = /* @__PURE__ */ new Map();
364
+ const fetchFn = async ({ sinceMs, sinceRowid, limit }) => {
365
+ const sinceISO = timestampMsToIsoString(sinceMs);
366
+ if (!sinceISO) {
367
+ warnLog(`imessage catchup: invalid since timestamp ${sinceMs}`);
368
+ return {
369
+ resolved: false,
370
+ rows: []
371
+ };
372
+ }
373
+ let chatsResult;
374
+ try {
375
+ chatsResult = await client.request("chats.list", { limit: CATCHUP_CHATS_LIST_LIMIT }, { timeoutMs: CATCHUP_RPC_TIMEOUT_MS });
376
+ } catch (err) {
377
+ warnLog(`imessage catchup: chats.list failed: ${String(err)}`);
378
+ return {
379
+ resolved: false,
380
+ rows: []
381
+ };
382
+ }
383
+ const chats = chatsResult?.chats ?? [];
384
+ const collected = [];
385
+ const perChatLimit = Math.min(limit, PER_CHAT_HISTORY_LIMIT_CAP);
386
+ let historyFetchFailed = false;
387
+ let rawWatermarkRowid = -Infinity;
388
+ let rawWatermarkMs = -Infinity;
389
+ for (const chat of chats) {
390
+ const chatId = typeof chat.id === "number" && Number.isFinite(chat.id) ? chat.id : null;
391
+ if (chatId === null) continue;
392
+ const lastMs = typeof chat.last_message_at === "string" ? Date.parse(chat.last_message_at) : NaN;
393
+ if (Number.isFinite(lastMs) && lastMs < sinceMs) continue;
394
+ let historyResult;
395
+ try {
396
+ historyResult = await client.request("messages.history", {
397
+ chat_id: chatId,
398
+ limit: perChatLimit,
399
+ start: sinceISO,
400
+ attachments: includeAttachments
401
+ }, { timeoutMs: CATCHUP_RPC_TIMEOUT_MS });
402
+ } catch (err) {
403
+ historyFetchFailed = true;
404
+ warnLog(`imessage catchup: messages.history failed for chat_id=${chatId}: ${String(err)}`);
405
+ continue;
406
+ }
407
+ const messages = Array.isArray(historyResult?.messages) ? historyResult.messages : [];
408
+ for (const raw of messages) {
409
+ const rawRecord = raw && typeof raw === "object" ? raw : null;
410
+ const rawRowid = rawRecord && typeof rawRecord.id === "number" && Number.isFinite(rawRecord.id) ? rawRecord.id : null;
411
+ const rawCreatedAt = rawRecord && typeof rawRecord.created_at === "string" ? rawRecord.created_at : null;
412
+ const rawDateMs = rawCreatedAt ? Date.parse(rawCreatedAt) : NaN;
413
+ if (rawRowid !== null) rawWatermarkRowid = Math.max(rawWatermarkRowid, rawRowid);
414
+ if (Number.isFinite(rawDateMs)) rawWatermarkMs = Math.max(rawWatermarkMs, rawDateMs);
415
+ const payload = parseIMessageNotification({ message: raw });
416
+ if (!payload) continue;
417
+ const guid = payload.guid?.trim();
418
+ const rowid = typeof payload.id === "number" ? payload.id : null;
419
+ const dateMs = typeof payload.created_at === "string" ? Date.parse(payload.created_at) : NaN;
420
+ if (!guid || rowid === null || !Number.isFinite(rowid) || !Number.isFinite(dateMs)) continue;
421
+ if (rowid <= sinceRowid) continue;
422
+ collected.push({
423
+ guid,
424
+ rowid,
425
+ date: dateMs,
426
+ isFromMe: payload.is_from_me === true
427
+ });
428
+ payloadByGuid.set(guid, {
429
+ message: payload,
430
+ rawEnvelope: { message: raw }
431
+ });
432
+ }
433
+ }
434
+ const sorted = collected.toSorted((a, b) => a.rowid - b.rowid);
435
+ const capped = sorted.slice(0, limit);
436
+ const isCapTruncated = capped.length < sorted.length;
437
+ if (isCapTruncated) {
438
+ warnLog(`imessage catchup: fetched ${sorted.length} rows across chats, capped to perRunLimit=${limit} (oldest first); next startup picks up the rest`);
439
+ const keep = new Set(capped.map((row) => row.guid));
440
+ for (const guid of payloadByGuid.keys()) if (!keep.has(guid)) payloadByGuid.delete(guid);
441
+ }
442
+ let effectiveWatermarkRowid = rawWatermarkRowid;
443
+ let effectiveWatermarkMs = rawWatermarkMs;
444
+ if (isCapTruncated && capped.length > 0) {
445
+ const last = capped.at(-1);
446
+ if (last) {
447
+ effectiveWatermarkRowid = Math.min(effectiveWatermarkRowid, last.rowid);
448
+ effectiveWatermarkMs = Math.min(effectiveWatermarkMs, last.date);
449
+ }
450
+ } else if (isCapTruncated && capped.length === 0) {
451
+ effectiveWatermarkRowid = NaN;
452
+ effectiveWatermarkMs = NaN;
453
+ }
454
+ return {
455
+ resolved: true,
456
+ rows: capped,
457
+ fullyCaughtUp: !historyFetchFailed && !isCapTruncated,
458
+ ...Number.isFinite(effectiveWatermarkRowid) ? { highWatermarkRowid: effectiveWatermarkRowid } : {},
459
+ ...Number.isFinite(effectiveWatermarkMs) ? { highWatermarkMs: effectiveWatermarkMs } : {}
460
+ };
461
+ };
462
+ const dispatchFn = async (row) => {
463
+ const entry = payloadByGuid.get(row.guid);
464
+ if (!entry) {
465
+ warnLog(`imessage catchup: missing payload for guid=${row.guid}, skipping`);
466
+ return { ok: false };
467
+ }
468
+ try {
469
+ await dispatchPayload(entry.message, entry.rawEnvelope);
470
+ return { ok: true };
471
+ } catch (err) {
472
+ warnLog(`imessage catchup: dispatch threw for guid=${row.guid}: ${String(err)}`);
473
+ return { ok: false };
474
+ }
475
+ };
476
+ return await performIMessageCatchup({
477
+ accountId,
478
+ config,
479
+ fetch: fetchFn,
480
+ dispatch: dispatchFn,
481
+ observeSkippedFromMe: async (row) => {
482
+ const entry = payloadByGuid.get(row.guid);
483
+ if (!entry) {
484
+ warnLog(`imessage catchup: missing skipped from-me payload for guid=${row.guid}`);
485
+ return;
486
+ }
487
+ await params.observeSkippedFromMePayload?.(entry.message);
488
+ },
489
+ log,
490
+ warn: warnLog,
491
+ ...params.now ? { now: params.now() } : {}
492
+ });
493
+ }
494
+ //#endregion
495
+ //#region extensions/imessage/src/monitor/coalesce.ts
496
+ /**
497
+ * Bounds on the merged output when multiple inbound iMessage payloads are
498
+ * folded into one agent turn. Caps each merge so a sender who
499
+ * rapid-fires DMs inside the debounce window cannot amplify the downstream
500
+ * prompt past a safe ceiling. Every source GUID still surfaces via
501
+ * `coalescedMessageGuids` so a future replay path can recognize duplicates.
502
+ */
503
+ const MAX_COALESCED_TEXT_CHARS = 4e3;
504
+ const MAX_COALESCED_ATTACHMENTS = 20;
505
+ const MAX_COALESCED_ENTRIES = 10;
506
+ /**
507
+ * Combine consecutive same-sender iMessage payloads into a single payload for
508
+ * downstream dispatch. Used for the general inbound debounce
509
+ * (`messages.inbound`, off by default) when configured.
510
+ *
511
+ * The first payload anchors the merged shape (preserving its GUID for reply
512
+ * threading). Text is concatenated with deduplication, attachments are merged
513
+ * (capped), and the latest `created_at` wins so downstream sees the most
514
+ * recent activity timestamp.
515
+ */
516
+ function combineIMessagePayloads(payloads) {
517
+ if (payloads.length === 0) throw new Error("combineIMessagePayloads: cannot combine empty payloads");
518
+ const first = expectDefined(payloads[0], "first iMessage payload to coalesce");
519
+ if (payloads.length === 1) return first;
520
+ const last = expectDefined(payloads.at(-1), "last iMessage payload to coalesce");
521
+ const boundedPayloads = payloads.length > MAX_COALESCED_ENTRIES ? [...payloads.slice(0, MAX_COALESCED_ENTRIES - 1), last] : payloads;
522
+ const seenTexts = /* @__PURE__ */ new Set();
523
+ const textParts = [];
524
+ for (const payload of boundedPayloads) {
525
+ const text = (payload.text ?? "").trim();
526
+ if (!text) continue;
527
+ const normalized = text.toLowerCase();
528
+ if (seenTexts.has(normalized)) continue;
529
+ seenTexts.add(normalized);
530
+ textParts.push(text);
531
+ }
532
+ let combinedText = textParts.join(" ");
533
+ if (combinedText.length > MAX_COALESCED_TEXT_CHARS) combinedText = `${sliceUtf16Safe(combinedText, 0, MAX_COALESCED_TEXT_CHARS)}…[truncated]`;
534
+ const allAttachments = boundedPayloads.flatMap((p) => p.attachments ?? []).slice(0, MAX_COALESCED_ATTACHMENTS);
535
+ const createdAts = payloads.map((p) => p.created_at).filter((c) => typeof c === "string" && c.length > 0);
536
+ const latestCreatedAt = createdAts.length > 0 ? createdAts.reduce((a, b) => a > b ? a : b) : first.created_at;
537
+ let maxRowid = -Infinity;
538
+ let maxDateMs = -Infinity;
539
+ for (const payload of payloads) {
540
+ if (typeof payload.id === "number" && Number.isFinite(payload.id)) maxRowid = Math.max(maxRowid, payload.id);
541
+ const dateMs = typeof payload.created_at === "string" ? Date.parse(payload.created_at) : NaN;
542
+ if (Number.isFinite(dateMs)) maxDateMs = Math.max(maxDateMs, dateMs);
543
+ }
544
+ const seenGuids = /* @__PURE__ */ new Set();
545
+ const coalescedMessageGuids = [];
546
+ for (const payload of payloads) {
547
+ const guid = payload.guid?.trim();
548
+ if (!guid || seenGuids.has(guid)) continue;
549
+ seenGuids.add(guid);
550
+ coalescedMessageGuids.push(guid);
551
+ }
552
+ const entryWithReply = payloads.find((p) => p.reply_to_id != null);
553
+ return {
554
+ ...first,
555
+ text: combinedText,
556
+ attachments: allAttachments.length > 0 ? allAttachments : null,
557
+ created_at: latestCreatedAt,
558
+ reply_to_id: entryWithReply?.reply_to_id ?? first.reply_to_id ?? null,
559
+ reply_to_text: entryWithReply?.reply_to_text ?? first.reply_to_text ?? null,
560
+ reply_to_sender: entryWithReply?.reply_to_sender ?? first.reply_to_sender ?? null,
561
+ coalescedMessageGuids: coalescedMessageGuids.length > 0 ? coalescedMessageGuids : void 0,
562
+ coalescedCatchupCursor: Number.isFinite(maxRowid) && Number.isFinite(maxDateMs) ? {
563
+ lastSeenMs: maxDateMs,
564
+ lastSeenRowid: maxRowid
565
+ } : void 0
566
+ };
567
+ }
568
+ //#endregion
569
+ //#region extensions/imessage/src/monitor/conversation-repair.ts
570
+ const DEFAULT_CHATS_LIMIT = 20;
571
+ const DEFAULT_PER_CHAT_HISTORY_LIMIT = 50;
572
+ const DEFAULT_RPC_TIMEOUT_MS = 5e3;
573
+ function hasPositiveChatId(value) {
574
+ return typeof value === "number" && Number.isFinite(value) && value > 0;
575
+ }
576
+ function isExplicitEmptyString(value) {
577
+ return typeof value === "string" && value.trim() === "";
578
+ }
579
+ function hasUsableConversationAnchor(projection) {
580
+ return hasPositiveChatId(projection.chat_id) || hasNonEmptyString(projection.chat_guid) || hasNonEmptyString(projection.chat_identifier);
581
+ }
582
+ function isIMessageAnchorless(message) {
583
+ if (hasPositiveChatId(message.chat_id) || hasNonEmptyString(message.chat_guid) || hasNonEmptyString(message.chat_identifier)) return false;
584
+ return message.chat_id === null || typeof message.chat_id === "number" && (!Number.isFinite(message.chat_id) || message.chat_id <= 0) || isExplicitEmptyString(message.chat_guid) || isExplicitEmptyString(message.chat_identifier);
585
+ }
586
+ function extractAuthoritativeRecoveryProjection(entry) {
587
+ if (typeof entry.is_group !== "boolean" || typeof entry.is_from_me !== "boolean") return null;
588
+ if (!hasNonEmptyString(entry.sender)) return null;
589
+ const projection = {
590
+ sender: entry.sender.trim(),
591
+ is_from_me: entry.is_from_me,
592
+ is_group: entry.is_group
593
+ };
594
+ if (hasNonEmptyString(entry.destination_caller_id)) projection.destination_caller_id = entry.destination_caller_id.trim();
595
+ if (hasPositiveChatId(entry.chat_id)) projection.chat_id = entry.chat_id;
596
+ if (hasNonEmptyString(entry.chat_guid)) projection.chat_guid = entry.chat_guid;
597
+ if (hasNonEmptyString(entry.chat_identifier)) projection.chat_identifier = entry.chat_identifier;
598
+ if (typeof entry.chat_name === "string") projection.chat_name = entry.chat_name;
599
+ if (Array.isArray(entry.participants) && entry.participants.every((participant) => typeof participant === "string")) projection.participants = entry.participants;
600
+ return hasUsableConversationAnchor(projection) ? projection : null;
601
+ }
602
+ function projectionConflictKey(projection) {
603
+ return JSON.stringify({
604
+ chat_id: projection.chat_id ?? null,
605
+ chat_guid: projection.chat_guid ?? null,
606
+ chat_identifier: projection.chat_identifier ?? null,
607
+ is_group: projection.is_group,
608
+ sender: projection.sender,
609
+ destination_caller_id: projection.destination_caller_id ?? null,
610
+ is_from_me: projection.is_from_me
611
+ });
612
+ }
613
+ function applyAuthoritativeRecoveryProjection(message, projection) {
614
+ return {
615
+ ...message,
616
+ ...projection.chat_id !== void 0 ? { chat_id: projection.chat_id } : {},
617
+ ...projection.chat_guid !== void 0 ? { chat_guid: projection.chat_guid } : {},
618
+ ...projection.chat_identifier !== void 0 ? { chat_identifier: projection.chat_identifier } : {},
619
+ ...projection.chat_name !== void 0 ? { chat_name: projection.chat_name } : {},
620
+ ...projection.participants !== void 0 ? { participants: projection.participants } : {},
621
+ is_group: projection.is_group,
622
+ sender: projection.sender,
623
+ destination_caller_id: projection.destination_caller_id ?? null,
624
+ is_from_me: projection.is_from_me
625
+ };
626
+ }
627
+ async function repairIMessageConversationAnchor(params) {
628
+ const { client, message, runtime } = params;
629
+ if (!isIMessageAnchorless(message)) return message;
630
+ const guid = message.guid?.trim();
631
+ if (!guid) {
632
+ runtime?.error?.("imessage: dropping anchorless message without GUID");
633
+ return null;
634
+ }
635
+ let chatsResult;
636
+ try {
637
+ chatsResult = await client.request("chats.list", { limit: params.chatsLimit ?? DEFAULT_CHATS_LIMIT }, { timeoutMs: params.rpcTimeoutMs ?? DEFAULT_RPC_TIMEOUT_MS });
638
+ } catch (err) {
639
+ runtime?.error?.(`imessage: anchorless message recovery failed listing chats: ${String(err)}`);
640
+ return null;
641
+ }
642
+ const matchedProjections = [];
643
+ const chats = chatsResult?.chats ?? [];
644
+ for (const chat of chats) {
645
+ const chatId = hasPositiveChatId(chat.id) ? chat.id : null;
646
+ if (chatId === null) continue;
647
+ let historyResult;
648
+ try {
649
+ historyResult = await client.request("messages.history", {
650
+ attachments: false,
651
+ chat_id: chatId,
652
+ limit: params.perChatHistoryLimit ?? DEFAULT_PER_CHAT_HISTORY_LIMIT
653
+ }, { timeoutMs: params.rpcTimeoutMs ?? DEFAULT_RPC_TIMEOUT_MS });
654
+ } catch {
655
+ continue;
656
+ }
657
+ const messages = Array.isArray(historyResult?.messages) ? historyResult.messages : [];
658
+ for (const raw of messages) {
659
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) continue;
660
+ const entry = raw;
661
+ if (entry.guid !== guid) continue;
662
+ const projection = extractAuthoritativeRecoveryProjection(entry);
663
+ if (!projection) {
664
+ runtime?.error?.(`imessage: dropping anchorless message GUID=${guid}; exact-GUID history row is incomplete`);
665
+ return null;
666
+ }
667
+ matchedProjections.push(projection);
668
+ }
669
+ }
670
+ const [projection] = matchedProjections;
671
+ if (!projection) {
672
+ runtime?.error?.(`imessage: dropping anchorless message GUID=${guid}; no recent chat matched`);
673
+ return null;
674
+ }
675
+ if (new Set(matchedProjections.map(projectionConflictKey)).size > 1) {
676
+ runtime?.error?.(`imessage: dropping anchorless message GUID=${guid}; conflicting exact-GUID history projections`);
677
+ return null;
678
+ }
679
+ if (projection.is_from_me) {
680
+ runtime?.error?.(`imessage: dropping anchorless message GUID=${guid}; recovered authoritative row is from-me`);
681
+ return null;
682
+ }
683
+ const repaired = applyAuthoritativeRecoveryProjection(message, projection);
684
+ if (isIMessageAnchorless(repaired)) {
685
+ runtime?.error?.(`imessage: dropping anchorless message GUID=${guid} after recovery found no usable conversation anchor`);
686
+ return null;
687
+ }
688
+ runtime?.log?.(`imessage: recovered anchorless message GUID=${guid} chat_id=${repaired.chat_id ?? "unknown"} is_group=${repaired.is_group === true}`);
689
+ return repaired;
690
+ }
691
+ //#endregion
692
+ //#region extensions/imessage/src/monitor/deliver.ts
693
+ async function deliverIMessageReply(params) {
694
+ const { payload, target, runtime, maxBytes, textLimit, accountId, sentMessageCache } = params;
695
+ const scope = `${accountId ?? ""}:${target}`;
696
+ const { cfg } = params;
697
+ const tableMode = resolveMarkdownTableMode$1({
698
+ cfg,
699
+ channel: "imessage",
700
+ accountId
701
+ });
702
+ const chunkMode = resolveChunkMode(cfg, "imessage", accountId);
703
+ const reply = resolveSendableOutboundReplyParts(payload, { text: convertMarkdownTables$1(sanitizeOutboundText(payload.text ?? ""), tableMode) });
704
+ const accepted = [];
705
+ const sendAccepted = async (text, mediaUrl) => {
706
+ const sent = await sendMessageIMessage(target, text, {
707
+ config: cfg,
708
+ ...mediaUrl ? {
709
+ mediaUrl,
710
+ ...payload.audioAsVoice ? { audioAsVoice: true } : {}
711
+ } : {},
712
+ maxBytes,
713
+ accountId,
714
+ replyToId: payload.replyToId
715
+ });
716
+ accepted.push(sent);
717
+ const echoText = sent.echoText ?? (sent.sentText || void 0);
718
+ sentMessageCache?.remember(scope, {
719
+ ...echoText ? { text: echoText } : {},
720
+ ...sent.echoMedia ? { media: sent.echoMedia } : {},
721
+ messageId: sent.messageId
722
+ });
723
+ };
724
+ let delivered;
725
+ try {
726
+ delivered = await deliverTextOrMediaReply({
727
+ payload,
728
+ text: reply.text,
729
+ chunkText: (value) => chunkTextWithMode(value, textLimit, chunkMode),
730
+ sendText: sendAccepted,
731
+ sendMedia: ({ mediaUrl, caption }) => sendAccepted(caption ?? "", mediaUrl)
732
+ });
733
+ } catch (error) {
734
+ const partial = isChannelPartialDeliveryError(error) ? error.deliveryResult : void 0;
735
+ if (accepted.length === 0 && partial?.visibleReplySent !== true) throw error;
736
+ const receipt = createMessageReceiptFromOutboundResults({
737
+ results: [...accepted.map((result) => ({ receipt: result.receipt })), ...partial?.receipt ? [{ receipt: partial.receipt }] : (partial?.messageIds ?? []).map((messageId) => ({ messageId }))],
738
+ kind: reply.mediaUrls.length > 0 ? "media" : "text"
739
+ });
740
+ throw createChannelPartialDeliveryError(error, {
741
+ messageIds: listMessageReceiptPlatformIds(receipt),
742
+ receipt,
743
+ visibleReplySent: true,
744
+ content: [...accepted.map((result) => result.sentText), partial?.content].filter(Boolean).join("\n")
745
+ });
746
+ }
747
+ if (delivered === "empty") return {
748
+ visibleReplySent: false,
749
+ suppression: { reason: "no_visible_result" }
750
+ };
751
+ const receipt = createMessageReceiptFromOutboundResults({
752
+ results: accepted.map((result) => ({ receipt: result.receipt })),
753
+ kind: delivered
754
+ });
755
+ runtime.log?.(`imessage: delivered reply to ${target}`);
756
+ return {
757
+ messageIds: listMessageReceiptPlatformIds(receipt),
758
+ receipt,
759
+ visibleReplySent: true,
760
+ content: accepted.map((result) => result.sentText).filter(Boolean).join("\n")
761
+ };
762
+ }
763
+ function createIMessageEchoCachingSend(params) {
764
+ return async (target, text, opts) => {
765
+ const sent = await sendMessageIMessage(target, sanitizeOutboundText(text), opts);
766
+ const scope = `${params.accountId ?? opts.accountId ?? ""}:${target}`;
767
+ const echoText = sent.echoText ?? (sent.sentText || void 0);
768
+ params.sentMessageCache?.remember(scope, {
769
+ ...echoText ? { text: echoText } : {},
770
+ ...sent.echoMedia ? { media: sent.echoMedia } : {},
771
+ messageId: sent.messageId
772
+ });
773
+ return sent;
774
+ };
775
+ }
776
+ //#endregion
777
+ //#region extensions/imessage/src/monitor/dm-history.ts
778
+ const DM_HISTORY_RPC_TIMEOUT_MS = 1e4;
779
+ function resolveIMessageDmHistoryLimit(params) {
780
+ const senderCandidates = [
781
+ normalizeOptionalString(params.senderNormalized),
782
+ normalizeOptionalString(params.sender),
783
+ params.sender ? normalizeIMessageHandle(params.sender) : void 0
784
+ ].filter((candidate) => Boolean(candidate));
785
+ for (const candidate of senderCandidates) {
786
+ const override = params.config.dms?.[candidate]?.historyLimit;
787
+ if (override !== void 0) return Math.max(0, override);
788
+ }
789
+ return Math.max(0, params.config.dmHistoryLimit ?? 0);
790
+ }
791
+ function historyRowSortValue(message) {
792
+ if (typeof message.id === "number" && Number.isFinite(message.id)) return message.id;
793
+ const createdAtMs = typeof message.created_at === "string" ? Date.parse(message.created_at) : NaN;
794
+ return Number.isFinite(createdAtMs) ? createdAtMs : 0;
795
+ }
796
+ function isBeforeCurrentMessage(params) {
797
+ const { message, currentMessage } = params;
798
+ if (typeof message.id === "number" && typeof currentMessage.id === "number" && Number.isFinite(message.id) && Number.isFinite(currentMessage.id)) return message.id < currentMessage.id;
799
+ const guid = normalizeOptionalString(message.guid);
800
+ const currentGuid = normalizeOptionalString(currentMessage.guid);
801
+ if (guid && currentGuid) return guid !== currentGuid;
802
+ return true;
803
+ }
804
+ function historyEntryFromMessage(message, fallbackSender) {
805
+ const body = normalizeOptionalString(message.text);
806
+ if (!body) return null;
807
+ const timestamp = parseDateStringTimestampMs(message.created_at);
808
+ return {
809
+ sender: message.is_from_me === true ? "Me" : normalizeIMessageHandle(normalizeOptionalString(message.sender) ?? fallbackSender) || fallbackSender,
810
+ body,
811
+ ...timestamp !== void 0 ? { timestamp } : {}
812
+ };
813
+ }
814
+ async function resolveIMessageDmHistoryContext(params) {
815
+ const maxMessages = Math.max(0, Math.floor(params.limit));
816
+ const chatId = typeof params.message.chat_id === "number" && Number.isFinite(params.message.chat_id) ? params.message.chat_id : void 0;
817
+ if (maxMessages <= 0 || chatId === void 0) return {};
818
+ let result;
819
+ try {
820
+ result = await params.client.request("messages.history", {
821
+ chat_id: chatId,
822
+ limit: maxMessages + 1,
823
+ attachments: false
824
+ }, { timeoutMs: DM_HISTORY_RPC_TIMEOUT_MS });
825
+ } catch (err) {
826
+ params.logVerbose?.(`imessage: DM history fetch failed for chat_id=${chatId}: ${String(err)}`);
827
+ return {};
828
+ }
829
+ const history = (Array.isArray(result?.messages) ? result.messages : []).map((row) => parseIMessageNotification({ message: row })).filter((message) => Boolean(message)).filter((message) => message.is_group !== true).filter((message) => isBeforeCurrentMessage({
830
+ message,
831
+ currentMessage: params.message
832
+ })).toSorted((a, b) => historyRowSortValue(a) - historyRowSortValue(b)).map((message) => historyEntryFromMessage(message, params.senderNormalized)).filter((entry) => Boolean(entry)).slice(-maxMessages);
833
+ if (history.length === 0) return {};
834
+ return {
835
+ inboundHistory: history,
836
+ body: history.map((entry) => formatInboundEnvelope({
837
+ channel: "iMessage",
838
+ from: entry.sender,
839
+ timestamp: entry.timestamp,
840
+ body: entry.body,
841
+ chatType: "direct",
842
+ senderLabel: entry.sender,
843
+ envelope: params.envelopeOptions
844
+ })).join("\n\n")
845
+ };
846
+ }
847
+ //#endregion
848
+ //#region extensions/imessage/src/monitor/drop-diagnostic-cache.ts
849
+ const THROTTLED_DROP_DIAGNOSTIC_CACHE_MAX_SIZE = 512;
850
+ function createIMessageThrottledDropDiagnosticCache() {
851
+ return createDedupeCache({
852
+ maxSize: THROTTLED_DROP_DIAGNOSTIC_CACHE_MAX_SIZE,
853
+ ttlMs: 0
854
+ });
855
+ }
856
+ //#endregion
857
+ //#region extensions/imessage/src/monitor/echo-cache.ts
858
+ const SENT_MESSAGE_TEXT_TTL_MS = 4e3;
859
+ const SENT_MESSAGE_ID_TTL_MS = 6e4;
860
+ function normalizeEchoTextKey(text) {
861
+ if (!text) return null;
862
+ const normalized = stripLeadingEchoTextCorruptionMarkers(text.replace(/\r\n?/g, "\n").trim()).trim();
863
+ return normalized ? normalized : null;
864
+ }
865
+ function normalizeEchoMessageIdKey(messageId) {
866
+ if (!messageId) return null;
867
+ const normalized = messageId.trim();
868
+ if (!normalized || normalized === "ok" || normalized === "unknown") return null;
869
+ return normalized;
870
+ }
871
+ var DefaultSentMessageCache = class {
872
+ constructor() {
873
+ this.textCache = /* @__PURE__ */ new Map();
874
+ this.textBackedByIdCache = /* @__PURE__ */ new Map();
875
+ this.mediaCache = /* @__PURE__ */ new Map();
876
+ this.mediaBackedByIdCache = /* @__PURE__ */ new Map();
877
+ this.messageIdCache = /* @__PURE__ */ new Map();
878
+ }
879
+ remember(scope, lookup) {
880
+ const textKey = normalizeEchoTextKey(lookup.text);
881
+ if (textKey) this.textCache.set(`${scope}:${textKey}`, Date.now());
882
+ const mediaKey = resolveIMessageEchoMediaKey(lookup.media);
883
+ if (mediaKey) this.mediaCache.set(`${scope}:${mediaKey}`, Date.now());
884
+ const messageIdKey = normalizeEchoMessageIdKey(lookup.messageId);
885
+ if (messageIdKey) {
886
+ this.messageIdCache.set(`${scope}:${messageIdKey}`, Date.now());
887
+ if (textKey) this.textBackedByIdCache.set(`${scope}:${textKey}`, Date.now());
888
+ if (mediaKey) this.mediaBackedByIdCache.set(`${scope}:${mediaKey}`, Date.now());
889
+ }
890
+ this.cleanup();
891
+ }
892
+ has(scope, lookup, options = false) {
893
+ this.cleanup();
894
+ const resolvedOptions = typeof options === "boolean" ? { skipIdShortCircuit: options } : options;
895
+ if (hasPersistedIMessageEcho({
896
+ scope,
897
+ text: lookup.text,
898
+ media: lookup.media,
899
+ messageId: lookup.messageId,
900
+ skipIdShortCircuit: resolvedOptions.skipIdShortCircuit,
901
+ includePendingText: resolvedOptions.includePendingText
902
+ })) return true;
903
+ const textKey = normalizeEchoTextKey(lookup.text);
904
+ const mediaKey = resolveIMessageEchoMediaKey(lookup.media);
905
+ const messageIdKey = normalizeEchoMessageIdKey(lookup.messageId);
906
+ let canUseMediaFallback = !messageIdKey;
907
+ if (messageIdKey) {
908
+ const idTimestamp = this.messageIdCache.get(`${scope}:${messageIdKey}`);
909
+ if (idTimestamp && Date.now() - idTimestamp <= SENT_MESSAGE_ID_TTL_MS) return true;
910
+ const textTimestamp = textKey ? this.textCache.get(`${scope}:${textKey}`) : void 0;
911
+ const textBackedByIdTimestamp = textKey ? this.textBackedByIdCache.get(`${scope}:${textKey}`) : void 0;
912
+ const hasTextOnlyMatch = typeof textTimestamp === "number" && (!textBackedByIdTimestamp || textTimestamp > textBackedByIdTimestamp);
913
+ const mediaTimestamp = mediaKey ? this.mediaCache.get(`${scope}:${mediaKey}`) : void 0;
914
+ const mediaBackedByIdTimestamp = mediaKey ? this.mediaBackedByIdCache.get(`${scope}:${mediaKey}`) : void 0;
915
+ const hasMediaOnlyMatch = typeof mediaTimestamp === "number" && (!mediaBackedByIdTimestamp || mediaTimestamp > mediaBackedByIdTimestamp);
916
+ canUseMediaFallback = hasMediaOnlyMatch;
917
+ if (!resolvedOptions.skipIdShortCircuit && !hasTextOnlyMatch && !hasMediaOnlyMatch) return false;
918
+ }
919
+ if (textKey) {
920
+ const textTimestamp = this.textCache.get(`${scope}:${textKey}`);
921
+ if (textTimestamp && Date.now() - textTimestamp <= SENT_MESSAGE_TEXT_TTL_MS) return true;
922
+ }
923
+ if (mediaKey && canUseMediaFallback) {
924
+ const mediaTimestamp = this.mediaCache.get(`${scope}:${mediaKey}`);
925
+ if (mediaTimestamp && Date.now() - mediaTimestamp <= SENT_MESSAGE_TEXT_TTL_MS) return true;
926
+ }
927
+ return false;
928
+ }
929
+ cleanup() {
930
+ const now = Date.now();
931
+ for (const [key, timestamp] of this.textCache.entries()) if (now - timestamp > SENT_MESSAGE_TEXT_TTL_MS) this.textCache.delete(key);
932
+ for (const [key, timestamp] of this.textBackedByIdCache.entries()) if (now - timestamp > SENT_MESSAGE_TEXT_TTL_MS) this.textBackedByIdCache.delete(key);
933
+ for (const [key, timestamp] of this.mediaCache.entries()) if (now - timestamp > SENT_MESSAGE_TEXT_TTL_MS) this.mediaCache.delete(key);
934
+ for (const [key, timestamp] of this.mediaBackedByIdCache.entries()) if (now - timestamp > SENT_MESSAGE_TEXT_TTL_MS) this.mediaBackedByIdCache.delete(key);
935
+ for (const [key, timestamp] of this.messageIdCache.entries()) if (now - timestamp > SENT_MESSAGE_ID_TTL_MS) this.messageIdCache.delete(key);
936
+ }
937
+ };
938
+ function createSentMessageCache() {
939
+ return new DefaultSentMessageCache();
940
+ }
941
+ //#endregion
942
+ //#region extensions/imessage/src/monitor/group-allowlist-warnings.ts
943
+ const PER_CHAT_WARNING_CACHE_MAX_SIZE = 512;
944
+ const startupWarned = /* @__PURE__ */ new Set();
945
+ const perChatWarned = createDedupeCache({
946
+ maxSize: PER_CHAT_WARNING_CACHE_MAX_SIZE,
947
+ ttlMs: 0
948
+ });
949
+ /**
950
+ * Fires once per `accountId` at monitor startup when `groupPolicy === "allowlist"`
951
+ * and the effective group sender allowlist is empty. The sender gate runs
952
+ * before the group registry, so `channels.imessage.groups` entries cannot admit
953
+ * traffic without a sender allowlist. A non-empty `groupAllowFrom` makes the
954
+ * configuration potentially valid and suppresses this drop-all warning.
955
+ */
956
+ function warnGroupAllowlistMisconfigOnce(params) {
957
+ if (params.groupPolicy !== "allowlist") return false;
958
+ if (params.hasGroupAllowFrom) return false;
959
+ const key = `imessage:${params.accountId}`;
960
+ if (startupWarned.has(key)) return false;
961
+ startupWarned.add(key);
962
+ params.log(`imessage: groupPolicy="allowlist" for account "${params.accountId}" but no group sender allowlist is configured (channels.imessage.groupAllowFrom, or its allowFrom fallback). Every inbound group message will be dropped. Set channels.imessage.groupAllowFrom (sender handles, chat targets like chat_id:<id>, or "*") to admit group senders, and optionally add channels.imessage.groups entries to scope which chats are allowed.`);
963
+ return true;
964
+ }
965
+ /**
966
+ * Fires once per `accountId:chat_id` when the runtime allowlist gate drops a
967
+ * group message because that chat_id is not in `channels.imessage.groups`.
968
+ * Retains up to 512 recently active account/chat pairs; evicted chats may warn again.
969
+ */
970
+ function warnGroupAllowlistDropPerChatOnce(params) {
971
+ const chat = params.chatId == null ? "" : String(params.chatId).trim();
972
+ if (!chat) return false;
973
+ const key = `imessage:${params.accountId}:${chat}`;
974
+ if (perChatWarned.check(key)) return false;
975
+ params.log(`imessage: dropping group message from chat_id=${chat} (account "${params.accountId}") — not in channels.imessage.groups allowlist. Add channels.imessage.groups["${chat}"] or channels.imessage.groups["*"] to allow it.`);
976
+ return true;
977
+ }
978
+ //#endregion
979
+ //#region extensions/imessage/src/monitor/inbound-dedupe.ts
980
+ const IMESSAGE_STALE_INBOUND_THRESHOLD_MS = 900 * 1e3;
981
+ const IMESSAGE_RECOVERY_MAX_AGE_MS = 7200 * 1e3;
982
+ /**
983
+ * Age fence: true when the message's own send date is materially older than
984
+ * now, i.e. stale backlog rather than a live message. Fails open (returns
985
+ * false) when the send date is missing or unparseable so an undateable message
986
+ * is never suppressed on a timestamp we cannot read.
987
+ */
988
+ function isStaleIMessageBacklog(message, nowMs, thresholdMs = IMESSAGE_STALE_INBOUND_THRESHOLD_MS) {
989
+ const createdAt = message.created_at?.trim();
990
+ if (!createdAt) return false;
991
+ const sentMs = Date.parse(createdAt);
992
+ if (!Number.isFinite(sentMs)) return false;
993
+ return nowMs - sentMs > thresholdMs;
994
+ }
995
+ //#endregion
996
+ //#region extensions/imessage/src/conversation-route.ts
997
+ function resolveIMessageConversationRoute(params) {
998
+ const route = resolveAgentRoute({
999
+ cfg: params.cfg,
1000
+ channel: "imessage",
1001
+ accountId: params.accountId,
1002
+ peer: {
1003
+ kind: params.isGroup ? "group" : "direct",
1004
+ id: params.peerId
1005
+ }
1006
+ });
1007
+ const conversationId = resolveIMessageInboundConversationId({
1008
+ isGroup: params.isGroup,
1009
+ sender: params.sender,
1010
+ chatId: params.chatId
1011
+ });
1012
+ if (!conversationId) return {
1013
+ route,
1014
+ bindingResolution: null
1015
+ };
1016
+ const conversation = {
1017
+ channel: "imessage",
1018
+ accountId: params.accountId,
1019
+ conversationId
1020
+ };
1021
+ const configuredRoute = resolveConfiguredBindingRoute({
1022
+ cfg: params.cfg,
1023
+ route,
1024
+ conversation
1025
+ });
1026
+ const runtimeRoute = resolveRuntimeConversationBindingRoute({
1027
+ route: configuredRoute.route,
1028
+ conversation
1029
+ });
1030
+ if (runtimeRoute.bindingRecord && !runtimeRoute.boundSessionKey) logVerbose(`imessage: plugin-bound conversation ${conversationId}`);
1031
+ else if (runtimeRoute.boundSessionKey) logVerbose(`imessage: routed via bound conversation ${conversationId} -> ${runtimeRoute.boundSessionKey}`);
1032
+ return {
1033
+ route: runtimeRoute.route,
1034
+ bindingResolution: runtimeRoute.bindingRecord ? null : configuredRoute.bindingResolution
1035
+ };
1036
+ }
1037
+ //#endregion
1038
+ //#region extensions/imessage/src/monitor/reflection-guard.ts
1039
+ const REFLECTION_PATTERNS = [
1040
+ {
1041
+ re: /(?:#\+){2,}#?/,
1042
+ label: "internal-separator"
1043
+ },
1044
+ {
1045
+ re: /\bassistant\s+to\s*=\s*\w+/i,
1046
+ label: "assistant-role-marker"
1047
+ },
1048
+ {
1049
+ re: /<\s*\/?\s*(?:(?:antml:|mm:)?(?:think(?:ing)?|thought)|antthinking)\b[^<>]*>/i,
1050
+ label: "thinking-tag"
1051
+ },
1052
+ {
1053
+ re: /<\s*\/?\s*relevant[-_]memories\b[^<>]*>/i,
1054
+ label: "relevant-memories-tag"
1055
+ },
1056
+ {
1057
+ re: /<\s*\/?\s*final\b[^<>]*>/i,
1058
+ label: "final-tag"
1059
+ },
1060
+ {
1061
+ re: /\bACP error\s*\(\s*ACP_[A-Z0-9_]+\s*\):/i,
1062
+ label: "acp-error"
1063
+ },
1064
+ {
1065
+ re: /\bMissing API key for\b.+\bon the gateway\b/i,
1066
+ label: "gateway-missing-api-key"
1067
+ }
1068
+ ];
1069
+ function hasMatchOutsideCode(text, re) {
1070
+ const codeRegions = findCodeRegions(text);
1071
+ const globalRe = new RegExp(re.source, re.flags.includes("g") ? re.flags : `${re.flags}g`);
1072
+ for (const match of text.matchAll(globalRe)) {
1073
+ const start = match.index ?? -1;
1074
+ if (start >= 0 && !isInsideCode(start, codeRegions)) return true;
1075
+ }
1076
+ return false;
1077
+ }
1078
+ /**
1079
+ * Check whether an inbound message appears to be a reflection of
1080
+ * assistant-originated content. Returns matched pattern labels for telemetry.
1081
+ */
1082
+ function detectReflectedContent(text) {
1083
+ if (!text) return {
1084
+ isReflection: false,
1085
+ matchedLabels: []
1086
+ };
1087
+ const matchedLabels = [];
1088
+ for (const { re, label } of REFLECTION_PATTERNS) if (hasMatchOutsideCode(text, re)) matchedLabels.push(label);
1089
+ return {
1090
+ isReflection: matchedLabels.length > 0,
1091
+ matchedLabels
1092
+ };
1093
+ }
1094
+ //#endregion
1095
+ //#region extensions/imessage/src/monitor/inbound-processing.ts
1096
+ const normalizeNonEmpty = (value) => value.trim() || null;
1097
+ const imessageConversationIdentityKinds = /* @__PURE__ */ new Set([
1098
+ "plugin:imessage-chat-id",
1099
+ "plugin:imessage-chat-guid",
1100
+ "plugin:imessage-chat-identifier"
1101
+ ]);
1102
+ const matchIMessageIngressEntry = ({ entry, context }) => {
1103
+ if (imessageConversationIdentityKinds.has(entry.kind) && context !== "group") return false;
1104
+ };
1105
+ function isIMessageConversationAllowTarget(entry) {
1106
+ const parsed = parseIMessageAllowTarget(entry);
1107
+ return parsed.kind === "chat_id" || parsed.kind === "chat_guid" || parsed.kind === "chat_identifier";
1108
+ }
1109
+ function mergeIMessageGroupAllowFromWithLegacyChatTargets(params) {
1110
+ if (params.groupAllowFrom.length > 0 || !params.allowLegacyConversationTargets) return params.groupAllowFrom;
1111
+ const legacyChatTargets = params.allowFrom.filter((entry) => isIMessageConversationAllowTarget(entry));
1112
+ if (legacyChatTargets.length === 0) return params.groupAllowFrom;
1113
+ return uniqueStrings([...params.groupAllowFrom, ...legacyChatTargets]);
1114
+ }
1115
+ const imessageIngressIdentity = defineStableChannelIngressIdentity({
1116
+ key: "imessage-sender",
1117
+ normalizeEntry: normalizeIMessageHandleEntry,
1118
+ normalizeSubject: normalizeIMessageHandle,
1119
+ sensitivity: "pii",
1120
+ matchEntry: matchIMessageIngressEntry,
1121
+ aliases: [
1122
+ [
1123
+ "imessage-chat-id",
1124
+ "plugin:imessage-chat-id",
1125
+ normalizeIMessageChatIdEntry
1126
+ ],
1127
+ [
1128
+ "imessage-chat-guid",
1129
+ "plugin:imessage-chat-guid",
1130
+ normalizeIMessageChatGuidEntry
1131
+ ],
1132
+ [
1133
+ "imessage-chat-identifier",
1134
+ "plugin:imessage-chat-identifier",
1135
+ normalizeIMessageChatIdentifierEntry
1136
+ ]
1137
+ ].map(([key, kind, normalizeEntry]) => ({
1138
+ key,
1139
+ kind,
1140
+ normalizeEntry,
1141
+ normalizeSubject: normalizeNonEmpty,
1142
+ sensitivity: "pii"
1143
+ })),
1144
+ resolveEntryId: ({ entryIndex }) => `imessage-entry-${entryIndex + 1}`
1145
+ });
1146
+ function normalizeIMessageHandleEntry(entry) {
1147
+ const parsed = parseIMessageAllowTarget(entry.trim());
1148
+ return parsed.kind === "handle" ? normalizeIMessageHandle(parsed.handle) : null;
1149
+ }
1150
+ function normalizeIMessageChatIdEntry(entry) {
1151
+ const parsed = parseIMessageAllowTarget(entry.trim());
1152
+ return parsed.kind === "chat_id" ? String(parsed.chatId) : null;
1153
+ }
1154
+ function normalizeIMessageChatGuidEntry(entry) {
1155
+ const parsed = parseIMessageAllowTarget(entry.trim());
1156
+ return parsed.kind === "chat_guid" ? parsed.chatGuid.trim() || null : null;
1157
+ }
1158
+ function normalizeIMessageChatIdentifierEntry(entry) {
1159
+ const parsed = parseIMessageAllowTarget(entry.trim());
1160
+ return parsed.kind === "chat_identifier" ? parsed.chatIdentifier.trim() || null : null;
1161
+ }
1162
+ function normalizeDmPolicy(policy) {
1163
+ return policy === "open" || policy === "allowlist" || policy === "disabled" ? policy : "pairing";
1164
+ }
1165
+ function normalizeGroupPolicy(policy) {
1166
+ return policy === "open" || policy === "disabled" ? policy : "allowlist";
1167
+ }
1168
+ function normalizeReplyField(value) {
1169
+ if (typeof value === "string") {
1170
+ const trimmed = value.trim();
1171
+ return trimmed ? trimmed : void 0;
1172
+ }
1173
+ if (typeof value === "number") return String(value);
1174
+ }
1175
+ function describeReplyContext(message) {
1176
+ const body = normalizeReplyField(message.reply_to_text);
1177
+ if (!body) return null;
1178
+ return {
1179
+ body,
1180
+ id: normalizeReplyField(message.reply_to_id),
1181
+ sender: normalizeReplyField(message.reply_to_sender)
1182
+ };
1183
+ }
1184
+ function resolveInboundEchoMessageIds(message) {
1185
+ const values = [message.id != null ? String(message.id) : void 0, normalizeReplyField(message.guid)];
1186
+ const ids = [];
1187
+ for (const value of values) {
1188
+ if (!value || ids.includes(value)) continue;
1189
+ ids.push(value);
1190
+ }
1191
+ return ids;
1192
+ }
1193
+ function rememberIMessageSkippedFromMeForSelfChatDedupe(params) {
1194
+ if (params.message.is_from_me !== true) return;
1195
+ const sender = params.message.sender?.trim();
1196
+ if (!sender) return;
1197
+ const chatId = params.message.chat_id ?? void 0;
1198
+ const isGroup = Boolean(params.message.is_group);
1199
+ const chatIdentifierNormalized = normalizeIMessageHandle(params.message.chat_identifier ?? "") || void 0;
1200
+ const destinationCallerIdNormalized = normalizeIMessageHandle(params.message.destination_caller_id ?? "") || void 0;
1201
+ const senderNormalized = normalizeIMessageHandle(sender);
1202
+ const createdAt = params.message.created_at ? Date.parse(params.message.created_at) : void 0;
1203
+ const lookup = {
1204
+ accountId: params.accountId,
1205
+ isGroup,
1206
+ chatId,
1207
+ sender,
1208
+ text: params.bodyText.trim(),
1209
+ createdAt
1210
+ };
1211
+ const isSelfChat = !isGroup && chatIdentifierNormalized != null && senderNormalized === chatIdentifierNormalized && destinationCallerIdNormalized != null && destinationCallerIdNormalized === senderNormalized;
1212
+ const isAmbiguousSelfThread = !isGroup && chatIdentifierNormalized != null && senderNormalized === chatIdentifierNormalized && destinationCallerIdNormalized == null;
1213
+ if (isSelfChat) params.selfChatCache?.remember({
1214
+ ...lookup,
1215
+ allowCreatedAtSkew: true
1216
+ });
1217
+ else if (isAmbiguousSelfThread) params.selfChatCache?.remember(lookup);
1218
+ }
1219
+ function hasIMessageEchoMatch(params) {
1220
+ const scopes = typeof params.scope === "string" ? [params.scope] : params.scope;
1221
+ for (const scope of scopes) {
1222
+ if (!scope) continue;
1223
+ for (const messageId of params.messageIds) if (params.echoCache.has(scope, { messageId })) return true;
1224
+ const fallbackMessageId = params.messageIds[0];
1225
+ if (!params.text && !params.media && !fallbackMessageId) continue;
1226
+ if (params.echoCache.has(scope, {
1227
+ text: params.text,
1228
+ media: params.media,
1229
+ messageId: fallbackMessageId
1230
+ }, {
1231
+ skipIdShortCircuit: params.skipIdShortCircuit,
1232
+ includePendingText: params.includePendingText
1233
+ })) return true;
1234
+ }
1235
+ return false;
1236
+ }
1237
+ function isKnownFromMeIMessageReactionTarget(params) {
1238
+ const { messageId, accountId, chatId, chatGuid, chatIdentifier } = params;
1239
+ const ctx = {
1240
+ accountId,
1241
+ chatId,
1242
+ chatGuid,
1243
+ chatIdentifier
1244
+ };
1245
+ if (params.isKnownFromMeMessageId) return params.isKnownFromMeMessageId(messageId, ctx);
1246
+ return isKnownFromMeIMessageMessageId(messageId, ctx);
1247
+ }
1248
+ /**
1249
+ * Per-group `systemPrompt` resolution. Mirrors `resolveWhatsAppGroupSystemPrompt`
1250
+ * in `extensions/whatsapp/src/system-prompt.ts`:
1251
+ *
1252
+ * 1. If the matched per-`chat_id` entry exists AND defines `systemPrompt` (key
1253
+ * is present, value is non-null), use it. Trim whitespace; if the trim
1254
+ * leaves an empty string, return `undefined` and DO NOT fall through to the
1255
+ * wildcard. This is how operators say "this specific group has no prompt"
1256
+ * without inheriting from `groups["*"]`.
1257
+ * 2. Otherwise, return the wildcard `groups["*"].systemPrompt` (trimmed; empty
1258
+ * after trim → `undefined`).
1259
+ */
1260
+ function resolveIMessageGroupSystemPrompt(params) {
1261
+ const specific = params.groupConfig;
1262
+ if (specific != null && specific.systemPrompt != null) return specific.systemPrompt.trim() || void 0;
1263
+ const wildcard = params.defaultConfig?.systemPrompt;
1264
+ return wildcard != null ? wildcard.trim() || void 0 : void 0;
1265
+ }
1266
+ async function resolveIMessageInboundDecision(params) {
1267
+ const sender = (params.message.sender ?? "").trim();
1268
+ if (!sender) return {
1269
+ kind: "drop",
1270
+ reason: "missing sender"
1271
+ };
1272
+ const senderNormalized = normalizeIMessageHandle(sender);
1273
+ const chatId = params.message.chat_id ?? void 0;
1274
+ const chatGuid = params.message.chat_guid ?? void 0;
1275
+ const chatIdentifier = params.message.chat_identifier ?? void 0;
1276
+ const destinationCallerId = params.message.destination_caller_id ?? void 0;
1277
+ const createdAt = params.message.created_at ? Date.parse(params.message.created_at) : void 0;
1278
+ const messageText = params.messageText.trim();
1279
+ const bodyText = params.bodyText.trim();
1280
+ const mediaFacts = params.mediaFacts ?? [];
1281
+ const reactionContext = resolveIMessageReactionContext(params.message, bodyText || messageText);
1282
+ const groupIdCandidate = chatId !== void 0 ? String(chatId) : void 0;
1283
+ const groupAllowFromWithLegacyChatTargets = mergeIMessageGroupAllowFromWithLegacyChatTargets({
1284
+ groupAllowFrom: params.groupAllowFrom,
1285
+ allowFrom: params.allowFrom,
1286
+ allowLegacyConversationTargets: params.allowLegacyConversationAllowFromForGroup
1287
+ });
1288
+ const groupListPolicy = groupIdCandidate ? resolveChannelGroupPolicy({
1289
+ cfg: params.cfg,
1290
+ channel: "imessage",
1291
+ accountId: params.accountId,
1292
+ groupId: groupIdCandidate,
1293
+ hasGroupAllowFrom: groupAllowFromWithLegacyChatTargets.length > 0
1294
+ }) : {
1295
+ allowlistEnabled: false,
1296
+ allowed: true,
1297
+ groupConfig: void 0,
1298
+ defaultConfig: void 0
1299
+ };
1300
+ const treatAsGroupByConfig = Boolean(groupIdCandidate && groupListPolicy.allowlistEnabled && groupListPolicy.groupConfig);
1301
+ const isGroup = Boolean(params.message.is_group) || treatAsGroupByConfig;
1302
+ const selfChatLookup = {
1303
+ accountId: params.accountId,
1304
+ isGroup,
1305
+ chatId,
1306
+ sender,
1307
+ text: bodyText,
1308
+ createdAt
1309
+ };
1310
+ const chatIdentifierNormalized = normalizeIMessageHandle(chatIdentifier ?? "") || void 0;
1311
+ const destinationCallerIdNormalized = normalizeIMessageHandle(destinationCallerId ?? "") || void 0;
1312
+ const isSelfChat = !isGroup && chatIdentifierNormalized != null && senderNormalized === chatIdentifierNormalized && destinationCallerIdNormalized != null && destinationCallerIdNormalized === senderNormalized;
1313
+ const isAmbiguousSelfThread = !isGroup && chatIdentifierNormalized != null && senderNormalized === chatIdentifierNormalized && destinationCallerIdNormalized == null;
1314
+ let skipSelfChatHasCheck = false;
1315
+ const inboundMessageIds = resolveInboundEchoMessageIds(params.message);
1316
+ const inboundMessageId = inboundMessageIds[0];
1317
+ const hasInboundGuid = Boolean(normalizeReplyField(params.message.guid));
1318
+ if (params.message.is_from_me) {
1319
+ if (isAmbiguousSelfThread) params.selfChatCache?.remember(selfChatLookup);
1320
+ if (isSelfChat) {
1321
+ params.selfChatCache?.remember({
1322
+ ...selfChatLookup,
1323
+ allowCreatedAtSkew: true
1324
+ });
1325
+ const echoScope = buildIMessageEchoScope({
1326
+ accountId: params.accountId,
1327
+ isGroup,
1328
+ chatId,
1329
+ chatGuid,
1330
+ chatIdentifier,
1331
+ sender
1332
+ });
1333
+ if (params.echoCache && (bodyText || inboundMessageId || mediaFacts.length > 0) && hasIMessageEchoMatch({
1334
+ echoCache: params.echoCache,
1335
+ scope: echoScope,
1336
+ text: bodyText || void 0,
1337
+ media: mediaFacts[0],
1338
+ messageIds: inboundMessageIds,
1339
+ skipIdShortCircuit: !hasInboundGuid,
1340
+ includePendingText: true
1341
+ })) return {
1342
+ kind: "drop",
1343
+ reason: "agent echo in self-chat"
1344
+ };
1345
+ skipSelfChatHasCheck = true;
1346
+ } else return {
1347
+ kind: "drop",
1348
+ reason: "from me"
1349
+ };
1350
+ }
1351
+ if (isGroup && !chatId) return {
1352
+ kind: "drop",
1353
+ reason: "group without chat_id"
1354
+ };
1355
+ const groupId = isGroup ? groupIdCandidate : void 0;
1356
+ const hasControlCommandInMessage = hasControlCommand(messageText, params.cfg);
1357
+ const groupAllowFromForAccess = isGroup ? groupAllowFromWithLegacyChatTargets : params.groupAllowFrom;
1358
+ const { route, bindingResolution } = resolveIMessageConversationRoute({
1359
+ cfg: params.cfg,
1360
+ accountId: params.accountId,
1361
+ isGroup,
1362
+ peerId: isGroup ? String(chatId ?? "unknown") : senderNormalized,
1363
+ sender,
1364
+ chatId
1365
+ });
1366
+ const accessDecision = await createChannelIngressResolver({
1367
+ channelId: "imessage",
1368
+ accountId: params.accountId,
1369
+ identity: imessageIngressIdentity,
1370
+ cfg: params.cfg,
1371
+ readStoreAllowFrom: async () => params.storeAllowFrom
1372
+ }).message({
1373
+ subject: {
1374
+ stableId: sender,
1375
+ aliases: {
1376
+ ...chatId != null ? { "imessage-chat-id": String(chatId) } : {},
1377
+ ...chatGuid ? { "imessage-chat-guid": chatGuid } : {},
1378
+ ...chatIdentifier ? { "imessage-chat-identifier": chatIdentifier } : {}
1379
+ }
1380
+ },
1381
+ conversation: {
1382
+ kind: isGroup ? "group" : "direct",
1383
+ id: isGroup ? String(chatId ?? chatGuid ?? chatIdentifier ?? "unknown") : normalizeIMessageHandle(sender)
1384
+ },
1385
+ ...reactionContext ? {} : { contextBinding: {
1386
+ agentId: route.agentId,
1387
+ sessionKey: route.sessionKey,
1388
+ inboundEventKind: "user_request"
1389
+ } },
1390
+ dmPolicy: normalizeDmPolicy(params.dmPolicy),
1391
+ groupPolicy: normalizeGroupPolicy(params.groupPolicy),
1392
+ policy: { groupAllowFromFallbackToAllowFrom: false },
1393
+ allowFrom: params.allowFrom,
1394
+ groupAllowFrom: groupAllowFromForAccess,
1395
+ command: {
1396
+ allowTextCommands: isGroup,
1397
+ hasControlCommand: hasControlCommandInMessage,
1398
+ directGroupAllowFrom: "effective"
1399
+ }
1400
+ });
1401
+ const { commandAccess, senderAccess } = accessDecision;
1402
+ const effectiveGroupAllowFrom = senderAccess.effectiveGroupAllowFrom;
1403
+ if (senderAccess.decision !== "allow") {
1404
+ if (isGroup) {
1405
+ if (senderAccess.reasonCode === "group_policy_disabled") {
1406
+ params.logVerbose?.("Blocked iMessage group message (groupPolicy: disabled)");
1407
+ return {
1408
+ kind: "drop",
1409
+ reason: "groupPolicy disabled"
1410
+ };
1411
+ }
1412
+ if (senderAccess.reasonCode === "group_policy_empty_allowlist") {
1413
+ params.logVerbose?.("Blocked iMessage group message (groupPolicy: allowlist, no groupAllowFrom)");
1414
+ return {
1415
+ kind: "drop",
1416
+ reason: "groupPolicy allowlist (empty groupAllowFrom)"
1417
+ };
1418
+ }
1419
+ if (senderAccess.reasonCode === "group_policy_not_allowlisted") {
1420
+ params.logVerbose?.(`Blocked iMessage sender ${sender} (not in groupAllowFrom)`);
1421
+ return {
1422
+ kind: "drop",
1423
+ reason: "not in groupAllowFrom"
1424
+ };
1425
+ }
1426
+ params.logVerbose?.(`Blocked iMessage group message (${senderAccess.reasonCode})`);
1427
+ return {
1428
+ kind: "drop",
1429
+ reason: senderAccess.reasonCode
1430
+ };
1431
+ }
1432
+ if (senderAccess.reasonCode === "dm_policy_disabled") return {
1433
+ kind: "drop",
1434
+ reason: "dmPolicy disabled"
1435
+ };
1436
+ if (senderAccess.decision === "pairing") return {
1437
+ kind: "pairing",
1438
+ senderId: senderNormalized
1439
+ };
1440
+ params.logVerbose?.(`Blocked iMessage sender ${sender} (dmPolicy=${params.dmPolicy})`);
1441
+ return {
1442
+ kind: "drop",
1443
+ reason: "dmPolicy blocked"
1444
+ };
1445
+ }
1446
+ if (isGroup && groupListPolicy.allowlistEnabled && !groupListPolicy.allowed) {
1447
+ params.logVerbose?.(`imessage: skipping group message (${groupId ?? "unknown"}) not in allowlist`);
1448
+ return {
1449
+ kind: "drop",
1450
+ reason: "group id not in allowlist"
1451
+ };
1452
+ }
1453
+ if (reactionContext) {
1454
+ const notificationMode = params.reactionNotifications ?? "own";
1455
+ if (notificationMode === "off") return {
1456
+ kind: "drop",
1457
+ reason: "reaction notifications disabled"
1458
+ };
1459
+ const targetGuid = reactionContext.targetGuid;
1460
+ const targetGuids = reactionContext.targetGuids ?? (targetGuid ? [targetGuid] : []);
1461
+ const targetIsOwn = Boolean(targetGuid && (params.echoCache && hasIMessageEchoMatch({
1462
+ echoCache: params.echoCache,
1463
+ scope: buildIMessageEchoScope({
1464
+ accountId: params.accountId,
1465
+ isGroup,
1466
+ chatId,
1467
+ chatGuid,
1468
+ chatIdentifier,
1469
+ sender
1470
+ }),
1471
+ messageIds: targetGuids
1472
+ }) || targetGuids.some((messageId) => isKnownFromMeIMessageReactionTarget({
1473
+ messageId,
1474
+ accountId: params.accountId,
1475
+ chatId,
1476
+ chatGuid,
1477
+ chatIdentifier,
1478
+ isKnownFromMeMessageId: params.isKnownFromMeMessageId
1479
+ }))));
1480
+ if (notificationMode === "own" && !targetIsOwn) return {
1481
+ kind: "drop",
1482
+ reason: "reaction target not sent by agent"
1483
+ };
1484
+ const target = targetGuid ? `msg ${targetGuid}` : reactionContext.targetText ? `message "${truncateUtf16Safe(reactionContext.targetText, 80)}"` : "a message";
1485
+ return {
1486
+ kind: "reaction",
1487
+ isGroup,
1488
+ chatId,
1489
+ chatGuid,
1490
+ chatIdentifier,
1491
+ sender,
1492
+ senderNormalized,
1493
+ route,
1494
+ reaction: reactionContext,
1495
+ text: `iMessage reaction ${reactionContext.action}: ${reactionContext.emoji} by ${senderNormalized} on ${target}`,
1496
+ contextKey: [
1497
+ "imessage",
1498
+ "reaction",
1499
+ reactionContext.action,
1500
+ chatId ?? chatGuid ?? chatIdentifier ?? senderNormalized,
1501
+ targetGuid ?? reactionContext.targetText ?? "unknown",
1502
+ senderNormalized,
1503
+ reactionContext.emoji
1504
+ ].join(":")
1505
+ };
1506
+ }
1507
+ const mentionRegexes = buildMentionRegexes(params.cfg, route.agentId);
1508
+ if (!bodyText && mediaFacts.length === 0) return {
1509
+ kind: "drop",
1510
+ reason: "empty body"
1511
+ };
1512
+ if (skipSelfChatHasCheck ? false : params.selfChatCache?.has({
1513
+ ...selfChatLookup,
1514
+ text: bodyText
1515
+ })) {
1516
+ const preview = sanitizeTerminalText(truncateUtf16Safe(bodyText, 50));
1517
+ params.logVerbose?.(`imessage: dropping self-chat reflected duplicate: "${preview}"`);
1518
+ return {
1519
+ kind: "drop",
1520
+ reason: "self-chat echo"
1521
+ };
1522
+ }
1523
+ if (params.echoCache && (messageText || inboundMessageId || mediaFacts.length > 0)) {
1524
+ const echoScope = buildIMessageEchoScope({
1525
+ accountId: params.accountId,
1526
+ isGroup,
1527
+ chatId,
1528
+ chatGuid,
1529
+ chatIdentifier,
1530
+ sender
1531
+ });
1532
+ if (hasIMessageEchoMatch({
1533
+ echoCache: params.echoCache,
1534
+ scope: echoScope,
1535
+ text: bodyText || void 0,
1536
+ media: mediaFacts[0],
1537
+ messageIds: inboundMessageIds,
1538
+ includePendingText: isSelfChat
1539
+ })) {
1540
+ params.logVerbose?.(describeIMessageEchoDropLog({
1541
+ messageText: bodyText,
1542
+ messageId: inboundMessageId
1543
+ }));
1544
+ return {
1545
+ kind: "drop",
1546
+ reason: "echo"
1547
+ };
1548
+ }
1549
+ }
1550
+ const reflection = detectReflectedContent(messageText);
1551
+ if (reflection.isReflection) {
1552
+ params.logVerbose?.(`imessage: dropping reflected assistant content (markers: ${reflection.matchedLabels.join(", ")})`);
1553
+ return {
1554
+ kind: "drop",
1555
+ reason: "reflected assistant content"
1556
+ };
1557
+ }
1558
+ const replyContext = describeReplyContext(params.message);
1559
+ const contextVisibilityMode = resolveChannelContextVisibilityMode({
1560
+ cfg: params.cfg,
1561
+ channel: "imessage",
1562
+ accountId: params.accountId
1563
+ });
1564
+ const replyContextAllowFrom = Array.from(/* @__PURE__ */ new Set([...groupAllowFromForAccess, ...effectiveGroupAllowFrom]));
1565
+ const replySenderAllowed = resolveInboundSupplementalSenderAllowed({
1566
+ isGroup,
1567
+ groupPolicy: replyContextAllowFrom.length === 0 ? "open" : "allowlist",
1568
+ allowFrom: replyContextAllowFrom,
1569
+ isSenderAllowed: (allowFrom) => replyContext?.sender ? isAllowedIMessageReplyContextSender({
1570
+ allowFrom: [...allowFrom],
1571
+ sender: replyContext.sender,
1572
+ chatId,
1573
+ chatGuid,
1574
+ chatIdentifier
1575
+ }) : false
1576
+ });
1577
+ const visibleReply = filterChannelInboundQuoteContext(contextVisibilityMode, replyContext ? {
1578
+ id: replyContext.id,
1579
+ body: replyContext.body,
1580
+ sender: replyContext.sender,
1581
+ senderAllowed: replySenderAllowed
1582
+ } : void 0);
1583
+ const filteredReplyContext = visibleReply ? {
1584
+ id: visibleReply.id,
1585
+ body: visibleReply.body ?? "",
1586
+ sender: visibleReply.sender
1587
+ } : null;
1588
+ if (replyContext && !filteredReplyContext && isGroup) params.logVerbose?.(`imessage: drop reply context (mode=${contextVisibilityMode}, sender_allowed=${replySenderAllowed ? "yes" : "no"})`);
1589
+ const historyKey = isGroup ? String(chatId ?? chatGuid ?? chatIdentifier ?? "unknown") : void 0;
1590
+ const mentioned = isGroup ? matchesMentionPatterns(messageText, mentionRegexes) : true;
1591
+ const requireMention = resolveScopeRequireMention({
1592
+ tree: buildChannelGroupsScopeTree(params.cfg, "imessage", params.accountId),
1593
+ path: groupId ? [groupId] : [],
1594
+ requireMentionOverride: params.opts?.requireMention,
1595
+ overrideOrder: "before-config"
1596
+ });
1597
+ const canDetectMention = mentionRegexes.length > 0;
1598
+ const commandAuthorized = commandAccess.authorized;
1599
+ if (commandAccess.shouldBlockControlCommand) {
1600
+ if (params.logVerbose) logInboundDrop({
1601
+ log: params.logVerbose,
1602
+ channel: "imessage",
1603
+ reason: "control command (unauthorized)",
1604
+ target: sender
1605
+ });
1606
+ return {
1607
+ kind: "drop",
1608
+ reason: "control command (unauthorized)"
1609
+ };
1610
+ }
1611
+ const mentionDecision = resolveInboundMentionDecision({
1612
+ facts: {
1613
+ canDetectMention,
1614
+ wasMentioned: mentioned,
1615
+ hasAnyMention: false,
1616
+ implicitMentionKinds: []
1617
+ },
1618
+ policy: {
1619
+ isGroup,
1620
+ requireMention,
1621
+ allowTextCommands: true,
1622
+ hasControlCommand: hasControlCommandInMessage,
1623
+ commandAuthorized
1624
+ }
1625
+ });
1626
+ const effectiveWasMentioned = mentionDecision.effectiveWasMentioned;
1627
+ if (isGroup && requireMention && canDetectMention && mentionDecision.shouldSkip) {
1628
+ params.logVerbose?.(`imessage: skipping group message (no mention)`);
1629
+ createChannelHistoryWindow({ historyMap: params.groupHistories }).record({
1630
+ historyKey: historyKey ?? "",
1631
+ limit: params.historyLimit,
1632
+ entry: historyKey ? {
1633
+ sender: senderNormalized,
1634
+ body: [bodyText, formatMediaPlaceholderText(mediaFacts)].filter(Boolean).join("\n"),
1635
+ timestamp: createdAt,
1636
+ messageId: params.message.id ? String(params.message.id) : void 0
1637
+ } : null
1638
+ });
1639
+ return {
1640
+ kind: "drop",
1641
+ reason: "no mention"
1642
+ };
1643
+ }
1644
+ return {
1645
+ kind: "dispatch",
1646
+ channelIngress: accessDecision,
1647
+ isGroup,
1648
+ chatId,
1649
+ chatGuid,
1650
+ chatIdentifier,
1651
+ groupId,
1652
+ historyKey,
1653
+ sender,
1654
+ senderNormalized,
1655
+ route,
1656
+ bindingResolution,
1657
+ bodyText,
1658
+ createdAt,
1659
+ replyContext: filteredReplyContext,
1660
+ effectiveWasMentioned,
1661
+ groupRequireMention: requireMention,
1662
+ commandAuthorized,
1663
+ hasControlCommand: hasControlCommandInMessage,
1664
+ groupSystemPrompt: isGroup ? resolveIMessageGroupSystemPrompt({
1665
+ groupConfig: groupListPolicy.groupConfig,
1666
+ defaultConfig: groupListPolicy.defaultConfig
1667
+ }) : void 0
1668
+ };
1669
+ }
1670
+ async function buildIMessageInboundContext(params) {
1671
+ const envelopeOptions = params.envelopeOptions ?? resolveEnvelopeFormatOptions(params.cfg);
1672
+ const { decision } = params;
1673
+ const chatId = decision.chatId;
1674
+ const chatTarget = decision.isGroup && chatId != null ? formatIMessageChatTarget(chatId) : void 0;
1675
+ const messageGuid = normalizeReplyField(params.message.guid);
1676
+ const messageSid = (messageGuid ? rememberIMessageReplyCache({
1677
+ accountId: decision.route.accountId,
1678
+ messageId: messageGuid,
1679
+ chatGuid: decision.chatGuid,
1680
+ chatIdentifier: decision.chatIdentifier,
1681
+ chatId: decision.chatId,
1682
+ timestamp: Date.now(),
1683
+ isFromMe: false
1684
+ }) : null)?.shortId || void 0;
1685
+ 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]` : "";
1686
+ const fromLabel = formatInboundFromLabel({
1687
+ isGroup: decision.isGroup,
1688
+ groupLabel: params.message.chat_name ?? void 0,
1689
+ groupId: chatId !== void 0 ? String(chatId) : "unknown",
1690
+ groupFallback: "Group",
1691
+ directLabel: decision.senderNormalized,
1692
+ directId: decision.sender
1693
+ });
1694
+ let combinedBody = formatInboundEnvelope({
1695
+ channel: "iMessage",
1696
+ from: fromLabel,
1697
+ timestamp: decision.createdAt,
1698
+ body: `${decision.agentBodyText ?? decision.bodyText}${replySuffix}`,
1699
+ chatType: decision.isGroup ? "group" : "direct",
1700
+ sender: {
1701
+ name: decision.senderNormalized,
1702
+ id: decision.sender
1703
+ },
1704
+ previousTimestamp: params.previousTimestamp,
1705
+ envelope: envelopeOptions
1706
+ });
1707
+ if (!decision.isGroup && params.dmHistory?.body) combinedBody = `${params.dmHistory.body}\n\n${combinedBody}`;
1708
+ if (decision.isGroup && decision.historyKey) combinedBody = createChannelHistoryWindow({ historyMap: params.groupHistories }).buildPendingContext({
1709
+ historyKey: decision.historyKey,
1710
+ limit: params.historyLimit,
1711
+ currentMessage: combinedBody,
1712
+ formatEntry: (entry) => formatInboundEnvelope({
1713
+ channel: "iMessage",
1714
+ from: fromLabel,
1715
+ timestamp: entry.timestamp,
1716
+ body: `${entry.body}${entry.messageId ? ` [id:${entry.messageId}]` : ""}`,
1717
+ chatType: "group",
1718
+ senderLabel: entry.sender,
1719
+ envelope: envelopeOptions
1720
+ })
1721
+ });
1722
+ const directService = resolveIMessageDirectChatService(params.accountService, decision.chatGuid) ?? "auto";
1723
+ const imessageTo = decision.isGroup ? chatTarget || `imessage:${decision.sender}` : `${directService}:${decision.sender}`;
1724
+ const imessageFrom = decision.isGroup ? `imessage:group:${chatId ?? "unknown"}` : imessageTo;
1725
+ const inboundHistory = !decision.isGroup && params.dmHistory?.inboundHistory ? params.dmHistory.inboundHistory : decision.isGroup && decision.historyKey && params.historyLimit > 0 ? createChannelHistoryWindow({ historyMap: params.groupHistories }).buildInboundHistory({
1726
+ historyKey: decision.historyKey,
1727
+ limit: params.historyLimit
1728
+ }) : void 0;
1729
+ const media = await toInboundMediaFactsWithMetadata(params.media?.facts?.map((entry) => ({
1730
+ ...entry,
1731
+ url: entry.url ?? entry.path
1732
+ })));
1733
+ return {
1734
+ ctxPayload: (params.buildContext ?? buildChannelInboundEventContext)({
1735
+ channelIngress: decision.channelIngress,
1736
+ channel: "imessage",
1737
+ supplemental: {
1738
+ quote: decision.replyContext ? {
1739
+ id: decision.replyContext.id,
1740
+ body: decision.replyContext.body,
1741
+ sender: decision.replyContext.sender
1742
+ } : void 0,
1743
+ groupSystemPrompt: decision.isGroup ? decision.groupSystemPrompt : void 0
1744
+ },
1745
+ media,
1746
+ messageId: messageSid,
1747
+ messageIdFull: messageGuid,
1748
+ timestamp: decision.createdAt,
1749
+ from: imessageFrom,
1750
+ sender: {
1751
+ id: decision.sender,
1752
+ name: decision.senderNormalized
1753
+ },
1754
+ conversation: {
1755
+ kind: decision.isGroup ? "group" : "direct",
1756
+ id: chatId != null ? String(chatId) : decision.sender,
1757
+ ...decision.isGroup && chatId == null ? {} : { routePeer: {
1758
+ kind: decision.isGroup ? "group" : "direct",
1759
+ id: decision.isGroup ? String(chatId) : decision.senderNormalized
1760
+ } },
1761
+ label: fromLabel
1762
+ },
1763
+ route: {
1764
+ agentId: decision.route.agentId,
1765
+ dmScope: decision.route.dmScope,
1766
+ accountId: decision.route.accountId,
1767
+ routeSessionKey: decision.route.sessionKey
1768
+ },
1769
+ reply: { to: imessageTo },
1770
+ message: {
1771
+ body: combinedBody,
1772
+ bodyForAgent: decision.agentBodyText ?? decision.bodyText,
1773
+ inboundHistory,
1774
+ rawBody: decision.bodyText,
1775
+ commandBody: decision.bodyText
1776
+ },
1777
+ sessionTranscript: { historyLimit: decision.isGroup ? params.historyLimit : 0 },
1778
+ access: {
1779
+ mentions: {
1780
+ canDetectMention: decision.isGroup,
1781
+ wasMentioned: decision.effectiveWasMentioned
1782
+ },
1783
+ commands: { authorized: decision.commandAuthorized }
1784
+ },
1785
+ extra: {
1786
+ GroupSubject: decision.isGroup ? params.message.chat_name ?? void 0 : void 0,
1787
+ GroupRequireMention: decision.isGroup ? decision.groupRequireMention : void 0,
1788
+ GroupMembers: decision.isGroup ? (params.message.participants ?? []).filter(Boolean).join(", ") : void 0,
1789
+ MediaRemoteHost: params.remoteHost,
1790
+ CommandSource: decision.commandAuthorized && decision.hasControlCommand ? "text" : void 0
1791
+ }
1792
+ }),
1793
+ fromLabel,
1794
+ chatTarget,
1795
+ imessageTo,
1796
+ inboundHistory
1797
+ };
1798
+ }
1799
+ function buildIMessageEchoScope(params) {
1800
+ const scopes = [];
1801
+ if (params.isGroup) {
1802
+ const chatIdScope = formatIMessageChatTarget(params.chatId);
1803
+ if (chatIdScope) scopes.push(`${params.accountId}:${chatIdScope}`);
1804
+ } else scopes.push(`${params.accountId}:imessage:${params.sender}`);
1805
+ if (params.chatGuid) scopes.push(`${params.accountId}:chat_guid:${params.chatGuid}`);
1806
+ if (params.chatIdentifier) scopes.push(`${params.accountId}:chat_identifier:${params.chatIdentifier}`);
1807
+ return scopes;
1808
+ }
1809
+ function describeIMessageEchoDropLog(params) {
1810
+ const preview = truncateUtf16Safe(params.messageText, 50);
1811
+ return `imessage: skipping echo message${params.messageId ? ` id=${params.messageId}` : ""}: "${preview}"`;
1812
+ }
1813
+ //#endregion
1814
+ //#region extensions/imessage/src/monitor/ingress.ts
1815
+ const IMESSAGE_INGRESS_PAYLOAD_VERSION = 1;
1816
+ const IMESSAGE_INGRESS_DRAIN_INTERVAL_MS = 1e3;
1817
+ const IMessageIngressPayloadError = createChannelIngressError("IMessageIngressPayloadError");
1818
+ function rawMessageRecord(raw) {
1819
+ if (!isRecord$1(raw)) return null;
1820
+ return isRecord$1(raw.message) ? raw.message : null;
1821
+ }
1822
+ function rawRowid(raw) {
1823
+ return asSafeIntegerInRange(rawMessageRecord(raw)?.id, { min: 0 }) ?? null;
1824
+ }
1825
+ /** Read only stable transport metadata; payload normalization waits for dispatch. */
1826
+ function inspectIMessageIngress(raw) {
1827
+ const message = rawMessageRecord(raw);
1828
+ const guid = typeof message?.guid === "string" ? message.guid.trim() : "";
1829
+ if (!guid) throw new IMessageIngressPayloadError("iMessage ingress row is missing its stable GUID.");
1830
+ const rowid = rawRowid(raw);
1831
+ if (rowid === null) throw new IMessageIngressPayloadError("iMessage ingress row is missing its ROWID.");
1832
+ const chatId = message?.chat_id;
1833
+ if (typeof chatId !== "number" || !Number.isSafeInteger(chatId)) throw new IMessageIngressPayloadError("iMessage ingress row is missing its chat id.");
1834
+ const createdAt = message?.created_at;
1835
+ return {
1836
+ eventId: guid,
1837
+ laneKey: `chat:${chatId}`,
1838
+ rowid,
1839
+ ...typeof createdAt === "string" ? { createdAt } : {}
1840
+ };
1841
+ }
1842
+ function decodeIMessageIngressPayload(payload, eventId) {
1843
+ if (typeof payload.receivedAt !== "number" || !Number.isFinite(payload.receivedAt)) throw new IMessageIngressPayloadError(`iMessage ingress payload ${eventId} is invalid.`);
1844
+ return {
1845
+ version: payload.version,
1846
+ body: {
1847
+ receivedAt: payload.receivedAt,
1848
+ raw: payload.raw,
1849
+ ...payload.catchup ? { catchup: true } : {}
1850
+ }
1851
+ };
1852
+ }
1853
+ function deserializeIMessageIngress(body, eventId) {
1854
+ const message = parseIMessageNotification(body.raw);
1855
+ if (!message) throw new IMessageIngressPayloadError(`iMessage ingress payload ${eventId} is invalid.`);
1856
+ return {
1857
+ raw: body.raw,
1858
+ receivedAt: body.receivedAt,
1859
+ message,
1860
+ ...body.catchup ? { catchup: true } : {}
1861
+ };
1862
+ }
1863
+ function isIMessageAuthenticationFailure(error) {
1864
+ return collectErrorGraphCandidates(error, (current) => [
1865
+ current.cause,
1866
+ current.error,
1867
+ current.original
1868
+ ]).some((candidate) => {
1869
+ const message = formatErrorMessage(candidate).toLowerCase();
1870
+ return message.includes("full disk access") && message.includes("chat.db") || message.includes("authorization denied") && message.includes("messages");
1871
+ });
1872
+ }
1873
+ function resolveIMessageIngressNonRetryableFailure(error) {
1874
+ if (error instanceof IMessageIngressPayloadError) return {
1875
+ reason: "invalid-event",
1876
+ message: error.message
1877
+ };
1878
+ if (isIMessageAuthenticationFailure(error)) return {
1879
+ reason: "authentication-failed",
1880
+ message: formatErrorMessage(error)
1881
+ };
1882
+ return null;
1883
+ }
1884
+ function createIMessageDurableIngress(options) {
1885
+ const queue = options.queue ?? getIMessageRuntime().state.openChannelIngressQueue({ accountId: options.accountId });
1886
+ const now = options.now ?? Date.now;
1887
+ const dispatchAdmissionQueue = new KeyedAsyncQueue();
1888
+ const priorityDispatchQueue = new KeyedAsyncQueue();
1889
+ const monitor = createChannelIngressMonitor({
1890
+ queue,
1891
+ inspect: (event, context) => {
1892
+ try {
1893
+ return inspectIMessageIngress(event.raw);
1894
+ } catch (error) {
1895
+ if (context.phase === "claim") throw new IMessageIngressPayloadError(`iMessage ingress payload ${context.claimedId} is invalid.`, { cause: error });
1896
+ throw error;
1897
+ }
1898
+ },
1899
+ payload: {
1900
+ version: IMESSAGE_INGRESS_PAYLOAD_VERSION,
1901
+ serialize: (event, { receivedAt }) => ({
1902
+ receivedAt,
1903
+ raw: event.raw,
1904
+ ...event.catchup ? { catchup: true } : {}
1905
+ }),
1906
+ deserialize: (body, { claim }) => deserializeIMessageIngress(body, claim.id),
1907
+ encode: ({ body }) => ({
1908
+ version: IMESSAGE_INGRESS_PAYLOAD_VERSION,
1909
+ ...body
1910
+ }),
1911
+ decode: (payload, { claim }) => decodeIMessageIngressPayload(payload, claim.id),
1912
+ createClaimError: (_kind, claim) => new IMessageIngressPayloadError(`iMessage ingress payload ${claim.id} is invalid.`)
1913
+ },
1914
+ deliver: async (event, lifecycle, record) => {
1915
+ if (!event.message || event.receivedAt === void 0) throw new IMessageIngressPayloadError(`iMessage ingress payload ${record.id} is invalid.`);
1916
+ const message = event.message;
1917
+ const receivedAt = event.receivedAt;
1918
+ if (lifecycle.abortSignal.aborted) throw lifecycle.abortSignal.reason;
1919
+ const priorityResult = await priorityDispatchQueue.enqueue(record.laneKey ?? record.id, async () => await options.dispatchPriority?.(message, lifecycle, receivedAt, event.catchup ? { catchup: true } : {}));
1920
+ if (priorityResult) return priorityResult;
1921
+ return await dispatchAdmissionQueue.enqueue(record.laneKey ?? record.id, async () => {
1922
+ return await options.dispatch(message, lifecycle, receivedAt, event.catchup ? { catchup: true } : {});
1923
+ });
1924
+ },
1925
+ pollIntervalMs: IMESSAGE_INGRESS_DRAIN_INTERVAL_MS,
1926
+ retention: {
1927
+ completedTtlMs: 14400 * 1e3,
1928
+ completedMaxEntries: 1e4,
1929
+ failedMaxEntries: 1e3
1930
+ },
1931
+ appendRetryDelaysMs: [0],
1932
+ onDurableAdmission: async (event) => {
1933
+ await options.onDurableEnqueue?.(inspectIMessageIngress(event.raw));
1934
+ },
1935
+ onAdmissionFailure: async (event, error) => {
1936
+ await options.onDurableEnqueueFailure?.(rawRowid(event.raw), error);
1937
+ },
1938
+ drain: {
1939
+ deriveLaneKey: (record) => `${record.laneKey ?? "event"}:${record.id}`,
1940
+ resolveNonRetryableFailure: resolveIMessageIngressNonRetryableFailure,
1941
+ onLog: (message) => options.runtime.log?.(`imessage ${message}`)
1942
+ },
1943
+ now,
1944
+ onError: (error) => options.runtime.error?.(`imessage: ingress drain failed: ${formatErrorMessage(error)}`)
1945
+ });
1946
+ let stopTask;
1947
+ return {
1948
+ receive: async (raw, receiveOpts) => {
1949
+ await monitor.admit({
1950
+ raw,
1951
+ ...receiveOpts?.catchup ? { catchup: true } : {}
1952
+ });
1953
+ },
1954
+ start: monitor.start,
1955
+ stop: () => {
1956
+ stopTask ??= (async () => {
1957
+ await monitor.waitForIdle();
1958
+ await monitor.stop();
1959
+ })();
1960
+ return stopTask;
1961
+ },
1962
+ waitForIdle: monitor.waitForIdle
1963
+ };
1964
+ }
1965
+ //#endregion
1966
+ //#region extensions/imessage/src/monitor/loop-rate-limiter.ts
1967
+ /**
1968
+ * Per-conversation rate limiter that detects rapid-fire identical echo
1969
+ * patterns and suppresses them before they amplify into queue overflow.
1970
+ */
1971
+ const DEFAULT_WINDOW_MS = 6e4;
1972
+ const DEFAULT_MAX_HITS = 5;
1973
+ const CLEANUP_INTERVAL_MS = 12e4;
1974
+ function createLoopRateLimiter(opts) {
1975
+ const windowMs = opts?.windowMs ?? DEFAULT_WINDOW_MS;
1976
+ const maxHits = opts?.maxHits ?? DEFAULT_MAX_HITS;
1977
+ const conversations = /* @__PURE__ */ new Map();
1978
+ let lastCleanup = Date.now();
1979
+ function cleanup() {
1980
+ const now = Date.now();
1981
+ if (now - lastCleanup < CLEANUP_INTERVAL_MS) return;
1982
+ lastCleanup = now;
1983
+ for (const [key, win] of conversations.entries()) {
1984
+ const recent = win.timestamps.filter((ts) => now - ts <= windowMs);
1985
+ if (recent.length === 0) conversations.delete(key);
1986
+ else win.timestamps = recent;
1987
+ }
1988
+ }
1989
+ return {
1990
+ record(conversationKey) {
1991
+ cleanup();
1992
+ let win = conversations.get(conversationKey);
1993
+ if (!win) {
1994
+ win = { timestamps: [] };
1995
+ conversations.set(conversationKey, win);
1996
+ }
1997
+ win.timestamps.push(Date.now());
1998
+ },
1999
+ isRateLimited(conversationKey) {
2000
+ cleanup();
2001
+ const win = conversations.get(conversationKey);
2002
+ if (!win) return false;
2003
+ const now = Date.now();
2004
+ const recent = win.timestamps.filter((ts) => now - ts <= windowMs);
2005
+ win.timestamps = recent;
2006
+ return recent.length >= maxHits;
2007
+ }
2008
+ };
2009
+ }
2010
+ //#endregion
2011
+ //#region extensions/imessage/src/monitor/media-staging.ts
2012
+ function createTypeOnlyIMessageAttachment(attachment) {
2013
+ const contentType = attachment.mime_type?.trim() || void 0;
2014
+ return {
2015
+ contentType,
2016
+ kind: kindFromMime(contentType) ?? "unknown"
2017
+ };
2018
+ }
2019
+ function isHeicAttachment(attachmentPath, mimeType) {
2020
+ const normalizedMime = mimeType?.toLowerCase();
2021
+ if (normalizedMime === "image/heic" || normalizedMime === "image/heif") return true;
2022
+ const ext = path.extname(attachmentPath).toLowerCase();
2023
+ return ext === ".heic" || ext === ".heif";
2024
+ }
2025
+ function jpegFilenameForAttachment(attachmentPath) {
2026
+ return `${path.parse(attachmentPath).name || "imessage-attachment"}.jpg`;
2027
+ }
2028
+ function hasWildcardSegment(root) {
2029
+ return root.replaceAll("\\", "/").split("/").includes("*");
2030
+ }
2031
+ async function canonicalizeAllowedRoots(roots) {
2032
+ const canonicalRoots = [];
2033
+ for (const root of roots) {
2034
+ canonicalRoots.push(root);
2035
+ if (hasWildcardSegment(root)) continue;
2036
+ const canonicalRoot = await fs.realpath(root).catch(() => void 0);
2037
+ if (canonicalRoot && canonicalRoot !== root) canonicalRoots.push(canonicalRoot);
2038
+ }
2039
+ return canonicalRoots;
2040
+ }
2041
+ async function assertAllowedCanonicalAttachmentPath(params) {
2042
+ if (!params.allowedRoots) return;
2043
+ const canonicalRoots = await canonicalizeAllowedRoots(params.allowedRoots);
2044
+ if (!isInboundPathAllowed({
2045
+ filePath: params.canonicalPath,
2046
+ roots: canonicalRoots
2047
+ })) throw new Error("attachment path resolves outside allowed roots");
2048
+ }
2049
+ async function readPinnedAttachmentBytes(handle, maxBytes) {
2050
+ const chunks = [];
2051
+ let totalBytes = 0;
2052
+ while (totalBytes <= maxBytes) {
2053
+ const remaining = maxBytes + 1 - totalBytes;
2054
+ const chunk = Buffer.allocUnsafe(Math.min(64 * 1024, remaining));
2055
+ const { bytesRead } = await handle.read(chunk, 0, chunk.length, null);
2056
+ if (bytesRead === 0) return Buffer.concat(chunks, totalBytes);
2057
+ chunks.push(chunk.subarray(0, bytesRead));
2058
+ totalBytes += bytesRead;
2059
+ }
2060
+ throw new Error(`attachment exceeds ${Math.round(maxBytes / (1024 * 1024))}MB limit`);
2061
+ }
2062
+ async function readAttachmentBuffer(params) {
2063
+ const opened = await (params.deps.openLocalFileSafely ?? openLocalFileSafely)({ filePath: params.attachmentPath });
2064
+ try {
2065
+ if (opened.stat.size > params.maxBytes) throw new Error(`attachment exceeds ${Math.round(params.maxBytes / (1024 * 1024))}MB limit`);
2066
+ await assertAllowedCanonicalAttachmentPath({
2067
+ canonicalPath: opened.realPath,
2068
+ allowedRoots: params.allowedRoots
2069
+ });
2070
+ const buffer = await readPinnedAttachmentBytes(opened.handle, params.maxBytes);
2071
+ if (isHeicAttachment(params.attachmentPath, params.mimeType)) try {
2072
+ const convert = params.deps.convertHeicToJpeg;
2073
+ return {
2074
+ buffer: (await withTempWorkspace({
2075
+ rootDir: resolvePreferredOpenClawTmpDir(),
2076
+ prefix: "openclaw-imessage-heic-"
2077
+ }, async (workspace) => {
2078
+ const pinnedPath = await workspace.write("attachment.heic", buffer);
2079
+ return convert ? { buffer: await convert(pinnedPath, params.maxBytes) } : await loadWebMedia(pinnedPath, {
2080
+ maxBytes: params.maxBytes,
2081
+ localRoots: [workspace.dir]
2082
+ });
2083
+ })).buffer,
2084
+ contentType: "image/jpeg",
2085
+ originalFilename: jpegFilenameForAttachment(params.attachmentPath)
2086
+ };
2087
+ } catch (err) {
2088
+ params.deps.logVerbose?.(`imessage: HEIC attachment conversion failed; staging original instead: ${String(err)}`);
2089
+ }
2090
+ return {
2091
+ buffer,
2092
+ contentType: params.mimeType ?? void 0,
2093
+ originalFilename: path.basename(params.attachmentPath)
2094
+ };
2095
+ } finally {
2096
+ await opened.handle.close().catch(() => void 0);
2097
+ }
2098
+ }
2099
+ async function stageIMessageAttachments(attachments, params) {
2100
+ const deps = params.deps ?? {};
2101
+ const save = deps.saveMediaBuffer ?? saveMediaBuffer;
2102
+ const staged = [];
2103
+ let unavailableCount = 0;
2104
+ for (const attachment of attachments) {
2105
+ const attachmentPath = attachment.original_path?.trim();
2106
+ if (!attachmentPath || attachment.missing) {
2107
+ unavailableCount += 1;
2108
+ staged.push(createTypeOnlyIMessageAttachment(attachment));
2109
+ continue;
2110
+ }
2111
+ try {
2112
+ const media = await readAttachmentBuffer({
2113
+ attachmentPath,
2114
+ mimeType: attachment.mime_type,
2115
+ maxBytes: params.maxBytes,
2116
+ allowedRoots: params.allowedRoots,
2117
+ deps
2118
+ });
2119
+ const saved = await save(media.buffer, media.contentType, "inbound", params.maxBytes, media.originalFilename);
2120
+ const contentType = saved.contentType ?? media.contentType;
2121
+ staged.push({
2122
+ path: saved.path,
2123
+ contentType,
2124
+ kind: kindFromMime(contentType) ?? "unknown"
2125
+ });
2126
+ } catch (err) {
2127
+ unavailableCount += 1;
2128
+ staged.push(createTypeOnlyIMessageAttachment(attachment));
2129
+ deps.logVerbose?.(`imessage: failed to stage inbound attachment: ${String(err)}`);
2130
+ }
2131
+ }
2132
+ return {
2133
+ attachments: staged,
2134
+ unavailableCount
2135
+ };
2136
+ }
2137
+ //#endregion
2138
+ //#region extensions/imessage/src/monitor/poll-comment.ts
2139
+ const DEFAULT_COMMENT_WINDOW_MS = 15e3;
2140
+ function normalizeGuid(guid) {
2141
+ return guid?.trim() ?? "";
2142
+ }
2143
+ function normalizeSender(sender) {
2144
+ return sender?.trim().toLowerCase() ?? "";
2145
+ }
2146
+ function createPollCommentFolder(options) {
2147
+ const windowMs = options?.windowMs ?? DEFAULT_COMMENT_WINDOW_MS;
2148
+ const seenPolls = /* @__PURE__ */ new Map();
2149
+ function prune(referenceMs) {
2150
+ for (const [key, seen] of seenPolls) if (referenceMs - seen.atMs > windowMs) seenPolls.delete(key);
2151
+ }
2152
+ return {
2153
+ rememberPoll(guid, atMs, sender) {
2154
+ const key = normalizeGuid(guid);
2155
+ if (!key || !Number.isFinite(atMs)) return;
2156
+ prune(atMs);
2157
+ seenPolls.set(key, {
2158
+ atMs,
2159
+ sender: normalizeSender(sender)
2160
+ });
2161
+ },
2162
+ isPollComment(replyToGuid, atMs, sender) {
2163
+ const key = normalizeGuid(replyToGuid);
2164
+ if (!key || !Number.isFinite(atMs)) return false;
2165
+ const seen = seenPolls.get(key);
2166
+ if (!seen || atMs < seen.atMs || atMs - seen.atMs > windowMs) return false;
2167
+ const replySender = normalizeSender(sender);
2168
+ return seen.sender.length > 0 && replySender.length > 0 && seen.sender === replySender;
2169
+ }
2170
+ };
2171
+ }
2172
+ //#endregion
2173
+ //#region extensions/imessage/src/monitor/poll-render.ts
2174
+ function renderIMessagePollBody(poll, sender, renderOptions) {
2175
+ const options = poll.options ?? [];
2176
+ if (poll.kind === "vote" || poll.vote && options.length === 0) {
2177
+ if (poll.votes) {
2178
+ const snapshotParticipant = poll.votes.find((vote) => vote.participant?.trim())?.participant?.trim() || sender?.trim() || "someone";
2179
+ const selectionsByParticipant = /* @__PURE__ */ new Map();
2180
+ for (const vote of poll.votes) {
2181
+ if (vote.event_type === "removed") continue;
2182
+ const who = vote.participant?.trim() || snapshotParticipant;
2183
+ const what = vote.option_text?.trim() || vote.option_id || "an option";
2184
+ const selections = selectionsByParticipant.get(who) ?? [];
2185
+ if (!selections.includes(what)) selections.push(what);
2186
+ selectionsByParticipant.set(who, selections);
2187
+ }
2188
+ if (selectionsByParticipant.size === 0) return `\u{1F4CA} Poll selections: ${snapshotParticipant} currently selected no options`;
2189
+ return `\u{1F4CA} Poll selections: ${Array.from(selectionsByParticipant, ([who, selections]) => {
2190
+ return `${who} currently selected ${selections.map((selection) => `"${selection}"`).join(", ")}`;
2191
+ }).join("; ")}`;
2192
+ }
2193
+ const vote = poll.vote;
2194
+ if (!vote) return "📊 Poll vote received";
2195
+ const who = vote.participant?.trim() || sender?.trim() || "someone";
2196
+ const what = vote.option_text?.trim() || vote.option_id || "an option";
2197
+ return `\u{1F4CA} Poll vote: ${who} ${vote.event_type === "removed" ? "removed their vote for" : "voted for"} "${what}"`;
2198
+ }
2199
+ if (options.length === 0) return null;
2200
+ const tally = /* @__PURE__ */ new Map();
2201
+ for (const vote of poll.votes ?? []) {
2202
+ if (vote.event_type === "removed" || !vote.option_id) continue;
2203
+ tally.set(vote.option_id, (tally.get(vote.option_id) ?? 0) + 1);
2204
+ }
2205
+ const optionList = options.map((option, index) => {
2206
+ const count = tally.get(option.id) ?? 0;
2207
+ const id = renderOptions?.preferOptionId ? ` (id: ${option.id})` : "";
2208
+ return `${index + 1}) ${option.text}${id}${count > 0 ? ` [${count}]` : ""}`;
2209
+ }).join(" ");
2210
+ const question = poll.question?.trim();
2211
+ const selector = renderOptions?.preferOptionId ? "pollOptionId = the stable option id shown above" : "pollOptionIndex = the option number";
2212
+ return `\u{1F4CA} Poll${question ? `: ${question}` : ""} — options: ${optionList}. Cast your vote on this poll with the poll-vote action (${selector}); do not answer in a text reply.`;
2213
+ }
2214
+ //#endregion
2215
+ //#region extensions/imessage/src/monitor/reaction-system-event.ts
2216
+ function enqueueIMessageReactionSystemEvent(params) {
2217
+ const { decision, runtime } = params;
2218
+ const queued = enqueueSystemEvent(decision.text, {
2219
+ sessionKey: decision.route.sessionKey,
2220
+ contextKey: decision.contextKey
2221
+ });
2222
+ 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}`);
2223
+ params.logVerbose?.(`imessage: reaction event enqueued: ${decision.text}`);
2224
+ return queued;
2225
+ }
2226
+ //#endregion
2227
+ //#region extensions/imessage/src/monitor/recovery-cursor.ts
2228
+ const IMESSAGE_RECOVERY_CURSOR_NAMESPACE = "imessage.recovery-cursor";
2229
+ const IMESSAGE_RECOVERY_CURSOR_MAX_ENTRIES = 64;
2230
+ const LEGACY_CATCHUP_CURSOR_NAMESPACE = "imessage.catchup-cursors";
2231
+ const LEGACY_CATCHUP_CURSOR_MAX_ENTRIES = 256;
2232
+ function openRecoveryCursorStore() {
2233
+ return getIMessageRuntime().state.openSyncKeyedStore({
2234
+ namespace: IMESSAGE_RECOVERY_CURSOR_NAMESPACE,
2235
+ maxEntries: IMESSAGE_RECOVERY_CURSOR_MAX_ENTRIES
2236
+ });
2237
+ }
2238
+ function normalizeLocalDbPath(dbPath) {
2239
+ let resolved = dbPath.trim();
2240
+ if (resolved.startsWith("~")) {
2241
+ const home = resolveIMessageHomeDir();
2242
+ if (home) resolved = path.join(home, resolved.slice(1).replace(/^\/+/, ""));
2243
+ }
2244
+ return path.resolve(resolved);
2245
+ }
2246
+ /**
2247
+ * Stable identity for the watched Messages database. A changed identity means a
2248
+ * different chat.db (different `dbPath`, custom `cliPath`, or a remote host),
2249
+ * whose rowids share no ordering with the previous one, so the cursor must not
2250
+ * carry across. Local paths are canonicalized so the implicit default and an
2251
+ * explicit path to the same chat.db resolve to one identity.
2252
+ */
2253
+ function resolveIMessageRecoveryCursorDbIdentity(params) {
2254
+ const remoteHost = params.remoteHost?.trim();
2255
+ if (remoteHost) return `remote:${remoteHost}:${params.dbPath?.trim() || "default"}`;
2256
+ const dbPath = params.dbPath?.trim();
2257
+ if (dbPath) return `local:${normalizeLocalDbPath(dbPath)}`;
2258
+ const cliPath = params.cliPath?.trim();
2259
+ if (!cliPath || cliPath === "imsg" || path.basename(cliPath) === "imsg") {
2260
+ const home = resolveIMessageHomeDir();
2261
+ return home ? `local:${normalizeLocalDbPath(path.join(home, "Library", "Messages", "chat.db"))}` : "local:default";
2262
+ }
2263
+ return `local:cli:${cliPath}`;
2264
+ }
2265
+ function recoveryCursorStoreKey(accountId, dbIdentity) {
2266
+ return `${accountId}\u0000${dbIdentity}`;
2267
+ }
2268
+ function readRecoveryCursor(accountId, dbIdentity) {
2269
+ try {
2270
+ const store = openRecoveryCursorStore();
2271
+ const key = recoveryCursorStoreKey(accountId, dbIdentity);
2272
+ const value = store.lookup(key);
2273
+ if (value) return Number.isFinite(value.lastRowid) ? value.lastRowid : null;
2274
+ const legacy = store.consume(accountId);
2275
+ if (legacy && Number.isFinite(legacy.lastRowid)) {
2276
+ store.register(key, { lastRowid: legacy.lastRowid });
2277
+ return legacy.lastRowid;
2278
+ }
2279
+ return null;
2280
+ } catch {
2281
+ return null;
2282
+ }
2283
+ }
2284
+ function migrateLegacyCatchupCursor(accountId, dbIdentity) {
2285
+ try {
2286
+ const legacy = getIMessageRuntime().state.openSyncKeyedStore({
2287
+ namespace: LEGACY_CATCHUP_CURSOR_NAMESPACE,
2288
+ maxEntries: LEGACY_CATCHUP_CURSOR_MAX_ENTRIES
2289
+ });
2290
+ const key = createHash("sha256").update(accountId, "utf8").digest("hex").slice(0, 32);
2291
+ const value = legacy.consume(key);
2292
+ const rowid = typeof value?.lastSeenRowid === "number" && Number.isFinite(value.lastSeenRowid) ? value.lastSeenRowid : null;
2293
+ if (rowid !== null) advanceIMessageRecoveryCursor(accountId, dbIdentity, rowid);
2294
+ return rowid;
2295
+ } catch {
2296
+ return null;
2297
+ }
2298
+ }
2299
+ function reconcileRecoveryCursorToWatermark(accountId, dbIdentity, cursorRowid, watermarkRowid) {
2300
+ if (cursorRowid === null || watermarkRowid === null || cursorRowid <= watermarkRowid) return cursorRowid;
2301
+ try {
2302
+ openRecoveryCursorStore().register(recoveryCursorStoreKey(accountId, dbIdentity), { lastRowid: watermarkRowid });
2303
+ } catch {
2304
+ return watermarkRowid;
2305
+ }
2306
+ return watermarkRowid;
2307
+ }
2308
+ /**
2309
+ * Last durably admitted rowid for this account on `dbIdentity`, or null when
2310
+ * none is recorded yet (including when the only stored cursor belongs to a
2311
+ * different database).
2312
+ */
2313
+ function loadIMessageRecoveryCursor(accountId, dbIdentity, options = {}) {
2314
+ const watermarkRowid = typeof options.watermarkRowid === "number" && Number.isFinite(options.watermarkRowid) ? options.watermarkRowid : null;
2315
+ const current = readRecoveryCursor(accountId, dbIdentity);
2316
+ if (current !== null) return reconcileRecoveryCursorToWatermark(accountId, dbIdentity, current, watermarkRowid);
2317
+ if (options.migrateLegacyCatchup === false) return null;
2318
+ return reconcileRecoveryCursorToWatermark(accountId, dbIdentity, migrateLegacyCatchupCursor(accountId, dbIdentity), watermarkRowid);
2319
+ }
2320
+ /** Advance the cursor forward to `rowid` (monotonic per database; never rewinds). */
2321
+ function advanceIMessageRecoveryCursor(accountId, dbIdentity, rowid) {
2322
+ if (!Number.isFinite(rowid)) return;
2323
+ try {
2324
+ const store = openRecoveryCursorStore();
2325
+ const key = recoveryCursorStoreKey(accountId, dbIdentity);
2326
+ const current = store.lookup(key);
2327
+ if (current && current.lastRowid >= rowid) return;
2328
+ store.register(key, { lastRowid: rowid });
2329
+ } catch {}
2330
+ }
2331
+ //#endregion
2332
+ //#region extensions/imessage/src/monitor/runtime.ts
2333
+ function resolveRuntime(opts) {
2334
+ return opts.runtime ?? createNonExitingRuntime();
2335
+ }
2336
+ //#endregion
2337
+ //#region extensions/imessage/src/monitor/self-chat-cache.ts
2338
+ const SELF_CHAT_TTL_MS = 1e4;
2339
+ const SELF_CHAT_CREATED_AT_TOLERANCE_MS = 1e3;
2340
+ const MAX_SELF_CHAT_CACHE_ENTRIES = 512;
2341
+ const CLEANUP_MIN_INTERVAL_MS = 1e3;
2342
+ function normalizeText(text) {
2343
+ if (!text) return null;
2344
+ const normalized = text.replace(/\r\n?/g, "\n").trim();
2345
+ return normalized ? normalized : null;
2346
+ }
2347
+ function isUsableTimestamp(createdAt) {
2348
+ return typeof createdAt === "number" && Number.isFinite(createdAt);
2349
+ }
2350
+ function digestText(text) {
2351
+ return createHash("sha256").update(text).digest("hex");
2352
+ }
2353
+ function buildScope(parts) {
2354
+ if (!parts.isGroup) return `${parts.accountId}:imessage:${parts.sender}`;
2355
+ const chatTarget = formatIMessageChatTarget(parts.chatId) || "chat_id:unknown";
2356
+ return `${parts.accountId}:${chatTarget}:imessage:${parts.sender}`;
2357
+ }
2358
+ var DefaultSelfChatCache = class {
2359
+ constructor() {
2360
+ this.cache = /* @__PURE__ */ new Map();
2361
+ this.insertionOrder = [];
2362
+ this.insertionOrderOffset = 0;
2363
+ this.entryCount = 0;
2364
+ this.lastCleanupAt = 0;
2365
+ this.nextEntryId = 1;
2366
+ }
2367
+ buildBucketKey(lookup) {
2368
+ const text = normalizeText(lookup.text);
2369
+ if (!text) return null;
2370
+ return `${buildScope(lookup)}:${digestText(text)}`;
2371
+ }
2372
+ remember(lookup) {
2373
+ const key = this.buildBucketKey(lookup);
2374
+ if (!key || !isUsableTimestamp(lookup.createdAt)) return;
2375
+ const entries = this.cache.get(key) ?? /* @__PURE__ */ new Map();
2376
+ const entry = {
2377
+ id: this.nextEntryId,
2378
+ createdAt: lookup.createdAt,
2379
+ createdAtSkewToleranceMs: lookup.allowCreatedAtSkew ? SELF_CHAT_CREATED_AT_TOLERANCE_MS : 0,
2380
+ rememberedAt: Date.now()
2381
+ };
2382
+ this.nextEntryId += 1;
2383
+ entries.set(entry.id, entry);
2384
+ this.cache.set(key, entries);
2385
+ this.insertionOrder.push({
2386
+ key,
2387
+ id: entry.id
2388
+ });
2389
+ this.entryCount += 1;
2390
+ this.maybeCleanup();
2391
+ }
2392
+ has(lookup) {
2393
+ this.maybeCleanup();
2394
+ const key = this.buildBucketKey(lookup);
2395
+ if (!key || !isUsableTimestamp(lookup.createdAt)) return false;
2396
+ const entries = this.cache.get(key);
2397
+ if (!entries) return false;
2398
+ const now = Date.now();
2399
+ const createdAt = lookup.createdAt;
2400
+ return [...entries.values()].some((entry) => {
2401
+ const createdAtDelta = Math.abs(entry.createdAt - createdAt);
2402
+ return now - entry.rememberedAt <= SELF_CHAT_TTL_MS && (createdAtDelta === 0 || createdAtDelta < entry.createdAtSkewToleranceMs);
2403
+ });
2404
+ }
2405
+ maybeCleanup() {
2406
+ const now = Date.now();
2407
+ if (now - this.lastCleanupAt < CLEANUP_MIN_INTERVAL_MS) return;
2408
+ this.lastCleanupAt = now;
2409
+ for (const [key, entries] of this.cache.entries()) {
2410
+ for (const [id, entry] of entries.entries()) if (now - entry.rememberedAt > SELF_CHAT_TTL_MS) {
2411
+ entries.delete(id);
2412
+ this.entryCount -= 1;
2413
+ }
2414
+ if (entries.size === 0) this.cache.delete(key);
2415
+ }
2416
+ while (this.entryCount > MAX_SELF_CHAT_CACHE_ENTRIES && this.insertionOrderOffset < this.insertionOrder.length) {
2417
+ const oldest = expectDefined(this.insertionOrder[this.insertionOrderOffset], "oldest iMessage self-chat cache entry");
2418
+ this.insertionOrderOffset += 1;
2419
+ const entries = this.cache.get(oldest.key);
2420
+ if (!entries) continue;
2421
+ if (!entries.delete(oldest.id)) continue;
2422
+ this.entryCount -= 1;
2423
+ if (entries.size === 0) this.cache.delete(oldest.key);
2424
+ }
2425
+ this.compactInsertionOrder();
2426
+ }
2427
+ compactInsertionOrder() {
2428
+ if (this.insertionOrderOffset <= 1024 && this.insertionOrder.length <= this.entryCount + 1024) return;
2429
+ this.insertionOrder = this.insertionOrder.slice(this.insertionOrderOffset).filter((entry) => this.cache.get(entry.key)?.has(entry.id));
2430
+ this.insertionOrderOffset = 0;
2431
+ }
2432
+ };
2433
+ function createSelfChatCache() {
2434
+ return new DefaultSelfChatCache();
2435
+ }
2436
+ //#endregion
2437
+ //#region extensions/imessage/src/monitor/watch-error-log.ts
2438
+ const MAX_WATCH_ERROR_MESSAGE_CHARS = 200;
2439
+ function sanitizeIMessageWatchErrorPayload(payload) {
2440
+ if (!isRecord(payload)) return {};
2441
+ const safe = {};
2442
+ if (typeof payload.code === "number" && Number.isFinite(payload.code)) safe.code = payload.code;
2443
+ if (typeof payload.message === "string") {
2444
+ const sanitizedMessage = sanitizeTerminalText(payload.message);
2445
+ if (sanitizedMessage) safe.message = sanitizedMessage.length > MAX_WATCH_ERROR_MESSAGE_CHARS ? `${truncateUtf16Safe(sanitizedMessage, MAX_WATCH_ERROR_MESSAGE_CHARS - 1)}…` : sanitizedMessage;
2446
+ }
2447
+ return safe;
2448
+ }
2449
+ //#endregion
2450
+ //#region extensions/imessage/src/monitor/monitor-provider.ts
2451
+ const WATCH_SUBSCRIBE_MAX_ATTEMPTS = 3;
2452
+ const WATCH_SUBSCRIBE_RETRY_DELAY_MS = 1e3;
2453
+ const CHANNEL_APPROVAL_GATEWAY_RUNTIME_CONTEXT_CAPABILITY = "approval.gateway";
2454
+ const APPROVAL_REACTION_POLL_INTERVAL_MS = 2e3;
2455
+ const APPROVAL_REACTION_DISCOVERY_INTERVAL_MS = 6e4;
2456
+ const IMESSAGE_TYPING_KEEPALIVE_INTERVAL_MS = 8e3;
2457
+ const IMESSAGE_TYPING_KEEPALIVE_MAX_DURATION_MS = 10 * 6e4;
2458
+ function resolveConfiguredIMessageTypingMode(cfg, agentId) {
2459
+ return resolveAgentConfig(cfg, agentId)?.typingMode ?? cfg.agents?.defaults?.typingMode;
2460
+ }
2461
+ function isIMessagePluginPayloadAttachment(attachment) {
2462
+ const attachmentPath = attachment.original_path?.trim().toLowerCase() ?? "";
2463
+ const transferName = attachment.transfer_name?.trim().toLowerCase() ?? "";
2464
+ const uti = attachment.uti?.trim().toLowerCase() ?? "";
2465
+ return attachmentPath.endsWith(".pluginpayloadattachment") || transferName.endsWith(".pluginpayloadattachment") || uti === "com.apple.messages.pluginpayloadattachment";
2466
+ }
2467
+ function resolveIMessageInboundMediaInput(params) {
2468
+ const mediaCandidates = params.attachments.filter((entry) => !isIMessagePluginPayloadAttachment(entry));
2469
+ const mediaFacts = mediaCandidates.map((attachment) => {
2470
+ const contentType = attachment.mime_type?.trim() || void 0;
2471
+ return {
2472
+ contentType,
2473
+ kind: kindFromMime(contentType) ?? "unknown"
2474
+ };
2475
+ });
2476
+ const rawMediaAttachments = mediaCandidates.map((attachment, index) => {
2477
+ const fact = mediaFacts[index] ?? { kind: "unknown" };
2478
+ const attachmentPath = attachment.original_path?.trim();
2479
+ if (!attachmentPath || attachment.missing) return fact;
2480
+ if (!isInboundPathAllowed({
2481
+ filePath: attachmentPath,
2482
+ roots: params.effectiveAttachmentRoots
2483
+ })) {
2484
+ params.logVerbose?.(`imessage: dropping inbound attachment outside allowed roots: ${attachmentPath}`);
2485
+ return fact;
2486
+ }
2487
+ return {
2488
+ ...fact,
2489
+ path: attachmentPath
2490
+ };
2491
+ });
2492
+ return {
2493
+ bodyText: params.messageText,
2494
+ mediaFacts,
2495
+ mediaCandidates,
2496
+ rawMediaAttachments
2497
+ };
2498
+ }
2499
+ function formatIMessageInboundMediaBody(params) {
2500
+ return formatInboundMediaUnavailableText({
2501
+ body: params.messageText,
2502
+ notice: `[imessage ${params.unavailableCount > 1 ? `${params.unavailableCount} attachments` : "attachment"} unavailable]`
2503
+ });
2504
+ }
2505
+ function resolveIMessageWatchSourceDbPath(params) {
2506
+ return resolveIMessageChatDbLookupPath(params);
2507
+ }
2508
+ async function resolveIMessageStartupRowidWatermark(dbPath) {
2509
+ let database;
2510
+ try {
2511
+ database = openNodeSqliteDatabase(dbPath, { readOnly: true });
2512
+ const row = database.prepare("SELECT MAX(ROWID) AS maxRowid FROM message").get();
2513
+ if (typeof row?.maxRowid === "number" && Number.isFinite(row.maxRowid)) return row.maxRowid;
2514
+ return row?.maxRowid === null ? 0 : null;
2515
+ } catch (err) {
2516
+ logVerbose(`imessage: startup rowid watermark unavailable for db=${dbPath}: ${String(err)}`);
2517
+ return null;
2518
+ } finally {
2519
+ database?.close();
2520
+ }
2521
+ }
2522
+ const warnIfImsgUpgradeNeeded = (() => {
2523
+ let fired = false;
2524
+ return { fireOnce: (rpcMethods, runtime) => {
2525
+ if (fired) return;
2526
+ fired = true;
2527
+ const detail = rpcMethods.length === 0 ? "imsg build pre-dates the rpc_methods capability list" : `imsg rpc_methods=[${rpcMethods.join(", ")}] does not include typing/read`;
2528
+ runtime.log?.(warn(`imessage: typing indicators / read receipts gated off (${detail}). Upgrade imsg (current bridge needs typing+read in rpc_methods).`));
2529
+ } };
2530
+ })();
2531
+ function isRetriableWatchSubscribeStartupError(error) {
2532
+ return /imsg rpc timeout \(watch\.subscribe\)|imsg rpc (closed|exited|not running)/i.test(String(error));
2533
+ }
2534
+ const IMESSAGE_DIAGNOSTIC_DROP_REASONS = /* @__PURE__ */ new Set([
2535
+ "agent echo in self-chat",
2536
+ "echo",
2537
+ "from me",
2538
+ "reflected assistant content",
2539
+ "self-chat echo"
2540
+ ]);
2541
+ const IMESSAGE_THROTTLED_DIAGNOSTIC_DROP_REASONS = /* @__PURE__ */ new Set(["from me"]);
2542
+ function shouldThrottleIMessageInboundDropDiagnostic(reason) {
2543
+ return IMESSAGE_THROTTLED_DIAGNOSTIC_DROP_REASONS.has(reason);
2544
+ }
2545
+ function describeIMessageInboundDropDiagnostic(params) {
2546
+ if (!IMESSAGE_DIAGNOSTIC_DROP_REASONS.has(params.reason)) return null;
2547
+ const messageId = typeof params.message.id === "number" || typeof params.message.id === "string" ? String(params.message.id) : "unknown";
2548
+ return `imessage: dropped inbound message account=${params.accountId} reason=${JSON.stringify(params.reason)} chat_id=${params.message.chat_id ?? "unknown"} group=${params.message.is_group === true} message_id=${messageId} guid=${params.message.guid ? "present" : "missing"} created_at=${params.message.created_at ?? "unknown"}`;
2549
+ }
2550
+ function describeIMessageWatchSubscribeStartupFailure(params) {
2551
+ const retry = params.retryDelayMs !== void 0 ? ` retry_in_ms=${params.retryDelayMs}` : "";
2552
+ return `imessage: watch.subscribe startup failed attempt=${params.attempt}/${params.maxAttempts} account=${params.accountId} cliPath=${params.cliPath} dbPath=${params.dbPath ? "configured" : "default"} remoteHost=${params.remoteHost ? "configured" : "none"} timeoutMs=${params.probeTimeoutMs} since_rowid=${params.watchSinceRowid ?? "none"} attachments=${params.includeAttachments} include_reactions=true${retry}: ${String(params.error)}`;
2553
+ }
2554
+ async function waitForWatchSubscribeRetryDelay(params) {
2555
+ if (params.ms <= 0) return;
2556
+ await new Promise((resolve) => {
2557
+ const timer = setTimeout(() => {
2558
+ params.abortSignal?.removeEventListener("abort", onAbort);
2559
+ resolve();
2560
+ }, params.ms);
2561
+ const onAbort = () => {
2562
+ clearTimeout(timer);
2563
+ params.abortSignal?.removeEventListener("abort", onAbort);
2564
+ resolve();
2565
+ };
2566
+ params.abortSignal?.addEventListener("abort", onAbort, { once: true });
2567
+ });
2568
+ }
2569
+ async function monitorIMessageProvider(opts = {}) {
2570
+ const runtime = resolveRuntime(opts);
2571
+ const cfg = opts.config ?? getRuntimeConfig();
2572
+ const accountInfo = resolveIMessageAccount({
2573
+ cfg,
2574
+ accountId: opts.accountId
2575
+ });
2576
+ const approvalGatewayRuntime = opts.channelRuntime?.runtimeContexts.get({
2577
+ channelId: "imessage",
2578
+ accountId: accountInfo.accountId,
2579
+ capability: CHANNEL_APPROVAL_GATEWAY_RUNTIME_CONTEXT_CAPABILITY
2580
+ });
2581
+ const imessageCfg = accountInfo.config;
2582
+ const historyLimit = Math.max(0, imessageCfg.historyLimit ?? cfg.messages?.groupChat?.historyLimit ?? DEFAULT_GROUP_HISTORY_LIMIT);
2583
+ const groupHistories = /* @__PURE__ */ new Map();
2584
+ const sentMessageCache = createSentMessageCache();
2585
+ const selfChatCache = createSelfChatCache();
2586
+ const loopRateLimiter = createLoopRateLimiter();
2587
+ const textLimit = resolveTextChunkLimit(cfg, "imessage", accountInfo.accountId);
2588
+ const allowFrom = normalizeStringEntries(opts.allowFrom ?? imessageCfg.allowFrom);
2589
+ const configuredGroupAllowFrom = opts.groupAllowFrom ?? imessageCfg.groupAllowFrom;
2590
+ const groupAllowFrom = normalizeStringEntries(configuredGroupAllowFrom ?? (imessageCfg.allowFrom && imessageCfg.allowFrom.length > 0 ? imessageCfg.allowFrom : []));
2591
+ const allowLegacyConversationAllowFromForGroup = configuredGroupAllowFrom == null;
2592
+ const defaultGroupPolicy = resolveDefaultGroupPolicy(cfg);
2593
+ const { groupPolicy, providerMissingFallbackApplied } = resolveOpenProviderRuntimeGroupPolicy({
2594
+ providerConfigPresent: cfg.channels?.imessage !== void 0,
2595
+ groupPolicy: imessageCfg.groupPolicy,
2596
+ defaultGroupPolicy
2597
+ });
2598
+ warnMissingProviderGroupPolicyFallbackOnce({
2599
+ providerMissingFallbackApplied,
2600
+ providerKey: "imessage",
2601
+ accountId: accountInfo.accountId,
2602
+ log: (message) => runtime.log?.(warn(message))
2603
+ });
2604
+ warnGroupAllowlistMisconfigOnce({
2605
+ groupPolicy,
2606
+ hasGroupAllowFrom: mergeIMessageGroupAllowFromWithLegacyChatTargets({
2607
+ groupAllowFrom,
2608
+ allowFrom,
2609
+ allowLegacyConversationTargets: allowLegacyConversationAllowFromForGroup
2610
+ }).length > 0,
2611
+ accountId: accountInfo.accountId,
2612
+ log: (message) => runtime.log?.(warn(message))
2613
+ });
2614
+ const dmPolicy = imessageCfg.dmPolicy ?? "pairing";
2615
+ const catchupCfg = resolveCatchupConfig(imessageCfg.catchup);
2616
+ const includeAttachments = opts.includeAttachments ?? imessageCfg.includeAttachments ?? false;
2617
+ const mediaMaxBytes = (opts.mediaMaxMb ?? imessageCfg.mediaMaxMb ?? 16) * 1024 * 1024;
2618
+ const cliPath = opts.cliPath ?? imessageCfg.cliPath ?? "imsg";
2619
+ const dbPath = opts.dbPath ?? imessageCfg.dbPath;
2620
+ const probeTimeoutMs = imessageCfg.probeTimeoutMs ?? 1e4;
2621
+ const attachmentRoots = resolveIMessageAttachmentRoots({
2622
+ cfg,
2623
+ accountId: accountInfo.accountId
2624
+ });
2625
+ const remoteAttachmentRoots = resolveIMessageRemoteAttachmentRoots({
2626
+ cfg,
2627
+ accountId: accountInfo.accountId
2628
+ });
2629
+ const remoteHost = await resolveIMessageRemoteHost({
2630
+ cliPath,
2631
+ remoteHost: imessageCfg.remoteHost
2632
+ });
2633
+ let staleBacklogSuppressed = 0;
2634
+ const loggedThrottledDropDiagnostics = createIMessageThrottledDropDiagnosticCache();
2635
+ const watchSourceDbPath = resolveIMessageWatchSourceDbPath({
2636
+ cliPath,
2637
+ dbPath,
2638
+ remoteHost
2639
+ });
2640
+ const recoveryBoundaryRowid = watchSourceDbPath ? await resolveIMessageStartupRowidWatermark(watchSourceDbPath) : null;
2641
+ const recoveryCursorDbIdentity = resolveIMessageRecoveryCursorDbIdentity({
2642
+ cliPath,
2643
+ dbPath,
2644
+ remoteHost
2645
+ });
2646
+ const recoveryCursorRowid = loadIMessageRecoveryCursor(accountInfo.accountId, recoveryCursorDbIdentity, {
2647
+ migrateLegacyCatchup: !catchupCfg.enabled,
2648
+ watermarkRowid: recoveryBoundaryRowid
2649
+ });
2650
+ const reconciledWatchSinceRowid = catchupCfg.enabled ? null : recoveryCursorRowid !== null ? recoveryBoundaryRowid !== null ? Math.max(recoveryCursorRowid, recoveryBoundaryRowid - 500) : recoveryCursorRowid : recoveryBoundaryRowid;
2651
+ const watchSinceRowid = reconciledWatchSinceRowid === 0 ? -1 : reconciledWatchSinceRowid;
2652
+ let latestAdvancedRecoveryCursorRowid = recoveryCursorRowid ?? -1;
2653
+ const durableRecoveryCursorRowids = /* @__PURE__ */ new Set();
2654
+ const failedRecoveryCursorRowids = /* @__PURE__ */ new Set();
2655
+ function minSetValue(values) {
2656
+ let min = null;
2657
+ for (const value of values) min = min === null ? value : Math.min(min, value);
2658
+ return min;
2659
+ }
2660
+ function advanceRecoveryCursorAfterDurableEnqueue(rowid) {
2661
+ if (catchupCfg.enabled) return;
2662
+ failedRecoveryCursorRowids.delete(rowid);
2663
+ durableRecoveryCursorRowids.add(rowid);
2664
+ const maxDurableRowid = Math.max(...durableRecoveryCursorRowids);
2665
+ const holdFloor = minSetValue(failedRecoveryCursorRowids);
2666
+ const nextCursorRowid = holdFloor !== null && maxDurableRowid >= holdFloor ? holdFloor - 1 : maxDurableRowid;
2667
+ if (nextCursorRowid >= 0 && nextCursorRowid > latestAdvancedRecoveryCursorRowid) {
2668
+ advanceIMessageRecoveryCursor(accountInfo.accountId, recoveryCursorDbIdentity, nextCursorRowid);
2669
+ latestAdvancedRecoveryCursorRowid = nextCursorRowid;
2670
+ for (const durableRowid of durableRecoveryCursorRowids) if (durableRowid <= nextCursorRowid) durableRecoveryCursorRowids.delete(durableRowid);
2671
+ }
2672
+ }
2673
+ function holdRecoveryCursorBeforeFailedEnqueue(rowid) {
2674
+ if (catchupCfg.enabled || rowid === null || rowid <= latestAdvancedRecoveryCursorRowid) return;
2675
+ failedRecoveryCursorRowids.add(rowid);
2676
+ }
2677
+ const { debouncer: inboundDebouncer } = createChannelInboundDebouncer({
2678
+ cfg,
2679
+ channel: "imessage",
2680
+ buildKey: (entry) => {
2681
+ const msg = entry.message;
2682
+ const sender = msg.sender?.trim();
2683
+ if (!sender) return null;
2684
+ const conversationId = msg.chat_id != null ? `chat:${msg.chat_id}` : msg.chat_guid ?? msg.chat_identifier ?? "unknown";
2685
+ return `imessage:${accountInfo.accountId}:${conversationId}:${sender}`;
2686
+ },
2687
+ shouldDebounce: (entry) => {
2688
+ const msg = entry.message;
2689
+ if (resolveIMessageReactionContext(msg, (msg.text ?? "").trim())) return false;
2690
+ if (msg.is_from_me === true) return false;
2691
+ return shouldDebounceTextInbound({
2692
+ text: msg.text,
2693
+ cfg,
2694
+ hasMedia: Boolean(msg.attachments?.some((attachment) => !isIMessagePluginPayloadAttachment(attachment)))
2695
+ });
2696
+ },
2697
+ onFlush: (entries, createFlush) => {
2698
+ const { lifecycle, settle, abandon } = fanInChannelIngressLifecycles(entries.flatMap((entry) => entry.ingressLifecycle ? [entry.ingressLifecycle] : []));
2699
+ return createFlush({
2700
+ lifecycle,
2701
+ dispatch: async (admissionLifecycle) => {
2702
+ if (entries.length === 0) return;
2703
+ try {
2704
+ if (admissionLifecycle.abortSignal.aborted) {
2705
+ await abandon();
2706
+ return;
2707
+ }
2708
+ if (entries.length === 1) {
2709
+ await handleMessageNow(expectDefined(entries[0], "single iMessage dispatch entry").message, admissionLifecycle);
2710
+ await settle();
2711
+ return;
2712
+ }
2713
+ const combined = combineIMessagePayloads(entries.map((entry) => entry.message));
2714
+ if (shouldLogVerbose()) {
2715
+ const text = combined.text ?? "";
2716
+ const preview = sliceUtf16Safe(text, 0, 50);
2717
+ const ellipsis = text.length > 50 ? "..." : "";
2718
+ logVerbose(`[imessage] merged ${entries.length} debounced messages: "${preview}${ellipsis}"`);
2719
+ }
2720
+ await handleMessageNow(combined, admissionLifecycle);
2721
+ await settle();
2722
+ } catch (err) {
2723
+ await abandon();
2724
+ runtime.error?.(`imessage: inbound dispatch failed: ${String(err)}`);
2725
+ }
2726
+ }
2727
+ });
2728
+ },
2729
+ onError: (err) => {
2730
+ runtime.error?.(`imessage debounce flush failed: ${String(err)}`);
2731
+ }
2732
+ });
2733
+ let client;
2734
+ let detachAbortHandler = () => {};
2735
+ let liveCatchupCursorAdvanceEnabled = false;
2736
+ let startupCatchupInProgress = false;
2737
+ const pendingLiveCatchupCursorAdvances = [];
2738
+ const getActiveClient = () => {
2739
+ if (!client) throw new Error("imessage monitor client not initialized");
2740
+ return client;
2741
+ };
2742
+ async function repairMessageConversationAnchor(message) {
2743
+ return await repairIMessageConversationAnchor({
2744
+ client: getActiveClient(),
2745
+ message,
2746
+ runtime
2747
+ });
2748
+ }
2749
+ function resolveLiveCatchupCursor(message) {
2750
+ const coalescedCursor = message.coalescedCatchupCursor;
2751
+ const rowid = typeof coalescedCursor?.lastSeenRowid === "number" && Number.isFinite(coalescedCursor.lastSeenRowid) ? coalescedCursor.lastSeenRowid : typeof message.id === "number" && Number.isFinite(message.id) ? message.id : null;
2752
+ const dateMs = typeof coalescedCursor?.lastSeenMs === "number" && Number.isFinite(coalescedCursor.lastSeenMs) ? coalescedCursor.lastSeenMs : typeof message.created_at === "string" ? Date.parse(message.created_at) : NaN;
2753
+ if (rowid === null || !Number.isFinite(dateMs)) return null;
2754
+ return {
2755
+ lastSeenMs: dateMs,
2756
+ lastSeenRowid: rowid
2757
+ };
2758
+ }
2759
+ async function maybeAdvanceLiveCatchupCursor(message) {
2760
+ if (!catchupCfg.enabled) return;
2761
+ const cursor = resolveLiveCatchupCursor(message);
2762
+ if (!cursor) return;
2763
+ if (!liveCatchupCursorAdvanceEnabled) {
2764
+ if (startupCatchupInProgress) pendingLiveCatchupCursorAdvances.push(cursor);
2765
+ return;
2766
+ }
2767
+ try {
2768
+ await advanceIMessageCatchupCursor(accountInfo.accountId, cursor, catchupCfg);
2769
+ } catch (err) {
2770
+ runtime.error?.(`imessage catchup: failed to advance live cursor: ${String(err)}`);
2771
+ }
2772
+ }
2773
+ async function flushPendingLiveCatchupCursorAdvances() {
2774
+ for (const cursor of pendingLiveCatchupCursorAdvances.splice(0)) try {
2775
+ await advanceIMessageCatchupCursor(accountInfo.accountId, cursor, catchupCfg);
2776
+ } catch (err) {
2777
+ runtime.error?.(`imessage catchup: failed to advance pending live cursor: ${String(err)}`);
2778
+ }
2779
+ }
2780
+ async function handleMessageNow(message, ingressLifecycle) {
2781
+ await handleMessageNowInner(message, ingressLifecycle);
2782
+ }
2783
+ const pollCommentFolder = createPollCommentFolder();
2784
+ function resolveIMessageInboundBodyText(message) {
2785
+ const messageText = ((message.poll ? renderIMessagePollBody(message.poll, message.sender, { preferOptionId: Boolean(remoteHost) }) : null) ?? message.text ?? "").trim();
2786
+ const attachments = includeAttachments ? message.attachments ?? [] : [];
2787
+ const effectiveAttachmentRoots = remoteHost ? remoteAttachmentRoots : attachmentRoots;
2788
+ return {
2789
+ messageText,
2790
+ ...resolveIMessageInboundMediaInput({
2791
+ messageText,
2792
+ attachments,
2793
+ effectiveAttachmentRoots,
2794
+ logVerbose
2795
+ }),
2796
+ effectiveAttachmentRoots
2797
+ };
2798
+ }
2799
+ async function handleMessageNowInner(rawMessage, ingressLifecycle) {
2800
+ const message = await repairMessageConversationAnchor(rawMessage);
2801
+ if (!message) return;
2802
+ const pollFoldAtMs = message.created_at ? Date.parse(message.created_at) : NaN;
2803
+ if (message.poll) pollCommentFolder.rememberPoll(message.guid, pollFoldAtMs, message.sender);
2804
+ else if (message.reply_to_guid != null && pollCommentFolder.isPollComment(message.reply_to_guid, pollFoldAtMs, message.sender)) {
2805
+ logVerbose("imessage: folding poll comment (inline reply sent with a poll) into the poll; not delivering standalone");
2806
+ return;
2807
+ }
2808
+ const { messageText, bodyText, mediaFacts, mediaCandidates, rawMediaAttachments, effectiveAttachmentRoots } = resolveIMessageInboundBodyText(message);
2809
+ const storeAllowFrom = await readChannelAllowFromStore("imessage", process.env, accountInfo.accountId).catch(() => []);
2810
+ const isQuestionReaction = hasIMessageQuestionReactionTarget({
2811
+ accountId: accountInfo.accountId,
2812
+ message,
2813
+ bodyText
2814
+ });
2815
+ const decision = await resolveIMessageInboundDecision({
2816
+ cfg,
2817
+ accountId: accountInfo.accountId,
2818
+ message,
2819
+ opts,
2820
+ messageText,
2821
+ bodyText,
2822
+ mediaFacts,
2823
+ allowFrom,
2824
+ groupAllowFrom,
2825
+ allowLegacyConversationAllowFromForGroup,
2826
+ groupPolicy,
2827
+ dmPolicy,
2828
+ storeAllowFrom,
2829
+ historyLimit,
2830
+ groupHistories,
2831
+ echoCache: sentMessageCache,
2832
+ selfChatCache,
2833
+ reactionNotifications: isQuestionReaction ? "all" : imessageCfg.reactionNotifications,
2834
+ logVerbose
2835
+ });
2836
+ const chatId = message.chat_id ?? void 0;
2837
+ const senderForKey = (message.sender ?? "").trim();
2838
+ const conversationKey = chatId != null ? `group:${chatId}` : `dm:${senderForKey}`;
2839
+ const rateLimitKey = `${accountInfo.accountId}:${conversationKey}`;
2840
+ if (decision.kind === "drop") {
2841
+ if (decision.reason === "echo" || decision.reason === "self-chat echo" || decision.reason === "reflected assistant content") loopRateLimiter.record(rateLimitKey);
2842
+ const diagnostic = describeIMessageInboundDropDiagnostic({
2843
+ accountId: accountInfo.accountId,
2844
+ reason: decision.reason,
2845
+ message
2846
+ });
2847
+ if (diagnostic) {
2848
+ const throttleKey = `${rateLimitKey}:${decision.reason}`;
2849
+ if (!shouldThrottleIMessageInboundDropDiagnostic(decision.reason) || !loggedThrottledDropDiagnostics.check(throttleKey)) runtime.log?.(warn(diagnostic));
2850
+ }
2851
+ if (decision.reason === "group id not in allowlist") warnGroupAllowlistDropPerChatOnce({
2852
+ accountId: accountInfo.accountId,
2853
+ chatId: message.chat_id ?? void 0,
2854
+ log: (msg) => runtime.log?.(warn(msg))
2855
+ });
2856
+ return;
2857
+ }
2858
+ if (decision.kind === "dispatch" && loopRateLimiter.isRateLimited(rateLimitKey)) {
2859
+ if (!loggedThrottledDropDiagnostics.check(`${rateLimitKey}:rate-limited`)) {
2860
+ const diagnosticConversationKey = `${chatId != null ? "group" : "dm"}:${redactIdentifier(conversationKey)}`;
2861
+ runtime.log?.(warn(`[imessage:${accountInfo.accountId}] Suppressing inbound from ${diagnosticConversationKey}: echo loop detected (rate limiter tripped)`));
2862
+ }
2863
+ return;
2864
+ }
2865
+ if (decision.kind === "pairing") {
2866
+ const sender = (message.sender ?? "").trim();
2867
+ if (!sender) return;
2868
+ await createChannelPairingChallengeIssuer({
2869
+ channel: "imessage",
2870
+ accountId: accountInfo.accountId,
2871
+ upsertPairingRequest: async ({ id, meta }) => await upsertChannelPairingRequest({
2872
+ channel: "imessage",
2873
+ id,
2874
+ accountId: accountInfo.accountId,
2875
+ meta
2876
+ })
2877
+ })({
2878
+ senderId: decision.senderId,
2879
+ senderIdLine: `Your iMessage sender id: ${decision.senderId}`,
2880
+ meta: {
2881
+ sender: decision.senderId,
2882
+ chatId: chatId ? String(chatId) : void 0
2883
+ },
2884
+ onCreated: () => {
2885
+ logVerbose(`imessage pairing request sender=${decision.senderId}`);
2886
+ },
2887
+ sendPairingReply: async (text) => {
2888
+ await sendMessageIMessage(sender, text, {
2889
+ config: cfg,
2890
+ client: getActiveClient(),
2891
+ maxBytes: mediaMaxBytes,
2892
+ accountId: accountInfo.accountId,
2893
+ ...chatId ? { chatId } : {}
2894
+ });
2895
+ },
2896
+ onReplyError: (err) => {
2897
+ runtime.error?.(`imessage pairing reply failed for ${decision.senderId}: ${String(err)}`);
2898
+ }
2899
+ });
2900
+ return;
2901
+ }
2902
+ if (decision.kind === "reaction") {
2903
+ if (await maybeResolveIMessageQuestionReaction({
2904
+ cfg,
2905
+ accountId: accountInfo.accountId,
2906
+ message,
2907
+ bodyText,
2908
+ senderId: decision.senderNormalized,
2909
+ logDebug: logVerbose
2910
+ })) return;
2911
+ enqueueIMessageReactionSystemEvent({
2912
+ decision,
2913
+ runtime,
2914
+ logVerbose
2915
+ });
2916
+ return;
2917
+ }
2918
+ if (decision.bindingResolution) {
2919
+ const readiness = await ensureConfiguredBindingRouteReady({
2920
+ cfg,
2921
+ bindingResolution: decision.bindingResolution
2922
+ });
2923
+ if (!readiness.ok) {
2924
+ runtime.error?.(`imessage: dropped inbound message; configured ACP binding unavailable for ${decision.bindingResolution.record.conversation.conversationId}: ${readiness.error}`);
2925
+ return;
2926
+ }
2927
+ }
2928
+ const storePath = resolveStorePath(cfg.session?.store, { agentId: decision.route.agentId });
2929
+ const privateApiStatus = getCachedIMessagePrivateApiStatus(cliPath);
2930
+ const supportsTyping = imessageRpcSupportsMethod(privateApiStatus, "typing");
2931
+ const supportsRead = imessageRpcSupportsMethod(privateApiStatus, "read");
2932
+ if (privateApiStatus?.available === true) {
2933
+ if (!supportsTyping || !supportsRead) warnIfImsgUpgradeNeeded.fireOnce(privateApiStatus.rpcMethods, runtime);
2934
+ }
2935
+ const configuredTypingMode = resolveConfiguredIMessageTypingMode(cfg, decision.route.agentId);
2936
+ const sendPolicy = resolveSendPolicy({
2937
+ cfg,
2938
+ entry: getSessionEntry({
2939
+ storePath,
2940
+ sessionKey: decision.route.sessionKey
2941
+ }),
2942
+ sessionKey: decision.route.sessionKey,
2943
+ channel: "imessage",
2944
+ chatType: decision.isGroup ? "group" : "direct"
2945
+ });
2946
+ const shouldUseDirectToolTypingOptions = !decision.isGroup && sendPolicy !== "deny" && (configuredTypingMode === void 0 || configuredTypingMode === "instant");
2947
+ const shouldStartDirectTyping = supportsTyping && shouldUseDirectToolTypingOptions;
2948
+ const earlyDirectTypingService = resolveIMessageDirectChatService(imessageCfg.service, decision.chatGuid) ?? "auto";
2949
+ const earlyDirectTypingTarget = shouldStartDirectTyping ? `${earlyDirectTypingService}:${decision.sender}` : void 0;
2950
+ let stopEarlyDirectTyping;
2951
+ if (earlyDirectTypingTarget) {
2952
+ const earlyDirectTypingStarted = sendIMessageTyping(earlyDirectTypingTarget, true, {
2953
+ cfg,
2954
+ accountId: accountInfo.accountId,
2955
+ cliPath,
2956
+ dbPath,
2957
+ remoteHost
2958
+ }).then(() => true, (err) => {
2959
+ logTypingFailure({
2960
+ log: (msg) => logVerbose(msg),
2961
+ channel: "imessage",
2962
+ action: "start",
2963
+ target: earlyDirectTypingTarget,
2964
+ error: err
2965
+ });
2966
+ return false;
2967
+ });
2968
+ let earlyTypingStopQueued = false;
2969
+ stopEarlyDirectTyping = () => {
2970
+ if (earlyTypingStopQueued) return;
2971
+ earlyTypingStopQueued = true;
2972
+ earlyDirectTypingStarted.then(async (started) => {
2973
+ if (!started) return;
2974
+ await sendIMessageTyping(earlyDirectTypingTarget, false, {
2975
+ cfg,
2976
+ accountId: accountInfo.accountId,
2977
+ cliPath,
2978
+ dbPath,
2979
+ remoteHost
2980
+ });
2981
+ }).catch((err) => {
2982
+ logTypingFailure({
2983
+ log: (msg) => logVerbose(msg),
2984
+ channel: "imessage",
2985
+ action: "stop",
2986
+ target: earlyDirectTypingTarget,
2987
+ error: err
2988
+ });
2989
+ });
2990
+ };
2991
+ }
2992
+ const staged = remoteHost ? {
2993
+ attachments: rawMediaAttachments,
2994
+ unavailableCount: rawMediaAttachments.filter((attachment) => !attachment.path).length
2995
+ } : await stageIMessageAttachments(mediaCandidates, {
2996
+ maxBytes: mediaMaxBytes,
2997
+ allowedRoots: effectiveAttachmentRoots,
2998
+ deps: { logVerbose }
2999
+ });
3000
+ const mediaAttachments = staged.attachments;
3001
+ const unavailableCount = staged.unavailableCount;
3002
+ const contextDecision = unavailableCount > 0 ? {
3003
+ ...decision,
3004
+ agentBodyText: formatIMessageInboundMediaBody({
3005
+ messageText,
3006
+ unavailableCount
3007
+ })
3008
+ } : decision;
3009
+ const previousTimestamp = readSessionUpdatedAt({
3010
+ storePath,
3011
+ sessionKey: decision.route.sessionKey
3012
+ });
3013
+ const dmHistoryLimit = !decision.isGroup ? resolveIMessageDmHistoryLimit({
3014
+ config: imessageCfg,
3015
+ sender: decision.sender,
3016
+ senderNormalized: decision.senderNormalized
3017
+ }) : 0;
3018
+ const dmHistory = !decision.isGroup && dmHistoryLimit > 0 && !previousTimestamp ? await resolveIMessageDmHistoryContext({
3019
+ client: getActiveClient(),
3020
+ message,
3021
+ senderNormalized: decision.senderNormalized,
3022
+ limit: dmHistoryLimit,
3023
+ envelopeOptions: resolveEnvelopeFormatOptions(cfg),
3024
+ logVerbose
3025
+ }) : void 0;
3026
+ const pluginChannelRuntime = opts.channelRuntime;
3027
+ const { ctxPayload, chatTarget, imessageTo } = await buildIMessageInboundContext({
3028
+ cfg,
3029
+ accountService: imessageCfg.service,
3030
+ decision: contextDecision,
3031
+ message,
3032
+ previousTimestamp,
3033
+ remoteHost,
3034
+ historyLimit,
3035
+ groupHistories,
3036
+ dmHistory,
3037
+ buildContext: pluginChannelRuntime?.inbound.buildContext,
3038
+ media: { facts: mediaAttachments }
3039
+ });
3040
+ const updateTarget = chatTarget || imessageTo;
3041
+ const pinnedMainDmOwner = resolvePinnedMainDmOwnerFromAllowlist({
3042
+ dmScope: cfg.session?.dmScope,
3043
+ allowFrom,
3044
+ normalizeEntry: normalizeIMessageHandle
3045
+ });
3046
+ if (shouldLogVerbose()) {
3047
+ const preview = truncateUtf16Safe(ctxPayload.Body ?? "", 200).replace(/\n/g, "\\n");
3048
+ logVerbose(`imessage inbound: chatId=${chatId ?? "unknown"} from=${ctxPayload.From} len=${(ctxPayload.Body ?? "").length} preview="${preview}"`);
3049
+ }
3050
+ const sendReadReceipts = imessageCfg.sendReadReceipts !== false;
3051
+ const typingTarget = ctxPayload.To;
3052
+ const readTarget = !decision.isGroup && decision.chatGuid ? `chat_guid:${decision.chatGuid}` : typingTarget;
3053
+ if (supportsRead && sendReadReceipts && readTarget) markIMessageChatRead(readTarget, {
3054
+ cfg,
3055
+ accountId: accountInfo.accountId,
3056
+ cliPath,
3057
+ dbPath,
3058
+ remoteHost
3059
+ }).catch((err) => {
3060
+ runtime.error?.(`imessage: mark read failed: ${String(err)}`);
3061
+ });
3062
+ const { onModelSelected, ...replyPipeline } = createChannelMessageReplyPipeline({
3063
+ cfg,
3064
+ agentId: decision.route.agentId,
3065
+ channel: "imessage",
3066
+ accountId: decision.route.accountId,
3067
+ typing: supportsTyping && typingTarget ? {
3068
+ start: async () => {
3069
+ await sendIMessageTyping(typingTarget, true, {
3070
+ cfg,
3071
+ accountId: accountInfo.accountId,
3072
+ client: getActiveClient(),
3073
+ cliPath,
3074
+ dbPath,
3075
+ remoteHost
3076
+ });
3077
+ },
3078
+ stop: async () => {
3079
+ await sendIMessageTyping(typingTarget, false, {
3080
+ cfg,
3081
+ accountId: accountInfo.accountId,
3082
+ client: getActiveClient(),
3083
+ cliPath,
3084
+ dbPath,
3085
+ remoteHost
3086
+ });
3087
+ },
3088
+ keepaliveIntervalMs: IMESSAGE_TYPING_KEEPALIVE_INTERVAL_MS,
3089
+ maxDurationMs: IMESSAGE_TYPING_KEEPALIVE_MAX_DURATION_MS,
3090
+ onStartError: (err) => {
3091
+ logTypingFailure({
3092
+ log: (msg) => logVerbose(msg),
3093
+ channel: "imessage",
3094
+ action: "start",
3095
+ target: typingTarget,
3096
+ error: err
3097
+ });
3098
+ },
3099
+ onStopError: (err) => {
3100
+ logTypingFailure({
3101
+ log: (msg) => logVerbose(msg),
3102
+ channel: "imessage",
3103
+ action: "stop",
3104
+ target: typingTarget,
3105
+ error: err
3106
+ });
3107
+ }
3108
+ } : void 0
3109
+ });
3110
+ const dispatcherOptions = {
3111
+ ...replyPipeline,
3112
+ humanDelay: resolveHumanDelayConfig(cfg, decision.route.agentId)
3113
+ };
3114
+ const delivery = {
3115
+ durable: ctxPayload.To ? {
3116
+ to: ctxPayload.To,
3117
+ deps: { imessage: createIMessageEchoCachingSend({
3118
+ accountId: accountInfo.accountId,
3119
+ sentMessageCache
3120
+ }) }
3121
+ } : false,
3122
+ observeMessageSent: true,
3123
+ deliver: async (payload) => {
3124
+ const target = ctxPayload.To;
3125
+ if (!target) {
3126
+ runtime.error?.(danger("imessage: missing delivery target"));
3127
+ return {
3128
+ visibleReplySent: false,
3129
+ suppression: { reason: "no_visible_result" }
3130
+ };
3131
+ }
3132
+ return await deliverIMessageReply({
3133
+ cfg,
3134
+ payload,
3135
+ target,
3136
+ accountId: accountInfo.accountId,
3137
+ runtime,
3138
+ maxBytes: mediaMaxBytes,
3139
+ textLimit,
3140
+ sentMessageCache
3141
+ });
3142
+ },
3143
+ onError: (err, info) => {
3144
+ runtime.error?.(danger(`imessage ${info.kind} reply failed: ${String(err)}`));
3145
+ }
3146
+ };
3147
+ let directTypingController;
3148
+ const directToolTypingOptions = shouldUseDirectToolTypingOptions ? {
3149
+ suppressDefaultToolProgressMessages: true,
3150
+ allowProgressCallbacksWhenSourceDeliverySuppressed: true,
3151
+ onTypingController: (typing) => {
3152
+ directTypingController = typing;
3153
+ },
3154
+ onToolResult: async () => {
3155
+ await directTypingController?.startTypingLoop();
3156
+ return false;
3157
+ },
3158
+ ...supportsTyping ? { onToolStart: async () => {
3159
+ await directTypingController?.startTypingLoop();
3160
+ return false;
3161
+ } } : {}
3162
+ } : {};
3163
+ const configuredBlockStreaming = resolveChannelStreamingBlockEnabled(accountInfo.config);
3164
+ const inboundLastRouteSessionKey = resolveInboundLastRouteSessionKey({
3165
+ route: decision.route,
3166
+ sessionKey: decision.route.sessionKey
3167
+ });
3168
+ await runChannelInboundEvent({
3169
+ channel: "imessage",
3170
+ accountId: decision.route.accountId,
3171
+ raw: decision,
3172
+ adapter: {
3173
+ ingest: () => ({
3174
+ id: ctxPayload.MessageSid ?? `${ctxPayload.From}:${Date.now()}`,
3175
+ timestamp: typeof ctxPayload.Timestamp === "number" ? ctxPayload.Timestamp : void 0,
3176
+ rawText: ctxPayload.RawBody ?? "",
3177
+ textForAgent: ctxPayload.BodyForAgent,
3178
+ textForCommands: ctxPayload.CommandBody,
3179
+ raw: decision
3180
+ }),
3181
+ resolveTurn: () => ({
3182
+ cfg,
3183
+ channel: "imessage",
3184
+ accountId: decision.route.accountId,
3185
+ route: {
3186
+ agentId: decision.route.agentId,
3187
+ sessionKey: decision.route.sessionKey
3188
+ },
3189
+ ctxPayload,
3190
+ dispatchReplyFromConfig: pluginChannelRuntime?.reply?.dispatchReplyFromConfig,
3191
+ record: {
3192
+ updateLastRoute: !decision.isGroup && updateTarget ? {
3193
+ sessionKey: inboundLastRouteSessionKey,
3194
+ channel: "imessage",
3195
+ to: updateTarget,
3196
+ accountId: decision.route.accountId,
3197
+ mainDmOwnerPin: inboundLastRouteSessionKey === decision.route.mainSessionKey && pinnedMainDmOwner && decision.senderNormalized ? {
3198
+ ownerRecipient: pinnedMainDmOwner,
3199
+ senderRecipient: decision.senderNormalized,
3200
+ onSkip: ({ ownerRecipient, senderRecipient }) => {
3201
+ logVerbose(`imessage: skip main-session last route for ${senderRecipient} (pinned owner ${ownerRecipient})`);
3202
+ }
3203
+ } : void 0
3204
+ } : void 0,
3205
+ onRecordError: (err) => {
3206
+ logVerbose(`imessage: failed updating session meta: ${String(err)}`);
3207
+ }
3208
+ },
3209
+ history: {
3210
+ isGroup: decision.isGroup,
3211
+ historyKey: decision.historyKey,
3212
+ historyMap: groupHistories,
3213
+ limit: historyLimit
3214
+ },
3215
+ delivery,
3216
+ dispatcherOptions: {
3217
+ ...dispatcherOptions,
3218
+ onSettled: () => stopEarlyDirectTyping?.()
3219
+ },
3220
+ replyOptions: {
3221
+ ...ingressLifecycle ? bindIngressLifecycleToReplyOptions(ingressLifecycle) : {},
3222
+ disableBlockStreaming: typeof configuredBlockStreaming === "boolean" ? !configuredBlockStreaming : void 0,
3223
+ onModelSelected,
3224
+ ...directToolTypingOptions
3225
+ }
3226
+ }),
3227
+ onFinalize: () => stopEarlyDirectTyping?.()
3228
+ }
3229
+ });
3230
+ }
3231
+ const suppressStaleIngress = (message, receivedAt, provenance) => {
3232
+ const isRecoveryReplay = recoveryCursorRowid !== null && recoveryBoundaryRowid !== null && typeof message.id === "number" && message.id <= recoveryBoundaryRowid;
3233
+ const staleThresholdMs = isRecoveryReplay ? IMESSAGE_RECOVERY_MAX_AGE_MS : IMESSAGE_STALE_INBOUND_THRESHOLD_MS;
3234
+ if (provenance?.catchup || !isStaleIMessageBacklog(message, receivedAt, staleThresholdMs)) return false;
3235
+ staleBacklogSuppressed += 1;
3236
+ runtime.log?.(warn(`imessage: suppressed stale inbound backlog account=${accountInfo.accountId} sent=${message.created_at ?? "unknown"} recovery=${isRecoveryReplay} (${staleBacklogSuppressed} suppressed since start)`));
3237
+ return true;
3238
+ };
3239
+ const maybeHandleApprovalControl = async (message) => {
3240
+ if (await maybeResolveIMessageApprovalPollVote({
3241
+ cfg,
3242
+ accountId: accountInfo.accountId,
3243
+ message,
3244
+ gatewayRuntime: approvalGatewayRuntime
3245
+ })) return true;
3246
+ return await maybeResolveIMessageApprovalReaction({
3247
+ cfg,
3248
+ accountId: accountInfo.accountId,
3249
+ message,
3250
+ bodyText: resolveIMessageInboundBodyText(message).bodyText,
3251
+ gatewayRuntime: approvalGatewayRuntime,
3252
+ logVerboseMessage: logVerbose
3253
+ });
3254
+ };
3255
+ const resolveApprovalControlConversation = (message) => {
3256
+ const sender = normalizeIMessageHandle((message.sender ?? "").trim());
3257
+ const destination = normalizeIMessageHandle((message.destination_caller_id ?? "").trim());
3258
+ const actorHandle = (message.is_from_me !== true && Boolean(sender) && sender === destination ? "" : sender) || (message.is_from_me === true ? destination : "");
3259
+ return actorHandle ? buildIMessageApprovalConversationKeyForInbound({
3260
+ chatGuid: message.chat_guid,
3261
+ chatIdentifier: message.chat_identifier,
3262
+ chatId: message.chat_id,
3263
+ isGroup: message.is_group,
3264
+ actorHandle
3265
+ }) : null;
3266
+ };
3267
+ const ingress = createIMessageDurableIngress({
3268
+ accountId: accountInfo.accountId,
3269
+ runtime,
3270
+ dispatchPriority: async (message, lifecycle, receivedAt, provenance) => {
3271
+ const bodyText = (message.text ?? "").trim();
3272
+ const isApprovalCommand = /^\/approve(?:@[^\s]+)?(?:\s|$)/i.test(bodyText);
3273
+ if (!(isApprovalCommand || message.poll?.kind === "vote" || Boolean(resolveIMessageReactionContext(message, bodyText)))) return;
3274
+ if (suppressStaleIngress(message, receivedAt, provenance)) return { kind: "completed" };
3275
+ const repairedMessage = await repairMessageConversationAnchor(message);
3276
+ if (!repairedMessage) return { kind: "completed" };
3277
+ if (isApprovalCommand) {
3278
+ await handleMessageNowInner(repairedMessage);
3279
+ return { kind: "completed" };
3280
+ }
3281
+ const conversation = resolveApprovalControlConversation(repairedMessage);
3282
+ while (true) {
3283
+ if (await maybeHandleApprovalControl(repairedMessage)) return { kind: "completed" };
3284
+ if (!conversation) return;
3285
+ if (!await iMessageApprovalControlBindings.wait({
3286
+ accountId: accountInfo.accountId,
3287
+ conversation,
3288
+ abortSignal: lifecycle.abortSignal
3289
+ })) return await maybeHandleApprovalControl(repairedMessage) ? { kind: "completed" } : void 0;
3290
+ }
3291
+ },
3292
+ dispatch: async (message, ingressLifecycle, receivedAt, provenance) => {
3293
+ if (suppressStaleIngress(message, receivedAt, provenance)) return { kind: "completed" };
3294
+ const repairedMessage = await repairMessageConversationAnchor(message);
3295
+ if (!repairedMessage) return { kind: "completed" };
3296
+ if (await maybeHandleApprovalControl(repairedMessage)) return { kind: "completed" };
3297
+ await inboundDebouncer.enqueue({
3298
+ message: repairedMessage,
3299
+ ingressLifecycle
3300
+ });
3301
+ return { kind: "deferred" };
3302
+ },
3303
+ onDurableEnqueue: async (facts) => {
3304
+ advanceRecoveryCursorAfterDurableEnqueue(facts.rowid);
3305
+ await maybeAdvanceLiveCatchupCursor({
3306
+ id: facts.rowid,
3307
+ created_at: facts.createdAt
3308
+ });
3309
+ },
3310
+ onDurableEnqueueFailure: (rowid) => {
3311
+ holdRecoveryCursorBeforeFailedEnqueue(rowid);
3312
+ }
3313
+ });
3314
+ await waitForTransportReady({
3315
+ label: "imsg rpc",
3316
+ timeoutMs: 3e4,
3317
+ logAfterMs: 1e4,
3318
+ logIntervalMs: 1e4,
3319
+ pollIntervalMs: 500,
3320
+ abortSignal: opts.abortSignal,
3321
+ runtime,
3322
+ check: async () => {
3323
+ const probe = await probeIMessage(probeTimeoutMs, {
3324
+ cliPath,
3325
+ dbPath,
3326
+ remoteHost,
3327
+ runtime
3328
+ });
3329
+ if (probe.ok) return { ok: true };
3330
+ if (probe.fatal) throw new Error(probe.error ?? "imsg rpc unavailable");
3331
+ return {
3332
+ ok: false,
3333
+ error: probe.error ?? "unreachable"
3334
+ };
3335
+ }
3336
+ });
3337
+ if (opts.abortSignal?.aborted) return;
3338
+ const abort = opts.abortSignal;
3339
+ const createWatchClient = async () => await createIMessageRpcClient({
3340
+ cliPath,
3341
+ dbPath,
3342
+ remoteHost,
3343
+ runtime,
3344
+ onNotification: (msg) => {
3345
+ if (msg.method === "message") ingress.receive(msg.params).catch((err) => {
3346
+ runtime.error?.(`imessage: durable admission failed: ${String(err)}`);
3347
+ });
3348
+ else if (msg.method === "error") runtime.error?.(`imessage: watch error ${JSON.stringify(sanitizeIMessageWatchErrorPayload(msg.params))}`);
3349
+ }
3350
+ });
3351
+ const requireWatchClient = (watchClient) => {
3352
+ if (!watchClient) throw new Error("imessage monitor client not initialized");
3353
+ return watchClient;
3354
+ };
3355
+ for (let attempt = 1; attempt <= WATCH_SUBSCRIBE_MAX_ATTEMPTS; attempt++) {
3356
+ if (abort?.aborted) return;
3357
+ let attemptClient;
3358
+ let attemptDetachAbortHandler = () => {};
3359
+ let keepAttemptClient = false;
3360
+ try {
3361
+ attemptClient = requireWatchClient(await createWatchClient());
3362
+ let attemptSubscriptionId = null;
3363
+ attemptDetachAbortHandler = attachIMessageMonitorAbortHandler({
3364
+ abortSignal: abort,
3365
+ client: attemptClient,
3366
+ getSubscriptionId: () => attemptSubscriptionId
3367
+ });
3368
+ attemptSubscriptionId = (await attemptClient.request("watch.subscribe", {
3369
+ attachments: includeAttachments,
3370
+ include_reactions: true,
3371
+ ...watchSinceRowid !== null ? { since_rowid: watchSinceRowid } : {}
3372
+ }, { timeoutMs: probeTimeoutMs }))?.subscription ?? null;
3373
+ opts.statusSink?.(channelReadyPatch());
3374
+ client = attemptClient;
3375
+ detachAbortHandler = attemptDetachAbortHandler;
3376
+ keepAttemptClient = true;
3377
+ break;
3378
+ } catch (err) {
3379
+ if (abort?.aborted) return;
3380
+ const retriable = isRetriableWatchSubscribeStartupError(err);
3381
+ if (!(attempt < WATCH_SUBSCRIBE_MAX_ATTEMPTS && retriable)) {
3382
+ opts.statusSink?.({
3383
+ connected: false,
3384
+ lifecycle: retriable ? "recovering" : "blocked",
3385
+ terminalDisconnect: retriable ? void 0 : true,
3386
+ lastError: String(err)
3387
+ });
3388
+ runtime.error?.(danger(`imessage: monitor failed: ${describeIMessageWatchSubscribeStartupFailure({
3389
+ accountId: accountInfo.accountId,
3390
+ attempt,
3391
+ maxAttempts: WATCH_SUBSCRIBE_MAX_ATTEMPTS,
3392
+ cliPath,
3393
+ dbPath,
3394
+ remoteHost,
3395
+ includeAttachments,
3396
+ probeTimeoutMs,
3397
+ watchSinceRowid,
3398
+ error: err
3399
+ })}`));
3400
+ throw err;
3401
+ }
3402
+ opts.statusSink?.({
3403
+ connected: false,
3404
+ lifecycle: "recovering",
3405
+ lastError: String(err)
3406
+ });
3407
+ runtime.log?.(warn(describeIMessageWatchSubscribeStartupFailure({
3408
+ accountId: accountInfo.accountId,
3409
+ attempt,
3410
+ maxAttempts: WATCH_SUBSCRIBE_MAX_ATTEMPTS,
3411
+ cliPath,
3412
+ dbPath,
3413
+ remoteHost,
3414
+ includeAttachments,
3415
+ probeTimeoutMs,
3416
+ watchSinceRowid,
3417
+ error: err,
3418
+ retryDelayMs: WATCH_SUBSCRIBE_RETRY_DELAY_MS
3419
+ })));
3420
+ attemptDetachAbortHandler();
3421
+ attemptDetachAbortHandler = () => {};
3422
+ await attemptClient?.stop();
3423
+ attemptClient = void 0;
3424
+ await waitForWatchSubscribeRetryDelay({
3425
+ ms: WATCH_SUBSCRIBE_RETRY_DELAY_MS,
3426
+ abortSignal: abort
3427
+ });
3428
+ if (abort?.aborted) return;
3429
+ } finally {
3430
+ if (!keepAttemptClient) {
3431
+ attemptDetachAbortHandler();
3432
+ await attemptClient?.stop();
3433
+ }
3434
+ }
3435
+ }
3436
+ const activeClient = client;
3437
+ if (!activeClient) return;
3438
+ ingress.start();
3439
+ const approvalContextLease = opts.channelRuntime ? registerChannelRuntimeContext({
3440
+ channelRuntime: opts.channelRuntime,
3441
+ channelId: "imessage",
3442
+ accountId: accountInfo.accountId,
3443
+ capability: CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY,
3444
+ context: { accountId: accountInfo.accountId },
3445
+ abortSignal: abort
3446
+ }) : void 0;
3447
+ let approvalReactionPollInFlight = false;
3448
+ const pollApprovalReactions = async (allowRecentChatDiscovery = false) => {
3449
+ if (approvalReactionPollInFlight) return;
3450
+ approvalReactionPollInFlight = true;
3451
+ try {
3452
+ await pollPendingIMessageApprovalReactions({
3453
+ client: activeClient,
3454
+ cfg,
3455
+ accountId: accountInfo.accountId,
3456
+ allowRecentChatDiscovery,
3457
+ gatewayRuntime: approvalGatewayRuntime,
3458
+ logVerboseMessage: logVerbose
3459
+ });
3460
+ } catch (err) {
3461
+ logVerbose(`imessage: approval reaction poll failed: ${String(err)}`);
3462
+ } finally {
3463
+ approvalReactionPollInFlight = false;
3464
+ }
3465
+ };
3466
+ const approvalReactionPollTimer = setInterval(() => {
3467
+ pollApprovalReactions();
3468
+ }, APPROVAL_REACTION_POLL_INTERVAL_MS);
3469
+ const approvalReactionDiscoveryTimer = setInterval(() => {
3470
+ pollApprovalReactions(true);
3471
+ }, APPROVAL_REACTION_DISCOVERY_INTERVAL_MS);
3472
+ pollApprovalReactions(true);
3473
+ if (catchupCfg.enabled && !abort?.aborted) {
3474
+ startupCatchupInProgress = true;
3475
+ try {
3476
+ const catchupSummary = await runIMessageCatchup({
3477
+ client: activeClient,
3478
+ accountId: accountInfo.accountId,
3479
+ config: catchupCfg,
3480
+ includeAttachments,
3481
+ dispatchPayload: async (_message, rawEnvelope) => {
3482
+ await ingress.receive(rawEnvelope, { catchup: true });
3483
+ },
3484
+ observeSkippedFromMePayload: (message) => {
3485
+ const { bodyText } = resolveIMessageInboundBodyText(message);
3486
+ rememberIMessageSkippedFromMeForSelfChatDedupe({
3487
+ accountId: accountInfo.accountId,
3488
+ message,
3489
+ bodyText,
3490
+ selfChatCache
3491
+ });
3492
+ },
3493
+ runtime
3494
+ });
3495
+ liveCatchupCursorAdvanceEnabled = catchupSummary.querySucceeded && catchupSummary.fullyCaughtUp;
3496
+ if (liveCatchupCursorAdvanceEnabled) await flushPendingLiveCatchupCursorAdvances();
3497
+ else pendingLiveCatchupCursorAdvances.length = 0;
3498
+ } catch (err) {
3499
+ pendingLiveCatchupCursorAdvances.length = 0;
3500
+ runtime.error?.(`imessage catchup: pass failed: ${String(err)}`);
3501
+ } finally {
3502
+ startupCatchupInProgress = false;
3503
+ }
3504
+ }
3505
+ try {
3506
+ await activeClient.waitForClose();
3507
+ } catch (err) {
3508
+ if (abort?.aborted) return;
3509
+ runtime.error?.(danger(`imessage: monitor failed: ${String(err)}`));
3510
+ throw err;
3511
+ } finally {
3512
+ clearInterval(approvalReactionPollTimer);
3513
+ clearInterval(approvalReactionDiscoveryTimer);
3514
+ approvalContextLease?.dispose();
3515
+ detachAbortHandler();
3516
+ await activeClient.stop();
3517
+ await ingress.stop();
3518
+ }
3519
+ }
3520
+ //#endregion
3521
+ export { monitorIMessageProvider as t };