@qwen-code/qwen-code 0.21.10 → 0.21.11-nightly.20260814.45c2e73080
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/coordinate/SKILL.md +52 -0
- package/bundled/qc-helper/docs/configuration/model-providers.md +10 -8
- package/bundled/qc-helper/docs/configuration/settings.md +10 -0
- package/bundled/qc-helper/docs/extension/_meta.ts +1 -0
- package/bundled/qc-helper/docs/extension/agent-plugins.md +50 -0
- package/bundled/qc-helper/docs/extension/extension-releasing.md +3 -3
- package/bundled/qc-helper/docs/extension/introduction.md +17 -3
- package/bundled/qc-helper/docs/features/_meta.ts +1 -0
- package/bundled/qc-helper/docs/features/arena.md +4 -3
- package/bundled/qc-helper/docs/features/code-review.md +1 -1
- package/bundled/qc-helper/docs/features/commands.md +7 -6
- package/bundled/qc-helper/docs/features/dual-output.md +5 -0
- package/bundled/qc-helper/docs/features/headless.md +8 -0
- package/bundled/qc-helper/docs/features/multi-agent-coordination.md +30 -0
- package/bundled/qc-helper/docs/qwen-serve.md +40 -40
- package/bundled/review/SKILL.md +45 -23
- package/chunks/{MaxSizedBox-FKXYULMW.js → MaxSizedBox-P4Z76535.js} +45 -44
- package/chunks/{StandaloneSessionPicker-OQS3M7AY.js → StandaloneSessionPicker-TRWDBCJG.js} +65 -64
- package/chunks/{acp-startup-profiler-VNTFWYAC.js → acp-startup-profiler-TVI2OVUN.js} +2 -2
- package/chunks/{acpAgent-AGS6HLQQ.js → acpAgent-MSZHQSZ7.js} +1645 -579
- package/chunks/{agent-4NCVO27U.js → agent-TMTEYQGK.js} +42 -41
- package/chunks/agent-headless-54WWND2M.js +87 -0
- package/chunks/{anthropicContentGenerator-D3Y4RFT4.js → anthropicContentGenerator-7ZK7U65G.js} +8 -8
- package/chunks/{artifact-tool-N652YE4L.js → artifact-tool-7HVSSXYZ.js} +2 -2
- package/chunks/{askUserQuestion-ONW74PKJ.js → askUserQuestion-IQCA2SOX.js} +2 -2
- package/chunks/{bridge-FHINXZMN.js → bridge-CI2NKV64.js} +49 -48
- package/chunks/{ca-ZLKAB4K3.js → ca-4CQ6MYNQ.js} +2 -1
- package/chunks/{channel-management-service-PHELKOW2.js → channel-management-service-LNEYNMDX.js} +6 -6
- package/chunks/channel-settings-store-QU4WFXHO.js +102 -0
- package/chunks/{channel-worker-group-WQP4RCDO.js → channel-worker-group-Q5WQVOMZ.js} +8 -7
- package/chunks/{channel-worker-manager-MRDFAKIM.js → channel-worker-manager-Z3JLH72P.js} +8 -7
- package/chunks/{channel-worker-supervisor-IVSDIMI4.js → channel-worker-supervisor-CG5HHT7K.js} +6 -5
- package/chunks/{chunk-A7XMDZRI.js → chunk-2AG524A4.js} +5 -5
- package/chunks/{chunk-GM463R2B.js → chunk-2ASWIM4A.js} +1 -1
- package/chunks/{chunk-DP3IHZGG.js → chunk-2AUM35J5.js} +59 -7
- package/chunks/{chunk-TZEZYNYD.js → chunk-2N6CV4PW.js} +1 -1
- package/chunks/{chunk-BSI645OU.js → chunk-3LHSUFPE.js} +3 -3
- package/chunks/{chunk-DCZEPFB4.js → chunk-3XLWKV4S.js} +3 -3
- package/chunks/{chunk-YWPSGJFI.js → chunk-4IBNVBGJ.js} +2 -2
- package/chunks/{chunk-ZRBMO3C7.js → chunk-4IWFPTAH.js} +1 -1
- package/chunks/{chunk-B2GJNDTV.js → chunk-4JS2QK7P.js} +1 -1
- package/chunks/{chunk-5MZCSWI4.js → chunk-4NV6L4GZ.js} +1184 -1450
- package/chunks/{chunk-Y3OVRWRY.js → chunk-4QC6SUVN.js} +1 -1
- package/chunks/{chunk-AOHJKPKL.js → chunk-5KZNWF2M.js} +1 -1
- package/chunks/{chunk-UMD7WQTR.js → chunk-5XNR53C7.js} +10 -8
- package/chunks/{chunk-IIJEYBNH.js → chunk-66PLFJQ7.js} +197 -60
- package/chunks/{chunk-SEZ556DZ.js → chunk-67F2BEYW.js} +1 -1
- package/chunks/{chunk-7GTMV7UE.js → chunk-6KXHEN6M.js} +8700 -2449
- package/chunks/{chunk-FVKHVJZQ.js → chunk-6OJDN5ZT.js} +1 -1
- package/chunks/{chunk-CKASRHZI.js → chunk-6SU6OW5Z.js} +1 -1
- package/chunks/{chunk-NEOXOWYH.js → chunk-6YUEAYJ5.js} +7 -7
- package/chunks/{chunk-QGNOFE5E.js → chunk-766PXUQ3.js} +1 -1
- package/chunks/{chunk-UVX4Y6IN.js → chunk-7JL5YBSA.js} +1 -1
- package/chunks/{chunk-2PLNY5TN.js → chunk-7MAHENBD.js} +4 -4
- package/chunks/{chunk-L2AFWWJE.js → chunk-7UNST76G.js} +105 -24
- package/chunks/{chunk-HUWENAHO.js → chunk-7WUMS2UA.js} +1 -1
- package/chunks/{chunk-MVUQRLOH.js → chunk-A4BAHMJF.js} +3 -3
- package/chunks/{chunk-7MH4J33A.js → chunk-A6GQUQ7I.js} +2 -2
- package/chunks/{chunk-GNPNYXJB.js → chunk-AAZWJAPQ.js} +2 -2
- package/chunks/{chunk-DX3RGJMS.js → chunk-ADJDLEVO.js} +72 -13
- package/chunks/{chunk-IWTMYQ32.js → chunk-AN3LCBS7.js} +9 -8
- package/chunks/{chunk-LHEC5V6G.js → chunk-AXEL55JW.js} +2 -2
- package/chunks/{chunk-QUI267ZP.js → chunk-B66LYK4B.js} +492 -63
- package/chunks/{chunk-VNNWAZSI.js → chunk-BCGJZGFI.js} +3 -3
- package/chunks/{chunk-F6WDTQ3M.js → chunk-BRYHERQ6.js} +5 -5
- package/chunks/{chunk-6ZRFAKXK.js → chunk-C2DR57L6.js} +1 -1
- package/chunks/{chunk-26CXSA6V.js → chunk-CAOT4DYN.js} +2 -2
- package/chunks/{chunk-H6XPXXMH.js → chunk-CQ35AJ4Z.js} +252 -254
- package/chunks/{chunk-F24A2JBM.js → chunk-CUXI3S6E.js} +914 -175
- package/chunks/{chunk-AEL7KN2O.js → chunk-DANYMI4U.js} +2 -2
- package/chunks/{chunk-AAE6SR4Q.js → chunk-DX7V233D.js} +1 -1
- package/chunks/{chunk-PJRW65JO.js → chunk-E74YSVIN.js} +1 -1
- package/chunks/{chunk-OWMAZHIX.js → chunk-EGB2PIYM.js} +1 -1
- package/chunks/{chunk-TRRF5BSP.js → chunk-F4BUGC4Y.js} +1 -1
- package/chunks/{chunk-4MKXUHXY.js → chunk-FGQY4VOZ.js} +5 -5
- package/chunks/{chunk-ZBVS26BY.js → chunk-FPGTNKCP.js} +7 -5
- package/chunks/{chunk-SR7RZ4MS.js → chunk-FTGU6G45.js} +2 -2
- package/chunks/{chunk-IBUGFUXC.js → chunk-G2ZEKO4T.js} +12 -12
- package/chunks/{chunk-NDU63YLI.js → chunk-GN2SCYBA.js} +4 -4
- package/chunks/{chunk-NV3F44FL.js → chunk-GNRFC5UM.js} +2 -2
- package/chunks/{chunk-KKBPOU75.js → chunk-H6BFLALJ.js} +1 -1
- package/chunks/chunk-HHJLM3WQ.js +41 -0
- package/chunks/{chunk-LLCWZQCU.js → chunk-HM7TLULV.js} +3 -3
- package/chunks/{chunk-ECWR5LQR.js → chunk-I76FLAP7.js} +3 -3
- package/chunks/{chunk-Q3AL4JQ3.js → chunk-IAE7LYSB.js} +2 -2
- package/chunks/{chunk-DREZZAZM.js → chunk-IDNVCWXZ.js} +13 -5
- package/chunks/{chunk-YF5MALI4.js → chunk-IPMHLZPY.js} +20 -16
- package/chunks/{chunk-UDXSXLER.js → chunk-IW6RQPQB.js} +14 -4
- package/chunks/{chunk-UBX6NL47.js → chunk-JLT5HCGQ.js} +47 -3
- package/chunks/{chunk-COBO5EBO.js → chunk-JRTJEGSP.js} +1 -1
- package/chunks/{chunk-PBRVUF5B.js → chunk-JW5UEE3V.js} +1 -1
- package/chunks/{chunk-W4RQUHY3.js → chunk-K5IDV3PC.js} +184 -22
- package/chunks/{chunk-O3EU6GMH.js → chunk-KACBT7N7.js} +27 -4
- package/chunks/{chunk-MFDYOYZZ.js → chunk-KCGEAL2C.js} +25 -2
- package/chunks/{chunk-EI3HZX6C.js → chunk-KK3FEHPJ.js} +1 -1
- package/chunks/{chunk-OJUQF2PL.js → chunk-KRRRRU3X.js} +5 -5
- package/chunks/{chunk-J6SZID63.js → chunk-KTWUFHS4.js} +2 -2
- package/chunks/{chunk-E2FPSSKP.js → chunk-KZKEVWJW.js} +57 -13
- package/chunks/{chunk-ZJ4W6SUY.js → chunk-L6PE52MF.js} +3 -3
- package/chunks/{chunk-YGT2AUJ7.js → chunk-LAKFZU36.js} +39 -19
- package/chunks/{chunk-47PEPJO7.js → chunk-LKN5SEHD.js} +3 -3
- package/chunks/{chunk-OQTXYMKW.js → chunk-LSMCI42W.js} +3 -3
- package/chunks/{chunk-ABVRJU3D.js → chunk-LY2SB7GC.js} +7 -7
- package/chunks/{chunk-D27I6YJT.js → chunk-M53FFYQJ.js} +27 -18
- package/chunks/{chunk-YTFDX4PR.js → chunk-M6NDLY2T.js} +1 -1
- package/chunks/{chunk-3P2LV43B.js → chunk-MMEDZKWK.js} +3 -3
- package/chunks/{chunk-VFMASYQA.js → chunk-MS7GNABG.js} +3 -0
- package/chunks/{chunk-6LP743KE.js → chunk-MUTFMB5B.js} +78 -112
- package/chunks/{chunk-URK542T4.js → chunk-NF5J2WFA.js} +15 -2
- package/chunks/{chunk-VSFKIRRW.js → chunk-NH6U7L42.js} +4 -4
- package/chunks/{chunk-DA4HRSBW.js → chunk-NHZF4VCD.js} +1 -1
- package/chunks/{chunk-QG3FFJYU.js → chunk-NJE5NH5B.js} +1 -1
- package/chunks/{chunk-2UUMVNYT.js → chunk-NM33GGOM.js} +3 -3
- package/chunks/{chunk-FOGU3LJX.js → chunk-NW7SPXVG.js} +1 -1
- package/chunks/{chunk-EUNWC2VS.js → chunk-O6SLWH4X.js} +2 -2
- package/chunks/{chunk-EBZ6BJTF.js → chunk-OEVVUUYW.js} +1 -1
- package/chunks/chunk-OMVHZ7E6.js +1280 -0
- package/chunks/{chunk-KZ22NXBY.js → chunk-OT72MGHE.js} +4 -4
- package/chunks/{chunk-DZUO626D.js → chunk-OUCCIS3E.js} +3 -3
- package/chunks/{chunk-OONWZLFK.js → chunk-OYLYERMH.js} +4 -4
- package/chunks/{chunk-P3BJLFSZ.js → chunk-OYQM5XZ4.js} +3 -3
- package/chunks/{chunk-NRLFZWCT.js → chunk-PNU3TILU.js} +3 -3
- package/chunks/{chunk-M6HMMKVG.js → chunk-PSTHNTHF.js} +1 -1
- package/chunks/{chunk-4PYCZH2V.js → chunk-QEWAHAW2.js} +3 -3
- package/chunks/{chunk-QJMOAMXT.js → chunk-RG2S3GYC.js} +8 -8
- package/chunks/{chunk-CTJLZLB5.js → chunk-RQS2BGPI.js} +1 -1
- package/chunks/{chunk-Y4R47ZUH.js → chunk-RTBUTKAX.js} +7 -7
- package/chunks/{chunk-NV65ZUVM.js → chunk-RZZV6GQN.js} +1 -1
- package/chunks/{chunk-UEOKWYGY.js → chunk-SESSAEWC.js} +11 -11
- package/chunks/{chunk-CPG6P4GG.js → chunk-SKRHR6N2.js} +1 -1
- package/chunks/{chunk-WAUGQKUU.js → chunk-SNHBRO4C.js} +9 -5
- package/chunks/{chunk-KID7K6H2.js → chunk-SNPOURNX.js} +6 -6
- package/chunks/{chunk-VWKER4ZH.js → chunk-SQCTJ435.js} +3 -3
- package/chunks/{chunk-Z4JX4NSH.js → chunk-SXJ7JYQA.js} +23 -23
- package/chunks/{chunk-XVHYA33G.js → chunk-TD7JVTIA.js} +4 -4
- package/chunks/{chunk-IRZ2ZH72.js → chunk-TEFHXP7C.js} +4 -4
- package/chunks/{chunk-2FRY5CRX.js → chunk-TNETSI2A.js} +3 -3
- package/chunks/{chunk-IA7TGCN2.js → chunk-TROB4PZY.js} +4 -4
- package/chunks/{chunk-4TRQPFDP.js → chunk-U3O2EO5Y.js} +26 -20
- package/chunks/{chunk-VKJ4KTPJ.js → chunk-U7ROFHSH.js} +1 -1
- package/chunks/{chunk-Q3JQ7OSU.js → chunk-UBC6PMV7.js} +1 -1
- package/chunks/{chunk-W5UC37EE.js → chunk-UFHPAMAV.js} +6 -0
- package/chunks/{chunk-EQL65XGA.js → chunk-UHF5VBKO.js} +47 -21
- package/chunks/{chunk-S6HYI3MF.js → chunk-UQPLUR4A.js} +2 -2
- package/chunks/{chunk-HGCQ5SE7.js → chunk-UXEO7E3V.js} +21 -0
- package/chunks/{chunk-WCG5O7IP.js → chunk-V3NMFQD2.js} +2 -2
- package/chunks/{chunk-EKPKKXY2.js → chunk-V4SJMQVJ.js} +1 -1
- package/chunks/{chunk-ONSZH6VM.js → chunk-VFJVRSRK.js} +2 -2
- package/chunks/{chunk-MZSJ43WV.js → chunk-W5ZFJYUG.js} +13 -0
- package/chunks/{chunk-XCGIMOLN.js → chunk-WCCLLK7X.js} +14 -1
- package/chunks/{chunk-4WL6SY4F.js → chunk-WDSTNDEW.js} +1 -1
- package/chunks/{chunk-KONVMRK7.js → chunk-WFTBYUOR.js} +1 -1
- package/chunks/{chunk-EI3NWELG.js → chunk-WH32GXQS.js} +6233 -4342
- package/chunks/{chunk-MIKXJYZB.js → chunk-WS5TWVT6.js} +305 -291
- package/chunks/{chunk-VJNBRRZG.js → chunk-WZMH7II3.js} +1 -1
- package/chunks/{chunk-67EWJE77.js → chunk-XY7DGTIC.js} +1 -1
- package/chunks/{chunk-HV76SFIA.js → chunk-YI5G32RU.js} +3 -3
- package/chunks/{chunk-OIVKILPI.js → chunk-YMB77M76.js} +18 -0
- package/chunks/{chunk-AQAJJMRR.js → chunk-YPITLFHS.js} +1 -1
- package/chunks/{chunk-WOJZWRAZ.js → chunk-YRLW2MSX.js} +1 -1
- package/chunks/{chunk-ZZCWJWTF.js → chunk-YY23TR4M.js} +31 -11
- package/chunks/{chunk-URKIBIFC.js → chunk-YYI3Z3AO.js} +3 -3
- package/chunks/chunk-Z7B6SRPM.js +32 -0
- package/chunks/{chunk-6Q5ABMTU.js → chunk-ZGONVQ3D.js} +23 -19
- package/chunks/{chunk-GWVUR3QZ.js → chunk-ZM6LZON7.js} +3 -3
- package/chunks/{chunk-XCWO3SMQ.js → chunk-ZPZANKVP.js} +3 -3
- package/chunks/{chunk-OCSFNUU4.js → chunk-ZRD3BUEX.js} +8 -8
- package/chunks/{chunk-PYQADEFD.js → chunk-ZRT36RSF.js} +1 -1
- package/chunks/{chunk-JT7XS4YW.js → chunk-ZZ7RUTJ4.js} +1 -1
- package/chunks/{computer-use-WQFK33Z3.js → computer-use-7BMFU557.js} +42 -41
- package/chunks/{config-utils-ULCSRMWD.js → config-utils-I732W437.js} +6 -6
- package/chunks/{contextCommand-7EOZND7C.js → contextCommand-VJ6UOMM4.js} +44 -43
- package/chunks/{core-runtime-FGMQRM6E.js → core-runtime-PMRKP77C.js} +42 -41
- package/chunks/{create-sub-session-QIDZUOPU.js → create-sub-session-23ULO5PO.js} +2 -2
- package/chunks/{create-sub-session-QM2K5HLZ.js → create-sub-session-5A3MSW22.js} +42 -41
- package/chunks/{cron-create-VONA5JYY.js → cron-create-5WUTNKNF.js} +4 -4
- package/chunks/{cron-delete-5JXSP2MI.js → cron-delete-JEQ27YPS.js} +4 -4
- package/chunks/{cron-list-KE4F2CIR.js → cron-list-IXGCA7UR.js} +4 -4
- package/chunks/{daemon-GWD7BT6E.js → daemon-PXIC4ZDK.js} +186 -7
- package/chunks/daemon-status-provider-33BLPRUA.js +103 -0
- package/chunks/daemon-trust-policy-ZUV26YGP.js +99 -0
- package/chunks/{daemon-trust-policy-monitor-6UKEABN5.js → daemon-trust-policy-monitor-35WRTIMA.js} +49 -48
- package/chunks/{de-LIW4XVLN.js → de-UBEBKG6V.js} +2 -1
- package/chunks/{deferred-core-runtime-67GJXHXS.js → deferred-core-runtime-ZSLQKM7J.js} +42 -41
- package/chunks/{display-image-NQRSIBXM.js → display-image-CAD7RAUM.js} +4 -4
- package/chunks/{dist-6BMOAE3Z.js → dist-362MN6CP.js} +4 -4
- package/chunks/{dist-3NTTUAHT.js → dist-5VDE7U3A.js} +3 -3
- package/chunks/{dist-Z3CS4OVP.js → dist-6RK4U6VU.js} +11 -5
- package/chunks/{dist-B2CGTW6T.js → dist-CCUH2Z4C.js} +3 -3
- package/chunks/{dist-J47AXBZC.js → dist-EZHCZSW6.js} +3 -3
- package/chunks/{dist-EZE3V3Q7.js → dist-JIORWIDV.js} +3 -3
- package/chunks/{dist-EWW3J4HQ.js → dist-M3XMEIP2.js} +3 -3
- package/chunks/{dist-OTUO3AS2.js → dist-NN5ARGTQ.js} +13 -5
- package/chunks/{earlyInputCapture-IWMYR6OB.js → earlyInputCapture-UNMCTGJR.js} +43 -42
- package/chunks/{edit-ZFGROCAF.js → edit-TXVTSXHY.js} +42 -41
- package/chunks/{en-SY5GTIGX.js → en-X6YV7GME.js} +2 -1
- package/chunks/{enter-worktree-TZZZCDM5.js → enter-worktree-7Q3X4PW7.js} +42 -41
- package/chunks/{enterPlanMode-U77BI3R6.js → enterPlanMode-AZBU3ZB6.js} +42 -41
- package/chunks/{environment-HC37DS2I.js → environment-TGFFQISF.js} +45 -44
- package/chunks/{errors-6AG54JPD.js → errors-GVPFT7BA.js} +44 -43
- package/chunks/{exit-worktree-UYYWFPNK.js → exit-worktree-7INKYMWE.js} +42 -41
- package/chunks/exitPlanMode-5CE7CLAE.js +85 -0
- package/chunks/{fast-path-F5FSZ3O7.js → fast-path-7B6F74IR.js} +5 -5
- package/chunks/{fast-path-settings-RPAVBD7P.js → fast-path-settings-LNOFM2YP.js} +2 -2
- package/chunks/{fr-RQFO7U4P.js → fr-VENTC2BS.js} +2 -1
- package/chunks/{gemini-NKQHYM36.js → gemini-4RUYPDKT.js} +92 -91
- package/chunks/{geminiContentGenerator-HCWZOUX3.js → geminiContentGenerator-NLL52POY.js} +6 -6
- package/chunks/{glob-3PDXKBAO.js → glob-DHU3INUK.js} +42 -41
- package/chunks/{goal-tools-SWNB6GP4.js → goal-tools-LQFO4BRY.js} +4 -4
- package/chunks/{grep-5HZKZYVD.js → grep-523W6G52.js} +42 -41
- package/chunks/handleAutoUpdate-PKUQ3OQQ.js +94 -0
- package/chunks/{i18n-Q27KKNDL.js → i18n-HYL2UBJW.js} +43 -42
- package/chunks/{image-gen-2Z2RJ6W7.js → image-gen-NLIDBAKE.js} +10 -10
- package/chunks/initializer-DGH7RAJ7.js +100 -0
- package/chunks/{installationInfo-XXB75T7O.js → installationInfo-FZ4XWV7O.js} +43 -42
- package/chunks/{ja-KOZKHJHZ.js → ja-QHT4EQTO.js} +2 -1
- package/chunks/{keychain-token-storage-TVAMTNP7.js → keychain-token-storage-GU75J2T2.js} +2 -2
- package/chunks/list-RH5HGWRJ.js +103 -0
- package/chunks/{list-agents-Z4WABFDZ.js → list-agents-5PNMK2AM.js} +2 -2
- package/chunks/loadedSettingsAdapter-XMX2JDOU.js +97 -0
- package/chunks/{loggingContentGenerator-6NTFBM7Q.js → loggingContentGenerator-T3J4HZ7U.js} +139 -98
- package/chunks/{loop-wakeup-UZ5RL5Y2.js → loop-wakeup-OV65FEGR.js} +5 -5
- package/chunks/{ls-TVHDGIES.js → ls-7CETV7WV.js} +4 -4
- package/chunks/{lsp-CVN6OQPI.js → lsp-IWTJWFLT.js} +2 -2
- package/chunks/{managed-npm-update-SPHYQUWZ.js → managed-npm-update-E5ZGIGWV.js} +45 -44
- package/chunks/mcp-6LC572CW.js +97 -0
- package/chunks/{monitor-ZBBPAA54.js → monitor-HQUS4RTV.js} +42 -41
- package/chunks/nonInteractiveCli-X7HKTS5Z.js +163 -0
- package/chunks/{notebook-edit-5W3FW7Z2.js → notebook-edit-QPI3LTFM.js} +42 -41
- package/chunks/{openaiContentGenerator-TQANPEVZ.js → openaiContentGenerator-GGS72DVB.js} +29 -29
- package/chunks/{pidfile-EQOBLH4E.js → pidfile-HD3EB6GL.js} +43 -42
- package/chunks/{processUtils-7XQG7EHS.js → processUtils-2WNEPSW4.js} +2 -2
- package/chunks/{pt-U6AOCTMF.js → pt-VL3I5RNY.js} +2 -1
- package/chunks/{qwenContentGenerator-BKCPHHXU.js → qwenContentGenerator-WJYPELF3.js} +48 -48
- package/chunks/{qwenOAuth2-BJ6PQKE6.js → qwenOAuth2-RSMEBZU4.js} +9 -9
- package/chunks/read-file-URU5ALY3.js +32 -0
- package/chunks/{read-mcp-resource-PZ4ZF6YL.js → read-mcp-resource-THCSZHXO.js} +2 -2
- package/chunks/{read-package-up-TCM6I7S2.js → read-package-up-K6RKTL5D.js} +1 -1
- package/chunks/{record-artifact-P4HFMS7X.js → record-artifact-76YYQA5F.js} +3 -3
- package/chunks/{resumeHistoryUtils-6N6XGJJW.js → resumeHistoryUtils-XMC3CR2U.js} +49 -48
- package/chunks/ripGrep-6NYCUBVW.js +85 -0
- package/chunks/{ru-CMX4UMYP.js → ru-4RCKL4PY.js} +2 -1
- package/chunks/{run-qwen-serve-BCKBCAMX.js → run-qwen-serve-H4IXCJDQ.js} +165 -65
- package/chunks/{runtime-E2437YKL.js → runtime-EJHNZR7H.js} +55 -54
- package/chunks/{scheduler-K3D5Z655.js → scheduler-VVORKEEZ.js} +44 -43
- package/chunks/{sdk-exporters-http-XVTZQRCE.js → sdk-exporters-http-JYKTSCMG.js} +11 -7
- package/chunks/{sdk-impl-7W7AKCS4.js → sdk-impl-ROR54N3H.js} +13 -10
- package/chunks/{send-message-CAMSLG2L.js → send-message-P5SLP57G.js} +6 -6
- package/chunks/serve-3ULKH2KQ.js +107 -0
- package/chunks/{server-UD6INW7J.js → server-J52IQLRJ.js} +949 -303
- package/chunks/{session-GR4ZEVW4.js → session-MNWSMCC2.js} +118 -98
- package/chunks/{settings-5O24D3OJ.js → settings-WFCKUQZO.js} +48 -47
- package/chunks/{shell-UTLWLG5G.js → shell-H5DZN76B.js} +42 -41
- package/chunks/{skill-QQAZL4VO.js → skill-STSDBOIL.js} +19 -19
- package/chunks/{skill-settings-P3YHJVBZ.js → skill-settings-LTJAR2LV.js} +48 -47
- package/chunks/spawnChannel-XL27KTLE.js +98 -0
- package/chunks/{standalone-update-QP742MGP.js → standalone-update-3FUDL2R6.js} +44 -43
- package/chunks/{startInteractiveUI-YCS6AEPN.js → startInteractiveUI-5BFJCCWU.js} +596 -335
- package/chunks/{syntheticOutput-PEBJQYJV.js → syntheticOutput-SEW4NA47.js} +3 -3
- package/chunks/{task-create-5NWCQSJF.js → task-create-247EAVF7.js} +10 -10
- package/chunks/{task-list-53265TRZ.js → task-list-ZJN4QHLK.js} +5 -5
- package/chunks/{task-stop-FPCOIRYX.js → task-stop-MAYQJ42I.js} +2 -2
- package/chunks/{task-update-5HN577LS.js → task-update-CG4FALQF.js} +10 -10
- package/chunks/{team-create-WFH7OCDQ.js → team-create-FC2EYGE7.js} +44 -43
- package/chunks/{team-delete-MMQB4OSC.js → team-delete-3XVRPQBP.js} +5 -5
- package/chunks/{team-plan-approval-EGTT53MV.js → team-plan-approval-X673CRIZ.js} +42 -41
- package/chunks/{terminal-image-renderer-BWRESAQ7.js → terminal-image-renderer-MRNJ77H7.js} +44 -43
- package/chunks/theme-manager-6UMSB7DJ.js +89 -0
- package/chunks/{todoWrite-JGV6VLOX.js → todoWrite-IE2YTCK7.js} +4 -4
- package/chunks/{tool-search-TI5PTIBF.js → tool-search-7Z3PPA5O.js} +19 -19
- package/chunks/total-session-admission-NU4KV76R.js +99 -0
- package/chunks/{trustedFolders-4KYHA4IG.js → trustedFolders-SCUSHKHS.js} +43 -42
- package/chunks/{update-relaunch-WB6LGIF2.js → update-relaunch-M6BNKY4W.js} +5 -5
- package/chunks/{updateCheck-LOS5GYFC.js → updateCheck-QMZZ53S6.js} +48 -47
- package/chunks/{useAutoAcceptIndicator-MHAPY52L.js → useAutoAcceptIndicator-GAFG5PFE.js} +52 -51
- package/chunks/{validateNonInterActiveAuth-QV22HNQU.js → validateNonInterActiveAuth-V44BOAD2.js} +87 -86
- package/chunks/{version-DALWZHKQ.js → version-A4J2RQXD.js} +2 -2
- package/chunks/{web-fetch-JMJVMYFE.js → web-fetch-43TWEBWB.js} +19 -19
- package/chunks/{web-search-DNDUIPU5.js → web-search-CS3Q6JBI.js} +11 -11
- package/chunks/{workflow-JGNN64PM.js → workflow-ETQXJUPR.js} +115 -49
- package/chunks/workspace-providers-status-Y4FPKLHN.js +100 -0
- package/chunks/{workspace-registration-store-LRJG7QA4.js → workspace-registration-store-JASCK5RS.js} +1 -1
- package/chunks/{workspace-registry-KVXIFM36.js → workspace-registry-MU3VIM2D.js} +49 -48
- package/chunks/{workspace-service-PO4AAKKT.js → workspace-service-MHVHRNDX.js} +54 -53
- package/chunks/workspace-skills-status-QVQMNHGO.js +100 -0
- package/chunks/{workspace-trust-reconciler-DOZPCVHG.js → workspace-trust-reconciler-ABXDCISO.js} +56 -55
- package/chunks/write-file-YL7EPQRJ.js +87 -0
- package/chunks/{zh-AGL2FVBI.js → zh-LMSTK4WD.js} +2 -1
- package/chunks/{zh-TW-KI66MHQY.js → zh-TW-SQ4HTSCW.js} +2 -1
- package/chunks/{zoom-image-CNC77ZMA.js → zoom-image-ZQV6O2KE.js} +15 -15
- package/cli.js +13 -13
- package/locales/ca.js +1 -0
- package/locales/de.js +1 -0
- package/locales/en.js +1 -0
- package/locales/fr.js +1 -0
- package/locales/ja.js +1 -0
- package/locales/pt.js +1 -0
- package/locales/ru.js +1 -0
- package/locales/zh-TW.js +1 -0
- package/locales/zh.js +1 -0
- package/package.json +4 -4
- package/web-shell/assets/{arc-CDk0d60K.js → arc-BDKBUdHd.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-h-W3I2lP.js → architectureDiagram-3BPJPVTR-DgMi5iOf.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-D1pvSmZg.js → blockDiagram-GPEHLZMM-DOyxD2BK.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-ByAm5ZNf.js → c4Diagram-AAUBKEIU-CmXzCE_n.js} +1 -1
- package/web-shell/assets/channel-BCff03Ag.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-VrGPPOGV.js → chunk-2J33WTMH-Dr13N7PT.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-B7hTowgG.js → chunk-4BX2VUAB-CIFcKNCP.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-j1Fq8DpE.js → chunk-55IACEB6-B8jmrVPK.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-UjABYpF2.js → chunk-727SXJPM-CQc0wjze.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-D4uBItrs.js → chunk-AQP2D5EJ-CGdZxT9s.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-DeFbKlb8.js → chunk-FMBD7UC4-4iCBhCLJ.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-rQJ8TIgT.js → chunk-ND2GUHAM-B0mMzZcM.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-DAGcRxvq.js → chunk-QZHKN3VN-6CURQrGl.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-DnwxH0ri.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-DnwxH0ri.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-MaE7MJSt.js → cose-bilkent-S5V4N54A-L6Fo1GN1.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-DzijYGSb.js → dagre-BM42HDAG-BTsGDeLA.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-WdbG7WnX.js → diagram-2AECGRRQ-B4AXYZGR.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-NYutsBnw.js → diagram-5GNKFQAL-C2yM5aNc.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-Dqg0eBY0.js → diagram-KO2AKTUF-CrGLZmRK.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-C7vRP2Lb.js → diagram-LMA3HP47-rycHl4fv.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-B2sEPpPt.js → diagram-OG6HWLK6-MQj80AQu.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-a4zIbzm8.js → erDiagram-TEJ5UH35-DCgH-D0D.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-BK9y89ya.js → flowDiagram-I6XJVG4X-B0gnwCnt.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-wUQTSNvV.js → ganttDiagram-6RSMTGT7-CB0OxXVE.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-Dnzt4SAi.js → gitGraphDiagram-PVQCEYII-xLxucse9.js} +1 -1
- package/web-shell/assets/{index-BA3wUcKL.js → index-BFFbq0E-.js} +1 -1
- package/web-shell/assets/index-D7XXR9S-.js +1789 -0
- package/web-shell/assets/index-Dk5RwPL9.css +5 -0
- package/web-shell/assets/{infoDiagram-5YYISTIA-DcaoToij.js → infoDiagram-5YYISTIA-7FCqN4qa.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-DzduqhP2.js → ishikawaDiagram-YF4QCWOH-BGyKlnik.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-BvviZR_O.js → journeyDiagram-JHISSGLW-CmgSXMLF.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-Efm2JxY3.js → kanban-definition-UN3LZRKU-CjT2mF6A.js} +1 -1
- package/web-shell/assets/{linear-DtY3IbOs.js → linear-CiTDGfCW.js} +1 -1
- package/web-shell/assets/{mermaid.core-PzpFqoMe.js → mermaid.core-_QnqxPRF.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-BLlTkHS0.js → mindmap-definition-RKZ34NQL-B1On14ZB.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-D-mKF-jE.js → pieDiagram-4H26LBE5-x1Pf1OG2.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-DYCzslGm.js → quadrantDiagram-W4KKPZXB-ZawmK1Q9.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-Dfpxlk7R.js → requirementDiagram-4Y6WPE33-krIMX0c8.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-D5cRaaxh.js → sankeyDiagram-5OEKKPKP-aMJyxtx_.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-s04DReiS.js → sequenceDiagram-3UESZ5HK-C530-Kqz.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-01UNFgnb.js → stateDiagram-AJRCARHV-DObd9dT_.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-Bttf9Ae9.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-DX8_wZBC.js → timeline-definition-PNZ67QCA-D9LnwQ1O.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-BK0FlBme.js → vennDiagram-CIIHVFJN-B_MT_v6Y.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-DkPc9UlD.js → wardley-L42UT6IY-DHKPz5Hu.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-DNKkpDAo.js → wardleyDiagram-YWT4CUSO-BoyKaItA.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-CiPwg8QG.js → xychartDiagram-2RQKCTM6--xBJT7Kg.js} +1 -1
- package/web-shell/index.html +2 -2
- package/chunks/agent-headless-HYEHZFH6.js +0 -86
- package/chunks/channel-settings-store-OXYG5S5X.js +0 -101
- package/chunks/chunk-I5VM3SKY.js +0 -451
- package/chunks/chunk-PDPFQ2FO.js +0 -156
- package/chunks/daemon-status-provider-L3J6GKCT.js +0 -102
- package/chunks/daemon-trust-policy-4PHPY23S.js +0 -98
- package/chunks/exitPlanMode-RWJR2KGB.js +0 -84
- package/chunks/handleAutoUpdate-NHFSGYTF.js +0 -93
- package/chunks/initializer-Y5DJLT43.js +0 -99
- package/chunks/list-YHNQ32CS.js +0 -102
- package/chunks/loadedSettingsAdapter-GHUQK7H4.js +0 -96
- package/chunks/mcp-EA3KO6FS.js +0 -96
- package/chunks/nonInteractiveCli-NNOR56HU.js +0 -162
- package/chunks/read-file-KKTXGIZD.js +0 -32
- package/chunks/ripGrep-SJVAAYDV.js +0 -84
- package/chunks/serve-IH4XR5IL.js +0 -106
- package/chunks/spawnChannel-UAQMH6Y6.js +0 -94
- package/chunks/theme-manager-ZNDGAHJN.js +0 -88
- package/chunks/total-session-admission-66UDSOHO.js +0 -98
- package/chunks/workspace-providers-status-K22B3Z6B.js +0 -99
- package/chunks/workspace-skills-status-DDYCBVSH.js +0 -99
- package/chunks/write-file-TT6MWIKC.js +0 -86
- package/web-shell/assets/channel-DPFUV4oi.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-CLm0hVvw.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CLm0hVvw.js +0 -1
- package/web-shell/assets/index-BjC3yjjL.css +0 -5
- package/web-shell/assets/index-QzFq6w7o.js +0 -1775
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DXb5olqv.js +0 -1
|
@@ -6,18 +6,20 @@ import {
|
|
|
6
6
|
EventBus,
|
|
7
7
|
logEventSizingFailed,
|
|
8
8
|
serializedBridgeEventByteLength
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-W5ZFJYUG.js";
|
|
10
10
|
import {
|
|
11
|
+
JOURNAL_GROWTH_HARD_CAP_BYTES,
|
|
11
12
|
normalizeCompactedReplayMaxBytes,
|
|
13
|
+
normalizeJournalGrowthPoolBytes,
|
|
12
14
|
normalizeMaxJournalBytes,
|
|
13
15
|
normalizeMaxJournalEvents
|
|
14
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-WCCLLK7X.js";
|
|
15
17
|
import {
|
|
16
18
|
MCP_RESTART_SERVER_DEADLINE_MS
|
|
17
19
|
} from "./chunk-OCPBI7J5.js";
|
|
18
20
|
import {
|
|
19
21
|
defaultSpawnChannelFactory
|
|
20
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-OMVHZ7E6.js";
|
|
21
23
|
import {
|
|
22
24
|
BridgeChannelClosedError,
|
|
23
25
|
BridgeTimeoutError,
|
|
@@ -27,7 +29,7 @@ import {
|
|
|
27
29
|
SessionRestoreTimeoutError,
|
|
28
30
|
createIdleWorkspaceExtensionsStatus,
|
|
29
31
|
createIdleWorkspaceHooksStatus
|
|
30
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-NHZF4VCD.js";
|
|
31
33
|
import {
|
|
32
34
|
ACTIVE_WORK_CLOSE_IF_UNHELD_PARAM,
|
|
33
35
|
ACTIVE_WORK_CLOSE_TIMEOUT_MS,
|
|
@@ -43,8 +45,10 @@ import {
|
|
|
43
45
|
CHANNEL_STARTUP_PROFILE_VERSION,
|
|
44
46
|
DAEMON_CHANNEL_DELIVERY_META_KEY,
|
|
45
47
|
DAEMON_MODEL_PROMPT_META_KEY,
|
|
48
|
+
DAEMON_PROMPT_DISPLAY_TEXT_META_KEY,
|
|
46
49
|
LOAD_REPLAY_BULK_MODE,
|
|
47
50
|
LOAD_REPLAY_HIDE_INHERITED_META_KEY,
|
|
51
|
+
LOAD_REPLAY_MAX_UPDATES,
|
|
48
52
|
LOAD_REPLAY_META_KEY,
|
|
49
53
|
LOAD_REPLAY_MODE_META_KEY,
|
|
50
54
|
LOAD_REPLAY_PAGE_SIZE_META_KEY,
|
|
@@ -58,7 +62,7 @@ import {
|
|
|
58
62
|
WORKTREE_MCP_DEFER_META_KEY,
|
|
59
63
|
clampActiveWorkIntervalMs,
|
|
60
64
|
isValidTrustedModelPrompt
|
|
61
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-UFHPAMAV.js";
|
|
62
66
|
import {
|
|
63
67
|
BranchWhilePromptActiveError,
|
|
64
68
|
BridgeChannelQuarantinedError,
|
|
@@ -102,9 +106,10 @@ import {
|
|
|
102
106
|
ClientSideConnection,
|
|
103
107
|
PROTOCOL_VERSION,
|
|
104
108
|
RequestError
|
|
105
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-IW6RQPQB.js";
|
|
106
110
|
import {
|
|
107
111
|
SESSION_ARTIFACT_PERSISTENCE_VERSION,
|
|
112
|
+
SESSION_TRANSCRIPT_MAX_LIMIT,
|
|
108
113
|
ShellExecutionService,
|
|
109
114
|
TrustGateError,
|
|
110
115
|
WORKSPACE_CONTENT_MTIME_MS_METADATA_KEY,
|
|
@@ -114,16 +119,16 @@ import {
|
|
|
114
119
|
metadataBudgetBytes,
|
|
115
120
|
normalizeSnapshotPayload,
|
|
116
121
|
stableSessionArtifactId
|
|
117
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-WH32GXQS.js";
|
|
118
123
|
import {
|
|
119
124
|
DAEMON_TRACEPARENT_META_KEY,
|
|
120
125
|
DAEMON_TRACESTATE_META_KEY
|
|
121
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-U3O2EO5Y.js";
|
|
122
127
|
import {
|
|
123
128
|
INVOCATION_CONTEXT_META_KEY,
|
|
124
129
|
PRIVATE_ACP_CAPABILITY_ENV,
|
|
125
130
|
PRIVATE_PARENT_CAPABILITY_META_KEY
|
|
126
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-LAKFZU36.js";
|
|
127
132
|
import {
|
|
128
133
|
init_esbuild_shims
|
|
129
134
|
} from "./chunk-5O2XNYP6.js";
|
|
@@ -135,6 +140,7 @@ import {
|
|
|
135
140
|
init_esbuild_shims();
|
|
136
141
|
import { randomBytes, randomUUID as randomUUID2 } from "node:crypto";
|
|
137
142
|
import * as path3 from "node:path";
|
|
143
|
+
import { inspect } from "node:util";
|
|
138
144
|
|
|
139
145
|
// packages/acp-bridge/src/compactionEngine.ts
|
|
140
146
|
init_esbuild_shims();
|
|
@@ -177,13 +183,20 @@ function lastRecordIdIn(events) {
|
|
|
177
183
|
return void 0;
|
|
178
184
|
}
|
|
179
185
|
__name(lastRecordIdIn, "lastRecordIdIn");
|
|
186
|
+
var JOURNAL_GROWTH_REASK_INTERVAL_MS = 1e4;
|
|
187
|
+
var JOURNAL_GROWTH_MAX_GRANTS_PER_BREACH = 64;
|
|
180
188
|
var TurnBoundaryCompactionEngine = class {
|
|
181
189
|
static {
|
|
182
190
|
__name(this, "TurnBoundaryCompactionEngine");
|
|
183
191
|
}
|
|
184
192
|
maxReplayBytes;
|
|
193
|
+
// Mutable: adaptive growth (see `maybeGrowJournalLimits`) raises these
|
|
194
|
+
// in place when the advisor grants headroom.
|
|
185
195
|
maxJournalEvents;
|
|
186
196
|
maxJournalBytes;
|
|
197
|
+
onJournalGrowth;
|
|
198
|
+
now;
|
|
199
|
+
journalGrowthDeniedAt;
|
|
187
200
|
onReplayWindowEviction;
|
|
188
201
|
replaySegments = [];
|
|
189
202
|
replaySegmentStart = 0;
|
|
@@ -229,8 +242,14 @@ var TurnBoundaryCompactionEngine = class {
|
|
|
229
242
|
this.maxReplayBytes = normalizeCompactedReplayMaxBytes(opts.maxReplayBytes);
|
|
230
243
|
this.maxJournalEvents = normalizeMaxJournalEvents(opts.maxJournalEvents);
|
|
231
244
|
this.maxJournalBytes = normalizeMaxJournalBytes(opts.maxJournalBytes);
|
|
245
|
+
this.onJournalGrowth = opts.onJournalGrowth;
|
|
246
|
+
this.now = opts.now ?? (() => performance.now());
|
|
232
247
|
this.onReplayWindowEviction = opts.onReplayWindowEviction;
|
|
233
248
|
}
|
|
249
|
+
/** Current journal caps — may have grown past the configured baseline. */
|
|
250
|
+
journalLimits() {
|
|
251
|
+
return { maxEvents: this.maxJournalEvents, maxBytes: this.maxJournalBytes };
|
|
252
|
+
}
|
|
234
253
|
ingest(event, byteLength) {
|
|
235
254
|
if (this.closed) return;
|
|
236
255
|
if (event.id !== void 0) {
|
|
@@ -384,6 +403,9 @@ var TurnBoundaryCompactionEngine = class {
|
|
|
384
403
|
this.journalTotalBytes += bytes;
|
|
385
404
|
this.journalTotalEvents += 1;
|
|
386
405
|
}
|
|
406
|
+
if (!TURN_BOUNDARY_TYPES.has(event.type) && (this.liveJournal.length > this.maxJournalEvents || this.journalTotalBytes > this.maxJournalBytes && this.liveJournal.length > 1)) {
|
|
407
|
+
this.maybeGrowJournalLimits();
|
|
408
|
+
}
|
|
387
409
|
while (this.liveJournal.length > this.maxJournalEvents || this.journalTotalBytes > this.maxJournalBytes && this.liveJournal.length > 1) {
|
|
388
410
|
const dropped = this.liveJournal.shift();
|
|
389
411
|
this.journalTotalBytes -= this.journalEntryBytes.shift() ?? 0;
|
|
@@ -395,6 +417,72 @@ var TurnBoundaryCompactionEngine = class {
|
|
|
395
417
|
}
|
|
396
418
|
}
|
|
397
419
|
}
|
|
420
|
+
/**
|
|
421
|
+
* Consults the growth advisor once the journal breaches its caps and
|
|
422
|
+
* applies a grant in place, so the eviction loop below only drops what
|
|
423
|
+
* still exceeds the (possibly raised) caps. An intermediate grant that
|
|
424
|
+
* does not yet retain an extra entry is still applied tentatively —
|
|
425
|
+
* each applied cap is what the next ask reports and is charged for —
|
|
426
|
+
* and the walk continues until a grant retains strictly more than the
|
|
427
|
+
* pre-breach caps, the advisor refuses, or the step budget runs out. A
|
|
428
|
+
* walk that never improves retention rolls back to the original caps
|
|
429
|
+
* and counts as a refusal, so the pool is never charged for growth that
|
|
430
|
+
* preserves no replay. Never throws: a misbehaving advisor degrades to
|
|
431
|
+
* plain eviction, matching the engine's best-effort contract.
|
|
432
|
+
*/
|
|
433
|
+
maybeGrowJournalLimits() {
|
|
434
|
+
const advisor = this.onJournalGrowth;
|
|
435
|
+
if (!advisor || this.closed) return;
|
|
436
|
+
const now = this.now();
|
|
437
|
+
if (this.journalGrowthDeniedAt !== void 0) {
|
|
438
|
+
const sinceDenialMs = now - this.journalGrowthDeniedAt;
|
|
439
|
+
if (sinceDenialMs >= 0 && sinceDenialMs < JOURNAL_GROWTH_REASK_INTERVAL_MS) {
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
const originalEvents = this.maxJournalEvents;
|
|
444
|
+
const originalBytes = this.maxJournalBytes;
|
|
445
|
+
const originalRetained = this.retainedTailCount(
|
|
446
|
+
originalEvents,
|
|
447
|
+
originalBytes
|
|
448
|
+
);
|
|
449
|
+
for (let step = 0; step < JOURNAL_GROWTH_MAX_GRANTS_PER_BREACH; step++) {
|
|
450
|
+
let grant;
|
|
451
|
+
try {
|
|
452
|
+
grant = advisor({
|
|
453
|
+
maxEvents: this.maxJournalEvents,
|
|
454
|
+
maxBytes: this.maxJournalBytes
|
|
455
|
+
});
|
|
456
|
+
} catch {
|
|
457
|
+
grant = void 0;
|
|
458
|
+
}
|
|
459
|
+
if (!grant || !Number.isSafeInteger(grant.maxBytes) || !Number.isSafeInteger(grant.maxEvents) || grant.maxBytes <= this.maxJournalBytes || grant.maxEvents < this.maxJournalEvents) {
|
|
460
|
+
break;
|
|
461
|
+
}
|
|
462
|
+
this.maxJournalBytes = grant.maxBytes;
|
|
463
|
+
this.maxJournalEvents = grant.maxEvents;
|
|
464
|
+
if (this.retainedTailCount(grant.maxEvents, grant.maxBytes) > originalRetained) {
|
|
465
|
+
this.journalGrowthDeniedAt = void 0;
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
this.maxJournalEvents = originalEvents;
|
|
470
|
+
this.maxJournalBytes = originalBytes;
|
|
471
|
+
this.journalGrowthDeniedAt = now;
|
|
472
|
+
}
|
|
473
|
+
/** Entries of the newest-first tail the eviction loop would retain. */
|
|
474
|
+
retainedTailCount(maxEvents, maxBytes) {
|
|
475
|
+
let count = 0;
|
|
476
|
+
let bytes = 0;
|
|
477
|
+
for (let i = this.liveJournal.length - 1; i >= 0; i--) {
|
|
478
|
+
const entryBytes = this.journalEntryBytes[i] ?? 0;
|
|
479
|
+
if (count + 1 > maxEvents) break;
|
|
480
|
+
if (count >= 1 && bytes + entryBytes > maxBytes) break;
|
|
481
|
+
count += 1;
|
|
482
|
+
bytes += entryBytes;
|
|
483
|
+
}
|
|
484
|
+
return count;
|
|
485
|
+
}
|
|
398
486
|
classifySessionUpdate(event) {
|
|
399
487
|
const data = event.data;
|
|
400
488
|
const updateType = data?.update?.sessionUpdate;
|
|
@@ -569,6 +657,7 @@ var TurnBoundaryCompactionEngine = class {
|
|
|
569
657
|
this.journalTotalEvents = 0;
|
|
570
658
|
this.journalTruncatedEvents = 0;
|
|
571
659
|
this.liveJournalTextSegment = void 0;
|
|
660
|
+
this.journalGrowthDeniedAt = void 0;
|
|
572
661
|
}
|
|
573
662
|
addReplaySegment(events, turnCount) {
|
|
574
663
|
if (events.length === 0) return;
|
|
@@ -925,6 +1014,44 @@ function mergeTranscriptUpdateMeta(existing, incoming) {
|
|
|
925
1014
|
}
|
|
926
1015
|
__name(mergeTranscriptUpdateMeta, "mergeTranscriptUpdateMeta");
|
|
927
1016
|
|
|
1017
|
+
// packages/acp-bridge/src/journalGrowthPolicy.ts
|
|
1018
|
+
init_esbuild_shims();
|
|
1019
|
+
function createJournalGrowthPolicy(opts) {
|
|
1020
|
+
const hardCapEvents = Math.min(
|
|
1021
|
+
Number.MAX_SAFE_INTEGER,
|
|
1022
|
+
Math.max(
|
|
1023
|
+
opts.baselineEvents,
|
|
1024
|
+
Math.ceil(opts.hardCapBytes / opts.baselineBytes * opts.baselineEvents)
|
|
1025
|
+
)
|
|
1026
|
+
);
|
|
1027
|
+
return {
|
|
1028
|
+
grant(request) {
|
|
1029
|
+
if (request.currentMaxBytes >= opts.hardCapBytes) return void 0;
|
|
1030
|
+
const extraGranted = request.allSessionLimits.reduce(
|
|
1031
|
+
(sum, session) => sum + Math.max(0, session.limitBytes - session.baselineBytes),
|
|
1032
|
+
0
|
|
1033
|
+
);
|
|
1034
|
+
const available = opts.poolBytes - extraGranted;
|
|
1035
|
+
if (available <= 0) return void 0;
|
|
1036
|
+
const maxBytes = Math.min(
|
|
1037
|
+
request.currentMaxBytes * 2,
|
|
1038
|
+
request.currentMaxBytes + available,
|
|
1039
|
+
opts.hardCapBytes
|
|
1040
|
+
);
|
|
1041
|
+
if (maxBytes <= request.currentMaxBytes) return void 0;
|
|
1042
|
+
const maxEvents = Math.min(
|
|
1043
|
+
Math.max(
|
|
1044
|
+
request.currentMaxEvents,
|
|
1045
|
+
Math.ceil(maxBytes / opts.baselineBytes * opts.baselineEvents)
|
|
1046
|
+
),
|
|
1047
|
+
hardCapEvents
|
|
1048
|
+
);
|
|
1049
|
+
return { maxBytes, maxEvents };
|
|
1050
|
+
}
|
|
1051
|
+
};
|
|
1052
|
+
}
|
|
1053
|
+
__name(createJournalGrowthPolicy, "createJournalGrowthPolicy");
|
|
1054
|
+
|
|
928
1055
|
// packages/acp-bridge/src/session-restore-timeout.ts
|
|
929
1056
|
init_esbuild_shims();
|
|
930
1057
|
var DEFAULT_SESSION_RESTORE_TIMEOUT_MS = 6e4;
|
|
@@ -5908,11 +6035,16 @@ var KNOWN_SESSION_UPDATE_TYPES = /* @__PURE__ */ new Set([
|
|
|
5908
6035
|
"session_info_update",
|
|
5909
6036
|
"usage_update"
|
|
5910
6037
|
]);
|
|
5911
|
-
var MAX_BULK_REPLAY_UPDATES = 1e4;
|
|
5912
6038
|
function isRecord3(value) {
|
|
5913
6039
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5914
6040
|
}
|
|
5915
6041
|
__name(isRecord3, "isRecord");
|
|
6042
|
+
function safeTransportFailureCode(error) {
|
|
6043
|
+
if (!isRecord3(error)) return void 0;
|
|
6044
|
+
const code = error["code"];
|
|
6045
|
+
return typeof code === "string" && /^[a-z0-9_.-]{1,64}$/iu.test(code) ? code : void 0;
|
|
6046
|
+
}
|
|
6047
|
+
__name(safeTransportFailureCode, "safeTransportFailureCode");
|
|
5916
6048
|
function sessionSourceRequestMeta(sourceType, sourceId) {
|
|
5917
6049
|
return sourceType ? {
|
|
5918
6050
|
[SESSION_SOURCE_META_KEY]: {
|
|
@@ -5922,12 +6054,280 @@ function sessionSourceRequestMeta(sourceType, sourceId) {
|
|
|
5922
6054
|
} : {};
|
|
5923
6055
|
}
|
|
5924
6056
|
__name(sessionSourceRequestMeta, "sessionSourceRequestMeta");
|
|
6057
|
+
function getChannelPromptDisplayText(entry, displayText) {
|
|
6058
|
+
return entry.sourceType === "channel" && typeof displayText === "string" ? displayText : void 0;
|
|
6059
|
+
}
|
|
6060
|
+
__name(getChannelPromptDisplayText, "getChannelPromptDisplayText");
|
|
5925
6061
|
function isDefinitiveAcpRequestError(error) {
|
|
5926
6062
|
if (error instanceof RequestError) return true;
|
|
5927
6063
|
if (!isRecord3(error)) return false;
|
|
5928
6064
|
return typeof error["code"] === "number" && Number.isInteger(error["code"]) && typeof error["message"] === "string";
|
|
5929
6065
|
}
|
|
5930
6066
|
__name(isDefinitiveAcpRequestError, "isDefinitiveAcpRequestError");
|
|
6067
|
+
var LogSafeAcpRequestError = class extends RequestError {
|
|
6068
|
+
constructor(code, message, data, reservePreparedResponse) {
|
|
6069
|
+
super(code, message, data);
|
|
6070
|
+
this.reservePreparedResponse = reservePreparedResponse;
|
|
6071
|
+
}
|
|
6072
|
+
static {
|
|
6073
|
+
__name(this, "LogSafeAcpRequestError");
|
|
6074
|
+
}
|
|
6075
|
+
toResult() {
|
|
6076
|
+
const result = super.toResult();
|
|
6077
|
+
if ("error" in result) {
|
|
6078
|
+
Object.defineProperty(result.error, inspect.custom, {
|
|
6079
|
+
configurable: true,
|
|
6080
|
+
value: /* @__PURE__ */ __name(() => ({ code: result.error.code, payloadOmitted: true }), "value")
|
|
6081
|
+
});
|
|
6082
|
+
try {
|
|
6083
|
+
this.reservePreparedResponse?.(result.error);
|
|
6084
|
+
} catch {
|
|
6085
|
+
}
|
|
6086
|
+
}
|
|
6087
|
+
return result;
|
|
6088
|
+
}
|
|
6089
|
+
};
|
|
6090
|
+
var MAX_LOG_SAFE_ACP_ERROR_DETAILS_CHARS = 1024;
|
|
6091
|
+
var MAX_LOG_SAFE_ACP_ERROR_KIND_CHARS = 128;
|
|
6092
|
+
var MAX_LOG_SAFE_ACP_ERROR_HINT_CHARS = 512;
|
|
6093
|
+
function logSafeAcpErrorDetails(error) {
|
|
6094
|
+
const details = error instanceof Error ? error.message : isRecord3(error) && typeof error["message"] === "string" ? error["message"] : void 0;
|
|
6095
|
+
if (!details) return void 0;
|
|
6096
|
+
return {
|
|
6097
|
+
details: details.length <= MAX_LOG_SAFE_ACP_ERROR_DETAILS_CHARS ? details : `${details.slice(0, MAX_LOG_SAFE_ACP_ERROR_DETAILS_CHARS)}\u2026`
|
|
6098
|
+
};
|
|
6099
|
+
}
|
|
6100
|
+
__name(logSafeAcpErrorDetails, "logSafeAcpErrorDetails");
|
|
6101
|
+
function boundedAcpErrorString(value, maxChars) {
|
|
6102
|
+
return value.length <= maxChars ? value : `${value.slice(0, maxChars)}\u2026`;
|
|
6103
|
+
}
|
|
6104
|
+
__name(boundedAcpErrorString, "boundedAcpErrorString");
|
|
6105
|
+
function logSafeRequestErrorMessage(code) {
|
|
6106
|
+
switch (code) {
|
|
6107
|
+
case -32700:
|
|
6108
|
+
return "Parse error";
|
|
6109
|
+
case -32600:
|
|
6110
|
+
return "Invalid request";
|
|
6111
|
+
case -32601:
|
|
6112
|
+
return "Method not found";
|
|
6113
|
+
case -32602:
|
|
6114
|
+
return "Invalid params";
|
|
6115
|
+
case -32603:
|
|
6116
|
+
return "Internal error";
|
|
6117
|
+
case -32e3:
|
|
6118
|
+
return "Authentication required";
|
|
6119
|
+
case -32002:
|
|
6120
|
+
return "Resource not found";
|
|
6121
|
+
default:
|
|
6122
|
+
return "ACP client request failed";
|
|
6123
|
+
}
|
|
6124
|
+
}
|
|
6125
|
+
__name(logSafeRequestErrorMessage, "logSafeRequestErrorMessage");
|
|
6126
|
+
function logSafeRequestErrorData(data) {
|
|
6127
|
+
if (!isRecord3(data) || typeof data["errorKind"] !== "string") {
|
|
6128
|
+
return void 0;
|
|
6129
|
+
}
|
|
6130
|
+
const status = data["status"];
|
|
6131
|
+
const hint = data["hint"];
|
|
6132
|
+
return {
|
|
6133
|
+
errorKind: boundedAcpErrorString(
|
|
6134
|
+
data["errorKind"],
|
|
6135
|
+
MAX_LOG_SAFE_ACP_ERROR_KIND_CHARS
|
|
6136
|
+
),
|
|
6137
|
+
...typeof status === "number" && Number.isFinite(status) ? { status } : {},
|
|
6138
|
+
...typeof hint === "string" ? {
|
|
6139
|
+
hint: boundedAcpErrorString(hint, MAX_LOG_SAFE_ACP_ERROR_HINT_CHARS)
|
|
6140
|
+
} : {}
|
|
6141
|
+
};
|
|
6142
|
+
}
|
|
6143
|
+
__name(logSafeRequestErrorData, "logSafeRequestErrorData");
|
|
6144
|
+
var AcpInboundHandlerLimitError = class extends Error {
|
|
6145
|
+
constructor(maxActiveHandlers, maxActiveHandlerBytes, requiredBytes, availableBytes) {
|
|
6146
|
+
super("ACP inbound handler capacity exceeded");
|
|
6147
|
+
this.maxActiveHandlers = maxActiveHandlers;
|
|
6148
|
+
this.maxActiveHandlerBytes = maxActiveHandlerBytes;
|
|
6149
|
+
this.requiredBytes = requiredBytes;
|
|
6150
|
+
this.availableBytes = availableBytes;
|
|
6151
|
+
this.name = "AcpInboundHandlerLimitError";
|
|
6152
|
+
}
|
|
6153
|
+
static {
|
|
6154
|
+
__name(this, "AcpInboundHandlerLimitError");
|
|
6155
|
+
}
|
|
6156
|
+
code = "acp_handler_limit_exceeded";
|
|
6157
|
+
};
|
|
6158
|
+
function estimateAcpHandlerBytes(value, limitBytes) {
|
|
6159
|
+
let bytes = 0;
|
|
6160
|
+
const stack = [value];
|
|
6161
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
6162
|
+
while (stack.length > 0) {
|
|
6163
|
+
const current = stack.pop();
|
|
6164
|
+
if (current === null) {
|
|
6165
|
+
bytes += 4;
|
|
6166
|
+
} else if (typeof current === "string") {
|
|
6167
|
+
bytes += Buffer.byteLength(current) + 2;
|
|
6168
|
+
} else if (typeof current === "number") {
|
|
6169
|
+
bytes += 24;
|
|
6170
|
+
} else if (typeof current === "boolean") {
|
|
6171
|
+
bytes += 5;
|
|
6172
|
+
} else if (Array.isArray(current)) {
|
|
6173
|
+
if (seen.has(current)) return limitBytes + 1;
|
|
6174
|
+
seen.add(current);
|
|
6175
|
+
bytes += 2 + Math.max(0, current.length - 1);
|
|
6176
|
+
if (bytes + current.length > limitBytes) return limitBytes + 1;
|
|
6177
|
+
for (let index = current.length - 1; index >= 0; index--) {
|
|
6178
|
+
stack.push(current[index]);
|
|
6179
|
+
}
|
|
6180
|
+
} else if (isRecord3(current)) {
|
|
6181
|
+
if (seen.has(current)) return limitBytes + 1;
|
|
6182
|
+
seen.add(current);
|
|
6183
|
+
const entries = Object.entries(current);
|
|
6184
|
+
bytes += 2 + Math.max(0, entries.length - 1);
|
|
6185
|
+
for (const [key, entryValue] of entries) {
|
|
6186
|
+
bytes += Buffer.byteLength(key) + 3;
|
|
6187
|
+
stack.push(entryValue);
|
|
6188
|
+
}
|
|
6189
|
+
} else {
|
|
6190
|
+
bytes += 4;
|
|
6191
|
+
}
|
|
6192
|
+
if (bytes > limitBytes) return limitBytes + 1;
|
|
6193
|
+
}
|
|
6194
|
+
return Math.max(1, bytes);
|
|
6195
|
+
}
|
|
6196
|
+
__name(estimateAcpHandlerBytes, "estimateAcpHandlerBytes");
|
|
6197
|
+
var AcpInboundHandlerAdmission = class {
|
|
6198
|
+
constructor(guard) {
|
|
6199
|
+
this.guard = guard;
|
|
6200
|
+
}
|
|
6201
|
+
static {
|
|
6202
|
+
__name(this, "AcpInboundHandlerAdmission");
|
|
6203
|
+
}
|
|
6204
|
+
activeHandlers = 0;
|
|
6205
|
+
activeBytes = 0;
|
|
6206
|
+
async run(params, operation) {
|
|
6207
|
+
const envelopeBytes = Math.min(2048, this.guard.maxActiveHandlerBytes);
|
|
6208
|
+
const requiredBytes = envelopeBytes + estimateAcpHandlerBytes(
|
|
6209
|
+
params,
|
|
6210
|
+
Math.max(0, this.guard.maxActiveHandlerBytes - envelopeBytes)
|
|
6211
|
+
);
|
|
6212
|
+
const availableBytes = Math.max(
|
|
6213
|
+
0,
|
|
6214
|
+
this.guard.maxActiveHandlerBytes - this.activeBytes
|
|
6215
|
+
);
|
|
6216
|
+
if (this.activeHandlers >= this.guard.maxActiveHandlers || requiredBytes > availableBytes) {
|
|
6217
|
+
const error = new AcpInboundHandlerLimitError(
|
|
6218
|
+
this.guard.maxActiveHandlers,
|
|
6219
|
+
this.guard.maxActiveHandlerBytes,
|
|
6220
|
+
requiredBytes,
|
|
6221
|
+
availableBytes
|
|
6222
|
+
);
|
|
6223
|
+
this.guard.fail(error);
|
|
6224
|
+
throw error;
|
|
6225
|
+
}
|
|
6226
|
+
this.activeHandlers++;
|
|
6227
|
+
this.activeBytes += requiredBytes;
|
|
6228
|
+
try {
|
|
6229
|
+
return await operation();
|
|
6230
|
+
} finally {
|
|
6231
|
+
this.activeHandlers--;
|
|
6232
|
+
this.activeBytes -= requiredBytes;
|
|
6233
|
+
}
|
|
6234
|
+
}
|
|
6235
|
+
};
|
|
6236
|
+
async function withLogSafeAcpError(operation, reservePreparedResponse) {
|
|
6237
|
+
try {
|
|
6238
|
+
return await operation();
|
|
6239
|
+
} catch (error) {
|
|
6240
|
+
if (error instanceof RequestError) {
|
|
6241
|
+
const code = Number.isFinite(error.code) ? error.code : -32603;
|
|
6242
|
+
throw new LogSafeAcpRequestError(
|
|
6243
|
+
code,
|
|
6244
|
+
logSafeRequestErrorMessage(code),
|
|
6245
|
+
logSafeRequestErrorData(error.data),
|
|
6246
|
+
reservePreparedResponse
|
|
6247
|
+
);
|
|
6248
|
+
}
|
|
6249
|
+
throw new LogSafeAcpRequestError(
|
|
6250
|
+
-32603,
|
|
6251
|
+
"Internal error",
|
|
6252
|
+
logSafeAcpErrorDetails(error),
|
|
6253
|
+
reservePreparedResponse
|
|
6254
|
+
);
|
|
6255
|
+
}
|
|
6256
|
+
}
|
|
6257
|
+
__name(withLogSafeAcpError, "withLogSafeAcpError");
|
|
6258
|
+
function createLogSafeAcpClient(client, transportGuard) {
|
|
6259
|
+
const admission = new AcpInboundHandlerAdmission(transportGuard);
|
|
6260
|
+
const runNotification = /* @__PURE__ */ __name((params, operation) => withLogSafeAcpError(() => admission.run(params, operation)), "runNotification");
|
|
6261
|
+
const runRequest = /* @__PURE__ */ __name((params, operation) => withLogSafeAcpError(
|
|
6262
|
+
() => admission.run(params, async () => {
|
|
6263
|
+
const result = await operation();
|
|
6264
|
+
transportGuard.reservePreparedResponse(result ?? null);
|
|
6265
|
+
return result;
|
|
6266
|
+
}),
|
|
6267
|
+
transportGuard.reservePreparedResponse
|
|
6268
|
+
), "runRequest");
|
|
6269
|
+
return {
|
|
6270
|
+
requestPermission: /* @__PURE__ */ __name((params) => runRequest(params, () => client.requestPermission(params)), "requestPermission"),
|
|
6271
|
+
sessionUpdate: /* @__PURE__ */ __name((params) => runNotification(params, () => client.sessionUpdate(params)), "sessionUpdate"),
|
|
6272
|
+
writeTextFile: client.writeTextFile ? (params) => runRequest(params, () => client.writeTextFile(params)) : void 0,
|
|
6273
|
+
readTextFile: client.readTextFile ? (params) => runRequest(params, () => client.readTextFile(params)) : void 0,
|
|
6274
|
+
createTerminal: client.createTerminal ? (params) => runRequest(params, () => client.createTerminal(params)) : void 0,
|
|
6275
|
+
terminalOutput: client.terminalOutput ? (params) => runRequest(params, () => client.terminalOutput(params)) : void 0,
|
|
6276
|
+
releaseTerminal: client.releaseTerminal ? (params) => runRequest(
|
|
6277
|
+
params,
|
|
6278
|
+
async () => await client.releaseTerminal(params) ?? {}
|
|
6279
|
+
) : void 0,
|
|
6280
|
+
waitForTerminalExit: client.waitForTerminalExit ? (params) => runRequest(params, () => client.waitForTerminalExit(params)) : void 0,
|
|
6281
|
+
killTerminal: client.killTerminal ? (params) => runRequest(
|
|
6282
|
+
params,
|
|
6283
|
+
async () => await client.killTerminal(params) ?? {}
|
|
6284
|
+
) : void 0,
|
|
6285
|
+
extMethod: client.extMethod ? (method, params) => runRequest(params, () => client.extMethod(method, params)) : void 0,
|
|
6286
|
+
extNotification: client.extNotification ? (method, params) => runNotification(params, () => client.extNotification(method, params)) : void 0
|
|
6287
|
+
};
|
|
6288
|
+
}
|
|
6289
|
+
__name(createLogSafeAcpClient, "createLogSafeAcpClient");
|
|
6290
|
+
var OUTBOUND_GUARDED_CONNECTION_METHODS = /* @__PURE__ */ new Set([
|
|
6291
|
+
"initialize",
|
|
6292
|
+
"newSession",
|
|
6293
|
+
"loadSession",
|
|
6294
|
+
"unstable_forkSession",
|
|
6295
|
+
"unstable_listSessions",
|
|
6296
|
+
"unstable_resumeSession",
|
|
6297
|
+
"setSessionMode",
|
|
6298
|
+
"unstable_setSessionModel",
|
|
6299
|
+
"setSessionConfigOption",
|
|
6300
|
+
"authenticate",
|
|
6301
|
+
"prompt",
|
|
6302
|
+
"cancel",
|
|
6303
|
+
"extMethod",
|
|
6304
|
+
"extNotification"
|
|
6305
|
+
]);
|
|
6306
|
+
function createOutboundGuardedConnection(connection, transportGuard) {
|
|
6307
|
+
const wrappers = /* @__PURE__ */ new Map();
|
|
6308
|
+
return new Proxy(connection, {
|
|
6309
|
+
get(target, property) {
|
|
6310
|
+
const value = Reflect.get(target, property, target);
|
|
6311
|
+
if (typeof value !== "function" || !OUTBOUND_GUARDED_CONNECTION_METHODS.has(property)) {
|
|
6312
|
+
return value;
|
|
6313
|
+
}
|
|
6314
|
+
let wrapper = wrappers.get(property);
|
|
6315
|
+
if (!wrapper) {
|
|
6316
|
+
wrapper = /* @__PURE__ */ __name(async (...args) => {
|
|
6317
|
+
const release = transportGuard.reserveOutboundOperation(args);
|
|
6318
|
+
try {
|
|
6319
|
+
return await Reflect.apply(value, target, args);
|
|
6320
|
+
} finally {
|
|
6321
|
+
release();
|
|
6322
|
+
}
|
|
6323
|
+
}, "wrapper");
|
|
6324
|
+
wrappers.set(property, wrapper);
|
|
6325
|
+
}
|
|
6326
|
+
return wrapper;
|
|
6327
|
+
}
|
|
6328
|
+
});
|
|
6329
|
+
}
|
|
6330
|
+
__name(createOutboundGuardedConnection, "createOutboundGuardedConnection");
|
|
5931
6331
|
function getCanonicalModelId(response, fallback) {
|
|
5932
6332
|
if (!isRecord3(response) || !isRecord3(response["_meta"])) return fallback;
|
|
5933
6333
|
const modelSwitch = response["_meta"]["qwenModelSwitch"];
|
|
@@ -5964,9 +6364,9 @@ function extractLoadReplayResponse(state) {
|
|
|
5964
6364
|
`Invalid qwen.session.loadReplay updates (version=${LOAD_REPLAY_VERSION}, count=not-array)`
|
|
5965
6365
|
);
|
|
5966
6366
|
}
|
|
5967
|
-
if (rawUpdates.length >
|
|
6367
|
+
if (rawUpdates.length > LOAD_REPLAY_MAX_UPDATES) {
|
|
5968
6368
|
throw new Error(
|
|
5969
|
-
`qwen.session.loadReplay updates exceed limit (${rawUpdates.length} > ${
|
|
6369
|
+
`qwen.session.loadReplay updates exceed limit (${rawUpdates.length} > ${LOAD_REPLAY_MAX_UPDATES})`
|
|
5970
6370
|
);
|
|
5971
6371
|
}
|
|
5972
6372
|
const partial = replay["partial"];
|
|
@@ -5987,6 +6387,12 @@ function extractLoadReplayResponse(state) {
|
|
|
5987
6387
|
`Invalid qwen.session.loadReplay hasMore (version=${LOAD_REPLAY_VERSION}, hasMore=${describeLoadReplayValue(hasMore)})`
|
|
5988
6388
|
);
|
|
5989
6389
|
}
|
|
6390
|
+
const anchorRecordId = replay["anchorRecordId"];
|
|
6391
|
+
if (anchorRecordId !== void 0 && typeof anchorRecordId !== "string") {
|
|
6392
|
+
throw new Error(
|
|
6393
|
+
`Invalid qwen.session.loadReplay anchorRecordId (version=${LOAD_REPLAY_VERSION}, anchorRecordId=${describeLoadReplayValue(anchorRecordId)})`
|
|
6394
|
+
);
|
|
6395
|
+
}
|
|
5990
6396
|
const invalidUpdateIndex = rawUpdates.findIndex(
|
|
5991
6397
|
(update) => !isBulkReplayUpdate(update)
|
|
5992
6398
|
);
|
|
@@ -6008,6 +6414,7 @@ function extractLoadReplayResponse(state) {
|
|
|
6008
6414
|
return {
|
|
6009
6415
|
state: cleanState,
|
|
6010
6416
|
updates: rawUpdates,
|
|
6417
|
+
...typeof anchorRecordId === "string" ? { anchorRecordId } : {},
|
|
6011
6418
|
...partial === true ? { partial: true } : {},
|
|
6012
6419
|
...typeof replayError === "string" ? { replayError } : {},
|
|
6013
6420
|
...hasMore === true ? { hasMore: true } : {}
|
|
@@ -6134,14 +6541,27 @@ function pickUserInputEchoMeta(meta) {
|
|
|
6134
6541
|
return Array.isArray(inputAnnotations) ? { inputAnnotations } : {};
|
|
6135
6542
|
}
|
|
6136
6543
|
__name(pickUserInputEchoMeta, "pickUserInputEchoMeta");
|
|
6137
|
-
function echoPromptToSessionBus(entry, req, promptId, originatorClientId) {
|
|
6544
|
+
function echoPromptToSessionBus(entry, req, promptId, originatorClientId, displayText) {
|
|
6138
6545
|
const prompt = req.prompt;
|
|
6139
6546
|
if (!Array.isArray(prompt) || prompt.length === 0) return;
|
|
6547
|
+
let displayTextPublished = false;
|
|
6140
6548
|
const serverTimestamp = Date.now();
|
|
6141
|
-
const
|
|
6549
|
+
const echoPrompt = prompt.slice(0, MAX_ECHO_CONTENT_BLOCKS);
|
|
6550
|
+
if (displayText && !echoPrompt.some((part) => isRecord3(part) && part["type"] === "text")) {
|
|
6551
|
+
const textPart = prompt.slice(MAX_ECHO_CONTENT_BLOCKS).find((part) => isRecord3(part) && part["type"] === "text");
|
|
6552
|
+
if (textPart) echoPrompt[echoPrompt.length - 1] = textPart;
|
|
6553
|
+
}
|
|
6554
|
+
const blockCount = echoPrompt.length;
|
|
6142
6555
|
for (let i = 0; i < blockCount; i += 1) {
|
|
6143
|
-
const part =
|
|
6556
|
+
const part = echoPrompt[i];
|
|
6144
6557
|
if (!part || typeof part !== "object" || Array.isArray(part)) continue;
|
|
6558
|
+
let displayPart = part;
|
|
6559
|
+
if (displayText !== void 0 && part.type === "text") {
|
|
6560
|
+
if (displayTextPublished) continue;
|
|
6561
|
+
displayTextPublished = true;
|
|
6562
|
+
if (!displayText) continue;
|
|
6563
|
+
displayPart = { ...part, text: displayText };
|
|
6564
|
+
}
|
|
6145
6565
|
try {
|
|
6146
6566
|
entry.events.publish({
|
|
6147
6567
|
type: "session_update",
|
|
@@ -6150,7 +6570,7 @@ function echoPromptToSessionBus(entry, req, promptId, originatorClientId) {
|
|
|
6150
6570
|
sessionId: req.sessionId,
|
|
6151
6571
|
update: {
|
|
6152
6572
|
sessionUpdate: "user_message_chunk",
|
|
6153
|
-
content:
|
|
6573
|
+
content: displayPart,
|
|
6154
6574
|
// `_meta` lives inside the `update` object rather than at
|
|
6155
6575
|
// envelope level. `_meta` is a standard JSON-RPC/MCP extension
|
|
6156
6576
|
// field permitted alongside spec fields, the SDK normalizer
|
|
@@ -6482,6 +6902,16 @@ function createAcpSessionBridge(opts) {
|
|
|
6482
6902
|
);
|
|
6483
6903
|
const maxJournalEvents = normalizeMaxJournalEvents(opts.maxJournalEvents);
|
|
6484
6904
|
const maxJournalBytes = normalizeMaxJournalBytes(opts.maxJournalBytes);
|
|
6905
|
+
const journalGrowthPoolBytes = normalizeJournalGrowthPoolBytes(
|
|
6906
|
+
opts.journalGrowthPoolBytes
|
|
6907
|
+
);
|
|
6908
|
+
const journalGrowthPolicy = journalGrowthPoolBytes !== void 0 ? createJournalGrowthPolicy({
|
|
6909
|
+
baselineEvents: maxJournalEvents,
|
|
6910
|
+
baselineBytes: maxJournalBytes,
|
|
6911
|
+
poolBytes: journalGrowthPoolBytes,
|
|
6912
|
+
hardCapBytes: JOURNAL_GROWTH_HARD_CAP_BYTES
|
|
6913
|
+
}) : void 0;
|
|
6914
|
+
const journalGrowthSessionLimits = opts.journalGrowthSessionLimits;
|
|
6485
6915
|
const channelFactory = opts.channelFactory ?? defaultSpawnChannelFactory;
|
|
6486
6916
|
const childEnvOverrides = opts.childEnvOverrides ? Object.freeze({ ...opts.childEnvOverrides }) : Object.freeze({});
|
|
6487
6917
|
const initTimeoutMs = opts.initializeTimeoutMs ?? DEFAULT_INIT_TIMEOUT_MS;
|
|
@@ -6717,6 +7147,14 @@ function createAcpSessionBridge(opts) {
|
|
|
6717
7147
|
}
|
|
6718
7148
|
}
|
|
6719
7149
|
__name(cancelIdleTimer, "cancelIdleTimer");
|
|
7150
|
+
function channelUnavailableReject(channel, context) {
|
|
7151
|
+
const unavailable = channel.transportFailed ? Promise.race([channel.exited, channel.transportFailed]) : channel.exited;
|
|
7152
|
+
const reject = /* @__PURE__ */ __name(() => {
|
|
7153
|
+
throw new BridgeChannelClosedError(context);
|
|
7154
|
+
}, "reject");
|
|
7155
|
+
return unavailable.then(reject, reject);
|
|
7156
|
+
}
|
|
7157
|
+
__name(channelUnavailableReject, "channelUnavailableReject");
|
|
6720
7158
|
async function killChannelWithLog(ci, context) {
|
|
6721
7159
|
ci.isDying = true;
|
|
6722
7160
|
await ci.channel.kill().catch((err) => {
|
|
@@ -6923,6 +7361,14 @@ function createAcpSessionBridge(opts) {
|
|
|
6923
7361
|
const generationRequests = /* @__PURE__ */ new Map();
|
|
6924
7362
|
const workspaceGenerationRequests = /* @__PURE__ */ new Map();
|
|
6925
7363
|
const inFlightExtensionRefreshes = /* @__PURE__ */ new Map();
|
|
7364
|
+
const clearInFlightExtensionRefreshes = /* @__PURE__ */ __name((connection) => {
|
|
7365
|
+
for (const [sessionId, refresh] of inFlightExtensionRefreshes) {
|
|
7366
|
+
if (refresh.connection === connection) {
|
|
7367
|
+
refresh.rejectUnavailable();
|
|
7368
|
+
inFlightExtensionRefreshes.delete(sessionId);
|
|
7369
|
+
}
|
|
7370
|
+
}
|
|
7371
|
+
}, "clearInFlightExtensionRefreshes");
|
|
6926
7372
|
const toSessionSummary = /* @__PURE__ */ __name((entry) => {
|
|
6927
7373
|
let isWaitingForPermission = false;
|
|
6928
7374
|
let isWaitingForUserQuestion = false;
|
|
@@ -6989,6 +7435,22 @@ function createAcpSessionBridge(opts) {
|
|
|
6989
7435
|
const inFlightRequestedSessionSpawns = /* @__PURE__ */ new Map();
|
|
6990
7436
|
const inFlightRestores = /* @__PURE__ */ new Map();
|
|
6991
7437
|
const pendingRestoreEvents = /* @__PURE__ */ new Map();
|
|
7438
|
+
const journalSessionLimits = /* @__PURE__ */ __name(() => {
|
|
7439
|
+
const limits = [...byId.values()].map((entry) => ({
|
|
7440
|
+
limitBytes: entry.events.journalLimitBytes() ?? maxJournalBytes,
|
|
7441
|
+
baselineBytes: maxJournalBytes
|
|
7442
|
+
}));
|
|
7443
|
+
for (const [restoreId, bus] of pendingRestoreEvents) {
|
|
7444
|
+
if (!byId.has(restoreId)) {
|
|
7445
|
+
limits.push({
|
|
7446
|
+
limitBytes: bus.journalLimitBytes() ?? maxJournalBytes,
|
|
7447
|
+
baselineBytes: maxJournalBytes
|
|
7448
|
+
});
|
|
7449
|
+
}
|
|
7450
|
+
}
|
|
7451
|
+
return limits;
|
|
7452
|
+
}, "journalSessionLimits");
|
|
7453
|
+
const unregisterJournalGrowthSessionLimits = journalGrowthPolicy !== void 0 && opts.registerJournalGrowthSessionLimits !== void 0 ? opts.registerJournalGrowthSessionLimits(journalSessionLimits) : void 0;
|
|
6992
7454
|
const createClientId = /* @__PURE__ */ __name(() => `client_${randomUUID2()}`, "createClientId");
|
|
6993
7455
|
const registerClient = /* @__PURE__ */ __name((entry, requestedClientId) => {
|
|
6994
7456
|
if (requestedClientId && entry.clientIds.has(requestedClientId)) {
|
|
@@ -7171,7 +7633,14 @@ function createAcpSessionBridge(opts) {
|
|
|
7171
7633
|
applyActiveWorkSnapshot(currentInfo, snapshot);
|
|
7172
7634
|
}
|
|
7173
7635
|
);
|
|
7174
|
-
|
|
7636
|
+
const rawConnection = new ClientSideConnection(
|
|
7637
|
+
() => channel.transportGuard ? createLogSafeAcpClient(client, channel.transportGuard) : client,
|
|
7638
|
+
channel.stream
|
|
7639
|
+
);
|
|
7640
|
+
connection = channel.transportGuard ? createOutboundGuardedConnection(
|
|
7641
|
+
rawConnection,
|
|
7642
|
+
channel.transportGuard
|
|
7643
|
+
) : rawConnection;
|
|
7175
7644
|
} catch (error) {
|
|
7176
7645
|
try {
|
|
7177
7646
|
channel.killSync();
|
|
@@ -7207,11 +7676,26 @@ function createAcpSessionBridge(opts) {
|
|
|
7207
7676
|
unsettledAbandonedRestores: /* @__PURE__ */ new Set(),
|
|
7208
7677
|
restoreSettlementOverdue: false,
|
|
7209
7678
|
restoreSettlementTimers: /* @__PURE__ */ new Map(),
|
|
7679
|
+
transportFailed: false,
|
|
7680
|
+
transportFailureInitiatedTeardown: false,
|
|
7210
7681
|
isDying: false,
|
|
7211
7682
|
isQuarantined: false,
|
|
7212
7683
|
handshakeComplete: false
|
|
7213
7684
|
};
|
|
7214
7685
|
infoRef.current = info;
|
|
7686
|
+
const markTransportFailed = /* @__PURE__ */ __name((error) => {
|
|
7687
|
+
if (!info.isDying) {
|
|
7688
|
+
info.transportFailureInitiatedTeardown = true;
|
|
7689
|
+
}
|
|
7690
|
+
info.transportFailed = true;
|
|
7691
|
+
info.transportFailureCode = safeTransportFailureCode(error);
|
|
7692
|
+
info.isDying = true;
|
|
7693
|
+
clearInFlightExtensionRefreshes(info.connection);
|
|
7694
|
+
}, "markTransportFailed");
|
|
7695
|
+
void channel.transportFailed?.then(
|
|
7696
|
+
markTransportFailed,
|
|
7697
|
+
markTransportFailed
|
|
7698
|
+
);
|
|
7215
7699
|
aliveChannels.add(info);
|
|
7216
7700
|
if (aliveChannels.size > 2) {
|
|
7217
7701
|
writeStderrLine(
|
|
@@ -7219,6 +7703,7 @@ function createAcpSessionBridge(opts) {
|
|
|
7219
7703
|
);
|
|
7220
7704
|
}
|
|
7221
7705
|
void channel.exited.then((exitInfo) => {
|
|
7706
|
+
clearInFlightExtensionRefreshes(info.connection);
|
|
7222
7707
|
if (channelInfo === info) cancelIdleTimer();
|
|
7223
7708
|
if (info.workspaceMcpDiscoveryTimer) {
|
|
7224
7709
|
clearTimeout(info.workspaceMcpDiscoveryTimer);
|
|
@@ -7237,7 +7722,7 @@ function createAcpSessionBridge(opts) {
|
|
|
7237
7722
|
if (channelInfo === info) channelInfo = void 0;
|
|
7238
7723
|
const sessions = Array.from(info.sessionIds);
|
|
7239
7724
|
info.sessionIds.clear();
|
|
7240
|
-
const channelExitExpected = shuttingDown || info.isDying;
|
|
7725
|
+
const channelExitExpected = shuttingDown || info.isDying && !info.transportFailureInitiatedTeardown;
|
|
7241
7726
|
if (info.handshakeComplete) {
|
|
7242
7727
|
telemetry.metrics?.channelLifecycle("exit", channelExitExpected);
|
|
7243
7728
|
}
|
|
@@ -7245,10 +7730,15 @@ function createAcpSessionBridge(opts) {
|
|
|
7245
7730
|
telemetry.event("channel.exited", {
|
|
7246
7731
|
"qwen-code.daemon.channel.exit_code": exitInfo?.exitCode ?? -1,
|
|
7247
7732
|
"qwen-code.daemon.channel.session_count": sessions.length,
|
|
7733
|
+
"qwen-code.daemon.channel.transport_failed": info.transportFailed,
|
|
7734
|
+
"qwen-code.daemon.channel.transport_failure_initiated_teardown": info.transportFailureInitiatedTeardown,
|
|
7735
|
+
...info.transportFailureCode ? {
|
|
7736
|
+
"qwen-code.daemon.channel.transport_error_code": info.transportFailureCode
|
|
7737
|
+
} : {},
|
|
7248
7738
|
...exitInfo?.signalCode ? { "qwen-code.daemon.channel.signal": exitInfo.signalCode } : {}
|
|
7249
7739
|
});
|
|
7250
7740
|
writeStderrLine(
|
|
7251
|
-
`qwen serve: channel exited (code=${exitInfo?.exitCode ?? "none"}, signal=${exitInfo?.signalCode ?? "none"}, ${sessions.length} session(s) torn down)`
|
|
7741
|
+
`qwen serve: channel exited (code=${exitInfo?.exitCode ?? "none"}, signal=${exitInfo?.signalCode ?? "none"}, transport=${info.transportFailed ? info.transportFailureCode ?? "failed" : "ok"}, ${sessions.length} session(s) torn down)`
|
|
7252
7742
|
);
|
|
7253
7743
|
}
|
|
7254
7744
|
for (const sid of sessions) {
|
|
@@ -7300,26 +7790,29 @@ function createAcpSessionBridge(opts) {
|
|
|
7300
7790
|
},
|
|
7301
7791
|
async () => {
|
|
7302
7792
|
const response = await withTimeout(
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7793
|
+
Promise.race([
|
|
7794
|
+
connection.initialize({
|
|
7795
|
+
protocolVersion: PROTOCOL_VERSION,
|
|
7796
|
+
_meta: {
|
|
7797
|
+
[ACTIVE_WORK_HEARTBEAT_META_KEY]: {
|
|
7798
|
+
v: ACTIVE_WORK_HEARTBEAT_VERSION,
|
|
7799
|
+
intervalMs: ACTIVE_WORK_HEARTBEAT_INTERVAL_MS
|
|
7800
|
+
},
|
|
7801
|
+
[CHANNEL_STARTUP_PROFILE_META_KEY]: {
|
|
7802
|
+
v: CHANNEL_STARTUP_PROFILE_VERSION
|
|
7803
|
+
},
|
|
7804
|
+
[PRIVATE_PARENT_CAPABILITY_META_KEY]: privateParentCapability
|
|
7309
7805
|
},
|
|
7310
|
-
|
|
7311
|
-
|
|
7806
|
+
clientCapabilities: {
|
|
7807
|
+
fs: {
|
|
7808
|
+
readTextFile: delegateReadTextFileToClient,
|
|
7809
|
+
writeTextFile: true
|
|
7810
|
+
}
|
|
7312
7811
|
},
|
|
7313
|
-
|
|
7314
|
-
},
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
readTextFile: delegateReadTextFileToClient,
|
|
7318
|
-
writeTextFile: true
|
|
7319
|
-
}
|
|
7320
|
-
},
|
|
7321
|
-
clientInfo: { name: "qwen-serve-bridge", version: "0" }
|
|
7322
|
-
}),
|
|
7812
|
+
clientInfo: { name: "qwen-serve-bridge", version: "0" }
|
|
7813
|
+
}),
|
|
7814
|
+
channelUnavailableReject(channel, "during initialize")
|
|
7815
|
+
]),
|
|
7323
7816
|
initTimeoutMs,
|
|
7324
7817
|
"initialize"
|
|
7325
7818
|
);
|
|
@@ -7364,6 +7857,11 @@ function createAcpSessionBridge(opts) {
|
|
|
7364
7857
|
});
|
|
7365
7858
|
throw err;
|
|
7366
7859
|
}
|
|
7860
|
+
if (info.isDying) {
|
|
7861
|
+
await channel.kill().catch(() => {
|
|
7862
|
+
});
|
|
7863
|
+
throw new BridgeChannelClosedError("during initialize");
|
|
7864
|
+
}
|
|
7367
7865
|
if (shuttingDown) {
|
|
7368
7866
|
info.isDying = true;
|
|
7369
7867
|
await channel.kill().catch(() => {
|
|
@@ -7393,6 +7891,9 @@ function createAcpSessionBridge(opts) {
|
|
|
7393
7891
|
},
|
|
7394
7892
|
ensureChannel
|
|
7395
7893
|
);
|
|
7894
|
+
if (ci.isDying) {
|
|
7895
|
+
throw new BridgeChannelClosedError("before newSession");
|
|
7896
|
+
}
|
|
7396
7897
|
ci.sessionSpawnsInFlight++;
|
|
7397
7898
|
if (requestedSessionId !== void 0) {
|
|
7398
7899
|
ci.client.markSessionRegistrationInFlight(requestedSessionId);
|
|
@@ -7425,15 +7926,18 @@ function createAcpSessionBridge(opts) {
|
|
|
7425
7926
|
} : {}
|
|
7426
7927
|
});
|
|
7427
7928
|
const response = await withTimeout(
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7929
|
+
Promise.race([
|
|
7930
|
+
ci.connection.newSession(
|
|
7931
|
+
worktree ? {
|
|
7932
|
+
...request,
|
|
7933
|
+
_meta: {
|
|
7934
|
+
...isRecord3(request._meta) ? request._meta : {},
|
|
7935
|
+
[WORKTREE_MCP_DEFER_META_KEY]: true
|
|
7936
|
+
}
|
|
7937
|
+
} : request
|
|
7938
|
+
),
|
|
7939
|
+
channelUnavailableReject(ci.channel, "during newSession")
|
|
7940
|
+
]),
|
|
7437
7941
|
initTimeoutMs,
|
|
7438
7942
|
"newSession"
|
|
7439
7943
|
);
|
|
@@ -7454,6 +7958,10 @@ function createAcpSessionBridge(opts) {
|
|
|
7454
7958
|
}
|
|
7455
7959
|
throw err;
|
|
7456
7960
|
}
|
|
7961
|
+
await Promise.resolve();
|
|
7962
|
+
if (ci.isDying) {
|
|
7963
|
+
throw new BridgeChannelClosedError("after newSession");
|
|
7964
|
+
}
|
|
7457
7965
|
if (shuttingDown) {
|
|
7458
7966
|
throw new Error("AcpSessionBridge is shutting down");
|
|
7459
7967
|
}
|
|
@@ -7772,13 +8280,25 @@ function createAcpSessionBridge(opts) {
|
|
|
7772
8280
|
__name(applyApprovalMode, "applyApprovalMode");
|
|
7773
8281
|
async function applyApprovalModeForAttach(entry, mode, clientId) {
|
|
7774
8282
|
try {
|
|
7775
|
-
await applyApprovalMode(entry, mode, false, clientId);
|
|
8283
|
+
const result = await applyApprovalMode(entry, mode, false, clientId);
|
|
8284
|
+
return result.previous;
|
|
7776
8285
|
} catch (err) {
|
|
7777
8286
|
await rollbackAttachRegistration(entry, clientId);
|
|
7778
8287
|
throw err;
|
|
7779
8288
|
}
|
|
7780
8289
|
}
|
|
7781
8290
|
__name(applyApprovalModeForAttach, "applyApprovalModeForAttach");
|
|
8291
|
+
async function rollbackApprovalModeForRejectedAttach(entry, previous, clientId) {
|
|
8292
|
+
if (byId.get(entry.sessionId) !== entry) return;
|
|
8293
|
+
try {
|
|
8294
|
+
await applyApprovalMode(entry, previous, false, clientId);
|
|
8295
|
+
} catch (err) {
|
|
8296
|
+
writeStderrLine(
|
|
8297
|
+
`attach: failed to restore approval mode for session ${entry.sessionId}: ${extractErrorMessage(err)}`
|
|
8298
|
+
);
|
|
8299
|
+
}
|
|
8300
|
+
}
|
|
8301
|
+
__name(rollbackApprovalModeForRejectedAttach, "rollbackApprovalModeForRejectedAttach");
|
|
7782
8302
|
const cancelPendingForSession = /* @__PURE__ */ __name((sessionId) => {
|
|
7783
8303
|
permissionMediator.forgetSession(sessionId);
|
|
7784
8304
|
byId.get(sessionId)?.pendingPermissionIds.clear();
|
|
@@ -7786,11 +8306,10 @@ function createAcpSessionBridge(opts) {
|
|
|
7786
8306
|
}, "cancelPendingForSession");
|
|
7787
8307
|
const getTransportClosedReject = /* @__PURE__ */ __name((entry) => {
|
|
7788
8308
|
if (!entry.transportClosedReject) {
|
|
7789
|
-
entry.transportClosedReject =
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
});
|
|
8309
|
+
entry.transportClosedReject = channelUnavailableReject(
|
|
8310
|
+
entry.channel,
|
|
8311
|
+
`mid-request (session ${entry.sessionId})`
|
|
8312
|
+
);
|
|
7794
8313
|
}
|
|
7795
8314
|
return entry.transportClosedReject;
|
|
7796
8315
|
}, "getTransportClosedReject");
|
|
@@ -7818,6 +8337,28 @@ function createAcpSessionBridge(opts) {
|
|
|
7818
8337
|
}
|
|
7819
8338
|
return void 0;
|
|
7820
8339
|
}, "channelInfoForEntry");
|
|
8340
|
+
const assertAttachableSessionEntry = /* @__PURE__ */ __name((sessionId, entry) => {
|
|
8341
|
+
if (byId.get(sessionId) !== entry) {
|
|
8342
|
+
throw new SessionNotFoundError(
|
|
8343
|
+
sessionId,
|
|
8344
|
+
"The session channel is unavailable; retry after teardown completes"
|
|
8345
|
+
);
|
|
8346
|
+
}
|
|
8347
|
+
if (isClosingOrAuthorizingClose(entry)) {
|
|
8348
|
+
throw new SessionNotFoundError(
|
|
8349
|
+
sessionId,
|
|
8350
|
+
"The session is closing; retry after close completes",
|
|
8351
|
+
"session_closing"
|
|
8352
|
+
);
|
|
8353
|
+
}
|
|
8354
|
+
const owner = channelInfoForEntry(entry);
|
|
8355
|
+
if (!owner || owner.isDying) {
|
|
8356
|
+
throw new SessionNotFoundError(
|
|
8357
|
+
sessionId,
|
|
8358
|
+
"The session channel is unavailable; retry after teardown completes"
|
|
8359
|
+
);
|
|
8360
|
+
}
|
|
8361
|
+
}, "assertAttachableSessionEntry");
|
|
7821
8362
|
const assertLivePromptEntry = /* @__PURE__ */ __name((sessionId, entry) => {
|
|
7822
8363
|
const info = channelInfoForEntry(entry);
|
|
7823
8364
|
if (byId.get(sessionId) !== entry || !info || info.isDying) {
|
|
@@ -7826,9 +8367,10 @@ function createAcpSessionBridge(opts) {
|
|
|
7826
8367
|
}, "assertLivePromptEntry");
|
|
7827
8368
|
const getChannelClosedReject = /* @__PURE__ */ __name((info) => {
|
|
7828
8369
|
if (!info.statusClosedReject) {
|
|
7829
|
-
info.statusClosedReject =
|
|
7830
|
-
|
|
7831
|
-
|
|
8370
|
+
info.statusClosedReject = channelUnavailableReject(
|
|
8371
|
+
info.channel,
|
|
8372
|
+
"mid-request (workspace status)"
|
|
8373
|
+
);
|
|
7832
8374
|
}
|
|
7833
8375
|
return info.statusClosedReject;
|
|
7834
8376
|
}, "getChannelClosedReject");
|
|
@@ -8039,7 +8581,7 @@ function createAcpSessionBridge(opts) {
|
|
|
8039
8581
|
`ACP session close channel unavailable for ${entry.sessionId}`
|
|
8040
8582
|
);
|
|
8041
8583
|
}
|
|
8042
|
-
return;
|
|
8584
|
+
return false;
|
|
8043
8585
|
}
|
|
8044
8586
|
try {
|
|
8045
8587
|
const closeRequest = entry.connection.extMethod(
|
|
@@ -8051,7 +8593,7 @@ function createAcpSessionBridge(opts) {
|
|
|
8051
8593
|
}
|
|
8052
8594
|
);
|
|
8053
8595
|
const observedCloseRequest = opts2?.timeoutMs ? withTimeout(closeRequest, opts2.timeoutMs, label) : closeRequest;
|
|
8054
|
-
await Promise.race([
|
|
8596
|
+
const response = await Promise.race([
|
|
8055
8597
|
opts2?.throwOnFailure === true ? observedCloseRequest : withTimeout(
|
|
8056
8598
|
observedCloseRequest,
|
|
8057
8599
|
initTimeoutMs,
|
|
@@ -8059,6 +8601,7 @@ function createAcpSessionBridge(opts) {
|
|
|
8059
8601
|
),
|
|
8060
8602
|
getTransportClosedReject(entry)
|
|
8061
8603
|
]);
|
|
8604
|
+
return response["closed"] === true;
|
|
8062
8605
|
} catch (err) {
|
|
8063
8606
|
writeStderrLine(
|
|
8064
8607
|
`qwen serve: ${label} ACP session close notification failed for session ${JSON.stringify(entry.sessionId)}: ${String(
|
|
@@ -8068,6 +8611,7 @@ function createAcpSessionBridge(opts) {
|
|
|
8068
8611
|
if (opts2?.throwOnFailure === true) {
|
|
8069
8612
|
throw err;
|
|
8070
8613
|
}
|
|
8614
|
+
return false;
|
|
8071
8615
|
}
|
|
8072
8616
|
}, "notifyAgentSessionClose");
|
|
8073
8617
|
const broadcastWorkspaceEvent = /* @__PURE__ */ __name((envelope, skipSessionId) => {
|
|
@@ -8118,7 +8662,34 @@ function createAcpSessionBridge(opts) {
|
|
|
8118
8662
|
teeServeDebugLine(
|
|
8119
8663
|
`replay window evicted ${JSON.stringify(eviction)}`
|
|
8120
8664
|
);
|
|
8121
|
-
}, "onReplayWindowEviction")
|
|
8665
|
+
}, "onReplayWindowEviction"),
|
|
8666
|
+
// Adaptive growth: the engine asks before evicting past its caps.
|
|
8667
|
+
// The policy accounts growth across this bridge's live sessions
|
|
8668
|
+
// from every session's CURRENT journal cap (stateless — no ledger
|
|
8669
|
+
// to reconcile when a session is reaped), so granted headroom dies
|
|
8670
|
+
// with its session.
|
|
8671
|
+
...journalGrowthPolicy ? {
|
|
8672
|
+
onJournalGrowth: /* @__PURE__ */ __name((current) => {
|
|
8673
|
+
const allSessionLimits = journalGrowthSessionLimits ? [...journalGrowthSessionLimits()] : journalSessionLimits();
|
|
8674
|
+
if (!byId.has(sessionId) && !pendingRestoreEvents.has(sessionId)) {
|
|
8675
|
+
allSessionLimits.push({
|
|
8676
|
+
limitBytes: current.maxBytes,
|
|
8677
|
+
baselineBytes: maxJournalBytes
|
|
8678
|
+
});
|
|
8679
|
+
}
|
|
8680
|
+
const grant = journalGrowthPolicy.grant({
|
|
8681
|
+
currentMaxEvents: current.maxEvents,
|
|
8682
|
+
currentMaxBytes: current.maxBytes,
|
|
8683
|
+
allSessionLimits
|
|
8684
|
+
});
|
|
8685
|
+
if (grant) {
|
|
8686
|
+
teeServeDebugLine(
|
|
8687
|
+
`live journal growth session=${JSON.stringify(sessionId)}: ${current.maxBytes} -> ${grant.maxBytes} bytes, ${current.maxEvents} -> ${grant.maxEvents} entries`
|
|
8688
|
+
);
|
|
8689
|
+
}
|
|
8690
|
+
return grant;
|
|
8691
|
+
}, "onJournalGrowth")
|
|
8692
|
+
} : {}
|
|
8122
8693
|
}),
|
|
8123
8694
|
{
|
|
8124
8695
|
// Fired once, on the FIRST ingest/seed failure (the bus keeps the
|
|
@@ -8405,7 +8976,8 @@ function createAcpSessionBridge(opts) {
|
|
|
8405
8976
|
return {
|
|
8406
8977
|
lastEventId: entry.events.lastEventId,
|
|
8407
8978
|
eventEpoch,
|
|
8408
|
-
...replayStatus
|
|
8979
|
+
...replayStatus,
|
|
8980
|
+
...action === "load" && entry.restoreHistoryAnchorRecordId !== void 0 ? { historyAnchorRecordId: entry.restoreHistoryAnchorRecordId } : {}
|
|
8409
8981
|
};
|
|
8410
8982
|
}
|
|
8411
8983
|
if (action === "load") {
|
|
@@ -8422,7 +8994,8 @@ function createAcpSessionBridge(opts) {
|
|
|
8422
8994
|
eventEpoch,
|
|
8423
8995
|
...replayStatus,
|
|
8424
8996
|
...snapshot.degraded ? { replayDegraded: true } : {},
|
|
8425
|
-
...entry.restoreHistoryHasMore === true ? { historyHasMore: true } : {}
|
|
8997
|
+
...entry.restoreHistoryHasMore === true ? { historyHasMore: true } : {},
|
|
8998
|
+
...entry.restoreHistoryAnchorRecordId !== void 0 ? { historyAnchorRecordId: entry.restoreHistoryAnchorRecordId } : {}
|
|
8426
8999
|
};
|
|
8427
9000
|
}
|
|
8428
9001
|
return { lastEventId: snapshot.lastEventId, eventEpoch, ...replayStatus };
|
|
@@ -8492,6 +9065,7 @@ function createAcpSessionBridge(opts) {
|
|
|
8492
9065
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
8493
9066
|
try {
|
|
8494
9067
|
const lastEventId = entry.events.lastEventId;
|
|
9068
|
+
const eventEpoch = entry.events.epoch;
|
|
8495
9069
|
const seenCursors = /* @__PURE__ */ new Set();
|
|
8496
9070
|
let emptyPageCount = 0;
|
|
8497
9071
|
let cursor;
|
|
@@ -8512,11 +9086,12 @@ function createAcpSessionBridge(opts) {
|
|
|
8512
9086
|
cursor = nextCursor;
|
|
8513
9087
|
if (cursor !== void 0) seenCursors.add(cursor);
|
|
8514
9088
|
} while (page.events.length === 0 && page.hasMore && cursor !== void 0 && page.partial !== true && page.replayError === void 0);
|
|
8515
|
-
if (byId.get(entry.sessionId) === entry && !entry.promptActive && entry.events.lastEventId === lastEventId) {
|
|
9089
|
+
if (byId.get(entry.sessionId) === entry && !entry.promptActive && entry.events.epoch === eventEpoch && entry.events.lastEventId === lastEventId) {
|
|
8516
9090
|
return {
|
|
8517
9091
|
compactedReplay: page.events,
|
|
8518
9092
|
liveJournal: [],
|
|
8519
9093
|
lastEventId,
|
|
9094
|
+
eventEpoch,
|
|
8520
9095
|
...page.partial === true ? { partial: true } : {},
|
|
8521
9096
|
...page.replayError !== void 0 ? { replayError: page.replayError } : {},
|
|
8522
9097
|
...page.hasMore ? { historyHasMore: true } : {}
|
|
@@ -8580,33 +9155,39 @@ function createAcpSessionBridge(opts) {
|
|
|
8580
9155
|
);
|
|
8581
9156
|
}
|
|
8582
9157
|
const historyReplay = action === "load" ? req.historyReplay ?? "stream" : "stream";
|
|
9158
|
+
const historyPageSize = action === "load" && historyReplay === "response" ? req.historyPageSize : void 0;
|
|
9159
|
+
if (historyPageSize !== void 0 && (!Number.isSafeInteger(historyPageSize) || historyPageSize < 1 || historyPageSize > SESSION_TRANSCRIPT_MAX_LIMIT)) {
|
|
9160
|
+
throw new Error(
|
|
9161
|
+
`Invalid historyPageSize; expected 1..${SESSION_TRANSCRIPT_MAX_LIMIT}`
|
|
9162
|
+
);
|
|
9163
|
+
}
|
|
8583
9164
|
const hideInheritedHistory = action === "load" && req.hideInheritedHistory === true;
|
|
8584
9165
|
const existing = byId.get(req.sessionId);
|
|
8585
9166
|
if (existing) {
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
req.sessionId,
|
|
8589
|
-
"The session is closing; retry after close completes",
|
|
8590
|
-
"session_closing"
|
|
8591
|
-
);
|
|
8592
|
-
}
|
|
8593
|
-
const replayFields = action === "load" && req.historyPageSize !== void 0 ? await refreshedReplayFieldsFor(existing, req.historyPageSize) : replayFieldsFor(existing, action);
|
|
9167
|
+
assertAttachableSessionEntry(req.sessionId, existing);
|
|
9168
|
+
const replayFields = historyPageSize !== void 0 ? await refreshedReplayFieldsFor(existing, historyPageSize) : replayFieldsFor(existing, action);
|
|
8594
9169
|
const historyAnchorRecordId = action === "load" ? await resolveHistoryAnchorRecordId(existing, replayFields) : void 0;
|
|
8595
|
-
|
|
8596
|
-
throw new SessionNotFoundError(req.sessionId);
|
|
8597
|
-
}
|
|
8598
|
-
if (isClosingOrAuthorizingClose(existing)) {
|
|
8599
|
-
throw new SessionNotFoundError(
|
|
8600
|
-
req.sessionId,
|
|
8601
|
-
"The session is closing; retry after close completes",
|
|
8602
|
-
"session_closing"
|
|
8603
|
-
);
|
|
8604
|
-
}
|
|
9170
|
+
assertAttachableSessionEntry(req.sessionId, existing);
|
|
8605
9171
|
existing.attachCount++;
|
|
8606
9172
|
const clientId = registerClient(existing, req.clientId);
|
|
8607
9173
|
recordAttachRef(existing, clientId);
|
|
8608
9174
|
if (req.approvalMode) {
|
|
8609
|
-
await applyApprovalModeForAttach(
|
|
9175
|
+
const previousApprovalMode = await applyApprovalModeForAttach(
|
|
9176
|
+
existing,
|
|
9177
|
+
req.approvalMode,
|
|
9178
|
+
clientId
|
|
9179
|
+
);
|
|
9180
|
+
try {
|
|
9181
|
+
assertAttachableSessionEntry(req.sessionId, existing);
|
|
9182
|
+
} catch (error) {
|
|
9183
|
+
await rollbackApprovalModeForRejectedAttach(
|
|
9184
|
+
existing,
|
|
9185
|
+
previousApprovalMode,
|
|
9186
|
+
clientId
|
|
9187
|
+
);
|
|
9188
|
+
await rollbackAttachRegistration(existing, clientId);
|
|
9189
|
+
throw error;
|
|
9190
|
+
}
|
|
8610
9191
|
}
|
|
8611
9192
|
return {
|
|
8612
9193
|
sessionId: existing.sessionId,
|
|
@@ -8630,7 +9211,7 @@ function createAcpSessionBridge(opts) {
|
|
|
8630
9211
|
}
|
|
8631
9212
|
const inFlight = inFlightRestores.get(req.sessionId);
|
|
8632
9213
|
if (inFlight) {
|
|
8633
|
-
if (inFlight.lifecycle.phase === "abandoned" || action !== inFlight.action || historyReplay !== inFlight.historyReplay || hideInheritedHistory !== inFlight.hideInheritedHistory) {
|
|
9214
|
+
if (inFlight.lifecycle.phase === "abandoned" || action !== inFlight.action || historyReplay !== inFlight.historyReplay || historyPageSize !== inFlight.historyPageSize || hideInheritedHistory !== inFlight.hideInheritedHistory) {
|
|
8634
9215
|
const abandoned = inFlight.lifecycle.phase === "abandoned";
|
|
8635
9216
|
throw new RestoreInProgressError(
|
|
8636
9217
|
req.sessionId,
|
|
@@ -8658,10 +9239,32 @@ function createAcpSessionBridge(opts) {
|
|
|
8658
9239
|
"the agent child likely crashed during session restore \u2014 retry to restore the session"
|
|
8659
9240
|
);
|
|
8660
9241
|
}
|
|
9242
|
+
try {
|
|
9243
|
+
assertAttachableSessionEntry(restored.sessionId, entry);
|
|
9244
|
+
} catch (error) {
|
|
9245
|
+
inFlight.coalesceState.count--;
|
|
9246
|
+
entry.attachCount = Math.max(0, entry.attachCount - 1);
|
|
9247
|
+
throw error;
|
|
9248
|
+
}
|
|
8661
9249
|
const clientId = registerClient(entry, req.clientId);
|
|
8662
9250
|
recordAttachRef(entry, clientId);
|
|
8663
9251
|
if (req.approvalMode) {
|
|
8664
|
-
await applyApprovalModeForAttach(
|
|
9252
|
+
const previousApprovalMode = await applyApprovalModeForAttach(
|
|
9253
|
+
entry,
|
|
9254
|
+
req.approvalMode,
|
|
9255
|
+
clientId
|
|
9256
|
+
);
|
|
9257
|
+
try {
|
|
9258
|
+
assertAttachableSessionEntry(restored.sessionId, entry);
|
|
9259
|
+
} catch (error) {
|
|
9260
|
+
await rollbackApprovalModeForRejectedAttach(
|
|
9261
|
+
entry,
|
|
9262
|
+
previousApprovalMode,
|
|
9263
|
+
clientId
|
|
9264
|
+
);
|
|
9265
|
+
await rollbackAttachRegistration(entry, clientId);
|
|
9266
|
+
throw error;
|
|
9267
|
+
}
|
|
8665
9268
|
}
|
|
8666
9269
|
return {
|
|
8667
9270
|
...restored,
|
|
@@ -8825,12 +9428,16 @@ function createAcpSessionBridge(opts) {
|
|
|
8825
9428
|
const promise = (async () => {
|
|
8826
9429
|
pendingRestoreEvents.set(req.sessionId, restoreEvents);
|
|
8827
9430
|
const restoreChannel = await ensureChannel();
|
|
9431
|
+
if (restoreChannel.isDying) {
|
|
9432
|
+
throw new BridgeChannelClosedError(`before session/${action}`);
|
|
9433
|
+
}
|
|
8828
9434
|
ci = restoreChannel;
|
|
8829
9435
|
restoreChannel.pendingRestoreIds.add(req.sessionId);
|
|
8830
9436
|
restoreChannel.client.markRestoreInFlight(req.sessionId);
|
|
8831
|
-
const transportClosed =
|
|
8832
|
-
|
|
8833
|
-
|
|
9437
|
+
const transportClosed = channelUnavailableReject(
|
|
9438
|
+
restoreChannel.channel,
|
|
9439
|
+
`during session/${action}`
|
|
9440
|
+
);
|
|
8834
9441
|
transportClosed.catch(() => {
|
|
8835
9442
|
});
|
|
8836
9443
|
let state;
|
|
@@ -8838,6 +9445,7 @@ function createAcpSessionBridge(opts) {
|
|
|
8838
9445
|
let replayPartial;
|
|
8839
9446
|
let replayError;
|
|
8840
9447
|
let replayHasMore;
|
|
9448
|
+
let replayAnchorRecordId;
|
|
8841
9449
|
try {
|
|
8842
9450
|
const rawRestore = telemetry.withSpan(
|
|
8843
9451
|
"session.restore",
|
|
@@ -8863,8 +9471,8 @@ function createAcpSessionBridge(opts) {
|
|
|
8863
9471
|
...sessionSourceRequestMeta(req.sourceType, req.sourceId),
|
|
8864
9472
|
...historyReplay === "response" ? {
|
|
8865
9473
|
[LOAD_REPLAY_MODE_META_KEY]: LOAD_REPLAY_BULK_MODE,
|
|
8866
|
-
...
|
|
8867
|
-
[LOAD_REPLAY_PAGE_SIZE_META_KEY]:
|
|
9474
|
+
...historyPageSize !== void 0 ? {
|
|
9475
|
+
[LOAD_REPLAY_PAGE_SIZE_META_KEY]: historyPageSize
|
|
8868
9476
|
} : {}
|
|
8869
9477
|
} : {},
|
|
8870
9478
|
...hideInheritedHistory ? { [LOAD_REPLAY_HIDE_INHERITED_META_KEY]: true } : {}
|
|
@@ -8948,6 +9556,7 @@ function createAcpSessionBridge(opts) {
|
|
|
8948
9556
|
replayPartial = extracted.partial;
|
|
8949
9557
|
replayError = extracted.replayError;
|
|
8950
9558
|
replayHasMore = extracted.hasMore === true ? true : void 0;
|
|
9559
|
+
replayAnchorRecordId = extracted.anchorRecordId;
|
|
8951
9560
|
}
|
|
8952
9561
|
} catch (err) {
|
|
8953
9562
|
if (err instanceof SessionRestoreTimeoutError) throw err;
|
|
@@ -8976,24 +9585,20 @@ function createAcpSessionBridge(opts) {
|
|
|
8976
9585
|
const racedEntry = byId.get(req.sessionId);
|
|
8977
9586
|
if (racedEntry) {
|
|
8978
9587
|
restoreEvents.close();
|
|
8979
|
-
|
|
8980
|
-
throw new SessionNotFoundError(
|
|
8981
|
-
req.sessionId,
|
|
8982
|
-
"The session is closing; retry after close completes",
|
|
8983
|
-
"session_closing"
|
|
8984
|
-
);
|
|
8985
|
-
}
|
|
9588
|
+
assertAttachableSessionEntry(req.sessionId, racedEntry);
|
|
8986
9589
|
racedEntry.attachCount += 1 + coalesceState.count;
|
|
8987
9590
|
const clientId2 = registerClient(racedEntry, req.clientId);
|
|
8988
9591
|
recordAttachRef(racedEntry, clientId2);
|
|
8989
9592
|
if (req.approvalMode) {
|
|
9593
|
+
let previousApprovalMode;
|
|
8990
9594
|
try {
|
|
8991
|
-
await applyApprovalMode(
|
|
9595
|
+
const result = await applyApprovalMode(
|
|
8992
9596
|
racedEntry,
|
|
8993
9597
|
req.approvalMode,
|
|
8994
9598
|
false,
|
|
8995
9599
|
clientId2
|
|
8996
9600
|
);
|
|
9601
|
+
previousApprovalMode = result.previous;
|
|
8997
9602
|
} catch (err) {
|
|
8998
9603
|
await rollbackAttachRegistration(
|
|
8999
9604
|
racedEntry,
|
|
@@ -9002,6 +9607,21 @@ function createAcpSessionBridge(opts) {
|
|
|
9002
9607
|
);
|
|
9003
9608
|
throw err;
|
|
9004
9609
|
}
|
|
9610
|
+
try {
|
|
9611
|
+
assertAttachableSessionEntry(req.sessionId, racedEntry);
|
|
9612
|
+
} catch (error) {
|
|
9613
|
+
await rollbackApprovalModeForRejectedAttach(
|
|
9614
|
+
racedEntry,
|
|
9615
|
+
previousApprovalMode,
|
|
9616
|
+
clientId2
|
|
9617
|
+
);
|
|
9618
|
+
await rollbackAttachRegistration(
|
|
9619
|
+
racedEntry,
|
|
9620
|
+
clientId2,
|
|
9621
|
+
1 + coalesceState.count
|
|
9622
|
+
);
|
|
9623
|
+
throw error;
|
|
9624
|
+
}
|
|
9005
9625
|
}
|
|
9006
9626
|
return {
|
|
9007
9627
|
sessionId: racedEntry.sessionId,
|
|
@@ -9045,6 +9665,9 @@ function createAcpSessionBridge(opts) {
|
|
|
9045
9665
|
if (replayHasMore === true) {
|
|
9046
9666
|
entry.restoreHistoryHasMore = true;
|
|
9047
9667
|
}
|
|
9668
|
+
if (replayAnchorRecordId !== void 0) {
|
|
9669
|
+
entry.restoreHistoryAnchorRecordId = replayAnchorRecordId;
|
|
9670
|
+
}
|
|
9048
9671
|
seedSnapshotCaches(entry, publicState);
|
|
9049
9672
|
const artifactRestoreWarnings = await entry.artifacts.restore(
|
|
9050
9673
|
restoredArtifactSnapshot
|
|
@@ -9063,14 +9686,16 @@ function createAcpSessionBridge(opts) {
|
|
|
9063
9686
|
await ci.client.seedSessionUpdates(entry, replayUpdates, {
|
|
9064
9687
|
ingestArtifacts: restoredArtifactSnapshot === void 0 || artifactRestoreFailed
|
|
9065
9688
|
});
|
|
9066
|
-
if (
|
|
9689
|
+
if (historyPageSize !== void 0 && entry.events.snapshotReplay()?.compactedTurns.some((event) => event.type === "history_truncated")) {
|
|
9067
9690
|
entry.restoreHistoryHasMore = true;
|
|
9068
9691
|
}
|
|
9069
9692
|
ci.client.drainEarlyEvents(entry.sessionId, entry);
|
|
9070
9693
|
}
|
|
9694
|
+
assertAttachableSessionEntry(req.sessionId, entry);
|
|
9071
9695
|
const clientId = registerClient(entry, req.clientId);
|
|
9072
9696
|
if (req.approvalMode) {
|
|
9073
9697
|
await applyApprovalModeForAttach(entry, req.approvalMode, clientId);
|
|
9698
|
+
assertAttachableSessionEntry(req.sessionId, entry);
|
|
9074
9699
|
}
|
|
9075
9700
|
entry.attachCount = coalesceState.count;
|
|
9076
9701
|
registeredEntry = entry;
|
|
@@ -9147,6 +9772,7 @@ function createAcpSessionBridge(opts) {
|
|
|
9147
9772
|
inFlightRestores.set(req.sessionId, {
|
|
9148
9773
|
action,
|
|
9149
9774
|
historyReplay,
|
|
9775
|
+
...historyPageSize !== void 0 ? { historyPageSize } : {},
|
|
9150
9776
|
hideInheritedHistory,
|
|
9151
9777
|
publicPromise: promise,
|
|
9152
9778
|
settlementPromise,
|
|
@@ -9192,15 +9818,21 @@ function createAcpSessionBridge(opts) {
|
|
|
9192
9818
|
`qwen serve: closeSession channelInfoForEntry returned undefined for session ${JSON.stringify(sessionId)} \u2014 channel cleanup skipped (entry's channel already torn down)`
|
|
9193
9819
|
);
|
|
9194
9820
|
}
|
|
9821
|
+
let agentSessionClosed = false;
|
|
9195
9822
|
try {
|
|
9196
9823
|
permissionMediator.forgetSession(sessionId);
|
|
9197
9824
|
entry.pendingPermissionIds.clear();
|
|
9198
9825
|
entry.pendingInteractions.clear();
|
|
9199
|
-
await notifyAgentSessionClose(
|
|
9200
|
-
|
|
9201
|
-
|
|
9202
|
-
|
|
9203
|
-
|
|
9826
|
+
agentSessionClosed = await notifyAgentSessionClose(
|
|
9827
|
+
entry,
|
|
9828
|
+
ci,
|
|
9829
|
+
"closeSession",
|
|
9830
|
+
{
|
|
9831
|
+
throwOnFailure: true,
|
|
9832
|
+
requireFlush: closeOpts?.requireAgentClose === true,
|
|
9833
|
+
...closeOpts?.agentCloseTimeoutMs !== void 0 ? { timeoutMs: closeOpts.agentCloseTimeoutMs } : {}
|
|
9834
|
+
}
|
|
9835
|
+
);
|
|
9204
9836
|
} catch (error) {
|
|
9205
9837
|
if (isDefinitiveAcpRequestError(error)) {
|
|
9206
9838
|
entry.closing = false;
|
|
@@ -9254,16 +9886,18 @@ function createAcpSessionBridge(opts) {
|
|
|
9254
9886
|
} catch {
|
|
9255
9887
|
}
|
|
9256
9888
|
entry.events.close();
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
|
|
9889
|
+
if (!agentSessionClosed) {
|
|
9890
|
+
try {
|
|
9891
|
+
await telemetry.withSpan(
|
|
9892
|
+
"session.close.cancel_active_prompt",
|
|
9893
|
+
{
|
|
9894
|
+
"qwen-code.daemon.bridge.operation": "session.close.cancel_active_prompt",
|
|
9895
|
+
"session.id": sessionId
|
|
9896
|
+
},
|
|
9897
|
+
async () => await entry.connection.cancel({ sessionId })
|
|
9898
|
+
);
|
|
9899
|
+
} catch {
|
|
9900
|
+
}
|
|
9267
9901
|
}
|
|
9268
9902
|
if (ci && hasNoChannelWork(ci)) {
|
|
9269
9903
|
await reapPendingEmptyChannel(ci);
|
|
@@ -9323,6 +9957,10 @@ function createAcpSessionBridge(opts) {
|
|
|
9323
9957
|
compactedReplayMaxBytes,
|
|
9324
9958
|
maxJournalEvents,
|
|
9325
9959
|
maxJournalBytes,
|
|
9960
|
+
journalGrowth: journalGrowthPoolBytes !== void 0 ? {
|
|
9961
|
+
poolBytes: journalGrowthPoolBytes,
|
|
9962
|
+
hardCapBytes: JOURNAL_GROWTH_HARD_CAP_BYTES
|
|
9963
|
+
} : null,
|
|
9326
9964
|
channelIdleTimeoutMs: resolvedChannelIdleTimeoutMs(),
|
|
9327
9965
|
sessionIdleTimeoutMs
|
|
9328
9966
|
},
|
|
@@ -9330,22 +9968,27 @@ function createAcpSessionBridge(opts) {
|
|
|
9330
9968
|
pendingPermissionCount: permissionMediator.pendingCount,
|
|
9331
9969
|
channelLive: !!liveChannelInfo(),
|
|
9332
9970
|
permissionPolicy: permissionMediator.policy,
|
|
9333
|
-
sessions: [...byId.values()].map((entry) =>
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
|
|
9337
|
-
|
|
9338
|
-
|
|
9339
|
-
|
|
9340
|
-
|
|
9341
|
-
|
|
9342
|
-
|
|
9343
|
-
|
|
9344
|
-
|
|
9345
|
-
|
|
9346
|
-
|
|
9347
|
-
|
|
9348
|
-
|
|
9971
|
+
sessions: [...byId.values()].map((entry) => {
|
|
9972
|
+
const journalLimits = entry.events.journalLimits();
|
|
9973
|
+
return {
|
|
9974
|
+
sessionId: entry.sessionId,
|
|
9975
|
+
workspaceCwd: entry.workspaceCwd,
|
|
9976
|
+
createdAt: entry.createdAt,
|
|
9977
|
+
...entry.displayName ? { displayName: entry.displayName } : {},
|
|
9978
|
+
clientCount: entry.clientIds.size,
|
|
9979
|
+
subscriberCount: entry.events.subscriberCount,
|
|
9980
|
+
attachCount: entry.attachCount,
|
|
9981
|
+
pendingPromptCount: entry.pendingPromptCount,
|
|
9982
|
+
pendingPermissionCount: entry.pendingPermissionIds.size,
|
|
9983
|
+
hasActivePrompt: entry.promptActive,
|
|
9984
|
+
lastEventId: entry.events.lastEventId,
|
|
9985
|
+
...entry.sessionLastSeenAt !== void 0 ? { lastSeenAt: entry.sessionLastSeenAt } : {},
|
|
9986
|
+
...entry.currentModelId ? { currentModelId: entry.currentModelId } : {},
|
|
9987
|
+
...entry.currentApprovalMode ? { currentApprovalMode: entry.currentApprovalMode } : {},
|
|
9988
|
+
maxJournalEvents: journalLimits?.maxEvents ?? maxJournalEvents,
|
|
9989
|
+
maxJournalBytes: journalLimits?.maxBytes ?? maxJournalBytes
|
|
9990
|
+
};
|
|
9991
|
+
})
|
|
9349
9992
|
};
|
|
9350
9993
|
},
|
|
9351
9994
|
get sessionCount() {
|
|
@@ -9447,13 +10090,7 @@ function createAcpSessionBridge(opts) {
|
|
|
9447
10090
|
if (effectiveScope === "single") {
|
|
9448
10091
|
const existing = defaultEntry;
|
|
9449
10092
|
if (existing) {
|
|
9450
|
-
|
|
9451
|
-
throw new SessionNotFoundError(
|
|
9452
|
-
existing.sessionId,
|
|
9453
|
-
"The session is closing; retry after close completes",
|
|
9454
|
-
"session_closing"
|
|
9455
|
-
);
|
|
9456
|
-
}
|
|
10093
|
+
assertAttachableSessionEntry(existing.sessionId, existing);
|
|
9457
10094
|
existing.attachCount++;
|
|
9458
10095
|
const clientId = registerClient(existing, req.clientId);
|
|
9459
10096
|
recordAttachRef(existing, clientId);
|
|
@@ -9466,13 +10103,27 @@ function createAcpSessionBridge(opts) {
|
|
|
9466
10103
|
).catch(() => {
|
|
9467
10104
|
});
|
|
9468
10105
|
}
|
|
10106
|
+
let previousApprovalMode;
|
|
9469
10107
|
if (req.approvalMode) {
|
|
9470
|
-
await applyApprovalModeForAttach(
|
|
10108
|
+
previousApprovalMode = await applyApprovalModeForAttach(
|
|
9471
10109
|
existing,
|
|
9472
10110
|
req.approvalMode,
|
|
9473
10111
|
clientId
|
|
9474
10112
|
);
|
|
9475
10113
|
}
|
|
10114
|
+
try {
|
|
10115
|
+
assertAttachableSessionEntry(existing.sessionId, existing);
|
|
10116
|
+
} catch (error) {
|
|
10117
|
+
if (previousApprovalMode !== void 0) {
|
|
10118
|
+
await rollbackApprovalModeForRejectedAttach(
|
|
10119
|
+
existing,
|
|
10120
|
+
previousApprovalMode,
|
|
10121
|
+
clientId
|
|
10122
|
+
);
|
|
10123
|
+
}
|
|
10124
|
+
await rollbackAttachRegistration(existing, clientId);
|
|
10125
|
+
throw error;
|
|
10126
|
+
}
|
|
9476
10127
|
return {
|
|
9477
10128
|
sessionId: existing.sessionId,
|
|
9478
10129
|
workspaceCwd: existing.workspaceCwd,
|
|
@@ -9489,13 +10140,14 @@ function createAcpSessionBridge(opts) {
|
|
|
9489
10140
|
if (inFlight) {
|
|
9490
10141
|
const session = await inFlight;
|
|
9491
10142
|
const attachedEntry = byId.get(session.sessionId);
|
|
9492
|
-
if (attachedEntry) attachedEntry.attachCount++;
|
|
9493
10143
|
if (!attachedEntry) {
|
|
9494
10144
|
throw new SessionNotFoundError(
|
|
9495
10145
|
session.sessionId,
|
|
9496
10146
|
"the agent child likely crashed during initialization \u2014 retry to spawn a new session"
|
|
9497
10147
|
);
|
|
9498
10148
|
}
|
|
10149
|
+
assertAttachableSessionEntry(session.sessionId, attachedEntry);
|
|
10150
|
+
attachedEntry.attachCount++;
|
|
9499
10151
|
const clientId = registerClient(attachedEntry, req.clientId);
|
|
9500
10152
|
recordAttachRef(attachedEntry, clientId);
|
|
9501
10153
|
if (req.modelServiceId) {
|
|
@@ -9507,13 +10159,27 @@ function createAcpSessionBridge(opts) {
|
|
|
9507
10159
|
).catch(() => {
|
|
9508
10160
|
});
|
|
9509
10161
|
}
|
|
10162
|
+
let previousApprovalMode;
|
|
9510
10163
|
if (req.approvalMode) {
|
|
9511
|
-
await applyApprovalModeForAttach(
|
|
10164
|
+
previousApprovalMode = await applyApprovalModeForAttach(
|
|
9512
10165
|
attachedEntry,
|
|
9513
10166
|
req.approvalMode,
|
|
9514
10167
|
clientId
|
|
9515
10168
|
);
|
|
9516
10169
|
}
|
|
10170
|
+
try {
|
|
10171
|
+
assertAttachableSessionEntry(session.sessionId, attachedEntry);
|
|
10172
|
+
} catch (error) {
|
|
10173
|
+
if (previousApprovalMode !== void 0) {
|
|
10174
|
+
await rollbackApprovalModeForRejectedAttach(
|
|
10175
|
+
attachedEntry,
|
|
10176
|
+
previousApprovalMode,
|
|
10177
|
+
clientId
|
|
10178
|
+
);
|
|
10179
|
+
}
|
|
10180
|
+
await rollbackAttachRegistration(attachedEntry, clientId);
|
|
10181
|
+
throw error;
|
|
10182
|
+
}
|
|
9517
10183
|
return {
|
|
9518
10184
|
...session,
|
|
9519
10185
|
attached: true,
|
|
@@ -9662,12 +10328,19 @@ function createAcpSessionBridge(opts) {
|
|
|
9662
10328
|
);
|
|
9663
10329
|
}
|
|
9664
10330
|
}
|
|
10331
|
+
const channelDisplayText = getChannelPromptDisplayText(
|
|
10332
|
+
entry,
|
|
10333
|
+
context?.promptDisplayText
|
|
10334
|
+
);
|
|
10335
|
+
const pendingText = channelDisplayText === void 0 ? extractPromptText(req.prompt) : channelDisplayText || (req.prompt.some(
|
|
10336
|
+
(block) => isRecord3(block) && block["type"] === "image"
|
|
10337
|
+
) ? "[image]" : "");
|
|
9665
10338
|
const pendingEntry = {
|
|
9666
10339
|
promptId,
|
|
9667
10340
|
queuedAt,
|
|
9668
10341
|
...originatorClientId !== void 0 ? { originatorClientId } : {},
|
|
9669
10342
|
...isPromotedMidTurn ? { promotedMidTurn: true } : {},
|
|
9670
|
-
text:
|
|
10343
|
+
text: pendingText,
|
|
9671
10344
|
abortController: pendingAbort,
|
|
9672
10345
|
state: isQueued ? "queued" : "running"
|
|
9673
10346
|
};
|
|
@@ -9805,11 +10478,13 @@ function createAcpSessionBridge(opts) {
|
|
|
9805
10478
|
delete copy.retry;
|
|
9806
10479
|
delete copy.delivery;
|
|
9807
10480
|
const meta = copy._meta && typeof copy._meta === "object" ? { ...copy._meta } : {};
|
|
10481
|
+
const promptDisplayText = channelDisplayText;
|
|
9808
10482
|
delete meta[DAEMON_RETRY_META_KEY];
|
|
9809
10483
|
delete meta[INVOCATION_CONTEXT_META_KEY];
|
|
9810
10484
|
delete meta[PRIVATE_PARENT_CAPABILITY_META_KEY];
|
|
9811
10485
|
delete meta[DAEMON_CONTINUE_META_KEY];
|
|
9812
10486
|
delete meta[DAEMON_CHANNEL_DELIVERY_META_KEY];
|
|
10487
|
+
delete meta[DAEMON_PROMPT_DISPLAY_TEXT_META_KEY];
|
|
9813
10488
|
delete meta[DAEMON_MODEL_PROMPT_META_KEY];
|
|
9814
10489
|
if (isRetry) {
|
|
9815
10490
|
meta[DAEMON_RETRY_META_KEY] = true;
|
|
@@ -9820,6 +10495,9 @@ function createAcpSessionBridge(opts) {
|
|
|
9820
10495
|
if (context?.channelDelivery) {
|
|
9821
10496
|
meta[DAEMON_CHANNEL_DELIVERY_META_KEY] = context.channelDelivery;
|
|
9822
10497
|
}
|
|
10498
|
+
if (promptDisplayText !== void 0) {
|
|
10499
|
+
meta[DAEMON_PROMPT_DISPLAY_TEXT_META_KEY] = promptDisplayText;
|
|
10500
|
+
}
|
|
9823
10501
|
if (modelPrompt !== void 0) {
|
|
9824
10502
|
meta[DAEMON_MODEL_PROMPT_META_KEY] = modelPrompt;
|
|
9825
10503
|
}
|
|
@@ -9849,7 +10527,8 @@ function createAcpSessionBridge(opts) {
|
|
|
9849
10527
|
entry,
|
|
9850
10528
|
promptRequest,
|
|
9851
10529
|
pendingEntry.promptId,
|
|
9852
|
-
originatorClientId
|
|
10530
|
+
originatorClientId,
|
|
10531
|
+
channelDisplayText
|
|
9853
10532
|
);
|
|
9854
10533
|
}
|
|
9855
10534
|
} catch (echoErr) {
|
|
@@ -10208,16 +10887,20 @@ function createAcpSessionBridge(opts) {
|
|
|
10208
10887
|
releaseFreshSessionReservation(admission);
|
|
10209
10888
|
}, "releaseAdmissionOnce");
|
|
10210
10889
|
try {
|
|
10211
|
-
|
|
10890
|
+
assertLivePromptEntry(sessionId, entry);
|
|
10891
|
+
const ci = channelInfoForEntry(entry);
|
|
10212
10892
|
const result = await withTimeout(
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
|
|
10217
|
-
|
|
10218
|
-
|
|
10219
|
-
|
|
10220
|
-
|
|
10893
|
+
Promise.race([
|
|
10894
|
+
ci.connection.extMethod(
|
|
10895
|
+
isSideTask ? SERVE_CONTROL_EXT_METHODS.sessionSideTask : SERVE_CONTROL_EXT_METHODS.sessionBranch,
|
|
10896
|
+
{
|
|
10897
|
+
sessionId,
|
|
10898
|
+
cwd: boundWorkspace,
|
|
10899
|
+
name: req.name
|
|
10900
|
+
}
|
|
10901
|
+
),
|
|
10902
|
+
getTransportClosedReject(entry)
|
|
10903
|
+
]),
|
|
10221
10904
|
initTimeoutMs,
|
|
10222
10905
|
isSideTask ? "createSideTaskSession" : "branchSession"
|
|
10223
10906
|
);
|
|
@@ -10253,10 +10936,25 @@ function createAcpSessionBridge(opts) {
|
|
|
10253
10936
|
`qwen serve: branchSession load failed for ${result.newSessionId}, attempting cleanup...`
|
|
10254
10937
|
);
|
|
10255
10938
|
try {
|
|
10256
|
-
|
|
10257
|
-
|
|
10258
|
-
|
|
10259
|
-
|
|
10939
|
+
if (!ci.isDying) {
|
|
10940
|
+
await withTimeout(
|
|
10941
|
+
Promise.race([
|
|
10942
|
+
ci.connection.extMethod(
|
|
10943
|
+
SERVE_CONTROL_EXT_METHODS.sessionClose,
|
|
10944
|
+
{
|
|
10945
|
+
sessionId: result.newSessionId,
|
|
10946
|
+
cwd: boundWorkspace
|
|
10947
|
+
}
|
|
10948
|
+
),
|
|
10949
|
+
channelUnavailableReject(
|
|
10950
|
+
ci.channel,
|
|
10951
|
+
"during branchSession cleanup"
|
|
10952
|
+
)
|
|
10953
|
+
]),
|
|
10954
|
+
initTimeoutMs,
|
|
10955
|
+
"branchSession cleanup"
|
|
10956
|
+
);
|
|
10957
|
+
}
|
|
10260
10958
|
} catch (cleanupErr) {
|
|
10261
10959
|
writeStderrLine(
|
|
10262
10960
|
`qwen serve: branchSession cleanup of ${result.newSessionId} failed: ${cleanupErr instanceof Error ? cleanupErr.message : cleanupErr}`
|
|
@@ -10352,16 +11050,16 @@ function createAcpSessionBridge(opts) {
|
|
|
10352
11050
|
if (entry.promptActive) {
|
|
10353
11051
|
throw new CdWhilePromptActiveError(sessionId);
|
|
10354
11052
|
}
|
|
10355
|
-
|
|
10356
|
-
const raw = await
|
|
10357
|
-
SERVE_CONTROL_EXT_METHODS.sessionCd,
|
|
10358
|
-
{
|
|
11053
|
+
assertLivePromptEntry(sessionId, entry);
|
|
11054
|
+
const raw = await Promise.race([
|
|
11055
|
+
entry.connection.extMethod(SERVE_CONTROL_EXT_METHODS.sessionCd, {
|
|
10359
11056
|
sessionId,
|
|
10360
11057
|
path: req.path,
|
|
10361
11058
|
...req.allowedRoots ? { allowedRoots: req.allowedRoots } : {},
|
|
10362
11059
|
...req.managedRelocation ? { managedRelocation: req.managedRelocation } : {}
|
|
10363
|
-
}
|
|
10364
|
-
|
|
11060
|
+
}),
|
|
11061
|
+
getTransportClosedReject(entry)
|
|
11062
|
+
]);
|
|
10365
11063
|
const extResult = raw;
|
|
10366
11064
|
if (typeof extResult?.previousCwd !== "string" || typeof extResult?.newCwd !== "string" || !Array.isArray(extResult?.warnings)) {
|
|
10367
11065
|
throw new Error(
|
|
@@ -10894,6 +11592,7 @@ function createAcpSessionBridge(opts) {
|
|
|
10894
11592
|
const bootstrapRefreshConnections = /* @__PURE__ */ new Set();
|
|
10895
11593
|
const refreshSession = /* @__PURE__ */ __name(async (entry, refreshBootstrap) => {
|
|
10896
11594
|
let inFlight = inFlightExtensionRefreshes.get(entry.sessionId);
|
|
11595
|
+
let created = false;
|
|
10897
11596
|
if (!inFlight || inFlight.connection !== entry.connection || refreshBootstrap && !inFlight.refreshBootstrap) {
|
|
10898
11597
|
const promise = (async () => {
|
|
10899
11598
|
await entry.connection.extMethod(
|
|
@@ -10904,27 +11603,36 @@ function createAcpSessionBridge(opts) {
|
|
|
10904
11603
|
}
|
|
10905
11604
|
);
|
|
10906
11605
|
})();
|
|
11606
|
+
let rejectUnavailable;
|
|
11607
|
+
const unavailable = new Promise((_resolve, reject) => {
|
|
11608
|
+
rejectUnavailable = /* @__PURE__ */ __name(() => reject(
|
|
11609
|
+
new BridgeChannelClosedError("refreshExtensionsForAllSessions")
|
|
11610
|
+
), "rejectUnavailable");
|
|
11611
|
+
});
|
|
10907
11612
|
inFlight = {
|
|
10908
11613
|
connection: entry.connection,
|
|
10909
11614
|
promise,
|
|
11615
|
+
wait: Promise.race([
|
|
11616
|
+
withTimeout(
|
|
11617
|
+
promise,
|
|
11618
|
+
3e4,
|
|
11619
|
+
SERVE_CONTROL_EXT_METHODS.workspaceExtensionsRefresh
|
|
11620
|
+
),
|
|
11621
|
+
unavailable
|
|
11622
|
+
]),
|
|
11623
|
+
rejectUnavailable,
|
|
10910
11624
|
refreshBootstrap
|
|
10911
11625
|
};
|
|
10912
11626
|
inFlightExtensionRefreshes.set(entry.sessionId, inFlight);
|
|
10913
|
-
|
|
10914
|
-
if (inFlightExtensionRefreshes.get(entry.sessionId) === inFlight) {
|
|
10915
|
-
inFlightExtensionRefreshes.delete(entry.sessionId);
|
|
10916
|
-
}
|
|
10917
|
-
}, "clear");
|
|
10918
|
-
void promise.then(clear, clear);
|
|
11627
|
+
created = true;
|
|
10919
11628
|
}
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
|
|
10925
|
-
|
|
10926
|
-
|
|
10927
|
-
]);
|
|
11629
|
+
const clear = /* @__PURE__ */ __name(() => {
|
|
11630
|
+
if (inFlightExtensionRefreshes.get(entry.sessionId) === inFlight) {
|
|
11631
|
+
inFlightExtensionRefreshes.delete(entry.sessionId);
|
|
11632
|
+
}
|
|
11633
|
+
}, "clear");
|
|
11634
|
+
if (created) void inFlight.promise.then(clear, clear);
|
|
11635
|
+
await inFlight.wait;
|
|
10928
11636
|
}, "refreshSession");
|
|
10929
11637
|
const results = await Promise.all(
|
|
10930
11638
|
sessions.map(async (entry) => {
|
|
@@ -11051,6 +11759,29 @@ function createAcpSessionBridge(opts) {
|
|
|
11051
11759
|
}
|
|
11052
11760
|
return response;
|
|
11053
11761
|
},
|
|
11762
|
+
async setSessionConfigOption(sessionId, req) {
|
|
11763
|
+
const entry = byId.get(sessionId);
|
|
11764
|
+
if (!entry) throw new SessionNotFoundError(sessionId);
|
|
11765
|
+
const info = channelInfoForEntry(entry);
|
|
11766
|
+
if (!info || info.isDying) throw new SessionNotFoundError(sessionId);
|
|
11767
|
+
const normalized = { ...req, sessionId };
|
|
11768
|
+
const transportClosed = getTransportClosedReject(entry);
|
|
11769
|
+
const work = entry.modelChangeQueue.then(
|
|
11770
|
+
() => Promise.race([
|
|
11771
|
+
withTimeout(
|
|
11772
|
+
entry.connection.setSessionConfigOption(normalized),
|
|
11773
|
+
initTimeoutMs,
|
|
11774
|
+
"setSessionConfigOption"
|
|
11775
|
+
),
|
|
11776
|
+
transportClosed
|
|
11777
|
+
])
|
|
11778
|
+
);
|
|
11779
|
+
entry.modelChangeQueue = work.then(
|
|
11780
|
+
() => void 0,
|
|
11781
|
+
() => void 0
|
|
11782
|
+
);
|
|
11783
|
+
return await work;
|
|
11784
|
+
},
|
|
11054
11785
|
async setSessionLanguage(sessionId, params, context) {
|
|
11055
11786
|
const entry = byId.get(sessionId);
|
|
11056
11787
|
if (!entry) throw new SessionNotFoundError(sessionId);
|
|
@@ -11659,9 +12390,16 @@ function createAcpSessionBridge(opts) {
|
|
|
11659
12390
|
});
|
|
11660
12391
|
const historyOutput = output.length > MAX_SHELL_OUTPUT_FOR_HISTORY ? output.substring(0, MAX_SHELL_OUTPUT_FOR_HISTORY) + "\n... (truncated)" : output;
|
|
11661
12392
|
try {
|
|
11662
|
-
await
|
|
11663
|
-
|
|
11664
|
-
|
|
12393
|
+
await withTimeout(
|
|
12394
|
+
Promise.race([
|
|
12395
|
+
entry.connection.extMethod(
|
|
12396
|
+
SERVE_CONTROL_EXT_METHODS.sessionShellHistory,
|
|
12397
|
+
{ sessionId, command, output: historyOutput, exitCode }
|
|
12398
|
+
),
|
|
12399
|
+
getTransportClosedReject(entry)
|
|
12400
|
+
]),
|
|
12401
|
+
initTimeoutMs,
|
|
12402
|
+
"sessionShellHistory"
|
|
11665
12403
|
);
|
|
11666
12404
|
} catch (err) {
|
|
11667
12405
|
writeServeDebugLine(
|
|
@@ -12226,6 +12964,7 @@ function createAcpSessionBridge(opts) {
|
|
|
12226
12964
|
});
|
|
12227
12965
|
void (async () => {
|
|
12228
12966
|
shuttingDown = true;
|
|
12967
|
+
unregisterJournalGrowthSessionLimits?.();
|
|
12229
12968
|
cancelIdleTimer();
|
|
12230
12969
|
stopSessionReaper();
|
|
12231
12970
|
const entries = Array.from(byId.values());
|