@gaodefa/daocore 2026.5.29 → 2026.5.30
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.
- package/dist/abort-DI3P6TIb.js +277 -0
- package/dist/abort.runtime-B6Z7lDEa.js +2 -0
- package/dist/abort.runtime.js +1 -1
- package/dist/account-inspect-BFz7X0TX.js +173 -0
- package/dist/accounts-BoYYrY7x.js +107 -0
- package/dist/accounts-Busq29zW.js +107 -0
- package/dist/accounts-CuvH2tuN.js +119 -0
- package/dist/accounts-DkIcqvf7.js +2 -0
- package/dist/acp-runtime-BA8lzXzf.js +26 -0
- package/dist/acp-spawn-DPz2aX3A.js +2 -0
- package/dist/acp-spawn-DvVCsWYV.js +1275 -0
- package/dist/acp-stateful-target-driver-DcC76aZW.js +89 -0
- package/dist/action-kill-D-dVisIX.js +33 -0
- package/dist/action-runtime-BEiqwxDD.js +469 -0
- package/dist/action-runtime-api-1LzcGjcX.js +2 -0
- package/dist/action-send-c3CnDuPg.js +39 -0
- package/dist/action-spawn-Dj4kwpWs.js +47 -0
- package/dist/actions-qLccmQBc.js +161 -0
- package/dist/actions.runtime-B5vYAgNi.js +5 -0
- package/dist/agent-command-D6Ds198G.js +1367 -0
- package/dist/agent-components.runtime-xquK0B3L.js +10 -0
- package/dist/agent-components.runtime.js +1 -1
- package/dist/agent-harness-runtime-Dq1fCBOM.js +180 -0
- package/dist/agent-harness-task-runtime-DvSEqFkD.js +140 -0
- package/dist/agent-lm5ZYOFy.js +3 -0
- package/dist/agent-runner-execution-Dbh2pDhQ.js +1713 -0
- package/dist/agent-runner-utils-Di3r2T1T.js +266 -0
- package/dist/agent-runner.runtime-BW90EcGW.js +3455 -0
- package/dist/agent-runner.runtime.js +1 -1
- package/dist/agent-runtime-BgIT5Ytc.js +229 -0
- package/dist/agent-via-gateway-DMMS8-hK.js +463 -0
- package/dist/agent-ylolD8-V.js +2 -0
- package/dist/api-BB4vXLtW.js +2 -0
- package/dist/api-CUhM3KNB.js +134 -0
- package/dist/api-CewRHSbT.js +6 -0
- package/dist/api-CfKjNJlW.js +2 -0
- package/dist/api-Rsnqui1u.js +3 -0
- package/dist/api-k7AvxwHr.js +639 -0
- package/dist/apply-DQ4TQNMA.js +54 -0
- package/dist/apply-S_75Py4Y.js +41 -0
- package/dist/approval-handler.runtime-Cthxrstu.js +130 -0
- package/dist/assistant-Cp9pGaBw.js +291 -0
- package/dist/attachment-normalize-5R0bLLOj.js +225 -0
- package/dist/attempt-execution-DuyyZYsU.js +558 -0
- package/dist/attempt-execution.runtime-DF2GPgNh.js +3 -0
- package/dist/attempt-execution.runtime.js +1 -1
- package/dist/attempt-execution.shared-CwdukA3t.js +38 -0
- package/dist/attempt.prompt-helpers-CUqKtIa5.js +475 -0
- package/dist/attempt.tool-run-context-BbN4_BYO.js +2094 -0
- package/dist/binding-routing-C6Ex2Blu.js +113 -0
- package/dist/binding-targets-BqREncSL.js +121 -0
- package/dist/bot-DGMEkaIJ.js +7894 -0
- package/dist/bot-deps-BltYjeMX.js +2 -0
- package/dist/bot-deps-XvGCor9f.js +747 -0
- package/dist/bot-message-context.runtime-kK-xvLV7.js +7 -0
- package/dist/bot-message-context.runtime.js +1 -1
- package/dist/bot-message-context.session.runtime-DpOIJUae.js +12 -0
- package/dist/bot-message-context.session.runtime.js +1 -1
- package/dist/bot-native-commands.delivery.runtime-D49p5Lc1.js +4 -0
- package/dist/bot-native-commands.delivery.runtime.js +1 -1
- package/dist/bot-native-commands.runtime-8XBdSpkQ.js +13 -0
- package/dist/bot-native-commands.runtime.js +1 -1
- package/dist/bridge-server-y_XGduPx.js +113 -0
- package/dist/browser-cli-B2jmmTT3.js +230 -0
- package/dist/browser-cli-actions-input-JQt5ZQcn.js +473 -0
- package/dist/browser-cli-actions-observe-CrfKh6AX.js +81 -0
- package/dist/browser-cli-debug-DQACWlvC.js +137 -0
- package/dist/browser-cli-inspect-DDnxx0Xw.js +104 -0
- package/dist/browser-cli-lEuOnZzs.js +2 -0
- package/dist/browser-cli-manage-DogmwtYt.js +443 -0
- package/dist/browser-cli-resize-BHuV71VZ.js +26 -0
- package/dist/browser-cli-shared-CidShgoF.js +50 -0
- package/dist/browser-cli-state-i8cCGbiQ.js +337 -0
- package/dist/browser-control-auth-CKfXdXWj.js +2 -0
- package/dist/browser-profiles-ATBTvUGh.js +2 -0
- package/dist/browser-runtime-KmCT6FuL.js +384 -0
- package/dist/build-DOOT6f62.js +257 -0
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +2 -2
- package/dist/bundled/session-memory/handler.js +1 -1
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/capability-cli-DwvrwB-g.js +1782 -0
- package/dist/channel-B-wgK1bK.js +481 -0
- package/dist/channel-B1e_k1P0.js +867 -0
- package/dist/channel-BRDfa5tc.js +1777 -0
- package/dist/channel-BVEO1O4p.js +376 -0
- package/dist/channel-BYlO5l1d.js +508 -0
- package/dist/channel-Bl0sPoNx.js +653 -0
- package/dist/channel-C84xtDBy.js +1134 -0
- package/dist/channel-CLgKq4Ds.js +1556 -0
- package/dist/channel-CZT0qxLh.js +1249 -0
- package/dist/channel-CffBHWkb.js +955 -0
- package/dist/channel-D34ZJvVB.js +2126 -0
- package/dist/channel-DcdXLo_W.js +238 -0
- package/dist/channel-DnK5TrXV.js +362 -0
- package/dist/channel-Dzj4RHY2.js +740 -0
- package/dist/channel-OhZzLZCj.js +562 -0
- package/dist/channel-actions.runtime-Cdvhqc9s.js +265 -0
- package/dist/channel-actions.runtime.js +1 -1
- package/dist/channel-core-Dz9I_R4j.js +5 -0
- package/dist/channel-inbound-COGoV_aS.js +80 -0
- package/dist/channel-mP6HCIMr.js +1496 -0
- package/dist/channel-plugin-runtime-C0R46KeG.js +998 -0
- package/dist/channel-quGdgWel.js +808 -0
- package/dist/channel-runtime-FvPQoIF9.js +408 -0
- package/dist/channel.runtime-2vUz3gij.js +109 -0
- package/dist/channel.runtime-BZLDSNuQ.js +254 -0
- package/dist/channel.runtime-Bo5jO0Hj.js +4 -0
- package/dist/channel.runtime-CDgvrjM2.js +652 -0
- package/dist/channel.runtime-COf8SDFn.js +88 -0
- package/dist/channel.runtime-C_C1f8lu.js +733 -0
- package/dist/channel.runtime-CqPbsg8t.js +2528 -0
- package/dist/channel.runtime-DtV85Khx.js +1008 -0
- package/dist/channel.runtime-Spt1ukGW.js +21009 -0
- package/dist/channel.setup-Bc0LUQS1.js +1098 -0
- package/dist/channel.setup-ChTkj2hq.js +343 -0
- package/dist/channel.setup-CpMD9F8i.js +10 -0
- package/dist/chat-mUsjD5YN.js +2666 -0
- package/dist/chrome-u314zcbM.js +1503 -0
- package/dist/cli/run-main.js +5 -5
- package/dist/cli-CJMoqXrc.js +1341 -0
- package/dist/cli-compaction-qGYB7suI.js +347 -0
- package/dist/cli-metadata-BBJFpNU9.js +22 -0
- package/dist/cli-runner-C0kcts0I.js +540 -0
- package/dist/cli-runner-CTm8K6s8.js +2 -0
- package/dist/cli-runner.runtime-C8deL5FL.js +3 -0
- package/dist/cli-runner.runtime-DDAg1D0L.js +4 -0
- package/dist/cli-runner.runtime.js +1 -1
- package/dist/cli-startup-metadata.json +8 -8
- package/dist/client-CPxpgs4m.js +650 -0
- package/dist/client-adapter-CLlqOqfu.js +897 -0
- package/dist/client-factory-R7Rr2jwn.js +9 -0
- package/dist/command-auth-CkQP1buP.js +135 -0
- package/dist/command-handlers-CJEjFyMk.js +1609 -0
- package/dist/command-registry-BDgyOqDw.js +4 -0
- package/dist/command-registry-BVi5Jn1S.js +9 -0
- package/dist/command-registry-core-JCfsVRtz.js +110 -0
- package/dist/command-status.runtime-CM1JLzi6.js +90 -0
- package/dist/command-status.runtime.js +1 -1
- package/dist/commands-acp-C1-I78U6.js +74 -0
- package/dist/commands-compact.runtime-DOsNavwp.js +10 -0
- package/dist/commands-compact.runtime.js +1 -1
- package/dist/commands-handlers.runtime-BD1n2WGw.js +6154 -0
- package/dist/commands-handlers.runtime.js +1 -1
- package/dist/commands-status-DU_UTQz1.js +16 -0
- package/dist/commands-status-DejfTakp.js +3 -0
- package/dist/commands-status.runtime-DejfTakp.js +3 -0
- package/dist/commands-status.runtime.js +1 -1
- package/dist/commands-subagents-control.runtime-D7vo_2Y_.js +3 -0
- package/dist/commands-subagents-control.runtime-DGybTjJ6.js +2 -0
- package/dist/commands-subagents-control.runtime.js +1 -1
- package/dist/commands-system-prompt-BEBXAMea.js +2 -0
- package/dist/commands-system-prompt-gj3oQpQO.js +162 -0
- package/dist/commands.runtime-CgXX70IN.js +176 -0
- package/dist/commands.runtime.js +1 -1
- package/dist/commitments/runtime.js +1 -1
- package/dist/compact-C41XxMDt.js +480 -0
- package/dist/compact-DUVAF9EC.js +1141 -0
- package/dist/compact.runtime-COMRg6s3.js +12 -0
- package/dist/compact.runtime.js +1 -1
- package/dist/completion-cli-CmEYoB9a.js +315 -0
- package/dist/computer-use-BwJHu1QF.js +367 -0
- package/dist/config-ATBTvUGh.js +2 -0
- package/dist/config-DlNgjF8W.js +373 -0
- package/dist/config-mutations-tl_OqI6d.js +159 -0
- package/dist/context-engine-host-compat-BNPAIK9F.js +288 -0
- package/dist/context-engine-host-compat-C69CK7zS.js +2 -0
- package/dist/context-engine-lifecycle-iQ8f5a_-.js +1274 -0
- package/dist/control-auth-vVxyGKxY.js +114 -0
- package/dist/control-service-73nj79EW.js +145 -0
- package/dist/control-ui/assets/agents-DdWIz8Vk.js +1008 -0
- package/dist/control-ui/assets/channel-config-extras-C7ELhuDi.js +2 -0
- package/dist/control-ui/assets/channels-Bsoj-9BS.js +367 -0
- package/dist/control-ui/assets/cron-BRTEw1tT.js +1013 -0
- package/dist/control-ui/assets/debug-EKl_F8_L.js +97 -0
- package/dist/control-ui/assets/index-DSbSO7ys.js +7370 -0
- package/dist/control-ui/assets/instances-B1AoYwI5.js +57 -0
- package/dist/control-ui/assets/logs-BChOznzh.js +74 -0
- package/dist/control-ui/assets/nodes-5yebKh9k.js +436 -0
- package/dist/control-ui/assets/sessions-BlDYNThc.js +399 -0
- package/dist/control-ui/assets/skills-shared-CNFnf7KU.js +11 -0
- package/dist/control-ui/assets/skills-uxTDRmLx.js +314 -0
- package/dist/control-ui/index.html +1 -1
- package/dist/control-ui/sw.js +1 -1
- package/dist/conversation-binding-runtime-CmoTKcY1.js +4 -0
- package/dist/conversation-runtime-BxOHxuin.js +31 -0
- package/dist/core-D0Y2H55f.js +282 -0
- package/dist/core-api-BKlJUtDt.js +5 -0
- package/dist/core-api-_fiftUHn.js +2 -0
- package/dist/crestodian/crestodian.js +1 -1
- package/dist/crestodian/rescue-message.js +1 -1
- package/dist/crestodian-BJifoQiR.js +55 -0
- package/dist/daocore-tools-BMdF8RwK.js +11727 -0
- package/dist/delivery-e2ci_bcX.js +1002 -0
- package/dist/dialogue-BXayGhnz.js +37 -0
- package/dist/dir-fetch-tool-Cara5mZh.js +565 -0
- package/dist/dir-list-tool-CQ8Bo5Ez.js +100 -0
- package/dist/direct-dm-CPk6Qm9D.js +64 -0
- package/dist/directive-handling.fast-lane-BQ9aXqk8.js +68 -0
- package/dist/directive-handling.impl--a5AGurq.js +818 -0
- package/dist/directive-handling.impl-C4JqMwle.js +2 -0
- package/dist/directive-handling.model-selection-pyTYMIXn.js +122 -0
- package/dist/directive-handling.persist.runtime-B7vWT1r9.js +263 -0
- package/dist/directive-handling.persist.runtime.js +1 -1
- package/dist/dispatch-3Ru_eGq1.js +1640 -0
- package/dist/dispatch-acp-transcript.runtime-CYMP-5oE.js +40 -0
- package/dist/dispatch-acp-transcript.runtime.js +1 -1
- package/dist/dispatch-acp.runtime-BVCiklXk.js +18 -0
- package/dist/dispatch-acp.runtime.js +1 -1
- package/dist/doctor-B8mR3Sgr.js +2 -0
- package/dist/doctor-BJ6DuerV.js +6 -0
- package/dist/doctor-config-flow-BdOGs_zn.js +1741 -0
- package/dist/doctor-core-checks-CDf0stz-.js +2 -0
- package/dist/doctor-core-checks-Cpdnu2XI.js +573 -0
- package/dist/doctor-health-0qv_acBu.js +65 -0
- package/dist/doctor-health-contributions-Db1FQgFw.js +696 -0
- package/dist/doctor-lint-C1g4Llgl.js +94 -0
- package/dist/doctor-state-integrity-C8iXFLJ7.js +1231 -0
- package/dist/doctor-update-CsPu6p3d.js +58 -0
- package/dist/dynamic-tools-YQ0z0YKH.js +486 -0
- package/dist/embedded-backend-S0cahIZw.js +579 -0
- package/dist/embedded-gateway-stub.runtime-Cjw12ALm.js +12 -0
- package/dist/embedded-gateway-stub.runtime.js +1 -1
- package/dist/exec-approvals-ArHHjoE-.js +149 -0
- package/dist/extensionAPI.js +1 -1
- package/dist/extensions/active-memory/index.js +1 -1
- package/dist/extensions/admin-http-rpc/index.js +1 -1
- package/dist/extensions/browser/browser-bridge.js +1 -1
- package/dist/extensions/browser/browser-config.js +4 -4
- package/dist/extensions/browser/browser-control-auth.js +2 -2
- package/dist/extensions/browser/browser-doctor.js +2 -2
- package/dist/extensions/browser/browser-maintenance.js +1 -1
- package/dist/extensions/browser/browser-profiles.js +2 -2
- package/dist/extensions/browser/browser-runtime-api.js +11 -11
- package/dist/extensions/browser/cli-metadata.js +1 -1
- package/dist/extensions/browser/index.js +1 -1
- package/dist/extensions/browser/plugin-registration.js +1 -1
- package/dist/extensions/browser/register.runtime.js +4 -4
- package/dist/extensions/browser/runtime-api.js +13 -13
- package/dist/extensions/canvas/index.js +1 -1
- package/dist/extensions/clickclack/api.js +2 -2
- package/dist/extensions/clickclack/channel-plugin-api.js +1 -1
- package/dist/extensions/clickclack/runtime-api.js +2 -2
- package/dist/extensions/device-pair/api.js +1 -1
- package/dist/extensions/device-pair/pair-command-approve.js +1 -1
- package/dist/extensions/file-transfer/index.js +4 -4
- package/dist/extensions/imessage/api.js +2 -2
- package/dist/extensions/imessage/channel-plugin-api.js +1 -1
- package/dist/extensions/imessage/message-tool-api.d.ts +1 -1
- package/dist/extensions/imessage/runtime-api.js +3 -3
- package/dist/extensions/irc/api.js +2 -2
- package/dist/extensions/irc/channel-plugin-api.js +1 -1
- package/dist/extensions/llm-task/index.js +1 -1
- package/dist/extensions/mattermost/api.js +1 -1
- package/dist/extensions/mattermost/channel-plugin-api.js +1 -1
- package/dist/extensions/mattermost/channel-plugin-runtime.js +1 -1
- package/dist/extensions/mattermost/policy-api.js +1 -1
- package/dist/extensions/mattermost/runtime-api.js +2 -2
- package/dist/extensions/mattermost/slash-route-api.js +1 -1
- package/dist/extensions/memory-core/cli-metadata.js +1 -1
- package/dist/extensions/migrate-claude/apply.js +1 -1
- package/dist/extensions/migrate-claude/index.js +1 -1
- package/dist/extensions/migrate-claude/plan.js +1 -1
- package/dist/extensions/migrate-claude/provider.js +1 -1
- package/dist/extensions/migrate-claude/targets.js +1 -1
- package/dist/extensions/migrate-hermes/apply.js +1 -1
- package/dist/extensions/migrate-hermes/index.js +1 -1
- package/dist/extensions/migrate-hermes/model.js +1 -1
- package/dist/extensions/migrate-hermes/plan.js +1 -1
- package/dist/extensions/migrate-hermes/provider.js +1 -1
- package/dist/extensions/migrate-hermes/secrets.js +1 -1
- package/dist/extensions/migrate-hermes/targets.js +1 -1
- package/dist/extensions/policy/api.js +1 -1
- package/dist/extensions/policy/index.js +2 -2
- package/dist/extensions/signal/api.js +6 -6
- package/dist/extensions/signal/channel-plugin-api.js +1 -1
- package/dist/extensions/signal/reaction-runtime-api.js +1 -1
- package/dist/extensions/signal/runtime-api.js +7 -7
- package/dist/extensions/skill-workshop/api.js +1 -1
- package/dist/extensions/skill-workshop/index.js +2 -2
- package/dist/extensions/telegram/account-inspect-api.js +1 -1
- package/dist/extensions/telegram/api.js +11 -11
- package/dist/extensions/telegram/channel-plugin-api.js +2 -2
- package/dist/extensions/telegram/contract-api.js +3 -3
- package/dist/extensions/telegram/runtime-api.js +7 -7
- package/dist/extensions/telegram/security-audit-contract-api.js +1 -1
- package/dist/extensions/telegram/setup-plugin-api.js +1 -1
- package/dist/extensions/telegram/test-api.js +2 -2
- package/dist/extensions/webhooks/api.js +1 -1
- package/dist/extensions/webhooks/index.js +1 -1
- package/dist/extensions/xai/index.js +4 -4
- package/dist/extensions/xai/realtime-transcription-provider.js +1 -1
- package/dist/extensions/xai/speech-provider.js +1 -1
- package/dist/extensions/xai/test-api.js +1 -1
- package/dist/extensions/xai/tts.js +1 -1
- package/dist/extensions/xai/web-search.js +1 -1
- package/dist/extensions/xai/xai-oauth.js +1 -1
- package/dist/file-fetch-tool-DQpAtjX4.js +124 -0
- package/dist/file-write-tool-CkB0oYwe.js +127 -0
- package/dist/format-DUJUpMFQ.js +1145 -0
- package/dist/gateway-cli-CQo_E4Ka.js +435 -0
- package/dist/gateway-method-runtime-1QPgVJH7.js +21 -0
- package/dist/get-reply-DfUcsC-O.js +4689 -0
- package/dist/get-reply-from-config.runtime-C95MG73O.js +2 -0
- package/dist/get-reply-from-config.runtime.js +1 -1
- package/dist/graph-users-DPJe0fPs.js +1419 -0
- package/dist/group-access-DefaNJ6L.js +112 -0
- package/dist/handle-action.guild-admin-C1sy1kGJ.js +288 -0
- package/dist/harness-BgPRdmNK.js +61 -0
- package/dist/health-DFR9A1YV.js +4 -0
- package/dist/heartbeat-runner-BiYVPs25.js +5 -0
- package/dist/heartbeat-runner.runtime-Bmaq8WUA.js +4 -0
- package/dist/heartbeat-runner.runtime.js +1 -1
- package/dist/hooks-CNJDuJUm.js +534 -0
- package/dist/inbound-direct-dm-runtime-DFt58p71.js +2 -0
- package/dist/inbound-reply-dispatch-kgSDM8ax.js +148 -0
- package/dist/index.js +1 -1
- package/dist/init-B0zO_U4r.js +59 -0
- package/dist/inline-buttons-B6zgQW3J.js +40 -0
- package/dist/internal-events-C3Q5t6hg.js +90 -0
- package/dist/isolated-agent-CaSU5GCJ.js +2 -0
- package/dist/isolated-agent-CnsD2TmP.js +1118 -0
- package/dist/lifecycle-i3WZDaIn.js +571 -0
- package/dist/list.probe-g0rUiVXW.js +449 -0
- package/dist/list.status-command-DG3PrmeO.js +789 -0
- package/dist/llm-slug-generator-CHlf69FU.js +78 -0
- package/dist/llm-slug-generator.js +1 -1
- package/dist/local-dispatch.runtime-CDeHUp_A.js +9 -0
- package/dist/local-dispatch.runtime.js +1 -1
- package/dist/manager.runtime-BlLMPUTq.js +2714 -0
- package/dist/manager.runtime.js +1 -1
- package/dist/markdown-to-line-r_mBHMdy.js +811 -0
- package/dist/mcp-http-C5UPIJGR.js +555 -0
- package/dist/mcp-http-CTy9gpfA.js +2 -0
- package/dist/media-understanding-provider-BT6TOuVa.js +339 -0
- package/dist/message-actions-BdcjjwFt.js +145 -0
- package/dist/message-handler-B29Tj2p2.js +1715 -0
- package/dist/message-handler-BhHb1FHI.js +384 -0
- package/dist/message-handler.preflight-ouZ_-3o8.js +1125 -0
- package/dist/message-handler.process-CrYiBx_F.js +1484 -0
- package/dist/model-CLbtocQX.js +74 -0
- package/dist/model-selection-BG_vU9Kl.js +272 -0
- package/dist/models-4KERn3ya.js +104 -0
- package/dist/models-BCa-ipxi.js +2 -0
- package/dist/models-cli-DtpGXEsf.js +256 -0
- package/dist/monitor-B-egsvmI.js +1657 -0
- package/dist/monitor-BJX9Yv7k.js +2 -0
- package/dist/monitor-BPrIy3pV.js +715 -0
- package/dist/monitor-BWknZZ7N.js +4377 -0
- package/dist/monitor-C3y_PtI1.js +60 -0
- package/dist/monitor-DCzfdqE4.js +1370 -0
- package/dist/monitor-P24epSwE.js +2788 -0
- package/dist/monitor-auth-CEG_xldE.js +179 -0
- package/dist/monitor-jEePJbbS.js +834 -0
- package/dist/monitor-polling.runtime-BzlHK11u.js +883 -0
- package/dist/monitor-polling.runtime.js +1 -1
- package/dist/monitor-webhook.runtime-vFEhk_Zj.js +387 -0
- package/dist/monitor-webhook.runtime.js +1 -1
- package/dist/monitor.account-BUIfgWXg.js +5233 -0
- package/dist/monitor.runtime-Cp7W4fhb.js +2 -0
- package/dist/monitor.runtime.js +1 -1
- package/dist/monitor.webhook-DzrbeR4T.js +180 -0
- package/dist/node-cli-sessions-CLbI14UA.js +1228 -0
- package/dist/openai-http-BM9BIA_g.js +824 -0
- package/dist/openresponses-http-CNoW9kk8.js +1173 -0
- package/dist/operations-DT4bsxV6.js +805 -0
- package/dist/outbound-adapter-CZRUOgY0.js +543 -0
- package/dist/outbound-session-route-DneMsGNx.js +45 -0
- package/dist/outbound.runtime-CHuoKJJI.js +2 -0
- package/dist/outbound.runtime.js +1 -1
- package/dist/pi-embedded-1-rsueO_.js +3796 -0
- package/dist/pi-embedded-BRfDncVO.js +4 -0
- package/dist/pi-embedded.runtime-DEYoa6bW.js +4 -0
- package/dist/pi-embedded.runtime.js +1 -1
- package/dist/pi-tools-C0P3NgP5.js +2413 -0
- package/dist/plan-BQUkjBMY.js +81 -0
- package/dist/plan-CRO9_2_k.js +112 -0
- package/dist/plugin-BJCmWhnh.js +12396 -0
- package/dist/plugin-app-cache-key-CXAg0F7A.js +46 -0
- package/dist/plugin-enabled-D93Z9LSo.js +233 -0
- package/dist/plugin-registration-BBrTcZnf.js +88 -0
- package/dist/plugin-sdk/.boundary-entry-shims.stamp +1 -1
- package/dist/plugin-sdk/acp-runtime-backend.js +1 -1
- package/dist/plugin-sdk/acp-runtime.js +2 -2
- package/dist/plugin-sdk/agent-harness-runtime.js +6 -6
- package/dist/plugin-sdk/agent-harness-task-runtime.js +1 -1
- package/dist/plugin-sdk/agent-harness.js +7 -7
- package/dist/plugin-sdk/agent-runtime.js +2 -2
- package/dist/plugin-sdk/channel-core.js +2 -2
- package/dist/plugin-sdk/channel-inbound.js +2 -2
- package/dist/plugin-sdk/channel-test-helpers.js +1 -1
- package/dist/plugin-sdk/command-auth.js +1 -1
- package/dist/plugin-sdk/command-status-runtime.js +1 -1
- package/dist/plugin-sdk/compat.js +1 -1
- package/dist/plugin-sdk/conversation-binding-runtime.js +2 -2
- package/dist/plugin-sdk/conversation-runtime.js +3 -3
- package/dist/plugin-sdk/core.js +2 -2
- package/dist/plugin-sdk/direct-dm.js +1 -1
- package/dist/plugin-sdk/gateway-method-runtime.js +1 -1
- package/dist/plugin-sdk/health.js +2 -2
- package/dist/plugin-sdk/inbound-reply-dispatch.js +1 -1
- package/dist/plugin-sdk/index.js +1 -1
- package/dist/plugin-sdk/mattermost.js +1 -1
- package/dist/plugin-sdk/plugin-test-contracts.js +2 -2
- package/dist/plugin-sdk/provider-test-contracts.js +4 -4
- package/dist/plugin-sdk/reply-runtime.js +4 -4
- package/dist/plugin-sdk/testing.js +2 -2
- package/dist/plugin-sdk/zalouser.js +1 -1
- package/dist/plugin-service-DnZEPBEA.js +1229 -0
- package/dist/plugins/runtime/index.js +4 -4
- package/dist/policy-CMv5QMPG.js +138 -0
- package/dist/policy-CeoP4t9J.js +680 -0
- package/dist/prepare.runtime-DZ55JiTt.js +732 -0
- package/dist/prepare.runtime.js +1 -1
- package/dist/preview-warnings-O08PZRxu.js +392 -0
- package/dist/probe-C6w3bP8X.js +682 -0
- package/dist/probe-Cs1_X1NA.js +47 -0
- package/dist/probe-Cuee_jyM.js +2204 -0
- package/dist/probe-DZxCnDzn.js +2 -0
- package/dist/program-C2dT8VHB.js +131 -0
- package/dist/provider-C2_vSzYh.js +32 -0
- package/dist/provider-DSfTDQbj.js +152 -0
- package/dist/provider-U8hrm9h-.js +32 -0
- package/dist/provider-_v910H8y.js +8735 -0
- package/dist/provider-dispatcher-C3kmmIEC.js +22 -0
- package/dist/provider-dispatcher.runtime.js +1 -1
- package/dist/provider-session.runtime-Mg0fx5hH.js +9 -0
- package/dist/provider-session.runtime.js +1 -1
- package/dist/provider.runtime-pSTXuHrq.js +2 -0
- package/dist/provider.runtime.js +1 -1
- package/dist/public-surface-loader-09t4TTue.js +114 -0
- package/dist/pw-ai-DjNqHV3_.js +3029 -0
- package/dist/pw-role-snapshot-DoGefdv7.js +333 -0
- package/dist/reaction-level-C8Mqxizo.js +19 -0
- package/dist/reaction-runtime-api-DOP6xOsm.js +116 -0
- package/dist/realtime-transcription-provider-BTGEXXna.js +205 -0
- package/dist/register-CbZPpqI3.js +2178 -0
- package/dist/register.agent-DrBFuPKh.js +156 -0
- package/dist/register.crestodian-DwTbmaK8.js +24 -0
- package/dist/register.maintenance-BIeoYBub.js +83 -0
- package/dist/register.runtime-B5V9_Dwz.js +54 -0
- package/dist/register.subclis-CJE9ISZY.js +31 -0
- package/dist/register.subclis-YQsKas8N.js +3 -0
- package/dist/register.subclis-core-CjwdGeGU.js +273 -0
- package/dist/repair-sequencing-C0jrL5pw.js +640 -0
- package/dist/reply-delivery-B28mTIpb.js +196 -0
- package/dist/reply-runtime-BqQX7HHw.js +11 -0
- package/dist/reply.runtime-C95MG73O.js +2 -0
- package/dist/reply.runtime.js +1 -1
- package/dist/request-BqoMvXxH.js +54 -0
- package/dist/resolve-allowlist-hbKKd_kq.js +220 -0
- package/dist/result-fallback-classifier-BrORPoxj.js +79 -0
- package/dist/route-HHRgSzVy.js +469 -0
- package/dist/route-resolution-C7bafjVc.js +274 -0
- package/dist/routes-86XGeo7a.js +2 -0
- package/dist/routes-BhVGr9ie.js +3602 -0
- package/dist/run-Bb5QP5JV.js +1162 -0
- package/dist/run-attempt-CLi0wV7j.js +7704 -0
- package/dist/run-command-Be6GAxiW.js +2 -0
- package/dist/run-command-Ds4hr3iU.js +23 -0
- package/dist/run-embedded.runtime-wX9ORojX.js +4 -0
- package/dist/run-embedded.runtime.js +1 -1
- package/dist/run-execution-cli.runtime-BmNZVB2N.js +4 -0
- package/dist/run-execution-cli.runtime.js +1 -1
- package/dist/run-executor.runtime.js +1 -1
- package/dist/run-subagent-registry.runtime-Uq5sjftu.js +2 -0
- package/dist/run-subagent-registry.runtime.js +1 -1
- package/dist/runtime-BktLQ75j.js +1287 -0
- package/dist/runtime-C9XdR62_.js +438 -0
- package/dist/runtime-CTvWDPx9.js +6179 -0
- package/dist/runtime-api-BojB3MUw.js +21 -0
- package/dist/runtime-api-C92MlAwp.js +13 -0
- package/dist/runtime-api-CFNZE9Xt.js +13 -0
- package/dist/runtime-api-Cimpgm5_.js +3 -0
- package/dist/runtime-api-D8qG_lUm.js +17 -0
- package/dist/runtime-api-DMDMnQEG.js +4 -0
- package/dist/runtime-api-DupQdIlE.js +24 -0
- package/dist/runtime-api.actions-B8i3elqu.js +3 -0
- package/dist/runtime-api.monitor-BntFzf_M.js +6 -0
- package/dist/runtime-api.send-CPlmi1jc.js +4 -0
- package/dist/runtime-api.threads-D-H_r_Nl.js +2 -0
- package/dist/runtime-channel-BGhTxnXZ.js +150 -0
- package/dist/runtime-channel-CPFxNapZ.js +2 -0
- package/dist/runtime-embedded-pi.runtime-BjnMTurB.js +2 -0
- package/dist/runtime-embedded-pi.runtime.js +1 -1
- package/dist/sanitize-outbound-BMUv1NeS.js +127 -0
- package/dist/sdk-setup-tools-Do3DkQi_.js +8 -0
- package/dist/secrets-B8YVPHhk.js +113 -0
- package/dist/security-audit-7Gg_nL4o.js +122 -0
- package/dist/security-audit-Bk3CREj-.js +118 -0
- package/dist/security-audit.runtime-BmSJrdeq.js +2 -0
- package/dist/security-audit.runtime.js +1 -1
- package/dist/selection-BFGde9-_.js +3 -0
- package/dist/selection-DrLFlbgG.js +16157 -0
- package/dist/send-4dLa-BQo.js +1631 -0
- package/dist/send-CV6gCwYP.js +192 -0
- package/dist/send-aGiK3Efu.js +143 -0
- package/dist/send-dB3CehAN.js +2 -0
- package/dist/send.components-BcG9BlkC.js +2 -0
- package/dist/send.components-rLjDlfYU.js +500 -0
- package/dist/send.runtime-D20k2MSr.js +2 -0
- package/dist/send.runtime.js +1 -1
- package/dist/server-BTRx_U1s.js +73 -0
- package/dist/server-CY0ymhBg.js +24 -0
- package/dist/server-close.runtime.js +1 -1
- package/dist/server-context-BxGT8wbK.js +955 -0
- package/dist/server-context-DYlbhAaT.js +2 -0
- package/dist/server-cron-BB_15lcP.js +2 -0
- package/dist/server-cron-CfyJX_a4.js +2989 -0
- package/dist/server-methods-Ck2ab6TC.js +16494 -0
- package/dist/server-node-events-BdRizF-5.js +596 -0
- package/dist/server-plugin-bootstrap-CPUr8NFE.js +70 -0
- package/dist/server-plugins-__5AxjzH.js +432 -0
- package/dist/server-reload-handlers-BMl9Fx9b.js +714 -0
- package/dist/server-restart-sentinel-D11M_ZsH.js +747 -0
- package/dist/server-restart-sentinel-DGptQ27c.js +2 -0
- package/dist/server-runtime-services-BwtLs-8I.js +2 -0
- package/dist/server-runtime-services-aJydixRu.js +267 -0
- package/dist/server-startup-plugins-m_P3gY4m.js +113 -0
- package/dist/server-startup-post-attach-DuXQ1AXL.js +716 -0
- package/dist/server-ws-runtime-mXmxB1W8.js +349 -0
- package/dist/server.impl-fuV8aKSP.js +2586 -0
- package/dist/service-a8cTFka4.js +1446 -0
- package/dist/session-binding-BIycxo9u.js +2 -0
- package/dist/session-binding-xHwQr9vM.js +219 -0
- package/dist/session-kill-http-DiUZhcoN.js +121 -0
- package/dist/session-reset-service-DkepDoob.js +625 -0
- package/dist/session-route-Ba5u7ecb.js +93 -0
- package/dist/session-status.runtime-Cb1X69Rl.js +2 -0
- package/dist/session-status.runtime.js +1 -1
- package/dist/session-subagent-reactivation.runtime-rbqmto4G.js +2 -0
- package/dist/session-subagent-reactivation.runtime.js +1 -1
- package/dist/session-tab-registry-DSKOoJta.js +521 -0
- package/dist/sessions-history-http-CWP88I_C.js +430 -0
- package/dist/sessions.runtime-1q1OwLn3.js +2 -0
- package/dist/sessions.runtime.js +1 -1
- package/dist/setup-api-DtrOOYeP.js +29 -0
- package/dist/setup-core-DMrJS6LP.js +174 -0
- package/dist/setup-surface-BFPNu1qA.js +405 -0
- package/dist/setup-surface-CedShqhO.js +288 -0
- package/dist/setup-surface-DLOBH1Vf.js +320 -0
- package/dist/setup-surface-MhCeEWSj.js +221 -0
- package/dist/shared-DamL-e8D.js +121 -0
- package/dist/shared-client-B48JoAsz.js +2 -0
- package/dist/shared-client-BoSiDnUo.js +629 -0
- package/dist/side-question-DQoQ_ETb.js +683 -0
- package/dist/skill-tool-dispatch.runtime-CWLloYA8.js +143 -0
- package/dist/skill-tool-dispatch.runtime.js +1 -1
- package/dist/slash-state-DrrWJQfv.js +2166 -0
- package/dist/speech-provider-8Hx1uw41.js +184 -0
- package/dist/src-BbUYOPwU.js +4256 -0
- package/dist/startup-context-opAJAamX.js +313 -0
- package/dist/status-subagents.runtime-DSo7ZK_Z.js +18 -0
- package/dist/status-subagents.runtime.js +1 -1
- package/dist/status-text-AyPuDzrO.js +296 -0
- package/dist/sticker-cache-91Tp8mLP.js +206 -0
- package/dist/sticker-vision.runtime-DjleFXi5.js +17 -0
- package/dist/sticker-vision.runtime.js +1 -1
- package/dist/subagent-announce-delivery-DS_2W9oZ.js +958 -0
- package/dist/subagent-announce-hatA_PZ2.js +354 -0
- package/dist/subagent-control-IyFIvc7T.js +508 -0
- package/dist/subagent-hooks-BCj5eB0Z.js +2 -0
- package/dist/subagent-hooks-BWjTBkox.js +146 -0
- package/dist/subagent-hooks-CdGLK9_3.js +230 -0
- package/dist/subagent-hooks-EH0tBkw9.js +2 -0
- package/dist/subagent-hooks-api-BhYaXQJV.js +23 -0
- package/dist/subagent-hooks-api-uGsV8Xn5.js +22 -0
- package/dist/subagent-hooks-api-wfJFKIPx.js +23 -0
- package/dist/subagent-hooks-l8Xd94dt.js +2 -0
- package/dist/subagent-hooks-m2eHUO_d.js +116 -0
- package/dist/subagent-orphan-recovery-Bq9zvX3L.js +352 -0
- package/dist/subagent-registry-Bcb3zy6b.js +3 -0
- package/dist/subagent-registry-CoZNTFx-.js +2351 -0
- package/dist/subagent-registry.runtime.js +1 -1
- package/dist/subagent-session-cleanup--00EjDLe.js +525 -0
- package/dist/subagent-spawn-ClJJkz3D.js +1164 -0
- package/dist/target-id-BsZLiF3x.js +107 -0
- package/dist/targets-CQMe4AZP.js +44 -0
- package/dist/targets-SmL1AU-H.js +19 -0
- package/dist/targets-Y-roiA47.js +19 -0
- package/dist/task-registry-control.runtime.js +1 -1
- package/dist/telegram/token.js +1 -1
- package/dist/testing-B5hNJDuF.js +267 -0
- package/dist/thread-bindings-BD3eE0kK.js +232 -0
- package/dist/thread-bindings-C9NNiv8K.js +571 -0
- package/dist/thread-bindings-Dl4PN1vZ.js +228 -0
- package/dist/thread-bindings-uK1LLAwy.js +8 -0
- package/dist/thread-bindings.discord-api-BHNEUbnk.js +187 -0
- package/dist/thread-bindings.manager-B0LXiH3F.js +2 -0
- package/dist/thread-bindings.manager-BTlH4XMG.js +536 -0
- package/dist/thread-lifecycle-DG8uyPHd.js +1614 -0
- package/dist/token-BbGCANnE.js +134 -0
- package/dist/tool-actions.runtime-oUUrD8HB.js +534 -0
- package/dist/tool-actions.runtime.js +1 -1
- package/dist/tool-bqg-_vYv.js +139 -0
- package/dist/tool-resolution-CSZsa3kP.js +149 -0
- package/dist/tools-effective-inventory-0CqFp-vq.js +204 -0
- package/dist/tools-invoke-http-DhYHY0Yh.js +67 -0
- package/dist/tools-invoke-shared-CbVJJUj7.js +200 -0
- package/dist/tts-C2qD-ad6.js +66 -0
- package/dist/tui-CzGY254f.js +4709 -0
- package/dist/tui-backend-fzoeoSN0.js +256 -0
- package/dist/tui-cli-B2RWb2gM.js +37 -0
- package/dist/tui-dgS8hdXU.js +2 -0
- package/dist/update-cli-BmiBDf3c.js +3664 -0
- package/dist/update-runner-CM7QVX6u.js +2379 -0
- package/dist/vision-tools-BzoBZnIc.js +1409 -0
- package/dist/web-search-DmfOd66S.js +62 -0
- package/dist/web-search-provider.runtime-3C5-pODD.js +328 -0
- package/dist/web-search-provider.runtime-Doh-Z9We.js +2 -0
- package/dist/web-search-provider.runtime.js +1 -1
- package/dist/xai-oauth-BLvQ43hx.js +479 -0
- package/dist/xai-user-agent-BdMQ_0_O.js +32 -0
- package/package.json +1 -1
- package/dist/abort-DeEb_wKd.js +0 -277
- package/dist/abort.runtime-CoYXQGPK.js +0 -2
- package/dist/account-inspect-D_06-CYS.js +0 -173
- package/dist/accounts-BCTqtj4Y.js +0 -107
- package/dist/accounts-BudLl8P2.js +0 -107
- package/dist/accounts-CUReBDA0.js +0 -2
- package/dist/accounts-PCioSzzr.js +0 -119
- package/dist/acp-runtime-B2t9_BHD.js +0 -26
- package/dist/acp-spawn-0x4Iiu1o.js +0 -2
- package/dist/acp-spawn-B2Ghe0jJ.js +0 -1275
- package/dist/acp-stateful-target-driver-C4VgcSyz.js +0 -89
- package/dist/action-kill-ClYsXEz7.js +0 -33
- package/dist/action-runtime-DrLPkNvU.js +0 -469
- package/dist/action-runtime-api-BqSflr9q.js +0 -2
- package/dist/action-send-CIy9cziD.js +0 -39
- package/dist/action-spawn-BjV6lFnX.js +0 -47
- package/dist/actions-D-QH7wq5.js +0 -161
- package/dist/actions.runtime-hzDtXQGU.js +0 -5
- package/dist/agent-Bb1DTBgv.js +0 -3
- package/dist/agent-Cnqj258q.js +0 -2
- package/dist/agent-command-BRx6ZNgJ.js +0 -1367
- package/dist/agent-components.runtime-D-g6xXJ0.js +0 -10
- package/dist/agent-harness-runtime-dKUQFuOc.js +0 -180
- package/dist/agent-harness-task-runtime-v2crUm3i.js +0 -140
- package/dist/agent-runner-execution-AOzdxvWR.js +0 -1713
- package/dist/agent-runner-utils-Byv50B4Z.js +0 -266
- package/dist/agent-runner.runtime-hhgRE0Z-.js +0 -3455
- package/dist/agent-runtime-BHmh3i0o.js +0 -229
- package/dist/agent-via-gateway-DnCqaK4a.js +0 -463
- package/dist/api-Bzyb8sFU.js +0 -3
- package/dist/api-CIEDFXZs.js +0 -2
- package/dist/api-D_dTQAu8.js +0 -2
- package/dist/api-DilBjZ9Q.js +0 -6
- package/dist/api-E5zoQMmh.js +0 -134
- package/dist/api-OJZug8gQ.js +0 -639
- package/dist/apply-C0eV5T0O.js +0 -41
- package/dist/apply-alsYvxLE.js +0 -54
- package/dist/approval-handler.runtime-C6jqZXSN.js +0 -130
- package/dist/assistant-DDXnAAB5.js +0 -291
- package/dist/attachment-normalize-Cv-_4DWU.js +0 -225
- package/dist/attempt-execution-DECEU59r.js +0 -558
- package/dist/attempt-execution.runtime-kasMxuER.js +0 -3
- package/dist/attempt-execution.shared-ClUxk52p.js +0 -38
- package/dist/attempt.prompt-helpers-Bxlv9VSu.js +0 -475
- package/dist/attempt.tool-run-context-CplQWX6g.js +0 -2094
- package/dist/binding-routing-0Obpp-Ij.js +0 -113
- package/dist/binding-targets-CZHQaZL4.js +0 -121
- package/dist/bot-BPbQ0840.js +0 -7894
- package/dist/bot-deps-Cs1M9USs.js +0 -2
- package/dist/bot-deps-xAcaOtTZ.js +0 -747
- package/dist/bot-message-context.runtime-Bji78Cbn.js +0 -7
- package/dist/bot-message-context.session.runtime-C3dyOIYH.js +0 -12
- package/dist/bot-native-commands.delivery.runtime-WshH99fy.js +0 -4
- package/dist/bot-native-commands.runtime-C1L364gU.js +0 -13
- package/dist/bridge-server-DPlM8_Lk.js +0 -113
- package/dist/browser-cli-DFNQE98N.js +0 -230
- package/dist/browser-cli-Drb5E5--.js +0 -2
- package/dist/browser-cli-actions-input-Dx-1OXmE.js +0 -473
- package/dist/browser-cli-actions-observe-BMDfE7xU.js +0 -81
- package/dist/browser-cli-debug-nu7Ih09g.js +0 -137
- package/dist/browser-cli-inspect-D5X2wohg.js +0 -104
- package/dist/browser-cli-manage-DkzYwph4.js +0 -443
- package/dist/browser-cli-resize-B30Avedl.js +0 -26
- package/dist/browser-cli-shared-cMgQoQzF.js +0 -50
- package/dist/browser-cli-state-CQLDvDy7.js +0 -337
- package/dist/browser-control-auth-D7ArmHUt.js +0 -2
- package/dist/browser-profiles-B39SIZNb.js +0 -2
- package/dist/browser-runtime-DUbSAOOS.js +0 -384
- package/dist/build-D25KqC92.js +0 -257
- package/dist/capability-cli-CuyXrlAB.js +0 -1782
- package/dist/channel-0N3YGMGg.js +0 -1496
- package/dist/channel-1UyKoLyp.js +0 -481
- package/dist/channel-BG87pSEW.js +0 -740
- package/dist/channel-BPGSaZW7.js +0 -1249
- package/dist/channel-BQMPh1J_.js +0 -376
- package/dist/channel-Bd_8V6zn.js +0 -1134
- package/dist/channel-BtBjh_ij.js +0 -362
- package/dist/channel-CpFBlVH6.js +0 -562
- package/dist/channel-CwuTrIrF.js +0 -508
- package/dist/channel-Cxl4sJA-.js +0 -1777
- package/dist/channel-D-VfU4Z2.js +0 -2126
- package/dist/channel-D9q8aYrN.js +0 -867
- package/dist/channel-DKSvVvZh.js +0 -238
- package/dist/channel-DvoFfWLx.js +0 -808
- package/dist/channel-GktTcGHm.js +0 -955
- package/dist/channel-actions.runtime-CKcRA0GW.js +0 -265
- package/dist/channel-core-nm8s1qFZ.js +0 -5
- package/dist/channel-d3t2ESlE.js +0 -653
- package/dist/channel-inbound-DKz40dq-.js +0 -80
- package/dist/channel-plugin-runtime-DKIGZWfW.js +0 -998
- package/dist/channel-runtime-Bh8_GY12.js +0 -408
- package/dist/channel-yQ8jCOb9.js +0 -1556
- package/dist/channel.runtime-BG4mM5cQ.js +0 -652
- package/dist/channel.runtime-BS6PyFFa.js +0 -1008
- package/dist/channel.runtime-CE_xECqN.js +0 -88
- package/dist/channel.runtime-Cd1Sw8U4.js +0 -254
- package/dist/channel.runtime-DIq3XOEe.js +0 -733
- package/dist/channel.runtime-Dy1cx35I.js +0 -21009
- package/dist/channel.runtime-NyIMjLnP.js +0 -109
- package/dist/channel.runtime-Zx5mfE2V.js +0 -4
- package/dist/channel.runtime-rJRibGfN.js +0 -2528
- package/dist/channel.setup--4ACadmF.js +0 -10
- package/dist/channel.setup-DzwqIlo3.js +0 -1098
- package/dist/channel.setup-FKYSJwXR.js +0 -343
- package/dist/chat-CKxSm7r1.js +0 -2666
- package/dist/chrome-rMubJwRG.js +0 -1503
- package/dist/cli-CbTod55I.js +0 -1341
- package/dist/cli-compaction-BbHgjJyW.js +0 -347
- package/dist/cli-metadata-DkOWLC_p.js +0 -22
- package/dist/cli-runner-Cwzv_RKf.js +0 -540
- package/dist/cli-runner-DdnUsgPl.js +0 -2
- package/dist/cli-runner.runtime-BlrSgbEW.js +0 -3
- package/dist/cli-runner.runtime-D8kVfvFH.js +0 -4
- package/dist/client-ClvxsWgL.js +0 -650
- package/dist/client-adapter-CsrIIjK1.js +0 -897
- package/dist/client-factory-DAYClhwm.js +0 -9
- package/dist/command-auth-CCha2ofd.js +0 -135
- package/dist/command-handlers-DCWJzHyB.js +0 -1609
- package/dist/command-registry-BIf61QNz.js +0 -9
- package/dist/command-registry-DJROBy4h.js +0 -4
- package/dist/command-registry-core-BQOWqi6S.js +0 -110
- package/dist/command-status.runtime-D88CUglL.js +0 -90
- package/dist/commands-acp-B-8dHX4Z.js +0 -74
- package/dist/commands-compact.runtime-ComX5mUk.js +0 -10
- package/dist/commands-handlers.runtime-DR3wjXHX.js +0 -6154
- package/dist/commands-status-CDyGrwsI.js +0 -3
- package/dist/commands-status-DV-i_ZIK.js +0 -16
- package/dist/commands-status.runtime-CDyGrwsI.js +0 -3
- package/dist/commands-subagents-control.runtime-B029cXAS.js +0 -3
- package/dist/commands-subagents-control.runtime-DR8Qspe0.js +0 -2
- package/dist/commands-system-prompt-C10ctsG3.js +0 -162
- package/dist/commands-system-prompt-DQlRWwnk.js +0 -2
- package/dist/commands.runtime-BYmIAuN0.js +0 -176
- package/dist/compact-14Ljaaeu.js +0 -480
- package/dist/compact-B--ovdkx.js +0 -1141
- package/dist/compact.runtime-E0Idf2Dq.js +0 -12
- package/dist/completion-cli-DMvvQGSk.js +0 -315
- package/dist/computer-use-CcLwX5SR.js +0 -367
- package/dist/config-B39SIZNb.js +0 -2
- package/dist/config-D4rsGOyV.js +0 -373
- package/dist/config-mutations-CsI3YJu7.js +0 -159
- package/dist/context-engine-host-compat-BZpDFiMJ.js +0 -2
- package/dist/context-engine-host-compat-runUdES5.js +0 -288
- package/dist/context-engine-lifecycle-D6odtNrn.js +0 -1274
- package/dist/control-auth-BPGpPtfz.js +0 -114
- package/dist/control-service-C-OmdPCe.js +0 -145
- package/dist/control-ui/assets/agents-GeyOHPuW.js +0 -1008
- package/dist/control-ui/assets/channel-config-extras-D7en6iUg.js +0 -2
- package/dist/control-ui/assets/channels-DkEyr1w5.js +0 -367
- package/dist/control-ui/assets/cron-C-wThQ1Q.js +0 -1013
- package/dist/control-ui/assets/debug-83AFRtIX.js +0 -97
- package/dist/control-ui/assets/index-CiGEhMOA.js +0 -7370
- package/dist/control-ui/assets/instances-CVl0t-1h.js +0 -57
- package/dist/control-ui/assets/logs-eybVEXxg.js +0 -74
- package/dist/control-ui/assets/nodes-C_A7eoU2.js +0 -436
- package/dist/control-ui/assets/sessions-Cq4Nc69u.js +0 -399
- package/dist/control-ui/assets/skills-ZN6hroIh.js +0 -314
- package/dist/control-ui/assets/skills-shared-DIWGwmdC.js +0 -11
- package/dist/conversation-binding-runtime-C2U1JElL.js +0 -4
- package/dist/conversation-runtime-NmIUd3Zu.js +0 -31
- package/dist/core-DGKJP1dm.js +0 -282
- package/dist/core-api-1fA4sNeC.js +0 -5
- package/dist/core-api-BY822Quq.js +0 -2
- package/dist/crestodian-Bp-NXiBC.js +0 -55
- package/dist/daocore-tools-Defpam0j.js +0 -11727
- package/dist/delivery-CEdVAUGB.js +0 -1002
- package/dist/dialogue-CZ69INPq.js +0 -37
- package/dist/dir-fetch-tool-BCicHhQE.js +0 -565
- package/dist/dir-list-tool-Cv_WktsJ.js +0 -100
- package/dist/direct-dm-Bz89rM8x.js +0 -64
- package/dist/directive-handling.fast-lane-DDnbcc5S.js +0 -68
- package/dist/directive-handling.impl-B0H52Ymr.js +0 -818
- package/dist/directive-handling.impl-CgKpwEW-.js +0 -2
- package/dist/directive-handling.model-selection-_cXAr0vt.js +0 -122
- package/dist/directive-handling.persist.runtime-Dw0mfzXT.js +0 -263
- package/dist/dispatch-C3AeYvyP.js +0 -1640
- package/dist/dispatch-acp-transcript.runtime-CP8pqBwS.js +0 -40
- package/dist/dispatch-acp.runtime-Cdap-AZI.js +0 -18
- package/dist/doctor-BZwVH97p.js +0 -2
- package/dist/doctor-BfkGBii1.js +0 -6
- package/dist/doctor-config-flow-D3JASGDt.js +0 -1741
- package/dist/doctor-core-checks-DH5AIT0Q.js +0 -573
- package/dist/doctor-core-checks-DiNu7VSh.js +0 -2
- package/dist/doctor-health-BDIJ-Nro.js +0 -65
- package/dist/doctor-health-contributions-BgmF7w8X.js +0 -696
- package/dist/doctor-lint-uIxkMUSO.js +0 -94
- package/dist/doctor-state-integrity-ws1b_BGk.js +0 -1231
- package/dist/doctor-update-Cx4CqxaX.js +0 -58
- package/dist/dynamic-tools-DiqOxhJh.js +0 -486
- package/dist/embedded-backend-C634irMl.js +0 -579
- package/dist/embedded-gateway-stub.runtime-CCfrTOeN.js +0 -12
- package/dist/exec-approvals-D85KThSg.js +0 -149
- package/dist/file-fetch-tool-BERaGYCT.js +0 -124
- package/dist/file-write-tool-BjHrMyfe.js +0 -127
- package/dist/format-DE9PuPg1.js +0 -1145
- package/dist/gateway-cli-B5hjhbUy.js +0 -435
- package/dist/gateway-method-runtime-Bu0E9Eki.js +0 -21
- package/dist/get-reply-6PtPz9hv.js +0 -4689
- package/dist/get-reply-from-config.runtime-CwprvhoR.js +0 -2
- package/dist/graph-users-DUp1kgnS.js +0 -1419
- package/dist/group-access-D5GBQ3w6.js +0 -112
- package/dist/handle-action.guild-admin-CA0Y-buD.js +0 -288
- package/dist/harness-B5nOFVfm.js +0 -61
- package/dist/health-D5heIDj3.js +0 -4
- package/dist/heartbeat-runner-BzFkIFHh.js +0 -5
- package/dist/heartbeat-runner.runtime-p6H1_xMV.js +0 -4
- package/dist/hooks-BvTyQ14X.js +0 -534
- package/dist/inbound-direct-dm-runtime-DwiDXi8L.js +0 -2
- package/dist/inbound-reply-dispatch-YoDUOC6C.js +0 -148
- package/dist/init-CPtcV5Xu.js +0 -59
- package/dist/inline-buttons-DeD5d42c.js +0 -40
- package/dist/internal-events-DEb50Sw3.js +0 -90
- package/dist/isolated-agent-CcxFFZ-Z.js +0 -1118
- package/dist/isolated-agent-CpHzq5qr.js +0 -2
- package/dist/lifecycle-DNel-oMe.js +0 -571
- package/dist/list.probe-DCa3N25d.js +0 -449
- package/dist/list.status-command-CyeAJmZW.js +0 -789
- package/dist/llm-slug-generator-CyqTY37Z.js +0 -78
- package/dist/local-dispatch.runtime-nE39kFIP.js +0 -9
- package/dist/manager.runtime-CpAPB8D5.js +0 -2714
- package/dist/markdown-to-line-Ci6TRmoZ.js +0 -811
- package/dist/mcp-http-BR0vmxFL.js +0 -2
- package/dist/mcp-http-C0oniA8h.js +0 -555
- package/dist/media-understanding-provider-BwA0XqC3.js +0 -339
- package/dist/message-actions-C9C_Ngkd.js +0 -145
- package/dist/message-handler-CUUKPC5n.js +0 -384
- package/dist/message-handler-xRTfIXWV.js +0 -1715
- package/dist/message-handler.preflight-Ch2Q7V3M.js +0 -1125
- package/dist/message-handler.process-HM3mK93q.js +0 -1484
- package/dist/model-CB8Ex5xS.js +0 -74
- package/dist/model-selection-2s0Dinux.js +0 -272
- package/dist/models-Cn-6DJ41.js +0 -2
- package/dist/models-CzszJD__.js +0 -104
- package/dist/models-cli-CbhElnA5.js +0 -256
- package/dist/monitor-7aprTsMV.js +0 -715
- package/dist/monitor-BuVhqwDS.js +0 -1370
- package/dist/monitor-C4H_YkgY.js +0 -2
- package/dist/monitor-CPQsMxgv.js +0 -1657
- package/dist/monitor-Ce0V1PiR.js +0 -4377
- package/dist/monitor-D0bcGJWI.js +0 -60
- package/dist/monitor-DEjlJqzh.js +0 -834
- package/dist/monitor-auth-DjJZsjgV.js +0 -179
- package/dist/monitor-ikSYagv3.js +0 -2788
- package/dist/monitor-polling.runtime-D7yEflMM.js +0 -883
- package/dist/monitor-webhook.runtime-CIZt-biI.js +0 -387
- package/dist/monitor.account-C2sMOBCS.js +0 -5233
- package/dist/monitor.runtime-BAi6zmcn.js +0 -2
- package/dist/monitor.webhook-BcjpfRCX.js +0 -180
- package/dist/node-cli-sessions-CIhkJRU4.js +0 -1228
- package/dist/openai-http-Dj21RwSj.js +0 -824
- package/dist/openresponses-http-COnnr1ox.js +0 -1173
- package/dist/operations-H3vUh0lM.js +0 -805
- package/dist/outbound-adapter-WLtWE7wv.js +0 -543
- package/dist/outbound-session-route-CZtd64EH.js +0 -45
- package/dist/outbound.runtime-D98P0sN1.js +0 -2
- package/dist/pi-embedded-BWJzd4mK.js +0 -4
- package/dist/pi-embedded-DeNsSqQQ.js +0 -3796
- package/dist/pi-embedded.runtime-CZnNwFpc.js +0 -4
- package/dist/pi-tools-CNHSpjBa.js +0 -2413
- package/dist/plan-B0reFFlM.js +0 -81
- package/dist/plan-CrfF-TH8.js +0 -112
- package/dist/plugin-DI_8eYOe.js +0 -12396
- package/dist/plugin-app-cache-key-WaTUD3e-.js +0 -46
- package/dist/plugin-enabled-aWLXgGGi.js +0 -233
- package/dist/plugin-registration-ByjRIVJm.js +0 -88
- package/dist/plugin-service-VQm_241d.js +0 -1229
- package/dist/policy-BmJH-swe.js +0 -680
- package/dist/policy-DE-bO1zn.js +0 -138
- package/dist/prepare.runtime-bSj3-res.js +0 -732
- package/dist/preview-warnings-CbuGYsF9.js +0 -392
- package/dist/probe-C_rWg7_m.js +0 -682
- package/dist/probe-CagOFfx6.js +0 -2
- package/dist/probe-thX1HqOh.js +0 -2204
- package/dist/probe-zU6B6gFt.js +0 -47
- package/dist/program-BtVdH743.js +0 -131
- package/dist/provider-CDoD7tO0.js +0 -8735
- package/dist/provider-CK1gMdJ2.js +0 -32
- package/dist/provider-DJqr9djy.js +0 -32
- package/dist/provider-DsOJp5bK.js +0 -152
- package/dist/provider-dispatcher-UNQ-LSx9.js +0 -22
- package/dist/provider-session.runtime-DMrkMb4x.js +0 -9
- package/dist/provider.runtime-C2-t3zm8.js +0 -2
- package/dist/public-surface-loader-hTeyyHcd.js +0 -114
- package/dist/pw-ai-BaL3eVYx.js +0 -3029
- package/dist/pw-role-snapshot-DKeBqhN1.js +0 -333
- package/dist/reaction-level-BV2potsD.js +0 -19
- package/dist/reaction-runtime-api-CCBxgM10.js +0 -116
- package/dist/realtime-transcription-provider-CHYtIXZm.js +0 -205
- package/dist/register-BJf28G9B.js +0 -2178
- package/dist/register.agent-oXAHwNQv.js +0 -156
- package/dist/register.crestodian-CQ0sqdV2.js +0 -24
- package/dist/register.maintenance-CylVRs5M.js +0 -83
- package/dist/register.runtime-CcDgwy0X.js +0 -54
- package/dist/register.subclis-CpBYNw2X.js +0 -3
- package/dist/register.subclis-N2CvieOL.js +0 -31
- package/dist/register.subclis-core-BHaGvbzg.js +0 -273
- package/dist/repair-sequencing-EBBnBdIB.js +0 -640
- package/dist/reply-delivery-BLoPALlI.js +0 -196
- package/dist/reply-runtime-D4asNTSa.js +0 -11
- package/dist/reply.runtime-CwprvhoR.js +0 -2
- package/dist/request-DlWPRUDt.js +0 -54
- package/dist/resolve-allowlist-BukQf58x.js +0 -220
- package/dist/result-fallback-classifier-DyHFnqfV.js +0 -79
- package/dist/route-BMf4keN5.js +0 -469
- package/dist/route-resolution-DWNi1QAu.js +0 -274
- package/dist/routes-C20LC8c4.js +0 -3602
- package/dist/routes-CkK7Vv_m.js +0 -2
- package/dist/run-KDF_AEza.js +0 -1162
- package/dist/run-attempt-JHYCfonU.js +0 -7704
- package/dist/run-command-3PVihYIy.js +0 -2
- package/dist/run-command-QHAXnyKY.js +0 -23
- package/dist/run-embedded.runtime-BJw-2vss.js +0 -4
- package/dist/run-execution-cli.runtime-GHClMn2g.js +0 -4
- package/dist/run-subagent-registry.runtime-BLLMrhtE.js +0 -2
- package/dist/runtime-C2u-dC1r.js +0 -1287
- package/dist/runtime-ClyfkDWT.js +0 -6179
- package/dist/runtime-WXCarlPc.js +0 -438
- package/dist/runtime-api-3QhGLpZf.js +0 -13
- package/dist/runtime-api-DRAu3mjv.js +0 -4
- package/dist/runtime-api-JE07pOem.js +0 -13
- package/dist/runtime-api-JuKylHvw.js +0 -24
- package/dist/runtime-api-bcbk4yax.js +0 -21
- package/dist/runtime-api-dDe9U2_V.js +0 -17
- package/dist/runtime-api-uMexLqGS.js +0 -3
- package/dist/runtime-api.actions-Bo7TLDFl.js +0 -3
- package/dist/runtime-api.monitor-7q78L1Em.js +0 -6
- package/dist/runtime-api.send-Bf9RR4nV.js +0 -4
- package/dist/runtime-api.threads-Dj2QuhHj.js +0 -2
- package/dist/runtime-channel-k1C0Satl.js +0 -2
- package/dist/runtime-channel-qt9t0J-J.js +0 -150
- package/dist/runtime-embedded-pi.runtime-BPB9NlTS.js +0 -2
- package/dist/sanitize-outbound-BLH_SQvg.js +0 -127
- package/dist/sdk-setup-tools-BshlBPau.js +0 -8
- package/dist/secrets-CsHXv7d3.js +0 -113
- package/dist/security-audit-CUXBQXNX.js +0 -122
- package/dist/security-audit-CzdXbRma.js +0 -118
- package/dist/security-audit.runtime-Ca0FMFJG.js +0 -2
- package/dist/selection-BmvQJlSD.js +0 -3
- package/dist/selection-BplDXc9w.js +0 -16157
- package/dist/send--qFg8a9v.js +0 -1631
- package/dist/send-BPdryPPA.js +0 -192
- package/dist/send-Bl4YaRkS.js +0 -143
- package/dist/send-Ccm7RMXC.js +0 -2
- package/dist/send.components-c3OUPSmR.js +0 -2
- package/dist/send.components-rhQJYoXs.js +0 -500
- package/dist/send.runtime-dfUkAp5d.js +0 -2
- package/dist/server-DRhyTMLe.js +0 -73
- package/dist/server-Dv4BzjGn.js +0 -24
- package/dist/server-context-4HRJy2vp.js +0 -955
- package/dist/server-context-DlxYb1G5.js +0 -2
- package/dist/server-cron-Bt8Pkc3i.js +0 -2989
- package/dist/server-cron-CtNWsa4Z.js +0 -2
- package/dist/server-methods-rye_okUW.js +0 -16494
- package/dist/server-node-events-C1yZ5a1u.js +0 -596
- package/dist/server-plugin-bootstrap-DUMyVtlP.js +0 -70
- package/dist/server-plugins-B5ZWWkRE.js +0 -432
- package/dist/server-reload-handlers-CTnMXNjT.js +0 -714
- package/dist/server-restart-sentinel-CAYxtwmY.js +0 -747
- package/dist/server-restart-sentinel-DqrtSIvy.js +0 -2
- package/dist/server-runtime-services-CuptQTe5.js +0 -2
- package/dist/server-runtime-services-aaS2IiW3.js +0 -267
- package/dist/server-startup-plugins-D0ymJgQT.js +0 -113
- package/dist/server-startup-post-attach-DlrN2uyt.js +0 -716
- package/dist/server-ws-runtime-CdpLbv4o.js +0 -349
- package/dist/server.impl-Cb4qcMTg.js +0 -2586
- package/dist/service-qxvDlMQE.js +0 -1446
- package/dist/session-binding-6bLobLHL.js +0 -219
- package/dist/session-binding-Bm6fCpoY.js +0 -2
- package/dist/session-kill-http-B6WjVo8V.js +0 -121
- package/dist/session-reset-service-GUVIhxp4.js +0 -625
- package/dist/session-route-BcRDnvzG.js +0 -93
- package/dist/session-status.runtime-BcjOunV4.js +0 -2
- package/dist/session-subagent-reactivation.runtime-BSmk_KYn.js +0 -2
- package/dist/session-tab-registry-BBYzbSOu.js +0 -521
- package/dist/sessions-history-http-bLJJfgLm.js +0 -430
- package/dist/sessions.runtime-DNRtQzCk.js +0 -2
- package/dist/setup-api-CcolVVJs.js +0 -29
- package/dist/setup-core-eJD18F3B.js +0 -174
- package/dist/setup-surface-B75C2Qtz.js +0 -221
- package/dist/setup-surface-CFuPfVHp.js +0 -405
- package/dist/setup-surface-Dyy-Mzyz.js +0 -288
- package/dist/setup-surface-ZsVF_g8W.js +0 -320
- package/dist/shared-BkCNrcLX.js +0 -121
- package/dist/shared-client-B7zqC9p2.js +0 -2
- package/dist/shared-client-yXjKgZBz.js +0 -629
- package/dist/side-question-DU3gESCb.js +0 -683
- package/dist/skill-tool-dispatch.runtime-CPBuqyvk.js +0 -143
- package/dist/slash-state-Do3bAahA.js +0 -2166
- package/dist/speech-provider-Bg9los3C.js +0 -184
- package/dist/src-D7LzUctH.js +0 -4256
- package/dist/startup-context-CCF2gIOl.js +0 -313
- package/dist/status-subagents.runtime-DX5FTymp.js +0 -18
- package/dist/status-text-B-1u5dSV.js +0 -296
- package/dist/sticker-cache-DwpU_9RJ.js +0 -206
- package/dist/sticker-vision.runtime-Bbldi_YL.js +0 -17
- package/dist/subagent-announce-BCo0VHVL.js +0 -354
- package/dist/subagent-announce-delivery-JcnuDN_N.js +0 -958
- package/dist/subagent-control-BzbA3Suz.js +0 -508
- package/dist/subagent-hooks-BIGZQWrG.js +0 -2
- package/dist/subagent-hooks-Bj4qYZfv.js +0 -230
- package/dist/subagent-hooks-C-rvhVBv.js +0 -2
- package/dist/subagent-hooks-P01_AFl5.js +0 -116
- package/dist/subagent-hooks-VEfak8nl.js +0 -2
- package/dist/subagent-hooks-api-BPnSxxN4.js +0 -23
- package/dist/subagent-hooks-api-DwIAvMoS.js +0 -22
- package/dist/subagent-hooks-api-kgyR9FOb.js +0 -23
- package/dist/subagent-hooks-oED56wqq.js +0 -146
- package/dist/subagent-orphan-recovery-D79ZzwKN.js +0 -352
- package/dist/subagent-registry-D0soBT5j.js +0 -2351
- package/dist/subagent-registry-DRJDkmty.js +0 -3
- package/dist/subagent-session-cleanup-9eAO1aJe.js +0 -525
- package/dist/subagent-spawn-D80vbogm.js +0 -1164
- package/dist/target-id-COLv5LsJ.js +0 -107
- package/dist/targets-CDW5IQ6a.js +0 -44
- package/dist/targets-Ci6O1ZdP.js +0 -19
- package/dist/targets-CsaWFBg1.js +0 -19
- package/dist/testing-BoJit-h1.js +0 -267
- package/dist/thread-bindings-CGCvw0KT.js +0 -571
- package/dist/thread-bindings-ClCTNacX.js +0 -228
- package/dist/thread-bindings-DRb7BMZ6.js +0 -8
- package/dist/thread-bindings-Xc6smav0.js +0 -232
- package/dist/thread-bindings.discord-api-DC467oeF.js +0 -187
- package/dist/thread-bindings.manager-C_mpTDIZ.js +0 -536
- package/dist/thread-bindings.manager-DkCRs612.js +0 -2
- package/dist/thread-lifecycle-DpqCXlx9.js +0 -1614
- package/dist/token-CI6HjbTA.js +0 -134
- package/dist/tool-BMe7hjBK.js +0 -139
- package/dist/tool-actions.runtime-D-h5PI_m.js +0 -534
- package/dist/tool-resolution-CnLx0CHe.js +0 -149
- package/dist/tools-effective-inventory-BR6MUMtE.js +0 -204
- package/dist/tools-invoke-http-CTTs2yMT.js +0 -67
- package/dist/tools-invoke-shared-9B1EjXWf.js +0 -200
- package/dist/tts-eGOviZ5c.js +0 -66
- package/dist/tui-Bw0HqKd7.js +0 -4709
- package/dist/tui-CIZJnPzj.js +0 -2
- package/dist/tui-backend-BJ_r7tcF.js +0 -256
- package/dist/tui-cli-BaSMBpuA.js +0 -37
- package/dist/update-cli-zuCybGNR.js +0 -3664
- package/dist/update-runner-Dek2BHmQ.js +0 -2379
- package/dist/vision-tools-1ps0BEE5.js +0 -1409
- package/dist/web-search-B7EziZXE.js +0 -62
- package/dist/web-search-provider.runtime-DGTCvGch.js +0 -328
- package/dist/web-search-provider.runtime-DWL5t39M.js +0 -2
- package/dist/xai-oauth-CRtsj2Gs.js +0 -479
- package/dist/xai-user-agent-Dndwzw2S.js +0 -32
- /package/dist/{acp-runtime-backend-DSDBcyh9.js → acp-runtime-backend-Cxo7eBHf.js} +0 -0
- /package/dist/{channel-actions-FV66JqtI.js → channel-actions-UDeVjgGz.js} +0 -0
- /package/dist/{command-status-runtime-BRWKSoG7.js → command-status-runtime-CoHd4Fws.js} +0 -0
- /package/dist/{delegate-DGqKhwB4.js → delegate-B-2xZ77o.js} +0 -0
- /package/dist/{dispatch-acp-Ceoxja_Z.js → dispatch-acp-DLPkmK7K.js} +0 -0
- /package/dist/{heartbeat-runner-CJHvr5pG.js → heartbeat-runner-D2j6JwOI.js} +0 -0
- /package/dist/{library-Bq3aDek_.js → library-DBT0cIPP.js} +0 -0
- /package/dist/{run-executor.runtime-DNJhGPbA.js → run-executor.runtime-DE4J7f4M.js} +0 -0
- /package/dist/{shared-CYxmRpq1.js → shared-xeo8Yh5n.js} +0 -0
|
@@ -0,0 +1,2379 @@
|
|
|
1
|
+
import { a as normalizeLowercaseStringOrEmpty, c as normalizeOptionalString } from "./string-coerce-DyL154ka.js";
|
|
2
|
+
import { E as pathExists } from "./fs-safe-BFN3ftAo.js";
|
|
3
|
+
import { u as pathExists$1 } from "./utils-CNnMhEDp.js";
|
|
4
|
+
import { i as resolveGatewayInstallEntrypoint } from "./gateway-entrypoint-Fvj9eT8J.js";
|
|
5
|
+
import { t as movePathWithCopyFallback } from "./replace-file-DJ-yT_Qm.js";
|
|
6
|
+
import { a as readJsonIfExists } from "./json-files-D7wa8Ux4.js";
|
|
7
|
+
import { a as parseSemver } from "./runtime-guard-CeaQ7tel.js";
|
|
8
|
+
import { t as resolveStableNodePath } from "./stable-node-path-COOLjGh2.js";
|
|
9
|
+
import { r as runCommandWithTimeout } from "./exec-PI-gh7wQ.js";
|
|
10
|
+
import { n as applyPosixNpmScriptShellEnv, r as createNpmFreshnessBypassArgs, t as applyNpmFreshnessBypassEnv } from "./npm-install-env-BDr63VWf.js";
|
|
11
|
+
import { u as trimLogTail } from "./restart-sentinel-Du4en0Hw.js";
|
|
12
|
+
import { t as BUNDLED_RUNTIME_SIDECAR_PATHS } from "./runtime-sidecar-paths-Blgi5sh-.js";
|
|
13
|
+
import { t as applyPathPrepend } from "./path-prepend-6X5fKWgG.js";
|
|
14
|
+
import { a as isBetaTag, n as DEV_BRANCH, o as isStableTag, r as channelToNpmTag } from "./update-channels-f-ieRme5.js";
|
|
15
|
+
import { n as readPackageName, r as readPackageVersion } from "./package-json-CIZcDaQ6.js";
|
|
16
|
+
import { n as compareSemverStrings, s as detectPackageManager } from "./update-check-Cv1EQVBi.js";
|
|
17
|
+
import { a as resolveControlUiDistIndexPathForRoot, r as resolveControlUiDistIndexHealth } from "./control-ui-assets-CJl2u-AI.js";
|
|
18
|
+
import fs from "node:fs";
|
|
19
|
+
import path from "node:path";
|
|
20
|
+
import fs$1 from "node:fs/promises";
|
|
21
|
+
import os from "node:os";
|
|
22
|
+
//#region src/infra/package-tag.ts
|
|
23
|
+
function normalizePackageTagInput(value, packageNames) {
|
|
24
|
+
const trimmed = normalizeOptionalString(value);
|
|
25
|
+
if (!trimmed) return null;
|
|
26
|
+
for (const packageName of packageNames) {
|
|
27
|
+
if (trimmed === packageName) return null;
|
|
28
|
+
const prefix = `${packageName}@`;
|
|
29
|
+
if (trimmed.startsWith(prefix)) {
|
|
30
|
+
const tag = trimmed.slice(prefix.length).trim();
|
|
31
|
+
return tag ? tag : null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return trimmed;
|
|
35
|
+
}
|
|
36
|
+
const LOCAL_BUILD_METADATA_DIST_PATHS = Object.freeze([`dist/.buildstamp`, `dist/.runtime-postbuildstamp`]);
|
|
37
|
+
const LOCAL_BUILD_METADATA_DIST_PATH_SET = new Set(LOCAL_BUILD_METADATA_DIST_PATHS);
|
|
38
|
+
function isLocalBuildMetadataDistPath(relativePath) {
|
|
39
|
+
return LOCAL_BUILD_METADATA_DIST_PATH_SET.has(relativePath);
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/infra/package-dist-inventory.ts
|
|
43
|
+
const PACKAGE_DIST_INVENTORY_RELATIVE_PATH = "dist/postinstall-inventory.json";
|
|
44
|
+
const LEGACY_QA_CHANNEL_DIR = ["qa", "channel"].join("-");
|
|
45
|
+
const LEGACY_QA_LAB_DIR = ["qa", "lab"].join("-");
|
|
46
|
+
const OMITTED_QA_EXTENSION_PREFIXES = [
|
|
47
|
+
`dist/extensions/${LEGACY_QA_CHANNEL_DIR}/`,
|
|
48
|
+
`dist/extensions/${LEGACY_QA_LAB_DIR}/`,
|
|
49
|
+
"dist/extensions/qa-matrix/"
|
|
50
|
+
];
|
|
51
|
+
const OMITTED_PRIVATE_QA_PLUGIN_SDK_PREFIXES = [`dist/plugin-sdk/extensions/${LEGACY_QA_CHANNEL_DIR}/`, `dist/plugin-sdk/extensions/${LEGACY_QA_LAB_DIR}/`];
|
|
52
|
+
const OMITTED_PRIVATE_QA_PLUGIN_SDK_FILES = new Set([
|
|
53
|
+
`dist/plugin-sdk/${LEGACY_QA_CHANNEL_DIR}.d.ts`,
|
|
54
|
+
`dist/plugin-sdk/${LEGACY_QA_CHANNEL_DIR}.js`,
|
|
55
|
+
`dist/plugin-sdk/${LEGACY_QA_CHANNEL_DIR}-protocol.d.ts`,
|
|
56
|
+
`dist/plugin-sdk/${LEGACY_QA_CHANNEL_DIR}-protocol.js`,
|
|
57
|
+
`dist/plugin-sdk/${LEGACY_QA_LAB_DIR}.d.ts`,
|
|
58
|
+
`dist/plugin-sdk/${LEGACY_QA_LAB_DIR}.js`,
|
|
59
|
+
"dist/plugin-sdk/qa-runtime.d.ts",
|
|
60
|
+
"dist/plugin-sdk/qa-runtime.js",
|
|
61
|
+
`dist/plugin-sdk/src/plugin-sdk/${LEGACY_QA_CHANNEL_DIR}.d.ts`,
|
|
62
|
+
`dist/plugin-sdk/src/plugin-sdk/${LEGACY_QA_CHANNEL_DIR}-protocol.d.ts`,
|
|
63
|
+
`dist/plugin-sdk/src/plugin-sdk/${LEGACY_QA_LAB_DIR}.d.ts`,
|
|
64
|
+
"dist/plugin-sdk/src/plugin-sdk/qa-runtime.d.ts"
|
|
65
|
+
]);
|
|
66
|
+
const OMITTED_PRIVATE_QA_DIST_PREFIXES = ["dist/qa-runtime-"];
|
|
67
|
+
const OMITTED_DIST_SUBTREE_PATTERNS = [
|
|
68
|
+
/^dist\/extensions\/node_modules(?:\/|$)/u,
|
|
69
|
+
/^dist\/extensions\/[^/]+\/node_modules(?:\/|$)/u,
|
|
70
|
+
/^dist\/extensions\/qa-matrix(?:\/|$)/u,
|
|
71
|
+
new RegExp(`^dist/plugin-sdk/extensions/${LEGACY_QA_CHANNEL_DIR}(?:/|$)`, "u"),
|
|
72
|
+
new RegExp(`^dist/plugin-sdk/extensions/${LEGACY_QA_LAB_DIR}(?:/|$)`, "u")
|
|
73
|
+
];
|
|
74
|
+
function normalizeRelativePath(value) {
|
|
75
|
+
return value.replace(/\\/g, "/");
|
|
76
|
+
}
|
|
77
|
+
function isLegacyPluginDependencyDirPath(relativePath) {
|
|
78
|
+
const parts = normalizeRelativePath(relativePath).split("/");
|
|
79
|
+
if (parts[0]?.toLowerCase() !== "dist" || parts[1]?.toLowerCase() !== "extensions") return false;
|
|
80
|
+
if ((parts[2] ?? "").toLowerCase() === "node_modules") return true;
|
|
81
|
+
return (parts[3] ?? "").toLowerCase() === "node_modules";
|
|
82
|
+
}
|
|
83
|
+
function collectExcludedPackagedExtensionDirs(rootPackageJson) {
|
|
84
|
+
if (!rootPackageJson || typeof rootPackageJson !== "object") return /* @__PURE__ */ new Set();
|
|
85
|
+
const files = rootPackageJson.files;
|
|
86
|
+
if (!Array.isArray(files)) return /* @__PURE__ */ new Set();
|
|
87
|
+
const excluded = /* @__PURE__ */ new Set();
|
|
88
|
+
for (const entry of files) {
|
|
89
|
+
if (typeof entry !== "string") continue;
|
|
90
|
+
const match = /^!dist\/extensions\/([^/]+)\/\*\*$/u.exec(entry);
|
|
91
|
+
if (match?.[1]) excluded.add(match[1]);
|
|
92
|
+
}
|
|
93
|
+
return excluded;
|
|
94
|
+
}
|
|
95
|
+
function isExternalizedBundledExtensionDistPath(relativePath, externalizedExtensionIds) {
|
|
96
|
+
if (externalizedExtensionIds.size === 0) return false;
|
|
97
|
+
const parts = normalizeRelativePath(relativePath).split("/");
|
|
98
|
+
return parts.length >= 3 && parts[0] === "dist" && parts[1] === "extensions" && Boolean(parts[2]) && externalizedExtensionIds.has(parts[2] ?? "");
|
|
99
|
+
}
|
|
100
|
+
async function collectExternalizedBundledExtensionIds(packageRoot) {
|
|
101
|
+
return collectExcludedPackagedExtensionDirs(await readJsonIfExists(path.join(packageRoot, "package.json")));
|
|
102
|
+
}
|
|
103
|
+
function isPackagedDistPath(relativePath, externalizedExtensionIds) {
|
|
104
|
+
if (!relativePath.startsWith("dist/")) return false;
|
|
105
|
+
if (isExternalizedBundledExtensionDistPath(relativePath, externalizedExtensionIds)) return false;
|
|
106
|
+
if (isLegacyPluginDependencyDirPath(relativePath)) return false;
|
|
107
|
+
if (relativePath === "dist/postinstall-inventory.json") return false;
|
|
108
|
+
if (isLocalBuildMetadataDistPath(relativePath)) return false;
|
|
109
|
+
if (relativePath.endsWith(".map")) return false;
|
|
110
|
+
if (relativePath === "dist/plugin-sdk/.tsbuildinfo") return false;
|
|
111
|
+
if (OMITTED_PRIVATE_QA_PLUGIN_SDK_PREFIXES.some((prefix) => relativePath.startsWith(prefix)) || OMITTED_PRIVATE_QA_PLUGIN_SDK_FILES.has(relativePath) || OMITTED_PRIVATE_QA_DIST_PREFIXES.some((prefix) => relativePath.startsWith(prefix))) return false;
|
|
112
|
+
if (OMITTED_QA_EXTENSION_PREFIXES.some((prefix) => relativePath.startsWith(prefix))) return false;
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
function isOmittedDistSubtree(relativePath, externalizedExtensionIds) {
|
|
116
|
+
return isExternalizedBundledExtensionDistPath(relativePath, externalizedExtensionIds) || isLegacyPluginDependencyDirPath(relativePath) || OMITTED_DIST_SUBTREE_PATTERNS.some((pattern) => pattern.test(relativePath));
|
|
117
|
+
}
|
|
118
|
+
async function collectRelativeFiles(rootDir, baseDir, externalizedExtensionIds) {
|
|
119
|
+
const rootRelativePath = normalizeRelativePath(path.relative(baseDir, rootDir));
|
|
120
|
+
if (rootRelativePath && isOmittedDistSubtree(rootRelativePath, externalizedExtensionIds)) return [];
|
|
121
|
+
try {
|
|
122
|
+
const rootStats = await fs$1.lstat(rootDir);
|
|
123
|
+
if (!rootStats.isDirectory() || rootStats.isSymbolicLink()) throw new Error(`Unsafe package dist path: ${normalizeRelativePath(path.relative(baseDir, rootDir))}`);
|
|
124
|
+
const entries = await fs$1.readdir(rootDir, { withFileTypes: true });
|
|
125
|
+
return (await Promise.all(entries.map(async (entry) => {
|
|
126
|
+
const entryPath = path.join(rootDir, entry.name);
|
|
127
|
+
const relativePath = normalizeRelativePath(path.relative(baseDir, entryPath));
|
|
128
|
+
if (entry.isSymbolicLink()) throw new Error(`Unsafe package dist path: ${relativePath}`);
|
|
129
|
+
if (entry.isDirectory()) return await collectRelativeFiles(entryPath, baseDir, externalizedExtensionIds);
|
|
130
|
+
if (entry.isFile()) return isPackagedDistPath(relativePath, externalizedExtensionIds) ? [relativePath] : [];
|
|
131
|
+
return [];
|
|
132
|
+
}))).flat().toSorted((left, right) => left.localeCompare(right));
|
|
133
|
+
} catch (error) {
|
|
134
|
+
if (error.code === "ENOENT") return [];
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async function collectPackageDistInventory(packageRoot) {
|
|
139
|
+
const externalizedExtensionIds = await collectExternalizedBundledExtensionIds(packageRoot);
|
|
140
|
+
return await collectRelativeFiles(path.join(packageRoot, "dist"), packageRoot, externalizedExtensionIds);
|
|
141
|
+
}
|
|
142
|
+
async function readPackageDistInventoryOptional(packageRoot) {
|
|
143
|
+
const parsed = await readJsonIfExists(path.join(packageRoot, PACKAGE_DIST_INVENTORY_RELATIVE_PATH));
|
|
144
|
+
if (parsed === null) return null;
|
|
145
|
+
if (!Array.isArray(parsed) || parsed.some((entry) => typeof entry !== "string")) throw new Error(`Invalid package dist inventory at ${PACKAGE_DIST_INVENTORY_RELATIVE_PATH}`);
|
|
146
|
+
return [...new Set(parsed.map(normalizeRelativePath))].toSorted((left, right) => left.localeCompare(right));
|
|
147
|
+
}
|
|
148
|
+
async function readPackageDistInventoryIfPresent(packageRoot) {
|
|
149
|
+
return await readPackageDistInventoryOptional(packageRoot);
|
|
150
|
+
}
|
|
151
|
+
//#endregion
|
|
152
|
+
//#region src/infra/update-global.ts
|
|
153
|
+
const PRIMARY_PACKAGE_NAME = "daocore";
|
|
154
|
+
const ALL_PACKAGE_NAMES = [PRIMARY_PACKAGE_NAME];
|
|
155
|
+
const GLOBAL_RENAME_PREFIX = ".";
|
|
156
|
+
const DAOCORE_MAIN_PACKAGE_SPEC = "github:daocore/daocore#main";
|
|
157
|
+
const COREPACK_ENABLE_DOWNLOAD_PROMPT_DEFAULT = "0";
|
|
158
|
+
const NPM_GLOBAL_INSTALL_QUIET_FLAGS = [
|
|
159
|
+
"--no-fund",
|
|
160
|
+
"--no-audit",
|
|
161
|
+
"--loglevel=error"
|
|
162
|
+
];
|
|
163
|
+
const PNPM_DAOCORE_BUILD_ALLOWLIST_FLAG = `--allow-build=${PRIMARY_PACKAGE_NAME}`;
|
|
164
|
+
const FIRST_PACKAGED_DIST_INVENTORY_VERSION = {
|
|
165
|
+
major: 2026,
|
|
166
|
+
minor: 4,
|
|
167
|
+
patch: 15
|
|
168
|
+
};
|
|
169
|
+
const OMITTED_PRIVATE_QA_BUNDLED_PLUGIN_ROOTS = new Set([
|
|
170
|
+
"dist/extensions/qa-channel",
|
|
171
|
+
"dist/extensions/qa-lab",
|
|
172
|
+
"dist/extensions/qa-matrix"
|
|
173
|
+
]);
|
|
174
|
+
function normalizePackageTarget(value) {
|
|
175
|
+
return value.trim();
|
|
176
|
+
}
|
|
177
|
+
function normalizePackageVersionForComparison(value) {
|
|
178
|
+
const trimmed = value?.trim();
|
|
179
|
+
if (!trimmed) return null;
|
|
180
|
+
return trimmed.replace(/^[vV](?=\d)/, "");
|
|
181
|
+
}
|
|
182
|
+
function isMainPackageTarget(value) {
|
|
183
|
+
return normalizeLowercaseStringOrEmpty(normalizePackageTarget(value)) === "main";
|
|
184
|
+
}
|
|
185
|
+
function isExplicitPackageInstallSpec(value) {
|
|
186
|
+
const trimmed = normalizePackageTarget(value);
|
|
187
|
+
if (!trimmed) return false;
|
|
188
|
+
return /\.(?:tgz|tar\.gz)$/iu.test(trimmed) || trimmed.includes("://") || trimmed.includes("#") || /^(?:file|github|git\+ssh|git\+https|git\+http|git\+file|npm):/i.test(trimmed);
|
|
189
|
+
}
|
|
190
|
+
function stripPrimaryPackageAlias(spec) {
|
|
191
|
+
const normalized = normalizePackageTarget(spec);
|
|
192
|
+
const prefix = `${PRIMARY_PACKAGE_NAME}@`;
|
|
193
|
+
return normalized.toLowerCase().startsWith(prefix) ? normalized.slice(prefix.length).trim() : normalized;
|
|
194
|
+
}
|
|
195
|
+
function isPnpmDaoCoreSourceInstallSpec(spec) {
|
|
196
|
+
const target = stripPrimaryPackageAlias(spec);
|
|
197
|
+
return /^github:/i.test(target) || /^git\+(?:ssh|https|http|file):/i.test(target) || /^git:/i.test(target);
|
|
198
|
+
}
|
|
199
|
+
function resolveExpectedInstalledVersionFromSpec(packageName, spec) {
|
|
200
|
+
const normalizedPackageName = packageName.trim();
|
|
201
|
+
const normalizedSpec = normalizePackageTarget(spec);
|
|
202
|
+
if (!normalizedPackageName || !normalizedSpec.startsWith(`${normalizedPackageName}@`)) return null;
|
|
203
|
+
const rawVersion = normalizedSpec.slice(normalizedPackageName.length + 1).trim();
|
|
204
|
+
if (!rawVersion || rawVersion.includes("/") || rawVersion.includes(":") || rawVersion.includes("#") || /^(latest|beta|next|main)$/i.test(rawVersion)) return null;
|
|
205
|
+
return normalizePackageVersionForComparison(rawVersion);
|
|
206
|
+
}
|
|
207
|
+
async function collectInstalledGlobalPackageErrors(params) {
|
|
208
|
+
const errors = [];
|
|
209
|
+
errors.push(...await collectSourceCheckoutInstallErrors(params.packageRoot));
|
|
210
|
+
const installedVersion = await readPackageVersion(params.packageRoot);
|
|
211
|
+
const expectedComparable = normalizePackageVersionForComparison(params.expectedVersion);
|
|
212
|
+
const installedComparable = normalizePackageVersionForComparison(installedVersion);
|
|
213
|
+
if (expectedComparable && installedComparable !== expectedComparable) errors.push(`expected installed version ${expectedComparable}, found ${installedComparable ?? "<missing>"}`);
|
|
214
|
+
errors.push(...await collectInstalledPackageDistErrors({
|
|
215
|
+
packageRoot: params.packageRoot,
|
|
216
|
+
installedVersion,
|
|
217
|
+
expectedVersion: params.expectedVersion
|
|
218
|
+
}));
|
|
219
|
+
return errors;
|
|
220
|
+
}
|
|
221
|
+
async function collectSourceCheckoutInstallErrors(packageRoot) {
|
|
222
|
+
const realPackageRoot = await tryRealpath(packageRoot);
|
|
223
|
+
return (await pathExists$1(path.join(realPackageRoot, ".git")) || await pathExists$1(path.join(realPackageRoot, "pnpm-workspace.yaml"))) && await pathExists$1(path.join(realPackageRoot, "src")) && await pathExists$1(path.join(realPackageRoot, "extensions")) ? [`global package root resolves to source checkout: ${realPackageRoot}`] : [];
|
|
224
|
+
}
|
|
225
|
+
function shouldRequirePackagedDistInventory(version) {
|
|
226
|
+
const parsed = parseSemver(version ?? null);
|
|
227
|
+
if (!parsed) return false;
|
|
228
|
+
if (parsed.major !== FIRST_PACKAGED_DIST_INVENTORY_VERSION.major) return parsed.major > FIRST_PACKAGED_DIST_INVENTORY_VERSION.major;
|
|
229
|
+
if (parsed.minor !== FIRST_PACKAGED_DIST_INVENTORY_VERSION.minor) return parsed.minor > FIRST_PACKAGED_DIST_INVENTORY_VERSION.minor;
|
|
230
|
+
return parsed.patch >= FIRST_PACKAGED_DIST_INVENTORY_VERSION.patch;
|
|
231
|
+
}
|
|
232
|
+
async function collectInstalledPackageDistErrors(params) {
|
|
233
|
+
const criticalPaths = await collectCriticalInstalledPackageDistPaths(params.packageRoot);
|
|
234
|
+
let inventoryFiles = null;
|
|
235
|
+
let inventoryError = null;
|
|
236
|
+
try {
|
|
237
|
+
inventoryFiles = await readPackageDistInventoryIfPresent(params.packageRoot);
|
|
238
|
+
} catch {
|
|
239
|
+
inventoryError = `invalid package dist inventory ${PACKAGE_DIST_INVENTORY_RELATIVE_PATH}`;
|
|
240
|
+
}
|
|
241
|
+
if (inventoryFiles !== null) {
|
|
242
|
+
const actualFiles = await collectPackageDistInventory(params.packageRoot);
|
|
243
|
+
const inventoryErrors = await collectInstalledPathErrors({
|
|
244
|
+
packageRoot: params.packageRoot,
|
|
245
|
+
expectedFiles: inventoryFiles,
|
|
246
|
+
actualFiles,
|
|
247
|
+
missingMessage: (relativePath) => `missing packaged dist file ${relativePath}`,
|
|
248
|
+
unexpectedMessage: (relativePath) => `unexpected packaged dist file ${relativePath}`
|
|
249
|
+
});
|
|
250
|
+
const inventorySet = new Set(inventoryFiles);
|
|
251
|
+
const supplementalCriticalPaths = criticalPaths.filter((relativePath) => !inventorySet.has(relativePath));
|
|
252
|
+
if (supplementalCriticalPaths.length === 0) return inventoryErrors;
|
|
253
|
+
return [...inventoryErrors, ...await collectInstalledPathErrors({
|
|
254
|
+
packageRoot: params.packageRoot,
|
|
255
|
+
expectedFiles: supplementalCriticalPaths,
|
|
256
|
+
actualFiles,
|
|
257
|
+
missingMessage: (relativePath) => `missing bundled runtime sidecar ${relativePath}`
|
|
258
|
+
})];
|
|
259
|
+
}
|
|
260
|
+
const criticalErrors = await collectInstalledPathErrors({
|
|
261
|
+
packageRoot: params.packageRoot,
|
|
262
|
+
expectedFiles: await collectLegacyInstalledPackageDistPaths(params.packageRoot),
|
|
263
|
+
actualFiles: null,
|
|
264
|
+
missingMessage: (relativePath) => `missing bundled runtime sidecar ${relativePath}`
|
|
265
|
+
});
|
|
266
|
+
if (inventoryError) return [inventoryError, ...criticalErrors];
|
|
267
|
+
if (shouldRequirePackagedDistInventory(params.installedVersion) || shouldRequirePackagedDistInventory(params.expectedVersion)) return [`missing package dist inventory ${PACKAGE_DIST_INVENTORY_RELATIVE_PATH}`, ...criticalErrors];
|
|
268
|
+
return criticalErrors;
|
|
269
|
+
}
|
|
270
|
+
async function collectLegacyInstalledPackageDistPaths(packageRoot) {
|
|
271
|
+
return await collectCriticalInstalledPackageDistPaths(packageRoot);
|
|
272
|
+
}
|
|
273
|
+
async function collectCriticalInstalledPackageDistPaths(packageRoot) {
|
|
274
|
+
const expectedFiles = /* @__PURE__ */ new Set();
|
|
275
|
+
await Promise.all(BUNDLED_RUNTIME_SIDECAR_PATHS.map(async (relativePath) => {
|
|
276
|
+
const pluginRoot = resolveBundledPluginRoot(relativePath);
|
|
277
|
+
if (pluginRoot === null) return;
|
|
278
|
+
if (OMITTED_PRIVATE_QA_BUNDLED_PLUGIN_ROOTS.has(pluginRoot)) return;
|
|
279
|
+
if (await pathExists$1(path.join(packageRoot, pluginRoot, "package.json")) || await pathExists$1(path.join(packageRoot, pluginRoot, "daocore.plugin.json"))) expectedFiles.add(relativePath);
|
|
280
|
+
}));
|
|
281
|
+
return [...expectedFiles].toSorted((left, right) => left.localeCompare(right));
|
|
282
|
+
}
|
|
283
|
+
function resolveBundledPluginRoot(relativePath) {
|
|
284
|
+
const match = /^dist\/extensions\/[^/]+/u.exec(relativePath);
|
|
285
|
+
return match ? match[0] : null;
|
|
286
|
+
}
|
|
287
|
+
async function collectInstalledPathErrors(params) {
|
|
288
|
+
const errors = [];
|
|
289
|
+
const actualSet = params.actualFiles ? new Set(params.actualFiles) : null;
|
|
290
|
+
for (const relativePath of params.expectedFiles) if (!(actualSet !== null ? actualSet.has(relativePath) : await pathExists$1(path.join(params.packageRoot, relativePath)))) errors.push(params.missingMessage(relativePath));
|
|
291
|
+
if (actualSet !== null && params.unexpectedMessage) {
|
|
292
|
+
const expectedSet = new Set(params.expectedFiles);
|
|
293
|
+
for (const relativePath of params.actualFiles ?? []) if (!expectedSet.has(relativePath)) errors.push(params.unexpectedMessage(relativePath));
|
|
294
|
+
}
|
|
295
|
+
return errors;
|
|
296
|
+
}
|
|
297
|
+
function canResolveRegistryVersionForPackageTarget(value) {
|
|
298
|
+
const trimmed = normalizePackageTarget(value);
|
|
299
|
+
if (!trimmed) return true;
|
|
300
|
+
return !isMainPackageTarget(trimmed) && !isExplicitPackageInstallSpec(trimmed);
|
|
301
|
+
}
|
|
302
|
+
async function resolvePortableGitPathPrepend() {
|
|
303
|
+
if (process.platform !== "win32") return [];
|
|
304
|
+
const localAppData = process.env.LOCALAPPDATA?.trim();
|
|
305
|
+
if (!localAppData) return [];
|
|
306
|
+
const portableGitRoot = path.join(localAppData, "DaoCore", "deps", "portable-git");
|
|
307
|
+
const candidates = [
|
|
308
|
+
path.join(portableGitRoot, "mingw64", "bin"),
|
|
309
|
+
path.join(portableGitRoot, "usr", "bin"),
|
|
310
|
+
path.join(portableGitRoot, "cmd"),
|
|
311
|
+
path.join(portableGitRoot, "bin")
|
|
312
|
+
];
|
|
313
|
+
const existing = [];
|
|
314
|
+
for (const candidate of candidates) if (await pathExists$1(candidate)) existing.push(candidate);
|
|
315
|
+
return existing;
|
|
316
|
+
}
|
|
317
|
+
function applyWindowsPackageInstallEnv(env) {
|
|
318
|
+
if (process.platform !== "win32") return;
|
|
319
|
+
env.NPM_CONFIG_UPDATE_NOTIFIER = "false";
|
|
320
|
+
env.NPM_CONFIG_FUND = "false";
|
|
321
|
+
env.NPM_CONFIG_AUDIT = "false";
|
|
322
|
+
env.NODE_LLAMA_CPP_SKIP_DOWNLOAD = "1";
|
|
323
|
+
}
|
|
324
|
+
function applyCorepackDownloadPromptEnv(env) {
|
|
325
|
+
if (!env.COREPACK_ENABLE_DOWNLOAD_PROMPT?.trim()) env.COREPACK_ENABLE_DOWNLOAD_PROMPT = COREPACK_ENABLE_DOWNLOAD_PROMPT_DEFAULT;
|
|
326
|
+
}
|
|
327
|
+
function resolveGlobalInstallSpec(params) {
|
|
328
|
+
const override = params.env?.DAOCORE_UPDATE_PACKAGE_SPEC?.trim() || process.env.DAOCORE_UPDATE_PACKAGE_SPEC?.trim();
|
|
329
|
+
if (override) return override;
|
|
330
|
+
const target = normalizePackageTarget(params.tag);
|
|
331
|
+
if (isMainPackageTarget(target)) return DAOCORE_MAIN_PACKAGE_SPEC;
|
|
332
|
+
if (isExplicitPackageInstallSpec(target)) return target;
|
|
333
|
+
return `${params.packageName}@${target}`;
|
|
334
|
+
}
|
|
335
|
+
async function createGlobalInstallEnv(env) {
|
|
336
|
+
const pathPrepend = await resolvePortableGitPathPrepend();
|
|
337
|
+
const sourceEnv = env ?? process.env;
|
|
338
|
+
const merged = Object.fromEntries(Object.entries(sourceEnv).filter(([, value]) => value != null).map(([key, value]) => [key, String(value)]));
|
|
339
|
+
applyPathPrepend(merged, pathPrepend);
|
|
340
|
+
applyWindowsPackageInstallEnv(merged);
|
|
341
|
+
applyCorepackDownloadPromptEnv(merged);
|
|
342
|
+
applyNpmFreshnessBypassEnv(merged);
|
|
343
|
+
applyPosixNpmScriptShellEnv(merged);
|
|
344
|
+
return merged;
|
|
345
|
+
}
|
|
346
|
+
async function tryRealpath(targetPath) {
|
|
347
|
+
try {
|
|
348
|
+
return await fs$1.realpath(targetPath);
|
|
349
|
+
} catch {
|
|
350
|
+
return path.resolve(targetPath);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
function resolveBunGlobalRoot() {
|
|
354
|
+
const bunInstall = process.env.BUN_INSTALL?.trim() || path.join(os.homedir(), ".bun");
|
|
355
|
+
return path.join(bunInstall, "install", "global", "node_modules");
|
|
356
|
+
}
|
|
357
|
+
function inferNpmPrefixFromPackageRoot(pkgRoot) {
|
|
358
|
+
const trimmed = pkgRoot?.trim();
|
|
359
|
+
if (!trimmed) return null;
|
|
360
|
+
const normalized = path.resolve(trimmed);
|
|
361
|
+
const nodeModulesDir = path.dirname(normalized);
|
|
362
|
+
if (path.basename(nodeModulesDir) !== "node_modules") return null;
|
|
363
|
+
const parentDir = path.dirname(nodeModulesDir);
|
|
364
|
+
if (path.basename(parentDir) === "lib") return path.dirname(parentDir);
|
|
365
|
+
if (process.platform === "win32" && normalizeLowercaseStringOrEmpty(path.basename(parentDir)) === "npm") return parentDir;
|
|
366
|
+
return null;
|
|
367
|
+
}
|
|
368
|
+
function resolveNpmGlobalPrefixLayoutFromGlobalRoot(globalRoot, options = {}) {
|
|
369
|
+
const trimmed = globalRoot?.trim();
|
|
370
|
+
if (!trimmed) return null;
|
|
371
|
+
const normalized = path.resolve(trimmed);
|
|
372
|
+
if (path.basename(normalized) !== "node_modules") return null;
|
|
373
|
+
const parentDir = path.dirname(normalized);
|
|
374
|
+
if (path.basename(parentDir) === "lib") {
|
|
375
|
+
const prefix = path.dirname(parentDir);
|
|
376
|
+
return {
|
|
377
|
+
prefix,
|
|
378
|
+
globalRoot: normalized,
|
|
379
|
+
binDir: path.join(prefix, "bin")
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
if (process.platform === "win32") return {
|
|
383
|
+
prefix: parentDir,
|
|
384
|
+
globalRoot: normalized,
|
|
385
|
+
binDir: parentDir
|
|
386
|
+
};
|
|
387
|
+
if (options.allowDirectNodeModulesRoot) return {
|
|
388
|
+
prefix: parentDir,
|
|
389
|
+
globalRoot: normalized,
|
|
390
|
+
binDir: path.join(normalized, ".bin")
|
|
391
|
+
};
|
|
392
|
+
return null;
|
|
393
|
+
}
|
|
394
|
+
function resolveNpmGlobalPrefixLayoutFromPrefix(prefix) {
|
|
395
|
+
const resolvedPrefix = path.resolve(prefix);
|
|
396
|
+
if (process.platform === "win32") return {
|
|
397
|
+
prefix: resolvedPrefix,
|
|
398
|
+
globalRoot: path.join(resolvedPrefix, "node_modules"),
|
|
399
|
+
binDir: resolvedPrefix
|
|
400
|
+
};
|
|
401
|
+
return {
|
|
402
|
+
prefix: resolvedPrefix,
|
|
403
|
+
globalRoot: path.join(resolvedPrefix, "lib", "node_modules"),
|
|
404
|
+
binDir: path.join(resolvedPrefix, "bin")
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
function resolvePreferredNpmCommand(pkgRoot) {
|
|
408
|
+
const prefix = inferNpmPrefixFromPackageRoot(pkgRoot);
|
|
409
|
+
if (!prefix) return null;
|
|
410
|
+
const candidate = process.platform === "win32" ? path.join(prefix, "npm.cmd") : path.join(prefix, "bin", "npm");
|
|
411
|
+
return fs.existsSync(candidate) ? candidate : null;
|
|
412
|
+
}
|
|
413
|
+
function inferGlobalRootFromPackageRoot(pkgRoot) {
|
|
414
|
+
const trimmed = pkgRoot?.trim();
|
|
415
|
+
if (!trimmed) return null;
|
|
416
|
+
const normalized = path.resolve(trimmed);
|
|
417
|
+
const globalRoot = path.dirname(normalized);
|
|
418
|
+
return path.basename(globalRoot) === "node_modules" ? globalRoot : null;
|
|
419
|
+
}
|
|
420
|
+
function isDirectNpmNodeModulesRoot(globalRoot) {
|
|
421
|
+
return globalRoot !== null && resolveNpmGlobalPrefixLayoutFromGlobalRoot(globalRoot) === null && resolveNpmGlobalPrefixLayoutFromGlobalRoot(globalRoot, { allowDirectNodeModulesRoot: true }) !== null;
|
|
422
|
+
}
|
|
423
|
+
function inferBunGlobalRootFromPackageRoot(pkgRoot) {
|
|
424
|
+
const directGlobalRoot = inferGlobalRootFromPackageRoot(pkgRoot);
|
|
425
|
+
if (!directGlobalRoot) return null;
|
|
426
|
+
return path.resolve(directGlobalRoot) === path.resolve(resolveBunGlobalRoot()) ? directGlobalRoot : null;
|
|
427
|
+
}
|
|
428
|
+
function inferPnpmGlobalRootFromPackageRoot(pkgRoot) {
|
|
429
|
+
const directGlobalRoot = inferGlobalRootFromPackageRoot(pkgRoot);
|
|
430
|
+
if (resolvePnpmGlobalDirFromGlobalRoot(directGlobalRoot)) return directGlobalRoot;
|
|
431
|
+
const trimmed = pkgRoot?.trim();
|
|
432
|
+
if (!trimmed) return null;
|
|
433
|
+
const parts = path.resolve(trimmed).split(path.sep);
|
|
434
|
+
const pnpmIndex = parts.lastIndexOf(".pnpm");
|
|
435
|
+
if (pnpmIndex <= 0) return null;
|
|
436
|
+
if (parts[pnpmIndex + 2] !== "node_modules") return null;
|
|
437
|
+
const layoutDir = parts.slice(0, pnpmIndex).join(path.sep) || path.sep;
|
|
438
|
+
const globalRoot = path.basename(layoutDir) === "node_modules" ? layoutDir : path.join(layoutDir, "node_modules");
|
|
439
|
+
return resolvePnpmGlobalDirFromGlobalRoot(globalRoot) ? globalRoot : null;
|
|
440
|
+
}
|
|
441
|
+
function resolvePnpmGlobalDirFromGlobalRoot(globalRoot) {
|
|
442
|
+
const trimmed = globalRoot?.trim();
|
|
443
|
+
if (!trimmed) return null;
|
|
444
|
+
const normalized = path.resolve(trimmed);
|
|
445
|
+
if (path.basename(normalized) !== "node_modules") return null;
|
|
446
|
+
const layoutDir = path.dirname(normalized);
|
|
447
|
+
return /^\d+$/u.test(path.basename(layoutDir)) ? path.dirname(layoutDir) : null;
|
|
448
|
+
}
|
|
449
|
+
async function isPnpmGlobalPackageRoot(pkgRoot) {
|
|
450
|
+
const globalRoot = inferPnpmGlobalRootFromPackageRoot(pkgRoot);
|
|
451
|
+
if (!globalRoot) return false;
|
|
452
|
+
const layoutDir = path.dirname(globalRoot);
|
|
453
|
+
if (!await pathExists$1(path.join(globalRoot, ".modules.yaml"))) return false;
|
|
454
|
+
return await pathExists$1(path.join(layoutDir, "pnpm-lock.yaml")) || await pathExists$1(path.join(layoutDir, "package.json"));
|
|
455
|
+
}
|
|
456
|
+
function resolvePreferredGlobalManagerCommand(manager, pkgRoot) {
|
|
457
|
+
if (manager !== "npm") return manager;
|
|
458
|
+
return resolvePreferredNpmCommand(pkgRoot) ?? manager;
|
|
459
|
+
}
|
|
460
|
+
function resolveGlobalInstallCommand(manager, pkgRoot) {
|
|
461
|
+
return {
|
|
462
|
+
manager,
|
|
463
|
+
command: resolvePreferredGlobalManagerCommand(manager, pkgRoot)
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
function normalizeGlobalInstallCommand(managerOrCommand, pkgRoot) {
|
|
467
|
+
return typeof managerOrCommand === "string" ? resolveGlobalInstallCommand(managerOrCommand, pkgRoot) : managerOrCommand;
|
|
468
|
+
}
|
|
469
|
+
function resolveInstallCommandForManager(managerOrCommand, manager, pkgRoot) {
|
|
470
|
+
const normalized = normalizeGlobalInstallCommand(managerOrCommand, pkgRoot);
|
|
471
|
+
return normalized.manager === manager ? normalized : resolveGlobalInstallCommand(manager, pkgRoot);
|
|
472
|
+
}
|
|
473
|
+
async function resolveGlobalRoot(managerOrCommand, runCommand, timeoutMs, pkgRoot) {
|
|
474
|
+
const resolved = normalizeGlobalInstallCommand(managerOrCommand, pkgRoot);
|
|
475
|
+
if (resolved.manager === "bun") return resolveBunGlobalRoot();
|
|
476
|
+
const res = await runCommand([
|
|
477
|
+
resolved.command,
|
|
478
|
+
"root",
|
|
479
|
+
"-g"
|
|
480
|
+
], { timeoutMs }).catch(() => null);
|
|
481
|
+
if (!res || res.code !== 0) return null;
|
|
482
|
+
return res.stdout.trim() || null;
|
|
483
|
+
}
|
|
484
|
+
async function resolveGlobalInstallTarget(params) {
|
|
485
|
+
const honoredPackageRootGlobalRoot = params.honorPackageRoot ? inferGlobalRootFromPackageRoot(params.pkgRoot) : null;
|
|
486
|
+
const pnpmPackageRootGlobalRoot = await isPnpmGlobalPackageRoot(params.pkgRoot) ? inferPnpmGlobalRootFromPackageRoot(params.pkgRoot) : null;
|
|
487
|
+
const bunPackageRootGlobalRoot = inferBunGlobalRootFromPackageRoot(params.pkgRoot);
|
|
488
|
+
const honoredDirectNpmRoot = pnpmPackageRootGlobalRoot === null && bunPackageRootGlobalRoot === null && isDirectNpmNodeModulesRoot(honoredPackageRootGlobalRoot);
|
|
489
|
+
const command = bunPackageRootGlobalRoot ? resolveInstallCommandForManager(params.manager, "bun", params.pkgRoot) : pnpmPackageRootGlobalRoot ? resolveInstallCommandForManager(params.manager, "pnpm", params.pkgRoot) : honoredDirectNpmRoot ? resolveInstallCommandForManager(params.manager, "npm", params.pkgRoot) : normalizeGlobalInstallCommand(params.manager, params.pkgRoot);
|
|
490
|
+
const globalRoot = await resolveGlobalRoot(command, params.runCommand, params.timeoutMs, params.pkgRoot);
|
|
491
|
+
const pkgRootGlobalRoot = command.manager === "pnpm" ? pnpmPackageRootGlobalRoot : null;
|
|
492
|
+
const targetGlobalRoot = (command.manager === "bun" ? bunPackageRootGlobalRoot : null) ?? pkgRootGlobalRoot ?? (command.manager === "npm" ? honoredPackageRootGlobalRoot : null) ?? globalRoot;
|
|
493
|
+
return {
|
|
494
|
+
...command,
|
|
495
|
+
globalRoot: targetGlobalRoot,
|
|
496
|
+
packageRoot: targetGlobalRoot ? path.join(targetGlobalRoot, PRIMARY_PACKAGE_NAME) : null,
|
|
497
|
+
...honoredPackageRootGlobalRoot && targetGlobalRoot === honoredPackageRootGlobalRoot && honoredDirectNpmRoot ? { directNodeModulesRoot: true } : {}
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
async function detectGlobalInstallManagerForRoot(runCommand, pkgRoot, timeoutMs) {
|
|
501
|
+
const pkgReal = await tryRealpath(pkgRoot);
|
|
502
|
+
for (const { manager, argv } of [{
|
|
503
|
+
manager: "npm",
|
|
504
|
+
argv: [
|
|
505
|
+
"npm",
|
|
506
|
+
"root",
|
|
507
|
+
"-g"
|
|
508
|
+
]
|
|
509
|
+
}, {
|
|
510
|
+
manager: "pnpm",
|
|
511
|
+
argv: [
|
|
512
|
+
"pnpm",
|
|
513
|
+
"root",
|
|
514
|
+
"-g"
|
|
515
|
+
]
|
|
516
|
+
}]) {
|
|
517
|
+
const res = await runCommand(argv, { timeoutMs }).catch(() => null);
|
|
518
|
+
if (!res || res.code !== 0) continue;
|
|
519
|
+
const globalRoot = res.stdout.trim();
|
|
520
|
+
if (!globalRoot) continue;
|
|
521
|
+
const globalReal = await tryRealpath(globalRoot);
|
|
522
|
+
for (const name of ALL_PACKAGE_NAMES) {
|
|
523
|
+
const expectedReal = await tryRealpath(path.join(globalReal, name));
|
|
524
|
+
if (path.resolve(expectedReal) === path.resolve(pkgReal)) return manager;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
if (await isPnpmGlobalPackageRoot(pkgRoot)) return "pnpm";
|
|
528
|
+
const bunGlobalReal = await tryRealpath(resolveBunGlobalRoot());
|
|
529
|
+
for (const name of ALL_PACKAGE_NAMES) {
|
|
530
|
+
const bunExpectedReal = await tryRealpath(path.join(bunGlobalReal, name));
|
|
531
|
+
if (path.resolve(bunExpectedReal) === path.resolve(pkgReal)) return "bun";
|
|
532
|
+
}
|
|
533
|
+
if (resolvePreferredNpmCommand(pkgRoot)) return "npm";
|
|
534
|
+
return null;
|
|
535
|
+
}
|
|
536
|
+
async function detectGlobalInstallManagerByPresence(runCommand, timeoutMs) {
|
|
537
|
+
for (const manager of ["npm", "pnpm"]) {
|
|
538
|
+
const root = await resolveGlobalRoot(manager, runCommand, timeoutMs);
|
|
539
|
+
if (!root) continue;
|
|
540
|
+
for (const name of ALL_PACKAGE_NAMES) if (await pathExists$1(path.join(root, name))) return manager;
|
|
541
|
+
}
|
|
542
|
+
const bunRoot = resolveBunGlobalRoot();
|
|
543
|
+
for (const name of ALL_PACKAGE_NAMES) if (await pathExists$1(path.join(bunRoot, name))) return "bun";
|
|
544
|
+
return null;
|
|
545
|
+
}
|
|
546
|
+
function globalInstallArgs(managerOrCommand, spec, pkgRoot, installPrefix) {
|
|
547
|
+
const resolved = normalizeGlobalInstallCommand(managerOrCommand, pkgRoot);
|
|
548
|
+
if (resolved.manager === "pnpm") return [
|
|
549
|
+
resolved.command,
|
|
550
|
+
"add",
|
|
551
|
+
"-g",
|
|
552
|
+
...installPrefix ? ["--global-dir", installPrefix] : [],
|
|
553
|
+
...isPnpmDaoCoreSourceInstallSpec(spec) ? [PNPM_DAOCORE_BUILD_ALLOWLIST_FLAG] : [],
|
|
554
|
+
spec
|
|
555
|
+
];
|
|
556
|
+
if (resolved.manager === "bun") return [
|
|
557
|
+
resolved.command,
|
|
558
|
+
"add",
|
|
559
|
+
"-g",
|
|
560
|
+
spec
|
|
561
|
+
];
|
|
562
|
+
return [
|
|
563
|
+
resolved.command,
|
|
564
|
+
"i",
|
|
565
|
+
"-g",
|
|
566
|
+
...installPrefix ? ["--prefix", installPrefix] : [],
|
|
567
|
+
spec,
|
|
568
|
+
...NPM_GLOBAL_INSTALL_QUIET_FLAGS,
|
|
569
|
+
...createNpmFreshnessBypassArgs(process.env, /* @__PURE__ */ new Date(), { npmConfigPrefix: installPrefix })
|
|
570
|
+
];
|
|
571
|
+
}
|
|
572
|
+
function globalInstallFallbackArgs(managerOrCommand, spec, pkgRoot, installPrefix) {
|
|
573
|
+
const resolved = normalizeGlobalInstallCommand(managerOrCommand, pkgRoot);
|
|
574
|
+
if (resolved.manager !== "npm") return null;
|
|
575
|
+
return [
|
|
576
|
+
resolved.command,
|
|
577
|
+
"i",
|
|
578
|
+
"-g",
|
|
579
|
+
...installPrefix ? ["--prefix", installPrefix] : [],
|
|
580
|
+
spec,
|
|
581
|
+
"--omit=optional",
|
|
582
|
+
...NPM_GLOBAL_INSTALL_QUIET_FLAGS,
|
|
583
|
+
...createNpmFreshnessBypassArgs(process.env, /* @__PURE__ */ new Date(), { npmConfigPrefix: installPrefix })
|
|
584
|
+
];
|
|
585
|
+
}
|
|
586
|
+
async function cleanupGlobalRenameDirs(params) {
|
|
587
|
+
const removed = [];
|
|
588
|
+
const root = params.globalRoot.trim();
|
|
589
|
+
const name = params.packageName.trim();
|
|
590
|
+
if (!root || !name) return { removed };
|
|
591
|
+
const prefix = `${GLOBAL_RENAME_PREFIX}${name}-`;
|
|
592
|
+
let entries = [];
|
|
593
|
+
try {
|
|
594
|
+
entries = await fs$1.readdir(root);
|
|
595
|
+
} catch {
|
|
596
|
+
return { removed };
|
|
597
|
+
}
|
|
598
|
+
for (const entry of entries) {
|
|
599
|
+
if (!entry.startsWith(prefix)) continue;
|
|
600
|
+
const target = path.join(root, entry);
|
|
601
|
+
try {
|
|
602
|
+
if (!(await fs$1.lstat(target)).isDirectory()) continue;
|
|
603
|
+
await fs$1.rm(target, {
|
|
604
|
+
recursive: true,
|
|
605
|
+
force: true
|
|
606
|
+
});
|
|
607
|
+
removed.push(entry);
|
|
608
|
+
} catch {}
|
|
609
|
+
}
|
|
610
|
+
return { removed };
|
|
611
|
+
}
|
|
612
|
+
//#endregion
|
|
613
|
+
//#region src/infra/package-update-steps.ts
|
|
614
|
+
const NPM_PACK_QUIET_FLAGS = ["--json", "--loglevel=error"];
|
|
615
|
+
function formatError(err) {
|
|
616
|
+
return err instanceof Error ? err.message : String(err);
|
|
617
|
+
}
|
|
618
|
+
async function removePathBestEffort(targetPath) {
|
|
619
|
+
await fs$1.rm(targetPath, {
|
|
620
|
+
recursive: true,
|
|
621
|
+
force: true,
|
|
622
|
+
maxRetries: process.platform === "win32" ? 5 : 2,
|
|
623
|
+
retryDelay: 100
|
|
624
|
+
}).catch(() => void 0);
|
|
625
|
+
}
|
|
626
|
+
async function readPackageVersionIfPresent(packageRoot) {
|
|
627
|
+
if (!packageRoot) return null;
|
|
628
|
+
try {
|
|
629
|
+
return await readPackageVersion(packageRoot);
|
|
630
|
+
} catch {
|
|
631
|
+
return null;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
function isUnambiguousNpmPrefixGlobalRoot(globalRoot) {
|
|
635
|
+
const trimmed = globalRoot?.trim();
|
|
636
|
+
if (!trimmed) return false;
|
|
637
|
+
const normalized = path.resolve(trimmed);
|
|
638
|
+
if (path.basename(normalized) !== "node_modules") return false;
|
|
639
|
+
const parentDir = path.dirname(normalized);
|
|
640
|
+
if (path.basename(parentDir) === "lib") return true;
|
|
641
|
+
return process.platform === "win32" && path.basename(parentDir).toLowerCase() === "npm";
|
|
642
|
+
}
|
|
643
|
+
function resolveStagedNpmTargetLayout(installTarget) {
|
|
644
|
+
const targetLayout = resolveNpmGlobalPrefixLayoutFromGlobalRoot(installTarget.globalRoot, { allowDirectNodeModulesRoot: installTarget.directNodeModulesRoot === true });
|
|
645
|
+
if (!targetLayout) return null;
|
|
646
|
+
if (installTarget.manager === "npm" || isUnambiguousNpmPrefixGlobalRoot(installTarget.globalRoot)) return targetLayout;
|
|
647
|
+
return null;
|
|
648
|
+
}
|
|
649
|
+
function stripPackageAlias(spec, packageName) {
|
|
650
|
+
const trimmed = spec.trim();
|
|
651
|
+
const prefix = `${packageName.trim()}@`;
|
|
652
|
+
return trimmed.toLowerCase().startsWith(prefix.toLowerCase()) ? trimmed.slice(prefix.length).trim() : trimmed;
|
|
653
|
+
}
|
|
654
|
+
function isHttpGitUrlSpec(spec) {
|
|
655
|
+
try {
|
|
656
|
+
const url = new URL(spec);
|
|
657
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") return false;
|
|
658
|
+
const pathname = url.pathname.replace(/\/+$/u, "");
|
|
659
|
+
if (pathname.endsWith(".git")) return true;
|
|
660
|
+
const parts = pathname.split("/").filter(Boolean);
|
|
661
|
+
return url.hostname.toLowerCase() === "github.com" && parts.length === 2;
|
|
662
|
+
} catch {
|
|
663
|
+
return false;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
function isGitHubShorthandSpec(spec) {
|
|
667
|
+
const [repo] = spec.split("#", 1);
|
|
668
|
+
if (!repo || repo.startsWith(".") || repo.startsWith("/") || repo.startsWith("@")) return false;
|
|
669
|
+
const parts = repo.split("/");
|
|
670
|
+
return parts.length === 2 && parts.every((part) => /^[^\s/:@]+$/u.test(part));
|
|
671
|
+
}
|
|
672
|
+
function isNpmGitSourceInstallSpec(spec, packageName) {
|
|
673
|
+
const target = stripPackageAlias(spec, packageName);
|
|
674
|
+
return /^github:/i.test(target) || /^git\+(?:ssh|https|http|file):/i.test(target) || /^git:/i.test(target) || /^ssh:\/\//i.test(target) || /^[^@\s]+@[^:\s]+:[^#\s]+(?:#.*)?$/u.test(target) || isHttpGitUrlSpec(target) || isGitHubShorthandSpec(target);
|
|
675
|
+
}
|
|
676
|
+
async function createStagedNpmInstall(installTarget, packageName) {
|
|
677
|
+
const targetLayout = resolveStagedNpmTargetLayout(installTarget);
|
|
678
|
+
if (!targetLayout) return null;
|
|
679
|
+
await fs$1.mkdir(targetLayout.globalRoot, { recursive: true });
|
|
680
|
+
const prefix = await fs$1.mkdtemp(path.join(targetLayout.globalRoot, ".daocore-update-stage-"));
|
|
681
|
+
const layout = resolveNpmGlobalPrefixLayoutFromPrefix(prefix);
|
|
682
|
+
const command = installTarget.manager === "npm" ? installTarget.command : "npm";
|
|
683
|
+
return {
|
|
684
|
+
prefix,
|
|
685
|
+
layout,
|
|
686
|
+
packageRoot: path.join(layout.globalRoot, packageName),
|
|
687
|
+
installTarget: {
|
|
688
|
+
manager: "npm",
|
|
689
|
+
command,
|
|
690
|
+
globalRoot: layout.globalRoot,
|
|
691
|
+
packageRoot: path.join(layout.globalRoot, packageName)
|
|
692
|
+
}
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
async function findPackedTarball(packDir) {
|
|
696
|
+
const tarballs = (await fs$1.readdir(packDir).catch(() => [])).filter((entry) => entry.endsWith(".tgz"));
|
|
697
|
+
if (tarballs.length !== 1) return null;
|
|
698
|
+
return path.join(packDir, tarballs[0] ?? "");
|
|
699
|
+
}
|
|
700
|
+
async function prepareNpmGitSourceInstallSpec(params) {
|
|
701
|
+
if (params.installTarget.manager !== "npm" || !isNpmGitSourceInstallSpec(params.installSpec, params.packageName)) return {
|
|
702
|
+
installSpec: params.installSpec,
|
|
703
|
+
packDir: null,
|
|
704
|
+
steps: [],
|
|
705
|
+
failedStep: null
|
|
706
|
+
};
|
|
707
|
+
const packDir = await fs$1.mkdtemp(path.join(os.tmpdir(), "daocore-update-pack-"));
|
|
708
|
+
const packStep = await params.runStep({
|
|
709
|
+
name: "global update pack",
|
|
710
|
+
argv: [
|
|
711
|
+
params.installTarget.command,
|
|
712
|
+
"pack",
|
|
713
|
+
params.installSpec,
|
|
714
|
+
"--pack-destination",
|
|
715
|
+
packDir,
|
|
716
|
+
...NPM_PACK_QUIET_FLAGS
|
|
717
|
+
],
|
|
718
|
+
cwd: params.installCwd,
|
|
719
|
+
env: params.env,
|
|
720
|
+
timeoutMs: params.timeoutMs
|
|
721
|
+
});
|
|
722
|
+
if (packStep.exitCode !== 0) return {
|
|
723
|
+
installSpec: params.installSpec,
|
|
724
|
+
packDir,
|
|
725
|
+
steps: [packStep],
|
|
726
|
+
failedStep: packStep
|
|
727
|
+
};
|
|
728
|
+
const tarball = await findPackedTarball(packDir);
|
|
729
|
+
if (!tarball) {
|
|
730
|
+
const failedStep = {
|
|
731
|
+
name: "global update pack verify",
|
|
732
|
+
command: `find packed tarball in ${packDir}`,
|
|
733
|
+
cwd: packDir,
|
|
734
|
+
durationMs: 0,
|
|
735
|
+
exitCode: 1,
|
|
736
|
+
stdoutTail: null,
|
|
737
|
+
stderrTail: `expected exactly one .tgz from npm pack ${params.installSpec}`
|
|
738
|
+
};
|
|
739
|
+
return {
|
|
740
|
+
installSpec: params.installSpec,
|
|
741
|
+
packDir,
|
|
742
|
+
steps: [packStep, failedStep],
|
|
743
|
+
failedStep
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
return {
|
|
747
|
+
installSpec: tarball,
|
|
748
|
+
packDir,
|
|
749
|
+
steps: [packStep],
|
|
750
|
+
failedStep: null
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
async function prepareStagedNpmInstall(installTarget, packageName) {
|
|
754
|
+
const startedAt = Date.now();
|
|
755
|
+
try {
|
|
756
|
+
return {
|
|
757
|
+
stagedInstall: await createStagedNpmInstall(installTarget, packageName),
|
|
758
|
+
failedStep: null
|
|
759
|
+
};
|
|
760
|
+
} catch (err) {
|
|
761
|
+
return {
|
|
762
|
+
stagedInstall: null,
|
|
763
|
+
failedStep: {
|
|
764
|
+
name: "global install stage",
|
|
765
|
+
command: "prepare staged npm install",
|
|
766
|
+
cwd: (installTarget.manager === "npm" ? resolveNpmGlobalPrefixLayoutFromGlobalRoot(installTarget.globalRoot, { allowDirectNodeModulesRoot: installTarget.directNodeModulesRoot === true }) : null)?.prefix ?? installTarget.globalRoot ?? process.cwd(),
|
|
767
|
+
durationMs: Date.now() - startedAt,
|
|
768
|
+
exitCode: 1,
|
|
769
|
+
stdoutTail: null,
|
|
770
|
+
stderrTail: formatError(err)
|
|
771
|
+
}
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
async function cleanupStagedNpmInstall(stage) {
|
|
776
|
+
if (!stage) return;
|
|
777
|
+
await removePathBestEffort(stage.prefix);
|
|
778
|
+
}
|
|
779
|
+
async function copyPathEntry(source, destination) {
|
|
780
|
+
const stat = await fs$1.lstat(source);
|
|
781
|
+
await removePathBestEffort(destination);
|
|
782
|
+
if (stat.isSymbolicLink()) {
|
|
783
|
+
await fs$1.symlink(await fs$1.readlink(source), destination);
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
786
|
+
if (stat.isDirectory()) {
|
|
787
|
+
await fs$1.cp(source, destination, {
|
|
788
|
+
recursive: true,
|
|
789
|
+
force: true,
|
|
790
|
+
preserveTimestamps: false
|
|
791
|
+
});
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
await fs$1.copyFile(source, destination);
|
|
795
|
+
await fs$1.chmod(destination, stat.mode).catch(() => void 0);
|
|
796
|
+
}
|
|
797
|
+
async function replaceNpmBinShims(params) {
|
|
798
|
+
let entries = [];
|
|
799
|
+
try {
|
|
800
|
+
entries = await fs$1.readdir(params.stageLayout.binDir);
|
|
801
|
+
} catch {
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
804
|
+
const names = new Set([params.packageName, "daocore"]);
|
|
805
|
+
const shimEntries = entries.filter((entry) => {
|
|
806
|
+
const parsed = path.parse(entry);
|
|
807
|
+
return names.has(entry) || names.has(parsed.name);
|
|
808
|
+
});
|
|
809
|
+
if (shimEntries.length === 0) return;
|
|
810
|
+
const backup = {
|
|
811
|
+
backupDir: await fs$1.mkdtemp(path.join(params.targetLayout.globalRoot, ".daocore-shim-backup-")),
|
|
812
|
+
targetBinDir: params.targetLayout.binDir,
|
|
813
|
+
entries: []
|
|
814
|
+
};
|
|
815
|
+
try {
|
|
816
|
+
await fs$1.mkdir(params.targetLayout.binDir, { recursive: true });
|
|
817
|
+
for (const entry of shimEntries) {
|
|
818
|
+
const destination = path.join(params.targetLayout.binDir, entry);
|
|
819
|
+
const hadExisting = await pathExists(destination);
|
|
820
|
+
backup.entries.push({
|
|
821
|
+
name: entry,
|
|
822
|
+
hadExisting
|
|
823
|
+
});
|
|
824
|
+
if (hadExisting) await copyPathEntry(destination, path.join(backup.backupDir, entry));
|
|
825
|
+
}
|
|
826
|
+
for (const entry of shimEntries) await copyPathEntry(path.join(params.stageLayout.binDir, entry), path.join(params.targetLayout.binDir, entry));
|
|
827
|
+
} catch (err) {
|
|
828
|
+
await restoreNpmBinShimBackup(backup);
|
|
829
|
+
throw err;
|
|
830
|
+
} finally {
|
|
831
|
+
await removePathBestEffort(backup.backupDir);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
async function restoreNpmBinShimBackup(backup) {
|
|
835
|
+
await fs$1.mkdir(backup.targetBinDir, { recursive: true });
|
|
836
|
+
for (const entry of backup.entries) {
|
|
837
|
+
const destination = path.join(backup.targetBinDir, entry.name);
|
|
838
|
+
await removePathBestEffort(destination);
|
|
839
|
+
if (entry.hadExisting) await copyPathEntry(path.join(backup.backupDir, entry.name), destination);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
async function swapStagedNpmInstall(params) {
|
|
843
|
+
const startedAt = Date.now();
|
|
844
|
+
const targetLayout = resolveNpmGlobalPrefixLayoutFromGlobalRoot(params.installTarget.globalRoot, { allowDirectNodeModulesRoot: params.installTarget.directNodeModulesRoot === true });
|
|
845
|
+
const targetPackageRoot = params.installTarget.packageRoot;
|
|
846
|
+
if (!targetLayout || !targetPackageRoot) return {
|
|
847
|
+
name: "global install swap",
|
|
848
|
+
command: "swap staged npm install",
|
|
849
|
+
cwd: params.stage.prefix,
|
|
850
|
+
durationMs: Date.now() - startedAt,
|
|
851
|
+
exitCode: 1,
|
|
852
|
+
stdoutTail: null,
|
|
853
|
+
stderrTail: "cannot resolve npm global prefix layout"
|
|
854
|
+
};
|
|
855
|
+
const backupRoot = path.join(targetLayout.globalRoot, `.daocore-${process.pid}-${Date.now()}`);
|
|
856
|
+
let movedExisting = false;
|
|
857
|
+
let movedStaged = false;
|
|
858
|
+
try {
|
|
859
|
+
await fs$1.mkdir(targetLayout.globalRoot, { recursive: true });
|
|
860
|
+
if (await pathExists(targetPackageRoot)) {
|
|
861
|
+
await movePathWithCopyFallback({
|
|
862
|
+
from: targetPackageRoot,
|
|
863
|
+
sourceHardlinks: "reject",
|
|
864
|
+
to: backupRoot
|
|
865
|
+
});
|
|
866
|
+
movedExisting = true;
|
|
867
|
+
}
|
|
868
|
+
await movePathWithCopyFallback({
|
|
869
|
+
from: params.stage.packageRoot,
|
|
870
|
+
sourceHardlinks: "reject",
|
|
871
|
+
to: targetPackageRoot
|
|
872
|
+
});
|
|
873
|
+
movedStaged = true;
|
|
874
|
+
if (params.installTarget.directNodeModulesRoot !== true) await replaceNpmBinShims({
|
|
875
|
+
stageLayout: params.stage.layout,
|
|
876
|
+
targetLayout,
|
|
877
|
+
packageName: params.packageName
|
|
878
|
+
});
|
|
879
|
+
if (movedExisting) await removePathBestEffort(backupRoot);
|
|
880
|
+
return {
|
|
881
|
+
name: "global install swap",
|
|
882
|
+
command: `swap ${params.stage.packageRoot} -> ${targetPackageRoot}`,
|
|
883
|
+
cwd: targetLayout.globalRoot,
|
|
884
|
+
durationMs: Date.now() - startedAt,
|
|
885
|
+
exitCode: 0,
|
|
886
|
+
stdoutTail: movedExisting ? `replaced ${params.packageName}` : `installed ${params.packageName}`,
|
|
887
|
+
stderrTail: null
|
|
888
|
+
};
|
|
889
|
+
} catch (err) {
|
|
890
|
+
if (movedStaged) await removePathBestEffort(targetPackageRoot);
|
|
891
|
+
if (movedExisting) await movePathWithCopyFallback({
|
|
892
|
+
from: backupRoot,
|
|
893
|
+
sourceHardlinks: "reject",
|
|
894
|
+
to: targetPackageRoot
|
|
895
|
+
}).catch(() => void 0);
|
|
896
|
+
return {
|
|
897
|
+
name: "global install swap",
|
|
898
|
+
command: `swap ${params.stage.packageRoot} -> ${targetPackageRoot}`,
|
|
899
|
+
cwd: targetLayout.globalRoot,
|
|
900
|
+
durationMs: Date.now() - startedAt,
|
|
901
|
+
exitCode: 1,
|
|
902
|
+
stdoutTail: null,
|
|
903
|
+
stderrTail: formatError(err)
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
async function runGlobalPackageUpdateSteps(params) {
|
|
908
|
+
const installCwd = params.installCwd === void 0 ? {} : { cwd: params.installCwd };
|
|
909
|
+
const installEnv = params.env === void 0 ? {} : { env: params.env };
|
|
910
|
+
let stagedInstall = null;
|
|
911
|
+
let packedInstallDir = null;
|
|
912
|
+
try {
|
|
913
|
+
const preparedInstall = await prepareStagedNpmInstall(params.installTarget, params.packageName);
|
|
914
|
+
stagedInstall = preparedInstall.stagedInstall;
|
|
915
|
+
if (preparedInstall.failedStep) return {
|
|
916
|
+
steps: [preparedInstall.failedStep],
|
|
917
|
+
verifiedPackageRoot: params.packageRoot ?? null,
|
|
918
|
+
afterVersion: null,
|
|
919
|
+
failedStep: preparedInstall.failedStep
|
|
920
|
+
};
|
|
921
|
+
const steps = [];
|
|
922
|
+
const installCommandTarget = stagedInstall?.installTarget ?? params.installTarget;
|
|
923
|
+
const preparedSpec = await prepareNpmGitSourceInstallSpec({
|
|
924
|
+
installTarget: installCommandTarget,
|
|
925
|
+
installSpec: params.installSpec,
|
|
926
|
+
packageName: params.packageName,
|
|
927
|
+
runStep: params.runStep,
|
|
928
|
+
timeoutMs: params.timeoutMs,
|
|
929
|
+
env: params.env,
|
|
930
|
+
installCwd: params.installCwd
|
|
931
|
+
});
|
|
932
|
+
packedInstallDir = preparedSpec.packDir;
|
|
933
|
+
steps.push(...preparedSpec.steps);
|
|
934
|
+
if (preparedSpec.failedStep) return {
|
|
935
|
+
steps,
|
|
936
|
+
verifiedPackageRoot: params.packageRoot ?? null,
|
|
937
|
+
afterVersion: null,
|
|
938
|
+
failedStep: preparedSpec.failedStep
|
|
939
|
+
};
|
|
940
|
+
const installLocation = stagedInstall?.prefix ?? (installCommandTarget.manager === "pnpm" ? resolvePnpmGlobalDirFromGlobalRoot(installCommandTarget.globalRoot) : null);
|
|
941
|
+
const updateStep = await params.runStep({
|
|
942
|
+
name: "global update",
|
|
943
|
+
argv: globalInstallArgs(installCommandTarget, preparedSpec.installSpec, void 0, installLocation),
|
|
944
|
+
...installCwd,
|
|
945
|
+
...installEnv,
|
|
946
|
+
timeoutMs: params.timeoutMs
|
|
947
|
+
});
|
|
948
|
+
steps.push(updateStep);
|
|
949
|
+
let finalInstallStep = updateStep;
|
|
950
|
+
if (updateStep.exitCode !== 0) {
|
|
951
|
+
await cleanupStagedNpmInstall(stagedInstall);
|
|
952
|
+
stagedInstall = null;
|
|
953
|
+
const preparedFallbackInstall = await prepareStagedNpmInstall(params.installTarget, params.packageName);
|
|
954
|
+
stagedInstall = preparedFallbackInstall.stagedInstall;
|
|
955
|
+
if (preparedFallbackInstall.failedStep) {
|
|
956
|
+
steps.push(preparedFallbackInstall.failedStep);
|
|
957
|
+
return {
|
|
958
|
+
steps,
|
|
959
|
+
verifiedPackageRoot: params.packageRoot ?? null,
|
|
960
|
+
afterVersion: null,
|
|
961
|
+
failedStep: preparedFallbackInstall.failedStep
|
|
962
|
+
};
|
|
963
|
+
}
|
|
964
|
+
const fallbackArgv = globalInstallFallbackArgs(stagedInstall?.installTarget ?? params.installTarget, preparedSpec.installSpec, void 0, stagedInstall?.prefix);
|
|
965
|
+
if (fallbackArgv) {
|
|
966
|
+
const fallbackStep = await params.runStep({
|
|
967
|
+
name: "global update (omit optional)",
|
|
968
|
+
argv: fallbackArgv,
|
|
969
|
+
...installCwd,
|
|
970
|
+
...installEnv,
|
|
971
|
+
timeoutMs: params.timeoutMs
|
|
972
|
+
});
|
|
973
|
+
steps.push(fallbackStep);
|
|
974
|
+
finalInstallStep = fallbackStep;
|
|
975
|
+
} else {
|
|
976
|
+
await cleanupStagedNpmInstall(stagedInstall);
|
|
977
|
+
stagedInstall = null;
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
const livePackageRoot = params.installTarget.packageRoot ?? params.packageRoot ?? (await resolveGlobalInstallTarget({
|
|
981
|
+
manager: params.installTarget,
|
|
982
|
+
runCommand: params.runCommand,
|
|
983
|
+
timeoutMs: params.timeoutMs
|
|
984
|
+
})).packageRoot ?? null;
|
|
985
|
+
const verificationPackageRoot = stagedInstall?.packageRoot ?? livePackageRoot;
|
|
986
|
+
let verifiedPackageRoot = livePackageRoot ?? verificationPackageRoot;
|
|
987
|
+
let afterVersion = null;
|
|
988
|
+
if (finalInstallStep.exitCode === 0 && verificationPackageRoot) {
|
|
989
|
+
const candidateVersion = await readPackageVersion(verificationPackageRoot);
|
|
990
|
+
if (!stagedInstall) afterVersion = candidateVersion;
|
|
991
|
+
const verificationErrors = await collectInstalledGlobalPackageErrors({
|
|
992
|
+
packageRoot: verificationPackageRoot,
|
|
993
|
+
expectedVersion: resolveExpectedInstalledVersionFromSpec(params.packageName, params.installSpec)
|
|
994
|
+
});
|
|
995
|
+
if (verificationErrors.length > 0) steps.push({
|
|
996
|
+
name: "global install verify",
|
|
997
|
+
command: `verify ${verificationPackageRoot}`,
|
|
998
|
+
cwd: verificationPackageRoot,
|
|
999
|
+
durationMs: 0,
|
|
1000
|
+
exitCode: 1,
|
|
1001
|
+
stderrTail: verificationErrors.join("\n"),
|
|
1002
|
+
stdoutTail: null
|
|
1003
|
+
});
|
|
1004
|
+
if (stagedInstall && verificationErrors.length === 0) {
|
|
1005
|
+
const swapStep = await swapStagedNpmInstall({
|
|
1006
|
+
stage: stagedInstall,
|
|
1007
|
+
installTarget: params.installTarget,
|
|
1008
|
+
packageName: params.packageName
|
|
1009
|
+
});
|
|
1010
|
+
steps.push(swapStep);
|
|
1011
|
+
if (swapStep.exitCode === 0) {
|
|
1012
|
+
verifiedPackageRoot = params.installTarget.packageRoot ?? verifiedPackageRoot;
|
|
1013
|
+
afterVersion = candidateVersion;
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
const failedVerifyOrSwap = steps.find((step) => (step.name === "global install verify" || step.name === "global install swap") && step.exitCode !== 0);
|
|
1017
|
+
const postVerifyStep = failedVerifyOrSwap ? null : verifiedPackageRoot ? await params.postVerifyStep?.(verifiedPackageRoot) : null;
|
|
1018
|
+
if (postVerifyStep) steps.push(postVerifyStep);
|
|
1019
|
+
if (failedVerifyOrSwap && stagedInstall) afterVersion = await readPackageVersionIfPresent(livePackageRoot);
|
|
1020
|
+
}
|
|
1021
|
+
const failedStep = finalInstallStep.exitCode !== 0 ? finalInstallStep : steps.find((step) => step !== updateStep && step.exitCode !== 0) ?? null;
|
|
1022
|
+
return {
|
|
1023
|
+
steps,
|
|
1024
|
+
verifiedPackageRoot,
|
|
1025
|
+
afterVersion,
|
|
1026
|
+
failedStep
|
|
1027
|
+
};
|
|
1028
|
+
} finally {
|
|
1029
|
+
await cleanupStagedNpmInstall(stagedInstall);
|
|
1030
|
+
if (packedInstallDir) await removePathBestEffort(packedInstallDir);
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
//#endregion
|
|
1034
|
+
//#region src/infra/update-package-manager.ts
|
|
1035
|
+
const PNPM_NPM_FALLBACK_SPEC = "pnpm@11";
|
|
1036
|
+
async function detectBuildManager(root) {
|
|
1037
|
+
return await detectPackageManager(root) ?? "npm";
|
|
1038
|
+
}
|
|
1039
|
+
function managerPreferenceOrder(preferred) {
|
|
1040
|
+
if (preferred === "pnpm") return [
|
|
1041
|
+
"pnpm",
|
|
1042
|
+
"npm",
|
|
1043
|
+
"bun"
|
|
1044
|
+
];
|
|
1045
|
+
if (preferred === "bun") return [
|
|
1046
|
+
"bun",
|
|
1047
|
+
"npm",
|
|
1048
|
+
"pnpm"
|
|
1049
|
+
];
|
|
1050
|
+
return [
|
|
1051
|
+
"npm",
|
|
1052
|
+
"pnpm",
|
|
1053
|
+
"bun"
|
|
1054
|
+
];
|
|
1055
|
+
}
|
|
1056
|
+
function managerVersionArgs(manager) {
|
|
1057
|
+
if (manager === "pnpm") return ["pnpm", "--version"];
|
|
1058
|
+
if (manager === "bun") return ["bun", "--version"];
|
|
1059
|
+
return ["npm", "--version"];
|
|
1060
|
+
}
|
|
1061
|
+
async function isManagerAvailable(runCommand, manager, timeoutMs, env) {
|
|
1062
|
+
try {
|
|
1063
|
+
return (await runCommand(managerVersionArgs(manager), {
|
|
1064
|
+
timeoutMs,
|
|
1065
|
+
env
|
|
1066
|
+
})).code === 0;
|
|
1067
|
+
} catch {
|
|
1068
|
+
return false;
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
async function isCommandAvailable(runCommand, argv, timeoutMs, env) {
|
|
1072
|
+
try {
|
|
1073
|
+
return (await runCommand(argv, {
|
|
1074
|
+
timeoutMs,
|
|
1075
|
+
env
|
|
1076
|
+
})).code === 0;
|
|
1077
|
+
} catch {
|
|
1078
|
+
return false;
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
function cloneCommandEnv(env) {
|
|
1082
|
+
return Object.fromEntries(Object.entries(env ?? process.env).filter(([, value]) => value != null).map(([key, value]) => [key, String(value)]));
|
|
1083
|
+
}
|
|
1084
|
+
async function enablePnpmViaCorepack(runCommand, timeoutMs, env) {
|
|
1085
|
+
if (!await isCommandAvailable(runCommand, ["corepack", "--version"], timeoutMs, env)) return "missing";
|
|
1086
|
+
try {
|
|
1087
|
+
if ((await runCommand(["corepack", "enable"], {
|
|
1088
|
+
timeoutMs,
|
|
1089
|
+
env
|
|
1090
|
+
})).code !== 0) return "failed";
|
|
1091
|
+
} catch {
|
|
1092
|
+
return "failed";
|
|
1093
|
+
}
|
|
1094
|
+
return await isManagerAvailable(runCommand, "pnpm", timeoutMs, env) ? "enabled" : "failed";
|
|
1095
|
+
}
|
|
1096
|
+
async function bootstrapPnpmViaNpm(params) {
|
|
1097
|
+
const tempRoot = await fs$1.mkdtemp(path.join(os.tmpdir(), "daocore-update-pnpm-"));
|
|
1098
|
+
const cleanup = async () => {
|
|
1099
|
+
await fs$1.rm(tempRoot, {
|
|
1100
|
+
recursive: true,
|
|
1101
|
+
force: true
|
|
1102
|
+
}).catch(() => {});
|
|
1103
|
+
};
|
|
1104
|
+
try {
|
|
1105
|
+
if ((await params.runCommand([
|
|
1106
|
+
"npm",
|
|
1107
|
+
"install",
|
|
1108
|
+
"--prefix",
|
|
1109
|
+
tempRoot,
|
|
1110
|
+
PNPM_NPM_FALLBACK_SPEC
|
|
1111
|
+
], {
|
|
1112
|
+
timeoutMs: params.timeoutMs,
|
|
1113
|
+
env: params.baseEnv
|
|
1114
|
+
})).code !== 0) {
|
|
1115
|
+
await cleanup();
|
|
1116
|
+
return null;
|
|
1117
|
+
}
|
|
1118
|
+
const env = cloneCommandEnv(params.baseEnv);
|
|
1119
|
+
applyPathPrepend(env, [path.join(tempRoot, "node_modules", ".bin")]);
|
|
1120
|
+
if (!await isManagerAvailable(params.runCommand, "pnpm", params.timeoutMs, env)) {
|
|
1121
|
+
await cleanup();
|
|
1122
|
+
return null;
|
|
1123
|
+
}
|
|
1124
|
+
return {
|
|
1125
|
+
env,
|
|
1126
|
+
cleanup
|
|
1127
|
+
};
|
|
1128
|
+
} catch {
|
|
1129
|
+
await cleanup();
|
|
1130
|
+
return null;
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
async function resolveUpdateBuildManager(runCommand, root, timeoutMs, baseEnv, requirement = "allow-fallback") {
|
|
1134
|
+
const preferred = await detectBuildManager(root);
|
|
1135
|
+
if (preferred === "pnpm") {
|
|
1136
|
+
if (await isManagerAvailable(runCommand, "pnpm", timeoutMs, baseEnv)) return {
|
|
1137
|
+
kind: "resolved",
|
|
1138
|
+
manager: "pnpm",
|
|
1139
|
+
preferred,
|
|
1140
|
+
fallback: false
|
|
1141
|
+
};
|
|
1142
|
+
const corepackStatus = await enablePnpmViaCorepack(runCommand, timeoutMs, baseEnv);
|
|
1143
|
+
if (corepackStatus === "enabled") return {
|
|
1144
|
+
kind: "resolved",
|
|
1145
|
+
manager: "pnpm",
|
|
1146
|
+
preferred,
|
|
1147
|
+
fallback: false
|
|
1148
|
+
};
|
|
1149
|
+
if (await isManagerAvailable(runCommand, "npm", timeoutMs, baseEnv)) {
|
|
1150
|
+
const pnpmBootstrap = await bootstrapPnpmViaNpm({
|
|
1151
|
+
runCommand,
|
|
1152
|
+
timeoutMs,
|
|
1153
|
+
baseEnv
|
|
1154
|
+
});
|
|
1155
|
+
if (pnpmBootstrap) return {
|
|
1156
|
+
kind: "resolved",
|
|
1157
|
+
manager: "pnpm",
|
|
1158
|
+
preferred,
|
|
1159
|
+
fallback: false,
|
|
1160
|
+
env: pnpmBootstrap.env,
|
|
1161
|
+
cleanup: pnpmBootstrap.cleanup
|
|
1162
|
+
};
|
|
1163
|
+
if (requirement === "require-preferred") return {
|
|
1164
|
+
kind: "missing-required",
|
|
1165
|
+
preferred,
|
|
1166
|
+
reason: "pnpm-npm-bootstrap-failed"
|
|
1167
|
+
};
|
|
1168
|
+
}
|
|
1169
|
+
if (requirement === "require-preferred") {
|
|
1170
|
+
if (corepackStatus === "missing") return {
|
|
1171
|
+
kind: "missing-required",
|
|
1172
|
+
preferred,
|
|
1173
|
+
reason: "pnpm-corepack-missing"
|
|
1174
|
+
};
|
|
1175
|
+
if (corepackStatus === "failed") return {
|
|
1176
|
+
kind: "missing-required",
|
|
1177
|
+
preferred,
|
|
1178
|
+
reason: "pnpm-corepack-enable-failed"
|
|
1179
|
+
};
|
|
1180
|
+
return {
|
|
1181
|
+
kind: "missing-required",
|
|
1182
|
+
preferred,
|
|
1183
|
+
reason: "preferred-manager-unavailable"
|
|
1184
|
+
};
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
for (const manager of managerPreferenceOrder(preferred)) if (await isManagerAvailable(runCommand, manager, timeoutMs, baseEnv)) return {
|
|
1188
|
+
kind: "resolved",
|
|
1189
|
+
manager,
|
|
1190
|
+
preferred,
|
|
1191
|
+
fallback: manager !== preferred
|
|
1192
|
+
};
|
|
1193
|
+
if (requirement === "require-preferred") return {
|
|
1194
|
+
kind: "missing-required",
|
|
1195
|
+
preferred,
|
|
1196
|
+
reason: "preferred-manager-unavailable"
|
|
1197
|
+
};
|
|
1198
|
+
return {
|
|
1199
|
+
kind: "resolved",
|
|
1200
|
+
manager: "npm",
|
|
1201
|
+
preferred,
|
|
1202
|
+
fallback: preferred !== "npm"
|
|
1203
|
+
};
|
|
1204
|
+
}
|
|
1205
|
+
function managerScriptArgs(manager, script, args = []) {
|
|
1206
|
+
if (manager === "pnpm") return [
|
|
1207
|
+
"pnpm",
|
|
1208
|
+
script,
|
|
1209
|
+
...args
|
|
1210
|
+
];
|
|
1211
|
+
if (manager === "bun") return [
|
|
1212
|
+
"bun",
|
|
1213
|
+
"run",
|
|
1214
|
+
script,
|
|
1215
|
+
...args
|
|
1216
|
+
];
|
|
1217
|
+
if (args.length > 0) return [
|
|
1218
|
+
"npm",
|
|
1219
|
+
"run",
|
|
1220
|
+
script,
|
|
1221
|
+
"--",
|
|
1222
|
+
...args
|
|
1223
|
+
];
|
|
1224
|
+
return [
|
|
1225
|
+
"npm",
|
|
1226
|
+
"run",
|
|
1227
|
+
script
|
|
1228
|
+
];
|
|
1229
|
+
}
|
|
1230
|
+
function managerInstallArgs(manager, opts) {
|
|
1231
|
+
if (manager === "pnpm") return ["pnpm", "install"];
|
|
1232
|
+
if (manager === "bun") return ["bun", "install"];
|
|
1233
|
+
if (opts?.compatFallback) return [
|
|
1234
|
+
"npm",
|
|
1235
|
+
"install",
|
|
1236
|
+
"--no-package-lock",
|
|
1237
|
+
"--legacy-peer-deps"
|
|
1238
|
+
];
|
|
1239
|
+
return ["npm", "install"];
|
|
1240
|
+
}
|
|
1241
|
+
function managerInstallIgnoreScriptsArgs(manager) {
|
|
1242
|
+
if (manager === "pnpm") return [
|
|
1243
|
+
"pnpm",
|
|
1244
|
+
"install",
|
|
1245
|
+
"--ignore-scripts"
|
|
1246
|
+
];
|
|
1247
|
+
if (manager === "bun") return [
|
|
1248
|
+
"bun",
|
|
1249
|
+
"install",
|
|
1250
|
+
"--ignore-scripts"
|
|
1251
|
+
];
|
|
1252
|
+
return [
|
|
1253
|
+
"npm",
|
|
1254
|
+
"install",
|
|
1255
|
+
"--ignore-scripts"
|
|
1256
|
+
];
|
|
1257
|
+
}
|
|
1258
|
+
//#endregion
|
|
1259
|
+
//#region src/infra/update-runner.ts
|
|
1260
|
+
function mapManagerResolutionFailure(reason) {
|
|
1261
|
+
return reason;
|
|
1262
|
+
}
|
|
1263
|
+
const DEFAULT_TIMEOUT_MS = 20 * 6e4;
|
|
1264
|
+
const MAX_LOG_CHARS = 8e3;
|
|
1265
|
+
const PREFLIGHT_MAX_COMMITS = 10;
|
|
1266
|
+
const DEFAULT_PACKAGE_NAME = "@gaodefa/daocore";
|
|
1267
|
+
const CORE_PACKAGE_NAMES = new Set([DEFAULT_PACKAGE_NAME]);
|
|
1268
|
+
const UPDATE_DEFER_CONFIGURED_PLUGIN_INSTALL_REPAIR_ENV = "DAOCORE_UPDATE_DEFER_CONFIGURED_PLUGIN_INSTALL_REPAIR";
|
|
1269
|
+
const UPDATE_PARENT_SUPPORTS_DOCTOR_CONFIG_WRITE_ENV = "DAOCORE_UPDATE_PARENT_SUPPORTS_DOCTOR_CONFIG_WRITE";
|
|
1270
|
+
const PREFLIGHT_TEMP_PREFIX = process.platform === "win32" ? "ocu-pf-" : "daocore-update-preflight-";
|
|
1271
|
+
const PREFLIGHT_WORKTREE_DIRNAME = process.platform === "win32" ? "wt" : "worktree";
|
|
1272
|
+
const PREFLIGHT_CLEANUP_TIMEOUT_MS = 6e4;
|
|
1273
|
+
const WINDOWS_PREFLIGHT_BASE_DIR = "ocu";
|
|
1274
|
+
const BUILD_MAX_OLD_SPACE_MB = 8192;
|
|
1275
|
+
const DEV_PREFLIGHT_LINT_ENV = {
|
|
1276
|
+
DAOCORE_LOCAL_CHECK: "1",
|
|
1277
|
+
DAOCORE_LOCAL_CHECK_MODE: "throttled",
|
|
1278
|
+
DAOCORE_OXLINT_SHARDS_SERIAL: "1"
|
|
1279
|
+
};
|
|
1280
|
+
const DEV_PREFLIGHT_LINT_OPT_IN_ENV = "DAOCORE_UPDATE_PREFLIGHT_LINT";
|
|
1281
|
+
function normalizeDir(value) {
|
|
1282
|
+
if (!value) return null;
|
|
1283
|
+
const trimmed = value.trim();
|
|
1284
|
+
if (!trimmed) return null;
|
|
1285
|
+
return path.resolve(trimmed);
|
|
1286
|
+
}
|
|
1287
|
+
function resolveNodeModulesBinPackageRoot(argv1) {
|
|
1288
|
+
const normalized = path.resolve(argv1);
|
|
1289
|
+
const parts = normalized.split(path.sep);
|
|
1290
|
+
const binIndex = parts.lastIndexOf(".bin");
|
|
1291
|
+
if (binIndex <= 0) return null;
|
|
1292
|
+
if (parts[binIndex - 1] !== "node_modules") return null;
|
|
1293
|
+
const binName = path.basename(normalized);
|
|
1294
|
+
const nodeModulesDir = parts.slice(0, binIndex).join(path.sep);
|
|
1295
|
+
return path.join(nodeModulesDir, binName);
|
|
1296
|
+
}
|
|
1297
|
+
function buildStartDirs(opts) {
|
|
1298
|
+
const dirs = [];
|
|
1299
|
+
const cwd = normalizeDir(opts.cwd);
|
|
1300
|
+
if (cwd) dirs.push(cwd);
|
|
1301
|
+
const argv1 = normalizeDir(opts.argv1);
|
|
1302
|
+
if (argv1) {
|
|
1303
|
+
dirs.push(path.dirname(argv1));
|
|
1304
|
+
const packageRoot = resolveNodeModulesBinPackageRoot(argv1);
|
|
1305
|
+
if (packageRoot) dirs.push(packageRoot);
|
|
1306
|
+
}
|
|
1307
|
+
let proc = null;
|
|
1308
|
+
try {
|
|
1309
|
+
proc = normalizeDir(process.cwd());
|
|
1310
|
+
} catch {
|
|
1311
|
+
proc = null;
|
|
1312
|
+
}
|
|
1313
|
+
if (proc) dirs.push(proc);
|
|
1314
|
+
return Array.from(new Set(dirs));
|
|
1315
|
+
}
|
|
1316
|
+
function resolvePreflightTempRootPrefix() {
|
|
1317
|
+
return path.join(os.tmpdir(), PREFLIGHT_TEMP_PREFIX);
|
|
1318
|
+
}
|
|
1319
|
+
function resolvePreflightWorktreeDir(preflightRoot) {
|
|
1320
|
+
return path.join(preflightRoot, PREFLIGHT_WORKTREE_DIRNAME);
|
|
1321
|
+
}
|
|
1322
|
+
function shouldUseNativeWindowsTempRoot() {
|
|
1323
|
+
return process.platform === "win32" && path.sep === "\\";
|
|
1324
|
+
}
|
|
1325
|
+
async function createPreflightRoot() {
|
|
1326
|
+
if (shouldUseNativeWindowsTempRoot()) {
|
|
1327
|
+
const baseDir = path.win32.join(process.env.SystemDrive ?? "C:", WINDOWS_PREFLIGHT_BASE_DIR);
|
|
1328
|
+
await fs$1.mkdir(baseDir, { recursive: true });
|
|
1329
|
+
return fs$1.mkdtemp(path.win32.join(baseDir, PREFLIGHT_TEMP_PREFIX));
|
|
1330
|
+
}
|
|
1331
|
+
return fs$1.mkdtemp(resolvePreflightTempRootPrefix());
|
|
1332
|
+
}
|
|
1333
|
+
async function removePathRecursive(target) {
|
|
1334
|
+
await fs$1.rm(target, {
|
|
1335
|
+
recursive: true,
|
|
1336
|
+
force: true,
|
|
1337
|
+
maxRetries: 3,
|
|
1338
|
+
retryDelay: 200
|
|
1339
|
+
}).catch(() => {});
|
|
1340
|
+
}
|
|
1341
|
+
async function repairPreflightCleanup(worktreeDir, preflightRoot) {
|
|
1342
|
+
try {
|
|
1343
|
+
await fs$1.rm(worktreeDir, {
|
|
1344
|
+
recursive: true,
|
|
1345
|
+
force: true,
|
|
1346
|
+
maxRetries: 3,
|
|
1347
|
+
retryDelay: 200
|
|
1348
|
+
});
|
|
1349
|
+
await fs$1.rm(preflightRoot, {
|
|
1350
|
+
recursive: true,
|
|
1351
|
+
force: true,
|
|
1352
|
+
maxRetries: 3,
|
|
1353
|
+
retryDelay: 200
|
|
1354
|
+
});
|
|
1355
|
+
return true;
|
|
1356
|
+
} catch {
|
|
1357
|
+
return false;
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
async function readBranchName(runCommand, root, timeoutMs) {
|
|
1361
|
+
const res = await runCommand([
|
|
1362
|
+
"git",
|
|
1363
|
+
"-C",
|
|
1364
|
+
root,
|
|
1365
|
+
"rev-parse",
|
|
1366
|
+
"--abbrev-ref",
|
|
1367
|
+
"HEAD"
|
|
1368
|
+
], { timeoutMs }).catch(() => null);
|
|
1369
|
+
if (!res || res.code !== 0) return null;
|
|
1370
|
+
return res.stdout.trim() || null;
|
|
1371
|
+
}
|
|
1372
|
+
async function listGitTags(runCommand, root, timeoutMs, pattern = "v*") {
|
|
1373
|
+
const res = await runCommand([
|
|
1374
|
+
"git",
|
|
1375
|
+
"-C",
|
|
1376
|
+
root,
|
|
1377
|
+
"tag",
|
|
1378
|
+
"--list",
|
|
1379
|
+
pattern,
|
|
1380
|
+
"--sort=-v:refname"
|
|
1381
|
+
], { timeoutMs }).catch(() => null);
|
|
1382
|
+
if (!res || res.code !== 0) return [];
|
|
1383
|
+
return res.stdout.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
1384
|
+
}
|
|
1385
|
+
async function resolveChannelTag(runCommand, root, timeoutMs, channel) {
|
|
1386
|
+
const tags = await listGitTags(runCommand, root, timeoutMs);
|
|
1387
|
+
if (channel === "beta") {
|
|
1388
|
+
const betaTag = tags.find((tag) => isBetaTag(tag)) ?? null;
|
|
1389
|
+
const stableTag = tags.find((tag) => isStableTag(tag)) ?? null;
|
|
1390
|
+
if (!betaTag) return stableTag;
|
|
1391
|
+
if (!stableTag) return betaTag;
|
|
1392
|
+
const cmp = compareSemverStrings(betaTag, stableTag);
|
|
1393
|
+
if (cmp != null && cmp < 0) return stableTag;
|
|
1394
|
+
return betaTag;
|
|
1395
|
+
}
|
|
1396
|
+
return tags.find((tag) => isStableTag(tag)) ?? null;
|
|
1397
|
+
}
|
|
1398
|
+
async function resolveGitRoot(runCommand, candidates, timeoutMs) {
|
|
1399
|
+
for (const dir of candidates) {
|
|
1400
|
+
const res = await runCommand([
|
|
1401
|
+
"git",
|
|
1402
|
+
"-C",
|
|
1403
|
+
dir,
|
|
1404
|
+
"rev-parse",
|
|
1405
|
+
"--show-toplevel"
|
|
1406
|
+
], { timeoutMs }).catch(() => null);
|
|
1407
|
+
if (!res) continue;
|
|
1408
|
+
if (res.code === 0) {
|
|
1409
|
+
const root = res.stdout.trim();
|
|
1410
|
+
if (root) return root;
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
return null;
|
|
1414
|
+
}
|
|
1415
|
+
async function findPackageRoot(candidates) {
|
|
1416
|
+
for (const dir of candidates) {
|
|
1417
|
+
let current = dir;
|
|
1418
|
+
for (let i = 0; i < 12; i += 1) {
|
|
1419
|
+
const pkgPath = path.join(current, "package.json");
|
|
1420
|
+
try {
|
|
1421
|
+
const raw = await fs$1.readFile(pkgPath, "utf-8");
|
|
1422
|
+
const name = JSON.parse(raw)?.name?.trim();
|
|
1423
|
+
if (name && CORE_PACKAGE_NAMES.has(name)) return current;
|
|
1424
|
+
} catch {}
|
|
1425
|
+
const parent = path.dirname(current);
|
|
1426
|
+
if (parent === current) break;
|
|
1427
|
+
current = parent;
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
return null;
|
|
1431
|
+
}
|
|
1432
|
+
async function runStep(opts) {
|
|
1433
|
+
const { runCommand, name, argv, cwd, timeoutMs, env, progress, stepIndex, totalSteps } = opts;
|
|
1434
|
+
const command = argv.join(" ");
|
|
1435
|
+
const stepInfo = {
|
|
1436
|
+
name,
|
|
1437
|
+
command,
|
|
1438
|
+
index: stepIndex,
|
|
1439
|
+
total: totalSteps
|
|
1440
|
+
};
|
|
1441
|
+
progress?.onStepStart?.(stepInfo);
|
|
1442
|
+
const started = Date.now();
|
|
1443
|
+
const result = await runCommand(argv, {
|
|
1444
|
+
cwd,
|
|
1445
|
+
timeoutMs,
|
|
1446
|
+
env
|
|
1447
|
+
});
|
|
1448
|
+
const durationMs = Date.now() - started;
|
|
1449
|
+
const stderrTail = trimLogTail(result.stderr, MAX_LOG_CHARS);
|
|
1450
|
+
progress?.onStepComplete?.({
|
|
1451
|
+
...stepInfo,
|
|
1452
|
+
durationMs,
|
|
1453
|
+
exitCode: result.code,
|
|
1454
|
+
stderrTail
|
|
1455
|
+
});
|
|
1456
|
+
return {
|
|
1457
|
+
name,
|
|
1458
|
+
command,
|
|
1459
|
+
cwd,
|
|
1460
|
+
durationMs,
|
|
1461
|
+
exitCode: result.code,
|
|
1462
|
+
stdoutTail: trimLogTail(result.stdout, MAX_LOG_CHARS),
|
|
1463
|
+
stderrTail: trimLogTail(result.stderr, MAX_LOG_CHARS)
|
|
1464
|
+
};
|
|
1465
|
+
}
|
|
1466
|
+
function normalizeTag(tag) {
|
|
1467
|
+
return normalizePackageTagInput(tag, ["@gaodefa/daocore", DEFAULT_PACKAGE_NAME]) ?? "latest";
|
|
1468
|
+
}
|
|
1469
|
+
function normalizeDevTargetRef(value) {
|
|
1470
|
+
const trimmed = value?.trim();
|
|
1471
|
+
return trimmed ? trimmed : null;
|
|
1472
|
+
}
|
|
1473
|
+
function looksLikeFullCommitSha(value) {
|
|
1474
|
+
return /^[0-9a-f]{40}$/i.test(value.trim());
|
|
1475
|
+
}
|
|
1476
|
+
function buildDevTargetRefResolutionCandidates(devTargetRef) {
|
|
1477
|
+
const trimmed = devTargetRef.trim();
|
|
1478
|
+
const candidates = [];
|
|
1479
|
+
const addCandidate = (candidate) => {
|
|
1480
|
+
if (!candidate || candidates.includes(candidate)) return;
|
|
1481
|
+
candidates.push(candidate);
|
|
1482
|
+
};
|
|
1483
|
+
if (looksLikeFullCommitSha(trimmed)) {
|
|
1484
|
+
addCandidate(trimmed);
|
|
1485
|
+
return candidates;
|
|
1486
|
+
}
|
|
1487
|
+
if (trimmed.startsWith("refs/remotes/")) {
|
|
1488
|
+
addCandidate(trimmed);
|
|
1489
|
+
return candidates;
|
|
1490
|
+
}
|
|
1491
|
+
if (trimmed.startsWith("refs/heads/")) {
|
|
1492
|
+
addCandidate(`refs/remotes/origin/${trimmed.slice(11)}`);
|
|
1493
|
+
return candidates;
|
|
1494
|
+
}
|
|
1495
|
+
if (trimmed.startsWith("origin/")) {
|
|
1496
|
+
addCandidate(`refs/remotes/${trimmed}`);
|
|
1497
|
+
return candidates;
|
|
1498
|
+
}
|
|
1499
|
+
if (trimmed.startsWith("refs/tags/")) {
|
|
1500
|
+
addCandidate(`${trimmed}^{}`);
|
|
1501
|
+
addCandidate(trimmed);
|
|
1502
|
+
return candidates;
|
|
1503
|
+
}
|
|
1504
|
+
addCandidate(`refs/remotes/origin/${trimmed}`);
|
|
1505
|
+
addCandidate(`refs/tags/${trimmed}^{}`);
|
|
1506
|
+
addCandidate(`refs/tags/${trimmed}`);
|
|
1507
|
+
return candidates;
|
|
1508
|
+
}
|
|
1509
|
+
async function resolveComparablePath(target) {
|
|
1510
|
+
return await fs$1.realpath(target).catch(() => path.resolve(target));
|
|
1511
|
+
}
|
|
1512
|
+
async function pathsReferToSameLocation(left, right) {
|
|
1513
|
+
return await resolveComparablePath(left) === await resolveComparablePath(right);
|
|
1514
|
+
}
|
|
1515
|
+
async function looksLikeGitCheckout(root) {
|
|
1516
|
+
try {
|
|
1517
|
+
await fs$1.access(path.join(root, ".git"));
|
|
1518
|
+
return true;
|
|
1519
|
+
} catch {
|
|
1520
|
+
return false;
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
function shouldRetryWindowsInstallIgnoringScripts(manager) {
|
|
1524
|
+
return process.platform === "win32" && manager === "pnpm";
|
|
1525
|
+
}
|
|
1526
|
+
function shouldPreferIgnoreScriptsForWindowsPreflight(manager) {
|
|
1527
|
+
return process.platform === "win32" && manager === "pnpm";
|
|
1528
|
+
}
|
|
1529
|
+
function resolveBuildNodeOptions(baseOptions) {
|
|
1530
|
+
const current = baseOptions?.trim() ?? "";
|
|
1531
|
+
const desired = `--max-old-space-size=${BUILD_MAX_OLD_SPACE_MB}`;
|
|
1532
|
+
const existingMatch = /(?:^|\s)--max-old-space-size=(\d+)(?=\s|$)/.exec(current);
|
|
1533
|
+
if (!existingMatch) return current ? `${current} ${desired}` : desired;
|
|
1534
|
+
const existingValue = Number(existingMatch[1]);
|
|
1535
|
+
if (Number.isFinite(existingValue) && existingValue >= BUILD_MAX_OLD_SPACE_MB) return current;
|
|
1536
|
+
return current.replace(/(?:^|\s)--max-old-space-size=\d+(?=\s|$)/, ` ${desired}`).trim();
|
|
1537
|
+
}
|
|
1538
|
+
function resolveBuildEnv(env) {
|
|
1539
|
+
const currentNodeOptions = env?.NODE_OPTIONS ?? process.env.NODE_OPTIONS;
|
|
1540
|
+
const nextNodeOptions = resolveBuildNodeOptions(currentNodeOptions);
|
|
1541
|
+
if (nextNodeOptions === currentNodeOptions) return env;
|
|
1542
|
+
return {
|
|
1543
|
+
...env,
|
|
1544
|
+
NODE_OPTIONS: nextNodeOptions
|
|
1545
|
+
};
|
|
1546
|
+
}
|
|
1547
|
+
function resolveInstallEnv(manager, env) {
|
|
1548
|
+
if (manager !== "pnpm") return env;
|
|
1549
|
+
return {
|
|
1550
|
+
...env,
|
|
1551
|
+
PNPM_CONFIG_RESOLUTION_MODE: env?.PNPM_CONFIG_RESOLUTION_MODE ?? "highest",
|
|
1552
|
+
npm_config_resolution_mode: env?.npm_config_resolution_mode ?? "highest",
|
|
1553
|
+
pnpm_config_resolution_mode: env?.pnpm_config_resolution_mode ?? "highest"
|
|
1554
|
+
};
|
|
1555
|
+
}
|
|
1556
|
+
function isSupersededInstallFailure(step, steps) {
|
|
1557
|
+
if (step.exitCode === 0) return false;
|
|
1558
|
+
if (step.name === "deps install") return steps.some((candidate) => candidate.name === "deps install (ignore scripts)" && candidate.exitCode === 0);
|
|
1559
|
+
const preflightMatch = /^preflight deps install \((.+)\)$/.exec(step.name);
|
|
1560
|
+
if (!preflightMatch) return false;
|
|
1561
|
+
const retryName = `preflight deps install (ignore scripts) (${preflightMatch[1]})`;
|
|
1562
|
+
return steps.some((candidate) => candidate.name === retryName && candidate.exitCode === 0);
|
|
1563
|
+
}
|
|
1564
|
+
function findBlockingGitFailure(steps) {
|
|
1565
|
+
return steps.find((step) => step.exitCode !== 0 && !isSupersededInstallFailure(step, steps));
|
|
1566
|
+
}
|
|
1567
|
+
function mergeCommandEnvironments(baseEnv, overrideEnv) {
|
|
1568
|
+
if (!baseEnv) return overrideEnv;
|
|
1569
|
+
if (!overrideEnv) return baseEnv;
|
|
1570
|
+
return {
|
|
1571
|
+
...baseEnv,
|
|
1572
|
+
...overrideEnv
|
|
1573
|
+
};
|
|
1574
|
+
}
|
|
1575
|
+
function shouldRunDevPreflightLint(env = process.env) {
|
|
1576
|
+
const value = env[DEV_PREFLIGHT_LINT_OPT_IN_ENV]?.trim().toLowerCase();
|
|
1577
|
+
return value === "1" || value === "true";
|
|
1578
|
+
}
|
|
1579
|
+
function resolveDevPreflightLintEnv(env) {
|
|
1580
|
+
return {
|
|
1581
|
+
...env,
|
|
1582
|
+
...DEV_PREFLIGHT_LINT_ENV
|
|
1583
|
+
};
|
|
1584
|
+
}
|
|
1585
|
+
function normalizeFallbackFailureReason(stepName) {
|
|
1586
|
+
switch (stepName) {
|
|
1587
|
+
case "global update":
|
|
1588
|
+
case "global update (omit optional)":
|
|
1589
|
+
case "global install stage":
|
|
1590
|
+
case "global install verify":
|
|
1591
|
+
case "global install swap": return "global-install-failed";
|
|
1592
|
+
case "daocore doctor": return "doctor-failed";
|
|
1593
|
+
case "ui:build (post-doctor repair)": return "ui-build-failed";
|
|
1594
|
+
default: return "unexpected-error";
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
async function buildUpdateCommandRunner(runCommand) {
|
|
1598
|
+
const defaultCommandEnv = await createGlobalInstallEnv();
|
|
1599
|
+
if (runCommand) return {
|
|
1600
|
+
defaultCommandEnv,
|
|
1601
|
+
runCommand
|
|
1602
|
+
};
|
|
1603
|
+
return {
|
|
1604
|
+
defaultCommandEnv,
|
|
1605
|
+
runCommand: async (argv, options) => {
|
|
1606
|
+
const res = await runCommandWithTimeout(argv, {
|
|
1607
|
+
...options,
|
|
1608
|
+
env: mergeCommandEnvironments(defaultCommandEnv, options.env)
|
|
1609
|
+
});
|
|
1610
|
+
return {
|
|
1611
|
+
stdout: res.stdout,
|
|
1612
|
+
stderr: res.stderr,
|
|
1613
|
+
code: res.code
|
|
1614
|
+
};
|
|
1615
|
+
}
|
|
1616
|
+
};
|
|
1617
|
+
}
|
|
1618
|
+
async function resolveUpdateInstallSurface(opts = {}) {
|
|
1619
|
+
const { runCommand } = await buildUpdateCommandRunner(opts.runCommand);
|
|
1620
|
+
const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1621
|
+
const candidates = buildStartDirs(opts);
|
|
1622
|
+
const pkgRoot = await findPackageRoot(candidates);
|
|
1623
|
+
let gitRoot = await resolveGitRoot(runCommand, candidates, timeoutMs);
|
|
1624
|
+
if (gitRoot && pkgRoot && path.resolve(gitRoot) !== path.resolve(pkgRoot)) gitRoot = null;
|
|
1625
|
+
if (gitRoot && !pkgRoot) return {
|
|
1626
|
+
kind: "missing",
|
|
1627
|
+
mode: "unknown",
|
|
1628
|
+
root: gitRoot
|
|
1629
|
+
};
|
|
1630
|
+
if (gitRoot && pkgRoot && path.resolve(gitRoot) === path.resolve(pkgRoot)) return {
|
|
1631
|
+
kind: "git",
|
|
1632
|
+
mode: "git",
|
|
1633
|
+
root: gitRoot,
|
|
1634
|
+
packageRoot: pkgRoot
|
|
1635
|
+
};
|
|
1636
|
+
if (!pkgRoot) return {
|
|
1637
|
+
kind: "missing",
|
|
1638
|
+
mode: "unknown"
|
|
1639
|
+
};
|
|
1640
|
+
const globalManager = await detectGlobalInstallManagerForRoot(runCommand, pkgRoot, timeoutMs);
|
|
1641
|
+
if (globalManager) return {
|
|
1642
|
+
kind: "global",
|
|
1643
|
+
mode: globalManager,
|
|
1644
|
+
root: pkgRoot,
|
|
1645
|
+
packageRoot: pkgRoot
|
|
1646
|
+
};
|
|
1647
|
+
return {
|
|
1648
|
+
kind: "package-root",
|
|
1649
|
+
mode: "unknown",
|
|
1650
|
+
root: pkgRoot,
|
|
1651
|
+
packageRoot: pkgRoot
|
|
1652
|
+
};
|
|
1653
|
+
}
|
|
1654
|
+
async function runGatewayUpdate(opts = {}) {
|
|
1655
|
+
const startedAt = Date.now();
|
|
1656
|
+
const { defaultCommandEnv, runCommand } = await buildUpdateCommandRunner(opts.runCommand);
|
|
1657
|
+
const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1658
|
+
const progress = opts.progress;
|
|
1659
|
+
const steps = [];
|
|
1660
|
+
const candidates = buildStartDirs(opts);
|
|
1661
|
+
let stepIndex = 0;
|
|
1662
|
+
let gitTotalSteps = 0;
|
|
1663
|
+
const step = (name, argv, cwd, env) => {
|
|
1664
|
+
const currentIndex = stepIndex;
|
|
1665
|
+
stepIndex += 1;
|
|
1666
|
+
return {
|
|
1667
|
+
runCommand,
|
|
1668
|
+
name,
|
|
1669
|
+
argv,
|
|
1670
|
+
cwd,
|
|
1671
|
+
timeoutMs,
|
|
1672
|
+
env,
|
|
1673
|
+
progress,
|
|
1674
|
+
stepIndex: currentIndex,
|
|
1675
|
+
totalSteps: gitTotalSteps
|
|
1676
|
+
};
|
|
1677
|
+
};
|
|
1678
|
+
const pkgRoot = await findPackageRoot(candidates);
|
|
1679
|
+
let gitRoot = await resolveGitRoot(runCommand, candidates, timeoutMs);
|
|
1680
|
+
if (!gitRoot && pkgRoot) {
|
|
1681
|
+
const cwdRoot = normalizeDir(opts.cwd);
|
|
1682
|
+
if (cwdRoot && await pathsReferToSameLocation(cwdRoot, pkgRoot) && await looksLikeGitCheckout(cwdRoot)) gitRoot = await resolveComparablePath(cwdRoot);
|
|
1683
|
+
}
|
|
1684
|
+
if (gitRoot && pkgRoot && !await pathsReferToSameLocation(gitRoot, pkgRoot)) gitRoot = null;
|
|
1685
|
+
if (gitRoot && !pkgRoot) return {
|
|
1686
|
+
status: "error",
|
|
1687
|
+
mode: "unknown",
|
|
1688
|
+
root: gitRoot,
|
|
1689
|
+
reason: "not-daocore-root",
|
|
1690
|
+
steps: [],
|
|
1691
|
+
durationMs: Date.now() - startedAt
|
|
1692
|
+
};
|
|
1693
|
+
if (gitRoot && pkgRoot && await pathsReferToSameLocation(gitRoot, pkgRoot)) {
|
|
1694
|
+
const beforeSha = (await runCommand([
|
|
1695
|
+
"git",
|
|
1696
|
+
"-C",
|
|
1697
|
+
gitRoot,
|
|
1698
|
+
"rev-parse",
|
|
1699
|
+
"HEAD"
|
|
1700
|
+
], {
|
|
1701
|
+
cwd: gitRoot,
|
|
1702
|
+
timeoutMs
|
|
1703
|
+
})).stdout.trim() || null;
|
|
1704
|
+
const beforeVersion = await readPackageVersion(gitRoot);
|
|
1705
|
+
const channel = opts.channel ?? "dev";
|
|
1706
|
+
const devTargetRef = channel === "dev" ? normalizeDevTargetRef(opts.devTargetRef) : null;
|
|
1707
|
+
const branch = await readBranchName(runCommand, gitRoot, timeoutMs);
|
|
1708
|
+
const needsCheckoutMain = channel === "dev" && !devTargetRef && branch !== "main";
|
|
1709
|
+
gitTotalSteps = channel === "dev" ? needsCheckoutMain ? 11 : 10 : 9;
|
|
1710
|
+
const buildGitErrorResult = (reason) => ({
|
|
1711
|
+
status: "error",
|
|
1712
|
+
mode: "git",
|
|
1713
|
+
root: gitRoot,
|
|
1714
|
+
reason,
|
|
1715
|
+
before: {
|
|
1716
|
+
sha: beforeSha,
|
|
1717
|
+
version: beforeVersion
|
|
1718
|
+
},
|
|
1719
|
+
steps,
|
|
1720
|
+
durationMs: Date.now() - startedAt
|
|
1721
|
+
});
|
|
1722
|
+
const runRequiredGitStep = async (name, argv, reason) => {
|
|
1723
|
+
const gitStep = await runStep(step(name, argv, gitRoot));
|
|
1724
|
+
steps.push(gitStep);
|
|
1725
|
+
if (gitStep.exitCode !== 0) return buildGitErrorResult(reason);
|
|
1726
|
+
return null;
|
|
1727
|
+
};
|
|
1728
|
+
const appendRecoveryStep = async (name, argv) => {
|
|
1729
|
+
const started = Date.now();
|
|
1730
|
+
const result = await runCommand(argv, {
|
|
1731
|
+
cwd: gitRoot,
|
|
1732
|
+
timeoutMs
|
|
1733
|
+
});
|
|
1734
|
+
const recoveryStep = {
|
|
1735
|
+
name,
|
|
1736
|
+
command: argv.join(" "),
|
|
1737
|
+
cwd: gitRoot,
|
|
1738
|
+
durationMs: Date.now() - started,
|
|
1739
|
+
exitCode: result.code,
|
|
1740
|
+
stdoutTail: trimLogTail(result.stdout, MAX_LOG_CHARS),
|
|
1741
|
+
stderrTail: trimLogTail(result.stderr, MAX_LOG_CHARS)
|
|
1742
|
+
};
|
|
1743
|
+
steps.push(recoveryStep);
|
|
1744
|
+
return recoveryStep.exitCode === 0;
|
|
1745
|
+
};
|
|
1746
|
+
const rollbackGitCheckout = async () => {
|
|
1747
|
+
if (!beforeSha) return;
|
|
1748
|
+
await appendRecoveryStep("git rollback clean", [
|
|
1749
|
+
"git",
|
|
1750
|
+
"-C",
|
|
1751
|
+
gitRoot,
|
|
1752
|
+
"reset",
|
|
1753
|
+
"--hard"
|
|
1754
|
+
]);
|
|
1755
|
+
if (branch && branch !== "HEAD") {
|
|
1756
|
+
if (await appendRecoveryStep("git rollback checkout", [
|
|
1757
|
+
"git",
|
|
1758
|
+
"-C",
|
|
1759
|
+
gitRoot,
|
|
1760
|
+
"checkout",
|
|
1761
|
+
"--force",
|
|
1762
|
+
branch
|
|
1763
|
+
])) await appendRecoveryStep("git rollback reset", [
|
|
1764
|
+
"git",
|
|
1765
|
+
"-C",
|
|
1766
|
+
gitRoot,
|
|
1767
|
+
"reset",
|
|
1768
|
+
"--hard",
|
|
1769
|
+
beforeSha
|
|
1770
|
+
]);
|
|
1771
|
+
return;
|
|
1772
|
+
}
|
|
1773
|
+
await appendRecoveryStep("git rollback checkout", [
|
|
1774
|
+
"git",
|
|
1775
|
+
"-C",
|
|
1776
|
+
gitRoot,
|
|
1777
|
+
"checkout",
|
|
1778
|
+
"--detach",
|
|
1779
|
+
beforeSha
|
|
1780
|
+
]);
|
|
1781
|
+
};
|
|
1782
|
+
const buildGitErrorResultWithRollback = async (reason) => {
|
|
1783
|
+
await rollbackGitCheckout();
|
|
1784
|
+
return buildGitErrorResult(reason);
|
|
1785
|
+
};
|
|
1786
|
+
const statusCheck = await runStep(step("clean check", [
|
|
1787
|
+
"git",
|
|
1788
|
+
"-C",
|
|
1789
|
+
gitRoot,
|
|
1790
|
+
"status",
|
|
1791
|
+
"--porcelain",
|
|
1792
|
+
"--",
|
|
1793
|
+
":!dist/control-ui/"
|
|
1794
|
+
], gitRoot));
|
|
1795
|
+
steps.push(statusCheck);
|
|
1796
|
+
if (statusCheck.stdoutTail && statusCheck.stdoutTail.trim().length > 0) return {
|
|
1797
|
+
status: "skipped",
|
|
1798
|
+
mode: "git",
|
|
1799
|
+
root: gitRoot,
|
|
1800
|
+
reason: "dirty",
|
|
1801
|
+
before: {
|
|
1802
|
+
sha: beforeSha,
|
|
1803
|
+
version: beforeVersion
|
|
1804
|
+
},
|
|
1805
|
+
steps,
|
|
1806
|
+
durationMs: Date.now() - startedAt
|
|
1807
|
+
};
|
|
1808
|
+
if (channel === "dev") {
|
|
1809
|
+
if (needsCheckoutMain) {
|
|
1810
|
+
const failure = await runRequiredGitStep(`git checkout ${DEV_BRANCH}`, [
|
|
1811
|
+
"git",
|
|
1812
|
+
"-C",
|
|
1813
|
+
gitRoot,
|
|
1814
|
+
"checkout",
|
|
1815
|
+
DEV_BRANCH
|
|
1816
|
+
], "checkout-failed");
|
|
1817
|
+
if (failure) return failure;
|
|
1818
|
+
}
|
|
1819
|
+
const fetchFailure = await runRequiredGitStep("git fetch", [
|
|
1820
|
+
"git",
|
|
1821
|
+
"-C",
|
|
1822
|
+
gitRoot,
|
|
1823
|
+
"fetch",
|
|
1824
|
+
"--all",
|
|
1825
|
+
"--prune",
|
|
1826
|
+
"--tags"
|
|
1827
|
+
], "fetch-failed");
|
|
1828
|
+
if (fetchFailure) return fetchFailure;
|
|
1829
|
+
let preflightBaseSha = null;
|
|
1830
|
+
let candidates = [];
|
|
1831
|
+
if (devTargetRef) {
|
|
1832
|
+
let targetSha = null;
|
|
1833
|
+
for (const targetRefCandidate of buildDevTargetRefResolutionCandidates(devTargetRef)) {
|
|
1834
|
+
const targetShaStep = await runStep(step(`git rev-parse ${targetRefCandidate}`, [
|
|
1835
|
+
"git",
|
|
1836
|
+
"-C",
|
|
1837
|
+
gitRoot,
|
|
1838
|
+
"rev-parse",
|
|
1839
|
+
targetRefCandidate
|
|
1840
|
+
], gitRoot));
|
|
1841
|
+
steps.push(targetShaStep);
|
|
1842
|
+
const resolvedTargetSha = targetShaStep.stdoutTail?.trim();
|
|
1843
|
+
if (targetShaStep.exitCode === 0 && resolvedTargetSha) {
|
|
1844
|
+
targetSha = resolvedTargetSha;
|
|
1845
|
+
break;
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
if (!targetSha) return {
|
|
1849
|
+
status: "error",
|
|
1850
|
+
mode: "git",
|
|
1851
|
+
root: gitRoot,
|
|
1852
|
+
reason: "no-target-sha",
|
|
1853
|
+
before: {
|
|
1854
|
+
sha: beforeSha,
|
|
1855
|
+
version: beforeVersion
|
|
1856
|
+
},
|
|
1857
|
+
steps,
|
|
1858
|
+
durationMs: Date.now() - startedAt
|
|
1859
|
+
};
|
|
1860
|
+
preflightBaseSha = targetSha;
|
|
1861
|
+
candidates = [targetSha];
|
|
1862
|
+
} else {
|
|
1863
|
+
const upstreamStep = await runStep(step("upstream check", [
|
|
1864
|
+
"git",
|
|
1865
|
+
"-C",
|
|
1866
|
+
gitRoot,
|
|
1867
|
+
"rev-parse",
|
|
1868
|
+
"--abbrev-ref",
|
|
1869
|
+
"--symbolic-full-name",
|
|
1870
|
+
"@{upstream}"
|
|
1871
|
+
], gitRoot));
|
|
1872
|
+
steps.push(upstreamStep);
|
|
1873
|
+
if (upstreamStep.exitCode !== 0) return {
|
|
1874
|
+
status: "skipped",
|
|
1875
|
+
mode: "git",
|
|
1876
|
+
root: gitRoot,
|
|
1877
|
+
reason: "no-upstream",
|
|
1878
|
+
before: {
|
|
1879
|
+
sha: beforeSha,
|
|
1880
|
+
version: beforeVersion
|
|
1881
|
+
},
|
|
1882
|
+
steps,
|
|
1883
|
+
durationMs: Date.now() - startedAt
|
|
1884
|
+
};
|
|
1885
|
+
const upstreamShaStep = await runStep(step("git rev-parse @{upstream}", [
|
|
1886
|
+
"git",
|
|
1887
|
+
"-C",
|
|
1888
|
+
gitRoot,
|
|
1889
|
+
"rev-parse",
|
|
1890
|
+
"@{upstream}"
|
|
1891
|
+
], gitRoot));
|
|
1892
|
+
steps.push(upstreamShaStep);
|
|
1893
|
+
const upstreamSha = upstreamShaStep.stdoutTail?.trim();
|
|
1894
|
+
if (!upstreamShaStep.stdoutTail || !upstreamSha) return {
|
|
1895
|
+
status: "error",
|
|
1896
|
+
mode: "git",
|
|
1897
|
+
root: gitRoot,
|
|
1898
|
+
reason: "no-upstream-sha",
|
|
1899
|
+
before: {
|
|
1900
|
+
sha: beforeSha,
|
|
1901
|
+
version: beforeVersion
|
|
1902
|
+
},
|
|
1903
|
+
steps,
|
|
1904
|
+
durationMs: Date.now() - startedAt
|
|
1905
|
+
};
|
|
1906
|
+
const revListStep = await runStep(step("git rev-list", [
|
|
1907
|
+
"git",
|
|
1908
|
+
"-C",
|
|
1909
|
+
gitRoot,
|
|
1910
|
+
"rev-list",
|
|
1911
|
+
`--max-count=${PREFLIGHT_MAX_COMMITS}`,
|
|
1912
|
+
upstreamSha
|
|
1913
|
+
], gitRoot));
|
|
1914
|
+
steps.push(revListStep);
|
|
1915
|
+
if (revListStep.exitCode !== 0) return {
|
|
1916
|
+
status: "error",
|
|
1917
|
+
mode: "git",
|
|
1918
|
+
root: gitRoot,
|
|
1919
|
+
reason: "preflight-revlist-failed",
|
|
1920
|
+
before: {
|
|
1921
|
+
sha: beforeSha,
|
|
1922
|
+
version: beforeVersion
|
|
1923
|
+
},
|
|
1924
|
+
steps,
|
|
1925
|
+
durationMs: Date.now() - startedAt
|
|
1926
|
+
};
|
|
1927
|
+
candidates = (revListStep.stdoutTail ?? "").split("\n").map((line) => line.trim()).filter(Boolean);
|
|
1928
|
+
if (candidates.length === 0) return {
|
|
1929
|
+
status: "error",
|
|
1930
|
+
mode: "git",
|
|
1931
|
+
root: gitRoot,
|
|
1932
|
+
reason: "preflight-no-candidates",
|
|
1933
|
+
before: {
|
|
1934
|
+
sha: beforeSha,
|
|
1935
|
+
version: beforeVersion
|
|
1936
|
+
},
|
|
1937
|
+
steps,
|
|
1938
|
+
durationMs: Date.now() - startedAt
|
|
1939
|
+
};
|
|
1940
|
+
preflightBaseSha = upstreamSha;
|
|
1941
|
+
}
|
|
1942
|
+
if (!preflightBaseSha) return {
|
|
1943
|
+
status: "error",
|
|
1944
|
+
mode: "git",
|
|
1945
|
+
root: gitRoot,
|
|
1946
|
+
reason: "preflight-base-missing",
|
|
1947
|
+
before: {
|
|
1948
|
+
sha: beforeSha,
|
|
1949
|
+
version: beforeVersion
|
|
1950
|
+
},
|
|
1951
|
+
steps,
|
|
1952
|
+
durationMs: Date.now() - startedAt
|
|
1953
|
+
};
|
|
1954
|
+
const manager = await resolveUpdateBuildManager((argv, options) => runCommand(argv, {
|
|
1955
|
+
timeoutMs: options.timeoutMs,
|
|
1956
|
+
env: options.env
|
|
1957
|
+
}), gitRoot, timeoutMs, defaultCommandEnv, "require-preferred");
|
|
1958
|
+
if (manager.kind === "missing-required") return {
|
|
1959
|
+
status: "error",
|
|
1960
|
+
mode: "git",
|
|
1961
|
+
root: gitRoot,
|
|
1962
|
+
reason: mapManagerResolutionFailure(manager.reason),
|
|
1963
|
+
before: {
|
|
1964
|
+
sha: beforeSha,
|
|
1965
|
+
version: beforeVersion
|
|
1966
|
+
},
|
|
1967
|
+
steps,
|
|
1968
|
+
durationMs: Date.now() - startedAt
|
|
1969
|
+
};
|
|
1970
|
+
const preflightRoot = await createPreflightRoot();
|
|
1971
|
+
const worktreeDir = resolvePreflightWorktreeDir(preflightRoot);
|
|
1972
|
+
const worktreeStep = await runStep(step("preflight worktree", [
|
|
1973
|
+
"git",
|
|
1974
|
+
"-C",
|
|
1975
|
+
gitRoot,
|
|
1976
|
+
"worktree",
|
|
1977
|
+
"add",
|
|
1978
|
+
"--detach",
|
|
1979
|
+
worktreeDir,
|
|
1980
|
+
preflightBaseSha
|
|
1981
|
+
], gitRoot));
|
|
1982
|
+
steps.push(worktreeStep);
|
|
1983
|
+
if (worktreeStep.exitCode !== 0) {
|
|
1984
|
+
await removePathRecursive(preflightRoot);
|
|
1985
|
+
return {
|
|
1986
|
+
status: "error",
|
|
1987
|
+
mode: "git",
|
|
1988
|
+
root: gitRoot,
|
|
1989
|
+
reason: "preflight-worktree-failed",
|
|
1990
|
+
before: {
|
|
1991
|
+
sha: beforeSha,
|
|
1992
|
+
version: beforeVersion
|
|
1993
|
+
},
|
|
1994
|
+
steps,
|
|
1995
|
+
durationMs: Date.now() - startedAt
|
|
1996
|
+
};
|
|
1997
|
+
}
|
|
1998
|
+
let selectedSha = null;
|
|
1999
|
+
try {
|
|
2000
|
+
for (const sha of candidates) {
|
|
2001
|
+
const shortSha = sha.slice(0, 8);
|
|
2002
|
+
const checkoutStep = await runStep(step(`preflight checkout (${shortSha})`, [
|
|
2003
|
+
"git",
|
|
2004
|
+
"-C",
|
|
2005
|
+
worktreeDir,
|
|
2006
|
+
"checkout",
|
|
2007
|
+
"--detach",
|
|
2008
|
+
sha
|
|
2009
|
+
], worktreeDir));
|
|
2010
|
+
steps.push(checkoutStep);
|
|
2011
|
+
if (checkoutStep.exitCode !== 0) continue;
|
|
2012
|
+
const preflightIgnoreScripts = shouldPreferIgnoreScriptsForWindowsPreflight(manager.manager);
|
|
2013
|
+
const preflightIgnoreScriptsArgv = managerInstallIgnoreScriptsArgs(manager.manager);
|
|
2014
|
+
const depsStepArgv = preflightIgnoreScripts && preflightIgnoreScriptsArgv ? preflightIgnoreScriptsArgv : managerInstallArgs(manager.manager, { compatFallback: manager.fallback && manager.manager === "npm" });
|
|
2015
|
+
const depsStepName = preflightIgnoreScripts ? `preflight deps install (ignore scripts) (${shortSha})` : `preflight deps install (${shortSha})`;
|
|
2016
|
+
const installEnv = resolveInstallEnv(manager.manager, manager.env);
|
|
2017
|
+
const depsStep = await runStep(step(depsStepName, depsStepArgv, worktreeDir, installEnv));
|
|
2018
|
+
steps.push(depsStep);
|
|
2019
|
+
let finalDepsStep = depsStep;
|
|
2020
|
+
if (depsStep.exitCode !== 0 && !preflightIgnoreScripts && shouldRetryWindowsInstallIgnoringScripts(manager.manager)) {
|
|
2021
|
+
const retryArgv = managerInstallIgnoreScriptsArgs(manager.manager);
|
|
2022
|
+
if (retryArgv) {
|
|
2023
|
+
const retryStep = await runStep(step(`preflight deps install (ignore scripts) (${shortSha})`, retryArgv, worktreeDir, installEnv));
|
|
2024
|
+
steps.push(retryStep);
|
|
2025
|
+
finalDepsStep = retryStep;
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
if (finalDepsStep.exitCode !== 0) continue;
|
|
2029
|
+
const buildStep = await runStep(step(`preflight build (${shortSha})`, managerScriptArgs(manager.manager, "build"), worktreeDir, resolveBuildEnv(manager.env)));
|
|
2030
|
+
steps.push(buildStep);
|
|
2031
|
+
if (buildStep.exitCode !== 0) continue;
|
|
2032
|
+
if (shouldRunDevPreflightLint()) {
|
|
2033
|
+
const lintStep = await runStep(step(`preflight lint (${shortSha})`, managerScriptArgs(manager.manager, "lint"), worktreeDir, resolveDevPreflightLintEnv(manager.env)));
|
|
2034
|
+
steps.push(lintStep);
|
|
2035
|
+
if (lintStep.exitCode !== 0) continue;
|
|
2036
|
+
}
|
|
2037
|
+
selectedSha = sha;
|
|
2038
|
+
break;
|
|
2039
|
+
}
|
|
2040
|
+
} finally {
|
|
2041
|
+
const removeStep = await runStep({
|
|
2042
|
+
...step("preflight cleanup", [
|
|
2043
|
+
"git",
|
|
2044
|
+
"-C",
|
|
2045
|
+
gitRoot,
|
|
2046
|
+
"worktree",
|
|
2047
|
+
"remove",
|
|
2048
|
+
"--force",
|
|
2049
|
+
worktreeDir
|
|
2050
|
+
], gitRoot),
|
|
2051
|
+
timeoutMs: Math.min(timeoutMs, PREFLIGHT_CLEANUP_TIMEOUT_MS)
|
|
2052
|
+
});
|
|
2053
|
+
if (removeStep.exitCode !== 0 && await repairPreflightCleanup(worktreeDir, preflightRoot)) {
|
|
2054
|
+
removeStep.exitCode = 0;
|
|
2055
|
+
const fallbackMessage = process.platform === "win32" ? "windows fallback cleanup removed preflight tree" : "fallback cleanup removed preflight tree";
|
|
2056
|
+
removeStep.stderrTail = trimLogTail([removeStep.stderrTail, fallbackMessage].filter(Boolean).join("\n"), MAX_LOG_CHARS);
|
|
2057
|
+
}
|
|
2058
|
+
steps.push(removeStep);
|
|
2059
|
+
await runCommand([
|
|
2060
|
+
"git",
|
|
2061
|
+
"-C",
|
|
2062
|
+
gitRoot,
|
|
2063
|
+
"worktree",
|
|
2064
|
+
"prune"
|
|
2065
|
+
], {
|
|
2066
|
+
cwd: gitRoot,
|
|
2067
|
+
timeoutMs
|
|
2068
|
+
}).catch(() => null);
|
|
2069
|
+
await removePathRecursive(preflightRoot);
|
|
2070
|
+
await manager.cleanup?.();
|
|
2071
|
+
}
|
|
2072
|
+
if (!selectedSha) return {
|
|
2073
|
+
status: "error",
|
|
2074
|
+
mode: "git",
|
|
2075
|
+
root: gitRoot,
|
|
2076
|
+
reason: "preflight-no-good-commit",
|
|
2077
|
+
before: {
|
|
2078
|
+
sha: beforeSha,
|
|
2079
|
+
version: beforeVersion
|
|
2080
|
+
},
|
|
2081
|
+
steps,
|
|
2082
|
+
durationMs: Date.now() - startedAt
|
|
2083
|
+
};
|
|
2084
|
+
if (devTargetRef) {
|
|
2085
|
+
const failure = await runRequiredGitStep(`git checkout ${selectedSha}`, [
|
|
2086
|
+
"git",
|
|
2087
|
+
"-C",
|
|
2088
|
+
gitRoot,
|
|
2089
|
+
"checkout",
|
|
2090
|
+
"--detach",
|
|
2091
|
+
selectedSha
|
|
2092
|
+
], "checkout-failed");
|
|
2093
|
+
if (failure) return failure;
|
|
2094
|
+
} else {
|
|
2095
|
+
const rebaseStep = await runStep(step("git rebase", [
|
|
2096
|
+
"git",
|
|
2097
|
+
"-C",
|
|
2098
|
+
gitRoot,
|
|
2099
|
+
"rebase",
|
|
2100
|
+
selectedSha
|
|
2101
|
+
], gitRoot));
|
|
2102
|
+
steps.push(rebaseStep);
|
|
2103
|
+
if (rebaseStep.exitCode !== 0) {
|
|
2104
|
+
const abortResult = await runCommand([
|
|
2105
|
+
"git",
|
|
2106
|
+
"-C",
|
|
2107
|
+
gitRoot,
|
|
2108
|
+
"rebase",
|
|
2109
|
+
"--abort"
|
|
2110
|
+
], {
|
|
2111
|
+
cwd: gitRoot,
|
|
2112
|
+
timeoutMs
|
|
2113
|
+
});
|
|
2114
|
+
steps.push({
|
|
2115
|
+
name: "git rebase --abort",
|
|
2116
|
+
command: "git rebase --abort",
|
|
2117
|
+
cwd: gitRoot,
|
|
2118
|
+
durationMs: 0,
|
|
2119
|
+
exitCode: abortResult.code,
|
|
2120
|
+
stdoutTail: trimLogTail(abortResult.stdout, MAX_LOG_CHARS),
|
|
2121
|
+
stderrTail: trimLogTail(abortResult.stderr, MAX_LOG_CHARS)
|
|
2122
|
+
});
|
|
2123
|
+
return {
|
|
2124
|
+
status: "error",
|
|
2125
|
+
mode: "git",
|
|
2126
|
+
root: gitRoot,
|
|
2127
|
+
reason: "rebase-failed",
|
|
2128
|
+
before: {
|
|
2129
|
+
sha: beforeSha,
|
|
2130
|
+
version: beforeVersion
|
|
2131
|
+
},
|
|
2132
|
+
steps,
|
|
2133
|
+
durationMs: Date.now() - startedAt
|
|
2134
|
+
};
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
} else {
|
|
2138
|
+
const fetchFailure = await runRequiredGitStep("git fetch", [
|
|
2139
|
+
"git",
|
|
2140
|
+
"-C",
|
|
2141
|
+
gitRoot,
|
|
2142
|
+
"fetch",
|
|
2143
|
+
"--all",
|
|
2144
|
+
"--prune",
|
|
2145
|
+
"--tags"
|
|
2146
|
+
], "fetch-failed");
|
|
2147
|
+
if (fetchFailure) return fetchFailure;
|
|
2148
|
+
const tag = await resolveChannelTag(runCommand, gitRoot, timeoutMs, channel);
|
|
2149
|
+
if (!tag) return {
|
|
2150
|
+
status: "error",
|
|
2151
|
+
mode: "git",
|
|
2152
|
+
root: gitRoot,
|
|
2153
|
+
reason: "no-release-tag",
|
|
2154
|
+
before: {
|
|
2155
|
+
sha: beforeSha,
|
|
2156
|
+
version: beforeVersion
|
|
2157
|
+
},
|
|
2158
|
+
steps,
|
|
2159
|
+
durationMs: Date.now() - startedAt
|
|
2160
|
+
};
|
|
2161
|
+
const failure = await runRequiredGitStep(`git checkout ${tag}`, [
|
|
2162
|
+
"git",
|
|
2163
|
+
"-C",
|
|
2164
|
+
gitRoot,
|
|
2165
|
+
"checkout",
|
|
2166
|
+
"--detach",
|
|
2167
|
+
tag
|
|
2168
|
+
], "checkout-failed");
|
|
2169
|
+
if (failure) return failure;
|
|
2170
|
+
}
|
|
2171
|
+
const manager = await resolveUpdateBuildManager((argv, options) => runCommand(argv, {
|
|
2172
|
+
timeoutMs: options.timeoutMs,
|
|
2173
|
+
env: options.env
|
|
2174
|
+
}), gitRoot, timeoutMs, defaultCommandEnv, "require-preferred");
|
|
2175
|
+
if (manager.kind === "missing-required") return await buildGitErrorResultWithRollback(mapManagerResolutionFailure(manager.reason));
|
|
2176
|
+
try {
|
|
2177
|
+
const installEnv = resolveInstallEnv(manager.manager, manager.env);
|
|
2178
|
+
const depsStep = await runStep(step("deps install", managerInstallArgs(manager.manager, { compatFallback: manager.fallback && manager.manager === "npm" }), gitRoot, installEnv));
|
|
2179
|
+
steps.push(depsStep);
|
|
2180
|
+
let finalDepsStep = depsStep;
|
|
2181
|
+
if (depsStep.exitCode !== 0 && shouldRetryWindowsInstallIgnoringScripts(manager.manager)) {
|
|
2182
|
+
const retryArgv = managerInstallIgnoreScriptsArgs(manager.manager);
|
|
2183
|
+
if (retryArgv) {
|
|
2184
|
+
const retryStep = await runStep(step("deps install (ignore scripts)", retryArgv, gitRoot, installEnv));
|
|
2185
|
+
steps.push(retryStep);
|
|
2186
|
+
finalDepsStep = retryStep;
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
if (finalDepsStep.exitCode !== 0) return await buildGitErrorResultWithRollback("deps-install-failed");
|
|
2190
|
+
const buildStep = await runStep(step("build", managerScriptArgs(manager.manager, "build"), gitRoot, resolveBuildEnv(manager.env)));
|
|
2191
|
+
steps.push(buildStep);
|
|
2192
|
+
if (buildStep.exitCode !== 0) return await buildGitErrorResultWithRollback("build-failed");
|
|
2193
|
+
const uiBuildStep = await runStep(step("ui:build", managerScriptArgs(manager.manager, "ui:build"), gitRoot, manager.env));
|
|
2194
|
+
steps.push(uiBuildStep);
|
|
2195
|
+
if (uiBuildStep.exitCode !== 0) return await buildGitErrorResultWithRollback("ui-build-failed");
|
|
2196
|
+
const doctorEntry = path.join(gitRoot, "daocore.mjs");
|
|
2197
|
+
if (!await fs$1.stat(doctorEntry).then(() => true).catch(() => false)) {
|
|
2198
|
+
steps.push({
|
|
2199
|
+
name: "daocore doctor entry",
|
|
2200
|
+
command: `verify ${doctorEntry}`,
|
|
2201
|
+
cwd: gitRoot,
|
|
2202
|
+
durationMs: 0,
|
|
2203
|
+
exitCode: 1,
|
|
2204
|
+
stderrTail: `missing ${doctorEntry}`
|
|
2205
|
+
});
|
|
2206
|
+
return await buildGitErrorResultWithRollback("doctor-entry-missing");
|
|
2207
|
+
}
|
|
2208
|
+
const doctorStep = await runStep(step("daocore doctor", [
|
|
2209
|
+
await resolveStableNodePath(process.execPath),
|
|
2210
|
+
doctorEntry,
|
|
2211
|
+
"doctor",
|
|
2212
|
+
"--non-interactive",
|
|
2213
|
+
"--fix"
|
|
2214
|
+
], gitRoot, {
|
|
2215
|
+
DAOCORE_UPDATE_IN_PROGRESS: "1",
|
|
2216
|
+
...opts.deferConfiguredPluginInstallRepair ? { [UPDATE_DEFER_CONFIGURED_PLUGIN_INSTALL_REPAIR_ENV]: "1" } : {},
|
|
2217
|
+
[UPDATE_PARENT_SUPPORTS_DOCTOR_CONFIG_WRITE_ENV]: "1"
|
|
2218
|
+
}));
|
|
2219
|
+
steps.push(doctorStep);
|
|
2220
|
+
if (doctorStep.exitCode !== 0) return await buildGitErrorResultWithRollback("doctor-failed");
|
|
2221
|
+
if (!(await resolveControlUiDistIndexHealth({ root: gitRoot })).exists) {
|
|
2222
|
+
const repairArgv = managerScriptArgs(manager.manager, "ui:build");
|
|
2223
|
+
const started = Date.now();
|
|
2224
|
+
const repairResult = await runCommand(repairArgv, {
|
|
2225
|
+
cwd: gitRoot,
|
|
2226
|
+
timeoutMs,
|
|
2227
|
+
env: manager.env
|
|
2228
|
+
});
|
|
2229
|
+
const repairStep = {
|
|
2230
|
+
name: "ui:build (post-doctor repair)",
|
|
2231
|
+
command: repairArgv.join(" "),
|
|
2232
|
+
cwd: gitRoot,
|
|
2233
|
+
durationMs: Date.now() - started,
|
|
2234
|
+
exitCode: repairResult.code,
|
|
2235
|
+
stdoutTail: trimLogTail(repairResult.stdout, MAX_LOG_CHARS),
|
|
2236
|
+
stderrTail: trimLogTail(repairResult.stderr, MAX_LOG_CHARS)
|
|
2237
|
+
};
|
|
2238
|
+
steps.push(repairStep);
|
|
2239
|
+
if (repairResult.code !== 0) return await buildGitErrorResultWithRollback("ui-build-failed");
|
|
2240
|
+
const repairedUiIndexHealth = await resolveControlUiDistIndexHealth({ root: gitRoot });
|
|
2241
|
+
if (!repairedUiIndexHealth.exists) {
|
|
2242
|
+
const uiIndexPath = repairedUiIndexHealth.indexPath ?? resolveControlUiDistIndexPathForRoot(gitRoot);
|
|
2243
|
+
steps.push({
|
|
2244
|
+
name: "ui assets verify",
|
|
2245
|
+
command: `verify ${uiIndexPath}`,
|
|
2246
|
+
cwd: gitRoot,
|
|
2247
|
+
durationMs: 0,
|
|
2248
|
+
exitCode: 1,
|
|
2249
|
+
stderrTail: `missing ${uiIndexPath}`
|
|
2250
|
+
});
|
|
2251
|
+
return await buildGitErrorResultWithRollback("ui-assets-missing");
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
const failedStep = findBlockingGitFailure(steps);
|
|
2255
|
+
const afterShaStep = await runStep(step("git rev-parse HEAD (after)", [
|
|
2256
|
+
"git",
|
|
2257
|
+
"-C",
|
|
2258
|
+
gitRoot,
|
|
2259
|
+
"rev-parse",
|
|
2260
|
+
"HEAD"
|
|
2261
|
+
], gitRoot));
|
|
2262
|
+
steps.push(afterShaStep);
|
|
2263
|
+
const afterVersion = await readPackageVersion(gitRoot);
|
|
2264
|
+
return {
|
|
2265
|
+
status: failedStep ? "error" : "ok",
|
|
2266
|
+
mode: "git",
|
|
2267
|
+
root: gitRoot,
|
|
2268
|
+
reason: failedStep ? normalizeFallbackFailureReason(failedStep.name) : void 0,
|
|
2269
|
+
before: {
|
|
2270
|
+
sha: beforeSha,
|
|
2271
|
+
version: beforeVersion
|
|
2272
|
+
},
|
|
2273
|
+
after: {
|
|
2274
|
+
sha: afterShaStep.stdoutTail?.trim() ?? null,
|
|
2275
|
+
version: afterVersion
|
|
2276
|
+
},
|
|
2277
|
+
steps,
|
|
2278
|
+
durationMs: Date.now() - startedAt
|
|
2279
|
+
};
|
|
2280
|
+
} finally {
|
|
2281
|
+
await manager.cleanup?.();
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
if (!pkgRoot) return {
|
|
2285
|
+
status: "error",
|
|
2286
|
+
mode: "unknown",
|
|
2287
|
+
reason: "not-daocore-root",
|
|
2288
|
+
steps: [],
|
|
2289
|
+
durationMs: Date.now() - startedAt
|
|
2290
|
+
};
|
|
2291
|
+
const beforeVersion = await readPackageVersion(pkgRoot);
|
|
2292
|
+
const globalManager = await detectGlobalInstallManagerForRoot(runCommand, pkgRoot, timeoutMs);
|
|
2293
|
+
if (globalManager) {
|
|
2294
|
+
const installTarget = await resolveGlobalInstallTarget({
|
|
2295
|
+
manager: globalManager,
|
|
2296
|
+
runCommand,
|
|
2297
|
+
timeoutMs,
|
|
2298
|
+
pkgRoot
|
|
2299
|
+
});
|
|
2300
|
+
const packageName = await readPackageName(pkgRoot) ?? DEFAULT_PACKAGE_NAME;
|
|
2301
|
+
await cleanupGlobalRenameDirs({
|
|
2302
|
+
globalRoot: path.dirname(pkgRoot),
|
|
2303
|
+
packageName
|
|
2304
|
+
});
|
|
2305
|
+
const channel = opts.channel ?? "stable";
|
|
2306
|
+
const tag = normalizeTag(opts.tag ?? channelToNpmTag(channel));
|
|
2307
|
+
const globalInstallEnv = await createGlobalInstallEnv();
|
|
2308
|
+
const packageUpdate = await runGlobalPackageUpdateSteps({
|
|
2309
|
+
installTarget,
|
|
2310
|
+
installSpec: resolveGlobalInstallSpec({
|
|
2311
|
+
packageName,
|
|
2312
|
+
tag,
|
|
2313
|
+
env: globalInstallEnv
|
|
2314
|
+
}),
|
|
2315
|
+
packageName,
|
|
2316
|
+
packageRoot: pkgRoot,
|
|
2317
|
+
runCommand,
|
|
2318
|
+
timeoutMs,
|
|
2319
|
+
...globalInstallEnv === void 0 ? {} : { env: globalInstallEnv },
|
|
2320
|
+
installCwd: pkgRoot,
|
|
2321
|
+
runStep: (stepParams) => runStep({
|
|
2322
|
+
runCommand,
|
|
2323
|
+
...stepParams,
|
|
2324
|
+
cwd: stepParams.cwd ?? pkgRoot,
|
|
2325
|
+
progress,
|
|
2326
|
+
stepIndex: 0,
|
|
2327
|
+
totalSteps: 1
|
|
2328
|
+
}),
|
|
2329
|
+
postVerifyStep: async (verifiedPackageRoot) => {
|
|
2330
|
+
const doctorEntry = await resolveGatewayInstallEntrypoint(verifiedPackageRoot);
|
|
2331
|
+
if (!doctorEntry) return null;
|
|
2332
|
+
const doctorNodePath = await resolveStableNodePath(process.execPath);
|
|
2333
|
+
const candidateHostVersion = await readPackageVersion(verifiedPackageRoot);
|
|
2334
|
+
return await runStep({
|
|
2335
|
+
runCommand,
|
|
2336
|
+
name: "daocore doctor",
|
|
2337
|
+
argv: [
|
|
2338
|
+
doctorNodePath,
|
|
2339
|
+
doctorEntry,
|
|
2340
|
+
"doctor",
|
|
2341
|
+
"--non-interactive",
|
|
2342
|
+
"--fix"
|
|
2343
|
+
],
|
|
2344
|
+
cwd: verifiedPackageRoot,
|
|
2345
|
+
timeoutMs,
|
|
2346
|
+
env: {
|
|
2347
|
+
DAOCORE_UPDATE_IN_PROGRESS: "1",
|
|
2348
|
+
[UPDATE_PARENT_SUPPORTS_DOCTOR_CONFIG_WRITE_ENV]: "1",
|
|
2349
|
+
...candidateHostVersion === null ? {} : { DAOCORE_COMPATIBILITY_HOST_VERSION: candidateHostVersion }
|
|
2350
|
+
},
|
|
2351
|
+
progress,
|
|
2352
|
+
stepIndex: 0,
|
|
2353
|
+
totalSteps: 1
|
|
2354
|
+
});
|
|
2355
|
+
}
|
|
2356
|
+
});
|
|
2357
|
+
return {
|
|
2358
|
+
status: packageUpdate.failedStep ? "error" : "ok",
|
|
2359
|
+
mode: globalManager,
|
|
2360
|
+
root: packageUpdate.verifiedPackageRoot ?? pkgRoot,
|
|
2361
|
+
reason: packageUpdate.failedStep ? normalizeFallbackFailureReason(packageUpdate.failedStep.name) : void 0,
|
|
2362
|
+
before: { version: beforeVersion },
|
|
2363
|
+
after: { version: packageUpdate.afterVersion },
|
|
2364
|
+
steps: packageUpdate.steps,
|
|
2365
|
+
durationMs: Date.now() - startedAt
|
|
2366
|
+
};
|
|
2367
|
+
}
|
|
2368
|
+
return {
|
|
2369
|
+
status: "skipped",
|
|
2370
|
+
mode: "unknown",
|
|
2371
|
+
root: pkgRoot,
|
|
2372
|
+
reason: "not-git-install",
|
|
2373
|
+
before: { version: beforeVersion },
|
|
2374
|
+
steps: [],
|
|
2375
|
+
durationMs: Date.now() - startedAt
|
|
2376
|
+
};
|
|
2377
|
+
}
|
|
2378
|
+
//#endregion
|
|
2379
|
+
export { cleanupGlobalRenameDirs as a, detectGlobalInstallManagerForRoot as c, resolveGlobalInstallTarget as d, resolvePnpmGlobalDirFromGlobalRoot as f, canResolveRegistryVersionForPackageTarget as i, globalInstallArgs as l, runGatewayUpdate as n, createGlobalInstallEnv as o, normalizePackageTagInput as p, runGlobalPackageUpdateSteps as r, detectGlobalInstallManagerByPresence as s, resolveUpdateInstallSurface as t, resolveGlobalInstallSpec as u };
|