@qwen-code/qwen-code 0.19.3 → 0.19.4-nightly.20260702.46814e4f1
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/bundled/loop/SKILL.md +22 -3
- package/bundled/loop/SKILL.test.ts +20 -0
- package/bundled/loop/autonomous-loop.test.ts +59 -0
- package/bundled/loop/autonomous-loop.ts +102 -0
- package/bundled/loop/loop-task-file.test.ts +1064 -0
- package/bundled/loop/loop-task-file.ts +404 -0
- package/bundled/loop/loop-tick-resolver.test.ts +906 -0
- package/bundled/loop/loop-tick-resolver.ts +416 -0
- package/bundled/qc-helper/SKILL.md +12 -5
- package/bundled/qc-helper/docs/configuration/auth.md +1 -1
- package/bundled/qc-helper/docs/configuration/settings.md +62 -32
- package/bundled/qc-helper/docs/features/approval-mode.md +3 -0
- package/bundled/qc-helper/docs/features/auto-mode.md +40 -0
- package/bundled/qc-helper/docs/features/channels/overview.md +81 -18
- package/bundled/qc-helper/docs/features/channels/plugins.md +1 -1
- package/bundled/qc-helper/docs/features/code-review.md +17 -61
- package/bundled/qc-helper/docs/features/commands.md +42 -40
- package/bundled/qc-helper/docs/features/headless.md +19 -18
- package/bundled/qc-helper/docs/features/hooks.md +6 -1
- package/bundled/qc-helper/docs/features/mcp.md +3 -1
- package/bundled/qc-helper/docs/features/memory.md +1 -1
- package/bundled/qc-helper/docs/features/scheduled-tasks.md +10 -0
- package/bundled/qc-helper/docs/features/status-line.md +3 -3
- package/bundled/qc-helper/docs/ide-integration/ide-integration.md +4 -4
- package/bundled/qc-helper/docs/qwen-serve.md +53 -0
- package/bundled/qc-helper/docs/support/troubleshooting.md +11 -0
- package/bundled/review/DESIGN.md +21 -26
- package/bundled/review/SKILL.md +45 -129
- package/chunks/MaxSizedBox-GHGRQ2OS.js +69 -0
- package/chunks/{StandaloneSessionPicker-Z52JTYST.js → StandaloneSessionPicker-G7YTTM27.js} +49 -42
- package/chunks/{acpAgent-7RZUOWOM.js → acpAgent-SDOILBSU.js} +1325 -365
- package/chunks/{agent-4FG7WTHJ.js → agent-NTSXGV4L.js} +31 -25
- package/chunks/agent-headless-WYURMSAB.js +62 -0
- package/chunks/{anthropicContentGenerator-PFITVL7Y.js → anthropicContentGenerator-WL3LJOUB.js} +110 -31
- package/chunks/{artifact-tool-D2X7G3C3.js → artifact-tool-W76WC2JX.js} +3 -3
- package/chunks/{askUserQuestion-UGETICJQ.js → askUserQuestion-J3P6TH3V.js} +2 -2
- package/chunks/bridge-AMOL4W4P.js +73 -0
- package/chunks/{ca-IUFWESZL.js → ca-HCMB2I54.js} +10 -9
- package/chunks/channel-worker-supervisor-C3IB63V7.js +659 -0
- package/chunks/{chunk-STUWFKGD.js → chunk-26JIREA5.js} +466 -543
- package/chunks/{chunk-SLNKLLEO.js → chunk-2MRV62AU.js} +37 -8
- package/chunks/{chunk-ODLIHNOY.js → chunk-2U4HUMOL.js} +1 -1
- package/chunks/{chunk-CKQA6AWF.js → chunk-4D73HUOP.js} +1 -1
- package/chunks/{chunk-M2U5NM24.js → chunk-54YZOP7P.js} +309 -72
- package/chunks/{chunk-J7FA27RO.js → chunk-5LKL3PAU.js} +3 -3
- package/chunks/chunk-5P5XGNYH.js +93 -0
- package/chunks/{chunk-UFLGERMB.js → chunk-6JE32BRB.js} +178 -124
- package/chunks/{chunk-FKAVULLM.js → chunk-75AVTQJ2.js} +74 -10
- package/chunks/{chunk-I2LYBGNI.js → chunk-7IOMIYOE.js} +1 -1
- package/chunks/{chunk-4LUZAKMK.js → chunk-7KXAGQJ2.js} +1 -1
- package/chunks/{chunk-BXSHL2SF.js → chunk-7LUOQJ3D.js} +1 -1
- package/chunks/{chunk-YAINVQ3Q.js → chunk-A5OPLHFM.js} +18693 -17055
- package/chunks/chunk-AHNXYU4O.js +24 -0
- package/chunks/{chunk-UX4SGCGN.js → chunk-AVQDCKNF.js} +96 -22
- package/chunks/{chunk-HYCC3XM3.js → chunk-B236XPGF.js} +1 -1
- package/chunks/chunk-B6SZLQAZ.js +3523 -0
- package/chunks/{chunk-5DWXLGOM.js → chunk-BJBWRCSK.js} +1 -1
- package/chunks/chunk-BPFJQGY7.js +193 -0
- package/chunks/{chunk-SKQZZVAV.js → chunk-BZHLWC6T.js} +2 -2
- package/chunks/{chunk-U3KSMM7G.js → chunk-D5KISTLW.js} +339 -383
- package/chunks/{chunk-GT2FGICD.js → chunk-DE7YXUR7.js} +1 -1
- package/chunks/{chunk-BUUQ5HPX.js → chunk-DG573EOO.js} +1 -1
- package/chunks/{chunk-VVLOGDB6.js → chunk-DX3TKXNT.js} +2 -2
- package/chunks/chunk-E5A7LHNN.js +51 -0
- package/chunks/{chunk-3PJXIDKI.js → chunk-E6US47KI.js} +3 -27
- package/chunks/{chunk-QBZ22PQX.js → chunk-EWALXUAD.js} +3 -1
- package/chunks/{chunk-PDE7CSDS.js → chunk-FXKI7OW6.js} +2 -2
- package/chunks/{chunk-F3ZYSEY6.js → chunk-FY4TT4L4.js} +3 -3
- package/chunks/{chunk-QLDPRILK.js → chunk-G7OQ3RFJ.js} +3 -3
- package/chunks/{chunk-R2BXK7SX.js → chunk-GHOTR7HL.js} +6 -1
- package/chunks/{chunk-KMGMKW5Q.js → chunk-GLPV75ES.js} +9 -3
- package/chunks/{chunk-LD2XBG6Z.js → chunk-GO6LNQXT.js} +1 -39
- package/chunks/{chunk-CNLEDYE3.js → chunk-H6TNLOLM.js} +5 -5
- package/chunks/{chunk-JVHEVCAU.js → chunk-HLW4EGKR.js} +31 -6
- package/chunks/{chunk-I4H7PRWQ.js → chunk-HTWHAN44.js} +1 -1
- package/chunks/{chunk-QE6KJYLT.js → chunk-IPYE5BIS.js} +123 -25
- package/chunks/{chunk-EJYJYJZ2.js → chunk-IRJWHZWU.js} +3 -70
- package/chunks/{chunk-EDMZZFDU.js → chunk-J3YPTTNL.js} +930 -798
- package/chunks/{chunk-GGBIN5K7.js → chunk-JGAJMIJZ.js} +1 -1
- package/chunks/{chunk-N4EJFBN5.js → chunk-JVLP5US5.js} +427 -263
- package/chunks/{chunk-R5OP2ATH.js → chunk-JZG7VB6C.js} +11 -11
- package/chunks/{chunk-QI7GOGJR.js → chunk-KKQWC6WS.js} +1 -1
- package/chunks/{chunk-ADCIHOQZ.js → chunk-KX5QZRW2.js} +142 -30
- package/chunks/{chunk-SBBN4BWR.js → chunk-L7OJ3ZO3.js} +1 -1
- package/chunks/{chunk-NDOC6M5S.js → chunk-L7QPM2YD.js} +2 -2
- package/chunks/{chunk-BVSVIN45.js → chunk-LKWAVAB5.js} +3 -3
- package/chunks/{chunk-T4T2FNV4.js → chunk-LOW52WYZ.js} +2 -2
- package/chunks/{chunk-4QK3O43S.js → chunk-LU7BIVWC.js} +4 -4
- package/chunks/{chunk-ZP6UKOPB.js → chunk-LWGLBVWA.js} +1 -1
- package/chunks/{chunk-L7OKCI7T.js → chunk-M7BLWURA.js} +15 -1
- package/chunks/{chunk-PR32FRT6.js → chunk-MIM62IXS.js} +3 -3
- package/chunks/{chunk-RD6YJJJ6.js → chunk-MOUXUCXQ.js} +1 -1
- package/chunks/{chunk-VBZ452JT.js → chunk-MSNGFH6L.js} +494 -114
- package/chunks/{chunk-BX5YO7UW.js → chunk-MTNTVOJR.js} +542 -370
- package/chunks/chunk-MX2YXRER.js +44 -0
- package/chunks/chunk-NIOPRZNN.js +27 -0
- package/chunks/{chunk-SMYQZVZ3.js → chunk-NOGSPTLJ.js} +1 -1
- package/chunks/{chunk-DDMOU62Q.js → chunk-NPQWQYU6.js} +1 -1
- package/chunks/{chunk-MNF6S5PR.js → chunk-P5THQV6A.js} +4 -4
- package/chunks/{chunk-6V4NZFUS.js → chunk-PCYOT4PK.js} +5 -5
- package/chunks/{chunk-CF6BB3LT.js → chunk-PPFWEV7G.js} +10 -1
- package/chunks/{chunk-FXKVLFFY.js → chunk-PSFDB5FZ.js} +3 -3
- package/chunks/{chunk-XJYUPHRC.js → chunk-QOMAHFYI.js} +3 -3
- package/chunks/{chunk-J37FGIOA.js → chunk-QXPI7FEC.js} +38 -4
- package/chunks/{chunk-RRFZXMYP.js → chunk-QZDBHNMV.js} +691 -164
- package/chunks/{chunk-S7AKE7HL.js → chunk-R6RI2HIC.js} +63 -9
- package/chunks/{chunk-HZT4UCFB.js → chunk-RB7S52NJ.js} +4 -4
- package/chunks/{chunk-J33ZR6OJ.js → chunk-RK22ACPP.js} +16 -16
- package/chunks/chunk-RM3PGSGL.js +66 -0
- package/chunks/chunk-RNBYOUGV.js +42 -0
- package/chunks/chunk-S6RLAIUR.js +23 -0
- package/chunks/{chunk-3TV3HUWZ.js → chunk-SCYK2YLI.js} +81 -30
- package/chunks/{chunk-HPZTOP4I.js → chunk-SEKRT4SD.js} +133 -23
- package/chunks/chunk-SEZC2725.js +36 -0
- package/chunks/chunk-SIUQ3YYX.js +78 -0
- package/chunks/{chunk-O2VBQ3Y2.js → chunk-SJBIFVD2.js} +2 -2
- package/chunks/chunk-SYCJMSIJ.js +82 -0
- package/chunks/{chunk-JE5FVRPC.js → chunk-T22H4V4R.js} +48 -23
- package/chunks/{chunk-3227DZO4.js → chunk-T42ACHFI.js} +1 -1
- package/chunks/{chunk-UO5GVXQE.js → chunk-TENOUWY2.js} +3 -3
- package/chunks/{chunk-JOLIREYR.js → chunk-TOAUDIS7.js} +1 -1
- package/chunks/{chunk-QNKBEJO2.js → chunk-UA6XBZT7.js} +2776 -1289
- package/chunks/{chunk-O75BHFQW.js → chunk-UQTYK5SS.js} +2 -2
- package/chunks/{chunk-Y6YMRS3U.js → chunk-UY2TCIZS.js} +17 -3
- package/chunks/{chunk-FNJ7BDPH.js → chunk-UY7ZAYTY.js} +10 -7
- package/chunks/{chunk-UYT3MWEB.js → chunk-UYHWM24C.js} +30 -2
- package/chunks/{chunk-SMXULRAN.js → chunk-VXGPYF7U.js} +1 -1
- package/chunks/{chunk-BTLJ2MF5.js → chunk-W7CG5HPC.js} +3 -3
- package/chunks/{chunk-JJXWTVSK.js → chunk-XHZKDN7M.js} +34 -1
- package/chunks/{chunk-K5XU6E4T.js → chunk-XKSCTXPK.js} +2 -2
- package/chunks/chunk-Y4LITCRB.js +367 -0
- package/chunks/chunk-YHTNWGRR.js +239 -0
- package/chunks/{chunk-BKXBARJZ.js → chunk-YPCPZSZB.js} +1 -1
- package/chunks/{chunk-QWFNTRH4.js → chunk-YSM24SCE.js} +1 -1
- package/chunks/chunk-YTFBURQD.js +313 -0
- package/chunks/{chunk-NL4C3H6C.js → chunk-YXK4GPYO.js} +1 -1
- package/chunks/{chunk-RYLJU2DY.js → chunk-ZN5T4BHI.js} +1 -1
- package/chunks/{computer-use-JGB36FDW.js → computer-use-MTSVPLPY.js} +34 -28
- package/chunks/contextCommand-VGJ3BPTK.js +67 -0
- package/chunks/{cron-create-SKEY55RG.js → cron-create-6YTCOX6P.js} +4 -4
- package/chunks/{cron-delete-I3NAT32Z.js → cron-delete-E3NIFSUK.js} +4 -4
- package/chunks/{cron-list-6XRRL6TH.js → cron-list-Q64MNQNE.js} +4 -4
- package/chunks/daemon-EEB2RYOL.js +8453 -0
- package/chunks/daemon-status-provider-H5SNMK42.js +71 -0
- package/chunks/{de-EOW5PVHF.js → de-PLLFDERI.js} +10 -9
- package/chunks/{dist-NHEYYB2B.js → dist-ADMIQGHI.js} +2 -2
- package/chunks/{dist-J37VXPLD.js → dist-BCQ7INM7.js} +40 -15
- package/chunks/{dist-663NZ6MI.js → dist-KNZFCY5F.js} +116 -11
- package/chunks/{dist-LB6OGPVM.js → dist-LHUWC3K6.js} +26 -5
- package/chunks/{dist-PQPZ5Q4N.js → dist-WBBZ76JZ.js} +20 -9
- package/chunks/{earlyInputCapture-44RISVVJ.js → earlyInputCapture-U4ZIQSQU.js} +32 -26
- package/chunks/{edit-NN6GM5DT.js → edit-SYIQ2KBI.js} +41 -38
- package/chunks/{en-HPWEJBTR.js → en-M4EBUBNU.js} +32 -10
- package/chunks/{enter-worktree-PB3O2C7D.js → enter-worktree-HPPOO244.js} +31 -25
- package/chunks/{enterPlanMode-YQFNNSUA.js → enterPlanMode-56YYO52U.js} +41 -25
- package/chunks/{errors-LS7XU5DZ.js → errors-EO4SXCFP.js} +33 -27
- package/chunks/{exit-worktree-E2FTNSBK.js → exit-worktree-UDM7E6XH.js} +31 -25
- package/chunks/{exitPlanMode-GLYK2BUB.js → exitPlanMode-M6P3AWLJ.js} +149 -33
- package/chunks/{fast-path-WQ6M7LI7.js → fast-path-42P4QYWI.js} +33 -14
- package/chunks/{fast-path-settings-OAGU3X5H.js → fast-path-settings-UQLRFDQP.js} +2 -2
- package/chunks/{fr-BN5NKSAC.js → fr-MBMNQSQ6.js} +10 -9
- package/chunks/{gemini-2YFLVA2M.js → gemini-NRLXS5J7.js} +84 -70
- package/chunks/{geminiContentGenerator-XV6SV6CD.js → geminiContentGenerator-DLJPYYPA.js} +41 -5
- package/chunks/{glob-2H6CDDMK.js → glob-JPY3F74Y.js} +31 -25
- package/chunks/{grep-VXIUXM3C.js → grep-HW23YES5.js} +31 -25
- package/chunks/initializer-HWOZTC4A.js +67 -0
- package/chunks/{ja-7DEUB2TS.js → ja-HFV5QCHR.js} +10 -9
- package/chunks/{keychain-token-storage-YLMDLKXT.js → keychain-token-storage-GPAKRDKQ.js} +2 -2
- package/chunks/list-OZGAGRDG.js +71 -0
- package/chunks/loadedSettingsAdapter-RUTZVVIA.js +66 -0
- package/chunks/{loop-wakeup-CITGGQHA.js → loop-wakeup-G2EHBRGR.js} +5 -5
- package/chunks/{ls-R5WP4BGZ.js → ls-IDHUVSAG.js} +4 -4
- package/chunks/{lsp-GSICJMMW.js → lsp-FSRYXGFT.js} +2 -2
- package/chunks/{monitor-HKLRS2HQ.js → monitor-QVWEIXU3.js} +33 -26
- package/chunks/nonInteractiveCli-RV2WYPML.js +109 -0
- package/chunks/{notebook-edit-Y6SKSGTT.js → notebook-edit-B26W3FFH.js} +37 -34
- package/chunks/{openaiContentGenerator-J7G2FYJT.js → openaiContentGenerator-6TH7AZGQ.js} +15 -13
- package/chunks/pidfile-KW2QQJZI.js +73 -0
- package/chunks/{pt-TNZRNLQB.js → pt-2THT3YHA.js} +10 -9
- package/chunks/{qwenContentGenerator-5XIEM5GV.js → qwenContentGenerator-5IQAC7RN.js} +33 -27
- package/chunks/{qwenOAuth2-AG3PFFLZ.js → qwenOAuth2-LWLA6MQG.js} +5 -4
- package/chunks/{read-file-J7D552ZJ.js → read-file-CWFAHOI2.js} +11 -10
- package/chunks/{read-mcp-resource-DQQW7H7T.js → read-mcp-resource-PIJF24RO.js} +2 -2
- package/chunks/ripGrep-FTZGDKY4.js +60 -0
- package/chunks/{ru-NIAUBKCN.js → ru-Z67YJHBG.js} +10 -9
- package/chunks/{run-qwen-serve-SGEEVMXD.js → run-qwen-serve-FN2SW5ZI.js} +545 -97
- package/chunks/{scheduler-7CQI3S4Q.js → scheduler-BMS23O3I.js} +31 -25
- package/chunks/{send-message-EE4TWKVU.js → send-message-33PYFMCT.js} +20 -4
- package/chunks/serve-PXFYKL65.js +71 -0
- package/chunks/{server-4QMUWXPW.js → server-BRKALJ4F.js} +4132 -1175
- package/chunks/{session-NRO7UFOY.js → session-AQMISBP4.js} +205 -64
- package/chunks/{settings-SGWRDQSC.js → settings-JCPVUZMB.js} +35 -29
- package/chunks/{shell-62ANGIHL.js → shell-POHCRVN2.js} +31 -25
- package/chunks/{skill-VWAQAWW6.js → skill-QPEVHS6H.js} +13 -12
- package/chunks/spawnChannel-V3QT62TE.js +69 -0
- package/chunks/{src-KUV5J5Q2.js → src-IZSP7L6Y.js} +127 -32
- package/chunks/{startInteractiveUI-6EYJN3JV.js → startInteractiveUI-63KATISO.js} +16762 -16075
- package/chunks/{syntheticOutput-T5YHQ6S2.js → syntheticOutput-YOSWIHDJ.js} +3 -3
- package/chunks/{task-create-BLY7RHXX.js → task-create-NHS2NGB3.js} +9 -7
- package/chunks/{task-list-3QUYNVYR.js → task-list-5UIB564R.js} +7 -6
- package/chunks/{task-stop-U4RATK2V.js → task-stop-HGXZ2VZ3.js} +2 -2
- package/chunks/{task-update-U54O7KJX.js → task-update-IYYWUILG.js} +40 -7
- package/chunks/{team-create-LPOGCPM7.js → team-create-E5O2F3CA.js} +31 -25
- package/chunks/{team-delete-LKBYPASD.js → team-delete-FEKJCU4P.js} +7 -6
- package/chunks/team-plan-approval-2TU4YROB.js +202 -0
- package/chunks/theme-manager-37KOGPJL.js +64 -0
- package/chunks/{todoWrite-OYXKTVYN.js → todoWrite-TKMVZ2HT.js} +4 -4
- package/chunks/{tool-search-YPUFJ3ZQ.js → tool-search-4ZTGNSFI.js} +38 -11
- package/chunks/{trustedFolders-5B24TMEA.js → trustedFolders-RJ5WXJ6L.js} +32 -26
- package/chunks/{validateNonInterActiveAuth-BTDTYOVT.js → validateNonInterActiveAuth-ZWMHZAOK.js} +66 -55
- package/chunks/{web-fetch-EEB5LZYU.js → web-fetch-J4PIW36Q.js} +5 -4
- package/chunks/{workflow-LAWIW5LI.js → workflow-6PG2PC5M.js} +68 -39
- package/chunks/workspace-providers-status-4QIZN2W4.js +68 -0
- package/chunks/workspace-service-CYMCOEIO.js +78 -0
- package/chunks/{write-file-PCV226DJ.js → write-file-R354LGQF.js} +41 -40
- package/chunks/{zh-5EUYXASN.js → zh-SLZNSSZB.js} +32 -10
- package/chunks/{zh-TW-TR3XYGE5.js → zh-TW-P53C2SL5.js} +32 -10
- package/cli.js +6 -6
- package/locales/ca.js +15 -13
- package/locales/de.js +15 -13
- package/locales/en.js +52 -15
- package/locales/fr.js +15 -14
- package/locales/ja.js +15 -14
- package/locales/pt.js +15 -13
- package/locales/ru.js +15 -13
- package/locales/zh-TW.js +50 -14
- package/locales/zh.js +50 -14
- package/node_modules/@qwen-code/audio-capture/package.json +1 -1
- package/node_modules/@qwen-code/audio-capture/prebuilds/darwin-arm64/@qwen-code+audio-capture.node +0 -0
- package/node_modules/@qwen-code/audio-capture/prebuilds/darwin-x64/@qwen-code+audio-capture.node +0 -0
- package/node_modules/@qwen-code/audio-capture/prebuilds/win32-x64/@qwen-code+audio-capture.node +0 -0
- package/package.json +15 -6
- package/patches/chrome-devtools-mcp+1.4.0.patch +31 -0
- package/postinstall.js +50 -0
- package/web-shell/assets/{arc-DA7r8Ueo.js → arc-Bd3048nX.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-ZDUxPtZ2.js → architectureDiagram-3BPJPVTR-DyzbzABx.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-vrtOf1kJ.js → blockDiagram-GPEHLZMM-CTjxm9Sy.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-BHFjzIi4.js → c4Diagram-AAUBKEIU-DSOFWNU6.js} +1 -1
- package/web-shell/assets/channel-oVoup_Ci.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-mdeQVz59.js → chunk-2J33WTMH-D_PFdjo2.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-BkKMlwBX.js → chunk-4BX2VUAB-52eG6wOT.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-B7bnXNfu.js → chunk-55IACEB6-CGTZfKkC.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-DGz8Mm6i.js → chunk-727SXJPM-CZ-qfRUm.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-BQAydUNk.js → chunk-AQP2D5EJ-B2dSDcqM.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-GHr2LN_p.js → chunk-FMBD7UC4-Cfy3tyA0.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-7R91lnUx.js → chunk-ND2GUHAM-CApNUpUq.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-aTJD3lSQ.js → chunk-QZHKN3VN-CVBG8kgg.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-B8WsaT2G.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-B8WsaT2G.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-BTf8t1RL.js → cose-bilkent-S5V4N54A-URd77-_-.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-_sgp3WuA.js → dagre-BM42HDAG-C07H4G9-.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-CROtRy1w.js → diagram-2AECGRRQ-CYbpXrSn.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-BqGRzwSc.js → diagram-5GNKFQAL-SI8s6fjX.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-CMrcEtA7.js → diagram-KO2AKTUF-mBkC4RTW.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-BRydGNW5.js → diagram-LMA3HP47-CyBPDzWJ.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-D0ilgNjV.js → diagram-OG6HWLK6-DwK7kBCu.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-2lnQeJUM.js → erDiagram-TEJ5UH35-Ds1StEUd.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-C_ZMdQiC.js → flowDiagram-I6XJVG4X-BDC4-jHO.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-Dw9V_Ny0.js → ganttDiagram-6RSMTGT7-CV2aHQqf.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-HDXI-F1B.js → gitGraphDiagram-PVQCEYII-B8RcuV_L.js} +1 -1
- package/web-shell/assets/index-B5WZ0qP1.js +717 -0
- package/web-shell/assets/index-CYE1IMd1.css +5 -0
- package/web-shell/assets/{infoDiagram-5YYISTIA-CuB8Ebua.js → infoDiagram-5YYISTIA-DUPoTf50.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-D_tyhVwh.js → ishikawaDiagram-YF4QCWOH-FDYOx9rf.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-CgCwJQNU.js → journeyDiagram-JHISSGLW-C5_ohMRp.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-PZUtcbPx.js → kanban-definition-UN3LZRKU-Bn4UnOMG.js} +1 -1
- package/web-shell/assets/{linear-CZqRdJIU.js → linear-Bl0pKQtY.js} +1 -1
- package/web-shell/assets/{mermaid.core-CPW_4UEF.js → mermaid.core-sevQFoji.js} +72 -72
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-D_Y75ID7.js → mindmap-definition-RKZ34NQL-DSH4JZF9.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-Q4dTyLeF.js → pieDiagram-4H26LBE5-acWvdQTD.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-ckw329Ft.js → quadrantDiagram-W4KKPZXB-DlggX4Sm.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-DbVDm4It.js → requirementDiagram-4Y6WPE33--mMqwmV8.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-CHuZ_ecH.js → sankeyDiagram-5OEKKPKP-BtV9tZ77.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-DU2YSpq-.js → sequenceDiagram-3UESZ5HK-iDQzPFlj.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-CA9PEBUo.js → stateDiagram-AJRCARHV-CsCyQLZ3.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-CPapECG9.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-Bhlo4WVc.js → timeline-definition-PNZ67QCA-Dl0rnKvr.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-6xtPLsyl.js → vennDiagram-CIIHVFJN-qF7nTZzA.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-3eozmXPf.js → wardley-L42UT6IY-fWoK9i7F.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-BOn6hKss.js → wardleyDiagram-YWT4CUSO-pHGfkMnc.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-BsP4-I_y.js → xychartDiagram-2RQKCTM6-3Doc4Trz.js} +1 -1
- package/web-shell/index.html +18 -2
- package/chunks/MaxSizedBox-QNF3EIGU.js +0 -63
- package/chunks/agent-headless-RQ5BTX3G.js +0 -56
- package/chunks/bridge-JL2PMCIW.js +0 -66
- package/chunks/chunk-5GOVVXEV.js +0 -73
- package/chunks/chunk-BC3C4F3Q.js +0 -40
- package/chunks/chunk-BW4KCQFD.js +0 -1103
- package/chunks/chunk-RKIZXJMB.js +0 -13
- package/chunks/contextCommand-WYU6OQ2F.js +0 -61
- package/chunks/daemon-status-provider-HH2EC5FI.js +0 -65
- package/chunks/headlessSafetyWarnings-TBE35GJ4.js +0 -55
- package/chunks/initializer-2Y7SLOKV.js +0 -61
- package/chunks/list-ZAFHZ7OS.js +0 -65
- package/chunks/loadedSettingsAdapter-6KJXD6M3.js +0 -60
- package/chunks/nonInteractiveCli-5W4GIZQM.js +0 -96
- package/chunks/ripGrep-IEIFIWP4.js +0 -54
- package/chunks/serve-V6GVZR6U.js +0 -65
- package/chunks/spawnChannel-3VHW5EPY.js +0 -63
- package/chunks/theme-manager-LYLGAERF.js +0 -58
- package/chunks/workspace-providers-status-PIAFVYHA.js +0 -62
- package/chunks/workspace-service-YAIOD4HG.js +0 -71
- package/web-shell/assets/channel-iRo68q4Q.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-iHF24a8X.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-iHF24a8X.js +0 -1
- package/web-shell/assets/index-CHmzAWys.css +0 -5
- package/web-shell/assets/index-w6GTOHh1.js +0 -713
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-t1LRI0oY.js +0 -1
|
@@ -0,0 +1,659 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import {
|
|
4
|
+
CHANNEL_DAEMON_WORKER_SENTINEL,
|
|
5
|
+
CHANNEL_WORKER_HEARTBEAT_INTERVAL_MS,
|
|
6
|
+
QWEN_DAEMON_TOKEN_ENV,
|
|
7
|
+
QWEN_DAEMON_URL_ENV,
|
|
8
|
+
QWEN_DAEMON_WORKSPACE_ENV,
|
|
9
|
+
QWEN_SERVER_TOKEN_ENV
|
|
10
|
+
} from "./chunk-S6RLAIUR.js";
|
|
11
|
+
import {
|
|
12
|
+
channelSelectionNames
|
|
13
|
+
} from "./chunk-MX2YXRER.js";
|
|
14
|
+
import {
|
|
15
|
+
sanitizeLogText
|
|
16
|
+
} from "./chunk-B6SZLQAZ.js";
|
|
17
|
+
import "./chunk-UFC57OYT.js";
|
|
18
|
+
import "./chunk-K5PGHDBN.js";
|
|
19
|
+
import {
|
|
20
|
+
init_esbuild_shims
|
|
21
|
+
} from "./chunk-A4BMJM77.js";
|
|
22
|
+
import {
|
|
23
|
+
__name
|
|
24
|
+
} from "./chunk-J2S4EL5Y.js";
|
|
25
|
+
|
|
26
|
+
// packages/cli/src/serve/channel-worker-supervisor.ts
|
|
27
|
+
init_esbuild_shims();
|
|
28
|
+
import { fork } from "node:child_process";
|
|
29
|
+
import { randomUUID } from "node:crypto";
|
|
30
|
+
var DEFAULT_CHANNEL_WORKER_STARTUP_TIMEOUT_MS = 3e4;
|
|
31
|
+
var DEFAULT_CHANNEL_WORKER_HEARTBEAT_TIMEOUT_MS = 45e3;
|
|
32
|
+
var MAX_WORKER_LOG_LINE_LENGTH = 4096;
|
|
33
|
+
var MAX_WORKER_LOG_BUFFER_LENGTH = 64 * 1024;
|
|
34
|
+
var MAX_WORKER_LOG_DISCARDED_REMAINDER_LENGTH = MAX_WORKER_LOG_BUFFER_LENGTH;
|
|
35
|
+
var ANSI_CSI_SEQUENCE_RE = new RegExp(
|
|
36
|
+
`${String.fromCharCode(27)}\\[[0-?]*[ -/]*[@-~]`,
|
|
37
|
+
"g"
|
|
38
|
+
);
|
|
39
|
+
var WORKER_LOG_INVISIBLE_RE = new RegExp("[\\p{Cf}\\u2028\\u2029]|\\p{Variation_Selector}", "gu");
|
|
40
|
+
var WORKER_LOG_CONTROL_RE = /[\x00-\x08\x0a-\x1f\x7f]/g;
|
|
41
|
+
var DEFAULT_RESTART_POLICY = {
|
|
42
|
+
maxRestarts: 3,
|
|
43
|
+
windowMs: 5 * 6e4,
|
|
44
|
+
delaysMs: [1e3, 5e3, 15e3]
|
|
45
|
+
};
|
|
46
|
+
function selectionChannelArgs(selection) {
|
|
47
|
+
return channelSelectionNames(selection).flatMap((name) => [
|
|
48
|
+
"--channel",
|
|
49
|
+
name
|
|
50
|
+
]);
|
|
51
|
+
}
|
|
52
|
+
__name(selectionChannelArgs, "selectionChannelArgs");
|
|
53
|
+
function defaultSpawnWorker(execPath, argv, options) {
|
|
54
|
+
const child = fork(argv[0], argv.slice(1), {
|
|
55
|
+
execPath,
|
|
56
|
+
cwd: options.cwd,
|
|
57
|
+
env: options.env,
|
|
58
|
+
stdio: options.stdio
|
|
59
|
+
});
|
|
60
|
+
return child;
|
|
61
|
+
}
|
|
62
|
+
__name(defaultSpawnWorker, "defaultSpawnWorker");
|
|
63
|
+
function isReadyMessage(message) {
|
|
64
|
+
return typeof message === "object" && message !== null && message.type === "ready";
|
|
65
|
+
}
|
|
66
|
+
__name(isReadyMessage, "isReadyMessage");
|
|
67
|
+
function isHeartbeatMessage(message) {
|
|
68
|
+
return typeof message === "object" && message !== null && message.type === "heartbeat";
|
|
69
|
+
}
|
|
70
|
+
__name(isHeartbeatMessage, "isHeartbeatMessage");
|
|
71
|
+
function requestedChannelNames(selection) {
|
|
72
|
+
return selection.mode === "names" ? [...selection.names] : void 0;
|
|
73
|
+
}
|
|
74
|
+
__name(requestedChannelNames, "requestedChannelNames");
|
|
75
|
+
function workerLogRedactionOptions(daemonToken, workerEnv) {
|
|
76
|
+
return {
|
|
77
|
+
...daemonToken ? { daemonToken } : {},
|
|
78
|
+
workerEnv
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
__name(workerLogRedactionOptions, "workerLogRedactionOptions");
|
|
82
|
+
function sanitizeWorkerError(error, redaction) {
|
|
83
|
+
const normalized = normalizeWorkerLogLineForRedaction(error);
|
|
84
|
+
const redacted = redaction ? redactWorkerLogLine(normalized, redaction) : normalized;
|
|
85
|
+
return Array.from(sanitizeLogText(redacted, 512)).slice(0, 512).join("");
|
|
86
|
+
}
|
|
87
|
+
__name(sanitizeWorkerError, "sanitizeWorkerError");
|
|
88
|
+
function notifyExit(onExit, snapshot) {
|
|
89
|
+
try {
|
|
90
|
+
onExit?.(snapshot);
|
|
91
|
+
} catch {
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
__name(notifyExit, "notifyExit");
|
|
95
|
+
function notifyReady(onReady, snapshot) {
|
|
96
|
+
try {
|
|
97
|
+
onReady?.(snapshot);
|
|
98
|
+
} catch {
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
__name(notifyReady, "notifyReady");
|
|
102
|
+
function notifyLog(onLog, entry) {
|
|
103
|
+
try {
|
|
104
|
+
onLog?.(entry);
|
|
105
|
+
} catch {
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
__name(notifyLog, "notifyLog");
|
|
109
|
+
function waitForExit(child, timeoutMs) {
|
|
110
|
+
return new Promise((resolve) => {
|
|
111
|
+
let settled = false;
|
|
112
|
+
const done = /* @__PURE__ */ __name((exited) => {
|
|
113
|
+
if (settled) return;
|
|
114
|
+
settled = true;
|
|
115
|
+
if (timer) clearTimeout(timer);
|
|
116
|
+
resolve(exited);
|
|
117
|
+
}, "done");
|
|
118
|
+
const timer = setTimeout(() => done(false), timeoutMs);
|
|
119
|
+
timer.unref();
|
|
120
|
+
child.once("exit", () => done(true));
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
__name(waitForExit, "waitForExit");
|
|
124
|
+
function hasObservedExit(snapshot) {
|
|
125
|
+
return snapshot.exitCode !== void 0 || snapshot.signal !== void 0;
|
|
126
|
+
}
|
|
127
|
+
__name(hasObservedExit, "hasObservedExit");
|
|
128
|
+
function createWorkerEnv(opts) {
|
|
129
|
+
const env = { ...process.env };
|
|
130
|
+
env["QWEN_CODE_NO_RELAUNCH"] = "true";
|
|
131
|
+
env[CHANNEL_DAEMON_WORKER_SENTINEL] = randomUUID();
|
|
132
|
+
env[QWEN_DAEMON_URL_ENV] = opts.daemonUrl;
|
|
133
|
+
env[QWEN_DAEMON_WORKSPACE_ENV] = opts.workspace;
|
|
134
|
+
delete env[QWEN_SERVER_TOKEN_ENV];
|
|
135
|
+
delete env[QWEN_DAEMON_TOKEN_ENV];
|
|
136
|
+
if (opts.daemonToken) {
|
|
137
|
+
env[QWEN_DAEMON_TOKEN_ENV] = opts.daemonToken;
|
|
138
|
+
}
|
|
139
|
+
return env;
|
|
140
|
+
}
|
|
141
|
+
__name(createWorkerEnv, "createWorkerEnv");
|
|
142
|
+
function escapeRegExp(value) {
|
|
143
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
144
|
+
}
|
|
145
|
+
__name(escapeRegExp, "escapeRegExp");
|
|
146
|
+
function sensitiveEnvValues(env) {
|
|
147
|
+
const sensitiveKey = /(^|_)(TOKEN|SECRET|API_KEY|ACCESS_KEY|PRIVATE_KEY|CREDENTIAL|PASSWORD|PASSWD|PASSPHRASE|BASIC_AUTH|AUTH_TOKEN|AUTHORIZATION|SESSION_SECRET|SESSION_TOKEN|SESSION_KEY|SESSION_COOKIE|DSN|CONNECTION_STRING)($|_)/i;
|
|
148
|
+
return Object.entries(env).filter(([key, value]) => sensitiveKey.test(key) && value !== void 0).map(([, value]) => value).filter((value) => value.length >= 4);
|
|
149
|
+
}
|
|
150
|
+
__name(sensitiveEnvValues, "sensitiveEnvValues");
|
|
151
|
+
function redactWorkerLogLine(line, opts) {
|
|
152
|
+
return createWorkerLogRedactor(opts)(line);
|
|
153
|
+
}
|
|
154
|
+
__name(redactWorkerLogLine, "redactWorkerLogLine");
|
|
155
|
+
function createWorkerLogRedactor(opts) {
|
|
156
|
+
const secretPatterns = [
|
|
157
|
+
.../* @__PURE__ */ new Set([
|
|
158
|
+
...opts.daemonToken && opts.daemonToken.length >= 4 ? [opts.daemonToken] : [],
|
|
159
|
+
...sensitiveEnvValues(opts.workerEnv)
|
|
160
|
+
])
|
|
161
|
+
].sort((a, b) => b.length - a.length).map((secret) => new RegExp(escapeRegExp(secret), "g"));
|
|
162
|
+
return (line) => {
|
|
163
|
+
let redacted = line.replace(
|
|
164
|
+
/\b([a-z][a-z0-9+.-]{0,31}:\/\/)([^\s/]*@)([^\s/]+)([^\s]*)/gi,
|
|
165
|
+
"$1<redacted>@$3$4"
|
|
166
|
+
);
|
|
167
|
+
for (const secretPattern of secretPatterns) {
|
|
168
|
+
redacted = redacted.replace(secretPattern, "<redacted>");
|
|
169
|
+
}
|
|
170
|
+
return redacted;
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
__name(createWorkerLogRedactor, "createWorkerLogRedactor");
|
|
174
|
+
function normalizeWorkerLogLineForRedaction(line) {
|
|
175
|
+
return line.replace(ANSI_CSI_SEQUENCE_RE, "").replace(WORKER_LOG_INVISIBLE_RE, "").replace(WORKER_LOG_CONTROL_RE, "");
|
|
176
|
+
}
|
|
177
|
+
__name(normalizeWorkerLogLineForRedaction, "normalizeWorkerLogLineForRedaction");
|
|
178
|
+
function attachWorkerLogStream(stream, streamName, opts) {
|
|
179
|
+
if (!stream) return () => {
|
|
180
|
+
};
|
|
181
|
+
let buffer = "";
|
|
182
|
+
let discardingOversizedLineRemainder = false;
|
|
183
|
+
let discardedOversizedLineRemainderLength = 0;
|
|
184
|
+
const redactWorkerLogLineForStream = createWorkerLogRedactor({
|
|
185
|
+
...opts.daemonToken ? { daemonToken: opts.daemonToken } : {},
|
|
186
|
+
workerEnv: opts.workerEnv
|
|
187
|
+
});
|
|
188
|
+
const flushLine = /* @__PURE__ */ __name((line) => {
|
|
189
|
+
const redacted = redactWorkerLogLineForStream(
|
|
190
|
+
normalizeWorkerLogLineForRedaction(line)
|
|
191
|
+
);
|
|
192
|
+
notifyLog(opts.onLog, {
|
|
193
|
+
stream: streamName,
|
|
194
|
+
line: sanitizeLogText(redacted, MAX_WORKER_LOG_LINE_LENGTH)
|
|
195
|
+
});
|
|
196
|
+
}, "flushLine");
|
|
197
|
+
const flushPartial = /* @__PURE__ */ __name(() => {
|
|
198
|
+
if (buffer.length === 0) return;
|
|
199
|
+
flushLine(buffer);
|
|
200
|
+
buffer = "";
|
|
201
|
+
}, "flushPartial");
|
|
202
|
+
const flushOversizedBuffer = /* @__PURE__ */ __name(() => {
|
|
203
|
+
if (buffer.length <= MAX_WORKER_LOG_BUFFER_LENGTH) return;
|
|
204
|
+
flushLine(buffer);
|
|
205
|
+
buffer = "";
|
|
206
|
+
discardingOversizedLineRemainder = true;
|
|
207
|
+
discardedOversizedLineRemainderLength = 0;
|
|
208
|
+
}, "flushOversizedBuffer");
|
|
209
|
+
stream.on("data", (chunk) => {
|
|
210
|
+
buffer += typeof chunk === "string" ? chunk : Buffer.from(chunk).toString("utf8");
|
|
211
|
+
for (; ; ) {
|
|
212
|
+
const newlineIndex = buffer.search(/\r?\n/);
|
|
213
|
+
if (newlineIndex < 0) break;
|
|
214
|
+
const line = buffer.slice(0, newlineIndex);
|
|
215
|
+
const newlineLength = buffer[newlineIndex] === "\r" && buffer[newlineIndex + 1] === "\n" ? 2 : 1;
|
|
216
|
+
buffer = buffer.slice(newlineIndex + newlineLength);
|
|
217
|
+
if (!discardingOversizedLineRemainder) {
|
|
218
|
+
flushLine(line);
|
|
219
|
+
}
|
|
220
|
+
discardingOversizedLineRemainder = false;
|
|
221
|
+
discardedOversizedLineRemainderLength = 0;
|
|
222
|
+
}
|
|
223
|
+
if (discardingOversizedLineRemainder) {
|
|
224
|
+
discardedOversizedLineRemainderLength += buffer.length;
|
|
225
|
+
buffer = "";
|
|
226
|
+
if (discardedOversizedLineRemainderLength >= MAX_WORKER_LOG_DISCARDED_REMAINDER_LENGTH) {
|
|
227
|
+
discardingOversizedLineRemainder = false;
|
|
228
|
+
discardedOversizedLineRemainderLength = 0;
|
|
229
|
+
}
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
flushOversizedBuffer();
|
|
233
|
+
});
|
|
234
|
+
stream.on("end", flushPartial);
|
|
235
|
+
stream.on("close", flushPartial);
|
|
236
|
+
stream.on("error", () => {
|
|
237
|
+
flushPartial();
|
|
238
|
+
});
|
|
239
|
+
return flushPartial;
|
|
240
|
+
}
|
|
241
|
+
__name(attachWorkerLogStream, "attachWorkerLogStream");
|
|
242
|
+
function createChannelWorkerSupervisor(opts) {
|
|
243
|
+
const spawnWorker = opts.spawnWorker ?? defaultSpawnWorker;
|
|
244
|
+
const restartPolicy = opts.restartPolicy ?? DEFAULT_RESTART_POLICY;
|
|
245
|
+
if (restartPolicy.delaysMs.length === 0) {
|
|
246
|
+
throw new Error("restartPolicy.delaysMs must be non-empty.");
|
|
247
|
+
}
|
|
248
|
+
const heartbeatTimeoutMs = opts.heartbeatTimeoutMs ?? DEFAULT_CHANNEL_WORKER_HEARTBEAT_TIMEOUT_MS;
|
|
249
|
+
if (heartbeatTimeoutMs > 0 && heartbeatTimeoutMs <= CHANNEL_WORKER_HEARTBEAT_INTERVAL_MS) {
|
|
250
|
+
throw new Error(
|
|
251
|
+
`heartbeatTimeoutMs (${heartbeatTimeoutMs}) must exceed the worker heartbeat interval (${CHANNEL_WORKER_HEARTBEAT_INTERVAL_MS}ms) or be 0 to disable.`
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
let child;
|
|
255
|
+
let snapshot = {
|
|
256
|
+
enabled: true,
|
|
257
|
+
state: "disabled",
|
|
258
|
+
channels: channelSelectionNames(opts.selection),
|
|
259
|
+
restartCount: 0
|
|
260
|
+
};
|
|
261
|
+
let stopping = false;
|
|
262
|
+
let restartTimer;
|
|
263
|
+
let staleHeartbeatTimer;
|
|
264
|
+
let restartAttemptTimes = [];
|
|
265
|
+
const snapshotCopy = /* @__PURE__ */ __name(() => ({
|
|
266
|
+
...snapshot,
|
|
267
|
+
channels: [...snapshot.channels],
|
|
268
|
+
...snapshot.requestedChannels ? { requestedChannels: [...snapshot.requestedChannels] } : {}
|
|
269
|
+
}), "snapshotCopy");
|
|
270
|
+
const clearRestartTimer = /* @__PURE__ */ __name(() => {
|
|
271
|
+
if (restartTimer) {
|
|
272
|
+
clearTimeout(restartTimer);
|
|
273
|
+
restartTimer = void 0;
|
|
274
|
+
}
|
|
275
|
+
if (snapshot.nextRestartAt) {
|
|
276
|
+
const next = { ...snapshot };
|
|
277
|
+
delete next.nextRestartAt;
|
|
278
|
+
snapshot = next;
|
|
279
|
+
}
|
|
280
|
+
}, "clearRestartTimer");
|
|
281
|
+
const clearStaleHeartbeatTimer = /* @__PURE__ */ __name(() => {
|
|
282
|
+
if (!staleHeartbeatTimer) return;
|
|
283
|
+
clearTimeout(staleHeartbeatTimer);
|
|
284
|
+
staleHeartbeatTimer = void 0;
|
|
285
|
+
}, "clearStaleHeartbeatTimer");
|
|
286
|
+
const pruneRestartAttempts = /* @__PURE__ */ __name((nowMs) => {
|
|
287
|
+
restartAttemptTimes = restartAttemptTimes.filter(
|
|
288
|
+
(attemptMs) => nowMs - attemptMs < restartPolicy.windowMs
|
|
289
|
+
);
|
|
290
|
+
}, "pruneRestartAttempts");
|
|
291
|
+
const canScheduleRestart = /* @__PURE__ */ __name((nowMs) => {
|
|
292
|
+
pruneRestartAttempts(nowMs);
|
|
293
|
+
return restartAttemptTimes.length < restartPolicy.maxRestarts;
|
|
294
|
+
}, "canScheduleRestart");
|
|
295
|
+
const nextRestartDelayMs = /* @__PURE__ */ __name(() => {
|
|
296
|
+
const index = Math.min(
|
|
297
|
+
restartAttemptTimes.length,
|
|
298
|
+
restartPolicy.delaysMs.length - 1
|
|
299
|
+
);
|
|
300
|
+
return restartPolicy.delaysMs[index] ?? 0;
|
|
301
|
+
}, "nextRestartDelayMs");
|
|
302
|
+
const setExited = /* @__PURE__ */ __name((state, code, signal, error) => {
|
|
303
|
+
const next = {
|
|
304
|
+
...snapshot,
|
|
305
|
+
state,
|
|
306
|
+
exitCode: code,
|
|
307
|
+
signal,
|
|
308
|
+
lastExitAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
309
|
+
};
|
|
310
|
+
if (error) {
|
|
311
|
+
next.error = error;
|
|
312
|
+
} else {
|
|
313
|
+
delete next.error;
|
|
314
|
+
}
|
|
315
|
+
snapshot = {
|
|
316
|
+
...next
|
|
317
|
+
};
|
|
318
|
+
}, "setExited");
|
|
319
|
+
const scheduleRestart = /* @__PURE__ */ __name(() => {
|
|
320
|
+
if (stopping) return false;
|
|
321
|
+
const nowMs = Date.now();
|
|
322
|
+
if (!canScheduleRestart(nowMs)) {
|
|
323
|
+
const lastError = snapshot.error;
|
|
324
|
+
snapshot = {
|
|
325
|
+
...snapshot,
|
|
326
|
+
state: "failed",
|
|
327
|
+
error: lastError ? `Channel worker restart budget exhausted. Last error: ${lastError}` : "Channel worker restart budget exhausted.",
|
|
328
|
+
nextRestartAt: void 0
|
|
329
|
+
};
|
|
330
|
+
return false;
|
|
331
|
+
}
|
|
332
|
+
clearRestartTimer();
|
|
333
|
+
const delayMs = nextRestartDelayMs();
|
|
334
|
+
const nextRestartAt = new Date(nowMs + delayMs).toISOString();
|
|
335
|
+
snapshot = {
|
|
336
|
+
...snapshot,
|
|
337
|
+
nextRestartAt
|
|
338
|
+
};
|
|
339
|
+
restartTimer = setTimeout(() => {
|
|
340
|
+
restartTimer = void 0;
|
|
341
|
+
void launch("restart").catch((err) => {
|
|
342
|
+
handleRestartFailure(err instanceof Error ? err.message : String(err));
|
|
343
|
+
});
|
|
344
|
+
}, delayMs);
|
|
345
|
+
restartTimer.unref();
|
|
346
|
+
return true;
|
|
347
|
+
}, "scheduleRestart");
|
|
348
|
+
const handleRestartFailure = /* @__PURE__ */ __name((error, redaction) => {
|
|
349
|
+
snapshot = {
|
|
350
|
+
...snapshot,
|
|
351
|
+
state: "failed",
|
|
352
|
+
error: sanitizeWorkerError(error, redaction)
|
|
353
|
+
};
|
|
354
|
+
scheduleRestart();
|
|
355
|
+
notifyExit(opts.onExit, snapshotCopy());
|
|
356
|
+
}, "handleRestartFailure");
|
|
357
|
+
const armStaleHeartbeatTimer = /* @__PURE__ */ __name((startedChild) => {
|
|
358
|
+
clearStaleHeartbeatTimer();
|
|
359
|
+
if (heartbeatTimeoutMs <= 0) return;
|
|
360
|
+
staleHeartbeatTimer = setTimeout(() => {
|
|
361
|
+
if (child !== startedChild || stopping) return;
|
|
362
|
+
snapshot = {
|
|
363
|
+
...snapshot,
|
|
364
|
+
error: "Channel worker heartbeat timed out.",
|
|
365
|
+
staleHeartbeatAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
366
|
+
};
|
|
367
|
+
startedChild.kill("SIGKILL");
|
|
368
|
+
}, heartbeatTimeoutMs);
|
|
369
|
+
staleHeartbeatTimer.unref();
|
|
370
|
+
}, "armStaleHeartbeatTimer");
|
|
371
|
+
const launch = /* @__PURE__ */ __name(async (kind) => {
|
|
372
|
+
clearStaleHeartbeatTimer();
|
|
373
|
+
const argv = [
|
|
374
|
+
opts.cliEntryPath,
|
|
375
|
+
"channel",
|
|
376
|
+
"daemon-worker",
|
|
377
|
+
...selectionChannelArgs(opts.selection)
|
|
378
|
+
];
|
|
379
|
+
const env = createWorkerEnv({
|
|
380
|
+
daemonUrl: opts.daemonUrl,
|
|
381
|
+
workspace: opts.workspace,
|
|
382
|
+
...opts.daemonToken ? { daemonToken: opts.daemonToken } : {}
|
|
383
|
+
});
|
|
384
|
+
const redaction = workerLogRedactionOptions(opts.daemonToken, env);
|
|
385
|
+
const requestedChannels = requestedChannelNames(opts.selection);
|
|
386
|
+
const startedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
387
|
+
snapshot = {
|
|
388
|
+
enabled: true,
|
|
389
|
+
state: "starting",
|
|
390
|
+
channels: channelSelectionNames(opts.selection),
|
|
391
|
+
...requestedChannels ? { requestedChannels } : {},
|
|
392
|
+
startedAt,
|
|
393
|
+
restartCount: snapshot.restartCount ?? 0,
|
|
394
|
+
...snapshot.lastExitAt ? { lastExitAt: snapshot.lastExitAt } : {},
|
|
395
|
+
...snapshot.lastHeartbeatAt ? { lastHeartbeatAt: snapshot.lastHeartbeatAt } : {},
|
|
396
|
+
...snapshot.staleHeartbeatAt ? { staleHeartbeatAt: snapshot.staleHeartbeatAt } : {}
|
|
397
|
+
};
|
|
398
|
+
if (kind === "restart") {
|
|
399
|
+
const nowMs = Date.now();
|
|
400
|
+
restartAttemptTimes.push(nowMs);
|
|
401
|
+
snapshot = {
|
|
402
|
+
...snapshot,
|
|
403
|
+
restartCount: (snapshot.restartCount ?? 0) + 1,
|
|
404
|
+
lastRestartAt: new Date(nowMs).toISOString(),
|
|
405
|
+
nextRestartAt: void 0
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
let startedChild;
|
|
409
|
+
try {
|
|
410
|
+
startedChild = spawnWorker(process.execPath, argv, {
|
|
411
|
+
cwd: opts.workspace,
|
|
412
|
+
env,
|
|
413
|
+
stdio: ["ignore", "pipe", "pipe", "ipc"]
|
|
414
|
+
});
|
|
415
|
+
} catch (err) {
|
|
416
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
417
|
+
const error = sanitizeWorkerError(message, redaction);
|
|
418
|
+
if (kind === "initial") {
|
|
419
|
+
snapshot = {
|
|
420
|
+
...snapshot,
|
|
421
|
+
state: "failed",
|
|
422
|
+
error
|
|
423
|
+
};
|
|
424
|
+
throw new Error(error);
|
|
425
|
+
}
|
|
426
|
+
handleRestartFailure(message, redaction);
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
child = startedChild;
|
|
430
|
+
attachWorkerLogStream(startedChild.stdout, "stdout", {
|
|
431
|
+
...redaction,
|
|
432
|
+
onLog: opts.onLog
|
|
433
|
+
});
|
|
434
|
+
attachWorkerLogStream(startedChild.stderr, "stderr", {
|
|
435
|
+
...redaction,
|
|
436
|
+
onLog: opts.onLog
|
|
437
|
+
});
|
|
438
|
+
if (startedChild.pid !== void 0) {
|
|
439
|
+
snapshot = { ...snapshot, pid: startedChild.pid };
|
|
440
|
+
}
|
|
441
|
+
await new Promise((resolve, reject) => {
|
|
442
|
+
let settled = false;
|
|
443
|
+
let ready = false;
|
|
444
|
+
let exitObserved = false;
|
|
445
|
+
let terminatingBeforeReady = false;
|
|
446
|
+
let startupTimer;
|
|
447
|
+
const cleanupStartupTimer = /* @__PURE__ */ __name(() => {
|
|
448
|
+
if (!startupTimer) return;
|
|
449
|
+
clearTimeout(startupTimer);
|
|
450
|
+
startupTimer = void 0;
|
|
451
|
+
}, "cleanupStartupTimer");
|
|
452
|
+
const cleanupLaunch = /* @__PURE__ */ __name(() => {
|
|
453
|
+
cleanupStartupTimer();
|
|
454
|
+
startedChild.removeListener("message", handleMessage);
|
|
455
|
+
clearStaleHeartbeatTimer();
|
|
456
|
+
}, "cleanupLaunch");
|
|
457
|
+
const terminateBeforeReady = /* @__PURE__ */ __name(() => {
|
|
458
|
+
cleanupLaunch();
|
|
459
|
+
if (terminatingBeforeReady) return;
|
|
460
|
+
terminatingBeforeReady = true;
|
|
461
|
+
const exited = waitForExit(startedChild, 2e3);
|
|
462
|
+
startedChild.kill("SIGTERM");
|
|
463
|
+
void exited.then(async (didExit) => {
|
|
464
|
+
if (!didExit && child === startedChild && !exitObserved) {
|
|
465
|
+
const killed = waitForExit(startedChild, 2e3);
|
|
466
|
+
startedChild.kill("SIGKILL");
|
|
467
|
+
if (!await killed && child === startedChild && !exitObserved) {
|
|
468
|
+
child = void 0;
|
|
469
|
+
if (kind === "restart" && !stopping) {
|
|
470
|
+
scheduleRestart();
|
|
471
|
+
notifyExit(opts.onExit, snapshotCopy());
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
});
|
|
476
|
+
}, "terminateBeforeReady");
|
|
477
|
+
const failBeforeReady = /* @__PURE__ */ __name((err) => {
|
|
478
|
+
if (settled) return;
|
|
479
|
+
settled = true;
|
|
480
|
+
cleanupStartupTimer();
|
|
481
|
+
if (kind === "initial") {
|
|
482
|
+
reject(err);
|
|
483
|
+
} else {
|
|
484
|
+
resolve();
|
|
485
|
+
}
|
|
486
|
+
}, "failBeforeReady");
|
|
487
|
+
const completeReady = /* @__PURE__ */ __name((message) => {
|
|
488
|
+
if (settled || child !== startedChild) return;
|
|
489
|
+
settled = true;
|
|
490
|
+
ready = true;
|
|
491
|
+
cleanupStartupTimer();
|
|
492
|
+
const next = {
|
|
493
|
+
...snapshot,
|
|
494
|
+
state: "running",
|
|
495
|
+
pid: message.pid ?? startedChild.pid,
|
|
496
|
+
channels: message.channels && message.channels.length > 0 ? [...message.channels] : [...snapshot.channels]
|
|
497
|
+
};
|
|
498
|
+
delete next.error;
|
|
499
|
+
delete next.lastHeartbeatAt;
|
|
500
|
+
delete next.nextRestartAt;
|
|
501
|
+
delete next.staleHeartbeatAt;
|
|
502
|
+
if (message.requestedChannels?.length) {
|
|
503
|
+
next.requestedChannels = [...message.requestedChannels];
|
|
504
|
+
}
|
|
505
|
+
snapshot = next;
|
|
506
|
+
armStaleHeartbeatTimer(startedChild);
|
|
507
|
+
notifyReady(opts.onReady, snapshotCopy());
|
|
508
|
+
resolve();
|
|
509
|
+
}, "completeReady");
|
|
510
|
+
const handleHeartbeat = /* @__PURE__ */ __name((message) => {
|
|
511
|
+
if (!ready || child !== startedChild) return;
|
|
512
|
+
const currentPid = snapshot.pid ?? startedChild.pid;
|
|
513
|
+
if (message.pid !== void 0 && currentPid !== void 0) {
|
|
514
|
+
if (message.pid !== currentPid) return;
|
|
515
|
+
}
|
|
516
|
+
snapshot = {
|
|
517
|
+
...snapshot,
|
|
518
|
+
lastHeartbeatAt: message.at ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
519
|
+
};
|
|
520
|
+
armStaleHeartbeatTimer(startedChild);
|
|
521
|
+
}, "handleHeartbeat");
|
|
522
|
+
function handleMessage(message) {
|
|
523
|
+
if (child !== startedChild) return;
|
|
524
|
+
if (!ready && isReadyMessage(message)) {
|
|
525
|
+
completeReady(message);
|
|
526
|
+
} else if (isHeartbeatMessage(message)) {
|
|
527
|
+
handleHeartbeat(message);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
__name(handleMessage, "handleMessage");
|
|
531
|
+
function settleExit(code, signal) {
|
|
532
|
+
if (child !== startedChild) return;
|
|
533
|
+
exitObserved = true;
|
|
534
|
+
cleanupLaunch();
|
|
535
|
+
const state = ready ? "exited" : "failed";
|
|
536
|
+
const message = `Channel worker exited before ready (code=${code ?? "null"}, signal=${signal ?? "null"}).`;
|
|
537
|
+
setExited(
|
|
538
|
+
state,
|
|
539
|
+
code,
|
|
540
|
+
signal,
|
|
541
|
+
snapshot.error ?? (ready ? void 0 : sanitizeWorkerError(message, redaction))
|
|
542
|
+
);
|
|
543
|
+
child = void 0;
|
|
544
|
+
if ((ready || kind === "restart") && !stopping) {
|
|
545
|
+
scheduleRestart();
|
|
546
|
+
notifyExit(opts.onExit, snapshotCopy());
|
|
547
|
+
}
|
|
548
|
+
if (!settled) {
|
|
549
|
+
failBeforeReady(new Error(snapshot.error ?? message));
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
__name(settleExit, "settleExit");
|
|
553
|
+
function settleError(err) {
|
|
554
|
+
if (child !== startedChild || exitObserved) return;
|
|
555
|
+
if (settled && ready) {
|
|
556
|
+
snapshot = {
|
|
557
|
+
...snapshot,
|
|
558
|
+
error: sanitizeWorkerError(err.message, redaction)
|
|
559
|
+
};
|
|
560
|
+
startedChild.kill("SIGTERM");
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
snapshot = {
|
|
564
|
+
...snapshot,
|
|
565
|
+
state: "failed",
|
|
566
|
+
error: sanitizeWorkerError(err.message, redaction)
|
|
567
|
+
};
|
|
568
|
+
terminateBeforeReady();
|
|
569
|
+
if (!settled) {
|
|
570
|
+
failBeforeReady(new Error(snapshot.error));
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
__name(settleError, "settleError");
|
|
574
|
+
startupTimer = setTimeout(() => {
|
|
575
|
+
const timeoutMs = opts.startupTimeoutMs ?? DEFAULT_CHANNEL_WORKER_STARTUP_TIMEOUT_MS;
|
|
576
|
+
const error = `Channel worker did not become ready within ${timeoutMs}ms.`;
|
|
577
|
+
snapshot = {
|
|
578
|
+
...snapshot,
|
|
579
|
+
state: "failed",
|
|
580
|
+
error: sanitizeWorkerError(error, redaction)
|
|
581
|
+
};
|
|
582
|
+
failBeforeReady(new Error(error));
|
|
583
|
+
if (child === startedChild) {
|
|
584
|
+
terminateBeforeReady();
|
|
585
|
+
}
|
|
586
|
+
}, opts.startupTimeoutMs ?? DEFAULT_CHANNEL_WORKER_STARTUP_TIMEOUT_MS);
|
|
587
|
+
startupTimer.unref();
|
|
588
|
+
startedChild.on("message", handleMessage);
|
|
589
|
+
startedChild.once("exit", settleExit);
|
|
590
|
+
startedChild.once("error", settleError);
|
|
591
|
+
});
|
|
592
|
+
}, "launch");
|
|
593
|
+
return {
|
|
594
|
+
async start() {
|
|
595
|
+
if (child) return;
|
|
596
|
+
stopping = false;
|
|
597
|
+
clearRestartTimer();
|
|
598
|
+
restartAttemptTimes = [];
|
|
599
|
+
await launch("initial");
|
|
600
|
+
},
|
|
601
|
+
async stop() {
|
|
602
|
+
clearRestartTimer();
|
|
603
|
+
clearStaleHeartbeatTimer();
|
|
604
|
+
if (!child || snapshot.state === "exited" || snapshot.state === "failed" && hasObservedExit(snapshot) || snapshot.state === "stopped") {
|
|
605
|
+
child = void 0;
|
|
606
|
+
snapshot = { ...snapshot, state: "stopped" };
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
const exited = waitForExit(child, 5e3);
|
|
610
|
+
stopping = true;
|
|
611
|
+
child.kill("SIGTERM");
|
|
612
|
+
if (!await exited) {
|
|
613
|
+
const killed = waitForExit(child, 2e3);
|
|
614
|
+
child.kill("SIGKILL");
|
|
615
|
+
if (!await killed) {
|
|
616
|
+
child = void 0;
|
|
617
|
+
stopping = false;
|
|
618
|
+
snapshot = {
|
|
619
|
+
...snapshot,
|
|
620
|
+
state: "failed",
|
|
621
|
+
signal: "SIGKILL",
|
|
622
|
+
error: "Channel worker did not exit after SIGKILL."
|
|
623
|
+
};
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
child = void 0;
|
|
628
|
+
stopping = false;
|
|
629
|
+
snapshot = { ...snapshot, state: "stopped" };
|
|
630
|
+
},
|
|
631
|
+
killAllSync() {
|
|
632
|
+
if (!child || snapshot.state === "exited" || snapshot.state === "failed" && hasObservedExit(snapshot) || snapshot.state === "stopped") {
|
|
633
|
+
clearRestartTimer();
|
|
634
|
+
clearStaleHeartbeatTimer();
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
const preserveFailure = snapshot.state === "failed" && !hasObservedExit(snapshot);
|
|
638
|
+
clearRestartTimer();
|
|
639
|
+
clearStaleHeartbeatTimer();
|
|
640
|
+
stopping = true;
|
|
641
|
+
child.kill("SIGKILL");
|
|
642
|
+
child = void 0;
|
|
643
|
+
if (!preserveFailure) {
|
|
644
|
+
snapshot = {
|
|
645
|
+
...snapshot,
|
|
646
|
+
state: "stopped",
|
|
647
|
+
signal: "SIGKILL"
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
},
|
|
651
|
+
snapshot() {
|
|
652
|
+
return snapshotCopy();
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
__name(createChannelWorkerSupervisor, "createChannelWorkerSupervisor");
|
|
657
|
+
export {
|
|
658
|
+
createChannelWorkerSupervisor
|
|
659
|
+
};
|