@qwen-code/qwen-code 0.20.2-gdpval-vl-bridge.1 → 0.20.2-headless-image-routing.0
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-M4LIT34W.js → MaxSizedBox-CPK6I4JU.js} +8 -8
- package/chunks/{StandaloneSessionPicker-HXMU7DFA.js → StandaloneSessionPicker-PUIA43XY.js} +21 -21
- package/chunks/{acpAgent-HBQ2JGZW.js → acpAgent-ROZXDEW6.js} +52 -94
- package/chunks/{agent-FTBEHKEX.js → agent-WAVPSQSS.js} +8 -8
- package/chunks/{agent-headless-N24DPYN3.js → agent-headless-74QWTN6L.js} +8 -8
- package/chunks/{bridge-CC3OBULF.js → bridge-A3IPRSLU.js} +11 -11
- package/chunks/{chunk-AOQJBD2B.js → chunk-2DGZGT4I.js} +3 -3
- package/chunks/{chunk-RJTVK5TR.js → chunk-2OYJGGJP.js} +4 -4
- package/chunks/{chunk-LPPJYKBM.js → chunk-2QEYXQY4.js} +3 -3
- package/chunks/{chunk-5XBOIXLC.js → chunk-3YIV2VCL.js} +1 -1
- package/chunks/{chunk-UDUPRNSS.js → chunk-5KDE7KYN.js} +1 -1
- package/chunks/{chunk-CJUU2TL7.js → chunk-6IC65F7C.js} +4 -4
- package/chunks/{chunk-OC6TMXM3.js → chunk-6YYPJBKS.js} +1 -1
- package/chunks/{chunk-RCUEYZDE.js → chunk-7362QS5B.js} +2 -36
- package/chunks/{chunk-NOZYC2NE.js → chunk-7LGIFLJS.js} +1002 -1347
- package/chunks/{chunk-XR45HSWW.js → chunk-7LPBIM25.js} +3 -3
- package/chunks/{chunk-TDQLAXFJ.js → chunk-7T6EFZMS.js} +1 -1
- package/chunks/{chunk-TSE4YYZ2.js → chunk-7UCSMQMH.js} +1 -1
- package/chunks/{chunk-Z2F3OACQ.js → chunk-CMX2PQVL.js} +6 -6
- package/chunks/{chunk-4VL535OR.js → chunk-CZOS5SHZ.js} +1 -1
- package/chunks/{chunk-BB5OWMWL.js → chunk-D3VPXCQO.js} +3 -3
- package/chunks/{chunk-IQSYK573.js → chunk-DNBEZRSH.js} +1 -1
- package/chunks/{chunk-4GS2REXS.js → chunk-DYV7CIWU.js} +1 -1
- package/chunks/{chunk-KWYUSUQD.js → chunk-FKH6IJVL.js} +2 -2
- package/chunks/{chunk-S72NV2OB.js → chunk-FPUSU3FS.js} +1 -1
- package/chunks/{chunk-SZFGXLCA.js → chunk-GAQPY2C5.js} +1 -1
- package/chunks/{chunk-QXNETMSU.js → chunk-GGMU7ESO.js} +52 -29
- package/chunks/{chunk-X7ZBWNFE.js → chunk-H4EI3IE7.js} +4 -4
- package/chunks/{chunk-VT7PBNGV.js → chunk-HIMIYFCP.js} +2 -2
- package/chunks/{chunk-RWG7SQHL.js → chunk-IK2WIHHP.js} +1 -1
- package/chunks/{chunk-HJIFNUBZ.js → chunk-IZUKQEXY.js} +1 -1
- package/chunks/{chunk-VYTSXNEU.js → chunk-JIULOPXR.js} +1 -1
- package/chunks/{chunk-SNQBTQAM.js → chunk-KBRGKSOR.js} +1 -1
- package/chunks/{chunk-DC6U5YUR.js → chunk-KIXDPYKU.js} +11 -11
- package/chunks/{chunk-AIBGEJYT.js → chunk-KL6CQ75X.js} +3 -3
- package/chunks/{chunk-PYXDHFAY.js → chunk-M3FNCPFA.js} +34 -48
- package/chunks/{chunk-BULDBTYC.js → chunk-M7WBGLYP.js} +0 -2
- package/chunks/{chunk-Y7TUCRKL.js → chunk-MBJGCTLS.js} +1 -1
- package/chunks/{chunk-BX7YNVT5.js → chunk-MGHZQY43.js} +1 -1
- package/chunks/{chunk-XNY7EQB3.js → chunk-MKCM6UYK.js} +3 -3
- package/chunks/{chunk-LCFDJI7O.js → chunk-MQGVHOSR.js} +1 -1
- package/chunks/{chunk-NAEJKDVZ.js → chunk-MR32FTT5.js} +7 -7
- package/chunks/{chunk-EHUVTCY3.js → chunk-MYNMIELG.js} +2 -2
- package/chunks/{chunk-J27HY6FZ.js → chunk-N6NZ332R.js} +1 -1
- package/chunks/{chunk-JUYIZ33D.js → chunk-NRRVUQS4.js} +1 -1
- package/chunks/{chunk-Z6HXYMH2.js → chunk-PJSM24XR.js} +4 -4
- package/chunks/{chunk-XFUPUW6C.js → chunk-PLVICOQK.js} +3 -3
- package/chunks/{chunk-WTAMVVTD.js → chunk-Q6457W3A.js} +5 -7
- package/chunks/{chunk-KXZCCC2Q.js → chunk-QIDWNN65.js} +1 -1
- package/chunks/{chunk-6LASQL5M.js → chunk-QJ5OOQAU.js} +3 -3
- package/chunks/{chunk-FZYDZJ7L.js → chunk-RGQSYME5.js} +1 -1
- package/chunks/{chunk-RM2BASBJ.js → chunk-S6PGTUT3.js} +3 -3
- package/chunks/{chunk-XHDZAA7D.js → chunk-SOYT56ML.js} +32 -66
- package/chunks/{chunk-3X35SQJ7.js → chunk-STJNEKSB.js} +7 -8
- package/chunks/{chunk-CG3ZHFKI.js → chunk-SVUKZKGO.js} +103 -188
- package/chunks/{chunk-OFBTA7ZH.js → chunk-VCJ5EJRK.js} +3 -3
- package/chunks/{chunk-J5MNGN7O.js → chunk-VF4PO5FU.js} +5 -5
- package/chunks/{chunk-ZXMRMRLV.js → chunk-VH7AN6R6.js} +1 -1
- package/chunks/{chunk-HJMEOB5V.js → chunk-VVPHBIAZ.js} +1 -1
- package/chunks/{chunk-3D3ZNXPX.js → chunk-WDXE6PYV.js} +2 -2
- package/chunks/{chunk-2GLQVVDB.js → chunk-WP6LZ4MJ.js} +1 -1
- package/chunks/{chunk-ZHOWRPNL.js → chunk-WSJV2PV5.js} +1 -1
- package/chunks/{chunk-2REMUBYR.js → chunk-X3WYTVQZ.js} +2 -2
- package/chunks/{chunk-73BA2M4B.js → chunk-XWGVNYYI.js} +10 -10
- package/chunks/{chunk-OKYDEY5X.js → chunk-Y6SYQRQQ.js} +1 -1
- package/chunks/{chunk-PR5EJ3NW.js → chunk-YBXY5Y3K.js} +23 -23
- package/chunks/{chunk-QB76EVWT.js → chunk-YTWAWLS6.js} +3 -3
- package/chunks/{chunk-JAR6YXXM.js → chunk-ZMBWA2ZY.js} +3 -3
- package/chunks/{computer-use-AOOWNXKW.js → computer-use-3TVSA54L.js} +8 -8
- package/chunks/{contextCommand-3XHEVDXU.js → contextCommand-RG2MM5PD.js} +10 -10
- package/chunks/{create-sub-session-JA3QWRJC.js → create-sub-session-KIVO6TT5.js} +8 -8
- package/chunks/{daemon-GJRFILYS.js → daemon-RAPSDJH7.js} +18 -168
- package/chunks/{daemon-status-provider-OX57FWCI.js → daemon-status-provider-BJJTMIDV.js} +15 -15
- package/chunks/{earlyInputCapture-FATCAVUQ.js → earlyInputCapture-NYQKIV4B.js} +8 -8
- package/chunks/{edit-ZRZNVZMT.js → edit-IOTOMN4X.js} +8 -8
- package/chunks/{enter-worktree-BRRS4GPZ.js → enter-worktree-35GDGWMB.js} +8 -8
- package/chunks/{enterPlanMode-BCOWUWG7.js → enterPlanMode-X4NEBGDH.js} +8 -8
- package/chunks/{environment-RSE7UJZL.js → environment-KFFOVPWY.js} +10 -10
- package/chunks/{errors-VPPU2OW3.js → errors-IZ7R5OI4.js} +10 -10
- package/chunks/{exit-worktree-5LZVWRXQ.js → exit-worktree-535TK24V.js} +8 -8
- package/chunks/{exitPlanMode-7HZD6265.js → exitPlanMode-HZ5HJCOD.js} +8 -8
- package/chunks/{fast-path-ZMMNGP3J.js → fast-path-BSDRID75.js} +2 -2
- package/chunks/{gemini-XWL26XGQ.js → gemini-UWO57GGI.js} +39 -39
- package/chunks/{geminiContentGenerator-JVCOWXJ4.js → geminiContentGenerator-TQ5ZCTB4.js} +1 -1
- package/chunks/{glob-6QZHUWF5.js → glob-CPQ43UDE.js} +8 -8
- package/chunks/{grep-S3LOICJR.js → grep-OBXWZT5D.js} +8 -8
- package/chunks/{handleAutoUpdate-N3XHBJJZ.js → handleAutoUpdate-DG6VI5J6.js} +12 -12
- package/chunks/{i18n-ZUTDML4N.js → i18n-2YRBDZWT.js} +9 -9
- package/chunks/{initializer-X5HQ4E3J.js → initializer-IP2DDAGE.js} +13 -13
- package/chunks/{installationInfo-EK2PKUUD.js → installationInfo-7GTMJJ2V.js} +9 -9
- package/chunks/{list-4JRNZBUF.js → list-L2PQSGVO.js} +16 -16
- package/chunks/{loadedSettingsAdapter-7K4IMWMJ.js → loadedSettingsAdapter-MMXSQWO4.js} +13 -13
- package/chunks/{managed-npm-update-FDLYPTSZ.js → managed-npm-update-75EPQN3U.js} +9 -9
- package/chunks/{mcp-5CZJQPWK.js → mcp-BKLURHSY.js} +13 -13
- package/chunks/{monitor-BCOYJMP3.js → monitor-L7V4QSQ5.js} +8 -8
- package/chunks/{nonInteractiveCli-MHJ4DO4E.js → nonInteractiveCli-5YG5J4C4.js} +39 -37
- package/chunks/{notebook-edit-B43IVF6V.js → notebook-edit-7TYQDSDD.js} +8 -8
- package/chunks/{openaiContentGenerator-7UHKXCMW.js → openaiContentGenerator-337EHHTE.js} +4 -4
- package/chunks/{pidfile-FTFXJNTU.js → pidfile-G7PQ2P5H.js} +8 -8
- package/chunks/{processUtils-H6DJTBGF.js → processUtils-CX44WAP2.js} +2 -2
- package/chunks/{qwenContentGenerator-5MAPZ5OI.js → qwenContentGenerator-SYWFK5OL.js} +9 -9
- package/chunks/{qwenOAuth2-E3C4BRET.js → qwenOAuth2-BXYGPV5P.js} +6 -6
- package/chunks/{read-file-HNWCU5ZJ.js → read-file-37YQVCEY.js} +3 -3
- package/chunks/{resumeHistoryUtils-X3LF3DDD.js → resumeHistoryUtils-W2C7GY6G.js} +11 -11
- package/chunks/{ripGrep-PK64GRYJ.js → ripGrep-WL2NQQFB.js} +8 -8
- package/chunks/{run-qwen-serve-HHOM27BS.js → run-qwen-serve-SLAWXYTD.js} +21 -21
- package/chunks/{runtime-FHQBKJK5.js → runtime-FL6GKWRC.js} +14 -14
- package/chunks/{scheduler-WWPWCUBB.js → scheduler-AWSFTIJK.js} +8 -8
- 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-KBO6X4ZS.js → send-message-PYIJ2PZL.js} +1 -1
- package/chunks/{serve-WDZUQEUY.js → serve-RL6OJAXK.js} +13 -13
- package/chunks/{server-CWB2ZELJ.js → server-ANUZOEU6.js} +133 -1117
- package/chunks/{session-55H43RX7.js → session-QVFFZWY5.js} +38 -38
- package/chunks/{settings-QU4XYBIP.js → settings-LCTEYRIB.js} +12 -12
- package/chunks/{shell-AVDH5SZ3.js → shell-6I6RUFMO.js} +8 -8
- package/chunks/{skill-QREIW4IT.js → skill-6H7VKWST.js} +3 -3
- package/chunks/{spawnChannel-Z6LCJXR7.js → spawnChannel-3PKMXS5E.js} +10 -10
- package/chunks/{src-MUZ56PFO.js → src-RMIJ7356.js} +8 -20
- package/chunks/{standalone-update-DAJPEKQX.js → standalone-update-HRFWNPD2.js} +10 -10
- package/chunks/{startInteractiveUI-CNYGTBZ5.js → startInteractiveUI-A46LW75Y.js} +51 -58
- package/chunks/{team-create-P52BTCPV.js → team-create-EWJRLBNH.js} +8 -8
- package/chunks/{team-plan-approval-73Q5FIJA.js → team-plan-approval-VDU66ODQ.js} +8 -8
- package/chunks/{theme-manager-V66HLBUQ.js → theme-manager-7VBYGZY3.js} +8 -8
- package/chunks/{tool-search-D6MU37WT.js → tool-search-54D47DON.js} +3 -3
- package/chunks/{total-session-admission-S6RM4XZ7.js → total-session-admission-S5A4LEAN.js} +11 -11
- package/chunks/{tree-sitter-L5BFT64K.js → tree-sitter-FS4VPMZA.js} +1 -1
- package/chunks/{tree-sitter-bash-ZKDNQGID.js → tree-sitter-bash-6B46JJCV.js} +1 -1
- package/chunks/{trustedFolders-2EVUM2F4.js → trustedFolders-4MBS5K4P.js} +9 -9
- package/chunks/{update-relaunch-GAUMJAG2.js → update-relaunch-GX4HUHRX.js} +5 -5
- package/chunks/{updateCheck-3432WPSE.js → updateCheck-IYFPWHAG.js} +11 -11
- package/chunks/{useAutoAcceptIndicator-DA7Z4KBZ.js → useAutoAcceptIndicator-R4QRIXCB.js} +14 -14
- package/chunks/{validateNonInterActiveAuth-B4AN7QTG.js → validateNonInterActiveAuth-S4RK7CKV.js} +34 -34
- package/chunks/{version-Y7OVY5KW.js → version-OJJ2JHIP.js} +1 -1
- package/chunks/{web-fetch-JBNFGW2V.js → web-fetch-BOUIZGFB.js} +5 -5
- package/chunks/{web-search-WMGBQQX7.js → web-search-4LAWHNNQ.js} +5 -5
- package/chunks/{workflow-4XR6C76U.js → workflow-DLWGUSKG.js} +9 -9
- package/chunks/{workspace-providers-status-SNN2VJZ2.js → workspace-providers-status-HC53BB36.js} +16 -16
- package/chunks/{workspace-registration-store-INZDPJZ5.js → workspace-registration-store-3BDRYY5Y.js} +1 -1
- package/chunks/{workspace-registry-CMMK4KMZ.js → workspace-registry-K4KIR3YU.js} +11 -11
- package/chunks/{workspace-service-ATCQSTSX.js → workspace-service-JONFMZJJ.js} +17 -17
- package/chunks/{workspace-skills-status-TZFVEBPM.js → workspace-skills-status-TZ4GFSTK.js} +14 -14
- package/chunks/{write-file-4IQOW5NC.js → write-file-YLJZTILT.js} +8 -8
- 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/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
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
shouldSuppressRememberErrorDetails,
|
|
15
15
|
workspaceMemoryFailureCode,
|
|
16
16
|
workspaceMemoryFailureDiagnostics
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-HIMIYFCP.js";
|
|
18
18
|
import {
|
|
19
19
|
openQwenAsrRealtimeStream,
|
|
20
20
|
openVoiceStream,
|
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
import {
|
|
24
24
|
SetupGithubError,
|
|
25
25
|
collectSessionData,
|
|
26
|
-
createTranscriptMessageUpdate,
|
|
27
26
|
generateExportFilename,
|
|
28
27
|
normalizeSessionData,
|
|
29
28
|
setupGithub,
|
|
@@ -31,12 +30,12 @@ import {
|
|
|
31
30
|
toJson,
|
|
32
31
|
toJsonl,
|
|
33
32
|
toMarkdown
|
|
34
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-STJNEKSB.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-DNBEZRSH.js";
|
|
40
39
|
import "./chunk-RS7MT2QG.js";
|
|
41
40
|
import "./chunk-H2XVO6NE.js";
|
|
42
41
|
import "./chunk-QHTIBUWB.js";
|
|
@@ -109,23 +108,23 @@ import {
|
|
|
109
108
|
} from "./chunk-RXFQM6FQ.js";
|
|
110
109
|
import {
|
|
111
110
|
createDaemonStatusProvider
|
|
112
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-6IC65F7C.js";
|
|
113
112
|
import "./chunk-LXXMOYPL.js";
|
|
114
|
-
import "./chunk-
|
|
113
|
+
import "./chunk-VCJ5EJRK.js";
|
|
115
114
|
import "./chunk-E5Z2AVNV.js";
|
|
116
115
|
import {
|
|
117
116
|
createWorkspaceProvidersStatusProvider
|
|
118
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-VF4PO5FU.js";
|
|
119
118
|
import {
|
|
120
119
|
getAuthTypeFromEnv,
|
|
121
120
|
resolveCliGenerationConfig
|
|
122
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-2DGZGT4I.js";
|
|
123
122
|
import {
|
|
124
123
|
snapshotProcessEnv
|
|
125
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-7T6EFZMS.js";
|
|
126
125
|
import {
|
|
127
126
|
createWorkspaceSkillsStatusProvider
|
|
128
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-PLVICOQK.js";
|
|
129
128
|
import "./chunk-2W3OOD4W.js";
|
|
130
129
|
import {
|
|
131
130
|
EMPTY_WORKSPACE_VOICE_UPDATE_ERROR,
|
|
@@ -140,14 +139,14 @@ import {
|
|
|
140
139
|
validateWorkspaceSkillName,
|
|
141
140
|
validateWorkspaceVoiceState,
|
|
142
141
|
voiceSettingsScopeToWire
|
|
143
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-MR32FTT5.js";
|
|
144
143
|
import {
|
|
145
144
|
PermissionRulesValidationError,
|
|
146
145
|
buildPermissionSettings,
|
|
147
146
|
isPermissionRuleType,
|
|
148
147
|
normalizePermissionRules,
|
|
149
148
|
readPermissionRuleSet
|
|
150
|
-
} from "./chunk-
|
|
149
|
+
} from "./chunk-5KDE7KYN.js";
|
|
151
150
|
import {
|
|
152
151
|
assertVoiceBaseUrlNetworkAllowed,
|
|
153
152
|
isStreamingVoiceModel,
|
|
@@ -155,12 +154,12 @@ import {
|
|
|
155
154
|
resolveVoiceTranscriptionConfig,
|
|
156
155
|
sanitizeVoiceErrorMessage,
|
|
157
156
|
transcribeVoiceAudio
|
|
158
|
-
} from "./chunk-
|
|
157
|
+
} from "./chunk-MBJGCTLS.js";
|
|
159
158
|
import {
|
|
160
159
|
isVoiceEnabled,
|
|
161
160
|
isVoiceMode,
|
|
162
161
|
readVoiceModel
|
|
163
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-WSJV2PV5.js";
|
|
164
163
|
import "./chunk-QLJUC7TG.js";
|
|
165
164
|
import {
|
|
166
165
|
WorkspacePermissionRulesSessionRequiredError,
|
|
@@ -177,10 +176,9 @@ import {
|
|
|
177
176
|
SessionArtifactValidationError,
|
|
178
177
|
createAcpSessionBridge,
|
|
179
178
|
parseSessionSource
|
|
180
|
-
} from "./chunk-
|
|
179
|
+
} from "./chunk-SOYT56ML.js";
|
|
181
180
|
import {
|
|
182
181
|
EVENT_SCHEMA_VERSION,
|
|
183
|
-
EventBus,
|
|
184
182
|
SubscriberLimitExceededError
|
|
185
183
|
} from "./chunk-6RLROE6G.js";
|
|
186
184
|
import "./chunk-COH43MRJ.js";
|
|
@@ -222,20 +220,20 @@ import "./chunk-WBL3FJEU.js";
|
|
|
222
220
|
import {
|
|
223
221
|
daemonObservedContactsPath,
|
|
224
222
|
loadChannelsConfig
|
|
225
|
-
} from "./chunk-
|
|
226
|
-
import "./chunk-
|
|
223
|
+
} from "./chunk-ZMBWA2ZY.js";
|
|
224
|
+
import "./chunk-H4EI3IE7.js";
|
|
227
225
|
import "./chunk-57OAHC2Y.js";
|
|
228
226
|
import {
|
|
229
227
|
parseChannelWebhookConfigLenient
|
|
230
228
|
} from "./chunk-GHRSKGHF.js";
|
|
231
229
|
import "./chunk-6ZBPS62S.js";
|
|
232
230
|
import "./chunk-V6WHFGST.js";
|
|
233
|
-
import "./chunk-
|
|
231
|
+
import "./chunk-FPUSU3FS.js";
|
|
234
232
|
import {
|
|
235
233
|
STATUS_SCHEMA_VERSION,
|
|
236
234
|
createIdleWorkspaceMemoryStatus,
|
|
237
235
|
mapDomainErrorToErrorKind
|
|
238
|
-
} from "./chunk-
|
|
236
|
+
} from "./chunk-N6NZ332R.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-DYV7CIWU.js";
|
|
247
245
|
import {
|
|
248
246
|
MAX_WORKSPACE_PATH_LENGTH,
|
|
249
247
|
canonicalizeWorkspace,
|
|
@@ -280,23 +278,23 @@ import {
|
|
|
280
278
|
getWritableScopes,
|
|
281
279
|
loadSettings,
|
|
282
280
|
validateSettingValue
|
|
283
|
-
} from "./chunk-
|
|
281
|
+
} from "./chunk-CMX2PQVL.js";
|
|
284
282
|
import "./chunk-RKUWKYED.js";
|
|
285
283
|
import {
|
|
286
284
|
SUPPORTED_LANGUAGES,
|
|
287
285
|
detectSystemLanguage,
|
|
288
286
|
resolveLanguageSetting,
|
|
289
287
|
resolveSupportedLanguage
|
|
290
|
-
} from "./chunk-
|
|
291
|
-
import "./chunk-
|
|
288
|
+
} from "./chunk-Y6SYQRQQ.js";
|
|
289
|
+
import "./chunk-CZOS5SHZ.js";
|
|
292
290
|
import "./chunk-GOXKNSDZ.js";
|
|
293
291
|
import "./chunk-IDS7MSUP.js";
|
|
294
292
|
import "./chunk-QRUIS3DN.js";
|
|
295
|
-
import "./chunk-
|
|
293
|
+
import "./chunk-JIULOPXR.js";
|
|
296
294
|
import "./chunk-VJNBRRZG.js";
|
|
297
295
|
import {
|
|
298
296
|
getWorkspaceTrustStatus
|
|
299
|
-
} from "./chunk-
|
|
297
|
+
} from "./chunk-GAQPY2C5.js";
|
|
300
298
|
import "./chunk-ALGGS7UH.js";
|
|
301
299
|
import {
|
|
302
300
|
isWithinRoot as isWithinRoot2
|
|
@@ -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,7 +360,7 @@ import {
|
|
|
364
360
|
writeWorkspaceContextFile,
|
|
365
361
|
writeWorktreeSession,
|
|
366
362
|
writeWorktreeSessionMarker
|
|
367
|
-
} from "./chunk-
|
|
363
|
+
} from "./chunk-7LGIFLJS.js";
|
|
368
364
|
import "./chunk-T4TZQJ7W.js";
|
|
369
365
|
import "./chunk-H6XPXXMH.js";
|
|
370
366
|
import "./chunk-5M6IDOMF.js";
|
|
@@ -372,7 +368,7 @@ import "./chunk-T2L47JJK.js";
|
|
|
372
368
|
import "./chunk-GPSKDNEE.js";
|
|
373
369
|
import "./chunk-X6N25LXS.js";
|
|
374
370
|
import "./chunk-E2UVIFI2.js";
|
|
375
|
-
import "./chunk-
|
|
371
|
+
import "./chunk-QIDWNN65.js";
|
|
376
372
|
import {
|
|
377
373
|
MAX_JOBS,
|
|
378
374
|
nextDurableFireMs
|
|
@@ -413,10 +409,10 @@ import {
|
|
|
413
409
|
isDeviceAuthorizationSuccess,
|
|
414
410
|
isDeviceTokenPending,
|
|
415
411
|
isDeviceTokenSuccess
|
|
416
|
-
} from "./chunk-
|
|
412
|
+
} from "./chunk-KBRGKSOR.js";
|
|
417
413
|
import "./chunk-JESCGQM3.js";
|
|
418
|
-
import "./chunk-
|
|
419
|
-
import "./chunk-
|
|
414
|
+
import "./chunk-6YYPJBKS.js";
|
|
415
|
+
import "./chunk-WP6LZ4MJ.js";
|
|
420
416
|
import "./chunk-XVNQMZ2I.js";
|
|
421
417
|
import "./chunk-CR3C7WXL.js";
|
|
422
418
|
import "./chunk-FODK6UMO.js";
|
|
@@ -430,14 +426,12 @@ import {
|
|
|
430
426
|
hashDaemonWorkspace,
|
|
431
427
|
isBinaryFile,
|
|
432
428
|
isWithinRoot,
|
|
433
|
-
parseLineTolerant,
|
|
434
|
-
read,
|
|
435
429
|
recordDaemonBridgeError,
|
|
436
430
|
recordDaemonError,
|
|
437
431
|
recordDaemonHttpRequest,
|
|
438
432
|
recordDaemonHttpResponse,
|
|
439
433
|
withDaemonRequestSpan
|
|
440
|
-
} from "./chunk-
|
|
434
|
+
} from "./chunk-SVUKZKGO.js";
|
|
441
435
|
import "./chunk-VGC4I5JJ.js";
|
|
442
436
|
import "./chunk-4K56OJFJ.js";
|
|
443
437
|
import "./chunk-CBOQ3HY7.js";
|
|
@@ -450,9 +444,9 @@ import {
|
|
|
450
444
|
import_websocket_server
|
|
451
445
|
} from "./chunk-TYAMGABM.js";
|
|
452
446
|
import "./chunk-FCMNKVXT.js";
|
|
453
|
-
import "./chunk-
|
|
447
|
+
import "./chunk-7362QS5B.js";
|
|
454
448
|
import "./chunk-HTR4WV6U.js";
|
|
455
|
-
import "./chunk-
|
|
449
|
+
import "./chunk-M7WBGLYP.js";
|
|
456
450
|
import "./chunk-U7ZFW55U.js";
|
|
457
451
|
import "./chunk-NPQDJGKU.js";
|
|
458
452
|
import "./chunk-YM3SZTH4.js";
|
|
@@ -657,9 +651,9 @@ async function findExistingAncestor(absolute) {
|
|
|
657
651
|
let current = absolute;
|
|
658
652
|
const tailParts = [];
|
|
659
653
|
for (let i = 0; i < MAX_ANCESTOR_HOPS; i++) {
|
|
660
|
-
let
|
|
654
|
+
let stat2 = null;
|
|
661
655
|
try {
|
|
662
|
-
|
|
656
|
+
stat2 = await fsp.stat(current);
|
|
663
657
|
} catch (err) {
|
|
664
658
|
const code = err?.code;
|
|
665
659
|
if (code === "ENOENT" || code === "ENOTDIR") {
|
|
@@ -667,8 +661,8 @@ async function findExistingAncestor(absolute) {
|
|
|
667
661
|
throw err;
|
|
668
662
|
}
|
|
669
663
|
}
|
|
670
|
-
if (
|
|
671
|
-
if (tailParts.length > 0 && !
|
|
664
|
+
if (stat2) {
|
|
665
|
+
if (tailParts.length > 0 && !stat2.isDirectory()) {
|
|
672
666
|
throw new FsError(
|
|
673
667
|
"parse_error",
|
|
674
668
|
`path component is not a directory: ${absolute}`,
|
|
@@ -741,7 +735,7 @@ async function resolveWithinWorkspace(input, boundWorkspaces, intent) {
|
|
|
741
735
|
boundCanonicals
|
|
742
736
|
);
|
|
743
737
|
if (boundCanonical !== void 0) {
|
|
744
|
-
const finalPathIsSymlink = await fsp.lstat(absolute).then((
|
|
738
|
+
const finalPathIsSymlink = await fsp.lstat(absolute).then((stat2) => stat2.isSymbolicLink()).catch((lstatErr) => {
|
|
745
739
|
if (lstatErr.code === "ENOENT" || lstatErr.code === "ENOTDIR") {
|
|
746
740
|
return false;
|
|
747
741
|
}
|
|
@@ -1232,8 +1226,8 @@ var WorkspaceFileSystemImpl = class {
|
|
|
1232
1226
|
const toRead = Math.min(maxBytes, available);
|
|
1233
1227
|
buf = Buffer.allocUnsafe(toRead);
|
|
1234
1228
|
if (toRead > 0) {
|
|
1235
|
-
const
|
|
1236
|
-
buf =
|
|
1229
|
+
const read = await fh.read(buf, 0, toRead, offset);
|
|
1230
|
+
buf = read.bytesRead === toRead ? buf : buf.subarray(0, read.bytesRead);
|
|
1237
1231
|
}
|
|
1238
1232
|
const afterRead = await fh.stat();
|
|
1239
1233
|
assertSameFile(st, afterRead, p, "read");
|
|
@@ -1774,17 +1768,17 @@ var WorkspaceFileSystemImpl = class {
|
|
|
1774
1768
|
* for their `sendFsError` serializer.
|
|
1775
1769
|
*/
|
|
1776
1770
|
recordAndWrap(err, intent, input) {
|
|
1777
|
-
const
|
|
1771
|
+
const fs5 = wrapAsFsError(err);
|
|
1778
1772
|
this.deps.audit.recordDenied(this.deps.ctx, {
|
|
1779
1773
|
intent,
|
|
1780
1774
|
input,
|
|
1781
|
-
errorKind:
|
|
1782
|
-
hint:
|
|
1775
|
+
errorKind: fs5.kind,
|
|
1776
|
+
hint: fs5.hint,
|
|
1783
1777
|
// Quote the underlying OS / FsError message so audit
|
|
1784
1778
|
// consumers debugging a production incident can see the
|
|
1785
1779
|
// actual cause (errno text, byte counts, glob pattern,
|
|
1786
1780
|
// etc.) rather than just `errorKind` + `hint`.
|
|
1787
|
-
message:
|
|
1781
|
+
message: fs5.message,
|
|
1788
1782
|
// For glob denials (parse_error pattern rejection,
|
|
1789
1783
|
// catastrophic walk failures) the input IS the pattern
|
|
1790
1784
|
// already; surfacing it on the dedicated `pattern` field
|
|
@@ -1793,7 +1787,7 @@ var WorkspaceFileSystemImpl = class {
|
|
|
1793
1787
|
// branching on intent.
|
|
1794
1788
|
pattern: intent === "glob" ? input : void 0
|
|
1795
1789
|
});
|
|
1796
|
-
return
|
|
1790
|
+
return fs5;
|
|
1797
1791
|
}
|
|
1798
1792
|
};
|
|
1799
1793
|
var CONTENT_HASH_RE = /^sha256:[0-9a-f]{64}$/;
|
|
@@ -1901,9 +1895,9 @@ async function readStableRegularFileBuffer(p, pre) {
|
|
|
1901
1895
|
const out = Buffer.alloc(opened.size);
|
|
1902
1896
|
let offset = 0;
|
|
1903
1897
|
while (offset < opened.size) {
|
|
1904
|
-
const
|
|
1905
|
-
if (
|
|
1906
|
-
offset +=
|
|
1898
|
+
const read = await fh.read(out, offset, opened.size - offset, offset);
|
|
1899
|
+
if (read.bytesRead === 0) break;
|
|
1900
|
+
offset += read.bytesRead;
|
|
1907
1901
|
}
|
|
1908
1902
|
const afterRead = await fh.stat();
|
|
1909
1903
|
assertSameFile(opened, afterRead, p, "read");
|
|
@@ -2158,15 +2152,15 @@ async function hashRegularFileAtPath(p, pre) {
|
|
|
2158
2152
|
const buf = Buffer.allocUnsafe(64 * 1024);
|
|
2159
2153
|
let offset = 0;
|
|
2160
2154
|
while (offset < opened.size) {
|
|
2161
|
-
const
|
|
2155
|
+
const read = await fh.read(
|
|
2162
2156
|
buf,
|
|
2163
2157
|
0,
|
|
2164
2158
|
Math.min(buf.length, opened.size - offset),
|
|
2165
2159
|
offset
|
|
2166
2160
|
);
|
|
2167
|
-
if (
|
|
2168
|
-
hash.update(buf.subarray(0,
|
|
2169
|
-
offset +=
|
|
2161
|
+
if (read.bytesRead === 0) break;
|
|
2162
|
+
hash.update(buf.subarray(0, read.bytesRead));
|
|
2163
|
+
offset += read.bytesRead;
|
|
2170
2164
|
}
|
|
2171
2165
|
} finally {
|
|
2172
2166
|
await fh.close();
|
|
@@ -2530,12 +2524,12 @@ __name(applyReadHeaders, "applyReadHeaders");
|
|
|
2530
2524
|
function sendFsError(res, err, route) {
|
|
2531
2525
|
applyReadHeaders(res);
|
|
2532
2526
|
if (isFsError(err)) {
|
|
2533
|
-
const
|
|
2534
|
-
res.status(
|
|
2535
|
-
errorKind:
|
|
2536
|
-
error:
|
|
2537
|
-
hint:
|
|
2538
|
-
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
|
|
2539
2533
|
});
|
|
2540
2534
|
return;
|
|
2541
2535
|
}
|
|
@@ -2637,13 +2631,13 @@ async function handleGetFile(req, res, deps) {
|
|
|
2637
2631
|
});
|
|
2638
2632
|
return;
|
|
2639
2633
|
}
|
|
2640
|
-
const
|
|
2634
|
+
const fs5 = factory.forRequest({
|
|
2641
2635
|
originatorClientId: clientId ?? void 0,
|
|
2642
2636
|
route: ROUTE2
|
|
2643
2637
|
});
|
|
2644
2638
|
try {
|
|
2645
|
-
const resolved = await
|
|
2646
|
-
const out = await
|
|
2639
|
+
const resolved = await fs5.resolve(queryPath, "read");
|
|
2640
|
+
const out = await fs5.readText(resolved, { maxBytes, line, limit });
|
|
2647
2641
|
const returnedBytes = Buffer.byteLength(out.content, "utf-8");
|
|
2648
2642
|
applyReadHeaders(res);
|
|
2649
2643
|
res.status(200).json({
|
|
@@ -2697,13 +2691,13 @@ async function handleGetFileBytes(req, res, deps) {
|
|
|
2697
2691
|
});
|
|
2698
2692
|
return;
|
|
2699
2693
|
}
|
|
2700
|
-
const
|
|
2694
|
+
const fs5 = factory.forRequest({
|
|
2701
2695
|
originatorClientId: clientId ?? void 0,
|
|
2702
2696
|
route: ROUTE2
|
|
2703
2697
|
});
|
|
2704
2698
|
try {
|
|
2705
|
-
const resolved = await
|
|
2706
|
-
const out = await
|
|
2699
|
+
const resolved = await fs5.resolve(queryPath, "read");
|
|
2700
|
+
const out = await fs5.readBytesWindow(resolved, {
|
|
2707
2701
|
offset: offset ?? 0,
|
|
2708
2702
|
maxBytes: maxBytes ?? DEFAULT_FILE_BYTES_MAX_BYTES
|
|
2709
2703
|
});
|
|
@@ -2731,13 +2725,13 @@ async function handleGetStat(req, res, deps) {
|
|
|
2731
2725
|
if (clientId === null) return;
|
|
2732
2726
|
const queryPath = requireStringQuery(res, req.query["path"], "path", ROUTE2);
|
|
2733
2727
|
if (queryPath === null) return;
|
|
2734
|
-
const
|
|
2728
|
+
const fs5 = factory.forRequest({
|
|
2735
2729
|
originatorClientId: clientId ?? void 0,
|
|
2736
2730
|
route: ROUTE2
|
|
2737
2731
|
});
|
|
2738
2732
|
try {
|
|
2739
|
-
const resolved = await
|
|
2740
|
-
const st = await
|
|
2733
|
+
const resolved = await fs5.resolve(queryPath, "stat");
|
|
2734
|
+
const st = await fs5.stat(resolved);
|
|
2741
2735
|
applyReadHeaders(res);
|
|
2742
2736
|
res.status(200).json({
|
|
2743
2737
|
kind: "stat",
|
|
@@ -2760,13 +2754,13 @@ async function handleGetList(req, res, deps) {
|
|
|
2760
2754
|
const queryPath = requireStringQuery(res, req.query["path"], "path", ROUTE2);
|
|
2761
2755
|
if (queryPath === null) return;
|
|
2762
2756
|
const includeIgnored = parseBoolFlag(req.query["includeIgnored"]);
|
|
2763
|
-
const
|
|
2757
|
+
const fs5 = factory.forRequest({
|
|
2764
2758
|
originatorClientId: clientId ?? void 0,
|
|
2765
2759
|
route: ROUTE2
|
|
2766
2760
|
});
|
|
2767
2761
|
try {
|
|
2768
|
-
const resolved = await
|
|
2769
|
-
const entries = await
|
|
2762
|
+
const resolved = await fs5.resolve(queryPath, "list");
|
|
2763
|
+
const entries = await fs5.list(resolved, {
|
|
2770
2764
|
includeIgnored,
|
|
2771
2765
|
maxEntries: MAX_LIST_ENTRIES + 1
|
|
2772
2766
|
});
|
|
@@ -2819,15 +2813,15 @@ async function handleGetGlob(req, res, deps) {
|
|
|
2819
2813
|
}
|
|
2820
2814
|
const cwdRaw = req.query["cwd"];
|
|
2821
2815
|
const cwdString = typeof cwdRaw === "string" && cwdRaw.length > 0 ? cwdRaw : void 0;
|
|
2822
|
-
const
|
|
2816
|
+
const fs5 = factory.forRequest({
|
|
2823
2817
|
originatorClientId: clientId ?? void 0,
|
|
2824
2818
|
route: ROUTE2
|
|
2825
2819
|
});
|
|
2826
2820
|
const start = performance.now();
|
|
2827
2821
|
try {
|
|
2828
|
-
const cwdResolved = cwdString ? await
|
|
2822
|
+
const cwdResolved = cwdString ? await fs5.resolve(cwdString, "list") : void 0;
|
|
2829
2823
|
const cap = maxResults ?? DEFAULT_GLOB_MAX_RESULTS;
|
|
2830
|
-
const probe = await
|
|
2824
|
+
const probe = await fs5.glob(pattern, {
|
|
2831
2825
|
cwd: cwdResolved,
|
|
2832
2826
|
includeIgnored,
|
|
2833
2827
|
maxResults: cap + 1
|
|
@@ -3001,7 +2995,7 @@ function validateClientId(clientId, deps, res) {
|
|
|
3001
2995
|
}
|
|
3002
2996
|
__name(validateClientId, "validateClientId");
|
|
3003
2997
|
function createSetupGithubFileOps(factory, route, originatorClientId) {
|
|
3004
|
-
const
|
|
2998
|
+
const fs5 = factory.forRequest({
|
|
3005
2999
|
route,
|
|
3006
3000
|
...originatorClientId ? { originatorClientId } : {}
|
|
3007
3001
|
});
|
|
@@ -3024,14 +3018,14 @@ function createSetupGithubFileOps(factory, route, originatorClientId) {
|
|
|
3024
3018
|
]);
|
|
3025
3019
|
},
|
|
3026
3020
|
async writeTextFile(_gitRepoRoot, relativePath, content) {
|
|
3027
|
-
const resolved = await
|
|
3028
|
-
const out = await
|
|
3021
|
+
const resolved = await fs5.resolve(relativePath, "write");
|
|
3022
|
+
const out = await fs5.writeTextOverwrite(resolved, content);
|
|
3029
3023
|
return { sizeBytes: out.sizeBytes };
|
|
3030
3024
|
},
|
|
3031
3025
|
async readTextFile(_gitRepoRoot, relativePath) {
|
|
3032
3026
|
try {
|
|
3033
|
-
const resolved = await
|
|
3034
|
-
const out = await
|
|
3027
|
+
const resolved = await fs5.resolve(relativePath, "read");
|
|
3028
|
+
const out = await fs5.readText(resolved);
|
|
3035
3029
|
return out.content;
|
|
3036
3030
|
} catch (error2) {
|
|
3037
3031
|
if (isFsError(error2) && error2.kind === "path_not_found") {
|
|
@@ -3052,15 +3046,15 @@ async function ensureDirectoryWithoutSymlink(root, segments) {
|
|
|
3052
3046
|
checkedSegments.push(segment);
|
|
3053
3047
|
const label = `Workspace path "${checkedSegments.join("/")}"`;
|
|
3054
3048
|
try {
|
|
3055
|
-
const
|
|
3056
|
-
if (
|
|
3049
|
+
const stat2 = await fsp3.lstat(current);
|
|
3050
|
+
if (stat2.isSymbolicLink()) {
|
|
3057
3051
|
throw new SetupGithubError(
|
|
3058
3052
|
"github_setup_invalid_workspace",
|
|
3059
3053
|
`${label} must not be a symlink.`,
|
|
3060
3054
|
400
|
|
3061
3055
|
);
|
|
3062
3056
|
}
|
|
3063
|
-
if (!
|
|
3057
|
+
if (!stat2.isDirectory()) {
|
|
3064
3058
|
throw new SetupGithubError(
|
|
3065
3059
|
"github_setup_invalid_workspace",
|
|
3066
3060
|
`${label} must be a directory.`,
|
|
@@ -3097,15 +3091,15 @@ async function ensureDirectoryWithoutSymlink(root, segments) {
|
|
|
3097
3091
|
}
|
|
3098
3092
|
__name(ensureDirectoryWithoutSymlink, "ensureDirectoryWithoutSymlink");
|
|
3099
3093
|
async function assertDirectoryWithoutSymlink(target, label) {
|
|
3100
|
-
const
|
|
3101
|
-
if (
|
|
3094
|
+
const stat2 = await fsp3.lstat(target);
|
|
3095
|
+
if (stat2.isSymbolicLink()) {
|
|
3102
3096
|
throw new SetupGithubError(
|
|
3103
3097
|
"github_setup_invalid_workspace",
|
|
3104
3098
|
`${label} must not be a symlink.`,
|
|
3105
3099
|
400
|
|
3106
3100
|
);
|
|
3107
3101
|
}
|
|
3108
|
-
if (!
|
|
3102
|
+
if (!stat2.isDirectory()) {
|
|
3109
3103
|
throw new SetupGithubError(
|
|
3110
3104
|
"github_setup_invalid_workspace",
|
|
3111
3105
|
`${label} must be a directory.`,
|
|
@@ -4746,12 +4740,12 @@ async function collectWorkspaceMemoryStatus(boundWorkspace) {
|
|
|
4746
4740
|
for (const filename of filenames) {
|
|
4747
4741
|
const candidate = path8.join(globalDir, filename);
|
|
4748
4742
|
try {
|
|
4749
|
-
const
|
|
4750
|
-
if (
|
|
4743
|
+
const stat2 = await fs.stat(candidate);
|
|
4744
|
+
if (stat2.isFile()) {
|
|
4751
4745
|
files.push({
|
|
4752
4746
|
absolutePath: candidate,
|
|
4753
4747
|
scope: "global",
|
|
4754
|
-
bytes:
|
|
4748
|
+
bytes: stat2.size
|
|
4755
4749
|
});
|
|
4756
4750
|
}
|
|
4757
4751
|
} catch (err) {
|
|
@@ -4795,12 +4789,12 @@ async function walkWorkspaceForMemory(start, filenames, errors) {
|
|
|
4795
4789
|
for (const filename of filenames) {
|
|
4796
4790
|
const candidate = path8.join(start, filename);
|
|
4797
4791
|
try {
|
|
4798
|
-
const
|
|
4799
|
-
if (
|
|
4792
|
+
const stat2 = await fs.stat(candidate);
|
|
4793
|
+
if (stat2.isFile()) {
|
|
4800
4794
|
out.push({
|
|
4801
4795
|
absolutePath: candidate,
|
|
4802
4796
|
scope: "workspace",
|
|
4803
|
-
bytes:
|
|
4797
|
+
bytes: stat2.size
|
|
4804
4798
|
});
|
|
4805
4799
|
}
|
|
4806
4800
|
} catch (err) {
|
|
@@ -9052,7 +9046,7 @@ var AcpDispatcher = class {
|
|
|
9052
9046
|
);
|
|
9053
9047
|
return;
|
|
9054
9048
|
}
|
|
9055
|
-
const
|
|
9049
|
+
const fs5 = this.fsFactory.forRequest({
|
|
9056
9050
|
originatorClientId: conn.clientId,
|
|
9057
9051
|
route: `ACP ${method}`
|
|
9058
9052
|
});
|
|
@@ -9104,8 +9098,8 @@ var AcpDispatcher = class {
|
|
|
9104
9098
|
);
|
|
9105
9099
|
return;
|
|
9106
9100
|
}
|
|
9107
|
-
const resolved = await
|
|
9108
|
-
const out = await
|
|
9101
|
+
const resolved = await fs5.resolve(p, "read");
|
|
9102
|
+
const out = await fs5.readText(resolved, { maxBytes, line, limit });
|
|
9109
9103
|
this.replyConn(conn, id, {
|
|
9110
9104
|
path: p,
|
|
9111
9105
|
content: out.content,
|
|
@@ -9127,7 +9121,7 @@ var AcpDispatcher = class {
|
|
|
9127
9121
|
conn.sendConn(error(id, RPC.INVALID_PARAMS, "`path` required"));
|
|
9128
9122
|
return;
|
|
9129
9123
|
}
|
|
9130
|
-
const
|
|
9124
|
+
const fs5 = this.fsFactory.forRequest({
|
|
9131
9125
|
originatorClientId: conn.clientId,
|
|
9132
9126
|
route: `ACP ${method}`
|
|
9133
9127
|
});
|
|
@@ -9163,8 +9157,8 @@ var AcpDispatcher = class {
|
|
|
9163
9157
|
);
|
|
9164
9158
|
return;
|
|
9165
9159
|
}
|
|
9166
|
-
const resolved = await
|
|
9167
|
-
const buf = await
|
|
9160
|
+
const resolved = await fs5.resolve(p, "read");
|
|
9161
|
+
const buf = await fs5.readBytesWindow(resolved, { offset, maxBytes });
|
|
9168
9162
|
this.replyConn(conn, id, { path: p, ...buf });
|
|
9169
9163
|
return;
|
|
9170
9164
|
}
|
|
@@ -9182,12 +9176,12 @@ var AcpDispatcher = class {
|
|
|
9182
9176
|
conn.sendConn(error(id, RPC.INVALID_PARAMS, "`path` required"));
|
|
9183
9177
|
return;
|
|
9184
9178
|
}
|
|
9185
|
-
const
|
|
9179
|
+
const fs5 = this.fsFactory.forRequest({
|
|
9186
9180
|
originatorClientId: conn.clientId,
|
|
9187
9181
|
route: `ACP ${method}`
|
|
9188
9182
|
});
|
|
9189
|
-
const resolved = await
|
|
9190
|
-
const result = await
|
|
9183
|
+
const resolved = await fs5.resolve(p, "read");
|
|
9184
|
+
const result = await fs5.stat(resolved);
|
|
9191
9185
|
this.replyConn(conn, id, { path: p, ...result });
|
|
9192
9186
|
return;
|
|
9193
9187
|
}
|
|
@@ -9205,13 +9199,13 @@ var AcpDispatcher = class {
|
|
|
9205
9199
|
conn.sendConn(error(id, RPC.INVALID_PARAMS, "`path` required"));
|
|
9206
9200
|
return;
|
|
9207
9201
|
}
|
|
9208
|
-
const
|
|
9202
|
+
const fs5 = this.fsFactory.forRequest({
|
|
9209
9203
|
originatorClientId: conn.clientId,
|
|
9210
9204
|
route: `ACP ${method}`
|
|
9211
9205
|
});
|
|
9212
|
-
const resolved = await
|
|
9206
|
+
const resolved = await fs5.resolve(p, "read");
|
|
9213
9207
|
const MAX_LIST = 2e3;
|
|
9214
|
-
const entries = await
|
|
9208
|
+
const entries = await fs5.list(resolved, { maxEntries: MAX_LIST + 1 });
|
|
9215
9209
|
const truncated = entries.length > MAX_LIST;
|
|
9216
9210
|
this.replyConn(conn, id, {
|
|
9217
9211
|
path: p,
|
|
@@ -9236,7 +9230,7 @@ var AcpDispatcher = class {
|
|
|
9236
9230
|
);
|
|
9237
9231
|
return;
|
|
9238
9232
|
}
|
|
9239
|
-
const
|
|
9233
|
+
const fs5 = this.fsFactory.forRequest({
|
|
9240
9234
|
originatorClientId: conn.clientId,
|
|
9241
9235
|
route: `ACP ${method}`
|
|
9242
9236
|
});
|
|
@@ -9256,7 +9250,7 @@ var AcpDispatcher = class {
|
|
|
9256
9250
|
);
|
|
9257
9251
|
return;
|
|
9258
9252
|
}
|
|
9259
|
-
const matches = await
|
|
9253
|
+
const matches = await fs5.glob(pattern, {
|
|
9260
9254
|
maxResults: maxResults + 1
|
|
9261
9255
|
});
|
|
9262
9256
|
const truncated = matches.length > maxResults;
|
|
@@ -9288,11 +9282,11 @@ var AcpDispatcher = class {
|
|
|
9288
9282
|
);
|
|
9289
9283
|
return;
|
|
9290
9284
|
}
|
|
9291
|
-
const
|
|
9285
|
+
const fs5 = this.fsFactory.forRequest({
|
|
9292
9286
|
originatorClientId: conn.clientId,
|
|
9293
9287
|
route: `ACP ${method}`
|
|
9294
9288
|
});
|
|
9295
|
-
const resolved = await
|
|
9289
|
+
const resolved = await fs5.resolve(p, "write");
|
|
9296
9290
|
if (Buffer.byteLength(params["content"], "utf8") > 10 * 1024 * 1024) {
|
|
9297
9291
|
if (id !== void 0)
|
|
9298
9292
|
conn.sendConn(
|
|
@@ -9300,7 +9294,7 @@ var AcpDispatcher = class {
|
|
|
9300
9294
|
);
|
|
9301
9295
|
return;
|
|
9302
9296
|
}
|
|
9303
|
-
await
|
|
9297
|
+
await fs5.writeTextOverwrite(resolved, params["content"]);
|
|
9304
9298
|
this.replyConn(conn, id, { ok: true, path: p });
|
|
9305
9299
|
return;
|
|
9306
9300
|
}
|
|
@@ -9329,12 +9323,12 @@ var AcpDispatcher = class {
|
|
|
9329
9323
|
);
|
|
9330
9324
|
return;
|
|
9331
9325
|
}
|
|
9332
|
-
const
|
|
9326
|
+
const fs5 = this.fsFactory.forRequest({
|
|
9333
9327
|
originatorClientId: conn.clientId,
|
|
9334
9328
|
route: `ACP ${method}`
|
|
9335
9329
|
});
|
|
9336
|
-
const resolved = await
|
|
9337
|
-
const result = await
|
|
9330
|
+
const resolved = await fs5.resolve(p, "write");
|
|
9331
|
+
const result = await fs5.edit(
|
|
9338
9332
|
resolved,
|
|
9339
9333
|
params["oldText"],
|
|
9340
9334
|
params["newText"]
|
|
@@ -17525,13 +17519,13 @@ async function handlePostFileWrite(req, res, deps) {
|
|
|
17525
17519
|
req
|
|
17526
17520
|
);
|
|
17527
17521
|
if (originatorClientId === null) return;
|
|
17528
|
-
const
|
|
17522
|
+
const fs5 = factory.forRequest({
|
|
17529
17523
|
originatorClientId,
|
|
17530
17524
|
route: ROUTE2
|
|
17531
17525
|
});
|
|
17532
17526
|
try {
|
|
17533
|
-
const resolved = await
|
|
17534
|
-
const out = await
|
|
17527
|
+
const resolved = await fs5.resolve(queryPath, "write");
|
|
17528
|
+
const out = await fs5.writeTextAtomic(resolved, content, {
|
|
17535
17529
|
mode,
|
|
17536
17530
|
...expectedHash ? { expectedHash } : {},
|
|
17537
17531
|
...bom !== void 0 ? { bom } : {},
|
|
@@ -17584,13 +17578,13 @@ async function handlePostFileEdit(req, res, deps) {
|
|
|
17584
17578
|
req
|
|
17585
17579
|
);
|
|
17586
17580
|
if (originatorClientId === null) return;
|
|
17587
|
-
const
|
|
17581
|
+
const fs5 = factory.forRequest({
|
|
17588
17582
|
originatorClientId,
|
|
17589
17583
|
route: ROUTE2
|
|
17590
17584
|
});
|
|
17591
17585
|
try {
|
|
17592
|
-
const resolved = await
|
|
17593
|
-
const out = await
|
|
17586
|
+
const resolved = await fs5.resolve(queryPath, "edit");
|
|
17587
|
+
const out = await fs5.editAtomic(resolved, oldText, newText, {
|
|
17594
17588
|
expectedHash
|
|
17595
17589
|
});
|
|
17596
17590
|
applyReadHeaders(res);
|
|
@@ -17918,18 +17912,6 @@ var legacySessionTelemetryRoutes = [
|
|
|
17918
17912
|
attribution: "handler_resolved",
|
|
17919
17913
|
route: "GET /session/:id/tasks"
|
|
17920
17914
|
},
|
|
17921
|
-
{
|
|
17922
|
-
method: "GET",
|
|
17923
|
-
path: "/session/:id/subagents/:toolCallId",
|
|
17924
|
-
attribution: "handler_resolved",
|
|
17925
|
-
route: "GET /session/:id/subagents/:toolCallId"
|
|
17926
|
-
},
|
|
17927
|
-
{
|
|
17928
|
-
method: "POST",
|
|
17929
|
-
path: "/session/:id/subagents/:toolCallId/cancel",
|
|
17930
|
-
attribution: "handler_resolved",
|
|
17931
|
-
route: "POST /session/:id/subagents/:toolCallId/cancel"
|
|
17932
|
-
},
|
|
17933
17915
|
{
|
|
17934
17916
|
method: "GET",
|
|
17935
17917
|
path: "/session/:id/lsp",
|
|
@@ -18612,7 +18594,7 @@ __name(registerPermissionRoutes, "registerPermissionRoutes");
|
|
|
18612
18594
|
// packages/cli/src/serve/routes/session.ts
|
|
18613
18595
|
init_esbuild_shims();
|
|
18614
18596
|
import * as crypto3 from "node:crypto";
|
|
18615
|
-
import * as
|
|
18597
|
+
import * as fs3 from "node:fs";
|
|
18616
18598
|
import * as path10 from "node:path";
|
|
18617
18599
|
|
|
18618
18600
|
// packages/cli/src/serve/server/prompt-deadline.ts
|
|
@@ -19218,714 +19200,6 @@ async function exportSessionTranscript(params) {
|
|
|
19218
19200
|
}
|
|
19219
19201
|
__name(exportSessionTranscript, "exportSessionTranscript");
|
|
19220
19202
|
|
|
19221
|
-
// packages/cli/src/serve/virtual-subagent-sessions.ts
|
|
19222
|
-
init_esbuild_shims();
|
|
19223
|
-
import * as fs3 from "node:fs/promises";
|
|
19224
|
-
import { createReadStream } from "node:fs";
|
|
19225
|
-
import readline from "node:readline";
|
|
19226
|
-
var PREFIX = "subagent.";
|
|
19227
|
-
var POLL_INTERVAL_MS = 250;
|
|
19228
|
-
var TARGET_RETENTION_MS = 6e4;
|
|
19229
|
-
async function readFirstUserText(filePath) {
|
|
19230
|
-
const stream = createReadStream(filePath);
|
|
19231
|
-
const lines = readline.createInterface({
|
|
19232
|
-
input: stream,
|
|
19233
|
-
crlfDelay: Infinity
|
|
19234
|
-
});
|
|
19235
|
-
try {
|
|
19236
|
-
for await (const line of lines) {
|
|
19237
|
-
const trimmed = line.trim();
|
|
19238
|
-
if (!trimmed) continue;
|
|
19239
|
-
for (const record of parseLineTolerant(trimmed, filePath)) {
|
|
19240
|
-
if (record.type !== "user") continue;
|
|
19241
|
-
return record.message?.parts?.find(
|
|
19242
|
-
(part) => typeof part.text === "string"
|
|
19243
|
-
)?.text;
|
|
19244
|
-
}
|
|
19245
|
-
}
|
|
19246
|
-
return void 0;
|
|
19247
|
-
} catch (error2) {
|
|
19248
|
-
if (error2.code === "ENOENT") return void 0;
|
|
19249
|
-
throw error2;
|
|
19250
|
-
} finally {
|
|
19251
|
-
lines.close();
|
|
19252
|
-
stream.destroy();
|
|
19253
|
-
}
|
|
19254
|
-
}
|
|
19255
|
-
__name(readFirstUserText, "readFirstUserText");
|
|
19256
|
-
function asRecord(value) {
|
|
19257
|
-
return typeof value === "object" && value !== null ? value : void 0;
|
|
19258
|
-
}
|
|
19259
|
-
__name(asRecord, "asRecord");
|
|
19260
|
-
function finiteNonNegative(value) {
|
|
19261
|
-
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : void 0;
|
|
19262
|
-
}
|
|
19263
|
-
__name(finiteNonNegative, "finiteNonNegative");
|
|
19264
|
-
function normalizeTaskStatus(status) {
|
|
19265
|
-
if (typeof status !== "string") return void 0;
|
|
19266
|
-
if (status === "success") return "completed";
|
|
19267
|
-
if (status === "error") return "failed";
|
|
19268
|
-
if (status === "background") return "running";
|
|
19269
|
-
return status;
|
|
19270
|
-
}
|
|
19271
|
-
__name(normalizeTaskStatus, "normalizeTaskStatus");
|
|
19272
|
-
function durationBetween(start, end) {
|
|
19273
|
-
if (!end) return void 0;
|
|
19274
|
-
const startTime = Date.parse(start);
|
|
19275
|
-
const endTime = Date.parse(end);
|
|
19276
|
-
return Number.isFinite(startTime) && Number.isFinite(endTime) ? Math.max(0, endTime - startTime) : void 0;
|
|
19277
|
-
}
|
|
19278
|
-
__name(durationBetween, "durationBetween");
|
|
19279
|
-
function findToolCallMetrics(records, toolCallId) {
|
|
19280
|
-
const toolResult = records.find(
|
|
19281
|
-
(record) => record.toolCallResult?.callId === toolCallId
|
|
19282
|
-
)?.toolCallResult;
|
|
19283
|
-
const display = asRecord(toolResult?.resultDisplay);
|
|
19284
|
-
const summary = asRecord(display?.["executionSummary"]);
|
|
19285
|
-
return {
|
|
19286
|
-
status: normalizeTaskStatus(display?.["status"]) ?? normalizeTaskStatus(toolResult?.status),
|
|
19287
|
-
durationMs: finiteNonNegative(summary?.["totalDurationMs"]),
|
|
19288
|
-
totalTokens: finiteNonNegative(summary?.["totalTokens"]) ?? finiteNonNegative(display?.["tokenCount"]),
|
|
19289
|
-
inputTokens: finiteNonNegative(summary?.["inputTokens"]),
|
|
19290
|
-
outputTokens: finiteNonNegative(summary?.["outputTokens"]),
|
|
19291
|
-
cachedTokens: finiteNonNegative(summary?.["cachedTokens"])
|
|
19292
|
-
};
|
|
19293
|
-
}
|
|
19294
|
-
__name(findToolCallMetrics, "findToolCallMetrics");
|
|
19295
|
-
function encodePart(value) {
|
|
19296
|
-
return Buffer.from(value, "utf8").toString("base64url");
|
|
19297
|
-
}
|
|
19298
|
-
__name(encodePart, "encodePart");
|
|
19299
|
-
function decodePart(value) {
|
|
19300
|
-
try {
|
|
19301
|
-
return Buffer.from(value, "base64url").toString("utf8");
|
|
19302
|
-
} catch {
|
|
19303
|
-
return void 0;
|
|
19304
|
-
}
|
|
19305
|
-
}
|
|
19306
|
-
__name(decodePart, "decodePart");
|
|
19307
|
-
function isValidVirtualSessionPart(value) {
|
|
19308
|
-
return /^[a-zA-Z0-9_-]{1,500}$/.test(value);
|
|
19309
|
-
}
|
|
19310
|
-
__name(isValidVirtualSessionPart, "isValidVirtualSessionPart");
|
|
19311
|
-
function createVirtualSubagentSessionId(parentSessionId, agentId) {
|
|
19312
|
-
if (!isValidVirtualSessionPart(parentSessionId) || !isValidVirtualSessionPart(agentId)) {
|
|
19313
|
-
throw new Error("Virtual subagent session ids require valid id parts");
|
|
19314
|
-
}
|
|
19315
|
-
return `${PREFIX}${encodePart(parentSessionId)}.${encodePart(agentId)}`;
|
|
19316
|
-
}
|
|
19317
|
-
__name(createVirtualSubagentSessionId, "createVirtualSubagentSessionId");
|
|
19318
|
-
function parseVirtualSubagentSessionId(sessionId) {
|
|
19319
|
-
if (!sessionId.startsWith(PREFIX) || sessionId.length > 2e3) {
|
|
19320
|
-
return void 0;
|
|
19321
|
-
}
|
|
19322
|
-
const parts = sessionId.slice(PREFIX.length).split(".");
|
|
19323
|
-
if (parts.length !== 2) return void 0;
|
|
19324
|
-
const parentSessionId = decodePart(parts[0]);
|
|
19325
|
-
const agentId = decodePart(parts[1]);
|
|
19326
|
-
if (!parentSessionId || !agentId || !isValidVirtualSessionPart(parentSessionId) || !isValidVirtualSessionPart(agentId)) {
|
|
19327
|
-
return void 0;
|
|
19328
|
-
}
|
|
19329
|
-
return { parentSessionId, agentId };
|
|
19330
|
-
}
|
|
19331
|
-
__name(parseVirtualSubagentSessionId, "parseVirtualSubagentSessionId");
|
|
19332
|
-
function replayCursorState(sessionId, position, leafUuid, startTime, lastUpdated) {
|
|
19333
|
-
return {
|
|
19334
|
-
v: 1,
|
|
19335
|
-
sessionId,
|
|
19336
|
-
fileIdentity: { dev: 0, ino: 0 },
|
|
19337
|
-
snapshotSize: position,
|
|
19338
|
-
position,
|
|
19339
|
-
leafUuid,
|
|
19340
|
-
startTime,
|
|
19341
|
-
lastUpdated
|
|
19342
|
-
};
|
|
19343
|
-
}
|
|
19344
|
-
__name(replayCursorState, "replayCursorState");
|
|
19345
|
-
var VirtualSubagentTarget = class _VirtualSubagentTarget {
|
|
19346
|
-
constructor(sessionId, parentSessionId, task, workspaceCwd, onExpired) {
|
|
19347
|
-
this.sessionId = sessionId;
|
|
19348
|
-
this.parentSessionId = parentSessionId;
|
|
19349
|
-
this.task = task;
|
|
19350
|
-
this.workspaceCwd = workspaceCwd;
|
|
19351
|
-
this.onExpired = onExpired;
|
|
19352
|
-
}
|
|
19353
|
-
static {
|
|
19354
|
-
__name(this, "VirtualSubagentTarget");
|
|
19355
|
-
}
|
|
19356
|
-
bus = new EventBus(1024, 8);
|
|
19357
|
-
events = [];
|
|
19358
|
-
snapshotDelivered = false;
|
|
19359
|
-
offset = 0;
|
|
19360
|
-
transcriptIdentity;
|
|
19361
|
-
streamOffset = 0;
|
|
19362
|
-
streamIdentity;
|
|
19363
|
-
streamReady = false;
|
|
19364
|
-
canonicalThroughTimestamp = 0;
|
|
19365
|
-
completedStreamRounds = /* @__PURE__ */ new Set();
|
|
19366
|
-
streamedRounds = /* @__PURE__ */ new Set();
|
|
19367
|
-
streamRunIds = /* @__PURE__ */ new Set();
|
|
19368
|
-
legacyStreamedSinceCanonical = false;
|
|
19369
|
-
replayState;
|
|
19370
|
-
initialized = false;
|
|
19371
|
-
refreshPromise = Promise.resolve();
|
|
19372
|
-
snapshotPromise = Promise.resolve();
|
|
19373
|
-
pollTimer;
|
|
19374
|
-
subscribers = 0;
|
|
19375
|
-
retentionTimer;
|
|
19376
|
-
updateStatus(status) {
|
|
19377
|
-
const wasRunning = this.task.status === "running";
|
|
19378
|
-
this.task.status = status;
|
|
19379
|
-
if (status !== "running" && this.pollTimer) {
|
|
19380
|
-
clearInterval(this.pollTimer);
|
|
19381
|
-
this.pollTimer = void 0;
|
|
19382
|
-
}
|
|
19383
|
-
if (wasRunning && status !== "running") {
|
|
19384
|
-
void this.refreshLive().catch(() => void 0);
|
|
19385
|
-
}
|
|
19386
|
-
}
|
|
19387
|
-
rememberEvent(event) {
|
|
19388
|
-
if (event && !this.snapshotDelivered) this.events.push(event);
|
|
19389
|
-
}
|
|
19390
|
-
resetCanonicalState() {
|
|
19391
|
-
this.offset = 0;
|
|
19392
|
-
this.replayState = void 0;
|
|
19393
|
-
this.canonicalThroughTimestamp = 0;
|
|
19394
|
-
this.completedStreamRounds.clear();
|
|
19395
|
-
this.streamRunIds.clear();
|
|
19396
|
-
this.streamedRounds.clear();
|
|
19397
|
-
this.legacyStreamedSinceCanonical = false;
|
|
19398
|
-
}
|
|
19399
|
-
resetStreamState() {
|
|
19400
|
-
this.streamOffset = 0;
|
|
19401
|
-
this.completedStreamRounds.clear();
|
|
19402
|
-
this.streamRunIds.clear();
|
|
19403
|
-
this.streamedRounds.clear();
|
|
19404
|
-
this.legacyStreamedSinceCanonical = false;
|
|
19405
|
-
}
|
|
19406
|
-
async readNewRecords(endOffset) {
|
|
19407
|
-
let handle;
|
|
19408
|
-
try {
|
|
19409
|
-
handle = await fs3.open(this.task.outputFile, "r");
|
|
19410
|
-
const stat3 = await handle.stat();
|
|
19411
|
-
const identity = `${stat3.dev}:${stat3.ino}`;
|
|
19412
|
-
if (this.transcriptIdentity !== void 0 && this.transcriptIdentity !== identity || stat3.size < this.offset) {
|
|
19413
|
-
this.resetCanonicalState();
|
|
19414
|
-
}
|
|
19415
|
-
this.transcriptIdentity = identity;
|
|
19416
|
-
const size = Math.min(stat3.size, endOffset ?? stat3.size);
|
|
19417
|
-
if (size <= this.offset) return [];
|
|
19418
|
-
const bytes = Buffer.alloc(size - this.offset);
|
|
19419
|
-
const { bytesRead } = await handle.read(
|
|
19420
|
-
bytes,
|
|
19421
|
-
0,
|
|
19422
|
-
bytes.length,
|
|
19423
|
-
this.offset
|
|
19424
|
-
);
|
|
19425
|
-
const chunk = bytes.subarray(0, bytesRead);
|
|
19426
|
-
const lastNewline = chunk.lastIndexOf(10);
|
|
19427
|
-
if (lastNewline < 0) return [];
|
|
19428
|
-
const complete = chunk.subarray(0, lastNewline + 1);
|
|
19429
|
-
this.offset += complete.length;
|
|
19430
|
-
return complete.toString("utf8").split("\n").flatMap((line) => {
|
|
19431
|
-
const trimmed = line.trim();
|
|
19432
|
-
return trimmed ? parseLineTolerant(trimmed, this.task.outputFile) : [];
|
|
19433
|
-
});
|
|
19434
|
-
} catch (error2) {
|
|
19435
|
-
if (error2.code === "ENOENT") {
|
|
19436
|
-
if (this.transcriptIdentity !== void 0) {
|
|
19437
|
-
this.transcriptIdentity = void 0;
|
|
19438
|
-
this.resetCanonicalState();
|
|
19439
|
-
}
|
|
19440
|
-
return [];
|
|
19441
|
-
}
|
|
19442
|
-
throw error2;
|
|
19443
|
-
} finally {
|
|
19444
|
-
await handle?.close();
|
|
19445
|
-
}
|
|
19446
|
-
}
|
|
19447
|
-
async readStreamUpdates(endOffset) {
|
|
19448
|
-
const replayingExisting = !this.streamReady;
|
|
19449
|
-
this.streamReady = true;
|
|
19450
|
-
const filePath = `${this.task.outputFile}.stream`;
|
|
19451
|
-
let handle;
|
|
19452
|
-
try {
|
|
19453
|
-
handle = await fs3.open(filePath, "r");
|
|
19454
|
-
const stat3 = await handle.stat();
|
|
19455
|
-
const identity = `${stat3.dev}:${stat3.ino}`;
|
|
19456
|
-
if (this.streamIdentity !== void 0 && this.streamIdentity !== identity) {
|
|
19457
|
-
this.resetStreamState();
|
|
19458
|
-
}
|
|
19459
|
-
this.streamIdentity = identity;
|
|
19460
|
-
if (stat3.size < this.streamOffset) this.resetStreamState();
|
|
19461
|
-
const size = Math.min(stat3.size, endOffset ?? stat3.size);
|
|
19462
|
-
if (size <= this.streamOffset) return;
|
|
19463
|
-
const bytes = Buffer.alloc(size - this.streamOffset);
|
|
19464
|
-
const { bytesRead } = await handle.read(
|
|
19465
|
-
bytes,
|
|
19466
|
-
0,
|
|
19467
|
-
bytes.length,
|
|
19468
|
-
this.streamOffset
|
|
19469
|
-
);
|
|
19470
|
-
const chunk = bytes.subarray(0, bytesRead);
|
|
19471
|
-
const lastNewline = chunk.lastIndexOf(10);
|
|
19472
|
-
if (lastNewline < 0) return;
|
|
19473
|
-
const complete = chunk.subarray(0, lastNewline + 1);
|
|
19474
|
-
this.streamOffset += complete.length;
|
|
19475
|
-
const records = complete.toString("utf8").split("\n").flatMap((line) => {
|
|
19476
|
-
const trimmed = line.trim();
|
|
19477
|
-
return trimmed ? parseLineTolerant(trimmed, filePath) : [];
|
|
19478
|
-
});
|
|
19479
|
-
for (const record of records) {
|
|
19480
|
-
if (record.v !== 1 || typeof record.text !== "string" || typeof record.timestamp !== "number") {
|
|
19481
|
-
continue;
|
|
19482
|
-
}
|
|
19483
|
-
const roundKey = typeof record.runId === "string" && typeof record.round === "number" ? `${record.runId}:${record.round}` : void 0;
|
|
19484
|
-
if (typeof record.runId === "string") {
|
|
19485
|
-
this.streamRunIds.add(record.runId);
|
|
19486
|
-
}
|
|
19487
|
-
if ((roundKey ? this.completedStreamRounds.has(roundKey) : record.timestamp <= this.canonicalThroughTimestamp) || replayingExisting && typeof record.round !== "number") {
|
|
19488
|
-
continue;
|
|
19489
|
-
}
|
|
19490
|
-
const event = this.bus.publish({
|
|
19491
|
-
type: "session_update",
|
|
19492
|
-
data: createTranscriptMessageUpdate({
|
|
19493
|
-
role: "assistant",
|
|
19494
|
-
text: record.text,
|
|
19495
|
-
timestamp: record.timestamp,
|
|
19496
|
-
...record.thought ? { thought: true } : {}
|
|
19497
|
-
})
|
|
19498
|
-
});
|
|
19499
|
-
this.rememberEvent(event);
|
|
19500
|
-
if (roundKey) this.streamedRounds.add(roundKey);
|
|
19501
|
-
else this.legacyStreamedSinceCanonical = true;
|
|
19502
|
-
}
|
|
19503
|
-
for (const completed of this.completedStreamRounds) {
|
|
19504
|
-
const runId = completed.slice(0, completed.lastIndexOf(":"));
|
|
19505
|
-
if (!this.streamRunIds.has(runId)) {
|
|
19506
|
-
this.completedStreamRounds.delete(completed);
|
|
19507
|
-
}
|
|
19508
|
-
}
|
|
19509
|
-
} catch (error2) {
|
|
19510
|
-
if (error2.code !== "ENOENT") throw error2;
|
|
19511
|
-
this.streamIdentity = void 0;
|
|
19512
|
-
this.streamOffset = 0;
|
|
19513
|
-
this.streamRunIds.clear();
|
|
19514
|
-
this.streamedRounds.clear();
|
|
19515
|
-
this.legacyStreamedSinceCanonical = false;
|
|
19516
|
-
} finally {
|
|
19517
|
-
await handle?.close();
|
|
19518
|
-
}
|
|
19519
|
-
}
|
|
19520
|
-
refreshOnce = /* @__PURE__ */ __name(async (endOffset) => {
|
|
19521
|
-
let records = await this.readNewRecords(endOffset);
|
|
19522
|
-
if (records.length === 0) {
|
|
19523
|
-
this.initialized = true;
|
|
19524
|
-
return;
|
|
19525
|
-
}
|
|
19526
|
-
for (const record of records) {
|
|
19527
|
-
if (record.type === "assistant" && (record.usageMetadata !== void 0 || record.message?.parts?.some((part) => typeof part.text === "string"))) {
|
|
19528
|
-
if (typeof record.agentRunId === "string" && typeof record.agentRound === "number") {
|
|
19529
|
-
this.completedStreamRounds.add(
|
|
19530
|
-
`${record.agentRunId}:${record.agentRound}`
|
|
19531
|
-
);
|
|
19532
|
-
}
|
|
19533
|
-
const timestamp = Date.parse(record.timestamp);
|
|
19534
|
-
if (Number.isFinite(timestamp)) {
|
|
19535
|
-
this.canonicalThroughTimestamp = Math.max(
|
|
19536
|
-
this.canonicalThroughTimestamp,
|
|
19537
|
-
timestamp
|
|
19538
|
-
);
|
|
19539
|
-
}
|
|
19540
|
-
}
|
|
19541
|
-
}
|
|
19542
|
-
if (this.streamedRounds.size > 0 || this.legacyStreamedSinceCanonical) {
|
|
19543
|
-
records = records.filter((record) => {
|
|
19544
|
-
const roundKey = typeof record.agentRunId === "string" && typeof record.agentRound === "number" ? `${record.agentRunId}:${record.agentRound}` : void 0;
|
|
19545
|
-
if (roundKey && this.streamedRounds.delete(roundKey)) return false;
|
|
19546
|
-
if (!this.legacyStreamedSinceCanonical || record.type !== "assistant" || record.message?.parts?.some((part) => part.functionCall)) {
|
|
19547
|
-
return true;
|
|
19548
|
-
}
|
|
19549
|
-
this.legacyStreamedSinceCanonical = false;
|
|
19550
|
-
return false;
|
|
19551
|
-
});
|
|
19552
|
-
if (records.length === 0) {
|
|
19553
|
-
this.initialized = true;
|
|
19554
|
-
return;
|
|
19555
|
-
}
|
|
19556
|
-
}
|
|
19557
|
-
const startTime = records[0]?.timestamp ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
19558
|
-
const lastUpdated = records[records.length - 1]?.timestamp ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
19559
|
-
const page = {
|
|
19560
|
-
sessionId: this.sessionId,
|
|
19561
|
-
filePath: this.task.outputFile,
|
|
19562
|
-
records,
|
|
19563
|
-
gaps: [],
|
|
19564
|
-
hasMore: true,
|
|
19565
|
-
replay: this.replayState,
|
|
19566
|
-
startTime,
|
|
19567
|
-
lastUpdated,
|
|
19568
|
-
nextCursorState: replayCursorState(
|
|
19569
|
-
this.sessionId,
|
|
19570
|
-
this.offset,
|
|
19571
|
-
records[records.length - 1]?.uuid ?? "",
|
|
19572
|
-
startTime,
|
|
19573
|
-
lastUpdated
|
|
19574
|
-
)
|
|
19575
|
-
};
|
|
19576
|
-
let nextReplayState;
|
|
19577
|
-
const replay = await replayTranscriptRecordPage({
|
|
19578
|
-
sessionId: this.sessionId,
|
|
19579
|
-
page,
|
|
19580
|
-
encodeCursor: /* @__PURE__ */ __name((state) => {
|
|
19581
|
-
nextReplayState = state.replay;
|
|
19582
|
-
return "virtual-subagent-replay";
|
|
19583
|
-
}, "encodeCursor")
|
|
19584
|
-
});
|
|
19585
|
-
this.replayState = nextReplayState;
|
|
19586
|
-
const inputs = replay.updates.map((update) => ({
|
|
19587
|
-
type: "session_update",
|
|
19588
|
-
data: update
|
|
19589
|
-
}));
|
|
19590
|
-
const published = this.initialized ? inputs.flatMap((input) => {
|
|
19591
|
-
const event = this.bus.publish(input);
|
|
19592
|
-
return event ? [event] : [];
|
|
19593
|
-
}) : this.bus.seedReplayEvents(inputs);
|
|
19594
|
-
if (!this.snapshotDelivered) this.events.push(...published);
|
|
19595
|
-
this.initialized = true;
|
|
19596
|
-
}, "refreshOnce");
|
|
19597
|
-
refreshAt(bounds) {
|
|
19598
|
-
return this.refreshOnce(bounds?.transcript).then(async () => {
|
|
19599
|
-
if (this.task.status === "running") {
|
|
19600
|
-
await this.readStreamUpdates(bounds?.stream);
|
|
19601
|
-
}
|
|
19602
|
-
});
|
|
19603
|
-
}
|
|
19604
|
-
enqueueRefresh(work) {
|
|
19605
|
-
const result = this.refreshPromise.catch(() => void 0).then(work);
|
|
19606
|
-
this.refreshPromise = result.then(
|
|
19607
|
-
() => void 0,
|
|
19608
|
-
() => void 0
|
|
19609
|
-
);
|
|
19610
|
-
return result;
|
|
19611
|
-
}
|
|
19612
|
-
refreshLive() {
|
|
19613
|
-
return this.enqueueRefresh(() => this.refreshAt());
|
|
19614
|
-
}
|
|
19615
|
-
async captureReadBounds() {
|
|
19616
|
-
const size = /* @__PURE__ */ __name(async (filePath) => {
|
|
19617
|
-
try {
|
|
19618
|
-
return (await fs3.stat(filePath)).size;
|
|
19619
|
-
} catch (error2) {
|
|
19620
|
-
if (error2.code === "ENOENT") return 0;
|
|
19621
|
-
throw error2;
|
|
19622
|
-
}
|
|
19623
|
-
}, "size");
|
|
19624
|
-
const [transcript, stream] = await Promise.all([
|
|
19625
|
-
size(this.task.outputFile),
|
|
19626
|
-
size(`${this.task.outputFile}.stream`)
|
|
19627
|
-
]);
|
|
19628
|
-
return { transcript, stream };
|
|
19629
|
-
}
|
|
19630
|
-
async createSnapshotOnce() {
|
|
19631
|
-
if (!this.snapshotDelivered) {
|
|
19632
|
-
await this.refreshLive();
|
|
19633
|
-
const snapshot = [...this.events];
|
|
19634
|
-
this.events.length = 0;
|
|
19635
|
-
this.snapshotDelivered = true;
|
|
19636
|
-
return { events: snapshot, lastEventId: this.bus.lastEventId };
|
|
19637
|
-
}
|
|
19638
|
-
return this.enqueueRefresh(async () => {
|
|
19639
|
-
const bounds = await this.captureReadBounds();
|
|
19640
|
-
const target = new _VirtualSubagentTarget(
|
|
19641
|
-
this.sessionId,
|
|
19642
|
-
this.parentSessionId,
|
|
19643
|
-
this.task,
|
|
19644
|
-
this.workspaceCwd,
|
|
19645
|
-
() => void 0
|
|
19646
|
-
);
|
|
19647
|
-
await target.refreshAt(bounds);
|
|
19648
|
-
await this.refreshAt(bounds);
|
|
19649
|
-
return {
|
|
19650
|
-
events: [...target.events],
|
|
19651
|
-
lastEventId: this.bus.lastEventId
|
|
19652
|
-
};
|
|
19653
|
-
});
|
|
19654
|
-
}
|
|
19655
|
-
createSnapshot() {
|
|
19656
|
-
const snapshot = this.snapshotPromise.then(() => this.createSnapshotOnce());
|
|
19657
|
-
this.snapshotPromise = snapshot.then(
|
|
19658
|
-
() => void 0,
|
|
19659
|
-
() => void 0
|
|
19660
|
-
);
|
|
19661
|
-
return snapshot;
|
|
19662
|
-
}
|
|
19663
|
-
async load(clientId) {
|
|
19664
|
-
const snapshot = await this.createSnapshot();
|
|
19665
|
-
if (this.subscribers === 0) this.scheduleRetention();
|
|
19666
|
-
return {
|
|
19667
|
-
sessionId: this.sessionId,
|
|
19668
|
-
workspaceCwd: this.workspaceCwd,
|
|
19669
|
-
attached: true,
|
|
19670
|
-
...clientId ? { clientId } : {},
|
|
19671
|
-
createdAt: new Date(this.task.startTime).toISOString(),
|
|
19672
|
-
hasActivePrompt: this.task.status === "running",
|
|
19673
|
-
state: {},
|
|
19674
|
-
compactedReplay: snapshot.events,
|
|
19675
|
-
liveJournal: [],
|
|
19676
|
-
historyHasMore: false,
|
|
19677
|
-
lastEventId: snapshot.lastEventId
|
|
19678
|
-
};
|
|
19679
|
-
}
|
|
19680
|
-
async *iterate(opts) {
|
|
19681
|
-
if (this.retentionTimer) {
|
|
19682
|
-
clearTimeout(this.retentionTimer);
|
|
19683
|
-
this.retentionTimer = void 0;
|
|
19684
|
-
}
|
|
19685
|
-
this.subscribers++;
|
|
19686
|
-
try {
|
|
19687
|
-
await this.refreshLive();
|
|
19688
|
-
if (!this.snapshotDelivered) {
|
|
19689
|
-
this.events.length = 0;
|
|
19690
|
-
this.snapshotDelivered = true;
|
|
19691
|
-
}
|
|
19692
|
-
if (this.task.status === "running" && !this.pollTimer) {
|
|
19693
|
-
this.pollTimer = setInterval(() => {
|
|
19694
|
-
void this.refreshLive().catch(() => void 0);
|
|
19695
|
-
}, POLL_INTERVAL_MS);
|
|
19696
|
-
this.pollTimer.unref();
|
|
19697
|
-
}
|
|
19698
|
-
yield* this.bus.subscribe(opts);
|
|
19699
|
-
} finally {
|
|
19700
|
-
this.subscribers--;
|
|
19701
|
-
if (this.subscribers === 0) {
|
|
19702
|
-
if (this.pollTimer) clearInterval(this.pollTimer);
|
|
19703
|
-
this.pollTimer = void 0;
|
|
19704
|
-
this.scheduleRetention();
|
|
19705
|
-
}
|
|
19706
|
-
}
|
|
19707
|
-
}
|
|
19708
|
-
subscribe(opts) {
|
|
19709
|
-
return {
|
|
19710
|
-
[Symbol.asyncIterator]: () => this.iterate(opts)
|
|
19711
|
-
};
|
|
19712
|
-
}
|
|
19713
|
-
scheduleRetention() {
|
|
19714
|
-
if (this.retentionTimer) clearTimeout(this.retentionTimer);
|
|
19715
|
-
this.retentionTimer = setTimeout(this.onExpired, TARGET_RETENTION_MS);
|
|
19716
|
-
this.retentionTimer.unref();
|
|
19717
|
-
}
|
|
19718
|
-
};
|
|
19719
|
-
var VirtualSubagentSessions = class {
|
|
19720
|
-
static {
|
|
19721
|
-
__name(this, "VirtualSubagentSessions");
|
|
19722
|
-
}
|
|
19723
|
-
targets = /* @__PURE__ */ new Map();
|
|
19724
|
-
async findTask(runtime, parentSessionId, predicate) {
|
|
19725
|
-
const status = await runtime.bridge.getSessionTasksStatus(parentSessionId);
|
|
19726
|
-
const task = status.tasks.find(
|
|
19727
|
-
(candidate) => candidate.kind === "agent" && typeof candidate.outputFile === "string" && predicate(candidate)
|
|
19728
|
-
);
|
|
19729
|
-
if (task?.kind === "agent" && task.outputFile) {
|
|
19730
|
-
return {
|
|
19731
|
-
id: task.id,
|
|
19732
|
-
title: task.label,
|
|
19733
|
-
outputFile: task.outputFile,
|
|
19734
|
-
status: task.status,
|
|
19735
|
-
startTime: task.startTime,
|
|
19736
|
-
durationMs: task.stats?.durationMs ?? (task.endTime === void 0 ? void 0 : Math.max(0, task.endTime - task.startTime)),
|
|
19737
|
-
totalTokens: task.stats?.totalTokens
|
|
19738
|
-
};
|
|
19739
|
-
}
|
|
19740
|
-
const runtimeDir = runtime.env.effectiveEnv?.["QWEN_RUNTIME_DIR"];
|
|
19741
|
-
const projectDir = Storage.runWithRuntimeBaseDir(
|
|
19742
|
-
runtimeDir,
|
|
19743
|
-
runtime.workspaceCwd,
|
|
19744
|
-
() => new Storage(runtime.workspaceCwd).getProjectDir()
|
|
19745
|
-
);
|
|
19746
|
-
const sessionDir = getSubagentSessionDir(projectDir, parentSessionId);
|
|
19747
|
-
let names;
|
|
19748
|
-
try {
|
|
19749
|
-
names = await fs3.readdir(sessionDir);
|
|
19750
|
-
} catch (error2) {
|
|
19751
|
-
if (error2.code === "ENOENT") return void 0;
|
|
19752
|
-
throw error2;
|
|
19753
|
-
}
|
|
19754
|
-
for (const name of names) {
|
|
19755
|
-
if (!name.endsWith(".meta.json")) continue;
|
|
19756
|
-
const metaPath = `${sessionDir}/${name}`;
|
|
19757
|
-
const meta = readAgentMeta(metaPath);
|
|
19758
|
-
if (!meta || !predicate({
|
|
19759
|
-
kind: "agent",
|
|
19760
|
-
id: meta.agentId,
|
|
19761
|
-
toolUseId: meta.toolUseId,
|
|
19762
|
-
outputFile: metaPath.slice(0, -".meta.json".length) + ".jsonl"
|
|
19763
|
-
})) {
|
|
19764
|
-
continue;
|
|
19765
|
-
}
|
|
19766
|
-
return {
|
|
19767
|
-
id: meta.agentId,
|
|
19768
|
-
title: meta.description || meta.agentType,
|
|
19769
|
-
outputFile: metaPath.slice(0, -".meta.json".length) + ".jsonl",
|
|
19770
|
-
status: meta.status ?? "completed",
|
|
19771
|
-
startTime: Number.isFinite(Date.parse(meta.createdAt)) ? Date.parse(meta.createdAt) : Date.now(),
|
|
19772
|
-
durationMs: durationBetween(meta.createdAt, meta.lastUpdatedAt)
|
|
19773
|
-
};
|
|
19774
|
-
}
|
|
19775
|
-
return void 0;
|
|
19776
|
-
}
|
|
19777
|
-
async findLegacyTaskByToolCall(runtime, parentSessionId, toolCallId) {
|
|
19778
|
-
const runtimeDir = runtime.env.effectiveEnv?.["QWEN_RUNTIME_DIR"];
|
|
19779
|
-
const projectDir = Storage.runWithRuntimeBaseDir(
|
|
19780
|
-
runtimeDir,
|
|
19781
|
-
runtime.workspaceCwd,
|
|
19782
|
-
() => new Storage(runtime.workspaceCwd).getProjectDir()
|
|
19783
|
-
);
|
|
19784
|
-
const parentRecords = await read(
|
|
19785
|
-
`${projectDir}/chats/${parentSessionId}.jsonl`
|
|
19786
|
-
);
|
|
19787
|
-
let root;
|
|
19788
|
-
for (const record of parentRecords) {
|
|
19789
|
-
for (const part of record.message?.parts ?? []) {
|
|
19790
|
-
const call = part.functionCall;
|
|
19791
|
-
if (call?.id !== toolCallId || call.name !== "agent") continue;
|
|
19792
|
-
const args = call.args;
|
|
19793
|
-
root = {
|
|
19794
|
-
timestamp: Date.parse(record.timestamp),
|
|
19795
|
-
...typeof args?.["description"] === "string" ? { description: args["description"] } : {},
|
|
19796
|
-
...typeof args?.["prompt"] === "string" ? { prompt: args["prompt"] } : {},
|
|
19797
|
-
...typeof args?.["subagent_type"] === "string" ? { agentType: args["subagent_type"] } : {}
|
|
19798
|
-
};
|
|
19799
|
-
break;
|
|
19800
|
-
}
|
|
19801
|
-
if (root) break;
|
|
19802
|
-
}
|
|
19803
|
-
if (!root) return void 0;
|
|
19804
|
-
const sessionDir = getSubagentSessionDir(projectDir, parentSessionId);
|
|
19805
|
-
let names;
|
|
19806
|
-
try {
|
|
19807
|
-
names = await fs3.readdir(sessionDir);
|
|
19808
|
-
} catch (error2) {
|
|
19809
|
-
if (error2.code === "ENOENT") return void 0;
|
|
19810
|
-
throw error2;
|
|
19811
|
-
}
|
|
19812
|
-
const candidates = [];
|
|
19813
|
-
for (const name of names) {
|
|
19814
|
-
if (!name.endsWith(".meta.json")) continue;
|
|
19815
|
-
const metaPath = `${sessionDir}/${name}`;
|
|
19816
|
-
const meta = readAgentMeta(metaPath);
|
|
19817
|
-
if (!meta) continue;
|
|
19818
|
-
const outputFile = metaPath.slice(0, -".meta.json".length) + ".jsonl";
|
|
19819
|
-
const launchPrompt = await readFirstUserText(outputFile);
|
|
19820
|
-
let score = 0;
|
|
19821
|
-
if (root.prompt && launchPrompt === root.prompt) score += 8;
|
|
19822
|
-
if (root.description && meta.description === root.description) score += 4;
|
|
19823
|
-
if (root.agentType && meta.agentType === root.agentType) score += 2;
|
|
19824
|
-
const startTime = Date.parse(meta.createdAt);
|
|
19825
|
-
const delta = Math.abs(startTime - root.timestamp);
|
|
19826
|
-
if (Number.isFinite(delta) && delta <= 6e4) score += 1;
|
|
19827
|
-
if (score === 0) continue;
|
|
19828
|
-
candidates.push({
|
|
19829
|
-
id: meta.agentId,
|
|
19830
|
-
title: meta.description || meta.agentType,
|
|
19831
|
-
outputFile,
|
|
19832
|
-
status: meta.status ?? "completed",
|
|
19833
|
-
startTime: Number.isFinite(startTime) ? startTime : Date.now(),
|
|
19834
|
-
durationMs: durationBetween(meta.createdAt, meta.lastUpdatedAt),
|
|
19835
|
-
score,
|
|
19836
|
-
delta
|
|
19837
|
-
});
|
|
19838
|
-
}
|
|
19839
|
-
candidates.sort((a, b) => b.score - a.score || a.delta - b.delta);
|
|
19840
|
-
const selected = candidates[0];
|
|
19841
|
-
if (!selected) return void 0;
|
|
19842
|
-
const metrics = findToolCallMetrics(parentRecords, toolCallId);
|
|
19843
|
-
return {
|
|
19844
|
-
...selected,
|
|
19845
|
-
status: metrics.status ?? selected.status,
|
|
19846
|
-
durationMs: metrics.durationMs ?? selected.durationMs,
|
|
19847
|
-
totalTokens: metrics.totalTokens ?? selected.totalTokens,
|
|
19848
|
-
inputTokens: metrics.inputTokens ?? selected.inputTokens,
|
|
19849
|
-
outputTokens: metrics.outputTokens ?? selected.outputTokens,
|
|
19850
|
-
cachedTokens: metrics.cachedTokens ?? selected.cachedTokens
|
|
19851
|
-
};
|
|
19852
|
-
}
|
|
19853
|
-
async readParentToolCallMetrics(runtime, parentSessionId, toolCallId) {
|
|
19854
|
-
const runtimeDir = runtime.env.effectiveEnv?.["QWEN_RUNTIME_DIR"];
|
|
19855
|
-
const projectDir = Storage.runWithRuntimeBaseDir(
|
|
19856
|
-
runtimeDir,
|
|
19857
|
-
runtime.workspaceCwd,
|
|
19858
|
-
() => new Storage(runtime.workspaceCwd).getProjectDir()
|
|
19859
|
-
);
|
|
19860
|
-
const records = await read(
|
|
19861
|
-
`${projectDir}/chats/${parentSessionId}.jsonl`
|
|
19862
|
-
);
|
|
19863
|
-
return findToolCallMetrics(records, toolCallId);
|
|
19864
|
-
}
|
|
19865
|
-
async resolve(runtime, parentSessionId, toolCallId) {
|
|
19866
|
-
let task = await this.findTask(
|
|
19867
|
-
runtime,
|
|
19868
|
-
parentSessionId,
|
|
19869
|
-
(candidate) => candidate.toolUseId === toolCallId || candidate.id.endsWith(`-${toolCallId}`)
|
|
19870
|
-
);
|
|
19871
|
-
const metrics = task && task.status !== "running" ? await this.readParentToolCallMetrics(
|
|
19872
|
-
runtime,
|
|
19873
|
-
parentSessionId,
|
|
19874
|
-
toolCallId
|
|
19875
|
-
) : void 0;
|
|
19876
|
-
task ??= await this.findLegacyTaskByToolCall(
|
|
19877
|
-
runtime,
|
|
19878
|
-
parentSessionId,
|
|
19879
|
-
toolCallId
|
|
19880
|
-
);
|
|
19881
|
-
if (!task) return void 0;
|
|
19882
|
-
const sessionId = createVirtualSubagentSessionId(parentSessionId, task.id);
|
|
19883
|
-
const status = task.status;
|
|
19884
|
-
this.targets.get(`${runtime.workspaceId}:${sessionId}`)?.updateStatus(status);
|
|
19885
|
-
return {
|
|
19886
|
-
sessionId,
|
|
19887
|
-
taskId: task.id,
|
|
19888
|
-
title: task.title,
|
|
19889
|
-
status,
|
|
19890
|
-
durationMs: metrics?.durationMs ?? task.durationMs,
|
|
19891
|
-
totalTokens: metrics?.totalTokens ?? task.totalTokens,
|
|
19892
|
-
inputTokens: metrics?.inputTokens ?? task.inputTokens,
|
|
19893
|
-
outputTokens: metrics?.outputTokens ?? task.outputTokens,
|
|
19894
|
-
cachedTokens: metrics?.cachedTokens ?? task.cachedTokens
|
|
19895
|
-
};
|
|
19896
|
-
}
|
|
19897
|
-
async getTarget(runtime, sessionId) {
|
|
19898
|
-
const targetKey = `${runtime.workspaceId}:${sessionId}`;
|
|
19899
|
-
const cached = this.targets.get(targetKey);
|
|
19900
|
-
if (cached) return cached;
|
|
19901
|
-
const key = parseVirtualSubagentSessionId(sessionId);
|
|
19902
|
-
if (!key) return void 0;
|
|
19903
|
-
const task = await this.findTask(
|
|
19904
|
-
runtime,
|
|
19905
|
-
key.parentSessionId,
|
|
19906
|
-
(candidate) => candidate.id === key.agentId
|
|
19907
|
-
);
|
|
19908
|
-
if (!task) return void 0;
|
|
19909
|
-
const existing = this.targets.get(targetKey);
|
|
19910
|
-
if (existing) return existing;
|
|
19911
|
-
const target = new VirtualSubagentTarget(
|
|
19912
|
-
sessionId,
|
|
19913
|
-
key.parentSessionId,
|
|
19914
|
-
task,
|
|
19915
|
-
runtime.workspaceCwd,
|
|
19916
|
-
() => this.targets.delete(targetKey)
|
|
19917
|
-
);
|
|
19918
|
-
this.targets.set(targetKey, target);
|
|
19919
|
-
return target;
|
|
19920
|
-
}
|
|
19921
|
-
async load(runtime, sessionId, clientId) {
|
|
19922
|
-
return (await this.getTarget(runtime, sessionId))?.load(clientId);
|
|
19923
|
-
}
|
|
19924
|
-
async subscribe(runtime, sessionId, opts) {
|
|
19925
|
-
return (await this.getTarget(runtime, sessionId))?.subscribe(opts);
|
|
19926
|
-
}
|
|
19927
|
-
};
|
|
19928
|
-
|
|
19929
19203
|
// packages/cli/src/serve/routes/session.ts
|
|
19930
19204
|
var WORKSPACE_TRANSCRIPT_RESPONSE_MAX_BYTES = 32 * 1024 * 1024;
|
|
19931
19205
|
var WORKSPACE_TRANSCRIPT_CURSOR_MAX_BYTES = 64 * 1024;
|
|
@@ -19988,8 +19262,8 @@ function isReadOnlyWorkspaceInspection(runtime) {
|
|
|
19988
19262
|
return !runtime.primary && !runtime.trusted;
|
|
19989
19263
|
}
|
|
19990
19264
|
__name(isReadOnlyWorkspaceInspection, "isReadOnlyWorkspaceInspection");
|
|
19991
|
-
function runWorkspaceInspectionWithLogPolicy(runtime,
|
|
19992
|
-
return isReadOnlyWorkspaceInspection(runtime) ? runWithoutDebugLogSession(
|
|
19265
|
+
function runWorkspaceInspectionWithLogPolicy(runtime, read) {
|
|
19266
|
+
return isReadOnlyWorkspaceInspection(runtime) ? runWithoutDebugLogSession(read) : read();
|
|
19993
19267
|
}
|
|
19994
19268
|
__name(runWorkspaceInspectionWithLogPolicy, "runWorkspaceInspectionWithLogPolicy");
|
|
19995
19269
|
function requireSessionArtifactClientId(clientId, res) {
|
|
@@ -20152,8 +19426,7 @@ function registerSessionRoutes(app, deps) {
|
|
|
20152
19426
|
sendBridgeError: sendBridgeError2,
|
|
20153
19427
|
daemonLog,
|
|
20154
19428
|
promptDeadlineMs,
|
|
20155
|
-
sessionShellCommandEnabled
|
|
20156
|
-
virtualSubagentSessions
|
|
19429
|
+
sessionShellCommandEnabled
|
|
20157
19430
|
} = deps;
|
|
20158
19431
|
const LANGUAGE_CODES = deps.languageCodes;
|
|
20159
19432
|
const transcriptCursorMasterKey = crypto3.randomBytes(32);
|
|
@@ -20922,55 +20195,6 @@ function registerSessionRoutes(app, deps) {
|
|
|
20922
20195
|
const restoreSessionHandler = /* @__PURE__ */ __name((action) => async (req, res) => {
|
|
20923
20196
|
const sessionId = requireSessionId(req, res);
|
|
20924
20197
|
if (!sessionId) return;
|
|
20925
|
-
const virtualKey = parseVirtualSubagentSessionId(sessionId);
|
|
20926
|
-
if (virtualKey) {
|
|
20927
|
-
const route2 = `POST /session/:id/${action}`;
|
|
20928
|
-
if (action !== "load") {
|
|
20929
|
-
res.status(400).json({
|
|
20930
|
-
error: `Virtual subagent sessions do not support ${action}`,
|
|
20931
|
-
code: "unsupported_action",
|
|
20932
|
-
sessionId
|
|
20933
|
-
});
|
|
20934
|
-
return;
|
|
20935
|
-
}
|
|
20936
|
-
if (!virtualSubagentSessions) {
|
|
20937
|
-
res.status(404).json({
|
|
20938
|
-
error: `No session with id "${sessionId}"`,
|
|
20939
|
-
code: "session_not_found",
|
|
20940
|
-
sessionId
|
|
20941
|
-
});
|
|
20942
|
-
return;
|
|
20943
|
-
}
|
|
20944
|
-
const runtime2 = requireSessionRuntime({
|
|
20945
|
-
sessionId: virtualKey.parentSessionId,
|
|
20946
|
-
route: route2,
|
|
20947
|
-
res,
|
|
20948
|
-
workspaceRegistry,
|
|
20949
|
-
daemonLog
|
|
20950
|
-
});
|
|
20951
|
-
if (!runtime2) return;
|
|
20952
|
-
const clientId2 = parseClientIdHeader(req, res);
|
|
20953
|
-
if (clientId2 === null) return;
|
|
20954
|
-
try {
|
|
20955
|
-
const session = await virtualSubagentSessions.load(
|
|
20956
|
-
runtime2,
|
|
20957
|
-
sessionId,
|
|
20958
|
-
clientId2
|
|
20959
|
-
);
|
|
20960
|
-
if (!session) {
|
|
20961
|
-
res.status(404).json({
|
|
20962
|
-
error: "Subagent session not found",
|
|
20963
|
-
code: "session_not_found",
|
|
20964
|
-
sessionId
|
|
20965
|
-
});
|
|
20966
|
-
return;
|
|
20967
|
-
}
|
|
20968
|
-
res.status(200).json(session);
|
|
20969
|
-
} catch (err) {
|
|
20970
|
-
sendBridgeError2(res, err, { route: route2, sessionId });
|
|
20971
|
-
}
|
|
20972
|
-
return;
|
|
20973
|
-
}
|
|
20974
20198
|
const body = safeBody(req);
|
|
20975
20199
|
const route = `POST /session/:id/${action}`;
|
|
20976
20200
|
let resolvedRuntime;
|
|
@@ -21060,7 +20284,7 @@ function registerSessionRoutes(app, deps) {
|
|
|
21060
20284
|
path10.join(workspaceCwd, ".qwen", "worktrees")
|
|
21061
20285
|
];
|
|
21062
20286
|
try {
|
|
21063
|
-
realTarget =
|
|
20287
|
+
realTarget = fs3.realpathSync(sidecar.worktreePath);
|
|
21064
20288
|
let repoTop = null;
|
|
21065
20289
|
try {
|
|
21066
20290
|
repoTop = await new GitWorktreeService(
|
|
@@ -21073,7 +20297,7 @@ function registerSessionRoutes(app, deps) {
|
|
|
21073
20297
|
}
|
|
21074
20298
|
const contained = candidateRoots.some((root) => {
|
|
21075
20299
|
try {
|
|
21076
|
-
const realRoot =
|
|
20300
|
+
const realRoot = fs3.realpathSync(root);
|
|
21077
20301
|
const rel = path10.relative(realRoot, realTarget);
|
|
21078
20302
|
return !rel.startsWith("..") && !path10.isAbsolute(rel);
|
|
21079
20303
|
} catch {
|
|
@@ -21128,112 +20352,6 @@ function registerSessionRoutes(app, deps) {
|
|
|
21128
20352
|
}, "restoreSessionHandler");
|
|
21129
20353
|
app.post("/session/:id/load", mutate(), restoreSessionHandler("load"));
|
|
21130
20354
|
app.post("/session/:id/resume", mutate(), restoreSessionHandler("resume"));
|
|
21131
|
-
app.get("/session/:id/subagents/:toolCallId", async (req, res) => {
|
|
21132
|
-
const route = "GET /session/:id/subagents/:toolCallId";
|
|
21133
|
-
const sessionId = requireSessionId(req, res);
|
|
21134
|
-
if (!sessionId) return;
|
|
21135
|
-
if (!virtualSubagentSessions) {
|
|
21136
|
-
res.status(404).json({
|
|
21137
|
-
error: `No session with id "${sessionId}"`,
|
|
21138
|
-
code: "session_not_found",
|
|
21139
|
-
sessionId
|
|
21140
|
-
});
|
|
21141
|
-
return;
|
|
21142
|
-
}
|
|
21143
|
-
const toolCallId = req.params["toolCallId"];
|
|
21144
|
-
if (!toolCallId || toolCallId.length > 500) {
|
|
21145
|
-
res.status(400).json({
|
|
21146
|
-
error: "`toolCallId` must be a non-empty tool call id",
|
|
21147
|
-
code: "invalid_tool_call_id"
|
|
21148
|
-
});
|
|
21149
|
-
return;
|
|
21150
|
-
}
|
|
21151
|
-
const runtime = requireSessionRuntime({
|
|
21152
|
-
sessionId,
|
|
21153
|
-
route,
|
|
21154
|
-
res,
|
|
21155
|
-
workspaceRegistry,
|
|
21156
|
-
daemonLog
|
|
21157
|
-
});
|
|
21158
|
-
if (!runtime) return;
|
|
21159
|
-
try {
|
|
21160
|
-
const resolved = await virtualSubagentSessions.resolve(
|
|
21161
|
-
runtime,
|
|
21162
|
-
sessionId,
|
|
21163
|
-
toolCallId
|
|
21164
|
-
);
|
|
21165
|
-
if (!resolved) {
|
|
21166
|
-
res.status(404).json({
|
|
21167
|
-
error: "Subagent session not found",
|
|
21168
|
-
code: "session_not_found",
|
|
21169
|
-
sessionId,
|
|
21170
|
-
toolCallId
|
|
21171
|
-
});
|
|
21172
|
-
return;
|
|
21173
|
-
}
|
|
21174
|
-
res.status(200).set("Cache-Control", "no-store").json(resolved);
|
|
21175
|
-
} catch (err) {
|
|
21176
|
-
sendBridgeError2(res, err, { route, sessionId });
|
|
21177
|
-
}
|
|
21178
|
-
});
|
|
21179
|
-
app.post(
|
|
21180
|
-
"/session/:id/subagents/:toolCallId/cancel",
|
|
21181
|
-
mutate(),
|
|
21182
|
-
async (req, res) => {
|
|
21183
|
-
const route = "POST /session/:id/subagents/:toolCallId/cancel";
|
|
21184
|
-
const sessionId = requireSessionId(req, res);
|
|
21185
|
-
if (!sessionId) return;
|
|
21186
|
-
if (!virtualSubagentSessions) {
|
|
21187
|
-
res.status(404).json({
|
|
21188
|
-
error: `No session with id "${sessionId}"`,
|
|
21189
|
-
code: "session_not_found",
|
|
21190
|
-
sessionId
|
|
21191
|
-
});
|
|
21192
|
-
return;
|
|
21193
|
-
}
|
|
21194
|
-
const toolCallId = req.params["toolCallId"];
|
|
21195
|
-
if (!toolCallId || toolCallId.length > 500) {
|
|
21196
|
-
res.status(400).json({
|
|
21197
|
-
error: "`toolCallId` must be a non-empty tool call id",
|
|
21198
|
-
code: "invalid_tool_call_id"
|
|
21199
|
-
});
|
|
21200
|
-
return;
|
|
21201
|
-
}
|
|
21202
|
-
const runtime = requireSessionRuntime({
|
|
21203
|
-
sessionId,
|
|
21204
|
-
route,
|
|
21205
|
-
res,
|
|
21206
|
-
workspaceRegistry,
|
|
21207
|
-
daemonLog
|
|
21208
|
-
});
|
|
21209
|
-
if (!runtime) return;
|
|
21210
|
-
try {
|
|
21211
|
-
const resolved = await virtualSubagentSessions.resolve(
|
|
21212
|
-
runtime,
|
|
21213
|
-
sessionId,
|
|
21214
|
-
toolCallId
|
|
21215
|
-
);
|
|
21216
|
-
if (!resolved) {
|
|
21217
|
-
res.status(404).json({
|
|
21218
|
-
error: "Subagent session not found",
|
|
21219
|
-
code: "session_not_found",
|
|
21220
|
-
sessionId,
|
|
21221
|
-
toolCallId
|
|
21222
|
-
});
|
|
21223
|
-
return;
|
|
21224
|
-
}
|
|
21225
|
-
res.status(200).json(
|
|
21226
|
-
await runtime.bridge.cancelSessionTask(
|
|
21227
|
-
sessionId,
|
|
21228
|
-
resolved.taskId,
|
|
21229
|
-
"agent"
|
|
21230
|
-
)
|
|
21231
|
-
);
|
|
21232
|
-
} catch (err) {
|
|
21233
|
-
sendBridgeError2(res, err, { route, sessionId });
|
|
21234
|
-
}
|
|
21235
|
-
}
|
|
21236
|
-
);
|
|
21237
20355
|
app.post(
|
|
21238
20356
|
"/session/:id/branch",
|
|
21239
20357
|
mutate(),
|
|
@@ -21533,28 +20651,6 @@ function registerSessionRoutes(app, deps) {
|
|
|
21533
20651
|
});
|
|
21534
20652
|
app.get(
|
|
21535
20653
|
"/session/:id/context",
|
|
21536
|
-
(req, res, next) => {
|
|
21537
|
-
const sessionId = req.params["id"];
|
|
21538
|
-
const key = sessionId ? parseVirtualSubagentSessionId(sessionId) : void 0;
|
|
21539
|
-
if (!sessionId || !key) {
|
|
21540
|
-
next();
|
|
21541
|
-
return;
|
|
21542
|
-
}
|
|
21543
|
-
const runtime = requireSessionRuntime({
|
|
21544
|
-
sessionId: key.parentSessionId,
|
|
21545
|
-
route: "GET /session/:id/context",
|
|
21546
|
-
res,
|
|
21547
|
-
workspaceRegistry,
|
|
21548
|
-
daemonLog
|
|
21549
|
-
});
|
|
21550
|
-
if (!runtime) return;
|
|
21551
|
-
res.status(200).json({
|
|
21552
|
-
v: 1,
|
|
21553
|
-
sessionId,
|
|
21554
|
-
workspaceCwd: runtime.workspaceCwd,
|
|
21555
|
-
state: {}
|
|
21556
|
-
});
|
|
21557
|
-
},
|
|
21558
20654
|
withOwnerReadSession(
|
|
21559
20655
|
"GET /session/:id/context",
|
|
21560
20656
|
async (_req, res, sessionId, runtime) => {
|
|
@@ -21586,28 +20682,6 @@ function registerSessionRoutes(app, deps) {
|
|
|
21586
20682
|
);
|
|
21587
20683
|
app.get(
|
|
21588
20684
|
"/session/:id/supported-commands",
|
|
21589
|
-
(req, res, next) => {
|
|
21590
|
-
const sessionId = req.params["id"];
|
|
21591
|
-
const key = sessionId ? parseVirtualSubagentSessionId(sessionId) : void 0;
|
|
21592
|
-
if (!sessionId || !key) {
|
|
21593
|
-
next();
|
|
21594
|
-
return;
|
|
21595
|
-
}
|
|
21596
|
-
const runtime = requireSessionRuntime({
|
|
21597
|
-
sessionId: key.parentSessionId,
|
|
21598
|
-
route: "GET /session/:id/supported-commands",
|
|
21599
|
-
res,
|
|
21600
|
-
workspaceRegistry,
|
|
21601
|
-
daemonLog
|
|
21602
|
-
});
|
|
21603
|
-
if (!runtime) return;
|
|
21604
|
-
res.status(200).json({
|
|
21605
|
-
v: 1,
|
|
21606
|
-
sessionId,
|
|
21607
|
-
availableCommands: [],
|
|
21608
|
-
availableSkills: []
|
|
21609
|
-
});
|
|
21610
|
-
},
|
|
21611
20685
|
withOwnerReadSession(
|
|
21612
20686
|
"GET /session/:id/supported-commands",
|
|
21613
20687
|
async (_req, res, sessionId, runtime) => {
|
|
@@ -22004,29 +21078,6 @@ function registerSessionRoutes(app, deps) {
|
|
|
22004
21078
|
app.post(
|
|
22005
21079
|
"/session/:id/heartbeat",
|
|
22006
21080
|
mutate(),
|
|
22007
|
-
(req, res, next) => {
|
|
22008
|
-
const sessionId = req.params["id"];
|
|
22009
|
-
const key = sessionId ? parseVirtualSubagentSessionId(sessionId) : void 0;
|
|
22010
|
-
if (!sessionId || !key) {
|
|
22011
|
-
next();
|
|
22012
|
-
return;
|
|
22013
|
-
}
|
|
22014
|
-
const runtime = requireSessionRuntime({
|
|
22015
|
-
sessionId: key.parentSessionId,
|
|
22016
|
-
route: "POST /session/:id/heartbeat",
|
|
22017
|
-
res,
|
|
22018
|
-
workspaceRegistry,
|
|
22019
|
-
daemonLog
|
|
22020
|
-
});
|
|
22021
|
-
if (!runtime) return;
|
|
22022
|
-
const clientId = parseClientIdHeader(req, res);
|
|
22023
|
-
if (clientId === null) return;
|
|
22024
|
-
res.status(200).json({
|
|
22025
|
-
sessionId,
|
|
22026
|
-
...clientId ? { clientId } : {},
|
|
22027
|
-
lastSeenAt: Date.now()
|
|
22028
|
-
});
|
|
22029
|
-
},
|
|
22030
21081
|
withOwnerMutableSession(
|
|
22031
21082
|
"POST /session/:id/heartbeat",
|
|
22032
21083
|
(req, res, sessionId, runtime) => {
|
|
@@ -22043,25 +21094,6 @@ function registerSessionRoutes(app, deps) {
|
|
|
22043
21094
|
app.post(
|
|
22044
21095
|
"/session/:id/detach",
|
|
22045
21096
|
mutate(),
|
|
22046
|
-
(req, res, next) => {
|
|
22047
|
-
const sessionId = req.params["id"];
|
|
22048
|
-
const key = sessionId ? parseVirtualSubagentSessionId(sessionId) : void 0;
|
|
22049
|
-
if (!sessionId || !key) {
|
|
22050
|
-
next();
|
|
22051
|
-
return;
|
|
22052
|
-
}
|
|
22053
|
-
const runtime = requireSessionRuntime({
|
|
22054
|
-
sessionId: key.parentSessionId,
|
|
22055
|
-
route: "POST /session/:id/detach",
|
|
22056
|
-
res,
|
|
22057
|
-
workspaceRegistry,
|
|
22058
|
-
daemonLog
|
|
22059
|
-
});
|
|
22060
|
-
if (!runtime) return;
|
|
22061
|
-
const clientId = parseClientIdHeader(req, res);
|
|
22062
|
-
if (clientId === null) return;
|
|
22063
|
-
res.status(204).end();
|
|
22064
|
-
},
|
|
22065
21097
|
withOwnerMutableSession(
|
|
22066
21098
|
"POST /session/:id/detach",
|
|
22067
21099
|
async (req, res, sessionId, runtime) => {
|
|
@@ -25826,7 +24858,7 @@ data: ${dataJson}
|
|
|
25826
24858
|
__name(formatSseFrame, "formatSseFrame");
|
|
25827
24859
|
function registerSseEventsRoutes(app, deps) {
|
|
25828
24860
|
const { workspaceRegistry, daemonLog, sendBridgeError: sendBridgeError2, writerIdleTimeoutMs } = deps;
|
|
25829
|
-
app.get("/session/:id/events",
|
|
24861
|
+
app.get("/session/:id/events", (req, res) => {
|
|
25830
24862
|
const sessionId = req.params["id"];
|
|
25831
24863
|
const lastEventId = parseLastEventId(req.headers["last-event-id"]);
|
|
25832
24864
|
const maxQueued = parseMaxQueuedQuery(req.query["maxQueued"], res);
|
|
@@ -25834,9 +24866,8 @@ function registerSseEventsRoutes(app, deps) {
|
|
|
25834
24866
|
let iter;
|
|
25835
24867
|
const abort = new AbortController();
|
|
25836
24868
|
try {
|
|
25837
|
-
const virtualKey = parseVirtualSubagentSessionId(sessionId);
|
|
25838
24869
|
const runtime = requireSessionRuntime({
|
|
25839
|
-
sessionId
|
|
24870
|
+
sessionId,
|
|
25840
24871
|
route: "GET /session/:id/events",
|
|
25841
24872
|
res,
|
|
25842
24873
|
workspaceRegistry,
|
|
@@ -25844,24 +24875,12 @@ function registerSseEventsRoutes(app, deps) {
|
|
|
25844
24875
|
});
|
|
25845
24876
|
if (!runtime) return;
|
|
25846
24877
|
const snapshot = req.query["snapshot"] === "1";
|
|
25847
|
-
const iterable =
|
|
25848
|
-
signal: abort.signal,
|
|
25849
|
-
lastEventId,
|
|
25850
|
-
...maxQueued !== void 0 ? { maxQueued } : {}
|
|
25851
|
-
}) : runtime.bridge.subscribeEvents(sessionId, {
|
|
24878
|
+
const iterable = runtime.bridge.subscribeEvents(sessionId, {
|
|
25852
24879
|
signal: abort.signal,
|
|
25853
24880
|
lastEventId,
|
|
25854
24881
|
...maxQueued !== void 0 ? { maxQueued } : {},
|
|
25855
24882
|
...snapshot ? { snapshot: true } : {}
|
|
25856
24883
|
});
|
|
25857
|
-
if (!iterable) {
|
|
25858
|
-
res.status(404).json({
|
|
25859
|
-
error: "Subagent session not found",
|
|
25860
|
-
code: "session_not_found",
|
|
25861
|
-
sessionId
|
|
25862
|
-
});
|
|
25863
|
-
return;
|
|
25864
|
-
}
|
|
25865
24884
|
iter = iterable[Symbol.asyncIterator]();
|
|
25866
24885
|
} catch (err) {
|
|
25867
24886
|
if (err instanceof SubscriberLimitExceededError) {
|
|
@@ -27015,7 +26034,7 @@ __name(registerWorkspaceQualifiedLifecycleRoutes, "registerWorkspaceQualifiedLif
|
|
|
27015
26034
|
|
|
27016
26035
|
// packages/cli/src/serve/routes/workspace-management.ts
|
|
27017
26036
|
init_esbuild_shims();
|
|
27018
|
-
import { readdir
|
|
26037
|
+
import { readdir, stat } from "node:fs/promises";
|
|
27019
26038
|
import { realpathSync as realpathSync2 } from "node:fs";
|
|
27020
26039
|
import { basename as basename4, dirname as dirname4, isAbsolute as isAbsolute7, join as join8, resolve as resolve4, sep as sep3 } from "node:path";
|
|
27021
26040
|
var MAX_PATH_SUGGESTIONS = 50;
|
|
@@ -27237,7 +26256,7 @@ function registerWorkspaceManagementRoutes(app, deps) {
|
|
|
27237
26256
|
const suggestions = [];
|
|
27238
26257
|
let truncated = false;
|
|
27239
26258
|
try {
|
|
27240
|
-
const entries = await
|
|
26259
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
27241
26260
|
entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
27242
26261
|
for (const entry of entries) {
|
|
27243
26262
|
if (entry.name.startsWith(".") && !filter.startsWith(".")) continue;
|
|
@@ -27247,7 +26266,7 @@ function registerWorkspaceManagementRoutes(app, deps) {
|
|
|
27247
26266
|
let isDir = entry.isDirectory();
|
|
27248
26267
|
if (!isDir && entry.isSymbolicLink()) {
|
|
27249
26268
|
try {
|
|
27250
|
-
isDir = (await
|
|
26269
|
+
isDir = (await stat(join8(dir, entry.name))).isDirectory();
|
|
27251
26270
|
} catch {
|
|
27252
26271
|
continue;
|
|
27253
26272
|
}
|
|
@@ -27367,7 +26386,7 @@ function registerWorkspaceManagementRoutes(app, deps) {
|
|
|
27367
26386
|
return;
|
|
27368
26387
|
}
|
|
27369
26388
|
try {
|
|
27370
|
-
const s = await
|
|
26389
|
+
const s = await stat(canonical);
|
|
27371
26390
|
if (!s.isDirectory()) {
|
|
27372
26391
|
res.status(400).json({
|
|
27373
26392
|
error: "Path is not a directory",
|
|
@@ -28170,7 +27189,7 @@ __name(registerWorkspaceManagementRoutes, "registerWorkspaceManagementRoutes");
|
|
|
28170
27189
|
|
|
28171
27190
|
// packages/cli/src/serve/routes/workspace-git.ts
|
|
28172
27191
|
init_esbuild_shims();
|
|
28173
|
-
import * as
|
|
27192
|
+
import * as fs4 from "node:fs";
|
|
28174
27193
|
import * as path14 from "node:path";
|
|
28175
27194
|
function registerWorkspaceGitRoutes(app, deps) {
|
|
28176
27195
|
app.get("/workspace/git", async (_req, res) => {
|
|
@@ -28197,8 +27216,8 @@ function registerWorkspaceQualifiedGitRoutes(app, deps) {
|
|
|
28197
27216
|
let gitCwd = runtime.workspaceCwd;
|
|
28198
27217
|
if (typeof rawCwd === "string" && rawCwd.length > 0) {
|
|
28199
27218
|
try {
|
|
28200
|
-
const resolved =
|
|
28201
|
-
const root =
|
|
27219
|
+
const resolved = fs4.realpathSync(path14.resolve(rawCwd));
|
|
27220
|
+
const root = fs4.realpathSync(runtime.workspaceCwd);
|
|
28202
27221
|
const rel = path14.relative(root, resolved);
|
|
28203
27222
|
if (!rel.startsWith("..") && !path14.isAbsolute(rel)) {
|
|
28204
27223
|
gitCwd = resolved;
|
|
@@ -30766,7 +29785,6 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
|
|
|
30766
29785
|
allowPrivateAuthBaseUrl: opts.allowPrivateAuthBaseUrl === true,
|
|
30767
29786
|
installAuthProvider: deps.installAuthProvider
|
|
30768
29787
|
});
|
|
30769
|
-
const virtualSubagentSessions = new VirtualSubagentSessions();
|
|
30770
29788
|
registerSessionRoutes(app, {
|
|
30771
29789
|
boundWorkspace: primaryBoundWorkspace,
|
|
30772
29790
|
bridge: primaryBridge,
|
|
@@ -30777,8 +29795,7 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
|
|
|
30777
29795
|
daemonLog,
|
|
30778
29796
|
promptDeadlineMs: opts.promptDeadlineMs,
|
|
30779
29797
|
sessionShellCommandEnabled,
|
|
30780
|
-
languageCodes
|
|
30781
|
-
virtualSubagentSessions
|
|
29798
|
+
languageCodes
|
|
30782
29799
|
});
|
|
30783
29800
|
registerWorkspaceMcpControlRoutes(app, {
|
|
30784
29801
|
boundWorkspace: primaryBoundWorkspace,
|
|
@@ -30944,8 +29961,7 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
|
|
|
30944
29961
|
workspaceRegistry,
|
|
30945
29962
|
daemonLog,
|
|
30946
29963
|
writerIdleTimeoutMs: opts.writerIdleTimeoutMs,
|
|
30947
|
-
sendBridgeError: sendBridgeError2
|
|
30948
|
-
virtualSubagentSessions
|
|
29964
|
+
sendBridgeError: sendBridgeError2
|
|
30949
29965
|
});
|
|
30950
29966
|
acpHandleRef.current = mountAcpHttp(app, primaryBridge, {
|
|
30951
29967
|
boundWorkspace: primaryBoundWorkspace,
|