@qwen-code/qwen-code 0.21.12-preview.3 → 0.21.12-preview.5
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 +10 -0
- package/bundled/qc-helper/docs/features/code-review.md +1 -1
- package/bundled/qc-helper/docs/qwen-serve.md +34 -34
- package/bundled/review/SKILL.md +55 -36
- package/chunks/{MaxSizedBox-EIK4BHBQ.js → MaxSizedBox-6STELMXN.js} +41 -41
- package/chunks/{StandaloneSessionPicker-NHVJDRYD.js → StandaloneSessionPicker-LXMGCAIF.js} +60 -60
- package/chunks/{acp-startup-profiler-JMJBZDVO.js → acp-startup-profiler-TVI2OVUN.js} +2 -2
- package/chunks/{acpAgent-37UDZP64.js → acpAgent-NFRP4O5A.js} +672 -428
- package/chunks/{agent-FAWBG7PP.js → agent-4AGYD6I6.js} +38 -38
- package/chunks/{agent-headless-SHK4PCCH.js → agent-headless-GH4UIDXU.js} +38 -38
- package/chunks/{anthropicContentGenerator-4JSC3ZFL.js → anthropicContentGenerator-ZBBX5VMY.js} +6 -6
- package/chunks/{artifact-tool-FRMBPDPB.js → artifact-tool-RWJAKYBZ.js} +2 -2
- package/chunks/{askUserQuestion-7G3LI3IZ.js → askUserQuestion-IQCA2SOX.js} +2 -2
- package/chunks/{bridge-DEAYNDCI.js → bridge-3S4SKXSQ.js} +44 -44
- package/chunks/{channel-management-service-SKAN6NOB.js → channel-management-service-5ZYX4ROW.js} +4 -4
- package/chunks/{channel-settings-store-UIGYER6R.js → channel-settings-store-62E3TWVK.js} +45 -45
- package/chunks/{channel-worker-group-YPTB5ASD.js → channel-worker-group-QFJKXO7R.js} +5 -5
- package/chunks/{channel-worker-manager-4EHJSPRH.js → channel-worker-manager-PWD2UURZ.js} +5 -5
- package/chunks/{channel-worker-supervisor-DZKHYFHV.js → channel-worker-supervisor-XQJBGFCM.js} +3 -3
- package/chunks/{chunk-GZGDJ4E6.js → chunk-2ASWIM4A.js} +1 -1
- package/chunks/{chunk-DP3IHZGG.js → chunk-2AUM35J5.js} +59 -7
- package/chunks/{chunk-T4FTABSW.js → chunk-2N6CV4PW.js} +1 -1
- package/chunks/{chunk-YI6UGZF5.js → chunk-2OFDCPMS.js} +12 -12
- package/chunks/{chunk-5PWLQ7SK.js → chunk-2RTRFLWH.js} +11 -4
- package/chunks/{chunk-TYGKUOEG.js → chunk-2U3UCXZ3.js} +2 -1
- package/chunks/{chunk-QZ5G26ZE.js → chunk-32SNBMNP.js} +12 -12
- package/chunks/{chunk-P64FPV3G.js → chunk-3HXLH5QV.js} +2 -2
- package/chunks/{chunk-E5BWLU5J.js → chunk-3MJ44LNC.js} +59 -23
- package/chunks/{chunk-LHY6HBRA.js → chunk-3RC5Q66G.js} +4 -4
- package/chunks/{chunk-QUESTNOP.js → chunk-4JS2QK7P.js} +1 -1
- package/chunks/{chunk-7LZ7DK4D.js → chunk-4XX2LZ3E.js} +1 -1
- package/chunks/{chunk-RRQJPCRQ.js → chunk-5IW3FJGD.js} +2 -2
- package/chunks/{chunk-IQFYO5BF.js → chunk-5KZNWF2M.js} +1 -1
- package/chunks/{chunk-UOMZKPI5.js → chunk-5PLOQW7H.js} +7 -7
- package/chunks/{chunk-HBZUU4AE.js → chunk-62OKKUOX.js} +4 -4
- package/chunks/{chunk-AJX4ITUG.js → chunk-646ZB2TS.js} +3 -3
- package/chunks/{chunk-T6W4KACQ.js → chunk-67F2BEYW.js} +1 -1
- package/chunks/{chunk-ILVATFYJ.js → chunk-6DH5YA3X.js} +19 -15
- package/chunks/{chunk-MDFUBQAQ.js → chunk-6GTKI2YX.js} +17 -17
- package/chunks/{chunk-575MI5K3.js → chunk-6JFPUJ2O.js} +4 -4
- package/chunks/{chunk-NELCY6JT.js → chunk-6LDLDK6E.js} +1 -1
- package/chunks/{chunk-732MOPEM.js → chunk-6OJDN5ZT.js} +1 -1
- package/chunks/{chunk-GLWWPFTW.js → chunk-6SU6OW5Z.js} +1 -1
- package/chunks/{chunk-V4MJ56RS.js → chunk-6YSSQFHQ.js} +5 -5
- package/chunks/{chunk-7D4KEFOT.js → chunk-72SKJ3E7.js} +3 -3
- package/chunks/{chunk-NPE3STIW.js → chunk-7ATQGA6V.js} +3 -3
- package/chunks/{chunk-AQHNAA7E.js → chunk-7JL5YBSA.js} +1 -1
- package/chunks/{chunk-ZQSNP4TG.js → chunk-7TKNMQ6L.js} +2 -2
- package/chunks/{chunk-NWPO6I7V.js → chunk-7WUMS2UA.js} +1 -1
- package/chunks/{chunk-KT4OWAAZ.js → chunk-A4BAHMJF.js} +3 -3
- package/chunks/{chunk-N7NBMAMW.js → chunk-A6GQUQ7I.js} +2 -2
- package/chunks/{chunk-XLQS3VI6.js → chunk-AAZWJAPQ.js} +2 -2
- package/chunks/{chunk-LT532KF4.js → chunk-ADJDLEVO.js} +1 -1
- package/chunks/{chunk-EXG2R5UR.js → chunk-AFKOAHC3.js} +8 -8
- package/chunks/{chunk-SAQHDAUJ.js → chunk-B66LYK4B.js} +452 -57
- package/chunks/{chunk-2J53A6MV.js → chunk-BNRIQWXW.js} +3 -3
- package/chunks/{chunk-IEP44U2R.js → chunk-C2DR57L6.js} +1 -1
- package/chunks/{chunk-TBVNYG5B.js → chunk-CDDLHCC2.js} +3 -3
- package/chunks/{chunk-N3FJOQX7.js → chunk-CPTIJGUK.js} +4 -4
- package/chunks/{chunk-M4OYAR6J.js → chunk-DGNQ5AFX.js} +2 -2
- package/chunks/{chunk-O5G7IQGM.js → chunk-DLDVO2NY.js} +347 -85
- package/chunks/{chunk-CG3OQDNY.js → chunk-DMODRHNL.js} +6 -6
- package/chunks/{chunk-DYVCDQW2.js → chunk-DXXYMK2U.js} +1 -1
- package/chunks/{chunk-ZWPWQEF5.js → chunk-E74YSVIN.js} +1 -1
- package/chunks/{chunk-32VOOMEF.js → chunk-E7XJWIWC.js} +4 -4
- package/chunks/{chunk-47FQVRCO.js → chunk-EGB2PIYM.js} +1 -1
- package/chunks/{chunk-TRYJ3BVE.js → chunk-EHXS5MAC.js} +7 -7
- package/chunks/{chunk-JXK3WAP7.js → chunk-F7PTQFTB.js} +4 -4
- package/chunks/{chunk-O4BBDP2G.js → chunk-FTGU6G45.js} +2 -2
- package/chunks/{chunk-ZGWY4YUB.js → chunk-FVHLDSQS.js} +2 -2
- package/chunks/{chunk-EFIMD5VA.js → chunk-H6BFLALJ.js} +1 -1
- package/chunks/{chunk-JL3LC3CQ.js → chunk-HAR4G5K2.js} +1 -1
- package/chunks/{chunk-TEKFBSMY.js → chunk-HOXEJHJQ.js} +3 -3
- package/chunks/{chunk-VQZXRLEX.js → chunk-HRAFAUM7.js} +3 -3
- package/chunks/{chunk-U6PTKAOW.js → chunk-HUDUANHL.js} +1 -1
- package/chunks/{chunk-GYBDYWMV.js → chunk-I3UEXUWJ.js} +2 -2
- package/chunks/{chunk-P2UCMHDT.js → chunk-IJCZP2MA.js} +2 -2
- package/chunks/{chunk-L7T742G2.js → chunk-J5SUM3ZJ.js} +47 -3
- package/chunks/{chunk-DAX3G67A.js → chunk-JOVJCXN4.js} +1 -1
- package/chunks/{chunk-CTQE2NB2.js → chunk-JRTJEGSP.js} +1 -1
- package/chunks/{chunk-MZSJ43WV.js → chunk-JVY7FHUZ.js} +15 -2
- package/chunks/{chunk-K7JW6V5O.js → chunk-JW5UEE3V.js} +1 -1
- package/chunks/{chunk-L2GTEEEU.js → chunk-K5IDV3PC.js} +44 -1
- package/chunks/{chunk-GJJQV4PY.js → chunk-KK3FEHPJ.js} +1 -1
- package/chunks/{chunk-Y66OOMKS.js → chunk-KQLW7LLV.js} +21 -21
- package/chunks/{chunk-2AZMF6G5.js → chunk-KTWUFHS4.js} +2 -2
- package/chunks/{chunk-JS4Q5NG5.js → chunk-LSMCI42W.js} +3 -3
- package/chunks/{chunk-VWD7SNNN.js → chunk-LYRA6ZTI.js} +2120 -2085
- package/chunks/{chunk-UNCIELQJ.js → chunk-M3DWLXEO.js} +1 -1
- package/chunks/{chunk-5UPJ774B.js → chunk-N2G4RA77.js} +1 -1
- package/chunks/{chunk-3TT6MZHJ.js → chunk-N4LVA3S6.js} +35 -35
- package/chunks/{chunk-URK542T4.js → chunk-NF5J2WFA.js} +15 -2
- package/chunks/{chunk-OPBATTFQ.js → chunk-NHZF4VCD.js} +1 -1
- package/chunks/{chunk-QTI7SRXI.js → chunk-NM33GGOM.js} +3 -3
- package/chunks/{chunk-TYCXSMZU.js → chunk-NNGCKJAD.js} +3 -3
- package/chunks/{chunk-F6AOBFUN.js → chunk-NW7SPXVG.js} +1 -1
- package/chunks/{chunk-NC4O6UE6.js → chunk-O6SLWH4X.js} +2 -2
- package/chunks/{chunk-J7DNMZFO.js → chunk-OK727E5D.js} +1 -1
- package/chunks/{chunk-EYY4IBPV.js → chunk-OSA2TFDI.js} +2 -2
- package/chunks/{chunk-I4XSOFH2.js → chunk-OZTGLK53.js} +1 -1
- package/chunks/{chunk-KPVVWKF3.js → chunk-PSTHNTHF.js} +1 -1
- package/chunks/{chunk-UZPWH6SP.js → chunk-Q7VJUIIB.js} +285 -125
- package/chunks/{chunk-EYW54TBD.js → chunk-QEWAHAW2.js} +3 -3
- package/chunks/{chunk-5I5NMQCU.js → chunk-QLFTWYTO.js} +3 -3
- package/chunks/{chunk-4GLFFNP3.js → chunk-R4YAQULI.js} +5 -5
- package/chunks/{chunk-WFRHWDBT.js → chunk-RECPKBBD.js} +5 -5
- package/chunks/{chunk-CZXQ4UZA.js → chunk-RIDUB2GC.js} +1 -1
- package/chunks/{chunk-KIFRFCCB.js → chunk-RXX5T3IF.js} +66 -19
- package/chunks/{chunk-EYS3GGM3.js → chunk-SKRHR6N2.js} +1 -1
- package/chunks/{chunk-6LYDH7VT.js → chunk-SNHBRO4C.js} +2 -2
- package/chunks/{chunk-5TXOGH4I.js → chunk-T4G33L3W.js} +3 -3
- package/chunks/{chunk-M6HXP2SG.js → chunk-T7YMWGFY.js} +1892 -622
- package/chunks/{chunk-SSAOTDK7.js → chunk-TIM7NVEO.js} +1 -1
- package/chunks/{chunk-DEG7R6Z6.js → chunk-TN3REXN4.js} +8 -8
- package/chunks/{chunk-MWZYNOCG.js → chunk-TNETSI2A.js} +3 -3
- package/chunks/{chunk-ZV4XVYL3.js → chunk-TROB4PZY.js} +4 -4
- package/chunks/{chunk-O5AZPHYZ.js → chunk-U5C2GIN2.js} +24 -16
- package/chunks/{chunk-3GCU5O2E.js → chunk-U7ROFHSH.js} +1 -1
- package/chunks/{chunk-HB6QW4LM.js → chunk-UAAWNTOC.js} +15 -12
- package/chunks/{chunk-4M2F7OG7.js → chunk-UALXTL5Y.js} +6 -6
- package/chunks/{chunk-HHGQGTJQ.js → chunk-UFHPAMAV.js} +4 -0
- package/chunks/{chunk-V3LXMASR.js → chunk-UHF5VBKO.js} +1 -1
- package/chunks/{chunk-FRH4SSGX.js → chunk-UPUAGRKY.js} +2 -2
- package/chunks/{chunk-6S52N6PG.js → chunk-UQPLUR4A.js} +2 -2
- package/chunks/{chunk-HGCQ5SE7.js → chunk-UXEO7E3V.js} +21 -0
- package/chunks/{chunk-7SUQZ7QH.js → chunk-V3NMFQD2.js} +2 -2
- package/chunks/{chunk-M2PY7CNK.js → chunk-V6PERRH4.js} +2 -2
- package/chunks/{chunk-JEMR2FTD.js → chunk-VAPNUDD5.js} +4 -4
- package/chunks/{chunk-KNXA5XXK.js → chunk-VBKTP7TH.js} +7 -7
- package/chunks/{chunk-4ETA3KRC.js → chunk-VE2UV7IN.js} +3 -3
- package/chunks/{chunk-XWUQ4IH5.js → chunk-VGGNHRYZ.js} +7 -7
- package/chunks/{chunk-3ZYX7AUR.js → chunk-VKEA37IR.js} +1 -1
- package/chunks/{chunk-6XZERB6P.js → chunk-VPZMLGD3.js} +3 -3
- package/chunks/{chunk-YTYPRVIZ.js → chunk-VUTOV2HG.js} +2 -2
- package/chunks/{chunk-RQVVXDHS.js → chunk-WAF6AR5Y.js} +4 -4
- package/chunks/{chunk-XCGIMOLN.js → chunk-WCCLLK7X.js} +14 -1
- package/chunks/{chunk-VJNBRRZG.js → chunk-WZMH7II3.js} +1 -1
- package/chunks/{chunk-3XZYK76R.js → chunk-XL6GYJL2.js} +1 -1
- package/chunks/{chunk-6AECVSVX.js → chunk-XNL23MGG.js} +3 -3
- package/chunks/{chunk-ENEEQMGM.js → chunk-XY7DGTIC.js} +1 -1
- package/chunks/{chunk-M6SXIXBV.js → chunk-YCGXJ4Q3.js} +6 -6
- package/chunks/{chunk-5HBFERG5.js → chunk-YI5G32RU.js} +3 -3
- package/chunks/{chunk-6ZIIHBNV.js → chunk-YK4O72LT.js} +3 -3
- package/chunks/{chunk-MPBRV3UU.js → chunk-YMB77M76.js} +15 -0
- package/chunks/{chunk-N5ULBHP3.js → chunk-YMIQ24FR.js} +2 -2
- package/chunks/{chunk-KNQZXSLW.js → chunk-YY23TR4M.js} +23 -9
- package/chunks/{chunk-FDWH6CBK.js → chunk-ZLX7FTZQ.js} +5 -5
- package/chunks/{chunk-IX7CFQGA.js → chunk-ZPZANKVP.js} +3 -3
- package/chunks/{chunk-XTH2OMDS.js → chunk-ZRT36RSF.js} +1 -1
- package/chunks/{chunk-YZJVVQD3.js → chunk-ZTBFA7I6.js} +7 -7
- package/chunks/{chunk-M2NMFAFR.js → chunk-ZZ7RUTJ4.js} +1 -1
- package/chunks/{computer-use-S4JEU5P7.js → computer-use-ZFBJYSR3.js} +38 -38
- package/chunks/{config-utils-TXVKR27S.js → config-utils-7JZQN6L2.js} +4 -4
- package/chunks/{contextCommand-2H5OH2HW.js → contextCommand-G3TAIY7T.js} +40 -40
- package/chunks/{core-runtime-IAQ4DD4Y.js → core-runtime-K3MQVNSF.js} +38 -38
- package/chunks/{create-sub-session-Y4WYDZGC.js → create-sub-session-23ULO5PO.js} +2 -2
- package/chunks/{create-sub-session-EKHKXJAA.js → create-sub-session-DMTLJPDG.js} +38 -38
- package/chunks/{cron-create-ZOVA3CC2.js → cron-create-5WUTNKNF.js} +4 -4
- package/chunks/{cron-delete-7Z3H4LJY.js → cron-delete-JEQ27YPS.js} +4 -4
- package/chunks/{cron-list-UHGX3IQG.js → cron-list-IXGCA7UR.js} +4 -4
- package/chunks/{daemon-PXIC4ZDK.js → daemon-UBVOQMWY.js} +2 -1
- package/chunks/{daemon-status-provider-LPYR2GXY.js → daemon-status-provider-KFLEZGD7.js} +49 -49
- package/chunks/{daemon-trust-policy-7JOBVFH3.js → daemon-trust-policy-ZZ6DRDAC.js} +44 -44
- package/chunks/{daemon-trust-policy-monitor-OU3NRHAR.js → daemon-trust-policy-monitor-CIKHNV2K.js} +44 -44
- package/chunks/{deferred-core-runtime-SFT3KI2C.js → deferred-core-runtime-MM7X7UYR.js} +38 -38
- package/chunks/{dispatch-B53LNEO4.js → dispatch-FW7DX2CR.js} +7 -1
- package/chunks/{display-image-ZE3GZNIK.js → display-image-CAD7RAUM.js} +4 -4
- package/chunks/{dist-BNWP6IZL.js → dist-362MN6CP.js} +2 -2
- package/chunks/{dist-EFJILGIS.js → dist-5VDE7U3A.js} +1 -1
- package/chunks/{dist-AVUYBK7L.js → dist-6RK4U6VU.js} +1 -1
- package/chunks/{dist-KTYDJNYM.js → dist-B3ODKYEB.js} +1 -1
- package/chunks/{dist-NPS52B2V.js → dist-CCUH2Z4C.js} +1 -1
- package/chunks/{dist-BW2LDPV3.js → dist-DANKRAB3.js} +1 -1
- package/chunks/{dist-PKSRQAR2.js → dist-EZHCZSW6.js} +1 -1
- package/chunks/{dist-ZWDH5HLS.js → dist-M3XMEIP2.js} +1 -1
- package/chunks/{earlyInputCapture-27RPWE2D.js → earlyInputCapture-O77TUBIF.js} +39 -39
- package/chunks/{edit-WXVZ7FHS.js → edit-CZ23AVP6.js} +38 -38
- package/chunks/{enter-worktree-TYMVXFLA.js → enter-worktree-4EMS7IRL.js} +38 -38
- package/chunks/{enterPlanMode-FT4MRU5N.js → enterPlanMode-TS6KO6DU.js} +38 -38
- package/chunks/{environment-Z6OMA34I.js → environment-7JAXEU6I.js} +40 -40
- package/chunks/{errors-YMXK2GG3.js → errors-NBABPF4S.js} +40 -40
- package/chunks/{exit-worktree-ODZUQLGJ.js → exit-worktree-Q3NFHYUI.js} +38 -38
- package/chunks/{exitPlanMode-MBPAPBBV.js → exitPlanMode-4JH6WLKL.js} +38 -38
- package/chunks/{fast-path-ZU5T6XSN.js → fast-path-5LFDLPHJ.js} +4 -4
- package/chunks/{gemini-OZK6AIMC.js → gemini-MB4S7YLN.js} +86 -86
- package/chunks/{geminiContentGenerator-MC6ZKWZG.js → geminiContentGenerator-EQY2QU7K.js} +6 -6
- package/chunks/{glob-KJ4A4ZOM.js → glob-LA5XO2H7.js} +38 -38
- package/chunks/{goal-tools-JDK2SNMV.js → goal-tools-LQFO4BRY.js} +4 -4
- package/chunks/{grep-QWBLG564.js → grep-KYBZMY36.js} +38 -38
- package/chunks/{handleAutoUpdate-M3ACKDKF.js → handleAutoUpdate-HZJSAUNC.js} +42 -42
- package/chunks/{i18n-FPW7XZL5.js → i18n-BSCIN4J4.js} +39 -39
- package/chunks/{image-gen-OTFC2S7L.js → image-gen-HGURQAHX.js} +10 -10
- package/chunks/{initializer-5HKUXXBT.js → initializer-WUHJXIB3.js} +45 -45
- package/chunks/{installationInfo-4OA6UW7V.js → installationInfo-G3PDBWG2.js} +39 -39
- package/chunks/{keychain-token-storage-JTWUYFU7.js → keychain-token-storage-GU75J2T2.js} +2 -2
- package/chunks/{list-3TKZ264A.js → list-IC7KDSZ6.js} +47 -47
- package/chunks/{list-agents-4GQ2XNEU.js → list-agents-5PNMK2AM.js} +2 -2
- package/chunks/{loadedSettingsAdapter-IRUANLS2.js → loadedSettingsAdapter-Z3GOJRI7.js} +44 -44
- package/chunks/{loggingContentGenerator-D4URLH2A.js → loggingContentGenerator-E2QENFPH.js} +115 -93
- package/chunks/{loop-wakeup-HOQI3K5D.js → loop-wakeup-OV65FEGR.js} +5 -5
- package/chunks/{ls-FSHISLLA.js → ls-RPRSX26R.js} +4 -4
- package/chunks/{lsp-APQJ5ZEZ.js → lsp-IWTJWFLT.js} +2 -2
- package/chunks/{managed-npm-update-2O7XSAWJ.js → managed-npm-update-MX2OPCW4.js} +41 -41
- package/chunks/{mcp-AFVHCHKT.js → mcp-QQEWPNWV.js} +44 -44
- package/chunks/{monitor-PY4WDSX3.js → monitor-SV64FNV3.js} +38 -38
- package/chunks/nonInteractiveCli-3XFIFXBR.js +166 -0
- package/chunks/{notebook-edit-GEPL33NO.js → notebook-edit-QPYSWPRI.js} +38 -38
- package/chunks/{openaiContentGenerator-ACYSXQ6R.js → openaiContentGenerator-CMZXOSVA.js} +24 -24
- package/chunks/{opentui-entry-SBAOWW7M.js → opentui-entry-TEHHLGN7.js} +192 -98
- package/chunks/{pidfile-SUNYCAA4.js → pidfile-D5UXVVAI.js} +39 -39
- package/chunks/{processUtils-F7LP7YUV.js → processUtils-ZEIMIVPX.js} +2 -2
- package/chunks/{qwenContentGenerator-BB6IPELF.js → qwenContentGenerator-JAXZKB7R.js} +43 -43
- package/chunks/{qwenOAuth2-OU3WGDOI.js → qwenOAuth2-C2QWTD2G.js} +9 -9
- package/chunks/{read-file-GORBXJTS.js → read-file-2V5GE6ZW.js} +12 -12
- package/chunks/{read-mcp-resource-TJSJRH4F.js → read-mcp-resource-THCSZHXO.js} +2 -2
- package/chunks/{read-package-up-TCM6I7S2.js → read-package-up-K6RKTL5D.js} +1 -1
- package/chunks/{record-artifact-FXF5LHPE.js → record-artifact-76YYQA5F.js} +3 -3
- package/chunks/{resumeHistoryUtils-FOAJJJWK.js → resumeHistoryUtils-UZ7GHPNY.js} +44 -44
- package/chunks/{ripGrep-RNLIZGCY.js → ripGrep-MUTMPQSV.js} +38 -38
- package/chunks/{run-qwen-serve-GVMMX3IU.js → run-qwen-serve-WU43JKEA.js} +160 -71
- package/chunks/{runtime-RNBZ5FDD.js → runtime-YLOFDP2P.js} +49 -49
- package/chunks/{scheduler-NTRFSPIP.js → scheduler-G44OPSZE.js} +40 -40
- package/chunks/{sdk-exporters-http-2VPMAPFI.js → sdk-exporters-http-A7XLKZO7.js} +11 -7
- package/chunks/{sdk-impl-5W3JUCWF.js → sdk-impl-XO4UF6PR.js} +11 -8
- package/chunks/{send-message-RBYLV5NY.js → send-message-P5SLP57G.js} +6 -6
- package/chunks/{serve-H3PGA26U.js → serve-CZQDBDYV.js} +47 -47
- package/chunks/{server-SUXD2F3C.js → server-HGI2KF3Y.js} +264 -159
- package/chunks/{session-MTFVUWWM.js → session-OVMSHAO5.js} +85 -85
- package/chunks/{settings-GUJ3TN2J.js → settings-TWX6ROGP.js} +43 -43
- package/chunks/{shell-C2UP5FF2.js → shell-JDSWGVC7.js} +38 -38
- package/chunks/{skill-4XCNK55E.js → skill-QILHTMYJ.js} +16 -16
- package/chunks/{skill-settings-Y2BU27XM.js → skill-settings-RKRD34RZ.js} +43 -43
- package/chunks/{spawnChannel-UUUUK734.js → spawnChannel-V5PYSDEI.js} +40 -40
- package/chunks/{standalone-update-MJ722XZ4.js → standalone-update-Y52CWCGG.js} +40 -40
- package/chunks/{startInteractiveUI-TCPIPNGN.js → startInteractiveUI-RVA62ZM6.js} +125 -115
- package/chunks/{syntheticOutput-D3Z64LJC.js → syntheticOutput-SEW4NA47.js} +3 -3
- package/chunks/{task-create-URFZ5EUX.js → task-create-247EAVF7.js} +10 -10
- package/chunks/{task-list-6JDFMPUW.js → task-list-ZJN4QHLK.js} +5 -5
- package/chunks/{task-stop-HHUGCD25.js → task-stop-MAYQJ42I.js} +2 -2
- package/chunks/{task-update-DVV6CUGI.js → task-update-SU5TMZGG.js} +10 -10
- package/chunks/{team-create-WZWH2NJI.js → team-create-YMWUDIE3.js} +38 -38
- package/chunks/{team-delete-PZGGBQLM.js → team-delete-3XVRPQBP.js} +5 -5
- package/chunks/{team-plan-approval-SUZQJCWJ.js → team-plan-approval-3GPZAW46.js} +38 -38
- package/chunks/{terminal-image-renderer-BCUN3Z3W.js → terminal-image-renderer-UGQKWDM3.js} +40 -40
- package/chunks/{theme-manager-UGMFDREN.js → theme-manager-KRG4GGFY.js} +39 -39
- package/chunks/{todoWrite-WINAZSZI.js → todoWrite-IE2YTCK7.js} +4 -4
- package/chunks/{tool-search-B6F3MPUZ.js → tool-search-SZRO5G72.js} +16 -16
- package/chunks/{total-session-admission-MQLBJ5WL.js → total-session-admission-JYHYOKWX.js} +44 -44
- package/chunks/{trustedFolders-2XST7U5C.js → trustedFolders-2BDCB5NJ.js} +39 -39
- package/chunks/{update-relaunch-OVC7YNGD.js → update-relaunch-XSYVPSDL.js} +5 -5
- package/chunks/{updateCheck-YAKM36WQ.js → updateCheck-SMMJ27GG.js} +44 -44
- package/chunks/{useAutoAcceptIndicator-RF6FVX3S.js → useAutoAcceptIndicator-HPG4UFIZ.js} +46 -46
- package/chunks/{validateNonInterActiveAuth-IPPXFNQH.js → validateNonInterActiveAuth-IIL774NT.js} +81 -81
- package/chunks/{version-4IDFEXOU.js → version-WSGAB2PA.js} +2 -2
- package/chunks/{web-fetch-NUOLHXPN.js → web-fetch-LKC2F5DM.js} +16 -16
- package/chunks/{web-search-LVOOV4XZ.js → web-search-BHMAMXEU.js} +9 -9
- package/chunks/{workflow-JSTYTG3K.js → workflow-A7AQ52HO.js} +111 -46
- package/chunks/{workspace-providers-status-U4EYXA4K.js → workspace-providers-status-JRT57TLL.js} +47 -47
- package/chunks/{workspace-registration-store-OG66U3CB.js → workspace-registration-store-EACJNCM5.js} +1 -1
- package/chunks/{workspace-registry-WSHWQRQQ.js → workspace-registry-OV5SI4ES.js} +44 -44
- package/chunks/{workspace-service-QZXQHX2F.js → workspace-service-PUHU4EEK.js} +49 -49
- package/chunks/{workspace-skills-status-VRBHEX5O.js → workspace-skills-status-YAJE3UW3.js} +45 -45
- package/chunks/{workspace-trust-reconciler-FCRIUIOF.js → workspace-trust-reconciler-JP5UR2H6.js} +50 -50
- package/chunks/{write-file-PYL3JCCD.js → write-file-UBIHUP5M.js} +38 -38
- package/chunks/{zoom-image-RS6MU26F.js → zoom-image-4QTKAMTP.js} +12 -12
- package/cli.js +13 -13
- package/package.json +4 -4
- package/web-shell/assets/{arc-CgGUyHWd.js → arc-lZ04kynw.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-BR0Qv-1Y.js → architectureDiagram-3BPJPVTR-B1wZVhzD.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-DIoaceaI.js → blockDiagram-GPEHLZMM-CO0e0yJt.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-Bc5k6BbI.js → c4Diagram-AAUBKEIU-Dfpo6Qie.js} +1 -1
- package/web-shell/assets/channel-BxvRq3pV.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-DtPEz2WX.js → chunk-2J33WTMH-BvxArftT.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-Dydo6ydE.js → chunk-4BX2VUAB-BS2XXjGY.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-DD9_VWXm.js → chunk-55IACEB6-CYL6h3Ph.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-DVI2m59k.js → chunk-727SXJPM-C-cWPX30.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-luatmaTN.js → chunk-AQP2D5EJ-CJLxNbVV.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-Duy8NTIi.js → chunk-FMBD7UC4-DwfzKywA.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-CrL1yhms.js → chunk-ND2GUHAM-BI5raYHQ.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-C7BX6bu1.js → chunk-QZHKN3VN-_GkNI90J.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-tL8nAxYf.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-tL8nAxYf.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-BTzs7mIi.js → cose-bilkent-S5V4N54A-BAVLNxh9.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-3VTUmWts.js → dagre-BM42HDAG-BD4XNLqp.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-Ehdp75GN.js → diagram-2AECGRRQ-WO567p8w.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-B3wu3teE.js → diagram-5GNKFQAL-mAk23VWO.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-DjgTSf2S.js → diagram-KO2AKTUF-YQEeHKze.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-Br9mwjY3.js → diagram-LMA3HP47-CMVjxAjv.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-D4xz5M-z.js → diagram-OG6HWLK6-42hPvbM-.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-CXayWlG_.js → erDiagram-TEJ5UH35-CXU_cPfu.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-CLonjQTi.js → flowDiagram-I6XJVG4X-D-3TdhMT.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-BTySFT-1.js → ganttDiagram-6RSMTGT7-CsgkXolz.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII--2WcUjOe.js → gitGraphDiagram-PVQCEYII-B6Q3PBLD.js} +1 -1
- package/web-shell/assets/{index-DPJHkFOG.js → index-BFrkGj2B.js} +1 -1
- package/web-shell/assets/index-BgjULKyF.css +5 -0
- package/web-shell/assets/index-CxXlPYfl.js +1789 -0
- package/web-shell/assets/{infoDiagram-5YYISTIA-9vpgAf1m.js → infoDiagram-5YYISTIA-jiAfSXp8.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-DcRpHnAW.js → ishikawaDiagram-YF4QCWOH-BWif5KeJ.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-C2TKorRm.js → journeyDiagram-JHISSGLW-B-GAZthS.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-DdsFwB8b.js → kanban-definition-UN3LZRKU-9TEuATdL.js} +1 -1
- package/web-shell/assets/{linear-7PjRvJrf.js → linear-dy_QPfyE.js} +1 -1
- package/web-shell/assets/{mermaid.core-raDXa11C.js → mermaid.core-DB2uLAnq.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-DLHc-PRN.js → mindmap-definition-RKZ34NQL-ey_dyxi-.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-BftYpeTW.js → pieDiagram-4H26LBE5-_6BuMdDj.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-O-6ygOYn.js → quadrantDiagram-W4KKPZXB-B2rM19W2.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-BmZWVufJ.js → requirementDiagram-4Y6WPE33-DWj8b7vW.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-2x5beiWt.js → sankeyDiagram-5OEKKPKP-D5dtYh0N.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-BH8uKokQ.js → sequenceDiagram-3UESZ5HK-DVkdn_qW.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-Dq1MFgX_.js → stateDiagram-AJRCARHV-DgwD_fi6.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BWGkVGVB.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-Cl2WKbv9.js → timeline-definition-PNZ67QCA-vNr_1UNX.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-BqoRo_Q-.js → vennDiagram-CIIHVFJN-ChFcGAcu.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-BTxp-Yot.js → wardley-L42UT6IY-C8PXoSWk.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-DFXVCSH2.js → wardleyDiagram-YWT4CUSO-C2nqOV6i.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-qQhWx0aE.js → xychartDiagram-2RQKCTM6-BntaqhSB.js} +1 -1
- package/web-shell/index.html +2 -2
- package/chunks/nonInteractiveCli-ZHW6F76F.js +0 -166
- package/web-shell/assets/channel-D2b9IYpS.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-DHatTCmD.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-DHatTCmD.js +0 -1
- package/web-shell/assets/index-CIFO52Wx.css +0 -5
- package/web-shell/assets/index-bhq3CUUF.js +0 -1789
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-spuAYji6.js +0 -1
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
CronScheduler,
|
|
41
41
|
DEFAULT_RECURRING_MAX_AGE_DAYS,
|
|
42
42
|
normalizeRecurringMaxAge
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-NM33GGOM.js";
|
|
44
44
|
import {
|
|
45
45
|
consumeUnread,
|
|
46
46
|
forwardApproval,
|
|
@@ -49,13 +49,13 @@ import {
|
|
|
49
49
|
sendStructuredMessage,
|
|
50
50
|
wrapConfirmWithBadge,
|
|
51
51
|
writeMessage
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-A4BAHMJF.js";
|
|
53
53
|
import {
|
|
54
54
|
claimTask,
|
|
55
55
|
listTasks,
|
|
56
56
|
onTasksUpdated,
|
|
57
57
|
unassignTeammateTasks
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-ZPZANKVP.js";
|
|
59
59
|
import {
|
|
60
60
|
assignTeammateColor,
|
|
61
61
|
classifyShutdownResponse,
|
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
formatAgentId,
|
|
64
64
|
generateUniqueTeammateName,
|
|
65
65
|
writeTeamFile
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-A6GQUQ7I.js";
|
|
67
67
|
import {
|
|
68
68
|
parsePositiveIntegerEnv
|
|
69
69
|
} from "./chunk-6PVPNMXU.js";
|
|
@@ -71,13 +71,13 @@ import {
|
|
|
71
71
|
RUNTIME_SNAPSHOT_PREFIX,
|
|
72
72
|
buildModelIdContext,
|
|
73
73
|
resolveModelId
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-OZTGLK53.js";
|
|
75
75
|
import {
|
|
76
76
|
ARTIFACT_TITLE_MAX_LENGTH,
|
|
77
77
|
ARTIFACT_WORKSPACE_PATH_MAX_LENGTH,
|
|
78
78
|
hasControlCharacter,
|
|
79
79
|
hasUnsafeDisplayPayload
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-7WUMS2UA.js";
|
|
81
81
|
import {
|
|
82
82
|
promptIdContext,
|
|
83
83
|
todoWorkChainContext
|
|
@@ -101,7 +101,7 @@ import {
|
|
|
101
101
|
isPlanRequiredTeammatePreApprovalAllowedTool,
|
|
102
102
|
isSubagentLikeExecutionContext,
|
|
103
103
|
shouldUsePlanOnlyReminderInSubagentContext
|
|
104
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-SNHBRO4C.js";
|
|
105
105
|
import {
|
|
106
106
|
SKILL_FILE_NAME,
|
|
107
107
|
SKILL_NAME_PATTERN,
|
|
@@ -121,7 +121,7 @@ import {
|
|
|
121
121
|
require_dist as require_dist2,
|
|
122
122
|
stringify,
|
|
123
123
|
validateSkillName
|
|
124
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-KTWUFHS4.js";
|
|
125
125
|
import {
|
|
126
126
|
require_proper_lockfile
|
|
127
127
|
} from "./chunk-KRXPRVGL.js";
|
|
@@ -139,48 +139,56 @@ import {
|
|
|
139
139
|
createHookOutput,
|
|
140
140
|
getHookKey,
|
|
141
141
|
isToolArtifactLike
|
|
142
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-2ASWIM4A.js";
|
|
143
143
|
import {
|
|
144
144
|
BaseTokenStorage,
|
|
145
145
|
KeychainTokenStorage
|
|
146
|
-
} from "./chunk-
|
|
146
|
+
} from "./chunk-67F2BEYW.js";
|
|
147
147
|
import {
|
|
148
148
|
normalizeImageGenerationBaseUrl,
|
|
149
149
|
resolveNetworkTarget
|
|
150
|
-
} from "./chunk-
|
|
150
|
+
} from "./chunk-TNETSI2A.js";
|
|
151
151
|
import {
|
|
152
|
+
EvidenceSourceUnavailableError,
|
|
153
|
+
GoalEvidenceCheckpointAccumulator,
|
|
154
|
+
GoalEvidenceRecordIndexAccumulator,
|
|
152
155
|
GoalPersistenceUnavailableError,
|
|
156
|
+
InvalidGoalEvidenceReferenceError,
|
|
153
157
|
PAUSED_GOAL_SYSTEM_REMINDER,
|
|
154
158
|
aggregateTranscriptRecordFragments,
|
|
155
159
|
createGoalCheckpointVerifier,
|
|
156
160
|
createGoalRuntime,
|
|
157
161
|
goalRequiresExactPermit,
|
|
158
162
|
goalTurnContext,
|
|
163
|
+
isGoalRecoveryCandidate,
|
|
159
164
|
isTranscriptArtifactRecord,
|
|
160
165
|
isTranscriptConversationRecord,
|
|
161
166
|
isUserPromptSubmitContextPartText,
|
|
167
|
+
normalizeGoalRecoveryRecord,
|
|
162
168
|
parseGoalStateRecordPayloadV2,
|
|
163
169
|
prepareTranscriptRecords,
|
|
164
170
|
projectUserTranscriptForDisplay,
|
|
171
|
+
selectGoalRecoveryFromRecords,
|
|
165
172
|
selectTranscriptLeaf,
|
|
166
173
|
validateTranscriptRecord,
|
|
167
174
|
walkTranscriptUuidChain,
|
|
168
175
|
wrapUserPromptSubmitContext
|
|
169
|
-
} from "./chunk-
|
|
176
|
+
} from "./chunk-B66LYK4B.js";
|
|
170
177
|
import {
|
|
171
178
|
DEFAULT_OTLP_ENDPOINT,
|
|
172
179
|
DEFAULT_TELEMETRY_TARGET,
|
|
180
|
+
addDaemonRequestAttribute,
|
|
173
181
|
addToolArgumentsAttributes,
|
|
174
182
|
addToolCallResultAttributes,
|
|
175
183
|
addUserPromptAttributes
|
|
176
|
-
} from "./chunk-
|
|
184
|
+
} from "./chunk-U5C2GIN2.js";
|
|
177
185
|
import {
|
|
178
186
|
supportsOpenAIPrefixCaching
|
|
179
187
|
} from "./chunk-SAH4BD2J.js";
|
|
180
188
|
import {
|
|
181
189
|
DashScopeOpenAICompatibleProvider,
|
|
182
190
|
selectDashScopeThinkingKnob
|
|
183
|
-
} from "./chunk-
|
|
191
|
+
} from "./chunk-2RTRFLWH.js";
|
|
184
192
|
import {
|
|
185
193
|
childLaunchDepth,
|
|
186
194
|
getCurrentAgentDepth,
|
|
@@ -191,7 +199,7 @@ import {
|
|
|
191
199
|
runWithAgentContext,
|
|
192
200
|
runWithRuntimeContentGenerator,
|
|
193
201
|
spawnBlockReason
|
|
194
|
-
} from "./chunk-
|
|
202
|
+
} from "./chunk-SKRHR6N2.js";
|
|
195
203
|
import {
|
|
196
204
|
getTeammateContext,
|
|
197
205
|
isTeammate,
|
|
@@ -318,7 +326,7 @@ import {
|
|
|
318
326
|
updateMCPServerStatus,
|
|
319
327
|
writeLine,
|
|
320
328
|
writeLineSync
|
|
321
|
-
} from "./chunk-
|
|
329
|
+
} from "./chunk-UAAWNTOC.js";
|
|
322
330
|
import {
|
|
323
331
|
defaultModalities,
|
|
324
332
|
isTieredEffortWireModel
|
|
@@ -347,13 +355,13 @@ import {
|
|
|
347
355
|
isManagedMemoryPath,
|
|
348
356
|
isTeamAutoMemPath,
|
|
349
357
|
isUserAutoMemPath
|
|
350
|
-
} from "./chunk-
|
|
358
|
+
} from "./chunk-6OJDN5ZT.js";
|
|
351
359
|
import {
|
|
352
360
|
runSideQuery
|
|
353
|
-
} from "./chunk-
|
|
361
|
+
} from "./chunk-JRTJEGSP.js";
|
|
354
362
|
import {
|
|
355
363
|
STRUCTURED_OUTPUT_REDACTED_ARGS
|
|
356
|
-
} from "./chunk-
|
|
364
|
+
} from "./chunk-C2DR57L6.js";
|
|
357
365
|
import {
|
|
358
366
|
BUBBLE_APPROVAL_MODE,
|
|
359
367
|
FORK_AGENT,
|
|
@@ -387,7 +395,7 @@ import {
|
|
|
387
395
|
selectForkHistory,
|
|
388
396
|
stripSystemReminderBlocks,
|
|
389
397
|
validateForkToolList
|
|
390
|
-
} from "./chunk-
|
|
398
|
+
} from "./chunk-TROB4PZY.js";
|
|
391
399
|
import {
|
|
392
400
|
collectAvailableSkillEntries,
|
|
393
401
|
renderAvailableSkillsBlock
|
|
@@ -405,7 +413,7 @@ import {
|
|
|
405
413
|
getQwenIgnoreFileNames,
|
|
406
414
|
isPathWithinRoot,
|
|
407
415
|
require_ignore
|
|
408
|
-
} from "./chunk-
|
|
416
|
+
} from "./chunk-UHF5VBKO.js";
|
|
409
417
|
import {
|
|
410
418
|
AgentStatistics,
|
|
411
419
|
BaseDeclarativeTool,
|
|
@@ -424,7 +432,7 @@ import {
|
|
|
424
432
|
require_dist,
|
|
425
433
|
require_fast_deep_equal,
|
|
426
434
|
require_fast_uri
|
|
427
|
-
} from "./chunk-
|
|
435
|
+
} from "./chunk-ZRT36RSF.js";
|
|
428
436
|
import {
|
|
429
437
|
openBrowserSecurely,
|
|
430
438
|
shouldAttemptBrowserLaunch
|
|
@@ -432,11 +440,11 @@ import {
|
|
|
432
440
|
import {
|
|
433
441
|
isUnattendedMode,
|
|
434
442
|
retryWithBackoff
|
|
435
|
-
} from "./chunk-
|
|
443
|
+
} from "./chunk-QEWAHAW2.js";
|
|
436
444
|
import {
|
|
437
445
|
classifyRetryError,
|
|
438
446
|
isFallbackEligible
|
|
439
|
-
} from "./chunk-
|
|
447
|
+
} from "./chunk-FTGU6G45.js";
|
|
440
448
|
import {
|
|
441
449
|
QUOTA_EXHAUSTED_PREFIX,
|
|
442
450
|
formatQuotaExhaustedMessage,
|
|
@@ -446,7 +454,7 @@ import {
|
|
|
446
454
|
isQuotaExhaustedError,
|
|
447
455
|
isRateLimitError,
|
|
448
456
|
isStructuredError
|
|
449
|
-
} from "./chunk-
|
|
457
|
+
} from "./chunk-PSTHNTHF.js";
|
|
450
458
|
import {
|
|
451
459
|
AUTH_ENV_MAPPINGS,
|
|
452
460
|
AuthType,
|
|
@@ -458,7 +466,7 @@ import {
|
|
|
458
466
|
createContentGenerator,
|
|
459
467
|
resetPreloadedContentGenerator,
|
|
460
468
|
resolveContentGeneratorConfigWithSources
|
|
461
|
-
} from "./chunk-
|
|
469
|
+
} from "./chunk-VGGNHRYZ.js";
|
|
462
470
|
import {
|
|
463
471
|
DEFAULT_QWEN_EMBEDDING_MODEL,
|
|
464
472
|
DEFAULT_QWEN_MODEL
|
|
@@ -468,7 +476,7 @@ import {
|
|
|
468
476
|
atomicWriteFileSync,
|
|
469
477
|
atomicWriteJSON,
|
|
470
478
|
renameWithRetry
|
|
471
|
-
} from "./chunk-
|
|
479
|
+
} from "./chunk-NW7SPXVG.js";
|
|
472
480
|
import {
|
|
473
481
|
DEFAULT_OPENAI_BASE_URL
|
|
474
482
|
} from "./chunk-AXMWHKXA.js";
|
|
@@ -500,7 +508,7 @@ import {
|
|
|
500
508
|
preloadRuntimeFetchModule,
|
|
501
509
|
redactProxyError,
|
|
502
510
|
setResolvedProxyUrlForRuntimeFetch
|
|
503
|
-
} from "./chunk-
|
|
511
|
+
} from "./chunk-H6BFLALJ.js";
|
|
504
512
|
import {
|
|
505
513
|
endHookSpan,
|
|
506
514
|
endInteractionSpan,
|
|
@@ -526,7 +534,7 @@ import {
|
|
|
526
534
|
startToolExecutionSpan,
|
|
527
535
|
startToolSpan,
|
|
528
536
|
truncateSpanError
|
|
529
|
-
} from "./chunk-
|
|
537
|
+
} from "./chunk-3MJ44LNC.js";
|
|
530
538
|
import {
|
|
531
539
|
safeJsonStringify
|
|
532
540
|
} from "./chunk-HHJLM3WQ.js";
|
|
@@ -546,8 +554,15 @@ import {
|
|
|
546
554
|
TOOL_FAILURE_KIND_TIMEOUT,
|
|
547
555
|
TOOL_FAILURE_KIND_TOOL_ERROR,
|
|
548
556
|
TOOL_FAILURE_KIND_TOOL_EXCEPTION,
|
|
549
|
-
|
|
550
|
-
|
|
557
|
+
getSessionModel,
|
|
558
|
+
getSessionProjectDir,
|
|
559
|
+
isValidSensitiveSpanAttributeMaxLength,
|
|
560
|
+
registerSessionModel,
|
|
561
|
+
registerSessionProjectDir,
|
|
562
|
+
sessionIdContext,
|
|
563
|
+
unregisterSessionModel,
|
|
564
|
+
unregisterSessionProjectDir
|
|
565
|
+
} from "./chunk-K5IDV3PC.js";
|
|
551
566
|
import {
|
|
552
567
|
FatalConfigError,
|
|
553
568
|
PATH_ARG_KEYS,
|
|
@@ -576,7 +591,7 @@ import {
|
|
|
576
591
|
tildeifyPath,
|
|
577
592
|
toFriendlyError,
|
|
578
593
|
unescapePath
|
|
579
|
-
} from "./chunk-
|
|
594
|
+
} from "./chunk-YMB77M76.js";
|
|
580
595
|
import {
|
|
581
596
|
require_src
|
|
582
597
|
} from "./chunk-AMDSOFFV.js";
|
|
@@ -21328,6 +21343,13 @@ var getGitBranch = /* @__PURE__ */ __name((cwd) => {
|
|
|
21328
21343
|
return void 0;
|
|
21329
21344
|
}
|
|
21330
21345
|
}, "getGitBranch");
|
|
21346
|
+
var gitBranchCache = /* @__PURE__ */ new Map();
|
|
21347
|
+
var getCachedGitBranch = /* @__PURE__ */ __name((cwd) => {
|
|
21348
|
+
if (gitBranchCache.has(cwd)) return gitBranchCache.get(cwd);
|
|
21349
|
+
const branch = getGitBranch(cwd);
|
|
21350
|
+
gitBranchCache.set(cwd, branch);
|
|
21351
|
+
return branch;
|
|
21352
|
+
}, "getCachedGitBranch");
|
|
21331
21353
|
var getGitRepoName = /* @__PURE__ */ __name((cwd) => {
|
|
21332
21354
|
try {
|
|
21333
21355
|
const remoteUrl = execSync("git remote get-url origin", {
|
|
@@ -26558,6 +26580,46 @@ var FileHistoryService = class {
|
|
|
26558
26580
|
}
|
|
26559
26581
|
};
|
|
26560
26582
|
|
|
26583
|
+
// packages/core/src/services/session-file-history-state.ts
|
|
26584
|
+
init_esbuild_shims();
|
|
26585
|
+
var SessionFileHistoryAccumulator = class {
|
|
26586
|
+
static {
|
|
26587
|
+
__name(this, "SessionFileHistoryAccumulator");
|
|
26588
|
+
}
|
|
26589
|
+
seenPromptIds = /* @__PURE__ */ new Set();
|
|
26590
|
+
retainedPromptIds = [];
|
|
26591
|
+
snapshotsByPromptId = /* @__PURE__ */ new Map();
|
|
26592
|
+
add(record2) {
|
|
26593
|
+
if (record2.type !== "system" || record2.subtype !== "file_history_snapshot" || !record2.systemPayload) {
|
|
26594
|
+
return;
|
|
26595
|
+
}
|
|
26596
|
+
const payload = record2.systemPayload;
|
|
26597
|
+
if (!Array.isArray(payload.snapshots)) return;
|
|
26598
|
+
const deserialized = deserializeSnapshots(payload.snapshots);
|
|
26599
|
+
for (const snapshot of deserialized) {
|
|
26600
|
+
if (this.seenPromptIds.has(snapshot.promptId)) {
|
|
26601
|
+
if (this.snapshotsByPromptId.has(snapshot.promptId)) {
|
|
26602
|
+
this.snapshotsByPromptId.set(snapshot.promptId, snapshot);
|
|
26603
|
+
}
|
|
26604
|
+
continue;
|
|
26605
|
+
}
|
|
26606
|
+
this.seenPromptIds.add(snapshot.promptId);
|
|
26607
|
+
this.retainedPromptIds.push(snapshot.promptId);
|
|
26608
|
+
this.snapshotsByPromptId.set(snapshot.promptId, snapshot);
|
|
26609
|
+
if (this.retainedPromptIds.length > MAX_SNAPSHOTS) {
|
|
26610
|
+
const evictedPromptId = this.retainedPromptIds.shift();
|
|
26611
|
+
this.snapshotsByPromptId.delete(evictedPromptId);
|
|
26612
|
+
}
|
|
26613
|
+
}
|
|
26614
|
+
}
|
|
26615
|
+
finish() {
|
|
26616
|
+
const snapshots = this.retainedPromptIds.map(
|
|
26617
|
+
(promptId) => this.snapshotsByPromptId.get(promptId)
|
|
26618
|
+
);
|
|
26619
|
+
return snapshots.length > 0 ? snapshots : void 0;
|
|
26620
|
+
}
|
|
26621
|
+
};
|
|
26622
|
+
|
|
26561
26623
|
// packages/core/src/utils/runtimeStatus.ts
|
|
26562
26624
|
init_esbuild_shims();
|
|
26563
26625
|
import * as fs7 from "node:fs/promises";
|
|
@@ -26910,42 +26972,21 @@ function readLastJsonStringFieldsSync(filePath, primaryKey, otherKeys, lineConta
|
|
|
26910
26972
|
}
|
|
26911
26973
|
}
|
|
26912
26974
|
__name(readLastJsonStringFieldsSync, "readLastJsonStringFieldsSync");
|
|
26913
|
-
|
|
26914
|
-
|
|
26915
|
-
|
|
26916
|
-
|
|
26917
|
-
|
|
26918
|
-
|
|
26919
|
-
|
|
26920
|
-
|
|
26921
|
-
|
|
26922
|
-
|
|
26923
|
-
|
|
26924
|
-
|
|
26925
|
-
|
|
26926
|
-
function estimatePromptTokens(history, userMessage, lastPromptTokenCount, lastOutputTokenCount = 0, imageTokenEstimate = DEFAULT_IMAGE_TOKEN_ESTIMATE, conservative = false) {
|
|
26927
|
-
if (lastPromptTokenCount > 0) {
|
|
26928
|
-
const newContentTokens = estimateContentTokens(
|
|
26929
|
-
[userMessage],
|
|
26930
|
-
imageTokenEstimate
|
|
26931
|
-
);
|
|
26932
|
-
return lastPromptTokenCount + lastOutputTokenCount + (conservative ? Math.ceil(newContentTokens * CONSERVATIVE_NEW_CONTENT_SAFETY_FACTOR) : newContentTokens);
|
|
26933
|
-
}
|
|
26934
|
-
return estimateContentTokens([...history, userMessage], imageTokenEstimate);
|
|
26935
|
-
}
|
|
26936
|
-
__name(estimatePromptTokens, "estimatePromptTokens");
|
|
26937
|
-
function getUsageOutputTokenCountForPromptEstimate(usage) {
|
|
26938
|
-
if (usage?.promptTokenCount === void 0) {
|
|
26939
|
-
return 0;
|
|
26940
|
-
}
|
|
26941
|
-
if (usage.totalTokenCount !== void 0) {
|
|
26942
|
-
return Math.max(0, usage.totalTokenCount - usage.promptTokenCount);
|
|
26943
|
-
}
|
|
26944
|
-
const candidates = Math.max(0, usage.candidatesTokenCount ?? 0);
|
|
26945
|
-
const thoughts = Math.max(0, usage.thoughtsTokenCount ?? 0);
|
|
26946
|
-
return candidates > thoughts ? candidates : candidates + thoughts;
|
|
26975
|
+
function readSessionTitleInfoFromFileSync(filePath, scratchBuffer) {
|
|
26976
|
+
const hit = readLastJsonStringFieldsSync(
|
|
26977
|
+
filePath,
|
|
26978
|
+
"customTitle",
|
|
26979
|
+
["titleSource"],
|
|
26980
|
+
'"subtype":"custom_title"',
|
|
26981
|
+
scratchBuffer
|
|
26982
|
+
);
|
|
26983
|
+
const title = hit["customTitle"];
|
|
26984
|
+
if (!title) return {};
|
|
26985
|
+
const rawSource = hit["titleSource"];
|
|
26986
|
+
const source = rawSource === "auto" || rawSource === "manual" ? rawSource : void 0;
|
|
26987
|
+
return { title, source };
|
|
26947
26988
|
}
|
|
26948
|
-
__name(
|
|
26989
|
+
__name(readSessionTitleInfoFromFileSync, "readSessionTitleInfoFromFileSync");
|
|
26949
26990
|
|
|
26950
26991
|
// packages/core/src/services/session-artifact-persistence.ts
|
|
26951
26992
|
init_esbuild_shims();
|
|
@@ -26971,6 +27012,52 @@ function isSessionArtifactRecord(record2) {
|
|
|
26971
27012
|
return isTranscriptArtifactRecord(record2);
|
|
26972
27013
|
}
|
|
26973
27014
|
__name(isSessionArtifactRecord, "isSessionArtifactRecord");
|
|
27015
|
+
function selectActiveSideArtifactRecordUuids(records, activeRecordUuids) {
|
|
27016
|
+
const activeUuids = new Set(activeRecordUuids);
|
|
27017
|
+
const firstActiveUuid = activeRecordUuids[0];
|
|
27018
|
+
const firstActiveIndex = firstActiveUuid === void 0 ? -1 : records.findIndex((record2) => record2.uuid === firstActiveUuid);
|
|
27019
|
+
const nextActiveUuidByIndex = /* @__PURE__ */ new Map();
|
|
27020
|
+
const nextBlockingUuidByIndex = /* @__PURE__ */ new Map();
|
|
27021
|
+
let nextActiveUuid;
|
|
27022
|
+
let nextBlockingUuid;
|
|
27023
|
+
for (let index = records.length - 1; index >= 0; index--) {
|
|
27024
|
+
if (nextActiveUuid !== void 0) {
|
|
27025
|
+
nextActiveUuidByIndex.set(index, nextActiveUuid);
|
|
27026
|
+
}
|
|
27027
|
+
if (nextBlockingUuid !== void 0) {
|
|
27028
|
+
nextBlockingUuidByIndex.set(index, nextBlockingUuid);
|
|
27029
|
+
}
|
|
27030
|
+
const record2 = records[index];
|
|
27031
|
+
if (activeUuids.has(record2.uuid)) {
|
|
27032
|
+
nextActiveUuid = record2.uuid;
|
|
27033
|
+
nextBlockingUuid = void 0;
|
|
27034
|
+
} else if (!isSessionArtifactRecord(record2) && !(record2.type === "system" && record2.subtype === "custom_title")) {
|
|
27035
|
+
nextBlockingUuid = record2.uuid;
|
|
27036
|
+
}
|
|
27037
|
+
}
|
|
27038
|
+
const selected = [];
|
|
27039
|
+
const includedSideArtifactUuids = /* @__PURE__ */ new Set();
|
|
27040
|
+
let previousActiveUuid;
|
|
27041
|
+
for (let index = 0; index < records.length; index++) {
|
|
27042
|
+
const record2 = records[index];
|
|
27043
|
+
if (activeUuids.has(record2.uuid)) {
|
|
27044
|
+
previousActiveUuid = record2.uuid;
|
|
27045
|
+
continue;
|
|
27046
|
+
}
|
|
27047
|
+
if (!isSessionArtifactRecord(record2)) continue;
|
|
27048
|
+
const nextUuid = nextActiveUuidByIndex.get(index);
|
|
27049
|
+
const isInActiveSegment = !nextBlockingUuidByIndex.has(index) && (nextUuid !== void 0 ? activeUuids.has(nextUuid) : previousActiveUuid !== void 0 && activeUuids.has(previousActiveUuid));
|
|
27050
|
+
if (record2.parentUuid !== null && (activeUuids.has(record2.parentUuid) || includedSideArtifactUuids.has(record2.parentUuid)) && isInActiveSegment && (record2.parentUuid === previousActiveUuid || includedSideArtifactUuids.has(record2.parentUuid))) {
|
|
27051
|
+
selected.push(record2.uuid);
|
|
27052
|
+
includedSideArtifactUuids.add(record2.uuid);
|
|
27053
|
+
} else if (record2.parentUuid === null && index < firstActiveIndex && isInActiveSegment) {
|
|
27054
|
+
selected.push(record2.uuid);
|
|
27055
|
+
includedSideArtifactUuids.add(record2.uuid);
|
|
27056
|
+
}
|
|
27057
|
+
}
|
|
27058
|
+
return selected;
|
|
27059
|
+
}
|
|
27060
|
+
__name(selectActiveSideArtifactRecordUuids, "selectActiveSideArtifactRecordUuids");
|
|
26974
27061
|
function stableSessionArtifactId(sessionId, identityKey) {
|
|
26975
27062
|
return createHash2("sha256").update(`${sessionId}:${identityKey}`).digest("hex").slice(0, 16);
|
|
26976
27063
|
}
|
|
@@ -26982,75 +27069,87 @@ function sessionArtifactIdentityKey(artifact) {
|
|
|
26982
27069
|
return void 0;
|
|
26983
27070
|
}
|
|
26984
27071
|
__name(sessionArtifactIdentityKey, "sessionArtifactIdentityKey");
|
|
26985
|
-
|
|
26986
|
-
|
|
26987
|
-
|
|
26988
|
-
|
|
26989
|
-
|
|
26990
|
-
|
|
26991
|
-
|
|
26992
|
-
|
|
26993
|
-
|
|
26994
|
-
|
|
26995
|
-
|
|
26996
|
-
|
|
27072
|
+
var SessionArtifactSnapshotAccumulator = class {
|
|
27073
|
+
static {
|
|
27074
|
+
__name(this, "SessionArtifactSnapshotAccumulator");
|
|
27075
|
+
}
|
|
27076
|
+
artifacts = /* @__PURE__ */ new Map();
|
|
27077
|
+
tombstonedIds = /* @__PURE__ */ new Set();
|
|
27078
|
+
stickyEphemeralIds = /* @__PURE__ */ new Set();
|
|
27079
|
+
markerArtifacts = /* @__PURE__ */ new Map();
|
|
27080
|
+
warnings = [];
|
|
27081
|
+
sequence = 0;
|
|
27082
|
+
lastSnapshotSequence = 0;
|
|
27083
|
+
sessionId;
|
|
27084
|
+
sawRecord = false;
|
|
27085
|
+
constructor(fallbackSessionId) {
|
|
27086
|
+
this.sessionId = fallbackSessionId;
|
|
27087
|
+
}
|
|
27088
|
+
add(record2) {
|
|
27089
|
+
if (!isSessionArtifactRecord(record2)) return;
|
|
26997
27090
|
if (record2.subtype === "session_artifact_snapshot") {
|
|
26998
|
-
const payload2 = normalizeSnapshotPayload(
|
|
26999
|
-
|
|
27000
|
-
|
|
27001
|
-
|
|
27002
|
-
|
|
27003
|
-
|
|
27004
|
-
|
|
27005
|
-
|
|
27006
|
-
|
|
27007
|
-
|
|
27008
|
-
|
|
27091
|
+
const payload2 = normalizeSnapshotPayload(
|
|
27092
|
+
record2.systemPayload,
|
|
27093
|
+
this.warnings
|
|
27094
|
+
);
|
|
27095
|
+
if (!payload2) return;
|
|
27096
|
+
this.sawRecord = true;
|
|
27097
|
+
this.sessionId = payload2.sessionId;
|
|
27098
|
+
this.sequence = Math.max(this.sequence, payload2.sequence);
|
|
27099
|
+
this.lastSnapshotSequence = payload2.sequence;
|
|
27100
|
+
this.artifacts.clear();
|
|
27101
|
+
this.tombstonedIds.clear();
|
|
27102
|
+
this.stickyEphemeralIds.clear();
|
|
27103
|
+
this.markerArtifacts.clear();
|
|
27104
|
+
for (const id of payload2.tombstonedIds ?? []) this.tombstonedIds.add(id);
|
|
27009
27105
|
for (const id of payload2.stickyEphemeralIds ?? []) {
|
|
27010
|
-
stickyEphemeralIds.add(id);
|
|
27106
|
+
this.stickyEphemeralIds.add(id);
|
|
27011
27107
|
}
|
|
27012
|
-
const markerIds = /* @__PURE__ */ new Set([
|
|
27108
|
+
const markerIds = /* @__PURE__ */ new Set([
|
|
27109
|
+
...this.tombstonedIds,
|
|
27110
|
+
...this.stickyEphemeralIds
|
|
27111
|
+
]);
|
|
27013
27112
|
for (const artifact of payload2.markerArtifacts ?? []) {
|
|
27014
27113
|
if (markerIds.has(artifact.id)) {
|
|
27015
|
-
markerArtifacts.set(artifact.id, artifact);
|
|
27114
|
+
this.markerArtifacts.set(artifact.id, artifact);
|
|
27016
27115
|
}
|
|
27017
27116
|
}
|
|
27018
27117
|
for (const artifact of payload2.artifacts) {
|
|
27019
27118
|
if (artifact.retention === "ephemeral") continue;
|
|
27020
|
-
artifacts.set(artifact.id, artifact);
|
|
27021
|
-
markerArtifacts.delete(artifact.id);
|
|
27119
|
+
this.artifacts.set(artifact.id, artifact);
|
|
27120
|
+
this.markerArtifacts.delete(artifact.id);
|
|
27022
27121
|
}
|
|
27023
|
-
|
|
27122
|
+
return;
|
|
27024
27123
|
}
|
|
27025
|
-
const payload = normalizeEventPayload(record2.systemPayload, warnings);
|
|
27026
|
-
if (!payload)
|
|
27027
|
-
sawRecord = true;
|
|
27028
|
-
sessionId = payload.sessionId;
|
|
27029
|
-
if (payload.sequence <= lastSnapshotSequence) {
|
|
27030
|
-
warnings.push(
|
|
27031
|
-
`skipped stale event sequence ${payload.sequence} at or before snapshot sequence ${lastSnapshotSequence}`
|
|
27124
|
+
const payload = normalizeEventPayload(record2.systemPayload, this.warnings);
|
|
27125
|
+
if (!payload) return;
|
|
27126
|
+
this.sawRecord = true;
|
|
27127
|
+
this.sessionId = payload.sessionId;
|
|
27128
|
+
if (payload.sequence <= this.lastSnapshotSequence) {
|
|
27129
|
+
this.warnings.push(
|
|
27130
|
+
`skipped stale event sequence ${payload.sequence} at or before snapshot sequence ${this.lastSnapshotSequence}`
|
|
27032
27131
|
);
|
|
27033
|
-
|
|
27132
|
+
return;
|
|
27034
27133
|
}
|
|
27035
|
-
sequence = Math.max(sequence, payload.sequence);
|
|
27134
|
+
this.sequence = Math.max(this.sequence, payload.sequence);
|
|
27036
27135
|
for (const change of payload.changes) {
|
|
27037
27136
|
if (change.action === "removed") {
|
|
27038
|
-
artifacts.delete(change.artifactId);
|
|
27137
|
+
this.artifacts.delete(change.artifactId);
|
|
27039
27138
|
if (change.reason === "explicit") {
|
|
27040
|
-
tombstonedIds.add(change.artifactId);
|
|
27041
|
-
stickyEphemeralIds.delete(change.artifactId);
|
|
27139
|
+
this.tombstonedIds.add(change.artifactId);
|
|
27140
|
+
this.stickyEphemeralIds.delete(change.artifactId);
|
|
27042
27141
|
if (change.artifact) {
|
|
27043
|
-
markerArtifacts.set(change.artifactId, change.artifact);
|
|
27142
|
+
this.markerArtifacts.set(change.artifactId, change.artifact);
|
|
27044
27143
|
}
|
|
27045
27144
|
}
|
|
27046
27145
|
if (change.reason === "eviction") {
|
|
27047
|
-
stickyEphemeralIds.delete(change.artifactId);
|
|
27048
|
-
markerArtifacts.delete(change.artifactId);
|
|
27146
|
+
this.stickyEphemeralIds.delete(change.artifactId);
|
|
27147
|
+
this.markerArtifacts.delete(change.artifactId);
|
|
27049
27148
|
}
|
|
27050
27149
|
if (change.reason === "unpin_to_ephemeral") {
|
|
27051
|
-
stickyEphemeralIds.add(change.artifactId);
|
|
27150
|
+
this.stickyEphemeralIds.add(change.artifactId);
|
|
27052
27151
|
if (change.artifact) {
|
|
27053
|
-
markerArtifacts.set(change.artifactId, change.artifact);
|
|
27152
|
+
this.markerArtifacts.set(change.artifactId, change.artifact);
|
|
27054
27153
|
}
|
|
27055
27154
|
}
|
|
27056
27155
|
continue;
|
|
@@ -27058,25 +27157,30 @@ function rebuildSessionArtifactSnapshot(records, fallbackSessionId) {
|
|
|
27058
27157
|
if (!change.artifact || change.artifact.retention === "ephemeral") {
|
|
27059
27158
|
continue;
|
|
27060
27159
|
}
|
|
27061
|
-
artifacts.set(change.artifact.id, change.artifact);
|
|
27062
|
-
tombstonedIds.delete(change.artifact.id);
|
|
27063
|
-
stickyEphemeralIds.delete(change.artifact.id);
|
|
27064
|
-
markerArtifacts.delete(change.artifact.id);
|
|
27160
|
+
this.artifacts.set(change.artifact.id, change.artifact);
|
|
27161
|
+
this.tombstonedIds.delete(change.artifact.id);
|
|
27162
|
+
this.stickyEphemeralIds.delete(change.artifact.id);
|
|
27163
|
+
this.markerArtifacts.delete(change.artifact.id);
|
|
27065
27164
|
}
|
|
27066
27165
|
}
|
|
27067
|
-
|
|
27068
|
-
return void 0;
|
|
27166
|
+
finish() {
|
|
27167
|
+
if (!this.sawRecord || !this.sessionId) return void 0;
|
|
27168
|
+
return {
|
|
27169
|
+
v: SESSION_ARTIFACT_PERSISTENCE_VERSION,
|
|
27170
|
+
sessionId: this.sessionId,
|
|
27171
|
+
sequence: this.sequence,
|
|
27172
|
+
artifacts: Array.from(this.artifacts.values()),
|
|
27173
|
+
tombstonedIds: Array.from(this.tombstonedIds),
|
|
27174
|
+
stickyEphemeralIds: Array.from(this.stickyEphemeralIds),
|
|
27175
|
+
...this.markerArtifacts.size > 0 ? { markerArtifacts: Array.from(this.markerArtifacts.values()) } : {},
|
|
27176
|
+
warnings: this.warnings
|
|
27177
|
+
};
|
|
27069
27178
|
}
|
|
27070
|
-
|
|
27071
|
-
|
|
27072
|
-
|
|
27073
|
-
|
|
27074
|
-
|
|
27075
|
-
tombstonedIds: Array.from(tombstonedIds),
|
|
27076
|
-
stickyEphemeralIds: Array.from(stickyEphemeralIds),
|
|
27077
|
-
...markerArtifacts.size > 0 ? { markerArtifacts: Array.from(markerArtifacts.values()) } : {},
|
|
27078
|
-
warnings
|
|
27079
|
-
};
|
|
27179
|
+
};
|
|
27180
|
+
function rebuildSessionArtifactSnapshot(records, fallbackSessionId) {
|
|
27181
|
+
const accumulator = new SessionArtifactSnapshotAccumulator(fallbackSessionId);
|
|
27182
|
+
for (const record2 of records) accumulator.add(record2);
|
|
27183
|
+
return accumulator.finish();
|
|
27080
27184
|
}
|
|
27081
27185
|
__name(rebuildSessionArtifactSnapshot, "rebuildSessionArtifactSnapshot");
|
|
27082
27186
|
function remapSessionArtifactPayloadForFork(payload, sourceSessionId, newSessionId, remappedArtifactIds = /* @__PURE__ */ new Map()) {
|
|
@@ -28177,6 +28281,291 @@ import * as crypto from "node:crypto";
|
|
|
28177
28281
|
import * as fs10 from "node:fs";
|
|
28178
28282
|
import * as fsp from "node:fs/promises";
|
|
28179
28283
|
import * as path10 from "node:path";
|
|
28284
|
+
import { performance as performance3 } from "node:perf_hooks";
|
|
28285
|
+
|
|
28286
|
+
// packages/core/src/services/session-api-history.ts
|
|
28287
|
+
init_esbuild_shims();
|
|
28288
|
+
function stripThoughtsFromContent(content) {
|
|
28289
|
+
if (!content.parts) return content;
|
|
28290
|
+
const filteredParts = content.parts.filter((part) => !part.thought);
|
|
28291
|
+
if (filteredParts.length === 0) return null;
|
|
28292
|
+
return { ...content, parts: filteredParts };
|
|
28293
|
+
}
|
|
28294
|
+
__name(stripThoughtsFromContent, "stripThoughtsFromContent");
|
|
28295
|
+
function copyContentForApiHistory(content) {
|
|
28296
|
+
return {
|
|
28297
|
+
...content,
|
|
28298
|
+
parts: content.parts?.map((part) => {
|
|
28299
|
+
if ("functionCall" in part && part.functionCall) {
|
|
28300
|
+
return {
|
|
28301
|
+
...part,
|
|
28302
|
+
functionCall: {
|
|
28303
|
+
...part.functionCall,
|
|
28304
|
+
args: part.functionCall.args ? { ...part.functionCall.args } : part.functionCall.args
|
|
28305
|
+
}
|
|
28306
|
+
};
|
|
28307
|
+
}
|
|
28308
|
+
if ("functionResponse" in part && part.functionResponse) {
|
|
28309
|
+
return {
|
|
28310
|
+
...part,
|
|
28311
|
+
functionResponse: { ...part.functionResponse }
|
|
28312
|
+
};
|
|
28313
|
+
}
|
|
28314
|
+
return { ...part };
|
|
28315
|
+
})
|
|
28316
|
+
};
|
|
28317
|
+
}
|
|
28318
|
+
__name(copyContentForApiHistory, "copyContentForApiHistory");
|
|
28319
|
+
function appendApiHistoryRecord(history, record2) {
|
|
28320
|
+
if (!record2.message || record2.subtype === "realtime_message") return;
|
|
28321
|
+
const message = copyContentForApiHistory(record2.message);
|
|
28322
|
+
if (record2.subtype === "mid_turn_user_message") {
|
|
28323
|
+
const previous = history.at(-1);
|
|
28324
|
+
if (previous?.role === "user") {
|
|
28325
|
+
previous.parts = [...previous.parts ?? [], ...message.parts ?? []];
|
|
28326
|
+
return;
|
|
28327
|
+
}
|
|
28328
|
+
}
|
|
28329
|
+
history.push(message);
|
|
28330
|
+
}
|
|
28331
|
+
__name(appendApiHistoryRecord, "appendApiHistoryRecord");
|
|
28332
|
+
var SessionApiHistoryAccumulator = class {
|
|
28333
|
+
static {
|
|
28334
|
+
__name(this, "SessionApiHistoryAccumulator");
|
|
28335
|
+
}
|
|
28336
|
+
history = [];
|
|
28337
|
+
compressionCandidate;
|
|
28338
|
+
add(record2) {
|
|
28339
|
+
if (record2.type === "system") {
|
|
28340
|
+
if (!isApiHistoryCompressionCandidate(record2)) return;
|
|
28341
|
+
const payload = record2.systemPayload;
|
|
28342
|
+
this.compressionCandidate = payload.compressedHistory;
|
|
28343
|
+
this.history = Array.isArray(payload.compressedHistory) ? payload.compressedHistory.map(copyContentForApiHistory) : [];
|
|
28344
|
+
return;
|
|
28345
|
+
}
|
|
28346
|
+
if (this.compressionCandidate !== void 0 && !Array.isArray(this.compressionCandidate)) {
|
|
28347
|
+
return;
|
|
28348
|
+
}
|
|
28349
|
+
appendApiHistoryRecord(this.history, record2);
|
|
28350
|
+
}
|
|
28351
|
+
finish(options2 = {}) {
|
|
28352
|
+
if (this.compressionCandidate !== void 0 && !Array.isArray(this.compressionCandidate)) {
|
|
28353
|
+
return this.compressionCandidate.map(
|
|
28354
|
+
copyContentForApiHistory
|
|
28355
|
+
);
|
|
28356
|
+
}
|
|
28357
|
+
if (!options2.stripThoughtsFromHistory) return this.history;
|
|
28358
|
+
return this.history.map(stripThoughtsFromContent).filter((content) => content !== null);
|
|
28359
|
+
}
|
|
28360
|
+
};
|
|
28361
|
+
function isApiHistoryCompressionCandidate(record2) {
|
|
28362
|
+
if (record2.type !== "system" || record2.subtype !== "chat_compression") {
|
|
28363
|
+
return false;
|
|
28364
|
+
}
|
|
28365
|
+
const payload = record2.systemPayload;
|
|
28366
|
+
return Boolean(payload?.compressedHistory);
|
|
28367
|
+
}
|
|
28368
|
+
__name(isApiHistoryCompressionCandidate, "isApiHistoryCompressionCandidate");
|
|
28369
|
+
function buildApiHistoryFromConversation(conversation, options2 = {}) {
|
|
28370
|
+
const accumulator = new SessionApiHistoryAccumulator();
|
|
28371
|
+
for (const record2 of conversation.messages) accumulator.add(record2);
|
|
28372
|
+
return accumulator.finish(options2);
|
|
28373
|
+
}
|
|
28374
|
+
__name(buildApiHistoryFromConversation, "buildApiHistoryFromConversation");
|
|
28375
|
+
|
|
28376
|
+
// packages/core/src/services/session-resume-token-counts.ts
|
|
28377
|
+
init_esbuild_shims();
|
|
28378
|
+
|
|
28379
|
+
// packages/core/src/services/tokenEstimation.ts
|
|
28380
|
+
init_esbuild_shims();
|
|
28381
|
+
var CHARS_PER_TOKEN = TOKEN_TO_CHAR_RATIO;
|
|
28382
|
+
function estimateContentTokens(contents, imageTokenEstimate = DEFAULT_IMAGE_TOKEN_ESTIMATE) {
|
|
28383
|
+
let totalChars = 0;
|
|
28384
|
+
for (const content of contents) {
|
|
28385
|
+
totalChars += estimateContentChars(content, imageTokenEstimate);
|
|
28386
|
+
}
|
|
28387
|
+
return Math.ceil(totalChars / CHARS_PER_TOKEN);
|
|
28388
|
+
}
|
|
28389
|
+
__name(estimateContentTokens, "estimateContentTokens");
|
|
28390
|
+
var CONSERVATIVE_NEW_CONTENT_SAFETY_FACTOR = 1.5;
|
|
28391
|
+
function estimatePromptTokens(history, userMessage, lastPromptTokenCount, lastOutputTokenCount = 0, imageTokenEstimate = DEFAULT_IMAGE_TOKEN_ESTIMATE, conservative = false) {
|
|
28392
|
+
if (lastPromptTokenCount > 0) {
|
|
28393
|
+
const newContentTokens = estimateContentTokens(
|
|
28394
|
+
[userMessage],
|
|
28395
|
+
imageTokenEstimate
|
|
28396
|
+
);
|
|
28397
|
+
return lastPromptTokenCount + lastOutputTokenCount + (conservative ? Math.ceil(newContentTokens * CONSERVATIVE_NEW_CONTENT_SAFETY_FACTOR) : newContentTokens);
|
|
28398
|
+
}
|
|
28399
|
+
return estimateContentTokens([...history, userMessage], imageTokenEstimate);
|
|
28400
|
+
}
|
|
28401
|
+
__name(estimatePromptTokens, "estimatePromptTokens");
|
|
28402
|
+
function getUsageOutputTokenCountForPromptEstimate(usage) {
|
|
28403
|
+
if (usage?.promptTokenCount === void 0) {
|
|
28404
|
+
return 0;
|
|
28405
|
+
}
|
|
28406
|
+
if (usage.totalTokenCount !== void 0) {
|
|
28407
|
+
return Math.max(0, usage.totalTokenCount - usage.promptTokenCount);
|
|
28408
|
+
}
|
|
28409
|
+
const candidates = Math.max(0, usage.candidatesTokenCount ?? 0);
|
|
28410
|
+
const thoughts = Math.max(0, usage.thoughtsTokenCount ?? 0);
|
|
28411
|
+
return candidates > thoughts ? candidates : candidates + thoughts;
|
|
28412
|
+
}
|
|
28413
|
+
__name(getUsageOutputTokenCountForPromptEstimate, "getUsageOutputTokenCountForPromptEstimate");
|
|
28414
|
+
|
|
28415
|
+
// packages/core/src/services/session-resume-token-counts.ts
|
|
28416
|
+
var ResumeTokenCountsAccumulator = class {
|
|
28417
|
+
static {
|
|
28418
|
+
__name(this, "ResumeTokenCountsAccumulator");
|
|
28419
|
+
}
|
|
28420
|
+
value;
|
|
28421
|
+
add(record2) {
|
|
28422
|
+
if (record2.type === "assistant") {
|
|
28423
|
+
const usage = record2.usageMetadata;
|
|
28424
|
+
const candidate = usage?.promptTokenCount ?? usage?.totalTokenCount;
|
|
28425
|
+
if (candidate) {
|
|
28426
|
+
this.value = {
|
|
28427
|
+
promptTokenCount: candidate,
|
|
28428
|
+
outputTokenCount: getUsageOutputTokenCountForPromptEstimate(usage),
|
|
28429
|
+
isEstimated: false
|
|
28430
|
+
};
|
|
28431
|
+
}
|
|
28432
|
+
return;
|
|
28433
|
+
}
|
|
28434
|
+
if (record2.type === "system" && record2.subtype === "chat_compression") {
|
|
28435
|
+
const payload = record2.systemPayload;
|
|
28436
|
+
if (payload?.info) {
|
|
28437
|
+
this.value = {
|
|
28438
|
+
promptTokenCount: payload.info.newTokenCount,
|
|
28439
|
+
outputTokenCount: 0,
|
|
28440
|
+
isEstimated: payload.info.newTokenCountIsEstimated ?? true
|
|
28441
|
+
};
|
|
28442
|
+
}
|
|
28443
|
+
}
|
|
28444
|
+
}
|
|
28445
|
+
finish() {
|
|
28446
|
+
return this.value;
|
|
28447
|
+
}
|
|
28448
|
+
};
|
|
28449
|
+
function isResumeTokenCountsCandidate(record2) {
|
|
28450
|
+
if (record2.type === "assistant") {
|
|
28451
|
+
const usage = record2.usageMetadata;
|
|
28452
|
+
return Boolean(usage?.promptTokenCount ?? usage?.totalTokenCount);
|
|
28453
|
+
}
|
|
28454
|
+
if (record2.type !== "system" || record2.subtype !== "chat_compression") {
|
|
28455
|
+
return false;
|
|
28456
|
+
}
|
|
28457
|
+
const payload = record2.systemPayload;
|
|
28458
|
+
return payload?.info !== void 0;
|
|
28459
|
+
}
|
|
28460
|
+
__name(isResumeTokenCountsCandidate, "isResumeTokenCountsCandidate");
|
|
28461
|
+
function getResumeTokenCounts(conversation) {
|
|
28462
|
+
const accumulator = new ResumeTokenCountsAccumulator();
|
|
28463
|
+
for (const record2 of conversation.messages) accumulator.add(record2);
|
|
28464
|
+
return accumulator.finish();
|
|
28465
|
+
}
|
|
28466
|
+
__name(getResumeTokenCounts, "getResumeTokenCounts");
|
|
28467
|
+
|
|
28468
|
+
// packages/core/src/services/session-turn-state.ts
|
|
28469
|
+
init_esbuild_shims();
|
|
28470
|
+
var SessionTurnStateAccumulator = class {
|
|
28471
|
+
constructor(sessionId) {
|
|
28472
|
+
this.sessionId = sessionId;
|
|
28473
|
+
}
|
|
28474
|
+
static {
|
|
28475
|
+
__name(this, "SessionTurnStateAccumulator");
|
|
28476
|
+
}
|
|
28477
|
+
maxPromptTurn = 0;
|
|
28478
|
+
userMessageCount = 0;
|
|
28479
|
+
turnParentUuids = [];
|
|
28480
|
+
backgroundNotificationTaskIds = /* @__PURE__ */ new Set();
|
|
28481
|
+
add(record2) {
|
|
28482
|
+
this.addHint(getSessionTurnRecordHint(record2, this.sessionId));
|
|
28483
|
+
}
|
|
28484
|
+
addHint(hint) {
|
|
28485
|
+
if (hint.countsAsUserPrompt) {
|
|
28486
|
+
this.userMessageCount += 1;
|
|
28487
|
+
}
|
|
28488
|
+
if (hint.promptTurn !== void 0) {
|
|
28489
|
+
this.maxPromptTurn = Math.max(this.maxPromptTurn, hint.promptTurn);
|
|
28490
|
+
}
|
|
28491
|
+
if (hint.turnParentUuid !== void 0) {
|
|
28492
|
+
this.turnParentUuids.push(hint.turnParentUuid);
|
|
28493
|
+
}
|
|
28494
|
+
if (hint.backgroundNotificationTaskId !== void 0) {
|
|
28495
|
+
this.backgroundNotificationTaskIds.add(hint.backgroundNotificationTaskId);
|
|
28496
|
+
}
|
|
28497
|
+
}
|
|
28498
|
+
finish() {
|
|
28499
|
+
return {
|
|
28500
|
+
initialTurn: this.maxPromptTurn > 0 ? this.maxPromptTurn : this.userMessageCount,
|
|
28501
|
+
turnParentUuids: [...this.turnParentUuids],
|
|
28502
|
+
backgroundNotificationTaskIds: [...this.backgroundNotificationTaskIds]
|
|
28503
|
+
};
|
|
28504
|
+
}
|
|
28505
|
+
};
|
|
28506
|
+
function getSessionTurnRecordHint(record2, sessionId) {
|
|
28507
|
+
let promptTurn;
|
|
28508
|
+
for (const promptId of getRecordPromptIds(record2)) {
|
|
28509
|
+
const candidate = parseSessionPromptTurn(promptId, sessionId);
|
|
28510
|
+
if (candidate !== void 0) {
|
|
28511
|
+
promptTurn = Math.max(promptTurn ?? 0, candidate);
|
|
28512
|
+
}
|
|
28513
|
+
}
|
|
28514
|
+
const turnParentUuid = record2.type === "user" && record2.subtype !== "goal_runtime" && record2.subtype !== "notification" && record2.subtype !== "cron" && record2.subtype !== "mid_turn_user_message" && record2.subtype !== "realtime_message" ? record2.parentUuid ?? null : void 0;
|
|
28515
|
+
const backgroundTask = record2.subtype === "notification" ? record2.systemPayload?.backgroundTask : void 0;
|
|
28516
|
+
return {
|
|
28517
|
+
...promptTurn !== void 0 ? { promptTurn } : {},
|
|
28518
|
+
countsAsUserPrompt: record2.sessionId === sessionId && isUserPromptRecord(record2),
|
|
28519
|
+
...turnParentUuid !== void 0 ? { turnParentUuid } : {},
|
|
28520
|
+
...typeof backgroundTask?.taskId === "string" ? { backgroundNotificationTaskId: backgroundTask.taskId } : {}
|
|
28521
|
+
};
|
|
28522
|
+
}
|
|
28523
|
+
__name(getSessionTurnRecordHint, "getSessionTurnRecordHint");
|
|
28524
|
+
function collectSessionTurnState(records, sessionId) {
|
|
28525
|
+
const accumulator = new SessionTurnStateAccumulator(sessionId);
|
|
28526
|
+
for (const record2 of records) accumulator.add(record2);
|
|
28527
|
+
return accumulator.finish();
|
|
28528
|
+
}
|
|
28529
|
+
__name(collectSessionTurnState, "collectSessionTurnState");
|
|
28530
|
+
function getRecordPromptIds(record2) {
|
|
28531
|
+
const promptIds = [];
|
|
28532
|
+
const recordPromptId = record2.promptId;
|
|
28533
|
+
if (typeof recordPromptId === "string") promptIds.push(recordPromptId);
|
|
28534
|
+
const telemetryPromptId = readTelemetryPromptId(record2.systemPayload);
|
|
28535
|
+
if (telemetryPromptId) promptIds.push(telemetryPromptId);
|
|
28536
|
+
return promptIds;
|
|
28537
|
+
}
|
|
28538
|
+
__name(getRecordPromptIds, "getRecordPromptIds");
|
|
28539
|
+
function readTelemetryPromptId(payload) {
|
|
28540
|
+
if (!payload || typeof payload !== "object" || !("uiEvent" in payload)) {
|
|
28541
|
+
return void 0;
|
|
28542
|
+
}
|
|
28543
|
+
const uiEvent = payload.uiEvent;
|
|
28544
|
+
if (!uiEvent || typeof uiEvent !== "object" || !("prompt_id" in uiEvent)) {
|
|
28545
|
+
return void 0;
|
|
28546
|
+
}
|
|
28547
|
+
const promptId = uiEvent.prompt_id;
|
|
28548
|
+
return typeof promptId === "string" ? promptId : void 0;
|
|
28549
|
+
}
|
|
28550
|
+
__name(readTelemetryPromptId, "readTelemetryPromptId");
|
|
28551
|
+
function parseSessionPromptTurn(promptId, sessionId) {
|
|
28552
|
+
const promptIdPrefix = `${sessionId}########`;
|
|
28553
|
+
if (!promptId.startsWith(promptIdPrefix)) return void 0;
|
|
28554
|
+
const suffix = promptId.slice(promptIdPrefix.length);
|
|
28555
|
+
return /^\d+$/.test(suffix) ? Number(suffix) : void 0;
|
|
28556
|
+
}
|
|
28557
|
+
__name(parseSessionPromptTurn, "parseSessionPromptTurn");
|
|
28558
|
+
function isUserPromptRecord(record2) {
|
|
28559
|
+
if (record2.type !== "user" || record2.subtype === "realtime_message") {
|
|
28560
|
+
return false;
|
|
28561
|
+
}
|
|
28562
|
+
return record2.message?.parts?.some(
|
|
28563
|
+
(part) => typeof part.text === "string" && part.text.trim().length > 0
|
|
28564
|
+
) ?? false;
|
|
28565
|
+
}
|
|
28566
|
+
__name(isUserPromptRecord, "isUserPromptRecord");
|
|
28567
|
+
|
|
28568
|
+
// packages/core/src/services/session-transcript-reader.ts
|
|
28180
28569
|
var SESSION_TRANSCRIPT_DEFAULT_LIMIT = 100;
|
|
28181
28570
|
var SESSION_TRANSCRIPT_MAX_LIMIT = 500;
|
|
28182
28571
|
var SESSION_TRANSCRIPT_CURSOR_VERSION = 1;
|
|
@@ -28201,6 +28590,11 @@ var SessionTranscriptSnapshotUnavailableError = class extends Error {
|
|
|
28201
28590
|
this.name = "SessionTranscriptSnapshotUnavailableError";
|
|
28202
28591
|
}
|
|
28203
28592
|
};
|
|
28593
|
+
var EmptySessionTranscriptError = class extends SessionTranscriptSnapshotUnavailableError {
|
|
28594
|
+
static {
|
|
28595
|
+
__name(this, "EmptySessionTranscriptError");
|
|
28596
|
+
}
|
|
28597
|
+
};
|
|
28204
28598
|
var SessionTranscriptTooLargeError = class extends Error {
|
|
28205
28599
|
constructor(sessionId, snapshotSize, maxBytes) {
|
|
28206
28600
|
super(
|
|
@@ -28235,15 +28629,104 @@ var INDEX_CACHE_TTL_MS = 5 * 60 * 1e3;
|
|
|
28235
28629
|
var INDEX_ENTRY_BASE_BYTES = 256;
|
|
28236
28630
|
var INDEX_SEGMENT_BYTES = 64;
|
|
28237
28631
|
var INDEX_STRING_BYTES = 2;
|
|
28632
|
+
var INDEX_HINT_BASE_BYTES = 64;
|
|
28633
|
+
var INDEX_CONTAINER_BASE_BYTES = 64;
|
|
28634
|
+
var INDEX_CONTAINER_SLOT_BYTES = 8;
|
|
28635
|
+
var INDEX_MAP_ENTRY_BYTES = 48;
|
|
28238
28636
|
var READ_CHUNK_SIZE = 64 * 1024;
|
|
28637
|
+
var COOPERATIVE_READ_BYTE_BUDGET = 2 * 1024 * 1024;
|
|
28638
|
+
var COOPERATIVE_READ_TIME_BUDGET_MS = 8;
|
|
28239
28639
|
var CURSOR_HMAC_KEY_BYTES = 32;
|
|
28240
28640
|
var CURSOR_HMAC_KEY_FILENAME = "session-transcript-cursor-key";
|
|
28241
28641
|
var SESSION_TRANSCRIPT_SESSION_ID_PATTERN = /^[0-9a-fA-F-]{32,36}$/;
|
|
28242
28642
|
var debugLogger14 = createDebugLogger("SESSION_TRANSCRIPT");
|
|
28643
|
+
function recordRestoreStage(stage, startedAt) {
|
|
28644
|
+
const durationMs = Math.round((performance3.now() - startedAt) * 100) / 100;
|
|
28645
|
+
if (Number.isFinite(durationMs) && durationMs >= 0) {
|
|
28646
|
+
addDaemonRequestAttribute(
|
|
28647
|
+
`qwen-code.daemon.session_restore.${stage}_ms`,
|
|
28648
|
+
durationMs
|
|
28649
|
+
);
|
|
28650
|
+
}
|
|
28651
|
+
}
|
|
28652
|
+
__name(recordRestoreStage, "recordRestoreStage");
|
|
28653
|
+
function recordRestoreIndexAttributes(index) {
|
|
28654
|
+
addDaemonRequestAttribute(
|
|
28655
|
+
"qwen-code.daemon.session_restore.transcript_bytes",
|
|
28656
|
+
index.snapshotSize
|
|
28657
|
+
);
|
|
28658
|
+
addDaemonRequestAttribute(
|
|
28659
|
+
"qwen-code.daemon.session_restore.records_indexed",
|
|
28660
|
+
index.byUuid.size
|
|
28661
|
+
);
|
|
28662
|
+
addDaemonRequestAttribute(
|
|
28663
|
+
"qwen-code.daemon.session_restore.active_records",
|
|
28664
|
+
index.runtimeUuids.length
|
|
28665
|
+
);
|
|
28666
|
+
}
|
|
28667
|
+
__name(recordRestoreIndexAttributes, "recordRestoreIndexAttributes");
|
|
28668
|
+
function selectedRecordBytes(index, uuids) {
|
|
28669
|
+
const offsets = /* @__PURE__ */ new Set();
|
|
28670
|
+
let bytes = 0;
|
|
28671
|
+
for (const uuid of uuids) {
|
|
28672
|
+
const entry = index.byUuid.get(uuid);
|
|
28673
|
+
if (!entry) continue;
|
|
28674
|
+
for (const segment of entry.segments) {
|
|
28675
|
+
if (offsets.has(segment.offset)) continue;
|
|
28676
|
+
offsets.add(segment.offset);
|
|
28677
|
+
bytes += segment.length;
|
|
28678
|
+
}
|
|
28679
|
+
}
|
|
28680
|
+
return bytes;
|
|
28681
|
+
}
|
|
28682
|
+
__name(selectedRecordBytes, "selectedRecordBytes");
|
|
28683
|
+
function recordRestoreSelectionAttributes(index, selectedUuids, replayUuids) {
|
|
28684
|
+
addDaemonRequestAttribute(
|
|
28685
|
+
"qwen-code.daemon.session_restore.selected_records",
|
|
28686
|
+
selectedUuids.size
|
|
28687
|
+
);
|
|
28688
|
+
addDaemonRequestAttribute(
|
|
28689
|
+
"qwen-code.daemon.session_restore.selected_bytes",
|
|
28690
|
+
selectedRecordBytes(index, selectedUuids)
|
|
28691
|
+
);
|
|
28692
|
+
addDaemonRequestAttribute(
|
|
28693
|
+
"qwen-code.daemon.session_restore.replay_records",
|
|
28694
|
+
replayUuids.size
|
|
28695
|
+
);
|
|
28696
|
+
addDaemonRequestAttribute(
|
|
28697
|
+
"qwen-code.daemon.session_restore.replay_bytes",
|
|
28698
|
+
selectedRecordBytes(index, replayUuids)
|
|
28699
|
+
);
|
|
28700
|
+
}
|
|
28701
|
+
__name(recordRestoreSelectionAttributes, "recordRestoreSelectionAttributes");
|
|
28243
28702
|
var indexCache = /* @__PURE__ */ new Map();
|
|
28244
28703
|
var cursorHmacKeys = /* @__PURE__ */ new Map();
|
|
28245
28704
|
var indexCacheMaxBytesForTest;
|
|
28246
28705
|
var expandedPageBytesForTest;
|
|
28706
|
+
var cooperativeReadByteBudgetForTest;
|
|
28707
|
+
var cooperativeReadTimeBudgetMsForTest;
|
|
28708
|
+
var cooperativeYieldHookForTest;
|
|
28709
|
+
var selectedLineReadHookForTest;
|
|
28710
|
+
var indexBuildCompleteHookForTest;
|
|
28711
|
+
var CooperativeReadScheduler = class {
|
|
28712
|
+
static {
|
|
28713
|
+
__name(this, "CooperativeReadScheduler");
|
|
28714
|
+
}
|
|
28715
|
+
processedBytes = 0;
|
|
28716
|
+
startedAt = performance3.now();
|
|
28717
|
+
async afterUnit(sourceBytes) {
|
|
28718
|
+
this.processedBytes += sourceBytes;
|
|
28719
|
+
const byteBudget = cooperativeReadByteBudgetForTest ?? COOPERATIVE_READ_BYTE_BUDGET;
|
|
28720
|
+
const timeBudgetMs = cooperativeReadTimeBudgetMsForTest ?? COOPERATIVE_READ_TIME_BUDGET_MS;
|
|
28721
|
+
if (this.processedBytes < byteBudget && performance3.now() - this.startedAt < timeBudgetMs) {
|
|
28722
|
+
return;
|
|
28723
|
+
}
|
|
28724
|
+
cooperativeYieldHookForTest?.();
|
|
28725
|
+
await new Promise((resolve41) => setImmediate(resolve41));
|
|
28726
|
+
this.processedBytes = 0;
|
|
28727
|
+
this.startedAt = performance3.now();
|
|
28728
|
+
}
|
|
28729
|
+
};
|
|
28247
28730
|
function getExpandedPageBytes() {
|
|
28248
28731
|
return expandedPageBytesForTest ?? SESSION_TRANSCRIPT_MAX_EXPANDED_PAGE_BYTES;
|
|
28249
28732
|
}
|
|
@@ -28262,6 +28745,14 @@ function isObjectRecord(value) {
|
|
|
28262
28745
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
28263
28746
|
}
|
|
28264
28747
|
__name(isObjectRecord, "isObjectRecord");
|
|
28748
|
+
function isFileMissingError(error) {
|
|
28749
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
28750
|
+
}
|
|
28751
|
+
__name(isFileMissingError, "isFileMissingError");
|
|
28752
|
+
function isAttributionSnapshotCandidate(record2) {
|
|
28753
|
+
return record2.subtype === "attribution_snapshot" && isObjectRecord(record2.systemPayload) && "snapshot" in record2.systemPayload;
|
|
28754
|
+
}
|
|
28755
|
+
__name(isAttributionSnapshotCandidate, "isAttributionSnapshotCandidate");
|
|
28265
28756
|
function isFiniteNonNegativeInteger(value) {
|
|
28266
28757
|
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
28267
28758
|
}
|
|
@@ -28473,7 +28964,7 @@ function recordSegmentBytes(index, uuid) {
|
|
|
28473
28964
|
}
|
|
28474
28965
|
__name(recordSegmentBytes, "recordSegmentBytes");
|
|
28475
28966
|
function selectPageUuids(index, position, limit, maxBytes) {
|
|
28476
|
-
const candidates = index.
|
|
28967
|
+
const candidates = index.replayUuids.slice(position, position + limit);
|
|
28477
28968
|
if (maxBytes === void 0) return candidates;
|
|
28478
28969
|
const selected = [];
|
|
28479
28970
|
let selectedBytes = 0;
|
|
@@ -28516,7 +29007,7 @@ function findBoundaryAtOrBefore(items, from, floor, isBoundary) {
|
|
|
28516
29007
|
__name(findBoundaryAtOrBefore, "findBoundaryAtOrBefore");
|
|
28517
29008
|
function findReplayBoundaryAtOrBefore(index, from, floor, isBoundary) {
|
|
28518
29009
|
return findBoundaryAtOrBefore(
|
|
28519
|
-
index.
|
|
29010
|
+
index.replayUuids,
|
|
28520
29011
|
from,
|
|
28521
29012
|
floor,
|
|
28522
29013
|
(uuid) => isBoundary(index, uuid)
|
|
@@ -28526,7 +29017,7 @@ __name(findReplayBoundaryAtOrBefore, "findReplayBoundaryAtOrBefore");
|
|
|
28526
29017
|
function backwardPageBytesFit(index, start, end, budget) {
|
|
28527
29018
|
let total = 0;
|
|
28528
29019
|
for (let i = start; i < end; i++) {
|
|
28529
|
-
total += recordSegmentBytes(index, index.
|
|
29020
|
+
total += recordSegmentBytes(index, index.replayUuids[i]);
|
|
28530
29021
|
if (total > budget) return false;
|
|
28531
29022
|
}
|
|
28532
29023
|
return true;
|
|
@@ -28534,11 +29025,11 @@ function backwardPageBytesFit(index, start, end, budget) {
|
|
|
28534
29025
|
__name(backwardPageBytesFit, "backwardPageBytesFit");
|
|
28535
29026
|
function selectionOrphansToolResult(index, start, end) {
|
|
28536
29027
|
for (let i = start; i < end; i++) {
|
|
28537
|
-
if (index.byUuid.get(index.
|
|
29028
|
+
if (index.byUuid.get(index.replayUuids[i])?.type !== "tool_result") {
|
|
28538
29029
|
continue;
|
|
28539
29030
|
}
|
|
28540
29031
|
for (let owner = i - 1; owner >= start; owner--) {
|
|
28541
|
-
if (isReplayPageStart(index, index.
|
|
29032
|
+
if (isReplayPageStart(index, index.replayUuids[owner])) return false;
|
|
28542
29033
|
}
|
|
28543
29034
|
return true;
|
|
28544
29035
|
}
|
|
@@ -28550,7 +29041,7 @@ function selectBackwardPageUuids(index, sessionId, position, limit, maxBytes) {
|
|
|
28550
29041
|
const expansionByteBudget = maxBytes === void 0 ? getExpandedPageBytes() : Math.min(2 * maxBytes, getExpandedPageBytes());
|
|
28551
29042
|
let start = Math.max(0, position - limit);
|
|
28552
29043
|
for (let i = start; i < position; i++) {
|
|
28553
|
-
if (isReplayTurnStart(index, index.
|
|
29044
|
+
if (isReplayTurnStart(index, index.replayUuids[i])) {
|
|
28554
29045
|
start = i;
|
|
28555
29046
|
break;
|
|
28556
29047
|
}
|
|
@@ -28562,13 +29053,13 @@ function selectBackwardPageUuids(index, sessionId, position, limit, maxBytes) {
|
|
|
28562
29053
|
expansionFloor,
|
|
28563
29054
|
isReplayTurnStart
|
|
28564
29055
|
);
|
|
28565
|
-
if (isReplayTurnStart(index, index.
|
|
29056
|
+
if (isReplayTurnStart(index, index.replayUuids[expandedStart])) {
|
|
28566
29057
|
start = expandedStart;
|
|
28567
29058
|
}
|
|
28568
29059
|
let selectedStart = position;
|
|
28569
29060
|
let selectedBytes = 0;
|
|
28570
29061
|
for (let i = position - 1; i >= start; i--) {
|
|
28571
|
-
const uuid = index.
|
|
29062
|
+
const uuid = index.replayUuids[i];
|
|
28572
29063
|
const bytes = recordSegmentBytes(index, uuid);
|
|
28573
29064
|
if (selectedStart < position && maxBytes !== void 0 && selectedBytes + bytes > maxBytes) {
|
|
28574
29065
|
break;
|
|
@@ -28578,12 +29069,12 @@ function selectBackwardPageUuids(index, sessionId, position, limit, maxBytes) {
|
|
|
28578
29069
|
}
|
|
28579
29070
|
const logTurnExpansionSkipped = /* @__PURE__ */ __name((reason) => {
|
|
28580
29071
|
debugLogger14.debug(
|
|
28581
|
-
`backward turn expansion skipped session=${sessionId} start=${index.
|
|
29072
|
+
`backward turn expansion skipped session=${sessionId} start=${index.replayUuids[selectedStart]} reason=${reason}`
|
|
28582
29073
|
);
|
|
28583
29074
|
}, "logTurnExpansionSkipped");
|
|
28584
29075
|
let alignedToReplayBoundary = false;
|
|
28585
29076
|
for (let i = selectedStart; i < position; i++) {
|
|
28586
|
-
if (isReplayTurnStart(index, index.
|
|
29077
|
+
if (isReplayTurnStart(index, index.replayUuids[i])) {
|
|
28587
29078
|
selectedStart = i;
|
|
28588
29079
|
alignedToReplayBoundary = true;
|
|
28589
29080
|
break;
|
|
@@ -28612,7 +29103,7 @@ function selectBackwardPageUuids(index, sessionId, position, limit, maxBytes) {
|
|
|
28612
29103
|
expansionFloor,
|
|
28613
29104
|
isReplayTurnStart
|
|
28614
29105
|
);
|
|
28615
|
-
if (isReplayTurnStart(index, index.
|
|
29106
|
+
if (isReplayTurnStart(index, index.replayUuids[candidate])) {
|
|
28616
29107
|
if (backwardPageBytesFit(index, candidate, position, expansionByteBudget)) {
|
|
28617
29108
|
selectedStart = candidate;
|
|
28618
29109
|
} else {
|
|
@@ -28628,9 +29119,9 @@ function selectBackwardPageUuids(index, sessionId, position, limit, maxBytes) {
|
|
|
28628
29119
|
pairFloor,
|
|
28629
29120
|
isReplayPageStart
|
|
28630
29121
|
);
|
|
28631
|
-
if (!isReplayPageStart(index, index.
|
|
29122
|
+
if (!isReplayPageStart(index, index.replayUuids[pairStart])) {
|
|
28632
29123
|
debugLogger14.debug(
|
|
28633
|
-
`backward pair extension skipped session=${sessionId} start=${index.
|
|
29124
|
+
`backward pair extension skipped session=${sessionId} start=${index.replayUuids[selectedStart]} reason=record-budget`
|
|
28634
29125
|
);
|
|
28635
29126
|
} else if (!backwardPageBytesFit(
|
|
28636
29127
|
index,
|
|
@@ -28639,14 +29130,14 @@ function selectBackwardPageUuids(index, sessionId, position, limit, maxBytes) {
|
|
|
28639
29130
|
expansionByteBudget
|
|
28640
29131
|
)) {
|
|
28641
29132
|
debugLogger14.debug(
|
|
28642
|
-
`backward pair extension skipped session=${sessionId} start=${index.
|
|
29133
|
+
`backward pair extension skipped session=${sessionId} start=${index.replayUuids[selectedStart]} reason=byte-budget`
|
|
28643
29134
|
);
|
|
28644
29135
|
} else {
|
|
28645
29136
|
selectedStart = pairStart;
|
|
28646
29137
|
}
|
|
28647
29138
|
}
|
|
28648
29139
|
return {
|
|
28649
|
-
uuids: index.
|
|
29140
|
+
uuids: index.replayUuids.slice(selectedStart, position),
|
|
28650
29141
|
nextPosition: selectedStart
|
|
28651
29142
|
};
|
|
28652
29143
|
}
|
|
@@ -28672,8 +29163,14 @@ function estimateStringBytes(value) {
|
|
|
28672
29163
|
}
|
|
28673
29164
|
__name(estimateStringBytes, "estimateStringBytes");
|
|
28674
29165
|
function estimateIndexCacheBytes(index) {
|
|
28675
|
-
let total = INDEX_ENTRY_BASE_BYTES + estimateStringBytes(index.filePath) + estimateStringBytes(index.leafUuid) + estimateStringBytes(index.startTime) + estimateStringBytes(index.lastUpdated);
|
|
28676
|
-
for (const
|
|
29166
|
+
let total = INDEX_ENTRY_BASE_BYTES + INDEX_CONTAINER_BASE_BYTES * 6 + (index.physicalRecords.length + index.runtimeUuids.length + index.replayUuids.length + index.goalStatePositions.length + index.gaps.length) * INDEX_CONTAINER_SLOT_BYTES + estimateStringBytes(index.filePath) + estimateStringBytes(index.leafUuid) + estimateStringBytes(index.firstRecordUuid) + estimateStringBytes(index.restoreStartTime) + estimateStringBytes(index.startTime) + estimateStringBytes(index.lastUpdated);
|
|
29167
|
+
for (const record2 of index.physicalRecords) {
|
|
29168
|
+
total += INDEX_HINT_BASE_BYTES + estimateStringBytes(record2.uuid) + estimateStringBytes(record2.parentUuid) + estimateStringBytes(record2.type) + estimateStringBytes(record2.subtype);
|
|
29169
|
+
}
|
|
29170
|
+
for (const uuid of index.runtimeUuids) {
|
|
29171
|
+
total += estimateStringBytes(uuid);
|
|
29172
|
+
}
|
|
29173
|
+
for (const uuid of index.replayUuids) {
|
|
28677
29174
|
total += estimateStringBytes(uuid);
|
|
28678
29175
|
}
|
|
28679
29176
|
total += index.goalStatePositions.length * 8;
|
|
@@ -28681,7 +29178,7 @@ function estimateIndexCacheBytes(index) {
|
|
|
28681
29178
|
total += INDEX_ENTRY_BASE_BYTES + estimateStringBytes(gap.childUuid) + estimateStringBytes(gap.missingParentUuid);
|
|
28682
29179
|
}
|
|
28683
29180
|
for (const [uuid, entry] of index.byUuid) {
|
|
28684
|
-
total += INDEX_ENTRY_BASE_BYTES + estimateStringBytes(uuid) + estimateStringBytes(entry.parentUuid) + entry.segments.length * INDEX_SEGMENT_BYTES;
|
|
29181
|
+
total += INDEX_ENTRY_BASE_BYTES + INDEX_HINT_BASE_BYTES * 2 + (entry.goalEvidenceHint.parsedGoalContext ? INDEX_HINT_BASE_BYTES : 0) + INDEX_MAP_ENTRY_BYTES + INDEX_CONTAINER_BASE_BYTES + entry.segments.length * INDEX_CONTAINER_SLOT_BYTES + estimateStringBytes(uuid) + estimateStringBytes(entry.parentUuid) + estimateStringBytes(entry.type) + estimateStringBytes(entry.subtype) + estimateStringBytes(entry.turnHint.turnParentUuid) + estimateStringBytes(entry.turnHint.backgroundNotificationTaskId) + estimateStringBytes(entry.goalEvidenceHint.parsedGoalContext?.goalId) + estimateStringBytes(entry.goalEvidenceHint.parsedGoalContext?.turnId) + estimateStringBytes(entry.goalEvidenceHint.claimedGoalId) + estimateStringBytes(entry.goalEvidenceHint.provenance) + entry.segments.length * INDEX_SEGMENT_BYTES;
|
|
28685
29182
|
}
|
|
28686
29183
|
return total;
|
|
28687
29184
|
}
|
|
@@ -28722,6 +29219,7 @@ function pruneCache(now = Date.now()) {
|
|
|
28722
29219
|
__name(pruneCache, "pruneCache");
|
|
28723
29220
|
async function forEachLineInSnapshot(filePath, snapshotSize, onLine) {
|
|
28724
29221
|
if (snapshotSize === 0) return;
|
|
29222
|
+
const scheduler = new CooperativeReadScheduler();
|
|
28725
29223
|
let pending = [];
|
|
28726
29224
|
let pendingLength = 0;
|
|
28727
29225
|
let pendingOffset = 0;
|
|
@@ -28745,7 +29243,8 @@ async function forEachLineInSnapshot(filePath, snapshotSize, onLine) {
|
|
|
28745
29243
|
pendingLength + currentLine.length
|
|
28746
29244
|
) : currentLine;
|
|
28747
29245
|
const line = rawLine.length > 0 && rawLine[rawLine.length - 1] === 13 ? rawLine.subarray(0, rawLine.length - 1) : rawLine;
|
|
28748
|
-
onLine(line, lineOffset, line.length);
|
|
29246
|
+
await onLine(line, lineOffset, line.length);
|
|
29247
|
+
await scheduler.afterUnit(line.length);
|
|
28749
29248
|
pending = [];
|
|
28750
29249
|
pendingLength = 0;
|
|
28751
29250
|
lineStart = lineEnd + 1;
|
|
@@ -28763,20 +29262,32 @@ async function forEachLineInSnapshot(filePath, snapshotSize, onLine) {
|
|
|
28763
29262
|
if (pendingLength > 0) {
|
|
28764
29263
|
const rawLine = makePendingLine();
|
|
28765
29264
|
const line = rawLine[rawLine.length - 1] === 13 ? rawLine.subarray(0, rawLine.length - 1) : rawLine;
|
|
28766
|
-
onLine(line, pendingOffset, line.length);
|
|
29265
|
+
await onLine(line, pendingOffset, line.length);
|
|
29266
|
+
await scheduler.afterUnit(line.length);
|
|
28767
29267
|
}
|
|
28768
29268
|
}
|
|
28769
29269
|
__name(forEachLineInSnapshot, "forEachLineInSnapshot");
|
|
28770
|
-
async function readSegmentRecords(handle, filePath, segment, uuid) {
|
|
29270
|
+
async function readSegmentRecords(handle, filePath, segment, uuid, lineCache) {
|
|
28771
29271
|
if (segment.length === 0) return [];
|
|
28772
|
-
|
|
28773
|
-
|
|
28774
|
-
|
|
28775
|
-
|
|
28776
|
-
|
|
28777
|
-
const
|
|
28778
|
-
|
|
28779
|
-
|
|
29272
|
+
let records;
|
|
29273
|
+
if (lineCache.value?.offset === segment.offset && lineCache.value.length === segment.length) {
|
|
29274
|
+
records = lineCache.value.records;
|
|
29275
|
+
} else {
|
|
29276
|
+
selectedLineReadHookForTest?.(segment.offset, segment.length);
|
|
29277
|
+
const buffer = Buffer.alloc(segment.length);
|
|
29278
|
+
await handle.read(buffer, 0, segment.length, segment.offset);
|
|
29279
|
+
const line = buffer.toString("utf8").trim();
|
|
29280
|
+
if (line.length === 0) return [];
|
|
29281
|
+
records = parseLineTolerant(line, filePath).flatMap((value) => {
|
|
29282
|
+
const record3 = validateTranscriptRecord(value).record;
|
|
29283
|
+
return record3 ? [record3] : [];
|
|
29284
|
+
});
|
|
29285
|
+
lineCache.value = {
|
|
29286
|
+
offset: segment.offset,
|
|
29287
|
+
length: segment.length,
|
|
29288
|
+
records
|
|
29289
|
+
};
|
|
29290
|
+
}
|
|
28780
29291
|
const anomalySessionId = path10.basename(filePath, ".jsonl");
|
|
28781
29292
|
const record2 = records[segment.fragmentIndex];
|
|
28782
29293
|
if (!record2) {
|
|
@@ -28791,31 +29302,84 @@ async function readSegmentRecords(handle, filePath, segment, uuid) {
|
|
|
28791
29302
|
);
|
|
28792
29303
|
throw new SessionTranscriptSnapshotUnavailableError(anomalySessionId);
|
|
28793
29304
|
}
|
|
29305
|
+
if (record2.sessionId !== anomalySessionId) {
|
|
29306
|
+
debugLogger14.warn(
|
|
29307
|
+
`segment read anomaly: session mismatch session=${anomalySessionId} recordSession=${record2.sessionId} uuid=${uuid} offset=${segment.offset}`
|
|
29308
|
+
);
|
|
29309
|
+
throw new SessionTranscriptSnapshotUnavailableError(anomalySessionId);
|
|
29310
|
+
}
|
|
28794
29311
|
return [record2];
|
|
28795
29312
|
}
|
|
28796
29313
|
__name(readSegmentRecords, "readSegmentRecords");
|
|
28797
|
-
async function
|
|
28798
|
-
|
|
29314
|
+
async function forEachAggregatedRecord(index, uuids, onRecord, context2) {
|
|
29315
|
+
if (!context2) {
|
|
29316
|
+
await withAggregatedRecordReadContext(
|
|
29317
|
+
index,
|
|
29318
|
+
(readContext) => forEachAggregatedRecord(index, uuids, onRecord, readContext)
|
|
29319
|
+
);
|
|
29320
|
+
return;
|
|
29321
|
+
}
|
|
29322
|
+
for (const uuid of uuids) {
|
|
29323
|
+
const entry = index.byUuid.get(uuid);
|
|
29324
|
+
if (!entry) continue;
|
|
29325
|
+
const preloadedRecord = context2.preloadedRecords?.get(uuid);
|
|
29326
|
+
if (preloadedRecord) {
|
|
29327
|
+
context2.preloadedRecords?.delete(uuid);
|
|
29328
|
+
await onRecord(preloadedRecord);
|
|
29329
|
+
continue;
|
|
29330
|
+
}
|
|
29331
|
+
const physicalRecords = [];
|
|
29332
|
+
for (const segment of entry.segments) {
|
|
29333
|
+
physicalRecords.push(
|
|
29334
|
+
...await readSegmentRecords(
|
|
29335
|
+
context2.handle,
|
|
29336
|
+
index.filePath,
|
|
29337
|
+
segment,
|
|
29338
|
+
uuid,
|
|
29339
|
+
context2.lineCache
|
|
29340
|
+
)
|
|
29341
|
+
);
|
|
29342
|
+
}
|
|
29343
|
+
if (physicalRecords.length > 0) {
|
|
29344
|
+
await onRecord(aggregateTranscriptRecordFragments(physicalRecords));
|
|
29345
|
+
}
|
|
29346
|
+
await context2.scheduler.afterUnit(
|
|
29347
|
+
entry.segments.reduce((total, segment) => total + segment.length, 0)
|
|
29348
|
+
);
|
|
29349
|
+
}
|
|
29350
|
+
}
|
|
29351
|
+
__name(forEachAggregatedRecord, "forEachAggregatedRecord");
|
|
29352
|
+
async function withAggregatedRecordReadContext(index, callback) {
|
|
29353
|
+
let handle;
|
|
28799
29354
|
try {
|
|
28800
|
-
|
|
28801
|
-
|
|
28802
|
-
|
|
28803
|
-
|
|
28804
|
-
|
|
28805
|
-
|
|
28806
|
-
physicalRecords.push(
|
|
28807
|
-
...await readSegmentRecords(handle, index.filePath, segment, uuid)
|
|
28808
|
-
);
|
|
28809
|
-
}
|
|
28810
|
-
if (physicalRecords.length > 0) {
|
|
28811
|
-
records.push(aggregateTranscriptRecordFragments(physicalRecords));
|
|
28812
|
-
}
|
|
29355
|
+
handle = await fsp.open(index.filePath, "r");
|
|
29356
|
+
} catch (error) {
|
|
29357
|
+
if (isFileMissingError(error)) {
|
|
29358
|
+
throw new SessionTranscriptSnapshotUnavailableError(
|
|
29359
|
+
path10.basename(index.filePath, ".jsonl")
|
|
29360
|
+
);
|
|
28813
29361
|
}
|
|
28814
|
-
|
|
29362
|
+
throw error;
|
|
29363
|
+
}
|
|
29364
|
+
const context2 = {
|
|
29365
|
+
handle,
|
|
29366
|
+
scheduler: new CooperativeReadScheduler(),
|
|
29367
|
+
lineCache: {}
|
|
29368
|
+
};
|
|
29369
|
+
try {
|
|
29370
|
+
return await callback(context2);
|
|
28815
29371
|
} finally {
|
|
28816
|
-
await handle.close();
|
|
29372
|
+
await context2.handle.close();
|
|
28817
29373
|
}
|
|
28818
29374
|
}
|
|
29375
|
+
__name(withAggregatedRecordReadContext, "withAggregatedRecordReadContext");
|
|
29376
|
+
async function readAggregatedRecords(index, uuids) {
|
|
29377
|
+
const records = [];
|
|
29378
|
+
await forEachAggregatedRecord(index, uuids, (record2) => {
|
|
29379
|
+
records.push(record2);
|
|
29380
|
+
});
|
|
29381
|
+
return records;
|
|
29382
|
+
}
|
|
28819
29383
|
__name(readAggregatedRecords, "readAggregatedRecords");
|
|
28820
29384
|
async function readGoalStatePayloadBeforePosition(index, position) {
|
|
28821
29385
|
let low = 0;
|
|
@@ -28830,7 +29394,7 @@ async function readGoalStatePayloadBeforePosition(index, position) {
|
|
|
28830
29394
|
}
|
|
28831
29395
|
const goalStatePosition = index.goalStatePositions[low - 1];
|
|
28832
29396
|
if (goalStatePosition === void 0) return void 0;
|
|
28833
|
-
const uuid = index.
|
|
29397
|
+
const uuid = index.replayUuids[goalStatePosition];
|
|
28834
29398
|
const [record2] = await readAggregatedRecords(index, [uuid]);
|
|
28835
29399
|
return parseGoalStateRecordPayloadV2(record2?.systemPayload);
|
|
28836
29400
|
}
|
|
@@ -28852,59 +29416,121 @@ async function buildIndex(params) {
|
|
|
28852
29416
|
`index build start session=${sessionId} snapshotSize=${snapshotSize}`
|
|
28853
29417
|
);
|
|
28854
29418
|
const byUuid = /* @__PURE__ */ new Map();
|
|
29419
|
+
const goalEvidenceAccumulators = /* @__PURE__ */ new Map();
|
|
28855
29420
|
let sequence = 0;
|
|
29421
|
+
const physicalRecords = [];
|
|
28856
29422
|
let leafUuid;
|
|
29423
|
+
let firstRecordUuid;
|
|
29424
|
+
let firstRecordTimestamp;
|
|
28857
29425
|
let startTime;
|
|
28858
|
-
|
|
28859
|
-
|
|
28860
|
-
|
|
28861
|
-
|
|
28862
|
-
|
|
28863
|
-
|
|
28864
|
-
|
|
28865
|
-
|
|
28866
|
-
|
|
28867
|
-
|
|
28868
|
-
|
|
28869
|
-
|
|
28870
|
-
|
|
28871
|
-
|
|
28872
|
-
|
|
28873
|
-
|
|
28874
|
-
|
|
28875
|
-
|
|
28876
|
-
|
|
28877
|
-
|
|
28878
|
-
|
|
28879
|
-
|
|
28880
|
-
|
|
28881
|
-
|
|
28882
|
-
|
|
28883
|
-
fragmentIndex++;
|
|
28884
|
-
if (existing) {
|
|
28885
|
-
existing.segments.push(segment);
|
|
28886
|
-
} else {
|
|
28887
|
-
byUuid.set(record2.uuid, {
|
|
29426
|
+
try {
|
|
29427
|
+
await forEachLineInSnapshot(
|
|
29428
|
+
filePath,
|
|
29429
|
+
snapshotSize,
|
|
29430
|
+
(line, offset, length) => {
|
|
29431
|
+
const text = line.toString("utf8").trim();
|
|
29432
|
+
if (text.length === 0) return;
|
|
29433
|
+
let fragmentIndex = 0;
|
|
29434
|
+
for (const value of parseLineTolerant(text, filePath)) {
|
|
29435
|
+
const record2 = validateTranscriptRecord(value).record;
|
|
29436
|
+
if (!record2) {
|
|
29437
|
+
continue;
|
|
29438
|
+
}
|
|
29439
|
+
if (firstRecordUuid === void 0) {
|
|
29440
|
+
firstRecordUuid = record2.uuid;
|
|
29441
|
+
firstRecordTimestamp = record2.timestamp;
|
|
29442
|
+
}
|
|
29443
|
+
const sideTaskSource = record2.type === "system" && record2.subtype === "session_source" && isObjectRecord(record2.systemPayload) && record2.systemPayload["sourceType"] === "side_task";
|
|
29444
|
+
if (isTranscriptConversationRecord(record2)) {
|
|
29445
|
+
if (record2.timestamp) startTime ??= record2.timestamp;
|
|
29446
|
+
leafUuid = record2.uuid;
|
|
29447
|
+
}
|
|
29448
|
+
const existing = byUuid.get(record2.uuid);
|
|
29449
|
+
physicalRecords.push({
|
|
29450
|
+
uuid: record2.uuid,
|
|
28888
29451
|
parentUuid: record2.parentUuid,
|
|
28889
29452
|
type: record2.type,
|
|
28890
|
-
...record2.subtype !== void 0 ? { subtype: record2.subtype } : {}
|
|
28891
|
-
inherited: record2.forkedFrom !== void 0,
|
|
28892
|
-
segments: [segment]
|
|
29453
|
+
...record2.subtype !== void 0 ? { subtype: record2.subtype } : {}
|
|
28893
29454
|
});
|
|
29455
|
+
const segment = {
|
|
29456
|
+
offset,
|
|
29457
|
+
length,
|
|
29458
|
+
sequence: sequence++,
|
|
29459
|
+
fragmentIndex
|
|
29460
|
+
};
|
|
29461
|
+
fragmentIndex++;
|
|
29462
|
+
if (existing) {
|
|
29463
|
+
existing.segments.push(segment);
|
|
29464
|
+
existing.sessionIdMatchesFile &&= record2.sessionId === sessionId;
|
|
29465
|
+
if (existing.type === "assistant" && record2.usageMetadata) {
|
|
29466
|
+
existing.resumeTokenCountsCandidate = isResumeTokenCountsCandidate({
|
|
29467
|
+
...record2,
|
|
29468
|
+
type: existing.type,
|
|
29469
|
+
subtype: existing.subtype
|
|
29470
|
+
});
|
|
29471
|
+
}
|
|
29472
|
+
existing.turnHint.countsAsUserPrompt ||= getSessionTurnRecordHint(
|
|
29473
|
+
record2,
|
|
29474
|
+
sessionId
|
|
29475
|
+
).countsAsUserPrompt;
|
|
29476
|
+
goalEvidenceAccumulators.get(record2.uuid)?.addFragment(record2);
|
|
29477
|
+
} else {
|
|
29478
|
+
const chatRecord = record2;
|
|
29479
|
+
const goalEvidenceAccumulator = new GoalEvidenceRecordIndexAccumulator(chatRecord);
|
|
29480
|
+
const goalEvidenceHint = goalEvidenceAccumulator.finish();
|
|
29481
|
+
if (goalEvidenceHint.provenance) {
|
|
29482
|
+
goalEvidenceAccumulators.set(
|
|
29483
|
+
record2.uuid,
|
|
29484
|
+
goalEvidenceAccumulator
|
|
29485
|
+
);
|
|
29486
|
+
}
|
|
29487
|
+
byUuid.set(record2.uuid, {
|
|
29488
|
+
parentUuid: record2.parentUuid,
|
|
29489
|
+
sessionIdMatchesFile: record2.sessionId === sessionId,
|
|
29490
|
+
type: record2.type,
|
|
29491
|
+
...record2.subtype !== void 0 ? { subtype: record2.subtype } : {},
|
|
29492
|
+
inherited: record2.forkedFrom !== void 0,
|
|
29493
|
+
sideTaskSource,
|
|
29494
|
+
apiHistoryCompressionCandidate: isApiHistoryCompressionCandidate(chatRecord),
|
|
29495
|
+
resumeTokenCountsCandidate: isResumeTokenCountsCandidate(chatRecord),
|
|
29496
|
+
attributionSnapshotCandidate: isAttributionSnapshotCandidate(chatRecord),
|
|
29497
|
+
goalRecoveryCandidate: isGoalRecoveryCandidate(chatRecord),
|
|
29498
|
+
goalEvidenceHint,
|
|
29499
|
+
turnHint: getSessionTurnRecordHint(chatRecord, sessionId),
|
|
29500
|
+
segments: [segment]
|
|
29501
|
+
});
|
|
29502
|
+
}
|
|
28894
29503
|
}
|
|
28895
29504
|
}
|
|
29505
|
+
);
|
|
29506
|
+
} catch (error) {
|
|
29507
|
+
if (isFileMissingError(error)) {
|
|
29508
|
+
throw new SessionTranscriptSnapshotUnavailableError(sessionId);
|
|
28896
29509
|
}
|
|
28897
|
-
|
|
28898
|
-
|
|
29510
|
+
throw error;
|
|
29511
|
+
}
|
|
29512
|
+
for (const [uuid, accumulator] of goalEvidenceAccumulators) {
|
|
29513
|
+
byUuid.get(uuid).goalEvidenceHint = accumulator.finish();
|
|
29514
|
+
}
|
|
29515
|
+
for (const [uuid, entry] of byUuid) {
|
|
29516
|
+
if (!entry.sessionIdMatchesFile) {
|
|
29517
|
+
debugLogger14.warn(
|
|
29518
|
+
`transcript session mismatch session=${sessionId} uuid=${uuid}`
|
|
29519
|
+
);
|
|
29520
|
+
throw new SessionTranscriptSnapshotUnavailableError(sessionId);
|
|
29521
|
+
}
|
|
29522
|
+
}
|
|
29523
|
+
if (!leafUuid || !firstRecordUuid) {
|
|
28899
29524
|
debugLogger14.warn(
|
|
28900
|
-
`index build failed: no transcript records session=${sessionId}`
|
|
29525
|
+
`index build failed: no active transcript records session=${sessionId}`
|
|
28901
29526
|
);
|
|
28902
|
-
throw new
|
|
29527
|
+
throw new EmptySessionTranscriptError(sessionId);
|
|
28903
29528
|
}
|
|
28904
29529
|
startTime ??= lastUpdated;
|
|
29530
|
+
const restoreStartTime = firstRecordTimestamp ?? startTime;
|
|
28905
29531
|
const chain = walkTranscriptUuidChain(leafUuid, (uuid) => {
|
|
28906
29532
|
const entry = byUuid.get(uuid);
|
|
28907
|
-
return entry ? {
|
|
29533
|
+
return entry && isTranscriptConversationRecord(entry) ? {
|
|
28908
29534
|
uuid,
|
|
28909
29535
|
parentUuid: entry.parentUuid,
|
|
28910
29536
|
sessionId,
|
|
@@ -28912,11 +29538,14 @@ async function buildIndex(params) {
|
|
|
28912
29538
|
type: "system"
|
|
28913
29539
|
} : void 0;
|
|
28914
29540
|
});
|
|
28915
|
-
const
|
|
28916
|
-
const
|
|
29541
|
+
const runtimeUuids = [...chain.uuids];
|
|
29542
|
+
const sourceBoundary = runtimeUuids.findIndex(
|
|
29543
|
+
(uuid) => byUuid.get(uuid)?.sideTaskSource === true
|
|
29544
|
+
);
|
|
29545
|
+
const replayUuids = sourceBoundary >= 0 ? runtimeUuids.slice(sourceBoundary).filter((uuid) => byUuid.get(uuid)?.inherited !== true) : [...runtimeUuids];
|
|
28917
29546
|
const goalStatePositions = [];
|
|
28918
|
-
for (let position = 0; position <
|
|
28919
|
-
const uuid =
|
|
29547
|
+
for (let position = 0; position < replayUuids.length; position++) {
|
|
29548
|
+
const uuid = replayUuids[position];
|
|
28920
29549
|
const entry = byUuid.get(uuid);
|
|
28921
29550
|
if (entry?.type === "system" && entry.subtype === "goal_state") {
|
|
28922
29551
|
goalStatePositions.push(position);
|
|
@@ -28929,16 +29558,21 @@ async function buildIndex(params) {
|
|
|
28929
29558
|
);
|
|
28930
29559
|
}
|
|
28931
29560
|
debugLogger14.debug(
|
|
28932
|
-
`index build complete session=${sessionId} records=${byUuid.size}
|
|
29561
|
+
`index build complete session=${sessionId} records=${byUuid.size} runtime=${runtimeUuids.length} replay=${replayUuids.length} gaps=${gaps.length}`
|
|
28933
29562
|
);
|
|
29563
|
+
await indexBuildCompleteHookForTest?.(filePath);
|
|
28934
29564
|
return {
|
|
28935
29565
|
filePath,
|
|
28936
29566
|
fileIdentity,
|
|
28937
29567
|
snapshotSize,
|
|
28938
29568
|
leafUuid,
|
|
28939
|
-
|
|
29569
|
+
firstRecordUuid,
|
|
29570
|
+
physicalRecords,
|
|
29571
|
+
runtimeUuids,
|
|
29572
|
+
replayUuids,
|
|
28940
29573
|
goalStatePositions,
|
|
28941
29574
|
gaps,
|
|
29575
|
+
restoreStartTime,
|
|
28942
29576
|
startTime,
|
|
28943
29577
|
lastUpdated,
|
|
28944
29578
|
byUuid
|
|
@@ -28959,13 +29593,16 @@ async function getCachedIndex(params) {
|
|
|
28959
29593
|
indexCache.delete(key);
|
|
28960
29594
|
indexCache.set(key, cached);
|
|
28961
29595
|
debugLogger14.debug(`index cache hit ${key}`);
|
|
29596
|
+
params.onCacheState?.("hit");
|
|
28962
29597
|
return cached.value;
|
|
28963
29598
|
}
|
|
28964
29599
|
if (cached?.pending && cached.expiresAt > now) {
|
|
28965
29600
|
debugLogger14.debug(`index cache pending hit ${key}`);
|
|
29601
|
+
params.onCacheState?.("pending");
|
|
28966
29602
|
return cached.pending;
|
|
28967
29603
|
}
|
|
28968
29604
|
debugLogger14.debug(`index cache miss ${key}`);
|
|
29605
|
+
params.onCacheState?.("miss");
|
|
28969
29606
|
const pending = buildIndex(params);
|
|
28970
29607
|
indexCache.set(key, {
|
|
28971
29608
|
pending,
|
|
@@ -28983,6 +29620,17 @@ async function getCachedIndex(params) {
|
|
|
28983
29620
|
);
|
|
28984
29621
|
return value;
|
|
28985
29622
|
}
|
|
29623
|
+
if (indexCache.get(key)?.pending !== pending) {
|
|
29624
|
+
debugLogger14.debug(`index cache skipped stale completion ${key}`);
|
|
29625
|
+
return value;
|
|
29626
|
+
}
|
|
29627
|
+
if (getIndexCacheBytes() + byteSize > getIndexCacheMaxBytes()) {
|
|
29628
|
+
indexCache.delete(key);
|
|
29629
|
+
debugLogger14.debug(
|
|
29630
|
+
`index cache skipped byte-budget admission ${key} byteSize=${byteSize}`
|
|
29631
|
+
);
|
|
29632
|
+
return value;
|
|
29633
|
+
}
|
|
28986
29634
|
indexCache.set(key, {
|
|
28987
29635
|
value,
|
|
28988
29636
|
byteSize,
|
|
@@ -28991,7 +29639,9 @@ async function getCachedIndex(params) {
|
|
|
28991
29639
|
pruneCache();
|
|
28992
29640
|
return value;
|
|
28993
29641
|
} catch (error) {
|
|
28994
|
-
indexCache.
|
|
29642
|
+
if (indexCache.get(key)?.pending === pending) {
|
|
29643
|
+
indexCache.delete(key);
|
|
29644
|
+
}
|
|
28995
29645
|
debugLogger14.debug(
|
|
28996
29646
|
`index cache build failed ${key}: ${error instanceof Error ? error.message : String(error)}`
|
|
28997
29647
|
);
|
|
@@ -28999,11 +29649,118 @@ async function getCachedIndex(params) {
|
|
|
28999
29649
|
}
|
|
29000
29650
|
}
|
|
29001
29651
|
__name(getCachedIndex, "getCachedIndex");
|
|
29652
|
+
function makeReplayIndex(index, hideInheritedHistory) {
|
|
29653
|
+
const replayUuids = hideInheritedHistory ? index.replayUuids.filter(
|
|
29654
|
+
(uuid) => index.byUuid.get(uuid)?.inherited !== true
|
|
29655
|
+
) : index.replayUuids;
|
|
29656
|
+
if (replayUuids === index.replayUuids) return index;
|
|
29657
|
+
const goalStatePositions = [];
|
|
29658
|
+
for (let position = 0; position < replayUuids.length; position++) {
|
|
29659
|
+
const entry = index.byUuid.get(replayUuids[position]);
|
|
29660
|
+
if (entry?.type === "system" && entry.subtype === "goal_state") {
|
|
29661
|
+
goalStatePositions.push(position);
|
|
29662
|
+
}
|
|
29663
|
+
}
|
|
29664
|
+
return { ...index, replayUuids, goalStatePositions };
|
|
29665
|
+
}
|
|
29666
|
+
__name(makeReplayIndex, "makeReplayIndex");
|
|
29667
|
+
function selectRestoreReplayUuids(index, sessionId, replay) {
|
|
29668
|
+
if (replay.kind === "none") return void 0;
|
|
29669
|
+
const replayIndex = makeReplayIndex(index, replay.hideInheritedHistory);
|
|
29670
|
+
if (replay.kind === "all") {
|
|
29671
|
+
return {
|
|
29672
|
+
index: replayIndex,
|
|
29673
|
+
uuids: replayIndex.replayUuids,
|
|
29674
|
+
hasMore: false,
|
|
29675
|
+
nextPosition: 0
|
|
29676
|
+
};
|
|
29677
|
+
}
|
|
29678
|
+
const limit = normalizeLimit(replay.limit);
|
|
29679
|
+
const selected = selectBackwardPageUuids(
|
|
29680
|
+
replayIndex,
|
|
29681
|
+
sessionId,
|
|
29682
|
+
replayIndex.replayUuids.length,
|
|
29683
|
+
limit,
|
|
29684
|
+
SESSION_TRANSCRIPT_MAX_PAGE_BYTES
|
|
29685
|
+
);
|
|
29686
|
+
return {
|
|
29687
|
+
index: replayIndex,
|
|
29688
|
+
uuids: selected.uuids,
|
|
29689
|
+
hasMore: selected.nextPosition > 0,
|
|
29690
|
+
nextPosition: selected.nextPosition
|
|
29691
|
+
};
|
|
29692
|
+
}
|
|
29693
|
+
__name(selectRestoreReplayUuids, "selectRestoreReplayUuids");
|
|
29694
|
+
function validateRestoreReplaySelection(replay) {
|
|
29695
|
+
if (replay.kind === "recent") normalizeLimit(replay.limit);
|
|
29696
|
+
}
|
|
29697
|
+
__name(validateRestoreReplaySelection, "validateRestoreReplaySelection");
|
|
29698
|
+
async function assertIndexSnapshotUnchanged(index, sessionId) {
|
|
29699
|
+
if (!await hasSnapshotSignature(
|
|
29700
|
+
index.filePath,
|
|
29701
|
+
index.fileIdentity,
|
|
29702
|
+
index.snapshotSize,
|
|
29703
|
+
index.lastUpdated
|
|
29704
|
+
)) {
|
|
29705
|
+
throw new SessionTranscriptSnapshotUnavailableError(sessionId);
|
|
29706
|
+
}
|
|
29707
|
+
}
|
|
29708
|
+
__name(assertIndexSnapshotUnchanged, "assertIndexSnapshotUnchanged");
|
|
29709
|
+
async function hasSnapshotSignature(filePath, fileIdentity, snapshotSize, lastUpdated) {
|
|
29710
|
+
let stats;
|
|
29711
|
+
try {
|
|
29712
|
+
stats = await fsp.stat(filePath);
|
|
29713
|
+
} catch (error) {
|
|
29714
|
+
if (isFileMissingError(error)) return false;
|
|
29715
|
+
throw error;
|
|
29716
|
+
}
|
|
29717
|
+
return stats.size === snapshotSize && sameFileIdentity(fileIdentityFromStats(stats), fileIdentity) && new Date(stats.mtimeMs).toISOString() === lastUpdated;
|
|
29718
|
+
}
|
|
29719
|
+
__name(hasSnapshotSignature, "hasSnapshotSignature");
|
|
29720
|
+
function offerFreshIndexToCache(index) {
|
|
29721
|
+
pruneCache();
|
|
29722
|
+
const key = makeCacheKey(
|
|
29723
|
+
index.filePath,
|
|
29724
|
+
index.fileIdentity,
|
|
29725
|
+
index.snapshotSize,
|
|
29726
|
+
index.lastUpdated
|
|
29727
|
+
);
|
|
29728
|
+
if (indexCache.has(key)) return;
|
|
29729
|
+
const byteSize = estimateIndexCacheBytes(index);
|
|
29730
|
+
if (byteSize > getIndexCacheMaxBytes() || getIndexCacheBytes() + byteSize > getIndexCacheMaxBytes() || indexCache.size >= INDEX_CACHE_MAX_ENTRIES) {
|
|
29731
|
+
debugLogger14.debug(
|
|
29732
|
+
`fresh index cache offer skipped ${key} byteSize=${byteSize}`
|
|
29733
|
+
);
|
|
29734
|
+
return;
|
|
29735
|
+
}
|
|
29736
|
+
indexCache.set(key, {
|
|
29737
|
+
value: index,
|
|
29738
|
+
byteSize,
|
|
29739
|
+
expiresAt: Date.now() + INDEX_CACHE_TTL_MS
|
|
29740
|
+
});
|
|
29741
|
+
}
|
|
29742
|
+
__name(offerFreshIndexToCache, "offerFreshIndexToCache");
|
|
29743
|
+
function lastUuidMatching(index, predicate) {
|
|
29744
|
+
for (let position = index.runtimeUuids.length - 1; position >= 0; position--) {
|
|
29745
|
+
const uuid = index.runtimeUuids[position];
|
|
29746
|
+
const entry = index.byUuid.get(uuid);
|
|
29747
|
+
if (entry && predicate(entry)) return uuid;
|
|
29748
|
+
}
|
|
29749
|
+
return void 0;
|
|
29750
|
+
}
|
|
29751
|
+
__name(lastUuidMatching, "lastUuidMatching");
|
|
29752
|
+
function selectArtifactUuids(index) {
|
|
29753
|
+
return selectActiveSideArtifactRecordUuids(
|
|
29754
|
+
index.physicalRecords,
|
|
29755
|
+
index.runtimeUuids
|
|
29756
|
+
);
|
|
29757
|
+
}
|
|
29758
|
+
__name(selectArtifactUuids, "selectArtifactUuids");
|
|
29002
29759
|
var SessionTranscriptReader = class {
|
|
29003
|
-
constructor(workspaceCwd, cursorCodec) {
|
|
29760
|
+
constructor(workspaceCwd, cursorCodec, runtimeBaseDir) {
|
|
29004
29761
|
this.workspaceCwd = workspaceCwd;
|
|
29005
29762
|
this.cursorCodec = cursorCodec;
|
|
29006
|
-
this.storage = new Storage(workspaceCwd);
|
|
29763
|
+
this.storage = new Storage(workspaceCwd, runtimeBaseDir);
|
|
29007
29764
|
}
|
|
29008
29765
|
static {
|
|
29009
29766
|
__name(this, "SessionTranscriptReader");
|
|
@@ -29020,6 +29777,522 @@ var SessionTranscriptReader = class {
|
|
|
29020
29777
|
`${sessionId}.jsonl`
|
|
29021
29778
|
);
|
|
29022
29779
|
}
|
|
29780
|
+
async readRestoreProjection(sessionId, options2, readOptions = {}) {
|
|
29781
|
+
const filePath = this.getSessionFilePath(sessionId);
|
|
29782
|
+
validateRestoreReplaySelection(options2.replay);
|
|
29783
|
+
addDaemonRequestAttribute(
|
|
29784
|
+
"qwen-code.daemon.session_restore.replay_mode",
|
|
29785
|
+
options2.replay.kind
|
|
29786
|
+
);
|
|
29787
|
+
addDaemonRequestAttribute(
|
|
29788
|
+
"qwen-code.daemon.session_restore.index_cache_state",
|
|
29789
|
+
"fresh"
|
|
29790
|
+
);
|
|
29791
|
+
let stats;
|
|
29792
|
+
try {
|
|
29793
|
+
stats = await fsp.stat(filePath);
|
|
29794
|
+
} catch (error) {
|
|
29795
|
+
if (isFileMissingError(error)) {
|
|
29796
|
+
throw new SessionTranscriptSnapshotUnavailableError(sessionId);
|
|
29797
|
+
}
|
|
29798
|
+
throw error;
|
|
29799
|
+
}
|
|
29800
|
+
const fileIdentity = fileIdentityFromStats(stats);
|
|
29801
|
+
const lastUpdated = new Date(stats.mtimeMs).toISOString();
|
|
29802
|
+
let index;
|
|
29803
|
+
const indexStartedAt = performance3.now();
|
|
29804
|
+
try {
|
|
29805
|
+
index = await buildIndex({
|
|
29806
|
+
filePath,
|
|
29807
|
+
fileIdentity,
|
|
29808
|
+
snapshotSize: stats.size,
|
|
29809
|
+
lastUpdated
|
|
29810
|
+
});
|
|
29811
|
+
} catch (error) {
|
|
29812
|
+
if (error instanceof EmptySessionTranscriptError) {
|
|
29813
|
+
if (await hasSnapshotSignature(
|
|
29814
|
+
filePath,
|
|
29815
|
+
fileIdentity,
|
|
29816
|
+
stats.size,
|
|
29817
|
+
lastUpdated
|
|
29818
|
+
)) {
|
|
29819
|
+
return void 0;
|
|
29820
|
+
}
|
|
29821
|
+
}
|
|
29822
|
+
throw error;
|
|
29823
|
+
} finally {
|
|
29824
|
+
recordRestoreStage("transcript_index", indexStartedAt);
|
|
29825
|
+
}
|
|
29826
|
+
recordRestoreIndexAttributes(index);
|
|
29827
|
+
const selectionStartedAt = performance3.now();
|
|
29828
|
+
let replaySelection;
|
|
29829
|
+
try {
|
|
29830
|
+
replaySelection = selectRestoreReplayUuids(
|
|
29831
|
+
index,
|
|
29832
|
+
sessionId,
|
|
29833
|
+
options2.replay
|
|
29834
|
+
);
|
|
29835
|
+
} finally {
|
|
29836
|
+
recordRestoreStage("resume_state_select", selectionStartedAt);
|
|
29837
|
+
}
|
|
29838
|
+
const replaySet = new Set(replaySelection?.uuids ?? []);
|
|
29839
|
+
const modelSet = /* @__PURE__ */ new Set();
|
|
29840
|
+
let compressionPosition = -1;
|
|
29841
|
+
for (let position = 0; position < index.runtimeUuids.length; position++) {
|
|
29842
|
+
const entry = index.byUuid.get(index.runtimeUuids[position]);
|
|
29843
|
+
if (entry?.apiHistoryCompressionCandidate) {
|
|
29844
|
+
compressionPosition = position;
|
|
29845
|
+
}
|
|
29846
|
+
}
|
|
29847
|
+
for (let position = 0; position < index.runtimeUuids.length; position++) {
|
|
29848
|
+
const uuid = index.runtimeUuids[position];
|
|
29849
|
+
const entry = index.byUuid.get(uuid);
|
|
29850
|
+
if (position === compressionPosition || entry?.type !== "system" && (compressionPosition < 0 || position > compressionPosition)) {
|
|
29851
|
+
modelSet.add(uuid);
|
|
29852
|
+
}
|
|
29853
|
+
}
|
|
29854
|
+
addDaemonRequestAttribute(
|
|
29855
|
+
"qwen-code.daemon.session_restore.compression_selected",
|
|
29856
|
+
compressionPosition >= 0
|
|
29857
|
+
);
|
|
29858
|
+
addDaemonRequestAttribute(
|
|
29859
|
+
"qwen-code.daemon.session_restore.legacy_full_model_history",
|
|
29860
|
+
compressionPosition < 0
|
|
29861
|
+
);
|
|
29862
|
+
const tokenUuid = lastUuidMatching(
|
|
29863
|
+
index,
|
|
29864
|
+
(entry) => entry.resumeTokenCountsCandidate
|
|
29865
|
+
);
|
|
29866
|
+
const attributionUuid = lastUuidMatching(
|
|
29867
|
+
index,
|
|
29868
|
+
(entry) => entry.attributionSnapshotCandidate
|
|
29869
|
+
);
|
|
29870
|
+
const parentSessionUuid = lastUuidMatching(
|
|
29871
|
+
index,
|
|
29872
|
+
(entry) => entry.type === "system" && entry.subtype === "parent_session"
|
|
29873
|
+
);
|
|
29874
|
+
const sessionSourceUuid = lastUuidMatching(
|
|
29875
|
+
index,
|
|
29876
|
+
(entry) => entry.type === "system" && entry.subtype === "session_source"
|
|
29877
|
+
);
|
|
29878
|
+
const uiTelemetrySet = new Set(
|
|
29879
|
+
index.runtimeUuids.filter((uuid) => {
|
|
29880
|
+
const entry = index.byUuid.get(uuid);
|
|
29881
|
+
return entry?.type === "system" && entry.subtype === "ui_telemetry";
|
|
29882
|
+
})
|
|
29883
|
+
);
|
|
29884
|
+
const fileHistorySet = new Set(
|
|
29885
|
+
index.runtimeUuids.filter((uuid) => {
|
|
29886
|
+
const entry = index.byUuid.get(uuid);
|
|
29887
|
+
return entry?.type === "system" && entry.subtype === "file_history_snapshot";
|
|
29888
|
+
})
|
|
29889
|
+
);
|
|
29890
|
+
const goalSet = new Set(
|
|
29891
|
+
index.runtimeUuids.filter(
|
|
29892
|
+
(uuid) => index.byUuid.get(uuid)?.goalRecoveryCandidate === true
|
|
29893
|
+
)
|
|
29894
|
+
);
|
|
29895
|
+
const replayGoalSet = new Set(
|
|
29896
|
+
replaySelection ? replaySelection.index.replayUuids.filter(
|
|
29897
|
+
(uuid) => index.byUuid.get(uuid)?.goalRecoveryCandidate === true
|
|
29898
|
+
) : []
|
|
29899
|
+
);
|
|
29900
|
+
const artifactUuids = selectArtifactUuids(index);
|
|
29901
|
+
const artifactSet = new Set(artifactUuids);
|
|
29902
|
+
const metadataSet = new Set(
|
|
29903
|
+
[parentSessionUuid, sessionSourceUuid].filter(
|
|
29904
|
+
(uuid) => uuid !== void 0
|
|
29905
|
+
)
|
|
29906
|
+
);
|
|
29907
|
+
const apiHistory = new SessionApiHistoryAccumulator();
|
|
29908
|
+
const resumeTokenCounts = new ResumeTokenCountsAccumulator();
|
|
29909
|
+
const turnState = new SessionTurnStateAccumulator(sessionId);
|
|
29910
|
+
for (const uuid of index.runtimeUuids) {
|
|
29911
|
+
const hint = index.byUuid.get(uuid)?.turnHint;
|
|
29912
|
+
if (hint) turnState.addHint(hint);
|
|
29913
|
+
}
|
|
29914
|
+
const uiTelemetryEvents = [];
|
|
29915
|
+
const fileHistory = new SessionFileHistoryAccumulator();
|
|
29916
|
+
const artifacts = new SessionArtifactSnapshotAccumulator(sessionId);
|
|
29917
|
+
const goalRecords = [];
|
|
29918
|
+
const goalStatePayloads = /* @__PURE__ */ new Map();
|
|
29919
|
+
const replayRecordsByUuid = /* @__PURE__ */ new Map();
|
|
29920
|
+
let attributionSnapshot;
|
|
29921
|
+
let parentSessionId;
|
|
29922
|
+
let sourceType;
|
|
29923
|
+
let sourceId;
|
|
29924
|
+
let firstRecord;
|
|
29925
|
+
let firstRecordSeen = false;
|
|
29926
|
+
let goalCheckpointAccumulator;
|
|
29927
|
+
let goalEvidenceSet = /* @__PURE__ */ new Set();
|
|
29928
|
+
const deferredPreReadRecords = /* @__PURE__ */ new Map();
|
|
29929
|
+
const dispatchRecord = /* @__PURE__ */ __name((record2) => {
|
|
29930
|
+
if (modelSet.has(record2.uuid)) apiHistory.add(record2);
|
|
29931
|
+
if (record2.uuid === tokenUuid) resumeTokenCounts.add(record2);
|
|
29932
|
+
if (uiTelemetrySet.has(record2.uuid)) {
|
|
29933
|
+
const uiEvent = record2.systemPayload?.uiEvent;
|
|
29934
|
+
if (uiEvent) uiTelemetryEvents.push(uiEvent);
|
|
29935
|
+
}
|
|
29936
|
+
if (record2.uuid === attributionUuid) {
|
|
29937
|
+
const snapshot = record2.systemPayload?.snapshot;
|
|
29938
|
+
if (snapshot && typeof snapshot === "object") {
|
|
29939
|
+
attributionSnapshot = snapshot;
|
|
29940
|
+
}
|
|
29941
|
+
}
|
|
29942
|
+
if (record2.uuid === parentSessionUuid) {
|
|
29943
|
+
parentSessionId = record2.systemPayload?.parentSessionId;
|
|
29944
|
+
} else if (record2.uuid === sessionSourceUuid) {
|
|
29945
|
+
const payload = record2.systemPayload;
|
|
29946
|
+
sourceType = payload?.sourceType;
|
|
29947
|
+
sourceId = payload?.sourceId;
|
|
29948
|
+
}
|
|
29949
|
+
if (fileHistorySet.has(record2.uuid)) {
|
|
29950
|
+
try {
|
|
29951
|
+
fileHistory.add(record2);
|
|
29952
|
+
} catch (error) {
|
|
29953
|
+
debugLogger14.warn(
|
|
29954
|
+
`restore projection: skipping malformed file_history_snapshot: ${error}`
|
|
29955
|
+
);
|
|
29956
|
+
}
|
|
29957
|
+
}
|
|
29958
|
+
if (artifactSet.has(record2.uuid)) artifacts.add(record2);
|
|
29959
|
+
if (goalEvidenceSet.has(record2.uuid)) {
|
|
29960
|
+
goalCheckpointAccumulator?.capture(record2);
|
|
29961
|
+
}
|
|
29962
|
+
if (replaySet.has(record2.uuid)) {
|
|
29963
|
+
replayRecordsByUuid.set(record2.uuid, record2);
|
|
29964
|
+
}
|
|
29965
|
+
}, "dispatchRecord");
|
|
29966
|
+
const preReadUuids = Array.from(
|
|
29967
|
+
/* @__PURE__ */ new Set([
|
|
29968
|
+
index.firstRecordUuid,
|
|
29969
|
+
...index.runtimeUuids.filter((uuid) => goalSet.has(uuid))
|
|
29970
|
+
])
|
|
29971
|
+
);
|
|
29972
|
+
const selectedReadsStartedAt = performance3.now();
|
|
29973
|
+
const selectedReadSet = new Set(preReadUuids);
|
|
29974
|
+
let goalRecovery;
|
|
29975
|
+
try {
|
|
29976
|
+
goalRecovery = await withAggregatedRecordReadContext(
|
|
29977
|
+
index,
|
|
29978
|
+
async (readContext) => {
|
|
29979
|
+
await forEachAggregatedRecord(
|
|
29980
|
+
index,
|
|
29981
|
+
preReadUuids,
|
|
29982
|
+
async (record2) => {
|
|
29983
|
+
if (record2.uuid === index.firstRecordUuid) {
|
|
29984
|
+
if (readOptions.validateFirstRecord && !await readOptions.validateFirstRecord(record2)) {
|
|
29985
|
+
throw new SessionTranscriptSnapshotUnavailableError(
|
|
29986
|
+
sessionId
|
|
29987
|
+
);
|
|
29988
|
+
}
|
|
29989
|
+
firstRecordSeen = true;
|
|
29990
|
+
if (!goalSet.has(record2.uuid)) firstRecord = record2;
|
|
29991
|
+
}
|
|
29992
|
+
if (goalSet.has(record2.uuid)) {
|
|
29993
|
+
const normalized2 = normalizeGoalRecoveryRecord(record2);
|
|
29994
|
+
if (normalized2) {
|
|
29995
|
+
goalRecords.push(normalized2);
|
|
29996
|
+
if (record2.subtype === "goal_state") {
|
|
29997
|
+
goalStatePayloads.set(
|
|
29998
|
+
record2.uuid,
|
|
29999
|
+
parseGoalStateRecordPayloadV2(normalized2.systemPayload)
|
|
30000
|
+
);
|
|
30001
|
+
}
|
|
30002
|
+
}
|
|
30003
|
+
}
|
|
30004
|
+
if (replaySet.has(record2.uuid)) {
|
|
30005
|
+
replayRecordsByUuid.set(record2.uuid, record2);
|
|
30006
|
+
}
|
|
30007
|
+
const needsDeferredDispatch = modelSet.has(record2.uuid) || record2.uuid === tokenUuid || record2.uuid === attributionUuid || metadataSet.has(record2.uuid) || uiTelemetrySet.has(record2.uuid) || fileHistorySet.has(record2.uuid) || artifactSet.has(record2.uuid);
|
|
30008
|
+
if (needsDeferredDispatch) {
|
|
30009
|
+
if (record2.uuid === index.firstRecordUuid && artifactSet.has(record2.uuid)) {
|
|
30010
|
+
artifacts.add(record2);
|
|
30011
|
+
} else {
|
|
30012
|
+
deferredPreReadRecords.set(record2.uuid, record2);
|
|
30013
|
+
}
|
|
30014
|
+
}
|
|
30015
|
+
},
|
|
30016
|
+
readContext
|
|
30017
|
+
);
|
|
30018
|
+
if (!firstRecordSeen) {
|
|
30019
|
+
throw new SessionTranscriptSnapshotUnavailableError(sessionId);
|
|
30020
|
+
}
|
|
30021
|
+
const selectedGoalRecovery = selectGoalRecoveryFromRecords(goalRecords);
|
|
30022
|
+
const pendingGoal = selectedGoalRecovery.recovery.kind === "v2" ? selectedGoalRecovery.recovery.payload : void 0;
|
|
30023
|
+
const pendingCheckpoint = pendingGoal?.checkpointPending;
|
|
30024
|
+
if (pendingCheckpoint && pendingGoal.snapshot.goal) {
|
|
30025
|
+
try {
|
|
30026
|
+
goalCheckpointAccumulator = new GoalEvidenceCheckpointAccumulator(
|
|
30027
|
+
index.runtimeUuids.map(
|
|
30028
|
+
(uuid) => index.byUuid.get(uuid).goalEvidenceHint
|
|
30029
|
+
),
|
|
30030
|
+
pendingGoal.snapshot.goal,
|
|
30031
|
+
pendingCheckpoint.permit
|
|
30032
|
+
);
|
|
30033
|
+
} catch (error) {
|
|
30034
|
+
if (!(error instanceof EvidenceSourceUnavailableError)) {
|
|
30035
|
+
throw error;
|
|
30036
|
+
}
|
|
30037
|
+
debugLogger14.warn(
|
|
30038
|
+
`restore projection: deferring unavailable Goal checkpoint evidence: ${error.message}`
|
|
30039
|
+
);
|
|
30040
|
+
}
|
|
30041
|
+
}
|
|
30042
|
+
goalEvidenceSet = new Set(
|
|
30043
|
+
goalCheckpointAccumulator?.getCandidateUuids() ?? []
|
|
30044
|
+
);
|
|
30045
|
+
if (firstRecord && goalEvidenceSet.has(firstRecord.uuid)) {
|
|
30046
|
+
goalCheckpointAccumulator?.capture(firstRecord);
|
|
30047
|
+
}
|
|
30048
|
+
firstRecord = void 0;
|
|
30049
|
+
const selectedRuntimeUuids = index.runtimeUuids.filter(
|
|
30050
|
+
(uuid) => modelSet.has(uuid) || uuid === tokenUuid || uuid === attributionUuid || metadataSet.has(uuid) || uiTelemetrySet.has(uuid) || fileHistorySet.has(uuid) || replaySet.has(uuid) || goalEvidenceSet.has(uuid)
|
|
30051
|
+
);
|
|
30052
|
+
const preReadSet = new Set(preReadUuids);
|
|
30053
|
+
readContext.preloadedRecords = deferredPreReadRecords;
|
|
30054
|
+
const remainingUuids = Array.from(
|
|
30055
|
+
/* @__PURE__ */ new Set([...selectedRuntimeUuids, ...artifactUuids])
|
|
30056
|
+
).filter(
|
|
30057
|
+
(uuid) => !preReadSet.has(uuid) || deferredPreReadRecords.has(uuid)
|
|
30058
|
+
);
|
|
30059
|
+
for (const uuid of remainingUuids) selectedReadSet.add(uuid);
|
|
30060
|
+
await forEachAggregatedRecord(
|
|
30061
|
+
index,
|
|
30062
|
+
remainingUuids,
|
|
30063
|
+
dispatchRecord,
|
|
30064
|
+
readContext
|
|
30065
|
+
);
|
|
30066
|
+
let goalCheckpointWindow;
|
|
30067
|
+
try {
|
|
30068
|
+
goalCheckpointWindow = goalCheckpointAccumulator?.finish();
|
|
30069
|
+
} catch (error) {
|
|
30070
|
+
if (!(error instanceof InvalidGoalEvidenceReferenceError)) {
|
|
30071
|
+
throw error;
|
|
30072
|
+
}
|
|
30073
|
+
debugLogger14.warn(
|
|
30074
|
+
`restore projection: deferring invalid Goal checkpoint evidence: ${error.message}`
|
|
30075
|
+
);
|
|
30076
|
+
}
|
|
30077
|
+
return { selectedGoalRecovery, goalCheckpointWindow };
|
|
30078
|
+
}
|
|
30079
|
+
);
|
|
30080
|
+
} finally {
|
|
30081
|
+
recordRestoreStage("selected_record_read", selectedReadsStartedAt);
|
|
30082
|
+
}
|
|
30083
|
+
recordRestoreSelectionAttributes(index, selectedReadSet, replaySet);
|
|
30084
|
+
let persistedTitle;
|
|
30085
|
+
try {
|
|
30086
|
+
persistedTitle = readSessionTitleInfoFromFileSync(index.filePath);
|
|
30087
|
+
} catch (error) {
|
|
30088
|
+
if (isFileMissingError(error)) {
|
|
30089
|
+
throw new SessionTranscriptSnapshotUnavailableError(sessionId);
|
|
30090
|
+
}
|
|
30091
|
+
throw error;
|
|
30092
|
+
}
|
|
30093
|
+
const customTitle = persistedTitle.title;
|
|
30094
|
+
const titleSource = persistedTitle.source;
|
|
30095
|
+
const turnStateValue = turnState.finish();
|
|
30096
|
+
const replayRecords = replaySelection ? replaySelection.uuids.map((uuid) => replayRecordsByUuid.get(uuid)).filter((record2) => record2 !== void 0) : [];
|
|
30097
|
+
const replayGoalRecords = replaySelection ? goalRecords.filter((record2) => replayGoalSet.has(record2.uuid)) : [];
|
|
30098
|
+
const replayGoalRecoverySourceUuid = replaySelection ? selectGoalRecoveryFromRecords(replayGoalRecords).sourceUuid : goalRecovery.selectedGoalRecovery.sourceUuid;
|
|
30099
|
+
let replay;
|
|
30100
|
+
if (replaySelection) {
|
|
30101
|
+
const goalStatePosition = replaySelection.index.goalStatePositions.findLast(
|
|
30102
|
+
(position) => position < replaySelection.nextPosition
|
|
30103
|
+
);
|
|
30104
|
+
const goalStateUuid = goalStatePosition === void 0 ? void 0 : replaySelection.index.replayUuids[goalStatePosition];
|
|
30105
|
+
const goalState = goalStateUuid ? goalStatePayloads.get(goalStateUuid) : void 0;
|
|
30106
|
+
replay = {
|
|
30107
|
+
records: replayRecords,
|
|
30108
|
+
gaps: index.gaps,
|
|
30109
|
+
hasMore: replaySelection.hasMore,
|
|
30110
|
+
...replaySelection.hasMore && replayRecords[0] ? { anchorRecordId: replayRecords[0].uuid } : {},
|
|
30111
|
+
...replayGoalRecoverySourceUuid && !replaySet.has(replayGoalRecoverySourceUuid) ? { goalBootstrapRecords: replayGoalRecords } : {},
|
|
30112
|
+
...replayGoalRecoverySourceUuid ? { goalRecoverySourceUuid: replayGoalRecoverySourceUuid } : {},
|
|
30113
|
+
...goalState ? {
|
|
30114
|
+
replay: {
|
|
30115
|
+
goalState: goalState.snapshot,
|
|
30116
|
+
goalCause: goalState.cause
|
|
30117
|
+
}
|
|
30118
|
+
} : {}
|
|
30119
|
+
};
|
|
30120
|
+
}
|
|
30121
|
+
const restoredTokenCounts = resumeTokenCounts.finish();
|
|
30122
|
+
const restoredFileHistory = fileHistory.finish();
|
|
30123
|
+
const artifactSnapshot = artifacts.finish();
|
|
30124
|
+
const runtime = {
|
|
30125
|
+
apiHistory: apiHistory.finish(),
|
|
30126
|
+
...restoredTokenCounts ? { resumeTokenCounts: restoredTokenCounts } : {},
|
|
30127
|
+
uiTelemetryEvents,
|
|
30128
|
+
...attributionSnapshot ? { attributionSnapshot } : {},
|
|
30129
|
+
...index.gaps.length > 0 ? { historyGaps: index.gaps } : {},
|
|
30130
|
+
recording: {
|
|
30131
|
+
lastCompletedUuid: index.leafUuid,
|
|
30132
|
+
turnParentUuids: turnStateValue.turnParentUuids,
|
|
30133
|
+
...customTitle !== void 0 ? { customTitle } : {},
|
|
30134
|
+
...titleSource !== void 0 ? { titleSource } : {},
|
|
30135
|
+
...parentSessionId !== void 0 ? { parentSessionId } : {},
|
|
30136
|
+
...sourceType !== void 0 ? { sourceType } : {},
|
|
30137
|
+
...sourceId !== void 0 ? { sourceId } : {}
|
|
30138
|
+
},
|
|
30139
|
+
...restoredFileHistory ? { fileHistorySnapshots: restoredFileHistory } : {},
|
|
30140
|
+
...artifactSnapshot ? { artifactSnapshot } : {},
|
|
30141
|
+
goalRecords,
|
|
30142
|
+
...goalRecovery.selectedGoalRecovery.sourceUuid ? {
|
|
30143
|
+
goalRecoverySourceUuid: goalRecovery.selectedGoalRecovery.sourceUuid
|
|
30144
|
+
} : {},
|
|
30145
|
+
...goalRecovery.goalCheckpointWindow ? { goalCheckpointWindow: goalRecovery.goalCheckpointWindow } : {},
|
|
30146
|
+
initialTurn: turnStateValue.initialTurn,
|
|
30147
|
+
backgroundNotificationTaskIds: turnStateValue.backgroundNotificationTaskIds
|
|
30148
|
+
};
|
|
30149
|
+
await assertIndexSnapshotUnchanged(index, sessionId);
|
|
30150
|
+
offerFreshIndexToCache(index);
|
|
30151
|
+
return {
|
|
30152
|
+
sessionId,
|
|
30153
|
+
filePath,
|
|
30154
|
+
startTime: index.restoreStartTime,
|
|
30155
|
+
lastUpdated: index.lastUpdated,
|
|
30156
|
+
runtime,
|
|
30157
|
+
...replay ? { replay } : {}
|
|
30158
|
+
};
|
|
30159
|
+
}
|
|
30160
|
+
async readLiveRestoreProjection(sessionId, options2, readOptions = {}) {
|
|
30161
|
+
const filePath = this.getSessionFilePath(sessionId);
|
|
30162
|
+
validateRestoreReplaySelection(options2.replay);
|
|
30163
|
+
addDaemonRequestAttribute(
|
|
30164
|
+
"qwen-code.daemon.session_restore.replay_mode",
|
|
30165
|
+
options2.replay.kind
|
|
30166
|
+
);
|
|
30167
|
+
let stats;
|
|
30168
|
+
try {
|
|
30169
|
+
stats = await fsp.stat(filePath);
|
|
30170
|
+
} catch (error) {
|
|
30171
|
+
if (error.code === "ENOENT") return void 0;
|
|
30172
|
+
throw error;
|
|
30173
|
+
}
|
|
30174
|
+
let index;
|
|
30175
|
+
const fileIdentity = fileIdentityFromStats(stats);
|
|
30176
|
+
const lastUpdated = new Date(stats.mtimeMs).toISOString();
|
|
30177
|
+
const indexStartedAt = performance3.now();
|
|
30178
|
+
try {
|
|
30179
|
+
index = await getCachedIndex({
|
|
30180
|
+
filePath,
|
|
30181
|
+
fileIdentity,
|
|
30182
|
+
snapshotSize: stats.size,
|
|
30183
|
+
lastUpdated,
|
|
30184
|
+
onCacheState: /* @__PURE__ */ __name((state) => addDaemonRequestAttribute(
|
|
30185
|
+
"qwen-code.daemon.session_restore.index_cache_state",
|
|
30186
|
+
state
|
|
30187
|
+
), "onCacheState")
|
|
30188
|
+
});
|
|
30189
|
+
} catch (error) {
|
|
30190
|
+
if (error instanceof EmptySessionTranscriptError) {
|
|
30191
|
+
if (await hasSnapshotSignature(
|
|
30192
|
+
filePath,
|
|
30193
|
+
fileIdentity,
|
|
30194
|
+
stats.size,
|
|
30195
|
+
lastUpdated
|
|
30196
|
+
)) {
|
|
30197
|
+
return void 0;
|
|
30198
|
+
}
|
|
30199
|
+
}
|
|
30200
|
+
throw error;
|
|
30201
|
+
} finally {
|
|
30202
|
+
recordRestoreStage("transcript_index", indexStartedAt);
|
|
30203
|
+
}
|
|
30204
|
+
recordRestoreIndexAttributes(index);
|
|
30205
|
+
const selectionStartedAt = performance3.now();
|
|
30206
|
+
const replaySelection = selectRestoreReplayUuids(
|
|
30207
|
+
index,
|
|
30208
|
+
sessionId,
|
|
30209
|
+
options2.replay
|
|
30210
|
+
);
|
|
30211
|
+
const replaySet = new Set(replaySelection?.uuids ?? []);
|
|
30212
|
+
const goalSet = new Set(
|
|
30213
|
+
replaySelection ? replaySelection.index.replayUuids.filter(
|
|
30214
|
+
(uuid) => index.byUuid.get(uuid)?.goalRecoveryCandidate === true
|
|
30215
|
+
) : []
|
|
30216
|
+
);
|
|
30217
|
+
const goalStatePosition = replaySelection ? replaySelection.index.goalStatePositions.findLast(
|
|
30218
|
+
(position) => position < replaySelection.nextPosition
|
|
30219
|
+
) : void 0;
|
|
30220
|
+
const goalStateUuid = goalStatePosition === void 0 || !replaySelection ? void 0 : replaySelection.index.replayUuids[goalStatePosition];
|
|
30221
|
+
const goalStateSet = new Set(goalStateUuid ? [goalStateUuid] : []);
|
|
30222
|
+
const artifactUuids = selectArtifactUuids(index);
|
|
30223
|
+
const artifactSet = new Set(artifactUuids);
|
|
30224
|
+
const selectedRuntimeUuids = index.runtimeUuids.filter(
|
|
30225
|
+
(uuid) => replaySet.has(uuid) || goalStateSet.has(uuid) || goalSet.has(uuid)
|
|
30226
|
+
);
|
|
30227
|
+
if (!selectedRuntimeUuids.includes(index.firstRecordUuid)) {
|
|
30228
|
+
selectedRuntimeUuids.unshift(index.firstRecordUuid);
|
|
30229
|
+
}
|
|
30230
|
+
const replayRecords = [];
|
|
30231
|
+
const goalRecords = [];
|
|
30232
|
+
const goalStatePayloads = /* @__PURE__ */ new Map();
|
|
30233
|
+
const artifacts = new SessionArtifactSnapshotAccumulator(sessionId);
|
|
30234
|
+
recordRestoreStage("resume_state_select", selectionStartedAt);
|
|
30235
|
+
const selectedReadSet = /* @__PURE__ */ new Set([
|
|
30236
|
+
...selectedRuntimeUuids,
|
|
30237
|
+
...artifactUuids
|
|
30238
|
+
]);
|
|
30239
|
+
const selectedReadsStartedAt = performance3.now();
|
|
30240
|
+
try {
|
|
30241
|
+
await forEachAggregatedRecord(
|
|
30242
|
+
index,
|
|
30243
|
+
[...selectedReadSet],
|
|
30244
|
+
async (record2) => {
|
|
30245
|
+
if (record2.uuid === index.firstRecordUuid && readOptions.validateFirstRecord && !await readOptions.validateFirstRecord(record2)) {
|
|
30246
|
+
throw new SessionTranscriptSnapshotUnavailableError(sessionId);
|
|
30247
|
+
}
|
|
30248
|
+
if (replaySet.has(record2.uuid)) replayRecords.push(record2);
|
|
30249
|
+
if (goalStateSet.has(record2.uuid)) {
|
|
30250
|
+
goalStatePayloads.set(
|
|
30251
|
+
record2.uuid,
|
|
30252
|
+
parseGoalStateRecordPayloadV2(record2.systemPayload)
|
|
30253
|
+
);
|
|
30254
|
+
}
|
|
30255
|
+
if (goalSet.has(record2.uuid)) {
|
|
30256
|
+
const normalized2 = normalizeGoalRecoveryRecord(record2);
|
|
30257
|
+
if (normalized2) goalRecords.push(normalized2);
|
|
30258
|
+
}
|
|
30259
|
+
if (artifactSet.has(record2.uuid)) artifacts.add(record2);
|
|
30260
|
+
}
|
|
30261
|
+
);
|
|
30262
|
+
} finally {
|
|
30263
|
+
recordRestoreStage("selected_record_read", selectedReadsStartedAt);
|
|
30264
|
+
}
|
|
30265
|
+
recordRestoreSelectionAttributes(index, selectedReadSet, replaySet);
|
|
30266
|
+
let replay;
|
|
30267
|
+
if (replaySelection) {
|
|
30268
|
+
const goalState = goalStateUuid ? goalStatePayloads.get(goalStateUuid) : void 0;
|
|
30269
|
+
replay = {
|
|
30270
|
+
records: replayRecords,
|
|
30271
|
+
gaps: index.gaps,
|
|
30272
|
+
hasMore: replaySelection.hasMore,
|
|
30273
|
+
...replaySelection.hasMore && replayRecords[0] ? { anchorRecordId: replayRecords[0].uuid } : {},
|
|
30274
|
+
...goalState ? {
|
|
30275
|
+
replay: {
|
|
30276
|
+
goalState: goalState.snapshot,
|
|
30277
|
+
goalCause: goalState.cause
|
|
30278
|
+
}
|
|
30279
|
+
} : {}
|
|
30280
|
+
};
|
|
30281
|
+
}
|
|
30282
|
+
const artifactSnapshot = artifacts.finish();
|
|
30283
|
+
const goalRecovery = selectGoalRecoveryFromRecords(goalRecords);
|
|
30284
|
+
const replayGoalRecoverySourceUuid = goalRecovery.sourceUuid && replaySelection?.index.replayUuids.includes(goalRecovery.sourceUuid) ? goalRecovery.sourceUuid : void 0;
|
|
30285
|
+
await assertIndexSnapshotUnchanged(index, sessionId);
|
|
30286
|
+
return {
|
|
30287
|
+
sessionId,
|
|
30288
|
+
startTime: index.restoreStartTime,
|
|
30289
|
+
lastUpdated: index.lastUpdated,
|
|
30290
|
+
...replay ? { replay } : {},
|
|
30291
|
+
...artifactSnapshot ? { artifactSnapshot } : {},
|
|
30292
|
+
...goalRecords.length > 0 ? { goalRecords } : {},
|
|
30293
|
+
...replayGoalRecoverySourceUuid ? { goalRecoverySourceUuid: replayGoalRecoverySourceUuid } : {}
|
|
30294
|
+
};
|
|
30295
|
+
}
|
|
29023
30296
|
async readPage(sessionId, options2 = {}) {
|
|
29024
30297
|
const limit = normalizeLimit(options2.limit);
|
|
29025
30298
|
const maxBytes = normalizeMaxBytes(options2.maxBytes);
|
|
@@ -29057,19 +30330,19 @@ var SessionTranscriptReader = class {
|
|
|
29057
30330
|
throw new SessionTranscriptSnapshotUnavailableError(sessionId);
|
|
29058
30331
|
}
|
|
29059
30332
|
const direction = cursor?.direction ?? options2.direction ?? (options2.beforeRecordId !== void 0 ? "backward" : "forward");
|
|
29060
|
-
let position = cursor?.position ?? (direction === "backward" ? index.
|
|
30333
|
+
let position = cursor?.position ?? (direction === "backward" ? index.replayUuids.length : 0);
|
|
29061
30334
|
if (!cursor && options2.beforeRecordId !== void 0) {
|
|
29062
30335
|
if (options2.beforeRecordId.length === 0) {
|
|
29063
30336
|
throw new InvalidSessionTranscriptCursorError();
|
|
29064
30337
|
}
|
|
29065
|
-
position = index.
|
|
30338
|
+
position = index.replayUuids.indexOf(options2.beforeRecordId);
|
|
29066
30339
|
if (position < 0) {
|
|
29067
30340
|
throw new InvalidSessionTranscriptCursorError();
|
|
29068
30341
|
}
|
|
29069
30342
|
}
|
|
29070
|
-
if (position > index.
|
|
30343
|
+
if (position > index.replayUuids.length) {
|
|
29071
30344
|
debugLogger14.debug(
|
|
29072
|
-
`cursor position out of range session=${sessionId} position=${position}
|
|
30345
|
+
`cursor position out of range session=${sessionId} position=${position} replay=${index.replayUuids.length}`
|
|
29073
30346
|
);
|
|
29074
30347
|
throw new InvalidSessionTranscriptCursorError();
|
|
29075
30348
|
}
|
|
@@ -29078,7 +30351,7 @@ var SessionTranscriptReader = class {
|
|
|
29078
30351
|
const nextPosition = backwardPage?.nextPosition ?? position + pageUuids.length;
|
|
29079
30352
|
const records = await readAggregatedRecords(index, pageUuids);
|
|
29080
30353
|
const backwardGoalState = direction === "backward" ? await readGoalStatePayloadBeforePosition(index, nextPosition) : void 0;
|
|
29081
|
-
const hasMore = direction === "backward" ? nextPosition > 0 : nextPosition < index.
|
|
30354
|
+
const hasMore = direction === "backward" ? nextPosition > 0 : nextPosition < index.replayUuids.length;
|
|
29082
30355
|
const nextCursorState = hasMore ? {
|
|
29083
30356
|
v: SESSION_TRANSCRIPT_CURSOR_VERSION,
|
|
29084
30357
|
sessionId,
|
|
@@ -31099,11 +32372,17 @@ var SessionService = class {
|
|
|
31099
32372
|
projectHash;
|
|
31100
32373
|
projectRoot;
|
|
31101
32374
|
onWarning;
|
|
32375
|
+
transcriptReader;
|
|
31102
32376
|
constructor(cwd, options2 = {}) {
|
|
31103
32377
|
this.storage = new Storage(cwd, options2.runtimeBaseDir);
|
|
31104
32378
|
this.projectRoot = cwd;
|
|
31105
32379
|
this.projectHash = getProjectHash(cwd);
|
|
31106
32380
|
this.onWarning = options2.onWarning;
|
|
32381
|
+
this.transcriptReader = new SessionTranscriptReader(
|
|
32382
|
+
cwd,
|
|
32383
|
+
void 0,
|
|
32384
|
+
options2.runtimeBaseDir
|
|
32385
|
+
);
|
|
31107
32386
|
}
|
|
31108
32387
|
/** The workspace root this service is bound to (the cwd it was constructed
|
|
31109
32388
|
* with). Lets callers that already hold a service — e.g. the session
|
|
@@ -31364,18 +32643,7 @@ var SessionService = class {
|
|
|
31364
32643
|
* user's pre-upgrade rename is never displayed as if it were auto-generated.
|
|
31365
32644
|
*/
|
|
31366
32645
|
readSessionTitleInfoFromFile(filePath, tailBuffer) {
|
|
31367
|
-
|
|
31368
|
-
filePath,
|
|
31369
|
-
"customTitle",
|
|
31370
|
-
["titleSource"],
|
|
31371
|
-
'"subtype":"custom_title"',
|
|
31372
|
-
tailBuffer
|
|
31373
|
-
);
|
|
31374
|
-
const title = hit["customTitle"];
|
|
31375
|
-
if (!title) return {};
|
|
31376
|
-
const rawSource = hit["titleSource"];
|
|
31377
|
-
const source = rawSource === "auto" || rawSource === "manual" ? rawSource : void 0;
|
|
31378
|
-
return { title, source };
|
|
32646
|
+
return readSessionTitleInfoFromFileSync(filePath, tailBuffer);
|
|
31379
32647
|
}
|
|
31380
32648
|
/**
|
|
31381
32649
|
* Extracts the `parent_session` record's `parentSessionId` from records
|
|
@@ -31816,6 +33084,16 @@ var SessionService = class {
|
|
|
31816
33084
|
async loadSession(sessionId) {
|
|
31817
33085
|
return this.loadSessionFromState(sessionId, "active");
|
|
31818
33086
|
}
|
|
33087
|
+
async readRestoreProjection(sessionId, options2) {
|
|
33088
|
+
return this.transcriptReader.readRestoreProjection(sessionId, options2, {
|
|
33089
|
+
validateFirstRecord: /* @__PURE__ */ __name((record2) => this.sessionBelongsToCurrentProject(record2.sessionId, record2.cwd), "validateFirstRecord")
|
|
33090
|
+
});
|
|
33091
|
+
}
|
|
33092
|
+
async readLiveRestoreProjection(sessionId, options2) {
|
|
33093
|
+
return this.transcriptReader.readLiveRestoreProjection(sessionId, options2, {
|
|
33094
|
+
validateFirstRecord: /* @__PURE__ */ __name((record2) => this.sessionBelongsToCurrentProject(record2.sessionId, record2.cwd), "validateFirstRecord")
|
|
33095
|
+
});
|
|
33096
|
+
}
|
|
31819
33097
|
/**
|
|
31820
33098
|
* Reads an archived session without changing its archive state.
|
|
31821
33099
|
* Daemon load/resume paths must continue to use {@link loadSession}.
|
|
@@ -31881,33 +33159,17 @@ var SessionService = class {
|
|
|
31881
33159
|
lastUpdated: new Date(stats.mtimeMs).toISOString(),
|
|
31882
33160
|
messages
|
|
31883
33161
|
};
|
|
31884
|
-
const
|
|
31885
|
-
const seenPromptIds = /* @__PURE__ */ new Map();
|
|
33162
|
+
const fileHistoryAccumulator = new SessionFileHistoryAccumulator();
|
|
31886
33163
|
for (const msg of messages) {
|
|
31887
|
-
|
|
31888
|
-
|
|
31889
|
-
|
|
31890
|
-
|
|
31891
|
-
|
|
31892
|
-
|
|
31893
|
-
} catch (e) {
|
|
31894
|
-
debugLogger16.warn(
|
|
31895
|
-
`loadSession: skipping malformed file_history_snapshot: ${e}`
|
|
31896
|
-
);
|
|
31897
|
-
continue;
|
|
31898
|
-
}
|
|
31899
|
-
for (const s3 of deserialized) {
|
|
31900
|
-
const existingIdx = seenPromptIds.get(s3.promptId);
|
|
31901
|
-
if (existingIdx !== void 0) {
|
|
31902
|
-
fileHistorySnapshots[existingIdx] = s3;
|
|
31903
|
-
} else {
|
|
31904
|
-
seenPromptIds.set(s3.promptId, fileHistorySnapshots.length);
|
|
31905
|
-
fileHistorySnapshots.push(s3);
|
|
31906
|
-
}
|
|
31907
|
-
}
|
|
33164
|
+
try {
|
|
33165
|
+
fileHistoryAccumulator.add(msg);
|
|
33166
|
+
} catch (e) {
|
|
33167
|
+
debugLogger16.warn(
|
|
33168
|
+
`loadSession: skipping malformed file_history_snapshot: ${e}`
|
|
33169
|
+
);
|
|
31908
33170
|
}
|
|
31909
33171
|
}
|
|
31910
|
-
const
|
|
33172
|
+
const fileHistorySnapshots = fileHistoryAccumulator.finish();
|
|
31911
33173
|
const activeBranchRecords = includeActiveSideArtifactRecords(
|
|
31912
33174
|
records,
|
|
31913
33175
|
messages
|
|
@@ -31920,7 +33182,7 @@ var SessionService = class {
|
|
|
31920
33182
|
conversation,
|
|
31921
33183
|
filePath,
|
|
31922
33184
|
lastCompletedUuid: lastMessage.uuid,
|
|
31923
|
-
fileHistorySnapshots
|
|
33185
|
+
fileHistorySnapshots,
|
|
31924
33186
|
...artifactSnapshot ? { artifactSnapshot } : {},
|
|
31925
33187
|
historyGaps: gaps.length > 0 ? gaps : void 0
|
|
31926
33188
|
};
|
|
@@ -32547,95 +33809,6 @@ var SessionService = class {
|
|
|
32547
33809
|
}
|
|
32548
33810
|
}
|
|
32549
33811
|
};
|
|
32550
|
-
function stripThoughtsFromContent(content) {
|
|
32551
|
-
if (!content.parts) return content;
|
|
32552
|
-
const filteredParts = content.parts.filter((part) => !part.thought);
|
|
32553
|
-
if (filteredParts.length === 0) {
|
|
32554
|
-
return null;
|
|
32555
|
-
}
|
|
32556
|
-
return {
|
|
32557
|
-
...content,
|
|
32558
|
-
parts: filteredParts
|
|
32559
|
-
};
|
|
32560
|
-
}
|
|
32561
|
-
__name(stripThoughtsFromContent, "stripThoughtsFromContent");
|
|
32562
|
-
function copyContentForApiHistory(content) {
|
|
32563
|
-
return {
|
|
32564
|
-
...content,
|
|
32565
|
-
parts: content.parts?.map((part) => {
|
|
32566
|
-
if ("functionCall" in part && part.functionCall) {
|
|
32567
|
-
return {
|
|
32568
|
-
...part,
|
|
32569
|
-
functionCall: {
|
|
32570
|
-
...part.functionCall,
|
|
32571
|
-
args: part.functionCall.args ? { ...part.functionCall.args } : part.functionCall.args
|
|
32572
|
-
}
|
|
32573
|
-
};
|
|
32574
|
-
}
|
|
32575
|
-
if ("functionResponse" in part && part.functionResponse) {
|
|
32576
|
-
return {
|
|
32577
|
-
...part,
|
|
32578
|
-
functionResponse: {
|
|
32579
|
-
...part.functionResponse
|
|
32580
|
-
}
|
|
32581
|
-
};
|
|
32582
|
-
}
|
|
32583
|
-
return { ...part };
|
|
32584
|
-
})
|
|
32585
|
-
};
|
|
32586
|
-
}
|
|
32587
|
-
__name(copyContentForApiHistory, "copyContentForApiHistory");
|
|
32588
|
-
function appendApiHistoryRecord(history, record2) {
|
|
32589
|
-
if (!record2.message || record2.subtype === "realtime_message") return;
|
|
32590
|
-
const message = copyContentForApiHistory(record2.message);
|
|
32591
|
-
if (record2.subtype === "mid_turn_user_message") {
|
|
32592
|
-
const previous = history.at(-1);
|
|
32593
|
-
if (previous?.role === "user") {
|
|
32594
|
-
previous.parts = [...previous.parts ?? [], ...message.parts ?? []];
|
|
32595
|
-
return;
|
|
32596
|
-
}
|
|
32597
|
-
}
|
|
32598
|
-
history.push(message);
|
|
32599
|
-
}
|
|
32600
|
-
__name(appendApiHistoryRecord, "appendApiHistoryRecord");
|
|
32601
|
-
function buildApiHistoryFromConversation(conversation, options2 = {}) {
|
|
32602
|
-
const { stripThoughtsFromHistory = false } = options2;
|
|
32603
|
-
const { messages } = conversation;
|
|
32604
|
-
let lastCompressionIndex = -1;
|
|
32605
|
-
let compressedHistory;
|
|
32606
|
-
messages.forEach((record2, index) => {
|
|
32607
|
-
if (record2.type === "system" && record2.subtype === "chat_compression") {
|
|
32608
|
-
const payload = record2.systemPayload;
|
|
32609
|
-
if (payload?.compressedHistory) {
|
|
32610
|
-
lastCompressionIndex = index;
|
|
32611
|
-
compressedHistory = payload.compressedHistory;
|
|
32612
|
-
}
|
|
32613
|
-
}
|
|
32614
|
-
});
|
|
32615
|
-
if (compressedHistory && lastCompressionIndex >= 0) {
|
|
32616
|
-
const baseHistory = compressedHistory.map(
|
|
32617
|
-
copyContentForApiHistory
|
|
32618
|
-
);
|
|
32619
|
-
for (let i = lastCompressionIndex + 1; i < messages.length; i++) {
|
|
32620
|
-
const record2 = messages[i];
|
|
32621
|
-
if (record2.type === "system") continue;
|
|
32622
|
-
appendApiHistoryRecord(baseHistory, record2);
|
|
32623
|
-
}
|
|
32624
|
-
if (stripThoughtsFromHistory) {
|
|
32625
|
-
return baseHistory.map(stripThoughtsFromContent).filter((content) => content !== null);
|
|
32626
|
-
}
|
|
32627
|
-
return baseHistory;
|
|
32628
|
-
}
|
|
32629
|
-
const result = [];
|
|
32630
|
-
for (const record2 of messages) {
|
|
32631
|
-
appendApiHistoryRecord(result, record2);
|
|
32632
|
-
}
|
|
32633
|
-
if (stripThoughtsFromHistory) {
|
|
32634
|
-
return result.map(stripThoughtsFromContent).filter((content) => content !== null);
|
|
32635
|
-
}
|
|
32636
|
-
return result;
|
|
32637
|
-
}
|
|
32638
|
-
__name(buildApiHistoryFromConversation, "buildApiHistoryFromConversation");
|
|
32639
33812
|
function remapSnapshotPromptId(snapshot, sourceSessionId, newSessionId) {
|
|
32640
33813
|
const sourcePrefix = `${sourceSessionId}########`;
|
|
32641
33814
|
if (!snapshot.promptId.startsWith(sourcePrefix)) {
|
|
@@ -32686,60 +33859,25 @@ function includeActiveSideArtifactRecords(records, activeRecords) {
|
|
|
32686
33859
|
const activeByUuid = new Map(
|
|
32687
33860
|
activeRecords.map((record2) => [record2.uuid, record2])
|
|
32688
33861
|
);
|
|
32689
|
-
const
|
|
32690
|
-
|
|
32691
|
-
|
|
32692
|
-
|
|
32693
|
-
|
|
32694
|
-
|
|
32695
|
-
let nextBlockingUuid;
|
|
32696
|
-
for (let index = records.length - 1; index >= 0; index--) {
|
|
32697
|
-
if (nextActiveUuid !== void 0) {
|
|
32698
|
-
nextActiveUuidByIndex.set(index, nextActiveUuid);
|
|
32699
|
-
}
|
|
32700
|
-
if (nextBlockingUuid !== void 0) {
|
|
32701
|
-
nextBlockingUuidByIndex.set(index, nextBlockingUuid);
|
|
32702
|
-
}
|
|
32703
|
-
if (activeUuids.has(records[index].uuid)) {
|
|
32704
|
-
nextActiveUuid = records[index].uuid;
|
|
32705
|
-
nextBlockingUuid = void 0;
|
|
32706
|
-
} else if (!isSessionArtifactRecord(records[index]) && !isTailNeutralSideRecord(records[index])) {
|
|
32707
|
-
nextBlockingUuid = records[index].uuid;
|
|
32708
|
-
}
|
|
32709
|
-
}
|
|
33862
|
+
const artifactUuids = new Set(
|
|
33863
|
+
selectActiveSideArtifactRecordUuids(
|
|
33864
|
+
records,
|
|
33865
|
+
activeRecords.map((record2) => record2.uuid)
|
|
33866
|
+
)
|
|
33867
|
+
);
|
|
32710
33868
|
const selected = [];
|
|
32711
|
-
const
|
|
32712
|
-
let previousActiveUuid;
|
|
32713
|
-
for (let index = 0; index < records.length; index++) {
|
|
32714
|
-
const record2 = records[index];
|
|
33869
|
+
for (const record2 of records) {
|
|
32715
33870
|
const activeRecord = activeByUuid.get(record2.uuid);
|
|
32716
33871
|
if (activeRecord) {
|
|
32717
33872
|
selected.push(activeRecord);
|
|
32718
33873
|
activeByUuid.delete(record2.uuid);
|
|
32719
|
-
previousActiveUuid = record2.uuid;
|
|
32720
|
-
continue;
|
|
32721
|
-
}
|
|
32722
|
-
if (!isSessionArtifactRecord(record2)) {
|
|
32723
33874
|
continue;
|
|
32724
33875
|
}
|
|
32725
|
-
|
|
32726
|
-
const hasBlockingRecordBeforeNextActive = nextBlockingUuidByIndex.has(index);
|
|
32727
|
-
const isInActiveSegment = !hasBlockingRecordBeforeNextActive && (nextUuid !== void 0 ? activeUuids.has(nextUuid) : previousActiveUuid !== void 0 && activeUuids.has(previousActiveUuid));
|
|
32728
|
-
if (record2.parentUuid !== null && (activeUuids.has(record2.parentUuid) || includedSideArtifactUuids.has(record2.parentUuid)) && isInActiveSegment && (record2.parentUuid === previousActiveUuid || includedSideArtifactUuids.has(record2.parentUuid))) {
|
|
32729
|
-
selected.push(record2);
|
|
32730
|
-
includedSideArtifactUuids.add(record2.uuid);
|
|
32731
|
-
} else if (record2.parentUuid === null && index < firstActiveIndex && isInActiveSegment) {
|
|
32732
|
-
selected.push(record2);
|
|
32733
|
-
includedSideArtifactUuids.add(record2.uuid);
|
|
32734
|
-
}
|
|
33876
|
+
if (artifactUuids.has(record2.uuid)) selected.push(record2);
|
|
32735
33877
|
}
|
|
32736
33878
|
return selected;
|
|
32737
33879
|
}
|
|
32738
33880
|
__name(includeActiveSideArtifactRecords, "includeActiveSideArtifactRecords");
|
|
32739
|
-
function isTailNeutralSideRecord(record2) {
|
|
32740
|
-
return record2.type === "system" && record2.subtype === "custom_title";
|
|
32741
|
-
}
|
|
32742
|
-
__name(isTailNeutralSideRecord, "isTailNeutralSideRecord");
|
|
32743
33881
|
function collectFileHistorySnapshotPromptIds(records) {
|
|
32744
33882
|
const ids = /* @__PURE__ */ new Set();
|
|
32745
33883
|
for (const record2 of records) {
|
|
@@ -32783,37 +33921,6 @@ function replayUiTelemetryFromConversation(conversation, sessionId) {
|
|
|
32783
33921
|
return resumeTokenCounts;
|
|
32784
33922
|
}
|
|
32785
33923
|
__name(replayUiTelemetryFromConversation, "replayUiTelemetryFromConversation");
|
|
32786
|
-
function getResumeTokenCounts(conversation) {
|
|
32787
|
-
for (let i = conversation.messages.length - 1; i >= 0; i--) {
|
|
32788
|
-
const record2 = conversation.messages[i];
|
|
32789
|
-
if (record2.type === "assistant") {
|
|
32790
|
-
const usage = record2.usageMetadata;
|
|
32791
|
-
const candidate = usage?.promptTokenCount ?? usage?.totalTokenCount;
|
|
32792
|
-
if (candidate) {
|
|
32793
|
-
return {
|
|
32794
|
-
promptTokenCount: candidate,
|
|
32795
|
-
outputTokenCount: getUsageOutputTokenCountForPromptEstimate(usage),
|
|
32796
|
-
isEstimated: false
|
|
32797
|
-
};
|
|
32798
|
-
}
|
|
32799
|
-
}
|
|
32800
|
-
if (record2.type === "system" && record2.subtype === "chat_compression") {
|
|
32801
|
-
const payload = record2.systemPayload;
|
|
32802
|
-
if (payload?.info) {
|
|
32803
|
-
return {
|
|
32804
|
-
promptTokenCount: payload.info.newTokenCount,
|
|
32805
|
-
outputTokenCount: 0,
|
|
32806
|
-
// Checkpoints created before provenance was persisted are safest to
|
|
32807
|
-
// treat as estimates: this keeps the output clamp's overhead pad on
|
|
32808
|
-
// and prevents an optimistic resume from overflowing the window.
|
|
32809
|
-
isEstimated: payload.info.newTokenCountIsEstimated ?? true
|
|
32810
|
-
};
|
|
32811
|
-
}
|
|
32812
|
-
}
|
|
32813
|
-
}
|
|
32814
|
-
return void 0;
|
|
32815
|
-
}
|
|
32816
|
-
__name(getResumeTokenCounts, "getResumeTokenCounts");
|
|
32817
33924
|
var MAX_BRANCH_COLLISION_SCAN = 99;
|
|
32818
33925
|
async function computeUniqueBranchTitle(baseName, sessionService) {
|
|
32819
33926
|
const maxSuffixLen = " (Branch 1234567890123)".length;
|
|
@@ -33118,24 +34225,28 @@ function copyGoalContext(goalContext) {
|
|
|
33118
34225
|
}
|
|
33119
34226
|
__name(copyGoalContext, "copyGoalContext");
|
|
33120
34227
|
var ChatRecordingService = class {
|
|
33121
|
-
constructor(config, onWriteFailure, writerLeaseRequired = config.isSessionWriterLeaseEnabled?.() ?? config.getExperimentalZedIntegration?.() ?? true) {
|
|
34228
|
+
constructor(config, onWriteFailure, writerLeaseRequired = config.isSessionWriterLeaseEnabled?.() ?? config.getExperimentalZedIntegration?.() ?? true, restoreState) {
|
|
33122
34229
|
this.onWriteFailure = onWriteFailure;
|
|
33123
34230
|
this.config = config;
|
|
33124
34231
|
this.writerLeaseRequired = writerLeaseRequired;
|
|
33125
34232
|
const resumed = config.getResumedSessionData();
|
|
33126
34233
|
if (writerLeaseRequired) {
|
|
33127
|
-
this.lastRecordUuid = resumed?.lastCompletedUuid ?? null;
|
|
34234
|
+
this.lastRecordUuid = restoreState?.lastCompletedUuid ?? resumed?.lastCompletedUuid ?? null;
|
|
33128
34235
|
this.lastPersistedRecordUuid = this.lastRecordUuid;
|
|
33129
34236
|
} else {
|
|
33130
34237
|
this.state = "active";
|
|
33131
34238
|
this.acceptingWrites = true;
|
|
33132
|
-
|
|
33133
|
-
|
|
33134
|
-
|
|
33135
|
-
|
|
33136
|
-
|
|
33137
|
-
|
|
33138
|
-
|
|
34239
|
+
if (restoreState) {
|
|
34240
|
+
this.restoreProjectedState(restoreState);
|
|
34241
|
+
} else {
|
|
34242
|
+
this.restoreSessionState(
|
|
34243
|
+
resumed ? {
|
|
34244
|
+
conversation: resumed.conversation ?? { messages: [] },
|
|
34245
|
+
lastCompletedUuid: resumed.lastCompletedUuid
|
|
34246
|
+
} : void 0,
|
|
34247
|
+
resumed ? this.readPersistedTitleInfo() : void 0
|
|
34248
|
+
);
|
|
34249
|
+
}
|
|
33139
34250
|
}
|
|
33140
34251
|
}
|
|
33141
34252
|
static {
|
|
@@ -33339,12 +34450,29 @@ var ChatRecordingService = class {
|
|
|
33339
34450
|
this.userDisplayTextsForTitle.shift();
|
|
33340
34451
|
}
|
|
33341
34452
|
}
|
|
33342
|
-
|
|
34453
|
+
restoreProjectedState(state) {
|
|
34454
|
+
this.lastRecordUuid = state.lastCompletedUuid;
|
|
34455
|
+
this.lastPersistedRecordUuid = state.lastCompletedUuid;
|
|
34456
|
+
this.turnParentUuids = [...state.turnParentUuids];
|
|
34457
|
+
this.currentCustomTitle = state.customTitle;
|
|
34458
|
+
this.currentTitleSource = state.titleSource;
|
|
34459
|
+
this.currentParentSessionId = state.parentSessionId;
|
|
34460
|
+
this.currentSourceType = state.sourceType;
|
|
34461
|
+
this.currentSourceId = state.sourceId;
|
|
34462
|
+
if (this.currentCustomTitle) {
|
|
34463
|
+
this.bytesSinceTitleAnchor = TITLE_REANCHOR_BYTES;
|
|
34464
|
+
}
|
|
34465
|
+
}
|
|
34466
|
+
activate(lease, sessionData, persistedTitleInfo, restoreState) {
|
|
33343
34467
|
if (!this.writerLeaseRequired || this.state !== "inactive" || lease.sessionId !== this.config.getSessionId()) {
|
|
33344
34468
|
throw new SessionWriterUnavailableError();
|
|
33345
34469
|
}
|
|
33346
34470
|
this.binding = { sessionId: lease.sessionId, lease };
|
|
33347
|
-
|
|
34471
|
+
if (restoreState) {
|
|
34472
|
+
this.restoreProjectedState(restoreState);
|
|
34473
|
+
} else {
|
|
34474
|
+
this.restoreSessionState(sessionData, persistedTitleInfo);
|
|
34475
|
+
}
|
|
33348
34476
|
this.state = "active";
|
|
33349
34477
|
this.acceptingWrites = true;
|
|
33350
34478
|
}
|
|
@@ -58674,7 +59802,7 @@ var HybridTokenStorage = class extends BaseTokenStorage {
|
|
|
58674
59802
|
const forceFileStorage = process.env[FORCE_FILE_STORAGE_ENV_VAR] === "true";
|
|
58675
59803
|
if (!forceFileStorage) {
|
|
58676
59804
|
try {
|
|
58677
|
-
const { KeychainTokenStorage: KeychainTokenStorage2 } = await import("./keychain-token-storage-
|
|
59805
|
+
const { KeychainTokenStorage: KeychainTokenStorage2 } = await import("./keychain-token-storage-GU75J2T2.js");
|
|
58678
59806
|
const keychainStorage = new KeychainTokenStorage2(this.serviceName);
|
|
58679
59807
|
const isAvailable = await keychainStorage.isAvailable();
|
|
58680
59808
|
if (isAvailable) {
|
|
@@ -79833,39 +80961,6 @@ var formatMemoryUsage = /* @__PURE__ */ __name((bytes) => {
|
|
|
79833
80961
|
// packages/core/src/utils/shellContextEnv.ts
|
|
79834
80962
|
init_esbuild_shims();
|
|
79835
80963
|
import { accessSync as accessSync2, closeSync as closeSync3, constants as constants4, openSync as openSync3, readSync } from "node:fs";
|
|
79836
|
-
|
|
79837
|
-
// packages/core/src/utils/sessionIdContext.ts
|
|
79838
|
-
init_esbuild_shims();
|
|
79839
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
79840
|
-
var sessionIdContext = new AsyncLocalStorage();
|
|
79841
|
-
var projectDirBySession = /* @__PURE__ */ new Map();
|
|
79842
|
-
function registerSessionProjectDir(sessionId, projectDir) {
|
|
79843
|
-
if (sessionId && projectDir) projectDirBySession.set(sessionId, projectDir);
|
|
79844
|
-
}
|
|
79845
|
-
__name(registerSessionProjectDir, "registerSessionProjectDir");
|
|
79846
|
-
function getSessionProjectDir(sessionId) {
|
|
79847
|
-
return projectDirBySession.get(sessionId);
|
|
79848
|
-
}
|
|
79849
|
-
__name(getSessionProjectDir, "getSessionProjectDir");
|
|
79850
|
-
function unregisterSessionProjectDir(sessionId) {
|
|
79851
|
-
projectDirBySession.delete(sessionId);
|
|
79852
|
-
}
|
|
79853
|
-
__name(unregisterSessionProjectDir, "unregisterSessionProjectDir");
|
|
79854
|
-
var modelBySession = /* @__PURE__ */ new Map();
|
|
79855
|
-
function registerSessionModel(sessionId, model) {
|
|
79856
|
-
if (sessionId && model) modelBySession.set(sessionId, model);
|
|
79857
|
-
}
|
|
79858
|
-
__name(registerSessionModel, "registerSessionModel");
|
|
79859
|
-
function getSessionModel(sessionId) {
|
|
79860
|
-
return modelBySession.get(sessionId);
|
|
79861
|
-
}
|
|
79862
|
-
__name(getSessionModel, "getSessionModel");
|
|
79863
|
-
function unregisterSessionModel(sessionId) {
|
|
79864
|
-
modelBySession.delete(sessionId);
|
|
79865
|
-
}
|
|
79866
|
-
__name(unregisterSessionModel, "unregisterSessionModel");
|
|
79867
|
-
|
|
79868
|
-
// packages/core/src/utils/shellContextEnv.ts
|
|
79869
80964
|
var unusableCache = /* @__PURE__ */ new Map();
|
|
79870
80965
|
function isUnusableScriptEntry(path103) {
|
|
79871
80966
|
if (!/\.(?:mjs|cjs|js)$/i.test(path103)) return false;
|
|
@@ -80114,10 +81209,11 @@ var serializePlainViewportToAnsiOutput = /* @__PURE__ */ __name((terminal, unwra
|
|
|
80114
81209
|
return lines;
|
|
80115
81210
|
}, "serializePlainViewportToAnsiOutput");
|
|
80116
81211
|
var WINDOWS_TASKKILL = `${process.env["SystemRoot"] || "C:\\Windows"}\\System32\\taskkill.exe`;
|
|
81212
|
+
var WINDOWS_TASKKILL_OPTIONS = { windowsHide: true };
|
|
80117
81213
|
var windowsKillPid = /* @__PURE__ */ __name((pid, tree) => {
|
|
80118
81214
|
try {
|
|
80119
81215
|
const args = tree ? ["/f", "/t", "/pid", pid.toString()] : ["/f", "/pid", pid.toString()];
|
|
80120
|
-
const killer = cpSpawn(WINDOWS_TASKKILL, args);
|
|
81216
|
+
const killer = cpSpawn(WINDOWS_TASKKILL, args, WINDOWS_TASKKILL_OPTIONS);
|
|
80121
81217
|
killer.on("error", (e) => {
|
|
80122
81218
|
debugLogger58.warn(
|
|
80123
81219
|
`windowsKillPid: taskkill failed to launch for pid ${pid}: ${e.message}`
|
|
@@ -80139,7 +81235,11 @@ var windowsKillPid = /* @__PURE__ */ __name((pid, tree) => {
|
|
|
80139
81235
|
var windowsStrategy = {
|
|
80140
81236
|
killPty: /* @__PURE__ */ __name((pid, pty) => {
|
|
80141
81237
|
try {
|
|
80142
|
-
spawnSync3(
|
|
81238
|
+
spawnSync3(
|
|
81239
|
+
WINDOWS_TASKKILL,
|
|
81240
|
+
["/f", "/t", "/pid", pid.toString()],
|
|
81241
|
+
WINDOWS_TASKKILL_OPTIONS
|
|
81242
|
+
);
|
|
80143
81243
|
} catch {
|
|
80144
81244
|
}
|
|
80145
81245
|
try {
|
|
@@ -80154,7 +81254,7 @@ var windowsStrategy = {
|
|
|
80154
81254
|
for (const pid of pids) {
|
|
80155
81255
|
args.push("/pid", pid.toString());
|
|
80156
81256
|
}
|
|
80157
|
-
spawnSync3(WINDOWS_TASKKILL, args);
|
|
81257
|
+
spawnSync3(WINDOWS_TASKKILL, args, WINDOWS_TASKKILL_OPTIONS);
|
|
80158
81258
|
} catch {
|
|
80159
81259
|
}
|
|
80160
81260
|
}
|
|
@@ -80615,12 +81715,11 @@ var ShellExecutionService = class _ShellExecutionService {
|
|
|
80615
81715
|
const performCancelKill = /* @__PURE__ */ __name(async () => {
|
|
80616
81716
|
if (!child.pid || exited) return;
|
|
80617
81717
|
if (isWindows3) {
|
|
80618
|
-
const killer = cpSpawn(
|
|
80619
|
-
|
|
80620
|
-
"/t",
|
|
80621
|
-
|
|
80622
|
-
|
|
80623
|
-
]);
|
|
81718
|
+
const killer = cpSpawn(
|
|
81719
|
+
WINDOWS_TASKKILL,
|
|
81720
|
+
["/f", "/t", "/pid", child.pid.toString()],
|
|
81721
|
+
WINDOWS_TASKKILL_OPTIONS
|
|
81722
|
+
);
|
|
80624
81723
|
const killChildFallback = /* @__PURE__ */ __name((why) => {
|
|
80625
81724
|
debugLogger58.warn(
|
|
80626
81725
|
`performCancelKill (child_process): taskkill ${why} for pid ${child.pid}; falling back to child.kill`
|
|
@@ -81260,12 +82359,11 @@ var ShellExecutionService = class _ShellExecutionService {
|
|
|
81260
82359
|
cancelKillDispatched = true;
|
|
81261
82360
|
if (os11.platform() === "win32") {
|
|
81262
82361
|
try {
|
|
81263
|
-
const r = spawnSync3(
|
|
81264
|
-
|
|
81265
|
-
"/t",
|
|
81266
|
-
|
|
81267
|
-
|
|
81268
|
-
]);
|
|
82362
|
+
const r = spawnSync3(
|
|
82363
|
+
WINDOWS_TASKKILL,
|
|
82364
|
+
["/f", "/t", "/pid", ptyProcess.pid.toString()],
|
|
82365
|
+
WINDOWS_TASKKILL_OPTIONS
|
|
82366
|
+
);
|
|
81269
82367
|
if (r.error || typeof r.status === "number" && r.status !== 0) {
|
|
81270
82368
|
debugLogger58.warn(
|
|
81271
82369
|
`performCancelKill: taskkill failed for pid ${ptyProcess.pid}: ${r.error?.message ?? `exit ${r.status}`}`
|
|
@@ -81547,6 +82645,26 @@ function readLastTranscriptRecordUuidSync(jsonlPath) {
|
|
|
81547
82645
|
return null;
|
|
81548
82646
|
}
|
|
81549
82647
|
__name(readLastTranscriptRecordUuidSync, "readLastTranscriptRecordUuidSync");
|
|
82648
|
+
function buildAgentTranscriptAttach(config, agentId, extras) {
|
|
82649
|
+
const projectRoot = config.getProjectRoot();
|
|
82650
|
+
const options2 = {
|
|
82651
|
+
agentId,
|
|
82652
|
+
sessionId: config.getSessionId(),
|
|
82653
|
+
cwd: projectRoot,
|
|
82654
|
+
version: config.getCliVersion() || "unknown",
|
|
82655
|
+
gitBranch: getCachedGitBranch(projectRoot),
|
|
82656
|
+
...extras
|
|
82657
|
+
};
|
|
82658
|
+
return {
|
|
82659
|
+
jsonlPath: getAgentJsonlPath(
|
|
82660
|
+
config.storage.getProjectDir(),
|
|
82661
|
+
options2.sessionId,
|
|
82662
|
+
options2.agentId
|
|
82663
|
+
),
|
|
82664
|
+
options: options2
|
|
82665
|
+
};
|
|
82666
|
+
}
|
|
82667
|
+
__name(buildAgentTranscriptAttach, "buildAgentTranscriptAttach");
|
|
81550
82668
|
function attachJsonlTranscriptWriter(emitter, jsonlPath, options2) {
|
|
81551
82669
|
let lastUuid = options2.initialParentUuid !== void 0 ? options2.initialParentUuid : options2.appendToExisting ? readLastTranscriptRecordUuidSync(jsonlPath) : null;
|
|
81552
82670
|
let fd = null;
|
|
@@ -81721,6 +82839,9 @@ function attachJsonlTranscriptWriter(emitter, jsonlPath, options2) {
|
|
|
81721
82839
|
displayText: options2.launchTaskPrompt
|
|
81722
82840
|
});
|
|
81723
82841
|
}
|
|
82842
|
+
if (options2.retryAttempt !== void 0) {
|
|
82843
|
+
recordSystem("agent_retry", { attempt: options2.retryAttempt });
|
|
82844
|
+
}
|
|
81724
82845
|
emitter.on("round_text" /* ROUND_TEXT */, onRoundText);
|
|
81725
82846
|
emitter.on("stream_text" /* STREAM_TEXT */, appendStreamText);
|
|
81726
82847
|
emitter.on("tool_call" /* TOOL_CALL */, onToolCall);
|
|
@@ -114211,19 +115332,19 @@ var BackgroundAgentResumeService = class {
|
|
|
114211
115332
|
subagent = result.subagent;
|
|
114212
115333
|
subagentDispose = result.dispose;
|
|
114213
115334
|
}
|
|
114214
|
-
const
|
|
114215
|
-
|
|
114216
|
-
agentId: meta.agentId,
|
|
115335
|
+
const { jsonlPath, options: transcriptAttachOptions } = buildAgentTranscriptAttach(this.config, meta.agentId, {
|
|
115336
|
+
sessionId: meta.parentSessionId,
|
|
114217
115337
|
agentName: target.agentName,
|
|
114218
115338
|
agentColor: target.subagentConfig?.color ?? meta.agentColor,
|
|
114219
|
-
sessionId: meta.parentSessionId,
|
|
114220
|
-
cwd: projectRoot,
|
|
114221
|
-
version: this.config.getCliVersion() || "unknown",
|
|
114222
|
-
gitBranch: getGitBranch(projectRoot),
|
|
114223
115339
|
initialUserPrompt: writerInitialPrompt,
|
|
114224
115340
|
appendToExisting: true,
|
|
114225
115341
|
initialParentUuid: recovery.lastStableUuid
|
|
114226
|
-
})
|
|
115342
|
+
});
|
|
115343
|
+
cleanupJsonl = attachJsonlTranscriptWriter(
|
|
115344
|
+
bgEventEmitter,
|
|
115345
|
+
jsonlPath,
|
|
115346
|
+
transcriptAttachOptions
|
|
115347
|
+
).cleanup;
|
|
114227
115348
|
const nextResumeCount = (meta.resumeCount ?? 0) + 1;
|
|
114228
115349
|
patchAgentMeta(metaPath, {
|
|
114229
115350
|
status: "running",
|
|
@@ -130519,12 +131640,13 @@ ${longRunHint}` : ""),
|
|
|
130519
131640
|
if (pid !== void 0) {
|
|
130520
131641
|
if (os23.platform() === "win32") {
|
|
130521
131642
|
try {
|
|
130522
|
-
const taskkillChild = childProcess.spawn(
|
|
130523
|
-
"
|
|
130524
|
-
String(pid),
|
|
130525
|
-
|
|
130526
|
-
|
|
130527
|
-
|
|
131643
|
+
const taskkillChild = childProcess.spawn(
|
|
131644
|
+
"taskkill",
|
|
131645
|
+
["/pid", String(pid), "/f", "/t"],
|
|
131646
|
+
// The desktop runtime daemon has no console; without this
|
|
131647
|
+
// flag each console-app child allocates a visible window.
|
|
131648
|
+
{ windowsHide: true }
|
|
131649
|
+
);
|
|
130528
131650
|
taskkillChild.on("error", () => {
|
|
130529
131651
|
});
|
|
130530
131652
|
} catch {
|
|
@@ -130594,12 +131716,13 @@ ${longRunHint}` : ""),
|
|
|
130594
131716
|
if (pid !== void 0) {
|
|
130595
131717
|
if (os23.platform() === "win32") {
|
|
130596
131718
|
try {
|
|
130597
|
-
const taskkillChild = childProcess.spawn(
|
|
130598
|
-
"
|
|
130599
|
-
String(pid),
|
|
130600
|
-
|
|
130601
|
-
|
|
130602
|
-
|
|
131719
|
+
const taskkillChild = childProcess.spawn(
|
|
131720
|
+
"taskkill",
|
|
131721
|
+
["/pid", String(pid), "/f", "/t"],
|
|
131722
|
+
// The desktop runtime daemon has no console; without this
|
|
131723
|
+
// flag each console-app child allocates a visible window.
|
|
131724
|
+
{ windowsHide: true }
|
|
131725
|
+
);
|
|
130603
131726
|
taskkillChild.on("error", (err) => {
|
|
130604
131727
|
debugLogger125.warn(
|
|
130605
131728
|
`promote: taskkill spawn failed for pid=${pid}: ${err.message}`
|
|
@@ -130912,7 +132035,7 @@ To inspect: /tasks (text) or the interactive Background tasks dialog (focus the
|
|
|
130912
132035
|
const child = childProcess.execFile(
|
|
130913
132036
|
"git",
|
|
130914
132037
|
args,
|
|
130915
|
-
{ cwd, timeout: 2e3 },
|
|
132038
|
+
{ cwd, timeout: 2e3, windowsHide: true },
|
|
130916
132039
|
(error, stdout) => {
|
|
130917
132040
|
if (error) {
|
|
130918
132041
|
resolve41(0);
|
|
@@ -130940,7 +132063,7 @@ To inspect: /tasks (text) or the interactive Background tasks dialog (focus the
|
|
|
130940
132063
|
const child = childProcess.execFile(
|
|
130941
132064
|
"git",
|
|
130942
132065
|
["rev-parse", "HEAD"],
|
|
130943
|
-
{ cwd, timeout: 2e3 },
|
|
132066
|
+
{ cwd, timeout: 2e3, windowsHide: true },
|
|
130944
132067
|
(error, stdout) => {
|
|
130945
132068
|
if (error) {
|
|
130946
132069
|
resolve41(null);
|
|
@@ -130972,6 +132095,7 @@ To inspect: /tasks (text) or the interactive Background tasks dialog (focus the
|
|
|
130972
132095
|
const stdout = childProcess.execFileSync("git", ["rev-parse", "HEAD"], {
|
|
130973
132096
|
cwd,
|
|
130974
132097
|
timeout: 2e3,
|
|
132098
|
+
windowsHide: true,
|
|
130975
132099
|
// Discard stderr noise (e.g. "fatal: not a git repository") —
|
|
130976
132100
|
// the catch-or-empty-output path already covers failure.
|
|
130977
132101
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -131052,6 +132176,7 @@ To inspect: /tasks (text) or the interactive Background tasks dialog (focus the
|
|
|
131052
132176
|
return childProcess.execFileSync("git", ["show", `${postHead}:${rel}`], {
|
|
131053
132177
|
cwd,
|
|
131054
132178
|
timeout: 2e3,
|
|
132179
|
+
windowsHide: true,
|
|
131055
132180
|
stdio: ["ignore", "pipe", "ignore"],
|
|
131056
132181
|
maxBuffer: 16 * 1024 * 1024
|
|
131057
132182
|
}).toString("utf-8");
|
|
@@ -131088,7 +132213,7 @@ To inspect: /tasks (text) or the interactive Background tasks dialog (focus the
|
|
|
131088
132213
|
const child = childProcess.execFile(
|
|
131089
132214
|
notesCommand.command,
|
|
131090
132215
|
notesCommand.args,
|
|
131091
|
-
{ cwd, timeout: 5e3 },
|
|
132216
|
+
{ cwd, timeout: 5e3, windowsHide: true },
|
|
131092
132217
|
(error, stdout, stderr) => {
|
|
131093
132218
|
const merged = (stdout || "") + (stderr || "");
|
|
131094
132219
|
if (error) {
|
|
@@ -137534,14 +138659,6 @@ __name(loadForkProfile, "loadForkProfile");
|
|
|
137534
138659
|
|
|
137535
138660
|
// packages/core/src/tools/agent/agent.ts
|
|
137536
138661
|
init_esm();
|
|
137537
|
-
var gitBranchCache = /* @__PURE__ */ new Map();
|
|
137538
|
-
function getCachedGitBranch(cwd) {
|
|
137539
|
-
if (gitBranchCache.has(cwd)) return gitBranchCache.get(cwd);
|
|
137540
|
-
const branch = getGitBranch(cwd);
|
|
137541
|
-
gitBranchCache.set(cwd, branch);
|
|
137542
|
-
return branch;
|
|
137543
|
-
}
|
|
137544
|
-
__name(getCachedGitBranch, "getCachedGitBranch");
|
|
137545
138662
|
function persistBackgroundCancellation2(metaPath, persistedStatus) {
|
|
137546
138663
|
patchAgentMeta(metaPath, {
|
|
137547
138664
|
status: persistedStatus,
|
|
@@ -139441,17 +140558,21 @@ ${taskPrompt}`;
|
|
|
139441
140558
|
const registry2 = this.config.getBackgroundTaskRegistry();
|
|
139442
140559
|
const projectDir = this.config.storage.getProjectDir();
|
|
139443
140560
|
const sessionId = this.config.getSessionId();
|
|
139444
|
-
const jsonlPath =
|
|
139445
|
-
|
|
139446
|
-
|
|
139447
|
-
|
|
139448
|
-
|
|
140561
|
+
const { jsonlPath, options: transcriptAttachOptions } = buildAgentTranscriptAttach(this.config, hookOpts.agentId, {
|
|
140562
|
+
agentName: subagentConfig.name,
|
|
140563
|
+
agentColor: subagentConfig.color,
|
|
140564
|
+
// Seed the JSONL with the launching prompt so the transcript is
|
|
140565
|
+
// self-describing — readers don't need to consult .meta.json to
|
|
140566
|
+
// know what the agent was asked to do.
|
|
140567
|
+
initialUserPrompt: this.params.prompt,
|
|
140568
|
+
bootstrapHistory: isFork ? bgInitialMessages : void 0,
|
|
140569
|
+
launchTaskPrompt: isFork ? bgTaskPrompt : void 0
|
|
140570
|
+
});
|
|
139449
140571
|
const metaPath = getAgentMetaPath(
|
|
139450
140572
|
projectDir,
|
|
139451
140573
|
sessionId,
|
|
139452
140574
|
hookOpts.agentId
|
|
139453
140575
|
);
|
|
139454
|
-
const projectRoot = this.config.getProjectRoot();
|
|
139455
140576
|
try {
|
|
139456
140577
|
const registerOptions = backgroundSlotReservation ? { slotReservation: backgroundSlotReservation } : {};
|
|
139457
140578
|
registry2.register(
|
|
@@ -139531,21 +140652,7 @@ ${taskPrompt}`;
|
|
|
139531
140652
|
const { cleanup: cleanupJsonl } = attachJsonlTranscriptWriter(
|
|
139532
140653
|
bgEventEmitter,
|
|
139533
140654
|
jsonlPath,
|
|
139534
|
-
|
|
139535
|
-
agentId: hookOpts.agentId,
|
|
139536
|
-
agentName: subagentConfig.name,
|
|
139537
|
-
agentColor: subagentConfig.color,
|
|
139538
|
-
sessionId,
|
|
139539
|
-
cwd: projectRoot,
|
|
139540
|
-
version: this.config.getCliVersion() || "unknown",
|
|
139541
|
-
gitBranch: getCachedGitBranch(projectRoot),
|
|
139542
|
-
// Seed the JSONL with the launching prompt so the transcript is
|
|
139543
|
-
// self-describing — readers don't need to consult .meta.json to
|
|
139544
|
-
// know what the agent was asked to do.
|
|
139545
|
-
initialUserPrompt: this.params.prompt,
|
|
139546
|
-
bootstrapHistory: isFork ? bgInitialMessages : void 0,
|
|
139547
|
-
launchTaskPrompt: isFork ? bgTaskPrompt : void 0
|
|
139548
|
-
}
|
|
140655
|
+
transcriptAttachOptions
|
|
139549
140656
|
);
|
|
139550
140657
|
writeAgentMeta(metaPath, {
|
|
139551
140658
|
agentId: hookOpts.agentId,
|
|
@@ -140029,17 +141136,19 @@ If asked, you can check progress before completion by using ${ToolNames.READ_FIL
|
|
|
140029
141136
|
const registry = this.config.getBackgroundTaskRegistry();
|
|
140030
141137
|
const fgProjectDir = this.config.storage.getProjectDir();
|
|
140031
141138
|
const fgSessionId = this.config.getSessionId();
|
|
140032
|
-
const fgJsonlPath =
|
|
140033
|
-
|
|
140034
|
-
|
|
140035
|
-
|
|
140036
|
-
|
|
141139
|
+
const { jsonlPath: fgJsonlPath, options: fgTranscriptAttachOptions } = buildAgentTranscriptAttach(this.config, hookOpts.agentId, {
|
|
141140
|
+
agentName: subagentConfig.name,
|
|
141141
|
+
agentColor: subagentConfig.color,
|
|
141142
|
+
// Seed the JSONL with the launching prompt so the transcript
|
|
141143
|
+
// is self-describing — readers don't need the meta sidecar to
|
|
141144
|
+
// know what the agent was asked to do.
|
|
141145
|
+
initialUserPrompt: this.params.prompt
|
|
141146
|
+
});
|
|
140037
141147
|
const fgMetaPath = getAgentMetaPath(
|
|
140038
141148
|
fgProjectDir,
|
|
140039
141149
|
fgSessionId,
|
|
140040
141150
|
hookOpts.agentId
|
|
140041
141151
|
);
|
|
140042
|
-
const fgProjectRoot = this.config.getProjectRoot();
|
|
140043
141152
|
let cleanupFgJsonl;
|
|
140044
141153
|
const cleanupOwnedMonitorNotifications = this.registerOwnedMonitorNotifications(
|
|
140045
141154
|
hookOpts.agentId,
|
|
@@ -140086,19 +141195,7 @@ If asked, you can check progress before completion by using ${ToolNames.READ_FIL
|
|
|
140086
141195
|
({ cleanup: cleanupFgJsonl } = attachJsonlTranscriptWriter(
|
|
140087
141196
|
this.eventEmitter,
|
|
140088
141197
|
fgJsonlPath,
|
|
140089
|
-
|
|
140090
|
-
agentId: hookOpts.agentId,
|
|
140091
|
-
agentName: subagentConfig.name,
|
|
140092
|
-
agentColor: subagentConfig.color,
|
|
140093
|
-
sessionId: fgSessionId,
|
|
140094
|
-
cwd: fgProjectRoot,
|
|
140095
|
-
version: this.config.getCliVersion() || "unknown",
|
|
140096
|
-
gitBranch: getCachedGitBranch(fgProjectRoot),
|
|
140097
|
-
// Seed the JSONL with the launching prompt so the transcript
|
|
140098
|
-
// is self-describing — readers don't need the meta sidecar to
|
|
140099
|
-
// know what the agent was asked to do.
|
|
140100
|
-
initialUserPrompt: this.params.prompt
|
|
140101
|
-
}
|
|
141198
|
+
fgTranscriptAttachOptions
|
|
140102
141199
|
));
|
|
140103
141200
|
registry.register({
|
|
140104
141201
|
agentId: hookOpts.agentId,
|
|
@@ -143112,7 +144209,32 @@ var GeminiClient = class _GeminiClient {
|
|
|
143112
144209
|
return;
|
|
143113
144210
|
}
|
|
143114
144211
|
const resumedSessionData = this.config.getResumedSessionData();
|
|
143115
|
-
|
|
144212
|
+
const restoreRuntime = this.config.getSessionRestoreRuntime?.();
|
|
144213
|
+
if (restoreRuntime) {
|
|
144214
|
+
uiTelemetryService.resetSession(sessionId);
|
|
144215
|
+
for (const event of restoreRuntime.uiTelemetryEvents) {
|
|
144216
|
+
uiTelemetryService.addEvent(event, sessionId);
|
|
144217
|
+
}
|
|
144218
|
+
this.seedRecentCompletedToolNamesFromHistory(restoreRuntime.apiHistory);
|
|
144219
|
+
await this.startChat(
|
|
144220
|
+
restoreRuntime.apiHistory,
|
|
144221
|
+
sessionStartSource ?? "resume" /* Resume */
|
|
144222
|
+
);
|
|
144223
|
+
const chat = this.getChat();
|
|
144224
|
+
if (restoreRuntime.resumeTokenCounts) {
|
|
144225
|
+
const counts = restoreRuntime.resumeTokenCounts;
|
|
144226
|
+
uiTelemetryService.setLastPromptTokenCount(counts.promptTokenCount);
|
|
144227
|
+
chat.seedResumeTokenCounts(
|
|
144228
|
+
counts.promptTokenCount,
|
|
144229
|
+
counts.outputTokenCount,
|
|
144230
|
+
counts.isEstimated
|
|
144231
|
+
);
|
|
144232
|
+
} else {
|
|
144233
|
+
chat.setLastPromptTokenCount(
|
|
144234
|
+
uiTelemetryService.getLastPromptTokenCount()
|
|
144235
|
+
);
|
|
144236
|
+
}
|
|
144237
|
+
} else if (resumedSessionData) {
|
|
143116
144238
|
const resumeTokenCounts = replayUiTelemetryFromConversation(
|
|
143117
144239
|
resumedSessionData.conversation,
|
|
143118
144240
|
this.config.getSessionId()
|
|
@@ -147289,6 +148411,12 @@ var Config = class _Config {
|
|
|
147289
148411
|
sessionSourceType;
|
|
147290
148412
|
sessionSourceId;
|
|
147291
148413
|
sessionData;
|
|
148414
|
+
pendingSessionRestoreProjection;
|
|
148415
|
+
sessionRestoreRuntime;
|
|
148416
|
+
sessionRestoreProjectionSource;
|
|
148417
|
+
restoredFileHistory = false;
|
|
148418
|
+
goalRestoreActivation;
|
|
148419
|
+
rejectGoalRestoreActivation;
|
|
147292
148420
|
sessionRuntimeBaseDir;
|
|
147293
148421
|
sessionProjectDirRegistered = false;
|
|
147294
148422
|
pendingSessionWriterLease;
|
|
@@ -147642,6 +148770,8 @@ var Config = class _Config {
|
|
|
147642
148770
|
sessionEnvClaimed = true;
|
|
147643
148771
|
}
|
|
147644
148772
|
this.sessionData = params.sessionData;
|
|
148773
|
+
this.sessionRestoreProjectionSource = params.sessionRestoreProjectionSource;
|
|
148774
|
+
this.setSessionRestoreProjection(params.sessionRestoreProjection);
|
|
147645
148775
|
setDebugLogSession(this);
|
|
147646
148776
|
this.debugLogger = createDebugLogger();
|
|
147647
148777
|
this.embeddingModel = params.embeddingModel ?? DEFAULT_QWEN_EMBEDDING_MODEL;
|
|
@@ -147910,7 +149040,12 @@ var Config = class _Config {
|
|
|
147910
149040
|
}
|
|
147911
149041
|
this.geminiClient = new GeminiClient(this);
|
|
147912
149042
|
this.chatRecordingService = this.chatRecordingEnabled ? this.createChatRecordingService() : void 0;
|
|
147913
|
-
this.
|
|
149043
|
+
if (!this.sessionRestoreProjectionSource || this.sessionRestoreRuntime || !this.sessionWriterLeaseEnabled) {
|
|
149044
|
+
this.initializeGoalRuntime(
|
|
149045
|
+
this.sessionRestoreRuntime?.goalRecords ?? this.sessionData?.conversation.messages,
|
|
149046
|
+
this.sessionRestoreRuntime
|
|
149047
|
+
);
|
|
149048
|
+
}
|
|
147914
149049
|
this.extensionManager = new ExtensionManager({
|
|
147915
149050
|
workspaceDir: this.targetDir,
|
|
147916
149051
|
enabledExtensionOverrides: this.overrideExtensions,
|
|
@@ -147978,6 +149113,7 @@ var Config = class _Config {
|
|
|
147978
149113
|
this.sessionProjectDirRegistered = true;
|
|
147979
149114
|
await this.initializeInternal(options2);
|
|
147980
149115
|
} catch (error) {
|
|
149116
|
+
this.clearSessionRestoreProjection();
|
|
147981
149117
|
if (this.sessionProjectDirRegistered) {
|
|
147982
149118
|
unregisterSessionProjectDir(this.sessionId);
|
|
147983
149119
|
this.sessionProjectDirRegistered = false;
|
|
@@ -148387,7 +149523,15 @@ var Config = class _Config {
|
|
|
148387
149523
|
throw new SessionTranscriptChangedError();
|
|
148388
149524
|
}
|
|
148389
149525
|
let authoritative;
|
|
148390
|
-
|
|
149526
|
+
let projection;
|
|
149527
|
+
if (this.sessionRestoreProjectionSource) {
|
|
149528
|
+
addDaemonRequestAttribute(
|
|
149529
|
+
"qwen-code.daemon.session_restore.projection_acquisition",
|
|
149530
|
+
"after_writer_lease"
|
|
149531
|
+
);
|
|
149532
|
+
projection = await this.sessionRestoreProjectionSource();
|
|
149533
|
+
this.setSessionRestoreProjection(projection);
|
|
149534
|
+
} else if (this.sessionData || lease.transcriptExistedAtAcquire) {
|
|
148391
149535
|
authoritative = await this.getSessionService().loadSession(
|
|
148392
149536
|
this.sessionId
|
|
148393
149537
|
);
|
|
@@ -148401,7 +149545,18 @@ var Config = class _Config {
|
|
|
148401
149545
|
throw new SessionWriterShutdownError();
|
|
148402
149546
|
}
|
|
148403
149547
|
this.sessionData = authoritative;
|
|
148404
|
-
recorder.activate(
|
|
149548
|
+
recorder.activate(
|
|
149549
|
+
lease,
|
|
149550
|
+
authoritative,
|
|
149551
|
+
persistedTitleInfo,
|
|
149552
|
+
projection?.runtime.recording
|
|
149553
|
+
);
|
|
149554
|
+
if (this.sessionRestoreProjectionSource) {
|
|
149555
|
+
this.initializeGoalRuntime(
|
|
149556
|
+
projection?.runtime.goalRecords,
|
|
149557
|
+
projection?.runtime
|
|
149558
|
+
);
|
|
149559
|
+
}
|
|
148405
149560
|
this.pendingSessionWriterLease = void 0;
|
|
148406
149561
|
lease = void 0;
|
|
148407
149562
|
this.startPendingGoalRestore();
|
|
@@ -148799,6 +149954,68 @@ var Config = class _Config {
|
|
|
148799
149954
|
getSessionId() {
|
|
148800
149955
|
return this.sessionId;
|
|
148801
149956
|
}
|
|
149957
|
+
getSessionRestoreRuntime() {
|
|
149958
|
+
return this.sessionRestoreRuntime;
|
|
149959
|
+
}
|
|
149960
|
+
consumeSessionRestoreProjection() {
|
|
149961
|
+
const projection = this.pendingSessionRestoreProjection;
|
|
149962
|
+
this.pendingSessionRestoreProjection = void 0;
|
|
149963
|
+
return projection;
|
|
149964
|
+
}
|
|
149965
|
+
hydrateSessionRestoreFileHistory() {
|
|
149966
|
+
if (this.restoredFileHistory) return;
|
|
149967
|
+
const snapshots = this.sessionRestoreRuntime?.fileHistorySnapshots;
|
|
149968
|
+
if (!snapshots?.length) return;
|
|
149969
|
+
const service = this.getFileHistoryService();
|
|
149970
|
+
if (!service.isEnabled()) return;
|
|
149971
|
+
service.restoreFromSnapshots(snapshots);
|
|
149972
|
+
this.restoredFileHistory = true;
|
|
149973
|
+
}
|
|
149974
|
+
finalizeSessionRestore() {
|
|
149975
|
+
const runtime = this.sessionRestoreRuntime;
|
|
149976
|
+
if (!runtime) return;
|
|
149977
|
+
this.sessionRestoreRuntime = void 0;
|
|
149978
|
+
if (runtime.attributionSnapshot) {
|
|
149979
|
+
try {
|
|
149980
|
+
CommitAttributionService.getInstance().restoreFromSnapshot(
|
|
149981
|
+
runtime.attributionSnapshot
|
|
149982
|
+
);
|
|
149983
|
+
} catch (error) {
|
|
149984
|
+
this.debugLogger.error(
|
|
149985
|
+
`Session restore attribution activation failed: ${error}`
|
|
149986
|
+
);
|
|
149987
|
+
}
|
|
149988
|
+
}
|
|
149989
|
+
const activateGoal = this.goalRestoreActivation;
|
|
149990
|
+
this.goalRestoreActivation = void 0;
|
|
149991
|
+
this.rejectGoalRestoreActivation = void 0;
|
|
149992
|
+
if (activateGoal) {
|
|
149993
|
+
try {
|
|
149994
|
+
void activateGoal().catch((error) => {
|
|
149995
|
+
this.debugLogger.error(
|
|
149996
|
+
`Session restore goal activation failed: ${error}`
|
|
149997
|
+
);
|
|
149998
|
+
});
|
|
149999
|
+
} catch (error) {
|
|
150000
|
+
this.debugLogger.error(
|
|
150001
|
+
`Session restore goal activation failed: ${error}`
|
|
150002
|
+
);
|
|
150003
|
+
}
|
|
150004
|
+
}
|
|
150005
|
+
if (this.restoredFileHistory && this.fileHistoryService) {
|
|
150006
|
+
try {
|
|
150007
|
+
void this.fileHistoryService.validateRestoredSnapshots().catch((error) => {
|
|
150008
|
+
this.debugLogger.error(
|
|
150009
|
+
`FileHistory: validateRestoredSnapshots failed: ${error}`
|
|
150010
|
+
);
|
|
150011
|
+
});
|
|
150012
|
+
} catch (error) {
|
|
150013
|
+
this.debugLogger.error(
|
|
150014
|
+
`FileHistory: validateRestoredSnapshots failed: ${error}`
|
|
150015
|
+
);
|
|
150016
|
+
}
|
|
150017
|
+
}
|
|
150018
|
+
}
|
|
148802
150019
|
setSessionSource(sourceType, sourceId) {
|
|
148803
150020
|
this.sessionSourceType = sourceType;
|
|
148804
150021
|
this.sessionSourceId = sourceId;
|
|
@@ -148855,6 +150072,7 @@ var Config = class _Config {
|
|
|
148855
150072
|
unregisterSessionModel(previousSessionId);
|
|
148856
150073
|
this.publishModelEnv();
|
|
148857
150074
|
this.sessionData = sessionData;
|
|
150075
|
+
this.clearSessionRestoreProjection();
|
|
148858
150076
|
this.pendingRecoveredAgentsNotice = null;
|
|
148859
150077
|
this.getOwnActiveTodoReminders().clear();
|
|
148860
150078
|
this.getOwnActiveTodoWorkChainOwners().clear();
|
|
@@ -149775,12 +150993,18 @@ var Config = class _Config {
|
|
|
149775
150993
|
}
|
|
149776
150994
|
async shutdownResourcesOnce() {
|
|
149777
150995
|
try {
|
|
150996
|
+
this.clearSessionRestoreProjection();
|
|
149778
150997
|
if (this.sessionProjectDirRegistered) {
|
|
149779
150998
|
unregisterSessionProjectDir(this.sessionId);
|
|
149780
150999
|
this.sessionProjectDirRegistered = false;
|
|
149781
151000
|
}
|
|
149782
151001
|
unregisterSessionModel(this.sessionId);
|
|
149783
151002
|
if (Object.hasOwn(this, "goalRuntime")) {
|
|
151003
|
+
this.rejectGoalRestoreActivation?.(
|
|
151004
|
+
new GoalPersistenceUnavailableError("Goal runtime disposed")
|
|
151005
|
+
);
|
|
151006
|
+
this.goalRestoreActivation = void 0;
|
|
151007
|
+
this.rejectGoalRestoreActivation = void 0;
|
|
149784
151008
|
this.goalTurnHostUnbind?.();
|
|
149785
151009
|
this.goalTurnHostUnbind = void 0;
|
|
149786
151010
|
this.settlePendingGoalRestore(
|
|
@@ -151659,6 +152883,11 @@ var Config = class _Config {
|
|
|
151659
152883
|
}
|
|
151660
152884
|
return this.goalRuntimeReady.then(() => runtime);
|
|
151661
152885
|
}
|
|
152886
|
+
getGoalRuntimePrepared() {
|
|
152887
|
+
const runtime = this.getGoalRuntime();
|
|
152888
|
+
if (!this.sessionRestoreRuntime) return this.getGoalRuntimeReady();
|
|
152889
|
+
return runtime.getPreparedRestore().then(() => runtime);
|
|
152890
|
+
}
|
|
151662
152891
|
async rebaseGoalRuntimeFromActiveTranscript() {
|
|
151663
152892
|
const runtime = this.getGoalRuntime();
|
|
151664
152893
|
const recordingService = this.chatRecordingService;
|
|
@@ -151702,10 +152931,16 @@ var Config = class _Config {
|
|
|
151702
152931
|
(event) => {
|
|
151703
152932
|
this.notifyChatRecordingFailure(event);
|
|
151704
152933
|
},
|
|
151705
|
-
this.sessionWriterLeaseEnabled
|
|
152934
|
+
this.sessionWriterLeaseEnabled,
|
|
152935
|
+
this.sessionRestoreRuntime?.recording
|
|
151706
152936
|
);
|
|
151707
152937
|
}
|
|
151708
|
-
initializeGoalRuntime(records) {
|
|
152938
|
+
initializeGoalRuntime(records, restoreRuntime) {
|
|
152939
|
+
this.rejectGoalRestoreActivation?.(
|
|
152940
|
+
new GoalPersistenceUnavailableError("Goal runtime replaced")
|
|
152941
|
+
);
|
|
152942
|
+
this.goalRestoreActivation = void 0;
|
|
152943
|
+
this.rejectGoalRestoreActivation = void 0;
|
|
151709
152944
|
this.goalTurnHostUnbind?.();
|
|
151710
152945
|
this.goalTurnHostUnbind = void 0;
|
|
151711
152946
|
this.settlePendingGoalRestore(
|
|
@@ -151729,7 +152964,27 @@ var Config = class _Config {
|
|
|
151729
152964
|
if (this.goalTurnHost) {
|
|
151730
152965
|
this.goalTurnHostUnbind = runtime.bindHost(this.goalTurnHost);
|
|
151731
152966
|
}
|
|
151732
|
-
if (
|
|
152967
|
+
if (restoreRuntime) {
|
|
152968
|
+
const preparation = runtime.prepareRestore(
|
|
152969
|
+
records ?? [],
|
|
152970
|
+
restoreRuntime.goalCheckpointWindow
|
|
152971
|
+
);
|
|
152972
|
+
let resolveActivation;
|
|
152973
|
+
let rejectActivation;
|
|
152974
|
+
const activation = new Promise((resolve41, reject) => {
|
|
152975
|
+
resolveActivation = resolve41;
|
|
152976
|
+
rejectActivation = reject;
|
|
152977
|
+
});
|
|
152978
|
+
this.rejectGoalRestoreActivation = rejectActivation;
|
|
152979
|
+
this.goalRestoreActivation = () => {
|
|
152980
|
+
const started = runtime.activateRestoredWork();
|
|
152981
|
+
void started.then(resolveActivation, rejectActivation);
|
|
152982
|
+
return started;
|
|
152983
|
+
};
|
|
152984
|
+
this.goalRuntimeReady = Promise.all([preparation, activation]).then(
|
|
152985
|
+
() => runtime
|
|
152986
|
+
);
|
|
152987
|
+
} else if (this.sessionWriterLeaseEnabled && !recorder.hasWriteOwnership()) {
|
|
151733
152988
|
const ready = new Promise((resolve41, reject) => {
|
|
151734
152989
|
this.pendingGoalRestore = { runtime, resolve: resolve41, reject };
|
|
151735
152990
|
});
|
|
@@ -151777,6 +153032,21 @@ var Config = class _Config {
|
|
|
151777
153032
|
this.pendingGoalRestore = void 0;
|
|
151778
153033
|
pending.reject(error);
|
|
151779
153034
|
}
|
|
153035
|
+
setSessionRestoreProjection(projection) {
|
|
153036
|
+
this.pendingSessionRestoreProjection = projection;
|
|
153037
|
+
this.sessionRestoreRuntime = projection?.runtime;
|
|
153038
|
+
this.restoredFileHistory = false;
|
|
153039
|
+
}
|
|
153040
|
+
clearSessionRestoreProjection() {
|
|
153041
|
+
this.pendingSessionRestoreProjection = void 0;
|
|
153042
|
+
this.sessionRestoreRuntime = void 0;
|
|
153043
|
+
this.restoredFileHistory = false;
|
|
153044
|
+
this.rejectGoalRestoreActivation?.(
|
|
153045
|
+
new GoalPersistenceUnavailableError("Session restore was abandoned")
|
|
153046
|
+
);
|
|
153047
|
+
this.goalRestoreActivation = void 0;
|
|
153048
|
+
this.rejectGoalRestoreActivation = void 0;
|
|
153049
|
+
}
|
|
151780
153050
|
notifyChatRecordingFailure(event) {
|
|
151781
153051
|
for (const listener of [...this.chatRecordingFailureListeners]) {
|
|
151782
153052
|
try {
|
|
@@ -152100,7 +153370,7 @@ var Config = class _Config {
|
|
|
152100
153370
|
}
|
|
152101
153371
|
if (!enabled) return;
|
|
152102
153372
|
registry.registerFactory(ToolNames.IMAGE_GEN, async () => {
|
|
152103
|
-
const { ImageGenTool } = await import("./image-gen-
|
|
153373
|
+
const { ImageGenTool } = await import("./image-gen-HGURQAHX.js");
|
|
152104
153374
|
return new ImageGenTool(this);
|
|
152105
153375
|
});
|
|
152106
153376
|
}
|
|
@@ -152130,36 +153400,36 @@ var Config = class _Config {
|
|
|
152130
153400
|
if (options2?.forSubAgent) return;
|
|
152131
153401
|
const schema = this.jsonSchema;
|
|
152132
153402
|
await registerLazy(ToolNames.STRUCTURED_OUTPUT, async () => {
|
|
152133
|
-
const { SyntheticOutputTool } = await import("./syntheticOutput-
|
|
153403
|
+
const { SyntheticOutputTool } = await import("./syntheticOutput-SEW4NA47.js");
|
|
152134
153404
|
return new SyntheticOutputTool(schema);
|
|
152135
153405
|
});
|
|
152136
153406
|
}, "registerStructuredOutputIfRequested");
|
|
152137
153407
|
const registerGoalWorkerTools = /* @__PURE__ */ __name(async () => {
|
|
152138
153408
|
if (options2?.forSubAgent) return;
|
|
152139
153409
|
await registerLazy(ToolNames.GET_GOAL, async () => {
|
|
152140
|
-
const { GetGoalTool } = await import("./goal-tools-
|
|
153410
|
+
const { GetGoalTool } = await import("./goal-tools-LQFO4BRY.js");
|
|
152141
153411
|
return new GetGoalTool(this);
|
|
152142
153412
|
});
|
|
152143
153413
|
await registerLazy(ToolNames.UPDATE_GOAL, async () => {
|
|
152144
|
-
const { UpdateGoalTool } = await import("./goal-tools-
|
|
153414
|
+
const { UpdateGoalTool } = await import("./goal-tools-LQFO4BRY.js");
|
|
152145
153415
|
return new UpdateGoalTool(this);
|
|
152146
153416
|
});
|
|
152147
153417
|
}, "registerGoalWorkerTools");
|
|
152148
153418
|
if (this.getBareMode()) {
|
|
152149
153419
|
await registerLazy(ToolNames.READ_FILE, async () => {
|
|
152150
|
-
const { ReadFileTool } = await import("./read-file-
|
|
153420
|
+
const { ReadFileTool } = await import("./read-file-2V5GE6ZW.js");
|
|
152151
153421
|
return new ReadFileTool(this);
|
|
152152
153422
|
});
|
|
152153
153423
|
await registerLazy(ToolNames.EDIT, async () => {
|
|
152154
|
-
const { EditTool } = await import("./edit-
|
|
153424
|
+
const { EditTool } = await import("./edit-CZ23AVP6.js");
|
|
152155
153425
|
return new EditTool(this);
|
|
152156
153426
|
});
|
|
152157
153427
|
await registerLazy(ToolNames.NOTEBOOK_EDIT, async () => {
|
|
152158
|
-
const { NotebookEditTool } = await import("./notebook-edit-
|
|
153428
|
+
const { NotebookEditTool } = await import("./notebook-edit-QPYSWPRI.js");
|
|
152159
153429
|
return new NotebookEditTool(this);
|
|
152160
153430
|
});
|
|
152161
153431
|
await registerLazy(ToolNames.SHELL, async () => {
|
|
152162
|
-
const { ShellTool: ShellTool2 } = await import("./shell-
|
|
153432
|
+
const { ShellTool: ShellTool2 } = await import("./shell-JDSWGVC7.js");
|
|
152163
153433
|
return new ShellTool2(this);
|
|
152164
153434
|
});
|
|
152165
153435
|
await registerGoalWorkerTools();
|
|
@@ -152171,43 +153441,43 @@ var Config = class _Config {
|
|
|
152171
153441
|
}
|
|
152172
153442
|
await registerGoalWorkerTools();
|
|
152173
153443
|
await registerLazy(ToolNames.TOOL_SEARCH, async () => {
|
|
152174
|
-
const { ToolSearchTool } = await import("./tool-search-
|
|
153444
|
+
const { ToolSearchTool } = await import("./tool-search-SZRO5G72.js");
|
|
152175
153445
|
return new ToolSearchTool(this);
|
|
152176
153446
|
});
|
|
152177
153447
|
await registerLazy(ToolNames.READ_MCP_RESOURCE, async () => {
|
|
152178
|
-
const { ReadMcpResourceTool } = await import("./read-mcp-resource-
|
|
153448
|
+
const { ReadMcpResourceTool } = await import("./read-mcp-resource-THCSZHXO.js");
|
|
152179
153449
|
return new ReadMcpResourceTool(this);
|
|
152180
153450
|
});
|
|
152181
153451
|
await registerLazy(ToolNames.AGENT, async () => {
|
|
152182
|
-
const { AgentTool: AgentTool2 } = await import("./agent-
|
|
153452
|
+
const { AgentTool: AgentTool2 } = await import("./agent-4AGYD6I6.js");
|
|
152183
153453
|
return new AgentTool2(this);
|
|
152184
153454
|
});
|
|
152185
153455
|
await registerLazy(ToolNames.LIST_AGENTS, async () => {
|
|
152186
|
-
const { ListAgentsTool } = await import("./list-agents-
|
|
153456
|
+
const { ListAgentsTool } = await import("./list-agents-5PNMK2AM.js");
|
|
152187
153457
|
return new ListAgentsTool(this);
|
|
152188
153458
|
});
|
|
152189
153459
|
await registerLazy(ToolNames.TASK_STOP, async () => {
|
|
152190
|
-
const { TaskStopTool } = await import("./task-stop-
|
|
153460
|
+
const { TaskStopTool } = await import("./task-stop-MAYQJ42I.js");
|
|
152191
153461
|
return new TaskStopTool(this);
|
|
152192
153462
|
});
|
|
152193
153463
|
await registerLazy(ToolNames.SEND_MESSAGE, async () => {
|
|
152194
|
-
const { SendMessageTool } = await import("./send-message-
|
|
153464
|
+
const { SendMessageTool } = await import("./send-message-P5SLP57G.js");
|
|
152195
153465
|
return new SendMessageTool(this);
|
|
152196
153466
|
});
|
|
152197
153467
|
await registerLazy(ToolNames.SKILL, async () => {
|
|
152198
|
-
const { SkillTool } = await import("./skill-
|
|
153468
|
+
const { SkillTool } = await import("./skill-QILHTMYJ.js");
|
|
152199
153469
|
return new SkillTool(this);
|
|
152200
153470
|
});
|
|
152201
153471
|
await registerLazy(ToolNames.LS, async () => {
|
|
152202
|
-
const { LSTool } = await import("./ls-
|
|
153472
|
+
const { LSTool } = await import("./ls-RPRSX26R.js");
|
|
152203
153473
|
return new LSTool(this);
|
|
152204
153474
|
});
|
|
152205
153475
|
await registerLazy(ToolNames.READ_FILE, async () => {
|
|
152206
|
-
const { ReadFileTool } = await import("./read-file-
|
|
153476
|
+
const { ReadFileTool } = await import("./read-file-2V5GE6ZW.js");
|
|
152207
153477
|
return new ReadFileTool(this);
|
|
152208
153478
|
});
|
|
152209
153479
|
await registerLazy(ToolNames.ZOOM_IMAGE, async () => {
|
|
152210
|
-
const { ZoomImageTool } = await import("./zoom-image-
|
|
153480
|
+
const { ZoomImageTool } = await import("./zoom-image-4QTKAMTP.js");
|
|
152211
153481
|
return new ZoomImageTool(this);
|
|
152212
153482
|
});
|
|
152213
153483
|
if (this.getUseRipgrep()) {
|
|
@@ -152222,7 +153492,7 @@ var Config = class _Config {
|
|
|
152222
153492
|
recordStartupEvent("config_initialize_ripgrep_probe_end");
|
|
152223
153493
|
if (useRipgrep) {
|
|
152224
153494
|
await registerLazy(ToolNames.GREP, async () => {
|
|
152225
|
-
const { RipGrepTool: RipGrepTool2 } = await import("./ripGrep-
|
|
153495
|
+
const { RipGrepTool: RipGrepTool2 } = await import("./ripGrep-MUTMPQSV.js");
|
|
152226
153496
|
return new RipGrepTool2(this);
|
|
152227
153497
|
});
|
|
152228
153498
|
} else {
|
|
@@ -152235,7 +153505,7 @@ var Config = class _Config {
|
|
|
152235
153505
|
)
|
|
152236
153506
|
);
|
|
152237
153507
|
await registerLazy(ToolNames.GREP, async () => {
|
|
152238
|
-
const { GrepTool } = await import("./grep-
|
|
153508
|
+
const { GrepTool } = await import("./grep-KYBZMY36.js");
|
|
152239
153509
|
return new GrepTool(this);
|
|
152240
153510
|
});
|
|
152241
153511
|
}
|
|
@@ -152243,77 +153513,77 @@ var Config = class _Config {
|
|
|
152243
153513
|
recordStartupEvent("config_initialize_ripgrep_probe_start");
|
|
152244
153514
|
recordStartupEvent("config_initialize_ripgrep_probe_end");
|
|
152245
153515
|
await registerLazy(ToolNames.GREP, async () => {
|
|
152246
|
-
const { GrepTool } = await import("./grep-
|
|
153516
|
+
const { GrepTool } = await import("./grep-KYBZMY36.js");
|
|
152247
153517
|
return new GrepTool(this);
|
|
152248
153518
|
});
|
|
152249
153519
|
}
|
|
152250
153520
|
await registerLazy(ToolNames.GLOB, async () => {
|
|
152251
|
-
const { GlobTool } = await import("./glob-
|
|
153521
|
+
const { GlobTool } = await import("./glob-LA5XO2H7.js");
|
|
152252
153522
|
return new GlobTool(this);
|
|
152253
153523
|
});
|
|
152254
153524
|
await registerLazy(ToolNames.EDIT, async () => {
|
|
152255
|
-
const { EditTool } = await import("./edit-
|
|
153525
|
+
const { EditTool } = await import("./edit-CZ23AVP6.js");
|
|
152256
153526
|
return new EditTool(this);
|
|
152257
153527
|
});
|
|
152258
153528
|
await registerLazy(ToolNames.NOTEBOOK_EDIT, async () => {
|
|
152259
|
-
const { NotebookEditTool } = await import("./notebook-edit-
|
|
153529
|
+
const { NotebookEditTool } = await import("./notebook-edit-QPYSWPRI.js");
|
|
152260
153530
|
return new NotebookEditTool(this);
|
|
152261
153531
|
});
|
|
152262
153532
|
await registerLazy(ToolNames.WRITE_FILE, async () => {
|
|
152263
|
-
const { WriteFileTool: WriteFileTool2 } = await import("./write-file-
|
|
153533
|
+
const { WriteFileTool: WriteFileTool2 } = await import("./write-file-UBIHUP5M.js");
|
|
152264
153534
|
return new WriteFileTool2(this);
|
|
152265
153535
|
});
|
|
152266
153536
|
await registerLazy(ToolNames.SHELL, async () => {
|
|
152267
|
-
const { ShellTool: ShellTool2 } = await import("./shell-
|
|
153537
|
+
const { ShellTool: ShellTool2 } = await import("./shell-JDSWGVC7.js");
|
|
152268
153538
|
return new ShellTool2(this);
|
|
152269
153539
|
});
|
|
152270
153540
|
await registerLazy(ToolNames.TODO_WRITE, async () => {
|
|
152271
|
-
const { TodoWriteTool } = await import("./todoWrite-
|
|
153541
|
+
const { TodoWriteTool } = await import("./todoWrite-IE2YTCK7.js");
|
|
152272
153542
|
return new TodoWriteTool(this);
|
|
152273
153543
|
});
|
|
152274
153544
|
const supportsUserInteraction = resolveInteractionMode(this) !== "headless";
|
|
152275
153545
|
if (supportsUserInteraction) {
|
|
152276
153546
|
await registerLazy(ToolNames.ASK_USER_QUESTION, async () => {
|
|
152277
|
-
const { AskUserQuestionTool } = await import("./askUserQuestion-
|
|
153547
|
+
const { AskUserQuestionTool } = await import("./askUserQuestion-IQCA2SOX.js");
|
|
152278
153548
|
return new AskUserQuestionTool(this);
|
|
152279
153549
|
});
|
|
152280
153550
|
}
|
|
152281
153551
|
if (!this.sdkMode && (supportsUserInteraction || options2?.forSubAgent)) {
|
|
152282
153552
|
await registerLazy(ToolNames.EXIT_PLAN_MODE, async () => {
|
|
152283
|
-
const { ExitPlanModeTool: ExitPlanModeTool2 } = await import("./exitPlanMode-
|
|
153553
|
+
const { ExitPlanModeTool: ExitPlanModeTool2 } = await import("./exitPlanMode-4JH6WLKL.js");
|
|
152284
153554
|
return new ExitPlanModeTool2(this);
|
|
152285
153555
|
});
|
|
152286
153556
|
}
|
|
152287
153557
|
if (!this.sdkMode && supportsUserInteraction) {
|
|
152288
153558
|
await registerLazy(ToolNames.ENTER_PLAN_MODE, async () => {
|
|
152289
|
-
const { EnterPlanModeTool } = await import("./enterPlanMode-
|
|
153559
|
+
const { EnterPlanModeTool } = await import("./enterPlanMode-TS6KO6DU.js");
|
|
152290
153560
|
return new EnterPlanModeTool(this);
|
|
152291
153561
|
});
|
|
152292
153562
|
}
|
|
152293
153563
|
await registerLazy(ToolNames.ENTER_WORKTREE, async () => {
|
|
152294
|
-
const { EnterWorktreeTool } = await import("./enter-worktree-
|
|
153564
|
+
const { EnterWorktreeTool } = await import("./enter-worktree-4EMS7IRL.js");
|
|
152295
153565
|
return new EnterWorktreeTool(this);
|
|
152296
153566
|
});
|
|
152297
153567
|
await registerLazy(ToolNames.EXIT_WORKTREE, async () => {
|
|
152298
|
-
const { ExitWorktreeTool } = await import("./exit-worktree-
|
|
153568
|
+
const { ExitWorktreeTool } = await import("./exit-worktree-Q3NFHYUI.js");
|
|
152299
153569
|
return new ExitWorktreeTool(this);
|
|
152300
153570
|
});
|
|
152301
153571
|
await registerLazy(ToolNames.WEB_FETCH, async () => {
|
|
152302
|
-
const { WebFetchTool } = await import("./web-fetch-
|
|
153572
|
+
const { WebFetchTool } = await import("./web-fetch-LKC2F5DM.js");
|
|
152303
153573
|
return new WebFetchTool(this);
|
|
152304
153574
|
});
|
|
152305
153575
|
if (resolveInteractionMode(this) === "interactive" && !this.sdkMode && !this.getScreenReader() && !options2?.forSubAgent) {
|
|
152306
153576
|
await registerLazy(ToolNames.DISPLAY_IMAGE, async () => {
|
|
152307
|
-
const { DisplayImageTool } = await import("./display-image-
|
|
153577
|
+
const { DisplayImageTool } = await import("./display-image-CAD7RAUM.js");
|
|
152308
153578
|
return new DisplayImageTool(this);
|
|
152309
153579
|
});
|
|
152310
153580
|
}
|
|
152311
153581
|
if (this.webSearchSettings?.enabled) {
|
|
152312
|
-
const { evaluateWebSearchGate } = await import("./web-search-
|
|
153582
|
+
const { evaluateWebSearchGate } = await import("./web-search-BHMAMXEU.js");
|
|
152313
153583
|
const gate = evaluateWebSearchGate(this);
|
|
152314
153584
|
if (gate.ok) {
|
|
152315
153585
|
await registerLazy(ToolNames.WEB_SEARCH, async () => {
|
|
152316
|
-
const { WebSearchTool } = await import("./web-search-
|
|
153586
|
+
const { WebSearchTool } = await import("./web-search-BHMAMXEU.js");
|
|
152317
153587
|
return new WebSearchTool(this);
|
|
152318
153588
|
});
|
|
152319
153589
|
} else if (!this.webSearchNoticeEmitted && !options2?.forSubAgent) {
|
|
@@ -152324,83 +153594,83 @@ var Config = class _Config {
|
|
|
152324
153594
|
await this.registerImageGenerationTool(registry);
|
|
152325
153595
|
if (this.isArtifactEnabled()) {
|
|
152326
153596
|
await registerLazy(ToolNames.ARTIFACT, async () => {
|
|
152327
|
-
const { ArtifactTool } = await import("./artifact-tool-
|
|
153597
|
+
const { ArtifactTool } = await import("./artifact-tool-RWJAKYBZ.js");
|
|
152328
153598
|
return new ArtifactTool(this);
|
|
152329
153599
|
});
|
|
152330
153600
|
}
|
|
152331
153601
|
if (this.isRecordArtifactEnabled()) {
|
|
152332
153602
|
await registerLazy(ToolNames.RECORD_ARTIFACT, async () => {
|
|
152333
|
-
const { RecordArtifactTool } = await import("./record-artifact-
|
|
153603
|
+
const { RecordArtifactTool } = await import("./record-artifact-76YYQA5F.js");
|
|
152334
153604
|
return new RecordArtifactTool();
|
|
152335
153605
|
});
|
|
152336
153606
|
}
|
|
152337
153607
|
if (this.isLspEnabled() && this.getLspClient()) {
|
|
152338
153608
|
await registerLazy(ToolNames.LSP, async () => {
|
|
152339
|
-
const { LspTool } = await import("./lsp-
|
|
153609
|
+
const { LspTool } = await import("./lsp-IWTJWFLT.js");
|
|
152340
153610
|
return new LspTool(this);
|
|
152341
153611
|
});
|
|
152342
153612
|
}
|
|
152343
153613
|
await registerStructuredOutputIfRequested();
|
|
152344
153614
|
if (this.isCronEnabled()) {
|
|
152345
153615
|
await registerLazy(ToolNames.CRON_CREATE, async () => {
|
|
152346
|
-
const { CronCreateTool } = await import("./cron-create-
|
|
153616
|
+
const { CronCreateTool } = await import("./cron-create-5WUTNKNF.js");
|
|
152347
153617
|
return new CronCreateTool(this);
|
|
152348
153618
|
});
|
|
152349
153619
|
await registerLazy(ToolNames.CRON_LIST, async () => {
|
|
152350
|
-
const { CronListTool } = await import("./cron-list-
|
|
153620
|
+
const { CronListTool } = await import("./cron-list-IXGCA7UR.js");
|
|
152351
153621
|
return new CronListTool(this);
|
|
152352
153622
|
});
|
|
152353
153623
|
await registerLazy(ToolNames.CRON_DELETE, async () => {
|
|
152354
|
-
const { CronDeleteTool } = await import("./cron-delete-
|
|
153624
|
+
const { CronDeleteTool } = await import("./cron-delete-JEQ27YPS.js");
|
|
152355
153625
|
return new CronDeleteTool(this);
|
|
152356
153626
|
});
|
|
152357
153627
|
await registerLazy(ToolNames.LOOP_WAKEUP, async () => {
|
|
152358
|
-
const { LoopWakeupTool } = await import("./loop-wakeup-
|
|
153628
|
+
const { LoopWakeupTool } = await import("./loop-wakeup-OV65FEGR.js");
|
|
152359
153629
|
return new LoopWakeupTool(this);
|
|
152360
153630
|
});
|
|
152361
153631
|
}
|
|
152362
153632
|
await registerLazy(ToolNames.CREATE_SUB_SESSION, async () => {
|
|
152363
|
-
const { CreateSubSessionTool } = await import("./create-sub-session-
|
|
153633
|
+
const { CreateSubSessionTool } = await import("./create-sub-session-23ULO5PO.js");
|
|
152364
153634
|
return new CreateSubSessionTool(this);
|
|
152365
153635
|
});
|
|
152366
153636
|
if (this.isAgentTeamEnabled()) {
|
|
152367
153637
|
await registerLazy(ToolNames.TEAM_CREATE, async () => {
|
|
152368
|
-
const { TeamCreateTool } = await import("./team-create-
|
|
153638
|
+
const { TeamCreateTool } = await import("./team-create-YMWUDIE3.js");
|
|
152369
153639
|
return new TeamCreateTool(this);
|
|
152370
153640
|
});
|
|
152371
153641
|
await registerLazy(ToolNames.TEAM_DELETE, async () => {
|
|
152372
|
-
const { TeamDeleteTool } = await import("./team-delete-
|
|
153642
|
+
const { TeamDeleteTool } = await import("./team-delete-3XVRPQBP.js");
|
|
152373
153643
|
return new TeamDeleteTool(this);
|
|
152374
153644
|
});
|
|
152375
153645
|
await registerLazy(ToolNames.TEAM_PLAN_APPROVAL, async () => {
|
|
152376
|
-
const { TeamPlanApprovalTool } = await import("./team-plan-approval-
|
|
153646
|
+
const { TeamPlanApprovalTool } = await import("./team-plan-approval-3GPZAW46.js");
|
|
152377
153647
|
return new TeamPlanApprovalTool(this);
|
|
152378
153648
|
});
|
|
152379
153649
|
await registerLazy(ToolNames.TASK_CREATE, async () => {
|
|
152380
|
-
const { TaskCreateTool } = await import("./task-create-
|
|
153650
|
+
const { TaskCreateTool } = await import("./task-create-247EAVF7.js");
|
|
152381
153651
|
return new TaskCreateTool(this);
|
|
152382
153652
|
});
|
|
152383
153653
|
await registerLazy(ToolNames.TASK_UPDATE, async () => {
|
|
152384
|
-
const { TaskUpdateTool } = await import("./task-update-
|
|
153654
|
+
const { TaskUpdateTool } = await import("./task-update-SU5TMZGG.js");
|
|
152385
153655
|
return new TaskUpdateTool(this);
|
|
152386
153656
|
});
|
|
152387
153657
|
await registerLazy(ToolNames.TASK_LIST, async () => {
|
|
152388
|
-
const { TaskListTool } = await import("./task-list-
|
|
153658
|
+
const { TaskListTool } = await import("./task-list-ZJN4QHLK.js");
|
|
152389
153659
|
return new TaskListTool(this);
|
|
152390
153660
|
});
|
|
152391
153661
|
}
|
|
152392
153662
|
if (this.isWorkflowsEnabled()) {
|
|
152393
153663
|
await registerLazy(ToolNames.WORKFLOW, async () => {
|
|
152394
|
-
const { WorkflowTool } = await import("./workflow-
|
|
153664
|
+
const { WorkflowTool } = await import("./workflow-A7AQ52HO.js");
|
|
152395
153665
|
return new WorkflowTool(this);
|
|
152396
153666
|
});
|
|
152397
153667
|
}
|
|
152398
153668
|
if (this.isComputerUseEnabled()) {
|
|
152399
|
-
const { registerComputerUseTools } = await import("./computer-use-
|
|
153669
|
+
const { registerComputerUseTools } = await import("./computer-use-ZFBJYSR3.js");
|
|
152400
153670
|
await registerComputerUseTools(registerLazy, this);
|
|
152401
153671
|
}
|
|
152402
153672
|
await registerLazy(ToolNames.MONITOR, async () => {
|
|
152403
|
-
const { MonitorTool } = await import("./monitor-
|
|
153673
|
+
const { MonitorTool } = await import("./monitor-SV64FNV3.js");
|
|
152404
153674
|
return new MonitorTool(this);
|
|
152405
153675
|
});
|
|
152406
153676
|
if (this.pendingMcpBudgetCallback) {
|
|
@@ -152871,6 +154141,7 @@ export {
|
|
|
152871
154141
|
GROUP_COLOR_OPTIONS,
|
|
152872
154142
|
SessionOrganizationError,
|
|
152873
154143
|
SessionOrganizationService,
|
|
154144
|
+
collectSessionTurnState,
|
|
152874
154145
|
SESSION_TRANSCRIPT_MAX_LIMIT,
|
|
152875
154146
|
SESSION_TRANSCRIPT_MAX_INDEX_BYTES,
|
|
152876
154147
|
SESSION_TRANSCRIPT_MAX_PAGE_BYTES,
|
|
@@ -152881,8 +154152,6 @@ export {
|
|
|
152881
154152
|
SessionTranscriptPageTooLargeError,
|
|
152882
154153
|
SessionTranscriptCursorCodec,
|
|
152883
154154
|
encodeSessionTranscriptCursor,
|
|
152884
|
-
isReplayTurnStartType,
|
|
152885
|
-
findBoundaryAtOrBefore,
|
|
152886
154155
|
SessionTranscriptReader,
|
|
152887
154156
|
SessionWriterError,
|
|
152888
154157
|
SESSION_WRITER_RPC_CODES,
|
|
@@ -152968,7 +154237,6 @@ export {
|
|
|
152968
154237
|
normalizeContent,
|
|
152969
154238
|
sanitizeChildEnv,
|
|
152970
154239
|
formatMemoryUsage,
|
|
152971
|
-
sessionIdContext,
|
|
152972
154240
|
getShellContextEnvVars,
|
|
152973
154241
|
getShellPagerEnv,
|
|
152974
154242
|
isSignalTermination,
|
|
@@ -153017,6 +154285,8 @@ export {
|
|
|
153017
154285
|
getSubagentsRootDir,
|
|
153018
154286
|
getSubagentSessionDir,
|
|
153019
154287
|
readAgentMeta,
|
|
154288
|
+
buildAgentTranscriptAttach,
|
|
154289
|
+
attachJsonlTranscriptWriter,
|
|
153020
154290
|
resolveSubagentApprovalMode,
|
|
153021
154291
|
TOOL_REGISTRY_REBUILT,
|
|
153022
154292
|
hasRebuiltToolRegistry,
|