@gaodefa/daocore 2026.5.86 → 2026.5.87

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 (1615) hide show
  1. package/dist/abort-DF_NBB7k.js +277 -0
  2. package/dist/abort.runtime-D4MkvEhQ.js +2 -0
  3. package/dist/abort.runtime.js +1 -1
  4. package/dist/account-inspect-BgTcq2xK.js +173 -0
  5. package/dist/accounts-B4A5OwEA.js +119 -0
  6. package/dist/accounts-BkS1Fh-0.js +107 -0
  7. package/dist/accounts-DF7-7Smq.js +107 -0
  8. package/dist/accounts-UL1OgSV7.js +2 -0
  9. package/dist/acp-runtime-Cx2ACvcD.js +26 -0
  10. package/dist/acp-spawn-BGd_lmtE.js +2 -0
  11. package/dist/acp-spawn-BV0aSrgH.js +1275 -0
  12. package/dist/acp-stateful-target-driver-BZXAtm9O.js +89 -0
  13. package/dist/action-kill-CrabJ-6-.js +33 -0
  14. package/dist/action-runtime-BWOfmJe3.js +469 -0
  15. package/dist/action-runtime-api-Fr0Pcsql.js +2 -0
  16. package/dist/action-send-Cpl-x8ro.js +39 -0
  17. package/dist/action-spawn-DceGvU1M.js +47 -0
  18. package/dist/actions-Dx4zHx1-.js +161 -0
  19. package/dist/actions.runtime-CXgc7_sE.js +5 -0
  20. package/dist/agent-6f80KcUH.js +2 -0
  21. package/dist/agent-B2kAd5xV.js +3 -0
  22. package/dist/agent-command-DwGwELK0.js +1367 -0
  23. package/dist/agent-components.runtime-DJYuGMFi.js +10 -0
  24. package/dist/agent-components.runtime.js +1 -1
  25. package/dist/agent-harness-Dya8_zFH.d.ts +146 -0
  26. package/dist/agent-harness-runtime-B18Zw6Rz.d.ts +691 -0
  27. package/dist/agent-harness-runtime-D_wIHJVe.js +180 -0
  28. package/dist/agent-harness-task-runtime-ol_ltjHi.js +140 -0
  29. package/dist/agent-runner-execution-D5wMRx5h.js +1713 -0
  30. package/dist/agent-runner-utils-CLCfaT2K.js +266 -0
  31. package/dist/agent-runner.runtime-Igsb-Us4.js +3455 -0
  32. package/dist/agent-runner.runtime.js +1 -1
  33. package/dist/agent-runtime-tAPmASEK.js +229 -0
  34. package/dist/agent-via-gateway-CmOOhHWf.js +463 -0
  35. package/dist/agents/pi-embedded-runner/tool-split.d.ts +1 -1
  36. package/dist/api-BGUYfA7u.js +639 -0
  37. package/dist/api-Bb3jRMVp.js +3 -0
  38. package/dist/api-CDGKNega.js +6 -0
  39. package/dist/api-D-TLdpx5.js +2 -0
  40. package/dist/api-DXDbFZ7W.js +134 -0
  41. package/dist/api-DYuUdqrI.d.ts +52 -0
  42. package/dist/api-o2EhTZRZ.js +2 -0
  43. package/dist/apply-BWXKR0_1.js +41 -0
  44. package/dist/apply-C3i3NucS.js +54 -0
  45. package/dist/approval-handler.runtime-DhzHxhOa.js +130 -0
  46. package/dist/assistant-SXZqrOD4.js +291 -0
  47. package/dist/attachment-normalize-DobdGk6t.js +225 -0
  48. package/dist/attempt-execution-BOV_h0-N.js +558 -0
  49. package/dist/attempt-execution.runtime-CXlw2E2H.js +3 -0
  50. package/dist/attempt-execution.runtime.js +1 -1
  51. package/dist/attempt-execution.shared-BUNB-ofJ.js +38 -0
  52. package/dist/attempt.prompt-helpers-DfgNBTYi.js +475 -0
  53. package/dist/attempt.tool-run-context-DdadqfC-.js +2094 -0
  54. package/dist/binding-routing-BYWsTgH4.js +113 -0
  55. package/dist/binding-targets-CDxkaXRY.js +121 -0
  56. package/dist/bot-BMJcaPAi.js +7894 -0
  57. package/dist/bot-deps-CNg_Zt2P.js +2 -0
  58. package/dist/bot-deps-FZotnMZO.js +747 -0
  59. package/dist/bot-message-context.runtime-C_OEKOE-.js +7 -0
  60. package/dist/bot-message-context.runtime.js +1 -1
  61. package/dist/bot-message-context.session.runtime-VbbwvU7y.js +12 -0
  62. package/dist/bot-message-context.session.runtime.js +1 -1
  63. package/dist/bot-native-commands.delivery.runtime-CuquGLAx.js +4 -0
  64. package/dist/bot-native-commands.delivery.runtime.js +1 -1
  65. package/dist/bot-native-commands.runtime-DtYCPjvW.js +13 -0
  66. package/dist/bot-native-commands.runtime.js +1 -1
  67. package/dist/bridge-server-B4pS54jd.js +113 -0
  68. package/dist/browser-cli-BHUdFJIS.js +230 -0
  69. package/dist/browser-cli-BWWH1Csp.js +2 -0
  70. package/dist/browser-cli-actions-input-1hfL1q3f.js +473 -0
  71. package/dist/browser-cli-actions-observe-Ctdz-Ocl.js +81 -0
  72. package/dist/browser-cli-debug-D4yOgAhy.js +137 -0
  73. package/dist/browser-cli-inspect-D6c28uLw.js +104 -0
  74. package/dist/browser-cli-manage-DoCDoOsO.js +443 -0
  75. package/dist/browser-cli-resize-Dgb5KdMO.js +26 -0
  76. package/dist/browser-cli-shared-C1LIiQyl.js +50 -0
  77. package/dist/browser-cli-state-CwIDB8-B.js +337 -0
  78. package/dist/browser-control-auth-COjZjE3L.js +2 -0
  79. package/dist/browser-profiles-D085C5gN.js +2 -0
  80. package/dist/browser-runtime-CKIOtwI9.js +384 -0
  81. package/dist/build-DHK6vRrC.js +257 -0
  82. package/dist/build-info.json +3 -3
  83. package/dist/bundled/boot-md/handler.js +2 -2
  84. package/dist/bundled/session-memory/handler.js +1 -1
  85. package/dist/bundled-channel-config-schema-BsHcx3wh.d.ts +3163 -0
  86. package/dist/call-D8ev9OI5.d.ts +43 -0
  87. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  88. package/dist/capability-cli-DRrPaB5q.js +1782 -0
  89. package/dist/channel-29833Q7U.d.ts +8 -0
  90. package/dist/channel-B0gFm2e0.d.ts +49 -0
  91. package/dist/channel-B4huj9Kp.js +362 -0
  92. package/dist/channel-B4wQxeHH.d.ts +14 -0
  93. package/dist/channel-BLs4RYYL.js +1777 -0
  94. package/dist/channel-BS3cqj-Z.d.ts +6 -0
  95. package/dist/channel-BU5YCSFs.d.ts +427 -0
  96. package/dist/channel-BXg8HDz6.d.ts +7 -0
  97. package/dist/channel-B_rnZ7-_.d.ts +26 -0
  98. package/dist/channel-BnSrEvQt.js +238 -0
  99. package/dist/channel-BuEQnzVg.js +1556 -0
  100. package/dist/channel-BvlX4grI.d.ts +106 -0
  101. package/dist/channel-C75uc-F0.d.ts +12 -0
  102. package/dist/channel-CMIcwlip.js +955 -0
  103. package/dist/channel-CTTRs_4Q.js +376 -0
  104. package/dist/channel-Ceh4DhGf.js +808 -0
  105. package/dist/channel-Cg78poCb.d.ts +7 -0
  106. package/dist/channel-CtVWvTxM.d.ts +8 -0
  107. package/dist/channel-CxzIiRo0.js +740 -0
  108. package/dist/channel-D3sCmweW.d.ts +64 -0
  109. package/dist/channel-DBe2Xwn9.js +1249 -0
  110. package/dist/channel-DOB2mltt.js +867 -0
  111. package/dist/channel-DU9qt3dX.js +481 -0
  112. package/dist/channel-DWCzQ-Po.js +562 -0
  113. package/dist/channel-Dha12xQd.js +2126 -0
  114. package/dist/channel-EAYFx_aX.d.ts +47 -0
  115. package/dist/channel-VJIcMa-M.js +508 -0
  116. package/dist/channel-WPOWimOu.js +1134 -0
  117. package/dist/channel-actions.runtime-bqHQHH3X.js +265 -0
  118. package/dist/channel-actions.runtime.js +1 -1
  119. package/dist/channel-core-DsmamxDL.d.ts +6 -0
  120. package/dist/channel-core-m0EI5nTB.js +5 -0
  121. package/dist/channel-entry-contract-DwsX3A32.d.ts +112 -0
  122. package/dist/channel-ez59JAzr.d.ts +114 -0
  123. package/dist/channel-inbound-hFEolyVo.js +80 -0
  124. package/dist/channel-l10cAz1Q.js +1496 -0
  125. package/dist/channel-oeyyvfIC.d.ts +104 -0
  126. package/dist/channel-plugin-runtime-BMtJ1Wgj.js +998 -0
  127. package/dist/channel-plugin-runtime-Cm532MRz.d.ts +7 -0
  128. package/dist/channel-runtime-TLiTFcI9.js +408 -0
  129. package/dist/channel-ryumzsaN.d.ts +28 -0
  130. package/dist/channel-uLv7YV-J.js +653 -0
  131. package/dist/channel-zfDQdZSM.d.ts +8 -0
  132. package/dist/channel.runtime-3Aev2p4z.js +88 -0
  133. package/dist/channel.runtime-BBoj-2rR.js +2528 -0
  134. package/dist/channel.runtime-BHW11124.js +254 -0
  135. package/dist/channel.runtime-BO5IrBIY.js +652 -0
  136. package/dist/channel.runtime-C8L4S2Y3.js +109 -0
  137. package/dist/channel.runtime-D55LFe_S.js +21009 -0
  138. package/dist/channel.runtime-DUVRcCkd.js +1008 -0
  139. package/dist/channel.runtime-eAjrNDCs.js +733 -0
  140. package/dist/channel.runtime-ek9gTQao.js +4 -0
  141. package/dist/channel.setup-BKCOmQ1R.d.ts +6 -0
  142. package/dist/channel.setup-C4kFVZ9n.js +1098 -0
  143. package/dist/channel.setup-CG4h40nr.js +10 -0
  144. package/dist/channel.setup-CIy_GOHl.d.ts +8 -0
  145. package/dist/channel.setup-DLoH7iov.d.ts +7 -0
  146. package/dist/channel.setup-t6GC0j9y.js +343 -0
  147. package/dist/chat-u7qZ4sNv.js +2666 -0
  148. package/dist/chrome-CcpklbxU.js +1503 -0
  149. package/dist/cli/run-main.js +5 -5
  150. package/dist/cli-DfMcB-YB.d.ts +20 -0
  151. package/dist/cli-DuN9_yOX.js +1341 -0
  152. package/dist/cli-backend-C3cY7GNo.d.ts +5 -0
  153. package/dist/cli-backend-Dq6pWbMI.d.ts +5 -0
  154. package/dist/cli-compaction-_t3h1d1Y.js +347 -0
  155. package/dist/cli-metadata-CuQDanWu.js +22 -0
  156. package/dist/cli-runner-BICDg94b.js +2 -0
  157. package/dist/cli-runner-CeaLhAdU.js +540 -0
  158. package/dist/cli-runner.runtime-Ckyx1-nO.js +4 -0
  159. package/dist/cli-runner.runtime-ZsfkXp6T.js +3 -0
  160. package/dist/cli-runner.runtime.js +1 -1
  161. package/dist/cli-shared-CLlJpRmc.d.ts +20 -0
  162. package/dist/cli-startup-metadata.json +8 -8
  163. package/dist/client-UnpX4vLL.js +650 -0
  164. package/dist/client-adapter-DXOFyLda.js +897 -0
  165. package/dist/client-factory-DvI4dWav.js +9 -0
  166. package/dist/command-auth--55vYozU.js +135 -0
  167. package/dist/command-handlers-luOY52Zj.js +1609 -0
  168. package/dist/command-registry-2ZPFOxQD.js +4 -0
  169. package/dist/command-registry-BnlVL4Z5.js +9 -0
  170. package/dist/command-registry-core-CY3_nsXj.js +110 -0
  171. package/dist/command-status.runtime-DlWcbk6f.js +90 -0
  172. package/dist/command-status.runtime.js +1 -1
  173. package/dist/commands-9rlXSaBn.d.ts +113 -0
  174. package/dist/commands-acp-1GcD7q5q.js +74 -0
  175. package/dist/commands-compact.runtime-DO9NBGsY.js +10 -0
  176. package/dist/commands-compact.runtime.js +1 -1
  177. package/dist/commands-handlers.runtime-CS9oLcTy.js +6154 -0
  178. package/dist/commands-handlers.runtime.js +1 -1
  179. package/dist/commands-status-B-VHaYH5.js +3 -0
  180. package/dist/commands-status-CD4lbvZe.js +16 -0
  181. package/dist/commands-status.runtime-B-VHaYH5.js +3 -0
  182. package/dist/commands-status.runtime.js +1 -1
  183. package/dist/commands-subagents-control.runtime-BW2wSGGB.js +2 -0
  184. package/dist/commands-subagents-control.runtime-DayCbQBi.js +3 -0
  185. package/dist/commands-subagents-control.runtime.js +1 -1
  186. package/dist/commands-system-prompt-Bu0-zdQV.js +162 -0
  187. package/dist/commands-system-prompt-DqzUrExG.js +2 -0
  188. package/dist/commands.runtime-Bi618hLG.js +176 -0
  189. package/dist/commands.runtime.js +1 -1
  190. package/dist/commitments/runtime.js +1 -1
  191. package/dist/compact-D6RF2ao-.js +480 -0
  192. package/dist/compact-DOHvJc9C.js +1141 -0
  193. package/dist/compact.runtime-BMV69fdx.js +12 -0
  194. package/dist/compact.runtime.js +1 -1
  195. package/dist/completion-cli-CKorRumh.js +315 -0
  196. package/dist/computer-use-QDwH-PSW.js +367 -0
  197. package/dist/config-D085C5gN.js +2 -0
  198. package/dist/config-kivtFwCd.js +373 -0
  199. package/dist/config-mutations-BEpZ3rYv.js +159 -0
  200. package/dist/config-schema-Bwgooc-v.d.ts +20 -0
  201. package/dist/config-schema-lIvqvlbL.d.ts +34 -0
  202. package/dist/context-engine-host-compat-BXoUGeB_.js +2 -0
  203. package/dist/context-engine-host-compat-CcCmD5o9.js +288 -0
  204. package/dist/context-engine-lifecycle-CwtbthA3.js +1274 -0
  205. package/dist/contracts-testkit-DC7MJzfa.d.ts +145 -0
  206. package/dist/control-auth-wsG-pObJ.js +114 -0
  207. package/dist/control-service-DoSyDuPZ.js +145 -0
  208. package/dist/conversation-binding-runtime-vZQ351Yx.js +4 -0
  209. package/dist/conversation-runtime-DZztdc11.js +31 -0
  210. package/dist/core-CcQCE1PE.js +282 -0
  211. package/dist/core-api-Cn9nxEQY.js +5 -0
  212. package/dist/core-api-DJttT99e.js +2 -0
  213. package/dist/core-loprAG73.d.ts +224 -0
  214. package/dist/crestodian/crestodian.js +1 -1
  215. package/dist/crestodian/rescue-message.js +1 -1
  216. package/dist/crestodian-B77mGOnM.js +55 -0
  217. package/dist/daocore-runtime-B-rzUpKx.d.ts +151 -0
  218. package/dist/daocore-tools-B2AoPxwu.js +11727 -0
  219. package/dist/delivery-DrO-hbmH.js +1002 -0
  220. package/dist/dialogue-xd9pIoHO.js +37 -0
  221. package/dist/dir-fetch-tool-CMJ9Pt6u.js +565 -0
  222. package/dist/dir-list-tool-BrTrO97I.js +100 -0
  223. package/dist/direct-dm-Dbxrg-M8.js +64 -0
  224. package/dist/directive-handling.fast-lane-Cm6q7myY.js +68 -0
  225. package/dist/directive-handling.impl-BW2_4S2v.js +818 -0
  226. package/dist/directive-handling.impl-DkMvyjSy.js +2 -0
  227. package/dist/directive-handling.model-selection-BBc-JgRD.js +122 -0
  228. package/dist/directive-handling.persist.runtime-ByZk594V.js +263 -0
  229. package/dist/directive-handling.persist.runtime.js +1 -1
  230. package/dist/dispatch-acp-transcript.runtime-t6_JeKwA.js +40 -0
  231. package/dist/dispatch-acp-transcript.runtime.js +1 -1
  232. package/dist/dispatch-acp.runtime-yf6pNdiB.js +18 -0
  233. package/dist/dispatch-acp.runtime.js +1 -1
  234. package/dist/dispatch-rpGfQmzk.js +1640 -0
  235. package/dist/doctor-Ce9osVgH.js +6 -0
  236. package/dist/doctor-Dl4rkbw8.js +2 -0
  237. package/dist/doctor-config-flow-IokiMPZL.js +1741 -0
  238. package/dist/doctor-core-checks-DPugZhrT.js +2 -0
  239. package/dist/doctor-core-checks-DTM0dPXV.js +573 -0
  240. package/dist/doctor-health-D9BF5XjZ.js +65 -0
  241. package/dist/doctor-health-contributions-CeAx5c5L.js +696 -0
  242. package/dist/doctor-lint-B3Ya8mmD.js +94 -0
  243. package/dist/doctor-state-integrity-B5aQjl2y.js +1231 -0
  244. package/dist/doctor-update-CGkyLrKv.js +58 -0
  245. package/dist/doctor-update-fix-CQ8qVhBX.js +107 -0
  246. package/dist/dynamic-tools-DZebai0O.js +486 -0
  247. package/dist/embedded-backend-BS79InDg.js +579 -0
  248. package/dist/embedded-gateway-stub.runtime-CsTs2-an.js +12 -0
  249. package/dist/embedded-gateway-stub.runtime.js +1 -1
  250. package/dist/embedding-provider-BKIXHvGl.d.ts +16 -0
  251. package/dist/embedding-provider-ZDZfzTLK.d.ts +65 -0
  252. package/dist/embedding-provider-uqWqn4wW.d.ts +21 -0
  253. package/dist/entry.d.ts +1 -1
  254. package/dist/exec-approvals-DSGilgX_.js +149 -0
  255. package/dist/extensionAPI.js +1 -1
  256. package/dist/extensions/active-memory/index.d.ts +1 -1
  257. package/dist/extensions/active-memory/index.js +1 -1
  258. package/dist/extensions/admin-http-rpc/index.d.ts +1 -1
  259. package/dist/extensions/admin-http-rpc/index.js +1 -1
  260. package/dist/extensions/alibaba/index.d.ts +1 -1
  261. package/dist/extensions/anthropic/api.d.ts +3 -3
  262. package/dist/extensions/anthropic/cli-backend-api.d.ts +2 -2
  263. package/dist/extensions/anthropic/cli-backend.d.ts +1 -1
  264. package/dist/extensions/anthropic/cli-migration.d.ts +1 -1
  265. package/dist/extensions/anthropic/cli-shared.d.ts +1 -1
  266. package/dist/extensions/anthropic/contract-api.d.ts +1 -1
  267. package/dist/extensions/anthropic/index.d.ts +1 -1
  268. package/dist/extensions/anthropic/provider-contract-api.d.ts +1 -1
  269. package/dist/extensions/anthropic/provider-discovery.d.ts +1 -1
  270. package/dist/extensions/anthropic/provider-policy-api.d.ts +1 -1
  271. package/dist/extensions/anthropic/register.runtime.d.ts +1 -1
  272. package/dist/extensions/anthropic/replay-policy.d.ts +1 -1
  273. package/dist/extensions/anthropic/setup-api.d.ts +1 -1
  274. package/dist/extensions/anthropic/stream-wrappers.d.ts +1 -1
  275. package/dist/extensions/anthropic/test-api.d.ts +2 -2
  276. package/dist/extensions/arcee/index.d.ts +1 -1
  277. package/dist/extensions/azure-speech/index.d.ts +1 -1
  278. package/dist/extensions/azure-speech/speech-provider.d.ts +1 -1
  279. package/dist/extensions/bonjour/index.d.ts +1 -1
  280. package/dist/extensions/browser/browser-bridge.js +1 -1
  281. package/dist/extensions/browser/browser-config.js +4 -4
  282. package/dist/extensions/browser/browser-control-auth.js +2 -2
  283. package/dist/extensions/browser/browser-doctor.js +2 -2
  284. package/dist/extensions/browser/browser-maintenance.js +1 -1
  285. package/dist/extensions/browser/browser-profiles.js +2 -2
  286. package/dist/extensions/browser/browser-runtime-api.js +11 -11
  287. package/dist/extensions/browser/cli-metadata.d.ts +1 -1
  288. package/dist/extensions/browser/cli-metadata.js +1 -1
  289. package/dist/extensions/browser/index.d.ts +1 -1
  290. package/dist/extensions/browser/index.js +1 -1
  291. package/dist/extensions/browser/plugin-registration.d.ts +1 -1
  292. package/dist/extensions/browser/plugin-registration.js +1 -1
  293. package/dist/extensions/browser/register.runtime.d.ts +2 -2
  294. package/dist/extensions/browser/register.runtime.js +4 -4
  295. package/dist/extensions/browser/runtime-api.d.ts +3 -3
  296. package/dist/extensions/browser/runtime-api.js +13 -13
  297. package/dist/extensions/browser/setup-api.d.ts +1 -1
  298. package/dist/extensions/byteplus/index.d.ts +1 -1
  299. package/dist/extensions/byteplus/provider-discovery.d.ts +1 -1
  300. package/dist/extensions/canvas/cli-metadata.d.ts +1 -1
  301. package/dist/extensions/canvas/index.d.ts +1 -1
  302. package/dist/extensions/canvas/index.js +1 -1
  303. package/dist/extensions/canvas/runtime-api.d.ts +2 -2
  304. package/dist/extensions/canvas/setup-api.d.ts +1 -1
  305. package/dist/extensions/cerebras/index.d.ts +1 -1
  306. package/dist/extensions/chutes/index.d.ts +1 -1
  307. package/dist/extensions/clickclack/api.d.ts +2 -2
  308. package/dist/extensions/clickclack/api.js +2 -2
  309. package/dist/extensions/clickclack/channel-plugin-api.d.ts +1 -1
  310. package/dist/extensions/clickclack/channel-plugin-api.js +1 -1
  311. package/dist/extensions/clickclack/index.d.ts +2 -2
  312. package/dist/extensions/clickclack/runtime-api.d.ts +2 -2
  313. package/dist/extensions/clickclack/runtime-api.js +2 -2
  314. package/dist/extensions/cloudflare-ai-gateway/index.d.ts +1 -1
  315. package/dist/extensions/cloudflare-ai-gateway/stream-wrappers.d.ts +1 -1
  316. package/dist/extensions/comfy/index.d.ts +1 -1
  317. package/dist/extensions/copilot-proxy/index.d.ts +1 -1
  318. package/dist/extensions/copilot-proxy/runtime-api.d.ts +2 -2
  319. package/dist/extensions/deepgram/index.d.ts +1 -1
  320. package/dist/extensions/deepgram/realtime-transcription-provider.d.ts +1 -1
  321. package/dist/extensions/deepgram/test-api.d.ts +1 -1
  322. package/dist/extensions/deepinfra/api.d.ts +2 -2
  323. package/dist/extensions/deepinfra/embedding-provider.d.ts +1 -1
  324. package/dist/extensions/deepinfra/index.d.ts +1 -1
  325. package/dist/extensions/deepinfra/memory-embedding-adapter.d.ts +1 -1
  326. package/dist/extensions/deepinfra/speech-provider.d.ts +1 -1
  327. package/dist/extensions/deepseek/api.d.ts +1 -1
  328. package/dist/extensions/deepseek/index.d.ts +1 -1
  329. package/dist/extensions/deepseek/provider-discovery.d.ts +1 -1
  330. package/dist/extensions/deepseek/provider-policy-api.d.ts +1 -1
  331. package/dist/extensions/deepseek/stream.d.ts +1 -1
  332. package/dist/extensions/deepseek/thinking.d.ts +1 -1
  333. package/dist/extensions/device-pair/api.d.ts +3 -3
  334. package/dist/extensions/device-pair/api.js +1 -1
  335. package/dist/extensions/device-pair/index.d.ts +1 -1
  336. package/dist/extensions/device-pair/notify.d.ts +1 -1
  337. package/dist/extensions/device-pair/pair-command-approve.js +1 -1
  338. package/dist/extensions/document-extract/index.d.ts +1 -1
  339. package/dist/extensions/duckduckgo/index.d.ts +1 -1
  340. package/dist/extensions/elevenlabs/index.d.ts +1 -1
  341. package/dist/extensions/elevenlabs/realtime-transcription-provider.d.ts +1 -1
  342. package/dist/extensions/elevenlabs/setup-api.d.ts +1 -1
  343. package/dist/extensions/elevenlabs/speech-provider.d.ts +1 -1
  344. package/dist/extensions/elevenlabs/test-api.d.ts +2 -2
  345. package/dist/extensions/exa/index.d.ts +1 -1
  346. package/dist/extensions/fal/index.d.ts +1 -1
  347. package/dist/extensions/fal/provider-contract-api.d.ts +1 -1
  348. package/dist/extensions/fal/provider-registration.d.ts +1 -1
  349. package/dist/extensions/file-transfer/index.d.ts +1 -1
  350. package/dist/extensions/file-transfer/index.js +4 -4
  351. package/dist/extensions/firecrawl/index.d.ts +1 -1
  352. package/dist/extensions/fireworks/index.d.ts +1 -1
  353. package/dist/extensions/fireworks/provider-policy-api.d.ts +1 -1
  354. package/dist/extensions/fireworks/stream.d.ts +1 -1
  355. package/dist/extensions/fireworks/thinking-policy.d.ts +1 -1
  356. package/dist/extensions/github-copilot/embeddings.d.ts +1 -1
  357. package/dist/extensions/github-copilot/index.d.ts +1 -1
  358. package/dist/extensions/github-copilot/models.d.ts +1 -1
  359. package/dist/extensions/github-copilot/register.runtime.d.ts +2 -2
  360. package/dist/extensions/github-copilot/stream.d.ts +1 -1
  361. package/dist/extensions/google/api.d.ts +5 -5
  362. package/dist/extensions/google/cli-backend.d.ts +1 -1
  363. package/dist/extensions/google/embedding-batch.d.ts +1 -1
  364. package/dist/extensions/google/embedding-provider.d.ts +1 -1
  365. package/dist/extensions/google/gemini-cli-provider.d.ts +1 -1
  366. package/dist/extensions/google/index.d.ts +1 -1
  367. package/dist/extensions/google/memory-embedding-adapter.d.ts +1 -1
  368. package/dist/extensions/google/provider-contract-api.d.ts +1 -1
  369. package/dist/extensions/google/provider-hooks.d.ts +2 -2
  370. package/dist/extensions/google/provider-models.d.ts +1 -1
  371. package/dist/extensions/google/provider-policy-api.d.ts +1 -1
  372. package/dist/extensions/google/provider-policy.d.ts +1 -1
  373. package/dist/extensions/google/provider-registration.d.ts +1 -1
  374. package/dist/extensions/google/realtime-voice-provider.d.ts +1 -1
  375. package/dist/extensions/google/runtime-api.d.ts +3 -3
  376. package/dist/extensions/google/setup-api.d.ts +1 -1
  377. package/dist/extensions/google/speech-provider.d.ts +1 -1
  378. package/dist/extensions/google/test-api.d.ts +2 -2
  379. package/dist/extensions/google/thinking-api.d.ts +1 -1
  380. package/dist/extensions/google/thinking.d.ts +1 -1
  381. package/dist/extensions/google/transport-stream.d.ts +1 -1
  382. package/dist/extensions/gradium/index.d.ts +1 -1
  383. package/dist/extensions/gradium/speech-provider.d.ts +1 -1
  384. package/dist/extensions/groq/index.d.ts +1 -1
  385. package/dist/extensions/huggingface/index.d.ts +1 -1
  386. package/dist/extensions/image-generation-core/api.d.ts +3 -3
  387. package/dist/extensions/image-generation-core/runtime-api.d.ts +1 -1
  388. package/dist/extensions/imessage/api.d.ts +2 -2
  389. package/dist/extensions/imessage/api.js +2 -2
  390. package/dist/extensions/imessage/channel-plugin-api.d.ts +1 -1
  391. package/dist/extensions/imessage/channel-plugin-api.js +1 -1
  392. package/dist/extensions/imessage/index.d.ts +2 -2
  393. package/dist/extensions/imessage/message-tool-api.d.ts +1 -1
  394. package/dist/extensions/imessage/runtime-api.d.ts +4 -4
  395. package/dist/extensions/imessage/runtime-api.js +3 -3
  396. package/dist/extensions/imessage/setup-entry.d.ts +2 -2
  397. package/dist/extensions/imessage/test-api.d.ts +1 -1
  398. package/dist/extensions/inworld/index.d.ts +1 -1
  399. package/dist/extensions/inworld/speech-provider.d.ts +1 -1
  400. package/dist/extensions/irc/api.d.ts +1 -1
  401. package/dist/extensions/irc/api.js +2 -2
  402. package/dist/extensions/irc/channel-plugin-api.d.ts +1 -1
  403. package/dist/extensions/irc/channel-plugin-api.js +1 -1
  404. package/dist/extensions/irc/index.d.ts +2 -2
  405. package/dist/extensions/irc/setup-entry.d.ts +2 -2
  406. package/dist/extensions/kilocode/index.d.ts +1 -1
  407. package/dist/extensions/kimi-coding/index.d.ts +1 -1
  408. package/dist/extensions/kimi-coding/stream.d.ts +1 -1
  409. package/dist/extensions/litellm/index.d.ts +1 -1
  410. package/dist/extensions/llm-task/api.d.ts +2 -2
  411. package/dist/extensions/llm-task/index.d.ts +1 -1
  412. package/dist/extensions/llm-task/index.js +1 -1
  413. package/dist/extensions/lmstudio/api.d.ts +1 -1
  414. package/dist/extensions/lmstudio/index.d.ts +1 -1
  415. package/dist/extensions/lmstudio/memory-embedding-adapter.d.ts +1 -1
  416. package/dist/extensions/mattermost/api.js +1 -1
  417. package/dist/extensions/mattermost/channel-plugin-api.d.ts +2 -2
  418. package/dist/extensions/mattermost/channel-plugin-api.js +1 -1
  419. package/dist/extensions/mattermost/channel-plugin-runtime.d.ts +1 -1
  420. package/dist/extensions/mattermost/channel-plugin-runtime.js +1 -1
  421. package/dist/extensions/mattermost/index.d.ts +2 -2
  422. package/dist/extensions/mattermost/policy-api.js +1 -1
  423. package/dist/extensions/mattermost/runtime-api.d.ts +4 -4
  424. package/dist/extensions/mattermost/runtime-api.js +2 -2
  425. package/dist/extensions/mattermost/setup-entry.d.ts +2 -2
  426. package/dist/extensions/mattermost/slash-route-api.d.ts +1 -1
  427. package/dist/extensions/mattermost/slash-route-api.js +1 -1
  428. package/dist/extensions/memory-core/api.d.ts +1 -1
  429. package/dist/extensions/memory-core/cli-metadata.d.ts +1 -1
  430. package/dist/extensions/memory-core/cli-metadata.js +1 -1
  431. package/dist/extensions/memory-core/index.d.ts +1 -1
  432. package/dist/extensions/memory-core/manager-runtime.d.ts +1 -1
  433. package/dist/extensions/memory-core/runtime-api.d.ts +2 -2
  434. package/dist/extensions/memory-wiki/api.d.ts +3 -3
  435. package/dist/extensions/memory-wiki/cli-metadata.d.ts +1 -1
  436. package/dist/extensions/memory-wiki/index.d.ts +1 -1
  437. package/dist/extensions/memory-wiki/setup-api.d.ts +1 -1
  438. package/dist/extensions/microsoft/index.d.ts +1 -1
  439. package/dist/extensions/microsoft/speech-provider.d.ts +1 -1
  440. package/dist/extensions/microsoft/test-api.d.ts +1 -1
  441. package/dist/extensions/microsoft-foundry/auth.d.ts +1 -1
  442. package/dist/extensions/microsoft-foundry/cli.d.ts +1 -1
  443. package/dist/extensions/microsoft-foundry/index.d.ts +1 -1
  444. package/dist/extensions/microsoft-foundry/onboard.d.ts +3 -3
  445. package/dist/extensions/microsoft-foundry/provider.d.ts +1 -1
  446. package/dist/extensions/microsoft-foundry/runtime.d.ts +1 -1
  447. package/dist/extensions/microsoft-foundry/shared-runtime.d.ts +1 -1
  448. package/dist/extensions/microsoft-foundry/shared.d.ts +1 -1
  449. package/dist/extensions/migrate-claude/apply.d.ts +1 -1
  450. package/dist/extensions/migrate-claude/apply.js +1 -1
  451. package/dist/extensions/migrate-claude/config.d.ts +1 -1
  452. package/dist/extensions/migrate-claude/helpers.d.ts +1 -1
  453. package/dist/extensions/migrate-claude/index.d.ts +1 -1
  454. package/dist/extensions/migrate-claude/index.js +1 -1
  455. package/dist/extensions/migrate-claude/memory.d.ts +2 -2
  456. package/dist/extensions/migrate-claude/plan.d.ts +1 -1
  457. package/dist/extensions/migrate-claude/plan.js +1 -1
  458. package/dist/extensions/migrate-claude/provider.d.ts +1 -1
  459. package/dist/extensions/migrate-claude/provider.js +1 -1
  460. package/dist/extensions/migrate-claude/skills.d.ts +2 -2
  461. package/dist/extensions/migrate-claude/targets.d.ts +1 -1
  462. package/dist/extensions/migrate-claude/targets.js +1 -1
  463. package/dist/extensions/migrate-hermes/apply.d.ts +1 -1
  464. package/dist/extensions/migrate-hermes/apply.js +1 -1
  465. package/dist/extensions/migrate-hermes/config.d.ts +1 -1
  466. package/dist/extensions/migrate-hermes/helpers.d.ts +1 -1
  467. package/dist/extensions/migrate-hermes/index.d.ts +1 -1
  468. package/dist/extensions/migrate-hermes/index.js +1 -1
  469. package/dist/extensions/migrate-hermes/items.d.ts +1 -1
  470. package/dist/extensions/migrate-hermes/model.d.ts +1 -1
  471. package/dist/extensions/migrate-hermes/model.js +1 -1
  472. package/dist/extensions/migrate-hermes/plan.d.ts +1 -1
  473. package/dist/extensions/migrate-hermes/plan.js +1 -1
  474. package/dist/extensions/migrate-hermes/provider.d.ts +1 -1
  475. package/dist/extensions/migrate-hermes/provider.js +1 -1
  476. package/dist/extensions/migrate-hermes/secrets.d.ts +2 -2
  477. package/dist/extensions/migrate-hermes/secrets.js +1 -1
  478. package/dist/extensions/migrate-hermes/skills.d.ts +2 -2
  479. package/dist/extensions/migrate-hermes/targets.d.ts +1 -1
  480. package/dist/extensions/migrate-hermes/targets.js +1 -1
  481. package/dist/extensions/minimax/index.d.ts +1 -1
  482. package/dist/extensions/minimax/provider-contract-api.d.ts +1 -1
  483. package/dist/extensions/minimax/provider-registration.d.ts +1 -1
  484. package/dist/extensions/minimax/speech-provider.d.ts +1 -1
  485. package/dist/extensions/mistral/embedding-provider.d.ts +1 -1
  486. package/dist/extensions/mistral/index.d.ts +1 -1
  487. package/dist/extensions/mistral/memory-embedding-adapter.d.ts +1 -1
  488. package/dist/extensions/mistral/realtime-transcription-provider.d.ts +1 -1
  489. package/dist/extensions/mistral/test-api.d.ts +1 -1
  490. package/dist/extensions/moonshot/index.d.ts +1 -1
  491. package/dist/extensions/moonshot/provider-contract-api.d.ts +1 -1
  492. package/dist/extensions/moonshot/provider-discovery.d.ts +1 -1
  493. package/dist/extensions/nvidia/index.d.ts +1 -1
  494. package/dist/extensions/oc-path/cli-metadata.d.ts +1 -1
  495. package/dist/extensions/oc-path/cli-registration.d.ts +1 -1
  496. package/dist/extensions/oc-path/index.d.ts +1 -1
  497. package/dist/extensions/ollama/api.d.ts +1 -1
  498. package/dist/extensions/ollama/index.d.ts +1 -1
  499. package/dist/extensions/ollama/provider-discovery.d.ts +1 -1
  500. package/dist/extensions/ollama/provider-policy-api.d.ts +1 -1
  501. package/dist/extensions/ollama/runtime-api.d.ts +1 -1
  502. package/dist/extensions/open-prose/index.d.ts +1 -1
  503. package/dist/extensions/open-prose/runtime-api.d.ts +2 -2
  504. package/dist/extensions/openai/api.d.ts +4 -4
  505. package/dist/extensions/openai/embedding-batch.d.ts +1 -1
  506. package/dist/extensions/openai/embedding-provider.d.ts +1 -1
  507. package/dist/extensions/openai/index.d.ts +1 -1
  508. package/dist/extensions/openai/memory-embedding-adapter.d.ts +1 -1
  509. package/dist/extensions/openai/openai-codex-oauth.runtime.d.ts +1 -1
  510. package/dist/extensions/openai/openai-codex-provider.d.ts +1 -1
  511. package/dist/extensions/openai/openai-provider.d.ts +1 -1
  512. package/dist/extensions/openai/prompt-overlay.d.ts +1 -1
  513. package/dist/extensions/openai/provider-contract-api.d.ts +1 -1
  514. package/dist/extensions/openai/provider-policy-api.d.ts +1 -1
  515. package/dist/extensions/openai/realtime-transcription-provider.d.ts +1 -1
  516. package/dist/extensions/openai/realtime-voice-provider.d.ts +1 -1
  517. package/dist/extensions/openai/register.runtime.d.ts +6 -6
  518. package/dist/extensions/openai/replay-policy.d.ts +1 -1
  519. package/dist/extensions/openai/setup-api.d.ts +1 -1
  520. package/dist/extensions/openai/shared.d.ts +3 -3
  521. package/dist/extensions/openai/speech-provider.d.ts +1 -1
  522. package/dist/extensions/openai/test-api.d.ts +3 -3
  523. package/dist/extensions/openai/thinking-policy.d.ts +1 -1
  524. package/dist/extensions/openai/transport-policy.d.ts +1 -1
  525. package/dist/extensions/opencode/index.d.ts +1 -1
  526. package/dist/extensions/opencode/provider-policy-api.d.ts +1 -1
  527. package/dist/extensions/opencode-go/index.d.ts +1 -1
  528. package/dist/extensions/opencode-go/provider-catalog.d.ts +1 -1
  529. package/dist/extensions/opencode-go/stream.d.ts +1 -1
  530. package/dist/extensions/openrouter/api.d.ts +1 -1
  531. package/dist/extensions/openrouter/index.d.ts +1 -1
  532. package/dist/extensions/openrouter/provider-contract-api.d.ts +1 -1
  533. package/dist/extensions/openrouter/provider-policy-api.d.ts +1 -1
  534. package/dist/extensions/openrouter/speech-provider.d.ts +1 -1
  535. package/dist/extensions/openrouter/stream.d.ts +1 -1
  536. package/dist/extensions/openrouter/test-api.d.ts +1 -1
  537. package/dist/extensions/openrouter/thinking-policy.d.ts +1 -1
  538. package/dist/extensions/openrouter/video-generation-provider.d.ts +1 -1
  539. package/dist/extensions/openrouter/video-model-catalog.d.ts +1 -1
  540. package/dist/extensions/perplexity/index.d.ts +1 -1
  541. package/dist/extensions/phone-control/index.d.ts +1 -1
  542. package/dist/extensions/phone-control/runtime-api.d.ts +2 -2
  543. package/dist/extensions/policy/api.js +1 -1
  544. package/dist/extensions/policy/index.d.ts +1 -1
  545. package/dist/extensions/policy/index.js +2 -2
  546. package/dist/extensions/qianfan/index.d.ts +1 -1
  547. package/dist/extensions/qwen/api.d.ts +1 -1
  548. package/dist/extensions/qwen/index.d.ts +1 -1
  549. package/dist/extensions/qwen/stream.d.ts +1 -1
  550. package/dist/extensions/qwen-dashscope/index.d.ts +1 -1
  551. package/dist/extensions/runway/index.d.ts +1 -1
  552. package/dist/extensions/searxng/index.d.ts +1 -1
  553. package/dist/extensions/senseaudio/index.d.ts +1 -1
  554. package/dist/extensions/sglang/index.d.ts +1 -1
  555. package/dist/extensions/signal/api.d.ts +2 -2
  556. package/dist/extensions/signal/api.js +6 -6
  557. package/dist/extensions/signal/channel-entry.d.ts +2 -2
  558. package/dist/extensions/signal/channel-plugin-api.d.ts +1 -1
  559. package/dist/extensions/signal/channel-plugin-api.js +1 -1
  560. package/dist/extensions/signal/index.d.ts +2 -2
  561. package/dist/extensions/signal/reaction-runtime-api.js +1 -1
  562. package/dist/extensions/signal/runtime-api.d.ts +6 -6
  563. package/dist/extensions/signal/runtime-api.js +7 -7
  564. package/dist/extensions/signal/setup-entry.d.ts +2 -2
  565. package/dist/extensions/skill-workshop/api.d.ts +2 -2
  566. package/dist/extensions/skill-workshop/api.js +1 -1
  567. package/dist/extensions/skill-workshop/index.d.ts +1 -1
  568. package/dist/extensions/skill-workshop/index.js +2 -2
  569. package/dist/extensions/speech-core/api.d.ts +3 -3
  570. package/dist/extensions/speech-core/runtime-api.d.ts +2 -2
  571. package/dist/extensions/stepfun/index.d.ts +1 -1
  572. package/dist/extensions/synthetic/index.d.ts +1 -1
  573. package/dist/extensions/talk-voice/api.d.ts +2 -2
  574. package/dist/extensions/talk-voice/index.d.ts +1 -1
  575. package/dist/extensions/tavily/index.d.ts +1 -1
  576. package/dist/extensions/telegram/account-inspect-api.js +1 -1
  577. package/dist/extensions/telegram/api.d.ts +4 -4
  578. package/dist/extensions/telegram/api.js +11 -11
  579. package/dist/extensions/telegram/channel-plugin-api.d.ts +2 -2
  580. package/dist/extensions/telegram/channel-plugin-api.js +2 -2
  581. package/dist/extensions/telegram/contract-api.d.ts +1 -1
  582. package/dist/extensions/telegram/contract-api.js +3 -3
  583. package/dist/extensions/telegram/index.d.ts +2 -2
  584. package/dist/extensions/telegram/runtime-api.d.ts +5 -5
  585. package/dist/extensions/telegram/runtime-api.js +7 -7
  586. package/dist/extensions/telegram/security-audit-contract-api.js +1 -1
  587. package/dist/extensions/telegram/setup-entry.d.ts +2 -2
  588. package/dist/extensions/telegram/setup-plugin-api.d.ts +1 -1
  589. package/dist/extensions/telegram/setup-plugin-api.js +1 -1
  590. package/dist/extensions/telegram/test-api.js +2 -2
  591. package/dist/extensions/tencent/index.d.ts +1 -1
  592. package/dist/extensions/tencent/provider-discovery.d.ts +1 -1
  593. package/dist/extensions/thread-ownership/api.d.ts +2 -2
  594. package/dist/extensions/thread-ownership/index.d.ts +1 -1
  595. package/dist/extensions/together/index.d.ts +1 -1
  596. package/dist/extensions/tokenjuice/index.d.ts +1 -1
  597. package/dist/extensions/tokenjuice/tool-result-middleware.d.ts +1 -1
  598. package/dist/extensions/tts-local-cli/index.d.ts +1 -1
  599. package/dist/extensions/tts-local-cli/speech-provider.d.ts +1 -1
  600. package/dist/extensions/venice/index.d.ts +1 -1
  601. package/dist/extensions/venice/stream.d.ts +1 -1
  602. package/dist/extensions/vercel-ai-gateway/index.d.ts +1 -1
  603. package/dist/extensions/vercel-ai-gateway/thinking.d.ts +1 -1
  604. package/dist/extensions/video-generation-core/api.d.ts +2 -2
  605. package/dist/extensions/video-generation-core/runtime-api.d.ts +1 -1
  606. package/dist/extensions/vllm/api.d.ts +1 -1
  607. package/dist/extensions/vllm/index.d.ts +1 -1
  608. package/dist/extensions/vllm/stream.d.ts +1 -1
  609. package/dist/extensions/volcengine/index.d.ts +1 -1
  610. package/dist/extensions/volcengine/provider-discovery.d.ts +1 -1
  611. package/dist/extensions/volcengine/speech-provider.d.ts +1 -1
  612. package/dist/extensions/voyage/embedding-batch.d.ts +1 -1
  613. package/dist/extensions/voyage/embedding-provider.d.ts +1 -1
  614. package/dist/extensions/voyage/index.d.ts +1 -1
  615. package/dist/extensions/voyage/memory-embedding-adapter.d.ts +1 -1
  616. package/dist/extensions/vydra/index.d.ts +1 -1
  617. package/dist/extensions/vydra/speech-provider.d.ts +1 -1
  618. package/dist/extensions/web-readability/index.d.ts +1 -1
  619. package/dist/extensions/webhooks/api.d.ts +2 -2
  620. package/dist/extensions/webhooks/api.js +1 -1
  621. package/dist/extensions/webhooks/index.d.ts +1 -1
  622. package/dist/extensions/webhooks/index.js +1 -1
  623. package/dist/extensions/webhooks/runtime-api.d.ts +1 -1
  624. package/dist/extensions/xai/api.d.ts +1 -1
  625. package/dist/extensions/xai/index.d.ts +1 -1
  626. package/dist/extensions/xai/index.js +4 -4
  627. package/dist/extensions/xai/provider-contract-api.d.ts +1 -1
  628. package/dist/extensions/xai/provider-discovery.d.ts +1 -1
  629. package/dist/extensions/xai/provider-models.d.ts +1 -1
  630. package/dist/extensions/xai/provider-policy-api.d.ts +1 -1
  631. package/dist/extensions/xai/realtime-transcription-provider.d.ts +1 -1
  632. package/dist/extensions/xai/realtime-transcription-provider.js +1 -1
  633. package/dist/extensions/xai/setup-api.d.ts +1 -1
  634. package/dist/extensions/xai/speech-provider.d.ts +1 -1
  635. package/dist/extensions/xai/speech-provider.js +1 -1
  636. package/dist/extensions/xai/stream.d.ts +1 -1
  637. package/dist/extensions/xai/test-api.js +1 -1
  638. package/dist/extensions/xai/tts.js +1 -1
  639. package/dist/extensions/xai/web-search.js +1 -1
  640. package/dist/extensions/xai/xai-oauth.d.ts +1 -1
  641. package/dist/extensions/xai/xai-oauth.js +1 -1
  642. package/dist/extensions/xiaomi/index.d.ts +1 -1
  643. package/dist/extensions/xiaomi/speech-provider.d.ts +1 -1
  644. package/dist/extensions/xiaomi/stream.d.ts +1 -1
  645. package/dist/extensions/xiaomi/thinking.d.ts +1 -1
  646. package/dist/extensions/zai/index.d.ts +1 -1
  647. package/dist/file-fetch-tool-QFQ7QZQ9.js +124 -0
  648. package/dist/file-write-tool-znIJ5MOE.js +127 -0
  649. package/dist/format-B3nq4sfa.js +1145 -0
  650. package/dist/gateway/protocol/index.d.ts +1 -1
  651. package/dist/gateway-cli-D5nQafQi.js +435 -0
  652. package/dist/gateway-method-runtime-BXmOAMxN.js +21 -0
  653. package/dist/gateway-runtime-BRfyNjsE.d.ts +163 -0
  654. package/dist/gemini-cli-provider-2RAshvHZ.d.ts +6 -0
  655. package/dist/get-reply-DZK53szF.js +4689 -0
  656. package/dist/get-reply-from-config.runtime-Kx4GwLAA.js +2 -0
  657. package/dist/get-reply-from-config.runtime.js +1 -1
  658. package/dist/graph-users-CNpoBMLI.js +1419 -0
  659. package/dist/group-access-B-lpiIoP.js +112 -0
  660. package/dist/handle-action.guild-admin-D7AInszH.js +288 -0
  661. package/dist/harness-BPTKe2TG.js +61 -0
  662. package/dist/health-BkXVkm2H.js +4 -0
  663. package/dist/heartbeat-runner-Dbddl21A.js +5 -0
  664. package/dist/heartbeat-runner.runtime-CDmb7D-Q.js +4 -0
  665. package/dist/heartbeat-runner.runtime.js +1 -1
  666. package/dist/hooks-90WH7Tva.js +534 -0
  667. package/dist/http-registry-DydRvucX.d.ts +23 -0
  668. package/dist/image-generation-runtime-CYSxJAy2.d.ts +21 -0
  669. package/dist/inbound-direct-dm-runtime-bXneq4t0.js +2 -0
  670. package/dist/inbound-reply-dispatch-BVzOSvZX.js +148 -0
  671. package/dist/index-BFhfE749.d.ts +3971 -0
  672. package/dist/index.js +1 -1
  673. package/dist/init-DWgLcXq7.js +59 -0
  674. package/dist/inline-buttons-DtcEDZIV.js +40 -0
  675. package/dist/interactive-dispatch-CNUK2pZt.d.ts +56 -0
  676. package/dist/interactive-dispatch-DuuOPzwD.d.ts +143 -0
  677. package/dist/internal-events-D3SdlwzM.js +90 -0
  678. package/dist/isolated-agent-B9qCvLC4.js +1118 -0
  679. package/dist/isolated-agent-DaBWyrzI.js +2 -0
  680. package/dist/lifecycle-CfcTMzLT.js +571 -0
  681. package/dist/list.probe-aXBUfusA.js +449 -0
  682. package/dist/list.status-command-xrFMny0R.js +789 -0
  683. package/dist/llm-slug-generator-D5FE5osT.js +78 -0
  684. package/dist/llm-slug-generator.js +1 -1
  685. package/dist/loader-BKopCdPY.d.ts +142 -0
  686. package/dist/local-dispatch.runtime-0dOK_rcW.js +9 -0
  687. package/dist/local-dispatch.runtime.js +1 -1
  688. package/dist/manager-BrS--u6G.d.ts +356 -0
  689. package/dist/manager.runtime-pUdntZ2i.js +2714 -0
  690. package/dist/manager.runtime.js +1 -1
  691. package/dist/markdown-to-line-Cv0Gm132.js +811 -0
  692. package/dist/mcp-http-CaliRokB.js +555 -0
  693. package/dist/mcp-http-Dgcmuypw.js +2 -0
  694. package/dist/media-understanding-provider-Cu7iRaWL.js +339 -0
  695. package/dist/memory-core-host-engine-storage-DsNomsw4.d.ts +54 -0
  696. package/dist/memory-embedding-adapter-Ba-UYpWr.d.ts +5 -0
  697. package/dist/message-actions-BBiWyHuJ.js +145 -0
  698. package/dist/message-handler-VnxCCjy7.js +384 -0
  699. package/dist/message-handler-dNRhdkX3.js +1715 -0
  700. package/dist/message-handler.preflight-CREgYCNj.js +1125 -0
  701. package/dist/message-handler.process-DN93vvas.js +1484 -0
  702. package/dist/migration-DOuQeJ7P.d.ts +45 -0
  703. package/dist/model-Bp-W7fVB.js +74 -0
  704. package/dist/model-eEpAu59T.d.ts +33 -0
  705. package/dist/model-selection-CXTwfi0m.js +272 -0
  706. package/dist/models-BF1vdgHr.js +2 -0
  707. package/dist/models-DepHj1G3.d.ts +24 -0
  708. package/dist/models-DvbokHz4.js +104 -0
  709. package/dist/models-cli-B_zT7frv.js +256 -0
  710. package/dist/monitor-BoW4qfGV.js +834 -0
  711. package/dist/monitor-Bs8KSKu7.js +60 -0
  712. package/dist/monitor-DHgHadUx.js +1370 -0
  713. package/dist/monitor-DX7Ya0rb.js +715 -0
  714. package/dist/monitor-DlzBuqhN.js +2788 -0
  715. package/dist/monitor-DnzcdtYh.js +1657 -0
  716. package/dist/monitor-DwwFCaSy.js +4377 -0
  717. package/dist/monitor-auth-BRF9yj8s.js +179 -0
  718. package/dist/monitor-m5zwJU51.js +2 -0
  719. package/dist/monitor-polling.runtime-DXMM7v9c.js +883 -0
  720. package/dist/monitor-polling.runtime.js +1 -1
  721. package/dist/monitor-webhook.runtime-vNDAo7Yq.js +387 -0
  722. package/dist/monitor-webhook.runtime.js +1 -1
  723. package/dist/monitor.account-DT1JC2fm.js +5233 -0
  724. package/dist/monitor.runtime-BUw4UbJN.js +2 -0
  725. package/dist/monitor.runtime.js +1 -1
  726. package/dist/monitor.webhook-IBx7ZFi4.js +180 -0
  727. package/dist/node-cli-sessions-BJW0oB3s.js +1228 -0
  728. package/dist/openai-codex-provider-LwMbKOK1.d.ts +5 -0
  729. package/dist/openai-http-BX-DFq23.js +824 -0
  730. package/dist/openai-provider-F0nEHs4l.d.ts +5 -0
  731. package/dist/openresponses-http-BN6ztKxO.js +1173 -0
  732. package/dist/operations-DmaD-gxv.js +805 -0
  733. package/dist/outbound-adapter-v9Q4K2Bl.js +543 -0
  734. package/dist/outbound-session-route-BxhErAps.js +45 -0
  735. package/dist/outbound.runtime-ClUOK-Ir.js +2 -0
  736. package/dist/outbound.runtime.js +1 -1
  737. package/dist/pi-embedded-CG0u988w.js +4 -0
  738. package/dist/pi-embedded-D7UoOQFj.js +3796 -0
  739. package/dist/pi-embedded.runtime-CKNVJdm9.js +4 -0
  740. package/dist/pi-embedded.runtime.js +1 -1
  741. package/dist/pi-tools-DP7eGHq-.js +2413 -0
  742. package/dist/plan-BD5JNOvV.js +81 -0
  743. package/dist/plan-BSDlELnX.js +112 -0
  744. package/dist/plugin-4bygXnMD.js +12396 -0
  745. package/dist/plugin-BW5kVZrl.d.ts +17 -0
  746. package/dist/plugin-app-cache-key-BfaJYLXl.js +46 -0
  747. package/dist/plugin-enabled-44kWBMek.js +233 -0
  748. package/dist/plugin-entry-oVFfOYI7.d.ts +47 -0
  749. package/dist/plugin-registration-DoD5ARyg.js +88 -0
  750. package/dist/plugin-runtime-Bx8TuYU5.d.ts +117 -0
  751. package/dist/plugin-sdk/.boundary-entry-shims.stamp +1 -1
  752. package/dist/plugin-sdk/acp-runtime-backend.js +1 -1
  753. package/dist/plugin-sdk/acp-runtime.js +2 -2
  754. package/dist/plugin-sdk/agent-harness-runtime.js +6 -6
  755. package/dist/plugin-sdk/agent-harness-task-runtime.js +1 -1
  756. package/dist/plugin-sdk/agent-harness.js +7 -7
  757. package/dist/plugin-sdk/agent-runtime.js +2 -2
  758. package/dist/plugin-sdk/channel-core.js +2 -2
  759. package/dist/plugin-sdk/channel-inbound.js +2 -2
  760. package/dist/plugin-sdk/channel-test-helpers.js +1 -1
  761. package/dist/plugin-sdk/command-auth.js +1 -1
  762. package/dist/plugin-sdk/command-status-runtime.js +1 -1
  763. package/dist/plugin-sdk/compat.js +1 -1
  764. package/dist/plugin-sdk/conversation-binding-runtime.js +2 -2
  765. package/dist/plugin-sdk/conversation-runtime.js +3 -3
  766. package/dist/plugin-sdk/core.js +2 -2
  767. package/dist/plugin-sdk/direct-dm.js +1 -1
  768. package/dist/plugin-sdk/gateway-method-runtime.js +1 -1
  769. package/dist/plugin-sdk/health.js +2 -2
  770. package/dist/plugin-sdk/inbound-reply-dispatch.js +1 -1
  771. package/dist/plugin-sdk/index.js +1 -1
  772. package/dist/plugin-sdk/mattermost.js +1 -1
  773. package/dist/plugin-sdk/plugin-test-contracts.js +2 -2
  774. package/dist/plugin-sdk/provider-test-contracts.js +4 -4
  775. package/dist/plugin-sdk/reply-runtime.js +4 -4
  776. package/dist/plugin-sdk/testing.js +2 -2
  777. package/dist/plugin-sdk/zalouser.js +1 -1
  778. package/dist/plugin-service-CJqwjPRa.js +1229 -0
  779. package/dist/plugin-service-W6IMgQjk.d.ts +24 -0
  780. package/dist/plugins/build-smoke-entry.d.ts +2 -2
  781. package/dist/plugins/loader.d.ts +1 -1
  782. package/dist/plugins/provider-discovery.runtime.d.ts +1 -1
  783. package/dist/plugins/provider-runtime.runtime.d.ts +1 -1
  784. package/dist/plugins/runtime/index.js +4 -4
  785. package/dist/policy-C2YDmnm2.js +138 -0
  786. package/dist/policy-CYBwtJmM.js +680 -0
  787. package/dist/prepare.runtime-B9SQyzSp.js +732 -0
  788. package/dist/prepare.runtime.js +1 -1
  789. package/dist/preview-warnings-DkMoGKdo.js +392 -0
  790. package/dist/probe-BYucGf4s.js +682 -0
  791. package/dist/probe-D8YoJ89r.js +2204 -0
  792. package/dist/probe-DKinNcah.js +47 -0
  793. package/dist/probe-DSYRrw81.js +2 -0
  794. package/dist/program-MtNU1_sG.js +131 -0
  795. package/dist/prompt-overlay-CaXYKmjI.d.ts +23 -0
  796. package/dist/provider-26ZZeAkw.js +32 -0
  797. package/dist/provider-BtNK1WFZ.js +8735 -0
  798. package/dist/provider-CfJzlnOm.js +32 -0
  799. package/dist/provider-Dl-E4_a8.js +152 -0
  800. package/dist/provider-api-key-auth-DOu4GJBt.d.ts +27 -0
  801. package/dist/provider-auth-result-CO9yqIJ_.d.ts +21 -0
  802. package/dist/provider-catalog-runtime-f_87intf.d.ts +23 -0
  803. package/dist/provider-catalog-shared-CXZnqdym.d.ts +62 -0
  804. package/dist/provider-dispatcher-CAaa54DQ.js +22 -0
  805. package/dist/provider-dispatcher.runtime.js +1 -1
  806. package/dist/provider-hook-runtime-o2J0hqhZ.d.ts +61 -0
  807. package/dist/provider-model-shared-CsZtXE0W.d.ts +143 -0
  808. package/dist/provider-models-BbjvK4gF.d.ts +12 -0
  809. package/dist/provider-policy-BwZykYqb.d.ts +30 -0
  810. package/dist/provider-registration-CytP1d9Y.d.ts +6 -0
  811. package/dist/provider-registry-Ct1dA5S3.d.ts +8 -0
  812. package/dist/provider-registry-DgEFqiK2.d.ts +30 -0
  813. package/dist/provider-registry-Dilmwbu_.d.ts +8 -0
  814. package/dist/provider-runtime-ChO01VYW.d.ts +359 -0
  815. package/dist/provider-self-hosted-setup-DCeKR5ZH.d.ts +74 -0
  816. package/dist/provider-session.runtime-DDMGL25I.js +9 -0
  817. package/dist/provider-session.runtime.js +1 -1
  818. package/dist/provider-stream-CrWY0s8C.d.ts +140 -0
  819. package/dist/provider-stream-shared-CgnrFxMf.d.ts +128 -0
  820. package/dist/provider.runtime-CUdlREry.js +2 -0
  821. package/dist/provider.runtime.js +1 -1
  822. package/dist/providers.runtime-CiX4UePR.d.ts +25 -0
  823. package/dist/public-surface-loader-iYUvHxzC.js +114 -0
  824. package/dist/pw-ai-DQjpZTSa.js +3029 -0
  825. package/dist/pw-role-snapshot-DgavoGdC.js +333 -0
  826. package/dist/reaction-level-uiCaLj0m.js +19 -0
  827. package/dist/reaction-runtime-api-ErmZKqXv.js +116 -0
  828. package/dist/realtime-transcription-abdbHd8R.d.ts +43 -0
  829. package/dist/realtime-transcription-provider-CPK7XYp9.d.ts +5 -0
  830. package/dist/realtime-transcription-provider-DC2AscwX.d.ts +32 -0
  831. package/dist/realtime-transcription-provider-Dg5t03mY.d.ts +28 -0
  832. package/dist/realtime-transcription-provider-UesXbEwy.d.ts +37 -0
  833. package/dist/realtime-transcription-provider-tLRMgcYk.js +205 -0
  834. package/dist/realtime-voice-D1aiUBBt.d.ts +333 -0
  835. package/dist/realtime-voice-provider-D5DZsLRA.d.ts +5 -0
  836. package/dist/register-DxldPhbz.js +2178 -0
  837. package/dist/register.agent-B9171wFk.js +156 -0
  838. package/dist/register.crestodian-plvra03q.js +24 -0
  839. package/dist/register.maintenance-BLH-PhXR.js +105 -0
  840. package/dist/register.runtime-CAW8ORTZ.d.ts +6 -0
  841. package/dist/register.runtime-CnuNQn65.js +54 -0
  842. package/dist/register.subclis-C9TqTF1g.js +3 -0
  843. package/dist/register.subclis-core-B4RLAWNE.js +273 -0
  844. package/dist/register.subclis-zvycA0fS.js +31 -0
  845. package/dist/registry-paAkM8At.d.ts +91 -0
  846. package/dist/registry-types-DSJvRhBP.d.ts +392 -0
  847. package/dist/repair-sequencing-3Q95ftKn.js +640 -0
  848. package/dist/reply-delivery-BYtyofYM.js +196 -0
  849. package/dist/reply-runtime-P6EiRGYz.js +11 -0
  850. package/dist/reply.runtime-Kx4GwLAA.js +2 -0
  851. package/dist/reply.runtime.js +1 -1
  852. package/dist/request-B8_J1Hk5.js +54 -0
  853. package/dist/resolve-allowlist-BHhr7pGG.js +220 -0
  854. package/dist/result-fallback-classifier-v1BgnJLN.js +79 -0
  855. package/dist/route-Dl0ZJvrW.js +469 -0
  856. package/dist/route-resolution-mVRyzqn_.js +274 -0
  857. package/dist/routes-B8uiTXHO.js +3602 -0
  858. package/dist/routes-Bjw1nWyB.js +2 -0
  859. package/dist/run-attempt-DKRsY7Xs.js +7704 -0
  860. package/dist/run-command-Bs2y31Ew.js +2 -0
  861. package/dist/run-command-CBDF_cGB.js +23 -0
  862. package/dist/run-embedded.runtime-2GWQN_Qf.js +4 -0
  863. package/dist/run-embedded.runtime.js +1 -1
  864. package/dist/run-execution-cli.runtime-BEXMdwL2.js +4 -0
  865. package/dist/run-execution-cli.runtime.js +1 -1
  866. package/dist/run-executor.runtime.js +1 -1
  867. package/dist/run-rMTtvEMF.js +1163 -0
  868. package/dist/run-subagent-registry.runtime-CBmgh09W.js +2 -0
  869. package/dist/run-subagent-registry.runtime.js +1 -1
  870. package/dist/runtime-DFBt4ZZw.js +1287 -0
  871. package/dist/runtime-DQV1yYF5.js +6179 -0
  872. package/dist/runtime-api-B6S-7TVS.js +3 -0
  873. package/dist/runtime-api-BLV9PO47.js +24 -0
  874. package/dist/runtime-api-BX1AvShq.js +17 -0
  875. package/dist/runtime-api-BnN22IWf.js +13 -0
  876. package/dist/runtime-api-BsmZgGnI.js +21 -0
  877. package/dist/runtime-api-CJ6x4Uuu.js +13 -0
  878. package/dist/runtime-api-DTdQMFV-.d.ts +3151 -0
  879. package/dist/runtime-api-DXCKXAYu.js +4 -0
  880. package/dist/runtime-api.actions-C9Jtoruo.js +3 -0
  881. package/dist/runtime-api.monitor-slWfxEgT.js +6 -0
  882. package/dist/runtime-api.send-D_auPJG_.js +4 -0
  883. package/dist/runtime-api.threads-BWzc1vrN.js +2 -0
  884. package/dist/runtime-channel-BOnbxldg.js +2 -0
  885. package/dist/runtime-channel-Dh45Bl_Q.js +150 -0
  886. package/dist/runtime-embedded-pi.runtime-BVjCGIqB.js +2 -0
  887. package/dist/runtime-embedded-pi.runtime.js +1 -1
  888. package/dist/runtime-hYOWxRKE.js +438 -0
  889. package/dist/runtime-taskflow-BYZsMg1i.d.ts +435 -0
  890. package/dist/sanitize-outbound-CP-twYgG.js +127 -0
  891. package/dist/sdk-setup-tools-Cfh-ATXD.js +8 -0
  892. package/dist/secrets-DcQ7WBB-.js +113 -0
  893. package/dist/security-audit-CwMh7ULQ.js +118 -0
  894. package/dist/security-audit-yRC5cfp1.js +122 -0
  895. package/dist/security-audit.runtime-COitYvaV.js +2 -0
  896. package/dist/security-audit.runtime.js +1 -1
  897. package/dist/selection-C_swgArS.js +3 -0
  898. package/dist/selection-Cud_xC6-.js +16157 -0
  899. package/dist/send-BXTj6QIe.js +143 -0
  900. package/dist/send-Be-rQ3Py.js +1631 -0
  901. package/dist/send-DrSo2pTm.js +192 -0
  902. package/dist/send-un_jKNYG.js +2 -0
  903. package/dist/send.components-C0ugXCvj.js +500 -0
  904. package/dist/send.components-CaHcQCve.js +2 -0
  905. package/dist/send.runtime-CcGjdPIe.js +2 -0
  906. package/dist/send.runtime.js +1 -1
  907. package/dist/server-Belw8J0P.js +24 -0
  908. package/dist/server-CbbbWl0g.js +73 -0
  909. package/dist/server-close.runtime.d.ts +1 -1
  910. package/dist/server-close.runtime.js +1 -1
  911. package/dist/server-context-D5PPz4pG.js +955 -0
  912. package/dist/server-context-DfiZrO39.js +2 -0
  913. package/dist/server-cron-B4uqojsc.js +2989 -0
  914. package/dist/server-cron-D5ofhC2R.js +2 -0
  915. package/dist/server-methods-BtrFcSCY.js +16499 -0
  916. package/dist/server-node-events-B7f6W47S.js +596 -0
  917. package/dist/server-plugin-bootstrap-CldF7ied.js +70 -0
  918. package/dist/server-plugins-BkRL48_Y.js +432 -0
  919. package/dist/server-reload-handlers-CmD463eg.js +714 -0
  920. package/dist/server-restart-sentinel-1-GltJOW.js +2 -0
  921. package/dist/server-restart-sentinel-BAc6ad7u.js +747 -0
  922. package/dist/server-runtime-services-DdDWPwwJ.js +2 -0
  923. package/dist/server-runtime-services-q4vtzdgR.js +267 -0
  924. package/dist/server-startup-plugins-RDIvIW1b.js +113 -0
  925. package/dist/server-startup-post-attach-B-Bcz1b8.js +716 -0
  926. package/dist/server-ws-runtime-ClfNa1gj.js +349 -0
  927. package/dist/server.impl-5A5eWz1g.js +2587 -0
  928. package/dist/service-BIi_LAz_.js +1446 -0
  929. package/dist/session-binding-DxgaaGZ8.js +219 -0
  930. package/dist/session-binding-SoSof-ir.js +2 -0
  931. package/dist/session-kill-http-CpA7WXXP.js +121 -0
  932. package/dist/session-reset-service-MBceWYbr.js +625 -0
  933. package/dist/session-route-SMerc1ZF.js +93 -0
  934. package/dist/session-status.runtime-C1MOnm-1.js +2 -0
  935. package/dist/session-status.runtime.js +1 -1
  936. package/dist/session-subagent-reactivation.runtime-Cca41-p8.js +2 -0
  937. package/dist/session-subagent-reactivation.runtime.js +1 -1
  938. package/dist/session-tab-registry-BL8A9tMR.js +521 -0
  939. package/dist/sessions-history-http-Cb21uPHU.js +430 -0
  940. package/dist/sessions.runtime-ClHkmNrd.js +2 -0
  941. package/dist/sessions.runtime.js +1 -1
  942. package/dist/setup-api-CwKuO7ZG.js +29 -0
  943. package/dist/setup-core-C8_XbMIV.js +174 -0
  944. package/dist/setup-surface-B3m7rAoM.js +405 -0
  945. package/dist/setup-surface-BstaBVou.js +320 -0
  946. package/dist/setup-surface-C5L8UmIu.js +221 -0
  947. package/dist/setup-surface-DwijXcOh.js +288 -0
  948. package/dist/shared-DdLk0hA6.d.ts +115 -0
  949. package/dist/shared-DemthgnG.js +121 -0
  950. package/dist/shared-client-CLvetNfK.js +2 -0
  951. package/dist/shared-client-CR88Qth4.js +629 -0
  952. package/dist/side-question-BKRlgFVG.js +683 -0
  953. package/dist/simple-completion-runtime-D3vYpwbZ.d.ts +73 -0
  954. package/dist/skill-tool-dispatch.runtime-Bsz4SNiK.js +143 -0
  955. package/dist/skill-tool-dispatch.runtime.js +1 -1
  956. package/dist/slash-state-Cbb2tkH9.js +2166 -0
  957. package/dist/speech-Cf7RmLix.d.ts +47 -0
  958. package/dist/speech-core-BWd27MY5.d.ts +36 -0
  959. package/dist/speech-provider-Csdu9pW1.d.ts +5 -0
  960. package/dist/speech-provider-D4v4Jv2s.d.ts +34 -0
  961. package/dist/speech-provider-Dj7nG9do.d.ts +5 -0
  962. package/dist/speech-provider-DnyUKHSU.d.ts +5 -0
  963. package/dist/speech-provider-MoJPg1gB.d.ts +8 -0
  964. package/dist/speech-provider-hT52upCX.d.ts +8 -0
  965. package/dist/speech-provider-hqhi426N.js +184 -0
  966. package/dist/src-wxYdKry6.js +4256 -0
  967. package/dist/startup-context-CidK9XK8.js +313 -0
  968. package/dist/status-subagents.runtime-DgYNfrbK.js +18 -0
  969. package/dist/status-subagents.runtime.js +1 -1
  970. package/dist/status-text-w43pGoDJ.js +296 -0
  971. package/dist/sticker-cache-BdIkkDGC.js +206 -0
  972. package/dist/sticker-vision.runtime-bmccn4BW.js +17 -0
  973. package/dist/sticker-vision.runtime.js +1 -1
  974. package/dist/stream-BVr9Y5Fk.d.ts +19 -0
  975. package/dist/stream-C5ugQLbM.d.ts +10 -0
  976. package/dist/stream-CDDV9-Wq.d.ts +5 -0
  977. package/dist/stream-D3ZhJVM7.d.ts +16 -0
  978. package/dist/stream-Dhh55ncO.d.ts +120 -0
  979. package/dist/stream-wrappers-PZu4IPG2.d.ts +21 -0
  980. package/dist/subagent-announce-Cig5R7bU.js +354 -0
  981. package/dist/subagent-announce-delivery-DElem-jW.js +958 -0
  982. package/dist/subagent-control-Dx1qbt2M.js +508 -0
  983. package/dist/subagent-hooks-03ne_B1P.js +2 -0
  984. package/dist/subagent-hooks-BW4tdl1N.js +116 -0
  985. package/dist/subagent-hooks-BdADgqQH.js +2 -0
  986. package/dist/subagent-hooks-D5ZUfS0C.js +146 -0
  987. package/dist/subagent-hooks-DKEWsBSa.js +230 -0
  988. package/dist/subagent-hooks-api-BNJpIv9Q.js +23 -0
  989. package/dist/subagent-hooks-api-BXE-a9iQ.js +22 -0
  990. package/dist/subagent-hooks-api-w7wOpXSR.js +23 -0
  991. package/dist/subagent-hooks-kf263oYw.js +2 -0
  992. package/dist/subagent-orphan-recovery-TGLIuI1K.js +352 -0
  993. package/dist/subagent-registry-Bai39rEv.js +3 -0
  994. package/dist/subagent-registry-vgjMT_I1.js +2351 -0
  995. package/dist/subagent-registry.runtime.js +1 -1
  996. package/dist/subagent-session-cleanup-PEEQtuLS.js +525 -0
  997. package/dist/subagent-spawn-2TTDQg5Y.js +1164 -0
  998. package/dist/target-id-BgSzF2Lk.js +107 -0
  999. package/dist/targets-Bd9-WGJt.js +19 -0
  1000. package/dist/targets-CdiGPFGr.d.ts +10 -0
  1001. package/dist/targets-DxKwMzNB.js +44 -0
  1002. package/dist/targets-DzdYRUSR.js +19 -0
  1003. package/dist/targets-ZJ1ZRt5L.d.ts +10 -0
  1004. package/dist/task-registry-control.runtime.js +1 -1
  1005. package/dist/telegram/token.js +1 -1
  1006. package/dist/testing-B6jLjq4r.js +267 -0
  1007. package/dist/thinking-policy-CAsew9b-.d.ts +5 -0
  1008. package/dist/thread-bindings-BumrOVO8.js +571 -0
  1009. package/dist/thread-bindings-C4yc8CZT.js +228 -0
  1010. package/dist/thread-bindings-Dkeit03N.js +8 -0
  1011. package/dist/thread-bindings-FVOv7g2T.js +232 -0
  1012. package/dist/thread-bindings.discord-api-D83vw86t.js +187 -0
  1013. package/dist/thread-bindings.manager-DEqfX4rc.js +2 -0
  1014. package/dist/thread-bindings.manager-LOMmQ1pN.js +536 -0
  1015. package/dist/thread-lifecycle-CGFgul5c.js +1614 -0
  1016. package/dist/token-CoB7XxKt.js +134 -0
  1017. package/dist/tool-CIfIAkxV.js +139 -0
  1018. package/dist/tool-actions.runtime-BrVxKuRd.js +534 -0
  1019. package/dist/tool-actions.runtime.js +1 -1
  1020. package/dist/tool-plugin-B18esZUX.d.ts +77 -0
  1021. package/dist/tool-resolution-BWdOXsX0.js +149 -0
  1022. package/dist/tool-split-_O9ZqSIU.d.ts +19 -0
  1023. package/dist/tools-effective-inventory-CW8_FJBN.js +204 -0
  1024. package/dist/tools-invoke-http-CYJCHpxL.js +67 -0
  1025. package/dist/tools-invoke-shared-SnaEXvuz.js +200 -0
  1026. package/dist/transport-stream-Piw1coFu.d.ts +42 -0
  1027. package/dist/tts-5p3qPz-P.js +66 -0
  1028. package/dist/tui-BYTSFA_c.js +4709 -0
  1029. package/dist/tui-LOGspKbe.js +2 -0
  1030. package/dist/tui-backend-C8nbqNLo.js +256 -0
  1031. package/dist/tui-cli-C91LywYY.js +37 -0
  1032. package/dist/types--mFsqUEV.d.ts +786 -0
  1033. package/dist/types-CcjGrBF52.d.ts +3650 -0
  1034. package/dist/types.public-rJrhXChy.d.ts +70 -0
  1035. package/dist/update-cli-DZuYe1aX.js +3665 -0
  1036. package/dist/update-global-ucSOAIga.js +606 -0
  1037. package/dist/update-runner-2pS-KlSn.js +1798 -0
  1038. package/dist/video-generation-runtime-CA2LiNwu.d.ts +21 -0
  1039. package/dist/video-model-catalog-BJ9GJKrw.d.ts +16 -0
  1040. package/dist/vision-tools-mJMJD3Yw.js +1409 -0
  1041. package/dist/web-search-BZgc3DQT.js +62 -0
  1042. package/dist/web-search-provider.runtime-BgoF9yna.js +328 -0
  1043. package/dist/web-search-provider.runtime-D1lmfAbp.js +2 -0
  1044. package/dist/web-search-provider.runtime.js +1 -1
  1045. package/dist/webhook-targets-B_syT8-q.d.ts +99 -0
  1046. package/dist/xai-oauth-B-LPhpsk.js +479 -0
  1047. package/dist/xai-user-agent-B0F4Hyt5.js +32 -0
  1048. package/dist/zod-schema.core-Bwbyyd_y.d.ts +166 -0
  1049. package/npm-shrinkwrap.json +2 -2
  1050. package/package.json +1 -1
  1051. package/dist/abort-BtS5AfJG.js +0 -277
  1052. package/dist/abort.runtime-D211494J.js +0 -2
  1053. package/dist/account-inspect-BqAxH1Q_.js +0 -173
  1054. package/dist/accounts-2VYKksau.js +0 -107
  1055. package/dist/accounts-B6aVCtty.js +0 -119
  1056. package/dist/accounts-CE6mvWMC.js +0 -2
  1057. package/dist/accounts-eprn8x0M.js +0 -107
  1058. package/dist/acp-runtime-C_0NA0CS.js +0 -26
  1059. package/dist/acp-spawn-CTmucfK5.js +0 -2
  1060. package/dist/acp-spawn-DcTgPZQB.js +0 -1275
  1061. package/dist/acp-stateful-target-driver-DVWNxIEX.js +0 -89
  1062. package/dist/action-kill-C6NRFglx.js +0 -33
  1063. package/dist/action-runtime-BaKOu7uV.js +0 -469
  1064. package/dist/action-runtime-api-QC43ZgvC.js +0 -2
  1065. package/dist/action-send-B790BH2g.js +0 -39
  1066. package/dist/action-spawn-Dgf97JGp.js +0 -47
  1067. package/dist/actions-DhY0Hqxd.js +0 -161
  1068. package/dist/actions.runtime-BfdjoY4f.js +0 -5
  1069. package/dist/agent-C1VC8waN.js +0 -3
  1070. package/dist/agent-DuLat04d.js +0 -2
  1071. package/dist/agent-command-BQ2JuYpP.js +0 -1367
  1072. package/dist/agent-components.runtime-BskyK1iq.js +0 -10
  1073. package/dist/agent-harness-Bt_1zRJ1.d.ts +0 -146
  1074. package/dist/agent-harness-runtime-CsWVHhWd.d.ts +0 -691
  1075. package/dist/agent-harness-runtime-l4d66klL.js +0 -180
  1076. package/dist/agent-harness-task-runtime-D5vhG7mw.js +0 -140
  1077. package/dist/agent-runner-execution-DKJ7YE9g.js +0 -1713
  1078. package/dist/agent-runner-utils-BOJEvwHI.js +0 -266
  1079. package/dist/agent-runner.runtime-BAC7XlZX.js +0 -3455
  1080. package/dist/agent-runtime-D8J3kngS.js +0 -229
  1081. package/dist/agent-via-gateway-BPZeOgET.js +0 -463
  1082. package/dist/api-2J3KsQlI.js +0 -2
  1083. package/dist/api-BNZFdrOx.js +0 -639
  1084. package/dist/api-CQY8p5l4.js +0 -134
  1085. package/dist/api-CdIYfiOh.js +0 -3
  1086. package/dist/api-D5uGvU4G.d.ts +0 -52
  1087. package/dist/api-DaLfnqrr.js +0 -2
  1088. package/dist/api-DzpDMEqm.js +0 -6
  1089. package/dist/apply-DTkOJDSZ.js +0 -54
  1090. package/dist/apply-DY6Ov6qF.js +0 -41
  1091. package/dist/approval-handler.runtime-9W6kSKLn.js +0 -130
  1092. package/dist/assistant-D338eQWk.js +0 -291
  1093. package/dist/attachment-normalize-BaGndElX.js +0 -225
  1094. package/dist/attempt-execution-aOkjnMht.js +0 -558
  1095. package/dist/attempt-execution.runtime-lKPuGjsg.js +0 -3
  1096. package/dist/attempt-execution.shared-lwEBnvQR.js +0 -38
  1097. package/dist/attempt.prompt-helpers-BVDwNazv.js +0 -475
  1098. package/dist/attempt.tool-run-context-DXgP_TxW.js +0 -2094
  1099. package/dist/binding-routing-CA-u9MaB.js +0 -113
  1100. package/dist/binding-targets-SGf9XyYl.js +0 -121
  1101. package/dist/bot-C0uHsCiq.js +0 -7894
  1102. package/dist/bot-deps-CfqgukPx.js +0 -747
  1103. package/dist/bot-deps-D0dGR0Um.js +0 -2
  1104. package/dist/bot-message-context.runtime-aqONyuCb.js +0 -7
  1105. package/dist/bot-message-context.session.runtime-CYJpmbne.js +0 -12
  1106. package/dist/bot-native-commands.delivery.runtime-DjCvDhXo.js +0 -4
  1107. package/dist/bot-native-commands.runtime-CNDOgqnt.js +0 -13
  1108. package/dist/bridge-server-DX39VTjh.js +0 -113
  1109. package/dist/browser-cli-BM0neIBN.js +0 -2
  1110. package/dist/browser-cli-TjkCzsOd.js +0 -230
  1111. package/dist/browser-cli-actions-input-Crdngwmz.js +0 -473
  1112. package/dist/browser-cli-actions-observe-CR0DTzDP.js +0 -81
  1113. package/dist/browser-cli-debug-CC9OYHxx.js +0 -137
  1114. package/dist/browser-cli-inspect-DVWu-CO3.js +0 -104
  1115. package/dist/browser-cli-manage-BfSgA18U.js +0 -443
  1116. package/dist/browser-cli-resize-ddNFsnFm.js +0 -26
  1117. package/dist/browser-cli-shared-B_5TDXXY.js +0 -50
  1118. package/dist/browser-cli-state-CnLWkvHn.js +0 -337
  1119. package/dist/browser-control-auth-1gcUHgnp.js +0 -2
  1120. package/dist/browser-profiles-BkIb0hYP.js +0 -2
  1121. package/dist/browser-runtime-RQ9H-pQ2.js +0 -384
  1122. package/dist/build-C3ote3YU.js +0 -257
  1123. package/dist/bundled-channel-config-schema-4eXcH-RE.d.ts +0 -3163
  1124. package/dist/call-DY6_VEa_.d.ts +0 -43
  1125. package/dist/capability-cli-D2fTtzuV.js +0 -1782
  1126. package/dist/channel-B0dtLI6U.d.ts +0 -49
  1127. package/dist/channel-B2MLRCOm.d.ts +0 -106
  1128. package/dist/channel-B4XBSqBl.d.ts +0 -7
  1129. package/dist/channel-BC3xWers.js +0 -808
  1130. package/dist/channel-BJFPY0Kt.js +0 -376
  1131. package/dist/channel-BMVs8cLm.js +0 -740
  1132. package/dist/channel-BNmekEHv.js +0 -508
  1133. package/dist/channel-BnPanYUC.js +0 -562
  1134. package/dist/channel-BompXOlb.js +0 -1134
  1135. package/dist/channel-Bq3wyp3c.d.ts +0 -8
  1136. package/dist/channel-BwdtLWWj.js +0 -1556
  1137. package/dist/channel-C1AEDysJ.d.ts +0 -47
  1138. package/dist/channel-CEH1dfVt.d.ts +0 -12
  1139. package/dist/channel-CQJHudhH.d.ts +0 -114
  1140. package/dist/channel-CUu3R9QU.d.ts +0 -14
  1141. package/dist/channel-CaugIi5d.js +0 -481
  1142. package/dist/channel-CsdkcuzU.d.ts +0 -7
  1143. package/dist/channel-D-QJ4LSf.d.ts +0 -28
  1144. package/dist/channel-D07QdL-Z.d.ts +0 -8
  1145. package/dist/channel-D1AKh1-N.d.ts +0 -6
  1146. package/dist/channel-D7LE0yXG.js +0 -653
  1147. package/dist/channel-DBucF-mL.js +0 -1496
  1148. package/dist/channel-DC98b13r.js +0 -238
  1149. package/dist/channel-DECcAIqn.d.ts +0 -104
  1150. package/dist/channel-DGWSLAgs.js +0 -1249
  1151. package/dist/channel-DHk6PKNy.js +0 -362
  1152. package/dist/channel-DZW76PDC.d.ts +0 -8
  1153. package/dist/channel-Dqyy2G9y.js +0 -955
  1154. package/dist/channel-DwSP9REc.d.ts +0 -64
  1155. package/dist/channel-LKyGksmz.d.ts +0 -26
  1156. package/dist/channel-Z-wTsii5.js +0 -1777
  1157. package/dist/channel-_B9ZXRPx.js +0 -867
  1158. package/dist/channel-actions.runtime-C3lWtJBL.js +0 -265
  1159. package/dist/channel-cGJKLfJe.d.ts +0 -427
  1160. package/dist/channel-core-B3Xqnnjw.js +0 -5
  1161. package/dist/channel-core-DshTARNf.d.ts +0 -6
  1162. package/dist/channel-entry-contract-DpdwxgOw.d.ts +0 -112
  1163. package/dist/channel-inbound-BnUDIbdQ.js +0 -80
  1164. package/dist/channel-plugin-runtime-CFKbI6Pu.js +0 -998
  1165. package/dist/channel-plugin-runtime-CS0_tyOZ.d.ts +0 -7
  1166. package/dist/channel-runtime-BLFYOC-l.js +0 -408
  1167. package/dist/channel-yBZ1hu-c.js +0 -2126
  1168. package/dist/channel.runtime-BMBFwVOB.js +0 -1008
  1169. package/dist/channel.runtime-BPaTa_4p.js +0 -4
  1170. package/dist/channel.runtime-BiOmO6NR.js +0 -254
  1171. package/dist/channel.runtime-BmwN1CYk.js +0 -652
  1172. package/dist/channel.runtime-C5JA3DOQ.js +0 -21009
  1173. package/dist/channel.runtime-CWmegcjl.js +0 -109
  1174. package/dist/channel.runtime-DDs1y218.js +0 -733
  1175. package/dist/channel.runtime-DJMJ7DxI.js +0 -88
  1176. package/dist/channel.runtime-Dr7_P-K2.js +0 -2528
  1177. package/dist/channel.setup-B03MiH5Q.d.ts +0 -6
  1178. package/dist/channel.setup-BRhsffda.js +0 -10
  1179. package/dist/channel.setup-ByuZMttY.d.ts +0 -8
  1180. package/dist/channel.setup-C74nA6R0.js +0 -343
  1181. package/dist/channel.setup-CIlbvWjW.d.ts +0 -7
  1182. package/dist/channel.setup-RbyDP1dD.js +0 -1098
  1183. package/dist/chat-CGdonziw.js +0 -2666
  1184. package/dist/chrome-BbE0579R.js +0 -1503
  1185. package/dist/cli-CJkC6ybf.js +0 -1341
  1186. package/dist/cli-backend-Dg9IEgrP.d.ts +0 -5
  1187. package/dist/cli-backend-DwmYGZX7.d.ts +0 -5
  1188. package/dist/cli-compaction-D7zwr6if.js +0 -347
  1189. package/dist/cli-metadata-gL02qQsZ.js +0 -22
  1190. package/dist/cli-pk6gIQfi.d.ts +0 -20
  1191. package/dist/cli-runner-DTqOC0Ap.js +0 -540
  1192. package/dist/cli-runner-DX7wbmT5.js +0 -2
  1193. package/dist/cli-runner.runtime-CMFns61M.js +0 -4
  1194. package/dist/cli-runner.runtime-DH0Kp9FZ.js +0 -3
  1195. package/dist/cli-shared-C_4_xNC-.d.ts +0 -20
  1196. package/dist/client-B763Tol6.js +0 -650
  1197. package/dist/client-adapter-WxKxH6x-.js +0 -897
  1198. package/dist/client-factory-00sxHiJF.js +0 -9
  1199. package/dist/command-auth-CXYQ5Z0j.js +0 -135
  1200. package/dist/command-handlers-D1Ac0Dkj.js +0 -1609
  1201. package/dist/command-registry-D2dsDDz5.js +0 -9
  1202. package/dist/command-registry-Dih3NQG-.js +0 -4
  1203. package/dist/command-registry-core-CjXOyB2J.js +0 -110
  1204. package/dist/command-status.runtime-B0-uERwh.js +0 -90
  1205. package/dist/commands-CLbV1tFt.d.ts +0 -113
  1206. package/dist/commands-acp-pD2JpUSj.js +0 -74
  1207. package/dist/commands-compact.runtime-V-TcIs65.js +0 -10
  1208. package/dist/commands-handlers.runtime-5M-A0jiA.js +0 -6154
  1209. package/dist/commands-status-Bm4dG6pI.js +0 -3
  1210. package/dist/commands-status-qm4EnRyE.js +0 -16
  1211. package/dist/commands-status.runtime-Bm4dG6pI.js +0 -3
  1212. package/dist/commands-subagents-control.runtime-DI46smsH.js +0 -2
  1213. package/dist/commands-subagents-control.runtime-rWDaFqzc.js +0 -3
  1214. package/dist/commands-system-prompt-B4F4MOEY.js +0 -162
  1215. package/dist/commands-system-prompt-jk5Mc_DP.js +0 -2
  1216. package/dist/commands.runtime-Bc23O5Mi.js +0 -176
  1217. package/dist/compact-CtN0DOvK.js +0 -480
  1218. package/dist/compact-D1ChSGOh.js +0 -1141
  1219. package/dist/compact.runtime-C7If8t90.js +0 -12
  1220. package/dist/completion-cli-gXouR92c.js +0 -315
  1221. package/dist/computer-use-CdO4BAyI.js +0 -367
  1222. package/dist/config-BkIb0hYP.js +0 -2
  1223. package/dist/config-dmYhst2s.js +0 -373
  1224. package/dist/config-mutations-D2ETKy_j.js +0 -159
  1225. package/dist/config-schema-BwKcspTI.d.ts +0 -20
  1226. package/dist/config-schema-Dx48Ud8L.d.ts +0 -34
  1227. package/dist/context-engine-host-compat-DgNqJwdY.js +0 -288
  1228. package/dist/context-engine-host-compat-OWTQLkIP.js +0 -2
  1229. package/dist/context-engine-lifecycle-CGVL8HdA.js +0 -1274
  1230. package/dist/contracts-testkit-CzhusazO.d.ts +0 -145
  1231. package/dist/control-auth-BFMiW_62.js +0 -114
  1232. package/dist/control-service-D7r7Quub.js +0 -145
  1233. package/dist/control-ui/sw.js +0 -133
  1234. package/dist/conversation-binding-runtime-BW_4K8cX.js +0 -4
  1235. package/dist/conversation-runtime-oIeuYAld.js +0 -31
  1236. package/dist/core-B7zb6eoz.d.ts +0 -224
  1237. package/dist/core-Cqwgrdgs.js +0 -282
  1238. package/dist/core-api-DI9CNhVz.js +0 -2
  1239. package/dist/core-api-Dcj6myhZ.js +0 -5
  1240. package/dist/crestodian-DVM5VVBT.js +0 -55
  1241. package/dist/daocore-runtime-DogaiqPT.d.ts +0 -151
  1242. package/dist/daocore-tools-bO6317PZ.js +0 -11727
  1243. package/dist/delivery-BCvDWVt-.js +0 -1002
  1244. package/dist/dialogue-D7jagbT_.js +0 -37
  1245. package/dist/dir-fetch-tool-BT5EPw-5.js +0 -565
  1246. package/dist/dir-list-tool-H_efDjDq.js +0 -100
  1247. package/dist/direct-dm-D0B-QMik.js +0 -64
  1248. package/dist/directive-handling.fast-lane-DsGCtBC-.js +0 -68
  1249. package/dist/directive-handling.impl-C-1mgd9g.js +0 -2
  1250. package/dist/directive-handling.impl-DumICYAp.js +0 -818
  1251. package/dist/directive-handling.model-selection-BJZn2fo_.js +0 -122
  1252. package/dist/directive-handling.persist.runtime-D62V2_9_.js +0 -263
  1253. package/dist/dispatch-CnOOlfPn.js +0 -1640
  1254. package/dist/dispatch-acp-transcript.runtime-DV_7Zl9P.js +0 -40
  1255. package/dist/dispatch-acp.runtime-ATTViG-t.js +0 -18
  1256. package/dist/doctor-8vhWy3Dw.js +0 -2
  1257. package/dist/doctor-CKYTXvU7.js +0 -6
  1258. package/dist/doctor-config-flow-B0Ilj0MM.js +0 -1741
  1259. package/dist/doctor-core-checks-B0DeLp7M.js +0 -2
  1260. package/dist/doctor-core-checks-NFFEe2qP.js +0 -573
  1261. package/dist/doctor-health-BQDkMVRf.js +0 -65
  1262. package/dist/doctor-health-contributions-BTtoe4Zy.js +0 -696
  1263. package/dist/doctor-lint-CtjiT5S1.js +0 -94
  1264. package/dist/doctor-state-integrity-C1p_aTX_.js +0 -1231
  1265. package/dist/doctor-update-Dzr9Vt00.js +0 -58
  1266. package/dist/doctor-update-fix-Dw80wTUs.js +0 -107
  1267. package/dist/dynamic-tools-Cb1BxOUV.js +0 -486
  1268. package/dist/embedded-backend-DIv3GabL.js +0 -579
  1269. package/dist/embedded-gateway-stub.runtime-DqgU4q-g.js +0 -12
  1270. package/dist/embedding-provider-B82QlZsy.d.ts +0 -21
  1271. package/dist/embedding-provider-Cmb3dgUf.d.ts +0 -65
  1272. package/dist/embedding-provider-w7EJz-DO.d.ts +0 -16
  1273. package/dist/exec-approvals-ClOFMgg8.js +0 -149
  1274. package/dist/file-fetch-tool-CIe7NhYV.js +0 -124
  1275. package/dist/file-write-tool-DBpMRVuc.js +0 -127
  1276. package/dist/format-DwlQcHW-.js +0 -1145
  1277. package/dist/gateway-cli-B-RpSgut.js +0 -435
  1278. package/dist/gateway-method-runtime-BblhHt-0.js +0 -21
  1279. package/dist/gateway-runtime-BcWCu-QH.d.ts +0 -163
  1280. package/dist/gemini-cli-provider-DtyOwxHA.d.ts +0 -6
  1281. package/dist/get-reply-HRNSgWtJ.js +0 -4689
  1282. package/dist/get-reply-from-config.runtime-D_IjyVEy.js +0 -2
  1283. package/dist/graph-users-xOkVRyWa.js +0 -1419
  1284. package/dist/group-access-5rOw40mA.js +0 -112
  1285. package/dist/handle-action.guild-admin-3izRlfhG.js +0 -288
  1286. package/dist/harness-DSATBx4q.js +0 -61
  1287. package/dist/health-gXf5LPQE.js +0 -4
  1288. package/dist/heartbeat-runner-BAl6rYJ4.js +0 -5
  1289. package/dist/heartbeat-runner.runtime-BwR4hXGN.js +0 -4
  1290. package/dist/hooks-Ds30xkRl.js +0 -534
  1291. package/dist/http-registry-D3Cdok5J.d.ts +0 -23
  1292. package/dist/image-generation-runtime-DhYgou3B.d.ts +0 -21
  1293. package/dist/inbound-direct-dm-runtime-VLA3Sl_Y.js +0 -2
  1294. package/dist/inbound-reply-dispatch-B1Yv-_Ol.js +0 -148
  1295. package/dist/index-ChRAMnH9.d.ts +0 -3971
  1296. package/dist/init-C94m6gc5.js +0 -59
  1297. package/dist/inline-buttons-B48KLvRY.js +0 -40
  1298. package/dist/interactive-dispatch-B-NLdr77.d.ts +0 -56
  1299. package/dist/interactive-dispatch-B66zssEF.d.ts +0 -143
  1300. package/dist/internal-events-DH1wKI3W.js +0 -90
  1301. package/dist/isolated-agent-BHtpDjQ3.js +0 -1118
  1302. package/dist/isolated-agent-CQ8xLCdA.js +0 -2
  1303. package/dist/lifecycle-J2_rGItq.js +0 -571
  1304. package/dist/list.probe-CQkRrePt.js +0 -449
  1305. package/dist/list.status-command-Dh4C_nmX.js +0 -789
  1306. package/dist/llm-slug-generator-CuTyqyw9.js +0 -78
  1307. package/dist/loader-Ben-RYnp.d.ts +0 -142
  1308. package/dist/local-dispatch.runtime-DMFlGKN5.js +0 -9
  1309. package/dist/manager-BDWyUfHJ.d.ts +0 -356
  1310. package/dist/manager.runtime-ChEFeq5B.js +0 -2714
  1311. package/dist/markdown-to-line-BXszL2cy.js +0 -811
  1312. package/dist/mcp-http-BfLRPB10.js +0 -555
  1313. package/dist/mcp-http-C4jMPkoA.js +0 -2
  1314. package/dist/media-understanding-provider-By_IYDJy.js +0 -339
  1315. package/dist/memory-core-host-engine-storage-BAq5Rf51.d.ts +0 -54
  1316. package/dist/memory-embedding-adapter-Cv87QsD0.d.ts +0 -5
  1317. package/dist/message-actions-CnGb9RhR.js +0 -145
  1318. package/dist/message-handler-BczaNv3J.js +0 -384
  1319. package/dist/message-handler-txIHUJJr.js +0 -1715
  1320. package/dist/message-handler.preflight-DQ_XIRJD.js +0 -1125
  1321. package/dist/message-handler.process-DW_BauDK.js +0 -1484
  1322. package/dist/migration-BOkhOT4K.d.ts +0 -45
  1323. package/dist/model-B4s-pIp8.d.ts +0 -33
  1324. package/dist/model-CzeDtlL2.js +0 -74
  1325. package/dist/model-selection-DISTEWT3.js +0 -272
  1326. package/dist/models-6NYWdsJM.d.ts +0 -24
  1327. package/dist/models-Cs632hpM.js +0 -104
  1328. package/dist/models-DFdDefW_.js +0 -2
  1329. package/dist/models-cli-CEJaAepl.js +0 -256
  1330. package/dist/monitor-1sdwxltF.js +0 -2788
  1331. package/dist/monitor-B3satZZM.js +0 -2
  1332. package/dist/monitor-BjTf4-1k.js +0 -715
  1333. package/dist/monitor-Blfd3oxm.js +0 -1370
  1334. package/dist/monitor-CTBBctRZ.js +0 -60
  1335. package/dist/monitor-DMs9Fc-I.js +0 -4377
  1336. package/dist/monitor-Jaf6yIPY.js +0 -1657
  1337. package/dist/monitor-QlSkTI6D.js +0 -834
  1338. package/dist/monitor-auth-C1tksIdC.js +0 -179
  1339. package/dist/monitor-polling.runtime-BfiQ9WKu.js +0 -883
  1340. package/dist/monitor-webhook.runtime-DaN0Z6_6.js +0 -387
  1341. package/dist/monitor.account-DXs-I96r.js +0 -5233
  1342. package/dist/monitor.runtime-CfhDXAnn.js +0 -2
  1343. package/dist/monitor.webhook-Dh2yCA0H.js +0 -180
  1344. package/dist/node-cli-sessions-BRSHPLpR.js +0 -1228
  1345. package/dist/openai-codex-provider-CByFL0Au.d.ts +0 -5
  1346. package/dist/openai-http-CJKcPRWW.js +0 -824
  1347. package/dist/openai-provider-DbEgHbfx.d.ts +0 -5
  1348. package/dist/openresponses-http-BhyRvqJ0.js +0 -1173
  1349. package/dist/operations-CL7dqxSs.js +0 -805
  1350. package/dist/outbound-adapter-BzLFym-i.js +0 -543
  1351. package/dist/outbound-session-route-do6mbRaF.js +0 -45
  1352. package/dist/outbound.runtime-ClwB5soC.js +0 -2
  1353. package/dist/pi-embedded-BtyxupRo.js +0 -3796
  1354. package/dist/pi-embedded-DC6txKUX.js +0 -4
  1355. package/dist/pi-embedded.runtime-CLGqbc8E.js +0 -4
  1356. package/dist/pi-tools-BNtGWzuL.js +0 -2413
  1357. package/dist/plan-BKvy4WrJ.js +0 -81
  1358. package/dist/plan-DwVlQpE1.js +0 -112
  1359. package/dist/plugin-BehbkTVr.d.ts +0 -17
  1360. package/dist/plugin-CY0rEF7s.js +0 -12396
  1361. package/dist/plugin-app-cache-key-DNUt0H7R.js +0 -46
  1362. package/dist/plugin-enabled-Cyd8634I.js +0 -233
  1363. package/dist/plugin-entry-feg_rkHL.d.ts +0 -47
  1364. package/dist/plugin-registration-B_-ymgPg.js +0 -88
  1365. package/dist/plugin-runtime-paqzXBLJ.d.ts +0 -117
  1366. package/dist/plugin-service-C0JwHvDr.d.ts +0 -24
  1367. package/dist/plugin-service-Dxx-FdeS.js +0 -1229
  1368. package/dist/policy-BXjjr3b_.js +0 -138
  1369. package/dist/policy-cKo9Yeux.js +0 -680
  1370. package/dist/prepare.runtime-DKbtJNij.js +0 -732
  1371. package/dist/preview-warnings-B_dB0-nc.js +0 -392
  1372. package/dist/probe-D02PTGyD.js +0 -47
  1373. package/dist/probe-DywFeNCV.js +0 -682
  1374. package/dist/probe-f3qP15_E.js +0 -2204
  1375. package/dist/probe-sSNH7OtW.js +0 -2
  1376. package/dist/program-CI-yGmHj.js +0 -131
  1377. package/dist/prompt-overlay-qLjnjnSK.d.ts +0 -23
  1378. package/dist/provider-0MTK_A59.js +0 -32
  1379. package/dist/provider-Bqz_XGo0.js +0 -8735
  1380. package/dist/provider-DguV0rAM.js +0 -32
  1381. package/dist/provider-Vf0kCR9H.js +0 -152
  1382. package/dist/provider-api-key-auth-CB8Tllmv.d.ts +0 -27
  1383. package/dist/provider-auth-result-Xze96yVn.d.ts +0 -21
  1384. package/dist/provider-catalog-runtime-Bo88wUpB.d.ts +0 -23
  1385. package/dist/provider-catalog-shared-rq7-Hkyg.d.ts +0 -62
  1386. package/dist/provider-dispatcher-DYgMXESe.js +0 -22
  1387. package/dist/provider-hook-runtime-bhgA4zLg.d.ts +0 -61
  1388. package/dist/provider-model-shared-Bv_vhH6i.d.ts +0 -143
  1389. package/dist/provider-models-DzbXgGDD.d.ts +0 -12
  1390. package/dist/provider-policy-Cx2IwhQ-.d.ts +0 -30
  1391. package/dist/provider-registration-D4DJp8vF.d.ts +0 -6
  1392. package/dist/provider-registry-BQ5DzWBt.d.ts +0 -8
  1393. package/dist/provider-registry-BrtezAkH.d.ts +0 -30
  1394. package/dist/provider-registry-DG571X-9.d.ts +0 -8
  1395. package/dist/provider-runtime-BJlV-8wH.d.ts +0 -359
  1396. package/dist/provider-self-hosted-setup-C5mGtzPJ.d.ts +0 -74
  1397. package/dist/provider-session.runtime-DPLsI_az.js +0 -9
  1398. package/dist/provider-stream-D-MYyujL.d.ts +0 -140
  1399. package/dist/provider-stream-shared-B6pQNRl4.d.ts +0 -128
  1400. package/dist/provider.runtime-Dqb234pz.js +0 -2
  1401. package/dist/providers.runtime-B9kfx6q8.d.ts +0 -25
  1402. package/dist/public-surface-loader-BFaumhij.js +0 -114
  1403. package/dist/pw-ai-G5xV3oAx.js +0 -3029
  1404. package/dist/pw-role-snapshot-Dx3HJBHP.js +0 -333
  1405. package/dist/reaction-level-cwg9IPV-.js +0 -19
  1406. package/dist/reaction-runtime-api-BO5tonA_.js +0 -116
  1407. package/dist/realtime-transcription-CAC89bnc.d.ts +0 -43
  1408. package/dist/realtime-transcription-provider-BPUt8lMk.js +0 -205
  1409. package/dist/realtime-transcription-provider-ChYQDNhv.d.ts +0 -5
  1410. package/dist/realtime-transcription-provider-DTYtMlJi.d.ts +0 -28
  1411. package/dist/realtime-transcription-provider-DirKeOjA.d.ts +0 -32
  1412. package/dist/realtime-transcription-provider-QHEXWhCJ.d.ts +0 -37
  1413. package/dist/realtime-voice-Bm0GBqnc.d.ts +0 -333
  1414. package/dist/realtime-voice-provider-NcUDkuN4.d.ts +0 -5
  1415. package/dist/register-hPi-PJ7K.js +0 -2178
  1416. package/dist/register.agent-C17wwmyB.js +0 -156
  1417. package/dist/register.crestodian-BgN2eNeU.js +0 -24
  1418. package/dist/register.maintenance-CZV43uUT.js +0 -105
  1419. package/dist/register.runtime-B6KhmuJw.js +0 -54
  1420. package/dist/register.runtime-CXLFfKiU.d.ts +0 -6
  1421. package/dist/register.subclis-By70wsLN.js +0 -31
  1422. package/dist/register.subclis-D_XDgsMy.js +0 -3
  1423. package/dist/register.subclis-core-CYi-wxpA.js +0 -273
  1424. package/dist/registry-DXBS27qE.d.ts +0 -91
  1425. package/dist/registry-types-DlO771W4.d.ts +0 -392
  1426. package/dist/repair-sequencing-ze6dXKp3.js +0 -640
  1427. package/dist/reply-delivery-BRsL-nIn.js +0 -196
  1428. package/dist/reply-runtime-hB7p7Uov.js +0 -11
  1429. package/dist/reply.runtime-D_IjyVEy.js +0 -2
  1430. package/dist/request-C6QBV_dA.js +0 -54
  1431. package/dist/resolve-allowlist-zmvmVPzW.js +0 -220
  1432. package/dist/result-fallback-classifier-hWTcOYyH.js +0 -79
  1433. package/dist/route-BMCrq1SN.js +0 -469
  1434. package/dist/route-resolution-nWgSniti.js +0 -274
  1435. package/dist/routes-BXyfYxi-.js +0 -2
  1436. package/dist/routes-CpMZFxzv.js +0 -3602
  1437. package/dist/run-Bzp1cq1J.js +0 -1163
  1438. package/dist/run-attempt-DMj1Q3oE.js +0 -7704
  1439. package/dist/run-command-CbDBts53.js +0 -23
  1440. package/dist/run-command-CrJ2mrht.js +0 -2
  1441. package/dist/run-embedded.runtime-sD3O3k2K.js +0 -4
  1442. package/dist/run-execution-cli.runtime-CG1zNse6.js +0 -4
  1443. package/dist/run-subagent-registry.runtime-CGzIerQZ.js +0 -2
  1444. package/dist/runtime-B0ZKPxxL.js +0 -6179
  1445. package/dist/runtime-Dh-KFKJv.js +0 -1287
  1446. package/dist/runtime-api-9Xxm9K2E.js +0 -21
  1447. package/dist/runtime-api-C2252PQ4.js +0 -4
  1448. package/dist/runtime-api-C7ToEUFX.d.ts +0 -3151
  1449. package/dist/runtime-api-Cl3W6JLB.js +0 -13
  1450. package/dist/runtime-api-CwyQGzrm.js +0 -24
  1451. package/dist/runtime-api-DQVZQ82e.js +0 -17
  1452. package/dist/runtime-api-Ksdts3J7.js +0 -13
  1453. package/dist/runtime-api-lHayJI0f.js +0 -3
  1454. package/dist/runtime-api.actions-CHH4JoFd.js +0 -3
  1455. package/dist/runtime-api.monitor-CuAnxOiA.js +0 -6
  1456. package/dist/runtime-api.send-C5Ndv4Sb.js +0 -4
  1457. package/dist/runtime-api.threads-Car1xuWI.js +0 -2
  1458. package/dist/runtime-channel-PhHAbE3P.js +0 -2
  1459. package/dist/runtime-channel-ehNPdqhp.js +0 -150
  1460. package/dist/runtime-embedded-pi.runtime-BExQEON7.js +0 -2
  1461. package/dist/runtime-l-x1mIPp.js +0 -438
  1462. package/dist/runtime-taskflow-PDIujF9q.d.ts +0 -435
  1463. package/dist/sanitize-outbound-CINW3wBb.js +0 -127
  1464. package/dist/sdk-setup-tools-DotzY-Ff.js +0 -8
  1465. package/dist/secrets-BdWCp_pg.js +0 -113
  1466. package/dist/security-audit-BMS02wuX.js +0 -122
  1467. package/dist/security-audit-BXupNbYa.js +0 -118
  1468. package/dist/security-audit.runtime-CONAKFRk.js +0 -2
  1469. package/dist/selection-8iOGMBPh.js +0 -16157
  1470. package/dist/selection-D9-GNcGp.js +0 -3
  1471. package/dist/send-BsqMC7vV.js +0 -143
  1472. package/dist/send-ChUpwNpF.js +0 -2
  1473. package/dist/send-D92kiCYa.js +0 -192
  1474. package/dist/send-LSm52k6p.js +0 -1631
  1475. package/dist/send.components-D_1vDkKM.js +0 -2
  1476. package/dist/send.components-Scs0rrDy.js +0 -500
  1477. package/dist/send.runtime-BJbljin6.js +0 -2
  1478. package/dist/server-BQ9wTpKB.js +0 -73
  1479. package/dist/server-CHWh_XGy.js +0 -24
  1480. package/dist/server-context-D42gG6GT.js +0 -2
  1481. package/dist/server-context-oRlMLKPz.js +0 -955
  1482. package/dist/server-cron-BpLzGXmi.js +0 -2
  1483. package/dist/server-cron-DFsVLz6k.js +0 -2989
  1484. package/dist/server-methods-CVgaE49L.js +0 -16499
  1485. package/dist/server-node-events-DmaGt81F.js +0 -596
  1486. package/dist/server-plugin-bootstrap-ypOUJ438.js +0 -70
  1487. package/dist/server-plugins-BZZxcYFZ.js +0 -432
  1488. package/dist/server-reload-handlers-Ccu2KW5E.js +0 -714
  1489. package/dist/server-restart-sentinel-Bud1fPG5.js +0 -2
  1490. package/dist/server-restart-sentinel-C4oYiDTT.js +0 -747
  1491. package/dist/server-runtime-services-BAlijw2O.js +0 -267
  1492. package/dist/server-runtime-services-BY8y-CAk.js +0 -2
  1493. package/dist/server-startup-plugins-utvxpVCl.js +0 -113
  1494. package/dist/server-startup-post-attach-C09QVu1D.js +0 -716
  1495. package/dist/server-ws-runtime-hgZQmILO.js +0 -349
  1496. package/dist/server.impl-btEzW7aF.js +0 -2587
  1497. package/dist/service-DYvUSJDx.js +0 -1446
  1498. package/dist/session-binding-Smi9h573.js +0 -219
  1499. package/dist/session-binding-vAzR408o.js +0 -2
  1500. package/dist/session-kill-http-HXI6hUDG.js +0 -121
  1501. package/dist/session-reset-service-CdqhH7XS.js +0 -625
  1502. package/dist/session-route-DX9HyYoG.js +0 -93
  1503. package/dist/session-status.runtime-B7dGtknj.js +0 -2
  1504. package/dist/session-subagent-reactivation.runtime-Dn-wvdjM.js +0 -2
  1505. package/dist/session-tab-registry-UN4VZE8a.js +0 -521
  1506. package/dist/sessions-history-http--Dgcvhb0.js +0 -430
  1507. package/dist/sessions.runtime-LnYxeKSP.js +0 -2
  1508. package/dist/setup-api-BfO7Ctmd.js +0 -29
  1509. package/dist/setup-core-DlCsv-9q.js +0 -174
  1510. package/dist/setup-surface-BDXmLycW.js +0 -221
  1511. package/dist/setup-surface-Bi-pZtB0.js +0 -405
  1512. package/dist/setup-surface-Bk9MdZ9I.js +0 -288
  1513. package/dist/setup-surface-m649hpou.js +0 -320
  1514. package/dist/shared-DwXuhcIz.js +0 -121
  1515. package/dist/shared-client-Cj3X4R8q.js +0 -2
  1516. package/dist/shared-client-D02xLLJg.js +0 -629
  1517. package/dist/shared-eYKaB8rP.d.ts +0 -115
  1518. package/dist/side-question-DbsrGTKR.js +0 -683
  1519. package/dist/simple-completion-runtime-D3SeEaWT.d.ts +0 -73
  1520. package/dist/skill-tool-dispatch.runtime-CswUeFQB.js +0 -143
  1521. package/dist/slash-state-Br7bOIIy.js +0 -2166
  1522. package/dist/speech-Dbhvhbdq.d.ts +0 -47
  1523. package/dist/speech-core-8X_D3HLF.d.ts +0 -36
  1524. package/dist/speech-provider-BHcOkoLn.js +0 -184
  1525. package/dist/speech-provider-BYm63_co.d.ts +0 -8
  1526. package/dist/speech-provider-BtJxZzKb.d.ts +0 -8
  1527. package/dist/speech-provider-CbneUhtJ.d.ts +0 -5
  1528. package/dist/speech-provider-DOAvAvlS.d.ts +0 -5
  1529. package/dist/speech-provider-DdfnOmrC.d.ts +0 -5
  1530. package/dist/speech-provider-ptNkD7Yf.d.ts +0 -34
  1531. package/dist/src-DcIZ_w7l.js +0 -4256
  1532. package/dist/startup-context-BU3ZwnPZ.js +0 -313
  1533. package/dist/status-subagents.runtime-U9cVRB6A.js +0 -18
  1534. package/dist/status-text-DlZ-OoHI.js +0 -296
  1535. package/dist/sticker-cache-BfgCFMo_.js +0 -206
  1536. package/dist/sticker-vision.runtime-DYSdlJUC.js +0 -17
  1537. package/dist/stream-BHkpDd1i.d.ts +0 -10
  1538. package/dist/stream-C6huJP_D.d.ts +0 -5
  1539. package/dist/stream-D4Pmcj3t.d.ts +0 -16
  1540. package/dist/stream-DpSe6hAE.d.ts +0 -19
  1541. package/dist/stream-DrRUuJ8m.d.ts +0 -120
  1542. package/dist/stream-wrappers-DLxwmPDI.d.ts +0 -21
  1543. package/dist/subagent-announce-BntptirO.js +0 -354
  1544. package/dist/subagent-announce-delivery-6GUsisag.js +0 -958
  1545. package/dist/subagent-control-C7DSvkWz.js +0 -508
  1546. package/dist/subagent-hooks-4aumktTW.js +0 -2
  1547. package/dist/subagent-hooks-COUrrxEC.js +0 -2
  1548. package/dist/subagent-hooks-DUGDXbSM.js +0 -146
  1549. package/dist/subagent-hooks-DjDgoKjj.js +0 -230
  1550. package/dist/subagent-hooks-DjvL3k1b.js +0 -2
  1551. package/dist/subagent-hooks-api-BxfHMA2E.js +0 -22
  1552. package/dist/subagent-hooks-api-Cn7QkuFW.js +0 -23
  1553. package/dist/subagent-hooks-api-_lgvYj20.js +0 -23
  1554. package/dist/subagent-hooks-gWxlJnmo.js +0 -116
  1555. package/dist/subagent-orphan-recovery-CcAPcsDk.js +0 -352
  1556. package/dist/subagent-registry-BsYF1Amv.js +0 -3
  1557. package/dist/subagent-registry-LC_Gic13.js +0 -2351
  1558. package/dist/subagent-session-cleanup-6AY_7hyu.js +0 -525
  1559. package/dist/subagent-spawn-C2IO1E1i.js +0 -1164
  1560. package/dist/target-id-By34AE0b.js +0 -107
  1561. package/dist/targets-B40DzW6Y.js +0 -44
  1562. package/dist/targets-BttGNxRs.js +0 -19
  1563. package/dist/targets-C6bpLZdS.js +0 -19
  1564. package/dist/targets-CZhlhiDN.d.ts +0 -10
  1565. package/dist/targets-HPytm6Z8.d.ts +0 -10
  1566. package/dist/testing-BzZIozrH.js +0 -267
  1567. package/dist/thinking-policy-wJH8MNPa.d.ts +0 -5
  1568. package/dist/thread-bindings-CBiuE4G4.js +0 -228
  1569. package/dist/thread-bindings-CTJq5UHl.js +0 -232
  1570. package/dist/thread-bindings-bN9Ad5r9.js +0 -571
  1571. package/dist/thread-bindings-kXHwWthg.js +0 -8
  1572. package/dist/thread-bindings.discord-api-C8jkPA0w.js +0 -187
  1573. package/dist/thread-bindings.manager-BsFmjrbx.js +0 -536
  1574. package/dist/thread-bindings.manager-DfJgNAl6.js +0 -2
  1575. package/dist/thread-lifecycle-gR5OSLzh.js +0 -1614
  1576. package/dist/token-B2FhcBoz.js +0 -134
  1577. package/dist/tool-47nHlaiR.js +0 -139
  1578. package/dist/tool-actions.runtime-DwQ1lVPo.js +0 -534
  1579. package/dist/tool-plugin-CmXn59FQ.d.ts +0 -77
  1580. package/dist/tool-resolution-DQej_E5w.js +0 -149
  1581. package/dist/tool-split-CaXOLBeI.d.ts +0 -19
  1582. package/dist/tools-effective-inventory-CyXaSANM.js +0 -204
  1583. package/dist/tools-invoke-http-yo3HU4V6.js +0 -67
  1584. package/dist/tools-invoke-shared-LpV_xD9g.js +0 -200
  1585. package/dist/transport-stream-lU_hAKuv.d.ts +0 -42
  1586. package/dist/tts-E7ULNzl4.js +0 -66
  1587. package/dist/tui-B-wyN6wJ.js +0 -4709
  1588. package/dist/tui-CdI6yMis.js +0 -2
  1589. package/dist/tui-backend-CXej-4Er.js +0 -256
  1590. package/dist/tui-cli-wboa0AnA.js +0 -37
  1591. package/dist/types-CD1xwSld.d.ts +0 -786
  1592. package/dist/types-Zj4Bq9h-2.d.ts +0 -3650
  1593. package/dist/types.public-B0VjJLe9.d.ts +0 -70
  1594. package/dist/update-cli-CGUsDh2T.js +0 -3665
  1595. package/dist/update-global-BbP9IhEf.js +0 -601
  1596. package/dist/update-runner-B54rgAmr.js +0 -1798
  1597. package/dist/video-generation-runtime-DsFG7djU.d.ts +0 -21
  1598. package/dist/video-model-catalog-CfhC-Mol.d.ts +0 -16
  1599. package/dist/vision-tools-wacIK5vr.js +0 -1409
  1600. package/dist/web-search-AMwc61Dr.js +0 -62
  1601. package/dist/web-search-provider.runtime-CNG2uQTF.js +0 -2
  1602. package/dist/web-search-provider.runtime-oBaJtm_S.js +0 -328
  1603. package/dist/webhook-targets-C9cJD_kB.d.ts +0 -99
  1604. package/dist/xai-oauth-DOqf2jTO.js +0 -479
  1605. package/dist/xai-user-agent-Dk71wEWd.js +0 -32
  1606. package/dist/zod-schema.core-BhLPa6BF.d.ts +0 -166
  1607. /package/dist/{acp-runtime-backend-4DfhM5M9.js → acp-runtime-backend-CxP454w8.js} +0 -0
  1608. /package/dist/{channel-actions-CYB0u2id.js → channel-actions-AudMk4Yk.js} +0 -0
  1609. /package/dist/{command-status-runtime-CPIRzAU6.js → command-status-runtime-BWRWzQv1.js} +0 -0
  1610. /package/dist/{delegate-DpQ2iXjn.js → delegate-CLZeP48P.js} +0 -0
  1611. /package/dist/{dispatch-acp-Bdp6i1Mz.js → dispatch-acp-BK0Zh3_p.js} +0 -0
  1612. /package/dist/{heartbeat-runner-Cx01gr5N.js → heartbeat-runner-BouutzYV.js} +0 -0
  1613. /package/dist/{library-BSsSuIcq.js → library-C-O719bG.js} +0 -0
  1614. /package/dist/{run-executor.runtime-DwZVL5h6.js → run-executor.runtime-DF1Wol1i.js} +0 -0
  1615. /package/dist/{shared-DJ7fJ5uN.js → shared-BqbJdmuE.js} +0 -0
@@ -0,0 +1,3665 @@
1
+ import { a as normalizeLowercaseStringOrEmpty, c as normalizeOptionalString } from "./string-coerce-DyL154ka.js";
2
+ import { t as resolveDaoCorePackageRoot } from "./daocore-root-CYblIxyF.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-738LMw6G.js";
7
+ import { r as theme } from "./theme-D58JpUfy.js";
8
+ import { n as inheritOptionFromParent } from "./command-options-Dhjl7AMa.js";
9
+ import "./daemon-cli-DclRZSJl.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-QmPt05QD.js";
16
+ import { a as resolveDefaultPluginNpmDir } from "./install-paths-wshgrJTh.js";
17
+ import { n as readPersistedInstalledPluginIndex } from "./installed-plugin-index-store-Dk2RlHPk.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-FS_seYnZ.js";
20
+ import { t as loadInstalledPluginIndexInstallRecords } from "./installed-plugin-index-record-reader-DFAIDyGb.js";
21
+ import { o as resolvePackageExtensionEntries } from "./manifest-B59xpnGE.js";
22
+ import { r as validatePackageExtensionEntriesForInstall } from "./package-entry-resolution-CW9yaev5.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-CHorChXr.js";
26
+ import { t as loadPluginManifestRegistryForInstalledIndex } from "./manifest-registry-installed-DS2dL8CS.js";
27
+ import { r as runCommandWithTimeout } from "./exec-BqPTmSqH.js";
28
+ import { F as asResolvedSourceConfig, I as asRuntimeConfig, K as createPreUpdateConfigSnapshot, o as parseConfigJson5, p as readSourceConfigBestEffort, u as readConfigFileSnapshot } from "./io-BAMe9xIp.js";
29
+ import { a as withPluginInstallRecords, o as withoutPluginInstallRecords } from "./installed-plugin-index-records-Bl3FZ0wP.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-C4xlcjwo.js";
33
+ import { r as mutateConfigFileWithRetry } from "./mutate-D96R6RZp.js";
34
+ import { n as quoteCmdScriptArg } from "./cmd-argv-fj4pRVR6.js";
35
+ import { r as getSelfAndAncestorPidsSync } from "./restart-stale-pids-CQAmGP81.js";
36
+ import { t as disableCurrentDaoCoreUpdateLaunchdJob } from "./launchd-QPD2y0Ch.js";
37
+ import { i as resolveGatewayRestartLogPath, n as renderPosixRestartLogSetup, o as shellEscapeRestartLogValue } from "./restart-logs-DHIuTlO-.js";
38
+ import "./config-D3DfZ5wH.js";
39
+ import { i as resolveGatewayService, r as readGatewayServiceState } from "./service-BJAo6V8n.js";
40
+ import { n as runDaemonInstall } from "./install-CWYMNUOH.js";
41
+ import { a as recoverInstalledLaunchAgent, t as runDaemonRestart } from "./lifecycle-Nr9wi826.js";
42
+ import { l as waitForGatewayHealthyRestart, o as renderRestartDiagnostics, s as terminateStaleGatewayPids } from "./restart-health-QOaGy9JH.js";
43
+ import { u as trimLogTail } from "./restart-sentinel-Du4en0Hw.js";
44
+ import { r as formatDurationPrecise } from "./format-duration-BrZ-AaEJ.js";
45
+ import { i as relinkDaoCorePeerDependenciesInManagedNpmRoot, n as auditDaoCorePeerDependencyLink } from "./plugin-peer-link-Bbj9bZaK.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-DG_8dlW2.js";
49
+ import { t as refreshPluginRegistryAfterConfigMutation } from "./plugins-registry-refresh-rnrnD9fM.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-DnT0XOWS.js";
54
+ import { n as readPackageName, r as readPackageVersion } from "./package-json-CIZcDaQ6.js";
55
+ import { a as fetchNpmTagVersion, i as fetchNpmPackageTargetStatus, n as compareSemverStrings, s as resolveNpmChannelTag, t as checkUpdateStatus } from "./update-check-C2LgvKYE.js";
56
+ import { i as resolveUpdateAvailability, n as formatUpdateOneLiner, t as formatUpdateAvailableHint } from "./status.update-It6LASlU.js";
57
+ import { i as normalizePackageTagInput, n as runGatewayUpdate, r as runGlobalPackageUpdateSteps } from "./update-runner-2pS-KlSn.js";
58
+ import { a as detectGlobalInstallManagerByPresence, d as resolveGlobalInstallTarget, i as createGlobalInstallEnv, m as resolvePnpmGlobalDirFromGlobalRoot, n as cleanupGlobalRenameDirs, o as detectGlobalInstallManagerForRoot, s as globalInstallArgs, t as canResolveRegistryVersionForPackageTarget, u as resolveGlobalInstallSpec } from "./update-global-ucSOAIga.js";
59
+ import { r as ensureCompletionCacheExists, t as checkShellCompletionStatus } from "./doctor-completion-pyXXj4oL.js";
60
+ import { t as doctorCommand } from "./doctor-Ce9osVgH.js";
61
+ 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-BZswmyl9.js";
62
+ import { t as summarizeGatewayServiceLayout } from "./service-layout-EdjNiu4j.js";
63
+ import { c as writeControlPlaneUpdateRestartSentinel, i as buildControlPlaneUpdateRestartHealthPendingResult, o as markControlPlaneUpdateRestartSentinelFailure, s as readControlPlaneUpdateSentinelMeta } from "./update-control-plane-sentinel-CHlpYBPO.js";
64
+ import { n as cleanupStaleManagedServiceUpdateHandoffs } from "./update-managed-service-handoff-cleanup-PGMcTNLe.js";
65
+ import { t as repairMissingConfiguredPluginInstalls } from "./missing-configured-plugin-install-PwdMzPHM.js";
66
+ import { n as pruneStaleLocalBundledPluginInstallRecords } from "./stale-local-bundled-plugin-install-records-CL2OEu4C.js";
67
+ import { t as selectStyled } from "./prompt-select-styled-Cp6-dKuR.js";
68
+ import fs, { existsSync } from "node:fs";
69
+ import path from "node:path";
70
+ import fs$1 from "node:fs/promises";
71
+ import os from "node:os";
72
+ import { execFile, spawn, spawnSync } from "node:child_process";
73
+ import { Writable } from "node:stream";
74
+ import { confirm, isCancel, spinner } from "@clack/prompts";
75
+ //#region src/cli/update-cli/shared.ts
76
+ const INVALID_TIMEOUT_ERROR = "--timeout must be a positive integer (seconds)";
77
+ function parseTimeoutMsOrExit(timeout) {
78
+ if (timeout === void 0) return;
79
+ const trimmed = timeout.trim();
80
+ const seconds = Number(trimmed);
81
+ if (!/^\d+$/u.test(trimmed) || !Number.isSafeInteger(seconds) || seconds <= 0) {
82
+ defaultRuntime.error(INVALID_TIMEOUT_ERROR);
83
+ defaultRuntime.exit(1);
84
+ return null;
85
+ }
86
+ return seconds * 1e3;
87
+ }
88
+ const DAOCORE_REPO_URL = "https://github.com/gaodefa/daocore-AI-assistant.git";
89
+ const MAX_LOG_CHARS = 8e3;
90
+ const DEFAULT_PACKAGE_NAME = "@gaodefa/daocore";
91
+ const CORE_PACKAGE_NAMES = new Set([DEFAULT_PACKAGE_NAME]);
92
+ function normalizeTag(value) {
93
+ return normalizePackageTagInput(value, ["daocore", DEFAULT_PACKAGE_NAME]);
94
+ }
95
+ function normalizeVersionTag(tag) {
96
+ const trimmed = tag.trim();
97
+ if (!trimmed) return null;
98
+ const cleaned = trimmed.startsWith("v") ? trimmed.slice(1) : trimmed;
99
+ return parseSemver(cleaned) ? cleaned : null;
100
+ }
101
+ async function resolveTargetVersion(tag, timeoutMs) {
102
+ if (!canResolveRegistryVersionForPackageTarget(tag)) return null;
103
+ const direct = normalizeVersionTag(tag);
104
+ if (direct) return direct;
105
+ return (await fetchNpmTagVersion({
106
+ tag,
107
+ timeoutMs
108
+ })).version ?? null;
109
+ }
110
+ async function isGitCheckout(root) {
111
+ try {
112
+ await fs$1.stat(path.join(root, ".git"));
113
+ return true;
114
+ } catch {
115
+ return false;
116
+ }
117
+ }
118
+ async function isCorePackage(root) {
119
+ const name = await readPackageName(root);
120
+ return Boolean(name && CORE_PACKAGE_NAMES.has(name));
121
+ }
122
+ async function isEmptyDir(targetPath) {
123
+ try {
124
+ return (await fs$1.readdir(targetPath)).length === 0;
125
+ } catch {
126
+ return false;
127
+ }
128
+ }
129
+ function resolveGitInstallDir() {
130
+ const override = process.env.DAOCORE_GIT_DIR?.trim();
131
+ if (override) return path.resolve(override);
132
+ return resolveDefaultGitDir();
133
+ }
134
+ function resolveDefaultGitDir() {
135
+ const home = os.homedir();
136
+ if (home.startsWith("/")) return path.posix.join(home, "daocore");
137
+ return path.join(home, "daocore");
138
+ }
139
+ function resolveNodeRunner() {
140
+ const base = normalizeLowercaseStringOrEmpty(path.basename(process.execPath));
141
+ if (base === "node" || base === "node.exe") return process.execPath;
142
+ return "node";
143
+ }
144
+ async function resolveUpdateRoot() {
145
+ return await resolveDaoCorePackageRoot({
146
+ moduleUrl: import.meta.url,
147
+ argv1: process.argv[1],
148
+ cwd: process.cwd()
149
+ }) ?? process.cwd();
150
+ }
151
+ async function runUpdateStep(params) {
152
+ const command = params.argv.join(" ");
153
+ params.progress?.onStepStart?.({
154
+ name: params.name,
155
+ command,
156
+ index: 0,
157
+ total: 0
158
+ });
159
+ const started = Date.now();
160
+ const res = await runCommandWithTimeout(params.argv, {
161
+ cwd: params.cwd,
162
+ env: params.env,
163
+ timeoutMs: params.timeoutMs
164
+ });
165
+ const durationMs = Date.now() - started;
166
+ const stderrTail = trimLogTail(res.stderr, MAX_LOG_CHARS);
167
+ params.progress?.onStepComplete?.({
168
+ name: params.name,
169
+ command,
170
+ index: 0,
171
+ total: 0,
172
+ durationMs,
173
+ exitCode: res.code,
174
+ stderrTail
175
+ });
176
+ return {
177
+ name: params.name,
178
+ command,
179
+ cwd: params.cwd ?? process.cwd(),
180
+ durationMs,
181
+ exitCode: res.code,
182
+ stdoutTail: trimLogTail(res.stdout, MAX_LOG_CHARS),
183
+ stderrTail
184
+ };
185
+ }
186
+ async function ensureGitCheckout(params) {
187
+ const gitEnv = params.env ?? await createGlobalInstallEnv();
188
+ if (!await pathExists$1(params.dir)) return await runUpdateStep({
189
+ name: "git clone",
190
+ argv: [
191
+ "git",
192
+ "clone",
193
+ DAOCORE_REPO_URL,
194
+ params.dir
195
+ ],
196
+ env: gitEnv,
197
+ timeoutMs: params.timeoutMs,
198
+ progress: params.progress
199
+ });
200
+ if (!await isGitCheckout(params.dir)) {
201
+ 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.`);
202
+ return await runUpdateStep({
203
+ name: "git clone",
204
+ argv: [
205
+ "git",
206
+ "clone",
207
+ DAOCORE_REPO_URL,
208
+ params.dir
209
+ ],
210
+ cwd: params.dir,
211
+ env: gitEnv,
212
+ timeoutMs: params.timeoutMs,
213
+ progress: params.progress
214
+ });
215
+ }
216
+ if (!await isCorePackage(params.dir)) throw new Error(`DAOCORE_GIT_DIR does not look like a core checkout: ${params.dir}.`);
217
+ return null;
218
+ }
219
+ async function resolveGlobalManager(params) {
220
+ const runCommand = createGlobalCommandRunner();
221
+ if (params.installKind === "package") {
222
+ const detected = await detectGlobalInstallManagerForRoot(runCommand, params.root, params.timeoutMs);
223
+ if (detected) return detected;
224
+ }
225
+ return await detectGlobalInstallManagerByPresence(runCommand, params.timeoutMs) ?? "npm";
226
+ }
227
+ const COMPLETION_CACHE_WRITE_TIMEOUT_MS = 3e4;
228
+ const COMPLETION_CACHE_MANUAL_REFRESH_HINT = "Shell tab-completion may be stale; refresh manually with: daocore completion --write-state";
229
+ async function tryWriteCompletionCache(root, jsonMode) {
230
+ const binPath = path.join(root, "daocore.mjs");
231
+ if (!await pathExists$1(binPath)) return;
232
+ const result = spawnSync(resolveNodeRunner(), [
233
+ binPath,
234
+ "completion",
235
+ "--write-state"
236
+ ], {
237
+ cwd: root,
238
+ env: {
239
+ ...process.env,
240
+ [COMPLETION_SKIP_PLUGIN_COMMANDS_ENV]: "1"
241
+ },
242
+ encoding: "utf-8",
243
+ timeout: COMPLETION_CACHE_WRITE_TIMEOUT_MS
244
+ });
245
+ if (result.error) {
246
+ if (!jsonMode) {
247
+ const reason = result.error.code === "ETIMEDOUT" ? `timed out after ${COMPLETION_CACHE_WRITE_TIMEOUT_MS / 1e3}s` : String(result.error);
248
+ defaultRuntime.log(theme.warn(`Completion cache update failed: ${reason}. ${COMPLETION_CACHE_MANUAL_REFRESH_HINT}`));
249
+ }
250
+ return;
251
+ }
252
+ if (result.status !== 0 && !jsonMode) {
253
+ const stderr = (result.stderr ?? "").trim();
254
+ const detail = stderr ? ` (${stderr})` : "";
255
+ defaultRuntime.log(theme.warn(`Completion cache update failed${detail}. ${COMPLETION_CACHE_MANUAL_REFRESH_HINT}`));
256
+ }
257
+ }
258
+ function createGlobalCommandRunner() {
259
+ return async (argv, options) => {
260
+ const res = await runCommandWithTimeout(argv, options);
261
+ return {
262
+ stdout: res.stdout,
263
+ stderr: res.stderr,
264
+ code: res.code
265
+ };
266
+ };
267
+ }
268
+ //#endregion
269
+ //#region src/cli/update-cli/status.ts
270
+ function formatGitStatusLine(params) {
271
+ const shortSha = params.sha ? params.sha.slice(0, 8) : null;
272
+ const branch = params.branch && params.branch !== "HEAD" ? params.branch : null;
273
+ const tag = params.tag;
274
+ return [
275
+ branch ?? (tag ? "detached" : "git"),
276
+ tag ? `tag ${tag}` : null,
277
+ shortSha ? `@ ${shortSha}` : null
278
+ ].filter(Boolean).join(" · ");
279
+ }
280
+ async function updateStatusCommand(opts) {
281
+ const timeoutMs = parseTimeoutMsOrExit(opts.timeout);
282
+ if (timeoutMs === null) return;
283
+ const root = await resolveUpdateRoot();
284
+ const configChannel = normalizeUpdateChannel((await readSourceConfigBestEffort()).update?.channel);
285
+ const update = await checkUpdateStatus({
286
+ root,
287
+ timeoutMs: timeoutMs ?? 3500,
288
+ fetchGit: true,
289
+ includeRegistry: true,
290
+ registryChannel: resolveRegistryUpdateChannel({
291
+ configChannel,
292
+ currentVersion: VERSION
293
+ })
294
+ });
295
+ const channelInfo = resolveUpdateChannelDisplay({
296
+ configChannel,
297
+ currentVersion: VERSION,
298
+ installKind: update.installKind,
299
+ gitTag: update.git?.tag ?? null,
300
+ gitBranch: update.git?.branch ?? null
301
+ });
302
+ const channelLabel = channelInfo.label;
303
+ const gitLabel = update.installKind === "git" ? formatGitStatusLine({
304
+ branch: update.git?.branch ?? null,
305
+ tag: update.git?.tag ?? null,
306
+ sha: update.git?.sha ?? null
307
+ }) : null;
308
+ const updateAvailability = resolveUpdateAvailability(update);
309
+ const updateLine = formatUpdateOneLiner(update).replace(/^Update:\s*/i, "");
310
+ if (opts.json) {
311
+ defaultRuntime.writeJson({
312
+ update,
313
+ channel: {
314
+ value: channelInfo.channel,
315
+ source: channelInfo.source,
316
+ label: channelLabel,
317
+ config: configChannel
318
+ },
319
+ availability: updateAvailability
320
+ });
321
+ return;
322
+ }
323
+ const tableWidth = getTerminalTableWidth();
324
+ const rows = [
325
+ {
326
+ Item: "Install",
327
+ Value: update.installKind === "git" ? `git (${update.root ?? "unknown"})` : update.installKind === "package" ? update.packageManager : "unknown"
328
+ },
329
+ {
330
+ Item: "Channel",
331
+ Value: channelLabel
332
+ },
333
+ ...gitLabel ? [{
334
+ Item: "Git",
335
+ Value: gitLabel
336
+ }] : [],
337
+ {
338
+ Item: "Update",
339
+ Value: updateAvailability.available ? theme.warn(`available · ${updateLine}`) : updateLine
340
+ }
341
+ ];
342
+ defaultRuntime.log(theme.heading("DaoCore update status"));
343
+ defaultRuntime.log("");
344
+ defaultRuntime.log(renderTable({
345
+ width: tableWidth,
346
+ columns: [{
347
+ key: "Item",
348
+ header: "Item",
349
+ minWidth: 10
350
+ }, {
351
+ key: "Value",
352
+ header: "Value",
353
+ flex: true,
354
+ minWidth: 24
355
+ }],
356
+ rows
357
+ }).trimEnd());
358
+ defaultRuntime.log("");
359
+ const updateHint = formatUpdateAvailableHint(update);
360
+ if (updateHint) defaultRuntime.log(theme.warn(updateHint));
361
+ }
362
+ //#endregion
363
+ //#region src/infra/disk-space.ts
364
+ const LOW_DISK_SPACE_WARNING_THRESHOLD_BYTES = 1024 * 1024 * 1024;
365
+ function finiteNonNegativeNumber(value) {
366
+ const numberValue = Number(value);
367
+ return Number.isFinite(numberValue) && numberValue >= 0 ? numberValue : null;
368
+ }
369
+ function findExistingDiskSpacePath(targetPath) {
370
+ let current = path.resolve(targetPath);
371
+ while (true) try {
372
+ return fs.statSync(current).isDirectory() ? current : path.dirname(current);
373
+ } catch {
374
+ const parent = path.dirname(current);
375
+ if (parent === current) return null;
376
+ current = parent;
377
+ }
378
+ }
379
+ function tryReadDiskSpace(targetPath) {
380
+ if (typeof fs.statfsSync !== "function") return null;
381
+ const checkedPath = findExistingDiskSpacePath(targetPath);
382
+ if (!checkedPath) return null;
383
+ try {
384
+ const stats = fs.statfsSync(checkedPath);
385
+ const blockSize = finiteNonNegativeNumber(stats.bsize);
386
+ const availableBlocks = finiteNonNegativeNumber(stats.bavail);
387
+ if (blockSize === null || availableBlocks === null) return null;
388
+ const totalBlocks = finiteNonNegativeNumber(stats.blocks);
389
+ return {
390
+ targetPath,
391
+ checkedPath,
392
+ availableBytes: blockSize * availableBlocks,
393
+ totalBytes: totalBlocks === null ? null : blockSize * totalBlocks
394
+ };
395
+ } catch {
396
+ return null;
397
+ }
398
+ }
399
+ function formatDiskSpaceBytes(bytes) {
400
+ const mib = bytes / (1024 * 1024);
401
+ if (mib < 1024) return `${Math.max(0, Math.round(mib))} MiB`;
402
+ const gib = mib / 1024;
403
+ return `${gib.toFixed(gib < 10 ? 1 : 0)} GiB`;
404
+ }
405
+ function createLowDiskSpaceWarning(params) {
406
+ const thresholdBytes = params.thresholdBytes ?? LOW_DISK_SPACE_WARNING_THRESHOLD_BYTES;
407
+ const snapshot = tryReadDiskSpace(params.targetPath);
408
+ if (!snapshot || snapshot.availableBytes >= thresholdBytes) return null;
409
+ 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.`;
410
+ }
411
+ //#endregion
412
+ //#region src/cli/plugins-location-bridges.ts
413
+ function buildBridgeFromPersistedBundledRecord(record, manifest) {
414
+ if (record.origin !== "bundled" || !record.enabled) return null;
415
+ const officialEntry = getOfficialExternalPluginCatalogEntry(record.pluginId);
416
+ const officialInstall = officialEntry ? resolveOfficialExternalPluginInstall(officialEntry) : null;
417
+ const npmSpec = officialInstall?.npmSpec?.trim() ?? record.packageInstall?.npm?.spec;
418
+ const clawhubSpec = officialInstall?.clawhubSpec?.trim();
419
+ if (!npmSpec && !clawhubSpec) return null;
420
+ const officialChannelId = officialEntry ? getOfficialExternalPluginCatalogManifest(officialEntry)?.channel?.id?.trim() : void 0;
421
+ const channelIds = manifest?.channels.length ? manifest.channels : officialChannelId ? [officialChannelId] : [];
422
+ return {
423
+ bundledPluginId: record.pluginId,
424
+ pluginId: record.pluginId,
425
+ preferredSource: officialInstall?.defaultChoice === "clawhub" && clawhubSpec ? "clawhub" : "npm",
426
+ ...npmSpec ? { npmSpec } : {},
427
+ ...clawhubSpec ? { clawhubSpec } : {},
428
+ ...record.enabledByDefault ? { enabledByDefault: true } : {},
429
+ ...channelIds.length ? { channelIds } : {}
430
+ };
431
+ }
432
+ async function listPersistedBundledPluginLocationBridges(options) {
433
+ const index = await readPersistedInstalledPluginIndex(options);
434
+ if (!index) return [];
435
+ const manifestRegistry = loadPluginManifestRegistryForInstalledIndex({
436
+ index,
437
+ workspaceDir: options.workspaceDir,
438
+ env: options.env,
439
+ includeDisabled: true
440
+ });
441
+ const manifestByPluginId = new Map(manifestRegistry.plugins.map((plugin) => [plugin.id, plugin]));
442
+ return index.plugins.flatMap((record) => {
443
+ const bridge = buildBridgeFromPersistedBundledRecord(record, manifestByPluginId.get(record.pluginId));
444
+ return bridge ? [bridge] : [];
445
+ });
446
+ }
447
+ //#endregion
448
+ //#region src/cli/update-cli/plugin-payload-validation.ts
449
+ const TRACKED_SOURCES = new Set([
450
+ "npm",
451
+ "clawhub",
452
+ "git",
453
+ "marketplace"
454
+ ]);
455
+ /**
456
+ * Verify that each tracked plugin install record on disk is structurally
457
+ * loadable: the install dir exists, contains a parseable `package.json`,
458
+ * and any declared package entry files exist.
459
+ *
460
+ * IMPORTANT: this is intentionally a *static* check. We do NOT execute the
461
+ * plugin's code, so post-update side effects (network calls, filesystem
462
+ * writes, registry registration) cannot fire while the gateway is still
463
+ * stopped. The goal is to catch obvious payload corruption — missing files,
464
+ * unparseable manifests — before we hand control back to the restart path.
465
+ */
466
+ async function runPluginPayloadSmokeCheck(params) {
467
+ const checked = [];
468
+ const failures = [];
469
+ for (const [pluginId, record] of Object.entries(params.records).toSorted(([a], [b]) => a.localeCompare(b))) {
470
+ if (!record || typeof record !== "object" || !TRACKED_SOURCES.has(record.source)) continue;
471
+ const rawInstallPath = typeof record.installPath === "string" ? record.installPath.trim() : "";
472
+ if (!rawInstallPath) {
473
+ checked.push(pluginId);
474
+ failures.push({
475
+ pluginId,
476
+ reason: "missing-install-path",
477
+ detail: "Install path is missing from the plugin install record."
478
+ });
479
+ continue;
480
+ }
481
+ const installPath = resolveUserPath(rawInstallPath, params.env);
482
+ checked.push(pluginId);
483
+ if (!(await safeStat(installPath))?.isDirectory()) {
484
+ failures.push({
485
+ pluginId,
486
+ installPath,
487
+ reason: "missing-package-dir",
488
+ detail: `Install dir is missing: ${installPath}`
489
+ });
490
+ continue;
491
+ }
492
+ const packageJsonPath = path.join(installPath, "package.json");
493
+ if (!(await safeStat(packageJsonPath))?.isFile()) {
494
+ failures.push({
495
+ pluginId,
496
+ installPath,
497
+ reason: "missing-package-json",
498
+ detail: `package.json is missing under ${installPath}`
499
+ });
500
+ continue;
501
+ }
502
+ let manifest;
503
+ try {
504
+ manifest = JSON.parse(await fs$1.readFile(packageJsonPath, "utf8"));
505
+ } catch (err) {
506
+ failures.push({
507
+ pluginId,
508
+ installPath,
509
+ reason: "invalid-package-json",
510
+ detail: `Could not parse package.json: ${err instanceof Error ? err.message : String(err)}`
511
+ });
512
+ continue;
513
+ }
514
+ if (manifestDeclaresDaoCorePeer(manifest)) {
515
+ const peerIssue = await auditDaoCorePeerDependencyLink({
516
+ packageDir: installPath,
517
+ packageName: manifest.name ?? pluginId
518
+ });
519
+ if (peerIssue) failures.push({
520
+ pluginId,
521
+ installPath,
522
+ reason: "missing-daocore-peer-link",
523
+ detail: `Plugin declares peerDependency "daocore" but peer link audit failed: ${peerIssue.reason}.`
524
+ });
525
+ }
526
+ const extensionResolution = resolvePackageExtensionEntries(manifest);
527
+ if (extensionResolution.status === "invalid" || extensionResolution.status === "empty") failures.push({
528
+ pluginId,
529
+ installPath,
530
+ reason: "missing-extension-entry",
531
+ detail: `Plugin extension entry validation failed: ${extensionResolution.status === "invalid" ? extensionResolution.error : "package.json daocore.extensions is empty"}`
532
+ });
533
+ else if (extensionResolution.status === "ok") {
534
+ const extensionValidation = await validatePackageExtensionEntriesForInstall({
535
+ packageDir: installPath,
536
+ extensions: extensionResolution.entries,
537
+ manifest
538
+ });
539
+ if (!extensionValidation.ok) failures.push({
540
+ pluginId,
541
+ installPath,
542
+ reason: "missing-extension-entry",
543
+ detail: `Plugin extension entry validation failed: ${extensionValidation.error}`
544
+ });
545
+ }
546
+ if (typeof manifest.main !== "string" || !manifest.main.trim()) continue;
547
+ const mainRel = manifest.main.trim();
548
+ const mainPath = path.join(installPath, mainRel);
549
+ if (!(await safeStat(mainPath))?.isFile()) failures.push({
550
+ pluginId,
551
+ installPath,
552
+ reason: "missing-main-entry",
553
+ detail: `Plugin main entry "${mainRel}" not found at ${mainPath}`
554
+ });
555
+ }
556
+ return {
557
+ checked,
558
+ failures
559
+ };
560
+ }
561
+ function manifestDeclaresDaoCorePeer(manifest) {
562
+ const peerDependencies = manifest.peerDependencies;
563
+ return typeof peerDependencies === "object" && peerDependencies !== null && !Array.isArray(peerDependencies) && typeof peerDependencies.daocore === "string";
564
+ }
565
+ async function safeStat(target) {
566
+ try {
567
+ return await fs$1.stat(target);
568
+ } catch {
569
+ return null;
570
+ }
571
+ }
572
+ //#endregion
573
+ //#region src/cli/update-cli/post-core-plugin-convergence.ts
574
+ const REPAIR_GUIDANCE = "Run `daocore doctor --fix` to retry plugin repair.";
575
+ const inspectGuidance = (pluginId) => `Run \`daocore plugins inspect ${pluginId} --runtime --json\` for details.`;
576
+ async function repairManagedNpmDaoCorePeerLinks(params) {
577
+ try {
578
+ const result = await relinkDaoCorePeerDependenciesInManagedNpmRoot({
579
+ npmRoot: resolveDefaultPluginNpmDir(params.env),
580
+ logger: {}
581
+ });
582
+ return {
583
+ changes: result.repaired > 0 ? [`Repaired DaoCore host peer link(s) for ${result.repaired} managed npm plugin package(s).`] : [],
584
+ warnings: []
585
+ };
586
+ } catch (err) {
587
+ const message = `Failed to repair managed npm DaoCore host peer links: ${err instanceof Error ? err.message : String(err)}`;
588
+ return {
589
+ changes: [],
590
+ warnings: [{
591
+ reason: message,
592
+ message,
593
+ guidance: [REPAIR_GUIDANCE]
594
+ }]
595
+ };
596
+ }
597
+ }
598
+ /**
599
+ * Mandatory post-core convergence pass. Runs AFTER the core package files
600
+ * are swapped and the in-update doctor pass has already returned, but BEFORE
601
+ * the gateway is restarted. Failures here must block the restart so we
602
+ * never restart with a configured plugin whose payload is unloadable.
603
+ */
604
+ async function runPostCorePluginConvergence(params) {
605
+ const env = {
606
+ ...params.env,
607
+ DAOCORE_COMPATIBILITY_HOST_VERSION: VERSION,
608
+ [UPDATE_POST_CORE_CONVERGENCE_ENV]: "1"
609
+ };
610
+ const prunedBaseline = params.baselineInstallRecords ? pruneStaleLocalBundledPluginInstallRecords({
611
+ installRecords: params.baselineInstallRecords,
612
+ env
613
+ }) : null;
614
+ const repair = await repairMissingConfiguredPluginInstalls({
615
+ cfg: params.cfg,
616
+ env,
617
+ ...prunedBaseline ? { baselineRecords: prunedBaseline.records } : {}
618
+ });
619
+ const warnings = repair.warnings.map((message) => ({
620
+ reason: message,
621
+ message,
622
+ guidance: [REPAIR_GUIDANCE]
623
+ }));
624
+ const peerLinkRepair = await repairManagedNpmDaoCorePeerLinks({ env });
625
+ warnings.push(...peerLinkRepair.warnings);
626
+ const records = repair.records;
627
+ const smoke = await runPluginPayloadSmokeCheck({
628
+ records: filterRecordsToActive({
629
+ cfg: params.cfg,
630
+ records
631
+ }),
632
+ env
633
+ });
634
+ for (const failure of smoke.failures) warnings.push({
635
+ pluginId: failure.pluginId,
636
+ reason: `${failure.reason}: ${failure.detail}`,
637
+ message: `Plugin "${failure.pluginId}" failed post-core payload smoke check (${failure.reason}): ${failure.detail}`,
638
+ guidance: [REPAIR_GUIDANCE, inspectGuidance(failure.pluginId)]
639
+ });
640
+ return {
641
+ changes: [
642
+ ...prunedBaseline?.stale.map((record) => `Removed stale local bundled plugin install record "${record.pluginId}".`) ?? [],
643
+ ...repair.changes,
644
+ ...peerLinkRepair.changes
645
+ ],
646
+ warnings,
647
+ errored: warnings.length > 0,
648
+ smokeFailures: smoke.failures,
649
+ installRecords: records
650
+ };
651
+ }
652
+ /**
653
+ * Drop install records that the gateway would never activate: disabled
654
+ * plugin entries, plugins listed in `plugins.deny`, etc. Records that
655
+ * resolve as a trusted-source-linked official install (npm or ClawHub)
656
+ * are retained even when the entry is disabled, mirroring the existing
657
+ * `collectMissingPluginInstallPayloads({ skipDisabledPlugins: true,
658
+ * syncOfficialPluginInstalls: true })` policy at
659
+ * `update-command.ts:~218`. We do NOT collapse to the configured plugin
660
+ * id set here — that would over-filter and miss e.g. providers/runtimes
661
+ * that are enabled implicitly via auth profiles or model refs. Effective
662
+ * enable state is the right precision boundary.
663
+ */
664
+ function filterRecordsToActive(params) {
665
+ const normalizedPluginConfig = normalizePluginsConfig(params.cfg.plugins);
666
+ const filtered = {};
667
+ for (const [pluginId, record] of Object.entries(params.records)) {
668
+ if (!record || typeof record !== "object") continue;
669
+ if (resolveEffectiveEnableState({
670
+ id: pluginId,
671
+ origin: "global",
672
+ config: normalizedPluginConfig,
673
+ rootConfig: params.cfg
674
+ }).enabled) {
675
+ filtered[pluginId] = record;
676
+ continue;
677
+ }
678
+ const officialNpm = resolveTrustedSourceLinkedOfficialNpmSpec({
679
+ pluginId,
680
+ record
681
+ });
682
+ const officialClawHub = resolveTrustedSourceLinkedOfficialClawHubSpec({
683
+ pluginId,
684
+ record
685
+ });
686
+ if (officialNpm || officialClawHub) filtered[pluginId] = record;
687
+ }
688
+ return filtered;
689
+ }
690
+ /**
691
+ * Pure helper used by `updatePluginsAfterCoreUpdate` to fold a convergence
692
+ * result into the existing `PluginUpdateOutcome[]` / warning shape that the
693
+ * post-core update result carries.
694
+ *
695
+ * Returns:
696
+ * - `outcomes` to append to `pluginUpdateOutcomes`. Only convergence
697
+ * warnings that name a `pluginId` produce per-plugin error outcomes; the
698
+ * rest are surfaced via `warnings`.
699
+ * - `errored` boolean that callers translate into `status: "error"`.
700
+ */
701
+ function convergenceWarningsToOutcomes(convergence) {
702
+ const outcomes = convergence.warnings.filter((w) => Boolean(w.pluginId)).map((w) => ({
703
+ pluginId: w.pluginId,
704
+ status: "error",
705
+ message: w.message
706
+ }));
707
+ return {
708
+ warnings: convergence.warnings,
709
+ outcomes,
710
+ errored: convergence.errored
711
+ };
712
+ }
713
+ //#endregion
714
+ //#region src/cli/update-cli/progress.ts
715
+ const STEP_LABELS = {
716
+ "clean check": "Working directory is clean",
717
+ "upstream check": "Upstream branch exists",
718
+ "git fetch": "Fetching latest changes",
719
+ "git rebase": "Rebasing onto target commit",
720
+ "git rev-parse @{upstream}": "Resolving upstream commit",
721
+ "git rev-list": "Enumerating candidate commits",
722
+ "git clone": "Cloning git checkout",
723
+ "preflight worktree": "Preparing preflight worktree",
724
+ "preflight cleanup": "Cleaning preflight worktree",
725
+ "deps install": "Installing dependencies",
726
+ build: "Building",
727
+ "ui:build": "Building UI assets",
728
+ "ui:build (post-doctor repair)": "Restoring missing UI assets",
729
+ "ui assets verify": "Validating UI assets",
730
+ "daocore doctor entry": "Checking doctor entrypoint",
731
+ "daocore doctor": "Running doctor checks",
732
+ "git rev-parse HEAD (after)": "Verifying update",
733
+ "global update": "Updating via package manager",
734
+ "global update (omit optional)": "Retrying update without optional deps",
735
+ "global install stage": "Preparing staged package install",
736
+ "global install verify": "Verifying global package",
737
+ "global install swap": "Activating global package",
738
+ "global install": "Installing global package"
739
+ };
740
+ function getStepLabel(step) {
741
+ return STEP_LABELS[step.name] ?? step.name;
742
+ }
743
+ function inferUpdateFailureHints(result) {
744
+ if (result.status !== "error") return [];
745
+ 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."];
746
+ 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."];
747
+ 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."];
748
+ 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."];
749
+ if (result.mode !== "npm") return [];
750
+ const failedStep = [...result.steps].toReversed().find((step) => step.exitCode !== 0);
751
+ if (!failedStep) return [];
752
+ const stderr = normalizeLowercaseStringOrEmpty(failedStep.stderrTail);
753
+ const hints = [];
754
+ if ((failedStep.name.startsWith("global update") || failedStep.name.startsWith("global install")) && stderr.includes("eacces")) {
755
+ hints.push("Detected permission failure (EACCES). Re-run with a writable global prefix or sudo (for system-managed Node installs).");
756
+ 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.");
757
+ hints.push("Example: npm config set prefix ~/.local && npm i -g daocore@latest");
758
+ hints.push("System install outline: daocore gateway stop -> sudo <system-npm> i -g daocore@latest -> daocore gateway install --force -> daocore gateway restart.");
759
+ }
760
+ if (failedStep.name.startsWith("global update") && (stderr.includes("node-gyp") || stderr.includes("prebuild"))) {
761
+ hints.push("Detected native optional dependency build failure. The updater retries with --omit=optional automatically.");
762
+ hints.push("If it still fails: npm i -g daocore@latest --omit=optional");
763
+ }
764
+ return hints;
765
+ }
766
+ function createUpdateProgress(enabled) {
767
+ if (!enabled) return {
768
+ progress: {},
769
+ stop: () => {}
770
+ };
771
+ let currentSpinner = null;
772
+ return {
773
+ progress: {
774
+ onStepStart: (step) => {
775
+ currentSpinner = spinner();
776
+ currentSpinner.start(theme.accent(getStepLabel(step)));
777
+ },
778
+ onStepComplete: (step) => {
779
+ if (!currentSpinner) return;
780
+ const label = getStepLabel(step);
781
+ const duration = theme.muted(`(${formatDurationPrecise(step.durationMs)})`);
782
+ const icon = step.exitCode === 0 ? theme.success("✓") : theme.error("✗");
783
+ currentSpinner.stop(`${icon} ${label} ${duration}`);
784
+ currentSpinner = null;
785
+ if (step.exitCode !== 0 && step.stderrTail) {
786
+ const lines = step.stderrTail.split("\n").slice(-10);
787
+ for (const line of lines) if (line.trim()) defaultRuntime.log(` ${theme.error(line)}`);
788
+ }
789
+ }
790
+ },
791
+ stop: () => {
792
+ if (currentSpinner) {
793
+ currentSpinner.stop();
794
+ currentSpinner = null;
795
+ }
796
+ }
797
+ };
798
+ }
799
+ function formatStepStatus(exitCode) {
800
+ if (exitCode === 0) return theme.success("✓");
801
+ if (exitCode === null) return theme.warn("?");
802
+ return theme.error("✗");
803
+ }
804
+ function printResult(result, opts) {
805
+ if (opts.json) {
806
+ defaultRuntime.writeJson(result);
807
+ return;
808
+ }
809
+ const statusColor = result.status === "ok" ? theme.success : result.status === "skipped" ? theme.warn : theme.error;
810
+ defaultRuntime.log("");
811
+ defaultRuntime.log(`${theme.heading("Update Result:")} ${statusColor(result.status.toUpperCase())}`);
812
+ if (result.root) defaultRuntime.log(` Root: ${theme.muted(result.root)}`);
813
+ if (result.reason) defaultRuntime.log(` Reason: ${theme.muted(result.reason)}`);
814
+ if (result.before?.version || result.before?.sha) {
815
+ const before = result.before.version ?? result.before.sha?.slice(0, 8) ?? "";
816
+ defaultRuntime.log(` Before: ${theme.muted(before)}`);
817
+ }
818
+ if (result.after?.version || result.after?.sha) {
819
+ const after = result.after.version ?? result.after.sha?.slice(0, 8) ?? "";
820
+ defaultRuntime.log(` After: ${theme.muted(after)}`);
821
+ }
822
+ if (!opts.hideSteps && result.steps.length > 0) {
823
+ defaultRuntime.log("");
824
+ defaultRuntime.log(theme.heading("Steps:"));
825
+ for (const step of result.steps) {
826
+ const status = formatStepStatus(step.exitCode);
827
+ const duration = theme.muted(`(${formatDurationPrecise(step.durationMs)})`);
828
+ defaultRuntime.log(` ${status} ${step.name} ${duration}`);
829
+ if (step.exitCode !== 0 && step.stderrTail) {
830
+ const lines = step.stderrTail.split("\n").slice(0, 5);
831
+ for (const line of lines) if (line.trim()) defaultRuntime.log(` ${theme.error(line)}`);
832
+ }
833
+ }
834
+ }
835
+ const hints = inferUpdateFailureHints(result);
836
+ if (hints.length > 0) {
837
+ defaultRuntime.log("");
838
+ defaultRuntime.log(theme.heading("Recovery hints:"));
839
+ for (const hint of hints) defaultRuntime.log(` - ${theme.warn(hint)}`);
840
+ }
841
+ defaultRuntime.log("");
842
+ defaultRuntime.log(`Total time: ${theme.muted(formatDurationPrecise(result.durationMs))}`);
843
+ }
844
+ //#endregion
845
+ //#region src/cli/update-cli/restart-helper.ts
846
+ /**
847
+ * Shell-escape a string for embedding in single-quoted shell arguments.
848
+ * Replaces every `'` with `'\''` (end quote, escaped quote, resume quote).
849
+ * For batch scripts, validates against special characters instead.
850
+ */
851
+ function shellEscape(value) {
852
+ return value.replace(/'/g, "'\\''");
853
+ }
854
+ /** Validates a task name is safe for embedding in Windows restart scripts. */
855
+ function isWindowsTaskNameSafe(value) {
856
+ return /^[A-Za-z0-9 _\-().]+$/.test(value);
857
+ }
858
+ function powerShellSingleQuote(value) {
859
+ return `'${value.replace(/'/g, "''")}'`;
860
+ }
861
+ function resolveSystemdUnit(env) {
862
+ const override = normalizeOptionalString(env.DAOCORE_SYSTEMD_UNIT);
863
+ if (override) return override.endsWith(".service") ? override : `${override}.service`;
864
+ return `${resolveGatewaySystemdServiceName(env.DAOCORE_PROFILE)}.service`;
865
+ }
866
+ function resolveLaunchdLabel(env) {
867
+ const override = normalizeOptionalString(env.DAOCORE_LAUNCHD_LABEL);
868
+ if (override) return override;
869
+ return resolveGatewayLaunchAgentLabel(env.DAOCORE_PROFILE);
870
+ }
871
+ function resolveWindowsTaskName(env) {
872
+ const override = env.DAOCORE_WINDOWS_TASK_NAME?.trim();
873
+ if (override) return override;
874
+ return resolveGatewayWindowsTaskName(env.DAOCORE_PROFILE);
875
+ }
876
+ /**
877
+ * Prepares a standalone script to restart the gateway service.
878
+ * This script is written to a temporary directory and does not depend on
879
+ * the installed package files, ensuring restart capability even if the
880
+ * update process temporarily removes or corrupts installation files.
881
+ */
882
+ async function prepareRestartScript(env = process.env, gatewayPort = DEFAULT_GATEWAY_PORT) {
883
+ const timestamp = Date.now();
884
+ const platform = process.platform;
885
+ let scriptContent = "";
886
+ let filename = "";
887
+ try {
888
+ if (platform === "linux") {
889
+ const escaped = shellEscape(resolveSystemdUnit(env));
890
+ const logSetup = renderPosixRestartLogSetup({
891
+ ...process.env,
892
+ ...env
893
+ });
894
+ filename = `daocore-restart-${timestamp}.sh`;
895
+ scriptContent = `#!/bin/sh
896
+ # Standalone restart script — survives parent process termination.
897
+ # Wait briefly to ensure file locks are released after update.
898
+ sleep 1
899
+ exec 3>&2
900
+ ${logSetup}
901
+ printf '[%s] daocore restart attempt source=update target=%s\\n' "$(date -u +%FT%TZ)" '${escaped}' >&2
902
+ if systemctl --user is-active --quiet '${escaped}' || systemctl --user is-enabled --quiet '${escaped}'; then
903
+ if systemctl --user restart '${escaped}'; then
904
+ status=0
905
+ printf '[%s] daocore restart done source=update\\n' "$(date -u +%FT%TZ)" >&2
906
+ else
907
+ status=$?
908
+ printf '[%s] daocore restart failed source=update status=%s\\n' "$(date -u +%FT%TZ)" "$status" >&2
909
+ fi
910
+ elif systemctl is-active --quiet '${escaped}' || systemctl is-enabled --quiet '${escaped}'; then
911
+ status=78
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}' >&2
913
+ 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
914
+ else
915
+ if systemctl --user restart '${escaped}'; then
916
+ status=0
917
+ printf '[%s] daocore restart done source=update\\n' "$(date -u +%FT%TZ)" >&2
918
+ else
919
+ status=$?
920
+ printf '[%s] daocore restart failed source=update status=%s\\n' "$(date -u +%FT%TZ)" "$status" >&2
921
+ fi
922
+ fi
923
+ # Self-cleanup
924
+ script_dir=$(dirname "$0")
925
+ exec 3>&-
926
+ rm -f "$0"
927
+ rmdir "$script_dir" 2>/dev/null || true
928
+ exit "$status"
929
+ `;
930
+ } else if (platform === "darwin") {
931
+ const label = resolveLaunchdLabel(env);
932
+ const escaped = shellEscape(label);
933
+ const uid = process.getuid ? process.getuid() : 501;
934
+ const home = normalizeOptionalString(env.HOME) || process.env.HOME || os.homedir();
935
+ const escapedPlistPath = shellEscape(path.join(home, "Library", "LaunchAgents", `${label}.plist`));
936
+ const logSetup = renderPosixRestartLogSetup({
937
+ ...process.env,
938
+ ...env
939
+ });
940
+ filename = `daocore-restart-${timestamp}.sh`;
941
+ scriptContent = `#!/bin/sh
942
+ # Standalone restart script — survives parent process termination.
943
+ # Wait briefly to ensure file locks are released after update.
944
+ sleep 1
945
+ # Capture launchctl output so bootstrap/kickstart failures leave a durable
946
+ # audit trail. Log setup is best-effort: restart must still run if the log path
947
+ # is temporarily unavailable.
948
+ ${logSetup}
949
+ printf '[%s] daocore restart attempt source=update target=%s\\n' "$(date -u +%FT%TZ)" '${shellEscapeRestartLogValue(label)}' >&2
950
+ # Try kickstart first (works when the service is still registered).
951
+ # If it fails (e.g. after bootout), clear any persisted disabled state,
952
+ # then re-register via bootstrap. Bootstrap loads RunAtLoad agents, so the
953
+ # fallback must not immediately kickstart -k the freshly spawned gateway.
954
+ # The final status is captured
955
+ # before self-cleanup so a genuine failure remains observable.
956
+ status=0
957
+ if ! launchctl kickstart -k 'gui/${uid}/${escaped}'; then
958
+ launchctl enable 'gui/${uid}/${escaped}'
959
+ if launchctl bootstrap 'gui/${uid}' '${escapedPlistPath}'; then
960
+ status=0
961
+ else
962
+ launchctl kickstart -k 'gui/${uid}/${escaped}'
963
+ status=$?
964
+ fi
965
+ fi
966
+ if [ "$status" -eq 0 ]; then
967
+ printf '[%s] daocore restart done source=update\\n' "$(date -u +%FT%TZ)" >&2
968
+ else
969
+ printf '[%s] daocore restart failed source=update status=%s\\n' "$(date -u +%FT%TZ)" "$status" >&2
970
+ fi
971
+ # Self-cleanup (log is retained under the DaoCore state logs directory).
972
+ script_dir=$(dirname "$0")
973
+ rm -f "$0"
974
+ rmdir "$script_dir" 2>/dev/null || true
975
+ exit "$status"
976
+ `;
977
+ } else if (platform === "win32") {
978
+ const taskName = resolveWindowsTaskName(env);
979
+ if (!isWindowsTaskNameSafe(taskName)) return null;
980
+ const port = Number.isFinite(gatewayPort) && gatewayPort > 0 ? gatewayPort : DEFAULT_GATEWAY_PORT;
981
+ const quotedLogPath = powerShellSingleQuote(resolveGatewayRestartLogPath({
982
+ ...process.env,
983
+ ...env
984
+ }));
985
+ const quotedTaskName = powerShellSingleQuote(taskName);
986
+ filename = `daocore-restart-${timestamp}.cmd`;
987
+ scriptContent = `@echo off
988
+ REM Standalone restart script - survives parent process termination.
989
+ REM Keep this as a cmd wrapper so Group Policy script execution policies
990
+ REM cannot block the update restart handoff before schtasks.exe runs.
991
+ setlocal
992
+ set "DAOCORE_RESTART_SCRIPT=%~f0"
993
+ set "DAOCORE_RESTART_SCRIPT_DIR=%~dp0."
994
+ 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)"
995
+ set "status=%ERRORLEVEL%"
996
+ del "%~f0" >nul 2>&1
997
+ rmdir "%DAOCORE_RESTART_SCRIPT_DIR%" >nul 2>&1
998
+ exit /b %status%
999
+ # POWERSHELL
1000
+ # Wait briefly to ensure file locks are released after update.
1001
+ $ErrorActionPreference = "Continue"
1002
+ Start-Sleep -Seconds 2
1003
+
1004
+ $logPath = ${quotedLogPath}
1005
+ try {
1006
+ $logDir = Split-Path -Parent $logPath
1007
+ New-Item -ItemType Directory -Path $logDir -Force | Out-Null
1008
+ Add-Content -LiteralPath $logPath -Value "[$(Get-Date -Format o)] daocore restart log initialized"
1009
+ } catch {
1010
+ # Restart should still run if log setup is unavailable.
1011
+ }
1012
+
1013
+ function Write-RestartLog {
1014
+ param([string]$Message)
1015
+ try {
1016
+ Add-Content -LiteralPath $logPath -Value "[$(Get-Date -Format o)] $Message"
1017
+ } catch {
1018
+ }
1019
+ }
1020
+
1021
+ function Join-DaoCoreProcessArguments {
1022
+ param([string[]]$Arguments)
1023
+ ($Arguments | ForEach-Object {
1024
+ if ($_ -match "\\s") {
1025
+ '"' + $_ + '"'
1026
+ } else {
1027
+ $_
1028
+ }
1029
+ }) -join " "
1030
+ }
1031
+
1032
+ function Invoke-DaoCoreSchtasksWithTimeout {
1033
+ param(
1034
+ [string[]]$Arguments,
1035
+ [int]$TimeoutSeconds
1036
+ )
1037
+ $process = $null
1038
+ try {
1039
+ $startInfo = [System.Diagnostics.ProcessStartInfo]::new()
1040
+ $startInfo.FileName = "schtasks.exe"
1041
+ $startInfo.Arguments = Join-DaoCoreProcessArguments -Arguments $Arguments
1042
+ $startInfo.UseShellExecute = $false
1043
+ $startInfo.RedirectStandardOutput = $true
1044
+ $startInfo.RedirectStandardError = $true
1045
+ $process = [System.Diagnostics.Process]::Start($startInfo)
1046
+ if (-not $process.WaitForExit($TimeoutSeconds * 1000)) {
1047
+ try {
1048
+ $process.Kill()
1049
+ } catch {
1050
+ }
1051
+ Write-RestartLog "daocore restart schtasks timeout source=update args=$($Arguments -join ' ')"
1052
+ return 124
1053
+ }
1054
+ $stdout = $process.StandardOutput.ReadToEnd()
1055
+ $stderr = $process.StandardError.ReadToEnd()
1056
+ if ($stdout) {
1057
+ Write-RestartLog $stdout.Trim()
1058
+ }
1059
+ if ($stderr) {
1060
+ Write-RestartLog $stderr.Trim()
1061
+ }
1062
+ return $process.ExitCode
1063
+ } catch {
1064
+ Write-RestartLog "daocore restart schtasks failed source=update args=$($Arguments -join ' ') error=$($_.Exception.Message)"
1065
+ return 1
1066
+ }
1067
+ }
1068
+
1069
+ function Get-DaoCoreScheduledTaskState {
1070
+ param([string]$TaskName)
1071
+ try {
1072
+ $task = Get-ScheduledTask -TaskName $TaskName -ErrorAction Stop
1073
+ if ($task -and $task.State) {
1074
+ return [string]$task.State
1075
+ }
1076
+ } catch {
1077
+ }
1078
+
1079
+ try {
1080
+ $queryOutput = & schtasks.exe /Query /TN $TaskName /FO LIST 2>$null
1081
+ foreach ($line in $queryOutput) {
1082
+ if ($line -match "^\\s*Status:\\s*(.+?)\\s*$") {
1083
+ return $Matches[1]
1084
+ }
1085
+ }
1086
+ } catch {
1087
+ }
1088
+
1089
+ return "Unknown"
1090
+ }
1091
+
1092
+ function Get-DaoCoreListenerPids {
1093
+ param([int]$Port)
1094
+ $listenerPids = @()
1095
+
1096
+ try {
1097
+ if (Get-Command Get-NetTCPConnection -ErrorAction SilentlyContinue) {
1098
+ $listenerPids += Get-NetTCPConnection -LocalPort $Port -State Listen -ErrorAction SilentlyContinue |
1099
+ ForEach-Object { [int]$_.OwningProcess }
1100
+ }
1101
+ } catch {
1102
+ }
1103
+
1104
+ if ($listenerPids.Count -eq 0) {
1105
+ try {
1106
+ $portPattern = [regex]::Escape(":$Port")
1107
+ $linePattern = "^\\s*TCP\\s+\\S+$portPattern\\s+\\S+\\s+LISTENING\\s+(\\d+)\\s*$"
1108
+ & netstat.exe -ano -p tcp 2>$null | ForEach-Object {
1109
+ if ($_ -match $linePattern) {
1110
+ $listenerPids += [int]$Matches[1]
1111
+ }
1112
+ }
1113
+ } catch {
1114
+ }
1115
+ }
1116
+
1117
+ $listenerPids | Sort-Object -Unique
1118
+ }
1119
+
1120
+ function Invoke-DaoCoreStartupLauncher {
1121
+ $launcherPath = Join-Path $env:USERPROFILE ".daocore\\gateway.cmd"
1122
+ if (-not (Test-Path -LiteralPath $launcherPath)) {
1123
+ Write-RestartLog "daocore restart startup launcher missing source=update path=$launcherPath"
1124
+ return 1
1125
+ }
1126
+
1127
+ try {
1128
+ Start-Process -FilePath $launcherPath -WindowStyle Hidden | Out-Null
1129
+ Write-RestartLog "daocore restart launched startup fallback source=update path=$launcherPath"
1130
+ return 0
1131
+ } catch {
1132
+ Write-RestartLog "daocore restart startup fallback failed source=update error=$($_.Exception.Message)"
1133
+ return 1
1134
+ }
1135
+ }
1136
+
1137
+ $taskName = ${quotedTaskName}
1138
+ $port = ${port}
1139
+ Write-RestartLog "daocore restart attempt source=update target=$taskName"
1140
+
1141
+ $taskState = Get-DaoCoreScheduledTaskState -TaskName $taskName
1142
+ if ($taskState -eq "Running") {
1143
+ $endStatus = Invoke-DaoCoreSchtasksWithTimeout -Arguments @("/End", "/TN", $taskName) -TimeoutSeconds 10
1144
+ if ($endStatus -ne 0) {
1145
+ Write-RestartLog "daocore restart schtasks end did not complete cleanly source=update status=$endStatus"
1146
+ }
1147
+ } else {
1148
+ Write-RestartLog "daocore restart skipped schtasks end source=update state=$taskState"
1149
+ }
1150
+
1151
+ for ($attempt = 1; $attempt -le 10; $attempt++) {
1152
+ $listeners = @(Get-DaoCoreListenerPids -Port $port)
1153
+ if ($listeners.Count -eq 0) {
1154
+ break
1155
+ }
1156
+
1157
+ if ($attempt -eq 10) {
1158
+ foreach ($listenerPid in $listeners) {
1159
+ try {
1160
+ Stop-Process -Id $listenerPid -Force -ErrorAction Stop
1161
+ Write-RestartLog "daocore restart killed stale listener source=update pid=$listenerPid"
1162
+ } catch {
1163
+ Write-RestartLog "daocore restart failed to kill stale listener source=update pid=$listenerPid error=$($_.Exception.Message)"
1164
+ }
1165
+ }
1166
+ break
1167
+ }
1168
+
1169
+ Start-Sleep -Seconds 1
1170
+ }
1171
+
1172
+ $status = Invoke-DaoCoreSchtasksWithTimeout -Arguments @("/Run", "/TN", $taskName) -TimeoutSeconds 30
1173
+ if ($status -ne 0) {
1174
+ $status = Invoke-DaoCoreStartupLauncher
1175
+ }
1176
+ if ($status -eq 0) {
1177
+ Write-RestartLog "daocore restart done source=update"
1178
+ } else {
1179
+ Write-RestartLog "daocore restart failed source=update status=$status"
1180
+ }
1181
+
1182
+ exit $status
1183
+ `;
1184
+ } else return null;
1185
+ const scriptDir = await fs$1.mkdtemp(path.join(os.tmpdir(), "daocore-restart-"));
1186
+ const scriptPath = path.join(scriptDir, filename);
1187
+ try {
1188
+ await fs$1.writeFile(scriptPath, scriptContent, {
1189
+ mode: 493,
1190
+ flag: "wx"
1191
+ });
1192
+ } catch (error) {
1193
+ await fs$1.rm(scriptDir, {
1194
+ recursive: true,
1195
+ force: true
1196
+ }).catch(() => {});
1197
+ throw error;
1198
+ }
1199
+ return scriptPath;
1200
+ } catch {
1201
+ return null;
1202
+ }
1203
+ }
1204
+ /**
1205
+ * Executes the prepared restart script as a **detached** process.
1206
+ *
1207
+ * The script must outlive the CLI process because the CLI itself is part
1208
+ * of the service being restarted — `systemctl restart` / `launchctl
1209
+ * kickstart -k` will terminate the current process tree. Using
1210
+ * `spawn({ detached: true })` + `unref()` ensures the script survives
1211
+ * the parent's exit.
1212
+ *
1213
+ * Resolves immediately after spawning; the script runs independently.
1214
+ */
1215
+ async function runRestartScript(scriptPath) {
1216
+ const isWindows = process.platform === "win32";
1217
+ spawn(isWindows ? "cmd.exe" : "/bin/sh", isWindows ? [
1218
+ "/d",
1219
+ "/s",
1220
+ "/c",
1221
+ quoteCmdScriptArg(scriptPath)
1222
+ ] : [scriptPath], {
1223
+ detached: true,
1224
+ stdio: "ignore",
1225
+ windowsHide: true
1226
+ }).unref();
1227
+ }
1228
+ //#endregion
1229
+ //#region src/cli/update-cli/suppress-deprecations.ts
1230
+ /**
1231
+ * Suppress Node.js deprecation warnings.
1232
+ *
1233
+ * On Node.js v23+ `process.noDeprecation` may be a read-only property
1234
+ * (defined via a getter on the prototype with no setter), so the
1235
+ * assignment can throw. We fall back to the environment variable which
1236
+ * achieves the same effect.
1237
+ */
1238
+ function suppressDeprecations() {
1239
+ try {
1240
+ process.noDeprecation = true;
1241
+ } catch {}
1242
+ process.env.NODE_NO_WARNINGS = "1";
1243
+ }
1244
+ //#endregion
1245
+ //#region src/cli/update-cli/update-command.ts
1246
+ const CLI_NAME = resolveCliName();
1247
+ const SERVICE_REFRESH_TIMEOUT_MS = 6e4;
1248
+ const POST_REFRESH_ALREADY_HEALTHY_ATTEMPTS = 10;
1249
+ const POST_REFRESH_ALREADY_HEALTHY_DELAY_MS = 500;
1250
+ const DEFAULT_UPDATE_STEP_TIMEOUT_MS = 30 * 6e4;
1251
+ const POST_CORE_UPDATE_ENV = "DAOCORE_UPDATE_POST_CORE";
1252
+ const POST_CORE_UPDATE_CHANNEL_ENV = "DAOCORE_UPDATE_POST_CORE_CHANNEL";
1253
+ const POST_CORE_UPDATE_REQUESTED_CHANNEL_ENV = "DAOCORE_UPDATE_POST_CORE_REQUESTED_CHANNEL";
1254
+ const POST_CORE_UPDATE_RESULT_PATH_ENV = "DAOCORE_UPDATE_POST_CORE_RESULT_PATH";
1255
+ const POST_CORE_UPDATE_INSTALL_RECORDS_PATH_ENV = "DAOCORE_UPDATE_POST_CORE_INSTALL_RECORDS_PATH";
1256
+ const POST_CORE_UPDATE_SOURCE_CONFIG_PATH_ENV = "DAOCORE_UPDATE_POST_CORE_SOURCE_CONFIG_PATH";
1257
+ const POST_CORE_UPDATE_STARTED_AT_ENV = "DAOCORE_UPDATE_POST_CORE_STARTED_AT_MS";
1258
+ const POST_CORE_UPDATE_RESULT_POLL_MS = 100;
1259
+ const PRE_UPDATE_CONFIG_SNAPSHOT_MAX_AGE_MS = 360 * 60 * 1e3;
1260
+ const SERVICE_REFRESH_PATH_ENV_KEYS = [
1261
+ "DAOCORE_HOME",
1262
+ "DAOCORE_STATE_DIR",
1263
+ "DAOCORE_CONFIG_PATH"
1264
+ ];
1265
+ const POST_INSTALL_DOCTOR_SERVICE_ENV_KEYS = [...SERVICE_REFRESH_PATH_ENV_KEYS, "DAOCORE_PROFILE"];
1266
+ const POST_UPDATE_PLUGIN_REPAIR_GUIDANCE = "Run daocore doctor --fix to attempt automatic repair.";
1267
+ const JSON_MODE_SERVICE_STDOUT = new Writable({ write(_chunk, _encoding, callback) {
1268
+ callback();
1269
+ } });
1270
+ async function createUpdateConfigSnapshot() {
1271
+ await createPreUpdateConfigSnapshot({
1272
+ configPath: CONFIG_PATH,
1273
+ fs: {
1274
+ writeFile: fs$1.writeFile,
1275
+ readFile: fs$1.readFile,
1276
+ existsSync
1277
+ }
1278
+ });
1279
+ }
1280
+ const UPDATE_QUIPS = [
1281
+ "Leveled up! New skills unlocked. You're welcome.",
1282
+ "Fresh code, same lobster. Miss me?",
1283
+ "Back and better. Did you even notice I was gone?",
1284
+ "Update complete. I learned some new tricks while I was out.",
1285
+ "Upgraded! Now with 23% more sass.",
1286
+ "I've evolved. Try to keep up.",
1287
+ "New version, who dis? Oh right, still me but shinier.",
1288
+ "Patched, polished, and ready to pinch. Let's go.",
1289
+ "The lobster has molted. Harder shell, sharper claws.",
1290
+ "Update done! Check the changelog or just trust me, it's good.",
1291
+ "Reborn from the boiling waters of npm. Stronger now.",
1292
+ "I went away and came back smarter. You should try it sometime.",
1293
+ "Update complete. The bugs feared me, so they left.",
1294
+ "New version installed. Old version sends its regards.",
1295
+ "Firmware fresh. Brain wrinkles: increased.",
1296
+ "I've seen things you wouldn't believe. Anyway, I'm updated.",
1297
+ "Back online. The changelog is long but our friendship is longer.",
1298
+ "Upgraded! Peter fixed stuff. Blame him if it breaks.",
1299
+ "Molting complete. Please don't look at my soft shell phase.",
1300
+ "Version bump! Same chaos energy, fewer crashes (probably)."
1301
+ ];
1302
+ function pickUpdateQuip() {
1303
+ return UPDATE_QUIPS[Math.floor(Math.random() * UPDATE_QUIPS.length)] ?? "Update complete.";
1304
+ }
1305
+ function isPackageManagerUpdateMode(mode) {
1306
+ return mode === "npm" || mode === "pnpm" || mode === "bun";
1307
+ }
1308
+ function isTrackedPackageInstallRecord(record) {
1309
+ return record.source === "npm" || record.source === "clawhub" || record.source === "git" || record.source === "marketplace";
1310
+ }
1311
+ function isRecord(value) {
1312
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1313
+ }
1314
+ function normalizePluginInstallRecordMap(value) {
1315
+ if (!isRecord(value)) return {};
1316
+ const records = {};
1317
+ 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);
1318
+ return records;
1319
+ }
1320
+ function normalizeChannelConfigMap(value) {
1321
+ if (!isRecord(value)) return null;
1322
+ return value;
1323
+ }
1324
+ function normalizeDirectAuthoredChannelConfigMap(value) {
1325
+ const channels = normalizeChannelConfigMap(value);
1326
+ if (!channels || Object.prototype.hasOwnProperty.call(channels, "$include")) return null;
1327
+ return channels;
1328
+ }
1329
+ function restorePreUpdateChannelModelOverrides(params) {
1330
+ if (params.restoredChannelIds.length === 0) return {
1331
+ channels: params.channels,
1332
+ changed: false
1333
+ };
1334
+ const preUpdateModelByChannel = normalizeChannelConfigMap(params.preUpdateChannels.modelByChannel);
1335
+ if (!preUpdateModelByChannel) return {
1336
+ channels: params.channels,
1337
+ changed: false
1338
+ };
1339
+ const currentModelByChannel = normalizeChannelConfigMap(params.channels.modelByChannel) ?? {};
1340
+ const restoredModelByChannel = structuredClone(currentModelByChannel);
1341
+ let changed = false;
1342
+ for (const [providerId, providerOverrides] of Object.entries(preUpdateModelByChannel)) {
1343
+ const preUpdateProviderOverrides = normalizeChannelConfigMap(providerOverrides);
1344
+ if (!preUpdateProviderOverrides) continue;
1345
+ const currentProviderOverrides = normalizeChannelConfigMap(restoredModelByChannel[providerId]) ?? {};
1346
+ let providerChanged = false;
1347
+ for (const channelId of params.restoredChannelIds) {
1348
+ if (currentProviderOverrides[channelId] !== void 0 || preUpdateProviderOverrides[channelId] === void 0) continue;
1349
+ currentProviderOverrides[channelId] = structuredClone(preUpdateProviderOverrides[channelId]);
1350
+ providerChanged = true;
1351
+ }
1352
+ if (providerChanged) {
1353
+ restoredModelByChannel[providerId] = currentProviderOverrides;
1354
+ changed = true;
1355
+ }
1356
+ }
1357
+ return changed ? {
1358
+ channels: {
1359
+ ...params.channels,
1360
+ modelByChannel: restoredModelByChannel
1361
+ },
1362
+ changed: true
1363
+ } : {
1364
+ channels: params.channels,
1365
+ changed: false
1366
+ };
1367
+ }
1368
+ function restoreDroppedPreUpdateChannels(snapshot, preUpdateConfig) {
1369
+ if (!snapshot.valid || !preUpdateConfig) return {
1370
+ snapshot,
1371
+ changed: false
1372
+ };
1373
+ const preUpdateChannels = normalizeChannelConfigMap(preUpdateConfig.sourceConfig.channels);
1374
+ if (!preUpdateChannels) return {
1375
+ snapshot,
1376
+ changed: false
1377
+ };
1378
+ let restoredChannels = { ...normalizeChannelConfigMap(snapshot.sourceConfig.channels) ?? {} };
1379
+ const restoredChannelIds = [];
1380
+ let restored = false;
1381
+ for (const [channelId, channelConfig] of Object.entries(preUpdateChannels)) {
1382
+ if (restoredChannels[channelId] !== void 0) continue;
1383
+ restoredChannels[channelId] = structuredClone(channelConfig);
1384
+ if (channelId !== "modelByChannel") restoredChannelIds.push(channelId);
1385
+ restored = true;
1386
+ }
1387
+ if (!restored) return {
1388
+ snapshot,
1389
+ changed: false
1390
+ };
1391
+ restoredChannels = restorePreUpdateChannelModelOverrides({
1392
+ channels: restoredChannels,
1393
+ preUpdateChannels,
1394
+ restoredChannelIds
1395
+ }).channels;
1396
+ const authoredChannels = resolveRestoredAuthoredChannels({
1397
+ currentChannels: snapshot.sourceConfig.channels,
1398
+ currentAuthoredChannels: isRecord(snapshot.parsed) ? snapshot.parsed.channels : snapshot.sourceConfig.channels,
1399
+ preUpdateAuthoredChannels: preUpdateConfig.authoredConfig.channels,
1400
+ restoredChannelIds
1401
+ });
1402
+ return {
1403
+ snapshot: {
1404
+ ...createUpdatedConfigSnapshot(snapshot, {
1405
+ ...snapshot.sourceConfig,
1406
+ channels: restoredChannels
1407
+ }),
1408
+ hash: snapshot.hash
1409
+ },
1410
+ changed: true,
1411
+ ...authoredChannels !== void 0 ? { authoredChannels } : {}
1412
+ };
1413
+ }
1414
+ function hasRestorablePreUpdateChannels(snapshot, preUpdateConfig) {
1415
+ if (!snapshot.valid) return false;
1416
+ const preUpdateChannels = normalizeChannelConfigMap(preUpdateConfig.sourceConfig.channels);
1417
+ if (!preUpdateChannels) return false;
1418
+ const postUpdateChannels = normalizeChannelConfigMap(snapshot.sourceConfig.channels) ?? {};
1419
+ return Object.keys(preUpdateChannels).some((channelId) => postUpdateChannels[channelId] === void 0);
1420
+ }
1421
+ function resolveRestoredAuthoredChannels(params) {
1422
+ if (params.preUpdateAuthoredChannels === void 0) return;
1423
+ const directAuthoredChannels = normalizeDirectAuthoredChannelConfigMap(params.preUpdateAuthoredChannels);
1424
+ if (!directAuthoredChannels) {
1425
+ const preUpdateAuthoredChannels = normalizeChannelConfigMap(params.preUpdateAuthoredChannels);
1426
+ if (!preUpdateAuthoredChannels) return;
1427
+ const currentDirectAuthoredChannels = normalizeDirectAuthoredChannelConfigMap(params.currentAuthoredChannels);
1428
+ if (currentDirectAuthoredChannels) return {
1429
+ ...structuredClone(preUpdateAuthoredChannels),
1430
+ ...structuredClone(currentDirectAuthoredChannels)
1431
+ };
1432
+ const currentAuthoredChannels = normalizeChannelConfigMap(params.currentAuthoredChannels);
1433
+ return !currentAuthoredChannels || Object.keys(currentAuthoredChannels).length === 0 ? structuredClone(preUpdateAuthoredChannels) : void 0;
1434
+ }
1435
+ const restoredChannels = { ...normalizeDirectAuthoredChannelConfigMap(params.currentAuthoredChannels) ?? normalizeDirectAuthoredChannelConfigMap(params.currentChannels) ?? {} };
1436
+ let changed = false;
1437
+ for (const channelId of params.restoredChannelIds) {
1438
+ if (restoredChannels[channelId] !== void 0 || directAuthoredChannels[channelId] === void 0) continue;
1439
+ restoredChannels[channelId] = structuredClone(directAuthoredChannels[channelId]);
1440
+ changed = true;
1441
+ }
1442
+ const restoredModelOverrides = restorePreUpdateChannelModelOverrides({
1443
+ channels: restoredChannels,
1444
+ preUpdateChannels: directAuthoredChannels,
1445
+ restoredChannelIds: params.restoredChannelIds
1446
+ });
1447
+ if (restoredModelOverrides.changed) return restoredModelOverrides.channels;
1448
+ return changed ? restoredChannels : void 0;
1449
+ }
1450
+ async function collectMissingPluginInstallPayloads(params) {
1451
+ const env = params.env ?? process.env;
1452
+ const normalizedPluginConfig = params.skipDisabledPlugins && params.config ? normalizePluginsConfig(params.config.plugins) : void 0;
1453
+ const missing = [];
1454
+ for (const [pluginId, record] of Object.entries(params.records).toSorted(([left], [right]) => left.localeCompare(right))) {
1455
+ if (!isTrackedPackageInstallRecord(record)) continue;
1456
+ const officialNpmSpec = params.syncOfficialPluginInstalls ? resolveTrustedSourceLinkedOfficialNpmSpec({
1457
+ pluginId,
1458
+ record
1459
+ }) : void 0;
1460
+ const officialClawHubSpec = params.syncOfficialPluginInstalls ? resolveTrustedSourceLinkedOfficialClawHubSpec({
1461
+ pluginId,
1462
+ record
1463
+ }) : void 0;
1464
+ if (normalizedPluginConfig && params.config) {
1465
+ if (!resolveEffectiveEnableState({
1466
+ id: pluginId,
1467
+ origin: "global",
1468
+ config: normalizedPluginConfig,
1469
+ rootConfig: params.config
1470
+ }).enabled && !officialNpmSpec && !officialClawHubSpec) continue;
1471
+ }
1472
+ const rawInstallPath = normalizeOptionalString(record.installPath);
1473
+ if (!rawInstallPath) {
1474
+ missing.push({
1475
+ pluginId,
1476
+ reason: "missing-install-path"
1477
+ });
1478
+ continue;
1479
+ }
1480
+ const installPath = resolveUserPath(rawInstallPath, env);
1481
+ if (!await pathExists(installPath)) {
1482
+ missing.push({
1483
+ pluginId,
1484
+ installPath,
1485
+ reason: "missing-package-dir"
1486
+ });
1487
+ continue;
1488
+ }
1489
+ if (!await pathExists(path.join(installPath, "package.json"))) missing.push({
1490
+ pluginId,
1491
+ installPath,
1492
+ reason: "missing-package-json"
1493
+ });
1494
+ }
1495
+ return missing;
1496
+ }
1497
+ function formatMissingPluginPayloadReason(entry) {
1498
+ if (entry.reason === "missing-install-path") return "installPath is missing";
1499
+ if (entry.reason === "missing-package-json") return `package.json is missing under ${entry.installPath}`;
1500
+ return `package directory is missing: ${entry.installPath}`;
1501
+ }
1502
+ function formatPostUpdatePluginInspectGuidance(pluginId) {
1503
+ return `Run daocore plugins inspect ${pluginId} --runtime --json for details.`;
1504
+ }
1505
+ function createPostUpdatePluginWarning(params) {
1506
+ const reason = params.reason.trim() || "unknown plugin post-update failure";
1507
+ const guidance = [POST_UPDATE_PLUGIN_REPAIR_GUIDANCE, ...params.pluginId ? [formatPostUpdatePluginInspectGuidance(params.pluginId)] : []];
1508
+ return {
1509
+ ...params.pluginId ? { pluginId: params.pluginId } : {},
1510
+ reason,
1511
+ 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(" ")}`,
1512
+ guidance
1513
+ };
1514
+ }
1515
+ function createGuidedPostUpdatePluginOutcome(outcome) {
1516
+ if (outcome.status !== "error" && !isDisabledAfterFailureOutcome(outcome)) return { outcome };
1517
+ const warning = createPostUpdatePluginWarning({
1518
+ ...outcome.pluginId && outcome.pluginId !== "unknown" ? { pluginId: outcome.pluginId } : {},
1519
+ reason: outcome.message
1520
+ });
1521
+ return {
1522
+ outcome: {
1523
+ ...outcome,
1524
+ message: warning.message
1525
+ },
1526
+ warning
1527
+ };
1528
+ }
1529
+ function isDisabledAfterFailureOutcome(outcome) {
1530
+ return outcome.status === "skipped" && outcome.message.includes("after plugin update failure");
1531
+ }
1532
+ /**
1533
+ * Build the post-core-update result we return when the active config cannot
1534
+ * even be parsed. Mandatory post-core convergence requires a parseable
1535
+ * config to know which plugins are configured; if one isn't available, we
1536
+ * refuse to restart the gateway and surface this as a hard error so the
1537
+ * existing `status === "error"` ⇒ `exit 1` pre-restart gate fires.
1538
+ *
1539
+ * Exported for unit testing without having to drive the entire
1540
+ * `updatePluginsAfterCoreUpdate` orchestrator.
1541
+ */
1542
+ function buildInvalidConfigPostCoreUpdateResult() {
1543
+ const guidance = ["Run `daocore doctor` to inspect the config validation errors.", "Once the config parses, rerun `daocore update`."];
1544
+ const message = "Plugin post-update convergence skipped because the config is invalid; refusing to restart the gateway with an unverified plugin set.";
1545
+ return {
1546
+ message,
1547
+ guidance,
1548
+ result: {
1549
+ status: "error",
1550
+ reason: "invalid-config",
1551
+ changed: false,
1552
+ sync: {
1553
+ changed: false,
1554
+ switchedToBundled: [],
1555
+ switchedToNpm: [],
1556
+ warnings: [],
1557
+ errors: []
1558
+ },
1559
+ npm: {
1560
+ changed: false,
1561
+ outcomes: []
1562
+ },
1563
+ integrityDrifts: [],
1564
+ warnings: [{
1565
+ reason: "invalid-config",
1566
+ message,
1567
+ guidance
1568
+ }]
1569
+ }
1570
+ };
1571
+ }
1572
+ function shouldPrepareUpdatedInstallRestart(params) {
1573
+ if (isPackageManagerUpdateMode(params.updateMode)) return params.serviceInstalled;
1574
+ return params.serviceLoaded;
1575
+ }
1576
+ function shouldUseLegacyProcessRestartAfterUpdate(params) {
1577
+ return !isPackageManagerUpdateMode(params.updateMode);
1578
+ }
1579
+ async function recoverInstalledLaunchAgentAfterUpdate(params) {
1580
+ if ((params.deps?.platform ?? process.platform) !== "darwin") return {
1581
+ attempted: false,
1582
+ recovered: false
1583
+ };
1584
+ const service = params.service ?? resolveGatewayService();
1585
+ const readState = params.deps?.readState ?? readGatewayServiceState;
1586
+ const recover = params.deps?.recover ?? recoverInstalledLaunchAgent;
1587
+ const state = await readState(service, { env: params.env }).catch(() => null);
1588
+ if (state?.loaded) return {
1589
+ attempted: false,
1590
+ recovered: false
1591
+ };
1592
+ if (state && !state.installed && !state.runtime?.missingSupervision) return {
1593
+ attempted: false,
1594
+ recovered: false
1595
+ };
1596
+ const recovered = await recover({
1597
+ result: "restarted",
1598
+ env: state?.env ?? params.env
1599
+ }).catch(() => null);
1600
+ if (!recovered) return {
1601
+ attempted: true,
1602
+ recovered: false,
1603
+ detail: "LaunchAgent was installed but not loaded; automatic bootstrap/kickstart recovery failed."
1604
+ };
1605
+ return {
1606
+ attempted: true,
1607
+ recovered: true,
1608
+ message: recovered.message
1609
+ };
1610
+ }
1611
+ async function recoverLaunchAgentAndRecheckGatewayHealth(params) {
1612
+ if (params.health.healthy) return {
1613
+ health: params.health,
1614
+ launchAgentRecovery: null
1615
+ };
1616
+ const launchAgentRecovery = await (params.deps?.recoverLaunchAgent ?? recoverInstalledLaunchAgentAfterUpdate)({
1617
+ service: params.service,
1618
+ env: params.env
1619
+ });
1620
+ if (!launchAgentRecovery.recovered) return {
1621
+ health: params.health,
1622
+ launchAgentRecovery
1623
+ };
1624
+ return {
1625
+ health: await (params.deps?.waitForHealthy ?? waitForGatewayHealthyRestart)({
1626
+ service: params.service,
1627
+ port: params.port,
1628
+ expectedVersion: params.expectedVersion,
1629
+ env: params.env
1630
+ }),
1631
+ launchAgentRecovery
1632
+ };
1633
+ }
1634
+ function formatPostUpdateGatewayRecoveryLine(platform) {
1635
+ const restartCommand = replaceCliName(formatCliCommand("daocore gateway restart"), CLI_NAME);
1636
+ const installCommand = replaceCliName(formatCliCommand("daocore gateway install --force"), CLI_NAME);
1637
+ const statusCommand = replaceCliName(formatCliCommand("daocore gateway status --deep"), CLI_NAME);
1638
+ 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}\`.`;
1639
+ 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}\`.`;
1640
+ 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}\`.`;
1641
+ 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}\`.`;
1642
+ }
1643
+ function formatPostUpdateGatewayRecoveryInstructions(result, platform = process.platform) {
1644
+ const lines = [formatPostUpdateGatewayRecoveryLine(platform)];
1645
+ const beforeVersion = normalizeOptionalString(result.before?.version);
1646
+ 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)}\`.`);
1647
+ return lines;
1648
+ }
1649
+ function formatGatewayAncestryBlockMessage(pid) {
1650
+ return `daocore update detected it is running inside the gateway process tree.
1651
+ Gateway PID ${pid} is an ancestor of this process, so this updater cannot safely stop or restart the gateway that owns it.
1652
+ Run \`${replaceCliName(formatCliCommand("daocore update"), CLI_NAME)}\` from a shell outside the gateway service, or stop the gateway service first and then update.`;
1653
+ }
1654
+ function parsePositivePid(value) {
1655
+ if (typeof value === "number" && Number.isFinite(value) && value > 0) return Math.floor(value);
1656
+ if (typeof value !== "string") return null;
1657
+ const trimmed = value.trim();
1658
+ if (!/^\d+$/u.test(trimmed)) return null;
1659
+ const parsed = Number.parseInt(trimmed, 10);
1660
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : null;
1661
+ }
1662
+ function isInheritedGatewayRuntimePid(pid, env = process.env) {
1663
+ if (!isRunningInsideGatewayService(env)) return false;
1664
+ return parsePositivePid(env[GATEWAY_SERVICE_RUNTIME_PID_ENV]) === pid;
1665
+ }
1666
+ function isGatewayAncestorPid(pid, env = process.env) {
1667
+ const parsed = parsePositivePid(pid);
1668
+ if (parsed === null) return false;
1669
+ return isInheritedGatewayRuntimePid(parsed, env) || getSelfAndAncestorPidsSync().has(parsed);
1670
+ }
1671
+ function gatewayAncestryBlockMessage(pid) {
1672
+ return isGatewayAncestorPid(pid) ? formatGatewayAncestryBlockMessage(pid) : void 0;
1673
+ }
1674
+ function gatewayRuntimeAncestryBlockMessage(runtime) {
1675
+ return gatewayAncestryBlockMessage(runtime?.pid);
1676
+ }
1677
+ function serviceControlStdoutForMode(jsonMode) {
1678
+ return jsonMode ? JSON_MODE_SERVICE_STDOUT : process.stdout;
1679
+ }
1680
+ async function maybeStopManagedServiceBeforePackageUpdate(params) {
1681
+ let service;
1682
+ let serviceState;
1683
+ try {
1684
+ service = resolveGatewayService();
1685
+ serviceState = await readGatewayServiceState(service, { env: process.env });
1686
+ } catch {
1687
+ return {
1688
+ stopped: false,
1689
+ inspected: false,
1690
+ runtimeInspected: false,
1691
+ running: false
1692
+ };
1693
+ }
1694
+ const runtimeStatus = serviceState.runtime?.status;
1695
+ const runtimeInspected = runtimeStatus === "running" || runtimeStatus === "stopped";
1696
+ if (!serviceState.installed) return {
1697
+ stopped: false,
1698
+ inspected: true,
1699
+ runtimeInspected,
1700
+ running: serviceState.running,
1701
+ serviceEnv: serviceState.env
1702
+ };
1703
+ if (!params.shouldRestart) {
1704
+ 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."));
1705
+ return {
1706
+ stopped: false,
1707
+ inspected: true,
1708
+ runtimeInspected,
1709
+ running: serviceState.running,
1710
+ serviceEnv: serviceState.env
1711
+ };
1712
+ }
1713
+ if (!runtimeInspected) return {
1714
+ stopped: false,
1715
+ inspected: true,
1716
+ runtimeInspected: false,
1717
+ running: false,
1718
+ serviceEnv: serviceState.env
1719
+ };
1720
+ if (!serviceState.running) return {
1721
+ stopped: false,
1722
+ inspected: true,
1723
+ runtimeInspected: true,
1724
+ running: false,
1725
+ serviceEnv: serviceState.env
1726
+ };
1727
+ const blockMessage = gatewayRuntimeAncestryBlockMessage(serviceState.runtime);
1728
+ if (blockMessage) return {
1729
+ stopped: false,
1730
+ inspected: true,
1731
+ runtimeInspected: true,
1732
+ running: true,
1733
+ blockMessage,
1734
+ serviceEnv: serviceState.env
1735
+ };
1736
+ if (!params.jsonMode) defaultRuntime.log(theme.muted("Stopping managed gateway service before package update..."));
1737
+ await service.stop({
1738
+ env: serviceState.env,
1739
+ stdout: serviceControlStdoutForMode(params.jsonMode)
1740
+ });
1741
+ return {
1742
+ stopped: true,
1743
+ inspected: true,
1744
+ runtimeInspected: true,
1745
+ running: true,
1746
+ serviceEnv: serviceState.env
1747
+ };
1748
+ }
1749
+ async function maybeRestartServiceAfterFailedPackageUpdate(params) {
1750
+ if (!params.prePackageServiceStop?.stopped || !params.prePackageServiceStop.serviceEnv) return;
1751
+ try {
1752
+ await resolveGatewayService().restart({
1753
+ env: params.prePackageServiceStop.serviceEnv,
1754
+ stdout: serviceControlStdoutForMode(params.jsonMode)
1755
+ });
1756
+ if (!params.jsonMode) defaultRuntime.log(theme.muted("Restarted managed gateway service after failed update."));
1757
+ } catch (err) {
1758
+ const message = `Failed to restart managed gateway service after failed update: ${String(err)}`;
1759
+ if (params.jsonMode) defaultRuntime.error(message);
1760
+ else defaultRuntime.log(theme.warn(message));
1761
+ }
1762
+ }
1763
+ function isRunningInsideGatewayService(env = process.env) {
1764
+ if (env.DAOCORE_SERVICE_MARKER?.trim() !== "daocore") return false;
1765
+ const serviceKind = env.DAOCORE_SERVICE_KIND?.trim();
1766
+ return !serviceKind || serviceKind === "gateway";
1767
+ }
1768
+ function shouldBlockPackageUpdateFromGatewayServiceEnv(params) {
1769
+ if (!isRunningInsideGatewayService()) return false;
1770
+ const stopState = params.prePackageServiceStop;
1771
+ if (!stopState?.inspected) return true;
1772
+ if (stopState.stopped) return false;
1773
+ if (!stopState.runtimeInspected) return true;
1774
+ return stopState.running;
1775
+ }
1776
+ function formatCommandFailure(stdout, stderr) {
1777
+ const detail = (stderr || stdout).trim();
1778
+ if (!detail) return "command returned a non-zero exit code";
1779
+ return detail.split("\n").slice(-3).join("\n");
1780
+ }
1781
+ function tryResolveInvocationCwd() {
1782
+ try {
1783
+ return process.cwd();
1784
+ } catch {
1785
+ return;
1786
+ }
1787
+ }
1788
+ async function resolvePackageRuntimePreflightError(params) {
1789
+ if (!canResolveRegistryVersionForPackageTarget(params.tag)) return null;
1790
+ const target = params.tag.trim();
1791
+ if (!target) return null;
1792
+ const status = await fetchNpmPackageTargetStatus({
1793
+ target,
1794
+ timeoutMs: params.timeoutMs
1795
+ });
1796
+ if (status.error) return null;
1797
+ const runtime = await resolvePackageRuntimeForPreflight({
1798
+ nodeRunner: params.nodeRunner,
1799
+ timeoutMs: params.timeoutMs
1800
+ });
1801
+ if (nodeVersionSatisfiesEngine(runtime.version, status.nodeEngine) !== false) return null;
1802
+ const targetLabel = status.version ?? target;
1803
+ return [
1804
+ `${runtime.nodeRunner ? `Node ${runtime.version ?? "unknown"} at ${runtime.nodeRunner}` : `Node ${runtime.version ?? "unknown"}`} is too old for daocore@${targetLabel}.`,
1805
+ `The requested package requires ${status.nodeEngine}.`,
1806
+ 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`.",
1807
+ "Bare `npm i -g daocore` can silently install an older compatible release.",
1808
+ "After upgrading Node, use `npm i -g daocore@latest`."
1809
+ ].join("\n");
1810
+ }
1811
+ async function resolvePackageRuntimeForPreflight(params) {
1812
+ const nodeRunner = normalizeOptionalString(params.nodeRunner);
1813
+ if (!nodeRunner) return { version: process.versions.node ?? null };
1814
+ const res = await runCommandWithTimeout([nodeRunner, "--version"], { timeoutMs: Math.min(params.timeoutMs ?? 1e4, 1e4) }).catch(() => null);
1815
+ return {
1816
+ version: (res?.code === 0 ? res.stdout.trim() : "").replace(/^v/u, "") || null,
1817
+ nodeRunner
1818
+ };
1819
+ }
1820
+ function resolveServiceRefreshEnv(env, invocationCwd) {
1821
+ const resolvedEnv = { ...env };
1822
+ for (const key of SERVICE_REFRESH_PATH_ENV_KEYS) {
1823
+ const rawValue = resolvedEnv[key]?.trim();
1824
+ if (!rawValue) continue;
1825
+ if (rawValue.startsWith("~") || path.isAbsolute(rawValue) || path.win32.isAbsolute(rawValue)) {
1826
+ resolvedEnv[key] = rawValue;
1827
+ continue;
1828
+ }
1829
+ if (!invocationCwd) {
1830
+ resolvedEnv[key] = rawValue;
1831
+ continue;
1832
+ }
1833
+ resolvedEnv[key] = path.resolve(invocationCwd, rawValue);
1834
+ }
1835
+ return resolvedEnv;
1836
+ }
1837
+ function disableUpdatedPackageCompileCacheEnv(env) {
1838
+ return {
1839
+ ...env,
1840
+ NODE_DISABLE_COMPILE_CACHE: "1"
1841
+ };
1842
+ }
1843
+ function stripGatewayServiceMarkerEnv(env) {
1844
+ const resolvedEnv = { ...env };
1845
+ delete resolvedEnv.DAOCORE_SERVICE_MARKER;
1846
+ delete resolvedEnv.DAOCORE_SERVICE_KIND;
1847
+ delete resolvedEnv[GATEWAY_SERVICE_RUNTIME_PID_ENV];
1848
+ return resolvedEnv;
1849
+ }
1850
+ function resolveUpdatedInstallCommandEnv(env, invocationCwd) {
1851
+ return disableUpdatedPackageCompileCacheEnv(resolveServiceRefreshEnv(env, invocationCwd));
1852
+ }
1853
+ function resolvePostInstallDoctorEnv(params) {
1854
+ const resolvedEnv = disableUpdatedPackageCompileCacheEnv(params?.baseEnv ?? process.env);
1855
+ if (!params?.serviceEnv) return resolvedEnv;
1856
+ const serviceEnv = resolveServiceRefreshEnv(params.serviceEnv, params.invocationCwd);
1857
+ for (const key of POST_INSTALL_DOCTOR_SERVICE_ENV_KEYS) if (serviceEnv[key]?.trim()) resolvedEnv[key] = serviceEnv[key];
1858
+ return resolvedEnv;
1859
+ }
1860
+ function resolveUpdatedGatewayRestartPort(params) {
1861
+ return resolveGatewayPort(params.config, params.serviceEnv ?? params.processEnv ?? process.env);
1862
+ }
1863
+ function resolvePostUpdateServiceStateReadEnv(params) {
1864
+ if (isPackageManagerUpdateMode(params.updateMode) && params.prePackageServiceEnv) return params.prePackageServiceEnv;
1865
+ return params.processEnv ?? process.env;
1866
+ }
1867
+ function printDryRunPreview(preview, jsonMode) {
1868
+ if (jsonMode) {
1869
+ defaultRuntime.writeJson(preview);
1870
+ return;
1871
+ }
1872
+ defaultRuntime.log(theme.heading("Update dry-run"));
1873
+ defaultRuntime.log(theme.muted("No changes were applied."));
1874
+ defaultRuntime.log("");
1875
+ defaultRuntime.log(` Root: ${theme.muted(preview.root)}`);
1876
+ defaultRuntime.log(` Install kind: ${theme.muted(preview.installKind)}`);
1877
+ defaultRuntime.log(` Mode: ${theme.muted(preview.mode)}`);
1878
+ defaultRuntime.log(` Channel: ${theme.muted(preview.effectiveChannel)}`);
1879
+ defaultRuntime.log(` Tag/spec: ${theme.muted(preview.tag)}`);
1880
+ if (preview.currentVersion) defaultRuntime.log(` Current version: ${theme.muted(preview.currentVersion)}`);
1881
+ if (preview.targetVersion) defaultRuntime.log(` Target version: ${theme.muted(preview.targetVersion)}`);
1882
+ if (preview.downgradeRisk) defaultRuntime.log(theme.warn(" Downgrade confirmation would be required in a real run."));
1883
+ defaultRuntime.log("");
1884
+ defaultRuntime.log(theme.heading("Planned actions:"));
1885
+ for (const action of preview.actions) defaultRuntime.log(` - ${action}`);
1886
+ if (preview.notes.length > 0) {
1887
+ defaultRuntime.log("");
1888
+ defaultRuntime.log(theme.heading("Notes:"));
1889
+ for (const note of preview.notes) defaultRuntime.log(` - ${theme.muted(note)}`);
1890
+ }
1891
+ }
1892
+ async function refreshGatewayServiceEnv(params) {
1893
+ const args = [
1894
+ "gateway",
1895
+ "install",
1896
+ "--force"
1897
+ ];
1898
+ if (params.jsonMode) args.push("--json");
1899
+ const entrypoint = await resolveGatewayInstallEntrypoint(params.result.root);
1900
+ if (entrypoint) {
1901
+ const res = await runCommandWithTimeout([
1902
+ params.nodeRunner ?? resolveNodeRunner(),
1903
+ entrypoint,
1904
+ ...args
1905
+ ], {
1906
+ cwd: params.result.root,
1907
+ env: resolveUpdatedInstallCommandEnv(params.env ?? process.env, params.invocationCwd),
1908
+ timeoutMs: SERVICE_REFRESH_TIMEOUT_MS
1909
+ });
1910
+ if (res.code === 0) return;
1911
+ throw new Error(`updated install refresh failed (${entrypoint}): ${formatCommandFailure(res.stdout, res.stderr)}`);
1912
+ }
1913
+ if (isPackageManagerUpdateMode(params.result.mode)) throw new Error(`updated install entrypoint not found under ${params.result.root ?? "unknown"}`);
1914
+ await runDaemonInstall({
1915
+ force: true,
1916
+ json: params.jsonMode || void 0
1917
+ });
1918
+ }
1919
+ async function runUpdatedInstallGatewayRestart(params) {
1920
+ const entrypoint = await resolveGatewayInstallEntrypoint(params.result.root);
1921
+ if (!entrypoint) throw new Error(`updated install entrypoint not found under ${params.result.root ?? "unknown"}`);
1922
+ const args = ["gateway", "restart"];
1923
+ if (params.jsonMode) args.push("--json");
1924
+ const res = await runCommandWithTimeout([
1925
+ params.nodeRunner ?? resolveNodeRunner(),
1926
+ entrypoint,
1927
+ ...args
1928
+ ], {
1929
+ cwd: params.result.root,
1930
+ env: resolveUpdatedInstallCommandEnv(params.env ?? process.env, params.invocationCwd),
1931
+ timeoutMs: SERVICE_REFRESH_TIMEOUT_MS
1932
+ });
1933
+ if (res.code === 0) return true;
1934
+ throw new Error(`updated install restart failed (${entrypoint}): ${formatCommandFailure(res.stdout, res.stderr)}`);
1935
+ }
1936
+ async function tryInstallShellCompletion(opts) {
1937
+ if (opts.jsonMode || !process.stdin.isTTY) return;
1938
+ const status = await checkShellCompletionStatus(CLI_NAME);
1939
+ if (status.usesSlowPattern) {
1940
+ defaultRuntime.log(theme.muted("Upgrading shell completion to cached version..."));
1941
+ if (await ensureCompletionCacheExists(CLI_NAME)) await installCompletion(status.shell, true, CLI_NAME);
1942
+ return;
1943
+ }
1944
+ if (status.profileInstalled && !status.cacheExists) {
1945
+ defaultRuntime.log(theme.muted("Regenerating shell completion cache..."));
1946
+ await ensureCompletionCacheExists(CLI_NAME);
1947
+ return;
1948
+ }
1949
+ if (!status.profileInstalled) {
1950
+ defaultRuntime.log("");
1951
+ defaultRuntime.log(theme.heading("Shell completion"));
1952
+ const shouldInstall = await confirm({
1953
+ message: stylePromptMessage(`Enable ${status.shell} shell completion for ${CLI_NAME}?`),
1954
+ initialValue: true
1955
+ });
1956
+ if (isCancel(shouldInstall) || !shouldInstall) {
1957
+ if (!opts.skipPrompt) defaultRuntime.log(theme.muted(`Skipped. Run \`${replaceCliName(formatCliCommand("daocore completion --install"), CLI_NAME)}\` later to enable.`));
1958
+ return;
1959
+ }
1960
+ if (!await ensureCompletionCacheExists(CLI_NAME)) {
1961
+ defaultRuntime.log(theme.warn("Failed to generate completion cache."));
1962
+ return;
1963
+ }
1964
+ await installCompletion(status.shell, opts.skipPrompt, CLI_NAME);
1965
+ }
1966
+ }
1967
+ async function tryRealpathOrResolve(value) {
1968
+ try {
1969
+ return await fs$1.realpath(path.resolve(value));
1970
+ } catch {
1971
+ return path.resolve(value);
1972
+ }
1973
+ }
1974
+ function isNodeExecutable(value) {
1975
+ const base = normalizeOptionalString(value ? path.basename(value) : void 0)?.toLowerCase();
1976
+ return base === "node" || base === "node.exe";
1977
+ }
1978
+ function resolveManagedServiceNodeRunner(command) {
1979
+ const args = command?.programArguments;
1980
+ if (!args?.length) return;
1981
+ const gatewayIndex = args.indexOf("gateway");
1982
+ if (gatewayIndex <= 1) return;
1983
+ const runner = args[gatewayIndex - 2];
1984
+ return isNodeExecutable(runner) ? runner : void 0;
1985
+ }
1986
+ /**
1987
+ * Resolve the node binary baked into the managed gateway service unit,
1988
+ * independent of any package root redirect. This detects when the user's
1989
+ * current PATH-resolved node differs from the service's baked node even
1990
+ * when the package root is the same.
1991
+ */
1992
+ async function resolveManagedServiceNodeRunnerOverride() {
1993
+ const serviceNode = resolveManagedServiceNodeRunner(await resolveGatewayService().readCommand(process.env).catch(() => null));
1994
+ if (!serviceNode) return;
1995
+ const currentNode = resolveNodeRunner();
1996
+ const [serviceNodeReal, currentNodeReal] = await Promise.all([tryRealpathOrResolve(serviceNode), tryRealpathOrResolve(currentNode)]);
1997
+ if (serviceNodeReal === currentNodeReal) return;
1998
+ return serviceNode;
1999
+ }
2000
+ async function resolveManagedServicePackageUpdateRoot(params) {
2001
+ const command = await resolveGatewayService().readCommand(process.env).catch(() => null);
2002
+ const layout = await summarizeGatewayServiceLayout(command);
2003
+ const serviceRoot = layout?.packageRoot;
2004
+ if (!serviceRoot || layout.entrypointSourceCheckout === true) return null;
2005
+ const [currentRootReal, serviceRootReal] = await Promise.all([tryRealpathOrResolve(params.root), tryRealpathOrResolve(serviceRoot)]);
2006
+ if (currentRootReal === serviceRootReal) return null;
2007
+ const nodeRunner = resolveManagedServiceNodeRunner(command);
2008
+ return {
2009
+ root: serviceRoot,
2010
+ previousRoot: params.root,
2011
+ ...nodeRunner ? { nodeRunner } : {}
2012
+ };
2013
+ }
2014
+ async function runPackageInstallUpdate(params) {
2015
+ const manager = await resolveGlobalManager({
2016
+ root: params.root,
2017
+ installKind: params.installKind,
2018
+ timeoutMs: params.timeoutMs
2019
+ });
2020
+ const installEnv = await createGlobalInstallEnv();
2021
+ const runCommand = createGlobalCommandRunner();
2022
+ const installTarget = await resolveGlobalInstallTarget({
2023
+ manager,
2024
+ runCommand,
2025
+ timeoutMs: params.timeoutMs,
2026
+ pkgRoot: params.root,
2027
+ honorPackageRoot: params.honorPackageRoot === true
2028
+ });
2029
+ const pkgRoot = installTarget.packageRoot;
2030
+ const packageName = (pkgRoot ? await readPackageName(pkgRoot) : await readPackageName(params.root)) ?? "@gaodefa/daocore";
2031
+ const installSpec = resolveGlobalInstallSpec({
2032
+ packageName,
2033
+ tag: params.tag,
2034
+ env: installEnv
2035
+ });
2036
+ const beforeVersion = pkgRoot ? await readPackageVersion(pkgRoot) : null;
2037
+ if (pkgRoot) await cleanupGlobalRenameDirs({
2038
+ globalRoot: path.dirname(pkgRoot),
2039
+ packageName
2040
+ });
2041
+ const diskWarning = createLowDiskSpaceWarning({
2042
+ targetPath: pkgRoot ? path.dirname(pkgRoot) : params.root,
2043
+ purpose: "global package update"
2044
+ });
2045
+ if (diskWarning) if (params.jsonMode) defaultRuntime.error(`Warning: ${diskWarning}`);
2046
+ else defaultRuntime.log(theme.warn(diskWarning));
2047
+ const packageUpdate = await runGlobalPackageUpdateSteps({
2048
+ installTarget,
2049
+ installSpec,
2050
+ packageName,
2051
+ packageRoot: pkgRoot,
2052
+ runCommand,
2053
+ timeoutMs: params.timeoutMs,
2054
+ ...installEnv === void 0 ? {} : { env: installEnv },
2055
+ runStep: (stepParams) => runUpdateStep({
2056
+ ...stepParams,
2057
+ progress: params.progress
2058
+ }),
2059
+ postVerifyStep: async (verifiedPackageRoot) => {
2060
+ const entryPath = await resolveGatewayInstallEntrypoint(verifiedPackageRoot);
2061
+ if (entryPath) {
2062
+ await createUpdateConfigSnapshot();
2063
+ const candidateHostVersion = await readPackageVersion(verifiedPackageRoot);
2064
+ return await runUpdateStep({
2065
+ name: `${CLI_NAME} doctor`,
2066
+ argv: [
2067
+ params.nodeRunner ?? resolveNodeRunner(),
2068
+ entryPath,
2069
+ "doctor",
2070
+ "--non-interactive",
2071
+ "--fix"
2072
+ ],
2073
+ cwd: verifiedPackageRoot,
2074
+ env: {
2075
+ ...resolvePostInstallDoctorEnv({
2076
+ serviceEnv: params.managedServiceEnv,
2077
+ invocationCwd: params.invocationCwd
2078
+ }),
2079
+ DAOCORE_UPDATE_IN_PROGRESS: "1",
2080
+ [UPDATE_DEFER_CONFIGURED_PLUGIN_INSTALL_REPAIR_ENV]: "1",
2081
+ [UPDATE_PARENT_SUPPORTS_DOCTOR_CONFIG_WRITE_ENV]: "1",
2082
+ ...candidateHostVersion === null ? {} : { DAOCORE_COMPATIBILITY_HOST_VERSION: candidateHostVersion }
2083
+ },
2084
+ timeoutMs: params.timeoutMs,
2085
+ progress: params.progress
2086
+ });
2087
+ }
2088
+ return null;
2089
+ }
2090
+ });
2091
+ return {
2092
+ status: packageUpdate.failedStep ? "error" : "ok",
2093
+ mode: manager,
2094
+ root: packageUpdate.verifiedPackageRoot ?? params.root,
2095
+ reason: packageUpdate.failedStep ? packageUpdate.failedStep.name : void 0,
2096
+ before: { version: beforeVersion },
2097
+ after: { version: packageUpdate.afterVersion ?? beforeVersion },
2098
+ steps: packageUpdate.steps,
2099
+ durationMs: Date.now() - params.startedAt
2100
+ };
2101
+ }
2102
+ async function runGitUpdate(params) {
2103
+ const updateRoot = params.switchToGit ? resolveGitInstallDir() : params.root;
2104
+ const effectiveTimeout = params.timeoutMs ?? DEFAULT_UPDATE_STEP_TIMEOUT_MS;
2105
+ const installEnv = await createGlobalInstallEnv();
2106
+ const cloneStep = params.switchToGit ? await ensureGitCheckout({
2107
+ dir: updateRoot,
2108
+ env: installEnv,
2109
+ timeoutMs: effectiveTimeout,
2110
+ progress: params.progress
2111
+ }) : null;
2112
+ if (cloneStep && cloneStep.exitCode !== 0) {
2113
+ const result = {
2114
+ status: "error",
2115
+ mode: "git",
2116
+ root: updateRoot,
2117
+ reason: cloneStep.name,
2118
+ steps: [cloneStep],
2119
+ durationMs: Date.now() - params.startedAt
2120
+ };
2121
+ params.stop();
2122
+ printResult(result, {
2123
+ ...params.opts,
2124
+ hideSteps: params.showProgress
2125
+ });
2126
+ defaultRuntime.exit(1);
2127
+ return result;
2128
+ }
2129
+ const updateResult = await runGatewayUpdate({
2130
+ cwd: updateRoot,
2131
+ argv1: params.switchToGit ? void 0 : process.argv[1],
2132
+ timeoutMs: params.timeoutMs,
2133
+ progress: params.progress,
2134
+ channel: params.channel,
2135
+ tag: params.tag,
2136
+ devTargetRef: params.devTargetRef,
2137
+ deferConfiguredPluginInstallRepair: true
2138
+ });
2139
+ const steps = [...cloneStep ? [cloneStep] : [], ...updateResult.steps];
2140
+ if (params.switchToGit && updateResult.status === "ok") {
2141
+ const installTarget = await resolveGlobalInstallTarget({
2142
+ manager: await resolveGlobalManager({
2143
+ root: params.root,
2144
+ installKind: params.installKind,
2145
+ timeoutMs: effectiveTimeout
2146
+ }),
2147
+ runCommand: createGlobalCommandRunner(),
2148
+ timeoutMs: effectiveTimeout,
2149
+ pkgRoot: params.root
2150
+ });
2151
+ const installStep = await runUpdateStep({
2152
+ name: "global install",
2153
+ argv: globalInstallArgs(installTarget, updateRoot, void 0, installTarget.manager === "pnpm" ? resolvePnpmGlobalDirFromGlobalRoot(installTarget.globalRoot) : null),
2154
+ cwd: updateRoot,
2155
+ env: installEnv,
2156
+ timeoutMs: effectiveTimeout,
2157
+ progress: params.progress
2158
+ });
2159
+ steps.push(installStep);
2160
+ const failedStep = installStep.exitCode !== 0 ? installStep : null;
2161
+ return {
2162
+ ...updateResult,
2163
+ status: updateResult.status === "ok" && !failedStep ? "ok" : "error",
2164
+ steps,
2165
+ durationMs: Date.now() - params.startedAt
2166
+ };
2167
+ }
2168
+ return {
2169
+ ...updateResult,
2170
+ steps,
2171
+ durationMs: Date.now() - params.startedAt
2172
+ };
2173
+ }
2174
+ async function updatePluginsAfterCoreUpdate(params) {
2175
+ if (!params.configSnapshot.valid) {
2176
+ const invalid = buildInvalidConfigPostCoreUpdateResult();
2177
+ if (!params.opts.json) {
2178
+ defaultRuntime.log(theme.error(invalid.message));
2179
+ for (const line of invalid.guidance) defaultRuntime.log(theme.muted(` ${line}`));
2180
+ }
2181
+ return invalid.result;
2182
+ }
2183
+ const pluginLogger = params.opts.json ? {} : {
2184
+ info: (msg) => defaultRuntime.log(msg),
2185
+ warn: (msg) => defaultRuntime.log(theme.warn(msg)),
2186
+ error: (msg) => defaultRuntime.log(theme.error(msg))
2187
+ };
2188
+ if (!params.opts.json) {
2189
+ defaultRuntime.log("");
2190
+ defaultRuntime.log(theme.heading("Updating plugins..."));
2191
+ }
2192
+ const warnings = [];
2193
+ const pluginInstallRecords = params.pluginInstallRecords ?? await loadInstalledPluginIndexInstallRecords();
2194
+ const syncResult = await syncPluginsForUpdateChannel({
2195
+ config: withPluginInstallRecords(params.configSnapshot.sourceConfig, pluginInstallRecords),
2196
+ channel: params.channel,
2197
+ workspaceDir: params.root,
2198
+ externalizedBundledPluginBridges: await listPersistedBundledPluginLocationBridges({ workspaceDir: params.root }),
2199
+ logger: pluginLogger
2200
+ });
2201
+ for (const error of syncResult.summary.errors) warnings.push(createPostUpdatePluginWarning({ reason: error }));
2202
+ let pluginConfig = syncResult.config;
2203
+ const integrityDrifts = [];
2204
+ const pluginUpdateOutcomes = [];
2205
+ let pluginsChanged = syncResult.changed || params.configChanged === true;
2206
+ let npmPluginsChanged = false;
2207
+ const onPluginIntegrityDrift = async (drift) => {
2208
+ integrityDrifts.push({
2209
+ pluginId: drift.pluginId,
2210
+ spec: drift.spec,
2211
+ expectedIntegrity: drift.expectedIntegrity,
2212
+ actualIntegrity: drift.actualIntegrity,
2213
+ ...drift.resolvedSpec ? { resolvedSpec: drift.resolvedSpec } : {},
2214
+ ...drift.resolvedVersion ? { resolvedVersion: drift.resolvedVersion } : {},
2215
+ action: "aborted"
2216
+ });
2217
+ if (!params.opts.json) {
2218
+ const specLabel = drift.resolvedSpec ?? drift.spec;
2219
+ defaultRuntime.log(theme.warn(`Integrity drift detected for "${drift.pluginId}" (${specLabel})\nExpected: ${drift.expectedIntegrity}\nActual: ${drift.actualIntegrity}
2220
+ Plugin update aborted. Reinstall the plugin only if you trust the new artifact.`));
2221
+ }
2222
+ return false;
2223
+ };
2224
+ const collectMissingPayloadWarnings = async (records) => {
2225
+ const missing = await collectMissingPluginInstallPayloads({
2226
+ records,
2227
+ config: pluginConfig,
2228
+ skipDisabledPlugins: true,
2229
+ syncOfficialPluginInstalls: true
2230
+ });
2231
+ if (missing.length === 0) return [];
2232
+ const missingIds = missing.map((entry) => entry.pluginId);
2233
+ for (const entry of missing) {
2234
+ const warning = createPostUpdatePluginWarning({
2235
+ pluginId: entry.pluginId,
2236
+ reason: `Plugin install payload missing after update: ${formatMissingPluginPayloadReason(entry)}.`
2237
+ });
2238
+ warnings.push(warning);
2239
+ pluginUpdateOutcomes.push({
2240
+ pluginId: entry.pluginId,
2241
+ status: "error",
2242
+ message: warning.message
2243
+ });
2244
+ if (!params.opts.json) defaultRuntime.log(theme.warn(warning.message));
2245
+ }
2246
+ const repairResult = await updateNpmInstalledPlugins({
2247
+ config: pluginConfig,
2248
+ pluginIds: missingIds,
2249
+ timeoutMs: params.timeoutMs,
2250
+ updateChannel: params.channel,
2251
+ skipDisabledPlugins: true,
2252
+ syncOfficialPluginInstalls: true,
2253
+ disableOnFailure: true,
2254
+ logger: pluginLogger,
2255
+ onIntegrityDrift: onPluginIntegrityDrift
2256
+ });
2257
+ pluginConfig = repairResult.config;
2258
+ pluginsChanged ||= repairResult.changed;
2259
+ npmPluginsChanged ||= repairResult.changed;
2260
+ pluginUpdateOutcomes.push(...repairResult.outcomes);
2261
+ return missingIds;
2262
+ };
2263
+ const missingPayloadIds = await collectMissingPayloadWarnings(pluginInstallRecords);
2264
+ const npmResult = await updateNpmInstalledPlugins({
2265
+ config: pluginConfig,
2266
+ timeoutMs: params.timeoutMs,
2267
+ updateChannel: params.channel,
2268
+ skipIds: new Set([...syncResult.summary.switchedToNpm, ...missingPayloadIds]),
2269
+ skipDisabledPlugins: true,
2270
+ syncOfficialPluginInstalls: true,
2271
+ disableOnFailure: true,
2272
+ logger: pluginLogger,
2273
+ onIntegrityDrift: onPluginIntegrityDrift
2274
+ });
2275
+ pluginConfig = npmResult.config;
2276
+ pluginsChanged ||= npmResult.changed;
2277
+ npmPluginsChanged ||= npmResult.changed;
2278
+ for (const rawOutcome of npmResult.outcomes) {
2279
+ const guided = createGuidedPostUpdatePluginOutcome(rawOutcome);
2280
+ pluginUpdateOutcomes.push(guided.outcome);
2281
+ if (guided.warning) warnings.push(guided.warning);
2282
+ }
2283
+ const remainingMissingPayloads = await collectMissingPluginInstallPayloads({
2284
+ records: pluginConfig.plugins?.installs ?? {},
2285
+ config: pluginConfig,
2286
+ skipDisabledPlugins: true,
2287
+ syncOfficialPluginInstalls: true
2288
+ });
2289
+ pluginUpdateOutcomes.push(...remainingMissingPayloads.filter((entry) => !missingPayloadIds.includes(entry.pluginId)).map((entry) => {
2290
+ const warning = createPostUpdatePluginWarning({
2291
+ pluginId: entry.pluginId,
2292
+ reason: `Plugin install payload missing after update: ${formatMissingPluginPayloadReason(entry)}.`
2293
+ });
2294
+ warnings.push(warning);
2295
+ return {
2296
+ pluginId: entry.pluginId,
2297
+ status: "error",
2298
+ message: warning.message
2299
+ };
2300
+ }));
2301
+ const convergenceBaselineRecords = pluginConfig.plugins?.installs ?? {};
2302
+ const convergence = await runPostCorePluginConvergence({
2303
+ cfg: pluginConfig,
2304
+ env: process.env,
2305
+ baselineInstallRecords: convergenceBaselineRecords
2306
+ });
2307
+ for (const change of convergence.changes) if (!params.opts.json) defaultRuntime.log(theme.muted(change));
2308
+ const convergenceFolded = convergenceWarningsToOutcomes(convergence);
2309
+ for (const warning of convergenceFolded.warnings) {
2310
+ warnings.push(warning);
2311
+ if (!params.opts.json) {
2312
+ defaultRuntime.log(theme.warn(warning.message));
2313
+ for (const guidance of warning.guidance) defaultRuntime.log(theme.muted(` ${guidance}`));
2314
+ }
2315
+ }
2316
+ pluginUpdateOutcomes.push(...convergenceFolded.outcomes);
2317
+ const convergenceErrored = convergenceFolded.errored;
2318
+ pluginConfig = withPluginInstallRecords(pluginConfig, convergence.installRecords);
2319
+ if (convergence.changes.length > 0) pluginsChanged = true;
2320
+ if (pluginsChanged) {
2321
+ const nextInstallRecords = pluginConfig.plugins?.installs ?? {};
2322
+ let nextConfig = withoutPluginInstallRecords(pluginConfig);
2323
+ if (params.restoredAuthoredChannels !== void 0) nextConfig = {
2324
+ ...nextConfig,
2325
+ channels: structuredClone(params.restoredAuthoredChannels)
2326
+ };
2327
+ await commitPluginInstallRecordsWithConfig({
2328
+ previousInstallRecords: pluginInstallRecords,
2329
+ nextInstallRecords,
2330
+ nextConfig,
2331
+ baseHash: params.configSnapshot.hash
2332
+ });
2333
+ await refreshPluginRegistryAfterConfigMutation({
2334
+ config: nextConfig,
2335
+ reason: "source-changed",
2336
+ workspaceDir: params.root,
2337
+ installRecords: nextInstallRecords,
2338
+ logger: pluginLogger
2339
+ });
2340
+ }
2341
+ if (params.opts.json) return {
2342
+ status: convergenceErrored ? "error" : warnings.length > 0 ? "warning" : "ok",
2343
+ changed: pluginsChanged,
2344
+ warnings,
2345
+ sync: {
2346
+ changed: syncResult.changed,
2347
+ switchedToBundled: syncResult.summary.switchedToBundled,
2348
+ switchedToNpm: syncResult.summary.switchedToNpm,
2349
+ warnings: syncResult.summary.warnings,
2350
+ errors: syncResult.summary.errors
2351
+ },
2352
+ npm: {
2353
+ changed: npmPluginsChanged,
2354
+ outcomes: pluginUpdateOutcomes
2355
+ },
2356
+ integrityDrifts
2357
+ };
2358
+ const summarizeList = (list) => {
2359
+ if (list.length <= 6) return list.join(", ");
2360
+ return `${list.slice(0, 6).join(", ")} +${list.length - 6} more`;
2361
+ };
2362
+ if (syncResult.summary.switchedToBundled.length > 0) defaultRuntime.log(theme.muted(`Switched to bundled plugins: ${summarizeList(syncResult.summary.switchedToBundled)}.`));
2363
+ if (syncResult.summary.switchedToNpm.length > 0) defaultRuntime.log(theme.muted(`Restored npm plugins: ${summarizeList(syncResult.summary.switchedToNpm)}.`));
2364
+ for (const warning of syncResult.summary.warnings) defaultRuntime.log(theme.warn(warning));
2365
+ for (const error of syncResult.summary.errors) defaultRuntime.log(theme.warn(createPostUpdatePluginWarning({ reason: error }).message));
2366
+ const updated = pluginUpdateOutcomes.filter((entry) => entry.status === "updated").length;
2367
+ const unchanged = pluginUpdateOutcomes.filter((entry) => entry.status === "unchanged").length;
2368
+ const failed = pluginUpdateOutcomes.filter((entry) => entry.status === "error").length;
2369
+ const skipped = pluginUpdateOutcomes.filter((entry) => entry.status === "skipped").length;
2370
+ if (pluginUpdateOutcomes.length === 0) defaultRuntime.log(theme.muted("No plugin updates needed."));
2371
+ else {
2372
+ const parts = [`${updated} updated`, `${unchanged} unchanged`];
2373
+ if (failed > 0) parts.push(`${failed} failed`);
2374
+ if (skipped > 0) parts.push(`${skipped} skipped`);
2375
+ defaultRuntime.log(theme.muted(`npm plugins: ${parts.join(", ")}.`));
2376
+ }
2377
+ for (const outcome of pluginUpdateOutcomes) {
2378
+ if (outcome.status !== "error") continue;
2379
+ defaultRuntime.log(theme.warn(outcome.message));
2380
+ }
2381
+ return {
2382
+ status: convergenceErrored ? "error" : warnings.length > 0 ? "warning" : "ok",
2383
+ changed: pluginsChanged,
2384
+ warnings,
2385
+ sync: {
2386
+ changed: syncResult.changed,
2387
+ switchedToBundled: syncResult.summary.switchedToBundled,
2388
+ switchedToNpm: syncResult.summary.switchedToNpm,
2389
+ warnings: syncResult.summary.warnings,
2390
+ errors: syncResult.summary.errors
2391
+ },
2392
+ npm: {
2393
+ changed: npmPluginsChanged,
2394
+ outcomes: pluginUpdateOutcomes
2395
+ },
2396
+ integrityDrifts
2397
+ };
2398
+ }
2399
+ async function maybeRestartService(params) {
2400
+ const verifyRestartedGateway = async (expectedGatewayVersion) => {
2401
+ const restartAfterStaleCleanup = async () => {
2402
+ if (params.refreshServiceEnv && isPackageManagerUpdateMode(params.result.mode)) {
2403
+ await runUpdatedInstallGatewayRestart({
2404
+ result: params.result,
2405
+ jsonMode: Boolean(params.opts.json),
2406
+ invocationCwd: params.invocationCwd,
2407
+ env: params.serviceEnv,
2408
+ nodeRunner: params.nodeRunner
2409
+ });
2410
+ return;
2411
+ }
2412
+ if (shouldUseLegacyProcessRestartAfterUpdate({ updateMode: params.result.mode })) await runDaemonRestart();
2413
+ };
2414
+ const service = resolveGatewayService();
2415
+ let health = await waitForGatewayHealthyRestart({
2416
+ service,
2417
+ port: params.gatewayPort,
2418
+ expectedVersion: expectedGatewayVersion,
2419
+ env: params.serviceEnv
2420
+ });
2421
+ if (!health.healthy && health.staleGatewayPids.length > 0) {
2422
+ if (!params.opts.json) defaultRuntime.log(theme.warn(`Found stale gateway process(es) after restart: ${health.staleGatewayPids.join(", ")}. Cleaning up...`));
2423
+ await terminateStaleGatewayPids(health.staleGatewayPids);
2424
+ await restartAfterStaleCleanup();
2425
+ health = await waitForGatewayHealthyRestart({
2426
+ service,
2427
+ port: params.gatewayPort,
2428
+ expectedVersion: expectedGatewayVersion,
2429
+ env: params.serviceEnv
2430
+ });
2431
+ }
2432
+ const recoveryVerification = await recoverLaunchAgentAndRecheckGatewayHealth({
2433
+ health,
2434
+ service,
2435
+ port: params.gatewayPort,
2436
+ expectedVersion: expectedGatewayVersion,
2437
+ env: params.serviceEnv
2438
+ });
2439
+ health = recoveryVerification.health;
2440
+ const launchAgentRecovery = recoveryVerification.launchAgentRecovery;
2441
+ if (launchAgentRecovery?.attempted) if (!params.opts.json) defaultRuntime.log(launchAgentRecovery.recovered ? theme.warn(launchAgentRecovery.message) : theme.warn(launchAgentRecovery.detail));
2442
+ else defaultRuntime.error(launchAgentRecovery.recovered ? launchAgentRecovery.message : launchAgentRecovery.detail);
2443
+ if (health.healthy) {
2444
+ if (!params.opts.json) defaultRuntime.log(theme.success("Gateway: restarted and verified."));
2445
+ return true;
2446
+ }
2447
+ const diagnosticLines = [
2448
+ "Gateway did not become healthy after restart.",
2449
+ ...renderRestartDiagnostics(health),
2450
+ ...launchAgentRecovery?.attempted ? [launchAgentRecovery.recovered ? `LaunchAgent recovery: ${launchAgentRecovery.message}` : `LaunchAgent recovery failed: ${launchAgentRecovery.detail}`] : [],
2451
+ `Restart log: ${resolveGatewayRestartLogPath(params.serviceEnv ?? process.env)}`,
2452
+ `Run \`${replaceCliName(formatCliCommand("daocore gateway status --deep"), CLI_NAME)}\` for details.`,
2453
+ ...formatPostUpdateGatewayRecoveryInstructions(params.result)
2454
+ ];
2455
+ if (params.opts.json) defaultRuntime.error(diagnosticLines.join("\n"));
2456
+ else {
2457
+ defaultRuntime.log(theme.warn(diagnosticLines[0] ?? "Gateway did not become healthy."));
2458
+ for (const line of diagnosticLines.slice(1)) defaultRuntime.log(theme.muted(line));
2459
+ }
2460
+ if (isPackageManagerUpdateMode(params.result.mode)) return false;
2461
+ return !(health.versionMismatch || health.activatedPluginErrors?.length);
2462
+ };
2463
+ if (params.shouldRestart) {
2464
+ if (!params.opts.json) {
2465
+ defaultRuntime.log("");
2466
+ defaultRuntime.log(theme.heading("Restarting service..."));
2467
+ }
2468
+ try {
2469
+ const expectedGatewayVersion = isPackageManagerUpdateMode(params.result.mode) ? normalizeOptionalString(params.result.after?.version) : void 0;
2470
+ const isPackageUpdate = isPackageManagerUpdateMode(params.result.mode);
2471
+ let restarted = false;
2472
+ let restartInitiated = false;
2473
+ let refreshedGatewayAlreadyHealthy = false;
2474
+ if (params.refreshServiceEnv) {
2475
+ try {
2476
+ await refreshGatewayServiceEnv({
2477
+ result: params.result,
2478
+ jsonMode: Boolean(params.opts.json),
2479
+ invocationCwd: params.invocationCwd,
2480
+ env: params.serviceEnv,
2481
+ nodeRunner: params.nodeRunner
2482
+ });
2483
+ } catch (err) {
2484
+ const message = `Failed to refresh gateway service environment from updated install: ${String(err)}`;
2485
+ if (params.opts.json) defaultRuntime.error(message);
2486
+ else defaultRuntime.log(theme.warn(message));
2487
+ if (isPackageUpdate) return false;
2488
+ }
2489
+ if (isPackageUpdate && expectedGatewayVersion) {
2490
+ refreshedGatewayAlreadyHealthy = (await waitForGatewayHealthyRestart({
2491
+ service: resolveGatewayService(),
2492
+ port: params.gatewayPort,
2493
+ expectedVersion: expectedGatewayVersion,
2494
+ env: params.serviceEnv,
2495
+ attempts: POST_REFRESH_ALREADY_HEALTHY_ATTEMPTS,
2496
+ delayMs: POST_REFRESH_ALREADY_HEALTHY_DELAY_MS
2497
+ })).healthy;
2498
+ if (refreshedGatewayAlreadyHealthy && !params.opts.json) defaultRuntime.log(theme.muted("Gateway already reports the updated version after service refresh; skipped redundant restart."));
2499
+ }
2500
+ }
2501
+ if (!refreshedGatewayAlreadyHealthy && params.restartScriptPath) {
2502
+ await createUpdateConfigSnapshot();
2503
+ await runRestartScript(params.restartScriptPath);
2504
+ restartInitiated = true;
2505
+ } else if (!refreshedGatewayAlreadyHealthy && params.refreshServiceEnv && isPackageUpdate) {
2506
+ await createUpdateConfigSnapshot();
2507
+ restarted = await runUpdatedInstallGatewayRestart({
2508
+ result: params.result,
2509
+ jsonMode: Boolean(params.opts.json),
2510
+ invocationCwd: params.invocationCwd,
2511
+ env: params.serviceEnv,
2512
+ nodeRunner: params.nodeRunner
2513
+ });
2514
+ } else if (!refreshedGatewayAlreadyHealthy && shouldUseLegacyProcessRestartAfterUpdate({ updateMode: params.result.mode })) {
2515
+ await createUpdateConfigSnapshot();
2516
+ restarted = await runDaemonRestart();
2517
+ } else if (!refreshedGatewayAlreadyHealthy && !params.opts.json) defaultRuntime.log(theme.muted("Gateway: restart skipped (no installed service found)."));
2518
+ if (refreshedGatewayAlreadyHealthy || restartInitiated || restarted && expectedGatewayVersion !== void 0) {
2519
+ if (!await verifyRestartedGateway(expectedGatewayVersion)) {
2520
+ if (!params.opts.json) defaultRuntime.log("");
2521
+ return false;
2522
+ }
2523
+ if (!params.opts.json && restartInitiated) {
2524
+ defaultRuntime.log(theme.success("Daemon restart completed."));
2525
+ defaultRuntime.log("");
2526
+ }
2527
+ }
2528
+ if (!params.opts.json && restarted) {
2529
+ defaultRuntime.log(theme.success("Daemon restarted successfully."));
2530
+ defaultRuntime.log("");
2531
+ await createUpdateConfigSnapshot();
2532
+ process.env.DAOCORE_UPDATE_IN_PROGRESS = "1";
2533
+ process.env[UPDATE_PARENT_SUPPORTS_DOCTOR_CONFIG_WRITE_ENV] = "1";
2534
+ try {
2535
+ await doctorCommand(defaultRuntime, { nonInteractive: !(process.stdin.isTTY && !params.opts.json && params.opts.yes !== true) });
2536
+ } catch (err) {
2537
+ defaultRuntime.log(theme.warn(`Doctor failed: ${String(err)}`));
2538
+ } finally {
2539
+ delete process.env.DAOCORE_UPDATE_IN_PROGRESS;
2540
+ delete process.env[UPDATE_PARENT_SUPPORTS_DOCTOR_CONFIG_WRITE_ENV];
2541
+ }
2542
+ }
2543
+ } catch (err) {
2544
+ if (!params.opts.json) {
2545
+ defaultRuntime.log(theme.warn(`Gateway: restart failed: ${String(err)}`));
2546
+ defaultRuntime.log(theme.muted(`You may need to restart the service manually: ${replaceCliName(formatCliCommand("daocore gateway restart"), CLI_NAME)}`));
2547
+ }
2548
+ if (isPackageManagerUpdateMode(params.result.mode)) return false;
2549
+ }
2550
+ return true;
2551
+ }
2552
+ if (!params.opts.json) {
2553
+ defaultRuntime.log("");
2554
+ defaultRuntime.log(theme.muted("Gateway: restart skipped (--no-restart)."));
2555
+ 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.`));
2556
+ else defaultRuntime.log(theme.muted(`Tip: Run \`${replaceCliName(formatCliCommand("daocore gateway restart"), CLI_NAME)}\` to apply updates to a running gateway.`));
2557
+ }
2558
+ return true;
2559
+ }
2560
+ async function runPostCorePluginUpdate(params) {
2561
+ return await updatePluginsAfterCoreUpdate({
2562
+ root: params.root,
2563
+ channel: params.channel,
2564
+ configSnapshot: params.configSnapshot,
2565
+ configChanged: params.configChanged,
2566
+ restoredAuthoredChannels: params.restoredAuthoredChannels,
2567
+ opts: params.opts,
2568
+ timeoutMs: params.timeoutMs,
2569
+ pluginInstallRecords: params.pluginInstallRecords
2570
+ });
2571
+ }
2572
+ function withUpdateFinalizationEnv(run) {
2573
+ const previousUpdateInProgress = process.env.DAOCORE_UPDATE_IN_PROGRESS;
2574
+ const previousDeferConfiguredPluginInstallRepair = process.env[UPDATE_DEFER_CONFIGURED_PLUGIN_INSTALL_REPAIR_ENV];
2575
+ const previousParentSupportsDoctorConfigWrite = process.env[UPDATE_PARENT_SUPPORTS_DOCTOR_CONFIG_WRITE_ENV];
2576
+ process.env.DAOCORE_UPDATE_IN_PROGRESS = "1";
2577
+ process.env[UPDATE_DEFER_CONFIGURED_PLUGIN_INSTALL_REPAIR_ENV] = "1";
2578
+ process.env[UPDATE_PARENT_SUPPORTS_DOCTOR_CONFIG_WRITE_ENV] = "1";
2579
+ return run().finally(() => {
2580
+ if (previousUpdateInProgress === void 0) delete process.env.DAOCORE_UPDATE_IN_PROGRESS;
2581
+ else process.env.DAOCORE_UPDATE_IN_PROGRESS = previousUpdateInProgress;
2582
+ if (previousDeferConfiguredPluginInstallRepair === void 0) delete process.env[UPDATE_DEFER_CONFIGURED_PLUGIN_INSTALL_REPAIR_ENV];
2583
+ else process.env[UPDATE_DEFER_CONFIGURED_PLUGIN_INSTALL_REPAIR_ENV] = previousDeferConfiguredPluginInstallRepair;
2584
+ if (previousParentSupportsDoctorConfigWrite === void 0) delete process.env[UPDATE_PARENT_SUPPORTS_DOCTOR_CONFIG_WRITE_ENV];
2585
+ else process.env[UPDATE_PARENT_SUPPORTS_DOCTOR_CONFIG_WRITE_ENV] = previousParentSupportsDoctorConfigWrite;
2586
+ });
2587
+ }
2588
+ async function updateFinalizeCommand(opts) {
2589
+ suppressDeprecations();
2590
+ const timeoutMs = parseTimeoutMsOrExit(opts.timeout);
2591
+ if (timeoutMs === null) return;
2592
+ assertConfigWriteAllowedInCurrentMode();
2593
+ const root = await resolveUpdateRoot();
2594
+ let configSnapshot = await readConfigFileSnapshot({ skipPluginValidation: true });
2595
+ const preFinalizeConfig = configSnapshot.valid ? {
2596
+ sourceConfig: configSnapshot.sourceConfig,
2597
+ authoredConfig: isRecord(configSnapshot.parsed) ? configSnapshot.parsed : configSnapshot.sourceConfig
2598
+ } : void 0;
2599
+ const requestedChannel = normalizeUpdateChannel(opts.channel);
2600
+ if (opts.channel && !requestedChannel) {
2601
+ defaultRuntime.error(`--channel must be "stable", "beta", or "dev" (got "${opts.channel}")`);
2602
+ defaultRuntime.exit(1);
2603
+ return;
2604
+ }
2605
+ const storedChannel = configSnapshot.valid ? normalizeUpdateChannel(configSnapshot.config.update?.channel) : null;
2606
+ const channel = requestedChannel ?? storedChannel ?? "stable";
2607
+ if (requestedChannel) configSnapshot = await persistRequestedUpdateChannel({
2608
+ configSnapshot,
2609
+ requestedChannel
2610
+ });
2611
+ const pluginUpdate = await withUpdateFinalizationEnv(async () => {
2612
+ await createUpdateConfigSnapshot();
2613
+ await doctorCommand(defaultRuntime, {
2614
+ nonInteractive: true,
2615
+ repair: true,
2616
+ yes: opts.yes === true
2617
+ });
2618
+ configSnapshot = await readConfigFileSnapshot({ skipPluginValidation: true });
2619
+ if (requestedChannel) configSnapshot = await persistRequestedUpdateChannel({
2620
+ configSnapshot,
2621
+ requestedChannel
2622
+ });
2623
+ const restoredConfig = restoreDroppedPreUpdateChannels(configSnapshot, preFinalizeConfig);
2624
+ configSnapshot = restoredConfig.snapshot;
2625
+ const postDoctorStoredChannel = configSnapshot.valid ? normalizeUpdateChannel(configSnapshot.config.update?.channel) : null;
2626
+ const postDoctorChannel = requestedChannel ?? postDoctorStoredChannel ?? storedChannel ?? "stable";
2627
+ const pluginInstallRecords = await loadInstalledPluginIndexInstallRecords();
2628
+ return await runPostCorePluginUpdate({
2629
+ root,
2630
+ channel: postDoctorChannel,
2631
+ configSnapshot,
2632
+ configChanged: restoredConfig.changed,
2633
+ restoredAuthoredChannels: restoredConfig.authoredChannels,
2634
+ opts: {
2635
+ json: opts.json,
2636
+ timeout: opts.timeout,
2637
+ yes: opts.yes,
2638
+ restart: false
2639
+ },
2640
+ timeoutMs: timeoutMs ?? DEFAULT_UPDATE_STEP_TIMEOUT_MS,
2641
+ pluginInstallRecords
2642
+ });
2643
+ });
2644
+ const result = {
2645
+ status: pluginUpdate.status === "error" ? "error" : pluginUpdate.status === "warning" ? "warning" : "ok",
2646
+ mode: "finalize",
2647
+ root,
2648
+ channel: requestedChannel ?? (configSnapshot.valid ? normalizeUpdateChannel(configSnapshot.config.update?.channel) : null) ?? channel,
2649
+ restart: false,
2650
+ postUpdate: {
2651
+ doctor: { status: "ok" },
2652
+ plugins: pluginUpdate
2653
+ }
2654
+ };
2655
+ await tryWriteCompletionCache(root, Boolean(opts.json));
2656
+ if (opts.json) defaultRuntime.writeJson(result);
2657
+ else if (result.status === "ok") defaultRuntime.log(theme.muted("Update finalization completed."));
2658
+ if (result.status === "error") defaultRuntime.exit(1);
2659
+ }
2660
+ async function persistRequestedUpdateChannel(params) {
2661
+ if (!params.requestedChannel || !params.configSnapshot.valid) return params.configSnapshot;
2662
+ const storedChannel = normalizeUpdateChannel(params.configSnapshot.config.update?.channel);
2663
+ if (params.requestedChannel === storedChannel) return params.configSnapshot;
2664
+ const requestedChannel = params.requestedChannel;
2665
+ const mutation = await mutateConfigFileWithRetry({
2666
+ writeOptions: { skipPluginValidation: true },
2667
+ mutate: (draft) => {
2668
+ draft.update = {
2669
+ ...draft.update,
2670
+ channel: requestedChannel
2671
+ };
2672
+ }
2673
+ });
2674
+ return createUpdatedConfigSnapshot(mutation.snapshot, mutation.nextConfig);
2675
+ }
2676
+ function createUpdatedConfigSnapshot(snapshot, next) {
2677
+ if (!snapshot.valid) return snapshot;
2678
+ return {
2679
+ ...snapshot,
2680
+ hash: void 0,
2681
+ parsed: next,
2682
+ sourceConfig: asResolvedSourceConfig(next),
2683
+ resolved: asResolvedSourceConfig(next),
2684
+ runtimeConfig: asRuntimeConfig(next),
2685
+ config: asRuntimeConfig(next)
2686
+ };
2687
+ }
2688
+ async function maybeRepairLegacyConfigForUpdateChannel(params) {
2689
+ if (params.configSnapshot.valid || params.configSnapshot.legacyIssues.length === 0) return params.configSnapshot;
2690
+ const { repairLegacyConfigForUpdateChannel } = await import("./legacy-config-repair-CLfJFkNY.js");
2691
+ const { snapshot, repaired } = await repairLegacyConfigForUpdateChannel(params);
2692
+ if (!params.jsonMode && repaired) defaultRuntime.log(theme.muted("Migrated legacy config before changing update channel."));
2693
+ return snapshot;
2694
+ }
2695
+ async function writePostCorePluginUpdateResultFile(filePath, result) {
2696
+ if (!filePath) return;
2697
+ await writeJson(filePath, result, { trailingNewline: true });
2698
+ }
2699
+ async function writePostCorePluginInstallRecordsFile(filePath, records) {
2700
+ await fs$1.writeFile(filePath, `${JSON.stringify(records)}\n`, "utf-8");
2701
+ }
2702
+ async function writePostCoreSourceConfigFile(filePath, preUpdateConfig) {
2703
+ if (!preUpdateConfig) return;
2704
+ await fs$1.writeFile(filePath, `${JSON.stringify(preUpdateConfig)}\n`, "utf-8");
2705
+ }
2706
+ async function readPostCorePluginInstallRecordsFile(filePath) {
2707
+ if (!filePath) return;
2708
+ try {
2709
+ return normalizePluginInstallRecordMap(JSON.parse(await fs$1.readFile(filePath, "utf-8")));
2710
+ } catch {
2711
+ return;
2712
+ }
2713
+ }
2714
+ async function readPostCoreSourceConfigFile(filePath, options) {
2715
+ if (!filePath) return;
2716
+ try {
2717
+ const parsed = parseConfigJson5(await fs$1.readFile(filePath, "utf-8"));
2718
+ if (!parsed.ok || !isRecord(parsed.parsed)) return;
2719
+ return normalizePreUpdateConfigRestoreInput(parsed.parsed, options);
2720
+ } catch {
2721
+ return;
2722
+ }
2723
+ }
2724
+ function normalizePreUpdateConfigRestoreInput(parsed, options) {
2725
+ const sourceConfig = parsed.sourceConfig;
2726
+ const authoredConfig = parsed.authoredConfig;
2727
+ if (isRecord(sourceConfig) && isRecord(authoredConfig)) return {
2728
+ sourceConfig,
2729
+ authoredConfig
2730
+ };
2731
+ const authored = parsed;
2732
+ return {
2733
+ sourceConfig: options?.configPath ? resolvePreUpdateSourceConfigFromAuthored(authored, options.configPath) : authored,
2734
+ authoredConfig: authored
2735
+ };
2736
+ }
2737
+ function resolvePreUpdateSourceConfigFromAuthored(authoredConfig, configPath) {
2738
+ try {
2739
+ const resolved = resolveConfigEnvVars(resolveConfigIncludes(authoredConfig, configPath, void 0, { allowedRoots: resolveIncludeRoots(process.env) }), process.env, { onMissing: () => void 0 });
2740
+ return isRecord(resolved) ? resolved : authoredConfig;
2741
+ } catch {
2742
+ return authoredConfig;
2743
+ }
2744
+ }
2745
+ async function isFreshPreUpdateConfigSnapshot(params) {
2746
+ const snapshotStat = await fs$1.stat(params.snapshotPath).catch(() => null);
2747
+ if (!snapshotStat) return false;
2748
+ if (params.updateStartedAtMs !== void 0 && snapshotStat.mtimeMs + 1e3 < params.updateStartedAtMs) return false;
2749
+ if (Date.now() - snapshotStat.mtimeMs > PRE_UPDATE_CONFIG_SNAPSHOT_MAX_AGE_MS) return false;
2750
+ const currentStat = await fs$1.stat(params.currentConfigPath).catch(() => null);
2751
+ return !currentStat || snapshotStat.mtimeMs <= currentStat.mtimeMs + 1e3;
2752
+ }
2753
+ async function execFileStdout(file, args) {
2754
+ return await new Promise((resolve) => {
2755
+ execFile(file, args, {
2756
+ timeout: 1e3,
2757
+ windowsHide: true
2758
+ }, (error, stdout) => {
2759
+ resolve(error ? void 0 : stdout);
2760
+ });
2761
+ });
2762
+ }
2763
+ async function readProcessStartTimeMs(pid) {
2764
+ if (!Number.isInteger(pid) || pid <= 0) return;
2765
+ const raw = process.platform === "win32" ? await execFileStdout("powershell.exe", [
2766
+ "-NoProfile",
2767
+ "-NonInteractive",
2768
+ "-Command",
2769
+ `[Console]::Out.Write((Get-Process -Id ${pid}).StartTime.ToUniversalTime().ToString("o"))`
2770
+ ]) : await execFileStdout("ps", [
2771
+ "-o",
2772
+ "lstart=",
2773
+ "-p",
2774
+ String(pid)
2775
+ ]);
2776
+ if (!raw) return;
2777
+ const parsed = Date.parse(raw.trim().replace(/\s+/g, " "));
2778
+ return Number.isFinite(parsed) ? parsed : void 0;
2779
+ }
2780
+ async function resolvePostCoreUpdateStartedAtMs(env) {
2781
+ const fromEnv = Number.parseInt(env[POST_CORE_UPDATE_STARTED_AT_ENV] ?? "", 10);
2782
+ if (Number.isFinite(fromEnv) && fromEnv > 0) return fromEnv;
2783
+ return await readProcessStartTimeMs(process.ppid);
2784
+ }
2785
+ async function readPostCorePreUpdateSourceConfig(params) {
2786
+ const fromChildEnv = await readPostCoreSourceConfigFile(params.sourceConfigPath);
2787
+ if (fromChildEnv) return fromChildEnv;
2788
+ if (params.updateStartedAtMs === void 0) return;
2789
+ const explicitPreUpdatePath = `${params.currentSnapshot.path}.pre-update`;
2790
+ if (await isFreshPreUpdateConfigSnapshot({
2791
+ currentConfigPath: params.currentSnapshot.path,
2792
+ snapshotPath: explicitPreUpdatePath,
2793
+ updateStartedAtMs: params.updateStartedAtMs
2794
+ })) {
2795
+ const preUpdateConfig = await readPostCoreSourceConfigFile(explicitPreUpdatePath, { configPath: params.currentSnapshot.path });
2796
+ if (preUpdateConfig && hasRestorablePreUpdateChannels(params.currentSnapshot, preUpdateConfig)) return preUpdateConfig;
2797
+ return;
2798
+ }
2799
+ const backupPath = `${params.currentSnapshot.path}.bak`;
2800
+ if (await isFreshPreUpdateConfigSnapshot({
2801
+ currentConfigPath: params.currentSnapshot.path,
2802
+ snapshotPath: backupPath,
2803
+ updateStartedAtMs: params.updateStartedAtMs
2804
+ })) {
2805
+ const preUpdateConfig = await readPostCoreSourceConfigFile(backupPath, { configPath: params.currentSnapshot.path });
2806
+ if (preUpdateConfig && hasRestorablePreUpdateChannels(params.currentSnapshot, preUpdateConfig)) return preUpdateConfig;
2807
+ }
2808
+ }
2809
+ async function readPostCorePluginUpdateResultFile(filePath) {
2810
+ try {
2811
+ const parsed = await readJsonIfExists(filePath);
2812
+ if (parsed && typeof parsed === "object" && (parsed.status === "ok" || parsed.status === "warning" || parsed.status === "skipped" || parsed.status === "error")) return parsed;
2813
+ } catch {
2814
+ return;
2815
+ }
2816
+ }
2817
+ function stopPostCoreUpdateChild(child) {
2818
+ if (process.platform === "win32" && child.pid) try {
2819
+ spawn("taskkill", [
2820
+ "/PID",
2821
+ String(child.pid),
2822
+ "/T",
2823
+ "/F"
2824
+ ], {
2825
+ stdio: "ignore",
2826
+ windowsHide: true
2827
+ }).once("error", () => {
2828
+ child.kill();
2829
+ });
2830
+ return;
2831
+ } catch {
2832
+ child.kill();
2833
+ return;
2834
+ }
2835
+ child.kill();
2836
+ }
2837
+ /**
2838
+ * Returns the stdio mode for the post-core-update child process.
2839
+ *
2840
+ * Windows shells (PowerShell/CMD) wait for all processes that hold inherited console handles to
2841
+ * exit before returning the prompt, even after the immediate child has exited. Using "pipe" on
2842
+ * Windows prevents the child (and any grandchildren it spawns) from ever receiving a reference to
2843
+ * the parent's console handles, eliminating the terminal hang seen in #78445.
2844
+ *
2845
+ * @internal exported for testing
2846
+ */
2847
+ function resolvePostCoreUpdateChildStdio(platform = process.platform) {
2848
+ return platform === "win32" ? "pipe" : "inherit";
2849
+ }
2850
+ async function continuePostCoreUpdateInFreshProcess(params) {
2851
+ const entryPath = await resolveGatewayInstallEntrypoint(params.root);
2852
+ if (!entryPath) return { resumed: false };
2853
+ const argv = [entryPath, "update"];
2854
+ if (params.opts.json) argv.push("--json");
2855
+ if (params.opts.restart === false) argv.push("--no-restart");
2856
+ if (params.opts.yes) argv.push("--yes");
2857
+ if (params.opts.timeout) argv.push("--timeout", params.opts.timeout);
2858
+ const resultDir = await fs$1.mkdtemp(path.join(os.tmpdir(), "daocore-update-post-core-"));
2859
+ const resultPath = path.join(resultDir, "plugins.json");
2860
+ const installRecordsPath = path.join(resultDir, "plugin-install-records.json");
2861
+ const sourceConfigPath = path.join(resultDir, "source-config.json");
2862
+ const postCoreHostVersion = await readPackageVersion(params.root);
2863
+ try {
2864
+ await writePostCorePluginInstallRecordsFile(installRecordsPath, params.pluginInstallRecords);
2865
+ await writePostCoreSourceConfigFile(sourceConfigPath, params.preUpdateConfig);
2866
+ const childStdio = resolvePostCoreUpdateChildStdio();
2867
+ const child = spawn(params.nodeRunner ?? resolveNodeRunner(), argv, {
2868
+ stdio: childStdio,
2869
+ env: {
2870
+ ...stripGatewayServiceMarkerEnv(disableUpdatedPackageCompileCacheEnv(process.env)),
2871
+ [POST_CORE_UPDATE_ENV]: "1",
2872
+ [POST_CORE_UPDATE_CHANNEL_ENV]: params.channel,
2873
+ ...params.requestedChannel ? { [POST_CORE_UPDATE_REQUESTED_CHANNEL_ENV]: params.requestedChannel } : {},
2874
+ [POST_CORE_UPDATE_RESULT_PATH_ENV]: resultPath,
2875
+ [POST_CORE_UPDATE_INSTALL_RECORDS_PATH_ENV]: installRecordsPath,
2876
+ [POST_CORE_UPDATE_STARTED_AT_ENV]: String(params.updateStartedAtMs),
2877
+ ...postCoreHostVersion === null ? {} : { DAOCORE_COMPATIBILITY_HOST_VERSION: postCoreHostVersion },
2878
+ ...params.preUpdateConfig ? { [POST_CORE_UPDATE_SOURCE_CONFIG_PATH_ENV]: sourceConfigPath } : {}
2879
+ }
2880
+ });
2881
+ if (childStdio === "pipe") {
2882
+ child.stdout?.pipe(process.stdout);
2883
+ child.stderr?.pipe(process.stderr);
2884
+ }
2885
+ const childResult = await new Promise((resolve, reject) => {
2886
+ let settled = false;
2887
+ const finish = (result) => {
2888
+ if (settled) return;
2889
+ settled = true;
2890
+ clearInterval(resultPoll);
2891
+ resolve(result);
2892
+ };
2893
+ const resultPoll = setInterval(() => {
2894
+ readPostCorePluginUpdateResultFile(resultPath).then((pluginUpdate) => {
2895
+ if (!pluginUpdate) return;
2896
+ stopPostCoreUpdateChild(child);
2897
+ finish({
2898
+ kind: "plugin-update",
2899
+ pluginUpdate
2900
+ });
2901
+ }).catch(() => void 0);
2902
+ }, POST_CORE_UPDATE_RESULT_POLL_MS);
2903
+ child.once("error", (error) => {
2904
+ if (settled) return;
2905
+ settled = true;
2906
+ clearInterval(resultPoll);
2907
+ reject(error);
2908
+ });
2909
+ child.once("exit", (code, signal) => {
2910
+ if (settled) return;
2911
+ if (signal) {
2912
+ settled = true;
2913
+ clearInterval(resultPoll);
2914
+ reject(/* @__PURE__ */ new Error(`post-update process terminated by signal ${signal}`));
2915
+ return;
2916
+ }
2917
+ finish({
2918
+ kind: "exit",
2919
+ exitCode: code ?? 1
2920
+ });
2921
+ });
2922
+ });
2923
+ const pluginUpdate = childResult.kind === "plugin-update" ? childResult.pluginUpdate : await readPostCorePluginUpdateResultFile(resultPath);
2924
+ const exitCode = childResult.kind === "exit" ? childResult.exitCode : 0;
2925
+ if (exitCode !== 0) {
2926
+ if (pluginUpdate) return {
2927
+ resumed: true,
2928
+ pluginUpdate
2929
+ };
2930
+ defaultRuntime.exit(exitCode);
2931
+ throw new Error(`post-update process exited with code ${exitCode}`);
2932
+ }
2933
+ return {
2934
+ resumed: true,
2935
+ ...pluginUpdate ? { pluginUpdate } : {}
2936
+ };
2937
+ } finally {
2938
+ await fs$1.rm(resultDir, {
2939
+ recursive: true,
2940
+ force: true
2941
+ }).catch(() => void 0);
2942
+ }
2943
+ }
2944
+ function shouldResumePostCoreUpdateInFreshProcess(params) {
2945
+ if (params.downgradeRisk) return false;
2946
+ if (isPackageManagerUpdateMode(params.result.mode)) return true;
2947
+ if (params.result.mode !== "git") return false;
2948
+ const beforeSha = normalizeOptionalString(params.result.before?.sha);
2949
+ const afterSha = normalizeOptionalString(params.result.after?.sha);
2950
+ if (beforeSha && afterSha && beforeSha !== afterSha) return true;
2951
+ const beforeVersion = normalizeOptionalString(params.result.before?.version);
2952
+ const afterVersion = normalizeOptionalString(params.result.after?.version);
2953
+ return Boolean(beforeVersion && afterVersion && beforeVersion !== afterVersion);
2954
+ }
2955
+ async function writeControlPlaneUpdateRestartSentinelBestEffort(params) {
2956
+ if (!params.meta) return;
2957
+ try {
2958
+ await writeControlPlaneUpdateRestartSentinel({
2959
+ meta: params.meta,
2960
+ result: params.result
2961
+ });
2962
+ } catch (err) {
2963
+ const message = `Failed to write update.run restart sentinel: ${String(err)}`;
2964
+ if (params.jsonMode) defaultRuntime.error(message);
2965
+ else defaultRuntime.log(theme.warn(message));
2966
+ }
2967
+ }
2968
+ async function markControlPlaneUpdateRestartSentinelFailureBestEffort(params) {
2969
+ if (!params.meta) return;
2970
+ try {
2971
+ await markControlPlaneUpdateRestartSentinelFailure(params.reason);
2972
+ } catch (err) {
2973
+ const message = `Failed to mark update.run restart sentinel failed: ${String(err)}`;
2974
+ if (params.jsonMode) defaultRuntime.error(message);
2975
+ else defaultRuntime.log(theme.warn(message));
2976
+ }
2977
+ }
2978
+ async function updateCommand(opts) {
2979
+ suppressDeprecations();
2980
+ await cleanupStaleManagedServiceUpdateHandoffs().catch(() => void 0);
2981
+ const invocationCwd = tryResolveInvocationCwd();
2982
+ const postCoreUpdateResume = process.env[POST_CORE_UPDATE_ENV] === "1";
2983
+ const postCoreUpdateChannel = process.env[POST_CORE_UPDATE_CHANNEL_ENV]?.trim();
2984
+ const postCoreRequestedChannelInput = process.env[POST_CORE_UPDATE_REQUESTED_CHANNEL_ENV]?.trim() ?? "";
2985
+ const postCoreInstallRecordsPath = process.env[POST_CORE_UPDATE_INSTALL_RECORDS_PATH_ENV];
2986
+ const timeoutMs = parseTimeoutMsOrExit(opts.timeout);
2987
+ const shouldRestart = opts.restart !== false;
2988
+ if (timeoutMs === null) return;
2989
+ if (opts.dryRun !== true) {
2990
+ await disableCurrentDaoCoreUpdateLaunchdJob().catch(() => void 0);
2991
+ assertConfigWriteAllowedInCurrentMode();
2992
+ }
2993
+ const updateStepTimeoutMs = timeoutMs ?? DEFAULT_UPDATE_STEP_TIMEOUT_MS;
2994
+ let root = await resolveUpdateRoot();
2995
+ if (postCoreUpdateResume) {
2996
+ if (postCoreUpdateChannel !== "stable" && postCoreUpdateChannel !== "beta" && postCoreUpdateChannel !== "dev") {
2997
+ defaultRuntime.error("Missing post-core update channel context.");
2998
+ defaultRuntime.exit(1);
2999
+ return;
3000
+ }
3001
+ const postCoreRequestedChannel = postCoreRequestedChannelInput ? normalizeUpdateChannel(postCoreRequestedChannelInput) : null;
3002
+ if (postCoreRequestedChannelInput && !postCoreRequestedChannel) {
3003
+ defaultRuntime.error("Invalid post-core requested update channel context.");
3004
+ defaultRuntime.exit(1);
3005
+ return;
3006
+ }
3007
+ process.env.DAOCORE_COMPATIBILITY_HOST_VERSION = await readPackageVersion(root) ?? VERSION;
3008
+ let postCoreConfigSnapshot = await readConfigFileSnapshot({ skipPluginValidation: true });
3009
+ const preUpdateSourceConfig = await readPostCorePreUpdateSourceConfig({
3010
+ sourceConfigPath: process.env[POST_CORE_UPDATE_SOURCE_CONFIG_PATH_ENV],
3011
+ currentSnapshot: postCoreConfigSnapshot,
3012
+ updateStartedAtMs: await resolvePostCoreUpdateStartedAtMs(process.env)
3013
+ });
3014
+ postCoreConfigSnapshot = await persistRequestedUpdateChannel({
3015
+ configSnapshot: postCoreConfigSnapshot,
3016
+ requestedChannel: postCoreRequestedChannel
3017
+ });
3018
+ const restoredPostCoreConfig = restoreDroppedPreUpdateChannels(postCoreConfigSnapshot, preUpdateSourceConfig);
3019
+ const parentPluginInstallRecords = await readPostCorePluginInstallRecordsFile(postCoreInstallRecordsPath);
3020
+ const currentPluginInstallRecords = await loadInstalledPluginIndexInstallRecords();
3021
+ const pluginInstallRecords = Object.keys(currentPluginInstallRecords).length > 0 ? currentPluginInstallRecords : parentPluginInstallRecords;
3022
+ const pluginUpdate = await runPostCorePluginUpdate({
3023
+ root,
3024
+ channel: postCoreUpdateChannel,
3025
+ configSnapshot: restoredPostCoreConfig.snapshot,
3026
+ configChanged: restoredPostCoreConfig.changed,
3027
+ restoredAuthoredChannels: restoredPostCoreConfig.authoredChannels,
3028
+ opts,
3029
+ timeoutMs: updateStepTimeoutMs,
3030
+ pluginInstallRecords
3031
+ });
3032
+ if (process.env[POST_CORE_UPDATE_RESULT_PATH_ENV]) await writePostCorePluginUpdateResultFile(process.env[POST_CORE_UPDATE_RESULT_PATH_ENV], pluginUpdate);
3033
+ if (opts.json) {
3034
+ if (!process.env[POST_CORE_UPDATE_RESULT_PATH_ENV]) {
3035
+ const result = {
3036
+ status: pluginUpdate.status === "error" ? "error" : "ok",
3037
+ mode: "unknown",
3038
+ root,
3039
+ steps: [],
3040
+ durationMs: 0,
3041
+ postUpdate: { plugins: pluginUpdate }
3042
+ };
3043
+ defaultRuntime.writeJson(result);
3044
+ }
3045
+ }
3046
+ defaultRuntime.exit(0);
3047
+ return;
3048
+ }
3049
+ const controlPlaneUpdateSentinelMeta = await readControlPlaneUpdateSentinelMeta();
3050
+ const updateStatus = await checkUpdateStatus({
3051
+ root,
3052
+ timeoutMs: timeoutMs ?? 3500,
3053
+ fetchGit: false,
3054
+ includeRegistry: false
3055
+ });
3056
+ const requestedChannel = normalizeUpdateChannel(opts.channel);
3057
+ if (opts.channel && !requestedChannel) {
3058
+ defaultRuntime.error(`--channel must be "stable", "beta", or "dev" (got "${opts.channel}")`);
3059
+ defaultRuntime.exit(1);
3060
+ return;
3061
+ }
3062
+ let configSnapshot = await readConfigFileSnapshot({ skipPluginValidation: true });
3063
+ if (opts.channel && !opts.dryRun && !configSnapshot.valid) configSnapshot = await maybeRepairLegacyConfigForUpdateChannel({
3064
+ configSnapshot,
3065
+ jsonMode: Boolean(opts.json)
3066
+ });
3067
+ const storedChannel = configSnapshot.valid ? normalizeUpdateChannel(configSnapshot.config.update?.channel) : null;
3068
+ if (opts.channel && !configSnapshot.valid) {
3069
+ const issues = formatConfigIssueLines(configSnapshot.issues, "-");
3070
+ defaultRuntime.error(["Config is invalid; cannot set update channel.", ...issues].join("\n"));
3071
+ defaultRuntime.exit(1);
3072
+ return;
3073
+ }
3074
+ const installKind = updateStatus.installKind;
3075
+ const switchToGit = requestedChannel === "dev" && installKind !== "git";
3076
+ const switchToPackage = requestedChannel !== null && requestedChannel !== "dev" && installKind === "git";
3077
+ const updateInstallKind = switchToGit ? "git" : switchToPackage ? "package" : installKind;
3078
+ const channel = requestedChannel ?? storedChannel ?? (updateInstallKind === "git" ? "dev" : "stable");
3079
+ const devTargetRef = channel === "dev" ? process.env.DAOCORE_UPDATE_DEV_TARGET_REF?.trim() || void 0 : void 0;
3080
+ const explicitTag = normalizeTag(opts.tag);
3081
+ let tag = explicitTag ?? channelToNpmTag(channel);
3082
+ let currentVersion = null;
3083
+ let targetVersion = null;
3084
+ let downgradeRisk = false;
3085
+ let fallbackToLatest = false;
3086
+ let packageInstallSpec = null;
3087
+ let packageAlreadyCurrent = false;
3088
+ let managedServiceRootRedirect = null;
3089
+ let managedServiceNodeRunner;
3090
+ if (updateInstallKind === "package") {
3091
+ managedServiceRootRedirect = await resolveManagedServicePackageUpdateRoot({ root });
3092
+ if (managedServiceRootRedirect) {
3093
+ root = managedServiceRootRedirect.root;
3094
+ managedServiceNodeRunner = managedServiceRootRedirect.nodeRunner;
3095
+ if (!opts.json) {
3096
+ defaultRuntime.log(theme.muted(`Targeting managed gateway service package root: ${managedServiceRootRedirect.root}`));
3097
+ defaultRuntime.log(theme.warn(`Shell DaoCore root differs from the managed gateway service root: ${managedServiceRootRedirect.previousRoot}`));
3098
+ 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.`));
3099
+ if (managedServiceNodeRunner) defaultRuntime.log(theme.muted(`Managed gateway service Node: ${managedServiceNodeRunner}`));
3100
+ }
3101
+ } else {
3102
+ managedServiceNodeRunner = await resolveManagedServiceNodeRunnerOverride();
3103
+ if (managedServiceNodeRunner && !opts.json) {
3104
+ defaultRuntime.log(theme.warn(`Current Node (${resolveNodeRunner()}) differs from the managed gateway service Node (${managedServiceNodeRunner}).`));
3105
+ defaultRuntime.log(theme.muted(`Using the managed service Node for this update so the gateway can start after the upgrade.`));
3106
+ }
3107
+ }
3108
+ }
3109
+ if (updateInstallKind !== "git") {
3110
+ currentVersion = switchToPackage ? null : await readPackageVersion(root);
3111
+ if (explicitTag) targetVersion = await resolveTargetVersion(tag, timeoutMs);
3112
+ else targetVersion = await resolveNpmChannelTag({
3113
+ channel,
3114
+ timeoutMs
3115
+ }).then((resolved) => {
3116
+ tag = resolved.tag;
3117
+ fallbackToLatest = channel === "beta" && resolved.tag === "latest";
3118
+ return resolved.version;
3119
+ });
3120
+ const cmp = currentVersion && targetVersion ? compareSemverStrings(currentVersion, targetVersion) : null;
3121
+ packageAlreadyCurrent = updateInstallKind === "package" && !switchToPackage && currentVersion != null && targetVersion != null && currentVersion === targetVersion && (requestedChannel === null || requestedChannel === storedChannel);
3122
+ downgradeRisk = canResolveRegistryVersionForPackageTarget(tag) && !fallbackToLatest && currentVersion != null && (targetVersion == null || cmp != null && cmp > 0);
3123
+ packageInstallSpec = resolveGlobalInstallSpec({
3124
+ packageName: DEFAULT_PACKAGE_NAME,
3125
+ tag,
3126
+ env: process.env
3127
+ });
3128
+ }
3129
+ if (opts.dryRun) {
3130
+ let mode = "unknown";
3131
+ if (updateInstallKind === "git") mode = "git";
3132
+ else if (updateInstallKind === "package") mode = await resolveGlobalManager({
3133
+ root,
3134
+ installKind,
3135
+ timeoutMs: updateStepTimeoutMs
3136
+ });
3137
+ const actions = [];
3138
+ if (requestedChannel && requestedChannel !== storedChannel) actions.push(`Persist update.channel=${requestedChannel} in config`);
3139
+ if (switchToGit) actions.push("Switch install mode from package to git checkout (dev channel)");
3140
+ else if (switchToPackage) actions.push(`Switch install mode from git to package manager (${mode})`);
3141
+ else if (updateInstallKind === "git") actions.push(`Run git update flow on channel ${channel} (fetch/rebase/build/doctor)`);
3142
+ else if (packageAlreadyCurrent) actions.push(`Refresh package install with spec ${packageInstallSpec ?? tag}; current version already matches ${targetVersion}`);
3143
+ else actions.push(`Run global package manager update with spec ${packageInstallSpec ?? tag}`);
3144
+ actions.push("Run plugin update sync after core update");
3145
+ actions.push("Refresh shell completion cache (if needed)");
3146
+ actions.push(shouldRestart ? "Restart gateway service and run doctor checks" : "Skip restart (because --no-restart is set)");
3147
+ const notes = [];
3148
+ if (opts.tag && updateInstallKind === "git") notes.push("--tag applies to npm installs only; git updates ignore it.");
3149
+ if (fallbackToLatest) notes.push("Beta channel resolves to latest for this run (fallback).");
3150
+ if (managedServiceRootRedirect) notes.push(`Package update targets managed service root ${managedServiceRootRedirect.root} instead of invoking root ${managedServiceRootRedirect.previousRoot}.`);
3151
+ if (explicitTag && !canResolveRegistryVersionForPackageTarget(tag)) notes.push("Non-registry package specs skip npm version lookup and downgrade previews.");
3152
+ printDryRunPreview({
3153
+ dryRun: true,
3154
+ root,
3155
+ installKind,
3156
+ mode,
3157
+ updateInstallKind,
3158
+ switchToGit,
3159
+ switchToPackage,
3160
+ restart: shouldRestart,
3161
+ requestedChannel,
3162
+ storedChannel,
3163
+ effectiveChannel: channel,
3164
+ tag: packageInstallSpec ?? tag,
3165
+ currentVersion,
3166
+ targetVersion,
3167
+ downgradeRisk,
3168
+ actions,
3169
+ notes
3170
+ }, Boolean(opts.json));
3171
+ return;
3172
+ }
3173
+ if (downgradeRisk && !opts.yes) {
3174
+ if (!process.stdin.isTTY || opts.json) {
3175
+ defaultRuntime.error(["Downgrade confirmation required.", "Downgrading can break configuration. Re-run in a TTY to confirm."].join("\n"));
3176
+ defaultRuntime.exit(1);
3177
+ return;
3178
+ }
3179
+ const targetLabel = targetVersion ?? `${tag} (unknown)`;
3180
+ const ok = await confirm({
3181
+ message: stylePromptMessage(`Downgrading from ${currentVersion} to ${targetLabel} can break configuration. Continue?`),
3182
+ initialValue: false
3183
+ });
3184
+ if (isCancel(ok) || !ok) {
3185
+ if (!opts.json) defaultRuntime.log(theme.muted("Update cancelled."));
3186
+ defaultRuntime.exit(0);
3187
+ return;
3188
+ }
3189
+ }
3190
+ if (updateInstallKind === "git" && opts.tag && !opts.json) defaultRuntime.log(theme.muted("Note: --tag applies to npm installs only; git updates ignore it."));
3191
+ if (updateInstallKind === "package") {
3192
+ const runtimePreflightError = await resolvePackageRuntimePreflightError({
3193
+ tag,
3194
+ timeoutMs,
3195
+ nodeRunner: managedServiceNodeRunner
3196
+ });
3197
+ if (runtimePreflightError) {
3198
+ defaultRuntime.error(runtimePreflightError);
3199
+ defaultRuntime.exit(1);
3200
+ return;
3201
+ }
3202
+ }
3203
+ const showProgress = !opts.json && process.stdout.isTTY;
3204
+ if (!opts.json) {
3205
+ defaultRuntime.log(theme.heading("Updating DaoCore..."));
3206
+ defaultRuntime.log("");
3207
+ }
3208
+ const { progress, stop } = createUpdateProgress(showProgress);
3209
+ const startedAt = Date.now();
3210
+ const preUpdatePluginInstallRecords = await loadInstalledPluginIndexInstallRecords();
3211
+ let prePackageServiceStop;
3212
+ if (updateInstallKind === "package") {
3213
+ try {
3214
+ prePackageServiceStop = await maybeStopManagedServiceBeforePackageUpdate({
3215
+ shouldRestart,
3216
+ jsonMode: Boolean(opts.json)
3217
+ });
3218
+ } catch (err) {
3219
+ stop();
3220
+ defaultRuntime.error(`Failed to stop managed gateway service before update: ${String(err)}`);
3221
+ defaultRuntime.exit(1);
3222
+ return;
3223
+ }
3224
+ if (prePackageServiceStop?.blockMessage) {
3225
+ stop();
3226
+ defaultRuntime.error(prePackageServiceStop.blockMessage);
3227
+ defaultRuntime.exit(1);
3228
+ return;
3229
+ }
3230
+ if (shouldBlockPackageUpdateFromGatewayServiceEnv({ prePackageServiceStop })) {
3231
+ stop();
3232
+ defaultRuntime.error([
3233
+ "Package updates cannot run from inside the gateway service process.",
3234
+ "That path replaces the active DaoCore dist tree while the live gateway may still lazy-load old chunks.",
3235
+ `Run \`${replaceCliName(formatCliCommand("daocore update"), CLI_NAME)}\` from a shell outside the gateway service, or stop the gateway service first and then update.`
3236
+ ].join("\n"));
3237
+ defaultRuntime.exit(1);
3238
+ return;
3239
+ }
3240
+ }
3241
+ let result;
3242
+ try {
3243
+ result = updateInstallKind === "package" ? await runPackageInstallUpdate({
3244
+ root,
3245
+ installKind,
3246
+ tag,
3247
+ timeoutMs: updateStepTimeoutMs,
3248
+ startedAt,
3249
+ progress,
3250
+ jsonMode: Boolean(opts.json),
3251
+ managedServiceEnv: prePackageServiceStop?.serviceEnv,
3252
+ invocationCwd,
3253
+ honorPackageRoot: managedServiceRootRedirect !== null || managedServiceNodeRunner !== void 0,
3254
+ nodeRunner: managedServiceNodeRunner
3255
+ }) : await runGitUpdate({
3256
+ root,
3257
+ switchToGit,
3258
+ installKind,
3259
+ timeoutMs,
3260
+ startedAt,
3261
+ progress,
3262
+ channel,
3263
+ tag,
3264
+ showProgress,
3265
+ opts,
3266
+ stop,
3267
+ devTargetRef
3268
+ });
3269
+ } catch (err) {
3270
+ stop();
3271
+ await maybeRestartServiceAfterFailedPackageUpdate({
3272
+ prePackageServiceStop,
3273
+ jsonMode: Boolean(opts.json)
3274
+ });
3275
+ throw err;
3276
+ }
3277
+ stop();
3278
+ if (!opts.json || result.status !== "ok") printResult(result, {
3279
+ ...opts,
3280
+ hideSteps: showProgress
3281
+ });
3282
+ if (result.status === "error") {
3283
+ await writeControlPlaneUpdateRestartSentinelBestEffort({
3284
+ meta: controlPlaneUpdateSentinelMeta,
3285
+ result,
3286
+ jsonMode: Boolean(opts.json)
3287
+ });
3288
+ await maybeRestartServiceAfterFailedPackageUpdate({
3289
+ prePackageServiceStop,
3290
+ jsonMode: Boolean(opts.json)
3291
+ });
3292
+ defaultRuntime.exit(1);
3293
+ return;
3294
+ }
3295
+ if (result.status === "skipped") {
3296
+ await writeControlPlaneUpdateRestartSentinelBestEffort({
3297
+ meta: controlPlaneUpdateSentinelMeta,
3298
+ result,
3299
+ jsonMode: Boolean(opts.json)
3300
+ });
3301
+ await maybeRestartServiceAfterFailedPackageUpdate({
3302
+ prePackageServiceStop,
3303
+ jsonMode: Boolean(opts.json)
3304
+ });
3305
+ if (result.reason === "dirty") {
3306
+ defaultRuntime.error(theme.error("Update blocked: local files are edited in this checkout."));
3307
+ defaultRuntime.log(theme.warn("Git-based updates need a clean working tree before they can switch commits, fetch, or rebase."));
3308
+ defaultRuntime.log(theme.muted("Commit, stash, or discard the local changes, then rerun `daocore update`."));
3309
+ }
3310
+ if (result.reason === "not-git-install") {
3311
+ 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)}\`.`));
3312
+ defaultRuntime.log(theme.muted(`Examples: \`${replaceCliName("npm i -g daocore@latest", CLI_NAME)}\` or \`${replaceCliName("pnpm add -g daocore@latest", CLI_NAME)}\``));
3313
+ }
3314
+ defaultRuntime.exit(0);
3315
+ return;
3316
+ }
3317
+ const shouldResumePostCoreInFreshProcess = shouldResumePostCoreUpdateInFreshProcess({
3318
+ result,
3319
+ downgradeRisk
3320
+ });
3321
+ let postUpdateConfigSnapshot = result.status === "ok" && !opts.dryRun ? await readConfigFileSnapshot({ skipPluginValidation: true }) : configSnapshot;
3322
+ if (!shouldResumePostCoreInFreshProcess) postUpdateConfigSnapshot = await persistRequestedUpdateChannel({
3323
+ configSnapshot: postUpdateConfigSnapshot,
3324
+ requestedChannel
3325
+ });
3326
+ if (requestedChannel && configSnapshot.valid && requestedChannel !== storedChannel && !shouldResumePostCoreInFreshProcess && !opts.json) defaultRuntime.log(theme.muted(`Update channel set to ${requestedChannel}.`));
3327
+ else if (requestedChannel && configSnapshot.valid && requestedChannel !== storedChannel && shouldResumePostCoreInFreshProcess && !opts.json) defaultRuntime.log(theme.muted(`Update channel will be set to ${requestedChannel}.`));
3328
+ const postUpdateRoot = result.root ?? root;
3329
+ let postCorePluginUpdate;
3330
+ let pluginsUpdatedInFreshProcess = false;
3331
+ if (shouldResumePostCoreInFreshProcess) {
3332
+ const freshProcessResult = await continuePostCoreUpdateInFreshProcess({
3333
+ root: postUpdateRoot,
3334
+ channel,
3335
+ requestedChannel,
3336
+ opts,
3337
+ pluginInstallRecords: preUpdatePluginInstallRecords,
3338
+ updateStartedAtMs: startedAt,
3339
+ nodeRunner: managedServiceNodeRunner,
3340
+ preUpdateConfig: configSnapshot.valid ? {
3341
+ sourceConfig: configSnapshot.sourceConfig,
3342
+ authoredConfig: isRecord(configSnapshot.parsed) ? configSnapshot.parsed : configSnapshot.sourceConfig
3343
+ } : void 0
3344
+ });
3345
+ pluginsUpdatedInFreshProcess = freshProcessResult.resumed;
3346
+ postCorePluginUpdate = freshProcessResult.pluginUpdate;
3347
+ }
3348
+ if (!pluginsUpdatedInFreshProcess) {
3349
+ if (shouldResumePostCoreInFreshProcess) postUpdateConfigSnapshot = await persistRequestedUpdateChannel({
3350
+ configSnapshot: postUpdateConfigSnapshot,
3351
+ requestedChannel
3352
+ });
3353
+ const restoredConfig = restoreDroppedPreUpdateChannels(postUpdateConfigSnapshot, configSnapshot.valid ? {
3354
+ sourceConfig: configSnapshot.sourceConfig,
3355
+ authoredConfig: isRecord(configSnapshot.parsed) ? configSnapshot.parsed : configSnapshot.sourceConfig
3356
+ } : void 0);
3357
+ postUpdateConfigSnapshot = restoredConfig.snapshot;
3358
+ postCorePluginUpdate = await runPostCorePluginUpdate({
3359
+ root: postUpdateRoot,
3360
+ channel,
3361
+ configSnapshot: postUpdateConfigSnapshot,
3362
+ configChanged: restoredConfig.changed,
3363
+ restoredAuthoredChannels: restoredConfig.authoredChannels,
3364
+ opts,
3365
+ timeoutMs: updateStepTimeoutMs,
3366
+ pluginInstallRecords: preUpdatePluginInstallRecords
3367
+ });
3368
+ }
3369
+ const resultWithPostUpdate = postCorePluginUpdate ? {
3370
+ ...result,
3371
+ status: postCorePluginUpdate.status === "error" ? "error" : result.status,
3372
+ ...postCorePluginUpdate.status === "error" ? { reason: "post-update-plugins" } : {},
3373
+ postUpdate: {
3374
+ ...result.postUpdate,
3375
+ plugins: postCorePluginUpdate
3376
+ }
3377
+ } : result;
3378
+ if (postCorePluginUpdate?.status === "error") {
3379
+ await writeControlPlaneUpdateRestartSentinelBestEffort({
3380
+ meta: controlPlaneUpdateSentinelMeta,
3381
+ result: resultWithPostUpdate,
3382
+ jsonMode: Boolean(opts.json)
3383
+ });
3384
+ if (opts.json) defaultRuntime.writeJson(resultWithPostUpdate);
3385
+ else defaultRuntime.error(theme.error("Update failed during plugin post-update sync."));
3386
+ defaultRuntime.exit(1);
3387
+ return;
3388
+ }
3389
+ let restartScriptPath = null;
3390
+ let refreshGatewayServiceEnv = false;
3391
+ let gatewayServiceEnv;
3392
+ let gatewayPort = resolveUpdatedGatewayRestartPort({
3393
+ config: postUpdateConfigSnapshot.valid ? postUpdateConfigSnapshot.config : void 0,
3394
+ processEnv: process.env
3395
+ });
3396
+ if (shouldRestart) try {
3397
+ const serviceState = await readGatewayServiceState(resolveGatewayService(), { env: resolvePostUpdateServiceStateReadEnv({
3398
+ updateMode: resultWithPostUpdate.mode,
3399
+ processEnv: process.env,
3400
+ prePackageServiceEnv: prePackageServiceStop?.serviceEnv
3401
+ }) });
3402
+ if (shouldPrepareUpdatedInstallRestart({
3403
+ updateMode: resultWithPostUpdate.mode,
3404
+ serviceInstalled: serviceState.installed,
3405
+ serviceLoaded: serviceState.loaded
3406
+ })) {
3407
+ gatewayServiceEnv = serviceState.env;
3408
+ gatewayPort = resolveUpdatedGatewayRestartPort({
3409
+ config: postUpdateConfigSnapshot.valid ? postUpdateConfigSnapshot.config : void 0,
3410
+ processEnv: process.env,
3411
+ serviceEnv: gatewayServiceEnv
3412
+ });
3413
+ restartScriptPath = await prepareRestartScript(serviceState.env, gatewayPort);
3414
+ refreshGatewayServiceEnv = true;
3415
+ }
3416
+ } catch {}
3417
+ await tryWriteCompletionCache(postUpdateRoot, Boolean(opts.json));
3418
+ await tryInstallShellCompletion({
3419
+ jsonMode: Boolean(opts.json),
3420
+ skipPrompt: Boolean(opts.yes)
3421
+ });
3422
+ await writeControlPlaneUpdateRestartSentinelBestEffort({
3423
+ meta: controlPlaneUpdateSentinelMeta,
3424
+ result: buildControlPlaneUpdateRestartHealthPendingResult(resultWithPostUpdate),
3425
+ jsonMode: Boolean(opts.json)
3426
+ });
3427
+ if (!await maybeRestartService({
3428
+ shouldRestart,
3429
+ result: resultWithPostUpdate,
3430
+ opts,
3431
+ refreshServiceEnv: refreshGatewayServiceEnv,
3432
+ serviceEnv: gatewayServiceEnv,
3433
+ gatewayPort,
3434
+ restartScriptPath,
3435
+ invocationCwd,
3436
+ nodeRunner: managedServiceNodeRunner
3437
+ })) {
3438
+ await markControlPlaneUpdateRestartSentinelFailureBestEffort({
3439
+ meta: controlPlaneUpdateSentinelMeta,
3440
+ reason: "restart-unhealthy",
3441
+ jsonMode: Boolean(opts.json)
3442
+ });
3443
+ defaultRuntime.exit(1);
3444
+ return;
3445
+ }
3446
+ await writeControlPlaneUpdateRestartSentinelBestEffort({
3447
+ meta: controlPlaneUpdateSentinelMeta,
3448
+ result: resultWithPostUpdate,
3449
+ jsonMode: Boolean(opts.json)
3450
+ });
3451
+ if (!opts.json) defaultRuntime.log(theme.muted(pickUpdateQuip()));
3452
+ else defaultRuntime.writeJson(resultWithPostUpdate);
3453
+ }
3454
+ //#endregion
3455
+ //#region src/cli/update-cli/wizard.ts
3456
+ async function updateWizardCommand(opts = {}) {
3457
+ if (!process.stdin.isTTY) {
3458
+ defaultRuntime.error("Update wizard requires a TTY. Use `daocore update --channel <stable|beta|dev>` instead.");
3459
+ defaultRuntime.exit(1);
3460
+ return;
3461
+ }
3462
+ const timeoutMs = parseTimeoutMsOrExit(opts.timeout);
3463
+ if (timeoutMs === null) return;
3464
+ const root = await resolveUpdateRoot();
3465
+ const [updateStatus, configSnapshot] = await Promise.all([checkUpdateStatus({
3466
+ root,
3467
+ timeoutMs: timeoutMs ?? 3500,
3468
+ fetchGit: false,
3469
+ includeRegistry: false
3470
+ }), readConfigFileSnapshot()]);
3471
+ const channelInfo = resolveEffectiveUpdateChannel({
3472
+ configChannel: configSnapshot.valid ? normalizeUpdateChannel(configSnapshot.config.update?.channel) : null,
3473
+ installKind: updateStatus.installKind,
3474
+ git: updateStatus.git ? {
3475
+ tag: updateStatus.git.tag,
3476
+ branch: updateStatus.git.branch
3477
+ } : void 0
3478
+ });
3479
+ const channelLabel = formatUpdateChannelLabel({
3480
+ channel: channelInfo.channel,
3481
+ source: channelInfo.source,
3482
+ gitTag: updateStatus.git?.tag ?? null,
3483
+ gitBranch: updateStatus.git?.branch ?? null
3484
+ });
3485
+ const pickedChannel = await selectStyled({
3486
+ message: "Update channel",
3487
+ options: [
3488
+ {
3489
+ value: "keep",
3490
+ label: `Keep current (${channelInfo.channel})`,
3491
+ hint: channelLabel
3492
+ },
3493
+ {
3494
+ value: "stable",
3495
+ label: "Stable",
3496
+ hint: "Tagged releases (npm latest)"
3497
+ },
3498
+ {
3499
+ value: "beta",
3500
+ label: "Beta",
3501
+ hint: "Prereleases (npm beta)"
3502
+ },
3503
+ {
3504
+ value: "dev",
3505
+ label: "Dev",
3506
+ hint: "Git main"
3507
+ }
3508
+ ],
3509
+ initialValue: "keep"
3510
+ });
3511
+ if (isCancel(pickedChannel)) {
3512
+ defaultRuntime.log(theme.muted("Update cancelled."));
3513
+ defaultRuntime.exit(0);
3514
+ return;
3515
+ }
3516
+ const requestedChannel = pickedChannel === "keep" ? null : pickedChannel;
3517
+ if (requestedChannel === "dev" && updateStatus.installKind !== "git") {
3518
+ const gitDir = resolveGitInstallDir();
3519
+ if (!await isGitCheckout(gitDir)) {
3520
+ if (await pathExists$1(gitDir)) {
3521
+ if (!await isEmptyDir(gitDir)) {
3522
+ defaultRuntime.error(`DAOCORE_GIT_DIR points at a non-git directory: ${gitDir}. Set DAOCORE_GIT_DIR to an empty folder or an daocore checkout.`);
3523
+ defaultRuntime.exit(1);
3524
+ return;
3525
+ }
3526
+ }
3527
+ const ok = await confirm({
3528
+ message: stylePromptMessage(`Create a git checkout at ${gitDir}? (override via DAOCORE_GIT_DIR)`),
3529
+ initialValue: true
3530
+ });
3531
+ if (isCancel(ok) || !ok) {
3532
+ defaultRuntime.log(theme.muted("Update cancelled."));
3533
+ defaultRuntime.exit(0);
3534
+ return;
3535
+ }
3536
+ }
3537
+ }
3538
+ const restart = await confirm({
3539
+ message: stylePromptMessage("Restart the gateway service after update?"),
3540
+ initialValue: true
3541
+ });
3542
+ if (isCancel(restart)) {
3543
+ defaultRuntime.log(theme.muted("Update cancelled."));
3544
+ defaultRuntime.exit(0);
3545
+ return;
3546
+ }
3547
+ try {
3548
+ await updateCommand({
3549
+ channel: requestedChannel ?? void 0,
3550
+ restart,
3551
+ timeout: opts.timeout
3552
+ });
3553
+ } catch (err) {
3554
+ defaultRuntime.error(String(err));
3555
+ defaultRuntime.exit(1);
3556
+ }
3557
+ }
3558
+ //#endregion
3559
+ //#region src/cli/update-cli.ts
3560
+ function inheritedUpdateJson(command) {
3561
+ return Boolean(inheritOptionFromParent(command, "json"));
3562
+ }
3563
+ function inheritedUpdateTimeout(opts, command) {
3564
+ const timeout = opts.timeout;
3565
+ if (timeout) return timeout;
3566
+ return inheritOptionFromParent(command, "timeout");
3567
+ }
3568
+ function registerUpdateCli(program) {
3569
+ program.enablePositionalOptions();
3570
+ 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", () => {
3571
+ const fmtExamples = [
3572
+ ["daocore update", "Update a source checkout (git)"],
3573
+ ["daocore update --channel beta", "Switch to beta channel (git + npm)"],
3574
+ ["daocore update --channel dev", "Switch to dev channel (git + npm)"],
3575
+ ["daocore update --tag beta", "One-off update to a dist-tag or version"],
3576
+ ["daocore update --tag main", "One-off package update from GitHub main"],
3577
+ ["daocore update --dry-run", "Preview actions without changing anything"],
3578
+ ["daocore update --no-restart", "Update without restarting the service"],
3579
+ ["daocore update --json", "Output result as JSON"],
3580
+ ["daocore update --yes", "Non-interactive (accept downgrade prompts)"],
3581
+ ["daocore update wizard", "Interactive update wizard"],
3582
+ ["daocore --update", "Shorthand for daocore update"]
3583
+ ].map(([cmd, desc]) => ` ${theme.command(cmd)} ${theme.muted(`# ${desc}`)}`).join("\n");
3584
+ return `
3585
+ ${theme.heading("What this does:")}
3586
+ - Git checkouts: fetches, rebases, installs deps, builds, and runs doctor
3587
+ - npm installs: updates via detected package manager
3588
+
3589
+ ${theme.heading("Switch channels:")}
3590
+ - Use --channel stable|beta|dev to persist the update channel in config
3591
+ - Run daocore update status to see the active channel and source
3592
+ - Use --tag <dist-tag|version|spec> for a one-off package update without persisting
3593
+ - Use --tag main for a one-off package update from GitHub main
3594
+
3595
+ ${theme.heading("Non-interactive:")}
3596
+ - Use --yes to accept downgrade prompts
3597
+ - Combine with --channel/--tag/--no-restart/--json/--timeout as needed
3598
+ - Use --dry-run to preview actions without writing config/installing/restarting
3599
+
3600
+ ${theme.heading("Examples:")}
3601
+ ${fmtExamples}
3602
+
3603
+ ${theme.heading("Notes:")}
3604
+ - Switch channels with --channel stable|beta|dev
3605
+ - For global installs: auto-updates via detected package manager when possible (see docs/install/updating.md)
3606
+ - Downgrades require confirmation (can break configuration)
3607
+ - Skips update if the working directory has uncommitted changes
3608
+
3609
+ ${theme.muted("Docs:")} ${formatDocsLink("/cli/update", "daocore-ai.vercel.app/cli/update")}`;
3610
+ }).action(async (opts) => {
3611
+ try {
3612
+ await updateCommand({
3613
+ json: Boolean(opts.json),
3614
+ restart: Boolean(opts.restart),
3615
+ dryRun: Boolean(opts.dryRun),
3616
+ channel: opts.channel,
3617
+ tag: opts.tag,
3618
+ timeout: opts.timeout,
3619
+ yes: Boolean(opts.yes)
3620
+ });
3621
+ } catch (err) {
3622
+ defaultRuntime.error(String(err));
3623
+ defaultRuntime.exit(1);
3624
+ }
3625
+ });
3626
+ 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) => {
3627
+ try {
3628
+ await updateFinalizeCommand({
3629
+ json: Boolean(opts.json) || inheritedUpdateJson(command),
3630
+ channel: opts.channel,
3631
+ timeout: inheritedUpdateTimeout(opts, command),
3632
+ yes: Boolean(opts.yes),
3633
+ restart: Boolean(opts.restart)
3634
+ });
3635
+ } catch (err) {
3636
+ defaultRuntime.error(String(err));
3637
+ defaultRuntime.exit(1);
3638
+ }
3639
+ });
3640
+ 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", "daocore-ai.vercel.app/cli/update")}\n`).action(async (opts, command) => {
3641
+ try {
3642
+ await updateWizardCommand({ timeout: inheritedUpdateTimeout(opts, command) });
3643
+ } catch (err) {
3644
+ defaultRuntime.error(String(err));
3645
+ defaultRuntime.exit(1);
3646
+ }
3647
+ });
3648
+ 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([
3649
+ ["daocore update status", "Show channel + version status."],
3650
+ ["daocore update status --json", "JSON output."],
3651
+ ["daocore update status --timeout 10", "Custom timeout."]
3652
+ ])}\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", "daocore-ai.vercel.app/cli/update")}`).action(async (opts, command) => {
3653
+ try {
3654
+ await updateStatusCommand({
3655
+ json: Boolean(opts.json) || inheritedUpdateJson(command),
3656
+ timeout: inheritedUpdateTimeout(opts, command)
3657
+ });
3658
+ } catch (err) {
3659
+ defaultRuntime.error(String(err));
3660
+ defaultRuntime.exit(1);
3661
+ }
3662
+ });
3663
+ }
3664
+ //#endregion
3665
+ export { registerUpdateCli, updateCommand, updateFinalizeCommand, updateStatusCommand, updateWizardCommand };