@openclaw/facetime 0.0.0 → 2026.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1461) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +83 -2
  3. package/THIRD_PARTY_NOTICES.md +18 -0
  4. package/assets/activity.svg +3 -0
  5. package/assets/icon.png +0 -0
  6. package/dist/.setup/setup-DUgC9yE7.mjs +601 -0
  7. package/dist/doctor-contract-api.js +89 -0
  8. package/dist/index.js +312 -0
  9. package/dist/runtime-api.js +3917 -0
  10. package/docs/phase1-verification.md +37 -0
  11. package/doctor-contract-api.ts +95 -0
  12. package/helper-endpoint.json +5 -0
  13. package/index.ts +222 -0
  14. package/node_modules/typebox/build/compile/code.d.mts +12 -0
  15. package/node_modules/typebox/build/compile/code.mjs +65 -0
  16. package/node_modules/typebox/build/compile/compile.d.mts +6 -0
  17. package/node_modules/typebox/build/compile/compile.mjs +12 -0
  18. package/node_modules/typebox/build/compile/index.d.mts +8 -0
  19. package/node_modules/typebox/build/compile/index.mjs +14 -0
  20. package/node_modules/typebox/build/compile/validator.d.mts +35 -0
  21. package/node_modules/typebox/build/compile/validator.mjs +91 -0
  22. package/node_modules/typebox/build/error/errors.d.mts +208 -0
  23. package/node_modules/typebox/build/error/errors.mjs +18 -0
  24. package/node_modules/typebox/build/error/index.d.mts +1 -0
  25. package/node_modules/typebox/build/error/index.mjs +1 -0
  26. package/node_modules/typebox/build/format/_registry.d.mts +15 -0
  27. package/node_modules/typebox/build/format/_registry.mjs +96 -0
  28. package/node_modules/typebox/build/format/date.d.mts +6 -0
  29. package/node_modules/typebox/build/format/date.mjs +19 -0
  30. package/node_modules/typebox/build/format/date_time.d.mts +6 -0
  31. package/node_modules/typebox/build/format/date_time.mjs +11 -0
  32. package/node_modules/typebox/build/format/duration.d.mts +5 -0
  33. package/node_modules/typebox/build/format/duration.mjs +8 -0
  34. package/node_modules/typebox/build/format/email.d.mts +5 -0
  35. package/node_modules/typebox/build/format/email.mjs +8 -0
  36. package/node_modules/typebox/build/format/format.d.mts +22 -0
  37. package/node_modules/typebox/build/format/format.mjs +22 -0
  38. package/node_modules/typebox/build/format/hostname.d.mts +7 -0
  39. package/node_modules/typebox/build/format/hostname.mjs +10 -0
  40. package/node_modules/typebox/build/format/idn_email.d.mts +5 -0
  41. package/node_modules/typebox/build/format/idn_email.mjs +8 -0
  42. package/node_modules/typebox/build/format/idn_hostname.d.mts +8 -0
  43. package/node_modules/typebox/build/format/idn_hostname.mjs +11 -0
  44. package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
  45. package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
  46. package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
  47. package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
  48. package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
  49. package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
  50. package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
  51. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +43 -0
  52. package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
  53. package/node_modules/typebox/build/format/idna/index.mjs +2 -0
  54. package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
  55. package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
  56. package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
  57. package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
  58. package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
  59. package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
  60. package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
  61. package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
  62. package/node_modules/typebox/build/format/index.d.mts +4 -0
  63. package/node_modules/typebox/build/format/index.mjs +4 -0
  64. package/node_modules/typebox/build/format/ipv4.d.mts +5 -0
  65. package/node_modules/typebox/build/format/ipv4.mjs +8 -0
  66. package/node_modules/typebox/build/format/ipv6.d.mts +5 -0
  67. package/node_modules/typebox/build/format/ipv6.mjs +8 -0
  68. package/node_modules/typebox/build/format/iri.d.mts +5 -0
  69. package/node_modules/typebox/build/format/iri.mjs +35 -0
  70. package/node_modules/typebox/build/format/iri_reference.d.mts +5 -0
  71. package/node_modules/typebox/build/format/iri_reference.mjs +14 -0
  72. package/node_modules/typebox/build/format/json_pointer.d.mts +6 -0
  73. package/node_modules/typebox/build/format/json_pointer.mjs +9 -0
  74. package/node_modules/typebox/build/format/json_pointer_uri_fragment.d.mts +6 -0
  75. package/node_modules/typebox/build/format/json_pointer_uri_fragment.mjs +9 -0
  76. package/node_modules/typebox/build/format/regex.d.mts +5 -0
  77. package/node_modules/typebox/build/format/regex.mjs +13 -0
  78. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +6 -0
  79. package/node_modules/typebox/build/format/relative_json_pointer.mjs +9 -0
  80. package/node_modules/typebox/build/format/time.d.mts +5 -0
  81. package/node_modules/typebox/build/format/time.mjs +32 -0
  82. package/node_modules/typebox/build/format/uri.d.mts +5 -0
  83. package/node_modules/typebox/build/format/uri.mjs +8 -0
  84. package/node_modules/typebox/build/format/uri_reference.d.mts +5 -0
  85. package/node_modules/typebox/build/format/uri_reference.mjs +8 -0
  86. package/node_modules/typebox/build/format/uri_template.d.mts +5 -0
  87. package/node_modules/typebox/build/format/uri_template.mjs +9 -0
  88. package/node_modules/typebox/build/format/url.d.mts +6 -0
  89. package/node_modules/typebox/build/format/url.mjs +8 -0
  90. package/node_modules/typebox/build/format/uuid.d.mts +6 -0
  91. package/node_modules/typebox/build/format/uuid.mjs +9 -0
  92. package/node_modules/typebox/build/guard/emit.d.mts +56 -0
  93. package/node_modules/typebox/build/guard/emit.mjs +191 -0
  94. package/node_modules/typebox/build/guard/globals.d.mts +35 -0
  95. package/node_modules/typebox/build/guard/globals.mjs +90 -0
  96. package/node_modules/typebox/build/guard/guard.d.mts +71 -0
  97. package/node_modules/typebox/build/guard/guard.mjs +221 -0
  98. package/node_modules/typebox/build/guard/index.d.mts +6 -0
  99. package/node_modules/typebox/build/guard/index.mjs +6 -0
  100. package/node_modules/typebox/build/guard/native.d.mts +20 -0
  101. package/node_modules/typebox/build/guard/native.mjs +60 -0
  102. package/node_modules/typebox/build/guard/string.d.mts +6 -0
  103. package/node_modules/typebox/build/guard/string.mjs +168 -0
  104. package/node_modules/typebox/build/index.d.mts +8 -0
  105. package/node_modules/typebox/build/index.mjs +14 -0
  106. package/node_modules/typebox/build/schema/build.d.mts +39 -0
  107. package/node_modules/typebox/build/schema/build.mjs +118 -0
  108. package/node_modules/typebox/build/schema/check.d.mts +6 -0
  109. package/node_modules/typebox/build/schema/check.mjs +14 -0
  110. package/node_modules/typebox/build/schema/compile.d.mts +23 -0
  111. package/node_modules/typebox/build/schema/compile.mjs +46 -0
  112. package/node_modules/typebox/build/schema/engine/_context.d.mts +34 -0
  113. package/node_modules/typebox/build/schema/engine/_context.mjs +137 -0
  114. package/node_modules/typebox/build/schema/engine/_exact_optional.d.mts +3 -0
  115. package/node_modules/typebox/build/schema/engine/_exact_optional.mjs +20 -0
  116. package/node_modules/typebox/build/schema/engine/_externals.d.mts +7 -0
  117. package/node_modules/typebox/build/schema/engine/_externals.mjs +25 -0
  118. package/node_modules/typebox/build/schema/engine/_functions.d.mts +6 -0
  119. package/node_modules/typebox/build/schema/engine/_functions.mjs +65 -0
  120. package/node_modules/typebox/build/schema/engine/_reducer.d.mts +4 -0
  121. package/node_modules/typebox/build/schema/engine/_reducer.mjs +45 -0
  122. package/node_modules/typebox/build/schema/engine/_refine.d.mts +6 -0
  123. package/node_modules/typebox/build/schema/engine/_refine.mjs +26 -0
  124. package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
  125. package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
  126. package/node_modules/typebox/build/schema/engine/_stack.d.mts +36 -0
  127. package/node_modules/typebox/build/schema/engine/_stack.mjs +150 -0
  128. package/node_modules/typebox/build/schema/engine/_unique.d.mts +2 -0
  129. package/node_modules/typebox/build/schema/engine/_unique.mjs +5 -0
  130. package/node_modules/typebox/build/schema/engine/additionalItems.d.mts +6 -0
  131. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +60 -0
  132. package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +9 -0
  133. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +119 -0
  134. package/node_modules/typebox/build/schema/engine/allOf.d.mts +6 -0
  135. package/node_modules/typebox/build/schema/engine/allOf.mjs +47 -0
  136. package/node_modules/typebox/build/schema/engine/anyOf.d.mts +6 -0
  137. package/node_modules/typebox/build/schema/engine/anyOf.mjs +47 -0
  138. package/node_modules/typebox/build/schema/engine/boolean.d.mts +5 -0
  139. package/node_modules/typebox/build/schema/engine/boolean.mjs +21 -0
  140. package/node_modules/typebox/build/schema/engine/const.d.mts +6 -0
  141. package/node_modules/typebox/build/schema/engine/const.mjs +26 -0
  142. package/node_modules/typebox/build/schema/engine/contains.d.mts +6 -0
  143. package/node_modules/typebox/build/schema/engine/contains.mjs +50 -0
  144. package/node_modules/typebox/build/schema/engine/dependencies.d.mts +6 -0
  145. package/node_modules/typebox/build/schema/engine/dependencies.mjs +42 -0
  146. package/node_modules/typebox/build/schema/engine/dependentRequired.d.mts +6 -0
  147. package/node_modules/typebox/build/schema/engine/dependentRequired.mjs +36 -0
  148. package/node_modules/typebox/build/schema/engine/dependentSchemas.d.mts +6 -0
  149. package/node_modules/typebox/build/schema/engine/dependentSchemas.mjs +38 -0
  150. package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +6 -0
  151. package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +29 -0
  152. package/node_modules/typebox/build/schema/engine/enum.d.mts +6 -0
  153. package/node_modules/typebox/build/schema/engine/enum.mjs +29 -0
  154. package/node_modules/typebox/build/schema/engine/exclusiveMaximum.d.mts +6 -0
  155. package/node_modules/typebox/build/schema/engine/exclusiveMaximum.mjs +21 -0
  156. package/node_modules/typebox/build/schema/engine/exclusiveMinimum.d.mts +6 -0
  157. package/node_modules/typebox/build/schema/engine/exclusiveMinimum.mjs +21 -0
  158. package/node_modules/typebox/build/schema/engine/format.d.mts +6 -0
  159. package/node_modules/typebox/build/schema/engine/format.mjs +22 -0
  160. package/node_modules/typebox/build/schema/engine/if.d.mts +6 -0
  161. package/node_modules/typebox/build/schema/engine/if.mjs +39 -0
  162. package/node_modules/typebox/build/schema/engine/index.d.mts +48 -0
  163. package/node_modules/typebox/build/schema/engine/index.mjs +54 -0
  164. package/node_modules/typebox/build/schema/engine/items.d.mts +6 -0
  165. package/node_modules/typebox/build/schema/engine/items.mjs +88 -0
  166. package/node_modules/typebox/build/schema/engine/maxContains.d.mts +6 -0
  167. package/node_modules/typebox/build/schema/engine/maxContains.mjs +38 -0
  168. package/node_modules/typebox/build/schema/engine/maxItems.d.mts +6 -0
  169. package/node_modules/typebox/build/schema/engine/maxItems.mjs +21 -0
  170. package/node_modules/typebox/build/schema/engine/maxLength.d.mts +6 -0
  171. package/node_modules/typebox/build/schema/engine/maxLength.mjs +21 -0
  172. package/node_modules/typebox/build/schema/engine/maxProperties.d.mts +6 -0
  173. package/node_modules/typebox/build/schema/engine/maxProperties.mjs +21 -0
  174. package/node_modules/typebox/build/schema/engine/maximum.d.mts +6 -0
  175. package/node_modules/typebox/build/schema/engine/maximum.mjs +21 -0
  176. package/node_modules/typebox/build/schema/engine/minContains.d.mts +6 -0
  177. package/node_modules/typebox/build/schema/engine/minContains.mjs +47 -0
  178. package/node_modules/typebox/build/schema/engine/minItems.d.mts +6 -0
  179. package/node_modules/typebox/build/schema/engine/minItems.mjs +21 -0
  180. package/node_modules/typebox/build/schema/engine/minLength.d.mts +6 -0
  181. package/node_modules/typebox/build/schema/engine/minLength.mjs +21 -0
  182. package/node_modules/typebox/build/schema/engine/minProperties.d.mts +6 -0
  183. package/node_modules/typebox/build/schema/engine/minProperties.mjs +21 -0
  184. package/node_modules/typebox/build/schema/engine/minimum.d.mts +6 -0
  185. package/node_modules/typebox/build/schema/engine/minimum.mjs +21 -0
  186. package/node_modules/typebox/build/schema/engine/multipleOf.d.mts +6 -0
  187. package/node_modules/typebox/build/schema/engine/multipleOf.mjs +21 -0
  188. package/node_modules/typebox/build/schema/engine/not.d.mts +6 -0
  189. package/node_modules/typebox/build/schema/engine/not.mjs +35 -0
  190. package/node_modules/typebox/build/schema/engine/oneOf.d.mts +6 -0
  191. package/node_modules/typebox/build/schema/engine/oneOf.mjs +54 -0
  192. package/node_modules/typebox/build/schema/engine/pattern.d.mts +6 -0
  193. package/node_modules/typebox/build/schema/engine/pattern.mjs +25 -0
  194. package/node_modules/typebox/build/schema/engine/patternProperties.d.mts +6 -0
  195. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +45 -0
  196. package/node_modules/typebox/build/schema/engine/prefixItems.d.mts +6 -0
  197. package/node_modules/typebox/build/schema/engine/prefixItems.mjs +35 -0
  198. package/node_modules/typebox/build/schema/engine/properties.d.mts +6 -0
  199. package/node_modules/typebox/build/schema/engine/properties.mjs +75 -0
  200. package/node_modules/typebox/build/schema/engine/propertyNames.d.mts +6 -0
  201. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +33 -0
  202. package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +6 -0
  203. package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +29 -0
  204. package/node_modules/typebox/build/schema/engine/ref.d.mts +6 -0
  205. package/node_modules/typebox/build/schema/engine/ref.mjs +56 -0
  206. package/node_modules/typebox/build/schema/engine/required.d.mts +6 -0
  207. package/node_modules/typebox/build/schema/engine/required.mjs +28 -0
  208. package/node_modules/typebox/build/schema/engine/schema.d.mts +9 -0
  209. package/node_modules/typebox/build/schema/engine/schema.mjs +360 -0
  210. package/node_modules/typebox/build/schema/engine/type.d.mts +6 -0
  211. package/node_modules/typebox/build/schema/engine/type.mjs +66 -0
  212. package/node_modules/typebox/build/schema/engine/unevaluatedItems.d.mts +6 -0
  213. package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +47 -0
  214. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.d.mts +6 -0
  215. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +47 -0
  216. package/node_modules/typebox/build/schema/engine/uniqueItems.d.mts +6 -0
  217. package/node_modules/typebox/build/schema/engine/uniqueItems.mjs +47 -0
  218. package/node_modules/typebox/build/schema/errors.d.mts +6 -0
  219. package/node_modules/typebox/build/schema/errors.mjs +18 -0
  220. package/node_modules/typebox/build/schema/index.d.mts +3 -0
  221. package/node_modules/typebox/build/schema/index.mjs +9 -0
  222. package/node_modules/typebox/build/schema/intern/index.d.mts +1 -0
  223. package/node_modules/typebox/build/schema/intern/index.mjs +1 -0
  224. package/node_modules/typebox/build/schema/intern/intern.d.mts +11 -0
  225. package/node_modules/typebox/build/schema/intern/intern.mjs +293 -0
  226. package/node_modules/typebox/build/schema/meta/draft_2019_09.d.mts +2 -0
  227. package/node_modules/typebox/build/schema/meta/draft_2019_09.mjs +288 -0
  228. package/node_modules/typebox/build/schema/meta/draft_2020_12.d.mts +2 -0
  229. package/node_modules/typebox/build/schema/meta/draft_2020_12.mjs +300 -0
  230. package/node_modules/typebox/build/schema/meta/draft_3.d.mts +2 -0
  231. package/node_modules/typebox/build/schema/meta/draft_3.mjs +143 -0
  232. package/node_modules/typebox/build/schema/meta/draft_4.d.mts +2 -0
  233. package/node_modules/typebox/build/schema/meta/draft_4.mjs +149 -0
  234. package/node_modules/typebox/build/schema/meta/draft_6.d.mts +2 -0
  235. package/node_modules/typebox/build/schema/meta/draft_6.mjs +155 -0
  236. package/node_modules/typebox/build/schema/meta/draft_7.d.mts +2 -0
  237. package/node_modules/typebox/build/schema/meta/draft_7.mjs +172 -0
  238. package/node_modules/typebox/build/schema/meta/index.d.mts +2 -0
  239. package/node_modules/typebox/build/schema/meta/index.mjs +2 -0
  240. package/node_modules/typebox/build/schema/meta/meta.d.mts +9 -0
  241. package/node_modules/typebox/build/schema/meta/meta.mjs +15 -0
  242. package/node_modules/typebox/build/schema/meta/schema.d.mts +6 -0
  243. package/node_modules/typebox/build/schema/meta/schema.mjs +1 -0
  244. package/node_modules/typebox/build/schema/parse.d.mts +14 -0
  245. package/node_modules/typebox/build/schema/parse.mjs +32 -0
  246. package/node_modules/typebox/build/schema/pointer/index.d.mts +2 -0
  247. package/node_modules/typebox/build/schema/pointer/index.mjs +2 -0
  248. package/node_modules/typebox/build/schema/pointer/pointer.d.mts +10 -0
  249. package/node_modules/typebox/build/schema/pointer/pointer.mjs +106 -0
  250. package/node_modules/typebox/build/schema/pointer/pointer_get.d.mts +9 -0
  251. package/node_modules/typebox/build/schema/pointer/pointer_get.mjs +2 -0
  252. package/node_modules/typebox/build/schema/resolve/index.d.mts +1 -0
  253. package/node_modules/typebox/build/schema/resolve/index.mjs +1 -0
  254. package/node_modules/typebox/build/schema/resolve/resolve.d.mts +9 -0
  255. package/node_modules/typebox/build/schema/resolve/resolve.mjs +331 -0
  256. package/node_modules/typebox/build/schema/schema.d.mts +12 -0
  257. package/node_modules/typebox/build/schema/schema.mjs +12 -0
  258. package/node_modules/typebox/build/schema/static/_canonical.d.mts +7 -0
  259. package/node_modules/typebox/build/schema/static/_canonical.mjs +2 -0
  260. package/node_modules/typebox/build/schema/static/_comparer.d.mts +6 -0
  261. package/node_modules/typebox/build/schema/static/_comparer.mjs +2 -0
  262. package/node_modules/typebox/build/schema/static/_elements.d.mts +18 -0
  263. package/node_modules/typebox/build/schema/static/_elements.mjs +2 -0
  264. package/node_modules/typebox/build/schema/static/additionalProperties.d.mts +7 -0
  265. package/node_modules/typebox/build/schema/static/additionalProperties.mjs +3 -0
  266. package/node_modules/typebox/build/schema/static/allOf.d.mts +3 -0
  267. package/node_modules/typebox/build/schema/static/allOf.mjs +2 -0
  268. package/node_modules/typebox/build/schema/static/anyOf.d.mts +3 -0
  269. package/node_modules/typebox/build/schema/static/anyOf.mjs +2 -0
  270. package/node_modules/typebox/build/schema/static/const.d.mts +1 -0
  271. package/node_modules/typebox/build/schema/static/const.mjs +2 -0
  272. package/node_modules/typebox/build/schema/static/enum.d.mts +1 -0
  273. package/node_modules/typebox/build/schema/static/enum.mjs +2 -0
  274. package/node_modules/typebox/build/schema/static/if.d.mts +15 -0
  275. package/node_modules/typebox/build/schema/static/if.mjs +2 -0
  276. package/node_modules/typebox/build/schema/static/index.d.mts +1 -0
  277. package/node_modules/typebox/build/schema/static/index.mjs +1 -0
  278. package/node_modules/typebox/build/schema/static/items.d.mts +7 -0
  279. package/node_modules/typebox/build/schema/static/items.mjs +2 -0
  280. package/node_modules/typebox/build/schema/static/oneOf.d.mts +3 -0
  281. package/node_modules/typebox/build/schema/static/oneOf.mjs +2 -0
  282. package/node_modules/typebox/build/schema/static/patternProperties.d.mts +7 -0
  283. package/node_modules/typebox/build/schema/static/patternProperties.mjs +2 -0
  284. package/node_modules/typebox/build/schema/static/prefixItems.d.mts +3 -0
  285. package/node_modules/typebox/build/schema/static/prefixItems.mjs +2 -0
  286. package/node_modules/typebox/build/schema/static/properties.d.mts +32 -0
  287. package/node_modules/typebox/build/schema/static/properties.mjs +2 -0
  288. package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
  289. package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
  290. package/node_modules/typebox/build/schema/static/ref.d.mts +8 -0
  291. package/node_modules/typebox/build/schema/static/ref.mjs +3 -0
  292. package/node_modules/typebox/build/schema/static/required.d.mts +3 -0
  293. package/node_modules/typebox/build/schema/static/required.mjs +3 -0
  294. package/node_modules/typebox/build/schema/static/schema.d.mts +59 -0
  295. package/node_modules/typebox/build/schema/static/schema.mjs +2 -0
  296. package/node_modules/typebox/build/schema/static/static.d.mts +4 -0
  297. package/node_modules/typebox/build/schema/static/static.mjs +3 -0
  298. package/node_modules/typebox/build/schema/static/type.d.mts +4 -0
  299. package/node_modules/typebox/build/schema/static/type.mjs +3 -0
  300. package/node_modules/typebox/build/schema/static/unevaluatedProperties.d.mts +7 -0
  301. package/node_modules/typebox/build/schema/static/unevaluatedProperties.mjs +3 -0
  302. package/node_modules/typebox/build/schema/types/_refine.d.mts +13 -0
  303. package/node_modules/typebox/build/schema/types/_refine.mjs +18 -0
  304. package/node_modules/typebox/build/schema/types/additionalItems.d.mts +9 -0
  305. package/node_modules/typebox/build/schema/types/additionalItems.mjs +14 -0
  306. package/node_modules/typebox/build/schema/types/additionalProperties.d.mts +9 -0
  307. package/node_modules/typebox/build/schema/types/additionalProperties.mjs +14 -0
  308. package/node_modules/typebox/build/schema/types/allOf.d.mts +9 -0
  309. package/node_modules/typebox/build/schema/types/allOf.mjs +15 -0
  310. package/node_modules/typebox/build/schema/types/anchor.d.mts +8 -0
  311. package/node_modules/typebox/build/schema/types/anchor.mjs +12 -0
  312. package/node_modules/typebox/build/schema/types/anyOf.d.mts +9 -0
  313. package/node_modules/typebox/build/schema/types/anyOf.mjs +15 -0
  314. package/node_modules/typebox/build/schema/types/const.d.mts +9 -0
  315. package/node_modules/typebox/build/schema/types/const.mjs +12 -0
  316. package/node_modules/typebox/build/schema/types/contains.d.mts +9 -0
  317. package/node_modules/typebox/build/schema/types/contains.mjs +14 -0
  318. package/node_modules/typebox/build/schema/types/default.d.mts +9 -0
  319. package/node_modules/typebox/build/schema/types/default.mjs +12 -0
  320. package/node_modules/typebox/build/schema/types/defs.d.mts +6 -0
  321. package/node_modules/typebox/build/schema/types/defs.mjs +12 -0
  322. package/node_modules/typebox/build/schema/types/dependencies.d.mts +11 -0
  323. package/node_modules/typebox/build/schema/types/dependencies.mjs +16 -0
  324. package/node_modules/typebox/build/schema/types/dependentRequired.d.mts +9 -0
  325. package/node_modules/typebox/build/schema/types/dependentRequired.mjs +15 -0
  326. package/node_modules/typebox/build/schema/types/dependentSchemas.d.mts +9 -0
  327. package/node_modules/typebox/build/schema/types/dependentSchemas.mjs +15 -0
  328. package/node_modules/typebox/build/schema/types/dynamicAnchor.d.mts +8 -0
  329. package/node_modules/typebox/build/schema/types/dynamicAnchor.mjs +12 -0
  330. package/node_modules/typebox/build/schema/types/dynamicRef.d.mts +8 -0
  331. package/node_modules/typebox/build/schema/types/dynamicRef.mjs +12 -0
  332. package/node_modules/typebox/build/schema/types/else.d.mts +9 -0
  333. package/node_modules/typebox/build/schema/types/else.mjs +14 -0
  334. package/node_modules/typebox/build/schema/types/enum.d.mts +9 -0
  335. package/node_modules/typebox/build/schema/types/enum.mjs +13 -0
  336. package/node_modules/typebox/build/schema/types/exclusiveMaximum.d.mts +9 -0
  337. package/node_modules/typebox/build/schema/types/exclusiveMaximum.mjs +13 -0
  338. package/node_modules/typebox/build/schema/types/exclusiveMinimum.d.mts +9 -0
  339. package/node_modules/typebox/build/schema/types/exclusiveMinimum.mjs +13 -0
  340. package/node_modules/typebox/build/schema/types/format.d.mts +9 -0
  341. package/node_modules/typebox/build/schema/types/format.mjs +13 -0
  342. package/node_modules/typebox/build/schema/types/id.d.mts +9 -0
  343. package/node_modules/typebox/build/schema/types/id.mjs +13 -0
  344. package/node_modules/typebox/build/schema/types/if.d.mts +9 -0
  345. package/node_modules/typebox/build/schema/types/if.mjs +14 -0
  346. package/node_modules/typebox/build/schema/types/index.d.mts +51 -0
  347. package/node_modules/typebox/build/schema/types/index.mjs +57 -0
  348. package/node_modules/typebox/build/schema/types/items.d.mts +19 -0
  349. package/node_modules/typebox/build/schema/types/items.mjs +26 -0
  350. package/node_modules/typebox/build/schema/types/maxContains.d.mts +9 -0
  351. package/node_modules/typebox/build/schema/types/maxContains.mjs +13 -0
  352. package/node_modules/typebox/build/schema/types/maxItems.d.mts +9 -0
  353. package/node_modules/typebox/build/schema/types/maxItems.mjs +13 -0
  354. package/node_modules/typebox/build/schema/types/maxLength.d.mts +9 -0
  355. package/node_modules/typebox/build/schema/types/maxLength.mjs +13 -0
  356. package/node_modules/typebox/build/schema/types/maxProperties.d.mts +9 -0
  357. package/node_modules/typebox/build/schema/types/maxProperties.mjs +13 -0
  358. package/node_modules/typebox/build/schema/types/maximum.d.mts +9 -0
  359. package/node_modules/typebox/build/schema/types/maximum.mjs +13 -0
  360. package/node_modules/typebox/build/schema/types/minContains.d.mts +9 -0
  361. package/node_modules/typebox/build/schema/types/minContains.mjs +13 -0
  362. package/node_modules/typebox/build/schema/types/minItems.d.mts +9 -0
  363. package/node_modules/typebox/build/schema/types/minItems.mjs +13 -0
  364. package/node_modules/typebox/build/schema/types/minLength.d.mts +9 -0
  365. package/node_modules/typebox/build/schema/types/minLength.mjs +13 -0
  366. package/node_modules/typebox/build/schema/types/minProperties.d.mts +9 -0
  367. package/node_modules/typebox/build/schema/types/minProperties.mjs +13 -0
  368. package/node_modules/typebox/build/schema/types/minimum.d.mts +9 -0
  369. package/node_modules/typebox/build/schema/types/minimum.mjs +13 -0
  370. package/node_modules/typebox/build/schema/types/multipleOf.d.mts +9 -0
  371. package/node_modules/typebox/build/schema/types/multipleOf.mjs +13 -0
  372. package/node_modules/typebox/build/schema/types/not.d.mts +9 -0
  373. package/node_modules/typebox/build/schema/types/not.mjs +14 -0
  374. package/node_modules/typebox/build/schema/types/oneOf.d.mts +9 -0
  375. package/node_modules/typebox/build/schema/types/oneOf.mjs +15 -0
  376. package/node_modules/typebox/build/schema/types/pattern.d.mts +9 -0
  377. package/node_modules/typebox/build/schema/types/pattern.mjs +14 -0
  378. package/node_modules/typebox/build/schema/types/patternProperties.d.mts +9 -0
  379. package/node_modules/typebox/build/schema/types/patternProperties.mjs +15 -0
  380. package/node_modules/typebox/build/schema/types/prefixItems.d.mts +8 -0
  381. package/node_modules/typebox/build/schema/types/prefixItems.mjs +14 -0
  382. package/node_modules/typebox/build/schema/types/properties.d.mts +9 -0
  383. package/node_modules/typebox/build/schema/types/properties.mjs +15 -0
  384. package/node_modules/typebox/build/schema/types/propertyNames.d.mts +9 -0
  385. package/node_modules/typebox/build/schema/types/propertyNames.mjs +15 -0
  386. package/node_modules/typebox/build/schema/types/recursiveAnchor.d.mts +12 -0
  387. package/node_modules/typebox/build/schema/types/recursiveAnchor.mjs +19 -0
  388. package/node_modules/typebox/build/schema/types/recursiveRef.d.mts +8 -0
  389. package/node_modules/typebox/build/schema/types/recursiveRef.mjs +12 -0
  390. package/node_modules/typebox/build/schema/types/ref.d.mts +9 -0
  391. package/node_modules/typebox/build/schema/types/ref.mjs +13 -0
  392. package/node_modules/typebox/build/schema/types/required.d.mts +9 -0
  393. package/node_modules/typebox/build/schema/types/required.mjs +14 -0
  394. package/node_modules/typebox/build/schema/types/schema.d.mts +9 -0
  395. package/node_modules/typebox/build/schema/types/schema.mjs +14 -0
  396. package/node_modules/typebox/build/schema/types/then.d.mts +9 -0
  397. package/node_modules/typebox/build/schema/types/then.mjs +14 -0
  398. package/node_modules/typebox/build/schema/types/type.d.mts +9 -0
  399. package/node_modules/typebox/build/schema/types/type.mjs +15 -0
  400. package/node_modules/typebox/build/schema/types/unevaluatedItems.d.mts +9 -0
  401. package/node_modules/typebox/build/schema/types/unevaluatedItems.mjs +14 -0
  402. package/node_modules/typebox/build/schema/types/unevaluatedProperties.d.mts +9 -0
  403. package/node_modules/typebox/build/schema/types/unevaluatedProperties.mjs +14 -0
  404. package/node_modules/typebox/build/schema/types/uniqueItems.d.mts +9 -0
  405. package/node_modules/typebox/build/schema/types/uniqueItems.mjs +13 -0
  406. package/node_modules/typebox/build/system/arguments/arguments.d.mts +5 -0
  407. package/node_modules/typebox/build/system/arguments/arguments.mjs +9 -0
  408. package/node_modules/typebox/build/system/arguments/index.d.mts +1 -0
  409. package/node_modules/typebox/build/system/arguments/index.mjs +1 -0
  410. package/node_modules/typebox/build/system/environment/environment.d.mts +1 -0
  411. package/node_modules/typebox/build/system/environment/environment.mjs +1 -0
  412. package/node_modules/typebox/build/system/environment/evaluate.d.mts +9 -0
  413. package/node_modules/typebox/build/system/environment/evaluate.mjs +37 -0
  414. package/node_modules/typebox/build/system/environment/index.d.mts +1 -0
  415. package/node_modules/typebox/build/system/environment/index.mjs +1 -0
  416. package/node_modules/typebox/build/system/hashing/hash.d.mts +4 -0
  417. package/node_modules/typebox/build/system/hashing/hash.mjs +232 -0
  418. package/node_modules/typebox/build/system/hashing/index.d.mts +1 -0
  419. package/node_modules/typebox/build/system/hashing/index.mjs +1 -0
  420. package/node_modules/typebox/build/system/index.d.mts +4 -0
  421. package/node_modules/typebox/build/system/index.mjs +4 -0
  422. package/node_modules/typebox/build/system/locale/_config.d.mts +7 -0
  423. package/node_modules/typebox/build/system/locale/_config.mjs +15 -0
  424. package/node_modules/typebox/build/system/locale/_locale.d.mts +40 -0
  425. package/node_modules/typebox/build/system/locale/_locale.mjs +40 -0
  426. package/node_modules/typebox/build/system/locale/ar_001.d.mts +3 -0
  427. package/node_modules/typebox/build/system/locale/ar_001.mjs +40 -0
  428. package/node_modules/typebox/build/system/locale/bn_BD.d.mts +3 -0
  429. package/node_modules/typebox/build/system/locale/bn_BD.mjs +40 -0
  430. package/node_modules/typebox/build/system/locale/cs_CZ.d.mts +3 -0
  431. package/node_modules/typebox/build/system/locale/cs_CZ.mjs +40 -0
  432. package/node_modules/typebox/build/system/locale/de_DE.d.mts +3 -0
  433. package/node_modules/typebox/build/system/locale/de_DE.mjs +40 -0
  434. package/node_modules/typebox/build/system/locale/el_GR.d.mts +3 -0
  435. package/node_modules/typebox/build/system/locale/el_GR.mjs +40 -0
  436. package/node_modules/typebox/build/system/locale/en_US.d.mts +3 -0
  437. package/node_modules/typebox/build/system/locale/en_US.mjs +39 -0
  438. package/node_modules/typebox/build/system/locale/es_419.d.mts +3 -0
  439. package/node_modules/typebox/build/system/locale/es_419.mjs +40 -0
  440. package/node_modules/typebox/build/system/locale/es_AR.d.mts +3 -0
  441. package/node_modules/typebox/build/system/locale/es_AR.mjs +40 -0
  442. package/node_modules/typebox/build/system/locale/es_ES.d.mts +3 -0
  443. package/node_modules/typebox/build/system/locale/es_ES.mjs +40 -0
  444. package/node_modules/typebox/build/system/locale/es_MX.d.mts +3 -0
  445. package/node_modules/typebox/build/system/locale/es_MX.mjs +40 -0
  446. package/node_modules/typebox/build/system/locale/fa_IR.d.mts +3 -0
  447. package/node_modules/typebox/build/system/locale/fa_IR.mjs +40 -0
  448. package/node_modules/typebox/build/system/locale/fil_PH.d.mts +3 -0
  449. package/node_modules/typebox/build/system/locale/fil_PH.mjs +40 -0
  450. package/node_modules/typebox/build/system/locale/fr_CA.d.mts +3 -0
  451. package/node_modules/typebox/build/system/locale/fr_CA.mjs +40 -0
  452. package/node_modules/typebox/build/system/locale/fr_FR.d.mts +3 -0
  453. package/node_modules/typebox/build/system/locale/fr_FR.mjs +40 -0
  454. package/node_modules/typebox/build/system/locale/ha_NG.d.mts +3 -0
  455. package/node_modules/typebox/build/system/locale/ha_NG.mjs +40 -0
  456. package/node_modules/typebox/build/system/locale/hi_IN.d.mts +3 -0
  457. package/node_modules/typebox/build/system/locale/hi_IN.mjs +40 -0
  458. package/node_modules/typebox/build/system/locale/hu_HU.d.mts +3 -0
  459. package/node_modules/typebox/build/system/locale/hu_HU.mjs +40 -0
  460. package/node_modules/typebox/build/system/locale/id_ID.d.mts +3 -0
  461. package/node_modules/typebox/build/system/locale/id_ID.mjs +40 -0
  462. package/node_modules/typebox/build/system/locale/index.d.mts +1 -0
  463. package/node_modules/typebox/build/system/locale/index.mjs +1 -0
  464. package/node_modules/typebox/build/system/locale/it_IT.d.mts +3 -0
  465. package/node_modules/typebox/build/system/locale/it_IT.mjs +40 -0
  466. package/node_modules/typebox/build/system/locale/ja_JP.d.mts +3 -0
  467. package/node_modules/typebox/build/system/locale/ja_JP.mjs +40 -0
  468. package/node_modules/typebox/build/system/locale/ko_KR.d.mts +3 -0
  469. package/node_modules/typebox/build/system/locale/ko_KR.mjs +40 -0
  470. package/node_modules/typebox/build/system/locale/ms_MY.d.mts +3 -0
  471. package/node_modules/typebox/build/system/locale/ms_MY.mjs +40 -0
  472. package/node_modules/typebox/build/system/locale/nl_NL.d.mts +3 -0
  473. package/node_modules/typebox/build/system/locale/nl_NL.mjs +40 -0
  474. package/node_modules/typebox/build/system/locale/pl_PL.d.mts +3 -0
  475. package/node_modules/typebox/build/system/locale/pl_PL.mjs +40 -0
  476. package/node_modules/typebox/build/system/locale/pt_BR.d.mts +3 -0
  477. package/node_modules/typebox/build/system/locale/pt_BR.mjs +40 -0
  478. package/node_modules/typebox/build/system/locale/pt_PT.d.mts +3 -0
  479. package/node_modules/typebox/build/system/locale/pt_PT.mjs +40 -0
  480. package/node_modules/typebox/build/system/locale/ro_RO.d.mts +3 -0
  481. package/node_modules/typebox/build/system/locale/ro_RO.mjs +40 -0
  482. package/node_modules/typebox/build/system/locale/ru_RU.d.mts +3 -0
  483. package/node_modules/typebox/build/system/locale/ru_RU.mjs +40 -0
  484. package/node_modules/typebox/build/system/locale/sv_SE.d.mts +3 -0
  485. package/node_modules/typebox/build/system/locale/sv_SE.mjs +40 -0
  486. package/node_modules/typebox/build/system/locale/sw_TZ.d.mts +3 -0
  487. package/node_modules/typebox/build/system/locale/sw_TZ.mjs +40 -0
  488. package/node_modules/typebox/build/system/locale/th_TH.d.mts +3 -0
  489. package/node_modules/typebox/build/system/locale/th_TH.mjs +40 -0
  490. package/node_modules/typebox/build/system/locale/tr_TR.d.mts +3 -0
  491. package/node_modules/typebox/build/system/locale/tr_TR.mjs +40 -0
  492. package/node_modules/typebox/build/system/locale/uk_UA.d.mts +3 -0
  493. package/node_modules/typebox/build/system/locale/uk_UA.mjs +40 -0
  494. package/node_modules/typebox/build/system/locale/ur_PK.d.mts +3 -0
  495. package/node_modules/typebox/build/system/locale/ur_PK.mjs +40 -0
  496. package/node_modules/typebox/build/system/locale/vi_VN.d.mts +3 -0
  497. package/node_modules/typebox/build/system/locale/vi_VN.mjs +40 -0
  498. package/node_modules/typebox/build/system/locale/yo_NG.d.mts +3 -0
  499. package/node_modules/typebox/build/system/locale/yo_NG.mjs +40 -0
  500. package/node_modules/typebox/build/system/locale/zh_Hans.d.mts +3 -0
  501. package/node_modules/typebox/build/system/locale/zh_Hans.mjs +40 -0
  502. package/node_modules/typebox/build/system/locale/zh_Hant.d.mts +3 -0
  503. package/node_modules/typebox/build/system/locale/zh_Hant.mjs +40 -0
  504. package/node_modules/typebox/build/system/memory/assign.d.mts +14 -0
  505. package/node_modules/typebox/build/system/memory/assign.mjs +12 -0
  506. package/node_modules/typebox/build/system/memory/clone.d.mts +5 -0
  507. package/node_modules/typebox/build/system/memory/clone.mjs +113 -0
  508. package/node_modules/typebox/build/system/memory/create.d.mts +8 -0
  509. package/node_modules/typebox/build/system/memory/create.mjs +29 -0
  510. package/node_modules/typebox/build/system/memory/discard.d.mts +4 -0
  511. package/node_modules/typebox/build/system/memory/discard.mjs +18 -0
  512. package/node_modules/typebox/build/system/memory/freeze.d.mts +4 -0
  513. package/node_modules/typebox/build/system/memory/freeze.mjs +6 -0
  514. package/node_modules/typebox/build/system/memory/index.d.mts +1 -0
  515. package/node_modules/typebox/build/system/memory/index.mjs +1 -0
  516. package/node_modules/typebox/build/system/memory/memory.d.mts +6 -0
  517. package/node_modules/typebox/build/system/memory/memory.mjs +7 -0
  518. package/node_modules/typebox/build/system/memory/metrics.d.mts +14 -0
  519. package/node_modules/typebox/build/system/memory/metrics.mjs +8 -0
  520. package/node_modules/typebox/build/system/memory/update.d.mts +7 -0
  521. package/node_modules/typebox/build/system/memory/update.mjs +33 -0
  522. package/node_modules/typebox/build/system/settings/index.d.mts +1 -0
  523. package/node_modules/typebox/build/system/settings/index.mjs +1 -0
  524. package/node_modules/typebox/build/system/settings/settings.d.mts +80 -0
  525. package/node_modules/typebox/build/system/settings/settings.mjs +36 -0
  526. package/node_modules/typebox/build/system/system.d.mts +6 -0
  527. package/node_modules/typebox/build/system/system.mjs +6 -0
  528. package/node_modules/typebox/build/system/unreachable/index.d.mts +1 -0
  529. package/node_modules/typebox/build/system/unreachable/index.mjs +1 -0
  530. package/node_modules/typebox/build/system/unreachable/unreachable.d.mts +3 -0
  531. package/node_modules/typebox/build/system/unreachable/unreachable.mjs +6 -0
  532. package/node_modules/typebox/build/type/action/_add_immutable.d.mts +11 -0
  533. package/node_modules/typebox/build/type/action/_add_immutable.mjs +11 -0
  534. package/node_modules/typebox/build/type/action/_add_optional.d.mts +11 -0
  535. package/node_modules/typebox/build/type/action/_add_optional.mjs +11 -0
  536. package/node_modules/typebox/build/type/action/_add_readonly.d.mts +11 -0
  537. package/node_modules/typebox/build/type/action/_add_readonly.mjs +11 -0
  538. package/node_modules/typebox/build/type/action/_remove_immutable.d.mts +11 -0
  539. package/node_modules/typebox/build/type/action/_remove_immutable.mjs +11 -0
  540. package/node_modules/typebox/build/type/action/_remove_optional.d.mts +11 -0
  541. package/node_modules/typebox/build/type/action/_remove_optional.mjs +11 -0
  542. package/node_modules/typebox/build/type/action/_remove_readonly.d.mts +11 -0
  543. package/node_modules/typebox/build/type/action/_remove_readonly.mjs +11 -0
  544. package/node_modules/typebox/build/type/action/capitalize.d.mts +11 -0
  545. package/node_modules/typebox/build/type/action/capitalize.mjs +11 -0
  546. package/node_modules/typebox/build/type/action/conditional.d.mts +12 -0
  547. package/node_modules/typebox/build/type/action/conditional.mjs +13 -0
  548. package/node_modules/typebox/build/type/action/constructor_parameters.d.mts +11 -0
  549. package/node_modules/typebox/build/type/action/constructor_parameters.mjs +11 -0
  550. package/node_modules/typebox/build/type/action/evaluate.d.mts +11 -0
  551. package/node_modules/typebox/build/type/action/evaluate.mjs +11 -0
  552. package/node_modules/typebox/build/type/action/exclude.d.mts +11 -0
  553. package/node_modules/typebox/build/type/action/exclude.mjs +11 -0
  554. package/node_modules/typebox/build/type/action/extract.d.mts +11 -0
  555. package/node_modules/typebox/build/type/action/extract.mjs +11 -0
  556. package/node_modules/typebox/build/type/action/index.d.mts +30 -0
  557. package/node_modules/typebox/build/type/action/index.mjs +30 -0
  558. package/node_modules/typebox/build/type/action/indexed.d.mts +14 -0
  559. package/node_modules/typebox/build/type/action/indexed.mjs +14 -0
  560. package/node_modules/typebox/build/type/action/instance_type.d.mts +11 -0
  561. package/node_modules/typebox/build/type/action/instance_type.mjs +11 -0
  562. package/node_modules/typebox/build/type/action/interface.d.mts +14 -0
  563. package/node_modules/typebox/build/type/action/interface.mjs +22 -0
  564. package/node_modules/typebox/build/type/action/keyof.d.mts +11 -0
  565. package/node_modules/typebox/build/type/action/keyof.mjs +11 -0
  566. package/node_modules/typebox/build/type/action/lowercase.d.mts +11 -0
  567. package/node_modules/typebox/build/type/action/lowercase.mjs +11 -0
  568. package/node_modules/typebox/build/type/action/mapped.d.mts +13 -0
  569. package/node_modules/typebox/build/type/action/mapped.mjs +13 -0
  570. package/node_modules/typebox/build/type/action/module.d.mts +13 -0
  571. package/node_modules/typebox/build/type/action/module.mjs +13 -0
  572. package/node_modules/typebox/build/type/action/non_nullable.d.mts +11 -0
  573. package/node_modules/typebox/build/type/action/non_nullable.mjs +11 -0
  574. package/node_modules/typebox/build/type/action/omit.d.mts +14 -0
  575. package/node_modules/typebox/build/type/action/omit.mjs +14 -0
  576. package/node_modules/typebox/build/type/action/parameters.d.mts +11 -0
  577. package/node_modules/typebox/build/type/action/parameters.mjs +11 -0
  578. package/node_modules/typebox/build/type/action/partial.d.mts +11 -0
  579. package/node_modules/typebox/build/type/action/partial.mjs +11 -0
  580. package/node_modules/typebox/build/type/action/pick.d.mts +14 -0
  581. package/node_modules/typebox/build/type/action/pick.mjs +14 -0
  582. package/node_modules/typebox/build/type/action/readonly_object.d.mts +16 -0
  583. package/node_modules/typebox/build/type/action/readonly_object.mjs +19 -0
  584. package/node_modules/typebox/build/type/action/required.d.mts +11 -0
  585. package/node_modules/typebox/build/type/action/required.mjs +11 -0
  586. package/node_modules/typebox/build/type/action/return_type.d.mts +11 -0
  587. package/node_modules/typebox/build/type/action/return_type.mjs +11 -0
  588. package/node_modules/typebox/build/type/action/uncapitalize.d.mts +11 -0
  589. package/node_modules/typebox/build/type/action/uncapitalize.mjs +11 -0
  590. package/node_modules/typebox/build/type/action/uppercase.d.mts +11 -0
  591. package/node_modules/typebox/build/type/action/uppercase.mjs +11 -0
  592. package/node_modules/typebox/build/type/action/with.d.mts +11 -0
  593. package/node_modules/typebox/build/type/action/with.mjs +11 -0
  594. package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +20 -0
  595. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +66 -0
  596. package/node_modules/typebox/build/type/engine/call/instantiate.d.mts +21 -0
  597. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +79 -0
  598. package/node_modules/typebox/build/type/engine/call/resolve_arguments.d.mts +13 -0
  599. package/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs +33 -0
  600. package/node_modules/typebox/build/type/engine/call/resolve_target.d.mts +25 -0
  601. package/node_modules/typebox/build/type/engine/call/resolve_target.mjs +27 -0
  602. package/node_modules/typebox/build/type/engine/conditional/index.d.mts +1 -0
  603. package/node_modules/typebox/build/type/engine/conditional/index.mjs +1 -0
  604. package/node_modules/typebox/build/type/engine/conditional/instantiate.d.mts +12 -0
  605. package/node_modules/typebox/build/type/engine/conditional/instantiate.mjs +23 -0
  606. package/node_modules/typebox/build/type/engine/constructor_parameters/index.d.mts +1 -0
  607. package/node_modules/typebox/build/type/engine/constructor_parameters/index.mjs +1 -0
  608. package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.d.mts +14 -0
  609. package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs +25 -0
  610. package/node_modules/typebox/build/type/engine/cyclic/candidates.d.mts +8 -0
  611. package/node_modules/typebox/build/type/engine/cyclic/candidates.mjs +16 -0
  612. package/node_modules/typebox/build/type/engine/cyclic/check.d.mts +21 -0
  613. package/node_modules/typebox/build/type/engine/cyclic/check.mjs +45 -0
  614. package/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +22 -0
  615. package/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +47 -0
  616. package/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +28 -0
  617. package/node_modules/typebox/build/type/engine/cyclic/extends.mjs +47 -0
  618. package/node_modules/typebox/build/type/engine/cyclic/index.d.mts +6 -0
  619. package/node_modules/typebox/build/type/engine/cyclic/index.mjs +6 -0
  620. package/node_modules/typebox/build/type/engine/cyclic/instantiate.d.mts +17 -0
  621. package/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs +31 -0
  622. package/node_modules/typebox/build/type/engine/cyclic/target.d.mts +10 -0
  623. package/node_modules/typebox/build/type/engine/cyclic/target.mjs +16 -0
  624. package/node_modules/typebox/build/type/engine/enum/index.d.mts +1 -0
  625. package/node_modules/typebox/build/type/engine/enum/index.mjs +1 -0
  626. package/node_modules/typebox/build/type/engine/enum/typescript_enum_to_enum_values.d.mts +8 -0
  627. package/node_modules/typebox/build/type/engine/enum/typescript_enum_to_enum_values.mjs +9 -0
  628. package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +15 -0
  629. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +37 -0
  630. package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +11 -0
  631. package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +18 -0
  632. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +37 -0
  633. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +60 -0
  634. package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +12 -0
  635. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +33 -0
  636. package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +26 -0
  637. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +56 -0
  638. package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +6 -0
  639. package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +10 -0
  640. package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +8 -0
  641. package/node_modules/typebox/build/type/engine/evaluate/index.mjs +8 -0
  642. package/node_modules/typebox/build/type/engine/evaluate/instantiate.d.mts +8 -0
  643. package/node_modules/typebox/build/type/engine/evaluate/instantiate.mjs +12 -0
  644. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +20 -0
  645. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +31 -0
  646. package/node_modules/typebox/build/type/engine/exclude/index.d.mts +1 -0
  647. package/node_modules/typebox/build/type/engine/exclude/index.mjs +1 -0
  648. package/node_modules/typebox/build/type/engine/exclude/instantiate.d.mts +9 -0
  649. package/node_modules/typebox/build/type/engine/exclude/instantiate.mjs +16 -0
  650. package/node_modules/typebox/build/type/engine/exclude/operation.d.mts +10 -0
  651. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +22 -0
  652. package/node_modules/typebox/build/type/engine/extract/index.d.mts +1 -0
  653. package/node_modules/typebox/build/type/engine/extract/index.mjs +1 -0
  654. package/node_modules/typebox/build/type/engine/extract/instantiate.d.mts +9 -0
  655. package/node_modules/typebox/build/type/engine/extract/instantiate.mjs +16 -0
  656. package/node_modules/typebox/build/type/engine/extract/operation.d.mts +10 -0
  657. package/node_modules/typebox/build/type/engine/extract/operation.mjs +22 -0
  658. package/node_modules/typebox/build/type/engine/helpers/index.d.mts +3 -0
  659. package/node_modules/typebox/build/type/engine/helpers/index.mjs +3 -0
  660. package/node_modules/typebox/build/type/engine/helpers/keys.d.mts +3 -0
  661. package/node_modules/typebox/build/type/engine/helpers/keys.mjs +8 -0
  662. package/node_modules/typebox/build/type/engine/helpers/keys_to_indexer.d.mts +7 -0
  663. package/node_modules/typebox/build/type/engine/helpers/keys_to_indexer.mjs +15 -0
  664. package/node_modules/typebox/build/type/engine/helpers/union.d.mts +7 -0
  665. package/node_modules/typebox/build/type/engine/helpers/union.mjs +3 -0
  666. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +10 -0
  667. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +14 -0
  668. package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.d.mts +10 -0
  669. package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs +14 -0
  670. package/node_modules/typebox/build/type/engine/index.d.mts +31 -0
  671. package/node_modules/typebox/build/type/engine/index.mjs +37 -0
  672. package/node_modules/typebox/build/type/engine/indexable/from_cyclic.d.mts +6 -0
  673. package/node_modules/typebox/build/type/engine/indexable/from_cyclic.mjs +8 -0
  674. package/node_modules/typebox/build/type/engine/indexable/from_dependent.d.mts +5 -0
  675. package/node_modules/typebox/build/type/engine/indexable/from_dependent.mjs +8 -0
  676. package/node_modules/typebox/build/type/engine/indexable/from_enum.d.mts +6 -0
  677. package/node_modules/typebox/build/type/engine/indexable/from_enum.mjs +8 -0
  678. package/node_modules/typebox/build/type/engine/indexable/from_intersect.d.mts +5 -0
  679. package/node_modules/typebox/build/type/engine/indexable/from_intersect.mjs +8 -0
  680. package/node_modules/typebox/build/type/engine/indexable/from_literal.d.mts +3 -0
  681. package/node_modules/typebox/build/type/engine/indexable/from_literal.mjs +5 -0
  682. package/node_modules/typebox/build/type/engine/indexable/from_template_literal.d.mts +5 -0
  683. package/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs +8 -0
  684. package/node_modules/typebox/build/type/engine/indexable/from_type.d.mts +19 -0
  685. package/node_modules/typebox/build/type/engine/indexable/from_type.mjs +25 -0
  686. package/node_modules/typebox/build/type/engine/indexable/from_union.d.mts +4 -0
  687. package/node_modules/typebox/build/type/engine/indexable/from_union.mjs +7 -0
  688. package/node_modules/typebox/build/type/engine/indexable/to_indexable.d.mts +9 -0
  689. package/node_modules/typebox/build/type/engine/indexable/to_indexable.mjs +14 -0
  690. package/node_modules/typebox/build/type/engine/indexable/to_indexable_keys.d.mts +10 -0
  691. package/node_modules/typebox/build/type/engine/indexable/to_indexable_keys.mjs +12 -0
  692. package/node_modules/typebox/build/type/engine/indexed/array_indexer.d.mts +12 -0
  693. package/node_modules/typebox/build/type/engine/indexed/array_indexer.mjs +18 -0
  694. package/node_modules/typebox/build/type/engine/indexed/from_array.d.mts +15 -0
  695. package/node_modules/typebox/build/type/engine/indexed/from_array.mjs +35 -0
  696. package/node_modules/typebox/build/type/engine/indexed/from_object.d.mts +16 -0
  697. package/node_modules/typebox/build/type/engine/indexed/from_object.mjs +40 -0
  698. package/node_modules/typebox/build/type/engine/indexed/from_tuple.d.mts +13 -0
  699. package/node_modules/typebox/build/type/engine/indexed/from_tuple.mjs +35 -0
  700. package/node_modules/typebox/build/type/engine/indexed/from_type.d.mts +11 -0
  701. package/node_modules/typebox/build/type/engine/indexed/from_type.mjs +14 -0
  702. package/node_modules/typebox/build/type/engine/indexed/index.d.mts +1 -0
  703. package/node_modules/typebox/build/type/engine/indexed/index.mjs +1 -0
  704. package/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +16 -0
  705. package/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +28 -0
  706. package/node_modules/typebox/build/type/engine/instance_type/index.d.mts +1 -0
  707. package/node_modules/typebox/build/type/engine/instance_type/index.mjs +1 -0
  708. package/node_modules/typebox/build/type/engine/instance_type/instantiate.d.mts +12 -0
  709. package/node_modules/typebox/build/type/engine/instance_type/instantiate.mjs +21 -0
  710. package/node_modules/typebox/build/type/engine/instantiate.d.mts +178 -0
  711. package/node_modules/typebox/build/type/engine/instantiate.mjs +158 -0
  712. package/node_modules/typebox/build/type/engine/interface/index.d.mts +1 -0
  713. package/node_modules/typebox/build/type/engine/interface/index.mjs +1 -0
  714. package/node_modules/typebox/build/type/engine/interface/instantiate.d.mts +15 -0
  715. package/node_modules/typebox/build/type/engine/interface/instantiate.mjs +23 -0
  716. package/node_modules/typebox/build/type/engine/intrinsics/from_literal.d.mts +5 -0
  717. package/node_modules/typebox/build/type/engine/intrinsics/from_literal.mjs +9 -0
  718. package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.d.mts +6 -0
  719. package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs +8 -0
  720. package/node_modules/typebox/build/type/engine/intrinsics/from_type.d.mts +10 -0
  721. package/node_modules/typebox/build/type/engine/intrinsics/from_type.mjs +13 -0
  722. package/node_modules/typebox/build/type/engine/intrinsics/from_union.d.mts +6 -0
  723. package/node_modules/typebox/build/type/engine/intrinsics/from_union.mjs +7 -0
  724. package/node_modules/typebox/build/type/engine/intrinsics/index.d.mts +1 -0
  725. package/node_modules/typebox/build/type/engine/intrinsics/index.mjs +1 -0
  726. package/node_modules/typebox/build/type/engine/intrinsics/instantiate.d.mts +38 -0
  727. package/node_modules/typebox/build/type/engine/intrinsics/instantiate.mjs +52 -0
  728. package/node_modules/typebox/build/type/engine/intrinsics/mapping.d.mts +9 -0
  729. package/node_modules/typebox/build/type/engine/intrinsics/mapping.mjs +4 -0
  730. package/node_modules/typebox/build/type/engine/keyof/from_any.d.mts +6 -0
  731. package/node_modules/typebox/build/type/engine/keyof/from_any.mjs +8 -0
  732. package/node_modules/typebox/build/type/engine/keyof/from_array.d.mts +4 -0
  733. package/node_modules/typebox/build/type/engine/keyof/from_array.mjs +5 -0
  734. package/node_modules/typebox/build/type/engine/keyof/from_object.d.mts +10 -0
  735. package/node_modules/typebox/build/type/engine/keyof/from_object.mjs +20 -0
  736. package/node_modules/typebox/build/type/engine/keyof/from_record.d.mts +4 -0
  737. package/node_modules/typebox/build/type/engine/keyof/from_record.mjs +5 -0
  738. package/node_modules/typebox/build/type/engine/keyof/from_tuple.d.mts +5 -0
  739. package/node_modules/typebox/build/type/engine/keyof/from_tuple.mjs +7 -0
  740. package/node_modules/typebox/build/type/engine/keyof/from_type.d.mts +15 -0
  741. package/node_modules/typebox/build/type/engine/keyof/from_type.mjs +23 -0
  742. package/node_modules/typebox/build/type/engine/keyof/index.d.mts +1 -0
  743. package/node_modules/typebox/build/type/engine/keyof/index.mjs +1 -0
  744. package/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +16 -0
  745. package/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +29 -0
  746. package/node_modules/typebox/build/type/engine/mapped/index.d.mts +1 -0
  747. package/node_modules/typebox/build/type/engine/mapped/index.mjs +1 -0
  748. package/node_modules/typebox/build/type/engine/mapped/instantiate.d.mts +10 -0
  749. package/node_modules/typebox/build/type/engine/mapped/instantiate.mjs +15 -0
  750. package/node_modules/typebox/build/type/engine/mapped/mapped_operation.d.mts +22 -0
  751. package/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs +42 -0
  752. package/node_modules/typebox/build/type/engine/mapped/mapped_variants.d.mts +17 -0
  753. package/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs +39 -0
  754. package/node_modules/typebox/build/type/engine/module/index.d.mts +1 -0
  755. package/node_modules/typebox/build/type/engine/module/index.mjs +1 -0
  756. package/node_modules/typebox/build/type/engine/module/instantiate.d.mts +19 -0
  757. package/node_modules/typebox/build/type/engine/module/instantiate.mjs +36 -0
  758. package/node_modules/typebox/build/type/engine/non_nullable/index.d.mts +1 -0
  759. package/node_modules/typebox/build/type/engine/non_nullable/index.mjs +1 -0
  760. package/node_modules/typebox/build/type/engine/non_nullable/instantiate.d.mts +14 -0
  761. package/node_modules/typebox/build/type/engine/non_nullable/instantiate.mjs +22 -0
  762. package/node_modules/typebox/build/type/engine/object/collapse.d.mts +12 -0
  763. package/node_modules/typebox/build/type/engine/object/collapse.mjs +14 -0
  764. package/node_modules/typebox/build/type/engine/object/from_cyclic.d.mts +6 -0
  765. package/node_modules/typebox/build/type/engine/object/from_cyclic.mjs +8 -0
  766. package/node_modules/typebox/build/type/engine/object/from_dependent.d.mts +5 -0
  767. package/node_modules/typebox/build/type/engine/object/from_dependent.mjs +8 -0
  768. package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +17 -0
  769. package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +22 -0
  770. package/node_modules/typebox/build/type/engine/object/from_object.d.mts +3 -0
  771. package/node_modules/typebox/build/type/engine/object/from_object.mjs +4 -0
  772. package/node_modules/typebox/build/type/engine/object/from_tuple.d.mts +6 -0
  773. package/node_modules/typebox/build/type/engine/object/from_tuple.mjs +9 -0
  774. package/node_modules/typebox/build/type/engine/object/from_type.d.mts +16 -0
  775. package/node_modules/typebox/build/type/engine/object/from_type.mjs +23 -0
  776. package/node_modules/typebox/build/type/engine/object/from_union.d.mts +12 -0
  777. package/node_modules/typebox/build/type/engine/object/from_union.mjs +19 -0
  778. package/node_modules/typebox/build/type/engine/object/index.d.mts +1 -0
  779. package/node_modules/typebox/build/type/engine/object/index.mjs +1 -0
  780. package/node_modules/typebox/build/type/engine/omit/from_type.d.mts +12 -0
  781. package/node_modules/typebox/build/type/engine/omit/from_type.mjs +18 -0
  782. package/node_modules/typebox/build/type/engine/omit/index.d.mts +1 -0
  783. package/node_modules/typebox/build/type/engine/omit/index.mjs +1 -0
  784. package/node_modules/typebox/build/type/engine/omit/instantiate.d.mts +9 -0
  785. package/node_modules/typebox/build/type/engine/omit/instantiate.mjs +16 -0
  786. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +10 -0
  787. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +14 -0
  788. package/node_modules/typebox/build/type/engine/optional/instantiate_remove.d.mts +10 -0
  789. package/node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs +14 -0
  790. package/node_modules/typebox/build/type/engine/parameters/index.d.mts +1 -0
  791. package/node_modules/typebox/build/type/engine/parameters/index.mjs +1 -0
  792. package/node_modules/typebox/build/type/engine/parameters/instantiate.d.mts +14 -0
  793. package/node_modules/typebox/build/type/engine/parameters/instantiate.mjs +25 -0
  794. package/node_modules/typebox/build/type/engine/partial/from_cyclic.d.mts +10 -0
  795. package/node_modules/typebox/build/type/engine/partial/from_cyclic.mjs +11 -0
  796. package/node_modules/typebox/build/type/engine/partial/from_dependent.d.mts +5 -0
  797. package/node_modules/typebox/build/type/engine/partial/from_dependent.mjs +8 -0
  798. package/node_modules/typebox/build/type/engine/partial/from_intersect.d.mts +5 -0
  799. package/node_modules/typebox/build/type/engine/partial/from_intersect.mjs +8 -0
  800. package/node_modules/typebox/build/type/engine/partial/from_object.d.mts +8 -0
  801. package/node_modules/typebox/build/type/engine/partial/from_object.mjs +11 -0
  802. package/node_modules/typebox/build/type/engine/partial/from_type.d.mts +14 -0
  803. package/node_modules/typebox/build/type/engine/partial/from_type.mjs +20 -0
  804. package/node_modules/typebox/build/type/engine/partial/from_union.d.mts +5 -0
  805. package/node_modules/typebox/build/type/engine/partial/from_union.mjs +7 -0
  806. package/node_modules/typebox/build/type/engine/partial/index.d.mts +1 -0
  807. package/node_modules/typebox/build/type/engine/partial/index.mjs +1 -0
  808. package/node_modules/typebox/build/type/engine/partial/instantiate.d.mts +9 -0
  809. package/node_modules/typebox/build/type/engine/partial/instantiate.mjs +15 -0
  810. package/node_modules/typebox/build/type/engine/patterns/index.d.mts +2 -0
  811. package/node_modules/typebox/build/type/engine/patterns/index.mjs +2 -0
  812. package/node_modules/typebox/build/type/engine/patterns/pattern.d.mts +6 -0
  813. package/node_modules/typebox/build/type/engine/patterns/pattern.mjs +11 -0
  814. package/node_modules/typebox/build/type/engine/patterns/template.d.mts +7 -0
  815. package/node_modules/typebox/build/type/engine/patterns/template.mjs +20 -0
  816. package/node_modules/typebox/build/type/engine/pick/from_type.d.mts +13 -0
  817. package/node_modules/typebox/build/type/engine/pick/from_type.mjs +20 -0
  818. package/node_modules/typebox/build/type/engine/pick/index.d.mts +1 -0
  819. package/node_modules/typebox/build/type/engine/pick/index.mjs +1 -0
  820. package/node_modules/typebox/build/type/engine/pick/instantiate.d.mts +9 -0
  821. package/node_modules/typebox/build/type/engine/pick/instantiate.mjs +16 -0
  822. package/node_modules/typebox/build/type/engine/priority/index.d.mts +1 -0
  823. package/node_modules/typebox/build/type/engine/priority/index.mjs +1 -0
  824. package/node_modules/typebox/build/type/engine/priority/priority.d.mts +20 -0
  825. package/node_modules/typebox/build/type/engine/priority/priority.mjs +27 -0
  826. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +10 -0
  827. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +14 -0
  828. package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.d.mts +10 -0
  829. package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs +14 -0
  830. package/node_modules/typebox/build/type/engine/readonly_object/from_array.d.mts +5 -0
  831. package/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs +7 -0
  832. package/node_modules/typebox/build/type/engine/readonly_object/from_cyclic.d.mts +10 -0
  833. package/node_modules/typebox/build/type/engine/readonly_object/from_cyclic.mjs +11 -0
  834. package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.d.mts +5 -0
  835. package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs +8 -0
  836. package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.d.mts +5 -0
  837. package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs +8 -0
  838. package/node_modules/typebox/build/type/engine/readonly_object/from_object.d.mts +8 -0
  839. package/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs +11 -0
  840. package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.d.mts +5 -0
  841. package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs +7 -0
  842. package/node_modules/typebox/build/type/engine/readonly_object/from_type.d.mts +18 -0
  843. package/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs +25 -0
  844. package/node_modules/typebox/build/type/engine/readonly_object/from_union.d.mts +5 -0
  845. package/node_modules/typebox/build/type/engine/readonly_object/from_union.mjs +7 -0
  846. package/node_modules/typebox/build/type/engine/readonly_object/index.d.mts +1 -0
  847. package/node_modules/typebox/build/type/engine/readonly_object/index.mjs +1 -0
  848. package/node_modules/typebox/build/type/engine/readonly_object/instantiate.d.mts +9 -0
  849. package/node_modules/typebox/build/type/engine/readonly_object/instantiate.mjs +15 -0
  850. package/node_modules/typebox/build/type/engine/record/from_key.d.mts +24 -0
  851. package/node_modules/typebox/build/type/engine/record/from_key.mjs +40 -0
  852. package/node_modules/typebox/build/type/engine/record/from_key_any.d.mts +4 -0
  853. package/node_modules/typebox/build/type/engine/record/from_key_any.mjs +6 -0
  854. package/node_modules/typebox/build/type/engine/record/from_key_boolean.d.mts +7 -0
  855. package/node_modules/typebox/build/type/engine/record/from_key_boolean.mjs +5 -0
  856. package/node_modules/typebox/build/type/engine/record/from_key_enum.d.mts +6 -0
  857. package/node_modules/typebox/build/type/engine/record/from_key_enum.mjs +8 -0
  858. package/node_modules/typebox/build/type/engine/record/from_key_integer.d.mts +5 -0
  859. package/node_modules/typebox/build/type/engine/record/from_key_integer.mjs +7 -0
  860. package/node_modules/typebox/build/type/engine/record/from_key_intersect.d.mts +5 -0
  861. package/node_modules/typebox/build/type/engine/record/from_key_intersect.mjs +8 -0
  862. package/node_modules/typebox/build/type/engine/record/from_key_literal.d.mts +11 -0
  863. package/node_modules/typebox/build/type/engine/record/from_key_literal.mjs +10 -0
  864. package/node_modules/typebox/build/type/engine/record/from_key_number.d.mts +5 -0
  865. package/node_modules/typebox/build/type/engine/record/from_key_number.mjs +7 -0
  866. package/node_modules/typebox/build/type/engine/record/from_key_string.d.mts +5 -0
  867. package/node_modules/typebox/build/type/engine/record/from_key_string.mjs +12 -0
  868. package/node_modules/typebox/build/type/engine/record/from_key_template_literal.d.mts +8 -0
  869. package/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs +12 -0
  870. package/node_modules/typebox/build/type/engine/record/from_key_union.d.mts +20 -0
  871. package/node_modules/typebox/build/type/engine/record/from_key_union.mjs +39 -0
  872. package/node_modules/typebox/build/type/engine/record/index.d.mts +1 -0
  873. package/node_modules/typebox/build/type/engine/record/index.mjs +1 -0
  874. package/node_modules/typebox/build/type/engine/record/instantiate.d.mts +9 -0
  875. package/node_modules/typebox/build/type/engine/record/instantiate.mjs +17 -0
  876. package/node_modules/typebox/build/type/engine/record/record_create.d.mts +3 -0
  877. package/node_modules/typebox/build/type/engine/record/record_create.mjs +7 -0
  878. package/node_modules/typebox/build/type/engine/ref/index.d.mts +1 -0
  879. package/node_modules/typebox/build/type/engine/ref/index.mjs +1 -0
  880. package/node_modules/typebox/build/type/engine/ref/instantiate.d.mts +6 -0
  881. package/node_modules/typebox/build/type/engine/ref/instantiate.mjs +10 -0
  882. package/node_modules/typebox/build/type/engine/required/from_cyclic.d.mts +10 -0
  883. package/node_modules/typebox/build/type/engine/required/from_cyclic.mjs +11 -0
  884. package/node_modules/typebox/build/type/engine/required/from_dependent.d.mts +5 -0
  885. package/node_modules/typebox/build/type/engine/required/from_dependent.mjs +8 -0
  886. package/node_modules/typebox/build/type/engine/required/from_intersect.d.mts +5 -0
  887. package/node_modules/typebox/build/type/engine/required/from_intersect.mjs +8 -0
  888. package/node_modules/typebox/build/type/engine/required/from_object.d.mts +8 -0
  889. package/node_modules/typebox/build/type/engine/required/from_object.mjs +11 -0
  890. package/node_modules/typebox/build/type/engine/required/from_type.d.mts +14 -0
  891. package/node_modules/typebox/build/type/engine/required/from_type.mjs +20 -0
  892. package/node_modules/typebox/build/type/engine/required/from_union.d.mts +5 -0
  893. package/node_modules/typebox/build/type/engine/required/from_union.mjs +7 -0
  894. package/node_modules/typebox/build/type/engine/required/index.d.mts +1 -0
  895. package/node_modules/typebox/build/type/engine/required/index.mjs +1 -0
  896. package/node_modules/typebox/build/type/engine/required/instantiate.d.mts +9 -0
  897. package/node_modules/typebox/build/type/engine/required/instantiate.mjs +15 -0
  898. package/node_modules/typebox/build/type/engine/rest/index.d.mts +1 -0
  899. package/node_modules/typebox/build/type/engine/rest/index.mjs +1 -0
  900. package/node_modules/typebox/build/type/engine/rest/spread.d.mts +12 -0
  901. package/node_modules/typebox/build/type/engine/rest/spread.mjs +19 -0
  902. package/node_modules/typebox/build/type/engine/return_type/index.d.mts +1 -0
  903. package/node_modules/typebox/build/type/engine/return_type/index.mjs +1 -0
  904. package/node_modules/typebox/build/type/engine/return_type/instantiate.d.mts +12 -0
  905. package/node_modules/typebox/build/type/engine/return_type/instantiate.mjs +21 -0
  906. package/node_modules/typebox/build/type/engine/template_literal/create.d.mts +1 -0
  907. package/node_modules/typebox/build/type/engine/template_literal/create.mjs +5 -0
  908. package/node_modules/typebox/build/type/engine/template_literal/decode.d.mts +30 -0
  909. package/node_modules/typebox/build/type/engine/template_literal/decode.mjs +81 -0
  910. package/node_modules/typebox/build/type/engine/template_literal/encode.d.mts +33 -0
  911. package/node_modules/typebox/build/type/engine/template_literal/encode.mjs +81 -0
  912. package/node_modules/typebox/build/type/engine/template_literal/index.d.mts +6 -0
  913. package/node_modules/typebox/build/type/engine/template_literal/index.mjs +6 -0
  914. package/node_modules/typebox/build/type/engine/template_literal/instantiate.d.mts +9 -0
  915. package/node_modules/typebox/build/type/engine/template_literal/instantiate.mjs +15 -0
  916. package/node_modules/typebox/build/type/engine/template_literal/is_finite.d.mts +12 -0
  917. package/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs +26 -0
  918. package/node_modules/typebox/build/type/engine/template_literal/is_pattern.d.mts +6 -0
  919. package/node_modules/typebox/build/type/engine/template_literal/is_pattern.mjs +10 -0
  920. package/node_modules/typebox/build/type/engine/template_literal/static.d.mts +18 -0
  921. package/node_modules/typebox/build/type/engine/template_literal/static.mjs +2 -0
  922. package/node_modules/typebox/build/type/engine/this/expand_this.d.mts +16 -0
  923. package/node_modules/typebox/build/type/engine/this/expand_this.mjs +26 -0
  924. package/node_modules/typebox/build/type/engine/tuple/to_object.d.mts +12 -0
  925. package/node_modules/typebox/build/type/engine/tuple/to_object.mjs +14 -0
  926. package/node_modules/typebox/build/type/engine/with/index.d.mts +1 -0
  927. package/node_modules/typebox/build/type/engine/with/index.mjs +1 -0
  928. package/node_modules/typebox/build/type/engine/with/instantiate.d.mts +8 -0
  929. package/node_modules/typebox/build/type/engine/with/instantiate.mjs +14 -0
  930. package/node_modules/typebox/build/type/extends/any.d.mts +9 -0
  931. package/node_modules/typebox/build/type/extends/any.mjs +12 -0
  932. package/node_modules/typebox/build/type/extends/array.d.mts +20 -0
  933. package/node_modules/typebox/build/type/extends/array.mjs +21 -0
  934. package/node_modules/typebox/build/type/extends/bigint.d.mts +7 -0
  935. package/node_modules/typebox/build/type/extends/bigint.mjs +9 -0
  936. package/node_modules/typebox/build/type/extends/boolean.d.mts +7 -0
  937. package/node_modules/typebox/build/type/extends/boolean.mjs +9 -0
  938. package/node_modules/typebox/build/type/extends/constructor.d.mts +10 -0
  939. package/node_modules/typebox/build/type/extends/constructor.mjs +17 -0
  940. package/node_modules/typebox/build/type/extends/dependent.d.mts +6 -0
  941. package/node_modules/typebox/build/type/extends/dependent.mjs +6 -0
  942. package/node_modules/typebox/build/type/extends/enum.d.mts +7 -0
  943. package/node_modules/typebox/build/type/extends/enum.mjs +7 -0
  944. package/node_modules/typebox/build/type/extends/extends.d.mts +13 -0
  945. package/node_modules/typebox/build/type/extends/extends.mjs +17 -0
  946. package/node_modules/typebox/build/type/extends/extends_left.d.mts +53 -0
  947. package/node_modules/typebox/build/type/extends/extends_left.mjs +80 -0
  948. package/node_modules/typebox/build/type/extends/extends_right.d.mts +27 -0
  949. package/node_modules/typebox/build/type/extends/extends_right.mjs +49 -0
  950. package/node_modules/typebox/build/type/extends/function.d.mts +10 -0
  951. package/node_modules/typebox/build/type/extends/function.mjs +17 -0
  952. package/node_modules/typebox/build/type/extends/index.d.mts +2 -0
  953. package/node_modules/typebox/build/type/extends/index.mjs +2 -0
  954. package/node_modules/typebox/build/type/extends/inference.d.mts +34 -0
  955. package/node_modules/typebox/build/type/extends/inference.mjs +62 -0
  956. package/node_modules/typebox/build/type/extends/integer.d.mts +8 -0
  957. package/node_modules/typebox/build/type/extends/integer.mjs +10 -0
  958. package/node_modules/typebox/build/type/extends/intersect.d.mts +6 -0
  959. package/node_modules/typebox/build/type/extends/intersect.mjs +15 -0
  960. package/node_modules/typebox/build/type/extends/literal.d.mts +18 -0
  961. package/node_modules/typebox/build/type/extends/literal.mjs +44 -0
  962. package/node_modules/typebox/build/type/extends/never.d.mts +8 -0
  963. package/node_modules/typebox/build/type/extends/never.mjs +9 -0
  964. package/node_modules/typebox/build/type/extends/null.d.mts +7 -0
  965. package/node_modules/typebox/build/type/extends/null.mjs +9 -0
  966. package/node_modules/typebox/build/type/extends/number.d.mts +7 -0
  967. package/node_modules/typebox/build/type/extends/number.mjs +9 -0
  968. package/node_modules/typebox/build/type/extends/object.d.mts +32 -0
  969. package/node_modules/typebox/build/type/extends/object.mjs +109 -0
  970. package/node_modules/typebox/build/type/extends/parameters.d.mts +15 -0
  971. package/node_modules/typebox/build/type/extends/parameters.mjs +28 -0
  972. package/node_modules/typebox/build/type/extends/record.d.mts +13 -0
  973. package/node_modules/typebox/build/type/extends/record.mjs +23 -0
  974. package/node_modules/typebox/build/type/extends/result.d.mts +24 -0
  975. package/node_modules/typebox/build/type/extends/result.mjs +36 -0
  976. package/node_modules/typebox/build/type/extends/return_type.d.mts +7 -0
  977. package/node_modules/typebox/build/type/extends/return_type.mjs +9 -0
  978. package/node_modules/typebox/build/type/extends/string.d.mts +7 -0
  979. package/node_modules/typebox/build/type/extends/string.mjs +9 -0
  980. package/node_modules/typebox/build/type/extends/symbol.d.mts +7 -0
  981. package/node_modules/typebox/build/type/extends/symbol.mjs +9 -0
  982. package/node_modules/typebox/build/type/extends/template_literal.d.mts +6 -0
  983. package/node_modules/typebox/build/type/extends/template_literal.mjs +7 -0
  984. package/node_modules/typebox/build/type/extends/tuple.d.mts +22 -0
  985. package/node_modules/typebox/build/type/extends/tuple.mjs +61 -0
  986. package/node_modules/typebox/build/type/extends/undefined.d.mts +8 -0
  987. package/node_modules/typebox/build/type/extends/undefined.mjs +10 -0
  988. package/node_modules/typebox/build/type/extends/union.d.mts +11 -0
  989. package/node_modules/typebox/build/type/extends/union.mjs +24 -0
  990. package/node_modules/typebox/build/type/extends/unknown.d.mts +9 -0
  991. package/node_modules/typebox/build/type/extends/unknown.mjs +12 -0
  992. package/node_modules/typebox/build/type/extends/void.d.mts +7 -0
  993. package/node_modules/typebox/build/type/extends/void.mjs +9 -0
  994. package/node_modules/typebox/build/type/index.d.mts +5 -0
  995. package/node_modules/typebox/build/type/index.mjs +5 -0
  996. package/node_modules/typebox/build/type/script/index.d.mts +1 -0
  997. package/node_modules/typebox/build/type/script/index.mjs +1 -0
  998. package/node_modules/typebox/build/type/script/mapping.d.mts +356 -0
  999. package/node_modules/typebox/build/type/script/mapping.mjs +528 -0
  1000. package/node_modules/typebox/build/type/script/parser.d.mts +256 -0
  1001. package/node_modules/typebox/build/type/script/parser.mjs +140 -0
  1002. package/node_modules/typebox/build/type/script/script.d.mts +16 -0
  1003. package/node_modules/typebox/build/type/script/script.mjs +22 -0
  1004. package/node_modules/typebox/build/type/script/token/bigint.d.mts +8 -0
  1005. package/node_modules/typebox/build/type/script/token/bigint.mjs +14 -0
  1006. package/node_modules/typebox/build/type/script/token/const.d.mts +11 -0
  1007. package/node_modules/typebox/build/type/script/token/const.mjs +18 -0
  1008. package/node_modules/typebox/build/type/script/token/ident.d.mts +16 -0
  1009. package/node_modules/typebox/build/type/script/token/ident.mjs +26 -0
  1010. package/node_modules/typebox/build/type/script/token/index.d.mts +12 -0
  1011. package/node_modules/typebox/build/type/script/token/index.mjs +12 -0
  1012. package/node_modules/typebox/build/type/script/token/integer.d.mts +11 -0
  1013. package/node_modules/typebox/build/type/script/token/integer.mjs +19 -0
  1014. package/node_modules/typebox/build/type/script/token/internal/char.d.mts +75 -0
  1015. package/node_modules/typebox/build/type/script/token/internal/char.mjs +26 -0
  1016. package/node_modules/typebox/build/type/script/token/internal/guard.d.mts +1 -0
  1017. package/node_modules/typebox/build/type/script/token/internal/guard.mjs +15 -0
  1018. package/node_modules/typebox/build/type/script/token/internal/many.d.mts +7 -0
  1019. package/node_modules/typebox/build/type/script/token/internal/many.mjs +14 -0
  1020. package/node_modules/typebox/build/type/script/token/internal/match.d.mts +6 -0
  1021. package/node_modules/typebox/build/type/script/token/internal/match.mjs +11 -0
  1022. package/node_modules/typebox/build/type/script/token/internal/optional.d.mts +5 -0
  1023. package/node_modules/typebox/build/type/script/token/internal/optional.mjs +9 -0
  1024. package/node_modules/typebox/build/type/script/token/internal/take.d.mts +6 -0
  1025. package/node_modules/typebox/build/type/script/token/internal/take.mjs +30 -0
  1026. package/node_modules/typebox/build/type/script/token/internal/trim.d.mts +19 -0
  1027. package/node_modules/typebox/build/type/script/token/internal/trim.mjs +34 -0
  1028. package/node_modules/typebox/build/type/script/token/number.d.mts +11 -0
  1029. package/node_modules/typebox/build/type/script/token/number.mjs +19 -0
  1030. package/node_modules/typebox/build/type/script/token/rest.d.mts +4 -0
  1031. package/node_modules/typebox/build/type/script/token/rest.mjs +9 -0
  1032. package/node_modules/typebox/build/type/script/token/span.d.mts +11 -0
  1033. package/node_modules/typebox/build/type/script/token/span.mjs +24 -0
  1034. package/node_modules/typebox/build/type/script/token/string.d.mts +11 -0
  1035. package/node_modules/typebox/build/type/script/token/string.mjs +20 -0
  1036. package/node_modules/typebox/build/type/script/token/unsigned_integer.d.mts +16 -0
  1037. package/node_modules/typebox/build/type/script/token/unsigned_integer.mjs +26 -0
  1038. package/node_modules/typebox/build/type/script/token/unsigned_number.d.mts +17 -0
  1039. package/node_modules/typebox/build/type/script/token/unsigned_number.mjs +38 -0
  1040. package/node_modules/typebox/build/type/script/token/until.d.mts +7 -0
  1041. package/node_modules/typebox/build/type/script/token/until.mjs +21 -0
  1042. package/node_modules/typebox/build/type/script/token/until_1.d.mts +5 -0
  1043. package/node_modules/typebox/build/type/script/token/until_1.mjs +12 -0
  1044. package/node_modules/typebox/build/type/types/_codec.d.mts +30 -0
  1045. package/node_modules/typebox/build/type/types/_codec.mjs +60 -0
  1046. package/node_modules/typebox/build/type/types/_immutable.d.mts +9 -0
  1047. package/node_modules/typebox/build/type/types/_immutable.mjs +18 -0
  1048. package/node_modules/typebox/build/type/types/_optional.d.mts +9 -0
  1049. package/node_modules/typebox/build/type/types/_optional.mjs +18 -0
  1050. package/node_modules/typebox/build/type/types/_readonly.d.mts +9 -0
  1051. package/node_modules/typebox/build/type/types/_readonly.mjs +18 -0
  1052. package/node_modules/typebox/build/type/types/_refine.d.mts +24 -0
  1053. package/node_modules/typebox/build/type/types/_refine.mjs +36 -0
  1054. package/node_modules/typebox/build/type/types/any.d.mts +10 -0
  1055. package/node_modules/typebox/build/type/types/any.mjs +18 -0
  1056. package/node_modules/typebox/build/type/types/array.d.mts +18 -0
  1057. package/node_modules/typebox/build/type/types/array.mjs +25 -0
  1058. package/node_modules/typebox/build/type/types/bigint.d.mts +12 -0
  1059. package/node_modules/typebox/build/type/types/bigint.mjs +21 -0
  1060. package/node_modules/typebox/build/type/types/boolean.d.mts +11 -0
  1061. package/node_modules/typebox/build/type/types/boolean.mjs +17 -0
  1062. package/node_modules/typebox/build/type/types/call.d.mts +16 -0
  1063. package/node_modules/typebox/build/type/types/call.mjs +23 -0
  1064. package/node_modules/typebox/build/type/types/constructor.d.mts +18 -0
  1065. package/node_modules/typebox/build/type/types/constructor.mjs +24 -0
  1066. package/node_modules/typebox/build/type/types/cyclic.d.mts +16 -0
  1067. package/node_modules/typebox/build/type/types/cyclic.mjs +29 -0
  1068. package/node_modules/typebox/build/type/types/deferred.d.mts +13 -0
  1069. package/node_modules/typebox/build/type/types/deferred.mjs +16 -0
  1070. package/node_modules/typebox/build/type/types/dependent.d.mts +17 -0
  1071. package/node_modules/typebox/build/type/types/dependent.mjs +24 -0
  1072. package/node_modules/typebox/build/type/types/enum.d.mts +18 -0
  1073. package/node_modules/typebox/build/type/types/enum.mjs +22 -0
  1074. package/node_modules/typebox/build/type/types/function.d.mts +21 -0
  1075. package/node_modules/typebox/build/type/types/function.mjs +25 -0
  1076. package/node_modules/typebox/build/type/types/generic.d.mts +13 -0
  1077. package/node_modules/typebox/build/type/types/generic.mjs +17 -0
  1078. package/node_modules/typebox/build/type/types/identifier.d.mts +11 -0
  1079. package/node_modules/typebox/build/type/types/identifier.mjs +17 -0
  1080. package/node_modules/typebox/build/type/types/index.d.mts +45 -0
  1081. package/node_modules/typebox/build/type/types/index.mjs +51 -0
  1082. package/node_modules/typebox/build/type/types/infer.d.mts +15 -0
  1083. package/node_modules/typebox/build/type/types/infer.mjs +20 -0
  1084. package/node_modules/typebox/build/type/types/integer.d.mts +12 -0
  1085. package/node_modules/typebox/build/type/types/integer.mjs +21 -0
  1086. package/node_modules/typebox/build/type/types/intersect.d.mts +15 -0
  1087. package/node_modules/typebox/build/type/types/intersect.mjs +24 -0
  1088. package/node_modules/typebox/build/type/types/literal.d.mts +31 -0
  1089. package/node_modules/typebox/build/type/types/literal.mjs +62 -0
  1090. package/node_modules/typebox/build/type/types/never.d.mts +12 -0
  1091. package/node_modules/typebox/build/type/types/never.mjs +22 -0
  1092. package/node_modules/typebox/build/type/types/null.d.mts +11 -0
  1093. package/node_modules/typebox/build/type/types/null.mjs +17 -0
  1094. package/node_modules/typebox/build/type/types/number.d.mts +12 -0
  1095. package/node_modules/typebox/build/type/types/number.mjs +21 -0
  1096. package/node_modules/typebox/build/type/types/object.d.mts +18 -0
  1097. package/node_modules/typebox/build/type/types/object.mjs +28 -0
  1098. package/node_modules/typebox/build/type/types/parameter.d.mts +17 -0
  1099. package/node_modules/typebox/build/type/types/parameter.mjs +21 -0
  1100. package/node_modules/typebox/build/type/types/properties.d.mts +43 -0
  1101. package/node_modules/typebox/build/type/types/properties.mjs +15 -0
  1102. package/node_modules/typebox/build/type/types/record.d.mts +52 -0
  1103. package/node_modules/typebox/build/type/types/record.mjs +66 -0
  1104. package/node_modules/typebox/build/type/types/ref.d.mts +19 -0
  1105. package/node_modules/typebox/build/type/types/ref.mjs +18 -0
  1106. package/node_modules/typebox/build/type/types/rest.d.mts +11 -0
  1107. package/node_modules/typebox/build/type/types/rest.mjs +17 -0
  1108. package/node_modules/typebox/build/type/types/schema.d.mts +176 -0
  1109. package/node_modules/typebox/build/type/types/schema.mjs +15 -0
  1110. package/node_modules/typebox/build/type/types/static.d.mts +45 -0
  1111. package/node_modules/typebox/build/type/types/static.mjs +3 -0
  1112. package/node_modules/typebox/build/type/types/string.d.mts +12 -0
  1113. package/node_modules/typebox/build/type/types/string.mjs +22 -0
  1114. package/node_modules/typebox/build/type/types/symbol.d.mts +11 -0
  1115. package/node_modules/typebox/build/type/types/symbol.mjs +17 -0
  1116. package/node_modules/typebox/build/type/types/template_literal.d.mts +28 -0
  1117. package/node_modules/typebox/build/type/types/template_literal.mjs +37 -0
  1118. package/node_modules/typebox/build/type/types/this.d.mts +14 -0
  1119. package/node_modules/typebox/build/type/types/this.mjs +17 -0
  1120. package/node_modules/typebox/build/type/types/tuple.d.mts +38 -0
  1121. package/node_modules/typebox/build/type/types/tuple.mjs +25 -0
  1122. package/node_modules/typebox/build/type/types/undefined.d.mts +11 -0
  1123. package/node_modules/typebox/build/type/types/undefined.mjs +17 -0
  1124. package/node_modules/typebox/build/type/types/union.d.mts +15 -0
  1125. package/node_modules/typebox/build/type/types/union.mjs +24 -0
  1126. package/node_modules/typebox/build/type/types/unknown.d.mts +10 -0
  1127. package/node_modules/typebox/build/type/types/unknown.mjs +17 -0
  1128. package/node_modules/typebox/build/type/types/unsafe.d.mts +10 -0
  1129. package/node_modules/typebox/build/type/types/unsafe.mjs +20 -0
  1130. package/node_modules/typebox/build/type/types/void.d.mts +11 -0
  1131. package/node_modules/typebox/build/type/types/void.mjs +17 -0
  1132. package/node_modules/typebox/build/typebox.d.mts +69 -0
  1133. package/node_modules/typebox/build/typebox.mjs +85 -0
  1134. package/node_modules/typebox/build/value/assert/assert.d.mts +14 -0
  1135. package/node_modules/typebox/build/value/assert/assert.mjs +28 -0
  1136. package/node_modules/typebox/build/value/assert/index.d.mts +1 -0
  1137. package/node_modules/typebox/build/value/assert/index.mjs +1 -0
  1138. package/node_modules/typebox/build/value/check/check.d.mts +5 -0
  1139. package/node_modules/typebox/build/value/check/check.mjs +11 -0
  1140. package/node_modules/typebox/build/value/check/index.d.mts +1 -0
  1141. package/node_modules/typebox/build/value/check/index.mjs +1 -0
  1142. package/node_modules/typebox/build/value/clean/additional.d.mts +2 -0
  1143. package/node_modules/typebox/build/value/clean/additional.mjs +6 -0
  1144. package/node_modules/typebox/build/value/clean/clean.d.mts +15 -0
  1145. package/node_modules/typebox/build/value/clean/clean.mjs +17 -0
  1146. package/node_modules/typebox/build/value/clean/from_array.d.mts +2 -0
  1147. package/node_modules/typebox/build/value/clean/from_array.mjs +8 -0
  1148. package/node_modules/typebox/build/value/clean/from_cyclic.d.mts +2 -0
  1149. package/node_modules/typebox/build/value/clean/from_cyclic.mjs +6 -0
  1150. package/node_modules/typebox/build/value/clean/from_intersect.d.mts +2 -0
  1151. package/node_modules/typebox/build/value/clean/from_intersect.mjs +26 -0
  1152. package/node_modules/typebox/build/value/clean/from_object.d.mts +2 -0
  1153. package/node_modules/typebox/build/value/clean/from_object.mjs +31 -0
  1154. package/node_modules/typebox/build/value/clean/from_record.d.mts +2 -0
  1155. package/node_modules/typebox/build/value/clean/from_record.mjs +32 -0
  1156. package/node_modules/typebox/build/value/clean/from_ref.d.mts +2 -0
  1157. package/node_modules/typebox/build/value/clean/from_ref.mjs +8 -0
  1158. package/node_modules/typebox/build/value/clean/from_tuple.d.mts +2 -0
  1159. package/node_modules/typebox/build/value/clean/from_tuple.mjs +14 -0
  1160. package/node_modules/typebox/build/value/clean/from_type.d.mts +2 -0
  1161. package/node_modules/typebox/build/value/clean/from_type.mjs +21 -0
  1162. package/node_modules/typebox/build/value/clean/from_union.d.mts +2 -0
  1163. package/node_modules/typebox/build/value/clean/from_union.mjs +12 -0
  1164. package/node_modules/typebox/build/value/clean/index.d.mts +1 -0
  1165. package/node_modules/typebox/build/value/clean/index.mjs +1 -0
  1166. package/node_modules/typebox/build/value/clone/clone.d.mts +5 -0
  1167. package/node_modules/typebox/build/value/clone/clone.mjs +12 -0
  1168. package/node_modules/typebox/build/value/clone/index.d.mts +1 -0
  1169. package/node_modules/typebox/build/value/clone/index.mjs +1 -0
  1170. package/node_modules/typebox/build/value/codec/callback.d.mts +2 -0
  1171. package/node_modules/typebox/build/value/codec/callback.mjs +25 -0
  1172. package/node_modules/typebox/build/value/codec/decode.d.mts +12 -0
  1173. package/node_modules/typebox/build/value/codec/decode.mjs +52 -0
  1174. package/node_modules/typebox/build/value/codec/encode.d.mts +12 -0
  1175. package/node_modules/typebox/build/value/codec/encode.mjs +52 -0
  1176. package/node_modules/typebox/build/value/codec/from_array.d.mts +2 -0
  1177. package/node_modules/typebox/build/value/codec/from_array.mjs +35 -0
  1178. package/node_modules/typebox/build/value/codec/from_cyclic.d.mts +2 -0
  1179. package/node_modules/typebox/build/value/codec/from_cyclic.mjs +8 -0
  1180. package/node_modules/typebox/build/value/codec/from_intersect.d.mts +2 -0
  1181. package/node_modules/typebox/build/value/codec/from_intersect.mjs +58 -0
  1182. package/node_modules/typebox/build/value/codec/from_object.d.mts +2 -0
  1183. package/node_modules/typebox/build/value/codec/from_object.mjs +42 -0
  1184. package/node_modules/typebox/build/value/codec/from_record.d.mts +2 -0
  1185. package/node_modules/typebox/build/value/codec/from_record.mjs +39 -0
  1186. package/node_modules/typebox/build/value/codec/from_ref.d.mts +2 -0
  1187. package/node_modules/typebox/build/value/codec/from_ref.mjs +31 -0
  1188. package/node_modules/typebox/build/value/codec/from_tuple.d.mts +2 -0
  1189. package/node_modules/typebox/build/value/codec/from_tuple.mjs +32 -0
  1190. package/node_modules/typebox/build/value/codec/from_type.d.mts +2 -0
  1191. package/node_modules/typebox/build/value/codec/from_type.mjs +22 -0
  1192. package/node_modules/typebox/build/value/codec/from_union.d.mts +2 -0
  1193. package/node_modules/typebox/build/value/codec/from_union.mjs +39 -0
  1194. package/node_modules/typebox/build/value/codec/has.d.mts +5 -0
  1195. package/node_modules/typebox/build/value/codec/has.mjs +93 -0
  1196. package/node_modules/typebox/build/value/codec/index.d.mts +3 -0
  1197. package/node_modules/typebox/build/value/codec/index.mjs +3 -0
  1198. package/node_modules/typebox/build/value/convert/convert.d.mts +13 -0
  1199. package/node_modules/typebox/build/value/convert/convert.mjs +15 -0
  1200. package/node_modules/typebox/build/value/convert/from_additional.d.mts +6 -0
  1201. package/node_modules/typebox/build/value/convert/from_additional.mjs +18 -0
  1202. package/node_modules/typebox/build/value/convert/from_array.d.mts +2 -0
  1203. package/node_modules/typebox/build/value/convert/from_array.mjs +7 -0
  1204. package/node_modules/typebox/build/value/convert/from_bigint.d.mts +2 -0
  1205. package/node_modules/typebox/build/value/convert/from_bigint.mjs +6 -0
  1206. package/node_modules/typebox/build/value/convert/from_boolean.d.mts +2 -0
  1207. package/node_modules/typebox/build/value/convert/from_boolean.mjs +6 -0
  1208. package/node_modules/typebox/build/value/convert/from_cyclic.d.mts +2 -0
  1209. package/node_modules/typebox/build/value/convert/from_cyclic.mjs +6 -0
  1210. package/node_modules/typebox/build/value/convert/from_enum.d.mts +2 -0
  1211. package/node_modules/typebox/build/value/convert/from_enum.mjs +6 -0
  1212. package/node_modules/typebox/build/value/convert/from_integer.d.mts +2 -0
  1213. package/node_modules/typebox/build/value/convert/from_integer.mjs +6 -0
  1214. package/node_modules/typebox/build/value/convert/from_intersect.d.mts +2 -0
  1215. package/node_modules/typebox/build/value/convert/from_intersect.mjs +8 -0
  1216. package/node_modules/typebox/build/value/convert/from_literal.d.mts +2 -0
  1217. package/node_modules/typebox/build/value/convert/from_literal.mjs +44 -0
  1218. package/node_modules/typebox/build/value/convert/from_null.d.mts +2 -0
  1219. package/node_modules/typebox/build/value/convert/from_null.mjs +6 -0
  1220. package/node_modules/typebox/build/value/convert/from_number.d.mts +2 -0
  1221. package/node_modules/typebox/build/value/convert/from_number.mjs +6 -0
  1222. package/node_modules/typebox/build/value/convert/from_object.d.mts +2 -0
  1223. package/node_modules/typebox/build/value/convert/from_object.mjs +28 -0
  1224. package/node_modules/typebox/build/value/convert/from_record.d.mts +2 -0
  1225. package/node_modules/typebox/build/value/convert/from_record.mjs +23 -0
  1226. package/node_modules/typebox/build/value/convert/from_ref.d.mts +2 -0
  1227. package/node_modules/typebox/build/value/convert/from_ref.mjs +8 -0
  1228. package/node_modules/typebox/build/value/convert/from_string.d.mts +2 -0
  1229. package/node_modules/typebox/build/value/convert/from_string.mjs +6 -0
  1230. package/node_modules/typebox/build/value/convert/from_template_literal.d.mts +2 -0
  1231. package/node_modules/typebox/build/value/convert/from_template_literal.mjs +6 -0
  1232. package/node_modules/typebox/build/value/convert/from_tuple.d.mts +2 -0
  1233. package/node_modules/typebox/build/value/convert/from_tuple.mjs +11 -0
  1234. package/node_modules/typebox/build/value/convert/from_type.d.mts +2 -0
  1235. package/node_modules/typebox/build/value/convert/from_type.mjs +43 -0
  1236. package/node_modules/typebox/build/value/convert/from_undefined.d.mts +2 -0
  1237. package/node_modules/typebox/build/value/convert/from_undefined.mjs +6 -0
  1238. package/node_modules/typebox/build/value/convert/from_union.d.mts +2 -0
  1239. package/node_modules/typebox/build/value/convert/from_union.mjs +13 -0
  1240. package/node_modules/typebox/build/value/convert/from_void.d.mts +2 -0
  1241. package/node_modules/typebox/build/value/convert/from_void.mjs +6 -0
  1242. package/node_modules/typebox/build/value/convert/index.d.mts +1 -0
  1243. package/node_modules/typebox/build/value/convert/index.mjs +1 -0
  1244. package/node_modules/typebox/build/value/convert/try/index.d.mts +1 -0
  1245. package/node_modules/typebox/build/value/convert/try/index.mjs +1 -0
  1246. package/node_modules/typebox/build/value/convert/try/try.d.mts +8 -0
  1247. package/node_modules/typebox/build/value/convert/try/try.mjs +8 -0
  1248. package/node_modules/typebox/build/value/convert/try/try_array.d.mts +2 -0
  1249. package/node_modules/typebox/build/value/convert/try/try_array.mjs +6 -0
  1250. package/node_modules/typebox/build/value/convert/try/try_bigint.d.mts +2 -0
  1251. package/node_modules/typebox/build/value/convert/try/try_bigint.mjs +45 -0
  1252. package/node_modules/typebox/build/value/convert/try/try_boolean.d.mts +2 -0
  1253. package/node_modules/typebox/build/value/convert/try/try_boolean.mjs +41 -0
  1254. package/node_modules/typebox/build/value/convert/try/try_null.d.mts +2 -0
  1255. package/node_modules/typebox/build/value/convert/try/try_null.mjs +44 -0
  1256. package/node_modules/typebox/build/value/convert/try/try_number.d.mts +2 -0
  1257. package/node_modules/typebox/build/value/convert/try/try_number.mjs +44 -0
  1258. package/node_modules/typebox/build/value/convert/try/try_result.d.mts +8 -0
  1259. package/node_modules/typebox/build/value/convert/try/try_result.mjs +17 -0
  1260. package/node_modules/typebox/build/value/convert/try/try_string.d.mts +2 -0
  1261. package/node_modules/typebox/build/value/convert/try/try_string.mjs +12 -0
  1262. package/node_modules/typebox/build/value/convert/try/try_undefined.d.mts +2 -0
  1263. package/node_modules/typebox/build/value/convert/try/try_undefined.mjs +44 -0
  1264. package/node_modules/typebox/build/value/create/create.d.mts +5 -0
  1265. package/node_modules/typebox/build/value/create/create.mjs +11 -0
  1266. package/node_modules/typebox/build/value/create/error.d.mts +5 -0
  1267. package/node_modules/typebox/build/value/create/error.mjs +7 -0
  1268. package/node_modules/typebox/build/value/create/from_array.d.mts +2 -0
  1269. package/node_modules/typebox/build/value/create/from_array.mjs +10 -0
  1270. package/node_modules/typebox/build/value/create/from_bigint.d.mts +2 -0
  1271. package/node_modules/typebox/build/value/create/from_bigint.mjs +7 -0
  1272. package/node_modules/typebox/build/value/create/from_boolean.d.mts +2 -0
  1273. package/node_modules/typebox/build/value/create/from_boolean.mjs +4 -0
  1274. package/node_modules/typebox/build/value/create/from_constructor.d.mts +2 -0
  1275. package/node_modules/typebox/build/value/create/from_constructor.mjs +10 -0
  1276. package/node_modules/typebox/build/value/create/from_cyclic.d.mts +2 -0
  1277. package/node_modules/typebox/build/value/create/from_cyclic.mjs +6 -0
  1278. package/node_modules/typebox/build/value/create/from_default.d.mts +3 -0
  1279. package/node_modules/typebox/build/value/create/from_default.mjs +10 -0
  1280. package/node_modules/typebox/build/value/create/from_enum.d.mts +2 -0
  1281. package/node_modules/typebox/build/value/create/from_enum.mjs +6 -0
  1282. package/node_modules/typebox/build/value/create/from_function.d.mts +2 -0
  1283. package/node_modules/typebox/build/value/create/from_function.mjs +6 -0
  1284. package/node_modules/typebox/build/value/create/from_integer.d.mts +2 -0
  1285. package/node_modules/typebox/build/value/create/from_integer.mjs +8 -0
  1286. package/node_modules/typebox/build/value/create/from_intersect.d.mts +2 -0
  1287. package/node_modules/typebox/build/value/create/from_intersect.mjs +8 -0
  1288. package/node_modules/typebox/build/value/create/from_literal.d.mts +2 -0
  1289. package/node_modules/typebox/build/value/create/from_literal.mjs +4 -0
  1290. package/node_modules/typebox/build/value/create/from_never.d.mts +2 -0
  1291. package/node_modules/typebox/build/value/create/from_never.mjs +5 -0
  1292. package/node_modules/typebox/build/value/create/from_null.d.mts +2 -0
  1293. package/node_modules/typebox/build/value/create/from_null.mjs +4 -0
  1294. package/node_modules/typebox/build/value/create/from_number.d.mts +2 -0
  1295. package/node_modules/typebox/build/value/create/from_number.mjs +8 -0
  1296. package/node_modules/typebox/build/value/create/from_object.d.mts +2 -0
  1297. package/node_modules/typebox/build/value/create/from_object.mjs +9 -0
  1298. package/node_modules/typebox/build/value/create/from_record.d.mts +2 -0
  1299. package/node_modules/typebox/build/value/create/from_record.mjs +8 -0
  1300. package/node_modules/typebox/build/value/create/from_ref.d.mts +2 -0
  1301. package/node_modules/typebox/build/value/create/from_ref.mjs +9 -0
  1302. package/node_modules/typebox/build/value/create/from_string.d.mts +2 -0
  1303. package/node_modules/typebox/build/value/create/from_string.mjs +9 -0
  1304. package/node_modules/typebox/build/value/create/from_symbol.d.mts +2 -0
  1305. package/node_modules/typebox/build/value/create/from_symbol.mjs +4 -0
  1306. package/node_modules/typebox/build/value/create/from_template_literal.d.mts +2 -0
  1307. package/node_modules/typebox/build/value/create/from_template_literal.mjs +11 -0
  1308. package/node_modules/typebox/build/value/create/from_tuple.d.mts +2 -0
  1309. package/node_modules/typebox/build/value/create/from_tuple.mjs +5 -0
  1310. package/node_modules/typebox/build/value/create/from_type.d.mts +2 -0
  1311. package/node_modules/typebox/build/value/create/from_type.mjs +61 -0
  1312. package/node_modules/typebox/build/value/create/from_undefined.d.mts +2 -0
  1313. package/node_modules/typebox/build/value/create/from_undefined.mjs +4 -0
  1314. package/node_modules/typebox/build/value/create/from_union.d.mts +2 -0
  1315. package/node_modules/typebox/build/value/create/from_union.mjs +9 -0
  1316. package/node_modules/typebox/build/value/create/from_void.d.mts +2 -0
  1317. package/node_modules/typebox/build/value/create/from_void.mjs +4 -0
  1318. package/node_modules/typebox/build/value/create/index.d.mts +2 -0
  1319. package/node_modules/typebox/build/value/create/index.mjs +2 -0
  1320. package/node_modules/typebox/build/value/default/default.d.mts +13 -0
  1321. package/node_modules/typebox/build/value/default/default.mjs +15 -0
  1322. package/node_modules/typebox/build/value/default/from_array.d.mts +2 -0
  1323. package/node_modules/typebox/build/value/default/from_array.mjs +12 -0
  1324. package/node_modules/typebox/build/value/default/from_cyclic.d.mts +2 -0
  1325. package/node_modules/typebox/build/value/default/from_cyclic.mjs +7 -0
  1326. package/node_modules/typebox/build/value/default/from_default.d.mts +3 -0
  1327. package/node_modules/typebox/build/value/default/from_default.mjs +13 -0
  1328. package/node_modules/typebox/build/value/default/from_intersect.d.mts +2 -0
  1329. package/node_modules/typebox/build/value/default/from_intersect.mjs +9 -0
  1330. package/node_modules/typebox/build/value/default/from_object.d.mts +2 -0
  1331. package/node_modules/typebox/build/value/default/from_object.mjs +32 -0
  1332. package/node_modules/typebox/build/value/default/from_record.d.mts +2 -0
  1333. package/node_modules/typebox/build/value/default/from_record.mjs +26 -0
  1334. package/node_modules/typebox/build/value/default/from_ref.d.mts +2 -0
  1335. package/node_modules/typebox/build/value/default/from_ref.mjs +9 -0
  1336. package/node_modules/typebox/build/value/default/from_tuple.d.mts +2 -0
  1337. package/node_modules/typebox/build/value/default/from_tuple.mjs +14 -0
  1338. package/node_modules/typebox/build/value/default/from_type.d.mts +2 -0
  1339. package/node_modules/typebox/build/value/default/from_type.mjs +25 -0
  1340. package/node_modules/typebox/build/value/default/from_union.d.mts +2 -0
  1341. package/node_modules/typebox/build/value/default/from_union.mjs +14 -0
  1342. package/node_modules/typebox/build/value/default/index.d.mts +1 -0
  1343. package/node_modules/typebox/build/value/default/index.mjs +1 -0
  1344. package/node_modules/typebox/build/value/delta/diff.d.mts +10 -0
  1345. package/node_modules/typebox/build/value/delta/diff.mjs +135 -0
  1346. package/node_modules/typebox/build/value/delta/edit.d.mts +24 -0
  1347. package/node_modules/typebox/build/value/delta/edit.mjs +17 -0
  1348. package/node_modules/typebox/build/value/delta/index.d.mts +3 -0
  1349. package/node_modules/typebox/build/value/delta/index.mjs +3 -0
  1350. package/node_modules/typebox/build/value/delta/patch.d.mts +8 -0
  1351. package/node_modules/typebox/build/value/delta/patch.mjs +42 -0
  1352. package/node_modules/typebox/build/value/equal/equal.d.mts +2 -0
  1353. package/node_modules/typebox/build/value/equal/equal.mjs +6 -0
  1354. package/node_modules/typebox/build/value/equal/index.d.mts +1 -0
  1355. package/node_modules/typebox/build/value/equal/index.mjs +1 -0
  1356. package/node_modules/typebox/build/value/errors/errors.d.mts +6 -0
  1357. package/node_modules/typebox/build/value/errors/errors.mjs +12 -0
  1358. package/node_modules/typebox/build/value/errors/index.d.mts +1 -0
  1359. package/node_modules/typebox/build/value/errors/index.mjs +1 -0
  1360. package/node_modules/typebox/build/value/hash/hash.d.mts +6 -0
  1361. package/node_modules/typebox/build/value/hash/hash.mjs +10 -0
  1362. package/node_modules/typebox/build/value/hash/index.d.mts +1 -0
  1363. package/node_modules/typebox/build/value/hash/index.mjs +1 -0
  1364. package/node_modules/typebox/build/value/index.d.mts +20 -0
  1365. package/node_modules/typebox/build/value/index.mjs +29 -0
  1366. package/node_modules/typebox/build/value/parse/index.d.mts +1 -0
  1367. package/node_modules/typebox/build/value/parse/index.mjs +1 -0
  1368. package/node_modules/typebox/build/value/parse/parse.d.mts +11 -0
  1369. package/node_modules/typebox/build/value/parse/parse.mjs +47 -0
  1370. package/node_modules/typebox/build/value/pipeline/index.d.mts +1 -0
  1371. package/node_modules/typebox/build/value/pipeline/index.mjs +1 -0
  1372. package/node_modules/typebox/build/value/pipeline/pipeline.d.mts +10 -0
  1373. package/node_modules/typebox/build/value/pipeline/pipeline.mjs +15 -0
  1374. package/node_modules/typebox/build/value/pointer/index.d.mts +1 -0
  1375. package/node_modules/typebox/build/value/pointer/index.mjs +1 -0
  1376. package/node_modules/typebox/build/value/repair/error.d.mts +7 -0
  1377. package/node_modules/typebox/build/value/repair/error.mjs +8 -0
  1378. package/node_modules/typebox/build/value/repair/from_array.d.mts +2 -0
  1379. package/node_modules/typebox/build/value/repair/from_array.mjs +39 -0
  1380. package/node_modules/typebox/build/value/repair/from_enum.d.mts +2 -0
  1381. package/node_modules/typebox/build/value/repair/from_enum.mjs +6 -0
  1382. package/node_modules/typebox/build/value/repair/from_intersect.d.mts +2 -0
  1383. package/node_modules/typebox/build/value/repair/from_intersect.mjs +8 -0
  1384. package/node_modules/typebox/build/value/repair/from_object.d.mts +2 -0
  1385. package/node_modules/typebox/build/value/repair/from_object.mjs +33 -0
  1386. package/node_modules/typebox/build/value/repair/from_record.d.mts +2 -0
  1387. package/node_modules/typebox/build/value/repair/from_record.mjs +33 -0
  1388. package/node_modules/typebox/build/value/repair/from_ref.d.mts +2 -0
  1389. package/node_modules/typebox/build/value/repair/from_ref.mjs +9 -0
  1390. package/node_modules/typebox/build/value/repair/from_template_literal.d.mts +2 -0
  1391. package/node_modules/typebox/build/value/repair/from_template_literal.mjs +7 -0
  1392. package/node_modules/typebox/build/value/repair/from_tuple.d.mts +2 -0
  1393. package/node_modules/typebox/build/value/repair/from_tuple.mjs +12 -0
  1394. package/node_modules/typebox/build/value/repair/from_type.d.mts +2 -0
  1395. package/node_modules/typebox/build/value/repair/from_type.mjs +88 -0
  1396. package/node_modules/typebox/build/value/repair/from_union.d.mts +2 -0
  1397. package/node_modules/typebox/build/value/repair/from_union.mjs +24 -0
  1398. package/node_modules/typebox/build/value/repair/from_unknown.d.mts +2 -0
  1399. package/node_modules/typebox/build/value/repair/from_unknown.mjs +12 -0
  1400. package/node_modules/typebox/build/value/repair/index.d.mts +1 -0
  1401. package/node_modules/typebox/build/value/repair/index.mjs +1 -0
  1402. package/node_modules/typebox/build/value/repair/repair.d.mts +17 -0
  1403. package/node_modules/typebox/build/value/repair/repair.mjs +20 -0
  1404. package/node_modules/typebox/build/value/shared/index.d.mts +3 -0
  1405. package/node_modules/typebox/build/value/shared/index.mjs +4 -0
  1406. package/node_modules/typebox/build/value/shared/optional_undefined.d.mts +2 -0
  1407. package/node_modules/typebox/build/value/shared/optional_undefined.mjs +15 -0
  1408. package/node_modules/typebox/build/value/shared/union_priority_sort.d.mts +7 -0
  1409. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +72 -0
  1410. package/node_modules/typebox/build/value/shared/union_score_select.d.mts +3 -0
  1411. package/node_modules/typebox/build/value/shared/union_score_select.mjs +51 -0
  1412. package/node_modules/typebox/build/value/value.d.mts +15 -0
  1413. package/node_modules/typebox/build/value/value.mjs +15 -0
  1414. package/node_modules/typebox/license +23 -0
  1415. package/node_modules/typebox/package.json +87 -0
  1416. package/node_modules/typebox/readme.md +337 -0
  1417. package/openclaw.plugin.json +69 -0
  1418. package/package.json +98 -7
  1419. package/runtime-api.ts +1 -0
  1420. package/scripts/commit-driver-transaction.sh +42 -0
  1421. package/scripts/ensure-helper-ipc-key.sh +56 -0
  1422. package/scripts/inject-helper-terminal.sh +11 -0
  1423. package/scripts/inject-helper.sh +219 -0
  1424. package/scripts/install-driver-root.sh +181 -0
  1425. package/scripts/install-driver.applescript +29 -0
  1426. package/scripts/install-driver.sh +75 -0
  1427. package/scripts/remove-user-artifacts.sh +21 -0
  1428. package/scripts/stage-helper.sh +56 -0
  1429. package/scripts/verify-native-helper.sh +29 -0
  1430. package/scripts/verify-xcode-trust.sh +152 -0
  1431. package/skills/facetime/SKILL.md +27 -0
  1432. package/skills/facetime/agents/openai.yaml +4 -0
  1433. package/src/audio-pump.ts +498 -0
  1434. package/src/call-events.ts +338 -0
  1435. package/src/call-lifecycle.ts +204 -0
  1436. package/src/config.ts +100 -0
  1437. package/src/driver-setup.ts +78 -0
  1438. package/src/helper-endpoint.ts +23 -0
  1439. package/src/helper-results.ts +132 -0
  1440. package/src/helper-rpc.ts +637 -0
  1441. package/src/helper-supervisor.ts +359 -0
  1442. package/src/outbound-call.ts +192 -0
  1443. package/src/pending-dial-store.ts +109 -0
  1444. package/src/plugin-paths.ts +201 -0
  1445. package/src/preflight.ts +295 -0
  1446. package/src/runtime-call-control.ts +457 -0
  1447. package/src/runtime-call-events.ts +407 -0
  1448. package/src/runtime-carrier-process.ts +79 -0
  1449. package/src/runtime-helper-results.ts +197 -0
  1450. package/src/runtime-lifecycle.ts +17 -0
  1451. package/src/runtime-state.ts +213 -0
  1452. package/src/runtime-status.ts +77 -0
  1453. package/src/runtime.ts +720 -0
  1454. package/src/setup.ts +615 -0
  1455. package/src/static-status.ts +41 -0
  1456. package/src/talk-consult-controller.ts +364 -0
  1457. package/src/talk-driver-config.ts +148 -0
  1458. package/src/talk-driver.ts +694 -0
  1459. package/src/talk-events-summary.ts +33 -0
  1460. package/src/talk-initial-greeting.ts +45 -0
  1461. package/src/tool.ts +160 -0
@@ -0,0 +1,3917 @@
1
+ import { l as resolveFaceTimeConfig, n as ensureCaptureBinary, r as ensureHelperArtifacts, s as installFaceTimeDriver, t as runFaceTimeSetup, u as validateFaceTimeConfig } from "./.setup/setup-DUgC9yE7.mjs";
2
+ import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
3
+ import { REALTIME_VOICE_AGENT_CONSULT_SENDER_AUTH_VERSION, REALTIME_VOICE_AGENT_CONSULT_TOOL_NAME, REALTIME_VOICE_AUDIO_FORMAT_PCM16_24KHZ, buildRealtimeVoiceAgentCancelProviderResult, buildRealtimeVoiceAgentConsultPolicyInstructions, buildRealtimeVoiceAgentConsultWorkingResponse, consultRealtimeVoiceAgent, createRealtimeVoiceBridgeSession, createTalkSessionController, getRealtimeVoiceProvider, recordRealtimeVoiceTranscript, recordTalkObservabilityEvent, resolveConfiguredRealtimeVoiceProvider, resolveRealtimeVoiceAgentConsultTools, resolveRealtimeVoiceAgentConsultToolsAllow } from "openclaw/plugin-sdk/realtime-voice";
4
+ import { asBoolean, asRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
5
+ import { resolve } from "node:path";
6
+ import { constants, existsSync } from "node:fs";
7
+ import { access } from "node:fs/promises";
8
+ import { createHmac, randomUUID, timingSafeEqual } from "node:crypto";
9
+ import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
10
+ import net from "node:net";
11
+ import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
12
+ import { spawn } from "node:child_process";
13
+ import { resolveDefaultAgentId } from "openclaw/plugin-sdk/agent-runtime";
14
+ import { parseAgentSessionKey, resolveAgentIdFromSessionKey } from "openclaw/plugin-sdk/routing";
15
+ import { resolveConfiguredSecretInputString } from "openclaw/plugin-sdk/secret-input-runtime";
16
+ import { resolveRealtimeBootstrapContextInstructions } from "openclaw/plugin-sdk/realtime-bootstrap-context";
17
+ //#region extensions/facetime/src/call-events.ts
18
+ const TU_CALL_STATUS = {
19
+ outgoingCreated: 0,
20
+ active: 1,
21
+ outgoingRinging: 3,
22
+ incomingRinging: 4
23
+ };
24
+ function readFiniteNumber(value) {
25
+ const number = typeof value === "number" ? value : typeof value === "string" ? Number(value) : NaN;
26
+ return Number.isFinite(number) ? number : void 0;
27
+ }
28
+ function normalizeCallTransport(value) {
29
+ const transport = asRecord(value);
30
+ const base = {
31
+ classifierVersion: "tu-provider-v1",
32
+ service: readFiniteNumber(transport.service),
33
+ faceTimeTransportType: readFiniteNumber(transport.facetime_transport_type ?? transport.faceTimeTransportType),
34
+ providerClassified: asBoolean(transport.provider_classified ?? transport.providerClassified),
35
+ providerIsFaceTime: asBoolean(transport.provider_is_facetime ?? transport.providerIsFaceTime),
36
+ providerIsTelephony: asBoolean(transport.provider_is_telephony ?? transport.providerIsTelephony),
37
+ isUsingBaseband: asBoolean(transport.is_using_baseband ?? transport.isUsingBaseband),
38
+ isWifiCall: asBoolean(transport.is_wifi_call ?? transport.isWifiCall),
39
+ isVoip: asBoolean(transport.is_voip ?? transport.isVoip),
40
+ isEmergency: asBoolean(transport.is_emergency ?? transport.isEmergency)
41
+ };
42
+ if (transport.kind === "facetime" && (transport.classifier_version === "tu-provider-v1" || transport.classifierVersion === "tu-provider-v1") && (base.service === 2 || base.service === 3) && base.providerClassified === true && base.providerIsFaceTime === true && base.providerIsTelephony === false && base.isUsingBaseband === false && base.isWifiCall === false && base.isVoip === true && base.isEmergency === false) return {
43
+ kind: "facetime",
44
+ classifierVersion: base.classifierVersion,
45
+ service: base.service,
46
+ ...base.faceTimeTransportType !== void 0 ? { faceTimeTransportType: base.faceTimeTransportType } : {},
47
+ providerClassified: true,
48
+ providerIsFaceTime: true,
49
+ providerIsTelephony: false,
50
+ isUsingBaseband: false,
51
+ isWifiCall: false,
52
+ isVoip: true,
53
+ isEmergency: false
54
+ };
55
+ return {
56
+ kind: transport.kind === "cellular" ? "cellular" : "unknown",
57
+ classifierVersion: base.classifierVersion,
58
+ ...base.service !== void 0 ? { service: base.service } : {},
59
+ ...base.faceTimeTransportType !== void 0 ? { faceTimeTransportType: base.faceTimeTransportType } : {},
60
+ ...base.providerClassified !== void 0 ? { providerClassified: base.providerClassified } : {},
61
+ ...base.providerIsFaceTime !== void 0 ? { providerIsFaceTime: base.providerIsFaceTime } : {},
62
+ ...base.providerIsTelephony !== void 0 ? { providerIsTelephony: base.providerIsTelephony } : {},
63
+ ...base.isUsingBaseband !== void 0 ? { isUsingBaseband: base.isUsingBaseband } : {},
64
+ ...base.isWifiCall !== void 0 ? { isWifiCall: base.isWifiCall } : {},
65
+ ...base.isVoip !== void 0 ? { isVoip: base.isVoip } : {},
66
+ ...base.isEmergency !== void 0 ? { isEmergency: base.isEmergency } : {}
67
+ };
68
+ }
69
+ const handleValueKeys = /* @__PURE__ */ new Set([
70
+ "address",
71
+ "email",
72
+ "emailAddress",
73
+ "handle",
74
+ "normalizedValue",
75
+ "phoneNumber",
76
+ "unformattedPhoneNumber",
77
+ "value"
78
+ ]);
79
+ function collectHandleCandidates(value, candidates = [], seen = /* @__PURE__ */ new Set()) {
80
+ const direct = normalizeOptionalString(value);
81
+ if (direct) {
82
+ candidates.push(direct);
83
+ return candidates;
84
+ }
85
+ if (!value || typeof value !== "object" || seen.has(value)) return candidates;
86
+ seen.add(value);
87
+ const record = asRecord(value);
88
+ for (const [key, nested] of Object.entries(record)) if (handleValueKeys.has(key)) collectHandleCandidates(nested, candidates, seen);
89
+ else if (nested && typeof nested === "object") collectHandleCandidates(nested, candidates, seen);
90
+ return candidates;
91
+ }
92
+ function normalizeFaceTimeHandleCandidates(value) {
93
+ return [...new Set(collectHandleCandidates(value).map((candidate) => candidate.trim()))];
94
+ }
95
+ function normalizeFaceTimeHandle(value) {
96
+ return normalizeFaceTimeHandleCandidates(value)[0];
97
+ }
98
+ function canonicalizeFaceTimeHandle(value) {
99
+ const stripped = value.trim().toLowerCase().replace(/^mailto:/, "").replace(/^tel:/, "").replace(/^facetime-audio:/, "").replace(/^facetime:/, "");
100
+ return stripped.includes("@") ? stripped : stripped.replace(/[^\d+]/g, "");
101
+ }
102
+ function normalizeFaceTimeCallEvent(value) {
103
+ const record = asRecord(value);
104
+ if (record.event !== "ft-call-status-changed") return;
105
+ const data = asRecord(record.data);
106
+ const callUUID = normalizeOptionalString(data.call_uuid);
107
+ const proxyIdentifier = normalizeOptionalString(data.proxy_identifier);
108
+ const conversationUUID = normalizeOptionalString(data.conversation_uuid);
109
+ const conversationGroupUUID = normalizeOptionalString(data.conversation_group_uuid);
110
+ const conversationAVMode = typeof data.conversation_av_mode === "number" ? data.conversation_av_mode : typeof data.conversation_av_mode === "string" ? Number(data.conversation_av_mode) : void 0;
111
+ const conversationResolvedAVMode = typeof data.conversation_resolved_audio_video_mode === "number" ? data.conversation_resolved_audio_video_mode : typeof data.conversation_resolved_audio_video_mode === "string" ? Number(data.conversation_resolved_audio_video_mode) : void 0;
112
+ const status = typeof data.call_status === "number" ? data.call_status : typeof data.call_status === "string" ? Number(data.call_status) : void 0;
113
+ if (!callUUID || !Number.isInteger(status)) return;
114
+ return {
115
+ event: "ft-call-status-changed",
116
+ data: {
117
+ ...data,
118
+ call_uuid: callUUID,
119
+ proxy_identifier: proxyIdentifier,
120
+ call_status: status,
121
+ conversation_uuid: conversationUUID,
122
+ conversation_group_uuid: conversationGroupUUID,
123
+ conversation_audio_enabled: data.conversation_audio_enabled === true,
124
+ conversation_video_enabled: data.conversation_video_enabled === true,
125
+ conversation_av_mode: Number.isInteger(conversationAVMode) ? conversationAVMode : void 0,
126
+ conversation_resolved_audio_video_mode: Number.isInteger(conversationResolvedAVMode) ? conversationResolvedAVMode : void 0,
127
+ is_outgoing: data.is_outgoing === true,
128
+ has_ended: data.has_ended === true,
129
+ is_sending_audio: data.is_sending_audio === true,
130
+ is_sending_transmission: data.is_sending_transmission === true,
131
+ is_sending_video: data.is_sending_video === true,
132
+ is_uplink_muted: data.is_uplink_muted === true,
133
+ local_meter_level: readFiniteNumber(data.local_meter_level),
134
+ remote_meter_level: readFiniteNumber(data.remote_meter_level),
135
+ transport: normalizeCallTransport(data.transport)
136
+ }
137
+ };
138
+ }
139
+ function resolveAuthorizedFaceTimeOwner(params) {
140
+ if (!isVerifiedFaceTimeTransport(params.event)) return;
141
+ const ownerHandles = new Set(params.ownerHandles.map(canonicalizeFaceTimeHandle).filter(Boolean));
142
+ const senderId = normalizeFaceTimeHandleCandidates(params.event.data.handle).map(canonicalizeFaceTimeHandle).find((candidate) => ownerHandles.has(candidate));
143
+ if (!senderId) return;
144
+ return {
145
+ senderId,
146
+ senderIsOwner: true
147
+ };
148
+ }
149
+ function isVerifiedFaceTimeTransport(event) {
150
+ return isVerifiedFaceTimeTransportEvidence(event.data.transport);
151
+ }
152
+ function isVerifiedFaceTimeTransportEvidence(value) {
153
+ return normalizeCallTransport(value).kind === "facetime";
154
+ }
155
+ function isAuthorizedFaceTimeHandle(params) {
156
+ const canonicalHandle = canonicalizeFaceTimeHandle(params.handle);
157
+ return canonicalHandle.length > 0 && params.ownerHandles.some((entry) => canonicalizeFaceTimeHandle(entry) === canonicalHandle);
158
+ }
159
+ function isIncomingRingingCall(event) {
160
+ return event.data.call_status === TU_CALL_STATUS.incomingRinging && event.data.is_outgoing !== true;
161
+ }
162
+ function isActiveCall(event) {
163
+ return event.data.call_status === TU_CALL_STATUS.active;
164
+ }
165
+ function isOutgoingRingingCall(event) {
166
+ return (event.data.call_status === TU_CALL_STATUS.outgoingCreated || event.data.call_status === TU_CALL_STATUS.outgoingRinging) && event.data.is_outgoing === true;
167
+ }
168
+ function isEndedCall(event) {
169
+ return event.data.has_ended === true;
170
+ }
171
+ function isUnknownCallStatus(event) {
172
+ return !isIncomingRingingCall(event) && !isOutgoingRingingCall(event) && !isActiveCall(event) && !isEndedCall(event);
173
+ }
174
+ //#endregion
175
+ //#region extensions/facetime/src/call-lifecycle.ts
176
+ function normalizeCallIdentity(value) {
177
+ return value.trim().toLowerCase();
178
+ }
179
+ var FaceTimeCallInstance = class {
180
+ #carrierClosure;
181
+ #commandTail;
182
+ constructor(canonicalId, phase) {
183
+ this.canonicalId = canonicalId;
184
+ this.lifecycleAbort = new AbortController();
185
+ this.aliases = /* @__PURE__ */ new Set();
186
+ this.generation = 1;
187
+ this.modelMediaMode = "starting";
188
+ this.#carrierClosure = createDeferred();
189
+ this.carrierClosure = this.#carrierClosure.promise;
190
+ this.#commandTail = Promise.resolve();
191
+ this.phase = phase;
192
+ this.carrierMode = phase === "ringing" ? "ringing" : "muted";
193
+ this.aliases.add(normalizeCallIdentity(canonicalId));
194
+ }
195
+ get identity() {
196
+ return {
197
+ canonical: this.canonicalId,
198
+ aliases: this.aliases
199
+ };
200
+ }
201
+ captureGeneration() {
202
+ return this.generation;
203
+ }
204
+ assertCurrent(generation, allowClosing = false) {
205
+ const phaseAllowed = allowClosing ? this.phase !== "closed" && this.carrierMode !== "closed" : this.phase !== "closing" && this.phase !== "closed";
206
+ if (generation !== this.generation || !phaseAllowed || !allowClosing && this.lifecycleAbort.signal.aborted) throw new Error("FaceTime call lifecycle changed during carrier command");
207
+ }
208
+ async runCarrierCommand(params) {
209
+ const previous = this.#commandTail;
210
+ let release = () => {};
211
+ this.#commandTail = new Promise((resolve) => {
212
+ release = resolve;
213
+ });
214
+ await previous;
215
+ try {
216
+ this.assertCurrent(params.generation, params.allowClosing);
217
+ const result = await params.action();
218
+ this.assertCurrent(params.generation, params.allowClosing);
219
+ return result;
220
+ } finally {
221
+ release();
222
+ }
223
+ }
224
+ beginAnswering() {
225
+ if (this.phase !== "ringing") throw new Error(`cannot answer FaceTime call in ${this.phase} phase`);
226
+ this.phase = "answering";
227
+ this.carrierMode = "muted";
228
+ return this.generation;
229
+ }
230
+ markCarrierActive(generation) {
231
+ this.assertCurrent(generation);
232
+ this.phase = "active";
233
+ this.carrierMode = "active";
234
+ }
235
+ markModelReady(generation) {
236
+ this.assertCurrent(generation);
237
+ this.modelMediaMode = "ready";
238
+ }
239
+ markModelActive(generation) {
240
+ this.assertCurrent(generation);
241
+ this.modelMediaMode = "active";
242
+ }
243
+ suspendModelMedia() {
244
+ if (this.modelMediaMode !== "closed") this.modelMediaMode = "suspended";
245
+ }
246
+ beginClosing() {
247
+ if (this.phase === "closed") return this.generation;
248
+ if (this.phase !== "closing") {
249
+ this.generation += 1;
250
+ this.phase = "closing";
251
+ this.carrierMode = "closing";
252
+ this.suspendModelMedia();
253
+ this.lifecycleAbort.abort(/* @__PURE__ */ new Error("FaceTime call is closing"));
254
+ }
255
+ return this.generation;
256
+ }
257
+ markCarrierClosed() {
258
+ this.beginClosing();
259
+ this.carrierMode = "closed";
260
+ this.#carrierClosure.resolve(void 0);
261
+ }
262
+ markClosed() {
263
+ this.phase = "closed";
264
+ this.carrierMode = "closed";
265
+ this.modelMediaMode = "closed";
266
+ }
267
+ };
268
+ var FaceTimeCallRegistry = class {
269
+ #active;
270
+ #aliases = /* @__PURE__ */ new Map();
271
+ get active() {
272
+ return this.#active;
273
+ }
274
+ get size() {
275
+ return this.#active && this.#active.phase !== "closed" ? 1 : 0;
276
+ }
277
+ values() {
278
+ return (this.#active && this.#active.phase !== "closed" ? [this.#active] : [])[Symbol.iterator]();
279
+ }
280
+ get(identity) {
281
+ return this.resolve(identity);
282
+ }
283
+ has(identity) {
284
+ return this.resolve(identity) !== void 0;
285
+ }
286
+ create(call) {
287
+ if (this.#active && this.#active.phase !== "closed") throw new Error("another FaceTime call lifecycle is already active");
288
+ this.#active = call;
289
+ for (const alias of call.aliases) this.#aliases.set(alias, call);
290
+ }
291
+ resolve(identity) {
292
+ return this.#aliases.get(normalizeCallIdentity(identity));
293
+ }
294
+ retainAlias(call, identity) {
295
+ if (this.#active !== call || call.phase === "closed") throw new Error("cannot retain an alias for an inactive FaceTime call");
296
+ const alias = normalizeCallIdentity(identity);
297
+ const existing = this.#aliases.get(alias);
298
+ if (existing && existing !== call) throw new Error("FaceTime call alias already belongs to another lifecycle");
299
+ call.aliases.add(alias);
300
+ this.#aliases.set(alias, call);
301
+ }
302
+ close(call) {
303
+ if (this.#active !== call) return;
304
+ call.markClosed();
305
+ for (const alias of call.aliases) if (this.#aliases.get(alias) === call) this.#aliases.delete(alias);
306
+ this.#active = void 0;
307
+ }
308
+ };
309
+ //#endregion
310
+ //#region extensions/facetime/helper-endpoint.json
311
+ var host = "127.0.0.1";
312
+ var basePort = 45670;
313
+ var maxPort = 65535;
314
+ //#endregion
315
+ //#region extensions/facetime/src/helper-endpoint.ts
316
+ function resolveFaceTimeHelperEndpoint(uid = typeof process.getuid === "function" ? process.getuid() : 501) {
317
+ if (host !== "127.0.0.1" || !Number.isSafeInteger(basePort) || !Number.isSafeInteger(maxPort) || basePort < 1024 || maxPort > 65535 || basePort > maxPort || !Number.isSafeInteger(uid)) throw new Error("Invalid FaceTime loopback helper endpoint contract");
318
+ return {
319
+ host,
320
+ port: Math.min(Math.max(basePort + uid - 501, basePort), maxPort)
321
+ };
322
+ }
323
+ //#endregion
324
+ //#region extensions/facetime/src/helper-results.ts
325
+ var FaceTimeHelperActionError = class extends Error {
326
+ constructor(message) {
327
+ super(message);
328
+ this.name = "FaceTimeHelperActionError";
329
+ }
330
+ };
331
+ var FaceTimeHelperAmbiguousError = class extends Error {
332
+ constructor(message, result = {}) {
333
+ super(message);
334
+ this.result = result;
335
+ this.name = "FaceTimeHelperAmbiguousError";
336
+ }
337
+ };
338
+ var FaceTimeHelperUnavailableError = class extends Error {
339
+ constructor(message) {
340
+ super(message);
341
+ this.name = "FaceTimeHelperUnavailableError";
342
+ }
343
+ };
344
+ function readHelperResults(result) {
345
+ return Array.isArray(result.helperResults) ? result.helperResults.filter((entry) => Boolean(entry && typeof entry === "object")) : [result];
346
+ }
347
+ function requireCompleteTopology(result) {
348
+ const results = readHelperResults(result);
349
+ if (result.topologyComplete !== true || typeof result.helpersContacted !== "number" || results.length !== result.helpersContacted) throw new FaceTimeHelperAmbiguousError("FaceTime helper topology was incomplete", result);
350
+ return results;
351
+ }
352
+ function projectFaceTimeNativeAction(action, result) {
353
+ const present = requireCompleteTopology(result).filter((entry) => entry.outcome !== "absent");
354
+ if (present.length === 0) throw new FaceTimeHelperAmbiguousError(`FaceTime ${action} carrier owner is missing`, result);
355
+ if (action === "unmute" && present.every((observed) => observed.muted === false && observed.is_uplink_muted === false && typeof observed.conversation_audio_error !== "string")) return { status: "media-active" };
356
+ if (action === "answer" && present.every((observed) => observed.outcome === "answered-muted" && observed.muted === true && observed.is_uplink_muted === true)) return { status: "answered-muted" };
357
+ if (action === "safe-mute" && present.every((observed) => observed.downlink_muted === true && observed.muted === true && observed.is_uplink_muted === true)) return { status: "safe-muted" };
358
+ if (action === "activate" && present.every((observed) => observed.muted === false && observed.is_uplink_muted === false && observed.is_sending_audio === true && observed.is_sending_transmission === true && typeof observed.conversation_audio_error !== "string")) return { status: "media-active" };
359
+ if (action === "terminate" && present.every((observed) => observed.outcome === "termination-requested")) return { status: "termination-requested" };
360
+ throw new FaceTimeHelperActionError(`FaceTime ${action} postcondition was not observed`);
361
+ }
362
+ function projectCompleteFaceTimeAbsence(result) {
363
+ if (!requireCompleteTopology(result).every((entry) => entry.outcome === "absent" && entry.found === false)) throw new FaceTimeHelperAmbiguousError("FaceTime carrier is still present", result);
364
+ if (typeof result.topologyGeneration !== "number") throw new FaceTimeHelperAmbiguousError("FaceTime topology generation is missing", result);
365
+ return {
366
+ status: "absent",
367
+ topologyGeneration: result.topologyGeneration
368
+ };
369
+ }
370
+ //#endregion
371
+ //#region extensions/facetime/src/helper-rpc.ts
372
+ const FACETIME_DIAL_HELPER_BUNDLES = /* @__PURE__ */ new Set(["com.apple.FaceTime", "com.apple.FaceTime.FTConversationService"]);
373
+ const FACETIME_HELPER_BUNDLES = /* @__PURE__ */ new Set([
374
+ ...FACETIME_DIAL_HELPER_BUNDLES,
375
+ "com.apple.mobilephone",
376
+ "com.apple.TelephonyUtilities"
377
+ ]);
378
+ const MAX_FRAME_BYTES = 65536;
379
+ const MAX_CONNECTIONS = 8;
380
+ const MAX_PENDING_ACTIONS = 32;
381
+ const AUTH_DEADLINE_MS = 3e3;
382
+ function helperHmac(ipcKey, message) {
383
+ return createHmac("sha256", ipcKey).update(message).digest("hex");
384
+ }
385
+ function secureStringsEqual(first, second) {
386
+ const firstBuffer = Buffer.from(first);
387
+ const secondBuffer = Buffer.from(second);
388
+ return firstBuffer.length > 0 && firstBuffer.length === secondBuffer.length && timingSafeEqual(firstBuffer, secondBuffer);
389
+ }
390
+ function hasExactKeys(record, keys) {
391
+ const actual = Object.keys(record).toSorted();
392
+ const expected = [...keys].toSorted();
393
+ return actual.length === expected.length && actual.every((key, index) => key === expected[index]);
394
+ }
395
+ var FaceTimeHelperSocketServer = class {
396
+ #server;
397
+ #sockets = /* @__PURE__ */ new Set();
398
+ #socketPeers = /* @__PURE__ */ new Map();
399
+ #pendingHandshakes = /* @__PURE__ */ new Map();
400
+ #socketAuthSessions = /* @__PURE__ */ new Map();
401
+ #authDeadlineTimers = /* @__PURE__ */ new Map();
402
+ #pending = /* @__PURE__ */ new Map();
403
+ #logger;
404
+ #started = false;
405
+ #connectionGeneration = 0;
406
+ constructor(params) {
407
+ this.params = params;
408
+ this.#logger = params.logger;
409
+ this.#server = net.createServer((socket) => this.#handleSocket(socket));
410
+ }
411
+ async start() {
412
+ if (this.#started) return;
413
+ await new Promise((resolve, reject) => {
414
+ const onError = (error) => {
415
+ this.#server.off("listening", onListening);
416
+ reject(error);
417
+ };
418
+ const onListening = () => {
419
+ this.#server.off("error", onError);
420
+ this.#started = true;
421
+ resolve();
422
+ };
423
+ this.#server.once("error", onError);
424
+ this.#server.once("listening", onListening);
425
+ this.#server.listen(this.params.port, this.params.host);
426
+ });
427
+ }
428
+ async stop() {
429
+ for (const pending of this.#pending.values()) {
430
+ clearTimeout(pending.timeout);
431
+ pending.reject(/* @__PURE__ */ new Error("helper socket server stopped"));
432
+ }
433
+ this.#pending.clear();
434
+ for (const socket of this.#sockets) socket.destroy();
435
+ this.#sockets.clear();
436
+ for (const deadline of this.#authDeadlineTimers.values()) clearTimeout(deadline);
437
+ this.#authDeadlineTimers.clear();
438
+ if (!this.#started) return;
439
+ await new Promise((resolve) => {
440
+ this.#server.close(() => resolve());
441
+ });
442
+ this.#started = false;
443
+ }
444
+ async answerCall(callUUID) {
445
+ return await this.#sendActionToAll("answer-call", { callUUID });
446
+ }
447
+ async startCall(request, dialID, requestedAt) {
448
+ return await this.#sendAction("start-call", {
449
+ ...request,
450
+ dialID,
451
+ requestedAt
452
+ });
453
+ }
454
+ async findOutgoingCall(handle, callUUID, dialID, proxyIdentifier, requestedAt, mode) {
455
+ return await this.#sendActionToAll("find-outgoing-call", {
456
+ handle,
457
+ ...callUUID ? { callUUID } : {},
458
+ ...dialID ? { dialID } : {},
459
+ ...proxyIdentifier ? { proxyIdentifier } : {},
460
+ ...requestedAt ? { requestedAt } : {},
461
+ ...mode ? { mode } : {}
462
+ });
463
+ }
464
+ async cancelOutgoingCall(params) {
465
+ return await this.#sendActionToAll("cancel-outgoing-call", params);
466
+ }
467
+ async leaveCall(callUUID) {
468
+ return await this.#sendActionToAll("leave-call", { callUUID }, 750);
469
+ }
470
+ async safetyMute(callUUID) {
471
+ return await this.#sendActionToAll("safety-mute", { callUUID }, 750);
472
+ }
473
+ async setMuted(callUUID, muted) {
474
+ return await this.#sendActionToAll("set-muted", {
475
+ callUUID,
476
+ muted
477
+ });
478
+ }
479
+ async startTransmission(callUUID) {
480
+ return await this.#sendActionToAll("start-transmission", { callUUID });
481
+ }
482
+ async inspectCall(callUUIDs, requiredPeerProcessIds = []) {
483
+ return await this.#sendActionToAll("inspect-call", { callUUIDs }, 750, requiredPeerProcessIds);
484
+ }
485
+ get connectedSockets() {
486
+ return this.#socketPeers.size;
487
+ }
488
+ get connectedHelperBundles() {
489
+ return [...new Set([...this.#socketPeers.values()].map((peer) => peer.bundleIdentifier))];
490
+ }
491
+ #handleSocket(socket) {
492
+ if (this.#sockets.size >= MAX_CONNECTIONS) {
493
+ socket.destroy();
494
+ return;
495
+ }
496
+ this.#sockets.add(socket);
497
+ socket.setEncoding("utf8");
498
+ const authDeadline = setTimeout(() => {
499
+ if (!this.#socketPeers.has(socket)) socket.destroy();
500
+ }, AUTH_DEADLINE_MS);
501
+ authDeadline.unref?.();
502
+ this.#authDeadlineTimers.set(socket, authDeadline);
503
+ let buffer = "";
504
+ socket.on("data", (chunk) => {
505
+ buffer += typeof chunk === "string" ? chunk : chunk.toString("utf8");
506
+ while (true) {
507
+ const newline = buffer.search(/\r?\n/);
508
+ if (newline < 0) {
509
+ if (Buffer.byteLength(buffer) > MAX_FRAME_BYTES) socket.destroy();
510
+ break;
511
+ }
512
+ if (Buffer.byteLength(buffer.slice(0, newline)) > MAX_FRAME_BYTES) {
513
+ socket.destroy();
514
+ return;
515
+ }
516
+ const line = buffer.slice(0, newline).trim();
517
+ buffer = buffer.slice(buffer[newline] === "\r" ? newline + 2 : newline + 1);
518
+ if (line) this.#handleLine(socket, line);
519
+ }
520
+ });
521
+ socket.on("error", (error) => {
522
+ this.#logger.debug?.(`[facetime] helper socket error: ${formatErrorMessage(error)}`);
523
+ });
524
+ socket.on("close", () => {
525
+ const disconnectedBundle = this.#socketPeers.get(socket)?.bundleIdentifier;
526
+ if (disconnectedBundle) this.#connectionGeneration += 1;
527
+ this.#sockets.delete(socket);
528
+ this.#socketPeers.delete(socket);
529
+ this.#pendingHandshakes.delete(socket);
530
+ this.#socketAuthSessions.delete(socket);
531
+ const deadline = this.#authDeadlineTimers.get(socket);
532
+ if (deadline) {
533
+ clearTimeout(deadline);
534
+ this.#authDeadlineTimers.delete(socket);
535
+ }
536
+ if (disconnectedBundle) this.params.onDisconnect?.(disconnectedBundle);
537
+ });
538
+ }
539
+ #handleLine(socket, line) {
540
+ let parsed;
541
+ try {
542
+ parsed = JSON.parse(line);
543
+ } catch (error) {
544
+ this.#logger.debug?.(`[facetime] rejected invalid helper JSON: ${formatErrorMessage(error)}`);
545
+ socket.destroy();
546
+ return;
547
+ }
548
+ const record = asRecord(parsed);
549
+ if (record.event === "client-hello") {
550
+ this.#handleClientHello(socket, record);
551
+ return;
552
+ }
553
+ if (record.event === "client-finish") {
554
+ this.#handleClientFinish(socket, record);
555
+ return;
556
+ }
557
+ const payload = this.#consumeHelperEnvelope(socket, record);
558
+ if (!payload) {
559
+ this.#logger.warn?.("[facetime] rejected unauthenticated or replayed helper message");
560
+ socket.destroy();
561
+ return;
562
+ }
563
+ if (!this.#socketPeers.has(socket)) {
564
+ if (hasExactKeys(payload, ["event"]) && payload.event === "session-ready-ack") {
565
+ this.#admitAuthenticatedHelper(socket);
566
+ return;
567
+ }
568
+ socket.destroy();
569
+ return;
570
+ }
571
+ const transactionId = typeof payload.transactionId === "string" ? payload.transactionId : "";
572
+ if (transactionId && this.#pending.has(transactionId)) {
573
+ const pending = this.#pending.get(transactionId);
574
+ this.#pending.delete(transactionId);
575
+ if (pending) {
576
+ clearTimeout(pending.timeout);
577
+ if (typeof payload.error === "string" && payload.error) pending.reject(payload.ambiguous === true ? new FaceTimeHelperAmbiguousError(payload.error, payload) : new FaceTimeHelperActionError(payload.error));
578
+ else pending.resolve(payload);
579
+ }
580
+ return;
581
+ }
582
+ const peer = this.#socketPeers.get(socket);
583
+ if (peer) this.params.onMessage(payload, peer);
584
+ }
585
+ #handleClientHello(socket, record) {
586
+ if (this.#pendingHandshakes.has(socket) || this.#socketAuthSessions.has(socket) || !hasExactKeys(record, [
587
+ "event",
588
+ "bundle_identifier",
589
+ "build_id",
590
+ "process_id",
591
+ "process_started_at_ms",
592
+ "client_nonce",
593
+ "proof"
594
+ ])) {
595
+ socket.destroy();
596
+ return;
597
+ }
598
+ const bundleIdentifier = typeof record.bundle_identifier === "string" ? record.bundle_identifier.trim() : "";
599
+ const buildId = typeof record.build_id === "string" ? record.build_id.trim() : "";
600
+ const processId = typeof record.process_id === "number" && Number.isSafeInteger(record.process_id) ? record.process_id : 0;
601
+ const processStartedAtMs = typeof record.process_started_at_ms === "number" && Number.isSafeInteger(record.process_started_at_ms) ? record.process_started_at_ms : 0;
602
+ const clientNonce = typeof record.client_nonce === "string" ? record.client_nonce : "";
603
+ const proof = typeof record.proof === "string" ? record.proof : "";
604
+ const expectedProof = helperHmac(this.params.ipcKey, `client-hello\n${bundleIdentifier}\n${buildId}\n${processId}\n${processStartedAtMs}\n${clientNonce}`);
605
+ if (!FACETIME_HELPER_BUNDLES.has(bundleIdentifier) || processId <= 0 || processStartedAtMs <= 0 || clientNonce.length < 32 || !secureStringsEqual(proof, expectedProof)) {
606
+ socket.destroy();
607
+ return;
608
+ }
609
+ if (buildId !== this.params.buildId) {
610
+ this.params.onStale?.(bundleIdentifier, processId);
611
+ socket.destroy();
612
+ return;
613
+ }
614
+ const serverNonce = randomUUID();
615
+ const connectionEpoch = randomUUID();
616
+ const context = `${bundleIdentifier}\n${buildId}\n${processId}\n${processStartedAtMs}\n${clientNonce}\n${serverNonce}\n${connectionEpoch}`;
617
+ const handshake = {
618
+ bundleIdentifier,
619
+ processId,
620
+ processStartedAtMs,
621
+ clientNonce,
622
+ serverNonce,
623
+ connectionEpoch,
624
+ connectionKey: helperHmac(this.params.ipcKey, `session\n${context}`)
625
+ };
626
+ this.#pendingHandshakes.set(socket, handshake);
627
+ socket.write(`${JSON.stringify({
628
+ event: "server-hello",
629
+ client_nonce: clientNonce,
630
+ server_nonce: serverNonce,
631
+ connection_epoch: connectionEpoch,
632
+ proof: helperHmac(this.params.ipcKey, `server-hello\n${context}`)
633
+ })}\r\n`);
634
+ }
635
+ #handleClientFinish(socket, record) {
636
+ const handshake = this.#pendingHandshakes.get(socket);
637
+ if (!handshake || !hasExactKeys(record, [
638
+ "event",
639
+ "connection_epoch",
640
+ "proof"
641
+ ]) || record.connection_epoch !== handshake.connectionEpoch || typeof record.proof !== "string" || !secureStringsEqual(record.proof, helperHmac(handshake.connectionKey, `client-finish\n${handshake.connectionEpoch}`))) {
642
+ socket.destroy();
643
+ return;
644
+ }
645
+ this.#pendingHandshakes.delete(socket);
646
+ this.#socketAuthSessions.set(socket, {
647
+ ...handshake,
648
+ incomingSequence: 0,
649
+ outgoingSequence: 0
650
+ });
651
+ this.#writeServerPayload(socket, { event: "session-ready" });
652
+ }
653
+ #admitAuthenticatedHelper(socket) {
654
+ const session = this.#socketAuthSessions.get(socket);
655
+ if (!session) {
656
+ socket.destroy();
657
+ return;
658
+ }
659
+ this.#socketPeers.set(socket, {
660
+ bundleIdentifier: session.bundleIdentifier,
661
+ processId: session.processId,
662
+ processStartedAtMs: session.processStartedAtMs,
663
+ connectionGeneration: ++this.#connectionGeneration
664
+ });
665
+ const deadline = this.#authDeadlineTimers.get(socket);
666
+ if (deadline) {
667
+ clearTimeout(deadline);
668
+ this.#authDeadlineTimers.delete(socket);
669
+ }
670
+ this.params.onConnect?.(session.bundleIdentifier);
671
+ }
672
+ #consumeHelperEnvelope(socket, record) {
673
+ const session = this.#socketAuthSessions.get(socket);
674
+ if (!session || !hasExactKeys(record, [
675
+ "connection_epoch",
676
+ "sequence",
677
+ "direction",
678
+ "payload_json",
679
+ "auth"
680
+ ]) || record.connection_epoch !== session.connectionEpoch || record.direction !== "helper-to-server" || typeof record.sequence !== "number" || !Number.isSafeInteger(record.sequence) || record.sequence !== session.incomingSequence + 1 || typeof record.payload_json !== "string" || typeof record.auth !== "string") return;
681
+ const expectedAuth = helperHmac(session.connectionKey, `message\nhelper-to-server\n${session.connectionEpoch}\n${record.sequence}\n${record.payload_json}`);
682
+ if (!secureStringsEqual(record.auth, expectedAuth)) return;
683
+ let payload;
684
+ try {
685
+ payload = JSON.parse(record.payload_json);
686
+ } catch {
687
+ return;
688
+ }
689
+ const payloadRecord = asRecord(payload);
690
+ if (Object.keys(payloadRecord).length === 0) return;
691
+ session.incomingSequence = record.sequence;
692
+ return payloadRecord;
693
+ }
694
+ #writeServerPayload(socket, payload) {
695
+ const session = this.#socketAuthSessions.get(socket);
696
+ if (!session) throw new FaceTimeHelperUnavailableError("FaceTime helper socket is not authenticated");
697
+ const payloadJson = JSON.stringify(payload);
698
+ const sequence = session.outgoingSequence + 1;
699
+ const envelope = JSON.stringify({
700
+ connection_epoch: session.connectionEpoch,
701
+ sequence,
702
+ direction: "server-to-helper",
703
+ payload_json: payloadJson,
704
+ auth: helperHmac(session.connectionKey, `message\nserver-to-helper\n${session.connectionEpoch}\n${sequence}\n${payloadJson}`)
705
+ });
706
+ if (Buffer.byteLength(envelope) > MAX_FRAME_BYTES) throw new FaceTimeHelperActionError("FaceTime helper message exceeds the frame limit");
707
+ session.outgoingSequence = sequence;
708
+ socket.write(`${envelope}\r\n`);
709
+ return envelope;
710
+ }
711
+ async #sendAction(action, data) {
712
+ const socket = [...this.#sockets].find((candidate) => !candidate.destroyed && FACETIME_DIAL_HELPER_BUNDLES.has(this.#socketPeers.get(candidate)?.bundleIdentifier ?? ""));
713
+ if (!socket) throw new FaceTimeHelperUnavailableError("Authenticated FaceTime dialing helper is not connected to the facetime event socket");
714
+ return {
715
+ ...await this.#sendActionOnSocket(socket, action, data),
716
+ helperBundleIdentifier: this.#socketPeers.get(socket)?.bundleIdentifier ?? "unknown",
717
+ helperPeer: this.#socketPeers.get(socket)
718
+ };
719
+ }
720
+ async #sendActionToAll(action, data, timeoutMs = 5e3, requiredPeerProcessIds = []) {
721
+ const sockets = [...this.#sockets].filter((candidate) => !candidate.destroyed && FACETIME_HELPER_BUNDLES.has(this.#socketPeers.get(candidate)?.bundleIdentifier ?? ""));
722
+ if (sockets.length === 0) throw new FaceTimeHelperUnavailableError("FaceTime helper is not connected to the facetime event socket");
723
+ const peers = sockets.map((socket) => this.#socketPeers.get(socket));
724
+ const results = await Promise.allSettled(sockets.map((socket) => this.#sendActionOnSocket(socket, action, data, timeoutMs)));
725
+ const fulfilled = results.flatMap((result, index) => result.status === "fulfilled" && sockets[index] ? [{
726
+ ...result.value,
727
+ helperBundleIdentifier: peers[index]?.bundleIdentifier ?? "unknown",
728
+ helperPeer: peers[index]
729
+ }] : []);
730
+ if (fulfilled.length > 0) {
731
+ const fulfilledProcessIds = new Set(fulfilled.flatMap((result) => {
732
+ const peer = result.helperPeer;
733
+ return peer && typeof peer === "object" && "processId" in peer ? [peer.processId] : [];
734
+ }));
735
+ return {
736
+ helpersContacted: sockets.length,
737
+ topologyGeneration: this.#connectionGeneration,
738
+ topologyComplete: fulfilled.length === sockets.length && requiredPeerProcessIds.every((processId) => fulfilledProcessIds.has(processId)),
739
+ helperResults: fulfilled,
740
+ ...fulfilled[fulfilled.length - 1]
741
+ };
742
+ }
743
+ const firstRejected = results.find((result) => result.status === "rejected");
744
+ throw firstRejected?.reason instanceof Error ? firstRejected.reason : /* @__PURE__ */ new Error(`FaceTime helper action failed: ${action}`);
745
+ }
746
+ async #sendActionOnSocket(socket, action, data, timeoutMs = 5e3) {
747
+ if (this.#pending.size >= MAX_PENDING_ACTIONS) throw new FaceTimeHelperUnavailableError("FaceTime helper action queue is full");
748
+ const transactionId = randomUUID();
749
+ if (!this.#socketAuthSessions.has(socket)) throw new FaceTimeHelperUnavailableError("FaceTime helper socket is not authenticated");
750
+ return await new Promise((resolve, reject) => {
751
+ const timeout = setTimeout(() => {
752
+ this.#pending.delete(transactionId);
753
+ reject(/* @__PURE__ */ new Error(`FaceTime helper action timed out: ${action}`));
754
+ }, timeoutMs);
755
+ this.#pending.set(transactionId, {
756
+ resolve,
757
+ reject,
758
+ timeout
759
+ });
760
+ try {
761
+ this.#writeServerPayload(socket, {
762
+ action,
763
+ transactionId,
764
+ data
765
+ });
766
+ } catch (error) {
767
+ clearTimeout(timeout);
768
+ this.#pending.delete(transactionId);
769
+ reject(error instanceof Error ? error : new Error(String(error)));
770
+ }
771
+ });
772
+ }
773
+ };
774
+ //#endregion
775
+ //#region extensions/facetime/src/helper-supervisor.ts
776
+ const TARGET_BUNDLES = {
777
+ FaceTime: /* @__PURE__ */ new Set(["com.apple.FaceTime", "com.apple.FaceTime.FTConversationService"]),
778
+ Phone: /* @__PURE__ */ new Set(["com.apple.mobilephone", "com.apple.TelephonyUtilities"])
779
+ };
780
+ const TARGET_APP_PATHS = {
781
+ FaceTime: "/System/Applications/FaceTime.app",
782
+ Phone: "/System/Applications/Phone.app"
783
+ };
784
+ const TARGET_EXECUTABLES = {
785
+ FaceTime: "/System/Applications/FaceTime.app/Contents/MacOS/FaceTime",
786
+ Phone: "/System/Applications/Phone.app/Contents/MacOS/Phone"
787
+ };
788
+ const FACETIME_HELPER_TARGETS = ["FaceTime", "Phone"];
789
+ const DEFAULT_RETRY_DELAYS_MS = [
790
+ 1e3,
791
+ 2e3,
792
+ 5e3,
793
+ 1e4,
794
+ 3e4,
795
+ 6e4
796
+ ];
797
+ function targetForBundle(bundleIdentifier) {
798
+ return FACETIME_HELPER_TARGETS.find((target) => TARGET_BUNDLES[target].has(bundleIdentifier));
799
+ }
800
+ var FaceTimeHelperSupervisor = class {
801
+ #states;
802
+ #timers = /* @__PURE__ */ new Map();
803
+ #retryDelaysMs;
804
+ #injectionChain = Promise.resolve();
805
+ #started = false;
806
+ #generation = 0;
807
+ #abortController = new AbortController();
808
+ constructor(params) {
809
+ this.params = params;
810
+ this.#retryDelaysMs = params.retryDelaysMs && params.retryDelaysMs.length > 0 ? params.retryDelaysMs : DEFAULT_RETRY_DELAYS_MS;
811
+ const targetAvailable = params.targetAvailable ?? ((target) => existsSync(TARGET_APP_PATHS[target]));
812
+ this.#states = new Map(FACETIME_HELPER_TARGETS.filter((target) => targetAvailable(target)).map((target) => [target, {
813
+ target,
814
+ connected: false,
815
+ attempts: 0,
816
+ injecting: false,
817
+ queued: false,
818
+ retryScheduled: false,
819
+ stale: false
820
+ }]));
821
+ }
822
+ start() {
823
+ if (this.#started) return;
824
+ this.#started = true;
825
+ this.#generation += 1;
826
+ this.#abortController = new AbortController();
827
+ this.#refreshConnections();
828
+ for (const target of this.#states.keys()) if (!this.#states.get(target)?.connected) this.#schedule(target, this.params.initialGraceMs ?? 6e3);
829
+ }
830
+ async stop() {
831
+ this.#started = false;
832
+ this.#generation += 1;
833
+ this.#abortController.abort(/* @__PURE__ */ new Error("FaceTime helper supervisor stopped"));
834
+ for (const timer of this.#timers.values()) clearTimeout(timer);
835
+ this.#timers.clear();
836
+ await this.#injectionChain;
837
+ }
838
+ connected(bundleIdentifier) {
839
+ const target = targetForBundle(bundleIdentifier);
840
+ if (!target) return;
841
+ this.#refreshConnections();
842
+ const state = this.#states.get(target);
843
+ if (state) {
844
+ state.connected = true;
845
+ state.attempts = 0;
846
+ state.stale = false;
847
+ state.staleProcessId = void 0;
848
+ state.lastError = void 0;
849
+ }
850
+ this.#cancelTimer(target);
851
+ }
852
+ disconnected(bundleIdentifier) {
853
+ const target = targetForBundle(bundleIdentifier);
854
+ if (!target) return;
855
+ this.#refreshConnections();
856
+ if (this.#started && !this.#states.get(target)?.connected) this.#schedule(target, this.#retryDelaysMs[0] ?? 1e3);
857
+ }
858
+ stale(bundleIdentifier, processId) {
859
+ const target = targetForBundle(bundleIdentifier);
860
+ const state = target ? this.#states.get(target) : void 0;
861
+ if (!target || !state) return;
862
+ const staleProcessId = processId > 0 ? processId : void 0;
863
+ const wasStale = state.stale;
864
+ if (state.stale && state.staleProcessId === staleProcessId) return;
865
+ state.connected = false;
866
+ state.stale = true;
867
+ state.staleProcessId = staleProcessId;
868
+ state.lastError = `Restart ${target} to load the updated OpenClaw helper`;
869
+ if (!wasStale) this.params.logger.warn(`[facetime] ${state.lastError}`);
870
+ if (processId > 0) this.#scheduleStaleProcessCheck(target, processId);
871
+ else {
872
+ this.#cancelTimer(target);
873
+ this.#resolveLegacyStaleProcess(target);
874
+ }
875
+ }
876
+ status() {
877
+ this.#refreshConnections();
878
+ return [...this.#states.values()].map((state) => Object.assign({}, state, { retryScheduled: this.#timers.has(state.target) }));
879
+ }
880
+ #refreshConnections() {
881
+ const bundles = new Set(this.params.connectedBundles());
882
+ for (const target of FACETIME_HELPER_TARGETS) {
883
+ const acceptedBundles = TARGET_BUNDLES[target];
884
+ const state = this.#states.get(target);
885
+ if (state) state.connected = [...acceptedBundles].some((bundle) => bundles.has(bundle));
886
+ }
887
+ }
888
+ #cancelTimer(target) {
889
+ const timer = this.#timers.get(target);
890
+ if (timer) {
891
+ clearTimeout(timer);
892
+ this.#timers.delete(target);
893
+ }
894
+ }
895
+ #schedule(target, delayMs) {
896
+ this.#cancelTimer(target);
897
+ const timer = setTimeout(() => {
898
+ this.#timers.delete(target);
899
+ this.#enqueueInjection(target);
900
+ }, delayMs);
901
+ timer.unref?.();
902
+ this.#timers.set(target, timer);
903
+ }
904
+ #scheduleStaleProcessCheck(target, processId) {
905
+ this.#cancelTimer(target);
906
+ const timer = setTimeout(() => {
907
+ this.#timers.delete(target);
908
+ if (!this.#started) return;
909
+ const processAlive = this.params.processAlive ?? ((candidate) => {
910
+ try {
911
+ process.kill(candidate, 0);
912
+ return true;
913
+ } catch (error) {
914
+ if (error && typeof error === "object" && "code" in error) return error.code !== "ESRCH";
915
+ return true;
916
+ }
917
+ });
918
+ const state = this.#states.get(target);
919
+ if (!state?.stale || state.staleProcessId !== processId) return;
920
+ if (processAlive(processId)) {
921
+ this.#scheduleStaleProcessCheck(target, processId);
922
+ return;
923
+ }
924
+ state.stale = false;
925
+ state.staleProcessId = void 0;
926
+ state.attempts = 0;
927
+ state.lastError = void 0;
928
+ this.#schedule(target, 0);
929
+ }, 2e3);
930
+ timer.unref?.();
931
+ this.#timers.set(target, timer);
932
+ }
933
+ async #resolveLegacyStaleProcess(target) {
934
+ const state = this.#states.get(target);
935
+ if (!this.#started || !state?.stale || state.staleProcessId !== void 0) return;
936
+ try {
937
+ const result = await this.params.runCommandWithTimeout([
938
+ "/usr/bin/pgrep",
939
+ "-f",
940
+ TARGET_EXECUTABLES[target]
941
+ ], { timeoutMs: 5e3 });
942
+ const processId = Number.parseInt(result.stdout.trim().split(/\s+/u)[0] ?? "", 10);
943
+ if (result.code === 0 && Number.isSafeInteger(processId) && processId > 0) {
944
+ state.staleProcessId = processId;
945
+ this.#scheduleStaleProcessCheck(target, processId);
946
+ return;
947
+ }
948
+ } catch (error) {
949
+ this.params.logger.debug?.(`[facetime] failed to resolve stale ${target} helper process: ${formatErrorMessage(error)}`);
950
+ }
951
+ if (this.#started && state.stale && state.staleProcessId === void 0) {
952
+ state.stale = false;
953
+ state.lastError = void 0;
954
+ this.#schedule(target, 0);
955
+ }
956
+ }
957
+ #enqueueInjection(target) {
958
+ const state = this.#states.get(target);
959
+ if (!state || state.queued || state.injecting) return;
960
+ state.queued = true;
961
+ const generation = this.#generation;
962
+ const pending = this.#injectionChain.then(async () => {
963
+ state.queued = false;
964
+ if (this.#started && generation === this.#generation) await this.#inject(target, generation);
965
+ });
966
+ this.#injectionChain = pending.catch(() => void 0);
967
+ }
968
+ async #waitForAuthenticatedConnection(target, generation) {
969
+ const deadline = Date.now() + (this.params.connectionGraceMs ?? 1e4);
970
+ while (this.#started && generation === this.#generation && Date.now() < deadline) {
971
+ this.#refreshConnections();
972
+ const state = this.#states.get(target);
973
+ if (!state || state.connected || state.stale) return;
974
+ await sleepWithAbort(250, this.#abortController.signal).catch(() => void 0);
975
+ }
976
+ this.#refreshConnections();
977
+ }
978
+ async #inject(target, generation) {
979
+ if (!this.#started || generation !== this.#generation) return;
980
+ this.#refreshConnections();
981
+ const state = this.#states.get(target);
982
+ if (!state || state.connected || state.injecting || state.stale) return;
983
+ state.injecting = true;
984
+ state.attempts += 1;
985
+ const script = resolve(this.params.pluginRoot, "scripts", "inject-helper.sh");
986
+ try {
987
+ const result = await this.params.runCommandWithTimeout([
988
+ "/bin/bash",
989
+ script,
990
+ "--app",
991
+ target
992
+ ], {
993
+ timeoutMs: 12e4,
994
+ signal: this.#abortController.signal,
995
+ killProcessTree: true
996
+ });
997
+ if (!this.#started || generation !== this.#generation) return;
998
+ if (result.code !== 0) throw new Error(result.stderr || result.stdout || `exit ${result.code}`);
999
+ state.lastError = void 0;
1000
+ this.params.logger.info(`[facetime] injected helper into ${target}`);
1001
+ if (!state.connected && !state.stale) {
1002
+ await this.#waitForAuthenticatedConnection(target, generation);
1003
+ if (!state.connected && !state.stale) throw new Error(`${target} helper injection completed but no authenticated connection arrived`);
1004
+ }
1005
+ } catch (error) {
1006
+ if (this.#started && generation === this.#generation) {
1007
+ state.lastError = formatErrorMessage(error);
1008
+ this.params.logger.warn(`[facetime] ${target} helper injection failed: ${state.lastError}`);
1009
+ }
1010
+ } finally {
1011
+ state.injecting = false;
1012
+ }
1013
+ if (!this.#started || generation !== this.#generation) return;
1014
+ this.#refreshConnections();
1015
+ if (!state.connected && !state.stale) {
1016
+ const retryIndex = Math.min(state.attempts - 1, this.#retryDelaysMs.length - 1);
1017
+ this.#schedule(target, this.#retryDelaysMs[retryIndex] ?? 6e4);
1018
+ }
1019
+ }
1020
+ };
1021
+ //#endregion
1022
+ //#region extensions/facetime/src/outbound-call.ts
1023
+ function normalizeFaceTimeOutboundIdentityEvent(value) {
1024
+ if (!value || typeof value !== "object" || Array.isArray(value)) return;
1025
+ const record = asRecord(value);
1026
+ if (record.event !== "ft-outbound-call-identified") return;
1027
+ const data = asRecord(record.data);
1028
+ const dialID = normalizeOptionalString(data.dial_id);
1029
+ if (!dialID) return;
1030
+ const callUUID = normalizeOptionalString(data.call_uuid);
1031
+ const proxyIdentifier = normalizeOptionalString(data.proxy_identifier);
1032
+ if (!callUUID && !proxyIdentifier) return;
1033
+ return {
1034
+ event: "ft-outbound-call-identified",
1035
+ data: {
1036
+ dial_id: dialID,
1037
+ ...callUUID ? { call_uuid: callUUID } : {},
1038
+ ...proxyIdentifier ? { proxy_identifier: proxyIdentifier } : {}
1039
+ }
1040
+ };
1041
+ }
1042
+ function readHandle(value) {
1043
+ if (typeof value !== "string") throw new Error("handle must be a string");
1044
+ const handle = value.trim();
1045
+ if (!handle) throw new Error("handle is required");
1046
+ if (handle.length > 320) throw new Error("handle is too long");
1047
+ if (/^[a-z][a-z\d+.-]*:/iu.test(handle)) throw new Error("handle must not include a URL scheme");
1048
+ for (const character of handle) {
1049
+ const code = character.codePointAt(0) ?? 0;
1050
+ if (code <= 31 || code === 127 || "/?#\\".includes(character)) throw new Error("handle contains unsupported characters");
1051
+ }
1052
+ if (handle.includes("@")) {
1053
+ if (!/^[^@\s]+@[^@\s]+$/u.test(handle)) throw new Error("handle must be a valid FaceTime email address or phone number");
1054
+ return handle;
1055
+ }
1056
+ if (!/^[+\d\s().-]+$/u.test(handle) || !/\d/u.test(handle)) throw new Error("handle must be a valid FaceTime email address or phone number");
1057
+ return handle;
1058
+ }
1059
+ function readMode(value) {
1060
+ if (value === void 0) return "audio";
1061
+ if (value === "audio" || value === "video") return value;
1062
+ throw new Error("mode must be audio or video");
1063
+ }
1064
+ function resolveFaceTimeDialRequest(params) {
1065
+ const handle = readHandle(params.handle);
1066
+ if (!isAuthorizedFaceTimeHandle({
1067
+ handle,
1068
+ ownerHandles: params.ownerHandles
1069
+ })) throw new Error("outbound FaceTime handle is not an authorized owner handle");
1070
+ return {
1071
+ handle,
1072
+ mode: readMode(params.mode)
1073
+ };
1074
+ }
1075
+ function resolveFaceTimeDialResult(params) {
1076
+ if (params.helper.muted !== true || params.helper.is_uplink_muted !== true || !isVerifiedFaceTimeTransportEvidence(params.helper.transport)) throw new Error("FaceTime helper did not prove a safely muted FaceTime outbound carrier");
1077
+ const callUUID = normalizeOptionalString(params.helper.call_uuid);
1078
+ const proxyIdentifier = normalizeOptionalString(params.helper.proxy_identifier);
1079
+ return {
1080
+ ...params.request,
1081
+ dialID: params.dialID,
1082
+ state: callUUID ? "ringing" : "pending",
1083
+ ...callUUID ? { callUUID } : {},
1084
+ ...proxyIdentifier ? { proxyIdentifier } : {},
1085
+ helper: params.helper
1086
+ };
1087
+ }
1088
+ function doesFaceTimeCallMatchPendingDial(params) {
1089
+ if (params.event.data.dial_id) return params.event.data.dial_id === params.pending.dialID;
1090
+ if (params.pending.callUUID) {
1091
+ const eventCallUUID = params.event.data.call_uuid;
1092
+ return typeof eventCallUUID === "string" && doesPendingFaceTimeDialHaveCallUUID(params.pending, eventCallUUID);
1093
+ }
1094
+ if (params.pending.proxyIdentifier) return params.event.data.proxy_identifier === params.pending.proxyIdentifier;
1095
+ return params.event.data.dial_id === params.pending.dialID;
1096
+ }
1097
+ function retainFaceTimeDialCallUUID(pending, callUUID) {
1098
+ if (!callUUID) return;
1099
+ pending.callUUIDAliases ??= /* @__PURE__ */ new Set();
1100
+ if (pending.callUUID) pending.callUUIDAliases.add(pending.callUUID);
1101
+ pending.callUUIDAliases.add(callUUID);
1102
+ pending.callUUID = callUUID;
1103
+ }
1104
+ function doesPendingFaceTimeDialHaveCallUUID(pending, callUUID) {
1105
+ return pending.callUUID === callUUID || pending.callUUIDAliases?.has(callUUID) === true;
1106
+ }
1107
+ //#endregion
1108
+ //#region extensions/facetime/src/pending-dial-store.ts
1109
+ const PENDING_DIAL_KEY = "active";
1110
+ function decodePendingDial(value) {
1111
+ if (!value || value.version !== 1 || !Number.isSafeInteger(value.ownerEpoch) || value.ownerEpoch < 1 || typeof value.dialID !== "string" || typeof value.handle !== "string" || value.mode !== "audio" && value.mode !== "video" || value.delivery !== "in-flight" && value.delivery !== "accepted" && value.delivery !== "ambiguous" && value.delivery !== "cancelling" || typeof value.requestedAt !== "string") return;
1112
+ const { callUUIDAliases, ...stored } = value;
1113
+ return {
1114
+ ...stored,
1115
+ ...callUUIDAliases?.length ? { callUUIDAliases: new Set(callUUIDAliases) } : {}
1116
+ };
1117
+ }
1118
+ var PendingFaceTimeDialStore = class {
1119
+ #tail = Promise.resolve();
1120
+ #clearing = /* @__PURE__ */ new Map();
1121
+ constructor(store) {
1122
+ this.store = store;
1123
+ }
1124
+ #enqueue(operation) {
1125
+ const pending = this.#tail.then(operation);
1126
+ this.#tail = pending.then(() => void 0, () => void 0);
1127
+ return pending;
1128
+ }
1129
+ load() {
1130
+ return this.#enqueue(async () => decodePendingDial(await this.store.lookup(PENDING_DIAL_KEY)));
1131
+ }
1132
+ save(pending) {
1133
+ const clearing = this.#clearing.get(pending.dialID);
1134
+ if (clearing) return clearing.then(() => void 0);
1135
+ const { callUUIDAliases, ...stored } = pending;
1136
+ const snapshot = {
1137
+ ...stored,
1138
+ ...callUUIDAliases ? { callUUIDAliases: [...callUUIDAliases].toSorted() } : {}
1139
+ };
1140
+ return this.#enqueue(() => this.store.register(PENDING_DIAL_KEY, snapshot));
1141
+ }
1142
+ clear(expectedDialID) {
1143
+ const existing = this.#clearing.get(expectedDialID);
1144
+ if (existing) return existing;
1145
+ const clearing = this.#enqueue(async () => {
1146
+ const { observe, compareAndApply } = this.store;
1147
+ if (!observe || !compareAndApply) {
1148
+ if (!this.store.deleteIf) throw new Error("FaceTime pending dial cleanup requires atomic plugin-state deletion");
1149
+ return this.store.deleteIf(PENDING_DIAL_KEY, (current) => current.dialID === expectedDialID);
1150
+ }
1151
+ let observation = await observe(PENDING_DIAL_KEY);
1152
+ for (;;) {
1153
+ const result = await compareAndApply(PENDING_DIAL_KEY, observation.comparison, {
1154
+ operation: "delete",
1155
+ action: observation.value?.dialID === expectedDialID ? "delete" : "keep"
1156
+ });
1157
+ if (result.status !== "conflict") return result.status === "applied";
1158
+ observation = result.current;
1159
+ }
1160
+ }).finally(() => this.#clearing.delete(expectedDialID));
1161
+ this.#clearing.set(expectedDialID, clearing);
1162
+ return clearing;
1163
+ }
1164
+ isClearing(dialID) {
1165
+ return dialID !== void 0 && this.#clearing.has(dialID);
1166
+ }
1167
+ settle() {
1168
+ return this.#tail;
1169
+ }
1170
+ };
1171
+ //#endregion
1172
+ //#region extensions/facetime/src/audio-pump.ts
1173
+ const CAFFEINATE_COMMAND = "/usr/bin/caffeinate";
1174
+ const CAPTURE_CLOSE_SAFE_FRAME = Buffer.from([
1175
+ 4,
1176
+ 0,
1177
+ 0,
1178
+ 0,
1179
+ 4,
1180
+ 0,
1181
+ 0,
1182
+ 0,
1183
+ 0
1184
+ ]);
1185
+ const FACETIME_AUDIO_SAMPLE_RATE_HZ = 24e3;
1186
+ const OUTPUT_LATENCY_BUDGET_MS = 100;
1187
+ const SOX_COREAUDIO_BUFFER_BYTES = 8192;
1188
+ const SOX_COMMAND = [
1189
+ process.env.HOME ? `${process.env.HOME}/.homebrew/bin/sox` : void 0,
1190
+ "/opt/homebrew/bin/sox",
1191
+ "/usr/local/bin/sox"
1192
+ ].find((path) => Boolean(path && existsSync(path))) ?? "sox";
1193
+ const FACETIME_FEED_DEVICE_NAME = "OpenClaw-Feed";
1194
+ const FACETIME_MIC_DEVICE_NAME = "OpenClaw-Mic";
1195
+ const MAX_PLAYBACK_BUFFERED_BYTES = 2097152;
1196
+ function sanitizedAudioChildEnv(env = process.env) {
1197
+ return Object.fromEntries(Object.entries(env).filter(([key]) => !/(?:API_?KEY|AUTH|CREDENTIAL|PASSWORD|SECRET|TOKEN)/iu.test(key)));
1198
+ }
1199
+ var PlaybackClock = class {
1200
+ constructor() {
1201
+ this.generatedFrames = 0;
1202
+ this.playedFramesBeforeSegment = 0;
1203
+ this.playbackStartsAtMs = 0;
1204
+ this.playbackUntilMs = 0;
1205
+ this.retiredFrames = 0;
1206
+ this.items = [];
1207
+ }
1208
+ append(frames, itemId, nowMs = Date.now()) {
1209
+ if (nowMs >= this.playbackUntilMs) {
1210
+ this.playedFramesBeforeSegment = this.generatedFrames;
1211
+ this.playbackStartsAtMs = nowMs + OUTPUT_LATENCY_BUDGET_MS;
1212
+ this.playbackUntilMs = this.playbackStartsAtMs;
1213
+ }
1214
+ this.generatedFrames += frames;
1215
+ this.playbackUntilMs += frames / FACETIME_AUDIO_SAMPLE_RATE_HZ * 1e3;
1216
+ const previous = this.items.at(-1);
1217
+ if (previous && previous.itemId === itemId) previous.frames += frames;
1218
+ else this.items.push({
1219
+ itemId,
1220
+ frames
1221
+ });
1222
+ }
1223
+ playbackState() {
1224
+ let remaining = Math.max(0, this.playedFrames() - this.retiredFrames);
1225
+ const playedByItem = /* @__PURE__ */ new Map();
1226
+ for (const item of this.items) {
1227
+ const consumed = Math.min(remaining, item.frames);
1228
+ remaining -= consumed;
1229
+ if (item.itemId) playedByItem.set(item.itemId, (playedByItem.get(item.itemId) ?? 0) + consumed);
1230
+ }
1231
+ return Array.from(playedByItem, ([itemId, frames]) => ({
1232
+ itemId,
1233
+ audioEndMs: Math.floor(frames * 1e3 / FACETIME_AUDIO_SAMPLE_RATE_HZ)
1234
+ }));
1235
+ }
1236
+ retireItems() {
1237
+ this.items = [];
1238
+ this.retiredFrames = this.generatedFrames;
1239
+ }
1240
+ playedFrames(nowMs = Date.now()) {
1241
+ if (nowMs <= this.playbackStartsAtMs) return this.playedFramesBeforeSegment;
1242
+ const elapsedFrames = (nowMs - this.playbackStartsAtMs) / 1e3 * FACETIME_AUDIO_SAMPLE_RATE_HZ;
1243
+ return Math.min(this.generatedFrames, this.playedFramesBeforeSegment + elapsedFrames);
1244
+ }
1245
+ queuedFrames(nowMs = Date.now()) {
1246
+ return Math.max(0, this.generatedFrames - this.playedFrames(nowMs));
1247
+ }
1248
+ millisecondsUntilDrained(nowMs = Date.now()) {
1249
+ return Math.max(0, this.playbackUntilMs - nowMs);
1250
+ }
1251
+ reset() {
1252
+ this.generatedFrames = 0;
1253
+ this.playedFramesBeforeSegment = 0;
1254
+ this.playbackStartsAtMs = 0;
1255
+ this.playbackUntilMs = 0;
1256
+ this.retireItems();
1257
+ }
1258
+ };
1259
+ function buildSoxOutputArguments() {
1260
+ return [
1261
+ "-q",
1262
+ "--buffer",
1263
+ String(SOX_COREAUDIO_BUFFER_BYTES),
1264
+ "-t",
1265
+ "raw",
1266
+ "-r",
1267
+ String(FACETIME_AUDIO_SAMPLE_RATE_HZ),
1268
+ "-c",
1269
+ "1",
1270
+ "-e",
1271
+ "signed-integer",
1272
+ "-b",
1273
+ "16",
1274
+ "-L",
1275
+ "-",
1276
+ "-t",
1277
+ "coreaudio",
1278
+ FACETIME_FEED_DEVICE_NAME
1279
+ ];
1280
+ }
1281
+ async function terminateProcess(proc, signal = "SIGTERM") {
1282
+ if (proc.killed && signal !== "SIGKILL") return;
1283
+ let exited = false;
1284
+ const exitedPromise = new Promise((resolve) => {
1285
+ proc.on("exit", () => {
1286
+ exited = true;
1287
+ resolve();
1288
+ });
1289
+ });
1290
+ try {
1291
+ proc.kill(signal);
1292
+ } catch {
1293
+ return;
1294
+ }
1295
+ await Promise.race([exitedPromise, new Promise((resolve) => {
1296
+ setTimeout(resolve, 500).unref?.();
1297
+ })]);
1298
+ if (!exited && signal !== "SIGKILL") {
1299
+ try {
1300
+ proc.kill("SIGKILL");
1301
+ } catch {
1302
+ return;
1303
+ }
1304
+ await Promise.race([exitedPromise, new Promise((resolve) => {
1305
+ setTimeout(resolve, 500).unref?.();
1306
+ })]);
1307
+ }
1308
+ }
1309
+ function startFaceTimeAudioPump(params) {
1310
+ const spawnFn = params.spawn ?? ((command, args, options) => spawn(command, args, options));
1311
+ const childEnv = sanitizedAudioChildEnv();
1312
+ const playbackClock = new PlaybackClock();
1313
+ let playbackGeneration = 1;
1314
+ let drainTimer;
1315
+ let outputProcess;
1316
+ const captureProcess = spawnFn(params.captureBinary, [], {
1317
+ env: childEnv,
1318
+ stdio: [
1319
+ "pipe",
1320
+ "pipe",
1321
+ "pipe"
1322
+ ]
1323
+ });
1324
+ let stopped = false;
1325
+ let mediaSuspended = false;
1326
+ let captureSuppressionActive = false;
1327
+ let captureFailureReported = false;
1328
+ let captureReadySettled = false;
1329
+ let routeReadySettled = false;
1330
+ let routeReadyTimer;
1331
+ let captureStderr = "";
1332
+ let resolveCaptureReady = () => {};
1333
+ let rejectCaptureReady = (_error) => {};
1334
+ const captureReadyPromise = new Promise((resolve, reject) => {
1335
+ resolveCaptureReady = resolve;
1336
+ rejectCaptureReady = reject;
1337
+ });
1338
+ let resolveRouteReady = () => {};
1339
+ let rejectRouteReady = (_error) => {};
1340
+ const routeReadyPromise = new Promise((resolve, reject) => {
1341
+ resolveRouteReady = resolve;
1342
+ rejectRouteReady = reject;
1343
+ });
1344
+ captureReadyPromise.catch(() => {});
1345
+ routeReadyPromise.catch(() => {});
1346
+ const settleCaptureReady = (error) => {
1347
+ if (captureReadySettled) return;
1348
+ captureReadySettled = true;
1349
+ clearTimeout(captureReadyTimer);
1350
+ if (error) rejectCaptureReady(error);
1351
+ else resolveCaptureReady();
1352
+ };
1353
+ const settleRouteReady = (error) => {
1354
+ if (routeReadySettled) return;
1355
+ routeReadySettled = true;
1356
+ if (routeReadyTimer) {
1357
+ clearTimeout(routeReadyTimer);
1358
+ routeReadyTimer = void 0;
1359
+ }
1360
+ if (error) rejectRouteReady(error);
1361
+ else resolveRouteReady();
1362
+ };
1363
+ const reportFailure = (error, suppressionLost) => {
1364
+ if (stopped) return;
1365
+ if (suppressionLost) {
1366
+ captureSuppressionActive = false;
1367
+ params.onSuppressionLost?.(error);
1368
+ }
1369
+ settleCaptureReady(error);
1370
+ settleRouteReady(error);
1371
+ params.logger.warn(`[facetime] native audio bridge failed: ${formatErrorMessage(error)}`);
1372
+ Promise.resolve(params.onError?.(error)).then((safeToStop) => {
1373
+ if (safeToStop !== false) stop();
1374
+ });
1375
+ };
1376
+ const cancelDrainTimer = () => {
1377
+ if (drainTimer) {
1378
+ clearTimeout(drainTimer);
1379
+ drainTimer = void 0;
1380
+ }
1381
+ };
1382
+ const spawnOutput = () => {
1383
+ const proc = spawnFn(SOX_COMMAND, buildSoxOutputArguments(), {
1384
+ env: childEnv,
1385
+ stdio: [
1386
+ "pipe",
1387
+ "ignore",
1388
+ "pipe"
1389
+ ]
1390
+ });
1391
+ proc.on("error", (error) => {
1392
+ if (!stopped && !mediaSuspended && proc === outputProcess) reportFailure(error, false);
1393
+ });
1394
+ proc.stdin?.on("error", (error) => {
1395
+ if (!stopped && !mediaSuspended && proc === outputProcess) reportFailure(error, false);
1396
+ });
1397
+ proc.on("exit", (code, signal) => {
1398
+ if (!stopped && !mediaSuspended && proc === outputProcess) reportFailure(/* @__PURE__ */ new Error(`SoX playback exited (${code ?? signal ?? "done"})`), false);
1399
+ });
1400
+ proc.stderr?.on("data", (chunk) => {
1401
+ if (proc === outputProcess) params.logger.debug?.(`[facetime] SoX playback: ${String(chunk).trim()}`);
1402
+ });
1403
+ return proc;
1404
+ };
1405
+ outputProcess = spawnOutput();
1406
+ const captureReadyTimer = setTimeout(() => {
1407
+ reportFailure(/* @__PURE__ */ new Error("FaceTime process tap was not ready within 10 seconds"), true);
1408
+ }, 1e4);
1409
+ captureReadyTimer.unref?.();
1410
+ const startRouteReadyTimer = () => {
1411
+ if (routeReadySettled || routeReadyTimer) return;
1412
+ routeReadyTimer = setTimeout(() => {
1413
+ reportFailure(/* @__PURE__ */ new Error("FaceTime input route was not verified within 15 seconds"), true);
1414
+ }, 15e3);
1415
+ routeReadyTimer.unref?.();
1416
+ };
1417
+ const clearPlayback = () => {
1418
+ if (stopped || mediaSuspended) return;
1419
+ const previous = outputProcess;
1420
+ outputProcess = spawnOutput();
1421
+ playbackGeneration += 1;
1422
+ cancelDrainTimer();
1423
+ playbackClock.reset();
1424
+ terminateProcess(previous, "SIGKILL");
1425
+ };
1426
+ const stop = async () => {
1427
+ if (stopped) return;
1428
+ mediaSuspended = true;
1429
+ captureSuppressionActive = false;
1430
+ settleCaptureReady(/* @__PURE__ */ new Error("FaceTime native audio bridge stopped before readiness"));
1431
+ settleRouteReady(/* @__PURE__ */ new Error("FaceTime input route stopped before verification"));
1432
+ cancelDrainTimer();
1433
+ playbackClock.reset();
1434
+ try {
1435
+ captureProcess.stdin?.write(CAPTURE_CLOSE_SAFE_FRAME);
1436
+ captureProcess.stdin?.end();
1437
+ } catch {}
1438
+ stopped = true;
1439
+ await Promise.all([
1440
+ terminateProcess(captureProcess),
1441
+ terminateProcess(outputProcess, "SIGKILL"),
1442
+ wakeProcess ? terminateProcess(wakeProcess) : Promise.resolve()
1443
+ ]);
1444
+ };
1445
+ const wakeProcess = existsSync(CAFFEINATE_COMMAND) ? spawnFn(CAFFEINATE_COMMAND, [
1446
+ "-d",
1447
+ "-i",
1448
+ ...captureProcess.pid ? ["-w", String(captureProcess.pid)] : []
1449
+ ], {
1450
+ env: childEnv,
1451
+ stdio: [
1452
+ "ignore",
1453
+ "ignore",
1454
+ "pipe"
1455
+ ]
1456
+ }) : void 0;
1457
+ wakeProcess?.on("error", () => void 0);
1458
+ captureProcess.on("error", (error) => reportFailure(error, true));
1459
+ captureProcess.stdin?.on("error", (error) => reportFailure(error, false));
1460
+ captureProcess.on("exit", (code, signal) => {
1461
+ if (!stopped) reportFailure(/* @__PURE__ */ new Error(`native audio bridge exited (${code ?? signal ?? "done"})`), true);
1462
+ });
1463
+ captureProcess.stderr?.on("data", (chunk) => {
1464
+ captureStderr = `${captureStderr}${String(chunk)}`.slice(-8192);
1465
+ for (const line of captureStderr.split(/\r?\n/u).slice(0, -1)) {
1466
+ if (line.includes("started FaceTime process tap")) {
1467
+ captureSuppressionActive = true;
1468
+ settleCaptureReady();
1469
+ }
1470
+ if (line.includes("verified OpenClaw-Mic input route")) settleRouteReady();
1471
+ const fatal = line.match(/facetime-audio-capture: fatal(?:-safety-retained)?:\s*(.*)$/u);
1472
+ if (!captureFailureReported && fatal) {
1473
+ captureFailureReported = true;
1474
+ const detail = fatal[1]?.trim();
1475
+ reportFailure(/* @__PURE__ */ new Error(detail ? `native FaceTime safety monitor reported a fatal error: ${detail}` : "native FaceTime safety monitor reported a fatal error"), false);
1476
+ }
1477
+ }
1478
+ captureStderr = captureStderr.split(/\r?\n/u).at(-1) ?? "";
1479
+ });
1480
+ captureProcess.stdout?.on("data", (chunk) => {
1481
+ if (!stopped && !mediaSuspended) {
1482
+ const audio = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
1483
+ if (audio.byteLength > 0) params.onInputAudio(audio);
1484
+ }
1485
+ });
1486
+ return {
1487
+ suppressionReady: async () => await captureReadyPromise,
1488
+ routeReady: async () => {
1489
+ startRouteReadyTimer();
1490
+ await routeReadyPromise;
1491
+ },
1492
+ processOutputSuppressed: () => captureSuppressionActive,
1493
+ writeOutputAudio(audio, metadata) {
1494
+ if (stopped || mediaSuspended || audio.byteLength === 0) return;
1495
+ if ((outputProcess.stdin?.writableLength ?? 0) + audio.byteLength > MAX_PLAYBACK_BUFFERED_BYTES) {
1496
+ reportFailure(/* @__PURE__ */ new Error("SoX playback queue exceeded 2 MiB"), false);
1497
+ return;
1498
+ }
1499
+ if (!outputProcess.stdin) {
1500
+ reportFailure(/* @__PURE__ */ new Error("SoX playback stdin is unavailable"), false);
1501
+ return;
1502
+ }
1503
+ try {
1504
+ cancelDrainTimer();
1505
+ outputProcess.stdin.write(audio);
1506
+ playbackClock.append(audio.byteLength / 2, metadata?.itemId);
1507
+ } catch (error) {
1508
+ reportFailure(error instanceof Error ? error : new Error(formatErrorMessage(error)), false);
1509
+ }
1510
+ },
1511
+ finishOutputAudio() {
1512
+ if (stopped || mediaSuspended) return;
1513
+ if (playbackClock.queuedFrames() <= 0) {
1514
+ playbackClock.retireItems();
1515
+ return;
1516
+ }
1517
+ cancelDrainTimer();
1518
+ const generation = playbackGeneration;
1519
+ const notifyWhenDrained = () => {
1520
+ if (stopped || mediaSuspended || generation !== playbackGeneration) return;
1521
+ const delayMs = Math.ceil(playbackClock.millisecondsUntilDrained());
1522
+ if (delayMs > 0) {
1523
+ drainTimer = setTimeout(notifyWhenDrained, Math.max(1, delayMs));
1524
+ drainTimer.unref?.();
1525
+ return;
1526
+ }
1527
+ drainTimer = void 0;
1528
+ playbackClock.retireItems();
1529
+ params.onPlaybackDrained?.({
1530
+ generation,
1531
+ playedFrames: Math.floor(playbackClock.playedFrames())
1532
+ });
1533
+ };
1534
+ notifyWhenDrained();
1535
+ },
1536
+ getPlaybackState: () => playbackClock.playbackState(),
1537
+ clearOutputAudio: clearPlayback,
1538
+ playedAudioFrames: () => Math.floor(playbackClock.playedFrames()),
1539
+ queuedAudioFrames: () => Math.ceil(playbackClock.queuedFrames()),
1540
+ async suspendMedia() {
1541
+ if (!stopped && !mediaSuspended) {
1542
+ mediaSuspended = true;
1543
+ cancelDrainTimer();
1544
+ playbackClock.reset();
1545
+ await terminateProcess(outputProcess, "SIGKILL");
1546
+ }
1547
+ },
1548
+ stop
1549
+ };
1550
+ }
1551
+ //#endregion
1552
+ //#region extensions/facetime/src/talk-driver-config.ts
1553
+ const CONSULT_SYSTEM_PROMPT = [
1554
+ "You are the configured OpenClaw agent receiving a delegated request from an authenticated owner in a private 1:1 FaceTime call.",
1555
+ "The authenticated caller is the configured owner/user described by this agent's workspace context, including USER.md. When asked who is speaking, identify them from that workspace context without asking them to reconfirm.",
1556
+ "Use the normal workspace, memory, tools, and approval policies for this agent.",
1557
+ "Prefer registered OpenClaw tools over exec.",
1558
+ "When a direct tool returns usable data that answers the caller, answer immediately from that result.",
1559
+ "Do not contact another agent or session merely to enrich or double-check a successful direct tool result unless the caller explicitly asks you to.",
1560
+ "Never claim completion unless the relevant tool result confirms it.",
1561
+ "Return a concise plain-text answer. The realtime voice provider speaks your answer; do not call tts or generate an audio attachment."
1562
+ ].join(" ");
1563
+ const REALTIME_READY_TIMEOUT_MS = 15e3;
1564
+ const MAX_TRANSCRIPT_ENTRY_CHARS = 2e3;
1565
+ const MAX_TRANSCRIPT_CHARS = 12e3;
1566
+ const AGENT_CONSULT_MESSAGE_PROVIDER = "voice";
1567
+ const FACETIME_END_CALL_TOOL_NAME = "facetime_end_call";
1568
+ const FACETIME_END_CALL_TOOL = {
1569
+ type: "function",
1570
+ name: FACETIME_END_CALL_TOOL_NAME,
1571
+ description: "Immediately end the current FaceTime call when the caller clearly asks to hang up, end, leave, or disconnect this call. Do not use this to cancel background work.",
1572
+ parameters: {
1573
+ type: "object",
1574
+ properties: {}
1575
+ }
1576
+ };
1577
+ function assertAuthenticatedSenderConsultSupport() {
1578
+ if (REALTIME_VOICE_AGENT_CONSULT_SENDER_AUTH_VERSION !== 1) throw new Error("OpenClaw host does not support authenticated sender identity for realtime agent consults; update OpenClaw before enabling FaceTime");
1579
+ }
1580
+ function agentIdFromSessionKey(sessionKey, config) {
1581
+ if (parseAgentSessionKey(sessionKey)) return resolveAgentIdFromSessionKey(sessionKey);
1582
+ return resolveAgentIdFromSessionKey(sessionKey, resolveDefaultAgentId(config));
1583
+ }
1584
+ function buildRealtimeInstructions(params) {
1585
+ const callControlInstructions = [
1586
+ "Call control:",
1587
+ `- When the caller asks you to hang up, end, leave, or disconnect the current FaceTime call, call ${FACETIME_END_CALL_TOOL_NAME} immediately.`,
1588
+ `- Never delegate a current-call hangup request to ${REALTIME_VOICE_AGENT_CONSULT_TOOL_NAME}, ask for confirmation, or say that you will check.`
1589
+ ].join("\n");
1590
+ const proxyInstructions = params.toolPolicy === "none" ? void 0 : [
1591
+ "Mode: OpenClaw agent proxy.",
1592
+ "You are the realtime voice surface for the same configured OpenClaw agent the owner can message directly.",
1593
+ "The FaceTime caller is the authenticated owner/user described by the loaded workspace profile context. Recognize them from that context without asking them to reconfirm.",
1594
+ "Answer greetings, acknowledgements, and questions about your own identity or persona directly from the loaded realtime profile context.",
1595
+ "Do not mention a backend, supervisor, helper, or separate system. Present the result as your own work.",
1596
+ `Delegate actions, tool work, current facts, memory, workspace context not already loaded above, and user-specific context with ${REALTIME_VOICE_AGENT_CONSULT_TOOL_NAME}.`,
1597
+ "Do not block, refuse, or downscope at the voice layer. Delegate to OpenClaw and treat its result as authoritative.",
1598
+ "While waiting for a tool result, use at most one short natural backchannel such as \"one sec\"; do not repeat progress updates or treat it as the final answer.",
1599
+ "Never claim you retried or are retrying unless a new tool result explicitly confirms a new attempt.",
1600
+ buildRealtimeVoiceAgentConsultPolicyInstructions({
1601
+ toolPolicy: params.toolPolicy,
1602
+ consultPolicy: "substantive"
1603
+ })
1604
+ ].filter(Boolean).join("\n");
1605
+ return [
1606
+ params.instructions?.trim(),
1607
+ params.bootstrapContext?.trim(),
1608
+ callControlInstructions,
1609
+ proxyInstructions
1610
+ ].filter(Boolean).join("\n\n");
1611
+ }
1612
+ async function resolveFaceTimeRealtimeProvider(params) {
1613
+ const configuredProviderId = params.config.realtime.provider;
1614
+ const sourceProviders = params.config.realtime.providers;
1615
+ const selectedProviderIds = configuredProviderId ? /* @__PURE__ */ new Set([configuredProviderId, getRealtimeVoiceProvider(configuredProviderId, params.fullConfig)?.id]) : void 0;
1616
+ const selectedEntries = configuredProviderId ? Object.entries(sourceProviders).filter(([providerId]) => selectedProviderIds?.has(providerId)) : Object.entries(sourceProviders);
1617
+ const providers = Object.fromEntries(await Promise.all(selectedEntries.map(async ([providerId, providerConfig]) => {
1618
+ const resolved = await resolveConfiguredSecretInputString({
1619
+ config: params.fullConfig,
1620
+ env: process.env,
1621
+ value: providerConfig.apiKey,
1622
+ path: `plugins.entries.facetime.config.realtime.providers.${providerId}.apiKey`
1623
+ });
1624
+ if (resolved.value) return [providerId, {
1625
+ ...providerConfig,
1626
+ apiKey: resolved.value
1627
+ }];
1628
+ if (resolved.unresolvedRefReason) {
1629
+ if (configuredProviderId) throw new Error(resolved.unresolvedRefReason);
1630
+ const { apiKey: _unresolvedApiKey, ...remainingConfig } = providerConfig;
1631
+ return [providerId, remainingConfig];
1632
+ }
1633
+ return [providerId, { ...providerConfig }];
1634
+ })));
1635
+ return resolveConfiguredRealtimeVoiceProvider({
1636
+ configuredProviderId,
1637
+ providerConfigs: providers,
1638
+ providerConfigOverrides: params.config.realtime.voice ? { voice: params.config.realtime.voice } : void 0,
1639
+ cfg: params.fullConfig,
1640
+ agentId: params.agentId,
1641
+ defaultModel: params.config.realtime.model,
1642
+ surface: "bridge",
1643
+ noRegisteredProviderMessage: "No realtime voice provider registered"
1644
+ });
1645
+ }
1646
+ //#endregion
1647
+ //#region extensions/facetime/src/preflight.ts
1648
+ function parseDefaultAudioDevices(raw) {
1649
+ const parsed = JSON.parse(raw);
1650
+ const record = asRecord(parsed);
1651
+ const input = asRecord(record.input);
1652
+ const output = asRecord(record.output);
1653
+ if (typeof input.isAggregate !== "boolean" || typeof input.name !== "string" || typeof input.uid !== "string" || typeof output.isAggregate !== "boolean" || typeof output.name !== "string" || typeof output.uid !== "string") throw new Error("invalid audio-device shape");
1654
+ return {
1655
+ input: {
1656
+ isAggregate: input.isAggregate,
1657
+ name: input.name,
1658
+ uid: input.uid
1659
+ },
1660
+ output: {
1661
+ isAggregate: output.isAggregate,
1662
+ name: output.name,
1663
+ uid: output.uid
1664
+ }
1665
+ };
1666
+ }
1667
+ function firstLine(value) {
1668
+ return typeof value === "string" ? value.trim().split(/\r?\n/u)[0] || void 0 : void 0;
1669
+ }
1670
+ function pushCheck(checks, check) {
1671
+ checks.push({
1672
+ required: true,
1673
+ ...check
1674
+ });
1675
+ }
1676
+ function parseCoreAudioDevices(systemProfilerOutput) {
1677
+ try {
1678
+ const parsed = asRecord(JSON.parse(systemProfilerOutput));
1679
+ const devices = (Array.isArray(parsed.SPAudioDataType) ? parsed.SPAudioDataType : []).flatMap((entry) => {
1680
+ const record = asRecord(entry);
1681
+ const items = record["_items"];
1682
+ return Array.isArray(items) ? items : [record];
1683
+ }).flatMap((entry) => {
1684
+ const record = asRecord(entry);
1685
+ const name = record["_name"];
1686
+ return typeof name === "string" ? [{
1687
+ name,
1688
+ virtual: record.coreaudio_device_transport === "coreaudio_device_type_virtual"
1689
+ }] : [];
1690
+ });
1691
+ if (devices.length > 0) return devices;
1692
+ } catch {}
1693
+ const devices = [];
1694
+ for (const line of systemProfilerOutput.split(/\r?\n/u)) {
1695
+ const match = line.match(/^\s{8}(.+):\s*$/u);
1696
+ if (match?.[1]) devices.push({
1697
+ name: match[1].trim(),
1698
+ virtual: false
1699
+ });
1700
+ }
1701
+ return [...new Map(devices.map((device) => [device.name, device])).values()];
1702
+ }
1703
+ function findPhysicalOutputProblem(defaults, devices) {
1704
+ if (defaults.output.isAggregate) return `system output is aggregate device ${defaults.output.name}`;
1705
+ if (devices.some((device) => device.name === defaults.output.name && device.virtual) || /BlackHole|OpenClaw-(?:Feed|Mic)/iu.test(defaults.output.name)) return `system output is virtual device ${defaults.output.name}`;
1706
+ }
1707
+ async function checkCallApp(params) {
1708
+ for (const app of ["FaceTime", "Phone"]) if ((await params.runCommandWithTimeout([
1709
+ "/usr/bin/pgrep",
1710
+ "-x",
1711
+ app
1712
+ ], { timeoutMs: 5e3 })).code === 0) {
1713
+ pushCheck(params.checks, {
1714
+ id: "call-app-running",
1715
+ label: "FaceTime or Phone process",
1716
+ ok: true,
1717
+ message: app
1718
+ });
1719
+ return;
1720
+ }
1721
+ pushCheck(params.checks, {
1722
+ id: "call-app-running",
1723
+ label: "FaceTime or Phone process",
1724
+ ok: false,
1725
+ message: "open FaceTime for video calls or Phone for FaceTime audio calls"
1726
+ });
1727
+ }
1728
+ async function runFaceTimePreflight(params) {
1729
+ const runCommandWithTimeout = params.runtime.system.runCommandWithTimeout;
1730
+ const checks = [];
1731
+ pushCheck(checks, {
1732
+ id: "helper-connected",
1733
+ label: "FaceTime helper socket",
1734
+ ok: params.helperConnected,
1735
+ message: params.helperConnected ? "helper connected" : "no authenticated helper connected on the local UID-derived endpoint"
1736
+ });
1737
+ const executable = await runCommandWithTimeout([
1738
+ "/bin/test",
1739
+ "-x",
1740
+ params.captureBinary
1741
+ ], { timeoutMs: 5e3 });
1742
+ pushCheck(checks, {
1743
+ id: "capture-binary",
1744
+ label: "FaceTime process-tap capture helper",
1745
+ ok: executable.code === 0,
1746
+ message: executable.code === 0 ? params.captureBinary : "capture helper is missing; reinstall with brew install openclaw/tap/openclaw-facetime"
1747
+ });
1748
+ await checkCallApp({
1749
+ runCommandWithTimeout,
1750
+ checks
1751
+ });
1752
+ const profiler = await runCommandWithTimeout([
1753
+ "/usr/sbin/system_profiler",
1754
+ "SPAudioDataType",
1755
+ "-json"
1756
+ ], { timeoutMs: 1e4 });
1757
+ const audioDevices = profiler.code === 0 ? parseCoreAudioDevices(profiler.stdout ?? "") : [];
1758
+ const deviceNames = new Set(audioDevices.map((device) => device.name));
1759
+ for (const [id, label, deviceName] of [[
1760
+ "paired-driver-mic",
1761
+ "OpenClaw microphone device",
1762
+ FACETIME_MIC_DEVICE_NAME
1763
+ ], [
1764
+ "paired-driver-feed",
1765
+ "OpenClaw feed device",
1766
+ FACETIME_FEED_DEVICE_NAME
1767
+ ]]) {
1768
+ const found = deviceNames.has(deviceName);
1769
+ pushCheck(checks, {
1770
+ id,
1771
+ label,
1772
+ ok: found,
1773
+ message: found ? deviceName : `missing ${deviceName}; run openclaw gateway call facetime.installDriver --json`
1774
+ });
1775
+ }
1776
+ let currentAudioDefaults;
1777
+ let currentAudioError;
1778
+ if (executable.code === 0) {
1779
+ const defaults = await runCommandWithTimeout([params.captureBinary, "--default-devices"], { timeoutMs: 5e3 });
1780
+ if (defaults.code === 0) try {
1781
+ currentAudioDefaults = parseDefaultAudioDevices(defaults.stdout ?? "");
1782
+ const problem = findPhysicalOutputProblem(currentAudioDefaults, audioDevices);
1783
+ pushCheck(checks, {
1784
+ id: "physical-output",
1785
+ label: "Physical call output",
1786
+ ok: !problem,
1787
+ message: problem ?? currentAudioDefaults.output.name
1788
+ });
1789
+ } catch (error) {
1790
+ currentAudioError = `invalid audio-device JSON: ${formatErrorMessage(error)}`;
1791
+ }
1792
+ else currentAudioError = firstLine(defaults.stderr) ?? firstLine(defaults.stdout);
1793
+ if (currentAudioError) pushCheck(checks, {
1794
+ id: "physical-output",
1795
+ label: "Physical call output",
1796
+ ok: false,
1797
+ message: currentAudioError
1798
+ });
1799
+ const capture = await runCommandWithTimeout([params.captureBinary, "--check"], { timeoutMs: 8e3 });
1800
+ pushCheck(checks, {
1801
+ id: "process-tap",
1802
+ label: "FaceTime app-audio process tap",
1803
+ ok: capture.code === 0,
1804
+ message: firstLine(capture.stderr) ?? firstLine(capture.stdout) ?? "grant Screen & System Audio Recording permission"
1805
+ });
1806
+ } else {
1807
+ pushCheck(checks, {
1808
+ id: "physical-output",
1809
+ label: "Physical call output",
1810
+ ok: false,
1811
+ message: "capture helper unavailable"
1812
+ });
1813
+ pushCheck(checks, {
1814
+ id: "process-tap",
1815
+ label: "FaceTime app-audio process tap",
1816
+ ok: false,
1817
+ message: "capture helper unavailable"
1818
+ });
1819
+ }
1820
+ let providerReady = false;
1821
+ let providerMessage;
1822
+ try {
1823
+ const resolved = await resolveFaceTimeRealtimeProvider({
1824
+ config: params.config,
1825
+ fullConfig: params.fullConfig,
1826
+ agentId: agentIdFromSessionKey(params.config.realtime.sessionKey, params.fullConfig)
1827
+ });
1828
+ providerReady = true;
1829
+ providerMessage = `${resolved.provider.id}:${normalizeOptionalString(resolved.providerConfig.model) ?? "provider default"}`;
1830
+ } catch (error) {
1831
+ providerMessage = formatErrorMessage(error);
1832
+ }
1833
+ pushCheck(checks, {
1834
+ id: "realtime-provider",
1835
+ label: "Realtime provider readiness",
1836
+ ok: providerReady,
1837
+ message: providerMessage
1838
+ });
1839
+ return {
1840
+ ok: checks.every((check) => check.ok || !check.required),
1841
+ helperConnected: params.helperConnected,
1842
+ currentAudioDefaults,
1843
+ currentAudioError,
1844
+ checks
1845
+ };
1846
+ }
1847
+ //#endregion
1848
+ //#region extensions/facetime/src/runtime-carrier-process.ts
1849
+ async function terminateExactCarrierProcesses(params) {
1850
+ params.assertCurrent();
1851
+ if (params.peers.size === 0) throw new Error("no authenticated carrier process identity is available for fail-closed shutdown");
1852
+ for (const peer of params.peers.values()) {
1853
+ const expected = peer.bundleIdentifier === "com.apple.FaceTime" ? "FaceTime" : peer.bundleIdentifier === "com.apple.FaceTime.FTConversationService" ? "FTConversationService" : peer.bundleIdentifier === "com.apple.mobilephone" ? "Phone" : peer.bundleIdentifier === "com.apple.TelephonyUtilities" ? "TelephonyUtilities" : "";
1854
+ const inspectExactProcess = async () => {
1855
+ const inspected = await params.runtime.system.runCommandWithTimeout([
1856
+ "/bin/ps",
1857
+ "-p",
1858
+ String(peer.processId),
1859
+ "-o",
1860
+ "comm="
1861
+ ], { timeoutMs: 500 });
1862
+ params.assertCurrent();
1863
+ if (inspected.code === 1 && !inspected.stdout.trim() && !inspected.stderr.trim()) return false;
1864
+ const executable = inspected.stdout.trim();
1865
+ if (inspected.code !== 0 || !expected || executable !== expected && !executable.endsWith(`/${expected}`)) throw new Error("authenticated carrier process identity no longer matches its executable");
1866
+ const started = await params.runtime.system.runCommandWithTimeout([
1867
+ "/bin/ps",
1868
+ "-p",
1869
+ String(peer.processId),
1870
+ "-o",
1871
+ "lstart="
1872
+ ], { timeoutMs: 500 });
1873
+ params.assertCurrent();
1874
+ if (started.code === 1 && !started.stdout.trim() && !started.stderr.trim()) return false;
1875
+ const observedStartedAt = Date.parse(started.stdout.trim());
1876
+ if (started.code !== 0 || !Number.isFinite(observedStartedAt) || observedStartedAt !== Math.floor(peer.processStartedAtMs / 1e3) * 1e3) throw new Error("authenticated carrier process identity no longer matches its executable");
1877
+ return true;
1878
+ };
1879
+ let alive = await inspectExactProcess();
1880
+ params.assertCurrent();
1881
+ for (const signal of ["-TERM", "-KILL"]) {
1882
+ if (!alive) break;
1883
+ await params.runtime.system.runCommandWithTimeout([
1884
+ "/bin/kill",
1885
+ signal,
1886
+ String(peer.processId)
1887
+ ], { timeoutMs: 500 });
1888
+ params.assertCurrent();
1889
+ alive = await inspectExactProcess();
1890
+ params.assertCurrent();
1891
+ }
1892
+ if (alive) throw new Error("authenticated carrier process remains alive after force termination");
1893
+ }
1894
+ }
1895
+ //#endregion
1896
+ //#region extensions/facetime/src/talk-consult-controller.ts
1897
+ function createFaceTimeConsultController(params) {
1898
+ const pending = /* @__PURE__ */ new Map();
1899
+ let hangupRequested = false;
1900
+ const ownsConsult = (consult) => pending.get(consult.callId) === consult && consult.generation === params.getGeneration() && !params.isUnavailable();
1901
+ const failDelivery = async (event, error, reason) => {
1902
+ const normalized = error instanceof Error ? error : new Error(String(error));
1903
+ params.remember({
1904
+ type: "tool.error",
1905
+ turnId: event.turnId,
1906
+ callId: event.callId,
1907
+ payload: {
1908
+ name: event.name,
1909
+ error: formatErrorMessage(normalized)
1910
+ },
1911
+ final: true
1912
+ });
1913
+ try {
1914
+ await params.suspendMedia(reason);
1915
+ if (await params.reportFailure(normalized)) await params.close(reason);
1916
+ } catch (failure) {
1917
+ params.logger.warn?.(`[facetime] tool delivery recovery failed: ${formatErrorMessage(failure)}`);
1918
+ }
1919
+ };
1920
+ const abortConsult = (consult, reason) => {
1921
+ consult.abortController.abort(/* @__PURE__ */ new Error(`FaceTime agent consult ${reason}`));
1922
+ consult.runRegistration?.controller.abort(/* @__PURE__ */ new Error(`FaceTime agent consult run ${reason}`));
1923
+ };
1924
+ const abortForClose = () => {
1925
+ for (const consult of pending.values()) {
1926
+ consult.cancelRequested = true;
1927
+ pending.delete(consult.callId);
1928
+ abortConsult(consult, "closed or reset");
1929
+ }
1930
+ };
1931
+ const cancelPending = () => {
1932
+ for (const consult of pending.values()) {
1933
+ if (consult.cancelRequested) continue;
1934
+ consult.cancelRequested = true;
1935
+ abortConsult(consult, "superseded");
1936
+ if (consult.terminalSubmitted) continue;
1937
+ consult.terminalSubmitted = true;
1938
+ const result = buildRealtimeVoiceAgentCancelProviderResult("A new agent consult replaced this request before it completed.");
1939
+ (async () => {
1940
+ try {
1941
+ const bridge = params.getBridge();
1942
+ if (!bridge) throw new Error("Realtime bridge unavailable during agent consult cancellation");
1943
+ const options = bridge.bridge.supportsToolResultSuppression === false ? void 0 : { suppressResponse: true };
1944
+ await bridge.submitToolResult(consult.callId, result, options);
1945
+ if (!ownsConsult(consult)) return;
1946
+ pending.delete(consult.callId);
1947
+ params.remember({
1948
+ type: "tool.result",
1949
+ turnId: consult.turnId,
1950
+ callId: consult.callId,
1951
+ payload: {
1952
+ name: consult.name,
1953
+ result
1954
+ },
1955
+ final: true
1956
+ });
1957
+ } catch (error) {
1958
+ if (!ownsConsult(consult)) return;
1959
+ pending.delete(consult.callId);
1960
+ await failDelivery(consult, error, "consult-cancel-failed");
1961
+ }
1962
+ })();
1963
+ }
1964
+ };
1965
+ const submitHangupResult = async (event) => {
1966
+ const bridge = params.getBridge();
1967
+ const callId = event.callId || event.itemId;
1968
+ const turnId = params.ensureTurn();
1969
+ const result = {
1970
+ status: "ending",
1971
+ message: "The current FaceTime call is ending. Do not speak another response."
1972
+ };
1973
+ params.remember({
1974
+ type: "tool.call",
1975
+ turnId,
1976
+ itemId: event.itemId,
1977
+ callId,
1978
+ payload: {
1979
+ name: event.name,
1980
+ args: event.args
1981
+ }
1982
+ });
1983
+ try {
1984
+ const options = bridge?.bridge.supportsToolResultSuppression === false ? void 0 : { suppressResponse: true };
1985
+ await bridge?.submitToolResult(callId, result, options);
1986
+ params.remember({
1987
+ type: "tool.result",
1988
+ turnId,
1989
+ callId,
1990
+ payload: {
1991
+ name: event.name,
1992
+ result
1993
+ },
1994
+ final: true
1995
+ });
1996
+ } catch (error) {
1997
+ const message = formatErrorMessage(error);
1998
+ params.logger.debug?.(`[facetime] hangup tool result ignored: ${message}`);
1999
+ params.remember({
2000
+ type: "tool.error",
2001
+ turnId,
2002
+ callId,
2003
+ payload: {
2004
+ name: event.name,
2005
+ error: message
2006
+ },
2007
+ final: true
2008
+ });
2009
+ }
2010
+ };
2011
+ const submitToolError = async (event, error) => {
2012
+ const callId = event.callId || event.itemId;
2013
+ const generation = params.getGeneration();
2014
+ params.remember({
2015
+ type: "tool.error",
2016
+ callId,
2017
+ payload: {
2018
+ name: event.name,
2019
+ error
2020
+ },
2021
+ final: true
2022
+ });
2023
+ try {
2024
+ const bridge = params.getBridge();
2025
+ if (!bridge) throw new Error("Realtime bridge unavailable during tool error delivery");
2026
+ await bridge.submitToolResult(callId, { error });
2027
+ } catch (failure) {
2028
+ if (generation === params.getGeneration() && !params.isUnavailable()) await failDelivery({
2029
+ callId,
2030
+ name: event.name
2031
+ }, failure, "tool-error-delivery-failed");
2032
+ }
2033
+ };
2034
+ const handleToolCall = async (event) => {
2035
+ if (params.isUnavailable()) return;
2036
+ const callId = event.callId || event.itemId;
2037
+ if (event.name === "facetime_end_call") {
2038
+ const shouldRequestHangup = !hangupRequested;
2039
+ hangupRequested = true;
2040
+ await submitHangupResult(event);
2041
+ if (shouldRequestHangup) try {
2042
+ await params.onHangupRequested();
2043
+ } catch (error) {
2044
+ params.logger.warn?.(`[facetime] caller-requested hangup remains pending: ${formatErrorMessage(error)}`);
2045
+ }
2046
+ return;
2047
+ }
2048
+ if (event.name !== REALTIME_VOICE_AGENT_CONSULT_TOOL_NAME) {
2049
+ await submitToolError(event, `Tool "${event.name}" not available`);
2050
+ return;
2051
+ }
2052
+ cancelPending();
2053
+ const turnId = params.ensureTurn();
2054
+ const consult = {
2055
+ callId,
2056
+ turnId,
2057
+ name: event.name,
2058
+ cancelRequested: false,
2059
+ terminalSubmitted: false,
2060
+ generation: params.getGeneration(),
2061
+ abortController: new AbortController()
2062
+ };
2063
+ pending.set(callId, consult);
2064
+ params.remember({
2065
+ type: "tool.call",
2066
+ turnId,
2067
+ itemId: event.itemId,
2068
+ callId,
2069
+ payload: {
2070
+ name: event.name,
2071
+ args: event.args
2072
+ }
2073
+ });
2074
+ params.remember({
2075
+ type: "tool.progress",
2076
+ turnId,
2077
+ callId,
2078
+ payload: {
2079
+ name: event.name,
2080
+ status: "working"
2081
+ }
2082
+ });
2083
+ const bridge = params.getBridge();
2084
+ if (bridge?.bridge.supportsToolResultContinuation) {
2085
+ try {
2086
+ await bridge.submitToolResult(callId, buildRealtimeVoiceAgentConsultWorkingResponse("caller"), { willContinue: true });
2087
+ } catch (error) {
2088
+ if (ownsConsult(consult) && !consult.cancelRequested) {
2089
+ pending.delete(callId);
2090
+ await failDelivery(consult, error, "consult-working-delivery-failed");
2091
+ }
2092
+ return;
2093
+ }
2094
+ if (!ownsConsult(consult) || consult.cancelRequested) return;
2095
+ }
2096
+ const deliverResult = async (result, backendError) => {
2097
+ if (!ownsConsult(consult) || consult.cancelRequested) return;
2098
+ consult.terminalSubmitted = true;
2099
+ try {
2100
+ const currentBridge = params.getBridge();
2101
+ if (!currentBridge) throw new Error("Realtime bridge unavailable during agent consult delivery");
2102
+ await currentBridge.submitToolResult(callId, result);
2103
+ } catch (error) {
2104
+ if (ownsConsult(consult)) {
2105
+ pending.delete(callId);
2106
+ await failDelivery(consult, error, "consult-result-delivery-failed");
2107
+ }
2108
+ return;
2109
+ }
2110
+ if (!ownsConsult(consult)) return;
2111
+ pending.delete(callId);
2112
+ params.remember({
2113
+ type: backendError === void 0 ? "tool.result" : "tool.error",
2114
+ turnId,
2115
+ callId,
2116
+ payload: backendError === void 0 ? {
2117
+ name: event.name,
2118
+ result
2119
+ } : {
2120
+ name: event.name,
2121
+ error: backendError
2122
+ },
2123
+ final: true
2124
+ });
2125
+ };
2126
+ consultRealtimeVoiceAgent({
2127
+ cfg: params.fullConfig,
2128
+ agentRuntime: params.runtime.agent,
2129
+ logger: params.logger,
2130
+ agentId: params.consultAgentId,
2131
+ sessionKey: params.consultSessionKey,
2132
+ spawnedBy: params.requesterSessionKey,
2133
+ senderId: params.senderId,
2134
+ senderIsOwner: params.senderIsOwner,
2135
+ contextMode: "fork",
2136
+ messageProvider: AGENT_CONSULT_MESSAGE_PROVIDER,
2137
+ lane: `facetime:${params.normalizedCallUUID}`,
2138
+ runIdPrefix: `facetime:${params.normalizedCallUUID}`,
2139
+ args: event.args,
2140
+ transcript: params.transcript,
2141
+ surface: "a private FaceTime call",
2142
+ userLabel: "Caller",
2143
+ assistantLabel: "Assistant",
2144
+ questionSourceLabel: "caller",
2145
+ toolsAllow: resolveRealtimeVoiceAgentConsultToolsAllow(params.config.realtime.toolPolicy),
2146
+ extraSystemPrompt: CONSULT_SYSTEM_PROMPT,
2147
+ thinkLevel: "off",
2148
+ abortSignal: consult.abortController.signal,
2149
+ onRunStarted: ({ runId }) => {
2150
+ const registration = {
2151
+ runId,
2152
+ controller: new AbortController()
2153
+ };
2154
+ consult.runRegistration = registration;
2155
+ if (consult.cancelRequested || pending.get(consult.callId) !== consult) registration.controller.abort(/* @__PURE__ */ new Error("FaceTime agent consult was already cancelled"));
2156
+ return {
2157
+ abortSignal: registration.controller.signal,
2158
+ cleanup: () => {
2159
+ if (consult.runRegistration === registration) consult.runRegistration = void 0;
2160
+ }
2161
+ };
2162
+ }
2163
+ }).then((result) => deliverResult(result), async (error) => {
2164
+ if (!ownsConsult(consult) || consult.cancelRequested) return;
2165
+ const message = formatErrorMessage(error);
2166
+ params.logger.warn?.(`[facetime] agent consult failed: ${message}`);
2167
+ await deliverResult({ error: message }, message);
2168
+ });
2169
+ };
2170
+ return {
2171
+ abortForClose,
2172
+ handleToolCall
2173
+ };
2174
+ }
2175
+ //#endregion
2176
+ //#region extensions/facetime/src/talk-initial-greeting.ts
2177
+ const FACETIME_INITIAL_GREETING = "Greet the caller briefly, introduce yourself using your configured identity, and ask how you can help.";
2178
+ const FACETIME_GREETING_MEDIA_SETTLE_MS = 100;
2179
+ function createFaceTimeInitialGreeting(params) {
2180
+ let timer;
2181
+ let dismissed = false;
2182
+ const clear = () => {
2183
+ if (timer) {
2184
+ clearTimeout(timer);
2185
+ timer = void 0;
2186
+ }
2187
+ };
2188
+ return {
2189
+ instructions: FACETIME_INITIAL_GREETING,
2190
+ schedule() {
2191
+ if (dismissed || timer) return;
2192
+ timer = setTimeout(() => {
2193
+ timer = void 0;
2194
+ dismissed = true;
2195
+ params.speak(FACETIME_INITIAL_GREETING);
2196
+ }, params.delayMs ?? FACETIME_GREETING_MEDIA_SETTLE_MS);
2197
+ timer.unref?.();
2198
+ },
2199
+ cancel() {
2200
+ dismissed = true;
2201
+ clear();
2202
+ }
2203
+ };
2204
+ }
2205
+ //#endregion
2206
+ //#region extensions/facetime/src/talk-driver.ts
2207
+ async function startFaceTimeTalkDriver(params) {
2208
+ if (params.signal?.aborted) throw new Error("FaceTime talk startup aborted");
2209
+ assertAuthenticatedSenderConsultSupport();
2210
+ const consultAgentId = agentIdFromSessionKey(params.config.realtime.sessionKey, params.fullConfig);
2211
+ const normalizedCallUUID = params.callUUID.trim().toLowerCase();
2212
+ const consultSessionKey = `agent:${consultAgentId}:facetime:${normalizedCallUUID}`;
2213
+ const requesterSessionKey = params.config.realtime.sessionKey.startsWith("agent:") ? params.config.realtime.sessionKey : `agent:${consultAgentId}:${params.config.realtime.sessionKey}`;
2214
+ const talk = createTalkSessionController({
2215
+ sessionId: `facetime:${params.callUUID}`,
2216
+ mode: "realtime",
2217
+ transport: "gateway-relay",
2218
+ brain: "agent-consult",
2219
+ provider: params.config.realtime.provider,
2220
+ maxRecentEvents: 40,
2221
+ turnIdPrefix: `facetime:${params.callUUID}:turn`
2222
+ }, { onEvent: recordTalkObservabilityEvent });
2223
+ const transcript = [];
2224
+ const appendTranscript = (entry) => {
2225
+ recordRealtimeVoiceTranscript(transcript, entry.role, entry.text.slice(0, MAX_TRANSCRIPT_ENTRY_CHARS), 40);
2226
+ while (transcript.reduce((total, current) => total + current.text.length, 0) > MAX_TRANSCRIPT_CHARS) transcript.shift();
2227
+ };
2228
+ let stopped = false;
2229
+ let mediaSuspended = false;
2230
+ let bridge;
2231
+ let lastInputAudioStatusAt = 0;
2232
+ let callMediaTimestampMs = 0;
2233
+ let modelMediaGeneration = 1;
2234
+ let responseGeneration = 0;
2235
+ let response;
2236
+ const settledResponseIds = /* @__PURE__ */ new Set();
2237
+ let suppressNextUnkeyedLegacyTerminal = false;
2238
+ const consultRef = {};
2239
+ let failurePromise;
2240
+ let activated = false;
2241
+ let providerReady = false;
2242
+ const providerReadyDeferred = createDeferred();
2243
+ let providerConnectPromise;
2244
+ let audioReadyPromise;
2245
+ let interruptProviderConnect;
2246
+ let mediaSuspensionError;
2247
+ const mediaSuspendedDeferred = createDeferred();
2248
+ const mediaSuspendedPromise = mediaSuspendedDeferred.promise;
2249
+ mediaSuspendedPromise.catch(() => {});
2250
+ let suspendMediaPromise;
2251
+ let closePromise;
2252
+ let startupSettled = false;
2253
+ let startupFailure;
2254
+ const startupFailureDeferred = createDeferred();
2255
+ const startupFailurePromise = startupFailureDeferred.promise;
2256
+ startupFailurePromise.catch(() => {});
2257
+ const signalStartupFailure = (error) => {
2258
+ if (startupSettled || startupFailure) return;
2259
+ startupFailure = error;
2260
+ startupFailureDeferred.reject(error);
2261
+ };
2262
+ const initialGreeting = createFaceTimeInitialGreeting({ speak: (instructions) => {
2263
+ if (!stopped && !mediaSuspended && activated && providerReady) bridge?.triggerGreeting(instructions);
2264
+ } });
2265
+ const reportFailure = (error) => {
2266
+ if (failurePromise) return failurePromise;
2267
+ failurePromise = Promise.resolve(params.onFailure?.(error)).then((safeToClose) => {
2268
+ return safeToClose !== false;
2269
+ });
2270
+ return failurePromise;
2271
+ };
2272
+ const suspendMedia = async (reason = "suspended") => {
2273
+ if (suspendMediaPromise) return await suspendMediaPromise;
2274
+ mediaSuspended = true;
2275
+ activated = false;
2276
+ initialGreeting.cancel();
2277
+ providerReady = false;
2278
+ mediaSuspensionError ??= /* @__PURE__ */ new Error(`FaceTime model media suspended: ${reason}`);
2279
+ mediaSuspendedDeferred.reject(mediaSuspensionError);
2280
+ interruptProviderConnect?.();
2281
+ consultRef.current?.abortForClose();
2282
+ suspendMediaPromise = (async () => {
2283
+ try {
2284
+ await bridge?.close();
2285
+ } catch (error) {
2286
+ params.logger.debug?.(`[facetime] realtime bridge close ignored: ${formatErrorMessage(error)}`);
2287
+ }
2288
+ try {
2289
+ await pump?.suspendMedia();
2290
+ } catch (error) {
2291
+ params.logger.warn?.(`[facetime] native media suspension failed: ${formatErrorMessage(error)}`);
2292
+ }
2293
+ resetResponsePlayback();
2294
+ finishOutputAudio(reason);
2295
+ })();
2296
+ return await suspendMediaPromise;
2297
+ };
2298
+ const close = async (reason = "closed") => {
2299
+ if (closePromise) return await closePromise;
2300
+ closePromise = (async () => {
2301
+ const mediaStop = suspendMedia(reason);
2302
+ stopped = true;
2303
+ try {
2304
+ await mediaStop;
2305
+ } finally {
2306
+ try {
2307
+ await pump?.stop();
2308
+ } finally {
2309
+ remember({
2310
+ type: "session.closed",
2311
+ payload: { reason },
2312
+ final: true
2313
+ });
2314
+ }
2315
+ }
2316
+ })();
2317
+ return await closePromise;
2318
+ };
2319
+ const remember = (input) => talk.emit(input);
2320
+ const ensureTurn = () => {
2321
+ return talk.ensureTurn({ payload: { callUUID: params.callUUID } }).turnId;
2322
+ };
2323
+ const finishOutputAudio = (reason) => {
2324
+ talk.finishOutputAudio({ payload: { reason } });
2325
+ };
2326
+ const endTurn = (reason) => {
2327
+ return talk.endTurn({ payload: { reason } }).ok;
2328
+ };
2329
+ const playedCurrentResponseMs = () => response === void 0 ? 0 : Math.max(0, ((pump?.playedAudioFrames() ?? 0) - response.playbackStartFrame) / 24);
2330
+ const resetResponsePlayback = () => {
2331
+ response = void 0;
2332
+ };
2333
+ const finishDrainedResponse = () => {
2334
+ const current = response;
2335
+ if (!current || current.outcome?.status !== "completed") return;
2336
+ callMediaTimestampMs = Math.max(callMediaTimestampMs, current.startTimestampMs + playedCurrentResponseMs());
2337
+ bridge?.setMediaTimestamp(Math.floor(callMediaTimestampMs));
2338
+ rememberSettledResponse(current.id);
2339
+ resetResponsePlayback();
2340
+ finishOutputAudio("playback-drained");
2341
+ endTurn("completed");
2342
+ };
2343
+ const rememberSettledResponse = (responseId) => {
2344
+ if (!responseId) return;
2345
+ settledResponseIds.add(responseId);
2346
+ if (settledResponseIds.size > 64) {
2347
+ const oldest = settledResponseIds.values().next().value;
2348
+ if (oldest) settledResponseIds.delete(oldest);
2349
+ }
2350
+ };
2351
+ const startResponse = (responseId) => {
2352
+ if (response && responseId && response.id === responseId) return;
2353
+ if (response && responseId && !response.id) {
2354
+ response.id = responseId;
2355
+ return;
2356
+ }
2357
+ if (response) {
2358
+ pump?.clearOutputAudio();
2359
+ finishOutputAudio("response-superseded");
2360
+ endTurn("response-superseded");
2361
+ }
2362
+ response = {
2363
+ id: responseId,
2364
+ generation: ++responseGeneration,
2365
+ startTimestampMs: callMediaTimestampMs,
2366
+ playbackStartFrame: pump?.playedAudioFrames() ?? 0
2367
+ };
2368
+ bridge?.setMediaTimestamp(Math.floor(callMediaTimestampMs));
2369
+ };
2370
+ const finishResponseOutcome = (outcome, typed) => {
2371
+ if (outcome.responseId && settledResponseIds.has(outcome.responseId)) return;
2372
+ if (outcome.responseId && response?.id && outcome.responseId !== response.id) return;
2373
+ if (!response) startResponse(outcome.responseId);
2374
+ if (!response) return;
2375
+ response.outcome = outcome;
2376
+ if (!outcome.responseId && typed) suppressNextUnkeyedLegacyTerminal = true;
2377
+ if (outcome.status === "completed") {
2378
+ pump?.finishOutputAudio();
2379
+ if ((pump?.queuedAudioFrames() ?? 0) <= 0) finishDrainedResponse();
2380
+ return;
2381
+ }
2382
+ pump?.clearOutputAudio();
2383
+ if (outcome.status === "failed" || outcome.status === "incomplete") remember({
2384
+ type: "session.error",
2385
+ payload: outcome,
2386
+ final: true
2387
+ });
2388
+ rememberSettledResponse(outcome.responseId);
2389
+ finishOutputAudio(outcome.status);
2390
+ endTurn(outcome.status);
2391
+ resetResponsePlayback();
2392
+ };
2393
+ const resetProviderContinuity = () => {
2394
+ modelMediaGeneration += 1;
2395
+ consultRef.current?.abortForClose();
2396
+ pump?.clearOutputAudio();
2397
+ resetResponsePlayback();
2398
+ finishOutputAudio("continuity-reset");
2399
+ endTurn("continuity-reset");
2400
+ };
2401
+ const consultController = createFaceTimeConsultController({
2402
+ config: params.config,
2403
+ fullConfig: params.fullConfig,
2404
+ runtime: params.runtime,
2405
+ logger: params.logger,
2406
+ consultAgentId,
2407
+ consultSessionKey,
2408
+ requesterSessionKey,
2409
+ normalizedCallUUID,
2410
+ senderId: params.senderId,
2411
+ senderIsOwner: params.senderIsOwner,
2412
+ transcript,
2413
+ getBridge: () => bridge,
2414
+ getGeneration: () => modelMediaGeneration,
2415
+ isUnavailable: () => stopped || mediaSuspended,
2416
+ ensureTurn,
2417
+ remember,
2418
+ suspendMedia,
2419
+ reportFailure,
2420
+ close,
2421
+ onHangupRequested: params.onHangupRequested
2422
+ });
2423
+ consultRef.current = consultController;
2424
+ remember({
2425
+ type: "session.started",
2426
+ payload: { callUUID: params.callUUID }
2427
+ });
2428
+ const pump = startFaceTimeAudioPump({
2429
+ captureBinary: params.captureBinary,
2430
+ logger: params.logger,
2431
+ onInputAudio(audio) {
2432
+ if (stopped || mediaSuspended || !activated) return;
2433
+ callMediaTimestampMs += audio.byteLength / 2 / 24;
2434
+ if (!talk.outputAudioActive) bridge?.setMediaTimestamp(Math.floor(callMediaTimestampMs));
2435
+ const now = Date.now();
2436
+ if (now - lastInputAudioStatusAt >= 1e3) {
2437
+ lastInputAudioStatusAt = now;
2438
+ remember({
2439
+ type: "input.audio.delta",
2440
+ turnId: ensureTurn(),
2441
+ payload: { byteLength: audio.byteLength }
2442
+ });
2443
+ }
2444
+ bridge?.sendAudio(audio);
2445
+ },
2446
+ onSuppressionLost(error) {
2447
+ reportFailure(error);
2448
+ },
2449
+ async onError(error) {
2450
+ signalStartupFailure(error);
2451
+ remember({
2452
+ type: "session.error",
2453
+ payload: { message: formatErrorMessage(error) },
2454
+ final: true
2455
+ });
2456
+ await suspendMedia("audio-error");
2457
+ const safeToClose = await reportFailure(error);
2458
+ if (safeToClose) await close("audio-error");
2459
+ return safeToClose;
2460
+ },
2461
+ onPlaybackDrained() {
2462
+ finishDrainedResponse();
2463
+ }
2464
+ });
2465
+ const connectProvider = async () => {
2466
+ if (providerConnectPromise) return await providerConnectPromise;
2467
+ providerConnectPromise = (async () => {
2468
+ let removeAbortListener;
2469
+ let readinessTimer;
2470
+ const interrupted = new Promise((_resolve, reject) => {
2471
+ const interrupt = () => reject(/* @__PURE__ */ new Error("FaceTime talk startup aborted"));
2472
+ interruptProviderConnect = interrupt;
2473
+ params.signal?.addEventListener("abort", interrupt, { once: true });
2474
+ removeAbortListener = () => params.signal?.removeEventListener("abort", interrupt);
2475
+ if (params.signal?.aborted || stopped || mediaSuspended) interrupt();
2476
+ });
2477
+ const readinessTimedOut = new Promise((_resolve, reject) => {
2478
+ readinessTimer = setTimeout(() => {
2479
+ reject(/* @__PURE__ */ new Error("Realtime provider was not ready within 15 seconds"));
2480
+ }, REALTIME_READY_TIMEOUT_MS);
2481
+ readinessTimer.unref?.();
2482
+ });
2483
+ const prepareAndConnect = async () => {
2484
+ const providerResolution = resolveFaceTimeRealtimeProvider({
2485
+ config: params.config,
2486
+ fullConfig: params.fullConfig,
2487
+ agentId: consultAgentId
2488
+ });
2489
+ const bootstrapContextResolution = resolveRealtimeBootstrapContextInstructions({
2490
+ config: params.fullConfig,
2491
+ agentId: consultAgentId,
2492
+ sessionKey: requesterSessionKey,
2493
+ warn: (message) => params.logger.warn?.(`[facetime] realtime bootstrap context: ${message}`)
2494
+ }).catch((error) => {
2495
+ params.logger.warn?.(`[facetime] realtime bootstrap context unavailable: ${formatErrorMessage(error)}`);
2496
+ });
2497
+ const [resolved, bootstrapContext] = await Promise.all([providerResolution, bootstrapContextResolution]);
2498
+ if (params.signal?.aborted || stopped || mediaSuspended) throw new Error("FaceTime talk startup aborted");
2499
+ bridge = createRealtimeVoiceBridgeSession({
2500
+ provider: resolved.provider,
2501
+ capabilities: resolved.capabilities,
2502
+ cfg: params.fullConfig,
2503
+ agentId: consultAgentId,
2504
+ providerConfig: resolved.providerConfig,
2505
+ audioFormat: REALTIME_VOICE_AUDIO_FORMAT_PCM16_24KHZ,
2506
+ instructions: buildRealtimeInstructions({
2507
+ instructions: params.config.realtime.instructions,
2508
+ bootstrapContext,
2509
+ toolPolicy: params.config.realtime.toolPolicy
2510
+ }),
2511
+ autoRespondToAudio: true,
2512
+ triggerGreetingOnReady: false,
2513
+ initialGreetingInstructions: initialGreeting.instructions,
2514
+ markStrategy: "ack-immediately",
2515
+ tools: resolveRealtimeVoiceAgentConsultTools(params.config.realtime.toolPolicy, [FACETIME_END_CALL_TOOL]),
2516
+ audioSink: {
2517
+ isOpen: () => !stopped && !mediaSuspended,
2518
+ sendAudio(audio, metadata) {
2519
+ if (stopped || mediaSuspended) return;
2520
+ const turnId = ensureTurn();
2521
+ if (!response) startResponse();
2522
+ talk.startOutputAudio({
2523
+ turnId,
2524
+ payload: { callUUID: params.callUUID }
2525
+ });
2526
+ remember({
2527
+ type: "output.audio.delta",
2528
+ turnId,
2529
+ payload: { byteLength: audio.byteLength }
2530
+ });
2531
+ pump?.writeOutputAudio(audio, metadata);
2532
+ },
2533
+ getPlaybackState: () => pump.getPlaybackState(),
2534
+ clearAudio() {
2535
+ if (stopped || mediaSuspended) return;
2536
+ pump?.clearOutputAudio();
2537
+ resetResponsePlayback();
2538
+ finishOutputAudio("clear");
2539
+ }
2540
+ },
2541
+ onTranscript(role, text, final) {
2542
+ if (stopped || mediaSuspended) return;
2543
+ const turnId = ensureTurn();
2544
+ remember({
2545
+ type: role === "assistant" ? final ? "output.text.done" : "output.text.delta" : final ? "transcript.done" : "transcript.delta",
2546
+ turnId,
2547
+ payload: role === "assistant" ? { text } : {
2548
+ role,
2549
+ text
2550
+ },
2551
+ final
2552
+ });
2553
+ if (role === "user" && final) {
2554
+ if (text.trim()) initialGreeting.cancel();
2555
+ else initialGreeting.schedule();
2556
+ remember({
2557
+ type: "input.audio.committed",
2558
+ turnId,
2559
+ payload: { callUUID: params.callUUID },
2560
+ final: true
2561
+ });
2562
+ }
2563
+ if (final) appendTranscript({
2564
+ role,
2565
+ text
2566
+ });
2567
+ },
2568
+ onEvent(event) {
2569
+ if (stopped || mediaSuspended) return;
2570
+ if (!(event.direction === "client" && event.type === "input_audio_buffer.append")) remember({
2571
+ type: "health.changed",
2572
+ payload: {
2573
+ name: `${event.direction}:${event.type}`,
2574
+ message: event.detail
2575
+ }
2576
+ });
2577
+ if (event.type === "response.created") startResponse(event.responseId);
2578
+ else if (event.type === "session.continuity.reset") resetProviderContinuity();
2579
+ else if (event.type === "response.done") {
2580
+ if (!event.responseId && suppressNextUnkeyedLegacyTerminal) suppressNextUnkeyedLegacyTerminal = false;
2581
+ else finishResponseOutcome({
2582
+ status: "completed",
2583
+ ...event.responseId ? { responseId: event.responseId } : {}
2584
+ }, false);
2585
+ } else if (event.type === "error") remember({
2586
+ type: "session.error",
2587
+ payload: { message: event.detail ?? "Realtime provider error" },
2588
+ final: true
2589
+ });
2590
+ },
2591
+ onResponseDone(outcome) {
2592
+ finishResponseOutcome(outcome, true);
2593
+ },
2594
+ onToolCall: consultController.handleToolCall,
2595
+ onReady() {
2596
+ if (!stopped && !mediaSuspended) {
2597
+ remember({
2598
+ type: "session.ready",
2599
+ payload: { callUUID: params.callUUID }
2600
+ });
2601
+ providerReadyDeferred.resolve();
2602
+ }
2603
+ },
2604
+ onError(error) {
2605
+ if (stopped || mediaSuspended) return;
2606
+ remember({
2607
+ type: "session.error",
2608
+ payload: { message: formatErrorMessage(error) },
2609
+ final: true
2610
+ });
2611
+ params.logger.warn(`[facetime] realtime bridge failed: ${formatErrorMessage(error)}`);
2612
+ if (!providerReady && !startupSettled) signalStartupFailure(error);
2613
+ },
2614
+ onClose(reason) {
2615
+ if (stopped || mediaSuspended) return;
2616
+ finishOutputAudio(reason);
2617
+ remember({
2618
+ type: "session.closed",
2619
+ payload: { reason },
2620
+ final: true
2621
+ });
2622
+ const error = /* @__PURE__ */ new Error(`Realtime bridge closed unexpectedly: ${reason}`);
2623
+ signalStartupFailure(error);
2624
+ (async () => {
2625
+ await suspendMedia("provider-closed");
2626
+ if (await reportFailure(error)) await close("provider-closed");
2627
+ })();
2628
+ }
2629
+ });
2630
+ await bridge.connect();
2631
+ };
2632
+ try {
2633
+ await Promise.race([
2634
+ Promise.all([prepareAndConnect(), providerReadyDeferred.promise]),
2635
+ startupFailurePromise,
2636
+ interrupted,
2637
+ readinessTimedOut
2638
+ ]);
2639
+ if (startupFailure) throw startupFailure;
2640
+ if (params.signal?.aborted || stopped || mediaSuspended) throw new Error("FaceTime talk startup aborted");
2641
+ startupSettled = true;
2642
+ providerReady = true;
2643
+ } catch (error) {
2644
+ const normalized = error instanceof Error ? error : new Error(String(error));
2645
+ await suspendMedia(params.signal?.aborted || stopped ? "startup-aborted" : "connect-failed");
2646
+ if (stopped || await reportFailure(normalized)) await close(params.signal?.aborted || stopped ? "startup-aborted" : "connect-failed");
2647
+ throw normalized;
2648
+ } finally {
2649
+ if (readinessTimer) clearTimeout(readinessTimer);
2650
+ interruptProviderConnect = void 0;
2651
+ removeAbortListener?.();
2652
+ }
2653
+ })();
2654
+ return await providerConnectPromise;
2655
+ };
2656
+ const providerConnect = connectProvider();
2657
+ providerConnect.catch(() => {});
2658
+ try {
2659
+ await Promise.race([pump.suppressionReady(), startupFailurePromise]);
2660
+ } catch (error) {
2661
+ const normalized = error instanceof Error ? error : new Error(String(error));
2662
+ await suspendMedia("capture-start-failed");
2663
+ if (startupFailure === normalized ? await reportFailure(normalized) : true) await close("capture-start-failed");
2664
+ throw error;
2665
+ }
2666
+ return {
2667
+ callUUID: params.callUUID,
2668
+ get recentTalkEvents() {
2669
+ return talk.recentEvents;
2670
+ },
2671
+ async readyForAudio() {
2672
+ audioReadyPromise ??= providerConnect.then(async () => {
2673
+ await Promise.race([pump?.routeReady(), mediaSuspendedPromise]);
2674
+ if (mediaSuspended || stopped) throw mediaSuspensionError ?? /* @__PURE__ */ new Error("FaceTime model media is unavailable");
2675
+ });
2676
+ await audioReadyPromise;
2677
+ },
2678
+ processOutputSuppressed() {
2679
+ return pump?.processOutputSuppressed() ?? false;
2680
+ },
2681
+ realtimeActive() {
2682
+ return providerReady && !mediaSuspended && !stopped;
2683
+ },
2684
+ activate() {
2685
+ if (stopped || mediaSuspended || !providerReady || activated) return;
2686
+ activated = true;
2687
+ initialGreeting.schedule();
2688
+ },
2689
+ suspendMedia,
2690
+ close
2691
+ };
2692
+ }
2693
+ //#endregion
2694
+ //#region extensions/facetime/src/runtime-call-control.ts
2695
+ function createFaceTimeCallControl(params) {
2696
+ const runCarrierActionAcrossAliases = async (request) => {
2697
+ const candidates = [request.call.carrierCallUUID, ...[...request.call.carrierCallUUIDs].toReversed()].filter((candidate, index, all) => all.indexOf(candidate) === index);
2698
+ let lastAbsent;
2699
+ for (const candidate of candidates) {
2700
+ let result;
2701
+ try {
2702
+ result = await request.call.runCarrierCommand({
2703
+ generation: request.generation,
2704
+ allowClosing: true,
2705
+ action: async () => await request.run(candidate)
2706
+ });
2707
+ } catch (error) {
2708
+ if (!(error instanceof FaceTimeHelperAmbiguousError)) throw error;
2709
+ try {
2710
+ projectCompleteFaceTimeAbsence(error.result);
2711
+ lastAbsent = error;
2712
+ } catch {
2713
+ throw error;
2714
+ }
2715
+ continue;
2716
+ }
2717
+ try {
2718
+ projectFaceTimeNativeAction(request.action, result);
2719
+ request.call.promoteCarrierCallUUID(candidate);
2720
+ return result;
2721
+ } catch (error) {
2722
+ try {
2723
+ projectCompleteFaceTimeAbsence(result);
2724
+ lastAbsent = error instanceof FaceTimeHelperAmbiguousError ? error : new FaceTimeHelperAmbiguousError(`FaceTime ${request.action} carrier owner is missing`, result);
2725
+ } catch {
2726
+ throw error;
2727
+ }
2728
+ }
2729
+ }
2730
+ throw lastAbsent ?? /* @__PURE__ */ new Error(`FaceTime ${request.action} carrier owner is missing`);
2731
+ };
2732
+ const routeCallAudio = async (call) => {
2733
+ if (!call.audioReady) {
2734
+ const routing = call.audioRouting ?? (async () => {
2735
+ const assertCallOpen = () => {
2736
+ if (call.lifecycleAbort.signal.aborted || params.calls.get(call.callUUID) !== call) throw new Error("FaceTime call closed during audio routing");
2737
+ };
2738
+ assertCallOpen();
2739
+ await access(params.captureBinary, constants.X_OK);
2740
+ assertCallOpen();
2741
+ call.audioReady = true;
2742
+ call.audioTransport = {
2743
+ captureBinary: params.captureBinary,
2744
+ feedDevice: "OpenClaw-Feed",
2745
+ microphoneDevice: "OpenClaw-Mic",
2746
+ processInputVerified: false,
2747
+ processOutputSuppressed: false
2748
+ };
2749
+ call.lastRoutingError = void 0;
2750
+ })();
2751
+ call.audioRouting = routing;
2752
+ try {
2753
+ await routing;
2754
+ } catch (error) {
2755
+ call.audioReady = false;
2756
+ call.lastRoutingError = formatErrorMessage(error);
2757
+ throw error;
2758
+ } finally {
2759
+ if (call.audioRouting === routing) call.audioRouting = void 0;
2760
+ }
2761
+ }
2762
+ if (call.lifecycleAbort.signal.aborted) throw new Error("FaceTime call closed during audio routing");
2763
+ };
2764
+ const enableCallAudio = async (call) => {
2765
+ const generation = call.captureGeneration();
2766
+ const mutedResult = await call.runCarrierCommand({
2767
+ generation,
2768
+ action: async () => await params.helper.setMuted(call.carrierCallUUID, false)
2769
+ });
2770
+ call.lastHelperAction = mutedResult;
2771
+ params.retainHelperResultPeers(call, mutedResult);
2772
+ projectFaceTimeNativeAction("unmute", mutedResult);
2773
+ const transmissionResult = await call.runCarrierCommand({
2774
+ generation,
2775
+ action: async () => await params.helper.startTransmission(call.carrierCallUUID)
2776
+ });
2777
+ call.lastHelperAction = transmissionResult;
2778
+ params.retainHelperResultPeers(call, transmissionResult);
2779
+ projectFaceTimeNativeAction("activate", transmissionResult);
2780
+ call.markCarrierActive(generation);
2781
+ if (call.audioTransport) {
2782
+ call.audioTransport.processInputVerified = true;
2783
+ call.audioTransport.processOutputSuppressed = call.talk?.processOutputSuppressed() === true;
2784
+ }
2785
+ };
2786
+ const closeCall = async (call, reason) => {
2787
+ if (params.calls.active !== call) return;
2788
+ if (call.carrierHangupRetryTimer) {
2789
+ clearTimeout(call.carrierHangupRetryTimer);
2790
+ call.carrierHangupRetryTimer = void 0;
2791
+ }
2792
+ call.beginClosing();
2793
+ await call.audioRouting?.catch((error) => {
2794
+ params.logger.debug?.(`[facetime] audio routing cancellation for active call: ${formatErrorMessage(error)}`);
2795
+ });
2796
+ await call.talkStarting?.catch((error) => {
2797
+ params.logger.debug?.(`[facetime] talk startup cancellation for active call: ${formatErrorMessage(error)}`);
2798
+ });
2799
+ await call.talk?.close(reason).catch((error) => {
2800
+ params.logger.debug?.(`[facetime] talk close ignored for active call: ${formatErrorMessage(error)}`);
2801
+ });
2802
+ await call.talkActivation?.catch((error) => {
2803
+ params.logger.debug?.(`[facetime] talk activation cancellation for active call: ${formatErrorMessage(error)}`);
2804
+ });
2805
+ call.audioReady = false;
2806
+ call.audioTransport = void 0;
2807
+ params.calls.close(call);
2808
+ params.logger.info(`[facetime] call closed (${reason})`);
2809
+ };
2810
+ const attemptCarrierHangup = async (call, reason, options = {}) => {
2811
+ const closeLocal = options.closeLocal !== false;
2812
+ const scheduleRetry = options.scheduleRetry !== false;
2813
+ if (params.calls.active !== call) return true;
2814
+ if (call.carrierMode === "closed") {
2815
+ if (closeLocal) await closeCall(call, reason);
2816
+ return true;
2817
+ }
2818
+ const generation = call.beginClosing();
2819
+ call.carrierHangupPending = true;
2820
+ call.talk?.suspendMedia(reason).catch((error) => {
2821
+ params.logger.warn(`[facetime] local media suspension failed: ${formatErrorMessage(error)}`);
2822
+ });
2823
+ const attempt = call.carrierHangupAttempt ?? (async () => {
2824
+ const topologyVersion = params.getHelperTopologyVersion();
2825
+ const readCompleteAbsenceGeneration = (error) => {
2826
+ if (!(error instanceof FaceTimeHelperAmbiguousError)) return;
2827
+ try {
2828
+ return projectCompleteFaceTimeAbsence(error.result).topologyGeneration;
2829
+ } catch {
2830
+ return;
2831
+ }
2832
+ };
2833
+ try {
2834
+ const muted = await runCarrierActionAcrossAliases({
2835
+ call,
2836
+ generation,
2837
+ action: "safe-mute",
2838
+ run: async (callUUID) => await params.helper.safetyMute(callUUID)
2839
+ });
2840
+ params.retainHelperResultPeers(call, muted);
2841
+ } catch (error) {
2842
+ if (readCompleteAbsenceGeneration(error) === void 0) params.logger.warn(`[facetime] failed to confirm carrier safety mute: ${formatErrorMessage(error)}`);
2843
+ }
2844
+ try {
2845
+ const leave = await runCarrierActionAcrossAliases({
2846
+ call,
2847
+ generation,
2848
+ action: "terminate",
2849
+ run: async (callUUID) => await params.helper.leaveCall(callUUID)
2850
+ });
2851
+ params.retainHelperResultPeers(call, leave);
2852
+ } catch (error) {
2853
+ if (readCompleteAbsenceGeneration(error) === void 0) params.logger.warn(`[facetime] carrier termination request failed: ${formatErrorMessage(error)}`);
2854
+ }
2855
+ try {
2856
+ const inspect = async () => await call.runCarrierCommand({
2857
+ generation,
2858
+ allowClosing: true,
2859
+ action: async () => await params.helper.inspectCall([...call.carrierCallUUIDs], [...call.carrierPeers.keys()])
2860
+ });
2861
+ const first = projectCompleteFaceTimeAbsence(await inspect());
2862
+ await new Promise((resolve) => {
2863
+ setTimeout(resolve, 100).unref?.();
2864
+ });
2865
+ const second = projectCompleteFaceTimeAbsence(await inspect());
2866
+ return first.topologyGeneration === second.topologyGeneration && params.getHelperTopologyVersion() === topologyVersion;
2867
+ } catch {
2868
+ return false;
2869
+ }
2870
+ })();
2871
+ call.carrierHangupAttempt = attempt;
2872
+ let carrierClosed;
2873
+ try {
2874
+ carrierClosed = await attempt;
2875
+ } finally {
2876
+ if (call.carrierHangupAttempt === attempt) call.carrierHangupAttempt = void 0;
2877
+ }
2878
+ const currentCall = params.calls.active;
2879
+ if (currentCall !== call) return true;
2880
+ if (carrierClosed || currentCall.carrierMode === "closed") {
2881
+ call.markCarrierClosed();
2882
+ call.carrierHangupPending = false;
2883
+ if (closeLocal) await closeCall(call, reason);
2884
+ return true;
2885
+ }
2886
+ if (scheduleRetry && !call.carrierHangupRetryTimer) {
2887
+ call.carrierHangupRetryTimer = setTimeout(() => {
2888
+ call.carrierHangupRetryTimer = void 0;
2889
+ attemptCarrierHangup(call, reason);
2890
+ }, 1e3);
2891
+ call.carrierHangupRetryTimer.unref?.();
2892
+ }
2893
+ return false;
2894
+ };
2895
+ const waitForStartupCarrierHangup = async (call, reason) => {
2896
+ call.beginClosing();
2897
+ return await Promise.race([call.carrierClosure.then(() => true), (async () => {
2898
+ while (params.calls.active === call && call.phase === "closing" && call.carrierMode !== "closed") {
2899
+ if (await attemptCarrierHangup(call, reason, {
2900
+ closeLocal: false,
2901
+ scheduleRetry: false
2902
+ })) return true;
2903
+ await new Promise((resolve) => {
2904
+ setTimeout(resolve, 1e3).unref?.();
2905
+ });
2906
+ }
2907
+ return true;
2908
+ })()]);
2909
+ };
2910
+ const terminateCarrierProcesses = async (call) => {
2911
+ const generation = call.captureGeneration();
2912
+ await terminateExactCarrierProcesses({
2913
+ runtime: params.runtime,
2914
+ peers: call.carrierPeers,
2915
+ assertCurrent: () => call.assertCurrent(generation, true)
2916
+ });
2917
+ call.markCarrierClosed();
2918
+ };
2919
+ const stopCall = async (call) => {
2920
+ if (await attemptCarrierHangup(call, "runtime-stop", { scheduleRetry: false })) return;
2921
+ try {
2922
+ await terminateCarrierProcesses(call);
2923
+ await closeCall(call, "runtime-stop-carrier-terminated");
2924
+ } catch (error) {
2925
+ await call.talk?.suspendMedia("runtime-stop-carrier-unconfirmed");
2926
+ throw new Error(`FaceTime fail-closed carrier termination failed: ${formatErrorMessage(error)}; carrier closure remains unconfirmed`, { cause: error });
2927
+ }
2928
+ };
2929
+ const startCallTalk = async (call) => {
2930
+ if (call.talk) return;
2931
+ if (!call.talkStarting) {
2932
+ const callUUID = call.callUUID;
2933
+ call.talkStarting = (async () => {
2934
+ await routeCallAudio(call);
2935
+ const talk = await startFaceTimeTalkDriver({
2936
+ config: params.config,
2937
+ fullConfig: params.fullConfig,
2938
+ runtime: params.runtime,
2939
+ logger: params.logger,
2940
+ callUUID,
2941
+ senderId: call.senderId,
2942
+ senderIsOwner: call.senderIsOwner,
2943
+ captureBinary: params.captureBinary,
2944
+ signal: call.lifecycleAbort.signal,
2945
+ async onHangupRequested() {
2946
+ if (!await attemptCarrierHangup(call, "caller-requested-hangup")) throw new Error(`carrier hangup pending for ${call.callUUID}; retry scheduled`);
2947
+ },
2948
+ async onFailure(error) {
2949
+ const failureReason = `talk-failed: ${formatErrorMessage(error)}`;
2950
+ if (!call.talk) {
2951
+ const carrierClosed = await waitForStartupCarrierHangup(call, failureReason);
2952
+ if (carrierClosed) queueMicrotask(() => {
2953
+ closeCall(call, failureReason);
2954
+ });
2955
+ return carrierClosed;
2956
+ }
2957
+ const carrierClosed = await attemptCarrierHangup(call, failureReason, { closeLocal: false });
2958
+ if (carrierClosed) queueMicrotask(() => {
2959
+ closeCall(call, failureReason);
2960
+ });
2961
+ return carrierClosed;
2962
+ }
2963
+ });
2964
+ if (params.isStopping() || params.calls.active !== call) {
2965
+ await talk.close("call-ended-during-start");
2966
+ return;
2967
+ }
2968
+ call.talk = talk;
2969
+ if (call.audioTransport) call.audioTransport.processOutputSuppressed = true;
2970
+ params.logger.info("[facetime] realtime talk suppression ready");
2971
+ })();
2972
+ }
2973
+ const starting = call.talkStarting;
2974
+ try {
2975
+ await starting;
2976
+ } finally {
2977
+ if (call.talkStarting === starting) call.talkStarting = void 0;
2978
+ }
2979
+ };
2980
+ const activateCallTalk = async (call, options) => {
2981
+ const generation = call.captureGeneration();
2982
+ if (!call.talkActivation) call.talkActivation = (async () => {
2983
+ await call.talk?.readyForAudio();
2984
+ call.assertCurrent(generation);
2985
+ call.markModelReady(generation);
2986
+ if (options.unmute) await enableCallAudio(call);
2987
+ call.assertCurrent(generation);
2988
+ call.markModelActive(generation);
2989
+ call.talk?.activate();
2990
+ })();
2991
+ const activation = call.talkActivation;
2992
+ try {
2993
+ await activation;
2994
+ call.assertCurrent(generation);
2995
+ if (options.unmute && call.carrierMode !== "active") await enableCallAudio(call);
2996
+ } finally {
2997
+ if (call.talkActivation === activation) call.talkActivation = void 0;
2998
+ }
2999
+ };
3000
+ return {
3001
+ activateCallTalk,
3002
+ attemptCarrierHangup,
3003
+ closeCall,
3004
+ startCallTalk,
3005
+ stopCall
3006
+ };
3007
+ }
3008
+ //#endregion
3009
+ //#region extensions/facetime/src/runtime-helper-results.ts
3010
+ const OUTBOUND_DIAL_HELPER_BUNDLES = /* @__PURE__ */ new Set(["com.apple.FaceTime", "com.apple.FaceTime.FTConversationService"]);
3011
+ function readHelperPeers(result) {
3012
+ const peers = [];
3013
+ for (const entry of readHelperResults(result)) {
3014
+ const peer = entry.helperPeer;
3015
+ if (peer && typeof peer === "object" && "processId" in peer && "bundleIdentifier" in peer && "connectionGeneration" in peer && "processStartedAtMs" in peer && typeof peer.processId === "number" && typeof peer.bundleIdentifier === "string" && typeof peer.connectionGeneration === "number" && typeof peer.processStartedAtMs === "number") peers.push({
3016
+ bundleIdentifier: peer.bundleIdentifier,
3017
+ processId: peer.processId,
3018
+ processStartedAtMs: peer.processStartedAtMs,
3019
+ connectionGeneration: peer.connectionGeneration
3020
+ });
3021
+ }
3022
+ return peers;
3023
+ }
3024
+ function retainHelperResultPeers(call, result) {
3025
+ for (const peer of readHelperPeers(result)) call.carrierPeers.set(peer.processId, peer);
3026
+ }
3027
+ function retainOutboundDialHelperPeers(peers, result) {
3028
+ for (const entry of readHelperResults(result)) {
3029
+ if (entry.found === false && entry.retained_outbound_dial !== true && entry.cancelled !== true) continue;
3030
+ for (const peer of readHelperPeers(entry)) if (OUTBOUND_DIAL_HELPER_BUNDLES.has(peer.bundleIdentifier)) peers.set(peer.processId, peer);
3031
+ }
3032
+ }
3033
+ function readOutboundCallUUID(result) {
3034
+ return readHelperResults(result).map((entry) => typeof entry.call_uuid === "string" && entry.call_uuid.trim() ? entry.call_uuid.trim() : void 0).find((value) => Boolean(value));
3035
+ }
3036
+ function readOutboundProxyIdentifier(result) {
3037
+ return readHelperResults(result).map((entry) => typeof entry.proxy_identifier === "string" && entry.proxy_identifier.trim() ? entry.proxy_identifier.trim() : void 0).find((value) => Boolean(value));
3038
+ }
3039
+ function hasDialHelperConfirmation(results) {
3040
+ return results.some((entry) => typeof entry.helperBundleIdentifier === "string" && OUTBOUND_DIAL_HELPER_BUNDLES.has(entry.helperBundleIdentifier));
3041
+ }
3042
+ function hasDefinitiveDialHelperAbsence(result, requiredPeerProcessIds) {
3043
+ const results = readHelperResults(result);
3044
+ const observedProcessIds = new Set(readHelperPeers(result).map((peer) => peer.processId));
3045
+ return result.topologyComplete === true && results.length === result.helpersContacted && hasDialHelperConfirmation(results) && results.every((entry) => entry.found === false && entry.retained_outbound_dial !== true) && [...requiredPeerProcessIds].every((processId) => observedProcessIds.has(processId));
3046
+ }
3047
+ async function reconcilePendingFaceTimeCarrier(params) {
3048
+ const { pending } = params;
3049
+ let previousAbsentTopology;
3050
+ let previousAbsenceCurrent;
3051
+ for (let attempt = 0; attempt < 12; attempt += 1) {
3052
+ if (!params.isCurrent()) return;
3053
+ const { ownerEpoch, delivery, callUUID, proxyIdentifier } = pending;
3054
+ const aliases = new Set(pending.callUUIDAliases);
3055
+ const isSnapshotCurrent = () => params.isCurrent() && pending.ownerEpoch === ownerEpoch && pending.delivery === delivery && pending.callUUID === callUUID && pending.proxyIdentifier === proxyIdentifier && (pending.callUUIDAliases?.size ?? 0) === aliases.size && [...aliases].every((alias) => pending.callUUIDAliases?.has(alias) === true);
3056
+ const result = await params.helper.findOutgoingCall(pending.handle, callUUID, pending.dialID, proxyIdentifier, pending.requestedAt, pending.mode);
3057
+ if (!params.isCurrent()) return;
3058
+ if (!isSnapshotCurrent()) {
3059
+ previousAbsentTopology = void 0;
3060
+ previousAbsenceCurrent = void 0;
3061
+ continue;
3062
+ }
3063
+ retainOutboundDialHelperPeers(params.peers, result);
3064
+ const reconciledCallUUID = readOutboundCallUUID(result);
3065
+ const reconciledProxyIdentifier = readOutboundProxyIdentifier(result);
3066
+ if (reconciledCallUUID || reconciledProxyIdentifier) {
3067
+ retainFaceTimeDialCallUUID(pending, reconciledCallUUID);
3068
+ if (reconciledProxyIdentifier) pending.proxyIdentifier = reconciledProxyIdentifier;
3069
+ await params.persist();
3070
+ }
3071
+ if (reconciledCallUUID || reconciledProxyIdentifier || readHelperResults(result).some((entry) => entry.found === true)) return;
3072
+ const topologyGeneration = typeof result.topologyGeneration === "number" ? result.topologyGeneration : void 0;
3073
+ const completeAbsence = hasDefinitiveDialHelperAbsence(result, params.peers.keys());
3074
+ if (completeAbsence && topologyGeneration !== void 0 && topologyGeneration === previousAbsentTopology && previousAbsenceCurrent?.()) {
3075
+ await params.clear();
3076
+ return;
3077
+ }
3078
+ previousAbsentTopology = completeAbsence ? topologyGeneration : void 0;
3079
+ previousAbsenceCurrent = completeAbsence ? isSnapshotCurrent : void 0;
3080
+ if (attempt + 1 < 12) await new Promise((resolve) => {
3081
+ setTimeout(resolve, 250);
3082
+ });
3083
+ }
3084
+ }
3085
+ //#endregion
3086
+ //#region extensions/facetime/src/runtime-state.ts
3087
+ var ActiveFaceTimeCall = class extends FaceTimeCallInstance {
3088
+ constructor(params) {
3089
+ super(params.callUUID, params.phase);
3090
+ this.retiredCarrierCallUUIDs = /* @__PURE__ */ new Set();
3091
+ this.carrierPeers = /* @__PURE__ */ new Map();
3092
+ this.senderIsOwner = true;
3093
+ this.audioReady = false;
3094
+ this.callUUID = params.callUUID;
3095
+ this.carrierCallUUID = params.callUUID;
3096
+ this.carrierCallUUIDs = /* @__PURE__ */ new Set([params.callUUID]);
3097
+ this.senderId = params.owner.senderId;
3098
+ this.handle = params.handle;
3099
+ if (params.peer) this.carrierPeers.set(params.peer.processId, params.peer);
3100
+ }
3101
+ promoteCarrierCallUUID(callUUID) {
3102
+ if (callUUID !== this.carrierCallUUID) {
3103
+ this.retiredCarrierCallUUIDs.add(this.carrierCallUUID);
3104
+ this.retiredCarrierCallUUIDs.delete(callUUID);
3105
+ }
3106
+ this.carrierCallUUIDs.add(callUUID);
3107
+ this.carrierCallUUID = callUUID;
3108
+ }
3109
+ };
3110
+ function readCallUUID(event) {
3111
+ return String(event.data.call_uuid);
3112
+ }
3113
+ function updateCallStatus(call, event) {
3114
+ call.callStatus = typeof event.data.call_status === "number" ? event.data.call_status : call.callStatus;
3115
+ call.isSendingAudio = typeof event.data.is_sending_audio === "boolean" ? event.data.is_sending_audio : call.isSendingAudio;
3116
+ call.isSendingTransmission = typeof event.data.is_sending_transmission === "boolean" ? event.data.is_sending_transmission : call.isSendingTransmission;
3117
+ call.isUplinkMuted = typeof event.data.is_uplink_muted === "boolean" ? event.data.is_uplink_muted : call.isUplinkMuted;
3118
+ call.isSendingVideo = typeof event.data.is_sending_video === "boolean" ? event.data.is_sending_video : call.isSendingVideo;
3119
+ call.conversationUUID = typeof event.data.conversation_uuid === "string" ? event.data.conversation_uuid : call.conversationUUID;
3120
+ call.conversationGroupUUID = typeof event.data.conversation_group_uuid === "string" ? event.data.conversation_group_uuid : call.conversationGroupUUID;
3121
+ call.conversationAudioEnabled = typeof event.data.conversation_audio_enabled === "boolean" ? event.data.conversation_audio_enabled : call.conversationAudioEnabled;
3122
+ call.conversationVideoEnabled = typeof event.data.conversation_video_enabled === "boolean" ? event.data.conversation_video_enabled : call.conversationVideoEnabled;
3123
+ call.conversationAVMode = typeof event.data.conversation_av_mode === "number" ? event.data.conversation_av_mode : call.conversationAVMode;
3124
+ call.conversationResolvedAudioVideoMode = typeof event.data.conversation_resolved_audio_video_mode === "number" ? event.data.conversation_resolved_audio_video_mode : call.conversationResolvedAudioVideoMode;
3125
+ call.localMeterLevel = typeof event.data.local_meter_level === "number" ? event.data.local_meter_level : call.localMeterLevel;
3126
+ call.remoteMeterLevel = typeof event.data.remote_meter_level === "number" ? event.data.remote_meter_level : call.remoteMeterLevel;
3127
+ if (typeof event.data.local_meter_level === "number") call.maxLocalMeterLevel = Math.max(call.maxLocalMeterLevel ?? 0, event.data.local_meter_level);
3128
+ if (typeof event.data.remote_meter_level === "number") call.maxRemoteMeterLevel = Math.max(call.maxRemoteMeterLevel ?? 0, event.data.remote_meter_level);
3129
+ }
3130
+ function createManagedCall(params) {
3131
+ return new ActiveFaceTimeCall(params);
3132
+ }
3133
+ //#endregion
3134
+ //#region extensions/facetime/src/runtime-call-events.ts
3135
+ function createFaceTimeCallEventHandler(params) {
3136
+ const eventIdentities = (event) => [
3137
+ event.data.call_uuid,
3138
+ event.data.dial_id,
3139
+ event.data.proxy_identifier,
3140
+ event.data.conversation_uuid
3141
+ ].filter((identity) => typeof identity === "string" && identity.trim() !== "");
3142
+ const resolveEventCall = (event) => {
3143
+ for (const identity of eventIdentities(event)) {
3144
+ const call = params.calls.get(identity);
3145
+ if (call) return call;
3146
+ }
3147
+ };
3148
+ const canPromotePendingDial = (pending) => !params.isStopping() && params.getPendingDial() === pending && pending.delivery !== "cancelling";
3149
+ const authorizePendingDial = async (event, pending) => {
3150
+ retainFaceTimeDialCallUUID(pending, readCallUUID(event));
3151
+ await params.persistPendingDial();
3152
+ if (params.isStopping() || params.getPendingDial() !== pending) return;
3153
+ const owner = pending.delivery === "cancelling" ? void 0 : resolveAuthorizedFaceTimeOwner({
3154
+ event,
3155
+ ownerHandles: params.config.ownerHandles
3156
+ });
3157
+ if (owner) return owner;
3158
+ if (pending.delivery !== "cancelling") params.logger.warn("[facetime] cancelling correlated outbound call because its handle is no longer authorized; add it to ownerHandles before dialing again");
3159
+ try {
3160
+ await params.cancelPendingDial(pending);
3161
+ } catch (error) {
3162
+ params.logger.warn(`[facetime] outbound authorization cancellation remains pending: ${formatErrorMessage(error)}`);
3163
+ }
3164
+ };
3165
+ const retainAliases = (call, event) => {
3166
+ for (const alias of [
3167
+ event.data.call_uuid,
3168
+ event.data.dial_id,
3169
+ event.data.proxy_identifier,
3170
+ event.data.conversation_uuid,
3171
+ event.data.conversation_group_uuid
3172
+ ]) if (typeof alias === "string" && alias.trim()) params.calls.retainAlias(call, alias);
3173
+ call.carrierCallUUIDs.add(String(event.data.call_uuid));
3174
+ };
3175
+ const retainPendingDial = (call, pending) => {
3176
+ params.calls.retainAlias(call, pending.dialID);
3177
+ if (pending.proxyIdentifier) params.calls.retainAlias(call, pending.proxyIdentifier);
3178
+ for (const alias of pending.callUUIDAliases ?? []) {
3179
+ params.calls.retainAlias(call, alias);
3180
+ call.carrierCallUUIDs.add(alias);
3181
+ }
3182
+ for (const carrierPeer of params.outboundCarrierPeers.values()) call.carrierPeers.set(carrierPeer.processId, carrierPeer);
3183
+ };
3184
+ const answerIncoming = async (event, owner, peer) => {
3185
+ const callUUID = readCallUUID(event);
3186
+ if (params.isDriverInstallPending()) {
3187
+ params.logger.warn("[facetime] ignored incoming call; audio driver installation is pending");
3188
+ return;
3189
+ }
3190
+ if (resolveEventCall(event)) return;
3191
+ if (params.calls.size > 0) {
3192
+ params.logger.warn("[facetime] ignored incoming call; another FaceTime bridge is active");
3193
+ return;
3194
+ }
3195
+ const call = createManagedCall({
3196
+ callUUID,
3197
+ phase: "ringing",
3198
+ owner,
3199
+ handle: normalizeFaceTimeHandle(event.data.handle),
3200
+ peer
3201
+ });
3202
+ updateCallStatus(call, event);
3203
+ params.calls.create(call);
3204
+ retainAliases(call, event);
3205
+ let answerAttempted = false;
3206
+ try {
3207
+ await params.callControl.startCallTalk(call);
3208
+ if (call.lifecycleAbort.signal.aborted || params.calls.active !== call || call.carrierHangupPending) throw new Error("FaceTime call closed before answer");
3209
+ const generation = call.beginAnswering();
3210
+ answerAttempted = true;
3211
+ const answerResult = await call.runCarrierCommand({
3212
+ generation,
3213
+ action: async () => await params.helper.answerCall(callUUID)
3214
+ });
3215
+ projectFaceTimeNativeAction("answer", answerResult);
3216
+ retainHelperResultPeers(call, answerResult);
3217
+ await params.callControl.activateCallTalk(call, { unmute: true });
3218
+ params.logger.info("[facetime] answered authorized FaceTime call");
3219
+ } catch (error) {
3220
+ params.logger.warn(`[facetime] failed to answer FaceTime call: ${formatErrorMessage(error)}`);
3221
+ if (answerAttempted) {
3222
+ await params.callControl.attemptCarrierHangup(call, "answer-failed");
3223
+ return;
3224
+ }
3225
+ await params.callControl.closeCall(call, "answer-failed").catch((closeError) => {
3226
+ params.logger.warn(`[facetime] answer failure cleanup failed: ${formatErrorMessage(closeError)}`);
3227
+ });
3228
+ }
3229
+ };
3230
+ const activate = async (event, owner, peer, pending) => {
3231
+ const callUUID = readCallUUID(event);
3232
+ if (params.isDriverInstallPending()) {
3233
+ params.logger.warn("[facetime] ignored active call; audio driver installation is pending");
3234
+ return;
3235
+ }
3236
+ let call = resolveEventCall(event);
3237
+ if (!call) {
3238
+ if (!owner) {
3239
+ params.logger.warn("[facetime] refused active call without authenticated owner");
3240
+ return;
3241
+ }
3242
+ if (params.calls.size > 0) {
3243
+ params.logger.warn("[facetime] ignored active call; another FaceTime bridge is active");
3244
+ return;
3245
+ }
3246
+ call = createManagedCall({
3247
+ callUUID,
3248
+ phase: "active",
3249
+ owner,
3250
+ handle: normalizeFaceTimeHandle(event.data.handle),
3251
+ peer
3252
+ });
3253
+ params.calls.create(call);
3254
+ retainAliases(call, event);
3255
+ }
3256
+ if (pending) retainPendingDial(call, pending);
3257
+ if (peer) call.carrierPeers.set(peer.processId, peer);
3258
+ call.promoteCarrierCallUUID(callUUID);
3259
+ updateCallStatus(call, event);
3260
+ try {
3261
+ await params.callControl.startCallTalk(call);
3262
+ await params.callControl.activateCallTalk(call, { unmute: true });
3263
+ params.logger.info("[facetime] realtime talk session active");
3264
+ } catch (error) {
3265
+ if (call.lifecycleAbort.signal.aborted || params.calls.active !== call) return;
3266
+ params.logger.warn(`[facetime] failed to start realtime talk: ${formatErrorMessage(error)}`);
3267
+ await params.callControl.attemptCarrierHangup(call, "talk-start-failed");
3268
+ }
3269
+ };
3270
+ const handleCallEvent = async (event, peer) => {
3271
+ if (params.isStopping()) return;
3272
+ const callUUID = readCallUUID(event);
3273
+ const existingCall = resolveEventCall(event);
3274
+ const pending = params.getPendingDial();
3275
+ if (existingCall) {
3276
+ if (peer) existingCall.carrierPeers.set(peer.processId, peer);
3277
+ updateCallStatus(existingCall, event);
3278
+ retainAliases(existingCall, event);
3279
+ }
3280
+ const verifiedTransport = isVerifiedFaceTimeTransport(event);
3281
+ if (existingCall && !verifiedTransport && !isEndedCall(event)) {
3282
+ params.logger.warn("[facetime] managed call transport lost FaceTime verification; closing fail-closed");
3283
+ await params.callControl.attemptCarrierHangup(existingCall, "transport-verification-lost");
3284
+ return;
3285
+ }
3286
+ if (pending && !existingCall && event.data.is_outgoing !== true && (isIncomingRingingCall(event) || isActiveCall(event))) {
3287
+ params.logger.info("[facetime] ignored incoming call; an outbound FaceTime call is pending");
3288
+ return;
3289
+ }
3290
+ if (isIncomingRingingCall(event)) {
3291
+ const owner = resolveAuthorizedFaceTimeOwner({
3292
+ event,
3293
+ ownerHandles: params.config.ownerHandles
3294
+ });
3295
+ if (owner) await answerIncoming(event, owner, peer);
3296
+ else params.logger.info("[facetime] ignored unauthorized incoming FaceTime call");
3297
+ return;
3298
+ }
3299
+ if (isOutgoingRingingCall(event)) {
3300
+ if (verifiedTransport && pending && doesFaceTimeCallMatchPendingDial({
3301
+ event,
3302
+ pending
3303
+ })) {
3304
+ const owner = await authorizePendingDial(event, pending);
3305
+ if (!owner || !canPromotePendingDial(pending)) return;
3306
+ let ringingCall = resolveEventCall(event);
3307
+ if (!ringingCall && params.calls.size === 0) {
3308
+ ringingCall = createManagedCall({
3309
+ callUUID,
3310
+ phase: "ringing",
3311
+ owner,
3312
+ handle: normalizeFaceTimeHandle(event.data.handle),
3313
+ peer
3314
+ });
3315
+ updateCallStatus(ringingCall, event);
3316
+ params.calls.create(ringingCall);
3317
+ retainAliases(ringingCall, event);
3318
+ retainPendingDial(ringingCall, pending);
3319
+ }
3320
+ if (ringingCall) try {
3321
+ const generation = ringingCall.captureGeneration();
3322
+ const muteResult = await ringingCall.runCarrierCommand({
3323
+ generation,
3324
+ action: async () => await params.helper.safetyMute(ringingCall.carrierCallUUID)
3325
+ });
3326
+ ringingCall.lastHelperAction = muteResult;
3327
+ retainHelperResultPeers(ringingCall, muteResult);
3328
+ projectFaceTimeNativeAction("safe-mute", muteResult);
3329
+ } catch (error) {
3330
+ params.logger.warn(`[facetime] outbound ringing safety mute failed: ${formatErrorMessage(error)}`);
3331
+ await params.callControl.attemptCarrierHangup(ringingCall, "outbound-ringing-safety-mute-failed");
3332
+ }
3333
+ }
3334
+ return;
3335
+ }
3336
+ if (isActiveCall(event)) {
3337
+ const authorizedPending = event.data.is_outgoing === true && verifiedTransport && pending && doesFaceTimeCallMatchPendingDial({
3338
+ event,
3339
+ pending
3340
+ }) ? pending : void 0;
3341
+ const owner = authorizedPending ? await authorizePendingDial(event, authorizedPending) : event.data.is_outgoing === true ? void 0 : resolveAuthorizedFaceTimeOwner({
3342
+ event,
3343
+ ownerHandles: params.config.ownerHandles
3344
+ });
3345
+ if (authorizedPending && (!owner || !canPromotePendingDial(authorizedPending))) return;
3346
+ const pendingCall = authorizedPending && params.calls.get(authorizedPending.dialID);
3347
+ if (pendingCall) params.calls.retainAlias(pendingCall, callUUID);
3348
+ if (!resolveEventCall(event) && !owner) {
3349
+ params.logger.info("[facetime] ignored unauthorized active FaceTime call");
3350
+ return;
3351
+ }
3352
+ await activate(event, owner, peer, authorizedPending);
3353
+ if (authorizedPending && canPromotePendingDial(authorizedPending) && params.calls.has(callUUID)) await params.clearPendingDial();
3354
+ return;
3355
+ }
3356
+ if (isEndedCall(event)) {
3357
+ const clearing = event.data.is_outgoing === true && pending && doesFaceTimeCallMatchPendingDial({
3358
+ event,
3359
+ pending
3360
+ }) ? params.clearPendingDial() : void 0;
3361
+ const endedCall = resolveEventCall(event);
3362
+ if (endedCall) {
3363
+ if (endedCall.retiredCarrierCallUUIDs.has(callUUID)) {
3364
+ params.logger.debug?.("[facetime] ignored ended event for a stale carrier alias while another carrier is current");
3365
+ await clearing;
3366
+ return;
3367
+ }
3368
+ endedCall.markCarrierClosed();
3369
+ await Promise.all([clearing, params.callControl.closeCall(endedCall, "native-ended")]);
3370
+ } else await clearing;
3371
+ return;
3372
+ }
3373
+ if (isUnknownCallStatus(event)) {
3374
+ const unknownCall = params.calls.get(callUUID);
3375
+ if (unknownCall) {
3376
+ params.logger.warn("[facetime] unknown native call status; closing carrier fail-closed");
3377
+ await params.callControl.attemptCarrierHangup(unknownCall, "unknown-native-status");
3378
+ }
3379
+ }
3380
+ };
3381
+ return { handleCallEvent };
3382
+ }
3383
+ //#endregion
3384
+ //#region extensions/facetime/src/talk-events-summary.ts
3385
+ function optionalNumber(value) {
3386
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
3387
+ }
3388
+ function summarizeRecentTalkEvents(events, limit = 12) {
3389
+ return events.slice(-limit).map((event) => {
3390
+ const record = asRecord(event);
3391
+ const payload = asRecord(record.payload);
3392
+ return {
3393
+ type: normalizeOptionalString(record.type) ?? "unknown",
3394
+ turnId: normalizeOptionalString(record.turnId),
3395
+ callId: normalizeOptionalString(record.callId),
3396
+ final: typeof record.final === "boolean" ? record.final : void 0,
3397
+ byteLength: optionalNumber(payload.byteLength),
3398
+ name: normalizeOptionalString(payload.name),
3399
+ text: normalizeOptionalString(payload.text),
3400
+ message: normalizeOptionalString(payload.message)
3401
+ };
3402
+ });
3403
+ }
3404
+ //#endregion
3405
+ //#region extensions/facetime/src/runtime-status.ts
3406
+ function buildFaceTimeRuntimeStatus(params) {
3407
+ const calls = [...params.calls.values()];
3408
+ return {
3409
+ enabled: true,
3410
+ helperConnected: params.helperConnected,
3411
+ helperProtocol: {
3412
+ version: 1,
3413
+ authentication: "mutual-hmac-sha256-v1",
3414
+ eventIntegrity: "epoch-sequence-hmac-v1",
3415
+ statusClassifier: "explicit-ended-tu-call-status-v1",
3416
+ transportClassifier: "tu-provider-v1"
3417
+ },
3418
+ helperTargets: params.helperTargets,
3419
+ driverInstallPending: params.driverInstall.phase === "installing",
3420
+ driverInstall: params.driverInstall,
3421
+ processOutputSuppressed: calls.some((call) => call.talk?.processOutputSuppressed() === true),
3422
+ outboundCallPending: params.pendingDial ? {
3423
+ dialID: params.pendingDial.dialID,
3424
+ delivery: params.pendingDial.delivery,
3425
+ handle: params.pendingDial.handle,
3426
+ mode: params.pendingDial.mode,
3427
+ requestedAt: params.pendingDial.requestedAt,
3428
+ proxyIdentifier: params.pendingDial.proxyIdentifier
3429
+ } : void 0,
3430
+ calls: calls.map((call) => ({
3431
+ callUUID: call.callUUID,
3432
+ generation: call.generation,
3433
+ phase: call.phase,
3434
+ carrierMode: call.carrierMode,
3435
+ modelMediaMode: call.modelMediaMode,
3436
+ handle: call.handle,
3437
+ callStatus: call.callStatus,
3438
+ isSendingAudio: call.isSendingAudio,
3439
+ isSendingTransmission: call.isSendingTransmission,
3440
+ isUplinkMuted: call.isUplinkMuted,
3441
+ isSendingVideo: call.isSendingVideo,
3442
+ conversationUUID: call.conversationUUID,
3443
+ conversationGroupUUID: call.conversationGroupUUID,
3444
+ conversationAudioEnabled: call.conversationAudioEnabled,
3445
+ conversationVideoEnabled: call.conversationVideoEnabled,
3446
+ conversationAVMode: call.conversationAVMode,
3447
+ conversationResolvedAudioVideoMode: call.conversationResolvedAudioVideoMode,
3448
+ localMeterLevel: call.localMeterLevel,
3449
+ remoteMeterLevel: call.remoteMeterLevel,
3450
+ maxLocalMeterLevel: call.maxLocalMeterLevel,
3451
+ maxRemoteMeterLevel: call.maxRemoteMeterLevel,
3452
+ realtimeActive: call.talk?.realtimeActive() === true,
3453
+ audioReady: call.audioReady,
3454
+ audioTransport: call.audioTransport ? {
3455
+ ...call.audioTransport,
3456
+ processOutputSuppressed: call.talk?.processOutputSuppressed() === true
3457
+ } : void 0,
3458
+ lastHelperAction: call.lastHelperAction,
3459
+ lastRoutingError: call.lastRoutingError,
3460
+ carrierHangupPending: call.carrierHangupPending,
3461
+ recentTalkEvents: call.talk ? summarizeRecentTalkEvents(call.talk.recentTalkEvents) : void 0
3462
+ }))
3463
+ };
3464
+ }
3465
+ //#endregion
3466
+ //#region extensions/facetime/src/runtime.ts
3467
+ const OUTBOUND_RECONCILE_DELAY_MS = 1e3;
3468
+ async function createFaceTimeRuntime(params) {
3469
+ const config = resolveFaceTimeConfig(params.config);
3470
+ if (!config.enabled) throw new Error("facetime disabled in plugin config");
3471
+ const validation = validateFaceTimeConfig(config);
3472
+ if (!validation.valid) throw new Error(`Invalid facetime config: ${validation.errors.join("; ")}`);
3473
+ const calls = new FaceTimeCallRegistry();
3474
+ const pendingDialStore = new PendingFaceTimeDialStore(params.runtime.state.openKeyedStore({
3475
+ namespace: "pending-dial",
3476
+ maxEntries: 1,
3477
+ overflowPolicy: "reject-new"
3478
+ }));
3479
+ let outboundDialInFlight;
3480
+ let outboundDialDispatchPending = false;
3481
+ let outboundCallPending = await pendingDialStore.load();
3482
+ const outboundCarrierPeers = /* @__PURE__ */ new Map();
3483
+ if (outboundCallPending) {
3484
+ outboundCallPending.ownerEpoch += 1;
3485
+ await pendingDialStore.save(outboundCallPending);
3486
+ }
3487
+ let outboundReconcileTimer;
3488
+ let outboundReconcileInFlight;
3489
+ let driverInstall = { phase: "idle" };
3490
+ let driverInstallAbortController;
3491
+ let driverInstallTask;
3492
+ const isDriverInstallPending = () => driverInstall.phase === "installing";
3493
+ const captureBinary = await ensureCaptureBinary();
3494
+ const { buildId: helperBuildId, ipcKey: helperIpcKey } = await ensureHelperArtifacts({
3495
+ pluginRoot: params.pluginRoot,
3496
+ runCommandWithTimeout: params.runtime.system.runCommandWithTimeout
3497
+ });
3498
+ let stopping = false;
3499
+ let helperStopped = false;
3500
+ const helperRef = {};
3501
+ const helperSupervisor = new FaceTimeHelperSupervisor({
3502
+ pluginRoot: params.pluginRoot,
3503
+ logger: params.logger,
3504
+ runCommandWithTimeout: params.runtime.system.runCommandWithTimeout,
3505
+ connectedBundles: () => helperRef.current?.connectedHelperBundles ?? []
3506
+ });
3507
+ const pendingOperations = /* @__PURE__ */ new Set();
3508
+ const observePendingOperation = (operation) => {
3509
+ pendingOperations.add(operation);
3510
+ operation.then(() => pendingOperations.delete(operation), (error) => {
3511
+ pendingOperations.delete(operation);
3512
+ params.logger.warn(`[facetime] pending dial operation failed: ${formatErrorMessage(error)}`);
3513
+ });
3514
+ return operation;
3515
+ };
3516
+ let pendingClearSettlement = Promise.resolve();
3517
+ const clearOutboundCallPending = (expectedDialID = outboundCallPending?.dialID) => {
3518
+ if (outboundReconcileTimer) {
3519
+ clearTimeout(outboundReconcileTimer);
3520
+ outboundReconcileTimer = void 0;
3521
+ }
3522
+ const pending = outboundCallPending;
3523
+ const clearing = (async () => {
3524
+ if (expectedDialID) await pendingDialStore.clear(expectedDialID);
3525
+ if (outboundCallPending === pending) {
3526
+ outboundCallPending = void 0;
3527
+ outboundCarrierPeers.clear();
3528
+ }
3529
+ })();
3530
+ pendingClearSettlement = clearing.catch(() => void 0);
3531
+ return clearing;
3532
+ };
3533
+ const persistOutboundCallPending = () => outboundCallPending ? pendingDialStore.save(outboundCallPending) : Promise.resolve();
3534
+ const reconcilePendingOutboundCall = async () => {
3535
+ if (outboundDialDispatchPending) return;
3536
+ if (outboundReconcileInFlight) return await outboundReconcileInFlight;
3537
+ const pending = outboundCallPending;
3538
+ if (!pending) return;
3539
+ const reconciliation = (async () => {
3540
+ try {
3541
+ await reconcilePendingFaceTimeCarrier({
3542
+ helper,
3543
+ pending,
3544
+ isCurrent: () => outboundCallPending === pending && !pendingDialStore.isClearing(pending.dialID),
3545
+ peers: outboundCarrierPeers,
3546
+ persist: persistOutboundCallPending,
3547
+ clear: () => clearOutboundCallPending(pending.dialID)
3548
+ });
3549
+ if (outboundCallPending === pending && pending.delivery === "cancelling") await cancelPendingOutboundCall();
3550
+ } catch (error) {
3551
+ params.logger.debug?.(`[facetime] outbound dial reconciliation deferred: ${formatErrorMessage(error)}`);
3552
+ }
3553
+ })();
3554
+ outboundReconcileInFlight = reconciliation;
3555
+ try {
3556
+ await reconciliation;
3557
+ } finally {
3558
+ if (outboundReconcileInFlight === reconciliation) outboundReconcileInFlight = void 0;
3559
+ }
3560
+ };
3561
+ const scheduleOutboundReconciliation = () => {
3562
+ if (stopping || outboundReconcileTimer || !outboundCallPending || helper.connectedSockets === 0) return;
3563
+ const pending = outboundCallPending;
3564
+ outboundReconcileTimer = setTimeout(() => {
3565
+ outboundReconcileTimer = void 0;
3566
+ observePendingOperation(reconcilePendingOutboundCall().finally(() => {
3567
+ if (outboundCallPending === pending) scheduleOutboundReconciliation();
3568
+ }));
3569
+ }, OUTBOUND_RECONCILE_DELAY_MS);
3570
+ outboundReconcileTimer.unref?.();
3571
+ };
3572
+ const cancelPendingOutboundCall = async () => {
3573
+ const pending = outboundCallPending;
3574
+ if (!pending) return;
3575
+ const { handle, dialID } = pending;
3576
+ let { callUUID } = pending;
3577
+ pending.delivery = "cancelling";
3578
+ await persistOutboundCallPending();
3579
+ if (outboundCallPending !== pending || pendingDialStore.isClearing(pending.dialID)) return;
3580
+ const result = await helper.cancelOutgoingCall({
3581
+ dialID,
3582
+ handle,
3583
+ callUUID,
3584
+ proxyIdentifier: pending.proxyIdentifier,
3585
+ requestedAt: pending.requestedAt,
3586
+ mode: pending.mode
3587
+ }).finally(scheduleOutboundReconciliation);
3588
+ const helperResults = readHelperResults(result);
3589
+ const cancelled = helperResults.some((entry) => entry.cancelled === true);
3590
+ const helpersContacted = typeof result.helpersContacted === "number" ? result.helpersContacted : helperResults.length;
3591
+ const definitivelyAbsent = helperResults.length === helpersContacted && hasDialHelperConfirmation(helperResults) && helperResults.every((entry) => entry.found === false && entry.cancelled === false);
3592
+ if (!cancelled && !definitivelyAbsent) throw new Error("FaceTime helper could not confirm outbound call cancellation");
3593
+ const replyCallUUID = helperResults.map(readOutboundCallUUID).find((value) => Boolean(value));
3594
+ callUUID = replyCallUUID ?? callUUID;
3595
+ if (outboundCallPending === pending) {
3596
+ retainOutboundDialHelperPeers(outboundCarrierPeers, result);
3597
+ retainFaceTimeDialCallUUID(pending, replyCallUUID);
3598
+ await persistOutboundCallPending();
3599
+ }
3600
+ return {
3601
+ ...callUUID ? { callUUID } : {},
3602
+ dialID,
3603
+ handle
3604
+ };
3605
+ };
3606
+ let helperTopologyVersion = 0;
3607
+ const helperEndpoint = resolveFaceTimeHelperEndpoint();
3608
+ const callEventRef = {};
3609
+ const helper = new FaceTimeHelperSocketServer({
3610
+ ...helperEndpoint,
3611
+ logger: params.logger,
3612
+ ipcKey: helperIpcKey,
3613
+ buildId: helperBuildId,
3614
+ onMessage(message, peer) {
3615
+ if (helperStopped) return;
3616
+ const outboundIdentity = normalizeFaceTimeOutboundIdentityEvent(message);
3617
+ if (outboundIdentity && outboundCallPending?.dialID === outboundIdentity.data.dial_id) {
3618
+ if (OUTBOUND_DIAL_HELPER_BUNDLES.has(peer.bundleIdentifier)) outboundCarrierPeers.set(peer.processId, peer);
3619
+ retainFaceTimeDialCallUUID(outboundCallPending, outboundIdentity.data.call_uuid);
3620
+ if (outboundIdentity.data.proxy_identifier) outboundCallPending.proxyIdentifier = outboundIdentity.data.proxy_identifier;
3621
+ return observePendingOperation(persistOutboundCallPending());
3622
+ }
3623
+ const event = normalizeFaceTimeCallEvent(message);
3624
+ if (event) {
3625
+ const operation = callEventRef.current?.handleCallEvent(event, peer);
3626
+ if (operation) return observePendingOperation(operation);
3627
+ }
3628
+ },
3629
+ onConnect(bundleIdentifier) {
3630
+ helperTopologyVersion += 1;
3631
+ helperSupervisor?.connected(bundleIdentifier);
3632
+ for (const call of calls.values()) if (call.carrierHangupPending) attemptCarrierHangup(call, "helper-reconnected");
3633
+ if (!stopping) observePendingOperation(reconcilePendingOutboundCall().finally(scheduleOutboundReconciliation));
3634
+ },
3635
+ onDisconnect(bundleIdentifier) {
3636
+ helperTopologyVersion += 1;
3637
+ helperSupervisor?.disconnected(bundleIdentifier);
3638
+ if (stopping || calls.size === 0) return;
3639
+ params.logger.warn("[facetime] carrier helper disconnected during a call; retaining audio safety bridge");
3640
+ for (const call of calls.values()) attemptCarrierHangup(call, "helper-disconnected");
3641
+ },
3642
+ onStale(bundleIdentifier, processId) {
3643
+ helperSupervisor?.stale(bundleIdentifier, processId);
3644
+ }
3645
+ });
3646
+ helperRef.current = helper;
3647
+ const callControl = createFaceTimeCallControl({
3648
+ calls,
3649
+ helper,
3650
+ config,
3651
+ fullConfig: params.fullConfig,
3652
+ runtime: params.runtime,
3653
+ logger: params.logger,
3654
+ captureBinary,
3655
+ isStopping: () => stopping,
3656
+ getHelperTopologyVersion: () => helperTopologyVersion,
3657
+ retainHelperResultPeers
3658
+ });
3659
+ const { attemptCarrierHangup, stopCall } = callControl;
3660
+ callEventRef.current = createFaceTimeCallEventHandler({
3661
+ calls,
3662
+ helper,
3663
+ config,
3664
+ logger: params.logger,
3665
+ callControl,
3666
+ isStopping: () => stopping,
3667
+ isDriverInstallPending,
3668
+ getPendingDial: () => pendingDialStore.isClearing(outboundCallPending?.dialID) ? void 0 : outboundCallPending,
3669
+ clearPendingDial: () => clearOutboundCallPending(),
3670
+ persistPendingDial: persistOutboundCallPending,
3671
+ outboundCarrierPeers,
3672
+ cancelPendingDial: async (pending) => {
3673
+ if (outboundCallPending === pending) await cancelPendingOutboundCall();
3674
+ }
3675
+ });
3676
+ await helper.start();
3677
+ helperSupervisor.start();
3678
+ params.logger.info(`[facetime] listening for FaceTime helper events on ${helperEndpoint.host}:${helperEndpoint.port}`);
3679
+ const readStatus = async () => buildFaceTimeRuntimeStatus({
3680
+ calls,
3681
+ helperConnected: helper.connectedSockets > 0,
3682
+ helperTargets: helperSupervisor.status(),
3683
+ driverInstall,
3684
+ pendingDial: outboundCallPending
3685
+ });
3686
+ const runPreflight = async () => await runFaceTimePreflight({
3687
+ config,
3688
+ fullConfig: params.fullConfig,
3689
+ runtime: params.runtime,
3690
+ logger: params.logger,
3691
+ helperConnected: helper.connectedSockets > 0,
3692
+ captureBinary
3693
+ });
3694
+ return {
3695
+ config,
3696
+ async status() {
3697
+ return await readStatus();
3698
+ },
3699
+ async dial(dialParams) {
3700
+ if (stopping) throw new Error("cannot start an outbound FaceTime call while the plugin is stopping");
3701
+ if (isDriverInstallPending()) throw new Error("cannot start an outbound FaceTime call while audio driver installation is pending");
3702
+ if (calls.size > 0) throw new Error("cannot start an outbound FaceTime call while another call is active");
3703
+ if (outboundCallPending) throw new Error(`outbound FaceTime ${outboundCallPending.mode} call is already pending for ${outboundCallPending.handle}`);
3704
+ if (outboundDialInFlight) throw new Error("cannot start an outbound FaceTime call while another dial is in flight");
3705
+ const request = resolveFaceTimeDialRequest({
3706
+ handle: dialParams.handle,
3707
+ mode: dialParams.mode,
3708
+ ownerHandles: config.ownerHandles
3709
+ });
3710
+ const dialID = randomUUID();
3711
+ const requestedAt = (/* @__PURE__ */ new Date()).toISOString();
3712
+ const pending = {
3713
+ ...request,
3714
+ version: 1,
3715
+ ownerEpoch: 1,
3716
+ dialID,
3717
+ delivery: "in-flight",
3718
+ requestedAt
3719
+ };
3720
+ outboundCallPending = pending;
3721
+ outboundDialDispatchPending = true;
3722
+ let helperStarted = false;
3723
+ const canDispatch = () => !stopping && outboundCallPending === pending && pending.delivery !== "cancelling" && !pendingDialStore.isClearing(pending.dialID);
3724
+ const dialPromise = (async () => {
3725
+ await persistOutboundCallPending();
3726
+ if (!canDispatch()) throw new Error("outbound FaceTime dial was cancelled before helper dispatch");
3727
+ outboundDialDispatchPending = false;
3728
+ helperStarted = true;
3729
+ const helperResult = await helper.startCall(request, dialID, requestedAt);
3730
+ retainOutboundDialHelperPeers(outboundCarrierPeers, helperResult);
3731
+ const result = resolveFaceTimeDialResult({
3732
+ dialID,
3733
+ request,
3734
+ helper: helperResult
3735
+ });
3736
+ const callUUID = result.callUUID;
3737
+ if (outboundCallPending === pending) {
3738
+ if (pending.delivery !== "cancelling") pending.delivery = "accepted";
3739
+ if (callUUID) retainFaceTimeDialCallUUID(outboundCallPending, callUUID);
3740
+ if (result.proxyIdentifier) outboundCallPending.proxyIdentifier = result.proxyIdentifier;
3741
+ await persistOutboundCallPending();
3742
+ scheduleOutboundReconciliation();
3743
+ }
3744
+ if (pending.delivery === "cancelling") throw new Error("outbound FaceTime dial was cancelled before helper acknowledgement");
3745
+ return result;
3746
+ })();
3747
+ outboundDialInFlight = dialPromise;
3748
+ try {
3749
+ return await dialPromise;
3750
+ } catch (error) {
3751
+ if (!helperStarted) throw error;
3752
+ if (error instanceof FaceTimeHelperUnavailableError) {
3753
+ if (outboundCallPending === pending && pending.delivery !== "cancelling") await clearOutboundCallPending();
3754
+ } else {
3755
+ if (outboundCallPending === pending) {
3756
+ if (pending.delivery !== "cancelling") pending.delivery = "ambiguous";
3757
+ if (error instanceof FaceTimeHelperAmbiguousError) {
3758
+ const callUUID = readOutboundCallUUID(error.result);
3759
+ const proxyIdentifier = readOutboundProxyIdentifier(error.result);
3760
+ if (callUUID) retainFaceTimeDialCallUUID(outboundCallPending, callUUID);
3761
+ if (proxyIdentifier) outboundCallPending.proxyIdentifier = proxyIdentifier;
3762
+ }
3763
+ await persistOutboundCallPending();
3764
+ }
3765
+ if (outboundDialInFlight === dialPromise) outboundDialInFlight = void 0;
3766
+ await reconcilePendingOutboundCall();
3767
+ scheduleOutboundReconciliation();
3768
+ }
3769
+ throw error;
3770
+ } finally {
3771
+ if (outboundDialInFlight === dialPromise) {
3772
+ outboundDialDispatchPending = false;
3773
+ outboundDialInFlight = void 0;
3774
+ }
3775
+ }
3776
+ },
3777
+ async hangup(hangupParams) {
3778
+ const requestedCallUUID = typeof hangupParams?.callUUID === "string" && hangupParams.callUUID.trim() ? hangupParams.callUUID.trim() : void 0;
3779
+ const findCall = () => requestedCallUUID ? calls.get(requestedCallUUID) : [...calls.values()].find((candidate) => candidate.talk) ?? [...calls.values()][0];
3780
+ let call = findCall();
3781
+ if (!call) {
3782
+ if (!requestedCallUUID || outboundCallPending && doesPendingFaceTimeDialHaveCallUUID(outboundCallPending, requestedCallUUID)) {
3783
+ const canceled = await cancelPendingOutboundCall();
3784
+ if (canceled) return {
3785
+ ...canceled.callUUID ? { callUUID: canceled.callUUID } : {},
3786
+ dialID: canceled.dialID
3787
+ };
3788
+ }
3789
+ for (let attempt = 0; attempt < 12 && !call; attempt += 1) {
3790
+ call = findCall();
3791
+ if (!call && attempt + 1 < 12) await new Promise((resolve) => {
3792
+ setTimeout(resolve, 250);
3793
+ });
3794
+ }
3795
+ }
3796
+ if (!call) throw new Error("no active FaceTime call to hang up");
3797
+ if (outboundCallPending && calls.get(outboundCallPending.dialID) === call) {
3798
+ call.beginClosing();
3799
+ outboundCallPending.delivery = "cancelling";
3800
+ await persistOutboundCallPending();
3801
+ scheduleOutboundReconciliation();
3802
+ }
3803
+ if (!await attemptCarrierHangup(call, "operator-hangup")) throw new Error(`carrier hangup pending for ${call.callUUID}; retry scheduled`);
3804
+ return { callUUID: call.callUUID };
3805
+ },
3806
+ async setup() {
3807
+ const preflight = runPreflight();
3808
+ preflight.catch(() => void 0);
3809
+ const runtimeStatus = preflight.then(() => readStatus(), () => readStatus());
3810
+ return await runFaceTimeSetup({
3811
+ config,
3812
+ nativePackageReady: true,
3813
+ pluginRoot: params.pluginRoot,
3814
+ runCommandWithTimeout: params.runtime.system.runCommandWithTimeout,
3815
+ runtimeStatus,
3816
+ preflight
3817
+ });
3818
+ },
3819
+ async preflight() {
3820
+ return await runPreflight();
3821
+ },
3822
+ async installDriver() {
3823
+ if (stopping) throw new Error("cannot install the FaceTime audio driver while the plugin is stopping");
3824
+ if (isDriverInstallPending()) throw new Error("FaceTime audio driver installation is already pending");
3825
+ if (calls.size > 0 || outboundCallPending || outboundDialInFlight) throw new Error("Cannot install the FaceTime audio driver during an active or pending call");
3826
+ driverInstall = {
3827
+ phase: "installing",
3828
+ startedAt: (/* @__PURE__ */ new Date()).toISOString()
3829
+ };
3830
+ const installAbortController = new AbortController();
3831
+ driverInstallAbortController = installAbortController;
3832
+ driverInstallTask = installFaceTimeDriver({
3833
+ pluginRoot: params.pluginRoot,
3834
+ runCommandWithTimeout: params.runtime.system.runCommandWithTimeout,
3835
+ callActive: false,
3836
+ signal: installAbortController.signal
3837
+ }).then((result) => {
3838
+ driverInstall = {
3839
+ phase: "succeeded",
3840
+ startedAt: driverInstall.startedAt,
3841
+ finishedAt: (/* @__PURE__ */ new Date()).toISOString(),
3842
+ changed: result.changed
3843
+ };
3844
+ params.logger.info(`[facetime] audio driver installation ${result.changed ? "completed" : "already current"}`);
3845
+ }).catch((error) => {
3846
+ const message = formatErrorMessage(error);
3847
+ driverInstall = {
3848
+ phase: "failed",
3849
+ startedAt: driverInstall.startedAt,
3850
+ finishedAt: (/* @__PURE__ */ new Date()).toISOString(),
3851
+ error: message
3852
+ };
3853
+ params.logger.warn(`[facetime] audio driver installation failed: ${message}`);
3854
+ }).finally(() => {
3855
+ if (driverInstallAbortController === installAbortController) {
3856
+ driverInstallAbortController = void 0;
3857
+ driverInstallTask = void 0;
3858
+ }
3859
+ });
3860
+ return { started: true };
3861
+ },
3862
+ async stop() {
3863
+ stopping = true;
3864
+ if (outboundReconcileTimer) {
3865
+ clearTimeout(outboundReconcileTimer);
3866
+ outboundReconcileTimer = void 0;
3867
+ }
3868
+ driverInstallAbortController?.abort();
3869
+ await driverInstallTask;
3870
+ await pendingDialStore.settle();
3871
+ await pendingClearSettlement;
3872
+ let cleanupError;
3873
+ let pendingCleanupError;
3874
+ const shutdownPending = outboundCallPending;
3875
+ if (outboundCallPending || outboundDialInFlight) {
3876
+ try {
3877
+ await cancelPendingOutboundCall();
3878
+ } catch (error) {
3879
+ pendingCleanupError = /* @__PURE__ */ new Error(`outbound FaceTime dial cleanup failed: ${formatErrorMessage(error)}`);
3880
+ }
3881
+ await outboundDialInFlight?.catch(() => void 0);
3882
+ await reconcilePendingOutboundCall();
3883
+ if (!outboundCallPending) pendingCleanupError = void 0;
3884
+ if (outboundCallPending === shutdownPending && calls.size === 0 && shutdownPending) {
3885
+ const pendingEpoch = shutdownPending.ownerEpoch;
3886
+ try {
3887
+ await terminateExactCarrierProcesses({
3888
+ runtime: params.runtime,
3889
+ peers: outboundCarrierPeers,
3890
+ assertCurrent: () => {
3891
+ if (outboundCallPending !== shutdownPending || shutdownPending.ownerEpoch !== pendingEpoch) throw new Error("pending FaceTime dial changed during fail-closed shutdown");
3892
+ }
3893
+ });
3894
+ await clearOutboundCallPending(shutdownPending.dialID);
3895
+ pendingCleanupError = void 0;
3896
+ } catch (error) {
3897
+ pendingCleanupError ??= /* @__PURE__ */ new Error(`pending FaceTime carrier termination failed: ${formatErrorMessage(error)}`);
3898
+ }
3899
+ }
3900
+ cleanupError ??= pendingCleanupError;
3901
+ }
3902
+ for (const call of calls.values()) try {
3903
+ await stopCall(call);
3904
+ } catch (error) {
3905
+ cleanupError ??= error instanceof Error ? error : new Error(formatErrorMessage(error));
3906
+ }
3907
+ await helperSupervisor.stop();
3908
+ await helper.stop();
3909
+ helperStopped = true;
3910
+ if (!cleanupError) while (pendingOperations.size > 0) await Promise.allSettled(pendingOperations);
3911
+ await pendingDialStore.settle();
3912
+ if (cleanupError) throw cleanupError;
3913
+ }
3914
+ };
3915
+ }
3916
+ //#endregion
3917
+ export { createFaceTimeRuntime };