@qwen-code/qwen-code 0.21.13 → 0.21.14-nightly.20260822.7a4566cb3b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/qc-helper/docs/configuration/settings.md +15 -7
- package/bundled/qc-helper/docs/extension/introduction.md +2 -0
- package/bundled/qc-helper/docs/features/_meta.ts +1 -0
- package/bundled/qc-helper/docs/features/channels/dingtalk.md +1 -1
- package/bundled/qc-helper/docs/features/code-review.md +25 -3
- package/bundled/qc-helper/docs/features/commands.md +120 -8
- package/bundled/qc-helper/docs/features/markdown-rendering.md +6 -0
- package/bundled/qc-helper/docs/features/sub-agents.md +3 -3
- package/bundled/qc-helper/docs/features/terminal-images.md +50 -0
- package/bundled/qc-helper/docs/qwen-serve-deploy-local.md +1 -1
- package/bundled/qc-helper/docs/qwen-serve.md +21 -4
- package/bundled/review/SKILL.md +113 -62
- package/chunks/MaxSizedBox-NCWYES5B.js +98 -0
- package/chunks/{StandaloneSessionPicker-KEGXNUG6.js → StandaloneSessionPicker-A4V4F64Y.js} +80 -79
- package/chunks/{acp-startup-profiler-NMDXYGDN.js → acp-startup-profiler-DDVSJKJK.js} +2 -2
- package/chunks/{acpAgent-XPES32S7.js → acpAgent-YYRH7HTQ.js} +1094 -278
- package/chunks/{agent-DPTOZFEM.js → agent-NEM254CJ.js} +52 -51
- package/chunks/agent-headless-AVFYIRPV.js +88 -0
- package/chunks/{anthropicContentGenerator-G7BVXTKN.js → anthropicContentGenerator-IWFTSBSV.js} +25 -25
- package/chunks/{artifact-tool-GEXTOPVO.js → artifact-tool-SBXMTVCB.js} +3 -3
- package/chunks/{askUserQuestion-B33XRSB7.js → askUserQuestion-KEQJRFD6.js} +3 -3
- package/chunks/{bridge-YNQBAA4Z.js → bridge-2CGOUO25.js} +59 -57
- package/chunks/{ca-4CQ6MYNQ.js → ca-SLZJD6QH.js} +8 -0
- package/chunks/{channel-management-service-GWY2GAIC.js → channel-management-service-FUJ2EFTF.js} +1 -1
- package/chunks/channel-settings-store-AZKNHHDC.js +103 -0
- package/chunks/{channel-worker-group-7LXCMZ77.js → channel-worker-group-CTE54QL6.js} +8 -7
- package/chunks/{channel-worker-manager-RYEME4ZZ.js → channel-worker-manager-4EHTD3T4.js} +8 -7
- package/chunks/{channel-worker-supervisor-OEVWBHGT.js → channel-worker-supervisor-F6I6WSWW.js} +6 -5
- package/chunks/{chunk-KD5BOPLP.js → chunk-2G4QF4VI.js} +125 -31
- package/chunks/{chunk-BHILXOC3.js → chunk-2MTIAN5Z.js} +3 -3
- package/chunks/{chunk-A4QRWUDE.js → chunk-2NWPB6T4.js} +6 -6
- package/chunks/{chunk-KV27IEHM.js → chunk-2TRNCJK4.js} +1 -1
- package/chunks/{chunk-EL5SXY3T.js → chunk-32CHFLGV.js} +198 -23
- package/chunks/{chunk-5CVO7YES.js → chunk-36OF5PRW.js} +1 -1
- package/chunks/{chunk-X26JYGTD.js → chunk-37BZSWEV.js} +1 -1
- package/chunks/{chunk-WFSTRPRO.js → chunk-3CLIDIVQ.js} +3 -3
- package/chunks/{chunk-A267JX7H.js → chunk-3HWN4E7N.js} +18 -18
- package/chunks/{chunk-ZYYTZUI2.js → chunk-3LYGXZ2H.js} +3 -3
- package/chunks/chunk-3SIGAHUX.js +3969 -0
- package/chunks/{chunk-BVJS5BSP.js → chunk-3XD4PT3B.js} +1 -1
- package/chunks/{chunk-6QFDQMQX.js → chunk-3ZFJUBTP.js} +1 -1
- package/chunks/{chunk-HUTNYWBG.js → chunk-45UD2TU4.js} +19 -11
- package/chunks/{chunk-4W5U2TUT.js → chunk-4F5WV4RF.js} +4 -4
- package/chunks/{chunk-I3G5JWBV.js → chunk-4GP3MNQ2.js} +2695 -1524
- package/chunks/{chunk-V26NVGAU.js → chunk-4MIDDJLJ.js} +8 -3
- package/chunks/{chunk-TS6625XH.js → chunk-5MK45KZ3.js} +9 -5
- package/chunks/{chunk-V57QC6WW.js → chunk-5OTMZVPL.js} +11 -9
- package/chunks/{chunk-MC4TLKEI.js → chunk-5PHLBWBL.js} +3 -3
- package/chunks/chunk-64LXOKG4.js +367 -0
- package/chunks/{chunk-6HY6IF3Z.js → chunk-6NFAEG54.js} +22 -2
- package/chunks/{chunk-TIGA2IVL.js → chunk-6NJIPX6W.js} +10 -298
- package/chunks/{chunk-MRMJCLIY.js → chunk-6RB2S4QP.js} +3 -3
- package/chunks/chunk-6S2OXVJT.js +369 -0
- package/chunks/{chunk-O4D7SPJN.js → chunk-6U46RZ25.js} +3 -3
- package/chunks/{chunk-JOOFMXGF.js → chunk-6UDHEIUT.js} +6 -6
- package/chunks/{chunk-VOQXFAY5.js → chunk-74TONY4F.js} +286 -0
- package/chunks/{chunk-LJQAUZMR.js → chunk-7CPJMZVJ.js} +1627 -180
- package/chunks/{chunk-T3CHYWJZ.js → chunk-7E7UCJHS.js} +100 -4
- package/chunks/{chunk-YZHRN3CF.js → chunk-7IV52LTO.js} +2 -2
- package/chunks/{chunk-4PKCUT7F.js → chunk-7JDGSJQH.js} +7 -7
- package/chunks/{chunk-GO7STP6N.js → chunk-7VITNOH6.js} +4 -4
- package/chunks/{chunk-CU6GJD55.js → chunk-7WLFSDLG.js} +1 -1
- package/chunks/{chunk-4WKAA4KS.js → chunk-A4N4FTMH.js} +1 -11
- package/chunks/{chunk-BUQDLC2G.js → chunk-A5F2YNO6.js} +3 -3
- package/chunks/{chunk-OY5RNSV4.js → chunk-AGCLK4G7.js} +3 -3
- package/chunks/{chunk-IA2K2HJE.js → chunk-AP3B7LKD.js} +2 -2
- package/chunks/{chunk-Y3YCSWG5.js → chunk-AZF6SME3.js} +2 -2
- package/chunks/{chunk-QFJ5JHQR.js → chunk-C72BXMJ5.js} +1 -1
- package/chunks/chunk-CETB5XY4.js +3654 -0
- package/chunks/{chunk-AA2BEKV3.js → chunk-CTAP6PO3.js} +3 -3
- package/chunks/{chunk-MS7GNABG.js → chunk-CXJHQVEK.js} +8 -0
- package/chunks/{chunk-QF2NHSPB.js → chunk-D534POS2.js} +274 -225
- package/chunks/{chunk-UKMR3CKV.js → chunk-D7QQ6RUB.js} +24 -9
- package/chunks/{chunk-DXIBNLBZ.js → chunk-DB2OKNTU.js} +2 -2
- package/chunks/{chunk-DGZEMW5R.js → chunk-DJEHYM4H.js} +3 -3
- package/chunks/{chunk-O565M6A4.js → chunk-DRVS6K7A.js} +260 -16
- package/chunks/{chunk-U3VNBPUO.js → chunk-DV4375RD.js} +5 -5
- package/chunks/{chunk-OXCMMLED.js → chunk-E63A23D7.js} +3 -3
- package/chunks/{chunk-4NFY2S7N.js → chunk-E7REAOTN.js} +15 -0
- package/chunks/{chunk-6ORZ2EDC.js → chunk-EW2IQ3ID.js} +3 -3
- package/chunks/{chunk-DGK6P3BQ.js → chunk-EXVK5R7X.js} +13 -13
- package/chunks/{chunk-NWNEANAT.js → chunk-FOGQO4FG.js} +953 -660
- package/chunks/{chunk-3U3VAL47.js → chunk-FV6PXZRO.js} +1 -1
- package/chunks/{chunk-76J3IJ3M.js → chunk-FX5TGHDE.js} +8 -8
- package/chunks/{chunk-QIH2HAEN.js → chunk-GXG4PYQB.js} +1 -1
- package/chunks/{chunk-FDGGZIYW.js → chunk-HDKCKCYO.js} +3 -3
- package/chunks/{chunk-RIAABG2K.js → chunk-HERHU33B.js} +2 -2
- package/chunks/{chunk-ZYBBISBY.js → chunk-HETN3NE2.js} +18 -15
- package/chunks/{chunk-XIT3GURH.js → chunk-HGBACZGD.js} +3 -3
- package/chunks/{chunk-UZPM4XHR.js → chunk-HGH7DXNI.js} +29 -8
- package/chunks/{chunk-CHHABXPE.js → chunk-HIK2OF33.js} +1 -1
- package/chunks/{chunk-FC4KQFCS.js → chunk-HMJ2P3SV.js} +1 -1
- package/chunks/chunk-HRVMTN37.js +26 -0
- package/chunks/{chunk-PQ36L4F5.js → chunk-HZZGYJIP.js} +1 -1
- package/chunks/{chunk-PT4I7NBA.js → chunk-I432KXWD.js} +1 -1
- package/chunks/{chunk-3EZLLVDF.js → chunk-IBJ5S45N.js} +3 -3
- package/chunks/{chunk-A4MFR4C5.js → chunk-IO257NUD.js} +3 -5
- package/chunks/{chunk-MIPFDQAF.js → chunk-ISJMN3ML.js} +1 -1
- package/chunks/chunk-IWOWEENB.js +9169 -0
- package/chunks/{chunk-XHRY7BXD.js → chunk-J6SIP2IT.js} +4 -4
- package/chunks/{chunk-OD2WU5QY.js → chunk-J7JQXYVL.js} +1 -1
- package/chunks/{chunk-NEFOOD54.js → chunk-J7VPB2HF.js} +4 -4
- package/chunks/{chunk-P7MPQI75.js → chunk-JGUBDRBC.js} +2 -2
- package/chunks/{chunk-SXCOEJO4.js → chunk-JOLJTKIG.js} +1 -1
- package/chunks/{chunk-NTTBXH7U.js → chunk-JS73NNWF.js} +8 -0
- package/chunks/{chunk-QRCNA3SR.js → chunk-JXLPQTMW.js} +50 -70
- package/chunks/{chunk-NNHNLJ2X.js → chunk-K2MSGB3W.js} +317 -72
- package/chunks/{chunk-KBXKR5R2.js → chunk-K52PZNU4.js} +1 -1
- package/chunks/{chunk-OOQUVWIG.js → chunk-K5OIW3I7.js} +4 -4
- package/chunks/{chunk-SOORFWKY.js → chunk-KSPRQSB4.js} +1 -1
- package/chunks/{chunk-WSH6GRKG.js → chunk-KVGR4MCF.js} +3 -3
- package/chunks/{chunk-6YKYPVDV.js → chunk-LC5M7YVE.js} +4 -4
- package/chunks/{chunk-M6NDLY2T.js → chunk-LD5VIJ7S.js} +1 -1
- package/chunks/{chunk-OMLJNPBE.js → chunk-LDGWX737.js} +84 -4
- package/chunks/{chunk-FAAUPSY2.js → chunk-LI4YHTQK.js} +1 -1
- package/chunks/{chunk-CXAOG665.js → chunk-LIKIJAUH.js} +2 -2
- package/chunks/chunk-LJZSMWOH.js +18 -0
- package/chunks/{chunk-BKPPWD33.js → chunk-M2IL2RTA.js} +22 -2
- package/chunks/{chunk-N5YPT6PH.js → chunk-MHOY756Q.js} +25 -13
- package/chunks/{chunk-YP5KH5Y7.js → chunk-ND7NOI4P.js} +1 -1
- package/chunks/{chunk-AW4TRXOC.js → chunk-NP2LV67M.js} +1 -1
- package/chunks/{chunk-GGDBMYGZ.js → chunk-NQB52P65.js} +5 -5
- package/chunks/{chunk-E3DYKPYZ.js → chunk-NUGZAFR2.js} +3 -3
- package/chunks/{chunk-GMIEIY3Y.js → chunk-O5BDEWBC.js} +3 -3
- package/chunks/{chunk-GDXET5XU.js → chunk-O5Z7EB6Y.js} +3 -3
- package/chunks/{chunk-5EYKMUUY.js → chunk-OTXXOZKW.js} +1 -1
- package/chunks/{chunk-M732YJPW.js → chunk-PALTIYXB.js} +6 -6
- package/chunks/{chunk-7UXUJ5T3.js → chunk-PLECQWDB.js} +1 -1
- package/chunks/{chunk-MLPXSYXR.js → chunk-PMIKPGDF.js} +66 -32
- package/chunks/{chunk-IWPYVAO2.js → chunk-PSQJ24ZZ.js} +3 -3
- package/chunks/{chunk-CPHEPGAO.js → chunk-PZRUV52H.js} +2 -2
- package/chunks/{chunk-PP4FUZNV.js → chunk-Q7RPLE33.js} +2 -2
- package/chunks/{chunk-S5DWMTHO.js → chunk-QQUVPMMZ.js} +2 -0
- package/chunks/{chunk-JUEPY766.js → chunk-RNGTMHKN.js} +3 -3
- package/chunks/{chunk-TUGSVUJB.js → chunk-ROV6B34L.js} +6 -6
- package/chunks/{chunk-RVOJ2FBP.js → chunk-RPJOOK6N.js} +1576 -10633
- package/chunks/{chunk-AXN7UPYQ.js → chunk-RQJJZQOH.js} +2 -2
- package/chunks/{chunk-AFSG32D5.js → chunk-RRRCWDFO.js} +1 -1
- package/chunks/{chunk-2M55OBEB.js → chunk-S3G6YFQC.js} +1 -1
- package/chunks/{chunk-4S5337WV.js → chunk-SVU5KGR7.js} +6527 -3314
- package/chunks/chunk-TBVSALA3.js +1109 -0
- package/chunks/{chunk-QUGAUQGJ.js → chunk-TBWQLLFO.js} +2 -0
- package/chunks/{chunk-AS5IN4GK.js → chunk-THK3QUU6.js} +5 -5
- package/chunks/{chunk-JNDY2MDR.js → chunk-TLDZKNZP.js} +1 -1
- package/chunks/{chunk-ZZO74WKW.js → chunk-TNAIZBPQ.js} +115 -28
- package/chunks/{chunk-3Z43GZUQ.js → chunk-TXASDT2M.js} +1 -1
- package/chunks/{chunk-CZBYX5MY.js → chunk-U53XZHAE.js} +1 -1
- package/chunks/{chunk-HIBNSEJE.js → chunk-UDG5EZJI.js} +0 -2
- package/chunks/{chunk-QNQAPSN2.js → chunk-URN2JIAQ.js} +4 -1
- package/chunks/{chunk-EZ5RP345.js → chunk-UYQTX2P6.js} +44 -13
- package/chunks/{chunk-BZ263IKX.js → chunk-UZPYR3EV.js} +1 -1
- package/chunks/{chunk-YZOSNW4R.js → chunk-VFACN2CE.js} +1 -1
- package/chunks/{chunk-RWDNJBWN.js → chunk-VLRBJ24J.js} +2 -2
- package/chunks/{chunk-NHDR76JX.js → chunk-VMJL7RH6.js} +4 -4
- package/chunks/{chunk-E23IPNGS.js → chunk-VOTDAZR7.js} +35 -6
- package/chunks/{chunk-XLLKYULU.js → chunk-VSNPOSDN.js} +2 -2
- package/chunks/{chunk-25EYDK42.js → chunk-VUMLT7E5.js} +2 -2
- package/chunks/{chunk-H4A72DE5.js → chunk-W4CRPSC5.js} +1 -1
- package/chunks/{chunk-NM5V5OVW.js → chunk-WJJYJVQE.js} +3 -3
- package/chunks/{chunk-ROIYNTHJ.js → chunk-WRT324N6.js} +3 -3
- package/chunks/chunk-WZAD4ZNJ.js +59 -0
- package/chunks/{chunk-SG7ZP5PG.js → chunk-WZDM44SB.js} +4 -4
- package/chunks/{chunk-JE7KQ2UP.js → chunk-XIQ5HQ2F.js} +469 -77
- package/chunks/{chunk-QV5YN5YD.js → chunk-XJOHLP2A.js} +5 -5
- package/chunks/{chunk-XUJNK7Y6.js → chunk-XL5K4SVK.js} +1 -1
- package/chunks/{chunk-CKSJECTU.js → chunk-XZJKSETB.js} +9 -5
- package/chunks/{chunk-YEYY7TEP.js → chunk-Y2FEAXLP.js} +7 -7
- package/chunks/{chunk-2B2BF7P7.js → chunk-YDJRMQU4.js} +3 -3
- package/chunks/{chunk-46UV252V.js → chunk-YHC2EYYG.js} +35 -38
- package/chunks/{chunk-OVZPVYZB.js → chunk-YMVFIYHV.js} +96 -18
- package/chunks/{chunk-WGHHA7ZH.js → chunk-Z3JMO2CH.js} +1 -1
- package/chunks/{chunk-MA2HEDVP.js → chunk-ZRYQMWEP.js} +3 -3
- package/chunks/{chunk-IGGGG5CX.js → chunk-ZTAT23TL.js} +15948 -10201
- package/chunks/{computer-use-77C5FHMW.js → computer-use-H2T7IFYX.js} +55 -54
- package/chunks/{config-utils-IVHRSXWI.js → config-utils-3DY73VIJ.js} +2 -2
- package/chunks/contextCommand-5AAZFFFV.js +94 -0
- package/chunks/{core-runtime-7VMIKUTG.js → core-runtime-JWFNKO2S.js} +57 -55
- package/chunks/{create-sub-session-2L5MQRN4.js → create-sub-session-33HIYIJE.js} +58 -56
- package/chunks/{create-sub-session-KRQULJE6.js → create-sub-session-XBCVGNFU.js} +6 -4
- package/chunks/{cron-create-H7UEPDSN.js → cron-create-IKA56DAF.js} +5 -5
- package/chunks/{cron-delete-6SZK7YFM.js → cron-delete-K5Q62EGH.js} +5 -5
- package/chunks/{cron-list-H25JIHEZ.js → cron-list-QBFGAMP7.js} +5 -5
- package/chunks/{daemon-2KTG7ZBN.js → daemon-NNCQ3HWT.js} +806 -147
- package/chunks/{daemon-git-worktree-guard-DXYIMWFT.js → daemon-git-worktree-guard-6233JAPJ.js} +54 -53
- package/chunks/daemon-status-provider-3EI2KALQ.js +104 -0
- package/chunks/daemon-trust-policy-QWWU7CON.js +100 -0
- package/chunks/{daemon-trust-policy-monitor-RYYGCQ3J.js → daemon-trust-policy-monitor-FH7GBAKN.js} +60 -59
- package/chunks/{de-UBEBKG6V.js → de-AH4LGCF5.js} +8 -0
- package/chunks/{deferred-core-runtime-3SGXFXEQ.js → deferred-core-runtime-EDUZQRME.js} +52 -51
- package/chunks/{discovery-ORA5J7YP.js → discovery-X2NV535U.js} +1 -1
- package/chunks/{display-image-ON3EYFRD.js → display-image-OEJMJV3S.js} +5 -5
- package/chunks/{dist-YEPL4RAW.js → dist-5EV2G6MC.js} +2 -3
- package/chunks/{dist-MAQXAQ2Y.js → dist-EQ3Q5XHX.js} +45337 -32756
- package/chunks/{dist-WJ4BHIEW.js → dist-ESS34DHC.js} +72 -0
- package/chunks/{dist-JWMKPWT5.js → dist-EUOUPUFO.js} +3 -4
- package/chunks/{dist-IYYN3RUT.js → dist-UOFRXJT6.js} +2798 -1250
- package/chunks/{earlyInputCapture-KJMLFVQV.js → earlyInputCapture-VSP42LUR.js} +53 -52
- package/chunks/{edit-I4LQFAEC.js → edit-ZTLO5ASX.js} +60 -58
- package/chunks/{en-X6YV7GME.js → en-MD3GP5YL.js} +8 -0
- package/chunks/{enter-worktree-YNPOJSRH.js → enter-worktree-TMTPDS2S.js} +55 -54
- package/chunks/{enterPlanMode-XCPK62ER.js → enterPlanMode-UBAXFMYI.js} +55 -54
- package/chunks/{environment-S7CTIHMX.js → environment-C2CZN7CB.js} +55 -54
- package/chunks/{errors-7HB2AIDS.js → errors-ZUNFQINF.js} +54 -53
- package/chunks/{exit-worktree-AIIY7SR6.js → exit-worktree-572NWEPJ.js} +55 -54
- package/chunks/exitPlanMode-QTIXFGZT.js +86 -0
- package/chunks/{fast-path-NDJV3ZFJ.js → fast-path-CEEVHQL3.js} +3 -3
- package/chunks/{fast-path-settings-LNOFM2YP.js → fast-path-settings-WHX3J3ZI.js} +2 -2
- package/chunks/{fr-VENTC2BS.js → fr-ZEML2JWS.js} +8 -0
- package/chunks/{gemini-RSUFP5OE.js → gemini-I2YR6GMS.js} +114 -112
- package/chunks/{geminiContentGenerator-SQ5XBPZ7.js → geminiContentGenerator-GQWNDZQF.js} +7 -7
- package/chunks/getMachineId-bsd-FBOAYNSY.js +48 -0
- package/chunks/{getMachineId-bsd-FG7IUY6U.js → getMachineId-bsd-YH7RURBZ.js} +4 -4
- package/chunks/{getMachineId-darwin-GLCJI2RA.js → getMachineId-darwin-H6USQYNI.js} +4 -4
- package/chunks/getMachineId-darwin-RNJLJUXY.js +47 -0
- package/chunks/{getMachineId-linux-O6OPPAKO.js → getMachineId-linux-HF2N63ET.js} +3 -3
- package/chunks/getMachineId-linux-UEVRAIAB.js +41 -0
- package/chunks/getMachineId-unsupported-FWXYJ7HW.js +31 -0
- package/chunks/{getMachineId-unsupported-S6CKYVGC.js → getMachineId-unsupported-NYA5DXRB.js} +3 -3
- package/chunks/getMachineId-win-LRVGMHLW.js +50 -0
- package/chunks/{getMachineId-win-X5SRNEH7.js → getMachineId-win-SMEGY2DW.js} +4 -4
- package/chunks/{glob-J4RUJAHX.js → glob-XFBL2RVT.js} +58 -57
- package/chunks/{goal-tools-VHTNVOKK.js → goal-tools-TLJCE7YZ.js} +6 -6
- package/chunks/{grep-VJWPLFOT.js → grep-U675LEXE.js} +55 -54
- package/chunks/handleAutoUpdate-R6RUCIA2.js +97 -0
- package/chunks/{i18n-RM5YOICI.js → i18n-SJCZDZ4C.js} +53 -52
- package/chunks/{image-gen-EXECB5XM.js → image-gen-6VY7CA7C.js} +14 -14
- package/chunks/initializer-CRDZXJOG.js +101 -0
- package/chunks/installationInfo-EW3NEJDZ.js +95 -0
- package/chunks/{ja-QHT4EQTO.js → ja-UM5B2HMD.js} +8 -0
- package/chunks/{keychain-token-storage-3XFJ5ZB2.js → keychain-token-storage-MTFTAESK.js} +3 -3
- package/chunks/list-TZEMTXDH.js +104 -0
- package/chunks/{list-agents-OSVDFI6S.js → list-agents-43XUEXJV.js} +6 -6
- package/chunks/loadedSettingsAdapter-47DG424L.js +98 -0
- package/chunks/{loggingContentGenerator-WF4ZOJEZ.js → loggingContentGenerator-77C6O5VW.js} +31 -29
- package/chunks/{loop-wakeup-WQS6JYAG.js → loop-wakeup-E54KDUXC.js} +6 -6
- package/chunks/{ls-D3HUFHDP.js → ls-CGL2UC3H.js} +7 -7
- package/chunks/{lsp-3QDDJTCS.js → lsp-5IKUO5DX.js} +3 -3
- package/chunks/{managed-npm-update-E7IW6N7V.js → managed-npm-update-AJ5GZRUA.js} +53 -52
- package/chunks/mcp-AQK656Y4.js +98 -0
- package/chunks/{monitor-EE2UYMGE.js → monitor-UDZXKYT3.js} +55 -54
- package/chunks/nonInteractiveCli-6NC3NLZM.js +166 -0
- package/chunks/{notebook-edit-NTDY4QDU.js → notebook-edit-G6WZI2YT.js} +59 -57
- package/chunks/{openaiContentGenerator-YNFVJMRJ.js → openaiContentGenerator-IHVHP3VB.js} +32 -32
- package/chunks/{pidfile-4XSFLYBZ.js → pidfile-EBKS2HBK.js} +53 -52
- package/chunks/{processUtils-WDA2MJFD.js → processUtils-B7M35ZLR.js} +2 -2
- package/chunks/prompt-terminal-ledger-5JYOPOII.js +93 -0
- package/chunks/{pt-VL3I5RNY.js → pt-5BMJ3XYH.js} +8 -0
- package/chunks/{qwenContentGenerator-434M7QKY.js → qwenContentGenerator-WCJPPTED.js} +59 -58
- package/chunks/{qwenOAuth2-GMYZOO6A.js → qwenOAuth2-S2CLBSEZ.js} +10 -10
- package/chunks/read-file-WFM53FTW.js +33 -0
- package/chunks/{read-mcp-resource-XD54ZQMC.js → read-mcp-resource-XYES2B42.js} +3 -3
- package/chunks/{record-artifact-SEYFJEJF.js → record-artifact-W3IBTGL7.js} +10 -6
- package/chunks/{resumeHistoryUtils-EVG3WYK2.js → resumeHistoryUtils-CK4ZC6YO.js} +59 -58
- package/chunks/ripGrep-B3PBLEQ3.js +86 -0
- package/chunks/{ru-4RCKL4PY.js → ru-6GL66ORV.js} +8 -0
- package/chunks/{run-qwen-serve-3QSGRXAN.js → run-qwen-serve-DC5RXI6N.js} +537 -185
- package/chunks/{runtime-5MLLZ7DC.js → runtime-UVEETF54.js} +63 -62
- package/chunks/{scheduler-RPBJ63CH.js → scheduler-MWT3UMVN.js} +54 -53
- package/chunks/{sdk-exporters-grpc-54L4LS5L.js → sdk-exporters-grpc-6J5CKOMO.js} +194 -75
- package/chunks/{sdk-exporters-http-XUVP63H6.js → sdk-exporters-http-Q3YZ4752.js} +40 -45
- package/chunks/{sdk-impl-YXUEN2Z2.js → sdk-impl-BOMCAN2Z.js} +7211 -5454
- package/chunks/{send-message-VZENRWRH.js → send-message-J4VT46OI.js} +8 -8
- package/chunks/{serve-HS3XLPXU.js → serve-AKM75GTE.js} +60 -61
- package/chunks/{server-TC4A7AAZ.js → server-KU7XIDVT.js} +2221 -399
- package/chunks/{session-UBOFXVMN.js → session-DKVYIRWN.js} +108 -105
- package/chunks/{settings-D5644OM5.js → settings-NS3PXZDP.js} +63 -62
- package/chunks/{shell-3PZULQQV.js → shell-UXCNM2OK.js} +52 -51
- package/chunks/{skill-PEVVXQ3L.js → skill-KV7YCCTM.js} +30 -28
- package/chunks/{skill-settings-J65JKKES.js → skill-settings-EXW7ESWJ.js} +59 -58
- package/chunks/{spawnChannel-IYGXRHSQ.js → spawnChannel-FCP44P4V.js} +55 -54
- package/chunks/{standalone-update-IFM53PE7.js → standalone-update-RGW3B2DX.js} +55 -54
- package/chunks/{startInteractiveUI-3AVH7L6H.js → startInteractiveUI-UZMF2BIJ.js} +615 -392
- package/chunks/{syntheticOutput-7GWFIDXT.js → syntheticOutput-JAXMIMZP.js} +4 -4
- package/chunks/{task-create-FCBDX7UH.js → task-create-I2H322E4.js} +12 -12
- package/chunks/{task-list-YIYIUFUA.js → task-list-3OLIWFTQ.js} +21 -7
- package/chunks/{task-stop-X37KYTKB.js → task-stop-JAUY6MSY.js} +3 -3
- package/chunks/{task-update-MYPFVOVM.js → task-update-B3XO4CPI.js} +87 -16
- package/chunks/{team-create-ZAIA7KAV.js → team-create-77XY3KAE.js} +56 -56
- package/chunks/{team-delete-6UMU4XLS.js → team-delete-Q7GE7RRI.js} +6 -6
- package/chunks/{team-plan-approval-UNIUS7OD.js → team-plan-approval-TAQANDQG.js} +55 -54
- package/chunks/{terminal-image-renderer-G343P2RV.js → terminal-image-renderer-V4LIF5NS.js} +54 -53
- package/chunks/theme-manager-KKBAJ574.js +90 -0
- package/chunks/{todoWrite-U2R4NVF4.js → todoWrite-FJJTY2TI.js} +7 -7
- package/chunks/{tool-search-5R2OE4C7.js → tool-search-GZJYRK4I.js} +25 -24
- package/chunks/{total-session-admission-4KBHMQQ2.js → total-session-admission-NIBNWXHE.js} +59 -57
- package/chunks/{trustedFolders-LK6T4XC7.js → trustedFolders-7GEI2NYC.js} +53 -52
- package/chunks/{undici-PYHBDDPN.js → undici-S7WJSKGJ.js} +962 -391
- package/chunks/{update-relaunch-UBKROIC6.js → update-relaunch-OA3OEBMD.js} +5 -5
- package/chunks/{updateCheck-W4Y2GFSD.js → updateCheck-QVHQEVIY.js} +56 -55
- package/chunks/{useAutoAcceptIndicator-C7BEICBF.js → useAutoAcceptIndicator-WZ27J7NY.js} +64 -63
- package/chunks/{validateNonInterActiveAuth-LTEI2TB6.js → validateNonInterActiveAuth-OXJA2JWG.js} +99 -96
- package/chunks/{version-G5A5DGVS.js → version-KJO64WD7.js} +1 -1
- package/chunks/{web-fetch-RTEQTR5Z.js → web-fetch-CC5INI2R.js} +25 -23
- package/chunks/{web-search-5OXHEZPV.js → web-search-MOAUAN6N.js} +18 -18
- package/chunks/{web-shell-static-O73YPVVC.js → web-shell-static-3NUTRHAH.js} +4 -5
- package/chunks/{workflow-ISQJHPG2.js → workflow-BN2ZEJMK.js} +366 -105
- package/chunks/workspace-providers-status-R5QTZFK3.js +101 -0
- package/chunks/{workspace-registration-store-CYNY6IP6.js → workspace-registration-store-WMSLM36M.js} +1 -1
- package/chunks/{workspace-registry-34GTUUHB.js → workspace-registry-J3RUCXH6.js} +59 -57
- package/chunks/{workspace-service-XCDQLE2Y.js → workspace-service-JJZFPKM4.js} +66 -65
- package/chunks/workspace-skills-status-DRIOZRIA.js +101 -0
- package/chunks/{workspace-trust-reconciler-AYGXC7A3.js → workspace-trust-reconciler-YAYSN6CX.js} +69 -67
- package/chunks/write-file-7HXHFFOY.js +88 -0
- package/chunks/{zh-TW-SQ4HTSCW.js → zh-TW-LVLBK4KF.js} +8 -0
- package/chunks/{zh-LMSTK4WD.js → zh-UBMWS2BJ.js} +8 -0
- package/chunks/{zoom-image-4BFYJ3HG.js → zoom-image-EFMQMU4G.js} +24 -22
- package/cli.js +15 -15
- package/locales/ca.js +13 -0
- package/locales/de.js +12 -0
- package/locales/en.js +11 -0
- package/locales/fr.js +13 -0
- package/locales/ja.js +13 -0
- package/locales/pt.js +12 -0
- package/locales/ru.js +12 -0
- package/locales/zh-TW.js +11 -0
- package/locales/zh.js +11 -0
- package/package.json +3 -3
- package/web-shell/assets/{arc-CgOpDKvm.js → arc-BCP1f-bN.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-0Ag_m34F.js → architectureDiagram-3BPJPVTR-D-6ajMay.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-IwTwFau0.js → blockDiagram-GPEHLZMM-CcLlnVnf.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-DLa5GUv8.js → c4Diagram-AAUBKEIU-C_Sp9UwQ.js} +1 -1
- package/web-shell/assets/channel-BcImYzbA.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-DcYP-WFG.js → chunk-2J33WTMH-CG0ngvo9.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-C8MVPMiQ.js → chunk-4BX2VUAB-D43LsVdk.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-BUi4Yfv3.js → chunk-55IACEB6-BqNIn5rz.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-Cy3Su2YY.js → chunk-727SXJPM-BSHmO08Y.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-Dp8Teqv6.js → chunk-AQP2D5EJ-CMUbr5tQ.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-BDTDM-4j.js → chunk-FMBD7UC4-Cm6JflnZ.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-7HfDt0r2.js → chunk-ND2GUHAM-CBR39YQZ.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-BIBU0uCF.js → chunk-QZHKN3VN-CWnqaLb-.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-OWx0rDRW.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-OWx0rDRW.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-DRLdcg9p.js → cose-bilkent-S5V4N54A-DJlTdnfD.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-DCCgDwqW.js → dagre-BM42HDAG-1AFN1uVc.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-CsBTBmk3.js → diagram-2AECGRRQ-gC0GGNSW.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-C9qjH8Lt.js → diagram-5GNKFQAL-CPmRPT1s.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-Brjs_lj2.js → diagram-KO2AKTUF-atigp6Hr.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-DtiWCl_F.js → diagram-LMA3HP47-BJnJFSRQ.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-DmfKLkBT.js → diagram-OG6HWLK6-CyvJ4fG2.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-Bve_4deH.js → erDiagram-TEJ5UH35-CZac_jT6.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-C2_kXCcV.js → flowDiagram-I6XJVG4X-pd-LQxWB.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-BSBIjiTF.js → ganttDiagram-6RSMTGT7-CvB1at7l.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-CyebwI55.js → gitGraphDiagram-PVQCEYII-B5Y6nkil.js} +1 -1
- package/web-shell/assets/index-Bg3DAn8Z.js +1788 -0
- package/web-shell/assets/{index-d0yfnV1M.js → index-Bj3ZSUHL.js} +1 -1
- package/web-shell/assets/index-mp32EO88.css +5 -0
- package/web-shell/assets/{infoDiagram-5YYISTIA-CSDGnWxU.js → infoDiagram-5YYISTIA-BdyWvU4P.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-BK4jU13p.js → ishikawaDiagram-YF4QCWOH-CaHbUdvN.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-D_W6j-oF.js → journeyDiagram-JHISSGLW-DR9F3FpG.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-C7xf-SdC.js → kanban-definition-UN3LZRKU-BoEUbkw2.js} +1 -1
- package/web-shell/assets/{linear-DQmzxpxd.js → linear-DUbfzV4T.js} +1 -1
- package/web-shell/assets/{mermaid.core-9P7AGOLG.js → mermaid.core-CLLkPcpD.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-DgcgMyPk.js → mindmap-definition-RKZ34NQL-FuKI3Stt.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-3wWGb9eG.js → pieDiagram-4H26LBE5-CVAHL7l5.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-BeCXnQw9.js → quadrantDiagram-W4KKPZXB-BkGi5fRj.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-Bi1UOHDz.js → requirementDiagram-4Y6WPE33-B5ghV8-K.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-lrLUjjbb.js → sankeyDiagram-5OEKKPKP-CKFbVhkQ.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-BFuqKz6Q.js → sequenceDiagram-3UESZ5HK-C5P9ujPd.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-8DemQLhu.js → stateDiagram-AJRCARHV-CsDn-Rez.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DpGKD1ez.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-uzEuVQXg.js → timeline-definition-PNZ67QCA-B6oLBkTr.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-BQTeZ_-o.js → vennDiagram-CIIHVFJN-DvtBkYwp.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-B6yM5Im7.js → wardley-L42UT6IY-D2UwTX16.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-ChM8bmgn.js → wardleyDiagram-YWT4CUSO-FnnfCxYI.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-oNG6HyB1.js → xychartDiagram-2RQKCTM6-C1SaMQ7d.js} +1 -1
- package/web-shell/index.html +2 -2
- package/chunks/MaxSizedBox-UQALOVVT.js +0 -97
- package/chunks/agent-headless-GJCQMURW.js +0 -87
- package/chunks/channel-settings-store-WNWYFHG7.js +0 -102
- package/chunks/chunk-AZQ3DT76.js +0 -10017
- package/chunks/chunk-CR3C7WXL.js +0 -113
- package/chunks/chunk-K5IDV3PC.js +0 -519
- package/chunks/chunk-MPHPFVKK.js +0 -48
- package/chunks/chunk-RLKC46YT.js +0 -3582
- package/chunks/chunk-UPDOZBWO.js +0 -358
- package/chunks/contextCommand-PJ77GBWL.js +0 -93
- package/chunks/daemon-status-provider-ZDOYJCU6.js +0 -102
- package/chunks/daemon-trust-policy-E67OYUK2.js +0 -99
- package/chunks/exitPlanMode-R4JY7V2O.js +0 -85
- package/chunks/handleAutoUpdate-POCX2MNB.js +0 -94
- package/chunks/initializer-Z2AFGBNR.js +0 -100
- package/chunks/installationInfo-4I5FXNMH.js +0 -92
- package/chunks/list-ZMBFIGZA.js +0 -103
- package/chunks/loadedSettingsAdapter-T6TV4YJ7.js +0 -97
- package/chunks/mcp-6UNYX4HG.js +0 -97
- package/chunks/nonInteractiveCli-WAY237O4.js +0 -163
- package/chunks/read-file-TAFBKMNI.js +0 -32
- package/chunks/ripGrep-WOEK2PXS.js +0 -85
- package/chunks/theme-manager-Z3RIT7DB.js +0 -89
- package/chunks/undici-3FJYTMOF.js +0 -25914
- package/chunks/workspace-providers-status-2ZPZPUPZ.js +0 -100
- package/chunks/workspace-skills-status-RS4O7AIJ.js +0 -100
- package/chunks/write-file-EWXKVVXF.js +0 -87
- package/web-shell/assets/channel-BrGVBa2L.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-B5TUzJzI.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-B5TUzJzI.js +0 -1
- package/web-shell/assets/index-CIDsgxTe.js +0 -1792
- package/web-shell/assets/index-DiQnWi_E.css +0 -5
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DhM5ixYd.js +0 -1
- package/chunks/{dist-BROOP2EG.js → dist-LZO24N3E.js} +1 -1
|
@@ -1418,6 +1418,18 @@ var DaemonClient = class {
|
|
|
1418
1418
|
{ method: "PUT", body: { state }, clientId, mode: "rest" }
|
|
1419
1419
|
);
|
|
1420
1420
|
}
|
|
1421
|
+
async setExtensionDefaultActivations(extensionNames, state, clientId) {
|
|
1422
|
+
return await this.jsonRequest(
|
|
1423
|
+
"/extensions/activation",
|
|
1424
|
+
"PUT /extensions/activation",
|
|
1425
|
+
{
|
|
1426
|
+
method: "PUT",
|
|
1427
|
+
body: { extensionNames: [...extensionNames], state },
|
|
1428
|
+
clientId,
|
|
1429
|
+
mode: "rest"
|
|
1430
|
+
}
|
|
1431
|
+
);
|
|
1432
|
+
}
|
|
1421
1433
|
async extensionOperation(operationId, signal) {
|
|
1422
1434
|
return await this.jsonRequest(
|
|
1423
1435
|
`/extensions/operations/${urlEncode(operationId)}`,
|
|
@@ -2198,6 +2210,22 @@ var DaemonClient = class {
|
|
|
2198
2210
|
"GET /workspace/sessions"
|
|
2199
2211
|
);
|
|
2200
2212
|
}
|
|
2213
|
+
/**
|
|
2214
|
+
* Read the memory-only live-state snapshot for a workspace via
|
|
2215
|
+
* `GET /workspaces/:workspace/sessions/live-state`: the complete set of
|
|
2216
|
+
* live sessions with volatile state plus the in-memory catalog version
|
|
2217
|
+
* equality token. Always uses native REST transport (never the pluggable
|
|
2218
|
+
* ACP transport).
|
|
2219
|
+
*
|
|
2220
|
+
* This method deliberately does not pre-flight
|
|
2221
|
+
* `requireCapability('workspace_session_live_state')` — a capability
|
|
2222
|
+
* probe on every poll would double request volume. Consumers preflight
|
|
2223
|
+
* the capability once from their already-loaded capabilities and fall
|
|
2224
|
+
* back to the full session catalog when it is absent.
|
|
2225
|
+
*/
|
|
2226
|
+
getWorkspaceSessionLiveState(workspaceCwd, opts = {}) {
|
|
2227
|
+
return this.workspaceByCwd(workspaceCwd).getSessionLiveState(opts);
|
|
2228
|
+
}
|
|
2201
2229
|
async listSessionGroups(workspaceCwd) {
|
|
2202
2230
|
return await this.jsonRequest(
|
|
2203
2231
|
`/workspace/${urlEncode(workspaceCwd)}/session-groups`,
|
|
@@ -2425,20 +2453,25 @@ var DaemonClient = class {
|
|
|
2425
2453
|
}
|
|
2426
2454
|
);
|
|
2427
2455
|
}
|
|
2428
|
-
|
|
2429
|
-
return
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2456
|
+
sessionGoalClear(sessionId, clientId) {
|
|
2457
|
+
return this.jsonRequest(
|
|
2458
|
+
`/session/${urlEncode(sessionId)}/goal/clear`,
|
|
2459
|
+
"POST /session/:id/goal/clear",
|
|
2460
|
+
{ method: "POST", body: {}, clientId }
|
|
2461
|
+
);
|
|
2462
|
+
}
|
|
2463
|
+
sessionGoal(sessionId, clientId) {
|
|
2464
|
+
return this.jsonRequest(
|
|
2465
|
+
`/session/${urlEncode(sessionId)}/goal`,
|
|
2466
|
+
"GET /session/:id/goal",
|
|
2467
|
+
{ clientId }
|
|
2468
|
+
);
|
|
2469
|
+
}
|
|
2470
|
+
sessionGoalControl(sessionId, request, clientId) {
|
|
2471
|
+
return this.jsonRequest(
|
|
2472
|
+
`/session/${urlEncode(sessionId)}/goal`,
|
|
2473
|
+
"POST /session/:id/goal",
|
|
2474
|
+
{ method: "POST", body: request, clientId }
|
|
2442
2475
|
);
|
|
2443
2476
|
}
|
|
2444
2477
|
async sessionStats(sessionId, clientId) {
|
|
@@ -2644,11 +2677,79 @@ var DaemonClient = class {
|
|
|
2644
2677
|
if (!res.ok) throw await this.failOnError(res, "POST /session/:id/btw");
|
|
2645
2678
|
return await res.json();
|
|
2646
2679
|
}
|
|
2680
|
+
async uploadSessionAttachment(sessionId, data, name, mimeType, opts) {
|
|
2681
|
+
return await this.fetchWithTimeout(
|
|
2682
|
+
`${this.baseUrl}/session/${urlEncode(sessionId)}/attachments?name=${urlEncode(name)}`,
|
|
2683
|
+
{
|
|
2684
|
+
method: "POST",
|
|
2685
|
+
headers: this.headers({ "Content-Type": mimeType }, opts?.clientId),
|
|
2686
|
+
body: data,
|
|
2687
|
+
signal: opts?.signal
|
|
2688
|
+
},
|
|
2689
|
+
async (res) => {
|
|
2690
|
+
if (!res.ok) {
|
|
2691
|
+
throw await this.failOnError(res, "POST /session/:id/attachments");
|
|
2692
|
+
}
|
|
2693
|
+
return await res.json();
|
|
2694
|
+
}
|
|
2695
|
+
);
|
|
2696
|
+
}
|
|
2697
|
+
async readSessionAttachment(sessionId, attachmentId, opts) {
|
|
2698
|
+
return await this.fetchWithTimeout(
|
|
2699
|
+
`${this.baseUrl}/session/${urlEncode(sessionId)}/attachments/${urlEncode(attachmentId)}`,
|
|
2700
|
+
{
|
|
2701
|
+
method: "GET",
|
|
2702
|
+
headers: this.headers({}, opts?.clientId),
|
|
2703
|
+
signal: opts?.signal
|
|
2704
|
+
},
|
|
2705
|
+
async (res) => {
|
|
2706
|
+
if (!res.ok) {
|
|
2707
|
+
throw await this.failOnError(
|
|
2708
|
+
res,
|
|
2709
|
+
"GET /session/:id/attachments/:attachmentId"
|
|
2710
|
+
);
|
|
2711
|
+
}
|
|
2712
|
+
const bytes = new Uint8Array(await res.arrayBuffer());
|
|
2713
|
+
let binary = "";
|
|
2714
|
+
for (let offset = 0; offset < bytes.length; offset += 32768) {
|
|
2715
|
+
binary += String.fromCharCode(
|
|
2716
|
+
...bytes.subarray(offset, offset + 32768)
|
|
2717
|
+
);
|
|
2718
|
+
}
|
|
2719
|
+
return {
|
|
2720
|
+
data: btoa(binary),
|
|
2721
|
+
mimeType: res.headers.get("content-type") ?? "application/octet-stream"
|
|
2722
|
+
};
|
|
2723
|
+
}
|
|
2724
|
+
);
|
|
2725
|
+
}
|
|
2726
|
+
async removeSessionAttachment(sessionId, attachmentId, opts) {
|
|
2727
|
+
return await this.fetchWithTimeout(
|
|
2728
|
+
`${this.baseUrl}/session/${urlEncode(sessionId)}/attachments/${urlEncode(attachmentId)}`,
|
|
2729
|
+
{
|
|
2730
|
+
method: "DELETE",
|
|
2731
|
+
headers: this.headers({}, opts?.clientId),
|
|
2732
|
+
signal: opts?.signal
|
|
2733
|
+
},
|
|
2734
|
+
async (res) => {
|
|
2735
|
+
if (!res.ok) {
|
|
2736
|
+
throw await this.failOnError(
|
|
2737
|
+
res,
|
|
2738
|
+
"DELETE /session/:id/attachments/:attachmentId"
|
|
2739
|
+
);
|
|
2740
|
+
}
|
|
2741
|
+
return (await res.json()).removed === true;
|
|
2742
|
+
}
|
|
2743
|
+
);
|
|
2744
|
+
}
|
|
2647
2745
|
/**
|
|
2648
2746
|
* Queue a user message typed while the session's turn is still running. The
|
|
2649
2747
|
* ACP child drains it between tool batches so the model sees it before the
|
|
2650
2748
|
* turn ends. Every accepted request is daemon-owned; a caller-supplied id
|
|
2651
|
-
* makes ambiguous retries idempotent.
|
|
2749
|
+
* makes ambiguous retries idempotent. `opts.content` carries media content
|
|
2750
|
+
* image blocks alongside the text — pre-flight the
|
|
2751
|
+
* `session_attachments` capability; older daemons ignore the
|
|
2752
|
+
* field and drop the media.
|
|
2652
2753
|
*/
|
|
2653
2754
|
async enqueueMidTurnMessage(sessionId, message, opts) {
|
|
2654
2755
|
return await this.fetchWithTimeout(
|
|
@@ -2659,7 +2760,11 @@ var DaemonClient = class {
|
|
|
2659
2760
|
{ "Content-Type": "application/json" },
|
|
2660
2761
|
opts?.clientId
|
|
2661
2762
|
),
|
|
2662
|
-
body: JSON.stringify({
|
|
2763
|
+
body: JSON.stringify({
|
|
2764
|
+
message,
|
|
2765
|
+
messageId: opts?.messageId,
|
|
2766
|
+
...opts?.content && opts.content.length > 0 ? { content: opts.content } : {}
|
|
2767
|
+
}),
|
|
2663
2768
|
signal: opts?.signal
|
|
2664
2769
|
},
|
|
2665
2770
|
async (res) => {
|
|
@@ -4595,6 +4700,26 @@ var WorkspaceDaemonClient = class {
|
|
|
4595
4700
|
getWorkspaceSessionInfo() {
|
|
4596
4701
|
return this.get("/session-info", "GET /workspaces/:workspace/session-info");
|
|
4597
4702
|
}
|
|
4703
|
+
/**
|
|
4704
|
+
* Read the memory-only live-state snapshot for this workspace: the
|
|
4705
|
+
* complete set of live sessions with volatile state plus the in-memory
|
|
4706
|
+
* catalog version equality token. Always uses native REST transport
|
|
4707
|
+
* (never the pluggable ACP transport).
|
|
4708
|
+
*
|
|
4709
|
+
* This method deliberately does not pre-flight
|
|
4710
|
+
* `requireCapability('workspace_session_live_state')` — a capability
|
|
4711
|
+
* probe on every poll would double request volume. Consumers preflight
|
|
4712
|
+
* the capability once from their already-loaded capabilities and fall
|
|
4713
|
+
* back to the full session catalog when it is absent.
|
|
4714
|
+
*/
|
|
4715
|
+
getSessionLiveState(opts = {}) {
|
|
4716
|
+
return this.client.workspaceJsonRequest(
|
|
4717
|
+
this.workspaceSelector,
|
|
4718
|
+
"/sessions/live-state",
|
|
4719
|
+
"GET /workspaces/:workspace/sessions/live-state",
|
|
4720
|
+
{ clientId: opts.clientId, timeoutMs: opts.timeoutMs, mode: "rest" }
|
|
4721
|
+
);
|
|
4722
|
+
}
|
|
4598
4723
|
/**
|
|
4599
4724
|
* Read one page from an active persisted session transcript in this
|
|
4600
4725
|
* workspace.
|
|
@@ -4625,6 +4750,14 @@ var WorkspaceDaemonClient = class {
|
|
|
4625
4750
|
opts
|
|
4626
4751
|
);
|
|
4627
4752
|
}
|
|
4753
|
+
updateSessionMetadata(sessionId, metadata, clientId) {
|
|
4754
|
+
return this.client.workspaceJsonRequest(
|
|
4755
|
+
this.workspaceSelector,
|
|
4756
|
+
`/session/${urlEncode(sessionId)}/metadata`,
|
|
4757
|
+
"PATCH /workspaces/:workspace/session/:id/metadata",
|
|
4758
|
+
{ method: "PATCH", body: metadata, clientId, mode: "rest" }
|
|
4759
|
+
);
|
|
4760
|
+
}
|
|
4628
4761
|
listSessionGroups() {
|
|
4629
4762
|
return this.get(
|
|
4630
4763
|
"/session-groups",
|
|
@@ -4879,6 +5012,19 @@ var WorkspaceDaemonClient = class {
|
|
|
4879
5012
|
{ method: "PUT", body: { state }, clientId, mode: "rest" }
|
|
4880
5013
|
);
|
|
4881
5014
|
}
|
|
5015
|
+
setExtensionActivations(extensionNames, state, clientId) {
|
|
5016
|
+
return this.client.workspaceJsonRequest(
|
|
5017
|
+
this.workspaceSelector,
|
|
5018
|
+
"/extensions/activation",
|
|
5019
|
+
"PUT /workspaces/:workspace/extensions/activation",
|
|
5020
|
+
{
|
|
5021
|
+
method: "PUT",
|
|
5022
|
+
body: { extensionNames: [...extensionNames], state },
|
|
5023
|
+
clientId,
|
|
5024
|
+
mode: "rest"
|
|
5025
|
+
}
|
|
5026
|
+
);
|
|
5027
|
+
}
|
|
4882
5028
|
clearExtensionActivation(extensionId, clientId) {
|
|
4883
5029
|
return this.client.workspaceJsonRequest(
|
|
4884
5030
|
this.workspaceSelector,
|
|
@@ -4983,6 +5129,14 @@ __name(isNonBlockingAccepted, "isNonBlockingAccepted");
|
|
|
4983
5129
|
|
|
4984
5130
|
// packages/sdk-typescript/src/daemon/DaemonSessionClient.ts
|
|
4985
5131
|
init_esbuild_shims();
|
|
5132
|
+
function isSessionAttachmentReference(value) {
|
|
5133
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
5134
|
+
const record = value;
|
|
5135
|
+
return (record["type"] === "image" || record["type"] === "resource") && typeof record["attachmentId"] === "string" && record["attachmentId"].length > 0 && typeof record["mimeType"] === "string" && record["mimeType"].length > 0 && (record["type"] !== "image" || record["mimeType"].startsWith("image/")) && typeof record["size"] === "number" && Number.isSafeInteger(record["size"]) && record["size"] >= 0 && (record["type"] !== "image" || record["size"] > 0);
|
|
5136
|
+
}
|
|
5137
|
+
__name(isSessionAttachmentReference, "isSessionAttachmentReference");
|
|
5138
|
+
var MAX_ATTACHMENT_CACHE_BYTES = 32 * 1024 * 1024;
|
|
5139
|
+
var MAX_ATTACHMENT_CACHE_ENTRIES = 128;
|
|
4986
5140
|
var DaemonSessionClient = class _DaemonSessionClient {
|
|
4987
5141
|
static {
|
|
4988
5142
|
__name(this, "DaemonSessionClient");
|
|
@@ -4990,6 +5144,12 @@ var DaemonSessionClient = class _DaemonSessionClient {
|
|
|
4990
5144
|
client;
|
|
4991
5145
|
session;
|
|
4992
5146
|
state;
|
|
5147
|
+
/**
|
|
5148
|
+
* Not `readonly`: {@link consumeReplaySnapshot} swaps it for an empty
|
|
5149
|
+
* snapshot once the provider has injected it into the transcript store,
|
|
5150
|
+
* releasing the raw wire events (tens of MiB on busy sessions) instead of
|
|
5151
|
+
* retaining them for the session client's lifetime.
|
|
5152
|
+
*/
|
|
4993
5153
|
replaySnapshot;
|
|
4994
5154
|
replaySnapshotComplete;
|
|
4995
5155
|
replayPartial;
|
|
@@ -5024,6 +5184,8 @@ var DaemonSessionClient = class _DaemonSessionClient {
|
|
|
5024
5184
|
reattaching;
|
|
5025
5185
|
cancelling;
|
|
5026
5186
|
promptLimit;
|
|
5187
|
+
attachmentCache = /* @__PURE__ */ new Map();
|
|
5188
|
+
attachmentCacheBytes = 0;
|
|
5027
5189
|
_pendingPrompts = /* @__PURE__ */ new Map();
|
|
5028
5190
|
constructor(opts) {
|
|
5029
5191
|
this.client = opts.client;
|
|
@@ -5083,7 +5245,7 @@ var DaemonSessionClient = class _DaemonSessionClient {
|
|
|
5083
5245
|
eventEpoch,
|
|
5084
5246
|
...session
|
|
5085
5247
|
} = restored;
|
|
5086
|
-
|
|
5248
|
+
const result = new _DaemonSessionClient({
|
|
5087
5249
|
client,
|
|
5088
5250
|
session,
|
|
5089
5251
|
hasActivePrompt,
|
|
@@ -5101,6 +5263,8 @@ var DaemonSessionClient = class _DaemonSessionClient {
|
|
|
5101
5263
|
historyAnchorRecordId,
|
|
5102
5264
|
replayDegraded
|
|
5103
5265
|
});
|
|
5266
|
+
await result.hydrateReplaySnapshot();
|
|
5267
|
+
return result;
|
|
5104
5268
|
}
|
|
5105
5269
|
/**
|
|
5106
5270
|
* Resumes an existing daemon session without requesting history replay.
|
|
@@ -5149,6 +5313,18 @@ var DaemonSessionClient = class _DaemonSessionClient {
|
|
|
5149
5313
|
get eventEpoch() {
|
|
5150
5314
|
return this.lastSeenEpoch;
|
|
5151
5315
|
}
|
|
5316
|
+
/**
|
|
5317
|
+
* Returns the retained replay snapshot and drops the client's reference
|
|
5318
|
+
* to it. Call once the snapshot has been injected into a transcript
|
|
5319
|
+
* store; the raw wire events are no longer needed (SSE continues from
|
|
5320
|
+
* `lastEventId`, and older history is served by pagination) and can
|
|
5321
|
+
* otherwise pin tens of MiB per session client.
|
|
5322
|
+
*/
|
|
5323
|
+
consumeReplaySnapshot() {
|
|
5324
|
+
const snapshot = this.replaySnapshot;
|
|
5325
|
+
this.replaySnapshot = { compactedReplay: [], liveJournal: [] };
|
|
5326
|
+
return snapshot;
|
|
5327
|
+
}
|
|
5152
5328
|
setLastEventId(lastEventId) {
|
|
5153
5329
|
this.lastSeenEventId = validateLastEventId(lastEventId);
|
|
5154
5330
|
}
|
|
@@ -5233,6 +5409,42 @@ var DaemonSessionClient = class _DaemonSessionClient {
|
|
|
5233
5409
|
}
|
|
5234
5410
|
return accepted;
|
|
5235
5411
|
}
|
|
5412
|
+
async uploadAttachment(data, name, mimeType, signal) {
|
|
5413
|
+
return await this.withClientIdSelfHeal(
|
|
5414
|
+
() => this.client.uploadSessionAttachment(
|
|
5415
|
+
this.sessionId,
|
|
5416
|
+
data,
|
|
5417
|
+
name,
|
|
5418
|
+
mimeType,
|
|
5419
|
+
{
|
|
5420
|
+
...signal ? { signal } : {},
|
|
5421
|
+
...this.clientId ? { clientId: this.clientId } : {}
|
|
5422
|
+
}
|
|
5423
|
+
)
|
|
5424
|
+
);
|
|
5425
|
+
}
|
|
5426
|
+
async readAttachment(attachmentId, signal) {
|
|
5427
|
+
return await this.withClientIdSelfHeal(
|
|
5428
|
+
() => this.client.readSessionAttachment(this.sessionId, attachmentId, {
|
|
5429
|
+
...signal ? { signal } : {},
|
|
5430
|
+
...this.clientId ? { clientId: this.clientId } : {}
|
|
5431
|
+
})
|
|
5432
|
+
);
|
|
5433
|
+
}
|
|
5434
|
+
async removeAttachment(attachmentId, signal) {
|
|
5435
|
+
const removed = await this.withClientIdSelfHeal(
|
|
5436
|
+
() => this.client.removeSessionAttachment(this.sessionId, attachmentId, {
|
|
5437
|
+
...signal ? { signal } : {},
|
|
5438
|
+
...this.clientId ? { clientId: this.clientId } : {}
|
|
5439
|
+
})
|
|
5440
|
+
);
|
|
5441
|
+
if (removed) {
|
|
5442
|
+
const cached = this.attachmentCache.get(attachmentId);
|
|
5443
|
+
this.attachmentCache.delete(attachmentId);
|
|
5444
|
+
this.attachmentCacheBytes -= cached?.size ?? 0;
|
|
5445
|
+
}
|
|
5446
|
+
return removed;
|
|
5447
|
+
}
|
|
5236
5448
|
/**
|
|
5237
5449
|
* Run a prompt-admission call, recovering from a stale `clientId`.
|
|
5238
5450
|
*
|
|
@@ -5287,55 +5499,48 @@ var DaemonSessionClient = class _DaemonSessionClient {
|
|
|
5287
5499
|
* policy. Forwards the bound `clientId` so identified clients update
|
|
5288
5500
|
* their per-client timestamp instead of just the session-wide one.
|
|
5289
5501
|
*/
|
|
5290
|
-
|
|
5291
|
-
return
|
|
5502
|
+
heartbeat() {
|
|
5503
|
+
return this.client.heartbeat(this.sessionId, this.clientId);
|
|
5292
5504
|
}
|
|
5293
|
-
|
|
5294
|
-
return
|
|
5295
|
-
this.sessionId,
|
|
5296
|
-
this.clientId
|
|
5297
|
-
);
|
|
5505
|
+
artifacts() {
|
|
5506
|
+
return this.client.listSessionArtifacts(this.sessionId, this.clientId);
|
|
5298
5507
|
}
|
|
5299
|
-
|
|
5300
|
-
return
|
|
5508
|
+
addArtifact(artifact) {
|
|
5509
|
+
return this.client.addSessionArtifact(
|
|
5301
5510
|
this.sessionId,
|
|
5302
5511
|
artifact,
|
|
5303
5512
|
this.clientId
|
|
5304
5513
|
);
|
|
5305
5514
|
}
|
|
5306
|
-
|
|
5307
|
-
return
|
|
5515
|
+
removeArtifact(artifactId) {
|
|
5516
|
+
return this.client.removeSessionArtifact(
|
|
5308
5517
|
this.sessionId,
|
|
5309
5518
|
artifactId,
|
|
5310
5519
|
this.clientId
|
|
5311
5520
|
);
|
|
5312
5521
|
}
|
|
5313
|
-
|
|
5314
|
-
return
|
|
5315
|
-
this.sessionId,
|
|
5316
|
-
modelId,
|
|
5317
|
-
this.clientId
|
|
5318
|
-
);
|
|
5522
|
+
setModel(modelId) {
|
|
5523
|
+
return this.client.setSessionModel(this.sessionId, modelId, this.clientId);
|
|
5319
5524
|
}
|
|
5320
|
-
|
|
5321
|
-
return
|
|
5525
|
+
setConfigOption(configId, value) {
|
|
5526
|
+
return this.client.setSessionConfigOption(
|
|
5322
5527
|
this.sessionId,
|
|
5323
5528
|
configId,
|
|
5324
5529
|
value,
|
|
5325
5530
|
this.clientId
|
|
5326
5531
|
);
|
|
5327
5532
|
}
|
|
5328
|
-
|
|
5329
|
-
return
|
|
5533
|
+
getRewindSnapshots() {
|
|
5534
|
+
return this.client.getRewindSnapshots(this.sessionId);
|
|
5330
5535
|
}
|
|
5331
|
-
|
|
5332
|
-
return
|
|
5536
|
+
rewind(promptId, opts) {
|
|
5537
|
+
return this.client.rewindSession(this.sessionId, promptId, {
|
|
5333
5538
|
clientId: this.clientId,
|
|
5334
5539
|
...opts?.rewindFiles !== void 0 ? { rewindFiles: opts.rewindFiles } : {}
|
|
5335
5540
|
});
|
|
5336
5541
|
}
|
|
5337
|
-
|
|
5338
|
-
return
|
|
5542
|
+
fork(directive) {
|
|
5543
|
+
return this.client.forkSession(
|
|
5339
5544
|
this.sessionId,
|
|
5340
5545
|
{ directive },
|
|
5341
5546
|
this.clientId
|
|
@@ -5349,8 +5554,8 @@ var DaemonSessionClient = class _DaemonSessionClient {
|
|
|
5349
5554
|
* child both run to completion regardless (no cross-process abort
|
|
5350
5555
|
* plumbing in v1).
|
|
5351
5556
|
*/
|
|
5352
|
-
|
|
5353
|
-
return
|
|
5557
|
+
recap(opts) {
|
|
5558
|
+
return this.client.recapSession(this.sessionId, {
|
|
5354
5559
|
...opts?.signal ? { signal: opts.signal } : {},
|
|
5355
5560
|
...this.clientId ? { clientId: this.clientId } : {}
|
|
5356
5561
|
});
|
|
@@ -5361,8 +5566,8 @@ var DaemonSessionClient = class _DaemonSessionClient {
|
|
|
5361
5566
|
...this.clientId ? { clientId: this.clientId } : {}
|
|
5362
5567
|
});
|
|
5363
5568
|
}
|
|
5364
|
-
|
|
5365
|
-
return
|
|
5569
|
+
btw(question, opts) {
|
|
5570
|
+
return this.client.btwSession(this.sessionId, question, {
|
|
5366
5571
|
...opts?.signal ? { signal: opts.signal } : {},
|
|
5367
5572
|
...this.clientId ? { clientId: this.clientId } : {}
|
|
5368
5573
|
});
|
|
@@ -5373,15 +5578,16 @@ var DaemonSessionClient = class _DaemonSessionClient {
|
|
|
5373
5578
|
* create/attach. Accepted requests become daemon-owned even when the active
|
|
5374
5579
|
* turn settles while the request is in flight.
|
|
5375
5580
|
*/
|
|
5376
|
-
|
|
5377
|
-
return
|
|
5581
|
+
enqueueMidTurnMessage(message, opts) {
|
|
5582
|
+
return this.client.enqueueMidTurnMessage(this.sessionId, message, {
|
|
5378
5583
|
...opts?.signal ? { signal: opts.signal } : {},
|
|
5379
5584
|
...opts?.messageId ? { messageId: opts.messageId } : {},
|
|
5585
|
+
...opts?.content && opts.content.length > 0 ? { content: opts.content } : {},
|
|
5380
5586
|
...this.clientId ? { clientId: this.clientId } : {}
|
|
5381
5587
|
});
|
|
5382
5588
|
}
|
|
5383
|
-
|
|
5384
|
-
return
|
|
5589
|
+
removeMidTurnMessage(messageId) {
|
|
5590
|
+
return this.client.removeMidTurnMessage(this.sessionId, messageId, {
|
|
5385
5591
|
...this.clientId ? { clientId: this.clientId } : {}
|
|
5386
5592
|
});
|
|
5387
5593
|
}
|
|
@@ -5393,18 +5599,47 @@ var DaemonSessionClient = class _DaemonSessionClient {
|
|
|
5393
5599
|
* callers preserve their current state.
|
|
5394
5600
|
*/
|
|
5395
5601
|
async getMidTurnMessages(opts) {
|
|
5396
|
-
|
|
5602
|
+
const result = await this.client.getMidTurnMessages(this.sessionId, {
|
|
5397
5603
|
...opts?.signal ? { signal: opts.signal } : {},
|
|
5398
5604
|
...this.clientId ? { clientId: this.clientId } : {}
|
|
5399
5605
|
});
|
|
5606
|
+
return {
|
|
5607
|
+
...result,
|
|
5608
|
+
messages: await Promise.all(
|
|
5609
|
+
result.messages.map(async (message) => ({
|
|
5610
|
+
...message,
|
|
5611
|
+
...message.content ? { content: await this.hydrateContent(message.content) } : {}
|
|
5612
|
+
}))
|
|
5613
|
+
)
|
|
5614
|
+
};
|
|
5400
5615
|
}
|
|
5401
5616
|
async getPendingPrompts() {
|
|
5402
|
-
|
|
5617
|
+
const result = await this.client.getPendingPrompts(this.sessionId, {
|
|
5403
5618
|
...this.clientId ? { clientId: this.clientId } : {}
|
|
5404
5619
|
});
|
|
5620
|
+
return {
|
|
5621
|
+
pendingPrompts: await Promise.all(
|
|
5622
|
+
result.pendingPrompts.map(async (prompt) => ({
|
|
5623
|
+
...prompt,
|
|
5624
|
+
...prompt.content ? { content: await this.hydrateContent(prompt.content) } : {}
|
|
5625
|
+
}))
|
|
5626
|
+
)
|
|
5627
|
+
};
|
|
5628
|
+
}
|
|
5629
|
+
async getTranscriptPage(opts = {}) {
|
|
5630
|
+
const page = await this.client.getSessionTranscriptPage(this.sessionId, {
|
|
5631
|
+
...opts,
|
|
5632
|
+
clientId: opts.clientId ?? this.clientId
|
|
5633
|
+
});
|
|
5634
|
+
return {
|
|
5635
|
+
...page,
|
|
5636
|
+
events: await Promise.all(
|
|
5637
|
+
page.events.map(async (event) => await this.hydrateEvent(event))
|
|
5638
|
+
)
|
|
5639
|
+
};
|
|
5405
5640
|
}
|
|
5406
|
-
|
|
5407
|
-
return
|
|
5641
|
+
removePendingPrompt(promptId) {
|
|
5642
|
+
return this.client.removePendingPrompt(this.sessionId, promptId, {
|
|
5408
5643
|
...this.clientId ? { clientId: this.clientId } : {}
|
|
5409
5644
|
});
|
|
5410
5645
|
}
|
|
@@ -5414,50 +5649,53 @@ var DaemonSessionClient = class _DaemonSessionClient {
|
|
|
5414
5649
|
* automatically forwards the client id bound when the session was created
|
|
5415
5650
|
* or attached.
|
|
5416
5651
|
*/
|
|
5417
|
-
|
|
5418
|
-
return
|
|
5652
|
+
shellCommand(command, signal) {
|
|
5653
|
+
return this.client.shellCommand(this.sessionId, command, {
|
|
5419
5654
|
...signal ? { signal } : {},
|
|
5420
5655
|
...this.clientId ? { clientId: this.clientId } : {}
|
|
5421
5656
|
});
|
|
5422
5657
|
}
|
|
5423
|
-
|
|
5424
|
-
return
|
|
5658
|
+
context() {
|
|
5659
|
+
return this.client.sessionContext(this.sessionId, this.clientId);
|
|
5425
5660
|
}
|
|
5426
|
-
|
|
5427
|
-
return
|
|
5661
|
+
status() {
|
|
5662
|
+
return this.client.sessionStatus(this.sessionId, this.clientId);
|
|
5428
5663
|
}
|
|
5429
|
-
|
|
5430
|
-
return
|
|
5431
|
-
this.sessionId,
|
|
5432
|
-
opts,
|
|
5433
|
-
this.clientId
|
|
5434
|
-
);
|
|
5664
|
+
contextUsage(opts = {}) {
|
|
5665
|
+
return this.client.sessionContextUsage(this.sessionId, opts, this.clientId);
|
|
5435
5666
|
}
|
|
5436
|
-
|
|
5437
|
-
return
|
|
5438
|
-
this.sessionId,
|
|
5439
|
-
this.clientId
|
|
5440
|
-
);
|
|
5667
|
+
supportedCommands() {
|
|
5668
|
+
return this.client.sessionSupportedCommands(this.sessionId, this.clientId);
|
|
5441
5669
|
}
|
|
5442
|
-
|
|
5443
|
-
return
|
|
5670
|
+
tasks() {
|
|
5671
|
+
return this.client.sessionTasks(this.sessionId, this.clientId);
|
|
5444
5672
|
}
|
|
5445
|
-
|
|
5446
|
-
return
|
|
5673
|
+
lspStatus() {
|
|
5674
|
+
return this.client.sessionLspStatus(this.sessionId, this.clientId);
|
|
5447
5675
|
}
|
|
5448
|
-
|
|
5449
|
-
return
|
|
5676
|
+
cancelTask(taskId, kind) {
|
|
5677
|
+
return this.client.sessionTaskCancel(
|
|
5450
5678
|
this.sessionId,
|
|
5451
5679
|
taskId,
|
|
5452
5680
|
kind,
|
|
5453
5681
|
this.clientId
|
|
5454
5682
|
);
|
|
5455
5683
|
}
|
|
5456
|
-
|
|
5457
|
-
return
|
|
5684
|
+
clearGoal() {
|
|
5685
|
+
return this.client.sessionGoalClear(this.sessionId, this.clientId);
|
|
5686
|
+
}
|
|
5687
|
+
goal() {
|
|
5688
|
+
return this.client.sessionGoal(this.sessionId, this.clientId);
|
|
5689
|
+
}
|
|
5690
|
+
controlGoal(request) {
|
|
5691
|
+
return this.client.sessionGoalControl(
|
|
5692
|
+
this.sessionId,
|
|
5693
|
+
request,
|
|
5694
|
+
this.clientId
|
|
5695
|
+
);
|
|
5458
5696
|
}
|
|
5459
|
-
|
|
5460
|
-
return
|
|
5697
|
+
stats() {
|
|
5698
|
+
return this.client.sessionStats(this.sessionId, this.clientId);
|
|
5461
5699
|
}
|
|
5462
5700
|
async respondToPermission(requestId, response) {
|
|
5463
5701
|
return await this.client.respondToPermission(
|
|
@@ -5581,8 +5819,9 @@ var DaemonSessionClient = class _DaemonSessionClient {
|
|
|
5581
5819
|
callerOnEpoch?.(learned);
|
|
5582
5820
|
}, "onEpoch")
|
|
5583
5821
|
})) {
|
|
5584
|
-
this.
|
|
5585
|
-
|
|
5822
|
+
const hydratedEvent = await this.hydrateEvent(event);
|
|
5823
|
+
this._dispatchTurnEvent(hydratedEvent);
|
|
5824
|
+
yield hydratedEvent;
|
|
5586
5825
|
if (event.id !== void 0) {
|
|
5587
5826
|
this.lastSeenEventId = Math.max(
|
|
5588
5827
|
this.lastSeenEventId ?? 0,
|
|
@@ -5595,6 +5834,113 @@ var DaemonSessionClient = class _DaemonSessionClient {
|
|
|
5595
5834
|
release();
|
|
5596
5835
|
}
|
|
5597
5836
|
}
|
|
5837
|
+
async hydrateReplaySnapshot() {
|
|
5838
|
+
this.replaySnapshot.compactedReplay = await Promise.all(
|
|
5839
|
+
this.replaySnapshot.compactedReplay.map(
|
|
5840
|
+
async (event) => await this.hydrateEvent(event)
|
|
5841
|
+
)
|
|
5842
|
+
);
|
|
5843
|
+
this.replaySnapshot.liveJournal = await Promise.all(
|
|
5844
|
+
this.replaySnapshot.liveJournal.map(
|
|
5845
|
+
async (event) => await this.hydrateEvent(event)
|
|
5846
|
+
)
|
|
5847
|
+
);
|
|
5848
|
+
}
|
|
5849
|
+
async hydrateEvent(event) {
|
|
5850
|
+
if (!event.data || typeof event.data !== "object") return event;
|
|
5851
|
+
const data = event.data;
|
|
5852
|
+
if (event.type === "session_update") {
|
|
5853
|
+
const update = data["update"];
|
|
5854
|
+
if (update && typeof update === "object" && !Array.isArray(update)) {
|
|
5855
|
+
const content2 = update["content"];
|
|
5856
|
+
const hydrated2 = await this.hydrateBlock(content2);
|
|
5857
|
+
if (hydrated2 === content2) return event;
|
|
5858
|
+
return {
|
|
5859
|
+
...event,
|
|
5860
|
+
data: { ...data, update: { ...update, content: hydrated2 } }
|
|
5861
|
+
};
|
|
5862
|
+
}
|
|
5863
|
+
const content = data["content"];
|
|
5864
|
+
const hydrated = await this.hydrateBlock(content);
|
|
5865
|
+
if (hydrated === content) return event;
|
|
5866
|
+
return { ...event, data: { ...data, content: hydrated } };
|
|
5867
|
+
}
|
|
5868
|
+
if (event.type !== "mid_turn_message_injected") return event;
|
|
5869
|
+
const items = data["items"];
|
|
5870
|
+
if (!Array.isArray(items)) return event;
|
|
5871
|
+
return {
|
|
5872
|
+
...event,
|
|
5873
|
+
data: {
|
|
5874
|
+
...data,
|
|
5875
|
+
items: await Promise.all(
|
|
5876
|
+
items.map(async (item) => {
|
|
5877
|
+
if (!item || typeof item !== "object" || Array.isArray(item)) {
|
|
5878
|
+
return item;
|
|
5879
|
+
}
|
|
5880
|
+
const record = item;
|
|
5881
|
+
return Array.isArray(record["content"]) ? {
|
|
5882
|
+
...record,
|
|
5883
|
+
content: await this.hydrateContent(record["content"])
|
|
5884
|
+
} : item;
|
|
5885
|
+
})
|
|
5886
|
+
)
|
|
5887
|
+
}
|
|
5888
|
+
};
|
|
5889
|
+
}
|
|
5890
|
+
async hydrateContent(content) {
|
|
5891
|
+
return await Promise.all(
|
|
5892
|
+
content.map(async (block) => await this.hydrateBlock(block))
|
|
5893
|
+
);
|
|
5894
|
+
}
|
|
5895
|
+
async hydrateBlock(block) {
|
|
5896
|
+
if (!isSessionAttachmentReference(block)) {
|
|
5897
|
+
return block;
|
|
5898
|
+
}
|
|
5899
|
+
if (block.type === "resource") return block;
|
|
5900
|
+
let cached = this.attachmentCache.get(block.attachmentId);
|
|
5901
|
+
if (cached) {
|
|
5902
|
+
this.attachmentCache.delete(block.attachmentId);
|
|
5903
|
+
this.attachmentCache.set(block.attachmentId, cached);
|
|
5904
|
+
} else {
|
|
5905
|
+
const pending = this.withClientIdSelfHeal(
|
|
5906
|
+
() => this.client.readSessionAttachment(this.sessionId, block.attachmentId, {
|
|
5907
|
+
...this.clientId ? { clientId: this.clientId } : {}
|
|
5908
|
+
})
|
|
5909
|
+
);
|
|
5910
|
+
cached = { pending, size: block.size };
|
|
5911
|
+
this.attachmentCache.set(block.attachmentId, cached);
|
|
5912
|
+
this.attachmentCacheBytes += block.size;
|
|
5913
|
+
while (this.attachmentCache.size > MAX_ATTACHMENT_CACHE_ENTRIES || this.attachmentCacheBytes > MAX_ATTACHMENT_CACHE_BYTES) {
|
|
5914
|
+
const oldestId = this.attachmentCache.keys().next().value;
|
|
5915
|
+
if (oldestId === void 0) break;
|
|
5916
|
+
const evicted = this.attachmentCache.get(oldestId);
|
|
5917
|
+
this.attachmentCache.delete(oldestId);
|
|
5918
|
+
this.attachmentCacheBytes -= evicted?.size ?? 0;
|
|
5919
|
+
}
|
|
5920
|
+
void pending.catch(() => {
|
|
5921
|
+
if (this.attachmentCache.get(block.attachmentId)?.pending !== pending)
|
|
5922
|
+
return;
|
|
5923
|
+
this.attachmentCache.delete(block.attachmentId);
|
|
5924
|
+
this.attachmentCacheBytes -= block.size;
|
|
5925
|
+
});
|
|
5926
|
+
}
|
|
5927
|
+
try {
|
|
5928
|
+
const attachment = await cached.pending;
|
|
5929
|
+
return {
|
|
5930
|
+
type: "image",
|
|
5931
|
+
data: attachment.data,
|
|
5932
|
+
mimeType: attachment.mimeType
|
|
5933
|
+
};
|
|
5934
|
+
} catch (err) {
|
|
5935
|
+
if (err instanceof DaemonHttpError && (err.status === 404 || err.status === 410)) {
|
|
5936
|
+
return {
|
|
5937
|
+
type: "text",
|
|
5938
|
+
text: "[Attachment is no longer available]"
|
|
5939
|
+
};
|
|
5940
|
+
}
|
|
5941
|
+
return block;
|
|
5942
|
+
}
|
|
5943
|
+
}
|
|
5598
5944
|
_dispatchTurnEvent(event) {
|
|
5599
5945
|
if (event.type !== "turn_complete" && event.type !== "turn_error") return;
|
|
5600
5946
|
const promptId = event.data?.promptId;
|
|
@@ -5931,7 +6277,7 @@ function asKnownDaemonEvent(event) {
|
|
|
5931
6277
|
case "tool_toggled":
|
|
5932
6278
|
return isToolToggledData(event.data) ? event : void 0;
|
|
5933
6279
|
case "settings_changed":
|
|
5934
|
-
return event.data
|
|
6280
|
+
return isSettingsChangedData(event.data) ? event : void 0;
|
|
5935
6281
|
case "trust_change_requested":
|
|
5936
6282
|
return isTrustChangeRequestedData(event.data) ? event : void 0;
|
|
5937
6283
|
case "workspace_initialized":
|
|
@@ -6633,6 +6979,19 @@ function isToolToggledData(value) {
|
|
|
6633
6979
|
return isRecord(value) && isNonEmptyString(value["toolName"]) && typeof value["enabled"] === "boolean";
|
|
6634
6980
|
}
|
|
6635
6981
|
__name(isToolToggledData, "isToolToggledData");
|
|
6982
|
+
function isDaemonSkillToggleMutation(value) {
|
|
6983
|
+
if (!isRecord(value)) return false;
|
|
6984
|
+
const activation = value["activation"];
|
|
6985
|
+
const skills = value["skills"];
|
|
6986
|
+
return isNonEmptyString(value["id"]) && value["kind"] === "skill_toggle" && Array.isArray(skills) && skills.length > 0 && skills.every(
|
|
6987
|
+
(skill) => isRecord(skill) && isNonEmptyString(skill["name"]) && typeof skill["enabled"] === "boolean"
|
|
6988
|
+
) && (activation === "applied" || activation === "deferred" || activation === "partial") && isFiniteNumber(value["sessionsRefreshed"]) && isFiniteNumber(value["sessionsFailed"]);
|
|
6989
|
+
}
|
|
6990
|
+
__name(isDaemonSkillToggleMutation, "isDaemonSkillToggleMutation");
|
|
6991
|
+
function isSettingsChangedData(value) {
|
|
6992
|
+
return isRecord(value) && isNonEmptyString(value["key"]) && (value["scope"] === void 0 || typeof value["scope"] === "string") && (value["mutation"] === void 0 || isDaemonSkillToggleMutation(value["mutation"]));
|
|
6993
|
+
}
|
|
6994
|
+
__name(isSettingsChangedData, "isSettingsChangedData");
|
|
6636
6995
|
function isTrustChangeRequestedData(value) {
|
|
6637
6996
|
if (!isRecord(value)) return false;
|
|
6638
6997
|
const desiredState = value["desiredState"];
|
|
@@ -6880,6 +7239,16 @@ var DAEMON_UI_DEBUG_REASONS = [
|
|
|
6880
7239
|
"unrecognized_session_update",
|
|
6881
7240
|
"malformed_payload"
|
|
6882
7241
|
];
|
|
7242
|
+
var DAEMON_UI_UNRECOGNIZED_DIAGNOSTIC_REASONS = [
|
|
7243
|
+
"unrecognized_event",
|
|
7244
|
+
"unrecognized_session_update"
|
|
7245
|
+
];
|
|
7246
|
+
function isUnrecognizedDiagnosticReason(reason) {
|
|
7247
|
+
return reason !== void 0 && DAEMON_UI_UNRECOGNIZED_DIAGNOSTIC_REASONS.includes(
|
|
7248
|
+
reason
|
|
7249
|
+
);
|
|
7250
|
+
}
|
|
7251
|
+
__name(isUnrecognizedDiagnosticReason, "isUnrecognizedDiagnosticReason");
|
|
6883
7252
|
|
|
6884
7253
|
// packages/sdk-typescript/src/daemon/ui/utils.ts
|
|
6885
7254
|
init_esbuild_shims();
|
|
@@ -6918,6 +7287,16 @@ function stringifyRedactedJson(value) {
|
|
|
6918
7287
|
return stringifyJson(redactSensitiveFields(value));
|
|
6919
7288
|
}
|
|
6920
7289
|
__name(stringifyRedactedJson, "stringifyRedactedJson");
|
|
7290
|
+
var MAX_DETAILS_LENGTH = 4096;
|
|
7291
|
+
function detachString(value) {
|
|
7292
|
+
return new TextDecoder("utf-8").decode(new TextEncoder().encode(value));
|
|
7293
|
+
}
|
|
7294
|
+
__name(detachString, "detachString");
|
|
7295
|
+
function capDetails(details) {
|
|
7296
|
+
if (details.length <= MAX_DETAILS_LENGTH) return details;
|
|
7297
|
+
return `${detachString(details.slice(0, MAX_DETAILS_LENGTH))}... [truncated]`;
|
|
7298
|
+
}
|
|
7299
|
+
__name(capDetails, "capDetails");
|
|
6921
7300
|
function redactSensitiveFields(value, depth = 0) {
|
|
6922
7301
|
if (depth > 16) return "[truncated]";
|
|
6923
7302
|
if (Array.isArray(value)) {
|
|
@@ -7075,8 +7454,8 @@ var MCP_RESTART_REFUSED_REASONS2 = /* @__PURE__ */ new Set([
|
|
|
7075
7454
|
"authentication_required"
|
|
7076
7455
|
]);
|
|
7077
7456
|
var MALFORMED_MEMORY_CHANGED = "malformed memory_changed payload";
|
|
7078
|
-
var MAX_DETAILS_LENGTH = 4096;
|
|
7079
7457
|
var SESSION_RECORDING_DEGRADED_MESSAGE = "Session recording stopped after a write failure. New messages for the affected session will not be saved. Check disk space and permissions, then start a new session to resume recording.";
|
|
7458
|
+
var ATTACHMENT_UNAVAILABLE_TEXT = "[Attachment is no longer available]";
|
|
7080
7459
|
function normalizeDaemonEvent(event, opts = {}) {
|
|
7081
7460
|
const base = createBase(event, opts);
|
|
7082
7461
|
switch (event.type) {
|
|
@@ -7338,7 +7717,10 @@ function normalizeUnrecognizedEvent(event, base) {
|
|
|
7338
7717
|
...base,
|
|
7339
7718
|
type: "debug",
|
|
7340
7719
|
debugReason: "unrecognized_event",
|
|
7341
|
-
text:
|
|
7720
|
+
text: debugBlockText(
|
|
7721
|
+
`${event.type} (unrecognized daemon event)`,
|
|
7722
|
+
event.data
|
|
7723
|
+
)
|
|
7342
7724
|
}
|
|
7343
7725
|
];
|
|
7344
7726
|
}
|
|
@@ -7453,21 +7835,37 @@ function normalizeMidTurnMessageInjected(event, base) {
|
|
|
7453
7835
|
if (!isRecord2(event.data)) {
|
|
7454
7836
|
return fallbackDebug(event, base, "malformed mid_turn_message_injected");
|
|
7455
7837
|
}
|
|
7456
|
-
const
|
|
7457
|
-
|
|
7458
|
-
)
|
|
7459
|
-
|
|
7838
|
+
const data = event.data;
|
|
7839
|
+
const rawMessages = data["messages"];
|
|
7840
|
+
const messages = Array.isArray(rawMessages) && rawMessages.every(
|
|
7841
|
+
(message) => typeof message === "string"
|
|
7842
|
+
) ? rawMessages : [];
|
|
7843
|
+
const items = data["items"];
|
|
7844
|
+
const hasRenderableItemContent = Array.isArray(items) && items.some(
|
|
7845
|
+
(item) => isRecord2(item) && Array.isArray(item["content"]) && item["content"].some(
|
|
7846
|
+
(block) => isRecord2(block) && (block["type"] === "image" || block["type"] === "resource" || block["type"] === "text" && typeof block["text"] === "string" && block["text"].length > 0)
|
|
7847
|
+
)
|
|
7848
|
+
);
|
|
7849
|
+
if (messages.length === 0 || !messages.some(Boolean) && !hasRenderableItemContent) {
|
|
7460
7850
|
return fallbackDebug(event, base, "malformed mid_turn_message_injected");
|
|
7461
7851
|
}
|
|
7462
|
-
|
|
7463
|
-
|
|
7852
|
+
const messageIds = Array.isArray(data["messageIds"]) ? data["messageIds"] : [];
|
|
7853
|
+
return messages.map((text, index) => {
|
|
7854
|
+
const item = Array.isArray(items) ? items[index] : void 0;
|
|
7855
|
+
const messageId = messageIds[index];
|
|
7856
|
+
return {
|
|
7464
7857
|
...base,
|
|
7465
7858
|
type: "status",
|
|
7466
|
-
text
|
|
7859
|
+
text,
|
|
7467
7860
|
source: "mid_turn_message_injected",
|
|
7468
|
-
data:
|
|
7469
|
-
|
|
7470
|
-
|
|
7861
|
+
data: {
|
|
7862
|
+
...data,
|
|
7863
|
+
messages: [text],
|
|
7864
|
+
...Array.isArray(items) ? { items: item !== void 0 ? [item] : [] } : {},
|
|
7865
|
+
...typeof messageId === "string" ? { messageIds: [messageId] } : Array.isArray(data["messageIds"]) ? { messageIds: [] } : {}
|
|
7866
|
+
}
|
|
7867
|
+
};
|
|
7868
|
+
});
|
|
7471
7869
|
}
|
|
7472
7870
|
__name(normalizeMidTurnMessageInjected, "normalizeMidTurnMessageInjected");
|
|
7473
7871
|
function createBase(event, opts) {
|
|
@@ -7540,6 +7938,10 @@ function parseTimestamp(value) {
|
|
|
7540
7938
|
return Number.isFinite(parsed) ? parsed : void 0;
|
|
7541
7939
|
}
|
|
7542
7940
|
__name(parseTimestamp, "parseTimestamp");
|
|
7941
|
+
function isAttachmentReferenceContent(value) {
|
|
7942
|
+
return isRecord2(value) && (value["type"] === "image" || value["type"] === "resource") && typeof value["attachmentId"] === "string" && value["attachmentId"].length > 0 && value["data"] === void 0 && value["url"] === void 0 && value["source"] === void 0;
|
|
7943
|
+
}
|
|
7944
|
+
__name(isAttachmentReferenceContent, "isAttachmentReferenceContent");
|
|
7543
7945
|
function normalizeSessionUpdate(event, base, opts) {
|
|
7544
7946
|
const update = getSessionUpdatePayload(event.data);
|
|
7545
7947
|
if (!update) {
|
|
@@ -7548,7 +7950,7 @@ function normalizeSessionUpdate(event, base, opts) {
|
|
|
7548
7950
|
...base,
|
|
7549
7951
|
type: "debug",
|
|
7550
7952
|
debugReason: "malformed_payload",
|
|
7551
|
-
text:
|
|
7953
|
+
text: debugBlockText("session_update", event.data)
|
|
7552
7954
|
}
|
|
7553
7955
|
];
|
|
7554
7956
|
}
|
|
@@ -7574,7 +7976,15 @@ function normalizeSessionUpdate(event, base, opts) {
|
|
|
7574
7976
|
else if (prefix.startsWith("UklGR")) mimeType = "image/webp";
|
|
7575
7977
|
}
|
|
7576
7978
|
if (data) {
|
|
7577
|
-
return [
|
|
7979
|
+
return [
|
|
7980
|
+
{
|
|
7981
|
+
...base,
|
|
7982
|
+
type: "user.image.delta",
|
|
7983
|
+
data,
|
|
7984
|
+
mimeType,
|
|
7985
|
+
...meta ? { meta } : {}
|
|
7986
|
+
}
|
|
7987
|
+
];
|
|
7578
7988
|
}
|
|
7579
7989
|
return [];
|
|
7580
7990
|
}
|
|
@@ -7590,6 +8000,30 @@ function normalizeSessionUpdate(event, base, opts) {
|
|
|
7590
8000
|
}
|
|
7591
8001
|
return [];
|
|
7592
8002
|
}
|
|
8003
|
+
if (isAttachmentReferenceContent(content)) {
|
|
8004
|
+
if (content["type"] === "resource") {
|
|
8005
|
+
const attachmentId = content["attachmentId"];
|
|
8006
|
+
const mimeType = content["mimeType"];
|
|
8007
|
+
return [
|
|
8008
|
+
{
|
|
8009
|
+
...base,
|
|
8010
|
+
type: "user.file.delta",
|
|
8011
|
+
name: attachmentId,
|
|
8012
|
+
attachmentId,
|
|
8013
|
+
mimeType: typeof mimeType === "string" ? mimeType : "",
|
|
8014
|
+
...meta ? { meta } : {}
|
|
8015
|
+
}
|
|
8016
|
+
];
|
|
8017
|
+
}
|
|
8018
|
+
return [
|
|
8019
|
+
{
|
|
8020
|
+
...base,
|
|
8021
|
+
type: "user.text.delta",
|
|
8022
|
+
text: ATTACHMENT_UNAVAILABLE_TEXT,
|
|
8023
|
+
...meta ? { meta } : {}
|
|
8024
|
+
}
|
|
8025
|
+
];
|
|
8026
|
+
}
|
|
7593
8027
|
const text = getTextContent(content);
|
|
7594
8028
|
return text ? [
|
|
7595
8029
|
{
|
|
@@ -7692,7 +8126,7 @@ function normalizeSessionUpdate(event, base, opts) {
|
|
|
7692
8126
|
// discriminator is truthy but no more usable than an empty one, so
|
|
7693
8127
|
// apply the same `trim()` convention `getFirstString` uses.
|
|
7694
8128
|
debugReason: kind?.trim() ? "unrecognized_session_update" : "malformed_payload",
|
|
7695
|
-
text:
|
|
8129
|
+
text: debugBlockText(kind ?? "session_update", update)
|
|
7696
8130
|
}
|
|
7697
8131
|
];
|
|
7698
8132
|
}
|
|
@@ -7863,11 +8297,10 @@ function asDaemonErrorKind(value) {
|
|
|
7863
8297
|
return DAEMON_ERROR_KIND_SET.has(value) ? value : void 0;
|
|
7864
8298
|
}
|
|
7865
8299
|
__name(asDaemonErrorKind, "asDaemonErrorKind");
|
|
7866
|
-
function
|
|
7867
|
-
|
|
7868
|
-
return `${details.slice(0, MAX_DETAILS_LENGTH)}... [truncated]`;
|
|
8300
|
+
function debugBlockText(prefix, data) {
|
|
8301
|
+
return capDetails(`${prefix}: ${stringifyRedactedJson(data)}`);
|
|
7869
8302
|
}
|
|
7870
|
-
__name(
|
|
8303
|
+
__name(debugBlockText, "debugBlockText");
|
|
7871
8304
|
function normalizePermissionRequest(event, base) {
|
|
7872
8305
|
if (!isRecord2(event.data)) {
|
|
7873
8306
|
return [
|
|
@@ -7875,7 +8308,7 @@ function normalizePermissionRequest(event, base) {
|
|
|
7875
8308
|
...base,
|
|
7876
8309
|
type: "debug",
|
|
7877
8310
|
debugReason: "malformed_payload",
|
|
7878
|
-
text:
|
|
8311
|
+
text: debugBlockText("permission_request", event.data)
|
|
7879
8312
|
}
|
|
7880
8313
|
];
|
|
7881
8314
|
}
|
|
@@ -7886,7 +8319,7 @@ function normalizePermissionRequest(event, base) {
|
|
|
7886
8319
|
...base,
|
|
7887
8320
|
type: "debug",
|
|
7888
8321
|
debugReason: "malformed_payload",
|
|
7889
|
-
text:
|
|
8322
|
+
text: debugBlockText("permission_request", event.data)
|
|
7890
8323
|
}
|
|
7891
8324
|
];
|
|
7892
8325
|
}
|
|
@@ -7912,7 +8345,7 @@ function normalizePermissionResolved(event, base) {
|
|
|
7912
8345
|
...base,
|
|
7913
8346
|
type: "debug",
|
|
7914
8347
|
debugReason: "malformed_payload",
|
|
7915
|
-
text:
|
|
8348
|
+
text: debugBlockText(event.type, event.data)
|
|
7916
8349
|
}
|
|
7917
8350
|
];
|
|
7918
8351
|
}
|
|
@@ -8128,13 +8561,15 @@ function normalizeSettingsChanged(event, base) {
|
|
|
8128
8561
|
if (!key) {
|
|
8129
8562
|
return fallbackDebug(event, base, "malformed settings_changed payload");
|
|
8130
8563
|
}
|
|
8564
|
+
const mutation = isSettingsChangedData(event.data) && event.data.mutation;
|
|
8131
8565
|
return [
|
|
8132
8566
|
{
|
|
8133
8567
|
...base,
|
|
8134
8568
|
type: "workspace.settings.changed",
|
|
8135
8569
|
key,
|
|
8136
8570
|
scope: scope ?? "workspace",
|
|
8137
|
-
value: isRecord2(event.data) ? event.data["value"] : void 0
|
|
8571
|
+
value: isRecord2(event.data) ? event.data["value"] : void 0,
|
|
8572
|
+
...mutation ? { mutation } : {}
|
|
8138
8573
|
}
|
|
8139
8574
|
];
|
|
8140
8575
|
}
|
|
@@ -8699,7 +9134,7 @@ function collectPreviewRows(input) {
|
|
|
8699
9134
|
if (isRecord2(value)) continue;
|
|
8700
9135
|
rows.push({
|
|
8701
9136
|
label: key,
|
|
8702
|
-
value: isSensitiveKey(key) ? "[redacted]" : stringifyRedactedJson(value)
|
|
9137
|
+
value: isSensitiveKey(key) ? "[redacted]" : capDetails(stringifyRedactedJson(value))
|
|
8703
9138
|
});
|
|
8704
9139
|
}
|
|
8705
9140
|
return rows;
|
|
@@ -8862,8 +9297,18 @@ __name(detectTabular, "detectTabular");
|
|
|
8862
9297
|
// packages/sdk-typescript/src/daemon/ui/transcript.ts
|
|
8863
9298
|
init_esbuild_shims();
|
|
8864
9299
|
var DEFAULT_MAX_BLOCKS = 1e3;
|
|
9300
|
+
var DEFAULT_MAX_RETAINED_BYTES = 128 * 1024 * 1024;
|
|
9301
|
+
var UNRECOGNIZED_DIAGNOSTICS_LIMIT = 50;
|
|
8865
9302
|
var TRIMMED_TOOL_BLOCK_ID = "__trimmed_tool_block__";
|
|
8866
9303
|
var TRIMMED_PERMISSION_BLOCK_ID = "__trimmed_permission_block__";
|
|
9304
|
+
function isTrimmedToolBlockId(blockId) {
|
|
9305
|
+
return blockId === TRIMMED_TOOL_BLOCK_ID;
|
|
9306
|
+
}
|
|
9307
|
+
__name(isTrimmedToolBlockId, "isTrimmedToolBlockId");
|
|
9308
|
+
function isTrimmedPermissionBlockId(blockId) {
|
|
9309
|
+
return blockId === TRIMMED_PERMISSION_BLOCK_ID;
|
|
9310
|
+
}
|
|
9311
|
+
__name(isTrimmedPermissionBlockId, "isTrimmedPermissionBlockId");
|
|
8867
9312
|
var MAX_TEXT_BLOCK_LENGTH = 1e5;
|
|
8868
9313
|
var TEXT_TRUNCATED_SUFFIX = "\n[truncated]\n";
|
|
8869
9314
|
var MAX_CLONE_DEPTH = 16;
|
|
@@ -8880,11 +9325,14 @@ function createDaemonTranscriptState(opts = {}) {
|
|
|
8880
9325
|
activeThoughtBlockByParent: createIndex(),
|
|
8881
9326
|
// PR-E sidechannel: track current tool / approval mode / progress
|
|
8882
9327
|
toolProgress: createIndex(),
|
|
9328
|
+
unrecognizedDiagnostics: [],
|
|
8883
9329
|
awaitingResync: false,
|
|
8884
9330
|
resyncRequiredCount: 0,
|
|
8885
9331
|
nextOrdinal: 1,
|
|
8886
9332
|
now: opts.now ?? Date.now(),
|
|
8887
9333
|
maxBlocks: opts.maxBlocks ?? DEFAULT_MAX_BLOCKS,
|
|
9334
|
+
retainedBytes: 0,
|
|
9335
|
+
maxRetainedBytes: opts.maxRetainedBytes ?? DEFAULT_MAX_RETAINED_BYTES,
|
|
8888
9336
|
retainSubagentBlocks: opts.retainSubagentBlocks ?? true
|
|
8889
9337
|
};
|
|
8890
9338
|
if (opts.onTruncation) truncationCallbacks.set(state, opts.onTruncation);
|
|
@@ -8934,14 +9382,15 @@ function appendLocalUserTranscriptMessage(state, text, opts = {}) {
|
|
|
8934
9382
|
return trimTranscriptState(next);
|
|
8935
9383
|
}
|
|
8936
9384
|
__name(appendLocalUserTranscriptMessage, "appendLocalUserTranscriptMessage");
|
|
8937
|
-
var
|
|
9385
|
+
var FREEZE_TRANSCRIPT_COLLECTIONS = typeof process !== "undefined" && false;
|
|
8938
9386
|
function reduceDaemonTranscriptEvents(state, events, opts = {}) {
|
|
8939
9387
|
if (events.length === 0) return state;
|
|
8940
9388
|
const next = cloneTranscriptState(state, opts);
|
|
8941
9389
|
for (const event of events) applyDaemonTranscriptEvent(next, event);
|
|
8942
9390
|
const result = trimTranscriptState(next);
|
|
8943
|
-
if (
|
|
9391
|
+
if (FREEZE_TRANSCRIPT_COLLECTIONS) {
|
|
8944
9392
|
Object.freeze(result.blocks);
|
|
9393
|
+
Object.freeze(result.blockIndexById);
|
|
8945
9394
|
}
|
|
8946
9395
|
return result;
|
|
8947
9396
|
}
|
|
@@ -8954,6 +9403,28 @@ function rebuildDaemonTranscriptBlockIndex(blocks) {
|
|
|
8954
9403
|
return blockIndexById;
|
|
8955
9404
|
}
|
|
8956
9405
|
__name(rebuildDaemonTranscriptBlockIndex, "rebuildDaemonTranscriptBlockIndex");
|
|
9406
|
+
function userBlockForAttachment(next, event) {
|
|
9407
|
+
const activeUserIndex = next.activeUserBlockId ? next.blockIndexById[next.activeUserBlockId] : void 0;
|
|
9408
|
+
const activeUser = activeUserIndex !== void 0 ? next.blocks[activeUserIndex] : void 0;
|
|
9409
|
+
if (activeUser?.kind === "user" && stringArraysEqual(activeUser.sourceRecordIds, event.sourceRecordIds)) {
|
|
9410
|
+
const block2 = getWritableBlockById(next, activeUser.id);
|
|
9411
|
+
if (block2?.kind === "user") return block2;
|
|
9412
|
+
}
|
|
9413
|
+
const block = createTextBlock(
|
|
9414
|
+
next,
|
|
9415
|
+
"user",
|
|
9416
|
+
"",
|
|
9417
|
+
event.eventId,
|
|
9418
|
+
event.serverTimestamp,
|
|
9419
|
+
event.meta,
|
|
9420
|
+
event.sourceRecordIds,
|
|
9421
|
+
event.promptId
|
|
9422
|
+
);
|
|
9423
|
+
appendBlock(next, block);
|
|
9424
|
+
next.activeUserBlockId = block.id;
|
|
9425
|
+
return block;
|
|
9426
|
+
}
|
|
9427
|
+
__name(userBlockForAttachment, "userBlockForAttachment");
|
|
8957
9428
|
function applyDaemonTranscriptEvent(next, event) {
|
|
8958
9429
|
if (event.eventId !== void 0) {
|
|
8959
9430
|
next.lastEventId = Math.max(next.lastEventId ?? 0, event.eventId);
|
|
@@ -8980,31 +9451,29 @@ function applyDaemonTranscriptEvent(next, event) {
|
|
|
8980
9451
|
appendTextDelta(next, "user", "activeUserBlockId", event.text, event);
|
|
8981
9452
|
break;
|
|
8982
9453
|
case "user.image.delta": {
|
|
8983
|
-
const
|
|
8984
|
-
const
|
|
8985
|
-
if (
|
|
8986
|
-
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
|
|
8992
|
-
|
|
8993
|
-
|
|
8994
|
-
|
|
8995
|
-
|
|
8996
|
-
|
|
8997
|
-
|
|
8998
|
-
|
|
8999
|
-
|
|
9000
|
-
|
|
9001
|
-
|
|
9002
|
-
|
|
9003
|
-
...block.images ?? [],
|
|
9004
|
-
{ data: event.data, mimeType: event.mimeType }
|
|
9005
|
-
];
|
|
9454
|
+
const block = userBlockForAttachment(next, event);
|
|
9455
|
+
const bytesBefore = estimateBlockBytes(block);
|
|
9456
|
+
if (event.meta) block.meta = { ...block.meta, ...event.meta };
|
|
9457
|
+
block.images = [
|
|
9458
|
+
...block.images ?? [],
|
|
9459
|
+
{ data: event.data, mimeType: event.mimeType }
|
|
9460
|
+
];
|
|
9461
|
+
next.retainedBytes += estimateBlockBytes(block) - bytesBefore;
|
|
9462
|
+
break;
|
|
9463
|
+
}
|
|
9464
|
+
case "user.file.delta": {
|
|
9465
|
+
const fileBlock = userBlockForAttachment(next, event);
|
|
9466
|
+
const fileBytesBefore = estimateBlockBytes(fileBlock);
|
|
9467
|
+
if (event.meta) fileBlock.meta = { ...fileBlock.meta, ...event.meta };
|
|
9468
|
+
fileBlock.files = [
|
|
9469
|
+
...fileBlock.files ?? [],
|
|
9470
|
+
{
|
|
9471
|
+
name: event.name,
|
|
9472
|
+
mimeType: event.mimeType,
|
|
9473
|
+
attachmentId: event.attachmentId
|
|
9006
9474
|
}
|
|
9007
|
-
|
|
9475
|
+
];
|
|
9476
|
+
next.retainedBytes += estimateBlockBytes(fileBlock) - fileBytesBefore;
|
|
9008
9477
|
break;
|
|
9009
9478
|
}
|
|
9010
9479
|
case "assistant.text.delta":
|
|
@@ -9082,6 +9551,10 @@ function applyDaemonTranscriptEvent(next, event) {
|
|
|
9082
9551
|
break;
|
|
9083
9552
|
case "status":
|
|
9084
9553
|
case "debug":
|
|
9554
|
+
if (isUnrecognizedDiagnostic(event)) {
|
|
9555
|
+
appendUnrecognizedDiagnostic(next, event);
|
|
9556
|
+
break;
|
|
9557
|
+
}
|
|
9085
9558
|
appendStatusBlock(next, event.type, event.text, event, {
|
|
9086
9559
|
clearActiveText: event.clearActiveText
|
|
9087
9560
|
});
|
|
@@ -9394,6 +9867,9 @@ function upsertToolBlock(state, event) {
|
|
|
9394
9867
|
}
|
|
9395
9868
|
return;
|
|
9396
9869
|
}
|
|
9870
|
+
const retainedIndex = existingId !== void 0 ? state.blockIndexById[existingId] : void 0;
|
|
9871
|
+
const retainedBefore = retainedIndex !== void 0 ? state.blocks[retainedIndex] : void 0;
|
|
9872
|
+
const bytesBefore = retainedBefore ? estimateBlockBytes(retainedBefore) : 0;
|
|
9397
9873
|
const existing = getWritableBlockById(state, existingId);
|
|
9398
9874
|
if (existing?.kind === "tool") {
|
|
9399
9875
|
if (event.title !== void 0) existing.title = event.title;
|
|
@@ -9469,6 +9945,7 @@ function upsertToolBlock(state, event) {
|
|
|
9469
9945
|
if (event.subagentType && !existing.subagentType) {
|
|
9470
9946
|
existing.subagentType = event.subagentType;
|
|
9471
9947
|
}
|
|
9948
|
+
state.retainedBytes += estimateBlockBytes(existing) - bytesBefore;
|
|
9472
9949
|
updateCurrentToolPointer(state, event.toolCallId, event.status);
|
|
9473
9950
|
return;
|
|
9474
9951
|
}
|
|
@@ -9518,9 +9995,19 @@ __name(upsertToolBlock, "upsertToolBlock");
|
|
|
9518
9995
|
function discardToolBlock(state, toolCallId) {
|
|
9519
9996
|
const blockId = state.toolBlockByCallId[toolCallId];
|
|
9520
9997
|
if (!blockId || blockId === TRIMMED_TOOL_BLOCK_ID) return;
|
|
9998
|
+
const droppedIndex = state.blockIndexById[blockId];
|
|
9999
|
+
const dropped = droppedIndex !== void 0 ? state.blocks[droppedIndex] : void 0;
|
|
9521
10000
|
takeBlocksOwnership(state);
|
|
9522
10001
|
state.blocks = state.blocks.filter((block) => block.id !== blockId);
|
|
10002
|
+
if (dropped) {
|
|
10003
|
+
state.retainedBytes = Math.max(
|
|
10004
|
+
0,
|
|
10005
|
+
state.retainedBytes - estimateBlockBytes(dropped)
|
|
10006
|
+
);
|
|
10007
|
+
}
|
|
9523
10008
|
state.blockIndexById = rebuildDaemonTranscriptBlockIndex(state.blocks);
|
|
10009
|
+
ownedBlocks.set(state, state.blocks);
|
|
10010
|
+
ownedBlockIndexes.set(state, state.blockIndexById);
|
|
9524
10011
|
delete state.toolBlockByCallId[toolCallId];
|
|
9525
10012
|
delete state.toolProgress[toolCallId];
|
|
9526
10013
|
if (state.currentToolCallId === toolCallId) {
|
|
@@ -9710,6 +10197,27 @@ function resolvePermissionBlock(state, event) {
|
|
|
9710
10197
|
clearActiveText(state);
|
|
9711
10198
|
}
|
|
9712
10199
|
__name(resolvePermissionBlock, "resolvePermissionBlock");
|
|
10200
|
+
function isUnrecognizedDiagnostic(event) {
|
|
10201
|
+
return event.type === "debug" && isUnrecognizedDiagnosticReason(event.debugReason);
|
|
10202
|
+
}
|
|
10203
|
+
__name(isUnrecognizedDiagnostic, "isUnrecognizedDiagnostic");
|
|
10204
|
+
function appendUnrecognizedDiagnostic(state, event) {
|
|
10205
|
+
state.activeUserBlockId = void 0;
|
|
10206
|
+
const diagnostic = {
|
|
10207
|
+
debugReason: event.debugReason,
|
|
10208
|
+
text: truncateTextAtLimit(event.text),
|
|
10209
|
+
clientReceivedAt: state.now,
|
|
10210
|
+
...event.promptId !== void 0 ? { promptId: event.promptId } : {},
|
|
10211
|
+
...event.sourceRecordIds !== void 0 ? { sourceRecordIds: event.sourceRecordIds } : {},
|
|
10212
|
+
...event.branchRecordId !== void 0 ? { branchRecordId: event.branchRecordId } : {},
|
|
10213
|
+
...event.originatorClientId !== void 0 ? { originatorClientId: event.originatorClientId } : {},
|
|
10214
|
+
...event.eventId !== void 0 ? { eventId: event.eventId } : {},
|
|
10215
|
+
...event.serverTimestamp !== void 0 ? { serverTimestamp: event.serverTimestamp } : {}
|
|
10216
|
+
};
|
|
10217
|
+
const diagnostics = [...state.unrecognizedDiagnostics, diagnostic];
|
|
10218
|
+
state.unrecognizedDiagnostics = diagnostics.length > UNRECOGNIZED_DIAGNOSTICS_LIMIT ? diagnostics.slice(-UNRECOGNIZED_DIAGNOSTICS_LIMIT) : diagnostics;
|
|
10219
|
+
}
|
|
10220
|
+
__name(appendUnrecognizedDiagnostic, "appendUnrecognizedDiagnostic");
|
|
9713
10221
|
function appendStatusBlock(state, kind, text, event, opts = {}) {
|
|
9714
10222
|
const blockId = allocateBlockId(state, kind);
|
|
9715
10223
|
const block = {
|
|
@@ -9779,6 +10287,7 @@ function cloneTranscriptState(state, opts) {
|
|
|
9779
10287
|
...state,
|
|
9780
10288
|
now: opts.now ?? Date.now(),
|
|
9781
10289
|
maxBlocks: opts.maxBlocks ?? state.maxBlocks,
|
|
10290
|
+
maxRetainedBytes: opts.maxRetainedBytes ?? state.maxRetainedBytes,
|
|
9782
10291
|
retainSubagentBlocks: opts.retainSubagentBlocks ?? state.retainSubagentBlocks,
|
|
9783
10292
|
// Lazy copy-on-write for
|
|
9784
10293
|
// `blocks` + `blockIndexById`. Eager `[...state.blocks]` defeated the
|
|
@@ -9818,21 +10327,62 @@ function cloneTranscriptState(state, opts) {
|
|
|
9818
10327
|
// unrelated dispatches lets `useSyncExternalStore` subscribers
|
|
9819
10328
|
// (e.g. `useDaemonFollowupSuggestion`) skip re-renders for events
|
|
9820
10329
|
// that don't touch the suggestion.
|
|
9821
|
-
lastFollowupSuggestion: state.lastFollowupSuggestion
|
|
10330
|
+
lastFollowupSuggestion: state.lastFollowupSuggestion,
|
|
10331
|
+
// Same reference-stability contract: the reducer replaces the whole
|
|
10332
|
+
// array when appending, never mutates it in-place.
|
|
10333
|
+
unrecognizedDiagnostics: state.unrecognizedDiagnostics
|
|
9822
10334
|
};
|
|
9823
10335
|
const onTruncation = opts.onTruncation ?? truncationCallbacks.get(state);
|
|
9824
10336
|
if (onTruncation) truncationCallbacks.set(next, onTruncation);
|
|
9825
10337
|
return next;
|
|
9826
10338
|
}
|
|
9827
10339
|
__name(cloneTranscriptState, "cloneTranscriptState");
|
|
10340
|
+
function sharesSourceRecordId(a, b) {
|
|
10341
|
+
const aIds = a.sourceRecordIds;
|
|
10342
|
+
const bIds = b.sourceRecordIds;
|
|
10343
|
+
if (!aIds?.length || !bIds?.length) return false;
|
|
10344
|
+
const set = new Set(aIds);
|
|
10345
|
+
return bIds.some((recordId) => set.has(recordId));
|
|
10346
|
+
}
|
|
10347
|
+
__name(sharesSourceRecordId, "sharesSourceRecordId");
|
|
9828
10348
|
function trimTranscriptState(state) {
|
|
9829
|
-
|
|
9830
|
-
|
|
9831
|
-
const
|
|
10349
|
+
const overByteBudget = state.retainedBytes > state.maxRetainedBytes;
|
|
10350
|
+
if (state.blocks.length <= state.maxBlocks && !overByteBudget) return state;
|
|
10351
|
+
const effectiveMaxBlocks = Math.max(
|
|
10352
|
+
1,
|
|
10353
|
+
Math.floor(Number.isFinite(state.maxBlocks) ? state.maxBlocks : 1)
|
|
10354
|
+
);
|
|
10355
|
+
let removeCount = Math.max(0, state.blocks.length - effectiveMaxBlocks);
|
|
10356
|
+
let bytes = state.retainedBytes;
|
|
10357
|
+
for (let i = 0; i < removeCount; i += 1) {
|
|
10358
|
+
bytes -= estimateBlockBytes(state.blocks[i]);
|
|
10359
|
+
}
|
|
10360
|
+
while (removeCount < state.blocks.length - 1 && bytes > state.maxRetainedBytes) {
|
|
10361
|
+
bytes -= estimateBlockBytes(state.blocks[removeCount]);
|
|
10362
|
+
removeCount += 1;
|
|
10363
|
+
}
|
|
10364
|
+
while (removeCount > 0 && removeCount < state.blocks.length - 1 && sharesSourceRecordId(
|
|
10365
|
+
state.blocks[removeCount - 1],
|
|
10366
|
+
state.blocks[removeCount]
|
|
10367
|
+
)) {
|
|
10368
|
+
bytes -= estimateBlockBytes(state.blocks[removeCount]);
|
|
10369
|
+
removeCount += 1;
|
|
10370
|
+
}
|
|
10371
|
+
while (removeCount > 0 && sharesSourceRecordId(
|
|
10372
|
+
state.blocks[removeCount - 1],
|
|
10373
|
+
state.blocks[removeCount]
|
|
10374
|
+
)) {
|
|
10375
|
+
removeCount -= 1;
|
|
10376
|
+
bytes += estimateBlockBytes(state.blocks[removeCount]);
|
|
10377
|
+
}
|
|
10378
|
+
if (removeCount === 0) return state;
|
|
10379
|
+
state.retainedBytes = Math.max(0, bytes);
|
|
10380
|
+
const blocks = state.blocks.slice(removeCount);
|
|
9832
10381
|
const keptIds = new Set(blocks.map((block) => block.id));
|
|
9833
10382
|
state.blocks = blocks;
|
|
9834
10383
|
state.blockIndexById = rebuildDaemonTranscriptBlockIndex(blocks);
|
|
9835
10384
|
ownedBlocks.set(state, state.blocks);
|
|
10385
|
+
ownedBlockIndexes.set(state, state.blockIndexById);
|
|
9836
10386
|
for (const [toolCallId, blockId] of Object.entries(state.toolBlockByCallId)) {
|
|
9837
10387
|
if (!keptIds.has(blockId)) {
|
|
9838
10388
|
state.toolBlockByCallId[toolCallId] = TRIMMED_TOOL_BLOCK_ID;
|
|
@@ -9886,6 +10436,18 @@ function trimTranscriptState(state) {
|
|
|
9886
10436
|
delete state.activeThoughtBlockByParent[parentId];
|
|
9887
10437
|
}
|
|
9888
10438
|
}
|
|
10439
|
+
const oldestRetainedBlock = state.blocks.find(
|
|
10440
|
+
(block) => (block.sourceRecordIds?.length ?? 0) > 0
|
|
10441
|
+
);
|
|
10442
|
+
truncationCallbacks.get(state)?.({
|
|
10443
|
+
kind: "blocks",
|
|
10444
|
+
oldestRetainedRecordId: oldestRetainedBlock?.sourceRecordIds?.[0],
|
|
10445
|
+
evictedOldest: true,
|
|
10446
|
+
blockCount: state.blocks.length,
|
|
10447
|
+
retainedBytes: state.retainedBytes,
|
|
10448
|
+
maxBlocks: state.maxBlocks,
|
|
10449
|
+
maxRetainedBytes: state.maxRetainedBytes
|
|
10450
|
+
});
|
|
9889
10451
|
return state;
|
|
9890
10452
|
}
|
|
9891
10453
|
__name(trimTranscriptState, "trimTranscriptState");
|
|
@@ -9894,13 +10456,19 @@ function shouldRecreateTrimmedToolBlock(event) {
|
|
|
9894
10456
|
}
|
|
9895
10457
|
__name(shouldRecreateTrimmedToolBlock, "shouldRecreateTrimmedToolBlock");
|
|
9896
10458
|
var ownedBlocks = /* @__PURE__ */ new WeakMap();
|
|
10459
|
+
var ownedBlockIndexes = /* @__PURE__ */ new WeakMap();
|
|
9897
10460
|
function takeBlocksOwnership(state) {
|
|
9898
10461
|
if (ownedBlocks.get(state) === state.blocks) return;
|
|
9899
10462
|
state.blocks = [...state.blocks];
|
|
9900
|
-
state.blockIndexById = createIndex(state.blockIndexById);
|
|
9901
10463
|
ownedBlocks.set(state, state.blocks);
|
|
9902
10464
|
}
|
|
9903
10465
|
__name(takeBlocksOwnership, "takeBlocksOwnership");
|
|
10466
|
+
function takeBlockIndexOwnership(state) {
|
|
10467
|
+
if (ownedBlockIndexes.get(state) === state.blockIndexById) return;
|
|
10468
|
+
state.blockIndexById = createIndex(state.blockIndexById);
|
|
10469
|
+
ownedBlockIndexes.set(state, state.blockIndexById);
|
|
10470
|
+
}
|
|
10471
|
+
__name(takeBlockIndexOwnership, "takeBlockIndexOwnership");
|
|
9904
10472
|
function rewindTranscriptToUserTurn(state, targetTurnIndex) {
|
|
9905
10473
|
let userTurnIndex = 0;
|
|
9906
10474
|
let lastUserIndex = -1;
|
|
@@ -9920,9 +10488,31 @@ function rewindTranscriptToUserTurn(state, targetTurnIndex) {
|
|
|
9920
10488
|
__name(rewindTranscriptToUserTurn, "rewindTranscriptToUserTurn");
|
|
9921
10489
|
function truncateTranscriptBeforeBlock(state, blockIndex) {
|
|
9922
10490
|
takeBlocksOwnership(state);
|
|
10491
|
+
const originalLength = state.blocks.length;
|
|
10492
|
+
let droppedBytes = 0;
|
|
10493
|
+
for (let index = blockIndex; index < state.blocks.length; index += 1) {
|
|
10494
|
+
const block = state.blocks[index];
|
|
10495
|
+
if (block) droppedBytes += estimateBlockBytes(block);
|
|
10496
|
+
}
|
|
9923
10497
|
state.blocks = state.blocks.slice(0, blockIndex);
|
|
10498
|
+
state.retainedBytes = Math.max(0, state.retainedBytes - droppedBytes);
|
|
9924
10499
|
ownedBlocks.set(state, state.blocks);
|
|
9925
10500
|
rebuildTranscriptIndexes(state);
|
|
10501
|
+
ownedBlockIndexes.set(state, state.blockIndexById);
|
|
10502
|
+
if (state.blocks.length < originalLength) {
|
|
10503
|
+
const oldestRetainedBlock = state.blocks.find(
|
|
10504
|
+
(block) => (block.sourceRecordIds?.length ?? 0) > 0
|
|
10505
|
+
);
|
|
10506
|
+
truncationCallbacks.get(state)?.({
|
|
10507
|
+
kind: "blocks",
|
|
10508
|
+
oldestRetainedRecordId: oldestRetainedBlock?.sourceRecordIds?.[0],
|
|
10509
|
+
evictedOldest: false,
|
|
10510
|
+
blockCount: state.blocks.length,
|
|
10511
|
+
retainedBytes: state.retainedBytes,
|
|
10512
|
+
maxBlocks: state.maxBlocks,
|
|
10513
|
+
maxRetainedBytes: state.maxRetainedBytes
|
|
10514
|
+
});
|
|
10515
|
+
}
|
|
9926
10516
|
}
|
|
9927
10517
|
__name(truncateTranscriptBeforeBlock, "truncateTranscriptBeforeBlock");
|
|
9928
10518
|
function rebuildTranscriptIndexes(state) {
|
|
@@ -9956,8 +10546,10 @@ function rebuildTranscriptIndexes(state) {
|
|
|
9956
10546
|
__name(rebuildTranscriptIndexes, "rebuildTranscriptIndexes");
|
|
9957
10547
|
function appendBlock(state, block) {
|
|
9958
10548
|
takeBlocksOwnership(state);
|
|
10549
|
+
takeBlockIndexOwnership(state);
|
|
9959
10550
|
state.blockIndexById[block.id] = state.blocks.length;
|
|
9960
10551
|
state.blocks.push(block);
|
|
10552
|
+
state.retainedBytes += estimateBlockBytes(block);
|
|
9961
10553
|
}
|
|
9962
10554
|
__name(appendBlock, "appendBlock");
|
|
9963
10555
|
function getWritableBlockById(state, blockId) {
|
|
@@ -10012,21 +10604,35 @@ function clearActiveText(state, parentToolCallId) {
|
|
|
10012
10604
|
__name(clearActiveText, "clearActiveText");
|
|
10013
10605
|
function appendBoundedText(state, block, text) {
|
|
10014
10606
|
const existing = "text" in block ? block.text : "";
|
|
10607
|
+
let next;
|
|
10015
10608
|
if (existing.length >= MAX_TEXT_BLOCK_LENGTH) {
|
|
10016
10609
|
if (text) reportTextTruncation(state, block.id, block.sourceRecordIds);
|
|
10017
|
-
|
|
10610
|
+
next = existing;
|
|
10611
|
+
} else {
|
|
10612
|
+
next = truncateText(
|
|
10613
|
+
state,
|
|
10614
|
+
block.id,
|
|
10615
|
+
block.sourceRecordIds,
|
|
10616
|
+
existing + text
|
|
10617
|
+
);
|
|
10018
10618
|
}
|
|
10019
|
-
|
|
10619
|
+
state.retainedBytes += (next.length - existing.length) * 2;
|
|
10620
|
+
return next;
|
|
10020
10621
|
}
|
|
10021
10622
|
__name(appendBoundedText, "appendBoundedText");
|
|
10022
|
-
function
|
|
10623
|
+
function truncateTextAtLimit(text) {
|
|
10023
10624
|
if (text.length <= MAX_TEXT_BLOCK_LENGTH) return text;
|
|
10024
|
-
reportTextTruncation(state, blockId, sourceRecordIds);
|
|
10025
10625
|
const keepLength = Math.max(
|
|
10026
10626
|
0,
|
|
10027
10627
|
MAX_TEXT_BLOCK_LENGTH - TEXT_TRUNCATED_SUFFIX.length
|
|
10028
10628
|
);
|
|
10029
|
-
return `${text.slice(0, keepLength)}${TEXT_TRUNCATED_SUFFIX}`;
|
|
10629
|
+
return `${detachString(text.slice(0, keepLength))}${TEXT_TRUNCATED_SUFFIX}`;
|
|
10630
|
+
}
|
|
10631
|
+
__name(truncateTextAtLimit, "truncateTextAtLimit");
|
|
10632
|
+
function truncateText(state, blockId, sourceRecordIds, text) {
|
|
10633
|
+
if (text.length <= MAX_TEXT_BLOCK_LENGTH) return text;
|
|
10634
|
+
reportTextTruncation(state, blockId, sourceRecordIds);
|
|
10635
|
+
return truncateTextAtLimit(text);
|
|
10030
10636
|
}
|
|
10031
10637
|
__name(truncateText, "truncateText");
|
|
10032
10638
|
function reportTextTruncation(state, blockId, sourceRecordIds) {
|
|
@@ -10037,6 +10643,35 @@ function reportTextTruncation(state, blockId, sourceRecordIds) {
|
|
|
10037
10643
|
});
|
|
10038
10644
|
}
|
|
10039
10645
|
__name(reportTextTruncation, "reportTextTruncation");
|
|
10646
|
+
function estimateRetainedBytes(value, depth = 0) {
|
|
10647
|
+
if (depth > MAX_CLONE_DEPTH) return 0;
|
|
10648
|
+
if (typeof value === "string") return value.length * 2;
|
|
10649
|
+
if (typeof value === "number" || typeof value === "boolean") return 16;
|
|
10650
|
+
if (typeof Blob !== "undefined" && value instanceof Blob) return value.size;
|
|
10651
|
+
if (value instanceof ArrayBuffer) return value.byteLength;
|
|
10652
|
+
if (ArrayBuffer.isView(value)) return value.byteLength;
|
|
10653
|
+
if (Array.isArray(value)) {
|
|
10654
|
+
let total = 32;
|
|
10655
|
+
for (const entry of value) {
|
|
10656
|
+
total += estimateRetainedBytes(entry, depth + 1);
|
|
10657
|
+
}
|
|
10658
|
+
return total;
|
|
10659
|
+
}
|
|
10660
|
+
if (isRecord2(value)) {
|
|
10661
|
+
let total = 64;
|
|
10662
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
10663
|
+
total += key.length * 2 + estimateRetainedBytes(entry, depth + 1);
|
|
10664
|
+
}
|
|
10665
|
+
return total;
|
|
10666
|
+
}
|
|
10667
|
+
return 0;
|
|
10668
|
+
}
|
|
10669
|
+
__name(estimateRetainedBytes, "estimateRetainedBytes");
|
|
10670
|
+
function estimateDaemonTranscriptBlockBytes(block) {
|
|
10671
|
+
return estimateRetainedBytes(block);
|
|
10672
|
+
}
|
|
10673
|
+
__name(estimateDaemonTranscriptBlockBytes, "estimateDaemonTranscriptBlockBytes");
|
|
10674
|
+
var estimateBlockBytes = estimateDaemonTranscriptBlockBytes;
|
|
10040
10675
|
function createIndex(source) {
|
|
10041
10676
|
return Object.assign(/* @__PURE__ */ Object.create(null), source);
|
|
10042
10677
|
}
|
|
@@ -10120,6 +10755,10 @@ function selectLastFollowupSuggestion(state) {
|
|
|
10120
10755
|
return state.lastFollowupSuggestion;
|
|
10121
10756
|
}
|
|
10122
10757
|
__name(selectLastFollowupSuggestion, "selectLastFollowupSuggestion");
|
|
10758
|
+
function selectUnrecognizedDiagnostics(state) {
|
|
10759
|
+
return state.unrecognizedDiagnostics;
|
|
10760
|
+
}
|
|
10761
|
+
__name(selectUnrecognizedDiagnostics, "selectUnrecognizedDiagnostics");
|
|
10123
10762
|
function selectToolProgress(state, toolCallId) {
|
|
10124
10763
|
return state.toolProgress[toolCallId];
|
|
10125
10764
|
}
|
|
@@ -10206,7 +10845,9 @@ __name(getTimestampFormatter, "getTimestampFormatter");
|
|
|
10206
10845
|
// packages/sdk-typescript/src/daemon/ui/store.ts
|
|
10207
10846
|
init_esbuild_shims();
|
|
10208
10847
|
function createDaemonTranscriptStore(seed = {}) {
|
|
10209
|
-
|
|
10848
|
+
const { onTruncation, ...stateSeed } = seed;
|
|
10849
|
+
const reducerOptions = onTruncation ? { onTruncation } : {};
|
|
10850
|
+
let state = createState(stateSeed);
|
|
10210
10851
|
const listeners = /* @__PURE__ */ new Set();
|
|
10211
10852
|
let notifyScheduled = false;
|
|
10212
10853
|
const notify = /* @__PURE__ */ __name(() => {
|
|
@@ -10239,20 +10880,22 @@ function createDaemonTranscriptStore(seed = {}) {
|
|
|
10239
10880
|
dispatch(event) {
|
|
10240
10881
|
const events = Array.isArray(event) ? event : [event];
|
|
10241
10882
|
if (events.length === 0) return;
|
|
10242
|
-
state = reduceDaemonTranscriptEvents(state, events);
|
|
10883
|
+
state = reduceDaemonTranscriptEvents(state, events, reducerOptions);
|
|
10243
10884
|
scheduleNotify();
|
|
10244
10885
|
},
|
|
10245
10886
|
appendLocalUserMessage(text, images, meta, files) {
|
|
10246
10887
|
state = appendLocalUserTranscriptMessage(state, text, {
|
|
10247
10888
|
images,
|
|
10248
10889
|
meta,
|
|
10249
|
-
files
|
|
10890
|
+
files,
|
|
10891
|
+
...reducerOptions
|
|
10250
10892
|
});
|
|
10251
10893
|
scheduleNotify();
|
|
10252
10894
|
},
|
|
10253
10895
|
reset(nextSeed = {}) {
|
|
10254
10896
|
state = createState({
|
|
10255
10897
|
maxBlocks: nextSeed.maxBlocks ?? state.maxBlocks,
|
|
10898
|
+
maxRetainedBytes: nextSeed.maxRetainedBytes ?? state.maxRetainedBytes,
|
|
10256
10899
|
retainSubagentBlocks: nextSeed.retainSubagentBlocks ?? state.retainSubagentBlocks,
|
|
10257
10900
|
...nextSeed
|
|
10258
10901
|
});
|
|
@@ -10313,10 +10956,17 @@ function createState(seed) {
|
|
|
10313
10956
|
return {
|
|
10314
10957
|
...createDaemonTranscriptState({
|
|
10315
10958
|
maxBlocks: seed.maxBlocks,
|
|
10959
|
+
maxRetainedBytes: seed.maxRetainedBytes,
|
|
10316
10960
|
now: seed.now
|
|
10317
10961
|
}),
|
|
10318
10962
|
...seed,
|
|
10319
10963
|
blocks,
|
|
10964
|
+
// Seeded blocks (e.g. a replay snapshot handed to `reset`) must count
|
|
10965
|
+
// toward the retention byte budget from the start.
|
|
10966
|
+
retainedBytes: seed.retainedBytes ?? blocks.reduce(
|
|
10967
|
+
(total, block) => total + estimateDaemonTranscriptBlockBytes(block),
|
|
10968
|
+
0
|
|
10969
|
+
),
|
|
10320
10970
|
blockIndexById: rebuildDaemonTranscriptBlockIndex(blocks),
|
|
10321
10971
|
toolBlockByCallId: createNullIndex(seed.toolBlockByCallId),
|
|
10322
10972
|
trimmedToolNotificationByCallId: createNullIndex(
|
|
@@ -10563,6 +11213,8 @@ function daemonUiEventToTerminalText(event) {
|
|
|
10563
11213
|
return "";
|
|
10564
11214
|
case "user.image.delta":
|
|
10565
11215
|
return `[image: ${sanitizeTerminalText(event.mimeType)}]`;
|
|
11216
|
+
case "user.file.delta":
|
|
11217
|
+
return `[file: ${sanitizeTerminalText(event.name)}]`;
|
|
10566
11218
|
default:
|
|
10567
11219
|
return assertNever(event);
|
|
10568
11220
|
}
|
|
@@ -11497,6 +12149,7 @@ export {
|
|
|
11497
12149
|
DAEMON_PLAN_TOOL_CALL_ID,
|
|
11498
12150
|
DAEMON_UI_CONFORMANCE_FIXTURES,
|
|
11499
12151
|
DAEMON_UI_DEBUG_REASONS,
|
|
12152
|
+
DAEMON_UI_UNRECOGNIZED_DIAGNOSTIC_REASONS,
|
|
11500
12153
|
DEVICE_FLOW_EXPIRY_GRACE_MS,
|
|
11501
12154
|
DaemonAuthFlow,
|
|
11502
12155
|
DaemonCapabilityMissingError,
|
|
@@ -11512,6 +12165,7 @@ export {
|
|
|
11512
12165
|
PENDING_PROMPT_COMPLETED_EVENT,
|
|
11513
12166
|
PENDING_PROMPT_STARTED_EVENT,
|
|
11514
12167
|
SseFramingError,
|
|
12168
|
+
UNRECOGNIZED_DIAGNOSTICS_LIMIT,
|
|
11515
12169
|
WorkspaceDaemonClient,
|
|
11516
12170
|
appendLocalUserTranscriptMessage,
|
|
11517
12171
|
asKnownDaemonEvent,
|
|
@@ -11525,6 +12179,7 @@ export {
|
|
|
11525
12179
|
daemonBlockToPlainText,
|
|
11526
12180
|
daemonToolPreviewToMarkdown,
|
|
11527
12181
|
daemonUiEventToTerminalText,
|
|
12182
|
+
estimateDaemonTranscriptBlockBytes,
|
|
11528
12183
|
extractContentPart,
|
|
11529
12184
|
extractServerTimestamp,
|
|
11530
12185
|
formatBlockTimestamp,
|
|
@@ -11540,6 +12195,9 @@ export {
|
|
|
11540
12195
|
isStaleBranchPointError,
|
|
11541
12196
|
isSubagentChildBlock,
|
|
11542
12197
|
isSubagentSessionNotFound,
|
|
12198
|
+
isTrimmedPermissionBlockId,
|
|
12199
|
+
isTrimmedToolBlockId,
|
|
12200
|
+
isUnrecognizedDiagnosticReason,
|
|
11543
12201
|
isWorkspaceScopedBudgetEvent,
|
|
11544
12202
|
matchTurnEvent,
|
|
11545
12203
|
normalizeDaemonEvent,
|
|
@@ -11562,6 +12220,7 @@ export {
|
|
|
11562
12220
|
selectToolProgress,
|
|
11563
12221
|
selectTranscriptBlocks,
|
|
11564
12222
|
selectTranscriptBlocksOrderedByEventId,
|
|
12223
|
+
selectUnrecognizedDiagnostics,
|
|
11565
12224
|
stringifyJson as stringifyDaemonUiJson,
|
|
11566
12225
|
stripOscSequences as stripDaemonOscSequences,
|
|
11567
12226
|
transcriptBlockToTerminalText
|