nolo-cli 0.38.0-alpha.3 → 0.47.0-alpha.2
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/{_executeModel-SWONBJ7Z.js → _executeModel-5PG6CUWD.js} +41 -42
- package/{action-KMBZ3LCZ.js → action-FLLC2SIX.js} +7 -7
- package/{addContentAction-KQ44UT2U.js → addContentAction-SVSPUUK4.js} +6 -6
- package/{addDialogAgentAction-ILSDCMYL.js → addDialogAgentAction-W3JGU4F7.js} +5 -5
- package/{agentDeleteCommand-SMUJYI6N.js → agentDeleteCommand-SHSPQZHI.js} +25 -26
- package/{agentEmailCommands-YWCGZ4RO.js → agentEmailCommands-LQKO5GRW.js} +54 -55
- package/{agentListCommands-ULFV2XJQ.js → agentListCommands-5QTNEYMQ.js} +31 -29
- package/{agentMachineCommands-7YZ2TIYZ.js → agentMachineCommands-P5K454CN.js} +24 -25
- package/{agentPullCommand-TSWAJPS2.js → agentPullCommand-M552CYSI.js} +2 -2
- package/{agentRecordCommands-EVOSSHJR.js → agentRecordCommands-Z4QYCNP4.js} +50 -51
- package/{agentRunCommand-PO55WUIY.js → agentRunCommand-HV3Y34B5.js} +52 -53
- package/{agentRunControl-7MUPSYDQ.js → agentRunControl-LHXOP4IU.js} +43 -1
- package/{agentRuntimeLocal-Q6D3G6G7.js → agentRuntimeLocal-ZKXYFLXI.js} +20 -21
- package/{agentSlice-6TRUUOSX.js → agentSlice-NKFLP3RI.js} +6 -6
- package/{agentSuperviseCommands-MKWW3ICX.js → agentSuperviseCommands-IMRZ56RC.js} +2 -2
- package/{appDeleteCommands-JDBSRLTX.js → appDeleteCommands-XYGAZIJX.js} +24 -25
- package/{appDeployCommands-Q5H2NBKQ.js → appDeployCommands-7T5CABRB.js} +24 -25
- package/{appDeployStatusCommands-PSYBUIZT.js → appDeployStatusCommands-KTFQMRPZ.js} +24 -25
- package/{appGetCommands-IX64IUW6.js → appGetCommands-HOX2ULSV.js} +24 -25
- package/{appListCommands-BJZFX65H.js → appListCommands-3SLCEHND.js} +24 -25
- package/{authCommand-B2XRHNJH.js → authCommand-OY2E2VQK.js} +12 -12
- package/{authCommands-GWABTFMR.js → authCommands-SBQVTD6V.js} +5 -5
- package/{chatQueueReduxAdapter-N7Z5MUPU.js → chatQueueReduxAdapter-WMMBQK3Y.js} +20 -20
- package/chunk-25J3BB35.js +6041 -0
- package/{chunk-U6QQLXWI.js → chunk-2X5S4IBZ.js} +1 -1
- package/{chunk-MJWX4JQO.js → chunk-3EEK7T3D.js} +1 -1
- package/{chunk-UNHKVD2N.js → chunk-43CXXVJD.js} +1 -1
- package/{chunk-WRP5TTM6.js → chunk-4MXGXSYN.js} +83 -3
- package/{chunk-7N7XKGEQ.js → chunk-4ZNDBDWG.js} +6 -6
- package/{chunk-XVVNNJAA.js → chunk-5BPZLBFB.js} +20 -51
- package/{chunk-MWGCZ4CS.js → chunk-5PPFYHU2.js} +3 -3
- package/{chunk-W445DPVT.js → chunk-5QRCPERU.js} +1 -1
- package/{chunk-GKHV4UH5.js → chunk-5UOBIU5G.js} +31 -3
- package/{chunk-BMB563Y6.js → chunk-6BYAXNH5.js} +3 -3
- package/{chunk-SMPAUSX5.js → chunk-6FGXGFAH.js} +2 -2
- package/{chunk-46VPXYIV.js → chunk-6LYUN76O.js} +5 -5
- package/{chunk-FTM4KUOZ.js → chunk-7XTC3KRG.js} +1 -1
- package/{chunk-IMHO5LC6.js → chunk-7XZ5GXSN.js} +1 -1
- package/{chunk-E2OQ5N2F.js → chunk-AEXP2UZT.js} +341 -16
- package/{chunk-MZZZYUZS.js → chunk-AV2CELZZ.js} +37 -12
- package/{chunk-JI2TIPLP.js → chunk-AYXSUBVC.js} +1 -1
- package/{chunk-J6WH4PYZ.js → chunk-CIF4X6ZM.js} +1 -1
- package/{chunk-GZRMWK5R.js → chunk-DQLYEGP7.js} +2 -2
- package/{chunk-GUYMR3JL.js → chunk-E2QH2AYX.js} +69 -3
- package/{chunk-B6H5XCT2.js → chunk-EMEUU5IY.js} +3 -3
- package/{chunk-X6EN3KJX.js → chunk-ENYDQKOB.js} +319 -71
- package/{chunk-RCFIB45Q.js → chunk-EVBFYPDC.js} +2 -2
- package/{chunk-PV734VZX.js → chunk-EXLOROHG.js} +1 -1
- package/{chunk-WRN7L5CS.js → chunk-FA4SY4F5.js} +1 -1
- package/{chunk-4WVNHL3V.js → chunk-FAWK6DBF.js} +157 -51
- package/{chunk-IFS5CUEH.js → chunk-FJHLA6SX.js} +1 -1
- package/{chunk-T2BZICLK.js → chunk-G46DB6KG.js} +49 -6
- package/{chunk-FGLKRJDI.js → chunk-GK74OOFT.js} +2 -2
- package/{chunk-LM6IYQ3F.js → chunk-GLKOYSRU.js} +8 -1
- package/{chunk-JIADXJYU.js → chunk-H2G6JXTR.js} +1 -1
- package/{chunk-IKGHZMK2.js → chunk-H2JQB6B6.js} +12 -12
- package/{chunk-MGIHZ5CJ.js → chunk-HAPCUPEO.js} +2 -2
- package/{chunk-LD6Y6RJY.js → chunk-HGDOIDQ4.js} +2 -2
- package/{chunk-NZLQ7B5P.js → chunk-HOM6NILS.js} +3 -3
- package/{chunk-IZNJDUJ4.js → chunk-I4JISVWK.js} +1 -1
- package/{chunk-N4XRDM26.js → chunk-IA3A5373.js} +2 -2
- package/{chunk-Y5MMUI3L.js → chunk-IWUPQUWA.js} +2 -2
- package/{chunk-L7SMDIL6.js → chunk-JEGPB5H2.js} +3 -3
- package/{chunk-GEPHJJW4.js → chunk-L7NG2M6H.js} +1 -1
- package/{chunk-XQES6LXQ.js → chunk-LFLWZX76.js} +2 -2
- package/{chunk-IIOHYLIG.js → chunk-LGUQHYAL.js} +1 -1
- package/{chunk-4AWH4LQA.js → chunk-LYGNQHUW.js} +3 -1
- package/{db-3H3JECGY.js → chunk-M5PVFLD4.js} +11 -158
- package/{chunk-WN5AJG5I.js → chunk-MKZRKDQM.js} +1 -1
- package/{chunk-VOXNBPLB.js → chunk-MUIJYGYW.js} +649 -41
- package/{chunk-CYAC5WXX.js → chunk-MWT2BBCH.js} +213 -45
- package/{chunk-V5GA74HI.js → chunk-MZXZJVVD.js} +20 -39
- package/{chunk-ZBB3MZR3.js → chunk-OLNC7AWK.js} +7 -4
- package/{chunk-J5NMOM35.js → chunk-OYNDYVSE.js} +1 -1
- package/{chunk-C6ELZQ7H.js → chunk-OZVGA4SY.js} +1 -1
- package/{chunk-K4KIFRIN.js → chunk-Q24S4NDF.js} +1 -1
- package/{chunk-NRROOY22.js → chunk-Q6DMA2OM.js} +271 -130
- package/{chunk-2WKUUY2E.js → chunk-SVEUG45B.js} +5 -3
- package/{chunk-IZCHPD7T.js → chunk-TNPCQNGQ.js} +11 -6
- package/{chunk-4DMPISV6.js → chunk-URBGEE42.js} +2 -2
- package/{chunk-2KO5QQFV.js → chunk-V2IPBG5U.js} +1 -1
- package/{chunk-B6YYACBT.js → chunk-WPFNAEIW.js} +1 -1
- package/{chunk-23KKIMD5.js → chunk-WVGEBWA6.js} +4 -4
- package/{chunk-KU6CDTZ5.js → chunk-XMI3APSU.js} +61 -49
- package/{chunk-64KIQZA2.js → chunk-XO3G35OV.js} +1 -1
- package/{chunk-UWGWUOVN.js → chunk-YNOGNUBC.js} +108 -47
- package/{chunk-XT73C4VH.js → chunk-Z5NW3O7V.js} +1 -1
- package/{codingSkills-H6N5EKSX.js → codingSkills-BYQI6EPT.js} +2 -2
- package/{createAgentAutomationAction-U57ZMPMS.js → createAgentAutomationAction-ENDNA3Q4.js} +21 -21
- package/{createDialogAction-MAJLBNK4.js → createDialogAction-2KNX6S2D.js} +23 -23
- package/{createPageAction-4EX7HU6G.js → createPageAction-SNBCYPK6.js} +21 -21
- package/db-VQSAOWAO.js +162 -0
- package/{dbSlice-PIQGICNM.js → dbSlice-XWUM4QOF.js} +5 -5
- package/deleteFile-NPZ64DFN.js +1 -1
- package/{dialogCommands-4MHZXEIS.js → dialogCommands-6E5P35DG.js} +28 -26
- package/{dialogSlice-AL3UJLOJ.js → dialogSlice-RTPOD6EW.js} +20 -20
- package/{docCreateCommands-GDYFEK67.js → docCreateCommands-JWY25UFB.js} +23 -24
- package/{docDeleteCommands-WIE5CXED.js → docDeleteCommands-BPJOCSX4.js} +24 -25
- package/{docReadCommands-LTOOPJVC.js → docReadCommands-BSEZCYTQ.js} +23 -24
- package/{docStore-35B5VAFF.js → docStore-TYHVLU7G.js} +22 -22
- package/{docUpdateCommands-TZGAGXSG.js → docUpdateCommands-S2IE2VV4.js} +23 -24
- package/{fetchMessages-CUEFN4GQ.js → fetchMessages-KZQVBXKY.js} +3 -3
- package/{getPricing-P3E2WRIH.js → getPricing-X3HXP6VQ.js} +3 -3
- package/{handleSendMessageAction-PXX2R5JS.js → handleSendMessageAction-QYXDQXGH.js} +21 -21
- package/index.js +69 -69
- package/levelLazyShim-GZBKODGI.js +7 -0
- package/{localDialogRead-P7CHFMIC.js → localDialogRead-NQ33HBSI.js} +2 -2
- package/{localRuntimeAuthority-S77B5QVB.js → localRuntimeAuthority-KQDAE64E.js} +4 -4
- package/{localRuntimeDb-N3H3HQ7G.js → localRuntimeDb-PF7CFKDL.js} +2 -2
- package/{machineCommands-VCPPY23X.js → machineCommands-QCE4KLGR.js} +48 -49
- package/{machineWsRunDispatch-A4C727GL.js → machineWsRunDispatch-FBRMGU5D.js} +48 -49
- package/{models-L7S2EKPM.js → models-7LWATQFH.js} +2 -2
- package/package.json +1 -1
- package/{read-6C2XD3YZ.js → read-DQQ75VI3.js} +2 -2
- package/{readDocTool-Y7AB365O.js → readDocTool-HCQQFAZD.js} +1 -1
- package/{readlineWorkspace-BIBIM6DG.js → readlineWorkspace-2TACWKMN.js} +164 -78
- package/{removeDialogAgentAction-KG5WMJRZ.js → removeDialogAgentAction-DNONRKST.js} +7 -7
- package/{runAgentClientLoop-RKDXMIZW.js → runAgentClientLoop-GBLDVBT5.js} +39 -39
- package/{runtimeDoctorCommands-HT4O2PXL.js → runtimeDoctorCommands-JKTTN723.js} +4 -4
- package/serverStoreFactory-YMXDF4NI.js +20 -0
- package/{setDialogExtraReferencesAction-O2NLXMSM.js → setDialogExtraReferencesAction-ERHUPT3F.js} +6 -6
- package/{setPrimaryDialogAgentAction-FYYUY7PB.js → setPrimaryDialogAgentAction-6C2HYNEC.js} +7 -7
- package/{settingSlice-GPLI6E3M.js → settingSlice-YVRJFKQX.js} +6 -6
- package/{spaceCommands-4FMO3SNP.js → spaceCommands-XOLPJMRK.js} +23 -24
- package/{spaceSlice-2W4GJ2OE.js → spaceSlice-OQPAGQDP.js} +21 -21
- package/{streamAgentChatTurn-FS52LDQP.js → streamAgentChatTurn-SN5XJJ7U.js} +91 -49
- package/{switchDialogAgentAction-GH5P6Q3Z.js → switchDialogAgentAction-HP57XYFP.js} +5 -5
- package/{tools-3J5CKEE7.js → tools-Y65Y3CI4.js} +32 -32
- package/{tuiSummaryLlmCaller-SHRB4RWM.js → tuiSummaryLlmCaller-NBTWT57U.js} +25 -14
- package/{updateDialogTitleAction-5MGPA3OO.js → updateDialogTitleAction-OAOP7CCE.js} +24 -23
- package/chunk-4APLX2RT.js +0 -1514
- package/chunk-P66M7LSQ.js +0 -58
- package/{chunk-6WD3OOJS.js → chunk-UV6VISQJ.js} +0 -0
- package/{tableCommands-PQUJ55AS.js → tableCommands-P2TXJ3CF.js} +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
asRecordOrEmpty
|
|
3
3
|
} from "./chunk-KX6YBIHG.js";
|
|
4
|
+
import {
|
|
5
|
+
asOptionalFiniteNumber
|
|
6
|
+
} from "./chunk-WWC7I6TA.js";
|
|
4
7
|
import {
|
|
5
8
|
asNonEmptyStringArray,
|
|
6
9
|
asTrimmedNonEmptyStringArray
|
|
7
10
|
} from "./chunk-I42VC5KR.js";
|
|
8
|
-
import {
|
|
9
|
-
asOptionalFiniteNumber
|
|
10
|
-
} from "./chunk-WWC7I6TA.js";
|
|
11
11
|
import {
|
|
12
12
|
isOwnedAgentKey,
|
|
13
13
|
ownedAgentKey,
|
|
@@ -191,7 +191,11 @@ var AGENT_SELECTION_PRIORITY_INSTRUCTIONS = ` - \u4F18\u5148\u7EA7\u5951\u7EA6
|
|
|
191
191
|
- \u9009\u4EBA\u4E0E\u4EFB\u52A1\u5339\u914D\u53C2\u8003\uFF1A
|
|
192
192
|
* **\u80FD\u529B\u5339\u914D**\uFF1A\u82E5\u4EFB\u52A1\u660E\u786E\u9700\u8981\u7279\u5B9A\u989D\u5916\u80FD\u529B\uFF08\u6D4F\u89C8\u5668/\u56FE\u7247/\u8868\u683C/\u90AE\u4EF6/\u6570\u636E\u5E93\uFF09\uFF0C\u4F18\u5148\u7B5B\u9009 tools \u5B57\u6BB5\u8986\u76D6\u5BF9\u5E94\u80FD\u529B\u7684\u5019\u9009\uFF1B
|
|
193
193
|
* **\u6210\u672C\u4E0E\u914D\u989D**\uFF1A\u5728\u6EE1\u8DB3\u80FD\u529B\u7684\u540C\u6863\u5019\u9009\u4E2D\uFF0C\u4F18\u5148\u9009\u62E9\u6210\u672C\u4F4E\uFF08\u4F4E inputPrice\uFF09\u6216\u8D70\u7528\u6237\u81EA\u5EFA/\u79C1\u6709\u51ED\u636E\u7684\u901A\u9053\uFF1B
|
|
194
|
-
* **tools \u5B57\u6BB5\u53EA\u53CD\u6620\u989D\u5916\u80FD\u529B\uFF0C\u4E0D\u53CD\u6620 coding \u80FD\u529B**\uFF1AwriteFile/editFile/execBash/applyEdit/gitCommit \u7B49\u4EE3\u7801\u5DE5\u5177\u7531 host \u81EA\u52A8\u6CE8\u5165\uFF0Ctools=[] \u4E0D\u4EE3\u8868\u4E0D\u80FD\u5199\u4EE3\u7801\uFF0C\u4E0D\u8981\u636E\u6B64\u6392\u9664\u5019\u9009\u3002
|
|
194
|
+
* **tools \u5B57\u6BB5\u53EA\u53CD\u6620\u989D\u5916\u80FD\u529B\uFF0C\u4E0D\u53CD\u6620 coding \u80FD\u529B**\uFF1AwriteFile/editFile/execBash/applyEdit/gitCommit \u7B49\u4EE3\u7801\u5DE5\u5177\u7531 host \u81EA\u52A8\u6CE8\u5165\uFF0Ctools=[] \u4E0D\u4EE3\u8868\u4E0D\u80FD\u5199\u4EE3\u7801\uFF0C\u4E0D\u8981\u636E\u6B64\u6392\u9664\u5019\u9009\u3002
|
|
195
|
+
- 429 \u9650\u6D41\u4E0E\u77E5\u60C5\u6743\u5951\u7EA6\uFF1A
|
|
196
|
+
* \u4EFB\u4F55\u7528\u6237\u79C1\u6709\u51ED\u636E\u4E0E\u81EA\u5EFA Agent\uFF08\u5373\u6EE1\u8DB3 isOwned=true\u3001isOAuth=true \u6216 apiSource="custom" \u4E4B\u4E00\uFF0C\u542B\u6536\u85CF\u4E0E\u672A\u6536\u85CF\uFF09\u82E5\u51FA\u73B0\u5728 listAgents \u8FD4\u56DE\u7684 unavailableAgents \u4E2D\uFF08429 \u9650\u6D41\u51B7\u5374\u671F\uFF09\uFF0C\u7981\u6B62\u9759\u9ED8\u8DF3\u8FC7\uFF1B
|
|
197
|
+
* \u6539\u6D3E\u5E73\u53F0 Agent\uFF08\u6D88\u8017\u5E73\u53F0\u79EF\u5206\uFF09\u524D\u5FC5\u987B\u5728\u56DE\u590D\u4E2D\u544A\u77E5\u7528\u6237\uFF1A\u54EA\u4E2A\u8BA2\u9605/\u81EA\u5EFA agent \u9650\u6D41\u3001\u9884\u8BA1\u4F55\u65F6\u6062\u590D\uFF08nextAvailableAt\uFF09\u3001\u672C\u6B21\u5C06\u6263\u5E73\u53F0\u79EF\u5206\uFF1B
|
|
198
|
+
* \u82E5\u4EFB\u52A1\u4E0D\u7D27\u6025\uFF0C\u5EFA\u8BAE\u7B49\u6062\u590D\u6216\u8BE2\u95EE\u7528\u6237\u3002`;
|
|
195
199
|
|
|
196
200
|
// packages/agent-runtime/noloWorkspaceTools.ts
|
|
197
201
|
var NOLO_WORKSPACE_TOOL_NAMES = [
|
|
@@ -274,9 +278,10 @@ function buildNoloWorkspaceOpenAiTools(args) {
|
|
|
274
278
|
description: "Confirmed dialog ids or dbKeys to delete."
|
|
275
279
|
}
|
|
276
280
|
}, ["query"]);
|
|
277
|
-
add("listAgents", "List the current user's agents with runnable agentKey for delegation. Copy the agentKey verbatim; do not infer it from the display name.", {
|
|
281
|
+
add("listAgents", "List the current user's agents with runnable agentKey for delegation. Copy the agentKey verbatim; do not infer it from the display name. Agents currently rate-limited (429) are hidden by default and summarized in `unavailableAgents` with `unavailableCount`; pass showUnavailable: true to include them in `agents`.", {
|
|
278
282
|
space: stringToolParam("Optional space id or URL."),
|
|
279
|
-
publicOnly: { type: "boolean", description: "Only show public agents." }
|
|
283
|
+
publicOnly: { type: "boolean", description: "Only show public agents." },
|
|
284
|
+
showUnavailable: { type: "boolean", description: "Include agents currently rate-limited (429). Default false." }
|
|
280
285
|
});
|
|
281
286
|
add("readAgent", "Read one agent's full config by exact agentKey returned by listAgents (agent-<userId>-<id> or agent-pub-<id>); do not use the display name.", {
|
|
282
287
|
agent: stringToolParam("Exact agentKey from listAgents (preferred; copy verbatim; plain id or URL are compatibility fallbacks).")
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from "./chunk-AGGIDPCZ.js";
|
|
7
7
|
import {
|
|
8
8
|
getModelConfig
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-OZVGA4SY.js";
|
|
10
10
|
import {
|
|
11
11
|
isPlatformHostedImageModel
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ENYDQKOB.js";
|
|
13
13
|
import {
|
|
14
14
|
asOptionalFiniteNumber
|
|
15
15
|
} from "./chunk-WWC7I6TA.js";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
fileKey,
|
|
4
4
|
getFileIdFromKey,
|
|
5
5
|
ulid
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SVEUG45B.js";
|
|
7
7
|
import {
|
|
8
8
|
loadFileFromIndexedDb,
|
|
9
9
|
removeAction,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
readAction,
|
|
14
14
|
readRequestManager,
|
|
15
15
|
resolveAgentReadServers
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-Z5NW3O7V.js";
|
|
17
17
|
import {
|
|
18
18
|
asyncThunkCreator,
|
|
19
19
|
buildCreateSlice,
|
|
@@ -707,7 +707,7 @@ var dbSlice = createSliceWithThunks({
|
|
|
707
707
|
// 动态 import 在调用期解析,避开 TDZ/求值顺序问题(同下方 share)。
|
|
708
708
|
read: create.asyncThunk(
|
|
709
709
|
async (payload, thunkApi) => {
|
|
710
|
-
const { readAction: readAction2 } = await import("./read-
|
|
710
|
+
const { readAction: readAction2 } = await import("./read-DQQ75VI3.js");
|
|
711
711
|
return readAction2(payload, thunkApi);
|
|
712
712
|
},
|
|
713
713
|
{
|
|
@@ -781,7 +781,7 @@ var dbSlice = createSliceWithThunks({
|
|
|
781
781
|
// 这里改成动态 import,运行期才解析,彻底断开这条边。
|
|
782
782
|
share: create.asyncThunk(
|
|
783
783
|
async (config, thunkApi) => {
|
|
784
|
-
const { shareResourceAction } = await import("./action-
|
|
784
|
+
const { shareResourceAction } = await import("./action-FLLC2SIX.js");
|
|
785
785
|
return shareResourceAction(config, thunkApi);
|
|
786
786
|
}
|
|
787
787
|
),
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
inlineImageUrlsForCustomProvider,
|
|
6
6
|
prepareTools,
|
|
7
7
|
shouldInlineImageUrlsForAgent
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-IWUPQUWA.js";
|
|
9
9
|
import {
|
|
10
10
|
INVALID_TOOL_ARGS_REPLACEMENT,
|
|
11
11
|
buildInvalidToolCallSelfHealResult,
|
|
12
12
|
parseToolCallArguments,
|
|
13
13
|
performFetchRequest,
|
|
14
14
|
sanitizeOutboundMessages
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-5BPZLBFB.js";
|
|
16
16
|
import {
|
|
17
17
|
createSSEParser,
|
|
18
18
|
createToolRunId,
|
|
@@ -23,30 +23,27 @@ import {
|
|
|
23
23
|
toolRunSetPending,
|
|
24
24
|
toolRunStarted,
|
|
25
25
|
toolRunSucceeded
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-YNOGNUBC.js";
|
|
27
27
|
import {
|
|
28
28
|
getPublicImageAgentMode
|
|
29
29
|
} from "./chunk-VIDPVFP3.js";
|
|
30
30
|
import {
|
|
31
31
|
getCurrentSpaceId
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-H2JQB6B6.js";
|
|
33
33
|
import {
|
|
34
34
|
addToolMessage,
|
|
35
35
|
messageStreamEnd,
|
|
36
36
|
messageStreaming,
|
|
37
37
|
updateToolMessage
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-FAWK6DBF.js";
|
|
39
39
|
import {
|
|
40
40
|
streamAgentChatTurn
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-6LYUN76O.js";
|
|
42
42
|
import {
|
|
43
43
|
addActiveController,
|
|
44
44
|
removeActiveController,
|
|
45
45
|
tokenUsageLiveUpdate
|
|
46
46
|
} from "./chunk-MRWGHF56.js";
|
|
47
|
-
import {
|
|
48
|
-
EMPTY_ASSISTANT_REPAIR_PROMPT
|
|
49
|
-
} from "./chunk-P66M7LSQ.js";
|
|
50
47
|
import {
|
|
51
48
|
accumulateToolCallDelta,
|
|
52
49
|
createThinkParserState,
|
|
@@ -57,25 +54,26 @@ import {
|
|
|
57
54
|
processThinkChunk
|
|
58
55
|
} from "./chunk-N7J63Q6C.js";
|
|
59
56
|
import {
|
|
57
|
+
EMPTY_ASSISTANT_REPAIR_PROMPT,
|
|
60
58
|
getModelInfo
|
|
61
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-4MXGXSYN.js";
|
|
62
60
|
import {
|
|
63
61
|
getApiEndpoint
|
|
64
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-OZVGA4SY.js";
|
|
65
63
|
import {
|
|
66
64
|
toErrorMessage
|
|
67
65
|
} from "./chunk-HNMXYYJR.js";
|
|
68
66
|
import {
|
|
69
67
|
selectCurrentServer
|
|
70
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-EMEUU5IY.js";
|
|
71
69
|
import {
|
|
72
70
|
write
|
|
73
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-WVGEBWA6.js";
|
|
74
72
|
import {
|
|
75
73
|
createDialogMessageKeyAndId,
|
|
76
74
|
dialogMessageKey,
|
|
77
75
|
toTrimmedString
|
|
78
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-SVEUG45B.js";
|
|
79
77
|
import {
|
|
80
78
|
extractCustomId
|
|
81
79
|
} from "./chunk-BJIRLHJR.js";
|
|
@@ -313,10 +311,18 @@ function updateTotalUsage(currentUsage, newUsageChunk) {
|
|
|
313
311
|
return currentUsage;
|
|
314
312
|
}
|
|
315
313
|
if (!currentUsage) {
|
|
314
|
+
const hasExplicitTokenField = [
|
|
315
|
+
"prompt_tokens",
|
|
316
|
+
"completion_tokens",
|
|
317
|
+
"total_tokens",
|
|
318
|
+
"input_tokens",
|
|
319
|
+
"output_tokens"
|
|
320
|
+
].some((field) => Object.prototype.hasOwnProperty.call(newUsageChunk, field));
|
|
316
321
|
const first = {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
322
|
+
// Do not synthesize zero token fields for metadata-only events such as
|
|
323
|
+
// `{provider_call_id}`. Explicit provider zeros remain real reported
|
|
324
|
+
// usage; only pure metadata is eligible for estimated fallback.
|
|
325
|
+
...hasExplicitTokenField ? { completion_tokens: 0, prompt_tokens: 0, total_tokens: 0 } : {},
|
|
320
326
|
...newUsageChunk
|
|
321
327
|
};
|
|
322
328
|
applyResponsesUsageFields(first, newUsageChunk);
|
|
@@ -356,6 +362,10 @@ function updateTotalUsage(currentUsage, newUsageChunk) {
|
|
|
356
362
|
if (billingModel) {
|
|
357
363
|
updatedUsage.billing_model = billingModel;
|
|
358
364
|
}
|
|
365
|
+
const providerCallId = asOptionalTrimmedString(newUsageChunk.provider_call_id);
|
|
366
|
+
if (providerCallId) {
|
|
367
|
+
updatedUsage.provider_call_id = providerCallId;
|
|
368
|
+
}
|
|
359
369
|
return updatedUsage;
|
|
360
370
|
}
|
|
361
371
|
function applyResponsesUsageFields(target, chunk) {
|
|
@@ -1017,9 +1027,24 @@ function createInitialStreamState() {
|
|
|
1017
1027
|
hasHandedOff: false,
|
|
1018
1028
|
hasProcessedToolCalls: false,
|
|
1019
1029
|
alreadyFinalized: false,
|
|
1020
|
-
finishReason: null
|
|
1030
|
+
finishReason: null,
|
|
1031
|
+
billingFailed: false,
|
|
1032
|
+
skipBilling: false
|
|
1021
1033
|
};
|
|
1022
1034
|
}
|
|
1035
|
+
function shouldSkipBillingForUserAbort(error, totalUsage) {
|
|
1036
|
+
if (!isAbortError(error)) return false;
|
|
1037
|
+
if (!totalUsage || typeof totalUsage !== "object") return true;
|
|
1038
|
+
const hasTokenField = [
|
|
1039
|
+
"prompt_tokens",
|
|
1040
|
+
"completion_tokens",
|
|
1041
|
+
"total_tokens",
|
|
1042
|
+
"input_tokens",
|
|
1043
|
+
"output_tokens"
|
|
1044
|
+
].some((field) => Object.prototype.hasOwnProperty.call(totalUsage, field));
|
|
1045
|
+
const hasCost = Object.prototype.hasOwnProperty.call(totalUsage, "cost") && typeof totalUsage.cost === "number";
|
|
1046
|
+
return !(hasTokenField || hasCost);
|
|
1047
|
+
}
|
|
1023
1048
|
function buildRequestBodyWithTools(bodyData, agentConfig, disableToolsForThisRequest) {
|
|
1024
1049
|
const messagesForBody = Array.isArray(bodyData?.messages) ? sanitizeOutboundMessages(bodyData.messages) : bodyData?.messages;
|
|
1025
1050
|
const baseBody = messagesForBody !== bodyData?.messages ? { ...bodyData, messages: messagesForBody } : bodyData;
|
|
@@ -1079,7 +1104,9 @@ async function finalizeStream(state, ctx) {
|
|
|
1079
1104
|
reasoningBuffer: state.reasoningBuffer,
|
|
1080
1105
|
messageMetadata: ctx.messageMetadata,
|
|
1081
1106
|
toolCalls: state.assistantToolCalls,
|
|
1082
|
-
spaceId: ctx.spaceId
|
|
1107
|
+
spaceId: ctx.spaceId,
|
|
1108
|
+
billingFailed: state.billingFailed,
|
|
1109
|
+
skipBilling: state.skipBilling
|
|
1083
1110
|
})
|
|
1084
1111
|
);
|
|
1085
1112
|
return {
|
|
@@ -1099,7 +1126,8 @@ function markEmptyCompletionAsError(state, ctx) {
|
|
|
1099
1126
|
contentBuffer: appendTextChunk(
|
|
1100
1127
|
state.contentBuffer,
|
|
1101
1128
|
`[\u9519\u8BEF: ${EMPTY_UPSTREAM_STREAM_MESSAGE}]`
|
|
1102
|
-
)
|
|
1129
|
+
),
|
|
1130
|
+
billingFailed: true
|
|
1103
1131
|
};
|
|
1104
1132
|
}
|
|
1105
1133
|
function markStreamMessageAborted(ctx, errorMessage) {
|
|
@@ -1435,7 +1463,7 @@ async function handleStreamCompletion(state, ctx, finalizeCtx) {
|
|
|
1435
1463
|
};
|
|
1436
1464
|
}
|
|
1437
1465
|
if (!state.hasProcessedToolCalls && state.accumulatedToolCalls.length > 0) {
|
|
1438
|
-
if (state.totalUsage) {
|
|
1466
|
+
if (state.totalUsage && !state.billingFailed) {
|
|
1439
1467
|
ctx.dispatch(tokenUsageLiveUpdate({
|
|
1440
1468
|
input_tokens: state.totalUsage.prompt_tokens ?? state.totalUsage.input_tokens,
|
|
1441
1469
|
output_tokens: state.totalUsage.completion_tokens ?? state.totalUsage.output_tokens,
|
|
@@ -1532,7 +1560,8 @@ var sendOpenAICompletionsRequest = async ({
|
|
|
1532
1560
|
hasHandedOff: hasHandedOffOverall,
|
|
1533
1561
|
finishReason: lastFinishReason,
|
|
1534
1562
|
messageId,
|
|
1535
|
-
usage: streamState.totalUsage ?? void 0
|
|
1563
|
+
usage: streamState.totalUsage ?? void 0,
|
|
1564
|
+
billingFailed: streamState.billingFailed
|
|
1536
1565
|
});
|
|
1537
1566
|
try {
|
|
1538
1567
|
if (!parentMessageId) {
|
|
@@ -1615,7 +1644,8 @@ var sendOpenAICompletionsRequest = async ({
|
|
|
1615
1644
|
contentBuffer: appendTextChunk(
|
|
1616
1645
|
streamState.contentBuffer,
|
|
1617
1646
|
`[\u9519\u8BEF: ${errorMessage}]`
|
|
1618
|
-
)
|
|
1647
|
+
),
|
|
1648
|
+
billingFailed: true
|
|
1619
1649
|
};
|
|
1620
1650
|
streamState = await finalizeStream(streamState, finalizeCtx);
|
|
1621
1651
|
return buildMeta();
|
|
@@ -1711,7 +1741,8 @@ var sendOpenAICompletionsRequest = async ({
|
|
|
1711
1741
|
streamState.contentBuffer,
|
|
1712
1742
|
`
|
|
1713
1743
|
[API Error] ${errorMsg}`
|
|
1714
|
-
)
|
|
1744
|
+
),
|
|
1745
|
+
billingFailed: true
|
|
1715
1746
|
};
|
|
1716
1747
|
await reader.cancel();
|
|
1717
1748
|
break;
|
|
@@ -1744,29 +1775,6 @@ var sendOpenAICompletionsRequest = async ({
|
|
|
1744
1775
|
streamState.finishReason = finishReason;
|
|
1745
1776
|
if (finishReason === "tool_calls") {
|
|
1746
1777
|
throttler.flush();
|
|
1747
|
-
if (streamState.totalUsage) {
|
|
1748
|
-
dispatch(tokenUsageLiveUpdate({
|
|
1749
|
-
input_tokens: streamState.totalUsage.prompt_tokens ?? streamState.totalUsage.input_tokens,
|
|
1750
|
-
output_tokens: streamState.totalUsage.completion_tokens ?? streamState.totalUsage.output_tokens,
|
|
1751
|
-
cost: streamState.totalUsage.cost,
|
|
1752
|
-
dialogKey
|
|
1753
|
-
}));
|
|
1754
|
-
}
|
|
1755
|
-
const toolResult = await processAccumulatedToolCalls(
|
|
1756
|
-
streamState,
|
|
1757
|
-
{
|
|
1758
|
-
dispatch,
|
|
1759
|
-
agentConfig,
|
|
1760
|
-
dialogId,
|
|
1761
|
-
dialogKey,
|
|
1762
|
-
messageId,
|
|
1763
|
-
messageMetadata
|
|
1764
|
-
}
|
|
1765
|
-
);
|
|
1766
|
-
streamState = toolResult.state;
|
|
1767
|
-
hasHandedOffOverall ||= toolResult.hasHandedOff;
|
|
1768
|
-
hasPendingInteractionOverall ||= toolResult.hasPendingInteraction;
|
|
1769
|
-
streamState = await finalizeStream(streamState, finalizeCtx);
|
|
1770
1778
|
} else if (finishReason !== "stop") {
|
|
1771
1779
|
const finishErrorMessage = finishReason === "error" ? getChoiceFinishErrorMessage(data, choice) : null;
|
|
1772
1780
|
streamState = {
|
|
@@ -1776,7 +1784,8 @@ var sendOpenAICompletionsRequest = async ({
|
|
|
1776
1784
|
finishErrorMessage ? `
|
|
1777
1785
|
[API Error] Error: ${finishErrorMessage}` : finishReason === "error" ? "\n[API Error] Error: \u6A21\u578B\u54CD\u5E94\u4EE5 error \u7ED3\u675F\uFF0C\u4F46\u4E0A\u6E38\u672A\u8FD4\u56DE\u5177\u4F53\u9519\u8BEF\u3002\u8BF7\u91CD\u8BD5\uFF0C\u6216\u5207\u6362\u5230\u5176\u4ED6\u652F\u6301\u56FE\u7247\u8F93\u5165\u7684\u6A21\u578B\u3002" : `
|
|
1778
1786
|
[\u6D41\u7ED3\u675F\u539F\u56E0: ${finishReason}]`
|
|
1779
|
-
)
|
|
1787
|
+
),
|
|
1788
|
+
...finishReason === "error" ? { billingFailed: true } : {}
|
|
1780
1789
|
};
|
|
1781
1790
|
}
|
|
1782
1791
|
}
|
|
@@ -1787,6 +1796,7 @@ var sendOpenAICompletionsRequest = async ({
|
|
|
1787
1796
|
throttler.flush();
|
|
1788
1797
|
let errorText;
|
|
1789
1798
|
const isAbort = isAbortError(error);
|
|
1799
|
+
const skipBilling = shouldSkipBillingForUserAbort(error, streamState.totalUsage);
|
|
1790
1800
|
if (isAbort) {
|
|
1791
1801
|
errorText = "\n[\u7528\u6237\u4E2D\u65AD]";
|
|
1792
1802
|
} else {
|
|
@@ -1796,7 +1806,9 @@ var sendOpenAICompletionsRequest = async ({
|
|
|
1796
1806
|
console.error("[SSE] sendOpenAICompletionsRequest error:", error);
|
|
1797
1807
|
streamState = {
|
|
1798
1808
|
...streamState,
|
|
1799
|
-
contentBuffer: appendTextChunk(streamState.contentBuffer, errorText)
|
|
1809
|
+
contentBuffer: appendTextChunk(streamState.contentBuffer, errorText),
|
|
1810
|
+
billingFailed: isAbort ? streamState.billingFailed : true,
|
|
1811
|
+
skipBilling: streamState.skipBilling || skipBilling
|
|
1800
1812
|
};
|
|
1801
1813
|
if (!isAbort) {
|
|
1802
1814
|
markStreamMessageAborted(
|