nolo-cli 0.38.0-alpha.2 → 0.47.0-alpha.1
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-2S6HNTBF.js → _executeModel-JWAASOOT.js} +43 -45
- 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-6XYC7JVL.js → agentDeleteCommand-QL7TF5F2.js} +26 -27
- package/{agentEmailCommands-NGL5B3UC.js → agentEmailCommands-AC3XQM53.js} +57 -59
- package/{agentListCommands-R7TKN3DL.js → agentListCommands-4YMFHDU6.js} +33 -31
- package/{agentMachineCommands-AXOO4OKN.js → agentMachineCommands-MFQKYUV4.js} +25 -26
- package/{agentPullCommand-TSWAJPS2.js → agentPullCommand-M552CYSI.js} +2 -2
- package/{agentRecordCommands-GJHH5GYI.js → agentRecordCommands-QG3YBSTQ.js} +53 -55
- package/{agentRunCommand-4MEMHFT5.js → agentRunCommand-B4PGT36L.js} +56 -58
- package/{agentRunControl-7MUPSYDQ.js → agentRunControl-LHXOP4IU.js} +43 -1
- package/{agentRuntimeLocal-CPEWDR3Z.js → agentRuntimeLocal-V2UKJPNE.js} +21 -22
- package/{agentSlice-LAILHBMM.js → agentSlice-B5O3RTRP.js} +6 -6
- package/{agentSuperviseCommands-MKWW3ICX.js → agentSuperviseCommands-IMRZ56RC.js} +2 -2
- package/{appDeleteCommands-6SYOAMTR.js → appDeleteCommands-BQCRRHOM.js} +25 -26
- package/{appDeployCommands-ZNMFUV2K.js → appDeployCommands-UMJ67TUR.js} +25 -26
- package/{appDeployStatusCommands-G5FIZT64.js → appDeployStatusCommands-KASPUR4V.js} +25 -26
- package/{appGetCommands-4RIFLLZZ.js → appGetCommands-FFT2LTGF.js} +25 -26
- package/{appListCommands-DK2JJ65T.js → appListCommands-TAVWFRZZ.js} +25 -26
- package/{authCommand-B2XRHNJH.js → authCommand-OY2E2VQK.js} +12 -12
- package/{authCommands-GWABTFMR.js → authCommands-SBQVTD6V.js} +5 -5
- package/{chatQueueReduxAdapter-DQWFZYNL.js → chatQueueReduxAdapter-OVDKLHLD.js} +20 -20
- package/chunk-25J3BB35.js +6041 -0
- package/chunk-2BWU4ORW.js +2574 -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-2KO5QQFV.js → chunk-5IQX2XPA.js} +2 -2
- package/{chunk-ARFXKWJH.js → chunk-5PFBRLJN.js} +157 -51
- 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-6XIE5ZGI.js → chunk-6HIGYUBQ.js} +1 -1
- package/{chunk-NT3QRCVS.js → chunk-7US2USK7.js} +7 -7
- 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-KR74XLMV.js → chunk-BIMCW2CC.js} +3 -3
- package/{chunk-GEGSCLZZ.js → chunk-C5UWCCLI.js} +3 -3
- package/{chunk-J6WH4PYZ.js → chunk-CIF4X6ZM.js} +1 -1
- package/{chunk-LZZQTQPY.js → chunk-CTXR4SRT.js} +3 -3
- package/{chunk-GZRMWK5R.js → chunk-DQLYEGP7.js} +2 -2
- package/{chunk-45NBTCS2.js → chunk-DROE55W3.js} +216 -48
- 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-KHCLMKZZ.js → chunk-EY7V7REW.js} +280 -6
- package/{chunk-WRN7L5CS.js → chunk-FA4SY4F5.js} +1 -1
- package/{chunk-IFS5CUEH.js → chunk-FJHLA6SX.js} +1 -1
- package/{chunk-D72M3G32.js → chunk-FM6ZGNMV.js} +12 -12
- 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-YNAGAUJT.js → chunk-GYSVYO35.js} +61 -49
- package/{chunk-JIADXJYU.js → chunk-H2G6JXTR.js} +1 -1
- package/{chunk-MGIHZ5CJ.js → chunk-HAPCUPEO.js} +2 -2
- package/{chunk-LD6Y6RJY.js → chunk-HGDOIDQ4.js} +2 -2
- package/{chunk-IZNJDUJ4.js → chunk-I4JISVWK.js} +1 -1
- package/{chunk-N4XRDM26.js → chunk-IA3A5373.js} +2 -2
- package/{chunk-X2K2JSO4.js → chunk-IWUMSAQF.js} +5 -1
- 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-V5GA74HI.js → chunk-MZXZJVVD.js} +20 -39
- package/{chunk-EJAL5LSG.js → chunk-NC3CSWVT.js} +2 -2
- package/{chunk-6XG52ZQ6.js → chunk-NI2BS6UD.js} +22 -3
- package/{chunk-FXZBSLFK.js → chunk-NSQNNYGW.js} +20 -51
- package/{chunk-VOXNBPLB.js → chunk-OFSVXPQS.js} +651 -43
- 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-HRSIJO5A.js → chunk-RNNAJ34U.js} +1 -1
- package/{chunk-JK7UM3LT.js → chunk-SEIOEDBB.js} +110 -49
- 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-23KKIMD5.js → chunk-WVGEBWA6.js} +4 -4
- package/{chunk-TH7ZZKPJ.js → chunk-XIRSTDYF.js} +275 -134
- package/{chunk-64KIQZA2.js → chunk-XO3G35OV.js} +1 -1
- package/{chunk-CVXDBLYH.js → chunk-XOFZEJGM.js} +5 -5
- package/{chunk-XT73C4VH.js → chunk-Z5NW3O7V.js} +1 -1
- package/{codingSkills-H6N5EKSX.js → codingSkills-QLDAXJRA.js} +3 -4
- package/{cooldownCommands-C2SZLEEO.js → cooldownCommands-GI5NNWGL.js} +5 -3
- package/{createAgentAutomationAction-767ZITQJ.js → createAgentAutomationAction-TQ7PYONU.js} +21 -21
- package/{createDialogAction-H75NDXYH.js → createDialogAction-EOQFCM3K.js} +24 -25
- package/{createPageAction-KYJYZPLC.js → createPageAction-ZG5PH6BI.js} +22 -23
- package/db-VQSAOWAO.js +162 -0
- package/{dbSlice-PIQGICNM.js → dbSlice-XWUM4QOF.js} +5 -5
- package/deleteFile-NPZ64DFN.js +1 -1
- package/{dialogCommands-SSQLOBRU.js → dialogCommands-DCGMVLBA.js} +29 -27
- package/{dialogSlice-YJV3AVFM.js → dialogSlice-YHGPDBAZ.js} +20 -20
- package/{docCreateCommands-WYP6MQ56.js → docCreateCommands-A2LVLROP.js} +26 -28
- package/{docDeleteCommands-6YNU4LZ7.js → docDeleteCommands-ENMROKH6.js} +27 -29
- package/{docReadCommands-PFJMIPYU.js → docReadCommands-XSRUV4EM.js} +26 -28
- package/{docStore-JOODSWDW.js → docStore-WIKRGVQJ.js} +22 -22
- package/{docUpdateCommands-KAP6JSGT.js → docUpdateCommands-5B5NBORA.js} +26 -28
- package/{fetchMessages-CUEFN4GQ.js → fetchMessages-KZQVBXKY.js} +3 -3
- package/{getPricing-P3E2WRIH.js → getPricing-X3HXP6VQ.js} +3 -3
- package/{handleSendMessageAction-DGL6H4E4.js → handleSendMessageAction-WT4FDMQS.js} +21 -21
- package/index.js +70 -70
- 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-NAFWPMLI.js → machineCommands-BFLTBAK6.js} +51 -53
- package/{machineWsRunDispatch-EWA7J37I.js → machineWsRunDispatch-VCJB5LHO.js} +51 -53
- 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-BCQVDX4V.js → readlineWorkspace-VBJLMU6V.js} +5168 -5003
- package/{removeDialogAgentAction-KG5WMJRZ.js → removeDialogAgentAction-DNONRKST.js} +7 -7
- package/{runAgentClientLoop-B3TTKXIX.js → runAgentClientLoop-4QOEJOJP.js} +41 -42
- 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/{skillDiscovery-COX56OBO.js → skillDiscovery-GPUDHDTZ.js} +1 -2
- package/{spaceCommands-VHOKUADK.js → spaceCommands-FBB7XSAW.js} +24 -25
- package/{spaceSlice-ZKUZSVYD.js → spaceSlice-YMDZ4G6H.js} +21 -21
- package/{streamAgentChatTurn-PLTB7RMV.js → streamAgentChatTurn-5NBWQHY6.js} +93 -52
- package/{switchDialogAgentAction-GH5P6Q3Z.js → switchDialogAgentAction-HP57XYFP.js} +5 -5
- package/{tools-KQXDW66A.js → tools-37H5A4OG.js} +34 -35
- package/{tuiSummaryLlmCaller-SHRB4RWM.js → tuiSummaryLlmCaller-NBTWT57U.js} +25 -14
- package/{updateDialogTitleAction-OTYEQJAK.js → updateDialogTitleAction-XAGMXHW5.js} +24 -23
- package/chunk-4APLX2RT.js +0 -1514
- package/chunk-AETZ7AD6.js +0 -274
- package/chunk-OFZPJ3NT.js +0 -114
- package/chunk-P66M7LSQ.js +0 -58
- package/{chunk-6WD3OOJS.js → chunk-UV6VISQJ.js} +0 -0
- package/{tableCommands-PQUJ55AS.js → tableCommands-P2TXJ3CF.js} +1 -1
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
|
|
5
5
|
// packages/cli/agentCommandSupport.ts
|
|
6
6
|
async function getDefaultCliDb() {
|
|
7
|
-
const { getDefaultCliLocalRuntimeDb } = await import("./localRuntimeDb-
|
|
7
|
+
const { getDefaultCliLocalRuntimeDb } = await import("./localRuntimeDb-PF7CFKDL.js");
|
|
8
8
|
return getDefaultCliLocalRuntimeDb();
|
|
9
9
|
}
|
|
10
10
|
function createNullCliDb() {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MODEL_LOOKUP_MAP
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OZVGA4SY.js";
|
|
4
4
|
import {
|
|
5
5
|
ALL_MODELS
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7XTC3KRG.js";
|
|
7
7
|
import {
|
|
8
8
|
PUBLIC_DEEPSEEK_V4_FLASH_AGENT_KEY
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-Z5NW3O7V.js";
|
|
10
10
|
|
|
11
11
|
// packages/ai/llm/getModelContextWindow.ts
|
|
12
12
|
var DEFAULT_CONTEXT_WINDOW = 256e3;
|
|
@@ -115,6 +115,76 @@ var getModelInfo = (modelName) => {
|
|
|
115
115
|
return map.get(modelName) || map.get(modelName.toLowerCase()) || null;
|
|
116
116
|
};
|
|
117
117
|
|
|
118
|
+
// packages/agent-runtime/emptyAssistantRepair.ts
|
|
119
|
+
var EMPTY_ASSISTANT_REPAIR_PROMPT = "\u8BF7\u7ED9\u51FA\u660E\u786E\u7684\u6587\u5B57\u56DE\u7B54\u6216\u6267\u884C\u4E0B\u4E00\u6B65\uFF1A\u5982\u679C\u4EFB\u52A1\u5DF2\u5B8C\u6210\uFF0C\u8BF7\u76F4\u63A5\u603B\u7ED3\u7ED3\u679C\uFF1B\u5982\u679C\u9700\u8981\u8C03\u7528\u5DE5\u5177\uFF0C\u8BF7\u76F4\u63A5\u8F93\u51FA tool_calls\u3002\u8BF7\u5207\u52FF\u8FD4\u56DE\u7A7A\u5185\u5BB9\u3002";
|
|
120
|
+
var EMPTY_ASSISTANT_FALLBACK_MESSAGE = "\u6A21\u578B\u8FDE\u7EED\u8FD4\u56DE\u7A7A\u6D88\u606F\uFF0C\u5F53\u524D\u4EFB\u52A1\u672A\u5B8C\u6210\u3002\u8BF7\u91CD\u8BD5\u5F53\u524D\u6B65\u9AA4\uFF0C\u6216\u7ED9\u51FA\u66F4\u5177\u4F53\u7684\u4FEE\u6539\u8303\u56F4\u3002";
|
|
121
|
+
var LENGTH_TRUNCATED_FALLBACK_MESSAGE = "\u8F93\u51FA\u8FBE\u5230\u957F\u5EA6\u4E0A\u9650\u88AB\u622A\u65AD\uFF0C\u5EFA\u8BAE\u7F29\u77ED\u4EFB\u52A1\u6216\u63D0\u9AD8\u8F93\u51FA\u4E0A\u9650\u3002";
|
|
122
|
+
var STREAM_TRUNCATED_FALLBACK_MESSAGE = "\u4E0A\u6E38\u54CD\u5E94\u6D41\u5728\u6536\u5C3E\u524D\u88AB\u4E2D\u65AD\uFF08\u672A\u6536\u5230\u7ED3\u675F\u6807\u8BB0\uFF09\uFF0C\u672C\u8F6E\u8F93\u51FA\u4E0D\u5B8C\u6574\u3002\u8BF7\u91CD\u8BD5\u5F53\u524D\u6B65\u9AA4\u3002";
|
|
123
|
+
var REPETITION_LOOP_FALLBACK_MESSAGE = "\u68C0\u6D4B\u5230\u6A21\u578B\u9677\u5165\u91CD\u590D\u8F93\u51FA\u6B7B\u5FAA\u73AF\uFF0C\u5DF2\u81EA\u52A8\u7194\u65AD\u7EC8\u6B62\u5F53\u524D\u4EFB\u52A1\u3002";
|
|
124
|
+
var STAGNANT_TOOL_CALLS_FALLBACK_MESSAGE = "\u68C0\u6D4B\u5230\u8FDE\u7EED\u591A\u6B21\u76F8\u540C\u5DE5\u5177\u8C03\u7528\u4E14\u65E0\u5B9E\u8D28\u8FDB\u5C55\uFF0C\u5DF2\u81EA\u52A8\u7194\u65AD\u7EC8\u6B62\u5F53\u524D\u4EFB\u52A1\u3002";
|
|
125
|
+
var MAX_REASONING_ONLY_REPAIRS = 2;
|
|
126
|
+
function resolveEmptyAssistantOutcome(args) {
|
|
127
|
+
if (args.hasVisibleOutput && !args.hasToolCalls && !args.finishReason && !args.streamComplete) {
|
|
128
|
+
return { kind: "ok_with_warning", reason: "stream_truncated" };
|
|
129
|
+
}
|
|
130
|
+
if (args.hasToolCalls || args.hasVisibleOutput) return { kind: "ok" };
|
|
131
|
+
if (args.finishReason === "length") return { kind: "fallback", reason: "length_truncated" };
|
|
132
|
+
if (!args.finishReason && !args.streamComplete) {
|
|
133
|
+
if (!args.repairUsed) return { kind: "repair" };
|
|
134
|
+
return { kind: "fallback", reason: "stream_truncated" };
|
|
135
|
+
}
|
|
136
|
+
if (args.hasReasoning && (args.reasoningRepairCount ?? 0) < MAX_REASONING_ONLY_REPAIRS) {
|
|
137
|
+
return { kind: "repair" };
|
|
138
|
+
}
|
|
139
|
+
if (!args.repairUsed) return { kind: "repair" };
|
|
140
|
+
return { kind: "fallback", reason: "empty_completion" };
|
|
141
|
+
}
|
|
142
|
+
function resolveEmptyAssistantFallbackMessage(reason) {
|
|
143
|
+
if (reason === "length_truncated") return LENGTH_TRUNCATED_FALLBACK_MESSAGE;
|
|
144
|
+
if (reason === "stream_truncated") return STREAM_TRUNCATED_FALLBACK_MESSAGE;
|
|
145
|
+
if (reason === "repetition_loop") return REPETITION_LOOP_FALLBACK_MESSAGE;
|
|
146
|
+
if (reason === "stagnant_tool_calls") return STAGNANT_TOOL_CALLS_FALLBACK_MESSAGE;
|
|
147
|
+
return EMPTY_ASSISTANT_FALLBACK_MESSAGE;
|
|
148
|
+
}
|
|
149
|
+
function hasAssistantVisibleOutput(content) {
|
|
150
|
+
if (typeof content === "string") return content.trim().length > 0;
|
|
151
|
+
if (!Array.isArray(content)) return false;
|
|
152
|
+
return content.some((part) => {
|
|
153
|
+
if (part?.type === "text" && String(part.text ?? "").trim()) return true;
|
|
154
|
+
if (part?.type === "image_url") {
|
|
155
|
+
const url = part?.image_url?.url;
|
|
156
|
+
return typeof url === "string" && url.trim().length > 0;
|
|
157
|
+
}
|
|
158
|
+
return false;
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
var LENGTH_TRUNCATED_REASONING_MARKER = "[length_truncated_reasoning_tail]";
|
|
162
|
+
var STREAM_TRUNCATED_REASONING_MARKER = "[stream_truncated_reasoning_tail]";
|
|
163
|
+
var MAX_TRUNCATED_REASONING_CHARS = 2e3;
|
|
164
|
+
function formatReasoningTailWithMarker(reasoning_content, marker, maxChars) {
|
|
165
|
+
if (typeof reasoning_content !== "string") return null;
|
|
166
|
+
const trimmed = reasoning_content.trim();
|
|
167
|
+
if (trimmed.length === 0) return null;
|
|
168
|
+
const tail = trimmed.length > maxChars ? trimmed.slice(-maxChars) : trimmed;
|
|
169
|
+
return `[nolo] ${marker}
|
|
170
|
+
${tail}`;
|
|
171
|
+
}
|
|
172
|
+
function formatLengthTruncatedReasoningTail(reasoning_content, maxChars = MAX_TRUNCATED_REASONING_CHARS) {
|
|
173
|
+
return formatReasoningTailWithMarker(reasoning_content, LENGTH_TRUNCATED_REASONING_MARKER, maxChars);
|
|
174
|
+
}
|
|
175
|
+
function formatStreamTruncatedReasoningTail(reasoning_content, maxChars = MAX_TRUNCATED_REASONING_CHARS) {
|
|
176
|
+
return formatReasoningTailWithMarker(reasoning_content, STREAM_TRUNCATED_REASONING_MARKER, maxChars);
|
|
177
|
+
}
|
|
178
|
+
function resolveTruncatedReasoningTailLog(reason, reasoning_content) {
|
|
179
|
+
if (reason === "length_truncated") {
|
|
180
|
+
return formatLengthTruncatedReasoningTail(reasoning_content);
|
|
181
|
+
}
|
|
182
|
+
if (reason === "stream_truncated") {
|
|
183
|
+
return formatStreamTruncatedReasoningTail(reasoning_content);
|
|
184
|
+
}
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
|
|
118
188
|
// packages/agent-runtime/autoExecutionProfiles.ts
|
|
119
189
|
var createProfile = (input) => ({
|
|
120
190
|
id: input.id,
|
|
@@ -156,6 +226,16 @@ export {
|
|
|
156
226
|
DEFAULT_CONTEXT_WINDOW,
|
|
157
227
|
getModelContextWindow,
|
|
158
228
|
getModelInfo,
|
|
229
|
+
EMPTY_ASSISTANT_REPAIR_PROMPT,
|
|
230
|
+
EMPTY_ASSISTANT_FALLBACK_MESSAGE,
|
|
231
|
+
LENGTH_TRUNCATED_FALLBACK_MESSAGE,
|
|
232
|
+
STREAM_TRUNCATED_FALLBACK_MESSAGE,
|
|
233
|
+
REPETITION_LOOP_FALLBACK_MESSAGE,
|
|
234
|
+
STAGNANT_TOOL_CALLS_FALLBACK_MESSAGE,
|
|
235
|
+
resolveEmptyAssistantOutcome,
|
|
236
|
+
resolveEmptyAssistantFallbackMessage,
|
|
237
|
+
hasAssistantVisibleOutput,
|
|
238
|
+
resolveTruncatedReasoningTailLog,
|
|
159
239
|
DEFAULT_AUTO_EXECUTION_PROFILE,
|
|
160
240
|
resolveAutoExecutionProfile
|
|
161
241
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TOOL_PACKS,
|
|
3
3
|
buildCodeWorkDiscipline
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-LGUQHYAL.js";
|
|
5
5
|
import {
|
|
6
6
|
buildSkillDocMarkdown,
|
|
7
7
|
resolvePageSkillMetadata
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-EY7V7REW.js";
|
|
9
9
|
import {
|
|
10
10
|
canonicalizeToolNames
|
|
11
11
|
} from "./chunk-O6OSWFZQ.js";
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BUILTIN_SUMMARY_LLM_CONFIG
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EVBFYPDC.js";
|
|
4
4
|
import {
|
|
5
5
|
buildDialogAttachmentPlan,
|
|
6
6
|
extractFileContentIds
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-H2G6JXTR.js";
|
|
8
8
|
import {
|
|
9
9
|
isOAuthApiKeyRef
|
|
10
10
|
} from "./chunk-YYLHWIW6.js";
|
|
11
|
+
import {
|
|
12
|
+
runLlm
|
|
13
|
+
} from "./chunk-XOFZEJGM.js";
|
|
11
14
|
import {
|
|
12
15
|
getApproxPricePerImage
|
|
13
16
|
} from "./chunk-AGGIDPCZ.js";
|
|
14
|
-
import {
|
|
15
|
-
runLlm
|
|
16
|
-
} from "./chunk-CVXDBLYH.js";
|
|
17
17
|
import {
|
|
18
18
|
cleanupCliSessionForDialog
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-HAPCUPEO.js";
|
|
20
20
|
import {
|
|
21
21
|
getActiveDialogAgentId,
|
|
22
22
|
getDialogAgentIds,
|
|
@@ -43,10 +43,15 @@ import {
|
|
|
43
43
|
import {
|
|
44
44
|
DEFAULT_AUTO_EXECUTION_PROFILE,
|
|
45
45
|
DEFAULT_CONTEXT_WINDOW,
|
|
46
|
+
EMPTY_ASSISTANT_FALLBACK_MESSAGE,
|
|
47
|
+
LENGTH_TRUNCATED_FALLBACK_MESSAGE,
|
|
48
|
+
REPETITION_LOOP_FALLBACK_MESSAGE,
|
|
49
|
+
STAGNANT_TOOL_CALLS_FALLBACK_MESSAGE,
|
|
50
|
+
STREAM_TRUNCATED_FALLBACK_MESSAGE,
|
|
46
51
|
getModelContextWindow,
|
|
47
52
|
getModelInfo,
|
|
48
53
|
resolveAutoExecutionProfile
|
|
49
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-4MXGXSYN.js";
|
|
50
55
|
import {
|
|
51
56
|
COMPACTION_SUMMARY_SYSTEM_PROMPT,
|
|
52
57
|
buildCompactionMetricsFromPlan,
|
|
@@ -58,26 +63,26 @@ import {
|
|
|
58
63
|
normalizeAssistantContentBuffer,
|
|
59
64
|
planCompression,
|
|
60
65
|
serializeMessageContent
|
|
61
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-GK74OOFT.js";
|
|
62
67
|
import {
|
|
63
68
|
findModelConfig,
|
|
64
69
|
getModelConfig
|
|
65
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-OZVGA4SY.js";
|
|
66
71
|
import {
|
|
67
72
|
toErrorMessage
|
|
68
73
|
} from "./chunk-HNMXYYJR.js";
|
|
69
74
|
import {
|
|
70
75
|
fetchMessages
|
|
71
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-FA4SY4F5.js";
|
|
72
77
|
import {
|
|
73
78
|
getPlatformHostedDeepSeekV4Price,
|
|
74
79
|
isPlatformHostedDeepSeekV4Model,
|
|
75
80
|
isPlatformHostedImageModel,
|
|
76
81
|
isPlatformHostedOpenAIImageModel
|
|
77
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-ENYDQKOB.js";
|
|
78
83
|
import {
|
|
79
84
|
nolotusId
|
|
80
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-EMEUU5IY.js";
|
|
81
86
|
import {
|
|
82
87
|
asRecordOrEmpty
|
|
83
88
|
} from "./chunk-KX6YBIHG.js";
|
|
@@ -87,7 +92,7 @@ import {
|
|
|
87
92
|
remove,
|
|
88
93
|
selectById,
|
|
89
94
|
write
|
|
90
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-WVGEBWA6.js";
|
|
91
96
|
import {
|
|
92
97
|
buildDialogAgentListIndexDeleteOps,
|
|
93
98
|
createDialogMessageKeyAndId,
|
|
@@ -98,13 +103,13 @@ import {
|
|
|
98
103
|
isDialogRecordKey,
|
|
99
104
|
isPageKey,
|
|
100
105
|
isTableMetaKey
|
|
101
|
-
} from "./chunk-
|
|
102
|
-
import {
|
|
103
|
-
asTrimmedNonEmptyStringArray
|
|
104
|
-
} from "./chunk-I42VC5KR.js";
|
|
106
|
+
} from "./chunk-SVEUG45B.js";
|
|
105
107
|
import {
|
|
106
108
|
asOptionalFiniteNumber
|
|
107
109
|
} from "./chunk-WWC7I6TA.js";
|
|
110
|
+
import {
|
|
111
|
+
asTrimmedNonEmptyStringArray
|
|
112
|
+
} from "./chunk-I42VC5KR.js";
|
|
108
113
|
import {
|
|
109
114
|
asTrimmedLowercaseString
|
|
110
115
|
} from "./chunk-QSJ3HFEF.js";
|
|
@@ -112,7 +117,7 @@ import {
|
|
|
112
117
|
builtinAgentCatalogEntryById,
|
|
113
118
|
builtinRuntimeFallbackEntries,
|
|
114
119
|
isBuiltinPlatformAgentKey
|
|
115
|
-
} from "./chunk-
|
|
120
|
+
} from "./chunk-Z5NW3O7V.js";
|
|
116
121
|
import {
|
|
117
122
|
extractCustomId,
|
|
118
123
|
extractUserId,
|
|
@@ -1432,6 +1437,38 @@ var updateDialogSummaryAction = async (args, thunkApi) => {
|
|
|
1432
1437
|
}
|
|
1433
1438
|
};
|
|
1434
1439
|
|
|
1440
|
+
// packages/chat/messages/normalizeHistoricalReasoning.ts
|
|
1441
|
+
var HISTORICAL_REASONING_FALLBACK_MESSAGES = /* @__PURE__ */ new Set([
|
|
1442
|
+
EMPTY_ASSISTANT_FALLBACK_MESSAGE,
|
|
1443
|
+
LENGTH_TRUNCATED_FALLBACK_MESSAGE,
|
|
1444
|
+
STREAM_TRUNCATED_FALLBACK_MESSAGE,
|
|
1445
|
+
REPETITION_LOOP_FALLBACK_MESSAGE,
|
|
1446
|
+
STAGNANT_TOOL_CALLS_FALLBACK_MESSAGE
|
|
1447
|
+
]);
|
|
1448
|
+
function normalizeHistoricalReasoningMessage(message) {
|
|
1449
|
+
if (!message || typeof message !== "object") {
|
|
1450
|
+
return message;
|
|
1451
|
+
}
|
|
1452
|
+
if (message.role !== "assistant") {
|
|
1453
|
+
return message;
|
|
1454
|
+
}
|
|
1455
|
+
if (typeof message.thinkContent === "string" && message.thinkContent.trim().length > 0) {
|
|
1456
|
+
return message;
|
|
1457
|
+
}
|
|
1458
|
+
const reasoning = message.reasoning_content;
|
|
1459
|
+
if (typeof reasoning !== "string" || reasoning.trim().length === 0) {
|
|
1460
|
+
return message;
|
|
1461
|
+
}
|
|
1462
|
+
const content = message.content;
|
|
1463
|
+
if (typeof content !== "string" || !HISTORICAL_REASONING_FALLBACK_MESSAGES.has(content.trim())) {
|
|
1464
|
+
return message;
|
|
1465
|
+
}
|
|
1466
|
+
return {
|
|
1467
|
+
...message,
|
|
1468
|
+
thinkContent: reasoning
|
|
1469
|
+
};
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1435
1472
|
// packages/chat/messages/messageContract.ts
|
|
1436
1473
|
function separateThinkContent(contentBuffer) {
|
|
1437
1474
|
let thinkContent = "";
|
|
@@ -1907,16 +1944,27 @@ function resolveStreamEndBillingUsages(input) {
|
|
|
1907
1944
|
const { agentConfig, totalUsage, finalVisibleContent } = input;
|
|
1908
1945
|
const imageGenerationCount = countImageGenerationOutputsInContent(finalVisibleContent);
|
|
1909
1946
|
const billedUsage = isOpenAIBuiltInImageGenerationAgent(agentConfig) ? withImageGenerationCount(totalUsage, imageGenerationCount) : totalUsage;
|
|
1910
|
-
const
|
|
1947
|
+
const rawEstimatedUsage = estimateMissingUsage({
|
|
1911
1948
|
content: finalVisibleContent
|
|
1912
1949
|
});
|
|
1950
|
+
const providerCallId = typeof totalUsage === "object" && totalUsage !== null ? totalUsage.provider_call_id : void 0;
|
|
1951
|
+
const estimatedUsage = providerCallId ? { ...rawEstimatedUsage, provider_call_id: providerCallId } : rawEstimatedUsage;
|
|
1913
1952
|
const billedEstimatedUsage = isOpenAIBuiltInImageGenerationAgent(agentConfig) ? withImageGenerationCount(estimatedUsage, imageGenerationCount) : estimatedUsage;
|
|
1914
1953
|
const titleEligibleContent = serializeMessageContent(finalVisibleContent, "[\u56FE\u7247]") ?? "";
|
|
1954
|
+
const hasReportedTokens = Boolean(
|
|
1955
|
+
totalUsage && typeof totalUsage === "object" && ([
|
|
1956
|
+
"prompt_tokens",
|
|
1957
|
+
"completion_tokens",
|
|
1958
|
+
"total_tokens",
|
|
1959
|
+
"input_tokens",
|
|
1960
|
+
"output_tokens"
|
|
1961
|
+
].some((field) => Object.prototype.hasOwnProperty.call(totalUsage, field)) || Object.prototype.hasOwnProperty.call(totalUsage, "cost") && typeof totalUsage.cost === "number")
|
|
1962
|
+
);
|
|
1915
1963
|
return {
|
|
1916
1964
|
imageGenerationCount,
|
|
1917
1965
|
billedUsage,
|
|
1918
1966
|
billedEstimatedUsage,
|
|
1919
|
-
hasReportedUsage:
|
|
1967
|
+
hasReportedUsage: hasReportedTokens,
|
|
1920
1968
|
titleEligible: titleEligibleContent.trim() !== ""
|
|
1921
1969
|
};
|
|
1922
1970
|
}
|
|
@@ -2474,8 +2522,8 @@ function resolveStreamEndFinalMetadata(input) {
|
|
|
2474
2522
|
|
|
2475
2523
|
// packages/chat/messages/messageStreamEndPostWritePolicy.ts
|
|
2476
2524
|
function resolveStreamEndPostWritePolicy(input) {
|
|
2477
|
-
const { hasReportedUsage, agentProvider, titleEligible, textContent, toolCalls } = input;
|
|
2478
|
-
const billingMode = hasReportedUsage ? "reported" : agentProvider && agentProvider !== "custom" ? "estimated" : "skip";
|
|
2525
|
+
const { hasReportedUsage, billingFailed, skipBilling, agentProvider, titleEligible, textContent, toolCalls } = input;
|
|
2526
|
+
const billingMode = billingFailed || skipBilling ? "skip" : hasReportedUsage ? "reported" : agentProvider && agentProvider !== "custom" ? "estimated" : "skip";
|
|
2479
2527
|
const hasText = textContent.trim() !== "";
|
|
2480
2528
|
const noTools = !toolCalls || toolCalls.length === 0;
|
|
2481
2529
|
return {
|
|
@@ -2503,7 +2551,8 @@ async function dispatchStreamEndBilling(input) {
|
|
|
2503
2551
|
} = input;
|
|
2504
2552
|
try {
|
|
2505
2553
|
if (billingMode === "reported") {
|
|
2506
|
-
const
|
|
2554
|
+
const fallbackCallId = typeof billedUsage?.provider_call_id === "string" && billedUsage.provider_call_id.trim() ? billedUsage.provider_call_id.trim() : void 0;
|
|
2555
|
+
const usageRecords = billingUsageRecords?.length ? billingUsageRecords : [{ callId: fallbackCallId, usage: billedUsage }];
|
|
2507
2556
|
for (const usageRecord of usageRecords) {
|
|
2508
2557
|
await dispatch(
|
|
2509
2558
|
updateTokensAction2({
|
|
@@ -2790,13 +2839,22 @@ var findDialogIdByMessageDbKey = (state, dbKey) => {
|
|
|
2790
2839
|
return inferDialogIdFromDbKey(dbKey);
|
|
2791
2840
|
};
|
|
2792
2841
|
var upsertOneMessage = (dialogState, message) => {
|
|
2793
|
-
dialogState.msgs = messagesAdapter.upsertOne(
|
|
2842
|
+
dialogState.msgs = messagesAdapter.upsertOne(
|
|
2843
|
+
dialogState.msgs,
|
|
2844
|
+
normalizeHistoricalReasoningMessage(message)
|
|
2845
|
+
);
|
|
2794
2846
|
};
|
|
2795
2847
|
var upsertManyMessages = (dialogState, messages) => {
|
|
2796
|
-
dialogState.msgs = messagesAdapter.upsertMany(
|
|
2848
|
+
dialogState.msgs = messagesAdapter.upsertMany(
|
|
2849
|
+
dialogState.msgs,
|
|
2850
|
+
messages.map(normalizeHistoricalReasoningMessage)
|
|
2851
|
+
);
|
|
2797
2852
|
};
|
|
2798
2853
|
var addOneMessage = (dialogState, message) => {
|
|
2799
|
-
dialogState.msgs = messagesAdapter.addOne(
|
|
2854
|
+
dialogState.msgs = messagesAdapter.addOne(
|
|
2855
|
+
dialogState.msgs,
|
|
2856
|
+
normalizeHistoricalReasoningMessage(message)
|
|
2857
|
+
);
|
|
2800
2858
|
};
|
|
2801
2859
|
var updateOneMessage = (dialogState, payload) => {
|
|
2802
2860
|
dialogState.msgs = messagesAdapter.updateOne(dialogState.msgs, payload);
|
|
@@ -2811,7 +2869,10 @@ var removeAllMessages = (dialogState) => {
|
|
|
2811
2869
|
dialogState.msgs = messagesAdapter.removeAll(dialogState.msgs);
|
|
2812
2870
|
};
|
|
2813
2871
|
var setAllMessages = (dialogState, messages) => {
|
|
2814
|
-
dialogState.msgs = messagesAdapter.setAll(
|
|
2872
|
+
dialogState.msgs = messagesAdapter.setAll(
|
|
2873
|
+
dialogState.msgs,
|
|
2874
|
+
messages.map(normalizeHistoricalReasoningMessage)
|
|
2875
|
+
);
|
|
2815
2876
|
};
|
|
2816
2877
|
var messageActions;
|
|
2817
2878
|
var messageSlice = createSliceWithThunks({
|
|
@@ -3231,7 +3292,9 @@ var messageSlice = createSliceWithThunks({
|
|
|
3231
3292
|
messageId,
|
|
3232
3293
|
reasoningBuffer,
|
|
3233
3294
|
toolCalls,
|
|
3234
|
-
finishReason
|
|
3295
|
+
finishReason,
|
|
3296
|
+
billingFailed,
|
|
3297
|
+
skipBilling
|
|
3235
3298
|
} = payload;
|
|
3236
3299
|
const spaceId = payload.spaceId;
|
|
3237
3300
|
const rawAgentName = asTrimmedString(agentConfig?.name);
|
|
@@ -3318,6 +3381,8 @@ var messageSlice = createSliceWithThunks({
|
|
|
3318
3381
|
addRefs
|
|
3319
3382
|
} = resolveStreamEndPostWritePolicy({
|
|
3320
3383
|
hasReportedUsage,
|
|
3384
|
+
billingFailed,
|
|
3385
|
+
skipBilling,
|
|
3321
3386
|
agentProvider: agentConfig?.provider,
|
|
3322
3387
|
titleEligible,
|
|
3323
3388
|
textContent,
|
|
@@ -3519,7 +3584,7 @@ var messageSlice = createSliceWithThunks({
|
|
|
3519
3584
|
runtimeOptions: args.runtimeOptions
|
|
3520
3585
|
});
|
|
3521
3586
|
if (agentKeyToUse) {
|
|
3522
|
-
const { streamAgentChatTurn } = await import("./agentSlice-
|
|
3587
|
+
const { streamAgentChatTurn } = await import("./agentSlice-B5O3RTRP.js");
|
|
3523
3588
|
await dispatch(
|
|
3524
3589
|
streamAgentChatTurn({
|
|
3525
3590
|
agentKey: agentKeyToUse,
|
|
@@ -4088,12 +4153,13 @@ var normalizeUsage = (usage) => {
|
|
|
4088
4153
|
output_tokens: 0,
|
|
4089
4154
|
total_tokens: 0,
|
|
4090
4155
|
cache_creation_input_tokens: 0,
|
|
4091
|
-
cache_read_input_tokens: 0
|
|
4156
|
+
cache_read_input_tokens: 0,
|
|
4157
|
+
cost: 0
|
|
4092
4158
|
};
|
|
4093
4159
|
}
|
|
4094
4160
|
const inputTokens = "input_tokens" in usage ? usage.input_tokens ?? 0 : "prompt_tokens" in usage ? usage.prompt_tokens : 0;
|
|
4095
4161
|
const outputTokens = "output_tokens" in usage ? usage.output_tokens ?? 0 : "completion_tokens" in usage ? usage.completion_tokens : 0;
|
|
4096
|
-
const cacheCreationInputTokens = "cache_creation_input_tokens" in usage ? usage.cache_creation_input_tokens ?? 0 : "prompt_cache_miss_tokens" in usage ? usage.prompt_cache_miss_tokens : 0;
|
|
4162
|
+
const cacheCreationInputTokens = "cache_creation_input_tokens" in usage ? usage.cache_creation_input_tokens ?? 0 : "prompt_cache_miss_tokens" in usage ? usage.prompt_cache_miss_tokens ?? 0 : 0;
|
|
4097
4163
|
const cacheReadInputTokens = finiteTokenCount(usage.cache_read_input_tokens) ?? finiteTokenCount(usage.prompt_cache_hit_tokens) ?? readNestedTokenCount(usage, ["input_tokens_details", "cached_tokens"]) ?? readNestedTokenCount(usage, ["prompt_tokens_details", "cached_tokens"]) ?? 0;
|
|
4098
4164
|
let cost = 0;
|
|
4099
4165
|
const providedCost = readFiniteNumberField(usage, "cost");
|
|
@@ -4120,6 +4186,7 @@ var normalizeUsage = (usage) => {
|
|
|
4120
4186
|
return {
|
|
4121
4187
|
input_tokens: inputTokens,
|
|
4122
4188
|
output_tokens: outputTokens,
|
|
4189
|
+
total_tokens: finiteTokenCount(usage.total_tokens) ?? inputTokens + outputTokens,
|
|
4123
4190
|
cache_creation_input_tokens: cacheCreationInputTokens,
|
|
4124
4191
|
cache_read_input_tokens: cacheReadInputTokens,
|
|
4125
4192
|
cost,
|
|
@@ -4317,7 +4384,9 @@ function normalizeDayStats(prev, userId, timeKey) {
|
|
|
4317
4384
|
models: {},
|
|
4318
4385
|
providers: {},
|
|
4319
4386
|
agents: {},
|
|
4320
|
-
entryPaths: {}
|
|
4387
|
+
entryPaths: {},
|
|
4388
|
+
categories: {},
|
|
4389
|
+
modelCategories: {}
|
|
4321
4390
|
};
|
|
4322
4391
|
}
|
|
4323
4392
|
const normalizeMap = (m) => {
|
|
@@ -4326,13 +4395,37 @@ function normalizeDayStats(prev, userId, timeKey) {
|
|
|
4326
4395
|
for (const [k, v] of Object.entries(m)) out[k] = normalizeStats(v);
|
|
4327
4396
|
return out;
|
|
4328
4397
|
};
|
|
4398
|
+
const normalizedTotal = normalizeStats(prev.total);
|
|
4399
|
+
const normalizedModels = normalizeMap(prev.models);
|
|
4400
|
+
const normalizedProviders = normalizeMap(prev.providers);
|
|
4401
|
+
const normalizedAgents = normalizeMap(prev.agents);
|
|
4402
|
+
const normalizedEntryPaths = normalizeMap(prev.entryPaths);
|
|
4403
|
+
let categories = normalizeMap(prev.categories);
|
|
4404
|
+
let modelCategories = normalizeMap(prev.modelCategories);
|
|
4405
|
+
const hasCategories = Object.keys(categories).length > 0;
|
|
4406
|
+
const hasModelCategories = Object.keys(modelCategories).length > 0;
|
|
4407
|
+
if (!hasCategories) {
|
|
4408
|
+
const hasActivity = normalizedTotal.count > 0 || normalizedTotal.failedCount > 0 || normalizedTotal.cost > 0 || normalizedTotal.tokens.input > 0 || normalizedTotal.tokens.output > 0;
|
|
4409
|
+
if (hasActivity) {
|
|
4410
|
+
categories = { platform: { ...normalizedTotal } };
|
|
4411
|
+
}
|
|
4412
|
+
}
|
|
4413
|
+
if (!hasModelCategories && Object.keys(normalizedModels).length > 0) {
|
|
4414
|
+
const legacyModelCats = {};
|
|
4415
|
+
for (const [modelKey, modelStat] of Object.entries(normalizedModels)) {
|
|
4416
|
+
legacyModelCats[`${modelKey}:::platform`] = { ...modelStat };
|
|
4417
|
+
}
|
|
4418
|
+
modelCategories = legacyModelCats;
|
|
4419
|
+
}
|
|
4329
4420
|
return {
|
|
4330
4421
|
...prev,
|
|
4331
|
-
total:
|
|
4332
|
-
models:
|
|
4333
|
-
providers:
|
|
4334
|
-
agents:
|
|
4335
|
-
entryPaths:
|
|
4422
|
+
total: normalizedTotal,
|
|
4423
|
+
models: normalizedModels,
|
|
4424
|
+
providers: normalizedProviders,
|
|
4425
|
+
agents: normalizedAgents,
|
|
4426
|
+
entryPaths: normalizedEntryPaths,
|
|
4427
|
+
categories,
|
|
4428
|
+
modelCategories
|
|
4336
4429
|
};
|
|
4337
4430
|
}
|
|
4338
4431
|
function applyTokenUsageToDayStats(prev, delta) {
|
|
@@ -4342,6 +4435,8 @@ function applyTokenUsageToDayStats(prev, delta) {
|
|
|
4342
4435
|
const cacheRead = delta.cache_read_input_tokens ?? 0;
|
|
4343
4436
|
const cacheCreation = delta.cache_creation_input_tokens ?? 0;
|
|
4344
4437
|
const isFailed = delta.status === "failed";
|
|
4438
|
+
const category = delta.billingCategory || "platform";
|
|
4439
|
+
const modelCategoryKey = `${modelName}:::${category}`;
|
|
4345
4440
|
const inc = (s) => {
|
|
4346
4441
|
const n = normalizeStats(s);
|
|
4347
4442
|
if (isFailed) {
|
|
@@ -4358,7 +4453,9 @@ function applyTokenUsageToDayStats(prev, delta) {
|
|
|
4358
4453
|
cacheRead: n.tokens.cacheRead + cacheRead,
|
|
4359
4454
|
cacheCreation: n.tokens.cacheCreation + cacheCreation
|
|
4360
4455
|
},
|
|
4361
|
-
|
|
4456
|
+
// 非计费记录(订阅/OAuth/CLI,billable=false)不向平台积分统计贡献 cost:
|
|
4457
|
+
// 订阅已付费、不按 token 计费,若不归零,图表「成本」视图会把订阅用量误显示为积分消耗。
|
|
4458
|
+
cost: Number((n.cost + (category === "subscription" ? 0 : delta.cost)).toFixed(6)),
|
|
4362
4459
|
failedCount: n.failedCount
|
|
4363
4460
|
};
|
|
4364
4461
|
};
|
|
@@ -4372,6 +4469,14 @@ function applyTokenUsageToDayStats(prev, delta) {
|
|
|
4372
4469
|
providers: {
|
|
4373
4470
|
...base.providers,
|
|
4374
4471
|
[providerName]: inc(base.providers[providerName])
|
|
4472
|
+
},
|
|
4473
|
+
categories: {
|
|
4474
|
+
...base.categories,
|
|
4475
|
+
[category]: inc(base.categories?.[category])
|
|
4476
|
+
},
|
|
4477
|
+
modelCategories: {
|
|
4478
|
+
...base.modelCategories,
|
|
4479
|
+
[modelCategoryKey]: inc(base.modelCategories?.[modelCategoryKey])
|
|
4375
4480
|
}
|
|
4376
4481
|
};
|
|
4377
4482
|
if (delta.agentId !== void 0) {
|
|
@@ -4443,7 +4548,8 @@ var updateStats = async (data, existingStats, key, thunkApi) => {
|
|
|
4443
4548
|
cache_read_input_tokens: data.cache_read_input_tokens,
|
|
4444
4549
|
cache_creation_input_tokens: data.cache_creation_input_tokens,
|
|
4445
4550
|
agentId: data.agentId ?? data.cybotId,
|
|
4446
|
-
entry_path: data.entry_path
|
|
4551
|
+
entry_path: data.entry_path,
|
|
4552
|
+
billingCategory: data.billable ? "platform" : "subscription"
|
|
4447
4553
|
});
|
|
4448
4554
|
await thunkApi.dispatch(
|
|
4449
4555
|
write({
|
|
@@ -4516,8 +4622,8 @@ var updateTokensAction = async ({ dialogId, dialogKey, usage: legacyUsage, usage
|
|
|
4516
4622
|
currentAccountUserId: currentUser?.userId ?? null
|
|
4517
4623
|
});
|
|
4518
4624
|
const timestamp = Date.now();
|
|
4519
|
-
const callId = typeof usageRecord?.callId === "string" && usageRecord.callId ? usageRecord.callId : void 0;
|
|
4520
4625
|
const usageRaw = usageRecord?.usage ?? legacyUsage;
|
|
4626
|
+
const callId = (typeof usageRecord?.callId === "string" && usageRecord.callId.trim() ? usageRecord.callId.trim() : void 0) ?? (typeof usageRaw?.provider_call_id === "string" && usageRaw.provider_call_id.trim() ? usageRaw.provider_call_id.trim() : void 0);
|
|
4521
4627
|
const usageWithStableCallId = callId && !usageRaw?.provider_call_id ? { ...usageRaw, provider_call_id: callId } : usageRaw;
|
|
4522
4628
|
const callAgentConfig = {
|
|
4523
4629
|
...agentConfig,
|
|
@@ -4742,7 +4848,7 @@ var deleteDialogThunk = async (payload, thunkApi) => {
|
|
|
4742
4848
|
}
|
|
4743
4849
|
if (isCurrentDialog) {
|
|
4744
4850
|
await thunkApi.dispatch(resetMsgs());
|
|
4745
|
-
const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-
|
|
4851
|
+
const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-YHGPDBAZ.js");
|
|
4746
4852
|
dispatch(clearPendingAttachments2());
|
|
4747
4853
|
}
|
|
4748
4854
|
return { dialogKey, isCurrentDialog, attachmentPlan };
|
|
@@ -4750,39 +4856,39 @@ var deleteDialogThunk = async (payload, thunkApi) => {
|
|
|
4750
4856
|
|
|
4751
4857
|
// packages/chat/dialog/dialogSlice.ts
|
|
4752
4858
|
var runCreateDialogAction = async (args, thunkApi) => {
|
|
4753
|
-
const { createDialogAction } = await import("./createDialogAction-
|
|
4859
|
+
const { createDialogAction } = await import("./createDialogAction-EOQFCM3K.js");
|
|
4754
4860
|
return createDialogAction(args, thunkApi);
|
|
4755
4861
|
};
|
|
4756
4862
|
var runCreateAgentAutomationAction = async (args, thunkApi) => {
|
|
4757
|
-
const { createAgentAutomationAction } = await import("./createAgentAutomationAction-
|
|
4863
|
+
const { createAgentAutomationAction } = await import("./createAgentAutomationAction-TQ7PYONU.js");
|
|
4758
4864
|
return createAgentAutomationAction(args, thunkApi);
|
|
4759
4865
|
};
|
|
4760
4866
|
var runUpdateDialogTitleAction = async (args, thunkApi) => {
|
|
4761
|
-
const { updateDialogTitleAction } = await import("./updateDialogTitleAction-
|
|
4867
|
+
const { updateDialogTitleAction } = await import("./updateDialogTitleAction-XAGMXHW5.js");
|
|
4762
4868
|
return updateDialogTitleAction(args, thunkApi);
|
|
4763
4869
|
};
|
|
4764
4870
|
var runAddDialogAgentAction = async (args, thunkApi) => {
|
|
4765
|
-
const { addDialogAgentAction } = await import("./addDialogAgentAction-
|
|
4871
|
+
const { addDialogAgentAction } = await import("./addDialogAgentAction-W3JGU4F7.js");
|
|
4766
4872
|
return addDialogAgentAction(args, thunkApi);
|
|
4767
4873
|
};
|
|
4768
4874
|
var runRemoveDialogAgentAction = async (args, thunkApi) => {
|
|
4769
|
-
const { removeDialogAgentAction } = await import("./removeDialogAgentAction-
|
|
4875
|
+
const { removeDialogAgentAction } = await import("./removeDialogAgentAction-DNONRKST.js");
|
|
4770
4876
|
return removeDialogAgentAction(args, thunkApi);
|
|
4771
4877
|
};
|
|
4772
4878
|
var runSetPrimaryDialogAgentAction = async (args, thunkApi) => {
|
|
4773
|
-
const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-
|
|
4879
|
+
const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-6C2HYNEC.js");
|
|
4774
4880
|
return setPrimaryDialogAgentAction(args, thunkApi);
|
|
4775
4881
|
};
|
|
4776
4882
|
var runSwitchDialogAgentAction = async (args, thunkApi) => {
|
|
4777
|
-
const { switchDialogAgentAction } = await import("./switchDialogAgentAction-
|
|
4883
|
+
const { switchDialogAgentAction } = await import("./switchDialogAgentAction-HP57XYFP.js");
|
|
4778
4884
|
return switchDialogAgentAction(args, thunkApi);
|
|
4779
4885
|
};
|
|
4780
4886
|
var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
|
|
4781
|
-
const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-
|
|
4887
|
+
const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-ERHUPT3F.js");
|
|
4782
4888
|
return setDialogExtraReferencesAction(args, thunkApi);
|
|
4783
4889
|
};
|
|
4784
4890
|
var runHandleSendMessageAction = async (args, thunkApi) => {
|
|
4785
|
-
const { handleSendMessageAction } = await import("./handleSendMessageAction-
|
|
4891
|
+
const { handleSendMessageAction } = await import("./handleSendMessageAction-WT4FDMQS.js");
|
|
4786
4892
|
return handleSendMessageAction(args, thunkApi);
|
|
4787
4893
|
};
|
|
4788
4894
|
function clearDialogState() {
|
|
@@ -4795,7 +4901,7 @@ var createPageAndAddReference = createAsyncThunk(
|
|
|
4795
4901
|
async (payload, { dispatch, getState, rejectWithValue }) => {
|
|
4796
4902
|
const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
|
|
4797
4903
|
try {
|
|
4798
|
-
const { createDocState } = await import("./docStore-
|
|
4904
|
+
const { createDocState } = await import("./docStore-WIKRGVQJ.js");
|
|
4799
4905
|
const pageKey = await createDocState(
|
|
4800
4906
|
{ slateData, title },
|
|
4801
4907
|
{ dispatch, getState }
|