@qwen-code/qwen-code 0.20.2-headless-image-routing.1 → 0.21.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/configuration/settings.md +5 -0
- package/bundled/qc-helper/docs/features/sub-agents.md +23 -5
- package/bundled/qc-helper/docs/integration-github-action.md +9 -9
- package/bundled/review/SKILL.md +7 -3
- package/chunks/MaxSizedBox-5DPPWPGT.js +85 -0
- package/chunks/{StandaloneSessionPicker-PLQQB22E.js → StandaloneSessionPicker-BIRMPLRD.js} +66 -59
- package/chunks/{acp-startup-profiler-N3RHHXJ3.js → acp-startup-profiler-RV3IV562.js} +2 -2
- package/chunks/{acpAgent-AIVK2EM5.js → acpAgent-6J2U72PQ.js} +705 -182
- package/chunks/agent-6ODUANDO.js +81 -0
- package/chunks/agent-headless-7BYQTMHW.js +75 -0
- package/chunks/{anthropicContentGenerator-HGWAHO24.js → anthropicContentGenerator-75BKLTSP.js} +117 -43
- package/chunks/{artifact-tool-56T5IMBP.js → artifact-tool-Y5T7GG7F.js} +3 -3
- package/chunks/{askUserQuestion-E25OBIC2.js → askUserQuestion-2H6747FR.js} +3 -3
- package/chunks/bridge-ZUB64FAE.js +90 -0
- package/chunks/{build-GHIZ4MSZ.js → build-RV63TIRH.js} +2 -3
- package/chunks/{ca-N6VVUFVB.js → ca-25EDXPFZ.js} +2 -0
- package/chunks/{channel-worker-group-QZV2SP5U.js → channel-worker-group-2ZD7TVAT.js} +8 -7
- package/chunks/{channel-worker-manager-3GMAU45H.js → channel-worker-manager-4OA4BCGB.js} +190 -30
- package/chunks/{channel-worker-supervisor-QCXSXCRY.js → channel-worker-supervisor-V7KCFJTS.js} +7 -6
- package/chunks/{chunk-TYQMGACW.js → chunk-22C7BQ6D.js} +508 -10967
- package/chunks/chunk-2JZBVYTU.js +452 -0
- package/chunks/{chunk-H2XVO6NE.js → chunk-2MIN6GRR.js} +1 -1
- package/chunks/{chunk-4DWTDZGS.js → chunk-2NH6DYI4.js} +12 -12
- package/chunks/chunk-2SCDWPXI.js +246 -0
- package/chunks/{chunk-QE4KFTBS.js → chunk-2X55UKQE.js} +3 -3
- package/chunks/{chunk-QBUDF33N.js → chunk-3QMGYBFN.js} +1 -1
- package/chunks/{chunk-3OAKYHRG.js → chunk-3RN6GBKS.js} +1 -1
- package/chunks/{chunk-QR6U5QPP.js → chunk-3SJ43L4W.js} +4 -0
- package/chunks/chunk-46UV252V.js +128 -0
- package/chunks/{chunk-GHRSKGHF.js → chunk-4WIZGAH3.js} +7 -7
- package/chunks/{chunk-CAS7CB3T.js → chunk-55DJUCI2.js} +87 -29
- package/chunks/{chunk-QNLNLENL.js → chunk-5I2IWRSH.js} +2 -2
- package/chunks/{chunk-H24SOJIQ.js → chunk-5NBDS5S6.js} +147 -7
- package/chunks/{chunk-E4IMU4Y5.js → chunk-63P4EL5V.js} +1 -1
- package/chunks/chunk-6FGBXPWM.js +293 -0
- package/chunks/{chunk-FFFM6NJV.js → chunk-6GMVPFB2.js} +155 -73
- package/chunks/{chunk-KWK7UE6L.js → chunk-6OUGMXDC.js} +6 -6
- package/chunks/{chunk-QRUIS3DN.js → chunk-6PEXNQTX.js} +22 -1
- package/chunks/{chunk-FZPTCQY7.js → chunk-7JURR4JT.js} +1 -1
- package/chunks/{chunk-Q6NAKZTA.js → chunk-7MVVZO4N.js} +4 -4
- package/chunks/{chunk-6ZBPS62S.js → chunk-7ZCNENPP.js} +1 -1
- package/chunks/{chunk-6X4GWOPW.js → chunk-A5L3JMUA.js} +1 -1
- package/chunks/{chunk-YO2XRXY6.js → chunk-ACY3A37B.js} +3 -3
- package/chunks/chunk-AMDSOFFV.js +10860 -0
- package/chunks/{chunk-RV4C2ZFG.js → chunk-BIQWWWJN.js} +1 -1
- package/chunks/{chunk-ZHERRXZJ.js → chunk-BJX6ZSUK.js} +4 -4
- package/chunks/chunk-BK2UNYWD.js +29 -0
- package/chunks/{chunk-FRPDJNK3.js → chunk-BKHWX6I2.js} +3 -3
- package/chunks/chunk-BPJSQIJX.js +100 -0
- package/chunks/{chunk-M7WBGLYP.js → chunk-BULDBTYC.js} +2 -0
- package/chunks/{chunk-ZDP2Y2AL.js → chunk-CIKQ7KKO.js} +4625 -8645
- package/chunks/{chunk-PEJWA3QQ.js → chunk-D3UEZIQH.js} +4 -2
- package/chunks/chunk-DHHOYAPR.js +1462 -0
- package/chunks/{chunk-LESHKUWF.js → chunk-DLWL3Z7A.js} +5 -3
- package/chunks/{chunk-XHATNRQA.js → chunk-DP3IHZGG.js} +0 -2
- package/chunks/chunk-E5TUC6CA.js +479 -0
- package/chunks/{chunk-JC26SJ5Y.js → chunk-EBJQ6AXW.js} +13 -12
- package/chunks/{chunk-RCWKCN2Z.js → chunk-EPDRMGT4.js} +164 -17
- package/chunks/{chunk-FUFCALSJ.js → chunk-ETSW4KLJ.js} +2 -2
- package/chunks/{chunk-KHOVYUHX.js → chunk-FNQ6T3CV.js} +20 -3
- package/chunks/{chunk-SP5WRGVG.js → chunk-FQK6JAFG.js} +72 -23
- package/chunks/{chunk-NWZY2SPY.js → chunk-FSITMZJH.js} +8 -8
- package/chunks/{chunk-6RLROE6G.js → chunk-GLWP3FDB.js} +80 -15
- package/chunks/{chunk-KPBVP6SL.js → chunk-GSN55ZRI.js} +5 -5
- package/chunks/{chunk-MLYGPZGU.js → chunk-H4SBPHSA.js} +3 -3
- package/chunks/chunk-H5FFA6TH.js +902 -0
- package/chunks/{chunk-TDKQP3M6.js → chunk-HIJQF5B5.js} +1 -1
- package/chunks/{chunk-5G3ZVADU.js → chunk-IJTOWOD7.js} +17 -6
- package/chunks/chunk-IKCX4CCL.js +469 -0
- package/chunks/{chunk-LPEONXNV.js → chunk-IKYJHJNF.js} +3 -3
- package/chunks/{chunk-DTZY2SH2.js → chunk-IO3IX5Q4.js} +1 -1
- package/chunks/{chunk-RS7MT2QG.js → chunk-IPUUTYMV.js} +2 -4
- package/chunks/{chunk-XU457J4V.js → chunk-IRH27ZC2.js} +2 -2
- package/chunks/{chunk-46DK772E.js → chunk-J24WCGIN.js} +4 -4
- package/chunks/{chunk-4LVZNIDO.js → chunk-J56UI34H.js} +4 -13
- package/chunks/{chunk-TJTKSVIV.js → chunk-JLU636DO.js} +5 -1
- package/chunks/{chunk-RKWX4CMO.js → chunk-JVPM2ULZ.js} +6 -6
- package/chunks/{chunk-ENPCQK44.js → chunk-JXJFVC6E.js} +37 -18
- package/chunks/{chunk-NABLFI57.js → chunk-JZA3JUDJ.js} +1 -1
- package/chunks/{chunk-CGLQAVZE.js → chunk-K36B6G2O.js} +5 -5
- package/chunks/{chunk-GPSKDNEE.js → chunk-K4XWPEWB.js} +4 -4
- package/chunks/{chunk-QOZOIPSF.js → chunk-KIM5GUMA.js} +650 -113
- package/chunks/{chunk-JZSM2IZ3.js → chunk-KMQ33DO4.js} +7 -5
- package/chunks/{chunk-E2UVIFI2.js → chunk-KRXPRVGL.js} +0 -1
- package/chunks/{chunk-WHGVTP7Q.js → chunk-L26JL52R.js} +3 -3
- package/chunks/{chunk-7Z6JQEL6.js → chunk-L5UHQJTJ.js} +1 -1
- package/chunks/{chunk-O2XSCRCS.js → chunk-LB6DUZ26.js} +259 -67
- package/chunks/chunk-LEH5C7FV.js +232 -0
- package/chunks/{chunk-RWV32G2M.js → chunk-LH2BYDQ5.js} +6 -4
- package/chunks/{chunk-QKTHJXCS.js → chunk-LK7CHLVP.js} +79 -2
- package/chunks/{chunk-VRRF3GW5.js → chunk-LKEJ26GS.js} +11 -11
- package/chunks/{chunk-SQFXI7VK.js → chunk-LQIW3YFY.js} +227 -41
- package/chunks/chunk-LS77BEZP.js +405 -0
- package/chunks/{chunk-BSHD62QJ.js → chunk-M4FMGVY4.js} +3 -3
- package/chunks/{chunk-57FIIFJN.js → chunk-M5JM7OSF.js} +1 -1
- package/chunks/{chunk-7362QS5B.js → chunk-MB4MZHMJ.js} +80 -37
- package/chunks/{chunk-4K56OJFJ.js → chunk-MUP3T3AD.js} +1 -1
- package/chunks/{chunk-3HFNGB2O.js → chunk-MVSUYZDT.js} +4 -4
- package/chunks/{chunk-T5IO6FZ4.js → chunk-MZAXJAUM.js} +1 -1
- package/chunks/{chunk-QKNXKTZX.js → chunk-NH6KE4JX.js} +3 -3
- package/chunks/chunk-NIBLUX3Y.js +934 -0
- package/chunks/{chunk-OQB4EXO4.js → chunk-NL7LTRLR.js} +1 -1
- package/chunks/{chunk-CS2FSS7W.js → chunk-OFDOK3VM.js} +5 -5
- package/chunks/{chunk-LIZRAKPB.js → chunk-OHNBB4XR.js} +1 -1
- package/chunks/{chunk-MDZTPSXO.js → chunk-OKY7HXPG.js} +2 -2
- package/chunks/{chunk-NHDKSOEY.js → chunk-P3QQPMQA.js} +5 -5
- package/chunks/{chunk-7THPNISK.js → chunk-PC6JANNU.js} +5 -5
- package/chunks/{chunk-OTQ6PSZC.js → chunk-PHOF65IG.js} +3498 -1030
- package/chunks/{chunk-OQ5SYCPE.js → chunk-PJIZUQVC.js} +2 -2
- package/chunks/{chunk-5DTTYNB7.js → chunk-PQNHRFJC.js} +16 -3
- package/chunks/{chunk-YM3SZTH4.js → chunk-PR75REBZ.js} +18 -1
- package/chunks/{chunk-RECUEJ7B.js → chunk-PSOO6YXD.js} +18 -15
- package/chunks/{chunk-X6N25LXS.js → chunk-PWTZEM3C.js} +2 -2
- package/chunks/{chunk-5NJTNQUW.js → chunk-PWVFN2LF.js} +1 -1
- package/chunks/{chunk-7AUH6A4T.js → chunk-Q4M4MDQ4.js} +2 -2
- package/chunks/{chunk-EZPB6S2I.js → chunk-QAF7NMK7.js} +1 -1
- package/chunks/{chunk-5GI55PF5.js → chunk-R5AFZNQW.js} +5 -5
- package/chunks/{chunk-T5B5NQZX.js → chunk-RF3EXIHJ.js} +47 -60
- package/chunks/{chunk-4K7VDKAD.js → chunk-RHLZR4E5.js} +1 -1
- package/chunks/{chunk-TJDW42MV.js → chunk-RIBKPMRP.js} +220 -141
- package/chunks/{chunk-RVLZCXEE.js → chunk-RWTEFFPU.js} +82 -3
- package/chunks/{chunk-L5QZGCRH.js → chunk-RZIX2G32.js} +1 -1
- package/chunks/{chunk-LLKWRXSS.js → chunk-SQCQ4KO2.js} +350 -418
- package/chunks/{chunk-THJNPLI4.js → chunk-TARRHLLG.js} +1 -0
- package/chunks/{chunk-XCXYRDHB.js → chunk-TEHGS6UP.js} +47 -18
- package/chunks/{chunk-PQIVAWXN.js → chunk-TGILQ3YH.js} +8 -8
- package/chunks/{chunk-Q2YKNMLS.js → chunk-TOFQCPDC.js} +43 -10
- package/chunks/{chunk-L3KUB6XM.js → chunk-TPRQ7RZH.js} +586 -242
- package/chunks/{chunk-T4TZQJ7W.js → chunk-TWPJO254.js} +5 -16
- package/chunks/{chunk-HIP6TVWA.js → chunk-U7M2DMGW.js} +3 -3
- package/chunks/{chunk-ACW3VNUE.js → chunk-UDX5OBWR.js} +41 -9
- package/chunks/{chunk-LW2FUYBN.js → chunk-USTWD7QV.js} +6 -4
- package/chunks/{chunk-NPQDJGKU.js → chunk-UUUTRMI2.js} +1 -1
- package/chunks/chunk-UW5EOVUN.js +249 -0
- package/chunks/{chunk-6IL7KRLE.js → chunk-VAK25FTU.js} +1 -1
- package/chunks/{chunk-O4BHWVUD.js → chunk-VIA5XA4U.js} +5 -2
- package/chunks/{chunk-EBXZ2YGV.js → chunk-VRYUBFMC.js} +1 -1
- package/chunks/{chunk-TWVE5ZS5.js → chunk-VULLI6WQ.js} +172 -6
- package/chunks/{chunk-LNDD3IML.js → chunk-WCXCRJYB.js} +1 -1
- package/chunks/{chunk-2LI23QA6.js → chunk-X5XDDSSH.js} +1 -1
- package/chunks/{chunk-Q35QUZDQ.js → chunk-Y34KJKDC.js} +1 -1
- package/chunks/{chunk-7NR2AIK6.js → chunk-YBL3QUDD.js} +2 -2
- package/chunks/{chunk-H4AR2JQF.js → chunk-YH6G52F2.js} +3 -3
- package/chunks/{chunk-MBOJHHPI.js → chunk-YPE6A4GC.js} +2 -2
- package/chunks/{chunk-3EK5ZOUQ.js → chunk-YX324OPW.js} +1 -1
- package/chunks/{chunk-4PTLZ3NX.js → chunk-Z2BC6UJ5.js} +3 -3
- package/chunks/{chunk-QLJUC7TG.js → chunk-ZD6UTE4A.js} +1 -1
- package/chunks/{chunk-LX3COOXF.js → chunk-ZFDTEDCF.js} +6 -6
- package/chunks/chunk-ZJHVAS7M.js +289 -0
- package/chunks/{chunk-4OWXOUYF.js → chunk-ZNAUOR2I.js} +15 -12
- package/chunks/{chunk-T2L47JJK.js → chunk-ZOIFNCKL.js} +4 -4
- package/chunks/{computer-use-2VIV73WK.js → computer-use-SOQ4E3VX.js} +43 -35
- package/chunks/{config-utils-FYTBZLCJ.js → config-utils-7V7GGIW6.js} +3 -3
- package/chunks/contextCommand-JLHYA34Z.js +80 -0
- package/chunks/{create-sub-session-AZ77LBL3.js → create-sub-session-IWW2IZ2T.js} +3 -3
- package/chunks/{create-sub-session-XDHHC2P4.js → create-sub-session-QRJLW5BV.js} +43 -35
- package/chunks/{cron-create-KTWJM7QT.js → cron-create-YIID5XAW.js} +6 -6
- package/chunks/{cron-delete-2P3I5ULL.js → cron-delete-ZVHYCEP2.js} +5 -5
- package/chunks/{cron-list-PXDPGEDQ.js → cron-list-XEGS463Q.js} +5 -5
- package/chunks/{daemon-RAPSDJH7.js → daemon-YO6433NF.js} +350 -53
- package/chunks/daemon-status-provider-2233Q37D.js +89 -0
- package/chunks/{de-4IBXM7CN.js → de-HGRCYDEJ.js} +1 -0
- package/chunks/{dist-UIFWIFRO.js → dist-46NQKLTW.js} +2 -2
- package/chunks/{dist-XRYV6TJP.js → dist-AIKFMUKK.js} +50 -4
- package/chunks/{dist-XBJVSWS2.js → dist-BBLXMS3N.js} +14 -2
- package/chunks/{dist-OMW6WDEO.js → dist-F6IBUDR4.js} +40 -9
- package/chunks/{dist-PJLG2XYX.js → dist-WEAHOXDM.js} +1 -1
- package/chunks/{dist-OAV7LJGJ.js → dist-YFNEUWSE.js} +26 -2
- package/chunks/earlyInputCapture-A7NDU3PF.js +82 -0
- package/chunks/{edit-CS6SFEXC.js → edit-OBDSQURM.js} +43 -35
- package/chunks/{en-USMCCJAJ.js → en-MTWBNGDO.js} +15 -0
- package/chunks/{enter-worktree-LMAL75DY.js → enter-worktree-U6MRPQ2P.js} +43 -35
- package/chunks/{enterPlanMode-WVJB4DSS.js → enterPlanMode-BC5QUZZ2.js} +43 -35
- package/chunks/{environment-6YHC4JAJ.js → environment-W5UFC2CH.js} +46 -38
- package/chunks/errors-M7CLORXH.js +88 -0
- package/chunks/{exit-worktree-KPFD742L.js → exit-worktree-DGNYMECB.js} +43 -35
- package/chunks/{exitPlanMode-UEJS6CDY.js → exitPlanMode-GXTBWQAR.js} +43 -35
- package/chunks/{fast-path-G2N4NRCA.js → fast-path-JJZFJANL.js} +6 -6
- package/chunks/{fast-path-settings-DAOVFADC.js → fast-path-settings-WQJU2LAT.js} +2 -2
- package/chunks/{fr-WVHEBDDB.js → fr-45RLL55O.js} +1 -0
- package/chunks/{gemini-2MDVIOVT.js → gemini-QS36EBZV.js} +132 -102
- package/chunks/{geminiContentGenerator-ZXTDBMFR.js → geminiContentGenerator-AG4KB6CV.js} +14 -8
- package/chunks/{getMachineId-bsd-QFVLPUPT.js → getMachineId-bsd-V7W3GODC.js} +1 -1
- package/chunks/{getMachineId-darwin-DGMQQE2E.js → getMachineId-darwin-TDO75DQP.js} +1 -1
- package/chunks/{getMachineId-linux-R4Z6CSWC.js → getMachineId-linux-TF43WQT2.js} +1 -1
- package/chunks/{getMachineId-unsupported-Z3SBVBUV.js → getMachineId-unsupported-ZGUO3TXT.js} +1 -1
- package/chunks/{getMachineId-win-SCK5UFDT.js → getMachineId-win-ECFYZZFQ.js} +1 -1
- package/chunks/{glob-562XFLIZ.js → glob-V7R3PSK3.js} +43 -35
- package/chunks/{grep-MGEFBDQK.js → grep-QYPSK7OP.js} +43 -35
- package/chunks/handleAutoUpdate-6DBEZYPV.js +81 -0
- package/chunks/{i18n-R6HJENXA.js → i18n-VUJJZIMU.js} +44 -36
- package/chunks/image-gen-Z3VPGKRC.js +240 -0
- package/chunks/initializer-UWAK5U5O.js +86 -0
- package/chunks/installationInfo-6O2YAA52.js +80 -0
- package/chunks/{ja-KY4ROZTE.js → ja-B7DF7DFG.js} +1 -0
- package/chunks/{keychain-token-storage-6ACJDYIB.js → keychain-token-storage-MDTG3WRM.js} +3 -3
- package/chunks/{kittyProtocolDetector-HCNNKJTI.js → kittyProtocolDetector-MBRTDRBK.js} +5 -3
- package/chunks/list-GB4ESM3T.js +89 -0
- package/chunks/list-agents-5KJJHR6I.js +80 -0
- package/chunks/loadedSettingsAdapter-OT6JVQ7U.js +83 -0
- package/chunks/loggingContentGenerator-HS3S5H3Q.js +1077 -0
- package/chunks/{loop-wakeup-RNMRVA66.js → loop-wakeup-FXKNNYSY.js} +7 -7
- package/chunks/{ls-J2ZI5XYK.js → ls-NTK6VOQJ.js} +5 -5
- package/chunks/{lsp-UMS3NUB5.js → lsp-2JI24STP.js} +3 -3
- package/chunks/{managed-npm-update-4KNYSOYC.js → managed-npm-update-JYEMMXA3.js} +94 -38
- package/chunks/mcp-6DBDJPFU.js +83 -0
- package/chunks/{monitor-DMHKE4SW.js → monitor-R3ODH5U6.js} +45 -36
- package/chunks/node-UUDY34IG.js +305 -0
- package/chunks/nonInteractiveCli-MOYCYBBU.js +141 -0
- package/chunks/{notebook-edit-35SJGEOR.js → notebook-edit-BNOK452R.js} +43 -35
- package/chunks/{openaiContentGenerator-5LPAFXPF.js → openaiContentGenerator-WMCU3O2H.js} +27 -17
- package/chunks/pidfile-TFRZZZIO.js +86 -0
- package/chunks/{processUtils-GM2I55KF.js → processUtils-RT7UNCC2.js} +2 -2
- package/chunks/{pt-OK455PLH.js → pt-22Q3FP73.js} +1 -0
- package/chunks/{qwenContentGenerator-HKOYNP7H.js → qwenContentGenerator-HHCRK4SX.js} +56 -42
- package/chunks/{qwenOAuth2-NUUYC3V5.js → qwenOAuth2-OWLB5AKH.js} +14 -27
- package/chunks/read-file-APMO3PSX.js +31 -0
- package/chunks/{read-mcp-resource-F6HYMDUY.js → read-mcp-resource-4DKQWGHD.js} +3 -3
- package/chunks/{record-artifact-7GCFLDD7.js → record-artifact-RQKFYO5B.js} +3 -3
- package/chunks/resumeHistoryUtils-6KRYEAWZ.js +91 -0
- package/chunks/ripGrep-BEJDEDXW.js +73 -0
- package/chunks/{ru-7SPDGMGD.js → ru-FZCNZHDC.js} +1 -0
- package/chunks/{run-qwen-serve-5VH3F4NW.js → run-qwen-serve-FU6HEM4J.js} +271 -57
- package/chunks/{runtime-OH77YH7W.js → runtime-XXRRTNP6.js} +55 -45
- package/chunks/{scheduler-WJQSLCSV.js → scheduler-G2ZS2Z7E.js} +43 -35
- package/chunks/{sdk-exporters-grpc-ETLH47EP.js → sdk-exporters-grpc-AK3LGHNO.js} +3 -3
- package/chunks/{sdk-exporters-http-T3POX73F.js → sdk-exporters-http-FYBSUCPD.js} +6 -6
- package/chunks/{sdk-impl-NSLPDH6I.js → sdk-impl-GMVPB7NB.js} +6 -6
- package/chunks/{send-message-PYIJ2PZL.js → send-message-Q6OOR6BR.js} +46 -9
- package/chunks/serve-7BSTXJ4T.js +89 -0
- package/chunks/{server-E4N4AI6Z.js → server-4UMH7OIZ.js} +2362 -411
- package/chunks/{session-5YUWIOQE.js → session-K3O3Q2SV.js} +105 -87
- package/chunks/{settings-YY7ZSFO7.js → settings-CR2EWTBA.js} +53 -45
- package/chunks/shell-HH3PF3A2.js +83 -0
- package/chunks/{skill-PAIDX3EU.js → skill-I3SDA4MB.js} +17 -16
- package/chunks/spawnChannel-RWNDBXGA.js +82 -0
- package/chunks/{src-IZXLJI5M.js → src-GE4TTTML.js} +302 -184
- package/chunks/{standalone-update-X675JVBL.js → standalone-update-Q6WFRZZQ.js} +45 -37
- package/chunks/{startInteractiveUI-ND2IVBU3.js → startInteractiveUI-SLZGHRPH.js} +747 -310
- package/chunks/{syntheticOutput-H7RTI5KL.js → syntheticOutput-I3757IWH.js} +4 -4
- package/chunks/{task-create-7474AJJD.js → task-create-N7WQSGYA.js} +10 -10
- package/chunks/{task-list-633HGOIB.js → task-list-FOPULZEP.js} +7 -7
- package/chunks/{task-stop-MNUGHPIA.js → task-stop-H6RHXFVQ.js} +4 -4
- package/chunks/{task-update-66GQB5LI.js → task-update-M57TFZJT.js} +10 -10
- package/chunks/{team-create-2DEYNMMN.js → team-create-YJALH5D2.js} +46 -38
- package/chunks/{team-delete-BB3CG3QF.js → team-delete-QE2UXJL7.js} +7 -7
- package/chunks/{team-plan-approval-65AVAOCT.js → team-plan-approval-34QFYKGN.js} +43 -35
- package/chunks/theme-manager-SWRILQHI.js +77 -0
- package/chunks/{todoWrite-KRAUN54W.js → todoWrite-VQ7FKOHL.js} +5 -5
- package/chunks/{tool-search-ZQP3SMTV.js → tool-search-NF7GB6LE.js} +16 -16
- package/chunks/total-session-admission-DLHHHLD3.js +84 -0
- package/chunks/{tree-sitter-FS4VPMZA.js → tree-sitter-4D7QS7F6.js} +1 -1
- package/chunks/{tree-sitter-bash-6B46JJCV.js → tree-sitter-bash-VEJGF5XF.js} +1 -1
- package/chunks/{trustedFolders-LURI52LP.js → trustedFolders-KHXHY6PY.js} +44 -36
- package/chunks/{update-relaunch-BPWFIDLM.js → update-relaunch-WBUZJC5O.js} +5 -5
- package/chunks/updateCheck-RKL6M5XN.js +92 -0
- package/chunks/useAutoAcceptIndicator-CFQ5BUJL.js +93 -0
- package/chunks/{validateNonInterActiveAuth-HWD6Y22I.js → validateNonInterActiveAuth-3R223G3R.js} +89 -80
- package/chunks/{version-OD4JAFG7.js → version-HS7YSFHV.js} +1 -1
- package/chunks/{web-fetch-RFBKNU24.js → web-fetch-NKCSG7ZE.js} +18 -16
- package/chunks/{web-search-AKTVS5YZ.js → web-search-S62WAP4S.js} +13 -27
- package/chunks/{workflow-VZVCOSZN.js → workflow-QAGU5RU4.js} +44 -36
- package/chunks/workspace-providers-status-QSVZUETE.js +86 -0
- package/chunks/{workspace-registration-store-Q5SFJSX4.js → workspace-registration-store-24JMHDGF.js} +2 -2
- package/chunks/workspace-registry-UT4RBNBM.js +88 -0
- package/chunks/workspace-service-JFWRUS4V.js +98 -0
- package/chunks/workspace-skills-status-ZBBKJOI2.js +85 -0
- package/chunks/write-file-VHIXW5M7.js +73 -0
- package/chunks/{zh-WY5DWYZD.js → zh-LUIGBD55.js} +15 -0
- package/chunks/{zh-TW-BM47YBFH.js → zh-TW-F5KG2IYD.js} +15 -0
- package/cli-entry.js +10 -1
- package/cli.js +13 -13
- package/locales/ca.js +2 -0
- package/locales/de.js +1 -0
- package/locales/en.js +25 -0
- package/locales/fr.js +1 -0
- package/locales/ja.js +1 -0
- package/locales/pt.js +1 -0
- package/locales/ru.js +1 -0
- package/locales/zh-TW.js +23 -0
- package/locales/zh.js +23 -0
- package/package.json +3 -3
- package/web-shell/assets/{arc-BWFm0SI0.js → arc-DcbWnB9T.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-CZ_yL-DQ.js → architectureDiagram-3BPJPVTR-kMMF5sud.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-B9F9mJvG.js → blockDiagram-GPEHLZMM-Htl9vTJS.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-BUdwJW5f.js → c4Diagram-AAUBKEIU-BnZnm0mQ.js} +1 -1
- package/web-shell/assets/channel-Cq7YKtfC.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-w4cF-qlF.js → chunk-2J33WTMH-DziB7kDG.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-BXwURxHJ.js → chunk-4BX2VUAB-CmkD8daw.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-Gem3LalC.js → chunk-55IACEB6-CHAd9A_U.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-A3ddVojI.js → chunk-727SXJPM-Dqaam3fE.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-CjHZ5L_R.js → chunk-AQP2D5EJ-D_-saBYM.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-CKgdgcpv.js → chunk-FMBD7UC4-B9r_veWD.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-Cn2Dykjb.js → chunk-ND2GUHAM-B3EaCSpL.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN--0SyraC5.js → chunk-QZHKN3VN-CYq8x9mn.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-CQ9aC1Tg.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CQ9aC1Tg.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-CphhAity.js → cose-bilkent-S5V4N54A-D0ng4uiB.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-DU--jiKp.js → dagre-BM42HDAG-DCZollQv.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-BzvuZw1Y.js → diagram-2AECGRRQ-Dfk2pWS0.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-D84-49Y0.js → diagram-5GNKFQAL-kX38ltWR.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-DQTq-3_3.js → diagram-KO2AKTUF-CJz2vsXh.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-8FTrshzN.js → diagram-LMA3HP47-BvMLZm_7.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-BCjpDBCm.js → diagram-OG6HWLK6-l7kfStkO.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-BtRObkmg.js → erDiagram-TEJ5UH35-BSVa8GGT.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-DTrW6oxy.js → flowDiagram-I6XJVG4X-CoawKIXH.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-BgPNSW6j.js → ganttDiagram-6RSMTGT7-DFUDH0zF.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-BTclNgGV.js → gitGraphDiagram-PVQCEYII-Y2pvpT4e.js} +1 -1
- package/web-shell/assets/{index-CxA7AqY6.js → index-D0GX0zZf.js} +1 -1
- package/web-shell/assets/index-D9haPt0X.css +5 -0
- package/web-shell/assets/index-ckX9Pq5k.js +1230 -0
- package/web-shell/assets/{infoDiagram-5YYISTIA-DCE4AJt2.js → infoDiagram-5YYISTIA-CU8_zLiX.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-C8iE6q4Y.js → ishikawaDiagram-YF4QCWOH-AVQiV0DU.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-C_dxdyEc.js → journeyDiagram-JHISSGLW-DQ0VSKa3.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-Dw3n1u3w.js → kanban-definition-UN3LZRKU-BqnWqsE_.js} +1 -1
- package/web-shell/assets/{linear-C2BF2zJ9.js → linear-BkoihsaA.js} +1 -1
- package/web-shell/assets/{mermaid.core-CGTQU3MA.js → mermaid.core-5RJs-31j.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-BVFZm9ZC.js → mindmap-definition-RKZ34NQL-D33Bxnpd.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-Cc-TNN3n.js → pieDiagram-4H26LBE5-BuEAw3BH.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-CgW3Rzsi.js → quadrantDiagram-W4KKPZXB-Kox_usEq.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-BAaj0Y3B.js → requirementDiagram-4Y6WPE33-CNjeUif0.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-XJWmekxS.js → sankeyDiagram-5OEKKPKP-BCd2OL_U.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-CtRc_0wf.js → sequenceDiagram-3UESZ5HK-CF2ZTsz0.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-WCnvMGy5.js → stateDiagram-AJRCARHV-qenSzHtm.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-B7W4zlCr.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-C9cRx49L.js → timeline-definition-PNZ67QCA-B5DyWdgs.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-BvXOCEt-.js → vennDiagram-CIIHVFJN-DqP4I_o_.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-ByafGtzu.js → wardley-L42UT6IY-CJe2e4mg.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-CozAnw8x.js → wardleyDiagram-YWT4CUSO-BMDSw-Rr.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-Camu9Qvq.js → xychartDiagram-2RQKCTM6-BTVZYkxD.js} +1 -1
- package/web-shell/index.html +17 -13
- package/chunks/MaxSizedBox-3XQIBACV.js +0 -78
- package/chunks/agent-QXD5NSKA.js +0 -73
- package/chunks/agent-headless-4VXR2TBK.js +0 -67
- package/chunks/bridge-GIBRSPE6.js +0 -81
- package/chunks/chunk-CBOQ3HY7.js +0 -2019
- package/chunks/chunk-MA6GYKK7.js +0 -6928
- package/chunks/contextCommand-XQU7KLIH.js +0 -72
- package/chunks/daemon-status-provider-KQVNB4VA.js +0 -80
- package/chunks/earlyInputCapture-WP5SA3KH.js +0 -74
- package/chunks/errors-JEYPXX4S.js +0 -80
- package/chunks/handleAutoUpdate-2VJPAW43.js +0 -73
- package/chunks/initializer-UOX67ZFQ.js +0 -78
- package/chunks/installationInfo-NQNY34X3.js +0 -72
- package/chunks/list-2Z7KS7ZF.js +0 -81
- package/chunks/loadedSettingsAdapter-LIYY3LE4.js +0 -75
- package/chunks/mcp-AJ4QW3JA.js +0 -75
- package/chunks/nonInteractiveCli-PUSO5QF6.js +0 -134
- package/chunks/pidfile-EH2JW2PB.js +0 -78
- package/chunks/read-file-JZ5VXILQ.js +0 -31
- package/chunks/resumeHistoryUtils-Z3HG4WKM.js +0 -84
- package/chunks/ripGrep-JNLJCT2B.js +0 -65
- package/chunks/serve-NN5FXWR6.js +0 -81
- package/chunks/shell-FXT3NVC6.js +0 -75
- package/chunks/spawnChannel-XAWLXNOD.js +0 -74
- package/chunks/theme-manager-2WZHPK2M.js +0 -69
- package/chunks/total-session-admission-HULB2TEQ.js +0 -75
- package/chunks/updateCheck-D4ESCHBJ.js +0 -88
- package/chunks/useAutoAcceptIndicator-CBNLOF2P.js +0 -86
- package/chunks/workspace-providers-status-TJTVHORI.js +0 -78
- package/chunks/workspace-registry-H6VM5WXK.js +0 -79
- package/chunks/workspace-service-ZNKD3I2J.js +0 -90
- package/chunks/workspace-skills-status-OOBIXADG.js +0 -77
- package/chunks/write-file-CAKK5IAO.js +0 -65
- package/web-shell/assets/channel-DiLlxxIf.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-CkylTdM4.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CkylTdM4.js +0 -1
- package/web-shell/assets/index-CGtQqOIa.css +0 -5
- package/web-shell/assets/index-TtM0hVjU.js +0 -1207
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-D1gzH2Ue.js +0 -1
|
@@ -4,22 +4,9 @@ import {
|
|
|
4
4
|
DEFAULT_RING_SIZE,
|
|
5
5
|
EVENT_SCHEMA_VERSION,
|
|
6
6
|
EventBus,
|
|
7
|
+
logEventSizingFailed,
|
|
7
8
|
serializedBridgeEventByteLength
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import {
|
|
10
|
-
normalizeCompactedReplayMaxBytes
|
|
11
|
-
} from "./chunk-COH43MRJ.js";
|
|
12
|
-
import {
|
|
13
|
-
CHANNEL_STARTUP_PROFILE_META_KEY,
|
|
14
|
-
CHANNEL_STARTUP_PROFILE_VERSION,
|
|
15
|
-
LOAD_REPLAY_BULK_MODE,
|
|
16
|
-
LOAD_REPLAY_META_KEY,
|
|
17
|
-
LOAD_REPLAY_MODE_META_KEY,
|
|
18
|
-
LOAD_REPLAY_PAGE_SIZE_META_KEY,
|
|
19
|
-
LOAD_REPLAY_VERSION,
|
|
20
|
-
MID_TURN_QUEUE_DRAIN_METHOD,
|
|
21
|
-
TODO_STOP_GUARD_QUEUE_RELEASE_METHOD
|
|
22
|
-
} from "./chunk-QR6U5QPP.js";
|
|
9
|
+
} from "./chunk-GLWP3FDB.js";
|
|
23
10
|
import {
|
|
24
11
|
BranchWhilePromptActiveError,
|
|
25
12
|
CancelSentinelCollisionError,
|
|
@@ -42,9 +29,25 @@ import {
|
|
|
42
29
|
WorkspaceMismatchError,
|
|
43
30
|
isNotCurrentlyGeneratingCancelError
|
|
44
31
|
} from "./chunk-UH3WSE5L.js";
|
|
32
|
+
import {
|
|
33
|
+
normalizeCompactedReplayMaxBytes
|
|
34
|
+
} from "./chunk-COH43MRJ.js";
|
|
35
|
+
import {
|
|
36
|
+
CHANNEL_STARTUP_PROFILE_META_KEY,
|
|
37
|
+
CHANNEL_STARTUP_PROFILE_VERSION,
|
|
38
|
+
DAEMON_CHANNEL_DELIVERY_META_KEY,
|
|
39
|
+
LOAD_REPLAY_BULK_MODE,
|
|
40
|
+
LOAD_REPLAY_META_KEY,
|
|
41
|
+
LOAD_REPLAY_MODE_META_KEY,
|
|
42
|
+
LOAD_REPLAY_PAGE_SIZE_META_KEY,
|
|
43
|
+
LOAD_REPLAY_VERSION,
|
|
44
|
+
MID_TURN_QUEUE_DRAIN_METHOD,
|
|
45
|
+
PROMPT_CANCEL_METHOD,
|
|
46
|
+
TODO_STOP_GUARD_QUEUE_RELEASE_METHOD
|
|
47
|
+
} from "./chunk-3SJ43L4W.js";
|
|
45
48
|
import {
|
|
46
49
|
defaultSpawnChannelFactory
|
|
47
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-7JURR4JT.js";
|
|
48
51
|
import {
|
|
49
52
|
BridgeChannelClosedError,
|
|
50
53
|
BridgeTimeoutError,
|
|
@@ -53,11 +56,16 @@ import {
|
|
|
53
56
|
STATUS_SCHEMA_VERSION,
|
|
54
57
|
createIdleWorkspaceExtensionsStatus,
|
|
55
58
|
createIdleWorkspaceHooksStatus
|
|
56
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-VIA5XA4U.js";
|
|
57
60
|
import {
|
|
58
61
|
canonicalizeWorkspace,
|
|
59
62
|
translateAndCheckAbsoluteWorkspacePath
|
|
60
63
|
} from "./chunk-2RFKHEXL.js";
|
|
64
|
+
import {
|
|
65
|
+
CHANNEL_DELIVERY_ERROR_CODES,
|
|
66
|
+
MAX_SUB_SESSION_NAME_CHARS,
|
|
67
|
+
MAX_SUB_SESSION_PROMPT_CHARS
|
|
68
|
+
} from "./chunk-BK2UNYWD.js";
|
|
61
69
|
import {
|
|
62
70
|
ClientSideConnection,
|
|
63
71
|
PROTOCOL_VERSION,
|
|
@@ -74,11 +82,16 @@ import {
|
|
|
74
82
|
metadataBudgetBytes,
|
|
75
83
|
normalizeSnapshotPayload,
|
|
76
84
|
stableSessionArtifactId
|
|
77
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-PHOF65IG.js";
|
|
78
86
|
import {
|
|
79
87
|
DAEMON_TRACEPARENT_META_KEY,
|
|
80
88
|
DAEMON_TRACESTATE_META_KEY
|
|
81
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-NIBLUX3Y.js";
|
|
90
|
+
import {
|
|
91
|
+
INVOCATION_CONTEXT_META_KEY,
|
|
92
|
+
PRIVATE_ACP_CAPABILITY_ENV,
|
|
93
|
+
PRIVATE_PARENT_CAPABILITY_META_KEY
|
|
94
|
+
} from "./chunk-CIKQ7KKO.js";
|
|
82
95
|
import {
|
|
83
96
|
init_esbuild_shims
|
|
84
97
|
} from "./chunk-5O2XNYP6.js";
|
|
@@ -88,7 +101,7 @@ import {
|
|
|
88
101
|
|
|
89
102
|
// packages/acp-bridge/src/bridge.ts
|
|
90
103
|
init_esbuild_shims();
|
|
91
|
-
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
104
|
+
import { randomBytes, randomUUID as randomUUID2 } from "node:crypto";
|
|
92
105
|
import * as path3 from "node:path";
|
|
93
106
|
|
|
94
107
|
// packages/acp-bridge/src/compactionEngine.ts
|
|
@@ -123,16 +136,32 @@ function replayRecordId(event) {
|
|
|
123
136
|
return typeof recordId === "string" ? recordId : void 0;
|
|
124
137
|
}
|
|
125
138
|
__name(replayRecordId, "replayRecordId");
|
|
139
|
+
var DEFAULT_MAX_JOURNAL_EVENTS = 2e3;
|
|
140
|
+
var DEFAULT_MAX_JOURNAL_BYTES = 2 * 1024 * 1024;
|
|
141
|
+
function normalizeJournalCap(value, fallback, name) {
|
|
142
|
+
if (value === void 0) return fallback;
|
|
143
|
+
if (!Number.isSafeInteger(value) || value < 1) {
|
|
144
|
+
throw new TypeError(`${name} must be a positive safe integer`);
|
|
145
|
+
}
|
|
146
|
+
return value;
|
|
147
|
+
}
|
|
148
|
+
__name(normalizeJournalCap, "normalizeJournalCap");
|
|
126
149
|
var TurnBoundaryCompactionEngine = class {
|
|
127
150
|
static {
|
|
128
151
|
__name(this, "TurnBoundaryCompactionEngine");
|
|
129
152
|
}
|
|
130
153
|
maxReplayBytes;
|
|
154
|
+
maxJournalEvents;
|
|
155
|
+
maxJournalBytes;
|
|
131
156
|
onReplayWindowEviction;
|
|
132
157
|
replaySegments = [];
|
|
133
158
|
replaySegmentStart = 0;
|
|
134
159
|
replayBytes = 0;
|
|
135
160
|
liveJournal = [];
|
|
161
|
+
/** Serialized size of each `liveJournal` entry, index-parallel. */
|
|
162
|
+
journalEntryBytes = [];
|
|
163
|
+
journalTotalBytes = 0;
|
|
164
|
+
journalTruncatedEvents = 0;
|
|
136
165
|
lastEventId = 0;
|
|
137
166
|
closed = false;
|
|
138
167
|
truncatedEvents = 0;
|
|
@@ -145,15 +174,33 @@ var TurnBoundaryCompactionEngine = class {
|
|
|
145
174
|
};
|
|
146
175
|
constructor(opts = {}) {
|
|
147
176
|
this.maxReplayBytes = normalizeCompactedReplayMaxBytes(opts.maxReplayBytes);
|
|
177
|
+
this.maxJournalEvents = normalizeJournalCap(
|
|
178
|
+
opts.maxJournalEvents,
|
|
179
|
+
DEFAULT_MAX_JOURNAL_EVENTS,
|
|
180
|
+
"maxJournalEvents"
|
|
181
|
+
);
|
|
182
|
+
this.maxJournalBytes = normalizeJournalCap(
|
|
183
|
+
opts.maxJournalBytes,
|
|
184
|
+
DEFAULT_MAX_JOURNAL_BYTES,
|
|
185
|
+
"maxJournalBytes"
|
|
186
|
+
);
|
|
148
187
|
this.onReplayWindowEviction = opts.onReplayWindowEviction;
|
|
149
188
|
}
|
|
150
|
-
ingest(event) {
|
|
189
|
+
ingest(event, byteLength) {
|
|
151
190
|
if (this.closed) return;
|
|
152
191
|
if (event.id !== void 0) {
|
|
153
192
|
this.lastEventId = event.id;
|
|
154
193
|
}
|
|
155
194
|
if (TRANSIENT_TYPES.has(event.type)) return;
|
|
156
195
|
this.liveJournal.push(event);
|
|
196
|
+
const bytes = byteLength ?? serializedBridgeEventByteLength(event) ?? 0;
|
|
197
|
+
this.journalEntryBytes.push(bytes);
|
|
198
|
+
this.journalTotalBytes += bytes;
|
|
199
|
+
while (this.liveJournal.length > this.maxJournalEvents || this.journalTotalBytes > this.maxJournalBytes && this.liveJournal.length > 1) {
|
|
200
|
+
this.liveJournal.shift();
|
|
201
|
+
this.journalTotalBytes -= this.journalEntryBytes.shift() ?? 0;
|
|
202
|
+
this.journalTruncatedEvents += 1;
|
|
203
|
+
}
|
|
157
204
|
if (TURN_BOUNDARY_TYPES.has(event.type)) {
|
|
158
205
|
this.compactCurrentTurn(event);
|
|
159
206
|
return;
|
|
@@ -171,9 +218,25 @@ var TurnBoundaryCompactionEngine = class {
|
|
|
171
218
|
this.makeHistoryTruncatedEvent(compactedTurns.length)
|
|
172
219
|
);
|
|
173
220
|
}
|
|
221
|
+
const liveJournal = this.liveJournal.slice();
|
|
222
|
+
if (this.journalTruncatedEvents > 0) {
|
|
223
|
+
liveJournal.unshift({
|
|
224
|
+
v: EVENT_SCHEMA_VERSION,
|
|
225
|
+
type: "history_truncated",
|
|
226
|
+
data: {
|
|
227
|
+
reason: "replay_window_exceeded",
|
|
228
|
+
scope: "live_journal",
|
|
229
|
+
truncatedEvents: this.journalTruncatedEvents,
|
|
230
|
+
retainedEvents: this.liveJournal.length,
|
|
231
|
+
maxBytes: this.maxJournalBytes,
|
|
232
|
+
maxEvents: this.maxJournalEvents,
|
|
233
|
+
fullTranscriptAvailable: true
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
}
|
|
174
237
|
return {
|
|
175
238
|
compactedTurns,
|
|
176
|
-
liveJournal
|
|
239
|
+
liveJournal,
|
|
177
240
|
lastEventId: this.lastEventId
|
|
178
241
|
};
|
|
179
242
|
}
|
|
@@ -185,7 +248,7 @@ var TurnBoundaryCompactionEngine = class {
|
|
|
185
248
|
if (TRANSIENT_TYPES.has(event.type)) continue;
|
|
186
249
|
this.addReplaySegment([event], 0);
|
|
187
250
|
}
|
|
188
|
-
this.
|
|
251
|
+
this.resetJournal();
|
|
189
252
|
this.slots = [];
|
|
190
253
|
this.toolSlotIndex.clear();
|
|
191
254
|
this.clearTextSlotIndex();
|
|
@@ -216,7 +279,7 @@ var TurnBoundaryCompactionEngine = class {
|
|
|
216
279
|
recordEvents.push(event);
|
|
217
280
|
}
|
|
218
281
|
flushRecord();
|
|
219
|
-
this.
|
|
282
|
+
this.resetJournal();
|
|
220
283
|
this.slots = [];
|
|
221
284
|
this.toolSlotIndex.clear();
|
|
222
285
|
this.clearTextSlotIndex();
|
|
@@ -225,7 +288,7 @@ var TurnBoundaryCompactionEngine = class {
|
|
|
225
288
|
if (this.closed) return;
|
|
226
289
|
this.closed = true;
|
|
227
290
|
this.resetReplayWindow();
|
|
228
|
-
this.
|
|
291
|
+
this.resetJournal();
|
|
229
292
|
this.slots = [];
|
|
230
293
|
this.toolSlotIndex.clear();
|
|
231
294
|
this.clearTextSlotIndex();
|
|
@@ -312,6 +375,8 @@ var TurnBoundaryCompactionEngine = class {
|
|
|
312
375
|
if (event.id !== void 0) slot.lastEventId = event.id;
|
|
313
376
|
slot.lastMeta = meta ?? slot.lastMeta;
|
|
314
377
|
slot.lastEnvelopeMeta = event._meta ?? slot.lastEnvelopeMeta;
|
|
378
|
+
slot.lastTurn = captureTurnFields(event, slot.lastTurn);
|
|
379
|
+
slot.lastSessionId = captureSessionId(event) ?? slot.lastSessionId;
|
|
315
380
|
} else {
|
|
316
381
|
entries.push({ sourceRecordIds, index: this.slots.length });
|
|
317
382
|
this.textSlotIndex[kind].set(parentToolCallId, entries);
|
|
@@ -322,7 +387,9 @@ var TurnBoundaryCompactionEngine = class {
|
|
|
322
387
|
sourceRecordIds,
|
|
323
388
|
lastEventId: event.id ?? 0,
|
|
324
389
|
lastMeta: meta,
|
|
325
|
-
lastEnvelopeMeta: event._meta
|
|
390
|
+
lastEnvelopeMeta: event._meta,
|
|
391
|
+
lastTurn: captureTurnFields(event),
|
|
392
|
+
lastSessionId: captureSessionId(event)
|
|
326
393
|
});
|
|
327
394
|
}
|
|
328
395
|
} else {
|
|
@@ -332,6 +399,8 @@ var TurnBoundaryCompactionEngine = class {
|
|
|
332
399
|
if (event.id !== void 0) lastSlot.lastEventId = event.id;
|
|
333
400
|
lastSlot.lastMeta = meta ?? lastSlot.lastMeta;
|
|
334
401
|
lastSlot.lastEnvelopeMeta = event._meta ?? lastSlot.lastEnvelopeMeta;
|
|
402
|
+
lastSlot.lastTurn = captureTurnFields(event, lastSlot.lastTurn);
|
|
403
|
+
lastSlot.lastSessionId = captureSessionId(event) ?? lastSlot.lastSessionId;
|
|
335
404
|
} else {
|
|
336
405
|
this.slots.push({
|
|
337
406
|
kind,
|
|
@@ -340,7 +409,9 @@ var TurnBoundaryCompactionEngine = class {
|
|
|
340
409
|
sourceRecordIds,
|
|
341
410
|
lastEventId: event.id ?? 0,
|
|
342
411
|
lastMeta: meta,
|
|
343
|
-
lastEnvelopeMeta: event._meta
|
|
412
|
+
lastEnvelopeMeta: event._meta,
|
|
413
|
+
lastTurn: captureTurnFields(event),
|
|
414
|
+
lastSessionId: captureSessionId(event)
|
|
344
415
|
});
|
|
345
416
|
}
|
|
346
417
|
}
|
|
@@ -357,7 +428,9 @@ var TurnBoundaryCompactionEngine = class {
|
|
|
357
428
|
slot.chunks.join(""),
|
|
358
429
|
slot.lastEventId,
|
|
359
430
|
slot.lastMeta,
|
|
360
|
-
slot.lastEnvelopeMeta
|
|
431
|
+
slot.lastEnvelopeMeta,
|
|
432
|
+
slot.lastTurn,
|
|
433
|
+
slot.lastSessionId
|
|
361
434
|
)
|
|
362
435
|
);
|
|
363
436
|
break;
|
|
@@ -372,7 +445,7 @@ var TurnBoundaryCompactionEngine = class {
|
|
|
372
445
|
}
|
|
373
446
|
compacted.push(boundaryEvent);
|
|
374
447
|
this.addReplaySegment(compacted, 1);
|
|
375
|
-
this.
|
|
448
|
+
this.resetJournal();
|
|
376
449
|
this.slots = [];
|
|
377
450
|
this.toolSlotIndex.clear();
|
|
378
451
|
this.clearTextSlotIndex();
|
|
@@ -382,10 +455,27 @@ var TurnBoundaryCompactionEngine = class {
|
|
|
382
455
|
this.lastEventId = event.id;
|
|
383
456
|
}
|
|
384
457
|
}
|
|
458
|
+
resetJournal() {
|
|
459
|
+
this.liveJournal = [];
|
|
460
|
+
this.journalEntryBytes = [];
|
|
461
|
+
this.journalTotalBytes = 0;
|
|
462
|
+
this.journalTruncatedEvents = 0;
|
|
463
|
+
}
|
|
385
464
|
addReplaySegment(events, turnCount) {
|
|
386
465
|
if (events.length === 0) return;
|
|
387
466
|
const bytes = events.reduce(
|
|
388
|
-
|
|
467
|
+
// Live events passed the publish-time serializability gate, but the
|
|
468
|
+
// seed paths (persisted transcripts) bypass it — log a diagnostic
|
|
469
|
+
// and count 0 so a single unserializable record can't wedge the
|
|
470
|
+
// replay-window accounting.
|
|
471
|
+
(sum, event) => {
|
|
472
|
+
const size = serializedBridgeEventByteLength(event);
|
|
473
|
+
if (size === void 0) {
|
|
474
|
+
logEventSizingFailed(event.type);
|
|
475
|
+
return sum;
|
|
476
|
+
}
|
|
477
|
+
return sum + size;
|
|
478
|
+
},
|
|
389
479
|
0
|
|
390
480
|
);
|
|
391
481
|
this.replaySegments.push({ events: events.slice(), bytes, turnCount });
|
|
@@ -464,13 +554,20 @@ var TurnBoundaryCompactionEngine = class {
|
|
|
464
554
|
this.textSlotIndex.thought.clear();
|
|
465
555
|
}
|
|
466
556
|
};
|
|
467
|
-
function makeMergedSessionUpdateEvent(sessionUpdate, text, eventId, meta, envelopeMeta) {
|
|
557
|
+
function makeMergedSessionUpdateEvent(sessionUpdate, text, eventId, meta, envelopeMeta, turn, sessionId) {
|
|
468
558
|
return {
|
|
469
559
|
id: eventId || void 0,
|
|
470
560
|
v: EVENT_SCHEMA_VERSION,
|
|
471
561
|
type: "session_update",
|
|
562
|
+
// Re-stamp prompt/originator attribution captured from the source
|
|
563
|
+
// chunks — clients rebuilding state from a compacted snapshot need
|
|
564
|
+
// them for prompt correlation and originator filtering. Present only
|
|
565
|
+
// when the source events carried them ("present only if set" style).
|
|
566
|
+
...turn?.promptId !== void 0 ? { promptId: turn.promptId } : {},
|
|
567
|
+
...turn?.originatorClientId !== void 0 ? { originatorClientId: turn.originatorClientId } : {},
|
|
472
568
|
...envelopeMeta !== void 0 ? { _meta: envelopeMeta } : {},
|
|
473
569
|
data: {
|
|
570
|
+
...sessionId !== void 0 ? { sessionId } : {},
|
|
474
571
|
update: {
|
|
475
572
|
sessionUpdate,
|
|
476
573
|
content: { type: "text", text },
|
|
@@ -480,6 +577,23 @@ function makeMergedSessionUpdateEvent(sessionUpdate, text, eventId, meta, envelo
|
|
|
480
577
|
};
|
|
481
578
|
}
|
|
482
579
|
__name(makeMergedSessionUpdateEvent, "makeMergedSessionUpdateEvent");
|
|
580
|
+
function captureTurnFields(event, previous) {
|
|
581
|
+
const promptId = event.promptId ?? previous?.promptId;
|
|
582
|
+
const originatorClientId = event.originatorClientId ?? previous?.originatorClientId;
|
|
583
|
+
if (promptId === void 0 && originatorClientId === void 0) {
|
|
584
|
+
return void 0;
|
|
585
|
+
}
|
|
586
|
+
return {
|
|
587
|
+
...promptId !== void 0 ? { promptId } : {},
|
|
588
|
+
...originatorClientId !== void 0 ? { originatorClientId } : {}
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
__name(captureTurnFields, "captureTurnFields");
|
|
592
|
+
function captureSessionId(event) {
|
|
593
|
+
const sessionId = event.data?.sessionId;
|
|
594
|
+
return typeof sessionId === "string" ? sessionId : void 0;
|
|
595
|
+
}
|
|
596
|
+
__name(captureSessionId, "captureSessionId");
|
|
483
597
|
function normalizeToolCallType(event) {
|
|
484
598
|
const data = event.data;
|
|
485
599
|
if (data?.update?.sessionUpdate === "tool_call_update") {
|
|
@@ -542,10 +656,14 @@ function mergeToolCallEvent(existing, incoming) {
|
|
|
542
656
|
if (updateMeta !== void 0) merged["_meta"] = updateMeta;
|
|
543
657
|
merged["sessionUpdate"] = "tool_call";
|
|
544
658
|
const mergedMeta = existing._meta || incoming._meta ? { ...existing._meta ?? {}, ...incoming._meta ?? {} } : void 0;
|
|
659
|
+
const promptId = incoming.promptId ?? existing.promptId;
|
|
660
|
+
const originatorClientId = incoming.originatorClientId ?? existing.originatorClientId;
|
|
545
661
|
return {
|
|
546
662
|
id: incoming.id ?? existing.id,
|
|
547
663
|
v: EVENT_SCHEMA_VERSION,
|
|
548
664
|
type: "session_update",
|
|
665
|
+
...promptId !== void 0 ? { promptId } : {},
|
|
666
|
+
...originatorClientId !== void 0 ? { originatorClientId } : {},
|
|
549
667
|
...mergedMeta ? { _meta: mergedMeta } : {},
|
|
550
668
|
data: {
|
|
551
669
|
...existingData,
|
|
@@ -717,11 +835,6 @@ import * as path from "node:path";
|
|
|
717
835
|
init_esbuild_shims();
|
|
718
836
|
var MID_TURN_MESSAGE_INJECTED_EVENT = "mid_turn_message_injected";
|
|
719
837
|
|
|
720
|
-
// packages/acp-bridge/src/bridgeOptions.ts
|
|
721
|
-
init_esbuild_shims();
|
|
722
|
-
var MAX_SUB_SESSION_PROMPT_CHARS = 1e5;
|
|
723
|
-
var MAX_SUB_SESSION_NAME_CHARS = 200;
|
|
724
|
-
|
|
725
838
|
// packages/acp-bridge/src/permissionMediator.ts
|
|
726
839
|
init_esbuild_shims();
|
|
727
840
|
|
|
@@ -1407,6 +1520,9 @@ var MultiClientPermissionMediator = class {
|
|
|
1407
1520
|
|
|
1408
1521
|
// packages/acp-bridge/src/bridgeClient.ts
|
|
1409
1522
|
var PUBLISH_ARTIFACT_TOOL_NAME = "artifact";
|
|
1523
|
+
var MAX_CHANNEL_DELIVERY_TEXT_CHARS = 1e5;
|
|
1524
|
+
var MAX_CHANNEL_DELIVERY_FIELD_CHARS = 2048;
|
|
1525
|
+
var MAX_CHANNEL_DELIVERY_ERROR_CHARS = 500;
|
|
1410
1526
|
function isFsErrorShape(err) {
|
|
1411
1527
|
return err instanceof Error && err.name === "FsError" && typeof err.kind === "string";
|
|
1412
1528
|
}
|
|
@@ -1415,6 +1531,25 @@ function isRecord2(value) {
|
|
|
1415
1531
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1416
1532
|
}
|
|
1417
1533
|
__name(isRecord2, "isRecord");
|
|
1534
|
+
function isBoundedChannelDeliveryString(value) {
|
|
1535
|
+
return typeof value === "string" && value.trim().length > 0 && value.length <= MAX_CHANNEL_DELIVERY_FIELD_CHARS;
|
|
1536
|
+
}
|
|
1537
|
+
__name(isBoundedChannelDeliveryString, "isBoundedChannelDeliveryString");
|
|
1538
|
+
function isChannelDeliveryTarget(value) {
|
|
1539
|
+
if (!isRecord2(value)) return false;
|
|
1540
|
+
return isBoundedChannelDeliveryString(value["channelName"]) && (value["type"] === "user" || value["type"] === "chat") && isBoundedChannelDeliveryString(value["id"]) && Object.keys(value).every(
|
|
1541
|
+
(key) => key === "channelName" || key === "type" || key === "id"
|
|
1542
|
+
);
|
|
1543
|
+
}
|
|
1544
|
+
__name(isChannelDeliveryTarget, "isChannelDeliveryTarget");
|
|
1545
|
+
function normalizeChannelDeliveryHostResult(value) {
|
|
1546
|
+
if (value.status === "delivered") return { status: "delivered" };
|
|
1547
|
+
if (value.status === "skipped") return { status: "skipped" };
|
|
1548
|
+
const code = CHANNEL_DELIVERY_ERROR_CODES.has(value.code) ? value.code : "channel_delivery_failed";
|
|
1549
|
+
const error = typeof value.error === "string" && value.error.length > 0 ? value.error.slice(0, MAX_CHANNEL_DELIVERY_ERROR_CHARS) : "Channel delivery failed.";
|
|
1550
|
+
return { status: "failed", code, error };
|
|
1551
|
+
}
|
|
1552
|
+
__name(normalizeChannelDeliveryHostResult, "normalizeChannelDeliveryHostResult");
|
|
1418
1553
|
function pendingInteractionOptions(options) {
|
|
1419
1554
|
return options.map((option) => ({
|
|
1420
1555
|
optionId: String(option.optionId ?? ""),
|
|
@@ -1625,7 +1760,7 @@ function sliceLineRange(content, startLine, endLine) {
|
|
|
1625
1760
|
}
|
|
1626
1761
|
__name(sliceLineRange, "sliceLineRange");
|
|
1627
1762
|
var BridgeClient = class {
|
|
1628
|
-
constructor(resolveEntry, resolvePendingRestoreEvents, mediator, permissionTimeoutMs, maxPendingPerSession, fileSystem, onModelPromoted, onModePromoted, clientMcpSender, ownsSession = () => true, onTokenUsage, onCreateSubSession, onGenerationEvent) {
|
|
1763
|
+
constructor(resolveEntry, resolvePendingRestoreEvents, mediator, permissionTimeoutMs, maxPendingPerSession, fileSystem, onModelPromoted, onModePromoted, clientMcpSender, ownsSession = () => true, onTokenUsage, onCreateSubSession, onGenerationEvent, onWorkspaceGenerationEvent, onChannelDelivery) {
|
|
1629
1764
|
this.resolveEntry = resolveEntry;
|
|
1630
1765
|
this.resolvePendingRestoreEvents = resolvePendingRestoreEvents;
|
|
1631
1766
|
this.mediator = mediator;
|
|
@@ -1639,6 +1774,8 @@ var BridgeClient = class {
|
|
|
1639
1774
|
this.onTokenUsage = onTokenUsage;
|
|
1640
1775
|
this.onCreateSubSession = onCreateSubSession;
|
|
1641
1776
|
this.onGenerationEvent = onGenerationEvent;
|
|
1777
|
+
this.onWorkspaceGenerationEvent = onWorkspaceGenerationEvent;
|
|
1778
|
+
this.onChannelDelivery = onChannelDelivery;
|
|
1642
1779
|
}
|
|
1643
1780
|
static {
|
|
1644
1781
|
__name(this, "BridgeClient");
|
|
@@ -1916,6 +2053,9 @@ var BridgeClient = class {
|
|
|
1916
2053
|
if (method === SERVE_CONTROL_EXT_METHODS.createSubSession) {
|
|
1917
2054
|
return this.handleCreateSubSession(params);
|
|
1918
2055
|
}
|
|
2056
|
+
if (method === SERVE_CONTROL_EXT_METHODS.channelDelivery) {
|
|
2057
|
+
return this.handleChannelDelivery(params);
|
|
2058
|
+
}
|
|
1919
2059
|
if (method !== MID_TURN_QUEUE_DRAIN_METHOD) {
|
|
1920
2060
|
throw RequestError.methodNotFound(method);
|
|
1921
2061
|
}
|
|
@@ -1952,6 +2092,98 @@ var BridgeClient = class {
|
|
|
1952
2092
|
}
|
|
1953
2093
|
return { messages, hasQueuedPrompt };
|
|
1954
2094
|
}
|
|
2095
|
+
async handleChannelDelivery(params) {
|
|
2096
|
+
if (!this.onChannelDelivery) {
|
|
2097
|
+
throw RequestError.methodNotFound(
|
|
2098
|
+
SERVE_CONTROL_EXT_METHODS.channelDelivery
|
|
2099
|
+
);
|
|
2100
|
+
}
|
|
2101
|
+
const sessionId = params["sessionId"];
|
|
2102
|
+
if (typeof sessionId !== "string" || sessionId.length === 0 || !this.ownsSession(sessionId)) {
|
|
2103
|
+
throw RequestError.invalidParams(
|
|
2104
|
+
void 0,
|
|
2105
|
+
"`sessionId` must name a session owned by this connection"
|
|
2106
|
+
);
|
|
2107
|
+
}
|
|
2108
|
+
const entry = this.resolveEntry(sessionId);
|
|
2109
|
+
if (!entry) {
|
|
2110
|
+
throw RequestError.invalidParams(void 0, "Unknown `sessionId`");
|
|
2111
|
+
}
|
|
2112
|
+
const deliveryId = params["deliveryId"];
|
|
2113
|
+
const source = params["source"];
|
|
2114
|
+
const text = params["text"];
|
|
2115
|
+
const rawTarget = params["target"];
|
|
2116
|
+
if (!isBoundedChannelDeliveryString(deliveryId) || source !== "prompt" && source !== "scheduled" || typeof text !== "string" || text.length > MAX_CHANNEL_DELIVERY_TEXT_CHARS || !isChannelDeliveryTarget(rawTarget)) {
|
|
2117
|
+
throw RequestError.invalidParams(
|
|
2118
|
+
void 0,
|
|
2119
|
+
"Invalid channel delivery request"
|
|
2120
|
+
);
|
|
2121
|
+
}
|
|
2122
|
+
const promptId = params["promptId"];
|
|
2123
|
+
const taskId = params["taskId"];
|
|
2124
|
+
const firedAt = params["firedAt"];
|
|
2125
|
+
const allowedKeys = source === "prompt" ? /* @__PURE__ */ new Set([
|
|
2126
|
+
"sessionId",
|
|
2127
|
+
"deliveryId",
|
|
2128
|
+
"source",
|
|
2129
|
+
"target",
|
|
2130
|
+
"text",
|
|
2131
|
+
"promptId"
|
|
2132
|
+
]) : /* @__PURE__ */ new Set([
|
|
2133
|
+
"sessionId",
|
|
2134
|
+
"deliveryId",
|
|
2135
|
+
"source",
|
|
2136
|
+
"target",
|
|
2137
|
+
"text",
|
|
2138
|
+
"taskId",
|
|
2139
|
+
"firedAt"
|
|
2140
|
+
]);
|
|
2141
|
+
const correlationValid = source === "prompt" ? isBoundedChannelDeliveryString(promptId) && promptId === deliveryId : isBoundedChannelDeliveryString(taskId) && typeof firedAt === "number" && Number.isFinite(firedAt) && deliveryId === `${taskId}:${firedAt}`;
|
|
2142
|
+
if (!correlationValid || !Object.keys(params).every((key) => allowedKeys.has(key))) {
|
|
2143
|
+
throw RequestError.invalidParams(
|
|
2144
|
+
void 0,
|
|
2145
|
+
"Invalid channel delivery correlation"
|
|
2146
|
+
);
|
|
2147
|
+
}
|
|
2148
|
+
const info = {
|
|
2149
|
+
sessionId,
|
|
2150
|
+
deliveryId,
|
|
2151
|
+
source,
|
|
2152
|
+
target: rawTarget,
|
|
2153
|
+
text,
|
|
2154
|
+
...source === "prompt" ? { promptId } : {},
|
|
2155
|
+
...source === "scheduled" ? { taskId, firedAt } : {}
|
|
2156
|
+
};
|
|
2157
|
+
let result;
|
|
2158
|
+
try {
|
|
2159
|
+
result = normalizeChannelDeliveryHostResult(
|
|
2160
|
+
await this.onChannelDelivery(info)
|
|
2161
|
+
);
|
|
2162
|
+
} catch {
|
|
2163
|
+
result = {
|
|
2164
|
+
status: "failed",
|
|
2165
|
+
code: "channel_delivery_failed",
|
|
2166
|
+
error: "Channel delivery failed."
|
|
2167
|
+
};
|
|
2168
|
+
}
|
|
2169
|
+
try {
|
|
2170
|
+
entry.events.publish({
|
|
2171
|
+
type: "channel_delivery_result",
|
|
2172
|
+
...source === "prompt" ? { promptId } : {},
|
|
2173
|
+
data: {
|
|
2174
|
+
sessionId,
|
|
2175
|
+
deliveryId,
|
|
2176
|
+
source,
|
|
2177
|
+
status: result.status,
|
|
2178
|
+
...source === "prompt" ? { promptId } : {},
|
|
2179
|
+
...source === "scheduled" ? { taskId, firedAt } : {},
|
|
2180
|
+
...result.status === "failed" ? { code: result.code, error: result.error } : {}
|
|
2181
|
+
}
|
|
2182
|
+
});
|
|
2183
|
+
} catch {
|
|
2184
|
+
}
|
|
2185
|
+
return result;
|
|
2186
|
+
}
|
|
1955
2187
|
/**
|
|
1956
2188
|
* Reverse tool channel (issue #5626, Phase 2) — answer the child's
|
|
1957
2189
|
* `qwen/control/client_mcp/message` ext-method. The child's session
|
|
@@ -2119,6 +2351,47 @@ var BridgeClient = class {
|
|
|
2119
2351
|
}
|
|
2120
2352
|
return;
|
|
2121
2353
|
}
|
|
2354
|
+
if (method === "qwen/notify/workspace/generation/event") {
|
|
2355
|
+
const requestId = params["requestId"];
|
|
2356
|
+
const event = params["event"];
|
|
2357
|
+
if (params["v"] !== 1 || typeof requestId !== "string" || !event || typeof event !== "object" || Array.isArray(event)) {
|
|
2358
|
+
return;
|
|
2359
|
+
}
|
|
2360
|
+
const record = event;
|
|
2361
|
+
if (record["type"] === "started") {
|
|
2362
|
+
const model = record["model"];
|
|
2363
|
+
const modelSource = record["modelSource"];
|
|
2364
|
+
if (typeof model !== "string" || modelSource !== "fast" && modelSource !== "main") {
|
|
2365
|
+
return;
|
|
2366
|
+
}
|
|
2367
|
+
this.onWorkspaceGenerationEvent?.({
|
|
2368
|
+
type: "started",
|
|
2369
|
+
requestId,
|
|
2370
|
+
model,
|
|
2371
|
+
modelSource
|
|
2372
|
+
});
|
|
2373
|
+
return;
|
|
2374
|
+
}
|
|
2375
|
+
if (record["type"] === "thinking") {
|
|
2376
|
+
this.onWorkspaceGenerationEvent?.({ type: "thinking", requestId });
|
|
2377
|
+
return;
|
|
2378
|
+
}
|
|
2379
|
+
if (record["type"] === "delta") {
|
|
2380
|
+
const seq = record["seq"];
|
|
2381
|
+
const text = record["text"];
|
|
2382
|
+
if (typeof seq !== "number" || !Number.isSafeInteger(seq) || seq < 0 || typeof text !== "string" || text.length === 0) {
|
|
2383
|
+
return;
|
|
2384
|
+
}
|
|
2385
|
+
this.onWorkspaceGenerationEvent?.({
|
|
2386
|
+
type: "delta",
|
|
2387
|
+
requestId,
|
|
2388
|
+
seq,
|
|
2389
|
+
text
|
|
2390
|
+
});
|
|
2391
|
+
return;
|
|
2392
|
+
}
|
|
2393
|
+
return;
|
|
2394
|
+
}
|
|
2122
2395
|
if (method === "qwen/notify/session/model-update") {
|
|
2123
2396
|
this.handleInSessionModelUpdate(params);
|
|
2124
2397
|
return;
|
|
@@ -5303,13 +5576,17 @@ function broadcastPromptCancelled(entry, sessionId, promptId, originatorClientId
|
|
|
5303
5576
|
}
|
|
5304
5577
|
__name(broadcastPromptCancelled, "broadcastPromptCancelled");
|
|
5305
5578
|
function broadcastPromptCancelledOnce(entry, sessionId, promptId, originatorClientId, reason) {
|
|
5306
|
-
if (entry.
|
|
5579
|
+
if (promptId !== void 0 && entry.cancelBroadcastPromptId === promptId || promptId === void 0 && entry.cancelBroadcastWithoutPrompt === true) {
|
|
5307
5580
|
writeStderrLine(
|
|
5308
|
-
`broadcastPromptCancelledOnce: suppressed duplicate cancel for session ${sessionId}
|
|
5581
|
+
`broadcastPromptCancelledOnce: suppressed duplicate cancel for session ${sessionId} prompt=${promptId ?? "none"}`
|
|
5309
5582
|
);
|
|
5310
5583
|
return;
|
|
5311
5584
|
}
|
|
5312
|
-
|
|
5585
|
+
if (promptId === void 0) {
|
|
5586
|
+
entry.cancelBroadcastWithoutPrompt = true;
|
|
5587
|
+
} else {
|
|
5588
|
+
entry.cancelBroadcastPromptId = promptId;
|
|
5589
|
+
}
|
|
5313
5590
|
broadcastPromptCancelled(
|
|
5314
5591
|
entry,
|
|
5315
5592
|
sessionId,
|
|
@@ -5375,7 +5652,7 @@ function classifyTurnErrorKind(message) {
|
|
|
5375
5652
|
return message.trim().toLowerCase() === "terminated" ? "model_stream_interrupted" : void 0;
|
|
5376
5653
|
}
|
|
5377
5654
|
__name(classifyTurnErrorKind, "classifyTurnErrorKind");
|
|
5378
|
-
function broadcastTurnError(entry, sessionId, err, promptId, originatorClientId) {
|
|
5655
|
+
function broadcastTurnError(entry, sessionId, err, promptId, originatorClientId, mutateTurnState) {
|
|
5379
5656
|
const message = extractErrorMessage(err);
|
|
5380
5657
|
const code = extractErrorCode(err);
|
|
5381
5658
|
const errorKind = classifyTurnErrorKind(message);
|
|
@@ -5384,12 +5661,14 @@ function broadcastTurnError(entry, sessionId, err, promptId, originatorClientId)
|
|
|
5384
5661
|
`turn_error classified session=${JSON.stringify(sessionId)} message=${JSON.stringify(message)} errorKind=${JSON.stringify(errorKind)}` + (code ? ` code=${JSON.stringify(code)}` : "") + (promptId ? ` promptId=${JSON.stringify(promptId)}` : "")
|
|
5385
5662
|
);
|
|
5386
5663
|
}
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5664
|
+
if (mutateTurnState) {
|
|
5665
|
+
entry.retryAllowed = true;
|
|
5666
|
+
entry.turnError = {
|
|
5667
|
+
message,
|
|
5668
|
+
...code ? { code } : {},
|
|
5669
|
+
...errorKind ? { errorKind } : {}
|
|
5670
|
+
};
|
|
5671
|
+
}
|
|
5393
5672
|
try {
|
|
5394
5673
|
entry.events.publish({
|
|
5395
5674
|
type: "turn_error",
|
|
@@ -5409,7 +5688,7 @@ function broadcastTurnError(entry, sessionId, err, promptId, originatorClientId)
|
|
|
5409
5688
|
__name(broadcastTurnError, "broadcastTurnError");
|
|
5410
5689
|
function publishPromptTerminal(entry, pendingEntry, terminal) {
|
|
5411
5690
|
if (pendingEntry.terminalPublished) {
|
|
5412
|
-
|
|
5691
|
+
writeServeDebugLine(
|
|
5413
5692
|
`publishPromptTerminal: suppressed duplicate ${terminal.kind} terminal for prompt ${pendingEntry.promptId} (session ${entry.sessionId})`
|
|
5414
5693
|
);
|
|
5415
5694
|
return;
|
|
@@ -5438,7 +5717,14 @@ function publishPromptTerminal(entry, pendingEntry, terminal) {
|
|
|
5438
5717
|
entry.sessionId,
|
|
5439
5718
|
terminal.err,
|
|
5440
5719
|
pendingEntry.promptId,
|
|
5441
|
-
originatorClientId
|
|
5720
|
+
originatorClientId,
|
|
5721
|
+
// Only a running prompt's failure is the active turn's failure. The
|
|
5722
|
+
// `state === 'running'` gate (not `activePromptId`) is deliberate:
|
|
5723
|
+
// on the normal settle path `settleActivePromptState` runs in
|
|
5724
|
+
// `promptPromise.finally` BEFORE the terminal is published, so
|
|
5725
|
+
// `activePromptId` is already cleared when a genuine active failure
|
|
5726
|
+
// lands here.
|
|
5727
|
+
pendingEntry.state === "running"
|
|
5442
5728
|
);
|
|
5443
5729
|
}
|
|
5444
5730
|
}
|
|
@@ -5775,7 +6061,54 @@ function createAcpSessionBridge(opts) {
|
|
|
5775
6061
|
const aliveChannels = /* @__PURE__ */ new Set();
|
|
5776
6062
|
let inFlightChannelSpawn;
|
|
5777
6063
|
const byId = /* @__PURE__ */ new Map();
|
|
6064
|
+
const forwardRunningPromptCancel = /* @__PURE__ */ __name(async (entry, pending, notification) => {
|
|
6065
|
+
if (pending.cancelForwardInitial) {
|
|
6066
|
+
return pending.cancelForwardInitial;
|
|
6067
|
+
}
|
|
6068
|
+
const initial = (async () => {
|
|
6069
|
+
try {
|
|
6070
|
+
const extension = entry.connection.extMethod(PROMPT_CANCEL_METHOD, notification).then((result2) => ({ kind: "result", result: result2 }));
|
|
6071
|
+
const outcome = await Promise.race([
|
|
6072
|
+
extension,
|
|
6073
|
+
getTransportClosedReject(entry),
|
|
6074
|
+
...pending.cancelForwardDeadline ? [
|
|
6075
|
+
pending.cancelForwardDeadline.then(() => ({
|
|
6076
|
+
kind: "deadline"
|
|
6077
|
+
}))
|
|
6078
|
+
] : []
|
|
6079
|
+
]);
|
|
6080
|
+
if (outcome.kind === "deadline") return;
|
|
6081
|
+
const { result } = outcome;
|
|
6082
|
+
if (typeof result["cancelled"] !== "boolean") {
|
|
6083
|
+
throw new Error(
|
|
6084
|
+
`${PROMPT_CANCEL_METHOD} returned an invalid acknowledgement`
|
|
6085
|
+
);
|
|
6086
|
+
}
|
|
6087
|
+
} catch (error) {
|
|
6088
|
+
if (typeof error === "object" && error !== null && "code" in error && error.code === -32601 || isNotCurrentlyGeneratingCancelError(error)) {
|
|
6089
|
+
await Promise.race([
|
|
6090
|
+
entry.connection.cancel(notification),
|
|
6091
|
+
getTransportClosedReject(entry),
|
|
6092
|
+
...pending.cancelForwardDeadline ? [pending.cancelForwardDeadline] : []
|
|
6093
|
+
]);
|
|
6094
|
+
return;
|
|
6095
|
+
}
|
|
6096
|
+
throw error;
|
|
6097
|
+
}
|
|
6098
|
+
})().catch((error) => {
|
|
6099
|
+
if (pending.cancelForwardInitial === initial) {
|
|
6100
|
+
delete pending.cancelForwardInitial;
|
|
6101
|
+
}
|
|
6102
|
+
throw error;
|
|
6103
|
+
});
|
|
6104
|
+
pending.cancelForwardInitial = initial;
|
|
6105
|
+
pending.cancelForwardDrain = initial;
|
|
6106
|
+
void initial.catch(() => {
|
|
6107
|
+
});
|
|
6108
|
+
return initial;
|
|
6109
|
+
}, "forwardRunningPromptCancel");
|
|
5778
6110
|
const generationRequests = /* @__PURE__ */ new Map();
|
|
6111
|
+
const workspaceGenerationRequests = /* @__PURE__ */ new Map();
|
|
5779
6112
|
const inFlightExtensionRefreshes = /* @__PURE__ */ new Map();
|
|
5780
6113
|
const toSessionSummary = /* @__PURE__ */ __name((entry) => {
|
|
5781
6114
|
let isWaitingForPermission = false;
|
|
@@ -5803,7 +6136,8 @@ function createAcpSessionBridge(opts) {
|
|
|
5803
6136
|
hasTurnError: entry.turnError !== void 0,
|
|
5804
6137
|
...entry.turnError !== void 0 ? { turnError: entry.turnError } : {},
|
|
5805
6138
|
pendingInteractions: [...entry.pendingInteractions.values()],
|
|
5806
|
-
...entry.worktree ? { worktree: entry.worktree } : {}
|
|
6139
|
+
...entry.worktree ? { worktree: entry.worktree } : {},
|
|
6140
|
+
...entry.branch ? { branch: entry.branch } : {}
|
|
5807
6141
|
};
|
|
5808
6142
|
}, "toSessionSummary");
|
|
5809
6143
|
const permissionConsensusQuorum = opts.permissionConsensusQuorum;
|
|
@@ -5910,6 +6244,7 @@ function createAcpSessionBridge(opts) {
|
|
|
5910
6244
|
if (channelInfo && !channelInfo.isDying) return channelInfo;
|
|
5911
6245
|
if (inFlightChannelSpawn) return await inFlightChannelSpawn;
|
|
5912
6246
|
const promise = (async () => {
|
|
6247
|
+
const privateParentCapability = randomBytes(32).toString("base64url");
|
|
5913
6248
|
const acpChannelId = randomUUID2();
|
|
5914
6249
|
const channel = await telemetry.withSpan(
|
|
5915
6250
|
"channel.spawn",
|
|
@@ -5918,7 +6253,10 @@ function createAcpSessionBridge(opts) {
|
|
|
5918
6253
|
"qwen-code.daemon.channel.reused": false,
|
|
5919
6254
|
"qwen-code.daemon.acp_channel.id": acpChannelId
|
|
5920
6255
|
},
|
|
5921
|
-
async () => await channelFactory(boundWorkspace,
|
|
6256
|
+
async () => await channelFactory(boundWorkspace, {
|
|
6257
|
+
...childEnvOverrides,
|
|
6258
|
+
[PRIVATE_ACP_CAPABILITY_ENV]: privateParentCapability
|
|
6259
|
+
})
|
|
5922
6260
|
);
|
|
5923
6261
|
const sessionIds = /* @__PURE__ */ new Set();
|
|
5924
6262
|
const client = new BridgeClient(
|
|
@@ -5998,7 +6336,19 @@ function createAcpSessionBridge(opts) {
|
|
|
5998
6336
|
sessionId,
|
|
5999
6337
|
requestId: event.requestId
|
|
6000
6338
|
}).catch(() => void 0);
|
|
6001
|
-
}
|
|
6339
|
+
},
|
|
6340
|
+
(event) => {
|
|
6341
|
+
const request = workspaceGenerationRequests.get(event.requestId);
|
|
6342
|
+
if (!request) return;
|
|
6343
|
+
if (request.queue.push(event)) return;
|
|
6344
|
+
request.settled = true;
|
|
6345
|
+
workspaceGenerationRequests.delete(event.requestId);
|
|
6346
|
+
request.queue.fail(new Error("Generation stream consumer too slow"));
|
|
6347
|
+
void request.connection?.extMethod(SERVE_CONTROL_EXT_METHODS.workspaceGenerationCancel, {
|
|
6348
|
+
requestId: event.requestId
|
|
6349
|
+
}).catch(() => void 0);
|
|
6350
|
+
},
|
|
6351
|
+
opts.onChannelDelivery
|
|
6002
6352
|
);
|
|
6003
6353
|
const connection = new ClientSideConnection(() => client, channel.stream);
|
|
6004
6354
|
const info = {
|
|
@@ -6107,7 +6457,8 @@ function createAcpSessionBridge(opts) {
|
|
|
6107
6457
|
_meta: {
|
|
6108
6458
|
[CHANNEL_STARTUP_PROFILE_META_KEY]: {
|
|
6109
6459
|
v: CHANNEL_STARTUP_PROFILE_VERSION
|
|
6110
|
-
}
|
|
6460
|
+
},
|
|
6461
|
+
[PRIVATE_PARENT_CAPABILITY_META_KEY]: privateParentCapability
|
|
6111
6462
|
},
|
|
6112
6463
|
clientCapabilities: {
|
|
6113
6464
|
fs: { readTextFile: true, writeTextFile: true }
|
|
@@ -6156,7 +6507,7 @@ function createAcpSessionBridge(opts) {
|
|
|
6156
6507
|
}
|
|
6157
6508
|
}
|
|
6158
6509
|
__name(ensureChannel, "ensureChannel");
|
|
6159
|
-
async function doSpawn(modelServiceId, effectiveScope, approvalMode, requestedClientId, onSessionRegistered, parentSessionId, sourceType, sourceId, worktree) {
|
|
6510
|
+
async function doSpawn(modelServiceId, effectiveScope, approvalMode, requestedClientId, onSessionRegistered, parentSessionId, sourceType, sourceId, worktree, branch) {
|
|
6160
6511
|
const channelPath = channelInfo && !channelInfo.isDying ? "reused" : inFlightChannelSpawn ? "joined" : "spawned_on_request";
|
|
6161
6512
|
const ci = await telemetry.withSpan(
|
|
6162
6513
|
"channel.wait",
|
|
@@ -6217,7 +6568,7 @@ function createAcpSessionBridge(opts) {
|
|
|
6217
6568
|
newSessionResp.sessionId,
|
|
6218
6569
|
boundWorkspace,
|
|
6219
6570
|
void 0,
|
|
6220
|
-
{ parentSessionId, sourceType, sourceId, worktree }
|
|
6571
|
+
{ parentSessionId, sourceType, sourceId, worktree, branch }
|
|
6221
6572
|
);
|
|
6222
6573
|
initializedSessionId = entry.sessionId;
|
|
6223
6574
|
sessionRegistered = true;
|
|
@@ -6332,7 +6683,8 @@ function createAcpSessionBridge(opts) {
|
|
|
6332
6683
|
...entry.sourceId !== void 0 ? { sourceId: entry.sourceId } : {},
|
|
6333
6684
|
...entry.sourceType ? { sourcePersisted: sourcePersisted === true } : {},
|
|
6334
6685
|
...entry.parentSessionId ? { parentSessionPersisted: parentSessionPersisted === true } : {},
|
|
6335
|
-
...entry.worktree ? { worktree: entry.worktree } : {}
|
|
6686
|
+
...entry.worktree ? { worktree: entry.worktree } : {},
|
|
6687
|
+
...entry.branch ? { branch: entry.branch } : {}
|
|
6336
6688
|
};
|
|
6337
6689
|
} finally {
|
|
6338
6690
|
ci.sessionSpawnsInFlight = Math.max(0, ci.sessionSpawnsInFlight - 1);
|
|
@@ -6828,7 +7180,7 @@ function createAcpSessionBridge(opts) {
|
|
|
6828
7180
|
if (published === void 0) {
|
|
6829
7181
|
failureCount += 1;
|
|
6830
7182
|
teeServeDebugLine(
|
|
6831
|
-
`broadcastWorkspaceEvent: publish on session ${entry.sessionId} no-op (bus closed)`
|
|
7183
|
+
`broadcastWorkspaceEvent: publish on session ${entry.sessionId} no-op (bus closed or unserializable)`
|
|
6832
7184
|
);
|
|
6833
7185
|
} else {
|
|
6834
7186
|
successCount += 1;
|
|
@@ -6850,7 +7202,7 @@ function createAcpSessionBridge(opts) {
|
|
|
6850
7202
|
);
|
|
6851
7203
|
}
|
|
6852
7204
|
}, "broadcastWorkspaceEvent");
|
|
6853
|
-
const createSessionEventBus = /* @__PURE__ */ __name(() => new EventBus(
|
|
7205
|
+
const createSessionEventBus = /* @__PURE__ */ __name((sessionId) => new EventBus(
|
|
6854
7206
|
eventRingSize,
|
|
6855
7207
|
void 0,
|
|
6856
7208
|
new TurnBoundaryCompactionEngine({
|
|
@@ -6860,7 +7212,17 @@ function createAcpSessionBridge(opts) {
|
|
|
6860
7212
|
`replay window evicted ${JSON.stringify(eviction)}`
|
|
6861
7213
|
);
|
|
6862
7214
|
}, "onReplayWindowEviction")
|
|
6863
|
-
})
|
|
7215
|
+
}),
|
|
7216
|
+
{
|
|
7217
|
+
// Fired once, on the FIRST ingest/seed failure (the bus keeps the
|
|
7218
|
+
// degraded flag set silently afterwards). The bus doesn't know its
|
|
7219
|
+
// session, so the sessionId context is injected here.
|
|
7220
|
+
onCompactionError: /* @__PURE__ */ __name((err) => {
|
|
7221
|
+
writeStderrLine(
|
|
7222
|
+
`qwen serve: compaction degraded for session=${JSON.stringify(sessionId)}; replay snapshot may lag behind live events: ${err instanceof Error ? err.message : String(err)}`
|
|
7223
|
+
);
|
|
7224
|
+
}, "onCompactionError")
|
|
7225
|
+
}
|
|
6864
7226
|
), "createSessionEventBus");
|
|
6865
7227
|
const publishModelSwitched = /* @__PURE__ */ __name((entry, modelId, originatorClientId) => {
|
|
6866
7228
|
entry.currentModelId = modelId;
|
|
@@ -6944,7 +7306,7 @@ function createAcpSessionBridge(opts) {
|
|
|
6944
7306
|
if (rerun) void reconcileAfterRoundtrip(entry, target);
|
|
6945
7307
|
}
|
|
6946
7308
|
}, "reconcileAfterRoundtrip");
|
|
6947
|
-
const createSessionEntry = /* @__PURE__ */ __name((ci, sessionId, workspaceCwd, events = createSessionEventBus(), options = {}) => {
|
|
7309
|
+
const createSessionEntry = /* @__PURE__ */ __name((ci, sessionId, workspaceCwd, events = createSessionEventBus(sessionId), options = {}) => {
|
|
6948
7310
|
const entry = {
|
|
6949
7311
|
sessionId,
|
|
6950
7312
|
workspaceCwd,
|
|
@@ -6953,6 +7315,7 @@ function createAcpSessionBridge(opts) {
|
|
|
6953
7315
|
...options.sourceType ? { sourceType: options.sourceType } : {},
|
|
6954
7316
|
...options.sourceId !== void 0 ? { sourceId: options.sourceId } : {},
|
|
6955
7317
|
...options.worktree ? { worktree: options.worktree } : {},
|
|
7318
|
+
...options.branch ? { branch: options.branch } : {},
|
|
6956
7319
|
channel: ci.channel,
|
|
6957
7320
|
connection: ci.connection,
|
|
6958
7321
|
events,
|
|
@@ -7120,20 +7483,27 @@ function createAcpSessionBridge(opts) {
|
|
|
7120
7483
|
partial: true,
|
|
7121
7484
|
...typeof entry.restoreReplayError === "string" ? { replayError: entry.restoreReplayError } : {}
|
|
7122
7485
|
} : {};
|
|
7486
|
+
const eventEpoch = entry.events.epoch;
|
|
7123
7487
|
const snapshot = entry.events.snapshotReplay();
|
|
7124
7488
|
if (!snapshot) {
|
|
7125
|
-
return {
|
|
7489
|
+
return {
|
|
7490
|
+
lastEventId: entry.events.lastEventId,
|
|
7491
|
+
eventEpoch,
|
|
7492
|
+
...replayStatus
|
|
7493
|
+
};
|
|
7126
7494
|
}
|
|
7127
7495
|
if (action === "load") {
|
|
7128
7496
|
return {
|
|
7129
7497
|
compactedReplay: snapshot.compactedTurns,
|
|
7130
7498
|
liveJournal: snapshot.liveJournal,
|
|
7131
7499
|
lastEventId: snapshot.lastEventId,
|
|
7500
|
+
eventEpoch,
|
|
7132
7501
|
...replayStatus,
|
|
7502
|
+
...snapshot.degraded ? { replayDegraded: true } : {},
|
|
7133
7503
|
...entry.restoreHistoryHasMore === true ? { historyHasMore: true } : {}
|
|
7134
7504
|
};
|
|
7135
7505
|
}
|
|
7136
|
-
return { lastEventId: snapshot.lastEventId, ...replayStatus };
|
|
7506
|
+
return { lastEventId: snapshot.lastEventId, eventEpoch, ...replayStatus };
|
|
7137
7507
|
}, "replayFieldsFor");
|
|
7138
7508
|
const restoredArtifactSnapshotFromState = /* @__PURE__ */ __name((state) => {
|
|
7139
7509
|
const candidate = state.artifactSnapshot;
|
|
@@ -7166,6 +7536,62 @@ function createAcpSessionBridge(opts) {
|
|
|
7166
7536
|
} = state;
|
|
7167
7537
|
return publicState;
|
|
7168
7538
|
}, "publicRestoreState");
|
|
7539
|
+
async function requestSessionTranscriptPage(req) {
|
|
7540
|
+
const info = await ensureChannel();
|
|
7541
|
+
try {
|
|
7542
|
+
const response = await withWorkspaceControl(
|
|
7543
|
+
info,
|
|
7544
|
+
() => withTimeout(
|
|
7545
|
+
Promise.race([
|
|
7546
|
+
info.connection.extMethod(
|
|
7547
|
+
SERVE_STATUS_EXT_METHODS.sessionTranscript,
|
|
7548
|
+
{ ...req, cwd: boundWorkspace }
|
|
7549
|
+
),
|
|
7550
|
+
getChannelClosedReject(info)
|
|
7551
|
+
]),
|
|
7552
|
+
Math.max(initTimeoutMs, SESSION_TRANSCRIPT_TIMEOUT_MS),
|
|
7553
|
+
SERVE_STATUS_EXT_METHODS.sessionTranscript
|
|
7554
|
+
)
|
|
7555
|
+
);
|
|
7556
|
+
return response;
|
|
7557
|
+
} catch (err) {
|
|
7558
|
+
if (isAcpSessionResourceNotFound(err, req.sessionId)) {
|
|
7559
|
+
throw new SessionNotFoundError(req.sessionId);
|
|
7560
|
+
}
|
|
7561
|
+
throw err;
|
|
7562
|
+
} finally {
|
|
7563
|
+
if (hasNoChannelWork(info)) {
|
|
7564
|
+
await startIdleTimer(info, "session transcript");
|
|
7565
|
+
}
|
|
7566
|
+
}
|
|
7567
|
+
}
|
|
7568
|
+
__name(requestSessionTranscriptPage, "requestSessionTranscriptPage");
|
|
7569
|
+
async function refreshedReplayFieldsFor(entry, historyPageSize) {
|
|
7570
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
7571
|
+
try {
|
|
7572
|
+
const lastEventId = entry.events.lastEventId;
|
|
7573
|
+
const page = await requestSessionTranscriptPage({
|
|
7574
|
+
sessionId: entry.sessionId,
|
|
7575
|
+
direction: "backward",
|
|
7576
|
+
limit: historyPageSize
|
|
7577
|
+
});
|
|
7578
|
+
if (byId.get(entry.sessionId) === entry && !entry.promptActive && entry.events.lastEventId === lastEventId) {
|
|
7579
|
+
return {
|
|
7580
|
+
compactedReplay: page.events,
|
|
7581
|
+
liveJournal: [],
|
|
7582
|
+
lastEventId,
|
|
7583
|
+
...page.partial === true ? { partial: true } : {},
|
|
7584
|
+
...page.replayError !== void 0 ? { replayError: page.replayError } : {},
|
|
7585
|
+
...page.hasMore ? { historyHasMore: true } : {}
|
|
7586
|
+
};
|
|
7587
|
+
}
|
|
7588
|
+
} catch {
|
|
7589
|
+
break;
|
|
7590
|
+
}
|
|
7591
|
+
}
|
|
7592
|
+
return replayFieldsFor(entry, "load");
|
|
7593
|
+
}
|
|
7594
|
+
__name(refreshedReplayFieldsFor, "refreshedReplayFieldsFor");
|
|
7169
7595
|
async function restoreSession(action, req, options = {}) {
|
|
7170
7596
|
if (shuttingDown) {
|
|
7171
7597
|
throw new Error("AcpSessionBridge is shutting down");
|
|
@@ -7185,6 +7611,10 @@ function createAcpSessionBridge(opts) {
|
|
|
7185
7611
|
"The session is closing; retry after close completes"
|
|
7186
7612
|
);
|
|
7187
7613
|
}
|
|
7614
|
+
const replayFields = action === "load" && req.historyPageSize !== void 0 ? await refreshedReplayFieldsFor(existing, req.historyPageSize) : replayFieldsFor(existing, action);
|
|
7615
|
+
if (byId.get(req.sessionId) !== existing || existing.closing) {
|
|
7616
|
+
throw new SessionNotFoundError(req.sessionId);
|
|
7617
|
+
}
|
|
7188
7618
|
existing.attachCount++;
|
|
7189
7619
|
const clientId = registerClient(existing, req.clientId);
|
|
7190
7620
|
recordAttachRef(existing, clientId);
|
|
@@ -7203,7 +7633,7 @@ function createAcpSessionBridge(opts) {
|
|
|
7203
7633
|
// caller saw; spawn-only sessions don't carry a state payload.
|
|
7204
7634
|
state: existing.restoreState ?? {},
|
|
7205
7635
|
hasActivePrompt: existing.promptActive,
|
|
7206
|
-
...
|
|
7636
|
+
...replayFields
|
|
7207
7637
|
};
|
|
7208
7638
|
}
|
|
7209
7639
|
const inFlight = inFlightRestores.get(req.sessionId);
|
|
@@ -7247,7 +7677,7 @@ function createAcpSessionBridge(opts) {
|
|
|
7247
7677
|
if (byId.size + inFlightSpawns.size + inFlightRestores.size >= maxSessions) {
|
|
7248
7678
|
throw new SessionLimitExceededError(maxSessions);
|
|
7249
7679
|
}
|
|
7250
|
-
const restoreEvents = createSessionEventBus();
|
|
7680
|
+
const restoreEvents = createSessionEventBus(req.sessionId);
|
|
7251
7681
|
let registeredEntry;
|
|
7252
7682
|
let ci;
|
|
7253
7683
|
const coalesceState = { count: 0 };
|
|
@@ -7797,7 +8227,8 @@ function createAcpSessionBridge(opts) {
|
|
|
7797
8227
|
req.parentSessionId,
|
|
7798
8228
|
source.sourceType,
|
|
7799
8229
|
source.sourceId,
|
|
7800
|
-
req.worktree
|
|
8230
|
+
req.worktree,
|
|
8231
|
+
req.branch
|
|
7801
8232
|
);
|
|
7802
8233
|
const tracker = effectiveScope === "single" ? workspaceKey : `${workspaceKey}#${randomUUID2()}`;
|
|
7803
8234
|
inFlightSpawns.set(tracker, promise);
|
|
@@ -7849,6 +8280,12 @@ function createAcpSessionBridge(opts) {
|
|
|
7849
8280
|
entry.pendingPromptCount = Math.max(0, entry.pendingPromptCount - 1);
|
|
7850
8281
|
}, "releasePromptSlot");
|
|
7851
8282
|
const promptId = context?.promptId ?? randomUUID2();
|
|
8283
|
+
const invocationContext = Object.freeze({
|
|
8284
|
+
version: 1,
|
|
8285
|
+
sessionId,
|
|
8286
|
+
promptId,
|
|
8287
|
+
...originatorClientId ? { originatorClientId } : {}
|
|
8288
|
+
});
|
|
7852
8289
|
const isQueued = entry.pendingPromptCount > 1;
|
|
7853
8290
|
const pendingAbort = new AbortController();
|
|
7854
8291
|
if (signal) {
|
|
@@ -7882,6 +8319,10 @@ function createAcpSessionBridge(opts) {
|
|
|
7882
8319
|
});
|
|
7883
8320
|
deadlinePromise.catch(() => {
|
|
7884
8321
|
});
|
|
8322
|
+
pendingEntry.cancelForwardDeadline = deadlinePromise.then(
|
|
8323
|
+
() => void 0,
|
|
8324
|
+
() => void 0
|
|
8325
|
+
);
|
|
7885
8326
|
const onDeadline = /* @__PURE__ */ __name(() => {
|
|
7886
8327
|
if (pendingEntry.terminalPublished) return;
|
|
7887
8328
|
const deadlineErr = new PromptDeadlineExceededError(deadlineMs);
|
|
@@ -7938,6 +8379,9 @@ function createAcpSessionBridge(opts) {
|
|
|
7938
8379
|
const queueWaitMs = Date.now() - queuedAt;
|
|
7939
8380
|
telemetry.metrics?.promptQueueWait(queueWaitMs);
|
|
7940
8381
|
if (pendingAbort.signal.aborted) {
|
|
8382
|
+
if (pendingAbort.signal.reason instanceof PromptDeadlineExceededError) {
|
|
8383
|
+
throw pendingAbort.signal.reason;
|
|
8384
|
+
}
|
|
7941
8385
|
throw new DOMException("Prompt aborted", "AbortError");
|
|
7942
8386
|
}
|
|
7943
8387
|
if (pendingEntry.state === "queued") {
|
|
@@ -7981,15 +8425,23 @@ function createAcpSessionBridge(opts) {
|
|
|
7981
8425
|
...normalized
|
|
7982
8426
|
};
|
|
7983
8427
|
delete copy.retry;
|
|
8428
|
+
delete copy.delivery;
|
|
7984
8429
|
const meta = copy._meta && typeof copy._meta === "object" ? { ...copy._meta } : {};
|
|
7985
8430
|
delete meta[DAEMON_RETRY_META_KEY];
|
|
8431
|
+
delete meta[INVOCATION_CONTEXT_META_KEY];
|
|
8432
|
+
delete meta[PRIVATE_PARENT_CAPABILITY_META_KEY];
|
|
7986
8433
|
delete meta[DAEMON_CONTINUE_META_KEY];
|
|
8434
|
+
delete meta[DAEMON_CHANNEL_DELIVERY_META_KEY];
|
|
7987
8435
|
if (isRetry) {
|
|
7988
8436
|
meta[DAEMON_RETRY_META_KEY] = true;
|
|
7989
8437
|
}
|
|
7990
8438
|
if (isContinue) {
|
|
7991
8439
|
meta[DAEMON_CONTINUE_META_KEY] = true;
|
|
7992
8440
|
}
|
|
8441
|
+
if (context?.channelDelivery) {
|
|
8442
|
+
meta[DAEMON_CHANNEL_DELIVERY_META_KEY] = context.channelDelivery;
|
|
8443
|
+
}
|
|
8444
|
+
meta[INVOCATION_CONTEXT_META_KEY] = invocationContext;
|
|
7993
8445
|
if (Object.keys(meta).length > 0) {
|
|
7994
8446
|
copy._meta = meta;
|
|
7995
8447
|
} else {
|
|
@@ -7999,6 +8451,7 @@ function createAcpSessionBridge(opts) {
|
|
|
7999
8451
|
})();
|
|
8000
8452
|
entry.promptActive = true;
|
|
8001
8453
|
entry.activePromptId = pendingEntry.promptId;
|
|
8454
|
+
delete entry.cancelBroadcastWithoutPrompt;
|
|
8002
8455
|
delete entry.turnError;
|
|
8003
8456
|
activePromptCounter++;
|
|
8004
8457
|
entry.sessionLastSeenAt = Date.now();
|
|
@@ -8009,7 +8462,6 @@ function createAcpSessionBridge(opts) {
|
|
|
8009
8462
|
entry.activePromptOriginatorClientId = originatorClientId;
|
|
8010
8463
|
}
|
|
8011
8464
|
try {
|
|
8012
|
-
entry.cancelBroadcast = false;
|
|
8013
8465
|
if (!isRetry && !isContinue) {
|
|
8014
8466
|
echoPromptToSessionBus(
|
|
8015
8467
|
entry,
|
|
@@ -8022,6 +8474,7 @@ function createAcpSessionBridge(opts) {
|
|
|
8022
8474
|
settleActivePromptState(entry, pendingEntry.promptId);
|
|
8023
8475
|
throw echoErr;
|
|
8024
8476
|
}
|
|
8477
|
+
pendingEntry.dispatched = true;
|
|
8025
8478
|
const promptPromise = entry.connection.prompt(promptRequest).finally(() => {
|
|
8026
8479
|
settleActivePromptState(entry, pendingEntry.promptId);
|
|
8027
8480
|
});
|
|
@@ -8057,11 +8510,6 @@ function createAcpSessionBridge(opts) {
|
|
|
8057
8510
|
"forward_failed"
|
|
8058
8511
|
);
|
|
8059
8512
|
cancelPendingForSession(sessionId);
|
|
8060
|
-
entry.connection.cancel({ sessionId }).catch((err2) => {
|
|
8061
|
-
writeStderrLine(
|
|
8062
|
-
`[pending-prompt] cancel forward failed after prompt abort session=${sessionId}: ${extractErrorMessage(err2)}`
|
|
8063
|
-
);
|
|
8064
|
-
});
|
|
8065
8513
|
}
|
|
8066
8514
|
).catch(() => {
|
|
8067
8515
|
});
|
|
@@ -8074,11 +8522,15 @@ function createAcpSessionBridge(opts) {
|
|
|
8074
8522
|
originatorClientId
|
|
8075
8523
|
);
|
|
8076
8524
|
cancelPendingForSession(sessionId);
|
|
8077
|
-
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
)
|
|
8081
|
-
|
|
8525
|
+
if (byId.get(sessionId) === entry) {
|
|
8526
|
+
void forwardRunningPromptCancel(entry, pendingEntry, {
|
|
8527
|
+
sessionId
|
|
8528
|
+
}).catch((err) => {
|
|
8529
|
+
writeStderrLine(
|
|
8530
|
+
`[pending-prompt] cancel forward failed after removePendingPrompt session=${sessionId}: ${extractErrorMessage(err)}`
|
|
8531
|
+
);
|
|
8532
|
+
});
|
|
8533
|
+
}
|
|
8082
8534
|
}, "onAbort");
|
|
8083
8535
|
if (abortSignal.aborted) {
|
|
8084
8536
|
onAbort();
|
|
@@ -8115,16 +8567,22 @@ function createAcpSessionBridge(opts) {
|
|
|
8115
8567
|
publishPromptTerminal(entry, pendingEntry, { kind: "error", err });
|
|
8116
8568
|
}
|
|
8117
8569
|
);
|
|
8570
|
+
const drainCancelForwarding = /* @__PURE__ */ __name(async () => {
|
|
8571
|
+
try {
|
|
8572
|
+
await pendingEntry.cancelForwardDrain;
|
|
8573
|
+
} catch {
|
|
8574
|
+
}
|
|
8575
|
+
}, "drainCancelForwarding");
|
|
8118
8576
|
entry.promptQueue = result.then(
|
|
8119
|
-
|
|
8120
|
-
|
|
8577
|
+
drainCancelForwarding,
|
|
8578
|
+
drainCancelForwarding
|
|
8121
8579
|
);
|
|
8122
8580
|
result.finally(() => {
|
|
8123
8581
|
if (deadlineTimer !== void 0) clearTimeout(deadlineTimer);
|
|
8124
8582
|
const listIdx = entry.pendingPromptList.indexOf(pendingEntry);
|
|
8125
8583
|
if (listIdx !== -1) {
|
|
8126
8584
|
entry.pendingPromptList.splice(listIdx, 1);
|
|
8127
|
-
if (isQueued) {
|
|
8585
|
+
if (isQueued && !pendingEntry.removed) {
|
|
8128
8586
|
try {
|
|
8129
8587
|
entry.events.publish({
|
|
8130
8588
|
type: "pending_prompt_completed",
|
|
@@ -8171,10 +8629,13 @@ function createAcpSessionBridge(opts) {
|
|
|
8171
8629
|
entry,
|
|
8172
8630
|
context?.clientId
|
|
8173
8631
|
);
|
|
8632
|
+
const runningPrompt = entry.pendingPromptList.find(
|
|
8633
|
+
(pending) => pending.state === "running" && !pending.terminalPublished
|
|
8634
|
+
);
|
|
8174
8635
|
broadcastPromptCancelledOnce(
|
|
8175
8636
|
entry,
|
|
8176
8637
|
sessionId,
|
|
8177
|
-
entry.activePromptId,
|
|
8638
|
+
entry.activePromptId ?? runningPrompt?.promptId,
|
|
8178
8639
|
cancelOriginatorClientId
|
|
8179
8640
|
);
|
|
8180
8641
|
cancelPendingForSession(sessionId);
|
|
@@ -8187,6 +8648,17 @@ function createAcpSessionBridge(opts) {
|
|
|
8187
8648
|
"session.id": sessionId
|
|
8188
8649
|
},
|
|
8189
8650
|
async () => {
|
|
8651
|
+
if (runningPrompt) {
|
|
8652
|
+
const forwarding = runningPrompt.dispatched === true && entry.activePromptId === runningPrompt.promptId ? forwardRunningPromptCancel(entry, runningPrompt, notif) : Promise.resolve();
|
|
8653
|
+
runningPrompt.abortController.abort(
|
|
8654
|
+
new DOMException(
|
|
8655
|
+
"Prompt cancelled before dispatch",
|
|
8656
|
+
"AbortError"
|
|
8657
|
+
)
|
|
8658
|
+
);
|
|
8659
|
+
await forwarding;
|
|
8660
|
+
return;
|
|
8661
|
+
}
|
|
8190
8662
|
try {
|
|
8191
8663
|
await entry.connection.cancel(notif);
|
|
8192
8664
|
} catch (err) {
|
|
@@ -8233,6 +8705,11 @@ function createAcpSessionBridge(opts) {
|
|
|
8233
8705
|
if (!entry) throw new SessionNotFoundError(sessionId);
|
|
8234
8706
|
return entry.events.lastEventId;
|
|
8235
8707
|
},
|
|
8708
|
+
getSessionEventEpoch(sessionId) {
|
|
8709
|
+
const entry = byId.get(sessionId);
|
|
8710
|
+
if (!entry) throw new SessionNotFoundError(sessionId);
|
|
8711
|
+
return entry.events.epoch;
|
|
8712
|
+
},
|
|
8236
8713
|
getSessionReplaySnapshot(sessionId) {
|
|
8237
8714
|
const entry = byId.get(sessionId);
|
|
8238
8715
|
if (!entry) throw new SessionNotFoundError(sessionId);
|
|
@@ -8608,7 +9085,7 @@ function createAcpSessionBridge(opts) {
|
|
|
8608
9085
|
if (published === void 0) {
|
|
8609
9086
|
failureCount += 1;
|
|
8610
9087
|
teeServeDebugLine(
|
|
8611
|
-
`publishWorkspaceEvent: publish on session ${entry.sessionId} no-op (bus closed)`
|
|
9088
|
+
`publishWorkspaceEvent: publish on session ${entry.sessionId} no-op (bus closed or unserializable)`
|
|
8612
9089
|
);
|
|
8613
9090
|
} else {
|
|
8614
9091
|
successCount += 1;
|
|
@@ -8877,33 +9354,7 @@ function createAcpSessionBridge(opts) {
|
|
|
8877
9354
|
);
|
|
8878
9355
|
},
|
|
8879
9356
|
async getSessionTranscriptPage(req) {
|
|
8880
|
-
|
|
8881
|
-
try {
|
|
8882
|
-
const response = await withWorkspaceControl(
|
|
8883
|
-
info,
|
|
8884
|
-
() => withTimeout(
|
|
8885
|
-
Promise.race([
|
|
8886
|
-
info.connection.extMethod(
|
|
8887
|
-
SERVE_STATUS_EXT_METHODS.sessionTranscript,
|
|
8888
|
-
{ ...req, cwd: boundWorkspace }
|
|
8889
|
-
),
|
|
8890
|
-
getChannelClosedReject(info)
|
|
8891
|
-
]),
|
|
8892
|
-
Math.max(initTimeoutMs, SESSION_TRANSCRIPT_TIMEOUT_MS),
|
|
8893
|
-
SERVE_STATUS_EXT_METHODS.sessionTranscript
|
|
8894
|
-
)
|
|
8895
|
-
);
|
|
8896
|
-
return response;
|
|
8897
|
-
} catch (err) {
|
|
8898
|
-
if (isAcpSessionResourceNotFound(err, req.sessionId)) {
|
|
8899
|
-
throw new SessionNotFoundError(req.sessionId);
|
|
8900
|
-
}
|
|
8901
|
-
throw err;
|
|
8902
|
-
} finally {
|
|
8903
|
-
if (hasNoChannelWork(info)) {
|
|
8904
|
-
await startIdleTimer(info, "session transcript");
|
|
8905
|
-
}
|
|
8906
|
-
}
|
|
9357
|
+
return requestSessionTranscriptPage(req);
|
|
8907
9358
|
},
|
|
8908
9359
|
async cancelSessionTask(sessionId, taskId, taskKind) {
|
|
8909
9360
|
return requestSessionStatus(
|
|
@@ -8935,6 +9386,7 @@ function createAcpSessionBridge(opts) {
|
|
|
8935
9386
|
const liveEntry = byId.get(sessionId);
|
|
8936
9387
|
if (!liveEntry) throw new SessionNotFoundError(sessionId);
|
|
8937
9388
|
const lastEventId = liveEntry.events.lastEventId;
|
|
9389
|
+
const eventEpoch = liveEntry.events.epoch;
|
|
8938
9390
|
const promptId = context?.promptId;
|
|
8939
9391
|
const promptPromise = bridgeApi.sendPrompt(
|
|
8940
9392
|
sessionId,
|
|
@@ -8954,7 +9406,8 @@ function createAcpSessionBridge(opts) {
|
|
|
8954
9406
|
return {
|
|
8955
9407
|
...decision,
|
|
8956
9408
|
...promptId !== void 0 ? { promptId } : {},
|
|
8957
|
-
lastEventId
|
|
9409
|
+
lastEventId,
|
|
9410
|
+
eventEpoch
|
|
8958
9411
|
};
|
|
8959
9412
|
},
|
|
8960
9413
|
async getSessionStatsStatus(sessionId) {
|
|
@@ -9271,7 +9724,7 @@ function createAcpSessionBridge(opts) {
|
|
|
9271
9724
|
const entry = byId.get(sessionId);
|
|
9272
9725
|
if (!entry) throw new SessionNotFoundError(sessionId);
|
|
9273
9726
|
resolveTrustedClientId(entry, context?.clientId);
|
|
9274
|
-
return entry.pendingPromptList.map((p) => ({
|
|
9727
|
+
return entry.pendingPromptList.filter((p) => !p.removed).map((p) => ({
|
|
9275
9728
|
promptId: p.promptId,
|
|
9276
9729
|
text: p.text,
|
|
9277
9730
|
queuedAt: p.queuedAt,
|
|
@@ -9288,13 +9741,18 @@ function createAcpSessionBridge(opts) {
|
|
|
9288
9741
|
);
|
|
9289
9742
|
if (idx === -1) return { removed: false };
|
|
9290
9743
|
const target = entry.pendingPromptList[idx];
|
|
9744
|
+
if (target.removed) return { removed: false };
|
|
9291
9745
|
writeStderrLine(
|
|
9292
9746
|
`[pending-prompt] session=${sessionId} removing promptId=${promptId} state=${target.state}`
|
|
9293
9747
|
);
|
|
9294
9748
|
target.abortController.abort(
|
|
9295
9749
|
new DOMException("Prompt removed by user", "AbortError")
|
|
9296
9750
|
);
|
|
9297
|
-
|
|
9751
|
+
if (target.state === "queued") {
|
|
9752
|
+
entry.pendingPromptList.splice(idx, 1);
|
|
9753
|
+
} else {
|
|
9754
|
+
target.removed = true;
|
|
9755
|
+
}
|
|
9298
9756
|
try {
|
|
9299
9757
|
entry.events.publish({
|
|
9300
9758
|
type: "pending_prompt_completed",
|
|
@@ -9748,7 +10206,7 @@ function createAcpSessionBridge(opts) {
|
|
|
9748
10206
|
}
|
|
9749
10207
|
}
|
|
9750
10208
|
},
|
|
9751
|
-
async reloadWorkspaceMcp() {
|
|
10209
|
+
async reloadWorkspaceMcp(options) {
|
|
9752
10210
|
const info = await ensureChannel();
|
|
9753
10211
|
info.workspaceMcpDiscoveryRequested = true;
|
|
9754
10212
|
try {
|
|
@@ -9756,7 +10214,7 @@ function createAcpSessionBridge(opts) {
|
|
|
9756
10214
|
withTimeout(
|
|
9757
10215
|
info.connection.extMethod(
|
|
9758
10216
|
SERVE_CONTROL_EXT_METHODS.workspaceMcpReload,
|
|
9759
|
-
{ cwd: boundWorkspace }
|
|
10217
|
+
{ cwd: boundWorkspace, ...options }
|
|
9760
10218
|
),
|
|
9761
10219
|
initTimeoutMs,
|
|
9762
10220
|
SERVE_CONTROL_EXT_METHODS.workspaceMcpReload
|
|
@@ -9790,6 +10248,85 @@ function createAcpSessionBridge(opts) {
|
|
|
9790
10248
|
getChannelClosedReject(info)
|
|
9791
10249
|
]);
|
|
9792
10250
|
},
|
|
10251
|
+
generateWorkspaceContent(prompt, signal, _originatorClientId) {
|
|
10252
|
+
const requestId = randomUUID2();
|
|
10253
|
+
const queue = new GenerationStreamQueue(
|
|
10254
|
+
GENERATION_STREAM_QUEUE_CAPACITY
|
|
10255
|
+
);
|
|
10256
|
+
const request = {
|
|
10257
|
+
connection: void 0,
|
|
10258
|
+
queue,
|
|
10259
|
+
settled: false
|
|
10260
|
+
};
|
|
10261
|
+
const cancel = /* @__PURE__ */ __name(() => {
|
|
10262
|
+
if (request.settled) return;
|
|
10263
|
+
request.settled = true;
|
|
10264
|
+
workspaceGenerationRequests.delete(requestId);
|
|
10265
|
+
queue.close();
|
|
10266
|
+
void request.connection?.extMethod(SERVE_CONTROL_EXT_METHODS.workspaceGenerationCancel, {
|
|
10267
|
+
requestId
|
|
10268
|
+
}).catch(() => void 0);
|
|
10269
|
+
}, "cancel");
|
|
10270
|
+
signal.addEventListener("abort", cancel, { once: true });
|
|
10271
|
+
if (signal.aborted) {
|
|
10272
|
+
cancel();
|
|
10273
|
+
return queue;
|
|
10274
|
+
}
|
|
10275
|
+
void (async () => {
|
|
10276
|
+
let info;
|
|
10277
|
+
try {
|
|
10278
|
+
const channelInfo2 = await ensureChannel();
|
|
10279
|
+
info = channelInfo2;
|
|
10280
|
+
request.connection = channelInfo2.connection;
|
|
10281
|
+
await withWorkspaceControl(channelInfo2, async () => {
|
|
10282
|
+
if (request.settled) return;
|
|
10283
|
+
workspaceGenerationRequests.set(requestId, request);
|
|
10284
|
+
const raw = await Promise.race([
|
|
10285
|
+
withTimeout(
|
|
10286
|
+
channelInfo2.connection.extMethod(
|
|
10287
|
+
SERVE_CONTROL_EXT_METHODS.workspaceGenerationStart,
|
|
10288
|
+
{
|
|
10289
|
+
requestId,
|
|
10290
|
+
prompt,
|
|
10291
|
+
purpose: "text"
|
|
10292
|
+
}
|
|
10293
|
+
),
|
|
10294
|
+
SESSION_GENERATION_TIMEOUT_MS,
|
|
10295
|
+
SERVE_CONTROL_EXT_METHODS.workspaceGenerationStart
|
|
10296
|
+
),
|
|
10297
|
+
getChannelClosedReject(channelInfo2)
|
|
10298
|
+
]);
|
|
10299
|
+
if (request.settled) return;
|
|
10300
|
+
const response = raw;
|
|
10301
|
+
const model = response["model"];
|
|
10302
|
+
const modelSource = response["modelSource"];
|
|
10303
|
+
if (typeof model !== "string" || modelSource !== "fast" && modelSource !== "main") {
|
|
10304
|
+
throw new Error("Malformed workspace generation completion");
|
|
10305
|
+
}
|
|
10306
|
+
const accepted = queue.push({
|
|
10307
|
+
type: "done",
|
|
10308
|
+
requestId,
|
|
10309
|
+
model,
|
|
10310
|
+
modelSource,
|
|
10311
|
+
...typeof response["inputTokens"] === "number" ? { inputTokens: response["inputTokens"] } : {},
|
|
10312
|
+
...typeof response["outputTokens"] === "number" ? { outputTokens: response["outputTokens"] } : {}
|
|
10313
|
+
});
|
|
10314
|
+
if (accepted) queue.close();
|
|
10315
|
+
else queue.fail(new Error("Generation stream consumer too slow"));
|
|
10316
|
+
});
|
|
10317
|
+
} catch (error) {
|
|
10318
|
+
if (!request.settled) queue.fail(error);
|
|
10319
|
+
} finally {
|
|
10320
|
+
request.settled = true;
|
|
10321
|
+
signal.removeEventListener("abort", cancel);
|
|
10322
|
+
workspaceGenerationRequests.delete(requestId);
|
|
10323
|
+
if (info && hasNoChannelWork(info) && !info.isDying) {
|
|
10324
|
+
await startIdleTimer(info, "workspace generation");
|
|
10325
|
+
}
|
|
10326
|
+
}
|
|
10327
|
+
})().catch(() => void 0);
|
|
10328
|
+
return queue;
|
|
10329
|
+
},
|
|
9793
10330
|
async addRuntimeMcpServer(name, config, originatorClientId) {
|
|
9794
10331
|
const info = liveChannelInfo();
|
|
9795
10332
|
if (!info) {
|