newcraw 1.0.2 → 1.0.3
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/dist/REPL-CTTH53A7.js +50 -0
- package/dist/{acp-J4WDYGRX.js → acp-25PIN25O.js} +69 -40
- package/dist/acp-25PIN25O.js.map +7 -0
- package/dist/{agentsValidate-UBOER2IN.js → agentsValidate-BXDD54YP.js} +13 -10
- package/dist/{agentsValidate-UBOER2IN.js.map → agentsValidate-BXDD54YP.js.map} +1 -1
- package/dist/{ask-MGUO3L35.js → ask-EL4XAA5P.js} +62 -52
- package/dist/ask-EL4XAA5P.js.map +7 -0
- package/dist/{autoUpdater-2GS6LRPK.js → autoUpdater-DKMSJXWW.js} +5 -4
- package/dist/{chunk-2C43OXE7.js → chunk-2OVXJBJV.js} +38 -59
- package/dist/chunk-2OVXJBJV.js.map +7 -0
- package/dist/{chunk-53A4JHFW.js → chunk-3D3C7MRI.js} +23 -4
- package/dist/chunk-3D3C7MRI.js.map +7 -0
- package/dist/{chunk-VKI7ORIO.js → chunk-3ZQRACCP.js} +37 -18
- package/dist/{chunk-VKI7ORIO.js.map → chunk-3ZQRACCP.js.map} +1 -1
- package/dist/chunk-4A6CDBDH.js +822 -0
- package/dist/chunk-4A6CDBDH.js.map +7 -0
- package/dist/{chunk-VQSCECTS.js → chunk-53VETVCP.js} +6 -4
- package/dist/{chunk-VQSCECTS.js.map → chunk-53VETVCP.js.map} +1 -1
- package/dist/{chunk-WWDVA4NV.js → chunk-6WT3ZRYF.js} +22 -6
- package/dist/{chunk-WWDVA4NV.js.map → chunk-6WT3ZRYF.js.map} +1 -1
- package/dist/{chunk-RUXIBQ3B.js → chunk-7E2L7EH2.js} +4 -4
- package/dist/{chunk-VHS2MZQS.js → chunk-7PWVUHQ2.js} +9 -6
- package/dist/{chunk-VHS2MZQS.js.map → chunk-7PWVUHQ2.js.map} +1 -1
- package/dist/{chunk-2EFL22PV.js → chunk-ADJ4YEII.js} +7 -3
- package/dist/chunk-ADJ4YEII.js.map +7 -0
- package/dist/chunk-AKNZJBBU.js +372 -0
- package/dist/chunk-AKNZJBBU.js.map +7 -0
- package/dist/chunk-ALQSPHXV.js +135 -0
- package/dist/chunk-ALQSPHXV.js.map +7 -0
- package/dist/{chunk-XS6PU75S.js → chunk-APSIF3YK.js} +1 -1
- package/dist/{chunk-IM33F5CM.js → chunk-BMJ5XGFR.js} +1668 -1623
- package/dist/chunk-BMJ5XGFR.js.map +7 -0
- package/dist/chunk-BQCOSNM3.js +93 -0
- package/dist/chunk-BQCOSNM3.js.map +7 -0
- package/dist/{chunk-OJIMOLIC.js → chunk-BTCASL4X.js} +3621 -7413
- package/dist/chunk-BTCASL4X.js.map +7 -0
- package/dist/chunk-CHB5K4GI.js +107 -0
- package/dist/chunk-CHB5K4GI.js.map +7 -0
- package/dist/{chunk-QH2M65BR.js → chunk-D2FSAFMO.js} +7 -3
- package/dist/{chunk-QH2M65BR.js.map → chunk-D2FSAFMO.js.map} +1 -1
- package/dist/chunk-D4OZACS2.js +35 -0
- package/dist/{chunk-IIFUDVGS.js → chunk-ENLHVQCX.js} +310 -177
- package/dist/chunk-ENLHVQCX.js.map +7 -0
- package/dist/{chunk-A7X6OCZE.js → chunk-ERKWSZ3K.js} +1 -1
- package/dist/{chunk-UYRR6F5S.js → chunk-FSSZHQEJ.js} +9 -3
- package/dist/{chunk-UYRR6F5S.js.map → chunk-FSSZHQEJ.js.map} +1 -1
- package/dist/chunk-GV73HKJO.js +5473 -0
- package/dist/chunk-GV73HKJO.js.map +7 -0
- package/dist/{chunk-GZTCXXSS.js → chunk-GZ4BEVMZ.js} +57 -46
- package/dist/{chunk-GZTCXXSS.js.map → chunk-GZ4BEVMZ.js.map} +1 -1
- package/dist/chunk-HLBLZKZH.js +45 -0
- package/dist/chunk-HLBLZKZH.js.map +7 -0
- package/dist/chunk-JLVECHVJ.js +36 -0
- package/dist/chunk-JLVECHVJ.js.map +7 -0
- package/dist/chunk-KNSAVNMD.js +683 -0
- package/dist/{chunk-F3COCCAE.js.map → chunk-KNSAVNMD.js.map} +1 -1
- package/dist/{chunk-V5U6BHT2.js → chunk-KRN3WHHL.js} +7 -3
- package/dist/{chunk-V5U6BHT2.js.map → chunk-KRN3WHHL.js.map} +1 -1
- package/dist/{chunk-3LMXSKZ7.js → chunk-NFYAVT54.js} +1 -1
- package/dist/chunk-NT7RDVDA.js +33 -0
- package/dist/{chunk-KQSHIOZK.js.map → chunk-NT7RDVDA.js.map} +1 -1
- package/dist/chunk-NW7WSLD5.js +166 -0
- package/dist/{chunk-ZYSVG4X3.js.map → chunk-NW7WSLD5.js.map} +2 -2
- package/dist/{chunk-HSJ6HYAO.js → chunk-P52SGBC4.js} +18 -10
- package/dist/chunk-P52SGBC4.js.map +7 -0
- package/dist/{chunk-XXU2NVOE.js → chunk-PC6QOCGI.js} +30 -6
- package/dist/chunk-PC6QOCGI.js.map +7 -0
- package/dist/{chunk-N5OHRWG2.js → chunk-QSRXXZO7.js} +4 -2
- package/dist/{chunk-N5OHRWG2.js.map → chunk-QSRXXZO7.js.map} +1 -1
- package/dist/{chunk-DEF3KFP7.js → chunk-QZFKONA3.js} +4 -2
- package/dist/{chunk-DEF3KFP7.js.map → chunk-QZFKONA3.js.map} +1 -1
- package/dist/{chunk-JWXQNBBA.js → chunk-RE226X4F.js} +7 -1
- package/dist/{chunk-JWXQNBBA.js.map → chunk-RE226X4F.js.map} +1 -1
- package/dist/chunk-RF57YWGW.js +88 -0
- package/dist/chunk-RF57YWGW.js.map +7 -0
- package/dist/chunk-UGBECBIR.js +62 -0
- package/dist/chunk-UGBECBIR.js.map +7 -0
- package/dist/chunk-UYWZQVH5.js +35 -0
- package/dist/chunk-UYWZQVH5.js.map +7 -0
- package/dist/{chunk-LOIZNQOU.js → chunk-VHZRJ7RI.js} +9 -3
- package/dist/{chunk-LOIZNQOU.js.map → chunk-VHZRJ7RI.js.map} +1 -1
- package/dist/{chunk-XMGUQHMF.js → chunk-VSSVN6WG.js} +11 -1
- package/dist/chunk-VSSVN6WG.js.map +7 -0
- package/dist/{chunk-OZHBEG7U.js → chunk-XV7LPJNT.js} +15 -5
- package/dist/{chunk-OZHBEG7U.js.map → chunk-XV7LPJNT.js.map} +1 -1
- package/dist/chunk-Y7MDOB3N.js +65 -0
- package/dist/chunk-Y7MDOB3N.js.map +7 -0
- package/dist/{chunk-BWYKUDJR.js → chunk-ZLAB3Z4G.js} +14 -8
- package/dist/{chunk-BWYKUDJR.js.map → chunk-ZLAB3Z4G.js.map} +1 -1
- package/dist/{chunk-755HIAI3.js → chunk-ZMO4E7IW.js} +3 -42
- package/dist/chunk-ZMO4E7IW.js.map +7 -0
- package/dist/{cli-KZGF3FV5.js → cli-Z2BNJWHT.js} +251 -485
- package/dist/cli-Z2BNJWHT.js.map +7 -0
- package/dist/commands-3Y3OQOXT.js +54 -0
- package/dist/{config-GTJWCNPF.js → config-5RS7HDIK.js} +9 -6
- package/dist/{context-WF3TTXQU.js → context-XZXRRYKS.js} +8 -7
- package/dist/{costTracker-2G3ZI2JF.js → costTracker-VSWW7SRT.js} +3 -2
- package/dist/{customCommands-QOWK57EX.js → customCommands-6KDAODFQ.js} +6 -5
- package/dist/{env-37BAP7QF.js → env-WIM2DQ4L.js} +10 -7
- package/dist/{gateway-IZYO6YFJ.js → gateway-DKHC7H3K.js} +542 -96
- package/dist/gateway-DKHC7H3K.js.map +7 -0
- package/dist/identity-3KZQQVBG.js +16 -0
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/{kodeAgentSessionId-KTGFX2BE.js → kodeAgentSessionId-4SH24DVH.js} +1 -1
- package/dist/{kodeAgentSessionLoad-6F7SJXBC.js → kodeAgentSessionLoad-4S452GGD.js} +6 -5
- package/dist/{kodeAgentSessionResume-UEEDRJ3N.js → kodeAgentSessionResume-MSMG4QUR.js} +6 -5
- package/dist/{kodeAgentStreamJson-VIXFTYL5.js → kodeAgentStreamJson-4ZKIWKS3.js} +4 -2
- package/dist/{kodeAgentStreamJsonSession-XC3IPREZ.js → kodeAgentStreamJsonSession-CYG6MLKP.js} +15 -4
- package/dist/kodeAgentStreamJsonSession-CYG6MLKP.js.map +7 -0
- package/dist/{kodeAgentStructuredStdio-SI5C7AAD.js → kodeAgentStructuredStdio-5DCUC6V6.js} +3 -3
- package/dist/{kodeHooks-V36SHCTC.js → kodeHooks-WX3N6CL6.js} +6 -5
- package/dist/{llm-CYUDKJNR.js → llm-V2W4KJIA.js} +239 -57
- package/dist/llm-V2W4KJIA.js.map +7 -0
- package/dist/{llmLazy-IXVVBRTN.js → llmLazy-I7SO67YA.js} +2 -2
- package/dist/{loader-OEJ6C3TN.js → loader-YJGRGJNH.js} +6 -5
- package/dist/{mcp-KE3SILMX.js → mcp-WG3RQQCZ.js} +10 -9
- package/dist/{mentionProcessor-GAU2WAYB.js → mentionProcessor-PKWDUKTN.js} +14 -7
- package/dist/{mentionProcessor-GAU2WAYB.js.map → mentionProcessor-PKWDUKTN.js.map} +1 -1
- package/dist/{messages-WCSGGSEU.js → messages-RXHQ6VKL.js} +2 -2
- package/dist/{model-4TQIV5J2.js → model-JNWAZGT7.js} +10 -7
- package/dist/{openai-KTZV6F7N.js → openai-6NL5UXO7.js} +8 -7
- package/dist/{outputStyles-WX5RYQOA.js → outputStyles-BVPXT3MW.js} +6 -5
- package/dist/{pluginRuntime-JXMJZ2LC.js → pluginRuntime-XHI3TCRJ.js} +11 -8
- package/dist/{pluginRuntime-JXMJZ2LC.js.map → pluginRuntime-XHI3TCRJ.js.map} +1 -1
- package/dist/{pluginValidation-JNQZYLUP.js → pluginValidation-WDFL352C.js} +8 -7
- package/dist/prompts-C4RUFGX2.js +58 -0
- package/dist/query-IA3UKMGR.js +58 -0
- package/dist/{responsesStreaming-2AIT6GHG.js → responsesStreaming-JORGEFQC.js} +1 -1
- package/dist/{ripgrep-KDPQAMB2.js → ripgrep-BHDXRABJ.js} +5 -4
- package/dist/sandbox-QOXESHL4.js +63 -0
- package/dist/{skillMarketplace-IXAGP3Q2.js → skillMarketplace-RIAMO2YA.js} +5 -4
- package/dist/{state-MSCYLB6Y.js → state-TM2XZQE2.js} +6 -3
- package/dist/structuredOutput-KAVFUV2Z.js +9 -0
- package/dist/theme-BXUQNXSD.js +15 -0
- package/dist/thinking-BCZ4WDT6.js +18 -0
- package/dist/{toolPermissionContext-I3IXPVED.js → toolPermissionContext-JCQ5MFUT.js} +1 -1
- package/dist/toolPermissionContext-JCQ5MFUT.js.map +7 -0
- package/dist/toolPermissionContextState-ILRPUITK.js +24 -0
- package/dist/toolPermissionContextState-ILRPUITK.js.map +7 -0
- package/dist/{toolPermissionSettings-EUZKGZU2.js → toolPermissionSettings-LNYZ6XFE.js} +9 -8
- package/dist/toolPermissionSettings-LNYZ6XFE.js.map +7 -0
- package/dist/tools-HIPUGTF5.js +55 -0
- package/dist/tools-HIPUGTF5.js.map +7 -0
- package/dist/{userInput-LJL4CVOB.js → userInput-I33T2RX2.js} +49 -34
- package/dist/{userInput-LJL4CVOB.js.map → userInput-I33T2RX2.js.map} +1 -1
- package/dist/{uuid-VA3KVASX.js → uuid-RQH3OZ3W.js} +1 -1
- package/dist/uuid-RQH3OZ3W.js.map +7 -0
- package/dist/workspace-EP63OB5S.js +21 -0
- package/dist/workspace-EP63OB5S.js.map +7 -0
- package/package.json +1 -1
- package/web/dist/assets/index-XuLVvSQF.js +251 -0
- package/web/dist/assets/index-pSid9IlY.css +10 -0
- package/web/dist/index.html +2 -2
- package/dist/REPL-IAK7ZN2Z.js +0 -42
- package/dist/acp-J4WDYGRX.js.map +0 -7
- package/dist/ask-MGUO3L35.js.map +0 -7
- package/dist/chunk-2C43OXE7.js.map +0 -7
- package/dist/chunk-2EFL22PV.js.map +0 -7
- package/dist/chunk-53A4JHFW.js.map +0 -7
- package/dist/chunk-755HIAI3.js.map +0 -7
- package/dist/chunk-AXWJI6N5.js +0 -11
- package/dist/chunk-F3COCCAE.js +0 -654
- package/dist/chunk-HSJ6HYAO.js.map +0 -7
- package/dist/chunk-IIFUDVGS.js.map +0 -7
- package/dist/chunk-IM33F5CM.js.map +0 -7
- package/dist/chunk-KQSHIOZK.js +0 -24
- package/dist/chunk-OJIMOLIC.js.map +0 -7
- package/dist/chunk-XMGUQHMF.js.map +0 -7
- package/dist/chunk-XXU2NVOE.js.map +0 -7
- package/dist/chunk-ZYSVG4X3.js +0 -151
- package/dist/cli-KZGF3FV5.js.map +0 -7
- package/dist/commands-AVEBLFVS.js +0 -46
- package/dist/gateway-IZYO6YFJ.js.map +0 -7
- package/dist/kodeAgentStreamJsonSession-XC3IPREZ.js.map +0 -7
- package/dist/llm-CYUDKJNR.js.map +0 -7
- package/dist/prompts-LE6GK75N.js +0 -48
- package/dist/query-GGIP6PWG.js +0 -50
- package/dist/theme-GAMFOLBW.js +0 -14
- package/dist/tools-3HOUIDM3.js +0 -47
- package/web/dist/assets/index-COAJqX1Z.css +0 -1
- package/web/dist/assets/index-CzS_4LmC.js +0 -179
- /package/dist/{REPL-IAK7ZN2Z.js.map → REPL-CTTH53A7.js.map} +0 -0
- /package/dist/{autoUpdater-2GS6LRPK.js.map → autoUpdater-DKMSJXWW.js.map} +0 -0
- /package/dist/{chunk-RUXIBQ3B.js.map → chunk-7E2L7EH2.js.map} +0 -0
- /package/dist/{chunk-XS6PU75S.js.map → chunk-APSIF3YK.js.map} +0 -0
- /package/dist/{chunk-AXWJI6N5.js.map → chunk-D4OZACS2.js.map} +0 -0
- /package/dist/{chunk-A7X6OCZE.js.map → chunk-ERKWSZ3K.js.map} +0 -0
- /package/dist/{chunk-3LMXSKZ7.js.map → chunk-NFYAVT54.js.map} +0 -0
- /package/dist/{commands-AVEBLFVS.js.map → commands-3Y3OQOXT.js.map} +0 -0
- /package/dist/{config-GTJWCNPF.js.map → config-5RS7HDIK.js.map} +0 -0
- /package/dist/{context-WF3TTXQU.js.map → context-XZXRRYKS.js.map} +0 -0
- /package/dist/{costTracker-2G3ZI2JF.js.map → costTracker-VSWW7SRT.js.map} +0 -0
- /package/dist/{customCommands-QOWK57EX.js.map → customCommands-6KDAODFQ.js.map} +0 -0
- /package/dist/{env-37BAP7QF.js.map → env-WIM2DQ4L.js.map} +0 -0
- /package/dist/{kodeAgentSessionId-KTGFX2BE.js.map → identity-3KZQQVBG.js.map} +0 -0
- /package/dist/{kodeAgentSessionLoad-6F7SJXBC.js.map → kodeAgentSessionId-4SH24DVH.js.map} +0 -0
- /package/dist/{kodeAgentSessionResume-UEEDRJ3N.js.map → kodeAgentSessionLoad-4S452GGD.js.map} +0 -0
- /package/dist/{kodeAgentStreamJson-VIXFTYL5.js.map → kodeAgentSessionResume-MSMG4QUR.js.map} +0 -0
- /package/dist/{kodeAgentStructuredStdio-SI5C7AAD.js.map → kodeAgentStreamJson-4ZKIWKS3.js.map} +0 -0
- /package/dist/{kodeHooks-V36SHCTC.js.map → kodeAgentStructuredStdio-5DCUC6V6.js.map} +0 -0
- /package/dist/{llmLazy-IXVVBRTN.js.map → kodeHooks-WX3N6CL6.js.map} +0 -0
- /package/dist/{loader-OEJ6C3TN.js.map → llmLazy-I7SO67YA.js.map} +0 -0
- /package/dist/{mcp-KE3SILMX.js.map → loader-YJGRGJNH.js.map} +0 -0
- /package/dist/{messages-WCSGGSEU.js.map → mcp-WG3RQQCZ.js.map} +0 -0
- /package/dist/{model-4TQIV5J2.js.map → messages-RXHQ6VKL.js.map} +0 -0
- /package/dist/{openai-KTZV6F7N.js.map → model-JNWAZGT7.js.map} +0 -0
- /package/dist/{outputStyles-WX5RYQOA.js.map → openai-6NL5UXO7.js.map} +0 -0
- /package/dist/{pluginValidation-JNQZYLUP.js.map → outputStyles-BVPXT3MW.js.map} +0 -0
- /package/dist/{prompts-LE6GK75N.js.map → pluginValidation-WDFL352C.js.map} +0 -0
- /package/dist/{query-GGIP6PWG.js.map → prompts-C4RUFGX2.js.map} +0 -0
- /package/dist/{responsesStreaming-2AIT6GHG.js.map → query-IA3UKMGR.js.map} +0 -0
- /package/dist/{ripgrep-KDPQAMB2.js.map → responsesStreaming-JORGEFQC.js.map} +0 -0
- /package/dist/{skillMarketplace-IXAGP3Q2.js.map → ripgrep-BHDXRABJ.js.map} +0 -0
- /package/dist/{state-MSCYLB6Y.js.map → sandbox-QOXESHL4.js.map} +0 -0
- /package/dist/{theme-GAMFOLBW.js.map → skillMarketplace-RIAMO2YA.js.map} +0 -0
- /package/dist/{toolPermissionContext-I3IXPVED.js.map → state-TM2XZQE2.js.map} +0 -0
- /package/dist/{toolPermissionSettings-EUZKGZU2.js.map → structuredOutput-KAVFUV2Z.js.map} +0 -0
- /package/dist/{tools-3HOUIDM3.js.map → theme-BXUQNXSD.js.map} +0 -0
- /package/dist/{uuid-VA3KVASX.js.map → thinking-BCZ4WDT6.js.map} +0 -0
|
@@ -3,45 +3,51 @@ const require = __newcrawCreateRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
getToolDescription
|
|
5
5
|
} from "./chunk-T25Z3JMG.js";
|
|
6
|
+
import {
|
|
7
|
+
isProviderAvailable,
|
|
8
|
+
markProviderFailure,
|
|
9
|
+
markProviderSuccess,
|
|
10
|
+
selectAvailableProvider
|
|
11
|
+
} from "./chunk-ALQSPHXV.js";
|
|
6
12
|
import {
|
|
7
13
|
processResponsesStream
|
|
8
14
|
} from "./chunk-BHNQGSLO.js";
|
|
15
|
+
import {
|
|
16
|
+
structuredOutputConfig
|
|
17
|
+
} from "./chunk-BQCOSNM3.js";
|
|
9
18
|
import {
|
|
10
19
|
formatSystemPromptWithContext,
|
|
11
20
|
generateKodeContext,
|
|
12
21
|
getCLISyspromptPrefix,
|
|
13
|
-
getReasoningEffort,
|
|
14
|
-
models_default,
|
|
15
22
|
refreshKodeContext
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-BTCASL4X.js";
|
|
24
|
+
import {
|
|
25
|
+
models_default
|
|
26
|
+
} from "./chunk-GV73HKJO.js";
|
|
27
|
+
import "./chunk-53VETVCP.js";
|
|
28
|
+
import "./chunk-NFYAVT54.js";
|
|
29
|
+
import "./chunk-APSIF3YK.js";
|
|
30
|
+
import "./chunk-PC6QOCGI.js";
|
|
23
31
|
import "./chunk-JX5ZQYTQ.js";
|
|
24
32
|
import {
|
|
25
33
|
setRequestStatus
|
|
26
34
|
} from "./chunk-XJQATPV7.js";
|
|
27
|
-
import "./chunk-V5U6BHT2.js";
|
|
28
|
-
import "./chunk-7ZFLZNOW.js";
|
|
29
|
-
import "./chunk-VHS2MZQS.js";
|
|
30
35
|
import {
|
|
31
36
|
getCompletionWithProfile,
|
|
32
37
|
getGPT5CompletionWithProfile
|
|
33
|
-
} from "./chunk-
|
|
34
|
-
import
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
import "./chunk-
|
|
38
|
-
import "./chunk-
|
|
38
|
+
} from "./chunk-D2FSAFMO.js";
|
|
39
|
+
import {
|
|
40
|
+
getReasoningEffort
|
|
41
|
+
} from "./chunk-Y7MDOB3N.js";
|
|
42
|
+
import "./chunk-7E2L7EH2.js";
|
|
43
|
+
import "./chunk-6WT3ZRYF.js";
|
|
44
|
+
import "./chunk-P52SGBC4.js";
|
|
45
|
+
import "./chunk-UGBECBIR.js";
|
|
46
|
+
import "./chunk-ZLAB3Z4G.js";
|
|
39
47
|
import "./chunk-U7S4MEYP.js";
|
|
40
|
-
import "./chunk-
|
|
48
|
+
import "./chunk-FSSZHQEJ.js";
|
|
41
49
|
import "./chunk-TY3CCSAT.js";
|
|
42
|
-
import "./chunk-
|
|
43
|
-
import "./chunk-INJSFEKL.js";
|
|
44
|
-
import "./chunk-2UO3BFZH.js";
|
|
50
|
+
import "./chunk-VHZRJ7RI.js";
|
|
45
51
|
import {
|
|
46
52
|
API_ERROR_MESSAGE_PREFIX,
|
|
47
53
|
CREDIT_BALANCE_TOO_LOW_ERROR_MESSAGE,
|
|
@@ -51,41 +57,65 @@ import {
|
|
|
51
57
|
PROMPT_TOO_LONG_ERROR_MESSAGE,
|
|
52
58
|
createAssistantAPIErrorMessage,
|
|
53
59
|
normalizeContentFromAPI
|
|
54
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-ERKWSZ3K.js";
|
|
61
|
+
import "./chunk-RE226X4F.js";
|
|
62
|
+
import "./chunk-4A6CDBDH.js";
|
|
63
|
+
import "./chunk-KRN3WHHL.js";
|
|
64
|
+
import "./chunk-7ZFLZNOW.js";
|
|
65
|
+
import "./chunk-7PWVUHQ2.js";
|
|
66
|
+
import "./chunk-INJSFEKL.js";
|
|
67
|
+
import "./chunk-ADJ4YEII.js";
|
|
68
|
+
import "./chunk-JLVECHVJ.js";
|
|
69
|
+
import "./chunk-2OVXJBJV.js";
|
|
70
|
+
import "./chunk-2UO3BFZH.js";
|
|
71
|
+
import "./chunk-CHB5K4GI.js";
|
|
55
72
|
import {
|
|
56
73
|
USE_BEDROCK,
|
|
57
74
|
USE_VERTEX,
|
|
58
75
|
getModelManager,
|
|
59
|
-
getVertexRegionForModel
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
import "./chunk-
|
|
76
|
+
getVertexRegionForModel,
|
|
77
|
+
init_model
|
|
78
|
+
} from "./chunk-KNSAVNMD.js";
|
|
79
|
+
import "./chunk-3D3C7MRI.js";
|
|
80
|
+
import "./chunk-QZFKONA3.js";
|
|
63
81
|
import {
|
|
64
82
|
getAnthropicApiKey,
|
|
65
|
-
getGlobalConfig
|
|
66
|
-
|
|
67
|
-
|
|
83
|
+
getGlobalConfig,
|
|
84
|
+
init_config
|
|
85
|
+
} from "./chunk-ENLHVQCX.js";
|
|
86
|
+
import "./chunk-NT7RDVDA.js";
|
|
68
87
|
import {
|
|
69
88
|
debug,
|
|
70
89
|
getCurrentRequest,
|
|
90
|
+
init_debugLogger,
|
|
71
91
|
logErrorWithDiagnosis,
|
|
72
92
|
logLLMInteraction,
|
|
73
93
|
logSystemPromptConstruction,
|
|
74
94
|
markPhase
|
|
75
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-GZ4BEVMZ.js";
|
|
76
96
|
import {
|
|
77
|
-
PRODUCT_COMMAND,
|
|
78
97
|
env,
|
|
79
98
|
getCwd,
|
|
99
|
+
init_env,
|
|
100
|
+
init_log,
|
|
101
|
+
init_state,
|
|
80
102
|
logError
|
|
81
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-BMJ5XGFR.js";
|
|
82
104
|
import {
|
|
83
|
-
|
|
84
|
-
|
|
105
|
+
PRODUCT_COMMAND,
|
|
106
|
+
init_product
|
|
107
|
+
} from "./chunk-UYWZQVH5.js";
|
|
108
|
+
import {
|
|
109
|
+
MACRO,
|
|
110
|
+
init_macros
|
|
111
|
+
} from "./chunk-NW7WSLD5.js";
|
|
85
112
|
import {
|
|
86
113
|
addToTotalCost
|
|
87
|
-
} from "./chunk-
|
|
88
|
-
import "./chunk-
|
|
114
|
+
} from "./chunk-ZMO4E7IW.js";
|
|
115
|
+
import "./chunk-HLBLZKZH.js";
|
|
116
|
+
import {
|
|
117
|
+
__require
|
|
118
|
+
} from "./chunk-D4OZACS2.js";
|
|
89
119
|
|
|
90
120
|
// src/services/ai/llm.ts
|
|
91
121
|
import "@anthropic-ai/sdk/shims/node";
|
|
@@ -95,11 +125,17 @@ import { AnthropicVertex } from "@anthropic-ai/vertex-sdk";
|
|
|
95
125
|
import chalk from "chalk";
|
|
96
126
|
import { randomUUID } from "crypto";
|
|
97
127
|
import "dotenv/config";
|
|
128
|
+
init_config();
|
|
129
|
+
init_log();
|
|
98
130
|
|
|
99
131
|
// src/utils/system/http.ts
|
|
132
|
+
init_macros();
|
|
133
|
+
init_product();
|
|
100
134
|
var USER_AGENT = `${PRODUCT_COMMAND}/${MACRO.VERSION} (${process.env.USER_TYPE})`;
|
|
101
135
|
|
|
102
136
|
// src/services/system/vcr.ts
|
|
137
|
+
init_env();
|
|
138
|
+
init_state();
|
|
103
139
|
import { createHash } from "crypto";
|
|
104
140
|
import { mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
105
141
|
import { dirname } from "path";
|
|
@@ -229,6 +265,8 @@ function hydrateValue(s) {
|
|
|
229
265
|
}
|
|
230
266
|
|
|
231
267
|
// src/services/ai/llm.ts
|
|
268
|
+
init_debugLogger();
|
|
269
|
+
init_model();
|
|
232
270
|
import { zodToJsonSchema as zodToJsonSchema4 } from "zod-to-json-schema";
|
|
233
271
|
|
|
234
272
|
// src/services/ai/adapters/base.ts
|
|
@@ -295,6 +333,8 @@ var ModelAPIAdapter = class {
|
|
|
295
333
|
};
|
|
296
334
|
|
|
297
335
|
// src/services/ai/adapters/openaiAdapter.ts
|
|
336
|
+
init_debugLogger();
|
|
337
|
+
init_log();
|
|
298
338
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
299
339
|
var OpenAIAdapter = class extends ModelAPIAdapter {
|
|
300
340
|
constructor(capabilities, modelProfile) {
|
|
@@ -465,6 +505,8 @@ var OpenAIAdapter = class extends ModelAPIAdapter {
|
|
|
465
505
|
|
|
466
506
|
// src/services/ai/adapters/responsesAPI.ts
|
|
467
507
|
import { zodToJsonSchema as zodToJsonSchema2 } from "zod-to-json-schema";
|
|
508
|
+
init_debugLogger();
|
|
509
|
+
init_log();
|
|
468
510
|
var ResponsesAPIAdapter = class extends OpenAIAdapter {
|
|
469
511
|
createRequest(params) {
|
|
470
512
|
const {
|
|
@@ -530,6 +572,8 @@ var ResponsesAPIAdapter = class extends OpenAIAdapter {
|
|
|
530
572
|
return request;
|
|
531
573
|
}
|
|
532
574
|
buildTools(tools) {
|
|
575
|
+
const provider = this.modelProfile.provider || "openai";
|
|
576
|
+
const config = structuredOutputConfig(provider);
|
|
533
577
|
return tools.map((tool) => {
|
|
534
578
|
let parameters = tool.inputJSONSchema;
|
|
535
579
|
if (!parameters && tool.inputSchema) {
|
|
@@ -555,7 +599,8 @@ var ResponsesAPIAdapter = class extends OpenAIAdapter {
|
|
|
555
599
|
type: "function",
|
|
556
600
|
name: tool.name,
|
|
557
601
|
description: getToolDescription(tool),
|
|
558
|
-
parameters: parameters || { type: "object", properties: {} }
|
|
602
|
+
parameters: parameters || { type: "object", properties: {} },
|
|
603
|
+
...config.enableStrictTools ? { strict: true } : {}
|
|
559
604
|
};
|
|
560
605
|
});
|
|
561
606
|
}
|
|
@@ -715,7 +760,7 @@ ${reasoningContent}
|
|
|
715
760
|
return state;
|
|
716
761
|
}
|
|
717
762
|
async parseStreamingOpenAIResponse(response) {
|
|
718
|
-
const { processResponsesStream: processResponsesStream2 } = await import("./responsesStreaming-
|
|
763
|
+
const { processResponsesStream: processResponsesStream2 } = await import("./responsesStreaming-JORGEFQC.js");
|
|
719
764
|
return await processResponsesStream2(
|
|
720
765
|
this.parseStreamingResponse(response),
|
|
721
766
|
Date.now(),
|
|
@@ -915,12 +960,15 @@ var ChatCompletionsAdapter = class extends OpenAIAdapter {
|
|
|
915
960
|
return request;
|
|
916
961
|
}
|
|
917
962
|
buildTools(tools) {
|
|
963
|
+
const provider = this.modelProfile.provider || "openai";
|
|
964
|
+
const config = structuredOutputConfig(provider);
|
|
918
965
|
return tools.map((tool) => ({
|
|
919
966
|
type: "function",
|
|
920
967
|
function: {
|
|
921
968
|
name: tool.name,
|
|
922
969
|
description: getToolDescription(tool),
|
|
923
|
-
parameters: tool.inputJSONSchema || zodToJsonSchema3(tool.inputSchema)
|
|
970
|
+
parameters: tool.inputJSONSchema || zodToJsonSchema3(tool.inputSchema),
|
|
971
|
+
...config.enableStrictTools ? { strict: true } : {}
|
|
924
972
|
}
|
|
925
973
|
}));
|
|
926
974
|
}
|
|
@@ -1389,6 +1437,8 @@ function getConversationId(agentId, messageId) {
|
|
|
1389
1437
|
}
|
|
1390
1438
|
|
|
1391
1439
|
// src/services/ai/llm.ts
|
|
1440
|
+
init_model();
|
|
1441
|
+
init_model();
|
|
1392
1442
|
import { nanoid } from "nanoid";
|
|
1393
1443
|
|
|
1394
1444
|
// src/utils/tooling/toolUsePartialJson.ts
|
|
@@ -2016,7 +2066,33 @@ async function handleMessageStream(stream, signal) {
|
|
|
2016
2066
|
usage
|
|
2017
2067
|
};
|
|
2018
2068
|
}
|
|
2019
|
-
|
|
2069
|
+
var ToolCallParseError = class extends Error {
|
|
2070
|
+
constructor(toolName, rawArguments, parseError) {
|
|
2071
|
+
super(`Failed to parse tool call arguments for "${toolName}": ${parseError instanceof Error ? parseError.message : String(parseError)}`);
|
|
2072
|
+
this.toolName = toolName;
|
|
2073
|
+
this.rawArguments = rawArguments;
|
|
2074
|
+
this.parseError = parseError;
|
|
2075
|
+
this.name = "ToolCallParseError";
|
|
2076
|
+
}
|
|
2077
|
+
};
|
|
2078
|
+
function validateToolArgsWithSchema(toolArgs, toolDef) {
|
|
2079
|
+
if (!toolDef) return { valid: true };
|
|
2080
|
+
const schema = toolDef.inputSchema ?? toolDef.input_schema;
|
|
2081
|
+
if (!schema || typeof schema !== "object") return { valid: true };
|
|
2082
|
+
try {
|
|
2083
|
+
const Ajv = __require("ajv");
|
|
2084
|
+
const ajv = new Ajv({ allErrors: true, strict: false });
|
|
2085
|
+
const validate = ajv.compile(schema);
|
|
2086
|
+
const valid = validate(toolArgs);
|
|
2087
|
+
if (!valid && validate.errors) {
|
|
2088
|
+
const errMsg = validate.errors.map((e) => `${e.instancePath || "/"}: ${e.message}`).join("; ");
|
|
2089
|
+
return { valid: false, errors: errMsg };
|
|
2090
|
+
}
|
|
2091
|
+
} catch {
|
|
2092
|
+
}
|
|
2093
|
+
return { valid: true };
|
|
2094
|
+
}
|
|
2095
|
+
function convertOpenAIResponseToAnthropic(response, tools, options) {
|
|
2020
2096
|
let contentBlocks = [];
|
|
2021
2097
|
const message = response.choices?.[0]?.message;
|
|
2022
2098
|
if (!message) {
|
|
@@ -2036,6 +2112,20 @@ function convertOpenAIResponseToAnthropic(response, tools) {
|
|
|
2036
2112
|
try {
|
|
2037
2113
|
toolArgs = tool?.arguments ? JSON.parse(tool.arguments) : {};
|
|
2038
2114
|
} catch (e) {
|
|
2115
|
+
if (options?.throwOnParseError) {
|
|
2116
|
+
throw new ToolCallParseError(toolName ?? "unknown", tool?.arguments ?? "", e);
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
if (options?.postValidate && Object.keys(toolArgs).length > 0) {
|
|
2120
|
+
const matchedTool = tools?.find((t) => t.name === toolName);
|
|
2121
|
+
const validation = validateToolArgsWithSchema(toolArgs, matchedTool);
|
|
2122
|
+
if (!validation.valid && options?.throwOnParseError) {
|
|
2123
|
+
throw new ToolCallParseError(
|
|
2124
|
+
toolName ?? "unknown",
|
|
2125
|
+
tool?.arguments ?? "",
|
|
2126
|
+
new Error(`AJV validation failed: ${validation.errors}`)
|
|
2127
|
+
);
|
|
2128
|
+
}
|
|
2039
2129
|
}
|
|
2040
2130
|
contentBlocks.push({
|
|
2041
2131
|
type: "tool_use",
|
|
@@ -2349,13 +2439,37 @@ async function queryLLMWithPromptCaching(messages, systemPrompt, maxThinkingToke
|
|
|
2349
2439
|
const config = getGlobalConfig();
|
|
2350
2440
|
const modelManager = getModelManager();
|
|
2351
2441
|
const toolUseContext = options.toolUseContext;
|
|
2352
|
-
|
|
2442
|
+
let modelProfile = options.modelProfile || modelManager.getModel("main");
|
|
2353
2443
|
let provider;
|
|
2354
2444
|
if (modelProfile) {
|
|
2355
2445
|
provider = modelProfile.provider || config.primaryProvider || "anthropic";
|
|
2356
2446
|
} else {
|
|
2357
2447
|
provider = config.primaryProvider || "anthropic";
|
|
2358
2448
|
}
|
|
2449
|
+
if (!isProviderAvailable(provider)) {
|
|
2450
|
+
const allProfiles = [
|
|
2451
|
+
modelManager.getModel("main"),
|
|
2452
|
+
modelManager.getModel("task"),
|
|
2453
|
+
modelManager.getModel("quick")
|
|
2454
|
+
].filter((p) => !!p && p.provider !== provider);
|
|
2455
|
+
const fallbackProviders = [...new Set(allProfiles.map((p) => p.provider))];
|
|
2456
|
+
const selected = selectAvailableProvider({
|
|
2457
|
+
primary: provider,
|
|
2458
|
+
fallbacks: fallbackProviders
|
|
2459
|
+
});
|
|
2460
|
+
if (selected && selected !== provider) {
|
|
2461
|
+
const fallbackProfile = allProfiles.find((p) => p.provider === selected);
|
|
2462
|
+
if (fallbackProfile) {
|
|
2463
|
+
debug.warn("PROVIDER_FAILOVER_ACTIVATED", {
|
|
2464
|
+
from: provider,
|
|
2465
|
+
to: selected,
|
|
2466
|
+
model: fallbackProfile.modelName
|
|
2467
|
+
});
|
|
2468
|
+
provider = selected;
|
|
2469
|
+
modelProfile = fallbackProfile;
|
|
2470
|
+
}
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2359
2473
|
if (provider === "anthropic" || provider === "bigdream" || provider === "opendev" || provider === "minimax-coding") {
|
|
2360
2474
|
return queryAnthropicNative(
|
|
2361
2475
|
messages,
|
|
@@ -2699,8 +2813,10 @@ async function queryAnthropicNative(messages, systemPrompt, maxThinkingTokens, t
|
|
|
2699
2813
|
const costUSD = inputTokens / 1e6 * getModelInputTokenCostUSD(model) + outputTokens / 1e6 * getModelOutputTokenCostUSD(model) + cacheCreationInputTokens / 1e6 * getModelInputTokenCostUSD(model) + cacheReadInputTokens / 1e6 * (getModelInputTokenCostUSD(model) * 0.1);
|
|
2700
2814
|
assistantMessage.costUSD = costUSD;
|
|
2701
2815
|
addToTotalCost(costUSD, durationMs);
|
|
2816
|
+
markProviderSuccess(provider, durationMs);
|
|
2702
2817
|
return assistantMessage;
|
|
2703
2818
|
} catch (error) {
|
|
2819
|
+
markProviderFailure(provider, error instanceof Error ? error.message : String(error));
|
|
2704
2820
|
return getAssistantMessageFromError(error);
|
|
2705
2821
|
}
|
|
2706
2822
|
}
|
|
@@ -2766,18 +2882,26 @@ async function queryOpenAI(messages, systemPrompt, maxThinkingTokens, tools, sig
|
|
|
2766
2882
|
type: "text"
|
|
2767
2883
|
})
|
|
2768
2884
|
);
|
|
2885
|
+
const provider = modelProfile?.provider || config.primaryProvider || "openai";
|
|
2886
|
+
const { structuredOutputConfig: getStructuredConfig } = await import("./structuredOutput-KAVFUV2Z.js");
|
|
2887
|
+
const structuredConfig = getStructuredConfig(provider);
|
|
2769
2888
|
const toolSchemas = await Promise.all(
|
|
2770
2889
|
tools.map(
|
|
2771
|
-
async (_) =>
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2890
|
+
async (_) => {
|
|
2891
|
+
const parameters = "inputJSONSchema" in _ && _.inputJSONSchema ? _.inputJSONSchema : zodToJsonSchema4(_.inputSchema);
|
|
2892
|
+
const toolDef = {
|
|
2893
|
+
type: "function",
|
|
2894
|
+
function: {
|
|
2895
|
+
name: _.name,
|
|
2896
|
+
description: await _.prompt({
|
|
2897
|
+
safeMode: options?.safeMode
|
|
2898
|
+
}),
|
|
2899
|
+
parameters,
|
|
2900
|
+
...structuredConfig.enableStrictTools ? { strict: true } : {}
|
|
2901
|
+
}
|
|
2902
|
+
};
|
|
2903
|
+
return toolDef;
|
|
2904
|
+
}
|
|
2781
2905
|
)
|
|
2782
2906
|
);
|
|
2783
2907
|
const openaiSystem = system.map(
|
|
@@ -2837,13 +2961,17 @@ async function queryOpenAI(messages, systemPrompt, maxThinkingTokens, tools, sig
|
|
|
2837
2961
|
}
|
|
2838
2962
|
let queryResult;
|
|
2839
2963
|
let startIncludingRetries = Date.now();
|
|
2840
|
-
|
|
2841
|
-
|
|
2964
|
+
const toolCallMaxRetries = structuredConfig.maxRetries;
|
|
2965
|
+
const isPostValidateMode = structuredConfig.mode === "post_validate";
|
|
2966
|
+
let throwOnToolParseError = true;
|
|
2967
|
+
const executeQuery = async () => {
|
|
2968
|
+
const shouldThrowOnParse = throwOnToolParseError;
|
|
2969
|
+
return withRetry(
|
|
2842
2970
|
async () => {
|
|
2843
2971
|
start = Date.now();
|
|
2844
2972
|
if (adapterContext) {
|
|
2845
2973
|
if (adapterContext.shouldUseResponses) {
|
|
2846
|
-
const { callGPT5ResponsesAPI } = await import("./openai-
|
|
2974
|
+
const { callGPT5ResponsesAPI } = await import("./openai-6NL5UXO7.js");
|
|
2847
2975
|
const response = await callGPT5ResponsesAPI(
|
|
2848
2976
|
modelProfile,
|
|
2849
2977
|
adapterContext.request,
|
|
@@ -2879,7 +3007,7 @@ async function queryOpenAI(messages, systemPrompt, maxThinkingTokens, tools, sig
|
|
|
2879
3007
|
} else {
|
|
2880
3008
|
finalResponse2 = s2;
|
|
2881
3009
|
}
|
|
2882
|
-
const message2 = convertOpenAIResponseToAnthropic(finalResponse2, tools);
|
|
3010
|
+
const message2 = convertOpenAIResponseToAnthropic(finalResponse2, tools, { throwOnParseError: shouldThrowOnParse, postValidate: isPostValidateMode });
|
|
2883
3011
|
const assistantMsg2 = {
|
|
2884
3012
|
type: "assistant",
|
|
2885
3013
|
message: message2,
|
|
@@ -2915,6 +3043,30 @@ async function queryOpenAI(messages, systemPrompt, maxThinkingTokens, tools, sig
|
|
|
2915
3043
|
if (toolSchemas.length > 0) {
|
|
2916
3044
|
opts.tools = toolSchemas;
|
|
2917
3045
|
opts.tool_choice = "auto";
|
|
3046
|
+
if (structuredConfig.mode === "format_json") {
|
|
3047
|
+
;
|
|
3048
|
+
opts.format = "json";
|
|
3049
|
+
} else if (structuredConfig.mode === "guided_json" && toolSchemas.length > 0) {
|
|
3050
|
+
const toolParamSchemas = toolSchemas.map((t) => t.function?.parameters).filter(Boolean);
|
|
3051
|
+
if (toolParamSchemas.length > 0) {
|
|
3052
|
+
;
|
|
3053
|
+
opts.guided_json = toolParamSchemas[0];
|
|
3054
|
+
}
|
|
3055
|
+
} else if (structuredConfig.mode === "strict" && !config.stream) {
|
|
3056
|
+
const firstToolSchema = toolSchemas[0];
|
|
3057
|
+
const paramSchema = firstToolSchema?.function?.parameters;
|
|
3058
|
+
if (paramSchema) {
|
|
3059
|
+
;
|
|
3060
|
+
opts.response_format = {
|
|
3061
|
+
type: "json_schema",
|
|
3062
|
+
json_schema: {
|
|
3063
|
+
name: "tool_call_output",
|
|
3064
|
+
strict: true,
|
|
3065
|
+
schema: paramSchema
|
|
3066
|
+
}
|
|
3067
|
+
};
|
|
3068
|
+
}
|
|
3069
|
+
}
|
|
2918
3070
|
}
|
|
2919
3071
|
const reasoningEffort = await getReasoningEffort(modelProfile, messages);
|
|
2920
3072
|
if (reasoningEffort) {
|
|
@@ -2931,7 +3083,7 @@ async function queryOpenAI(messages, systemPrompt, maxThinkingTokens, tools, sig
|
|
|
2931
3083
|
} else {
|
|
2932
3084
|
finalResponse = s;
|
|
2933
3085
|
}
|
|
2934
|
-
const message = convertOpenAIResponseToAnthropic(finalResponse, tools);
|
|
3086
|
+
const message = convertOpenAIResponseToAnthropic(finalResponse, tools, { throwOnParseError: shouldThrowOnParse, postValidate: isPostValidateMode });
|
|
2935
3087
|
const assistantMsg = {
|
|
2936
3088
|
type: "assistant",
|
|
2937
3089
|
message,
|
|
@@ -2947,7 +3099,36 @@ async function queryOpenAI(messages, systemPrompt, maxThinkingTokens, tools, sig
|
|
|
2947
3099
|
},
|
|
2948
3100
|
{ signal }
|
|
2949
3101
|
);
|
|
3102
|
+
};
|
|
3103
|
+
try {
|
|
3104
|
+
for (let attempt = 0; attempt <= toolCallMaxRetries; attempt++) {
|
|
3105
|
+
try {
|
|
3106
|
+
queryResult = await executeQuery();
|
|
3107
|
+
break;
|
|
3108
|
+
} catch (error) {
|
|
3109
|
+
if (error instanceof ToolCallParseError && attempt < toolCallMaxRetries) {
|
|
3110
|
+
debug.warn("TOOL_CALL_PARSE_RETRY", {
|
|
3111
|
+
toolName: error.toolName,
|
|
3112
|
+
attempt: attempt + 1,
|
|
3113
|
+
maxRetries: toolCallMaxRetries,
|
|
3114
|
+
rawArgs: error.rawArguments.slice(0, 200)
|
|
3115
|
+
});
|
|
3116
|
+
continue;
|
|
3117
|
+
}
|
|
3118
|
+
if (error instanceof ToolCallParseError) {
|
|
3119
|
+
debug.warn("TOOL_CALL_PARSE_EXHAUSTED", {
|
|
3120
|
+
toolName: error.toolName,
|
|
3121
|
+
rawArgs: error.rawArguments.slice(0, 200)
|
|
3122
|
+
});
|
|
3123
|
+
throwOnToolParseError = false;
|
|
3124
|
+
queryResult = await executeQuery();
|
|
3125
|
+
break;
|
|
3126
|
+
}
|
|
3127
|
+
throw error;
|
|
3128
|
+
}
|
|
3129
|
+
}
|
|
2950
3130
|
} catch (error) {
|
|
3131
|
+
markProviderFailure(provider, error instanceof Error ? error.message : String(error));
|
|
2951
3132
|
logError(error);
|
|
2952
3133
|
return getAssistantMessageFromError(error);
|
|
2953
3134
|
}
|
|
@@ -2965,6 +3146,7 @@ async function queryOpenAI(messages, systemPrompt, maxThinkingTokens, tools, sig
|
|
|
2965
3146
|
const cacheCreationInputTokens = normalizedUsage.cache_creation_input_tokens ?? 0;
|
|
2966
3147
|
const costUSD = inputTokens / 1e6 * SONNET_COST_PER_MILLION_INPUT_TOKENS + outputTokens / 1e6 * SONNET_COST_PER_MILLION_OUTPUT_TOKENS + cacheReadInputTokens / 1e6 * SONNET_COST_PER_MILLION_PROMPT_CACHE_READ_TOKENS + cacheCreationInputTokens / 1e6 * SONNET_COST_PER_MILLION_PROMPT_CACHE_WRITE_TOKENS;
|
|
2967
3148
|
addToTotalCost(costUSD, durationMsIncludingRetries);
|
|
3149
|
+
markProviderSuccess(provider, durationMs);
|
|
2968
3150
|
logLLMInteraction({
|
|
2969
3151
|
systemPrompt: systemPrompt.join("\n"),
|
|
2970
3152
|
messages: [...openaiSystem, ...openaiMessages],
|