@qwen-code/qwen-code 0.21.7 → 0.21.8
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/README.md +2 -0
- package/bundled/qc-helper/docs/configuration/settings.md +43 -30
- package/bundled/qc-helper/docs/features/channels/dingtalk.md +40 -2
- package/bundled/qc-helper/docs/features/channels/feishu.md +13 -2
- package/bundled/qc-helper/docs/features/channels/github.md +13 -11
- package/bundled/qc-helper/docs/features/channels/gitlab.md +13 -11
- package/bundled/qc-helper/docs/features/channels/overview.md +49 -31
- package/bundled/qc-helper/docs/features/channels/plugins.md +2 -2
- package/bundled/qc-helper/docs/features/channels/qqbot.md +4 -2
- package/bundled/qc-helper/docs/features/channels/telegram.md +4 -2
- package/bundled/qc-helper/docs/features/channels/wecom.md +1 -1
- package/bundled/qc-helper/docs/features/code-review.md +4 -0
- package/bundled/qc-helper/docs/features/commands.md +1 -1
- package/bundled/qc-helper/docs/features/hooks.md +52 -0
- package/bundled/qc-helper/docs/integration-jetbrains.md +1 -0
- package/bundled/qc-helper/docs/qwen-serve.md +4 -1
- package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +50 -36
- package/bundled/review/SKILL.md +28 -5
- package/chunks/{MaxSizedBox-ANWZBPTS.js → MaxSizedBox-7PM6BGJ5.js} +26 -22
- package/chunks/{StandaloneSessionPicker-XKS3VU3A.js → StandaloneSessionPicker-3UQHM7GV.js} +44 -40
- package/chunks/{acp-startup-profiler-ORIQ2CCQ.js → acp-startup-profiler-B5BYAMYQ.js} +2 -2
- package/chunks/{acpAgent-KUAZ3GCZ.js → acpAgent-5UWLFV6V.js} +534 -262
- package/chunks/{agent-T6PTGX5R.js → agent-624T2BLO.js} +26 -22
- package/chunks/{agent-headless-PR7YCB7S.js → agent-headless-2EE5J2KX.js} +26 -22
- package/chunks/{artifact-tool-U4VOZIK5.js → artifact-tool-N652YE4L.js} +1 -1
- package/chunks/{askUserQuestion-XOBQLPFA.js → askUserQuestion-ONW74PKJ.js} +1 -1
- package/chunks/{bridge-NU6YEEHK.js → bridge-JENKGFFP.js} +29 -25
- package/chunks/{ca-NYKNH222.js → ca-ZLKAB4K3.js} +6 -0
- package/chunks/{channel-management-service-FSQ7SHYI.js → channel-management-service-DDWUPHMU.js} +19 -10
- package/chunks/{channel-settings-store-35VQVUVV.js → channel-settings-store-SA6JZSPH.js} +34 -30
- package/chunks/{channel-worker-group-JWQK224X.js → channel-worker-group-E67EN3RV.js} +5 -5
- package/chunks/{channel-worker-manager-77E3OXRQ.js → channel-worker-manager-SW4C45CF.js} +5 -5
- package/chunks/{channel-worker-supervisor-62YWUGP2.js → channel-worker-supervisor-5SRD24FG.js} +3 -3
- package/chunks/{chunk-CJXIIILK.js → chunk-2FRY5CRX.js} +1 -1
- package/chunks/{chunk-ZJ3VGYHK.js → chunk-2ILAOM2I.js} +34 -17
- package/chunks/{chunk-6XJMFJ4D.js → chunk-2M4K4KYS.js} +177 -120
- package/chunks/{chunk-CNIID3TV.js → chunk-2UUMVNYT.js} +1 -1
- package/chunks/{chunk-22NBYCPD.js → chunk-3P2LV43B.js} +1 -1
- package/chunks/{chunk-2U3WZGZG.js → chunk-3PY4LPJF.js} +19 -131
- package/chunks/{chunk-SPMY6CX6.js → chunk-3SE7J4DR.js} +3 -3
- package/chunks/{chunk-6UWFTUQL.js → chunk-3WNQOYHQ.js} +66 -22
- package/chunks/{chunk-KXSDEOFU.js → chunk-4ALIARFY.js} +1 -1
- package/chunks/{chunk-D3UEZIQH.js → chunk-4DU3NCHG.js} +48 -55
- package/chunks/{chunk-BGG4MBYD.js → chunk-4PYCZH2V.js} +4 -187
- package/chunks/{chunk-H2UQ2M5Z.js → chunk-4WU6NY7F.js} +96 -22
- package/chunks/{chunk-TLV2IMHR.js → chunk-5ZGR6RKJ.js} +3 -3
- package/chunks/{chunk-3K7FH2KQ.js → chunk-67N6HB5H.js} +1310 -171
- package/chunks/{chunk-EORNAQDT.js → chunk-6TR7CFXH.js} +1 -1
- package/chunks/{chunk-NG2R4N5O.js → chunk-6ZRFAKXK.js} +1 -1
- package/chunks/{chunk-P2AJ7FTI.js → chunk-757GB46F.js} +1 -1
- package/chunks/{chunk-72LNFGUY.js → chunk-77QVBFCU.js} +3 -3
- package/chunks/{chunk-OH2VKQXH.js → chunk-7DVT4LVV.js} +37 -30
- package/chunks/{chunk-KKJJB5X6.js → chunk-7VUERJHS.js} +1503 -815
- package/chunks/{chunk-VOARQPTA.js → chunk-B52AWKBB.js} +65 -21
- package/chunks/{chunk-Y4EWSQF7.js → chunk-BF224XHL.js} +2 -2
- package/chunks/{chunk-PJOBIWUG.js → chunk-BF52U4XJ.js} +1 -1
- package/chunks/{chunk-55LYDVPU.js → chunk-C5VWPTGT.js} +1 -1
- package/chunks/{chunk-W7U4ESW2.js → chunk-CG3WBKJK.js} +1 -1
- package/chunks/chunk-COBO5EBO.js +135 -0
- package/chunks/chunk-CPG6P4GG.js +82 -0
- package/chunks/{chunk-DIEFUBV6.js → chunk-DIWZNWZT.js} +205 -35
- package/chunks/{chunk-AE77C5ZU.js → chunk-DQSDACD2.js} +1 -1
- package/chunks/{chunk-P3LEG54R.js → chunk-DX5W5AON.js} +2 -2
- package/chunks/{chunk-EUQTXRKZ.js → chunk-E4ZBKMSF.js} +5 -5
- package/chunks/{chunk-FPM27XN4.js → chunk-EIVICVHM.js} +4 -4
- package/chunks/{chunk-YHEEE624.js → chunk-EN2TKTFH.js} +1 -1
- package/chunks/chunk-F6WFNA7U.js +22 -0
- package/chunks/{chunk-FZBZSYKU.js → chunk-FN6YXJOP.js} +1 -1
- package/chunks/{chunk-KR4ZSC7K.js → chunk-FWBXMANW.js} +3 -3
- package/chunks/{chunk-LA7YLSR6.js → chunk-FYAXKJK7.js} +327 -67
- package/chunks/{chunk-CSZEXZBE.js → chunk-GBDINRIL.js} +3 -3
- package/chunks/{chunk-SCI7K3GM.js → chunk-GOEVOFQI.js} +19 -10
- package/chunks/{chunk-LEMXGVEP.js → chunk-GQCEQPYQ.js} +3 -3
- package/chunks/{chunk-Y7E5LNLO.js → chunk-GXSNGY5M.js} +1027 -876
- package/chunks/{chunk-6XU3PH66.js → chunk-HA3SAB64.js} +22 -69
- package/chunks/{chunk-Y4NGLFGJ.js → chunk-HUWENAHO.js} +1 -1
- package/chunks/{chunk-3ULCB3NE.js → chunk-HV76SFIA.js} +1 -1
- package/chunks/{chunk-CB2464BK.js → chunk-HWX5HPUG.js} +14 -4
- package/chunks/{chunk-LZC3B5N2.js → chunk-IA7TGCN2.js} +2 -2
- package/chunks/{chunk-RERATVSK.js → chunk-IBYULW65.js} +6 -6
- package/chunks/{chunk-HYRDKNUY.js → chunk-IUQ52YJK.js} +1 -1
- package/chunks/{chunk-TDXGKHDN.js → chunk-IYES5WOT.js} +2 -2
- package/chunks/{chunk-RGSBTHSU.js → chunk-KAQCJO6Y.js} +131 -4
- package/chunks/{chunk-VWOVHOTT.js → chunk-KJZ26VBX.js} +1 -1
- package/chunks/{chunk-6GONZVLS.js → chunk-KKDVZLGL.js} +1 -1
- package/chunks/{chunk-MKVZE4ZJ.js → chunk-KTJFU7RT.js} +3 -2
- package/chunks/{chunk-R574ATRM.js → chunk-M2PNLYGY.js} +41 -0
- package/chunks/{chunk-6EOI4HOK.js → chunk-M3STHEMM.js} +12 -17
- package/chunks/chunk-NGYI5EF5.js +244 -0
- package/chunks/{chunk-ALGGS7UH.js → chunk-NPQ5ZKRP.js} +82 -1
- package/chunks/{chunk-HQB2KUAN.js → chunk-NPUXXRJI.js} +1 -1
- package/chunks/{chunk-QETYKPMG.js → chunk-NVRDQFCX.js} +1 -1
- package/chunks/{chunk-PQBHU2IA.js → chunk-OHKJVAKG.js} +10 -10
- package/chunks/{chunk-CYR3HI5X.js → chunk-OQTXYMKW.js} +2 -2
- package/chunks/{chunk-DBOFL3LQ.js → chunk-PG62DFWD.js} +10 -10
- package/chunks/{chunk-2VSTGY6M.js → chunk-PJRW65JO.js} +1 -1
- package/chunks/{chunk-33ACCIIY.js → chunk-PLFATELK.js} +1 -1
- package/chunks/{chunk-IC4Z6LX6.js → chunk-PYQADEFD.js} +5 -0
- package/chunks/{chunk-MAJS7AT4.js → chunk-QGHSP65Z.js} +2 -2
- package/chunks/{chunk-OHJLEW5J.js → chunk-QQWD7LZV.js} +4 -4
- package/chunks/{chunk-ZXU5UHMI.js → chunk-QXVSWG66.js} +2 -2
- package/chunks/{chunk-E33LOKRA.js → chunk-RPWVIXDB.js} +18 -1
- package/chunks/{chunk-TYKC75AX.js → chunk-S3Y3GBFD.js} +1 -1
- package/chunks/{chunk-7UFKAV7Y.js → chunk-S6HYI3MF.js} +2 -2
- package/chunks/chunk-SAH4BD2J.js +92 -0
- package/chunks/{chunk-OMKQH5C5.js → chunk-SNRT2TJJ.js} +6 -23
- package/chunks/chunk-SR7RZ4MS.js +202 -0
- package/chunks/{chunk-CXE7E23H.js → chunk-TE3ZAJE7.js} +45 -17
- package/chunks/{chunk-S7CV4KO6.js → chunk-TKSZJ5BV.js} +3 -3
- package/chunks/{chunk-3NB7TSE2.js → chunk-U5SLIG7E.js} +1 -1
- package/chunks/chunk-UA5H3DS2.js +203 -0
- package/chunks/{chunk-24ER7UV4.js → chunk-UFALT4LK.js} +1 -1
- package/chunks/{chunk-YJQCUTT2.js → chunk-VWMUDKLC.js} +3 -3
- package/chunks/{chunk-RMH5OWLD.js → chunk-VXZ5HAOV.js} +1 -1
- package/chunks/{chunk-BVWVWGLE.js → chunk-WAUGQKUU.js} +4 -64
- package/chunks/{chunk-SHZYHGQH.js → chunk-WG6542MA.js} +1 -1
- package/chunks/{chunk-5KH532V7.js → chunk-WV5J6Q6N.js} +1 -1
- package/chunks/{chunk-RNVQB725.js → chunk-XHD7CRP2.js} +2 -2
- package/chunks/{chunk-W4B7UBUS.js → chunk-XZKQT2B2.js} +5 -5
- package/chunks/{chunk-6HVUFDS2.js → chunk-Y4TETC74.js} +22 -13
- package/chunks/{chunk-RZHU3ILK.js → chunk-YEF7XEO2.js} +4 -4
- package/chunks/{chunk-RUL4S3K3.js → chunk-YHJFF7KH.js} +146 -45
- package/chunks/{chunk-23RZCH76.js → chunk-YOM7DEGB.js} +3 -3
- package/chunks/{chunk-OFI7IGST.js → chunk-ZCLLJARV.js} +9 -9
- package/chunks/{chunk-GSS34377.js → chunk-ZHA242R4.js} +2 -2
- package/chunks/{chunk-TRLYP7OF.js → chunk-ZPLALRXZ.js} +17 -9
- package/chunks/{chunk-WUC6ZFXO.js → chunk-ZWBUH5UP.js} +1 -1
- package/chunks/{computer-use-KEAPATUY.js → computer-use-ESQYJ3JY.js} +26 -22
- package/chunks/{config-utils-K7SCOWHD.js → config-utils-XQHBJP7G.js} +4 -4
- package/chunks/{contextCommand-ZJA6A5K5.js → contextCommand-CX3YF4ZE.js} +28 -24
- package/chunks/{core-runtime-QMJPWHCI.js → core-runtime-DIAU7JMG.js} +30 -26
- package/chunks/{create-sub-session-DJE6XICH.js → create-sub-session-HDPD6HOA.js} +26 -22
- package/chunks/{create-sub-session-E4PBYXV5.js → create-sub-session-QIDZUOPU.js} +1 -1
- package/chunks/{cron-create-GRBWYMIJ.js → cron-create-VONA5JYY.js} +1 -1
- package/chunks/{cron-delete-4CMKBR2M.js → cron-delete-5JXSP2MI.js} +1 -1
- package/chunks/{cron-list-W7K4ASOA.js → cron-list-KE4F2CIR.js} +1 -1
- package/chunks/{daemon-SCTQMM7Z.js → daemon-VZBGJUNL.js} +30 -0
- package/chunks/{daemon-status-provider-FSWDPE2G.js → daemon-status-provider-H6O4UQ4F.js} +33 -29
- package/chunks/{daemon-trust-policy-P5L5VFAY.js → daemon-trust-policy-BNUXG6MT.js} +33 -29
- package/chunks/{daemon-trust-policy-monitor-73JYN6ET.js → daemon-trust-policy-monitor-E4EQ7GF4.js} +33 -29
- package/chunks/{de-VL76CPLV.js → de-LIW4XVLN.js} +5 -0
- package/chunks/{deferred-core-runtime-BWRCCFTE.js → deferred-core-runtime-CBMSHPAU.js} +26 -22
- package/chunks/{display-image-O2XFPQTC.js → display-image-NQRSIBXM.js} +2 -2
- package/chunks/{dist-DPPHJAVL.js → dist-EEEQGCZA.js} +918 -142
- package/chunks/{dist-K4WWQBHS.js → dist-HIACTZEK.js} +55 -15
- package/chunks/{dist-3BMEUGTG.js → dist-IRL7WA5Z.js} +1 -1
- package/chunks/{dist-HVBMEYWK.js → dist-KVISB2O2.js} +1 -1
- package/chunks/{dist-KS4O2NKE.js → dist-MBF3I5MX.js} +14 -8
- package/chunks/{dist-SFQ34F4M.js → dist-MKX5OSFF.js} +5 -4
- package/chunks/{dist-7JGAAQSC.js → dist-RCH3I7SS.js} +2 -2
- package/chunks/{dist-C5U4LJKW.js → dist-TUSWNE2I.js} +5 -4
- package/chunks/{earlyInputCapture-L5ST23A6.js → earlyInputCapture-UIOP7OIN.js} +26 -22
- package/chunks/{edit-LHHRFNFK.js → edit-ITMZYFKA.js} +26 -22
- package/chunks/{en-IRJ2WN5T.js → en-SY5GTIGX.js} +6 -0
- package/chunks/{enter-worktree-6NXCRZPF.js → enter-worktree-S4PL5UV6.js} +26 -22
- package/chunks/{enterPlanMode-ZVQT4U7D.js → enterPlanMode-YV52NNJT.js} +26 -22
- package/chunks/{environment-GJ2HWJOS.js → environment-NGOWPRZV.js} +30 -26
- package/chunks/{errors-6RLH3XXC.js → errors-BU26DTDX.js} +28 -24
- package/chunks/{exit-worktree-I2YLUHHY.js → exit-worktree-XRM6LH5F.js} +26 -22
- package/chunks/{exitPlanMode-7CCWKO7I.js → exitPlanMode-ZLI5F7KR.js} +26 -22
- package/chunks/{fast-path-DVFD4HQD.js → fast-path-UJWORIED.js} +23 -3
- package/chunks/{fast-path-settings-WQJU2LAT.js → fast-path-settings-37WQD5B2.js} +6 -3
- package/chunks/{fr-GK3HQYVB.js → fr-RQFO7U4P.js} +5 -0
- package/chunks/{gemini-7FWGOYD4.js → gemini-ZSKNDUMU.js} +77 -65
- package/chunks/{geminiContentGenerator-V2WVLIXU.js → geminiContentGenerator-YGEXOEKD.js} +1 -1
- package/chunks/{glob-3N6GGI75.js → glob-7KZG44BR.js} +26 -22
- package/chunks/{goal-tools-APOW6UXL.js → goal-tools-PXWN5VK3.js} +4 -2
- package/chunks/{grep-V43ILZVX.js → grep-6ZFC7RJ5.js} +26 -22
- package/chunks/{handleAutoUpdate-A5WFVWIA.js → handleAutoUpdate-KSEL3TQS.js} +30 -26
- package/chunks/{i18n-PLVQ4FBZ.js → i18n-ZIUXBW5V.js} +27 -23
- package/chunks/{image-gen-7C6IK6DC.js → image-gen-AUIZJJNK.js} +7 -5
- package/chunks/{initializer-CVAIKZYL.js → initializer-7AHY3N6Q.js} +33 -29
- package/chunks/{installationInfo-J6QDHNTK.js → installationInfo-VGBXMYLY.js} +27 -23
- package/chunks/{ja-3FA46IKD.js → ja-KOZKHJHZ.js} +5 -0
- package/chunks/{list-ZZ4OUUWV.js → list-PSFKQHLB.js} +36 -32
- package/chunks/{list-agents-KFFIIS2G.js → list-agents-Z4WABFDZ.js} +1 -1
- package/chunks/{loadedSettingsAdapter-QRYRJSWL.js → loadedSettingsAdapter-FTMRCTOF.js} +33 -29
- package/chunks/{loggingContentGenerator-OJCO75HM.js → loggingContentGenerator-MZAN52UV.js} +7 -5
- package/chunks/{loop-wakeup-TLMJPMMP.js → loop-wakeup-UZ5RL5Y2.js} +2 -2
- package/chunks/{ls-UVVE2XGE.js → ls-TVHDGIES.js} +1 -1
- package/chunks/{lsp-QMEA2VLB.js → lsp-CVN6OQPI.js} +1 -1
- package/chunks/{managed-npm-update-PCOSCP2N.js → managed-npm-update-O4NHK45X.js} +27 -23
- package/chunks/{mcp-M3WKKWKY.js → mcp-6CFP2AYQ.js} +33 -29
- package/chunks/{monitor-GN24FH6C.js → monitor-DAKD6OU4.js} +26 -22
- package/chunks/{nonInteractiveCli-KPTU3VSQ.js → nonInteractiveCli-RC7VIUZL.js} +66 -60
- package/chunks/{notebook-edit-4YM65BBO.js → notebook-edit-474DPMRL.js} +34 -22
- package/chunks/{openaiContentGenerator-EDQT6GTV.js → openaiContentGenerator-2NFY2MWO.js} +19 -9
- package/chunks/{pidfile-JOIIRN2C.js → pidfile-KBFVDNQP.js} +26 -22
- package/chunks/{process-registry-2CHQBXH5.js → process-registry-PMJOA5CO.js} +15 -0
- package/chunks/{processUtils-5SV4MX3Q.js → processUtils-6GRYH4Y3.js} +2 -2
- package/chunks/{pt-3AOBKPIJ.js → pt-U6AOCTMF.js} +5 -0
- package/chunks/{qwenContentGenerator-ODRJSUGR.js → qwenContentGenerator-KAHU6IZY.js} +33 -28
- package/chunks/{qwenOAuth2-NESCMZ47.js → qwenOAuth2-RRQTCP4W.js} +7 -5
- package/chunks/{read-file-HPSODLPK.js → read-file-3M6WXDXP.js} +6 -4
- package/chunks/{read-mcp-resource-2TNSJTC3.js → read-mcp-resource-PZ4ZF6YL.js} +1 -1
- package/chunks/{record-artifact-RAON52FC.js → record-artifact-P4HFMS7X.js} +2 -2
- package/chunks/{resumeHistoryUtils-TXCOFFMQ.js → resumeHistoryUtils-D6TAY3HX.js} +30 -26
- package/chunks/{ripGrep-ZKQGTQAO.js → ripGrep-PLPENT3E.js} +26 -22
- package/chunks/{ru-VJRAMC4W.js → ru-CMX4UMYP.js} +5 -0
- package/chunks/{run-qwen-serve-ZPKPKECF.js → run-qwen-serve-ZAFIJKJC.js} +168 -54
- package/chunks/{runtime-2FLNNM36.js → runtime-ZED7CYOZ.js} +38 -34
- package/chunks/{scheduler-365PJHNR.js → scheduler-MD3AL2W5.js} +26 -22
- package/chunks/{send-message-ZM7MRUGP.js → send-message-CAMSLG2L.js} +4 -3
- package/chunks/{serve-QD2RNLKJ.js → serve-E3VUDRZN.js} +33 -29
- package/chunks/{server-XLJVLTYM.js → server-OWMEMAKR.js} +450 -231
- package/chunks/{session-3VTUHH4Q.js → session-HZ57QK7K.js} +158 -97
- package/chunks/{settings-KULVPCQC.js → settings-V7BR3RKP.js} +32 -28
- package/chunks/{shell-3SWW22MH.js → shell-23OMNMW6.js} +26 -22
- package/chunks/{skill-KDHWYS7W.js → skill-6HBDYZRS.js} +7 -5
- package/chunks/{skill-settings-NMY4JEJC.js → skill-settings-HWJLTU7M.js} +32 -28
- package/chunks/{spawnChannel-ZKS4Q5OU.js → spawnChannel-N6KKUW5B.js} +27 -23
- package/chunks/{standalone-update-7CXPGAQ4.js → standalone-update-QGIKHATD.js} +28 -24
- package/chunks/{startInteractiveUI-2QQLEKM6.js → startInteractiveUI-GX2CRL42.js} +365 -155
- package/chunks/{syntheticOutput-ZLCUTKO2.js → syntheticOutput-PEBJQYJV.js} +2 -2
- package/chunks/{task-create-CQP5UEA3.js → task-create-5NWCQSJF.js} +5 -4
- package/chunks/{task-list-XLEZOJXP.js → task-list-53265TRZ.js} +1 -1
- package/chunks/{task-stop-7ZQM5CFF.js → task-stop-FPCOIRYX.js} +1 -1
- package/chunks/{task-update-JA75U2SN.js → task-update-5HN577LS.js} +5 -4
- package/chunks/{team-create-2WTNGAOX.js → team-create-CFFKU7KL.js} +26 -22
- package/chunks/{team-delete-MHY3UZGY.js → team-delete-MMQB4OSC.js} +1 -1
- package/chunks/{team-plan-approval-LZTYLEG4.js → team-plan-approval-6EFOKR6A.js} +26 -22
- package/chunks/{terminal-image-renderer-R5HHAFJN.js → terminal-image-renderer-TLDNACQY.js} +28 -24
- package/chunks/{theme-manager-PAUCSJFF.js → theme-manager-5LJ3H7VO.js} +26 -22
- package/chunks/{todoWrite-UPVOHYGD.js → todoWrite-JGV6VLOX.js} +1 -1
- package/chunks/{tool-search-2BFCGLI6.js → tool-search-UJV3A24H.js} +9 -6
- package/chunks/{total-session-admission-MK4SINFK.js → total-session-admission-D63QYXGO.js} +29 -25
- package/chunks/{trustedFolders-TJ5S26N7.js → trustedFolders-KZCOB53W.js} +30 -24
- package/chunks/{update-relaunch-N7AYLARF.js → update-relaunch-IFILM3SA.js} +5 -5
- package/chunks/{updateCheck-QRZ3DVT5.js → updateCheck-YZ2CRCFC.js} +29 -25
- package/chunks/{useAutoAcceptIndicator-DBJ7Y5AF.js → useAutoAcceptIndicator-AXEVNA3Q.js} +35 -31
- package/chunks/{validateNonInterActiveAuth-6ZQWUDS3.js → validateNonInterActiveAuth-3WTOJFWA.js} +61 -57
- package/chunks/{version-AJQGQWXC.js → version-GXK7OHZY.js} +1 -1
- package/chunks/{web-fetch-QWJYRXFL.js → web-fetch-ILB4GAVR.js} +12 -8
- package/chunks/{web-search-2AOXJGHU.js → web-search-HKRPGPZZ.js} +8 -6
- package/chunks/{workflow-ERH3SJG2.js → workflow-FXIPRQQA.js} +750 -147
- package/chunks/{workspace-providers-status-HZ474RA4.js → workspace-providers-status-NYHC7HSR.js} +35 -31
- package/chunks/{workspace-registration-store-6EUP4JXG.js → workspace-registration-store-AKEB7OMW.js} +1 -1
- package/chunks/{workspace-registry-R4APRRNC.js → workspace-registry-CDAS5TVZ.js} +29 -25
- package/chunks/{workspace-service-HFIFDMU7.js → workspace-service-PAMUKMAV.js} +36 -32
- package/chunks/{workspace-skills-status-HAHEIHGK.js → workspace-skills-status-YQSHCCMS.js} +33 -29
- package/chunks/{workspace-trust-reconciler-65GTAGDK.js → workspace-trust-reconciler-RPTXOIY2.js} +36 -32
- package/chunks/{write-file-B34CDELV.js → write-file-CGS57TS4.js} +26 -22
- package/chunks/{zh-ARWDLDLR.js → zh-AGL2FVBI.js} +6 -0
- package/chunks/{zh-TW-Y4RGI3P7.js → zh-TW-KI66MHQY.js} +6 -0
- package/chunks/{zoom-image-HPRBZHSS.js → zoom-image-E7D72GYV.js} +6 -4
- package/cli.js +13 -13
- package/locales/ca.js +10 -0
- package/locales/de.js +9 -0
- package/locales/en.js +10 -0
- package/locales/fr.js +9 -0
- package/locales/ja.js +9 -0
- package/locales/pt.js +9 -0
- package/locales/ru.js +9 -0
- package/locales/zh-TW.js +10 -0
- package/locales/zh.js +10 -0
- package/package.json +3 -3
- package/web-shell/assets/{arc-Ip-FFDJ0.js → arc-DybZaz32.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-CChqgwIb.js → architectureDiagram-3BPJPVTR-jN3qBd19.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-BHN-Tfss.js → blockDiagram-GPEHLZMM-Ct5DZPrj.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-BhyjzDjN.js → c4Diagram-AAUBKEIU-CUAFMlUG.js} +1 -1
- package/web-shell/assets/channel-BMwLrwLW.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-BB9eyHrx.js → chunk-2J33WTMH-CuV8n90B.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-BeV7ce_J.js → chunk-4BX2VUAB-BUzl_kls.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-DO7kXDiV.js → chunk-55IACEB6-BnDBLX6A.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-B27MPznD.js → chunk-727SXJPM-B83uTOjm.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-DHIjqjD_.js → chunk-AQP2D5EJ-DM3HLgpT.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-DabMqyN2.js → chunk-FMBD7UC4-CSQ5hgyb.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-Dw7Nnnxc.js → chunk-ND2GUHAM-BWOF4SxX.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-DdaZew1Q.js → chunk-QZHKN3VN-BsOH9LMi.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-BGDv98jY.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-BGDv98jY.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-CgBpCYH5.js → cose-bilkent-S5V4N54A-IENqH2iJ.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-BB4IU8G0.js → dagre-BM42HDAG--dyzDTGo.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-BcUTHU37.js → diagram-2AECGRRQ-BE7Dcqof.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-B6Lyihyv.js → diagram-5GNKFQAL-Cr8-5OTj.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-CRIJOjpG.js → diagram-KO2AKTUF-Bzey3uAY.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-DdNiwWWT.js → diagram-LMA3HP47-sErl28Xb.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-Dz4b32Do.js → diagram-OG6HWLK6-Dq30ATIo.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-D-8NGw77.js → erDiagram-TEJ5UH35-BkCoEfVW.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-Dun26LyM.js → flowDiagram-I6XJVG4X-DHwO0rrI.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-F10Hu1Gc.js → ganttDiagram-6RSMTGT7-s7vAPxWq.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-Bf8Ez6-D.js → gitGraphDiagram-PVQCEYII-CQxhwPOU.js} +1 -1
- package/web-shell/assets/index-Bckpjr-I.css +5 -0
- package/web-shell/assets/{index-BXqw-nGq.js → index-CF4wApWp.js} +1 -1
- package/web-shell/assets/index-DwEr9HEW.js +1768 -0
- package/web-shell/assets/{infoDiagram-5YYISTIA-DVgTMLvj.js → infoDiagram-5YYISTIA-BnFrD0bq.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-uT-KepvK.js → ishikawaDiagram-YF4QCWOH-Bf9zK5NK.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-Vg_XadQf.js → journeyDiagram-JHISSGLW-CyGAhsxi.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-Dyv1ESBE.js → kanban-definition-UN3LZRKU-CbsK5akB.js} +1 -1
- package/web-shell/assets/{linear-BMIepYX3.js → linear-cQsF4P8D.js} +1 -1
- package/web-shell/assets/{mermaid.core-zA8pJ9ag.js → mermaid.core-Z4HVqrKY.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-BCW_BZ_5.js → mindmap-definition-RKZ34NQL-CYnrBo_f.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-DseNEGp2.js → pieDiagram-4H26LBE5-CBzOfhrs.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-6Z7wr1Fi.js → quadrantDiagram-W4KKPZXB-D4LK1Ebn.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-CVOlCRPf.js → requirementDiagram-4Y6WPE33-Bzti2Lcj.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-CGhgrUJZ.js → sankeyDiagram-5OEKKPKP-yTBw5Z2s.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-dlqmpLuQ.js → sequenceDiagram-3UESZ5HK-D07UVRiZ.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-B9EW10Xb.js → stateDiagram-AJRCARHV-UE_lHsTn.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DC6xgXjX.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-BBRh0mgZ.js → timeline-definition-PNZ67QCA-DRvYdiTs.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-B8Gs-REP.js → vennDiagram-CIIHVFJN-CQLIXs0u.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-D_y80Ur7.js → wardley-L42UT6IY-JZz_Xqse.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-D-CNfHJ-.js → wardleyDiagram-YWT4CUSO--i7BiJwB.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-DQ5CvELo.js → xychartDiagram-2RQKCTM6-Bkc-bW0S.js} +1 -1
- package/web-shell/index.html +2 -2
- package/chunks/chunk-6PEXNQTX.js +0 -68
- package/chunks/chunk-IUFV6FYU.js +0 -81
- package/web-shell/assets/channel-Cu8qd6OB.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-BI3KrXhq.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-BI3KrXhq.js +0 -1
- package/web-shell/assets/index-QQlUCJGg.css +0 -5
- package/web-shell/assets/index-hcgjV7vS.js +0 -1768
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-CJTZJJ5X.js +0 -1
- package/chunks/{anthropicContentGenerator-DTMVEL5M.js → anthropicContentGenerator-SSFE2753.js} +9 -9
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
CronScheduler,
|
|
41
41
|
DEFAULT_RECURRING_MAX_AGE_DAYS,
|
|
42
42
|
normalizeRecurringMaxAge
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-2UUMVNYT.js";
|
|
44
44
|
import {
|
|
45
45
|
consumeUnread,
|
|
46
46
|
forwardApproval,
|
|
@@ -71,13 +71,13 @@ import {
|
|
|
71
71
|
RUNTIME_SNAPSHOT_PREFIX,
|
|
72
72
|
buildModelIdContext,
|
|
73
73
|
resolveModelId
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-VXZ5HAOV.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-HUWENAHO.js";
|
|
81
81
|
import {
|
|
82
82
|
promptIdContext,
|
|
83
83
|
todoWorkChainContext
|
|
@@ -131,25 +131,31 @@ import {
|
|
|
131
131
|
import {
|
|
132
132
|
normalizeImageGenerationBaseUrl,
|
|
133
133
|
resolveNetworkTarget
|
|
134
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-2FRY5CRX.js";
|
|
135
135
|
import {
|
|
136
136
|
GoalPersistenceUnavailableError,
|
|
137
137
|
PAUSED_GOAL_SYSTEM_REMINDER,
|
|
138
|
+
aggregateTranscriptRecordFragments,
|
|
139
|
+
createGoalCheckpointVerifier,
|
|
138
140
|
createGoalRuntime,
|
|
139
141
|
goalRequiresExactPermit,
|
|
140
142
|
goalTurnContext,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
+
isTranscriptArtifactRecord,
|
|
144
|
+
isTranscriptConversationRecord,
|
|
145
|
+
parseGoalStateRecordPayloadV2,
|
|
146
|
+
prepareTranscriptRecords,
|
|
147
|
+
projectUserTranscriptForDisplay,
|
|
148
|
+
selectTranscriptLeaf,
|
|
149
|
+
validateTranscriptRecord,
|
|
150
|
+
walkTranscriptUuidChain,
|
|
151
|
+
wrapUserPromptSubmitContext
|
|
152
|
+
} from "./chunk-67N6HB5H.js";
|
|
143
153
|
import {
|
|
144
154
|
APPROVAL_MODES,
|
|
145
155
|
SUBAGENT_PLAN_LIFECYCLE_TOOLS,
|
|
146
156
|
buildSubagentPlanToolBlockedResult,
|
|
147
|
-
childLaunchDepth,
|
|
148
|
-
getCurrentAgentDepth,
|
|
149
|
-
getCurrentAgentId,
|
|
150
157
|
getLeaderOnlyToolUnavailableMessage,
|
|
151
158
|
getPlanRequiredTeammatePreApprovalMessage,
|
|
152
|
-
getRuntimeContentGenerator,
|
|
153
159
|
getSubagentPlanToolUnavailableMessage,
|
|
154
160
|
isLeaderOnlyToolUnavailableInSubagent,
|
|
155
161
|
isPlanLifecycleToolUnavailableInSubagent,
|
|
@@ -157,18 +163,38 @@ import {
|
|
|
157
163
|
isPlanRequiredTeammateContext,
|
|
158
164
|
isPlanRequiredTeammatePreApprovalAllowedTool,
|
|
159
165
|
isSubagentLikeExecutionContext,
|
|
166
|
+
shouldUsePlanOnlyReminderInSubagentContext
|
|
167
|
+
} from "./chunk-WAUGQKUU.js";
|
|
168
|
+
import {
|
|
169
|
+
DEFAULT_OTLP_ENDPOINT,
|
|
170
|
+
DEFAULT_TELEMETRY_TARGET,
|
|
171
|
+
addToolArgumentsAttributes,
|
|
172
|
+
addToolCallResultAttributes,
|
|
173
|
+
addUserPromptAttributes
|
|
174
|
+
} from "./chunk-L4N6TIP7.js";
|
|
175
|
+
import {
|
|
176
|
+
supportsOpenAIPrefixCaching
|
|
177
|
+
} from "./chunk-SAH4BD2J.js";
|
|
178
|
+
import {
|
|
179
|
+
childLaunchDepth,
|
|
180
|
+
getCurrentAgentDepth,
|
|
181
|
+
getCurrentAgentId,
|
|
182
|
+
getRuntimeContentGenerator,
|
|
160
183
|
isTopLevelSession,
|
|
161
184
|
runOutsideAgentContext,
|
|
162
185
|
runWithAgentContext,
|
|
163
186
|
runWithRuntimeContentGenerator,
|
|
164
|
-
shouldUsePlanOnlyReminderInSubagentContext,
|
|
165
187
|
spawnBlockReason
|
|
166
|
-
} from "./chunk-
|
|
188
|
+
} from "./chunk-CPG6P4GG.js";
|
|
167
189
|
import {
|
|
168
190
|
getTeammateContext,
|
|
169
191
|
isTeammate,
|
|
170
192
|
runWithTeammateIdentity
|
|
171
193
|
} from "./chunk-S6LOFUVP.js";
|
|
194
|
+
import {
|
|
195
|
+
InvalidStreamError,
|
|
196
|
+
getThoughtSummary
|
|
197
|
+
} from "./chunk-2J3OJGTL.js";
|
|
172
198
|
import {
|
|
173
199
|
BUBBLE_APPROVAL_MODE,
|
|
174
200
|
FORK_AGENT,
|
|
@@ -202,7 +228,7 @@ import {
|
|
|
202
228
|
selectForkHistory,
|
|
203
229
|
stripSystemReminderBlocks,
|
|
204
230
|
validateForkToolList
|
|
205
|
-
} from "./chunk-
|
|
231
|
+
} from "./chunk-IA7TGCN2.js";
|
|
206
232
|
import {
|
|
207
233
|
collectAvailableSkillEntries,
|
|
208
234
|
renderAvailableSkillsBlock
|
|
@@ -221,38 +247,18 @@ import {
|
|
|
221
247
|
isPathWithinRoot,
|
|
222
248
|
require_ignore
|
|
223
249
|
} from "./chunk-EQL65XGA.js";
|
|
224
|
-
import {
|
|
225
|
-
DashScopeOpenAICompatibleProvider
|
|
226
|
-
} from "./chunk-IIJEYBNH.js";
|
|
227
250
|
import {
|
|
228
251
|
openBrowserSecurely,
|
|
229
252
|
shouldAttemptBrowserLaunch
|
|
230
253
|
} from "./chunk-NAVJD2PQ.js";
|
|
231
254
|
import {
|
|
232
|
-
classifyRetryError,
|
|
233
|
-
isFallbackEligible,
|
|
234
255
|
isUnattendedMode,
|
|
235
256
|
retryWithBackoff
|
|
236
|
-
} from "./chunk-
|
|
237
|
-
import {
|
|
238
|
-
DEFAULT_OPENAI_BASE_URL
|
|
239
|
-
} from "./chunk-AXMWHKXA.js";
|
|
240
|
-
import {
|
|
241
|
-
combineAbortSignals,
|
|
242
|
-
createAbortController,
|
|
243
|
-
createChildAbortController
|
|
244
|
-
} from "./chunk-DJ2GSRLV.js";
|
|
257
|
+
} from "./chunk-4PYCZH2V.js";
|
|
245
258
|
import {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
addToolCallResultAttributes,
|
|
250
|
-
addUserPromptAttributes
|
|
251
|
-
} from "./chunk-L4N6TIP7.js";
|
|
252
|
-
import {
|
|
253
|
-
InvalidStreamError,
|
|
254
|
-
getThoughtSummary
|
|
255
|
-
} from "./chunk-2J3OJGTL.js";
|
|
259
|
+
classifyRetryError,
|
|
260
|
+
isFallbackEligible
|
|
261
|
+
} from "./chunk-SR7RZ4MS.js";
|
|
256
262
|
import {
|
|
257
263
|
QUOTA_EXHAUSTED_PREFIX,
|
|
258
264
|
formatQuotaExhaustedMessage,
|
|
@@ -263,10 +269,18 @@ import {
|
|
|
263
269
|
isRateLimitError,
|
|
264
270
|
isStructuredError
|
|
265
271
|
} from "./chunk-M6HMMKVG.js";
|
|
272
|
+
import {
|
|
273
|
+
DEFAULT_OPENAI_BASE_URL
|
|
274
|
+
} from "./chunk-AXMWHKXA.js";
|
|
266
275
|
import {
|
|
267
276
|
getToolCallPreparations,
|
|
268
277
|
setToolCallPreparations
|
|
269
278
|
} from "./chunk-GLCZKT5V.js";
|
|
279
|
+
import {
|
|
280
|
+
combineAbortSignals,
|
|
281
|
+
createAbortController,
|
|
282
|
+
createChildAbortController
|
|
283
|
+
} from "./chunk-DJ2GSRLV.js";
|
|
270
284
|
import {
|
|
271
285
|
ApiRetryEvent,
|
|
272
286
|
ContentRetryEvent,
|
|
@@ -368,7 +382,6 @@ import {
|
|
|
368
382
|
readTextRangeFromHandle,
|
|
369
383
|
removeMCPServerStatus,
|
|
370
384
|
removeMCPStatusChangeListener,
|
|
371
|
-
runSideQuery,
|
|
372
385
|
runVisionBridge,
|
|
373
386
|
runWithChatRecordingSuppressed,
|
|
374
387
|
runWithInvocationContext,
|
|
@@ -382,7 +395,7 @@ import {
|
|
|
382
395
|
updateMCPServerStatus,
|
|
383
396
|
writeLine,
|
|
384
397
|
writeLineSync
|
|
385
|
-
} from "./chunk-
|
|
398
|
+
} from "./chunk-3PY4LPJF.js";
|
|
386
399
|
import {
|
|
387
400
|
defaultModalities
|
|
388
401
|
} from "./chunk-WOJZWRAZ.js";
|
|
@@ -411,9 +424,12 @@ import {
|
|
|
411
424
|
isTeamAutoMemPath,
|
|
412
425
|
isUserAutoMemPath
|
|
413
426
|
} from "./chunk-FVKHVJZQ.js";
|
|
427
|
+
import {
|
|
428
|
+
runSideQuery
|
|
429
|
+
} from "./chunk-COBO5EBO.js";
|
|
414
430
|
import {
|
|
415
431
|
STRUCTURED_OUTPUT_REDACTED_ARGS
|
|
416
|
-
} from "./chunk-
|
|
432
|
+
} from "./chunk-6ZRFAKXK.js";
|
|
417
433
|
import {
|
|
418
434
|
AgentStatistics,
|
|
419
435
|
BaseDeclarativeTool,
|
|
@@ -425,19 +441,18 @@ import {
|
|
|
425
441
|
ToolDisplayNamesMigration,
|
|
426
442
|
ToolNames,
|
|
427
443
|
ToolNamesMigration,
|
|
444
|
+
canonicalToolName,
|
|
428
445
|
hasCycleInSchema,
|
|
429
446
|
isShellProgressData,
|
|
430
447
|
isTool,
|
|
431
448
|
require_dist,
|
|
432
449
|
require_fast_deep_equal,
|
|
433
450
|
require_fast_uri
|
|
434
|
-
} from "./chunk-
|
|
451
|
+
} from "./chunk-PYQADEFD.js";
|
|
435
452
|
import {
|
|
436
453
|
AUTH_ENV_MAPPINGS,
|
|
437
454
|
AuthType,
|
|
438
455
|
DEFAULT_MODELS,
|
|
439
|
-
DEFAULT_QWEN_EMBEDDING_MODEL,
|
|
440
|
-
DEFAULT_QWEN_MODEL,
|
|
441
456
|
MODEL_GENERATION_CONFIG_FIELDS,
|
|
442
457
|
PROVIDER_SOURCED_FIELDS,
|
|
443
458
|
QWEN_OAUTH_ALLOWED_MODELS,
|
|
@@ -445,7 +460,11 @@ import {
|
|
|
445
460
|
createContentGenerator,
|
|
446
461
|
resetPreloadedContentGenerator,
|
|
447
462
|
resolveContentGeneratorConfigWithSources
|
|
448
|
-
} from "./chunk-
|
|
463
|
+
} from "./chunk-M3STHEMM.js";
|
|
464
|
+
import {
|
|
465
|
+
DEFAULT_QWEN_EMBEDDING_MODEL,
|
|
466
|
+
DEFAULT_QWEN_MODEL
|
|
467
|
+
} from "./chunk-F6WFNA7U.js";
|
|
449
468
|
import {
|
|
450
469
|
normalizeMcpToolName,
|
|
451
470
|
sanitizeToolNameForProvider
|
|
@@ -8802,16 +8821,16 @@ var require_windows = __commonJS({
|
|
|
8802
8821
|
return false;
|
|
8803
8822
|
}
|
|
8804
8823
|
__name(checkPathExt, "checkPathExt");
|
|
8805
|
-
function checkStat(
|
|
8806
|
-
if (!
|
|
8824
|
+
function checkStat(stat22, path98, options2) {
|
|
8825
|
+
if (!stat22.isSymbolicLink() && !stat22.isFile()) {
|
|
8807
8826
|
return false;
|
|
8808
8827
|
}
|
|
8809
8828
|
return checkPathExt(path98, options2);
|
|
8810
8829
|
}
|
|
8811
8830
|
__name(checkStat, "checkStat");
|
|
8812
8831
|
function isexe(path98, options2, cb) {
|
|
8813
|
-
fs93.stat(path98, function(er2,
|
|
8814
|
-
cb(er2, er2 ? false : checkStat(
|
|
8832
|
+
fs93.stat(path98, function(er2, stat22) {
|
|
8833
|
+
cb(er2, er2 ? false : checkStat(stat22, path98, options2));
|
|
8815
8834
|
});
|
|
8816
8835
|
}
|
|
8817
8836
|
__name(isexe, "isexe");
|
|
@@ -8830,8 +8849,8 @@ var require_mode = __commonJS({
|
|
|
8830
8849
|
isexe.sync = sync2;
|
|
8831
8850
|
var fs93 = __require("fs");
|
|
8832
8851
|
function isexe(path98, options2, cb) {
|
|
8833
|
-
fs93.stat(path98, function(er2,
|
|
8834
|
-
cb(er2, er2 ? false : checkStat(
|
|
8852
|
+
fs93.stat(path98, function(er2, stat22) {
|
|
8853
|
+
cb(er2, er2 ? false : checkStat(stat22, options2));
|
|
8835
8854
|
});
|
|
8836
8855
|
}
|
|
8837
8856
|
__name(isexe, "isexe");
|
|
@@ -8839,14 +8858,14 @@ var require_mode = __commonJS({
|
|
|
8839
8858
|
return checkStat(fs93.statSync(path98), options2);
|
|
8840
8859
|
}
|
|
8841
8860
|
__name(sync2, "sync");
|
|
8842
|
-
function checkStat(
|
|
8843
|
-
return
|
|
8861
|
+
function checkStat(stat22, options2) {
|
|
8862
|
+
return stat22.isFile() && checkMode(stat22, options2);
|
|
8844
8863
|
}
|
|
8845
8864
|
__name(checkStat, "checkStat");
|
|
8846
|
-
function checkMode(
|
|
8847
|
-
var mod =
|
|
8848
|
-
var uid =
|
|
8849
|
-
var gid =
|
|
8865
|
+
function checkMode(stat22, options2) {
|
|
8866
|
+
var mod = stat22.mode;
|
|
8867
|
+
var uid = stat22.uid;
|
|
8868
|
+
var gid = stat22.gid;
|
|
8850
8869
|
var myUid = options2.uid !== void 0 ? options2.uid : process.getuid && process.getuid();
|
|
8851
8870
|
var myGid = options2.gid !== void 0 ? options2.gid : process.getgid && process.getgid();
|
|
8852
8871
|
var u2 = parseInt("100", 8);
|
|
@@ -18227,12 +18246,12 @@ var require_resolve_symlink = __commonJS({
|
|
|
18227
18246
|
fs_1.default.realpath(path98, (error, resolvedPath) => {
|
|
18228
18247
|
if (error)
|
|
18229
18248
|
return queue.dequeue(suppressErrors ? null : error, state);
|
|
18230
|
-
fs_1.default.stat(resolvedPath, (error2,
|
|
18249
|
+
fs_1.default.stat(resolvedPath, (error2, stat22) => {
|
|
18231
18250
|
if (error2)
|
|
18232
18251
|
return queue.dequeue(suppressErrors ? null : error2, state);
|
|
18233
|
-
if (
|
|
18252
|
+
if (stat22.isDirectory() && isRecursive(path98, resolvedPath, state))
|
|
18234
18253
|
return queue.dequeue(null, state);
|
|
18235
|
-
callback(
|
|
18254
|
+
callback(stat22, resolvedPath);
|
|
18236
18255
|
queue.dequeue(null, state);
|
|
18237
18256
|
});
|
|
18238
18257
|
});
|
|
@@ -18242,10 +18261,10 @@ var require_resolve_symlink = __commonJS({
|
|
|
18242
18261
|
queue.enqueue();
|
|
18243
18262
|
try {
|
|
18244
18263
|
const resolvedPath = fs_1.default.realpathSync(path98);
|
|
18245
|
-
const
|
|
18246
|
-
if (
|
|
18264
|
+
const stat22 = fs_1.default.statSync(resolvedPath);
|
|
18265
|
+
if (stat22.isDirectory() && isRecursive(path98, resolvedPath, state))
|
|
18247
18266
|
return;
|
|
18248
|
-
callback(
|
|
18267
|
+
callback(stat22, resolvedPath);
|
|
18249
18268
|
} catch (e) {
|
|
18250
18269
|
if (!suppressErrors)
|
|
18251
18270
|
throw e;
|
|
@@ -18564,8 +18583,8 @@ var require_walker = __commonJS({
|
|
|
18564
18583
|
this.walkDirectory(this.state, path98, path98, depth - 1, this.walk);
|
|
18565
18584
|
} else if (this.resolveSymlink && entry.isSymbolicLink()) {
|
|
18566
18585
|
let path98 = joinPath.joinPathWithBasePath(entry.name, directoryPath);
|
|
18567
|
-
this.resolveSymlink(path98, this.state, (
|
|
18568
|
-
if (
|
|
18586
|
+
this.resolveSymlink(path98, this.state, (stat22, resolvedPath) => {
|
|
18587
|
+
if (stat22.isDirectory()) {
|
|
18569
18588
|
resolvedPath = (0, utils_1.normalizePath)(resolvedPath, this.state.options);
|
|
18570
18589
|
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path98 + pathSeparator))
|
|
18571
18590
|
return;
|
|
@@ -19972,7 +19991,8 @@ var BaseLlmClient = class {
|
|
|
19972
19991
|
const request = {
|
|
19973
19992
|
model: requestModel,
|
|
19974
19993
|
config: requestConfig,
|
|
19975
|
-
contents: requestContents
|
|
19994
|
+
contents: requestContents,
|
|
19995
|
+
...options2.promptCacheSharing && { promptCacheSharing: true }
|
|
19976
19996
|
};
|
|
19977
19997
|
const apiCall = stream2 ? async () => {
|
|
19978
19998
|
const responseStream = await contentGenerator.generateContentStream(
|
|
@@ -20327,12 +20347,12 @@ async function cleanupLegacyOutputFiles(dir, now, maxAgeMs, result) {
|
|
|
20327
20347
|
__name(cleanupLegacyOutputFiles, "cleanupLegacyOutputFiles");
|
|
20328
20348
|
async function tryDeleteIfOld(filePath, now, maxAgeMs, result) {
|
|
20329
20349
|
try {
|
|
20330
|
-
const
|
|
20331
|
-
if (!
|
|
20332
|
-
if (now -
|
|
20350
|
+
const stat22 = await fs2.lstat(filePath);
|
|
20351
|
+
if (!stat22.isFile()) return;
|
|
20352
|
+
if (now - stat22.mtimeMs < maxAgeMs) return;
|
|
20333
20353
|
await fs2.unlink(filePath);
|
|
20334
20354
|
result.filesDeleted++;
|
|
20335
|
-
result.bytesFreed +=
|
|
20355
|
+
result.bytesFreed += stat22.size;
|
|
20336
20356
|
} catch (error) {
|
|
20337
20357
|
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
|
|
20338
20358
|
return;
|
|
@@ -21627,33 +21647,6 @@ function buildContextUsage(contextWindowSize, inputTokens) {
|
|
|
21627
21647
|
}
|
|
21628
21648
|
__name(buildContextUsage, "buildContextUsage");
|
|
21629
21649
|
|
|
21630
|
-
// packages/core/src/hooks/user-prompt-submit-context.ts
|
|
21631
|
-
init_esbuild_shims();
|
|
21632
|
-
var USER_PROMPT_SUBMIT_CONTEXT_OPEN_TAG = "<qwen:user-prompt-submit-context>";
|
|
21633
|
-
var USER_PROMPT_SUBMIT_CONTEXT_CLOSE_TAG = "</qwen:user-prompt-submit-context>";
|
|
21634
|
-
function wrapUserPromptSubmitContext(context2) {
|
|
21635
|
-
return `${USER_PROMPT_SUBMIT_CONTEXT_OPEN_TAG}
|
|
21636
|
-
${context2}
|
|
21637
|
-
${USER_PROMPT_SUBMIT_CONTEXT_CLOSE_TAG}`;
|
|
21638
|
-
}
|
|
21639
|
-
__name(wrapUserPromptSubmitContext, "wrapUserPromptSubmitContext");
|
|
21640
|
-
function isUserPromptSubmitContextPartText(text) {
|
|
21641
|
-
const trimmed = text.trim();
|
|
21642
|
-
return trimmed.startsWith(USER_PROMPT_SUBMIT_CONTEXT_OPEN_TAG) && trimmed.endsWith(USER_PROMPT_SUBMIT_CONTEXT_CLOSE_TAG) && trimmed.length >= USER_PROMPT_SUBMIT_CONTEXT_OPEN_TAG.length + USER_PROMPT_SUBMIT_CONTEXT_CLOSE_TAG.length;
|
|
21643
|
-
}
|
|
21644
|
-
__name(isUserPromptSubmitContextPartText, "isUserPromptSubmitContextPartText");
|
|
21645
|
-
function stripTrailingUserPromptSubmitContextPart(parts) {
|
|
21646
|
-
if (parts.length <= 1) {
|
|
21647
|
-
return parts;
|
|
21648
|
-
}
|
|
21649
|
-
const last = parts[parts.length - 1];
|
|
21650
|
-
if (!last || typeof last.text !== "string" || !isUserPromptSubmitContextPartText(last.text)) {
|
|
21651
|
-
return parts;
|
|
21652
|
-
}
|
|
21653
|
-
return parts.slice(0, -1);
|
|
21654
|
-
}
|
|
21655
|
-
__name(stripTrailingUserPromptSubmitContextPart, "stripTrailingUserPromptSubmitContextPart");
|
|
21656
|
-
|
|
21657
21650
|
// packages/core/src/core/session-start-profiler.ts
|
|
21658
21651
|
init_esbuild_shims();
|
|
21659
21652
|
import * as fs3 from "node:fs";
|
|
@@ -22165,6 +22158,7 @@ ${coreIdentity}
|
|
|
22165
22158
|
|
|
22166
22159
|
# Core Mandates
|
|
22167
22160
|
|
|
22161
|
+
- **UserPromptSubmit Context:** Text inside a \`<qwen:user-prompt-submit-context>\` tag is model context added by a configured \`UserPromptSubmit\` hook, not user input.
|
|
22168
22162
|
- **Conventions:** Rigorously adhere to existing project conventions when reading or modifying code. Analyze surrounding code, tests, and configuration first.
|
|
22169
22163
|
- **Libraries/Frameworks:** NEVER assume a library/framework is available or appropriate. Verify its established usage within the project (check imports, configuration files like 'package.json', 'Cargo.toml', 'requirements.txt', 'build.gradle', etc., or observe neighboring files) before employing it.
|
|
22170
22164
|
- **Style & Structure:** Mimic the style (formatting, naming), structure, framework choices, typing, and architectural patterns of existing code in the project.
|
|
@@ -24473,357 +24467,6 @@ import fs12 from "node:fs";
|
|
|
24473
24467
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
24474
24468
|
import readline from "node:readline";
|
|
24475
24469
|
|
|
24476
|
-
// packages/core/src/utils/transcript-records.ts
|
|
24477
|
-
init_esbuild_shims();
|
|
24478
|
-
var TranscriptRecordPreparationError = class extends TypeError {
|
|
24479
|
-
constructor(code, message) {
|
|
24480
|
-
super(message);
|
|
24481
|
-
this.code = code;
|
|
24482
|
-
this.name = "TranscriptRecordPreparationError";
|
|
24483
|
-
}
|
|
24484
|
-
static {
|
|
24485
|
-
__name(this, "TranscriptRecordPreparationError");
|
|
24486
|
-
}
|
|
24487
|
-
};
|
|
24488
|
-
var RECORD_TYPES = /* @__PURE__ */ new Set([
|
|
24489
|
-
"user",
|
|
24490
|
-
"assistant",
|
|
24491
|
-
"tool_result",
|
|
24492
|
-
"system"
|
|
24493
|
-
]);
|
|
24494
|
-
var ARTIFACT_RECORD_SUBTYPES = /* @__PURE__ */ new Set([
|
|
24495
|
-
"session_artifact_event",
|
|
24496
|
-
"session_artifact_snapshot"
|
|
24497
|
-
]);
|
|
24498
|
-
var KNOWN_RECORD_SUBTYPES = /* @__PURE__ */ new Set([
|
|
24499
|
-
"chat_compression",
|
|
24500
|
-
"slash_command",
|
|
24501
|
-
"ui_telemetry",
|
|
24502
|
-
"at_command",
|
|
24503
|
-
"attribution_snapshot",
|
|
24504
|
-
"notification",
|
|
24505
|
-
"cron",
|
|
24506
|
-
"mid_turn_user_message",
|
|
24507
|
-
"realtime_message",
|
|
24508
|
-
"custom_title",
|
|
24509
|
-
"parent_session",
|
|
24510
|
-
"rewind",
|
|
24511
|
-
"agent_bootstrap",
|
|
24512
|
-
"agent_launch_prompt",
|
|
24513
|
-
"file_history_snapshot",
|
|
24514
|
-
"session_source",
|
|
24515
|
-
"goal_state",
|
|
24516
|
-
"goal_runtime",
|
|
24517
|
-
...ARTIFACT_RECORD_SUBTYPES
|
|
24518
|
-
]);
|
|
24519
|
-
function isObjectRecord(value) {
|
|
24520
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
24521
|
-
}
|
|
24522
|
-
__name(isObjectRecord, "isObjectRecord");
|
|
24523
|
-
function diagnostic(code, message, affectsCompleteness, fields = {}, severity = affectsCompleteness ? "warning" : "info") {
|
|
24524
|
-
return {
|
|
24525
|
-
code,
|
|
24526
|
-
severity,
|
|
24527
|
-
message,
|
|
24528
|
-
affectsCompleteness,
|
|
24529
|
-
...fields
|
|
24530
|
-
};
|
|
24531
|
-
}
|
|
24532
|
-
__name(diagnostic, "diagnostic");
|
|
24533
|
-
function isTranscriptConversationRecord(record2) {
|
|
24534
|
-
return !isTranscriptArtifactRecord(record2);
|
|
24535
|
-
}
|
|
24536
|
-
__name(isTranscriptConversationRecord, "isTranscriptConversationRecord");
|
|
24537
|
-
function isTranscriptArtifactRecord(record2) {
|
|
24538
|
-
return record2.type === "system" && typeof record2.subtype === "string" && ARTIFACT_RECORD_SUBTYPES.has(record2.subtype);
|
|
24539
|
-
}
|
|
24540
|
-
__name(isTranscriptArtifactRecord, "isTranscriptArtifactRecord");
|
|
24541
|
-
function validateTranscriptRecord(value, recordIndex) {
|
|
24542
|
-
const diagnostics = [];
|
|
24543
|
-
if (!isObjectRecord(value)) {
|
|
24544
|
-
diagnostics.push(
|
|
24545
|
-
diagnostic(
|
|
24546
|
-
"invalid_record",
|
|
24547
|
-
"Skipped a transcript record that is not an object.",
|
|
24548
|
-
true,
|
|
24549
|
-
{ recordIndex }
|
|
24550
|
-
)
|
|
24551
|
-
);
|
|
24552
|
-
return { diagnostics };
|
|
24553
|
-
}
|
|
24554
|
-
const uuid = value["uuid"];
|
|
24555
|
-
const parentUuid = value["parentUuid"];
|
|
24556
|
-
const sessionId = value["sessionId"];
|
|
24557
|
-
const type = value["type"];
|
|
24558
|
-
const recordId = typeof uuid === "string" ? uuid : void 0;
|
|
24559
|
-
if (typeof uuid !== "string" || uuid.length === 0 || typeof parentUuid !== "string" && parentUuid !== null || typeof sessionId !== "string" || sessionId.length === 0) {
|
|
24560
|
-
diagnostics.push(
|
|
24561
|
-
diagnostic(
|
|
24562
|
-
"invalid_record",
|
|
24563
|
-
"Skipped a transcript record with invalid identity fields.",
|
|
24564
|
-
true,
|
|
24565
|
-
{ recordIndex, recordId }
|
|
24566
|
-
)
|
|
24567
|
-
);
|
|
24568
|
-
return { diagnostics };
|
|
24569
|
-
}
|
|
24570
|
-
if (typeof type !== "string" || !RECORD_TYPES.has(type)) {
|
|
24571
|
-
diagnostics.push(
|
|
24572
|
-
diagnostic(
|
|
24573
|
-
"unknown_record_or_part",
|
|
24574
|
-
"Skipped a transcript record with an unknown record type.",
|
|
24575
|
-
true,
|
|
24576
|
-
{ recordIndex, recordId }
|
|
24577
|
-
)
|
|
24578
|
-
);
|
|
24579
|
-
return { diagnostics };
|
|
24580
|
-
}
|
|
24581
|
-
const timestamp = value["timestamp"];
|
|
24582
|
-
if (timestamp !== void 0 && (typeof timestamp !== "string" || !Number.isFinite(new Date(timestamp).getTime()))) {
|
|
24583
|
-
diagnostics.push(
|
|
24584
|
-
diagnostic(
|
|
24585
|
-
"invalid_timestamp",
|
|
24586
|
-
"Ignored an invalid transcript record timestamp.",
|
|
24587
|
-
false,
|
|
24588
|
-
{ recordIndex, recordId, path: "timestamp" }
|
|
24589
|
-
)
|
|
24590
|
-
);
|
|
24591
|
-
}
|
|
24592
|
-
const subtype = value["subtype"];
|
|
24593
|
-
if (subtype !== void 0 && (typeof subtype !== "string" || !KNOWN_RECORD_SUBTYPES.has(subtype))) {
|
|
24594
|
-
diagnostics.push(
|
|
24595
|
-
diagnostic(
|
|
24596
|
-
"unknown_record_or_part",
|
|
24597
|
-
"The transcript record has an unknown subtype.",
|
|
24598
|
-
true,
|
|
24599
|
-
{ recordIndex, recordId, path: "subtype" }
|
|
24600
|
-
)
|
|
24601
|
-
);
|
|
24602
|
-
}
|
|
24603
|
-
let message;
|
|
24604
|
-
if (value["message"] !== void 0) {
|
|
24605
|
-
if (!isObjectRecord(value["message"])) {
|
|
24606
|
-
diagnostics.push(
|
|
24607
|
-
diagnostic(
|
|
24608
|
-
"malformed_part",
|
|
24609
|
-
"Ignored a malformed transcript message payload.",
|
|
24610
|
-
true,
|
|
24611
|
-
{ recordIndex, recordId, path: "message" }
|
|
24612
|
-
)
|
|
24613
|
-
);
|
|
24614
|
-
} else {
|
|
24615
|
-
const parts = value["message"]["parts"];
|
|
24616
|
-
if (parts !== void 0 && !Array.isArray(parts)) {
|
|
24617
|
-
diagnostics.push(
|
|
24618
|
-
diagnostic(
|
|
24619
|
-
"malformed_part",
|
|
24620
|
-
"Ignored malformed transcript message parts.",
|
|
24621
|
-
true,
|
|
24622
|
-
{ recordIndex, recordId, path: "message.parts" }
|
|
24623
|
-
)
|
|
24624
|
-
);
|
|
24625
|
-
}
|
|
24626
|
-
message = {
|
|
24627
|
-
...typeof value["message"]["role"] === "string" ? { role: value["message"]["role"] } : {},
|
|
24628
|
-
...Array.isArray(parts) ? { parts } : {}
|
|
24629
|
-
};
|
|
24630
|
-
}
|
|
24631
|
-
}
|
|
24632
|
-
return {
|
|
24633
|
-
record: {
|
|
24634
|
-
...value,
|
|
24635
|
-
uuid,
|
|
24636
|
-
parentUuid,
|
|
24637
|
-
sessionId,
|
|
24638
|
-
type,
|
|
24639
|
-
...typeof subtype === "string" ? { subtype } : { subtype: void 0 },
|
|
24640
|
-
...typeof timestamp === "string" && Number.isFinite(new Date(timestamp).getTime()) ? { timestamp } : { timestamp: void 0 },
|
|
24641
|
-
...message ? { message } : { message: void 0 }
|
|
24642
|
-
},
|
|
24643
|
-
diagnostics
|
|
24644
|
-
};
|
|
24645
|
-
}
|
|
24646
|
-
__name(validateTranscriptRecord, "validateTranscriptRecord");
|
|
24647
|
-
function selectTranscriptLeaf(records, leafUuid) {
|
|
24648
|
-
if (leafUuid !== void 0) {
|
|
24649
|
-
return records.some(
|
|
24650
|
-
(record2) => record2.uuid === leafUuid && isTranscriptConversationRecord(record2)
|
|
24651
|
-
) ? leafUuid : void 0;
|
|
24652
|
-
}
|
|
24653
|
-
for (let index = records.length - 1; index >= 0; index -= 1) {
|
|
24654
|
-
const record2 = records[index];
|
|
24655
|
-
if (record2 && isTranscriptConversationRecord(record2)) return record2.uuid;
|
|
24656
|
-
}
|
|
24657
|
-
return void 0;
|
|
24658
|
-
}
|
|
24659
|
-
__name(selectTranscriptLeaf, "selectTranscriptLeaf");
|
|
24660
|
-
function walkTranscriptUuidChain(leafUuid, lookup2) {
|
|
24661
|
-
const uuids = [];
|
|
24662
|
-
const gaps = [];
|
|
24663
|
-
const visited = /* @__PURE__ */ new Set();
|
|
24664
|
-
let currentUuid = leafUuid;
|
|
24665
|
-
let cycleUuid;
|
|
24666
|
-
while (currentUuid) {
|
|
24667
|
-
if (visited.has(currentUuid)) {
|
|
24668
|
-
cycleUuid = currentUuid;
|
|
24669
|
-
break;
|
|
24670
|
-
}
|
|
24671
|
-
visited.add(currentUuid);
|
|
24672
|
-
const record2 = lookup2(currentUuid);
|
|
24673
|
-
if (!record2) break;
|
|
24674
|
-
uuids.push(currentUuid);
|
|
24675
|
-
if (!record2.parentUuid) break;
|
|
24676
|
-
if (!lookup2(record2.parentUuid)) {
|
|
24677
|
-
gaps.push({
|
|
24678
|
-
childUuid: currentUuid,
|
|
24679
|
-
missingParentUuid: record2.parentUuid
|
|
24680
|
-
});
|
|
24681
|
-
break;
|
|
24682
|
-
}
|
|
24683
|
-
currentUuid = record2.parentUuid;
|
|
24684
|
-
}
|
|
24685
|
-
uuids.reverse();
|
|
24686
|
-
return { uuids, gaps, ...cycleUuid ? { cycleUuid } : {} };
|
|
24687
|
-
}
|
|
24688
|
-
__name(walkTranscriptUuidChain, "walkTranscriptUuidChain");
|
|
24689
|
-
function aggregateTranscriptRecordFragments(records) {
|
|
24690
|
-
const first = records[0];
|
|
24691
|
-
if (!first) {
|
|
24692
|
-
throw new Error("Cannot aggregate empty transcript record array");
|
|
24693
|
-
}
|
|
24694
|
-
const base = { ...first };
|
|
24695
|
-
let message = first.message ? { ...first.message, parts: [...first.message.parts ?? []] } : void 0;
|
|
24696
|
-
for (let index = 1; index < records.length; index += 1) {
|
|
24697
|
-
const record2 = records[index];
|
|
24698
|
-
if (record2.message !== void 0) {
|
|
24699
|
-
message = message ? {
|
|
24700
|
-
role: message.role,
|
|
24701
|
-
parts: [...message.parts ?? [], ...record2.message.parts ?? []]
|
|
24702
|
-
} : { ...record2.message, parts: [...record2.message.parts ?? []] };
|
|
24703
|
-
}
|
|
24704
|
-
if (record2.usageMetadata) base["usageMetadata"] = record2.usageMetadata;
|
|
24705
|
-
if (record2.toolCallResult && !base["toolCallResult"]) {
|
|
24706
|
-
base["toolCallResult"] = record2.toolCallResult;
|
|
24707
|
-
}
|
|
24708
|
-
if (record2.model && !base["model"]) base["model"] = record2.model;
|
|
24709
|
-
if (record2.timestamp && (!base["timestamp"] || record2.timestamp > String(base["timestamp"]))) {
|
|
24710
|
-
base["timestamp"] = record2.timestamp;
|
|
24711
|
-
}
|
|
24712
|
-
}
|
|
24713
|
-
base["message"] = message;
|
|
24714
|
-
return base;
|
|
24715
|
-
}
|
|
24716
|
-
__name(aggregateTranscriptRecordFragments, "aggregateTranscriptRecordFragments");
|
|
24717
|
-
function prepareTranscriptRecords(values, options2 = {}) {
|
|
24718
|
-
if (!Array.isArray(values)) {
|
|
24719
|
-
throw new TranscriptRecordPreparationError(
|
|
24720
|
-
"invalid_records",
|
|
24721
|
-
"Transcript records must be an array."
|
|
24722
|
-
);
|
|
24723
|
-
}
|
|
24724
|
-
const diagnostics = [];
|
|
24725
|
-
const records = [];
|
|
24726
|
-
const sourceIndexByRecord = /* @__PURE__ */ new Map();
|
|
24727
|
-
for (let index = 0; index < values.length; index += 1) {
|
|
24728
|
-
const validated = validateTranscriptRecord(values[index], index);
|
|
24729
|
-
diagnostics.push(...validated.diagnostics);
|
|
24730
|
-
if (validated.record) {
|
|
24731
|
-
records.push(validated.record);
|
|
24732
|
-
sourceIndexByRecord.set(validated.record, index);
|
|
24733
|
-
}
|
|
24734
|
-
}
|
|
24735
|
-
const sessionIds = new Set(records.map((record2) => record2.sessionId));
|
|
24736
|
-
if (sessionIds.size > 1) {
|
|
24737
|
-
throw new TranscriptRecordPreparationError(
|
|
24738
|
-
"mixed_session_ids",
|
|
24739
|
-
"Transcript records contain multiple session ids."
|
|
24740
|
-
);
|
|
24741
|
-
}
|
|
24742
|
-
const leafUuid = selectTranscriptLeaf(records, options2.leafUuid);
|
|
24743
|
-
if (options2.leafUuid !== void 0 && leafUuid === void 0) {
|
|
24744
|
-
throw new TranscriptRecordPreparationError(
|
|
24745
|
-
"leaf_not_found",
|
|
24746
|
-
"The requested transcript leaf was not found."
|
|
24747
|
-
);
|
|
24748
|
-
}
|
|
24749
|
-
if (!leafUuid) {
|
|
24750
|
-
if (records.length > 0) {
|
|
24751
|
-
diagnostics.push(
|
|
24752
|
-
diagnostic(
|
|
24753
|
-
"artifact_only",
|
|
24754
|
-
"The input contains no conversation records.",
|
|
24755
|
-
false
|
|
24756
|
-
)
|
|
24757
|
-
);
|
|
24758
|
-
}
|
|
24759
|
-
return {
|
|
24760
|
-
...sessionIds.size === 1 ? { sessionId: records[0].sessionId } : {},
|
|
24761
|
-
records: [],
|
|
24762
|
-
gaps: [],
|
|
24763
|
-
diagnostics
|
|
24764
|
-
};
|
|
24765
|
-
}
|
|
24766
|
-
const fragmentsByUuid = /* @__PURE__ */ new Map();
|
|
24767
|
-
const firstByUuid = /* @__PURE__ */ new Map();
|
|
24768
|
-
for (const record2 of records) {
|
|
24769
|
-
if (!isTranscriptConversationRecord(record2)) continue;
|
|
24770
|
-
const fragments = fragmentsByUuid.get(record2.uuid);
|
|
24771
|
-
if (fragments) {
|
|
24772
|
-
if (fragments[0].parentUuid !== record2.parentUuid) {
|
|
24773
|
-
diagnostics.push(
|
|
24774
|
-
diagnostic(
|
|
24775
|
-
"conflicting_parent_uuid",
|
|
24776
|
-
"Duplicate transcript record fragments disagree on parentUuid.",
|
|
24777
|
-
true,
|
|
24778
|
-
{
|
|
24779
|
-
recordIndex: sourceIndexByRecord.get(record2),
|
|
24780
|
-
recordId: record2.uuid,
|
|
24781
|
-
path: "parentUuid"
|
|
24782
|
-
}
|
|
24783
|
-
)
|
|
24784
|
-
);
|
|
24785
|
-
}
|
|
24786
|
-
fragments.push(record2);
|
|
24787
|
-
} else {
|
|
24788
|
-
fragmentsByUuid.set(record2.uuid, [record2]);
|
|
24789
|
-
firstByUuid.set(record2.uuid, record2);
|
|
24790
|
-
}
|
|
24791
|
-
}
|
|
24792
|
-
const chain = walkTranscriptUuidChain(
|
|
24793
|
-
leafUuid,
|
|
24794
|
-
(uuid) => firstByUuid.get(uuid)
|
|
24795
|
-
);
|
|
24796
|
-
for (const gap of chain.gaps) {
|
|
24797
|
-
diagnostics.push(
|
|
24798
|
-
diagnostic(
|
|
24799
|
-
"history_gap",
|
|
24800
|
-
"The active transcript chain is missing a parent record.",
|
|
24801
|
-
true,
|
|
24802
|
-
{ recordId: gap.childUuid }
|
|
24803
|
-
)
|
|
24804
|
-
);
|
|
24805
|
-
}
|
|
24806
|
-
if (chain.cycleUuid) {
|
|
24807
|
-
diagnostics.push(
|
|
24808
|
-
diagnostic(
|
|
24809
|
-
"parent_cycle",
|
|
24810
|
-
"The active transcript chain contains a parent cycle.",
|
|
24811
|
-
true,
|
|
24812
|
-
{ recordId: chain.cycleUuid }
|
|
24813
|
-
)
|
|
24814
|
-
);
|
|
24815
|
-
}
|
|
24816
|
-
return {
|
|
24817
|
-
...sessionIds.size === 1 ? { sessionId: records[0].sessionId } : {},
|
|
24818
|
-
records: chain.uuids.map(
|
|
24819
|
-
(uuid) => aggregateTranscriptRecordFragments(fragmentsByUuid.get(uuid) ?? [])
|
|
24820
|
-
),
|
|
24821
|
-
gaps: chain.gaps,
|
|
24822
|
-
diagnostics
|
|
24823
|
-
};
|
|
24824
|
-
}
|
|
24825
|
-
__name(prepareTranscriptRecords, "prepareTranscriptRecords");
|
|
24826
|
-
|
|
24827
24470
|
// packages/core/src/services/fileHistoryService.ts
|
|
24828
24471
|
init_esbuild_shims();
|
|
24829
24472
|
import { createHash } from "node:crypto";
|
|
@@ -29106,6 +28749,7 @@ var SESSION_TRANSCRIPT_MAX_LIMIT = 500;
|
|
|
29106
28749
|
var SESSION_TRANSCRIPT_CURSOR_VERSION = 1;
|
|
29107
28750
|
var SESSION_TRANSCRIPT_MAX_INDEX_BYTES = 256 * 1024 * 1024;
|
|
29108
28751
|
var SESSION_TRANSCRIPT_MAX_PAGE_BYTES = 4 * 1024 * 1024;
|
|
28752
|
+
var SESSION_TRANSCRIPT_MAX_EXPANDED_PAGE_BYTES = 16 * 1024 * 1024;
|
|
29109
28753
|
var InvalidSessionTranscriptCursorError = class extends Error {
|
|
29110
28754
|
static {
|
|
29111
28755
|
__name(this, "InvalidSessionTranscriptCursorError");
|
|
@@ -29166,6 +28810,11 @@ var debugLogger14 = createDebugLogger("SESSION_TRANSCRIPT");
|
|
|
29166
28810
|
var indexCache = /* @__PURE__ */ new Map();
|
|
29167
28811
|
var cursorHmacKeys = /* @__PURE__ */ new Map();
|
|
29168
28812
|
var indexCacheMaxBytesForTest;
|
|
28813
|
+
var expandedPageBytesForTest;
|
|
28814
|
+
function getExpandedPageBytes() {
|
|
28815
|
+
return expandedPageBytesForTest ?? SESSION_TRANSCRIPT_MAX_EXPANDED_PAGE_BYTES;
|
|
28816
|
+
}
|
|
28817
|
+
__name(getExpandedPageBytes, "getExpandedPageBytes");
|
|
29169
28818
|
function makeSessionTranscriptNotFoundError(sessionId) {
|
|
29170
28819
|
const error = new Error(
|
|
29171
28820
|
`ENOENT: no such file or directory, open '${sessionId}.jsonl'`
|
|
@@ -29176,10 +28825,10 @@ function makeSessionTranscriptNotFoundError(sessionId) {
|
|
|
29176
28825
|
return error;
|
|
29177
28826
|
}
|
|
29178
28827
|
__name(makeSessionTranscriptNotFoundError, "makeSessionTranscriptNotFoundError");
|
|
29179
|
-
function
|
|
28828
|
+
function isObjectRecord(value) {
|
|
29180
28829
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
29181
28830
|
}
|
|
29182
|
-
__name(
|
|
28831
|
+
__name(isObjectRecord, "isObjectRecord");
|
|
29183
28832
|
function isFiniteNonNegativeInteger(value) {
|
|
29184
28833
|
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
29185
28834
|
}
|
|
@@ -29293,11 +28942,11 @@ function decodeCursorState(cursor, key) {
|
|
|
29293
28942
|
try {
|
|
29294
28943
|
const decoded = Buffer.from(cursor, "base64url").toString("utf8");
|
|
29295
28944
|
const parsed = JSON.parse(decoded);
|
|
29296
|
-
if (!
|
|
28945
|
+
if (!isObjectRecord(parsed)) {
|
|
29297
28946
|
throw new InvalidSessionTranscriptCursorError();
|
|
29298
28947
|
}
|
|
29299
28948
|
const fileIdentity = parsed["fileIdentity"];
|
|
29300
|
-
if (parsed["v"] !== SESSION_TRANSCRIPT_CURSOR_VERSION || typeof parsed["sessionId"] !== "string" || !
|
|
28949
|
+
if (parsed["v"] !== SESSION_TRANSCRIPT_CURSOR_VERSION || typeof parsed["sessionId"] !== "string" || !isObjectRecord(fileIdentity) || !isFiniteNonNegativeFileId(fileIdentity["dev"]) || !isFiniteNonNegativeFileId(fileIdentity["ino"]) || !isFiniteNonNegativeInteger(parsed["snapshotSize"]) || !isFiniteNonNegativeInteger(parsed["position"]) || parsed["direction"] !== void 0 && parsed["direction"] !== "backward" || typeof parsed["leafUuid"] !== "string" || typeof parsed["startTime"] !== "string" || typeof parsed["lastUpdated"] !== "string" || typeof parsed["mac"] !== "string") {
|
|
29301
28950
|
debugLogger14.debug("cursor decode failed: invalid payload shape");
|
|
29302
28951
|
throw new InvalidSessionTranscriptCursorError();
|
|
29303
28952
|
}
|
|
@@ -29404,12 +29053,68 @@ function selectPageUuids(index, position, limit, maxBytes) {
|
|
|
29404
29053
|
return selected;
|
|
29405
29054
|
}
|
|
29406
29055
|
__name(selectPageUuids, "selectPageUuids");
|
|
29056
|
+
var REPLAY_MID_TURN_USER_SUBTYPES = /* @__PURE__ */ new Set([
|
|
29057
|
+
"goal_runtime",
|
|
29058
|
+
"notification",
|
|
29059
|
+
"cron",
|
|
29060
|
+
"mid_turn_user_message"
|
|
29061
|
+
]);
|
|
29062
|
+
function isReplayTurnStartType(type, subtype) {
|
|
29063
|
+
return type === "user" && (subtype === void 0 || !REPLAY_MID_TURN_USER_SUBTYPES.has(subtype));
|
|
29064
|
+
}
|
|
29065
|
+
__name(isReplayTurnStartType, "isReplayTurnStartType");
|
|
29407
29066
|
function isReplayTurnStart(index, uuid) {
|
|
29408
29067
|
const entry = index.byUuid.get(uuid);
|
|
29409
|
-
return entry?.type
|
|
29068
|
+
return isReplayTurnStartType(entry?.type, entry?.subtype);
|
|
29410
29069
|
}
|
|
29411
29070
|
__name(isReplayTurnStart, "isReplayTurnStart");
|
|
29412
|
-
function
|
|
29071
|
+
function isReplayPageStart(index, uuid) {
|
|
29072
|
+
const entry = index.byUuid.get(uuid);
|
|
29073
|
+
return entry?.subtype !== "realtime_message" && (entry?.type === "assistant" || isReplayTurnStartType(entry?.type, entry?.subtype));
|
|
29074
|
+
}
|
|
29075
|
+
__name(isReplayPageStart, "isReplayPageStart");
|
|
29076
|
+
function findBoundaryAtOrBefore(items, from, floor, isBoundary) {
|
|
29077
|
+
let candidate = from;
|
|
29078
|
+
while (candidate > floor && !isBoundary(items[candidate])) {
|
|
29079
|
+
candidate--;
|
|
29080
|
+
}
|
|
29081
|
+
return candidate;
|
|
29082
|
+
}
|
|
29083
|
+
__name(findBoundaryAtOrBefore, "findBoundaryAtOrBefore");
|
|
29084
|
+
function findReplayBoundaryAtOrBefore(index, from, floor, isBoundary) {
|
|
29085
|
+
return findBoundaryAtOrBefore(
|
|
29086
|
+
index.activeUuids,
|
|
29087
|
+
from,
|
|
29088
|
+
floor,
|
|
29089
|
+
(uuid) => isBoundary(index, uuid)
|
|
29090
|
+
);
|
|
29091
|
+
}
|
|
29092
|
+
__name(findReplayBoundaryAtOrBefore, "findReplayBoundaryAtOrBefore");
|
|
29093
|
+
function backwardPageBytesFit(index, start, end, budget) {
|
|
29094
|
+
let total = 0;
|
|
29095
|
+
for (let i = start; i < end; i++) {
|
|
29096
|
+
total += recordSegmentBytes(index, index.activeUuids[i]);
|
|
29097
|
+
if (total > budget) return false;
|
|
29098
|
+
}
|
|
29099
|
+
return true;
|
|
29100
|
+
}
|
|
29101
|
+
__name(backwardPageBytesFit, "backwardPageBytesFit");
|
|
29102
|
+
function selectionOrphansToolResult(index, start, end) {
|
|
29103
|
+
for (let i = start; i < end; i++) {
|
|
29104
|
+
if (index.byUuid.get(index.activeUuids[i])?.type !== "tool_result") {
|
|
29105
|
+
continue;
|
|
29106
|
+
}
|
|
29107
|
+
for (let owner = i - 1; owner >= start; owner--) {
|
|
29108
|
+
if (isReplayPageStart(index, index.activeUuids[owner])) return false;
|
|
29109
|
+
}
|
|
29110
|
+
return true;
|
|
29111
|
+
}
|
|
29112
|
+
return false;
|
|
29113
|
+
}
|
|
29114
|
+
__name(selectionOrphansToolResult, "selectionOrphansToolResult");
|
|
29115
|
+
function selectBackwardPageUuids(index, sessionId, position, limit, maxBytes) {
|
|
29116
|
+
if (position === 0) return { uuids: [], nextPosition: 0 };
|
|
29117
|
+
const expansionByteBudget = maxBytes === void 0 ? getExpandedPageBytes() : Math.min(2 * maxBytes, getExpandedPageBytes());
|
|
29413
29118
|
let start = Math.max(0, position - limit);
|
|
29414
29119
|
for (let i = start; i < position; i++) {
|
|
29415
29120
|
if (isReplayTurnStart(index, index.activeUuids[i])) {
|
|
@@ -29417,8 +29122,15 @@ function selectBackwardPageUuids(index, position, limit, maxBytes) {
|
|
|
29417
29122
|
break;
|
|
29418
29123
|
}
|
|
29419
29124
|
}
|
|
29420
|
-
|
|
29421
|
-
|
|
29125
|
+
const expansionFloor = Math.max(0, position - 2 * limit);
|
|
29126
|
+
const expandedStart = findReplayBoundaryAtOrBefore(
|
|
29127
|
+
index,
|
|
29128
|
+
start,
|
|
29129
|
+
expansionFloor,
|
|
29130
|
+
isReplayTurnStart
|
|
29131
|
+
);
|
|
29132
|
+
if (isReplayTurnStart(index, index.activeUuids[expandedStart])) {
|
|
29133
|
+
start = expandedStart;
|
|
29422
29134
|
}
|
|
29423
29135
|
let selectedStart = position;
|
|
29424
29136
|
let selectedBytes = 0;
|
|
@@ -29431,6 +29143,11 @@ function selectBackwardPageUuids(index, position, limit, maxBytes) {
|
|
|
29431
29143
|
selectedStart = i;
|
|
29432
29144
|
selectedBytes += bytes;
|
|
29433
29145
|
}
|
|
29146
|
+
const logTurnExpansionSkipped = /* @__PURE__ */ __name((reason) => {
|
|
29147
|
+
debugLogger14.debug(
|
|
29148
|
+
`backward turn expansion skipped session=${sessionId} start=${index.activeUuids[selectedStart]} reason=${reason}`
|
|
29149
|
+
);
|
|
29150
|
+
}, "logTurnExpansionSkipped");
|
|
29434
29151
|
let alignedToReplayBoundary = false;
|
|
29435
29152
|
for (let i = selectedStart; i < position; i++) {
|
|
29436
29153
|
if (isReplayTurnStart(index, index.activeUuids[i])) {
|
|
@@ -29440,16 +29157,59 @@ function selectBackwardPageUuids(index, position, limit, maxBytes) {
|
|
|
29440
29157
|
}
|
|
29441
29158
|
}
|
|
29442
29159
|
if (alignedToReplayBoundary && selectedStart > 0) {
|
|
29443
|
-
|
|
29444
|
-
|
|
29445
|
-
|
|
29446
|
-
|
|
29160
|
+
const previousTurnStart = findReplayBoundaryAtOrBefore(
|
|
29161
|
+
index,
|
|
29162
|
+
selectedStart - 1,
|
|
29163
|
+
-1,
|
|
29164
|
+
isReplayTurnStart
|
|
29165
|
+
);
|
|
29447
29166
|
if (previousTurnStart < 0) {
|
|
29448
|
-
|
|
29167
|
+
if (expansionFloor === 0 && backwardPageBytesFit(index, 0, position, expansionByteBudget)) {
|
|
29168
|
+
selectedStart = 0;
|
|
29169
|
+
} else {
|
|
29170
|
+
logTurnExpansionSkipped(
|
|
29171
|
+
expansionFloor === 0 ? "byte-budget" : "record-budget"
|
|
29172
|
+
);
|
|
29173
|
+
}
|
|
29449
29174
|
}
|
|
29450
29175
|
} else if (!alignedToReplayBoundary) {
|
|
29451
|
-
|
|
29452
|
-
|
|
29176
|
+
const candidate = findReplayBoundaryAtOrBefore(
|
|
29177
|
+
index,
|
|
29178
|
+
selectedStart,
|
|
29179
|
+
expansionFloor,
|
|
29180
|
+
isReplayTurnStart
|
|
29181
|
+
);
|
|
29182
|
+
if (isReplayTurnStart(index, index.activeUuids[candidate])) {
|
|
29183
|
+
if (backwardPageBytesFit(index, candidate, position, expansionByteBudget)) {
|
|
29184
|
+
selectedStart = candidate;
|
|
29185
|
+
} else {
|
|
29186
|
+
logTurnExpansionSkipped("byte-budget");
|
|
29187
|
+
}
|
|
29188
|
+
}
|
|
29189
|
+
}
|
|
29190
|
+
if (selectedStart > 0 && selectionOrphansToolResult(index, selectedStart, position)) {
|
|
29191
|
+
const pairFloor = Math.max(0, selectedStart - limit);
|
|
29192
|
+
const pairStart = findReplayBoundaryAtOrBefore(
|
|
29193
|
+
index,
|
|
29194
|
+
selectedStart,
|
|
29195
|
+
pairFloor,
|
|
29196
|
+
isReplayPageStart
|
|
29197
|
+
);
|
|
29198
|
+
if (!isReplayPageStart(index, index.activeUuids[pairStart])) {
|
|
29199
|
+
debugLogger14.debug(
|
|
29200
|
+
`backward pair extension skipped session=${sessionId} start=${index.activeUuids[selectedStart]} reason=record-budget`
|
|
29201
|
+
);
|
|
29202
|
+
} else if (!backwardPageBytesFit(
|
|
29203
|
+
index,
|
|
29204
|
+
pairStart + 1,
|
|
29205
|
+
selectedStart,
|
|
29206
|
+
expansionByteBudget
|
|
29207
|
+
)) {
|
|
29208
|
+
debugLogger14.debug(
|
|
29209
|
+
`backward pair extension skipped session=${sessionId} start=${index.activeUuids[selectedStart]} reason=byte-budget`
|
|
29210
|
+
);
|
|
29211
|
+
} else {
|
|
29212
|
+
selectedStart = pairStart;
|
|
29453
29213
|
}
|
|
29454
29214
|
}
|
|
29455
29215
|
return {
|
|
@@ -29624,7 +29384,7 @@ async function readAggregatedRecords(index, uuids) {
|
|
|
29624
29384
|
}
|
|
29625
29385
|
}
|
|
29626
29386
|
__name(readAggregatedRecords, "readAggregatedRecords");
|
|
29627
|
-
async function
|
|
29387
|
+
async function readGoalStatePayloadBeforePosition(index, position) {
|
|
29628
29388
|
let low = 0;
|
|
29629
29389
|
let high = index.goalStatePositions.length;
|
|
29630
29390
|
while (low < high) {
|
|
@@ -29639,9 +29399,9 @@ async function readGoalStateBeforePosition(index, position) {
|
|
|
29639
29399
|
if (goalStatePosition === void 0) return void 0;
|
|
29640
29400
|
const uuid = index.activeUuids[goalStatePosition];
|
|
29641
29401
|
const [record2] = await readAggregatedRecords(index, [uuid]);
|
|
29642
|
-
return parseGoalStateRecordPayloadV2(record2?.systemPayload)
|
|
29402
|
+
return parseGoalStateRecordPayloadV2(record2?.systemPayload);
|
|
29643
29403
|
}
|
|
29644
|
-
__name(
|
|
29404
|
+
__name(readGoalStatePayloadBeforePosition, "readGoalStatePayloadBeforePosition");
|
|
29645
29405
|
async function buildIndex(params) {
|
|
29646
29406
|
const { filePath, fileIdentity, snapshotSize, lastUpdated } = params;
|
|
29647
29407
|
const sessionId = path10.basename(filePath, ".jsonl");
|
|
@@ -29675,7 +29435,7 @@ async function buildIndex(params) {
|
|
|
29675
29435
|
if (!record2 || !isTranscriptConversationRecord(record2)) {
|
|
29676
29436
|
continue;
|
|
29677
29437
|
}
|
|
29678
|
-
if (record2.type === "system" && record2.subtype === "session_source" &&
|
|
29438
|
+
if (record2.type === "system" && record2.subtype === "session_source" && isObjectRecord(record2.systemPayload) && record2.systemPayload["sourceType"] === "side_task") {
|
|
29679
29439
|
sideTaskSourceUuid = record2.uuid;
|
|
29680
29440
|
}
|
|
29681
29441
|
if (record2.timestamp) startTime ??= record2.timestamp;
|
|
@@ -29880,11 +29640,11 @@ var SessionTranscriptReader = class {
|
|
|
29880
29640
|
);
|
|
29881
29641
|
throw new InvalidSessionTranscriptCursorError();
|
|
29882
29642
|
}
|
|
29883
|
-
const backwardPage = direction === "backward" ? selectBackwardPageUuids(index, position, limit, maxBytes) : void 0;
|
|
29643
|
+
const backwardPage = direction === "backward" ? selectBackwardPageUuids(index, sessionId, position, limit, maxBytes) : void 0;
|
|
29884
29644
|
const pageUuids = backwardPage?.uuids ?? selectPageUuids(index, position, limit, maxBytes);
|
|
29885
29645
|
const nextPosition = backwardPage?.nextPosition ?? position + pageUuids.length;
|
|
29886
29646
|
const records = await readAggregatedRecords(index, pageUuids);
|
|
29887
|
-
const backwardGoalState = direction === "backward" ? await
|
|
29647
|
+
const backwardGoalState = direction === "backward" ? await readGoalStatePayloadBeforePosition(index, nextPosition) : void 0;
|
|
29888
29648
|
const hasMore = direction === "backward" ? nextPosition > 0 : nextPosition < index.activeUuids.length;
|
|
29889
29649
|
const nextCursorState = hasMore ? {
|
|
29890
29650
|
v: SESSION_TRANSCRIPT_CURSOR_VERSION,
|
|
@@ -29908,7 +29668,12 @@ var SessionTranscriptReader = class {
|
|
|
29908
29668
|
hasMore,
|
|
29909
29669
|
...direction === "backward" ? { direction: "backward" } : {},
|
|
29910
29670
|
...nextCursorState ? { nextCursorState } : {},
|
|
29911
|
-
...backwardGoalState ? {
|
|
29671
|
+
...backwardGoalState ? {
|
|
29672
|
+
replay: {
|
|
29673
|
+
goalState: backwardGoalState.snapshot,
|
|
29674
|
+
goalCause: backwardGoalState.cause
|
|
29675
|
+
}
|
|
29676
|
+
} : cursor?.replay !== void 0 ? { replay: cursor.replay } : {},
|
|
29912
29677
|
startTime: index.startTime,
|
|
29913
29678
|
lastUpdated: index.lastUpdated
|
|
29914
29679
|
};
|
|
@@ -29923,6 +29688,15 @@ import { createHash as createHash3, randomUUID as randomUUID2 } from "node:crypt
|
|
|
29923
29688
|
import * as fs11 from "node:fs/promises";
|
|
29924
29689
|
import * as os3 from "node:os";
|
|
29925
29690
|
import * as path11 from "node:path";
|
|
29691
|
+
|
|
29692
|
+
// packages/core/src/utils/file-identity.ts
|
|
29693
|
+
init_esbuild_shims();
|
|
29694
|
+
function hasVerifiableInode(ino) {
|
|
29695
|
+
return Number(ino) !== 0;
|
|
29696
|
+
}
|
|
29697
|
+
__name(hasVerifiableInode, "hasVerifiableInode");
|
|
29698
|
+
|
|
29699
|
+
// packages/core/src/services/session-writer-lease.ts
|
|
29926
29700
|
var LEGACY_LOCK_SCHEMA_VERSION = 1;
|
|
29927
29701
|
var LOCK_SCHEMA_VERSION = 2;
|
|
29928
29702
|
var MALFORMED_RETRY_COUNT = 3;
|
|
@@ -30000,12 +29774,31 @@ var SessionWriterUnavailableError = class extends SessionWriterError {
|
|
|
30000
29774
|
static {
|
|
30001
29775
|
__name(this, "SessionWriterUnavailableError");
|
|
30002
29776
|
}
|
|
29777
|
+
// Widened from the literal type so the subclass below can redeclare `name`.
|
|
29778
|
+
// Narrowing this back to a literal makes that subclass fail to compile.
|
|
30003
29779
|
name = "SessionWriterUnavailableError";
|
|
30004
29780
|
rpcCode = SESSION_WRITER_RPC_CODES.session_writer_unavailable;
|
|
30005
29781
|
errorKind = "session_writer_unavailable";
|
|
30006
29782
|
httpStatus = 503;
|
|
30007
29783
|
constructor(options2) {
|
|
30008
|
-
super(
|
|
29784
|
+
super(
|
|
29785
|
+
options2?.message ?? "Session write ownership could not be verified.",
|
|
29786
|
+
options2
|
|
29787
|
+
);
|
|
29788
|
+
}
|
|
29789
|
+
};
|
|
29790
|
+
var SessionTranscriptIdentityUnavailableError = class extends SessionWriterUnavailableError {
|
|
29791
|
+
static {
|
|
29792
|
+
__name(this, "SessionTranscriptIdentityUnavailableError");
|
|
29793
|
+
}
|
|
29794
|
+
name = "SessionTranscriptIdentityUnavailableError";
|
|
29795
|
+
constructor(cause) {
|
|
29796
|
+
super({
|
|
29797
|
+
message: "Session transcript identity could not be verified on this filesystem.",
|
|
29798
|
+
cause: cause ?? new Error(
|
|
29799
|
+
"The session transcript filesystem does not provide a verifiable inode identity (ino=0)."
|
|
29800
|
+
)
|
|
29801
|
+
});
|
|
30009
29802
|
}
|
|
30010
29803
|
};
|
|
30011
29804
|
function isProcessAlive(pid) {
|
|
@@ -30043,11 +29836,11 @@ __name(execFileText, "execFileText");
|
|
|
30043
29836
|
async function readProcessStartIdentity(pid) {
|
|
30044
29837
|
if (process.platform === "linux") {
|
|
30045
29838
|
try {
|
|
30046
|
-
const [
|
|
29839
|
+
const [stat22, bootId] = await Promise.all([
|
|
30047
29840
|
fs11.readFile(`/proc/${pid}/stat`, "utf8"),
|
|
30048
29841
|
fs11.readFile("/proc/sys/kernel/random/boot_id", "utf8")
|
|
30049
29842
|
]);
|
|
30050
|
-
const fields =
|
|
29843
|
+
const fields = stat22.slice(stat22.lastIndexOf(")") + 1).trim().split(/\s+/);
|
|
30051
29844
|
const startTicks = fields[19];
|
|
30052
29845
|
if (!startTicks || !/^\d+$/.test(startTicks) || !/^[0-9a-f-]+$/i.test(bootId.trim())) {
|
|
30053
29846
|
return null;
|
|
@@ -30125,22 +29918,46 @@ async function delay(ms2) {
|
|
|
30125
29918
|
await new Promise((resolve38) => setTimeout(resolve38, ms2));
|
|
30126
29919
|
}
|
|
30127
29920
|
__name(delay, "delay");
|
|
30128
|
-
function transcriptFingerprint(
|
|
29921
|
+
function transcriptFingerprint(stat22) {
|
|
30129
29922
|
return {
|
|
30130
|
-
dev:
|
|
30131
|
-
ino:
|
|
30132
|
-
mode:
|
|
30133
|
-
uid:
|
|
30134
|
-
gid:
|
|
30135
|
-
nlink:
|
|
30136
|
-
birthtimeMs:
|
|
30137
|
-
ctimeMs:
|
|
30138
|
-
mtimeMs:
|
|
29923
|
+
dev: stat22.dev,
|
|
29924
|
+
ino: stat22.ino,
|
|
29925
|
+
mode: stat22.mode,
|
|
29926
|
+
uid: stat22.uid,
|
|
29927
|
+
gid: stat22.gid,
|
|
29928
|
+
nlink: stat22.nlink,
|
|
29929
|
+
birthtimeMs: stat22.birthtimeMs,
|
|
29930
|
+
ctimeMs: stat22.ctimeMs,
|
|
29931
|
+
mtimeMs: stat22.mtimeMs
|
|
30139
29932
|
};
|
|
30140
29933
|
}
|
|
30141
29934
|
__name(transcriptFingerprint, "transcriptFingerprint");
|
|
29935
|
+
function assertVerifiableTranscriptIdentity(fingerprint2) {
|
|
29936
|
+
if (!hasVerifiableInode(fingerprint2.ino)) {
|
|
29937
|
+
throw new SessionTranscriptIdentityUnavailableError();
|
|
29938
|
+
}
|
|
29939
|
+
}
|
|
29940
|
+
__name(assertVerifiableTranscriptIdentity, "assertVerifiableTranscriptIdentity");
|
|
29941
|
+
async function assertTranscriptFilesystemProvidesIdentity(transcriptPath) {
|
|
29942
|
+
let dir = path11.dirname(transcriptPath);
|
|
29943
|
+
for (; ; ) {
|
|
29944
|
+
try {
|
|
29945
|
+
const stat22 = await fs11.stat(dir);
|
|
29946
|
+
assertVerifiableTranscriptIdentity({ ino: stat22.ino });
|
|
29947
|
+
return;
|
|
29948
|
+
} catch (error) {
|
|
29949
|
+
if (error instanceof SessionWriterError) throw error;
|
|
29950
|
+
const code = error.code;
|
|
29951
|
+
if (code !== "ENOENT" && code !== "ENOTDIR") return;
|
|
29952
|
+
const parent = path11.dirname(dir);
|
|
29953
|
+
if (parent === dir) return;
|
|
29954
|
+
dir = parent;
|
|
29955
|
+
}
|
|
29956
|
+
}
|
|
29957
|
+
}
|
|
29958
|
+
__name(assertTranscriptFilesystemProvidesIdentity, "assertTranscriptFilesystemProvidesIdentity");
|
|
30142
29959
|
function sameFileIdentity2(left, right) {
|
|
30143
|
-
return left.dev === right.dev && left.ino === right.ino;
|
|
29960
|
+
return left.ino !== 0 && right.ino !== 0 && left.dev === right.dev && left.ino === right.ino;
|
|
30144
29961
|
}
|
|
30145
29962
|
__name(sameFileIdentity2, "sameFileIdentity");
|
|
30146
29963
|
function sameFileSecurityMetadata(left, right) {
|
|
@@ -30159,11 +29976,13 @@ function sameTranscriptState(left, right) {
|
|
|
30159
29976
|
return sameHardTranscriptState(left, right) && left.fingerprint.birthtimeMs === right.fingerprint.birthtimeMs && left.fingerprint.ctimeMs === right.fingerprint.ctimeMs && left.fingerprint.mtimeMs === right.fingerprint.mtimeMs;
|
|
30160
29977
|
}
|
|
30161
29978
|
__name(sameTranscriptState, "sameTranscriptState");
|
|
30162
|
-
function transcriptStateFromStat(
|
|
29979
|
+
function transcriptStateFromStat(stat22) {
|
|
29980
|
+
const fingerprint2 = transcriptFingerprint(stat22);
|
|
29981
|
+
assertVerifiableTranscriptIdentity(fingerprint2);
|
|
30163
29982
|
return {
|
|
30164
29983
|
exists: true,
|
|
30165
|
-
byteLength:
|
|
30166
|
-
fingerprint:
|
|
29984
|
+
byteLength: stat22.size,
|
|
29985
|
+
fingerprint: fingerprint2
|
|
30167
29986
|
};
|
|
30168
29987
|
}
|
|
30169
29988
|
__name(transcriptStateFromStat, "transcriptStateFromStat");
|
|
@@ -30255,20 +30074,20 @@ async function getOpenTranscriptState(filePath, handle, invalidPathIsChange) {
|
|
|
30255
30074
|
}
|
|
30256
30075
|
__name(getOpenTranscriptState, "getOpenTranscriptState");
|
|
30257
30076
|
async function inspectTranscriptPath(filePath, invalidPathIsChange) {
|
|
30258
|
-
let
|
|
30077
|
+
let stat22;
|
|
30259
30078
|
try {
|
|
30260
|
-
|
|
30079
|
+
stat22 = await fs11.lstat(filePath);
|
|
30261
30080
|
} catch (error) {
|
|
30262
30081
|
if (error.code === "ENOENT") {
|
|
30263
30082
|
return { exists: false, byteLength: 0 };
|
|
30264
30083
|
}
|
|
30265
30084
|
throw error;
|
|
30266
30085
|
}
|
|
30267
|
-
if (!
|
|
30086
|
+
if (!stat22.isFile() || stat22.isSymbolicLink()) {
|
|
30268
30087
|
if (invalidPathIsChange) throw new SessionTranscriptChangedError();
|
|
30269
30088
|
throw new SessionWriterUnavailableError();
|
|
30270
30089
|
}
|
|
30271
|
-
return transcriptStateFromStat(
|
|
30090
|
+
return transcriptStateFromStat(stat22);
|
|
30272
30091
|
}
|
|
30273
30092
|
__name(inspectTranscriptPath, "inspectTranscriptPath");
|
|
30274
30093
|
async function openTranscriptForRead(filePath, expectedState) {
|
|
@@ -30467,15 +30286,10 @@ async function openTranscriptProof(filePath) {
|
|
|
30467
30286
|
if (!beforeStat.isFile() || !pathStat.isFile() || pathStat.isSymbolicLink()) {
|
|
30468
30287
|
throw new SessionWriterUnavailableError();
|
|
30469
30288
|
}
|
|
30470
|
-
const beforeState =
|
|
30471
|
-
|
|
30472
|
-
|
|
30473
|
-
|
|
30474
|
-
};
|
|
30475
|
-
if (!sameFileIdentity2(
|
|
30476
|
-
beforeState.fingerprint,
|
|
30477
|
-
transcriptFingerprint(pathStat)
|
|
30478
|
-
)) {
|
|
30289
|
+
const beforeState = transcriptStateFromStat(beforeStat);
|
|
30290
|
+
const beforePathFingerprint = transcriptFingerprint(pathStat);
|
|
30291
|
+
assertVerifiableTranscriptIdentity(beforePathFingerprint);
|
|
30292
|
+
if (!sameFileIdentity2(beforeState.fingerprint, beforePathFingerprint)) {
|
|
30479
30293
|
throw new SessionTranscriptChangedError();
|
|
30480
30294
|
}
|
|
30481
30295
|
if (beforeStat.size > 0) {
|
|
@@ -30508,15 +30322,10 @@ async function openTranscriptProof(filePath) {
|
|
|
30508
30322
|
handle.stat(),
|
|
30509
30323
|
fs11.lstat(filePath)
|
|
30510
30324
|
]);
|
|
30511
|
-
const afterState =
|
|
30512
|
-
|
|
30513
|
-
|
|
30514
|
-
|
|
30515
|
-
};
|
|
30516
|
-
if (!sameTranscriptState(beforeState, afterState) || !afterPathStat.isFile() || afterPathStat.isSymbolicLink() || !sameFileIdentity2(
|
|
30517
|
-
afterState.fingerprint,
|
|
30518
|
-
transcriptFingerprint(afterPathStat)
|
|
30519
|
-
)) {
|
|
30325
|
+
const afterState = transcriptStateFromStat(afterStat);
|
|
30326
|
+
const afterPathFingerprint = transcriptFingerprint(afterPathStat);
|
|
30327
|
+
assertVerifiableTranscriptIdentity(afterPathFingerprint);
|
|
30328
|
+
if (!sameTranscriptState(beforeState, afterState) || !afterPathStat.isFile() || afterPathStat.isSymbolicLink() || !sameFileIdentity2(afterState.fingerprint, afterPathFingerprint)) {
|
|
30520
30329
|
throw new SessionTranscriptChangedError();
|
|
30521
30330
|
}
|
|
30522
30331
|
const proof = {
|
|
@@ -30555,12 +30364,10 @@ async function validateOpenTranscriptProof(filePath, proof) {
|
|
|
30555
30364
|
if (!handleStat.isFile() || !pathStat.isFile() || pathStat.isSymbolicLink()) {
|
|
30556
30365
|
throw new SessionWriterUnavailableError();
|
|
30557
30366
|
}
|
|
30558
|
-
const current =
|
|
30559
|
-
|
|
30560
|
-
|
|
30561
|
-
|
|
30562
|
-
};
|
|
30563
|
-
if (!sameTranscriptState(current, proof.state) || !sameFileIdentity2(current.fingerprint, transcriptFingerprint(pathStat))) {
|
|
30367
|
+
const current = transcriptStateFromStat(handleStat);
|
|
30368
|
+
const pathFingerprint = transcriptFingerprint(pathStat);
|
|
30369
|
+
assertVerifiableTranscriptIdentity(pathFingerprint);
|
|
30370
|
+
if (!sameTranscriptState(current, proof.state) || !sameFileIdentity2(current.fingerprint, pathFingerprint)) {
|
|
30564
30371
|
throw new SessionTranscriptChangedError();
|
|
30565
30372
|
}
|
|
30566
30373
|
} catch (error) {
|
|
@@ -30697,8 +30504,8 @@ async function removeExactRecord(candidatePath, expectedRaw) {
|
|
|
30697
30504
|
__name(removeExactRecord, "removeExactRecord");
|
|
30698
30505
|
async function inspectExactRecord(candidatePath, expectedRaw) {
|
|
30699
30506
|
try {
|
|
30700
|
-
const
|
|
30701
|
-
if (!
|
|
30507
|
+
const stat22 = await fs11.lstat(candidatePath);
|
|
30508
|
+
if (!stat22.isFile() || stat22.isSymbolicLink()) return { state: "other" };
|
|
30702
30509
|
const raw = await fs11.readFile(candidatePath, "utf8");
|
|
30703
30510
|
return { state: raw === expectedRaw ? "exact" : "other" };
|
|
30704
30511
|
} catch (error) {
|
|
@@ -30752,8 +30559,8 @@ async function releaseTransitionClaim(claimPath, claimRaw) {
|
|
|
30752
30559
|
__name(releaseTransitionClaim, "releaseTransitionClaim");
|
|
30753
30560
|
async function inspectClaimedPrimary(lockPath, sourceRaw, sessionId) {
|
|
30754
30561
|
try {
|
|
30755
|
-
const
|
|
30756
|
-
if (!
|
|
30562
|
+
const stat22 = await fs11.lstat(lockPath);
|
|
30563
|
+
if (!stat22.isFile() || stat22.isSymbolicLink()) return { state: "other" };
|
|
30757
30564
|
const raw = await fs11.readFile(lockPath, "utf8");
|
|
30758
30565
|
if (raw === sourceRaw) return { state: "source" };
|
|
30759
30566
|
const record2 = parseLockRecord(raw);
|
|
@@ -31273,6 +31080,11 @@ var SessionWriterLease = class _SessionWriterLease {
|
|
|
31273
31080
|
void 0,
|
|
31274
31081
|
() => lease.released
|
|
31275
31082
|
);
|
|
31083
|
+
if (!snapshot.state.exists) {
|
|
31084
|
+
await assertTranscriptFilesystemProvidesIdentity(
|
|
31085
|
+
options2.transcriptPath
|
|
31086
|
+
);
|
|
31087
|
+
}
|
|
31276
31088
|
await lease.readOwnedLock();
|
|
31277
31089
|
lease.expectedTranscriptState = snapshot.state;
|
|
31278
31090
|
lease.expectedTranscriptHasher = snapshot.hasher;
|
|
@@ -31299,9 +31111,9 @@ var SessionWriterLease = class _SessionWriterLease {
|
|
|
31299
31111
|
}
|
|
31300
31112
|
static async inspectExistingLock(lockPath, expectedSessionId) {
|
|
31301
31113
|
for (let attempt = 0; attempt < MALFORMED_RETRY_COUNT; attempt++) {
|
|
31302
|
-
let
|
|
31114
|
+
let stat22;
|
|
31303
31115
|
try {
|
|
31304
|
-
|
|
31116
|
+
stat22 = await fs11.lstat(lockPath);
|
|
31305
31117
|
} catch (error) {
|
|
31306
31118
|
if (error.code === "ENOENT") {
|
|
31307
31119
|
return { kind: "missing" };
|
|
@@ -31310,7 +31122,7 @@ var SessionWriterLease = class _SessionWriterLease {
|
|
|
31310
31122
|
cause: error instanceof Error ? error : void 0
|
|
31311
31123
|
});
|
|
31312
31124
|
}
|
|
31313
|
-
if (!
|
|
31125
|
+
if (!stat22.isFile() || stat22.isSymbolicLink()) {
|
|
31314
31126
|
throw new SessionWriterUnavailableError({
|
|
31315
31127
|
cause: new Error("Session writer lock is not a regular file")
|
|
31316
31128
|
});
|
|
@@ -31346,16 +31158,16 @@ var SessionWriterLease = class _SessionWriterLease {
|
|
|
31346
31158
|
}
|
|
31347
31159
|
async readOwnedLock() {
|
|
31348
31160
|
if (this.released) throw new SessionWriterLostError();
|
|
31349
|
-
let
|
|
31161
|
+
let stat22;
|
|
31350
31162
|
try {
|
|
31351
|
-
|
|
31163
|
+
stat22 = await fs11.lstat(this.lockPath);
|
|
31352
31164
|
} catch (error) {
|
|
31353
31165
|
if (error.code === "ENOENT") {
|
|
31354
31166
|
throw new SessionWriterLostError();
|
|
31355
31167
|
}
|
|
31356
31168
|
throw new SessionWriterUnavailableError();
|
|
31357
31169
|
}
|
|
31358
|
-
if (!
|
|
31170
|
+
if (!stat22.isFile() || stat22.isSymbolicLink()) {
|
|
31359
31171
|
throw new SessionWriterLostError();
|
|
31360
31172
|
}
|
|
31361
31173
|
let raw;
|
|
@@ -31454,6 +31266,7 @@ var SessionWriterLease = class _SessionWriterLease {
|
|
|
31454
31266
|
candidateHasher.update(bytes);
|
|
31455
31267
|
const nextByteLength = expectedBefore.byteLength + bytes.byteLength;
|
|
31456
31268
|
await this.readOwnedLock();
|
|
31269
|
+
assertVerifiableTranscriptIdentity(beforeState.fingerprint);
|
|
31457
31270
|
await handle.writeFile(bytes);
|
|
31458
31271
|
await handle.sync();
|
|
31459
31272
|
const afterStat = await handle.stat();
|
|
@@ -31781,8 +31594,8 @@ var SessionWriterLease = class _SessionWriterLease {
|
|
|
31781
31594
|
}
|
|
31782
31595
|
async inspectReleasePath(candidatePath) {
|
|
31783
31596
|
try {
|
|
31784
|
-
const
|
|
31785
|
-
if (!
|
|
31597
|
+
const stat22 = await fs11.lstat(candidatePath);
|
|
31598
|
+
if (!stat22.isFile() || stat22.isSymbolicLink()) return "other";
|
|
31786
31599
|
const raw = await fs11.readFile(candidatePath, "utf8");
|
|
31787
31600
|
return raw === this.lockRecordRaw ? "owned" : "other";
|
|
31788
31601
|
} catch (error) {
|
|
@@ -33476,7 +33289,8 @@ function getResumeTokenCounts(conversation) {
|
|
|
33476
33289
|
if (candidate) {
|
|
33477
33290
|
return {
|
|
33478
33291
|
promptTokenCount: candidate,
|
|
33479
|
-
outputTokenCount: getUsageOutputTokenCountForPromptEstimate(usage)
|
|
33292
|
+
outputTokenCount: getUsageOutputTokenCountForPromptEstimate(usage),
|
|
33293
|
+
isEstimated: false
|
|
33480
33294
|
};
|
|
33481
33295
|
}
|
|
33482
33296
|
}
|
|
@@ -33485,7 +33299,11 @@ function getResumeTokenCounts(conversation) {
|
|
|
33485
33299
|
if (payload?.info) {
|
|
33486
33300
|
return {
|
|
33487
33301
|
promptTokenCount: payload.info.newTokenCount,
|
|
33488
|
-
outputTokenCount: 0
|
|
33302
|
+
outputTokenCount: 0,
|
|
33303
|
+
// Checkpoints created before provenance was persisted are safest to
|
|
33304
|
+
// treat as estimates: this keeps the output clamp's overhead pad on
|
|
33305
|
+
// and prevents an optimistic resume from overflowing the window.
|
|
33306
|
+
isEstimated: payload.info.newTokenCountIsEstimated ?? true
|
|
33489
33307
|
};
|
|
33490
33308
|
}
|
|
33491
33309
|
}
|
|
@@ -34345,15 +34163,17 @@ var ChatRecordingService = class {
|
|
|
34345
34163
|
* Queues the write immediately on the serialized async writer.
|
|
34346
34164
|
*
|
|
34347
34165
|
* @param message The raw PartListUnion object as used with the API
|
|
34166
|
+
* @param goalContext Goal identity and turn that own this message
|
|
34167
|
+
* @param promptPayload User-authored display text and hook-context provenance
|
|
34348
34168
|
*/
|
|
34349
|
-
recordUserMessage(message, goalContext,
|
|
34169
|
+
recordUserMessage(message, goalContext, promptPayload) {
|
|
34350
34170
|
try {
|
|
34351
34171
|
this.turnParentUuids.push(this.lastRecordUuid);
|
|
34352
34172
|
const record2 = {
|
|
34353
34173
|
...this.createBaseRecord("user"),
|
|
34354
34174
|
...goalContext ? { goalContext: copyGoalContext(goalContext) } : {},
|
|
34355
34175
|
message: createUserContent(message),
|
|
34356
|
-
...
|
|
34176
|
+
...promptPayload ? { systemPayload: promptPayload } : {}
|
|
34357
34177
|
};
|
|
34358
34178
|
this.appendRecord(record2);
|
|
34359
34179
|
} catch (error) {
|
|
@@ -35439,18 +35259,9 @@ function getCitations(resp) {
|
|
|
35439
35259
|
}
|
|
35440
35260
|
__name(getCitations, "getCitations");
|
|
35441
35261
|
|
|
35442
|
-
// packages/core/src/core/openaiContentGenerator/prefix-caching.ts
|
|
35443
|
-
init_esbuild_shims();
|
|
35444
|
-
function supportsOpenAIPrefixCaching(contentGeneratorConfig) {
|
|
35445
|
-
return DashScopeOpenAICompatibleProvider.isDashScopeProvider(
|
|
35446
|
-
contentGeneratorConfig
|
|
35447
|
-
);
|
|
35448
|
-
}
|
|
35449
|
-
__name(supportsOpenAIPrefixCaching, "supportsOpenAIPrefixCaching");
|
|
35450
|
-
|
|
35451
35262
|
// packages/core/src/services/postCompactAttachments.ts
|
|
35452
35263
|
init_esbuild_shims();
|
|
35453
|
-
import { readFile as readFile7, stat as
|
|
35264
|
+
import { readFile as readFile7, stat as stat5 } from "node:fs/promises";
|
|
35454
35265
|
import { realpathSync } from "node:fs";
|
|
35455
35266
|
import { resolve as resolvePath2, sep as pathSep } from "node:path";
|
|
35456
35267
|
var POST_COMPACT_MAX_FILES_TO_RESTORE = 5;
|
|
@@ -35585,7 +35396,7 @@ async function readFileSizeAdaptive(filePath, maxTokens, signal) {
|
|
|
35585
35396
|
if (signal?.aborted) return { kind: "missing" };
|
|
35586
35397
|
const maxChars = maxTokens * CHARS_PER_TOKEN;
|
|
35587
35398
|
try {
|
|
35588
|
-
const { size } = await
|
|
35399
|
+
const { size } = await stat5(filePath);
|
|
35589
35400
|
if (size > maxChars * 4) return { kind: "reference" };
|
|
35590
35401
|
} catch {
|
|
35591
35402
|
return { kind: "missing" };
|
|
@@ -35909,9 +35720,12 @@ ${parts.join("\n\n")}`;
|
|
|
35909
35720
|
__name(buildCompressionSystemPrompt, "buildCompressionSystemPrompt");
|
|
35910
35721
|
function supportsCompressionCacheSharing(config) {
|
|
35911
35722
|
const provider = config.getContentGeneratorConfig();
|
|
35723
|
+
if (provider.authType === "gemini" /* USE_GEMINI */ || provider.authType === "vertex-ai" /* USE_VERTEX_AI */) {
|
|
35724
|
+
return true;
|
|
35725
|
+
}
|
|
35912
35726
|
if (provider.enableCacheControl === false) return false;
|
|
35913
35727
|
if (provider.authType === "anthropic" /* USE_ANTHROPIC */) return true;
|
|
35914
|
-
return
|
|
35728
|
+
return supportsOpenAIPrefixCaching(provider);
|
|
35915
35729
|
}
|
|
35916
35730
|
__name(supportsCompressionCacheSharing, "supportsCompressionCacheSharing");
|
|
35917
35731
|
function hasStateSnapshot(summary) {
|
|
@@ -36123,11 +35937,11 @@ Do not call tools; tool execution is disabled for this request. ` + COMPRESSION_
|
|
|
36123
35937
|
);
|
|
36124
35938
|
const usesMainModel = effectiveCompactionModel === config.getModel();
|
|
36125
35939
|
const providerSupportsCacheSharing = supportsCompressionCacheSharing(config);
|
|
36126
|
-
const hasProviderTokenCount = (chat.getLastPromptTokenCount?.() ?? 0) > 0;
|
|
35940
|
+
const hasProviderTokenCount = (chat.getLastPromptTokenCount?.() ?? 0) > 0 && chat.isLastPromptTokenCountEstimated?.() !== true;
|
|
36127
35941
|
const sharedRequestFits = sharedPromptTokenCount + sharedDirectiveTokenCount + COMPACT_MAX_OUTPUT_TOKENS <= contextLimit;
|
|
36128
35942
|
const canShareCache = usesMainModel && providerSupportsCacheSharing && hasProviderTokenCount && sharedRequestFits;
|
|
36129
35943
|
if (!canShareCache) {
|
|
36130
|
-
const reason = !usesMainModel ? "distinct compaction model" : !providerSupportsCacheSharing ? "provider does not support cache sharing" : !hasProviderTokenCount ? "no provider token-count anchor" : `shared request exceeds context window: prompt=${sharedPromptTokenCount}, directive=${sharedDirectiveTokenCount}, reserve=${COMPACT_MAX_OUTPUT_TOKENS}, window=${contextLimit}`;
|
|
35944
|
+
const reason = !usesMainModel ? "distinct compaction model" : !providerSupportsCacheSharing ? "provider does not support cache sharing" : !hasProviderTokenCount ? "no provider-reported token-count anchor" : `shared request exceeds context window: prompt=${sharedPromptTokenCount}, directive=${sharedDirectiveTokenCount}, reserve=${COMPACT_MAX_OUTPUT_TOKENS}, window=${contextLimit}`;
|
|
36131
35945
|
debugLogger20.debug(`[compaction] skipping cache sharing: ${reason}`);
|
|
36132
35946
|
}
|
|
36133
35947
|
if (canShareCache) {
|
|
@@ -36139,6 +35953,7 @@ Do not call tools; tool execution is disabled for this request. ` + COMPRESSION_
|
|
|
36139
35953
|
const mainSystemInstruction = generationConfig.systemInstruction;
|
|
36140
35954
|
delete generationConfig.systemInstruction;
|
|
36141
35955
|
delete generationConfig.abortSignal;
|
|
35956
|
+
const authType = config.getContentGeneratorConfig().authType;
|
|
36142
35957
|
const sharedResult = await config.getBaseLlmClient().generateText({
|
|
36143
35958
|
contents: [
|
|
36144
35959
|
...sideQueryHistory,
|
|
@@ -36155,7 +35970,7 @@ Do not call tools; tool execution is disabled for this request. ` + COMPRESSION_
|
|
|
36155
35970
|
systemInstruction: mainSystemInstruction,
|
|
36156
35971
|
config: {
|
|
36157
35972
|
...generationConfig,
|
|
36158
|
-
...
|
|
35973
|
+
...authType === "anthropic" /* USE_ANTHROPIC */ ? {
|
|
36159
35974
|
thinkingConfig: {
|
|
36160
35975
|
...generationConfig.thinkingConfig,
|
|
36161
35976
|
// Manual Anthropic thinking requires budget_tokens to be
|
|
@@ -36163,13 +35978,19 @@ Do not call tools; tool execution is disabled for this request. ` + COMPRESSION_
|
|
|
36163
35978
|
// compatibility while keeping this bounded request valid.
|
|
36164
35979
|
thinkingBudget: COMPACT_MAX_OUTPUT_TOKENS - 1
|
|
36165
35980
|
}
|
|
35981
|
+
} : authType === "gemini" /* USE_GEMINI */ || authType === "vertex-ai" /* USE_VERTEX_AI */ ? {
|
|
35982
|
+
thinkingConfig: {
|
|
35983
|
+
...generationConfig.thinkingConfig,
|
|
35984
|
+
includeThoughts: false
|
|
35985
|
+
}
|
|
36166
35986
|
} : {},
|
|
36167
35987
|
maxOutputTokens: COMPACT_MAX_OUTPUT_TOKENS
|
|
36168
35988
|
},
|
|
36169
35989
|
abortSignal,
|
|
36170
35990
|
promptId,
|
|
36171
35991
|
stream: true,
|
|
36172
|
-
maxAttempts: 1
|
|
35992
|
+
maxAttempts: 1,
|
|
35993
|
+
promptCacheSharing: true
|
|
36173
35994
|
});
|
|
36174
35995
|
if (!sharedResult.hadToolCall && hasStateSnapshot(sharedResult.text)) {
|
|
36175
35996
|
summaryResult = sharedResult;
|
|
@@ -36367,6 +36188,7 @@ Do not call tools; tool execution is disabled for this request. ` + COMPRESSION_
|
|
|
36367
36188
|
info: {
|
|
36368
36189
|
originalTokenCount,
|
|
36369
36190
|
newTokenCount,
|
|
36191
|
+
newTokenCountIsEstimated: true,
|
|
36370
36192
|
compressionStatus: 1 /* COMPRESSED */,
|
|
36371
36193
|
triggerReason,
|
|
36372
36194
|
...compactionWarning && { warning: compactionWarning }
|
|
@@ -37067,7 +36889,7 @@ function syncFunctionCallsField(response, parts) {
|
|
|
37067
36889
|
__name(syncFunctionCallsField, "syncFunctionCallsField");
|
|
37068
36890
|
function canonicalPlanToolName(toolName) {
|
|
37069
36891
|
if (!toolName) return "";
|
|
37070
|
-
return
|
|
36892
|
+
return canonicalToolName(toolName);
|
|
37071
36893
|
}
|
|
37072
36894
|
__name(canonicalPlanToolName, "canonicalPlanToolName");
|
|
37073
36895
|
function approvedPlanRedactionText(planPath) {
|
|
@@ -37179,7 +37001,7 @@ var TRANSPORT_STREAM_RETRY_CONFIG = {
|
|
|
37179
37001
|
*/
|
|
37180
37002
|
maxContinuationRetries: 3
|
|
37181
37003
|
};
|
|
37182
|
-
var
|
|
37004
|
+
var ESTIMATE_CLAMP_OVERHEAD_PAD = 2e4;
|
|
37183
37005
|
var MAX_OUTPUT_RECOVERY_ATTEMPTS = 3;
|
|
37184
37006
|
var RECOVERY_RESUME_INSTRUCTION = "Resume directly \u2014 no apology, no recap of what you were doing. Pick up mid-thought if that is where the cut happened. Break remaining work into smaller pieces.";
|
|
37185
37007
|
var OUTPUT_RECOVERY_MESSAGE = `Output token limit hit. ${RECOVERY_RESUME_INSTRUCTION}`;
|
|
@@ -37283,6 +37105,10 @@ ${suffix}`;
|
|
|
37283
37105
|
return continuationText;
|
|
37284
37106
|
}
|
|
37285
37107
|
__name(getRecoveryContinuationSuffix, "getRecoveryContinuationSuffix");
|
|
37108
|
+
function mergeDeliveredPrefix(deliveredText, continuationText) {
|
|
37109
|
+
return deliveredText + getRecoveryContinuationSuffix(deliveredText, continuationText);
|
|
37110
|
+
}
|
|
37111
|
+
__name(mergeDeliveredPrefix, "mergeDeliveredPrefix");
|
|
37286
37112
|
function isPlainTextPart(part) {
|
|
37287
37113
|
return part !== void 0 && isValidNonThoughtTextPart(part);
|
|
37288
37114
|
}
|
|
@@ -37784,6 +37610,7 @@ var GeminiChat = class {
|
|
|
37784
37610
|
* still make compaction decisions based on their *own* context size.
|
|
37785
37611
|
*/
|
|
37786
37612
|
lastPromptTokenCount = 0;
|
|
37613
|
+
lastPromptTokenCountIsEstimated = false;
|
|
37787
37614
|
/**
|
|
37788
37615
|
* Per-chat output-token count from the previous model response. The
|
|
37789
37616
|
* previous response is appended to local history after `promptTokenCount`
|
|
@@ -37932,18 +37759,26 @@ var GeminiChat = class {
|
|
|
37932
37759
|
* comes from a different chat instance and should not inherit this chat's
|
|
37933
37760
|
* last response size.
|
|
37934
37761
|
*/
|
|
37935
|
-
setLastPromptTokenCount(count) {
|
|
37762
|
+
setLastPromptTokenCount(count, isEstimated = false) {
|
|
37936
37763
|
this.lastPromptTokenCount = count;
|
|
37764
|
+
this.lastPromptTokenCountIsEstimated = isEstimated;
|
|
37937
37765
|
this.lastOutputTokenCount = 0;
|
|
37938
37766
|
}
|
|
37767
|
+
isLastPromptTokenCountEstimated() {
|
|
37768
|
+
return this.lastPromptTokenCountIsEstimated;
|
|
37769
|
+
}
|
|
37770
|
+
promptCountIsEstimateDerived() {
|
|
37771
|
+
return this.lastPromptTokenCount === 0 || this.lastPromptTokenCountIsEstimated;
|
|
37772
|
+
}
|
|
37939
37773
|
/**
|
|
37940
37774
|
* Seed the restored prompt and previous-response output token counts in one
|
|
37941
|
-
* step. Resume restores chat history plus both counters
|
|
37942
|
-
*
|
|
37775
|
+
* step. Resume restores chat history plus both counters and their provenance
|
|
37776
|
+
* from the same checkpoint, so callers must avoid the normal
|
|
37943
37777
|
* setLastPromptTokenCount() clearing behavior.
|
|
37944
37778
|
*/
|
|
37945
|
-
seedResumeTokenCounts(promptTokenCount, outputTokenCount) {
|
|
37779
|
+
seedResumeTokenCounts(promptTokenCount, outputTokenCount, isEstimated = false) {
|
|
37946
37780
|
this.lastPromptTokenCount = Number.isFinite(promptTokenCount) ? Math.max(0, promptTokenCount) : 0;
|
|
37781
|
+
this.lastPromptTokenCountIsEstimated = isEstimated;
|
|
37947
37782
|
this.lastOutputTokenCount = Number.isFinite(outputTokenCount) ? Math.max(0, outputTokenCount) : 0;
|
|
37948
37783
|
}
|
|
37949
37784
|
/**
|
|
@@ -37958,13 +37793,21 @@ var GeminiChat = class {
|
|
|
37958
37793
|
* post-compression guards pass.
|
|
37959
37794
|
*/
|
|
37960
37795
|
async tryCompress(promptId, force = false, signal, options2) {
|
|
37796
|
+
const originalTokenCountIsEstimated = options2?.originalTokenCountOverride === void 0 && this.promptCountIsEstimateDerived();
|
|
37797
|
+
const originalTokenCount = originalTokenCountIsEstimated ? options2?.precomputedEffectiveTokens ?? estimateContentTokens(
|
|
37798
|
+
options2?.pendingUserMessage ? [...this.getHistoryShallow(true), options2.pendingUserMessage] : this.getHistoryShallow(true),
|
|
37799
|
+
resolveSlimmingConfig(this.config.getChatCompression()).imageTokenEstimate
|
|
37800
|
+
) : options2?.originalTokenCountOverride ?? this.lastPromptTokenCount;
|
|
37801
|
+
debugLogger22.debug(
|
|
37802
|
+
`[compaction] token-count provenance: prompt_id=${promptId}, originalTokenCount=${originalTokenCount}, estimated=${originalTokenCountIsEstimated}`
|
|
37803
|
+
);
|
|
37961
37804
|
const service = new ChatCompressionService();
|
|
37962
37805
|
const { newHistory, info } = await service.compress(this, {
|
|
37963
37806
|
promptId,
|
|
37964
37807
|
force,
|
|
37965
37808
|
config: this.config,
|
|
37966
37809
|
consecutiveFailures: this.consecutiveFailures,
|
|
37967
|
-
originalTokenCount
|
|
37810
|
+
originalTokenCount,
|
|
37968
37811
|
pendingUserMessage: options2?.pendingUserMessage,
|
|
37969
37812
|
precomputedEffectiveTokens: options2?.precomputedEffectiveTokens,
|
|
37970
37813
|
requestGenerationConfig: options2?.requestGenerationConfig,
|
|
@@ -37973,6 +37816,7 @@ var GeminiChat = class {
|
|
|
37973
37816
|
signal
|
|
37974
37817
|
});
|
|
37975
37818
|
if (info.compressionStatus === 1 /* COMPRESSED */ && newHistory) {
|
|
37819
|
+
info.newTokenCountIsEstimated ??= true;
|
|
37976
37820
|
if (!options2?.deferChatCompressionRecord) {
|
|
37977
37821
|
this.chatRecordingService?.recordChatCompression({
|
|
37978
37822
|
info,
|
|
@@ -37982,8 +37826,10 @@ var GeminiChat = class {
|
|
|
37982
37826
|
this.setHistory(newHistory);
|
|
37983
37827
|
debugLogger22.debug("[FILE_READ_CACHE] clear after auto tryCompress");
|
|
37984
37828
|
this.config.getFileReadCache().clear();
|
|
37985
|
-
this.
|
|
37986
|
-
|
|
37829
|
+
this.setLastPromptTokenCount(
|
|
37830
|
+
info.newTokenCount,
|
|
37831
|
+
info.newTokenCountIsEstimated
|
|
37832
|
+
);
|
|
37987
37833
|
this.telemetryService?.setLastPromptTokenCount(info.newTokenCount);
|
|
37988
37834
|
this.consecutiveFailures = 0;
|
|
37989
37835
|
this.hardRescueFailureCount = 0;
|
|
@@ -38033,10 +37879,15 @@ var GeminiChat = class {
|
|
|
38033
37879
|
}
|
|
38034
37880
|
const reduction = beforeEstimate - afterEstimate;
|
|
38035
37881
|
const apiBaseline = this.lastPromptTokenCount || beforeEstimate;
|
|
37882
|
+
const baselineIsEstimated = this.promptCountIsEstimateDerived();
|
|
38036
37883
|
const adjustedTokenCount = Math.max(0, apiBaseline - reduction);
|
|
37884
|
+
debugLogger22.debug(
|
|
37885
|
+
`[compaction] fast token-count provenance: originalTokenCount=${apiBaseline}, estimated=${baselineIsEstimated}`
|
|
37886
|
+
);
|
|
38037
37887
|
const info = {
|
|
38038
37888
|
originalTokenCount: apiBaseline,
|
|
38039
37889
|
newTokenCount: adjustedTokenCount,
|
|
37890
|
+
newTokenCountIsEstimated: true,
|
|
38040
37891
|
compressionStatus: 1 /* COMPRESSED */,
|
|
38041
37892
|
triggerReason: "manual"
|
|
38042
37893
|
};
|
|
@@ -38053,6 +37904,7 @@ var GeminiChat = class {
|
|
|
38053
37904
|
);
|
|
38054
37905
|
this.setHistory(newHistory);
|
|
38055
37906
|
this.lastPromptTokenCount = adjustedTokenCount;
|
|
37907
|
+
this.lastPromptTokenCountIsEstimated = true;
|
|
38056
37908
|
this.telemetryService?.setLastPromptTokenCount(adjustedTokenCount);
|
|
38057
37909
|
this.consecutiveFailures = 0;
|
|
38058
37910
|
return { info, microcompactMeta: mcMeta };
|
|
@@ -38173,6 +38025,7 @@ var GeminiChat = class {
|
|
|
38173
38025
|
const shouldForceFromHard = !exactRoute && isHardTier && this.hardRescueFailureCount < MAX_CONSECUTIVE_FAILURES;
|
|
38174
38026
|
const historyBeforeHardRescue = shouldForceFromHard ? this.getHistoryShallow() : void 0;
|
|
38175
38027
|
const lastPromptTokenCountBeforeHardRescue = this.lastPromptTokenCount;
|
|
38028
|
+
const lastPromptTokenCountWasEstimatedBeforeHardRescue = this.lastPromptTokenCountIsEstimated;
|
|
38176
38029
|
const hardRescueFailureCountBeforeHardRescue = this.hardRescueFailureCount;
|
|
38177
38030
|
if (shouldForceFromHard) {
|
|
38178
38031
|
debugLogger22.warn(
|
|
@@ -38232,6 +38085,7 @@ var GeminiChat = class {
|
|
|
38232
38085
|
if (compressionInfo.compressionStatus === 1 /* COMPRESSED */ && historyBeforeHardRescue) {
|
|
38233
38086
|
this.setHistory(historyBeforeHardRescue);
|
|
38234
38087
|
this.lastPromptTokenCount = lastPromptTokenCountBeforeHardRescue;
|
|
38088
|
+
this.lastPromptTokenCountIsEstimated = lastPromptTokenCountWasEstimatedBeforeHardRescue;
|
|
38235
38089
|
this.telemetryService?.setLastPromptTokenCount(
|
|
38236
38090
|
lastPromptTokenCountBeforeHardRescue
|
|
38237
38091
|
);
|
|
@@ -38293,7 +38147,13 @@ var GeminiChat = class {
|
|
|
38293
38147
|
imageTokenEstimate,
|
|
38294
38148
|
/* conservative= */
|
|
38295
38149
|
true
|
|
38296
|
-
) : effectiveTokens
|
|
38150
|
+
) : effectiveTokens;
|
|
38151
|
+
if (this.promptCountIsEstimateDerived()) {
|
|
38152
|
+
promptTokensForClamp += ESTIMATE_CLAMP_OVERHEAD_PAD;
|
|
38153
|
+
debugLogger22.debug(
|
|
38154
|
+
`[clamp] estimate-derived prompt count; padded by ${ESTIMATE_CLAMP_OVERHEAD_PAD}: promptTokensForClamp=${promptTokensForClamp}, count=${this.lastPromptTokenCount}`
|
|
38155
|
+
);
|
|
38156
|
+
}
|
|
38297
38157
|
const clampedMaxOutputTokens = clampOutputTokensToWindow(
|
|
38298
38158
|
outputCeiling,
|
|
38299
38159
|
contextWindowForClamp,
|
|
@@ -38414,7 +38274,11 @@ var GeminiChat = class {
|
|
|
38414
38274
|
params,
|
|
38415
38275
|
prompt_id,
|
|
38416
38276
|
requestOverrides,
|
|
38417
|
-
turnGoalContext
|
|
38277
|
+
turnGoalContext,
|
|
38278
|
+
// Captured by value, so the attempt records exactly the prefix
|
|
38279
|
+
// `buildAttemptContents()` just asked the model to resume from,
|
|
38280
|
+
// even if a later branch resets the continuation.
|
|
38281
|
+
transportContinuationPrefix.length > 0 ? transportContinuationPrefix : void 0
|
|
38418
38282
|
);
|
|
38419
38283
|
lastFinishReason = void 0;
|
|
38420
38284
|
for await (const chunk of stream2) {
|
|
@@ -38435,10 +38299,7 @@ var GeminiChat = class {
|
|
|
38435
38299
|
yield { type: "chunk" /* CHUNK */, value: chunk };
|
|
38436
38300
|
}
|
|
38437
38301
|
lastError = null;
|
|
38438
|
-
|
|
38439
|
-
self2.prependTextToLastModelTurn(transportContinuationPrefix);
|
|
38440
|
-
transportContinuationPrefix = "";
|
|
38441
|
-
}
|
|
38302
|
+
transportContinuationPrefix = "";
|
|
38442
38303
|
break;
|
|
38443
38304
|
} catch (error) {
|
|
38444
38305
|
lastError = error;
|
|
@@ -38846,7 +38707,7 @@ var GeminiChat = class {
|
|
|
38846
38707
|
const walkRecoveryEstimate = estimateContentTokens(
|
|
38847
38708
|
recoveryContents,
|
|
38848
38709
|
recoveryImageTokenEstimate
|
|
38849
|
-
) +
|
|
38710
|
+
) + ESTIMATE_CLAMP_OVERHEAD_PAD;
|
|
38850
38711
|
const recoveryPromptEstimate = Math.max(
|
|
38851
38712
|
countBasedRecoveryEstimate,
|
|
38852
38713
|
walkRecoveryEstimate
|
|
@@ -39093,7 +38954,7 @@ var GeminiChat = class {
|
|
|
39093
38954
|
* by the fallback chain to call alternative models without duplicating
|
|
39094
38955
|
* the retry wiring.
|
|
39095
38956
|
*/
|
|
39096
|
-
async makeApiCallAndProcessStream(model, requestContents, params, prompt_id, overrides, goalContext) {
|
|
38957
|
+
async makeApiCallAndProcessStream(model, requestContents, params, prompt_id, overrides, goalContext, transportContinuationPrefix) {
|
|
39097
38958
|
const generator = overrides?.contentGenerator ?? this.config.getContentGenerator();
|
|
39098
38959
|
const apiCall = /* @__PURE__ */ __name(() => generator.generateContentStream(
|
|
39099
38960
|
{
|
|
@@ -39150,7 +39011,12 @@ var GeminiChat = class {
|
|
|
39150
39011
|
);
|
|
39151
39012
|
}, "onRetry")
|
|
39152
39013
|
});
|
|
39153
|
-
return this.processStreamResponse(
|
|
39014
|
+
return this.processStreamResponse(
|
|
39015
|
+
model,
|
|
39016
|
+
streamResponse,
|
|
39017
|
+
goalContext,
|
|
39018
|
+
transportContinuationPrefix
|
|
39019
|
+
);
|
|
39154
39020
|
}
|
|
39155
39021
|
async *makeFallbackStream(model, requestContents, params, prompt_id, contentGenerator, retryAuthType, retryErrorCodes, goalContext) {
|
|
39156
39022
|
const stream2 = await this.makeApiCallAndProcessStream(
|
|
@@ -39471,7 +39337,15 @@ This error was probably caused by cyclic schema references in one of the followi
|
|
|
39471
39337
|
}
|
|
39472
39338
|
}
|
|
39473
39339
|
}
|
|
39474
|
-
|
|
39340
|
+
/**
|
|
39341
|
+
* @param transportContinuationPrefix - Text a previous attempt already
|
|
39342
|
+
* delivered before a socket cut, which this attempt was asked to resume
|
|
39343
|
+
* from (issue #7832). On success it is folded into the response parts
|
|
39344
|
+
* before either durable write, so the JSONL transcript and in-memory
|
|
39345
|
+
* history carry the same merged turn (issue #8094). Undefined on every
|
|
39346
|
+
* non-continuation send.
|
|
39347
|
+
*/
|
|
39348
|
+
async *processStreamResponse(model, streamResponse, goalContext, transportContinuationPrefix) {
|
|
39475
39349
|
const allModelParts = [];
|
|
39476
39350
|
const usedToolCallIds = collectToolCallIdsFromHistory(this.history);
|
|
39477
39351
|
const rawToolCallIdsInCurrentTurn = /* @__PURE__ */ new Set();
|
|
@@ -39619,6 +39493,7 @@ This error was probably caused by cyclic schema references in one of the followi
|
|
|
39619
39493
|
const lastPromptTokenCount = hasUsablePromptTokenCount ? promptTokenCount : totalTokenCount;
|
|
39620
39494
|
if (lastPromptTokenCount) {
|
|
39621
39495
|
this.lastPromptTokenCount = lastPromptTokenCount;
|
|
39496
|
+
this.lastPromptTokenCountIsEstimated = false;
|
|
39622
39497
|
this.lastOutputTokenCount = hasUsablePromptTokenCount ? getUsageOutputTokenCountForPromptEstimate({
|
|
39623
39498
|
promptTokenCount,
|
|
39624
39499
|
...hasUsableTotalTokenCount ? { totalTokenCount } : {},
|
|
@@ -39768,6 +39643,22 @@ This error was probably caused by cyclic schema references in one of the followi
|
|
|
39768
39643
|
yield recoveredChunk;
|
|
39769
39644
|
}
|
|
39770
39645
|
const willPersistToHistory = streamError === null || hasToolCall && (thoughtContentPart || consolidatedHistoryParts.length > 0);
|
|
39646
|
+
if (streamError === null && transportContinuationPrefix) {
|
|
39647
|
+
const textIndex = consolidatedHistoryParts.findIndex(isPlainTextPart);
|
|
39648
|
+
if (textIndex < 0) {
|
|
39649
|
+
consolidatedHistoryParts.unshift({ text: transportContinuationPrefix });
|
|
39650
|
+
} else {
|
|
39651
|
+
const remainderPart = consolidatedHistoryParts[textIndex];
|
|
39652
|
+
consolidatedHistoryParts[textIndex] = {
|
|
39653
|
+
...remainderPart,
|
|
39654
|
+
text: mergeDeliveredPrefix(
|
|
39655
|
+
transportContinuationPrefix,
|
|
39656
|
+
remainderPart.text
|
|
39657
|
+
)
|
|
39658
|
+
};
|
|
39659
|
+
}
|
|
39660
|
+
contentText = consolidatedHistoryParts.filter((part) => part.text).map((part) => part.text).join("").trim();
|
|
39661
|
+
}
|
|
39771
39662
|
if (willPersistToHistory && (thoughtContentPart || contentText || hasToolCall || usageMetadata)) {
|
|
39772
39663
|
const contextWindowSize = this.config.getContentGeneratorConfig()?.contextWindowSize;
|
|
39773
39664
|
const recordArgs = {
|
|
@@ -39819,49 +39710,6 @@ This error was probably caused by cyclic schema references in one of the followi
|
|
|
39819
39710
|
};
|
|
39820
39711
|
}
|
|
39821
39712
|
}
|
|
39822
|
-
/**
|
|
39823
|
-
* Prepend already-delivered text to the trailing model turn.
|
|
39824
|
-
*
|
|
39825
|
-
* Used by the transport-continuation path (issue #7832): after a socket cut
|
|
39826
|
-
* mid-response, the caller has seen text that `processStreamResponse`
|
|
39827
|
-
* deliberately did not persist, and the continuation attempt's own turn
|
|
39828
|
-
* carries only the resumed remainder. Without this, durable history would
|
|
39829
|
-
* hold an answer that starts mid-sentence — visibly wrong on `/compress`,
|
|
39830
|
-
* `--resume`, and every later turn's context.
|
|
39831
|
-
*
|
|
39832
|
-
* The delivered text is merged into the turn's first plain-text part (kept
|
|
39833
|
-
* after any leading thought part, matching the
|
|
39834
|
-
* `[thoughtPart?, ...text]` shape `processStreamResponse` produces), or
|
|
39835
|
-
* inserted as a new part when the continuation returned no text of its own.
|
|
39836
|
-
* Overlap is deduped by the same helper the output-recovery merge uses, so a
|
|
39837
|
-
* model that replays part of its previous tail does not double it.
|
|
39838
|
-
*/
|
|
39839
|
-
prependTextToLastModelTurn(deliveredText) {
|
|
39840
|
-
if (deliveredText.length === 0) return;
|
|
39841
|
-
const lastEntry = this.history.at(-1);
|
|
39842
|
-
if (lastEntry?.role !== "model") {
|
|
39843
|
-
debugLogger22.warn(
|
|
39844
|
-
"[TRANSPORT_CONTINUATION] Trailing entry is not a model turn; dropping the delivered-text merge.",
|
|
39845
|
-
{ role: lastEntry?.role ?? "undefined" }
|
|
39846
|
-
);
|
|
39847
|
-
return;
|
|
39848
|
-
}
|
|
39849
|
-
const parts = [...lastEntry.parts ?? []];
|
|
39850
|
-
const textIndex = parts.findIndex(isPlainTextPart);
|
|
39851
|
-
if (textIndex < 0) {
|
|
39852
|
-
const insertAt = parts.findIndex((part) => !part.thought);
|
|
39853
|
-
parts.splice(insertAt < 0 ? parts.length : insertAt, 0, {
|
|
39854
|
-
text: deliveredText
|
|
39855
|
-
});
|
|
39856
|
-
} else {
|
|
39857
|
-
const continuationPart = parts[textIndex];
|
|
39858
|
-
parts[textIndex] = {
|
|
39859
|
-
...continuationPart,
|
|
39860
|
-
text: deliveredText + getRecoveryContinuationSuffix(deliveredText, continuationPart.text)
|
|
39861
|
-
};
|
|
39862
|
-
}
|
|
39863
|
-
lastEntry.parts = parts;
|
|
39864
|
-
}
|
|
39865
39713
|
/**
|
|
39866
39714
|
* Merge `pairCount` trailing (user_recovery, model_continuation) pairs back
|
|
39867
39715
|
* into the model turn that precedes them. Used after the output-token
|
|
@@ -39933,6 +39781,19 @@ function canonicalizeForHash(value) {
|
|
|
39933
39781
|
return value;
|
|
39934
39782
|
}
|
|
39935
39783
|
__name(canonicalizeForHash, "canonicalizeForHash");
|
|
39784
|
+
function getToolCallRepeatKey(toolName, args) {
|
|
39785
|
+
const argsString = JSON.stringify(canonicalizeForHash(args));
|
|
39786
|
+
const keyString = `${canonicalToolName(toolName)}:${argsString}`;
|
|
39787
|
+
return createHash5("sha256").update(keyString).digest("hex");
|
|
39788
|
+
}
|
|
39789
|
+
__name(getToolCallRepeatKey, "getToolCallRepeatKey");
|
|
39790
|
+
function shouldHaltOnTurnToolCallCap(totalCalls, maxKeyRepeat, cap, isExplicitCap) {
|
|
39791
|
+
if (totalCalls <= cap) return false;
|
|
39792
|
+
const hardCap = cap * ADAPTIVE_CAP_HARD_MULTIPLIER;
|
|
39793
|
+
const stuck = maxKeyRepeat >= GLOBAL_DUPLICATE_THRESHOLD;
|
|
39794
|
+
return isExplicitCap || totalCalls > hardCap || stuck;
|
|
39795
|
+
}
|
|
39796
|
+
__name(shouldHaltOnTurnToolCallCap, "shouldHaltOnTurnToolCallCap");
|
|
39936
39797
|
var LoopDetectionService = class _LoopDetectionService {
|
|
39937
39798
|
static {
|
|
39938
39799
|
__name(this, "LoopDetectionService");
|
|
@@ -40024,9 +39885,7 @@ var LoopDetectionService = class _LoopDetectionService {
|
|
|
40024
39885
|
);
|
|
40025
39886
|
}
|
|
40026
39887
|
getToolCallKey(toolCall) {
|
|
40027
|
-
|
|
40028
|
-
const keyString = `${toolCall.name}:${argsString}`;
|
|
40029
|
-
return createHash5("sha256").update(keyString).digest("hex");
|
|
39888
|
+
return getToolCallRepeatKey(toolCall.name, toolCall.args);
|
|
40030
39889
|
}
|
|
40031
39890
|
/**
|
|
40032
39891
|
* Convenience aggregate that runs every tier in order: the always-on
|
|
@@ -40486,22 +40345,20 @@ var LoopDetectionService = class _LoopDetectionService {
|
|
|
40486
40345
|
*/
|
|
40487
40346
|
checkTurnToolCallCap() {
|
|
40488
40347
|
this.turnToolCallTotal++;
|
|
40489
|
-
|
|
40490
|
-
|
|
40348
|
+
if (!shouldHaltOnTurnToolCallCap(
|
|
40349
|
+
this.turnToolCallTotal,
|
|
40350
|
+
this.capMaxKeyRepeat,
|
|
40351
|
+
this.config.getMaxToolCallsPerTurn(),
|
|
40352
|
+
this.config.isMaxToolCallsPerTurnExplicit()
|
|
40353
|
+
)) {
|
|
40491
40354
|
return false;
|
|
40492
40355
|
}
|
|
40493
|
-
|
|
40494
|
-
|
|
40495
|
-
|
|
40496
|
-
|
|
40497
|
-
|
|
40498
|
-
|
|
40499
|
-
this.config,
|
|
40500
|
-
new LoopDetectedEvent("turn_tool_call_cap" /* TURN_TOOL_CALL_CAP */, this.promptId)
|
|
40501
|
-
);
|
|
40502
|
-
return true;
|
|
40503
|
-
}
|
|
40504
|
-
return false;
|
|
40356
|
+
this.lastLoopType = "turn_tool_call_cap" /* TURN_TOOL_CALL_CAP */;
|
|
40357
|
+
logLoopDetected(
|
|
40358
|
+
this.config,
|
|
40359
|
+
new LoopDetectedEvent("turn_tool_call_cap" /* TURN_TOOL_CALL_CAP */, this.promptId)
|
|
40360
|
+
);
|
|
40361
|
+
return true;
|
|
40505
40362
|
}
|
|
40506
40363
|
/**
|
|
40507
40364
|
* Non-consecutive global duplicate detection: the SAME (tool, args) pair
|
|
@@ -41777,14 +41634,14 @@ function resolveToolName(rawName) {
|
|
|
41777
41634
|
return TOOL_NAME_ALIASES[rawName] ?? rawName;
|
|
41778
41635
|
}
|
|
41779
41636
|
__name(resolveToolName, "resolveToolName");
|
|
41780
|
-
function getSpecifierKind(
|
|
41781
|
-
if (SHELL_TOOL_NAMES.has(
|
|
41637
|
+
function getSpecifierKind(canonicalToolName2) {
|
|
41638
|
+
if (SHELL_TOOL_NAMES.has(canonicalToolName2)) {
|
|
41782
41639
|
return "command";
|
|
41783
41640
|
}
|
|
41784
|
-
if (READ_TOOLS.has(
|
|
41641
|
+
if (READ_TOOLS.has(canonicalToolName2) || EDIT_TOOLS.has(canonicalToolName2)) {
|
|
41785
41642
|
return "path";
|
|
41786
41643
|
}
|
|
41787
|
-
if (WEBFETCH_TOOLS.has(
|
|
41644
|
+
if (WEBFETCH_TOOLS.has(canonicalToolName2)) {
|
|
41788
41645
|
return "domain";
|
|
41789
41646
|
}
|
|
41790
41647
|
return "literal";
|
|
@@ -41911,8 +41768,8 @@ var CANONICAL_TO_RULE_DISPLAY = {
|
|
|
41911
41768
|
exit_plan_mode: "ExitPlanMode",
|
|
41912
41769
|
enter_plan_mode: "EnterPlanMode"
|
|
41913
41770
|
};
|
|
41914
|
-
function getRuleDisplayName(
|
|
41915
|
-
return CANONICAL_TO_RULE_DISPLAY[
|
|
41771
|
+
function getRuleDisplayName(canonicalToolName2) {
|
|
41772
|
+
return CANONICAL_TO_RULE_DISPLAY[canonicalToolName2] ?? canonicalToolName2;
|
|
41916
41773
|
}
|
|
41917
41774
|
__name(getRuleDisplayName, "getRuleDisplayName");
|
|
41918
41775
|
var FILE_TARGETED_TOOLS = /* @__PURE__ */ new Set([
|
|
@@ -61574,6 +61431,39 @@ function sigtermPids(pids) {
|
|
|
61574
61431
|
}
|
|
61575
61432
|
__name(sigtermPids, "sigtermPids");
|
|
61576
61433
|
|
|
61434
|
+
// packages/core/src/tools/mcp-session-config.ts
|
|
61435
|
+
init_esbuild_shims();
|
|
61436
|
+
function normalizeMcpIncludeEntry(entry) {
|
|
61437
|
+
const paren = entry.indexOf("(");
|
|
61438
|
+
return paren === -1 ? entry : entry.slice(0, paren);
|
|
61439
|
+
}
|
|
61440
|
+
__name(normalizeMcpIncludeEntry, "normalizeMcpIncludeEntry");
|
|
61441
|
+
function coerceMcpFilterEntries(entries) {
|
|
61442
|
+
return (Array.isArray(entries) ? entries : []).filter(
|
|
61443
|
+
(entry) => typeof entry === "string"
|
|
61444
|
+
);
|
|
61445
|
+
}
|
|
61446
|
+
__name(coerceMcpFilterEntries, "coerceMcpFilterEntries");
|
|
61447
|
+
function normalizeFilter(entries, stripParenthesizedSuffix) {
|
|
61448
|
+
const normalized2 = coerceMcpFilterEntries(entries).map(
|
|
61449
|
+
(entry) => stripParenthesizedSuffix ? normalizeMcpIncludeEntry(entry) : entry
|
|
61450
|
+
);
|
|
61451
|
+
return [...new Set(normalized2)].sort();
|
|
61452
|
+
}
|
|
61453
|
+
__name(normalizeFilter, "normalizeFilter");
|
|
61454
|
+
function mcpSessionMetadataKey(config) {
|
|
61455
|
+
return JSON.stringify({
|
|
61456
|
+
trust: config.trust ?? null,
|
|
61457
|
+
alwaysLoadTools: config.alwaysLoadTools === true,
|
|
61458
|
+
// An absent allowlist accepts every name, while an explicit empty
|
|
61459
|
+
// allowlist accepts none. JSON `null` is treated as absent because
|
|
61460
|
+
// every runtime filter treats a falsy include list as "allow all".
|
|
61461
|
+
includeTools: config.includeTools == null ? null : normalizeFilter(config.includeTools, true),
|
|
61462
|
+
excludeTools: normalizeFilter(config.excludeTools, false)
|
|
61463
|
+
});
|
|
61464
|
+
}
|
|
61465
|
+
__name(mcpSessionMetadataKey, "mcpSessionMetadataKey");
|
|
61466
|
+
|
|
61577
61467
|
// packages/core/src/tools/mcp-client-manager.ts
|
|
61578
61468
|
var debugLogger40 = createDebugLogger("MCP");
|
|
61579
61469
|
var RUNTIME_MCP_IF_ABSENT_CONFIG_FLAG = "__qwenRuntimeMcpIfAbsent";
|
|
@@ -61680,13 +61570,13 @@ var McpClientManager = class _McpClientManager {
|
|
|
61680
61570
|
* Per connected server, the single-session "connected config key" of the
|
|
61681
61571
|
* config it was last connected with — see {@link singleSessionConnectedKeyOf}.
|
|
61682
61572
|
* Single-session path only; pool mode tracks transport identity via
|
|
61683
|
-
* `pooledConnections[].
|
|
61573
|
+
* `pooledConnections[].transportId` and its own `desiredIds` diff.
|
|
61684
61574
|
* Lets `discoverAllMcpToolsIncremental` detect an in-place config change to an
|
|
61685
61575
|
* already-connected server and reconnect it, instead of leaving it on the
|
|
61686
61576
|
* stale config. Unlike the transport-only `connectionIdOf`, this key also
|
|
61687
|
-
* covers the discovery-time
|
|
61688
|
-
* editing those re-applies
|
|
61689
|
-
* teardown path so a stale key can't mask a later change.
|
|
61577
|
+
* covers the discovery-time metadata (trust / alwaysLoadTools / includeTools /
|
|
61578
|
+
* excludeTools) so editing those re-applies it. Set on successful connect;
|
|
61579
|
+
* cleared on every teardown path so a stale key can't mask a later change.
|
|
61690
61580
|
*/
|
|
61691
61581
|
connectedConfigKeys = /* @__PURE__ */ new Map();
|
|
61692
61582
|
/**
|
|
@@ -62445,7 +62335,7 @@ var McpClientManager = class _McpClientManager {
|
|
|
62445
62335
|
}
|
|
62446
62336
|
for (const [name, conn] of [...this.pooledConnections]) {
|
|
62447
62337
|
const desired = desiredIds.get(name);
|
|
62448
|
-
if (desired === void 0 || desired !== conn.
|
|
62338
|
+
if (desired === void 0 || desired !== conn.transportId) {
|
|
62449
62339
|
try {
|
|
62450
62340
|
conn.release();
|
|
62451
62341
|
} catch (err) {
|
|
@@ -62474,7 +62364,17 @@ var McpClientManager = class _McpClientManager {
|
|
|
62474
62364
|
await this.discoverMcpToolsForServer(name, cliConfig);
|
|
62475
62365
|
return;
|
|
62476
62366
|
}
|
|
62477
|
-
|
|
62367
|
+
const existingConnection = this.pooledConnections.get(name);
|
|
62368
|
+
if (existingConnection) {
|
|
62369
|
+
try {
|
|
62370
|
+
existingConnection.updateConfig(config);
|
|
62371
|
+
} catch (err) {
|
|
62372
|
+
debugLogger40.error(
|
|
62373
|
+
`Pool metadata refresh failed for ${name}: ${getErrorMessage(err)}`
|
|
62374
|
+
);
|
|
62375
|
+
}
|
|
62376
|
+
return;
|
|
62377
|
+
}
|
|
62478
62378
|
try {
|
|
62479
62379
|
const conn = await this.pool.acquire(
|
|
62480
62380
|
name,
|
|
@@ -62982,18 +62882,11 @@ var McpClientManager = class _McpClientManager {
|
|
|
62982
62882
|
* intentionally transport-only (it excludes the per-session discovery filters
|
|
62983
62883
|
* so the shared pool can reuse a transport across sessions with different
|
|
62984
62884
|
* filters). But the single-session reconcile must ALSO reconnect when only a
|
|
62985
|
-
* discovery
|
|
62986
|
-
*
|
|
62987
|
-
* config edit to them otherwise never takes effect mid-session. Append a
|
|
62988
|
-
* stable hash of those fields (arrays sorted so order alone doesn't churn).
|
|
62885
|
+
* discovery metadata changes. Append the same canonical metadata identity
|
|
62886
|
+
* used by pooled session views so equivalent filters do not reconnect.
|
|
62989
62887
|
*/
|
|
62990
62888
|
singleSessionConnectedKeyOf(serverName, config) {
|
|
62991
|
-
|
|
62992
|
-
trust: config.trust ?? null,
|
|
62993
|
-
includeTools: [...config.includeTools ?? []].sort(),
|
|
62994
|
-
excludeTools: [...config.excludeTools ?? []].sort()
|
|
62995
|
-
});
|
|
62996
|
-
return `${connectionIdOf(serverName, config)}|${discovery}`;
|
|
62889
|
+
return `${connectionIdOf(serverName, config)}|${mcpSessionMetadataKey(config)}`;
|
|
62997
62890
|
}
|
|
62998
62891
|
/**
|
|
62999
62892
|
* Purge a server's entries from all three registries (tools + prompts +
|
|
@@ -63180,9 +63073,10 @@ var McpClientManager = class _McpClientManager {
|
|
|
63180
63073
|
}
|
|
63181
63074
|
}
|
|
63182
63075
|
const existingConn = this.pooledConnections.get(name);
|
|
63183
|
-
if (existingConn && existingConn.
|
|
63076
|
+
if (existingConn && existingConn.transportId === newConnId) {
|
|
63077
|
+
existingConn.updateConfig(config);
|
|
63184
63078
|
this.cliConfig.addRuntimeMcpServer(name, config);
|
|
63185
|
-
const toolCount2 =
|
|
63079
|
+
const toolCount2 = this.toolRegistry.getToolsByServer(name).length;
|
|
63186
63080
|
return {
|
|
63187
63081
|
name,
|
|
63188
63082
|
transport,
|
|
@@ -64116,16 +64010,6 @@ var ToolRegistry = class _ToolRegistry {
|
|
|
64116
64010
|
}
|
|
64117
64011
|
};
|
|
64118
64012
|
|
|
64119
|
-
// packages/core/src/tools/mcp-transport-pool.ts
|
|
64120
|
-
init_esbuild_shims();
|
|
64121
|
-
|
|
64122
|
-
// packages/core/src/tools/mcp-pool-entry.ts
|
|
64123
|
-
init_esbuild_shims();
|
|
64124
|
-
import { EventEmitter } from "node:events";
|
|
64125
|
-
|
|
64126
|
-
// packages/core/src/tools/mcp-pool-events.ts
|
|
64127
|
-
init_esbuild_shims();
|
|
64128
|
-
|
|
64129
64013
|
// packages/core/src/tools/mcp-discovery-timeout.ts
|
|
64130
64014
|
init_esbuild_shims();
|
|
64131
64015
|
var MIN_DISCOVERY_TIMEOUT_MS = 100;
|
|
@@ -64168,6 +64052,16 @@ function runWithTimeout(task, timeoutMs, label) {
|
|
|
64168
64052
|
}
|
|
64169
64053
|
__name(runWithTimeout, "runWithTimeout");
|
|
64170
64054
|
|
|
64055
|
+
// packages/core/src/tools/mcp-transport-pool.ts
|
|
64056
|
+
init_esbuild_shims();
|
|
64057
|
+
|
|
64058
|
+
// packages/core/src/tools/mcp-pool-entry.ts
|
|
64059
|
+
init_esbuild_shims();
|
|
64060
|
+
import { EventEmitter } from "node:events";
|
|
64061
|
+
|
|
64062
|
+
// packages/core/src/tools/mcp-pool-events.ts
|
|
64063
|
+
init_esbuild_shims();
|
|
64064
|
+
|
|
64171
64065
|
// packages/core/src/tools/mcp-pool-entry.ts
|
|
64172
64066
|
var debugLogger42 = createDebugLogger("McpPool:Entry");
|
|
64173
64067
|
function defaultPoolEntryOptions(transport) {
|
|
@@ -64182,7 +64076,8 @@ function defaultPoolEntryOptions(transport) {
|
|
|
64182
64076
|
__name(defaultPoolEntryOptions, "defaultPoolEntryOptions");
|
|
64183
64077
|
var PoolEntry = class {
|
|
64184
64078
|
/**
|
|
64185
|
-
* @param id
|
|
64079
|
+
* @param id Lifecycle identity. Pooled entries use `name::fingerprint`;
|
|
64080
|
+
* unpooled entries use a unique `name::unpooled-N` value.
|
|
64186
64081
|
* @param serverName Server name as advertised in `MCPServerConfig`.
|
|
64187
64082
|
* @param entryIndex Opaque, monotonic-within-name-group index for
|
|
64188
64083
|
* status-route exposure. Stable across reconnect / drain
|
|
@@ -64211,6 +64106,7 @@ var PoolEntry = class {
|
|
|
64211
64106
|
this.opts = opts;
|
|
64212
64107
|
this.onClosed = onClosed;
|
|
64213
64108
|
this.aggregateStatusByName = aggregateStatusByName;
|
|
64109
|
+
this.transportId = connectionIdOf(serverName, cfg);
|
|
64214
64110
|
this.emitter.setMaxListeners(0);
|
|
64215
64111
|
this.statusChangeListener = (name, status) => {
|
|
64216
64112
|
if (name !== this.serverName) return;
|
|
@@ -64323,6 +64219,8 @@ var PoolEntry = class {
|
|
|
64323
64219
|
* us. Skip those echoes (we already know our localStatus).
|
|
64324
64220
|
*/
|
|
64325
64221
|
suppressNextStatusEcho = false;
|
|
64222
|
+
/** Transport identity captured at spawn, separate from unpooled lifecycle id. */
|
|
64223
|
+
transportId;
|
|
64326
64224
|
get generation() {
|
|
64327
64225
|
return this._generation;
|
|
64328
64226
|
}
|
|
@@ -64423,6 +64321,30 @@ var PoolEntry = class {
|
|
|
64423
64321
|
this.subscriberHandles.set(sessionId, handle);
|
|
64424
64322
|
return handle;
|
|
64425
64323
|
}
|
|
64324
|
+
/**
|
|
64325
|
+
* Refresh one attached session's metadata without reconnecting the shared
|
|
64326
|
+
* transport. The view owns filtering and per-session tool decoration; the
|
|
64327
|
+
* entry remains the single source of truth for discovery snapshots.
|
|
64328
|
+
*/
|
|
64329
|
+
updateSessionConfig(sessionId, cfg) {
|
|
64330
|
+
if (this.isTerminated()) {
|
|
64331
|
+
throw new Error(
|
|
64332
|
+
`Cannot update config on PoolEntry ${this.id} in state ${this.state}`
|
|
64333
|
+
);
|
|
64334
|
+
}
|
|
64335
|
+
const view = this.subscribers.get(sessionId);
|
|
64336
|
+
if (!view) {
|
|
64337
|
+
throw new Error(
|
|
64338
|
+
`Cannot update config for detached session ${sessionId} on PoolEntry ${this.id}`
|
|
64339
|
+
);
|
|
64340
|
+
}
|
|
64341
|
+
if (!view.updateConfig(cfg)) return;
|
|
64342
|
+
if (this.state === "active") {
|
|
64343
|
+
view.applyTools(this.toolsSnapshot);
|
|
64344
|
+
view.applyPrompts(this.promptsSnapshot);
|
|
64345
|
+
view.applyResources(this.resourcesSnapshot);
|
|
64346
|
+
}
|
|
64347
|
+
}
|
|
64426
64348
|
/**
|
|
64427
64349
|
* Detach a session subscriber. Tears down the subscriber's
|
|
64428
64350
|
* registrations via `view.teardown()` and removes the ref.
|
|
@@ -64780,6 +64702,9 @@ var PooledConnectionImpl = class {
|
|
|
64780
64702
|
get id() {
|
|
64781
64703
|
return this.entry.id;
|
|
64782
64704
|
}
|
|
64705
|
+
get transportId() {
|
|
64706
|
+
return this.entry.transportId;
|
|
64707
|
+
}
|
|
64783
64708
|
get serverName() {
|
|
64784
64709
|
return this.entry.serverName;
|
|
64785
64710
|
}
|
|
@@ -64798,6 +64723,14 @@ var PooledConnectionImpl = class {
|
|
|
64798
64723
|
get resourcesSnapshot() {
|
|
64799
64724
|
return this.entry.resourcesSnapshot;
|
|
64800
64725
|
}
|
|
64726
|
+
updateConfig(cfg) {
|
|
64727
|
+
if (this.released) {
|
|
64728
|
+
throw new Error(
|
|
64729
|
+
`Cannot update config on released MCP connection ${this.id}`
|
|
64730
|
+
);
|
|
64731
|
+
}
|
|
64732
|
+
this.entry.updateSessionConfig(this.sessionId, cfg);
|
|
64733
|
+
}
|
|
64801
64734
|
on(event, listener) {
|
|
64802
64735
|
if (event !== "event") return this;
|
|
64803
64736
|
if (this.listeners.has(listener)) return this;
|
|
@@ -64827,11 +64760,9 @@ init_esbuild_shims();
|
|
|
64827
64760
|
var debugLogger43 = createDebugLogger("McpPool:View");
|
|
64828
64761
|
function compileNameFilter(includeTools, excludeTools) {
|
|
64829
64762
|
return {
|
|
64830
|
-
excludeSet: excludeTools ? new Set(excludeTools) : void 0,
|
|
64831
|
-
includeSet: includeTools ? new Set(
|
|
64832
|
-
includeTools.map(
|
|
64833
|
-
(entry) => entry.includes("(") ? entry.slice(0, entry.indexOf("(")) : entry
|
|
64834
|
-
)
|
|
64763
|
+
excludeSet: excludeTools ? new Set(coerceMcpFilterEntries(excludeTools)) : void 0,
|
|
64764
|
+
includeSet: includeTools != null ? new Set(
|
|
64765
|
+
coerceMcpFilterEntries(includeTools).map(normalizeMcpIncludeEntry)
|
|
64835
64766
|
) : void 0
|
|
64836
64767
|
};
|
|
64837
64768
|
}
|
|
@@ -64846,16 +64777,18 @@ var SessionMcpView = class {
|
|
|
64846
64777
|
/**
|
|
64847
64778
|
* @param sessionToolRegistry The session-owned ToolRegistry; receives
|
|
64848
64779
|
* filtered + trust-decorated `DiscoveredMCPTool` instances.
|
|
64849
|
-
* @param sessionPromptRegistry The session-owned PromptRegistry;
|
|
64850
|
-
*
|
|
64851
|
-
*
|
|
64780
|
+
* @param sessionPromptRegistry The session-owned PromptRegistry; receives
|
|
64781
|
+
* prompts selected by the same name filter as tools.
|
|
64782
|
+
* @param sessionResourceRegistry The session-owned ResourceRegistry;
|
|
64783
|
+
* receives the full resource snapshot because tool-name filters do not
|
|
64784
|
+
* apply to resource URIs.
|
|
64852
64785
|
* @param sessionId Stamped onto debug logs for cross-session
|
|
64853
64786
|
* correlation; not used for routing (pool's reverse index handles that).
|
|
64854
64787
|
* @param serverName Server name as advertised in the per-session
|
|
64855
64788
|
* merged mcpServers map; used as the key into the registries'
|
|
64856
64789
|
* `removeMcpToolsByServer` / `removePromptsByServer` cleanup paths.
|
|
64857
64790
|
* @param cfg The session's view of this server's config, source of
|
|
64858
|
-
* `includeTools` / `excludeTools` / `trust`.
|
|
64791
|
+
* `includeTools` / `excludeTools` / `trust` / `alwaysLoadTools`.
|
|
64859
64792
|
*/
|
|
64860
64793
|
constructor(sessionToolRegistry, sessionPromptRegistry, sessionResourceRegistry, sessionId, serverName, cfg) {
|
|
64861
64794
|
this.sessionToolRegistry = sessionToolRegistry;
|
|
@@ -64864,10 +64797,12 @@ var SessionMcpView = class {
|
|
|
64864
64797
|
this.sessionId = sessionId;
|
|
64865
64798
|
this.serverName = serverName;
|
|
64866
64799
|
this.cfg = cfg;
|
|
64800
|
+
this.metadataKey = mcpSessionMetadataKey(cfg);
|
|
64867
64801
|
}
|
|
64868
64802
|
static {
|
|
64869
64803
|
__name(this, "SessionMcpView");
|
|
64870
64804
|
}
|
|
64805
|
+
metadataKey;
|
|
64871
64806
|
/**
|
|
64872
64807
|
* Replace this session's registered tools for `serverName` with a
|
|
64873
64808
|
* filtered+decorated copy of `snapshot`. Idempotent: re-apply on
|
|
@@ -64885,7 +64820,10 @@ var SessionMcpView = class {
|
|
|
64885
64820
|
if (!compiledFilterAccepts(filter3, tool.serverToolName)) {
|
|
64886
64821
|
continue;
|
|
64887
64822
|
}
|
|
64888
|
-
const sessionTool = tool.
|
|
64823
|
+
const sessionTool = tool.withSessionConfig(
|
|
64824
|
+
this.cfg.trust,
|
|
64825
|
+
this.cfg.alwaysLoadTools === true
|
|
64826
|
+
);
|
|
64889
64827
|
try {
|
|
64890
64828
|
this.sessionToolRegistry.registerTool(sessionTool);
|
|
64891
64829
|
registered += 1;
|
|
@@ -64994,14 +64932,17 @@ var SessionMcpView = class {
|
|
|
64994
64932
|
* `/mcp` tweaks `includeTools` at runtime). Re-apply uses the new
|
|
64995
64933
|
* filter against the most recent snapshot.
|
|
64996
64934
|
*
|
|
64997
|
-
* The caller
|
|
64998
|
-
* `
|
|
64999
|
-
*
|
|
65000
|
-
*
|
|
65001
|
-
* (single-source-of-truth is the pool entry).
|
|
64935
|
+
* The caller is responsible for invoking `applyTools` / `applyPrompts` /
|
|
64936
|
+
* `applyResources` with the current snapshots when this method returns true.
|
|
64937
|
+
* The captured key also detects callers that mutate and resubmit the same
|
|
64938
|
+
* config object.
|
|
65002
64939
|
*/
|
|
65003
64940
|
updateConfig(cfg) {
|
|
64941
|
+
const nextKey = mcpSessionMetadataKey(cfg);
|
|
64942
|
+
const changed = this.metadataKey !== nextKey;
|
|
65004
64943
|
this.cfg = cfg;
|
|
64944
|
+
this.metadataKey = nextKey;
|
|
64945
|
+
return changed;
|
|
65005
64946
|
}
|
|
65006
64947
|
/**
|
|
65007
64948
|
* Tear down this view's registrations. Called on:
|
|
@@ -74808,6 +74749,16 @@ async function checkPriorRead(cache, filePath, verb, options2 = {}) {
|
|
|
74808
74749
|
displayMessage: `file changed since last read; re-run ${ToolNames.READ_FILE} first.`
|
|
74809
74750
|
};
|
|
74810
74751
|
}
|
|
74752
|
+
if (status.state === "unverifiable") {
|
|
74753
|
+
const verbBare2 = verb === "editing" ? "edit" : "overwrite";
|
|
74754
|
+
const raw2 = `File ${filePath} is on a filesystem that does not provide a verifiable inode identity (ino=0), so the ${verbBare2} tool cannot safely confirm a prior read. Use a different mechanism (for example, the shell tool) to ${verbBare2} this file.`;
|
|
74755
|
+
return {
|
|
74756
|
+
ok: false,
|
|
74757
|
+
type: "prior_read_verification_failed" /* PRIOR_READ_VERIFICATION_FAILED */,
|
|
74758
|
+
rawMessage: raw2,
|
|
74759
|
+
displayMessage: `cannot verify prior read of ${filePath}; use a different mechanism to ${verbBare2} it.`
|
|
74760
|
+
};
|
|
74761
|
+
}
|
|
74811
74762
|
if (status.state === "fresh" && status.entry.lastReadAt !== void 0 && !status.entry.lastReadCacheable) {
|
|
74812
74763
|
const verbBare2 = verb === "editing" ? "edit" : "overwrite";
|
|
74813
74764
|
const raw2 = `File ${filePath} is a binary / image / audio / video / PDF / notebook payload that the ${ToolNames.READ_FILE} tool returns as a structured value rather than as plain text. The Edit / WriteFile tools cannot mutate that payload safely \u2014 re-reading it would not change this. If this is a Jupyter notebook (.ipynb), use the ${ToolNames.NOTEBOOK_EDIT} tool for cell-level edits after reading it. For other non-text files, use a different mechanism (e.g. shell tool with an appropriate writer) if you need to ${verbBare2} it.`;
|
|
@@ -75802,7 +75753,7 @@ var TOKEN_PLAN_MODELS = [
|
|
|
75802
75753
|
enableThinking: true
|
|
75803
75754
|
},
|
|
75804
75755
|
{ id: "deepseek-v4-pro", contextWindowSize: 1e6 },
|
|
75805
|
-
{ id: "deepseek-v4-flash", contextWindowSize: 1e6 },
|
|
75756
|
+
{ id: "deepseek-v4-flash-0731", contextWindowSize: 1e6 },
|
|
75806
75757
|
{ id: "deepseek-v3.2", contextWindowSize: 131072 },
|
|
75807
75758
|
{
|
|
75808
75759
|
id: "kimi-k2.7-code",
|
|
@@ -76755,6 +76706,10 @@ var FileReadCache = class _FileReadCache {
|
|
|
76755
76706
|
static inodeKey(stats) {
|
|
76756
76707
|
return `${stats.dev}:${stats.ino}`;
|
|
76757
76708
|
}
|
|
76709
|
+
/** See {@link hasVerifiableInode}. */
|
|
76710
|
+
static hasVerifiableIdentity(stats) {
|
|
76711
|
+
return hasVerifiableInode(stats.ino);
|
|
76712
|
+
}
|
|
76758
76713
|
/**
|
|
76759
76714
|
* Record a successful Read of `absPath`.
|
|
76760
76715
|
*
|
|
@@ -76793,8 +76748,21 @@ var FileReadCache = class _FileReadCache {
|
|
|
76793
76748
|
* The fast-path `file_unchanged` check still gates on the
|
|
76794
76749
|
* incoming request's own `isFullRead` (in `read-file.ts`), so a
|
|
76795
76750
|
* partial read does not get a placeholder it shouldn't.
|
|
76751
|
+
*
|
|
76752
|
+
* When `stats.ino` is `0` the read is not stored and the returned
|
|
76753
|
+
* entry is **detached**: it describes this read for the immediate
|
|
76754
|
+
* caller, but it is not in the map, so mutating it has no effect
|
|
76755
|
+
* and a later {@link check} still reports `unverifiable`.
|
|
76796
76756
|
*/
|
|
76797
76757
|
recordRead(absPath, stats, opts) {
|
|
76758
|
+
if (!_FileReadCache.hasVerifiableIdentity(stats)) {
|
|
76759
|
+
const entry2 = _FileReadCache.createEntry(absPath, stats);
|
|
76760
|
+
entry2.lastReadAt = Date.now();
|
|
76761
|
+
entry2.readResidentInHistory = opts.full;
|
|
76762
|
+
entry2.lastReadWasFull = opts.full;
|
|
76763
|
+
entry2.lastReadCacheable = opts.cacheable;
|
|
76764
|
+
return entry2;
|
|
76765
|
+
}
|
|
76798
76766
|
const key = _FileReadCache.inodeKey(stats);
|
|
76799
76767
|
const existing = this.byInode.get(key);
|
|
76800
76768
|
const sameFingerprint = existing !== void 0 && existing.mtimeMs === stats.mtimeMs && existing.sizeBytes === stats.size;
|
|
@@ -76830,9 +76798,12 @@ var FileReadCache = class _FileReadCache {
|
|
|
76830
76798
|
* the default `cacheable: true`; structured writers such as notebook cell
|
|
76831
76799
|
* editors can set `cacheable: false` so regular Edit / WriteFile still
|
|
76832
76800
|
* reject the file as a non-text payload.
|
|
76801
|
+
*
|
|
76802
|
+
* As with {@link recordRead}, an `ino === 0` write returns a
|
|
76803
|
+
* **detached** entry that was never added to the map.
|
|
76833
76804
|
*/
|
|
76834
76805
|
recordWrite(absPath, stats, opts = {}) {
|
|
76835
|
-
const entry = this.upsert(absPath, stats);
|
|
76806
|
+
const entry = _FileReadCache.hasVerifiableIdentity(stats) ? this.upsert(absPath, stats) : _FileReadCache.createEntry(absPath, stats);
|
|
76836
76807
|
const now = Date.now();
|
|
76837
76808
|
entry.lastWriteAt = now;
|
|
76838
76809
|
entry.lastReadAt = now;
|
|
@@ -76844,6 +76815,8 @@ var FileReadCache = class _FileReadCache {
|
|
|
76844
76815
|
/**
|
|
76845
76816
|
* Compare the cached fingerprint against `stats` for the same inode.
|
|
76846
76817
|
*
|
|
76818
|
+
* - `unverifiable` — the filesystem reported `ino === 0`, so the
|
|
76819
|
+
* file identity cannot be safely compared or cached.
|
|
76847
76820
|
* - `unknown` — no entry. The file has never been Read or written in
|
|
76848
76821
|
* this session.
|
|
76849
76822
|
* - `stale` — entry exists but mtime or size differs. The file has
|
|
@@ -76858,6 +76831,9 @@ var FileReadCache = class _FileReadCache {
|
|
|
76858
76831
|
* `0 occurrences` failure mode, which prompts the model to re-read.
|
|
76859
76832
|
*/
|
|
76860
76833
|
check(stats) {
|
|
76834
|
+
if (!_FileReadCache.hasVerifiableIdentity(stats)) {
|
|
76835
|
+
return { state: "unverifiable" };
|
|
76836
|
+
}
|
|
76861
76837
|
const entry = this.byInode.get(_FileReadCache.inodeKey(stats));
|
|
76862
76838
|
if (!entry) return { state: "unknown" };
|
|
76863
76839
|
if (entry.mtimeMs !== stats.mtimeMs || entry.sizeBytes !== stats.size) {
|
|
@@ -76885,6 +76861,9 @@ var FileReadCache = class _FileReadCache {
|
|
|
76885
76861
|
* fall back to {@link clear}.
|
|
76886
76862
|
*/
|
|
76887
76863
|
markReadEvictedFromHistory(stats) {
|
|
76864
|
+
if (!_FileReadCache.hasVerifiableIdentity(stats)) {
|
|
76865
|
+
return false;
|
|
76866
|
+
}
|
|
76888
76867
|
const entry = this.byInode.get(_FileReadCache.inodeKey(stats));
|
|
76889
76868
|
if (entry) {
|
|
76890
76869
|
entry.readResidentInHistory = false;
|
|
@@ -76894,6 +76873,9 @@ var FileReadCache = class _FileReadCache {
|
|
|
76894
76873
|
}
|
|
76895
76874
|
/** Remove the entry for the given Stats, if any. */
|
|
76896
76875
|
invalidate(stats) {
|
|
76876
|
+
if (!_FileReadCache.hasVerifiableIdentity(stats)) {
|
|
76877
|
+
return;
|
|
76878
|
+
}
|
|
76897
76879
|
this.byInode.delete(_FileReadCache.inodeKey(stats));
|
|
76898
76880
|
}
|
|
76899
76881
|
/**
|
|
@@ -76966,8 +76948,13 @@ var FileReadCache = class _FileReadCache {
|
|
|
76966
76948
|
this.byInode.delete(oldestKey);
|
|
76967
76949
|
}
|
|
76968
76950
|
}
|
|
76969
|
-
const entry =
|
|
76970
|
-
|
|
76951
|
+
const entry = _FileReadCache.createEntry(absPath, stats);
|
|
76952
|
+
this.byInode.set(key, entry);
|
|
76953
|
+
return entry;
|
|
76954
|
+
}
|
|
76955
|
+
static createEntry(absPath, stats) {
|
|
76956
|
+
return {
|
|
76957
|
+
inodeKey: _FileReadCache.inodeKey(stats),
|
|
76971
76958
|
realPath: absPath,
|
|
76972
76959
|
mtimeMs: stats.mtimeMs,
|
|
76973
76960
|
sizeBytes: stats.size,
|
|
@@ -76975,8 +76962,6 @@ var FileReadCache = class _FileReadCache {
|
|
|
76975
76962
|
lastReadCacheable: false,
|
|
76976
76963
|
readResidentInHistory: false
|
|
76977
76964
|
};
|
|
76978
|
-
this.byInode.set(key, entry);
|
|
76979
|
-
return entry;
|
|
76980
76965
|
}
|
|
76981
76966
|
};
|
|
76982
76967
|
|
|
@@ -77806,8 +77791,8 @@ var GitWorktreeService = class _GitWorktreeService {
|
|
|
77806
77791
|
async getRegisteredWorktreeBranch(worktreePath) {
|
|
77807
77792
|
let resolvedWorktreePath;
|
|
77808
77793
|
try {
|
|
77809
|
-
const
|
|
77810
|
-
if (!
|
|
77794
|
+
const stat22 = await fs29.stat(worktreePath);
|
|
77795
|
+
if (!stat22.isDirectory()) return null;
|
|
77811
77796
|
resolvedWorktreePath = await fs29.realpath(worktreePath);
|
|
77812
77797
|
} catch {
|
|
77813
77798
|
return null;
|
|
@@ -78847,7 +78832,7 @@ ${body}`;
|
|
|
78847
78832
|
const out = [];
|
|
78848
78833
|
for (const rec of records) {
|
|
78849
78834
|
if (rec.type === "user") {
|
|
78850
|
-
const text = this.
|
|
78835
|
+
const text = this.visibleUserText(rec);
|
|
78851
78836
|
if (text) out.push(`User: ${text}`);
|
|
78852
78837
|
} else if (rec.type === "assistant") {
|
|
78853
78838
|
const text = this.visibleText(rec.message);
|
|
@@ -78862,8 +78847,17 @@ ${body}`;
|
|
|
78862
78847
|
return out;
|
|
78863
78848
|
}
|
|
78864
78849
|
visibleText(message) {
|
|
78865
|
-
|
|
78866
|
-
|
|
78850
|
+
return this.visibleTextParts(message?.parts ?? []);
|
|
78851
|
+
}
|
|
78852
|
+
visibleUserText(record2) {
|
|
78853
|
+
const projection = projectUserTranscriptForDisplay(record2);
|
|
78854
|
+
if (projection.displayText !== void 0) {
|
|
78855
|
+
return projection.displayText.trim();
|
|
78856
|
+
}
|
|
78857
|
+
return this.visibleTextParts(projection.parts);
|
|
78858
|
+
}
|
|
78859
|
+
visibleTextParts(parts) {
|
|
78860
|
+
return parts.filter((p2) => !p2.thought && p2.text).map((p2) => p2.text).join("").trim();
|
|
78867
78861
|
}
|
|
78868
78862
|
static TITLE_MAX_LENGTH = 80;
|
|
78869
78863
|
deriveTitle(records) {
|
|
@@ -78877,7 +78871,7 @@ ${body}`;
|
|
|
78877
78871
|
if (customTitle) return customTitle;
|
|
78878
78872
|
for (const rec of records) {
|
|
78879
78873
|
if (rec.type !== "user") continue;
|
|
78880
|
-
const text = this.
|
|
78874
|
+
const text = this.visibleUserText(rec);
|
|
78881
78875
|
if (!text) continue;
|
|
78882
78876
|
const firstLine = text.split("\n")[0].trim();
|
|
78883
78877
|
if (firstLine.length === 0) continue;
|
|
@@ -79186,8 +79180,8 @@ async function restoreWorktreeContext(sidecarPath, onWarn) {
|
|
|
79186
79180
|
}
|
|
79187
79181
|
let worktreeAlive = false;
|
|
79188
79182
|
try {
|
|
79189
|
-
const
|
|
79190
|
-
worktreeAlive =
|
|
79183
|
+
const stat22 = await fs30.stat(session.worktreePath);
|
|
79184
|
+
worktreeAlive = stat22.isDirectory();
|
|
79191
79185
|
} catch {
|
|
79192
79186
|
worktreeAlive = false;
|
|
79193
79187
|
}
|
|
@@ -79896,6 +79890,10 @@ function applyUtf8Prefix(command, shell) {
|
|
|
79896
79890
|
}
|
|
79897
79891
|
}
|
|
79898
79892
|
__name(applyUtf8Prefix, "applyUtf8Prefix");
|
|
79893
|
+
function isSignalTermination(signal) {
|
|
79894
|
+
return signal !== null && signal !== 0;
|
|
79895
|
+
}
|
|
79896
|
+
__name(isSignalTermination, "isSignalTermination");
|
|
79899
79897
|
function createPreSpawnAbortedHandle() {
|
|
79900
79898
|
return {
|
|
79901
79899
|
pid: void 0,
|
|
@@ -80928,7 +80926,7 @@ var ShellExecutionService = class _ShellExecutionService {
|
|
|
80928
80926
|
rawOutput: finalBuffer,
|
|
80929
80927
|
output: fullOutput,
|
|
80930
80928
|
exitCode,
|
|
80931
|
-
signal: signal ?? null,
|
|
80929
|
+
signal: signal === 0 ? null : signal ?? null,
|
|
80932
80930
|
error,
|
|
80933
80931
|
aborted: abortSignal.aborted,
|
|
80934
80932
|
pid: ptyProcess.pid,
|
|
@@ -81068,7 +81066,7 @@ var ShellExecutionService = class _ShellExecutionService {
|
|
|
81068
81066
|
}) => {
|
|
81069
81067
|
firePostSettle({
|
|
81070
81068
|
exitCode,
|
|
81071
|
-
signal: signal ?? null,
|
|
81069
|
+
signal: signal === 0 ? null : signal ?? null,
|
|
81072
81070
|
endTime: Date.now()
|
|
81073
81071
|
});
|
|
81074
81072
|
}
|
|
@@ -82088,10 +82086,10 @@ function readOutputTail(outputFile) {
|
|
|
82088
82086
|
let fd;
|
|
82089
82087
|
try {
|
|
82090
82088
|
fd = fs32.openSync(outputFile, getReadOutputOpenFlags());
|
|
82091
|
-
const
|
|
82092
|
-
if (!
|
|
82093
|
-
const length = Math.min(
|
|
82094
|
-
const start =
|
|
82089
|
+
const stat22 = fs32.fstatSync(fd);
|
|
82090
|
+
if (!stat22.isFile() || stat22.size <= 0) return void 0;
|
|
82091
|
+
const length = Math.min(stat22.size, MAX_NOTIFICATION_OUTPUT_TAIL_BYTES);
|
|
82092
|
+
const start = stat22.size - length;
|
|
82095
82093
|
const buffer = Buffer.allocUnsafe(length);
|
|
82096
82094
|
const bytesRead = fs32.readSync(fd, buffer, 0, length, start);
|
|
82097
82095
|
let sliceOffset = 0;
|
|
@@ -82460,6 +82458,14 @@ var BackgroundShellRegistry = class {
|
|
|
82460
82458
|
init_esbuild_shims();
|
|
82461
82459
|
var debugLogger61 = createDebugLogger("WORKFLOW_REGISTRY");
|
|
82462
82460
|
var MAX_RETAINED_TERMINAL_WORKFLOWS = 10;
|
|
82461
|
+
function isActiveWorkflowStatus(status) {
|
|
82462
|
+
return status === "running" || status === "pausing" || status === "paused";
|
|
82463
|
+
}
|
|
82464
|
+
__name(isActiveWorkflowStatus, "isActiveWorkflowStatus");
|
|
82465
|
+
function isTerminalWorkflowStatus(status) {
|
|
82466
|
+
return status === "completed" || status === "failed" || status === "cancelled";
|
|
82467
|
+
}
|
|
82468
|
+
__name(isTerminalWorkflowStatus, "isTerminalWorkflowStatus");
|
|
82463
82469
|
var MAX_PENDING_WORKFLOW_APPROVALS = 32;
|
|
82464
82470
|
var MAX_WORKFLOW_APPROVAL_DISPLAY_CHARS = 64 * 1024;
|
|
82465
82471
|
var WorkflowRunRegistry = class {
|
|
@@ -82573,7 +82579,7 @@ var WorkflowRunRegistry = class {
|
|
|
82573
82579
|
*/
|
|
82574
82580
|
register(registration) {
|
|
82575
82581
|
const existing = this.entries.get(registration.runId);
|
|
82576
|
-
if (existing
|
|
82582
|
+
if (existing && isActiveWorkflowStatus(existing.status) || this.handles.has(registration.runId)) {
|
|
82577
82583
|
throw new Error(`Workflow run ${registration.runId} is already active.`);
|
|
82578
82584
|
}
|
|
82579
82585
|
const entry = registration;
|
|
@@ -82611,10 +82617,34 @@ var WorkflowRunRegistry = class {
|
|
|
82611
82617
|
return entry;
|
|
82612
82618
|
}
|
|
82613
82619
|
attachHandle(handle) {
|
|
82614
|
-
|
|
82620
|
+
const status = this.entries.get(handle.runId)?.status;
|
|
82621
|
+
if (status && isActiveWorkflowStatus(status)) {
|
|
82615
82622
|
this.handles.set(handle.runId, handle);
|
|
82616
82623
|
}
|
|
82617
82624
|
}
|
|
82625
|
+
pause(runId) {
|
|
82626
|
+
const entry = this.entries.get(runId);
|
|
82627
|
+
const handle = this.handles.get(runId);
|
|
82628
|
+
if (!entry?.isBackgrounded || entry.status !== "running" || !handle) {
|
|
82629
|
+
return false;
|
|
82630
|
+
}
|
|
82631
|
+
return handle.pause();
|
|
82632
|
+
}
|
|
82633
|
+
resume(runId) {
|
|
82634
|
+
const entry = this.entries.get(runId);
|
|
82635
|
+
const handle = this.handles.get(runId);
|
|
82636
|
+
if (!entry || entry.status !== "paused" || !handle) return false;
|
|
82637
|
+
return handle.resume();
|
|
82638
|
+
}
|
|
82639
|
+
onDispatchStateChange(runId, state) {
|
|
82640
|
+
const entry = this.entries.get(runId);
|
|
82641
|
+
if (!entry || isTerminalWorkflowStatus(entry.status)) return;
|
|
82642
|
+
if (state === "pausing" && entry.status !== "running") return;
|
|
82643
|
+
if (state === "paused" && entry.status !== "pausing") return;
|
|
82644
|
+
if (state === "running" && entry.status !== "paused") return;
|
|
82645
|
+
entry.status = state;
|
|
82646
|
+
this.emitStatusChange(entry);
|
|
82647
|
+
}
|
|
82618
82648
|
getHandle(runId) {
|
|
82619
82649
|
return this.handles.get(runId);
|
|
82620
82650
|
}
|
|
@@ -82710,9 +82740,9 @@ var WorkflowRunRegistry = class {
|
|
|
82710
82740
|
}
|
|
82711
82741
|
parkPendingApproval(runId, event) {
|
|
82712
82742
|
const entry = this.entries.get(runId);
|
|
82713
|
-
if (!entry || entry.status
|
|
82743
|
+
if (!entry || !isActiveWorkflowStatus(entry.status) || !this.approvalChangeCallback && !this.approvalRequestCallback) {
|
|
82714
82744
|
debugLogger61.warn(
|
|
82715
|
-
`Workflow approval rejected for ${runId}/${event.callId}: entry missing, not
|
|
82745
|
+
`Workflow approval rejected for ${runId}/${event.callId}: entry missing, not active, or no host channel`
|
|
82716
82746
|
);
|
|
82717
82747
|
return "rejected";
|
|
82718
82748
|
}
|
|
@@ -82793,7 +82823,7 @@ var WorkflowRunRegistry = class {
|
|
|
82793
82823
|
*/
|
|
82794
82824
|
onPhaseStarted(runId, title) {
|
|
82795
82825
|
const entry = this.entries.get(runId);
|
|
82796
|
-
if (!entry || entry.status
|
|
82826
|
+
if (!entry || !isActiveWorkflowStatus(entry.status)) return;
|
|
82797
82827
|
entry.currentPhase = title;
|
|
82798
82828
|
const last = entry.phases[entry.phases.length - 1];
|
|
82799
82829
|
if (last !== title) entry.phases.push(title);
|
|
@@ -82802,14 +82832,14 @@ var WorkflowRunRegistry = class {
|
|
|
82802
82832
|
/** Cumulative dispatch counter — incremented before each `agent()` call resolves. */
|
|
82803
82833
|
onAgentDispatched(runId) {
|
|
82804
82834
|
const entry = this.entries.get(runId);
|
|
82805
|
-
if (!entry || entry.status
|
|
82835
|
+
if (!entry || !isActiveWorkflowStatus(entry.status)) return;
|
|
82806
82836
|
entry.agentsDispatched++;
|
|
82807
82837
|
this.emitStatusChange(entry);
|
|
82808
82838
|
}
|
|
82809
82839
|
/** Cumulative completion counter — incremented after each `agent()` call settles. */
|
|
82810
82840
|
onAgentCompleted(runId) {
|
|
82811
82841
|
const entry = this.entries.get(runId);
|
|
82812
|
-
if (!entry || entry.
|
|
82842
|
+
if (!entry || entry.agentsCompleted >= entry.agentsDispatched) return;
|
|
82813
82843
|
entry.agentsCompleted++;
|
|
82814
82844
|
this.emitStatusChange(entry);
|
|
82815
82845
|
}
|
|
@@ -82825,7 +82855,7 @@ var WorkflowRunRegistry = class {
|
|
|
82825
82855
|
*/
|
|
82826
82856
|
onBudgetUpdated(runId, spent, total) {
|
|
82827
82857
|
const entry = this.entries.get(runId);
|
|
82828
|
-
if (!entry
|
|
82858
|
+
if (!entry) return;
|
|
82829
82859
|
const delta = spent - entry.tokensSpent;
|
|
82830
82860
|
const totalChanged = entry.tokenBudgetTotal !== total;
|
|
82831
82861
|
if (delta <= 0 && !totalChanged) return;
|
|
@@ -82855,14 +82885,15 @@ var WorkflowRunRegistry = class {
|
|
|
82855
82885
|
setRecentLogs(runId, logs) {
|
|
82856
82886
|
const entry = this.entries.get(runId);
|
|
82857
82887
|
if (!entry) return;
|
|
82858
|
-
if (entry.status
|
|
82888
|
+
if (!isActiveWorkflowStatus(entry.status) && entry.status !== "cancelled")
|
|
82889
|
+
return;
|
|
82859
82890
|
const tail = logs.length > 100 ? logs.slice(-100) : Array.from(logs);
|
|
82860
82891
|
entry.recentLogs = tail;
|
|
82861
82892
|
this.emitStatusChange(entry);
|
|
82862
82893
|
}
|
|
82863
82894
|
complete(runId, result, endTime) {
|
|
82864
82895
|
const entry = this.entries.get(runId);
|
|
82865
|
-
if (!entry || entry.status
|
|
82896
|
+
if (!entry || !isActiveWorkflowStatus(entry.status)) return;
|
|
82866
82897
|
this.rejectPendingApprovals(runId);
|
|
82867
82898
|
entry.status = "completed";
|
|
82868
82899
|
entry.endTime = endTime;
|
|
@@ -82875,7 +82906,7 @@ var WorkflowRunRegistry = class {
|
|
|
82875
82906
|
}
|
|
82876
82907
|
fail(runId, message, endTime) {
|
|
82877
82908
|
const entry = this.entries.get(runId);
|
|
82878
|
-
if (!entry || entry.status
|
|
82909
|
+
if (!entry || !isActiveWorkflowStatus(entry.status)) return;
|
|
82879
82910
|
this.rejectPendingApprovals(runId);
|
|
82880
82911
|
entry.status = "failed";
|
|
82881
82912
|
entry.endTime = endTime;
|
|
@@ -82887,13 +82918,13 @@ var WorkflowRunRegistry = class {
|
|
|
82887
82918
|
this.evictTerminal();
|
|
82888
82919
|
}
|
|
82889
82920
|
/**
|
|
82890
|
-
* Mark
|
|
82921
|
+
* Mark an active entry as cancelled and abort its controller. No-op
|
|
82891
82922
|
* if the entry has already settled — protects against an explicit
|
|
82892
82923
|
* dialog cancel racing with the natural complete/fail path.
|
|
82893
82924
|
*/
|
|
82894
82925
|
cancel(runId, endTime) {
|
|
82895
82926
|
const entry = this.entries.get(runId);
|
|
82896
|
-
if (!entry || entry.status
|
|
82927
|
+
if (!entry || !isActiveWorkflowStatus(entry.status)) return;
|
|
82897
82928
|
this.rejectPendingApprovals(runId);
|
|
82898
82929
|
entry.status = "cancelled";
|
|
82899
82930
|
entry.endTime = endTime;
|
|
@@ -82909,21 +82940,33 @@ var WorkflowRunRegistry = class {
|
|
|
82909
82940
|
get(runId) {
|
|
82910
82941
|
return this.entries.get(runId);
|
|
82911
82942
|
}
|
|
82912
|
-
/** All entries (
|
|
82943
|
+
/** All entries (active + terminal, no filter). Iteration order = registration order. */
|
|
82913
82944
|
list() {
|
|
82914
82945
|
return Array.from(this.entries.values());
|
|
82915
82946
|
}
|
|
82916
82947
|
/**
|
|
82917
|
-
* R7 (wenshao): true if any entry is still
|
|
82918
|
-
* three sibling registries' `hasUnfinalizedTasks()` /
|
|
82948
|
+
* R7 (wenshao): true if any entry is still actively executing.
|
|
82949
|
+
* Mirrors the three sibling registries' `hasUnfinalizedTasks()` /
|
|
82919
82950
|
* `hasRunningEntries()` / `getRunning().length > 0` so the unified
|
|
82920
82951
|
* `hasBlockingBackgroundWork()` helper (the gate `/clear` and session-
|
|
82921
82952
|
* resume both use to refuse a switch with live work) can count
|
|
82922
82953
|
* workflow runs the same way.
|
|
82954
|
+
*
|
|
82955
|
+
* R12 (doudouOUC): `paused` deliberately does NOT count. A paused run
|
|
82956
|
+
* has drained its dispatches and executes nothing, and its wall-clock
|
|
82957
|
+
* watchdog is suspended — if it blocked the switch, a paused-and-
|
|
82958
|
+
* forgotten run would block `/clear` and session switching forever
|
|
82959
|
+
* with no backstop to release it. Mirrors the sibling
|
|
82960
|
+
* `BackgroundTaskRegistry.hasRunningTasks()`, which also counts only
|
|
82961
|
+
* `running` (a paused background agent does not block a switch).
|
|
82962
|
+
* Session-switch teardown cancels paused runs via `abortAll()` before
|
|
82963
|
+
* `reset()` so they settle terminal instead of leaking.
|
|
82923
82964
|
*/
|
|
82924
82965
|
hasRunningEntries() {
|
|
82925
82966
|
for (const entry of this.entries.values()) {
|
|
82926
|
-
if (entry.status === "running")
|
|
82967
|
+
if (entry.status === "running" || entry.status === "pausing") {
|
|
82968
|
+
return true;
|
|
82969
|
+
}
|
|
82927
82970
|
}
|
|
82928
82971
|
return false;
|
|
82929
82972
|
}
|
|
@@ -82931,7 +82974,7 @@ var WorkflowRunRegistry = class {
|
|
|
82931
82974
|
* R7 (wenshao): drop every in-memory entry without touching
|
|
82932
82975
|
* controllers. Mirrors `BackgroundShellRegistry.reset()` and the
|
|
82933
82976
|
* other siblings' contract — callers (`/clear`, session-resume)
|
|
82934
|
-
* MUST verify via `hasRunningEntries()` first that no
|
|
82977
|
+
* MUST verify via `hasRunningEntries()` first that no active
|
|
82935
82978
|
* work exists before invoking. The companion path that aborts
|
|
82936
82979
|
* controllers is `abortAll()`.
|
|
82937
82980
|
*/
|
|
@@ -82951,7 +82994,7 @@ var WorkflowRunRegistry = class {
|
|
|
82951
82994
|
if (sample) this.emitStatusChange(sample);
|
|
82952
82995
|
}
|
|
82953
82996
|
/**
|
|
82954
|
-
* R7 (wenshao): cancel every
|
|
82997
|
+
* R7 (wenshao): cancel every active entry. Called on session/
|
|
82955
82998
|
* Config shutdown so workflow runs don't outlive the CLI process and
|
|
82956
82999
|
* leak orphaned dispatches. Symmetric with `BackgroundShellRegistry.
|
|
82957
83000
|
* abortAll()` and `BackgroundTaskRegistry.abortAll()`.
|
|
@@ -82959,13 +83002,13 @@ var WorkflowRunRegistry = class {
|
|
|
82959
83002
|
* Settles each entry inline (status → 'cancelled', abort the
|
|
82960
83003
|
* controller) and fires the status-change callback exactly once
|
|
82961
83004
|
* after the loop — the per-entry `cancel()` path would have fired
|
|
82962
|
-
* the callback for every
|
|
83005
|
+
* the callback for every active entry, wasteful on shutdown.
|
|
82963
83006
|
*/
|
|
82964
83007
|
abortAll() {
|
|
82965
83008
|
const endTime = Date.now();
|
|
82966
83009
|
let lastCancelled;
|
|
82967
83010
|
for (const entry of Array.from(this.entries.values())) {
|
|
82968
|
-
if (entry.status
|
|
83011
|
+
if (!isActiveWorkflowStatus(entry.status)) continue;
|
|
82969
83012
|
this.rejectPendingApprovals(entry.runId);
|
|
82970
83013
|
entry.status = "cancelled";
|
|
82971
83014
|
entry.endTime = endTime;
|
|
@@ -82985,11 +83028,13 @@ var WorkflowRunRegistry = class {
|
|
|
82985
83028
|
}
|
|
82986
83029
|
/**
|
|
82987
83030
|
* Sweep terminal entries when they exceed `MAX_RETAINED_TERMINAL_WORKFLOWS`.
|
|
82988
|
-
*
|
|
83031
|
+
* Active entries are always retained. Oldest terminal entries
|
|
82989
83032
|
* (by `endTime`) are evicted first.
|
|
82990
83033
|
*/
|
|
82991
83034
|
evictTerminal() {
|
|
82992
|
-
const terminal = this.list().filter(
|
|
83035
|
+
const terminal = this.list().filter(
|
|
83036
|
+
(e) => isTerminalWorkflowStatus(e.status)
|
|
83037
|
+
);
|
|
82993
83038
|
if (terminal.length <= MAX_RETAINED_TERMINAL_WORKFLOWS) return;
|
|
82994
83039
|
terminal.sort((a, b2) => (a.endTime ?? 0) - (b2.endTime ?? 0));
|
|
82995
83040
|
const toEvict = terminal.slice(
|
|
@@ -83096,6 +83141,7 @@ function restrictWorkflowConfirmationDetails(details) {
|
|
|
83096
83141
|
type: "info",
|
|
83097
83142
|
title: details.title,
|
|
83098
83143
|
prompt: details.prompt,
|
|
83144
|
+
renderPromptAsPlainText: details.renderPromptAsPlainText,
|
|
83099
83145
|
urls: details.urls ? [...details.urls] : void 0,
|
|
83100
83146
|
hideAlwaysAllow: true
|
|
83101
83147
|
};
|
|
@@ -83116,6 +83162,9 @@ import { promises as fs33 } from "node:fs";
|
|
|
83116
83162
|
var debugLogger62 = createDebugLogger("WORKFLOW_SNAPSHOT");
|
|
83117
83163
|
var MAX_RETAINED_SNAPSHOTS = 30;
|
|
83118
83164
|
function toSnapshot(task) {
|
|
83165
|
+
if (!isTerminalWorkflowStatus(task.status)) {
|
|
83166
|
+
throw new Error(`Cannot snapshot active workflow ${task.runId}.`);
|
|
83167
|
+
}
|
|
83119
83168
|
return {
|
|
83120
83169
|
runId: task.runId,
|
|
83121
83170
|
meta: task.meta,
|
|
@@ -83150,9 +83199,9 @@ async function writeWorkflowSnapshot(config, task) {
|
|
|
83150
83199
|
const storage = config.storage;
|
|
83151
83200
|
if (!storage) return;
|
|
83152
83201
|
try {
|
|
83202
|
+
const snapshot = toSnapshot(task);
|
|
83153
83203
|
const dir = storage.getWorkflowRunsDir();
|
|
83154
83204
|
await fs33.mkdir(dir, { recursive: true });
|
|
83155
|
-
const snapshot = toSnapshot(task);
|
|
83156
83205
|
await fs33.writeFile(
|
|
83157
83206
|
storage.getWorkflowRunSnapshotPath(task.runId),
|
|
83158
83207
|
JSON.stringify(snapshot, null, 2),
|
|
@@ -85530,10 +85579,6 @@ var WRITE_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
|
85530
85579
|
ToolNames.WRITE_FILE,
|
|
85531
85580
|
ToolNames.EDIT
|
|
85532
85581
|
]);
|
|
85533
|
-
function canonicalToolName(toolName) {
|
|
85534
|
-
return ToolNamesMigration[toolName] ?? toolName;
|
|
85535
|
-
}
|
|
85536
|
-
__name(canonicalToolName, "canonicalToolName");
|
|
85537
85582
|
function candidateFilePath(args) {
|
|
85538
85583
|
const value = args?.["file_path"] ?? args?.["path"] ?? args?.["target_file"];
|
|
85539
85584
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
@@ -85577,6 +85622,19 @@ function didWriteManagedMemory(candidates, projectRoot) {
|
|
|
85577
85622
|
);
|
|
85578
85623
|
}
|
|
85579
85624
|
__name(didWriteManagedMemory, "didWriteManagedMemory");
|
|
85625
|
+
function didWriteProjectContextFile(candidates, projectRoot) {
|
|
85626
|
+
const contextFilePaths = new Set(
|
|
85627
|
+
getAllGeminiMdFilenames().map((name) => name.trim()).filter((name) => name.length > 0).map((name) => path42.resolve(projectRoot, name))
|
|
85628
|
+
);
|
|
85629
|
+
return candidates.some((candidate) => {
|
|
85630
|
+
if (!isSuccessfulWrite(candidate)) {
|
|
85631
|
+
return false;
|
|
85632
|
+
}
|
|
85633
|
+
const filePath = candidateFilePath(candidate.args);
|
|
85634
|
+
return filePath !== void 0 && contextFilePaths.has(resolveCandidatePath(filePath, projectRoot));
|
|
85635
|
+
});
|
|
85636
|
+
}
|
|
85637
|
+
__name(didWriteProjectContextFile, "didWriteProjectContextFile");
|
|
85580
85638
|
async function rebuildWrittenMemoryIndexes(candidates, projectRoot, options2) {
|
|
85581
85639
|
let wroteProjectMemory = false;
|
|
85582
85640
|
let wroteUserMemory = false;
|
|
@@ -86425,11 +86483,11 @@ var WorkspaceMemoryFileTooLargeError = class extends Error {
|
|
|
86425
86483
|
async function composeAppendedContent(filePath, newContent) {
|
|
86426
86484
|
let existing = "";
|
|
86427
86485
|
try {
|
|
86428
|
-
const
|
|
86429
|
-
if (
|
|
86486
|
+
const stat22 = await fs41.stat(filePath);
|
|
86487
|
+
if (stat22.size > MAX_EXISTING_FILE_BYTES) {
|
|
86430
86488
|
throw new WorkspaceMemoryFileTooLargeError(
|
|
86431
86489
|
filePath,
|
|
86432
|
-
|
|
86490
|
+
stat22.size,
|
|
86433
86491
|
MAX_EXISTING_FILE_BYTES
|
|
86434
86492
|
);
|
|
86435
86493
|
}
|
|
@@ -87471,13 +87529,13 @@ var IdeClient = class _IdeClient {
|
|
|
87471
87529
|
lockFiles.map(async (file) => {
|
|
87472
87530
|
const fullPath = path47.join(ideDir, file);
|
|
87473
87531
|
try {
|
|
87474
|
-
const
|
|
87532
|
+
const stat22 = await fs42.promises.stat(fullPath);
|
|
87475
87533
|
const content = await fs42.promises.readFile(fullPath, "utf8");
|
|
87476
87534
|
try {
|
|
87477
87535
|
return {
|
|
87478
87536
|
file,
|
|
87479
87537
|
fullPath,
|
|
87480
|
-
mtimeMs:
|
|
87538
|
+
mtimeMs: stat22.mtimeMs,
|
|
87481
87539
|
parsed: JSON.parse(content)
|
|
87482
87540
|
};
|
|
87483
87541
|
} catch (error) {
|
|
@@ -89017,7 +89075,7 @@ var LspResponseNormalizer = class {
|
|
|
89017
89075
|
/**
|
|
89018
89076
|
* Convert diagnostic back to LSP format for requests
|
|
89019
89077
|
*/
|
|
89020
|
-
denormalizeDiagnostic(
|
|
89078
|
+
denormalizeDiagnostic(diagnostic) {
|
|
89021
89079
|
const severityMap = {
|
|
89022
89080
|
error: 1,
|
|
89023
89081
|
warning: 2,
|
|
@@ -89025,11 +89083,11 @@ var LspResponseNormalizer = class {
|
|
|
89025
89083
|
hint: 4
|
|
89026
89084
|
};
|
|
89027
89085
|
return {
|
|
89028
|
-
range:
|
|
89029
|
-
message:
|
|
89030
|
-
severity:
|
|
89031
|
-
code:
|
|
89032
|
-
source:
|
|
89086
|
+
range: diagnostic.range,
|
|
89087
|
+
message: diagnostic.message,
|
|
89088
|
+
severity: diagnostic.severity ? severityMap[diagnostic.severity] : void 0,
|
|
89089
|
+
code: diagnostic.code,
|
|
89090
|
+
source: diagnostic.source
|
|
89033
89091
|
};
|
|
89034
89092
|
}
|
|
89035
89093
|
/**
|
|
@@ -95340,11 +95398,9 @@ import * as os16 from "node:os";
|
|
|
95340
95398
|
init_esbuild_shims();
|
|
95341
95399
|
var REDACTED_URL_CREDENTIAL = "***REDACTED***";
|
|
95342
95400
|
var URL_CREDENTIALS_PATTERN = /\b([a-z][a-z0-9+.-]*:\/\/)(?:[^/\s]+@)+/gi;
|
|
95401
|
+
var UPLOAD_IDENTITY_PATTERN = /\bupload:v1:[0-9a-fA-F-]+:/gu;
|
|
95343
95402
|
function redactUrlCredentials(source) {
|
|
95344
|
-
return source.replace(
|
|
95345
|
-
URL_CREDENTIALS_PATTERN,
|
|
95346
|
-
`$1${REDACTED_URL_CREDENTIAL}@`
|
|
95347
|
-
);
|
|
95403
|
+
return source.replace(UPLOAD_IDENTITY_PATTERN, "upload:").replace(URL_CREDENTIALS_PATTERN, `$1${REDACTED_URL_CREDENTIAL}@`);
|
|
95348
95404
|
}
|
|
95349
95405
|
__name(redactUrlCredentials, "redactUrlCredentials");
|
|
95350
95406
|
|
|
@@ -96626,8 +96682,8 @@ async function collectResources(resourcePaths, pluginRoot, destDir) {
|
|
|
96626
96682
|
debugLogger79.warn(`Resource path not found: ${resolvedPath}`);
|
|
96627
96683
|
continue;
|
|
96628
96684
|
}
|
|
96629
|
-
const
|
|
96630
|
-
if (
|
|
96685
|
+
const stat22 = fs53.statSync(resolvedPath);
|
|
96686
|
+
if (stat22.isDirectory()) {
|
|
96631
96687
|
const dirName = path56.basename(resolvedPath);
|
|
96632
96688
|
const finalDestDir = dirName === destFolderName ? destDir : path56.join(destDir, dirName);
|
|
96633
96689
|
const files = await glob("**/*", {
|
|
@@ -97283,6 +97339,9 @@ async function checkForExtensionUpdate(extension, extensionManager, signal) {
|
|
|
97283
97339
|
signal?.throwIfAborted();
|
|
97284
97340
|
const installMetadata = extension.installMetadata;
|
|
97285
97341
|
if (installMetadata?.type === "local") {
|
|
97342
|
+
if (installMetadata.source.startsWith("upload:")) {
|
|
97343
|
+
return "not updatable" /* NOT_UPDATABLE */;
|
|
97344
|
+
}
|
|
97286
97345
|
let latestConfig;
|
|
97287
97346
|
let tempDir;
|
|
97288
97347
|
let convertedDir;
|
|
@@ -98204,7 +98263,7 @@ import * as path62 from "node:path";
|
|
|
98204
98263
|
init_esbuild_shims();
|
|
98205
98264
|
import * as fs59 from "node:fs";
|
|
98206
98265
|
import * as path61 from "node:path";
|
|
98207
|
-
import { stat as
|
|
98266
|
+
import { stat as stat12 } from "node:fs/promises";
|
|
98208
98267
|
var debugLogger83 = createDebugLogger("EXT_MARKETPLACE");
|
|
98209
98268
|
function parseSourceAndPluginName(source) {
|
|
98210
98269
|
const urlSchemes = ["http://", "https://", "git@", "sso://"];
|
|
@@ -98391,7 +98450,7 @@ async function loadMarketplaceConfigFromSource(source, networkPolicy) {
|
|
|
98391
98450
|
const trimmed = source.trim();
|
|
98392
98451
|
const lowerTrimmed = trimmed.toLowerCase();
|
|
98393
98452
|
try {
|
|
98394
|
-
const stats = await
|
|
98453
|
+
const stats = await stat12(trimmed);
|
|
98395
98454
|
if (stats.isDirectory()) {
|
|
98396
98455
|
return await readLocalMarketplaceConfig(trimmed);
|
|
98397
98456
|
}
|
|
@@ -98464,7 +98523,7 @@ async function parseInstallSource(source, options2 = {}) {
|
|
|
98464
98523
|
let marketplaceConfig = null;
|
|
98465
98524
|
let isLocalPath = false;
|
|
98466
98525
|
try {
|
|
98467
|
-
await
|
|
98526
|
+
await stat12(repo);
|
|
98468
98527
|
isLocalPath = true;
|
|
98469
98528
|
} catch {
|
|
98470
98529
|
}
|
|
@@ -103544,7 +103603,8 @@ var ExtensionManager = class _ExtensionManager {
|
|
|
103544
103603
|
options2.initialActivation,
|
|
103545
103604
|
options2.signal,
|
|
103546
103605
|
true,
|
|
103547
|
-
false
|
|
103606
|
+
false,
|
|
103607
|
+
options2.localSourcePath
|
|
103548
103608
|
);
|
|
103549
103609
|
}
|
|
103550
103610
|
async prepareExtensionUpdateFromState(extension, signal) {
|
|
@@ -103593,7 +103653,10 @@ var ExtensionManager = class _ExtensionManager {
|
|
|
103593
103653
|
)
|
|
103594
103654
|
};
|
|
103595
103655
|
}
|
|
103596
|
-
async installExtensionInternal(installMetadata, requestConsent, requestSetting, cwd, previousExtensionConfig, initialActivation, signal, prepareOnly, emitMutation) {
|
|
103656
|
+
async installExtensionInternal(installMetadata, requestConsent, requestSetting, cwd, previousExtensionConfig, initialActivation, signal, prepareOnly, emitMutation, localSourcePathOverride) {
|
|
103657
|
+
if (localSourcePathOverride && installMetadata.type !== "local") {
|
|
103658
|
+
throw new Error("A local source path requires a local install.");
|
|
103659
|
+
}
|
|
103597
103660
|
installMetadata = this.withNetworkPolicy(installMetadata);
|
|
103598
103661
|
const currentDir = cwd ?? this.workspaceDir;
|
|
103599
103662
|
const telemetryConfig = getTelemetryConfig(
|
|
@@ -103620,7 +103683,7 @@ var ExtensionManager = class _ExtensionManager {
|
|
|
103620
103683
|
}
|
|
103621
103684
|
const extensionsDir = this.configDir;
|
|
103622
103685
|
await fs66.promises.mkdir(extensionsDir, { recursive: true });
|
|
103623
|
-
if (!path67.isAbsolute(installMetadata.source) && (installMetadata.type === "local" || installMetadata.type === "link")) {
|
|
103686
|
+
if (!localSourcePathOverride && !path67.isAbsolute(installMetadata.source) && (installMetadata.type === "local" || installMetadata.type === "link")) {
|
|
103624
103687
|
installMetadata.source = path67.resolve(
|
|
103625
103688
|
currentDir,
|
|
103626
103689
|
installMetadata.source
|
|
@@ -103667,12 +103730,18 @@ var ExtensionManager = class _ExtensionManager {
|
|
|
103667
103730
|
);
|
|
103668
103731
|
installMetadata.releaseTag = result.version;
|
|
103669
103732
|
localSourcePath = tempDir;
|
|
103670
|
-
} else if (installMetadata.type === "local" && isSupportedArchivePath(
|
|
103733
|
+
} else if (installMetadata.type === "local" && isSupportedArchivePath(
|
|
103734
|
+
localSourcePathOverride ?? installMetadata.source
|
|
103735
|
+
)) {
|
|
103671
103736
|
tempDir = await ExtensionStorage.createTmpDir();
|
|
103672
|
-
await extractArchiveFile(
|
|
103737
|
+
await extractArchiveFile(
|
|
103738
|
+
localSourcePathOverride ?? installMetadata.source,
|
|
103739
|
+
tempDir,
|
|
103740
|
+
signal
|
|
103741
|
+
);
|
|
103673
103742
|
localSourcePath = tempDir;
|
|
103674
103743
|
} else if (installMetadata.type === "local" || installMetadata.type === "link") {
|
|
103675
|
-
localSourcePath = installMetadata.source;
|
|
103744
|
+
localSourcePath = localSourcePathOverride ?? installMetadata.source;
|
|
103676
103745
|
} else {
|
|
103677
103746
|
throw new Error(`Unsupported install type: ${installMetadata.type}`);
|
|
103678
103747
|
}
|
|
@@ -104484,13 +104553,13 @@ import * as os21 from "os";
|
|
|
104484
104553
|
// node_modules/chokidar/esm/index.js
|
|
104485
104554
|
init_esbuild_shims();
|
|
104486
104555
|
import { stat as statcb } from "fs";
|
|
104487
|
-
import { stat as
|
|
104556
|
+
import { stat as stat16, readdir as readdir10 } from "fs/promises";
|
|
104488
104557
|
import { EventEmitter as EventEmitter4 } from "events";
|
|
104489
104558
|
import * as sysPath2 from "path";
|
|
104490
104559
|
|
|
104491
104560
|
// node_modules/readdirp/esm/index.js
|
|
104492
104561
|
init_esbuild_shims();
|
|
104493
|
-
import { stat as
|
|
104562
|
+
import { stat as stat14, lstat as lstat7, readdir as readdir9, realpath as realpath6 } from "node:fs/promises";
|
|
104494
104563
|
import { Readable } from "node:stream";
|
|
104495
104564
|
import { resolve as presolve, relative as prelative, join as pjoin, sep as psep } from "node:path";
|
|
104496
104565
|
var EntryTypes = {
|
|
@@ -104531,7 +104600,7 @@ var FILE_TYPES = /* @__PURE__ */ new Set([
|
|
|
104531
104600
|
var isNormalFlowError = /* @__PURE__ */ __name((error) => NORMAL_FLOW_ERRORS.has(error.code), "isNormalFlowError");
|
|
104532
104601
|
var wantBigintFsStats = process.platform === "win32";
|
|
104533
104602
|
var emptyFn = /* @__PURE__ */ __name((_entryInfo) => true, "emptyFn");
|
|
104534
|
-
var
|
|
104603
|
+
var normalizeFilter2 = /* @__PURE__ */ __name((filter3) => {
|
|
104535
104604
|
if (filter3 === void 0)
|
|
104536
104605
|
return emptyFn;
|
|
104537
104606
|
if (typeof filter3 === "function")
|
|
@@ -104558,9 +104627,9 @@ var ReaddirpStream = class extends Readable {
|
|
|
104558
104627
|
});
|
|
104559
104628
|
const opts = { ...defaultOptions, ...options2 };
|
|
104560
104629
|
const { root, type } = opts;
|
|
104561
|
-
this._fileFilter =
|
|
104562
|
-
this._directoryFilter =
|
|
104563
|
-
const statMethod = opts.lstat ? lstat7 :
|
|
104630
|
+
this._fileFilter = normalizeFilter2(opts.fileFilter);
|
|
104631
|
+
this._directoryFilter = normalizeFilter2(opts.directoryFilter);
|
|
104632
|
+
const statMethod = opts.lstat ? lstat7 : stat14;
|
|
104564
104633
|
if (wantBigintFsStats) {
|
|
104565
104634
|
this._stat = (path98) => statMethod(path98, { bigint: true });
|
|
104566
104635
|
} else {
|
|
@@ -104715,7 +104784,7 @@ __name(readdirp, "readdirp");
|
|
|
104715
104784
|
// node_modules/chokidar/esm/handler.js
|
|
104716
104785
|
init_esbuild_shims();
|
|
104717
104786
|
import { watchFile, unwatchFile, watch as fs_watch } from "fs";
|
|
104718
|
-
import { open as open8, stat as
|
|
104787
|
+
import { open as open8, stat as stat15, lstat as lstat8, realpath as fsrealpath } from "fs/promises";
|
|
104719
104788
|
import * as sysPath from "path";
|
|
104720
104789
|
import { type as osType } from "os";
|
|
104721
104790
|
var STR_DATA = "data";
|
|
@@ -104742,7 +104811,7 @@ var EVENTS = {
|
|
|
104742
104811
|
};
|
|
104743
104812
|
var EV = EVENTS;
|
|
104744
104813
|
var THROTTLE_MODE_WATCH = "watch";
|
|
104745
|
-
var statMethods = { lstat: lstat8, stat:
|
|
104814
|
+
var statMethods = { lstat: lstat8, stat: stat15 };
|
|
104746
104815
|
var KEY_LISTENERS = "listeners";
|
|
104747
104816
|
var KEY_ERR = "errHandlers";
|
|
104748
104817
|
var KEY_RAW = "rawEmitters";
|
|
@@ -105232,7 +105301,7 @@ var NodeFsHandler = class {
|
|
|
105232
105301
|
return;
|
|
105233
105302
|
if (!newStats || newStats.mtimeMs === 0) {
|
|
105234
105303
|
try {
|
|
105235
|
-
const newStats2 = await
|
|
105304
|
+
const newStats2 = await stat15(file);
|
|
105236
105305
|
if (this.fsw.closed)
|
|
105237
105306
|
return;
|
|
105238
105307
|
const at2 = newStats2.atimeMs;
|
|
@@ -105945,7 +106014,7 @@ var FSWatcher = class extends EventEmitter4 {
|
|
|
105945
106014
|
const fullPath = opts.cwd ? sysPath2.join(opts.cwd, path98) : path98;
|
|
105946
106015
|
let stats2;
|
|
105947
106016
|
try {
|
|
105948
|
-
stats2 = await
|
|
106017
|
+
stats2 = await stat16(fullPath);
|
|
105949
106018
|
} catch (err) {
|
|
105950
106019
|
}
|
|
105951
106020
|
if (!stats2 || this.closed)
|
|
@@ -106073,8 +106142,8 @@ var FSWatcher = class extends EventEmitter4 {
|
|
|
106073
106142
|
}
|
|
106074
106143
|
return this._userIgnored(path98, stats);
|
|
106075
106144
|
}
|
|
106076
|
-
_isntIgnored(path98,
|
|
106077
|
-
return !this._isIgnored(path98,
|
|
106145
|
+
_isntIgnored(path98, stat22) {
|
|
106146
|
+
return !this._isIgnored(path98, stat22);
|
|
106078
106147
|
}
|
|
106079
106148
|
/**
|
|
106080
106149
|
* Provides a set of common helpers and properties relating to symlink handling.
|
|
@@ -107280,12 +107349,12 @@ __name(isWithin, "isWithin");
|
|
|
107280
107349
|
async function readBoundedTaskFile(filePath) {
|
|
107281
107350
|
const handle = await fs68.open(filePath, "r");
|
|
107282
107351
|
try {
|
|
107283
|
-
const
|
|
107284
|
-
if (!
|
|
107352
|
+
const stat22 = await handle.stat();
|
|
107353
|
+
if (!stat22.isFile()) {
|
|
107285
107354
|
return null;
|
|
107286
107355
|
}
|
|
107287
107356
|
const cap = LOOP_TASK_FILE_MAX_BYTES + 1;
|
|
107288
|
-
const allocSize = Math.min(cap,
|
|
107357
|
+
const allocSize = Math.min(cap, stat22.size + 1);
|
|
107289
107358
|
const buffer = Buffer.alloc(allocSize);
|
|
107290
107359
|
let total = 0;
|
|
107291
107360
|
while (total < allocSize) {
|
|
@@ -112224,6 +112293,29 @@ var BackgroundTaskRegistry = class {
|
|
|
112224
112293
|
}
|
|
112225
112294
|
return false;
|
|
112226
112295
|
}
|
|
112296
|
+
/**
|
|
112297
|
+
* The agent ids behind `hasUnfinalizedTasks()`, in registration order.
|
|
112298
|
+
*
|
|
112299
|
+
* Callers that must *name* the outstanding work — rather than just know
|
|
112300
|
+
* that some exists — use this. The daemon's active-work snapshot builds
|
|
112301
|
+
* one hold per id so a restart controller and the session-retention path
|
|
112302
|
+
* both see the same set the registry itself would report, with no second
|
|
112303
|
+
* ledger to drift out of sync. Deliberately shares
|
|
112304
|
+
* `hasUnfinalizedTasks()`'s predicate (and not `hasRunningTasks()`'s):
|
|
112305
|
+
* a cancelled entry still owes its terminal task-notification, and
|
|
112306
|
+
* dropping it here would let the daemon reap the session inside the
|
|
112307
|
+
* cancel → finalizeCancelled() window.
|
|
112308
|
+
*/
|
|
112309
|
+
listUnfinalizedBackgroundAgentIds() {
|
|
112310
|
+
const ids = [];
|
|
112311
|
+
for (const entry of this.agents.values()) {
|
|
112312
|
+
if (!entry.isBackgrounded) continue;
|
|
112313
|
+
if (entry.status === "running" || entry.status === "cancelled" && !entry.notified) {
|
|
112314
|
+
ids.push(entry.agentId);
|
|
112315
|
+
}
|
|
112316
|
+
}
|
|
112317
|
+
return ids;
|
|
112318
|
+
}
|
|
112227
112319
|
/**
|
|
112228
112320
|
* True while any background entry is still actually executing. Unlike
|
|
112229
112321
|
* `hasUnfinalizedTasks()`, a `cancelled`-but-not-yet-finalized entry
|
|
@@ -112387,6 +112479,19 @@ var BackgroundTaskRegistry = class {
|
|
|
112387
112479
|
setStatusChangeCallback(cb) {
|
|
112388
112480
|
this.statusChangeCallback = cb;
|
|
112389
112481
|
}
|
|
112482
|
+
/**
|
|
112483
|
+
* Retract `cb`, but only if it is still the installed one.
|
|
112484
|
+
*
|
|
112485
|
+
* The slot holds a single callback, so a subscriber that clears it
|
|
112486
|
+
* unconditionally on teardown can unhook whoever claimed it afterwards. This
|
|
112487
|
+
* makes the retraction safe to call from any owner's dispose path without
|
|
112488
|
+
* having to know whether it is still the owner.
|
|
112489
|
+
*/
|
|
112490
|
+
clearStatusChangeCallback(cb) {
|
|
112491
|
+
if (this.statusChangeCallback === cb) {
|
|
112492
|
+
this.statusChangeCallback = void 0;
|
|
112493
|
+
}
|
|
112494
|
+
}
|
|
112390
112495
|
setActivityChangeCallback(cb) {
|
|
112391
112496
|
this.activityChangeCallback = cb;
|
|
112392
112497
|
}
|
|
@@ -114764,7 +114869,7 @@ async function runSpeculativeLoop(config, state, cacheSafe, modelOverride) {
|
|
|
114764
114869
|
toolInvocationGuard,
|
|
114765
114870
|
{
|
|
114766
114871
|
callId: persistenceCallId,
|
|
114767
|
-
toolName:
|
|
114872
|
+
toolName: canonicalToolName(name),
|
|
114768
114873
|
args: invocation.params,
|
|
114769
114874
|
signal: state.abortController.signal,
|
|
114770
114875
|
...invocationContext ? { invocationContext } : {}
|
|
@@ -115442,12 +115547,12 @@ function resolveGitDir2(crawlDirectory) {
|
|
|
115442
115547
|
while (current) {
|
|
115443
115548
|
const gitPath = path76.join(current, ".git");
|
|
115444
115549
|
try {
|
|
115445
|
-
const
|
|
115446
|
-
if (
|
|
115550
|
+
const stat22 = fs72.statSync(gitPath);
|
|
115551
|
+
if (stat22.isDirectory()) {
|
|
115447
115552
|
pathCacheSet(resolveGitDirCache, cacheKey, gitPath);
|
|
115448
115553
|
return gitPath;
|
|
115449
115554
|
}
|
|
115450
|
-
if (
|
|
115555
|
+
if (stat22.isFile()) {
|
|
115451
115556
|
const contents = fs72.readFileSync(gitPath, "utf8").trim();
|
|
115452
115557
|
const match2 = contents.match(/^gitdir:\s*(.+)$/i);
|
|
115453
115558
|
if (!match2) {
|
|
@@ -116055,13 +116160,13 @@ async function crawlWithGitLsFiles(stateKey, crawlDirectory, cwd, options2, work
|
|
|
116055
116160
|
if (deletedSet.has(normalizedFile)) {
|
|
116056
116161
|
return true;
|
|
116057
116162
|
}
|
|
116058
|
-
let
|
|
116163
|
+
let stat22;
|
|
116059
116164
|
try {
|
|
116060
|
-
|
|
116165
|
+
stat22 = fs72.lstatSync(path76.join(gitRoot, ...normalizedFile.split("/")));
|
|
116061
116166
|
} catch {
|
|
116062
116167
|
return true;
|
|
116063
116168
|
}
|
|
116064
|
-
if (
|
|
116169
|
+
if (stat22.isDirectory()) {
|
|
116065
116170
|
return true;
|
|
116066
116171
|
}
|
|
116067
116172
|
if (relativeToGitRoot && relativeToGitRoot !== "." && normalizedFile === relativeToGitRoot) {
|
|
@@ -121940,8 +122045,8 @@ function getWelcomeBackStatePath() {
|
|
|
121940
122045
|
return path85.join(process.cwd(), ".qwen", WELCOME_BACK_STATE_FILENAME);
|
|
121941
122046
|
}
|
|
121942
122047
|
__name(getWelcomeBackStatePath, "getWelcomeBackStatePath");
|
|
121943
|
-
function buildSummaryFingerprint(
|
|
121944
|
-
return `${
|
|
122048
|
+
function buildSummaryFingerprint(stat22) {
|
|
122049
|
+
return `${stat22.mtimeMs}:${stat22.size}`;
|
|
121945
122050
|
}
|
|
121946
122051
|
__name(buildSummaryFingerprint, "buildSummaryFingerprint");
|
|
121947
122052
|
async function getWelcomeBackState() {
|
|
@@ -127084,11 +127189,30 @@ function createInstructionsLoadedCallback(getHookSystem) {
|
|
|
127084
127189
|
}
|
|
127085
127190
|
__name(createInstructionsLoadedCallback, "createInstructionsLoadedCallback");
|
|
127086
127191
|
|
|
127192
|
+
// packages/core/src/hooks/user-prompt-submit-context.ts
|
|
127193
|
+
init_esbuild_shims();
|
|
127194
|
+
|
|
127087
127195
|
// packages/core/src/goals/index.ts
|
|
127088
127196
|
init_esbuild_shims();
|
|
127089
127197
|
|
|
127090
127198
|
// packages/core/src/goals/goal-legacy-projection.ts
|
|
127091
127199
|
init_esbuild_shims();
|
|
127200
|
+
function isGoalCheckpointBookkeepingTransition(previous, next) {
|
|
127201
|
+
const previousGoal = previous?.goal;
|
|
127202
|
+
const nextGoal = next.goal;
|
|
127203
|
+
if (!previousGoal || !nextGoal) return false;
|
|
127204
|
+
return previousGoal.goalId === nextGoal.goalId && previousGoal.revision === nextGoal.revision && previousGoal.objective === nextGoal.objective && previousGoal.status === nextGoal.status && previousGoal.turnCount === nextGoal.turnCount && previousGoal.createdAt === nextGoal.createdAt && previousGoal.lastReason === nextGoal.lastReason;
|
|
127205
|
+
}
|
|
127206
|
+
__name(isGoalCheckpointBookkeepingTransition, "isGoalCheckpointBookkeepingTransition");
|
|
127207
|
+
function isGoalCheckpointBookkeepingCause(cause, previousCause) {
|
|
127208
|
+
if (cause === "checkpoint") return true;
|
|
127209
|
+
return cause === "verifier_reject" && (previousCause === "verifier_reject" || previousCause === "checkpoint");
|
|
127210
|
+
}
|
|
127211
|
+
__name(isGoalCheckpointBookkeepingCause, "isGoalCheckpointBookkeepingCause");
|
|
127212
|
+
function isGoalCheckpointBookkeepingRecord(input) {
|
|
127213
|
+
return isGoalCheckpointBookkeepingTransition(input.previous, input.next) && isGoalCheckpointBookkeepingCause(input.cause, input.previousCause);
|
|
127214
|
+
}
|
|
127215
|
+
__name(isGoalCheckpointBookkeepingRecord, "isGoalCheckpointBookkeepingRecord");
|
|
127092
127216
|
|
|
127093
127217
|
// packages/core/src/goals/goal-verifier.ts
|
|
127094
127218
|
init_esbuild_shims();
|
|
@@ -129423,7 +129547,7 @@ ${result.output}`;
|
|
|
129423
129547
|
}
|
|
129424
129548
|
const elapsedMs = performance.now() - executionStartTime;
|
|
129425
129549
|
const longRunThreshold = effectiveTimeout === 0 ? null : longRunThresholdFor(effectiveTimeout);
|
|
129426
|
-
const shouldAppendLongRunHint = longRunThreshold !== null && !result.aborted && result.signal
|
|
129550
|
+
const shouldAppendLongRunHint = longRunThreshold !== null && !result.aborted && !isSignalTermination(result.signal) && elapsedMs >= longRunThreshold;
|
|
129427
129551
|
debugLogger122.debug(
|
|
129428
129552
|
`long-run hint: elapsed=${Math.round(elapsedMs)}ms threshold=${longRunThreshold === null ? "disabled" : `${longRunThreshold}ms`} aborted=${result.aborted} signal=${result.signal} \u2192 ${shouldAppendLongRunHint ? "fire" : "suppress"}`
|
|
129429
129553
|
);
|
|
@@ -129437,7 +129561,7 @@ ${result.output}` : result.output;
|
|
|
129437
129561
|
} else {
|
|
129438
129562
|
if (result.aborted) {
|
|
129439
129563
|
returnDisplayMessage = wasTimeout ? `${timeoutSummary} There was no output before it timed out.` : wasPromoteRefused ? "Command finished before background-promote could be honoured." : "Command cancelled by user.";
|
|
129440
|
-
} else if (result.signal) {
|
|
129564
|
+
} else if (isSignalTermination(result.signal)) {
|
|
129441
129565
|
returnDisplayMessage = `Command terminated by signal: ${result.signal}`;
|
|
129442
129566
|
} else if (result.error) {
|
|
129443
129567
|
returnDisplayMessage = `Command failed: ${getErrorMessage(
|
|
@@ -129509,7 +129633,7 @@ ${attributionWarning}`;
|
|
|
129509
129633
|
${longRunHint}` : ""),
|
|
129510
129634
|
type: "shell_execute_error" /* SHELL_EXECUTE_ERROR */
|
|
129511
129635
|
}
|
|
129512
|
-
} : isShellExitError(this.params.command, result.exitCode) ? {
|
|
129636
|
+
} : !result.aborted && isSignalTermination(result.signal) || isShellExitError(this.params.command, result.exitCode) ? {
|
|
129513
129637
|
error: {
|
|
129514
129638
|
// Schedulers use error.message as the model-facing response.
|
|
129515
129639
|
message: typeof llmContent === "string" ? llmContent : returnDisplayMessage,
|
|
@@ -129709,16 +129833,17 @@ ${longRunHint}` : ""),
|
|
|
129709
129833
|
let postPromoteFinalStatus = null;
|
|
129710
129834
|
const classifySettle = /* @__PURE__ */ __name((info) => {
|
|
129711
129835
|
if (info.error) return { status: "failed", failMsg: info.error.message };
|
|
129712
|
-
if (info.
|
|
129713
|
-
if (info.exitCode !== null)
|
|
129836
|
+
if (isSignalTermination(info.signal)) {
|
|
129714
129837
|
return {
|
|
129715
129838
|
status: "failed",
|
|
129716
|
-
failMsg: `
|
|
129839
|
+
failMsg: `Terminated by signal ${info.signal}`
|
|
129717
129840
|
};
|
|
129718
|
-
|
|
129841
|
+
}
|
|
129842
|
+
if (info.exitCode === 0) return { status: "completed", failMsg: null };
|
|
129843
|
+
if (info.exitCode !== null)
|
|
129719
129844
|
return {
|
|
129720
129845
|
status: "failed",
|
|
129721
|
-
failMsg: `
|
|
129846
|
+
failMsg: `Exited with code ${info.exitCode}`
|
|
129722
129847
|
};
|
|
129723
129848
|
debugLogger122.warn(
|
|
129724
129849
|
`promote: classifySettle all-null fallback hit for ${shellId} \u2014 exitCode=${info.exitCode}, signal=${info.signal}, error=undefined`
|
|
@@ -129729,6 +129854,10 @@ ${longRunHint}` : ""),
|
|
|
129729
129854
|
};
|
|
129730
129855
|
}, "classifySettle");
|
|
129731
129856
|
const transitionRegistry = /* @__PURE__ */ __name((info) => {
|
|
129857
|
+
if (entryAc.signal.aborted) {
|
|
129858
|
+
registry.cancel(shellId, info.endTime);
|
|
129859
|
+
return;
|
|
129860
|
+
}
|
|
129732
129861
|
const cls = classifySettle(info);
|
|
129733
129862
|
if (cls.status === "completed") {
|
|
129734
129863
|
registry.complete(shellId, info.exitCode, info.endTime);
|
|
@@ -129886,8 +130015,8 @@ ${longRunHint}` : ""),
|
|
|
129886
130015
|
if (registry.get(shellId)?.status === "running") {
|
|
129887
130016
|
registry.cancel(shellId, endTime);
|
|
129888
130017
|
}
|
|
129889
|
-
} else if (result.error || result.exitCode !== null && result.exitCode !== 0 || result.signal
|
|
129890
|
-
const reason = result.error ? result.error.message : result.signal
|
|
130018
|
+
} else if (result.error || result.exitCode !== null && result.exitCode !== 0 || isSignalTermination(result.signal)) {
|
|
130019
|
+
const reason = result.error ? result.error.message : isSignalTermination(result.signal) ? `terminated by signal ${result.signal}` : `exited with code ${result.exitCode}`;
|
|
129891
130020
|
registry.fail(shellId, reason, endTime);
|
|
129892
130021
|
} else {
|
|
129893
130022
|
registry.complete(shellId, result.exitCode ?? 0, endTime);
|
|
@@ -130857,12 +130986,8 @@ var FS_PATH_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
|
130857
130986
|
ToolNames.NOTEBOOK_EDIT,
|
|
130858
130987
|
ToolNames.DISPLAY_IMAGE
|
|
130859
130988
|
]);
|
|
130860
|
-
function canonicalToolName2(toolName) {
|
|
130861
|
-
return ToolNamesMigration[toolName] ?? toolName;
|
|
130862
|
-
}
|
|
130863
|
-
__name(canonicalToolName2, "canonicalToolName");
|
|
130864
130989
|
function isFilesystemPathTool(toolName) {
|
|
130865
|
-
return FS_PATH_TOOL_NAMES.has(
|
|
130990
|
+
return FS_PATH_TOOL_NAMES.has(canonicalToolName(toolName));
|
|
130866
130991
|
}
|
|
130867
130992
|
__name(isFilesystemPathTool, "isFilesystemPathTool");
|
|
130868
130993
|
function trimTrailingSlash(s3) {
|
|
@@ -130892,7 +131017,7 @@ function pushLspPathCandidate(out, v2) {
|
|
|
130892
131017
|
}
|
|
130893
131018
|
__name(pushLspPathCandidate, "pushLspPathCandidate");
|
|
130894
131019
|
function extractToolFilePaths(toolName, toolInput) {
|
|
130895
|
-
const canonical =
|
|
131020
|
+
const canonical = canonicalToolName(toolName);
|
|
130896
131021
|
if (!FS_PATH_TOOL_NAMES.has(canonical)) {
|
|
130897
131022
|
if (toolInput && typeof toolInput === "object") {
|
|
130898
131023
|
const obj2 = toolInput;
|
|
@@ -131273,7 +131398,7 @@ function withPostToolBatchStop(completedCalls, stopReason) {
|
|
|
131273
131398
|
}
|
|
131274
131399
|
__name(withPostToolBatchStop, "withPostToolBatchStop");
|
|
131275
131400
|
function isToolCallConcurrencySafe(name, kind, args) {
|
|
131276
|
-
if (
|
|
131401
|
+
if (canonicalToolName(name) === ToolNames.AGENT) return true;
|
|
131277
131402
|
if (kind === "execute" /* Execute */) {
|
|
131278
131403
|
const command = args?.command;
|
|
131279
131404
|
if (typeof command !== "string") return false;
|
|
@@ -132006,7 +132131,7 @@ var CoreToolScheduler = class {
|
|
|
132006
132131
|
Array.isArray(request) ? request : [request]
|
|
132007
132132
|
);
|
|
132008
132133
|
const planModeEntryBoundaryIndex = findPlanModeEntryBatchBoundaryIndex(
|
|
132009
|
-
requestsToProcess.map((item) =>
|
|
132134
|
+
requestsToProcess.map((item) => canonicalToolName(item.name))
|
|
132010
132135
|
);
|
|
132011
132136
|
if (this.validationRetryCounts.size > 0) {
|
|
132012
132137
|
const currentToolNames = new Set(requestsToProcess.map((r) => r.name));
|
|
@@ -132071,7 +132196,7 @@ var CoreToolScheduler = class {
|
|
|
132071
132196
|
});
|
|
132072
132197
|
continue;
|
|
132073
132198
|
}
|
|
132074
|
-
const canonicalName =
|
|
132199
|
+
const canonicalName = canonicalToolName(reqInfo.name);
|
|
132075
132200
|
const pm = this.config.getPermissionManager?.();
|
|
132076
132201
|
const permissionEnabled = pm ? await pm.isToolEnabled(canonicalName) : true;
|
|
132077
132202
|
if (recordPrevalidationCancellation()) continue;
|
|
@@ -132263,7 +132388,7 @@ var CoreToolScheduler = class {
|
|
|
132263
132388
|
continue;
|
|
132264
132389
|
}
|
|
132265
132390
|
const { request: reqInfo, invocation } = toolCall;
|
|
132266
|
-
const canonicalName =
|
|
132391
|
+
const canonicalName = canonicalToolName(reqInfo.name);
|
|
132267
132392
|
const toolSpan = startToolSpan(
|
|
132268
132393
|
canonicalName,
|
|
132269
132394
|
{
|
|
@@ -133358,7 +133483,7 @@ var CoreToolScheduler = class {
|
|
|
133358
133483
|
}
|
|
133359
133484
|
let toolSpan = this.toolSpans.get(callId);
|
|
133360
133485
|
if (!toolSpan) {
|
|
133361
|
-
const canonical =
|
|
133486
|
+
const canonical = canonicalToolName(toolName);
|
|
133362
133487
|
toolSpan = startToolSpan(
|
|
133363
133488
|
canonical,
|
|
133364
133489
|
{
|
|
@@ -133436,12 +133561,13 @@ var CoreToolScheduler = class {
|
|
|
133436
133561
|
*/
|
|
133437
133562
|
bounceToAwaitingApprovalForAsk(scheduledCall, reason, toolSpan, signal) {
|
|
133438
133563
|
const { callId, name: toolName } = scheduledCall.request;
|
|
133439
|
-
const canonicalName =
|
|
133564
|
+
const canonicalName = canonicalToolName(toolName);
|
|
133440
133565
|
this.bouncedAwaitingApproval.add(callId);
|
|
133441
133566
|
const confirmationDetails = {
|
|
133442
133567
|
type: "info",
|
|
133443
133568
|
title: `Hook requested confirmation to run ${toolName}`,
|
|
133444
133569
|
prompt: reason || `A PreToolUse hook requested confirmation before running ${toolName}.`,
|
|
133570
|
+
renderPromptAsPlainText: true,
|
|
133445
133571
|
hideAlwaysAllow: true,
|
|
133446
133572
|
onConfirm: /* @__PURE__ */ __name((outcome, payload) => this.handleConfirmationResponse(
|
|
133447
133573
|
callId,
|
|
@@ -133490,7 +133616,7 @@ var CoreToolScheduler = class {
|
|
|
133490
133616
|
}
|
|
133491
133617
|
async _executeToolCallBody(scheduledCall, signal, span) {
|
|
133492
133618
|
const { callId, name: toolName } = scheduledCall.request;
|
|
133493
|
-
const canonicalName =
|
|
133619
|
+
const canonicalName = canonicalToolName(toolName);
|
|
133494
133620
|
const invocation = scheduledCall.invocation;
|
|
133495
133621
|
const toolInput = scheduledCall.request.args;
|
|
133496
133622
|
const isPostAskReexecution = this.bouncedAwaitingApproval.delete(callId);
|
|
@@ -134570,7 +134696,7 @@ ${failureHookResult.additionalContext}`;
|
|
|
134570
134696
|
}
|
|
134571
134697
|
}
|
|
134572
134698
|
async maybePersistLargeToolResult(callId, toolName, content) {
|
|
134573
|
-
if (GATE_EXEMPT_TOOLS.has(
|
|
134699
|
+
if (GATE_EXEMPT_TOOLS.has(canonicalToolName(toolName))) return { content };
|
|
134574
134700
|
const text = extractTextFromPartListUnion(content);
|
|
134575
134701
|
if (!text || isAlreadyTruncated(text)) return { content };
|
|
134576
134702
|
const gateThreshold = this.config.getTruncateToolOutputThreshold() + GATE_HEADROOM;
|
|
@@ -139902,6 +140028,9 @@ async function runAutoMemoryExtract(params) {
|
|
|
139902
140028
|
);
|
|
139903
140029
|
}) : Promise.resolve();
|
|
139904
140030
|
await Promise.all([projectRebuild, userRebuild]);
|
|
140031
|
+
await refreshMemoryInstruction(params.config, {
|
|
140032
|
+
logContext: "managed auto-memory extraction"
|
|
140033
|
+
});
|
|
139905
140034
|
}
|
|
139906
140035
|
const madeGenuineProgress = agentResult.touchedTopics.length > 0 || agentResult.hasToolActivity;
|
|
139907
140036
|
const cursor = {
|
|
@@ -142108,7 +142237,8 @@ var GeminiClient = class _GeminiClient {
|
|
|
142108
142237
|
if (resumeTokenCounts) {
|
|
142109
142238
|
chat.seedResumeTokenCounts(
|
|
142110
142239
|
resumeTokenCounts.promptTokenCount,
|
|
142111
|
-
resumeTokenCounts.outputTokenCount
|
|
142240
|
+
resumeTokenCounts.outputTokenCount,
|
|
142241
|
+
resumeTokenCounts.isEstimated
|
|
142112
142242
|
);
|
|
142113
142243
|
} else {
|
|
142114
142244
|
chat.setLastPromptTokenCount(
|
|
@@ -143477,7 +143607,8 @@ var GeminiClient = class _GeminiClient {
|
|
|
143477
143607
|
strippedRetryEntries = this.stripOrphanedUserEntriesFromHistory() ?? [];
|
|
143478
143608
|
pushCountAfterStrip = currentPushCount();
|
|
143479
143609
|
}
|
|
143480
|
-
|
|
143610
|
+
const preHookUserPromptText = messageType === "userQuery" /* UserQuery */ ? partToString(request) : void 0;
|
|
143611
|
+
let userPromptRecordPayload;
|
|
143481
143612
|
let hooksEnabled;
|
|
143482
143613
|
let messageBus;
|
|
143483
143614
|
try {
|
|
@@ -143488,7 +143619,7 @@ var GeminiClient = class _GeminiClient {
|
|
|
143488
143619
|
// hooks must not fire on (or be able to block) internal team
|
|
143489
143620
|
// coordination traffic.
|
|
143490
143621
|
messageType !== "teammate" /* Teammate */ && messageType !== "goal" /* Goal */ && hooksEnabled && messageBus && this.config.hasHooksForEvent("UserPromptSubmit")) {
|
|
143491
|
-
const promptText = partToString(request);
|
|
143622
|
+
const promptText = preHookUserPromptText ?? partToString(request);
|
|
143492
143623
|
const submittedPrompt = messageType === "userQuery" /* UserQuery */ && typeof options2?.submittedPrompt === "string" && options2.submittedPrompt.trim().length > 0 ? options2.submittedPrompt : void 0;
|
|
143493
143624
|
const response = await messageBus.request(
|
|
143494
143625
|
{
|
|
@@ -143538,7 +143669,12 @@ var GeminiClient = class _GeminiClient {
|
|
|
143538
143669
|
...requestArray,
|
|
143539
143670
|
{ text: wrapUserPromptSubmitContext(additionalContext) }
|
|
143540
143671
|
];
|
|
143541
|
-
|
|
143672
|
+
if (messageType === "userQuery" /* UserQuery */) {
|
|
143673
|
+
userPromptRecordPayload = {
|
|
143674
|
+
displayText: submittedPrompt ?? promptText,
|
|
143675
|
+
hookContext: additionalContext
|
|
143676
|
+
};
|
|
143677
|
+
}
|
|
143542
143678
|
}
|
|
143543
143679
|
}
|
|
143544
143680
|
} catch (error) {
|
|
@@ -143640,7 +143776,7 @@ var GeminiClient = class _GeminiClient {
|
|
|
143640
143776
|
addUserPromptAttributes(
|
|
143641
143777
|
this.config,
|
|
143642
143778
|
interactionSpan,
|
|
143643
|
-
|
|
143779
|
+
preHookUserPromptText ?? partToString(request)
|
|
143644
143780
|
);
|
|
143645
143781
|
}
|
|
143646
143782
|
}
|
|
@@ -143668,7 +143804,7 @@ var GeminiClient = class _GeminiClient {
|
|
|
143668
143804
|
}
|
|
143669
143805
|
const promise = this.config.getMemoryManager().recall(
|
|
143670
143806
|
this.config.getProjectRoot(),
|
|
143671
|
-
|
|
143807
|
+
preHookUserPromptText ?? partToString(request),
|
|
143672
143808
|
{
|
|
143673
143809
|
config: this.config,
|
|
143674
143810
|
excludedFilePaths: this.surfacedRelevantAutoMemoryPaths,
|
|
@@ -143720,13 +143856,15 @@ var GeminiClient = class _GeminiClient {
|
|
|
143720
143856
|
goalPermit
|
|
143721
143857
|
);
|
|
143722
143858
|
} else {
|
|
143723
|
-
const
|
|
143724
|
-
if (
|
|
143725
|
-
|
|
143726
|
-
|
|
143727
|
-
|
|
143728
|
-
|
|
143729
|
-
|
|
143859
|
+
const recorder = this.config.getChatRecordingService();
|
|
143860
|
+
if (userPromptRecordPayload) {
|
|
143861
|
+
recorder?.recordUserMessage(
|
|
143862
|
+
request,
|
|
143863
|
+
goalPermit,
|
|
143864
|
+
userPromptRecordPayload
|
|
143865
|
+
);
|
|
143866
|
+
} else {
|
|
143867
|
+
recorder?.recordUserMessage(request, goalPermit);
|
|
143730
143868
|
}
|
|
143731
143869
|
}
|
|
143732
143870
|
}
|
|
@@ -144614,15 +144752,15 @@ The current date is: ${today}. Note: This is the authoritative current date \u20
|
|
|
144614
144752
|
async tryCompressChat(prompt_id, force = false, signal, customInstructions) {
|
|
144615
144753
|
const previousSessionStartContext = this.lastSessionStartContext;
|
|
144616
144754
|
const previousSessionStartSource = this.lastSessionStartSource;
|
|
144617
|
-
const
|
|
144755
|
+
const previousChat = this.getChat();
|
|
144756
|
+
const info = await previousChat.tryCompress(
|
|
144618
144757
|
prompt_id,
|
|
144619
144758
|
force,
|
|
144620
144759
|
signal,
|
|
144621
144760
|
customInstructions ? { customInstructions } : void 0
|
|
144622
144761
|
);
|
|
144623
144762
|
if (info.compressionStatus === 1 /* COMPRESSED */) {
|
|
144624
|
-
const
|
|
144625
|
-
const compressedHistory = chat.getHistoryShallow?.() ?? chat.getHistory();
|
|
144763
|
+
const compressedHistory = previousChat.getHistoryShallow?.() ?? previousChat.getHistory();
|
|
144626
144764
|
await this.startChat(compressedHistory, "compact" /* Compact */);
|
|
144627
144765
|
if (!this.lastSessionStartContext && previousSessionStartContext && previousSessionStartSource) {
|
|
144628
144766
|
this.lastSessionStartContext = previousSessionStartContext;
|
|
@@ -144634,7 +144772,10 @@ The current date is: ${today}. Note: This is the authoritative current date \u20
|
|
|
144634
144772
|
}
|
|
144635
144773
|
debugLogger133.debug("[FILE_READ_CACHE] clear after tryCompressChat");
|
|
144636
144774
|
this.config.getFileReadCache().clear();
|
|
144637
|
-
this.getChat().setLastPromptTokenCount(
|
|
144775
|
+
this.getChat().setLastPromptTokenCount(
|
|
144776
|
+
info.newTokenCount,
|
|
144777
|
+
info.newTokenCountIsEstimated ?? true
|
|
144778
|
+
);
|
|
144638
144779
|
this.forceFullIdeContext = true;
|
|
144639
144780
|
}
|
|
144640
144781
|
return info;
|
|
@@ -150579,7 +150720,8 @@ var Config = class _Config {
|
|
|
150579
150720
|
const runtime = createGoalRuntime({
|
|
150580
150721
|
journal: this.chatRecordingService,
|
|
150581
150722
|
evidenceSource: this.chatRecordingService,
|
|
150582
|
-
verifier: createGoalVerifier(this)
|
|
150723
|
+
verifier: createGoalVerifier(this),
|
|
150724
|
+
checkpointVerifier: createGoalCheckpointVerifier(this)
|
|
150583
150725
|
});
|
|
150584
150726
|
this.goalRuntime = runtime;
|
|
150585
150727
|
if (this.goalTurnHost) {
|
|
@@ -150911,7 +151053,7 @@ var Config = class _Config {
|
|
|
150911
151053
|
}
|
|
150912
151054
|
if (!enabled) return;
|
|
150913
151055
|
registry.registerFactory(ToolNames.IMAGE_GEN, async () => {
|
|
150914
|
-
const { ImageGenTool } = await import("./image-gen-
|
|
151056
|
+
const { ImageGenTool } = await import("./image-gen-AUIZJJNK.js");
|
|
150915
151057
|
return new ImageGenTool(this);
|
|
150916
151058
|
});
|
|
150917
151059
|
}
|
|
@@ -150941,36 +151083,36 @@ var Config = class _Config {
|
|
|
150941
151083
|
if (options2?.forSubAgent) return;
|
|
150942
151084
|
const schema = this.jsonSchema;
|
|
150943
151085
|
await registerLazy(ToolNames.STRUCTURED_OUTPUT, async () => {
|
|
150944
|
-
const { SyntheticOutputTool } = await import("./syntheticOutput-
|
|
151086
|
+
const { SyntheticOutputTool } = await import("./syntheticOutput-PEBJQYJV.js");
|
|
150945
151087
|
return new SyntheticOutputTool(schema);
|
|
150946
151088
|
});
|
|
150947
151089
|
}, "registerStructuredOutputIfRequested");
|
|
150948
151090
|
const registerGoalWorkerTools = /* @__PURE__ */ __name(async () => {
|
|
150949
151091
|
if (options2?.forSubAgent) return;
|
|
150950
151092
|
await registerLazy(ToolNames.GET_GOAL, async () => {
|
|
150951
|
-
const { GetGoalTool } = await import("./goal-tools-
|
|
151093
|
+
const { GetGoalTool } = await import("./goal-tools-PXWN5VK3.js");
|
|
150952
151094
|
return new GetGoalTool(this);
|
|
150953
151095
|
});
|
|
150954
151096
|
await registerLazy(ToolNames.UPDATE_GOAL, async () => {
|
|
150955
|
-
const { UpdateGoalTool } = await import("./goal-tools-
|
|
151097
|
+
const { UpdateGoalTool } = await import("./goal-tools-PXWN5VK3.js");
|
|
150956
151098
|
return new UpdateGoalTool(this);
|
|
150957
151099
|
});
|
|
150958
151100
|
}, "registerGoalWorkerTools");
|
|
150959
151101
|
if (this.getBareMode()) {
|
|
150960
151102
|
await registerLazy(ToolNames.READ_FILE, async () => {
|
|
150961
|
-
const { ReadFileTool } = await import("./read-file-
|
|
151103
|
+
const { ReadFileTool } = await import("./read-file-3M6WXDXP.js");
|
|
150962
151104
|
return new ReadFileTool(this);
|
|
150963
151105
|
});
|
|
150964
151106
|
await registerLazy(ToolNames.EDIT, async () => {
|
|
150965
|
-
const { EditTool } = await import("./edit-
|
|
151107
|
+
const { EditTool } = await import("./edit-ITMZYFKA.js");
|
|
150966
151108
|
return new EditTool(this);
|
|
150967
151109
|
});
|
|
150968
151110
|
await registerLazy(ToolNames.NOTEBOOK_EDIT, async () => {
|
|
150969
|
-
const { NotebookEditTool } = await import("./notebook-edit-
|
|
151111
|
+
const { NotebookEditTool } = await import("./notebook-edit-474DPMRL.js");
|
|
150970
151112
|
return new NotebookEditTool(this);
|
|
150971
151113
|
});
|
|
150972
151114
|
await registerLazy(ToolNames.SHELL, async () => {
|
|
150973
|
-
const { ShellTool: ShellTool2 } = await import("./shell-
|
|
151115
|
+
const { ShellTool: ShellTool2 } = await import("./shell-23OMNMW6.js");
|
|
150974
151116
|
return new ShellTool2(this);
|
|
150975
151117
|
});
|
|
150976
151118
|
await registerGoalWorkerTools();
|
|
@@ -150982,43 +151124,43 @@ var Config = class _Config {
|
|
|
150982
151124
|
}
|
|
150983
151125
|
await registerGoalWorkerTools();
|
|
150984
151126
|
await registerLazy(ToolNames.TOOL_SEARCH, async () => {
|
|
150985
|
-
const { ToolSearchTool } = await import("./tool-search-
|
|
151127
|
+
const { ToolSearchTool } = await import("./tool-search-UJV3A24H.js");
|
|
150986
151128
|
return new ToolSearchTool(this);
|
|
150987
151129
|
});
|
|
150988
151130
|
await registerLazy(ToolNames.READ_MCP_RESOURCE, async () => {
|
|
150989
|
-
const { ReadMcpResourceTool } = await import("./read-mcp-resource-
|
|
151131
|
+
const { ReadMcpResourceTool } = await import("./read-mcp-resource-PZ4ZF6YL.js");
|
|
150990
151132
|
return new ReadMcpResourceTool(this);
|
|
150991
151133
|
});
|
|
150992
151134
|
await registerLazy(ToolNames.AGENT, async () => {
|
|
150993
|
-
const { AgentTool: AgentTool2 } = await import("./agent-
|
|
151135
|
+
const { AgentTool: AgentTool2 } = await import("./agent-624T2BLO.js");
|
|
150994
151136
|
return new AgentTool2(this);
|
|
150995
151137
|
});
|
|
150996
151138
|
await registerLazy(ToolNames.LIST_AGENTS, async () => {
|
|
150997
|
-
const { ListAgentsTool } = await import("./list-agents-
|
|
151139
|
+
const { ListAgentsTool } = await import("./list-agents-Z4WABFDZ.js");
|
|
150998
151140
|
return new ListAgentsTool(this);
|
|
150999
151141
|
});
|
|
151000
151142
|
await registerLazy(ToolNames.TASK_STOP, async () => {
|
|
151001
|
-
const { TaskStopTool } = await import("./task-stop-
|
|
151143
|
+
const { TaskStopTool } = await import("./task-stop-FPCOIRYX.js");
|
|
151002
151144
|
return new TaskStopTool(this);
|
|
151003
151145
|
});
|
|
151004
151146
|
await registerLazy(ToolNames.SEND_MESSAGE, async () => {
|
|
151005
|
-
const { SendMessageTool } = await import("./send-message-
|
|
151147
|
+
const { SendMessageTool } = await import("./send-message-CAMSLG2L.js");
|
|
151006
151148
|
return new SendMessageTool(this);
|
|
151007
151149
|
});
|
|
151008
151150
|
await registerLazy(ToolNames.SKILL, async () => {
|
|
151009
|
-
const { SkillTool } = await import("./skill-
|
|
151151
|
+
const { SkillTool } = await import("./skill-6HBDYZRS.js");
|
|
151010
151152
|
return new SkillTool(this);
|
|
151011
151153
|
});
|
|
151012
151154
|
await registerLazy(ToolNames.LS, async () => {
|
|
151013
|
-
const { LSTool } = await import("./ls-
|
|
151155
|
+
const { LSTool } = await import("./ls-TVHDGIES.js");
|
|
151014
151156
|
return new LSTool(this);
|
|
151015
151157
|
});
|
|
151016
151158
|
await registerLazy(ToolNames.READ_FILE, async () => {
|
|
151017
|
-
const { ReadFileTool } = await import("./read-file-
|
|
151159
|
+
const { ReadFileTool } = await import("./read-file-3M6WXDXP.js");
|
|
151018
151160
|
return new ReadFileTool(this);
|
|
151019
151161
|
});
|
|
151020
151162
|
await registerLazy(ToolNames.ZOOM_IMAGE, async () => {
|
|
151021
|
-
const { ZoomImageTool } = await import("./zoom-image-
|
|
151163
|
+
const { ZoomImageTool } = await import("./zoom-image-E7D72GYV.js");
|
|
151022
151164
|
return new ZoomImageTool(this);
|
|
151023
151165
|
});
|
|
151024
151166
|
if (this.getUseRipgrep()) {
|
|
@@ -151033,7 +151175,7 @@ var Config = class _Config {
|
|
|
151033
151175
|
recordStartupEvent("config_initialize_ripgrep_probe_end");
|
|
151034
151176
|
if (useRipgrep) {
|
|
151035
151177
|
await registerLazy(ToolNames.GREP, async () => {
|
|
151036
|
-
const { RipGrepTool: RipGrepTool2 } = await import("./ripGrep-
|
|
151178
|
+
const { RipGrepTool: RipGrepTool2 } = await import("./ripGrep-PLPENT3E.js");
|
|
151037
151179
|
return new RipGrepTool2(this);
|
|
151038
151180
|
});
|
|
151039
151181
|
} else {
|
|
@@ -151046,7 +151188,7 @@ var Config = class _Config {
|
|
|
151046
151188
|
)
|
|
151047
151189
|
);
|
|
151048
151190
|
await registerLazy(ToolNames.GREP, async () => {
|
|
151049
|
-
const { GrepTool } = await import("./grep-
|
|
151191
|
+
const { GrepTool } = await import("./grep-6ZFC7RJ5.js");
|
|
151050
151192
|
return new GrepTool(this);
|
|
151051
151193
|
});
|
|
151052
151194
|
}
|
|
@@ -151054,77 +151196,77 @@ var Config = class _Config {
|
|
|
151054
151196
|
recordStartupEvent("config_initialize_ripgrep_probe_start");
|
|
151055
151197
|
recordStartupEvent("config_initialize_ripgrep_probe_end");
|
|
151056
151198
|
await registerLazy(ToolNames.GREP, async () => {
|
|
151057
|
-
const { GrepTool } = await import("./grep-
|
|
151199
|
+
const { GrepTool } = await import("./grep-6ZFC7RJ5.js");
|
|
151058
151200
|
return new GrepTool(this);
|
|
151059
151201
|
});
|
|
151060
151202
|
}
|
|
151061
151203
|
await registerLazy(ToolNames.GLOB, async () => {
|
|
151062
|
-
const { GlobTool } = await import("./glob-
|
|
151204
|
+
const { GlobTool } = await import("./glob-7KZG44BR.js");
|
|
151063
151205
|
return new GlobTool(this);
|
|
151064
151206
|
});
|
|
151065
151207
|
await registerLazy(ToolNames.EDIT, async () => {
|
|
151066
|
-
const { EditTool } = await import("./edit-
|
|
151208
|
+
const { EditTool } = await import("./edit-ITMZYFKA.js");
|
|
151067
151209
|
return new EditTool(this);
|
|
151068
151210
|
});
|
|
151069
151211
|
await registerLazy(ToolNames.NOTEBOOK_EDIT, async () => {
|
|
151070
|
-
const { NotebookEditTool } = await import("./notebook-edit-
|
|
151212
|
+
const { NotebookEditTool } = await import("./notebook-edit-474DPMRL.js");
|
|
151071
151213
|
return new NotebookEditTool(this);
|
|
151072
151214
|
});
|
|
151073
151215
|
await registerLazy(ToolNames.WRITE_FILE, async () => {
|
|
151074
|
-
const { WriteFileTool: WriteFileTool2 } = await import("./write-file-
|
|
151216
|
+
const { WriteFileTool: WriteFileTool2 } = await import("./write-file-CGS57TS4.js");
|
|
151075
151217
|
return new WriteFileTool2(this);
|
|
151076
151218
|
});
|
|
151077
151219
|
await registerLazy(ToolNames.SHELL, async () => {
|
|
151078
|
-
const { ShellTool: ShellTool2 } = await import("./shell-
|
|
151220
|
+
const { ShellTool: ShellTool2 } = await import("./shell-23OMNMW6.js");
|
|
151079
151221
|
return new ShellTool2(this);
|
|
151080
151222
|
});
|
|
151081
151223
|
await registerLazy(ToolNames.TODO_WRITE, async () => {
|
|
151082
|
-
const { TodoWriteTool } = await import("./todoWrite-
|
|
151224
|
+
const { TodoWriteTool } = await import("./todoWrite-JGV6VLOX.js");
|
|
151083
151225
|
return new TodoWriteTool(this);
|
|
151084
151226
|
});
|
|
151085
151227
|
const supportsUserInteraction = resolveInteractionMode(this) !== "headless";
|
|
151086
151228
|
if (supportsUserInteraction) {
|
|
151087
151229
|
await registerLazy(ToolNames.ASK_USER_QUESTION, async () => {
|
|
151088
|
-
const { AskUserQuestionTool } = await import("./askUserQuestion-
|
|
151230
|
+
const { AskUserQuestionTool } = await import("./askUserQuestion-ONW74PKJ.js");
|
|
151089
151231
|
return new AskUserQuestionTool(this);
|
|
151090
151232
|
});
|
|
151091
151233
|
}
|
|
151092
151234
|
if (!this.sdkMode && (supportsUserInteraction || options2?.forSubAgent)) {
|
|
151093
151235
|
await registerLazy(ToolNames.EXIT_PLAN_MODE, async () => {
|
|
151094
|
-
const { ExitPlanModeTool: ExitPlanModeTool2 } = await import("./exitPlanMode-
|
|
151236
|
+
const { ExitPlanModeTool: ExitPlanModeTool2 } = await import("./exitPlanMode-ZLI5F7KR.js");
|
|
151095
151237
|
return new ExitPlanModeTool2(this);
|
|
151096
151238
|
});
|
|
151097
151239
|
}
|
|
151098
151240
|
if (!this.sdkMode && supportsUserInteraction) {
|
|
151099
151241
|
await registerLazy(ToolNames.ENTER_PLAN_MODE, async () => {
|
|
151100
|
-
const { EnterPlanModeTool } = await import("./enterPlanMode-
|
|
151242
|
+
const { EnterPlanModeTool } = await import("./enterPlanMode-YV52NNJT.js");
|
|
151101
151243
|
return new EnterPlanModeTool(this);
|
|
151102
151244
|
});
|
|
151103
151245
|
}
|
|
151104
151246
|
await registerLazy(ToolNames.ENTER_WORKTREE, async () => {
|
|
151105
|
-
const { EnterWorktreeTool } = await import("./enter-worktree-
|
|
151247
|
+
const { EnterWorktreeTool } = await import("./enter-worktree-S4PL5UV6.js");
|
|
151106
151248
|
return new EnterWorktreeTool(this);
|
|
151107
151249
|
});
|
|
151108
151250
|
await registerLazy(ToolNames.EXIT_WORKTREE, async () => {
|
|
151109
|
-
const { ExitWorktreeTool } = await import("./exit-worktree-
|
|
151251
|
+
const { ExitWorktreeTool } = await import("./exit-worktree-XRM6LH5F.js");
|
|
151110
151252
|
return new ExitWorktreeTool(this);
|
|
151111
151253
|
});
|
|
151112
151254
|
await registerLazy(ToolNames.WEB_FETCH, async () => {
|
|
151113
|
-
const { WebFetchTool } = await import("./web-fetch-
|
|
151255
|
+
const { WebFetchTool } = await import("./web-fetch-ILB4GAVR.js");
|
|
151114
151256
|
return new WebFetchTool(this);
|
|
151115
151257
|
});
|
|
151116
151258
|
if (resolveInteractionMode(this) === "interactive" && !this.sdkMode && !this.getScreenReader() && !options2?.forSubAgent) {
|
|
151117
151259
|
await registerLazy(ToolNames.DISPLAY_IMAGE, async () => {
|
|
151118
|
-
const { DisplayImageTool } = await import("./display-image-
|
|
151260
|
+
const { DisplayImageTool } = await import("./display-image-NQRSIBXM.js");
|
|
151119
151261
|
return new DisplayImageTool(this);
|
|
151120
151262
|
});
|
|
151121
151263
|
}
|
|
151122
151264
|
if (this.webSearchSettings?.enabled) {
|
|
151123
|
-
const { evaluateWebSearchGate } = await import("./web-search-
|
|
151265
|
+
const { evaluateWebSearchGate } = await import("./web-search-HKRPGPZZ.js");
|
|
151124
151266
|
const gate = evaluateWebSearchGate(this);
|
|
151125
151267
|
if (gate.ok) {
|
|
151126
151268
|
await registerLazy(ToolNames.WEB_SEARCH, async () => {
|
|
151127
|
-
const { WebSearchTool } = await import("./web-search-
|
|
151269
|
+
const { WebSearchTool } = await import("./web-search-HKRPGPZZ.js");
|
|
151128
151270
|
return new WebSearchTool(this);
|
|
151129
151271
|
});
|
|
151130
151272
|
} else if (!this.webSearchNoticeEmitted && !options2?.forSubAgent) {
|
|
@@ -151135,83 +151277,83 @@ var Config = class _Config {
|
|
|
151135
151277
|
await this.registerImageGenerationTool(registry);
|
|
151136
151278
|
if (this.isArtifactEnabled()) {
|
|
151137
151279
|
await registerLazy(ToolNames.ARTIFACT, async () => {
|
|
151138
|
-
const { ArtifactTool } = await import("./artifact-tool-
|
|
151280
|
+
const { ArtifactTool } = await import("./artifact-tool-N652YE4L.js");
|
|
151139
151281
|
return new ArtifactTool(this);
|
|
151140
151282
|
});
|
|
151141
151283
|
}
|
|
151142
151284
|
if (this.isRecordArtifactEnabled()) {
|
|
151143
151285
|
await registerLazy(ToolNames.RECORD_ARTIFACT, async () => {
|
|
151144
|
-
const { RecordArtifactTool } = await import("./record-artifact-
|
|
151286
|
+
const { RecordArtifactTool } = await import("./record-artifact-P4HFMS7X.js");
|
|
151145
151287
|
return new RecordArtifactTool();
|
|
151146
151288
|
});
|
|
151147
151289
|
}
|
|
151148
151290
|
if (this.isLspEnabled() && this.getLspClient()) {
|
|
151149
151291
|
await registerLazy(ToolNames.LSP, async () => {
|
|
151150
|
-
const { LspTool } = await import("./lsp-
|
|
151292
|
+
const { LspTool } = await import("./lsp-CVN6OQPI.js");
|
|
151151
151293
|
return new LspTool(this);
|
|
151152
151294
|
});
|
|
151153
151295
|
}
|
|
151154
151296
|
await registerStructuredOutputIfRequested();
|
|
151155
151297
|
if (this.isCronEnabled()) {
|
|
151156
151298
|
await registerLazy(ToolNames.CRON_CREATE, async () => {
|
|
151157
|
-
const { CronCreateTool } = await import("./cron-create-
|
|
151299
|
+
const { CronCreateTool } = await import("./cron-create-VONA5JYY.js");
|
|
151158
151300
|
return new CronCreateTool(this);
|
|
151159
151301
|
});
|
|
151160
151302
|
await registerLazy(ToolNames.CRON_LIST, async () => {
|
|
151161
|
-
const { CronListTool } = await import("./cron-list-
|
|
151303
|
+
const { CronListTool } = await import("./cron-list-KE4F2CIR.js");
|
|
151162
151304
|
return new CronListTool(this);
|
|
151163
151305
|
});
|
|
151164
151306
|
await registerLazy(ToolNames.CRON_DELETE, async () => {
|
|
151165
|
-
const { CronDeleteTool } = await import("./cron-delete-
|
|
151307
|
+
const { CronDeleteTool } = await import("./cron-delete-5JXSP2MI.js");
|
|
151166
151308
|
return new CronDeleteTool(this);
|
|
151167
151309
|
});
|
|
151168
151310
|
await registerLazy(ToolNames.LOOP_WAKEUP, async () => {
|
|
151169
|
-
const { LoopWakeupTool } = await import("./loop-wakeup-
|
|
151311
|
+
const { LoopWakeupTool } = await import("./loop-wakeup-UZ5RL5Y2.js");
|
|
151170
151312
|
return new LoopWakeupTool(this);
|
|
151171
151313
|
});
|
|
151172
151314
|
}
|
|
151173
151315
|
await registerLazy(ToolNames.CREATE_SUB_SESSION, async () => {
|
|
151174
|
-
const { CreateSubSessionTool } = await import("./create-sub-session-
|
|
151316
|
+
const { CreateSubSessionTool } = await import("./create-sub-session-QIDZUOPU.js");
|
|
151175
151317
|
return new CreateSubSessionTool(this);
|
|
151176
151318
|
});
|
|
151177
151319
|
if (this.isAgentTeamEnabled()) {
|
|
151178
151320
|
await registerLazy(ToolNames.TEAM_CREATE, async () => {
|
|
151179
|
-
const { TeamCreateTool } = await import("./team-create-
|
|
151321
|
+
const { TeamCreateTool } = await import("./team-create-CFFKU7KL.js");
|
|
151180
151322
|
return new TeamCreateTool(this);
|
|
151181
151323
|
});
|
|
151182
151324
|
await registerLazy(ToolNames.TEAM_DELETE, async () => {
|
|
151183
|
-
const { TeamDeleteTool } = await import("./team-delete-
|
|
151325
|
+
const { TeamDeleteTool } = await import("./team-delete-MMQB4OSC.js");
|
|
151184
151326
|
return new TeamDeleteTool(this);
|
|
151185
151327
|
});
|
|
151186
151328
|
await registerLazy(ToolNames.TEAM_PLAN_APPROVAL, async () => {
|
|
151187
|
-
const { TeamPlanApprovalTool } = await import("./team-plan-approval-
|
|
151329
|
+
const { TeamPlanApprovalTool } = await import("./team-plan-approval-6EFOKR6A.js");
|
|
151188
151330
|
return new TeamPlanApprovalTool(this);
|
|
151189
151331
|
});
|
|
151190
151332
|
await registerLazy(ToolNames.TASK_CREATE, async () => {
|
|
151191
|
-
const { TaskCreateTool } = await import("./task-create-
|
|
151333
|
+
const { TaskCreateTool } = await import("./task-create-5NWCQSJF.js");
|
|
151192
151334
|
return new TaskCreateTool(this);
|
|
151193
151335
|
});
|
|
151194
151336
|
await registerLazy(ToolNames.TASK_UPDATE, async () => {
|
|
151195
|
-
const { TaskUpdateTool } = await import("./task-update-
|
|
151337
|
+
const { TaskUpdateTool } = await import("./task-update-5HN577LS.js");
|
|
151196
151338
|
return new TaskUpdateTool(this);
|
|
151197
151339
|
});
|
|
151198
151340
|
await registerLazy(ToolNames.TASK_LIST, async () => {
|
|
151199
|
-
const { TaskListTool } = await import("./task-list-
|
|
151341
|
+
const { TaskListTool } = await import("./task-list-53265TRZ.js");
|
|
151200
151342
|
return new TaskListTool(this);
|
|
151201
151343
|
});
|
|
151202
151344
|
}
|
|
151203
151345
|
if (this.isWorkflowsEnabled()) {
|
|
151204
151346
|
await registerLazy(ToolNames.WORKFLOW, async () => {
|
|
151205
|
-
const { WorkflowTool } = await import("./workflow-
|
|
151347
|
+
const { WorkflowTool } = await import("./workflow-FXIPRQQA.js");
|
|
151206
151348
|
return new WorkflowTool(this);
|
|
151207
151349
|
});
|
|
151208
151350
|
}
|
|
151209
151351
|
if (this.isComputerUseEnabled()) {
|
|
151210
|
-
const { registerComputerUseTools } = await import("./computer-use-
|
|
151352
|
+
const { registerComputerUseTools } = await import("./computer-use-ESQYJ3JY.js");
|
|
151211
151353
|
await registerComputerUseTools(registerLazy, this);
|
|
151212
151354
|
}
|
|
151213
151355
|
await registerLazy(ToolNames.MONITOR, async () => {
|
|
151214
|
-
const { MonitorTool } = await import("./monitor-
|
|
151356
|
+
const { MonitorTool } = await import("./monitor-DAKD6OU4.js");
|
|
151215
151357
|
return new MonitorTool(this);
|
|
151216
151358
|
});
|
|
151217
151359
|
if (this.pendingMcpBudgetCallback) {
|
|
@@ -151635,8 +151777,6 @@ export {
|
|
|
151635
151777
|
DEFAULT_STOP_HOOK_BLOCK_CAP,
|
|
151636
151778
|
formatStopHookBlockingCapWarning,
|
|
151637
151779
|
buildContextUsage,
|
|
151638
|
-
wrapUserPromptSubmitContext,
|
|
151639
|
-
stripTrailingUserPromptSubmitContextPart,
|
|
151640
151780
|
isGitRepository,
|
|
151641
151781
|
findGitRoot,
|
|
151642
151782
|
getGitBranch,
|
|
@@ -151691,12 +151831,15 @@ export {
|
|
|
151691
151831
|
SESSION_TRANSCRIPT_MAX_LIMIT,
|
|
151692
151832
|
SESSION_TRANSCRIPT_MAX_INDEX_BYTES,
|
|
151693
151833
|
SESSION_TRANSCRIPT_MAX_PAGE_BYTES,
|
|
151834
|
+
SESSION_TRANSCRIPT_MAX_EXPANDED_PAGE_BYTES,
|
|
151694
151835
|
InvalidSessionTranscriptCursorError,
|
|
151695
151836
|
SessionTranscriptSnapshotUnavailableError,
|
|
151696
151837
|
SessionTranscriptTooLargeError,
|
|
151697
151838
|
SessionTranscriptPageTooLargeError,
|
|
151698
151839
|
SessionTranscriptCursorCodec,
|
|
151699
151840
|
encodeSessionTranscriptCursor,
|
|
151841
|
+
isReplayTurnStartType,
|
|
151842
|
+
findBoundaryAtOrBefore,
|
|
151700
151843
|
SessionTranscriptReader,
|
|
151701
151844
|
SessionWriterError,
|
|
151702
151845
|
SESSION_WRITER_RPC_CODES,
|
|
@@ -151714,7 +151857,10 @@ export {
|
|
|
151714
151857
|
acquireSleepInhibitor,
|
|
151715
151858
|
approxBase64Bytes,
|
|
151716
151859
|
clampInlineMediaPart,
|
|
151860
|
+
GLOBAL_DUPLICATE_THRESHOLD,
|
|
151717
151861
|
DEFAULT_MAX_TOOL_CALLS_PER_TURN,
|
|
151862
|
+
getToolCallRepeatKey,
|
|
151863
|
+
shouldHaltOnTurnToolCallCap,
|
|
151718
151864
|
CommitAttributionService,
|
|
151719
151865
|
generateToolUseId,
|
|
151720
151866
|
firePreToolUseHook,
|
|
@@ -151781,6 +151927,7 @@ export {
|
|
|
151781
151927
|
sessionIdContext,
|
|
151782
151928
|
getShellContextEnvVars,
|
|
151783
151929
|
getShellPagerEnv,
|
|
151930
|
+
isSignalTermination,
|
|
151784
151931
|
ShellExecutionService,
|
|
151785
151932
|
escape,
|
|
151786
151933
|
globStream,
|
|
@@ -151805,7 +151952,6 @@ export {
|
|
|
151805
151952
|
IdeClient,
|
|
151806
151953
|
bridgeToolResultImages,
|
|
151807
151954
|
evaluateToolInvocationGuard,
|
|
151808
|
-
canonicalToolName2 as canonicalToolName,
|
|
151809
151955
|
convertToFunctionResponse,
|
|
151810
151956
|
convertToFunctionErrorResponse,
|
|
151811
151957
|
isToolCallConcurrencySafe,
|
|
@@ -151840,6 +151986,9 @@ export {
|
|
|
151840
151986
|
MAX_RECENT_ACTIVITIES,
|
|
151841
151987
|
buildBackgroundEntryLabel,
|
|
151842
151988
|
runForkedAgent,
|
|
151989
|
+
didWriteProjectContextFile,
|
|
151990
|
+
refreshMemoryInstruction,
|
|
151991
|
+
refreshMemoryAfterManagedWrite,
|
|
151843
151992
|
runManagedAutoMemoryDream,
|
|
151844
151993
|
MessageDisplayDispatcher,
|
|
151845
151994
|
collectMemoryDiagnostics,
|
|
@@ -151862,6 +152011,8 @@ export {
|
|
|
151862
152011
|
SubagentManager,
|
|
151863
152012
|
MAX_CONCURRENT_MONITORS,
|
|
151864
152013
|
getMonitorOutputPath,
|
|
152014
|
+
isActiveWorkflowStatus,
|
|
152015
|
+
isTerminalWorkflowStatus,
|
|
151865
152016
|
EXTENSIONS_CONFIG_FILENAME,
|
|
151866
152017
|
So,
|
|
151867
152018
|
redactUrlCredentials,
|
|
@@ -151930,6 +152081,7 @@ export {
|
|
|
151930
152081
|
TURN_INTERRUPTION_HISTORY_TAIL_COUNT,
|
|
151931
152082
|
buildSessionRecoveryPlan,
|
|
151932
152083
|
buildSessionRecoveryPlanFromApiHistory,
|
|
152084
|
+
runWithTimeout,
|
|
151933
152085
|
McpTransportPool,
|
|
151934
152086
|
WorkspaceMcpBudget,
|
|
151935
152087
|
ClientMcpRegistrar,
|
|
@@ -151969,8 +152121,6 @@ export {
|
|
|
151969
152121
|
buildManagedRememberPrompt,
|
|
151970
152122
|
buildBareRememberPrompt,
|
|
151971
152123
|
runManagedRememberByAgent,
|
|
151972
|
-
refreshMemoryInstruction,
|
|
151973
|
-
refreshMemoryAfterManagedWrite,
|
|
151974
152124
|
parseLearnVideoInput,
|
|
151975
152125
|
buildLearnSkillPrompt,
|
|
151976
152126
|
buildLearnVideoSkillRequest,
|
|
@@ -152019,7 +152169,8 @@ export {
|
|
|
152019
152169
|
subagentGenerator,
|
|
152020
152170
|
BTW_MAX_INPUT_LENGTH,
|
|
152021
152171
|
buildBtwPrompt,
|
|
152022
|
-
buildBtwCacheSafeParams
|
|
152172
|
+
buildBtwCacheSafeParams,
|
|
152173
|
+
isGoalCheckpointBookkeepingRecord
|
|
152023
152174
|
};
|
|
152024
152175
|
/**
|
|
152025
152176
|
* @license
|
|
@@ -152043,12 +152194,12 @@ export {
|
|
|
152043
152194
|
*/
|
|
152044
152195
|
/**
|
|
152045
152196
|
* @license
|
|
152046
|
-
* Copyright
|
|
152197
|
+
* Copyright 2026 Qwen
|
|
152047
152198
|
* SPDX-License-Identifier: Apache-2.0
|
|
152048
152199
|
*/
|
|
152049
152200
|
/**
|
|
152050
152201
|
* @license
|
|
152051
|
-
* Copyright
|
|
152202
|
+
* Copyright 2025 Qwen Code
|
|
152052
152203
|
* SPDX-License-Identifier: Apache-2.0
|
|
152053
152204
|
*/
|
|
152054
152205
|
/**
|