@qwen-code/qwen-code 0.20.2-gdpval-vl-tool.1 → 0.20.2-headless-image-routing.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/qc-helper/docs/integration-github-action.md +9 -9
- package/chunks/{MaxSizedBox-42ICHKS7.js → MaxSizedBox-3XQIBACV.js} +17 -19
- package/chunks/{StandaloneSessionPicker-TO5KKJ44.js → StandaloneSessionPicker-PLQQB22E.js} +30 -32
- package/chunks/{acpAgent-RUPSQHXN.js → acpAgent-AIVK2EM5.js} +102 -147
- package/chunks/{agent-JNZ2RCVD.js → agent-QXD5NSKA.js} +16 -18
- package/chunks/{agent-headless-PFFOEECI.js → agent-headless-4VXR2TBK.js} +16 -18
- package/chunks/{anthropicContentGenerator-BGJHONDY.js → anthropicContentGenerator-HGWAHO24.js} +2 -3
- package/chunks/{artifact-tool-KMOJFNXS.js → artifact-tool-56T5IMBP.js} +1 -1
- package/chunks/{askUserQuestion-MPB63OHJ.js → askUserQuestion-E25OBIC2.js} +1 -1
- package/chunks/{bridge-NUGPSV5B.js → bridge-GIBRSPE6.js} +19 -21
- package/chunks/{chunk-PF5UYO5Q.js → chunk-3EK5ZOUQ.js} +1 -1
- package/chunks/{chunk-C73AHBAV.js → chunk-3HFNGB2O.js} +3 -3
- package/chunks/{chunk-FDV3Z2BC.js → chunk-3OAKYHRG.js} +1 -1
- package/chunks/{chunk-2UI7V7R3.js → chunk-46DK772E.js} +4 -4
- package/chunks/{chunk-YCFEI2OV.js → chunk-4DWTDZGS.js} +11 -11
- package/chunks/{chunk-RXHSK2MW.js → chunk-4OWXOUYF.js} +1 -1
- package/chunks/{chunk-RUKBSYT7.js → chunk-4PTLZ3NX.js} +1 -1
- package/chunks/{chunk-RTONGKGB.js → chunk-5GI55PF5.js} +5 -5
- package/chunks/{chunk-7SAZFFHW.js → chunk-5NJTNQUW.js} +1 -1
- package/chunks/{chunk-RCUEYZDE.js → chunk-7362QS5B.js} +2 -36
- package/chunks/{chunk-C4ETCPER.js → chunk-7AUH6A4T.js} +1 -1
- package/chunks/{chunk-PG3JGIRR.js → chunk-7NR2AIK6.js} +1 -1
- package/chunks/{chunk-A7LADCF4.js → chunk-7THPNISK.js} +4 -4
- package/chunks/{chunk-ZOIDHP5S.js → chunk-BSHD62QJ.js} +2 -2
- package/chunks/{chunk-TNPQMHHI.js → chunk-CAS7CB3T.js} +4 -4
- package/chunks/{chunk-Q73YJ7BX.js → chunk-CBOQ3HY7.js} +73 -4
- package/chunks/{chunk-2M4KCHXP.js → chunk-CGLQAVZE.js} +3 -3
- package/chunks/{chunk-WU4D5WUQ.js → chunk-CS2FSS7W.js} +4 -4
- package/chunks/{chunk-5H7WEGFG.js → chunk-DTZY2SH2.js} +1 -1
- package/chunks/{chunk-7EUTGPKC.js → chunk-EBXZ2YGV.js} +1 -1
- package/chunks/{chunk-Y5M7FHK5.js → chunk-ENPCQK44.js} +4 -4
- package/chunks/{chunk-Y2ZUMUZL.js → chunk-EZPB6S2I.js} +1 -1
- package/chunks/{chunk-VABJHFDA.js → chunk-FRPDJNK3.js} +3 -3
- package/chunks/{chunk-PS72KIET.js → chunk-FUFCALSJ.js} +2 -2
- package/chunks/{chunk-SBVVI22Y.js → chunk-FZPTCQY7.js} +1 -1
- package/chunks/{chunk-E5BPCNXZ.js → chunk-H4AR2JQF.js} +2 -2
- package/chunks/{chunk-DIAZD4DX.js → chunk-HIP6TVWA.js} +2 -2
- package/chunks/{chunk-XZNMB7QW.js → chunk-JC26SJ5Y.js} +8 -9
- package/chunks/{chunk-SRQQYF3Z.js → chunk-JZSM2IZ3.js} +3 -3
- package/chunks/{chunk-NAXCIYOA.js → chunk-KPBVP6SL.js} +3 -3
- package/chunks/{chunk-6WKLJQX7.js → chunk-L3KUB6XM.js} +115 -67
- package/chunks/{chunk-VNSKLTSN.js → chunk-L5QZGCRH.js} +1 -1
- package/chunks/{chunk-K4CH43YQ.js → chunk-LESHKUWF.js} +1 -1
- package/chunks/{chunk-T6KYXITU.js → chunk-LLKWRXSS.js} +16 -16
- package/chunks/{chunk-RZ65WFKB.js → chunk-LNDD3IML.js} +1 -1
- package/chunks/{chunk-XQ7BU4AV.js → chunk-LPEONXNV.js} +2 -2
- package/chunks/{chunk-XXJFSC4V.js → chunk-LW2FUYBN.js} +1 -1
- package/chunks/{chunk-DNKFNK6R.js → chunk-LX3COOXF.js} +3 -3
- package/chunks/{chunk-BULDBTYC.js → chunk-M7WBGLYP.js} +0 -2
- package/chunks/{chunk-WGK7MAGV.js → chunk-MA6GYKK7.js} +5 -7
- package/chunks/{chunk-NYRB3MSN.js → chunk-MBOJHHPI.js} +1 -1
- package/chunks/{chunk-IQMMGLER.js → chunk-MDZTPSXO.js} +1 -1
- package/chunks/{chunk-YBE3PTHM.js → chunk-MLYGPZGU.js} +1 -1
- package/chunks/{chunk-UZYKREB7.js → chunk-NPQDJGKU.js} +1 -1
- package/chunks/{chunk-LQ7Y2GRQ.js → chunk-NWZY2SPY.js} +7 -7
- package/chunks/{chunk-5BKCOFFW.js → chunk-O2XSCRCS.js} +31 -33
- package/chunks/{chunk-TU5VYHT4.js → chunk-O4BHWVUD.js} +1 -1
- package/chunks/{chunk-AXHOQ3RJ.js → chunk-OTQ6PSZC.js} +1061 -1428
- package/chunks/{chunk-AENXDZVH.js → chunk-PQIVAWXN.js} +13 -13
- package/chunks/{chunk-7TKBZBV7.js → chunk-Q2YKNMLS.js} +1 -1
- package/chunks/{chunk-FZBG2HS4.js → chunk-Q35QUZDQ.js} +1 -1
- package/chunks/{chunk-BONUXJOS.js → chunk-Q6NAKZTA.js} +4 -4
- package/chunks/{chunk-ABEHP4EQ.js → chunk-QE4KFTBS.js} +3 -3
- package/chunks/{chunk-KC7XCBTP.js → chunk-QKNXKTZX.js} +2 -2
- package/chunks/{chunk-SBVX4EOS.js → chunk-QOZOIPSF.js} +34 -68
- package/chunks/{chunk-XKBFSSZ4.js → chunk-RCWKCN2Z.js} +3 -3
- package/chunks/{chunk-4CG5FAS7.js → chunk-RECUEJ7B.js} +4 -4
- package/chunks/{chunk-TDHRPHZR.js → chunk-RKWX4CMO.js} +4 -4
- package/chunks/{chunk-N3YEMUFU.js → chunk-RWV32G2M.js} +1 -1
- package/chunks/{chunk-DFD65FQV.js → chunk-SQFXI7VK.js} +1 -1
- package/chunks/{chunk-XNTCIMRV.js → chunk-T5B5NQZX.js} +56 -33
- package/chunks/{chunk-I7SIAC4T.js → chunk-T5IO6FZ4.js} +1 -1
- package/chunks/{chunk-7FP7WKMN.js → chunk-TJDW42MV.js} +2 -2
- package/chunks/{chunk-LNOAJP4N.js → chunk-TWVE5ZS5.js} +3 -3
- package/chunks/{chunk-CHVO77PY.js → chunk-VRRF3GW5.js} +1 -1
- package/chunks/{chunk-KFMI4CZ4.js → chunk-WHGVTP7Q.js} +1 -1
- package/chunks/{chunk-HJ4A47AL.js → chunk-XCXYRDHB.js} +15 -15
- package/chunks/{chunk-VYIRF4CR.js → chunk-YM3SZTH4.js} +0 -2
- package/chunks/{chunk-LUCNM4BR.js → chunk-YO2XRXY6.js} +3 -3
- package/chunks/{chunk-HFI23JY4.js → chunk-ZDP2Y2AL.js} +10321 -1690
- package/chunks/{computer-use-L3SQOBAM.js → computer-use-2VIV73WK.js} +16 -18
- package/chunks/{config-utils-3A3NKH4C.js → config-utils-FYTBZLCJ.js} +1 -1
- package/chunks/{contextCommand-H6GAWHPJ.js → contextCommand-XQU7KLIH.js} +18 -20
- package/chunks/{create-sub-session-7VU7EIIU.js → create-sub-session-AZ77LBL3.js} +1 -1
- package/chunks/{create-sub-session-2AY5BJ6T.js → create-sub-session-XDHHC2P4.js} +16 -18
- package/chunks/{cron-create-NDYTP7SC.js → cron-create-KTWJM7QT.js} +1 -1
- package/chunks/{cron-delete-UBWGS4WI.js → cron-delete-2P3I5ULL.js} +1 -1
- package/chunks/{cron-list-ND7XOWNC.js → cron-list-PXDPGEDQ.js} +1 -1
- package/chunks/{daemon-GJRFILYS.js → daemon-RAPSDJH7.js} +18 -168
- package/chunks/{daemon-status-provider-CCL4KK33.js → daemon-status-provider-KQVNB4VA.js} +23 -25
- package/chunks/{earlyInputCapture-HD36OUOE.js → earlyInputCapture-WP5SA3KH.js} +16 -18
- package/chunks/{edit-OJBHWVG6.js → edit-CS6SFEXC.js} +18 -21
- package/chunks/{enter-worktree-KGMO6QQ6.js → enter-worktree-LMAL75DY.js} +16 -18
- package/chunks/{enterPlanMode-PDQC3HTV.js → enterPlanMode-WVJB4DSS.js} +16 -18
- package/chunks/{environment-VEKICJGA.js → environment-6YHC4JAJ.js} +18 -20
- package/chunks/{errors-5SA5BLN6.js → errors-JEYPXX4S.js} +18 -20
- package/chunks/{exit-worktree-ZRMRX2C7.js → exit-worktree-KPFD742L.js} +16 -18
- package/chunks/{exitPlanMode-NOH3TOAH.js → exitPlanMode-UEJS6CDY.js} +16 -18
- package/chunks/{fast-path-4O7MUC7X.js → fast-path-G2N4NRCA.js} +2 -2
- package/chunks/{gemini-M3TQUMEZ.js → gemini-2MDVIOVT.js} +61 -63
- package/chunks/{geminiContentGenerator-FBJTKMNS.js → geminiContentGenerator-ZXTDBMFR.js} +1 -1
- package/chunks/{glob-MEJJWB2L.js → glob-562XFLIZ.js} +16 -18
- package/chunks/{grep-C4CVQJAZ.js → grep-MGEFBDQK.js} +16 -18
- package/chunks/{handleAutoUpdate-TISLFVFV.js → handleAutoUpdate-2VJPAW43.js} +20 -22
- package/chunks/{i18n-5S3Y5NKK.js → i18n-R6HJENXA.js} +17 -19
- package/chunks/{initializer-WAOBUBPF.js → initializer-UOX67ZFQ.js} +21 -23
- package/chunks/{installationInfo-OSCQA3IC.js → installationInfo-NQNY34X3.js} +17 -19
- package/chunks/{list-RZATWVCE.js → list-2Z7KS7ZF.js} +24 -26
- package/chunks/{loadedSettingsAdapter-662HB67T.js → loadedSettingsAdapter-LIYY3LE4.js} +21 -23
- package/chunks/{loop-wakeup-FS5IXH3E.js → loop-wakeup-RNMRVA66.js} +2 -2
- package/chunks/{ls-VWYWZTHH.js → ls-J2ZI5XYK.js} +1 -1
- package/chunks/{lsp-XQHKK6CE.js → lsp-UMS3NUB5.js} +1 -1
- package/chunks/{managed-npm-update-PRI44AGZ.js → managed-npm-update-4KNYSOYC.js} +17 -19
- package/chunks/{mcp-SYZSCE5H.js → mcp-AJ4QW3JA.js} +21 -23
- package/chunks/{monitor-I5KABA3Z.js → monitor-DMHKE4SW.js} +16 -18
- package/chunks/{nonInteractiveCli-U5WR3FCD.js → nonInteractiveCli-PUSO5QF6.js} +52 -52
- package/chunks/{notebook-edit-LOXTW3JH.js → notebook-edit-35SJGEOR.js} +19 -22
- package/chunks/{openaiContentGenerator-W3S2JGNM.js → openaiContentGenerator-5LPAFXPF.js} +9 -11
- package/chunks/{pidfile-ZJ45VVDA.js → pidfile-EH2JW2PB.js} +16 -18
- package/chunks/{processUtils-5QVHTL7P.js → processUtils-GM2I55KF.js} +2 -2
- package/chunks/{qwenContentGenerator-I3OEFORN.js → qwenContentGenerator-HKOYNP7H.js} +19 -21
- package/chunks/{qwenOAuth2-B3WM4QKH.js → qwenOAuth2-NUUYC3V5.js} +9 -11
- package/chunks/{read-file-FLOUJKC7.js → read-file-JZ5VXILQ.js} +6 -8
- package/chunks/{read-mcp-resource-T7EMXEBK.js → read-mcp-resource-F6HYMDUY.js} +1 -1
- package/chunks/{record-artifact-QNGVUCQ7.js → record-artifact-7GCFLDD7.js} +1 -1
- package/chunks/{resumeHistoryUtils-YI3EUTAC.js → resumeHistoryUtils-Z3HG4WKM.js} +20 -22
- package/chunks/{ripGrep-LISAK6JN.js → ripGrep-JNLJCT2B.js} +16 -18
- package/chunks/{run-qwen-serve-WR2TQ3MS.js → run-qwen-serve-5VH3F4NW.js} +30 -30
- package/chunks/{runtime-QILBUIY7.js → runtime-OH77YH7W.js} +23 -25
- package/chunks/{scheduler-N3BSVKO4.js → scheduler-WJQSLCSV.js} +16 -18
- package/chunks/{sdk-exporters-http-6MCQH335.js → sdk-exporters-http-T3POX73F.js} +2 -2
- package/chunks/{sdk-impl-HOLWAXC6.js → sdk-impl-NSLPDH6I.js} +2 -2
- package/chunks/{send-message-C32RULM2.js → send-message-PYIJ2PZL.js} +3 -3
- package/chunks/{serve-IMCGI6X5.js → serve-NN5FXWR6.js} +21 -23
- package/chunks/{server-JZHNPNQ4.js → server-E4N4AI6Z.js} +182 -1169
- package/chunks/{session-ELWBF56T.js → session-5YUWIOQE.js} +53 -55
- package/chunks/{settings-YMHM2Z5I.js → settings-YY7ZSFO7.js} +25 -27
- package/chunks/{shell-DELSJRJW.js → shell-FXT3NVC6.js} +16 -18
- package/chunks/{skill-YTED22QO.js → skill-PAIDX3EU.js} +6 -8
- package/chunks/{spawnChannel-7FI4SLQQ.js → spawnChannel-XAWLXNOD.js} +18 -20
- package/chunks/{src-LISVYQMO.js → src-IZXLJI5M.js} +88 -104
- package/chunks/{standalone-update-YNKHAR3J.js → standalone-update-X675JVBL.js} +18 -20
- package/chunks/{startInteractiveUI-WFVCIGX7.js → startInteractiveUI-ND2IVBU3.js} +86 -96
- package/chunks/{syntheticOutput-7RM5GMNP.js → syntheticOutput-H7RTI5KL.js} +2 -2
- package/chunks/{task-create-6CJGO665.js → task-create-7474AJJD.js} +3 -3
- package/chunks/{task-list-7H2LPZJG.js → task-list-633HGOIB.js} +1 -1
- package/chunks/{task-stop-YAMT7XLX.js → task-stop-MNUGHPIA.js} +1 -1
- package/chunks/{task-update-FMN4BGUB.js → task-update-66GQB5LI.js} +3 -3
- package/chunks/{team-create-6ZX2E3UQ.js → team-create-2DEYNMMN.js} +16 -18
- package/chunks/{team-delete-HEKJEMYO.js → team-delete-BB3CG3QF.js} +1 -1
- package/chunks/{team-plan-approval-T3ZTY3OE.js → team-plan-approval-65AVAOCT.js} +16 -18
- package/chunks/{theme-manager-G7E3243G.js → theme-manager-2WZHPK2M.js} +16 -18
- package/chunks/{todoWrite-PNBWLG7M.js → todoWrite-KRAUN54W.js} +1 -1
- package/chunks/{tool-search-MWB75PJV.js → tool-search-ZQP3SMTV.js} +7 -9
- package/chunks/{total-session-admission-GJONESAL.js → total-session-admission-HULB2TEQ.js} +19 -21
- package/chunks/{tree-sitter-674TBDQZ.js → tree-sitter-FS4VPMZA.js} +1 -1
- package/chunks/{tree-sitter-bash-77P2V3I2.js → tree-sitter-bash-6B46JJCV.js} +1 -1
- package/chunks/{trustedFolders-CYQTKEFU.js → trustedFolders-LURI52LP.js} +17 -19
- package/chunks/{update-relaunch-XLLNZKT7.js → update-relaunch-BPWFIDLM.js} +5 -5
- package/chunks/{updateCheck-N7XECY3V.js → updateCheck-D4ESCHBJ.js} +19 -21
- package/chunks/{useAutoAcceptIndicator-MHDECHJ6.js → useAutoAcceptIndicator-CBNLOF2P.js} +22 -24
- package/chunks/{validateNonInterActiveAuth-47QCR5T5.js → validateNonInterActiveAuth-HWD6Y22I.js} +47 -49
- package/chunks/{version-IYYGFE6J.js → version-OD4JAFG7.js} +1 -1
- package/chunks/{web-fetch-SBOBXUB5.js → web-fetch-RFBKNU24.js} +11 -14
- package/chunks/{web-search-UL5724RB.js → web-search-AKTVS5YZ.js} +9 -11
- package/chunks/{workflow-Y7H3B76H.js → workflow-VZVCOSZN.js} +19 -21
- package/chunks/{workspace-providers-status-F5NXDK5F.js → workspace-providers-status-TJTVHORI.js} +24 -26
- package/chunks/{workspace-registration-store-EO2MWBI2.js → workspace-registration-store-Q5SFJSX4.js} +1 -1
- package/chunks/{workspace-registry-D73XQOR4.js → workspace-registry-H6VM5WXK.js} +19 -21
- package/chunks/{workspace-service-WMXDLVR7.js → workspace-service-ZNKD3I2J.js} +26 -28
- package/chunks/{workspace-skills-status-TL22ZQ33.js → workspace-skills-status-OOBIXADG.js} +22 -24
- package/chunks/{write-file-YYNJIVU6.js → write-file-CAKK5IAO.js} +16 -18
- package/cli.js +12 -12
- package/package.json +3 -3
- package/web-shell/assets/{arc-DIQrcXXh.js → arc-BWFm0SI0.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-CbPd-DSw.js → architectureDiagram-3BPJPVTR-CZ_yL-DQ.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-yzBIVhMX.js → blockDiagram-GPEHLZMM-B9F9mJvG.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-B88Swcsu.js → c4Diagram-AAUBKEIU-BUdwJW5f.js} +1 -1
- package/web-shell/assets/channel-DiLlxxIf.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-BbOLo6NX.js → chunk-2J33WTMH-w4cF-qlF.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-Bg6in0r0.js → chunk-4BX2VUAB-BXwURxHJ.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-Bv9QRyLI.js → chunk-55IACEB6-Gem3LalC.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-CFokiv61.js → chunk-727SXJPM-A3ddVojI.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-DS2Oxf6L.js → chunk-AQP2D5EJ-CjHZ5L_R.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-D2NkHD3B.js → chunk-FMBD7UC4-CKgdgcpv.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-BsT_UC5B.js → chunk-ND2GUHAM-Cn2Dykjb.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-tnJo3zln.js → chunk-QZHKN3VN--0SyraC5.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-CkylTdM4.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CkylTdM4.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-BTMa6DAZ.js → cose-bilkent-S5V4N54A-CphhAity.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-ujGX7Owg.js → dagre-BM42HDAG-DU--jiKp.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-fU4-dbPa.js → diagram-2AECGRRQ-BzvuZw1Y.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-Bdm-TYSA.js → diagram-5GNKFQAL-D84-49Y0.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-Bkhz85Z9.js → diagram-KO2AKTUF-DQTq-3_3.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-Bzu3q26p.js → diagram-LMA3HP47-8FTrshzN.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-CZrXbG5Q.js → diagram-OG6HWLK6-BCjpDBCm.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-BjozEAYu.js → erDiagram-TEJ5UH35-BtRObkmg.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-B3a2I8c-.js → flowDiagram-I6XJVG4X-DTrW6oxy.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-CIMn9fNm.js → ganttDiagram-6RSMTGT7-BgPNSW6j.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-DlFy9KRx.js → gitGraphDiagram-PVQCEYII-BTclNgGV.js} +1 -1
- package/web-shell/assets/index-CGtQqOIa.css +5 -0
- package/web-shell/assets/{index-BODUAzQA.js → index-CxA7AqY6.js} +1 -1
- package/web-shell/assets/index-TtM0hVjU.js +1207 -0
- package/web-shell/assets/{infoDiagram-5YYISTIA-BmKjQgCy.js → infoDiagram-5YYISTIA-DCE4AJt2.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-BrQEMZz2.js → ishikawaDiagram-YF4QCWOH-C8iE6q4Y.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-D-2r7Xrt.js → journeyDiagram-JHISSGLW-C_dxdyEc.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-CndsFHCX.js → kanban-definition-UN3LZRKU-Dw3n1u3w.js} +1 -1
- package/web-shell/assets/{linear-D-IwNnKx.js → linear-C2BF2zJ9.js} +1 -1
- package/web-shell/assets/{mermaid.core-4ll09sri.js → mermaid.core-CGTQU3MA.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-maMRIxjo.js → mindmap-definition-RKZ34NQL-BVFZm9ZC.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-aunUDhrJ.js → pieDiagram-4H26LBE5-Cc-TNN3n.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-D3K0P1NZ.js → quadrantDiagram-W4KKPZXB-CgW3Rzsi.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-CX2X9HRc.js → requirementDiagram-4Y6WPE33-BAaj0Y3B.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-CDroWk7l.js → sankeyDiagram-5OEKKPKP-XJWmekxS.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-DTk-2b16.js → sequenceDiagram-3UESZ5HK-CtRc_0wf.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-Cud64hQr.js → stateDiagram-AJRCARHV-WCnvMGy5.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-D1gzH2Ue.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-DfD5okf_.js → timeline-definition-PNZ67QCA-C9cRx49L.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-BYl8ay25.js → vennDiagram-CIIHVFJN-BvXOCEt-.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-BZFAt10J.js → wardley-L42UT6IY-ByafGtzu.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-BIWn0GA7.js → wardleyDiagram-YWT4CUSO-CozAnw8x.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-1_H4xblT.js → xychartDiagram-2RQKCTM6-Camu9Qvq.js} +1 -1
- package/web-shell/index.html +2 -2
- package/chunks/chunk-2F6JNSIQ.js +0 -8774
- package/chunks/chunk-SPX4CKEA.js +0 -85
- package/chunks/read-image-DBTJIZ2H.js +0 -155
- package/web-shell/assets/channel-BaTMUesZ.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-CyBPzWud.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CyBPzWud.js +0 -1
- package/web-shell/assets/index-C54DNMF7.js +0 -1209
- package/web-shell/assets/index-lWqBfc78.css +0 -5
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-g-uUpecT.js +0 -1
- /package/chunks/{chunk-UARMJBDM.js → chunk-GHRSKGHF.js} +0 -0
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import {
|
|
4
|
-
openQwenAsrRealtimeStream,
|
|
5
|
-
openVoiceStream,
|
|
6
|
-
openVoiceStreamWithRetry
|
|
7
|
-
} from "./chunk-ZHERRXZJ.js";
|
|
8
3
|
import {
|
|
9
4
|
GENERATION_MAX_PROMPT_BYTES,
|
|
10
5
|
MAX_REMEMBER_CONTENT_BYTES,
|
|
@@ -19,11 +14,15 @@ import {
|
|
|
19
14
|
shouldSuppressRememberErrorDetails,
|
|
20
15
|
workspaceMemoryFailureCode,
|
|
21
16
|
workspaceMemoryFailureDiagnostics
|
|
22
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-TJDW42MV.js";
|
|
18
|
+
import {
|
|
19
|
+
openQwenAsrRealtimeStream,
|
|
20
|
+
openVoiceStream,
|
|
21
|
+
openVoiceStreamWithRetry
|
|
22
|
+
} from "./chunk-ZHERRXZJ.js";
|
|
23
23
|
import {
|
|
24
24
|
SetupGithubError,
|
|
25
25
|
collectSessionData,
|
|
26
|
-
createTranscriptMessageUpdate,
|
|
27
26
|
generateExportFilename,
|
|
28
27
|
normalizeSessionData,
|
|
29
28
|
setupGithub,
|
|
@@ -31,25 +30,21 @@ import {
|
|
|
31
30
|
toJson,
|
|
32
31
|
toJsonl,
|
|
33
32
|
toMarkdown
|
|
34
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-JC26SJ5Y.js";
|
|
35
34
|
import {
|
|
36
35
|
OBSERVED_CONTACT_MAX_FRESH_WITHIN_SECONDS,
|
|
37
36
|
ObservedChannelContactStore
|
|
38
37
|
} from "./chunk-4K7VDKAD.js";
|
|
39
|
-
import "./chunk-
|
|
38
|
+
import "./chunk-LNDD3IML.js";
|
|
40
39
|
import "./chunk-RS7MT2QG.js";
|
|
41
40
|
import "./chunk-H2XVO6NE.js";
|
|
42
41
|
import "./chunk-QHTIBUWB.js";
|
|
43
42
|
import "./chunk-QTERJVPZ.js";
|
|
44
43
|
import "./chunk-3Z43GZUQ.js";
|
|
45
|
-
import {
|
|
46
|
-
createTotalSessionAdmissionController
|
|
47
|
-
} from "./chunk-VYPFXUCB.js";
|
|
48
44
|
import {
|
|
49
45
|
createSingleWorkspaceRegistry,
|
|
50
46
|
createWorkspaceSessionOwnerIndex
|
|
51
47
|
} from "./chunk-UGYMA4EI.js";
|
|
52
|
-
import "./chunk-GRC5HGPI.js";
|
|
53
48
|
import {
|
|
54
49
|
CAPABILITIES_SCHEMA_VERSION,
|
|
55
50
|
CLIENT_ID_HEADER,
|
|
@@ -113,37 +108,23 @@ import {
|
|
|
113
108
|
} from "./chunk-RXFQM6FQ.js";
|
|
114
109
|
import {
|
|
115
110
|
createDaemonStatusProvider
|
|
116
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-46DK772E.js";
|
|
117
112
|
import "./chunk-LXXMOYPL.js";
|
|
118
|
-
import "./chunk-
|
|
113
|
+
import "./chunk-3HFNGB2O.js";
|
|
119
114
|
import "./chunk-E5Z2AVNV.js";
|
|
120
|
-
import {
|
|
121
|
-
SessionArtifactAuthorizationError,
|
|
122
|
-
SessionArtifactValidationError,
|
|
123
|
-
createAcpSessionBridge,
|
|
124
|
-
parseSessionSource
|
|
125
|
-
} from "./chunk-SBVX4EOS.js";
|
|
126
|
-
import {
|
|
127
|
-
EVENT_SCHEMA_VERSION,
|
|
128
|
-
EventBus,
|
|
129
|
-
SubscriberLimitExceededError
|
|
130
|
-
} from "./chunk-6RLROE6G.js";
|
|
131
|
-
import "./chunk-COH43MRJ.js";
|
|
132
|
-
import "./chunk-QR6U5QPP.js";
|
|
133
|
-
import "./chunk-SBVVI22Y.js";
|
|
134
115
|
import {
|
|
135
116
|
createWorkspaceProvidersStatusProvider
|
|
136
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-NWZY2SPY.js";
|
|
137
118
|
import {
|
|
138
119
|
getAuthTypeFromEnv,
|
|
139
120
|
resolveCliGenerationConfig
|
|
140
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-JZSM2IZ3.js";
|
|
141
122
|
import {
|
|
142
123
|
snapshotProcessEnv
|
|
143
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-FUFCALSJ.js";
|
|
144
125
|
import {
|
|
145
126
|
createWorkspaceSkillsStatusProvider
|
|
146
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-YO2XRXY6.js";
|
|
147
128
|
import "./chunk-2W3OOD4W.js";
|
|
148
129
|
import {
|
|
149
130
|
EMPTY_WORKSPACE_VOICE_UPDATE_ERROR,
|
|
@@ -158,14 +139,14 @@ import {
|
|
|
158
139
|
validateWorkspaceSkillName,
|
|
159
140
|
validateWorkspaceVoiceState,
|
|
160
141
|
voiceSettingsScopeToWire
|
|
161
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-PQIVAWXN.js";
|
|
162
143
|
import {
|
|
163
144
|
PermissionRulesValidationError,
|
|
164
145
|
buildPermissionSettings,
|
|
165
146
|
isPermissionRuleType,
|
|
166
147
|
normalizePermissionRules,
|
|
167
148
|
readPermissionRuleSet
|
|
168
|
-
} from "./chunk-
|
|
149
|
+
} from "./chunk-EBXZ2YGV.js";
|
|
169
150
|
import {
|
|
170
151
|
assertVoiceBaseUrlNetworkAllowed,
|
|
171
152
|
isStreamingVoiceModel,
|
|
@@ -173,13 +154,35 @@ import {
|
|
|
173
154
|
resolveVoiceTranscriptionConfig,
|
|
174
155
|
sanitizeVoiceErrorMessage,
|
|
175
156
|
transcribeVoiceAudio
|
|
176
|
-
} from "./chunk-
|
|
157
|
+
} from "./chunk-MLYGPZGU.js";
|
|
177
158
|
import {
|
|
178
159
|
isVoiceEnabled,
|
|
179
160
|
isVoiceMode,
|
|
180
161
|
readVoiceModel
|
|
181
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-7NR2AIK6.js";
|
|
182
163
|
import "./chunk-QLJUC7TG.js";
|
|
164
|
+
import {
|
|
165
|
+
WorkspacePermissionRulesSessionRequiredError,
|
|
166
|
+
WorkspaceSettingsPartialPersistError,
|
|
167
|
+
WorkspaceSkillNotFoundError,
|
|
168
|
+
WorkspaceSkillNotToggleableError
|
|
169
|
+
} from "./chunk-OA4JVLSA.js";
|
|
170
|
+
import {
|
|
171
|
+
createTotalSessionAdmissionController
|
|
172
|
+
} from "./chunk-VYPFXUCB.js";
|
|
173
|
+
import "./chunk-GRC5HGPI.js";
|
|
174
|
+
import {
|
|
175
|
+
SessionArtifactAuthorizationError,
|
|
176
|
+
SessionArtifactValidationError,
|
|
177
|
+
createAcpSessionBridge,
|
|
178
|
+
parseSessionSource
|
|
179
|
+
} from "./chunk-QOZOIPSF.js";
|
|
180
|
+
import {
|
|
181
|
+
EVENT_SCHEMA_VERSION,
|
|
182
|
+
SubscriberLimitExceededError
|
|
183
|
+
} from "./chunk-6RLROE6G.js";
|
|
184
|
+
import "./chunk-COH43MRJ.js";
|
|
185
|
+
import "./chunk-QR6U5QPP.js";
|
|
183
186
|
import {
|
|
184
187
|
BranchWhilePromptActiveError,
|
|
185
188
|
CancelSentinelCollisionError,
|
|
@@ -213,29 +216,24 @@ import {
|
|
|
213
216
|
WorkspaceInitSymlinkError,
|
|
214
217
|
WorkspaceMismatchError
|
|
215
218
|
} from "./chunk-UH3WSE5L.js";
|
|
216
|
-
import {
|
|
217
|
-
STATUS_SCHEMA_VERSION,
|
|
218
|
-
createIdleWorkspaceMemoryStatus,
|
|
219
|
-
mapDomainErrorToErrorKind
|
|
220
|
-
} from "./chunk-TU5VYHT4.js";
|
|
221
|
-
import {
|
|
222
|
-
WorkspacePermissionRulesSessionRequiredError,
|
|
223
|
-
WorkspaceSettingsPartialPersistError,
|
|
224
|
-
WorkspaceSkillNotFoundError,
|
|
225
|
-
WorkspaceSkillNotToggleableError
|
|
226
|
-
} from "./chunk-OA4JVLSA.js";
|
|
227
219
|
import "./chunk-WBL3FJEU.js";
|
|
228
220
|
import {
|
|
229
221
|
daemonObservedContactsPath,
|
|
230
222
|
loadChannelsConfig
|
|
231
|
-
} from "./chunk-
|
|
232
|
-
import "./chunk-
|
|
223
|
+
} from "./chunk-RECUEJ7B.js";
|
|
224
|
+
import "./chunk-7THPNISK.js";
|
|
233
225
|
import "./chunk-57OAHC2Y.js";
|
|
234
226
|
import {
|
|
235
227
|
parseChannelWebhookConfigLenient
|
|
236
|
-
} from "./chunk-
|
|
228
|
+
} from "./chunk-GHRSKGHF.js";
|
|
237
229
|
import "./chunk-6ZBPS62S.js";
|
|
238
230
|
import "./chunk-V6WHFGST.js";
|
|
231
|
+
import "./chunk-FZPTCQY7.js";
|
|
232
|
+
import {
|
|
233
|
+
STATUS_SCHEMA_VERSION,
|
|
234
|
+
createIdleWorkspaceMemoryStatus,
|
|
235
|
+
mapDomainErrorToErrorKind
|
|
236
|
+
} from "./chunk-O4BHWVUD.js";
|
|
239
237
|
import {
|
|
240
238
|
MAX_REGISTERED_WORKSPACES,
|
|
241
239
|
WorkspaceDisplayNameValidationError,
|
|
@@ -243,7 +241,7 @@ import {
|
|
|
243
241
|
WorkspaceRegistrationStoreLimitError,
|
|
244
242
|
normalizeWorkspaceDisplayName,
|
|
245
243
|
workspaceRegistrationId
|
|
246
|
-
} from "./chunk-
|
|
244
|
+
} from "./chunk-7AUH6A4T.js";
|
|
247
245
|
import {
|
|
248
246
|
MAX_WORKSPACE_PATH_LENGTH,
|
|
249
247
|
canonicalizeWorkspace,
|
|
@@ -280,27 +278,27 @@ import {
|
|
|
280
278
|
getWritableScopes,
|
|
281
279
|
loadSettings,
|
|
282
280
|
validateSettingValue
|
|
283
|
-
} from "./chunk-
|
|
281
|
+
} from "./chunk-XCXYRDHB.js";
|
|
284
282
|
import "./chunk-RKUWKYED.js";
|
|
285
|
-
import "./chunk-GOXKNSDZ.js";
|
|
286
|
-
import "./chunk-IDS7MSUP.js";
|
|
287
283
|
import {
|
|
288
284
|
SUPPORTED_LANGUAGES,
|
|
289
285
|
detectSystemLanguage,
|
|
290
286
|
resolveLanguageSetting,
|
|
291
287
|
resolveSupportedLanguage
|
|
292
|
-
} from "./chunk-
|
|
293
|
-
import "./chunk-
|
|
288
|
+
} from "./chunk-VRRF3GW5.js";
|
|
289
|
+
import "./chunk-RWV32G2M.js";
|
|
290
|
+
import "./chunk-GOXKNSDZ.js";
|
|
291
|
+
import "./chunk-IDS7MSUP.js";
|
|
294
292
|
import "./chunk-QRUIS3DN.js";
|
|
293
|
+
import "./chunk-3EK5ZOUQ.js";
|
|
294
|
+
import "./chunk-VJNBRRZG.js";
|
|
295
295
|
import {
|
|
296
296
|
getWorkspaceTrustStatus
|
|
297
|
-
} from "./chunk-
|
|
297
|
+
} from "./chunk-4PTLZ3NX.js";
|
|
298
298
|
import "./chunk-ALGGS7UH.js";
|
|
299
299
|
import {
|
|
300
300
|
isWithinRoot as isWithinRoot2
|
|
301
301
|
} from "./chunk-MR3PXB6E.js";
|
|
302
|
-
import "./chunk-PF5UYO5Q.js";
|
|
303
|
-
import "./chunk-VJNBRRZG.js";
|
|
304
302
|
import {
|
|
305
303
|
writeStderrLine
|
|
306
304
|
} from "./chunk-OWAK7LMW.js";
|
|
@@ -347,12 +345,10 @@ import {
|
|
|
347
345
|
fetchGitDiffHunksForFile,
|
|
348
346
|
fetchGitLog,
|
|
349
347
|
getGitWorkingTreeStatus,
|
|
350
|
-
getSubagentSessionDir,
|
|
351
348
|
glob,
|
|
352
349
|
loadIgnoreRules,
|
|
353
350
|
loadUsageHistoryWithLive,
|
|
354
351
|
parseInstallSource,
|
|
355
|
-
readAgentMeta,
|
|
356
352
|
readWorktreeSession,
|
|
357
353
|
redactUrlCredentials,
|
|
358
354
|
resolveBranchName,
|
|
@@ -364,20 +360,19 @@ import {
|
|
|
364
360
|
writeWorkspaceContextFile,
|
|
365
361
|
writeWorktreeSession,
|
|
366
362
|
writeWorktreeSessionMarker
|
|
367
|
-
} from "./chunk-
|
|
368
|
-
import "./chunk-5M6IDOMF.js";
|
|
363
|
+
} from "./chunk-OTQ6PSZC.js";
|
|
369
364
|
import "./chunk-T4TZQJ7W.js";
|
|
370
365
|
import "./chunk-H6XPXXMH.js";
|
|
371
|
-
import
|
|
372
|
-
MAX_JOBS,
|
|
373
|
-
nextDurableFireMs
|
|
374
|
-
} from "./chunk-7TKBZBV7.js";
|
|
366
|
+
import "./chunk-5M6IDOMF.js";
|
|
375
367
|
import "./chunk-T2L47JJK.js";
|
|
376
368
|
import "./chunk-GPSKDNEE.js";
|
|
377
369
|
import "./chunk-X6N25LXS.js";
|
|
378
370
|
import "./chunk-E2UVIFI2.js";
|
|
379
|
-
import "./chunk-
|
|
380
|
-
import
|
|
371
|
+
import "./chunk-T5IO6FZ4.js";
|
|
372
|
+
import {
|
|
373
|
+
MAX_JOBS,
|
|
374
|
+
nextDurableFireMs
|
|
375
|
+
} from "./chunk-Q2YKNMLS.js";
|
|
381
376
|
import {
|
|
382
377
|
nextFireTime,
|
|
383
378
|
parseCron
|
|
@@ -392,7 +387,7 @@ import {
|
|
|
392
387
|
updateCronTasks
|
|
393
388
|
} from "./chunk-KHOVYUHX.js";
|
|
394
389
|
import "./chunk-SZRN75WQ.js";
|
|
395
|
-
import "./chunk-
|
|
390
|
+
import "./chunk-6PVPNMXU.js";
|
|
396
391
|
import "./chunk-CPBF7KYF.js";
|
|
397
392
|
import "./chunk-NABLFI57.js";
|
|
398
393
|
import "./chunk-QBUDF33N.js";
|
|
@@ -401,10 +396,11 @@ import {
|
|
|
401
396
|
APPROVAL_MODES,
|
|
402
397
|
SubagentError,
|
|
403
398
|
SubagentErrorCode
|
|
404
|
-
} from "./chunk-
|
|
399
|
+
} from "./chunk-WHGVTP7Q.js";
|
|
405
400
|
import "./chunk-6AM5D4ME.js";
|
|
406
401
|
import "./chunk-JCW2R7WC.js";
|
|
407
402
|
import "./chunk-57FIIFJN.js";
|
|
403
|
+
import "./chunk-HTO4JFDZ.js";
|
|
408
404
|
import {
|
|
409
405
|
QwenOAuth2Client,
|
|
410
406
|
QwenOAuthPollError,
|
|
@@ -413,10 +409,10 @@ import {
|
|
|
413
409
|
isDeviceAuthorizationSuccess,
|
|
414
410
|
isDeviceTokenPending,
|
|
415
411
|
isDeviceTokenSuccess
|
|
416
|
-
} from "./chunk-
|
|
417
|
-
import "./chunk-KC7XCBTP.js";
|
|
418
|
-
import "./chunk-XXJFSC4V.js";
|
|
412
|
+
} from "./chunk-RCWKCN2Z.js";
|
|
419
413
|
import "./chunk-JESCGQM3.js";
|
|
414
|
+
import "./chunk-QKNXKTZX.js";
|
|
415
|
+
import "./chunk-LW2FUYBN.js";
|
|
420
416
|
import "./chunk-XVNQMZ2I.js";
|
|
421
417
|
import "./chunk-CR3C7WXL.js";
|
|
422
418
|
import "./chunk-FODK6UMO.js";
|
|
@@ -424,26 +420,21 @@ import "./chunk-GLNBDYUX.js";
|
|
|
424
420
|
import "./chunk-DJ2GSRLV.js";
|
|
425
421
|
import {
|
|
426
422
|
addDaemonRequestAttribute,
|
|
423
|
+
decodeBufferWithEncodingInfo,
|
|
427
424
|
emitDaemonLog,
|
|
425
|
+
getAllGeminiMdFilenames,
|
|
428
426
|
hashDaemonWorkspace,
|
|
429
|
-
|
|
430
|
-
|
|
427
|
+
isBinaryFile,
|
|
428
|
+
isWithinRoot,
|
|
431
429
|
recordDaemonBridgeError,
|
|
432
430
|
recordDaemonError,
|
|
433
431
|
recordDaemonHttpRequest,
|
|
434
432
|
recordDaemonHttpResponse,
|
|
435
433
|
withDaemonRequestSpan
|
|
436
|
-
} from "./chunk-
|
|
434
|
+
} from "./chunk-ZDP2Y2AL.js";
|
|
437
435
|
import "./chunk-VGC4I5JJ.js";
|
|
438
436
|
import "./chunk-4K56OJFJ.js";
|
|
439
|
-
import
|
|
440
|
-
decodeBufferWithEncodingInfo,
|
|
441
|
-
getAllGeminiMdFilenames,
|
|
442
|
-
isBinaryFile,
|
|
443
|
-
isWithinRoot
|
|
444
|
-
} from "./chunk-2F6JNSIQ.js";
|
|
445
|
-
import "./chunk-Q73YJ7BX.js";
|
|
446
|
-
import "./chunk-SPX4CKEA.js";
|
|
437
|
+
import "./chunk-CBOQ3HY7.js";
|
|
447
438
|
import "./chunk-A4UCTEB5.js";
|
|
448
439
|
import "./chunk-XWRJCPHC.js";
|
|
449
440
|
import "./chunk-QNLNLENL.js";
|
|
@@ -453,12 +444,12 @@ import {
|
|
|
453
444
|
import_websocket_server
|
|
454
445
|
} from "./chunk-TYAMGABM.js";
|
|
455
446
|
import "./chunk-FCMNKVXT.js";
|
|
456
|
-
import "./chunk-
|
|
447
|
+
import "./chunk-7362QS5B.js";
|
|
457
448
|
import "./chunk-HTR4WV6U.js";
|
|
458
|
-
import "./chunk-
|
|
449
|
+
import "./chunk-M7WBGLYP.js";
|
|
459
450
|
import "./chunk-U7ZFW55U.js";
|
|
460
|
-
import "./chunk-
|
|
461
|
-
import "./chunk-
|
|
451
|
+
import "./chunk-NPQDJGKU.js";
|
|
452
|
+
import "./chunk-YM3SZTH4.js";
|
|
462
453
|
import {
|
|
463
454
|
FatalConfigError,
|
|
464
455
|
Storage,
|
|
@@ -660,9 +651,9 @@ async function findExistingAncestor(absolute) {
|
|
|
660
651
|
let current = absolute;
|
|
661
652
|
const tailParts = [];
|
|
662
653
|
for (let i = 0; i < MAX_ANCESTOR_HOPS; i++) {
|
|
663
|
-
let
|
|
654
|
+
let stat2 = null;
|
|
664
655
|
try {
|
|
665
|
-
|
|
656
|
+
stat2 = await fsp.stat(current);
|
|
666
657
|
} catch (err) {
|
|
667
658
|
const code = err?.code;
|
|
668
659
|
if (code === "ENOENT" || code === "ENOTDIR") {
|
|
@@ -670,8 +661,8 @@ async function findExistingAncestor(absolute) {
|
|
|
670
661
|
throw err;
|
|
671
662
|
}
|
|
672
663
|
}
|
|
673
|
-
if (
|
|
674
|
-
if (tailParts.length > 0 && !
|
|
664
|
+
if (stat2) {
|
|
665
|
+
if (tailParts.length > 0 && !stat2.isDirectory()) {
|
|
675
666
|
throw new FsError(
|
|
676
667
|
"parse_error",
|
|
677
668
|
`path component is not a directory: ${absolute}`,
|
|
@@ -744,7 +735,7 @@ async function resolveWithinWorkspace(input, boundWorkspaces, intent) {
|
|
|
744
735
|
boundCanonicals
|
|
745
736
|
);
|
|
746
737
|
if (boundCanonical !== void 0) {
|
|
747
|
-
const finalPathIsSymlink = await fsp.lstat(absolute).then((
|
|
738
|
+
const finalPathIsSymlink = await fsp.lstat(absolute).then((stat2) => stat2.isSymbolicLink()).catch((lstatErr) => {
|
|
748
739
|
if (lstatErr.code === "ENOENT" || lstatErr.code === "ENOTDIR") {
|
|
749
740
|
return false;
|
|
750
741
|
}
|
|
@@ -1235,8 +1226,8 @@ var WorkspaceFileSystemImpl = class {
|
|
|
1235
1226
|
const toRead = Math.min(maxBytes, available);
|
|
1236
1227
|
buf = Buffer.allocUnsafe(toRead);
|
|
1237
1228
|
if (toRead > 0) {
|
|
1238
|
-
const
|
|
1239
|
-
buf =
|
|
1229
|
+
const read = await fh.read(buf, 0, toRead, offset);
|
|
1230
|
+
buf = read.bytesRead === toRead ? buf : buf.subarray(0, read.bytesRead);
|
|
1240
1231
|
}
|
|
1241
1232
|
const afterRead = await fh.stat();
|
|
1242
1233
|
assertSameFile(st, afterRead, p, "read");
|
|
@@ -1777,17 +1768,17 @@ var WorkspaceFileSystemImpl = class {
|
|
|
1777
1768
|
* for their `sendFsError` serializer.
|
|
1778
1769
|
*/
|
|
1779
1770
|
recordAndWrap(err, intent, input) {
|
|
1780
|
-
const
|
|
1771
|
+
const fs5 = wrapAsFsError(err);
|
|
1781
1772
|
this.deps.audit.recordDenied(this.deps.ctx, {
|
|
1782
1773
|
intent,
|
|
1783
1774
|
input,
|
|
1784
|
-
errorKind:
|
|
1785
|
-
hint:
|
|
1775
|
+
errorKind: fs5.kind,
|
|
1776
|
+
hint: fs5.hint,
|
|
1786
1777
|
// Quote the underlying OS / FsError message so audit
|
|
1787
1778
|
// consumers debugging a production incident can see the
|
|
1788
1779
|
// actual cause (errno text, byte counts, glob pattern,
|
|
1789
1780
|
// etc.) rather than just `errorKind` + `hint`.
|
|
1790
|
-
message:
|
|
1781
|
+
message: fs5.message,
|
|
1791
1782
|
// For glob denials (parse_error pattern rejection,
|
|
1792
1783
|
// catastrophic walk failures) the input IS the pattern
|
|
1793
1784
|
// already; surfacing it on the dedicated `pattern` field
|
|
@@ -1796,7 +1787,7 @@ var WorkspaceFileSystemImpl = class {
|
|
|
1796
1787
|
// branching on intent.
|
|
1797
1788
|
pattern: intent === "glob" ? input : void 0
|
|
1798
1789
|
});
|
|
1799
|
-
return
|
|
1790
|
+
return fs5;
|
|
1800
1791
|
}
|
|
1801
1792
|
};
|
|
1802
1793
|
var CONTENT_HASH_RE = /^sha256:[0-9a-f]{64}$/;
|
|
@@ -1904,9 +1895,9 @@ async function readStableRegularFileBuffer(p, pre) {
|
|
|
1904
1895
|
const out = Buffer.alloc(opened.size);
|
|
1905
1896
|
let offset = 0;
|
|
1906
1897
|
while (offset < opened.size) {
|
|
1907
|
-
const
|
|
1908
|
-
if (
|
|
1909
|
-
offset +=
|
|
1898
|
+
const read = await fh.read(out, offset, opened.size - offset, offset);
|
|
1899
|
+
if (read.bytesRead === 0) break;
|
|
1900
|
+
offset += read.bytesRead;
|
|
1910
1901
|
}
|
|
1911
1902
|
const afterRead = await fh.stat();
|
|
1912
1903
|
assertSameFile(opened, afterRead, p, "read");
|
|
@@ -2161,15 +2152,15 @@ async function hashRegularFileAtPath(p, pre) {
|
|
|
2161
2152
|
const buf = Buffer.allocUnsafe(64 * 1024);
|
|
2162
2153
|
let offset = 0;
|
|
2163
2154
|
while (offset < opened.size) {
|
|
2164
|
-
const
|
|
2155
|
+
const read = await fh.read(
|
|
2165
2156
|
buf,
|
|
2166
2157
|
0,
|
|
2167
2158
|
Math.min(buf.length, opened.size - offset),
|
|
2168
2159
|
offset
|
|
2169
2160
|
);
|
|
2170
|
-
if (
|
|
2171
|
-
hash.update(buf.subarray(0,
|
|
2172
|
-
offset +=
|
|
2161
|
+
if (read.bytesRead === 0) break;
|
|
2162
|
+
hash.update(buf.subarray(0, read.bytesRead));
|
|
2163
|
+
offset += read.bytesRead;
|
|
2173
2164
|
}
|
|
2174
2165
|
} finally {
|
|
2175
2166
|
await fh.close();
|
|
@@ -2533,12 +2524,12 @@ __name(applyReadHeaders, "applyReadHeaders");
|
|
|
2533
2524
|
function sendFsError(res, err, route) {
|
|
2534
2525
|
applyReadHeaders(res);
|
|
2535
2526
|
if (isFsError(err)) {
|
|
2536
|
-
const
|
|
2537
|
-
res.status(
|
|
2538
|
-
errorKind:
|
|
2539
|
-
error:
|
|
2540
|
-
hint:
|
|
2541
|
-
status:
|
|
2527
|
+
const fs5 = err;
|
|
2528
|
+
res.status(fs5.status).json({
|
|
2529
|
+
errorKind: fs5.kind,
|
|
2530
|
+
error: fs5.message,
|
|
2531
|
+
hint: fs5.hint,
|
|
2532
|
+
status: fs5.status
|
|
2542
2533
|
});
|
|
2543
2534
|
return;
|
|
2544
2535
|
}
|
|
@@ -2640,13 +2631,13 @@ async function handleGetFile(req, res, deps) {
|
|
|
2640
2631
|
});
|
|
2641
2632
|
return;
|
|
2642
2633
|
}
|
|
2643
|
-
const
|
|
2634
|
+
const fs5 = factory.forRequest({
|
|
2644
2635
|
originatorClientId: clientId ?? void 0,
|
|
2645
2636
|
route: ROUTE2
|
|
2646
2637
|
});
|
|
2647
2638
|
try {
|
|
2648
|
-
const resolved = await
|
|
2649
|
-
const out = await
|
|
2639
|
+
const resolved = await fs5.resolve(queryPath, "read");
|
|
2640
|
+
const out = await fs5.readText(resolved, { maxBytes, line, limit });
|
|
2650
2641
|
const returnedBytes = Buffer.byteLength(out.content, "utf-8");
|
|
2651
2642
|
applyReadHeaders(res);
|
|
2652
2643
|
res.status(200).json({
|
|
@@ -2700,13 +2691,13 @@ async function handleGetFileBytes(req, res, deps) {
|
|
|
2700
2691
|
});
|
|
2701
2692
|
return;
|
|
2702
2693
|
}
|
|
2703
|
-
const
|
|
2694
|
+
const fs5 = factory.forRequest({
|
|
2704
2695
|
originatorClientId: clientId ?? void 0,
|
|
2705
2696
|
route: ROUTE2
|
|
2706
2697
|
});
|
|
2707
2698
|
try {
|
|
2708
|
-
const resolved = await
|
|
2709
|
-
const out = await
|
|
2699
|
+
const resolved = await fs5.resolve(queryPath, "read");
|
|
2700
|
+
const out = await fs5.readBytesWindow(resolved, {
|
|
2710
2701
|
offset: offset ?? 0,
|
|
2711
2702
|
maxBytes: maxBytes ?? DEFAULT_FILE_BYTES_MAX_BYTES
|
|
2712
2703
|
});
|
|
@@ -2734,13 +2725,13 @@ async function handleGetStat(req, res, deps) {
|
|
|
2734
2725
|
if (clientId === null) return;
|
|
2735
2726
|
const queryPath = requireStringQuery(res, req.query["path"], "path", ROUTE2);
|
|
2736
2727
|
if (queryPath === null) return;
|
|
2737
|
-
const
|
|
2728
|
+
const fs5 = factory.forRequest({
|
|
2738
2729
|
originatorClientId: clientId ?? void 0,
|
|
2739
2730
|
route: ROUTE2
|
|
2740
2731
|
});
|
|
2741
2732
|
try {
|
|
2742
|
-
const resolved = await
|
|
2743
|
-
const st = await
|
|
2733
|
+
const resolved = await fs5.resolve(queryPath, "stat");
|
|
2734
|
+
const st = await fs5.stat(resolved);
|
|
2744
2735
|
applyReadHeaders(res);
|
|
2745
2736
|
res.status(200).json({
|
|
2746
2737
|
kind: "stat",
|
|
@@ -2763,13 +2754,13 @@ async function handleGetList(req, res, deps) {
|
|
|
2763
2754
|
const queryPath = requireStringQuery(res, req.query["path"], "path", ROUTE2);
|
|
2764
2755
|
if (queryPath === null) return;
|
|
2765
2756
|
const includeIgnored = parseBoolFlag(req.query["includeIgnored"]);
|
|
2766
|
-
const
|
|
2757
|
+
const fs5 = factory.forRequest({
|
|
2767
2758
|
originatorClientId: clientId ?? void 0,
|
|
2768
2759
|
route: ROUTE2
|
|
2769
2760
|
});
|
|
2770
2761
|
try {
|
|
2771
|
-
const resolved = await
|
|
2772
|
-
const entries = await
|
|
2762
|
+
const resolved = await fs5.resolve(queryPath, "list");
|
|
2763
|
+
const entries = await fs5.list(resolved, {
|
|
2773
2764
|
includeIgnored,
|
|
2774
2765
|
maxEntries: MAX_LIST_ENTRIES + 1
|
|
2775
2766
|
});
|
|
@@ -2822,15 +2813,15 @@ async function handleGetGlob(req, res, deps) {
|
|
|
2822
2813
|
}
|
|
2823
2814
|
const cwdRaw = req.query["cwd"];
|
|
2824
2815
|
const cwdString = typeof cwdRaw === "string" && cwdRaw.length > 0 ? cwdRaw : void 0;
|
|
2825
|
-
const
|
|
2816
|
+
const fs5 = factory.forRequest({
|
|
2826
2817
|
originatorClientId: clientId ?? void 0,
|
|
2827
2818
|
route: ROUTE2
|
|
2828
2819
|
});
|
|
2829
2820
|
const start = performance.now();
|
|
2830
2821
|
try {
|
|
2831
|
-
const cwdResolved = cwdString ? await
|
|
2822
|
+
const cwdResolved = cwdString ? await fs5.resolve(cwdString, "list") : void 0;
|
|
2832
2823
|
const cap = maxResults ?? DEFAULT_GLOB_MAX_RESULTS;
|
|
2833
|
-
const probe = await
|
|
2824
|
+
const probe = await fs5.glob(pattern, {
|
|
2834
2825
|
cwd: cwdResolved,
|
|
2835
2826
|
includeIgnored,
|
|
2836
2827
|
maxResults: cap + 1
|
|
@@ -3004,7 +2995,7 @@ function validateClientId(clientId, deps, res) {
|
|
|
3004
2995
|
}
|
|
3005
2996
|
__name(validateClientId, "validateClientId");
|
|
3006
2997
|
function createSetupGithubFileOps(factory, route, originatorClientId) {
|
|
3007
|
-
const
|
|
2998
|
+
const fs5 = factory.forRequest({
|
|
3008
2999
|
route,
|
|
3009
3000
|
...originatorClientId ? { originatorClientId } : {}
|
|
3010
3001
|
});
|
|
@@ -3027,14 +3018,14 @@ function createSetupGithubFileOps(factory, route, originatorClientId) {
|
|
|
3027
3018
|
]);
|
|
3028
3019
|
},
|
|
3029
3020
|
async writeTextFile(_gitRepoRoot, relativePath, content) {
|
|
3030
|
-
const resolved = await
|
|
3031
|
-
const out = await
|
|
3021
|
+
const resolved = await fs5.resolve(relativePath, "write");
|
|
3022
|
+
const out = await fs5.writeTextOverwrite(resolved, content);
|
|
3032
3023
|
return { sizeBytes: out.sizeBytes };
|
|
3033
3024
|
},
|
|
3034
3025
|
async readTextFile(_gitRepoRoot, relativePath) {
|
|
3035
3026
|
try {
|
|
3036
|
-
const resolved = await
|
|
3037
|
-
const out = await
|
|
3027
|
+
const resolved = await fs5.resolve(relativePath, "read");
|
|
3028
|
+
const out = await fs5.readText(resolved);
|
|
3038
3029
|
return out.content;
|
|
3039
3030
|
} catch (error2) {
|
|
3040
3031
|
if (isFsError(error2) && error2.kind === "path_not_found") {
|
|
@@ -3055,15 +3046,15 @@ async function ensureDirectoryWithoutSymlink(root, segments) {
|
|
|
3055
3046
|
checkedSegments.push(segment);
|
|
3056
3047
|
const label = `Workspace path "${checkedSegments.join("/")}"`;
|
|
3057
3048
|
try {
|
|
3058
|
-
const
|
|
3059
|
-
if (
|
|
3049
|
+
const stat2 = await fsp3.lstat(current);
|
|
3050
|
+
if (stat2.isSymbolicLink()) {
|
|
3060
3051
|
throw new SetupGithubError(
|
|
3061
3052
|
"github_setup_invalid_workspace",
|
|
3062
3053
|
`${label} must not be a symlink.`,
|
|
3063
3054
|
400
|
|
3064
3055
|
);
|
|
3065
3056
|
}
|
|
3066
|
-
if (!
|
|
3057
|
+
if (!stat2.isDirectory()) {
|
|
3067
3058
|
throw new SetupGithubError(
|
|
3068
3059
|
"github_setup_invalid_workspace",
|
|
3069
3060
|
`${label} must be a directory.`,
|
|
@@ -3100,15 +3091,15 @@ async function ensureDirectoryWithoutSymlink(root, segments) {
|
|
|
3100
3091
|
}
|
|
3101
3092
|
__name(ensureDirectoryWithoutSymlink, "ensureDirectoryWithoutSymlink");
|
|
3102
3093
|
async function assertDirectoryWithoutSymlink(target, label) {
|
|
3103
|
-
const
|
|
3104
|
-
if (
|
|
3094
|
+
const stat2 = await fsp3.lstat(target);
|
|
3095
|
+
if (stat2.isSymbolicLink()) {
|
|
3105
3096
|
throw new SetupGithubError(
|
|
3106
3097
|
"github_setup_invalid_workspace",
|
|
3107
3098
|
`${label} must not be a symlink.`,
|
|
3108
3099
|
400
|
|
3109
3100
|
);
|
|
3110
3101
|
}
|
|
3111
|
-
if (!
|
|
3102
|
+
if (!stat2.isDirectory()) {
|
|
3112
3103
|
throw new SetupGithubError(
|
|
3113
3104
|
"github_setup_invalid_workspace",
|
|
3114
3105
|
`${label} must be a directory.`,
|
|
@@ -4749,12 +4740,12 @@ async function collectWorkspaceMemoryStatus(boundWorkspace) {
|
|
|
4749
4740
|
for (const filename of filenames) {
|
|
4750
4741
|
const candidate = path8.join(globalDir, filename);
|
|
4751
4742
|
try {
|
|
4752
|
-
const
|
|
4753
|
-
if (
|
|
4743
|
+
const stat2 = await fs.stat(candidate);
|
|
4744
|
+
if (stat2.isFile()) {
|
|
4754
4745
|
files.push({
|
|
4755
4746
|
absolutePath: candidate,
|
|
4756
4747
|
scope: "global",
|
|
4757
|
-
bytes:
|
|
4748
|
+
bytes: stat2.size
|
|
4758
4749
|
});
|
|
4759
4750
|
}
|
|
4760
4751
|
} catch (err) {
|
|
@@ -4798,12 +4789,12 @@ async function walkWorkspaceForMemory(start, filenames, errors) {
|
|
|
4798
4789
|
for (const filename of filenames) {
|
|
4799
4790
|
const candidate = path8.join(start, filename);
|
|
4800
4791
|
try {
|
|
4801
|
-
const
|
|
4802
|
-
if (
|
|
4792
|
+
const stat2 = await fs.stat(candidate);
|
|
4793
|
+
if (stat2.isFile()) {
|
|
4803
4794
|
out.push({
|
|
4804
4795
|
absolutePath: candidate,
|
|
4805
4796
|
scope: "workspace",
|
|
4806
|
-
bytes:
|
|
4797
|
+
bytes: stat2.size
|
|
4807
4798
|
});
|
|
4808
4799
|
}
|
|
4809
4800
|
} catch (err) {
|
|
@@ -9055,7 +9046,7 @@ var AcpDispatcher = class {
|
|
|
9055
9046
|
);
|
|
9056
9047
|
return;
|
|
9057
9048
|
}
|
|
9058
|
-
const
|
|
9049
|
+
const fs5 = this.fsFactory.forRequest({
|
|
9059
9050
|
originatorClientId: conn.clientId,
|
|
9060
9051
|
route: `ACP ${method}`
|
|
9061
9052
|
});
|
|
@@ -9107,8 +9098,8 @@ var AcpDispatcher = class {
|
|
|
9107
9098
|
);
|
|
9108
9099
|
return;
|
|
9109
9100
|
}
|
|
9110
|
-
const resolved = await
|
|
9111
|
-
const out = await
|
|
9101
|
+
const resolved = await fs5.resolve(p, "read");
|
|
9102
|
+
const out = await fs5.readText(resolved, { maxBytes, line, limit });
|
|
9112
9103
|
this.replyConn(conn, id, {
|
|
9113
9104
|
path: p,
|
|
9114
9105
|
content: out.content,
|
|
@@ -9130,7 +9121,7 @@ var AcpDispatcher = class {
|
|
|
9130
9121
|
conn.sendConn(error(id, RPC.INVALID_PARAMS, "`path` required"));
|
|
9131
9122
|
return;
|
|
9132
9123
|
}
|
|
9133
|
-
const
|
|
9124
|
+
const fs5 = this.fsFactory.forRequest({
|
|
9134
9125
|
originatorClientId: conn.clientId,
|
|
9135
9126
|
route: `ACP ${method}`
|
|
9136
9127
|
});
|
|
@@ -9166,8 +9157,8 @@ var AcpDispatcher = class {
|
|
|
9166
9157
|
);
|
|
9167
9158
|
return;
|
|
9168
9159
|
}
|
|
9169
|
-
const resolved = await
|
|
9170
|
-
const buf = await
|
|
9160
|
+
const resolved = await fs5.resolve(p, "read");
|
|
9161
|
+
const buf = await fs5.readBytesWindow(resolved, { offset, maxBytes });
|
|
9171
9162
|
this.replyConn(conn, id, { path: p, ...buf });
|
|
9172
9163
|
return;
|
|
9173
9164
|
}
|
|
@@ -9185,12 +9176,12 @@ var AcpDispatcher = class {
|
|
|
9185
9176
|
conn.sendConn(error(id, RPC.INVALID_PARAMS, "`path` required"));
|
|
9186
9177
|
return;
|
|
9187
9178
|
}
|
|
9188
|
-
const
|
|
9179
|
+
const fs5 = this.fsFactory.forRequest({
|
|
9189
9180
|
originatorClientId: conn.clientId,
|
|
9190
9181
|
route: `ACP ${method}`
|
|
9191
9182
|
});
|
|
9192
|
-
const resolved = await
|
|
9193
|
-
const result = await
|
|
9183
|
+
const resolved = await fs5.resolve(p, "read");
|
|
9184
|
+
const result = await fs5.stat(resolved);
|
|
9194
9185
|
this.replyConn(conn, id, { path: p, ...result });
|
|
9195
9186
|
return;
|
|
9196
9187
|
}
|
|
@@ -9208,13 +9199,13 @@ var AcpDispatcher = class {
|
|
|
9208
9199
|
conn.sendConn(error(id, RPC.INVALID_PARAMS, "`path` required"));
|
|
9209
9200
|
return;
|
|
9210
9201
|
}
|
|
9211
|
-
const
|
|
9202
|
+
const fs5 = this.fsFactory.forRequest({
|
|
9212
9203
|
originatorClientId: conn.clientId,
|
|
9213
9204
|
route: `ACP ${method}`
|
|
9214
9205
|
});
|
|
9215
|
-
const resolved = await
|
|
9206
|
+
const resolved = await fs5.resolve(p, "read");
|
|
9216
9207
|
const MAX_LIST = 2e3;
|
|
9217
|
-
const entries = await
|
|
9208
|
+
const entries = await fs5.list(resolved, { maxEntries: MAX_LIST + 1 });
|
|
9218
9209
|
const truncated = entries.length > MAX_LIST;
|
|
9219
9210
|
this.replyConn(conn, id, {
|
|
9220
9211
|
path: p,
|
|
@@ -9239,7 +9230,7 @@ var AcpDispatcher = class {
|
|
|
9239
9230
|
);
|
|
9240
9231
|
return;
|
|
9241
9232
|
}
|
|
9242
|
-
const
|
|
9233
|
+
const fs5 = this.fsFactory.forRequest({
|
|
9243
9234
|
originatorClientId: conn.clientId,
|
|
9244
9235
|
route: `ACP ${method}`
|
|
9245
9236
|
});
|
|
@@ -9259,7 +9250,7 @@ var AcpDispatcher = class {
|
|
|
9259
9250
|
);
|
|
9260
9251
|
return;
|
|
9261
9252
|
}
|
|
9262
|
-
const matches = await
|
|
9253
|
+
const matches = await fs5.glob(pattern, {
|
|
9263
9254
|
maxResults: maxResults + 1
|
|
9264
9255
|
});
|
|
9265
9256
|
const truncated = matches.length > maxResults;
|
|
@@ -9291,11 +9282,11 @@ var AcpDispatcher = class {
|
|
|
9291
9282
|
);
|
|
9292
9283
|
return;
|
|
9293
9284
|
}
|
|
9294
|
-
const
|
|
9285
|
+
const fs5 = this.fsFactory.forRequest({
|
|
9295
9286
|
originatorClientId: conn.clientId,
|
|
9296
9287
|
route: `ACP ${method}`
|
|
9297
9288
|
});
|
|
9298
|
-
const resolved = await
|
|
9289
|
+
const resolved = await fs5.resolve(p, "write");
|
|
9299
9290
|
if (Buffer.byteLength(params["content"], "utf8") > 10 * 1024 * 1024) {
|
|
9300
9291
|
if (id !== void 0)
|
|
9301
9292
|
conn.sendConn(
|
|
@@ -9303,7 +9294,7 @@ var AcpDispatcher = class {
|
|
|
9303
9294
|
);
|
|
9304
9295
|
return;
|
|
9305
9296
|
}
|
|
9306
|
-
await
|
|
9297
|
+
await fs5.writeTextOverwrite(resolved, params["content"]);
|
|
9307
9298
|
this.replyConn(conn, id, { ok: true, path: p });
|
|
9308
9299
|
return;
|
|
9309
9300
|
}
|
|
@@ -9332,12 +9323,12 @@ var AcpDispatcher = class {
|
|
|
9332
9323
|
);
|
|
9333
9324
|
return;
|
|
9334
9325
|
}
|
|
9335
|
-
const
|
|
9326
|
+
const fs5 = this.fsFactory.forRequest({
|
|
9336
9327
|
originatorClientId: conn.clientId,
|
|
9337
9328
|
route: `ACP ${method}`
|
|
9338
9329
|
});
|
|
9339
|
-
const resolved = await
|
|
9340
|
-
const result = await
|
|
9330
|
+
const resolved = await fs5.resolve(p, "write");
|
|
9331
|
+
const result = await fs5.edit(
|
|
9341
9332
|
resolved,
|
|
9342
9333
|
params["oldText"],
|
|
9343
9334
|
params["newText"]
|
|
@@ -17528,13 +17519,13 @@ async function handlePostFileWrite(req, res, deps) {
|
|
|
17528
17519
|
req
|
|
17529
17520
|
);
|
|
17530
17521
|
if (originatorClientId === null) return;
|
|
17531
|
-
const
|
|
17522
|
+
const fs5 = factory.forRequest({
|
|
17532
17523
|
originatorClientId,
|
|
17533
17524
|
route: ROUTE2
|
|
17534
17525
|
});
|
|
17535
17526
|
try {
|
|
17536
|
-
const resolved = await
|
|
17537
|
-
const out = await
|
|
17527
|
+
const resolved = await fs5.resolve(queryPath, "write");
|
|
17528
|
+
const out = await fs5.writeTextAtomic(resolved, content, {
|
|
17538
17529
|
mode,
|
|
17539
17530
|
...expectedHash ? { expectedHash } : {},
|
|
17540
17531
|
...bom !== void 0 ? { bom } : {},
|
|
@@ -17587,13 +17578,13 @@ async function handlePostFileEdit(req, res, deps) {
|
|
|
17587
17578
|
req
|
|
17588
17579
|
);
|
|
17589
17580
|
if (originatorClientId === null) return;
|
|
17590
|
-
const
|
|
17581
|
+
const fs5 = factory.forRequest({
|
|
17591
17582
|
originatorClientId,
|
|
17592
17583
|
route: ROUTE2
|
|
17593
17584
|
});
|
|
17594
17585
|
try {
|
|
17595
|
-
const resolved = await
|
|
17596
|
-
const out = await
|
|
17586
|
+
const resolved = await fs5.resolve(queryPath, "edit");
|
|
17587
|
+
const out = await fs5.editAtomic(resolved, oldText, newText, {
|
|
17597
17588
|
expectedHash
|
|
17598
17589
|
});
|
|
17599
17590
|
applyReadHeaders(res);
|
|
@@ -17921,18 +17912,6 @@ var legacySessionTelemetryRoutes = [
|
|
|
17921
17912
|
attribution: "handler_resolved",
|
|
17922
17913
|
route: "GET /session/:id/tasks"
|
|
17923
17914
|
},
|
|
17924
|
-
{
|
|
17925
|
-
method: "GET",
|
|
17926
|
-
path: "/session/:id/subagents/:toolCallId",
|
|
17927
|
-
attribution: "handler_resolved",
|
|
17928
|
-
route: "GET /session/:id/subagents/:toolCallId"
|
|
17929
|
-
},
|
|
17930
|
-
{
|
|
17931
|
-
method: "POST",
|
|
17932
|
-
path: "/session/:id/subagents/:toolCallId/cancel",
|
|
17933
|
-
attribution: "handler_resolved",
|
|
17934
|
-
route: "POST /session/:id/subagents/:toolCallId/cancel"
|
|
17935
|
-
},
|
|
17936
17915
|
{
|
|
17937
17916
|
method: "GET",
|
|
17938
17917
|
path: "/session/:id/lsp",
|
|
@@ -18615,7 +18594,7 @@ __name(registerPermissionRoutes, "registerPermissionRoutes");
|
|
|
18615
18594
|
// packages/cli/src/serve/routes/session.ts
|
|
18616
18595
|
init_esbuild_shims();
|
|
18617
18596
|
import * as crypto3 from "node:crypto";
|
|
18618
|
-
import * as
|
|
18597
|
+
import * as fs3 from "node:fs";
|
|
18619
18598
|
import * as path10 from "node:path";
|
|
18620
18599
|
|
|
18621
18600
|
// packages/cli/src/serve/server/prompt-deadline.ts
|
|
@@ -19221,714 +19200,6 @@ async function exportSessionTranscript(params) {
|
|
|
19221
19200
|
}
|
|
19222
19201
|
__name(exportSessionTranscript, "exportSessionTranscript");
|
|
19223
19202
|
|
|
19224
|
-
// packages/cli/src/serve/virtual-subagent-sessions.ts
|
|
19225
|
-
init_esbuild_shims();
|
|
19226
|
-
import * as fs3 from "node:fs/promises";
|
|
19227
|
-
import { createReadStream } from "node:fs";
|
|
19228
|
-
import readline from "node:readline";
|
|
19229
|
-
var PREFIX = "subagent.";
|
|
19230
|
-
var POLL_INTERVAL_MS = 250;
|
|
19231
|
-
var TARGET_RETENTION_MS = 6e4;
|
|
19232
|
-
async function readFirstUserText(filePath) {
|
|
19233
|
-
const stream = createReadStream(filePath);
|
|
19234
|
-
const lines = readline.createInterface({
|
|
19235
|
-
input: stream,
|
|
19236
|
-
crlfDelay: Infinity
|
|
19237
|
-
});
|
|
19238
|
-
try {
|
|
19239
|
-
for await (const line of lines) {
|
|
19240
|
-
const trimmed = line.trim();
|
|
19241
|
-
if (!trimmed) continue;
|
|
19242
|
-
for (const record of parseLineTolerant(trimmed, filePath)) {
|
|
19243
|
-
if (record.type !== "user") continue;
|
|
19244
|
-
return record.message?.parts?.find(
|
|
19245
|
-
(part) => typeof part.text === "string"
|
|
19246
|
-
)?.text;
|
|
19247
|
-
}
|
|
19248
|
-
}
|
|
19249
|
-
return void 0;
|
|
19250
|
-
} catch (error2) {
|
|
19251
|
-
if (error2.code === "ENOENT") return void 0;
|
|
19252
|
-
throw error2;
|
|
19253
|
-
} finally {
|
|
19254
|
-
lines.close();
|
|
19255
|
-
stream.destroy();
|
|
19256
|
-
}
|
|
19257
|
-
}
|
|
19258
|
-
__name(readFirstUserText, "readFirstUserText");
|
|
19259
|
-
function asRecord(value) {
|
|
19260
|
-
return typeof value === "object" && value !== null ? value : void 0;
|
|
19261
|
-
}
|
|
19262
|
-
__name(asRecord, "asRecord");
|
|
19263
|
-
function finiteNonNegative(value) {
|
|
19264
|
-
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : void 0;
|
|
19265
|
-
}
|
|
19266
|
-
__name(finiteNonNegative, "finiteNonNegative");
|
|
19267
|
-
function normalizeTaskStatus(status) {
|
|
19268
|
-
if (typeof status !== "string") return void 0;
|
|
19269
|
-
if (status === "success") return "completed";
|
|
19270
|
-
if (status === "error") return "failed";
|
|
19271
|
-
if (status === "background") return "running";
|
|
19272
|
-
return status;
|
|
19273
|
-
}
|
|
19274
|
-
__name(normalizeTaskStatus, "normalizeTaskStatus");
|
|
19275
|
-
function durationBetween(start, end) {
|
|
19276
|
-
if (!end) return void 0;
|
|
19277
|
-
const startTime = Date.parse(start);
|
|
19278
|
-
const endTime = Date.parse(end);
|
|
19279
|
-
return Number.isFinite(startTime) && Number.isFinite(endTime) ? Math.max(0, endTime - startTime) : void 0;
|
|
19280
|
-
}
|
|
19281
|
-
__name(durationBetween, "durationBetween");
|
|
19282
|
-
function findToolCallMetrics(records, toolCallId) {
|
|
19283
|
-
const toolResult = records.find(
|
|
19284
|
-
(record) => record.toolCallResult?.callId === toolCallId
|
|
19285
|
-
)?.toolCallResult;
|
|
19286
|
-
const display = asRecord(toolResult?.resultDisplay);
|
|
19287
|
-
const summary = asRecord(display?.["executionSummary"]);
|
|
19288
|
-
return {
|
|
19289
|
-
status: normalizeTaskStatus(display?.["status"]) ?? normalizeTaskStatus(toolResult?.status),
|
|
19290
|
-
durationMs: finiteNonNegative(summary?.["totalDurationMs"]),
|
|
19291
|
-
totalTokens: finiteNonNegative(summary?.["totalTokens"]) ?? finiteNonNegative(display?.["tokenCount"]),
|
|
19292
|
-
inputTokens: finiteNonNegative(summary?.["inputTokens"]),
|
|
19293
|
-
outputTokens: finiteNonNegative(summary?.["outputTokens"]),
|
|
19294
|
-
cachedTokens: finiteNonNegative(summary?.["cachedTokens"])
|
|
19295
|
-
};
|
|
19296
|
-
}
|
|
19297
|
-
__name(findToolCallMetrics, "findToolCallMetrics");
|
|
19298
|
-
function encodePart(value) {
|
|
19299
|
-
return Buffer.from(value, "utf8").toString("base64url");
|
|
19300
|
-
}
|
|
19301
|
-
__name(encodePart, "encodePart");
|
|
19302
|
-
function decodePart(value) {
|
|
19303
|
-
try {
|
|
19304
|
-
return Buffer.from(value, "base64url").toString("utf8");
|
|
19305
|
-
} catch {
|
|
19306
|
-
return void 0;
|
|
19307
|
-
}
|
|
19308
|
-
}
|
|
19309
|
-
__name(decodePart, "decodePart");
|
|
19310
|
-
function isValidVirtualSessionPart(value) {
|
|
19311
|
-
return /^[a-zA-Z0-9_-]{1,500}$/.test(value);
|
|
19312
|
-
}
|
|
19313
|
-
__name(isValidVirtualSessionPart, "isValidVirtualSessionPart");
|
|
19314
|
-
function createVirtualSubagentSessionId(parentSessionId, agentId) {
|
|
19315
|
-
if (!isValidVirtualSessionPart(parentSessionId) || !isValidVirtualSessionPart(agentId)) {
|
|
19316
|
-
throw new Error("Virtual subagent session ids require valid id parts");
|
|
19317
|
-
}
|
|
19318
|
-
return `${PREFIX}${encodePart(parentSessionId)}.${encodePart(agentId)}`;
|
|
19319
|
-
}
|
|
19320
|
-
__name(createVirtualSubagentSessionId, "createVirtualSubagentSessionId");
|
|
19321
|
-
function parseVirtualSubagentSessionId(sessionId) {
|
|
19322
|
-
if (!sessionId.startsWith(PREFIX) || sessionId.length > 2e3) {
|
|
19323
|
-
return void 0;
|
|
19324
|
-
}
|
|
19325
|
-
const parts = sessionId.slice(PREFIX.length).split(".");
|
|
19326
|
-
if (parts.length !== 2) return void 0;
|
|
19327
|
-
const parentSessionId = decodePart(parts[0]);
|
|
19328
|
-
const agentId = decodePart(parts[1]);
|
|
19329
|
-
if (!parentSessionId || !agentId || !isValidVirtualSessionPart(parentSessionId) || !isValidVirtualSessionPart(agentId)) {
|
|
19330
|
-
return void 0;
|
|
19331
|
-
}
|
|
19332
|
-
return { parentSessionId, agentId };
|
|
19333
|
-
}
|
|
19334
|
-
__name(parseVirtualSubagentSessionId, "parseVirtualSubagentSessionId");
|
|
19335
|
-
function replayCursorState(sessionId, position, leafUuid, startTime, lastUpdated) {
|
|
19336
|
-
return {
|
|
19337
|
-
v: 1,
|
|
19338
|
-
sessionId,
|
|
19339
|
-
fileIdentity: { dev: 0, ino: 0 },
|
|
19340
|
-
snapshotSize: position,
|
|
19341
|
-
position,
|
|
19342
|
-
leafUuid,
|
|
19343
|
-
startTime,
|
|
19344
|
-
lastUpdated
|
|
19345
|
-
};
|
|
19346
|
-
}
|
|
19347
|
-
__name(replayCursorState, "replayCursorState");
|
|
19348
|
-
var VirtualSubagentTarget = class _VirtualSubagentTarget {
|
|
19349
|
-
constructor(sessionId, parentSessionId, task, workspaceCwd, onExpired) {
|
|
19350
|
-
this.sessionId = sessionId;
|
|
19351
|
-
this.parentSessionId = parentSessionId;
|
|
19352
|
-
this.task = task;
|
|
19353
|
-
this.workspaceCwd = workspaceCwd;
|
|
19354
|
-
this.onExpired = onExpired;
|
|
19355
|
-
}
|
|
19356
|
-
static {
|
|
19357
|
-
__name(this, "VirtualSubagentTarget");
|
|
19358
|
-
}
|
|
19359
|
-
bus = new EventBus(1024, 8);
|
|
19360
|
-
events = [];
|
|
19361
|
-
snapshotDelivered = false;
|
|
19362
|
-
offset = 0;
|
|
19363
|
-
transcriptIdentity;
|
|
19364
|
-
streamOffset = 0;
|
|
19365
|
-
streamIdentity;
|
|
19366
|
-
streamReady = false;
|
|
19367
|
-
canonicalThroughTimestamp = 0;
|
|
19368
|
-
completedStreamRounds = /* @__PURE__ */ new Set();
|
|
19369
|
-
streamedRounds = /* @__PURE__ */ new Set();
|
|
19370
|
-
streamRunIds = /* @__PURE__ */ new Set();
|
|
19371
|
-
legacyStreamedSinceCanonical = false;
|
|
19372
|
-
replayState;
|
|
19373
|
-
initialized = false;
|
|
19374
|
-
refreshPromise = Promise.resolve();
|
|
19375
|
-
snapshotPromise = Promise.resolve();
|
|
19376
|
-
pollTimer;
|
|
19377
|
-
subscribers = 0;
|
|
19378
|
-
retentionTimer;
|
|
19379
|
-
updateStatus(status) {
|
|
19380
|
-
const wasRunning = this.task.status === "running";
|
|
19381
|
-
this.task.status = status;
|
|
19382
|
-
if (status !== "running" && this.pollTimer) {
|
|
19383
|
-
clearInterval(this.pollTimer);
|
|
19384
|
-
this.pollTimer = void 0;
|
|
19385
|
-
}
|
|
19386
|
-
if (wasRunning && status !== "running") {
|
|
19387
|
-
void this.refreshLive().catch(() => void 0);
|
|
19388
|
-
}
|
|
19389
|
-
}
|
|
19390
|
-
rememberEvent(event) {
|
|
19391
|
-
if (event && !this.snapshotDelivered) this.events.push(event);
|
|
19392
|
-
}
|
|
19393
|
-
resetCanonicalState() {
|
|
19394
|
-
this.offset = 0;
|
|
19395
|
-
this.replayState = void 0;
|
|
19396
|
-
this.canonicalThroughTimestamp = 0;
|
|
19397
|
-
this.completedStreamRounds.clear();
|
|
19398
|
-
this.streamRunIds.clear();
|
|
19399
|
-
this.streamedRounds.clear();
|
|
19400
|
-
this.legacyStreamedSinceCanonical = false;
|
|
19401
|
-
}
|
|
19402
|
-
resetStreamState() {
|
|
19403
|
-
this.streamOffset = 0;
|
|
19404
|
-
this.completedStreamRounds.clear();
|
|
19405
|
-
this.streamRunIds.clear();
|
|
19406
|
-
this.streamedRounds.clear();
|
|
19407
|
-
this.legacyStreamedSinceCanonical = false;
|
|
19408
|
-
}
|
|
19409
|
-
async readNewRecords(endOffset) {
|
|
19410
|
-
let handle;
|
|
19411
|
-
try {
|
|
19412
|
-
handle = await fs3.open(this.task.outputFile, "r");
|
|
19413
|
-
const stat3 = await handle.stat();
|
|
19414
|
-
const identity = `${stat3.dev}:${stat3.ino}`;
|
|
19415
|
-
if (this.transcriptIdentity !== void 0 && this.transcriptIdentity !== identity || stat3.size < this.offset) {
|
|
19416
|
-
this.resetCanonicalState();
|
|
19417
|
-
}
|
|
19418
|
-
this.transcriptIdentity = identity;
|
|
19419
|
-
const size = Math.min(stat3.size, endOffset ?? stat3.size);
|
|
19420
|
-
if (size <= this.offset) return [];
|
|
19421
|
-
const bytes = Buffer.alloc(size - this.offset);
|
|
19422
|
-
const { bytesRead } = await handle.read(
|
|
19423
|
-
bytes,
|
|
19424
|
-
0,
|
|
19425
|
-
bytes.length,
|
|
19426
|
-
this.offset
|
|
19427
|
-
);
|
|
19428
|
-
const chunk = bytes.subarray(0, bytesRead);
|
|
19429
|
-
const lastNewline = chunk.lastIndexOf(10);
|
|
19430
|
-
if (lastNewline < 0) return [];
|
|
19431
|
-
const complete = chunk.subarray(0, lastNewline + 1);
|
|
19432
|
-
this.offset += complete.length;
|
|
19433
|
-
return complete.toString("utf8").split("\n").flatMap((line) => {
|
|
19434
|
-
const trimmed = line.trim();
|
|
19435
|
-
return trimmed ? parseLineTolerant(trimmed, this.task.outputFile) : [];
|
|
19436
|
-
});
|
|
19437
|
-
} catch (error2) {
|
|
19438
|
-
if (error2.code === "ENOENT") {
|
|
19439
|
-
if (this.transcriptIdentity !== void 0) {
|
|
19440
|
-
this.transcriptIdentity = void 0;
|
|
19441
|
-
this.resetCanonicalState();
|
|
19442
|
-
}
|
|
19443
|
-
return [];
|
|
19444
|
-
}
|
|
19445
|
-
throw error2;
|
|
19446
|
-
} finally {
|
|
19447
|
-
await handle?.close();
|
|
19448
|
-
}
|
|
19449
|
-
}
|
|
19450
|
-
async readStreamUpdates(endOffset) {
|
|
19451
|
-
const replayingExisting = !this.streamReady;
|
|
19452
|
-
this.streamReady = true;
|
|
19453
|
-
const filePath = `${this.task.outputFile}.stream`;
|
|
19454
|
-
let handle;
|
|
19455
|
-
try {
|
|
19456
|
-
handle = await fs3.open(filePath, "r");
|
|
19457
|
-
const stat3 = await handle.stat();
|
|
19458
|
-
const identity = `${stat3.dev}:${stat3.ino}`;
|
|
19459
|
-
if (this.streamIdentity !== void 0 && this.streamIdentity !== identity) {
|
|
19460
|
-
this.resetStreamState();
|
|
19461
|
-
}
|
|
19462
|
-
this.streamIdentity = identity;
|
|
19463
|
-
if (stat3.size < this.streamOffset) this.resetStreamState();
|
|
19464
|
-
const size = Math.min(stat3.size, endOffset ?? stat3.size);
|
|
19465
|
-
if (size <= this.streamOffset) return;
|
|
19466
|
-
const bytes = Buffer.alloc(size - this.streamOffset);
|
|
19467
|
-
const { bytesRead } = await handle.read(
|
|
19468
|
-
bytes,
|
|
19469
|
-
0,
|
|
19470
|
-
bytes.length,
|
|
19471
|
-
this.streamOffset
|
|
19472
|
-
);
|
|
19473
|
-
const chunk = bytes.subarray(0, bytesRead);
|
|
19474
|
-
const lastNewline = chunk.lastIndexOf(10);
|
|
19475
|
-
if (lastNewline < 0) return;
|
|
19476
|
-
const complete = chunk.subarray(0, lastNewline + 1);
|
|
19477
|
-
this.streamOffset += complete.length;
|
|
19478
|
-
const records = complete.toString("utf8").split("\n").flatMap((line) => {
|
|
19479
|
-
const trimmed = line.trim();
|
|
19480
|
-
return trimmed ? parseLineTolerant(trimmed, filePath) : [];
|
|
19481
|
-
});
|
|
19482
|
-
for (const record of records) {
|
|
19483
|
-
if (record.v !== 1 || typeof record.text !== "string" || typeof record.timestamp !== "number") {
|
|
19484
|
-
continue;
|
|
19485
|
-
}
|
|
19486
|
-
const roundKey = typeof record.runId === "string" && typeof record.round === "number" ? `${record.runId}:${record.round}` : void 0;
|
|
19487
|
-
if (typeof record.runId === "string") {
|
|
19488
|
-
this.streamRunIds.add(record.runId);
|
|
19489
|
-
}
|
|
19490
|
-
if ((roundKey ? this.completedStreamRounds.has(roundKey) : record.timestamp <= this.canonicalThroughTimestamp) || replayingExisting && typeof record.round !== "number") {
|
|
19491
|
-
continue;
|
|
19492
|
-
}
|
|
19493
|
-
const event = this.bus.publish({
|
|
19494
|
-
type: "session_update",
|
|
19495
|
-
data: createTranscriptMessageUpdate({
|
|
19496
|
-
role: "assistant",
|
|
19497
|
-
text: record.text,
|
|
19498
|
-
timestamp: record.timestamp,
|
|
19499
|
-
...record.thought ? { thought: true } : {}
|
|
19500
|
-
})
|
|
19501
|
-
});
|
|
19502
|
-
this.rememberEvent(event);
|
|
19503
|
-
if (roundKey) this.streamedRounds.add(roundKey);
|
|
19504
|
-
else this.legacyStreamedSinceCanonical = true;
|
|
19505
|
-
}
|
|
19506
|
-
for (const completed of this.completedStreamRounds) {
|
|
19507
|
-
const runId = completed.slice(0, completed.lastIndexOf(":"));
|
|
19508
|
-
if (!this.streamRunIds.has(runId)) {
|
|
19509
|
-
this.completedStreamRounds.delete(completed);
|
|
19510
|
-
}
|
|
19511
|
-
}
|
|
19512
|
-
} catch (error2) {
|
|
19513
|
-
if (error2.code !== "ENOENT") throw error2;
|
|
19514
|
-
this.streamIdentity = void 0;
|
|
19515
|
-
this.streamOffset = 0;
|
|
19516
|
-
this.streamRunIds.clear();
|
|
19517
|
-
this.streamedRounds.clear();
|
|
19518
|
-
this.legacyStreamedSinceCanonical = false;
|
|
19519
|
-
} finally {
|
|
19520
|
-
await handle?.close();
|
|
19521
|
-
}
|
|
19522
|
-
}
|
|
19523
|
-
refreshOnce = /* @__PURE__ */ __name(async (endOffset) => {
|
|
19524
|
-
let records = await this.readNewRecords(endOffset);
|
|
19525
|
-
if (records.length === 0) {
|
|
19526
|
-
this.initialized = true;
|
|
19527
|
-
return;
|
|
19528
|
-
}
|
|
19529
|
-
for (const record of records) {
|
|
19530
|
-
if (record.type === "assistant" && (record.usageMetadata !== void 0 || record.message?.parts?.some((part) => typeof part.text === "string"))) {
|
|
19531
|
-
if (typeof record.agentRunId === "string" && typeof record.agentRound === "number") {
|
|
19532
|
-
this.completedStreamRounds.add(
|
|
19533
|
-
`${record.agentRunId}:${record.agentRound}`
|
|
19534
|
-
);
|
|
19535
|
-
}
|
|
19536
|
-
const timestamp = Date.parse(record.timestamp);
|
|
19537
|
-
if (Number.isFinite(timestamp)) {
|
|
19538
|
-
this.canonicalThroughTimestamp = Math.max(
|
|
19539
|
-
this.canonicalThroughTimestamp,
|
|
19540
|
-
timestamp
|
|
19541
|
-
);
|
|
19542
|
-
}
|
|
19543
|
-
}
|
|
19544
|
-
}
|
|
19545
|
-
if (this.streamedRounds.size > 0 || this.legacyStreamedSinceCanonical) {
|
|
19546
|
-
records = records.filter((record) => {
|
|
19547
|
-
const roundKey = typeof record.agentRunId === "string" && typeof record.agentRound === "number" ? `${record.agentRunId}:${record.agentRound}` : void 0;
|
|
19548
|
-
if (roundKey && this.streamedRounds.delete(roundKey)) return false;
|
|
19549
|
-
if (!this.legacyStreamedSinceCanonical || record.type !== "assistant" || record.message?.parts?.some((part) => part.functionCall)) {
|
|
19550
|
-
return true;
|
|
19551
|
-
}
|
|
19552
|
-
this.legacyStreamedSinceCanonical = false;
|
|
19553
|
-
return false;
|
|
19554
|
-
});
|
|
19555
|
-
if (records.length === 0) {
|
|
19556
|
-
this.initialized = true;
|
|
19557
|
-
return;
|
|
19558
|
-
}
|
|
19559
|
-
}
|
|
19560
|
-
const startTime = records[0]?.timestamp ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
19561
|
-
const lastUpdated = records[records.length - 1]?.timestamp ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
19562
|
-
const page = {
|
|
19563
|
-
sessionId: this.sessionId,
|
|
19564
|
-
filePath: this.task.outputFile,
|
|
19565
|
-
records,
|
|
19566
|
-
gaps: [],
|
|
19567
|
-
hasMore: true,
|
|
19568
|
-
replay: this.replayState,
|
|
19569
|
-
startTime,
|
|
19570
|
-
lastUpdated,
|
|
19571
|
-
nextCursorState: replayCursorState(
|
|
19572
|
-
this.sessionId,
|
|
19573
|
-
this.offset,
|
|
19574
|
-
records[records.length - 1]?.uuid ?? "",
|
|
19575
|
-
startTime,
|
|
19576
|
-
lastUpdated
|
|
19577
|
-
)
|
|
19578
|
-
};
|
|
19579
|
-
let nextReplayState;
|
|
19580
|
-
const replay = await replayTranscriptRecordPage({
|
|
19581
|
-
sessionId: this.sessionId,
|
|
19582
|
-
page,
|
|
19583
|
-
encodeCursor: /* @__PURE__ */ __name((state) => {
|
|
19584
|
-
nextReplayState = state.replay;
|
|
19585
|
-
return "virtual-subagent-replay";
|
|
19586
|
-
}, "encodeCursor")
|
|
19587
|
-
});
|
|
19588
|
-
this.replayState = nextReplayState;
|
|
19589
|
-
const inputs = replay.updates.map((update) => ({
|
|
19590
|
-
type: "session_update",
|
|
19591
|
-
data: update
|
|
19592
|
-
}));
|
|
19593
|
-
const published = this.initialized ? inputs.flatMap((input) => {
|
|
19594
|
-
const event = this.bus.publish(input);
|
|
19595
|
-
return event ? [event] : [];
|
|
19596
|
-
}) : this.bus.seedReplayEvents(inputs);
|
|
19597
|
-
if (!this.snapshotDelivered) this.events.push(...published);
|
|
19598
|
-
this.initialized = true;
|
|
19599
|
-
}, "refreshOnce");
|
|
19600
|
-
refreshAt(bounds) {
|
|
19601
|
-
return this.refreshOnce(bounds?.transcript).then(async () => {
|
|
19602
|
-
if (this.task.status === "running") {
|
|
19603
|
-
await this.readStreamUpdates(bounds?.stream);
|
|
19604
|
-
}
|
|
19605
|
-
});
|
|
19606
|
-
}
|
|
19607
|
-
enqueueRefresh(work) {
|
|
19608
|
-
const result = this.refreshPromise.catch(() => void 0).then(work);
|
|
19609
|
-
this.refreshPromise = result.then(
|
|
19610
|
-
() => void 0,
|
|
19611
|
-
() => void 0
|
|
19612
|
-
);
|
|
19613
|
-
return result;
|
|
19614
|
-
}
|
|
19615
|
-
refreshLive() {
|
|
19616
|
-
return this.enqueueRefresh(() => this.refreshAt());
|
|
19617
|
-
}
|
|
19618
|
-
async captureReadBounds() {
|
|
19619
|
-
const size = /* @__PURE__ */ __name(async (filePath) => {
|
|
19620
|
-
try {
|
|
19621
|
-
return (await fs3.stat(filePath)).size;
|
|
19622
|
-
} catch (error2) {
|
|
19623
|
-
if (error2.code === "ENOENT") return 0;
|
|
19624
|
-
throw error2;
|
|
19625
|
-
}
|
|
19626
|
-
}, "size");
|
|
19627
|
-
const [transcript, stream] = await Promise.all([
|
|
19628
|
-
size(this.task.outputFile),
|
|
19629
|
-
size(`${this.task.outputFile}.stream`)
|
|
19630
|
-
]);
|
|
19631
|
-
return { transcript, stream };
|
|
19632
|
-
}
|
|
19633
|
-
async createSnapshotOnce() {
|
|
19634
|
-
if (!this.snapshotDelivered) {
|
|
19635
|
-
await this.refreshLive();
|
|
19636
|
-
const snapshot = [...this.events];
|
|
19637
|
-
this.events.length = 0;
|
|
19638
|
-
this.snapshotDelivered = true;
|
|
19639
|
-
return { events: snapshot, lastEventId: this.bus.lastEventId };
|
|
19640
|
-
}
|
|
19641
|
-
return this.enqueueRefresh(async () => {
|
|
19642
|
-
const bounds = await this.captureReadBounds();
|
|
19643
|
-
const target = new _VirtualSubagentTarget(
|
|
19644
|
-
this.sessionId,
|
|
19645
|
-
this.parentSessionId,
|
|
19646
|
-
this.task,
|
|
19647
|
-
this.workspaceCwd,
|
|
19648
|
-
() => void 0
|
|
19649
|
-
);
|
|
19650
|
-
await target.refreshAt(bounds);
|
|
19651
|
-
await this.refreshAt(bounds);
|
|
19652
|
-
return {
|
|
19653
|
-
events: [...target.events],
|
|
19654
|
-
lastEventId: this.bus.lastEventId
|
|
19655
|
-
};
|
|
19656
|
-
});
|
|
19657
|
-
}
|
|
19658
|
-
createSnapshot() {
|
|
19659
|
-
const snapshot = this.snapshotPromise.then(() => this.createSnapshotOnce());
|
|
19660
|
-
this.snapshotPromise = snapshot.then(
|
|
19661
|
-
() => void 0,
|
|
19662
|
-
() => void 0
|
|
19663
|
-
);
|
|
19664
|
-
return snapshot;
|
|
19665
|
-
}
|
|
19666
|
-
async load(clientId) {
|
|
19667
|
-
const snapshot = await this.createSnapshot();
|
|
19668
|
-
if (this.subscribers === 0) this.scheduleRetention();
|
|
19669
|
-
return {
|
|
19670
|
-
sessionId: this.sessionId,
|
|
19671
|
-
workspaceCwd: this.workspaceCwd,
|
|
19672
|
-
attached: true,
|
|
19673
|
-
...clientId ? { clientId } : {},
|
|
19674
|
-
createdAt: new Date(this.task.startTime).toISOString(),
|
|
19675
|
-
hasActivePrompt: this.task.status === "running",
|
|
19676
|
-
state: {},
|
|
19677
|
-
compactedReplay: snapshot.events,
|
|
19678
|
-
liveJournal: [],
|
|
19679
|
-
historyHasMore: false,
|
|
19680
|
-
lastEventId: snapshot.lastEventId
|
|
19681
|
-
};
|
|
19682
|
-
}
|
|
19683
|
-
async *iterate(opts) {
|
|
19684
|
-
if (this.retentionTimer) {
|
|
19685
|
-
clearTimeout(this.retentionTimer);
|
|
19686
|
-
this.retentionTimer = void 0;
|
|
19687
|
-
}
|
|
19688
|
-
this.subscribers++;
|
|
19689
|
-
try {
|
|
19690
|
-
await this.refreshLive();
|
|
19691
|
-
if (!this.snapshotDelivered) {
|
|
19692
|
-
this.events.length = 0;
|
|
19693
|
-
this.snapshotDelivered = true;
|
|
19694
|
-
}
|
|
19695
|
-
if (this.task.status === "running" && !this.pollTimer) {
|
|
19696
|
-
this.pollTimer = setInterval(() => {
|
|
19697
|
-
void this.refreshLive().catch(() => void 0);
|
|
19698
|
-
}, POLL_INTERVAL_MS);
|
|
19699
|
-
this.pollTimer.unref();
|
|
19700
|
-
}
|
|
19701
|
-
yield* this.bus.subscribe(opts);
|
|
19702
|
-
} finally {
|
|
19703
|
-
this.subscribers--;
|
|
19704
|
-
if (this.subscribers === 0) {
|
|
19705
|
-
if (this.pollTimer) clearInterval(this.pollTimer);
|
|
19706
|
-
this.pollTimer = void 0;
|
|
19707
|
-
this.scheduleRetention();
|
|
19708
|
-
}
|
|
19709
|
-
}
|
|
19710
|
-
}
|
|
19711
|
-
subscribe(opts) {
|
|
19712
|
-
return {
|
|
19713
|
-
[Symbol.asyncIterator]: () => this.iterate(opts)
|
|
19714
|
-
};
|
|
19715
|
-
}
|
|
19716
|
-
scheduleRetention() {
|
|
19717
|
-
if (this.retentionTimer) clearTimeout(this.retentionTimer);
|
|
19718
|
-
this.retentionTimer = setTimeout(this.onExpired, TARGET_RETENTION_MS);
|
|
19719
|
-
this.retentionTimer.unref();
|
|
19720
|
-
}
|
|
19721
|
-
};
|
|
19722
|
-
var VirtualSubagentSessions = class {
|
|
19723
|
-
static {
|
|
19724
|
-
__name(this, "VirtualSubagentSessions");
|
|
19725
|
-
}
|
|
19726
|
-
targets = /* @__PURE__ */ new Map();
|
|
19727
|
-
async findTask(runtime, parentSessionId, predicate) {
|
|
19728
|
-
const status = await runtime.bridge.getSessionTasksStatus(parentSessionId);
|
|
19729
|
-
const task = status.tasks.find(
|
|
19730
|
-
(candidate) => candidate.kind === "agent" && typeof candidate.outputFile === "string" && predicate(candidate)
|
|
19731
|
-
);
|
|
19732
|
-
if (task?.kind === "agent" && task.outputFile) {
|
|
19733
|
-
return {
|
|
19734
|
-
id: task.id,
|
|
19735
|
-
title: task.label,
|
|
19736
|
-
outputFile: task.outputFile,
|
|
19737
|
-
status: task.status,
|
|
19738
|
-
startTime: task.startTime,
|
|
19739
|
-
durationMs: task.stats?.durationMs ?? (task.endTime === void 0 ? void 0 : Math.max(0, task.endTime - task.startTime)),
|
|
19740
|
-
totalTokens: task.stats?.totalTokens
|
|
19741
|
-
};
|
|
19742
|
-
}
|
|
19743
|
-
const runtimeDir = runtime.env.effectiveEnv?.["QWEN_RUNTIME_DIR"];
|
|
19744
|
-
const projectDir = Storage.runWithRuntimeBaseDir(
|
|
19745
|
-
runtimeDir,
|
|
19746
|
-
runtime.workspaceCwd,
|
|
19747
|
-
() => new Storage(runtime.workspaceCwd).getProjectDir()
|
|
19748
|
-
);
|
|
19749
|
-
const sessionDir = getSubagentSessionDir(projectDir, parentSessionId);
|
|
19750
|
-
let names;
|
|
19751
|
-
try {
|
|
19752
|
-
names = await fs3.readdir(sessionDir);
|
|
19753
|
-
} catch (error2) {
|
|
19754
|
-
if (error2.code === "ENOENT") return void 0;
|
|
19755
|
-
throw error2;
|
|
19756
|
-
}
|
|
19757
|
-
for (const name of names) {
|
|
19758
|
-
if (!name.endsWith(".meta.json")) continue;
|
|
19759
|
-
const metaPath = `${sessionDir}/${name}`;
|
|
19760
|
-
const meta = readAgentMeta(metaPath);
|
|
19761
|
-
if (!meta || !predicate({
|
|
19762
|
-
kind: "agent",
|
|
19763
|
-
id: meta.agentId,
|
|
19764
|
-
toolUseId: meta.toolUseId,
|
|
19765
|
-
outputFile: metaPath.slice(0, -".meta.json".length) + ".jsonl"
|
|
19766
|
-
})) {
|
|
19767
|
-
continue;
|
|
19768
|
-
}
|
|
19769
|
-
return {
|
|
19770
|
-
id: meta.agentId,
|
|
19771
|
-
title: meta.description || meta.agentType,
|
|
19772
|
-
outputFile: metaPath.slice(0, -".meta.json".length) + ".jsonl",
|
|
19773
|
-
status: meta.status ?? "completed",
|
|
19774
|
-
startTime: Number.isFinite(Date.parse(meta.createdAt)) ? Date.parse(meta.createdAt) : Date.now(),
|
|
19775
|
-
durationMs: durationBetween(meta.createdAt, meta.lastUpdatedAt)
|
|
19776
|
-
};
|
|
19777
|
-
}
|
|
19778
|
-
return void 0;
|
|
19779
|
-
}
|
|
19780
|
-
async findLegacyTaskByToolCall(runtime, parentSessionId, toolCallId) {
|
|
19781
|
-
const runtimeDir = runtime.env.effectiveEnv?.["QWEN_RUNTIME_DIR"];
|
|
19782
|
-
const projectDir = Storage.runWithRuntimeBaseDir(
|
|
19783
|
-
runtimeDir,
|
|
19784
|
-
runtime.workspaceCwd,
|
|
19785
|
-
() => new Storage(runtime.workspaceCwd).getProjectDir()
|
|
19786
|
-
);
|
|
19787
|
-
const parentRecords = await read(
|
|
19788
|
-
`${projectDir}/chats/${parentSessionId}.jsonl`
|
|
19789
|
-
);
|
|
19790
|
-
let root;
|
|
19791
|
-
for (const record of parentRecords) {
|
|
19792
|
-
for (const part of record.message?.parts ?? []) {
|
|
19793
|
-
const call = part.functionCall;
|
|
19794
|
-
if (call?.id !== toolCallId || call.name !== "agent") continue;
|
|
19795
|
-
const args = call.args;
|
|
19796
|
-
root = {
|
|
19797
|
-
timestamp: Date.parse(record.timestamp),
|
|
19798
|
-
...typeof args?.["description"] === "string" ? { description: args["description"] } : {},
|
|
19799
|
-
...typeof args?.["prompt"] === "string" ? { prompt: args["prompt"] } : {},
|
|
19800
|
-
...typeof args?.["subagent_type"] === "string" ? { agentType: args["subagent_type"] } : {}
|
|
19801
|
-
};
|
|
19802
|
-
break;
|
|
19803
|
-
}
|
|
19804
|
-
if (root) break;
|
|
19805
|
-
}
|
|
19806
|
-
if (!root) return void 0;
|
|
19807
|
-
const sessionDir = getSubagentSessionDir(projectDir, parentSessionId);
|
|
19808
|
-
let names;
|
|
19809
|
-
try {
|
|
19810
|
-
names = await fs3.readdir(sessionDir);
|
|
19811
|
-
} catch (error2) {
|
|
19812
|
-
if (error2.code === "ENOENT") return void 0;
|
|
19813
|
-
throw error2;
|
|
19814
|
-
}
|
|
19815
|
-
const candidates = [];
|
|
19816
|
-
for (const name of names) {
|
|
19817
|
-
if (!name.endsWith(".meta.json")) continue;
|
|
19818
|
-
const metaPath = `${sessionDir}/${name}`;
|
|
19819
|
-
const meta = readAgentMeta(metaPath);
|
|
19820
|
-
if (!meta) continue;
|
|
19821
|
-
const outputFile = metaPath.slice(0, -".meta.json".length) + ".jsonl";
|
|
19822
|
-
const launchPrompt = await readFirstUserText(outputFile);
|
|
19823
|
-
let score = 0;
|
|
19824
|
-
if (root.prompt && launchPrompt === root.prompt) score += 8;
|
|
19825
|
-
if (root.description && meta.description === root.description) score += 4;
|
|
19826
|
-
if (root.agentType && meta.agentType === root.agentType) score += 2;
|
|
19827
|
-
const startTime = Date.parse(meta.createdAt);
|
|
19828
|
-
const delta = Math.abs(startTime - root.timestamp);
|
|
19829
|
-
if (Number.isFinite(delta) && delta <= 6e4) score += 1;
|
|
19830
|
-
if (score === 0) continue;
|
|
19831
|
-
candidates.push({
|
|
19832
|
-
id: meta.agentId,
|
|
19833
|
-
title: meta.description || meta.agentType,
|
|
19834
|
-
outputFile,
|
|
19835
|
-
status: meta.status ?? "completed",
|
|
19836
|
-
startTime: Number.isFinite(startTime) ? startTime : Date.now(),
|
|
19837
|
-
durationMs: durationBetween(meta.createdAt, meta.lastUpdatedAt),
|
|
19838
|
-
score,
|
|
19839
|
-
delta
|
|
19840
|
-
});
|
|
19841
|
-
}
|
|
19842
|
-
candidates.sort((a, b) => b.score - a.score || a.delta - b.delta);
|
|
19843
|
-
const selected = candidates[0];
|
|
19844
|
-
if (!selected) return void 0;
|
|
19845
|
-
const metrics = findToolCallMetrics(parentRecords, toolCallId);
|
|
19846
|
-
return {
|
|
19847
|
-
...selected,
|
|
19848
|
-
status: metrics.status ?? selected.status,
|
|
19849
|
-
durationMs: metrics.durationMs ?? selected.durationMs,
|
|
19850
|
-
totalTokens: metrics.totalTokens ?? selected.totalTokens,
|
|
19851
|
-
inputTokens: metrics.inputTokens ?? selected.inputTokens,
|
|
19852
|
-
outputTokens: metrics.outputTokens ?? selected.outputTokens,
|
|
19853
|
-
cachedTokens: metrics.cachedTokens ?? selected.cachedTokens
|
|
19854
|
-
};
|
|
19855
|
-
}
|
|
19856
|
-
async readParentToolCallMetrics(runtime, parentSessionId, toolCallId) {
|
|
19857
|
-
const runtimeDir = runtime.env.effectiveEnv?.["QWEN_RUNTIME_DIR"];
|
|
19858
|
-
const projectDir = Storage.runWithRuntimeBaseDir(
|
|
19859
|
-
runtimeDir,
|
|
19860
|
-
runtime.workspaceCwd,
|
|
19861
|
-
() => new Storage(runtime.workspaceCwd).getProjectDir()
|
|
19862
|
-
);
|
|
19863
|
-
const records = await read(
|
|
19864
|
-
`${projectDir}/chats/${parentSessionId}.jsonl`
|
|
19865
|
-
);
|
|
19866
|
-
return findToolCallMetrics(records, toolCallId);
|
|
19867
|
-
}
|
|
19868
|
-
async resolve(runtime, parentSessionId, toolCallId) {
|
|
19869
|
-
let task = await this.findTask(
|
|
19870
|
-
runtime,
|
|
19871
|
-
parentSessionId,
|
|
19872
|
-
(candidate) => candidate.toolUseId === toolCallId || candidate.id.endsWith(`-${toolCallId}`)
|
|
19873
|
-
);
|
|
19874
|
-
const metrics = task && task.status !== "running" ? await this.readParentToolCallMetrics(
|
|
19875
|
-
runtime,
|
|
19876
|
-
parentSessionId,
|
|
19877
|
-
toolCallId
|
|
19878
|
-
) : void 0;
|
|
19879
|
-
task ??= await this.findLegacyTaskByToolCall(
|
|
19880
|
-
runtime,
|
|
19881
|
-
parentSessionId,
|
|
19882
|
-
toolCallId
|
|
19883
|
-
);
|
|
19884
|
-
if (!task) return void 0;
|
|
19885
|
-
const sessionId = createVirtualSubagentSessionId(parentSessionId, task.id);
|
|
19886
|
-
const status = task.status;
|
|
19887
|
-
this.targets.get(`${runtime.workspaceId}:${sessionId}`)?.updateStatus(status);
|
|
19888
|
-
return {
|
|
19889
|
-
sessionId,
|
|
19890
|
-
taskId: task.id,
|
|
19891
|
-
title: task.title,
|
|
19892
|
-
status,
|
|
19893
|
-
durationMs: metrics?.durationMs ?? task.durationMs,
|
|
19894
|
-
totalTokens: metrics?.totalTokens ?? task.totalTokens,
|
|
19895
|
-
inputTokens: metrics?.inputTokens ?? task.inputTokens,
|
|
19896
|
-
outputTokens: metrics?.outputTokens ?? task.outputTokens,
|
|
19897
|
-
cachedTokens: metrics?.cachedTokens ?? task.cachedTokens
|
|
19898
|
-
};
|
|
19899
|
-
}
|
|
19900
|
-
async getTarget(runtime, sessionId) {
|
|
19901
|
-
const targetKey = `${runtime.workspaceId}:${sessionId}`;
|
|
19902
|
-
const cached = this.targets.get(targetKey);
|
|
19903
|
-
if (cached) return cached;
|
|
19904
|
-
const key = parseVirtualSubagentSessionId(sessionId);
|
|
19905
|
-
if (!key) return void 0;
|
|
19906
|
-
const task = await this.findTask(
|
|
19907
|
-
runtime,
|
|
19908
|
-
key.parentSessionId,
|
|
19909
|
-
(candidate) => candidate.id === key.agentId
|
|
19910
|
-
);
|
|
19911
|
-
if (!task) return void 0;
|
|
19912
|
-
const existing = this.targets.get(targetKey);
|
|
19913
|
-
if (existing) return existing;
|
|
19914
|
-
const target = new VirtualSubagentTarget(
|
|
19915
|
-
sessionId,
|
|
19916
|
-
key.parentSessionId,
|
|
19917
|
-
task,
|
|
19918
|
-
runtime.workspaceCwd,
|
|
19919
|
-
() => this.targets.delete(targetKey)
|
|
19920
|
-
);
|
|
19921
|
-
this.targets.set(targetKey, target);
|
|
19922
|
-
return target;
|
|
19923
|
-
}
|
|
19924
|
-
async load(runtime, sessionId, clientId) {
|
|
19925
|
-
return (await this.getTarget(runtime, sessionId))?.load(clientId);
|
|
19926
|
-
}
|
|
19927
|
-
async subscribe(runtime, sessionId, opts) {
|
|
19928
|
-
return (await this.getTarget(runtime, sessionId))?.subscribe(opts);
|
|
19929
|
-
}
|
|
19930
|
-
};
|
|
19931
|
-
|
|
19932
19203
|
// packages/cli/src/serve/routes/session.ts
|
|
19933
19204
|
var WORKSPACE_TRANSCRIPT_RESPONSE_MAX_BYTES = 32 * 1024 * 1024;
|
|
19934
19205
|
var WORKSPACE_TRANSCRIPT_CURSOR_MAX_BYTES = 64 * 1024;
|
|
@@ -19991,8 +19262,8 @@ function isReadOnlyWorkspaceInspection(runtime) {
|
|
|
19991
19262
|
return !runtime.primary && !runtime.trusted;
|
|
19992
19263
|
}
|
|
19993
19264
|
__name(isReadOnlyWorkspaceInspection, "isReadOnlyWorkspaceInspection");
|
|
19994
|
-
function runWorkspaceInspectionWithLogPolicy(runtime,
|
|
19995
|
-
return isReadOnlyWorkspaceInspection(runtime) ? runWithoutDebugLogSession(
|
|
19265
|
+
function runWorkspaceInspectionWithLogPolicy(runtime, read) {
|
|
19266
|
+
return isReadOnlyWorkspaceInspection(runtime) ? runWithoutDebugLogSession(read) : read();
|
|
19996
19267
|
}
|
|
19997
19268
|
__name(runWorkspaceInspectionWithLogPolicy, "runWorkspaceInspectionWithLogPolicy");
|
|
19998
19269
|
function requireSessionArtifactClientId(clientId, res) {
|
|
@@ -20155,8 +19426,7 @@ function registerSessionRoutes(app, deps) {
|
|
|
20155
19426
|
sendBridgeError: sendBridgeError2,
|
|
20156
19427
|
daemonLog,
|
|
20157
19428
|
promptDeadlineMs,
|
|
20158
|
-
sessionShellCommandEnabled
|
|
20159
|
-
virtualSubagentSessions
|
|
19429
|
+
sessionShellCommandEnabled
|
|
20160
19430
|
} = deps;
|
|
20161
19431
|
const LANGUAGE_CODES = deps.languageCodes;
|
|
20162
19432
|
const transcriptCursorMasterKey = crypto3.randomBytes(32);
|
|
@@ -20925,55 +20195,6 @@ function registerSessionRoutes(app, deps) {
|
|
|
20925
20195
|
const restoreSessionHandler = /* @__PURE__ */ __name((action) => async (req, res) => {
|
|
20926
20196
|
const sessionId = requireSessionId(req, res);
|
|
20927
20197
|
if (!sessionId) return;
|
|
20928
|
-
const virtualKey = parseVirtualSubagentSessionId(sessionId);
|
|
20929
|
-
if (virtualKey) {
|
|
20930
|
-
const route2 = `POST /session/:id/${action}`;
|
|
20931
|
-
if (action !== "load") {
|
|
20932
|
-
res.status(400).json({
|
|
20933
|
-
error: `Virtual subagent sessions do not support ${action}`,
|
|
20934
|
-
code: "unsupported_action",
|
|
20935
|
-
sessionId
|
|
20936
|
-
});
|
|
20937
|
-
return;
|
|
20938
|
-
}
|
|
20939
|
-
if (!virtualSubagentSessions) {
|
|
20940
|
-
res.status(404).json({
|
|
20941
|
-
error: `No session with id "${sessionId}"`,
|
|
20942
|
-
code: "session_not_found",
|
|
20943
|
-
sessionId
|
|
20944
|
-
});
|
|
20945
|
-
return;
|
|
20946
|
-
}
|
|
20947
|
-
const runtime2 = requireSessionRuntime({
|
|
20948
|
-
sessionId: virtualKey.parentSessionId,
|
|
20949
|
-
route: route2,
|
|
20950
|
-
res,
|
|
20951
|
-
workspaceRegistry,
|
|
20952
|
-
daemonLog
|
|
20953
|
-
});
|
|
20954
|
-
if (!runtime2) return;
|
|
20955
|
-
const clientId2 = parseClientIdHeader(req, res);
|
|
20956
|
-
if (clientId2 === null) return;
|
|
20957
|
-
try {
|
|
20958
|
-
const session = await virtualSubagentSessions.load(
|
|
20959
|
-
runtime2,
|
|
20960
|
-
sessionId,
|
|
20961
|
-
clientId2
|
|
20962
|
-
);
|
|
20963
|
-
if (!session) {
|
|
20964
|
-
res.status(404).json({
|
|
20965
|
-
error: "Subagent session not found",
|
|
20966
|
-
code: "session_not_found",
|
|
20967
|
-
sessionId
|
|
20968
|
-
});
|
|
20969
|
-
return;
|
|
20970
|
-
}
|
|
20971
|
-
res.status(200).json(session);
|
|
20972
|
-
} catch (err) {
|
|
20973
|
-
sendBridgeError2(res, err, { route: route2, sessionId });
|
|
20974
|
-
}
|
|
20975
|
-
return;
|
|
20976
|
-
}
|
|
20977
20198
|
const body = safeBody(req);
|
|
20978
20199
|
const route = `POST /session/:id/${action}`;
|
|
20979
20200
|
let resolvedRuntime;
|
|
@@ -21063,7 +20284,7 @@ function registerSessionRoutes(app, deps) {
|
|
|
21063
20284
|
path10.join(workspaceCwd, ".qwen", "worktrees")
|
|
21064
20285
|
];
|
|
21065
20286
|
try {
|
|
21066
|
-
realTarget =
|
|
20287
|
+
realTarget = fs3.realpathSync(sidecar.worktreePath);
|
|
21067
20288
|
let repoTop = null;
|
|
21068
20289
|
try {
|
|
21069
20290
|
repoTop = await new GitWorktreeService(
|
|
@@ -21076,7 +20297,7 @@ function registerSessionRoutes(app, deps) {
|
|
|
21076
20297
|
}
|
|
21077
20298
|
const contained = candidateRoots.some((root) => {
|
|
21078
20299
|
try {
|
|
21079
|
-
const realRoot =
|
|
20300
|
+
const realRoot = fs3.realpathSync(root);
|
|
21080
20301
|
const rel = path10.relative(realRoot, realTarget);
|
|
21081
20302
|
return !rel.startsWith("..") && !path10.isAbsolute(rel);
|
|
21082
20303
|
} catch {
|
|
@@ -21131,112 +20352,6 @@ function registerSessionRoutes(app, deps) {
|
|
|
21131
20352
|
}, "restoreSessionHandler");
|
|
21132
20353
|
app.post("/session/:id/load", mutate(), restoreSessionHandler("load"));
|
|
21133
20354
|
app.post("/session/:id/resume", mutate(), restoreSessionHandler("resume"));
|
|
21134
|
-
app.get("/session/:id/subagents/:toolCallId", async (req, res) => {
|
|
21135
|
-
const route = "GET /session/:id/subagents/:toolCallId";
|
|
21136
|
-
const sessionId = requireSessionId(req, res);
|
|
21137
|
-
if (!sessionId) return;
|
|
21138
|
-
if (!virtualSubagentSessions) {
|
|
21139
|
-
res.status(404).json({
|
|
21140
|
-
error: `No session with id "${sessionId}"`,
|
|
21141
|
-
code: "session_not_found",
|
|
21142
|
-
sessionId
|
|
21143
|
-
});
|
|
21144
|
-
return;
|
|
21145
|
-
}
|
|
21146
|
-
const toolCallId = req.params["toolCallId"];
|
|
21147
|
-
if (!toolCallId || toolCallId.length > 500) {
|
|
21148
|
-
res.status(400).json({
|
|
21149
|
-
error: "`toolCallId` must be a non-empty tool call id",
|
|
21150
|
-
code: "invalid_tool_call_id"
|
|
21151
|
-
});
|
|
21152
|
-
return;
|
|
21153
|
-
}
|
|
21154
|
-
const runtime = requireSessionRuntime({
|
|
21155
|
-
sessionId,
|
|
21156
|
-
route,
|
|
21157
|
-
res,
|
|
21158
|
-
workspaceRegistry,
|
|
21159
|
-
daemonLog
|
|
21160
|
-
});
|
|
21161
|
-
if (!runtime) return;
|
|
21162
|
-
try {
|
|
21163
|
-
const resolved = await virtualSubagentSessions.resolve(
|
|
21164
|
-
runtime,
|
|
21165
|
-
sessionId,
|
|
21166
|
-
toolCallId
|
|
21167
|
-
);
|
|
21168
|
-
if (!resolved) {
|
|
21169
|
-
res.status(404).json({
|
|
21170
|
-
error: "Subagent session not found",
|
|
21171
|
-
code: "session_not_found",
|
|
21172
|
-
sessionId,
|
|
21173
|
-
toolCallId
|
|
21174
|
-
});
|
|
21175
|
-
return;
|
|
21176
|
-
}
|
|
21177
|
-
res.status(200).set("Cache-Control", "no-store").json(resolved);
|
|
21178
|
-
} catch (err) {
|
|
21179
|
-
sendBridgeError2(res, err, { route, sessionId });
|
|
21180
|
-
}
|
|
21181
|
-
});
|
|
21182
|
-
app.post(
|
|
21183
|
-
"/session/:id/subagents/:toolCallId/cancel",
|
|
21184
|
-
mutate(),
|
|
21185
|
-
async (req, res) => {
|
|
21186
|
-
const route = "POST /session/:id/subagents/:toolCallId/cancel";
|
|
21187
|
-
const sessionId = requireSessionId(req, res);
|
|
21188
|
-
if (!sessionId) return;
|
|
21189
|
-
if (!virtualSubagentSessions) {
|
|
21190
|
-
res.status(404).json({
|
|
21191
|
-
error: `No session with id "${sessionId}"`,
|
|
21192
|
-
code: "session_not_found",
|
|
21193
|
-
sessionId
|
|
21194
|
-
});
|
|
21195
|
-
return;
|
|
21196
|
-
}
|
|
21197
|
-
const toolCallId = req.params["toolCallId"];
|
|
21198
|
-
if (!toolCallId || toolCallId.length > 500) {
|
|
21199
|
-
res.status(400).json({
|
|
21200
|
-
error: "`toolCallId` must be a non-empty tool call id",
|
|
21201
|
-
code: "invalid_tool_call_id"
|
|
21202
|
-
});
|
|
21203
|
-
return;
|
|
21204
|
-
}
|
|
21205
|
-
const runtime = requireSessionRuntime({
|
|
21206
|
-
sessionId,
|
|
21207
|
-
route,
|
|
21208
|
-
res,
|
|
21209
|
-
workspaceRegistry,
|
|
21210
|
-
daemonLog
|
|
21211
|
-
});
|
|
21212
|
-
if (!runtime) return;
|
|
21213
|
-
try {
|
|
21214
|
-
const resolved = await virtualSubagentSessions.resolve(
|
|
21215
|
-
runtime,
|
|
21216
|
-
sessionId,
|
|
21217
|
-
toolCallId
|
|
21218
|
-
);
|
|
21219
|
-
if (!resolved) {
|
|
21220
|
-
res.status(404).json({
|
|
21221
|
-
error: "Subagent session not found",
|
|
21222
|
-
code: "session_not_found",
|
|
21223
|
-
sessionId,
|
|
21224
|
-
toolCallId
|
|
21225
|
-
});
|
|
21226
|
-
return;
|
|
21227
|
-
}
|
|
21228
|
-
res.status(200).json(
|
|
21229
|
-
await runtime.bridge.cancelSessionTask(
|
|
21230
|
-
sessionId,
|
|
21231
|
-
resolved.taskId,
|
|
21232
|
-
"agent"
|
|
21233
|
-
)
|
|
21234
|
-
);
|
|
21235
|
-
} catch (err) {
|
|
21236
|
-
sendBridgeError2(res, err, { route, sessionId });
|
|
21237
|
-
}
|
|
21238
|
-
}
|
|
21239
|
-
);
|
|
21240
20355
|
app.post(
|
|
21241
20356
|
"/session/:id/branch",
|
|
21242
20357
|
mutate(),
|
|
@@ -21536,28 +20651,6 @@ function registerSessionRoutes(app, deps) {
|
|
|
21536
20651
|
});
|
|
21537
20652
|
app.get(
|
|
21538
20653
|
"/session/:id/context",
|
|
21539
|
-
(req, res, next) => {
|
|
21540
|
-
const sessionId = req.params["id"];
|
|
21541
|
-
const key = sessionId ? parseVirtualSubagentSessionId(sessionId) : void 0;
|
|
21542
|
-
if (!sessionId || !key) {
|
|
21543
|
-
next();
|
|
21544
|
-
return;
|
|
21545
|
-
}
|
|
21546
|
-
const runtime = requireSessionRuntime({
|
|
21547
|
-
sessionId: key.parentSessionId,
|
|
21548
|
-
route: "GET /session/:id/context",
|
|
21549
|
-
res,
|
|
21550
|
-
workspaceRegistry,
|
|
21551
|
-
daemonLog
|
|
21552
|
-
});
|
|
21553
|
-
if (!runtime) return;
|
|
21554
|
-
res.status(200).json({
|
|
21555
|
-
v: 1,
|
|
21556
|
-
sessionId,
|
|
21557
|
-
workspaceCwd: runtime.workspaceCwd,
|
|
21558
|
-
state: {}
|
|
21559
|
-
});
|
|
21560
|
-
},
|
|
21561
20654
|
withOwnerReadSession(
|
|
21562
20655
|
"GET /session/:id/context",
|
|
21563
20656
|
async (_req, res, sessionId, runtime) => {
|
|
@@ -21589,28 +20682,6 @@ function registerSessionRoutes(app, deps) {
|
|
|
21589
20682
|
);
|
|
21590
20683
|
app.get(
|
|
21591
20684
|
"/session/:id/supported-commands",
|
|
21592
|
-
(req, res, next) => {
|
|
21593
|
-
const sessionId = req.params["id"];
|
|
21594
|
-
const key = sessionId ? parseVirtualSubagentSessionId(sessionId) : void 0;
|
|
21595
|
-
if (!sessionId || !key) {
|
|
21596
|
-
next();
|
|
21597
|
-
return;
|
|
21598
|
-
}
|
|
21599
|
-
const runtime = requireSessionRuntime({
|
|
21600
|
-
sessionId: key.parentSessionId,
|
|
21601
|
-
route: "GET /session/:id/supported-commands",
|
|
21602
|
-
res,
|
|
21603
|
-
workspaceRegistry,
|
|
21604
|
-
daemonLog
|
|
21605
|
-
});
|
|
21606
|
-
if (!runtime) return;
|
|
21607
|
-
res.status(200).json({
|
|
21608
|
-
v: 1,
|
|
21609
|
-
sessionId,
|
|
21610
|
-
availableCommands: [],
|
|
21611
|
-
availableSkills: []
|
|
21612
|
-
});
|
|
21613
|
-
},
|
|
21614
20685
|
withOwnerReadSession(
|
|
21615
20686
|
"GET /session/:id/supported-commands",
|
|
21616
20687
|
async (_req, res, sessionId, runtime) => {
|
|
@@ -22007,29 +21078,6 @@ function registerSessionRoutes(app, deps) {
|
|
|
22007
21078
|
app.post(
|
|
22008
21079
|
"/session/:id/heartbeat",
|
|
22009
21080
|
mutate(),
|
|
22010
|
-
(req, res, next) => {
|
|
22011
|
-
const sessionId = req.params["id"];
|
|
22012
|
-
const key = sessionId ? parseVirtualSubagentSessionId(sessionId) : void 0;
|
|
22013
|
-
if (!sessionId || !key) {
|
|
22014
|
-
next();
|
|
22015
|
-
return;
|
|
22016
|
-
}
|
|
22017
|
-
const runtime = requireSessionRuntime({
|
|
22018
|
-
sessionId: key.parentSessionId,
|
|
22019
|
-
route: "POST /session/:id/heartbeat",
|
|
22020
|
-
res,
|
|
22021
|
-
workspaceRegistry,
|
|
22022
|
-
daemonLog
|
|
22023
|
-
});
|
|
22024
|
-
if (!runtime) return;
|
|
22025
|
-
const clientId = parseClientIdHeader(req, res);
|
|
22026
|
-
if (clientId === null) return;
|
|
22027
|
-
res.status(200).json({
|
|
22028
|
-
sessionId,
|
|
22029
|
-
...clientId ? { clientId } : {},
|
|
22030
|
-
lastSeenAt: Date.now()
|
|
22031
|
-
});
|
|
22032
|
-
},
|
|
22033
21081
|
withOwnerMutableSession(
|
|
22034
21082
|
"POST /session/:id/heartbeat",
|
|
22035
21083
|
(req, res, sessionId, runtime) => {
|
|
@@ -22046,25 +21094,6 @@ function registerSessionRoutes(app, deps) {
|
|
|
22046
21094
|
app.post(
|
|
22047
21095
|
"/session/:id/detach",
|
|
22048
21096
|
mutate(),
|
|
22049
|
-
(req, res, next) => {
|
|
22050
|
-
const sessionId = req.params["id"];
|
|
22051
|
-
const key = sessionId ? parseVirtualSubagentSessionId(sessionId) : void 0;
|
|
22052
|
-
if (!sessionId || !key) {
|
|
22053
|
-
next();
|
|
22054
|
-
return;
|
|
22055
|
-
}
|
|
22056
|
-
const runtime = requireSessionRuntime({
|
|
22057
|
-
sessionId: key.parentSessionId,
|
|
22058
|
-
route: "POST /session/:id/detach",
|
|
22059
|
-
res,
|
|
22060
|
-
workspaceRegistry,
|
|
22061
|
-
daemonLog
|
|
22062
|
-
});
|
|
22063
|
-
if (!runtime) return;
|
|
22064
|
-
const clientId = parseClientIdHeader(req, res);
|
|
22065
|
-
if (clientId === null) return;
|
|
22066
|
-
res.status(204).end();
|
|
22067
|
-
},
|
|
22068
21097
|
withOwnerMutableSession(
|
|
22069
21098
|
"POST /session/:id/detach",
|
|
22070
21099
|
async (req, res, sessionId, runtime) => {
|
|
@@ -25829,7 +24858,7 @@ data: ${dataJson}
|
|
|
25829
24858
|
__name(formatSseFrame, "formatSseFrame");
|
|
25830
24859
|
function registerSseEventsRoutes(app, deps) {
|
|
25831
24860
|
const { workspaceRegistry, daemonLog, sendBridgeError: sendBridgeError2, writerIdleTimeoutMs } = deps;
|
|
25832
|
-
app.get("/session/:id/events",
|
|
24861
|
+
app.get("/session/:id/events", (req, res) => {
|
|
25833
24862
|
const sessionId = req.params["id"];
|
|
25834
24863
|
const lastEventId = parseLastEventId(req.headers["last-event-id"]);
|
|
25835
24864
|
const maxQueued = parseMaxQueuedQuery(req.query["maxQueued"], res);
|
|
@@ -25837,9 +24866,8 @@ function registerSseEventsRoutes(app, deps) {
|
|
|
25837
24866
|
let iter;
|
|
25838
24867
|
const abort = new AbortController();
|
|
25839
24868
|
try {
|
|
25840
|
-
const virtualKey = parseVirtualSubagentSessionId(sessionId);
|
|
25841
24869
|
const runtime = requireSessionRuntime({
|
|
25842
|
-
sessionId
|
|
24870
|
+
sessionId,
|
|
25843
24871
|
route: "GET /session/:id/events",
|
|
25844
24872
|
res,
|
|
25845
24873
|
workspaceRegistry,
|
|
@@ -25847,24 +24875,12 @@ function registerSseEventsRoutes(app, deps) {
|
|
|
25847
24875
|
});
|
|
25848
24876
|
if (!runtime) return;
|
|
25849
24877
|
const snapshot = req.query["snapshot"] === "1";
|
|
25850
|
-
const iterable =
|
|
25851
|
-
signal: abort.signal,
|
|
25852
|
-
lastEventId,
|
|
25853
|
-
...maxQueued !== void 0 ? { maxQueued } : {}
|
|
25854
|
-
}) : runtime.bridge.subscribeEvents(sessionId, {
|
|
24878
|
+
const iterable = runtime.bridge.subscribeEvents(sessionId, {
|
|
25855
24879
|
signal: abort.signal,
|
|
25856
24880
|
lastEventId,
|
|
25857
24881
|
...maxQueued !== void 0 ? { maxQueued } : {},
|
|
25858
24882
|
...snapshot ? { snapshot: true } : {}
|
|
25859
24883
|
});
|
|
25860
|
-
if (!iterable) {
|
|
25861
|
-
res.status(404).json({
|
|
25862
|
-
error: "Subagent session not found",
|
|
25863
|
-
code: "session_not_found",
|
|
25864
|
-
sessionId
|
|
25865
|
-
});
|
|
25866
|
-
return;
|
|
25867
|
-
}
|
|
25868
24884
|
iter = iterable[Symbol.asyncIterator]();
|
|
25869
24885
|
} catch (err) {
|
|
25870
24886
|
if (err instanceof SubscriberLimitExceededError) {
|
|
@@ -27018,7 +26034,7 @@ __name(registerWorkspaceQualifiedLifecycleRoutes, "registerWorkspaceQualifiedLif
|
|
|
27018
26034
|
|
|
27019
26035
|
// packages/cli/src/serve/routes/workspace-management.ts
|
|
27020
26036
|
init_esbuild_shims();
|
|
27021
|
-
import { readdir
|
|
26037
|
+
import { readdir, stat } from "node:fs/promises";
|
|
27022
26038
|
import { realpathSync as realpathSync2 } from "node:fs";
|
|
27023
26039
|
import { basename as basename4, dirname as dirname4, isAbsolute as isAbsolute7, join as join8, resolve as resolve4, sep as sep3 } from "node:path";
|
|
27024
26040
|
var MAX_PATH_SUGGESTIONS = 50;
|
|
@@ -27240,7 +26256,7 @@ function registerWorkspaceManagementRoutes(app, deps) {
|
|
|
27240
26256
|
const suggestions = [];
|
|
27241
26257
|
let truncated = false;
|
|
27242
26258
|
try {
|
|
27243
|
-
const entries = await
|
|
26259
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
27244
26260
|
entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
27245
26261
|
for (const entry of entries) {
|
|
27246
26262
|
if (entry.name.startsWith(".") && !filter.startsWith(".")) continue;
|
|
@@ -27250,7 +26266,7 @@ function registerWorkspaceManagementRoutes(app, deps) {
|
|
|
27250
26266
|
let isDir = entry.isDirectory();
|
|
27251
26267
|
if (!isDir && entry.isSymbolicLink()) {
|
|
27252
26268
|
try {
|
|
27253
|
-
isDir = (await
|
|
26269
|
+
isDir = (await stat(join8(dir, entry.name))).isDirectory();
|
|
27254
26270
|
} catch {
|
|
27255
26271
|
continue;
|
|
27256
26272
|
}
|
|
@@ -27370,7 +26386,7 @@ function registerWorkspaceManagementRoutes(app, deps) {
|
|
|
27370
26386
|
return;
|
|
27371
26387
|
}
|
|
27372
26388
|
try {
|
|
27373
|
-
const s = await
|
|
26389
|
+
const s = await stat(canonical);
|
|
27374
26390
|
if (!s.isDirectory()) {
|
|
27375
26391
|
res.status(400).json({
|
|
27376
26392
|
error: "Path is not a directory",
|
|
@@ -28173,7 +27189,7 @@ __name(registerWorkspaceManagementRoutes, "registerWorkspaceManagementRoutes");
|
|
|
28173
27189
|
|
|
28174
27190
|
// packages/cli/src/serve/routes/workspace-git.ts
|
|
28175
27191
|
init_esbuild_shims();
|
|
28176
|
-
import * as
|
|
27192
|
+
import * as fs4 from "node:fs";
|
|
28177
27193
|
import * as path14 from "node:path";
|
|
28178
27194
|
function registerWorkspaceGitRoutes(app, deps) {
|
|
28179
27195
|
app.get("/workspace/git", async (_req, res) => {
|
|
@@ -28200,8 +27216,8 @@ function registerWorkspaceQualifiedGitRoutes(app, deps) {
|
|
|
28200
27216
|
let gitCwd = runtime.workspaceCwd;
|
|
28201
27217
|
if (typeof rawCwd === "string" && rawCwd.length > 0) {
|
|
28202
27218
|
try {
|
|
28203
|
-
const resolved =
|
|
28204
|
-
const root =
|
|
27219
|
+
const resolved = fs4.realpathSync(path14.resolve(rawCwd));
|
|
27220
|
+
const root = fs4.realpathSync(runtime.workspaceCwd);
|
|
28205
27221
|
const rel = path14.relative(root, resolved);
|
|
28206
27222
|
if (!rel.startsWith("..") && !path14.isAbsolute(rel)) {
|
|
28207
27223
|
gitCwd = resolved;
|
|
@@ -30769,7 +29785,6 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
|
|
|
30769
29785
|
allowPrivateAuthBaseUrl: opts.allowPrivateAuthBaseUrl === true,
|
|
30770
29786
|
installAuthProvider: deps.installAuthProvider
|
|
30771
29787
|
});
|
|
30772
|
-
const virtualSubagentSessions = new VirtualSubagentSessions();
|
|
30773
29788
|
registerSessionRoutes(app, {
|
|
30774
29789
|
boundWorkspace: primaryBoundWorkspace,
|
|
30775
29790
|
bridge: primaryBridge,
|
|
@@ -30780,8 +29795,7 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
|
|
|
30780
29795
|
daemonLog,
|
|
30781
29796
|
promptDeadlineMs: opts.promptDeadlineMs,
|
|
30782
29797
|
sessionShellCommandEnabled,
|
|
30783
|
-
languageCodes
|
|
30784
|
-
virtualSubagentSessions
|
|
29798
|
+
languageCodes
|
|
30785
29799
|
});
|
|
30786
29800
|
registerWorkspaceMcpControlRoutes(app, {
|
|
30787
29801
|
boundWorkspace: primaryBoundWorkspace,
|
|
@@ -30947,8 +29961,7 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
|
|
|
30947
29961
|
workspaceRegistry,
|
|
30948
29962
|
daemonLog,
|
|
30949
29963
|
writerIdleTimeoutMs: opts.writerIdleTimeoutMs,
|
|
30950
|
-
sendBridgeError: sendBridgeError2
|
|
30951
|
-
virtualSubagentSessions
|
|
29964
|
+
sendBridgeError: sendBridgeError2
|
|
30952
29965
|
});
|
|
30953
29966
|
acpHandleRef.current = mountAcpHttp(app, primaryBridge, {
|
|
30954
29967
|
boundWorkspace: primaryBoundWorkspace,
|