remoteclaw 0.1.0-next.b9d22ea → 0.1.0-next.bf16d82

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 (1103) hide show
  1. package/README.md +9 -7
  2. package/dist/accounts-Aqbb2_Fn.js +270 -0
  3. package/dist/accounts-Bo2bX8jP.js +272 -0
  4. package/dist/accounts-CM9-wQiO.js +32 -0
  5. package/dist/accounts-D3fAPVzU.js +36 -0
  6. package/dist/accounts-DZmv4bXS.js +47 -0
  7. package/dist/accounts-DmB4SVPK.js +47 -0
  8. package/dist/accounts-DtkyfvwR.js +36 -0
  9. package/dist/ack-reactions-BpScrBGW.js +446 -0
  10. package/dist/ack-reactions-Dzzngl4O.js +446 -0
  11. package/dist/acp-cli-DVXhDMc6.js +1324 -0
  12. package/dist/acp-cli-QBL4_qcW.js +1319 -0
  13. package/dist/active-listener-CwxZ24bZ.js +37 -0
  14. package/dist/active-listener-v2sItamh.js +37 -0
  15. package/dist/agent-BDLAlLCL.js +704 -0
  16. package/dist/agent-BLF0q7z7.js +703 -0
  17. package/dist/agent-helpers-BSGqeJr-.js +400 -0
  18. package/dist/agent-helpers-eEHy5uX2.js +400 -0
  19. package/dist/agent-scope-CJW7vnF8.js +114 -0
  20. package/dist/agent-scope-_ND_-bJy.js +116 -0
  21. package/dist/agents-CL3NO8AU.js +760 -0
  22. package/dist/agents.config-BPIAuyp2.js +116 -0
  23. package/dist/agents.config-H06b2bwI.js +116 -0
  24. package/dist/ansi-DtaiOnt1.js +107 -0
  25. package/dist/audio-BIvUsncf.js +43 -0
  26. package/dist/audio-CQ8TfmVN.js +43 -0
  27. package/dist/audit-BK7HInSG.js +3150 -0
  28. package/dist/audit-DEXNUeWm.js +3150 -0
  29. package/dist/auth-DGqCLaQq.js +448 -0
  30. package/dist/auth-DLTRySEi.js +314 -0
  31. package/dist/auth-Drf91ntw.js +315 -0
  32. package/dist/auth-ku2khJyQ.js +448 -0
  33. package/dist/banner-V89c8CZr.js +294 -0
  34. package/dist/binaries-BTvHIrCr.js +13 -0
  35. package/dist/bindings-Dr0bGRst.js +69 -0
  36. package/dist/bindings-DsWJQVKh.js +69 -0
  37. package/dist/bonjour-discovery-753eUdn8.js +378 -0
  38. package/dist/bonjour-discovery-Lo4oz5nx.js +378 -0
  39. package/dist/boot/handler.js +42 -69
  40. package/dist/browser-cli-DxJew43l.js +1694 -0
  41. package/dist/browser-cli-p0nakrjO.js +1690 -0
  42. package/dist/build-info.json +3 -3
  43. package/dist/call-BrTmlOx3.js +518 -0
  44. package/dist/call-ChdUdwb4.js +517 -0
  45. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  46. package/dist/catalog-DTlcfTT9.js +185 -0
  47. package/dist/catalog-PixZqhZK.js +185 -0
  48. package/dist/channel-account-context-BM7ekXJw.js +133 -0
  49. package/dist/channel-account-context-B_CTilep.js +133 -0
  50. package/dist/channel-activity-C-L6rDrQ.js +94 -0
  51. package/dist/channel-activity-DdgLBZ7M.js +94 -0
  52. package/dist/channel-activity-hL4KZrCz.js +292 -0
  53. package/dist/channel-options-DDJfZ19-.js +33 -0
  54. package/dist/channel-options-DPgNXhhg.js +32 -0
  55. package/dist/channel-selection-Ba3RY1Ao.js +51 -0
  56. package/dist/channel-selection-DW21dXB1.js +51 -0
  57. package/dist/channel-web-BsdEYRcn.js +2136 -0
  58. package/dist/channel-web-DrEUZh4c.js +2134 -0
  59. package/dist/channels-cli-D1Hg7OoJ.js +1429 -0
  60. package/dist/channels-cli-DYdSWyJS.js +1425 -0
  61. package/dist/channels-status-issues-Chzsa1R2.js +18 -0
  62. package/dist/channels-status-issues-dszAk26n.js +18 -0
  63. package/dist/chat-envelope-BIujl9Cj.js +248 -0
  64. package/dist/chat-envelope-CrM0X4sl.js +248 -0
  65. package/dist/chrome-Dqtq7zCc.js +1733 -0
  66. package/dist/chrome-XeSY99Z_.js +1732 -0
  67. package/dist/chunk-CWD_zrz_.js +341 -0
  68. package/dist/chunk-LUabyS9k.js +341 -0
  69. package/dist/clack-prompter-BhtlKYaz.js +122 -0
  70. package/dist/clack-prompter-Ds_jQwRg.js +121 -0
  71. package/dist/cli/daemon-cli.js +1 -1
  72. package/dist/cli-B7AOUqP7.js +133 -0
  73. package/dist/cli-Cf0q1XPt.js +129 -0
  74. package/dist/client-B9u3JdT_.js +2316 -0
  75. package/dist/client-DEEOhx0w.js +2316 -0
  76. package/dist/clipboard-B2nstLx7.js +31 -0
  77. package/dist/clipboard-C8QI9fes.js +31 -0
  78. package/dist/command-format-D0vKipG9.js +32 -0
  79. package/dist/command-format-LFmgWzKJ.js +18 -0
  80. package/dist/command-logger/handler.js +1 -1
  81. package/dist/command-registry-G0iFZSsB.js +215 -0
  82. package/dist/commands-BAYwlS3d.js +41 -0
  83. package/dist/commands-D842kCjj.js +41 -0
  84. package/dist/commands-registry-Cg2GTT2J.js +892 -0
  85. package/dist/commands-registry-Yz-uV5oG.js +891 -0
  86. package/dist/common-B67cBSew.js +156 -0
  87. package/dist/common-DEoiTqOr.js +156 -0
  88. package/dist/completion-cli-CsnRuzKE.js +452 -0
  89. package/dist/completion-cli-up_dylJo.js +452 -0
  90. package/dist/config-CAa0rZSx.js +4225 -0
  91. package/dist/config-W0w-gi2j.js +4223 -0
  92. package/dist/config-cli-B3ZJv_rA.js +247 -0
  93. package/dist/config-cli-Bw9dMm2_.js +243 -0
  94. package/dist/config-guard-BB8ZCtG2.js +75 -0
  95. package/dist/config-guard-BGDrhmVw.js +99 -0
  96. package/dist/config-validation-BRV8Dwlm.js +18 -0
  97. package/dist/config-validation-CgLT7yOT.js +18 -0
  98. package/dist/configure-9Z1a-62u.js +889 -0
  99. package/dist/configure-B8GTAFVp.js +891 -0
  100. package/dist/constants-BAZuhSRm.js +75 -0
  101. package/dist/constants-BBVTjb1j.js +75 -0
  102. package/dist/control-auth-BrBr2xb8.js +397 -0
  103. package/dist/control-auth-CehjYKnL.js +397 -0
  104. package/dist/control-ui/assets/index-DdiU_ccM.css +1 -0
  105. package/dist/control-ui/assets/index-kVUYi64u.js +7723 -0
  106. package/dist/control-ui/assets/index-kVUYi64u.js.map +1 -0
  107. package/dist/control-ui/index.html +2 -2
  108. package/dist/control-ui-assets-BhJwfkgT.js +186 -0
  109. package/dist/control-ui-assets-DEQuKyme.js +186 -0
  110. package/dist/conversation-label-Bn5j3lUT.js +36 -0
  111. package/dist/conversation-label-CDH4rKMG.js +36 -0
  112. package/dist/cron-cli-Be9JgLb2.js +498 -0
  113. package/dist/cron-cli-DkXVZaCq.js +494 -0
  114. package/dist/daemon-cli-CIoKNZvF.js +735 -0
  115. package/dist/daemon-cli-niV5fzD4.js +737 -0
  116. package/dist/daemon-cli.js +36 -83
  117. package/dist/daemon-install-1ynjvFZL.js +56 -0
  118. package/dist/daemon-install-C8IcQYs1.js +60 -0
  119. package/dist/daemon-install-helpers-CfcKL7QX.js +504 -0
  120. package/dist/daemon-install-helpers-DzVSXu0U.js +504 -0
  121. package/dist/deliver-CDcL8ok6.js +481 -0
  122. package/dist/deliver-xpNcxpb6.js +481 -0
  123. package/dist/delivery-queue-33Q7Kk2m.js +244 -0
  124. package/dist/delivery-queue-CTaYZQ_8.js +244 -0
  125. package/dist/devices-cli-BKKwdow_.js +319 -0
  126. package/dist/devices-cli-ChY_hDCH.js +323 -0
  127. package/dist/diagnostics-DRGjLipf.js +35 -0
  128. package/dist/diagnostics-DeuGkI5l.js +35 -0
  129. package/dist/directory-cli-1GNpcNre.js +224 -0
  130. package/dist/directory-cli-CdlTrGda.js +220 -0
  131. package/dist/dispatcher-BMmzjWPB.js +174 -0
  132. package/dist/dispatcher-WqL89TYp.js +173 -0
  133. package/dist/dm-policy-shared-n9ISCHRR.js +22 -0
  134. package/dist/dm-policy-shared-rngrU9Sh.js +22 -0
  135. package/dist/dns-cli-Dih_PCz2.js +203 -0
  136. package/dist/dns-cli-mGfvT-X2.js +199 -0
  137. package/dist/dock-Big-J2VN.js +929 -0
  138. package/dist/dock-Cj4PKiUh.js +928 -0
  139. package/dist/doctor-completion-Bg4iXpHR.js +92 -0
  140. package/dist/doctor-completion-x0A_9Rp_.js +92 -0
  141. package/dist/doctor-config-flow-CP28w1Gp.js +1935 -0
  142. package/dist/doctor-config-flow-C_HMyUfr.js +1934 -0
  143. package/dist/enable-Bnnd9rJQ.js +59 -0
  144. package/dist/enable-DeRa_Dwn.js +59 -0
  145. package/dist/entry.js +1 -3
  146. package/dist/env-B3zr72vQ.js +60 -0
  147. package/dist/env-vars-CD2_baIP.js +43 -0
  148. package/dist/env-vars-a7S70ba7.js +43 -0
  149. package/dist/errors-CdmXrBic.js +35 -0
  150. package/dist/errors-Cr_NbOb4.js +35 -0
  151. package/dist/exec-D_s-zAtY.js +164 -0
  152. package/dist/exec-Zz6eJ6YU.js +164 -0
  153. package/dist/export-html/template.css +0 -36
  154. package/dist/export-html/template.js +1 -32
  155. package/dist/extensionAPI.js +1126 -133
  156. package/dist/fetch-C0Kt-OTD.js +67 -0
  157. package/dist/fetch-DRVdxxEj.js +67 -0
  158. package/dist/fetch-DTR2MlOk.js +67 -0
  159. package/dist/file-lock-6NXMPZTT.js +107 -0
  160. package/dist/file-lock-C_KRlR7M.js +107 -0
  161. package/dist/fs-safe-DZHpH7TI.js +98 -0
  162. package/dist/fs-safe-vm3JMUkq.js +88 -0
  163. package/dist/gateway-cli-CNBEuTi7.js +24347 -0
  164. package/dist/gateway-cli-D8h_MX6P.js +24351 -0
  165. package/dist/gateway-rpc-BCFkQPa2.js +28 -0
  166. package/dist/gateway-rpc-DOgYbsOG.js +28 -0
  167. package/dist/gmail-setup-utils-CaCw59UH.js +423 -0
  168. package/dist/gmail-setup-utils-Esi4W52F.js +422 -0
  169. package/dist/health-CBusRcqc.js +1417 -0
  170. package/dist/health-QDyYt942.js +1414 -0
  171. package/dist/heartbeat-visibility-BjkWJxq6.js +125 -0
  172. package/dist/heartbeat-visibility-Cg_NtXtE.js +125 -0
  173. package/dist/helpers-CGZx9FJd.js +10 -0
  174. package/dist/helpers-b1jzdNE7.js +10 -0
  175. package/dist/hook-runner-global-C0DFQmQw.js +527 -0
  176. package/dist/hooks-cli-Dx9gOIX8.js +1225 -0
  177. package/dist/hooks-cli-K-N__uX4.js +1221 -0
  178. package/dist/host-env-security-BGibnCbS.js +106 -0
  179. package/dist/host-env-security-axRnIi8d.js +106 -0
  180. package/dist/image-ops-B9ofmzSq.js +354 -0
  181. package/dist/image-ops-CMuvRsMY.js +354 -0
  182. package/dist/import-CeK_fKST.js +604 -0
  183. package/dist/import-DMBcRq13.js +606 -0
  184. package/dist/inbound-context-BLy-G2Eq.js +68 -0
  185. package/dist/inbound-context-CmmmT8IP.js +68 -0
  186. package/dist/inbound-path-policy-BdmTOUka.js +90 -0
  187. package/dist/inbound-path-policy-BurOAu44.js +90 -0
  188. package/dist/index.js +106 -103
  189. package/dist/inspect-BK1tKJHb.js +286 -0
  190. package/dist/inspect-DBREkI_G.js +286 -0
  191. package/dist/installs-BYABRozP.js +325 -0
  192. package/dist/installs-CoZboJSz.js +325 -0
  193. package/dist/ipv4-B7xPGk8R.js +46 -0
  194. package/dist/ipv4-Y373I4Sy.js +46 -0
  195. package/dist/ir-CaxTklDC.js +940 -0
  196. package/dist/json-files-CfhnuGaC.js +46 -0
  197. package/dist/lifecycle-core-BiImPUqN.js +474 -0
  198. package/dist/lifecycle-core-DhR4-w4Q.js +476 -0
  199. package/dist/loader-DCBZ8gN2.js +22401 -0
  200. package/dist/loader-Dd7Cl24B.js +22404 -0
  201. package/dist/local-roots-CrJ_Jv_G.js +314 -0
  202. package/dist/local-roots-n_Y4iYwb.js +313 -0
  203. package/dist/logger-B8yHnzPl.js +49 -0
  204. package/dist/logging-BiuZwq5D.js +1 -0
  205. package/dist/logging-JZEg5nDp.js +1 -0
  206. package/dist/login-C99fsB0N.js +61 -0
  207. package/dist/login-cLvGPjeO.js +62 -0
  208. package/dist/login-qr-BAq-OGnv.js +325 -0
  209. package/dist/login-qr-BH1GPRt0.js +329 -0
  210. package/dist/logs-cli-CukoNyQ2.js +240 -0
  211. package/dist/logs-cli-D7GEvBIc.js +236 -0
  212. package/dist/markdown-tables-58Hq__7K.js +29 -0
  213. package/dist/markdown-tables-GFEX0OR6.js +29 -0
  214. package/dist/media-Bj2S2t91.js +10452 -0
  215. package/dist/media-CFsyXs3H.js +940 -0
  216. package/dist/message-action-names-CFl6mreB.js +2521 -0
  217. package/dist/message-action-names-DngGaJR0.js +2521 -0
  218. package/dist/message-channel-FMNRI5Ax.js +91 -0
  219. package/dist/message-channel-tuc9CdEw.js +91 -0
  220. package/dist/net-BEFkF-nI.js +225 -0
  221. package/dist/net-CNsUGiSw.js +225 -0
  222. package/dist/node-cli-BNnJAzRx.js +1458 -0
  223. package/dist/node-cli-pCw87J46.js +1462 -0
  224. package/dist/node-service-DJRZflx8.js +67 -0
  225. package/dist/node-service-GmW3_BfS.js +67 -0
  226. package/dist/nodes-cli-CIAUxdc0.js +1350 -0
  227. package/dist/nodes-cli-TzMjNiS1.js +1346 -0
  228. package/dist/nodes-screen-CFQjs8MT.js +250 -0
  229. package/dist/nodes-screen-DWZW8GM2.js +250 -0
  230. package/dist/note-BDIews1m.js +92 -0
  231. package/dist/note-Nm8KaHZU.js +92 -0
  232. package/dist/npm-registry-spec-BvfH5h_W.js +786 -0
  233. package/dist/npm-registry-spec-JNJIF0sj.js +786 -0
  234. package/dist/npm-resolution-BKF5UOfb.js +86 -0
  235. package/dist/npm-resolution-CbILViog.js +86 -0
  236. package/dist/onboard-CRbh4DgN.js +436 -0
  237. package/dist/onboard-IWFW8JdN.js +438 -0
  238. package/dist/onboard-channels-D6QHtbux.js +2547 -0
  239. package/dist/onboard-channels-ZfIB3AQ7.js +2548 -0
  240. package/dist/onboard-helpers-CpaqhBRc.js +363 -0
  241. package/dist/onboard-helpers-SCO3k5Y8.js +364 -0
  242. package/dist/onboard-remote-BuNPRJ5F.js +127 -0
  243. package/dist/onboard-remote-qen5mdEh.js +127 -0
  244. package/dist/onboarding-Bfrfm9h3.js +586 -0
  245. package/dist/onboarding-BwamheyW.js +588 -0
  246. package/dist/onboarding.finalize-DmQVHUeh.js +402 -0
  247. package/dist/onboarding.finalize-OhTirY4S.js +404 -0
  248. package/dist/onboarding.gateway-config-Bnhzp671.js +201 -0
  249. package/dist/onboarding.gateway-config-CrAPZ-KT.js +195 -0
  250. package/dist/outbound-CcaPcetn.js +220 -0
  251. package/dist/outbound-CeiW8z3a.js +221 -0
  252. package/dist/outbound-attachment-BXV5BWfH.js +18 -0
  253. package/dist/outbound-attachment-Ba4U62Y0.js +18 -0
  254. package/dist/outbound-attachment-CZ7zoYxB.js +18 -0
  255. package/dist/pairing-cli-Cfas8mtn.js +125 -0
  256. package/dist/pairing-cli-DPYlR__9.js +129 -0
  257. package/dist/pairing-labels-3wDxaApH.js +9 -0
  258. package/dist/pairing-labels-iJmT0otM.js +9 -0
  259. package/dist/pairing-store-CdY7iRS0.js +459 -0
  260. package/dist/pairing-store-DykkYpQ7.js +460 -0
  261. package/dist/path-env-Cqo5LZmw.js +89 -0
  262. package/dist/path-env-GTM4HXCN.js +89 -0
  263. package/dist/path-safety-Cp7nWVMJ.js +14 -0
  264. package/dist/path-safety-Dtu7zu8V.js +14 -0
  265. package/dist/plugin-auto-enable-BuGRHS7-.js +301 -0
  266. package/dist/plugin-auto-enable-CLfBNuVK.js +302 -0
  267. package/dist/plugin-registry-DEp-56qo.js +33 -0
  268. package/dist/plugin-registry-eDrBvMCH.js +33 -0
  269. package/dist/plugin-sdk/agents/agent-helpers.d.ts +0 -1
  270. package/dist/plugin-sdk/agents/agent-scope.d.ts +10 -0
  271. package/dist/plugin-sdk/agents/agent-types.d.ts +1 -6
  272. package/dist/plugin-sdk/agents/agent-utils.d.ts +0 -14
  273. package/dist/plugin-sdk/agents/provider-utils.d.ts +0 -1
  274. package/dist/plugin-sdk/agents/subagent-spawn.d.ts +0 -1
  275. package/dist/plugin-sdk/agents/tools/sessions-helpers.d.ts +0 -1
  276. package/dist/plugin-sdk/auth/constants.d.ts +15 -0
  277. package/dist/plugin-sdk/auth/display.d.ts +7 -0
  278. package/dist/plugin-sdk/auth/doctor.d.ts +8 -0
  279. package/dist/plugin-sdk/auth/env-injection.d.ts +38 -0
  280. package/dist/plugin-sdk/auth/index.d.ts +10 -0
  281. package/dist/plugin-sdk/auth/oauth.d.ts +13 -0
  282. package/dist/plugin-sdk/auth/order.d.ts +8 -0
  283. package/dist/plugin-sdk/auth/paths.d.ts +3 -0
  284. package/dist/plugin-sdk/auth/profiles.d.ts +11 -0
  285. package/dist/plugin-sdk/auth/provider-auth.d.ts +38 -0
  286. package/dist/plugin-sdk/auth/session-override.d.ts +17 -0
  287. package/dist/plugin-sdk/auth/store.d.ts +7 -0
  288. package/dist/plugin-sdk/auth/types.d.ts +45 -0
  289. package/dist/plugin-sdk/auth/usage.d.ts +80 -0
  290. package/dist/plugin-sdk/auto-reply/reply/agent-runner-execution.d.ts +0 -1
  291. package/dist/plugin-sdk/auto-reply/reply/agent-runner-utils.d.ts +0 -2
  292. package/dist/plugin-sdk/auto-reply/reply/commands-status.d.ts +1 -4
  293. package/dist/plugin-sdk/auto-reply/reply/commands-types.d.ts +1 -4
  294. package/dist/plugin-sdk/auto-reply/reply/directive-handling.auth.d.ts +1 -2
  295. package/dist/plugin-sdk/auto-reply/reply/directive-handling.levels.d.ts +1 -7
  296. package/dist/plugin-sdk/auto-reply/reply/directive-handling.params.d.ts +1 -4
  297. package/dist/plugin-sdk/auto-reply/reply/directive-handling.parse.d.ts +1 -7
  298. package/dist/plugin-sdk/auto-reply/reply/directive-handling.persist.d.ts +0 -1
  299. package/dist/plugin-sdk/auto-reply/reply/directive-handling.shared.d.ts +1 -4
  300. package/dist/plugin-sdk/auto-reply/reply/directives.d.ts +3 -15
  301. package/dist/plugin-sdk/auto-reply/reply/get-reply-directives-apply.d.ts +0 -1
  302. package/dist/plugin-sdk/auto-reply/reply/get-reply-directives.d.ts +1 -6
  303. package/dist/plugin-sdk/auto-reply/reply/get-reply-inline-actions.d.ts +1 -5
  304. package/dist/plugin-sdk/auto-reply/reply/get-reply-run.d.ts +1 -5
  305. package/dist/plugin-sdk/auto-reply/reply/queue/types.d.ts +1 -3
  306. package/dist/plugin-sdk/auto-reply/reply/response-prefix-template.d.ts +4 -6
  307. package/dist/plugin-sdk/auto-reply/reply/session-run-accounting.d.ts +0 -7
  308. package/dist/plugin-sdk/auto-reply/reply/session-updates.d.ts +0 -10
  309. package/dist/plugin-sdk/auto-reply/reply.d.ts +1 -1
  310. package/dist/plugin-sdk/auto-reply/status.d.ts +3 -7
  311. package/dist/plugin-sdk/auto-reply/thinking.d.ts +0 -11
  312. package/dist/plugin-sdk/auto-reply/types.d.ts +1 -2
  313. package/dist/plugin-sdk/commands/agent/session.d.ts +1 -2
  314. package/dist/plugin-sdk/config/defaults.d.ts +0 -1
  315. package/dist/plugin-sdk/config/sessions/types.d.ts +0 -8
  316. package/dist/plugin-sdk/config/types.agent-defaults.d.ts +28 -112
  317. package/dist/plugin-sdk/config/types.agents.d.ts +8 -0
  318. package/dist/plugin-sdk/config/types.messages.d.ts +1 -2
  319. package/dist/plugin-sdk/config/types.remoteclaw.d.ts +2 -2
  320. package/dist/plugin-sdk/config/zod-schema.agent-defaults.d.ts +8 -66
  321. package/dist/plugin-sdk/config/zod-schema.agent-runtime.d.ts +5 -13
  322. package/dist/plugin-sdk/config/zod-schema.agents.d.ts +11 -76
  323. package/dist/plugin-sdk/config/zod-schema.d.ts +12 -77
  324. package/dist/plugin-sdk/daemon/constants.d.ts +2 -2
  325. package/dist/plugin-sdk/gateway/protocol/index.d.ts +1 -3
  326. package/dist/plugin-sdk/gateway/protocol/schema/sessions.d.ts +0 -2
  327. package/dist/plugin-sdk/gateway/server/ws-types.d.ts +2 -0
  328. package/dist/plugin-sdk/gateway/session-utils.types.d.ts +0 -2
  329. package/dist/plugin-sdk/index.js +105 -120
  330. package/dist/plugin-sdk/infra/agent-events.d.ts +1 -1
  331. package/dist/plugin-sdk/infra/provider-usage.auth.d.ts +0 -1
  332. package/dist/plugin-sdk/infra/provider-usage.load.d.ts +0 -1
  333. package/dist/plugin-sdk/media-understanding/defaults.d.ts +1 -2
  334. package/dist/plugin-sdk/media-understanding/providers/deepgram/audio.d.ts +1 -4
  335. package/dist/plugin-sdk/media-understanding/providers/google/audio.d.ts +1 -3
  336. package/dist/plugin-sdk/media-understanding/providers/openai/audio.d.ts +1 -3
  337. package/dist/plugin-sdk/media-understanding/types.d.ts +3 -18
  338. package/dist/plugin-sdk/middleware/auth-key-retry.d.ts +31 -0
  339. package/dist/plugin-sdk/middleware/channel-bridge.d.ts +4 -0
  340. package/dist/plugin-sdk/middleware/error-classifier.d.ts +5 -0
  341. package/dist/plugin-sdk/middleware/media-capability.d.ts +21 -0
  342. package/dist/plugin-sdk/middleware/media-resolver.d.ts +12 -0
  343. package/dist/plugin-sdk/middleware/runtime-factory.d.ts +42 -0
  344. package/dist/plugin-sdk/middleware/runtimes/claude.d.ts +4 -0
  345. package/dist/plugin-sdk/middleware/runtimes/codex.d.ts +5 -0
  346. package/dist/plugin-sdk/middleware/runtimes/gemini.d.ts +4 -0
  347. package/dist/plugin-sdk/middleware/runtimes/opencode.d.ts +5 -0
  348. package/dist/plugin-sdk/middleware/types.d.ts +41 -1
  349. package/dist/plugin-sdk/plugins/types.d.ts +1 -1
  350. package/dist/plugin-sdk/stt/defaults.d.ts +2 -0
  351. package/dist/plugin-sdk/stt/preflight.d.ts +16 -0
  352. package/dist/plugin-sdk/stt/providers/deepgram/audio.d.ts +4 -0
  353. package/dist/plugin-sdk/stt/providers/deepgram/index.d.ts +2 -0
  354. package/dist/plugin-sdk/stt/providers/google/audio.d.ts +3 -0
  355. package/dist/plugin-sdk/stt/providers/google/index.d.ts +2 -0
  356. package/dist/plugin-sdk/stt/providers/groq/index.d.ts +2 -0
  357. package/dist/plugin-sdk/stt/providers/index.d.ts +4 -0
  358. package/dist/plugin-sdk/stt/providers/mistral/index.d.ts +2 -0
  359. package/dist/plugin-sdk/stt/providers/openai/audio.d.ts +3 -0
  360. package/dist/plugin-sdk/stt/providers/openai/index.d.ts +2 -0
  361. package/dist/plugin-sdk/stt/providers/shared.d.ts +1 -0
  362. package/dist/plugin-sdk/stt/stt.d.ts +27 -0
  363. package/dist/plugin-sdk/stt/types.d.ts +22 -0
  364. package/dist/plugin-sdk/tts/tts.d.ts +3 -3
  365. package/dist/plugins-7B167wIj.js +453 -0
  366. package/dist/plugins-BRHOfy1Z.js +455 -0
  367. package/dist/plugins-cli-BvRGvufE.js +797 -0
  368. package/dist/plugins-cli-aI4bjnQ4.js +801 -0
  369. package/dist/ports-CAqyeQYZ.js +316 -0
  370. package/dist/ports-CTUgXF2d.js +96 -0
  371. package/dist/ports-DLPAW42A.js +96 -0
  372. package/dist/ports-DqfnVnCw.js +370 -0
  373. package/dist/preflight-Bj0s82gR.js +64 -0
  374. package/dist/preflight-x_CMwa17.js +68 -0
  375. package/dist/program-COwy4sJS.js +248 -0
  376. package/dist/program-context-D9cxxxLY.js +474 -0
  377. package/dist/progress-BOdRbOHD.js +124 -0
  378. package/dist/prompt-select-styled-6MqsW5bZ.js +1648 -0
  379. package/dist/prompt-select-styled-uxLmoEua.js +1651 -0
  380. package/dist/provider-dispatcher-Cy2Isoz1.js +659 -0
  381. package/dist/provider-dispatcher-I3K1YmY3.js +660 -0
  382. package/dist/push-apns-KJ97wv09.js +713 -0
  383. package/dist/push-apns-NnGGNBCY.js +711 -0
  384. package/dist/pw-ai-CnN2sITD.js +1908 -0
  385. package/dist/pw-ai-fnX3cecw.js +1911 -0
  386. package/dist/qr-cli-B7LLp7Uo.js +353 -0
  387. package/dist/qr-cli-CcvOgLQ1.js +349 -0
  388. package/dist/redact-snapshot-CuSk1PiF.js +2016 -0
  389. package/dist/redact-snapshot-DsfhbREd.js +2016 -0
  390. package/dist/register.agent-B0aT5KAm.js +290 -0
  391. package/dist/register.agent-DbTAbTF7.js +1018 -0
  392. package/dist/register.configure-Bg5pK0p7.js +128 -0
  393. package/dist/register.configure-DHm-bmFr.js +133 -0
  394. package/dist/register.import-C059WtC6.js +31 -0
  395. package/dist/register.import-DHOWhJbR.js +29 -0
  396. package/dist/register.maintenance-CBdNBh2k.js +500 -0
  397. package/dist/register.maintenance-_jnyzREO.js +498 -0
  398. package/dist/register.message-BhkqTcxt.js +685 -0
  399. package/dist/register.message-CTj5j1Gh.js +689 -0
  400. package/dist/register.onboard-6RmDaVze.js +261 -0
  401. package/dist/register.onboard-DFcMuO4e.js +265 -0
  402. package/dist/register.setup-BhAJcFcx.js +117 -0
  403. package/dist/register.setup-BpQpGPcS.js +113 -0
  404. package/dist/register.status-health-sessions-BDDOQjxJ.js +668 -0
  405. package/dist/register.status-health-sessions-CqUJ7FNe.js +428 -0
  406. package/dist/register.subclis-VFXvj7dx.js +267 -0
  407. package/dist/replies-B58ewStm.js +136 -0
  408. package/dist/replies-LSx_XhsP.js +136 -0
  409. package/dist/reply-BY4A8j7Z.js +13715 -0
  410. package/dist/reply-C1ydfb_h.js +13718 -0
  411. package/dist/reply-directives-Cz7622Qx.js +182 -0
  412. package/dist/reply-directives-ssnaPNiU.js +182 -0
  413. package/dist/reply-payloads-CQMtrphw.js +527 -0
  414. package/dist/reply-prefix-CWcAZKhE.js +37 -0
  415. package/dist/reply-prefix-Drq7Pf3A.js +37 -0
  416. package/dist/resolve-route-B8uIc2H3.js +249 -0
  417. package/dist/resolve-route-C8ooNlI4.js +249 -0
  418. package/dist/response-prefix-template-D3ZcJP4E.js +134 -0
  419. package/dist/response-prefix-template-DPOggmPO.js +134 -0
  420. package/dist/retry-BMUvSHT-.js +77 -0
  421. package/dist/run-main-BwtU9LeR.js +306 -0
  422. package/dist/runner-BQat0D_4.js +2394 -0
  423. package/dist/runner-CzEWYvcp.js +2394 -0
  424. package/dist/runtime-guard-CK80eucm.js +60 -0
  425. package/dist/runtime-status-CM4rzyfO.js +12 -0
  426. package/dist/runtime-status-CcDMsddE.js +12 -0
  427. package/dist/secure-random-pF_q3xhf.js +44 -0
  428. package/dist/security-cli-CPPCeteZ.js +487 -0
  429. package/dist/security-cli-dGXRUT_F.js +482 -0
  430. package/dist/send-9Huf62k3.js +2245 -0
  431. package/dist/send-B9mIJdUo.js +547 -0
  432. package/dist/send-C7lqywdv.js +374 -0
  433. package/dist/send-CXj20hiJ.js +332 -0
  434. package/dist/send-C_RLMTgb.js +11 -0
  435. package/dist/send-Casi9Q0G.js +492 -0
  436. package/dist/send-ChvasRSh.js +1779 -0
  437. package/dist/send-CwcHjhXw.js +426 -0
  438. package/dist/send-DAEzDqyo.js +547 -0
  439. package/dist/send-DT-HD0B8.js +1776 -0
  440. package/dist/send-DWf7BCPe.js +492 -0
  441. package/dist/send-Dd2_MykI.js +2245 -0
  442. package/dist/send-DheZejq2.js +29 -0
  443. package/dist/send-Dt4C-KXH.js +349 -0
  444. package/dist/send-eIbBsLlB.js +1174 -0
  445. package/dist/send-vvZXksNU.js +349 -0
  446. package/dist/server-BrzR9JmX.js +206 -0
  447. package/dist/server-_h27-uP_.js +202 -0
  448. package/dist/server-lifecycle-CUdA6Far.js +2437 -0
  449. package/dist/server-lifecycle-DQZWL8iP.js +2437 -0
  450. package/dist/server-node-events-6XFKuq3Y.js +392 -0
  451. package/dist/server-node-events-D29jcNbz.js +396 -0
  452. package/dist/service-Z0W9IHDW.js +670 -0
  453. package/dist/service-aV0YmkBw.js +670 -0
  454. package/dist/session-BIAOl5QR.js +170 -0
  455. package/dist/session-Wu00pCn_.js +170 -0
  456. package/dist/session-cost-usage-7plmOKbs.js +627 -0
  457. package/dist/session-cost-usage-CPFxBFUg.js +627 -0
  458. package/dist/session-dirs-BLLxW3ZS.js +318 -0
  459. package/dist/session-dirs-CVihy8Ai.js +318 -0
  460. package/dist/session-utils-90yswubs.js +622 -0
  461. package/dist/session-utils-D8GljJ55.js +622 -0
  462. package/dist/sessions-ZRmCDdj1.js +2569 -0
  463. package/dist/sessions-usKmYetT.js +247 -0
  464. package/dist/shell-env-DBS5su07.js +163 -0
  465. package/dist/shell-env-DYZq9PqC.js +163 -0
  466. package/dist/ssrf-B-rF_tZB.js +183 -0
  467. package/dist/ssrf-DJW14Wkh.js +183 -0
  468. package/dist/status-B1RE8YnT.js +1979 -0
  469. package/dist/status-Dy4u3bpY.js +1983 -0
  470. package/dist/status.update-B96J4HaE.js +449 -0
  471. package/dist/status.update-BjBbgwxn.js +449 -0
  472. package/dist/store-B5989JkX.js +64 -0
  473. package/dist/store-DCrrxHyS.js +2571 -0
  474. package/dist/store-IFJqgD2Q.js +53 -0
  475. package/dist/store-Ql6vAcsg.js +64 -0
  476. package/dist/subagent-registry-BGknZEUI.js +4856 -0
  477. package/dist/subagent-registry-CGhMOYVx.js +4854 -0
  478. package/dist/subsystem-PQ64_nsu.js +1136 -0
  479. package/dist/subsystem-SgROXN1v.js +1079 -0
  480. package/dist/system-cli-Cfk2ankT.js +77 -0
  481. package/dist/system-cli-feOkmeNQ.js +73 -0
  482. package/dist/systemd-B6BCzznn.js +547 -0
  483. package/dist/systemd-BhQdjwJw.js +547 -0
  484. package/dist/systemd-hints-B8d0fce2.js +278 -0
  485. package/dist/systemd-hints-C5dlAJ5Z.js +278 -0
  486. package/dist/systemd-linger-B42HZhnk.js +75 -0
  487. package/dist/systemd-linger-D1Jtwxar.js +75 -0
  488. package/dist/table-CzC1hpWo.js +279 -0
  489. package/dist/tables-CO_kxD0e.js +55 -0
  490. package/dist/tables-Du1Gu0aG.js +55 -0
  491. package/dist/tables-WZp8Vt9n.js +55 -0
  492. package/dist/tailnet-CfZhpSnt.js +40 -0
  493. package/dist/tailnet-D0NV0tRJ.js +40 -0
  494. package/dist/tailscale-B__xvMjA.js +230 -0
  495. package/dist/tailscale-q_ZrxUCc.js +230 -0
  496. package/dist/targets-B4rMyQFJ.js +53 -0
  497. package/dist/targets-BHYLCv06.js +2534 -0
  498. package/dist/targets-BjWhDMJM.js +650 -0
  499. package/dist/targets-CHwGDIgO.js +650 -0
  500. package/dist/targets-D3WkRcT8.js +120 -0
  501. package/dist/targets-DkmiOlPe.js +220 -0
  502. package/dist/targets-bqjVeCnF.js +2535 -0
  503. package/dist/targets-mqj9GNg1.js +53 -0
  504. package/dist/targets-tDrl_ioQ.js +46 -0
  505. package/dist/thinking-BqJmU6Zp.js +88 -0
  506. package/dist/thinking-l-rrvZwu.js +88 -0
  507. package/dist/tool-display-C0hpLmkw.js +785 -0
  508. package/dist/tool-display-CQTRHo3Z.js +785 -0
  509. package/dist/tool-images-BYY11Gw3.js +263 -0
  510. package/dist/tool-images-CnJ0R8Fo.js +263 -0
  511. package/dist/trash-C0mjnHuW.js +125 -0
  512. package/dist/trash-Cgwc9mLD.js +125 -0
  513. package/dist/tui-DmstEnnX.js +3282 -0
  514. package/dist/tui-Dngv7ykt.js +3282 -0
  515. package/dist/tui-cli-D2dJs5Fl.js +62 -0
  516. package/dist/tui-cli-azwehnLo.js +66 -0
  517. package/dist/update-B7nMMqp1.js +349 -0
  518. package/dist/update-C1-XOYtz.js +349 -0
  519. package/dist/update-cli-BmI_TMNi.js +1147 -0
  520. package/dist/update-cli-BxtNSw_X.js +1145 -0
  521. package/dist/usage-BOEcX9lB.js +5448 -0
  522. package/dist/version-3QUZW8EP.js +52 -0
  523. package/dist/version-CVMnqdzu.js +52 -0
  524. package/dist/web-CSur3l1X.js +74 -0
  525. package/dist/web-DABJ4byB.js +79 -0
  526. package/dist/web-Dkbd0w1V.js +3070 -0
  527. package/dist/webhooks-cli-CzSeHHov.js +334 -0
  528. package/dist/webhooks-cli-DDeU_DV5.js +330 -0
  529. package/dist/whatsapp-actions-3NdzsNg1.js +130 -0
  530. package/dist/whatsapp-actions-y_1vjkYY.js +125 -0
  531. package/dist/workspace-DW1ofNbI.js +447 -0
  532. package/dist/workspace-aStQsS6k.js +449 -0
  533. package/dist/zod-schema-CbqZAIYy.js +2696 -0
  534. package/dist/zod-schema-YGQJEcnj.js +2696 -0
  535. package/extensions/matrix/src/matrix/monitor/replies.ts +0 -24
  536. package/extensions/mattermost/src/mattermost/monitor-helpers.ts +0 -1
  537. package/package.json +3 -3
  538. package/dist/accounts-6bE7_6RL.js +0 -32
  539. package/dist/accounts-B1aJFYXr.js +0 -272
  540. package/dist/accounts-BTXSfPWi.js +0 -270
  541. package/dist/accounts-BxGS70Do.js +0 -36
  542. package/dist/accounts-CNY1TGj1.js +0 -47
  543. package/dist/accounts-Cl_cFv9X.js +0 -47
  544. package/dist/accounts-Dn9h7HHT.js +0 -36
  545. package/dist/ack-reactions-C5kPZvda.js +0 -446
  546. package/dist/ack-reactions-obWeK7Rw.js +0 -446
  547. package/dist/acp-cli-B-wqDGbE.js +0 -1326
  548. package/dist/acp-cli-BWhVu-KY.js +0 -1320
  549. package/dist/active-listener-VzhWW8W6.js +0 -37
  550. package/dist/active-listener-z0qVEcom.js +0 -37
  551. package/dist/agent-D0tKpxob.js +0 -731
  552. package/dist/agent-DfNHqNSe.js +0 -732
  553. package/dist/agent-helpers-CTx5KKJu.js +0 -606
  554. package/dist/agent-helpers-D_9mS2Ti.js +0 -606
  555. package/dist/agent-scope-9WY5O-KK.js +0 -121
  556. package/dist/agent-scope-C50VuLKh.js +0 -119
  557. package/dist/agents-VeVj5NN9.js +0 -788
  558. package/dist/agents.config-BPGQ3Qyn.js +0 -116
  559. package/dist/agents.config-p3V3b9u6.js +0 -116
  560. package/dist/ansi-D04X81yq.js +0 -14
  561. package/dist/audio-DPOuhNq7.js +0 -43
  562. package/dist/audio-VBcVDa08.js +0 -43
  563. package/dist/audio-preflight-BwmCYeuM.js +0 -64
  564. package/dist/audio-preflight-Dj6hBcFR.js +0 -69
  565. package/dist/audit-C1GUK9MZ.js +0 -3138
  566. package/dist/audit-CakTmUvV.js +0 -3138
  567. package/dist/auth-C6VDYgb7.js +0 -448
  568. package/dist/auth-Deh9i9Eg.js +0 -448
  569. package/dist/auth-profiles-BquJGKLC.js +0 -279
  570. package/dist/auth-profiles-CeDgZz_7.js +0 -281
  571. package/dist/banner-D0g6Jqg7.js +0 -294
  572. package/dist/binaries-X6FW-wD4.js +0 -13
  573. package/dist/bindings-B582pDIa.js +0 -69
  574. package/dist/bindings-CRU_udk8.js +0 -69
  575. package/dist/bonjour-discovery-BtPaR8vb.js +0 -378
  576. package/dist/bonjour-discovery-DuhiIZZx.js +0 -378
  577. package/dist/browser-cli-ZGejewVU.js +0 -1692
  578. package/dist/browser-cli-apM-sb95.js +0 -1687
  579. package/dist/call-C1c3rcy7.js +0 -2828
  580. package/dist/call-EndUQoN2.js +0 -2829
  581. package/dist/catalog-BMf9kYo4.js +0 -185
  582. package/dist/catalog-DTOwqzdA.js +0 -185
  583. package/dist/channel-account-context-CjXyzMXE.js +0 -550
  584. package/dist/channel-account-context-CvIDAtHS.js +0 -550
  585. package/dist/channel-activity-BZbNMyql.js +0 -292
  586. package/dist/channel-activity-BeRrcCd8.js +0 -94
  587. package/dist/channel-activity-DTKGf3j5.js +0 -94
  588. package/dist/channel-options-A-6mAxk3.js +0 -33
  589. package/dist/channel-options-CUMGATrC.js +0 -32
  590. package/dist/channel-selection-CJXZTxae.js +0 -51
  591. package/dist/channel-selection-NNPbxnyZ.js +0 -51
  592. package/dist/channel-web-BI274Kbc.js +0 -2136
  593. package/dist/channel-web-tkULzsN2.js +0 -2134
  594. package/dist/channels-cli-GMS9bQeR.js +0 -1421
  595. package/dist/channels-cli-GQ1h5nQo.js +0 -1426
  596. package/dist/channels-status-issues-BDAHISWe.js +0 -18
  597. package/dist/channels-status-issues-DwRDzwrV.js +0 -18
  598. package/dist/chat-envelope-DEZ-5RY8.js +0 -248
  599. package/dist/chat-envelope-el7Uo-Fe.js +0 -248
  600. package/dist/chrome-5KCwEdqq.js +0 -1733
  601. package/dist/chrome-bU1D1n_G.js +0 -1732
  602. package/dist/chunk-CSQfUhgF.js +0 -341
  603. package/dist/chunk-DAjFKt2g.js +0 -341
  604. package/dist/clack-prompter-CCFnKP_1.js +0 -121
  605. package/dist/clack-prompter-CabwzmG4.js +0 -122
  606. package/dist/cli-BRKebcMX.js +0 -130
  607. package/dist/cli-DaI8rboT.js +0 -125
  608. package/dist/clipboard-B2j4qGIl.js +0 -31
  609. package/dist/clipboard-Dzkx6Q2K.js +0 -31
  610. package/dist/command-format-CVfo8I5f.js +0 -18
  611. package/dist/command-format-DgXcqxBt.js +0 -32
  612. package/dist/command-registry-DGcTGjBl.js +0 -215
  613. package/dist/commands-C2uNKRTf.js +0 -41
  614. package/dist/commands-CDonBOrw.js +0 -41
  615. package/dist/commands-registry-BvESmXoK.js +0 -893
  616. package/dist/commands-registry-CWJv6xe2.js +0 -892
  617. package/dist/common-Cp3rsBqx.js +0 -156
  618. package/dist/common-DSVmydhm.js +0 -156
  619. package/dist/completion-cli-BHimaCdU.js +0 -452
  620. package/dist/completion-cli-C2ej-NKQ.js +0 -452
  621. package/dist/config-CKjn6ORX.js +0 -6953
  622. package/dist/config-Dx2muBSJ.js +0 -6955
  623. package/dist/config-cli-DPSj7xEW.js +0 -246
  624. package/dist/config-cli-uCJAolq3.js +0 -241
  625. package/dist/config-guard-C2g3LlWk.js +0 -75
  626. package/dist/config-guard-D1htIUcx.js +0 -97
  627. package/dist/config-validation-CqVJLiYT.js +0 -18
  628. package/dist/config-validation-D3Up1-Pq.js +0 -18
  629. package/dist/configure-CExN5RUz.js +0 -891
  630. package/dist/configure-sLl4dSHU.js +0 -889
  631. package/dist/constants-BmRFoHl0.js +0 -67
  632. package/dist/constants-C9WPAluB.js +0 -67
  633. package/dist/control-auth--fCnBrmu.js +0 -397
  634. package/dist/control-auth-894Ezu61.js +0 -397
  635. package/dist/control-ui/assets/index-B4ZM1lW1.js +0 -7738
  636. package/dist/control-ui/assets/index-B4ZM1lW1.js.map +0 -1
  637. package/dist/control-ui/assets/index-PED72sKF.css +0 -1
  638. package/dist/control-ui-assets-Cx_mw4D0.js +0 -186
  639. package/dist/control-ui-assets-D4yaD8jm.js +0 -186
  640. package/dist/conversation-label-C4SDz4sT.js +0 -36
  641. package/dist/conversation-label-D1frnvYe.js +0 -36
  642. package/dist/cron-cli-CzNB7gey.js +0 -495
  643. package/dist/cron-cli-kN6pZBMh.js +0 -490
  644. package/dist/daemon-cli-Bf5va8oF.js +0 -1199
  645. package/dist/daemon-cli-TuWhoQ3H.js +0 -1197
  646. package/dist/daemon-install-CcohRvKV.js +0 -55
  647. package/dist/daemon-install-DrTvAWhM.js +0 -60
  648. package/dist/daemon-install-helpers-CFGAfRlj.js +0 -462
  649. package/dist/daemon-install-helpers-DIUzSFG1.js +0 -462
  650. package/dist/defaults-B5KStIBg.js +0 -7
  651. package/dist/defaults-xUAL2Z-F.js +0 -7
  652. package/dist/deliver-Dm7GkHXJ.js +0 -481
  653. package/dist/deliver-wTlFm59G.js +0 -481
  654. package/dist/delivery-queue-Cfa9Wmxp.js +0 -244
  655. package/dist/delivery-queue-CxVRi4tw.js +0 -244
  656. package/dist/devices-cli-CAcVSiHC.js +0 -316
  657. package/dist/devices-cli-rX6imHCj.js +0 -321
  658. package/dist/diagnostics-HGkN467d.js +0 -46
  659. package/dist/diagnostics-VC0cz7kX.js +0 -46
  660. package/dist/directory-cli-D83Q7y5H.js +0 -222
  661. package/dist/directory-cli-DVfyUHCz.js +0 -217
  662. package/dist/dm-policy-shared-BBfEyAN1.js +0 -22
  663. package/dist/dm-policy-shared-D8lgnmrC.js +0 -22
  664. package/dist/dns-cli-5SrjpIcy.js +0 -197
  665. package/dist/dns-cli-Canj4LtY.js +0 -202
  666. package/dist/dock-BqNINg7k.js +0 -928
  667. package/dist/dock-O8ArYwed.js +0 -929
  668. package/dist/doctor-completion-BuPeaJgR.js +0 -92
  669. package/dist/doctor-completion-CVwczO1U.js +0 -92
  670. package/dist/doctor-config-flow-DXnCqDd9.js +0 -1933
  671. package/dist/doctor-config-flow-DZG6oOAj.js +0 -1934
  672. package/dist/enable-DMIq6evt.js +0 -59
  673. package/dist/enable-ibNq4UWy.js +0 -59
  674. package/dist/env-Br2Bl6Ht.js +0 -60
  675. package/dist/env-vars-7aZqKPhk.js +0 -93
  676. package/dist/env-vars-CLGbxdpL.js +0 -93
  677. package/dist/errors-BpAidYqH.js +0 -35
  678. package/dist/errors-DZ199hOo.js +0 -35
  679. package/dist/exec-C6ACg_Mn.js +0 -164
  680. package/dist/exec-DkFE7lqU.js +0 -164
  681. package/dist/fetch-BFuS-EfP.js +0 -67
  682. package/dist/fetch-C6XKGA11.js +0 -67
  683. package/dist/fetch-CEDsOiql.js +0 -67
  684. package/dist/file-lock-CIvloidc.js +0 -107
  685. package/dist/file-lock-CzBL_VIx.js +0 -107
  686. package/dist/fs-safe-DSwT85uK.js +0 -88
  687. package/dist/fs-safe-DkBhNAc3.js +0 -98
  688. package/dist/gateway-cli-Ci9M4Tnt.js +0 -23742
  689. package/dist/gateway-cli-DNr539Bh.js +0 -23747
  690. package/dist/gateway-rpc-BxH8V6gB.js +0 -28
  691. package/dist/gateway-rpc-CMsfRKML.js +0 -28
  692. package/dist/gmail-setup-utils-BPmUIqso.js +0 -423
  693. package/dist/gmail-setup-utils-Cnx8A5pW.js +0 -422
  694. package/dist/health-DeNxtGCn.js +0 -1420
  695. package/dist/health-DwKPQOTn.js +0 -1423
  696. package/dist/heartbeat-visibility-BvJaUOFC.js +0 -125
  697. package/dist/heartbeat-visibility-EBPnhcaa.js +0 -125
  698. package/dist/helpers-R7bU5IBz.js +0 -10
  699. package/dist/helpers-kkeXif0Q.js +0 -10
  700. package/dist/hook-runner-global-BSklbS52.js +0 -527
  701. package/dist/hooks-cli-BuWpetaT.js +0 -1222
  702. package/dist/hooks-cli-C1BG-IlR.js +0 -1217
  703. package/dist/host-env-security-Bms2_EMV.js +0 -92
  704. package/dist/host-env-security-szwfmhC4.js +0 -92
  705. package/dist/image-ops-DRdKC0uO.js +0 -354
  706. package/dist/image-ops-DWytvdh_.js +0 -354
  707. package/dist/import-B6Xn6yAg.js +0 -248
  708. package/dist/import-CIIB1Q1J.js +0 -250
  709. package/dist/inbound-context-CPkkQW0i.js +0 -68
  710. package/dist/inbound-context-DS_kpIYI.js +0 -68
  711. package/dist/inbound-path-policy-C_Qo8rqg.js +0 -250
  712. package/dist/inbound-path-policy-sdr5Ji0k.js +0 -250
  713. package/dist/inspect-B1Fq39RC.js +0 -559
  714. package/dist/inspect-Dt8hogS3.js +0 -559
  715. package/dist/installs-B1rNHwnF.js +0 -325
  716. package/dist/installs-ClyOD2BY.js +0 -325
  717. package/dist/ipv4--2WXMVtE.js +0 -46
  718. package/dist/ipv4-CDQpx1A7.js +0 -46
  719. package/dist/ir-Ch9FC9Z_.js +0 -940
  720. package/dist/json-files-DzpTak5i.js +0 -46
  721. package/dist/loader-Bkhoi4yR.js +0 -22621
  722. package/dist/loader-DrZ6VM0f.js +0 -22624
  723. package/dist/local-roots-BrH0Q63K.js +0 -313
  724. package/dist/local-roots-z2u_s7jG.js +0 -314
  725. package/dist/logger-pznB_IdT.js +0 -49
  726. package/dist/login-BIgEFDBJ.js +0 -61
  727. package/dist/login-CqST6Yyp.js +0 -62
  728. package/dist/login-qr-ChZo1oB2.js +0 -327
  729. package/dist/login-qr-lciTI8Ue.js +0 -322
  730. package/dist/logs-cli-B4DaUuwW.js +0 -238
  731. package/dist/logs-cli-BBWcmNEs.js +0 -233
  732. package/dist/markdown-tables-hhOWaw8L.js +0 -29
  733. package/dist/markdown-tables-jrnSPvZ6.js +0 -29
  734. package/dist/media-BrtsoHDf.js +0 -10499
  735. package/dist/media-DN7yRfrH.js +0 -940
  736. package/dist/message-action-names-DYTTi8gx.js +0 -2521
  737. package/dist/message-action-names-oFjla2Uc.js +0 -2521
  738. package/dist/message-channel-BlYrtmIp.js +0 -91
  739. package/dist/message-channel-uWMAiywE.js +0 -91
  740. package/dist/net-Cg8AQeke.js +0 -225
  741. package/dist/net-D6D0wgcF.js +0 -225
  742. package/dist/node-cli-Q2-n3Fgv.js +0 -24
  743. package/dist/node-cli-Uf6lAntf.js +0 -24
  744. package/dist/nodes-cli-BAYWaRF9.js +0 -1348
  745. package/dist/nodes-cli-C0b4ae_w.js +0 -1343
  746. package/dist/nodes-screen-Bmp1l9wY.js +0 -250
  747. package/dist/nodes-screen-Cw7Hv7M2.js +0 -250
  748. package/dist/note-DR8A0G5H.js +0 -92
  749. package/dist/note-Dlv4NmlQ.js +0 -92
  750. package/dist/npm-registry-spec-COvUzy5J.js +0 -786
  751. package/dist/npm-registry-spec-Cobb5KYR.js +0 -786
  752. package/dist/npm-resolution-D6VFpSMk.js +0 -86
  753. package/dist/npm-resolution-DCVQ6Y0K.js +0 -86
  754. package/dist/onboard-BXB0BqXA.js +0 -407
  755. package/dist/onboard-channels-BMwYGHjJ.js +0 -2547
  756. package/dist/onboard-channels-Cm2oMc5h.js +0 -2548
  757. package/dist/onboard-dWO3eHR_.js +0 -405
  758. package/dist/onboard-helpers-DC1_Uz_K.js +0 -362
  759. package/dist/onboard-helpers-zH14EFKa.js +0 -363
  760. package/dist/onboard-remote-DKLIRtxz.js +0 -127
  761. package/dist/onboard-remote-G7myeQp9.js +0 -127
  762. package/dist/onboarding-BjqWZRpo.js +0 -534
  763. package/dist/onboarding-czAjtgrV.js +0 -532
  764. package/dist/onboarding.finalize-C5K0VM-b.js +0 -398
  765. package/dist/onboarding.finalize-Df9zwPyz.js +0 -401
  766. package/dist/onboarding.gateway-config-DbL694q5.js +0 -198
  767. package/dist/onboarding.gateway-config-mAUMPQtE.js +0 -191
  768. package/dist/outbound-BSrQB04F.js +0 -221
  769. package/dist/outbound-UQ05e6hy.js +0 -220
  770. package/dist/outbound-attachment-DIiKB_mP.js +0 -18
  771. package/dist/outbound-attachment-DvxfVMMN.js +0 -18
  772. package/dist/outbound-attachment-o0seS0CP.js +0 -18
  773. package/dist/pairing-cli-Dg7flTtc.js +0 -122
  774. package/dist/pairing-cli-DyOmIkR8.js +0 -127
  775. package/dist/pairing-labels-B_53dY5L.js +0 -9
  776. package/dist/pairing-labels-BiSZLitI.js +0 -9
  777. package/dist/pairing-store-BgAv4uN8.js +0 -460
  778. package/dist/pairing-store-CTkD51uW.js +0 -459
  779. package/dist/path-env-ErEKbxOI.js +0 -89
  780. package/dist/path-env-qRJbjJzj.js +0 -89
  781. package/dist/path-safety-DkT9RmTG.js +0 -14
  782. package/dist/path-safety-juI2XbO1.js +0 -14
  783. package/dist/plugin-auto-enable-C2C0yYb0.js +0 -302
  784. package/dist/plugin-auto-enable-CqeLGGEe.js +0 -301
  785. package/dist/plugin-registry-ByWYnPMd.js +0 -33
  786. package/dist/plugin-registry-D1XLfwHj.js +0 -33
  787. package/dist/plugin-sdk/agents/agent-helpers/thinking.d.ts +0 -5
  788. package/dist/plugin-sdk/agents/agent-paths.d.ts +0 -1
  789. package/dist/plugin-sdk/agents/auth-profiles/constants.d.ts +0 -16
  790. package/dist/plugin-sdk/agents/auth-profiles/display.d.ts +0 -7
  791. package/dist/plugin-sdk/agents/auth-profiles/doctor.d.ts +0 -8
  792. package/dist/plugin-sdk/agents/auth-profiles/oauth.d.ts +0 -14
  793. package/dist/plugin-sdk/agents/auth-profiles/paths.d.ts +0 -4
  794. package/dist/plugin-sdk/agents/auth-profiles/profiles.d.ts +0 -12
  795. package/dist/plugin-sdk/agents/auth-profiles/session-override.d.ts +0 -18
  796. package/dist/plugin-sdk/agents/auth-profiles/store.d.ts +0 -10
  797. package/dist/plugin-sdk/agents/auth-profiles/types.d.ts +0 -13
  798. package/dist/plugin-sdk/agents/auth-profiles.d.ts +0 -8
  799. package/dist/plugin-sdk/agents/defaults.d.ts +0 -3
  800. package/dist/plugin-sdk/agents/provider-auth.d.ts +0 -40
  801. package/dist/plugin-sdk/auto-reply/model-runtime.d.ts +0 -17
  802. package/dist/plugin-sdk/config/model-input.d.ts +0 -9
  803. package/dist/plugin-sdk/config/zod-schema.agent-model.d.ts +0 -5
  804. package/dist/plugin-sdk/media-understanding/audio-preflight.d.ts +0 -16
  805. package/dist/plugin-sdk/sessions/model-overrides.d.ts +0 -14
  806. package/dist/plugin-sdk/telegram/reasoning-lane-coordinator.d.ts +0 -18
  807. package/dist/plugins-BXkDApVh.js +0 -455
  808. package/dist/plugins-BflZz0sp.js +0 -453
  809. package/dist/plugins-cli-Dq7-gN1i.js +0 -798
  810. package/dist/plugins-cli-TDt5Ap1o.js +0 -793
  811. package/dist/ports-DIYJq-SY.js +0 -370
  812. package/dist/ports-DPL-Pzfh.js +0 -96
  813. package/dist/ports-NPqtlfp0.js +0 -316
  814. package/dist/ports-QMI4-F9m.js +0 -96
  815. package/dist/program-CV25aS-N.js +0 -244
  816. package/dist/program-context-MYxxQ1ar.js +0 -474
  817. package/dist/progress--dapuyZA.js +0 -124
  818. package/dist/prompt-select-styled-4xpEHxBE.js +0 -1647
  819. package/dist/prompt-select-styled-CqCRCk9u.js +0 -1650
  820. package/dist/provider-dispatcher-CbJCfJNB.js +0 -660
  821. package/dist/provider-dispatcher-pOqMXfLQ.js +0 -659
  822. package/dist/push-apns-CLmNS5AZ.js +0 -713
  823. package/dist/push-apns-DuG95AKC.js +0 -711
  824. package/dist/pw-ai-B2LkFeUC.js +0 -1906
  825. package/dist/pw-ai-CwC1FQEH.js +0 -1910
  826. package/dist/qr-cli-9iFACuGt.js +0 -352
  827. package/dist/qr-cli-CDRHTGnv.js +0 -347
  828. package/dist/redact-snapshot-CJApG-fd.js +0 -2028
  829. package/dist/redact-snapshot-DR_-YlRl.js +0 -2028
  830. package/dist/register.agent-BYxDAKY7.js +0 -1043
  831. package/dist/register.agent-CUANybY6.js +0 -286
  832. package/dist/register.configure-BP0t9Uwl.js +0 -124
  833. package/dist/register.configure-DyhKPvnk.js +0 -130
  834. package/dist/register.import-Dc7m8NdP.js +0 -30
  835. package/dist/register.import-DdLGUSEK.js +0 -27
  836. package/dist/register.maintenance-BrX4RfuS.js +0 -497
  837. package/dist/register.maintenance-BtPJG7Q7.js +0 -494
  838. package/dist/register.message-CKl_lHTO.js +0 -686
  839. package/dist/register.message-ZbmkQ5ht.js +0 -681
  840. package/dist/register.onboard--u57gjFL.js +0 -262
  841. package/dist/register.onboard-ixO7YHUQ.js +0 -257
  842. package/dist/register.setup-B6IX71r9.js +0 -114
  843. package/dist/register.setup-u9E6svMo.js +0 -109
  844. package/dist/register.status-health-sessions-BBFNCrfS.js +0 -669
  845. package/dist/register.status-health-sessions-ClYWL_wb.js +0 -423
  846. package/dist/register.subclis-DJdrt1IR.js +0 -267
  847. package/dist/replies-BGYU-p0J.js +0 -136
  848. package/dist/replies-Bn1oXSB8.js +0 -136
  849. package/dist/reply-Cepi2flR.js +0 -13897
  850. package/dist/reply-CmeV20ii.js +0 -13900
  851. package/dist/reply-directives-DOPAdviR.js +0 -182
  852. package/dist/reply-directives-DspqGGVJ.js +0 -182
  853. package/dist/reply-payloads-MIecsqo-.js +0 -527
  854. package/dist/reply-prefix-4zLS7A1Y.js +0 -38
  855. package/dist/reply-prefix-DBLCYiup.js +0 -38
  856. package/dist/resolve-route-BDGdM-l3.js +0 -249
  857. package/dist/resolve-route-CBVbY0xS.js +0 -249
  858. package/dist/response-prefix-template-CSxp9HN5.js +0 -136
  859. package/dist/response-prefix-template-up4REfuR.js +0 -136
  860. package/dist/retry-D_-vU9CD.js +0 -77
  861. package/dist/run-main-Izi_Z0dI.js +0 -302
  862. package/dist/runner-BbLPl1dz.js +0 -2294
  863. package/dist/runner-z92MWZ3m.js +0 -2294
  864. package/dist/runtime-DJNp29jv.js +0 -94
  865. package/dist/runtime-guard-DZ_xuCc4.js +0 -60
  866. package/dist/secure-random-B7stcuHs.js +0 -44
  867. package/dist/security-cli-BvhB_SJV.js +0 -478
  868. package/dist/security-cli-DZ_pwUS6.js +0 -484
  869. package/dist/send-5HyMBvLh.js +0 -492
  870. package/dist/send-B0elLDis.js +0 -349
  871. package/dist/send-Bh75o8GE.js +0 -547
  872. package/dist/send-C2BVmzi6.js +0 -29
  873. package/dist/send-CHquO379.js +0 -547
  874. package/dist/send-CltrzWlk.js +0 -492
  875. package/dist/send-D9zlp5S9.js +0 -11
  876. package/dist/send-DD5szdZD.js +0 -1174
  877. package/dist/send-DIO6FcGs.js +0 -426
  878. package/dist/send-DWzItTE9.js +0 -1775
  879. package/dist/send-JUsdp68w.js +0 -2245
  880. package/dist/send-W1ofaGo7.js +0 -2245
  881. package/dist/send-fmudAAFF.js +0 -332
  882. package/dist/send-jN0cqz2d.js +0 -349
  883. package/dist/send-pZWXl_O3.js +0 -1778
  884. package/dist/send-uNEzfw9q.js +0 -374
  885. package/dist/server-55CHFsiA.js +0 -205
  886. package/dist/server-Bk0uMX7-.js +0 -200
  887. package/dist/server-lifecycle-CEOTZr99.js +0 -2437
  888. package/dist/server-lifecycle-DGais-nv.js +0 -2437
  889. package/dist/server-node-events-BT_YSlcA.js +0 -393
  890. package/dist/server-node-events-CiqYClwC.js +0 -398
  891. package/dist/service-BHos7oX8.js +0 -670
  892. package/dist/service-Bjqii5nW.js +0 -670
  893. package/dist/session-DBL5nHDy.js +0 -170
  894. package/dist/session-aUptxSVD.js +0 -170
  895. package/dist/session-cost-usage-DX09eTPU.js +0 -627
  896. package/dist/session-cost-usage-yYi525j3.js +0 -627
  897. package/dist/session-dirs-BADAi9Iz.js +0 -947
  898. package/dist/session-dirs-DdF6TDsE.js +0 -947
  899. package/dist/session-utils-BuXY8tQT.js +0 -625
  900. package/dist/session-utils-ByK5sFXr.js +0 -625
  901. package/dist/sessions-B_zoH4sM.js +0 -252
  902. package/dist/sessions-BntNl3-l.js +0 -2593
  903. package/dist/ssrf-Ck9HDZpv.js +0 -183
  904. package/dist/ssrf-m7kFIobZ.js +0 -183
  905. package/dist/status-B47idaLU.js +0 -2072
  906. package/dist/status-Dof6X4RY.js +0 -2068
  907. package/dist/status.update-C55QM2xs.js +0 -79
  908. package/dist/status.update-CVnonGHu.js +0 -79
  909. package/dist/store-BPZo49zT.js +0 -64
  910. package/dist/store-BsEwlSm1.js +0 -2595
  911. package/dist/store-Bxy7EHAf.js +0 -53
  912. package/dist/store-v3P-OWhi.js +0 -64
  913. package/dist/subagent-registry-DN3omJzH.js +0 -4858
  914. package/dist/subagent-registry-NTmURwBx.js +0 -4860
  915. package/dist/subsystem-C_FedsH7.js +0 -1079
  916. package/dist/subsystem-CrJCqjAh.js +0 -1139
  917. package/dist/system-cli-ByjvquTo.js +0 -75
  918. package/dist/system-cli-C8iA6NZ0.js +0 -70
  919. package/dist/systemd-B5lyaCc3.js +0 -547
  920. package/dist/systemd-DSnlM3jX.js +0 -547
  921. package/dist/systemd-linger-DRPSEQVw.js +0 -75
  922. package/dist/systemd-linger-_0_-RY4v.js +0 -75
  923. package/dist/table-CpmqqcxJ.js +0 -279
  924. package/dist/tables-BO6GU4qX.js +0 -55
  925. package/dist/tables-DI5LGEr1.js +0 -55
  926. package/dist/tables-D_PTzthR.js +0 -55
  927. package/dist/tailnet-CEudzG0i.js +0 -40
  928. package/dist/tailnet-PnMrjwGT.js +0 -40
  929. package/dist/tailscale-Dbyahx0J.js +0 -230
  930. package/dist/tailscale-Dxyz13fn.js +0 -230
  931. package/dist/targets-B-hWtwfx.js +0 -220
  932. package/dist/targets-CMhBAn87.js +0 -120
  933. package/dist/targets-CcTME3bp.js +0 -46
  934. package/dist/targets-Cm1X3IyA.js +0 -650
  935. package/dist/targets-CmC5m7Ey.js +0 -53
  936. package/dist/targets-D1e9eyXc.js +0 -2173
  937. package/dist/targets-D7OKVXMI.js +0 -650
  938. package/dist/targets-DK9MVsjx.js +0 -2172
  939. package/dist/targets-DyybKefq.js +0 -53
  940. package/dist/tool-display-B-nr7cSF.js +0 -785
  941. package/dist/tool-display-Br6mwaJc.js +0 -785
  942. package/dist/tool-images-DVrUJEqc.js +0 -263
  943. package/dist/tool-images-kloBqxqK.js +0 -263
  944. package/dist/trash-DPi0aCCQ.js +0 -125
  945. package/dist/trash-DzrtBoP1.js +0 -125
  946. package/dist/tui-ByoaOs-l.js +0 -3392
  947. package/dist/tui-C9l1U4r8.js +0 -3392
  948. package/dist/tui-cli-1Jp507CR.js +0 -63
  949. package/dist/tui-cli-DvjBEn7h.js +0 -58
  950. package/dist/update-Cj-HdoD2.js +0 -349
  951. package/dist/update-CrKl8Exj.js +0 -349
  952. package/dist/update-cli-BrgFncHk.js +0 -1370
  953. package/dist/update-cli-CpVeFz7g.js +0 -1373
  954. package/dist/usage-DY7X9Iud.js +0 -5279
  955. package/dist/web-B9EiMNAf.js +0 -70
  956. package/dist/web-Bp50XopI.js +0 -76
  957. package/dist/web-C5EBMd1-.js +0 -3065
  958. package/dist/webhooks-cli-D7kHy94s.js +0 -328
  959. package/dist/webhooks-cli-o4indVra.js +0 -333
  960. package/dist/whatsapp-actions-BOMh8Mlv.js +0 -122
  961. package/dist/whatsapp-actions-CT2Z1Iab.js +0 -128
  962. package/dist/workspace-Bnn6LXsc.js +0 -449
  963. package/dist/workspace-C6kLpOuR.js +0 -447
  964. /package/dist/{account-lookup-0KDSp5Mj.js → account-lookup-BOCzCnir.js} +0 -0
  965. /package/dist/{account-lookup-zvANGr2x.js → account-lookup-C0ndrpt-.js} +0 -0
  966. /package/dist/{api-BeQMq2iS.js → api-BRGaT2rg.js} +0 -0
  967. /package/dist/{api-CxX8-gGz.js → api-CUkn9zpm.js} +0 -0
  968. /package/dist/{argv-Co-b9Zsc.js → argv-BY8EVMTP.js} +0 -0
  969. /package/dist/{brew-DbSbN8sD.js → brew-CmTYeZk1.js} +0 -0
  970. /package/dist/{brew-C4zKZsHX.js → brew-V4lMBeE3.js} +0 -0
  971. /package/dist/{chat-type-CYPyHAj-.js → chat-type-CH3W-zKy.js} +0 -0
  972. /package/dist/{chat-type-DKb2TlGZ.js → chat-type-DyovJwCt.js} +0 -0
  973. /package/dist/{cleanup-utils-o2MM9xyf.js → cleanup-utils-C957khj6.js} +0 -0
  974. /package/dist/{cleanup-utils-CwQvD73q.js → cleanup-utils-CJ_R9s8l.js} +0 -0
  975. /package/dist/{cli-name-BicfmwQX.js → cli-name-3MdfbvIR.js} +0 -0
  976. /package/dist/{cli-name-C6rJGl18.js → cli-name-CRLBidNP.js} +0 -0
  977. /package/dist/{cli-utils-BhXbz2UF.js → cli-utils-5ZIfXAfM.js} +0 -0
  978. /package/dist/{cli-utils-DZe_rVkZ.js → cli-utils-BUOtyfnU.js} +0 -0
  979. /package/dist/{client-C61M8zI3.js → client-D5m46AuY.js} +0 -0
  980. /package/dist/{client-DdpmATKq.js → client-DFyI5I0n.js} +0 -0
  981. /package/dist/{command-options-C4paWSGf.js → command-options-Cn2fc1Of.js} +0 -0
  982. /package/dist/{command-options-CA30lfLK.js → command-options-D2nN4AXX.js} +0 -0
  983. /package/dist/{config-eval-H_wlEYIG.js → config-eval-COtEQ2A7.js} +0 -0
  984. /package/dist/{config-eval-CjGZtLwx.js → config-eval-DtP5xy_j.js} +0 -0
  985. /package/dist/{constants-ChptG3d7.js → constants-CRGAZ2ow.js} +0 -0
  986. /package/dist/{constants-DY6b-_Wl.js → constants-DoYLsBmv.js} +0 -0
  987. /package/dist/{credentials-BHWUBHMd.js → credentials-DMAWNZdV.js} +0 -0
  988. /package/dist/{credentials-DFsi1_e8.js → credentials-Dmc3H-jd.js} +0 -0
  989. /package/dist/{daemon-runtime-CMnbwryP.js → daemon-runtime-99xh1fGv.js} +0 -0
  990. /package/dist/{daemon-runtime-CvqE4ysg.js → daemon-runtime-KyXiP2ib.js} +0 -0
  991. /package/dist/{dangerous-name-matching-BzmiLXmA.js → dangerous-name-matching--N6kyM-p.js} +0 -0
  992. /package/dist/{dangerous-name-matching-DaVRgwer.js → dangerous-name-matching-BlTBBZns.js} +0 -0
  993. /package/dist/{dangerous-tools-BOLoCRv4.js → dangerous-tools-BRmbBvRf.js} +0 -0
  994. /package/dist/{dangerous-tools-Baq7Q-i6.js → dangerous-tools-E1i3IoxZ.js} +0 -0
  995. /package/dist/{fetch-timeout-DTIN7CGM.js → fetch-timeout-DBRRPNBi.js} +0 -0
  996. /package/dist/{fetch-timeout-DoySHqfO.js → fetch-timeout-l_6RdoMw.js} +0 -0
  997. /package/dist/{file-identity-BxlKD8Ys.js → file-identity-BnGA6wyc.js} +0 -0
  998. /package/dist/{format-duration-CqUERz51.js → format-duration-B-Uv5nOi.js} +0 -0
  999. /package/dist/{format-duration-Ct-yiwkS.js → format-duration-D1M3Zxu6.js} +0 -0
  1000. /package/dist/{format-relative-79_Y1n2Y.js → format-relative-Cywx6ldk.js} +0 -0
  1001. /package/dist/{format-relative-CxLpEQOX.js → format-relative-DcQZUAYl.js} +0 -0
  1002. /package/dist/{health-format-Bygse7KA.js → health-format-4qIciWnH.js} +0 -0
  1003. /package/dist/{health-format-B_QRD8Si.js → health-format-DVAm0AKy.js} +0 -0
  1004. /package/dist/{heartbeat-wake-LGEgcXjs.js → heartbeat-wake-D6Lt5YUk.js} +0 -0
  1005. /package/dist/{heartbeat-wake-Y97geucO.js → heartbeat-wake-exV5m54T.js} +0 -0
  1006. /package/dist/{help-format-NNm_Ov4H.js → help-format-CJQ7APRn.js} +0 -0
  1007. /package/dist/{help-format-sqWgYEdL.js → help-format-DM6-OBt-.js} +0 -0
  1008. /package/dist/{helpers-BAsMXprO.js → helpers-BER76F_2.js} +0 -0
  1009. /package/dist/{helpers-DLgbkcEn.js → helpers-CAHQ-4Mb.js} +0 -0
  1010. /package/dist/{input-provenance-Bn6thJNm.js → input-provenance-BgfeDgck.js} +0 -0
  1011. /package/dist/{ip-C9q3Oq20.js → ip-BAhS4rY2.js} +0 -0
  1012. /package/dist/{ip-D0zgNmBV.js → ip-BUhsZdJu.js} +0 -0
  1013. /package/dist/{is-main-DN8-sNR5.js → is-main-BmHYGRhd.js} +0 -0
  1014. /package/dist/{json-file-ChO_R9yh.js → json-file-B5WEJJye.js} +0 -0
  1015. /package/dist/{json-file-B7l5-Xhr.js → json-file-Dbg7nZg1.js} +0 -0
  1016. /package/dist/{json-files-CmpYSF4G.js → json-files-BFGbyEzL.js} +0 -0
  1017. /package/dist/{lanes-ByWMUgrz.js → lanes-4FoQemog.js} +0 -0
  1018. /package/dist/{lanes-cHJ5arWg.js → lanes-BhdzrAIa.js} +0 -0
  1019. /package/dist/{links-Bz4V7R_p.js → links-CwTlzaPe.js} +0 -0
  1020. /package/dist/{links-Cm43Vcft.js → links-D5vtq30Q.js} +0 -0
  1021. /package/dist/{location-DBWCGNLq.js → location-50gaJF5Z.js} +0 -0
  1022. /package/dist/{location-GbZ0bBRU.js → location-Qo8Ii1zo.js} +0 -0
  1023. /package/dist/{logger-DyL5G2DO.js → logger-B1JSUwco.js} +0 -0
  1024. /package/dist/{logger-GvipVDfh.js → logger-Ds0NtnLh.js} +0 -0
  1025. /package/dist/{logger-BWMPnILd.js → logger-nEdVxm5D.js} +0 -0
  1026. /package/dist/{logging-D8-Kozjc.js → logging-IMll-y7p.js} +0 -0
  1027. /package/dist/{logging-D8R0sLY9.js → logging-xAM90kGK.js} +0 -0
  1028. /package/dist/{mime-BS3jhcZE.js → mime-AuIDUZPG.js} +0 -0
  1029. /package/dist/{mime-Cxh_64P6.js → mime-Cqg1jjia.js} +0 -0
  1030. /package/dist/{mutable-allowlist-detectors-DiZDtmlZ.js → mutable-allowlist-detectors-4m-Kc8Kn.js} +0 -0
  1031. /package/dist/{mutable-allowlist-detectors-U5ThQr9V.js → mutable-allowlist-detectors-DpVwqsrI.js} +0 -0
  1032. /package/dist/{onboard-config-CLLvYuqo.js → onboard-config-B22XEPgo.js} +0 -0
  1033. /package/dist/{onboard-config-CM9pKGnR.js → onboard-config-CnzPYr-v.js} +0 -0
  1034. /package/dist/{parse-log-line-enq8pduH.js → parse-log-line-BqNWR10F.js} +0 -0
  1035. /package/dist/{parse-log-line-mz9TG6ig.js → parse-log-line-ZSGs_ws7.js} +0 -0
  1036. /package/dist/{parse-timeout-BMP8a0_a.js → parse-timeout-BjhbNq7X.js} +0 -0
  1037. /package/dist/{parse-timeout-CDkco8kd.js → parse-timeout-CvODy9RC.js} +0 -0
  1038. /package/dist/{path-guards-CIx4hURU.js → path-guards-DOpzcMXz.js} +0 -0
  1039. /package/dist/{path-guards-CrQOUlsq.js → path-guards-DipYoPVw.js} +0 -0
  1040. /package/dist/plugin-sdk/{agents → auth}/api-key-rotation.d.ts +0 -0
  1041. /package/dist/{plugins-allowlist-BbTQ5Z2k.js → plugins-allowlist-BdyQ2KUk.js} +0 -0
  1042. /package/dist/{plugins-allowlist-C20oaESO.js → plugins-allowlist-NGzAob6Q.js} +0 -0
  1043. /package/dist/{polls-B0CCBDeR.js → polls-DQrR-qT3.js} +0 -0
  1044. /package/dist/{polls-CwwHzYBM.js → polls-ybwcqkWt.js} +0 -0
  1045. /package/dist/{ports-lsof-Wteul3ju.js → ports-lsof-CDyv5GJd.js} +0 -0
  1046. /package/dist/{process-scoped-map-CV9kDvfG.js → process-scoped-map-BwUkYFQV.js} +0 -0
  1047. /package/dist/{process-scoped-map-PEvnG75N.js → process-scoped-map-_zxf_kLz.js} +0 -0
  1048. /package/dist/{program-context-jqeI5alP.js → program-context-D5txVtUZ.js} +0 -0
  1049. /package/dist/{progress-C1kUfYL-.js → progress-DRLmcFiG.js} +0 -0
  1050. /package/dist/{prompt-Yn2yClg1.js → prompt-BRGfic91.js} +0 -0
  1051. /package/dist/{prompt-BVZVovoB.js → prompt-WEkXwIMT.js} +0 -0
  1052. /package/dist/{prompt-style-D0LUnqXi.js → prompt-style-B4Cq4PyQ.js} +0 -0
  1053. /package/dist/{prompt-style-DjEYC_s-.js → prompt-style-DKz0g3V_.js} +0 -0
  1054. /package/dist/{provider-utils-3JTMJroG.js → provider-utils-C9kBVF1f.js} +0 -0
  1055. /package/dist/{provider-utils-FaBmofiq.js → provider-utils-DiLhkKQp.js} +0 -0
  1056. /package/dist/{proxy-DL3MD6-P.js → proxy-BMJL0Qog.js} +0 -0
  1057. /package/dist/{proxy-DpNv2cSV.js → proxy-DIuxrx_D.js} +0 -0
  1058. /package/dist/{pw-ai-state-CGfLv6nV.js → pw-ai-state-CwXeO5d0.js} +0 -0
  1059. /package/dist/{pw-ai-state-Dynx20hr.js → pw-ai-state-DaISdsXY.js} +0 -0
  1060. /package/dist/{redact-Dx1Fue21.js → redact-CqWx9rpK.js} +0 -0
  1061. /package/dist/{redact-BsoXOV1y.js → redact-gXuh8MFk.js} +0 -0
  1062. /package/dist/{redact-identifier-BTIWtaa-.js → redact-identifier-BJOQDEj0.js} +0 -0
  1063. /package/dist/{redact-identifier-CAagcfWA.js → redact-identifier-DR54qsoT.js} +0 -0
  1064. /package/dist/{remoteclaw-root-DybYl8PL.js → remoteclaw-root-C3Pq14Zr.js} +0 -0
  1065. /package/dist/{remoteclaw-root-C2HV2VeC.js → remoteclaw-root-DTWE68ED.js} +0 -0
  1066. /package/dist/{render-CCLsW6Lz.js → render-CDCvpfhh.js} +0 -0
  1067. /package/dist/{render-uf6PvGMV.js → render-CJl4GK1B.js} +0 -0
  1068. /package/dist/{retry-CxXVRdes.js → retry-B19gMxS7.js} +0 -0
  1069. /package/dist/{retry-DnqPAqWp.js → retry-cXXk2j6_.js} +0 -0
  1070. /package/dist/{runtime-guard-U-ewY_QH.js → runtime-guard-CohQmZ1R.js} +0 -0
  1071. /package/dist/{secret-equal-BbHdTtqY.js → secret-equal-CJzes24Z.js} +0 -0
  1072. /package/dist/{secret-equal-CXJEZiWb.js → secret-equal-CQAmGfGc.js} +0 -0
  1073. /package/dist/{secure-random-CS2mSdTn.js → secure-random-B3f7Ri2X.js} +0 -0
  1074. /package/dist/{secure-random-_dzDDlFo.js → secure-random-BkZFG9cd.js} +0 -0
  1075. /package/dist/{session-key-5YLnn_qf.js → session-key-BF-9YzxC.js} +0 -0
  1076. /package/dist/{session-key-C2n-VILA.js → session-key-CgKWfjoZ.js} +0 -0
  1077. /package/dist/{stagger-BXv_apuy.js → stagger--wvODnNe.js} +0 -0
  1078. /package/dist/{stagger-MI9gd2rQ.js → stagger-DhN5TT84.js} +0 -0
  1079. /package/dist/{status-BmtCS3T1.js → status-BVTsuvCS.js} +0 -0
  1080. /package/dist/{status-BrwHRn2B.js → status-BwiJpA37.js} +0 -0
  1081. /package/dist/{strip-inbound-meta-jy3bkUab.js → strip-inbound-meta-0cvL6itU.js} +0 -0
  1082. /package/dist/{table-C1rdyYl9.js → table-r6POocso.js} +0 -0
  1083. /package/dist/{target-errors-BDpPcwh5.js → target-errors-DJVRKFcU.js} +0 -0
  1084. /package/dist/{target-errors-DdIAPcMM.js → target-errors-GZXDqlUu.js} +0 -0
  1085. /package/dist/{targets-D-qLBpTA.js → targets-B_d_1z3N.js} +0 -0
  1086. /package/dist/{targets-UncQvCVs.js → targets-D01MJGnh.js} +0 -0
  1087. /package/dist/{targets-BMenhVHg.js → targets-D3r6Zgic.js} +0 -0
  1088. /package/dist/{targets-C-2xwh9f.js → targets-DOJXjN1U.js} +0 -0
  1089. /package/dist/{targets-D7PT_rdO.js → targets-WSwPflb6.js} +0 -0
  1090. /package/dist/{text-format-BQ3z_OXA.js → text-format-C_RADpVD.js} +0 -0
  1091. /package/dist/{text-format-oWqzVmah.js → text-format-VSogn9Yq.js} +0 -0
  1092. /package/dist/{tokens-B-jmvNR9.js → tokens-C8yGxAcR.js} +0 -0
  1093. /package/dist/{tokens-qLtFu3nT.js → tokens-DAFBx5qr.js} +0 -0
  1094. /package/dist/{usage-BdhBT0Vz.js → usage-BXi79Rq6.js} +0 -0
  1095. /package/dist/{usage-BtQcAnf6.js → usage-C1lHaofV.js} +0 -0
  1096. /package/dist/{usage-format-C3mNLfhI.js → usage-format-CD5jsZY1.js} +0 -0
  1097. /package/dist/{usage-format-DAaPzr_z.js → usage-format-CRVpDVj1.js} +0 -0
  1098. /package/dist/{widearea-dns-BXGCmXnD.js → widearea-dns-BNFRmJwa.js} +0 -0
  1099. /package/dist/{widearea-dns-CsmBVbez.js → widearea-dns-CV8_Cl64.js} +0 -0
  1100. /package/dist/{workspace-BzPeZDew.js → workspace-BJCKO8Ns.js} +0 -0
  1101. /package/dist/{workspace-DkGLVfOl.js → workspace-BisvA9oA.js} +0 -0
  1102. /package/dist/{wsl-B_sPlzWw.js → wsl-DOF5ZlX9.js} +0 -0
  1103. /package/dist/{wsl-BCnYV9O0.js → wsl-kFaeW76c.js} +0 -0
@@ -0,0 +1,2394 @@
1
+ import { Mt as resolvePreferredRemoteClawTmpDir, ht as logVerbose, vt as shouldLogVerbose } from "./entry.js";
2
+ import { t as getShellEnvAppliedKeys } from "./shell-env-DBS5su07.js";
3
+ import { a as normalizeProviderId, r as normalizeGoogleModelId } from "./provider-utils-DiLhkKQp.js";
4
+ import { a as resolveIMessageAttachmentRoots, i as mergeInboundPathRoots, n as isInboundPathAllowed, t as DEFAULT_IMESSAGE_ATTACHMENT_ROOTS } from "./inbound-path-policy-BurOAu44.js";
5
+ import { t as normalizeChatType } from "./chat-type-CH3W-zKy.js";
6
+ import { t as formatCliCommand } from "./command-format-LFmgWzKJ.js";
7
+ import { n as runExec } from "./exec-D_s-zAtY.js";
8
+ import { a as isAudioFileName, r as getFileExtension, s as kindFromMime, t as detectMime } from "./mime-AuIDUZPG.js";
9
+ import { n as fetchWithTimeout } from "./fetch-timeout-DBRRPNBi.js";
10
+ import { i as fetchRemoteMedia, n as getDefaultMediaLocalRoots, o as fetchWithSsrFGuard, r as MediaFetchError } from "./local-roots-n_Y4iYwb.js";
11
+ import { f as resolveAuthStorePathForDisplay, h as resolveAuthProfileDisplayLabel, l as ensureAuthProfileStore, m as normalizeSecretInput, o as resolveApiKeyForProfile, p as normalizeOptionalSecretInput, s as listProfilesForProvider } from "./auth-DLTRySEi.js";
12
+ import { n as formatErrorMessage, r as formatUncaughtError, t as extractErrorCode } from "./errors-Cr_NbOb4.js";
13
+ import process$1 from "node:process";
14
+ import { fileURLToPath } from "node:url";
15
+ import os, { homedir } from "node:os";
16
+ import path, { join } from "node:path";
17
+ import { constants, existsSync } from "node:fs";
18
+ import crypto from "node:crypto";
19
+ import fsp, { mkdtemp, rm } from "node:fs/promises";
20
+
21
+ //#region src/auth/provider-auth.ts
22
+ /**
23
+ * Provider auth resolution extracted from model-auth.ts.
24
+ *
25
+ * Resolves API keys for providers via auth profiles, environment variables,
26
+ * and AWS SDK credential chains. Used by media-understanding, onboarding,
27
+ * and status display.
28
+ */
29
+ const AWS_BEARER_ENV = "AWS_BEARER_TOKEN_BEDROCK";
30
+ const AWS_ACCESS_KEY_ENV = "AWS_ACCESS_KEY_ID";
31
+ const AWS_SECRET_KEY_ENV = "AWS_SECRET_ACCESS_KEY";
32
+ const AWS_PROFILE_ENV = "AWS_PROFILE";
33
+ function resolveEnvSourceLabel(params) {
34
+ return `${params.envVars.some((envVar) => params.applied.has(envVar)) ? "shell env: " : "env: "}${params.label}`;
35
+ }
36
+ function resolveAwsSdkAuthInfo() {
37
+ const applied = new Set(getShellEnvAppliedKeys());
38
+ if (process.env[AWS_BEARER_ENV]?.trim()) return {
39
+ mode: "api-key",
40
+ source: resolveEnvSourceLabel({
41
+ applied,
42
+ envVars: [AWS_BEARER_ENV],
43
+ label: AWS_BEARER_ENV
44
+ })
45
+ };
46
+ if (process.env[AWS_ACCESS_KEY_ENV]?.trim() && process.env[AWS_SECRET_KEY_ENV]?.trim()) return {
47
+ mode: "api-key",
48
+ source: resolveEnvSourceLabel({
49
+ applied,
50
+ envVars: [AWS_ACCESS_KEY_ENV, AWS_SECRET_KEY_ENV],
51
+ label: `${AWS_ACCESS_KEY_ENV} + ${AWS_SECRET_KEY_ENV}`
52
+ })
53
+ };
54
+ if (process.env[AWS_PROFILE_ENV]?.trim()) return {
55
+ mode: "api-key",
56
+ source: resolveEnvSourceLabel({
57
+ applied,
58
+ envVars: [AWS_PROFILE_ENV],
59
+ label: AWS_PROFILE_ENV
60
+ })
61
+ };
62
+ return {
63
+ mode: "api-key",
64
+ source: "aws-sdk default chain"
65
+ };
66
+ }
67
+ function hasVertexAdcCredentials() {
68
+ const gacPath = process.env.GOOGLE_APPLICATION_CREDENTIALS;
69
+ if (gacPath) return existsSync(gacPath);
70
+ return existsSync(join(homedir(), ".config", "gcloud", "application_default_credentials.json"));
71
+ }
72
+ async function resolveApiKeyForProvider(params) {
73
+ const { provider, cfg, profileId } = params;
74
+ const store = params.store ?? ensureAuthProfileStore();
75
+ if (profileId) {
76
+ const resolved = await resolveApiKeyForProfile({
77
+ cfg,
78
+ store,
79
+ profileId
80
+ });
81
+ if (!resolved) throw new Error(`No credentials found for profile "${profileId}".`);
82
+ return {
83
+ apiKey: resolved.apiKey,
84
+ profileId,
85
+ source: `profile:${profileId}`,
86
+ mode: "api-key"
87
+ };
88
+ }
89
+ const profiles = listProfilesForProvider(store, provider);
90
+ const preferred = params.preferredProfile;
91
+ const candidates = preferred && profiles.includes(preferred) ? [preferred, ...profiles.filter((id) => id !== preferred)] : profiles;
92
+ for (const candidate of candidates) try {
93
+ const resolved = await resolveApiKeyForProfile({
94
+ cfg,
95
+ store,
96
+ profileId: candidate
97
+ });
98
+ if (resolved) return {
99
+ apiKey: resolved.apiKey,
100
+ profileId: candidate,
101
+ source: `profile:${candidate}`,
102
+ mode: "api-key"
103
+ };
104
+ } catch {}
105
+ const envResolved = resolveEnvApiKey(provider);
106
+ if (envResolved) return {
107
+ apiKey: envResolved.apiKey,
108
+ source: envResolved.source,
109
+ mode: "api-key"
110
+ };
111
+ if (normalizeProviderId(provider) === "amazon-bedrock") return resolveAwsSdkAuthInfo();
112
+ if (provider === "openai") {
113
+ 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.");
114
+ }
115
+ const authStorePath = resolveAuthStorePathForDisplay();
116
+ throw new Error([
117
+ `No API key found for provider "${provider}".`,
118
+ `Auth store: ${authStorePath}.`,
119
+ `Configure auth via ${formatCliCommand("remoteclaw configure")} or ${formatCliCommand("remoteclaw onboard")}.`
120
+ ].join(" "));
121
+ }
122
+ function resolveEnvApiKey(provider) {
123
+ const normalized = normalizeProviderId(provider);
124
+ const applied = new Set(getShellEnvAppliedKeys());
125
+ const pick = (envVar) => {
126
+ const value = normalizeOptionalSecretInput(process.env[envVar]);
127
+ if (!value) return null;
128
+ return {
129
+ apiKey: value,
130
+ source: applied.has(envVar) ? `shell env: ${envVar}` : `env: ${envVar}`
131
+ };
132
+ };
133
+ if (normalized === "github-copilot") return pick("COPILOT_GITHUB_TOKEN") ?? pick("GH_TOKEN") ?? pick("GITHUB_TOKEN");
134
+ if (normalized === "anthropic") return pick("ANTHROPIC_OAUTH_TOKEN") ?? pick("ANTHROPIC_API_KEY");
135
+ if (normalized === "chutes") return pick("CHUTES_OAUTH_TOKEN") ?? pick("CHUTES_API_KEY");
136
+ if (normalized === "zai") return pick("ZAI_API_KEY") ?? pick("Z_AI_API_KEY");
137
+ if (normalized === "google-vertex") {
138
+ const hasCredentials = hasVertexAdcCredentials();
139
+ const hasProject = !!(process.env.GOOGLE_CLOUD_PROJECT || process.env.GCLOUD_PROJECT);
140
+ const hasLocation = !!process.env.GOOGLE_CLOUD_LOCATION;
141
+ if (hasCredentials && hasProject && hasLocation) return {
142
+ apiKey: "<authenticated>",
143
+ source: "gcloud adc"
144
+ };
145
+ return null;
146
+ }
147
+ if (normalized === "opencode") return pick("OPENCODE_API_KEY") ?? pick("OPENCODE_ZEN_API_KEY");
148
+ if (normalized === "qwen-portal") return pick("QWEN_OAUTH_TOKEN") ?? pick("QWEN_PORTAL_API_KEY");
149
+ if (normalized === "volcengine" || normalized === "volcengine-plan") return pick("VOLCANO_ENGINE_API_KEY");
150
+ if (normalized === "byteplus" || normalized === "byteplus-plan") return pick("BYTEPLUS_API_KEY");
151
+ if (normalized === "minimax-portal") return pick("MINIMAX_OAUTH_TOKEN") ?? pick("MINIMAX_API_KEY");
152
+ if (normalized === "kimi-coding") return pick("KIMI_API_KEY") ?? pick("KIMICODE_API_KEY");
153
+ if (normalized === "huggingface") return pick("HUGGINGFACE_HUB_TOKEN") ?? pick("HF_TOKEN");
154
+ if (normalized === "elevenlabs") return pick("ELEVENLABS_API_KEY") ?? pick("XI_API_KEY");
155
+ const envVar = {
156
+ openai: "OPENAI_API_KEY",
157
+ google: "GEMINI_API_KEY",
158
+ voyage: "VOYAGE_API_KEY",
159
+ groq: "GROQ_API_KEY",
160
+ deepgram: "DEEPGRAM_API_KEY",
161
+ cerebras: "CEREBRAS_API_KEY",
162
+ xai: "XAI_API_KEY",
163
+ openrouter: "OPENROUTER_API_KEY",
164
+ litellm: "LITELLM_API_KEY",
165
+ "vercel-ai-gateway": "AI_GATEWAY_API_KEY",
166
+ "cloudflare-ai-gateway": "CLOUDFLARE_AI_GATEWAY_API_KEY",
167
+ moonshot: "MOONSHOT_API_KEY",
168
+ minimax: "MINIMAX_API_KEY",
169
+ nvidia: "NVIDIA_API_KEY",
170
+ xiaomi: "XIAOMI_API_KEY",
171
+ synthetic: "SYNTHETIC_API_KEY",
172
+ venice: "VENICE_API_KEY",
173
+ mistral: "MISTRAL_API_KEY",
174
+ opencode: "OPENCODE_API_KEY",
175
+ together: "TOGETHER_API_KEY",
176
+ qianfan: "QIANFAN_API_KEY",
177
+ ollama: "OLLAMA_API_KEY",
178
+ vllm: "VLLM_API_KEY",
179
+ kilocode: "KILOCODE_API_KEY"
180
+ }[normalized];
181
+ if (!envVar) return null;
182
+ return pick(envVar);
183
+ }
184
+ function resolveModelAuthMode(provider, cfg, store) {
185
+ const resolved = provider?.trim();
186
+ if (!resolved) return;
187
+ if (listProfilesForProvider(store ?? ensureAuthProfileStore(), resolved).length > 0) return "api-key";
188
+ if (normalizeProviderId(resolved) === "amazon-bedrock") return "api-key";
189
+ if (resolveEnvApiKey(resolved)?.apiKey) return "api-key";
190
+ return "unknown";
191
+ }
192
+ function requireApiKey(auth, provider) {
193
+ const key = normalizeSecretInput(auth.apiKey);
194
+ if (key) return key;
195
+ throw new Error(`No API key resolved for provider "${provider}" (auth mode: ${auth.mode}).`);
196
+ }
197
+ function formatApiKeySnippet(apiKey) {
198
+ const compact = apiKey.replace(/\s+/g, "");
199
+ if (!compact) return "unknown";
200
+ const edge = compact.length >= 12 ? 6 : 4;
201
+ return `${compact.slice(0, edge)}…${compact.slice(-edge)}`;
202
+ }
203
+ function resolveModelAuthLabel(params) {
204
+ const resolvedProvider = params.provider?.trim();
205
+ if (!resolvedProvider) return;
206
+ const providerKey = normalizeProviderId(resolvedProvider);
207
+ const store = ensureAuthProfileStore();
208
+ const candidates = [params.sessionEntry?.authProfileOverride?.trim(), ...listProfilesForProvider(store, providerKey)].filter(Boolean);
209
+ for (const profileId of candidates) {
210
+ const profile = store.profiles[profileId];
211
+ if (!profile || normalizeProviderId(profile.provider) !== providerKey) continue;
212
+ const label = resolveAuthProfileDisplayLabel({
213
+ cfg: params.cfg,
214
+ store,
215
+ profileId
216
+ });
217
+ return `api-key ${formatApiKeySnippet(profile.type === "token" ? profile.token : profile.key ?? "")}${label ? ` (${label})` : ""}`;
218
+ }
219
+ const envKey = resolveEnvApiKey(providerKey);
220
+ if (envKey?.apiKey) {
221
+ if (envKey.source.includes("OAUTH_TOKEN")) return `oauth (${envKey.source})`;
222
+ return `api-key ${formatApiKeySnippet(envKey.apiKey)} (${envKey.source})`;
223
+ }
224
+ return "unknown";
225
+ }
226
+
227
+ //#endregion
228
+ //#region src/auto-reply/templating.ts
229
+ function formatTemplateValue(value) {
230
+ if (value == null) return "";
231
+ if (typeof value === "string") return value;
232
+ if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return String(value);
233
+ if (typeof value === "symbol" || typeof value === "function") return value.toString();
234
+ if (Array.isArray(value)) return value.flatMap((entry) => {
235
+ if (entry == null) return [];
236
+ if (typeof entry === "string") return [entry];
237
+ if (typeof entry === "number" || typeof entry === "boolean" || typeof entry === "bigint") return [String(entry)];
238
+ return [];
239
+ }).join(",");
240
+ if (typeof value === "object") return "";
241
+ return "";
242
+ }
243
+ function applyTemplate(str, ctx) {
244
+ if (!str) return "";
245
+ return str.replace(/{{\s*(\w+)\s*}}/g, (_, key) => {
246
+ const value = ctx[key];
247
+ return formatTemplateValue(value);
248
+ });
249
+ }
250
+
251
+ //#endregion
252
+ //#region src/stt/defaults.ts
253
+ const DEFAULT_AUDIO_MODELS = {
254
+ groq: "whisper-large-v3-turbo",
255
+ openai: "gpt-4o-mini-transcribe",
256
+ deepgram: "nova-3",
257
+ mistral: "voxtral-mini-latest"
258
+ };
259
+ const AUTO_AUDIO_KEY_PROVIDERS = [
260
+ "openai",
261
+ "groq",
262
+ "deepgram",
263
+ "google",
264
+ "mistral"
265
+ ];
266
+
267
+ //#endregion
268
+ //#region src/media-understanding/defaults.ts
269
+ const MB = 1024 * 1024;
270
+ const DEFAULT_MAX_CHARS = 500;
271
+ const DEFAULT_MAX_CHARS_BY_CAPABILITY = {
272
+ image: DEFAULT_MAX_CHARS,
273
+ audio: void 0,
274
+ video: DEFAULT_MAX_CHARS
275
+ };
276
+ const DEFAULT_MAX_BYTES = {
277
+ image: 10 * MB,
278
+ audio: 20 * MB,
279
+ video: 50 * MB
280
+ };
281
+ const DEFAULT_TIMEOUT_SECONDS = {
282
+ image: 60,
283
+ audio: 60,
284
+ video: 120
285
+ };
286
+ const DEFAULT_PROMPT = {
287
+ image: "Describe the image.",
288
+ audio: "Transcribe the audio.",
289
+ video: "Describe the video."
290
+ };
291
+ const DEFAULT_VIDEO_MAX_BASE64_BYTES = 70 * MB;
292
+ const AUTO_VIDEO_KEY_PROVIDERS = ["google", "moonshot"];
293
+ const CLI_OUTPUT_MAX_BUFFER = 5 * MB;
294
+ const DEFAULT_MEDIA_CONCURRENCY = 2;
295
+
296
+ //#endregion
297
+ //#region src/media-understanding/providers/anthropic/index.ts
298
+ const anthropicProvider = { id: "anthropic" };
299
+
300
+ //#endregion
301
+ //#region src/media-understanding/providers/shared.ts
302
+ const MAX_ERROR_CHARS = 300;
303
+ function normalizeBaseUrl(baseUrl, fallback) {
304
+ return (baseUrl?.trim() || fallback).replace(/\/+$/, "");
305
+ }
306
+ async function fetchWithTimeoutGuarded(url, init, timeoutMs, fetchFn, options) {
307
+ return await fetchWithSsrFGuard({
308
+ url,
309
+ fetchImpl: fetchFn,
310
+ init,
311
+ timeoutMs,
312
+ policy: options?.ssrfPolicy,
313
+ lookupFn: options?.lookupFn,
314
+ pinDns: options?.pinDns
315
+ });
316
+ }
317
+ async function postTranscriptionRequest(params) {
318
+ return fetchWithTimeoutGuarded(params.url, {
319
+ method: "POST",
320
+ headers: params.headers,
321
+ body: params.body
322
+ }, params.timeoutMs, params.fetchFn, params.allowPrivateNetwork ? { ssrfPolicy: { allowPrivateNetwork: true } } : void 0);
323
+ }
324
+ async function readErrorResponse(res) {
325
+ try {
326
+ const collapsed = (await res.text()).replace(/\s+/g, " ").trim();
327
+ if (!collapsed) return;
328
+ if (collapsed.length <= MAX_ERROR_CHARS) return collapsed;
329
+ return `${collapsed.slice(0, MAX_ERROR_CHARS)}…`;
330
+ } catch {
331
+ return;
332
+ }
333
+ }
334
+ async function assertOkOrThrowHttpError(res, label) {
335
+ if (res.ok) return;
336
+ const detail = await readErrorResponse(res);
337
+ const suffix = detail ? `: ${detail}` : "";
338
+ throw new Error(`${label} (HTTP ${res.status})${suffix}`);
339
+ }
340
+ function requireTranscriptionText(value, missingMessage) {
341
+ const text = value?.trim();
342
+ if (!text) throw new Error(missingMessage);
343
+ return text;
344
+ }
345
+
346
+ //#endregion
347
+ //#region src/stt/providers/deepgram/audio.ts
348
+ const DEFAULT_DEEPGRAM_AUDIO_BASE_URL = "https://api.deepgram.com/v1";
349
+ const DEFAULT_DEEPGRAM_AUDIO_MODEL = "nova-3";
350
+ function resolveModel$2(model) {
351
+ return model?.trim() || DEFAULT_DEEPGRAM_AUDIO_MODEL;
352
+ }
353
+ async function transcribeDeepgramAudio(params) {
354
+ const fetchFn = params.fetchFn ?? fetch;
355
+ const baseUrl = normalizeBaseUrl(params.baseUrl, DEFAULT_DEEPGRAM_AUDIO_BASE_URL);
356
+ const allowPrivate = Boolean(params.baseUrl?.trim());
357
+ const model = resolveModel$2(params.model);
358
+ const url = new URL(`${baseUrl}/listen`);
359
+ url.searchParams.set("model", model);
360
+ if (params.language?.trim()) url.searchParams.set("language", params.language.trim());
361
+ if (params.query) for (const [key, value] of Object.entries(params.query)) {
362
+ if (value === void 0) continue;
363
+ url.searchParams.set(key, String(value));
364
+ }
365
+ const headers = new Headers(params.headers);
366
+ if (!headers.has("authorization")) headers.set("authorization", `Token ${params.apiKey}`);
367
+ if (!headers.has("content-type")) headers.set("content-type", params.mime ?? "application/octet-stream");
368
+ const body = new Uint8Array(params.buffer);
369
+ const { response: res, release } = await postTranscriptionRequest({
370
+ url: url.toString(),
371
+ headers,
372
+ body,
373
+ timeoutMs: params.timeoutMs,
374
+ fetchFn,
375
+ allowPrivateNetwork: allowPrivate
376
+ });
377
+ try {
378
+ await assertOkOrThrowHttpError(res, "Audio transcription failed");
379
+ return {
380
+ text: requireTranscriptionText((await res.json()).results?.channels?.[0]?.alternatives?.[0]?.transcript, "Audio transcription response missing transcript"),
381
+ model
382
+ };
383
+ } finally {
384
+ await release();
385
+ }
386
+ }
387
+
388
+ //#endregion
389
+ //#region src/media-understanding/providers/deepgram/index.ts
390
+ const deepgramProvider = {
391
+ id: "deepgram",
392
+ capabilities: ["audio"],
393
+ transcribeAudio: transcribeDeepgramAudio
394
+ };
395
+
396
+ //#endregion
397
+ //#region src/infra/gemini-auth.ts
398
+ /**
399
+ * Shared Gemini authentication utilities.
400
+ *
401
+ * Supports both traditional API keys and OAuth JSON format.
402
+ */
403
+ /**
404
+ * Parse Gemini API key and return appropriate auth headers.
405
+ *
406
+ * OAuth format: `{"token": "...", "projectId": "..."}`
407
+ *
408
+ * @param apiKey - Either a traditional API key string or OAuth JSON
409
+ * @returns Headers object with appropriate authentication
410
+ */
411
+ function parseGeminiAuth(apiKey) {
412
+ if (apiKey.startsWith("{")) try {
413
+ const parsed = JSON.parse(apiKey);
414
+ if (typeof parsed.token === "string" && parsed.token) return { headers: {
415
+ Authorization: `Bearer ${parsed.token}`,
416
+ "Content-Type": "application/json"
417
+ } };
418
+ } catch {}
419
+ return { headers: {
420
+ "x-goog-api-key": apiKey,
421
+ "Content-Type": "application/json"
422
+ } };
423
+ }
424
+
425
+ //#endregion
426
+ //#region src/media-understanding/providers/google/inline-data.ts
427
+ async function generateGeminiInlineDataText(params) {
428
+ const fetchFn = params.fetchFn ?? fetch;
429
+ const baseUrl = normalizeBaseUrl(params.baseUrl, params.defaultBaseUrl);
430
+ const allowPrivate = Boolean(params.baseUrl?.trim());
431
+ const model = (() => {
432
+ const trimmed = params.model?.trim();
433
+ if (!trimmed) return params.defaultModel;
434
+ return normalizeGoogleModelId(trimmed);
435
+ })();
436
+ const url = `${baseUrl}/models/${model}:generateContent`;
437
+ const authHeaders = parseGeminiAuth(params.apiKey);
438
+ const headers = new Headers(params.headers);
439
+ for (const [key, value] of Object.entries(authHeaders.headers)) if (!headers.has(key)) headers.set(key, value);
440
+ const body = { contents: [{
441
+ role: "user",
442
+ parts: [{ text: params.prompt?.trim() || params.defaultPrompt }, { inline_data: {
443
+ mime_type: params.mime ?? params.defaultMime,
444
+ data: params.buffer.toString("base64")
445
+ } }]
446
+ }] };
447
+ const { response: res, release } = await fetchWithTimeoutGuarded(url, {
448
+ method: "POST",
449
+ headers,
450
+ body: JSON.stringify(body)
451
+ }, params.timeoutMs, fetchFn, allowPrivate ? { ssrfPolicy: { allowPrivateNetwork: true } } : void 0);
452
+ try {
453
+ await assertOkOrThrowHttpError(res, params.httpErrorLabel);
454
+ const text = ((await res.json()).candidates?.[0]?.content?.parts ?? []).map((part) => part?.text?.trim()).filter(Boolean).join("\n");
455
+ if (!text) throw new Error(params.missingTextError);
456
+ return {
457
+ text,
458
+ model
459
+ };
460
+ } finally {
461
+ await release();
462
+ }
463
+ }
464
+
465
+ //#endregion
466
+ //#region src/stt/providers/google/audio.ts
467
+ const DEFAULT_GOOGLE_AUDIO_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
468
+ const DEFAULT_GOOGLE_AUDIO_MODEL = "gemini-3-flash-preview";
469
+ const DEFAULT_GOOGLE_AUDIO_PROMPT = "Transcribe the audio.";
470
+ async function transcribeGeminiAudio(params) {
471
+ const { text, model } = await generateGeminiInlineDataText({
472
+ ...params,
473
+ defaultBaseUrl: DEFAULT_GOOGLE_AUDIO_BASE_URL,
474
+ defaultModel: DEFAULT_GOOGLE_AUDIO_MODEL,
475
+ defaultPrompt: DEFAULT_GOOGLE_AUDIO_PROMPT,
476
+ defaultMime: "audio/wav",
477
+ httpErrorLabel: "Audio transcription failed",
478
+ missingTextError: "Audio transcription response missing text"
479
+ });
480
+ return {
481
+ text,
482
+ model
483
+ };
484
+ }
485
+
486
+ //#endregion
487
+ //#region src/media-understanding/providers/google/video.ts
488
+ const DEFAULT_GOOGLE_VIDEO_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
489
+ const DEFAULT_GOOGLE_VIDEO_MODEL = "gemini-3-flash-preview";
490
+ const DEFAULT_GOOGLE_VIDEO_PROMPT = "Describe the video.";
491
+ async function describeGeminiVideo(params) {
492
+ const { text, model } = await generateGeminiInlineDataText({
493
+ ...params,
494
+ defaultBaseUrl: DEFAULT_GOOGLE_VIDEO_BASE_URL,
495
+ defaultModel: DEFAULT_GOOGLE_VIDEO_MODEL,
496
+ defaultPrompt: DEFAULT_GOOGLE_VIDEO_PROMPT,
497
+ defaultMime: "video/mp4",
498
+ httpErrorLabel: "Video description failed",
499
+ missingTextError: "Video description response missing text"
500
+ });
501
+ return {
502
+ text,
503
+ model
504
+ };
505
+ }
506
+
507
+ //#endregion
508
+ //#region src/media-understanding/providers/google/index.ts
509
+ const googleProvider = {
510
+ id: "google",
511
+ capabilities: ["audio", "video"],
512
+ transcribeAudio: transcribeGeminiAudio,
513
+ describeVideo: describeGeminiVideo
514
+ };
515
+
516
+ //#endregion
517
+ //#region src/stt/providers/openai/audio.ts
518
+ const DEFAULT_OPENAI_AUDIO_BASE_URL = "https://api.openai.com/v1";
519
+ const DEFAULT_OPENAI_AUDIO_MODEL = "gpt-4o-mini-transcribe";
520
+ function resolveModel$1(model) {
521
+ return model?.trim() || DEFAULT_OPENAI_AUDIO_MODEL;
522
+ }
523
+ async function transcribeOpenAiCompatibleAudio(params) {
524
+ const fetchFn = params.fetchFn ?? fetch;
525
+ const baseUrl = normalizeBaseUrl(params.baseUrl, DEFAULT_OPENAI_AUDIO_BASE_URL);
526
+ const allowPrivate = Boolean(params.baseUrl?.trim());
527
+ const url = `${baseUrl}/audio/transcriptions`;
528
+ const model = resolveModel$1(params.model);
529
+ const form = new FormData();
530
+ const fileName = params.fileName?.trim() || path.basename(params.fileName) || "audio";
531
+ const bytes = new Uint8Array(params.buffer);
532
+ const blob = new Blob([bytes], { type: params.mime ?? "application/octet-stream" });
533
+ form.append("file", blob, fileName);
534
+ form.append("model", model);
535
+ if (params.language?.trim()) form.append("language", params.language.trim());
536
+ if (params.prompt?.trim()) form.append("prompt", params.prompt.trim());
537
+ const headers = new Headers(params.headers);
538
+ if (!headers.has("authorization")) headers.set("authorization", `Bearer ${params.apiKey}`);
539
+ const { response: res, release } = await postTranscriptionRequest({
540
+ url,
541
+ headers,
542
+ body: form,
543
+ timeoutMs: params.timeoutMs,
544
+ fetchFn,
545
+ allowPrivateNetwork: allowPrivate
546
+ });
547
+ try {
548
+ await assertOkOrThrowHttpError(res, "Audio transcription failed");
549
+ return {
550
+ text: requireTranscriptionText((await res.json()).text, "Audio transcription response missing text"),
551
+ model
552
+ };
553
+ } finally {
554
+ await release();
555
+ }
556
+ }
557
+
558
+ //#endregion
559
+ //#region src/media-understanding/providers/groq/index.ts
560
+ const DEFAULT_GROQ_AUDIO_BASE_URL$1 = "https://api.groq.com/openai/v1";
561
+ const groqProvider = {
562
+ id: "groq",
563
+ capabilities: ["audio"],
564
+ transcribeAudio: (req) => transcribeOpenAiCompatibleAudio({
565
+ ...req,
566
+ baseUrl: req.baseUrl ?? DEFAULT_GROQ_AUDIO_BASE_URL$1
567
+ })
568
+ };
569
+
570
+ //#endregion
571
+ //#region src/media-understanding/providers/minimax/index.ts
572
+ const minimaxProvider = { id: "minimax" };
573
+
574
+ //#endregion
575
+ //#region src/media-understanding/providers/mistral/index.ts
576
+ const DEFAULT_MISTRAL_AUDIO_BASE_URL$1 = "https://api.mistral.ai/v1";
577
+ const mistralProvider = {
578
+ id: "mistral",
579
+ capabilities: ["audio"],
580
+ transcribeAudio: (req) => transcribeOpenAiCompatibleAudio({
581
+ ...req,
582
+ baseUrl: req.baseUrl ?? DEFAULT_MISTRAL_AUDIO_BASE_URL$1
583
+ })
584
+ };
585
+
586
+ //#endregion
587
+ //#region src/media-understanding/providers/moonshot/video.ts
588
+ const DEFAULT_MOONSHOT_VIDEO_BASE_URL = "https://api.moonshot.ai/v1";
589
+ const DEFAULT_MOONSHOT_VIDEO_MODEL = "kimi-k2.5";
590
+ const DEFAULT_MOONSHOT_VIDEO_PROMPT = "Describe the video.";
591
+ function resolveModel(model) {
592
+ return model?.trim() || DEFAULT_MOONSHOT_VIDEO_MODEL;
593
+ }
594
+ function resolvePrompt$1(prompt) {
595
+ return prompt?.trim() || DEFAULT_MOONSHOT_VIDEO_PROMPT;
596
+ }
597
+ function coerceMoonshotText(payload) {
598
+ const message = payload.choices?.[0]?.message;
599
+ if (!message) return null;
600
+ if (typeof message.content === "string" && message.content.trim()) return message.content.trim();
601
+ if (Array.isArray(message.content)) {
602
+ const text = message.content.map((part) => typeof part.text === "string" ? part.text.trim() : "").filter(Boolean).join("\n").trim();
603
+ if (text) return text;
604
+ }
605
+ if (typeof message.reasoning_content === "string" && message.reasoning_content.trim()) return message.reasoning_content.trim();
606
+ return null;
607
+ }
608
+ async function describeMoonshotVideo(params) {
609
+ const fetchFn = params.fetchFn ?? fetch;
610
+ const baseUrl = normalizeBaseUrl(params.baseUrl, DEFAULT_MOONSHOT_VIDEO_BASE_URL);
611
+ const model = resolveModel(params.model);
612
+ const mime = params.mime ?? "video/mp4";
613
+ const prompt = resolvePrompt$1(params.prompt);
614
+ const url = `${baseUrl}/chat/completions`;
615
+ const headers = new Headers(params.headers);
616
+ if (!headers.has("content-type")) headers.set("content-type", "application/json");
617
+ if (!headers.has("authorization")) headers.set("authorization", `Bearer ${params.apiKey}`);
618
+ const body = {
619
+ model,
620
+ messages: [{
621
+ role: "user",
622
+ content: [{
623
+ type: "text",
624
+ text: prompt
625
+ }, {
626
+ type: "video_url",
627
+ video_url: { url: `data:${mime};base64,${params.buffer.toString("base64")}` }
628
+ }]
629
+ }]
630
+ };
631
+ const { response: res, release } = await fetchWithTimeoutGuarded(url, {
632
+ method: "POST",
633
+ headers,
634
+ body: JSON.stringify(body)
635
+ }, params.timeoutMs, fetchFn);
636
+ try {
637
+ await assertOkOrThrowHttpError(res, "Moonshot video description failed");
638
+ const text = coerceMoonshotText(await res.json());
639
+ if (!text) throw new Error("Moonshot video description response missing content");
640
+ return {
641
+ text,
642
+ model
643
+ };
644
+ } finally {
645
+ await release();
646
+ }
647
+ }
648
+
649
+ //#endregion
650
+ //#region src/media-understanding/providers/moonshot/index.ts
651
+ const moonshotProvider = {
652
+ id: "moonshot",
653
+ capabilities: ["video"],
654
+ describeVideo: describeMoonshotVideo
655
+ };
656
+
657
+ //#endregion
658
+ //#region src/media-understanding/providers/openai/index.ts
659
+ const openaiProvider = {
660
+ id: "openai",
661
+ transcribeAudio: transcribeOpenAiCompatibleAudio
662
+ };
663
+
664
+ //#endregion
665
+ //#region src/media-understanding/providers/zai/index.ts
666
+ const zaiProvider = { id: "zai" };
667
+
668
+ //#endregion
669
+ //#region src/media-understanding/providers/index.ts
670
+ const PROVIDERS = [
671
+ groqProvider,
672
+ openaiProvider,
673
+ googleProvider,
674
+ anthropicProvider,
675
+ minimaxProvider,
676
+ moonshotProvider,
677
+ mistralProvider,
678
+ zaiProvider,
679
+ deepgramProvider
680
+ ];
681
+ function normalizeMediaProviderId(id) {
682
+ const normalized = normalizeProviderId(id);
683
+ if (normalized === "gemini") return "google";
684
+ return normalized;
685
+ }
686
+ function buildMediaUnderstandingRegistry(overrides) {
687
+ const registry = /* @__PURE__ */ new Map();
688
+ for (const provider of PROVIDERS) registry.set(normalizeMediaProviderId(provider.id), provider);
689
+ if (overrides) for (const [key, provider] of Object.entries(overrides)) {
690
+ const normalizedKey = normalizeMediaProviderId(key);
691
+ const existing = registry.get(normalizedKey);
692
+ const merged = existing ? {
693
+ ...existing,
694
+ ...provider,
695
+ capabilities: provider.capabilities ?? existing.capabilities
696
+ } : provider;
697
+ registry.set(normalizedKey, merged);
698
+ }
699
+ return registry;
700
+ }
701
+ function getMediaUnderstandingProvider(id, registry) {
702
+ return registry.get(normalizeMediaProviderId(id));
703
+ }
704
+
705
+ //#endregion
706
+ //#region src/media-understanding/scope.ts
707
+ function normalizeDecision(value) {
708
+ const normalized = value?.trim().toLowerCase();
709
+ if (normalized === "allow") return "allow";
710
+ if (normalized === "deny") return "deny";
711
+ }
712
+ function normalizeMatch(value) {
713
+ return value?.trim().toLowerCase() || void 0;
714
+ }
715
+ function normalizeMediaUnderstandingChatType(raw) {
716
+ return normalizeChatType(raw ?? void 0);
717
+ }
718
+ function resolveMediaUnderstandingScope(params) {
719
+ const scope = params.scope;
720
+ if (!scope) return "allow";
721
+ const channel = normalizeMatch(params.channel);
722
+ const chatType = normalizeMediaUnderstandingChatType(params.chatType);
723
+ const sessionKey = normalizeMatch(params.sessionKey) ?? "";
724
+ for (const rule of scope.rules ?? []) {
725
+ if (!rule) continue;
726
+ const action = normalizeDecision(rule.action) ?? "allow";
727
+ const match = rule.match ?? {};
728
+ const matchChannel = normalizeMatch(match.channel);
729
+ const matchChatType = normalizeMediaUnderstandingChatType(match.chatType);
730
+ const matchPrefix = normalizeMatch(match.keyPrefix);
731
+ if (matchChannel && matchChannel !== channel) continue;
732
+ if (matchChatType && matchChatType !== chatType) continue;
733
+ if (matchPrefix && !sessionKey.startsWith(matchPrefix)) continue;
734
+ return action;
735
+ }
736
+ return normalizeDecision(scope.default) ?? "allow";
737
+ }
738
+
739
+ //#endregion
740
+ //#region src/media-understanding/resolve.ts
741
+ function resolveTimeoutMs(seconds, fallbackSeconds) {
742
+ const value = typeof seconds === "number" && Number.isFinite(seconds) ? seconds : fallbackSeconds;
743
+ return Math.max(1e3, Math.floor(value * 1e3));
744
+ }
745
+ function resolvePrompt(capability, prompt, maxChars) {
746
+ const base = prompt?.trim() || DEFAULT_PROMPT[capability];
747
+ if (!maxChars || capability === "audio") return base;
748
+ return `${base} Respond in at most ${maxChars} characters.`;
749
+ }
750
+ function resolveMaxChars(params) {
751
+ const { capability, entry, cfg } = params;
752
+ const configured = entry.maxChars ?? params.config?.maxChars ?? cfg.tools?.media?.[capability]?.maxChars;
753
+ if (typeof configured === "number") return configured;
754
+ return DEFAULT_MAX_CHARS_BY_CAPABILITY[capability];
755
+ }
756
+ function resolveMaxBytes(params) {
757
+ const configured = params.entry.maxBytes ?? params.config?.maxBytes ?? params.cfg.tools?.media?.[params.capability]?.maxBytes;
758
+ if (typeof configured === "number") return configured;
759
+ return DEFAULT_MAX_BYTES[params.capability];
760
+ }
761
+ function resolveScopeDecision(params) {
762
+ return resolveMediaUnderstandingScope({
763
+ scope: params.scope,
764
+ sessionKey: params.ctx.SessionKey,
765
+ channel: params.ctx.Surface ?? params.ctx.Provider,
766
+ chatType: normalizeMediaUnderstandingChatType(params.ctx.ChatType)
767
+ });
768
+ }
769
+ function resolveEntryCapabilities(params) {
770
+ if ((params.entry.type ?? (params.entry.command ? "cli" : "provider")) === "cli") return;
771
+ const providerId = normalizeMediaProviderId(params.entry.provider ?? "");
772
+ if (!providerId) return;
773
+ return params.providerRegistry.get(providerId)?.capabilities;
774
+ }
775
+ function resolveModelEntries(params) {
776
+ const { cfg, capability, config } = params;
777
+ const sharedModels = cfg.tools?.media?.models ?? [];
778
+ const entries = [...(config?.models ?? []).map((entry) => ({
779
+ entry,
780
+ source: "capability"
781
+ })), ...sharedModels.map((entry) => ({
782
+ entry,
783
+ source: "shared"
784
+ }))];
785
+ if (entries.length === 0) return [];
786
+ return entries.filter(({ entry, source }) => {
787
+ const caps = entry.capabilities && entry.capabilities.length > 0 ? entry.capabilities : source === "shared" ? resolveEntryCapabilities({
788
+ entry,
789
+ providerRegistry: params.providerRegistry
790
+ }) : void 0;
791
+ if (!caps || caps.length === 0) {
792
+ if (source === "shared") {
793
+ if (shouldLogVerbose()) logVerbose(`Skipping shared media model without capabilities: ${entry.provider ?? entry.command ?? "unknown"}`);
794
+ return false;
795
+ }
796
+ return true;
797
+ }
798
+ return caps.includes(capability);
799
+ }).map(({ entry }) => entry);
800
+ }
801
+ function resolveConcurrency(cfg) {
802
+ const configured = cfg.tools?.media?.concurrency;
803
+ if (typeof configured === "number" && Number.isFinite(configured) && configured > 0) return Math.floor(configured);
804
+ return DEFAULT_MEDIA_CONCURRENCY;
805
+ }
806
+
807
+ //#endregion
808
+ //#region src/infra/unhandled-rejections.ts
809
+ const handlers = /* @__PURE__ */ new Set();
810
+ const FATAL_ERROR_CODES = new Set([
811
+ "ERR_OUT_OF_MEMORY",
812
+ "ERR_SCRIPT_EXECUTION_TIMEOUT",
813
+ "ERR_WORKER_OUT_OF_MEMORY",
814
+ "ERR_WORKER_UNCAUGHT_EXCEPTION",
815
+ "ERR_WORKER_INITIALIZATION_FAILED"
816
+ ]);
817
+ const CONFIG_ERROR_CODES = new Set([
818
+ "INVALID_CONFIG",
819
+ "MISSING_API_KEY",
820
+ "MISSING_CREDENTIALS"
821
+ ]);
822
+ const TRANSIENT_NETWORK_CODES = new Set([
823
+ "ECONNRESET",
824
+ "ECONNREFUSED",
825
+ "ENOTFOUND",
826
+ "ETIMEDOUT",
827
+ "ESOCKETTIMEDOUT",
828
+ "ECONNABORTED",
829
+ "EPIPE",
830
+ "EHOSTUNREACH",
831
+ "ENETUNREACH",
832
+ "EAI_AGAIN",
833
+ "UND_ERR_CONNECT_TIMEOUT",
834
+ "UND_ERR_DNS_RESOLVE_FAILED",
835
+ "UND_ERR_CONNECT",
836
+ "UND_ERR_SOCKET",
837
+ "UND_ERR_HEADERS_TIMEOUT",
838
+ "UND_ERR_BODY_TIMEOUT"
839
+ ]);
840
+ const TRANSIENT_NETWORK_ERROR_NAMES = new Set([
841
+ "AbortError",
842
+ "ConnectTimeoutError",
843
+ "HeadersTimeoutError",
844
+ "BodyTimeoutError",
845
+ "TimeoutError"
846
+ ]);
847
+ 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;
848
+ const TRANSIENT_NETWORK_MESSAGE_SNIPPETS = [
849
+ "getaddrinfo",
850
+ "socket hang up",
851
+ "network error",
852
+ "network is unreachable",
853
+ "temporary failure in name resolution"
854
+ ];
855
+ function getErrorCause(err) {
856
+ if (!err || typeof err !== "object") return;
857
+ return err.cause;
858
+ }
859
+ function getErrorName(err) {
860
+ if (!err || typeof err !== "object") return "";
861
+ const name = err.name;
862
+ return typeof name === "string" ? name : "";
863
+ }
864
+ function extractErrorCodeOrErrno(err) {
865
+ const code = extractErrorCode(err);
866
+ if (code) return code.trim().toUpperCase();
867
+ if (!err || typeof err !== "object") return;
868
+ const errno = err.errno;
869
+ if (typeof errno === "string" && errno.trim()) return errno.trim().toUpperCase();
870
+ if (typeof errno === "number" && Number.isFinite(errno)) return String(errno);
871
+ }
872
+ function extractErrorCodeWithCause(err) {
873
+ const direct = extractErrorCode(err);
874
+ if (direct) return direct;
875
+ return extractErrorCode(getErrorCause(err));
876
+ }
877
+ function collectErrorCandidates(err) {
878
+ const queue = [err];
879
+ const seen = /* @__PURE__ */ new Set();
880
+ const candidates = [];
881
+ while (queue.length > 0) {
882
+ const current = queue.shift();
883
+ if (current == null || seen.has(current)) continue;
884
+ seen.add(current);
885
+ candidates.push(current);
886
+ if (!current || typeof current !== "object") continue;
887
+ const maybeNested = [
888
+ current.cause,
889
+ current.reason,
890
+ current.original,
891
+ current.error,
892
+ current.data
893
+ ];
894
+ const errors = current.errors;
895
+ if (Array.isArray(errors)) maybeNested.push(...errors);
896
+ for (const nested of maybeNested) if (nested != null && !seen.has(nested)) queue.push(nested);
897
+ }
898
+ return candidates;
899
+ }
900
+ /**
901
+ * Checks if an error is an AbortError.
902
+ * These are typically intentional cancellations (e.g., during shutdown) and shouldn't crash.
903
+ */
904
+ function isAbortError(err) {
905
+ if (!err || typeof err !== "object") return false;
906
+ if (("name" in err ? String(err.name) : "") === "AbortError") return true;
907
+ if (("message" in err && typeof err.message === "string" ? err.message : "") === "This operation was aborted") return true;
908
+ return false;
909
+ }
910
+ function isFatalError(err) {
911
+ const code = extractErrorCodeWithCause(err);
912
+ return code !== void 0 && FATAL_ERROR_CODES.has(code);
913
+ }
914
+ function isConfigError(err) {
915
+ const code = extractErrorCodeWithCause(err);
916
+ return code !== void 0 && CONFIG_ERROR_CODES.has(code);
917
+ }
918
+ /**
919
+ * Checks if an error is a transient network error that shouldn't crash the gateway.
920
+ * These are typically temporary connectivity issues that will resolve on their own.
921
+ */
922
+ function isTransientNetworkError(err) {
923
+ if (!err) return false;
924
+ for (const candidate of collectErrorCandidates(err)) {
925
+ const code = extractErrorCodeOrErrno(candidate);
926
+ if (code && TRANSIENT_NETWORK_CODES.has(code)) return true;
927
+ const name = getErrorName(candidate);
928
+ if (name && TRANSIENT_NETWORK_ERROR_NAMES.has(name)) return true;
929
+ if (candidate instanceof TypeError && candidate.message === "fetch failed") return true;
930
+ if (!candidate || typeof candidate !== "object") continue;
931
+ const rawMessage = candidate.message;
932
+ const message = typeof rawMessage === "string" ? rawMessage.toLowerCase().trim() : "";
933
+ if (!message) continue;
934
+ if (TRANSIENT_NETWORK_MESSAGE_CODE_RE.test(message)) return true;
935
+ if (message === "fetch failed") return true;
936
+ if (TRANSIENT_NETWORK_MESSAGE_SNIPPETS.some((snippet) => message.includes(snippet))) return true;
937
+ }
938
+ return false;
939
+ }
940
+ function registerUnhandledRejectionHandler(handler) {
941
+ handlers.add(handler);
942
+ return () => {
943
+ handlers.delete(handler);
944
+ };
945
+ }
946
+ function isUnhandledRejectionHandled(reason) {
947
+ for (const handler of handlers) try {
948
+ if (handler(reason)) return true;
949
+ } catch (err) {
950
+ console.error("[remoteclaw] Unhandled rejection handler failed:", err instanceof Error ? err.stack ?? err.message : err);
951
+ }
952
+ return false;
953
+ }
954
+ function installUnhandledRejectionHandler() {
955
+ process$1.on("unhandledRejection", (reason, _promise) => {
956
+ if (isUnhandledRejectionHandled(reason)) return;
957
+ if (isAbortError(reason)) {
958
+ console.warn("[remoteclaw] Suppressed AbortError:", formatUncaughtError(reason));
959
+ return;
960
+ }
961
+ if (isFatalError(reason)) {
962
+ console.error("[remoteclaw] FATAL unhandled rejection:", formatUncaughtError(reason));
963
+ process$1.exit(1);
964
+ return;
965
+ }
966
+ if (isConfigError(reason)) {
967
+ console.error("[remoteclaw] CONFIGURATION ERROR - requires fix:", formatUncaughtError(reason));
968
+ process$1.exit(1);
969
+ return;
970
+ }
971
+ if (isTransientNetworkError(reason)) {
972
+ console.warn("[remoteclaw] Non-fatal unhandled rejection (continuing):", formatUncaughtError(reason));
973
+ return;
974
+ }
975
+ console.error("[remoteclaw] Unhandled promise rejection:", formatUncaughtError(reason));
976
+ process$1.exit(1);
977
+ });
978
+ }
979
+
980
+ //#endregion
981
+ //#region src/plugin-sdk/temp-path.ts
982
+ function sanitizePrefix(prefix) {
983
+ return prefix.replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || "tmp";
984
+ }
985
+ function sanitizeExtension(extension) {
986
+ if (!extension) return "";
987
+ const token = ((extension.startsWith(".") ? extension : `.${extension}`).match(/[a-zA-Z0-9._-]+$/)?.[0] ?? "").replace(/^[._-]+/, "");
988
+ if (!token) return "";
989
+ return `.${token}`;
990
+ }
991
+ function resolveTempRoot(tmpDir) {
992
+ return tmpDir ?? resolvePreferredRemoteClawTmpDir();
993
+ }
994
+ function buildRandomTempFilePath(params) {
995
+ const prefix = sanitizePrefix(params.prefix);
996
+ const extension = sanitizeExtension(params.extension);
997
+ const nowCandidate = params.now;
998
+ const now = typeof nowCandidate === "number" && Number.isFinite(nowCandidate) ? Math.trunc(nowCandidate) : Date.now();
999
+ const uuid = params.uuid?.trim() || crypto.randomUUID();
1000
+ return path.join(resolveTempRoot(params.tmpDir), `${prefix}-${now}-${uuid}${extension}`);
1001
+ }
1002
+
1003
+ //#endregion
1004
+ //#region src/media-understanding/errors.ts
1005
+ var MediaUnderstandingSkipError = class extends Error {
1006
+ constructor(reason, message) {
1007
+ super(message);
1008
+ this.reason = reason;
1009
+ this.name = "MediaUnderstandingSkipError";
1010
+ }
1011
+ };
1012
+ function isMediaUnderstandingSkipError(err) {
1013
+ return err instanceof MediaUnderstandingSkipError;
1014
+ }
1015
+
1016
+ //#endregion
1017
+ //#region src/media-understanding/attachments.ts
1018
+ const DEFAULT_MAX_ATTACHMENTS = 1;
1019
+ const DEFAULT_LOCAL_PATH_ROOTS = mergeInboundPathRoots(getDefaultMediaLocalRoots(), DEFAULT_IMESSAGE_ATTACHMENT_ROOTS);
1020
+ function normalizeAttachmentPath(raw) {
1021
+ const value = raw?.trim();
1022
+ if (!value) return;
1023
+ if (value.startsWith("file://")) try {
1024
+ return fileURLToPath(value);
1025
+ } catch {
1026
+ return;
1027
+ }
1028
+ return value;
1029
+ }
1030
+ function normalizeAttachments(ctx) {
1031
+ const pathsFromArray = Array.isArray(ctx.MediaPaths) ? ctx.MediaPaths : void 0;
1032
+ const urlsFromArray = Array.isArray(ctx.MediaUrls) ? ctx.MediaUrls : void 0;
1033
+ const typesFromArray = Array.isArray(ctx.MediaTypes) ? ctx.MediaTypes : void 0;
1034
+ const resolveMime = (count, index) => {
1035
+ const typeHint = typesFromArray?.[index];
1036
+ const trimmed = typeof typeHint === "string" ? typeHint.trim() : "";
1037
+ if (trimmed) return trimmed;
1038
+ return count === 1 ? ctx.MediaType : void 0;
1039
+ };
1040
+ if (pathsFromArray && pathsFromArray.length > 0) {
1041
+ const count = pathsFromArray.length;
1042
+ const urls = urlsFromArray && urlsFromArray.length > 0 ? urlsFromArray : void 0;
1043
+ return pathsFromArray.map((value, index) => ({
1044
+ path: value?.trim() || void 0,
1045
+ url: urls?.[index] ?? ctx.MediaUrl,
1046
+ mime: resolveMime(count, index),
1047
+ index
1048
+ })).filter((entry) => Boolean(entry.path?.trim() || entry.url?.trim()));
1049
+ }
1050
+ if (urlsFromArray && urlsFromArray.length > 0) {
1051
+ const count = urlsFromArray.length;
1052
+ return urlsFromArray.map((value, index) => ({
1053
+ path: void 0,
1054
+ url: value?.trim() || void 0,
1055
+ mime: resolveMime(count, index),
1056
+ index
1057
+ })).filter((entry) => Boolean(entry.url?.trim()));
1058
+ }
1059
+ const pathValue = ctx.MediaPath?.trim();
1060
+ const url = ctx.MediaUrl?.trim();
1061
+ if (!pathValue && !url) return [];
1062
+ return [{
1063
+ path: pathValue || void 0,
1064
+ url: url || void 0,
1065
+ mime: ctx.MediaType,
1066
+ index: 0
1067
+ }];
1068
+ }
1069
+ function resolveAttachmentKind(attachment) {
1070
+ const kind = kindFromMime(attachment.mime);
1071
+ if (kind === "image" || kind === "audio" || kind === "video") return kind;
1072
+ const ext = getFileExtension(attachment.path ?? attachment.url);
1073
+ if (!ext) return "unknown";
1074
+ if ([
1075
+ ".mp4",
1076
+ ".mov",
1077
+ ".mkv",
1078
+ ".webm",
1079
+ ".avi",
1080
+ ".m4v"
1081
+ ].includes(ext)) return "video";
1082
+ if (isAudioFileName(attachment.path ?? attachment.url)) return "audio";
1083
+ if ([
1084
+ ".png",
1085
+ ".jpg",
1086
+ ".jpeg",
1087
+ ".webp",
1088
+ ".gif",
1089
+ ".bmp",
1090
+ ".tiff",
1091
+ ".tif"
1092
+ ].includes(ext)) return "image";
1093
+ return "unknown";
1094
+ }
1095
+ function isVideoAttachment(attachment) {
1096
+ return resolveAttachmentKind(attachment) === "video";
1097
+ }
1098
+ function isAudioAttachment(attachment) {
1099
+ return resolveAttachmentKind(attachment) === "audio";
1100
+ }
1101
+ function isImageAttachment(attachment) {
1102
+ return resolveAttachmentKind(attachment) === "image";
1103
+ }
1104
+ function resolveRequestUrl(input) {
1105
+ if (typeof input === "string") return input;
1106
+ if (input instanceof URL) return input.toString();
1107
+ return input.url;
1108
+ }
1109
+ function orderAttachments(attachments, prefer) {
1110
+ if (!prefer || prefer === "first") return attachments;
1111
+ if (prefer === "last") return [...attachments].toReversed();
1112
+ if (prefer === "path") {
1113
+ const withPath = attachments.filter((item) => item.path);
1114
+ const withoutPath = attachments.filter((item) => !item.path);
1115
+ return [...withPath, ...withoutPath];
1116
+ }
1117
+ if (prefer === "url") {
1118
+ const withUrl = attachments.filter((item) => item.url);
1119
+ const withoutUrl = attachments.filter((item) => !item.url);
1120
+ return [...withUrl, ...withoutUrl];
1121
+ }
1122
+ return attachments;
1123
+ }
1124
+ function selectAttachments(params) {
1125
+ const { capability, attachments, policy } = params;
1126
+ const matches = attachments.filter((item) => {
1127
+ if (capability === "audio" && item.alreadyTranscribed) return false;
1128
+ if (capability === "image") return isImageAttachment(item);
1129
+ if (capability === "audio") return isAudioAttachment(item);
1130
+ return isVideoAttachment(item);
1131
+ });
1132
+ if (matches.length === 0) return [];
1133
+ const ordered = orderAttachments(matches, policy?.prefer);
1134
+ const mode = policy?.mode ?? "first";
1135
+ const maxAttachments = policy?.maxAttachments ?? DEFAULT_MAX_ATTACHMENTS;
1136
+ if (mode === "all") return ordered.slice(0, Math.max(1, maxAttachments));
1137
+ return ordered.slice(0, 1);
1138
+ }
1139
+ var MediaAttachmentCache = class {
1140
+ constructor(attachments, options) {
1141
+ this.entries = /* @__PURE__ */ new Map();
1142
+ this.attachments = attachments;
1143
+ this.localPathRoots = mergeInboundPathRoots(options?.localPathRoots, DEFAULT_LOCAL_PATH_ROOTS);
1144
+ for (const attachment of attachments) this.entries.set(attachment.index, { attachment });
1145
+ }
1146
+ async getBuffer(params) {
1147
+ const entry = await this.ensureEntry(params.attachmentIndex);
1148
+ if (entry.buffer) {
1149
+ if (entry.buffer.length > params.maxBytes) throw new MediaUnderstandingSkipError("maxBytes", `Attachment ${params.attachmentIndex + 1} exceeds maxBytes ${params.maxBytes}`);
1150
+ return {
1151
+ buffer: entry.buffer,
1152
+ mime: entry.bufferMime,
1153
+ fileName: entry.bufferFileName ?? `media-${params.attachmentIndex + 1}`,
1154
+ size: entry.buffer.length
1155
+ };
1156
+ }
1157
+ if (entry.resolvedPath) {
1158
+ const size = await this.ensureLocalStat(entry);
1159
+ if (entry.resolvedPath) {
1160
+ if (size !== void 0 && size > params.maxBytes) throw new MediaUnderstandingSkipError("maxBytes", `Attachment ${params.attachmentIndex + 1} exceeds maxBytes ${params.maxBytes}`);
1161
+ const buffer = await fsp.readFile(entry.resolvedPath);
1162
+ entry.buffer = buffer;
1163
+ entry.bufferMime = entry.bufferMime ?? entry.attachment.mime ?? await detectMime({
1164
+ buffer,
1165
+ filePath: entry.resolvedPath
1166
+ });
1167
+ entry.bufferFileName = path.basename(entry.resolvedPath) || `media-${params.attachmentIndex + 1}`;
1168
+ return {
1169
+ buffer,
1170
+ mime: entry.bufferMime,
1171
+ fileName: entry.bufferFileName,
1172
+ size: buffer.length
1173
+ };
1174
+ }
1175
+ }
1176
+ const url = entry.attachment.url?.trim();
1177
+ if (!url) throw new MediaUnderstandingSkipError("empty", `Attachment ${params.attachmentIndex + 1} has no path or URL.`);
1178
+ try {
1179
+ const fetchImpl = (input, init) => fetchWithTimeout(resolveRequestUrl(input), init ?? {}, params.timeoutMs, fetch);
1180
+ const fetched = await fetchRemoteMedia({
1181
+ url,
1182
+ fetchImpl,
1183
+ maxBytes: params.maxBytes
1184
+ });
1185
+ entry.buffer = fetched.buffer;
1186
+ entry.bufferMime = entry.attachment.mime ?? fetched.contentType ?? await detectMime({
1187
+ buffer: fetched.buffer,
1188
+ filePath: fetched.fileName ?? url
1189
+ });
1190
+ entry.bufferFileName = fetched.fileName ?? `media-${params.attachmentIndex + 1}`;
1191
+ return {
1192
+ buffer: fetched.buffer,
1193
+ mime: entry.bufferMime,
1194
+ fileName: entry.bufferFileName,
1195
+ size: fetched.buffer.length
1196
+ };
1197
+ } catch (err) {
1198
+ if (err instanceof MediaFetchError && err.code === "max_bytes") throw new MediaUnderstandingSkipError("maxBytes", `Attachment ${params.attachmentIndex + 1} exceeds maxBytes ${params.maxBytes}`);
1199
+ if (isAbortError(err)) throw new MediaUnderstandingSkipError("timeout", `Attachment ${params.attachmentIndex + 1} timed out while fetching.`);
1200
+ throw err;
1201
+ }
1202
+ }
1203
+ async getPath(params) {
1204
+ const entry = await this.ensureEntry(params.attachmentIndex);
1205
+ if (entry.resolvedPath) {
1206
+ if (params.maxBytes) {
1207
+ const size = await this.ensureLocalStat(entry);
1208
+ if (entry.resolvedPath) {
1209
+ if (size !== void 0 && size > params.maxBytes) throw new MediaUnderstandingSkipError("maxBytes", `Attachment ${params.attachmentIndex + 1} exceeds maxBytes ${params.maxBytes}`);
1210
+ }
1211
+ }
1212
+ if (entry.resolvedPath) return { path: entry.resolvedPath };
1213
+ }
1214
+ if (entry.tempPath) {
1215
+ if (params.maxBytes && entry.buffer && entry.buffer.length > params.maxBytes) throw new MediaUnderstandingSkipError("maxBytes", `Attachment ${params.attachmentIndex + 1} exceeds maxBytes ${params.maxBytes}`);
1216
+ return {
1217
+ path: entry.tempPath,
1218
+ cleanup: entry.tempCleanup
1219
+ };
1220
+ }
1221
+ const maxBytes = params.maxBytes ?? Number.POSITIVE_INFINITY;
1222
+ const bufferResult = await this.getBuffer({
1223
+ attachmentIndex: params.attachmentIndex,
1224
+ maxBytes,
1225
+ timeoutMs: params.timeoutMs
1226
+ });
1227
+ const tmpPath = buildRandomTempFilePath({
1228
+ prefix: "remoteclaw-media",
1229
+ extension: path.extname(bufferResult.fileName || "") || ""
1230
+ });
1231
+ await fsp.writeFile(tmpPath, bufferResult.buffer);
1232
+ entry.tempPath = tmpPath;
1233
+ entry.tempCleanup = async () => {
1234
+ await fsp.unlink(tmpPath).catch(() => {});
1235
+ };
1236
+ return {
1237
+ path: tmpPath,
1238
+ cleanup: entry.tempCleanup
1239
+ };
1240
+ }
1241
+ async cleanup() {
1242
+ const cleanups = [];
1243
+ for (const entry of this.entries.values()) if (entry.tempCleanup) {
1244
+ cleanups.push(Promise.resolve(entry.tempCleanup()));
1245
+ entry.tempCleanup = void 0;
1246
+ }
1247
+ await Promise.all(cleanups);
1248
+ }
1249
+ async ensureEntry(attachmentIndex) {
1250
+ const existing = this.entries.get(attachmentIndex);
1251
+ if (existing) {
1252
+ if (!existing.resolvedPath) existing.resolvedPath = this.resolveLocalPath(existing.attachment);
1253
+ return existing;
1254
+ }
1255
+ const attachment = this.attachments.find((item) => item.index === attachmentIndex) ?? { index: attachmentIndex };
1256
+ const entry = {
1257
+ attachment,
1258
+ resolvedPath: this.resolveLocalPath(attachment)
1259
+ };
1260
+ this.entries.set(attachmentIndex, entry);
1261
+ return entry;
1262
+ }
1263
+ resolveLocalPath(attachment) {
1264
+ const rawPath = normalizeAttachmentPath(attachment.path);
1265
+ if (!rawPath) return;
1266
+ return path.isAbsolute(rawPath) ? rawPath : path.resolve(rawPath);
1267
+ }
1268
+ async ensureLocalStat(entry) {
1269
+ if (!entry.resolvedPath) return;
1270
+ if (!isInboundPathAllowed({
1271
+ filePath: entry.resolvedPath,
1272
+ roots: this.localPathRoots
1273
+ })) {
1274
+ entry.resolvedPath = void 0;
1275
+ if (shouldLogVerbose()) logVerbose(`Blocked attachment path outside allowed roots: ${entry.attachment.path ?? entry.attachment.url ?? "(unknown)"}`);
1276
+ return;
1277
+ }
1278
+ if (entry.statSize !== void 0) return entry.statSize;
1279
+ try {
1280
+ const currentPath = entry.resolvedPath;
1281
+ const stat = await fsp.stat(currentPath);
1282
+ if (!stat.isFile()) {
1283
+ entry.resolvedPath = void 0;
1284
+ return;
1285
+ }
1286
+ const canonicalPath = await fsp.realpath(currentPath).catch(() => currentPath);
1287
+ if (!isInboundPathAllowed({
1288
+ filePath: canonicalPath,
1289
+ roots: await this.getCanonicalLocalPathRoots()
1290
+ })) {
1291
+ entry.resolvedPath = void 0;
1292
+ if (shouldLogVerbose()) logVerbose(`Blocked canonicalized attachment path outside allowed roots: ${canonicalPath}`);
1293
+ return;
1294
+ }
1295
+ entry.resolvedPath = canonicalPath;
1296
+ entry.statSize = stat.size;
1297
+ return stat.size;
1298
+ } catch (err) {
1299
+ entry.resolvedPath = void 0;
1300
+ if (shouldLogVerbose()) logVerbose(`Failed to read attachment ${entry.attachment.index + 1}: ${String(err)}`);
1301
+ return;
1302
+ }
1303
+ }
1304
+ async getCanonicalLocalPathRoots() {
1305
+ if (this.canonicalLocalPathRoots) return await this.canonicalLocalPathRoots;
1306
+ this.canonicalLocalPathRoots = (async () => mergeInboundPathRoots(this.localPathRoots, await Promise.all(this.localPathRoots.map(async (root) => {
1307
+ if (root.includes("*")) return root;
1308
+ return await fsp.realpath(root).catch(() => root);
1309
+ }))))();
1310
+ return await this.canonicalLocalPathRoots;
1311
+ }
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 fsp.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 fsp.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 fsp.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 fsp.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 fsp.stat(filePath)).isFile()) return false;
2004
+ if (process.platform === "win32") return true;
2005
+ await fsp.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 { resolveApiKeyForProvider as _, runCapability as a, buildRandomTempFilePath as c, resolveConcurrency as d, resolveTimeoutMs as f, applyTemplate as g, CLI_OUTPUT_MAX_BUFFER as h, resolveMediaAttachmentLocalRoots as i, installUnhandledRejectionHandler as l, resolveMediaUnderstandingScope as m, createMediaAttachmentCache as n, isAudioAttachment as o, normalizeMediaUnderstandingChatType as p, normalizeMediaAttachments as r, resolveAttachmentKind as s, buildProviderRegistry as t, registerUnhandledRejectionHandler as u, resolveModelAuthLabel as v, resolveModelAuthMode as y };