remoteclaw 0.1.0-next.da482d8 → 0.1.0-next.db8a792

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 (1020) hide show
  1. package/dist/accounts-BZ2kR_Ij.js +47 -0
  2. package/dist/accounts-Bi4rFQG5.js +272 -0
  3. package/dist/accounts-Bpk-loA6.js +47 -0
  4. package/dist/accounts-D1CBpsaa.js +32 -0
  5. package/dist/accounts-DAdUdbPk.js +36 -0
  6. package/dist/accounts-WYyfAiie.js +270 -0
  7. package/dist/accounts-zQKMwnvt.js +36 -0
  8. package/dist/ack-reactions-B1l-vKPr.js +621 -0
  9. package/dist/ack-reactions-BnG0DLMu.js +621 -0
  10. package/dist/acp-cli-Btx71t69.js +1319 -0
  11. package/dist/acp-cli-DVQMjl0p.js +1324 -0
  12. package/dist/active-listener-BfN4RKlA.js +37 -0
  13. package/dist/active-listener-Bq7ckjOV.js +37 -0
  14. package/dist/agent-D2IwuL6g.js +688 -0
  15. package/dist/agent-WaE2mXI1.js +687 -0
  16. package/dist/agent-helpers-BcaiJFiG.js +400 -0
  17. package/dist/agent-scope-DVvX_nkQ.js +116 -0
  18. package/dist/agents-BwnT7jca.js +760 -0
  19. package/dist/agents.config-Dorm30BQ.js +116 -0
  20. package/dist/audio-B1lTyRqS.js +43 -0
  21. package/dist/audio-e0dFnrn8.js +43 -0
  22. package/dist/audit-DZvqycbG.js +3150 -0
  23. package/dist/audit-Mit73dYD.js +3150 -0
  24. package/dist/auth-C-XX0Tdt.js +314 -0
  25. package/dist/auth-D8--b01l.js +315 -0
  26. package/dist/auth-DJ7XEBDO.js +448 -0
  27. package/dist/auth-otyjXf9l.js +448 -0
  28. package/dist/banner-DSE-i7gH.js +294 -0
  29. package/dist/binaries-BSjilwX-.js +13 -0
  30. package/dist/bindings-DFTxQj8x.js +69 -0
  31. package/dist/bonjour-discovery-BnxTMHRd.js +378 -0
  32. package/dist/bonjour-discovery-CVJYHT3g.js +378 -0
  33. package/dist/boot/handler.js +28 -44
  34. package/dist/browser-cli-BR2pZWTC.js +1694 -0
  35. package/dist/browser-cli-I0kfR7FV.js +1690 -0
  36. package/dist/build-info.json +3 -3
  37. package/dist/call-Ck7ysmEl.js +517 -0
  38. package/dist/call-MN6mCJEB.js +518 -0
  39. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  40. package/dist/catalog-Bt9EM4sK.js +185 -0
  41. package/dist/catalog-BtUvWKd9.js +185 -0
  42. package/dist/channel-account-context-BLQq9NKz.js +133 -0
  43. package/dist/channel-account-context-CaCzVa76.js +133 -0
  44. package/dist/channel-activity-BatlvP_U.js +292 -0
  45. package/dist/channel-activity-DHVMMb2x.js +94 -0
  46. package/dist/channel-activity-DtRx3b0W.js +94 -0
  47. package/dist/channel-options-C6kT3nXB.js +32 -0
  48. package/dist/channel-options-CbgR_vsp.js +33 -0
  49. package/dist/channel-selection-CzbrpDPd.js +51 -0
  50. package/dist/channel-selection-Xv5UFxOx.js +51 -0
  51. package/dist/channel-web-DfDokU69.js +2134 -0
  52. package/dist/channel-web-DtvksSuY.js +2132 -0
  53. package/dist/channels-cli-BmdCVX6O.js +1435 -0
  54. package/dist/channels-cli-CrAZpaiN.js +1439 -0
  55. package/dist/channels-status-issues-B77y-TLr.js +18 -0
  56. package/dist/channels-status-issues-COECL8nx.js +18 -0
  57. package/dist/chrome-Cr5wmMk8.js +1733 -0
  58. package/dist/chrome-YBrnJN-g.js +1732 -0
  59. package/dist/chunk-CrfQ_O--.js +341 -0
  60. package/dist/chunk-DFBUmlXU.js +341 -0
  61. package/dist/clack-prompter-CFNKgQXx.js +122 -0
  62. package/dist/clack-prompter-DDlR2e34.js +121 -0
  63. package/dist/cli/daemon-cli.js +1 -1
  64. package/dist/cli-BbOinSy6.js +130 -0
  65. package/dist/cli-DuvHXQ5h.js +134 -0
  66. package/dist/client-BZeatr3g.js +2316 -0
  67. package/dist/client-Bc9JFAwL.js +2316 -0
  68. package/dist/clipboard-Com-8GBg.js +31 -0
  69. package/dist/clipboard-J_9AABIu.js +31 -0
  70. package/dist/command-format-CMAQa4dB.js +32 -0
  71. package/dist/command-format-KkslAzwV.js +18 -0
  72. package/dist/command-logger/handler.js +1 -1
  73. package/dist/command-registry-BJnVtHo0.js +215 -0
  74. package/dist/commands-ijxtne0J.js +41 -0
  75. package/dist/commands-kZtQfqDl.js +41 -0
  76. package/dist/commands-registry-BrBtH2_B.js +891 -0
  77. package/dist/commands-registry-xZoSouba.js +892 -0
  78. package/dist/common-6D7nhDP-.js +156 -0
  79. package/dist/common-B4cjsvqP.js +156 -0
  80. package/dist/completion-cli-CpUq9QC3.js +452 -0
  81. package/dist/completion-cli-De4umD_N.js +452 -0
  82. package/dist/config-C_WcTz_O.js +4231 -0
  83. package/dist/config-DfcqHTH-.js +4229 -0
  84. package/dist/config-cli-C7rq2n_m.js +243 -0
  85. package/dist/config-cli-VToCKln2.js +247 -0
  86. package/dist/config-guard-BlAcGEao.js +75 -0
  87. package/dist/config-guard-C-h_KIeI.js +99 -0
  88. package/dist/config-validation-C0YXR2dY.js +18 -0
  89. package/dist/config-validation-DDYBTmxT.js +18 -0
  90. package/dist/configure-Bkre1zEB.js +891 -0
  91. package/dist/configure-ifuEamRQ.js +889 -0
  92. package/dist/control-auth-DK6cIBzl.js +397 -0
  93. package/dist/control-auth-DQ8bfDMk.js +397 -0
  94. package/dist/control-ui-assets-DLEWfed6.js +186 -0
  95. package/dist/control-ui-assets-DVhkAyhv.js +186 -0
  96. package/dist/conversation-label-HuHoShPF.js +36 -0
  97. package/dist/conversation-label-L0QTtKji.js +36 -0
  98. package/dist/cron-cli-DnxnTi83.js +498 -0
  99. package/dist/cron-cli-yqcBkqZT.js +494 -0
  100. package/dist/daemon-cli-CmQYq8uO.js +735 -0
  101. package/dist/daemon-cli-_OIRoswC.js +737 -0
  102. package/dist/daemon-cli.js +34 -69
  103. package/dist/daemon-install-BEgffqDj.js +56 -0
  104. package/dist/daemon-install-DAorzotp.js +60 -0
  105. package/dist/daemon-install-helpers-B82uvJjJ.js +504 -0
  106. package/dist/daemon-install-helpers-BhL2Gh4l.js +504 -0
  107. package/dist/deliver-CCvDBk5c.js +481 -0
  108. package/dist/deliver-CqKw0wFi.js +481 -0
  109. package/dist/delivery-queue-CK7VnUJf.js +244 -0
  110. package/dist/delivery-queue-DMeQchpT.js +244 -0
  111. package/dist/devices-cli-C6UAfRV_.js +323 -0
  112. package/dist/devices-cli-Le-isdZB.js +319 -0
  113. package/dist/diagnostics-BhFwk6F3.js +35 -0
  114. package/dist/diagnostics-BtaQtaVR.js +35 -0
  115. package/dist/directory-cli-BqMfX5og.js +220 -0
  116. package/dist/directory-cli-DD72TTD4.js +224 -0
  117. package/dist/dispatcher-BLC2WYZv.js +173 -0
  118. package/dist/dispatcher-Cm2FAG_D.js +174 -0
  119. package/dist/dm-policy-shared-DOzpxMHC.js +22 -0
  120. package/dist/dm-policy-shared-DZY0f1bR.js +22 -0
  121. package/dist/dns-cli-BgsNg-bn.js +203 -0
  122. package/dist/dns-cli-CdMU5yuG.js +199 -0
  123. package/dist/dock-ByrYnLiz.js +929 -0
  124. package/dist/dock-CpNmmysM.js +928 -0
  125. package/dist/doctor-completion-BPeaRbmd.js +92 -0
  126. package/dist/doctor-completion-CfOyGJd3.js +92 -0
  127. package/dist/doctor-config-flow-DMyTycn7.js +1935 -0
  128. package/dist/doctor-config-flow-DoMu-pTm.js +1934 -0
  129. package/dist/enable-D5KetMo7.js +59 -0
  130. package/dist/entry.js +61 -1
  131. package/dist/env-BJ36dSrx.js +60 -0
  132. package/dist/errors-BfONuT95.js +35 -0
  133. package/dist/errors-_DSePI1C.js +35 -0
  134. package/dist/exec-DkFE7lqU.js +164 -0
  135. package/dist/exec-mY96dhIg.js +164 -0
  136. package/dist/extensionAPI.js +112 -76
  137. package/dist/fetch-B3EQXbTa.js +67 -0
  138. package/dist/fetch-BPeSHPvr.js +281 -0
  139. package/dist/fetch-BQ7HvRwe.js +67 -0
  140. package/dist/fetch-CbGTzJ8L.js +281 -0
  141. package/dist/fetch-CfIaWynF.js +67 -0
  142. package/dist/file-lock-BHfqppLm.js +107 -0
  143. package/dist/file-lock-CCBpdPM_.js +107 -0
  144. package/dist/fs-safe-BcEpbVjc.js +88 -0
  145. package/dist/fs-safe-S3Zvbabd.js +98 -0
  146. package/dist/gateway-cli-BXipRcsU.js +24602 -0
  147. package/dist/gateway-cli-Bv2K3rXx.js +24606 -0
  148. package/dist/gateway-rpc-BHnd7P1q.js +28 -0
  149. package/dist/gateway-rpc-COEQDswS.js +28 -0
  150. package/dist/gmail-setup-utils-BpdKFe3P.js +423 -0
  151. package/dist/gmail-setup-utils-CqbWr0Kq.js +422 -0
  152. package/dist/health-1ero5j64.js +1414 -0
  153. package/dist/health-ioP2au7j.js +1417 -0
  154. package/dist/heartbeat-visibility-C88L-_f2.js +125 -0
  155. package/dist/heartbeat-visibility-Dk_Q02qX.js +125 -0
  156. package/dist/hook-runner-global-BztoD8lu.js +527 -0
  157. package/dist/hooks-cli-B8D9DzRR.js +1226 -0
  158. package/dist/hooks-cli-rZ3GOXag.js +1222 -0
  159. package/dist/image-ops-Cx1ym2Hi.js +354 -0
  160. package/dist/image-ops-DWytvdh_.js +354 -0
  161. package/dist/import-CTUBsy7D.js +604 -0
  162. package/dist/import-cBp4f62k.js +606 -0
  163. package/dist/inbound-context-COwswi8z.js +68 -0
  164. package/dist/inbound-context-ChcNR30g.js +68 -0
  165. package/dist/index.js +127 -102
  166. package/dist/inspect-BsS3_z-x.js +286 -0
  167. package/dist/inspect-drfsUSIW.js +286 -0
  168. package/dist/installs-BFmmM5Zd.js +325 -0
  169. package/dist/installs-DA7SG0Tx.js +325 -0
  170. package/dist/ipv4-BZGSwnH4.js +46 -0
  171. package/dist/ipv4-DsOgHE0B.js +46 -0
  172. package/dist/ir-R3Pk8Cv8.js +972 -0
  173. package/dist/lifecycle-core-BZMeOT7u.js +474 -0
  174. package/dist/lifecycle-core-C6-_Gts0.js +476 -0
  175. package/dist/loader-CJ2UHqV7.js +22414 -0
  176. package/dist/loader-dEFvmwXu.js +22411 -0
  177. package/dist/logger-9I2fg5mr.js +49 -0
  178. package/dist/login-D9uJTyEv.js +62 -0
  179. package/dist/login-DTh702_w.js +61 -0
  180. package/dist/login-qr-BKsmW6XI.js +325 -0
  181. package/dist/login-qr-SOXdIR58.js +329 -0
  182. package/dist/logs-cli-BshJBHZQ.js +236 -0
  183. package/dist/logs-cli-Ckh-BBTT.js +240 -0
  184. package/dist/markdown-tables-Cfz7zDXI.js +29 -0
  185. package/dist/markdown-tables-DeFSK6aY.js +29 -0
  186. package/dist/media-BD2cZGXT.js +971 -0
  187. package/dist/media-CjvpnJmQ.js +10388 -0
  188. package/dist/message-action-names-CZHrHMRE.js +2520 -0
  189. package/dist/message-action-names-CiZ-0Smk.js +2520 -0
  190. package/dist/message-channel-EMCYRaxk.js +91 -0
  191. package/dist/mime-1E7nn9IU.js +146 -0
  192. package/dist/mime-mSgQeDnC.js +146 -0
  193. package/dist/net-Cg8AQeke.js +225 -0
  194. package/dist/net-DMh1m8AZ.js +225 -0
  195. package/dist/node-cli-BJ5CCbqx.js +1462 -0
  196. package/dist/node-cli-wYYhAs8x.js +1458 -0
  197. package/dist/node-service-CkwVlcey.js +67 -0
  198. package/dist/node-service-DTVW9YJh.js +67 -0
  199. package/dist/nodes-cli-CMFYLD1o.js +1346 -0
  200. package/dist/nodes-cli-DC2zUx3f.js +1350 -0
  201. package/dist/nodes-screen-6pXv1lYa.js +250 -0
  202. package/dist/nodes-screen-CTIZKksn.js +250 -0
  203. package/dist/note-CMELkPJN.js +92 -0
  204. package/dist/npm-registry-spec-BiJI7Rkr.js +786 -0
  205. package/dist/npm-registry-spec-Dza35Ig4.js +786 -0
  206. package/dist/npm-resolution-CUQGDty4.js +86 -0
  207. package/dist/npm-resolution-CwbZK9AI.js +86 -0
  208. package/dist/onboard-8Qd9lU8x.js +649 -0
  209. package/dist/onboard-Q3cY65m8.js +647 -0
  210. package/dist/onboard-auth-BUzYDEqf.js +211 -0
  211. package/dist/onboard-auth-DcVXyd-Z.js +207 -0
  212. package/dist/onboard-channels-BFHuA-AU.js +2548 -0
  213. package/dist/onboard-channels-DVrPP_ie.js +2547 -0
  214. package/dist/onboard-helpers-B-bBSsyR.js +363 -0
  215. package/dist/onboard-helpers-YsCa-sAt.js +364 -0
  216. package/dist/onboard-remote-BWFcuEOD.js +127 -0
  217. package/dist/onboard-remote-C0THuDTK.js +127 -0
  218. package/dist/onboarding-B31lnOPp.js +586 -0
  219. package/dist/onboarding-DmN_qC8e.js +588 -0
  220. package/dist/onboarding.finalize-DGD0PA-D.js +402 -0
  221. package/dist/onboarding.finalize-DNIb3meE.js +404 -0
  222. package/dist/onboarding.gateway-config-BaeIuA62.js +195 -0
  223. package/dist/onboarding.gateway-config-DMV2Odzr.js +201 -0
  224. package/dist/outbound-BdxBHDax.js +220 -0
  225. package/dist/outbound-D-Y9rMgB.js +221 -0
  226. package/dist/outbound-attachment-CvZ04r5k.js +18 -0
  227. package/dist/outbound-attachment-DYa1asB5.js +18 -0
  228. package/dist/outbound-attachment-DgUpk7Uh.js +18 -0
  229. package/dist/pairing-cli-BxTv78V7.js +125 -0
  230. package/dist/pairing-cli-CxUCzNUc.js +129 -0
  231. package/dist/pairing-labels-DVO6NJr0.js +9 -0
  232. package/dist/pairing-labels-D_pD8Cag.js +9 -0
  233. package/dist/pairing-store-Bu9pVlkO.js +459 -0
  234. package/dist/pairing-store-CWaGbAGi.js +460 -0
  235. package/dist/path-env-RsuO6yO-.js +89 -0
  236. package/dist/path-env-_my-d_iR.js +89 -0
  237. package/dist/path-safety-CfiVyVz7.js +14 -0
  238. package/dist/path-safety-D-wLK4pV.js +14 -0
  239. package/dist/plugin-auto-enable-CW01H36W.js +301 -0
  240. package/dist/plugin-auto-enable-CeHhBLCU.js +302 -0
  241. package/dist/plugin-registry-CWL37HnB.js +33 -0
  242. package/dist/plugin-registry-ELliiumZ.js +33 -0
  243. package/dist/plugin-sdk/auth/provider-auth.d.ts +0 -6
  244. package/dist/plugin-sdk/auto-reply/reply/agent-runner-utils.d.ts +9 -29
  245. package/dist/plugin-sdk/auto-reply/reply/commands-status.d.ts +0 -2
  246. package/dist/plugin-sdk/auto-reply/reply/commands-subagents/shared.d.ts +1 -1
  247. package/dist/plugin-sdk/auto-reply/reply/queue/types.d.ts +0 -2
  248. package/dist/plugin-sdk/auto-reply/status.d.ts +0 -4
  249. package/dist/plugin-sdk/auto-reply/templating.d.ts +0 -4
  250. package/dist/plugin-sdk/config/sessions/types.d.ts +0 -2
  251. package/dist/plugin-sdk/config/types.tools.d.ts +1 -59
  252. package/dist/plugin-sdk/config/types.tts.d.ts +2 -1
  253. package/dist/plugin-sdk/config/zod-schema.agent-runtime.d.ts +0 -177
  254. package/dist/plugin-sdk/config/zod-schema.core.d.ts +2 -230
  255. package/dist/plugin-sdk/config/zod-schema.d.ts +3 -192
  256. package/dist/plugin-sdk/config/zod-schema.providers-core.d.ts +3 -15
  257. package/dist/plugin-sdk/config/zod-schema.providers.d.ts +2 -10
  258. package/dist/plugin-sdk/config/zod-schema.session.d.ts +1 -5
  259. package/dist/plugin-sdk/gateway/protocol/index.d.ts +5 -5
  260. package/dist/plugin-sdk/index.js +72 -142
  261. package/dist/plugin-sdk/middleware/cli-runtime-base.d.ts +6 -0
  262. package/dist/plugin-sdk/middleware/runtimes/claude.d.ts +6 -0
  263. package/dist/plugin-sdk/middleware/runtimes/codex.d.ts +2 -2
  264. package/dist/plugin-sdk/plugin-sdk/index.d.ts +2 -0
  265. package/dist/plugin-sdk/plugins/manifest-registry.d.ts +2 -0
  266. package/dist/plugin-sdk/plugins/manifest.d.ts +2 -0
  267. package/dist/plugin-sdk/plugins/registry.d.ts +18 -0
  268. package/dist/plugin-sdk/plugins/types.d.ts +4 -0
  269. package/dist/plugin-sdk/stt/preflight.d.ts +2 -4
  270. package/dist/plugin-sdk/stt/providers/index.d.ts +1 -1
  271. package/dist/plugin-sdk/stt/providers/shared.d.ts +20 -1
  272. package/dist/plugin-sdk/tts/providers/edge.d.ts +2 -0
  273. package/dist/plugin-sdk/tts/providers/elevenlabs.d.ts +2 -0
  274. package/dist/plugin-sdk/tts/providers/index.d.ts +4 -0
  275. package/dist/plugin-sdk/tts/providers/openai.d.ts +2 -0
  276. package/dist/plugin-sdk/tts/tts.d.ts +13 -5
  277. package/dist/plugin-sdk/tts/types.d.ts +21 -0
  278. package/dist/plugins-DExsdlTp.js +455 -0
  279. package/dist/plugins-DdMgSc_b.js +453 -0
  280. package/dist/plugins-cli-DqBWiT_G.js +806 -0
  281. package/dist/plugins-cli-KQEzhU6P.js +802 -0
  282. package/dist/ports-CL0pXAXO.js +96 -0
  283. package/dist/ports-CRI-HSZx.js +370 -0
  284. package/dist/ports-DiQFcKUB.js +316 -0
  285. package/dist/ports-HRurfPIr.js +96 -0
  286. package/dist/preflight-6QRqxWh7.js +667 -0
  287. package/dist/preflight-DDZjr5KD.js +667 -0
  288. package/dist/program-DmhbOJj3.js +249 -0
  289. package/dist/program-context-PPMzZ6Gu.js +474 -0
  290. package/dist/prompt-select-styled-CmSWunD8.js +1669 -0
  291. package/dist/prompt-select-styled-PfxT9zl9.js +1672 -0
  292. package/dist/provider-auth-CfdnLqh3.js +187 -0
  293. package/dist/provider-auth-gpHOMUBP.js +187 -0
  294. package/dist/provider-dispatcher-D4eY8LZW.js +659 -0
  295. package/dist/provider-dispatcher-D5Q7M15D.js +660 -0
  296. package/dist/push-apns-BNwVMXX9.js +713 -0
  297. package/dist/push-apns-BszVkcZK.js +711 -0
  298. package/dist/pw-ai-Bdb3zrBM.js +1911 -0
  299. package/dist/pw-ai-BvcvEdGs.js +1908 -0
  300. package/dist/qr-cli-BBgk2ci1.js +349 -0
  301. package/dist/qr-cli-BLzVrhia.js +353 -0
  302. package/dist/redact-snapshot-CyBDcb_a.js +1966 -0
  303. package/dist/redact-snapshot-D9oPMqA-.js +1966 -0
  304. package/dist/register.agent-CAhKX3Ft.js +1019 -0
  305. package/dist/register.agent-RKHXtLLm.js +291 -0
  306. package/dist/register.configure-CW6XRGxV.js +129 -0
  307. package/dist/register.configure-dvrKc0j7.js +134 -0
  308. package/dist/register.import-CRLOolHv.js +31 -0
  309. package/dist/register.import-dhDEj7Om.js +29 -0
  310. package/dist/register.maintenance-EAhr1tJ9.js +500 -0
  311. package/dist/register.maintenance-lWz4v90u.js +502 -0
  312. package/dist/register.message-DyWkwUIU.js +690 -0
  313. package/dist/register.message-bl2Khz6c.js +686 -0
  314. package/dist/register.onboard-BAozmeei.js +97 -0
  315. package/dist/register.onboard-Da9hWQR1.js +93 -0
  316. package/dist/register.setup-DVrQWLoF.js +117 -0
  317. package/dist/register.setup-DbiLuuqg.js +113 -0
  318. package/dist/register.status-health-sessions-CA8ApUkH.js +668 -0
  319. package/dist/register.status-health-sessions-lGszs-NJ.js +428 -0
  320. package/dist/register.subclis-C-lqMygb.js +267 -0
  321. package/dist/replies-BTC1z8j0.js +136 -0
  322. package/dist/replies-BhlnuFp0.js +136 -0
  323. package/dist/reply-DZMooMoq.js +12880 -0
  324. package/dist/reply-directives-C0-hYyAt.js +182 -0
  325. package/dist/reply-directives-C_CGXLBJ.js +182 -0
  326. package/dist/reply-payloads-BospFSPI.js +527 -0
  327. package/dist/reply-prefix-DDgh77yy.js +37 -0
  328. package/dist/reply-prefix-DwKZPZyG.js +37 -0
  329. package/dist/reply-yGEQ0UW4.js +12877 -0
  330. package/dist/resolve-route-B73QhBIl.js +249 -0
  331. package/dist/resolve-route-DckdRbW8.js +249 -0
  332. package/dist/response-prefix-template-x5RBQnEy.js +134 -0
  333. package/dist/retry-CDrH81GP.js +77 -0
  334. package/dist/run-main-D869n5qf.js +307 -0
  335. package/dist/secure-random-CxzxAnMS.js +44 -0
  336. package/dist/security-cli-CfqosyUf.js +487 -0
  337. package/dist/security-cli-DMZun6gO.js +482 -0
  338. package/dist/send-3wvngctD.js +547 -0
  339. package/dist/send-AY7Fs5ky.js +374 -0
  340. package/dist/send-BSWD4Kr_.js +2245 -0
  341. package/dist/send-BT4HhTLm.js +349 -0
  342. package/dist/send-BvuxToC8.js +2245 -0
  343. package/dist/send-CaUxFvu0.js +492 -0
  344. package/dist/send-CiBRE4OY.js +1178 -0
  345. package/dist/send-Cidd4lQn.js +11 -0
  346. package/dist/send-Cq_Db9wG.js +1779 -0
  347. package/dist/send-DBFcxDPm.js +1776 -0
  348. package/dist/send-DUha0nIz.js +492 -0
  349. package/dist/send-DgYBI05s.js +332 -0
  350. package/dist/send-Dnf5bISH.js +426 -0
  351. package/dist/send-NcQk6UH1.js +547 -0
  352. package/dist/send-Og0-IMee.js +29 -0
  353. package/dist/send-oCN80Pl2.js +349 -0
  354. package/dist/server-DoGGLeP3.js +202 -0
  355. package/dist/server-V7G9FG2A.js +206 -0
  356. package/dist/server-lifecycle-CSWpSlvn.js +2437 -0
  357. package/dist/server-lifecycle-Cal8hBP1.js +2437 -0
  358. package/dist/server-node-events-DSee6jSG.js +394 -0
  359. package/dist/server-node-events-DbQWkU3M.js +390 -0
  360. package/dist/service-Duw0xMJX.js +670 -0
  361. package/dist/service-SRcnA1Am.js +670 -0
  362. package/dist/session-BLcfWX5_.js +170 -0
  363. package/dist/session-CQwkaAs-.js +170 -0
  364. package/dist/session-cost-usage-C-UcrvL4.js +627 -0
  365. package/dist/session-cost-usage-Dg3dzS0E.js +627 -0
  366. package/dist/session-dirs-D6mFEF90.js +318 -0
  367. package/dist/session-dirs-DVsG6e7L.js +318 -0
  368. package/dist/session-utils-C6522g3D.js +622 -0
  369. package/dist/session-utils-Dq2BJyVy.js +622 -0
  370. package/dist/sessions-CNkj4Eq8.js +247 -0
  371. package/dist/sessions-DDIoP7Rl.js +2569 -0
  372. package/dist/shell-env-D8nXPDbP.js +163 -0
  373. package/dist/ssrf-7I3FUHpm.js +183 -0
  374. package/dist/ssrf-DZi4qw5c.js +183 -0
  375. package/dist/status-CrAe8ZYt.js +1983 -0
  376. package/dist/status-DetRJxvZ.js +1979 -0
  377. package/dist/status.update-DquSK3p7.js +449 -0
  378. package/dist/status.update-iABAY3iW.js +449 -0
  379. package/dist/store-Bnm6zwaq.js +2571 -0
  380. package/dist/store-CVkGKjWm.js +64 -0
  381. package/dist/store-D_gpBpAW.js +64 -0
  382. package/dist/store-mxh63FBa.js +53 -0
  383. package/dist/subagent-registry-DNAz7Heu.js +4856 -0
  384. package/dist/subagent-registry-Dhz6HC4Z.js +4854 -0
  385. package/dist/subsystem-DGSHVL8I.js +1081 -0
  386. package/dist/subsystem-m7RSGQoR.js +1196 -0
  387. package/dist/system-cli-ByVDF6p8.js +77 -0
  388. package/dist/system-cli-CERb89Bl.js +73 -0
  389. package/dist/systemd-CSUtfsJx.js +547 -0
  390. package/dist/systemd-hints-BCxkQemJ.js +278 -0
  391. package/dist/systemd-hints-ef7m-7ZH.js +278 -0
  392. package/dist/systemd-linger-CWLgT0Wr.js +75 -0
  393. package/dist/systemd-linger-DT0E7YET.js +75 -0
  394. package/dist/systemd-tS61V4ao.js +547 -0
  395. package/dist/tables-DED01JNI.js +55 -0
  396. package/dist/tables-K3rOiGaJ.js +55 -0
  397. package/dist/tables-NcsXz3r_.js +55 -0
  398. package/dist/tailnet-CEudzG0i.js +40 -0
  399. package/dist/tailnet-D66Y5zC7.js +40 -0
  400. package/dist/tailscale-DjSRjPA-.js +230 -0
  401. package/dist/tailscale-DngZHD9L.js +230 -0
  402. package/dist/targets-BOpYPsGM.js +2545 -0
  403. package/dist/targets-BVsxzQh1.js +220 -0
  404. package/dist/targets-C99szk_e.js +114 -0
  405. package/dist/targets-CA4zx5G4.js +650 -0
  406. package/dist/targets-CTNm3bJ8.js +2544 -0
  407. package/dist/targets-DpmQjetK.js +53 -0
  408. package/dist/targets-Q-YGeAqu.js +650 -0
  409. package/dist/targets-rdWlC6Y-.js +53 -0
  410. package/dist/tool-display-Br6mwaJc.js +785 -0
  411. package/dist/tool-display-CLBf5cRa.js +785 -0
  412. package/dist/tool-images-DB4f57XK.js +263 -0
  413. package/dist/tool-images-kloBqxqK.js +263 -0
  414. package/dist/trash-B32LfX0l.js +125 -0
  415. package/dist/trash-SlUJxKO7.js +125 -0
  416. package/dist/tui-CHOtFK6k.js +3282 -0
  417. package/dist/tui-D4yiSpop.js +3282 -0
  418. package/dist/tui-cli-CzrjmAMZ.js +66 -0
  419. package/dist/tui-cli-Dpbs2QW_.js +62 -0
  420. package/dist/update-B5nYVxpc.js +349 -0
  421. package/dist/update-Bs3HhSnE.js +349 -0
  422. package/dist/update-cli-D_yz9Kyz.js +1147 -0
  423. package/dist/update-cli-DdfwNAsA.js +1149 -0
  424. package/dist/usage-BVyabt5E.js +5421 -0
  425. package/dist/voice-credentials-CI4VgB6u.js +46 -0
  426. package/dist/voice-credentials-l_d_gZiG.js +46 -0
  427. package/dist/web-B5xSAAH2.js +74 -0
  428. package/dist/web-Cc4tDVO9.js +3067 -0
  429. package/dist/web-Cdp9_IUk.js +79 -0
  430. package/dist/webhooks-cli-BDPcBkZL.js +330 -0
  431. package/dist/webhooks-cli-sRfsNesg.js +334 -0
  432. package/dist/whatsapp-actions-BGZXdWiP.js +125 -0
  433. package/dist/whatsapp-actions-HdmZu8oU.js +130 -0
  434. package/dist/workspace-D5LAl41l.js +449 -0
  435. package/dist/workspace-DRYGbrDM.js +447 -0
  436. package/dist/zod-schema-C8gEV0uz.js +2739 -0
  437. package/dist/zod-schema-CCUbW_Si.js +2739 -0
  438. package/package.json +1 -1
  439. package/dist/accounts-Aqbb2_Fn.js +0 -270
  440. package/dist/accounts-Bo2bX8jP.js +0 -272
  441. package/dist/accounts-D3fAPVzU.js +0 -36
  442. package/dist/accounts-DUEDngp6.js +0 -32
  443. package/dist/accounts-DZmv4bXS.js +0 -47
  444. package/dist/accounts-DmB4SVPK.js +0 -47
  445. package/dist/accounts-DtkyfvwR.js +0 -36
  446. package/dist/ack-reactions-Bvfy17SM.js +0 -446
  447. package/dist/ack-reactions-DYU8uhcz.js +0 -446
  448. package/dist/acp-cli-DVXhDMc6.js +0 -1324
  449. package/dist/acp-cli-QBL4_qcW.js +0 -1319
  450. package/dist/active-listener-CwxZ24bZ.js +0 -37
  451. package/dist/active-listener-v2sItamh.js +0 -37
  452. package/dist/agent-BisC5WZ6.js +0 -704
  453. package/dist/agent-Bqdrc0AK.js +0 -703
  454. package/dist/agent-helpers-BSGqeJr-.js +0 -400
  455. package/dist/agent-scope-_ND_-bJy.js +0 -116
  456. package/dist/agents-khSbraAA.js +0 -760
  457. package/dist/agents.config-D8gLHPWo.js +0 -116
  458. package/dist/audio-BIvUsncf.js +0 -43
  459. package/dist/audio-CQ8TfmVN.js +0 -43
  460. package/dist/audit-C0x7Cm6K.js +0 -3150
  461. package/dist/audit-CAY-uzWP.js +0 -3150
  462. package/dist/auth-DGqCLaQq.js +0 -448
  463. package/dist/auth-DLTRySEi.js +0 -314
  464. package/dist/auth-Drf91ntw.js +0 -315
  465. package/dist/auth-ku2khJyQ.js +0 -448
  466. package/dist/banner-txHC40UW.js +0 -294
  467. package/dist/binaries-BTvHIrCr.js +0 -13
  468. package/dist/bindings-DsWJQVKh.js +0 -69
  469. package/dist/bonjour-discovery-BElR62fH.js +0 -378
  470. package/dist/bonjour-discovery-C8XyVsjb.js +0 -378
  471. package/dist/browser-cli-DxJew43l.js +0 -1694
  472. package/dist/browser-cli-p0nakrjO.js +0 -1690
  473. package/dist/call-BrTmlOx3.js +0 -518
  474. package/dist/call-ChdUdwb4.js +0 -517
  475. package/dist/catalog-DTlcfTT9.js +0 -185
  476. package/dist/catalog-PixZqhZK.js +0 -185
  477. package/dist/channel-account-context-BO245Tcn.js +0 -133
  478. package/dist/channel-account-context-BgK0hm-I.js +0 -133
  479. package/dist/channel-activity-B0qlUR5e.js +0 -292
  480. package/dist/channel-activity-C-L6rDrQ.js +0 -94
  481. package/dist/channel-activity-DdgLBZ7M.js +0 -94
  482. package/dist/channel-options-CjlvAHSH.js +0 -32
  483. package/dist/channel-options-DpjP7qQf.js +0 -33
  484. package/dist/channel-selection-DW21dXB1.js +0 -51
  485. package/dist/channel-selection-wK_6S2Ku.js +0 -51
  486. package/dist/channel-web-COTkzJBt.js +0 -2136
  487. package/dist/channel-web-DUz5bn9h.js +0 -2134
  488. package/dist/channels-cli-D8RS8g2Q.js +0 -1438
  489. package/dist/channels-cli-X_8rENR6.js +0 -1434
  490. package/dist/channels-status-issues-B6I2l7Sm.js +0 -18
  491. package/dist/channels-status-issues-DhDH2fWp.js +0 -18
  492. package/dist/chrome-Dqtq7zCc.js +0 -1733
  493. package/dist/chrome-XeSY99Z_.js +0 -1732
  494. package/dist/chunk-CWD_zrz_.js +0 -341
  495. package/dist/chunk-LUabyS9k.js +0 -341
  496. package/dist/clack-prompter-fAgbvPW4.js +0 -122
  497. package/dist/clack-prompter-kf9qTN5p.js +0 -121
  498. package/dist/cli-BjPLpuZR.js +0 -133
  499. package/dist/cli-fFyOTtkD.js +0 -129
  500. package/dist/client-B9u3JdT_.js +0 -2316
  501. package/dist/client-DEEOhx0w.js +0 -2316
  502. package/dist/clipboard-B2nstLx7.js +0 -31
  503. package/dist/clipboard-C8QI9fes.js +0 -31
  504. package/dist/command-format-D0vKipG9.js +0 -32
  505. package/dist/command-format-LFmgWzKJ.js +0 -18
  506. package/dist/command-registry-BsPaMI53.js +0 -215
  507. package/dist/commands-BAYwlS3d.js +0 -41
  508. package/dist/commands-D842kCjj.js +0 -41
  509. package/dist/commands-registry-Cg2GTT2J.js +0 -892
  510. package/dist/commands-registry-Yz-uV5oG.js +0 -891
  511. package/dist/common-B67cBSew.js +0 -156
  512. package/dist/common-DEoiTqOr.js +0 -156
  513. package/dist/completion-cli-BO5mIPLa.js +0 -452
  514. package/dist/completion-cli-z9a6MVgr.js +0 -452
  515. package/dist/config-CAa0rZSx.js +0 -4225
  516. package/dist/config-W0w-gi2j.js +0 -4223
  517. package/dist/config-cli-DdRue35G.js +0 -243
  518. package/dist/config-cli-uOwxu5AC.js +0 -247
  519. package/dist/config-guard-BI85dxHR.js +0 -99
  520. package/dist/config-guard-DQqnigKh.js +0 -75
  521. package/dist/config-validation-D-h4LHyA.js +0 -18
  522. package/dist/config-validation-Df_kroIQ.js +0 -18
  523. package/dist/configure-B7ChPbXv.js +0 -891
  524. package/dist/configure-QspkIXME.js +0 -889
  525. package/dist/control-auth-BrBr2xb8.js +0 -397
  526. package/dist/control-auth-CehjYKnL.js +0 -397
  527. package/dist/control-ui-assets-D8F383Mo.js +0 -186
  528. package/dist/control-ui-assets-DYKtRIm0.js +0 -186
  529. package/dist/conversation-label-Bn5j3lUT.js +0 -36
  530. package/dist/conversation-label-CDH4rKMG.js +0 -36
  531. package/dist/cron-cli-DVzDHzAX.js +0 -494
  532. package/dist/cron-cli-gkH2qKM4.js +0 -498
  533. package/dist/daemon-cli-BTdNO1vH.js +0 -737
  534. package/dist/daemon-cli-DNNqI2LD.js +0 -735
  535. package/dist/daemon-install-CaEHG92p.js +0 -56
  536. package/dist/daemon-install-DbpDSDfW.js +0 -60
  537. package/dist/daemon-install-helpers-DjE_WnlY.js +0 -504
  538. package/dist/daemon-install-helpers-DocTUxqQ.js +0 -504
  539. package/dist/deliver-CDcL8ok6.js +0 -481
  540. package/dist/deliver-CS8JsevV.js +0 -481
  541. package/dist/delivery-queue-CTaYZQ_8.js +0 -244
  542. package/dist/delivery-queue-DMZ7mH8P.js +0 -244
  543. package/dist/devices-cli-BBJ4His-.js +0 -319
  544. package/dist/devices-cli-DHSJSFW1.js +0 -323
  545. package/dist/diagnostics-BSvCaLNs.js +0 -35
  546. package/dist/diagnostics-mWFAsFeo.js +0 -35
  547. package/dist/directory-cli-C-oHD_XE.js +0 -224
  548. package/dist/directory-cli-Cw99VGvr.js +0 -220
  549. package/dist/dispatcher-C8d1NNLZ.js +0 -174
  550. package/dist/dispatcher-DY6Ga60j.js +0 -173
  551. package/dist/dm-policy-shared-CRQ-Wr5g.js +0 -22
  552. package/dist/dm-policy-shared-CXXf2ltd.js +0 -22
  553. package/dist/dns-cli-BOqx9qo1.js +0 -199
  554. package/dist/dns-cli-WfqSC3JU.js +0 -203
  555. package/dist/dock-Big-J2VN.js +0 -929
  556. package/dist/dock-Cj4PKiUh.js +0 -928
  557. package/dist/doctor-completion-hYqcZ7IE.js +0 -92
  558. package/dist/doctor-completion-nxQQ5bEw.js +0 -92
  559. package/dist/doctor-config-flow-BUuADMDa.js +0 -1935
  560. package/dist/doctor-config-flow-yOUpQC2B.js +0 -1934
  561. package/dist/enable-DC9V0nTO.js +0 -59
  562. package/dist/env-B3zr72vQ.js +0 -60
  563. package/dist/errors-CdmXrBic.js +0 -35
  564. package/dist/errors-Cr_NbOb4.js +0 -35
  565. package/dist/exec-D_s-zAtY.js +0 -164
  566. package/dist/exec-Zz6eJ6YU.js +0 -164
  567. package/dist/fetch-BIZkXB5i.js +0 -67
  568. package/dist/fetch-DRVdxxEj.js +0 -67
  569. package/dist/fetch-DTR2MlOk.js +0 -67
  570. package/dist/file-lock-6NXMPZTT.js +0 -107
  571. package/dist/file-lock-C_KRlR7M.js +0 -107
  572. package/dist/fs-safe-DZHpH7TI.js +0 -98
  573. package/dist/fs-safe-vm3JMUkq.js +0 -88
  574. package/dist/gateway-cli-DEW-Ukmc.js +0 -24351
  575. package/dist/gateway-cli-DQYcZCOV.js +0 -24347
  576. package/dist/gateway-rpc-BCFkQPa2.js +0 -28
  577. package/dist/gateway-rpc-DOgYbsOG.js +0 -28
  578. package/dist/gmail-setup-utils-DMeA1UM1.js +0 -423
  579. package/dist/gmail-setup-utils-FHWSAur3.js +0 -422
  580. package/dist/health-BrLNGkZV.js +0 -1414
  581. package/dist/health-C8p9mnfl.js +0 -1417
  582. package/dist/heartbeat-visibility-CJVdaMZF.js +0 -125
  583. package/dist/heartbeat-visibility-DwK1UL0t.js +0 -125
  584. package/dist/hook-runner-global-C0DFQmQw.js +0 -527
  585. package/dist/hooks-cli-DEKi-tbA.js +0 -1221
  586. package/dist/hooks-cli-FndXPMD3.js +0 -1225
  587. package/dist/image-ops-B9ofmzSq.js +0 -354
  588. package/dist/image-ops-CMuvRsMY.js +0 -354
  589. package/dist/import-BH13F5mT.js +0 -606
  590. package/dist/import-D8HVcDqO.js +0 -604
  591. package/dist/inbound-context-BLy-G2Eq.js +0 -68
  592. package/dist/inbound-context-CmmmT8IP.js +0 -68
  593. package/dist/inbound-path-policy-BdmTOUka.js +0 -90
  594. package/dist/inbound-path-policy-BurOAu44.js +0 -90
  595. package/dist/inspect-nW8LAukU.js +0 -286
  596. package/dist/inspect-xy2EHy8G.js +0 -286
  597. package/dist/installs-CpfHmKY1.js +0 -325
  598. package/dist/installs-DebiMrGj.js +0 -325
  599. package/dist/ipv4-ysiNGssl.js +0 -46
  600. package/dist/ipv4-zc_Hfvbp.js +0 -46
  601. package/dist/ir-CaxTklDC.js +0 -940
  602. package/dist/lifecycle-core-Z5SScMlU.js +0 -476
  603. package/dist/lifecycle-core-pPwYSt7m.js +0 -474
  604. package/dist/loader-BapIdJyx.js +0 -22404
  605. package/dist/loader-BdAToyDH.js +0 -22401
  606. package/dist/local-roots-CrJ_Jv_G.js +0 -314
  607. package/dist/local-roots-n_Y4iYwb.js +0 -313
  608. package/dist/logger-B8yHnzPl.js +0 -49
  609. package/dist/login-C99fsB0N.js +0 -61
  610. package/dist/login-cLvGPjeO.js +0 -62
  611. package/dist/login-qr-CGqRFwgl.js +0 -329
  612. package/dist/login-qr-dnY5DC2C.js +0 -325
  613. package/dist/logs-cli-Bda7xY4N.js +0 -236
  614. package/dist/logs-cli-HzR-vnpD.js +0 -240
  615. package/dist/markdown-tables-58Hq__7K.js +0 -29
  616. package/dist/markdown-tables-GFEX0OR6.js +0 -29
  617. package/dist/media-CFsyXs3H.js +0 -940
  618. package/dist/media-Du5SHtnp.js +0 -10452
  619. package/dist/message-action-names-BfuEvR6j.js +0 -2521
  620. package/dist/message-action-names-CVBkpOLt.js +0 -2521
  621. package/dist/message-channel-FMNRI5Ax.js +0 -91
  622. package/dist/mime-AuIDUZPG.js +0 -149
  623. package/dist/mime-Cqg1jjia.js +0 -149
  624. package/dist/net-BEFkF-nI.js +0 -225
  625. package/dist/net-CNsUGiSw.js +0 -225
  626. package/dist/node-cli-Bu-InsO9.js +0 -1462
  627. package/dist/node-cli-DE7Pm7Fr.js +0 -1458
  628. package/dist/node-service-CumFZc9L.js +0 -67
  629. package/dist/node-service-DY1gG06I.js +0 -67
  630. package/dist/nodes-cli-B5aAExN0.js +0 -1350
  631. package/dist/nodes-cli-eKRqlKuO.js +0 -1346
  632. package/dist/nodes-screen-B3Sij1uT.js +0 -250
  633. package/dist/nodes-screen-DEvpoFmH.js +0 -250
  634. package/dist/note-CPFJCWJJ.js +0 -92
  635. package/dist/npm-registry-spec-BgMtTHvq.js +0 -786
  636. package/dist/npm-registry-spec-Dz3z1Zpd.js +0 -786
  637. package/dist/npm-resolution-Buio63BQ.js +0 -86
  638. package/dist/npm-resolution-gH1zHW2a.js +0 -86
  639. package/dist/onboard-BSf6qJWk.js +0 -647
  640. package/dist/onboard-V-SsZRk-.js +0 -649
  641. package/dist/onboard-auth-C_wHkop1.js +0 -207
  642. package/dist/onboard-auth-CkCBLvTg.js +0 -211
  643. package/dist/onboard-channels-DQTGPC18.js +0 -2548
  644. package/dist/onboard-channels-DSDQfR0u.js +0 -2547
  645. package/dist/onboard-helpers-Q7M6vdzh.js +0 -363
  646. package/dist/onboard-helpers-SCO3k5Y8.js +0 -364
  647. package/dist/onboard-remote-Co2hv1AD.js +0 -127
  648. package/dist/onboard-remote-Dl3BFSg2.js +0 -127
  649. package/dist/onboarding-B0bJfZ20.js +0 -588
  650. package/dist/onboarding-CeBR9OBi.js +0 -586
  651. package/dist/onboarding.finalize-BPgfWPB9.js +0 -404
  652. package/dist/onboarding.finalize-BmfLvNPJ.js +0 -402
  653. package/dist/onboarding.gateway-config-BL0Q7Wpg.js +0 -201
  654. package/dist/onboarding.gateway-config-D2QsXMYO.js +0 -195
  655. package/dist/outbound-CcaPcetn.js +0 -220
  656. package/dist/outbound-CeiW8z3a.js +0 -221
  657. package/dist/outbound-attachment-BIvFb3Is.js +0 -18
  658. package/dist/outbound-attachment-Bfm5-JYe.js +0 -18
  659. package/dist/outbound-attachment-CZ7zoYxB.js +0 -18
  660. package/dist/pairing-cli-CgX79ujL.js +0 -125
  661. package/dist/pairing-cli-DvbbXFgC.js +0 -129
  662. package/dist/pairing-labels-3wDxaApH.js +0 -9
  663. package/dist/pairing-labels-DCbWnbWk.js +0 -9
  664. package/dist/pairing-store-CdY7iRS0.js +0 -459
  665. package/dist/pairing-store-DykkYpQ7.js +0 -460
  666. package/dist/path-env-Cqo5LZmw.js +0 -89
  667. package/dist/path-env-GTM4HXCN.js +0 -89
  668. package/dist/path-safety-CXKAVpMp.js +0 -14
  669. package/dist/path-safety-DGB91qBk.js +0 -14
  670. package/dist/plugin-auto-enable-C6FPGg_-.js +0 -301
  671. package/dist/plugin-auto-enable-L8eOc8iC.js +0 -302
  672. package/dist/plugin-registry-CHlaWZD7.js +0 -33
  673. package/dist/plugin-registry-DQdMze4z.js +0 -33
  674. package/dist/plugin-sdk/auth/session-override.d.ts +0 -17
  675. package/dist/plugin-sdk/auto-reply/reply/directive-handling.auth.d.ts +0 -18
  676. package/dist/plugin-sdk/link-understanding/apply.d.ts +0 -10
  677. package/dist/plugin-sdk/link-understanding/defaults.d.ts +0 -2
  678. package/dist/plugin-sdk/link-understanding/detect.d.ts +0 -3
  679. package/dist/plugin-sdk/link-understanding/format.d.ts +0 -4
  680. package/dist/plugin-sdk/link-understanding/runner.d.ts +0 -11
  681. package/dist/plugin-sdk/media/input-files.d.ts +0 -95
  682. package/dist/plugin-sdk/media-understanding/apply.d.ts +0 -19
  683. package/dist/plugin-sdk/media-understanding/attachments.d.ts +0 -49
  684. package/dist/plugin-sdk/media-understanding/concurrency.d.ts +0 -1
  685. package/dist/plugin-sdk/media-understanding/defaults.d.ts +0 -11
  686. package/dist/plugin-sdk/media-understanding/errors.d.ts +0 -6
  687. package/dist/plugin-sdk/media-understanding/format.d.ts +0 -7
  688. package/dist/plugin-sdk/media-understanding/fs.d.ts +0 -1
  689. package/dist/plugin-sdk/media-understanding/output-extract.d.ts +0 -2
  690. package/dist/plugin-sdk/media-understanding/providers/anthropic/index.d.ts +0 -2
  691. package/dist/plugin-sdk/media-understanding/providers/deepgram/audio.d.ts +0 -1
  692. package/dist/plugin-sdk/media-understanding/providers/deepgram/index.d.ts +0 -2
  693. package/dist/plugin-sdk/media-understanding/providers/google/audio.d.ts +0 -1
  694. package/dist/plugin-sdk/media-understanding/providers/google/index.d.ts +0 -2
  695. package/dist/plugin-sdk/media-understanding/providers/google/video.d.ts +0 -3
  696. package/dist/plugin-sdk/media-understanding/providers/groq/index.d.ts +0 -2
  697. package/dist/plugin-sdk/media-understanding/providers/index.d.ts +0 -4
  698. package/dist/plugin-sdk/media-understanding/providers/minimax/index.d.ts +0 -2
  699. package/dist/plugin-sdk/media-understanding/providers/mistral/index.d.ts +0 -2
  700. package/dist/plugin-sdk/media-understanding/providers/moonshot/index.d.ts +0 -2
  701. package/dist/plugin-sdk/media-understanding/providers/moonshot/video.d.ts +0 -3
  702. package/dist/plugin-sdk/media-understanding/providers/openai/audio.d.ts +0 -1
  703. package/dist/plugin-sdk/media-understanding/providers/openai/index.d.ts +0 -2
  704. package/dist/plugin-sdk/media-understanding/providers/shared.d.ts +0 -20
  705. package/dist/plugin-sdk/media-understanding/providers/zai/index.d.ts +0 -2
  706. package/dist/plugin-sdk/media-understanding/resolve.d.ts +0 -44
  707. package/dist/plugin-sdk/media-understanding/runner.d.ts +0 -34
  708. package/dist/plugin-sdk/media-understanding/runner.entries.d.ts +0 -33
  709. package/dist/plugin-sdk/media-understanding/scope.d.ts +0 -9
  710. package/dist/plugin-sdk/media-understanding/types.d.ts +0 -59
  711. package/dist/plugin-sdk/media-understanding/video.d.ts +0 -2
  712. package/dist/plugin-sdk/utils/mask-api-key.d.ts +0 -1
  713. package/dist/plugin-sdk/utils/run-with-concurrency.d.ts +0 -11
  714. package/dist/plugins-7B167wIj.js +0 -453
  715. package/dist/plugins-BRHOfy1Z.js +0 -455
  716. package/dist/plugins-cli--I43zIaS.js +0 -797
  717. package/dist/plugins-cli-DIxMbY9I.js +0 -801
  718. package/dist/ports-BS8kQkd9.js +0 -96
  719. package/dist/ports-CAqyeQYZ.js +0 -316
  720. package/dist/ports-CTUgXF2d.js +0 -96
  721. package/dist/ports-DqfnVnCw.js +0 -370
  722. package/dist/preflight-CaRJtknt.js +0 -64
  723. package/dist/preflight-DeDRKMx4.js +0 -68
  724. package/dist/program-context-9dv7ClZz.js +0 -474
  725. package/dist/program-wVSvyiD-.js +0 -248
  726. package/dist/prompt-select-styled-BE_4W66Z.js +0 -1672
  727. package/dist/prompt-select-styled-BTPf06Os.js +0 -1669
  728. package/dist/provider-dispatcher-VZWITjmt.js +0 -660
  729. package/dist/provider-dispatcher-zYYGo00g.js +0 -659
  730. package/dist/push-apns-Cj0Ryn18.js +0 -713
  731. package/dist/push-apns-fFfYCqda.js +0 -711
  732. package/dist/pw-ai-CnN2sITD.js +0 -1908
  733. package/dist/pw-ai-fnX3cecw.js +0 -1911
  734. package/dist/qr-cli-CriPg41m.js +0 -349
  735. package/dist/qr-cli-DSURqD0D.js +0 -353
  736. package/dist/redact-snapshot-BecRL_h6.js +0 -2016
  737. package/dist/redact-snapshot-pTdzSrex.js +0 -2016
  738. package/dist/register.agent-B5_1XatO.js +0 -290
  739. package/dist/register.agent-Dba3CYyo.js +0 -1018
  740. package/dist/register.configure-DmwHGsPG.js +0 -128
  741. package/dist/register.configure-DrPlgBqB.js +0 -133
  742. package/dist/register.import-CPQqqdje.js +0 -31
  743. package/dist/register.import-D1UaH1QV.js +0 -29
  744. package/dist/register.maintenance-D76tiF4W.js +0 -501
  745. package/dist/register.maintenance-hUriFBfi.js +0 -499
  746. package/dist/register.message--VzmF3u4.js +0 -685
  747. package/dist/register.message-itNWUdvP.js +0 -689
  748. package/dist/register.onboard-Co8D908b.js +0 -93
  749. package/dist/register.onboard-q8JzWtuv.js +0 -97
  750. package/dist/register.setup-Djc6jZTc.js +0 -113
  751. package/dist/register.setup-hhPii4O7.js +0 -117
  752. package/dist/register.status-health-sessions-C1FhACQB.js +0 -668
  753. package/dist/register.status-health-sessions-DcUegHcH.js +0 -428
  754. package/dist/register.subclis-DAfihpBz.js +0 -267
  755. package/dist/replies-IpiCq1Ht.js +0 -136
  756. package/dist/replies-LSx_XhsP.js +0 -136
  757. package/dist/reply-D0CLqcBY.js +0 -13718
  758. package/dist/reply-Djq8ghfI.js +0 -13715
  759. package/dist/reply-directives-Cz7622Qx.js +0 -182
  760. package/dist/reply-directives-ssnaPNiU.js +0 -182
  761. package/dist/reply-payloads-CQMtrphw.js +0 -527
  762. package/dist/reply-prefix-CWcAZKhE.js +0 -37
  763. package/dist/reply-prefix-Drq7Pf3A.js +0 -37
  764. package/dist/resolve-route-B8uIc2H3.js +0 -249
  765. package/dist/resolve-route-C8ooNlI4.js +0 -249
  766. package/dist/response-prefix-template-DPOggmPO.js +0 -134
  767. package/dist/retry-BdhJlZQI.js +0 -77
  768. package/dist/run-main-B-Cb62fC.js +0 -306
  769. package/dist/runner-DUnmgjJ8.js +0 -2394
  770. package/dist/runner-EobZIrDt.js +0 -2394
  771. package/dist/secure-random-B5qmFc3N.js +0 -44
  772. package/dist/security-cli-05blEYyC.js +0 -482
  773. package/dist/security-cli-DYbt8duB.js +0 -487
  774. package/dist/send-7O3-bRtl.js +0 -547
  775. package/dist/send-9Huf62k3.js +0 -2245
  776. package/dist/send-B9mIJdUo.js +0 -547
  777. package/dist/send-Bj0RXr-a.js +0 -492
  778. package/dist/send-BzkAsn7K.js +0 -29
  779. package/dist/send-CXFhFLP9.js +0 -11
  780. package/dist/send-Ce_BDa8P.js +0 -349
  781. package/dist/send-ChvasRSh.js +0 -1779
  782. package/dist/send-Cl5BhbnF.js +0 -426
  783. package/dist/send-CpebTvM6.js +0 -374
  784. package/dist/send-DWf7BCPe.js +0 -492
  785. package/dist/send-DX8QSuSI.js +0 -1174
  786. package/dist/send-DZRn6PT2.js +0 -332
  787. package/dist/send-Dd2_MykI.js +0 -2245
  788. package/dist/send-IJaUAa8H.js +0 -1776
  789. package/dist/send-vvZXksNU.js +0 -349
  790. package/dist/server-BrzR9JmX.js +0 -206
  791. package/dist/server-_h27-uP_.js +0 -202
  792. package/dist/server-lifecycle-CUdA6Far.js +0 -2437
  793. package/dist/server-lifecycle-DQZWL8iP.js +0 -2437
  794. package/dist/server-node-events-DgB1z2Cx.js +0 -392
  795. package/dist/server-node-events-DtvPfM1I.js +0 -396
  796. package/dist/service-9le8AnC-.js +0 -670
  797. package/dist/service-Drb0kx6I.js +0 -670
  798. package/dist/session-BIAOl5QR.js +0 -170
  799. package/dist/session-Wu00pCn_.js +0 -170
  800. package/dist/session-cost-usage-7plmOKbs.js +0 -627
  801. package/dist/session-cost-usage-CPFxBFUg.js +0 -627
  802. package/dist/session-dirs-CfIrIJxG.js +0 -318
  803. package/dist/session-dirs-DlPpWt5Q.js +0 -318
  804. package/dist/session-utils-Sd9w4vc1.js +0 -622
  805. package/dist/session-utils-iL47hYmZ.js +0 -622
  806. package/dist/sessions-6pKQ3gN3.js +0 -247
  807. package/dist/sessions-ZRmCDdj1.js +0 -2569
  808. package/dist/shell-env-DYZq9PqC.js +0 -163
  809. package/dist/ssrf-B-rF_tZB.js +0 -183
  810. package/dist/ssrf-DJW14Wkh.js +0 -183
  811. package/dist/status-CTRQCXRj.js +0 -1979
  812. package/dist/status-Y67xsH93.js +0 -1983
  813. package/dist/status.update-DlBReI5-.js +0 -449
  814. package/dist/status.update-v7fEQ7R9.js +0 -449
  815. package/dist/store-B5989JkX.js +0 -64
  816. package/dist/store-BgtgYJoX.js +0 -53
  817. package/dist/store-DCrrxHyS.js +0 -2571
  818. package/dist/store-Ql6vAcsg.js +0 -64
  819. package/dist/subagent-registry-BGknZEUI.js +0 -4856
  820. package/dist/subagent-registry-CWeRBjfn.js +0 -4854
  821. package/dist/subsystem-Ct6qOOqZ.js +0 -1079
  822. package/dist/subsystem-PQ64_nsu.js +0 -1136
  823. package/dist/system-cli-CmO-4Rju.js +0 -77
  824. package/dist/system-cli-VBsa18K6.js +0 -73
  825. package/dist/systemd-CqFpK30Y.js +0 -547
  826. package/dist/systemd-fK9AV5bP.js +0 -547
  827. package/dist/systemd-hints-D3rr0j14.js +0 -278
  828. package/dist/systemd-hints-DNOSRaqA.js +0 -278
  829. package/dist/systemd-linger-B907NVVy.js +0 -75
  830. package/dist/systemd-linger-wYksBbM7.js +0 -75
  831. package/dist/tables-Boxa9MJH.js +0 -55
  832. package/dist/tables-CO_kxD0e.js +0 -55
  833. package/dist/tables-WZp8Vt9n.js +0 -55
  834. package/dist/tailnet-CfZhpSnt.js +0 -40
  835. package/dist/tailnet-D0NV0tRJ.js +0 -40
  836. package/dist/tailscale-B__xvMjA.js +0 -230
  837. package/dist/tailscale-q_ZrxUCc.js +0 -230
  838. package/dist/targets-B4rMyQFJ.js +0 -53
  839. package/dist/targets-BHYLCv06.js +0 -2534
  840. package/dist/targets-BjWhDMJM.js +0 -650
  841. package/dist/targets-BnpMZZC_.js +0 -120
  842. package/dist/targets-CHwGDIgO.js +0 -650
  843. package/dist/targets-DIDKlfKI.js +0 -220
  844. package/dist/targets-bqjVeCnF.js +0 -2535
  845. package/dist/targets-mqj9GNg1.js +0 -53
  846. package/dist/tool-display-C0hpLmkw.js +0 -785
  847. package/dist/tool-display-CQTRHo3Z.js +0 -785
  848. package/dist/tool-images-BYY11Gw3.js +0 -263
  849. package/dist/tool-images-CnJ0R8Fo.js +0 -263
  850. package/dist/trash-C0mjnHuW.js +0 -125
  851. package/dist/trash-Cgwc9mLD.js +0 -125
  852. package/dist/tui-9cJnR1dN.js +0 -3282
  853. package/dist/tui-BR3egaFJ.js +0 -3282
  854. package/dist/tui-cli-BYpkhE6J.js +0 -66
  855. package/dist/tui-cli-DndeZyup.js +0 -62
  856. package/dist/update-BJVdkzk7.js +0 -349
  857. package/dist/update-DjI6KTA5.js +0 -349
  858. package/dist/update-cli-B7Rl2Qr2.js +0 -1146
  859. package/dist/update-cli-CFk_jqUm.js +0 -1148
  860. package/dist/usage-CFv4a1Nf.js +0 -5448
  861. package/dist/voice-credentials-D59RcLbl.js +0 -45
  862. package/dist/voice-credentials-fjA7GShF.js +0 -45
  863. package/dist/web-Bs1td8Qw.js +0 -79
  864. package/dist/web-CSiw--Px.js +0 -3070
  865. package/dist/web-jRTtDiNf.js +0 -74
  866. package/dist/webhooks-cli-0yQha2yj.js +0 -334
  867. package/dist/webhooks-cli-ula0bTX-.js +0 -330
  868. package/dist/whatsapp-actions-3NdzsNg1.js +0 -130
  869. package/dist/whatsapp-actions-y_1vjkYY.js +0 -125
  870. package/dist/workspace-BT3X-qCZ.js +0 -449
  871. package/dist/workspace-D5hHXubL.js +0 -447
  872. package/dist/zod-schema-CbqZAIYy.js +0 -2696
  873. package/dist/zod-schema-YGQJEcnj.js +0 -2696
  874. /package/dist/{account-lookup-BOCzCnir.js → account-lookup-CIY_RKhi.js} +0 -0
  875. /package/dist/{account-lookup-C0ndrpt-.js → account-lookup-DGscKBsr.js} +0 -0
  876. /package/dist/{agent-helpers-eEHy5uX2.js → agent-helpers-D83kfcF9.js} +0 -0
  877. /package/dist/{agents.config-BgDBcY4h.js → agents.config-BPe_hkMn.js} +0 -0
  878. /package/dist/{api-Cd_7aESj.js → api-D8QQo5bc.js} +0 -0
  879. /package/dist/{api-DJ_oWYus.js → api-GywrnwRm.js} +0 -0
  880. /package/dist/{argv-BY8EVMTP.js → argv-DW4MYBdJ.js} +0 -0
  881. /package/dist/{bindings-Dr0bGRst.js → bindings-BpL4pISF.js} +0 -0
  882. /package/dist/{brew-CmTYeZk1.js → brew-CBsS-Vq1.js} +0 -0
  883. /package/dist/{brew-V4lMBeE3.js → brew-Clw9vXhE.js} +0 -0
  884. /package/dist/{chat-envelope-CrM0X4sl.js → chat-envelope-CY1yvCc-.js} +0 -0
  885. /package/dist/{chat-envelope-BIujl9Cj.js → chat-envelope-DUMcMMB2.js} +0 -0
  886. /package/dist/{chat-type-CH3W-zKy.js → chat-type-BKe459rw.js} +0 -0
  887. /package/dist/{chat-type-DyovJwCt.js → chat-type-CE6cJOyt.js} +0 -0
  888. /package/dist/{cleanup-utils-CNwlTKyR.js → cleanup-utils-365rf8YN.js} +0 -0
  889. /package/dist/{cleanup-utils-gNzIs9yk.js → cleanup-utils-rqUXvR3Z.js} +0 -0
  890. /package/dist/{cli-name-3MdfbvIR.js → cli-name-7Gb97Vyl.js} +0 -0
  891. /package/dist/{cli-name-CRLBidNP.js → cli-name-Yv30OygA.js} +0 -0
  892. /package/dist/{cli-utils-5ZIfXAfM.js → cli-utils-5W6ugvN5.js} +0 -0
  893. /package/dist/{cli-utils-BUOtyfnU.js → cli-utils-CZJacPS2.js} +0 -0
  894. /package/dist/{client-D5m46AuY.js → client-DQ-Nh-rV.js} +0 -0
  895. /package/dist/{client-DFyI5I0n.js → client-Fi2k2G9Z.js} +0 -0
  896. /package/dist/{command-options-Cn2fc1Of.js → command-options-CXHYeogR.js} +0 -0
  897. /package/dist/{command-options-D2nN4AXX.js → command-options-Cx6evn0x.js} +0 -0
  898. /package/dist/{config-eval-CU2G7a83.js → config-eval-DU_v_3lY.js} +0 -0
  899. /package/dist/{config-eval-BCKpAS_K.js → config-eval-V26Gl6eZ.js} +0 -0
  900. /package/dist/{constants-CRGAZ2ow.js → constants-C7gkSGRE.js} +0 -0
  901. /package/dist/{constants-BAZuhSRm.js → constants-DAiBiWlI.js} +0 -0
  902. /package/dist/{constants-DoYLsBmv.js → constants-DOnQraOP.js} +0 -0
  903. /package/dist/{constants-BBVTjb1j.js → constants-DQxqJVLu.js} +0 -0
  904. /package/dist/{credentials-DMAWNZdV.js → credentials-BHWUBHMd.js} +0 -0
  905. /package/dist/{credentials-Dmc3H-jd.js → credentials-DG0tD6-e.js} +0 -0
  906. /package/dist/{daemon-runtime-CzFI2dPw.js → daemon-runtime-B7Tmba31.js} +0 -0
  907. /package/dist/{daemon-runtime-aQhinwSL.js → daemon-runtime-KyXiP2ib.js} +0 -0
  908. /package/dist/{dangerous-name-matching-BlTBBZns.js → dangerous-name-matching-B4MRPcn-.js} +0 -0
  909. /package/dist/{dangerous-tools-BRmbBvRf.js → dangerous-tools-CIPZZJoN.js} +0 -0
  910. /package/dist/{dangerous-tools-E1i3IoxZ.js → dangerous-tools-D-GNbdpV.js} +0 -0
  911. /package/dist/{fetch-timeout-DBRRPNBi.js → fetch-timeout-CPe2rPLq.js} +0 -0
  912. /package/dist/{fetch-timeout-l_6RdoMw.js → fetch-timeout-DkT3EnRA.js} +0 -0
  913. /package/dist/{file-identity-BnGA6wyc.js → file-identity-C8MIb5lb.js} +0 -0
  914. /package/dist/{format-duration-B-Uv5nOi.js → format-duration-Cd7SCued.js} +0 -0
  915. /package/dist/{format-duration-D1M3Zxu6.js → format-duration-Oj8pTbYL.js} +0 -0
  916. /package/dist/{format-relative-Cywx6ldk.js → format-relative-8dpVUfzZ.js} +0 -0
  917. /package/dist/{format-relative-DcQZUAYl.js → format-relative-BMNeqaxW.js} +0 -0
  918. /package/dist/{health-format-CL2Xq92A.js → health-format-CwLlmYSK.js} +0 -0
  919. /package/dist/{health-format-CVgQD-z9.js → health-format-CycFH5Sj.js} +0 -0
  920. /package/dist/{heartbeat-wake-DLxQm6-U.js → heartbeat-wake-D6Lt5YUk.js} +0 -0
  921. /package/dist/{heartbeat-wake-DjsTDzF3.js → heartbeat-wake-uZkAP-tP.js} +0 -0
  922. /package/dist/{help-format-DM6-OBt-.js → help-format-B0YIbosn.js} +0 -0
  923. /package/dist/{help-format-CJQ7APRn.js → help-format-GeOPYD_A.js} +0 -0
  924. /package/dist/{helpers-BER76F_2.js → helpers-6_MYSJEW.js} +0 -0
  925. /package/dist/{helpers-DSMIGYx2.js → helpers-703bXVlF.js} +0 -0
  926. /package/dist/{helpers-D-r6yhnI.js → helpers-p_u0Gnj_.js} +0 -0
  927. /package/dist/{input-provenance-BgfeDgck.js → input-provenance-C4nlFv5Y.js} +0 -0
  928. /package/dist/{input-provenance-xUsSMOsz.js → input-provenance-duDehu0D.js} +0 -0
  929. /package/dist/{ip-BAhS4rY2.js → ip-BFJnbRh9.js} +0 -0
  930. /package/dist/{ip-BUhsZdJu.js → ip-D0zgNmBV.js} +0 -0
  931. /package/dist/{is-main-BmHYGRhd.js → is-main-BE1Jih91.js} +0 -0
  932. /package/dist/{json-file-B5WEJJye.js → json-file-CsV03dh-.js} +0 -0
  933. /package/dist/{json-file-Dbg7nZg1.js → json-file-CtQKYRLl.js} +0 -0
  934. /package/dist/{json-files-BFGbyEzL.js → json-files-B2yMsppu.js} +0 -0
  935. /package/dist/{json-files-CfhnuGaC.js → json-files-BYH8U7Mx.js} +0 -0
  936. /package/dist/{lanes-4FoQemog.js → lanes-BWL_LwXG.js} +0 -0
  937. /package/dist/{lanes-BhdzrAIa.js → lanes-cHJ5arWg.js} +0 -0
  938. /package/dist/{links-CwTlzaPe.js → links-BFtUmGLH.js} +0 -0
  939. /package/dist/{links-D5vtq30Q.js → links-BNjLUJ9U.js} +0 -0
  940. /package/dist/{location-50gaJF5Z.js → location-BC45kOxc.js} +0 -0
  941. /package/dist/{location-Qo8Ii1zo.js → location-BUhzov-a.js} +0 -0
  942. /package/dist/{logger-IA_Dr_BT.js → logger-1QWMF9Hc.js} +0 -0
  943. /package/dist/{logger-nEdVxm5D.js → logger-BWMPnILd.js} +0 -0
  944. /package/dist/{logger-O6JX52kK.js → logger-Liu31nEU.js} +0 -0
  945. /package/dist/{logging-FctZEleJ.js → logging-CtbzyUjs.js} +0 -0
  946. /package/dist/{logging-BiuZwq5D.js → logging-DJFQvfGD.js} +0 -0
  947. /package/dist/{logging-Bs1VqVFL.js → logging-JiRrQn2_.js} +0 -0
  948. /package/dist/{logging-JZEg5nDp.js → logging-kuFzZMsG.js} +0 -0
  949. /package/dist/{message-channel-tuc9CdEw.js → message-channel-DOyKgFu8.js} +0 -0
  950. /package/dist/{mutable-allowlist-detectors-CtKavajp.js → mutable-allowlist-detectors-4m-Kc8Kn.js} +0 -0
  951. /package/dist/{mutable-allowlist-detectors-TCG6mnbz.js → mutable-allowlist-detectors-BECxOoKX.js} +0 -0
  952. /package/dist/{onboard-config-BxfgUqk6.js → onboard-config-C9so5ggC.js} +0 -0
  953. /package/dist/{onboard-config-DNzlo8Cg.js → onboard-config-oXID97rS.js} +0 -0
  954. /package/dist/{parse-log-line-CT0H1-oQ.js → parse-log-line-BtFI563v.js} +0 -0
  955. /package/dist/{parse-log-line-pij_xhtE.js → parse-log-line-COptqka7.js} +0 -0
  956. /package/dist/{parse-timeout-CvODy9RC.js → parse-timeout-BpphuwYl.js} +0 -0
  957. /package/dist/{path-guards-DOpzcMXz.js → path-guards-DJteVA0d.js} +0 -0
  958. /package/dist/{path-guards-DipYoPVw.js → path-guards-DVRUJZVN.js} +0 -0
  959. /package/dist/plugin-sdk/{media-understanding → stt}/providers/google/inline-data.d.ts +0 -0
  960. /package/dist/{plugins-allowlist-Bcqe9Gd8.js → plugins-allowlist-Clt6dsY6.js} +0 -0
  961. /package/dist/{polls-DQrR-qT3.js → polls-C5xr-8pM.js} +0 -0
  962. /package/dist/{polls-ybwcqkWt.js → polls-DXd67TD8.js} +0 -0
  963. /package/dist/{ports-lsof-CDyv5GJd.js → ports-lsof-xWMTWvMQ.js} +0 -0
  964. /package/dist/{process-scoped-map-BwUkYFQV.js → process-scoped-map-C7KeadUK.js} +0 -0
  965. /package/dist/{process-scoped-map-_zxf_kLz.js → process-scoped-map-CQ1C5MbT.js} +0 -0
  966. /package/dist/{program-context-CG-t6Yp-.js → program-context-LuBAPt4y.js} +0 -0
  967. /package/dist/{progress-DRLmcFiG.js → progress-C-hTn2yV.js} +0 -0
  968. /package/dist/{progress-BOdRbOHD.js → progress-ChmZpgvt.js} +0 -0
  969. /package/dist/{prompt-WEkXwIMT.js → prompt-BXeXEH0o.js} +0 -0
  970. /package/dist/{prompt-BRGfic91.js → prompt-C31r0R5I.js} +0 -0
  971. /package/dist/{prompt-style-B4Cq4PyQ.js → prompt-style-BcM-VSMx.js} +0 -0
  972. /package/dist/{proxy-BMJL0Qog.js → proxy-dRhp8Ykw.js} +0 -0
  973. /package/dist/{pw-ai-state-CwXeO5d0.js → pw-ai-state-CjfcKQoO.js} +0 -0
  974. /package/dist/{pw-ai-state-DaISdsXY.js → pw-ai-state-DfjyEttO.js} +0 -0
  975. /package/dist/{redact-gXuh8MFk.js → redact-D975G-N6.js} +0 -0
  976. /package/dist/{redact-CqWx9rpK.js → redact-Dx1Fue21.js} +0 -0
  977. /package/dist/{redact-identifier-BJOQDEj0.js → redact-identifier-Bqj_YiPd.js} +0 -0
  978. /package/dist/{redact-identifier-DR54qsoT.js → redact-identifier-HyK89Sod.js} +0 -0
  979. /package/dist/{remoteclaw-root-CgNyrbxc.js → remoteclaw-root-B1iQBmbi.js} +0 -0
  980. /package/dist/{remoteclaw-root-u8dAeHID.js → remoteclaw-root-BmYwCzQN.js} +0 -0
  981. /package/dist/{render-CDCvpfhh.js → render-BvFSFJZW.js} +0 -0
  982. /package/dist/{render-CJl4GK1B.js → render-flG67HhW.js} +0 -0
  983. /package/dist/{response-prefix-template-D3ZcJP4E.js → response-prefix-template-DDvbVpx6.js} +0 -0
  984. /package/dist/{retry-cXXk2j6_.js → retry-CByUYDAZ.js} +0 -0
  985. /package/dist/{retry-B19gMxS7.js → retry-oNE3cBeG.js} +0 -0
  986. /package/dist/{runtime-guard-BS55uiSW.js → runtime-guard-CqNug-FG.js} +0 -0
  987. /package/dist/{runtime-guard-CK80eucm.js → runtime-guard-DAHXelsb.js} +0 -0
  988. /package/dist/{runtime-status-BhW7hP_U.js → runtime-status-CM4rzyfO.js} +0 -0
  989. /package/dist/{runtime-status-hFVEC3wO.js → runtime-status-DJYthOLz.js} +0 -0
  990. /package/dist/{secret-equal-CJzes24Z.js → secret-equal-1-dwi8DL.js} +0 -0
  991. /package/dist/{secret-equal-CQAmGfGc.js → secret-equal-CXJEZiWb.js} +0 -0
  992. /package/dist/{secure-random-B3f7Ri2X.js → secure-random-Ba4Y5xG5.js} +0 -0
  993. /package/dist/{secure-random-BkZFG9cd.js → secure-random-C6AVByhV.js} +0 -0
  994. /package/dist/{stagger-B-_Wnofy.js → stagger-CjeisVRF.js} +0 -0
  995. /package/dist/{stagger-B2ORDHsP.js → stagger-vkvpUmOz.js} +0 -0
  996. /package/dist/{status-C6YNwimj.js → status-DNLnVQZ4.js} +0 -0
  997. /package/dist/{status-yrDGXYZM.js → status-DZhl73dM.js} +0 -0
  998. /package/dist/{strip-inbound-meta-0cvL6itU.js → strip-inbound-meta-C3Cwe_ZO.js} +0 -0
  999. /package/dist/{strip-inbound-meta-DjKcSFaW.js → strip-inbound-meta-DuDjnGjC.js} +0 -0
  1000. /package/dist/{table-ByMyHTh_.js → table-B9zSN_7D.js} +0 -0
  1001. /package/dist/{table-C-dba-5-.js → table-j8Ayarot.js} +0 -0
  1002. /package/dist/{target-errors-DJVRKFcU.js → target-errors-ChjvOMuV.js} +0 -0
  1003. /package/dist/{target-errors-GZXDqlUu.js → target-errors-Dn4aykSV.js} +0 -0
  1004. /package/dist/{targets-B_d_1z3N.js → targets-BtGRUQMa.js} +0 -0
  1005. /package/dist/{targets-DOJXjN1U.js → targets-CE4AYRI9.js} +0 -0
  1006. /package/dist/{targets-D01MJGnh.js → targets-DlufWCmy.js} +0 -0
  1007. /package/dist/{targets-WSwPflb6.js → targets-akvAerZF.js} +0 -0
  1008. /package/dist/{text-format-DarxU3JH.js → text-format-VSogn9Yq.js} +0 -0
  1009. /package/dist/{text-format-mr5bZq0f.js → text-format-xeHt9ywT.js} +0 -0
  1010. /package/dist/{thinking-BqJmU6Zp.js → thinking-B171Rc3-.js} +0 -0
  1011. /package/dist/{tokens-C8yGxAcR.js → tokens-B-jmvNR9.js} +0 -0
  1012. /package/dist/{tokens-DAFBx5qr.js → tokens-kTLGxaAF.js} +0 -0
  1013. /package/dist/{usage-BXi79Rq6.js → usage-CRJFqYf8.js} +0 -0
  1014. /package/dist/{usage-C1lHaofV.js → usage-Txvb0Iq2.js} +0 -0
  1015. /package/dist/{usage-format-CD5jsZY1.js → usage-format-70DvrseE.js} +0 -0
  1016. /package/dist/{usage-format-CRVpDVj1.js → usage-format-Bs8DkQtr.js} +0 -0
  1017. /package/dist/{widearea-dns-C-0P7TRi.js → widearea-dns-BOgHvO4O.js} +0 -0
  1018. /package/dist/{widearea-dns-DFZMcfLf.js → widearea-dns-CGhfClCr.js} +0 -0
  1019. /package/dist/{workspace-BJCKO8Ns.js → workspace-DhUqtMK_.js} +0 -0
  1020. /package/dist/{wsl-kFaeW76c.js → wsl-Cs-gowFJ.js} +0 -0
@@ -1,2394 +0,0 @@
1
- import { M as shouldLogVerbose, Z as resolvePreferredRemoteClawTmpDir, k as logVerbose } from "./utils-C5daYcFn.js";
2
- import { a as normalizeProviderId, r as normalizeGoogleModelId } from "./provider-utils-C9kBVF1f.js";
3
- import { t as getShellEnvAppliedKeys } from "./shell-env-DYZq9PqC.js";
4
- import { a as resolveIMessageAttachmentRoots, i as mergeInboundPathRoots, n as isInboundPathAllowed, t as DEFAULT_IMESSAGE_ATTACHMENT_ROOTS } from "./inbound-path-policy-BdmTOUka.js";
5
- import { t as normalizeChatType } from "./chat-type-DyovJwCt.js";
6
- import { n as fetchWithTimeout } from "./fetch-timeout-l_6RdoMw.js";
7
- import { i as fetchRemoteMedia, n as getDefaultMediaLocalRoots, o as fetchWithSsrFGuard, r as MediaFetchError } from "./local-roots-CrJ_Jv_G.js";
8
- import { n as runExec } from "./exec-Zz6eJ6YU.js";
9
- import { n as formatErrorMessage, r as formatUncaughtError, t as extractErrorCode } from "./errors-CdmXrBic.js";
10
- import { a as isAudioFileName, r as getFileExtension, s as kindFromMime, t as detectMime } from "./mime-Cqg1jjia.js";
11
- import { t as formatCliCommand } from "./command-format-D0vKipG9.js";
12
- import { _ as normalizeSecretInput, f as resolveAuthStorePathForDisplay, g as normalizeOptionalSecretInput, l as ensureAuthProfileStore, o as resolveApiKeyForProfile, p as resolveAuthProfileDisplayLabel, s as listProfilesForProvider } from "./auth-Drf91ntw.js";
13
- import process$1 from "node:process";
14
- import { fileURLToPath } from "node:url";
15
- import { constants, existsSync } from "node:fs";
16
- import os, { homedir } from "node:os";
17
- import path, { join } from "node:path";
18
- import fs$1, { mkdtemp, rm } from "node:fs/promises";
19
- import crypto from "node:crypto";
20
-
21
- //#region src/auto-reply/templating.ts
22
- function formatTemplateValue(value) {
23
- if (value == null) return "";
24
- if (typeof value === "string") return value;
25
- if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return String(value);
26
- if (typeof value === "symbol" || typeof value === "function") return value.toString();
27
- if (Array.isArray(value)) return value.flatMap((entry) => {
28
- if (entry == null) return [];
29
- if (typeof entry === "string") return [entry];
30
- if (typeof entry === "number" || typeof entry === "boolean" || typeof entry === "bigint") return [String(entry)];
31
- return [];
32
- }).join(",");
33
- if (typeof value === "object") return "";
34
- return "";
35
- }
36
- function applyTemplate(str, ctx) {
37
- if (!str) return "";
38
- return str.replace(/{{\s*(\w+)\s*}}/g, (_, key) => {
39
- const value = ctx[key];
40
- return formatTemplateValue(value);
41
- });
42
- }
43
-
44
- //#endregion
45
- //#region src/stt/defaults.ts
46
- const DEFAULT_AUDIO_MODELS = {
47
- groq: "whisper-large-v3-turbo",
48
- openai: "gpt-4o-mini-transcribe",
49
- deepgram: "nova-3",
50
- mistral: "voxtral-mini-latest"
51
- };
52
- const AUTO_AUDIO_KEY_PROVIDERS = [
53
- "openai",
54
- "groq",
55
- "deepgram",
56
- "google",
57
- "mistral"
58
- ];
59
-
60
- //#endregion
61
- //#region src/media-understanding/defaults.ts
62
- const MB = 1024 * 1024;
63
- const DEFAULT_MAX_CHARS = 500;
64
- const DEFAULT_MAX_CHARS_BY_CAPABILITY = {
65
- image: DEFAULT_MAX_CHARS,
66
- audio: void 0,
67
- video: DEFAULT_MAX_CHARS
68
- };
69
- const DEFAULT_MAX_BYTES = {
70
- image: 10 * MB,
71
- audio: 20 * MB,
72
- video: 50 * MB
73
- };
74
- const DEFAULT_TIMEOUT_SECONDS = {
75
- image: 60,
76
- audio: 60,
77
- video: 120
78
- };
79
- const DEFAULT_PROMPT = {
80
- image: "Describe the image.",
81
- audio: "Transcribe the audio.",
82
- video: "Describe the video."
83
- };
84
- const DEFAULT_VIDEO_MAX_BASE64_BYTES = 70 * MB;
85
- const AUTO_VIDEO_KEY_PROVIDERS = ["google", "moonshot"];
86
- const CLI_OUTPUT_MAX_BUFFER = 5 * MB;
87
- const DEFAULT_MEDIA_CONCURRENCY = 2;
88
-
89
- //#endregion
90
- //#region src/media-understanding/providers/anthropic/index.ts
91
- const anthropicProvider = { id: "anthropic" };
92
-
93
- //#endregion
94
- //#region src/media-understanding/providers/shared.ts
95
- const MAX_ERROR_CHARS = 300;
96
- function normalizeBaseUrl(baseUrl, fallback) {
97
- return (baseUrl?.trim() || fallback).replace(/\/+$/, "");
98
- }
99
- async function fetchWithTimeoutGuarded(url, init, timeoutMs, fetchFn, options) {
100
- return await fetchWithSsrFGuard({
101
- url,
102
- fetchImpl: fetchFn,
103
- init,
104
- timeoutMs,
105
- policy: options?.ssrfPolicy,
106
- lookupFn: options?.lookupFn,
107
- pinDns: options?.pinDns
108
- });
109
- }
110
- async function postTranscriptionRequest(params) {
111
- return fetchWithTimeoutGuarded(params.url, {
112
- method: "POST",
113
- headers: params.headers,
114
- body: params.body
115
- }, params.timeoutMs, params.fetchFn, params.allowPrivateNetwork ? { ssrfPolicy: { allowPrivateNetwork: true } } : void 0);
116
- }
117
- async function readErrorResponse(res) {
118
- try {
119
- const collapsed = (await res.text()).replace(/\s+/g, " ").trim();
120
- if (!collapsed) return;
121
- if (collapsed.length <= MAX_ERROR_CHARS) return collapsed;
122
- return `${collapsed.slice(0, MAX_ERROR_CHARS)}…`;
123
- } catch {
124
- return;
125
- }
126
- }
127
- async function assertOkOrThrowHttpError(res, label) {
128
- if (res.ok) return;
129
- const detail = await readErrorResponse(res);
130
- const suffix = detail ? `: ${detail}` : "";
131
- throw new Error(`${label} (HTTP ${res.status})${suffix}`);
132
- }
133
- function requireTranscriptionText(value, missingMessage) {
134
- const text = value?.trim();
135
- if (!text) throw new Error(missingMessage);
136
- return text;
137
- }
138
-
139
- //#endregion
140
- //#region src/stt/providers/deepgram/audio.ts
141
- const DEFAULT_DEEPGRAM_AUDIO_BASE_URL = "https://api.deepgram.com/v1";
142
- const DEFAULT_DEEPGRAM_AUDIO_MODEL = "nova-3";
143
- function resolveModel$2(model) {
144
- return model?.trim() || DEFAULT_DEEPGRAM_AUDIO_MODEL;
145
- }
146
- async function transcribeDeepgramAudio(params) {
147
- const fetchFn = params.fetchFn ?? fetch;
148
- const baseUrl = normalizeBaseUrl(params.baseUrl, DEFAULT_DEEPGRAM_AUDIO_BASE_URL);
149
- const allowPrivate = Boolean(params.baseUrl?.trim());
150
- const model = resolveModel$2(params.model);
151
- const url = new URL(`${baseUrl}/listen`);
152
- url.searchParams.set("model", model);
153
- if (params.language?.trim()) url.searchParams.set("language", params.language.trim());
154
- if (params.query) for (const [key, value] of Object.entries(params.query)) {
155
- if (value === void 0) continue;
156
- url.searchParams.set(key, String(value));
157
- }
158
- const headers = new Headers(params.headers);
159
- if (!headers.has("authorization")) headers.set("authorization", `Token ${params.apiKey}`);
160
- if (!headers.has("content-type")) headers.set("content-type", params.mime ?? "application/octet-stream");
161
- const body = new Uint8Array(params.buffer);
162
- const { response: res, release } = await postTranscriptionRequest({
163
- url: url.toString(),
164
- headers,
165
- body,
166
- timeoutMs: params.timeoutMs,
167
- fetchFn,
168
- allowPrivateNetwork: allowPrivate
169
- });
170
- try {
171
- await assertOkOrThrowHttpError(res, "Audio transcription failed");
172
- return {
173
- text: requireTranscriptionText((await res.json()).results?.channels?.[0]?.alternatives?.[0]?.transcript, "Audio transcription response missing transcript"),
174
- model
175
- };
176
- } finally {
177
- await release();
178
- }
179
- }
180
-
181
- //#endregion
182
- //#region src/media-understanding/providers/deepgram/index.ts
183
- const deepgramProvider = {
184
- id: "deepgram",
185
- capabilities: ["audio"],
186
- transcribeAudio: transcribeDeepgramAudio
187
- };
188
-
189
- //#endregion
190
- //#region src/infra/gemini-auth.ts
191
- /**
192
- * Shared Gemini authentication utilities.
193
- *
194
- * Supports both traditional API keys and OAuth JSON format.
195
- */
196
- /**
197
- * Parse Gemini API key and return appropriate auth headers.
198
- *
199
- * OAuth format: `{"token": "...", "projectId": "..."}`
200
- *
201
- * @param apiKey - Either a traditional API key string or OAuth JSON
202
- * @returns Headers object with appropriate authentication
203
- */
204
- function parseGeminiAuth(apiKey) {
205
- if (apiKey.startsWith("{")) try {
206
- const parsed = JSON.parse(apiKey);
207
- if (typeof parsed.token === "string" && parsed.token) return { headers: {
208
- Authorization: `Bearer ${parsed.token}`,
209
- "Content-Type": "application/json"
210
- } };
211
- } catch {}
212
- return { headers: {
213
- "x-goog-api-key": apiKey,
214
- "Content-Type": "application/json"
215
- } };
216
- }
217
-
218
- //#endregion
219
- //#region src/media-understanding/providers/google/inline-data.ts
220
- async function generateGeminiInlineDataText(params) {
221
- const fetchFn = params.fetchFn ?? fetch;
222
- const baseUrl = normalizeBaseUrl(params.baseUrl, params.defaultBaseUrl);
223
- const allowPrivate = Boolean(params.baseUrl?.trim());
224
- const model = (() => {
225
- const trimmed = params.model?.trim();
226
- if (!trimmed) return params.defaultModel;
227
- return normalizeGoogleModelId(trimmed);
228
- })();
229
- const url = `${baseUrl}/models/${model}:generateContent`;
230
- const authHeaders = parseGeminiAuth(params.apiKey);
231
- const headers = new Headers(params.headers);
232
- for (const [key, value] of Object.entries(authHeaders.headers)) if (!headers.has(key)) headers.set(key, value);
233
- const body = { contents: [{
234
- role: "user",
235
- parts: [{ text: params.prompt?.trim() || params.defaultPrompt }, { inline_data: {
236
- mime_type: params.mime ?? params.defaultMime,
237
- data: params.buffer.toString("base64")
238
- } }]
239
- }] };
240
- const { response: res, release } = await fetchWithTimeoutGuarded(url, {
241
- method: "POST",
242
- headers,
243
- body: JSON.stringify(body)
244
- }, params.timeoutMs, fetchFn, allowPrivate ? { ssrfPolicy: { allowPrivateNetwork: true } } : void 0);
245
- try {
246
- await assertOkOrThrowHttpError(res, params.httpErrorLabel);
247
- const text = ((await res.json()).candidates?.[0]?.content?.parts ?? []).map((part) => part?.text?.trim()).filter(Boolean).join("\n");
248
- if (!text) throw new Error(params.missingTextError);
249
- return {
250
- text,
251
- model
252
- };
253
- } finally {
254
- await release();
255
- }
256
- }
257
-
258
- //#endregion
259
- //#region src/stt/providers/google/audio.ts
260
- const DEFAULT_GOOGLE_AUDIO_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
261
- const DEFAULT_GOOGLE_AUDIO_MODEL = "gemini-3-flash-preview";
262
- const DEFAULT_GOOGLE_AUDIO_PROMPT = "Transcribe the audio.";
263
- async function transcribeGeminiAudio(params) {
264
- const { text, model } = await generateGeminiInlineDataText({
265
- ...params,
266
- defaultBaseUrl: DEFAULT_GOOGLE_AUDIO_BASE_URL,
267
- defaultModel: DEFAULT_GOOGLE_AUDIO_MODEL,
268
- defaultPrompt: DEFAULT_GOOGLE_AUDIO_PROMPT,
269
- defaultMime: "audio/wav",
270
- httpErrorLabel: "Audio transcription failed",
271
- missingTextError: "Audio transcription response missing text"
272
- });
273
- return {
274
- text,
275
- model
276
- };
277
- }
278
-
279
- //#endregion
280
- //#region src/media-understanding/providers/google/video.ts
281
- const DEFAULT_GOOGLE_VIDEO_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
282
- const DEFAULT_GOOGLE_VIDEO_MODEL = "gemini-3-flash-preview";
283
- const DEFAULT_GOOGLE_VIDEO_PROMPT = "Describe the video.";
284
- async function describeGeminiVideo(params) {
285
- const { text, model } = await generateGeminiInlineDataText({
286
- ...params,
287
- defaultBaseUrl: DEFAULT_GOOGLE_VIDEO_BASE_URL,
288
- defaultModel: DEFAULT_GOOGLE_VIDEO_MODEL,
289
- defaultPrompt: DEFAULT_GOOGLE_VIDEO_PROMPT,
290
- defaultMime: "video/mp4",
291
- httpErrorLabel: "Video description failed",
292
- missingTextError: "Video description response missing text"
293
- });
294
- return {
295
- text,
296
- model
297
- };
298
- }
299
-
300
- //#endregion
301
- //#region src/media-understanding/providers/google/index.ts
302
- const googleProvider = {
303
- id: "google",
304
- capabilities: ["audio", "video"],
305
- transcribeAudio: transcribeGeminiAudio,
306
- describeVideo: describeGeminiVideo
307
- };
308
-
309
- //#endregion
310
- //#region src/stt/providers/openai/audio.ts
311
- const DEFAULT_OPENAI_AUDIO_BASE_URL = "https://api.openai.com/v1";
312
- const DEFAULT_OPENAI_AUDIO_MODEL = "gpt-4o-mini-transcribe";
313
- function resolveModel$1(model) {
314
- return model?.trim() || DEFAULT_OPENAI_AUDIO_MODEL;
315
- }
316
- async function transcribeOpenAiCompatibleAudio(params) {
317
- const fetchFn = params.fetchFn ?? fetch;
318
- const baseUrl = normalizeBaseUrl(params.baseUrl, DEFAULT_OPENAI_AUDIO_BASE_URL);
319
- const allowPrivate = Boolean(params.baseUrl?.trim());
320
- const url = `${baseUrl}/audio/transcriptions`;
321
- const model = resolveModel$1(params.model);
322
- const form = new FormData();
323
- const fileName = params.fileName?.trim() || path.basename(params.fileName) || "audio";
324
- const bytes = new Uint8Array(params.buffer);
325
- const blob = new Blob([bytes], { type: params.mime ?? "application/octet-stream" });
326
- form.append("file", blob, fileName);
327
- form.append("model", model);
328
- if (params.language?.trim()) form.append("language", params.language.trim());
329
- if (params.prompt?.trim()) form.append("prompt", params.prompt.trim());
330
- const headers = new Headers(params.headers);
331
- if (!headers.has("authorization")) headers.set("authorization", `Bearer ${params.apiKey}`);
332
- const { response: res, release } = await postTranscriptionRequest({
333
- url,
334
- headers,
335
- body: form,
336
- timeoutMs: params.timeoutMs,
337
- fetchFn,
338
- allowPrivateNetwork: allowPrivate
339
- });
340
- try {
341
- await assertOkOrThrowHttpError(res, "Audio transcription failed");
342
- return {
343
- text: requireTranscriptionText((await res.json()).text, "Audio transcription response missing text"),
344
- model
345
- };
346
- } finally {
347
- await release();
348
- }
349
- }
350
-
351
- //#endregion
352
- //#region src/media-understanding/providers/groq/index.ts
353
- const DEFAULT_GROQ_AUDIO_BASE_URL$1 = "https://api.groq.com/openai/v1";
354
- const groqProvider = {
355
- id: "groq",
356
- capabilities: ["audio"],
357
- transcribeAudio: (req) => transcribeOpenAiCompatibleAudio({
358
- ...req,
359
- baseUrl: req.baseUrl ?? DEFAULT_GROQ_AUDIO_BASE_URL$1
360
- })
361
- };
362
-
363
- //#endregion
364
- //#region src/media-understanding/providers/minimax/index.ts
365
- const minimaxProvider = { id: "minimax" };
366
-
367
- //#endregion
368
- //#region src/media-understanding/providers/mistral/index.ts
369
- const DEFAULT_MISTRAL_AUDIO_BASE_URL$1 = "https://api.mistral.ai/v1";
370
- const mistralProvider = {
371
- id: "mistral",
372
- capabilities: ["audio"],
373
- transcribeAudio: (req) => transcribeOpenAiCompatibleAudio({
374
- ...req,
375
- baseUrl: req.baseUrl ?? DEFAULT_MISTRAL_AUDIO_BASE_URL$1
376
- })
377
- };
378
-
379
- //#endregion
380
- //#region src/media-understanding/providers/moonshot/video.ts
381
- const DEFAULT_MOONSHOT_VIDEO_BASE_URL = "https://api.moonshot.ai/v1";
382
- const DEFAULT_MOONSHOT_VIDEO_MODEL = "kimi-k2.5";
383
- const DEFAULT_MOONSHOT_VIDEO_PROMPT = "Describe the video.";
384
- function resolveModel(model) {
385
- return model?.trim() || DEFAULT_MOONSHOT_VIDEO_MODEL;
386
- }
387
- function resolvePrompt$1(prompt) {
388
- return prompt?.trim() || DEFAULT_MOONSHOT_VIDEO_PROMPT;
389
- }
390
- function coerceMoonshotText(payload) {
391
- const message = payload.choices?.[0]?.message;
392
- if (!message) return null;
393
- if (typeof message.content === "string" && message.content.trim()) return message.content.trim();
394
- if (Array.isArray(message.content)) {
395
- const text = message.content.map((part) => typeof part.text === "string" ? part.text.trim() : "").filter(Boolean).join("\n").trim();
396
- if (text) return text;
397
- }
398
- if (typeof message.reasoning_content === "string" && message.reasoning_content.trim()) return message.reasoning_content.trim();
399
- return null;
400
- }
401
- async function describeMoonshotVideo(params) {
402
- const fetchFn = params.fetchFn ?? fetch;
403
- const baseUrl = normalizeBaseUrl(params.baseUrl, DEFAULT_MOONSHOT_VIDEO_BASE_URL);
404
- const model = resolveModel(params.model);
405
- const mime = params.mime ?? "video/mp4";
406
- const prompt = resolvePrompt$1(params.prompt);
407
- const url = `${baseUrl}/chat/completions`;
408
- const headers = new Headers(params.headers);
409
- if (!headers.has("content-type")) headers.set("content-type", "application/json");
410
- if (!headers.has("authorization")) headers.set("authorization", `Bearer ${params.apiKey}`);
411
- const body = {
412
- model,
413
- messages: [{
414
- role: "user",
415
- content: [{
416
- type: "text",
417
- text: prompt
418
- }, {
419
- type: "video_url",
420
- video_url: { url: `data:${mime};base64,${params.buffer.toString("base64")}` }
421
- }]
422
- }]
423
- };
424
- const { response: res, release } = await fetchWithTimeoutGuarded(url, {
425
- method: "POST",
426
- headers,
427
- body: JSON.stringify(body)
428
- }, params.timeoutMs, fetchFn);
429
- try {
430
- await assertOkOrThrowHttpError(res, "Moonshot video description failed");
431
- const text = coerceMoonshotText(await res.json());
432
- if (!text) throw new Error("Moonshot video description response missing content");
433
- return {
434
- text,
435
- model
436
- };
437
- } finally {
438
- await release();
439
- }
440
- }
441
-
442
- //#endregion
443
- //#region src/media-understanding/providers/moonshot/index.ts
444
- const moonshotProvider = {
445
- id: "moonshot",
446
- capabilities: ["video"],
447
- describeVideo: describeMoonshotVideo
448
- };
449
-
450
- //#endregion
451
- //#region src/media-understanding/providers/openai/index.ts
452
- const openaiProvider = {
453
- id: "openai",
454
- transcribeAudio: transcribeOpenAiCompatibleAudio
455
- };
456
-
457
- //#endregion
458
- //#region src/media-understanding/providers/zai/index.ts
459
- const zaiProvider = { id: "zai" };
460
-
461
- //#endregion
462
- //#region src/media-understanding/providers/index.ts
463
- const PROVIDERS = [
464
- groqProvider,
465
- openaiProvider,
466
- googleProvider,
467
- anthropicProvider,
468
- minimaxProvider,
469
- moonshotProvider,
470
- mistralProvider,
471
- zaiProvider,
472
- deepgramProvider
473
- ];
474
- function normalizeMediaProviderId(id) {
475
- const normalized = normalizeProviderId(id);
476
- if (normalized === "gemini") return "google";
477
- return normalized;
478
- }
479
- function buildMediaUnderstandingRegistry(overrides) {
480
- const registry = /* @__PURE__ */ new Map();
481
- for (const provider of PROVIDERS) registry.set(normalizeMediaProviderId(provider.id), provider);
482
- if (overrides) for (const [key, provider] of Object.entries(overrides)) {
483
- const normalizedKey = normalizeMediaProviderId(key);
484
- const existing = registry.get(normalizedKey);
485
- const merged = existing ? {
486
- ...existing,
487
- ...provider,
488
- capabilities: provider.capabilities ?? existing.capabilities
489
- } : provider;
490
- registry.set(normalizedKey, merged);
491
- }
492
- return registry;
493
- }
494
- function getMediaUnderstandingProvider(id, registry) {
495
- return registry.get(normalizeMediaProviderId(id));
496
- }
497
-
498
- //#endregion
499
- //#region src/media-understanding/scope.ts
500
- function normalizeDecision(value) {
501
- const normalized = value?.trim().toLowerCase();
502
- if (normalized === "allow") return "allow";
503
- if (normalized === "deny") return "deny";
504
- }
505
- function normalizeMatch(value) {
506
- return value?.trim().toLowerCase() || void 0;
507
- }
508
- function normalizeMediaUnderstandingChatType(raw) {
509
- return normalizeChatType(raw ?? void 0);
510
- }
511
- function resolveMediaUnderstandingScope(params) {
512
- const scope = params.scope;
513
- if (!scope) return "allow";
514
- const channel = normalizeMatch(params.channel);
515
- const chatType = normalizeMediaUnderstandingChatType(params.chatType);
516
- const sessionKey = normalizeMatch(params.sessionKey) ?? "";
517
- for (const rule of scope.rules ?? []) {
518
- if (!rule) continue;
519
- const action = normalizeDecision(rule.action) ?? "allow";
520
- const match = rule.match ?? {};
521
- const matchChannel = normalizeMatch(match.channel);
522
- const matchChatType = normalizeMediaUnderstandingChatType(match.chatType);
523
- const matchPrefix = normalizeMatch(match.keyPrefix);
524
- if (matchChannel && matchChannel !== channel) continue;
525
- if (matchChatType && matchChatType !== chatType) continue;
526
- if (matchPrefix && !sessionKey.startsWith(matchPrefix)) continue;
527
- return action;
528
- }
529
- return normalizeDecision(scope.default) ?? "allow";
530
- }
531
-
532
- //#endregion
533
- //#region src/media-understanding/resolve.ts
534
- function resolveTimeoutMs(seconds, fallbackSeconds) {
535
- const value = typeof seconds === "number" && Number.isFinite(seconds) ? seconds : fallbackSeconds;
536
- return Math.max(1e3, Math.floor(value * 1e3));
537
- }
538
- function resolvePrompt(capability, prompt, maxChars) {
539
- const base = prompt?.trim() || DEFAULT_PROMPT[capability];
540
- if (!maxChars || capability === "audio") return base;
541
- return `${base} Respond in at most ${maxChars} characters.`;
542
- }
543
- function resolveMaxChars(params) {
544
- const { capability, entry, cfg } = params;
545
- const configured = entry.maxChars ?? params.config?.maxChars ?? cfg.tools?.media?.[capability]?.maxChars;
546
- if (typeof configured === "number") return configured;
547
- return DEFAULT_MAX_CHARS_BY_CAPABILITY[capability];
548
- }
549
- function resolveMaxBytes(params) {
550
- const configured = params.entry.maxBytes ?? params.config?.maxBytes ?? params.cfg.tools?.media?.[params.capability]?.maxBytes;
551
- if (typeof configured === "number") return configured;
552
- return DEFAULT_MAX_BYTES[params.capability];
553
- }
554
- function resolveScopeDecision(params) {
555
- return resolveMediaUnderstandingScope({
556
- scope: params.scope,
557
- sessionKey: params.ctx.SessionKey,
558
- channel: params.ctx.Surface ?? params.ctx.Provider,
559
- chatType: normalizeMediaUnderstandingChatType(params.ctx.ChatType)
560
- });
561
- }
562
- function resolveEntryCapabilities(params) {
563
- if ((params.entry.type ?? (params.entry.command ? "cli" : "provider")) === "cli") return;
564
- const providerId = normalizeMediaProviderId(params.entry.provider ?? "");
565
- if (!providerId) return;
566
- return params.providerRegistry.get(providerId)?.capabilities;
567
- }
568
- function resolveModelEntries(params) {
569
- const { cfg, capability, config } = params;
570
- const sharedModels = cfg.tools?.media?.models ?? [];
571
- const entries = [...(config?.models ?? []).map((entry) => ({
572
- entry,
573
- source: "capability"
574
- })), ...sharedModels.map((entry) => ({
575
- entry,
576
- source: "shared"
577
- }))];
578
- if (entries.length === 0) return [];
579
- return entries.filter(({ entry, source }) => {
580
- const caps = entry.capabilities && entry.capabilities.length > 0 ? entry.capabilities : source === "shared" ? resolveEntryCapabilities({
581
- entry,
582
- providerRegistry: params.providerRegistry
583
- }) : void 0;
584
- if (!caps || caps.length === 0) {
585
- if (source === "shared") {
586
- if (shouldLogVerbose()) logVerbose(`Skipping shared media model without capabilities: ${entry.provider ?? entry.command ?? "unknown"}`);
587
- return false;
588
- }
589
- return true;
590
- }
591
- return caps.includes(capability);
592
- }).map(({ entry }) => entry);
593
- }
594
- function resolveConcurrency(cfg) {
595
- const configured = cfg.tools?.media?.concurrency;
596
- if (typeof configured === "number" && Number.isFinite(configured) && configured > 0) return Math.floor(configured);
597
- return DEFAULT_MEDIA_CONCURRENCY;
598
- }
599
-
600
- //#endregion
601
- //#region src/infra/unhandled-rejections.ts
602
- const handlers = /* @__PURE__ */ new Set();
603
- const FATAL_ERROR_CODES = new Set([
604
- "ERR_OUT_OF_MEMORY",
605
- "ERR_SCRIPT_EXECUTION_TIMEOUT",
606
- "ERR_WORKER_OUT_OF_MEMORY",
607
- "ERR_WORKER_UNCAUGHT_EXCEPTION",
608
- "ERR_WORKER_INITIALIZATION_FAILED"
609
- ]);
610
- const CONFIG_ERROR_CODES = new Set([
611
- "INVALID_CONFIG",
612
- "MISSING_API_KEY",
613
- "MISSING_CREDENTIALS"
614
- ]);
615
- const TRANSIENT_NETWORK_CODES = new Set([
616
- "ECONNRESET",
617
- "ECONNREFUSED",
618
- "ENOTFOUND",
619
- "ETIMEDOUT",
620
- "ESOCKETTIMEDOUT",
621
- "ECONNABORTED",
622
- "EPIPE",
623
- "EHOSTUNREACH",
624
- "ENETUNREACH",
625
- "EAI_AGAIN",
626
- "UND_ERR_CONNECT_TIMEOUT",
627
- "UND_ERR_DNS_RESOLVE_FAILED",
628
- "UND_ERR_CONNECT",
629
- "UND_ERR_SOCKET",
630
- "UND_ERR_HEADERS_TIMEOUT",
631
- "UND_ERR_BODY_TIMEOUT"
632
- ]);
633
- const TRANSIENT_NETWORK_ERROR_NAMES = new Set([
634
- "AbortError",
635
- "ConnectTimeoutError",
636
- "HeadersTimeoutError",
637
- "BodyTimeoutError",
638
- "TimeoutError"
639
- ]);
640
- const TRANSIENT_NETWORK_MESSAGE_CODE_RE = /\b(ECONNRESET|ECONNREFUSED|ENOTFOUND|ETIMEDOUT|ESOCKETTIMEDOUT|ECONNABORTED|EPIPE|EHOSTUNREACH|ENETUNREACH|EAI_AGAIN|UND_ERR_CONNECT_TIMEOUT|UND_ERR_DNS_RESOLVE_FAILED|UND_ERR_CONNECT|UND_ERR_SOCKET|UND_ERR_HEADERS_TIMEOUT|UND_ERR_BODY_TIMEOUT)\b/i;
641
- const TRANSIENT_NETWORK_MESSAGE_SNIPPETS = [
642
- "getaddrinfo",
643
- "socket hang up",
644
- "network error",
645
- "network is unreachable",
646
- "temporary failure in name resolution"
647
- ];
648
- function getErrorCause(err) {
649
- if (!err || typeof err !== "object") return;
650
- return err.cause;
651
- }
652
- function getErrorName(err) {
653
- if (!err || typeof err !== "object") return "";
654
- const name = err.name;
655
- return typeof name === "string" ? name : "";
656
- }
657
- function extractErrorCodeOrErrno(err) {
658
- const code = extractErrorCode(err);
659
- if (code) return code.trim().toUpperCase();
660
- if (!err || typeof err !== "object") return;
661
- const errno = err.errno;
662
- if (typeof errno === "string" && errno.trim()) return errno.trim().toUpperCase();
663
- if (typeof errno === "number" && Number.isFinite(errno)) return String(errno);
664
- }
665
- function extractErrorCodeWithCause(err) {
666
- const direct = extractErrorCode(err);
667
- if (direct) return direct;
668
- return extractErrorCode(getErrorCause(err));
669
- }
670
- function collectErrorCandidates(err) {
671
- const queue = [err];
672
- const seen = /* @__PURE__ */ new Set();
673
- const candidates = [];
674
- while (queue.length > 0) {
675
- const current = queue.shift();
676
- if (current == null || seen.has(current)) continue;
677
- seen.add(current);
678
- candidates.push(current);
679
- if (!current || typeof current !== "object") continue;
680
- const maybeNested = [
681
- current.cause,
682
- current.reason,
683
- current.original,
684
- current.error,
685
- current.data
686
- ];
687
- const errors = current.errors;
688
- if (Array.isArray(errors)) maybeNested.push(...errors);
689
- for (const nested of maybeNested) if (nested != null && !seen.has(nested)) queue.push(nested);
690
- }
691
- return candidates;
692
- }
693
- /**
694
- * Checks if an error is an AbortError.
695
- * These are typically intentional cancellations (e.g., during shutdown) and shouldn't crash.
696
- */
697
- function isAbortError(err) {
698
- if (!err || typeof err !== "object") return false;
699
- if (("name" in err ? String(err.name) : "") === "AbortError") return true;
700
- if (("message" in err && typeof err.message === "string" ? err.message : "") === "This operation was aborted") return true;
701
- return false;
702
- }
703
- function isFatalError(err) {
704
- const code = extractErrorCodeWithCause(err);
705
- return code !== void 0 && FATAL_ERROR_CODES.has(code);
706
- }
707
- function isConfigError(err) {
708
- const code = extractErrorCodeWithCause(err);
709
- return code !== void 0 && CONFIG_ERROR_CODES.has(code);
710
- }
711
- /**
712
- * Checks if an error is a transient network error that shouldn't crash the gateway.
713
- * These are typically temporary connectivity issues that will resolve on their own.
714
- */
715
- function isTransientNetworkError(err) {
716
- if (!err) return false;
717
- for (const candidate of collectErrorCandidates(err)) {
718
- const code = extractErrorCodeOrErrno(candidate);
719
- if (code && TRANSIENT_NETWORK_CODES.has(code)) return true;
720
- const name = getErrorName(candidate);
721
- if (name && TRANSIENT_NETWORK_ERROR_NAMES.has(name)) return true;
722
- if (candidate instanceof TypeError && candidate.message === "fetch failed") return true;
723
- if (!candidate || typeof candidate !== "object") continue;
724
- const rawMessage = candidate.message;
725
- const message = typeof rawMessage === "string" ? rawMessage.toLowerCase().trim() : "";
726
- if (!message) continue;
727
- if (TRANSIENT_NETWORK_MESSAGE_CODE_RE.test(message)) return true;
728
- if (message === "fetch failed") return true;
729
- if (TRANSIENT_NETWORK_MESSAGE_SNIPPETS.some((snippet) => message.includes(snippet))) return true;
730
- }
731
- return false;
732
- }
733
- function registerUnhandledRejectionHandler(handler) {
734
- handlers.add(handler);
735
- return () => {
736
- handlers.delete(handler);
737
- };
738
- }
739
- function isUnhandledRejectionHandled(reason) {
740
- for (const handler of handlers) try {
741
- if (handler(reason)) return true;
742
- } catch (err) {
743
- console.error("[remoteclaw] Unhandled rejection handler failed:", err instanceof Error ? err.stack ?? err.message : err);
744
- }
745
- return false;
746
- }
747
- function installUnhandledRejectionHandler() {
748
- process$1.on("unhandledRejection", (reason, _promise) => {
749
- if (isUnhandledRejectionHandled(reason)) return;
750
- if (isAbortError(reason)) {
751
- console.warn("[remoteclaw] Suppressed AbortError:", formatUncaughtError(reason));
752
- return;
753
- }
754
- if (isFatalError(reason)) {
755
- console.error("[remoteclaw] FATAL unhandled rejection:", formatUncaughtError(reason));
756
- process$1.exit(1);
757
- return;
758
- }
759
- if (isConfigError(reason)) {
760
- console.error("[remoteclaw] CONFIGURATION ERROR - requires fix:", formatUncaughtError(reason));
761
- process$1.exit(1);
762
- return;
763
- }
764
- if (isTransientNetworkError(reason)) {
765
- console.warn("[remoteclaw] Non-fatal unhandled rejection (continuing):", formatUncaughtError(reason));
766
- return;
767
- }
768
- console.error("[remoteclaw] Unhandled promise rejection:", formatUncaughtError(reason));
769
- process$1.exit(1);
770
- });
771
- }
772
-
773
- //#endregion
774
- //#region src/plugin-sdk/temp-path.ts
775
- function sanitizePrefix(prefix) {
776
- return prefix.replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || "tmp";
777
- }
778
- function sanitizeExtension(extension) {
779
- if (!extension) return "";
780
- const token = ((extension.startsWith(".") ? extension : `.${extension}`).match(/[a-zA-Z0-9._-]+$/)?.[0] ?? "").replace(/^[._-]+/, "");
781
- if (!token) return "";
782
- return `.${token}`;
783
- }
784
- function resolveTempRoot(tmpDir) {
785
- return tmpDir ?? resolvePreferredRemoteClawTmpDir();
786
- }
787
- function buildRandomTempFilePath(params) {
788
- const prefix = sanitizePrefix(params.prefix);
789
- const extension = sanitizeExtension(params.extension);
790
- const nowCandidate = params.now;
791
- const now = typeof nowCandidate === "number" && Number.isFinite(nowCandidate) ? Math.trunc(nowCandidate) : Date.now();
792
- const uuid = params.uuid?.trim() || crypto.randomUUID();
793
- return path.join(resolveTempRoot(params.tmpDir), `${prefix}-${now}-${uuid}${extension}`);
794
- }
795
-
796
- //#endregion
797
- //#region src/media-understanding/errors.ts
798
- var MediaUnderstandingSkipError = class extends Error {
799
- constructor(reason, message) {
800
- super(message);
801
- this.reason = reason;
802
- this.name = "MediaUnderstandingSkipError";
803
- }
804
- };
805
- function isMediaUnderstandingSkipError(err) {
806
- return err instanceof MediaUnderstandingSkipError;
807
- }
808
-
809
- //#endregion
810
- //#region src/media-understanding/attachments.ts
811
- const DEFAULT_MAX_ATTACHMENTS = 1;
812
- const DEFAULT_LOCAL_PATH_ROOTS = mergeInboundPathRoots(getDefaultMediaLocalRoots(), DEFAULT_IMESSAGE_ATTACHMENT_ROOTS);
813
- function normalizeAttachmentPath(raw) {
814
- const value = raw?.trim();
815
- if (!value) return;
816
- if (value.startsWith("file://")) try {
817
- return fileURLToPath(value);
818
- } catch {
819
- return;
820
- }
821
- return value;
822
- }
823
- function normalizeAttachments(ctx) {
824
- const pathsFromArray = Array.isArray(ctx.MediaPaths) ? ctx.MediaPaths : void 0;
825
- const urlsFromArray = Array.isArray(ctx.MediaUrls) ? ctx.MediaUrls : void 0;
826
- const typesFromArray = Array.isArray(ctx.MediaTypes) ? ctx.MediaTypes : void 0;
827
- const resolveMime = (count, index) => {
828
- const typeHint = typesFromArray?.[index];
829
- const trimmed = typeof typeHint === "string" ? typeHint.trim() : "";
830
- if (trimmed) return trimmed;
831
- return count === 1 ? ctx.MediaType : void 0;
832
- };
833
- if (pathsFromArray && pathsFromArray.length > 0) {
834
- const count = pathsFromArray.length;
835
- const urls = urlsFromArray && urlsFromArray.length > 0 ? urlsFromArray : void 0;
836
- return pathsFromArray.map((value, index) => ({
837
- path: value?.trim() || void 0,
838
- url: urls?.[index] ?? ctx.MediaUrl,
839
- mime: resolveMime(count, index),
840
- index
841
- })).filter((entry) => Boolean(entry.path?.trim() || entry.url?.trim()));
842
- }
843
- if (urlsFromArray && urlsFromArray.length > 0) {
844
- const count = urlsFromArray.length;
845
- return urlsFromArray.map((value, index) => ({
846
- path: void 0,
847
- url: value?.trim() || void 0,
848
- mime: resolveMime(count, index),
849
- index
850
- })).filter((entry) => Boolean(entry.url?.trim()));
851
- }
852
- const pathValue = ctx.MediaPath?.trim();
853
- const url = ctx.MediaUrl?.trim();
854
- if (!pathValue && !url) return [];
855
- return [{
856
- path: pathValue || void 0,
857
- url: url || void 0,
858
- mime: ctx.MediaType,
859
- index: 0
860
- }];
861
- }
862
- function resolveAttachmentKind(attachment) {
863
- const kind = kindFromMime(attachment.mime);
864
- if (kind === "image" || kind === "audio" || kind === "video") return kind;
865
- const ext = getFileExtension(attachment.path ?? attachment.url);
866
- if (!ext) return "unknown";
867
- if ([
868
- ".mp4",
869
- ".mov",
870
- ".mkv",
871
- ".webm",
872
- ".avi",
873
- ".m4v"
874
- ].includes(ext)) return "video";
875
- if (isAudioFileName(attachment.path ?? attachment.url)) return "audio";
876
- if ([
877
- ".png",
878
- ".jpg",
879
- ".jpeg",
880
- ".webp",
881
- ".gif",
882
- ".bmp",
883
- ".tiff",
884
- ".tif"
885
- ].includes(ext)) return "image";
886
- return "unknown";
887
- }
888
- function isVideoAttachment(attachment) {
889
- return resolveAttachmentKind(attachment) === "video";
890
- }
891
- function isAudioAttachment(attachment) {
892
- return resolveAttachmentKind(attachment) === "audio";
893
- }
894
- function isImageAttachment(attachment) {
895
- return resolveAttachmentKind(attachment) === "image";
896
- }
897
- function resolveRequestUrl(input) {
898
- if (typeof input === "string") return input;
899
- if (input instanceof URL) return input.toString();
900
- return input.url;
901
- }
902
- function orderAttachments(attachments, prefer) {
903
- if (!prefer || prefer === "first") return attachments;
904
- if (prefer === "last") return [...attachments].toReversed();
905
- if (prefer === "path") {
906
- const withPath = attachments.filter((item) => item.path);
907
- const withoutPath = attachments.filter((item) => !item.path);
908
- return [...withPath, ...withoutPath];
909
- }
910
- if (prefer === "url") {
911
- const withUrl = attachments.filter((item) => item.url);
912
- const withoutUrl = attachments.filter((item) => !item.url);
913
- return [...withUrl, ...withoutUrl];
914
- }
915
- return attachments;
916
- }
917
- function selectAttachments(params) {
918
- const { capability, attachments, policy } = params;
919
- const matches = attachments.filter((item) => {
920
- if (capability === "audio" && item.alreadyTranscribed) return false;
921
- if (capability === "image") return isImageAttachment(item);
922
- if (capability === "audio") return isAudioAttachment(item);
923
- return isVideoAttachment(item);
924
- });
925
- if (matches.length === 0) return [];
926
- const ordered = orderAttachments(matches, policy?.prefer);
927
- const mode = policy?.mode ?? "first";
928
- const maxAttachments = policy?.maxAttachments ?? DEFAULT_MAX_ATTACHMENTS;
929
- if (mode === "all") return ordered.slice(0, Math.max(1, maxAttachments));
930
- return ordered.slice(0, 1);
931
- }
932
- var MediaAttachmentCache = class {
933
- constructor(attachments, options) {
934
- this.entries = /* @__PURE__ */ new Map();
935
- this.attachments = attachments;
936
- this.localPathRoots = mergeInboundPathRoots(options?.localPathRoots, DEFAULT_LOCAL_PATH_ROOTS);
937
- for (const attachment of attachments) this.entries.set(attachment.index, { attachment });
938
- }
939
- async getBuffer(params) {
940
- const entry = await this.ensureEntry(params.attachmentIndex);
941
- if (entry.buffer) {
942
- if (entry.buffer.length > params.maxBytes) throw new MediaUnderstandingSkipError("maxBytes", `Attachment ${params.attachmentIndex + 1} exceeds maxBytes ${params.maxBytes}`);
943
- return {
944
- buffer: entry.buffer,
945
- mime: entry.bufferMime,
946
- fileName: entry.bufferFileName ?? `media-${params.attachmentIndex + 1}`,
947
- size: entry.buffer.length
948
- };
949
- }
950
- if (entry.resolvedPath) {
951
- const size = await this.ensureLocalStat(entry);
952
- if (entry.resolvedPath) {
953
- if (size !== void 0 && size > params.maxBytes) throw new MediaUnderstandingSkipError("maxBytes", `Attachment ${params.attachmentIndex + 1} exceeds maxBytes ${params.maxBytes}`);
954
- const buffer = await fs$1.readFile(entry.resolvedPath);
955
- entry.buffer = buffer;
956
- entry.bufferMime = entry.bufferMime ?? entry.attachment.mime ?? await detectMime({
957
- buffer,
958
- filePath: entry.resolvedPath
959
- });
960
- entry.bufferFileName = path.basename(entry.resolvedPath) || `media-${params.attachmentIndex + 1}`;
961
- return {
962
- buffer,
963
- mime: entry.bufferMime,
964
- fileName: entry.bufferFileName,
965
- size: buffer.length
966
- };
967
- }
968
- }
969
- const url = entry.attachment.url?.trim();
970
- if (!url) throw new MediaUnderstandingSkipError("empty", `Attachment ${params.attachmentIndex + 1} has no path or URL.`);
971
- try {
972
- const fetchImpl = (input, init) => fetchWithTimeout(resolveRequestUrl(input), init ?? {}, params.timeoutMs, fetch);
973
- const fetched = await fetchRemoteMedia({
974
- url,
975
- fetchImpl,
976
- maxBytes: params.maxBytes
977
- });
978
- entry.buffer = fetched.buffer;
979
- entry.bufferMime = entry.attachment.mime ?? fetched.contentType ?? await detectMime({
980
- buffer: fetched.buffer,
981
- filePath: fetched.fileName ?? url
982
- });
983
- entry.bufferFileName = fetched.fileName ?? `media-${params.attachmentIndex + 1}`;
984
- return {
985
- buffer: fetched.buffer,
986
- mime: entry.bufferMime,
987
- fileName: entry.bufferFileName,
988
- size: fetched.buffer.length
989
- };
990
- } catch (err) {
991
- if (err instanceof MediaFetchError && err.code === "max_bytes") throw new MediaUnderstandingSkipError("maxBytes", `Attachment ${params.attachmentIndex + 1} exceeds maxBytes ${params.maxBytes}`);
992
- if (isAbortError(err)) throw new MediaUnderstandingSkipError("timeout", `Attachment ${params.attachmentIndex + 1} timed out while fetching.`);
993
- throw err;
994
- }
995
- }
996
- async getPath(params) {
997
- const entry = await this.ensureEntry(params.attachmentIndex);
998
- if (entry.resolvedPath) {
999
- if (params.maxBytes) {
1000
- const size = await this.ensureLocalStat(entry);
1001
- if (entry.resolvedPath) {
1002
- if (size !== void 0 && size > params.maxBytes) throw new MediaUnderstandingSkipError("maxBytes", `Attachment ${params.attachmentIndex + 1} exceeds maxBytes ${params.maxBytes}`);
1003
- }
1004
- }
1005
- if (entry.resolvedPath) return { path: entry.resolvedPath };
1006
- }
1007
- if (entry.tempPath) {
1008
- if (params.maxBytes && entry.buffer && entry.buffer.length > params.maxBytes) throw new MediaUnderstandingSkipError("maxBytes", `Attachment ${params.attachmentIndex + 1} exceeds maxBytes ${params.maxBytes}`);
1009
- return {
1010
- path: entry.tempPath,
1011
- cleanup: entry.tempCleanup
1012
- };
1013
- }
1014
- const maxBytes = params.maxBytes ?? Number.POSITIVE_INFINITY;
1015
- const bufferResult = await this.getBuffer({
1016
- attachmentIndex: params.attachmentIndex,
1017
- maxBytes,
1018
- timeoutMs: params.timeoutMs
1019
- });
1020
- const tmpPath = buildRandomTempFilePath({
1021
- prefix: "remoteclaw-media",
1022
- extension: path.extname(bufferResult.fileName || "") || ""
1023
- });
1024
- await fs$1.writeFile(tmpPath, bufferResult.buffer);
1025
- entry.tempPath = tmpPath;
1026
- entry.tempCleanup = async () => {
1027
- await fs$1.unlink(tmpPath).catch(() => {});
1028
- };
1029
- return {
1030
- path: tmpPath,
1031
- cleanup: entry.tempCleanup
1032
- };
1033
- }
1034
- async cleanup() {
1035
- const cleanups = [];
1036
- for (const entry of this.entries.values()) if (entry.tempCleanup) {
1037
- cleanups.push(Promise.resolve(entry.tempCleanup()));
1038
- entry.tempCleanup = void 0;
1039
- }
1040
- await Promise.all(cleanups);
1041
- }
1042
- async ensureEntry(attachmentIndex) {
1043
- const existing = this.entries.get(attachmentIndex);
1044
- if (existing) {
1045
- if (!existing.resolvedPath) existing.resolvedPath = this.resolveLocalPath(existing.attachment);
1046
- return existing;
1047
- }
1048
- const attachment = this.attachments.find((item) => item.index === attachmentIndex) ?? { index: attachmentIndex };
1049
- const entry = {
1050
- attachment,
1051
- resolvedPath: this.resolveLocalPath(attachment)
1052
- };
1053
- this.entries.set(attachmentIndex, entry);
1054
- return entry;
1055
- }
1056
- resolveLocalPath(attachment) {
1057
- const rawPath = normalizeAttachmentPath(attachment.path);
1058
- if (!rawPath) return;
1059
- return path.isAbsolute(rawPath) ? rawPath : path.resolve(rawPath);
1060
- }
1061
- async ensureLocalStat(entry) {
1062
- if (!entry.resolvedPath) return;
1063
- if (!isInboundPathAllowed({
1064
- filePath: entry.resolvedPath,
1065
- roots: this.localPathRoots
1066
- })) {
1067
- entry.resolvedPath = void 0;
1068
- if (shouldLogVerbose()) logVerbose(`Blocked attachment path outside allowed roots: ${entry.attachment.path ?? entry.attachment.url ?? "(unknown)"}`);
1069
- return;
1070
- }
1071
- if (entry.statSize !== void 0) return entry.statSize;
1072
- try {
1073
- const currentPath = entry.resolvedPath;
1074
- const stat = await fs$1.stat(currentPath);
1075
- if (!stat.isFile()) {
1076
- entry.resolvedPath = void 0;
1077
- return;
1078
- }
1079
- const canonicalPath = await fs$1.realpath(currentPath).catch(() => currentPath);
1080
- if (!isInboundPathAllowed({
1081
- filePath: canonicalPath,
1082
- roots: await this.getCanonicalLocalPathRoots()
1083
- })) {
1084
- entry.resolvedPath = void 0;
1085
- if (shouldLogVerbose()) logVerbose(`Blocked canonicalized attachment path outside allowed roots: ${canonicalPath}`);
1086
- return;
1087
- }
1088
- entry.resolvedPath = canonicalPath;
1089
- entry.statSize = stat.size;
1090
- return stat.size;
1091
- } catch (err) {
1092
- entry.resolvedPath = void 0;
1093
- if (shouldLogVerbose()) logVerbose(`Failed to read attachment ${entry.attachment.index + 1}: ${String(err)}`);
1094
- return;
1095
- }
1096
- }
1097
- async getCanonicalLocalPathRoots() {
1098
- if (this.canonicalLocalPathRoots) return await this.canonicalLocalPathRoots;
1099
- this.canonicalLocalPathRoots = (async () => mergeInboundPathRoots(this.localPathRoots, await Promise.all(this.localPathRoots.map(async (root) => {
1100
- if (root.includes("*")) return root;
1101
- return await fs$1.realpath(root).catch(() => root);
1102
- }))))();
1103
- return await this.canonicalLocalPathRoots;
1104
- }
1105
- };
1106
-
1107
- //#endregion
1108
- //#region src/auth/provider-auth.ts
1109
- /**
1110
- * Provider auth resolution extracted from model-auth.ts.
1111
- *
1112
- * Resolves API keys for providers via auth profiles, environment variables,
1113
- * and AWS SDK credential chains. Used by media-understanding, onboarding,
1114
- * and status display.
1115
- */
1116
- const AWS_BEARER_ENV = "AWS_BEARER_TOKEN_BEDROCK";
1117
- const AWS_ACCESS_KEY_ENV = "AWS_ACCESS_KEY_ID";
1118
- const AWS_SECRET_KEY_ENV = "AWS_SECRET_ACCESS_KEY";
1119
- const AWS_PROFILE_ENV = "AWS_PROFILE";
1120
- function resolveEnvSourceLabel(params) {
1121
- return `${params.envVars.some((envVar) => params.applied.has(envVar)) ? "shell env: " : "env: "}${params.label}`;
1122
- }
1123
- function resolveAwsSdkAuthInfo() {
1124
- const applied = new Set(getShellEnvAppliedKeys());
1125
- if (process.env[AWS_BEARER_ENV]?.trim()) return {
1126
- mode: "api-key",
1127
- source: resolveEnvSourceLabel({
1128
- applied,
1129
- envVars: [AWS_BEARER_ENV],
1130
- label: AWS_BEARER_ENV
1131
- })
1132
- };
1133
- if (process.env[AWS_ACCESS_KEY_ENV]?.trim() && process.env[AWS_SECRET_KEY_ENV]?.trim()) return {
1134
- mode: "api-key",
1135
- source: resolveEnvSourceLabel({
1136
- applied,
1137
- envVars: [AWS_ACCESS_KEY_ENV, AWS_SECRET_KEY_ENV],
1138
- label: `${AWS_ACCESS_KEY_ENV} + ${AWS_SECRET_KEY_ENV}`
1139
- })
1140
- };
1141
- if (process.env[AWS_PROFILE_ENV]?.trim()) return {
1142
- mode: "api-key",
1143
- source: resolveEnvSourceLabel({
1144
- applied,
1145
- envVars: [AWS_PROFILE_ENV],
1146
- label: AWS_PROFILE_ENV
1147
- })
1148
- };
1149
- return {
1150
- mode: "api-key",
1151
- source: "aws-sdk default chain"
1152
- };
1153
- }
1154
- function hasVertexAdcCredentials() {
1155
- const gacPath = process.env.GOOGLE_APPLICATION_CREDENTIALS;
1156
- if (gacPath) return existsSync(gacPath);
1157
- return existsSync(join(homedir(), ".config", "gcloud", "application_default_credentials.json"));
1158
- }
1159
- async function resolveApiKeyForProvider(params) {
1160
- const { provider, cfg, profileId } = params;
1161
- const store = params.store ?? ensureAuthProfileStore();
1162
- if (profileId) {
1163
- const resolved = await resolveApiKeyForProfile({
1164
- cfg,
1165
- store,
1166
- profileId
1167
- });
1168
- if (!resolved) throw new Error(`No credentials found for profile "${profileId}".`);
1169
- return {
1170
- apiKey: resolved.apiKey,
1171
- profileId,
1172
- source: `profile:${profileId}`,
1173
- mode: "api-key"
1174
- };
1175
- }
1176
- const profiles = listProfilesForProvider(store, provider);
1177
- const preferred = params.preferredProfile;
1178
- const candidates = preferred && profiles.includes(preferred) ? [preferred, ...profiles.filter((id) => id !== preferred)] : profiles;
1179
- for (const candidate of candidates) try {
1180
- const resolved = await resolveApiKeyForProfile({
1181
- cfg,
1182
- store,
1183
- profileId: candidate
1184
- });
1185
- if (resolved) return {
1186
- apiKey: resolved.apiKey,
1187
- profileId: candidate,
1188
- source: `profile:${candidate}`,
1189
- mode: "api-key"
1190
- };
1191
- } catch {}
1192
- const envResolved = resolveEnvApiKey(provider);
1193
- if (envResolved) return {
1194
- apiKey: envResolved.apiKey,
1195
- source: envResolved.source,
1196
- mode: "api-key"
1197
- };
1198
- if (normalizeProviderId(provider) === "amazon-bedrock") return resolveAwsSdkAuthInfo();
1199
- if (provider === "openai") {
1200
- if (listProfilesForProvider(store, "openai-codex").length > 0) throw new Error("No API key found for provider \"openai\". You are authenticated with OpenAI Codex OAuth. Use openai-codex/gpt-5.3-codex (OAuth) or set OPENAI_API_KEY to use openai/gpt-5.1-codex.");
1201
- }
1202
- const authStorePath = resolveAuthStorePathForDisplay();
1203
- throw new Error([
1204
- `No API key found for provider "${provider}".`,
1205
- `Auth store: ${authStorePath}.`,
1206
- `Configure auth via ${formatCliCommand("remoteclaw configure")} or ${formatCliCommand("remoteclaw onboard")}.`
1207
- ].join(" "));
1208
- }
1209
- function resolveEnvApiKey(provider) {
1210
- const normalized = normalizeProviderId(provider);
1211
- const applied = new Set(getShellEnvAppliedKeys());
1212
- const pick = (envVar) => {
1213
- const value = normalizeOptionalSecretInput(process.env[envVar]);
1214
- if (!value) return null;
1215
- return {
1216
- apiKey: value,
1217
- source: applied.has(envVar) ? `shell env: ${envVar}` : `env: ${envVar}`
1218
- };
1219
- };
1220
- if (normalized === "github-copilot") return pick("COPILOT_GITHUB_TOKEN") ?? pick("GH_TOKEN") ?? pick("GITHUB_TOKEN");
1221
- if (normalized === "anthropic") return pick("ANTHROPIC_OAUTH_TOKEN") ?? pick("ANTHROPIC_API_KEY");
1222
- if (normalized === "chutes") return pick("CHUTES_OAUTH_TOKEN") ?? pick("CHUTES_API_KEY");
1223
- if (normalized === "zai") return pick("ZAI_API_KEY") ?? pick("Z_AI_API_KEY");
1224
- if (normalized === "google-vertex") {
1225
- const hasCredentials = hasVertexAdcCredentials();
1226
- const hasProject = !!(process.env.GOOGLE_CLOUD_PROJECT || process.env.GCLOUD_PROJECT);
1227
- const hasLocation = !!process.env.GOOGLE_CLOUD_LOCATION;
1228
- if (hasCredentials && hasProject && hasLocation) return {
1229
- apiKey: "<authenticated>",
1230
- source: "gcloud adc"
1231
- };
1232
- return null;
1233
- }
1234
- if (normalized === "opencode") return pick("OPENCODE_API_KEY") ?? pick("OPENCODE_ZEN_API_KEY");
1235
- if (normalized === "qwen-portal") return pick("QWEN_OAUTH_TOKEN") ?? pick("QWEN_PORTAL_API_KEY");
1236
- if (normalized === "volcengine" || normalized === "volcengine-plan") return pick("VOLCANO_ENGINE_API_KEY");
1237
- if (normalized === "byteplus" || normalized === "byteplus-plan") return pick("BYTEPLUS_API_KEY");
1238
- if (normalized === "minimax-portal") return pick("MINIMAX_OAUTH_TOKEN") ?? pick("MINIMAX_API_KEY");
1239
- if (normalized === "kimi-coding") return pick("KIMI_API_KEY") ?? pick("KIMICODE_API_KEY");
1240
- if (normalized === "huggingface") return pick("HUGGINGFACE_HUB_TOKEN") ?? pick("HF_TOKEN");
1241
- if (normalized === "elevenlabs") return pick("ELEVENLABS_API_KEY") ?? pick("XI_API_KEY");
1242
- const envVar = {
1243
- openai: "OPENAI_API_KEY",
1244
- google: "GEMINI_API_KEY",
1245
- voyage: "VOYAGE_API_KEY",
1246
- groq: "GROQ_API_KEY",
1247
- deepgram: "DEEPGRAM_API_KEY",
1248
- cerebras: "CEREBRAS_API_KEY",
1249
- xai: "XAI_API_KEY",
1250
- openrouter: "OPENROUTER_API_KEY",
1251
- litellm: "LITELLM_API_KEY",
1252
- "vercel-ai-gateway": "AI_GATEWAY_API_KEY",
1253
- "cloudflare-ai-gateway": "CLOUDFLARE_AI_GATEWAY_API_KEY",
1254
- moonshot: "MOONSHOT_API_KEY",
1255
- minimax: "MINIMAX_API_KEY",
1256
- nvidia: "NVIDIA_API_KEY",
1257
- xiaomi: "XIAOMI_API_KEY",
1258
- synthetic: "SYNTHETIC_API_KEY",
1259
- venice: "VENICE_API_KEY",
1260
- mistral: "MISTRAL_API_KEY",
1261
- opencode: "OPENCODE_API_KEY",
1262
- together: "TOGETHER_API_KEY",
1263
- qianfan: "QIANFAN_API_KEY",
1264
- ollama: "OLLAMA_API_KEY",
1265
- vllm: "VLLM_API_KEY",
1266
- kilocode: "KILOCODE_API_KEY"
1267
- }[normalized];
1268
- if (!envVar) return null;
1269
- return pick(envVar);
1270
- }
1271
- function resolveModelAuthMode(provider, cfg, store) {
1272
- const resolved = provider?.trim();
1273
- if (!resolved) return;
1274
- if (listProfilesForProvider(store ?? ensureAuthProfileStore(), resolved).length > 0) return "api-key";
1275
- if (normalizeProviderId(resolved) === "amazon-bedrock") return "api-key";
1276
- if (resolveEnvApiKey(resolved)?.apiKey) return "api-key";
1277
- return "unknown";
1278
- }
1279
- function requireApiKey(auth, provider) {
1280
- const key = normalizeSecretInput(auth.apiKey);
1281
- if (key) return key;
1282
- throw new Error(`No API key resolved for provider "${provider}" (auth mode: ${auth.mode}).`);
1283
- }
1284
- function formatApiKeySnippet(apiKey) {
1285
- const compact = apiKey.replace(/\s+/g, "");
1286
- if (!compact) return "unknown";
1287
- const edge = compact.length >= 12 ? 6 : 4;
1288
- return `${compact.slice(0, edge)}…${compact.slice(-edge)}`;
1289
- }
1290
- function resolveModelAuthLabel(params) {
1291
- const resolvedProvider = params.provider?.trim();
1292
- if (!resolvedProvider) return;
1293
- const providerKey = normalizeProviderId(resolvedProvider);
1294
- const store = ensureAuthProfileStore();
1295
- const candidates = [params.sessionEntry?.authProfileOverride?.trim(), ...listProfilesForProvider(store, providerKey)].filter(Boolean);
1296
- for (const profileId of candidates) {
1297
- const profile = store.profiles[profileId];
1298
- if (!profile || normalizeProviderId(profile.provider) !== providerKey) continue;
1299
- const label = resolveAuthProfileDisplayLabel({
1300
- cfg: params.cfg,
1301
- store,
1302
- profileId
1303
- });
1304
- return `api-key ${formatApiKeySnippet(profile.type === "token" ? profile.token : profile.key ?? "")}${label ? ` (${label})` : ""}`;
1305
- }
1306
- const envKey = resolveEnvApiKey(providerKey);
1307
- if (envKey?.apiKey) {
1308
- if (envKey.source.includes("OAUTH_TOKEN")) return `oauth (${envKey.source})`;
1309
- return `api-key ${formatApiKeySnippet(envKey.apiKey)} (${envKey.source})`;
1310
- }
1311
- return "unknown";
1312
- }
1313
-
1314
- //#endregion
1315
- //#region src/media-understanding/fs.ts
1316
- async function fileExists(filePath) {
1317
- if (!filePath) return false;
1318
- try {
1319
- await fs$1.stat(filePath);
1320
- return true;
1321
- } catch {
1322
- return false;
1323
- }
1324
- }
1325
-
1326
- //#endregion
1327
- //#region src/media-understanding/output-extract.ts
1328
- function extractLastJsonObject(raw) {
1329
- const trimmed = raw.trim();
1330
- const start = trimmed.lastIndexOf("{");
1331
- if (start === -1) return null;
1332
- const slice = trimmed.slice(start);
1333
- try {
1334
- return JSON.parse(slice);
1335
- } catch {
1336
- return null;
1337
- }
1338
- }
1339
- function extractGeminiResponse(raw) {
1340
- const payload = extractLastJsonObject(raw);
1341
- if (!payload || typeof payload !== "object") return null;
1342
- const response = payload.response;
1343
- if (typeof response !== "string") return null;
1344
- return response.trim() || null;
1345
- }
1346
-
1347
- //#endregion
1348
- //#region src/agents/live-auth-keys.ts
1349
- const KEY_SPLIT_RE = /[\s,;]+/g;
1350
- const GOOGLE_LIVE_SINGLE_KEY = "REMOTECLAW_LIVE_GEMINI_KEY";
1351
- const PROVIDER_PREFIX_OVERRIDES = {
1352
- google: "GEMINI",
1353
- "google-vertex": "GEMINI"
1354
- };
1355
- const PROVIDER_API_KEY_CONFIG = {
1356
- anthropic: {
1357
- liveSingle: "REMOTECLAW_LIVE_ANTHROPIC_KEY",
1358
- listVar: "REMOTECLAW_LIVE_ANTHROPIC_KEYS",
1359
- primaryVar: "ANTHROPIC_API_KEY",
1360
- prefixedVar: "ANTHROPIC_API_KEY_"
1361
- },
1362
- google: {
1363
- liveSingle: GOOGLE_LIVE_SINGLE_KEY,
1364
- listVar: "GEMINI_API_KEYS",
1365
- primaryVar: "GEMINI_API_KEY",
1366
- prefixedVar: "GEMINI_API_KEY_"
1367
- },
1368
- "google-vertex": {
1369
- liveSingle: GOOGLE_LIVE_SINGLE_KEY,
1370
- listVar: "GEMINI_API_KEYS",
1371
- primaryVar: "GEMINI_API_KEY",
1372
- prefixedVar: "GEMINI_API_KEY_"
1373
- },
1374
- openai: {
1375
- liveSingle: "REMOTECLAW_LIVE_OPENAI_KEY",
1376
- listVar: "OPENAI_API_KEYS",
1377
- primaryVar: "OPENAI_API_KEY",
1378
- prefixedVar: "OPENAI_API_KEY_"
1379
- }
1380
- };
1381
- function parseKeyList(raw) {
1382
- if (!raw) return [];
1383
- return raw.split(KEY_SPLIT_RE).map((value) => value.trim()).filter(Boolean);
1384
- }
1385
- function collectEnvPrefixedKeys(prefix) {
1386
- const keys = [];
1387
- for (const [name, value] of Object.entries(process.env)) {
1388
- if (!name.startsWith(prefix)) continue;
1389
- const trimmed = value?.trim();
1390
- if (!trimmed) continue;
1391
- keys.push(trimmed);
1392
- }
1393
- return keys;
1394
- }
1395
- function resolveProviderApiKeyConfig(provider) {
1396
- const normalized = normalizeProviderId(provider);
1397
- const custom = PROVIDER_API_KEY_CONFIG[normalized];
1398
- const base = PROVIDER_PREFIX_OVERRIDES[normalized] ?? normalized.toUpperCase().replace(/-/g, "_");
1399
- const liveSingle = custom?.liveSingle ?? `REMOTECLAW_LIVE_${base}_KEY`;
1400
- const listVar = custom?.listVar ?? `${base}_API_KEYS`;
1401
- const primaryVar = custom?.primaryVar ?? `${base}_API_KEY`;
1402
- const prefixedVar = custom?.prefixedVar ?? `${base}_API_KEY_`;
1403
- if (normalized === "google" || normalized === "google-vertex") return {
1404
- liveSingle,
1405
- listVar,
1406
- primaryVar,
1407
- prefixedVar,
1408
- fallbackVars: ["GOOGLE_API_KEY"]
1409
- };
1410
- return {
1411
- liveSingle,
1412
- listVar,
1413
- primaryVar,
1414
- prefixedVar,
1415
- fallbackVars: []
1416
- };
1417
- }
1418
- function collectProviderApiKeys(provider) {
1419
- const config = resolveProviderApiKeyConfig(provider);
1420
- const forcedSingle = config.liveSingle ? process.env[config.liveSingle]?.trim() : void 0;
1421
- if (forcedSingle) return [forcedSingle];
1422
- const fromList = parseKeyList(config.listVar ? process.env[config.listVar] : void 0);
1423
- const primary = config.primaryVar ? process.env[config.primaryVar]?.trim() : void 0;
1424
- const fromPrefixed = config.prefixedVar ? collectEnvPrefixedKeys(config.prefixedVar) : [];
1425
- const fallback = config.fallbackVars.map((envVar) => process.env[envVar]?.trim()).filter(Boolean);
1426
- const seen = /* @__PURE__ */ new Set();
1427
- const add = (value) => {
1428
- if (!value) return;
1429
- if (seen.has(value)) return;
1430
- seen.add(value);
1431
- };
1432
- for (const value of fromList) add(value);
1433
- add(primary);
1434
- for (const value of fromPrefixed) add(value);
1435
- for (const value of fallback) add(value);
1436
- return Array.from(seen);
1437
- }
1438
- function isApiKeyRateLimitError(message) {
1439
- const lower = message.toLowerCase();
1440
- if (lower.includes("rate_limit")) return true;
1441
- if (lower.includes("rate limit")) return true;
1442
- if (lower.includes("429")) return true;
1443
- if (lower.includes("quota exceeded") || lower.includes("quota_exceeded")) return true;
1444
- if (lower.includes("resource exhausted") || lower.includes("resource_exhausted")) return true;
1445
- if (lower.includes("too many requests")) return true;
1446
- return false;
1447
- }
1448
-
1449
- //#endregion
1450
- //#region src/auth/api-key-rotation.ts
1451
- function dedupeApiKeys(raw) {
1452
- const seen = /* @__PURE__ */ new Set();
1453
- const keys = [];
1454
- for (const value of raw) {
1455
- const apiKey = value.trim();
1456
- if (!apiKey || seen.has(apiKey)) continue;
1457
- seen.add(apiKey);
1458
- keys.push(apiKey);
1459
- }
1460
- return keys;
1461
- }
1462
- function collectProviderApiKeysForExecution(params) {
1463
- const { primaryApiKey, provider } = params;
1464
- return dedupeApiKeys([primaryApiKey?.trim() ?? "", ...collectProviderApiKeys(provider)]);
1465
- }
1466
- async function executeWithApiKeyRotation(params) {
1467
- const keys = dedupeApiKeys(params.apiKeys);
1468
- if (keys.length === 0) throw new Error(`No API keys configured for provider "${params.provider}".`);
1469
- let lastError;
1470
- for (let attempt = 0; attempt < keys.length; attempt += 1) {
1471
- const apiKey = keys[attempt];
1472
- try {
1473
- return await params.execute(apiKey);
1474
- } catch (error) {
1475
- lastError = error;
1476
- const message = formatErrorMessage(error);
1477
- if (!(params.shouldRetry ? params.shouldRetry({
1478
- apiKey,
1479
- error,
1480
- attempt,
1481
- message
1482
- }) : isApiKeyRateLimitError(message)) || attempt + 1 >= keys.length) break;
1483
- params.onRetry?.({
1484
- apiKey,
1485
- error,
1486
- attempt,
1487
- message
1488
- });
1489
- }
1490
- }
1491
- if (lastError === void 0) throw new Error(`Failed to run API request for ${params.provider}.`);
1492
- throw lastError;
1493
- }
1494
-
1495
- //#endregion
1496
- //#region src/stt/providers/deepgram/index.ts
1497
- const deepgramSttProvider = {
1498
- id: "deepgram",
1499
- transcribeAudio: transcribeDeepgramAudio
1500
- };
1501
-
1502
- //#endregion
1503
- //#region src/stt/providers/google/index.ts
1504
- const googleSttProvider = {
1505
- id: "google",
1506
- transcribeAudio: transcribeGeminiAudio
1507
- };
1508
-
1509
- //#endregion
1510
- //#region src/stt/providers/groq/index.ts
1511
- const DEFAULT_GROQ_AUDIO_BASE_URL = "https://api.groq.com/openai/v1";
1512
- const groqSttProvider = {
1513
- id: "groq",
1514
- transcribeAudio: (req) => transcribeOpenAiCompatibleAudio({
1515
- ...req,
1516
- baseUrl: req.baseUrl ?? DEFAULT_GROQ_AUDIO_BASE_URL
1517
- })
1518
- };
1519
-
1520
- //#endregion
1521
- //#region src/stt/providers/mistral/index.ts
1522
- const DEFAULT_MISTRAL_AUDIO_BASE_URL = "https://api.mistral.ai/v1";
1523
- const mistralSttProvider = {
1524
- id: "mistral",
1525
- transcribeAudio: (req) => transcribeOpenAiCompatibleAudio({
1526
- ...req,
1527
- baseUrl: req.baseUrl ?? DEFAULT_MISTRAL_AUDIO_BASE_URL
1528
- })
1529
- };
1530
-
1531
- //#endregion
1532
- //#region src/stt/providers/openai/index.ts
1533
- const openaiSttProvider = {
1534
- id: "openai",
1535
- transcribeAudio: transcribeOpenAiCompatibleAudio
1536
- };
1537
-
1538
- //#endregion
1539
- //#region src/stt/providers/index.ts
1540
- const STT_PROVIDERS = [
1541
- groqSttProvider,
1542
- openaiSttProvider,
1543
- googleSttProvider,
1544
- mistralSttProvider,
1545
- deepgramSttProvider
1546
- ];
1547
- function normalizeSttProviderId(id) {
1548
- const normalized = normalizeProviderId(id);
1549
- if (normalized === "gemini") return "google";
1550
- return normalized;
1551
- }
1552
- function buildSttProviderRegistry(overrides) {
1553
- const registry = /* @__PURE__ */ new Map();
1554
- for (const provider of STT_PROVIDERS) registry.set(normalizeSttProviderId(provider.id), provider);
1555
- if (overrides) for (const [key, provider] of Object.entries(overrides)) registry.set(normalizeSttProviderId(key), provider);
1556
- return registry;
1557
- }
1558
- function getSttProvider(id, registry) {
1559
- return registry.get(normalizeSttProviderId(id));
1560
- }
1561
-
1562
- //#endregion
1563
- //#region src/stt/stt.ts
1564
- function normalizeProviderQuery(options) {
1565
- if (!options) return;
1566
- const query = {};
1567
- for (const [key, value] of Object.entries(options)) {
1568
- if (value === void 0) continue;
1569
- query[key] = value;
1570
- }
1571
- return Object.keys(query).length > 0 ? query : void 0;
1572
- }
1573
- function buildDeepgramCompatQuery(options) {
1574
- if (!options) return;
1575
- const query = {};
1576
- if (typeof options.detectLanguage === "boolean") query.detect_language = options.detectLanguage;
1577
- if (typeof options.punctuate === "boolean") query.punctuate = options.punctuate;
1578
- if (typeof options.smartFormat === "boolean") query.smart_format = options.smartFormat;
1579
- return Object.keys(query).length > 0 ? query : void 0;
1580
- }
1581
- function normalizeDeepgramQueryKeys(query) {
1582
- const normalized = { ...query };
1583
- if ("detectLanguage" in normalized) {
1584
- normalized.detect_language = normalized.detectLanguage;
1585
- delete normalized.detectLanguage;
1586
- }
1587
- if ("smartFormat" in normalized) {
1588
- normalized.smart_format = normalized.smartFormat;
1589
- delete normalized.smartFormat;
1590
- }
1591
- return normalized;
1592
- }
1593
- function resolveProviderQuery(params) {
1594
- const { providerId, config, entry } = params;
1595
- const mergedOptions = normalizeProviderQuery({
1596
- ...config?.providerOptions?.[providerId],
1597
- ...entry.providerOptions?.[providerId]
1598
- });
1599
- if (providerId !== "deepgram") return mergedOptions;
1600
- const query = normalizeDeepgramQueryKeys(mergedOptions ?? {});
1601
- const compat = buildDeepgramCompatQuery({
1602
- ...config?.deepgram,
1603
- ...entry.deepgram
1604
- });
1605
- for (const [key, value] of Object.entries(compat ?? {})) if (query[key] === void 0) query[key] = value;
1606
- return Object.keys(query).length > 0 ? query : void 0;
1607
- }
1608
- async function transcribeAudioWithProvider(params) {
1609
- const { providerId, cfg, entry, config } = params;
1610
- const provider = getSttProvider(providerId, params.providerRegistry);
1611
- if (!provider) throw new Error(`STT provider not available: ${providerId}`);
1612
- const apiKeys = collectProviderApiKeysForExecution({
1613
- provider: providerId,
1614
- primaryApiKey: requireApiKey(await resolveApiKeyForProvider({
1615
- provider: providerId,
1616
- cfg,
1617
- profileId: entry.profile,
1618
- preferredProfile: entry.preferredProfile
1619
- }), providerId)
1620
- });
1621
- const baseUrl = entry.baseUrl ?? config?.baseUrl;
1622
- const mergedHeaders = {
1623
- ...config?.headers,
1624
- ...entry.headers
1625
- };
1626
- const headers = Object.keys(mergedHeaders).length > 0 ? mergedHeaders : void 0;
1627
- const providerQuery = resolveProviderQuery({
1628
- providerId,
1629
- config,
1630
- entry
1631
- });
1632
- const model = entry.model?.trim() || DEFAULT_AUDIO_MODELS[providerId];
1633
- return await executeWithApiKeyRotation({
1634
- provider: providerId,
1635
- apiKeys,
1636
- execute: async (apiKey) => provider.transcribeAudio({
1637
- buffer: params.buffer,
1638
- fileName: params.fileName,
1639
- mime: params.mime,
1640
- apiKey,
1641
- baseUrl,
1642
- headers,
1643
- model,
1644
- language: params.language ?? entry.language ?? config?.language ?? cfg.tools?.media?.audio?.language,
1645
- prompt: params.prompt,
1646
- query: providerQuery,
1647
- timeoutMs: params.timeoutMs
1648
- })
1649
- });
1650
- }
1651
-
1652
- //#endregion
1653
- //#region src/media-understanding/video.ts
1654
- function estimateBase64Size(bytes) {
1655
- return Math.ceil(bytes / 3) * 4;
1656
- }
1657
- function resolveVideoMaxBase64Bytes(maxBytes) {
1658
- const expanded = Math.floor(maxBytes * (4 / 3));
1659
- return Math.min(expanded, DEFAULT_VIDEO_MAX_BASE64_BYTES);
1660
- }
1661
-
1662
- //#endregion
1663
- //#region src/media-understanding/runner.entries.ts
1664
- function trimOutput(text, maxChars) {
1665
- const trimmed = text.trim();
1666
- if (!maxChars || trimmed.length <= maxChars) return trimmed;
1667
- return trimmed.slice(0, maxChars).trim();
1668
- }
1669
- function extractSherpaOnnxText(raw) {
1670
- const tryParse = (value) => {
1671
- const trimmed = value.trim();
1672
- if (!trimmed) return null;
1673
- const head = trimmed[0];
1674
- if (head !== "{" && head !== "\"") return null;
1675
- try {
1676
- const parsed = JSON.parse(trimmed);
1677
- if (typeof parsed === "string") return tryParse(parsed);
1678
- if (parsed && typeof parsed === "object") {
1679
- const text = parsed.text;
1680
- if (typeof text === "string" && text.trim()) return text.trim();
1681
- }
1682
- } catch {}
1683
- return null;
1684
- };
1685
- const direct = tryParse(raw);
1686
- if (direct) return direct;
1687
- const lines = raw.split("\n").map((line) => line.trim()).filter(Boolean);
1688
- for (let i = lines.length - 1; i >= 0; i -= 1) {
1689
- const parsed = tryParse(lines[i] ?? "");
1690
- if (parsed) return parsed;
1691
- }
1692
- return null;
1693
- }
1694
- function commandBase(command) {
1695
- return path.parse(command).name;
1696
- }
1697
- function findArgValue(args, keys) {
1698
- for (let i = 0; i < args.length; i += 1) if (keys.includes(args[i] ?? "")) {
1699
- const value = args[i + 1];
1700
- if (value) return value;
1701
- }
1702
- }
1703
- function hasArg(args, keys) {
1704
- return args.some((arg) => keys.includes(arg));
1705
- }
1706
- function resolveWhisperOutputPath(args, mediaPath) {
1707
- const outputDir = findArgValue(args, ["--output_dir", "-o"]);
1708
- const outputFormat = findArgValue(args, ["--output_format"]);
1709
- if (!outputDir || !outputFormat) return null;
1710
- if (!outputFormat.split(",").map((value) => value.trim()).includes("txt")) return null;
1711
- const base = path.parse(mediaPath).name;
1712
- return path.join(outputDir, `${base}.txt`);
1713
- }
1714
- function resolveWhisperCppOutputPath(args) {
1715
- if (!hasArg(args, ["-otxt", "--output-txt"])) return null;
1716
- const outputBase = findArgValue(args, ["-of", "--output-file"]);
1717
- if (!outputBase) return null;
1718
- return `${outputBase}.txt`;
1719
- }
1720
- async function resolveCliOutput(params) {
1721
- const commandId = commandBase(params.command);
1722
- const fileOutput = commandId === "whisper-cli" ? resolveWhisperCppOutputPath(params.args) : commandId === "whisper" ? resolveWhisperOutputPath(params.args, params.mediaPath) : null;
1723
- if (fileOutput && await fileExists(fileOutput)) try {
1724
- const content = await fs$1.readFile(fileOutput, "utf8");
1725
- if (content.trim()) return content.trim();
1726
- } catch {}
1727
- if (commandId === "gemini") {
1728
- const response = extractGeminiResponse(params.stdout);
1729
- if (response) return response;
1730
- }
1731
- if (commandId === "sherpa-onnx-offline") {
1732
- const response = extractSherpaOnnxText(params.stdout);
1733
- if (response) return response;
1734
- }
1735
- return params.stdout.trim();
1736
- }
1737
- function buildModelDecision(params) {
1738
- if (params.entryType === "cli") {
1739
- const command = params.entry.command?.trim();
1740
- return {
1741
- type: "cli",
1742
- provider: command ?? "cli",
1743
- model: params.entry.model ?? command,
1744
- outcome: params.outcome,
1745
- reason: params.reason
1746
- };
1747
- }
1748
- const providerIdRaw = params.entry.provider?.trim();
1749
- return {
1750
- type: "provider",
1751
- provider: (providerIdRaw ? normalizeMediaProviderId(providerIdRaw) : void 0) ?? providerIdRaw,
1752
- model: params.entry.model,
1753
- outcome: params.outcome,
1754
- reason: params.reason
1755
- };
1756
- }
1757
- function resolveEntryRunOptions(params) {
1758
- const { capability, entry, cfg } = params;
1759
- const maxBytes = resolveMaxBytes({
1760
- capability,
1761
- entry,
1762
- cfg,
1763
- config: params.config
1764
- });
1765
- const maxChars = resolveMaxChars({
1766
- capability,
1767
- entry,
1768
- cfg,
1769
- config: params.config
1770
- });
1771
- return {
1772
- maxBytes,
1773
- maxChars,
1774
- timeoutMs: resolveTimeoutMs(entry.timeoutSeconds ?? params.config?.timeoutSeconds ?? cfg.tools?.media?.[capability]?.timeoutSeconds, DEFAULT_TIMEOUT_SECONDS[capability]),
1775
- prompt: resolvePrompt(capability, entry.prompt ?? params.config?.prompt ?? cfg.tools?.media?.[capability]?.prompt, maxChars)
1776
- };
1777
- }
1778
- async function resolveProviderExecutionAuth(params) {
1779
- const auth = await resolveApiKeyForProvider({
1780
- provider: params.providerId,
1781
- cfg: params.cfg,
1782
- profileId: params.entry.profile,
1783
- preferredProfile: params.entry.preferredProfile
1784
- });
1785
- return { apiKeys: collectProviderApiKeysForExecution({
1786
- provider: params.providerId,
1787
- primaryApiKey: requireApiKey(auth, params.providerId)
1788
- }) };
1789
- }
1790
- async function resolveProviderExecutionContext(params) {
1791
- const { apiKeys } = await resolveProviderExecutionAuth({
1792
- providerId: params.providerId,
1793
- cfg: params.cfg,
1794
- entry: params.entry,
1795
- agentDir: params.agentDir
1796
- });
1797
- const baseUrl = params.entry.baseUrl ?? params.config?.baseUrl;
1798
- const mergedHeaders = {
1799
- ...params.config?.headers,
1800
- ...params.entry.headers
1801
- };
1802
- return {
1803
- apiKeys,
1804
- baseUrl,
1805
- headers: Object.keys(mergedHeaders).length > 0 ? mergedHeaders : void 0
1806
- };
1807
- }
1808
- function formatDecisionSummary(decision) {
1809
- const total = decision.attachments.length;
1810
- const success = decision.attachments.filter((entry) => entry.chosen?.outcome === "success").length;
1811
- const chosen = decision.attachments.find((entry) => entry.chosen)?.chosen;
1812
- const provider = chosen?.provider?.trim();
1813
- const model = chosen?.model?.trim();
1814
- const modelLabel = provider ? model ? `${provider}/${model}` : provider : void 0;
1815
- const reason = decision.attachments.flatMap((entry) => entry.attempts.map((attempt) => attempt.reason).filter(Boolean)).find(Boolean);
1816
- const shortReason = reason ? reason.split(":")[0]?.trim() : void 0;
1817
- const countLabel = total > 0 ? ` (${success}/${total})` : "";
1818
- const viaLabel = modelLabel ? ` via ${modelLabel}` : "";
1819
- const reasonLabel = shortReason ? ` reason=${shortReason}` : "";
1820
- return `${decision.capability}: ${decision.outcome}${countLabel}${viaLabel}${reasonLabel}`;
1821
- }
1822
- async function runProviderEntry(params) {
1823
- const { entry, capability, cfg } = params;
1824
- const providerIdRaw = entry.provider?.trim();
1825
- if (!providerIdRaw) throw new Error(`Provider entry missing provider for ${capability}`);
1826
- const providerId = normalizeMediaProviderId(providerIdRaw);
1827
- const { maxBytes, maxChars, timeoutMs, prompt } = resolveEntryRunOptions({
1828
- capability,
1829
- entry,
1830
- cfg,
1831
- config: params.config
1832
- });
1833
- const provider = getMediaUnderstandingProvider(providerId, params.providerRegistry);
1834
- if (!provider) throw new Error(`Media provider not available: ${providerId}`);
1835
- if (capability === "audio") {
1836
- if (!provider.transcribeAudio) throw new Error(`Audio transcription provider "${providerId}" not available.`);
1837
- const media = await params.cache.getBuffer({
1838
- attachmentIndex: params.attachmentIndex,
1839
- maxBytes,
1840
- timeoutMs
1841
- });
1842
- const sttOverrides = {};
1843
- for (const [key, muProvider] of params.providerRegistry) if (muProvider.transcribeAudio) sttOverrides[key] = {
1844
- id: muProvider.id,
1845
- transcribeAudio: muProvider.transcribeAudio
1846
- };
1847
- const sttRegistry = buildSttProviderRegistry(sttOverrides);
1848
- const result = await transcribeAudioWithProvider({
1849
- buffer: media.buffer,
1850
- fileName: media.fileName,
1851
- mime: media.mime,
1852
- providerId,
1853
- cfg,
1854
- entry,
1855
- config: params.config,
1856
- agentDir: params.agentDir,
1857
- providerRegistry: sttRegistry,
1858
- prompt,
1859
- timeoutMs
1860
- });
1861
- return {
1862
- kind: "audio.transcription",
1863
- attachmentIndex: params.attachmentIndex,
1864
- text: trimOutput(result.text, maxChars),
1865
- provider: providerId,
1866
- model: result.model ?? entry.model
1867
- };
1868
- }
1869
- if (!provider.describeVideo) throw new Error(`Video understanding provider "${providerId}" not available.`);
1870
- const describeVideo = provider.describeVideo;
1871
- const media = await params.cache.getBuffer({
1872
- attachmentIndex: params.attachmentIndex,
1873
- maxBytes,
1874
- timeoutMs
1875
- });
1876
- const estimatedBase64Bytes = estimateBase64Size(media.size);
1877
- const maxBase64Bytes = resolveVideoMaxBase64Bytes(maxBytes);
1878
- if (estimatedBase64Bytes > maxBase64Bytes) throw new MediaUnderstandingSkipError("maxBytes", `Video attachment ${params.attachmentIndex + 1} base64 payload ${estimatedBase64Bytes} exceeds ${maxBase64Bytes}`);
1879
- const { apiKeys, baseUrl, headers } = await resolveProviderExecutionContext({
1880
- providerId,
1881
- cfg,
1882
- entry,
1883
- config: params.config,
1884
- agentDir: params.agentDir
1885
- });
1886
- const result = await executeWithApiKeyRotation({
1887
- provider: providerId,
1888
- apiKeys,
1889
- execute: (apiKey) => describeVideo({
1890
- buffer: media.buffer,
1891
- fileName: media.fileName,
1892
- mime: media.mime,
1893
- apiKey,
1894
- baseUrl,
1895
- headers,
1896
- model: entry.model,
1897
- prompt,
1898
- timeoutMs
1899
- })
1900
- });
1901
- return {
1902
- kind: "video.description",
1903
- attachmentIndex: params.attachmentIndex,
1904
- text: trimOutput(result.text, maxChars),
1905
- provider: providerId,
1906
- model: result.model ?? entry.model
1907
- };
1908
- }
1909
- async function runCliEntry(params) {
1910
- const { entry, capability, cfg, ctx } = params;
1911
- const command = entry.command?.trim();
1912
- const args = entry.args ?? [];
1913
- if (!command) throw new Error(`CLI entry missing command for ${capability}`);
1914
- const { maxBytes, maxChars, timeoutMs, prompt } = resolveEntryRunOptions({
1915
- capability,
1916
- entry,
1917
- cfg,
1918
- config: params.config
1919
- });
1920
- const pathResult = await params.cache.getPath({
1921
- attachmentIndex: params.attachmentIndex,
1922
- maxBytes,
1923
- timeoutMs
1924
- });
1925
- const outputDir = await fs$1.mkdtemp(path.join(resolvePreferredRemoteClawTmpDir(), "remoteclaw-media-cli-"));
1926
- const mediaPath = pathResult.path;
1927
- const outputBase = path.join(outputDir, path.parse(mediaPath).name);
1928
- const templCtx = {
1929
- ...ctx,
1930
- MediaPath: mediaPath,
1931
- MediaDir: path.dirname(mediaPath),
1932
- OutputDir: outputDir,
1933
- OutputBase: outputBase,
1934
- Prompt: prompt,
1935
- MaxChars: maxChars
1936
- };
1937
- const argv = [command, ...args].map((part, index) => index === 0 ? part : applyTemplate(part, templCtx));
1938
- try {
1939
- if (shouldLogVerbose()) logVerbose(`Media understanding via CLI: ${argv.join(" ")}`);
1940
- const { stdout } = await runExec(argv[0], argv.slice(1), {
1941
- timeoutMs,
1942
- maxBuffer: CLI_OUTPUT_MAX_BUFFER
1943
- });
1944
- const text = trimOutput(await resolveCliOutput({
1945
- command,
1946
- args: argv.slice(1),
1947
- stdout,
1948
- mediaPath
1949
- }), maxChars);
1950
- if (!text) return null;
1951
- return {
1952
- kind: capability === "audio" ? "audio.transcription" : `${capability}.description`,
1953
- attachmentIndex: params.attachmentIndex,
1954
- text,
1955
- provider: "cli",
1956
- model: command
1957
- };
1958
- } finally {
1959
- await fs$1.rm(outputDir, {
1960
- recursive: true,
1961
- force: true
1962
- }).catch(() => {});
1963
- }
1964
- }
1965
-
1966
- //#endregion
1967
- //#region src/media-understanding/runner.ts
1968
- function buildProviderRegistry(overrides) {
1969
- return buildMediaUnderstandingRegistry(overrides);
1970
- }
1971
- function normalizeMediaAttachments(ctx) {
1972
- return normalizeAttachments(ctx);
1973
- }
1974
- function resolveMediaAttachmentLocalRoots(params) {
1975
- return mergeInboundPathRoots(getDefaultMediaLocalRoots(), resolveIMessageAttachmentRoots({
1976
- cfg: params.cfg,
1977
- accountId: params.ctx.AccountId
1978
- }));
1979
- }
1980
- function createMediaAttachmentCache(attachments, options) {
1981
- return new MediaAttachmentCache(attachments, options);
1982
- }
1983
- const binaryCache = /* @__PURE__ */ new Map();
1984
- const geminiProbeCache = /* @__PURE__ */ new Map();
1985
- function expandHomeDir(value) {
1986
- if (!value.startsWith("~")) return value;
1987
- const home = os.homedir();
1988
- if (value === "~") return home;
1989
- if (value.startsWith("~/")) return path.join(home, value.slice(2));
1990
- return value;
1991
- }
1992
- function hasPathSeparator(value) {
1993
- return value.includes("/") || value.includes("\\");
1994
- }
1995
- function candidateBinaryNames(name) {
1996
- if (process.platform !== "win32") return [name];
1997
- if (path.extname(name)) return [name];
1998
- const pathext = (process.env.PATHEXT ?? ".EXE;.CMD;.BAT;.COM").split(";").map((item) => item.trim()).filter(Boolean).map((item) => item.startsWith(".") ? item : `.${item}`);
1999
- return [name, ...Array.from(new Set(pathext)).map((item) => `${name}${item}`)];
2000
- }
2001
- async function isExecutable(filePath) {
2002
- try {
2003
- if (!(await fs$1.stat(filePath)).isFile()) return false;
2004
- if (process.platform === "win32") return true;
2005
- await fs$1.access(filePath, constants.X_OK);
2006
- return true;
2007
- } catch {
2008
- return false;
2009
- }
2010
- }
2011
- async function findBinary(name) {
2012
- const cached = binaryCache.get(name);
2013
- if (cached) return cached;
2014
- const resolved = (async () => {
2015
- const direct = expandHomeDir(name.trim());
2016
- if (direct && hasPathSeparator(direct)) {
2017
- for (const candidate of candidateBinaryNames(direct)) if (await isExecutable(candidate)) return candidate;
2018
- }
2019
- const searchName = name.trim();
2020
- if (!searchName) return null;
2021
- const pathEntries = (process.env.PATH ?? "").split(path.delimiter);
2022
- const candidates = candidateBinaryNames(searchName);
2023
- for (const entryRaw of pathEntries) {
2024
- const entry = expandHomeDir(entryRaw.trim().replace(/^"(.*)"$/, "$1"));
2025
- if (!entry) continue;
2026
- for (const candidate of candidates) {
2027
- const fullPath = path.join(entry, candidate);
2028
- if (await isExecutable(fullPath)) return fullPath;
2029
- }
2030
- }
2031
- return null;
2032
- })();
2033
- binaryCache.set(name, resolved);
2034
- return resolved;
2035
- }
2036
- async function hasBinary(name) {
2037
- return Boolean(await findBinary(name));
2038
- }
2039
- async function probeGeminiCli() {
2040
- const cached = geminiProbeCache.get("gemini");
2041
- if (cached) return cached;
2042
- const resolved = (async () => {
2043
- if (!await hasBinary("gemini")) return false;
2044
- try {
2045
- const { stdout } = await runExec("gemini", [
2046
- "--output-format",
2047
- "json",
2048
- "ok"
2049
- ], { timeoutMs: 8e3 });
2050
- return Boolean(extractGeminiResponse(stdout) ?? stdout.toLowerCase().includes("ok"));
2051
- } catch {
2052
- return false;
2053
- }
2054
- })();
2055
- geminiProbeCache.set("gemini", resolved);
2056
- return resolved;
2057
- }
2058
- async function resolveLocalWhisperCppEntry() {
2059
- if (!await hasBinary("whisper-cli")) return null;
2060
- const envModel = process.env.WHISPER_CPP_MODEL?.trim();
2061
- const modelPath = envModel && await fileExists(envModel) ? envModel : "/opt/homebrew/share/whisper-cpp/for-tests-ggml-tiny.bin";
2062
- if (!await fileExists(modelPath)) return null;
2063
- return {
2064
- type: "cli",
2065
- command: "whisper-cli",
2066
- args: [
2067
- "-m",
2068
- modelPath,
2069
- "-otxt",
2070
- "-of",
2071
- "{{OutputBase}}",
2072
- "-np",
2073
- "-nt",
2074
- "{{MediaPath}}"
2075
- ]
2076
- };
2077
- }
2078
- async function resolveLocalWhisperEntry() {
2079
- if (!await hasBinary("whisper")) return null;
2080
- return {
2081
- type: "cli",
2082
- command: "whisper",
2083
- args: [
2084
- "--model",
2085
- "turbo",
2086
- "--output_format",
2087
- "txt",
2088
- "--output_dir",
2089
- "{{OutputDir}}",
2090
- "--verbose",
2091
- "False",
2092
- "{{MediaPath}}"
2093
- ]
2094
- };
2095
- }
2096
- async function resolveSherpaOnnxEntry() {
2097
- if (!await hasBinary("sherpa-onnx-offline")) return null;
2098
- const modelDir = process.env.SHERPA_ONNX_MODEL_DIR?.trim();
2099
- if (!modelDir) return null;
2100
- const tokens = path.join(modelDir, "tokens.txt");
2101
- const encoder = path.join(modelDir, "encoder.onnx");
2102
- const decoder = path.join(modelDir, "decoder.onnx");
2103
- const joiner = path.join(modelDir, "joiner.onnx");
2104
- if (!await fileExists(tokens)) return null;
2105
- if (!await fileExists(encoder)) return null;
2106
- if (!await fileExists(decoder)) return null;
2107
- if (!await fileExists(joiner)) return null;
2108
- return {
2109
- type: "cli",
2110
- command: "sherpa-onnx-offline",
2111
- args: [
2112
- `--tokens=${tokens}`,
2113
- `--encoder=${encoder}`,
2114
- `--decoder=${decoder}`,
2115
- `--joiner=${joiner}`,
2116
- "{{MediaPath}}"
2117
- ]
2118
- };
2119
- }
2120
- async function resolveLocalAudioEntry() {
2121
- const sherpa = await resolveSherpaOnnxEntry();
2122
- if (sherpa) return sherpa;
2123
- const whisperCpp = await resolveLocalWhisperCppEntry();
2124
- if (whisperCpp) return whisperCpp;
2125
- return await resolveLocalWhisperEntry();
2126
- }
2127
- async function resolveGeminiCliEntry(_capability) {
2128
- if (!await probeGeminiCli()) return null;
2129
- return {
2130
- type: "cli",
2131
- command: "gemini",
2132
- args: [
2133
- "--output-format",
2134
- "json",
2135
- "--allowed-tools",
2136
- "read_many_files",
2137
- "--include-directories",
2138
- "{{MediaDir}}",
2139
- "{{Prompt}}",
2140
- "Use read_many_files to read {{MediaPath}} and respond with only the text output."
2141
- ]
2142
- };
2143
- }
2144
- async function resolveKeyEntry(params) {
2145
- const { cfg, providerRegistry, capability } = params;
2146
- const checkProvider = async (providerId, model) => {
2147
- const provider = getMediaUnderstandingProvider(providerId, providerRegistry);
2148
- if (!provider) return null;
2149
- if (capability === "audio" && !provider.transcribeAudio) return null;
2150
- if (capability === "video" && !provider.describeVideo) return null;
2151
- try {
2152
- await resolveApiKeyForProvider({
2153
- provider: providerId,
2154
- cfg
2155
- });
2156
- return {
2157
- type: "provider",
2158
- provider: providerId,
2159
- model
2160
- };
2161
- } catch {
2162
- return null;
2163
- }
2164
- };
2165
- if (capability === "video") {
2166
- const activeProvider = params.activeModel?.provider?.trim();
2167
- if (activeProvider) {
2168
- const activeEntry = await checkProvider(activeProvider, params.activeModel?.model);
2169
- if (activeEntry) return activeEntry;
2170
- }
2171
- for (const providerId of AUTO_VIDEO_KEY_PROVIDERS) {
2172
- const entry = await checkProvider(providerId, void 0);
2173
- if (entry) return entry;
2174
- }
2175
- return null;
2176
- }
2177
- const activeProvider = params.activeModel?.provider?.trim();
2178
- if (activeProvider) {
2179
- const activeEntry = await checkProvider(activeProvider, params.activeModel?.model);
2180
- if (activeEntry) return activeEntry;
2181
- }
2182
- for (const providerId of AUTO_AUDIO_KEY_PROVIDERS) {
2183
- const entry = await checkProvider(providerId, void 0);
2184
- if (entry) return entry;
2185
- }
2186
- return null;
2187
- }
2188
- async function resolveAutoEntries(params) {
2189
- const activeEntry = await resolveActiveModelEntry(params);
2190
- if (activeEntry) return [activeEntry];
2191
- if (params.capability === "audio") {
2192
- const localAudio = await resolveLocalAudioEntry();
2193
- if (localAudio) return [localAudio];
2194
- }
2195
- const gemini = await resolveGeminiCliEntry(params.capability);
2196
- if (gemini) return [gemini];
2197
- const keys = await resolveKeyEntry(params);
2198
- if (keys) return [keys];
2199
- return [];
2200
- }
2201
- async function resolveActiveModelEntry(params) {
2202
- const activeProviderRaw = params.activeModel?.provider?.trim();
2203
- if (!activeProviderRaw) return null;
2204
- const providerId = normalizeMediaProviderId(activeProviderRaw);
2205
- if (!providerId) return null;
2206
- const provider = getMediaUnderstandingProvider(providerId, params.providerRegistry);
2207
- if (!provider) return null;
2208
- if (params.capability === "audio" && !provider.transcribeAudio) return null;
2209
- if (params.capability === "video" && !provider.describeVideo) return null;
2210
- try {
2211
- await resolveApiKeyForProvider({
2212
- provider: providerId,
2213
- cfg: params.cfg
2214
- });
2215
- } catch {
2216
- return null;
2217
- }
2218
- return {
2219
- type: "provider",
2220
- provider: providerId,
2221
- model: params.activeModel?.model
2222
- };
2223
- }
2224
- async function runAttachmentEntries(params) {
2225
- const { entries, capability } = params;
2226
- const attempts = [];
2227
- for (const entry of entries) {
2228
- const entryType = entry.type ?? (entry.command ? "cli" : "provider");
2229
- try {
2230
- const result = entryType === "cli" ? await runCliEntry({
2231
- capability,
2232
- entry,
2233
- cfg: params.cfg,
2234
- ctx: params.ctx,
2235
- attachmentIndex: params.attachmentIndex,
2236
- cache: params.cache,
2237
- config: params.config
2238
- }) : await runProviderEntry({
2239
- capability,
2240
- entry,
2241
- cfg: params.cfg,
2242
- ctx: params.ctx,
2243
- attachmentIndex: params.attachmentIndex,
2244
- cache: params.cache,
2245
- agentDir: params.agentDir,
2246
- providerRegistry: params.providerRegistry,
2247
- config: params.config
2248
- });
2249
- if (result) {
2250
- const decision = buildModelDecision({
2251
- entry,
2252
- entryType,
2253
- outcome: "success"
2254
- });
2255
- if (result.provider) decision.provider = result.provider;
2256
- if (result.model) decision.model = result.model;
2257
- attempts.push(decision);
2258
- return {
2259
- output: result,
2260
- attempts
2261
- };
2262
- }
2263
- attempts.push(buildModelDecision({
2264
- entry,
2265
- entryType,
2266
- outcome: "skipped",
2267
- reason: "empty output"
2268
- }));
2269
- } catch (err) {
2270
- if (isMediaUnderstandingSkipError(err)) {
2271
- attempts.push(buildModelDecision({
2272
- entry,
2273
- entryType,
2274
- outcome: "skipped",
2275
- reason: `${err.reason}: ${err.message}`
2276
- }));
2277
- if (shouldLogVerbose()) logVerbose(`Skipping ${capability} model due to ${err.reason}: ${err.message}`);
2278
- continue;
2279
- }
2280
- attempts.push(buildModelDecision({
2281
- entry,
2282
- entryType,
2283
- outcome: "failed",
2284
- reason: String(err)
2285
- }));
2286
- if (shouldLogVerbose()) logVerbose(`${capability} understanding failed: ${String(err)}`);
2287
- }
2288
- }
2289
- return {
2290
- output: null,
2291
- attempts
2292
- };
2293
- }
2294
- async function runCapability(params) {
2295
- const { capability, cfg, ctx } = params;
2296
- const config = params.config ?? cfg.tools?.media?.[capability];
2297
- if (config?.enabled === false) return {
2298
- outputs: [],
2299
- decision: {
2300
- capability,
2301
- outcome: "disabled",
2302
- attachments: []
2303
- }
2304
- };
2305
- const attachmentPolicy = config?.attachments;
2306
- const selected = selectAttachments({
2307
- capability,
2308
- attachments: params.media,
2309
- policy: attachmentPolicy
2310
- });
2311
- if (selected.length === 0) return {
2312
- outputs: [],
2313
- decision: {
2314
- capability,
2315
- outcome: "no-attachment",
2316
- attachments: []
2317
- }
2318
- };
2319
- if (resolveScopeDecision({
2320
- scope: config?.scope,
2321
- ctx
2322
- }) === "deny") {
2323
- if (shouldLogVerbose()) logVerbose(`${capability} understanding disabled by scope policy.`);
2324
- return {
2325
- outputs: [],
2326
- decision: {
2327
- capability,
2328
- outcome: "scope-deny",
2329
- attachments: selected.map((item) => ({
2330
- attachmentIndex: item.index,
2331
- attempts: []
2332
- }))
2333
- }
2334
- };
2335
- }
2336
- let resolvedEntries = resolveModelEntries({
2337
- cfg,
2338
- capability,
2339
- config,
2340
- providerRegistry: params.providerRegistry
2341
- });
2342
- if (resolvedEntries.length === 0) resolvedEntries = await resolveAutoEntries({
2343
- cfg,
2344
- agentDir: params.agentDir,
2345
- providerRegistry: params.providerRegistry,
2346
- capability,
2347
- activeModel: params.activeModel
2348
- });
2349
- if (resolvedEntries.length === 0) return {
2350
- outputs: [],
2351
- decision: {
2352
- capability,
2353
- outcome: "skipped",
2354
- attachments: selected.map((item) => ({
2355
- attachmentIndex: item.index,
2356
- attempts: []
2357
- }))
2358
- }
2359
- };
2360
- const outputs = [];
2361
- const attachmentDecisions = [];
2362
- for (const attachment of selected) {
2363
- const { output, attempts } = await runAttachmentEntries({
2364
- capability,
2365
- cfg,
2366
- ctx,
2367
- attachmentIndex: attachment.index,
2368
- agentDir: params.agentDir,
2369
- providerRegistry: params.providerRegistry,
2370
- cache: params.attachments,
2371
- entries: resolvedEntries,
2372
- config
2373
- });
2374
- if (output) outputs.push(output);
2375
- attachmentDecisions.push({
2376
- attachmentIndex: attachment.index,
2377
- attempts,
2378
- chosen: attempts.find((attempt) => attempt.outcome === "success")
2379
- });
2380
- }
2381
- const decision = {
2382
- capability,
2383
- outcome: outputs.length > 0 ? "success" : "skipped",
2384
- attachments: attachmentDecisions
2385
- };
2386
- if (shouldLogVerbose()) logVerbose(`Media understanding ${formatDecisionSummary(decision)}`);
2387
- return {
2388
- outputs,
2389
- decision
2390
- };
2391
- }
2392
-
2393
- //#endregion
2394
- export { resolveMediaUnderstandingScope as _, runCapability as a, applyTemplate as b, resolveModelAuthMode as c, buildRandomTempFilePath as d, installUnhandledRejectionHandler as f, normalizeMediaUnderstandingChatType as g, resolveTimeoutMs as h, resolveMediaAttachmentLocalRoots as i, isAudioAttachment as l, resolveConcurrency as m, createMediaAttachmentCache as n, resolveApiKeyForProvider as o, registerUnhandledRejectionHandler as p, normalizeMediaAttachments as r, resolveModelAuthLabel as s, buildProviderRegistry as t, resolveAttachmentKind as u, CLI_OUTPUT_MAX_BUFFER as v, AUTO_AUDIO_KEY_PROVIDERS as y };