@gaodefa/daocore 2026.5.25 → 2026.5.27

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 (1698) hide show
  1. package/dist/abort-By0wxKlI.js +277 -0
  2. package/dist/abort.runtime-C7zfjxBp.js +2 -0
  3. package/dist/abort.runtime.js +1 -1
  4. package/dist/account-inspect-DTeLlJz-.js +173 -0
  5. package/dist/accounts-B776XBaL.js +119 -0
  6. package/dist/accounts-CLyZILFF.js +107 -0
  7. package/dist/accounts-DiXgq14W.js +107 -0
  8. package/dist/accounts-iTlRLYN8.js +2 -0
  9. package/dist/acp-runtime-D9YQyGax.js +26 -0
  10. package/dist/acp-spawn-CWciV70C.js +1275 -0
  11. package/dist/acp-spawn-DjaS4O_V.js +2 -0
  12. package/dist/acp-stateful-target-driver-ByvGCj_i.js +89 -0
  13. package/dist/action-kill-DXeOA6YH.js +33 -0
  14. package/dist/action-runtime-BjQnG6qb.js +469 -0
  15. package/dist/action-runtime-api-a73ODsYk.js +2 -0
  16. package/dist/action-send-B_F3xwIu.js +39 -0
  17. package/dist/action-spawn-BFiW7gZJ.js +47 -0
  18. package/dist/actions-Bi7eE2I6.js +161 -0
  19. package/dist/actions.runtime-DmtbCLld.js +5 -0
  20. package/dist/agent-BOI4AdYK.js +3 -0
  21. package/dist/agent-DQPyDWP5.js +2 -0
  22. package/dist/agent-command-ClCxEw82.js +1367 -0
  23. package/dist/agent-components.runtime-C5wxy4D_.js +10 -0
  24. package/dist/agent-components.runtime.js +1 -1
  25. package/dist/agent-harness-CEPgjZ3p.d.ts +146 -0
  26. package/dist/agent-harness-runtime-CkdXIMHI.js +180 -0
  27. package/dist/agent-harness-runtime-DMYJ4buZ.d.ts +691 -0
  28. package/dist/agent-harness-task-runtime-CDtn5RjX.js +140 -0
  29. package/dist/agent-runner-execution-lXW8y0i2.js +1713 -0
  30. package/dist/agent-runner-utils-OdM9hLGt.js +266 -0
  31. package/dist/agent-runner.runtime-fZnfhCJI.js +3455 -0
  32. package/dist/agent-runner.runtime.js +1 -1
  33. package/dist/agent-runtime-Dp0RDnX1.js +229 -0
  34. package/dist/agent-via-gateway-vsBf3nqZ.js +463 -0
  35. package/dist/agents/pi-embedded-runner/tool-split.d.ts +1 -1
  36. package/dist/agents.commands.add-C94vGOFH.js +304 -0
  37. package/dist/agents.commands.delete-D-p2NL4v.js +128 -0
  38. package/dist/api-BZ2QC7WM.js +2 -0
  39. package/dist/api-BmYK5Dge.js +6 -0
  40. package/dist/api-C9Dmd2CA.d.ts +52 -0
  41. package/dist/api-CGdlHCIH.js +3 -0
  42. package/dist/api-CGjlsXii.js +134 -0
  43. package/dist/api-DGqp6wZo.js +2 -0
  44. package/dist/api-DKpE-zdY.js +639 -0
  45. package/dist/apply-GK4z5lYw.js +54 -0
  46. package/dist/apply-_yxsBkiR.js +41 -0
  47. package/dist/approval-handler.runtime-C7d9p3DG.js +130 -0
  48. package/dist/assistant-B-h25aRy.js +291 -0
  49. package/dist/attachment-normalize-DWZ4Nrn-.js +225 -0
  50. package/dist/attempt-execution-BY9C1EOu.js +558 -0
  51. package/dist/attempt-execution.runtime-SR7eolDa.js +3 -0
  52. package/dist/attempt-execution.runtime.js +1 -1
  53. package/dist/attempt-execution.shared-h6uYmkJz.js +38 -0
  54. package/dist/attempt.prompt-helpers-COc5m_TZ.js +475 -0
  55. package/dist/attempt.tool-run-context-CAtfgOqC.js +2094 -0
  56. package/dist/auth-BdkNYTYU.js +541 -0
  57. package/dist/banner-0TOO6XHd.js +397 -0
  58. package/dist/banner-DTHug6Ey.js +2 -0
  59. package/dist/binding-routing-BJ_A83Nl.js +113 -0
  60. package/dist/binding-targets-D5dmPh4R.js +121 -0
  61. package/dist/bot-DX1uG3P-.js +7894 -0
  62. package/dist/bot-deps-BpaYejaN.js +2 -0
  63. package/dist/bot-deps-CKFDy5y3.js +747 -0
  64. package/dist/bot-message-context.runtime-BKOeRg34.js +7 -0
  65. package/dist/bot-message-context.runtime.js +1 -1
  66. package/dist/bot-message-context.session.runtime-xgZdFv6P.js +12 -0
  67. package/dist/bot-message-context.session.runtime.js +1 -1
  68. package/dist/bot-native-commands.delivery.runtime-DDMQrRfJ.js +4 -0
  69. package/dist/bot-native-commands.delivery.runtime.js +1 -1
  70. package/dist/bot-native-commands.runtime-CVVvUz0h.js +13 -0
  71. package/dist/bot-native-commands.runtime.js +1 -1
  72. package/dist/bridge-server-37OWsDZc.js +113 -0
  73. package/dist/browser-cli-BC_6aZJV.js +2 -0
  74. package/dist/browser-cli-Dg1ipmgf.js +230 -0
  75. package/dist/browser-cli-actions-input-B0QuzzSW.js +473 -0
  76. package/dist/browser-cli-actions-observe-C246bas5.js +81 -0
  77. package/dist/browser-cli-debug-F64e_v4B.js +137 -0
  78. package/dist/browser-cli-inspect-Srn6eWjO.js +104 -0
  79. package/dist/browser-cli-manage-CaZ97-Me.js +443 -0
  80. package/dist/browser-cli-resize-CUR20fvZ.js +26 -0
  81. package/dist/browser-cli-shared-BhphnFVo.js +50 -0
  82. package/dist/browser-cli-state-CzaNXNWF.js +337 -0
  83. package/dist/browser-control-auth-DTY0Wx2B.js +2 -0
  84. package/dist/browser-profiles-BDGPPDJ7.js +2 -0
  85. package/dist/browser-runtime-aqBKI8Oi.js +384 -0
  86. package/dist/build-CG7aTzO9.js +257 -0
  87. package/dist/build-info.json +3 -3
  88. package/dist/bundled/boot-md/handler.js +2 -2
  89. package/dist/bundled/session-memory/handler.js +1 -1
  90. package/dist/call-BAWIPJo2.d.ts +43 -0
  91. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  92. package/dist/capability-cli-BhF26gVm.js +1782 -0
  93. package/dist/channel-5_XS0Mss.js +508 -0
  94. package/dist/channel-7L-vyWOO.js +362 -0
  95. package/dist/channel-B6YcNFXw.d.ts +104 -0
  96. package/dist/channel-BVxTyJ0I.js +376 -0
  97. package/dist/channel-BWIsr1r-.js +808 -0
  98. package/dist/channel-Ba0p4xM-.js +1134 -0
  99. package/dist/channel-BdhbzWTg.d.ts +427 -0
  100. package/dist/channel-Bi2nTop1.js +481 -0
  101. package/dist/channel-Bj29iFgF.js +740 -0
  102. package/dist/channel-Bkp8v6zY.d.ts +14 -0
  103. package/dist/channel-BoK62YYe.d.ts +49 -0
  104. package/dist/channel-C10lHKrC.d.ts +47 -0
  105. package/dist/channel-C6G6-tH6.js +562 -0
  106. package/dist/channel-CBhuuq-_.js +2126 -0
  107. package/dist/channel-CMmVpcnl.js +867 -0
  108. package/dist/channel-COc7idAe.js +653 -0
  109. package/dist/channel-CZrble5P.d.ts +8 -0
  110. package/dist/channel-CjfuHhSU.js +1556 -0
  111. package/dist/channel-Cquy73C-.js +1249 -0
  112. package/dist/channel-CzvuskEn.js +955 -0
  113. package/dist/channel-D6u-243v.js +1777 -0
  114. package/dist/channel-D8X4fgB9.d.ts +106 -0
  115. package/dist/channel-D9LDQOYt.d.ts +8 -0
  116. package/dist/channel-DR8PbP31.js +238 -0
  117. package/dist/channel-DUZ0s98I.js +1496 -0
  118. package/dist/channel-DVGMasO6.d.ts +7 -0
  119. package/dist/channel-Djgm5DE9.d.ts +64 -0
  120. package/dist/channel-Dl4eeuJ3.d.ts +114 -0
  121. package/dist/channel-DpQ6_cvo.d.ts +8 -0
  122. package/dist/channel-JqEqZ04S.d.ts +6 -0
  123. package/dist/channel-actions.runtime-BzEqt_Va.js +265 -0
  124. package/dist/channel-actions.runtime.js +1 -1
  125. package/dist/channel-core-CbkDdNXh.d.ts +6 -0
  126. package/dist/channel-core-DDZnTvT6.js +5 -0
  127. package/dist/channel-entry-contract-DUSF3gce.d.ts +112 -0
  128. package/dist/channel-hShoCuAc.d.ts +12 -0
  129. package/dist/channel-inbound-C2wLEE7Q.js +80 -0
  130. package/dist/channel-pIMjOo6Y.d.ts +28 -0
  131. package/dist/channel-plugin-runtime-B8AWkA0i.js +998 -0
  132. package/dist/channel-plugin-runtime-Cg67QAiE.d.ts +7 -0
  133. package/dist/channel-runtime-CciKN6E5.js +408 -0
  134. package/dist/channel-uP-mo8Q6.d.ts +7 -0
  135. package/dist/channel-whyHp4eY.d.ts +26 -0
  136. package/dist/channel.runtime-BQN8Bkb0.js +254 -0
  137. package/dist/channel.runtime-BXeGEvv7.js +21009 -0
  138. package/dist/channel.runtime-C40ILulM.js +1008 -0
  139. package/dist/channel.runtime-CJ2DSojv.js +733 -0
  140. package/dist/channel.runtime-CUaygROD.js +652 -0
  141. package/dist/channel.runtime-CcCbJhDb.js +88 -0
  142. package/dist/channel.runtime-DJbKu9D3.js +4 -0
  143. package/dist/channel.runtime-DgRuSo5T.js +109 -0
  144. package/dist/channel.runtime-tRXUD2p2.js +2528 -0
  145. package/dist/channel.setup-3aVku-g-.js +1098 -0
  146. package/dist/channel.setup-BMXb23G7.d.ts +6 -0
  147. package/dist/channel.setup-BdEXf9Ic.d.ts +8 -0
  148. package/dist/channel.setup-DT7Z9egu.js +343 -0
  149. package/dist/channel.setup-DhlkGTJV.js +10 -0
  150. package/dist/channel.setup-UZjcpncE.d.ts +7 -0
  151. package/dist/chat-D3LWYymW.js +2666 -0
  152. package/dist/chrome--ATU1T0X.js +1503 -0
  153. package/dist/cli/run-main.js +9 -9
  154. package/dist/cli-D8hIXnS1.js +1341 -0
  155. package/dist/cli-DYinYyHP.d.ts +20 -0
  156. package/dist/cli-backend-CSCGROD2.d.ts +5 -0
  157. package/dist/cli-backend-DmBwqwqy.d.ts +5 -0
  158. package/dist/cli-compaction-jmi3u2HG.js +347 -0
  159. package/dist/cli-metadata-Cy9MEdPv.js +22 -0
  160. package/dist/cli-runner-DuT8oeZF.js +540 -0
  161. package/dist/cli-runner-DvKgnkCL.js +2 -0
  162. package/dist/cli-runner.runtime-B-aD16MD.js +4 -0
  163. package/dist/cli-runner.runtime-DofcKX1U.js +3 -0
  164. package/dist/cli-runner.runtime.js +1 -1
  165. package/dist/cli-shared-CXpra3BN.d.ts +20 -0
  166. package/dist/cli-startup-metadata.json +13 -13
  167. package/dist/client-B5IcAlfB.js +650 -0
  168. package/dist/client-adapter-CXA67h2E.js +897 -0
  169. package/dist/client-factory-aY6TuKfQ.js +9 -0
  170. package/dist/command-auth-DS9XgXEG.js +135 -0
  171. package/dist/command-execution-startup-DQOLt5Sz.js +87 -0
  172. package/dist/command-handlers-DqxF-IM9.js +1609 -0
  173. package/dist/command-registry-BSVx1oOc.js +4 -0
  174. package/dist/command-registry-CsPIOiQ3.js +9 -0
  175. package/dist/command-registry-core-Bzu5ff5F.js +110 -0
  176. package/dist/command-status.runtime-MKsizBC-.js +90 -0
  177. package/dist/command-status.runtime.js +1 -1
  178. package/dist/commands-CqcnXnk-.d.ts +113 -0
  179. package/dist/commands-acp-ClJofWty.js +74 -0
  180. package/dist/commands-compact.runtime-7VqYX4tS.js +10 -0
  181. package/dist/commands-compact.runtime.js +1 -1
  182. package/dist/commands-handlers.runtime-Dfqf_Oyp.js +6154 -0
  183. package/dist/commands-handlers.runtime.js +1 -1
  184. package/dist/commands-status-CRaEj9Vf.js +16 -0
  185. package/dist/commands-status-uDaqCP2F.js +3 -0
  186. package/dist/commands-status.runtime-uDaqCP2F.js +3 -0
  187. package/dist/commands-status.runtime.js +1 -1
  188. package/dist/commands-subagents-control.runtime-BaYcGLtc.js +2 -0
  189. package/dist/commands-subagents-control.runtime-C4xMpLed.js +3 -0
  190. package/dist/commands-subagents-control.runtime.js +1 -1
  191. package/dist/commands-system-prompt-C3lzz7wW.js +162 -0
  192. package/dist/commands-system-prompt-DpiW5FkQ.js +2 -0
  193. package/dist/commands.runtime-l4fGcB5c.js +176 -0
  194. package/dist/commands.runtime.js +1 -1
  195. package/dist/commitments/runtime.js +1 -1
  196. package/dist/compact-Dq0mi-y_.js +480 -0
  197. package/dist/compact-voJdoXm-.js +1141 -0
  198. package/dist/compact.runtime-BNLPSDQQ.js +12 -0
  199. package/dist/compact.runtime.js +1 -1
  200. package/dist/completion-cli-qHUelvvd.js +315 -0
  201. package/dist/computer-use-dP3FCUtq.js +367 -0
  202. package/dist/config-BDGPPDJ7.js +2 -0
  203. package/dist/config-Dg3sgjXu.js +373 -0
  204. package/dist/config-cli-INHPnZOG.js +1633 -0
  205. package/dist/config-mutations-CAgnXnDt.js +159 -0
  206. package/dist/config-schema-Bqr7vPys.d.ts +20 -0
  207. package/dist/configure-M1VU0h9O.js +3 -0
  208. package/dist/configure.commands-CM8RXyn3.js +1251 -0
  209. package/dist/configure.commands-PvOJd4nu.js +2 -0
  210. package/dist/context-engine-host-compat-D7I7Q63Z.js +288 -0
  211. package/dist/context-engine-host-compat-DGHUiQUV.js +2 -0
  212. package/dist/context-engine-lifecycle-Zsi-S6qy.js +1274 -0
  213. package/dist/contracts-testkit-DQ4aMv6G.d.ts +145 -0
  214. package/dist/control-auth-BKUTwIvH.js +114 -0
  215. package/dist/control-service-CKUzEAa0.js +145 -0
  216. package/dist/control-ui/assets/agents-ClA7Dmdi.js +1008 -0
  217. package/dist/control-ui/assets/channel-config-extras-DbFSI8yX.js +2 -0
  218. package/dist/control-ui/assets/channels-DnbSBvPm.js +367 -0
  219. package/dist/control-ui/assets/cron-CEUF8LjD.js +1013 -0
  220. package/dist/control-ui/assets/debug-DRYELUHG.js +97 -0
  221. package/dist/control-ui/assets/index-DCsdjM46.js +7370 -0
  222. package/dist/control-ui/assets/instances-COCizU2x.js +57 -0
  223. package/dist/control-ui/assets/logs-DNECqE3y.js +74 -0
  224. package/dist/control-ui/assets/nodes-MFf2wNIy.js +436 -0
  225. package/dist/control-ui/assets/sessions-DDnQy3rE.js +399 -0
  226. package/dist/control-ui/assets/skills-8ppwfjOc.js +314 -0
  227. package/dist/control-ui/assets/skills-shared-DI8nwzCe.js +11 -0
  228. package/dist/control-ui/index.html +1 -1
  229. package/dist/control-ui/sw.js +1 -1
  230. package/dist/conversation-binding-runtime-rXAYUZyM.js +4 -0
  231. package/dist/conversation-runtime-CV0pSg81.js +31 -0
  232. package/dist/core-BV0irASW.js +282 -0
  233. package/dist/core-DIQ0fbwp.d.ts +224 -0
  234. package/dist/core-api-CyhjZVzn.js +5 -0
  235. package/dist/core-api-YdHGjff8.js +2 -0
  236. package/dist/crestodian/crestodian.js +1 -1
  237. package/dist/crestodian/rescue-message.js +1 -1
  238. package/dist/crestodian-n5FVHIW5.js +55 -0
  239. package/dist/daocore-runtime-JsdCNe3l.d.ts +151 -0
  240. package/dist/daocore-tools-CXDZ1Xhe.js +11727 -0
  241. package/dist/dashboard-CeQV6L1K.js +263 -0
  242. package/dist/delivery-D7LfafSk.js +1002 -0
  243. package/dist/dev-BSY4rs1s.js +97 -0
  244. package/dist/dialogue-DWFnjTiN.js +37 -0
  245. package/dist/dir-fetch-tool-BnlEyfZh.js +565 -0
  246. package/dist/dir-list-tool-Blhg_vTH.js +100 -0
  247. package/dist/direct-dm-DJPIaf5J.js +64 -0
  248. package/dist/directive-handling.fast-lane-DGV6PZYZ.js +68 -0
  249. package/dist/directive-handling.impl-CTDwclQa.js +818 -0
  250. package/dist/directive-handling.impl-_zI0_GsT.js +2 -0
  251. package/dist/directive-handling.model-selection-C8lG4FHQ.js +122 -0
  252. package/dist/directive-handling.persist.runtime-CmLb1evR.js +263 -0
  253. package/dist/directive-handling.persist.runtime.js +1 -1
  254. package/dist/dispatch-DvZRbIrc.js +1640 -0
  255. package/dist/dispatch-acp-transcript.runtime-PehNIsnR.js +40 -0
  256. package/dist/dispatch-acp-transcript.runtime.js +1 -1
  257. package/dist/dispatch-acp.runtime-Dg8ft-Ve.js +18 -0
  258. package/dist/dispatch-acp.runtime.js +1 -1
  259. package/dist/doctor-DJFM3lrT.js +6 -0
  260. package/dist/doctor-_ob4EiVf.js +2 -0
  261. package/dist/doctor-config-flow-D6iEk-en.js +1741 -0
  262. package/dist/doctor-core-checks-CCfWWL1-.js +573 -0
  263. package/dist/doctor-core-checks-CqkHUVcZ.js +2 -0
  264. package/dist/doctor-health-CrNPft4G.js +65 -0
  265. package/dist/doctor-health-contributions-Bwu5M_GQ.js +696 -0
  266. package/dist/doctor-lint-B2Wb_jEn.js +94 -0
  267. package/dist/doctor-prompter-cXq7RExi.js +58 -0
  268. package/dist/doctor-state-integrity-DfYyVFbQ.js +1231 -0
  269. package/dist/dynamic-tools-CbHsYkuk.js +486 -0
  270. package/dist/embedded-backend-IYuqoxzv.js +579 -0
  271. package/dist/embedded-gateway-stub.runtime-BjJ_93Pp.js +12 -0
  272. package/dist/embedded-gateway-stub.runtime.js +1 -1
  273. package/dist/embedding-provider-56qUY6a4.d.ts +16 -0
  274. package/dist/embedding-provider-CfSvDhLk.d.ts +65 -0
  275. package/dist/embedding-provider-DV9KtS1H.d.ts +21 -0
  276. package/dist/entry.d.ts +1 -1
  277. package/dist/entry.js +1 -1
  278. package/dist/exec-approvals-VjIKwFog.js +149 -0
  279. package/dist/extensionAPI.js +1 -1
  280. package/dist/extensions/active-memory/index.d.ts +1 -1
  281. package/dist/extensions/active-memory/index.js +1 -1
  282. package/dist/extensions/admin-http-rpc/index.d.ts +1 -1
  283. package/dist/extensions/admin-http-rpc/index.js +1 -1
  284. package/dist/extensions/alibaba/index.d.ts +1 -1
  285. package/dist/extensions/anthropic/api.d.ts +3 -3
  286. package/dist/extensions/anthropic/cli-backend-api.d.ts +2 -2
  287. package/dist/extensions/anthropic/cli-backend.d.ts +1 -1
  288. package/dist/extensions/anthropic/cli-migration.d.ts +1 -1
  289. package/dist/extensions/anthropic/cli-shared.d.ts +1 -1
  290. package/dist/extensions/anthropic/contract-api.d.ts +1 -1
  291. package/dist/extensions/anthropic/index.d.ts +1 -1
  292. package/dist/extensions/anthropic/provider-contract-api.d.ts +1 -1
  293. package/dist/extensions/anthropic/provider-discovery.d.ts +1 -1
  294. package/dist/extensions/anthropic/provider-policy-api.d.ts +1 -1
  295. package/dist/extensions/anthropic/register.runtime.d.ts +1 -1
  296. package/dist/extensions/anthropic/replay-policy.d.ts +1 -1
  297. package/dist/extensions/anthropic/setup-api.d.ts +1 -1
  298. package/dist/extensions/anthropic/stream-wrappers.d.ts +1 -1
  299. package/dist/extensions/anthropic/test-api.d.ts +2 -2
  300. package/dist/extensions/arcee/index.d.ts +1 -1
  301. package/dist/extensions/azure-speech/index.d.ts +1 -1
  302. package/dist/extensions/azure-speech/speech-provider.d.ts +1 -1
  303. package/dist/extensions/bonjour/index.d.ts +1 -1
  304. package/dist/extensions/browser/browser-bridge.js +1 -1
  305. package/dist/extensions/browser/browser-config.js +4 -4
  306. package/dist/extensions/browser/browser-control-auth.js +2 -2
  307. package/dist/extensions/browser/browser-doctor.js +2 -2
  308. package/dist/extensions/browser/browser-maintenance.js +1 -1
  309. package/dist/extensions/browser/browser-profiles.js +2 -2
  310. package/dist/extensions/browser/browser-runtime-api.js +11 -11
  311. package/dist/extensions/browser/cli-metadata.d.ts +1 -1
  312. package/dist/extensions/browser/cli-metadata.js +1 -1
  313. package/dist/extensions/browser/index.d.ts +1 -1
  314. package/dist/extensions/browser/index.js +1 -1
  315. package/dist/extensions/browser/plugin-registration.d.ts +1 -1
  316. package/dist/extensions/browser/plugin-registration.js +1 -1
  317. package/dist/extensions/browser/register.runtime.d.ts +2 -2
  318. package/dist/extensions/browser/register.runtime.js +4 -4
  319. package/dist/extensions/browser/runtime-api.d.ts +3 -3
  320. package/dist/extensions/browser/runtime-api.js +13 -13
  321. package/dist/extensions/browser/setup-api.d.ts +1 -1
  322. package/dist/extensions/byteplus/index.d.ts +1 -1
  323. package/dist/extensions/byteplus/provider-discovery.d.ts +1 -1
  324. package/dist/extensions/canvas/cli-metadata.d.ts +1 -1
  325. package/dist/extensions/canvas/index.d.ts +1 -1
  326. package/dist/extensions/canvas/index.js +1 -1
  327. package/dist/extensions/canvas/runtime-api.d.ts +2 -2
  328. package/dist/extensions/canvas/setup-api.d.ts +1 -1
  329. package/dist/extensions/cerebras/index.d.ts +1 -1
  330. package/dist/extensions/chutes/index.d.ts +1 -1
  331. package/dist/extensions/clickclack/api.d.ts +2 -2
  332. package/dist/extensions/clickclack/api.js +2 -2
  333. package/dist/extensions/clickclack/channel-plugin-api.d.ts +1 -1
  334. package/dist/extensions/clickclack/channel-plugin-api.js +1 -1
  335. package/dist/extensions/clickclack/index.d.ts +2 -2
  336. package/dist/extensions/clickclack/runtime-api.d.ts +2 -2
  337. package/dist/extensions/clickclack/runtime-api.js +2 -2
  338. package/dist/extensions/cloudflare-ai-gateway/index.d.ts +1 -1
  339. package/dist/extensions/cloudflare-ai-gateway/stream-wrappers.d.ts +1 -1
  340. package/dist/extensions/comfy/index.d.ts +1 -1
  341. package/dist/extensions/copilot-proxy/index.d.ts +1 -1
  342. package/dist/extensions/copilot-proxy/runtime-api.d.ts +2 -2
  343. package/dist/extensions/deepgram/index.d.ts +1 -1
  344. package/dist/extensions/deepgram/realtime-transcription-provider.d.ts +1 -1
  345. package/dist/extensions/deepgram/test-api.d.ts +1 -1
  346. package/dist/extensions/deepinfra/api.d.ts +2 -2
  347. package/dist/extensions/deepinfra/embedding-provider.d.ts +1 -1
  348. package/dist/extensions/deepinfra/index.d.ts +1 -1
  349. package/dist/extensions/deepinfra/memory-embedding-adapter.d.ts +1 -1
  350. package/dist/extensions/deepinfra/speech-provider.d.ts +1 -1
  351. package/dist/extensions/deepseek/api.d.ts +1 -1
  352. package/dist/extensions/deepseek/index.d.ts +1 -1
  353. package/dist/extensions/deepseek/provider-discovery.d.ts +1 -1
  354. package/dist/extensions/deepseek/provider-policy-api.d.ts +1 -1
  355. package/dist/extensions/deepseek/stream.d.ts +1 -1
  356. package/dist/extensions/deepseek/thinking.d.ts +1 -1
  357. package/dist/extensions/device-pair/api.d.ts +3 -3
  358. package/dist/extensions/device-pair/api.js +1 -1
  359. package/dist/extensions/device-pair/index.d.ts +1 -1
  360. package/dist/extensions/device-pair/notify.d.ts +1 -1
  361. package/dist/extensions/device-pair/pair-command-approve.js +1 -1
  362. package/dist/extensions/document-extract/index.d.ts +1 -1
  363. package/dist/extensions/duckduckgo/index.d.ts +1 -1
  364. package/dist/extensions/elevenlabs/index.d.ts +1 -1
  365. package/dist/extensions/elevenlabs/realtime-transcription-provider.d.ts +1 -1
  366. package/dist/extensions/elevenlabs/setup-api.d.ts +1 -1
  367. package/dist/extensions/elevenlabs/speech-provider.d.ts +1 -1
  368. package/dist/extensions/elevenlabs/test-api.d.ts +2 -2
  369. package/dist/extensions/exa/index.d.ts +1 -1
  370. package/dist/extensions/fal/index.d.ts +1 -1
  371. package/dist/extensions/fal/provider-contract-api.d.ts +1 -1
  372. package/dist/extensions/fal/provider-registration.d.ts +1 -1
  373. package/dist/extensions/file-transfer/index.d.ts +1 -1
  374. package/dist/extensions/file-transfer/index.js +4 -4
  375. package/dist/extensions/firecrawl/index.d.ts +1 -1
  376. package/dist/extensions/fireworks/index.d.ts +1 -1
  377. package/dist/extensions/fireworks/provider-policy-api.d.ts +1 -1
  378. package/dist/extensions/fireworks/stream.d.ts +1 -1
  379. package/dist/extensions/fireworks/thinking-policy.d.ts +1 -1
  380. package/dist/extensions/github-copilot/embeddings.d.ts +1 -1
  381. package/dist/extensions/github-copilot/index.d.ts +1 -1
  382. package/dist/extensions/github-copilot/models.d.ts +1 -1
  383. package/dist/extensions/github-copilot/register.runtime.d.ts +2 -2
  384. package/dist/extensions/github-copilot/stream.d.ts +1 -1
  385. package/dist/extensions/google/api.d.ts +5 -5
  386. package/dist/extensions/google/cli-backend.d.ts +1 -1
  387. package/dist/extensions/google/embedding-batch.d.ts +1 -1
  388. package/dist/extensions/google/embedding-provider.d.ts +1 -1
  389. package/dist/extensions/google/gemini-cli-provider.d.ts +1 -1
  390. package/dist/extensions/google/index.d.ts +1 -1
  391. package/dist/extensions/google/memory-embedding-adapter.d.ts +1 -1
  392. package/dist/extensions/google/provider-contract-api.d.ts +1 -1
  393. package/dist/extensions/google/provider-hooks.d.ts +2 -2
  394. package/dist/extensions/google/provider-models.d.ts +1 -1
  395. package/dist/extensions/google/provider-policy-api.d.ts +1 -1
  396. package/dist/extensions/google/provider-policy.d.ts +1 -1
  397. package/dist/extensions/google/provider-registration.d.ts +1 -1
  398. package/dist/extensions/google/realtime-voice-provider.d.ts +1 -1
  399. package/dist/extensions/google/runtime-api.d.ts +3 -3
  400. package/dist/extensions/google/setup-api.d.ts +1 -1
  401. package/dist/extensions/google/speech-provider.d.ts +1 -1
  402. package/dist/extensions/google/test-api.d.ts +2 -2
  403. package/dist/extensions/google/thinking-api.d.ts +1 -1
  404. package/dist/extensions/google/thinking.d.ts +1 -1
  405. package/dist/extensions/google/transport-stream.d.ts +1 -1
  406. package/dist/extensions/gradium/index.d.ts +1 -1
  407. package/dist/extensions/gradium/speech-provider.d.ts +1 -1
  408. package/dist/extensions/groq/index.d.ts +1 -1
  409. package/dist/extensions/huggingface/index.d.ts +1 -1
  410. package/dist/extensions/image-generation-core/api.d.ts +3 -3
  411. package/dist/extensions/image-generation-core/runtime-api.d.ts +1 -1
  412. package/dist/extensions/imessage/api.d.ts +2 -2
  413. package/dist/extensions/imessage/api.js +2 -2
  414. package/dist/extensions/imessage/channel-plugin-api.d.ts +1 -1
  415. package/dist/extensions/imessage/channel-plugin-api.js +1 -1
  416. package/dist/extensions/imessage/index.d.ts +2 -2
  417. package/dist/extensions/imessage/message-tool-api.d.ts +1 -1
  418. package/dist/extensions/imessage/runtime-api.d.ts +2 -2
  419. package/dist/extensions/imessage/runtime-api.js +3 -3
  420. package/dist/extensions/imessage/setup-entry.d.ts +2 -2
  421. package/dist/extensions/imessage/test-api.d.ts +1 -1
  422. package/dist/extensions/inworld/index.d.ts +1 -1
  423. package/dist/extensions/inworld/speech-provider.d.ts +1 -1
  424. package/dist/extensions/irc/api.d.ts +1 -1
  425. package/dist/extensions/irc/api.js +2 -2
  426. package/dist/extensions/irc/channel-plugin-api.d.ts +1 -1
  427. package/dist/extensions/irc/channel-plugin-api.js +1 -1
  428. package/dist/extensions/irc/index.d.ts +2 -2
  429. package/dist/extensions/irc/setup-entry.d.ts +2 -2
  430. package/dist/extensions/kilocode/index.d.ts +1 -1
  431. package/dist/extensions/kimi-coding/index.d.ts +1 -1
  432. package/dist/extensions/kimi-coding/stream.d.ts +1 -1
  433. package/dist/extensions/litellm/index.d.ts +1 -1
  434. package/dist/extensions/llm-task/api.d.ts +2 -2
  435. package/dist/extensions/llm-task/index.d.ts +1 -1
  436. package/dist/extensions/llm-task/index.js +1 -1
  437. package/dist/extensions/lmstudio/api.d.ts +1 -1
  438. package/dist/extensions/lmstudio/index.d.ts +1 -1
  439. package/dist/extensions/lmstudio/memory-embedding-adapter.d.ts +1 -1
  440. package/dist/extensions/mattermost/api.js +1 -1
  441. package/dist/extensions/mattermost/channel-plugin-api.d.ts +2 -2
  442. package/dist/extensions/mattermost/channel-plugin-api.js +1 -1
  443. package/dist/extensions/mattermost/channel-plugin-runtime.d.ts +1 -1
  444. package/dist/extensions/mattermost/channel-plugin-runtime.js +1 -1
  445. package/dist/extensions/mattermost/index.d.ts +2 -2
  446. package/dist/extensions/mattermost/policy-api.js +1 -1
  447. package/dist/extensions/mattermost/runtime-api.d.ts +3 -3
  448. package/dist/extensions/mattermost/runtime-api.js +2 -2
  449. package/dist/extensions/mattermost/setup-entry.d.ts +2 -2
  450. package/dist/extensions/mattermost/slash-route-api.d.ts +1 -1
  451. package/dist/extensions/mattermost/slash-route-api.js +1 -1
  452. package/dist/extensions/memory-core/api.d.ts +1 -1
  453. package/dist/extensions/memory-core/cli-metadata.d.ts +1 -1
  454. package/dist/extensions/memory-core/cli-metadata.js +1 -1
  455. package/dist/extensions/memory-core/index.d.ts +1 -1
  456. package/dist/extensions/memory-core/manager-runtime.d.ts +1 -1
  457. package/dist/extensions/memory-core/runtime-api.d.ts +2 -2
  458. package/dist/extensions/memory-wiki/api.d.ts +3 -3
  459. package/dist/extensions/memory-wiki/cli-metadata.d.ts +1 -1
  460. package/dist/extensions/memory-wiki/index.d.ts +1 -1
  461. package/dist/extensions/memory-wiki/setup-api.d.ts +1 -1
  462. package/dist/extensions/microsoft/index.d.ts +1 -1
  463. package/dist/extensions/microsoft/speech-provider.d.ts +1 -1
  464. package/dist/extensions/microsoft/test-api.d.ts +1 -1
  465. package/dist/extensions/microsoft-foundry/auth.d.ts +1 -1
  466. package/dist/extensions/microsoft-foundry/cli.d.ts +1 -1
  467. package/dist/extensions/microsoft-foundry/index.d.ts +1 -1
  468. package/dist/extensions/microsoft-foundry/onboard.d.ts +3 -3
  469. package/dist/extensions/microsoft-foundry/provider.d.ts +1 -1
  470. package/dist/extensions/microsoft-foundry/runtime.d.ts +1 -1
  471. package/dist/extensions/microsoft-foundry/shared-runtime.d.ts +1 -1
  472. package/dist/extensions/microsoft-foundry/shared.d.ts +1 -1
  473. package/dist/extensions/migrate-claude/apply.d.ts +1 -1
  474. package/dist/extensions/migrate-claude/apply.js +1 -1
  475. package/dist/extensions/migrate-claude/config.d.ts +1 -1
  476. package/dist/extensions/migrate-claude/helpers.d.ts +1 -1
  477. package/dist/extensions/migrate-claude/index.d.ts +1 -1
  478. package/dist/extensions/migrate-claude/index.js +1 -1
  479. package/dist/extensions/migrate-claude/memory.d.ts +2 -2
  480. package/dist/extensions/migrate-claude/plan.d.ts +1 -1
  481. package/dist/extensions/migrate-claude/plan.js +1 -1
  482. package/dist/extensions/migrate-claude/provider.d.ts +1 -1
  483. package/dist/extensions/migrate-claude/provider.js +1 -1
  484. package/dist/extensions/migrate-claude/skills.d.ts +2 -2
  485. package/dist/extensions/migrate-claude/targets.d.ts +1 -1
  486. package/dist/extensions/migrate-claude/targets.js +1 -1
  487. package/dist/extensions/migrate-hermes/apply.d.ts +1 -1
  488. package/dist/extensions/migrate-hermes/apply.js +1 -1
  489. package/dist/extensions/migrate-hermes/config.d.ts +1 -1
  490. package/dist/extensions/migrate-hermes/helpers.d.ts +1 -1
  491. package/dist/extensions/migrate-hermes/index.d.ts +1 -1
  492. package/dist/extensions/migrate-hermes/index.js +1 -1
  493. package/dist/extensions/migrate-hermes/items.d.ts +1 -1
  494. package/dist/extensions/migrate-hermes/model.d.ts +1 -1
  495. package/dist/extensions/migrate-hermes/model.js +1 -1
  496. package/dist/extensions/migrate-hermes/plan.d.ts +1 -1
  497. package/dist/extensions/migrate-hermes/plan.js +1 -1
  498. package/dist/extensions/migrate-hermes/provider.d.ts +1 -1
  499. package/dist/extensions/migrate-hermes/provider.js +1 -1
  500. package/dist/extensions/migrate-hermes/secrets.d.ts +2 -2
  501. package/dist/extensions/migrate-hermes/secrets.js +1 -1
  502. package/dist/extensions/migrate-hermes/skills.d.ts +2 -2
  503. package/dist/extensions/migrate-hermes/targets.d.ts +1 -1
  504. package/dist/extensions/migrate-hermes/targets.js +1 -1
  505. package/dist/extensions/minimax/index.d.ts +1 -1
  506. package/dist/extensions/minimax/provider-contract-api.d.ts +1 -1
  507. package/dist/extensions/minimax/provider-registration.d.ts +1 -1
  508. package/dist/extensions/minimax/speech-provider.d.ts +1 -1
  509. package/dist/extensions/mistral/embedding-provider.d.ts +1 -1
  510. package/dist/extensions/mistral/index.d.ts +1 -1
  511. package/dist/extensions/mistral/memory-embedding-adapter.d.ts +1 -1
  512. package/dist/extensions/mistral/realtime-transcription-provider.d.ts +1 -1
  513. package/dist/extensions/mistral/test-api.d.ts +1 -1
  514. package/dist/extensions/moonshot/index.d.ts +1 -1
  515. package/dist/extensions/moonshot/provider-contract-api.d.ts +1 -1
  516. package/dist/extensions/moonshot/provider-discovery.d.ts +1 -1
  517. package/dist/extensions/nvidia/index.d.ts +1 -1
  518. package/dist/extensions/oc-path/cli-metadata.d.ts +1 -1
  519. package/dist/extensions/oc-path/cli-registration.d.ts +1 -1
  520. package/dist/extensions/oc-path/index.d.ts +1 -1
  521. package/dist/extensions/ollama/api.d.ts +1 -1
  522. package/dist/extensions/ollama/index.d.ts +1 -1
  523. package/dist/extensions/ollama/provider-discovery.d.ts +1 -1
  524. package/dist/extensions/ollama/provider-policy-api.d.ts +1 -1
  525. package/dist/extensions/ollama/runtime-api.d.ts +1 -1
  526. package/dist/extensions/open-prose/index.d.ts +1 -1
  527. package/dist/extensions/open-prose/runtime-api.d.ts +2 -2
  528. package/dist/extensions/openai/api.d.ts +4 -4
  529. package/dist/extensions/openai/embedding-batch.d.ts +1 -1
  530. package/dist/extensions/openai/embedding-provider.d.ts +1 -1
  531. package/dist/extensions/openai/index.d.ts +1 -1
  532. package/dist/extensions/openai/memory-embedding-adapter.d.ts +1 -1
  533. package/dist/extensions/openai/openai-codex-oauth.runtime.d.ts +1 -1
  534. package/dist/extensions/openai/openai-codex-provider.d.ts +1 -1
  535. package/dist/extensions/openai/openai-provider.d.ts +1 -1
  536. package/dist/extensions/openai/prompt-overlay.d.ts +1 -1
  537. package/dist/extensions/openai/provider-contract-api.d.ts +1 -1
  538. package/dist/extensions/openai/provider-policy-api.d.ts +1 -1
  539. package/dist/extensions/openai/realtime-transcription-provider.d.ts +1 -1
  540. package/dist/extensions/openai/realtime-voice-provider.d.ts +1 -1
  541. package/dist/extensions/openai/register.runtime.d.ts +6 -6
  542. package/dist/extensions/openai/replay-policy.d.ts +1 -1
  543. package/dist/extensions/openai/setup-api.d.ts +1 -1
  544. package/dist/extensions/openai/shared.d.ts +3 -3
  545. package/dist/extensions/openai/speech-provider.d.ts +1 -1
  546. package/dist/extensions/openai/test-api.d.ts +3 -3
  547. package/dist/extensions/openai/thinking-policy.d.ts +1 -1
  548. package/dist/extensions/openai/transport-policy.d.ts +1 -1
  549. package/dist/extensions/opencode/index.d.ts +1 -1
  550. package/dist/extensions/opencode/provider-policy-api.d.ts +1 -1
  551. package/dist/extensions/opencode-go/index.d.ts +1 -1
  552. package/dist/extensions/opencode-go/provider-catalog.d.ts +1 -1
  553. package/dist/extensions/opencode-go/stream.d.ts +1 -1
  554. package/dist/extensions/openrouter/api.d.ts +1 -1
  555. package/dist/extensions/openrouter/index.d.ts +1 -1
  556. package/dist/extensions/openrouter/provider-contract-api.d.ts +1 -1
  557. package/dist/extensions/openrouter/provider-policy-api.d.ts +1 -1
  558. package/dist/extensions/openrouter/speech-provider.d.ts +1 -1
  559. package/dist/extensions/openrouter/stream.d.ts +1 -1
  560. package/dist/extensions/openrouter/test-api.d.ts +1 -1
  561. package/dist/extensions/openrouter/thinking-policy.d.ts +1 -1
  562. package/dist/extensions/openrouter/video-generation-provider.d.ts +1 -1
  563. package/dist/extensions/openrouter/video-model-catalog.d.ts +1 -1
  564. package/dist/extensions/perplexity/index.d.ts +1 -1
  565. package/dist/extensions/phone-control/index.d.ts +1 -1
  566. package/dist/extensions/phone-control/runtime-api.d.ts +2 -2
  567. package/dist/extensions/policy/api.js +1 -1
  568. package/dist/extensions/policy/index.d.ts +1 -1
  569. package/dist/extensions/policy/index.js +2 -2
  570. package/dist/extensions/qianfan/index.d.ts +1 -1
  571. package/dist/extensions/qwen/api.d.ts +1 -1
  572. package/dist/extensions/qwen/index.d.ts +1 -1
  573. package/dist/extensions/qwen/stream.d.ts +1 -1
  574. package/dist/extensions/runway/index.d.ts +1 -1
  575. package/dist/extensions/searxng/index.d.ts +1 -1
  576. package/dist/extensions/senseaudio/index.d.ts +1 -1
  577. package/dist/extensions/sglang/index.d.ts +1 -1
  578. package/dist/extensions/signal/api.d.ts +2 -2
  579. package/dist/extensions/signal/api.js +6 -6
  580. package/dist/extensions/signal/channel-entry.d.ts +2 -2
  581. package/dist/extensions/signal/channel-plugin-api.d.ts +1 -1
  582. package/dist/extensions/signal/channel-plugin-api.js +1 -1
  583. package/dist/extensions/signal/index.d.ts +2 -2
  584. package/dist/extensions/signal/reaction-runtime-api.js +1 -1
  585. package/dist/extensions/signal/runtime-api.d.ts +4 -4
  586. package/dist/extensions/signal/runtime-api.js +7 -7
  587. package/dist/extensions/signal/setup-entry.d.ts +2 -2
  588. package/dist/extensions/skill-workshop/api.d.ts +2 -2
  589. package/dist/extensions/skill-workshop/api.js +1 -1
  590. package/dist/extensions/skill-workshop/index.d.ts +1 -1
  591. package/dist/extensions/skill-workshop/index.js +2 -2
  592. package/dist/extensions/speech-core/api.d.ts +3 -3
  593. package/dist/extensions/speech-core/runtime-api.d.ts +2 -2
  594. package/dist/extensions/stepfun/index.d.ts +1 -1
  595. package/dist/extensions/synthetic/index.d.ts +1 -1
  596. package/dist/extensions/talk-voice/api.d.ts +2 -2
  597. package/dist/extensions/talk-voice/index.d.ts +1 -1
  598. package/dist/extensions/tavily/index.d.ts +1 -1
  599. package/dist/extensions/telegram/account-inspect-api.js +1 -1
  600. package/dist/extensions/telegram/api.d.ts +3 -3
  601. package/dist/extensions/telegram/api.js +11 -11
  602. package/dist/extensions/telegram/channel-plugin-api.d.ts +2 -2
  603. package/dist/extensions/telegram/channel-plugin-api.js +2 -2
  604. package/dist/extensions/telegram/contract-api.d.ts +1 -1
  605. package/dist/extensions/telegram/contract-api.js +3 -3
  606. package/dist/extensions/telegram/index.d.ts +2 -2
  607. package/dist/extensions/telegram/runtime-api.d.ts +3 -3
  608. package/dist/extensions/telegram/runtime-api.js +7 -7
  609. package/dist/extensions/telegram/security-audit-contract-api.js +1 -1
  610. package/dist/extensions/telegram/setup-entry.d.ts +2 -2
  611. package/dist/extensions/telegram/setup-plugin-api.d.ts +1 -1
  612. package/dist/extensions/telegram/setup-plugin-api.js +1 -1
  613. package/dist/extensions/telegram/test-api.js +2 -2
  614. package/dist/extensions/tencent/index.d.ts +1 -1
  615. package/dist/extensions/tencent/provider-discovery.d.ts +1 -1
  616. package/dist/extensions/thread-ownership/api.d.ts +2 -2
  617. package/dist/extensions/thread-ownership/index.d.ts +1 -1
  618. package/dist/extensions/together/index.d.ts +1 -1
  619. package/dist/extensions/tokenjuice/index.d.ts +1 -1
  620. package/dist/extensions/tokenjuice/tool-result-middleware.d.ts +1 -1
  621. package/dist/extensions/tts-local-cli/index.d.ts +1 -1
  622. package/dist/extensions/tts-local-cli/speech-provider.d.ts +1 -1
  623. package/dist/extensions/venice/index.d.ts +1 -1
  624. package/dist/extensions/venice/stream.d.ts +1 -1
  625. package/dist/extensions/vercel-ai-gateway/index.d.ts +1 -1
  626. package/dist/extensions/vercel-ai-gateway/thinking.d.ts +1 -1
  627. package/dist/extensions/video-generation-core/api.d.ts +2 -2
  628. package/dist/extensions/video-generation-core/runtime-api.d.ts +1 -1
  629. package/dist/extensions/vllm/api.d.ts +1 -1
  630. package/dist/extensions/vllm/index.d.ts +1 -1
  631. package/dist/extensions/vllm/stream.d.ts +1 -1
  632. package/dist/extensions/volcengine/index.d.ts +1 -1
  633. package/dist/extensions/volcengine/provider-discovery.d.ts +1 -1
  634. package/dist/extensions/volcengine/speech-provider.d.ts +1 -1
  635. package/dist/extensions/voyage/embedding-batch.d.ts +1 -1
  636. package/dist/extensions/voyage/embedding-provider.d.ts +1 -1
  637. package/dist/extensions/voyage/index.d.ts +1 -1
  638. package/dist/extensions/voyage/memory-embedding-adapter.d.ts +1 -1
  639. package/dist/extensions/vydra/index.d.ts +1 -1
  640. package/dist/extensions/vydra/speech-provider.d.ts +1 -1
  641. package/dist/extensions/web-readability/index.d.ts +1 -1
  642. package/dist/extensions/webhooks/api.d.ts +2 -2
  643. package/dist/extensions/webhooks/api.js +1 -1
  644. package/dist/extensions/webhooks/index.d.ts +1 -1
  645. package/dist/extensions/webhooks/index.js +1 -1
  646. package/dist/extensions/webhooks/runtime-api.d.ts +1 -1
  647. package/dist/extensions/xai/api.d.ts +1 -1
  648. package/dist/extensions/xai/index.d.ts +1 -1
  649. package/dist/extensions/xai/index.js +4 -4
  650. package/dist/extensions/xai/provider-contract-api.d.ts +1 -1
  651. package/dist/extensions/xai/provider-discovery.d.ts +1 -1
  652. package/dist/extensions/xai/provider-models.d.ts +1 -1
  653. package/dist/extensions/xai/provider-policy-api.d.ts +1 -1
  654. package/dist/extensions/xai/realtime-transcription-provider.d.ts +1 -1
  655. package/dist/extensions/xai/realtime-transcription-provider.js +1 -1
  656. package/dist/extensions/xai/setup-api.d.ts +1 -1
  657. package/dist/extensions/xai/speech-provider.d.ts +1 -1
  658. package/dist/extensions/xai/speech-provider.js +1 -1
  659. package/dist/extensions/xai/stream.d.ts +1 -1
  660. package/dist/extensions/xai/test-api.js +1 -1
  661. package/dist/extensions/xai/tts.js +1 -1
  662. package/dist/extensions/xai/web-search.js +1 -1
  663. package/dist/extensions/xai/xai-oauth.d.ts +1 -1
  664. package/dist/extensions/xai/xai-oauth.js +1 -1
  665. package/dist/extensions/xiaomi/index.d.ts +1 -1
  666. package/dist/extensions/xiaomi/speech-provider.d.ts +1 -1
  667. package/dist/extensions/xiaomi/stream.d.ts +1 -1
  668. package/dist/extensions/xiaomi/thinking.d.ts +1 -1
  669. package/dist/extensions/zai/index.d.ts +1 -1
  670. package/dist/file-fetch-tool-smMykVXl.js +124 -0
  671. package/dist/file-write-tool-yEYLZ2hU.js +127 -0
  672. package/dist/format-DyREJP5V.js +1145 -0
  673. package/dist/gateway/protocol/index.d.ts +1 -1
  674. package/dist/gateway-cli-D4yhwJa8.js +435 -0
  675. package/dist/gateway-method-runtime-B8AOnwqD.js +21 -0
  676. package/dist/gateway-runtime-COtKzRqi.d.ts +163 -0
  677. package/dist/gemini-cli-provider-BQgviROv.d.ts +6 -0
  678. package/dist/get-reply-Co-_Qlr-.js +4689 -0
  679. package/dist/get-reply-from-config.runtime-BcbRKxzJ.js +2 -0
  680. package/dist/get-reply-from-config.runtime.js +1 -1
  681. package/dist/graph-users-CF7Dlee2.js +1419 -0
  682. package/dist/group-access-BTU-w5S5.js +112 -0
  683. package/dist/handle-action.guild-admin-DS29y_6h.js +288 -0
  684. package/dist/harness-d9YmZWA3.js +61 -0
  685. package/dist/health-Cov1Kryj.js +4 -0
  686. package/dist/heartbeat-runner-B2wo_xDj.js +5 -0
  687. package/dist/heartbeat-runner.runtime-DrHZD-P2.js +4 -0
  688. package/dist/heartbeat-runner.runtime.js +1 -1
  689. package/dist/help-BgDd1atJ.js +136 -0
  690. package/dist/hooks-CgXKCJSD.js +534 -0
  691. package/dist/http-registry-Yo_NvKls.d.ts +23 -0
  692. package/dist/image-generation-runtime-BIAvq6jv.d.ts +21 -0
  693. package/dist/inbound-direct-dm-runtime-DjOHl6c_.js +2 -0
  694. package/dist/inbound-reply-dispatch-BCTiM2jm.js +148 -0
  695. package/dist/index-7GMgTC5k.d.ts +3971 -0
  696. package/dist/index.js +1 -1
  697. package/dist/init-CreYGHpp.js +59 -0
  698. package/dist/inline-buttons-C94TOhmL.js +40 -0
  699. package/dist/interactive-dispatch-ChuCQxzf.d.ts +56 -0
  700. package/dist/interactive-dispatch-DY_jVu-V.d.ts +143 -0
  701. package/dist/internal-events-B6D5bqsn.js +90 -0
  702. package/dist/isolated-agent-9faqxl7c.js +1118 -0
  703. package/dist/isolated-agent-CaY4uTcE.js +2 -0
  704. package/dist/lifecycle-pTz4liUn.js +571 -0
  705. package/dist/list.probe-B8pt-DOd.js +449 -0
  706. package/dist/list.status-command-Wgmt361J.js +789 -0
  707. package/dist/llm-slug-generator-Do4oXnXl.js +78 -0
  708. package/dist/llm-slug-generator.js +1 -1
  709. package/dist/loader-C-JyPvyF.d.ts +142 -0
  710. package/dist/local-dispatch.runtime-7keeuHHm.js +9 -0
  711. package/dist/local-dispatch.runtime.js +1 -1
  712. package/dist/manager-CknaUr2b.d.ts +356 -0
  713. package/dist/manager.runtime-B3nVh8Nl.js +2714 -0
  714. package/dist/manager.runtime.js +1 -1
  715. package/dist/markdown-to-line-CZLeX0SL.js +811 -0
  716. package/dist/mcp-http-LaAmzBev.js +2 -0
  717. package/dist/mcp-http-M4GjuKFd.js +555 -0
  718. package/dist/media-understanding-provider-DLA6VsQZ.js +339 -0
  719. package/dist/memory-core-host-engine-storage-izjrNFNA.d.ts +54 -0
  720. package/dist/memory-embedding-adapter-B3WLPdKc.d.ts +5 -0
  721. package/dist/message-actions-Dlv-B5yk.js +145 -0
  722. package/dist/message-handler-2HSbEoAi.js +384 -0
  723. package/dist/message-handler-XiApv_iS.js +1715 -0
  724. package/dist/message-handler.preflight-CN-g4nxs.js +1125 -0
  725. package/dist/message-handler.process-BzVq3Lq_.js +1484 -0
  726. package/dist/migration-DVKbowM8.d.ts +45 -0
  727. package/dist/model-BSBoLWjJ.d.ts +33 -0
  728. package/dist/model-Sqz99RFi.js +74 -0
  729. package/dist/model-selection-Bh9QtqlJ.js +272 -0
  730. package/dist/models-BvEw11kE.d.ts +24 -0
  731. package/dist/models-C_dD1FNN.js +2 -0
  732. package/dist/models-CtpB-fi2.js +104 -0
  733. package/dist/models-cli-I2sJE5tg.js +256 -0
  734. package/dist/monitor-B4J6Kn4-.js +60 -0
  735. package/dist/monitor-BIFxJ3Ql.js +2788 -0
  736. package/dist/monitor-BTkcXHvw.js +834 -0
  737. package/dist/monitor-BX7Encm5.js +1657 -0
  738. package/dist/monitor-CZsJ4D3J.js +4377 -0
  739. package/dist/monitor-CvKt9k7P.js +2 -0
  740. package/dist/monitor-Dy9phiVJ.js +1370 -0
  741. package/dist/monitor-auth-CjtJPc9C.js +179 -0
  742. package/dist/monitor-jQpVHEky.js +715 -0
  743. package/dist/monitor-polling.runtime-Li4-3e2G.js +883 -0
  744. package/dist/monitor-polling.runtime.js +1 -1
  745. package/dist/monitor-webhook.runtime-CQ2kN5ya.js +387 -0
  746. package/dist/monitor-webhook.runtime.js +1 -1
  747. package/dist/monitor.account-CFdazLEm.js +5233 -0
  748. package/dist/monitor.runtime-B774iFU_.js +2 -0
  749. package/dist/monitor.runtime.js +1 -1
  750. package/dist/monitor.webhook-NNrWA5P9.js +180 -0
  751. package/dist/node-cli-sessions-Ct-6bGab.js +1228 -0
  752. package/dist/onboard-DEUA1HCQ.js +733 -0
  753. package/dist/onboard-helpers-Cupkjkec.js +251 -0
  754. package/dist/onboard-helpers-D1Pvowo1.js +6 -0
  755. package/dist/onboard-remote-BN_7wNqG.js +2 -0
  756. package/dist/onboard-remote-BqYAK5dF.js +212 -0
  757. package/dist/onboard-skills-BM40qOkc.js +160 -0
  758. package/dist/onboard-skills-rSLgDOzB.js +2 -0
  759. package/dist/openai-codex-provider-C48t8ka8.d.ts +5 -0
  760. package/dist/openai-http-BRnxRJ_y.js +824 -0
  761. package/dist/openai-provider-Df75q4KM.d.ts +5 -0
  762. package/dist/openresponses-http-Dg3OL0qA.js +1173 -0
  763. package/dist/operations-jvr0A8cu.js +805 -0
  764. package/dist/outbound-adapter-BJej9JpO.js +543 -0
  765. package/dist/outbound-session-route-D3QVwFKr.js +45 -0
  766. package/dist/outbound.runtime-gdOoPtOh.js +2 -0
  767. package/dist/outbound.runtime.js +1 -1
  768. package/dist/pi-embedded-CwD_xrGP.js +3796 -0
  769. package/dist/pi-embedded-DL6l8KBl.js +4 -0
  770. package/dist/pi-embedded.runtime-DyGCj24d.js +4 -0
  771. package/dist/pi-embedded.runtime.js +1 -1
  772. package/dist/pi-tools-BzbgexEG.js +2413 -0
  773. package/dist/plan-HWBV2Rhq.js +112 -0
  774. package/dist/plan-iN77JYw-.js +81 -0
  775. package/dist/plugin-CbNvjum_.js +12396 -0
  776. package/dist/plugin-DMYsMKAW.d.ts +17 -0
  777. package/dist/plugin-app-cache-key-CHpwYM0e.js +46 -0
  778. package/dist/plugin-enabled-DjbDhNRG.js +233 -0
  779. package/dist/plugin-entry-DwVZtdM9.d.ts +47 -0
  780. package/dist/plugin-registration-BM_Iko3e.js +88 -0
  781. package/dist/plugin-runtime-Dx9WRWX8.d.ts +117 -0
  782. package/dist/plugin-sdk/.boundary-entry-shims.stamp +1 -1
  783. package/dist/plugin-sdk/acp-runtime-backend.js +1 -1
  784. package/dist/plugin-sdk/acp-runtime.js +2 -2
  785. package/dist/plugin-sdk/agent-harness-runtime.js +6 -6
  786. package/dist/plugin-sdk/agent-harness-task-runtime.js +1 -1
  787. package/dist/plugin-sdk/agent-harness.js +7 -7
  788. package/dist/plugin-sdk/agent-runtime.js +2 -2
  789. package/dist/plugin-sdk/channel-core.js +2 -2
  790. package/dist/plugin-sdk/channel-inbound.js +2 -2
  791. package/dist/plugin-sdk/channel-test-helpers.js +1 -1
  792. package/dist/plugin-sdk/command-auth.js +1 -1
  793. package/dist/plugin-sdk/command-status-runtime.js +1 -1
  794. package/dist/plugin-sdk/compat.js +1 -1
  795. package/dist/plugin-sdk/conversation-binding-runtime.js +2 -2
  796. package/dist/plugin-sdk/conversation-runtime.js +3 -3
  797. package/dist/plugin-sdk/core.js +2 -2
  798. package/dist/plugin-sdk/direct-dm.js +1 -1
  799. package/dist/plugin-sdk/gateway-method-runtime.js +1 -1
  800. package/dist/plugin-sdk/health.js +2 -2
  801. package/dist/plugin-sdk/inbound-reply-dispatch.js +1 -1
  802. package/dist/plugin-sdk/index.js +1 -1
  803. package/dist/plugin-sdk/mattermost.js +1 -1
  804. package/dist/plugin-sdk/plugin-test-contracts.js +2 -2
  805. package/dist/plugin-sdk/provider-test-contracts.js +4 -4
  806. package/dist/plugin-sdk/reply-runtime.js +4 -4
  807. package/dist/plugin-sdk/testing.js +2 -2
  808. package/dist/plugin-sdk/zalouser.js +1 -1
  809. package/dist/plugin-service-CVyMm03C.js +1229 -0
  810. package/dist/plugin-service-mHunWjlo.d.ts +24 -0
  811. package/dist/plugins/build-smoke-entry.d.ts +2 -2
  812. package/dist/plugins/loader.d.ts +1 -1
  813. package/dist/plugins/provider-discovery.runtime.d.ts +1 -1
  814. package/dist/plugins/provider-runtime.runtime.d.ts +1 -1
  815. package/dist/plugins/runtime/index.js +4 -4
  816. package/dist/policy-B2lTxn8H.js +680 -0
  817. package/dist/policy-Bp9GYcSZ.js +138 -0
  818. package/dist/prepare.runtime-CxhQeo9l.js +732 -0
  819. package/dist/prepare.runtime.js +1 -1
  820. package/dist/preview-warnings-FVRS7Mcs.js +392 -0
  821. package/dist/probe-BRLc43oX.js +47 -0
  822. package/dist/probe-C1eD9yG7.js +2204 -0
  823. package/dist/probe-C1giMJtz.js +682 -0
  824. package/dist/probe-rIUNPFef.js +2 -0
  825. package/dist/program-DfIqBXRH.js +131 -0
  826. package/dist/prompt-overlay-D0r0EA6z.d.ts +23 -0
  827. package/dist/provider-BCxvG42s.js +152 -0
  828. package/dist/provider-BHPMcHk-.js +32 -0
  829. package/dist/provider-CIAQ8D7q.js +32 -0
  830. package/dist/provider-api-key-auth-2Fp25hP8.d.ts +27 -0
  831. package/dist/provider-auth-result-mIg6RY-l.d.ts +21 -0
  832. package/dist/provider-catalog-runtime-B7e02aat.d.ts +23 -0
  833. package/dist/provider-catalog-shared-D0mIMF1C.d.ts +62 -0
  834. package/dist/provider-dispatcher-DyJDef6y.js +22 -0
  835. package/dist/provider-dispatcher.runtime.js +1 -1
  836. package/dist/provider-hook-runtime-CrtHxgL6.d.ts +61 -0
  837. package/dist/provider-j7cYms68.js +8735 -0
  838. package/dist/provider-model-shared-BESf3jvo.d.ts +143 -0
  839. package/dist/provider-models-B6wofKVD.d.ts +12 -0
  840. package/dist/provider-policy-0JjxJfxh.d.ts +30 -0
  841. package/dist/provider-registration-O7mvATZX.d.ts +6 -0
  842. package/dist/provider-registry-CtFVQxwM.d.ts +8 -0
  843. package/dist/provider-registry-DZxCJHb2.d.ts +8 -0
  844. package/dist/provider-registry-DcUASGbX.d.ts +30 -0
  845. package/dist/provider-runtime-CrrstiDP.d.ts +359 -0
  846. package/dist/provider-self-hosted-setup-DKlGE8A7.d.ts +74 -0
  847. package/dist/provider-session.runtime-CmNY15Mr.js +9 -0
  848. package/dist/provider-session.runtime.js +1 -1
  849. package/dist/provider-stream-C2vPdKh5.d.ts +140 -0
  850. package/dist/provider-stream-shared-CslVTt39.d.ts +128 -0
  851. package/dist/provider.runtime-DJO3dwrX.js +2 -0
  852. package/dist/provider.runtime.js +1 -1
  853. package/dist/providers.runtime-CHPPEG1J.d.ts +25 -0
  854. package/dist/public-surface-loader-CgBnme5n.js +114 -0
  855. package/dist/pw-ai-UeRWGzcL.js +3029 -0
  856. package/dist/pw-role-snapshot-BtlutwlO.js +333 -0
  857. package/dist/reaction-level-DWOV-qJM.js +19 -0
  858. package/dist/reaction-runtime-api-5ZiPcbGJ.js +116 -0
  859. package/dist/realtime-transcription-Brox5yj7.d.ts +43 -0
  860. package/dist/realtime-transcription-provider-B9DWwCuO.d.ts +32 -0
  861. package/dist/realtime-transcription-provider-CGhoGie3.d.ts +28 -0
  862. package/dist/realtime-transcription-provider-Dau7Zk9V.d.ts +37 -0
  863. package/dist/realtime-transcription-provider-DcsAmQEp.js +205 -0
  864. package/dist/realtime-transcription-provider-WgtPbRJc.d.ts +5 -0
  865. package/dist/realtime-voice-C5Xiylos.d.ts +333 -0
  866. package/dist/realtime-voice-provider-DUPM9wyW.d.ts +5 -0
  867. package/dist/register-Dga1nJRL.js +2178 -0
  868. package/dist/register.agent-VIgyZLKG.js +156 -0
  869. package/dist/register.configure-C21zJ4Qb.js +16 -0
  870. package/dist/register.crestodian-Bam6mUXr.js +24 -0
  871. package/dist/register.maintenance-D9E-Hh90.js +83 -0
  872. package/dist/register.onboard-BnUcaZsb.js +113 -0
  873. package/dist/register.runtime-BcgdXzLA.d.ts +6 -0
  874. package/dist/register.runtime-BdRAp4xz.js +54 -0
  875. package/dist/register.setup-Bq-9IQdV.js +40 -0
  876. package/dist/register.subclis-DubBtg8Z.js +31 -0
  877. package/dist/register.subclis-H_qmmDFx.js +3 -0
  878. package/dist/register.subclis-core-fg3DalSH.js +273 -0
  879. package/dist/registry-DnnBulh_.d.ts +91 -0
  880. package/dist/registry-types-BQ26lhRo.d.ts +392 -0
  881. package/dist/repair-sequencing-Dn0sDvBE.js +640 -0
  882. package/dist/reply-delivery-DZGfRh-W.js +196 -0
  883. package/dist/reply-runtime-BdCPL-OF.js +11 -0
  884. package/dist/reply.runtime-BcbRKxzJ.js +2 -0
  885. package/dist/reply.runtime.js +1 -1
  886. package/dist/request-Ca681Kt1.js +54 -0
  887. package/dist/resolve-allowlist-DWjCzDq1.js +220 -0
  888. package/dist/result-fallback-classifier-BWIh0wzc.js +79 -0
  889. package/dist/root-help-8a3TWleF.js +43 -0
  890. package/dist/route-BsWREv6-.js +469 -0
  891. package/dist/route-resolution-D8FyF30I.js +274 -0
  892. package/dist/routes-BxkaJuyM.js +3602 -0
  893. package/dist/routes-DdwFgSv9.js +2 -0
  894. package/dist/run-attempt-Ca7HP1Nd.js +7704 -0
  895. package/dist/run-command-JwrnqCIB.js +2 -0
  896. package/dist/run-command-wWvfXyIf.js +23 -0
  897. package/dist/run-embedded.runtime-0QIAc8PG.js +4 -0
  898. package/dist/run-embedded.runtime.js +1 -1
  899. package/dist/run-execution-cli.runtime-LhD-S0h_.js +4 -0
  900. package/dist/run-execution-cli.runtime.js +1 -1
  901. package/dist/run-executor.runtime.js +1 -1
  902. package/dist/run-prKMVvM2.js +1162 -0
  903. package/dist/run-subagent-registry.runtime-C07jSlV2.js +2 -0
  904. package/dist/run-subagent-registry.runtime.js +1 -1
  905. package/dist/runtime-7Xhj2T8S.js +6179 -0
  906. package/dist/runtime-CXUwJU3q.js +438 -0
  907. package/dist/runtime-DeQypuDs.js +1287 -0
  908. package/dist/runtime-api-0djTIsuz.js +13 -0
  909. package/dist/runtime-api-Bz1h0p3i.js +17 -0
  910. package/dist/runtime-api-CLcJZKu2.js +13 -0
  911. package/dist/runtime-api-Ce7axAAW.js +24 -0
  912. package/dist/runtime-api-CoAsju8a.js +4 -0
  913. package/dist/runtime-api-DEuynhDr.js +3 -0
  914. package/dist/runtime-api-oZFIOS9l.js +21 -0
  915. package/dist/runtime-api.actions-DWLRlSej.js +3 -0
  916. package/dist/runtime-api.monitor-DtXB3_sf.js +6 -0
  917. package/dist/runtime-api.send-BU586hbs.js +4 -0
  918. package/dist/runtime-api.threads-Djhr5AJy.js +2 -0
  919. package/dist/runtime-channel-BIgBTs_X.js +2 -0
  920. package/dist/runtime-channel-CsUTBjYU.js +150 -0
  921. package/dist/runtime-embedded-pi.runtime-Rszd_KCt.js +2 -0
  922. package/dist/runtime-embedded-pi.runtime.js +1 -1
  923. package/dist/runtime-taskflow-Co1PrqbP.d.ts +435 -0
  924. package/dist/sanitize-outbound-2umQeW_U.js +127 -0
  925. package/dist/sdk-setup-tools-TiaNam05.js +8 -0
  926. package/dist/secrets-BmyFSkt-.js +113 -0
  927. package/dist/secrets-cli-DPAwFvtH.js +149 -0
  928. package/dist/security-audit-BR9FBcLD.js +122 -0
  929. package/dist/security-audit-RKut1lWG.js +118 -0
  930. package/dist/security-audit.runtime-Pe7YbS9P.js +2 -0
  931. package/dist/security-audit.runtime.js +1 -1
  932. package/dist/selection-Cqhmjpyl.js +16157 -0
  933. package/dist/selection-xFFMaq92.js +3 -0
  934. package/dist/send-BDHagrwl.js +1631 -0
  935. package/dist/send-BV_O_Ljd.js +192 -0
  936. package/dist/send-W-DVyil6.js +2 -0
  937. package/dist/send-jUp2-szO.js +143 -0
  938. package/dist/send.components-BR_yPtKv.js +500 -0
  939. package/dist/send.components-CK7UbpRP.js +2 -0
  940. package/dist/send.runtime-DHLfdHbS.js +2 -0
  941. package/dist/send.runtime.js +1 -1
  942. package/dist/server-DRcdRu6J.js +73 -0
  943. package/dist/server-Ddv-oAKv.js +24 -0
  944. package/dist/server-close.runtime.d.ts +1 -1
  945. package/dist/server-close.runtime.js +1 -1
  946. package/dist/server-context-9rW0Cvdw.js +2 -0
  947. package/dist/server-context-uRD5N8_D.js +955 -0
  948. package/dist/server-cron-BClEPtbv.js +2 -0
  949. package/dist/server-cron-CNGar45o.js +2989 -0
  950. package/dist/server-methods-CAMhJf7g.js +16494 -0
  951. package/dist/server-node-events-DW5DoAxk.js +596 -0
  952. package/dist/server-plugin-bootstrap-CqX4dDcN.js +70 -0
  953. package/dist/server-plugins-BIhs3eCz.js +432 -0
  954. package/dist/server-reload-handlers-54HSfSr7.js +714 -0
  955. package/dist/server-restart-sentinel-C47-O08k.js +747 -0
  956. package/dist/server-restart-sentinel-Cx-3Rzl0.js +2 -0
  957. package/dist/server-runtime-services-D-SWzUww.js +267 -0
  958. package/dist/server-runtime-services-D0GOFPFq.js +2 -0
  959. package/dist/server-startup-plugins-C8pzVvkb.js +113 -0
  960. package/dist/server-startup-post-attach-2xoGJJts.js +716 -0
  961. package/dist/server-ws-runtime-Dywo6GC-.js +349 -0
  962. package/dist/server.impl-xK22fZyJ.js +2586 -0
  963. package/dist/service-Ci8roOZn.js +1446 -0
  964. package/dist/session-binding-BsdbGBhb.js +219 -0
  965. package/dist/session-binding-D42jROcb.js +2 -0
  966. package/dist/session-kill-http-kU4rUj1_.js +121 -0
  967. package/dist/session-reset-service-DkCGElAA.js +625 -0
  968. package/dist/session-route-hmQSEijy.js +93 -0
  969. package/dist/session-status.runtime-Dsz-54he.js +2 -0
  970. package/dist/session-status.runtime.js +1 -1
  971. package/dist/session-subagent-reactivation.runtime-CYJIkiW8.js +2 -0
  972. package/dist/session-subagent-reactivation.runtime.js +1 -1
  973. package/dist/session-tab-registry-YfQve--K.js +521 -0
  974. package/dist/sessions-history-http-DeuZSSGj.js +430 -0
  975. package/dist/sessions.runtime-wAccC8Lk.js +2 -0
  976. package/dist/sessions.runtime.js +1 -1
  977. package/dist/setup-B8caUFIZ.js +586 -0
  978. package/dist/setup-CgHGdMpV.js +2 -0
  979. package/dist/setup-api-Uew7qBry.js +29 -0
  980. package/dist/setup-core-BP_fjsmA.js +174 -0
  981. package/dist/setup-onboard-configure-help-fast-path-ykLp2JqU.js +64 -0
  982. package/dist/setup-surface-BgEGrdZ3.js +320 -0
  983. package/dist/setup-surface-BvSqsFEu.js +221 -0
  984. package/dist/setup-surface-CHzMJ7_T.js +405 -0
  985. package/dist/setup-surface-DYm3Xvgt.js +288 -0
  986. package/dist/setup.finalize-BgLIjblM.js +582 -0
  987. package/dist/setup.gateway-config-BBguRpIc.js +281 -0
  988. package/dist/setup.migration-import-BY06brv-.js +200 -0
  989. package/dist/setup.migration-import-Igj5NMey.js +2 -0
  990. package/dist/shared-2-FiBN51.d.ts +115 -0
  991. package/dist/shared-client-GL2KQ2Eu.js +2 -0
  992. package/dist/shared-client-Mc7bTBoQ.js +629 -0
  993. package/dist/shared-moi7PK0C.js +121 -0
  994. package/dist/side-question-BEHswpGw.js +683 -0
  995. package/dist/simple-completion-runtime-JMnVclQ6.d.ts +73 -0
  996. package/dist/skill-tool-dispatch.runtime-O5uXeees.js +143 -0
  997. package/dist/skill-tool-dispatch.runtime.js +1 -1
  998. package/dist/slash-state-BAYUTcHl.js +2166 -0
  999. package/dist/speech-CmQkc7zi.d.ts +47 -0
  1000. package/dist/speech-core-CVkLGUxG.d.ts +36 -0
  1001. package/dist/speech-provider-22oDk8Tz.js +184 -0
  1002. package/dist/speech-provider-B73iu4fH.d.ts +5 -0
  1003. package/dist/speech-provider-BEBH8vyF.d.ts +34 -0
  1004. package/dist/speech-provider-BhCRdoMK.d.ts +8 -0
  1005. package/dist/speech-provider-Cf1PVMAj.d.ts +8 -0
  1006. package/dist/speech-provider-DdEPWhuR.d.ts +5 -0
  1007. package/dist/speech-provider-ECom8JiZ.d.ts +5 -0
  1008. package/dist/src-C8wkJgE6.js +4256 -0
  1009. package/dist/startup-context-BhLJufFU.js +313 -0
  1010. package/dist/status-C20LHDLA.js +73 -0
  1011. package/dist/status-message-CmzgS8zM.js +484 -0
  1012. package/dist/status-message.runtime-iG6qi7wn.js +6 -0
  1013. package/dist/status-message.runtime.js +1 -1
  1014. package/dist/status-subagents.runtime-D49P_RIr.js +18 -0
  1015. package/dist/status-subagents.runtime.js +1 -1
  1016. package/dist/status-text-BI7Q1z4U.js +296 -0
  1017. package/dist/status.runtime-RQes0TI5.js +2 -0
  1018. package/dist/sticker-cache-Dh4joqan.js +206 -0
  1019. package/dist/sticker-vision.runtime-5SRgpo_k.js +17 -0
  1020. package/dist/sticker-vision.runtime.js +1 -1
  1021. package/dist/stream-CYHgCxMh.d.ts +5 -0
  1022. package/dist/stream-D8Ytt_tB.d.ts +120 -0
  1023. package/dist/stream-DX9I-gkW.d.ts +19 -0
  1024. package/dist/stream-DjL6Gw2C.d.ts +16 -0
  1025. package/dist/stream-m7GKt3W2.d.ts +10 -0
  1026. package/dist/stream-wrappers-UyEQes6p.d.ts +21 -0
  1027. package/dist/subagent-announce-BEPlkjCS.js +354 -0
  1028. package/dist/subagent-announce-delivery-jcxPIfNG.js +958 -0
  1029. package/dist/subagent-control-DdMWVJXs.js +508 -0
  1030. package/dist/subagent-hooks-BsTVb6ur.js +2 -0
  1031. package/dist/subagent-hooks-CBlMBrss.js +2 -0
  1032. package/dist/subagent-hooks-Ch5oDUxb.js +116 -0
  1033. package/dist/subagent-hooks-DmUeAwY3.js +146 -0
  1034. package/dist/subagent-hooks-PNuPbYEl.js +2 -0
  1035. package/dist/subagent-hooks-api-BQ051dF0.js +23 -0
  1036. package/dist/subagent-hooks-api-DcVS0aJZ.js +22 -0
  1037. package/dist/subagent-hooks-api-Dlbc5Mtd.js +23 -0
  1038. package/dist/subagent-hooks-dwsegI07.js +230 -0
  1039. package/dist/subagent-orphan-recovery-Cl_y6Poi.js +352 -0
  1040. package/dist/subagent-registry-BosUdBW6.js +2351 -0
  1041. package/dist/subagent-registry-Bxd6vaAO.js +3 -0
  1042. package/dist/subagent-registry.runtime.js +1 -1
  1043. package/dist/subagent-session-cleanup-Bd6d93qi.js +525 -0
  1044. package/dist/subagent-spawn-ViO3XAR1.js +1164 -0
  1045. package/dist/target-id-Bje_v2Ax.js +107 -0
  1046. package/dist/targets-C4byiOgQ.js +19 -0
  1047. package/dist/targets-D-0Biv4s.d.ts +10 -0
  1048. package/dist/targets-J0MVE-dD.js +44 -0
  1049. package/dist/targets-S-Pmze3w.d.ts +10 -0
  1050. package/dist/targets-ZMEvyNa8.js +19 -0
  1051. package/dist/task-registry-control.runtime.js +1 -1
  1052. package/dist/telegram/token.js +1 -1
  1053. package/dist/testing-Dk757Ggg.js +267 -0
  1054. package/dist/thinking-policy-B31-nCQk.d.ts +5 -0
  1055. package/dist/thread-bindings-CYrmTzFY.js +232 -0
  1056. package/dist/thread-bindings-Cf7fkXxk.js +571 -0
  1057. package/dist/thread-bindings-DI6LNGbW.js +8 -0
  1058. package/dist/thread-bindings-DdmuKtVD.js +228 -0
  1059. package/dist/thread-bindings.discord-api-C01V3kFk.js +187 -0
  1060. package/dist/thread-bindings.manager--WOGVrL-.js +2 -0
  1061. package/dist/thread-bindings.manager-HzjqZNiL.js +536 -0
  1062. package/dist/thread-lifecycle-CJKTxWnQ.js +1614 -0
  1063. package/dist/token-D-FQ8AQz.js +134 -0
  1064. package/dist/tool-DTCfs0DU.js +139 -0
  1065. package/dist/tool-actions.runtime-Cb3iA3Os.js +534 -0
  1066. package/dist/tool-actions.runtime.js +1 -1
  1067. package/dist/tool-plugin-B9aQw4fj.d.ts +77 -0
  1068. package/dist/tool-resolution-CbqzNutV.js +149 -0
  1069. package/dist/tool-split-zov3PauL.d.ts +19 -0
  1070. package/dist/tools-effective-inventory-BsAax-ML.js +204 -0
  1071. package/dist/tools-invoke-http-DAqZxikd.js +67 -0
  1072. package/dist/tools-invoke-shared-CsVRemTL.js +200 -0
  1073. package/dist/transport-stream-3OMu_lV2.d.ts +42 -0
  1074. package/dist/tts-Ckj6MJNr.js +66 -0
  1075. package/dist/tui-CwwCXMCq.js +2 -0
  1076. package/dist/tui-DpJn3v2D.js +4709 -0
  1077. package/dist/tui-backend-DQ9wF5es.js +256 -0
  1078. package/dist/tui-cli-k3AYPBn3.js +37 -0
  1079. package/dist/types-D3enA0Vx.d.ts +786 -0
  1080. package/dist/types-DHSQkzyq2.d.ts +3650 -0
  1081. package/dist/types.public-DHQb4Kl9.d.ts +70 -0
  1082. package/dist/update-cli-DB5Doqld.js +3664 -0
  1083. package/dist/video-generation-runtime-Dj060lga.d.ts +21 -0
  1084. package/dist/video-model-catalog-CQ-f89xh.d.ts +16 -0
  1085. package/dist/vision-tools-Dp0JrLRi.js +1409 -0
  1086. package/dist/web-search-B0yvxuiq.js +62 -0
  1087. package/dist/web-search-provider.runtime-B-cNT-5J.js +2 -0
  1088. package/dist/web-search-provider.runtime-HhmIlk_Z.js +328 -0
  1089. package/dist/web-search-provider.runtime.js +1 -1
  1090. package/dist/webhook-targets-CW4Nl_cq.d.ts +99 -0
  1091. package/dist/xai-oauth-cZGjnEjh.js +479 -0
  1092. package/dist/xai-user-agent-DA8le6vP.js +32 -0
  1093. package/package.json +1 -1
  1094. package/dist/abort-CvuLeqr1.js +0 -277
  1095. package/dist/abort.runtime-DNoavlKn.js +0 -2
  1096. package/dist/account-inspect-ByX21U_z.js +0 -173
  1097. package/dist/accounts-B0sjdn0w.js +0 -119
  1098. package/dist/accounts-BF_AfTED.js +0 -107
  1099. package/dist/accounts-DX1c8NKM.js +0 -107
  1100. package/dist/accounts-EA2GGTep.js +0 -2
  1101. package/dist/acp-runtime-BC8oA7xM.js +0 -26
  1102. package/dist/acp-spawn-CPYDCZ95.js +0 -2
  1103. package/dist/acp-spawn-Cqi47GCL.js +0 -1275
  1104. package/dist/acp-stateful-target-driver-CcWMRAQ2.js +0 -89
  1105. package/dist/action-kill-CZrPfOIS.js +0 -33
  1106. package/dist/action-runtime-DuhVKLRJ.js +0 -469
  1107. package/dist/action-runtime-api-BKaUWi7b.js +0 -2
  1108. package/dist/action-send-_NpIHMwj.js +0 -39
  1109. package/dist/action-spawn-Dymn4rUo.js +0 -47
  1110. package/dist/actions-Bk_WaEAa.js +0 -161
  1111. package/dist/actions.runtime-Hh7HYOlJ.js +0 -5
  1112. package/dist/agent-CQzGVmy1.js +0 -2
  1113. package/dist/agent-ClmYyW81.js +0 -3
  1114. package/dist/agent-command-DbU2fo-p.js +0 -1367
  1115. package/dist/agent-components.runtime-BpXJmJXk.js +0 -10
  1116. package/dist/agent-harness-D8c6PLE_.d.ts +0 -146
  1117. package/dist/agent-harness-runtime-AHXS4Jj3.d.ts +0 -691
  1118. package/dist/agent-harness-runtime-TzbK9YTz.js +0 -180
  1119. package/dist/agent-harness-task-runtime-CZWJEsKk.js +0 -140
  1120. package/dist/agent-runner-execution-CmHT78Vr.js +0 -1713
  1121. package/dist/agent-runner-utils-B0i1PW18.js +0 -266
  1122. package/dist/agent-runner.runtime-B6Ah_MlB.js +0 -3455
  1123. package/dist/agent-runtime-BOMioAX6.js +0 -229
  1124. package/dist/agent-via-gateway-DfxQCPit.js +0 -463
  1125. package/dist/agents.commands.add-CszEBxoJ.js +0 -304
  1126. package/dist/agents.commands.delete-ulnJ7RH9.js +0 -128
  1127. package/dist/api-6SmEQDkK.js +0 -134
  1128. package/dist/api-B7QdoMF5.js +0 -2
  1129. package/dist/api-BBgby6ck.js +0 -639
  1130. package/dist/api-DwKV-xfM.d.ts +0 -52
  1131. package/dist/api-RfjCqA7Y.js +0 -6
  1132. package/dist/api-VDkFlOiv.js +0 -2
  1133. package/dist/api-We4xoZFr.js +0 -3
  1134. package/dist/apply-Cgtzilem.js +0 -41
  1135. package/dist/apply-Csp3U8cA.js +0 -54
  1136. package/dist/approval-handler.runtime-aQaSBbpF.js +0 -130
  1137. package/dist/assistant-UMyirSUH.js +0 -291
  1138. package/dist/attachment-normalize-BupK-_Ox.js +0 -225
  1139. package/dist/attempt-execution-oLlyFjHk.js +0 -558
  1140. package/dist/attempt-execution.runtime-Cq8RE0x_.js +0 -3
  1141. package/dist/attempt-execution.shared-DyBzUJGB.js +0 -38
  1142. package/dist/attempt.prompt-helpers-CVBP6t5J.js +0 -475
  1143. package/dist/attempt.tool-run-context-UU1BUUC9.js +0 -2094
  1144. package/dist/auth-BDaK_y-g.js +0 -541
  1145. package/dist/banner-VbID973v.js +0 -2
  1146. package/dist/banner-W77piyz6.js +0 -397
  1147. package/dist/binding-routing-DahKvjr3.js +0 -113
  1148. package/dist/binding-targets-C3mqUdUT.js +0 -121
  1149. package/dist/bot-DonUKEuy.js +0 -7894
  1150. package/dist/bot-deps-CroXwZeM.js +0 -747
  1151. package/dist/bot-deps-DKoy3x0l.js +0 -2
  1152. package/dist/bot-message-context.runtime-BI_zyqDu.js +0 -7
  1153. package/dist/bot-message-context.session.runtime-Cpy2H9Ez.js +0 -12
  1154. package/dist/bot-native-commands.delivery.runtime-CsHg3h1O.js +0 -4
  1155. package/dist/bot-native-commands.runtime-rmoBpwZY.js +0 -13
  1156. package/dist/bridge-server-BmDNWgHD.js +0 -113
  1157. package/dist/browser-cli-BQLwmLw3.js +0 -2
  1158. package/dist/browser-cli-CHHIN-of.js +0 -230
  1159. package/dist/browser-cli-actions-input-DBZ7uwag.js +0 -473
  1160. package/dist/browser-cli-actions-observe-BdH2-WTk.js +0 -81
  1161. package/dist/browser-cli-debug-C82Apbgb.js +0 -137
  1162. package/dist/browser-cli-inspect-CrO1qca7.js +0 -104
  1163. package/dist/browser-cli-manage-Dgm1IUZT.js +0 -443
  1164. package/dist/browser-cli-resize-DqgMr3DY.js +0 -26
  1165. package/dist/browser-cli-shared-BTnXMCKA.js +0 -50
  1166. package/dist/browser-cli-state-DT3bVOtg.js +0 -337
  1167. package/dist/browser-control-auth-BRwKCt45.js +0 -2
  1168. package/dist/browser-profiles-DhGtxK9v.js +0 -2
  1169. package/dist/browser-runtime-BL6b-qtr.js +0 -384
  1170. package/dist/build-33AnG55F.js +0 -257
  1171. package/dist/call-dct8amtn.d.ts +0 -43
  1172. package/dist/capability-cli-D-KoVyyP.js +0 -1782
  1173. package/dist/channel-0tgrzPag.js +0 -867
  1174. package/dist/channel-4g20sJKJ.d.ts +0 -104
  1175. package/dist/channel-6tG8jWsw.d.ts +0 -8
  1176. package/dist/channel-7OEbQ8xS.d.ts +0 -6
  1177. package/dist/channel-7rVapSdN.d.ts +0 -8
  1178. package/dist/channel-B1fZN0iI.d.ts +0 -427
  1179. package/dist/channel-B5Q7fRiN.js +0 -1134
  1180. package/dist/channel-BEg_0h_C.d.ts +0 -12
  1181. package/dist/channel-BNp1J_eZ.js +0 -376
  1182. package/dist/channel-BP6RWm-M.d.ts +0 -47
  1183. package/dist/channel-BRjqrJfj.d.ts +0 -49
  1184. package/dist/channel-BUoyH_tP.d.ts +0 -114
  1185. package/dist/channel-BVBG4Tmn.d.ts +0 -28
  1186. package/dist/channel-Bap23sAx.js +0 -481
  1187. package/dist/channel-BhZ7x0SB.d.ts +0 -26
  1188. package/dist/channel-Bxod9CjX.js +0 -508
  1189. package/dist/channel-C6LASGjS.js +0 -808
  1190. package/dist/channel-COWZEKCw.js +0 -1249
  1191. package/dist/channel-CRAIreZ3.js +0 -238
  1192. package/dist/channel-CVY2hnJh.js +0 -1556
  1193. package/dist/channel-CgKdh_Jd.d.ts +0 -106
  1194. package/dist/channel-Cxo62btA.js +0 -1496
  1195. package/dist/channel-D5SzoyWI.js +0 -562
  1196. package/dist/channel-DE4vIsYF.d.ts +0 -64
  1197. package/dist/channel-DOdRHxJg.js +0 -1777
  1198. package/dist/channel-DZygtXdy.js +0 -362
  1199. package/dist/channel-DfhOnM71.d.ts +0 -7
  1200. package/dist/channel-DhZiptRe.d.ts +0 -8
  1201. package/dist/channel-DqPZviVV.js +0 -2126
  1202. package/dist/channel-Dssy3NQA.js +0 -740
  1203. package/dist/channel-actions.runtime-CDaMC9SV.js +0 -265
  1204. package/dist/channel-buMY8xZQ.d.ts +0 -7
  1205. package/dist/channel-core-CBhC_PNR.js +0 -5
  1206. package/dist/channel-core-x9b94azO.d.ts +0 -6
  1207. package/dist/channel-cvGHll3-.js +0 -955
  1208. package/dist/channel-entry-contract-BfZdcgTS.d.ts +0 -112
  1209. package/dist/channel-inbound-CNdyzYlz.js +0 -80
  1210. package/dist/channel-l8amaSI9.js +0 -653
  1211. package/dist/channel-plugin-runtime-CvcVGjj4.js +0 -998
  1212. package/dist/channel-plugin-runtime-D5n9A86n.d.ts +0 -7
  1213. package/dist/channel-runtime-BAbg8Dcv.js +0 -408
  1214. package/dist/channel-sWtDTVwd.d.ts +0 -14
  1215. package/dist/channel.runtime-9o-iF8zm.js +0 -2528
  1216. package/dist/channel.runtime-BotO7RD0.js +0 -21009
  1217. package/dist/channel.runtime-BrDb4cP8.js +0 -88
  1218. package/dist/channel.runtime-C1cLfrDt.js +0 -254
  1219. package/dist/channel.runtime-CTM3VO2E.js +0 -4
  1220. package/dist/channel.runtime-CnodqvCJ.js +0 -733
  1221. package/dist/channel.runtime-Dmr8503H.js +0 -1008
  1222. package/dist/channel.runtime-DqzR3Gd9.js +0 -109
  1223. package/dist/channel.runtime-LOf0PHu_.js +0 -652
  1224. package/dist/channel.setup-1leD5F5B.js +0 -343
  1225. package/dist/channel.setup-D9UyWhXM.js +0 -1098
  1226. package/dist/channel.setup-DkVld-9Z.d.ts +0 -7
  1227. package/dist/channel.setup-DxT4prSl.d.ts +0 -8
  1228. package/dist/channel.setup-IHNFkdUD.js +0 -10
  1229. package/dist/channel.setup-YwXqilBB.d.ts +0 -6
  1230. package/dist/chat-DrycI6KH.js +0 -2666
  1231. package/dist/chrome-CgGY9FsG.js +0 -1503
  1232. package/dist/cli-backend-B3aNoTD4.d.ts +0 -5
  1233. package/dist/cli-backend-BVUFOLXj.d.ts +0 -5
  1234. package/dist/cli-compaction-DPmSHZx7.js +0 -347
  1235. package/dist/cli-metadata-eFfCoGmY.js +0 -22
  1236. package/dist/cli-nmYmL8lb.js +0 -1341
  1237. package/dist/cli-runner-BTOYShgV.js +0 -2
  1238. package/dist/cli-runner-DgXAxJVr.js +0 -540
  1239. package/dist/cli-runner.runtime-BeMsKcaS.js +0 -4
  1240. package/dist/cli-runner.runtime-DMD8X8-h.js +0 -3
  1241. package/dist/cli-shared-BAuePn3e.d.ts +0 -20
  1242. package/dist/cli-v6XF4hHd.d.ts +0 -20
  1243. package/dist/client-CKLZqMCW.js +0 -650
  1244. package/dist/client-adapter-B_0W-6Fx.js +0 -897
  1245. package/dist/client-factory-CdMLQFeA.js +0 -9
  1246. package/dist/command-auth-BxYfnQzs.js +0 -135
  1247. package/dist/command-execution-startup-CiV5yFW1.js +0 -87
  1248. package/dist/command-handlers-BAWROGlt.js +0 -1609
  1249. package/dist/command-registry-BqTMebZr.js +0 -4
  1250. package/dist/command-registry-C2Y8GeJl.js +0 -9
  1251. package/dist/command-registry-core-Bi-d0-WH.js +0 -110
  1252. package/dist/command-status.runtime-BSXHZzOq.js +0 -90
  1253. package/dist/commands-Z6AfrJar.d.ts +0 -113
  1254. package/dist/commands-acp-BYWOkjAx.js +0 -74
  1255. package/dist/commands-compact.runtime-Cyb7Pu12.js +0 -10
  1256. package/dist/commands-handlers.runtime-DdJ20XTn.js +0 -6154
  1257. package/dist/commands-status-6uhiUw13.js +0 -3
  1258. package/dist/commands-status-BJ5AnkOG.js +0 -16
  1259. package/dist/commands-status.runtime-6uhiUw13.js +0 -3
  1260. package/dist/commands-subagents-control.runtime-DZrrLjSk.js +0 -2
  1261. package/dist/commands-subagents-control.runtime-_R3XgUpp.js +0 -3
  1262. package/dist/commands-system-prompt-CHGtJPnx.js +0 -162
  1263. package/dist/commands-system-prompt-CM23NlDu.js +0 -2
  1264. package/dist/commands.runtime-DUEbtHG1.js +0 -176
  1265. package/dist/compact-BA6lVtLj.js +0 -480
  1266. package/dist/compact-BfC-utPW.js +0 -1141
  1267. package/dist/compact.runtime-BRL2wCqh.js +0 -12
  1268. package/dist/completion-cli-CYKoLZLl.js +0 -315
  1269. package/dist/computer-use-BWgYktaW.js +0 -367
  1270. package/dist/config-B_HanwOV.js +0 -373
  1271. package/dist/config-DhGtxK9v.js +0 -2
  1272. package/dist/config-cli-CI5UtWr-.js +0 -1633
  1273. package/dist/config-mutations-D2GtlLMA.js +0 -159
  1274. package/dist/config-schema-BKOfHz23.d.ts +0 -20
  1275. package/dist/configure-CuPwIiwW.js +0 -3
  1276. package/dist/configure.commands-BWpwrafi.js +0 -1251
  1277. package/dist/configure.commands-qzipmoDP.js +0 -2
  1278. package/dist/context-engine-host-compat-D246ZMR2.js +0 -2
  1279. package/dist/context-engine-host-compat-KMl-oqCw.js +0 -288
  1280. package/dist/context-engine-lifecycle-DvEDHkQz.js +0 -1274
  1281. package/dist/contracts-testkit-Ym3exIK5.d.ts +0 -145
  1282. package/dist/control-auth-B_RiUaHt.js +0 -114
  1283. package/dist/control-service-DcQFx6_O.js +0 -145
  1284. package/dist/control-ui/assets/agents-Bc8cIfWF.js +0 -1008
  1285. package/dist/control-ui/assets/channel-config-extras-DQru4ECs.js +0 -2
  1286. package/dist/control-ui/assets/channels-BfncerPV.js +0 -367
  1287. package/dist/control-ui/assets/cron-DHLcga_r.js +0 -1013
  1288. package/dist/control-ui/assets/debug-DprDzDn1.js +0 -97
  1289. package/dist/control-ui/assets/index-XTZKpkBL.js +0 -7370
  1290. package/dist/control-ui/assets/instances-D1_lOT13.js +0 -57
  1291. package/dist/control-ui/assets/logs-DINx8syb.js +0 -74
  1292. package/dist/control-ui/assets/nodes-BH4XOUmD.js +0 -436
  1293. package/dist/control-ui/assets/sessions-D5Xt25SY.js +0 -399
  1294. package/dist/control-ui/assets/skills-BmayrBHY.js +0 -314
  1295. package/dist/control-ui/assets/skills-shared-CHaYSJ_s.js +0 -11
  1296. package/dist/conversation-binding-runtime-_jhzwiiC.js +0 -4
  1297. package/dist/conversation-runtime-F5kCN0Sj.js +0 -31
  1298. package/dist/core-BpeKfqbI.d.ts +0 -224
  1299. package/dist/core-DE71gncT.js +0 -282
  1300. package/dist/core-api-B4L5WkKc.js +0 -5
  1301. package/dist/core-api-Q9oM19yY.js +0 -2
  1302. package/dist/crestodian-DLpxYmzP.js +0 -55
  1303. package/dist/daocore-runtime-BnYtDbMC.d.ts +0 -151
  1304. package/dist/daocore-tools-wNTIZIO3.js +0 -11727
  1305. package/dist/dashboard-SHmcCcnT.js +0 -263
  1306. package/dist/delivery-BA4di5Tw.js +0 -1002
  1307. package/dist/dev-Cr2Dhgoc.js +0 -97
  1308. package/dist/dialogue-xI4qAuLY.js +0 -37
  1309. package/dist/dir-fetch-tool-6d4yElM4.js +0 -565
  1310. package/dist/dir-list-tool-D2k-hax6.js +0 -100
  1311. package/dist/direct-dm-eGyFHTug.js +0 -64
  1312. package/dist/directive-handling.fast-lane-Ci1l6GN_.js +0 -68
  1313. package/dist/directive-handling.impl-Co3i_YQ4.js +0 -818
  1314. package/dist/directive-handling.impl-DHKC0TrU.js +0 -2
  1315. package/dist/directive-handling.model-selection-bv5KrHOw.js +0 -122
  1316. package/dist/directive-handling.persist.runtime-CPLg-YHh.js +0 -263
  1317. package/dist/dispatch-CdvERWY-.js +0 -1640
  1318. package/dist/dispatch-acp-transcript.runtime-BhQo1XEg.js +0 -40
  1319. package/dist/dispatch-acp.runtime-Dtiu2EgE.js +0 -18
  1320. package/dist/doctor-BzsPHvLP.js +0 -2
  1321. package/dist/doctor-Cg4FWB15.js +0 -6
  1322. package/dist/doctor-config-flow-SYjHcyu4.js +0 -1741
  1323. package/dist/doctor-core-checks-75amkN-e.js +0 -2
  1324. package/dist/doctor-core-checks-B1fu7KDm.js +0 -573
  1325. package/dist/doctor-health-contributions-BMdJKStr.js +0 -696
  1326. package/dist/doctor-health-vLyDQqfq.js +0 -65
  1327. package/dist/doctor-lint-DfvFyBgL.js +0 -94
  1328. package/dist/doctor-prompter-C-dTuOnw.js +0 -58
  1329. package/dist/doctor-state-integrity-Cv-ECLuv.js +0 -1231
  1330. package/dist/dynamic-tools-BG8ijDFH.js +0 -486
  1331. package/dist/embedded-backend-bRfALCWz.js +0 -579
  1332. package/dist/embedded-gateway-stub.runtime-CAh3IhtZ.js +0 -12
  1333. package/dist/embedding-provider-B7kg9IhC.d.ts +0 -16
  1334. package/dist/embedding-provider-jB1zjkZy.d.ts +0 -65
  1335. package/dist/embedding-provider-sea2CddJ.d.ts +0 -21
  1336. package/dist/exec-approvals-BBa28Sct.js +0 -149
  1337. package/dist/file-fetch-tool-DRIsI7eQ.js +0 -124
  1338. package/dist/file-write-tool-vTMh7eW6.js +0 -127
  1339. package/dist/format-nrhTS41q.js +0 -1145
  1340. package/dist/gateway-cli-CCgw11Ik.js +0 -435
  1341. package/dist/gateway-method-runtime-BNAVGCC_.js +0 -21
  1342. package/dist/gateway-runtime-DGdJumdK.d.ts +0 -163
  1343. package/dist/gemini-cli-provider-Bbpd5lx5.d.ts +0 -6
  1344. package/dist/get-reply-DGFCqKen.js +0 -4689
  1345. package/dist/get-reply-from-config.runtime-l7NTyCh5.js +0 -2
  1346. package/dist/graph-users-CGpakgek.js +0 -1419
  1347. package/dist/group-access-D095jQ78.js +0 -112
  1348. package/dist/handle-action.guild-admin-B3pALmMq.js +0 -288
  1349. package/dist/harness-Bs-sPbOD.js +0 -61
  1350. package/dist/health-4gWMIKHu.js +0 -4
  1351. package/dist/heartbeat-runner-Sky_Rjw7.js +0 -5
  1352. package/dist/heartbeat-runner.runtime-CRZ-NbrW.js +0 -4
  1353. package/dist/help-B68Ov4LD.js +0 -136
  1354. package/dist/hooks-DWSdYas_.js +0 -534
  1355. package/dist/http-registry-CHKiFHCC.d.ts +0 -23
  1356. package/dist/image-generation-runtime-p-dfXZTf.d.ts +0 -21
  1357. package/dist/inbound-direct-dm-runtime-5z3W9Oqn.js +0 -2
  1358. package/dist/inbound-reply-dispatch-D7NeeFC1.js +0 -148
  1359. package/dist/index-CKAHTIU4.d.ts +0 -3971
  1360. package/dist/init-BXF3o80o.js +0 -59
  1361. package/dist/inline-buttons-DsHwKEVU.js +0 -40
  1362. package/dist/interactive-dispatch-BsKWomnh.d.ts +0 -143
  1363. package/dist/interactive-dispatch-CItEYOu3.d.ts +0 -56
  1364. package/dist/internal-events-TAN9dPEj.js +0 -90
  1365. package/dist/isolated-agent-CTrVGI6q.js +0 -2
  1366. package/dist/isolated-agent-DPyibJ8B.js +0 -1118
  1367. package/dist/lifecycle-BwTg0Djv.js +0 -571
  1368. package/dist/list.probe-BpM4PKu7.js +0 -449
  1369. package/dist/list.status-command-BbcloYBd.js +0 -789
  1370. package/dist/llm-slug-generator-UG7Bhj_y.js +0 -78
  1371. package/dist/loader-D6z2PEKl.d.ts +0 -142
  1372. package/dist/local-dispatch.runtime-CU6Y-BDa.js +0 -9
  1373. package/dist/manager-C3AVKMSl.d.ts +0 -356
  1374. package/dist/manager.runtime-Da5LiiaQ.js +0 -2714
  1375. package/dist/markdown-to-line-BnESmsY4.js +0 -811
  1376. package/dist/mcp-http-C38KS7On.js +0 -2
  1377. package/dist/mcp-http-CcGhAZcF.js +0 -555
  1378. package/dist/media-understanding-provider-BCz5dVl6.js +0 -339
  1379. package/dist/memory-core-host-engine-storage-sWQlfr8J.d.ts +0 -54
  1380. package/dist/memory-embedding-adapter-BrGY0ecB.d.ts +0 -5
  1381. package/dist/message-actions-CQURSOZH.js +0 -145
  1382. package/dist/message-handler-C2U3bt-X.js +0 -1715
  1383. package/dist/message-handler-CwZfuHhP.js +0 -384
  1384. package/dist/message-handler.preflight-Cosa3kg0.js +0 -1125
  1385. package/dist/message-handler.process-BlKFMYXw.js +0 -1484
  1386. package/dist/migration-hAtbc95i.d.ts +0 -45
  1387. package/dist/model-B8M2deNL.js +0 -74
  1388. package/dist/model-Ck-vNyGd.d.ts +0 -33
  1389. package/dist/model-selection-v2wQWgsT.js +0 -272
  1390. package/dist/models-B7IiQBWY.js +0 -104
  1391. package/dist/models-CnWFsPX6.d.ts +0 -24
  1392. package/dist/models-DMNzBNgt.js +0 -2
  1393. package/dist/models-cli-CQaOg02d.js +0 -256
  1394. package/dist/monitor-Bd9kOezJ.js +0 -1370
  1395. package/dist/monitor-Cy6D6MyS.js +0 -715
  1396. package/dist/monitor-DStY23C4.js +0 -834
  1397. package/dist/monitor-DnF8eltK.js +0 -1657
  1398. package/dist/monitor-DrFJ63I1.js +0 -4377
  1399. package/dist/monitor-J8jOsDaJ.js +0 -60
  1400. package/dist/monitor-auth-DKkbt_CR.js +0 -179
  1401. package/dist/monitor-jp3H9Ri_.js +0 -2
  1402. package/dist/monitor-polling.runtime-DPCAacPc.js +0 -883
  1403. package/dist/monitor-tBNmyf1s.js +0 -2788
  1404. package/dist/monitor-webhook.runtime-BnjEsLRS.js +0 -387
  1405. package/dist/monitor.account-Gh8FuMEq.js +0 -5233
  1406. package/dist/monitor.runtime-Bdh6dxyq.js +0 -2
  1407. package/dist/monitor.webhook-BosT2ylg.js +0 -180
  1408. package/dist/node-cli-sessions-B0_DtIxz.js +0 -1228
  1409. package/dist/onboard-CiTp3HuT.js +0 -733
  1410. package/dist/onboard-helpers-6NgX4RkW.js +0 -251
  1411. package/dist/onboard-helpers-BwxJT_0T.js +0 -6
  1412. package/dist/onboard-remote-CNCFouj7.js +0 -212
  1413. package/dist/onboard-remote-DXzWgH_H.js +0 -2
  1414. package/dist/onboard-skills-Dx58zrXg.js +0 -160
  1415. package/dist/onboard-skills-qaynAMqw.js +0 -2
  1416. package/dist/openai-codex-provider-Bj9cyh4I.d.ts +0 -5
  1417. package/dist/openai-http-Dp0cp01u.js +0 -824
  1418. package/dist/openai-provider-Dm3YkkWf.d.ts +0 -5
  1419. package/dist/openresponses-http-acbxr5UW.js +0 -1173
  1420. package/dist/operations-BZVuEl9E.js +0 -805
  1421. package/dist/outbound-adapter-BKGzT1Rl.js +0 -543
  1422. package/dist/outbound-session-route-mWVuRF9I.js +0 -45
  1423. package/dist/outbound.runtime-BTjY78St.js +0 -2
  1424. package/dist/pi-embedded-CFP2IrYS.js +0 -3796
  1425. package/dist/pi-embedded-D8caT0Nm.js +0 -4
  1426. package/dist/pi-embedded.runtime-eBik36nq.js +0 -4
  1427. package/dist/pi-tools-DOiFN8QJ.js +0 -2413
  1428. package/dist/plan-Cq2-YWkv.js +0 -112
  1429. package/dist/plan-DZacZ3Zv.js +0 -81
  1430. package/dist/plugin-BcNkVMQf.d.ts +0 -17
  1431. package/dist/plugin-app-cache-key-CBK84hKp.js +0 -46
  1432. package/dist/plugin-enabled-CMfz3hfi.js +0 -233
  1433. package/dist/plugin-entry-BS5QKDoz.d.ts +0 -47
  1434. package/dist/plugin-k9ChkvvX.js +0 -12396
  1435. package/dist/plugin-registration-DzPoDboh.js +0 -88
  1436. package/dist/plugin-runtime-BNGhLQ-_.d.ts +0 -117
  1437. package/dist/plugin-service-BynKHNHj.d.ts +0 -24
  1438. package/dist/plugin-service-Ckp9CgP5.js +0 -1229
  1439. package/dist/policy-CBa8yH5k.js +0 -680
  1440. package/dist/policy-Dlam-IbU.js +0 -138
  1441. package/dist/prepare.runtime-B8h04--2.js +0 -732
  1442. package/dist/preview-warnings-DPDK9HPk.js +0 -392
  1443. package/dist/probe-Bts3wK7l.js +0 -682
  1444. package/dist/probe-ByHrOECy.js +0 -47
  1445. package/dist/probe-CXqCx5yV.js +0 -2204
  1446. package/dist/probe-fhhJ0LMx.js +0 -2
  1447. package/dist/program-DfNLP_PI.js +0 -131
  1448. package/dist/prompt-overlay-qKGGXVs-.d.ts +0 -23
  1449. package/dist/provider-CeG5mirD.js +0 -8735
  1450. package/dist/provider-D_TXf9b1.js +0 -152
  1451. package/dist/provider-Fb0fhEC5.js +0 -32
  1452. package/dist/provider-api-key-auth-BIph5btg.d.ts +0 -27
  1453. package/dist/provider-auth-result-BFvMZrH6.d.ts +0 -21
  1454. package/dist/provider-catalog-runtime-Du74RUel.d.ts +0 -23
  1455. package/dist/provider-catalog-shared-B3nN3sf2.d.ts +0 -62
  1456. package/dist/provider-dispatcher-DQ0FP7Oj.js +0 -22
  1457. package/dist/provider-hook-runtime-CRpS8VJ_.d.ts +0 -61
  1458. package/dist/provider-model-shared-GrPEK3SY.d.ts +0 -143
  1459. package/dist/provider-models-iUJVn9QI.d.ts +0 -12
  1460. package/dist/provider-policy-DliVEM__.d.ts +0 -30
  1461. package/dist/provider-registration-BxzmE1yB.d.ts +0 -6
  1462. package/dist/provider-registry-B4AQXjYK.d.ts +0 -8
  1463. package/dist/provider-registry-BHyB46kI.d.ts +0 -30
  1464. package/dist/provider-registry-CnfpUSqh.d.ts +0 -8
  1465. package/dist/provider-runtime-D3j0VBbF.d.ts +0 -359
  1466. package/dist/provider-self-hosted-setup-_11XAmRH.d.ts +0 -74
  1467. package/dist/provider-session.runtime-CIMJ-7ay.js +0 -9
  1468. package/dist/provider-stream-mWxYXsAm.d.ts +0 -140
  1469. package/dist/provider-stream-shared-QayId-fm.d.ts +0 -128
  1470. package/dist/provider-xNaUQ5Lv.js +0 -32
  1471. package/dist/provider.runtime-CGsYbZGk.js +0 -2
  1472. package/dist/providers.runtime-fmZQlSRt.d.ts +0 -25
  1473. package/dist/public-surface-loader-CuVkM64A.js +0 -114
  1474. package/dist/pw-ai-BDGftH9e.js +0 -3029
  1475. package/dist/pw-role-snapshot-C_P091Iv.js +0 -333
  1476. package/dist/reaction-level-DKxiNfWB.js +0 -19
  1477. package/dist/reaction-runtime-api-TY4aPHui.js +0 -116
  1478. package/dist/realtime-transcription-CmRx7wX7.d.ts +0 -43
  1479. package/dist/realtime-transcription-provider-BNca2pAl.js +0 -205
  1480. package/dist/realtime-transcription-provider-Csl2NRiB.d.ts +0 -5
  1481. package/dist/realtime-transcription-provider-CtUTdTS4.d.ts +0 -37
  1482. package/dist/realtime-transcription-provider-DKd69ns6.d.ts +0 -28
  1483. package/dist/realtime-transcription-provider-DPj1VZIg.d.ts +0 -32
  1484. package/dist/realtime-voice-CVgV9cqF.d.ts +0 -333
  1485. package/dist/realtime-voice-provider-CmtxwZon.d.ts +0 -5
  1486. package/dist/register-DLjqO2vR.js +0 -2178
  1487. package/dist/register.agent-FV7a6yzo.js +0 -156
  1488. package/dist/register.configure-DrkSyKW3.js +0 -16
  1489. package/dist/register.crestodian-CQGAa8z2.js +0 -24
  1490. package/dist/register.maintenance-tocHfiS3.js +0 -83
  1491. package/dist/register.onboard-BomHnBGE.js +0 -113
  1492. package/dist/register.runtime-6AmV3Vgs.js +0 -54
  1493. package/dist/register.runtime-CSz0gVBB.d.ts +0 -6
  1494. package/dist/register.setup-ENYtNAA5.js +0 -40
  1495. package/dist/register.subclis-BC6TefAM.js +0 -31
  1496. package/dist/register.subclis-DZdEZgSS.js +0 -3
  1497. package/dist/register.subclis-core-C-EfowrU.js +0 -273
  1498. package/dist/registry-VitXYFE8.d.ts +0 -91
  1499. package/dist/registry-types-C4eAzEgQ.d.ts +0 -392
  1500. package/dist/repair-sequencing-l8dFaytn.js +0 -640
  1501. package/dist/reply-delivery-DdeUWVuk.js +0 -196
  1502. package/dist/reply-runtime-Bd91JEZL.js +0 -11
  1503. package/dist/reply.runtime-l7NTyCh5.js +0 -2
  1504. package/dist/request-BY_4UukN.js +0 -54
  1505. package/dist/resolve-allowlist-C4lmxl4V.js +0 -220
  1506. package/dist/result-fallback-classifier-XORMMp30.js +0 -79
  1507. package/dist/root-help-CTW0Wyrf.js +0 -43
  1508. package/dist/route-dOf1WMkJ.js +0 -469
  1509. package/dist/route-resolution-BddNYZEI.js +0 -274
  1510. package/dist/routes-D0xw72Lf.js +0 -3602
  1511. package/dist/routes-TXSPQFWS.js +0 -2
  1512. package/dist/run-DpvUuaWB.js +0 -1162
  1513. package/dist/run-attempt-Bet0PiSc.js +0 -7704
  1514. package/dist/run-command-C5vMVqMt.js +0 -23
  1515. package/dist/run-command-pNDd7NqP.js +0 -2
  1516. package/dist/run-embedded.runtime-CBZV6YWj.js +0 -4
  1517. package/dist/run-execution-cli.runtime-DTQLV8tA.js +0 -4
  1518. package/dist/run-subagent-registry.runtime-DJCvSdhY.js +0 -2
  1519. package/dist/runtime-CNXeG8vX.js +0 -1287
  1520. package/dist/runtime-DEOSWxv9.js +0 -438
  1521. package/dist/runtime-api-BCM7T4WV.js +0 -17
  1522. package/dist/runtime-api-BTnMvj8L.js +0 -13
  1523. package/dist/runtime-api-By6LEySM.js +0 -3
  1524. package/dist/runtime-api-Cd0b5LPQ.js +0 -4
  1525. package/dist/runtime-api-CtuDiikz.js +0 -21
  1526. package/dist/runtime-api-DjySILXC.js +0 -13
  1527. package/dist/runtime-api-XJTq_pyQ.js +0 -24
  1528. package/dist/runtime-api.actions-BmsSg8Ai.js +0 -3
  1529. package/dist/runtime-api.monitor-DSk7Pd5H.js +0 -6
  1530. package/dist/runtime-api.send-D3sPncy9.js +0 -4
  1531. package/dist/runtime-api.threads-BK9cB4L1.js +0 -2
  1532. package/dist/runtime-channel--Wjr2ePx.js +0 -150
  1533. package/dist/runtime-channel-WdTa9hHZ.js +0 -2
  1534. package/dist/runtime-embedded-pi.runtime-BNYBvaxo.js +0 -2
  1535. package/dist/runtime-r3jS5wSq.js +0 -6179
  1536. package/dist/runtime-taskflow-DMBY6o56.d.ts +0 -435
  1537. package/dist/sanitize-outbound-D6IBCCpn.js +0 -127
  1538. package/dist/sdk-setup-tools-DcDrd8tW.js +0 -8
  1539. package/dist/secrets-OV1uTwRt.js +0 -113
  1540. package/dist/secrets-cli-llC7t41S.js +0 -149
  1541. package/dist/security-audit-BM_fypcl.js +0 -118
  1542. package/dist/security-audit-CQ2yKgF8.js +0 -122
  1543. package/dist/security-audit.runtime-CRgJUegH.js +0 -2
  1544. package/dist/selection-DkJ7MaPC.js +0 -16157
  1545. package/dist/selection-LeUiOSn0.js +0 -3
  1546. package/dist/send-C0ZHzB6o.js +0 -1631
  1547. package/dist/send-CXL3cM-w.js +0 -192
  1548. package/dist/send-CuDA29HM.js +0 -2
  1549. package/dist/send-D7qhwK7Z.js +0 -143
  1550. package/dist/send.components-BNeg1zrc.js +0 -2
  1551. package/dist/send.components-DwRyC_Hc.js +0 -500
  1552. package/dist/send.runtime-DBIUdxpO.js +0 -2
  1553. package/dist/server-DGcm6Swr.js +0 -24
  1554. package/dist/server-DPvleC-x.js +0 -73
  1555. package/dist/server-context-BWBM4f-_.js +0 -955
  1556. package/dist/server-context-CFgwcLlu.js +0 -2
  1557. package/dist/server-cron-C1kChsjw.js +0 -2989
  1558. package/dist/server-cron-CS1EP5Li.js +0 -2
  1559. package/dist/server-methods-BcIlC8iD.js +0 -16494
  1560. package/dist/server-node-events-BAZCvZOy.js +0 -596
  1561. package/dist/server-plugin-bootstrap-cQUi21Uu.js +0 -70
  1562. package/dist/server-plugins-BRFre223.js +0 -432
  1563. package/dist/server-reload-handlers-DfcsAX-5.js +0 -714
  1564. package/dist/server-restart-sentinel-CFX5zQkM.js +0 -747
  1565. package/dist/server-restart-sentinel-DUvs77Q0.js +0 -2
  1566. package/dist/server-runtime-services-0vm5XmvV.js +0 -2
  1567. package/dist/server-runtime-services-CLz_vkLy.js +0 -267
  1568. package/dist/server-startup-plugins-CPXqqIRV.js +0 -113
  1569. package/dist/server-startup-post-attach-BkNe1Z6g.js +0 -716
  1570. package/dist/server-ws-runtime-rcJeRHFO.js +0 -349
  1571. package/dist/server.impl-a6knQ-N8.js +0 -2586
  1572. package/dist/service-H-BcELwS.js +0 -1446
  1573. package/dist/session-binding-BQliaqL7.js +0 -2
  1574. package/dist/session-binding-DPvZil_F.js +0 -219
  1575. package/dist/session-kill-http-DJMipluP.js +0 -121
  1576. package/dist/session-reset-service-Dn9FU5wA.js +0 -625
  1577. package/dist/session-route-JLWNmJxD.js +0 -93
  1578. package/dist/session-status.runtime-D0OptHcW.js +0 -2
  1579. package/dist/session-subagent-reactivation.runtime-BUmf1vNS.js +0 -2
  1580. package/dist/session-tab-registry-CoBvJVRj.js +0 -521
  1581. package/dist/sessions-history-http-B8CkLDAn.js +0 -430
  1582. package/dist/sessions.runtime-DbNqS_Gy.js +0 -2
  1583. package/dist/setup-CTZUUn1s.js +0 -586
  1584. package/dist/setup-D6fXOEjD.js +0 -2
  1585. package/dist/setup-api-DLPEXHCv.js +0 -29
  1586. package/dist/setup-core-DLXb29jm.js +0 -174
  1587. package/dist/setup-onboard-configure-help-fast-path-CrcZmKPI.js +0 -64
  1588. package/dist/setup-surface--Cct-rCt.js +0 -288
  1589. package/dist/setup-surface-CW8YN207.js +0 -320
  1590. package/dist/setup-surface-DIxcfqD0.js +0 -221
  1591. package/dist/setup-surface-IJ6kmKgi.js +0 -405
  1592. package/dist/setup.finalize-gWpWnCCk.js +0 -582
  1593. package/dist/setup.gateway-config-D_DaSfpW.js +0 -281
  1594. package/dist/setup.migration-import-CYZjCkle.js +0 -2
  1595. package/dist/setup.migration-import-CZJU4scH.js +0 -200
  1596. package/dist/shared-Bp_Fgv6B.js +0 -121
  1597. package/dist/shared-CLqPY0yv.d.ts +0 -115
  1598. package/dist/shared-client-OQdg8NGC.js +0 -629
  1599. package/dist/shared-client-dk1ICVBm.js +0 -2
  1600. package/dist/side-question-CbhRW3UI.js +0 -683
  1601. package/dist/simple-completion-runtime-XIF65b47.d.ts +0 -73
  1602. package/dist/skill-tool-dispatch.runtime-EcycYnWE.js +0 -143
  1603. package/dist/slash-state-BoX6WwB5.js +0 -2166
  1604. package/dist/speech-CvkJG5Mt.d.ts +0 -47
  1605. package/dist/speech-core-MG83lB3i.d.ts +0 -36
  1606. package/dist/speech-provider-1EN9hT-3.d.ts +0 -8
  1607. package/dist/speech-provider-67ebyEcs.js +0 -184
  1608. package/dist/speech-provider-B6tb45De.d.ts +0 -5
  1609. package/dist/speech-provider-C74wAyBX.d.ts +0 -5
  1610. package/dist/speech-provider-CYJoZZpj.d.ts +0 -8
  1611. package/dist/speech-provider-DavEMdKC.d.ts +0 -34
  1612. package/dist/speech-provider-DvFtveg6.d.ts +0 -5
  1613. package/dist/src-CbfOifft.js +0 -4256
  1614. package/dist/startup-context-YF24NARp.js +0 -313
  1615. package/dist/status-message-CcrZdfCO.js +0 -484
  1616. package/dist/status-message.runtime-Cptt1EPV.js +0 -6
  1617. package/dist/status-subagents.runtime-v2eijc4R.js +0 -18
  1618. package/dist/status-text-BWwar3Yc.js +0 -296
  1619. package/dist/status-tn3uQDY7.js +0 -73
  1620. package/dist/status.runtime-BFjTHLiQ.js +0 -2
  1621. package/dist/sticker-cache-Cs7LV_3a.js +0 -206
  1622. package/dist/sticker-vision.runtime-CyPMpoCs.js +0 -17
  1623. package/dist/stream-1rWKMSqV.d.ts +0 -16
  1624. package/dist/stream-Bk9TnoRV.d.ts +0 -10
  1625. package/dist/stream-DZeY9rhs.d.ts +0 -120
  1626. package/dist/stream-DgCoKjcL.d.ts +0 -19
  1627. package/dist/stream-exnufPSG.d.ts +0 -5
  1628. package/dist/stream-wrappers-D2EuY1tP.d.ts +0 -21
  1629. package/dist/subagent-announce-CRjGGxSB.js +0 -354
  1630. package/dist/subagent-announce-delivery-CbfRRdwt.js +0 -958
  1631. package/dist/subagent-control-VTsWynTB.js +0 -508
  1632. package/dist/subagent-hooks-BB__aHul.js +0 -2
  1633. package/dist/subagent-hooks-Cb5fJ2H0.js +0 -146
  1634. package/dist/subagent-hooks-CwVBMhp_.js +0 -2
  1635. package/dist/subagent-hooks-Cx9_GAMF.js +0 -116
  1636. package/dist/subagent-hooks-DOJhvTDx.js +0 -230
  1637. package/dist/subagent-hooks-DUMqhB3r.js +0 -2
  1638. package/dist/subagent-hooks-api-BDGmCxB2.js +0 -22
  1639. package/dist/subagent-hooks-api-CcTdPqP1.js +0 -23
  1640. package/dist/subagent-hooks-api-D18tQta6.js +0 -23
  1641. package/dist/subagent-orphan-recovery-6bNIX25Q.js +0 -352
  1642. package/dist/subagent-registry-DokIxoQ6.js +0 -2351
  1643. package/dist/subagent-registry-tlyJE0hN.js +0 -3
  1644. package/dist/subagent-session-cleanup-BWHQ6rcm.js +0 -525
  1645. package/dist/subagent-spawn-BUdUAwoc.js +0 -1164
  1646. package/dist/target-id-CI1U3MSO.js +0 -107
  1647. package/dist/targets-CbBORUXB.d.ts +0 -10
  1648. package/dist/targets-CgmlXrhv.js +0 -44
  1649. package/dist/targets-D-jSrLUN.js +0 -19
  1650. package/dist/targets-DPDu8x6v.js +0 -19
  1651. package/dist/targets-D_fXvxrg.d.ts +0 -10
  1652. package/dist/testing-D-48HuIK.js +0 -267
  1653. package/dist/thinking-policy-CY16OlCs.d.ts +0 -5
  1654. package/dist/thread-bindings-B9J0nGG7.js +0 -232
  1655. package/dist/thread-bindings-BByWvFZq.js +0 -8
  1656. package/dist/thread-bindings-Cxjm2mLg.js +0 -571
  1657. package/dist/thread-bindings-DQWmglaO.js +0 -228
  1658. package/dist/thread-bindings.discord-api-DWWDvMgL.js +0 -187
  1659. package/dist/thread-bindings.manager-CQW6bNs5.js +0 -2
  1660. package/dist/thread-bindings.manager-DpBYBs9s.js +0 -536
  1661. package/dist/thread-lifecycle-PpB8gTx1.js +0 -1614
  1662. package/dist/token-CBy6YYM_.js +0 -134
  1663. package/dist/tool-BCHcwX9p.js +0 -139
  1664. package/dist/tool-actions.runtime-Cwxr2NmB.js +0 -534
  1665. package/dist/tool-plugin-DHZYdwyJ.d.ts +0 -77
  1666. package/dist/tool-resolution-DQpf531V.js +0 -149
  1667. package/dist/tool-split-ClZW5eN5.d.ts +0 -19
  1668. package/dist/tools-effective-inventory-BHxeIAri.js +0 -204
  1669. package/dist/tools-invoke-http-Bv2LES5Q.js +0 -67
  1670. package/dist/tools-invoke-shared-Cf_ifab9.js +0 -200
  1671. package/dist/transport-stream-D_pZ9Qwv.d.ts +0 -42
  1672. package/dist/tts-CjTcF0YS.js +0 -66
  1673. package/dist/tui-D3_WpyGV.js +0 -2
  1674. package/dist/tui-Y8IezK6P.js +0 -4709
  1675. package/dist/tui-backend-BIJbrfDK.js +0 -256
  1676. package/dist/tui-cli-YVLQJGLU.js +0 -37
  1677. package/dist/types-CnKegQ41.d.ts +0 -786
  1678. package/dist/types-Dyry5PA_2.d.ts +0 -3650
  1679. package/dist/types.public-AUFnQi6j.d.ts +0 -70
  1680. package/dist/update-cli-B7MOXy4Y.js +0 -3664
  1681. package/dist/video-generation-runtime-Cc8klYNS.d.ts +0 -21
  1682. package/dist/video-model-catalog-XG42YlJS.d.ts +0 -16
  1683. package/dist/vision-tools-kEwnV2UO.js +0 -1409
  1684. package/dist/web-search-DH1W_lfx.js +0 -62
  1685. package/dist/web-search-provider.runtime-BX9TezsY.js +0 -328
  1686. package/dist/web-search-provider.runtime-BhRjYeyp.js +0 -2
  1687. package/dist/webhook-targets--wGRjxMd.d.ts +0 -99
  1688. package/dist/xai-oauth-BZQ--94U.js +0 -479
  1689. package/dist/xai-user-agent-SpZaKTGR.js +0 -32
  1690. /package/dist/{acp-runtime-backend-DU5R8SXu.js → acp-runtime-backend-DHyoMnZY.js} +0 -0
  1691. /package/dist/{channel-actions-Ce2Sna1a.js → channel-actions-B5OPAiNK.js} +0 -0
  1692. /package/dist/{command-status-runtime-Cj5vB8lc.js → command-status-runtime-BqQvv1BR.js} +0 -0
  1693. /package/dist/{delegate-BeKeQwNR.js → delegate-B1QIF1j8.js} +0 -0
  1694. /package/dist/{dispatch-acp-DXlzEM_A.js → dispatch-acp-Ch9ZmM4b.js} +0 -0
  1695. /package/dist/{heartbeat-runner-Dncw_0KS.js → heartbeat-runner-BkgH94IS.js} +0 -0
  1696. /package/dist/{library-6cU4n1-c.js → library-DP1oARlw.js} +0 -0
  1697. /package/dist/{run-executor.runtime-DjwaphFT.js → run-executor.runtime-Czk4Lxkj.js} +0 -0
  1698. /package/dist/{shared-BE5PSFeb.js → shared-SiM6kZAE.js} +0 -0
@@ -1,3664 +0,0 @@
1
- import { a as normalizeLowercaseStringOrEmpty, c as normalizeOptionalString } from "./string-coerce-DyL154ka.js";
2
- import { t as resolveDaoCorePackageRoot } from "./daocore-root-CtcNbdeM.js";
3
- import { d as resolveIncludeRoots, n as DEFAULT_GATEWAY_PORT, t as CONFIG_PATH, u as resolveGatewayPort } from "./paths-ZwPDM6zn.js";
4
- import { n as resolveCliName, t as replaceCliName } from "./cli-name-jOXS5CgS.js";
5
- import { t as formatCliCommand } from "./command-format-tWmMYcvZ.js";
6
- import { t as formatDocsLink } from "./links-CM5vg8_V.js";
7
- import { r as theme } from "./theme-D58JpUfy.js";
8
- import { n as inheritOptionFromParent } from "./command-options-Dhjl7AMa.js";
9
- import "./daemon-cli-DJRA_hOn.js";
10
- import { E as pathExists } from "./fs-safe-BFN3ftAo.js";
11
- import { p as resolveUserPath, u as pathExists$1 } from "./utils-CNnMhEDp.js";
12
- import { r as resolveConfigEnvVars } from "./env-substitution-D-Bqv65n.js";
13
- import { i as GATEWAY_SERVICE_RUNTIME_PID_ENV, m as resolveGatewayWindowsTaskName, p as resolveGatewaySystemdServiceName, u as resolveGatewayLaunchAgentLabel } from "./constants-DZBCdcay.js";
14
- import { i as resolveGatewayInstallEntrypoint } from "./gateway-entrypoint-Fvj9eT8J.js";
15
- import { n as VERSION } from "./version-j6aVEPCK.js";
16
- import { a as resolveDefaultPluginNpmDir } from "./install-paths-wshgrJTh.js";
17
- import { n as readPersistedInstalledPluginIndex } from "./installed-plugin-index-store-B8HH0THM.js";
18
- import { a as readJsonIfExists, m as writeJson } from "./json-files-D7wa8Ux4.js";
19
- import { c as resolveEffectiveEnableState, s as normalizePluginsConfig } from "./config-state-YvXWZeFQ.js";
20
- import { t as loadInstalledPluginIndexInstallRecords } from "./installed-plugin-index-record-reader-DFAIDyGb.js";
21
- import { o as resolvePackageExtensionEntries } from "./manifest-DbwIPpku.js";
22
- import { r as validatePackageExtensionEntriesForInstall } from "./package-entry-resolution-ZpftJNrs.js";
23
- import { n as defaultRuntime } from "./runtime-E_A14BX_.js";
24
- import { a as parseSemver, i as nodeVersionSatisfiesEngine } from "./runtime-guard-CeaQ7tel.js";
25
- import { c as resolveOfficialExternalPluginInstall, r as getOfficialExternalPluginCatalogManifest, t as getOfficialExternalPluginCatalogEntry } from "./official-external-plugin-catalog-D1DpizID.js";
26
- import { t as loadPluginManifestRegistryForInstalledIndex } from "./manifest-registry-installed-D4O9NZ2i.js";
27
- import { r as runCommandWithTimeout } from "./exec-BpTrisS-.js";
28
- import { F as asResolvedSourceConfig, I as asRuntimeConfig, K as createPreUpdateConfigSnapshot, o as parseConfigJson5, p as readSourceConfigBestEffort, u as readConfigFileSnapshot } from "./io-CcynUC5m.js";
29
- import { a as withPluginInstallRecords, o as withoutPluginInstallRecords } from "./installed-plugin-index-records-Cz6JpQvn.js";
30
- import { a as resolveConfigIncludes } from "./includes-Dyyq3cbf.js";
31
- import { n as formatConfigIssueLines } from "./issue-format-c8ezaSew.js";
32
- import { n as assertConfigWriteAllowedInCurrentMode } from "./nix-mode-write-guard-BdS6kePT.js";
33
- import { r as mutateConfigFileWithRetry } from "./mutate-CIVoWqFQ.js";
34
- import { n as quoteCmdScriptArg } from "./cmd-argv-fj4pRVR6.js";
35
- import { r as getSelfAndAncestorPidsSync } from "./restart-stale-pids-DhQYU5p8.js";
36
- import { t as disableCurrentDaoCoreUpdateLaunchdJob } from "./launchd-hBRYEtKh.js";
37
- import { i as resolveGatewayRestartLogPath, n as renderPosixRestartLogSetup, o as shellEscapeRestartLogValue } from "./restart-logs-DHIuTlO-.js";
38
- import "./config-D3mxUrDI.js";
39
- import { i as resolveGatewayService, r as readGatewayServiceState } from "./service-C-Cl3Ppm.js";
40
- import { n as runDaemonInstall } from "./install-DVVn5x2k.js";
41
- import { a as recoverInstalledLaunchAgent, t as runDaemonRestart } from "./lifecycle-B8g4NnPs.js";
42
- import { l as waitForGatewayHealthyRestart, o as renderRestartDiagnostics, s as terminateStaleGatewayPids } from "./restart-health-CMWaOHhW.js";
43
- import { u as trimLogTail } from "./restart-sentinel-4lLlUHCK.js";
44
- import { r as formatDurationPrecise } from "./format-duration-BrZ-AaEJ.js";
45
- import { i as relinkDaoCorePeerDependenciesInManagedNpmRoot, n as auditDaoCorePeerDependencyLink } from "./plugin-peer-link-CGmlrTX9.js";
46
- import { n as stylePromptMessage } from "./prompt-style-DH7LpiPN.js";
47
- import { t as formatHelpExamples } from "./help-format-DXVAk021.js";
48
- import { r as commitPluginInstallRecordsWithConfig } from "./plugins-install-record-commit-BlmRMT3o.js";
49
- import { t as refreshPluginRegistryAfterConfigMutation } from "./plugins-registry-refresh-BFVkLu8q.js";
50
- import { c as resolveEffectiveUpdateChannel, i as formatUpdateChannelLabel, l as resolveRegistryUpdateChannel, r as channelToNpmTag, s as normalizeUpdateChannel, u as resolveUpdateChannelDisplay } from "./update-channels-f-ieRme5.js";
51
- import { a as installCompletion, n as COMPLETION_SKIP_PLUGIN_COMMANDS_ENV } from "./completion-runtime-BfGS2hGl.js";
52
- import { n as renderTable, t as getTerminalTableWidth } from "./table-CgadVAEi.js";
53
- import { i as updateNpmInstalledPlugins, n as resolveTrustedSourceLinkedOfficialNpmSpec, r as syncPluginsForUpdateChannel, t as resolveTrustedSourceLinkedOfficialClawHubSpec } from "./update-DUvOXYSk.js";
54
- import { n as readPackageName, r as readPackageVersion } from "./package-json-CIZcDaQ6.js";
55
- import { i as fetchNpmTagVersion, n as compareSemverStrings, o as resolveNpmChannelTag, r as fetchNpmPackageTargetStatus, t as checkUpdateStatus } from "./update-check-BhQUU8g2.js";
56
- import { i as resolveUpdateAvailability, n as formatUpdateOneLiner, t as formatUpdateAvailableHint } from "./status.update-BYn9UP9Q.js";
57
- import { a as cleanupGlobalRenameDirs, c as detectGlobalInstallManagerForRoot, d as resolveGlobalInstallTarget, f as resolvePnpmGlobalDirFromGlobalRoot, i as canResolveRegistryVersionForPackageTarget, l as globalInstallArgs, n as runGatewayUpdate, o as createGlobalInstallEnv, p as normalizePackageTagInput, r as runGlobalPackageUpdateSteps, s as detectGlobalInstallManagerByPresence, u as resolveGlobalInstallSpec } from "./update-runner-ofbxhN8Z.js";
58
- import { r as ensureCompletionCacheExists, t as checkShellCompletionStatus } from "./doctor-completion-CmYrUrCV.js";
59
- import { t as doctorCommand } from "./doctor-Cg4FWB15.js";
60
- import { n as UPDATE_PARENT_SUPPORTS_DOCTOR_CONFIG_WRITE_ENV, r as UPDATE_POST_CORE_CONVERGENCE_ENV, t as UPDATE_DEFER_CONFIGURED_PLUGIN_INSTALL_REPAIR_ENV } from "./update-phase-CsC-RZSA.js";
61
- import { t as summarizeGatewayServiceLayout } from "./service-layout-EdjNiu4j.js";
62
- import { c as writeControlPlaneUpdateRestartSentinel, i as buildControlPlaneUpdateRestartHealthPendingResult, o as markControlPlaneUpdateRestartSentinelFailure, s as readControlPlaneUpdateSentinelMeta } from "./update-control-plane-sentinel-C6MEKyRJ.js";
63
- import { n as cleanupStaleManagedServiceUpdateHandoffs } from "./update-managed-service-handoff-cleanup-PGMcTNLe.js";
64
- import { t as repairMissingConfiguredPluginInstalls } from "./missing-configured-plugin-install-_8xxr-Qw.js";
65
- import { n as pruneStaleLocalBundledPluginInstallRecords } from "./stale-local-bundled-plugin-install-records-D5Yid5Hs.js";
66
- import { t as selectStyled } from "./prompt-select-styled-Cp6-dKuR.js";
67
- import fs, { existsSync } from "node:fs";
68
- import path from "node:path";
69
- import fs$1 from "node:fs/promises";
70
- import os from "node:os";
71
- import { execFile, spawn, spawnSync } from "node:child_process";
72
- import { Writable } from "node:stream";
73
- import { confirm, isCancel, spinner } from "@clack/prompts";
74
- //#region src/cli/update-cli/shared.ts
75
- const INVALID_TIMEOUT_ERROR = "--timeout must be a positive integer (seconds)";
76
- function parseTimeoutMsOrExit(timeout) {
77
- if (timeout === void 0) return;
78
- const trimmed = timeout.trim();
79
- const seconds = Number(trimmed);
80
- if (!/^\d+$/u.test(trimmed) || !Number.isSafeInteger(seconds) || seconds <= 0) {
81
- defaultRuntime.error(INVALID_TIMEOUT_ERROR);
82
- defaultRuntime.exit(1);
83
- return null;
84
- }
85
- return seconds * 1e3;
86
- }
87
- const DAOCORE_REPO_URL = "https://github.com/openclaw/openclaw.git";
88
- const MAX_LOG_CHARS = 8e3;
89
- const DEFAULT_PACKAGE_NAME = "daocore";
90
- const CORE_PACKAGE_NAMES = new Set([DEFAULT_PACKAGE_NAME]);
91
- function normalizeTag(value) {
92
- return normalizePackageTagInput(value, ["daocore", DEFAULT_PACKAGE_NAME]);
93
- }
94
- function normalizeVersionTag(tag) {
95
- const trimmed = tag.trim();
96
- if (!trimmed) return null;
97
- const cleaned = trimmed.startsWith("v") ? trimmed.slice(1) : trimmed;
98
- return parseSemver(cleaned) ? cleaned : null;
99
- }
100
- async function resolveTargetVersion(tag, timeoutMs) {
101
- if (!canResolveRegistryVersionForPackageTarget(tag)) return null;
102
- const direct = normalizeVersionTag(tag);
103
- if (direct) return direct;
104
- return (await fetchNpmTagVersion({
105
- tag,
106
- timeoutMs
107
- })).version ?? null;
108
- }
109
- async function isGitCheckout(root) {
110
- try {
111
- await fs$1.stat(path.join(root, ".git"));
112
- return true;
113
- } catch {
114
- return false;
115
- }
116
- }
117
- async function isCorePackage(root) {
118
- const name = await readPackageName(root);
119
- return Boolean(name && CORE_PACKAGE_NAMES.has(name));
120
- }
121
- async function isEmptyDir(targetPath) {
122
- try {
123
- return (await fs$1.readdir(targetPath)).length === 0;
124
- } catch {
125
- return false;
126
- }
127
- }
128
- function resolveGitInstallDir() {
129
- const override = process.env.DAOCORE_GIT_DIR?.trim();
130
- if (override) return path.resolve(override);
131
- return resolveDefaultGitDir();
132
- }
133
- function resolveDefaultGitDir() {
134
- const home = os.homedir();
135
- if (home.startsWith("/")) return path.posix.join(home, "daocore");
136
- return path.join(home, "daocore");
137
- }
138
- function resolveNodeRunner() {
139
- const base = normalizeLowercaseStringOrEmpty(path.basename(process.execPath));
140
- if (base === "node" || base === "node.exe") return process.execPath;
141
- return "node";
142
- }
143
- async function resolveUpdateRoot() {
144
- return await resolveDaoCorePackageRoot({
145
- moduleUrl: import.meta.url,
146
- argv1: process.argv[1],
147
- cwd: process.cwd()
148
- }) ?? process.cwd();
149
- }
150
- async function runUpdateStep(params) {
151
- const command = params.argv.join(" ");
152
- params.progress?.onStepStart?.({
153
- name: params.name,
154
- command,
155
- index: 0,
156
- total: 0
157
- });
158
- const started = Date.now();
159
- const res = await runCommandWithTimeout(params.argv, {
160
- cwd: params.cwd,
161
- env: params.env,
162
- timeoutMs: params.timeoutMs
163
- });
164
- const durationMs = Date.now() - started;
165
- const stderrTail = trimLogTail(res.stderr, MAX_LOG_CHARS);
166
- params.progress?.onStepComplete?.({
167
- name: params.name,
168
- command,
169
- index: 0,
170
- total: 0,
171
- durationMs,
172
- exitCode: res.code,
173
- stderrTail
174
- });
175
- return {
176
- name: params.name,
177
- command,
178
- cwd: params.cwd ?? process.cwd(),
179
- durationMs,
180
- exitCode: res.code,
181
- stdoutTail: trimLogTail(res.stdout, MAX_LOG_CHARS),
182
- stderrTail
183
- };
184
- }
185
- async function ensureGitCheckout(params) {
186
- const gitEnv = params.env ?? await createGlobalInstallEnv();
187
- if (!await pathExists$1(params.dir)) return await runUpdateStep({
188
- name: "git clone",
189
- argv: [
190
- "git",
191
- "clone",
192
- DAOCORE_REPO_URL,
193
- params.dir
194
- ],
195
- env: gitEnv,
196
- timeoutMs: params.timeoutMs,
197
- progress: params.progress
198
- });
199
- if (!await isGitCheckout(params.dir)) {
200
- if (!await isEmptyDir(params.dir)) throw new Error(`DAOCORE_GIT_DIR points at a non-git directory: ${params.dir}. Set DAOCORE_GIT_DIR to an empty folder or an daocore checkout.`);
201
- return await runUpdateStep({
202
- name: "git clone",
203
- argv: [
204
- "git",
205
- "clone",
206
- DAOCORE_REPO_URL,
207
- params.dir
208
- ],
209
- cwd: params.dir,
210
- env: gitEnv,
211
- timeoutMs: params.timeoutMs,
212
- progress: params.progress
213
- });
214
- }
215
- if (!await isCorePackage(params.dir)) throw new Error(`DAOCORE_GIT_DIR does not look like a core checkout: ${params.dir}.`);
216
- return null;
217
- }
218
- async function resolveGlobalManager(params) {
219
- const runCommand = createGlobalCommandRunner();
220
- if (params.installKind === "package") {
221
- const detected = await detectGlobalInstallManagerForRoot(runCommand, params.root, params.timeoutMs);
222
- if (detected) return detected;
223
- }
224
- return await detectGlobalInstallManagerByPresence(runCommand, params.timeoutMs) ?? "npm";
225
- }
226
- const COMPLETION_CACHE_WRITE_TIMEOUT_MS = 3e4;
227
- const COMPLETION_CACHE_MANUAL_REFRESH_HINT = "Shell tab-completion may be stale; refresh manually with: daocore completion --write-state";
228
- async function tryWriteCompletionCache(root, jsonMode) {
229
- const binPath = path.join(root, "daocore.mjs");
230
- if (!await pathExists$1(binPath)) return;
231
- const result = spawnSync(resolveNodeRunner(), [
232
- binPath,
233
- "completion",
234
- "--write-state"
235
- ], {
236
- cwd: root,
237
- env: {
238
- ...process.env,
239
- [COMPLETION_SKIP_PLUGIN_COMMANDS_ENV]: "1"
240
- },
241
- encoding: "utf-8",
242
- timeout: COMPLETION_CACHE_WRITE_TIMEOUT_MS
243
- });
244
- if (result.error) {
245
- if (!jsonMode) {
246
- const reason = result.error.code === "ETIMEDOUT" ? `timed out after ${COMPLETION_CACHE_WRITE_TIMEOUT_MS / 1e3}s` : String(result.error);
247
- defaultRuntime.log(theme.warn(`Completion cache update failed: ${reason}. ${COMPLETION_CACHE_MANUAL_REFRESH_HINT}`));
248
- }
249
- return;
250
- }
251
- if (result.status !== 0 && !jsonMode) {
252
- const stderr = (result.stderr ?? "").trim();
253
- const detail = stderr ? ` (${stderr})` : "";
254
- defaultRuntime.log(theme.warn(`Completion cache update failed${detail}. ${COMPLETION_CACHE_MANUAL_REFRESH_HINT}`));
255
- }
256
- }
257
- function createGlobalCommandRunner() {
258
- return async (argv, options) => {
259
- const res = await runCommandWithTimeout(argv, options);
260
- return {
261
- stdout: res.stdout,
262
- stderr: res.stderr,
263
- code: res.code
264
- };
265
- };
266
- }
267
- //#endregion
268
- //#region src/cli/update-cli/status.ts
269
- function formatGitStatusLine(params) {
270
- const shortSha = params.sha ? params.sha.slice(0, 8) : null;
271
- const branch = params.branch && params.branch !== "HEAD" ? params.branch : null;
272
- const tag = params.tag;
273
- return [
274
- branch ?? (tag ? "detached" : "git"),
275
- tag ? `tag ${tag}` : null,
276
- shortSha ? `@ ${shortSha}` : null
277
- ].filter(Boolean).join(" · ");
278
- }
279
- async function updateStatusCommand(opts) {
280
- const timeoutMs = parseTimeoutMsOrExit(opts.timeout);
281
- if (timeoutMs === null) return;
282
- const root = await resolveUpdateRoot();
283
- const configChannel = normalizeUpdateChannel((await readSourceConfigBestEffort()).update?.channel);
284
- const update = await checkUpdateStatus({
285
- root,
286
- timeoutMs: timeoutMs ?? 3500,
287
- fetchGit: true,
288
- includeRegistry: true,
289
- registryChannel: resolveRegistryUpdateChannel({
290
- configChannel,
291
- currentVersion: VERSION
292
- })
293
- });
294
- const channelInfo = resolveUpdateChannelDisplay({
295
- configChannel,
296
- currentVersion: VERSION,
297
- installKind: update.installKind,
298
- gitTag: update.git?.tag ?? null,
299
- gitBranch: update.git?.branch ?? null
300
- });
301
- const channelLabel = channelInfo.label;
302
- const gitLabel = update.installKind === "git" ? formatGitStatusLine({
303
- branch: update.git?.branch ?? null,
304
- tag: update.git?.tag ?? null,
305
- sha: update.git?.sha ?? null
306
- }) : null;
307
- const updateAvailability = resolveUpdateAvailability(update);
308
- const updateLine = formatUpdateOneLiner(update).replace(/^Update:\s*/i, "");
309
- if (opts.json) {
310
- defaultRuntime.writeJson({
311
- update,
312
- channel: {
313
- value: channelInfo.channel,
314
- source: channelInfo.source,
315
- label: channelLabel,
316
- config: configChannel
317
- },
318
- availability: updateAvailability
319
- });
320
- return;
321
- }
322
- const tableWidth = getTerminalTableWidth();
323
- const rows = [
324
- {
325
- Item: "Install",
326
- Value: update.installKind === "git" ? `git (${update.root ?? "unknown"})` : update.installKind === "package" ? update.packageManager : "unknown"
327
- },
328
- {
329
- Item: "Channel",
330
- Value: channelLabel
331
- },
332
- ...gitLabel ? [{
333
- Item: "Git",
334
- Value: gitLabel
335
- }] : [],
336
- {
337
- Item: "Update",
338
- Value: updateAvailability.available ? theme.warn(`available · ${updateLine}`) : updateLine
339
- }
340
- ];
341
- defaultRuntime.log(theme.heading("DaoCore update status"));
342
- defaultRuntime.log("");
343
- defaultRuntime.log(renderTable({
344
- width: tableWidth,
345
- columns: [{
346
- key: "Item",
347
- header: "Item",
348
- minWidth: 10
349
- }, {
350
- key: "Value",
351
- header: "Value",
352
- flex: true,
353
- minWidth: 24
354
- }],
355
- rows
356
- }).trimEnd());
357
- defaultRuntime.log("");
358
- const updateHint = formatUpdateAvailableHint(update);
359
- if (updateHint) defaultRuntime.log(theme.warn(updateHint));
360
- }
361
- //#endregion
362
- //#region src/infra/disk-space.ts
363
- const LOW_DISK_SPACE_WARNING_THRESHOLD_BYTES = 1024 * 1024 * 1024;
364
- function finiteNonNegativeNumber(value) {
365
- const numberValue = Number(value);
366
- return Number.isFinite(numberValue) && numberValue >= 0 ? numberValue : null;
367
- }
368
- function findExistingDiskSpacePath(targetPath) {
369
- let current = path.resolve(targetPath);
370
- while (true) try {
371
- return fs.statSync(current).isDirectory() ? current : path.dirname(current);
372
- } catch {
373
- const parent = path.dirname(current);
374
- if (parent === current) return null;
375
- current = parent;
376
- }
377
- }
378
- function tryReadDiskSpace(targetPath) {
379
- if (typeof fs.statfsSync !== "function") return null;
380
- const checkedPath = findExistingDiskSpacePath(targetPath);
381
- if (!checkedPath) return null;
382
- try {
383
- const stats = fs.statfsSync(checkedPath);
384
- const blockSize = finiteNonNegativeNumber(stats.bsize);
385
- const availableBlocks = finiteNonNegativeNumber(stats.bavail);
386
- if (blockSize === null || availableBlocks === null) return null;
387
- const totalBlocks = finiteNonNegativeNumber(stats.blocks);
388
- return {
389
- targetPath,
390
- checkedPath,
391
- availableBytes: blockSize * availableBlocks,
392
- totalBytes: totalBlocks === null ? null : blockSize * totalBlocks
393
- };
394
- } catch {
395
- return null;
396
- }
397
- }
398
- function formatDiskSpaceBytes(bytes) {
399
- const mib = bytes / (1024 * 1024);
400
- if (mib < 1024) return `${Math.max(0, Math.round(mib))} MiB`;
401
- const gib = mib / 1024;
402
- return `${gib.toFixed(gib < 10 ? 1 : 0)} GiB`;
403
- }
404
- function createLowDiskSpaceWarning(params) {
405
- const thresholdBytes = params.thresholdBytes ?? LOW_DISK_SPACE_WARNING_THRESHOLD_BYTES;
406
- const snapshot = tryReadDiskSpace(params.targetPath);
407
- if (!snapshot || snapshot.availableBytes >= thresholdBytes) return null;
408
- return `Low disk space near ${path.resolve(snapshot.targetPath) === path.resolve(snapshot.checkedPath) ? snapshot.checkedPath : `${snapshot.targetPath} (volume checked at ${snapshot.checkedPath})`}: ${formatDiskSpaceBytes(snapshot.availableBytes)} available; ${params.purpose} may fail.`;
409
- }
410
- //#endregion
411
- //#region src/cli/plugins-location-bridges.ts
412
- function buildBridgeFromPersistedBundledRecord(record, manifest) {
413
- if (record.origin !== "bundled" || !record.enabled) return null;
414
- const officialEntry = getOfficialExternalPluginCatalogEntry(record.pluginId);
415
- const officialInstall = officialEntry ? resolveOfficialExternalPluginInstall(officialEntry) : null;
416
- const npmSpec = officialInstall?.npmSpec?.trim() ?? record.packageInstall?.npm?.spec;
417
- const clawhubSpec = officialInstall?.clawhubSpec?.trim();
418
- if (!npmSpec && !clawhubSpec) return null;
419
- const officialChannelId = officialEntry ? getOfficialExternalPluginCatalogManifest(officialEntry)?.channel?.id?.trim() : void 0;
420
- const channelIds = manifest?.channels.length ? manifest.channels : officialChannelId ? [officialChannelId] : [];
421
- return {
422
- bundledPluginId: record.pluginId,
423
- pluginId: record.pluginId,
424
- preferredSource: officialInstall?.defaultChoice === "clawhub" && clawhubSpec ? "clawhub" : "npm",
425
- ...npmSpec ? { npmSpec } : {},
426
- ...clawhubSpec ? { clawhubSpec } : {},
427
- ...record.enabledByDefault ? { enabledByDefault: true } : {},
428
- ...channelIds.length ? { channelIds } : {}
429
- };
430
- }
431
- async function listPersistedBundledPluginLocationBridges(options) {
432
- const index = await readPersistedInstalledPluginIndex(options);
433
- if (!index) return [];
434
- const manifestRegistry = loadPluginManifestRegistryForInstalledIndex({
435
- index,
436
- workspaceDir: options.workspaceDir,
437
- env: options.env,
438
- includeDisabled: true
439
- });
440
- const manifestByPluginId = new Map(manifestRegistry.plugins.map((plugin) => [plugin.id, plugin]));
441
- return index.plugins.flatMap((record) => {
442
- const bridge = buildBridgeFromPersistedBundledRecord(record, manifestByPluginId.get(record.pluginId));
443
- return bridge ? [bridge] : [];
444
- });
445
- }
446
- //#endregion
447
- //#region src/cli/update-cli/plugin-payload-validation.ts
448
- const TRACKED_SOURCES = new Set([
449
- "npm",
450
- "clawhub",
451
- "git",
452
- "marketplace"
453
- ]);
454
- /**
455
- * Verify that each tracked plugin install record on disk is structurally
456
- * loadable: the install dir exists, contains a parseable `package.json`,
457
- * and any declared package entry files exist.
458
- *
459
- * IMPORTANT: this is intentionally a *static* check. We do NOT execute the
460
- * plugin's code, so post-update side effects (network calls, filesystem
461
- * writes, registry registration) cannot fire while the gateway is still
462
- * stopped. The goal is to catch obvious payload corruption — missing files,
463
- * unparseable manifests — before we hand control back to the restart path.
464
- */
465
- async function runPluginPayloadSmokeCheck(params) {
466
- const checked = [];
467
- const failures = [];
468
- for (const [pluginId, record] of Object.entries(params.records).toSorted(([a], [b]) => a.localeCompare(b))) {
469
- if (!record || typeof record !== "object" || !TRACKED_SOURCES.has(record.source)) continue;
470
- const rawInstallPath = typeof record.installPath === "string" ? record.installPath.trim() : "";
471
- if (!rawInstallPath) {
472
- checked.push(pluginId);
473
- failures.push({
474
- pluginId,
475
- reason: "missing-install-path",
476
- detail: "Install path is missing from the plugin install record."
477
- });
478
- continue;
479
- }
480
- const installPath = resolveUserPath(rawInstallPath, params.env);
481
- checked.push(pluginId);
482
- if (!(await safeStat(installPath))?.isDirectory()) {
483
- failures.push({
484
- pluginId,
485
- installPath,
486
- reason: "missing-package-dir",
487
- detail: `Install dir is missing: ${installPath}`
488
- });
489
- continue;
490
- }
491
- const packageJsonPath = path.join(installPath, "package.json");
492
- if (!(await safeStat(packageJsonPath))?.isFile()) {
493
- failures.push({
494
- pluginId,
495
- installPath,
496
- reason: "missing-package-json",
497
- detail: `package.json is missing under ${installPath}`
498
- });
499
- continue;
500
- }
501
- let manifest;
502
- try {
503
- manifest = JSON.parse(await fs$1.readFile(packageJsonPath, "utf8"));
504
- } catch (err) {
505
- failures.push({
506
- pluginId,
507
- installPath,
508
- reason: "invalid-package-json",
509
- detail: `Could not parse package.json: ${err instanceof Error ? err.message : String(err)}`
510
- });
511
- continue;
512
- }
513
- if (manifestDeclaresDaoCorePeer(manifest)) {
514
- const peerIssue = await auditDaoCorePeerDependencyLink({
515
- packageDir: installPath,
516
- packageName: manifest.name ?? pluginId
517
- });
518
- if (peerIssue) failures.push({
519
- pluginId,
520
- installPath,
521
- reason: "missing-daocore-peer-link",
522
- detail: `Plugin declares peerDependency "daocore" but peer link audit failed: ${peerIssue.reason}.`
523
- });
524
- }
525
- const extensionResolution = resolvePackageExtensionEntries(manifest);
526
- if (extensionResolution.status === "invalid" || extensionResolution.status === "empty") failures.push({
527
- pluginId,
528
- installPath,
529
- reason: "missing-extension-entry",
530
- detail: `Plugin extension entry validation failed: ${extensionResolution.status === "invalid" ? extensionResolution.error : "package.json daocore.extensions is empty"}`
531
- });
532
- else if (extensionResolution.status === "ok") {
533
- const extensionValidation = await validatePackageExtensionEntriesForInstall({
534
- packageDir: installPath,
535
- extensions: extensionResolution.entries,
536
- manifest
537
- });
538
- if (!extensionValidation.ok) failures.push({
539
- pluginId,
540
- installPath,
541
- reason: "missing-extension-entry",
542
- detail: `Plugin extension entry validation failed: ${extensionValidation.error}`
543
- });
544
- }
545
- if (typeof manifest.main !== "string" || !manifest.main.trim()) continue;
546
- const mainRel = manifest.main.trim();
547
- const mainPath = path.join(installPath, mainRel);
548
- if (!(await safeStat(mainPath))?.isFile()) failures.push({
549
- pluginId,
550
- installPath,
551
- reason: "missing-main-entry",
552
- detail: `Plugin main entry "${mainRel}" not found at ${mainPath}`
553
- });
554
- }
555
- return {
556
- checked,
557
- failures
558
- };
559
- }
560
- function manifestDeclaresDaoCorePeer(manifest) {
561
- const peerDependencies = manifest.peerDependencies;
562
- return typeof peerDependencies === "object" && peerDependencies !== null && !Array.isArray(peerDependencies) && typeof peerDependencies.daocore === "string";
563
- }
564
- async function safeStat(target) {
565
- try {
566
- return await fs$1.stat(target);
567
- } catch {
568
- return null;
569
- }
570
- }
571
- //#endregion
572
- //#region src/cli/update-cli/post-core-plugin-convergence.ts
573
- const REPAIR_GUIDANCE = "Run `daocore doctor --fix` to retry plugin repair.";
574
- const inspectGuidance = (pluginId) => `Run \`daocore plugins inspect ${pluginId} --runtime --json\` for details.`;
575
- async function repairManagedNpmDaoCorePeerLinks(params) {
576
- try {
577
- const result = await relinkDaoCorePeerDependenciesInManagedNpmRoot({
578
- npmRoot: resolveDefaultPluginNpmDir(params.env),
579
- logger: {}
580
- });
581
- return {
582
- changes: result.repaired > 0 ? [`Repaired DaoCore host peer link(s) for ${result.repaired} managed npm plugin package(s).`] : [],
583
- warnings: []
584
- };
585
- } catch (err) {
586
- const message = `Failed to repair managed npm DaoCore host peer links: ${err instanceof Error ? err.message : String(err)}`;
587
- return {
588
- changes: [],
589
- warnings: [{
590
- reason: message,
591
- message,
592
- guidance: [REPAIR_GUIDANCE]
593
- }]
594
- };
595
- }
596
- }
597
- /**
598
- * Mandatory post-core convergence pass. Runs AFTER the core package files
599
- * are swapped and the in-update doctor pass has already returned, but BEFORE
600
- * the gateway is restarted. Failures here must block the restart so we
601
- * never restart with a configured plugin whose payload is unloadable.
602
- */
603
- async function runPostCorePluginConvergence(params) {
604
- const env = {
605
- ...params.env,
606
- DAOCORE_COMPATIBILITY_HOST_VERSION: VERSION,
607
- [UPDATE_POST_CORE_CONVERGENCE_ENV]: "1"
608
- };
609
- const prunedBaseline = params.baselineInstallRecords ? pruneStaleLocalBundledPluginInstallRecords({
610
- installRecords: params.baselineInstallRecords,
611
- env
612
- }) : null;
613
- const repair = await repairMissingConfiguredPluginInstalls({
614
- cfg: params.cfg,
615
- env,
616
- ...prunedBaseline ? { baselineRecords: prunedBaseline.records } : {}
617
- });
618
- const warnings = repair.warnings.map((message) => ({
619
- reason: message,
620
- message,
621
- guidance: [REPAIR_GUIDANCE]
622
- }));
623
- const peerLinkRepair = await repairManagedNpmDaoCorePeerLinks({ env });
624
- warnings.push(...peerLinkRepair.warnings);
625
- const records = repair.records;
626
- const smoke = await runPluginPayloadSmokeCheck({
627
- records: filterRecordsToActive({
628
- cfg: params.cfg,
629
- records
630
- }),
631
- env
632
- });
633
- for (const failure of smoke.failures) warnings.push({
634
- pluginId: failure.pluginId,
635
- reason: `${failure.reason}: ${failure.detail}`,
636
- message: `Plugin "${failure.pluginId}" failed post-core payload smoke check (${failure.reason}): ${failure.detail}`,
637
- guidance: [REPAIR_GUIDANCE, inspectGuidance(failure.pluginId)]
638
- });
639
- return {
640
- changes: [
641
- ...prunedBaseline?.stale.map((record) => `Removed stale local bundled plugin install record "${record.pluginId}".`) ?? [],
642
- ...repair.changes,
643
- ...peerLinkRepair.changes
644
- ],
645
- warnings,
646
- errored: warnings.length > 0,
647
- smokeFailures: smoke.failures,
648
- installRecords: records
649
- };
650
- }
651
- /**
652
- * Drop install records that the gateway would never activate: disabled
653
- * plugin entries, plugins listed in `plugins.deny`, etc. Records that
654
- * resolve as a trusted-source-linked official install (npm or ClawHub)
655
- * are retained even when the entry is disabled, mirroring the existing
656
- * `collectMissingPluginInstallPayloads({ skipDisabledPlugins: true,
657
- * syncOfficialPluginInstalls: true })` policy at
658
- * `update-command.ts:~218`. We do NOT collapse to the configured plugin
659
- * id set here — that would over-filter and miss e.g. providers/runtimes
660
- * that are enabled implicitly via auth profiles or model refs. Effective
661
- * enable state is the right precision boundary.
662
- */
663
- function filterRecordsToActive(params) {
664
- const normalizedPluginConfig = normalizePluginsConfig(params.cfg.plugins);
665
- const filtered = {};
666
- for (const [pluginId, record] of Object.entries(params.records)) {
667
- if (!record || typeof record !== "object") continue;
668
- if (resolveEffectiveEnableState({
669
- id: pluginId,
670
- origin: "global",
671
- config: normalizedPluginConfig,
672
- rootConfig: params.cfg
673
- }).enabled) {
674
- filtered[pluginId] = record;
675
- continue;
676
- }
677
- const officialNpm = resolveTrustedSourceLinkedOfficialNpmSpec({
678
- pluginId,
679
- record
680
- });
681
- const officialClawHub = resolveTrustedSourceLinkedOfficialClawHubSpec({
682
- pluginId,
683
- record
684
- });
685
- if (officialNpm || officialClawHub) filtered[pluginId] = record;
686
- }
687
- return filtered;
688
- }
689
- /**
690
- * Pure helper used by `updatePluginsAfterCoreUpdate` to fold a convergence
691
- * result into the existing `PluginUpdateOutcome[]` / warning shape that the
692
- * post-core update result carries.
693
- *
694
- * Returns:
695
- * - `outcomes` to append to `pluginUpdateOutcomes`. Only convergence
696
- * warnings that name a `pluginId` produce per-plugin error outcomes; the
697
- * rest are surfaced via `warnings`.
698
- * - `errored` boolean that callers translate into `status: "error"`.
699
- */
700
- function convergenceWarningsToOutcomes(convergence) {
701
- const outcomes = convergence.warnings.filter((w) => Boolean(w.pluginId)).map((w) => ({
702
- pluginId: w.pluginId,
703
- status: "error",
704
- message: w.message
705
- }));
706
- return {
707
- warnings: convergence.warnings,
708
- outcomes,
709
- errored: convergence.errored
710
- };
711
- }
712
- //#endregion
713
- //#region src/cli/update-cli/progress.ts
714
- const STEP_LABELS = {
715
- "clean check": "Working directory is clean",
716
- "upstream check": "Upstream branch exists",
717
- "git fetch": "Fetching latest changes",
718
- "git rebase": "Rebasing onto target commit",
719
- "git rev-parse @{upstream}": "Resolving upstream commit",
720
- "git rev-list": "Enumerating candidate commits",
721
- "git clone": "Cloning git checkout",
722
- "preflight worktree": "Preparing preflight worktree",
723
- "preflight cleanup": "Cleaning preflight worktree",
724
- "deps install": "Installing dependencies",
725
- build: "Building",
726
- "ui:build": "Building UI assets",
727
- "ui:build (post-doctor repair)": "Restoring missing UI assets",
728
- "ui assets verify": "Validating UI assets",
729
- "daocore doctor entry": "Checking doctor entrypoint",
730
- "daocore doctor": "Running doctor checks",
731
- "git rev-parse HEAD (after)": "Verifying update",
732
- "global update": "Updating via package manager",
733
- "global update (omit optional)": "Retrying update without optional deps",
734
- "global install stage": "Preparing staged package install",
735
- "global install verify": "Verifying global package",
736
- "global install swap": "Activating global package",
737
- "global install": "Installing global package"
738
- };
739
- function getStepLabel(step) {
740
- return STEP_LABELS[step.name] ?? step.name;
741
- }
742
- function inferUpdateFailureHints(result) {
743
- if (result.status !== "error") return [];
744
- if (result.reason === "pnpm-corepack-missing") return ["This pnpm checkout could not auto-enable pnpm because corepack is missing.", "Install pnpm manually or install Node with corepack available, then rerun the update command."];
745
- if (result.reason === "pnpm-corepack-enable-failed") return ["This pnpm checkout could not auto-enable pnpm via corepack.", "Run `corepack enable` manually or install pnpm manually, then rerun the update command."];
746
- if (result.reason === "pnpm-npm-bootstrap-failed") return ["This pnpm checkout could not bootstrap pnpm from npm automatically.", "Install pnpm manually, then rerun the update command."];
747
- if (result.reason === "preferred-manager-unavailable") return ["This checkout requires its declared package manager and the updater could not find it.", "Install the missing package manager manually, then rerun the update command."];
748
- if (result.mode !== "npm") return [];
749
- const failedStep = [...result.steps].toReversed().find((step) => step.exitCode !== 0);
750
- if (!failedStep) return [];
751
- const stderr = normalizeLowercaseStringOrEmpty(failedStep.stderrTail);
752
- const hints = [];
753
- if ((failedStep.name.startsWith("global update") || failedStep.name.startsWith("global install")) && stderr.includes("eacces")) {
754
- hints.push("Detected permission failure (EACCES). Re-run with a writable global prefix or sudo (for system-managed Node installs).");
755
- hints.push("If you recover with sudo/manual package install on a managed Gateway, stop the Gateway first so it does not load files while the package tree is being replaced.");
756
- hints.push("Example: npm config set prefix ~/.local && npm i -g daocore@latest");
757
- hints.push("System install outline: daocore gateway stop -> sudo <system-npm> i -g daocore@latest -> daocore gateway install --force -> daocore gateway restart.");
758
- }
759
- if (failedStep.name.startsWith("global update") && (stderr.includes("node-gyp") || stderr.includes("prebuild"))) {
760
- hints.push("Detected native optional dependency build failure. The updater retries with --omit=optional automatically.");
761
- hints.push("If it still fails: npm i -g daocore@latest --omit=optional");
762
- }
763
- return hints;
764
- }
765
- function createUpdateProgress(enabled) {
766
- if (!enabled) return {
767
- progress: {},
768
- stop: () => {}
769
- };
770
- let currentSpinner = null;
771
- return {
772
- progress: {
773
- onStepStart: (step) => {
774
- currentSpinner = spinner();
775
- currentSpinner.start(theme.accent(getStepLabel(step)));
776
- },
777
- onStepComplete: (step) => {
778
- if (!currentSpinner) return;
779
- const label = getStepLabel(step);
780
- const duration = theme.muted(`(${formatDurationPrecise(step.durationMs)})`);
781
- const icon = step.exitCode === 0 ? theme.success("✓") : theme.error("✗");
782
- currentSpinner.stop(`${icon} ${label} ${duration}`);
783
- currentSpinner = null;
784
- if (step.exitCode !== 0 && step.stderrTail) {
785
- const lines = step.stderrTail.split("\n").slice(-10);
786
- for (const line of lines) if (line.trim()) defaultRuntime.log(` ${theme.error(line)}`);
787
- }
788
- }
789
- },
790
- stop: () => {
791
- if (currentSpinner) {
792
- currentSpinner.stop();
793
- currentSpinner = null;
794
- }
795
- }
796
- };
797
- }
798
- function formatStepStatus(exitCode) {
799
- if (exitCode === 0) return theme.success("✓");
800
- if (exitCode === null) return theme.warn("?");
801
- return theme.error("✗");
802
- }
803
- function printResult(result, opts) {
804
- if (opts.json) {
805
- defaultRuntime.writeJson(result);
806
- return;
807
- }
808
- const statusColor = result.status === "ok" ? theme.success : result.status === "skipped" ? theme.warn : theme.error;
809
- defaultRuntime.log("");
810
- defaultRuntime.log(`${theme.heading("Update Result:")} ${statusColor(result.status.toUpperCase())}`);
811
- if (result.root) defaultRuntime.log(` Root: ${theme.muted(result.root)}`);
812
- if (result.reason) defaultRuntime.log(` Reason: ${theme.muted(result.reason)}`);
813
- if (result.before?.version || result.before?.sha) {
814
- const before = result.before.version ?? result.before.sha?.slice(0, 8) ?? "";
815
- defaultRuntime.log(` Before: ${theme.muted(before)}`);
816
- }
817
- if (result.after?.version || result.after?.sha) {
818
- const after = result.after.version ?? result.after.sha?.slice(0, 8) ?? "";
819
- defaultRuntime.log(` After: ${theme.muted(after)}`);
820
- }
821
- if (!opts.hideSteps && result.steps.length > 0) {
822
- defaultRuntime.log("");
823
- defaultRuntime.log(theme.heading("Steps:"));
824
- for (const step of result.steps) {
825
- const status = formatStepStatus(step.exitCode);
826
- const duration = theme.muted(`(${formatDurationPrecise(step.durationMs)})`);
827
- defaultRuntime.log(` ${status} ${step.name} ${duration}`);
828
- if (step.exitCode !== 0 && step.stderrTail) {
829
- const lines = step.stderrTail.split("\n").slice(0, 5);
830
- for (const line of lines) if (line.trim()) defaultRuntime.log(` ${theme.error(line)}`);
831
- }
832
- }
833
- }
834
- const hints = inferUpdateFailureHints(result);
835
- if (hints.length > 0) {
836
- defaultRuntime.log("");
837
- defaultRuntime.log(theme.heading("Recovery hints:"));
838
- for (const hint of hints) defaultRuntime.log(` - ${theme.warn(hint)}`);
839
- }
840
- defaultRuntime.log("");
841
- defaultRuntime.log(`Total time: ${theme.muted(formatDurationPrecise(result.durationMs))}`);
842
- }
843
- //#endregion
844
- //#region src/cli/update-cli/restart-helper.ts
845
- /**
846
- * Shell-escape a string for embedding in single-quoted shell arguments.
847
- * Replaces every `'` with `'\''` (end quote, escaped quote, resume quote).
848
- * For batch scripts, validates against special characters instead.
849
- */
850
- function shellEscape(value) {
851
- return value.replace(/'/g, "'\\''");
852
- }
853
- /** Validates a task name is safe for embedding in Windows restart scripts. */
854
- function isWindowsTaskNameSafe(value) {
855
- return /^[A-Za-z0-9 _\-().]+$/.test(value);
856
- }
857
- function powerShellSingleQuote(value) {
858
- return `'${value.replace(/'/g, "''")}'`;
859
- }
860
- function resolveSystemdUnit(env) {
861
- const override = normalizeOptionalString(env.DAOCORE_SYSTEMD_UNIT);
862
- if (override) return override.endsWith(".service") ? override : `${override}.service`;
863
- return `${resolveGatewaySystemdServiceName(env.DAOCORE_PROFILE)}.service`;
864
- }
865
- function resolveLaunchdLabel(env) {
866
- const override = normalizeOptionalString(env.DAOCORE_LAUNCHD_LABEL);
867
- if (override) return override;
868
- return resolveGatewayLaunchAgentLabel(env.DAOCORE_PROFILE);
869
- }
870
- function resolveWindowsTaskName(env) {
871
- const override = env.DAOCORE_WINDOWS_TASK_NAME?.trim();
872
- if (override) return override;
873
- return resolveGatewayWindowsTaskName(env.DAOCORE_PROFILE);
874
- }
875
- /**
876
- * Prepares a standalone script to restart the gateway service.
877
- * This script is written to a temporary directory and does not depend on
878
- * the installed package files, ensuring restart capability even if the
879
- * update process temporarily removes or corrupts installation files.
880
- */
881
- async function prepareRestartScript(env = process.env, gatewayPort = DEFAULT_GATEWAY_PORT) {
882
- const timestamp = Date.now();
883
- const platform = process.platform;
884
- let scriptContent = "";
885
- let filename = "";
886
- try {
887
- if (platform === "linux") {
888
- const escaped = shellEscape(resolveSystemdUnit(env));
889
- const logSetup = renderPosixRestartLogSetup({
890
- ...process.env,
891
- ...env
892
- });
893
- filename = `daocore-restart-${timestamp}.sh`;
894
- scriptContent = `#!/bin/sh
895
- # Standalone restart script — survives parent process termination.
896
- # Wait briefly to ensure file locks are released after update.
897
- sleep 1
898
- exec 3>&2
899
- ${logSetup}
900
- printf '[%s] daocore restart attempt source=update target=%s\\n' "$(date -u +%FT%TZ)" '${escaped}' >&2
901
- if systemctl --user is-active --quiet '${escaped}' || systemctl --user is-enabled --quiet '${escaped}'; then
902
- if systemctl --user restart '${escaped}'; then
903
- status=0
904
- printf '[%s] daocore restart done source=update\\n' "$(date -u +%FT%TZ)" >&2
905
- else
906
- status=$?
907
- printf '[%s] daocore restart failed source=update status=%s\\n' "$(date -u +%FT%TZ)" "$status" >&2
908
- fi
909
- elif systemctl is-active --quiet '${escaped}' || systemctl is-enabled --quiet '${escaped}'; then
910
- status=78
911
- printf '[%s] system-scoped daocore gateway unit detected; update cannot restart it without sudo. Run: sudo systemctl restart %s\\n' "$(date -u +%FT%TZ)" '${escaped}' >&2
912
- printf '[%s] system-scoped daocore gateway unit detected; update cannot restart it without sudo. Run: sudo systemctl restart %s\\n' "$(date -u +%FT%TZ)" '${escaped}' >&3 2>/dev/null || true
913
- else
914
- if systemctl --user restart '${escaped}'; then
915
- status=0
916
- printf '[%s] daocore restart done source=update\\n' "$(date -u +%FT%TZ)" >&2
917
- else
918
- status=$?
919
- printf '[%s] daocore restart failed source=update status=%s\\n' "$(date -u +%FT%TZ)" "$status" >&2
920
- fi
921
- fi
922
- # Self-cleanup
923
- script_dir=$(dirname "$0")
924
- exec 3>&-
925
- rm -f "$0"
926
- rmdir "$script_dir" 2>/dev/null || true
927
- exit "$status"
928
- `;
929
- } else if (platform === "darwin") {
930
- const label = resolveLaunchdLabel(env);
931
- const escaped = shellEscape(label);
932
- const uid = process.getuid ? process.getuid() : 501;
933
- const home = normalizeOptionalString(env.HOME) || process.env.HOME || os.homedir();
934
- const escapedPlistPath = shellEscape(path.join(home, "Library", "LaunchAgents", `${label}.plist`));
935
- const logSetup = renderPosixRestartLogSetup({
936
- ...process.env,
937
- ...env
938
- });
939
- filename = `daocore-restart-${timestamp}.sh`;
940
- scriptContent = `#!/bin/sh
941
- # Standalone restart script — survives parent process termination.
942
- # Wait briefly to ensure file locks are released after update.
943
- sleep 1
944
- # Capture launchctl output so bootstrap/kickstart failures leave a durable
945
- # audit trail. Log setup is best-effort: restart must still run if the log path
946
- # is temporarily unavailable.
947
- ${logSetup}
948
- printf '[%s] daocore restart attempt source=update target=%s\\n' "$(date -u +%FT%TZ)" '${shellEscapeRestartLogValue(label)}' >&2
949
- # Try kickstart first (works when the service is still registered).
950
- # If it fails (e.g. after bootout), clear any persisted disabled state,
951
- # then re-register via bootstrap. Bootstrap loads RunAtLoad agents, so the
952
- # fallback must not immediately kickstart -k the freshly spawned gateway.
953
- # The final status is captured
954
- # before self-cleanup so a genuine failure remains observable.
955
- status=0
956
- if ! launchctl kickstart -k 'gui/${uid}/${escaped}'; then
957
- launchctl enable 'gui/${uid}/${escaped}'
958
- if launchctl bootstrap 'gui/${uid}' '${escapedPlistPath}'; then
959
- status=0
960
- else
961
- launchctl kickstart -k 'gui/${uid}/${escaped}'
962
- status=$?
963
- fi
964
- fi
965
- if [ "$status" -eq 0 ]; then
966
- printf '[%s] daocore restart done source=update\\n' "$(date -u +%FT%TZ)" >&2
967
- else
968
- printf '[%s] daocore restart failed source=update status=%s\\n' "$(date -u +%FT%TZ)" "$status" >&2
969
- fi
970
- # Self-cleanup (log is retained under the DaoCore state logs directory).
971
- script_dir=$(dirname "$0")
972
- rm -f "$0"
973
- rmdir "$script_dir" 2>/dev/null || true
974
- exit "$status"
975
- `;
976
- } else if (platform === "win32") {
977
- const taskName = resolveWindowsTaskName(env);
978
- if (!isWindowsTaskNameSafe(taskName)) return null;
979
- const port = Number.isFinite(gatewayPort) && gatewayPort > 0 ? gatewayPort : DEFAULT_GATEWAY_PORT;
980
- const quotedLogPath = powerShellSingleQuote(resolveGatewayRestartLogPath({
981
- ...process.env,
982
- ...env
983
- }));
984
- const quotedTaskName = powerShellSingleQuote(taskName);
985
- filename = `daocore-restart-${timestamp}.cmd`;
986
- scriptContent = `@echo off
987
- REM Standalone restart script - survives parent process termination.
988
- REM Keep this as a cmd wrapper so Group Policy script execution policies
989
- REM cannot block the update restart handoff before schtasks.exe runs.
990
- setlocal
991
- set "DAOCORE_RESTART_SCRIPT=%~f0"
992
- set "DAOCORE_RESTART_SCRIPT_DIR=%~dp0."
993
- powershell -NoProfile -ExecutionPolicy Bypass -Command "$p=$env:DAOCORE_RESTART_SCRIPT; $s=Get-Content -Raw -LiteralPath $p; $m='# POWERSHELL'; $i=$s.IndexOf($m); if ($i -lt 0) { exit 1 }; Invoke-Expression $s.Substring($i)"
994
- set "status=%ERRORLEVEL%"
995
- del "%~f0" >nul 2>&1
996
- rmdir "%DAOCORE_RESTART_SCRIPT_DIR%" >nul 2>&1
997
- exit /b %status%
998
- # POWERSHELL
999
- # Wait briefly to ensure file locks are released after update.
1000
- $ErrorActionPreference = "Continue"
1001
- Start-Sleep -Seconds 2
1002
-
1003
- $logPath = ${quotedLogPath}
1004
- try {
1005
- $logDir = Split-Path -Parent $logPath
1006
- New-Item -ItemType Directory -Path $logDir -Force | Out-Null
1007
- Add-Content -LiteralPath $logPath -Value "[$(Get-Date -Format o)] daocore restart log initialized"
1008
- } catch {
1009
- # Restart should still run if log setup is unavailable.
1010
- }
1011
-
1012
- function Write-RestartLog {
1013
- param([string]$Message)
1014
- try {
1015
- Add-Content -LiteralPath $logPath -Value "[$(Get-Date -Format o)] $Message"
1016
- } catch {
1017
- }
1018
- }
1019
-
1020
- function Join-DaoCoreProcessArguments {
1021
- param([string[]]$Arguments)
1022
- ($Arguments | ForEach-Object {
1023
- if ($_ -match "\\s") {
1024
- '"' + $_ + '"'
1025
- } else {
1026
- $_
1027
- }
1028
- }) -join " "
1029
- }
1030
-
1031
- function Invoke-DaoCoreSchtasksWithTimeout {
1032
- param(
1033
- [string[]]$Arguments,
1034
- [int]$TimeoutSeconds
1035
- )
1036
- $process = $null
1037
- try {
1038
- $startInfo = [System.Diagnostics.ProcessStartInfo]::new()
1039
- $startInfo.FileName = "schtasks.exe"
1040
- $startInfo.Arguments = Join-DaoCoreProcessArguments -Arguments $Arguments
1041
- $startInfo.UseShellExecute = $false
1042
- $startInfo.RedirectStandardOutput = $true
1043
- $startInfo.RedirectStandardError = $true
1044
- $process = [System.Diagnostics.Process]::Start($startInfo)
1045
- if (-not $process.WaitForExit($TimeoutSeconds * 1000)) {
1046
- try {
1047
- $process.Kill()
1048
- } catch {
1049
- }
1050
- Write-RestartLog "daocore restart schtasks timeout source=update args=$($Arguments -join ' ')"
1051
- return 124
1052
- }
1053
- $stdout = $process.StandardOutput.ReadToEnd()
1054
- $stderr = $process.StandardError.ReadToEnd()
1055
- if ($stdout) {
1056
- Write-RestartLog $stdout.Trim()
1057
- }
1058
- if ($stderr) {
1059
- Write-RestartLog $stderr.Trim()
1060
- }
1061
- return $process.ExitCode
1062
- } catch {
1063
- Write-RestartLog "daocore restart schtasks failed source=update args=$($Arguments -join ' ') error=$($_.Exception.Message)"
1064
- return 1
1065
- }
1066
- }
1067
-
1068
- function Get-DaoCoreScheduledTaskState {
1069
- param([string]$TaskName)
1070
- try {
1071
- $task = Get-ScheduledTask -TaskName $TaskName -ErrorAction Stop
1072
- if ($task -and $task.State) {
1073
- return [string]$task.State
1074
- }
1075
- } catch {
1076
- }
1077
-
1078
- try {
1079
- $queryOutput = & schtasks.exe /Query /TN $TaskName /FO LIST 2>$null
1080
- foreach ($line in $queryOutput) {
1081
- if ($line -match "^\\s*Status:\\s*(.+?)\\s*$") {
1082
- return $Matches[1]
1083
- }
1084
- }
1085
- } catch {
1086
- }
1087
-
1088
- return "Unknown"
1089
- }
1090
-
1091
- function Get-DaoCoreListenerPids {
1092
- param([int]$Port)
1093
- $listenerPids = @()
1094
-
1095
- try {
1096
- if (Get-Command Get-NetTCPConnection -ErrorAction SilentlyContinue) {
1097
- $listenerPids += Get-NetTCPConnection -LocalPort $Port -State Listen -ErrorAction SilentlyContinue |
1098
- ForEach-Object { [int]$_.OwningProcess }
1099
- }
1100
- } catch {
1101
- }
1102
-
1103
- if ($listenerPids.Count -eq 0) {
1104
- try {
1105
- $portPattern = [regex]::Escape(":$Port")
1106
- $linePattern = "^\\s*TCP\\s+\\S+$portPattern\\s+\\S+\\s+LISTENING\\s+(\\d+)\\s*$"
1107
- & netstat.exe -ano -p tcp 2>$null | ForEach-Object {
1108
- if ($_ -match $linePattern) {
1109
- $listenerPids += [int]$Matches[1]
1110
- }
1111
- }
1112
- } catch {
1113
- }
1114
- }
1115
-
1116
- $listenerPids | Sort-Object -Unique
1117
- }
1118
-
1119
- function Invoke-DaoCoreStartupLauncher {
1120
- $launcherPath = Join-Path $env:USERPROFILE ".daocore\\gateway.cmd"
1121
- if (-not (Test-Path -LiteralPath $launcherPath)) {
1122
- Write-RestartLog "daocore restart startup launcher missing source=update path=$launcherPath"
1123
- return 1
1124
- }
1125
-
1126
- try {
1127
- Start-Process -FilePath $launcherPath -WindowStyle Hidden | Out-Null
1128
- Write-RestartLog "daocore restart launched startup fallback source=update path=$launcherPath"
1129
- return 0
1130
- } catch {
1131
- Write-RestartLog "daocore restart startup fallback failed source=update error=$($_.Exception.Message)"
1132
- return 1
1133
- }
1134
- }
1135
-
1136
- $taskName = ${quotedTaskName}
1137
- $port = ${port}
1138
- Write-RestartLog "daocore restart attempt source=update target=$taskName"
1139
-
1140
- $taskState = Get-DaoCoreScheduledTaskState -TaskName $taskName
1141
- if ($taskState -eq "Running") {
1142
- $endStatus = Invoke-DaoCoreSchtasksWithTimeout -Arguments @("/End", "/TN", $taskName) -TimeoutSeconds 10
1143
- if ($endStatus -ne 0) {
1144
- Write-RestartLog "daocore restart schtasks end did not complete cleanly source=update status=$endStatus"
1145
- }
1146
- } else {
1147
- Write-RestartLog "daocore restart skipped schtasks end source=update state=$taskState"
1148
- }
1149
-
1150
- for ($attempt = 1; $attempt -le 10; $attempt++) {
1151
- $listeners = @(Get-DaoCoreListenerPids -Port $port)
1152
- if ($listeners.Count -eq 0) {
1153
- break
1154
- }
1155
-
1156
- if ($attempt -eq 10) {
1157
- foreach ($listenerPid in $listeners) {
1158
- try {
1159
- Stop-Process -Id $listenerPid -Force -ErrorAction Stop
1160
- Write-RestartLog "daocore restart killed stale listener source=update pid=$listenerPid"
1161
- } catch {
1162
- Write-RestartLog "daocore restart failed to kill stale listener source=update pid=$listenerPid error=$($_.Exception.Message)"
1163
- }
1164
- }
1165
- break
1166
- }
1167
-
1168
- Start-Sleep -Seconds 1
1169
- }
1170
-
1171
- $status = Invoke-DaoCoreSchtasksWithTimeout -Arguments @("/Run", "/TN", $taskName) -TimeoutSeconds 30
1172
- if ($status -ne 0) {
1173
- $status = Invoke-DaoCoreStartupLauncher
1174
- }
1175
- if ($status -eq 0) {
1176
- Write-RestartLog "daocore restart done source=update"
1177
- } else {
1178
- Write-RestartLog "daocore restart failed source=update status=$status"
1179
- }
1180
-
1181
- exit $status
1182
- `;
1183
- } else return null;
1184
- const scriptDir = await fs$1.mkdtemp(path.join(os.tmpdir(), "daocore-restart-"));
1185
- const scriptPath = path.join(scriptDir, filename);
1186
- try {
1187
- await fs$1.writeFile(scriptPath, scriptContent, {
1188
- mode: 493,
1189
- flag: "wx"
1190
- });
1191
- } catch (error) {
1192
- await fs$1.rm(scriptDir, {
1193
- recursive: true,
1194
- force: true
1195
- }).catch(() => {});
1196
- throw error;
1197
- }
1198
- return scriptPath;
1199
- } catch {
1200
- return null;
1201
- }
1202
- }
1203
- /**
1204
- * Executes the prepared restart script as a **detached** process.
1205
- *
1206
- * The script must outlive the CLI process because the CLI itself is part
1207
- * of the service being restarted — `systemctl restart` / `launchctl
1208
- * kickstart -k` will terminate the current process tree. Using
1209
- * `spawn({ detached: true })` + `unref()` ensures the script survives
1210
- * the parent's exit.
1211
- *
1212
- * Resolves immediately after spawning; the script runs independently.
1213
- */
1214
- async function runRestartScript(scriptPath) {
1215
- const isWindows = process.platform === "win32";
1216
- spawn(isWindows ? "cmd.exe" : "/bin/sh", isWindows ? [
1217
- "/d",
1218
- "/s",
1219
- "/c",
1220
- quoteCmdScriptArg(scriptPath)
1221
- ] : [scriptPath], {
1222
- detached: true,
1223
- stdio: "ignore",
1224
- windowsHide: true
1225
- }).unref();
1226
- }
1227
- //#endregion
1228
- //#region src/cli/update-cli/suppress-deprecations.ts
1229
- /**
1230
- * Suppress Node.js deprecation warnings.
1231
- *
1232
- * On Node.js v23+ `process.noDeprecation` may be a read-only property
1233
- * (defined via a getter on the prototype with no setter), so the
1234
- * assignment can throw. We fall back to the environment variable which
1235
- * achieves the same effect.
1236
- */
1237
- function suppressDeprecations() {
1238
- try {
1239
- process.noDeprecation = true;
1240
- } catch {}
1241
- process.env.NODE_NO_WARNINGS = "1";
1242
- }
1243
- //#endregion
1244
- //#region src/cli/update-cli/update-command.ts
1245
- const CLI_NAME = resolveCliName();
1246
- const SERVICE_REFRESH_TIMEOUT_MS = 6e4;
1247
- const POST_REFRESH_ALREADY_HEALTHY_ATTEMPTS = 10;
1248
- const POST_REFRESH_ALREADY_HEALTHY_DELAY_MS = 500;
1249
- const DEFAULT_UPDATE_STEP_TIMEOUT_MS = 30 * 6e4;
1250
- const POST_CORE_UPDATE_ENV = "DAOCORE_UPDATE_POST_CORE";
1251
- const POST_CORE_UPDATE_CHANNEL_ENV = "DAOCORE_UPDATE_POST_CORE_CHANNEL";
1252
- const POST_CORE_UPDATE_REQUESTED_CHANNEL_ENV = "DAOCORE_UPDATE_POST_CORE_REQUESTED_CHANNEL";
1253
- const POST_CORE_UPDATE_RESULT_PATH_ENV = "DAOCORE_UPDATE_POST_CORE_RESULT_PATH";
1254
- const POST_CORE_UPDATE_INSTALL_RECORDS_PATH_ENV = "DAOCORE_UPDATE_POST_CORE_INSTALL_RECORDS_PATH";
1255
- const POST_CORE_UPDATE_SOURCE_CONFIG_PATH_ENV = "DAOCORE_UPDATE_POST_CORE_SOURCE_CONFIG_PATH";
1256
- const POST_CORE_UPDATE_STARTED_AT_ENV = "DAOCORE_UPDATE_POST_CORE_STARTED_AT_MS";
1257
- const POST_CORE_UPDATE_RESULT_POLL_MS = 100;
1258
- const PRE_UPDATE_CONFIG_SNAPSHOT_MAX_AGE_MS = 360 * 60 * 1e3;
1259
- const SERVICE_REFRESH_PATH_ENV_KEYS = [
1260
- "DAOCORE_HOME",
1261
- "DAOCORE_STATE_DIR",
1262
- "DAOCORE_CONFIG_PATH"
1263
- ];
1264
- const POST_INSTALL_DOCTOR_SERVICE_ENV_KEYS = [...SERVICE_REFRESH_PATH_ENV_KEYS, "DAOCORE_PROFILE"];
1265
- const POST_UPDATE_PLUGIN_REPAIR_GUIDANCE = "Run daocore doctor --fix to attempt automatic repair.";
1266
- const JSON_MODE_SERVICE_STDOUT = new Writable({ write(_chunk, _encoding, callback) {
1267
- callback();
1268
- } });
1269
- async function createUpdateConfigSnapshot() {
1270
- await createPreUpdateConfigSnapshot({
1271
- configPath: CONFIG_PATH,
1272
- fs: {
1273
- writeFile: fs$1.writeFile,
1274
- readFile: fs$1.readFile,
1275
- existsSync
1276
- }
1277
- });
1278
- }
1279
- const UPDATE_QUIPS = [
1280
- "Leveled up! New skills unlocked. You're welcome.",
1281
- "Fresh code, same lobster. Miss me?",
1282
- "Back and better. Did you even notice I was gone?",
1283
- "Update complete. I learned some new tricks while I was out.",
1284
- "Upgraded! Now with 23% more sass.",
1285
- "I've evolved. Try to keep up.",
1286
- "New version, who dis? Oh right, still me but shinier.",
1287
- "Patched, polished, and ready to pinch. Let's go.",
1288
- "The lobster has molted. Harder shell, sharper claws.",
1289
- "Update done! Check the changelog or just trust me, it's good.",
1290
- "Reborn from the boiling waters of npm. Stronger now.",
1291
- "I went away and came back smarter. You should try it sometime.",
1292
- "Update complete. The bugs feared me, so they left.",
1293
- "New version installed. Old version sends its regards.",
1294
- "Firmware fresh. Brain wrinkles: increased.",
1295
- "I've seen things you wouldn't believe. Anyway, I'm updated.",
1296
- "Back online. The changelog is long but our friendship is longer.",
1297
- "Upgraded! Peter fixed stuff. Blame him if it breaks.",
1298
- "Molting complete. Please don't look at my soft shell phase.",
1299
- "Version bump! Same chaos energy, fewer crashes (probably)."
1300
- ];
1301
- function pickUpdateQuip() {
1302
- return UPDATE_QUIPS[Math.floor(Math.random() * UPDATE_QUIPS.length)] ?? "Update complete.";
1303
- }
1304
- function isPackageManagerUpdateMode(mode) {
1305
- return mode === "npm" || mode === "pnpm" || mode === "bun";
1306
- }
1307
- function isTrackedPackageInstallRecord(record) {
1308
- return record.source === "npm" || record.source === "clawhub" || record.source === "git" || record.source === "marketplace";
1309
- }
1310
- function isRecord(value) {
1311
- return typeof value === "object" && value !== null && !Array.isArray(value);
1312
- }
1313
- function normalizePluginInstallRecordMap(value) {
1314
- if (!isRecord(value)) return {};
1315
- const records = {};
1316
- for (const [pluginId, record] of Object.entries(value).toSorted(([left], [right]) => left.localeCompare(right))) if (isRecord(record) && typeof record.source === "string") records[pluginId] = structuredClone(record);
1317
- return records;
1318
- }
1319
- function normalizeChannelConfigMap(value) {
1320
- if (!isRecord(value)) return null;
1321
- return value;
1322
- }
1323
- function normalizeDirectAuthoredChannelConfigMap(value) {
1324
- const channels = normalizeChannelConfigMap(value);
1325
- if (!channels || Object.prototype.hasOwnProperty.call(channels, "$include")) return null;
1326
- return channels;
1327
- }
1328
- function restorePreUpdateChannelModelOverrides(params) {
1329
- if (params.restoredChannelIds.length === 0) return {
1330
- channels: params.channels,
1331
- changed: false
1332
- };
1333
- const preUpdateModelByChannel = normalizeChannelConfigMap(params.preUpdateChannels.modelByChannel);
1334
- if (!preUpdateModelByChannel) return {
1335
- channels: params.channels,
1336
- changed: false
1337
- };
1338
- const currentModelByChannel = normalizeChannelConfigMap(params.channels.modelByChannel) ?? {};
1339
- const restoredModelByChannel = structuredClone(currentModelByChannel);
1340
- let changed = false;
1341
- for (const [providerId, providerOverrides] of Object.entries(preUpdateModelByChannel)) {
1342
- const preUpdateProviderOverrides = normalizeChannelConfigMap(providerOverrides);
1343
- if (!preUpdateProviderOverrides) continue;
1344
- const currentProviderOverrides = normalizeChannelConfigMap(restoredModelByChannel[providerId]) ?? {};
1345
- let providerChanged = false;
1346
- for (const channelId of params.restoredChannelIds) {
1347
- if (currentProviderOverrides[channelId] !== void 0 || preUpdateProviderOverrides[channelId] === void 0) continue;
1348
- currentProviderOverrides[channelId] = structuredClone(preUpdateProviderOverrides[channelId]);
1349
- providerChanged = true;
1350
- }
1351
- if (providerChanged) {
1352
- restoredModelByChannel[providerId] = currentProviderOverrides;
1353
- changed = true;
1354
- }
1355
- }
1356
- return changed ? {
1357
- channels: {
1358
- ...params.channels,
1359
- modelByChannel: restoredModelByChannel
1360
- },
1361
- changed: true
1362
- } : {
1363
- channels: params.channels,
1364
- changed: false
1365
- };
1366
- }
1367
- function restoreDroppedPreUpdateChannels(snapshot, preUpdateConfig) {
1368
- if (!snapshot.valid || !preUpdateConfig) return {
1369
- snapshot,
1370
- changed: false
1371
- };
1372
- const preUpdateChannels = normalizeChannelConfigMap(preUpdateConfig.sourceConfig.channels);
1373
- if (!preUpdateChannels) return {
1374
- snapshot,
1375
- changed: false
1376
- };
1377
- let restoredChannels = { ...normalizeChannelConfigMap(snapshot.sourceConfig.channels) ?? {} };
1378
- const restoredChannelIds = [];
1379
- let restored = false;
1380
- for (const [channelId, channelConfig] of Object.entries(preUpdateChannels)) {
1381
- if (restoredChannels[channelId] !== void 0) continue;
1382
- restoredChannels[channelId] = structuredClone(channelConfig);
1383
- if (channelId !== "modelByChannel") restoredChannelIds.push(channelId);
1384
- restored = true;
1385
- }
1386
- if (!restored) return {
1387
- snapshot,
1388
- changed: false
1389
- };
1390
- restoredChannels = restorePreUpdateChannelModelOverrides({
1391
- channels: restoredChannels,
1392
- preUpdateChannels,
1393
- restoredChannelIds
1394
- }).channels;
1395
- const authoredChannels = resolveRestoredAuthoredChannels({
1396
- currentChannels: snapshot.sourceConfig.channels,
1397
- currentAuthoredChannels: isRecord(snapshot.parsed) ? snapshot.parsed.channels : snapshot.sourceConfig.channels,
1398
- preUpdateAuthoredChannels: preUpdateConfig.authoredConfig.channels,
1399
- restoredChannelIds
1400
- });
1401
- return {
1402
- snapshot: {
1403
- ...createUpdatedConfigSnapshot(snapshot, {
1404
- ...snapshot.sourceConfig,
1405
- channels: restoredChannels
1406
- }),
1407
- hash: snapshot.hash
1408
- },
1409
- changed: true,
1410
- ...authoredChannels !== void 0 ? { authoredChannels } : {}
1411
- };
1412
- }
1413
- function hasRestorablePreUpdateChannels(snapshot, preUpdateConfig) {
1414
- if (!snapshot.valid) return false;
1415
- const preUpdateChannels = normalizeChannelConfigMap(preUpdateConfig.sourceConfig.channels);
1416
- if (!preUpdateChannels) return false;
1417
- const postUpdateChannels = normalizeChannelConfigMap(snapshot.sourceConfig.channels) ?? {};
1418
- return Object.keys(preUpdateChannels).some((channelId) => postUpdateChannels[channelId] === void 0);
1419
- }
1420
- function resolveRestoredAuthoredChannels(params) {
1421
- if (params.preUpdateAuthoredChannels === void 0) return;
1422
- const directAuthoredChannels = normalizeDirectAuthoredChannelConfigMap(params.preUpdateAuthoredChannels);
1423
- if (!directAuthoredChannels) {
1424
- const preUpdateAuthoredChannels = normalizeChannelConfigMap(params.preUpdateAuthoredChannels);
1425
- if (!preUpdateAuthoredChannels) return;
1426
- const currentDirectAuthoredChannels = normalizeDirectAuthoredChannelConfigMap(params.currentAuthoredChannels);
1427
- if (currentDirectAuthoredChannels) return {
1428
- ...structuredClone(preUpdateAuthoredChannels),
1429
- ...structuredClone(currentDirectAuthoredChannels)
1430
- };
1431
- const currentAuthoredChannels = normalizeChannelConfigMap(params.currentAuthoredChannels);
1432
- return !currentAuthoredChannels || Object.keys(currentAuthoredChannels).length === 0 ? structuredClone(preUpdateAuthoredChannels) : void 0;
1433
- }
1434
- const restoredChannels = { ...normalizeDirectAuthoredChannelConfigMap(params.currentAuthoredChannels) ?? normalizeDirectAuthoredChannelConfigMap(params.currentChannels) ?? {} };
1435
- let changed = false;
1436
- for (const channelId of params.restoredChannelIds) {
1437
- if (restoredChannels[channelId] !== void 0 || directAuthoredChannels[channelId] === void 0) continue;
1438
- restoredChannels[channelId] = structuredClone(directAuthoredChannels[channelId]);
1439
- changed = true;
1440
- }
1441
- const restoredModelOverrides = restorePreUpdateChannelModelOverrides({
1442
- channels: restoredChannels,
1443
- preUpdateChannels: directAuthoredChannels,
1444
- restoredChannelIds: params.restoredChannelIds
1445
- });
1446
- if (restoredModelOverrides.changed) return restoredModelOverrides.channels;
1447
- return changed ? restoredChannels : void 0;
1448
- }
1449
- async function collectMissingPluginInstallPayloads(params) {
1450
- const env = params.env ?? process.env;
1451
- const normalizedPluginConfig = params.skipDisabledPlugins && params.config ? normalizePluginsConfig(params.config.plugins) : void 0;
1452
- const missing = [];
1453
- for (const [pluginId, record] of Object.entries(params.records).toSorted(([left], [right]) => left.localeCompare(right))) {
1454
- if (!isTrackedPackageInstallRecord(record)) continue;
1455
- const officialNpmSpec = params.syncOfficialPluginInstalls ? resolveTrustedSourceLinkedOfficialNpmSpec({
1456
- pluginId,
1457
- record
1458
- }) : void 0;
1459
- const officialClawHubSpec = params.syncOfficialPluginInstalls ? resolveTrustedSourceLinkedOfficialClawHubSpec({
1460
- pluginId,
1461
- record
1462
- }) : void 0;
1463
- if (normalizedPluginConfig && params.config) {
1464
- if (!resolveEffectiveEnableState({
1465
- id: pluginId,
1466
- origin: "global",
1467
- config: normalizedPluginConfig,
1468
- rootConfig: params.config
1469
- }).enabled && !officialNpmSpec && !officialClawHubSpec) continue;
1470
- }
1471
- const rawInstallPath = normalizeOptionalString(record.installPath);
1472
- if (!rawInstallPath) {
1473
- missing.push({
1474
- pluginId,
1475
- reason: "missing-install-path"
1476
- });
1477
- continue;
1478
- }
1479
- const installPath = resolveUserPath(rawInstallPath, env);
1480
- if (!await pathExists(installPath)) {
1481
- missing.push({
1482
- pluginId,
1483
- installPath,
1484
- reason: "missing-package-dir"
1485
- });
1486
- continue;
1487
- }
1488
- if (!await pathExists(path.join(installPath, "package.json"))) missing.push({
1489
- pluginId,
1490
- installPath,
1491
- reason: "missing-package-json"
1492
- });
1493
- }
1494
- return missing;
1495
- }
1496
- function formatMissingPluginPayloadReason(entry) {
1497
- if (entry.reason === "missing-install-path") return "installPath is missing";
1498
- if (entry.reason === "missing-package-json") return `package.json is missing under ${entry.installPath}`;
1499
- return `package directory is missing: ${entry.installPath}`;
1500
- }
1501
- function formatPostUpdatePluginInspectGuidance(pluginId) {
1502
- return `Run daocore plugins inspect ${pluginId} --runtime --json for details.`;
1503
- }
1504
- function createPostUpdatePluginWarning(params) {
1505
- const reason = params.reason.trim() || "unknown plugin post-update failure";
1506
- const guidance = [POST_UPDATE_PLUGIN_REPAIR_GUIDANCE, ...params.pluginId ? [formatPostUpdatePluginInspectGuidance(params.pluginId)] : []];
1507
- return {
1508
- ...params.pluginId ? { pluginId: params.pluginId } : {},
1509
- reason,
1510
- message: params.pluginId ? `Plugin "${params.pluginId}" could not be processed after the core update: ${reason} ${guidance.join(" ")}` : `Plugin post-update processing could not complete after the core update: ${reason} ${guidance.join(" ")}`,
1511
- guidance
1512
- };
1513
- }
1514
- function createGuidedPostUpdatePluginOutcome(outcome) {
1515
- if (outcome.status !== "error" && !isDisabledAfterFailureOutcome(outcome)) return { outcome };
1516
- const warning = createPostUpdatePluginWarning({
1517
- ...outcome.pluginId && outcome.pluginId !== "unknown" ? { pluginId: outcome.pluginId } : {},
1518
- reason: outcome.message
1519
- });
1520
- return {
1521
- outcome: {
1522
- ...outcome,
1523
- message: warning.message
1524
- },
1525
- warning
1526
- };
1527
- }
1528
- function isDisabledAfterFailureOutcome(outcome) {
1529
- return outcome.status === "skipped" && outcome.message.includes("after plugin update failure");
1530
- }
1531
- /**
1532
- * Build the post-core-update result we return when the active config cannot
1533
- * even be parsed. Mandatory post-core convergence requires a parseable
1534
- * config to know which plugins are configured; if one isn't available, we
1535
- * refuse to restart the gateway and surface this as a hard error so the
1536
- * existing `status === "error"` ⇒ `exit 1` pre-restart gate fires.
1537
- *
1538
- * Exported for unit testing without having to drive the entire
1539
- * `updatePluginsAfterCoreUpdate` orchestrator.
1540
- */
1541
- function buildInvalidConfigPostCoreUpdateResult() {
1542
- const guidance = ["Run `daocore doctor` to inspect the config validation errors.", "Once the config parses, rerun `daocore update`."];
1543
- const message = "Plugin post-update convergence skipped because the config is invalid; refusing to restart the gateway with an unverified plugin set.";
1544
- return {
1545
- message,
1546
- guidance,
1547
- result: {
1548
- status: "error",
1549
- reason: "invalid-config",
1550
- changed: false,
1551
- sync: {
1552
- changed: false,
1553
- switchedToBundled: [],
1554
- switchedToNpm: [],
1555
- warnings: [],
1556
- errors: []
1557
- },
1558
- npm: {
1559
- changed: false,
1560
- outcomes: []
1561
- },
1562
- integrityDrifts: [],
1563
- warnings: [{
1564
- reason: "invalid-config",
1565
- message,
1566
- guidance
1567
- }]
1568
- }
1569
- };
1570
- }
1571
- function shouldPrepareUpdatedInstallRestart(params) {
1572
- if (isPackageManagerUpdateMode(params.updateMode)) return params.serviceInstalled;
1573
- return params.serviceLoaded;
1574
- }
1575
- function shouldUseLegacyProcessRestartAfterUpdate(params) {
1576
- return !isPackageManagerUpdateMode(params.updateMode);
1577
- }
1578
- async function recoverInstalledLaunchAgentAfterUpdate(params) {
1579
- if ((params.deps?.platform ?? process.platform) !== "darwin") return {
1580
- attempted: false,
1581
- recovered: false
1582
- };
1583
- const service = params.service ?? resolveGatewayService();
1584
- const readState = params.deps?.readState ?? readGatewayServiceState;
1585
- const recover = params.deps?.recover ?? recoverInstalledLaunchAgent;
1586
- const state = await readState(service, { env: params.env }).catch(() => null);
1587
- if (state?.loaded) return {
1588
- attempted: false,
1589
- recovered: false
1590
- };
1591
- if (state && !state.installed && !state.runtime?.missingSupervision) return {
1592
- attempted: false,
1593
- recovered: false
1594
- };
1595
- const recovered = await recover({
1596
- result: "restarted",
1597
- env: state?.env ?? params.env
1598
- }).catch(() => null);
1599
- if (!recovered) return {
1600
- attempted: true,
1601
- recovered: false,
1602
- detail: "LaunchAgent was installed but not loaded; automatic bootstrap/kickstart recovery failed."
1603
- };
1604
- return {
1605
- attempted: true,
1606
- recovered: true,
1607
- message: recovered.message
1608
- };
1609
- }
1610
- async function recoverLaunchAgentAndRecheckGatewayHealth(params) {
1611
- if (params.health.healthy) return {
1612
- health: params.health,
1613
- launchAgentRecovery: null
1614
- };
1615
- const launchAgentRecovery = await (params.deps?.recoverLaunchAgent ?? recoverInstalledLaunchAgentAfterUpdate)({
1616
- service: params.service,
1617
- env: params.env
1618
- });
1619
- if (!launchAgentRecovery.recovered) return {
1620
- health: params.health,
1621
- launchAgentRecovery
1622
- };
1623
- return {
1624
- health: await (params.deps?.waitForHealthy ?? waitForGatewayHealthyRestart)({
1625
- service: params.service,
1626
- port: params.port,
1627
- expectedVersion: params.expectedVersion,
1628
- env: params.env
1629
- }),
1630
- launchAgentRecovery
1631
- };
1632
- }
1633
- function formatPostUpdateGatewayRecoveryLine(platform) {
1634
- const restartCommand = replaceCliName(formatCliCommand("daocore gateway restart"), CLI_NAME);
1635
- const installCommand = replaceCliName(formatCliCommand("daocore gateway install --force"), CLI_NAME);
1636
- const statusCommand = replaceCliName(formatCliCommand("daocore gateway status --deep"), CLI_NAME);
1637
- if (platform === "darwin") return `Recovery: run \`${restartCommand}\`; if the LaunchAgent is installed but not loaded, run \`${installCommand}\` from the logged-in macOS user session, then rerun \`${statusCommand}\`.`;
1638
- if (platform === "linux") return `Recovery: run \`${restartCommand}\`; if the systemd user service is missing, stale, or not active, run \`${installCommand}\` from the same user account, then rerun \`${statusCommand}\`.`;
1639
- if (platform === "win32") return `Recovery: run \`${restartCommand}\`; if the gateway Scheduled Task or Windows login item is missing, stale, or not running, run \`${installCommand}\` from the same user account, then rerun \`${statusCommand}\`.`;
1640
- return `Recovery: run \`${restartCommand}\`; if the local service manager reports the gateway service is missing, stale, or not running, run \`${installCommand}\` from the same user account, then rerun \`${statusCommand}\`.`;
1641
- }
1642
- function formatPostUpdateGatewayRecoveryInstructions(result, platform = process.platform) {
1643
- const lines = [formatPostUpdateGatewayRecoveryLine(platform)];
1644
- const beforeVersion = normalizeOptionalString(result.before?.version);
1645
- if (isPackageManagerUpdateMode(result.mode) && beforeVersion) lines.push(`Rollback: reinstall DaoCore ${beforeVersion} with the same package manager, then rerun \`${replaceCliName(formatCliCommand("daocore gateway install --force"), CLI_NAME)}\`.`);
1646
- return lines;
1647
- }
1648
- function formatGatewayAncestryBlockMessage(pid) {
1649
- return `daocore update detected it is running inside the gateway process tree.
1650
- Gateway PID ${pid} is an ancestor of this process, so this updater cannot safely stop or restart the gateway that owns it.
1651
- Run \`${replaceCliName(formatCliCommand("daocore update"), CLI_NAME)}\` from a shell outside the gateway service, or stop the gateway service first and then update.`;
1652
- }
1653
- function parsePositivePid(value) {
1654
- if (typeof value === "number" && Number.isFinite(value) && value > 0) return Math.floor(value);
1655
- if (typeof value !== "string") return null;
1656
- const trimmed = value.trim();
1657
- if (!/^\d+$/u.test(trimmed)) return null;
1658
- const parsed = Number.parseInt(trimmed, 10);
1659
- return Number.isFinite(parsed) && parsed > 0 ? parsed : null;
1660
- }
1661
- function isInheritedGatewayRuntimePid(pid, env = process.env) {
1662
- if (!isRunningInsideGatewayService(env)) return false;
1663
- return parsePositivePid(env[GATEWAY_SERVICE_RUNTIME_PID_ENV]) === pid;
1664
- }
1665
- function isGatewayAncestorPid(pid, env = process.env) {
1666
- const parsed = parsePositivePid(pid);
1667
- if (parsed === null) return false;
1668
- return isInheritedGatewayRuntimePid(parsed, env) || getSelfAndAncestorPidsSync().has(parsed);
1669
- }
1670
- function gatewayAncestryBlockMessage(pid) {
1671
- return isGatewayAncestorPid(pid) ? formatGatewayAncestryBlockMessage(pid) : void 0;
1672
- }
1673
- function gatewayRuntimeAncestryBlockMessage(runtime) {
1674
- return gatewayAncestryBlockMessage(runtime?.pid);
1675
- }
1676
- function serviceControlStdoutForMode(jsonMode) {
1677
- return jsonMode ? JSON_MODE_SERVICE_STDOUT : process.stdout;
1678
- }
1679
- async function maybeStopManagedServiceBeforePackageUpdate(params) {
1680
- let service;
1681
- let serviceState;
1682
- try {
1683
- service = resolveGatewayService();
1684
- serviceState = await readGatewayServiceState(service, { env: process.env });
1685
- } catch {
1686
- return {
1687
- stopped: false,
1688
- inspected: false,
1689
- runtimeInspected: false,
1690
- running: false
1691
- };
1692
- }
1693
- const runtimeStatus = serviceState.runtime?.status;
1694
- const runtimeInspected = runtimeStatus === "running" || runtimeStatus === "stopped";
1695
- if (!serviceState.installed) return {
1696
- stopped: false,
1697
- inspected: true,
1698
- runtimeInspected,
1699
- running: serviceState.running,
1700
- serviceEnv: serviceState.env
1701
- };
1702
- if (!params.shouldRestart) {
1703
- if (!params.jsonMode && serviceState.running) defaultRuntime.log(theme.warn("--no-restart is set while the managed gateway service is running; the package update will not stop or restart that process."));
1704
- return {
1705
- stopped: false,
1706
- inspected: true,
1707
- runtimeInspected,
1708
- running: serviceState.running,
1709
- serviceEnv: serviceState.env
1710
- };
1711
- }
1712
- if (!runtimeInspected) return {
1713
- stopped: false,
1714
- inspected: true,
1715
- runtimeInspected: false,
1716
- running: false,
1717
- serviceEnv: serviceState.env
1718
- };
1719
- if (!serviceState.running) return {
1720
- stopped: false,
1721
- inspected: true,
1722
- runtimeInspected: true,
1723
- running: false,
1724
- serviceEnv: serviceState.env
1725
- };
1726
- const blockMessage = gatewayRuntimeAncestryBlockMessage(serviceState.runtime);
1727
- if (blockMessage) return {
1728
- stopped: false,
1729
- inspected: true,
1730
- runtimeInspected: true,
1731
- running: true,
1732
- blockMessage,
1733
- serviceEnv: serviceState.env
1734
- };
1735
- if (!params.jsonMode) defaultRuntime.log(theme.muted("Stopping managed gateway service before package update..."));
1736
- await service.stop({
1737
- env: serviceState.env,
1738
- stdout: serviceControlStdoutForMode(params.jsonMode)
1739
- });
1740
- return {
1741
- stopped: true,
1742
- inspected: true,
1743
- runtimeInspected: true,
1744
- running: true,
1745
- serviceEnv: serviceState.env
1746
- };
1747
- }
1748
- async function maybeRestartServiceAfterFailedPackageUpdate(params) {
1749
- if (!params.prePackageServiceStop?.stopped || !params.prePackageServiceStop.serviceEnv) return;
1750
- try {
1751
- await resolveGatewayService().restart({
1752
- env: params.prePackageServiceStop.serviceEnv,
1753
- stdout: serviceControlStdoutForMode(params.jsonMode)
1754
- });
1755
- if (!params.jsonMode) defaultRuntime.log(theme.muted("Restarted managed gateway service after failed update."));
1756
- } catch (err) {
1757
- const message = `Failed to restart managed gateway service after failed update: ${String(err)}`;
1758
- if (params.jsonMode) defaultRuntime.error(message);
1759
- else defaultRuntime.log(theme.warn(message));
1760
- }
1761
- }
1762
- function isRunningInsideGatewayService(env = process.env) {
1763
- if (env.DAOCORE_SERVICE_MARKER?.trim() !== "daocore") return false;
1764
- const serviceKind = env.DAOCORE_SERVICE_KIND?.trim();
1765
- return !serviceKind || serviceKind === "gateway";
1766
- }
1767
- function shouldBlockPackageUpdateFromGatewayServiceEnv(params) {
1768
- if (!isRunningInsideGatewayService()) return false;
1769
- const stopState = params.prePackageServiceStop;
1770
- if (!stopState?.inspected) return true;
1771
- if (stopState.stopped) return false;
1772
- if (!stopState.runtimeInspected) return true;
1773
- return stopState.running;
1774
- }
1775
- function formatCommandFailure(stdout, stderr) {
1776
- const detail = (stderr || stdout).trim();
1777
- if (!detail) return "command returned a non-zero exit code";
1778
- return detail.split("\n").slice(-3).join("\n");
1779
- }
1780
- function tryResolveInvocationCwd() {
1781
- try {
1782
- return process.cwd();
1783
- } catch {
1784
- return;
1785
- }
1786
- }
1787
- async function resolvePackageRuntimePreflightError(params) {
1788
- if (!canResolveRegistryVersionForPackageTarget(params.tag)) return null;
1789
- const target = params.tag.trim();
1790
- if (!target) return null;
1791
- const status = await fetchNpmPackageTargetStatus({
1792
- target,
1793
- timeoutMs: params.timeoutMs
1794
- });
1795
- if (status.error) return null;
1796
- const runtime = await resolvePackageRuntimeForPreflight({
1797
- nodeRunner: params.nodeRunner,
1798
- timeoutMs: params.timeoutMs
1799
- });
1800
- if (nodeVersionSatisfiesEngine(runtime.version, status.nodeEngine) !== false) return null;
1801
- const targetLabel = status.version ?? target;
1802
- return [
1803
- `${runtime.nodeRunner ? `Node ${runtime.version ?? "unknown"} at ${runtime.nodeRunner}` : `Node ${runtime.version ?? "unknown"}`} is too old for daocore@${targetLabel}.`,
1804
- `The requested package requires ${status.nodeEngine}.`,
1805
- runtime.nodeRunner ? "Upgrade the Node runtime that owns the managed Gateway service, then rerun `daocore update`." : "Upgrade Node to 22.19+ or Node 24, then rerun `daocore update`.",
1806
- "Bare `npm i -g daocore` can silently install an older compatible release.",
1807
- "After upgrading Node, use `npm i -g daocore@latest`."
1808
- ].join("\n");
1809
- }
1810
- async function resolvePackageRuntimeForPreflight(params) {
1811
- const nodeRunner = normalizeOptionalString(params.nodeRunner);
1812
- if (!nodeRunner) return { version: process.versions.node ?? null };
1813
- const res = await runCommandWithTimeout([nodeRunner, "--version"], { timeoutMs: Math.min(params.timeoutMs ?? 1e4, 1e4) }).catch(() => null);
1814
- return {
1815
- version: (res?.code === 0 ? res.stdout.trim() : "").replace(/^v/u, "") || null,
1816
- nodeRunner
1817
- };
1818
- }
1819
- function resolveServiceRefreshEnv(env, invocationCwd) {
1820
- const resolvedEnv = { ...env };
1821
- for (const key of SERVICE_REFRESH_PATH_ENV_KEYS) {
1822
- const rawValue = resolvedEnv[key]?.trim();
1823
- if (!rawValue) continue;
1824
- if (rawValue.startsWith("~") || path.isAbsolute(rawValue) || path.win32.isAbsolute(rawValue)) {
1825
- resolvedEnv[key] = rawValue;
1826
- continue;
1827
- }
1828
- if (!invocationCwd) {
1829
- resolvedEnv[key] = rawValue;
1830
- continue;
1831
- }
1832
- resolvedEnv[key] = path.resolve(invocationCwd, rawValue);
1833
- }
1834
- return resolvedEnv;
1835
- }
1836
- function disableUpdatedPackageCompileCacheEnv(env) {
1837
- return {
1838
- ...env,
1839
- NODE_DISABLE_COMPILE_CACHE: "1"
1840
- };
1841
- }
1842
- function stripGatewayServiceMarkerEnv(env) {
1843
- const resolvedEnv = { ...env };
1844
- delete resolvedEnv.DAOCORE_SERVICE_MARKER;
1845
- delete resolvedEnv.DAOCORE_SERVICE_KIND;
1846
- delete resolvedEnv[GATEWAY_SERVICE_RUNTIME_PID_ENV];
1847
- return resolvedEnv;
1848
- }
1849
- function resolveUpdatedInstallCommandEnv(env, invocationCwd) {
1850
- return disableUpdatedPackageCompileCacheEnv(resolveServiceRefreshEnv(env, invocationCwd));
1851
- }
1852
- function resolvePostInstallDoctorEnv(params) {
1853
- const resolvedEnv = disableUpdatedPackageCompileCacheEnv(params?.baseEnv ?? process.env);
1854
- if (!params?.serviceEnv) return resolvedEnv;
1855
- const serviceEnv = resolveServiceRefreshEnv(params.serviceEnv, params.invocationCwd);
1856
- for (const key of POST_INSTALL_DOCTOR_SERVICE_ENV_KEYS) if (serviceEnv[key]?.trim()) resolvedEnv[key] = serviceEnv[key];
1857
- return resolvedEnv;
1858
- }
1859
- function resolveUpdatedGatewayRestartPort(params) {
1860
- return resolveGatewayPort(params.config, params.serviceEnv ?? params.processEnv ?? process.env);
1861
- }
1862
- function resolvePostUpdateServiceStateReadEnv(params) {
1863
- if (isPackageManagerUpdateMode(params.updateMode) && params.prePackageServiceEnv) return params.prePackageServiceEnv;
1864
- return params.processEnv ?? process.env;
1865
- }
1866
- function printDryRunPreview(preview, jsonMode) {
1867
- if (jsonMode) {
1868
- defaultRuntime.writeJson(preview);
1869
- return;
1870
- }
1871
- defaultRuntime.log(theme.heading("Update dry-run"));
1872
- defaultRuntime.log(theme.muted("No changes were applied."));
1873
- defaultRuntime.log("");
1874
- defaultRuntime.log(` Root: ${theme.muted(preview.root)}`);
1875
- defaultRuntime.log(` Install kind: ${theme.muted(preview.installKind)}`);
1876
- defaultRuntime.log(` Mode: ${theme.muted(preview.mode)}`);
1877
- defaultRuntime.log(` Channel: ${theme.muted(preview.effectiveChannel)}`);
1878
- defaultRuntime.log(` Tag/spec: ${theme.muted(preview.tag)}`);
1879
- if (preview.currentVersion) defaultRuntime.log(` Current version: ${theme.muted(preview.currentVersion)}`);
1880
- if (preview.targetVersion) defaultRuntime.log(` Target version: ${theme.muted(preview.targetVersion)}`);
1881
- if (preview.downgradeRisk) defaultRuntime.log(theme.warn(" Downgrade confirmation would be required in a real run."));
1882
- defaultRuntime.log("");
1883
- defaultRuntime.log(theme.heading("Planned actions:"));
1884
- for (const action of preview.actions) defaultRuntime.log(` - ${action}`);
1885
- if (preview.notes.length > 0) {
1886
- defaultRuntime.log("");
1887
- defaultRuntime.log(theme.heading("Notes:"));
1888
- for (const note of preview.notes) defaultRuntime.log(` - ${theme.muted(note)}`);
1889
- }
1890
- }
1891
- async function refreshGatewayServiceEnv(params) {
1892
- const args = [
1893
- "gateway",
1894
- "install",
1895
- "--force"
1896
- ];
1897
- if (params.jsonMode) args.push("--json");
1898
- const entrypoint = await resolveGatewayInstallEntrypoint(params.result.root);
1899
- if (entrypoint) {
1900
- const res = await runCommandWithTimeout([
1901
- params.nodeRunner ?? resolveNodeRunner(),
1902
- entrypoint,
1903
- ...args
1904
- ], {
1905
- cwd: params.result.root,
1906
- env: resolveUpdatedInstallCommandEnv(params.env ?? process.env, params.invocationCwd),
1907
- timeoutMs: SERVICE_REFRESH_TIMEOUT_MS
1908
- });
1909
- if (res.code === 0) return;
1910
- throw new Error(`updated install refresh failed (${entrypoint}): ${formatCommandFailure(res.stdout, res.stderr)}`);
1911
- }
1912
- if (isPackageManagerUpdateMode(params.result.mode)) throw new Error(`updated install entrypoint not found under ${params.result.root ?? "unknown"}`);
1913
- await runDaemonInstall({
1914
- force: true,
1915
- json: params.jsonMode || void 0
1916
- });
1917
- }
1918
- async function runUpdatedInstallGatewayRestart(params) {
1919
- const entrypoint = await resolveGatewayInstallEntrypoint(params.result.root);
1920
- if (!entrypoint) throw new Error(`updated install entrypoint not found under ${params.result.root ?? "unknown"}`);
1921
- const args = ["gateway", "restart"];
1922
- if (params.jsonMode) args.push("--json");
1923
- const res = await runCommandWithTimeout([
1924
- params.nodeRunner ?? resolveNodeRunner(),
1925
- entrypoint,
1926
- ...args
1927
- ], {
1928
- cwd: params.result.root,
1929
- env: resolveUpdatedInstallCommandEnv(params.env ?? process.env, params.invocationCwd),
1930
- timeoutMs: SERVICE_REFRESH_TIMEOUT_MS
1931
- });
1932
- if (res.code === 0) return true;
1933
- throw new Error(`updated install restart failed (${entrypoint}): ${formatCommandFailure(res.stdout, res.stderr)}`);
1934
- }
1935
- async function tryInstallShellCompletion(opts) {
1936
- if (opts.jsonMode || !process.stdin.isTTY) return;
1937
- const status = await checkShellCompletionStatus(CLI_NAME);
1938
- if (status.usesSlowPattern) {
1939
- defaultRuntime.log(theme.muted("Upgrading shell completion to cached version..."));
1940
- if (await ensureCompletionCacheExists(CLI_NAME)) await installCompletion(status.shell, true, CLI_NAME);
1941
- return;
1942
- }
1943
- if (status.profileInstalled && !status.cacheExists) {
1944
- defaultRuntime.log(theme.muted("Regenerating shell completion cache..."));
1945
- await ensureCompletionCacheExists(CLI_NAME);
1946
- return;
1947
- }
1948
- if (!status.profileInstalled) {
1949
- defaultRuntime.log("");
1950
- defaultRuntime.log(theme.heading("Shell completion"));
1951
- const shouldInstall = await confirm({
1952
- message: stylePromptMessage(`Enable ${status.shell} shell completion for ${CLI_NAME}?`),
1953
- initialValue: true
1954
- });
1955
- if (isCancel(shouldInstall) || !shouldInstall) {
1956
- if (!opts.skipPrompt) defaultRuntime.log(theme.muted(`Skipped. Run \`${replaceCliName(formatCliCommand("daocore completion --install"), CLI_NAME)}\` later to enable.`));
1957
- return;
1958
- }
1959
- if (!await ensureCompletionCacheExists(CLI_NAME)) {
1960
- defaultRuntime.log(theme.warn("Failed to generate completion cache."));
1961
- return;
1962
- }
1963
- await installCompletion(status.shell, opts.skipPrompt, CLI_NAME);
1964
- }
1965
- }
1966
- async function tryRealpathOrResolve(value) {
1967
- try {
1968
- return await fs$1.realpath(path.resolve(value));
1969
- } catch {
1970
- return path.resolve(value);
1971
- }
1972
- }
1973
- function isNodeExecutable(value) {
1974
- const base = normalizeOptionalString(value ? path.basename(value) : void 0)?.toLowerCase();
1975
- return base === "node" || base === "node.exe";
1976
- }
1977
- function resolveManagedServiceNodeRunner(command) {
1978
- const args = command?.programArguments;
1979
- if (!args?.length) return;
1980
- const gatewayIndex = args.indexOf("gateway");
1981
- if (gatewayIndex <= 1) return;
1982
- const runner = args[gatewayIndex - 2];
1983
- return isNodeExecutable(runner) ? runner : void 0;
1984
- }
1985
- /**
1986
- * Resolve the node binary baked into the managed gateway service unit,
1987
- * independent of any package root redirect. This detects when the user's
1988
- * current PATH-resolved node differs from the service's baked node even
1989
- * when the package root is the same.
1990
- */
1991
- async function resolveManagedServiceNodeRunnerOverride() {
1992
- const serviceNode = resolveManagedServiceNodeRunner(await resolveGatewayService().readCommand(process.env).catch(() => null));
1993
- if (!serviceNode) return;
1994
- const currentNode = resolveNodeRunner();
1995
- const [serviceNodeReal, currentNodeReal] = await Promise.all([tryRealpathOrResolve(serviceNode), tryRealpathOrResolve(currentNode)]);
1996
- if (serviceNodeReal === currentNodeReal) return;
1997
- return serviceNode;
1998
- }
1999
- async function resolveManagedServicePackageUpdateRoot(params) {
2000
- const command = await resolveGatewayService().readCommand(process.env).catch(() => null);
2001
- const layout = await summarizeGatewayServiceLayout(command);
2002
- const serviceRoot = layout?.packageRoot;
2003
- if (!serviceRoot || layout.entrypointSourceCheckout === true) return null;
2004
- const [currentRootReal, serviceRootReal] = await Promise.all([tryRealpathOrResolve(params.root), tryRealpathOrResolve(serviceRoot)]);
2005
- if (currentRootReal === serviceRootReal) return null;
2006
- const nodeRunner = resolveManagedServiceNodeRunner(command);
2007
- return {
2008
- root: serviceRoot,
2009
- previousRoot: params.root,
2010
- ...nodeRunner ? { nodeRunner } : {}
2011
- };
2012
- }
2013
- async function runPackageInstallUpdate(params) {
2014
- const manager = await resolveGlobalManager({
2015
- root: params.root,
2016
- installKind: params.installKind,
2017
- timeoutMs: params.timeoutMs
2018
- });
2019
- const installEnv = await createGlobalInstallEnv();
2020
- const runCommand = createGlobalCommandRunner();
2021
- const installTarget = await resolveGlobalInstallTarget({
2022
- manager,
2023
- runCommand,
2024
- timeoutMs: params.timeoutMs,
2025
- pkgRoot: params.root,
2026
- honorPackageRoot: params.honorPackageRoot === true
2027
- });
2028
- const pkgRoot = installTarget.packageRoot;
2029
- const packageName = (pkgRoot ? await readPackageName(pkgRoot) : await readPackageName(params.root)) ?? "daocore";
2030
- const installSpec = resolveGlobalInstallSpec({
2031
- packageName,
2032
- tag: params.tag,
2033
- env: installEnv
2034
- });
2035
- const beforeVersion = pkgRoot ? await readPackageVersion(pkgRoot) : null;
2036
- if (pkgRoot) await cleanupGlobalRenameDirs({
2037
- globalRoot: path.dirname(pkgRoot),
2038
- packageName
2039
- });
2040
- const diskWarning = createLowDiskSpaceWarning({
2041
- targetPath: pkgRoot ? path.dirname(pkgRoot) : params.root,
2042
- purpose: "global package update"
2043
- });
2044
- if (diskWarning) if (params.jsonMode) defaultRuntime.error(`Warning: ${diskWarning}`);
2045
- else defaultRuntime.log(theme.warn(diskWarning));
2046
- const packageUpdate = await runGlobalPackageUpdateSteps({
2047
- installTarget,
2048
- installSpec,
2049
- packageName,
2050
- packageRoot: pkgRoot,
2051
- runCommand,
2052
- timeoutMs: params.timeoutMs,
2053
- ...installEnv === void 0 ? {} : { env: installEnv },
2054
- runStep: (stepParams) => runUpdateStep({
2055
- ...stepParams,
2056
- progress: params.progress
2057
- }),
2058
- postVerifyStep: async (verifiedPackageRoot) => {
2059
- const entryPath = await resolveGatewayInstallEntrypoint(verifiedPackageRoot);
2060
- if (entryPath) {
2061
- await createUpdateConfigSnapshot();
2062
- const candidateHostVersion = await readPackageVersion(verifiedPackageRoot);
2063
- return await runUpdateStep({
2064
- name: `${CLI_NAME} doctor`,
2065
- argv: [
2066
- params.nodeRunner ?? resolveNodeRunner(),
2067
- entryPath,
2068
- "doctor",
2069
- "--non-interactive",
2070
- "--fix"
2071
- ],
2072
- cwd: verifiedPackageRoot,
2073
- env: {
2074
- ...resolvePostInstallDoctorEnv({
2075
- serviceEnv: params.managedServiceEnv,
2076
- invocationCwd: params.invocationCwd
2077
- }),
2078
- DAOCORE_UPDATE_IN_PROGRESS: "1",
2079
- [UPDATE_DEFER_CONFIGURED_PLUGIN_INSTALL_REPAIR_ENV]: "1",
2080
- [UPDATE_PARENT_SUPPORTS_DOCTOR_CONFIG_WRITE_ENV]: "1",
2081
- ...candidateHostVersion === null ? {} : { DAOCORE_COMPATIBILITY_HOST_VERSION: candidateHostVersion }
2082
- },
2083
- timeoutMs: params.timeoutMs,
2084
- progress: params.progress
2085
- });
2086
- }
2087
- return null;
2088
- }
2089
- });
2090
- return {
2091
- status: packageUpdate.failedStep ? "error" : "ok",
2092
- mode: manager,
2093
- root: packageUpdate.verifiedPackageRoot ?? params.root,
2094
- reason: packageUpdate.failedStep ? packageUpdate.failedStep.name : void 0,
2095
- before: { version: beforeVersion },
2096
- after: { version: packageUpdate.afterVersion ?? beforeVersion },
2097
- steps: packageUpdate.steps,
2098
- durationMs: Date.now() - params.startedAt
2099
- };
2100
- }
2101
- async function runGitUpdate(params) {
2102
- const updateRoot = params.switchToGit ? resolveGitInstallDir() : params.root;
2103
- const effectiveTimeout = params.timeoutMs ?? DEFAULT_UPDATE_STEP_TIMEOUT_MS;
2104
- const installEnv = await createGlobalInstallEnv();
2105
- const cloneStep = params.switchToGit ? await ensureGitCheckout({
2106
- dir: updateRoot,
2107
- env: installEnv,
2108
- timeoutMs: effectiveTimeout,
2109
- progress: params.progress
2110
- }) : null;
2111
- if (cloneStep && cloneStep.exitCode !== 0) {
2112
- const result = {
2113
- status: "error",
2114
- mode: "git",
2115
- root: updateRoot,
2116
- reason: cloneStep.name,
2117
- steps: [cloneStep],
2118
- durationMs: Date.now() - params.startedAt
2119
- };
2120
- params.stop();
2121
- printResult(result, {
2122
- ...params.opts,
2123
- hideSteps: params.showProgress
2124
- });
2125
- defaultRuntime.exit(1);
2126
- return result;
2127
- }
2128
- const updateResult = await runGatewayUpdate({
2129
- cwd: updateRoot,
2130
- argv1: params.switchToGit ? void 0 : process.argv[1],
2131
- timeoutMs: params.timeoutMs,
2132
- progress: params.progress,
2133
- channel: params.channel,
2134
- tag: params.tag,
2135
- devTargetRef: params.devTargetRef,
2136
- deferConfiguredPluginInstallRepair: true
2137
- });
2138
- const steps = [...cloneStep ? [cloneStep] : [], ...updateResult.steps];
2139
- if (params.switchToGit && updateResult.status === "ok") {
2140
- const installTarget = await resolveGlobalInstallTarget({
2141
- manager: await resolveGlobalManager({
2142
- root: params.root,
2143
- installKind: params.installKind,
2144
- timeoutMs: effectiveTimeout
2145
- }),
2146
- runCommand: createGlobalCommandRunner(),
2147
- timeoutMs: effectiveTimeout,
2148
- pkgRoot: params.root
2149
- });
2150
- const installStep = await runUpdateStep({
2151
- name: "global install",
2152
- argv: globalInstallArgs(installTarget, updateRoot, void 0, installTarget.manager === "pnpm" ? resolvePnpmGlobalDirFromGlobalRoot(installTarget.globalRoot) : null),
2153
- cwd: updateRoot,
2154
- env: installEnv,
2155
- timeoutMs: effectiveTimeout,
2156
- progress: params.progress
2157
- });
2158
- steps.push(installStep);
2159
- const failedStep = installStep.exitCode !== 0 ? installStep : null;
2160
- return {
2161
- ...updateResult,
2162
- status: updateResult.status === "ok" && !failedStep ? "ok" : "error",
2163
- steps,
2164
- durationMs: Date.now() - params.startedAt
2165
- };
2166
- }
2167
- return {
2168
- ...updateResult,
2169
- steps,
2170
- durationMs: Date.now() - params.startedAt
2171
- };
2172
- }
2173
- async function updatePluginsAfterCoreUpdate(params) {
2174
- if (!params.configSnapshot.valid) {
2175
- const invalid = buildInvalidConfigPostCoreUpdateResult();
2176
- if (!params.opts.json) {
2177
- defaultRuntime.log(theme.error(invalid.message));
2178
- for (const line of invalid.guidance) defaultRuntime.log(theme.muted(` ${line}`));
2179
- }
2180
- return invalid.result;
2181
- }
2182
- const pluginLogger = params.opts.json ? {} : {
2183
- info: (msg) => defaultRuntime.log(msg),
2184
- warn: (msg) => defaultRuntime.log(theme.warn(msg)),
2185
- error: (msg) => defaultRuntime.log(theme.error(msg))
2186
- };
2187
- if (!params.opts.json) {
2188
- defaultRuntime.log("");
2189
- defaultRuntime.log(theme.heading("Updating plugins..."));
2190
- }
2191
- const warnings = [];
2192
- const pluginInstallRecords = params.pluginInstallRecords ?? await loadInstalledPluginIndexInstallRecords();
2193
- const syncResult = await syncPluginsForUpdateChannel({
2194
- config: withPluginInstallRecords(params.configSnapshot.sourceConfig, pluginInstallRecords),
2195
- channel: params.channel,
2196
- workspaceDir: params.root,
2197
- externalizedBundledPluginBridges: await listPersistedBundledPluginLocationBridges({ workspaceDir: params.root }),
2198
- logger: pluginLogger
2199
- });
2200
- for (const error of syncResult.summary.errors) warnings.push(createPostUpdatePluginWarning({ reason: error }));
2201
- let pluginConfig = syncResult.config;
2202
- const integrityDrifts = [];
2203
- const pluginUpdateOutcomes = [];
2204
- let pluginsChanged = syncResult.changed || params.configChanged === true;
2205
- let npmPluginsChanged = false;
2206
- const onPluginIntegrityDrift = async (drift) => {
2207
- integrityDrifts.push({
2208
- pluginId: drift.pluginId,
2209
- spec: drift.spec,
2210
- expectedIntegrity: drift.expectedIntegrity,
2211
- actualIntegrity: drift.actualIntegrity,
2212
- ...drift.resolvedSpec ? { resolvedSpec: drift.resolvedSpec } : {},
2213
- ...drift.resolvedVersion ? { resolvedVersion: drift.resolvedVersion } : {},
2214
- action: "aborted"
2215
- });
2216
- if (!params.opts.json) {
2217
- const specLabel = drift.resolvedSpec ?? drift.spec;
2218
- defaultRuntime.log(theme.warn(`Integrity drift detected for "${drift.pluginId}" (${specLabel})\nExpected: ${drift.expectedIntegrity}\nActual: ${drift.actualIntegrity}
2219
- Plugin update aborted. Reinstall the plugin only if you trust the new artifact.`));
2220
- }
2221
- return false;
2222
- };
2223
- const collectMissingPayloadWarnings = async (records) => {
2224
- const missing = await collectMissingPluginInstallPayloads({
2225
- records,
2226
- config: pluginConfig,
2227
- skipDisabledPlugins: true,
2228
- syncOfficialPluginInstalls: true
2229
- });
2230
- if (missing.length === 0) return [];
2231
- const missingIds = missing.map((entry) => entry.pluginId);
2232
- for (const entry of missing) {
2233
- const warning = createPostUpdatePluginWarning({
2234
- pluginId: entry.pluginId,
2235
- reason: `Plugin install payload missing after update: ${formatMissingPluginPayloadReason(entry)}.`
2236
- });
2237
- warnings.push(warning);
2238
- pluginUpdateOutcomes.push({
2239
- pluginId: entry.pluginId,
2240
- status: "error",
2241
- message: warning.message
2242
- });
2243
- if (!params.opts.json) defaultRuntime.log(theme.warn(warning.message));
2244
- }
2245
- const repairResult = await updateNpmInstalledPlugins({
2246
- config: pluginConfig,
2247
- pluginIds: missingIds,
2248
- timeoutMs: params.timeoutMs,
2249
- updateChannel: params.channel,
2250
- skipDisabledPlugins: true,
2251
- syncOfficialPluginInstalls: true,
2252
- disableOnFailure: true,
2253
- logger: pluginLogger,
2254
- onIntegrityDrift: onPluginIntegrityDrift
2255
- });
2256
- pluginConfig = repairResult.config;
2257
- pluginsChanged ||= repairResult.changed;
2258
- npmPluginsChanged ||= repairResult.changed;
2259
- pluginUpdateOutcomes.push(...repairResult.outcomes);
2260
- return missingIds;
2261
- };
2262
- const missingPayloadIds = await collectMissingPayloadWarnings(pluginInstallRecords);
2263
- const npmResult = await updateNpmInstalledPlugins({
2264
- config: pluginConfig,
2265
- timeoutMs: params.timeoutMs,
2266
- updateChannel: params.channel,
2267
- skipIds: new Set([...syncResult.summary.switchedToNpm, ...missingPayloadIds]),
2268
- skipDisabledPlugins: true,
2269
- syncOfficialPluginInstalls: true,
2270
- disableOnFailure: true,
2271
- logger: pluginLogger,
2272
- onIntegrityDrift: onPluginIntegrityDrift
2273
- });
2274
- pluginConfig = npmResult.config;
2275
- pluginsChanged ||= npmResult.changed;
2276
- npmPluginsChanged ||= npmResult.changed;
2277
- for (const rawOutcome of npmResult.outcomes) {
2278
- const guided = createGuidedPostUpdatePluginOutcome(rawOutcome);
2279
- pluginUpdateOutcomes.push(guided.outcome);
2280
- if (guided.warning) warnings.push(guided.warning);
2281
- }
2282
- const remainingMissingPayloads = await collectMissingPluginInstallPayloads({
2283
- records: pluginConfig.plugins?.installs ?? {},
2284
- config: pluginConfig,
2285
- skipDisabledPlugins: true,
2286
- syncOfficialPluginInstalls: true
2287
- });
2288
- pluginUpdateOutcomes.push(...remainingMissingPayloads.filter((entry) => !missingPayloadIds.includes(entry.pluginId)).map((entry) => {
2289
- const warning = createPostUpdatePluginWarning({
2290
- pluginId: entry.pluginId,
2291
- reason: `Plugin install payload missing after update: ${formatMissingPluginPayloadReason(entry)}.`
2292
- });
2293
- warnings.push(warning);
2294
- return {
2295
- pluginId: entry.pluginId,
2296
- status: "error",
2297
- message: warning.message
2298
- };
2299
- }));
2300
- const convergenceBaselineRecords = pluginConfig.plugins?.installs ?? {};
2301
- const convergence = await runPostCorePluginConvergence({
2302
- cfg: pluginConfig,
2303
- env: process.env,
2304
- baselineInstallRecords: convergenceBaselineRecords
2305
- });
2306
- for (const change of convergence.changes) if (!params.opts.json) defaultRuntime.log(theme.muted(change));
2307
- const convergenceFolded = convergenceWarningsToOutcomes(convergence);
2308
- for (const warning of convergenceFolded.warnings) {
2309
- warnings.push(warning);
2310
- if (!params.opts.json) {
2311
- defaultRuntime.log(theme.warn(warning.message));
2312
- for (const guidance of warning.guidance) defaultRuntime.log(theme.muted(` ${guidance}`));
2313
- }
2314
- }
2315
- pluginUpdateOutcomes.push(...convergenceFolded.outcomes);
2316
- const convergenceErrored = convergenceFolded.errored;
2317
- pluginConfig = withPluginInstallRecords(pluginConfig, convergence.installRecords);
2318
- if (convergence.changes.length > 0) pluginsChanged = true;
2319
- if (pluginsChanged) {
2320
- const nextInstallRecords = pluginConfig.plugins?.installs ?? {};
2321
- let nextConfig = withoutPluginInstallRecords(pluginConfig);
2322
- if (params.restoredAuthoredChannels !== void 0) nextConfig = {
2323
- ...nextConfig,
2324
- channels: structuredClone(params.restoredAuthoredChannels)
2325
- };
2326
- await commitPluginInstallRecordsWithConfig({
2327
- previousInstallRecords: pluginInstallRecords,
2328
- nextInstallRecords,
2329
- nextConfig,
2330
- baseHash: params.configSnapshot.hash
2331
- });
2332
- await refreshPluginRegistryAfterConfigMutation({
2333
- config: nextConfig,
2334
- reason: "source-changed",
2335
- workspaceDir: params.root,
2336
- installRecords: nextInstallRecords,
2337
- logger: pluginLogger
2338
- });
2339
- }
2340
- if (params.opts.json) return {
2341
- status: convergenceErrored ? "error" : warnings.length > 0 ? "warning" : "ok",
2342
- changed: pluginsChanged,
2343
- warnings,
2344
- sync: {
2345
- changed: syncResult.changed,
2346
- switchedToBundled: syncResult.summary.switchedToBundled,
2347
- switchedToNpm: syncResult.summary.switchedToNpm,
2348
- warnings: syncResult.summary.warnings,
2349
- errors: syncResult.summary.errors
2350
- },
2351
- npm: {
2352
- changed: npmPluginsChanged,
2353
- outcomes: pluginUpdateOutcomes
2354
- },
2355
- integrityDrifts
2356
- };
2357
- const summarizeList = (list) => {
2358
- if (list.length <= 6) return list.join(", ");
2359
- return `${list.slice(0, 6).join(", ")} +${list.length - 6} more`;
2360
- };
2361
- if (syncResult.summary.switchedToBundled.length > 0) defaultRuntime.log(theme.muted(`Switched to bundled plugins: ${summarizeList(syncResult.summary.switchedToBundled)}.`));
2362
- if (syncResult.summary.switchedToNpm.length > 0) defaultRuntime.log(theme.muted(`Restored npm plugins: ${summarizeList(syncResult.summary.switchedToNpm)}.`));
2363
- for (const warning of syncResult.summary.warnings) defaultRuntime.log(theme.warn(warning));
2364
- for (const error of syncResult.summary.errors) defaultRuntime.log(theme.warn(createPostUpdatePluginWarning({ reason: error }).message));
2365
- const updated = pluginUpdateOutcomes.filter((entry) => entry.status === "updated").length;
2366
- const unchanged = pluginUpdateOutcomes.filter((entry) => entry.status === "unchanged").length;
2367
- const failed = pluginUpdateOutcomes.filter((entry) => entry.status === "error").length;
2368
- const skipped = pluginUpdateOutcomes.filter((entry) => entry.status === "skipped").length;
2369
- if (pluginUpdateOutcomes.length === 0) defaultRuntime.log(theme.muted("No plugin updates needed."));
2370
- else {
2371
- const parts = [`${updated} updated`, `${unchanged} unchanged`];
2372
- if (failed > 0) parts.push(`${failed} failed`);
2373
- if (skipped > 0) parts.push(`${skipped} skipped`);
2374
- defaultRuntime.log(theme.muted(`npm plugins: ${parts.join(", ")}.`));
2375
- }
2376
- for (const outcome of pluginUpdateOutcomes) {
2377
- if (outcome.status !== "error") continue;
2378
- defaultRuntime.log(theme.warn(outcome.message));
2379
- }
2380
- return {
2381
- status: convergenceErrored ? "error" : warnings.length > 0 ? "warning" : "ok",
2382
- changed: pluginsChanged,
2383
- warnings,
2384
- sync: {
2385
- changed: syncResult.changed,
2386
- switchedToBundled: syncResult.summary.switchedToBundled,
2387
- switchedToNpm: syncResult.summary.switchedToNpm,
2388
- warnings: syncResult.summary.warnings,
2389
- errors: syncResult.summary.errors
2390
- },
2391
- npm: {
2392
- changed: npmPluginsChanged,
2393
- outcomes: pluginUpdateOutcomes
2394
- },
2395
- integrityDrifts
2396
- };
2397
- }
2398
- async function maybeRestartService(params) {
2399
- const verifyRestartedGateway = async (expectedGatewayVersion) => {
2400
- const restartAfterStaleCleanup = async () => {
2401
- if (params.refreshServiceEnv && isPackageManagerUpdateMode(params.result.mode)) {
2402
- await runUpdatedInstallGatewayRestart({
2403
- result: params.result,
2404
- jsonMode: Boolean(params.opts.json),
2405
- invocationCwd: params.invocationCwd,
2406
- env: params.serviceEnv,
2407
- nodeRunner: params.nodeRunner
2408
- });
2409
- return;
2410
- }
2411
- if (shouldUseLegacyProcessRestartAfterUpdate({ updateMode: params.result.mode })) await runDaemonRestart();
2412
- };
2413
- const service = resolveGatewayService();
2414
- let health = await waitForGatewayHealthyRestart({
2415
- service,
2416
- port: params.gatewayPort,
2417
- expectedVersion: expectedGatewayVersion,
2418
- env: params.serviceEnv
2419
- });
2420
- if (!health.healthy && health.staleGatewayPids.length > 0) {
2421
- if (!params.opts.json) defaultRuntime.log(theme.warn(`Found stale gateway process(es) after restart: ${health.staleGatewayPids.join(", ")}. Cleaning up...`));
2422
- await terminateStaleGatewayPids(health.staleGatewayPids);
2423
- await restartAfterStaleCleanup();
2424
- health = await waitForGatewayHealthyRestart({
2425
- service,
2426
- port: params.gatewayPort,
2427
- expectedVersion: expectedGatewayVersion,
2428
- env: params.serviceEnv
2429
- });
2430
- }
2431
- const recoveryVerification = await recoverLaunchAgentAndRecheckGatewayHealth({
2432
- health,
2433
- service,
2434
- port: params.gatewayPort,
2435
- expectedVersion: expectedGatewayVersion,
2436
- env: params.serviceEnv
2437
- });
2438
- health = recoveryVerification.health;
2439
- const launchAgentRecovery = recoveryVerification.launchAgentRecovery;
2440
- if (launchAgentRecovery?.attempted) if (!params.opts.json) defaultRuntime.log(launchAgentRecovery.recovered ? theme.warn(launchAgentRecovery.message) : theme.warn(launchAgentRecovery.detail));
2441
- else defaultRuntime.error(launchAgentRecovery.recovered ? launchAgentRecovery.message : launchAgentRecovery.detail);
2442
- if (health.healthy) {
2443
- if (!params.opts.json) defaultRuntime.log(theme.success("Gateway: restarted and verified."));
2444
- return true;
2445
- }
2446
- const diagnosticLines = [
2447
- "Gateway did not become healthy after restart.",
2448
- ...renderRestartDiagnostics(health),
2449
- ...launchAgentRecovery?.attempted ? [launchAgentRecovery.recovered ? `LaunchAgent recovery: ${launchAgentRecovery.message}` : `LaunchAgent recovery failed: ${launchAgentRecovery.detail}`] : [],
2450
- `Restart log: ${resolveGatewayRestartLogPath(params.serviceEnv ?? process.env)}`,
2451
- `Run \`${replaceCliName(formatCliCommand("daocore gateway status --deep"), CLI_NAME)}\` for details.`,
2452
- ...formatPostUpdateGatewayRecoveryInstructions(params.result)
2453
- ];
2454
- if (params.opts.json) defaultRuntime.error(diagnosticLines.join("\n"));
2455
- else {
2456
- defaultRuntime.log(theme.warn(diagnosticLines[0] ?? "Gateway did not become healthy."));
2457
- for (const line of diagnosticLines.slice(1)) defaultRuntime.log(theme.muted(line));
2458
- }
2459
- if (isPackageManagerUpdateMode(params.result.mode)) return false;
2460
- return !(health.versionMismatch || health.activatedPluginErrors?.length);
2461
- };
2462
- if (params.shouldRestart) {
2463
- if (!params.opts.json) {
2464
- defaultRuntime.log("");
2465
- defaultRuntime.log(theme.heading("Restarting service..."));
2466
- }
2467
- try {
2468
- const expectedGatewayVersion = isPackageManagerUpdateMode(params.result.mode) ? normalizeOptionalString(params.result.after?.version) : void 0;
2469
- const isPackageUpdate = isPackageManagerUpdateMode(params.result.mode);
2470
- let restarted = false;
2471
- let restartInitiated = false;
2472
- let refreshedGatewayAlreadyHealthy = false;
2473
- if (params.refreshServiceEnv) {
2474
- try {
2475
- await refreshGatewayServiceEnv({
2476
- result: params.result,
2477
- jsonMode: Boolean(params.opts.json),
2478
- invocationCwd: params.invocationCwd,
2479
- env: params.serviceEnv,
2480
- nodeRunner: params.nodeRunner
2481
- });
2482
- } catch (err) {
2483
- const message = `Failed to refresh gateway service environment from updated install: ${String(err)}`;
2484
- if (params.opts.json) defaultRuntime.error(message);
2485
- else defaultRuntime.log(theme.warn(message));
2486
- if (isPackageUpdate) return false;
2487
- }
2488
- if (isPackageUpdate && expectedGatewayVersion) {
2489
- refreshedGatewayAlreadyHealthy = (await waitForGatewayHealthyRestart({
2490
- service: resolveGatewayService(),
2491
- port: params.gatewayPort,
2492
- expectedVersion: expectedGatewayVersion,
2493
- env: params.serviceEnv,
2494
- attempts: POST_REFRESH_ALREADY_HEALTHY_ATTEMPTS,
2495
- delayMs: POST_REFRESH_ALREADY_HEALTHY_DELAY_MS
2496
- })).healthy;
2497
- if (refreshedGatewayAlreadyHealthy && !params.opts.json) defaultRuntime.log(theme.muted("Gateway already reports the updated version after service refresh; skipped redundant restart."));
2498
- }
2499
- }
2500
- if (!refreshedGatewayAlreadyHealthy && params.restartScriptPath) {
2501
- await createUpdateConfigSnapshot();
2502
- await runRestartScript(params.restartScriptPath);
2503
- restartInitiated = true;
2504
- } else if (!refreshedGatewayAlreadyHealthy && params.refreshServiceEnv && isPackageUpdate) {
2505
- await createUpdateConfigSnapshot();
2506
- restarted = await runUpdatedInstallGatewayRestart({
2507
- result: params.result,
2508
- jsonMode: Boolean(params.opts.json),
2509
- invocationCwd: params.invocationCwd,
2510
- env: params.serviceEnv,
2511
- nodeRunner: params.nodeRunner
2512
- });
2513
- } else if (!refreshedGatewayAlreadyHealthy && shouldUseLegacyProcessRestartAfterUpdate({ updateMode: params.result.mode })) {
2514
- await createUpdateConfigSnapshot();
2515
- restarted = await runDaemonRestart();
2516
- } else if (!refreshedGatewayAlreadyHealthy && !params.opts.json) defaultRuntime.log(theme.muted("Gateway: restart skipped (no installed service found)."));
2517
- if (refreshedGatewayAlreadyHealthy || restartInitiated || restarted && expectedGatewayVersion !== void 0) {
2518
- if (!await verifyRestartedGateway(expectedGatewayVersion)) {
2519
- if (!params.opts.json) defaultRuntime.log("");
2520
- return false;
2521
- }
2522
- if (!params.opts.json && restartInitiated) {
2523
- defaultRuntime.log(theme.success("Daemon restart completed."));
2524
- defaultRuntime.log("");
2525
- }
2526
- }
2527
- if (!params.opts.json && restarted) {
2528
- defaultRuntime.log(theme.success("Daemon restarted successfully."));
2529
- defaultRuntime.log("");
2530
- await createUpdateConfigSnapshot();
2531
- process.env.DAOCORE_UPDATE_IN_PROGRESS = "1";
2532
- process.env[UPDATE_PARENT_SUPPORTS_DOCTOR_CONFIG_WRITE_ENV] = "1";
2533
- try {
2534
- await doctorCommand(defaultRuntime, { nonInteractive: !(process.stdin.isTTY && !params.opts.json && params.opts.yes !== true) });
2535
- } catch (err) {
2536
- defaultRuntime.log(theme.warn(`Doctor failed: ${String(err)}`));
2537
- } finally {
2538
- delete process.env.DAOCORE_UPDATE_IN_PROGRESS;
2539
- delete process.env[UPDATE_PARENT_SUPPORTS_DOCTOR_CONFIG_WRITE_ENV];
2540
- }
2541
- }
2542
- } catch (err) {
2543
- if (!params.opts.json) {
2544
- defaultRuntime.log(theme.warn(`Gateway: restart failed: ${String(err)}`));
2545
- defaultRuntime.log(theme.muted(`You may need to restart the service manually: ${replaceCliName(formatCliCommand("daocore gateway restart"), CLI_NAME)}`));
2546
- }
2547
- if (isPackageManagerUpdateMode(params.result.mode)) return false;
2548
- }
2549
- return true;
2550
- }
2551
- if (!params.opts.json) {
2552
- defaultRuntime.log("");
2553
- defaultRuntime.log(theme.muted("Gateway: restart skipped (--no-restart)."));
2554
- if (params.result.mode === "npm" || params.result.mode === "pnpm") defaultRuntime.log(theme.muted(`Tip: Run \`${replaceCliName(formatCliCommand("daocore doctor"), CLI_NAME)}\`, then \`${replaceCliName(formatCliCommand("daocore gateway restart"), CLI_NAME)}\` to apply updates to a running gateway.`));
2555
- else defaultRuntime.log(theme.muted(`Tip: Run \`${replaceCliName(formatCliCommand("daocore gateway restart"), CLI_NAME)}\` to apply updates to a running gateway.`));
2556
- }
2557
- return true;
2558
- }
2559
- async function runPostCorePluginUpdate(params) {
2560
- return await updatePluginsAfterCoreUpdate({
2561
- root: params.root,
2562
- channel: params.channel,
2563
- configSnapshot: params.configSnapshot,
2564
- configChanged: params.configChanged,
2565
- restoredAuthoredChannels: params.restoredAuthoredChannels,
2566
- opts: params.opts,
2567
- timeoutMs: params.timeoutMs,
2568
- pluginInstallRecords: params.pluginInstallRecords
2569
- });
2570
- }
2571
- function withUpdateFinalizationEnv(run) {
2572
- const previousUpdateInProgress = process.env.DAOCORE_UPDATE_IN_PROGRESS;
2573
- const previousDeferConfiguredPluginInstallRepair = process.env[UPDATE_DEFER_CONFIGURED_PLUGIN_INSTALL_REPAIR_ENV];
2574
- const previousParentSupportsDoctorConfigWrite = process.env[UPDATE_PARENT_SUPPORTS_DOCTOR_CONFIG_WRITE_ENV];
2575
- process.env.DAOCORE_UPDATE_IN_PROGRESS = "1";
2576
- process.env[UPDATE_DEFER_CONFIGURED_PLUGIN_INSTALL_REPAIR_ENV] = "1";
2577
- process.env[UPDATE_PARENT_SUPPORTS_DOCTOR_CONFIG_WRITE_ENV] = "1";
2578
- return run().finally(() => {
2579
- if (previousUpdateInProgress === void 0) delete process.env.DAOCORE_UPDATE_IN_PROGRESS;
2580
- else process.env.DAOCORE_UPDATE_IN_PROGRESS = previousUpdateInProgress;
2581
- if (previousDeferConfiguredPluginInstallRepair === void 0) delete process.env[UPDATE_DEFER_CONFIGURED_PLUGIN_INSTALL_REPAIR_ENV];
2582
- else process.env[UPDATE_DEFER_CONFIGURED_PLUGIN_INSTALL_REPAIR_ENV] = previousDeferConfiguredPluginInstallRepair;
2583
- if (previousParentSupportsDoctorConfigWrite === void 0) delete process.env[UPDATE_PARENT_SUPPORTS_DOCTOR_CONFIG_WRITE_ENV];
2584
- else process.env[UPDATE_PARENT_SUPPORTS_DOCTOR_CONFIG_WRITE_ENV] = previousParentSupportsDoctorConfigWrite;
2585
- });
2586
- }
2587
- async function updateFinalizeCommand(opts) {
2588
- suppressDeprecations();
2589
- const timeoutMs = parseTimeoutMsOrExit(opts.timeout);
2590
- if (timeoutMs === null) return;
2591
- assertConfigWriteAllowedInCurrentMode();
2592
- const root = await resolveUpdateRoot();
2593
- let configSnapshot = await readConfigFileSnapshot({ skipPluginValidation: true });
2594
- const preFinalizeConfig = configSnapshot.valid ? {
2595
- sourceConfig: configSnapshot.sourceConfig,
2596
- authoredConfig: isRecord(configSnapshot.parsed) ? configSnapshot.parsed : configSnapshot.sourceConfig
2597
- } : void 0;
2598
- const requestedChannel = normalizeUpdateChannel(opts.channel);
2599
- if (opts.channel && !requestedChannel) {
2600
- defaultRuntime.error(`--channel must be "stable", "beta", or "dev" (got "${opts.channel}")`);
2601
- defaultRuntime.exit(1);
2602
- return;
2603
- }
2604
- const storedChannel = configSnapshot.valid ? normalizeUpdateChannel(configSnapshot.config.update?.channel) : null;
2605
- const channel = requestedChannel ?? storedChannel ?? "stable";
2606
- if (requestedChannel) configSnapshot = await persistRequestedUpdateChannel({
2607
- configSnapshot,
2608
- requestedChannel
2609
- });
2610
- const pluginUpdate = await withUpdateFinalizationEnv(async () => {
2611
- await createUpdateConfigSnapshot();
2612
- await doctorCommand(defaultRuntime, {
2613
- nonInteractive: true,
2614
- repair: true,
2615
- yes: opts.yes === true
2616
- });
2617
- configSnapshot = await readConfigFileSnapshot({ skipPluginValidation: true });
2618
- if (requestedChannel) configSnapshot = await persistRequestedUpdateChannel({
2619
- configSnapshot,
2620
- requestedChannel
2621
- });
2622
- const restoredConfig = restoreDroppedPreUpdateChannels(configSnapshot, preFinalizeConfig);
2623
- configSnapshot = restoredConfig.snapshot;
2624
- const postDoctorStoredChannel = configSnapshot.valid ? normalizeUpdateChannel(configSnapshot.config.update?.channel) : null;
2625
- const postDoctorChannel = requestedChannel ?? postDoctorStoredChannel ?? storedChannel ?? "stable";
2626
- const pluginInstallRecords = await loadInstalledPluginIndexInstallRecords();
2627
- return await runPostCorePluginUpdate({
2628
- root,
2629
- channel: postDoctorChannel,
2630
- configSnapshot,
2631
- configChanged: restoredConfig.changed,
2632
- restoredAuthoredChannels: restoredConfig.authoredChannels,
2633
- opts: {
2634
- json: opts.json,
2635
- timeout: opts.timeout,
2636
- yes: opts.yes,
2637
- restart: false
2638
- },
2639
- timeoutMs: timeoutMs ?? DEFAULT_UPDATE_STEP_TIMEOUT_MS,
2640
- pluginInstallRecords
2641
- });
2642
- });
2643
- const result = {
2644
- status: pluginUpdate.status === "error" ? "error" : pluginUpdate.status === "warning" ? "warning" : "ok",
2645
- mode: "finalize",
2646
- root,
2647
- channel: requestedChannel ?? (configSnapshot.valid ? normalizeUpdateChannel(configSnapshot.config.update?.channel) : null) ?? channel,
2648
- restart: false,
2649
- postUpdate: {
2650
- doctor: { status: "ok" },
2651
- plugins: pluginUpdate
2652
- }
2653
- };
2654
- await tryWriteCompletionCache(root, Boolean(opts.json));
2655
- if (opts.json) defaultRuntime.writeJson(result);
2656
- else if (result.status === "ok") defaultRuntime.log(theme.muted("Update finalization completed."));
2657
- if (result.status === "error") defaultRuntime.exit(1);
2658
- }
2659
- async function persistRequestedUpdateChannel(params) {
2660
- if (!params.requestedChannel || !params.configSnapshot.valid) return params.configSnapshot;
2661
- const storedChannel = normalizeUpdateChannel(params.configSnapshot.config.update?.channel);
2662
- if (params.requestedChannel === storedChannel) return params.configSnapshot;
2663
- const requestedChannel = params.requestedChannel;
2664
- const mutation = await mutateConfigFileWithRetry({
2665
- writeOptions: { skipPluginValidation: true },
2666
- mutate: (draft) => {
2667
- draft.update = {
2668
- ...draft.update,
2669
- channel: requestedChannel
2670
- };
2671
- }
2672
- });
2673
- return createUpdatedConfigSnapshot(mutation.snapshot, mutation.nextConfig);
2674
- }
2675
- function createUpdatedConfigSnapshot(snapshot, next) {
2676
- if (!snapshot.valid) return snapshot;
2677
- return {
2678
- ...snapshot,
2679
- hash: void 0,
2680
- parsed: next,
2681
- sourceConfig: asResolvedSourceConfig(next),
2682
- resolved: asResolvedSourceConfig(next),
2683
- runtimeConfig: asRuntimeConfig(next),
2684
- config: asRuntimeConfig(next)
2685
- };
2686
- }
2687
- async function maybeRepairLegacyConfigForUpdateChannel(params) {
2688
- if (params.configSnapshot.valid || params.configSnapshot.legacyIssues.length === 0) return params.configSnapshot;
2689
- const { repairLegacyConfigForUpdateChannel } = await import("./legacy-config-repair-BVy0AtEa.js");
2690
- const { snapshot, repaired } = await repairLegacyConfigForUpdateChannel(params);
2691
- if (!params.jsonMode && repaired) defaultRuntime.log(theme.muted("Migrated legacy config before changing update channel."));
2692
- return snapshot;
2693
- }
2694
- async function writePostCorePluginUpdateResultFile(filePath, result) {
2695
- if (!filePath) return;
2696
- await writeJson(filePath, result, { trailingNewline: true });
2697
- }
2698
- async function writePostCorePluginInstallRecordsFile(filePath, records) {
2699
- await fs$1.writeFile(filePath, `${JSON.stringify(records)}\n`, "utf-8");
2700
- }
2701
- async function writePostCoreSourceConfigFile(filePath, preUpdateConfig) {
2702
- if (!preUpdateConfig) return;
2703
- await fs$1.writeFile(filePath, `${JSON.stringify(preUpdateConfig)}\n`, "utf-8");
2704
- }
2705
- async function readPostCorePluginInstallRecordsFile(filePath) {
2706
- if (!filePath) return;
2707
- try {
2708
- return normalizePluginInstallRecordMap(JSON.parse(await fs$1.readFile(filePath, "utf-8")));
2709
- } catch {
2710
- return;
2711
- }
2712
- }
2713
- async function readPostCoreSourceConfigFile(filePath, options) {
2714
- if (!filePath) return;
2715
- try {
2716
- const parsed = parseConfigJson5(await fs$1.readFile(filePath, "utf-8"));
2717
- if (!parsed.ok || !isRecord(parsed.parsed)) return;
2718
- return normalizePreUpdateConfigRestoreInput(parsed.parsed, options);
2719
- } catch {
2720
- return;
2721
- }
2722
- }
2723
- function normalizePreUpdateConfigRestoreInput(parsed, options) {
2724
- const sourceConfig = parsed.sourceConfig;
2725
- const authoredConfig = parsed.authoredConfig;
2726
- if (isRecord(sourceConfig) && isRecord(authoredConfig)) return {
2727
- sourceConfig,
2728
- authoredConfig
2729
- };
2730
- const authored = parsed;
2731
- return {
2732
- sourceConfig: options?.configPath ? resolvePreUpdateSourceConfigFromAuthored(authored, options.configPath) : authored,
2733
- authoredConfig: authored
2734
- };
2735
- }
2736
- function resolvePreUpdateSourceConfigFromAuthored(authoredConfig, configPath) {
2737
- try {
2738
- const resolved = resolveConfigEnvVars(resolveConfigIncludes(authoredConfig, configPath, void 0, { allowedRoots: resolveIncludeRoots(process.env) }), process.env, { onMissing: () => void 0 });
2739
- return isRecord(resolved) ? resolved : authoredConfig;
2740
- } catch {
2741
- return authoredConfig;
2742
- }
2743
- }
2744
- async function isFreshPreUpdateConfigSnapshot(params) {
2745
- const snapshotStat = await fs$1.stat(params.snapshotPath).catch(() => null);
2746
- if (!snapshotStat) return false;
2747
- if (params.updateStartedAtMs !== void 0 && snapshotStat.mtimeMs + 1e3 < params.updateStartedAtMs) return false;
2748
- if (Date.now() - snapshotStat.mtimeMs > PRE_UPDATE_CONFIG_SNAPSHOT_MAX_AGE_MS) return false;
2749
- const currentStat = await fs$1.stat(params.currentConfigPath).catch(() => null);
2750
- return !currentStat || snapshotStat.mtimeMs <= currentStat.mtimeMs + 1e3;
2751
- }
2752
- async function execFileStdout(file, args) {
2753
- return await new Promise((resolve) => {
2754
- execFile(file, args, {
2755
- timeout: 1e3,
2756
- windowsHide: true
2757
- }, (error, stdout) => {
2758
- resolve(error ? void 0 : stdout);
2759
- });
2760
- });
2761
- }
2762
- async function readProcessStartTimeMs(pid) {
2763
- if (!Number.isInteger(pid) || pid <= 0) return;
2764
- const raw = process.platform === "win32" ? await execFileStdout("powershell.exe", [
2765
- "-NoProfile",
2766
- "-NonInteractive",
2767
- "-Command",
2768
- `[Console]::Out.Write((Get-Process -Id ${pid}).StartTime.ToUniversalTime().ToString("o"))`
2769
- ]) : await execFileStdout("ps", [
2770
- "-o",
2771
- "lstart=",
2772
- "-p",
2773
- String(pid)
2774
- ]);
2775
- if (!raw) return;
2776
- const parsed = Date.parse(raw.trim().replace(/\s+/g, " "));
2777
- return Number.isFinite(parsed) ? parsed : void 0;
2778
- }
2779
- async function resolvePostCoreUpdateStartedAtMs(env) {
2780
- const fromEnv = Number.parseInt(env[POST_CORE_UPDATE_STARTED_AT_ENV] ?? "", 10);
2781
- if (Number.isFinite(fromEnv) && fromEnv > 0) return fromEnv;
2782
- return await readProcessStartTimeMs(process.ppid);
2783
- }
2784
- async function readPostCorePreUpdateSourceConfig(params) {
2785
- const fromChildEnv = await readPostCoreSourceConfigFile(params.sourceConfigPath);
2786
- if (fromChildEnv) return fromChildEnv;
2787
- if (params.updateStartedAtMs === void 0) return;
2788
- const explicitPreUpdatePath = `${params.currentSnapshot.path}.pre-update`;
2789
- if (await isFreshPreUpdateConfigSnapshot({
2790
- currentConfigPath: params.currentSnapshot.path,
2791
- snapshotPath: explicitPreUpdatePath,
2792
- updateStartedAtMs: params.updateStartedAtMs
2793
- })) {
2794
- const preUpdateConfig = await readPostCoreSourceConfigFile(explicitPreUpdatePath, { configPath: params.currentSnapshot.path });
2795
- if (preUpdateConfig && hasRestorablePreUpdateChannels(params.currentSnapshot, preUpdateConfig)) return preUpdateConfig;
2796
- return;
2797
- }
2798
- const backupPath = `${params.currentSnapshot.path}.bak`;
2799
- if (await isFreshPreUpdateConfigSnapshot({
2800
- currentConfigPath: params.currentSnapshot.path,
2801
- snapshotPath: backupPath,
2802
- updateStartedAtMs: params.updateStartedAtMs
2803
- })) {
2804
- const preUpdateConfig = await readPostCoreSourceConfigFile(backupPath, { configPath: params.currentSnapshot.path });
2805
- if (preUpdateConfig && hasRestorablePreUpdateChannels(params.currentSnapshot, preUpdateConfig)) return preUpdateConfig;
2806
- }
2807
- }
2808
- async function readPostCorePluginUpdateResultFile(filePath) {
2809
- try {
2810
- const parsed = await readJsonIfExists(filePath);
2811
- if (parsed && typeof parsed === "object" && (parsed.status === "ok" || parsed.status === "warning" || parsed.status === "skipped" || parsed.status === "error")) return parsed;
2812
- } catch {
2813
- return;
2814
- }
2815
- }
2816
- function stopPostCoreUpdateChild(child) {
2817
- if (process.platform === "win32" && child.pid) try {
2818
- spawn("taskkill", [
2819
- "/PID",
2820
- String(child.pid),
2821
- "/T",
2822
- "/F"
2823
- ], {
2824
- stdio: "ignore",
2825
- windowsHide: true
2826
- }).once("error", () => {
2827
- child.kill();
2828
- });
2829
- return;
2830
- } catch {
2831
- child.kill();
2832
- return;
2833
- }
2834
- child.kill();
2835
- }
2836
- /**
2837
- * Returns the stdio mode for the post-core-update child process.
2838
- *
2839
- * Windows shells (PowerShell/CMD) wait for all processes that hold inherited console handles to
2840
- * exit before returning the prompt, even after the immediate child has exited. Using "pipe" on
2841
- * Windows prevents the child (and any grandchildren it spawns) from ever receiving a reference to
2842
- * the parent's console handles, eliminating the terminal hang seen in #78445.
2843
- *
2844
- * @internal exported for testing
2845
- */
2846
- function resolvePostCoreUpdateChildStdio(platform = process.platform) {
2847
- return platform === "win32" ? "pipe" : "inherit";
2848
- }
2849
- async function continuePostCoreUpdateInFreshProcess(params) {
2850
- const entryPath = await resolveGatewayInstallEntrypoint(params.root);
2851
- if (!entryPath) return { resumed: false };
2852
- const argv = [entryPath, "update"];
2853
- if (params.opts.json) argv.push("--json");
2854
- if (params.opts.restart === false) argv.push("--no-restart");
2855
- if (params.opts.yes) argv.push("--yes");
2856
- if (params.opts.timeout) argv.push("--timeout", params.opts.timeout);
2857
- const resultDir = await fs$1.mkdtemp(path.join(os.tmpdir(), "daocore-update-post-core-"));
2858
- const resultPath = path.join(resultDir, "plugins.json");
2859
- const installRecordsPath = path.join(resultDir, "plugin-install-records.json");
2860
- const sourceConfigPath = path.join(resultDir, "source-config.json");
2861
- const postCoreHostVersion = await readPackageVersion(params.root);
2862
- try {
2863
- await writePostCorePluginInstallRecordsFile(installRecordsPath, params.pluginInstallRecords);
2864
- await writePostCoreSourceConfigFile(sourceConfigPath, params.preUpdateConfig);
2865
- const childStdio = resolvePostCoreUpdateChildStdio();
2866
- const child = spawn(params.nodeRunner ?? resolveNodeRunner(), argv, {
2867
- stdio: childStdio,
2868
- env: {
2869
- ...stripGatewayServiceMarkerEnv(disableUpdatedPackageCompileCacheEnv(process.env)),
2870
- [POST_CORE_UPDATE_ENV]: "1",
2871
- [POST_CORE_UPDATE_CHANNEL_ENV]: params.channel,
2872
- ...params.requestedChannel ? { [POST_CORE_UPDATE_REQUESTED_CHANNEL_ENV]: params.requestedChannel } : {},
2873
- [POST_CORE_UPDATE_RESULT_PATH_ENV]: resultPath,
2874
- [POST_CORE_UPDATE_INSTALL_RECORDS_PATH_ENV]: installRecordsPath,
2875
- [POST_CORE_UPDATE_STARTED_AT_ENV]: String(params.updateStartedAtMs),
2876
- ...postCoreHostVersion === null ? {} : { DAOCORE_COMPATIBILITY_HOST_VERSION: postCoreHostVersion },
2877
- ...params.preUpdateConfig ? { [POST_CORE_UPDATE_SOURCE_CONFIG_PATH_ENV]: sourceConfigPath } : {}
2878
- }
2879
- });
2880
- if (childStdio === "pipe") {
2881
- child.stdout?.pipe(process.stdout);
2882
- child.stderr?.pipe(process.stderr);
2883
- }
2884
- const childResult = await new Promise((resolve, reject) => {
2885
- let settled = false;
2886
- const finish = (result) => {
2887
- if (settled) return;
2888
- settled = true;
2889
- clearInterval(resultPoll);
2890
- resolve(result);
2891
- };
2892
- const resultPoll = setInterval(() => {
2893
- readPostCorePluginUpdateResultFile(resultPath).then((pluginUpdate) => {
2894
- if (!pluginUpdate) return;
2895
- stopPostCoreUpdateChild(child);
2896
- finish({
2897
- kind: "plugin-update",
2898
- pluginUpdate
2899
- });
2900
- }).catch(() => void 0);
2901
- }, POST_CORE_UPDATE_RESULT_POLL_MS);
2902
- child.once("error", (error) => {
2903
- if (settled) return;
2904
- settled = true;
2905
- clearInterval(resultPoll);
2906
- reject(error);
2907
- });
2908
- child.once("exit", (code, signal) => {
2909
- if (settled) return;
2910
- if (signal) {
2911
- settled = true;
2912
- clearInterval(resultPoll);
2913
- reject(/* @__PURE__ */ new Error(`post-update process terminated by signal ${signal}`));
2914
- return;
2915
- }
2916
- finish({
2917
- kind: "exit",
2918
- exitCode: code ?? 1
2919
- });
2920
- });
2921
- });
2922
- const pluginUpdate = childResult.kind === "plugin-update" ? childResult.pluginUpdate : await readPostCorePluginUpdateResultFile(resultPath);
2923
- const exitCode = childResult.kind === "exit" ? childResult.exitCode : 0;
2924
- if (exitCode !== 0) {
2925
- if (pluginUpdate) return {
2926
- resumed: true,
2927
- pluginUpdate
2928
- };
2929
- defaultRuntime.exit(exitCode);
2930
- throw new Error(`post-update process exited with code ${exitCode}`);
2931
- }
2932
- return {
2933
- resumed: true,
2934
- ...pluginUpdate ? { pluginUpdate } : {}
2935
- };
2936
- } finally {
2937
- await fs$1.rm(resultDir, {
2938
- recursive: true,
2939
- force: true
2940
- }).catch(() => void 0);
2941
- }
2942
- }
2943
- function shouldResumePostCoreUpdateInFreshProcess(params) {
2944
- if (params.downgradeRisk) return false;
2945
- if (isPackageManagerUpdateMode(params.result.mode)) return true;
2946
- if (params.result.mode !== "git") return false;
2947
- const beforeSha = normalizeOptionalString(params.result.before?.sha);
2948
- const afterSha = normalizeOptionalString(params.result.after?.sha);
2949
- if (beforeSha && afterSha && beforeSha !== afterSha) return true;
2950
- const beforeVersion = normalizeOptionalString(params.result.before?.version);
2951
- const afterVersion = normalizeOptionalString(params.result.after?.version);
2952
- return Boolean(beforeVersion && afterVersion && beforeVersion !== afterVersion);
2953
- }
2954
- async function writeControlPlaneUpdateRestartSentinelBestEffort(params) {
2955
- if (!params.meta) return;
2956
- try {
2957
- await writeControlPlaneUpdateRestartSentinel({
2958
- meta: params.meta,
2959
- result: params.result
2960
- });
2961
- } catch (err) {
2962
- const message = `Failed to write update.run restart sentinel: ${String(err)}`;
2963
- if (params.jsonMode) defaultRuntime.error(message);
2964
- else defaultRuntime.log(theme.warn(message));
2965
- }
2966
- }
2967
- async function markControlPlaneUpdateRestartSentinelFailureBestEffort(params) {
2968
- if (!params.meta) return;
2969
- try {
2970
- await markControlPlaneUpdateRestartSentinelFailure(params.reason);
2971
- } catch (err) {
2972
- const message = `Failed to mark update.run restart sentinel failed: ${String(err)}`;
2973
- if (params.jsonMode) defaultRuntime.error(message);
2974
- else defaultRuntime.log(theme.warn(message));
2975
- }
2976
- }
2977
- async function updateCommand(opts) {
2978
- suppressDeprecations();
2979
- await cleanupStaleManagedServiceUpdateHandoffs().catch(() => void 0);
2980
- const invocationCwd = tryResolveInvocationCwd();
2981
- const postCoreUpdateResume = process.env[POST_CORE_UPDATE_ENV] === "1";
2982
- const postCoreUpdateChannel = process.env[POST_CORE_UPDATE_CHANNEL_ENV]?.trim();
2983
- const postCoreRequestedChannelInput = process.env[POST_CORE_UPDATE_REQUESTED_CHANNEL_ENV]?.trim() ?? "";
2984
- const postCoreInstallRecordsPath = process.env[POST_CORE_UPDATE_INSTALL_RECORDS_PATH_ENV];
2985
- const timeoutMs = parseTimeoutMsOrExit(opts.timeout);
2986
- const shouldRestart = opts.restart !== false;
2987
- if (timeoutMs === null) return;
2988
- if (opts.dryRun !== true) {
2989
- await disableCurrentDaoCoreUpdateLaunchdJob().catch(() => void 0);
2990
- assertConfigWriteAllowedInCurrentMode();
2991
- }
2992
- const updateStepTimeoutMs = timeoutMs ?? DEFAULT_UPDATE_STEP_TIMEOUT_MS;
2993
- let root = await resolveUpdateRoot();
2994
- if (postCoreUpdateResume) {
2995
- if (postCoreUpdateChannel !== "stable" && postCoreUpdateChannel !== "beta" && postCoreUpdateChannel !== "dev") {
2996
- defaultRuntime.error("Missing post-core update channel context.");
2997
- defaultRuntime.exit(1);
2998
- return;
2999
- }
3000
- const postCoreRequestedChannel = postCoreRequestedChannelInput ? normalizeUpdateChannel(postCoreRequestedChannelInput) : null;
3001
- if (postCoreRequestedChannelInput && !postCoreRequestedChannel) {
3002
- defaultRuntime.error("Invalid post-core requested update channel context.");
3003
- defaultRuntime.exit(1);
3004
- return;
3005
- }
3006
- process.env.DAOCORE_COMPATIBILITY_HOST_VERSION = await readPackageVersion(root) ?? VERSION;
3007
- let postCoreConfigSnapshot = await readConfigFileSnapshot({ skipPluginValidation: true });
3008
- const preUpdateSourceConfig = await readPostCorePreUpdateSourceConfig({
3009
- sourceConfigPath: process.env[POST_CORE_UPDATE_SOURCE_CONFIG_PATH_ENV],
3010
- currentSnapshot: postCoreConfigSnapshot,
3011
- updateStartedAtMs: await resolvePostCoreUpdateStartedAtMs(process.env)
3012
- });
3013
- postCoreConfigSnapshot = await persistRequestedUpdateChannel({
3014
- configSnapshot: postCoreConfigSnapshot,
3015
- requestedChannel: postCoreRequestedChannel
3016
- });
3017
- const restoredPostCoreConfig = restoreDroppedPreUpdateChannels(postCoreConfigSnapshot, preUpdateSourceConfig);
3018
- const parentPluginInstallRecords = await readPostCorePluginInstallRecordsFile(postCoreInstallRecordsPath);
3019
- const currentPluginInstallRecords = await loadInstalledPluginIndexInstallRecords();
3020
- const pluginInstallRecords = Object.keys(currentPluginInstallRecords).length > 0 ? currentPluginInstallRecords : parentPluginInstallRecords;
3021
- const pluginUpdate = await runPostCorePluginUpdate({
3022
- root,
3023
- channel: postCoreUpdateChannel,
3024
- configSnapshot: restoredPostCoreConfig.snapshot,
3025
- configChanged: restoredPostCoreConfig.changed,
3026
- restoredAuthoredChannels: restoredPostCoreConfig.authoredChannels,
3027
- opts,
3028
- timeoutMs: updateStepTimeoutMs,
3029
- pluginInstallRecords
3030
- });
3031
- if (process.env[POST_CORE_UPDATE_RESULT_PATH_ENV]) await writePostCorePluginUpdateResultFile(process.env[POST_CORE_UPDATE_RESULT_PATH_ENV], pluginUpdate);
3032
- if (opts.json) {
3033
- if (!process.env[POST_CORE_UPDATE_RESULT_PATH_ENV]) {
3034
- const result = {
3035
- status: pluginUpdate.status === "error" ? "error" : "ok",
3036
- mode: "unknown",
3037
- root,
3038
- steps: [],
3039
- durationMs: 0,
3040
- postUpdate: { plugins: pluginUpdate }
3041
- };
3042
- defaultRuntime.writeJson(result);
3043
- }
3044
- }
3045
- defaultRuntime.exit(0);
3046
- return;
3047
- }
3048
- const controlPlaneUpdateSentinelMeta = await readControlPlaneUpdateSentinelMeta();
3049
- const updateStatus = await checkUpdateStatus({
3050
- root,
3051
- timeoutMs: timeoutMs ?? 3500,
3052
- fetchGit: false,
3053
- includeRegistry: false
3054
- });
3055
- const requestedChannel = normalizeUpdateChannel(opts.channel);
3056
- if (opts.channel && !requestedChannel) {
3057
- defaultRuntime.error(`--channel must be "stable", "beta", or "dev" (got "${opts.channel}")`);
3058
- defaultRuntime.exit(1);
3059
- return;
3060
- }
3061
- let configSnapshot = await readConfigFileSnapshot({ skipPluginValidation: true });
3062
- if (opts.channel && !opts.dryRun && !configSnapshot.valid) configSnapshot = await maybeRepairLegacyConfigForUpdateChannel({
3063
- configSnapshot,
3064
- jsonMode: Boolean(opts.json)
3065
- });
3066
- const storedChannel = configSnapshot.valid ? normalizeUpdateChannel(configSnapshot.config.update?.channel) : null;
3067
- if (opts.channel && !configSnapshot.valid) {
3068
- const issues = formatConfigIssueLines(configSnapshot.issues, "-");
3069
- defaultRuntime.error(["Config is invalid; cannot set update channel.", ...issues].join("\n"));
3070
- defaultRuntime.exit(1);
3071
- return;
3072
- }
3073
- const installKind = updateStatus.installKind;
3074
- const switchToGit = requestedChannel === "dev" && installKind !== "git";
3075
- const switchToPackage = requestedChannel !== null && requestedChannel !== "dev" && installKind === "git";
3076
- const updateInstallKind = switchToGit ? "git" : switchToPackage ? "package" : installKind;
3077
- const channel = requestedChannel ?? storedChannel ?? (updateInstallKind === "git" ? "dev" : "stable");
3078
- const devTargetRef = channel === "dev" ? process.env.DAOCORE_UPDATE_DEV_TARGET_REF?.trim() || void 0 : void 0;
3079
- const explicitTag = normalizeTag(opts.tag);
3080
- let tag = explicitTag ?? channelToNpmTag(channel);
3081
- let currentVersion = null;
3082
- let targetVersion = null;
3083
- let downgradeRisk = false;
3084
- let fallbackToLatest = false;
3085
- let packageInstallSpec = null;
3086
- let packageAlreadyCurrent = false;
3087
- let managedServiceRootRedirect = null;
3088
- let managedServiceNodeRunner;
3089
- if (updateInstallKind === "package") {
3090
- managedServiceRootRedirect = await resolveManagedServicePackageUpdateRoot({ root });
3091
- if (managedServiceRootRedirect) {
3092
- root = managedServiceRootRedirect.root;
3093
- managedServiceNodeRunner = managedServiceRootRedirect.nodeRunner;
3094
- if (!opts.json) {
3095
- defaultRuntime.log(theme.muted(`Targeting managed gateway service package root: ${managedServiceRootRedirect.root}`));
3096
- defaultRuntime.log(theme.warn(`Shell DaoCore root differs from the managed gateway service root: ${managedServiceRootRedirect.previousRoot}`));
3097
- defaultRuntime.log(theme.muted(`After the update, make sure \`${CLI_NAME}\` on PATH resolves to the managed service root or reinstall the gateway service from the shell install you want to use.`));
3098
- if (managedServiceNodeRunner) defaultRuntime.log(theme.muted(`Managed gateway service Node: ${managedServiceNodeRunner}`));
3099
- }
3100
- } else {
3101
- managedServiceNodeRunner = await resolveManagedServiceNodeRunnerOverride();
3102
- if (managedServiceNodeRunner && !opts.json) {
3103
- defaultRuntime.log(theme.warn(`Current Node (${resolveNodeRunner()}) differs from the managed gateway service Node (${managedServiceNodeRunner}).`));
3104
- defaultRuntime.log(theme.muted(`Using the managed service Node for this update so the gateway can start after the upgrade.`));
3105
- }
3106
- }
3107
- }
3108
- if (updateInstallKind !== "git") {
3109
- currentVersion = switchToPackage ? null : await readPackageVersion(root);
3110
- if (explicitTag) targetVersion = await resolveTargetVersion(tag, timeoutMs);
3111
- else targetVersion = await resolveNpmChannelTag({
3112
- channel,
3113
- timeoutMs
3114
- }).then((resolved) => {
3115
- tag = resolved.tag;
3116
- fallbackToLatest = channel === "beta" && resolved.tag === "latest";
3117
- return resolved.version;
3118
- });
3119
- const cmp = currentVersion && targetVersion ? compareSemverStrings(currentVersion, targetVersion) : null;
3120
- packageAlreadyCurrent = updateInstallKind === "package" && !switchToPackage && currentVersion != null && targetVersion != null && currentVersion === targetVersion && (requestedChannel === null || requestedChannel === storedChannel);
3121
- downgradeRisk = canResolveRegistryVersionForPackageTarget(tag) && !fallbackToLatest && currentVersion != null && (targetVersion == null || cmp != null && cmp > 0);
3122
- packageInstallSpec = resolveGlobalInstallSpec({
3123
- packageName: DEFAULT_PACKAGE_NAME,
3124
- tag,
3125
- env: process.env
3126
- });
3127
- }
3128
- if (opts.dryRun) {
3129
- let mode = "unknown";
3130
- if (updateInstallKind === "git") mode = "git";
3131
- else if (updateInstallKind === "package") mode = await resolveGlobalManager({
3132
- root,
3133
- installKind,
3134
- timeoutMs: updateStepTimeoutMs
3135
- });
3136
- const actions = [];
3137
- if (requestedChannel && requestedChannel !== storedChannel) actions.push(`Persist update.channel=${requestedChannel} in config`);
3138
- if (switchToGit) actions.push("Switch install mode from package to git checkout (dev channel)");
3139
- else if (switchToPackage) actions.push(`Switch install mode from git to package manager (${mode})`);
3140
- else if (updateInstallKind === "git") actions.push(`Run git update flow on channel ${channel} (fetch/rebase/build/doctor)`);
3141
- else if (packageAlreadyCurrent) actions.push(`Refresh package install with spec ${packageInstallSpec ?? tag}; current version already matches ${targetVersion}`);
3142
- else actions.push(`Run global package manager update with spec ${packageInstallSpec ?? tag}`);
3143
- actions.push("Run plugin update sync after core update");
3144
- actions.push("Refresh shell completion cache (if needed)");
3145
- actions.push(shouldRestart ? "Restart gateway service and run doctor checks" : "Skip restart (because --no-restart is set)");
3146
- const notes = [];
3147
- if (opts.tag && updateInstallKind === "git") notes.push("--tag applies to npm installs only; git updates ignore it.");
3148
- if (fallbackToLatest) notes.push("Beta channel resolves to latest for this run (fallback).");
3149
- if (managedServiceRootRedirect) notes.push(`Package update targets managed service root ${managedServiceRootRedirect.root} instead of invoking root ${managedServiceRootRedirect.previousRoot}.`);
3150
- if (explicitTag && !canResolveRegistryVersionForPackageTarget(tag)) notes.push("Non-registry package specs skip npm version lookup and downgrade previews.");
3151
- printDryRunPreview({
3152
- dryRun: true,
3153
- root,
3154
- installKind,
3155
- mode,
3156
- updateInstallKind,
3157
- switchToGit,
3158
- switchToPackage,
3159
- restart: shouldRestart,
3160
- requestedChannel,
3161
- storedChannel,
3162
- effectiveChannel: channel,
3163
- tag: packageInstallSpec ?? tag,
3164
- currentVersion,
3165
- targetVersion,
3166
- downgradeRisk,
3167
- actions,
3168
- notes
3169
- }, Boolean(opts.json));
3170
- return;
3171
- }
3172
- if (downgradeRisk && !opts.yes) {
3173
- if (!process.stdin.isTTY || opts.json) {
3174
- defaultRuntime.error(["Downgrade confirmation required.", "Downgrading can break configuration. Re-run in a TTY to confirm."].join("\n"));
3175
- defaultRuntime.exit(1);
3176
- return;
3177
- }
3178
- const targetLabel = targetVersion ?? `${tag} (unknown)`;
3179
- const ok = await confirm({
3180
- message: stylePromptMessage(`Downgrading from ${currentVersion} to ${targetLabel} can break configuration. Continue?`),
3181
- initialValue: false
3182
- });
3183
- if (isCancel(ok) || !ok) {
3184
- if (!opts.json) defaultRuntime.log(theme.muted("Update cancelled."));
3185
- defaultRuntime.exit(0);
3186
- return;
3187
- }
3188
- }
3189
- if (updateInstallKind === "git" && opts.tag && !opts.json) defaultRuntime.log(theme.muted("Note: --tag applies to npm installs only; git updates ignore it."));
3190
- if (updateInstallKind === "package") {
3191
- const runtimePreflightError = await resolvePackageRuntimePreflightError({
3192
- tag,
3193
- timeoutMs,
3194
- nodeRunner: managedServiceNodeRunner
3195
- });
3196
- if (runtimePreflightError) {
3197
- defaultRuntime.error(runtimePreflightError);
3198
- defaultRuntime.exit(1);
3199
- return;
3200
- }
3201
- }
3202
- const showProgress = !opts.json && process.stdout.isTTY;
3203
- if (!opts.json) {
3204
- defaultRuntime.log(theme.heading("Updating DaoCore..."));
3205
- defaultRuntime.log("");
3206
- }
3207
- const { progress, stop } = createUpdateProgress(showProgress);
3208
- const startedAt = Date.now();
3209
- const preUpdatePluginInstallRecords = await loadInstalledPluginIndexInstallRecords();
3210
- let prePackageServiceStop;
3211
- if (updateInstallKind === "package") {
3212
- try {
3213
- prePackageServiceStop = await maybeStopManagedServiceBeforePackageUpdate({
3214
- shouldRestart,
3215
- jsonMode: Boolean(opts.json)
3216
- });
3217
- } catch (err) {
3218
- stop();
3219
- defaultRuntime.error(`Failed to stop managed gateway service before update: ${String(err)}`);
3220
- defaultRuntime.exit(1);
3221
- return;
3222
- }
3223
- if (prePackageServiceStop?.blockMessage) {
3224
- stop();
3225
- defaultRuntime.error(prePackageServiceStop.blockMessage);
3226
- defaultRuntime.exit(1);
3227
- return;
3228
- }
3229
- if (shouldBlockPackageUpdateFromGatewayServiceEnv({ prePackageServiceStop })) {
3230
- stop();
3231
- defaultRuntime.error([
3232
- "Package updates cannot run from inside the gateway service process.",
3233
- "That path replaces the active DaoCore dist tree while the live gateway may still lazy-load old chunks.",
3234
- `Run \`${replaceCliName(formatCliCommand("daocore update"), CLI_NAME)}\` from a shell outside the gateway service, or stop the gateway service first and then update.`
3235
- ].join("\n"));
3236
- defaultRuntime.exit(1);
3237
- return;
3238
- }
3239
- }
3240
- let result;
3241
- try {
3242
- result = updateInstallKind === "package" ? await runPackageInstallUpdate({
3243
- root,
3244
- installKind,
3245
- tag,
3246
- timeoutMs: updateStepTimeoutMs,
3247
- startedAt,
3248
- progress,
3249
- jsonMode: Boolean(opts.json),
3250
- managedServiceEnv: prePackageServiceStop?.serviceEnv,
3251
- invocationCwd,
3252
- honorPackageRoot: managedServiceRootRedirect !== null || managedServiceNodeRunner !== void 0,
3253
- nodeRunner: managedServiceNodeRunner
3254
- }) : await runGitUpdate({
3255
- root,
3256
- switchToGit,
3257
- installKind,
3258
- timeoutMs,
3259
- startedAt,
3260
- progress,
3261
- channel,
3262
- tag,
3263
- showProgress,
3264
- opts,
3265
- stop,
3266
- devTargetRef
3267
- });
3268
- } catch (err) {
3269
- stop();
3270
- await maybeRestartServiceAfterFailedPackageUpdate({
3271
- prePackageServiceStop,
3272
- jsonMode: Boolean(opts.json)
3273
- });
3274
- throw err;
3275
- }
3276
- stop();
3277
- if (!opts.json || result.status !== "ok") printResult(result, {
3278
- ...opts,
3279
- hideSteps: showProgress
3280
- });
3281
- if (result.status === "error") {
3282
- await writeControlPlaneUpdateRestartSentinelBestEffort({
3283
- meta: controlPlaneUpdateSentinelMeta,
3284
- result,
3285
- jsonMode: Boolean(opts.json)
3286
- });
3287
- await maybeRestartServiceAfterFailedPackageUpdate({
3288
- prePackageServiceStop,
3289
- jsonMode: Boolean(opts.json)
3290
- });
3291
- defaultRuntime.exit(1);
3292
- return;
3293
- }
3294
- if (result.status === "skipped") {
3295
- await writeControlPlaneUpdateRestartSentinelBestEffort({
3296
- meta: controlPlaneUpdateSentinelMeta,
3297
- result,
3298
- jsonMode: Boolean(opts.json)
3299
- });
3300
- await maybeRestartServiceAfterFailedPackageUpdate({
3301
- prePackageServiceStop,
3302
- jsonMode: Boolean(opts.json)
3303
- });
3304
- if (result.reason === "dirty") {
3305
- defaultRuntime.error(theme.error("Update blocked: local files are edited in this checkout."));
3306
- defaultRuntime.log(theme.warn("Git-based updates need a clean working tree before they can switch commits, fetch, or rebase."));
3307
- defaultRuntime.log(theme.muted("Commit, stash, or discard the local changes, then rerun `daocore update`."));
3308
- }
3309
- if (result.reason === "not-git-install") {
3310
- defaultRuntime.log(theme.warn(`Skipped: this DaoCore install isn't a git checkout, and the package manager couldn't be detected. Update via your package manager, then run \`${replaceCliName(formatCliCommand("daocore doctor"), CLI_NAME)}\` and \`${replaceCliName(formatCliCommand("daocore gateway restart"), CLI_NAME)}\`.`));
3311
- defaultRuntime.log(theme.muted(`Examples: \`${replaceCliName("npm i -g daocore@latest", CLI_NAME)}\` or \`${replaceCliName("pnpm add -g daocore@latest", CLI_NAME)}\``));
3312
- }
3313
- defaultRuntime.exit(0);
3314
- return;
3315
- }
3316
- const shouldResumePostCoreInFreshProcess = shouldResumePostCoreUpdateInFreshProcess({
3317
- result,
3318
- downgradeRisk
3319
- });
3320
- let postUpdateConfigSnapshot = result.status === "ok" && !opts.dryRun ? await readConfigFileSnapshot({ skipPluginValidation: true }) : configSnapshot;
3321
- if (!shouldResumePostCoreInFreshProcess) postUpdateConfigSnapshot = await persistRequestedUpdateChannel({
3322
- configSnapshot: postUpdateConfigSnapshot,
3323
- requestedChannel
3324
- });
3325
- if (requestedChannel && configSnapshot.valid && requestedChannel !== storedChannel && !shouldResumePostCoreInFreshProcess && !opts.json) defaultRuntime.log(theme.muted(`Update channel set to ${requestedChannel}.`));
3326
- else if (requestedChannel && configSnapshot.valid && requestedChannel !== storedChannel && shouldResumePostCoreInFreshProcess && !opts.json) defaultRuntime.log(theme.muted(`Update channel will be set to ${requestedChannel}.`));
3327
- const postUpdateRoot = result.root ?? root;
3328
- let postCorePluginUpdate;
3329
- let pluginsUpdatedInFreshProcess = false;
3330
- if (shouldResumePostCoreInFreshProcess) {
3331
- const freshProcessResult = await continuePostCoreUpdateInFreshProcess({
3332
- root: postUpdateRoot,
3333
- channel,
3334
- requestedChannel,
3335
- opts,
3336
- pluginInstallRecords: preUpdatePluginInstallRecords,
3337
- updateStartedAtMs: startedAt,
3338
- nodeRunner: managedServiceNodeRunner,
3339
- preUpdateConfig: configSnapshot.valid ? {
3340
- sourceConfig: configSnapshot.sourceConfig,
3341
- authoredConfig: isRecord(configSnapshot.parsed) ? configSnapshot.parsed : configSnapshot.sourceConfig
3342
- } : void 0
3343
- });
3344
- pluginsUpdatedInFreshProcess = freshProcessResult.resumed;
3345
- postCorePluginUpdate = freshProcessResult.pluginUpdate;
3346
- }
3347
- if (!pluginsUpdatedInFreshProcess) {
3348
- if (shouldResumePostCoreInFreshProcess) postUpdateConfigSnapshot = await persistRequestedUpdateChannel({
3349
- configSnapshot: postUpdateConfigSnapshot,
3350
- requestedChannel
3351
- });
3352
- const restoredConfig = restoreDroppedPreUpdateChannels(postUpdateConfigSnapshot, configSnapshot.valid ? {
3353
- sourceConfig: configSnapshot.sourceConfig,
3354
- authoredConfig: isRecord(configSnapshot.parsed) ? configSnapshot.parsed : configSnapshot.sourceConfig
3355
- } : void 0);
3356
- postUpdateConfigSnapshot = restoredConfig.snapshot;
3357
- postCorePluginUpdate = await runPostCorePluginUpdate({
3358
- root: postUpdateRoot,
3359
- channel,
3360
- configSnapshot: postUpdateConfigSnapshot,
3361
- configChanged: restoredConfig.changed,
3362
- restoredAuthoredChannels: restoredConfig.authoredChannels,
3363
- opts,
3364
- timeoutMs: updateStepTimeoutMs,
3365
- pluginInstallRecords: preUpdatePluginInstallRecords
3366
- });
3367
- }
3368
- const resultWithPostUpdate = postCorePluginUpdate ? {
3369
- ...result,
3370
- status: postCorePluginUpdate.status === "error" ? "error" : result.status,
3371
- ...postCorePluginUpdate.status === "error" ? { reason: "post-update-plugins" } : {},
3372
- postUpdate: {
3373
- ...result.postUpdate,
3374
- plugins: postCorePluginUpdate
3375
- }
3376
- } : result;
3377
- if (postCorePluginUpdate?.status === "error") {
3378
- await writeControlPlaneUpdateRestartSentinelBestEffort({
3379
- meta: controlPlaneUpdateSentinelMeta,
3380
- result: resultWithPostUpdate,
3381
- jsonMode: Boolean(opts.json)
3382
- });
3383
- if (opts.json) defaultRuntime.writeJson(resultWithPostUpdate);
3384
- else defaultRuntime.error(theme.error("Update failed during plugin post-update sync."));
3385
- defaultRuntime.exit(1);
3386
- return;
3387
- }
3388
- let restartScriptPath = null;
3389
- let refreshGatewayServiceEnv = false;
3390
- let gatewayServiceEnv;
3391
- let gatewayPort = resolveUpdatedGatewayRestartPort({
3392
- config: postUpdateConfigSnapshot.valid ? postUpdateConfigSnapshot.config : void 0,
3393
- processEnv: process.env
3394
- });
3395
- if (shouldRestart) try {
3396
- const serviceState = await readGatewayServiceState(resolveGatewayService(), { env: resolvePostUpdateServiceStateReadEnv({
3397
- updateMode: resultWithPostUpdate.mode,
3398
- processEnv: process.env,
3399
- prePackageServiceEnv: prePackageServiceStop?.serviceEnv
3400
- }) });
3401
- if (shouldPrepareUpdatedInstallRestart({
3402
- updateMode: resultWithPostUpdate.mode,
3403
- serviceInstalled: serviceState.installed,
3404
- serviceLoaded: serviceState.loaded
3405
- })) {
3406
- gatewayServiceEnv = serviceState.env;
3407
- gatewayPort = resolveUpdatedGatewayRestartPort({
3408
- config: postUpdateConfigSnapshot.valid ? postUpdateConfigSnapshot.config : void 0,
3409
- processEnv: process.env,
3410
- serviceEnv: gatewayServiceEnv
3411
- });
3412
- restartScriptPath = await prepareRestartScript(serviceState.env, gatewayPort);
3413
- refreshGatewayServiceEnv = true;
3414
- }
3415
- } catch {}
3416
- await tryWriteCompletionCache(postUpdateRoot, Boolean(opts.json));
3417
- await tryInstallShellCompletion({
3418
- jsonMode: Boolean(opts.json),
3419
- skipPrompt: Boolean(opts.yes)
3420
- });
3421
- await writeControlPlaneUpdateRestartSentinelBestEffort({
3422
- meta: controlPlaneUpdateSentinelMeta,
3423
- result: buildControlPlaneUpdateRestartHealthPendingResult(resultWithPostUpdate),
3424
- jsonMode: Boolean(opts.json)
3425
- });
3426
- if (!await maybeRestartService({
3427
- shouldRestart,
3428
- result: resultWithPostUpdate,
3429
- opts,
3430
- refreshServiceEnv: refreshGatewayServiceEnv,
3431
- serviceEnv: gatewayServiceEnv,
3432
- gatewayPort,
3433
- restartScriptPath,
3434
- invocationCwd,
3435
- nodeRunner: managedServiceNodeRunner
3436
- })) {
3437
- await markControlPlaneUpdateRestartSentinelFailureBestEffort({
3438
- meta: controlPlaneUpdateSentinelMeta,
3439
- reason: "restart-unhealthy",
3440
- jsonMode: Boolean(opts.json)
3441
- });
3442
- defaultRuntime.exit(1);
3443
- return;
3444
- }
3445
- await writeControlPlaneUpdateRestartSentinelBestEffort({
3446
- meta: controlPlaneUpdateSentinelMeta,
3447
- result: resultWithPostUpdate,
3448
- jsonMode: Boolean(opts.json)
3449
- });
3450
- if (!opts.json) defaultRuntime.log(theme.muted(pickUpdateQuip()));
3451
- else defaultRuntime.writeJson(resultWithPostUpdate);
3452
- }
3453
- //#endregion
3454
- //#region src/cli/update-cli/wizard.ts
3455
- async function updateWizardCommand(opts = {}) {
3456
- if (!process.stdin.isTTY) {
3457
- defaultRuntime.error("Update wizard requires a TTY. Use `daocore update --channel <stable|beta|dev>` instead.");
3458
- defaultRuntime.exit(1);
3459
- return;
3460
- }
3461
- const timeoutMs = parseTimeoutMsOrExit(opts.timeout);
3462
- if (timeoutMs === null) return;
3463
- const root = await resolveUpdateRoot();
3464
- const [updateStatus, configSnapshot] = await Promise.all([checkUpdateStatus({
3465
- root,
3466
- timeoutMs: timeoutMs ?? 3500,
3467
- fetchGit: false,
3468
- includeRegistry: false
3469
- }), readConfigFileSnapshot()]);
3470
- const channelInfo = resolveEffectiveUpdateChannel({
3471
- configChannel: configSnapshot.valid ? normalizeUpdateChannel(configSnapshot.config.update?.channel) : null,
3472
- installKind: updateStatus.installKind,
3473
- git: updateStatus.git ? {
3474
- tag: updateStatus.git.tag,
3475
- branch: updateStatus.git.branch
3476
- } : void 0
3477
- });
3478
- const channelLabel = formatUpdateChannelLabel({
3479
- channel: channelInfo.channel,
3480
- source: channelInfo.source,
3481
- gitTag: updateStatus.git?.tag ?? null,
3482
- gitBranch: updateStatus.git?.branch ?? null
3483
- });
3484
- const pickedChannel = await selectStyled({
3485
- message: "Update channel",
3486
- options: [
3487
- {
3488
- value: "keep",
3489
- label: `Keep current (${channelInfo.channel})`,
3490
- hint: channelLabel
3491
- },
3492
- {
3493
- value: "stable",
3494
- label: "Stable",
3495
- hint: "Tagged releases (npm latest)"
3496
- },
3497
- {
3498
- value: "beta",
3499
- label: "Beta",
3500
- hint: "Prereleases (npm beta)"
3501
- },
3502
- {
3503
- value: "dev",
3504
- label: "Dev",
3505
- hint: "Git main"
3506
- }
3507
- ],
3508
- initialValue: "keep"
3509
- });
3510
- if (isCancel(pickedChannel)) {
3511
- defaultRuntime.log(theme.muted("Update cancelled."));
3512
- defaultRuntime.exit(0);
3513
- return;
3514
- }
3515
- const requestedChannel = pickedChannel === "keep" ? null : pickedChannel;
3516
- if (requestedChannel === "dev" && updateStatus.installKind !== "git") {
3517
- const gitDir = resolveGitInstallDir();
3518
- if (!await isGitCheckout(gitDir)) {
3519
- if (await pathExists$1(gitDir)) {
3520
- if (!await isEmptyDir(gitDir)) {
3521
- defaultRuntime.error(`DAOCORE_GIT_DIR points at a non-git directory: ${gitDir}. Set DAOCORE_GIT_DIR to an empty folder or an daocore checkout.`);
3522
- defaultRuntime.exit(1);
3523
- return;
3524
- }
3525
- }
3526
- const ok = await confirm({
3527
- message: stylePromptMessage(`Create a git checkout at ${gitDir}? (override via DAOCORE_GIT_DIR)`),
3528
- initialValue: true
3529
- });
3530
- if (isCancel(ok) || !ok) {
3531
- defaultRuntime.log(theme.muted("Update cancelled."));
3532
- defaultRuntime.exit(0);
3533
- return;
3534
- }
3535
- }
3536
- }
3537
- const restart = await confirm({
3538
- message: stylePromptMessage("Restart the gateway service after update?"),
3539
- initialValue: true
3540
- });
3541
- if (isCancel(restart)) {
3542
- defaultRuntime.log(theme.muted("Update cancelled."));
3543
- defaultRuntime.exit(0);
3544
- return;
3545
- }
3546
- try {
3547
- await updateCommand({
3548
- channel: requestedChannel ?? void 0,
3549
- restart,
3550
- timeout: opts.timeout
3551
- });
3552
- } catch (err) {
3553
- defaultRuntime.error(String(err));
3554
- defaultRuntime.exit(1);
3555
- }
3556
- }
3557
- //#endregion
3558
- //#region src/cli/update-cli.ts
3559
- function inheritedUpdateJson(command) {
3560
- return Boolean(inheritOptionFromParent(command, "json"));
3561
- }
3562
- function inheritedUpdateTimeout(opts, command) {
3563
- const timeout = opts.timeout;
3564
- if (timeout) return timeout;
3565
- return inheritOptionFromParent(command, "timeout");
3566
- }
3567
- function registerUpdateCli(program) {
3568
- program.enablePositionalOptions();
3569
- const update = program.command("update").description("Update DaoCore and inspect update channel status").option("--json", "Output result as JSON", false).option("--no-restart", "Skip restarting the gateway service after a successful update").option("--dry-run", "Preview update actions without making changes", false).option("--channel <stable|beta|dev>", "Persist update channel (git + npm)").option("--tag <dist-tag|version|spec>", "Override the package target for this update (dist-tag, version, or package spec)").option("--timeout <seconds>", "Timeout for each update step in seconds (default: 1800)").option("--yes", "Skip confirmation prompts (non-interactive)", false).addHelpText("after", () => {
3570
- const fmtExamples = [
3571
- ["daocore update", "Update a source checkout (git)"],
3572
- ["daocore update --channel beta", "Switch to beta channel (git + npm)"],
3573
- ["daocore update --channel dev", "Switch to dev channel (git + npm)"],
3574
- ["daocore update --tag beta", "One-off update to a dist-tag or version"],
3575
- ["daocore update --tag main", "One-off package update from GitHub main"],
3576
- ["daocore update --dry-run", "Preview actions without changing anything"],
3577
- ["daocore update --no-restart", "Update without restarting the service"],
3578
- ["daocore update --json", "Output result as JSON"],
3579
- ["daocore update --yes", "Non-interactive (accept downgrade prompts)"],
3580
- ["daocore update wizard", "Interactive update wizard"],
3581
- ["daocore --update", "Shorthand for daocore update"]
3582
- ].map(([cmd, desc]) => ` ${theme.command(cmd)} ${theme.muted(`# ${desc}`)}`).join("\n");
3583
- return `
3584
- ${theme.heading("What this does:")}
3585
- - Git checkouts: fetches, rebases, installs deps, builds, and runs doctor
3586
- - npm installs: updates via detected package manager
3587
-
3588
- ${theme.heading("Switch channels:")}
3589
- - Use --channel stable|beta|dev to persist the update channel in config
3590
- - Run daocore update status to see the active channel and source
3591
- - Use --tag <dist-tag|version|spec> for a one-off package update without persisting
3592
- - Use --tag main for a one-off package update from GitHub main
3593
-
3594
- ${theme.heading("Non-interactive:")}
3595
- - Use --yes to accept downgrade prompts
3596
- - Combine with --channel/--tag/--no-restart/--json/--timeout as needed
3597
- - Use --dry-run to preview actions without writing config/installing/restarting
3598
-
3599
- ${theme.heading("Examples:")}
3600
- ${fmtExamples}
3601
-
3602
- ${theme.heading("Notes:")}
3603
- - Switch channels with --channel stable|beta|dev
3604
- - For global installs: auto-updates via detected package manager when possible (see docs/install/updating.md)
3605
- - Downgrades require confirmation (can break configuration)
3606
- - Skips update if the working directory has uncommitted changes
3607
-
3608
- ${theme.muted("Docs:")} ${formatDocsLink("/cli/update", "docs.openclaw.ai/cli/update")}`;
3609
- }).action(async (opts) => {
3610
- try {
3611
- await updateCommand({
3612
- json: Boolean(opts.json),
3613
- restart: Boolean(opts.restart),
3614
- dryRun: Boolean(opts.dryRun),
3615
- channel: opts.channel,
3616
- tag: opts.tag,
3617
- timeout: opts.timeout,
3618
- yes: Boolean(opts.yes)
3619
- });
3620
- } catch (err) {
3621
- defaultRuntime.error(String(err));
3622
- defaultRuntime.exit(1);
3623
- }
3624
- });
3625
- update.command("finalize", { hidden: true }).description("Run DaoCore update finalization after an external core runtime change").option("--json", "Output result as JSON", false).option("--channel <stable|beta|dev>", "Persist update channel for finalization").option("--timeout <seconds>", "Timeout for update finalization steps in seconds (default: 1800)").option("--yes", "Skip confirmation prompts (non-interactive)", false).option("--no-restart", "Accepted for update command parity; finalization never restarts").action(async (opts, command) => {
3626
- try {
3627
- await updateFinalizeCommand({
3628
- json: Boolean(opts.json) || inheritedUpdateJson(command),
3629
- channel: opts.channel,
3630
- timeout: inheritedUpdateTimeout(opts, command),
3631
- yes: Boolean(opts.yes),
3632
- restart: Boolean(opts.restart)
3633
- });
3634
- } catch (err) {
3635
- defaultRuntime.error(String(err));
3636
- defaultRuntime.exit(1);
3637
- }
3638
- });
3639
- update.command("wizard").description("Interactive update wizard").option("--timeout <seconds>", "Timeout for each update step in seconds (default: 1800)").addHelpText("after", `\n${theme.muted("Docs:")} ${formatDocsLink("/cli/update", "docs.openclaw.ai/cli/update")}\n`).action(async (opts, command) => {
3640
- try {
3641
- await updateWizardCommand({ timeout: inheritedUpdateTimeout(opts, command) });
3642
- } catch (err) {
3643
- defaultRuntime.error(String(err));
3644
- defaultRuntime.exit(1);
3645
- }
3646
- });
3647
- update.command("status").description("Show update channel and version status").option("--json", "Output result as JSON", false).option("--timeout <seconds>", "Timeout for update checks in seconds (default: 3)").addHelpText("after", () => `\n${theme.heading("Examples:")}\n${formatHelpExamples([
3648
- ["daocore update status", "Show channel + version status."],
3649
- ["daocore update status --json", "JSON output."],
3650
- ["daocore update status --timeout 10", "Custom timeout."]
3651
- ])}\n\n${theme.heading("Notes:")}\n${theme.muted("- Shows current update channel (stable/beta/dev) and source")}\n${theme.muted("- Includes git tag/branch/SHA for source checkouts")}\n\n${theme.muted("Docs:")} ${formatDocsLink("/cli/update", "docs.openclaw.ai/cli/update")}`).action(async (opts, command) => {
3652
- try {
3653
- await updateStatusCommand({
3654
- json: Boolean(opts.json) || inheritedUpdateJson(command),
3655
- timeout: inheritedUpdateTimeout(opts, command)
3656
- });
3657
- } catch (err) {
3658
- defaultRuntime.error(String(err));
3659
- defaultRuntime.exit(1);
3660
- }
3661
- });
3662
- }
3663
- //#endregion
3664
- export { registerUpdateCli, updateCommand, updateFinalizeCommand, updateStatusCommand, updateWizardCommand };