@qwen-code/qwen-code 0.21.3 → 0.21.4-nightly.20260804.d6f55a1c9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/qc-helper/docs/configuration/model-providers.md +8 -7
- package/bundled/qc-helper/docs/configuration/settings.md +14 -1
- package/bundled/qc-helper/docs/features/channels/github.md +12 -8
- package/bundled/qc-helper/docs/features/code-review.md +16 -1
- package/bundled/qc-helper/docs/features/commands.md +46 -40
- package/bundled/qc-helper/docs/features/mcp.md +11 -3
- package/bundled/qc-helper/docs/qwen-serve.md +27 -26
- package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +50 -19
- package/bundled/review/SKILL.md +99 -23
- package/chunks/{MaxSizedBox-OJR636GP.js → MaxSizedBox-6J7WTW2Q.js} +16 -15
- package/chunks/{StandaloneSessionPicker-AMMBF5UY.js → StandaloneSessionPicker-J3HNBNWF.js} +30 -29
- package/chunks/{acpAgent-M57LVIQA.js → acpAgent-SGIEWC4W.js} +681 -291
- package/chunks/{agent-PE37ARLM.js → agent-W6IG55Q7.js} +16 -15
- package/chunks/{agent-headless-45ASME4R.js → agent-headless-EAPKUL6K.js} +16 -15
- package/chunks/{anthropicContentGenerator-WCBYB6JG.js → anthropicContentGenerator-3CAHEZBM.js} +4 -2
- package/chunks/{artifact-tool-TBOYEKTY.js → artifact-tool-RROCCJDA.js} +1 -1
- package/chunks/{askUserQuestion-23Y5WZFJ.js → askUserQuestion-2EPPBPUZ.js} +1 -1
- package/chunks/{bridge-K3ZRPO4D.js → bridge-SNQAVLI3.js} +17 -16
- package/chunks/{ca-4OJN75WT.js → ca-NYKNH222.js} +4 -0
- package/chunks/{channel-management-service-IXJ2MZTS.js → channel-management-service-UHX56NBO.js} +1 -1
- package/chunks/{channel-settings-store-PEAR3IME.js → channel-settings-store-TR7UMQVQ.js} +22 -21
- package/chunks/{chunk-L7FTDKCD.js → chunk-23DFTW2G.js} +21 -3
- package/chunks/{chunk-PWCQRLM5.js → chunk-2AGOQ7QO.js} +1 -1
- package/chunks/{chunk-HUIQ4FYC.js → chunk-2UYGQRYZ.js} +3 -3
- package/chunks/{chunk-4K3RV3OA.js → chunk-36Q4BOUL.js} +243 -108
- package/chunks/{chunk-2MI7ZTRT.js → chunk-3KTHFE53.js} +5 -5
- package/chunks/{chunk-QDWLUXKP.js → chunk-3X3CRYEU.js} +1 -1
- package/chunks/{chunk-YXEVDA66.js → chunk-4LLUH3A7.js} +19 -18
- package/chunks/{chunk-QPSYIV2O.js → chunk-4RNMAX6B.js} +2492 -690
- package/chunks/{chunk-O2ZYHG33.js → chunk-5L6CQ4ZU.js} +131 -67
- package/chunks/{chunk-HEBW74ZW.js → chunk-5WFVHBQR.js} +3 -3
- package/chunks/{chunk-LZV2BZPL.js → chunk-6BBIRJ6Z.js} +2 -2
- package/chunks/{chunk-TZTBZ25J.js → chunk-6WBWIPBF.js} +2 -2
- package/chunks/{chunk-QWDVZH24.js → chunk-7BUWEQD3.js} +3 -3
- package/chunks/{chunk-EGYJRIDF.js → chunk-7DKCE4VO.js} +2 -2
- package/chunks/{chunk-UQDFEU47.js → chunk-7E5BCHGR.js} +1165 -385
- package/chunks/{chunk-X6QNZOTC.js → chunk-7MFQLOHZ.js} +1 -1
- package/chunks/{chunk-MCXMWLFT.js → chunk-7VZZVBW7.js} +5 -5
- package/chunks/{chunk-FF75UUB2.js → chunk-7WE7B63C.js} +1 -1
- package/chunks/{chunk-M5LIY7Y6.js → chunk-AUM6IYIZ.js} +1 -1
- package/chunks/{chunk-K2J5JZ6B.js → chunk-B452JFK7.js} +1 -1
- package/chunks/{chunk-6NE5NTHJ.js → chunk-BDUPVCHA.js} +1 -1
- package/chunks/{chunk-SKSF3LGQ.js → chunk-BH4HRGTW.js} +4 -4
- package/chunks/{chunk-3XF4WT3B.js → chunk-BKLXFYJJ.js} +1 -1
- package/chunks/{chunk-RL6J3BPE.js → chunk-BQUXJJ72.js} +3 -3
- package/chunks/{chunk-H6FIBBXK.js → chunk-C4EK5K64.js} +13 -13
- package/chunks/{chunk-VUNRNRN6.js → chunk-CE424L46.js} +5 -5
- package/chunks/{chunk-DSGJLHM3.js → chunk-CJGLCNDE.js} +3 -3
- package/chunks/{chunk-FXVHVCNA.js → chunk-CTRZ7IDH.js} +1 -1
- package/chunks/{chunk-CFDR3GNL.js → chunk-D7D7RXIJ.js} +11 -0
- package/chunks/{chunk-ZGSUFIL5.js → chunk-DMI5SX2V.js} +1 -1
- package/chunks/{chunk-X6WUYMOV.js → chunk-DTAPI453.js} +2 -2
- package/chunks/{chunk-NW57GHNL.js → chunk-EF2FDVAL.js} +5 -5
- package/chunks/{chunk-BSKUTHLO.js → chunk-EVSV25NF.js} +16 -3
- package/chunks/{chunk-3MWNROHB.js → chunk-FQL6PVUI.js} +3 -3
- package/chunks/{chunk-IF6K42YJ.js → chunk-FSHOUNV4.js} +1 -1
- package/chunks/chunk-HGCQ5SE7.js +136 -0
- package/chunks/{chunk-GMSBXEH4.js → chunk-HTCXG5RY.js} +6 -6
- package/chunks/{chunk-FG63DZQA.js → chunk-I4PRUCND.js} +10 -10
- package/chunks/{chunk-YWMDTMAU.js → chunk-J2QPGVAE.js} +2 -2
- package/chunks/{chunk-RCXCGZG6.js → chunk-KCHQQBHO.js} +4 -4
- package/chunks/{chunk-LGT3YMLN.js → chunk-LEZFUYPM.js} +1 -1
- package/chunks/{chunk-G7XXKQYS.js → chunk-LKRMNRSN.js} +27 -1
- package/chunks/{chunk-WY2ENRDN.js → chunk-LZPIUB47.js} +1 -1
- package/chunks/{chunk-HFVW54NL.js → chunk-MBEMTXQT.js} +9 -2
- package/chunks/{chunk-RPYYTL7E.js → chunk-MGSSJT27.js} +2 -2
- package/chunks/{chunk-H35Q5CEG.js → chunk-MMWH7ERH.js} +6 -6
- package/chunks/{chunk-MUEJ4R3E.js → chunk-MP2XAFAD.js} +3 -3
- package/chunks/{chunk-R7XNRHYD.js → chunk-N64L3CUV.js} +1 -1
- package/chunks/{chunk-EIMKVOSF.js → chunk-NJ4ANA44.js} +1 -1
- package/chunks/{chunk-ZJES4C3I.js → chunk-O6GB7LVR.js} +2 -2
- package/chunks/{chunk-QWW6I2UO.js → chunk-PFQWATDS.js} +410 -39
- package/chunks/{chunk-XUMAD5IT.js → chunk-PMMWMPWV.js} +1 -1
- package/chunks/{chunk-H6ZYP74A.js → chunk-PUQDGXJV.js} +1 -1
- package/chunks/{chunk-XMJO6C44.js → chunk-PYXZLKUJ.js} +3 -3
- package/chunks/{chunk-KXWERR6P.js → chunk-QIS6FQFI.js} +10 -10
- package/chunks/{chunk-22YFMJBW.js → chunk-QK6BFCAL.js} +59 -7
- package/chunks/{chunk-HIXVWF7I.js → chunk-R2JZCL4S.js} +3 -3
- package/chunks/{chunk-N42C2FU3.js → chunk-RJ2KM6NF.js} +1 -1
- package/chunks/{chunk-2LZCLQIS.js → chunk-S5VUT4K2.js} +5 -5
- package/chunks/{chunk-4AGGSHCH.js → chunk-SVR6JPEL.js} +197 -53
- package/chunks/{chunk-SQ3YD5MI.js → chunk-T4LUW2CP.js} +4 -3
- package/chunks/{chunk-BKGA75MU.js → chunk-T7AALAF5.js} +1 -1
- package/chunks/{chunk-YU6TBRTA.js → chunk-URJHXOSO.js} +2 -2
- package/chunks/{chunk-MTR4JWQJ.js → chunk-UZNJUCOI.js} +4 -4
- package/chunks/{chunk-D2GPKXCQ.js → chunk-VQHIIPVE.js} +4 -4
- package/chunks/{chunk-IWGTGH4G.js → chunk-W2W6PMZX.js} +2 -2
- package/chunks/{chunk-SRY26X4H.js → chunk-WVAESIM6.js} +12 -3
- package/chunks/{chunk-5VYFXHY2.js → chunk-XKX3PNZR.js} +3 -3
- package/chunks/{chunk-BKXTHMOZ.js → chunk-XLD2R34T.js} +1 -1
- package/chunks/{chunk-5JPVOYWA.js → chunk-YT2BQ4JH.js} +5 -5
- package/chunks/{chunk-YPUHMQXV.js → chunk-Z5ZLRJFS.js} +1 -1
- package/chunks/{chunk-VA5NLVPT.js → chunk-Z7JILXGX.js} +1 -1
- package/chunks/{chunk-RR224BUP.js → chunk-ZLJQIGCH.js} +45 -1
- package/chunks/{chunk-TXABHVZD.js → chunk-ZNCRSKRP.js} +1 -1
- package/chunks/{chunk-UEJESCS7.js → chunk-ZPPP6VCL.js} +1 -1
- package/chunks/{chunk-Q3G5L5KF.js → chunk-ZQPHKE4K.js} +1 -1
- package/chunks/{computer-use-UJMK6JQU.js → computer-use-NFBEZ73C.js} +16 -15
- package/chunks/{config-utils-7COTJMWK.js → config-utils-E3ZQTHGM.js} +2 -2
- package/chunks/{contextCommand-4YABGF4S.js → contextCommand-HJN4W5PC.js} +18 -17
- package/chunks/{core-runtime-7M4VM3DA.js → core-runtime-Z4IALQ37.js} +16 -15
- package/chunks/{create-sub-session-J32WC64U.js → create-sub-session-6EWLAZD5.js} +1 -1
- package/chunks/{create-sub-session-HOFDW4N7.js → create-sub-session-MJKTT6R4.js} +28 -21
- package/chunks/{cron-create-HMFSHIAR.js → cron-create-CCRIULJE.js} +1 -1
- package/chunks/{cron-delete-ZJFHOX57.js → cron-delete-FCFW6BGP.js} +1 -1
- package/chunks/{cron-list-ZEX2NBMN.js → cron-list-QDBVCHRF.js} +1 -1
- package/chunks/{daemon-status-provider-W2U5Q3J5.js → daemon-status-provider-GR32VNM6.js} +21 -20
- package/chunks/{daemon-trust-policy-IFICWPXP.js → daemon-trust-policy-O4DGWLR5.js} +21 -20
- package/chunks/{daemon-trust-policy-monitor-GX7EO6FW.js → daemon-trust-policy-monitor-5RHH3YSK.js} +21 -20
- package/chunks/{de-A6TI4LBB.js → de-VL76CPLV.js} +4 -0
- package/chunks/{deferred-core-runtime-U36OOOKE.js → deferred-core-runtime-A5CKPGQZ.js} +16 -15
- package/chunks/{display-image-VS3TXYQH.js → display-image-GUJA352B.js} +2 -2
- package/chunks/{dist-NEBRI7WO.js → dist-C5U4LJKW.js} +95 -0
- package/chunks/{dist-4KAX7CCL.js → dist-IKGVITP3.js} +401 -24
- package/chunks/{earlyInputCapture-5ZWDH3SB.js → earlyInputCapture-ZB4EHBSD.js} +16 -15
- package/chunks/{edit-J7SW6UP6.js → edit-QSTJ353U.js} +17 -16
- package/chunks/{en-L4UQDLWW.js → en-IRJ2WN5T.js} +4 -0
- package/chunks/{enter-worktree-NRLOHRB6.js → enter-worktree-R73VWVFF.js} +16 -15
- package/chunks/{enterPlanMode-GDSTEFSM.js → enterPlanMode-OWFAGX5J.js} +16 -15
- package/chunks/{environment-KHYEKG5W.js → environment-57MAPDBT.js} +18 -17
- package/chunks/{errors-VNLAJV3O.js → errors-5BKZ3KMI.js} +18 -17
- package/chunks/{exit-worktree-ARVID7DF.js → exit-worktree-6O2324LA.js} +16 -15
- package/chunks/{exitPlanMode-4ZFY7KUH.js → exitPlanMode-GCRUFTNX.js} +16 -15
- package/chunks/{fast-path-KA65VREJ.js → fast-path-VN3BV4WN.js} +11 -2
- package/chunks/{fr-QF7RI5ZE.js → fr-GK3HQYVB.js} +4 -0
- package/chunks/{gemini-5PMCNPF7.js → gemini-K43YNDW7.js} +50 -48
- package/chunks/{geminiContentGenerator-NFSYJ4HA.js → geminiContentGenerator-BTPPSMCF.js} +1 -1
- package/chunks/{glob-F3EAUDAX.js → glob-4MLY2HOS.js} +16 -15
- package/chunks/{goal-tools-SPQ5M6D3.js → goal-tools-3AZKX5WQ.js} +2 -18
- package/chunks/{grep-UJMPVZER.js → grep-XFBSAUJW.js} +16 -15
- package/chunks/{handleAutoUpdate-MG4FRZPN.js → handleAutoUpdate-HWVO6M65.js} +20 -19
- package/chunks/{i18n-EVHV4ZF3.js → i18n-MASWUB3I.js} +17 -16
- package/chunks/{image-gen-UC7XVHI7.js → image-gen-XLFJRDFA.js} +2 -2
- package/chunks/{initializer-O5B6HUBI.js → initializer-M6JYLRYA.js} +21 -20
- package/chunks/{installationInfo-2LIKCNVX.js → installationInfo-TEJOXP5W.js} +17 -16
- package/chunks/{ja-URQESVGW.js → ja-3FA46IKD.js} +4 -0
- package/chunks/{list-BPKIE3Z4.js → list-UABKY6YY.js} +24 -23
- package/chunks/{list-agents-TWEGRJWO.js → list-agents-GC4BRET7.js} +1 -1
- package/chunks/{loadedSettingsAdapter-NGLFF4V4.js → loadedSettingsAdapter-L7PIVGJX.js} +21 -20
- package/chunks/{loggingContentGenerator-7TFESRG5.js → loggingContentGenerator-W7QO23AD.js} +8 -8
- package/chunks/{loop-wakeup-6LLEOQYV.js → loop-wakeup-SQQSBMEY.js} +2 -2
- package/chunks/{ls-H5WX22VK.js → ls-63CC3NNX.js} +1 -1
- package/chunks/{lsp-G6FXYEIS.js → lsp-P6NVJVNT.js} +1 -1
- package/chunks/{managed-npm-update-CLZGGV7F.js → managed-npm-update-WQ2J42H7.js} +17 -16
- package/chunks/{mcp-X5OZOOXX.js → mcp-A652OREB.js} +21 -20
- package/chunks/{monitor-TGSVSAZZ.js → monitor-Y7YAHCA6.js} +16 -15
- package/chunks/{nonInteractiveCli-GUMJ5JLG.js → nonInteractiveCli-EKLP5WCN.js} +48 -46
- package/chunks/{notebook-edit-EZISE7IC.js → notebook-edit-MALKVMST.js} +17 -16
- package/chunks/{openaiContentGenerator-ZAKS5A6P.js → openaiContentGenerator-WM2TUU7E.js} +8 -8
- package/chunks/{pidfile-PCMBX4LR.js → pidfile-QBNVWD7M.js} +16 -15
- package/chunks/{processUtils-2CSVE5BW.js → processUtils-4L46PM2I.js} +2 -2
- package/chunks/{pt-EEEQXRUI.js → pt-3AOBKPIJ.js} +4 -0
- package/chunks/{qwenContentGenerator-S3H6PIC4.js → qwenContentGenerator-GG6SY4YP.js} +17 -17
- package/chunks/{qwenOAuth2-MNU425VE.js → qwenOAuth2-PE27GJRG.js} +1 -1
- package/chunks/{read-file-HXJXHBI6.js → read-file-IHXKC6D3.js} +6 -6
- package/chunks/{read-mcp-resource-DRZSI3HE.js → read-mcp-resource-RTSSEER5.js} +1 -1
- package/chunks/{record-artifact-IPIRWMFY.js → record-artifact-L3BAHQFN.js} +2 -2
- package/chunks/{resumeHistoryUtils-4QAMC2S6.js → resumeHistoryUtils-BWVAHKRZ.js} +19 -18
- package/chunks/{ripGrep-MCETPF2E.js → ripGrep-7ASLNF5O.js} +16 -15
- package/chunks/{ru-WGZDYQAB.js → ru-VJRAMC4W.js} +4 -0
- package/chunks/{run-qwen-serve-3NMODTXV.js → run-qwen-serve-JLFJHJSU.js} +82 -35
- package/chunks/{runtime-AQOV7DVP.js → runtime-DVQFRHKX.js} +24 -23
- package/chunks/{scheduler-DN7SZ6ZE.js → scheduler-WMFCKI7V.js} +16 -15
- package/chunks/{sdk-exporters-http-IKNWQJNV.js → sdk-exporters-http-IL2346MJ.js} +6 -2
- package/chunks/{sdk-impl-7CUUMQDB.js → sdk-impl-SYKGVWOZ.js} +2 -2
- package/chunks/{send-message-HGCVVDTZ.js → send-message-TL6FIMMN.js} +3 -3
- package/chunks/{serve-WZB45HVT.js → serve-NYWUO6YF.js} +22 -20
- package/chunks/{server-GOTZFEEZ.js → server-WHLRWZCG.js} +44 -42
- package/chunks/{session-23LOFLWN.js → session-EN34VEJM.js} +49 -47
- package/chunks/{settings-LI2ORVXC.js → settings-FZH5YZLH.js} +20 -19
- package/chunks/{shell-GLC6OP3C.js → shell-FQLEHJKT.js} +16 -15
- package/chunks/{skill-C7W6M4GO.js → skill-QAXTGG6F.js} +7 -7
- package/chunks/{skill-settings-W25NCK5I.js → skill-settings-SRUMUJIE.js} +20 -19
- package/chunks/{spawnChannel-OHJLEBLD.js → spawnChannel-VYQCFI7T.js} +16 -15
- package/chunks/{standalone-update-E4V5V7WT.js → standalone-update-LEPP5BOB.js} +18 -17
- package/chunks/{startInteractiveUI-FKILLW7Q.js → startInteractiveUI-IQIG2MKN.js} +77 -62
- package/chunks/{syntheticOutput-EYL7DWO7.js → syntheticOutput-BN7E626U.js} +2 -2
- package/chunks/{task-create-CSCEG4SM.js → task-create-2X4UP4F3.js} +4 -4
- package/chunks/{task-list-6CVQPORX.js → task-list-WOLJPZ64.js} +1 -1
- package/chunks/{task-stop-Y5ZTFVRX.js → task-stop-TNXRNAL2.js} +1 -1
- package/chunks/{task-update-C52LNFU5.js → task-update-VDUSN36E.js} +4 -4
- package/chunks/{team-create-HBIJ7NHT.js → team-create-7B5NKWA2.js} +16 -15
- package/chunks/{team-delete-CE7DC53R.js → team-delete-D2VMSDOT.js} +1 -1
- package/chunks/{team-plan-approval-IBJOKS4J.js → team-plan-approval-J6TURTZC.js} +16 -15
- package/chunks/{terminal-image-renderer-BOQJPVLB.js → terminal-image-renderer-KZMAF5E5.js} +17 -16
- package/chunks/{theme-manager-NSS7VLUD.js → theme-manager-NPISCKAX.js} +16 -15
- package/chunks/{todoWrite-YKAA57W2.js → todoWrite-MHWHO5UO.js} +3 -2
- package/chunks/{tool-search-DEAS54VG.js → tool-search-MFTNRTFA.js} +8 -8
- package/chunks/{total-session-admission-4LWTX3WD.js → total-session-admission-42THE4X2.js} +17 -16
- package/chunks/{trustedFolders-NF3J2TA7.js → trustedFolders-OT7IORFI.js} +17 -16
- package/chunks/{update-relaunch-WUHRH5V3.js → update-relaunch-2NJAMGWQ.js} +5 -5
- package/chunks/{updateCheck-7EG4BLBH.js → updateCheck-XSIBJXYA.js} +19 -18
- package/chunks/{useAutoAcceptIndicator-ZRV56GVP.js → useAutoAcceptIndicator-VH4DU3JR.js} +22 -21
- package/chunks/{validateNonInterActiveAuth-WC2FPE3I.js → validateNonInterActiveAuth-JD3VEJ2O.js} +45 -43
- package/chunks/{version-6SS7KCUP.js → version-F75ALUI3.js} +1 -1
- package/chunks/{web-fetch-Y5QQMPKA.js → web-fetch-Y6VEJMFN.js} +6 -6
- package/chunks/{web-search-QKKEU723.js → web-search-BTKVYWOR.js} +4 -4
- package/chunks/{workflow-PWIU6Q2M.js → workflow-LWFOBFN3.js} +17 -16
- package/chunks/{workspace-providers-status-B2DM6FNK.js → workspace-providers-status-VFEB7C5S.js} +23 -22
- package/chunks/{workspace-registration-store-7Y33TTHJ.js → workspace-registration-store-MB24E7PA.js} +1 -1
- package/chunks/{workspace-registry-TSNJKLPC.js → workspace-registry-FHFAPD74.js} +17 -16
- package/chunks/{workspace-service-4I2QHDX4.js → workspace-service-A6EFCR5H.js} +24 -23
- package/chunks/{workspace-skills-status-HVXNWVGR.js → workspace-skills-status-SDX2JT7P.js} +21 -20
- package/chunks/{workspace-trust-reconciler-RDBBGMWP.js → workspace-trust-reconciler-5NOCATAW.js} +22 -21
- package/chunks/{write-file-RQ4DG5RY.js → write-file-OHTP7KKV.js} +16 -15
- package/chunks/{zh-72XPUG5P.js → zh-ARWDLDLR.js} +4 -0
- package/chunks/{zh-TW-LTB4SRH3.js → zh-TW-Y4RGI3P7.js} +4 -0
- package/chunks/{zoom-image-O5YCB7WN.js → zoom-image-WLSVNK2C.js} +6 -6
- package/cli.js +12 -12
- package/locales/ca.js +8 -0
- package/locales/de.js +8 -0
- package/locales/en.js +8 -0
- package/locales/fr.js +8 -0
- package/locales/ja.js +8 -0
- package/locales/pt.js +8 -0
- package/locales/ru.js +8 -0
- package/locales/zh-TW.js +7 -0
- package/locales/zh.js +7 -0
- package/package.json +3 -3
- package/web-shell/assets/{arc-Bd7d781i.js → arc-Dpg66jw7.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-CpnOJqNE.js → architectureDiagram-3BPJPVTR-BJ4FIBxN.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-NxVTiWnk.js → blockDiagram-GPEHLZMM-VXmYdtYT.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-BWT75l82.js → c4Diagram-AAUBKEIU-BNLDb8FE.js} +1 -1
- package/web-shell/assets/channel-Bd9wOnaA.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-Dzz03hk6.js → chunk-2J33WTMH-DR5yHxr0.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-DRF-egfm.js → chunk-4BX2VUAB-Czkq8UZU.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-Co15vq5x.js → chunk-55IACEB6-DugUgM6s.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-DHSUk1J7.js → chunk-727SXJPM-Dw6quA1K.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-Br8u_E2R.js → chunk-AQP2D5EJ-BoVYOTTz.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-DXbPTnqF.js → chunk-FMBD7UC4--Amcse-j.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-BleQdi4d.js → chunk-ND2GUHAM-ajaEYAC8.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-CqgBf-95.js → chunk-QZHKN3VN-CUNDZ7im.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-XhCT8FE3.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-XhCT8FE3.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A-WS7b13Yg.js → cose-bilkent-S5V4N54A-BnfkD-m1.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-v_55ki8o.js → dagre-BM42HDAG-BuUdFk7Z.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-DaYAjbdK.js → diagram-2AECGRRQ-B2ZXxoab.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-D_Hy-L64.js → diagram-5GNKFQAL-BsgOICzM.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-dB06cZyD.js → diagram-KO2AKTUF-DTTjG6U-.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-DzSluD4F.js → diagram-LMA3HP47-temLf1x7.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-Cvb6CeXQ.js → diagram-OG6HWLK6-CRFjScs2.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-7eB2Hmov.js → erDiagram-TEJ5UH35-D4oaY-rQ.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-B08iGCw_.js → flowDiagram-I6XJVG4X-BqG8B49b.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-BgsrCHq-.js → ganttDiagram-6RSMTGT7-DffQBdd5.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-DQLurQ2i.js → gitGraphDiagram-PVQCEYII-CMDPfseF.js} +1 -1
- package/web-shell/assets/index-2F4RsNzd.js +1756 -0
- package/web-shell/assets/index-CaucmEO_.css +5 -0
- package/web-shell/assets/{index-B_1Z0Mgr.js → index-qTQR_smP.js} +1 -1
- package/web-shell/assets/{infoDiagram-5YYISTIA-DXZGO8qB.js → infoDiagram-5YYISTIA-Cn3T83MA.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-g7gbuH2w.js → ishikawaDiagram-YF4QCWOH-ijFs7e25.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-euefICGn.js → journeyDiagram-JHISSGLW-CINTv8VB.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-Dws8-mjG.js → kanban-definition-UN3LZRKU-CMGRZCxx.js} +1 -1
- package/web-shell/assets/{linear-C63F0tyh.js → linear-Co-2_37d.js} +1 -1
- package/web-shell/assets/{mermaid.core-fLrhp_4-.js → mermaid.core-DijbyaN5.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-qRkydfT-.js → mindmap-definition-RKZ34NQL-k_sDYDPZ.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-BZ0wQaKN.js → pieDiagram-4H26LBE5-CG-oz8V3.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-Fjq6GbSZ.js → quadrantDiagram-W4KKPZXB-Baq7HIG2.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-CqWvjLHU.js → requirementDiagram-4Y6WPE33-CDM3ZvBt.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-VcXX6PVZ.js → sankeyDiagram-5OEKKPKP-C2dJbWKN.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-BJSRtxFr.js → sequenceDiagram-3UESZ5HK-Cf1_h59p.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-Dt9zUwmZ.js → stateDiagram-AJRCARHV-CI5clUEc.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BDc8asKD.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-DQwlNRws.js → timeline-definition-PNZ67QCA-B2O8cAZX.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-DwxjUEtQ.js → vennDiagram-CIIHVFJN-BLsJ_h9s.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-D3QdMSpJ.js → wardley-L42UT6IY-BlPU4FTA.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-BddN8oK8.js → wardleyDiagram-YWT4CUSO-D_U-RdU4.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-BUNuBrRJ.js → xychartDiagram-2RQKCTM6-BynXGSTl.js} +1 -1
- package/web-shell/index.html +2 -2
- package/web-shell/assets/channel-A434sWK5.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-CwPuhldB.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CwPuhldB.js +0 -1
- package/web-shell/assets/index-Bi1dP2mU.css +0 -5
- package/web-shell/assets/index-DJ-z1Oba.js +0 -1756
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-CCxQt56w.js +0 -1
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
CronScheduler,
|
|
41
41
|
DEFAULT_RECURRING_MAX_AGE_DAYS,
|
|
42
42
|
normalizeRecurringMaxAge
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-Z7JILXGX.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-PMMWMPWV.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-7MFQLOHZ.js";
|
|
81
81
|
import {
|
|
82
82
|
promptIdContext,
|
|
83
83
|
todoWorkChainContext
|
|
@@ -139,7 +139,7 @@ import {
|
|
|
139
139
|
goalRequiresExactPermit,
|
|
140
140
|
goalTurnContext,
|
|
141
141
|
parseGoalStateRecordPayloadV2
|
|
142
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-MBEMTXQT.js";
|
|
143
143
|
import {
|
|
144
144
|
APPROVAL_MODES,
|
|
145
145
|
SUBAGENT_PLAN_LIFECYCLE_TOOLS,
|
|
@@ -163,7 +163,7 @@ import {
|
|
|
163
163
|
runWithRuntimeContentGenerator,
|
|
164
164
|
shouldUsePlanOnlyReminderInSubagentContext,
|
|
165
165
|
spawnBlockReason
|
|
166
|
-
} from "./chunk-
|
|
166
|
+
} from "./chunk-6WBWIPBF.js";
|
|
167
167
|
import {
|
|
168
168
|
getTeammateContext,
|
|
169
169
|
isTeammate,
|
|
@@ -202,7 +202,7 @@ import {
|
|
|
202
202
|
selectForkHistory,
|
|
203
203
|
stripSystemReminderBlocks,
|
|
204
204
|
validateForkToolList
|
|
205
|
-
} from "./chunk-
|
|
205
|
+
} from "./chunk-WVAESIM6.js";
|
|
206
206
|
import {
|
|
207
207
|
collectAvailableSkillEntries,
|
|
208
208
|
renderAvailableSkillsBlock
|
|
@@ -221,6 +221,9 @@ import {
|
|
|
221
221
|
isPathWithinRoot,
|
|
222
222
|
require_ignore
|
|
223
223
|
} from "./chunk-432XCUHF.js";
|
|
224
|
+
import {
|
|
225
|
+
DashScopeOpenAICompatibleProvider
|
|
226
|
+
} from "./chunk-4LLUH3A7.js";
|
|
224
227
|
import {
|
|
225
228
|
openBrowserSecurely,
|
|
226
229
|
shouldAttemptBrowserLaunch
|
|
@@ -245,7 +248,7 @@ import {
|
|
|
245
248
|
addToolArgumentsAttributes,
|
|
246
249
|
addToolCallResultAttributes,
|
|
247
250
|
addUserPromptAttributes
|
|
248
|
-
} from "./chunk-
|
|
251
|
+
} from "./chunk-MGSSJT27.js";
|
|
249
252
|
import {
|
|
250
253
|
InvalidStreamError,
|
|
251
254
|
getThoughtSummary
|
|
@@ -380,7 +383,7 @@ import {
|
|
|
380
383
|
updateMCPServerStatus,
|
|
381
384
|
writeLine,
|
|
382
385
|
writeLineSync
|
|
383
|
-
} from "./chunk-
|
|
386
|
+
} from "./chunk-36Q4BOUL.js";
|
|
384
387
|
import {
|
|
385
388
|
E_TIMEOUT,
|
|
386
389
|
Mutex,
|
|
@@ -408,13 +411,14 @@ import {
|
|
|
408
411
|
} from "./chunk-E4WHKETF.js";
|
|
409
412
|
import {
|
|
410
413
|
STRUCTURED_OUTPUT_REDACTED_ARGS
|
|
411
|
-
} from "./chunk-
|
|
414
|
+
} from "./chunk-ZPPP6VCL.js";
|
|
412
415
|
import {
|
|
413
416
|
AgentStatistics,
|
|
414
417
|
BaseDeclarativeTool,
|
|
415
418
|
BaseToolInvocation,
|
|
416
419
|
CONCURRENCY_SAFE_KINDS,
|
|
417
420
|
SchemaValidator,
|
|
421
|
+
StructuredToolError,
|
|
418
422
|
ToolDisplayNames,
|
|
419
423
|
ToolDisplayNamesMigration,
|
|
420
424
|
ToolNames,
|
|
@@ -425,7 +429,7 @@ import {
|
|
|
425
429
|
require_dist,
|
|
426
430
|
require_fast_deep_equal,
|
|
427
431
|
require_fast_uri
|
|
428
|
-
} from "./chunk-
|
|
432
|
+
} from "./chunk-D7D7RXIJ.js";
|
|
429
433
|
import {
|
|
430
434
|
AUTH_ENV_MAPPINGS,
|
|
431
435
|
AuthType,
|
|
@@ -439,7 +443,7 @@ import {
|
|
|
439
443
|
createContentGenerator,
|
|
440
444
|
resetPreloadedContentGenerator,
|
|
441
445
|
resolveContentGeneratorConfigWithSources
|
|
442
|
-
} from "./chunk-
|
|
446
|
+
} from "./chunk-MMWH7ERH.js";
|
|
443
447
|
import {
|
|
444
448
|
normalizeMcpToolName,
|
|
445
449
|
sanitizeToolNameForProvider
|
|
@@ -491,15 +495,28 @@ import {
|
|
|
491
495
|
startToolExecutionSpan,
|
|
492
496
|
startToolSpan,
|
|
493
497
|
truncateSpanError
|
|
494
|
-
} from "./chunk-
|
|
498
|
+
} from "./chunk-5L6CQ4ZU.js";
|
|
495
499
|
import {
|
|
496
500
|
safeJsonStringify
|
|
497
501
|
} from "./chunk-W4RQUHY3.js";
|
|
498
502
|
import {
|
|
499
503
|
DEFAULT_SENSITIVE_SPAN_ATTRIBUTE_MAX_LENGTH,
|
|
500
504
|
SENSITIVE_SPAN_ATTRIBUTE_MAX_LENGTH_LIMIT,
|
|
505
|
+
TOOL_FAILURE_KIND_ATTRIBUTE,
|
|
506
|
+
TOOL_FAILURE_KIND_BACKGROUND_AGENT_DENIED,
|
|
507
|
+
TOOL_FAILURE_KIND_CANCELLED,
|
|
508
|
+
TOOL_FAILURE_KIND_INVOCATION_GUARD_DENIED,
|
|
509
|
+
TOOL_FAILURE_KIND_NON_INTERACTIVE_DENIED,
|
|
510
|
+
TOOL_FAILURE_KIND_PERMISSION_DENIED,
|
|
511
|
+
TOOL_FAILURE_KIND_PERMISSION_HOOK_DENIED,
|
|
512
|
+
TOOL_FAILURE_KIND_PLAN_MODE_BLOCKED,
|
|
513
|
+
TOOL_FAILURE_KIND_POST_HOOK_STOPPED,
|
|
514
|
+
TOOL_FAILURE_KIND_PRE_HOOK_BLOCKED,
|
|
515
|
+
TOOL_FAILURE_KIND_TIMEOUT,
|
|
516
|
+
TOOL_FAILURE_KIND_TOOL_ERROR,
|
|
517
|
+
TOOL_FAILURE_KIND_TOOL_EXCEPTION,
|
|
501
518
|
isValidSensitiveSpanAttributeMaxLength
|
|
502
|
-
} from "./chunk-
|
|
519
|
+
} from "./chunk-LKRMNRSN.js";
|
|
503
520
|
import {
|
|
504
521
|
FatalConfigError,
|
|
505
522
|
PATH_ARG_KEYS,
|
|
@@ -19962,13 +19979,15 @@ var BaseLlmClient = class {
|
|
|
19962
19979
|
);
|
|
19963
19980
|
let text = "";
|
|
19964
19981
|
let usage;
|
|
19982
|
+
let hadToolCall = false;
|
|
19965
19983
|
for await (const chunk of responseStream) {
|
|
19966
19984
|
text += getResponseText(chunk) ?? "";
|
|
19985
|
+
hadToolCall ||= (getFunctionCalls(chunk)?.length ?? 0) > 0;
|
|
19967
19986
|
if (chunk.usageMetadata) {
|
|
19968
19987
|
usage = chunk.usageMetadata;
|
|
19969
19988
|
}
|
|
19970
19989
|
}
|
|
19971
|
-
return { text, usage };
|
|
19990
|
+
return { text, usage, hadToolCall };
|
|
19972
19991
|
} : async () => {
|
|
19973
19992
|
const result2 = await contentGenerator.generateContent(
|
|
19974
19993
|
request,
|
|
@@ -19976,7 +19995,8 @@ var BaseLlmClient = class {
|
|
|
19976
19995
|
);
|
|
19977
19996
|
return {
|
|
19978
19997
|
text: getResponseText(result2) ?? "",
|
|
19979
|
-
usage: result2.usageMetadata
|
|
19998
|
+
usage: result2.usageMetadata,
|
|
19999
|
+
hadToolCall: (getFunctionCalls(result2)?.length ?? 0) > 0
|
|
19980
20000
|
};
|
|
19981
20001
|
};
|
|
19982
20002
|
const result = await retryWithBackoff(apiCall, {
|
|
@@ -20008,7 +20028,8 @@ var BaseLlmClient = class {
|
|
|
20008
20028
|
});
|
|
20009
20029
|
return {
|
|
20010
20030
|
text: result.text.trim(),
|
|
20011
|
-
usage: result.usage
|
|
20031
|
+
usage: result.usage,
|
|
20032
|
+
hadToolCall: result.hadToolCall
|
|
20012
20033
|
};
|
|
20013
20034
|
} catch (error) {
|
|
20014
20035
|
if (abortSignal.aborted) {
|
|
@@ -22132,7 +22153,7 @@ You have access to the ${ToolNames.TODO_WRITE} tool to keep user-visible progres
|
|
|
22132
22153
|
|
|
22133
22154
|
When you create a todo list:
|
|
22134
22155
|
- Keep it short and outcome-oriented. Use a few meaningful, logically ordered, verifiable steps rather than one item per error, file, command, or minor edit.
|
|
22135
|
-
-
|
|
22156
|
+
- When an active Todo plan covers work delegated through top-level Agent calls, pass the matching Todo ID as \`todo_id\` so the execution can be associated with that plan node. Do not create a Todo solely to wrap a delegation that does not otherwise need task tracking.
|
|
22136
22157
|
- Keep at most one item in_progress. Keep the list current, mark finished work completed, and revise it when the scope or approach changes. When work completes together, update multiple statuses in one tool call rather than making bookkeeping-only calls.
|
|
22137
22158
|
- Do not repeat the full todo list in prose after calling the tool; briefly communicate only important context or the next step.
|
|
22138
22159
|
|
|
@@ -22434,6 +22455,9 @@ Okay, I can write those tests. First, I'll read someFile.ts to understand its fu
|
|
|
22434
22455
|
Now I'll look for existing or related test files to understand current testing conventions and dependencies.
|
|
22435
22456
|
[tool_call: ${ToolNames.READ_FILE} for file_path '/path/to/existingTest.test.ts']
|
|
22436
22457
|
(After reviewing existing tests and the file content)
|
|
22458
|
+
I'll check whether the intended test file already exists.
|
|
22459
|
+
[tool_call: ${ToolNames.READ_FILE} for file_path '/path/to/someFile.test.ts']
|
|
22460
|
+
(After read_file reports that /path/to/someFile.test.ts does not exist)
|
|
22437
22461
|
[tool_call: ${ToolNames.WRITE_FILE} for file_path '/path/to/someFile.test.ts' with content '(test code content)']
|
|
22438
22462
|
I've written the tests. Now I'll run the project's test command to verify them.
|
|
22439
22463
|
[tool_call: ${ToolNames.SHELL} for 'npm run test']
|
|
@@ -22573,6 +22597,15 @@ Now I'll look for existing or related test files to understand current testing c
|
|
|
22573
22597
|
</function>
|
|
22574
22598
|
</tool_call>
|
|
22575
22599
|
(After reviewing existing tests and the file content)
|
|
22600
|
+
I'll check whether the intended test file already exists.
|
|
22601
|
+
<tool_call>
|
|
22602
|
+
<function=${ToolNames.READ_FILE}>
|
|
22603
|
+
<parameter=file_path>
|
|
22604
|
+
/path/to/someFile.test.ts
|
|
22605
|
+
</parameter>
|
|
22606
|
+
</function>
|
|
22607
|
+
</tool_call>
|
|
22608
|
+
(After read_file reports that /path/to/someFile.test.ts does not exist)
|
|
22576
22609
|
<tool_call>
|
|
22577
22610
|
<function=${ToolNames.WRITE_FILE}>
|
|
22578
22611
|
<parameter=file_path>
|
|
@@ -22686,6 +22719,11 @@ Now I'll look for existing or related test files to understand current testing c
|
|
|
22686
22719
|
{"name": "${ToolNames.READ_FILE}", "arguments": {"file_path": "/path/to/existingTest.test.ts"}}
|
|
22687
22720
|
</tool_call>
|
|
22688
22721
|
(After reviewing existing tests and the file content)
|
|
22722
|
+
I'll check whether the intended test file already exists.
|
|
22723
|
+
<tool_call>
|
|
22724
|
+
{"name": "${ToolNames.READ_FILE}", "arguments": {"file_path": "/path/to/someFile.test.ts"}}
|
|
22725
|
+
</tool_call>
|
|
22726
|
+
(After read_file reports that /path/to/someFile.test.ts does not exist)
|
|
22689
22727
|
<tool_call>
|
|
22690
22728
|
{"name": "${ToolNames.WRITE_FILE}", "arguments": {"file_path": "/path/to/someFile.test.ts", "content": "(test code content)"}}
|
|
22691
22729
|
</tool_call>
|
|
@@ -22767,6 +22805,9 @@ Okay, I can write those tests. First, I'll read someFile.ts to understand its fu
|
|
|
22767
22805
|
Now I'll look for existing or related test files to understand current testing conventions and dependencies.
|
|
22768
22806
|
<|tool_call>call:${ToolNames.READ_FILE}{file_path:<|"|>/path/to/existingTest.test.ts<|"|>}<tool_call|>
|
|
22769
22807
|
(After reviewing existing tests and the file content)
|
|
22808
|
+
I'll check whether the intended test file already exists.
|
|
22809
|
+
<|tool_call>call:${ToolNames.READ_FILE}{file_path:<|"|>/path/to/someFile.test.ts<|"|>}<tool_call|>
|
|
22810
|
+
(After read_file reports that /path/to/someFile.test.ts does not exist)
|
|
22770
22811
|
<|tool_call>call:${ToolNames.WRITE_FILE}{file_path:<|"|>/path/to/someFile.test.ts<|"|>,content:<|"|>(test code content)<|"|>}<tool_call|>
|
|
22771
22812
|
I've written the tests. Now I'll run the project's test command to verify them.
|
|
22772
22813
|
<|tool_call>call:${ToolNames.SHELL}{command:<|"|>npm run test<|"|>}<tool_call|>
|
|
@@ -29318,17 +29359,14 @@ function recordSegmentBytes(index, uuid) {
|
|
|
29318
29359
|
return entry?.segments.reduce((total, segment) => total + segment.length, 0) ?? 0;
|
|
29319
29360
|
}
|
|
29320
29361
|
__name(recordSegmentBytes, "recordSegmentBytes");
|
|
29321
|
-
function selectPageUuids(index,
|
|
29362
|
+
function selectPageUuids(index, position, limit, maxBytes) {
|
|
29322
29363
|
const candidates = index.activeUuids.slice(position, position + limit);
|
|
29323
29364
|
if (maxBytes === void 0) return candidates;
|
|
29324
29365
|
const selected = [];
|
|
29325
29366
|
let selectedBytes = 0;
|
|
29326
29367
|
for (const uuid of candidates) {
|
|
29327
29368
|
const bytes = recordSegmentBytes(index, uuid);
|
|
29328
|
-
if (selected.length
|
|
29329
|
-
throw new SessionTranscriptPageTooLargeError(sessionId, bytes, maxBytes);
|
|
29330
|
-
}
|
|
29331
|
-
if (selectedBytes + bytes > maxBytes) break;
|
|
29369
|
+
if (selected.length > 0 && selectedBytes + bytes > maxBytes) break;
|
|
29332
29370
|
selected.push(uuid);
|
|
29333
29371
|
selectedBytes += bytes;
|
|
29334
29372
|
}
|
|
@@ -29340,7 +29378,7 @@ function isReplayTurnStart(index, uuid) {
|
|
|
29340
29378
|
return entry?.type === "user" && entry.subtype !== "mid_turn_user_message";
|
|
29341
29379
|
}
|
|
29342
29380
|
__name(isReplayTurnStart, "isReplayTurnStart");
|
|
29343
|
-
function selectBackwardPageUuids(index,
|
|
29381
|
+
function selectBackwardPageUuids(index, position, limit, maxBytes) {
|
|
29344
29382
|
let start = Math.max(0, position - limit);
|
|
29345
29383
|
for (let i = start; i < position; i++) {
|
|
29346
29384
|
if (isReplayTurnStart(index, index.activeUuids[i])) {
|
|
@@ -29356,10 +29394,9 @@ function selectBackwardPageUuids(index, sessionId, position, limit, maxBytes) {
|
|
|
29356
29394
|
for (let i = position - 1; i >= start; i--) {
|
|
29357
29395
|
const uuid = index.activeUuids[i];
|
|
29358
29396
|
const bytes = recordSegmentBytes(index, uuid);
|
|
29359
|
-
if (selectedStart
|
|
29360
|
-
|
|
29397
|
+
if (selectedStart < position && maxBytes !== void 0 && selectedBytes + bytes > maxBytes) {
|
|
29398
|
+
break;
|
|
29361
29399
|
}
|
|
29362
|
-
if (maxBytes !== void 0 && selectedBytes + bytes > maxBytes) break;
|
|
29363
29400
|
selectedStart = i;
|
|
29364
29401
|
selectedBytes += bytes;
|
|
29365
29402
|
}
|
|
@@ -29371,7 +29408,6 @@ function selectBackwardPageUuids(index, sessionId, position, limit, maxBytes) {
|
|
|
29371
29408
|
break;
|
|
29372
29409
|
}
|
|
29373
29410
|
}
|
|
29374
|
-
let expandedSelection = false;
|
|
29375
29411
|
if (alignedToReplayBoundary && selectedStart > 0) {
|
|
29376
29412
|
let previousTurnStart = selectedStart - 1;
|
|
29377
29413
|
while (previousTurnStart >= 0 && !isReplayTurnStart(index, index.activeUuids[previousTurnStart])) {
|
|
@@ -29379,23 +29415,11 @@ function selectBackwardPageUuids(index, sessionId, position, limit, maxBytes) {
|
|
|
29379
29415
|
}
|
|
29380
29416
|
if (previousTurnStart < 0) {
|
|
29381
29417
|
selectedStart = 0;
|
|
29382
|
-
expandedSelection = true;
|
|
29383
29418
|
}
|
|
29384
29419
|
} else if (!alignedToReplayBoundary) {
|
|
29385
29420
|
while (selectedStart > 0 && !isReplayTurnStart(index, index.activeUuids[selectedStart])) {
|
|
29386
29421
|
selectedStart--;
|
|
29387
29422
|
}
|
|
29388
|
-
expandedSelection = true;
|
|
29389
|
-
}
|
|
29390
|
-
if (expandedSelection && maxBytes !== void 0) {
|
|
29391
|
-
const alignedBytes = index.activeUuids.slice(selectedStart, position).reduce((total, uuid) => total + recordSegmentBytes(index, uuid), 0);
|
|
29392
|
-
if (alignedBytes > maxBytes) {
|
|
29393
|
-
throw new SessionTranscriptPageTooLargeError(
|
|
29394
|
-
sessionId,
|
|
29395
|
-
alignedBytes,
|
|
29396
|
-
maxBytes
|
|
29397
|
-
);
|
|
29398
|
-
}
|
|
29399
29423
|
}
|
|
29400
29424
|
return {
|
|
29401
29425
|
uuids: index.activeUuids.slice(selectedStart, position),
|
|
@@ -29825,8 +29849,8 @@ var SessionTranscriptReader = class {
|
|
|
29825
29849
|
);
|
|
29826
29850
|
throw new InvalidSessionTranscriptCursorError();
|
|
29827
29851
|
}
|
|
29828
|
-
const backwardPage = direction === "backward" ? selectBackwardPageUuids(index,
|
|
29829
|
-
const pageUuids = backwardPage?.uuids ?? selectPageUuids(index,
|
|
29852
|
+
const backwardPage = direction === "backward" ? selectBackwardPageUuids(index, position, limit, maxBytes) : void 0;
|
|
29853
|
+
const pageUuids = backwardPage?.uuids ?? selectPageUuids(index, position, limit, maxBytes);
|
|
29830
29854
|
const nextPosition = backwardPage?.nextPosition ?? position + pageUuids.length;
|
|
29831
29855
|
const records = await readAggregatedRecords(index, pageUuids);
|
|
29832
29856
|
const backwardGoalState = direction === "backward" ? await readGoalStateBeforePosition(index, nextPosition) : void 0;
|
|
@@ -35100,7 +35124,8 @@ function createDuplicateProviderToolCallResponse(request) {
|
|
|
35100
35124
|
],
|
|
35101
35125
|
resultDisplay: message,
|
|
35102
35126
|
error: new Error(message),
|
|
35103
|
-
errorType: "execution_failed" /* EXECUTION_FAILED
|
|
35127
|
+
errorType: "execution_failed" /* EXECUTION_FAILED */,
|
|
35128
|
+
executionStatus: "not_started"
|
|
35104
35129
|
};
|
|
35105
35130
|
}
|
|
35106
35131
|
__name(createDuplicateProviderToolCallResponse, "createDuplicateProviderToolCallResponse");
|
|
@@ -35318,6 +35343,15 @@ function getCitations(resp) {
|
|
|
35318
35343
|
}
|
|
35319
35344
|
__name(getCitations, "getCitations");
|
|
35320
35345
|
|
|
35346
|
+
// packages/core/src/core/openaiContentGenerator/prefix-caching.ts
|
|
35347
|
+
init_esbuild_shims();
|
|
35348
|
+
function supportsOpenAIPrefixCaching(contentGeneratorConfig) {
|
|
35349
|
+
return DashScopeOpenAICompatibleProvider.isDashScopeProvider(
|
|
35350
|
+
contentGeneratorConfig
|
|
35351
|
+
);
|
|
35352
|
+
}
|
|
35353
|
+
__name(supportsOpenAIPrefixCaching, "supportsOpenAIPrefixCaching");
|
|
35354
|
+
|
|
35321
35355
|
// packages/core/src/services/postCompactAttachments.ts
|
|
35322
35356
|
init_esbuild_shims();
|
|
35323
35357
|
import { readFile as readFile7, stat as stat4 } from "node:fs/promises";
|
|
@@ -35776,6 +35810,21 @@ Additional Instructions:
|
|
|
35776
35810
|
${parts.join("\n\n")}`;
|
|
35777
35811
|
}
|
|
35778
35812
|
__name(buildCompressionSystemPrompt, "buildCompressionSystemPrompt");
|
|
35813
|
+
function supportsCompressionCacheSharing(config) {
|
|
35814
|
+
const provider = config.getContentGeneratorConfig();
|
|
35815
|
+
if (provider.enableCacheControl === false) return false;
|
|
35816
|
+
if (provider.authType === "anthropic" /* USE_ANTHROPIC */) return true;
|
|
35817
|
+
return (provider.authType === "qwen-oauth" /* QWEN_OAUTH */ || provider.authType === "openai" /* USE_OPENAI */) && supportsOpenAIPrefixCaching(provider);
|
|
35818
|
+
}
|
|
35819
|
+
__name(supportsCompressionCacheSharing, "supportsCompressionCacheSharing");
|
|
35820
|
+
function hasStateSnapshot(summary) {
|
|
35821
|
+
const stripped = stripAnalysisBlock(summary);
|
|
35822
|
+
const startTag = "<state_snapshot>";
|
|
35823
|
+
const start = stripped.indexOf(startTag);
|
|
35824
|
+
const end = stripped.indexOf("</state_snapshot>", start + startTag.length);
|
|
35825
|
+
return start >= 0 && end > start + startTag.length && stripped.slice(start + startTag.length, end).trim().length > 0;
|
|
35826
|
+
}
|
|
35827
|
+
__name(hasStateSnapshot, "hasStateSnapshot");
|
|
35779
35828
|
var ChatCompressionService = class {
|
|
35780
35829
|
static {
|
|
35781
35830
|
__name(this, "ChatCompressionService");
|
|
@@ -35916,7 +35965,9 @@ var ChatCompressionService = class {
|
|
|
35916
35965
|
}
|
|
35917
35966
|
}
|
|
35918
35967
|
}
|
|
35919
|
-
const
|
|
35968
|
+
const abortSignal = signal ?? new AbortController().signal;
|
|
35969
|
+
abortSignal.throwIfAborted();
|
|
35970
|
+
const runColdCompression = /* @__PURE__ */ __name(() => runSideQuery(config, {
|
|
35920
35971
|
purpose: "chat-compression",
|
|
35921
35972
|
skipOutputLanguagePreference: true,
|
|
35922
35973
|
model: effectiveCompactionModel,
|
|
@@ -35953,9 +36004,77 @@ var ChatCompressionService = class {
|
|
|
35953
36004
|
thinkingConfig: { includeThoughts: false },
|
|
35954
36005
|
maxOutputTokens: COMPACT_MAX_OUTPUT_TOKENS
|
|
35955
36006
|
},
|
|
35956
|
-
abortSignal
|
|
36007
|
+
abortSignal,
|
|
35957
36008
|
promptId
|
|
35958
|
-
});
|
|
36009
|
+
}), "runColdCompression");
|
|
36010
|
+
let summaryResult;
|
|
36011
|
+
let usedCacheSharing = false;
|
|
36012
|
+
const canShareCache = effectiveCompactionModel === config.getModel() && slim.stats.imagesStripped === 0 && slim.stats.documentsStripped === 0 && supportsCompressionCacheSharing(config);
|
|
36013
|
+
if (canShareCache) {
|
|
36014
|
+
try {
|
|
36015
|
+
const generationConfig = {
|
|
36016
|
+
...chat.getGenerationConfig(),
|
|
36017
|
+
...opts.requestGenerationConfig
|
|
36018
|
+
};
|
|
36019
|
+
const mainSystemInstruction = generationConfig.systemInstruction;
|
|
36020
|
+
delete generationConfig.systemInstruction;
|
|
36021
|
+
delete generationConfig.abortSignal;
|
|
36022
|
+
const sharedResult = await config.getBaseLlmClient().generateText({
|
|
36023
|
+
contents: [
|
|
36024
|
+
...sideQueryHistory,
|
|
36025
|
+
{
|
|
36026
|
+
role: "user",
|
|
36027
|
+
parts: [
|
|
36028
|
+
{
|
|
36029
|
+
text: `${systemInstruction}
|
|
36030
|
+
|
|
36031
|
+
Do not call tools; tool execution is disabled for this request. First, reason in your <analysis> block. Then, produce the <state_snapshot> XML.`
|
|
36032
|
+
}
|
|
36033
|
+
]
|
|
36034
|
+
}
|
|
36035
|
+
],
|
|
36036
|
+
model: effectiveCompactionModel,
|
|
36037
|
+
systemInstruction: mainSystemInstruction,
|
|
36038
|
+
config: {
|
|
36039
|
+
...generationConfig,
|
|
36040
|
+
...config.getContentGeneratorConfig().authType === "anthropic" /* USE_ANTHROPIC */ ? {
|
|
36041
|
+
thinkingConfig: {
|
|
36042
|
+
...generationConfig.thinkingConfig,
|
|
36043
|
+
// Manual Anthropic thinking requires budget_tokens to be
|
|
36044
|
+
// strictly below max_tokens. Preserve thinking for cache
|
|
36045
|
+
// compatibility while keeping this bounded request valid.
|
|
36046
|
+
thinkingBudget: COMPACT_MAX_OUTPUT_TOKENS - 1
|
|
36047
|
+
}
|
|
36048
|
+
} : {},
|
|
36049
|
+
maxOutputTokens: COMPACT_MAX_OUTPUT_TOKENS
|
|
36050
|
+
},
|
|
36051
|
+
abortSignal,
|
|
36052
|
+
promptId,
|
|
36053
|
+
stream: true,
|
|
36054
|
+
maxAttempts: 1
|
|
36055
|
+
});
|
|
36056
|
+
if (!sharedResult.hadToolCall && hasStateSnapshot(sharedResult.text)) {
|
|
36057
|
+
summaryResult = sharedResult;
|
|
36058
|
+
usedCacheSharing = true;
|
|
36059
|
+
config.getDebugLogger().debug(
|
|
36060
|
+
`[chat-compression] cache-sharing request succeeded; cachedContentTokenCount=${sharedResult.usage?.cachedContentTokenCount ?? 0}`
|
|
36061
|
+
);
|
|
36062
|
+
} else {
|
|
36063
|
+
config.getDebugLogger().warn(
|
|
36064
|
+
`[chat-compression] cache-sharing response was unusable (${sharedResult.hadToolCall ? "tool call" : "invalid state snapshot"}); falling back to the dedicated summarizer.`
|
|
36065
|
+
);
|
|
36066
|
+
}
|
|
36067
|
+
} catch (error) {
|
|
36068
|
+
if (abortSignal.aborted) throw error;
|
|
36069
|
+
config.getDebugLogger().warn(
|
|
36070
|
+
`[chat-compression] cache-sharing request failed; falling back to the dedicated summarizer: ${String(error)}`
|
|
36071
|
+
);
|
|
36072
|
+
}
|
|
36073
|
+
}
|
|
36074
|
+
if (!summaryResult) {
|
|
36075
|
+
abortSignal.throwIfAborted();
|
|
36076
|
+
summaryResult = await runColdCompression();
|
|
36077
|
+
}
|
|
35959
36078
|
const summary = summaryResult.text;
|
|
35960
36079
|
const isSummaryEmpty = !summary || stripAnalysisBlock(summary).trim().length === 0;
|
|
35961
36080
|
const compressionUsageMetadata = summaryResult.usage;
|
|
@@ -35976,7 +36095,7 @@ var ChatCompressionService = class {
|
|
|
35976
36095
|
`[chat-compression] compression side-query omitted usage metadata; using local estimate for summary output token count (${compressionOutputTokenCount}).`
|
|
35977
36096
|
);
|
|
35978
36097
|
}
|
|
35979
|
-
if (!isSummaryEmpty && typeof compressionOutputTokenCount === "number" && compressionOutputTokenCount >= COMPACT_MAX_OUTPUT_TOKENS) {
|
|
36098
|
+
if (!usedCacheSharing && !isSummaryEmpty && typeof compressionOutputTokenCount === "number" && compressionOutputTokenCount >= COMPACT_MAX_OUTPUT_TOKENS) {
|
|
35980
36099
|
config.getDebugLogger().warn(
|
|
35981
36100
|
`[chat-compression] summary output reached the COMPACT_MAX_OUTPUT_TOKENS cap (${COMPACT_MAX_OUTPUT_TOKENS}); dropping potentially-truncated result. This counts as a compression failure for the per-chat circuit breaker.`
|
|
35982
36101
|
);
|
|
@@ -36039,7 +36158,7 @@ var ChatCompressionService = class {
|
|
|
36039
36158
|
}
|
|
36040
36159
|
];
|
|
36041
36160
|
}
|
|
36042
|
-
if (typeof compressionInputTokenCount === "number" && compressionInputTokenCount > 0 && typeof compressionOutputTokenCount === "number" && compressionOutputTokenCount > 0) {
|
|
36161
|
+
if (!usedCacheSharing && typeof compressionInputTokenCount === "number" && compressionInputTokenCount > 0 && typeof compressionOutputTokenCount === "number" && compressionOutputTokenCount > 0) {
|
|
36043
36162
|
canCalculateNewTokenCount = true;
|
|
36044
36163
|
const compressedHistoryTokenCount = Math.max(
|
|
36045
36164
|
0,
|
|
@@ -36071,7 +36190,7 @@ var ChatCompressionService = class {
|
|
|
36071
36190
|
newTokenCount = estimatedNonVisibleTokenCount + estimatedNewVisibleTokenCount;
|
|
36072
36191
|
canCalculateNewTokenCount = true;
|
|
36073
36192
|
config.getDebugLogger().debug(
|
|
36074
|
-
`[chat-compression] usage metadata missing; estimated post-compression token count by preserving the API-reported non-visible remainder (${estimatedNonVisibleTokenCount}) and replacing the visible-history estimate (${estimatedOriginalVisibleTokenCount} -> ${estimatedNewVisibleTokenCount}).`
|
|
36193
|
+
`[chat-compression] ${usedCacheSharing ? "cache-sharing token accounting" : "usage metadata missing"}; estimated post-compression token count by preserving the API-reported non-visible remainder (${estimatedNonVisibleTokenCount}) and replacing the visible-history estimate (${estimatedOriginalVisibleTokenCount} -> ${estimatedNewVisibleTokenCount}).`
|
|
36075
36194
|
);
|
|
36076
36195
|
}
|
|
36077
36196
|
}
|
|
@@ -36082,7 +36201,9 @@ var ChatCompressionService = class {
|
|
|
36082
36201
|
tokens_before: originalTokenCount,
|
|
36083
36202
|
tokens_after: newTokenCount,
|
|
36084
36203
|
compression_input_token_count: compressionInputTokenCount,
|
|
36085
|
-
compression_output_token_count: compressionOutputTokenCount
|
|
36204
|
+
compression_output_token_count: compressionOutputTokenCount,
|
|
36205
|
+
cache_sharing_attempted: canShareCache,
|
|
36206
|
+
cache_sharing_used: usedCacheSharing
|
|
36086
36207
|
})
|
|
36087
36208
|
);
|
|
36088
36209
|
if (isSummaryEmpty) {
|
|
@@ -36787,14 +36908,14 @@ var RETRYABLE_STREAM_TRANSPORT_CODES = /* @__PURE__ */ new Set([
|
|
|
36787
36908
|
// packages/core/src/core/geminiChat.ts
|
|
36788
36909
|
var debugLogger22 = createDebugLogger("QWEN_CODE_CHAT");
|
|
36789
36910
|
var GEMINI_EMPTY_CONTENT_PLACEHOLDER = "(empty content)";
|
|
36790
|
-
function
|
|
36791
|
-
|
|
36792
|
-
|
|
36793
|
-
|
|
36911
|
+
function hasCandidateOutput(response) {
|
|
36912
|
+
return Boolean(
|
|
36913
|
+
response.candidates?.some(
|
|
36914
|
+
(candidate) => Boolean(candidate.finishReason) || (candidate.content?.parts?.length ?? 0) > 0
|
|
36915
|
+
)
|
|
36794
36916
|
);
|
|
36795
|
-
return !hasCandidateOutput && !response.usageMetadata;
|
|
36796
36917
|
}
|
|
36797
|
-
__name(
|
|
36918
|
+
__name(hasCandidateOutput, "hasCandidateOutput");
|
|
36798
36919
|
function hasNonThoughtCandidateParts(response) {
|
|
36799
36920
|
return Boolean(
|
|
36800
36921
|
response.candidates?.some(
|
|
@@ -36927,11 +37048,24 @@ var INVALID_STREAM_RETRY_CONFIG = {
|
|
|
36927
37048
|
};
|
|
36928
37049
|
var TRANSPORT_STREAM_RETRY_CONFIG = {
|
|
36929
37050
|
maxRetries: 2,
|
|
36930
|
-
initialDelayMs: 1e3
|
|
37051
|
+
initialDelayMs: 1e3,
|
|
37052
|
+
/**
|
|
37053
|
+
* Budget for *continuation* recovery after a socket-level cut that already
|
|
37054
|
+
* delivered output (issue #7832). This is a different mechanism from the
|
|
37055
|
+
* `maxRetries` replay above and therefore has its own budget: a replay
|
|
37056
|
+
* re-sends the request from scratch and is only legal before any chunk
|
|
37057
|
+
* reached callers, while a continuation keeps the delivered output and asks
|
|
37058
|
+
* the model to resume from it. A single long generation can be cut more than
|
|
37059
|
+
* once by the same gateway idle timeout, so this is sized like
|
|
37060
|
+
* {@link MAX_OUTPUT_RECOVERY_ATTEMPTS} rather than like the replay budget.
|
|
37061
|
+
*/
|
|
37062
|
+
maxContinuationRetries: 3
|
|
36931
37063
|
};
|
|
36932
37064
|
var FIRST_SEND_CLAMP_OVERHEAD_PAD = 2e4;
|
|
36933
37065
|
var MAX_OUTPUT_RECOVERY_ATTEMPTS = 3;
|
|
36934
|
-
var
|
|
37066
|
+
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.";
|
|
37067
|
+
var OUTPUT_RECOVERY_MESSAGE = `Output token limit hit. ${RECOVERY_RESUME_INSTRUCTION}`;
|
|
37068
|
+
var TRANSPORT_CONTINUATION_MESSAGE = `The connection dropped mid-response. ${RECOVERY_RESUME_INSTRUCTION}`;
|
|
36935
37069
|
var OUTPUT_RECOVERY_TAIL_CHARS = 1200;
|
|
36936
37070
|
var RECOVERY_OVERLAP_MAX_SCAN_CHARS = 4e3;
|
|
36937
37071
|
var RECOVERY_OVERLAP_MIN_BYTES = 6;
|
|
@@ -37046,20 +37180,26 @@ function sanitizeRecoverySuffixTail(tail) {
|
|
|
37046
37180
|
return tail.replace(/<\/previous_response_suffix>/g, "<\u200B/previous_response_suffix>").replace(/<previous_response_suffix>/g, "<\u200Bprevious_response_suffix>");
|
|
37047
37181
|
}
|
|
37048
37182
|
__name(sanitizeRecoverySuffixTail, "sanitizeRecoverySuffixTail");
|
|
37049
|
-
function
|
|
37050
|
-
const previousText = previousModelTurn?.role === "model" ? getPlainTextFromParts(previousModelTurn.parts) : "";
|
|
37183
|
+
function buildRecoveryMessageFromText(lead, previousText) {
|
|
37051
37184
|
if (previousText.trim().length === 0) {
|
|
37052
|
-
return
|
|
37185
|
+
return lead;
|
|
37053
37186
|
}
|
|
37054
37187
|
const rawTail = previousText.length > OUTPUT_RECOVERY_TAIL_CHARS ? previousText.slice(-OUTPUT_RECOVERY_TAIL_CHARS) : previousText;
|
|
37055
37188
|
const tail = sanitizeRecoverySuffixTail(rawTail);
|
|
37056
|
-
return `${
|
|
37189
|
+
return `${lead}
|
|
37057
37190
|
|
|
37058
37191
|
The previous assistant response ended with this exact suffix. Do not repeat any line, table row, code line, or prose that already appears in it; output only text that comes after this suffix:
|
|
37059
37192
|
|
|
37060
37193
|
<previous_response_suffix>
|
|
37061
37194
|
` + tail + "\n</previous_response_suffix>";
|
|
37062
37195
|
}
|
|
37196
|
+
__name(buildRecoveryMessageFromText, "buildRecoveryMessageFromText");
|
|
37197
|
+
function buildOutputRecoveryMessage(previousModelTurn) {
|
|
37198
|
+
return buildRecoveryMessageFromText(
|
|
37199
|
+
OUTPUT_RECOVERY_MESSAGE,
|
|
37200
|
+
previousModelTurn?.role === "model" ? getPlainTextFromParts(previousModelTurn.parts) : ""
|
|
37201
|
+
);
|
|
37202
|
+
}
|
|
37063
37203
|
__name(buildOutputRecoveryMessage, "buildOutputRecoveryMessage");
|
|
37064
37204
|
function appendRecoveryContinuationParts(previousParts, continuationParts) {
|
|
37065
37205
|
const mergedParts = [...previousParts ?? []];
|
|
@@ -37247,6 +37387,26 @@ var PROTOCOL_TAG_PREFIXES = [
|
|
|
37247
37387
|
"<summary",
|
|
37248
37388
|
"</summary"
|
|
37249
37389
|
];
|
|
37390
|
+
var LEAKED_TOOL_CALL_TAGS = /[}\]]\s*<\/parameter>\s*<\/function>/iy;
|
|
37391
|
+
function hasLeakedToolCallTags(text) {
|
|
37392
|
+
let inString = false;
|
|
37393
|
+
let escaped = false;
|
|
37394
|
+
for (let i = 0; i < text.length; i++) {
|
|
37395
|
+
const char = text[i];
|
|
37396
|
+
if (inString) {
|
|
37397
|
+
if (escaped) escaped = false;
|
|
37398
|
+
else if (char === "\\") escaped = true;
|
|
37399
|
+
else if (char === '"') inString = false;
|
|
37400
|
+
} else if (char === '"') {
|
|
37401
|
+
inString = true;
|
|
37402
|
+
} else if (char === "}" || char === "]") {
|
|
37403
|
+
LEAKED_TOOL_CALL_TAGS.lastIndex = i;
|
|
37404
|
+
if (LEAKED_TOOL_CALL_TAGS.test(text)) return true;
|
|
37405
|
+
}
|
|
37406
|
+
}
|
|
37407
|
+
return false;
|
|
37408
|
+
}
|
|
37409
|
+
__name(hasLeakedToolCallTags, "hasLeakedToolCallTags");
|
|
37250
37410
|
var LeadingProtocolTagLeakDetector = class {
|
|
37251
37411
|
static {
|
|
37252
37412
|
__name(this, "LeadingProtocolTagLeakDetector");
|
|
@@ -37257,6 +37417,7 @@ var LeadingProtocolTagLeakDetector = class {
|
|
|
37257
37417
|
if (this.state === "clean") return text;
|
|
37258
37418
|
if (this.state === "leaked") return "";
|
|
37259
37419
|
this.buffer += text;
|
|
37420
|
+
if (this.state === "json") return "";
|
|
37260
37421
|
const candidate = this.buffer.trimStart().toLowerCase();
|
|
37261
37422
|
if (!candidate) return "";
|
|
37262
37423
|
if (PROTOCOL_TAG_PREFIXES.some((prefix) => prefix.startsWith(candidate))) {
|
|
@@ -37269,12 +37430,29 @@ var LeadingProtocolTagLeakDetector = class {
|
|
|
37269
37430
|
return "";
|
|
37270
37431
|
}
|
|
37271
37432
|
}
|
|
37272
|
-
|
|
37273
|
-
|
|
37274
|
-
|
|
37275
|
-
|
|
37433
|
+
if (candidate.startsWith("{")) {
|
|
37434
|
+
this.state = "json";
|
|
37435
|
+
return "";
|
|
37436
|
+
}
|
|
37437
|
+
if (candidate.startsWith("[")) {
|
|
37438
|
+
const normalized2 = candidate.replace(/\s/g, "");
|
|
37439
|
+
if (normalized2 === "[") return "";
|
|
37440
|
+
if (normalized2.startsWith("[{")) {
|
|
37441
|
+
this.state = "json";
|
|
37442
|
+
return "";
|
|
37443
|
+
}
|
|
37444
|
+
}
|
|
37445
|
+
return this.release();
|
|
37276
37446
|
}
|
|
37277
37447
|
finish() {
|
|
37448
|
+
if (this.state === "json") {
|
|
37449
|
+
if (hasLeakedToolCallTags(this.buffer)) {
|
|
37450
|
+
this.state = "leaked";
|
|
37451
|
+
this.buffer = "";
|
|
37452
|
+
return "";
|
|
37453
|
+
}
|
|
37454
|
+
return this.release();
|
|
37455
|
+
}
|
|
37278
37456
|
if (this.state !== "detecting") return "";
|
|
37279
37457
|
const candidate = this.buffer.trimStart().toLowerCase();
|
|
37280
37458
|
if (candidate && PROTOCOL_TAG_PREFIXES.some((prefix) => prefix.startsWith(candidate))) {
|
|
@@ -37282,8 +37460,11 @@ var LeadingProtocolTagLeakDetector = class {
|
|
|
37282
37460
|
this.buffer = "";
|
|
37283
37461
|
return "";
|
|
37284
37462
|
}
|
|
37285
|
-
this.
|
|
37463
|
+
return this.release();
|
|
37464
|
+
}
|
|
37465
|
+
release() {
|
|
37286
37466
|
const output = this.buffer;
|
|
37467
|
+
this.state = "clean";
|
|
37287
37468
|
this.buffer = "";
|
|
37288
37469
|
return output;
|
|
37289
37470
|
}
|
|
@@ -37664,6 +37845,7 @@ var GeminiChat = class {
|
|
|
37664
37845
|
originalTokenCount: options2?.originalTokenCountOverride ?? this.lastPromptTokenCount,
|
|
37665
37846
|
pendingUserMessage: options2?.pendingUserMessage,
|
|
37666
37847
|
precomputedEffectiveTokens: options2?.precomputedEffectiveTokens,
|
|
37848
|
+
requestGenerationConfig: options2?.requestGenerationConfig,
|
|
37667
37849
|
trigger: options2?.trigger,
|
|
37668
37850
|
customInstructions: options2?.customInstructions,
|
|
37669
37851
|
signal
|
|
@@ -37893,6 +38075,7 @@ var GeminiChat = class {
|
|
|
37893
38075
|
{
|
|
37894
38076
|
pendingUserMessage: userContent,
|
|
37895
38077
|
precomputedEffectiveTokens: effectiveTokens,
|
|
38078
|
+
requestGenerationConfig: params.config,
|
|
37896
38079
|
deferChatCompressionRecord: shouldForceFromHard,
|
|
37897
38080
|
// Hard-rescue is force=true to bypass the cheap-gate breaker
|
|
37898
38081
|
// but it remains a semantically AUTOMATIC trigger. Tag the
|
|
@@ -38033,6 +38216,10 @@ var GeminiChat = class {
|
|
|
38033
38216
|
let protocolTagLeakRetryCount = 0;
|
|
38034
38217
|
const totalInvalidStreamRetryCount = /* @__PURE__ */ __name(() => transientInvalidStreamRetryCount + protocolTagLeakRetryCount, "totalInvalidStreamRetryCount");
|
|
38035
38218
|
let transportStreamRetryCount = 0;
|
|
38219
|
+
let transportContinuationCount = 0;
|
|
38220
|
+
let transportContinuationText = "";
|
|
38221
|
+
let transportAttemptText = "";
|
|
38222
|
+
let transportContinuationPrefix = "";
|
|
38036
38223
|
let reactiveCompressionAttempted = false;
|
|
38037
38224
|
let suppressNextRetryEvent = false;
|
|
38038
38225
|
let streamYieldedAnyChunk = false;
|
|
@@ -38059,18 +38246,49 @@ var GeminiChat = class {
|
|
|
38059
38246
|
);
|
|
38060
38247
|
const shouldEscalateMaxOutputTokens = effectiveInitialMaxOutputTokens < escalatedLimit;
|
|
38061
38248
|
let lastFinishReason;
|
|
38249
|
+
const buildAttemptContents = /* @__PURE__ */ __name(() => transportContinuationPrefix.length > 0 ? [
|
|
38250
|
+
...requestContents,
|
|
38251
|
+
{
|
|
38252
|
+
role: "model",
|
|
38253
|
+
parts: [{ text: transportContinuationPrefix }]
|
|
38254
|
+
},
|
|
38255
|
+
createUserContent([
|
|
38256
|
+
{
|
|
38257
|
+
text: buildRecoveryMessageFromText(
|
|
38258
|
+
TRANSPORT_CONTINUATION_MESSAGE,
|
|
38259
|
+
transportContinuationPrefix
|
|
38260
|
+
)
|
|
38261
|
+
}
|
|
38262
|
+
])
|
|
38263
|
+
] : requestContents, "buildAttemptContents");
|
|
38264
|
+
const resetTransportContinuation = /* @__PURE__ */ __name(() => {
|
|
38265
|
+
transportContinuationCount = 0;
|
|
38266
|
+
transportContinuationText = "";
|
|
38267
|
+
transportAttemptText = "";
|
|
38268
|
+
transportContinuationPrefix = "";
|
|
38269
|
+
}, "resetTransportContinuation");
|
|
38270
|
+
const foldTransportAttemptText = /* @__PURE__ */ __name(() => {
|
|
38271
|
+
transportContinuationText += getRecoveryContinuationSuffix(
|
|
38272
|
+
transportContinuationText,
|
|
38273
|
+
transportAttemptText
|
|
38274
|
+
);
|
|
38275
|
+
transportAttemptText = "";
|
|
38276
|
+
}, "foldTransportAttemptText");
|
|
38062
38277
|
for (; ; ) {
|
|
38278
|
+
transportAttemptText = "";
|
|
38063
38279
|
let streamYieldedChunk = false;
|
|
38064
38280
|
let streamYieldedContentChunk = false;
|
|
38281
|
+
let streamYieldedFunctionCall = false;
|
|
38065
38282
|
try {
|
|
38066
38283
|
if (suppressNextRetryEvent) {
|
|
38067
38284
|
suppressNextRetryEvent = false;
|
|
38068
|
-
} else if (rateLimitRetryCount > 0 || totalInvalidStreamRetryCount() > 0 || transportStreamRetryCount > 0) {
|
|
38285
|
+
} else if (rateLimitRetryCount > 0 || totalInvalidStreamRetryCount() > 0 || transportStreamRetryCount > 0 || transportContinuationCount > 0) {
|
|
38286
|
+
resetTransportContinuation();
|
|
38069
38287
|
yield { type: "retry" /* RETRY */ };
|
|
38070
38288
|
}
|
|
38071
38289
|
const stream2 = await self2.makeApiCallAndProcessStream(
|
|
38072
38290
|
model,
|
|
38073
|
-
|
|
38291
|
+
buildAttemptContents(),
|
|
38074
38292
|
params,
|
|
38075
38293
|
prompt_id,
|
|
38076
38294
|
requestOverrides,
|
|
@@ -38078,21 +38296,31 @@ var GeminiChat = class {
|
|
|
38078
38296
|
);
|
|
38079
38297
|
lastFinishReason = void 0;
|
|
38080
38298
|
for await (const chunk of stream2) {
|
|
38081
|
-
if (
|
|
38299
|
+
if (hasCandidateOutput(chunk)) {
|
|
38082
38300
|
streamYieldedChunk = true;
|
|
38083
38301
|
streamYieldedAnyChunk = true;
|
|
38084
38302
|
}
|
|
38085
38303
|
if (hasNonThoughtCandidateParts(chunk)) {
|
|
38086
38304
|
streamYieldedContentChunk = true;
|
|
38087
38305
|
}
|
|
38306
|
+
const chunkParts = chunk.candidates?.[0]?.content?.parts;
|
|
38307
|
+
transportAttemptText += getPlainTextFromParts(chunkParts);
|
|
38308
|
+
if (chunkParts?.some((part) => part.functionCall)) {
|
|
38309
|
+
streamYieldedFunctionCall = true;
|
|
38310
|
+
}
|
|
38088
38311
|
const fr2 = chunk.candidates?.[0]?.finishReason;
|
|
38089
38312
|
if (fr2) lastFinishReason = fr2;
|
|
38090
38313
|
yield { type: "chunk" /* CHUNK */, value: chunk };
|
|
38091
38314
|
}
|
|
38092
38315
|
lastError = null;
|
|
38316
|
+
if (transportContinuationPrefix.length > 0) {
|
|
38317
|
+
self2.prependTextToLastModelTurn(transportContinuationPrefix);
|
|
38318
|
+
transportContinuationPrefix = "";
|
|
38319
|
+
}
|
|
38093
38320
|
break;
|
|
38094
38321
|
} catch (error) {
|
|
38095
38322
|
lastError = error;
|
|
38323
|
+
foldTransportAttemptText();
|
|
38096
38324
|
const classification = classifyRetryError(error, {
|
|
38097
38325
|
authType: cgConfig?.authType,
|
|
38098
38326
|
extraRetryErrorCodes
|
|
@@ -38165,7 +38393,15 @@ var GeminiChat = class {
|
|
|
38165
38393
|
const isRetryableStreamTransportError = classification.kind === "transport" && classification.transportCode !== void 0 && RETRYABLE_STREAM_TRANSPORT_CODES.has(
|
|
38166
38394
|
classification.transportCode
|
|
38167
38395
|
);
|
|
38168
|
-
if (isRetryableStreamTransportError && !streamYieldedContentChunk &&
|
|
38396
|
+
if (isRetryableStreamTransportError && !streamYieldedContentChunk && // `streamYieldedContentChunk` is per-attempt, so on its own it
|
|
38397
|
+
// cannot tell "nothing has been delivered" from "this attempt
|
|
38398
|
+
// was cut while thinking, after earlier attempts already put
|
|
38399
|
+
// text on screen". Only the first is replayable; replaying the
|
|
38400
|
+
// second discards output the caller is watching. The
|
|
38401
|
+
// accumulated buffer is what distinguishes them, and it must be
|
|
38402
|
+
// consulted here because this branch is checked before the
|
|
38403
|
+
// continuation one below.
|
|
38404
|
+
transportContinuationText.trim().length === 0 && transportStreamRetryCount < TRANSPORT_STREAM_RETRY_CONFIG.maxRetries) {
|
|
38169
38405
|
self2.popPendingPartialAssistantTurn();
|
|
38170
38406
|
transportStreamRetryCount++;
|
|
38171
38407
|
const delayMs = TRANSPORT_STREAM_RETRY_CONFIG.initialDelayMs * transportStreamRetryCount;
|
|
@@ -38180,6 +38416,28 @@ var GeminiChat = class {
|
|
|
38180
38416
|
transportCode: classification.transportCode
|
|
38181
38417
|
});
|
|
38182
38418
|
yield { type: "retry" /* RETRY */ };
|
|
38419
|
+
resetTransportContinuation();
|
|
38420
|
+
suppressNextRetryEvent = true;
|
|
38421
|
+
await delay2(delayMs, params.config?.abortSignal).promise;
|
|
38422
|
+
continue;
|
|
38423
|
+
}
|
|
38424
|
+
const canContinueAfterTransportCut = isRetryableStreamTransportError && !streamYieldedFunctionCall && transportContinuationText.trim().length > 0 && transportContinuationCount < TRANSPORT_STREAM_RETRY_CONFIG.maxContinuationRetries;
|
|
38425
|
+
if (canContinueAfterTransportCut) {
|
|
38426
|
+
self2.popPendingPartialAssistantTurn();
|
|
38427
|
+
transportContinuationCount++;
|
|
38428
|
+
transportContinuationPrefix = transportContinuationText;
|
|
38429
|
+
const delayMs = TRANSPORT_STREAM_RETRY_CONFIG.initialDelayMs * transportContinuationCount;
|
|
38430
|
+
debugLogger22.warn("Transport stream continuation scheduled", {
|
|
38431
|
+
retryPath: "stream",
|
|
38432
|
+
retryDecision: "continue",
|
|
38433
|
+
attempt: transportContinuationCount,
|
|
38434
|
+
maxRetries: TRANSPORT_STREAM_RETRY_CONFIG.maxContinuationRetries,
|
|
38435
|
+
retryDelayMs: delayMs,
|
|
38436
|
+
errorKind: classification.kind,
|
|
38437
|
+
transportCode: classification.transportCode,
|
|
38438
|
+
deliveredChars: transportContinuationText.length
|
|
38439
|
+
});
|
|
38440
|
+
yield { type: "retry" /* RETRY */, isContinuation: true };
|
|
38183
38441
|
suppressNextRetryEvent = true;
|
|
38184
38442
|
await delay2(delayMs, params.config?.abortSignal).promise;
|
|
38185
38443
|
continue;
|
|
@@ -38190,6 +38448,8 @@ var GeminiChat = class {
|
|
|
38190
38448
|
retryDecision: streamYieldedContentChunk ? "skipped_after_content" : "exhausted",
|
|
38191
38449
|
attempts: transportStreamRetryCount,
|
|
38192
38450
|
maxRetries: TRANSPORT_STREAM_RETRY_CONFIG.maxRetries,
|
|
38451
|
+
continuationAttempts: transportContinuationCount,
|
|
38452
|
+
maxContinuationRetries: TRANSPORT_STREAM_RETRY_CONFIG.maxContinuationRetries,
|
|
38193
38453
|
errorKind: classification.kind,
|
|
38194
38454
|
transportCode: classification.transportCode
|
|
38195
38455
|
});
|
|
@@ -38209,6 +38469,7 @@ var GeminiChat = class {
|
|
|
38209
38469
|
params.config?.abortSignal,
|
|
38210
38470
|
{
|
|
38211
38471
|
originalTokenCountOverride: reactiveOriginalTokenCount,
|
|
38472
|
+
requestGenerationConfig: params.config,
|
|
38212
38473
|
trigger: "auto"
|
|
38213
38474
|
}
|
|
38214
38475
|
);
|
|
@@ -38244,6 +38505,7 @@ var GeminiChat = class {
|
|
|
38244
38505
|
info: reactiveInfo
|
|
38245
38506
|
};
|
|
38246
38507
|
yield { type: "retry" /* RETRY */ };
|
|
38508
|
+
resetTransportContinuation();
|
|
38247
38509
|
suppressNextRetryEvent = true;
|
|
38248
38510
|
continue;
|
|
38249
38511
|
}
|
|
@@ -38612,7 +38874,7 @@ var GeminiChat = class {
|
|
|
38612
38874
|
fallbackRetryErrorCodes,
|
|
38613
38875
|
turnGoalContext
|
|
38614
38876
|
)) {
|
|
38615
|
-
const emittedUserVisibleOutput = event.type !== "chunk" /* CHUNK */ ||
|
|
38877
|
+
const emittedUserVisibleOutput = event.type !== "chunk" /* CHUNK */ || hasCandidateOutput(event.value);
|
|
38616
38878
|
if (emittedUserVisibleOutput) {
|
|
38617
38879
|
currentFallbackYieldedAnyChunk = true;
|
|
38618
38880
|
fallbackStreamYieldedAnyChunk = true;
|
|
@@ -39096,6 +39358,21 @@ This error was probably caused by cyclic schema references in one of the followi
|
|
|
39096
39358
|
let hasToolCall = false;
|
|
39097
39359
|
let hasFinishReason = false;
|
|
39098
39360
|
const protocolTagDetector = new LeadingProtocolTagLeakDetector();
|
|
39361
|
+
let pendingProtocolParts = [];
|
|
39362
|
+
const takePendingProtocolParts = /* @__PURE__ */ __name(() => {
|
|
39363
|
+
const parts = pendingProtocolParts;
|
|
39364
|
+
pendingProtocolParts = [];
|
|
39365
|
+
const released = [];
|
|
39366
|
+
for (const part of parts) {
|
|
39367
|
+
const previous = released.at(-1);
|
|
39368
|
+
if (previous && isValidNonThoughtTextPart(previous) && isValidNonThoughtTextPart(part)) {
|
|
39369
|
+
previous.text += part.text;
|
|
39370
|
+
} else {
|
|
39371
|
+
released.push(isValidNonThoughtTextPart(part) ? { ...part } : part);
|
|
39372
|
+
}
|
|
39373
|
+
}
|
|
39374
|
+
return released;
|
|
39375
|
+
}, "takePendingProtocolParts");
|
|
39099
39376
|
let protocolTextWasSuppressed = false;
|
|
39100
39377
|
const currentUserTurn = this.history[this.history.length - 1];
|
|
39101
39378
|
const isToolResultContinuation = currentUserTurn?.role === "user" && currentUserTurn.parts?.some((part) => part.functionResponse) === true;
|
|
@@ -39120,22 +39397,57 @@ This error was probably caused by cyclic schema references in one of the followi
|
|
|
39120
39397
|
hasFinishReason ||= chunk?.candidates?.some((candidate) => candidate.finishReason) ?? false;
|
|
39121
39398
|
if (isValidResponse(chunk)) {
|
|
39122
39399
|
const candidate = chunk.candidates?.[0];
|
|
39123
|
-
|
|
39400
|
+
let content = candidate?.content;
|
|
39401
|
+
if (candidate?.finishReason && !content?.parts) {
|
|
39402
|
+
protocolTagDetector.finish();
|
|
39403
|
+
if (protocolTagDetector.leaked) {
|
|
39404
|
+
pendingProtocolParts = [];
|
|
39405
|
+
} else {
|
|
39406
|
+
const parts = takePendingProtocolParts();
|
|
39407
|
+
if (parts.length > 0) {
|
|
39408
|
+
content = {
|
|
39409
|
+
...content,
|
|
39410
|
+
role: content?.role ?? "model",
|
|
39411
|
+
parts
|
|
39412
|
+
};
|
|
39413
|
+
candidate.content = content;
|
|
39414
|
+
}
|
|
39415
|
+
}
|
|
39416
|
+
}
|
|
39124
39417
|
if (content?.parts) {
|
|
39125
|
-
|
|
39418
|
+
const outputParts = [];
|
|
39419
|
+
for (const part of content.parts) {
|
|
39126
39420
|
if (isToolResultContinuation && !part.thought && part.text?.trim() === GEMINI_EMPTY_CONTENT_PLACEHOLDER) {
|
|
39127
|
-
|
|
39421
|
+
continue;
|
|
39422
|
+
}
|
|
39423
|
+
if (typeof part.text !== "string" || part.thought) {
|
|
39424
|
+
if (pendingProtocolParts.length > 0 || protocolTagDetector.leaked) {
|
|
39425
|
+
pendingProtocolParts.push(part);
|
|
39426
|
+
} else {
|
|
39427
|
+
outputParts.push(part);
|
|
39428
|
+
}
|
|
39429
|
+
continue;
|
|
39128
39430
|
}
|
|
39129
|
-
if (typeof part.text !== "string" || part.thought) return [part];
|
|
39130
39431
|
const text = protocolTagDetector.accept(part.text);
|
|
39131
|
-
if (text)
|
|
39432
|
+
if (text) {
|
|
39433
|
+
if (pendingProtocolParts.length > 0) {
|
|
39434
|
+
outputParts.push(...takePendingProtocolParts(), part);
|
|
39435
|
+
} else {
|
|
39436
|
+
outputParts.push({ ...part, text });
|
|
39437
|
+
}
|
|
39438
|
+
continue;
|
|
39439
|
+
}
|
|
39440
|
+
pendingProtocolParts.push(...outputParts.splice(0), part);
|
|
39132
39441
|
protocolTextWasSuppressed ||= part.text.length > 0;
|
|
39133
|
-
|
|
39134
|
-
|
|
39135
|
-
});
|
|
39442
|
+
}
|
|
39443
|
+
content.parts = outputParts;
|
|
39136
39444
|
if (candidate?.finishReason) {
|
|
39137
|
-
|
|
39138
|
-
if (
|
|
39445
|
+
protocolTagDetector.finish();
|
|
39446
|
+
if (protocolTagDetector.leaked) {
|
|
39447
|
+
pendingProtocolParts = [];
|
|
39448
|
+
} else {
|
|
39449
|
+
content.parts.push(...takePendingProtocolParts());
|
|
39450
|
+
}
|
|
39139
39451
|
}
|
|
39140
39452
|
content.parts = normalizeModelToolCallIds(
|
|
39141
39453
|
content.parts,
|
|
@@ -39208,13 +39520,33 @@ This error was probably caused by cyclic schema references in one of the followi
|
|
|
39208
39520
|
}
|
|
39209
39521
|
}
|
|
39210
39522
|
}
|
|
39211
|
-
if (!protocolTextWasSuppressed || !protocolTagDetector.blockingOutput) {
|
|
39523
|
+
if (!chunk.candidates?.length || preparations.length > 0 || !protocolTextWasSuppressed || !protocolTagDetector.blockingOutput) {
|
|
39212
39524
|
yield chunk;
|
|
39213
39525
|
}
|
|
39214
39526
|
}
|
|
39215
39527
|
} catch (e) {
|
|
39216
39528
|
streamError = e;
|
|
39217
39529
|
}
|
|
39530
|
+
if (streamError === null && pendingProtocolParts.length > 0 && (hasToolCall || pendingProtocolParts.some((part) => part.functionCall !== void 0))) {
|
|
39531
|
+
protocolTagDetector.finish();
|
|
39532
|
+
if (protocolTagDetector.leaked) {
|
|
39533
|
+
pendingProtocolParts = [];
|
|
39534
|
+
} else {
|
|
39535
|
+
const parts = normalizeModelToolCallIds(
|
|
39536
|
+
takePendingProtocolParts(),
|
|
39537
|
+
usedToolCallIds,
|
|
39538
|
+
rawToolCallIdsInCurrentTurn,
|
|
39539
|
+
reservedToolCallIds
|
|
39540
|
+
);
|
|
39541
|
+
const chunk = {
|
|
39542
|
+
candidates: [{ content: { role: "model", parts } }]
|
|
39543
|
+
};
|
|
39544
|
+
syncFunctionCallsField(chunk, parts);
|
|
39545
|
+
hasToolCall ||= parts.some((part) => part.functionCall);
|
|
39546
|
+
allModelParts.push(...parts);
|
|
39547
|
+
yield chunk;
|
|
39548
|
+
}
|
|
39549
|
+
}
|
|
39218
39550
|
let thoughtContentPart;
|
|
39219
39551
|
const thoughtText = allModelParts.filter((part) => part.thought).map((part) => part.text).join("").trim();
|
|
39220
39552
|
if (thoughtText !== "") {
|
|
@@ -39283,7 +39615,7 @@ This error was probably caused by cyclic schema references in one of the followi
|
|
|
39283
39615
|
);
|
|
39284
39616
|
}
|
|
39285
39617
|
}
|
|
39286
|
-
if (streamError === null && protocolTagDetector.leaked) {
|
|
39618
|
+
if (streamError === null && protocolTagDetector.leaked && !hasToolCall) {
|
|
39287
39619
|
throw new InvalidStreamError(
|
|
39288
39620
|
"Model response started with leaked protocol tags.",
|
|
39289
39621
|
"PROTOCOL_TAG_LEAK"
|
|
@@ -39364,6 +39696,49 @@ This error was probably caused by cyclic schema references in one of the followi
|
|
|
39364
39696
|
};
|
|
39365
39697
|
}
|
|
39366
39698
|
}
|
|
39699
|
+
/**
|
|
39700
|
+
* Prepend already-delivered text to the trailing model turn.
|
|
39701
|
+
*
|
|
39702
|
+
* Used by the transport-continuation path (issue #7832): after a socket cut
|
|
39703
|
+
* mid-response, the caller has seen text that `processStreamResponse`
|
|
39704
|
+
* deliberately did not persist, and the continuation attempt's own turn
|
|
39705
|
+
* carries only the resumed remainder. Without this, durable history would
|
|
39706
|
+
* hold an answer that starts mid-sentence — visibly wrong on `/compress`,
|
|
39707
|
+
* `--resume`, and every later turn's context.
|
|
39708
|
+
*
|
|
39709
|
+
* The delivered text is merged into the turn's first plain-text part (kept
|
|
39710
|
+
* after any leading thought part, matching the
|
|
39711
|
+
* `[thoughtPart?, ...text]` shape `processStreamResponse` produces), or
|
|
39712
|
+
* inserted as a new part when the continuation returned no text of its own.
|
|
39713
|
+
* Overlap is deduped by the same helper the output-recovery merge uses, so a
|
|
39714
|
+
* model that replays part of its previous tail does not double it.
|
|
39715
|
+
*/
|
|
39716
|
+
prependTextToLastModelTurn(deliveredText) {
|
|
39717
|
+
if (deliveredText.length === 0) return;
|
|
39718
|
+
const lastEntry = this.history.at(-1);
|
|
39719
|
+
if (lastEntry?.role !== "model") {
|
|
39720
|
+
debugLogger22.warn(
|
|
39721
|
+
"[TRANSPORT_CONTINUATION] Trailing entry is not a model turn; dropping the delivered-text merge.",
|
|
39722
|
+
{ role: lastEntry?.role ?? "undefined" }
|
|
39723
|
+
);
|
|
39724
|
+
return;
|
|
39725
|
+
}
|
|
39726
|
+
const parts = [...lastEntry.parts ?? []];
|
|
39727
|
+
const textIndex = parts.findIndex(isPlainTextPart);
|
|
39728
|
+
if (textIndex < 0) {
|
|
39729
|
+
const insertAt = parts.findIndex((part) => !part.thought);
|
|
39730
|
+
parts.splice(insertAt < 0 ? parts.length : insertAt, 0, {
|
|
39731
|
+
text: deliveredText
|
|
39732
|
+
});
|
|
39733
|
+
} else {
|
|
39734
|
+
const continuationPart = parts[textIndex];
|
|
39735
|
+
parts[textIndex] = {
|
|
39736
|
+
...continuationPart,
|
|
39737
|
+
text: deliveredText + getRecoveryContinuationSuffix(deliveredText, continuationPart.text)
|
|
39738
|
+
};
|
|
39739
|
+
}
|
|
39740
|
+
lastEntry.parts = parts;
|
|
39741
|
+
}
|
|
39367
39742
|
/**
|
|
39368
39743
|
* Merge `pairCount` trailing (user_recovery, model_continuation) pairs back
|
|
39369
39744
|
* into the model turn that precedes them. Used after the output-token
|
|
@@ -74245,16 +74620,6 @@ __name(toReadTextFileResponse, "toReadTextFileResponse");
|
|
|
74245
74620
|
// packages/core/src/tools/priorReadEnforcement.ts
|
|
74246
74621
|
init_esbuild_shims();
|
|
74247
74622
|
import * as fs26 from "node:fs";
|
|
74248
|
-
var StructuredToolError = class extends Error {
|
|
74249
|
-
constructor(message, errorType) {
|
|
74250
|
-
super(message);
|
|
74251
|
-
this.errorType = errorType;
|
|
74252
|
-
}
|
|
74253
|
-
static {
|
|
74254
|
-
__name(this, "StructuredToolError");
|
|
74255
|
-
}
|
|
74256
|
-
name = "StructuredToolError";
|
|
74257
|
-
};
|
|
74258
74623
|
async function checkPriorRead(cache, filePath, verb, options2 = {}) {
|
|
74259
74624
|
let stats;
|
|
74260
74625
|
try {
|
|
@@ -74780,7 +75145,7 @@ var WriteFileTool = class _WriteFileTool extends BaseDeclarativeTool {
|
|
|
74780
75145
|
super(
|
|
74781
75146
|
_WriteFileTool.Name,
|
|
74782
75147
|
ToolDisplayNames.WRITE_FILE,
|
|
74783
|
-
`Writes content to a specified file in the local filesystem. The file_path argument MUST be an absolute path. Always construct it by combining the project root with the file's relative path (e.g. project root '/path/to/project/' + relative 'foo/bar.txt' = '/path/to/project/foo/bar.txt'). If the user provides a relative path, resolve it against the project root first.
|
|
75148
|
+
`Writes content to a specified file in the local filesystem. A request to create or generate a file does not establish that the target path is new. Unless the target's absence or current text contents have already been established in this session, you MUST use the ${ToolNames.READ_FILE} tool first; if the file does not exist, then create it. With prior-read enforcement enabled, blind overwrites are rejected. The file_path argument MUST be an absolute path. Always construct it by combining the project root with the file's relative path (e.g. project root '/path/to/project/' + relative 'foo/bar.txt' = '/path/to/project/foo/bar.txt'). If the user provides a relative path, resolve it against the project root first.
|
|
74784
75149
|
|
|
74785
75150
|
The user has the ability to modify \`content\`. If modified, this will be stated in the response.`,
|
|
74786
75151
|
"edit" /* Edit */,
|
|
@@ -84989,7 +85354,7 @@ async function runManagedRememberByAgent(params) {
|
|
|
84989
85354
|
wrapUserContent: true
|
|
84990
85355
|
}),
|
|
84991
85356
|
systemPrompt: buildRememberSystemPrompt(memoryPrompt),
|
|
84992
|
-
maxTurns: 6,
|
|
85357
|
+
maxTurns: params.config.getMemoryAgentMaxTurns() ?? 6,
|
|
84993
85358
|
maxTimeMinutes: params.config.getMemoryAgentTimeoutMinutes() ?? 5,
|
|
84994
85359
|
extraHistory: params.contextMode === "clean" ? [] : void 0,
|
|
84995
85360
|
preserveEmptyExtraHistory: params.contextMode === "clean",
|
|
@@ -85235,7 +85600,7 @@ async function planManagedAutoMemoryDreamByAgent(config, projectRoot, abortSigna
|
|
|
85235
85600
|
config: scopedConfig,
|
|
85236
85601
|
taskPrompt: buildConsolidationTaskPrompt(memoryRoot, transcriptDir),
|
|
85237
85602
|
systemPrompt: DREAM_AGENT_SYSTEM_PROMPT,
|
|
85238
|
-
maxTurns: MAX_TURNS,
|
|
85603
|
+
maxTurns: config.getMemoryAgentMaxTurns() ?? MAX_TURNS,
|
|
85239
85604
|
maxTimeMinutes: config.getMemoryAgentTimeoutMinutes() ?? MAX_TIME_MINUTES,
|
|
85240
85605
|
tools: [
|
|
85241
85606
|
ToolNames.READ_FILE,
|
|
@@ -85616,7 +85981,7 @@ async function runSkillReviewByAgent(params) {
|
|
|
85616
85981
|
config: scopedConfig,
|
|
85617
85982
|
taskPrompt: await buildTaskPrompt(params.projectRoot),
|
|
85618
85983
|
systemPrompt: SKILL_REVIEW_SYSTEM_PROMPT,
|
|
85619
|
-
maxTurns: params.maxTurns ?? DEFAULT_AUTO_SKILL_MAX_TURNS,
|
|
85984
|
+
maxTurns: params.maxTurns ?? params.config.getMemoryAgentMaxTurns() ?? DEFAULT_AUTO_SKILL_MAX_TURNS,
|
|
85620
85985
|
maxTimeMinutes: params.timeoutMs !== void 0 ? params.timeoutMs / 6e4 : params.config.getMemoryAgentTimeoutMinutes() ?? DEFAULT_AUTO_SKILL_TIMEOUT_MS / 6e4,
|
|
85621
85986
|
tools: [
|
|
85622
85987
|
ToolNames.READ_FILE,
|
|
@@ -130272,18 +130637,6 @@ function extractTextFromPartListUnion(c) {
|
|
|
130272
130637
|
return "";
|
|
130273
130638
|
}
|
|
130274
130639
|
__name(extractTextFromPartListUnion, "extractTextFromPartListUnion");
|
|
130275
|
-
var TOOL_FAILURE_KIND_ATTRIBUTE = "tool.failure_kind";
|
|
130276
|
-
var TOOL_FAILURE_KIND_PRE_HOOK_BLOCKED = "pre_hook_blocked";
|
|
130277
|
-
var TOOL_FAILURE_KIND_INVOCATION_GUARD_DENIED = "invocation_guard_denied";
|
|
130278
|
-
var TOOL_FAILURE_KIND_POST_HOOK_STOPPED = "post_hook_stopped";
|
|
130279
|
-
var TOOL_FAILURE_KIND_TOOL_ERROR = "tool_error";
|
|
130280
|
-
var TOOL_FAILURE_KIND_TOOL_EXCEPTION = "tool_exception";
|
|
130281
|
-
var TOOL_FAILURE_KIND_CANCELLED = "cancelled";
|
|
130282
|
-
var TOOL_FAILURE_KIND_PERMISSION_DENIED = "permission_denied";
|
|
130283
|
-
var TOOL_FAILURE_KIND_PERMISSION_HOOK_DENIED = "permission_hook_denied";
|
|
130284
|
-
var TOOL_FAILURE_KIND_PLAN_MODE_BLOCKED = "plan_mode_blocked";
|
|
130285
|
-
var TOOL_FAILURE_KIND_NON_INTERACTIVE_DENIED = "non_interactive_denied";
|
|
130286
|
-
var TOOL_FAILURE_KIND_BACKGROUND_AGENT_DENIED = "background_agent_denied";
|
|
130287
130640
|
var TOOL_SPAN_STATUS_PRE_HOOK_BLOCKED = "Tool execution blocked by hook";
|
|
130288
130641
|
var TOOL_SPAN_STATUS_INVOCATION_GUARD_DENIED = "Tool execution blocked by host policy";
|
|
130289
130642
|
var TOOL_SPAN_STATUS_POST_HOOK_STOPPED = "Tool execution stopped by hook";
|
|
@@ -130295,8 +130648,9 @@ var TOOL_SPAN_STATUS_BACKGROUND_AGENT_DENIED = "Background agent cannot prompt f
|
|
|
130295
130648
|
var TOOL_SPAN_STATUS_TOOL_ERROR = "Tool execution failed";
|
|
130296
130649
|
var TOOL_SPAN_STATUS_TOOL_EXCEPTION = "Tool execution failed with exception";
|
|
130297
130650
|
var TOOL_SPAN_STATUS_TOOL_CANCELLED = "Tool execution cancelled by user";
|
|
130298
|
-
var TOOL_FAILURE_KIND_TIMEOUT = "timeout";
|
|
130299
130651
|
var TOOL_SPAN_STATUS_TOOL_TIMEOUT = "Tool execution timed out";
|
|
130652
|
+
var TOOL_CANCELLED_BEFORE_COMPLETION_MESSAGE = "User cancelled tool execution.";
|
|
130653
|
+
var TOOL_CANCELLED_AFTER_COMPLETION_MESSAGE = "The tool had already completed; its output was discarded.";
|
|
130300
130654
|
function createToolTimeoutResult(timeoutMs) {
|
|
130301
130655
|
const display = timeoutMs >= 1e3 ? `${Math.round(timeoutMs / 1e3)}s` : `${timeoutMs}ms`;
|
|
130302
130656
|
const message = `Tool execution timed out after ${display}. The tool may be stuck or operating on too large a scope.`;
|
|
@@ -130574,7 +130928,7 @@ __name(toParts2, "toParts");
|
|
|
130574
130928
|
var VALIDATION_RETRY_LOOP_THRESHOLD = 3;
|
|
130575
130929
|
var RETRY_LOOP_STOP_DIRECTIVE = "\n\n\u26A0 RETRY LOOP DETECTED: This tool call has failed validation multiple times with the same error. STOP retrying the same approach. Re-examine the tool schema and parameter requirements, then try a fundamentally different approach. If you cannot resolve the validation error, explain the issue to the user instead of retrying.";
|
|
130576
130930
|
var TRUNCATION_RETRY_LOOP_DIRECTIVE = "\n\n\u26A0 RETRY LOOP DETECTED: The same truncated file write has been rejected multiple times. STOP resending the same large content. Either split it into smaller write_file + incremental edit calls, or explain to the user that the content is too large to write safely in one call.";
|
|
130577
|
-
var createErrorResponse = /* @__PURE__ */ __name((request, error, errorType, artifacts, resultDisplay) => ({
|
|
130931
|
+
var createErrorResponse = /* @__PURE__ */ __name((request, error, errorType, executionStatus, artifacts, resultDisplay) => ({
|
|
130578
130932
|
callId: request.callId,
|
|
130579
130933
|
error,
|
|
130580
130934
|
responseParts: [
|
|
@@ -130588,10 +130942,11 @@ var createErrorResponse = /* @__PURE__ */ __name((request, error, errorType, art
|
|
|
130588
130942
|
],
|
|
130589
130943
|
resultDisplay: resultDisplay ?? error.message,
|
|
130590
130944
|
errorType,
|
|
130945
|
+
executionStatus,
|
|
130591
130946
|
contentLength: error.message.length,
|
|
130592
130947
|
...artifacts && artifacts.length > 0 ? { artifacts } : {}
|
|
130593
130948
|
}), "createErrorResponse");
|
|
130594
|
-
var createCancelledResponse = /* @__PURE__ */ __name((request, reason, artifacts) => {
|
|
130949
|
+
var createCancelledResponse = /* @__PURE__ */ __name((request, reason, executionStatus, artifacts, persistedOutputFiles, visionBridgeNotice) => {
|
|
130595
130950
|
const errorMessage = `[Operation Cancelled] Reason: ${reason}`;
|
|
130596
130951
|
return {
|
|
130597
130952
|
callId: request.callId,
|
|
@@ -130607,8 +130962,11 @@ var createCancelledResponse = /* @__PURE__ */ __name((request, reason, artifacts
|
|
|
130607
130962
|
resultDisplay: void 0,
|
|
130608
130963
|
error: void 0,
|
|
130609
130964
|
errorType: void 0,
|
|
130965
|
+
executionStatus,
|
|
130610
130966
|
contentLength: errorMessage.length,
|
|
130611
|
-
...artifacts && artifacts.length > 0 ? { artifacts } : {}
|
|
130967
|
+
...artifacts && artifacts.length > 0 ? { artifacts } : {},
|
|
130968
|
+
...persistedOutputFiles !== void 0 ? { persistedOutputFiles } : {},
|
|
130969
|
+
...visionBridgeNotice !== void 0 ? { visionBridgeNotice } : {}
|
|
130612
130970
|
};
|
|
130613
130971
|
}, "createCancelledResponse");
|
|
130614
130972
|
function isToolCallResponseInfo(value) {
|
|
@@ -130625,6 +130983,7 @@ function serializeToolResponse(response) {
|
|
|
130625
130983
|
result_display: response.resultDisplay,
|
|
130626
130984
|
error: response.error?.message,
|
|
130627
130985
|
error_type: response.errorType,
|
|
130986
|
+
execution_status: response.executionStatus,
|
|
130628
130987
|
content_length: response.contentLength,
|
|
130629
130988
|
...response.visionBridgeNotice !== void 0 ? { vision_bridge_notice: response.visionBridgeNotice } : {}
|
|
130630
130989
|
};
|
|
@@ -130757,15 +131116,19 @@ function withPostToolBatchStop(completedCalls, stopReason) {
|
|
|
130757
131116
|
}
|
|
130758
131117
|
const calls = [...completedCalls];
|
|
130759
131118
|
const lastCall = calls[calls.length - 1];
|
|
131119
|
+
const executionStatus = lastCall.response.executionStatus;
|
|
131120
|
+
const { executionStatus: _es, ...baseResponse } = createErrorResponse(
|
|
131121
|
+
lastCall.request,
|
|
131122
|
+
new Error(stopReason),
|
|
131123
|
+
"execution_denied" /* EXECUTION_DENIED */,
|
|
131124
|
+
executionStatus ?? "not_started"
|
|
131125
|
+
);
|
|
131126
|
+
const response = executionStatus !== void 0 ? { ...baseResponse, executionStatus } : baseResponse;
|
|
130760
131127
|
calls[calls.length - 1] = {
|
|
130761
131128
|
status: "error",
|
|
130762
131129
|
request: lastCall.request,
|
|
130763
131130
|
tool: lastCall.tool,
|
|
130764
|
-
response
|
|
130765
|
-
lastCall.request,
|
|
130766
|
-
new Error(stopReason),
|
|
130767
|
-
"execution_denied" /* EXECUTION_DENIED */
|
|
130768
|
-
),
|
|
131131
|
+
response,
|
|
130769
131132
|
durationMs: lastCall.durationMs,
|
|
130770
131133
|
outcome: void 0
|
|
130771
131134
|
};
|
|
@@ -130827,6 +131190,9 @@ var CoreToolScheduler = class {
|
|
|
130827
131190
|
chatRecordingService;
|
|
130828
131191
|
onToolResultFullTurnModel;
|
|
130829
131192
|
isFinalizingToolCalls = false;
|
|
131193
|
+
postToolBatchEnabledForBatch = false;
|
|
131194
|
+
postToolBatchSpanCallId;
|
|
131195
|
+
postToolBatchConfigWarned = false;
|
|
130830
131196
|
isScheduling = false;
|
|
130831
131197
|
validationRetryCounts = /* @__PURE__ */ new Map();
|
|
130832
131198
|
autoModeFallbackCallIds = /* @__PURE__ */ new Set();
|
|
@@ -130909,7 +131275,7 @@ var CoreToolScheduler = class {
|
|
|
130909
131275
|
...notices.length > 0 ? { visionBridgeNotice: notices.join("\n") } : {}
|
|
130910
131276
|
};
|
|
130911
131277
|
}
|
|
130912
|
-
setStatusInternal(targetCallId, newStatus, auxiliaryData) {
|
|
131278
|
+
setStatusInternal(targetCallId, newStatus, auxiliaryData, executionStatus) {
|
|
130913
131279
|
this.toolCalls = this.toolCalls.map((currentCall) => {
|
|
130914
131280
|
if (currentCall.request.callId !== targetCallId || currentCall.status === "success" || currentCall.status === "error" || currentCall.status === "cancelled") {
|
|
130915
131281
|
return currentCall;
|
|
@@ -130990,8 +131356,11 @@ var CoreToolScheduler = class {
|
|
|
130990
131356
|
}
|
|
130991
131357
|
const preservedResultDisplay = this.compactResultDisplayForInteractiveHistory(resultDisplay);
|
|
130992
131358
|
const errorMessage = `[Operation Cancelled] Reason: ${auxiliaryData}`;
|
|
130993
|
-
const response = isToolCallResponseInfo(
|
|
131359
|
+
const response = isToolCallResponseInfo(
|
|
131360
|
+
auxiliaryData
|
|
131361
|
+
) ? {
|
|
130994
131362
|
...auxiliaryData,
|
|
131363
|
+
executionStatus: auxiliaryData.executionStatus ?? executionStatus ?? "not_started",
|
|
130995
131364
|
resultDisplay: auxiliaryData.resultDisplay ?? preservedResultDisplay
|
|
130996
131365
|
} : {
|
|
130997
131366
|
callId: currentCall.request.callId,
|
|
@@ -131009,6 +131378,7 @@ var CoreToolScheduler = class {
|
|
|
131009
131378
|
resultDisplay: preservedResultDisplay,
|
|
131010
131379
|
error: void 0,
|
|
131011
131380
|
errorType: void 0,
|
|
131381
|
+
executionStatus: executionStatus ?? "not_started",
|
|
131012
131382
|
contentLength: errorMessage.length
|
|
131013
131383
|
};
|
|
131014
131384
|
return {
|
|
@@ -131054,8 +131424,10 @@ var CoreToolScheduler = class {
|
|
|
131054
131424
|
});
|
|
131055
131425
|
}
|
|
131056
131426
|
setArgsInternal(targetCallId, args) {
|
|
131427
|
+
let invocationError;
|
|
131428
|
+
let argsUpdated = false;
|
|
131057
131429
|
this.toolCalls = this.toolCalls.map((call) => {
|
|
131058
|
-
if (call.request.callId !== targetCallId || call.status === "error") {
|
|
131430
|
+
if (call.request.callId !== targetCallId || call.status === "success" || call.status === "error" || call.status === "cancelled") {
|
|
131059
131431
|
return call;
|
|
131060
131432
|
}
|
|
131061
131433
|
const invocationOrError = runInRequestGoalContext(
|
|
@@ -131068,10 +131440,12 @@ var CoreToolScheduler = class {
|
|
|
131068
131440
|
)
|
|
131069
131441
|
);
|
|
131070
131442
|
if (invocationOrError instanceof Error) {
|
|
131443
|
+
invocationError = invocationOrError;
|
|
131071
131444
|
const response = createErrorResponse(
|
|
131072
131445
|
call.request,
|
|
131073
131446
|
invocationOrError,
|
|
131074
|
-
"invalid_tool_params" /* INVALID_TOOL_PARAMS
|
|
131447
|
+
"invalid_tool_params" /* INVALID_TOOL_PARAMS */,
|
|
131448
|
+
"not_started"
|
|
131075
131449
|
);
|
|
131076
131450
|
return {
|
|
131077
131451
|
request: { ...call.request, args },
|
|
@@ -131080,18 +131454,54 @@ var CoreToolScheduler = class {
|
|
|
131080
131454
|
response
|
|
131081
131455
|
};
|
|
131082
131456
|
}
|
|
131457
|
+
argsUpdated = true;
|
|
131083
131458
|
return {
|
|
131084
131459
|
...call,
|
|
131085
131460
|
request: { ...call.request, args },
|
|
131086
131461
|
invocation: invocationOrError
|
|
131087
131462
|
};
|
|
131088
131463
|
});
|
|
131464
|
+
if (invocationError) {
|
|
131465
|
+
this.finalizeBlockedSpan(targetCallId, "error", "system");
|
|
131466
|
+
const toolSpan = this.toolSpans.get(targetCallId);
|
|
131467
|
+
if (toolSpan) {
|
|
131468
|
+
setToolSpanFailure(
|
|
131469
|
+
toolSpan,
|
|
131470
|
+
TOOL_FAILURE_KIND_TOOL_EXCEPTION,
|
|
131471
|
+
invocationError.message
|
|
131472
|
+
);
|
|
131473
|
+
}
|
|
131474
|
+
this.finalizeToolSpan(targetCallId);
|
|
131475
|
+
this.notifyToolCallsUpdate();
|
|
131476
|
+
void this.checkAndNotifyCompletion().catch((error) => {
|
|
131477
|
+
debugLogger122.warn(
|
|
131478
|
+
`setArgsInternal completion notification failed: ${error instanceof Error ? error.message : String(error)}`
|
|
131479
|
+
);
|
|
131480
|
+
});
|
|
131481
|
+
return false;
|
|
131482
|
+
}
|
|
131483
|
+
return argsUpdated;
|
|
131089
131484
|
}
|
|
131090
131485
|
isRunning() {
|
|
131091
131486
|
return this.isFinalizingToolCalls || this.toolCalls.some(
|
|
131092
131487
|
(call) => call.status === "executing" || call.status === "awaiting_approval"
|
|
131093
131488
|
);
|
|
131094
131489
|
}
|
|
131490
|
+
cancelPreExecutionIfAborted(callId, signal, toolSpan = this.toolSpans.get(callId)) {
|
|
131491
|
+
if (!signal.aborted) return false;
|
|
131492
|
+
this.setStatusInternal(
|
|
131493
|
+
callId,
|
|
131494
|
+
"cancelled",
|
|
131495
|
+
"Tool call cancelled by user.",
|
|
131496
|
+
"not_started"
|
|
131497
|
+
);
|
|
131498
|
+
this.finalizeBlockedSpan(callId, "aborted", "system");
|
|
131499
|
+
if (toolSpan) {
|
|
131500
|
+
setToolSpanCancelled(toolSpan);
|
|
131501
|
+
}
|
|
131502
|
+
this.finalizeToolSpan(callId);
|
|
131503
|
+
return true;
|
|
131504
|
+
}
|
|
131095
131505
|
/**
|
|
131096
131506
|
* End the tool span for `callId` (if any) and remove it from the map.
|
|
131097
131507
|
* Centralizes terminal-state cleanup so every cancel/error/success path
|
|
@@ -131101,10 +131511,12 @@ var CoreToolScheduler = class {
|
|
|
131101
131511
|
* No `metadata` parameter: every caller pre-sets span status via
|
|
131102
131512
|
* `setToolSpan{Failure,Cancelled,Ok}` before this call (#4321 review).
|
|
131103
131513
|
*/
|
|
131104
|
-
finalizeToolSpan(callId) {
|
|
131514
|
+
finalizeToolSpan(callId, force = false) {
|
|
131105
131515
|
this.bouncedAwaitingApproval.delete(callId);
|
|
131106
131516
|
this.bouncedToolUseId.delete(callId);
|
|
131517
|
+
this.autoModeFallbackCallIds.delete(callId);
|
|
131107
131518
|
this.runtimeContentGeneratorViews.delete(callId);
|
|
131519
|
+
if (callId === this.postToolBatchSpanCallId && !force) return;
|
|
131108
131520
|
const span = this.toolSpans.get(callId);
|
|
131109
131521
|
if (!span) return;
|
|
131110
131522
|
this.toolSpans.delete(callId);
|
|
@@ -131181,7 +131593,8 @@ var CoreToolScheduler = class {
|
|
|
131181
131593
|
this.setStatusInternal(
|
|
131182
131594
|
callId,
|
|
131183
131595
|
"cancelled",
|
|
131184
|
-
"Tool call cancelled by user."
|
|
131596
|
+
"Tool call cancelled by user.",
|
|
131597
|
+
"not_started"
|
|
131185
131598
|
);
|
|
131186
131599
|
if (this.blockedSpans.has(callId)) {
|
|
131187
131600
|
this.finalizeBlockedSpan(callId, "aborted", "system");
|
|
@@ -131189,7 +131602,7 @@ var CoreToolScheduler = class {
|
|
|
131189
131602
|
const span = this.toolSpans.get(callId);
|
|
131190
131603
|
if (span) {
|
|
131191
131604
|
setToolSpanCancelled(span);
|
|
131192
|
-
this.finalizeToolSpan(callId);
|
|
131605
|
+
this.finalizeToolSpan(callId, true);
|
|
131193
131606
|
}
|
|
131194
131607
|
this.callIdToPostToolBatchSignal.delete(callId);
|
|
131195
131608
|
this.autoModeFallbackCallIds.delete(callId);
|
|
@@ -131389,6 +131802,13 @@ var CoreToolScheduler = class {
|
|
|
131389
131802
|
}
|
|
131390
131803
|
return this._schedule(request, signal, runtimeView);
|
|
131391
131804
|
}
|
|
131805
|
+
drainRequestQueueIfIdle() {
|
|
131806
|
+
if (this.requestQueue.length === 0 || this.isScheduling || this.isRunning()) {
|
|
131807
|
+
return;
|
|
131808
|
+
}
|
|
131809
|
+
const next = this.requestQueue.shift();
|
|
131810
|
+
this._schedule(next.request, next.signal, next.runtimeView).then(next.resolve).catch(next.reject);
|
|
131811
|
+
}
|
|
131392
131812
|
/**
|
|
131393
131813
|
* Removes all validation retry counters for the given tool. Keys are
|
|
131394
131814
|
* "<toolName>:<errorMessage>", so a plain `Map.delete(toolName)` would not
|
|
@@ -131480,147 +131900,220 @@ var CoreToolScheduler = class {
|
|
|
131480
131900
|
return count;
|
|
131481
131901
|
}, "recordBatchRetryableToolError");
|
|
131482
131902
|
for (const [requestIndex, reqInfo] of requestsToProcess.entries()) {
|
|
131483
|
-
|
|
131484
|
-
|
|
131485
|
-
|
|
131486
|
-
|
|
131487
|
-
response: createErrorResponse(
|
|
131488
|
-
reqInfo,
|
|
131489
|
-
new Error(PLAN_MODE_ENTRY_SIBLING_SKIP_MESSAGE),
|
|
131490
|
-
"execution_denied" /* EXECUTION_DENIED */
|
|
131491
|
-
),
|
|
131492
|
-
durationMs: 0
|
|
131493
|
-
});
|
|
131494
|
-
continue;
|
|
131495
|
-
}
|
|
131496
|
-
const canonicalName = canonicalToolName2(reqInfo.name);
|
|
131497
|
-
const pm = this.config.getPermissionManager?.();
|
|
131498
|
-
if (pm && !await pm.isToolEnabled(canonicalName)) {
|
|
131499
|
-
const matchingRule = pm.findMatchingDenyRule({
|
|
131500
|
-
toolName: canonicalName
|
|
131501
|
-
});
|
|
131502
|
-
const ruleInfo = matchingRule ? ` Matching deny rule: "${matchingRule}".` : "";
|
|
131503
|
-
const permissionErrorMessage = `Qwen Code requires permission to use "${reqInfo.name}", but that permission was declined.${ruleInfo}`;
|
|
131903
|
+
let resolvedTool;
|
|
131904
|
+
let resolvedInvocation;
|
|
131905
|
+
const recordPrevalidationCancellation = /* @__PURE__ */ __name(() => {
|
|
131906
|
+
if (!signal.aborted) return false;
|
|
131504
131907
|
newToolCalls.push({
|
|
131505
|
-
status: "
|
|
131908
|
+
status: "cancelled",
|
|
131506
131909
|
request: reqInfo,
|
|
131507
|
-
response:
|
|
131910
|
+
response: createCancelledResponse(
|
|
131508
131911
|
reqInfo,
|
|
131509
|
-
|
|
131510
|
-
"
|
|
131912
|
+
"Tool call cancelled before execution.",
|
|
131913
|
+
"not_started"
|
|
131511
131914
|
),
|
|
131915
|
+
...resolvedTool ? { tool: resolvedTool } : {},
|
|
131916
|
+
...resolvedInvocation ? { invocation: resolvedInvocation } : {},
|
|
131512
131917
|
durationMs: 0
|
|
131513
131918
|
});
|
|
131514
|
-
|
|
131515
|
-
}
|
|
131516
|
-
|
|
131517
|
-
|
|
131518
|
-
if (
|
|
131519
|
-
|
|
131520
|
-
|
|
131521
|
-
|
|
131522
|
-
|
|
131523
|
-
|
|
131524
|
-
|
|
131525
|
-
|
|
131526
|
-
|
|
131527
|
-
|
|
131528
|
-
|
|
131529
|
-
|
|
131530
|
-
|
|
131531
|
-
|
|
131532
|
-
|
|
131533
|
-
|
|
131534
|
-
|
|
131535
|
-
|
|
131919
|
+
return true;
|
|
131920
|
+
}, "recordPrevalidationCancellation");
|
|
131921
|
+
try {
|
|
131922
|
+
if (recordPrevalidationCancellation()) continue;
|
|
131923
|
+
if (planModeEntryBoundaryIndex !== void 0 && requestIndex !== planModeEntryBoundaryIndex) {
|
|
131924
|
+
newToolCalls.push({
|
|
131925
|
+
status: "error",
|
|
131926
|
+
request: reqInfo,
|
|
131927
|
+
response: createErrorResponse(
|
|
131928
|
+
reqInfo,
|
|
131929
|
+
new Error(PLAN_MODE_ENTRY_SIBLING_SKIP_MESSAGE),
|
|
131930
|
+
"execution_denied" /* EXECUTION_DENIED */,
|
|
131931
|
+
"not_started"
|
|
131932
|
+
),
|
|
131933
|
+
durationMs: 0
|
|
131934
|
+
});
|
|
131935
|
+
continue;
|
|
131936
|
+
}
|
|
131937
|
+
const canonicalName = canonicalToolName2(reqInfo.name);
|
|
131938
|
+
const pm = this.config.getPermissionManager?.();
|
|
131939
|
+
const permissionEnabled = pm ? await pm.isToolEnabled(canonicalName) : true;
|
|
131940
|
+
if (recordPrevalidationCancellation()) continue;
|
|
131941
|
+
if (pm && !permissionEnabled) {
|
|
131942
|
+
const matchingRule = pm.findMatchingDenyRule({
|
|
131943
|
+
toolName: canonicalName
|
|
131944
|
+
});
|
|
131945
|
+
const ruleInfo = matchingRule ? ` Matching deny rule: "${matchingRule}".` : "";
|
|
131946
|
+
const permissionErrorMessage = `Qwen Code requires permission to use "${reqInfo.name}", but that permission was declined.${ruleInfo}`;
|
|
131947
|
+
newToolCalls.push({
|
|
131948
|
+
status: "error",
|
|
131949
|
+
request: reqInfo,
|
|
131950
|
+
response: createErrorResponse(
|
|
131951
|
+
reqInfo,
|
|
131952
|
+
new Error(permissionErrorMessage),
|
|
131953
|
+
"execution_denied" /* EXECUTION_DENIED */,
|
|
131954
|
+
"not_started"
|
|
131955
|
+
),
|
|
131956
|
+
durationMs: 0
|
|
131957
|
+
});
|
|
131958
|
+
continue;
|
|
131959
|
+
}
|
|
131960
|
+
if (!pm) {
|
|
131961
|
+
const excludeTools = this.config.getPermissionsDeny?.() ?? void 0;
|
|
131962
|
+
if (excludeTools && excludeTools.length > 0) {
|
|
131963
|
+
const normalizedToolName = canonicalName.toLowerCase().trim();
|
|
131964
|
+
const excludedMatch = excludeTools.find(
|
|
131965
|
+
(excludedTool) => excludedTool.toLowerCase().trim() === normalizedToolName
|
|
131966
|
+
);
|
|
131967
|
+
if (excludedMatch) {
|
|
131968
|
+
const permissionErrorMessage = `Qwen Code requires permission to use ${excludedMatch}, but that permission was declined.`;
|
|
131969
|
+
newToolCalls.push({
|
|
131970
|
+
status: "error",
|
|
131971
|
+
request: reqInfo,
|
|
131972
|
+
response: createErrorResponse(
|
|
131973
|
+
reqInfo,
|
|
131974
|
+
new Error(permissionErrorMessage),
|
|
131975
|
+
"execution_denied" /* EXECUTION_DENIED */,
|
|
131976
|
+
"not_started"
|
|
131977
|
+
),
|
|
131978
|
+
durationMs: 0
|
|
131979
|
+
});
|
|
131980
|
+
continue;
|
|
131981
|
+
}
|
|
131536
131982
|
}
|
|
131537
131983
|
}
|
|
131538
|
-
|
|
131539
|
-
const toolInstance = await runInRequestGoalContext(
|
|
131540
|
-
reqInfo,
|
|
131541
|
-
() => this.toolRegistry.ensureTool(canonicalName)
|
|
131542
|
-
);
|
|
131543
|
-
if (!toolInstance) {
|
|
131544
|
-
const errorMessage = await runInRequestGoalContext(
|
|
131984
|
+
const toolInstance = await runInRequestGoalContext(
|
|
131545
131985
|
reqInfo,
|
|
131546
|
-
() => this.
|
|
131986
|
+
() => this.toolRegistry.ensureTool(canonicalName)
|
|
131547
131987
|
);
|
|
131548
|
-
|
|
131549
|
-
|
|
131550
|
-
|
|
131551
|
-
|
|
131988
|
+
resolvedTool = toolInstance;
|
|
131989
|
+
if (recordPrevalidationCancellation()) continue;
|
|
131990
|
+
if (!toolInstance) {
|
|
131991
|
+
const errorMessage = await runInRequestGoalContext(
|
|
131552
131992
|
reqInfo,
|
|
131553
|
-
|
|
131554
|
-
|
|
131555
|
-
)
|
|
131556
|
-
|
|
131557
|
-
|
|
131558
|
-
|
|
131559
|
-
|
|
131560
|
-
|
|
131561
|
-
|
|
131562
|
-
|
|
131563
|
-
|
|
131564
|
-
|
|
131565
|
-
|
|
131566
|
-
|
|
131993
|
+
() => this.getToolNotFoundMessage(reqInfo.name)
|
|
131994
|
+
);
|
|
131995
|
+
if (recordPrevalidationCancellation()) continue;
|
|
131996
|
+
newToolCalls.push({
|
|
131997
|
+
status: "error",
|
|
131998
|
+
request: reqInfo,
|
|
131999
|
+
response: createErrorResponse(
|
|
132000
|
+
reqInfo,
|
|
132001
|
+
new Error(errorMessage),
|
|
132002
|
+
"tool_not_registered" /* TOOL_NOT_REGISTERED */,
|
|
132003
|
+
"not_started"
|
|
132004
|
+
),
|
|
132005
|
+
durationMs: 0
|
|
132006
|
+
});
|
|
132007
|
+
continue;
|
|
132008
|
+
}
|
|
132009
|
+
if (reqInfo.wasOutputTruncated && toolInstance.kind === "edit" /* Edit */) {
|
|
132010
|
+
const count = recordBatchRetryableToolError(
|
|
132011
|
+
reqInfo.name,
|
|
132012
|
+
TRUNCATION_EDIT_REJECTION
|
|
132013
|
+
);
|
|
132014
|
+
const truncationError = new Error(
|
|
132015
|
+
count >= VALIDATION_RETRY_LOOP_THRESHOLD ? `${TRUNCATION_EDIT_REJECTION}${TRUNCATION_RETRY_LOOP_DIRECTIVE}` : TRUNCATION_EDIT_REJECTION
|
|
132016
|
+
);
|
|
132017
|
+
newToolCalls.push({
|
|
132018
|
+
status: "error",
|
|
132019
|
+
request: reqInfo,
|
|
132020
|
+
tool: toolInstance,
|
|
132021
|
+
response: createErrorResponse(
|
|
132022
|
+
reqInfo,
|
|
132023
|
+
truncationError,
|
|
132024
|
+
"output_truncated" /* OUTPUT_TRUNCATED */,
|
|
132025
|
+
"not_started"
|
|
132026
|
+
),
|
|
132027
|
+
durationMs: 0
|
|
132028
|
+
});
|
|
132029
|
+
continue;
|
|
132030
|
+
}
|
|
132031
|
+
const invocationOrError = runInRequestGoalContext(
|
|
132032
|
+
reqInfo,
|
|
132033
|
+
() => this.buildInvocation(
|
|
132034
|
+
toolInstance,
|
|
132035
|
+
reqInfo.args,
|
|
132036
|
+
reqInfo.callId,
|
|
132037
|
+
reqInfo.prompt_id
|
|
132038
|
+
)
|
|
131567
132039
|
);
|
|
132040
|
+
if (recordPrevalidationCancellation()) continue;
|
|
132041
|
+
if (invocationOrError instanceof Error) {
|
|
132042
|
+
const displayError = reqInfo.wasOutputTruncated ? new Error(
|
|
132043
|
+
`${invocationOrError.message} ${TRUNCATION_PARAM_GUIDANCE}`
|
|
132044
|
+
) : invocationOrError;
|
|
132045
|
+
const count = recordBatchRetryableToolError(
|
|
132046
|
+
reqInfo.name,
|
|
132047
|
+
invocationOrError.message
|
|
132048
|
+
);
|
|
132049
|
+
const finalError = count >= VALIDATION_RETRY_LOOP_THRESHOLD ? new Error(
|
|
132050
|
+
`${invocationOrError.message}${RETRY_LOOP_STOP_DIRECTIVE}`
|
|
132051
|
+
) : displayError;
|
|
132052
|
+
newToolCalls.push({
|
|
132053
|
+
status: "error",
|
|
132054
|
+
request: reqInfo,
|
|
132055
|
+
tool: toolInstance,
|
|
132056
|
+
response: createErrorResponse(
|
|
132057
|
+
reqInfo,
|
|
132058
|
+
finalError,
|
|
132059
|
+
"invalid_tool_params" /* INVALID_TOOL_PARAMS */,
|
|
132060
|
+
"not_started"
|
|
132061
|
+
),
|
|
132062
|
+
durationMs: 0
|
|
132063
|
+
});
|
|
132064
|
+
continue;
|
|
132065
|
+
}
|
|
132066
|
+
resolvedInvocation = invocationOrError;
|
|
132067
|
+
this.clearRetryCountsForTool(reqInfo.name);
|
|
131568
132068
|
newToolCalls.push({
|
|
131569
|
-
status: "
|
|
132069
|
+
status: "validating",
|
|
131570
132070
|
request: reqInfo,
|
|
131571
132071
|
tool: toolInstance,
|
|
131572
|
-
|
|
131573
|
-
|
|
131574
|
-
truncationError,
|
|
131575
|
-
"output_truncated" /* OUTPUT_TRUNCATED */
|
|
131576
|
-
),
|
|
131577
|
-
durationMs: 0
|
|
132072
|
+
invocation: invocationOrError,
|
|
132073
|
+
startTime: Date.now()
|
|
131578
132074
|
});
|
|
131579
|
-
|
|
131580
|
-
|
|
131581
|
-
|
|
131582
|
-
reqInfo,
|
|
131583
|
-
() => this.buildInvocation(
|
|
131584
|
-
toolInstance,
|
|
131585
|
-
reqInfo.args,
|
|
131586
|
-
reqInfo.callId,
|
|
131587
|
-
reqInfo.prompt_id
|
|
131588
|
-
)
|
|
131589
|
-
);
|
|
131590
|
-
if (invocationOrError instanceof Error) {
|
|
131591
|
-
const displayError = reqInfo.wasOutputTruncated ? new Error(
|
|
131592
|
-
`${invocationOrError.message} ${TRUNCATION_PARAM_GUIDANCE}`
|
|
131593
|
-
) : invocationOrError;
|
|
131594
|
-
const count = recordBatchRetryableToolError(
|
|
131595
|
-
reqInfo.name,
|
|
131596
|
-
invocationOrError.message
|
|
131597
|
-
);
|
|
131598
|
-
const finalError = count >= VALIDATION_RETRY_LOOP_THRESHOLD ? new Error(
|
|
131599
|
-
`${invocationOrError.message}${RETRY_LOOP_STOP_DIRECTIVE}`
|
|
131600
|
-
) : displayError;
|
|
132075
|
+
} catch (error) {
|
|
132076
|
+
if (recordPrevalidationCancellation()) continue;
|
|
132077
|
+
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
131601
132078
|
newToolCalls.push({
|
|
131602
132079
|
status: "error",
|
|
131603
132080
|
request: reqInfo,
|
|
131604
|
-
tool: toolInstance,
|
|
131605
132081
|
response: createErrorResponse(
|
|
131606
132082
|
reqInfo,
|
|
131607
|
-
|
|
131608
|
-
"
|
|
132083
|
+
normalizedError,
|
|
132084
|
+
error?.errorType ?? "unhandled_exception" /* UNHANDLED_EXCEPTION */,
|
|
132085
|
+
"not_started"
|
|
131609
132086
|
),
|
|
132087
|
+
...resolvedTool ? { tool: resolvedTool } : {},
|
|
131610
132088
|
durationMs: 0
|
|
131611
132089
|
});
|
|
131612
|
-
continue;
|
|
131613
132090
|
}
|
|
131614
|
-
this.clearRetryCountsForTool(reqInfo.name);
|
|
131615
|
-
newToolCalls.push({
|
|
131616
|
-
status: "validating",
|
|
131617
|
-
request: reqInfo,
|
|
131618
|
-
tool: toolInstance,
|
|
131619
|
-
invocation: invocationOrError,
|
|
131620
|
-
startTime: Date.now()
|
|
131621
|
-
});
|
|
131622
132091
|
}
|
|
131623
132092
|
this.toolCalls = this.toolCalls.concat(newToolCalls);
|
|
132093
|
+
for (const toolCall of newToolCalls) {
|
|
132094
|
+
this.callIdToPostToolBatchSignal.set(toolCall.request.callId, signal);
|
|
132095
|
+
}
|
|
132096
|
+
const postToolBatchParentCallId = newToolCalls.findLast(
|
|
132097
|
+
(toolCall) => toolCall.status === "validating"
|
|
132098
|
+
)?.request.callId;
|
|
132099
|
+
this.postToolBatchEnabledForBatch = false;
|
|
132100
|
+
this.postToolBatchSpanCallId = void 0;
|
|
132101
|
+
try {
|
|
132102
|
+
this.postToolBatchEnabledForBatch = !this.config.getDisableAllHooks() && (this.config.hasHooksForEvent?.("PostToolBatch") ?? false);
|
|
132103
|
+
if (this.postToolBatchEnabledForBatch) {
|
|
132104
|
+
this.postToolBatchSpanCallId = postToolBatchParentCallId;
|
|
132105
|
+
}
|
|
132106
|
+
} catch (configError) {
|
|
132107
|
+
this.postToolBatchEnabledForBatch = true;
|
|
132108
|
+
this.postToolBatchSpanCallId = postToolBatchParentCallId;
|
|
132109
|
+
if (!this.postToolBatchConfigWarned) {
|
|
132110
|
+
this.postToolBatchConfigWarned = true;
|
|
132111
|
+
debugLogger122.warn(
|
|
132112
|
+
"PostToolBatch hook detection failed; deferring span as a precaution:",
|
|
132113
|
+
configError
|
|
132114
|
+
);
|
|
132115
|
+
}
|
|
132116
|
+
}
|
|
131624
132117
|
this.notifyToolCallsUpdate();
|
|
131625
132118
|
const batchState = {
|
|
131626
132119
|
signal,
|
|
@@ -131648,16 +132141,8 @@ var CoreToolScheduler = class {
|
|
|
131648
132141
|
this.toolSpans.set(reqInfo.callId, toolSpan);
|
|
131649
132142
|
batchState.callIds.add(reqInfo.callId);
|
|
131650
132143
|
this.callIdToBatch.set(reqInfo.callId, batchState);
|
|
131651
|
-
this.callIdToPostToolBatchSignal.set(reqInfo.callId, signal);
|
|
131652
132144
|
try {
|
|
131653
|
-
if (signal
|
|
131654
|
-
this.setStatusInternal(
|
|
131655
|
-
reqInfo.callId,
|
|
131656
|
-
"cancelled",
|
|
131657
|
-
"Tool call cancelled by user."
|
|
131658
|
-
);
|
|
131659
|
-
setToolSpanCancelled(toolSpan);
|
|
131660
|
-
this.finalizeToolSpan(reqInfo.callId);
|
|
132145
|
+
if (this.cancelPreExecutionIfAborted(reqInfo.callId, signal, toolSpan)) {
|
|
131661
132146
|
continue;
|
|
131662
132147
|
}
|
|
131663
132148
|
let toolParams = invocation.params;
|
|
@@ -131670,6 +132155,9 @@ var CoreToolScheduler = class {
|
|
|
131670
132155
|
toolParams
|
|
131671
132156
|
)
|
|
131672
132157
|
);
|
|
132158
|
+
if (this.cancelPreExecutionIfAborted(reqInfo.callId, signal, toolSpan)) {
|
|
132159
|
+
continue;
|
|
132160
|
+
}
|
|
131673
132161
|
const {
|
|
131674
132162
|
defaultPermission,
|
|
131675
132163
|
finalPermission,
|
|
@@ -131714,7 +132202,8 @@ var CoreToolScheduler = class {
|
|
|
131714
132202
|
createErrorResponse(
|
|
131715
132203
|
reqInfo,
|
|
131716
132204
|
new Error(message),
|
|
131717
|
-
"execution_denied" /* EXECUTION_DENIED
|
|
132205
|
+
"execution_denied" /* EXECUTION_DENIED */,
|
|
132206
|
+
"not_started"
|
|
131718
132207
|
)
|
|
131719
132208
|
);
|
|
131720
132209
|
setToolSpanFailure(
|
|
@@ -131732,7 +132221,8 @@ var CoreToolScheduler = class {
|
|
|
131732
132221
|
createErrorResponse(
|
|
131733
132222
|
reqInfo,
|
|
131734
132223
|
new Error(denyMessage ?? `Tool "${reqInfo.name}" is denied.`),
|
|
131735
|
-
"execution_denied" /* EXECUTION_DENIED
|
|
132224
|
+
"execution_denied" /* EXECUTION_DENIED */,
|
|
132225
|
+
"not_started"
|
|
131736
132226
|
)
|
|
131737
132227
|
);
|
|
131738
132228
|
setToolSpanFailure(
|
|
@@ -131765,12 +132255,16 @@ var CoreToolScheduler = class {
|
|
|
131765
132255
|
signal
|
|
131766
132256
|
})
|
|
131767
132257
|
) : { classification: "not-applicable" };
|
|
132258
|
+
if (this.cancelPreExecutionIfAborted(reqInfo.callId, signal, toolSpan)) {
|
|
132259
|
+
continue;
|
|
132260
|
+
}
|
|
131768
132261
|
const rejectPlanShell = /* @__PURE__ */ __name((message) => {
|
|
131769
132262
|
this.setStatusInternal(reqInfo.callId, "error", {
|
|
131770
132263
|
...createErrorResponse(
|
|
131771
132264
|
reqInfo,
|
|
131772
132265
|
new Error(message),
|
|
131773
|
-
"execution_denied" /* EXECUTION_DENIED
|
|
132266
|
+
"execution_denied" /* EXECUTION_DENIED */,
|
|
132267
|
+
"not_started"
|
|
131774
132268
|
),
|
|
131775
132269
|
resultDisplay: message
|
|
131776
132270
|
});
|
|
@@ -131792,6 +132286,9 @@ var CoreToolScheduler = class {
|
|
|
131792
132286
|
signal
|
|
131793
132287
|
})
|
|
131794
132288
|
);
|
|
132289
|
+
if (this.cancelPreExecutionIfAborted(reqInfo.callId, signal, toolSpan)) {
|
|
132290
|
+
continue;
|
|
132291
|
+
}
|
|
131795
132292
|
if (initialPlanShellError) {
|
|
131796
132293
|
rejectPlanShell(initialPlanShellError);
|
|
131797
132294
|
continue;
|
|
@@ -131832,6 +132329,9 @@ var CoreToolScheduler = class {
|
|
|
131832
132329
|
skipClassifierReason: fallback.fallback ? fallback.reason : void 0
|
|
131833
132330
|
})
|
|
131834
132331
|
);
|
|
132332
|
+
if (this.cancelPreExecutionIfAborted(reqInfo.callId, signal, toolSpan)) {
|
|
132333
|
+
continue;
|
|
132334
|
+
}
|
|
131835
132335
|
const outcome = applyAutoModeDecision(
|
|
131836
132336
|
decision,
|
|
131837
132337
|
this.config,
|
|
@@ -131856,6 +132356,9 @@ var CoreToolScheduler = class {
|
|
|
131856
132356
|
);
|
|
131857
132357
|
}
|
|
131858
132358
|
}
|
|
132359
|
+
if (this.cancelPreExecutionIfAborted(reqInfo.callId, signal, toolSpan)) {
|
|
132360
|
+
continue;
|
|
132361
|
+
}
|
|
131859
132362
|
switch (outcome.kind) {
|
|
131860
132363
|
case "approved":
|
|
131861
132364
|
this.setToolCallOutcome(
|
|
@@ -131874,9 +132377,16 @@ var CoreToolScheduler = class {
|
|
|
131874
132377
|
createErrorResponse(
|
|
131875
132378
|
reqInfo,
|
|
131876
132379
|
new Error(outcome.errorMessage),
|
|
131877
|
-
"execution_denied" /* EXECUTION_DENIED
|
|
132380
|
+
"execution_denied" /* EXECUTION_DENIED */,
|
|
132381
|
+
"not_started"
|
|
131878
132382
|
)
|
|
131879
132383
|
);
|
|
132384
|
+
setToolSpanFailure(
|
|
132385
|
+
toolSpan,
|
|
132386
|
+
TOOL_FAILURE_KIND_PERMISSION_DENIED,
|
|
132387
|
+
outcome.errorMessage
|
|
132388
|
+
);
|
|
132389
|
+
this.finalizeToolSpan(reqInfo.callId);
|
|
131880
132390
|
continue;
|
|
131881
132391
|
case "fallback":
|
|
131882
132392
|
if (isDenialFallbackReason(outcome.reason) || outcome.reason === "classifier_unavailable") {
|
|
@@ -131911,6 +132421,9 @@ var CoreToolScheduler = class {
|
|
|
131911
132421
|
reqInfo,
|
|
131912
132422
|
() => invocation.getConfirmationDetails(signal)
|
|
131913
132423
|
);
|
|
132424
|
+
if (this.cancelPreExecutionIfAborted(reqInfo.callId, signal, toolSpan)) {
|
|
132425
|
+
continue;
|
|
132426
|
+
}
|
|
131914
132427
|
if (autoModeFallbackMessage) {
|
|
131915
132428
|
confirmationDetails = decorateClassifierUnavailableConfirmation(
|
|
131916
132429
|
confirmationDetails,
|
|
@@ -131928,6 +132441,13 @@ var CoreToolScheduler = class {
|
|
|
131928
132441
|
signal
|
|
131929
132442
|
})
|
|
131930
132443
|
);
|
|
132444
|
+
if (this.cancelPreExecutionIfAborted(
|
|
132445
|
+
reqInfo.callId,
|
|
132446
|
+
signal,
|
|
132447
|
+
toolSpan
|
|
132448
|
+
)) {
|
|
132449
|
+
continue;
|
|
132450
|
+
}
|
|
131931
132451
|
if (preDisplayPlanShellError) {
|
|
131932
132452
|
rejectPlanShell(preDisplayPlanShellError);
|
|
131933
132453
|
continue;
|
|
@@ -131961,7 +132481,8 @@ var CoreToolScheduler = class {
|
|
|
131961
132481
|
...createErrorResponse(
|
|
131962
132482
|
reqInfo,
|
|
131963
132483
|
planModeError,
|
|
131964
|
-
"execution_denied" /* EXECUTION_DENIED
|
|
132484
|
+
"execution_denied" /* EXECUTION_DENIED */,
|
|
132485
|
+
"not_started"
|
|
131965
132486
|
),
|
|
131966
132487
|
resultDisplay: "Plan mode blocked a non-read-only tool call."
|
|
131967
132488
|
});
|
|
@@ -131994,7 +132515,8 @@ var CoreToolScheduler = class {
|
|
|
131994
132515
|
createErrorResponse(
|
|
131995
132516
|
reqInfo,
|
|
131996
132517
|
new Error(errorMessage),
|
|
131997
|
-
"execution_denied" /* EXECUTION_DENIED
|
|
132518
|
+
"execution_denied" /* EXECUTION_DENIED */,
|
|
132519
|
+
"not_started"
|
|
131998
132520
|
)
|
|
131999
132521
|
);
|
|
132000
132522
|
setToolSpanFailure(
|
|
@@ -132021,6 +132543,13 @@ var CoreToolScheduler = class {
|
|
|
132021
132543
|
signal
|
|
132022
132544
|
)
|
|
132023
132545
|
);
|
|
132546
|
+
if (this.cancelPreExecutionIfAborted(
|
|
132547
|
+
reqInfo.callId,
|
|
132548
|
+
signal,
|
|
132549
|
+
toolSpan
|
|
132550
|
+
)) {
|
|
132551
|
+
continue;
|
|
132552
|
+
}
|
|
132024
132553
|
if (hookResult.hasDecision && (!hookResult.shouldAllow || !requiresUserInteraction)) {
|
|
132025
132554
|
if (hookResult.shouldAllow) {
|
|
132026
132555
|
if (planShellDecision.classification !== "not-applicable") {
|
|
@@ -132036,6 +132565,13 @@ var CoreToolScheduler = class {
|
|
|
132036
132565
|
payload: hookResult.updatedInput ? { updatedInput: hookResult.updatedInput } : void 0
|
|
132037
132566
|
})
|
|
132038
132567
|
);
|
|
132568
|
+
if (this.cancelPreExecutionIfAborted(
|
|
132569
|
+
reqInfo.callId,
|
|
132570
|
+
signal,
|
|
132571
|
+
toolSpan
|
|
132572
|
+
)) {
|
|
132573
|
+
continue;
|
|
132574
|
+
}
|
|
132039
132575
|
if (approval.outcome === "cancel" /* Cancel */) {
|
|
132040
132576
|
await runInRequestGoalContext(
|
|
132041
132577
|
reqInfo,
|
|
@@ -132044,6 +132580,13 @@ var CoreToolScheduler = class {
|
|
|
132044
132580
|
approval.payload
|
|
132045
132581
|
)
|
|
132046
132582
|
);
|
|
132583
|
+
if (this.cancelPreExecutionIfAborted(
|
|
132584
|
+
reqInfo.callId,
|
|
132585
|
+
signal,
|
|
132586
|
+
toolSpan
|
|
132587
|
+
)) {
|
|
132588
|
+
continue;
|
|
132589
|
+
}
|
|
132047
132590
|
rejectPlanShell(
|
|
132048
132591
|
approval.payload?.cancelMessage ?? planShellDecision.noApprovalMessage
|
|
132049
132592
|
);
|
|
@@ -132056,6 +132599,13 @@ var CoreToolScheduler = class {
|
|
|
132056
132599
|
approval.payload
|
|
132057
132600
|
)
|
|
132058
132601
|
);
|
|
132602
|
+
if (this.cancelPreExecutionIfAborted(
|
|
132603
|
+
reqInfo.callId,
|
|
132604
|
+
signal,
|
|
132605
|
+
toolSpan
|
|
132606
|
+
)) {
|
|
132607
|
+
continue;
|
|
132608
|
+
}
|
|
132059
132609
|
this.recordAutoModeFallbackResolution(
|
|
132060
132610
|
reqInfo.callId,
|
|
132061
132611
|
approval.outcome
|
|
@@ -132065,10 +132615,12 @@ var CoreToolScheduler = class {
|
|
|
132065
132615
|
continue;
|
|
132066
132616
|
}
|
|
132067
132617
|
if (hookResult.updatedInput && typeof reqInfo.args === "object") {
|
|
132068
|
-
this.setArgsInternal(
|
|
132618
|
+
if (!this.setArgsInternal(
|
|
132069
132619
|
reqInfo.callId,
|
|
132070
132620
|
hookResult.updatedInput
|
|
132071
|
-
)
|
|
132621
|
+
)) {
|
|
132622
|
+
continue;
|
|
132623
|
+
}
|
|
132072
132624
|
}
|
|
132073
132625
|
await runInRequestGoalContext(
|
|
132074
132626
|
reqInfo,
|
|
@@ -132076,6 +132628,13 @@ var CoreToolScheduler = class {
|
|
|
132076
132628
|
"proceed_once" /* ProceedOnce */
|
|
132077
132629
|
)
|
|
132078
132630
|
);
|
|
132631
|
+
if (this.cancelPreExecutionIfAborted(
|
|
132632
|
+
reqInfo.callId,
|
|
132633
|
+
signal,
|
|
132634
|
+
toolSpan
|
|
132635
|
+
)) {
|
|
132636
|
+
continue;
|
|
132637
|
+
}
|
|
132079
132638
|
this.recordAutoModeFallbackResolution(
|
|
132080
132639
|
reqInfo.callId,
|
|
132081
132640
|
"proceed_once" /* ProceedOnce */
|
|
@@ -132094,6 +132653,13 @@ var CoreToolScheduler = class {
|
|
|
132094
132653
|
cancelPayload
|
|
132095
132654
|
)
|
|
132096
132655
|
);
|
|
132656
|
+
if (this.cancelPreExecutionIfAborted(
|
|
132657
|
+
reqInfo.callId,
|
|
132658
|
+
signal,
|
|
132659
|
+
toolSpan
|
|
132660
|
+
)) {
|
|
132661
|
+
continue;
|
|
132662
|
+
}
|
|
132097
132663
|
this.recordAutoModeFallbackResolution(
|
|
132098
132664
|
reqInfo.callId,
|
|
132099
132665
|
"cancel" /* Cancel */
|
|
@@ -132110,7 +132676,8 @@ var CoreToolScheduler = class {
|
|
|
132110
132676
|
new Error(
|
|
132111
132677
|
hookResult.denyMessage || `Permission denied by hook for "${reqInfo.name}"`
|
|
132112
132678
|
),
|
|
132113
|
-
"execution_denied" /* EXECUTION_DENIED
|
|
132679
|
+
"execution_denied" /* EXECUTION_DENIED */,
|
|
132680
|
+
"not_started"
|
|
132114
132681
|
)
|
|
132115
132682
|
);
|
|
132116
132683
|
setToolSpanFailure(
|
|
@@ -132135,7 +132702,8 @@ var CoreToolScheduler = class {
|
|
|
132135
132702
|
createErrorResponse(
|
|
132136
132703
|
reqInfo,
|
|
132137
132704
|
new Error(errorMessage),
|
|
132138
|
-
"execution_denied" /* EXECUTION_DENIED
|
|
132705
|
+
"execution_denied" /* EXECUTION_DENIED */,
|
|
132706
|
+
"not_started"
|
|
132139
132707
|
)
|
|
132140
132708
|
);
|
|
132141
132709
|
setToolSpanFailure(
|
|
@@ -132146,14 +132714,7 @@ var CoreToolScheduler = class {
|
|
|
132146
132714
|
this.finalizeToolSpan(reqInfo.callId);
|
|
132147
132715
|
continue;
|
|
132148
132716
|
}
|
|
132149
|
-
if (signal
|
|
132150
|
-
this.setStatusInternal(
|
|
132151
|
-
reqInfo.callId,
|
|
132152
|
-
"cancelled",
|
|
132153
|
-
"Tool call cancelled by user."
|
|
132154
|
-
);
|
|
132155
|
-
setToolSpanCancelled(toolSpan);
|
|
132156
|
-
this.finalizeToolSpan(reqInfo.callId);
|
|
132717
|
+
if (this.cancelPreExecutionIfAborted(reqInfo.callId, signal, toolSpan)) {
|
|
132157
132718
|
continue;
|
|
132158
132719
|
}
|
|
132159
132720
|
if (planShellDecision.classification !== "not-applicable") {
|
|
@@ -132167,6 +132728,13 @@ var CoreToolScheduler = class {
|
|
|
132167
132728
|
signal
|
|
132168
132729
|
})
|
|
132169
132730
|
);
|
|
132731
|
+
if (this.cancelPreExecutionIfAborted(
|
|
132732
|
+
reqInfo.callId,
|
|
132733
|
+
signal,
|
|
132734
|
+
toolSpan
|
|
132735
|
+
)) {
|
|
132736
|
+
continue;
|
|
132737
|
+
}
|
|
132170
132738
|
if (finalPreDisplayPlanShellError) {
|
|
132171
132739
|
rejectPlanShell(finalPreDisplayPlanShellError);
|
|
132172
132740
|
continue;
|
|
@@ -132253,7 +132821,8 @@ var CoreToolScheduler = class {
|
|
|
132253
132821
|
this.setStatusInternal(
|
|
132254
132822
|
reqInfo.callId,
|
|
132255
132823
|
"cancelled",
|
|
132256
|
-
"Tool call cancelled by user."
|
|
132824
|
+
"Tool call cancelled by user.",
|
|
132825
|
+
"not_started"
|
|
132257
132826
|
);
|
|
132258
132827
|
this.finalizeBlockedSpan(reqInfo.callId, "aborted", "system");
|
|
132259
132828
|
setToolSpanCancelled(toolSpan);
|
|
@@ -132267,7 +132836,8 @@ var CoreToolScheduler = class {
|
|
|
132267
132836
|
createErrorResponse(
|
|
132268
132837
|
reqInfo,
|
|
132269
132838
|
error instanceof Error ? error : new Error(String(error)),
|
|
132270
|
-
explicitErrorType ?? "unhandled_exception" /* UNHANDLED_EXCEPTION
|
|
132839
|
+
explicitErrorType ?? "unhandled_exception" /* UNHANDLED_EXCEPTION */,
|
|
132840
|
+
"not_started"
|
|
132271
132841
|
)
|
|
132272
132842
|
);
|
|
132273
132843
|
this.finalizeBlockedSpan(reqInfo.callId, "error", "system");
|
|
@@ -132290,6 +132860,7 @@ var CoreToolScheduler = class {
|
|
|
132290
132860
|
}
|
|
132291
132861
|
} finally {
|
|
132292
132862
|
this.isScheduling = false;
|
|
132863
|
+
this.drainRequestQueueIfIdle();
|
|
132293
132864
|
}
|
|
132294
132865
|
}
|
|
132295
132866
|
async handleConfirmationResponse(callId, originalOnConfirm, outcome, signal, payload) {
|
|
@@ -132333,6 +132904,25 @@ var CoreToolScheduler = class {
|
|
|
132333
132904
|
);
|
|
132334
132905
|
} catch (error) {
|
|
132335
132906
|
const aborted = signal.aborted;
|
|
132907
|
+
if (aborted) {
|
|
132908
|
+
this.setStatusInternal(
|
|
132909
|
+
callId,
|
|
132910
|
+
"cancelled",
|
|
132911
|
+
"Tool call cancelled by user.",
|
|
132912
|
+
"not_started"
|
|
132913
|
+
);
|
|
132914
|
+
} else {
|
|
132915
|
+
this.setStatusInternal(
|
|
132916
|
+
callId,
|
|
132917
|
+
"error",
|
|
132918
|
+
createErrorResponse(
|
|
132919
|
+
toolCall.request,
|
|
132920
|
+
error instanceof Error ? error : new Error(String(error)),
|
|
132921
|
+
"unhandled_exception" /* UNHANDLED_EXCEPTION */,
|
|
132922
|
+
"not_started"
|
|
132923
|
+
)
|
|
132924
|
+
);
|
|
132925
|
+
}
|
|
132336
132926
|
this.finalizeBlockedSpan(callId, aborted ? "aborted" : "error", "system");
|
|
132337
132927
|
const toolSpan = this.toolSpans.get(callId);
|
|
132338
132928
|
if (toolSpan) {
|
|
@@ -132376,7 +132966,7 @@ var CoreToolScheduler = class {
|
|
|
132376
132966
|
this.recordAutoModeFallbackResolution(callId, outcome);
|
|
132377
132967
|
if (outcome === "cancel" /* Cancel */ || signal.aborted) {
|
|
132378
132968
|
const cancelMessage = payload?.cancelMessage || "User did not allow tool call";
|
|
132379
|
-
this.setStatusInternal(callId, "cancelled", cancelMessage);
|
|
132969
|
+
this.setStatusInternal(callId, "cancelled", cancelMessage, "not_started");
|
|
132380
132970
|
const toolSpan = this.toolSpans.get(callId);
|
|
132381
132971
|
if (toolSpan) {
|
|
132382
132972
|
setToolSpanCancelled(toolSpan);
|
|
@@ -132431,7 +133021,7 @@ var CoreToolScheduler = class {
|
|
|
132431
133021
|
signal,
|
|
132432
133022
|
this.onEditorClose
|
|
132433
133023
|
);
|
|
132434
|
-
this.setArgsInternal(callId, updatedParams);
|
|
133024
|
+
if (!this.setArgsInternal(callId, updatedParams)) return;
|
|
132435
133025
|
this.setStatusInternal(callId, "awaiting_approval", {
|
|
132436
133026
|
...waitingToolCall.confirmationDetails,
|
|
132437
133027
|
fileDiff: updatedDiff,
|
|
@@ -132440,11 +133030,13 @@ var CoreToolScheduler = class {
|
|
|
132440
133030
|
}
|
|
132441
133031
|
} else {
|
|
132442
133032
|
if (payload?.newContent && toolCall) {
|
|
132443
|
-
await this._applyInlineModify(
|
|
133033
|
+
if (!await this._applyInlineModify(
|
|
132444
133034
|
toolCall,
|
|
132445
133035
|
payload,
|
|
132446
133036
|
signal
|
|
132447
|
-
)
|
|
133037
|
+
)) {
|
|
133038
|
+
return;
|
|
133039
|
+
}
|
|
132448
133040
|
}
|
|
132449
133041
|
this.setStatusInternal(callId, "scheduled");
|
|
132450
133042
|
const decision = outcome === "proceed_once" /* ProceedOnce */ ? "proceed_once" : "proceed_always";
|
|
@@ -132528,7 +133120,7 @@ var CoreToolScheduler = class {
|
|
|
132528
133120
|
async _applyInlineModify(toolCall, payload, signal) {
|
|
132529
133121
|
const confirmDetails = toolCall.confirmationDetails;
|
|
132530
133122
|
if (confirmDetails.type !== "edit" || !isModifiableDeclarativeTool(toolCall.tool) || !payload.newContent) {
|
|
132531
|
-
return;
|
|
133123
|
+
return true;
|
|
132532
133124
|
}
|
|
132533
133125
|
const currentContent = confirmDetails.originalContent ?? "";
|
|
132534
133126
|
const modifyContext = toolCall.tool.getModifyContext(signal);
|
|
@@ -132544,11 +133136,14 @@ var CoreToolScheduler = class {
|
|
|
132544
133136
|
"Current",
|
|
132545
133137
|
"Proposed"
|
|
132546
133138
|
);
|
|
132547
|
-
this.setArgsInternal(toolCall.request.callId, updatedParams)
|
|
133139
|
+
if (!this.setArgsInternal(toolCall.request.callId, updatedParams)) {
|
|
133140
|
+
return false;
|
|
133141
|
+
}
|
|
132548
133142
|
this.setStatusInternal(toolCall.request.callId, "awaiting_approval", {
|
|
132549
133143
|
...confirmDetails,
|
|
132550
133144
|
fileDiff: updatedDiff
|
|
132551
133145
|
});
|
|
133146
|
+
return true;
|
|
132552
133147
|
}
|
|
132553
133148
|
async attemptExecutionOfScheduledCalls(signal) {
|
|
132554
133149
|
while (true) {
|
|
@@ -132662,10 +133257,10 @@ var CoreToolScheduler = class {
|
|
|
132662
133257
|
createErrorResponse(
|
|
132663
133258
|
scheduledCall.request,
|
|
132664
133259
|
error instanceof Error ? error : new Error(errorMessage),
|
|
132665
|
-
"unhandled_exception" /* UNHANDLED_EXCEPTION
|
|
133260
|
+
"unhandled_exception" /* UNHANDLED_EXCEPTION */,
|
|
133261
|
+
this.toolCalls.find((call) => call.request.callId === callId)?.status === "executing" ? "error" : "not_started"
|
|
132666
133262
|
)
|
|
132667
133263
|
);
|
|
132668
|
-
throw error;
|
|
132669
133264
|
} finally {
|
|
132670
133265
|
if (!this.bouncedAwaitingApproval.has(callId)) {
|
|
132671
133266
|
this.finalizeToolSpan(callId);
|
|
@@ -132805,7 +133400,7 @@ var CoreToolScheduler = class {
|
|
|
132805
133400
|
hasAdditionalContext: !!r.additionalContext
|
|
132806
133401
|
}
|
|
132807
133402
|
);
|
|
132808
|
-
if (!preHookResult.shouldProceed) {
|
|
133403
|
+
if (!signal.aborted && !preHookResult.shouldProceed) {
|
|
132809
133404
|
if (preHookResult.blockType === "ask" && !signal.aborted && this.canPromptForAskBounce()) {
|
|
132810
133405
|
this.bouncedToolUseId.set(callId, toolUseId);
|
|
132811
133406
|
this.bounceToAwaitingApprovalForAsk(
|
|
@@ -132820,7 +133415,8 @@ var CoreToolScheduler = class {
|
|
|
132820
133415
|
const errorResponse = createErrorResponse(
|
|
132821
133416
|
scheduledCall.request,
|
|
132822
133417
|
new Error(blockMessage),
|
|
132823
|
-
"execution_denied" /* EXECUTION_DENIED
|
|
133418
|
+
"execution_denied" /* EXECUTION_DENIED */,
|
|
133419
|
+
"not_started"
|
|
132824
133420
|
);
|
|
132825
133421
|
this.setStatusInternal(callId, "error", errorResponse);
|
|
132826
133422
|
setToolSpanFailure(
|
|
@@ -132846,16 +133442,23 @@ var CoreToolScheduler = class {
|
|
|
132846
133442
|
this.setStatusInternal(
|
|
132847
133443
|
callId,
|
|
132848
133444
|
"cancelled",
|
|
132849
|
-
|
|
133445
|
+
createCancelledResponse(
|
|
133446
|
+
scheduledCall.request,
|
|
133447
|
+
"Tool call cancelled before execution.",
|
|
133448
|
+
"not_started"
|
|
133449
|
+
)
|
|
132850
133450
|
);
|
|
132851
|
-
|
|
133451
|
+
if (this.toolSpans.has(callId)) {
|
|
133452
|
+
setToolSpanCancelled(span);
|
|
133453
|
+
}
|
|
132852
133454
|
return;
|
|
132853
133455
|
}
|
|
132854
133456
|
if (!guardDecision.allowed) {
|
|
132855
133457
|
const errorResponse = createErrorResponse(
|
|
132856
133458
|
scheduledCall.request,
|
|
132857
133459
|
new Error(guardDecision.reason),
|
|
132858
|
-
"execution_denied" /* EXECUTION_DENIED
|
|
133460
|
+
"execution_denied" /* EXECUTION_DENIED */,
|
|
133461
|
+
"not_started"
|
|
132859
133462
|
);
|
|
132860
133463
|
this.setStatusInternal(callId, "error", errorResponse);
|
|
132861
133464
|
setToolSpanFailure(
|
|
@@ -132866,7 +133469,26 @@ var CoreToolScheduler = class {
|
|
|
132866
133469
|
return;
|
|
132867
133470
|
}
|
|
132868
133471
|
}
|
|
132869
|
-
|
|
133472
|
+
if (signal.aborted) {
|
|
133473
|
+
const currentCall = this.toolCalls.find(
|
|
133474
|
+
(call) => call.request.callId === callId
|
|
133475
|
+
);
|
|
133476
|
+
if (currentCall && currentCall.status !== "success" && currentCall.status !== "error" && currentCall.status !== "cancelled") {
|
|
133477
|
+
this.setStatusInternal(
|
|
133478
|
+
callId,
|
|
133479
|
+
"cancelled",
|
|
133480
|
+
createCancelledResponse(
|
|
133481
|
+
scheduledCall.request,
|
|
133482
|
+
"Tool call cancelled before execution.",
|
|
133483
|
+
"not_started"
|
|
133484
|
+
)
|
|
133485
|
+
);
|
|
133486
|
+
if (this.toolSpans.has(callId)) {
|
|
133487
|
+
setToolSpanCancelled(span);
|
|
133488
|
+
}
|
|
133489
|
+
}
|
|
133490
|
+
return;
|
|
133491
|
+
}
|
|
132870
133492
|
const liveOutputCallback = scheduledCall.tool.canUpdateOutput ? (outputChunk) => {
|
|
132871
133493
|
if (isShellProgressData(outputChunk)) {
|
|
132872
133494
|
if (this.outputUpdateHandler) {
|
|
@@ -132884,12 +133506,14 @@ var CoreToolScheduler = class {
|
|
|
132884
133506
|
this.notifyToolCallsUpdate();
|
|
132885
133507
|
} : void 0;
|
|
132886
133508
|
const shellExecutionConfig = this.config.getShellExecutionConfig();
|
|
132887
|
-
const execSpan = startToolExecutionSpan();
|
|
132888
133509
|
const sleepInhibitorHandle = acquireSleepInhibitor(
|
|
132889
133510
|
this.config,
|
|
132890
133511
|
`Qwen Code is executing tool ${canonicalName}`
|
|
132891
133512
|
);
|
|
132892
133513
|
let removeParentAbortForward;
|
|
133514
|
+
let executionStatus = "not_started";
|
|
133515
|
+
let executionSettled = false;
|
|
133516
|
+
let execSpan;
|
|
132893
133517
|
try {
|
|
132894
133518
|
let promise;
|
|
132895
133519
|
const toolExecutionTimeoutMs = Math.min(
|
|
@@ -132940,30 +133564,40 @@ var CoreToolScheduler = class {
|
|
|
132940
133564
|
this.safelyAddToolArgumentsAttributes(span, invocation.params);
|
|
132941
133565
|
promise = todoWorkChainContext.run(
|
|
132942
133566
|
todoWorkChainId,
|
|
132943
|
-
() => promptIdContext.run(
|
|
132944
|
-
|
|
132945
|
-
|
|
133567
|
+
() => promptIdContext.run(scheduledCall.request.prompt_id, () => {
|
|
133568
|
+
this.setStatusInternal(callId, "executing");
|
|
133569
|
+
execSpan = startToolExecutionSpan({
|
|
133570
|
+
toolName: canonicalName,
|
|
133571
|
+
callId
|
|
133572
|
+
});
|
|
133573
|
+
executionStatus = "error";
|
|
133574
|
+
return invocation.execute(
|
|
132946
133575
|
execSignal,
|
|
132947
133576
|
liveOutputCallback,
|
|
132948
133577
|
shellExecutionConfig,
|
|
132949
133578
|
setPidCallback,
|
|
132950
133579
|
setPromoteAbortControllerCallback,
|
|
132951
133580
|
canPromoteForegroundShell
|
|
132952
|
-
)
|
|
132953
|
-
)
|
|
133581
|
+
);
|
|
133582
|
+
})
|
|
132954
133583
|
);
|
|
132955
133584
|
} else {
|
|
132956
133585
|
this.safelyAddToolArgumentsAttributes(span, invocation.params);
|
|
132957
133586
|
promise = todoWorkChainContext.run(
|
|
132958
133587
|
todoWorkChainId,
|
|
132959
|
-
() => promptIdContext.run(
|
|
132960
|
-
|
|
132961
|
-
|
|
133588
|
+
() => promptIdContext.run(scheduledCall.request.prompt_id, () => {
|
|
133589
|
+
this.setStatusInternal(callId, "executing");
|
|
133590
|
+
execSpan = startToolExecutionSpan({
|
|
133591
|
+
toolName: canonicalName,
|
|
133592
|
+
callId
|
|
133593
|
+
});
|
|
133594
|
+
executionStatus = "error";
|
|
133595
|
+
return invocation.execute(
|
|
132962
133596
|
execSignal,
|
|
132963
133597
|
liveOutputCallback,
|
|
132964
133598
|
shellExecutionConfig
|
|
132965
|
-
)
|
|
132966
|
-
)
|
|
133599
|
+
);
|
|
133600
|
+
})
|
|
132967
133601
|
);
|
|
132968
133602
|
}
|
|
132969
133603
|
let toolResult;
|
|
@@ -132998,14 +133632,24 @@ var CoreToolScheduler = class {
|
|
|
132998
133632
|
toolResult = await promise;
|
|
132999
133633
|
}
|
|
133000
133634
|
const isTimeout = toolResult.error?.type === "execution_timeout" /* EXECUTION_TIMEOUT */ && (!schedulerTimeoutResultSelected || schedulerTimeoutWon);
|
|
133001
|
-
const
|
|
133002
|
-
|
|
133003
|
-
|
|
133004
|
-
|
|
133005
|
-
|
|
133006
|
-
|
|
133635
|
+
const parentAbortedAtExecutionSettle = signal.aborted;
|
|
133636
|
+
const aborted = parentAbortedAtExecutionSettle && !isTimeout;
|
|
133637
|
+
const executionErrorType = toolResult.error ? toolResult.error.type ?? (scheduledCall.tool instanceof DiscoveredMCPTool ? "mcp_tool_error" /* MCP_TOOL_ERROR */ : "unknown" /* UNKNOWN */) : void 0;
|
|
133638
|
+
executionStatus = aborted ? "cancelled" : toolResult.error ? "error" : "success";
|
|
133639
|
+
executionSettled = true;
|
|
133640
|
+
if (execSpan) {
|
|
133641
|
+
const completedExecSpan = execSpan;
|
|
133642
|
+
execSpan = void 0;
|
|
133643
|
+
endToolExecutionSpan(completedExecSpan, {
|
|
133644
|
+
success: executionStatus === "success",
|
|
133645
|
+
error: aborted ? TOOL_SPAN_STATUS_TOOL_CANCELLED : isTimeout ? TOOL_SPAN_STATUS_TOOL_TIMEOUT : toolResult.error ? TOOL_SPAN_STATUS_TOOL_ERROR : void 0,
|
|
133646
|
+
cancelled: aborted,
|
|
133647
|
+
executionStatus,
|
|
133648
|
+
errorType: executionErrorType
|
|
133649
|
+
});
|
|
133650
|
+
}
|
|
133007
133651
|
if (aborted) {
|
|
133008
|
-
let cancelMessage =
|
|
133652
|
+
let cancelMessage = TOOL_CANCELLED_AFTER_COMPLETION_MESSAGE;
|
|
133009
133653
|
let failureHookArtifacts;
|
|
133010
133654
|
if (hooksEnabled && messageBus) {
|
|
133011
133655
|
const failureHookResult = await this.withHookSpan(
|
|
@@ -133037,15 +133681,37 @@ ${failureHookResult.additionalContext}`;
|
|
|
133037
133681
|
this.setStatusInternal(
|
|
133038
133682
|
callId,
|
|
133039
133683
|
"cancelled",
|
|
133040
|
-
|
|
133684
|
+
createCancelledResponse(
|
|
133041
133685
|
scheduledCall.request,
|
|
133042
133686
|
cancelMessage,
|
|
133043
|
-
|
|
133044
|
-
|
|
133687
|
+
executionStatus,
|
|
133688
|
+
failureHookArtifacts,
|
|
133689
|
+
toolResult.persistedOutputFiles
|
|
133690
|
+
)
|
|
133045
133691
|
);
|
|
133046
133692
|
setToolSpanCancelled(span);
|
|
133047
133693
|
return;
|
|
133048
133694
|
}
|
|
133695
|
+
const cancelAfterPostProcessing = /* @__PURE__ */ __name((artifacts, preserved) => {
|
|
133696
|
+
if (!signal.aborted || isTimeout && parentAbortedAtExecutionSettle) {
|
|
133697
|
+
return false;
|
|
133698
|
+
}
|
|
133699
|
+
this.setStatusInternal(
|
|
133700
|
+
callId,
|
|
133701
|
+
"cancelled",
|
|
133702
|
+
createCancelledResponse(
|
|
133703
|
+
scheduledCall.request,
|
|
133704
|
+
// Reached only after `execute()` settled with a result.
|
|
133705
|
+
TOOL_CANCELLED_AFTER_COMPLETION_MESSAGE,
|
|
133706
|
+
executionStatus,
|
|
133707
|
+
artifacts,
|
|
133708
|
+
preserved?.persistedOutputFiles,
|
|
133709
|
+
preserved?.visionBridgeNotice
|
|
133710
|
+
)
|
|
133711
|
+
);
|
|
133712
|
+
setToolSpanCancelled(span);
|
|
133713
|
+
return true;
|
|
133714
|
+
}, "cancelAfterPostProcessing");
|
|
133049
133715
|
if (toolResult.error === void 0) {
|
|
133050
133716
|
let content = toolResult.llmContent ?? "";
|
|
133051
133717
|
let persistedOutputFiles = toolResult.persistedOutputFiles ? [...toolResult.persistedOutputFiles] : toolResult.persistedOutputFiles;
|
|
@@ -133102,12 +133768,21 @@ ${failureHookResult.additionalContext}`;
|
|
|
133102
133768
|
postToolUseArtifacts = postHookResult.artifacts;
|
|
133103
133769
|
}
|
|
133104
133770
|
if (postHookResult.shouldStop) {
|
|
133771
|
+
if (cancelAfterPostProcessing(postHookResult.artifacts, {
|
|
133772
|
+
persistedOutputFiles
|
|
133773
|
+
})) {
|
|
133774
|
+
return;
|
|
133775
|
+
}
|
|
133105
133776
|
const stopMessage = postHookResult.stopReason || "Execution stopped by hook";
|
|
133106
133777
|
const errorResponse = createErrorResponse(
|
|
133107
133778
|
scheduledCall.request,
|
|
133108
133779
|
new Error(stopMessage),
|
|
133109
|
-
"execution_denied" /* EXECUTION_DENIED
|
|
133780
|
+
"execution_denied" /* EXECUTION_DENIED */,
|
|
133781
|
+
executionStatus
|
|
133110
133782
|
);
|
|
133783
|
+
if (persistedOutputFiles !== void 0) {
|
|
133784
|
+
errorResponse.persistedOutputFiles = persistedOutputFiles;
|
|
133785
|
+
}
|
|
133111
133786
|
this.setStatusInternal(callId, "error", errorResponse);
|
|
133112
133787
|
setToolSpanFailure(
|
|
133113
133788
|
span,
|
|
@@ -133273,6 +133948,7 @@ ${body}
|
|
|
133273
133948
|
),
|
|
133274
133949
|
error: void 0,
|
|
133275
133950
|
errorType: void 0,
|
|
133951
|
+
executionStatus,
|
|
133276
133952
|
contentLength,
|
|
133277
133953
|
...persistedOutputFiles !== void 0 ? { persistedOutputFiles } : {},
|
|
133278
133954
|
// Propagate modelOverride from skill tools. Use `in` to distinguish
|
|
@@ -133304,6 +133980,12 @@ ${body}
|
|
|
133304
133980
|
);
|
|
133305
133981
|
}
|
|
133306
133982
|
}
|
|
133983
|
+
if (cancelAfterPostProcessing(artifacts, {
|
|
133984
|
+
persistedOutputFiles: successResponse.persistedOutputFiles,
|
|
133985
|
+
visionBridgeNotice: successResponse.visionBridgeNotice
|
|
133986
|
+
})) {
|
|
133987
|
+
return;
|
|
133988
|
+
}
|
|
133307
133989
|
this.setStatusInternal(callId, "success", successResponse);
|
|
133308
133990
|
safeSetStatus(span, { code: SpanStatusCode.OK });
|
|
133309
133991
|
try {
|
|
@@ -133392,6 +134074,12 @@ ${failureHookResult.additionalContext}`;
|
|
|
133392
134074
|
...timeoutContent.persistedOutputFiles ?? []
|
|
133393
134075
|
])
|
|
133394
134076
|
);
|
|
134077
|
+
if (cancelAfterPostProcessing(artifacts, {
|
|
134078
|
+
persistedOutputFiles: timeoutPersistedOutputFiles,
|
|
134079
|
+
visionBridgeNotice: processedImages.visionBridgeNotice
|
|
134080
|
+
})) {
|
|
134081
|
+
return;
|
|
134082
|
+
}
|
|
133395
134083
|
this.setStatusInternal(callId, "error", {
|
|
133396
134084
|
callId,
|
|
133397
134085
|
responseParts,
|
|
@@ -133400,6 +134088,7 @@ ${failureHookResult.additionalContext}`;
|
|
|
133400
134088
|
),
|
|
133401
134089
|
error: new Error(operationalErrorMessage),
|
|
133402
134090
|
errorType: "execution_timeout" /* EXECUTION_TIMEOUT */,
|
|
134091
|
+
executionStatus,
|
|
133403
134092
|
contentLength,
|
|
133404
134093
|
...timeoutPersistedOutputFiles !== void 0 ? { persistedOutputFiles: timeoutPersistedOutputFiles } : {},
|
|
133405
134094
|
...processedImages.modelOverride !== void 0 ? { modelOverride: processedImages.modelOverride } : {},
|
|
@@ -133433,7 +134122,8 @@ ${failureHookResult.additionalContext}`;
|
|
|
133433
134122
|
let errorResponse = createErrorResponse(
|
|
133434
134123
|
scheduledCall.request,
|
|
133435
134124
|
error,
|
|
133436
|
-
|
|
134125
|
+
executionErrorType ?? "unknown" /* UNKNOWN */,
|
|
134126
|
+
executionStatus,
|
|
133437
134127
|
failureHookArtifacts,
|
|
133438
134128
|
typeof toolResult.returnDisplay === "string" ? void 0 : this.compactResultDisplayForInteractiveHistory(
|
|
133439
134129
|
toolResult.returnDisplay
|
|
@@ -133481,6 +134171,15 @@ ${failureHookResult.additionalContext}`;
|
|
|
133481
134171
|
};
|
|
133482
134172
|
}
|
|
133483
134173
|
}
|
|
134174
|
+
if (cancelAfterPostProcessing(
|
|
134175
|
+
[...toolResult.artifacts ?? [], ...failureHookArtifacts ?? []],
|
|
134176
|
+
{
|
|
134177
|
+
persistedOutputFiles: errorResponse.persistedOutputFiles,
|
|
134178
|
+
visionBridgeNotice: errorResponse.visionBridgeNotice
|
|
134179
|
+
}
|
|
134180
|
+
)) {
|
|
134181
|
+
return;
|
|
134182
|
+
}
|
|
133484
134183
|
this.setStatusInternal(callId, "error", errorResponse);
|
|
133485
134184
|
setToolSpanFailure(
|
|
133486
134185
|
span,
|
|
@@ -133490,14 +134189,28 @@ ${failureHookResult.additionalContext}`;
|
|
|
133490
134189
|
}
|
|
133491
134190
|
} catch (executionError) {
|
|
133492
134191
|
const errorMessage = executionError instanceof Error ? executionError.message : String(executionError);
|
|
133493
|
-
const
|
|
133494
|
-
|
|
133495
|
-
|
|
133496
|
-
|
|
133497
|
-
|
|
133498
|
-
|
|
134192
|
+
const executionThrew = !executionSettled && executionStatus !== "not_started";
|
|
134193
|
+
const explicitErrorType = executionError?.errorType;
|
|
134194
|
+
const executionTimedOut = executionThrew && explicitErrorType === "execution_timeout" /* EXECUTION_TIMEOUT */;
|
|
134195
|
+
const aborted = signal.aborted && !executionTimedOut;
|
|
134196
|
+
if (executionThrew) {
|
|
134197
|
+
executionStatus = aborted ? "cancelled" : "error";
|
|
134198
|
+
executionSettled = true;
|
|
134199
|
+
}
|
|
134200
|
+
const exceptionErrorType = explicitErrorType ?? (executionThrew && scheduledCall.tool instanceof DiscoveredMCPTool ? "mcp_tool_error" /* MCP_TOOL_ERROR */ : "unhandled_exception" /* UNHANDLED_EXCEPTION */);
|
|
134201
|
+
if (execSpan) {
|
|
134202
|
+
const failedExecSpan = execSpan;
|
|
134203
|
+
execSpan = void 0;
|
|
134204
|
+
endToolExecutionSpan(failedExecSpan, {
|
|
134205
|
+
success: false,
|
|
134206
|
+
error: aborted ? TOOL_SPAN_STATUS_TOOL_CANCELLED : executionTimedOut ? TOOL_SPAN_STATUS_TOOL_TIMEOUT : TOOL_SPAN_STATUS_TOOL_EXCEPTION,
|
|
134207
|
+
cancelled: aborted,
|
|
134208
|
+
executionStatus,
|
|
134209
|
+
errorType: executionStatus === "error" ? exceptionErrorType : void 0
|
|
134210
|
+
});
|
|
134211
|
+
}
|
|
133499
134212
|
if (aborted) {
|
|
133500
|
-
let cancelMessage =
|
|
134213
|
+
let cancelMessage = executionThrew ? TOOL_CANCELLED_BEFORE_COMPLETION_MESSAGE : TOOL_CANCELLED_AFTER_COMPLETION_MESSAGE;
|
|
133501
134214
|
let failureHookArtifacts;
|
|
133502
134215
|
if (hooksEnabled && messageBus) {
|
|
133503
134216
|
const failureHookResult = await this.withHookSpan(
|
|
@@ -133529,11 +134242,12 @@ ${failureHookResult.additionalContext}`;
|
|
|
133529
134242
|
this.setStatusInternal(
|
|
133530
134243
|
callId,
|
|
133531
134244
|
"cancelled",
|
|
133532
|
-
|
|
134245
|
+
createCancelledResponse(
|
|
133533
134246
|
scheduledCall.request,
|
|
133534
134247
|
cancelMessage,
|
|
134248
|
+
executionStatus,
|
|
133535
134249
|
failureHookArtifacts
|
|
133536
|
-
)
|
|
134250
|
+
)
|
|
133537
134251
|
);
|
|
133538
134252
|
setToolSpanCancelled(span);
|
|
133539
134253
|
return;
|
|
@@ -133567,13 +134281,30 @@ ${failureHookResult.additionalContext}`;
|
|
|
133567
134281
|
}
|
|
133568
134282
|
failureHookArtifacts = failureHookResult.artifacts;
|
|
133569
134283
|
}
|
|
134284
|
+
if (signal.aborted && !executionTimedOut) {
|
|
134285
|
+
this.setStatusInternal(
|
|
134286
|
+
callId,
|
|
134287
|
+
"cancelled",
|
|
134288
|
+
createCancelledResponse(
|
|
134289
|
+
scheduledCall.request,
|
|
134290
|
+
// The abort landed while the failure hook was running; the
|
|
134291
|
+
// tool's own outcome is still what `executionThrew` says.
|
|
134292
|
+
executionThrew ? TOOL_CANCELLED_BEFORE_COMPLETION_MESSAGE : TOOL_CANCELLED_AFTER_COMPLETION_MESSAGE,
|
|
134293
|
+
executionStatus,
|
|
134294
|
+
failureHookArtifacts
|
|
134295
|
+
)
|
|
134296
|
+
);
|
|
134297
|
+
setToolSpanCancelled(span);
|
|
134298
|
+
return;
|
|
134299
|
+
}
|
|
133570
134300
|
this.setStatusInternal(
|
|
133571
134301
|
callId,
|
|
133572
134302
|
"error",
|
|
133573
134303
|
createErrorResponse(
|
|
133574
134304
|
scheduledCall.request,
|
|
133575
134305
|
executionError instanceof Error ? new Error(exceptionErrorMessage) : new Error(String(executionError)),
|
|
133576
|
-
|
|
134306
|
+
exceptionErrorType,
|
|
134307
|
+
executionStatus,
|
|
133577
134308
|
failureHookArtifacts
|
|
133578
134309
|
)
|
|
133579
134310
|
);
|
|
@@ -133604,8 +134335,7 @@ ${failureHookResult.additionalContext}`;
|
|
|
133604
134335
|
}
|
|
133605
134336
|
let messageBus;
|
|
133606
134337
|
try {
|
|
133607
|
-
|
|
133608
|
-
messageBus = shouldFirePostToolBatch ? this.config.getMessageBus() : void 0;
|
|
134338
|
+
messageBus = this.postToolBatchEnabledForBatch ? this.config.getMessageBus() : void 0;
|
|
133609
134339
|
} catch (error) {
|
|
133610
134340
|
debugLogger122.warn(
|
|
133611
134341
|
`PostToolBatch hook setup failed: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -133619,7 +134349,7 @@ ${failureHookResult.additionalContext}`;
|
|
|
133619
134349
|
if (messageBus) {
|
|
133620
134350
|
const batchToolCalls = completedCalls.map(toPostToolBatchToolCall);
|
|
133621
134351
|
const permissionMode = this.config.getApprovalMode();
|
|
133622
|
-
const
|
|
134352
|
+
const fireBatchHook = /* @__PURE__ */ __name(() => this.withHookSpan(
|
|
133623
134353
|
{ hookEvent: "PostToolBatch", toolName: "batch" },
|
|
133624
134354
|
() => firePostToolBatchHook(
|
|
133625
134355
|
messageBus,
|
|
@@ -133641,15 +134371,28 @@ ${failureHookResult.additionalContext}`;
|
|
|
133641
134371
|
postBatchStop: r.shouldStop,
|
|
133642
134372
|
postBatchStopReason: r.shouldStop ? r.stopReason || "no reason given" : void 0
|
|
133643
134373
|
}
|
|
133644
|
-
);
|
|
134374
|
+
), "fireBatchHook");
|
|
134375
|
+
const batchParentSpan = this.postToolBatchSpanCallId ? this.toolSpans.get(this.postToolBatchSpanCallId) : void 0;
|
|
134376
|
+
const batchHookResult = await (batchParentSpan ? runInToolSpanContext(batchParentSpan, fireBatchHook) : fireBatchHook());
|
|
133645
134377
|
if (batchHookResult.shouldStop) {
|
|
134378
|
+
const stopMessage = batchHookResult.stopReason || "Execution stopped by PostToolBatch hook";
|
|
133646
134379
|
debugLogger122.info(
|
|
133647
134380
|
`PostToolBatch hook stopped batch (${completedCalls.length} calls): ${batchHookResult.stopReason || "no reason given"}`
|
|
133648
134381
|
);
|
|
133649
|
-
completedCalls = withPostToolBatchStop(
|
|
133650
|
-
|
|
133651
|
-
|
|
133652
|
-
)
|
|
134382
|
+
completedCalls = withPostToolBatchStop(completedCalls, stopMessage);
|
|
134383
|
+
const stoppedCall = completedCalls.at(-1);
|
|
134384
|
+
const stoppedSpan = stoppedCall ? this.toolSpans.get(stoppedCall.request.callId) : void 0;
|
|
134385
|
+
if (stoppedSpan) {
|
|
134386
|
+
setToolSpanFailure(
|
|
134387
|
+
stoppedSpan,
|
|
134388
|
+
TOOL_FAILURE_KIND_POST_HOOK_STOPPED,
|
|
134389
|
+
stopMessage
|
|
134390
|
+
);
|
|
134391
|
+
} else {
|
|
134392
|
+
debugLogger122.debug(
|
|
134393
|
+
`PostToolBatch stop: no tool span for stopped call ${stoppedCall?.request.callId}; post_hook_stopped not recorded`
|
|
134394
|
+
);
|
|
134395
|
+
}
|
|
133653
134396
|
}
|
|
133654
134397
|
completedCalls = withPostToolBatchAdditionalContext(
|
|
133655
134398
|
completedCalls,
|
|
@@ -133661,6 +134404,9 @@ ${failureHookResult.additionalContext}`;
|
|
|
133661
134404
|
);
|
|
133662
134405
|
}
|
|
133663
134406
|
completedCalls = await this.applyBatchOutputBudget(completedCalls);
|
|
134407
|
+
for (const call of completedCalls) {
|
|
134408
|
+
this.finalizeToolSpan(call.request.callId, true);
|
|
134409
|
+
}
|
|
133664
134410
|
for (const call of completedCalls) {
|
|
133665
134411
|
this.runtimeContentGeneratorViews.delete(call.request.callId);
|
|
133666
134412
|
logToolCall(this.config, new ToolCallEvent(call));
|
|
@@ -133671,13 +134417,15 @@ ${failureHookResult.additionalContext}`;
|
|
|
133671
134417
|
}
|
|
133672
134418
|
} finally {
|
|
133673
134419
|
try {
|
|
134420
|
+
for (const call of completedCalls) {
|
|
134421
|
+
this.finalizeToolSpan(call.request.callId, true);
|
|
134422
|
+
}
|
|
134423
|
+
this.postToolBatchEnabledForBatch = false;
|
|
134424
|
+
this.postToolBatchSpanCallId = void 0;
|
|
133674
134425
|
this.notifyToolCallsUpdate();
|
|
133675
134426
|
} finally {
|
|
133676
134427
|
this.isFinalizingToolCalls = false;
|
|
133677
|
-
|
|
133678
|
-
const next = this.requestQueue.shift();
|
|
133679
|
-
this._schedule(next.request, next.signal, next.runtimeView).then(next.resolve).catch(next.reject);
|
|
133680
|
-
}
|
|
134428
|
+
this.drainRequestQueueIfIdle();
|
|
133681
134429
|
}
|
|
133682
134430
|
}
|
|
133683
134431
|
}
|
|
@@ -133742,6 +134490,7 @@ ${failureHookResult.additionalContext}`;
|
|
|
133742
134490
|
const result = {
|
|
133743
134491
|
callId: call.request.callId,
|
|
133744
134492
|
status: call.status,
|
|
134493
|
+
executionStatus: call.response.executionStatus,
|
|
133745
134494
|
resultDisplay: call.response.resultDisplay,
|
|
133746
134495
|
...call.response.visionBridgeNotice !== void 0 ? { visionBridgeNotice: call.response.visionBridgeNotice } : {},
|
|
133747
134496
|
error: call.response.error,
|
|
@@ -133769,8 +134518,15 @@ ${failureHookResult.additionalContext}`;
|
|
|
133769
134518
|
}
|
|
133770
134519
|
}
|
|
133771
134520
|
notifyToolCallsUpdate() {
|
|
133772
|
-
if (this.onToolCallsUpdate) {
|
|
134521
|
+
if (!this.onToolCallsUpdate) {
|
|
134522
|
+
return;
|
|
134523
|
+
}
|
|
134524
|
+
try {
|
|
133773
134525
|
this.onToolCallsUpdate([...this.toolCalls]);
|
|
134526
|
+
} catch (error) {
|
|
134527
|
+
debugLogger122.error(
|
|
134528
|
+
`Tool call update observer failed: ${error instanceof Error ? error.message : String(error)}`
|
|
134529
|
+
);
|
|
133774
134530
|
}
|
|
133775
134531
|
}
|
|
133776
134532
|
setToolCallOutcome(callId, outcome) {
|
|
@@ -133793,6 +134549,9 @@ ${failureHookResult.additionalContext}`;
|
|
|
133793
134549
|
);
|
|
133794
134550
|
for (const pendingTool of pendingTools) {
|
|
133795
134551
|
try {
|
|
134552
|
+
if (this.cancelPreExecutionIfAborted(pendingTool.request.callId, signal)) {
|
|
134553
|
+
continue;
|
|
134554
|
+
}
|
|
133796
134555
|
const toolParams = pendingTool.invocation.params;
|
|
133797
134556
|
const flowResult = await runInRequestGoalContext(
|
|
133798
134557
|
pendingTool.request,
|
|
@@ -133803,6 +134562,9 @@ ${failureHookResult.additionalContext}`;
|
|
|
133803
134562
|
toolParams
|
|
133804
134563
|
)
|
|
133805
134564
|
);
|
|
134565
|
+
if (this.cancelPreExecutionIfAborted(pendingTool.request.callId, signal)) {
|
|
134566
|
+
continue;
|
|
134567
|
+
}
|
|
133806
134568
|
const { finalPermission, pmForcedAsk, pmCtx, requiresUserInteraction } = flowResult;
|
|
133807
134569
|
if (requiresUserInteraction) {
|
|
133808
134570
|
continue;
|
|
@@ -133830,6 +134592,9 @@ ${failureHookResult.additionalContext}`;
|
|
|
133830
134592
|
skipClassifierReason: fallback.fallback ? fallback.reason : void 0
|
|
133831
134593
|
})
|
|
133832
134594
|
);
|
|
134595
|
+
if (this.cancelPreExecutionIfAborted(pendingTool.request.callId, signal)) {
|
|
134596
|
+
continue;
|
|
134597
|
+
}
|
|
133833
134598
|
const outcome = applyAutoModeDecision(
|
|
133834
134599
|
decision,
|
|
133835
134600
|
this.config,
|
|
@@ -133854,6 +134619,9 @@ ${failureHookResult.additionalContext}`;
|
|
|
133854
134619
|
);
|
|
133855
134620
|
}
|
|
133856
134621
|
}
|
|
134622
|
+
if (this.cancelPreExecutionIfAborted(pendingTool.request.callId, signal)) {
|
|
134623
|
+
continue;
|
|
134624
|
+
}
|
|
133857
134625
|
switch (outcome.kind) {
|
|
133858
134626
|
case "approved":
|
|
133859
134627
|
this.setToolCallOutcome(
|
|
@@ -133874,7 +134642,8 @@ ${failureHookResult.additionalContext}`;
|
|
|
133874
134642
|
createErrorResponse(
|
|
133875
134643
|
pendingTool.request,
|
|
133876
134644
|
new Error(outcome.errorMessage),
|
|
133877
|
-
"execution_denied" /* EXECUTION_DENIED
|
|
134645
|
+
"execution_denied" /* EXECUTION_DENIED */,
|
|
134646
|
+
"not_started"
|
|
133878
134647
|
)
|
|
133879
134648
|
);
|
|
133880
134649
|
this.finalizeBlockedSpan(
|
|
@@ -133933,6 +134702,9 @@ ${failureHookResult.additionalContext}`;
|
|
|
133933
134702
|
);
|
|
133934
134703
|
}
|
|
133935
134704
|
} catch (error) {
|
|
134705
|
+
if (this.cancelPreExecutionIfAborted(pendingTool.request.callId, signal)) {
|
|
134706
|
+
continue;
|
|
134707
|
+
}
|
|
133936
134708
|
debugLogger122.error(
|
|
133937
134709
|
`Error checking confirmation for tool ${pendingTool.request.callId}:`,
|
|
133938
134710
|
error
|
|
@@ -138860,7 +139632,7 @@ async function runAutoMemoryExtractionByAgent(config, projectRoot) {
|
|
|
138860
139632
|
topicSummaries
|
|
138861
139633
|
),
|
|
138862
139634
|
systemPrompt: EXTRACTION_AGENT_SYSTEM_PROMPT,
|
|
138863
|
-
maxTurns: 5,
|
|
139635
|
+
maxTurns: config.getMemoryAgentMaxTurns() ?? 5,
|
|
138864
139636
|
maxTimeMinutes: config.getMemoryAgentTimeoutMinutes() ?? 2,
|
|
138865
139637
|
tools: [
|
|
138866
139638
|
ToolNames.READ_FILE,
|
|
@@ -142242,7 +143014,6 @@ var GeminiClient = class _GeminiClient {
|
|
|
142242
143014
|
skillsModified: this.skillsModifiedInSession,
|
|
142243
143015
|
enabled: autoSkillEnabled,
|
|
142244
143016
|
threshold: AUTO_SKILL_THRESHOLD,
|
|
142245
|
-
maxTurns: DEFAULT_AUTO_SKILL_MAX_TURNS,
|
|
142246
143017
|
confirmBeforePersist: this.config.getAutoSkillConfirmEnabled()
|
|
142247
143018
|
});
|
|
142248
143019
|
if (skillReviewResult.status === "scheduled") {
|
|
@@ -145613,6 +146384,7 @@ var Config = class _Config {
|
|
|
145613
146384
|
enableAutoSkill;
|
|
145614
146385
|
autoSkillConfirm;
|
|
145615
146386
|
memoryAgentTimeoutMinutes;
|
|
146387
|
+
memoryAgentMaxTurns;
|
|
145616
146388
|
fastModel;
|
|
145617
146389
|
webSearchSettings;
|
|
145618
146390
|
webSearchNoticeEmitted = false;
|
|
@@ -145928,6 +146700,7 @@ var Config = class _Config {
|
|
|
145928
146700
|
this.enableAutoSkill = params.enableAutoSkill ?? false;
|
|
145929
146701
|
this.autoSkillConfirm = params.autoSkillConfirm ?? true;
|
|
145930
146702
|
this.memoryAgentTimeoutMinutes = params.memoryAgentTimeoutMinutes !== void 0 && params.memoryAgentTimeoutMinutes >= 0 ? params.memoryAgentTimeoutMinutes : void 0;
|
|
146703
|
+
this.memoryAgentMaxTurns = params.memoryAgentMaxTurns !== void 0 && Number.isInteger(params.memoryAgentMaxTurns) && params.memoryAgentMaxTurns >= 0 ? params.memoryAgentMaxTurns : void 0;
|
|
145931
146704
|
this.fastModel = params.fastModel || void 0;
|
|
145932
146705
|
this.webSearchSettings = params.webSearch;
|
|
145933
146706
|
this.visionModel = params.visionModel || void 0;
|
|
@@ -149243,6 +150016,14 @@ var Config = class _Config {
|
|
|
149243
150016
|
getMemoryAgentTimeoutMinutes() {
|
|
149244
150017
|
return this.memoryAgentTimeoutMinutes;
|
|
149245
150018
|
}
|
|
150019
|
+
/**
|
|
150020
|
+
* Max turns for background memory agents. Resolves the
|
|
150021
|
+
* `memory.agentMaxTurns` setting. Unset means each agent's built-in default;
|
|
150022
|
+
* 0 disables the turn limit.
|
|
150023
|
+
*/
|
|
150024
|
+
getMemoryAgentMaxTurns() {
|
|
150025
|
+
return this.memoryAgentMaxTurns;
|
|
150026
|
+
}
|
|
149246
150027
|
getPreventSystemSleepEnabled() {
|
|
149247
150028
|
return this.preventSystemSleep && !this.isSafeMode();
|
|
149248
150029
|
}
|
|
@@ -149982,7 +150763,7 @@ var Config = class _Config {
|
|
|
149982
150763
|
}
|
|
149983
150764
|
if (!enabled) return;
|
|
149984
150765
|
registry.registerFactory(ToolNames.IMAGE_GEN, async () => {
|
|
149985
|
-
const { ImageGenTool } = await import("./image-gen-
|
|
150766
|
+
const { ImageGenTool } = await import("./image-gen-XLFJRDFA.js");
|
|
149986
150767
|
return new ImageGenTool(this);
|
|
149987
150768
|
});
|
|
149988
150769
|
}
|
|
@@ -150012,36 +150793,36 @@ var Config = class _Config {
|
|
|
150012
150793
|
if (options2?.forSubAgent) return;
|
|
150013
150794
|
const schema = this.jsonSchema;
|
|
150014
150795
|
await registerLazy(ToolNames.STRUCTURED_OUTPUT, async () => {
|
|
150015
|
-
const { SyntheticOutputTool } = await import("./syntheticOutput-
|
|
150796
|
+
const { SyntheticOutputTool } = await import("./syntheticOutput-BN7E626U.js");
|
|
150016
150797
|
return new SyntheticOutputTool(schema);
|
|
150017
150798
|
});
|
|
150018
150799
|
}, "registerStructuredOutputIfRequested");
|
|
150019
150800
|
const registerGoalWorkerTools = /* @__PURE__ */ __name(async () => {
|
|
150020
150801
|
if (options2?.forSubAgent) return;
|
|
150021
150802
|
await registerLazy(ToolNames.GET_GOAL, async () => {
|
|
150022
|
-
const { GetGoalTool } = await import("./goal-tools-
|
|
150803
|
+
const { GetGoalTool } = await import("./goal-tools-3AZKX5WQ.js");
|
|
150023
150804
|
return new GetGoalTool(this);
|
|
150024
150805
|
});
|
|
150025
150806
|
await registerLazy(ToolNames.UPDATE_GOAL, async () => {
|
|
150026
|
-
const { UpdateGoalTool } = await import("./goal-tools-
|
|
150807
|
+
const { UpdateGoalTool } = await import("./goal-tools-3AZKX5WQ.js");
|
|
150027
150808
|
return new UpdateGoalTool(this);
|
|
150028
150809
|
});
|
|
150029
150810
|
}, "registerGoalWorkerTools");
|
|
150030
150811
|
if (this.getBareMode()) {
|
|
150031
150812
|
await registerLazy(ToolNames.READ_FILE, async () => {
|
|
150032
|
-
const { ReadFileTool } = await import("./read-file-
|
|
150813
|
+
const { ReadFileTool } = await import("./read-file-IHXKC6D3.js");
|
|
150033
150814
|
return new ReadFileTool(this);
|
|
150034
150815
|
});
|
|
150035
150816
|
await registerLazy(ToolNames.EDIT, async () => {
|
|
150036
|
-
const { EditTool } = await import("./edit-
|
|
150817
|
+
const { EditTool } = await import("./edit-QSTJ353U.js");
|
|
150037
150818
|
return new EditTool(this);
|
|
150038
150819
|
});
|
|
150039
150820
|
await registerLazy(ToolNames.NOTEBOOK_EDIT, async () => {
|
|
150040
|
-
const { NotebookEditTool } = await import("./notebook-edit-
|
|
150821
|
+
const { NotebookEditTool } = await import("./notebook-edit-MALKVMST.js");
|
|
150041
150822
|
return new NotebookEditTool(this);
|
|
150042
150823
|
});
|
|
150043
150824
|
await registerLazy(ToolNames.SHELL, async () => {
|
|
150044
|
-
const { ShellTool: ShellTool2 } = await import("./shell-
|
|
150825
|
+
const { ShellTool: ShellTool2 } = await import("./shell-FQLEHJKT.js");
|
|
150045
150826
|
return new ShellTool2(this);
|
|
150046
150827
|
});
|
|
150047
150828
|
await registerGoalWorkerTools();
|
|
@@ -150053,43 +150834,43 @@ var Config = class _Config {
|
|
|
150053
150834
|
}
|
|
150054
150835
|
await registerGoalWorkerTools();
|
|
150055
150836
|
await registerLazy(ToolNames.TOOL_SEARCH, async () => {
|
|
150056
|
-
const { ToolSearchTool } = await import("./tool-search-
|
|
150837
|
+
const { ToolSearchTool } = await import("./tool-search-MFTNRTFA.js");
|
|
150057
150838
|
return new ToolSearchTool(this);
|
|
150058
150839
|
});
|
|
150059
150840
|
await registerLazy(ToolNames.READ_MCP_RESOURCE, async () => {
|
|
150060
|
-
const { ReadMcpResourceTool } = await import("./read-mcp-resource-
|
|
150841
|
+
const { ReadMcpResourceTool } = await import("./read-mcp-resource-RTSSEER5.js");
|
|
150061
150842
|
return new ReadMcpResourceTool(this);
|
|
150062
150843
|
});
|
|
150063
150844
|
await registerLazy(ToolNames.AGENT, async () => {
|
|
150064
|
-
const { AgentTool: AgentTool2 } = await import("./agent-
|
|
150845
|
+
const { AgentTool: AgentTool2 } = await import("./agent-W6IG55Q7.js");
|
|
150065
150846
|
return new AgentTool2(this);
|
|
150066
150847
|
});
|
|
150067
150848
|
await registerLazy(ToolNames.LIST_AGENTS, async () => {
|
|
150068
|
-
const { ListAgentsTool } = await import("./list-agents-
|
|
150849
|
+
const { ListAgentsTool } = await import("./list-agents-GC4BRET7.js");
|
|
150069
150850
|
return new ListAgentsTool(this);
|
|
150070
150851
|
});
|
|
150071
150852
|
await registerLazy(ToolNames.TASK_STOP, async () => {
|
|
150072
|
-
const { TaskStopTool } = await import("./task-stop-
|
|
150853
|
+
const { TaskStopTool } = await import("./task-stop-TNXRNAL2.js");
|
|
150073
150854
|
return new TaskStopTool(this);
|
|
150074
150855
|
});
|
|
150075
150856
|
await registerLazy(ToolNames.SEND_MESSAGE, async () => {
|
|
150076
|
-
const { SendMessageTool } = await import("./send-message-
|
|
150857
|
+
const { SendMessageTool } = await import("./send-message-TL6FIMMN.js");
|
|
150077
150858
|
return new SendMessageTool(this);
|
|
150078
150859
|
});
|
|
150079
150860
|
await registerLazy(ToolNames.SKILL, async () => {
|
|
150080
|
-
const { SkillTool } = await import("./skill-
|
|
150861
|
+
const { SkillTool } = await import("./skill-QAXTGG6F.js");
|
|
150081
150862
|
return new SkillTool(this);
|
|
150082
150863
|
});
|
|
150083
150864
|
await registerLazy(ToolNames.LS, async () => {
|
|
150084
|
-
const { LSTool } = await import("./ls-
|
|
150865
|
+
const { LSTool } = await import("./ls-63CC3NNX.js");
|
|
150085
150866
|
return new LSTool(this);
|
|
150086
150867
|
});
|
|
150087
150868
|
await registerLazy(ToolNames.READ_FILE, async () => {
|
|
150088
|
-
const { ReadFileTool } = await import("./read-file-
|
|
150869
|
+
const { ReadFileTool } = await import("./read-file-IHXKC6D3.js");
|
|
150089
150870
|
return new ReadFileTool(this);
|
|
150090
150871
|
});
|
|
150091
150872
|
await registerLazy(ToolNames.ZOOM_IMAGE, async () => {
|
|
150092
|
-
const { ZoomImageTool } = await import("./zoom-image-
|
|
150873
|
+
const { ZoomImageTool } = await import("./zoom-image-WLSVNK2C.js");
|
|
150093
150874
|
return new ZoomImageTool(this);
|
|
150094
150875
|
});
|
|
150095
150876
|
if (this.getUseRipgrep()) {
|
|
@@ -150104,7 +150885,7 @@ var Config = class _Config {
|
|
|
150104
150885
|
recordStartupEvent("config_initialize_ripgrep_probe_end");
|
|
150105
150886
|
if (useRipgrep) {
|
|
150106
150887
|
await registerLazy(ToolNames.GREP, async () => {
|
|
150107
|
-
const { RipGrepTool: RipGrepTool2 } = await import("./ripGrep-
|
|
150888
|
+
const { RipGrepTool: RipGrepTool2 } = await import("./ripGrep-7ASLNF5O.js");
|
|
150108
150889
|
return new RipGrepTool2(this);
|
|
150109
150890
|
});
|
|
150110
150891
|
} else {
|
|
@@ -150117,7 +150898,7 @@ var Config = class _Config {
|
|
|
150117
150898
|
)
|
|
150118
150899
|
);
|
|
150119
150900
|
await registerLazy(ToolNames.GREP, async () => {
|
|
150120
|
-
const { GrepTool } = await import("./grep-
|
|
150901
|
+
const { GrepTool } = await import("./grep-XFBSAUJW.js");
|
|
150121
150902
|
return new GrepTool(this);
|
|
150122
150903
|
});
|
|
150123
150904
|
}
|
|
@@ -150125,77 +150906,77 @@ var Config = class _Config {
|
|
|
150125
150906
|
recordStartupEvent("config_initialize_ripgrep_probe_start");
|
|
150126
150907
|
recordStartupEvent("config_initialize_ripgrep_probe_end");
|
|
150127
150908
|
await registerLazy(ToolNames.GREP, async () => {
|
|
150128
|
-
const { GrepTool } = await import("./grep-
|
|
150909
|
+
const { GrepTool } = await import("./grep-XFBSAUJW.js");
|
|
150129
150910
|
return new GrepTool(this);
|
|
150130
150911
|
});
|
|
150131
150912
|
}
|
|
150132
150913
|
await registerLazy(ToolNames.GLOB, async () => {
|
|
150133
|
-
const { GlobTool } = await import("./glob-
|
|
150914
|
+
const { GlobTool } = await import("./glob-4MLY2HOS.js");
|
|
150134
150915
|
return new GlobTool(this);
|
|
150135
150916
|
});
|
|
150136
150917
|
await registerLazy(ToolNames.EDIT, async () => {
|
|
150137
|
-
const { EditTool } = await import("./edit-
|
|
150918
|
+
const { EditTool } = await import("./edit-QSTJ353U.js");
|
|
150138
150919
|
return new EditTool(this);
|
|
150139
150920
|
});
|
|
150140
150921
|
await registerLazy(ToolNames.NOTEBOOK_EDIT, async () => {
|
|
150141
|
-
const { NotebookEditTool } = await import("./notebook-edit-
|
|
150922
|
+
const { NotebookEditTool } = await import("./notebook-edit-MALKVMST.js");
|
|
150142
150923
|
return new NotebookEditTool(this);
|
|
150143
150924
|
});
|
|
150144
150925
|
await registerLazy(ToolNames.WRITE_FILE, async () => {
|
|
150145
|
-
const { WriteFileTool: WriteFileTool2 } = await import("./write-file-
|
|
150926
|
+
const { WriteFileTool: WriteFileTool2 } = await import("./write-file-OHTP7KKV.js");
|
|
150146
150927
|
return new WriteFileTool2(this);
|
|
150147
150928
|
});
|
|
150148
150929
|
await registerLazy(ToolNames.SHELL, async () => {
|
|
150149
|
-
const { ShellTool: ShellTool2 } = await import("./shell-
|
|
150930
|
+
const { ShellTool: ShellTool2 } = await import("./shell-FQLEHJKT.js");
|
|
150150
150931
|
return new ShellTool2(this);
|
|
150151
150932
|
});
|
|
150152
150933
|
await registerLazy(ToolNames.TODO_WRITE, async () => {
|
|
150153
|
-
const { TodoWriteTool } = await import("./todoWrite-
|
|
150934
|
+
const { TodoWriteTool } = await import("./todoWrite-MHWHO5UO.js");
|
|
150154
150935
|
return new TodoWriteTool(this);
|
|
150155
150936
|
});
|
|
150156
150937
|
const supportsUserInteraction = resolveInteractionMode(this) !== "headless";
|
|
150157
150938
|
if (supportsUserInteraction) {
|
|
150158
150939
|
await registerLazy(ToolNames.ASK_USER_QUESTION, async () => {
|
|
150159
|
-
const { AskUserQuestionTool } = await import("./askUserQuestion-
|
|
150940
|
+
const { AskUserQuestionTool } = await import("./askUserQuestion-2EPPBPUZ.js");
|
|
150160
150941
|
return new AskUserQuestionTool(this);
|
|
150161
150942
|
});
|
|
150162
150943
|
}
|
|
150163
150944
|
if (!this.sdkMode && (supportsUserInteraction || options2?.forSubAgent)) {
|
|
150164
150945
|
await registerLazy(ToolNames.EXIT_PLAN_MODE, async () => {
|
|
150165
|
-
const { ExitPlanModeTool: ExitPlanModeTool2 } = await import("./exitPlanMode-
|
|
150946
|
+
const { ExitPlanModeTool: ExitPlanModeTool2 } = await import("./exitPlanMode-GCRUFTNX.js");
|
|
150166
150947
|
return new ExitPlanModeTool2(this);
|
|
150167
150948
|
});
|
|
150168
150949
|
}
|
|
150169
150950
|
if (!this.sdkMode && supportsUserInteraction) {
|
|
150170
150951
|
await registerLazy(ToolNames.ENTER_PLAN_MODE, async () => {
|
|
150171
|
-
const { EnterPlanModeTool } = await import("./enterPlanMode-
|
|
150952
|
+
const { EnterPlanModeTool } = await import("./enterPlanMode-OWFAGX5J.js");
|
|
150172
150953
|
return new EnterPlanModeTool(this);
|
|
150173
150954
|
});
|
|
150174
150955
|
}
|
|
150175
150956
|
await registerLazy(ToolNames.ENTER_WORKTREE, async () => {
|
|
150176
|
-
const { EnterWorktreeTool } = await import("./enter-worktree-
|
|
150957
|
+
const { EnterWorktreeTool } = await import("./enter-worktree-R73VWVFF.js");
|
|
150177
150958
|
return new EnterWorktreeTool(this);
|
|
150178
150959
|
});
|
|
150179
150960
|
await registerLazy(ToolNames.EXIT_WORKTREE, async () => {
|
|
150180
|
-
const { ExitWorktreeTool } = await import("./exit-worktree-
|
|
150961
|
+
const { ExitWorktreeTool } = await import("./exit-worktree-6O2324LA.js");
|
|
150181
150962
|
return new ExitWorktreeTool(this);
|
|
150182
150963
|
});
|
|
150183
150964
|
await registerLazy(ToolNames.WEB_FETCH, async () => {
|
|
150184
|
-
const { WebFetchTool } = await import("./web-fetch-
|
|
150965
|
+
const { WebFetchTool } = await import("./web-fetch-Y6VEJMFN.js");
|
|
150185
150966
|
return new WebFetchTool(this);
|
|
150186
150967
|
});
|
|
150187
150968
|
if (resolveInteractionMode(this) === "interactive" && !this.sdkMode && !this.getScreenReader() && !options2?.forSubAgent) {
|
|
150188
150969
|
await registerLazy(ToolNames.DISPLAY_IMAGE, async () => {
|
|
150189
|
-
const { DisplayImageTool } = await import("./display-image-
|
|
150970
|
+
const { DisplayImageTool } = await import("./display-image-GUJA352B.js");
|
|
150190
150971
|
return new DisplayImageTool(this);
|
|
150191
150972
|
});
|
|
150192
150973
|
}
|
|
150193
150974
|
if (this.webSearchSettings?.enabled) {
|
|
150194
|
-
const { evaluateWebSearchGate } = await import("./web-search-
|
|
150975
|
+
const { evaluateWebSearchGate } = await import("./web-search-BTKVYWOR.js");
|
|
150195
150976
|
const gate = evaluateWebSearchGate(this);
|
|
150196
150977
|
if (gate.ok) {
|
|
150197
150978
|
await registerLazy(ToolNames.WEB_SEARCH, async () => {
|
|
150198
|
-
const { WebSearchTool } = await import("./web-search-
|
|
150979
|
+
const { WebSearchTool } = await import("./web-search-BTKVYWOR.js");
|
|
150199
150980
|
return new WebSearchTool(this);
|
|
150200
150981
|
});
|
|
150201
150982
|
} else if (!this.webSearchNoticeEmitted && !options2?.forSubAgent) {
|
|
@@ -150206,83 +150987,83 @@ var Config = class _Config {
|
|
|
150206
150987
|
await this.registerImageGenerationTool(registry);
|
|
150207
150988
|
if (this.isArtifactEnabled()) {
|
|
150208
150989
|
await registerLazy(ToolNames.ARTIFACT, async () => {
|
|
150209
|
-
const { ArtifactTool } = await import("./artifact-tool-
|
|
150990
|
+
const { ArtifactTool } = await import("./artifact-tool-RROCCJDA.js");
|
|
150210
150991
|
return new ArtifactTool(this);
|
|
150211
150992
|
});
|
|
150212
150993
|
}
|
|
150213
150994
|
if (this.isRecordArtifactEnabled()) {
|
|
150214
150995
|
await registerLazy(ToolNames.RECORD_ARTIFACT, async () => {
|
|
150215
|
-
const { RecordArtifactTool } = await import("./record-artifact-
|
|
150996
|
+
const { RecordArtifactTool } = await import("./record-artifact-L3BAHQFN.js");
|
|
150216
150997
|
return new RecordArtifactTool();
|
|
150217
150998
|
});
|
|
150218
150999
|
}
|
|
150219
151000
|
if (this.isLspEnabled() && this.getLspClient()) {
|
|
150220
151001
|
await registerLazy(ToolNames.LSP, async () => {
|
|
150221
|
-
const { LspTool } = await import("./lsp-
|
|
151002
|
+
const { LspTool } = await import("./lsp-P6NVJVNT.js");
|
|
150222
151003
|
return new LspTool(this);
|
|
150223
151004
|
});
|
|
150224
151005
|
}
|
|
150225
151006
|
await registerStructuredOutputIfRequested();
|
|
150226
151007
|
if (this.isCronEnabled()) {
|
|
150227
151008
|
await registerLazy(ToolNames.CRON_CREATE, async () => {
|
|
150228
|
-
const { CronCreateTool } = await import("./cron-create-
|
|
151009
|
+
const { CronCreateTool } = await import("./cron-create-CCRIULJE.js");
|
|
150229
151010
|
return new CronCreateTool(this);
|
|
150230
151011
|
});
|
|
150231
151012
|
await registerLazy(ToolNames.CRON_LIST, async () => {
|
|
150232
|
-
const { CronListTool } = await import("./cron-list-
|
|
151013
|
+
const { CronListTool } = await import("./cron-list-QDBVCHRF.js");
|
|
150233
151014
|
return new CronListTool(this);
|
|
150234
151015
|
});
|
|
150235
151016
|
await registerLazy(ToolNames.CRON_DELETE, async () => {
|
|
150236
|
-
const { CronDeleteTool } = await import("./cron-delete-
|
|
151017
|
+
const { CronDeleteTool } = await import("./cron-delete-FCFW6BGP.js");
|
|
150237
151018
|
return new CronDeleteTool(this);
|
|
150238
151019
|
});
|
|
150239
151020
|
await registerLazy(ToolNames.LOOP_WAKEUP, async () => {
|
|
150240
|
-
const { LoopWakeupTool } = await import("./loop-wakeup-
|
|
151021
|
+
const { LoopWakeupTool } = await import("./loop-wakeup-SQQSBMEY.js");
|
|
150241
151022
|
return new LoopWakeupTool(this);
|
|
150242
151023
|
});
|
|
150243
151024
|
}
|
|
150244
151025
|
await registerLazy(ToolNames.CREATE_SUB_SESSION, async () => {
|
|
150245
|
-
const { CreateSubSessionTool } = await import("./create-sub-session-
|
|
151026
|
+
const { CreateSubSessionTool } = await import("./create-sub-session-6EWLAZD5.js");
|
|
150246
151027
|
return new CreateSubSessionTool(this);
|
|
150247
151028
|
});
|
|
150248
151029
|
if (this.isAgentTeamEnabled()) {
|
|
150249
151030
|
await registerLazy(ToolNames.TEAM_CREATE, async () => {
|
|
150250
|
-
const { TeamCreateTool } = await import("./team-create-
|
|
151031
|
+
const { TeamCreateTool } = await import("./team-create-7B5NKWA2.js");
|
|
150251
151032
|
return new TeamCreateTool(this);
|
|
150252
151033
|
});
|
|
150253
151034
|
await registerLazy(ToolNames.TEAM_DELETE, async () => {
|
|
150254
|
-
const { TeamDeleteTool } = await import("./team-delete-
|
|
151035
|
+
const { TeamDeleteTool } = await import("./team-delete-D2VMSDOT.js");
|
|
150255
151036
|
return new TeamDeleteTool(this);
|
|
150256
151037
|
});
|
|
150257
151038
|
await registerLazy(ToolNames.TEAM_PLAN_APPROVAL, async () => {
|
|
150258
|
-
const { TeamPlanApprovalTool } = await import("./team-plan-approval-
|
|
151039
|
+
const { TeamPlanApprovalTool } = await import("./team-plan-approval-J6TURTZC.js");
|
|
150259
151040
|
return new TeamPlanApprovalTool(this);
|
|
150260
151041
|
});
|
|
150261
151042
|
await registerLazy(ToolNames.TASK_CREATE, async () => {
|
|
150262
|
-
const { TaskCreateTool } = await import("./task-create-
|
|
151043
|
+
const { TaskCreateTool } = await import("./task-create-2X4UP4F3.js");
|
|
150263
151044
|
return new TaskCreateTool(this);
|
|
150264
151045
|
});
|
|
150265
151046
|
await registerLazy(ToolNames.TASK_UPDATE, async () => {
|
|
150266
|
-
const { TaskUpdateTool } = await import("./task-update-
|
|
151047
|
+
const { TaskUpdateTool } = await import("./task-update-VDUSN36E.js");
|
|
150267
151048
|
return new TaskUpdateTool(this);
|
|
150268
151049
|
});
|
|
150269
151050
|
await registerLazy(ToolNames.TASK_LIST, async () => {
|
|
150270
|
-
const { TaskListTool } = await import("./task-list-
|
|
151051
|
+
const { TaskListTool } = await import("./task-list-WOLJPZ64.js");
|
|
150271
151052
|
return new TaskListTool(this);
|
|
150272
151053
|
});
|
|
150273
151054
|
}
|
|
150274
151055
|
if (this.isWorkflowsEnabled()) {
|
|
150275
151056
|
await registerLazy(ToolNames.WORKFLOW, async () => {
|
|
150276
|
-
const { WorkflowTool } = await import("./workflow-
|
|
151057
|
+
const { WorkflowTool } = await import("./workflow-LWFOBFN3.js");
|
|
150277
151058
|
return new WorkflowTool(this);
|
|
150278
151059
|
});
|
|
150279
151060
|
}
|
|
150280
151061
|
if (this.isComputerUseEnabled()) {
|
|
150281
|
-
const { registerComputerUseTools } = await import("./computer-use-
|
|
151062
|
+
const { registerComputerUseTools } = await import("./computer-use-NFBEZ73C.js");
|
|
150282
151063
|
await registerComputerUseTools(registerLazy, this);
|
|
150283
151064
|
}
|
|
150284
151065
|
await registerLazy(ToolNames.MONITOR, async () => {
|
|
150285
|
-
const { MonitorTool } = await import("./monitor-
|
|
151066
|
+
const { MonitorTool } = await import("./monitor-Y7YAHCA6.js");
|
|
150286
151067
|
return new MonitorTool(this);
|
|
150287
151068
|
});
|
|
150288
151069
|
if (this.pendingMcpBudgetCallback) {
|
|
@@ -150722,7 +151503,6 @@ export {
|
|
|
150722
151503
|
findPlanModeEntryBatchBoundaryIndex,
|
|
150723
151504
|
finalizeToolResponses,
|
|
150724
151505
|
parseAndFormatApiError,
|
|
150725
|
-
StructuredToolError,
|
|
150726
151506
|
checkPriorRead,
|
|
150727
151507
|
PLAN_EXIT_APPROVED_LLM_CONTENT_PREFIXES,
|
|
150728
151508
|
ExitPlanModeTool,
|