@qwen-code/qwen-code 0.21.11-preview.0 → 0.21.12-preview.1
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/coordinate/SKILL.md +52 -0
- package/bundled/qc-helper/docs/configuration/model-providers.md +10 -8
- package/bundled/qc-helper/docs/features/_meta.ts +1 -0
- package/bundled/qc-helper/docs/features/arena.md +4 -3
- package/bundled/qc-helper/docs/features/commands.md +7 -6
- package/bundled/qc-helper/docs/features/dual-output.md +5 -0
- package/bundled/qc-helper/docs/features/headless.md +8 -0
- package/bundled/qc-helper/docs/features/multi-agent-coordination.md +30 -0
- package/bundled/qc-helper/docs/qwen-serve.md +7 -7
- package/bundled/review/SKILL.md +17 -7
- package/chunks/{MaxSizedBox-FVSXOMKP.js → MaxSizedBox-VSAJNP52.js} +49 -48
- package/chunks/{StandaloneSessionPicker-Q27UAQ3X.js → StandaloneSessionPicker-N5MC42M2.js} +73 -70
- package/chunks/{acp-startup-profiler-VNTFWYAC.js → acp-startup-profiler-JMJBZDVO.js} +2 -2
- package/chunks/{acpAgent-C6TV2BIU.js → acpAgent-GUV7LTDH.js} +1143 -317
- package/chunks/{agent-IPODFZTU.js → agent-WJT3BALC.js} +45 -44
- package/chunks/agent-headless-JRRUUVP3.js +87 -0
- package/chunks/{anthropicContentGenerator-D3Y4RFT4.js → anthropicContentGenerator-4JSC3ZFL.js} +27 -27
- package/chunks/{artifact-tool-N652YE4L.js → artifact-tool-FRMBPDPB.js} +5 -5
- package/chunks/{askUserQuestion-ONW74PKJ.js → askUserQuestion-7G3LI3IZ.js} +2 -2
- package/chunks/{bridge-YX2R6VVM.js → bridge-VB3BPG7G.js} +50 -49
- package/chunks/{build-GDBLPA24.js → build-RZS65IIX.js} +1 -1
- package/chunks/{ca-ZLKAB4K3.js → ca-4CQ6MYNQ.js} +2 -1
- package/chunks/{channel-management-service-PHELKOW2.js → channel-management-service-SKAN6NOB.js} +6 -6
- package/chunks/channel-settings-store-UM7JZEW7.js +102 -0
- package/chunks/{channel-worker-group-WQP4RCDO.js → channel-worker-group-YPTB5ASD.js} +8 -7
- package/chunks/{channel-worker-manager-MRDFAKIM.js → channel-worker-manager-4EHJSPRH.js} +8 -7
- package/chunks/{channel-worker-supervisor-IVSDIMI4.js → channel-worker-supervisor-DZKHYFHV.js} +6 -5
- package/chunks/{chunk-J6SZID63.js → chunk-2AZMF6G5.js} +2 -2
- package/chunks/{chunk-2IIJTXYF.js → chunk-2SB4SLKC.js} +3 -1
- package/chunks/{chunk-VKJ4KTPJ.js → chunk-3GCU5O2E.js} +1 -1
- package/chunks/{chunk-PDUIXSYP.js → chunk-3SIXC6QC.js} +7 -7
- package/chunks/{chunk-Q3JQ7OSU.js → chunk-3XZYK76R.js} +2 -2
- package/chunks/{chunk-SVY7G3WS.js → chunk-3ZLUA4GV.js} +9 -9
- package/chunks/{chunk-6CONQTS2.js → chunk-45TYWBCB.js} +1 -1
- package/chunks/{chunk-OWMAZHIX.js → chunk-47FQVRCO.js} +1 -1
- package/chunks/{chunk-VNNWAZSI.js → chunk-4W25XH7F.js} +7 -7
- package/chunks/{chunk-VVSMEI6C.js → chunk-5AWARYOK.js} +22 -101
- package/chunks/{chunk-I7XTOGIS.js → chunk-5DDUYIY6.js} +7 -7
- package/chunks/{chunk-HV76SFIA.js → chunk-5HBFERG5.js} +3 -3
- package/chunks/{chunk-IIJEYBNH.js → chunk-5PWLQ7SK.js} +191 -61
- package/chunks/{chunk-BSI645OU.js → chunk-5TXOGH4I.js} +3 -3
- package/chunks/{chunk-BO2VRKY2.js → chunk-67LXZ6LV.js} +7 -7
- package/chunks/{chunk-KHLBIO6M.js → chunk-6LK2QPIA.js} +11 -11
- package/chunks/{chunk-WAUGQKUU.js → chunk-6LYDH7VT.js} +9 -5
- package/chunks/{chunk-S6HYI3MF.js → chunk-6S52N6PG.js} +2 -2
- package/chunks/{chunk-DZUO626D.js → chunk-6XZERB6P.js} +5 -5
- package/chunks/{chunk-FVKHVJZQ.js → chunk-732MOPEM.js} +1 -1
- package/chunks/{chunk-5C7FDVHB.js → chunk-7L64FSYQ.js} +55 -477
- package/chunks/{chunk-V3KCCRKA.js → chunk-7N6WK2W6.js} +3 -3
- package/chunks/chunk-7P32M35F.js +51 -0
- package/chunks/{chunk-T3FNRMFJ.js → chunk-7PBUQKMT.js} +1 -1
- package/chunks/{chunk-WCG5O7IP.js → chunk-7SUQZ7QH.js} +2 -2
- package/chunks/{chunk-LU7RJB2W.js → chunk-A7M57KOL.js} +8 -8
- package/chunks/{chunk-6WIKTX4C.js → chunk-ABGS4FDQ.js} +1 -1
- package/chunks/{chunk-DVQECPGW.js → chunk-AJL3SAZG.js} +12 -12
- package/chunks/{chunk-NV3F44FL.js → chunk-AMXMM7DH.js} +2 -2
- package/chunks/{chunk-UVX4Y6IN.js → chunk-AQHNAA7E.js} +1 -1
- package/chunks/{chunk-TG3IUQ6M.js → chunk-C2VGLLNA.js} +4 -4
- package/chunks/{chunk-H6XPXXMH.js → chunk-CQ35AJ4Z.js} +252 -254
- package/chunks/{chunk-COBO5EBO.js → chunk-CTQE2NB2.js} +1 -1
- package/chunks/{chunk-PWYEWOZM.js → chunk-CX2MARRJ.js} +1 -1
- package/chunks/{chunk-E2FPSSKP.js → chunk-DEG7R6Z6.js} +57 -13
- package/chunks/{chunk-A6PSUNCY.js → chunk-DEVFUPC5.js} +8 -8
- package/chunks/{chunk-RKCPPZV6.js → chunk-DGM2XA3R.js} +1 -1
- package/chunks/{chunk-4P66JPNV.js → chunk-DNRV2US3.js} +5 -5
- package/chunks/{chunk-TYAMGABM.js → chunk-E3GLDLYB.js} +6 -0
- package/chunks/{chunk-L2AFWWJE.js → chunk-E5BWLU5J.js} +50 -5
- package/chunks/{chunk-7C7RTJPC.js → chunk-EAJESCBT.js} +7 -9
- package/chunks/{chunk-KKBPOU75.js → chunk-EFIMD5VA.js} +1 -1
- package/chunks/{chunk-CTJLZLB5.js → chunk-EN2J77G7.js} +1 -1
- package/chunks/{chunk-67EWJE77.js → chunk-ENEEQMGM.js} +1 -1
- package/chunks/{chunk-CPG6P4GG.js → chunk-EYS3GGM3.js} +1 -1
- package/chunks/{chunk-4PYCZH2V.js → chunk-EYW54TBD.js} +3 -3
- package/chunks/{chunk-FOGU3LJX.js → chunk-F6AOBFUN.js} +1 -1
- package/chunks/{chunk-F32C6V5B.js → chunk-FLUYVAQZ.js} +3 -3
- package/chunks/{chunk-7WUUNAJP.js → chunk-FMLUVVQ6.js} +3 -3
- package/chunks/{chunk-ZBVS26BY.js → chunk-FPGTNKCP.js} +7 -5
- package/chunks/{chunk-HOUK5CR2.js → chunk-FWJRWCKU.js} +6 -6
- package/chunks/{chunk-HGBUHVFO.js → chunk-G4C5RLX6.js} +3 -3
- package/chunks/{chunk-EI3HZX6C.js → chunk-GJJQV4PY.js} +1 -1
- package/chunks/{chunk-CKASRHZI.js → chunk-GLWWPFTW.js} +1 -1
- package/chunks/{chunk-2Z6PYTOK.js → chunk-GQW6P73F.js} +1 -1
- package/chunks/{chunk-GM463R2B.js → chunk-GZGDJ4E6.js} +1 -1
- package/chunks/{chunk-YGT2AUJ7.js → chunk-HB6QW4LM.js} +37 -20
- package/chunks/{chunk-W5UC37EE.js → chunk-HHGQGTJQ.js} +2 -0
- package/chunks/chunk-HHJLM3WQ.js +41 -0
- package/chunks/{chunk-6ZRFAKXK.js → chunk-IEP44U2R.js} +1 -1
- package/chunks/{chunk-O3VWAZLP.js → chunk-INQN4KIA.js} +871 -1033
- package/chunks/{chunk-AOHJKPKL.js → chunk-IQFYO5BF.js} +1 -1
- package/chunks/{chunk-UDXSXLER.js → chunk-IW6RQPQB.js} +14 -4
- package/chunks/{chunk-XCWO3SMQ.js → chunk-IX7CFQGA.js} +3 -3
- package/chunks/{chunk-6S4NCX23.js → chunk-JO45C3OY.js} +3 -3
- package/chunks/{chunk-HDHLWOG5.js → chunk-JRRZFO4A.js} +2 -2
- package/chunks/{chunk-OQTXYMKW.js → chunk-JS4Q5NG5.js} +3 -3
- package/chunks/{chunk-UMEB4DHF.js → chunk-JWXBLIQL.js} +4 -4
- package/chunks/{chunk-PBRVUF5B.js → chunk-K7JW6V5O.js} +1 -1
- package/chunks/{chunk-ZZCWJWTF.js → chunk-KNQZXSLW.js} +9 -3
- package/chunks/{chunk-M6HMMKVG.js → chunk-KPVVWKF3.js} +1 -1
- package/chunks/{chunk-MVUQRLOH.js → chunk-KT4OWAAZ.js} +3 -3
- package/chunks/{chunk-W4RQUHY3.js → chunk-L2GTEEEU.js} +142 -23
- package/chunks/{chunk-X7XXP7CN.js → chunk-L2O7DJIE.js} +2 -2
- package/chunks/{chunk-BCZ2TTSH.js → chunk-LCWRQA5U.js} +1 -1
- package/chunks/{chunk-22C7BQ6D.js → chunk-LHOG4E6Y.js} +3 -3
- package/chunks/{chunk-3WOZVMGJ.js → chunk-LOJO2RPW.js} +7 -7
- package/chunks/{chunk-DX3RGJMS.js → chunk-LT532KF4.js} +71 -12
- package/chunks/{chunk-JT7XS4YW.js → chunk-M2NMFAFR.js} +1 -1
- package/chunks/{chunk-P6RBCBBE.js → chunk-M2S67TPJ.js} +3 -3
- package/chunks/{chunk-AJ6LQ5A6.js → chunk-M3QYOPGN.js} +1 -1
- package/chunks/{chunk-AZQ3DT76.js → chunk-M4NWDIFU.js} +1 -1
- package/chunks/{chunk-YTFDX4PR.js → chunk-M6NDLY2T.js} +1 -1
- package/chunks/{chunk-X76PVMPQ.js → chunk-MJ5FMYVQ.js} +3 -3
- package/chunks/{chunk-EKPKKXY2.js → chunk-MLZCPGDX.js} +1 -1
- package/chunks/{chunk-CQGGDOR5.js → chunk-MM4XBXF7.js} +1 -1
- package/chunks/{chunk-UHJ5S7DF.js → chunk-MMH3GO4Z.js} +11 -11
- package/chunks/{chunk-OIVKILPI.js → chunk-MPBRV3UU.js} +3 -0
- package/chunks/{chunk-VFMASYQA.js → chunk-MS7GNABG.js} +3 -0
- package/chunks/{chunk-2FRY5CRX.js → chunk-MWZYNOCG.js} +3 -3
- package/chunks/chunk-N2TNM3QB.js +9 -0
- package/chunks/{chunk-7MH4J33A.js → chunk-N7NBMAMW.js} +2 -2
- package/chunks/{chunk-EUNWC2VS.js → chunk-NC4O6UE6.js} +2 -2
- package/chunks/{chunk-HUWENAHO.js → chunk-NWPO6I7V.js} +1 -1
- package/chunks/{chunk-SR7RZ4MS.js → chunk-O4BBDP2G.js} +2 -2
- package/chunks/{chunk-4TRQPFDP.js → chunk-O5AZPHYZ.js} +6 -8
- package/chunks/{chunk-XGLVQQ6F.js → chunk-OH5UKBLL.js} +4 -4
- package/chunks/{chunk-PIA35YOG.js → chunk-OLU7GIF4.js} +14 -45
- package/chunks/{chunk-DA4HRSBW.js → chunk-OPBATTFQ.js} +1 -1
- package/chunks/{chunk-7S4DYMFG.js → chunk-OSPIZEAM.js} +34 -23
- package/chunks/{chunk-K4QON4BH.js → chunk-OYLNJPY3.js} +61 -364
- package/chunks/{chunk-DREZZAZM.js → chunk-P2UCMHDT.js} +14 -6
- package/chunks/chunk-PDKLO2DN.js +526 -0
- package/chunks/{chunk-TZ3FN4B2.js → chunk-PRWGIKKU.js} +5 -5
- package/chunks/{chunk-FYTHSJDQ.js → chunk-Q6FGSG6B.js} +2 -2
- package/chunks/{chunk-VBU76UYP.js → chunk-QIN5P5BP.js} +315 -1081
- package/chunks/{chunk-2UUMVNYT.js → chunk-QTI7SRXI.js} +3 -3
- package/chunks/{chunk-B2GJNDTV.js → chunk-QUESTNOP.js} +1 -1
- package/chunks/{chunk-6Q5ABMTU.js → chunk-QZ5G26ZE.js} +36 -32
- package/chunks/{chunk-7OFX3YZW.js → chunk-RE6JD2BH.js} +1 -1
- package/chunks/{chunk-QUI267ZP.js → chunk-SAQHDAUJ.js} +42 -8
- package/chunks/{chunk-UXV3DYVT.js → chunk-SZ36WFVK.js} +1 -1
- package/chunks/{chunk-FTO3P6PZ.js → chunk-T2VEHZH3.js} +3 -3
- package/chunks/{chunk-TZEZYNYD.js → chunk-T4FTABSW.js} +1 -1
- package/chunks/chunk-T5ZFG4CI.js +830 -0
- package/chunks/{chunk-SEZ556DZ.js → chunk-T6W4KACQ.js} +1 -1
- package/chunks/{chunk-3P2LV43B.js → chunk-TBVNYG5B.js} +5 -5
- package/chunks/{chunk-EV3LZGGK.js → chunk-TKAEODJR.js} +572 -42
- package/chunks/{chunk-TCRQD7F6.js → chunk-U6LT3QBF.js} +1 -1
- package/chunks/{chunk-EQL65XGA.js → chunk-V3LXMASR.js} +47 -21
- package/chunks/{chunk-MTE6R5HF.js → chunk-VESDV72K.js} +3 -3
- package/chunks/{chunk-SKSOLRPK.js → chunk-VO52SIZW.js} +3 -3
- package/chunks/{chunk-ZUIOLZ4V.js → chunk-VUFEW3SF.js} +8471 -2375
- package/chunks/{chunk-E2XBEWAK.js → chunk-VUTOKX6F.js} +650 -129
- package/chunks/{chunk-5BRSWOSC.js → chunk-WFBG4MF5.js} +4 -4
- package/chunks/chunk-WLML6VIA.js +18 -0
- package/chunks/{chunk-ONSZH6VM.js → chunk-WQOE4IYF.js} +3 -3
- package/chunks/{chunk-PFWPBYL2.js → chunk-XAAL4IFG.js} +3 -3
- package/chunks/{chunk-UO2N5QWP.js → chunk-XDN6SMAQ.js} +27 -4
- package/chunks/{chunk-GNPNYXJB.js → chunk-XLQS3VI6.js} +2 -2
- package/chunks/{chunk-PYQADEFD.js → chunk-XTH2OMDS.js} +1 -1
- package/chunks/chunk-XYVBANG5.js +336 -0
- package/chunks/{chunk-Y3NNBNGM.js → chunk-YQB3HSQ7.js} +6 -6
- package/chunks/{chunk-WOJZWRAZ.js → chunk-YRLW2MSX.js} +1 -1
- package/chunks/{chunk-LHEC5V6G.js → chunk-YTYPRVIZ.js} +2 -2
- package/chunks/chunk-Z7B6SRPM.js +32 -0
- package/chunks/chunk-ZBBVBZBR.js +137 -0
- package/chunks/{chunk-MFDYOYZZ.js → chunk-ZGWY4YUB.js} +27 -4
- package/chunks/{chunk-B7SQOICP.js → chunk-ZIS5I56G.js} +4 -4
- package/chunks/{chunk-IA7TGCN2.js → chunk-ZV4XVYL3.js} +4 -4
- package/chunks/{chunk-PJRW65JO.js → chunk-ZWPWQEF5.js} +1 -1
- package/chunks/{chunk-DCGYLIYO.js → chunk-ZXUMPZRT.js} +5 -5
- package/chunks/chunk-bdqvmfwv-OHYAFAAO.js +17446 -0
- package/chunks/{computer-use-5LGM2YO5.js → computer-use-YOYLKIHT.js} +48 -47
- package/chunks/{config-utils-ULCSRMWD.js → config-utils-TXVKR27S.js} +6 -6
- package/chunks/{contextCommand-JT44ADUD.js → contextCommand-KZMV5EOI.js} +47 -46
- package/chunks/{core-runtime-XHEJM2VB.js → core-runtime-VFUL2R7U.js} +45 -44
- package/chunks/{create-sub-session-UQBDJF5G.js → create-sub-session-EZW2NP4Z.js} +45 -44
- package/chunks/{create-sub-session-QIDZUOPU.js → create-sub-session-Y4WYDZGC.js} +2 -2
- package/chunks/{cron-create-VONA5JYY.js → cron-create-ZOVA3CC2.js} +4 -4
- package/chunks/{cron-delete-5JXSP2MI.js → cron-delete-7Z3H4LJY.js} +4 -4
- package/chunks/{cron-list-KE4F2CIR.js → cron-list-UHGX3IQG.js} +4 -4
- package/chunks/{daemon-GWD7BT6E.js → daemon-PXIC4ZDK.js} +186 -7
- package/chunks/daemon-status-provider-6L3ZKVVR.js +103 -0
- package/chunks/daemon-trust-policy-SZ3V4JEY.js +99 -0
- package/chunks/{daemon-trust-policy-monitor-LUMB46CL.js → daemon-trust-policy-monitor-HN34EJQ5.js} +52 -51
- package/chunks/{de-LIW4XVLN.js → de-UBEBKG6V.js} +2 -1
- package/chunks/{deferred-core-runtime-BFB6YRTZ.js → deferred-core-runtime-Z462KPKI.js} +47 -46
- package/chunks/{devtools-4QFYJT6U.js → devtools-X6ROTKHE.js} +1 -1
- package/chunks/dispatch-B53LNEO4.js +37 -0
- package/chunks/{display-image-NQRSIBXM.js → display-image-ZE3GZNIK.js} +4 -4
- package/chunks/{dist-Z3CS4OVP.js → dist-AVUYBK7L.js} +11 -5
- package/chunks/{dist-6BMOAE3Z.js → dist-BNWP6IZL.js} +4 -4
- package/chunks/{dist-EZE3V3Q7.js → dist-BW2LDPV3.js} +4 -4
- package/chunks/{dist-3NTTUAHT.js → dist-EFJILGIS.js} +3 -3
- package/chunks/{dist-OTUO3AS2.js → dist-KTYDJNYM.js} +14 -6
- package/chunks/{dist-B2CGTW6T.js → dist-NPS52B2V.js} +3 -3
- package/chunks/{dist-J47AXBZC.js → dist-PKSRQAR2.js} +3 -3
- package/chunks/{dist-EWW3J4HQ.js → dist-ZWDH5HLS.js} +3 -3
- package/chunks/{earlyInputCapture-GPULMO2H.js → earlyInputCapture-GSE6MMC7.js} +46 -45
- package/chunks/{edit-XYMQNMWU.js → edit-YJX2HMSA.js} +51 -50
- package/chunks/{en-SY5GTIGX.js → en-X6YV7GME.js} +2 -1
- package/chunks/{enter-worktree-TIASENJP.js → enter-worktree-H3GV4KQ7.js} +50 -49
- package/chunks/{enterPlanMode-K6LTIGWM.js → enterPlanMode-6LPSFIN2.js} +51 -50
- package/chunks/{environment-3XX7LUMG.js → environment-IVCQ3H7T.js} +48 -47
- package/chunks/{errors-VTFZ6M4W.js → errors-2K5VJQVK.js} +47 -46
- package/chunks/{exit-worktree-IBKPEHUJ.js → exit-worktree-QZC6DXGO.js} +50 -49
- package/chunks/exitPlanMode-UHGM7I4A.js +85 -0
- package/chunks/{fast-path-QOBSDLA6.js → fast-path-BDDOO4H6.js} +3 -3
- package/chunks/{fast-path-settings-RPAVBD7P.js → fast-path-settings-LNOFM2YP.js} +2 -2
- package/chunks/{fr-RQFO7U4P.js → fr-VENTC2BS.js} +2 -1
- package/chunks/{gemini-OCRXJUWF.js → gemini-VDUDROF7.js} +105 -104
- package/chunks/{geminiContentGenerator-VHSPCS6F.js → geminiContentGenerator-O4HYJOR7.js} +11 -11
- package/chunks/{glob-BVX4L3CM.js → glob-Z7VZDN7C.js} +52 -51
- package/chunks/{goal-tools-SWNB6GP4.js → goal-tools-JDK2SNMV.js} +4 -4
- package/chunks/{grep-CJSUX5NJ.js → grep-JQ6AGN62.js} +51 -50
- package/chunks/handleAutoUpdate-XZCLKEMR.js +94 -0
- package/chunks/{i18n-BPEDXABF.js → i18n-G2BMPGAS.js} +46 -45
- package/chunks/{image-gen-DEEXNNA2.js → image-gen-NMKTIERQ.js} +11 -11
- package/chunks/initializer-JEYFVIIG.js +100 -0
- package/chunks/{installationInfo-JCUKPGDB.js → installationInfo-GY2OCLIS.js} +46 -45
- package/chunks/{ja-KOZKHJHZ.js → ja-QHT4EQTO.js} +2 -1
- package/chunks/{keychain-token-storage-TVAMTNP7.js → keychain-token-storage-JTWUYFU7.js} +2 -2
- package/chunks/list-ZJ4GEKM4.js +103 -0
- package/chunks/{list-agents-Z4WABFDZ.js → list-agents-4GQ2XNEU.js} +2 -2
- package/chunks/loadedSettingsAdapter-5BO2PZLD.js +97 -0
- package/chunks/{loggingContentGenerator-MOOIBKKR.js → loggingContentGenerator-ER2Z5L3L.js} +59 -40
- package/chunks/{loop-wakeup-UZ5RL5Y2.js → loop-wakeup-HOQI3K5D.js} +5 -5
- package/chunks/{ls-TVHDGIES.js → ls-FSHISLLA.js} +6 -6
- package/chunks/{lsp-CVN6OQPI.js → lsp-APQJ5ZEZ.js} +2 -2
- package/chunks/{managed-npm-update-7K2LDL7V.js → managed-npm-update-X66EZDQD.js} +46 -45
- package/chunks/mcp-BDWPEXJF.js +97 -0
- package/chunks/{monitor-EXI73A5P.js → monitor-7J3DCMBL.js} +50 -49
- package/chunks/{node-UUDY34IG.js → node-YSOU44FX.js} +3 -3
- package/chunks/nonInteractiveCli-THJJIXKG.js +166 -0
- package/chunks/{notebook-edit-GKKQJQQU.js → notebook-edit-IX7GCTIL.js} +51 -50
- package/chunks/{openaiContentGenerator-NSPCP4FY.js → openaiContentGenerator-K65IDMQ6.js} +35 -35
- package/chunks/opentui-entry-L76XJNPE.js +47945 -0
- package/chunks/{pidfile-IU4ETBRE.js → pidfile-NNWTPHX2.js} +46 -45
- package/chunks/{processUtils-GZOVMFK4.js → processUtils-ILOXESNR.js} +2 -2
- package/chunks/{pt-U6AOCTMF.js → pt-VL3I5RNY.js} +2 -1
- package/chunks/{qwenContentGenerator-BBTNTOMB.js → qwenContentGenerator-YIKX3NHW.js} +54 -54
- package/chunks/{qwenOAuth2-D6L2W25Z.js → qwenOAuth2-BLYU65Y4.js} +10 -10
- package/chunks/read-file-GLBZFPNV.js +32 -0
- package/chunks/{read-mcp-resource-PZ4ZF6YL.js → read-mcp-resource-TJSJRH4F.js} +2 -2
- package/chunks/{record-artifact-P4HFMS7X.js → record-artifact-FXF5LHPE.js} +3 -3
- package/chunks/{resumeHistoryUtils-VUY4B6BO.js → resumeHistoryUtils-UMC4Y3E2.js} +54 -52
- package/chunks/ripGrep-53XOGSZ4.js +85 -0
- package/chunks/{ru-CMX4UMYP.js → ru-4RCKL4PY.js} +2 -1
- package/chunks/{run-qwen-serve-7BDTKCFP.js → run-qwen-serve-BTZ46CLW.js} +67 -60
- package/chunks/{runtime-VMWGIAX7.js → runtime-RQ3ACQKH.js} +58 -57
- package/chunks/runtime-gate-T4ICWGQJ.js +89 -0
- package/chunks/{scheduler-MUKPARY5.js → scheduler-WEIFVKQH.js} +47 -46
- package/chunks/{sdk-exporters-grpc-54L4LS5L.js → sdk-exporters-grpc-4QKV6MCX.js} +2 -2
- package/chunks/{sdk-exporters-http-XVTZQRCE.js → sdk-exporters-http-2VPMAPFI.js} +13 -13
- package/chunks/{sdk-impl-7W7AKCS4.js → sdk-impl-5W3JUCWF.js} +12 -12
- package/chunks/{send-message-CAMSLG2L.js → send-message-RBYLV5NY.js} +6 -6
- package/chunks/{serve-7G5R52HX.js → serve-RJUR5OJH.js} +52 -51
- package/chunks/{server-FTSWAHXF.js → server-WQ2ID4U7.js} +961 -322
- package/chunks/{session-FLUDUMZJ.js → session-O4OXRVNI.js} +124 -101
- package/chunks/{settings-CJVTBEW7.js → settings-4BVJ36YG.js} +51 -50
- package/chunks/{shell-2DOQIYEE.js → shell-DCQZWM5T.js} +45 -44
- package/chunks/{skill-2GOEKN34.js → skill-4KWZ4J7U.js} +24 -24
- package/chunks/{skill-settings-5FEOMZQS.js → skill-settings-TEMNXCLU.js} +51 -50
- package/chunks/{spawnChannel-VJRIO75F.js → spawnChannel-ROYEZK57.js} +48 -46
- package/chunks/{standalone-update-OC5IKJGY.js → standalone-update-G4BETY4B.js} +47 -46
- package/chunks/{startInteractiveUI-HFHFI2ZR.js → startInteractiveUI-PDFQ7N7A.js} +2665 -2827
- package/chunks/{syntheticOutput-PEBJQYJV.js → syntheticOutput-D3Z64LJC.js} +3 -3
- package/chunks/{task-create-5NWCQSJF.js → task-create-URFZ5EUX.js} +11 -11
- package/chunks/{task-list-53265TRZ.js → task-list-6JDFMPUW.js} +5 -5
- package/chunks/{task-stop-FPCOIRYX.js → task-stop-HHUGCD25.js} +2 -2
- package/chunks/{task-update-5HN577LS.js → task-update-DVV6CUGI.js} +12 -12
- package/chunks/{team-create-ZWAXZR75.js → team-create-KW4LOVHD.js} +52 -51
- package/chunks/{team-delete-MMQB4OSC.js → team-delete-PZGGBQLM.js} +5 -5
- package/chunks/{team-plan-approval-LH23GCUV.js → team-plan-approval-XHFK2RTF.js} +51 -50
- package/chunks/{terminal-image-renderer-7L3GCHD5.js → terminal-image-renderer-46R2LHGR.js} +47 -46
- package/chunks/theme-manager-E56XY2JG.js +89 -0
- package/chunks/{todoWrite-JGV6VLOX.js → todoWrite-WINAZSZI.js} +4 -4
- package/chunks/{tool-search-BZOZHGKI.js → tool-search-EVVFQUMJ.js} +21 -21
- package/chunks/{total-session-admission-KP4CJTSB.js → total-session-admission-CULMHRTA.js} +50 -49
- package/chunks/{trustedFolders-57QEHV67.js → trustedFolders-BKLVSCXW.js} +46 -45
- package/chunks/{update-relaunch-53MODFE4.js → update-relaunch-46H4Q4VL.js} +5 -5
- package/chunks/{updateCheck-4QDI7CUZ.js → updateCheck-3BQA7KNI.js} +49 -48
- package/chunks/{useAutoAcceptIndicator-VVQUPTM5.js → useAutoAcceptIndicator-3QJ7QV5R.js} +57 -56
- package/chunks/{validateNonInterActiveAuth-KKVD5E43.js → validateNonInterActiveAuth-QVFJVBSY.js} +90 -87
- package/chunks/{version-IB5ASN63.js → version-6JJA54HH.js} +1 -1
- package/chunks/{web-fetch-APSFQMIH.js → web-fetch-75JBSDA3.js} +24 -24
- package/chunks/{web-search-EWEHMFIW.js → web-search-PKBISWS3.js} +17 -17
- package/chunks/{workflow-LA4ACRO4.js → workflow-KEZDQISR.js} +58 -57
- package/chunks/workspace-providers-status-YQW4VNIV.js +100 -0
- package/chunks/{workspace-registration-store-WSLHN7HA.js → workspace-registration-store-GQ42PR72.js} +1 -1
- package/chunks/{workspace-registry-5HXRV7L4.js → workspace-registry-ZR6DVZQ6.js} +50 -49
- package/chunks/{workspace-service-SSP4PLBC.js → workspace-service-BCMK3NLA.js} +58 -57
- package/chunks/workspace-skills-status-ZHBYM2X7.js +100 -0
- package/chunks/{workspace-trust-reconciler-PASUNEKQ.js → workspace-trust-reconciler-TWRB3TW2.js} +59 -58
- package/chunks/wrapper-46Z24CTM.js +35 -0
- package/chunks/write-file-CQBI7HXO.js +87 -0
- package/chunks/{zh-AGL2FVBI.js → zh-LMSTK4WD.js} +2 -1
- package/chunks/{zh-TW-KI66MHQY.js → zh-TW-SQ4HTSCW.js} +2 -1
- package/chunks/{zoom-image-NAVVM4R2.js → zoom-image-36I4WZIL.js} +15 -15
- package/cli.js +13 -13
- package/locales/ca.js +1 -0
- package/locales/de.js +1 -0
- package/locales/en.js +1 -0
- package/locales/fr.js +1 -0
- package/locales/ja.js +1 -0
- package/locales/pt.js +1 -0
- package/locales/ru.js +1 -0
- package/locales/zh-TW.js +1 -0
- package/locales/zh.js +1 -0
- package/package.json +3 -3
- package/web-shell/assets/{arc-BGiARkbG.js → arc-CgGUyHWd.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-3QBZDeqg.js → architectureDiagram-3BPJPVTR-BR0Qv-1Y.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-CbJI0j0o.js → blockDiagram-GPEHLZMM-DIoaceaI.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-pita1IYy.js → c4Diagram-AAUBKEIU-Bc5k6BbI.js} +1 -1
- package/web-shell/assets/channel-D2b9IYpS.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-WzTFww1i.js → chunk-2J33WTMH-DtPEz2WX.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-8TIRo9bL.js → chunk-4BX2VUAB-Dydo6ydE.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-CuCr34qf.js → chunk-55IACEB6-DD9_VWXm.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-Bb_xWEAx.js → chunk-727SXJPM-DVI2m59k.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-C8T1b2Qw.js → chunk-AQP2D5EJ-luatmaTN.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-kjpyMkNM.js → chunk-FMBD7UC4-Duy8NTIi.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-Dm35jDmi.js → chunk-ND2GUHAM-CrL1yhms.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-BPVKwuby.js → chunk-QZHKN3VN-C7BX6bu1.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-DHatTCmD.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-DHatTCmD.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-M-7J9Xyz.js → cose-bilkent-S5V4N54A-BTzs7mIi.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-u6rmS689.js → dagre-BM42HDAG-3VTUmWts.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-nAisfOUB.js → diagram-2AECGRRQ-Ehdp75GN.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-CpobRd3l.js → diagram-5GNKFQAL-B3wu3teE.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-B82W_wPq.js → diagram-KO2AKTUF-DjgTSf2S.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-ClTkmPW6.js → diagram-LMA3HP47-Br9mwjY3.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-42fbxGPW.js → diagram-OG6HWLK6-D4xz5M-z.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-8_zQfzlQ.js → erDiagram-TEJ5UH35-CXayWlG_.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-DQDoN_oV.js → flowDiagram-I6XJVG4X-CLonjQTi.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-Cqd646fB.js → ganttDiagram-6RSMTGT7-BTySFT-1.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-B6qWs_tS.js → gitGraphDiagram-PVQCEYII--2WcUjOe.js} +1 -1
- package/web-shell/assets/{index-eYjX7fQg.css → index-CIFO52Wx.css} +1 -1
- package/web-shell/assets/{index-BCeQB_tk.js → index-DPJHkFOG.js} +1 -1
- package/web-shell/assets/index-bhq3CUUF.js +1789 -0
- package/web-shell/assets/{infoDiagram-5YYISTIA-BVyDAHuu.js → infoDiagram-5YYISTIA-9vpgAf1m.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-BBHM904I.js → ishikawaDiagram-YF4QCWOH-DcRpHnAW.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-B5Bv5Z_0.js → journeyDiagram-JHISSGLW-C2TKorRm.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-BwSTb0YF.js → kanban-definition-UN3LZRKU-DdsFwB8b.js} +1 -1
- package/web-shell/assets/{linear-CHtTm36c.js → linear-7PjRvJrf.js} +1 -1
- package/web-shell/assets/{mermaid.core-vBCuAUkf.js → mermaid.core-raDXa11C.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-CNfKHJrA.js → mindmap-definition-RKZ34NQL-DLHc-PRN.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-DT6QMLhc.js → pieDiagram-4H26LBE5-BftYpeTW.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-Rb2Dar4i.js → quadrantDiagram-W4KKPZXB-O-6ygOYn.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-CA9YzPUY.js → requirementDiagram-4Y6WPE33-BmZWVufJ.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-CJ5SkhJw.js → sankeyDiagram-5OEKKPKP-2x5beiWt.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-T31AiuVM.js → sequenceDiagram-3UESZ5HK-BH8uKokQ.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-f7Xpd_Xh.js → stateDiagram-AJRCARHV-Dq1MFgX_.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-spuAYji6.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-dCwsTscr.js → timeline-definition-PNZ67QCA-Cl2WKbv9.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-SQtBFYkQ.js → vennDiagram-CIIHVFJN-BqoRo_Q-.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-Dfh4eW0B.js → wardley-L42UT6IY-BTxp-Yot.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-BWBKXBsC.js → wardleyDiagram-YWT4CUSO-DFXVCSH2.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-DVqzcaxh.js → xychartDiagram-2RQKCTM6-qQhWx0aE.js} +1 -1
- package/web-shell/index.html +2 -2
- package/chunks/agent-headless-JOL3STCJ.js +0 -86
- package/chunks/channel-settings-store-CDUEUDYS.js +0 -101
- package/chunks/chunk-PDPFQ2FO.js +0 -156
- package/chunks/daemon-status-provider-67M3LFIJ.js +0 -102
- package/chunks/daemon-trust-policy-3XCIBLLT.js +0 -98
- package/chunks/exitPlanMode-2U23CG2U.js +0 -84
- package/chunks/handleAutoUpdate-2F3RWBIT.js +0 -93
- package/chunks/initializer-QRD7X25L.js +0 -99
- package/chunks/list-G6SHYRHQ.js +0 -102
- package/chunks/loadedSettingsAdapter-S4EPYP35.js +0 -96
- package/chunks/mcp-R2Z6IKPN.js +0 -96
- package/chunks/nonInteractiveCli-E6CEE6IG.js +0 -162
- package/chunks/read-file-S2BROE4F.js +0 -32
- package/chunks/ripGrep-V4EX6SLA.js +0 -84
- package/chunks/theme-manager-7WO6DXIT.js +0 -88
- package/chunks/workspace-providers-status-5C3HGWHF.js +0 -99
- package/chunks/workspace-skills-status-DX7CA34S.js +0 -99
- package/chunks/write-file-3N2WAE3F.js +0 -86
- package/web-shell/assets/channel-3vYOf77E.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-Dr2aqxvr.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-Dr2aqxvr.js +0 -1
- package/web-shell/assets/index-Dv9zBWC9.js +0 -1775
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-wucbNzkr.js +0 -1
- /package/chunks/{chunk-NWNEANAT.js → chunk-44CTCCLY.js} +0 -0
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import {
|
|
4
|
-
deriveWebSocketBase,
|
|
5
|
-
openQwenAsrRealtimeStream,
|
|
6
|
-
openVoiceStream,
|
|
7
|
-
openVoiceStreamWithRetry
|
|
8
|
-
} from "./chunk-Q3JQ7OSU.js";
|
|
9
3
|
import {
|
|
10
4
|
GENERATION_MAX_PROMPT_BYTES,
|
|
11
5
|
LIVE_SESSION_SOURCE_PREFIX,
|
|
@@ -26,7 +20,14 @@ import {
|
|
|
26
20
|
shouldSuppressRememberErrorDetails,
|
|
27
21
|
workspaceMemoryFailureCode,
|
|
28
22
|
workspaceMemoryFailureDiagnostics
|
|
29
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-5AWARYOK.js";
|
|
24
|
+
import {
|
|
25
|
+
deriveWebSocketBase,
|
|
26
|
+
openQwenAsrRealtimeStream,
|
|
27
|
+
openVoiceStream,
|
|
28
|
+
openVoiceStreamWithRetry
|
|
29
|
+
} from "./chunk-3XZYK76R.js";
|
|
30
|
+
import "./chunk-ZBBVBZBR.js";
|
|
30
31
|
import {
|
|
31
32
|
SetupGithubError,
|
|
32
33
|
collectSessionData,
|
|
@@ -38,18 +39,17 @@ import {
|
|
|
38
39
|
toJson,
|
|
39
40
|
toJsonl,
|
|
40
41
|
toMarkdown
|
|
41
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-7L64FSYQ.js";
|
|
42
43
|
import {
|
|
43
44
|
OBSERVED_CONTACT_MAX_FRESH_WITHIN_SECONDS,
|
|
44
45
|
ObservedChannelContactStore
|
|
45
|
-
} from "./chunk-
|
|
46
|
-
import "./chunk-2Z6PYTOK.js";
|
|
46
|
+
} from "./chunk-47FQVRCO.js";
|
|
47
47
|
import {
|
|
48
48
|
escapeAnsiCtrlCodes
|
|
49
49
|
} from "./chunk-4NFY2S7N.js";
|
|
50
|
+
import "./chunk-GQW6P73F.js";
|
|
50
51
|
import "./chunk-2MIN6GRR.js";
|
|
51
52
|
import "./chunk-QHTIBUWB.js";
|
|
52
|
-
import "./chunk-EKTCKZV5.js";
|
|
53
53
|
import "./chunk-3Z43GZUQ.js";
|
|
54
54
|
import {
|
|
55
55
|
CAPABILITIES_SCHEMA_VERSION,
|
|
@@ -107,7 +107,7 @@ import {
|
|
|
107
107
|
setRateLimiter,
|
|
108
108
|
unsafeRevealSecret,
|
|
109
109
|
validateMcpRuntimeServerName
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-KNQZXSLW.js";
|
|
111
111
|
import "./chunk-VGHZT6JR.js";
|
|
112
112
|
import {
|
|
113
113
|
isLoopbackBind,
|
|
@@ -115,6 +115,10 @@ import {
|
|
|
115
115
|
parseCallerSuppliedSessionId
|
|
116
116
|
} from "./chunk-TQOF5KBL.js";
|
|
117
117
|
import "./chunk-HGCQ5SE7.js";
|
|
118
|
+
import {
|
|
119
|
+
evaluateDaemonWorkspaceTrust,
|
|
120
|
+
readDaemonTrustPolicySnapshot
|
|
121
|
+
} from "./chunk-XAAL4IFG.js";
|
|
118
122
|
import {
|
|
119
123
|
EMPTY_WORKSPACE_VOICE_UPDATE_ERROR,
|
|
120
124
|
MAX_WORKSPACE_SKILL_NAME_LENGTH,
|
|
@@ -128,14 +132,14 @@ import {
|
|
|
128
132
|
validateWorkspaceSkillName,
|
|
129
133
|
validateWorkspaceVoiceState,
|
|
130
134
|
voiceSettingsScopeToWire
|
|
131
|
-
} from "./chunk-
|
|
135
|
+
} from "./chunk-MMH3GO4Z.js";
|
|
132
136
|
import {
|
|
133
137
|
PermissionRulesValidationError,
|
|
134
138
|
buildPermissionSettings,
|
|
135
139
|
isPermissionRuleType,
|
|
136
140
|
normalizePermissionRules,
|
|
137
141
|
readPermissionRuleSet
|
|
138
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-LCWRQA5U.js";
|
|
139
143
|
import {
|
|
140
144
|
assertVoiceBaseUrlNetworkAllowed,
|
|
141
145
|
isStreamingVoiceModel,
|
|
@@ -143,13 +147,13 @@ import {
|
|
|
143
147
|
resolveVoiceTranscriptionConfig,
|
|
144
148
|
sanitizeVoiceErrorMessage,
|
|
145
149
|
transcribeVoiceAudio
|
|
146
|
-
} from "./chunk-
|
|
150
|
+
} from "./chunk-FLUYVAQZ.js";
|
|
147
151
|
import {
|
|
148
152
|
isVoiceEnabled,
|
|
149
153
|
isVoiceMode,
|
|
150
154
|
readVoiceModel
|
|
151
|
-
} from "./chunk-
|
|
152
|
-
import "./chunk-
|
|
155
|
+
} from "./chunk-SZ36WFVK.js";
|
|
156
|
+
import "./chunk-IQFYO5BF.js";
|
|
153
157
|
import {
|
|
154
158
|
createTotalSessionAdmissionController
|
|
155
159
|
} from "./chunk-X2UOOG5V.js";
|
|
@@ -166,26 +170,39 @@ import {
|
|
|
166
170
|
} from "./chunk-4JRM2BSM.js";
|
|
167
171
|
import {
|
|
168
172
|
assertValidChannelSecretUpdates
|
|
169
|
-
} from "./chunk-
|
|
173
|
+
} from "./chunk-FMLUVVQ6.js";
|
|
170
174
|
import {
|
|
171
175
|
createDaemonStatusProvider
|
|
172
|
-
} from "./chunk-
|
|
176
|
+
} from "./chunk-WFBG4MF5.js";
|
|
173
177
|
import "./chunk-NTTBXH7U.js";
|
|
174
|
-
import "./chunk-
|
|
178
|
+
import "./chunk-ZIS5I56G.js";
|
|
175
179
|
import "./chunk-3SH53ANB.js";
|
|
180
|
+
import {
|
|
181
|
+
SessionArtifactAuthorizationError,
|
|
182
|
+
SessionArtifactValidationError,
|
|
183
|
+
createAcpSessionBridge,
|
|
184
|
+
parseSessionSource
|
|
185
|
+
} from "./chunk-VUTOKX6F.js";
|
|
186
|
+
import {
|
|
187
|
+
EVENT_SCHEMA_VERSION,
|
|
188
|
+
EventBus,
|
|
189
|
+
SubscriberLimitExceededError
|
|
190
|
+
} from "./chunk-MZSJ43WV.js";
|
|
191
|
+
import "./chunk-XCGIMOLN.js";
|
|
192
|
+
import "./chunk-OCPBI7J5.js";
|
|
176
193
|
import {
|
|
177
194
|
createWorkspaceProvidersStatusProvider
|
|
178
|
-
} from "./chunk-
|
|
195
|
+
} from "./chunk-A7M57KOL.js";
|
|
179
196
|
import {
|
|
180
197
|
getAuthTypeFromEnv,
|
|
181
198
|
resolveCliGenerationConfig
|
|
182
|
-
} from "./chunk-
|
|
199
|
+
} from "./chunk-5DDUYIY6.js";
|
|
183
200
|
import {
|
|
184
201
|
snapshotProcessEnv
|
|
185
|
-
} from "./chunk-
|
|
202
|
+
} from "./chunk-VESDV72K.js";
|
|
186
203
|
import {
|
|
187
204
|
createWorkspaceSkillsStatusProvider
|
|
188
|
-
} from "./chunk-
|
|
205
|
+
} from "./chunk-JO45C3OY.js";
|
|
189
206
|
import "./chunk-BGXZBI5B.js";
|
|
190
207
|
import "./chunk-Z4X5MTRT.js";
|
|
191
208
|
import {
|
|
@@ -201,52 +218,35 @@ import {
|
|
|
201
218
|
import {
|
|
202
219
|
require_express
|
|
203
220
|
} from "./chunk-GDXET5XU.js";
|
|
204
|
-
import {
|
|
205
|
-
evaluateDaemonWorkspaceTrust,
|
|
206
|
-
readDaemonTrustPolicySnapshot
|
|
207
|
-
} from "./chunk-PFWPBYL2.js";
|
|
208
221
|
import {
|
|
209
222
|
daemonObservedContactsPath,
|
|
210
223
|
loadChannelsConfig
|
|
211
|
-
} from "./chunk-
|
|
212
|
-
import "./chunk-
|
|
224
|
+
} from "./chunk-3SIXC6QC.js";
|
|
225
|
+
import "./chunk-C2VGLLNA.js";
|
|
213
226
|
import "./chunk-57OAHC2Y.js";
|
|
214
227
|
import {
|
|
215
228
|
parseChannelWebhookConfigLenient
|
|
216
|
-
} from "./chunk-
|
|
217
|
-
import "./chunk-
|
|
229
|
+
} from "./chunk-YTYPRVIZ.js";
|
|
230
|
+
import "./chunk-ENEEQMGM.js";
|
|
218
231
|
import {
|
|
219
232
|
supportedChannelCatalog
|
|
220
|
-
} from "./chunk-
|
|
233
|
+
} from "./chunk-DEG7R6Z6.js";
|
|
234
|
+
import "./chunk-V6WHFGST.js";
|
|
221
235
|
import {
|
|
222
236
|
LIVE_HOST_BUNDLE_ID,
|
|
223
237
|
LIVE_HOST_PROTOCOL_VERSION,
|
|
224
238
|
LIVE_INPUT_AUDIO_EPOCH_BYTES
|
|
225
239
|
} from "./chunk-NKLP3DCK.js";
|
|
226
|
-
import
|
|
227
|
-
SessionArtifactAuthorizationError,
|
|
228
|
-
SessionArtifactValidationError,
|
|
229
|
-
createAcpSessionBridge,
|
|
230
|
-
parseSessionSource
|
|
231
|
-
} from "./chunk-E2XBEWAK.js";
|
|
232
|
-
import {
|
|
233
|
-
EVENT_SCHEMA_VERSION,
|
|
234
|
-
EventBus,
|
|
235
|
-
SubscriberLimitExceededError
|
|
236
|
-
} from "./chunk-MZSJ43WV.js";
|
|
237
|
-
import "./chunk-XCGIMOLN.js";
|
|
238
|
-
import "./chunk-OCPBI7J5.js";
|
|
239
|
-
import "./chunk-EV3LZGGK.js";
|
|
240
|
+
import "./chunk-TKAEODJR.js";
|
|
240
241
|
import {
|
|
241
242
|
STATUS_SCHEMA_VERSION,
|
|
242
243
|
SessionRestoreTimeoutError,
|
|
243
244
|
createIdleWorkspaceMemoryStatus,
|
|
244
245
|
mapDomainErrorToErrorKind
|
|
245
|
-
} from "./chunk-
|
|
246
|
+
} from "./chunk-OPBATTFQ.js";
|
|
246
247
|
import "./chunk-K6KS3LTN.js";
|
|
247
248
|
import "./chunk-FC4KQFCS.js";
|
|
248
249
|
import "./chunk-T3CHYWJZ.js";
|
|
249
|
-
import "./chunk-V6WHFGST.js";
|
|
250
250
|
import {
|
|
251
251
|
MAX_REGISTERED_WORKSPACES,
|
|
252
252
|
WorkspaceDisplayNameValidationError,
|
|
@@ -254,11 +254,12 @@ import {
|
|
|
254
254
|
WorkspaceRegistrationStoreLimitError,
|
|
255
255
|
normalizeWorkspaceDisplayName,
|
|
256
256
|
workspaceRegistrationId
|
|
257
|
-
} from "./chunk-
|
|
257
|
+
} from "./chunk-CX2MARRJ.js";
|
|
258
258
|
import {
|
|
259
|
+
DAEMON_PROMPT_DISPLAY_TEXT_META_KEY,
|
|
259
260
|
REQUESTED_SESSION_ID_META_KEY,
|
|
260
261
|
gradeActiveWorkCoverage
|
|
261
|
-
} from "./chunk-
|
|
262
|
+
} from "./chunk-HHGQGTJQ.js";
|
|
262
263
|
import {
|
|
263
264
|
BranchWhilePromptActiveError,
|
|
264
265
|
BridgeChannelQuarantinedError,
|
|
@@ -299,6 +300,10 @@ import {
|
|
|
299
300
|
canonicalizeWorkspaces,
|
|
300
301
|
translateAndCheckAbsoluteWorkspacePath
|
|
301
302
|
} from "./chunk-6PLDPT2C.js";
|
|
303
|
+
import {
|
|
304
|
+
CHANNEL_WORKER_PROMPT_AUTHORIZATION_META_KEY,
|
|
305
|
+
isChannelWorkerPromptAuthorized
|
|
306
|
+
} from "./chunk-Z7B6SRPM.js";
|
|
302
307
|
import {
|
|
303
308
|
ChannelDeliveryError,
|
|
304
309
|
MAX_CHANNEL_STARTUP_FAILURES,
|
|
@@ -311,7 +316,7 @@ import {
|
|
|
311
316
|
} from "./chunk-YP5KH5Y7.js";
|
|
312
317
|
import {
|
|
313
318
|
normalizeWorkerDiagnostic
|
|
314
|
-
} from "./chunk-
|
|
319
|
+
} from "./chunk-K7JW6V5O.js";
|
|
315
320
|
import {
|
|
316
321
|
normalizeServeChannelSelection
|
|
317
322
|
} from "./chunk-ALMR3E6Q.js";
|
|
@@ -320,11 +325,11 @@ import {
|
|
|
320
325
|
redactLogCredentials
|
|
321
326
|
} from "./chunk-M5GB774H.js";
|
|
322
327
|
import "./chunk-BKHCW2BI.js";
|
|
323
|
-
import "./chunk-5HBA2Z7V.js";
|
|
324
328
|
import {
|
|
325
329
|
sanitizeLogText
|
|
326
|
-
} from "./chunk-
|
|
327
|
-
import "./chunk-
|
|
330
|
+
} from "./chunk-LT532KF4.js";
|
|
331
|
+
import "./chunk-IW6RQPQB.js";
|
|
332
|
+
import "./chunk-5HBA2Z7V.js";
|
|
328
333
|
import {
|
|
329
334
|
getDialogSettingKeys,
|
|
330
335
|
getModelProvidersOwnerScope,
|
|
@@ -334,26 +339,26 @@ import {
|
|
|
334
339
|
getWritableScopes,
|
|
335
340
|
loadSettings,
|
|
336
341
|
validateSettingValue
|
|
337
|
-
} from "./chunk-
|
|
338
|
-
import "./chunk-HGBUHVFO.js";
|
|
342
|
+
} from "./chunk-3ZLUA4GV.js";
|
|
339
343
|
import "./chunk-RKUWKYED.js";
|
|
344
|
+
import "./chunk-G4C5RLX6.js";
|
|
340
345
|
import "./chunk-GOXKNSDZ.js";
|
|
341
346
|
import "./chunk-IDS7MSUP.js";
|
|
342
347
|
import {
|
|
343
348
|
detectSystemLanguage,
|
|
344
349
|
resolveLanguageSetting
|
|
345
|
-
} from "./chunk-
|
|
350
|
+
} from "./chunk-6LK2QPIA.js";
|
|
346
351
|
import {
|
|
347
352
|
SUPPORTED_LANGUAGES,
|
|
348
353
|
resolveSupportedLanguage
|
|
349
354
|
} from "./chunk-5EJZE3FP.js";
|
|
350
|
-
import "./chunk-
|
|
351
|
-
import "./chunk-
|
|
352
|
-
import "./chunk-
|
|
355
|
+
import "./chunk-7N6WK2W6.js";
|
|
356
|
+
import "./chunk-MS7GNABG.js";
|
|
357
|
+
import "./chunk-DGM2XA3R.js";
|
|
353
358
|
import "./chunk-VJNBRRZG.js";
|
|
354
359
|
import {
|
|
355
360
|
getWorkspaceTrustStatus
|
|
356
|
-
} from "./chunk-
|
|
361
|
+
} from "./chunk-M2S67TPJ.js";
|
|
357
362
|
import "./chunk-NPQ5ZKRP.js";
|
|
358
363
|
import {
|
|
359
364
|
isWithinRoot as isWithinRoot2
|
|
@@ -433,20 +438,20 @@ import {
|
|
|
433
438
|
writeWorkspaceContextFile,
|
|
434
439
|
writeWorktreeSession,
|
|
435
440
|
writeWorktreeSessionMarker
|
|
436
|
-
} from "./chunk-
|
|
441
|
+
} from "./chunk-INQN4KIA.js";
|
|
437
442
|
import "./chunk-GOFAQQZA.js";
|
|
438
443
|
import "./chunk-5M6IDOMF.js";
|
|
439
444
|
import "./chunk-TWPJO254.js";
|
|
440
|
-
import "./chunk-
|
|
445
|
+
import "./chunk-CQ35AJ4Z.js";
|
|
441
446
|
import {
|
|
442
447
|
MAX_JOBS,
|
|
443
448
|
nextDurableFireMs
|
|
444
|
-
} from "./chunk-
|
|
445
|
-
import "./chunk-
|
|
446
|
-
import "./chunk-
|
|
447
|
-
import "./chunk-
|
|
449
|
+
} from "./chunk-QTI7SRXI.js";
|
|
450
|
+
import "./chunk-KT4OWAAZ.js";
|
|
451
|
+
import "./chunk-IX7CFQGA.js";
|
|
452
|
+
import "./chunk-N7NBMAMW.js";
|
|
448
453
|
import "./chunk-6PVPNMXU.js";
|
|
449
|
-
import "./chunk-
|
|
454
|
+
import "./chunk-U6LT3QBF.js";
|
|
450
455
|
import {
|
|
451
456
|
nextFireTime,
|
|
452
457
|
parseCron
|
|
@@ -459,22 +464,22 @@ import {
|
|
|
459
464
|
readCronTasks,
|
|
460
465
|
taskHasLegacyCondition,
|
|
461
466
|
updateCronTasks
|
|
462
|
-
} from "./chunk-
|
|
463
|
-
import "./chunk-
|
|
467
|
+
} from "./chunk-XLQS3VI6.js";
|
|
468
|
+
import "./chunk-NWPO6I7V.js";
|
|
464
469
|
import "./chunk-O6GEWCJA.js";
|
|
465
470
|
import "./chunk-T26EAKDL.js";
|
|
466
471
|
import "./chunk-ZPJWUGCS.js";
|
|
467
472
|
import "./chunk-CPBF7KYF.js";
|
|
468
|
-
import "./chunk-J6SZID63.js";
|
|
469
|
-
import "./chunk-KRXPRVGL.js";
|
|
470
|
-
import "./chunk-GM463R2B.js";
|
|
471
|
-
import "./chunk-SEZ556DZ.js";
|
|
472
|
-
import "./chunk-2FRY5CRX.js";
|
|
473
|
-
import "./chunk-QUI267ZP.js";
|
|
474
473
|
import {
|
|
475
474
|
APPROVAL_MODES
|
|
476
|
-
} from "./chunk-
|
|
477
|
-
import "./chunk-
|
|
475
|
+
} from "./chunk-6LYDH7VT.js";
|
|
476
|
+
import "./chunk-2AZMF6G5.js";
|
|
477
|
+
import "./chunk-KRXPRVGL.js";
|
|
478
|
+
import "./chunk-GZGDJ4E6.js";
|
|
479
|
+
import "./chunk-T6W4KACQ.js";
|
|
480
|
+
import "./chunk-MWZYNOCG.js";
|
|
481
|
+
import "./chunk-SAQHDAUJ.js";
|
|
482
|
+
import "./chunk-6XZERB6P.js";
|
|
478
483
|
import {
|
|
479
484
|
addDaemonRequestAttribute,
|
|
480
485
|
captureDaemonTelemetryContext,
|
|
@@ -486,20 +491,39 @@ import {
|
|
|
486
491
|
recordDaemonHttpResponse,
|
|
487
492
|
runWithDaemonTelemetryContext,
|
|
488
493
|
withDaemonRequestSpan
|
|
489
|
-
} from "./chunk-
|
|
494
|
+
} from "./chunk-O5AZPHYZ.js";
|
|
490
495
|
import "./chunk-SAH4BD2J.js";
|
|
491
|
-
import "./chunk-
|
|
496
|
+
import "./chunk-5PWLQ7SK.js";
|
|
497
|
+
import "./chunk-EYS3GGM3.js";
|
|
492
498
|
import "./chunk-S6LOFUVP.js";
|
|
493
499
|
import "./chunk-2J3OJGTL.js";
|
|
500
|
+
import {
|
|
501
|
+
CursorNotAtLineBoundaryError,
|
|
502
|
+
LargeNonUtf8TextError,
|
|
503
|
+
TextScanBudgetExceededError,
|
|
504
|
+
decodeBufferWithEncodingInfoAsync,
|
|
505
|
+
getAllGeminiMdFilenames,
|
|
506
|
+
isUtf8CompatibleEncoding,
|
|
507
|
+
isWithinRoot,
|
|
508
|
+
parseLineTolerant,
|
|
509
|
+
read
|
|
510
|
+
} from "./chunk-HB6QW4LM.js";
|
|
511
|
+
import "./chunk-YRLW2MSX.js";
|
|
512
|
+
import "./chunk-VGC4I5JJ.js";
|
|
513
|
+
import "./chunk-732MOPEM.js";
|
|
514
|
+
import "./chunk-CTQE2NB2.js";
|
|
515
|
+
import "./chunk-NC4O6UE6.js";
|
|
516
|
+
import "./chunk-IEP44U2R.js";
|
|
494
517
|
import {
|
|
495
518
|
SubagentError,
|
|
496
519
|
SubagentErrorCode
|
|
497
|
-
} from "./chunk-
|
|
520
|
+
} from "./chunk-ZV4XVYL3.js";
|
|
498
521
|
import "./chunk-K623ENWT.js";
|
|
499
522
|
import {
|
|
500
523
|
escapeXml
|
|
501
524
|
} from "./chunk-AQ37AY7B.js";
|
|
502
|
-
import "./chunk-
|
|
525
|
+
import "./chunk-V3LXMASR.js";
|
|
526
|
+
import "./chunk-XTH2OMDS.js";
|
|
503
527
|
import {
|
|
504
528
|
QwenOAuth2Client,
|
|
505
529
|
QwenOAuthPollError,
|
|
@@ -508,56 +532,38 @@ import {
|
|
|
508
532
|
isDeviceAuthorizationSuccess,
|
|
509
533
|
isDeviceTokenPending,
|
|
510
534
|
isDeviceTokenSuccess
|
|
511
|
-
} from "./chunk-
|
|
535
|
+
} from "./chunk-TBVNYG5B.js";
|
|
512
536
|
import "./chunk-NAVJD2PQ.js";
|
|
513
|
-
import "./chunk-
|
|
514
|
-
import "./chunk-
|
|
537
|
+
import "./chunk-5HBFERG5.js";
|
|
538
|
+
import "./chunk-EYW54TBD.js";
|
|
515
539
|
import "./chunk-P3QQPMQA.js";
|
|
516
|
-
import "./chunk-
|
|
517
|
-
import "./chunk-
|
|
540
|
+
import "./chunk-O4BBDP2G.js";
|
|
541
|
+
import "./chunk-KPVVWKF3.js";
|
|
542
|
+
import "./chunk-LOJO2RPW.js";
|
|
543
|
+
import "./chunk-F6WFNA7U.js";
|
|
544
|
+
import "./chunk-F6AOBFUN.js";
|
|
518
545
|
import "./chunk-KM73TBQ4.js";
|
|
519
546
|
import "./chunk-MPHPFVKK.js";
|
|
520
547
|
import "./chunk-AXMWHKXA.js";
|
|
521
548
|
import "./chunk-GLCZKT5V.js";
|
|
549
|
+
import "./chunk-GJJQV4PY.js";
|
|
550
|
+
import "./chunk-46UV252V.js";
|
|
551
|
+
import "./chunk-FPGTNKCP.js";
|
|
522
552
|
import "./chunk-DJ2GSRLV.js";
|
|
523
|
-
import "./chunk-
|
|
553
|
+
import "./chunk-EFIMD5VA.js";
|
|
554
|
+
import "./chunk-E5BWLU5J.js";
|
|
524
555
|
import "./chunk-CR3C7WXL.js";
|
|
525
|
-
import "./chunk-
|
|
526
|
-
import
|
|
527
|
-
CursorNotAtLineBoundaryError,
|
|
528
|
-
LargeNonUtf8TextError,
|
|
529
|
-
TextScanBudgetExceededError,
|
|
530
|
-
decodeBufferWithEncodingInfoAsync,
|
|
531
|
-
getAllGeminiMdFilenames,
|
|
532
|
-
isUtf8CompatibleEncoding,
|
|
533
|
-
isWithinRoot,
|
|
534
|
-
parseLineTolerant,
|
|
535
|
-
read
|
|
536
|
-
} from "./chunk-YGT2AUJ7.js";
|
|
537
|
-
import "./chunk-WOJZWRAZ.js";
|
|
538
|
-
import "./chunk-VGC4I5JJ.js";
|
|
539
|
-
import "./chunk-FVKHVJZQ.js";
|
|
540
|
-
import "./chunk-COBO5EBO.js";
|
|
541
|
-
import "./chunk-6ZRFAKXK.js";
|
|
542
|
-
import "./chunk-PYQADEFD.js";
|
|
543
|
-
import "./chunk-3WOZVMGJ.js";
|
|
544
|
-
import "./chunk-F6WFNA7U.js";
|
|
545
|
-
import "./chunk-46UV252V.js";
|
|
546
|
-
import "./chunk-ZBVS26BY.js";
|
|
547
|
-
import "./chunk-KKBPOU75.js";
|
|
548
|
-
import "./chunk-EUNWC2VS.js";
|
|
549
|
-
import "./chunk-FOGU3LJX.js";
|
|
550
|
-
import "./chunk-L2AFWWJE.js";
|
|
551
|
-
import "./chunk-W4RQUHY3.js";
|
|
552
|
-
import "./chunk-PDPFQ2FO.js";
|
|
556
|
+
import "./chunk-HHJLM3WQ.js";
|
|
557
|
+
import "./chunk-L2GTEEEU.js";
|
|
553
558
|
import {
|
|
554
559
|
FatalConfigError,
|
|
555
560
|
Storage,
|
|
556
561
|
createDebugLogger,
|
|
557
562
|
getErrorMessage,
|
|
558
563
|
runWithoutDebugLogSession
|
|
559
|
-
} from "./chunk-
|
|
564
|
+
} from "./chunk-MPBRV3UU.js";
|
|
560
565
|
import "./chunk-VOQXFAY5.js";
|
|
566
|
+
import "./chunk-XWRJCPHC.js";
|
|
561
567
|
import {
|
|
562
568
|
writeStderrLine,
|
|
563
569
|
writeStderrLineSafe
|
|
@@ -565,13 +571,13 @@ import {
|
|
|
565
571
|
import "./chunk-75DOP5OR.js";
|
|
566
572
|
import "./chunk-DMTGGOSA.js";
|
|
567
573
|
import "./chunk-YQ3U5MUC.js";
|
|
574
|
+
import "./chunk-AMDSOFFV.js";
|
|
568
575
|
import {
|
|
569
576
|
import_websocket,
|
|
570
577
|
import_websocket_server,
|
|
571
578
|
wrapper_default
|
|
572
|
-
} from "./chunk-
|
|
579
|
+
} from "./chunk-E3GLDLYB.js";
|
|
573
580
|
import "./chunk-FCMNKVXT.js";
|
|
574
|
-
import "./chunk-AMDSOFFV.js";
|
|
575
581
|
import "./chunk-QUGAUQGJ.js";
|
|
576
582
|
import {
|
|
577
583
|
init_esbuild_shims
|
|
@@ -583,7 +589,7 @@ import {
|
|
|
583
589
|
|
|
584
590
|
// packages/cli/src/serve/server.ts
|
|
585
591
|
init_esbuild_shims();
|
|
586
|
-
var
|
|
592
|
+
var import_express6 = __toESM(require_express(), 1);
|
|
587
593
|
|
|
588
594
|
// packages/cli/src/serve/acp-http/index.ts
|
|
589
595
|
init_esbuild_shims();
|
|
@@ -1001,6 +1007,7 @@ import * as path2 from "node:path";
|
|
|
1001
1007
|
var MAX_READ_BYTES = 256 * 1024;
|
|
1002
1008
|
var MAX_TEXT_SCAN_BYTES = 8 * 1024 * 1024;
|
|
1003
1009
|
var MAX_WRITE_BYTES = 5 * 1024 * 1024;
|
|
1010
|
+
var MAX_UPLOAD_BYTES = 50 * 1024 * 1024;
|
|
1004
1011
|
var BINARY_PROBE_BYTES = 4096;
|
|
1005
1012
|
function shouldIgnore(absolute, boundWorkspace, ignore, kind = "file") {
|
|
1006
1013
|
const rel = path2.relative(boundWorkspace, absolute);
|
|
@@ -1200,11 +1207,11 @@ function decodeTextCursor(cursor) {
|
|
|
1200
1207
|
return { off, size, dev, ino };
|
|
1201
1208
|
}
|
|
1202
1209
|
__name(decodeTextCursor, "decodeTextCursor");
|
|
1203
|
-
function assertCursorMatchesFile(cursor, stats,
|
|
1210
|
+
function assertCursorMatchesFile(cursor, stats, path17) {
|
|
1204
1211
|
if (String(stats.dev) !== cursor.dev || String(stats.ino) !== cursor.ino || stats.size < cursor.size) {
|
|
1205
1212
|
throw new FsError(
|
|
1206
1213
|
"hash_mismatch",
|
|
1207
|
-
`cursor no longer matches the file it was issued for: ${
|
|
1214
|
+
`cursor no longer matches the file it was issued for: ${path17}`,
|
|
1208
1215
|
{ hint: "re-read the file from the beginning to get a fresh cursor" }
|
|
1209
1216
|
);
|
|
1210
1217
|
}
|
|
@@ -2088,6 +2095,41 @@ var WorkspaceFileSystemImpl = class {
|
|
|
2088
2095
|
throw this.recordAndWrap(err, "edit", p);
|
|
2089
2096
|
}
|
|
2090
2097
|
}
|
|
2098
|
+
async writeBytesAtomic(p, data) {
|
|
2099
|
+
const start = performance.now();
|
|
2100
|
+
try {
|
|
2101
|
+
this.deps.generationGuard?.assertOpen();
|
|
2102
|
+
assertTrustedForIntent(this.deps.trusted, "write");
|
|
2103
|
+
enforceWriteSize(data.length, MAX_UPLOAD_BYTES);
|
|
2104
|
+
const out = await this.deps.pathLocks.runExclusive(
|
|
2105
|
+
p,
|
|
2106
|
+
async () => {
|
|
2107
|
+
await assertCreateTargetAbsent(p);
|
|
2108
|
+
this.deps.generationGuard?.assertOpen();
|
|
2109
|
+
const result = await atomicPublishResolvedFile({
|
|
2110
|
+
target: p,
|
|
2111
|
+
buf: data,
|
|
2112
|
+
mode: "create",
|
|
2113
|
+
assertGenerationOpen: /* @__PURE__ */ __name(() => this.deps.generationGuard?.assertOpen(), "assertGenerationOpen")
|
|
2114
|
+
});
|
|
2115
|
+
const verdict = this.ignoreVerdict(p, "file");
|
|
2116
|
+
this.deps.audit.recordAccess(this.deps.ctx, {
|
|
2117
|
+
intent: "write",
|
|
2118
|
+
absolute: p,
|
|
2119
|
+
durationMs: performance.now() - start,
|
|
2120
|
+
sizeBytes: result.sizeBytes,
|
|
2121
|
+
matchedIgnore: verdict.ignored ? verdict.category : void 0
|
|
2122
|
+
});
|
|
2123
|
+
return { sizeBytes: result.sizeBytes, hash: result.hash };
|
|
2124
|
+
}
|
|
2125
|
+
);
|
|
2126
|
+
return out;
|
|
2127
|
+
} catch (err) {
|
|
2128
|
+
throw this.recordAndWrap(err, "write", p, {
|
|
2129
|
+
audit: !(isFsError(err) && err.kind === "file_already_exists")
|
|
2130
|
+
});
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2091
2133
|
/**
|
|
2092
2134
|
* Coerce an arbitrary thrown value into an `FsError`, emit the
|
|
2093
2135
|
* matching `fs.denied` audit event, and return the typed error
|
|
@@ -2101,11 +2143,14 @@ var WorkspaceFileSystemImpl = class {
|
|
|
2101
2143
|
* - routes can still rely on `instanceof FsError`
|
|
2102
2144
|
* for their `sendFsError` serializer.
|
|
2103
2145
|
*/
|
|
2104
|
-
recordAndWrap(err, intent, input) {
|
|
2146
|
+
recordAndWrap(err, intent, input, opts) {
|
|
2105
2147
|
if (err instanceof Error && "code" in err && err.code === "workspace_generation_closed") {
|
|
2106
2148
|
return err;
|
|
2107
2149
|
}
|
|
2108
2150
|
const fs8 = wrapAsFsError(err);
|
|
2151
|
+
if (opts?.audit === false) {
|
|
2152
|
+
return fs8;
|
|
2153
|
+
}
|
|
2109
2154
|
this.deps.audit.recordDenied(this.deps.ctx, {
|
|
2110
2155
|
intent,
|
|
2111
2156
|
input,
|
|
@@ -2557,6 +2602,22 @@ function mergeWriteMeta(existing, opts) {
|
|
|
2557
2602
|
}
|
|
2558
2603
|
__name(mergeWriteMeta, "mergeWriteMeta");
|
|
2559
2604
|
async function atomicWriteTextResolvedFile(input) {
|
|
2605
|
+
const buf = await encodeTextFileContentAsync(
|
|
2606
|
+
input.target,
|
|
2607
|
+
input.content,
|
|
2608
|
+
buildWriteMeta(input.meta)
|
|
2609
|
+
);
|
|
2610
|
+
enforceWriteSize(buf.length);
|
|
2611
|
+
return atomicPublishResolvedFile({
|
|
2612
|
+
target: input.target,
|
|
2613
|
+
buf,
|
|
2614
|
+
mode: input.mode,
|
|
2615
|
+
expectedHash: input.expectedHash,
|
|
2616
|
+
assertGenerationOpen: input.assertGenerationOpen
|
|
2617
|
+
});
|
|
2618
|
+
}
|
|
2619
|
+
__name(atomicWriteTextResolvedFile, "atomicWriteTextResolvedFile");
|
|
2620
|
+
async function atomicPublishResolvedFile(input) {
|
|
2560
2621
|
const target = input.target;
|
|
2561
2622
|
const parent = path4.dirname(target);
|
|
2562
2623
|
const parentStat = await fsp2.lstat(parent);
|
|
@@ -2571,24 +2632,29 @@ async function atomicWriteTextResolvedFile(input) {
|
|
|
2571
2632
|
`parent path is not a directory: ${parent}`
|
|
2572
2633
|
);
|
|
2573
2634
|
}
|
|
2574
|
-
const
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
);
|
|
2635
|
+
const tmpSuffix = `.${process.pid}.${randomBytes(6).toString("hex")}.tmp`;
|
|
2636
|
+
const tmpNameMaxBytes = 255;
|
|
2637
|
+
const tmpBaseMaxBytes = tmpNameMaxBytes - 1 - Buffer.byteLength(tmpSuffix, "utf-8");
|
|
2638
|
+
let tmpBase = path4.basename(target);
|
|
2639
|
+
if (Buffer.byteLength(tmpBase, "utf-8") > tmpBaseMaxBytes) {
|
|
2640
|
+
tmpBase = safeUtf8Truncate(
|
|
2641
|
+
Buffer.from(tmpBase, "utf-8"),
|
|
2642
|
+
tmpBaseMaxBytes
|
|
2643
|
+
).toString("utf-8");
|
|
2644
|
+
}
|
|
2645
|
+
const tmpPath = path4.join(parent, `.${tmpBase}${tmpSuffix}`);
|
|
2578
2646
|
let tempLive = false;
|
|
2579
2647
|
let tempHandle;
|
|
2580
2648
|
let tempStat;
|
|
2581
2649
|
try {
|
|
2582
2650
|
tempHandle = await reserveTempFile(tmpPath);
|
|
2583
2651
|
tempLive = true;
|
|
2584
|
-
const
|
|
2585
|
-
targetPath: target,
|
|
2652
|
+
const written = await writeBufferToTemp({
|
|
2586
2653
|
tmpPath,
|
|
2587
|
-
|
|
2588
|
-
meta: input.meta,
|
|
2654
|
+
buf: input.buf,
|
|
2589
2655
|
handle: tempHandle
|
|
2590
2656
|
});
|
|
2591
|
-
tempStat =
|
|
2657
|
+
tempStat = written.stat;
|
|
2592
2658
|
const targetState = await assertAtomicTargetPrecondition({
|
|
2593
2659
|
target,
|
|
2594
2660
|
mode: input.mode,
|
|
@@ -2607,7 +2673,7 @@ async function atomicWriteTextResolvedFile(input) {
|
|
|
2607
2673
|
}
|
|
2608
2674
|
tempLive = false;
|
|
2609
2675
|
await fsyncParentDirBestEffort(parent);
|
|
2610
|
-
return
|
|
2676
|
+
return written;
|
|
2611
2677
|
} catch (err) {
|
|
2612
2678
|
await tempHandle?.close().catch(() => void 0);
|
|
2613
2679
|
if (tempLive) {
|
|
@@ -2619,19 +2685,13 @@ async function atomicWriteTextResolvedFile(input) {
|
|
|
2619
2685
|
throw err;
|
|
2620
2686
|
}
|
|
2621
2687
|
}
|
|
2622
|
-
__name(
|
|
2688
|
+
__name(atomicPublishResolvedFile, "atomicPublishResolvedFile");
|
|
2623
2689
|
async function reserveTempFile(tmpPath) {
|
|
2624
2690
|
return fsp2.open(tmpPath, "wx", 384);
|
|
2625
2691
|
}
|
|
2626
2692
|
__name(reserveTempFile, "reserveTempFile");
|
|
2627
|
-
async function
|
|
2628
|
-
|
|
2629
|
-
input.targetPath,
|
|
2630
|
-
input.content,
|
|
2631
|
-
buildWriteMeta(input.meta)
|
|
2632
|
-
);
|
|
2633
|
-
enforceWriteSize(buf.length);
|
|
2634
|
-
await input.handle.writeFile(buf);
|
|
2693
|
+
async function writeBufferToTemp(input) {
|
|
2694
|
+
await input.handle.writeFile(input.buf);
|
|
2635
2695
|
await syncHandleBestEffort(input.handle);
|
|
2636
2696
|
const st = await fsp2.lstat(input.tmpPath);
|
|
2637
2697
|
const opened = await input.handle.stat();
|
|
@@ -2649,9 +2709,9 @@ async function writeEncodedTextTemp(input) {
|
|
|
2649
2709
|
`temporary path is not a regular file: ${input.tmpPath}`
|
|
2650
2710
|
);
|
|
2651
2711
|
}
|
|
2652
|
-
return { sizeBytes: buf.length, hash: hashBuffer(buf), stat: st };
|
|
2712
|
+
return { sizeBytes: input.buf.length, hash: hashBuffer(input.buf), stat: st };
|
|
2653
2713
|
}
|
|
2654
|
-
__name(
|
|
2714
|
+
__name(writeBufferToTemp, "writeBufferToTemp");
|
|
2655
2715
|
async function assertCreateTargetAbsent(target) {
|
|
2656
2716
|
try {
|
|
2657
2717
|
const st = await fsp2.lstat(target);
|
|
@@ -9839,20 +9899,31 @@ var AcpDispatcher = class {
|
|
|
9839
9899
|
if ("error" in parsedSource) {
|
|
9840
9900
|
throw new AcpParamError(parsedSource.error);
|
|
9841
9901
|
}
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
|
|
9855
|
-
|
|
9902
|
+
let result;
|
|
9903
|
+
try {
|
|
9904
|
+
conn.abortSignal.throwIfAborted();
|
|
9905
|
+
result = await listWorkspaceSessionsForResponse(
|
|
9906
|
+
this.bridge,
|
|
9907
|
+
workspaceCwd,
|
|
9908
|
+
{
|
|
9909
|
+
cursor,
|
|
9910
|
+
size: metaSize,
|
|
9911
|
+
archiveState,
|
|
9912
|
+
view,
|
|
9913
|
+
group,
|
|
9914
|
+
parentSessionId,
|
|
9915
|
+
...parsedSource
|
|
9916
|
+
},
|
|
9917
|
+
{
|
|
9918
|
+
runtimeBaseDir: this.sessionRuntimeBaseDir,
|
|
9919
|
+
signal: conn.abortSignal
|
|
9920
|
+
}
|
|
9921
|
+
);
|
|
9922
|
+
conn.abortSignal.throwIfAborted();
|
|
9923
|
+
} catch (error2) {
|
|
9924
|
+
if (conn.abortSignal.aborted) return;
|
|
9925
|
+
throw error2;
|
|
9926
|
+
}
|
|
9856
9927
|
this.replyConn(conn, id, {
|
|
9857
9928
|
sessions: result.sessions.map((s) => ({
|
|
9858
9929
|
sessionId: s.sessionId,
|
|
@@ -14570,7 +14641,7 @@ function mountAcpHttp(app, bridge, opts) {
|
|
|
14570
14641
|
const archiveCoordinator = opts.archiveCoordinator ?? new SessionArchiveCoordinator();
|
|
14571
14642
|
const requestedSessionIdAdmission = opts.requestedSessionIdAdmission;
|
|
14572
14643
|
const getPrimaryEnv = /* @__PURE__ */ __name(() => opts.workspaceRegistry ? runtimeEffectiveEnv(opts.workspaceRegistry.primary, daemonEnv) : daemonEnv, "getPrimaryEnv");
|
|
14573
|
-
const
|
|
14644
|
+
const path17 = opts.path ?? "/acp";
|
|
14574
14645
|
const dispatcherRef = {};
|
|
14575
14646
|
let disposed = false;
|
|
14576
14647
|
const rejectIfDisposed = /* @__PURE__ */ __name((res) => {
|
|
@@ -14754,7 +14825,7 @@ function mountAcpHttp(app, bridge, opts) {
|
|
|
14754
14825
|
const primaryMount = {
|
|
14755
14826
|
primary: true,
|
|
14756
14827
|
workspaceCwd: opts.boundWorkspace,
|
|
14757
|
-
routeLabel: logSafe(
|
|
14828
|
+
routeLabel: logSafe(path17),
|
|
14758
14829
|
rateLimitScope: opts.workspaceRegistry?.primary.workspaceId ?? "primary",
|
|
14759
14830
|
registry,
|
|
14760
14831
|
dispatcher,
|
|
@@ -14908,7 +14979,7 @@ function mountAcpHttp(app, bridge, opts) {
|
|
|
14908
14979
|
});
|
|
14909
14980
|
}, "handleAcpPost");
|
|
14910
14981
|
app.post(
|
|
14911
|
-
|
|
14982
|
+
path17,
|
|
14912
14983
|
(req, res) => handleAcpPost(primaryMount, req, res)
|
|
14913
14984
|
);
|
|
14914
14985
|
const handleAcpGet = /* @__PURE__ */ __name((mount, req, res) => {
|
|
@@ -15007,10 +15078,10 @@ function mountAcpHttp(app, bridge, opts) {
|
|
|
15007
15078
|
onPumpSettled();
|
|
15008
15079
|
});
|
|
15009
15080
|
}, "handleAcpGet");
|
|
15010
|
-
app.get(
|
|
15081
|
+
app.get(path17, (req, res) => {
|
|
15011
15082
|
handleAcpGet(primaryMount, req, res);
|
|
15012
15083
|
});
|
|
15013
|
-
app.delete(
|
|
15084
|
+
app.delete(path17, (req, res) => {
|
|
15014
15085
|
handleAcpDelete(primaryMount, req, res);
|
|
15015
15086
|
});
|
|
15016
15087
|
const createSecondaryAcpMount = /* @__PURE__ */ __name((rt) => {
|
|
@@ -15219,7 +15290,7 @@ function mountAcpHttp(app, bridge, opts) {
|
|
|
15219
15290
|
const isPluralAcpShape = pluralRawSelector !== null;
|
|
15220
15291
|
const pluralVoiceRawSelector = opts.workspaceVoiceConnection ? pluralWorkspaceRawSelector(rawPath, PLURAL_VOICE_WS_SUFFIX) : null;
|
|
15221
15292
|
const isPluralVoiceShape = pluralVoiceRawSelector !== null;
|
|
15222
|
-
if (rawPath !==
|
|
15293
|
+
if (rawPath !== path17 && !isCdpPath && !extraRoute && !isPluralAcpShape && !isPluralVoiceShape) {
|
|
15223
15294
|
logReject(`unknown-path ${logSafe(rawPath)}`);
|
|
15224
15295
|
socket.destroy();
|
|
15225
15296
|
return;
|
|
@@ -15757,7 +15828,7 @@ function mountAcpHttp(app, bridge, opts) {
|
|
|
15757
15828
|
});
|
|
15758
15829
|
}, "upgradeListener");
|
|
15759
15830
|
httpServer.on("upgrade", upgradeListener);
|
|
15760
|
-
writeStderrLine(`qwen serve: /acp WebSocket transport enabled on ${
|
|
15831
|
+
writeStderrLine(`qwen serve: /acp WebSocket transport enabled on ${path17}`);
|
|
15761
15832
|
}
|
|
15762
15833
|
__name(setupWebSocket, "setupWebSocket");
|
|
15763
15834
|
return {
|
|
@@ -19657,6 +19728,8 @@ __name(registerWorkspaceExtensionRoutes, "registerWorkspaceExtensionRoutes");
|
|
|
19657
19728
|
|
|
19658
19729
|
// packages/cli/src/serve/routes/workspace-file-write.ts
|
|
19659
19730
|
init_esbuild_shims();
|
|
19731
|
+
var import_express3 = __toESM(require_express(), 1);
|
|
19732
|
+
import * as path10 from "node:path";
|
|
19660
19733
|
function getFsFactory3(req, res) {
|
|
19661
19734
|
const context = getWorkspaceRouteContext(req);
|
|
19662
19735
|
if (context) return context.runtime.routeFileSystemFactory;
|
|
@@ -19934,6 +20007,351 @@ function registerWorkspaceQualifiedFileWriteRoutes(app, deps) {
|
|
|
19934
20007
|
);
|
|
19935
20008
|
}
|
|
19936
20009
|
__name(registerWorkspaceQualifiedFileWriteRoutes, "registerWorkspaceQualifiedFileWriteRoutes");
|
|
20010
|
+
var MAX_CONCURRENT_UPLOADS = 4;
|
|
20011
|
+
var MAX_UPLOAD_FILENAME_BYTES = 255;
|
|
20012
|
+
var NUMBERED_CANDIDATE_CAP = 1e3;
|
|
20013
|
+
var uploadGateLeases = /* @__PURE__ */ new WeakMap();
|
|
20014
|
+
function createUploadConcurrencyGate(max = MAX_CONCURRENT_UPLOADS) {
|
|
20015
|
+
let active = 0;
|
|
20016
|
+
return {
|
|
20017
|
+
tryAcquire() {
|
|
20018
|
+
if (active >= max) return false;
|
|
20019
|
+
active += 1;
|
|
20020
|
+
return true;
|
|
20021
|
+
},
|
|
20022
|
+
release() {
|
|
20023
|
+
if (active > 0) active -= 1;
|
|
20024
|
+
}
|
|
20025
|
+
};
|
|
20026
|
+
}
|
|
20027
|
+
__name(createUploadConcurrencyGate, "createUploadConcurrencyGate");
|
|
20028
|
+
var uploadAdmissions = /* @__PURE__ */ new WeakMap();
|
|
20029
|
+
function splitStemExtension(basename7) {
|
|
20030
|
+
const lastDot = basename7.lastIndexOf(".");
|
|
20031
|
+
if (lastDot <= 0) return { stem: basename7, ext: "" };
|
|
20032
|
+
return { stem: basename7.slice(0, lastDot), ext: basename7.slice(lastDot) };
|
|
20033
|
+
}
|
|
20034
|
+
__name(splitStemExtension, "splitStemExtension");
|
|
20035
|
+
function fitFilenameToByteCap(stem, suffix, ext, capBytes) {
|
|
20036
|
+
if (Buffer.byteLength(suffix + ext, "utf-8") > capBytes) return null;
|
|
20037
|
+
let chars = Array.from(stem);
|
|
20038
|
+
while (Buffer.byteLength(chars.join("") + suffix + ext, "utf-8") > capBytes) {
|
|
20039
|
+
if (chars.length === 0) return null;
|
|
20040
|
+
chars = chars.slice(0, -1);
|
|
20041
|
+
}
|
|
20042
|
+
return chars.join("") + suffix + ext;
|
|
20043
|
+
}
|
|
20044
|
+
__name(fitFilenameToByteCap, "fitFilenameToByteCap");
|
|
20045
|
+
function sendUploadTooLarge(res) {
|
|
20046
|
+
applyReadHeaders(res);
|
|
20047
|
+
res.status(413).json({
|
|
20048
|
+
errorKind: "file_too_large",
|
|
20049
|
+
error: `Request body too large (max ${MAX_UPLOAD_BYTES / (1024 * 1024)} MiB)`,
|
|
20050
|
+
status: 413,
|
|
20051
|
+
maxBytes: MAX_UPLOAD_BYTES
|
|
20052
|
+
});
|
|
20053
|
+
}
|
|
20054
|
+
__name(sendUploadTooLarge, "sendUploadTooLarge");
|
|
20055
|
+
function fileUploadConcurrencyGate(gate) {
|
|
20056
|
+
return (req, res, next) => {
|
|
20057
|
+
if (!gate.tryAcquire()) {
|
|
20058
|
+
applyReadHeaders(res);
|
|
20059
|
+
res.status(429).set("Retry-After", "1").json({
|
|
20060
|
+
errorKind: "upload_busy",
|
|
20061
|
+
error: "Too many uploads in progress",
|
|
20062
|
+
status: 429,
|
|
20063
|
+
retryAfterSeconds: 1
|
|
20064
|
+
});
|
|
20065
|
+
return;
|
|
20066
|
+
}
|
|
20067
|
+
let released = false;
|
|
20068
|
+
const release = /* @__PURE__ */ __name(() => {
|
|
20069
|
+
if (released) return;
|
|
20070
|
+
released = true;
|
|
20071
|
+
gate.release();
|
|
20072
|
+
res.off("finish", releaseBeforeHandler);
|
|
20073
|
+
res.off("close", releaseBeforeHandler);
|
|
20074
|
+
uploadGateLeases.delete(req);
|
|
20075
|
+
}, "release");
|
|
20076
|
+
const releaseBeforeHandler = /* @__PURE__ */ __name(() => {
|
|
20077
|
+
if (!lease.handlerStarted) release();
|
|
20078
|
+
}, "releaseBeforeHandler");
|
|
20079
|
+
const lease = { handlerStarted: false, release };
|
|
20080
|
+
uploadGateLeases.set(req, lease);
|
|
20081
|
+
res.once("finish", releaseBeforeHandler);
|
|
20082
|
+
res.once("close", releaseBeforeHandler);
|
|
20083
|
+
next();
|
|
20084
|
+
};
|
|
20085
|
+
}
|
|
20086
|
+
__name(fileUploadConcurrencyGate, "fileUploadConcurrencyGate");
|
|
20087
|
+
function fileUploadBodyParser() {
|
|
20088
|
+
const raw = import_express3.default.raw({
|
|
20089
|
+
type: "application/octet-stream",
|
|
20090
|
+
limit: MAX_UPLOAD_BYTES,
|
|
20091
|
+
// The endpoint contract is raw octets: decoding a Content-Encoding would
|
|
20092
|
+
// publish bytes the client never sent (and hash/size of the decoded form).
|
|
20093
|
+
inflate: false
|
|
20094
|
+
});
|
|
20095
|
+
return (req, res, next) => {
|
|
20096
|
+
raw(req, res, (err) => {
|
|
20097
|
+
if (err) {
|
|
20098
|
+
const status = err.status;
|
|
20099
|
+
if (status === 413) {
|
|
20100
|
+
sendUploadTooLarge(res);
|
|
20101
|
+
return;
|
|
20102
|
+
}
|
|
20103
|
+
if (status === 415) {
|
|
20104
|
+
applyReadHeaders(res);
|
|
20105
|
+
res.status(415).json({
|
|
20106
|
+
errorKind: "unsupported_media_type",
|
|
20107
|
+
error: "File uploads do not support encoded request bodies",
|
|
20108
|
+
status: 415
|
|
20109
|
+
});
|
|
20110
|
+
return;
|
|
20111
|
+
}
|
|
20112
|
+
if (err.code === "ECONNABORTED" || req.aborted) {
|
|
20113
|
+
return;
|
|
20114
|
+
}
|
|
20115
|
+
next(err);
|
|
20116
|
+
return;
|
|
20117
|
+
}
|
|
20118
|
+
next();
|
|
20119
|
+
});
|
|
20120
|
+
};
|
|
20121
|
+
}
|
|
20122
|
+
__name(fileUploadBodyParser, "fileUploadBodyParser");
|
|
20123
|
+
function fileUploadAdmission(deps, opts) {
|
|
20124
|
+
return (req, res, next) => {
|
|
20125
|
+
void (async () => {
|
|
20126
|
+
const ROUTE2 = opts.qualified ? "POST /workspaces/:workspace/file/upload" : "POST /file/upload";
|
|
20127
|
+
try {
|
|
20128
|
+
if (opts.qualified) {
|
|
20129
|
+
const registry = deps.workspaceRegistry;
|
|
20130
|
+
if (!registry) {
|
|
20131
|
+
throw new Error("workspace registry is not configured");
|
|
20132
|
+
}
|
|
20133
|
+
const runtime = resolveWorkspaceRuntimeFromParam(registry, req, res);
|
|
20134
|
+
if (!runtime) return;
|
|
20135
|
+
if (!requireTrustedWorkspaceRuntime(runtime, res)) return;
|
|
20136
|
+
setWorkspaceRouteContext(req, {
|
|
20137
|
+
runtime,
|
|
20138
|
+
routePrefix: "POST /workspaces/:workspace"
|
|
20139
|
+
});
|
|
20140
|
+
} else if (opts.isWorkspaceTrusted?.() === false) {
|
|
20141
|
+
applyReadHeaders(res);
|
|
20142
|
+
res.status(403).json({
|
|
20143
|
+
errorKind: "untrusted_workspace",
|
|
20144
|
+
error: "workspace is not trusted; write operations are forbidden",
|
|
20145
|
+
status: 403
|
|
20146
|
+
});
|
|
20147
|
+
return;
|
|
20148
|
+
}
|
|
20149
|
+
const contentType = (req.headers["content-type"] ?? "").split(";")[0].trim().toLowerCase();
|
|
20150
|
+
if (contentType !== "application/octet-stream") {
|
|
20151
|
+
applyReadHeaders(res);
|
|
20152
|
+
res.status(415).json({
|
|
20153
|
+
errorKind: "unsupported_media_type",
|
|
20154
|
+
error: "File uploads require application/octet-stream",
|
|
20155
|
+
status: 415
|
|
20156
|
+
});
|
|
20157
|
+
return;
|
|
20158
|
+
}
|
|
20159
|
+
const queryPath = req.query["path"];
|
|
20160
|
+
if (typeof queryPath !== "string" || queryPath.length === 0) {
|
|
20161
|
+
sendParseError(res, ROUTE2, "`path` query parameter is required");
|
|
20162
|
+
return;
|
|
20163
|
+
}
|
|
20164
|
+
const dir = path10.dirname(queryPath);
|
|
20165
|
+
const basename7 = path10.basename(queryPath);
|
|
20166
|
+
if (queryPath.endsWith("/") || basename7.length === 0 || basename7 === "." || basename7 === "..") {
|
|
20167
|
+
sendParseError(res, ROUTE2, "`path` must name a file");
|
|
20168
|
+
return;
|
|
20169
|
+
}
|
|
20170
|
+
if (queryPath.includes("\0")) {
|
|
20171
|
+
sendParseError(res, ROUTE2, "path must not contain null bytes");
|
|
20172
|
+
return;
|
|
20173
|
+
}
|
|
20174
|
+
if (hasSuspiciousPathPattern(basename7)) {
|
|
20175
|
+
sendParseError(res, ROUTE2, "filename contains a suspicious pattern");
|
|
20176
|
+
return;
|
|
20177
|
+
}
|
|
20178
|
+
if (Buffer.byteLength(basename7, "utf-8") > MAX_UPLOAD_FILENAME_BYTES) {
|
|
20179
|
+
sendParseError(
|
|
20180
|
+
res,
|
|
20181
|
+
ROUTE2,
|
|
20182
|
+
`filename exceeds ${MAX_UPLOAD_FILENAME_BYTES} bytes`
|
|
20183
|
+
);
|
|
20184
|
+
return;
|
|
20185
|
+
}
|
|
20186
|
+
const contentLength = req.headers["content-length"];
|
|
20187
|
+
if (contentLength !== void 0) {
|
|
20188
|
+
const declared = Number(contentLength);
|
|
20189
|
+
if (Number.isFinite(declared) && declared > MAX_UPLOAD_BYTES) {
|
|
20190
|
+
sendUploadTooLarge(res);
|
|
20191
|
+
return;
|
|
20192
|
+
}
|
|
20193
|
+
}
|
|
20194
|
+
const clientId = deps.parseClientId(req, res);
|
|
20195
|
+
if (clientId === null) return;
|
|
20196
|
+
const originatorClientId = resolveOriginatorClientId2(
|
|
20197
|
+
clientId,
|
|
20198
|
+
deps,
|
|
20199
|
+
res,
|
|
20200
|
+
req
|
|
20201
|
+
);
|
|
20202
|
+
if (originatorClientId === null) return;
|
|
20203
|
+
const factory = getFsFactory3(req, res);
|
|
20204
|
+
if (!factory) return;
|
|
20205
|
+
const fs8 = factory.forRequest({
|
|
20206
|
+
originatorClientId,
|
|
20207
|
+
route: ROUTE2
|
|
20208
|
+
});
|
|
20209
|
+
const resolvedDir = await fs8.resolve(dir, "write");
|
|
20210
|
+
let dirStat;
|
|
20211
|
+
try {
|
|
20212
|
+
dirStat = await fs8.stat(resolvedDir);
|
|
20213
|
+
} catch (err) {
|
|
20214
|
+
if (isFsError(err) && err.kind === "path_not_found") {
|
|
20215
|
+
sendParseError(res, ROUTE2, "parent directory does not exist");
|
|
20216
|
+
return;
|
|
20217
|
+
}
|
|
20218
|
+
throw err;
|
|
20219
|
+
}
|
|
20220
|
+
if (dirStat.kind !== "directory") {
|
|
20221
|
+
sendParseError(res, ROUTE2, "parent path is not a directory");
|
|
20222
|
+
return;
|
|
20223
|
+
}
|
|
20224
|
+
uploadAdmissions.set(req, {
|
|
20225
|
+
route: ROUTE2,
|
|
20226
|
+
fs: fs8,
|
|
20227
|
+
basename: basename7,
|
|
20228
|
+
resolvedDir,
|
|
20229
|
+
queryDir: dir
|
|
20230
|
+
});
|
|
20231
|
+
next();
|
|
20232
|
+
} catch (err) {
|
|
20233
|
+
sendFsError(
|
|
20234
|
+
res,
|
|
20235
|
+
err,
|
|
20236
|
+
opts.qualified ? "POST /workspaces/:workspace/file/upload" : "POST /file/upload"
|
|
20237
|
+
);
|
|
20238
|
+
}
|
|
20239
|
+
})();
|
|
20240
|
+
};
|
|
20241
|
+
}
|
|
20242
|
+
__name(fileUploadAdmission, "fileUploadAdmission");
|
|
20243
|
+
async function handlePostFileUpload(req, res) {
|
|
20244
|
+
const admission = uploadAdmissions.get(req);
|
|
20245
|
+
if (!admission) {
|
|
20246
|
+
applyReadHeaders(res);
|
|
20247
|
+
res.status(500).json({
|
|
20248
|
+
errorKind: "internal_error",
|
|
20249
|
+
error: "upload admission context is missing",
|
|
20250
|
+
status: 500
|
|
20251
|
+
});
|
|
20252
|
+
return;
|
|
20253
|
+
}
|
|
20254
|
+
const { route, fs: fs8, basename: basename7, resolvedDir, queryDir } = admission;
|
|
20255
|
+
const { stem, ext } = splitStemExtension(basename7);
|
|
20256
|
+
const lease = uploadGateLeases.get(req);
|
|
20257
|
+
if (lease) lease.handlerStarted = true;
|
|
20258
|
+
try {
|
|
20259
|
+
if (req.aborted || res.closed) return;
|
|
20260
|
+
const body = req.body;
|
|
20261
|
+
const data = body === void 0 || body === null ? Buffer.alloc(0) : body;
|
|
20262
|
+
for (let n = 0; n < NUMBERED_CANDIDATE_CAP; n++) {
|
|
20263
|
+
const candidateBasename = n === 0 ? basename7 : fitFilenameToByteCap(
|
|
20264
|
+
stem,
|
|
20265
|
+
` (${n})`,
|
|
20266
|
+
ext,
|
|
20267
|
+
MAX_UPLOAD_FILENAME_BYTES
|
|
20268
|
+
);
|
|
20269
|
+
if (candidateBasename === null) {
|
|
20270
|
+
sendParseError(
|
|
20271
|
+
res,
|
|
20272
|
+
route,
|
|
20273
|
+
`filename cannot fit within ${MAX_UPLOAD_FILENAME_BYTES} bytes`
|
|
20274
|
+
);
|
|
20275
|
+
return;
|
|
20276
|
+
}
|
|
20277
|
+
const candidateAbs = path10.join(resolvedDir, candidateBasename);
|
|
20278
|
+
let resolved;
|
|
20279
|
+
try {
|
|
20280
|
+
resolved = await fs8.resolve(
|
|
20281
|
+
path10.join(queryDir, candidateBasename),
|
|
20282
|
+
"write"
|
|
20283
|
+
);
|
|
20284
|
+
} catch (err) {
|
|
20285
|
+
if (isFsError(err) && err.kind === "symlink_escape" && err.cause?.code === "ELOOP") {
|
|
20286
|
+
continue;
|
|
20287
|
+
}
|
|
20288
|
+
sendFsError(res, err, route);
|
|
20289
|
+
return;
|
|
20290
|
+
}
|
|
20291
|
+
if (resolved !== candidateAbs) {
|
|
20292
|
+
continue;
|
|
20293
|
+
}
|
|
20294
|
+
try {
|
|
20295
|
+
const out = await fs8.writeBytesAtomic(resolved, data);
|
|
20296
|
+
applyReadHeaders(res);
|
|
20297
|
+
res.status(201).json({
|
|
20298
|
+
kind: "file_upload",
|
|
20299
|
+
path: workspaceRelative(req, resolved),
|
|
20300
|
+
sizeBytes: out.sizeBytes,
|
|
20301
|
+
hash: out.hash
|
|
20302
|
+
});
|
|
20303
|
+
return;
|
|
20304
|
+
} catch (err) {
|
|
20305
|
+
if (isFsError(err) && err.kind === "file_already_exists") {
|
|
20306
|
+
continue;
|
|
20307
|
+
}
|
|
20308
|
+
sendFsError(res, err, route);
|
|
20309
|
+
return;
|
|
20310
|
+
}
|
|
20311
|
+
}
|
|
20312
|
+
applyReadHeaders(res);
|
|
20313
|
+
res.status(409).json({
|
|
20314
|
+
errorKind: "file_already_exists",
|
|
20315
|
+
error: `could not allocate a free filename for "${basename7}"`,
|
|
20316
|
+
status: 409
|
|
20317
|
+
});
|
|
20318
|
+
} catch (err) {
|
|
20319
|
+
sendFsError(res, err, route);
|
|
20320
|
+
} finally {
|
|
20321
|
+
uploadAdmissions.delete(req);
|
|
20322
|
+
lease?.release();
|
|
20323
|
+
}
|
|
20324
|
+
}
|
|
20325
|
+
__name(handlePostFileUpload, "handlePostFileUpload");
|
|
20326
|
+
function registerWorkspaceFileUploadRoutes(app, deps) {
|
|
20327
|
+
app.post(
|
|
20328
|
+
"/file/upload",
|
|
20329
|
+
deps.mutate({ strict: true }),
|
|
20330
|
+
fileUploadAdmission(deps, {
|
|
20331
|
+
qualified: false,
|
|
20332
|
+
isWorkspaceTrusted: deps.isWorkspaceTrusted
|
|
20333
|
+
}),
|
|
20334
|
+
fileUploadConcurrencyGate(deps.uploadGate),
|
|
20335
|
+
fileUploadBodyParser(),
|
|
20336
|
+
(req, res) => {
|
|
20337
|
+
void handlePostFileUpload(req, res);
|
|
20338
|
+
}
|
|
20339
|
+
);
|
|
20340
|
+
}
|
|
20341
|
+
__name(registerWorkspaceFileUploadRoutes, "registerWorkspaceFileUploadRoutes");
|
|
20342
|
+
function registerWorkspaceQualifiedFileUploadRoutes(app, deps) {
|
|
20343
|
+
app.post(
|
|
20344
|
+
"/workspaces/:workspace/file/upload",
|
|
20345
|
+
deps.mutate({ strict: true }),
|
|
20346
|
+
fileUploadAdmission(deps, { qualified: true }),
|
|
20347
|
+
fileUploadConcurrencyGate(deps.uploadGate),
|
|
20348
|
+
fileUploadBodyParser(),
|
|
20349
|
+
(req, res) => {
|
|
20350
|
+
void handlePostFileUpload(req, res);
|
|
20351
|
+
}
|
|
20352
|
+
);
|
|
20353
|
+
}
|
|
20354
|
+
__name(registerWorkspaceQualifiedFileUploadRoutes, "registerWorkspaceQualifiedFileUploadRoutes");
|
|
19937
20355
|
|
|
19938
20356
|
// packages/cli/src/serve/routes/workspace-trust.ts
|
|
19939
20357
|
init_esbuild_shims();
|
|
@@ -20288,15 +20706,15 @@ var legacySessionTelemetryRoutes = [
|
|
|
20288
20706
|
},
|
|
20289
20707
|
{
|
|
20290
20708
|
method: "GET",
|
|
20291
|
-
path: "/session/:id/subagents/:
|
|
20709
|
+
path: "/session/:id/subagents/:subagentRef",
|
|
20292
20710
|
attribution: "handler_resolved",
|
|
20293
|
-
route: "GET /session/:id/subagents/:
|
|
20711
|
+
route: "GET /session/:id/subagents/:subagentRef"
|
|
20294
20712
|
},
|
|
20295
20713
|
{
|
|
20296
20714
|
method: "POST",
|
|
20297
|
-
path: "/session/:id/subagents/:
|
|
20715
|
+
path: "/session/:id/subagents/:subagentRef/cancel",
|
|
20298
20716
|
attribution: "handler_resolved",
|
|
20299
|
-
route: "POST /session/:id/subagents/:
|
|
20717
|
+
route: "POST /session/:id/subagents/:subagentRef/cancel"
|
|
20300
20718
|
},
|
|
20301
20719
|
{
|
|
20302
20720
|
method: "GET",
|
|
@@ -20418,6 +20836,12 @@ var legacySessionTelemetryRoutes = [
|
|
|
20418
20836
|
attribution: "handler_resolved",
|
|
20419
20837
|
route: "POST /session/:id/model"
|
|
20420
20838
|
},
|
|
20839
|
+
{
|
|
20840
|
+
method: "POST",
|
|
20841
|
+
path: "/session/:id/config-option",
|
|
20842
|
+
attribution: "handler_resolved",
|
|
20843
|
+
route: "POST /session/:id/config-option"
|
|
20844
|
+
},
|
|
20421
20845
|
{
|
|
20422
20846
|
method: "POST",
|
|
20423
20847
|
path: "/session/:id/recap",
|
|
@@ -20525,8 +20949,8 @@ function decodePathSegment(value) {
|
|
|
20525
20949
|
}
|
|
20526
20950
|
__name(decodePathSegment, "decodePathSegment");
|
|
20527
20951
|
function matchLegacySessionTelemetryRoute(method, requestPath) {
|
|
20528
|
-
const
|
|
20529
|
-
const requestSegments =
|
|
20952
|
+
const path17 = requestPath.length > 1 && requestPath.endsWith("/") ? requestPath.slice(0, -1) : requestPath;
|
|
20953
|
+
const requestSegments = path17.split("/").slice(1);
|
|
20530
20954
|
const prefix = requestSegments[0]?.toLowerCase();
|
|
20531
20955
|
if (prefix !== "session" && prefix !== "sessions" && prefix !== "permission") {
|
|
20532
20956
|
return void 0;
|
|
@@ -20578,23 +21002,23 @@ __name(setDaemonTelemetryWorkspace, "setDaemonTelemetryWorkspace");
|
|
|
20578
21002
|
function resolveDaemonTelemetryRoute(req) {
|
|
20579
21003
|
const legacyRoute = matchLegacySessionTelemetryRoute(req.method, req.path);
|
|
20580
21004
|
if (legacyRoute) return legacyRoute;
|
|
20581
|
-
const
|
|
20582
|
-
if (req.method === "GET" &&
|
|
21005
|
+
const path17 = req.path.replace(/\/$/, "") || "/";
|
|
21006
|
+
if (req.method === "GET" && path17 === "/daemon/status") {
|
|
20583
21007
|
return { route: "GET /daemon/status" };
|
|
20584
21008
|
}
|
|
20585
|
-
if (req.method === "GET" && /^\/workspace\/[^/]+\/sessions$/.test(
|
|
21009
|
+
if (req.method === "GET" && /^\/workspace\/[^/]+\/sessions$/.test(path17)) {
|
|
20586
21010
|
return { route: "GET /workspace/:id/sessions" };
|
|
20587
21011
|
}
|
|
20588
|
-
if (req.method === "GET" && /^\/workspaces\/[^/]+\/sessions$/.test(
|
|
21012
|
+
if (req.method === "GET" && /^\/workspaces\/[^/]+\/sessions$/.test(path17)) {
|
|
20589
21013
|
return { route: "GET /workspace/:id/sessions" };
|
|
20590
21014
|
}
|
|
20591
|
-
if (req.method === "GET" && /^\/workspace\/[^/]+\/session-info$/.test(
|
|
21015
|
+
if (req.method === "GET" && /^\/workspace\/[^/]+\/session-info$/.test(path17)) {
|
|
20592
21016
|
return { route: "GET /workspace/:id/session-info" };
|
|
20593
21017
|
}
|
|
20594
|
-
if (req.method === "GET" && /^\/workspaces\/[^/]+\/session-info$/.test(
|
|
21018
|
+
if (req.method === "GET" && /^\/workspaces\/[^/]+\/session-info$/.test(path17)) {
|
|
20595
21019
|
return { route: "GET /workspace/:id/session-info" };
|
|
20596
21020
|
}
|
|
20597
|
-
const workspaceTranscript =
|
|
21021
|
+
const workspaceTranscript = path17.match(
|
|
20598
21022
|
/^\/workspaces\/[^/]+\/session\/([^/]+)\/transcript$/
|
|
20599
21023
|
);
|
|
20600
21024
|
if (workspaceTranscript?.[1] && req.method === "GET") {
|
|
@@ -20603,7 +21027,7 @@ function resolveDaemonTelemetryRoute(req) {
|
|
|
20603
21027
|
sessionId: decodePathSegment(workspaceTranscript[1])
|
|
20604
21028
|
};
|
|
20605
21029
|
}
|
|
20606
|
-
const workspaceExport =
|
|
21030
|
+
const workspaceExport = path17.match(
|
|
20607
21031
|
/^\/workspaces\/[^/]+\/session\/([^/]+)\/export$/
|
|
20608
21032
|
);
|
|
20609
21033
|
if (workspaceExport?.[1] && req.method === "GET") {
|
|
@@ -20612,7 +21036,7 @@ function resolveDaemonTelemetryRoute(req) {
|
|
|
20612
21036
|
sessionId: decodePathSegment(workspaceExport[1])
|
|
20613
21037
|
};
|
|
20614
21038
|
}
|
|
20615
|
-
const workspaceArchivedExport =
|
|
21039
|
+
const workspaceArchivedExport = path17.match(
|
|
20616
21040
|
/^\/workspaces\/[^/]+\/session\/([^/]+)\/archive\/export$/
|
|
20617
21041
|
);
|
|
20618
21042
|
if (workspaceArchivedExport?.[1] && req.method === "GET") {
|
|
@@ -20622,8 +21046,8 @@ function resolveDaemonTelemetryRoute(req) {
|
|
|
20622
21046
|
};
|
|
20623
21047
|
}
|
|
20624
21048
|
const pluralWorkspacePrefix = /^\/workspaces\/[^/]+/;
|
|
20625
|
-
if (pluralWorkspacePrefix.test(
|
|
20626
|
-
const suffix =
|
|
21049
|
+
if (pluralWorkspacePrefix.test(path17)) {
|
|
21050
|
+
const suffix = path17.replace(pluralWorkspacePrefix, "/workspace");
|
|
20627
21051
|
if (req.method === "GET") {
|
|
20628
21052
|
if (suffix === "/workspace/mcp" || suffix === "/workspace/skills" || suffix === "/workspace/tools" || suffix === "/workspace/providers" || suffix === "/workspace/env" || suffix === "/workspace/preflight" || suffix === "/workspace/hooks" || suffix === "/workspace/settings" || suffix === "/workspace/voice" || suffix === "/workspace/permissions" || suffix === "/workspace/trust" || suffix === "/workspace/memory" || suffix === "/workspace/agents") {
|
|
20629
21053
|
return { route: `GET ${suffix}` };
|
|
@@ -20646,7 +21070,7 @@ function resolveDaemonTelemetryRoute(req) {
|
|
|
20646
21070
|
}
|
|
20647
21071
|
}
|
|
20648
21072
|
if (req.method === "POST") {
|
|
20649
|
-
if (suffix === "/workspace/settings" || suffix === "/workspace/voice" || suffix === "/workspace/voice/transcribe" || suffix === "/workspace/permissions" || suffix === "/workspace/trust/request" || suffix === "/workspace/init" || suffix === "/workspace/reload" || suffix === "/workspace/file/write" || suffix === "/workspace/file/edit" || suffix === "/workspace/mcp/servers" || suffix === "/workspace/memory" || suffix === "/workspace/agents" || suffix === "/workspace/sessions/delete" || suffix === "/workspace/sessions/archive" || suffix === "/workspace/sessions/unarchive" || suffix === "/workspace/session-groups") {
|
|
21073
|
+
if (suffix === "/workspace/settings" || suffix === "/workspace/voice" || suffix === "/workspace/voice/transcribe" || suffix === "/workspace/permissions" || suffix === "/workspace/trust/request" || suffix === "/workspace/init" || suffix === "/workspace/reload" || suffix === "/workspace/file/write" || suffix === "/workspace/file/edit" || suffix === "/workspace/file/upload" || suffix === "/workspace/mcp/servers" || suffix === "/workspace/memory" || suffix === "/workspace/agents" || suffix === "/workspace/sessions/delete" || suffix === "/workspace/sessions/archive" || suffix === "/workspace/sessions/unarchive" || suffix === "/workspace/session-groups") {
|
|
20650
21074
|
return { route: `POST ${suffix}` };
|
|
20651
21075
|
}
|
|
20652
21076
|
if (/^\/workspace\/tools\/[^/]+\/enable$/.test(suffix)) {
|
|
@@ -20682,58 +21106,58 @@ function resolveDaemonTelemetryRoute(req) {
|
|
|
20682
21106
|
return { route: "DELETE /workspace/session-groups/:groupId" };
|
|
20683
21107
|
}
|
|
20684
21108
|
}
|
|
20685
|
-
if (req.method === "POST" &&
|
|
21109
|
+
if (req.method === "POST" && path17 === "/workspace/init") {
|
|
20686
21110
|
return { route: "POST /workspace/init" };
|
|
20687
21111
|
}
|
|
20688
|
-
if (req.method === "POST" &&
|
|
21112
|
+
if (req.method === "POST" && path17 === "/workspace/setup-github") {
|
|
20689
21113
|
return { route: "POST /workspace/setup-github" };
|
|
20690
21114
|
}
|
|
20691
|
-
if (req.method === "POST" &&
|
|
21115
|
+
if (req.method === "POST" && path17 === "/workspace/reload") {
|
|
20692
21116
|
return { route: "POST /workspace/reload" };
|
|
20693
21117
|
}
|
|
20694
|
-
const mcpRestart =
|
|
21118
|
+
const mcpRestart = path17.match(/^\/workspace\/mcp\/([^/]+)\/restart$/);
|
|
20695
21119
|
if (mcpRestart?.[1] && req.method === "POST") {
|
|
20696
21120
|
return { route: "POST /workspace/mcp/:server/restart" };
|
|
20697
21121
|
}
|
|
20698
|
-
if (req.method === "POST" &&
|
|
21122
|
+
if (req.method === "POST" && path17 === "/workspace/mcp/servers") {
|
|
20699
21123
|
return { route: "POST /workspace/mcp/servers" };
|
|
20700
21124
|
}
|
|
20701
|
-
const mcpDelete =
|
|
21125
|
+
const mcpDelete = path17.match(/^\/workspace\/mcp\/servers\/([^/]+)$/);
|
|
20702
21126
|
if (mcpDelete?.[1] && req.method === "DELETE") {
|
|
20703
21127
|
return { route: "DELETE /workspace/mcp/servers/:name" };
|
|
20704
21128
|
}
|
|
20705
|
-
if (req.method === "POST" &&
|
|
21129
|
+
if (req.method === "POST" && path17 === "/workspace/auth/device-flow") {
|
|
20706
21130
|
return { route: "POST /workspace/auth/device-flow" };
|
|
20707
21131
|
}
|
|
20708
|
-
const deviceFlowDelete =
|
|
21132
|
+
const deviceFlowDelete = path17.match(
|
|
20709
21133
|
/^\/workspace\/auth\/device-flow\/([^/]+)$/
|
|
20710
21134
|
);
|
|
20711
21135
|
if (deviceFlowDelete?.[1] && req.method === "DELETE") {
|
|
20712
21136
|
return { route: "DELETE /workspace/auth/device-flow/:id" };
|
|
20713
21137
|
}
|
|
20714
|
-
const toolEnable =
|
|
21138
|
+
const toolEnable = path17.match(/^\/workspace\/tools\/([^/]+)\/enable$/);
|
|
20715
21139
|
if (toolEnable?.[1] && req.method === "POST") {
|
|
20716
21140
|
return { route: "POST /workspace/tools/:name/enable" };
|
|
20717
21141
|
}
|
|
20718
|
-
if (
|
|
21142
|
+
if (path17 === "/workspace/settings") {
|
|
20719
21143
|
if (req.method === "GET") return { route: "GET /workspace/settings" };
|
|
20720
21144
|
if (req.method === "POST") return { route: "POST /workspace/settings" };
|
|
20721
21145
|
}
|
|
20722
|
-
if (
|
|
21146
|
+
if (path17 === "/workspace/permissions") {
|
|
20723
21147
|
if (req.method === "GET") return { route: "GET /workspace/permissions" };
|
|
20724
21148
|
if (req.method === "POST") return { route: "POST /workspace/permissions" };
|
|
20725
21149
|
}
|
|
20726
|
-
if (
|
|
21150
|
+
if (path17 === "/workspace/trust") {
|
|
20727
21151
|
if (req.method === "GET") return { route: "GET /workspace/trust" };
|
|
20728
21152
|
}
|
|
20729
|
-
if (req.method === "POST" &&
|
|
21153
|
+
if (req.method === "POST" && path17 === "/workspace/trust/request") {
|
|
20730
21154
|
return { route: "POST /workspace/trust/request" };
|
|
20731
21155
|
}
|
|
20732
|
-
if (
|
|
21156
|
+
if (path17 === "/workspace/voice") {
|
|
20733
21157
|
if (req.method === "GET") return { route: "GET /workspace/voice" };
|
|
20734
21158
|
if (req.method === "POST") return { route: "POST /workspace/voice" };
|
|
20735
21159
|
}
|
|
20736
|
-
if (req.method === "POST" &&
|
|
21160
|
+
if (req.method === "POST" && path17 === "/workspace/voice/transcribe") {
|
|
20737
21161
|
return { route: "POST /workspace/voice/transcribe" };
|
|
20738
21162
|
}
|
|
20739
21163
|
return void 0;
|
|
@@ -21002,7 +21426,7 @@ __name(registerPermissionRoutes, "registerPermissionRoutes");
|
|
|
21002
21426
|
init_esbuild_shims();
|
|
21003
21427
|
import * as crypto3 from "node:crypto";
|
|
21004
21428
|
import * as fs6 from "node:fs";
|
|
21005
|
-
import * as
|
|
21429
|
+
import * as path12 from "node:path";
|
|
21006
21430
|
|
|
21007
21431
|
// packages/cli/src/serve/server/prompt-deadline.ts
|
|
21008
21432
|
init_esbuild_shims();
|
|
@@ -21022,7 +21446,7 @@ init_esbuild_shims();
|
|
|
21022
21446
|
|
|
21023
21447
|
// packages/cli/src/serve/server/persisted-session-list-cache.ts
|
|
21024
21448
|
init_esbuild_shims();
|
|
21025
|
-
import
|
|
21449
|
+
import path11 from "node:path";
|
|
21026
21450
|
var PersistedSessionListCache = class {
|
|
21027
21451
|
constructor(ttlMs, maxRetainedSummaries) {
|
|
21028
21452
|
this.ttlMs = ttlMs;
|
|
@@ -21033,7 +21457,8 @@ var PersistedSessionListCache = class {
|
|
|
21033
21457
|
}
|
|
21034
21458
|
slots = /* @__PURE__ */ new Map();
|
|
21035
21459
|
retainedSummaries = 0;
|
|
21036
|
-
lookup(scope, loader) {
|
|
21460
|
+
lookup(scope, loader, options = {}) {
|
|
21461
|
+
options.signal?.throwIfAborted();
|
|
21037
21462
|
const key = this.key(scope);
|
|
21038
21463
|
let slot = this.slots.get(key);
|
|
21039
21464
|
if (!slot) {
|
|
@@ -21044,27 +21469,43 @@ var PersistedSessionListCache = class {
|
|
|
21044
21469
|
if (slot.value) {
|
|
21045
21470
|
const cacheAgeMs = Math.max(0, now - slot.value.completedAt);
|
|
21046
21471
|
if (cacheAgeMs < this.ttlMs) {
|
|
21472
|
+
const snapshot = slot.value.snapshot;
|
|
21047
21473
|
return {
|
|
21048
21474
|
status: "cache_hit",
|
|
21049
|
-
promise: Promise.resolve(
|
|
21475
|
+
promise: Promise.resolve().then(() => {
|
|
21476
|
+
options.signal?.throwIfAborted();
|
|
21477
|
+
return snapshot;
|
|
21478
|
+
}),
|
|
21050
21479
|
cacheAgeMs
|
|
21051
21480
|
};
|
|
21052
21481
|
}
|
|
21053
21482
|
this.removeValue(slot);
|
|
21054
21483
|
}
|
|
21055
|
-
if (slot.inFlight !== void 0 && slot.inFlight.generation === slot.generation) {
|
|
21484
|
+
if (slot.inFlight !== void 0 && slot.inFlight.generation === slot.generation && !slot.inFlight.controller.signal.aborted) {
|
|
21056
21485
|
return {
|
|
21057
21486
|
status: "single_flight",
|
|
21058
|
-
promise: slot.inFlight.
|
|
21487
|
+
promise: this.attachWaiter(key, slot, slot.inFlight, options.signal)
|
|
21059
21488
|
};
|
|
21060
21489
|
}
|
|
21061
21490
|
const generation = slot.generation;
|
|
21062
|
-
const
|
|
21491
|
+
const controller = new AbortController();
|
|
21492
|
+
const load = {
|
|
21493
|
+
generation,
|
|
21494
|
+
controller,
|
|
21495
|
+
promise: void 0,
|
|
21496
|
+
waiterCount: 0,
|
|
21497
|
+
settled: false
|
|
21498
|
+
};
|
|
21499
|
+
const managed = Promise.resolve().then(() => {
|
|
21500
|
+
controller.signal.throwIfAborted();
|
|
21501
|
+
return loader(controller.signal);
|
|
21502
|
+
}).then(
|
|
21063
21503
|
(snapshot) => {
|
|
21504
|
+
load.settled = true;
|
|
21064
21505
|
const current = this.slots.get(key);
|
|
21065
|
-
if (current === slot && current.inFlight
|
|
21506
|
+
if (current === slot && current.inFlight === load) {
|
|
21066
21507
|
current.inFlight = void 0;
|
|
21067
|
-
if (current.generation === generation && snapshot.sessions.length <= this.maxRetainedSummaries) {
|
|
21508
|
+
if (current.generation === generation && !controller.signal.aborted && snapshot.sessions.length <= this.maxRetainedSummaries) {
|
|
21068
21509
|
this.installValue(key, current, snapshot);
|
|
21069
21510
|
} else if (current.value === void 0) {
|
|
21070
21511
|
this.slots.delete(key);
|
|
@@ -21073,16 +21514,21 @@ var PersistedSessionListCache = class {
|
|
|
21073
21514
|
return snapshot;
|
|
21074
21515
|
},
|
|
21075
21516
|
(error2) => {
|
|
21517
|
+
load.settled = true;
|
|
21076
21518
|
const current = this.slots.get(key);
|
|
21077
|
-
if (current === slot && current.inFlight
|
|
21519
|
+
if (current === slot && current.inFlight === load) {
|
|
21078
21520
|
current.inFlight = void 0;
|
|
21079
21521
|
if (current.value === void 0) this.slots.delete(key);
|
|
21080
21522
|
}
|
|
21081
21523
|
throw error2;
|
|
21082
21524
|
}
|
|
21083
21525
|
);
|
|
21084
|
-
|
|
21085
|
-
|
|
21526
|
+
load.promise = managed;
|
|
21527
|
+
slot.inFlight = load;
|
|
21528
|
+
return {
|
|
21529
|
+
status: "scan",
|
|
21530
|
+
promise: this.attachWaiter(key, slot, load, options.signal)
|
|
21531
|
+
};
|
|
21086
21532
|
}
|
|
21087
21533
|
invalidate(scope) {
|
|
21088
21534
|
const key = this.key(scope);
|
|
@@ -21136,9 +21582,42 @@ var PersistedSessionListCache = class {
|
|
|
21136
21582
|
this.retainedSummaries -= value.snapshot.sessions.length;
|
|
21137
21583
|
slot.value = void 0;
|
|
21138
21584
|
}
|
|
21585
|
+
attachWaiter(key, slot, load, signal) {
|
|
21586
|
+
load.waiterCount += 1;
|
|
21587
|
+
return new Promise((resolve5, reject) => {
|
|
21588
|
+
let settled = false;
|
|
21589
|
+
const settle = /* @__PURE__ */ __name((finish) => {
|
|
21590
|
+
if (settled) return;
|
|
21591
|
+
settled = true;
|
|
21592
|
+
signal?.removeEventListener("abort", onAbort);
|
|
21593
|
+
load.waiterCount -= 1;
|
|
21594
|
+
if (load.waiterCount === 0 && !load.settled) {
|
|
21595
|
+
load.controller.abort(
|
|
21596
|
+
new DOMException("No active session list waiters", "AbortError")
|
|
21597
|
+
);
|
|
21598
|
+
const current = this.slots.get(key);
|
|
21599
|
+
if (current === slot && current.inFlight === load) {
|
|
21600
|
+
current.inFlight = void 0;
|
|
21601
|
+
if (current.value === void 0) this.slots.delete(key);
|
|
21602
|
+
}
|
|
21603
|
+
}
|
|
21604
|
+
finish();
|
|
21605
|
+
}, "settle");
|
|
21606
|
+
const onAbort = /* @__PURE__ */ __name(() => {
|
|
21607
|
+
if (load.settled) return;
|
|
21608
|
+
settle(() => reject(signal?.reason));
|
|
21609
|
+
}, "onAbort");
|
|
21610
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
21611
|
+
if (signal?.aborted) onAbort();
|
|
21612
|
+
void load.promise.then(
|
|
21613
|
+
(snapshot) => settle(() => resolve5(snapshot)),
|
|
21614
|
+
(error2) => settle(() => reject(error2))
|
|
21615
|
+
);
|
|
21616
|
+
});
|
|
21617
|
+
}
|
|
21139
21618
|
key(scope) {
|
|
21140
21619
|
return JSON.stringify([
|
|
21141
|
-
|
|
21620
|
+
path11.resolve(scope.runtimeBaseDir),
|
|
21142
21621
|
scope.workspaceCwd,
|
|
21143
21622
|
scope.archiveState
|
|
21144
21623
|
]);
|
|
@@ -21257,15 +21736,21 @@ function encodeMetadataSessionCursor(last, filter, archiveState) {
|
|
|
21257
21736
|
).toString("base64url");
|
|
21258
21737
|
}
|
|
21259
21738
|
__name(encodeMetadataSessionCursor, "encodeMetadataSessionCursor");
|
|
21260
|
-
async function enrichWorktreeSidecars(bySessionId, sessionService, archiveState = "active") {
|
|
21739
|
+
async function enrichWorktreeSidecars(bySessionId, sessionService, archiveState = "active", signal) {
|
|
21261
21740
|
for (const [sessionId, summary] of bySessionId) {
|
|
21741
|
+
signal?.throwIfAborted();
|
|
21262
21742
|
if (summary.worktree) continue;
|
|
21263
|
-
|
|
21264
|
-
|
|
21743
|
+
let sidecar;
|
|
21744
|
+
try {
|
|
21745
|
+
const sidecarPath = sessionService.getWorktreeSessionPathForArchiveState(
|
|
21265
21746
|
sessionId,
|
|
21266
21747
|
archiveState
|
|
21267
|
-
)
|
|
21268
|
-
|
|
21748
|
+
);
|
|
21749
|
+
sidecar = signal ? await readWorktreeSession(sidecarPath, { signal }) : await readWorktreeSession(sidecarPath);
|
|
21750
|
+
} catch {
|
|
21751
|
+
signal?.throwIfAborted();
|
|
21752
|
+
sidecar = null;
|
|
21753
|
+
}
|
|
21269
21754
|
if (sidecar) {
|
|
21270
21755
|
bySessionId.set(sessionId, {
|
|
21271
21756
|
...summary,
|
|
@@ -21320,8 +21805,9 @@ function clonePersistedSummary(session) {
|
|
|
21320
21805
|
};
|
|
21321
21806
|
}
|
|
21322
21807
|
__name(clonePersistedSummary, "clonePersistedSummary");
|
|
21323
|
-
async function loadAllPersistedSummaries(sessionService, archiveState) {
|
|
21808
|
+
async function loadAllPersistedSummaries(sessionService, archiveState, signal) {
|
|
21324
21809
|
const scanStartedAt = performance.now();
|
|
21810
|
+
signal.throwIfAborted();
|
|
21325
21811
|
const sessions = [];
|
|
21326
21812
|
let truncated = false;
|
|
21327
21813
|
let scanPages = 0;
|
|
@@ -21331,8 +21817,10 @@ async function loadAllPersistedSummaries(sessionService, archiveState) {
|
|
|
21331
21817
|
const page = await sessionService.listSessions({
|
|
21332
21818
|
cursor,
|
|
21333
21819
|
size: 1e4,
|
|
21334
|
-
archiveState
|
|
21820
|
+
archiveState,
|
|
21821
|
+
signal
|
|
21335
21822
|
});
|
|
21823
|
+
signal.throwIfAborted();
|
|
21336
21824
|
const remaining = MAX_ORGANIZED_SESSIONS - sessions.length;
|
|
21337
21825
|
sessions.push(...page.items.slice(0, remaining).map(toSummary2));
|
|
21338
21826
|
cursor = page.nextCursor;
|
|
@@ -21350,7 +21838,13 @@ async function loadAllPersistedSummaries(sessionService, archiveState) {
|
|
|
21350
21838
|
const bySessionId = new Map(
|
|
21351
21839
|
sessions.map((session) => [session.sessionId, session])
|
|
21352
21840
|
);
|
|
21353
|
-
await enrichWorktreeSidecars(
|
|
21841
|
+
await enrichWorktreeSidecars(
|
|
21842
|
+
bySessionId,
|
|
21843
|
+
sessionService,
|
|
21844
|
+
archiveState,
|
|
21845
|
+
signal
|
|
21846
|
+
);
|
|
21847
|
+
signal.throwIfAborted();
|
|
21354
21848
|
return {
|
|
21355
21849
|
sessions: [...bySessionId.values()],
|
|
21356
21850
|
truncated,
|
|
@@ -21359,10 +21853,11 @@ async function loadAllPersistedSummaries(sessionService, archiveState) {
|
|
|
21359
21853
|
};
|
|
21360
21854
|
}
|
|
21361
21855
|
__name(loadAllPersistedSummaries, "loadAllPersistedSummaries");
|
|
21362
|
-
async function listAllPersistedSummaries(sessionService, workspaceCwd, archiveState, runtimeBaseDir, queryKind) {
|
|
21856
|
+
async function listAllPersistedSummaries(sessionService, workspaceCwd, archiveState, runtimeBaseDir, queryKind, signal) {
|
|
21363
21857
|
const lookup = persistedSessionListCache.lookup(
|
|
21364
21858
|
{ runtimeBaseDir, workspaceCwd, archiveState },
|
|
21365
|
-
() => loadAllPersistedSummaries(sessionService, archiveState)
|
|
21859
|
+
(loadSignal) => loadAllPersistedSummaries(sessionService, archiveState, loadSignal),
|
|
21860
|
+
{ signal }
|
|
21366
21861
|
);
|
|
21367
21862
|
addDaemonRequestAttribute(
|
|
21368
21863
|
"qwen-code.daemon.session_list.cache_status",
|
|
@@ -21383,6 +21878,7 @@ async function listAllPersistedSummaries(sessionService, workspaceCwd, archiveSt
|
|
|
21383
21878
|
);
|
|
21384
21879
|
}
|
|
21385
21880
|
const snapshot = await lookup.promise;
|
|
21881
|
+
signal?.throwIfAborted();
|
|
21386
21882
|
addDaemonRequestAttribute(
|
|
21387
21883
|
"qwen-code.daemon.session_list.persisted_sessions",
|
|
21388
21884
|
snapshot.sessions.length
|
|
@@ -21395,7 +21891,7 @@ async function listAllPersistedSummaries(sessionService, workspaceCwd, archiveSt
|
|
|
21395
21891
|
"qwen-code.daemon.session_list.truncated",
|
|
21396
21892
|
snapshot.truncated
|
|
21397
21893
|
);
|
|
21398
|
-
if (lookup.status
|
|
21894
|
+
if (lookup.status !== "cache_hit") {
|
|
21399
21895
|
addDaemonRequestAttribute(
|
|
21400
21896
|
"qwen-code.daemon.session_list.scan_duration_ms",
|
|
21401
21897
|
snapshot.scanDurationMs
|
|
@@ -21459,7 +21955,9 @@ async function listOrganizedWorkspaceSessionsForResponse(bridge, workspaceCwd, o
|
|
|
21459
21955
|
const archiveState = options.archiveState ?? "active";
|
|
21460
21956
|
const sessionService = new SessionService(workspaceCwd);
|
|
21461
21957
|
const organizationService = createSessionOrganizationService(workspaceCwd);
|
|
21958
|
+
readOptions.signal?.throwIfAborted();
|
|
21462
21959
|
const snapshot = await organizationService.readSnapshot();
|
|
21960
|
+
readOptions.signal?.throwIfAborted();
|
|
21463
21961
|
const knownGroupIds = new Set(snapshot.groups.map((group2) => group2.id));
|
|
21464
21962
|
const group = options.group ?? "all";
|
|
21465
21963
|
if (group !== "all" && group !== "pinned" && group !== "ungrouped" && !knownGroupIds.has(group)) {
|
|
@@ -21483,8 +21981,10 @@ async function listOrganizedWorkspaceSessionsForResponse(bridge, workspaceCwd, o
|
|
|
21483
21981
|
workspaceCwd,
|
|
21484
21982
|
archiveState,
|
|
21485
21983
|
readOptions.runtimeBaseDir,
|
|
21486
|
-
"organized"
|
|
21984
|
+
"organized",
|
|
21985
|
+
readOptions.signal
|
|
21487
21986
|
);
|
|
21987
|
+
readOptions.signal?.throwIfAborted();
|
|
21488
21988
|
for (const session of persisted.sessions) {
|
|
21489
21989
|
bySessionId.set(
|
|
21490
21990
|
session.sessionId,
|
|
@@ -21517,7 +22017,9 @@ async function listOrganizedWorkspaceSessionsForResponse(bridge, workspaceCwd, o
|
|
|
21517
22017
|
// above and this point: `existing` stayed undefined but
|
|
21518
22018
|
// `sessionExists` flipped to true, silently dropping the live
|
|
21519
22019
|
// session from the response instead of merging it.
|
|
21520
|
-
!persisted.truncated || !await sessionService.sessionExists(live.sessionId
|
|
22020
|
+
!persisted.truncated || !await (readOptions.signal ? sessionService.sessionExists(live.sessionId, {
|
|
22021
|
+
signal: readOptions.signal
|
|
22022
|
+
}) : sessionService.sessionExists(live.sessionId))
|
|
21521
22023
|
) {
|
|
21522
22024
|
bySessionId.set(
|
|
21523
22025
|
live.sessionId,
|
|
@@ -21535,6 +22037,7 @@ async function listOrganizedWorkspaceSessionsForResponse(bridge, workspaceCwd, o
|
|
|
21535
22037
|
}
|
|
21536
22038
|
}
|
|
21537
22039
|
} catch (error2) {
|
|
22040
|
+
readOptions.signal?.throwIfAborted();
|
|
21538
22041
|
liveMergeFailed = true;
|
|
21539
22042
|
writeStderrLine(
|
|
21540
22043
|
`qwen serve: organized session list live merge failed; using persisted sessions only: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
@@ -21549,6 +22052,7 @@ async function listOrganizedWorkspaceSessionsForResponse(bridge, workspaceCwd, o
|
|
|
21549
22052
|
return session.groupId == null && session.color == null;
|
|
21550
22053
|
return session.color == null && session.groupId === group;
|
|
21551
22054
|
});
|
|
22055
|
+
readOptions.signal?.throwIfAborted();
|
|
21552
22056
|
const activityTimeById = new Map(
|
|
21553
22057
|
filtered.map((session) => [
|
|
21554
22058
|
session.sessionId,
|
|
@@ -21556,6 +22060,7 @@ async function listOrganizedWorkspaceSessionsForResponse(bridge, workspaceCwd, o
|
|
|
21556
22060
|
])
|
|
21557
22061
|
);
|
|
21558
22062
|
filtered.sort((a, b) => compareOrganizedSessions(activityTimeById, a, b));
|
|
22063
|
+
readOptions.signal?.throwIfAborted();
|
|
21559
22064
|
const afterCursor = cursorKey === void 0 ? filtered : filtered.filter(
|
|
21560
22065
|
(session) => compareOrganizedCursorKeys(
|
|
21561
22066
|
cursorKey,
|
|
@@ -21587,8 +22092,10 @@ async function listWorkspaceSessionsByMetadataForResponse(bridge, workspaceCwd,
|
|
|
21587
22092
|
workspaceCwd,
|
|
21588
22093
|
archiveState,
|
|
21589
22094
|
readOptions.runtimeBaseDir,
|
|
21590
|
-
"metadata"
|
|
22095
|
+
"metadata",
|
|
22096
|
+
readOptions.signal
|
|
21591
22097
|
);
|
|
22098
|
+
readOptions.signal?.throwIfAborted();
|
|
21592
22099
|
for (const session of persisted.sessions) {
|
|
21593
22100
|
bySessionId.set(session.sessionId, clonePersistedSummary(session));
|
|
21594
22101
|
}
|
|
@@ -21607,7 +22114,9 @@ async function listWorkspaceSessionsByMetadataForResponse(bridge, workspaceCwd,
|
|
|
21607
22114
|
// `listOrganizedWorkspaceSessionsForResponse`: an untruncated scan
|
|
21608
22115
|
// already covers every persisted session, so skip the racy
|
|
21609
22116
|
// re-check when nothing was truncated.
|
|
21610
|
-
!persisted.truncated || !await sessionService.sessionExists(live.sessionId
|
|
22117
|
+
!persisted.truncated || !await (readOptions.signal ? sessionService.sessionExists(live.sessionId, {
|
|
22118
|
+
signal: readOptions.signal
|
|
22119
|
+
}) : sessionService.sessionExists(live.sessionId))
|
|
21611
22120
|
) {
|
|
21612
22121
|
bySessionId.set(live.sessionId, {
|
|
21613
22122
|
...live,
|
|
@@ -21619,6 +22128,7 @@ async function listWorkspaceSessionsByMetadataForResponse(bridge, workspaceCwd,
|
|
|
21619
22128
|
}
|
|
21620
22129
|
}
|
|
21621
22130
|
} catch (error2) {
|
|
22131
|
+
readOptions.signal?.throwIfAborted();
|
|
21622
22132
|
liveMergeFailed = true;
|
|
21623
22133
|
writeStderrLine(
|
|
21624
22134
|
`qwen serve: session metadata filter live merge failed; using persisted sessions only: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
@@ -21633,6 +22143,7 @@ async function listWorkspaceSessionsByMetadataForResponse(bridge, workspaceCwd,
|
|
|
21633
22143
|
getLiveSessionCursorKey(b)
|
|
21634
22144
|
)
|
|
21635
22145
|
);
|
|
22146
|
+
readOptions.signal?.throwIfAborted();
|
|
21636
22147
|
const cursorKey = options.cursor !== void 0 && options.cursor !== "" ? parseMetadataSessionCursor(options.cursor, {
|
|
21637
22148
|
...filter,
|
|
21638
22149
|
archiveState
|
|
@@ -21658,20 +22169,25 @@ async function listWorkspaceSessionsByMetadataForResponse(bridge, workspaceCwd,
|
|
|
21658
22169
|
}
|
|
21659
22170
|
__name(listWorkspaceSessionsByMetadataForResponse, "listWorkspaceSessionsByMetadataForResponse");
|
|
21660
22171
|
async function listWorkspaceSessionsForResponse(bridge, workspaceCwd, options, readOptions = {}) {
|
|
22172
|
+
readOptions.signal?.throwIfAborted();
|
|
21661
22173
|
const runtimeBaseDir = new Storage(
|
|
21662
22174
|
workspaceCwd,
|
|
21663
22175
|
readOptions.runtimeBaseDir
|
|
21664
22176
|
).getRuntimeBaseDir();
|
|
21665
|
-
|
|
22177
|
+
const result = await Storage.runWithResolvedRuntimeBaseDir(
|
|
21666
22178
|
runtimeBaseDir,
|
|
21667
22179
|
() => listWorkspaceSessionsForResponseInRuntime(bridge, workspaceCwd, options, {
|
|
21668
22180
|
...readOptions.mergeLive !== void 0 ? { mergeLive: readOptions.mergeLive } : {},
|
|
22181
|
+
...readOptions.signal !== void 0 ? { signal: readOptions.signal } : {},
|
|
21669
22182
|
runtimeBaseDir
|
|
21670
22183
|
})
|
|
21671
22184
|
);
|
|
22185
|
+
readOptions.signal?.throwIfAborted();
|
|
22186
|
+
return result;
|
|
21672
22187
|
}
|
|
21673
22188
|
__name(listWorkspaceSessionsForResponse, "listWorkspaceSessionsForResponse");
|
|
21674
22189
|
async function listWorkspaceSessionsForResponseInRuntime(bridge, workspaceCwd, options, readOptions) {
|
|
22190
|
+
readOptions.signal?.throwIfAborted();
|
|
21675
22191
|
const rawSize = options?.size;
|
|
21676
22192
|
const requestedSize = typeof rawSize === "number" && Number.isSafeInteger(rawSize) ? rawSize : DEFAULT_SESSION_PAGE_SIZE;
|
|
21677
22193
|
const pageSize = Math.min(Math.max(requestedSize, 1), MAX_SESSION_PAGE_SIZE);
|
|
@@ -21708,13 +22224,21 @@ async function listWorkspaceSessionsForResponseInRuntime(bridge, workspaceCwd, o
|
|
|
21708
22224
|
const persisted = await sessionService.listSessions({
|
|
21709
22225
|
cursor: numericCursor,
|
|
21710
22226
|
size: pageSize,
|
|
21711
|
-
archiveState
|
|
22227
|
+
archiveState,
|
|
22228
|
+
...readOptions.signal ? { signal: readOptions.signal } : {}
|
|
21712
22229
|
});
|
|
22230
|
+
readOptions.signal?.throwIfAborted();
|
|
21713
22231
|
const bySessionId = /* @__PURE__ */ new Map();
|
|
21714
22232
|
for (const item of persisted.items) {
|
|
21715
22233
|
bySessionId.set(item.sessionId, toSummary2(item));
|
|
21716
22234
|
}
|
|
21717
|
-
await enrichWorktreeSidecars(
|
|
22235
|
+
await enrichWorktreeSidecars(
|
|
22236
|
+
bySessionId,
|
|
22237
|
+
sessionService,
|
|
22238
|
+
archiveState,
|
|
22239
|
+
readOptions.signal
|
|
22240
|
+
);
|
|
22241
|
+
readOptions.signal?.throwIfAborted();
|
|
21718
22242
|
if (archiveState === "archived" || readOptions.mergeLive === false) {
|
|
21719
22243
|
const sessions2 = [...bySessionId.values()];
|
|
21720
22244
|
const nextCursor2 = persisted.nextCursor != null ? String(persisted.nextCursor) : void 0;
|
|
@@ -21732,7 +22256,9 @@ async function listWorkspaceSessionsForResponseInRuntime(bridge, workspaceCwd, o
|
|
|
21732
22256
|
// `existing` stayed undefined but `sessionExists` flipped to true,
|
|
21733
22257
|
// silently dropping the live session from the response instead of
|
|
21734
22258
|
// merging it.
|
|
21735
|
-
(persisted.nextCursor == null || !await sessionService.sessionExists(live.sessionId
|
|
22259
|
+
(persisted.nextCursor == null || !await (readOptions.signal ? sessionService.sessionExists(live.sessionId, {
|
|
22260
|
+
signal: readOptions.signal
|
|
22261
|
+
}) : sessionService.sessionExists(live.sessionId)))) {
|
|
21736
22262
|
bySessionId.set(live.sessionId, {
|
|
21737
22263
|
...live,
|
|
21738
22264
|
createdAt: live.createdAt,
|
|
@@ -21747,6 +22273,7 @@ async function listWorkspaceSessionsForResponseInRuntime(bridge, workspaceCwd, o
|
|
|
21747
22273
|
const bTime = Date.parse(b.updatedAt ?? b.createdAt);
|
|
21748
22274
|
return bTime - aTime;
|
|
21749
22275
|
});
|
|
22276
|
+
readOptions.signal?.throwIfAborted();
|
|
21750
22277
|
const nextCursor = persisted.nextCursor != null ? String(persisted.nextCursor) : void 0;
|
|
21751
22278
|
return { sessions, nextCursor };
|
|
21752
22279
|
}
|
|
@@ -21927,6 +22454,8 @@ import * as fs5 from "node:fs/promises";
|
|
|
21927
22454
|
import { createReadStream } from "node:fs";
|
|
21928
22455
|
import readline from "node:readline";
|
|
21929
22456
|
var PREFIX = "subagent.";
|
|
22457
|
+
var MAX_VIRTUAL_SESSION_ID_PART_LENGTH = 500;
|
|
22458
|
+
var MAX_VIRTUAL_SESSION_ID_LENGTH = 2e3;
|
|
21930
22459
|
var POLL_INTERVAL_MS = 250;
|
|
21931
22460
|
var TARGET_RETENTION_MS = 6e4;
|
|
21932
22461
|
async function readFirstUserText(filePath) {
|
|
@@ -22015,26 +22544,40 @@ function decodePart(value) {
|
|
|
22015
22544
|
}
|
|
22016
22545
|
}
|
|
22017
22546
|
__name(decodePart, "decodePart");
|
|
22018
|
-
function
|
|
22019
|
-
return /^[a-zA-Z0-9_-]
|
|
22547
|
+
function isValidVirtualParentSessionId(value) {
|
|
22548
|
+
return value.length > 0 && value.length <= MAX_VIRTUAL_SESSION_ID_PART_LENGTH && /^[a-zA-Z0-9_-]+$/.test(value);
|
|
22020
22549
|
}
|
|
22021
|
-
__name(
|
|
22550
|
+
__name(isValidVirtualParentSessionId, "isValidVirtualParentSessionId");
|
|
22551
|
+
function isValidVirtualAgentId(value) {
|
|
22552
|
+
return value.length > 0 && value.length <= MAX_VIRTUAL_SESSION_ID_PART_LENGTH && // Round-trip rejects lone surrogates: UTF-8 maps them to U+FFFD, so two
|
|
22553
|
+
// distinct agent ids would otherwise encode to the same session id.
|
|
22554
|
+
decodePart(encodePart(value)) === value;
|
|
22555
|
+
}
|
|
22556
|
+
__name(isValidVirtualAgentId, "isValidVirtualAgentId");
|
|
22022
22557
|
function createVirtualSubagentSessionId(parentSessionId, agentId) {
|
|
22023
|
-
if (!
|
|
22558
|
+
if (!isValidVirtualParentSessionId(parentSessionId) || !isValidVirtualAgentId(agentId)) {
|
|
22024
22559
|
throw new Error("Virtual subagent session ids require valid id parts");
|
|
22025
22560
|
}
|
|
22026
|
-
|
|
22561
|
+
const sessionId = `${PREFIX}${encodePart(parentSessionId)}.${encodePart(agentId)}`;
|
|
22562
|
+
if (sessionId.length > MAX_VIRTUAL_SESSION_ID_LENGTH) {
|
|
22563
|
+
throw new Error(
|
|
22564
|
+
`Virtual subagent session id exceeds ${MAX_VIRTUAL_SESSION_ID_LENGTH} characters`
|
|
22565
|
+
);
|
|
22566
|
+
}
|
|
22567
|
+
return sessionId;
|
|
22027
22568
|
}
|
|
22028
22569
|
__name(createVirtualSubagentSessionId, "createVirtualSubagentSessionId");
|
|
22029
22570
|
function parseVirtualSubagentSessionId(sessionId) {
|
|
22030
|
-
if (!sessionId.startsWith(PREFIX) || sessionId.length >
|
|
22571
|
+
if (!sessionId.startsWith(PREFIX) || sessionId.length > MAX_VIRTUAL_SESSION_ID_LENGTH) {
|
|
22031
22572
|
return void 0;
|
|
22032
22573
|
}
|
|
22033
22574
|
const parts = sessionId.slice(PREFIX.length).split(".");
|
|
22034
22575
|
if (parts.length !== 2) return void 0;
|
|
22035
|
-
const
|
|
22036
|
-
const
|
|
22037
|
-
|
|
22576
|
+
const parentPart = parts[0];
|
|
22577
|
+
const agentPart = parts[1];
|
|
22578
|
+
const parentSessionId = decodePart(parentPart);
|
|
22579
|
+
const agentId = decodePart(agentPart);
|
|
22580
|
+
if (!parentSessionId || !agentId || !isValidVirtualParentSessionId(parentSessionId) || !isValidVirtualAgentId(agentId) || encodePart(parentSessionId) !== parentPart || encodePart(agentId) !== agentPart) {
|
|
22038
22581
|
return void 0;
|
|
22039
22582
|
}
|
|
22040
22583
|
return { parentSessionId, agentId };
|
|
@@ -23033,7 +23576,7 @@ function registerSessionRoutes(app, deps) {
|
|
|
23033
23576
|
const workspaceParam = req.params[paramName] ?? "";
|
|
23034
23577
|
const byId = workspaceRegistry.getByWorkspaceId(workspaceParam);
|
|
23035
23578
|
if (byId) return byId;
|
|
23036
|
-
if (!
|
|
23579
|
+
if (!path12.isAbsolute(workspaceParam)) {
|
|
23037
23580
|
res.status(400).json({
|
|
23038
23581
|
error: `\`:${paramName}\` must decode to a workspace id or absolute path`
|
|
23039
23582
|
});
|
|
@@ -23090,16 +23633,19 @@ function registerSessionRoutes(app, deps) {
|
|
|
23090
23633
|
}
|
|
23091
23634
|
return runtime;
|
|
23092
23635
|
}, "resolveLegacyPrimaryRuntimeFromParam");
|
|
23093
|
-
const hasActivePersistedSessions = /* @__PURE__ */ __name(async (runtime) => {
|
|
23636
|
+
const hasActivePersistedSessions = /* @__PURE__ */ __name(async (runtime, signal) => {
|
|
23094
23637
|
try {
|
|
23095
23638
|
const page = await createWorkspaceRuntimeSessionService(
|
|
23096
23639
|
runtime
|
|
23097
23640
|
).listSessions({
|
|
23098
23641
|
archiveState: "active",
|
|
23099
|
-
size: 1
|
|
23642
|
+
size: 1,
|
|
23643
|
+
signal
|
|
23100
23644
|
});
|
|
23645
|
+
signal.throwIfAborted();
|
|
23101
23646
|
return page.items.length > 0;
|
|
23102
23647
|
} catch {
|
|
23648
|
+
signal.throwIfAborted();
|
|
23103
23649
|
return false;
|
|
23104
23650
|
}
|
|
23105
23651
|
}, "hasActivePersistedSessions");
|
|
@@ -23890,7 +24436,7 @@ function registerSessionRoutes(app, deps) {
|
|
|
23890
24436
|
if (worktreeMeta) {
|
|
23891
24437
|
try {
|
|
23892
24438
|
const createAllowedRoots = [
|
|
23893
|
-
|
|
24439
|
+
path12.join(workspaceCwd, ".qwen", "worktrees")
|
|
23894
24440
|
];
|
|
23895
24441
|
let createRepoTop = null;
|
|
23896
24442
|
try {
|
|
@@ -23901,7 +24447,7 @@ function registerSessionRoutes(app, deps) {
|
|
|
23901
24447
|
}
|
|
23902
24448
|
if (createRepoTop && createRepoTop !== workspaceCwd) {
|
|
23903
24449
|
createAllowedRoots.push(
|
|
23904
|
-
|
|
24450
|
+
path12.join(createRepoTop, ".qwen", "worktrees")
|
|
23905
24451
|
);
|
|
23906
24452
|
}
|
|
23907
24453
|
await runtime.bridge.changeSessionCwd(session.sessionId, {
|
|
@@ -24200,7 +24746,7 @@ function registerSessionRoutes(app, deps) {
|
|
|
24200
24746
|
if (sidecar) {
|
|
24201
24747
|
let realTarget;
|
|
24202
24748
|
const candidateRoots = [
|
|
24203
|
-
|
|
24749
|
+
path12.join(workspaceCwd, ".qwen", "worktrees")
|
|
24204
24750
|
];
|
|
24205
24751
|
try {
|
|
24206
24752
|
realTarget = fs6.realpathSync(sidecar.worktreePath);
|
|
@@ -24212,13 +24758,13 @@ function registerSessionRoutes(app, deps) {
|
|
|
24212
24758
|
} catch {
|
|
24213
24759
|
}
|
|
24214
24760
|
if (repoTop && repoTop !== workspaceCwd) {
|
|
24215
|
-
candidateRoots.push(
|
|
24761
|
+
candidateRoots.push(path12.join(repoTop, ".qwen", "worktrees"));
|
|
24216
24762
|
}
|
|
24217
24763
|
const contained = candidateRoots.some((root) => {
|
|
24218
24764
|
try {
|
|
24219
24765
|
const realRoot = fs6.realpathSync(root);
|
|
24220
|
-
const rel =
|
|
24221
|
-
return !rel.startsWith("..") && !
|
|
24766
|
+
const rel = path12.relative(realRoot, realTarget);
|
|
24767
|
+
return !rel.startsWith("..") && !path12.isAbsolute(rel);
|
|
24222
24768
|
} catch {
|
|
24223
24769
|
return false;
|
|
24224
24770
|
}
|
|
@@ -24271,8 +24817,8 @@ function registerSessionRoutes(app, deps) {
|
|
|
24271
24817
|
}, "restoreSessionHandler");
|
|
24272
24818
|
app.post("/session/:id/load", mutate(), restoreSessionHandler("load"));
|
|
24273
24819
|
app.post("/session/:id/resume", mutate(), restoreSessionHandler("resume"));
|
|
24274
|
-
app.get("/session/:id/subagents/:
|
|
24275
|
-
const route = "GET /session/:id/subagents/:
|
|
24820
|
+
app.get("/session/:id/subagents/:subagentRef", async (req, res) => {
|
|
24821
|
+
const route = "GET /session/:id/subagents/:subagentRef";
|
|
24276
24822
|
const sessionId = requireSessionId(req, res);
|
|
24277
24823
|
if (!sessionId) return;
|
|
24278
24824
|
if (!virtualSubagentSessions) {
|
|
@@ -24283,11 +24829,11 @@ function registerSessionRoutes(app, deps) {
|
|
|
24283
24829
|
});
|
|
24284
24830
|
return;
|
|
24285
24831
|
}
|
|
24286
|
-
const
|
|
24287
|
-
if (!
|
|
24832
|
+
const subagentRef = req.params["subagentRef"];
|
|
24833
|
+
if (!subagentRef || subagentRef.length > MAX_VIRTUAL_SESSION_ID_PART_LENGTH) {
|
|
24288
24834
|
res.status(400).json({
|
|
24289
|
-
error: "`
|
|
24290
|
-
code: "
|
|
24835
|
+
error: "`subagentRef` must be a non-empty subagent reference",
|
|
24836
|
+
code: "invalid_subagent_ref"
|
|
24291
24837
|
});
|
|
24292
24838
|
return;
|
|
24293
24839
|
}
|
|
@@ -24303,14 +24849,14 @@ function registerSessionRoutes(app, deps) {
|
|
|
24303
24849
|
const resolved = await virtualSubagentSessions.resolve(
|
|
24304
24850
|
runtime,
|
|
24305
24851
|
sessionId,
|
|
24306
|
-
|
|
24852
|
+
subagentRef
|
|
24307
24853
|
);
|
|
24308
24854
|
if (!resolved) {
|
|
24309
24855
|
res.status(404).json({
|
|
24310
24856
|
error: "Subagent session not found",
|
|
24311
24857
|
code: "session_not_found",
|
|
24312
24858
|
sessionId,
|
|
24313
|
-
|
|
24859
|
+
subagentRef
|
|
24314
24860
|
});
|
|
24315
24861
|
return;
|
|
24316
24862
|
}
|
|
@@ -24320,10 +24866,10 @@ function registerSessionRoutes(app, deps) {
|
|
|
24320
24866
|
}
|
|
24321
24867
|
});
|
|
24322
24868
|
app.post(
|
|
24323
|
-
"/session/:id/subagents/:
|
|
24869
|
+
"/session/:id/subagents/:subagentRef/cancel",
|
|
24324
24870
|
mutate(),
|
|
24325
24871
|
async (req, res) => {
|
|
24326
|
-
const route = "POST /session/:id/subagents/:
|
|
24872
|
+
const route = "POST /session/:id/subagents/:subagentRef/cancel";
|
|
24327
24873
|
const sessionId = requireSessionId(req, res);
|
|
24328
24874
|
if (!sessionId) return;
|
|
24329
24875
|
if (!virtualSubagentSessions) {
|
|
@@ -24334,11 +24880,11 @@ function registerSessionRoutes(app, deps) {
|
|
|
24334
24880
|
});
|
|
24335
24881
|
return;
|
|
24336
24882
|
}
|
|
24337
|
-
const
|
|
24338
|
-
if (!
|
|
24883
|
+
const subagentRef = req.params["subagentRef"];
|
|
24884
|
+
if (!subagentRef || subagentRef.length > MAX_VIRTUAL_SESSION_ID_PART_LENGTH) {
|
|
24339
24885
|
res.status(400).json({
|
|
24340
|
-
error: "`
|
|
24341
|
-
code: "
|
|
24886
|
+
error: "`subagentRef` must be a non-empty subagent reference",
|
|
24887
|
+
code: "invalid_subagent_ref"
|
|
24342
24888
|
});
|
|
24343
24889
|
return;
|
|
24344
24890
|
}
|
|
@@ -24354,14 +24900,14 @@ function registerSessionRoutes(app, deps) {
|
|
|
24354
24900
|
const resolved = await virtualSubagentSessions.resolve(
|
|
24355
24901
|
runtime,
|
|
24356
24902
|
sessionId,
|
|
24357
|
-
|
|
24903
|
+
subagentRef
|
|
24358
24904
|
);
|
|
24359
24905
|
if (!resolved) {
|
|
24360
24906
|
res.status(404).json({
|
|
24361
24907
|
error: "Subagent session not found",
|
|
24362
24908
|
code: "session_not_found",
|
|
24363
24909
|
sessionId,
|
|
24364
|
-
|
|
24910
|
+
subagentRef
|
|
24365
24911
|
});
|
|
24366
24912
|
return;
|
|
24367
24913
|
}
|
|
@@ -24534,7 +25080,7 @@ function registerSessionRoutes(app, deps) {
|
|
|
24534
25080
|
async (req, res, sessionId, runtime) => {
|
|
24535
25081
|
const body = safeBody(req);
|
|
24536
25082
|
const targetPath = body["path"];
|
|
24537
|
-
if (typeof targetPath !== "string" || targetPath.length === 0 || !
|
|
25083
|
+
if (typeof targetPath !== "string" || targetPath.length === 0 || !path12.isAbsolute(targetPath)) {
|
|
24538
25084
|
res.status(400).json({
|
|
24539
25085
|
error: "`path` is required and must be an absolute path",
|
|
24540
25086
|
code: "invalid_path"
|
|
@@ -25110,6 +25656,22 @@ function registerSessionRoutes(app, deps) {
|
|
|
25110
25656
|
const forwardedBody = { ...body };
|
|
25111
25657
|
delete forwardedBody["deadlineMs"];
|
|
25112
25658
|
delete forwardedBody["delivery"];
|
|
25659
|
+
const forwardedMeta = typeof forwardedBody["_meta"] === "object" && forwardedBody["_meta"] !== null && !Array.isArray(forwardedBody["_meta"]) ? { ...forwardedBody["_meta"] } : void 0;
|
|
25660
|
+
const promptAuthorization = forwardedMeta?.[CHANNEL_WORKER_PROMPT_AUTHORIZATION_META_KEY];
|
|
25661
|
+
const promptDisplayText = forwardedMeta?.[DAEMON_PROMPT_DISPLAY_TEXT_META_KEY];
|
|
25662
|
+
if (forwardedMeta) {
|
|
25663
|
+
delete forwardedMeta[CHANNEL_WORKER_PROMPT_AUTHORIZATION_META_KEY];
|
|
25664
|
+
delete forwardedMeta[DAEMON_PROMPT_DISPLAY_TEXT_META_KEY];
|
|
25665
|
+
if (Object.keys(forwardedMeta).length > 0) {
|
|
25666
|
+
forwardedBody["_meta"] = forwardedMeta;
|
|
25667
|
+
} else {
|
|
25668
|
+
delete forwardedBody["_meta"];
|
|
25669
|
+
}
|
|
25670
|
+
}
|
|
25671
|
+
const trustedPromptDisplayText = typeof promptDisplayText === "string" && isChannelWorkerPromptAuthorized(
|
|
25672
|
+
promptAuthorization,
|
|
25673
|
+
runtime.workspaceCwd
|
|
25674
|
+
) ? promptDisplayText : void 0;
|
|
25113
25675
|
const lastEventId = ownerBridge.getSessionLastEventId(sessionId);
|
|
25114
25676
|
const eventEpoch = ownerBridge.getSessionEventEpoch(sessionId);
|
|
25115
25677
|
addDaemonRequestAttribute("qwen-code.prompt_id", promptId);
|
|
@@ -25142,6 +25704,7 @@ function registerSessionRoutes(app, deps) {
|
|
|
25142
25704
|
...clientId !== void 0 ? { clientId } : {},
|
|
25143
25705
|
promptId,
|
|
25144
25706
|
...effectiveDeadlineMs !== void 0 ? { deadlineMs: effectiveDeadlineMs } : {},
|
|
25707
|
+
...trustedPromptDisplayText !== void 0 ? { promptDisplayText: trustedPromptDisplayText } : {},
|
|
25145
25708
|
...delivery !== void 0 ? {
|
|
25146
25709
|
channelDelivery: {
|
|
25147
25710
|
deliveryId: promptId,
|
|
@@ -26020,25 +26583,54 @@ function registerSessionRoutes(app, deps) {
|
|
|
26020
26583
|
...parentSessionId !== void 0 ? { parentSessionId } : {},
|
|
26021
26584
|
...parsedSource
|
|
26022
26585
|
};
|
|
26023
|
-
const
|
|
26024
|
-
|
|
26025
|
-
|
|
26026
|
-
|
|
26586
|
+
const controller = new AbortController();
|
|
26587
|
+
const onRequestAborted = /* @__PURE__ */ __name(() => {
|
|
26588
|
+
controller.abort(new DOMException("Request aborted", "AbortError"));
|
|
26589
|
+
}, "onRequestAborted");
|
|
26590
|
+
const onResponseClosed = /* @__PURE__ */ __name(() => {
|
|
26591
|
+
if (!res.writableEnded) {
|
|
26592
|
+
controller.abort(new DOMException("Response closed", "AbortError"));
|
|
26593
|
+
}
|
|
26594
|
+
}, "onResponseClosed");
|
|
26595
|
+
req.once("aborted", onRequestAborted);
|
|
26596
|
+
res.once("close", onResponseClosed);
|
|
26597
|
+
if (req.aborted || res.destroyed) onRequestAborted();
|
|
26598
|
+
try {
|
|
26599
|
+
const usePersisted = readOnlySecondary || runtime.primary || view === "organized" || archiveState === "archived" || parentSessionId !== void 0 || parsedSource.sourceType !== void 0 || (cursor !== void 0 && cursor !== "" ? isNumericSessionCursor(cursor) : await hasActivePersistedSessions(runtime, controller.signal));
|
|
26600
|
+
if (!usePersisted && (view !== void 0 || archiveState === "archived" || parentSessionId !== void 0 || parsedSource.sourceType !== void 0)) {
|
|
26601
|
+
throw new Error(
|
|
26602
|
+
"session list live path received persisted-only options"
|
|
26603
|
+
);
|
|
26604
|
+
}
|
|
26605
|
+
const result = usePersisted ? await runWorkspaceInspectionWithLogPolicy(
|
|
26606
|
+
runtime,
|
|
26607
|
+
() => listWorkspaceSessionsForResponse(runtime.bridge, key, options, {
|
|
26608
|
+
mergeLive: !readOnlySecondary,
|
|
26609
|
+
runtimeBaseDir: runtime.sessionRuntimeBaseDir,
|
|
26610
|
+
signal: controller.signal
|
|
26611
|
+
})
|
|
26612
|
+
) : listLiveWorkspaceSessionsForResponse(
|
|
26613
|
+
runtime.bridge,
|
|
26614
|
+
key,
|
|
26615
|
+
options
|
|
26027
26616
|
);
|
|
26617
|
+
controller.signal.throwIfAborted();
|
|
26618
|
+
if (res.destroyed) return;
|
|
26619
|
+
res.status(200).json({
|
|
26620
|
+
sessions: result.sessions,
|
|
26621
|
+
...result.nextCursor != null ? { nextCursor: result.nextCursor } : {},
|
|
26622
|
+
...result.liveMergeFailed ? { liveMergeFailed: true } : {},
|
|
26623
|
+
...result.truncated ? { truncated: true } : {}
|
|
26624
|
+
});
|
|
26625
|
+
} catch (err) {
|
|
26626
|
+
if (controller.signal.aborted || res.destroyed) {
|
|
26627
|
+
return;
|
|
26628
|
+
}
|
|
26629
|
+
throw err;
|
|
26630
|
+
} finally {
|
|
26631
|
+
req.off("aborted", onRequestAborted);
|
|
26632
|
+
res.off("close", onResponseClosed);
|
|
26028
26633
|
}
|
|
26029
|
-
const result = usePersisted ? await runWorkspaceInspectionWithLogPolicy(
|
|
26030
|
-
runtime,
|
|
26031
|
-
() => listWorkspaceSessionsForResponse(runtime.bridge, key, options, {
|
|
26032
|
-
mergeLive: !readOnlySecondary,
|
|
26033
|
-
runtimeBaseDir: runtime.sessionRuntimeBaseDir
|
|
26034
|
-
})
|
|
26035
|
-
) : listLiveWorkspaceSessionsForResponse(runtime.bridge, key, options);
|
|
26036
|
-
res.status(200).json({
|
|
26037
|
-
sessions: result.sessions,
|
|
26038
|
-
...result.nextCursor != null ? { nextCursor: result.nextCursor } : {},
|
|
26039
|
-
...result.liveMergeFailed ? { liveMergeFailed: true } : {},
|
|
26040
|
-
...result.truncated ? { truncated: true } : {}
|
|
26041
|
-
});
|
|
26042
26634
|
} catch (err) {
|
|
26043
26635
|
if (err instanceof InvalidCursorError) {
|
|
26044
26636
|
res.status(400).json({
|
|
@@ -26131,6 +26723,35 @@ function registerSessionRoutes(app, deps) {
|
|
|
26131
26723
|
}
|
|
26132
26724
|
)
|
|
26133
26725
|
);
|
|
26726
|
+
app.post(
|
|
26727
|
+
"/session/:id/config-option",
|
|
26728
|
+
mutate(),
|
|
26729
|
+
withOwnerMutableSession(
|
|
26730
|
+
"POST /session/:id/config-option",
|
|
26731
|
+
async (req, res, sessionId, runtime) => {
|
|
26732
|
+
const body = safeBody(req);
|
|
26733
|
+
const configId = body["configId"];
|
|
26734
|
+
const value = body["value"];
|
|
26735
|
+
if (configId !== "reasoning_effort") {
|
|
26736
|
+
res.status(400).json({
|
|
26737
|
+
error: "`configId` must be reasoning_effort"
|
|
26738
|
+
});
|
|
26739
|
+
return;
|
|
26740
|
+
}
|
|
26741
|
+
if (typeof value !== "string" || !value) {
|
|
26742
|
+
res.status(400).json({
|
|
26743
|
+
error: "`value` is required and must be a non-empty string"
|
|
26744
|
+
});
|
|
26745
|
+
return;
|
|
26746
|
+
}
|
|
26747
|
+
const response = await runtime.bridge.setSessionConfigOption(
|
|
26748
|
+
sessionId,
|
|
26749
|
+
{ sessionId, configId, value }
|
|
26750
|
+
);
|
|
26751
|
+
res.status(200).json(response);
|
|
26752
|
+
}
|
|
26753
|
+
)
|
|
26754
|
+
);
|
|
26134
26755
|
app.post(
|
|
26135
26756
|
"/session/:id/recap",
|
|
26136
26757
|
mutate(),
|
|
@@ -27634,7 +28255,7 @@ __name(registerUsageStatsRoutes, "registerUsageStatsRoutes");
|
|
|
27634
28255
|
// packages/cli/src/serve/scheduled-task-keepalive.ts
|
|
27635
28256
|
init_esbuild_shims();
|
|
27636
28257
|
import * as fsSync from "node:fs";
|
|
27637
|
-
import * as
|
|
28258
|
+
import * as path13 from "node:path";
|
|
27638
28259
|
var log = createDebugLogger("SCHED_KEEPALIVE");
|
|
27639
28260
|
function collectBoundSessionIds(tasks) {
|
|
27640
28261
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -27860,8 +28481,8 @@ function startScheduledTaskKeepalive(opts) {
|
|
|
27860
28481
|
opts.runtimeBaseDir,
|
|
27861
28482
|
() => getCronFilePath(boundWorkspace)
|
|
27862
28483
|
);
|
|
27863
|
-
const cronDir =
|
|
27864
|
-
const cronFileName =
|
|
28484
|
+
const cronDir = path13.dirname(cronFilePath);
|
|
28485
|
+
const cronFileName = path13.basename(cronFilePath);
|
|
27865
28486
|
let fileWatcher;
|
|
27866
28487
|
try {
|
|
27867
28488
|
fsSync.mkdirSync(cronDir, { recursive: true });
|
|
@@ -28525,6 +29146,7 @@ function registerCapabilitiesRoutes(app, deps) {
|
|
|
28525
29146
|
deps.maxPendingPromptsPerSession
|
|
28526
29147
|
),
|
|
28527
29148
|
sessionRestoreTimeoutMs: deps.sessionRestoreTimeoutMs,
|
|
29149
|
+
...features.includes("workspace_file_upload") ? { maxWorkspaceFileUploadBytes: MAX_UPLOAD_BYTES } : {},
|
|
28528
29150
|
...multiWorkspace ? {
|
|
28529
29151
|
maxSessionsPerWorkspace: advertisedMaxSessions(
|
|
28530
29152
|
deps.maxSessionsPerWorkspace
|
|
@@ -30843,7 +31465,7 @@ __name(registerWorkspaceModelsRoutes, "registerWorkspaceModelsRoutes");
|
|
|
30843
31465
|
// packages/cli/src/serve/routes/a2ui-action.ts
|
|
30844
31466
|
init_esbuild_shims();
|
|
30845
31467
|
import * as fsp4 from "node:fs/promises";
|
|
30846
|
-
import * as
|
|
31468
|
+
import * as path14 from "node:path";
|
|
30847
31469
|
var A2UI_MIME = "application/a2ui+json";
|
|
30848
31470
|
var ACTION_TOOL = "action";
|
|
30849
31471
|
var CALL_TIMEOUT_MS = 15e3;
|
|
@@ -30866,7 +31488,7 @@ __name(usableServerConfig, "usableServerConfig");
|
|
|
30866
31488
|
async function findFromSettingsFile(workspaceCwd) {
|
|
30867
31489
|
try {
|
|
30868
31490
|
const raw = await fsp4.readFile(
|
|
30869
|
-
|
|
31491
|
+
path14.join(workspaceCwd, ".qwen", "settings.json"),
|
|
30870
31492
|
"utf8"
|
|
30871
31493
|
);
|
|
30872
31494
|
const settings = JSON.parse(raw);
|
|
@@ -31027,7 +31649,7 @@ __name(registerA2uiActionRoutes, "registerA2uiActionRoutes");
|
|
|
31027
31649
|
|
|
31028
31650
|
// packages/cli/src/serve/server/fs-factory.ts
|
|
31029
31651
|
init_esbuild_shims();
|
|
31030
|
-
import * as
|
|
31652
|
+
import * as path15 from "node:path";
|
|
31031
31653
|
var IDE_WORKSPACE_PATH_ENV_VAR = "QWEN_CODE_IDE_WORKSPACE_PATH";
|
|
31032
31654
|
function createDefaultFsAuditEmit() {
|
|
31033
31655
|
const WARN_EVERY = 100;
|
|
@@ -31102,14 +31724,14 @@ function parseIdeWorkspacePathEnv(value) {
|
|
|
31102
31724
|
const parsed = JSON.parse(value);
|
|
31103
31725
|
if (Array.isArray(parsed) && parsed.every((item) => typeof item === "string")) {
|
|
31104
31726
|
return parsed.filter(
|
|
31105
|
-
(workspace) => workspace.length > 0 &&
|
|
31727
|
+
(workspace) => workspace.length > 0 && path15.isAbsolute(workspace)
|
|
31106
31728
|
);
|
|
31107
31729
|
}
|
|
31108
31730
|
throw new Error("IDE workspace path JSON must be a string array");
|
|
31109
31731
|
} catch {
|
|
31110
31732
|
}
|
|
31111
31733
|
}
|
|
31112
|
-
return value.split(
|
|
31734
|
+
return value.split(path15.delimiter).filter((workspace) => workspace.length > 0 && path15.isAbsolute(workspace));
|
|
31113
31735
|
}
|
|
31114
31736
|
__name(parseIdeWorkspacePathEnv, "parseIdeWorkspacePathEnv");
|
|
31115
31737
|
function dropNestedWorkspacesPreservingPrimary(workspaces) {
|
|
@@ -31378,9 +32000,9 @@ __name(setupDeviceFlowRegistry, "setupDeviceFlowRegistry");
|
|
|
31378
32000
|
|
|
31379
32001
|
// packages/cli/src/serve/server/error-handlers.ts
|
|
31380
32002
|
init_esbuild_shims();
|
|
31381
|
-
var
|
|
32003
|
+
var import_express4 = __toESM(require_express(), 1);
|
|
31382
32004
|
function installJsonBodyParser(app) {
|
|
31383
|
-
app.use(
|
|
32005
|
+
app.use(import_express4.default.json({ limit: "10mb" }));
|
|
31384
32006
|
app.use((err, _req, res, next) => {
|
|
31385
32007
|
if (sendJsonBodyParserError(res, err)) return;
|
|
31386
32008
|
next(err);
|
|
@@ -31434,10 +32056,10 @@ function installRateLimiter(app, opts, daemonLog, options = {}) {
|
|
|
31434
32056
|
{ tier, key: key.slice(0, 64) }
|
|
31435
32057
|
);
|
|
31436
32058
|
} : void 0,
|
|
31437
|
-
onError: daemonLog ? (err,
|
|
32059
|
+
onError: daemonLog ? (err, path17) => {
|
|
31438
32060
|
daemonLog.warn(
|
|
31439
32061
|
`rate limiter error (fail-open): ${err instanceof Error ? err.message : String(err)}`,
|
|
31440
|
-
{ path:
|
|
32062
|
+
{ path: path17 }
|
|
31441
32063
|
);
|
|
31442
32064
|
} : void 0
|
|
31443
32065
|
});
|
|
@@ -31633,7 +32255,7 @@ __name(registerWorkspaceQualifiedLifecycleRoutes, "registerWorkspaceQualifiedLif
|
|
|
31633
32255
|
init_esbuild_shims();
|
|
31634
32256
|
import { readdir as readdir2, stat as stat2 } from "node:fs/promises";
|
|
31635
32257
|
import { realpathSync as realpathSync3 } from "node:fs";
|
|
31636
|
-
import { basename as
|
|
32258
|
+
import { basename as basename5, dirname as dirname5, isAbsolute as isAbsolute7, join as join9, resolve as resolve4, sep as sep3 } from "node:path";
|
|
31637
32259
|
|
|
31638
32260
|
// packages/cli/src/serve/native-directory-picker.ts
|
|
31639
32261
|
init_esbuild_shims();
|
|
@@ -32019,8 +32641,8 @@ function registerWorkspaceManagementRoutes(app, deps) {
|
|
|
32019
32641
|
return;
|
|
32020
32642
|
}
|
|
32021
32643
|
const endsWithSep = prefix.endsWith("/") || process.platform === "win32" && prefix.endsWith("\\");
|
|
32022
|
-
const dir = endsWithSep ?
|
|
32023
|
-
const filter = endsWithSep ? "" :
|
|
32644
|
+
const dir = endsWithSep ? join9(prefix, ".") : dirname5(prefix);
|
|
32645
|
+
const filter = endsWithSep ? "" : basename5(prefix);
|
|
32024
32646
|
const filterLower = filter.toLowerCase();
|
|
32025
32647
|
const suggestions = [];
|
|
32026
32648
|
let truncated = false;
|
|
@@ -32035,7 +32657,7 @@ function registerWorkspaceManagementRoutes(app, deps) {
|
|
|
32035
32657
|
let isDir = entry.isDirectory();
|
|
32036
32658
|
if (!isDir && entry.isSymbolicLink()) {
|
|
32037
32659
|
try {
|
|
32038
|
-
isDir = (await stat2(
|
|
32660
|
+
isDir = (await stat2(join9(dir, entry.name))).isDirectory();
|
|
32039
32661
|
} catch {
|
|
32040
32662
|
continue;
|
|
32041
32663
|
}
|
|
@@ -32045,7 +32667,7 @@ function registerWorkspaceManagementRoutes(app, deps) {
|
|
|
32045
32667
|
truncated = true;
|
|
32046
32668
|
break;
|
|
32047
32669
|
}
|
|
32048
|
-
suggestions.push({ name: entry.name, path:
|
|
32670
|
+
suggestions.push({ name: entry.name, path: join9(dir, entry.name) });
|
|
32049
32671
|
}
|
|
32050
32672
|
} catch {
|
|
32051
32673
|
}
|
|
@@ -32065,11 +32687,11 @@ function registerWorkspaceManagementRoutes(app, deps) {
|
|
|
32065
32687
|
const controller = new AbortController();
|
|
32066
32688
|
res.on("close", () => controller.abort());
|
|
32067
32689
|
try {
|
|
32068
|
-
const
|
|
32690
|
+
const path17 = await pickWorkspaceDirectory(controller.signal);
|
|
32069
32691
|
res.status(200).json({
|
|
32070
32692
|
kind: "workspace-directory-picker",
|
|
32071
|
-
selected:
|
|
32072
|
-
...
|
|
32693
|
+
selected: path17 !== void 0,
|
|
32694
|
+
...path17 === void 0 ? {} : { path: path17 }
|
|
32073
32695
|
});
|
|
32074
32696
|
} catch (error2) {
|
|
32075
32697
|
const detail = error2 instanceof Error ? error2.message : String(error2);
|
|
@@ -33126,8 +33748,8 @@ function buildDiffList(workspaceCwd, result) {
|
|
|
33126
33748
|
hiddenCount: 0
|
|
33127
33749
|
};
|
|
33128
33750
|
}
|
|
33129
|
-
const files = [...result.perFileStats.entries()].map(([
|
|
33130
|
-
path:
|
|
33751
|
+
const files = [...result.perFileStats.entries()].map(([path17, s]) => ({
|
|
33752
|
+
path: path17,
|
|
33131
33753
|
oldPath: s.oldPath,
|
|
33132
33754
|
added: s.added,
|
|
33133
33755
|
removed: s.removed,
|
|
@@ -36119,7 +36741,7 @@ __name(registerWorkspaceQualifiedSkillsRoutes, "registerWorkspaceQualifiedSkills
|
|
|
36119
36741
|
|
|
36120
36742
|
// packages/cli/src/serve/routes/channel-webhooks.ts
|
|
36121
36743
|
init_esbuild_shims();
|
|
36122
|
-
var
|
|
36744
|
+
var import_express5 = __toESM(require_express(), 1);
|
|
36123
36745
|
import { createHash as createHash4, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
|
|
36124
36746
|
var PROTOTYPE_POLLUTION_KEYS = /* @__PURE__ */ new Set([
|
|
36125
36747
|
"__proto__",
|
|
@@ -36168,7 +36790,7 @@ function registerChannelWebhookRoutes(app, deps) {
|
|
|
36168
36790
|
locals.channelWebhook = { channelName, source, sourceConfig };
|
|
36169
36791
|
next();
|
|
36170
36792
|
},
|
|
36171
|
-
|
|
36793
|
+
import_express5.default.json({ limit: "1mb" }),
|
|
36172
36794
|
async (req, res) => {
|
|
36173
36795
|
const locals = res.locals;
|
|
36174
36796
|
const webhook = locals.channelWebhook;
|
|
@@ -39670,7 +40292,7 @@ import { createHash as createHash5, randomUUID as randomUUID11 } from "node:cryp
|
|
|
39670
40292
|
import * as fs7 from "node:fs";
|
|
39671
40293
|
import * as fsp5 from "node:fs/promises";
|
|
39672
40294
|
import * as os2 from "node:os";
|
|
39673
|
-
import * as
|
|
40295
|
+
import * as path16 from "node:path";
|
|
39674
40296
|
import { Readable, Transform } from "node:stream";
|
|
39675
40297
|
import { pipeline } from "node:stream/promises";
|
|
39676
40298
|
import { promisify as promisify3 } from "node:util";
|
|
@@ -39750,7 +40372,7 @@ async function readBundleValue(appPath, key) {
|
|
|
39750
40372
|
"raw",
|
|
39751
40373
|
"-o",
|
|
39752
40374
|
"-",
|
|
39753
|
-
|
|
40375
|
+
path16.join(appPath, "Contents", "Info.plist")
|
|
39754
40376
|
]);
|
|
39755
40377
|
}
|
|
39756
40378
|
__name(readBundleValue, "readBundleValue");
|
|
@@ -39892,11 +40514,11 @@ async function downloadLiveHostRelease(currentArchitecture, destination, onProgr
|
|
|
39892
40514
|
__name(downloadLiveHostRelease, "downloadLiveHostRelease");
|
|
39893
40515
|
async function installLatestHost(currentArchitecture, onStatus) {
|
|
39894
40516
|
const temporaryDirectory = await fsp5.mkdtemp(
|
|
39895
|
-
|
|
40517
|
+
path16.join(os2.tmpdir(), "qwen-live-host-")
|
|
39896
40518
|
);
|
|
39897
|
-
const archivePath =
|
|
39898
|
-
const extractedPath =
|
|
39899
|
-
const candidatePath =
|
|
40519
|
+
const archivePath = path16.join(temporaryDirectory, "Qwen-Live-Host.zip");
|
|
40520
|
+
const extractedPath = path16.join(temporaryDirectory, "extracted");
|
|
40521
|
+
const candidatePath = path16.join(extractedPath, LIVE_HOST_APP_NAME);
|
|
39900
40522
|
const stagingPath = `/Applications/.Qwen Live Host.install-${randomUUID11()}.app`;
|
|
39901
40523
|
const backupPath = `/Applications/.Qwen Live Host.backup-${randomUUID11()}.app`;
|
|
39902
40524
|
let movedExisting = false;
|
|
@@ -40048,13 +40670,13 @@ var LiveHostInstaller = class {
|
|
|
40048
40670
|
init_esbuild_shims();
|
|
40049
40671
|
import { createHash as createHash6, randomUUID as randomUUID12 } from "node:crypto";
|
|
40050
40672
|
import { createWriteStream as createWriteStream2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
40051
|
-
import { join as
|
|
40673
|
+
import { join as join12 } from "node:path";
|
|
40052
40674
|
|
|
40053
40675
|
// packages/cli/src/serve/live/realtime-startup-context.ts
|
|
40054
40676
|
init_esbuild_shims();
|
|
40055
40677
|
import { readdirSync } from "node:fs";
|
|
40056
40678
|
import { homedir } from "node:os";
|
|
40057
|
-
import { basename as
|
|
40679
|
+
import { basename as basename6, join as join11 } from "node:path";
|
|
40058
40680
|
var STARTUP_CONTEXT_HEADER = "Startup context from Qwen Code.\nThis is background context about recent work and machine/workspace layout. It may be incomplete or stale. Use it to inform responses, and do not repeat it back unless relevant.";
|
|
40059
40681
|
var CURRENT_THREAD_SECTION_TOKEN_BUDGET = 1200;
|
|
40060
40682
|
var RECENT_WORK_SECTION_TOKEN_BUDGET = 2200;
|
|
@@ -40296,7 +40918,7 @@ function collectTreeLines(directory, depth, lines) {
|
|
|
40296
40918
|
const indent = " ".repeat(depth);
|
|
40297
40919
|
lines.push(`${indent}- ${entry.name}${entry.isDirectory() ? "/" : ""}`);
|
|
40298
40920
|
if (entry.isDirectory()) {
|
|
40299
|
-
collectTreeLines(
|
|
40921
|
+
collectTreeLines(join11(directory, entry.name), depth + 1, lines);
|
|
40300
40922
|
}
|
|
40301
40923
|
}
|
|
40302
40924
|
if (entries.length > DIR_ENTRY_LIMIT) {
|
|
@@ -40320,11 +40942,11 @@ function buildWorkspaceSection(currentCwd, userRoot) {
|
|
|
40320
40942
|
if (!cwdTree && !gitRoot && !userRootTree) return void 0;
|
|
40321
40943
|
const lines = [
|
|
40322
40944
|
`Current working directory: ${currentCwd}`,
|
|
40323
|
-
`Working directory name: ${
|
|
40945
|
+
`Working directory name: ${basename6(currentCwd) || currentCwd}`
|
|
40324
40946
|
];
|
|
40325
40947
|
if (gitRoot) {
|
|
40326
40948
|
lines.push(`Git root: ${gitRoot}`);
|
|
40327
|
-
lines.push(`Git project: ${
|
|
40949
|
+
lines.push(`Git project: ${basename6(gitRoot) || gitRoot}`);
|
|
40328
40950
|
}
|
|
40329
40951
|
if (userRoot) lines.push(`User root: ${userRoot}`);
|
|
40330
40952
|
if (cwdTree) lines.push("", "Working directory tree:", ...cwdTree);
|
|
@@ -40415,13 +41037,13 @@ function openLiveAudioCapture(source, identifier) {
|
|
|
40415
41037
|
try {
|
|
40416
41038
|
mkdirSync2(directory, { recursive: true, mode: 448 });
|
|
40417
41039
|
const safeIdentifier = identifier.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
40418
|
-
const
|
|
41040
|
+
const path17 = join12(
|
|
40419
41041
|
directory,
|
|
40420
41042
|
`${source}-${Date.now()}-${safeIdentifier}.pcm`
|
|
40421
41043
|
);
|
|
40422
|
-
const stream = createWriteStream2(
|
|
41044
|
+
const stream = createWriteStream2(path17, { flags: "wx", mode: 384 });
|
|
40423
41045
|
stream.on("error", () => void 0);
|
|
40424
|
-
return { source, path:
|
|
41046
|
+
return { source, path: path17, stream, hash: createHash6("sha256"), bytes: 0 };
|
|
40425
41047
|
} catch {
|
|
40426
41048
|
return void 0;
|
|
40427
41049
|
}
|
|
@@ -42817,7 +43439,7 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
|
|
|
42817
43439
|
"createServeApp: runtime replacement/removal requires deps.getSessionBridges so session-id admission can inspect draining generations."
|
|
42818
43440
|
);
|
|
42819
43441
|
}
|
|
42820
|
-
const app = (0,
|
|
43442
|
+
const app = (0, import_express6.default)();
|
|
42821
43443
|
const injectedWorkspaceRegistry = deps.workspaceRegistry;
|
|
42822
43444
|
const boundWorkspace = injectedWorkspaceRegistry?.primary.workspaceCwd ?? deps.boundWorkspace ?? canonicalizeWorkspace(opts.workspace ?? process.cwd());
|
|
42823
43445
|
if (injectedWorkspaceRegistry) {
|
|
@@ -43816,6 +44438,23 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
|
|
|
43816
44438
|
safeBody,
|
|
43817
44439
|
workspaceRegistry
|
|
43818
44440
|
});
|
|
44441
|
+
const uploadGate = createUploadConcurrencyGate();
|
|
44442
|
+
registerWorkspaceFileUploadRoutes(app, {
|
|
44443
|
+
bridge: primaryBridge,
|
|
44444
|
+
mutate,
|
|
44445
|
+
parseClientId: parseClientIdHeader,
|
|
44446
|
+
safeBody,
|
|
44447
|
+
uploadGate,
|
|
44448
|
+
...primaryRuntimeTrustAuthoritative ? { isWorkspaceTrusted: isPrimaryWorkspaceTrusted } : {}
|
|
44449
|
+
});
|
|
44450
|
+
registerWorkspaceQualifiedFileUploadRoutes(app, {
|
|
44451
|
+
bridge: primaryBridge,
|
|
44452
|
+
mutate,
|
|
44453
|
+
parseClientId: parseClientIdHeader,
|
|
44454
|
+
safeBody,
|
|
44455
|
+
uploadGate,
|
|
44456
|
+
workspaceRegistry
|
|
44457
|
+
});
|
|
43819
44458
|
registerWorkspaceSetupGithubRoutes(app, {
|
|
43820
44459
|
boundWorkspace: primaryBoundWorkspace,
|
|
43821
44460
|
bridge: primaryBridge,
|