jinzd-ai-cli 0.4.262 → 0.4.263
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -14
- package/README.zh-CN.md +21 -16
- package/THIRD_PARTY_NOTICES.md +88 -0
- package/dist/{batch-2B7UUX27.js → batch-AN47AYCZ.js} +2 -2
- package/dist/{chunk-XZNRZGG2.js → chunk-3OBY7WSS.js} +1 -0
- package/dist/{chunk-ZQZEBPAQ.js → chunk-3RHY2HF7.js} +1 -1
- package/dist/{chunk-JFXKQPKY.js → chunk-5K2LFD7D.js} +1 -1
- package/dist/{chunk-BS44XEZ4.js → chunk-7YCA2BD3.js} +1 -1
- package/dist/{chunk-FWBSGBB7.js → chunk-B27MLWFJ.js} +4 -4
- package/dist/{chunk-D6DHS5GL.js → chunk-GKI7B4BD.js} +7 -6
- package/dist/{chunk-2XPJRRBB.js → chunk-GMZTY7DA.js} +4 -4
- package/dist/{chunk-WAAFA32V.js → chunk-MJICIIBW.js} +1 -1
- package/dist/{chunk-A6JLBNAI.js → chunk-MTZ6XHJD.js} +2 -2
- package/dist/{chunk-DQY2DDGS.js → chunk-QG4NG7KJ.js} +1 -1
- package/dist/{chunk-JEJHNVA2.js → chunk-QMB7QYZC.js} +1 -1
- package/dist/{chunk-25HFWCM3.js → chunk-TL5MD5XU.js} +31 -19
- package/dist/{chunk-KWYJFLXY.js → chunk-VKBGOFEO.js} +1 -1
- package/dist/{chunk-KMS3LBO3.js → chunk-VUZAKIZ5.js} +1 -1
- package/dist/{chunk-MTIS7H6V.js → chunk-WM4VTGAF.js} +3 -1
- package/dist/{chunk-HPDI4F5F.js → chunk-XST4N2JM.js} +1 -1
- package/dist/{chunk-EZ6QLHOS.js → chunk-YRD6M5XI.js} +30 -5
- package/dist/{ci-G6OZDH4H.js → ci-JTO7LN5S.js} +6 -6
- package/dist/{ci-format-BRS7G5X5.js → ci-format-2VGHOLBA.js} +2 -2
- package/dist/{constants-24AD5JQV.js → constants-HLSJL5HQ.js} +1 -1
- package/dist/{doctor-cli-WWZRFGQJ.js → doctor-cli-JML4FGH4.js} +6 -6
- package/dist/electron-server.js +94 -34
- package/dist/{hub-2DYZQVEN.js → hub-6EYFGJRT.js} +1 -1
- package/dist/index.js +103 -56
- package/dist/{persistent-memory-DFSZZSYP.js → persistent-memory-ANIMO5CF.js} +2 -2
- package/dist/{persistent-memory-LJT37XVO.js → persistent-memory-MPBPSZDN.js} +2 -2
- package/dist/{pr-OOIQPCBX.js → pr-XE7NGT6U.js} +6 -6
- package/dist/{run-tests-ICTVJSJN.js → run-tests-ME5KED57.js} +2 -2
- package/dist/{run-tests-W4TG4OQV.js → run-tests-TF7UPUWW.js} +2 -2
- package/dist/{server-GTVYIHBG.js → server-BIYJEJK3.js} +6 -6
- package/dist/{server-IXUVVPTV.js → server-VKA4FR2Z.js} +37 -18
- package/dist/{task-orchestrator-6MHSDOFR.js → task-orchestrator-2RAKLFWN.js} +6 -6
- package/dist/{usage-23I3ZJZO.js → usage-5F5Q3GGR.js} +4 -4
- package/dist/web/client/app.js +1 -1
- package/package.json +13 -10
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/core/pricing.ts
|
|
4
|
+
var DEEPSEEK_CNY_PER_USD = 6.9;
|
|
5
|
+
var DEEPSEEK_TIME_PRICING_EFFECTIVE_AT = /* @__PURE__ */ new Date("2026-08-16T16:00:00.000Z");
|
|
6
|
+
function deepSeekCnyPricing(cacheRead, input, output) {
|
|
7
|
+
return {
|
|
8
|
+
cacheRead: cacheRead / DEEPSEEK_CNY_PER_USD,
|
|
9
|
+
input: input / DEEPSEEK_CNY_PER_USD,
|
|
10
|
+
output: output / DEEPSEEK_CNY_PER_USD
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function getDeepSeekV4Pricing(model, at) {
|
|
14
|
+
const isPro = model.startsWith("deepseek-v4-pro");
|
|
15
|
+
const isFlash = model.startsWith("deepseek-v4-flash");
|
|
16
|
+
if (!isPro && !isFlash) return null;
|
|
17
|
+
if (at < DEEPSEEK_TIME_PRICING_EFFECTIVE_AT) {
|
|
18
|
+
return isPro ? deepSeekCnyPricing(0.025, 3, 6) : deepSeekCnyPricing(0.02, 1, 2);
|
|
19
|
+
}
|
|
20
|
+
const beijingHour = (at.getUTCHours() + 8) % 24;
|
|
21
|
+
const isPeak = beijingHour >= 9 && beijingHour < 12 || beijingHour >= 14 && beijingHour < 18;
|
|
22
|
+
if (isPro) {
|
|
23
|
+
return isPeak ? deepSeekCnyPricing(0.3, 9, 27) : deepSeekCnyPricing(0.15, 4.5, 13.5);
|
|
24
|
+
}
|
|
25
|
+
return isPeak ? deepSeekCnyPricing(0.1, 3, 9) : deepSeekCnyPricing(0.05, 1.5, 4.5);
|
|
26
|
+
}
|
|
4
27
|
var PRICING_TABLE = {
|
|
5
28
|
// ── Anthropic Claude ──────────────────────────────────────────
|
|
6
29
|
"claude-opus-4-8": { input: 15, output: 75, cacheWrite: 18.75, cacheRead: 1.5 },
|
|
@@ -44,8 +67,6 @@ var PRICING_TABLE = {
|
|
|
44
67
|
// 20% 拍脑袋而非抄文档)——`aicli usage` 因此系统性高报 DeepSeek 成本。
|
|
45
68
|
// 待办:官方已公告峰谷定价(北京时间 9-12 点、14-18 点为平时 2 倍),本表仍是单一费率,
|
|
46
69
|
// 届时高峰时段会低报;等该策略实际生效后再决定是否引入时段维度。
|
|
47
|
-
"deepseek-v4-pro": { input: 0.435, output: 0.87, cacheRead: 3625e-6 },
|
|
48
|
-
"deepseek-v4-flash": { input: 0.14, output: 0.28, cacheRead: 28e-4 },
|
|
49
70
|
// Legacy aliases:retires 2026-07-24 UTC 15:59,官方 route 到 V4 Flash。
|
|
50
71
|
// 这几条只服务历史 session 的成本回算,保留当时的费率口径,不随现价改动。
|
|
51
72
|
"deepseek-chat": { input: 0.14, output: 0.28, cacheRead: 0.028 },
|
|
@@ -89,11 +110,15 @@ var PRICING_TABLE = {
|
|
|
89
110
|
// Handled via provider check below (FREE_PROVIDERS → genuine $0.00, not "unknown").
|
|
90
111
|
};
|
|
91
112
|
var FREE_PROVIDERS = /* @__PURE__ */ new Set(["ollama"]);
|
|
92
|
-
function getPricing(provider, model) {
|
|
113
|
+
function getPricing(provider, model, at = /* @__PURE__ */ new Date()) {
|
|
93
114
|
if (FREE_PROVIDERS.has(provider.toLowerCase())) {
|
|
94
115
|
return { input: 0, output: 0 };
|
|
95
116
|
}
|
|
96
117
|
const key = model.toLowerCase();
|
|
118
|
+
if (provider.toLowerCase() === "deepseek") {
|
|
119
|
+
const dynamicPricing = getDeepSeekV4Pricing(key, at);
|
|
120
|
+
if (dynamicPricing) return dynamicPricing;
|
|
121
|
+
}
|
|
97
122
|
if (PRICING_TABLE[key]) return PRICING_TABLE[key];
|
|
98
123
|
const keys = Object.keys(PRICING_TABLE).sort((a, b) => b.length - a.length);
|
|
99
124
|
for (const k of keys) {
|
|
@@ -101,8 +126,8 @@ function getPricing(provider, model) {
|
|
|
101
126
|
}
|
|
102
127
|
return null;
|
|
103
128
|
}
|
|
104
|
-
function computeCost(provider, model, usage) {
|
|
105
|
-
const p = getPricing(provider, model);
|
|
129
|
+
function computeCost(provider, model, usage, at = /* @__PURE__ */ new Date()) {
|
|
130
|
+
const p = getPricing(provider, model, at);
|
|
106
131
|
if (!p) return null;
|
|
107
132
|
const input = usage.inputTokens * p.input;
|
|
108
133
|
const output = usage.outputTokens * p.output;
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
CI_COMMENT_MARKER,
|
|
4
4
|
countSeverity,
|
|
5
5
|
runCi
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-GMZTY7DA.js";
|
|
7
|
+
import "./chunk-MJICIIBW.js";
|
|
8
8
|
import "./chunk-HLWUDRBO.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-TL5MD5XU.js";
|
|
10
|
+
import "./chunk-WM4VTGAF.js";
|
|
11
|
+
import "./chunk-3OBY7WSS.js";
|
|
12
12
|
import "./chunk-TU3L3PW7.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-VKBGOFEO.js";
|
|
14
14
|
import "./chunk-IW3Q7AE5.js";
|
|
15
15
|
export {
|
|
16
16
|
CI_COMMENT_MARKER,
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import {
|
|
3
3
|
formatDoctorReport,
|
|
4
4
|
runDoctorCli
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-B27MLWFJ.js";
|
|
6
|
+
import "./chunk-TL5MD5XU.js";
|
|
7
|
+
import "./chunk-WM4VTGAF.js";
|
|
8
|
+
import "./chunk-QMB7QYZC.js";
|
|
9
|
+
import "./chunk-3OBY7WSS.js";
|
|
10
10
|
import "./chunk-TU3L3PW7.js";
|
|
11
11
|
import "./chunk-HOSJZMQS.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-VKBGOFEO.js";
|
|
13
13
|
import "./chunk-IW3Q7AE5.js";
|
|
14
14
|
export {
|
|
15
15
|
formatDoctorReport,
|
package/dist/electron-server.js
CHANGED
|
@@ -34,14 +34,14 @@ import {
|
|
|
34
34
|
touchMemoryReferences,
|
|
35
35
|
updateMemoryApproval,
|
|
36
36
|
updateMemoryEntry
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-5K2LFD7D.js";
|
|
38
38
|
import {
|
|
39
39
|
redactJson,
|
|
40
40
|
scanString
|
|
41
41
|
} from "./chunk-YVTASHS5.js";
|
|
42
42
|
import {
|
|
43
43
|
runTestsTool
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-7YCA2BD3.js";
|
|
45
45
|
import {
|
|
46
46
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
47
47
|
APP_NAME,
|
|
@@ -73,7 +73,7 @@ import {
|
|
|
73
73
|
SUBAGENT_MAX_ROUNDS_LIMIT,
|
|
74
74
|
VERSION,
|
|
75
75
|
buildUserIdentityPrompt
|
|
76
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-3RHY2HF7.js";
|
|
77
77
|
import {
|
|
78
78
|
hasSemanticIndex,
|
|
79
79
|
semanticSearch
|
|
@@ -128,6 +128,8 @@ var ModelParamsSchema = z.object({
|
|
|
128
128
|
timeout: z.number().int().positive().optional(),
|
|
129
129
|
/** 是否启用深度思考(thinking)模式,Claude Sonnet/Opus、GLM-5 等 */
|
|
130
130
|
thinking: z.boolean().optional(),
|
|
131
|
+
/** DeepSeek V4 reasoning effort. */
|
|
132
|
+
thinkingEffort: z.enum(["low", "high", "max"]).optional(),
|
|
131
133
|
/** thinking 模式的 token 预算(最小 1024,仅 Claude Extended Thinking 使用) */
|
|
132
134
|
thinkingBudget: z.number().int().min(1024).optional()
|
|
133
135
|
});
|
|
@@ -2784,6 +2786,7 @@ async function runLeanAgentLoop(opts) {
|
|
|
2784
2786
|
maxTokens: opts.chatParams?.maxTokens,
|
|
2785
2787
|
timeout: opts.chatParams?.timeout,
|
|
2786
2788
|
thinking: opts.chatParams?.thinking,
|
|
2789
|
+
thinkingEffort: opts.chatParams?.thinkingEffort,
|
|
2787
2790
|
...extraMessages.length > 0 ? { _extraMessages: extraMessages } : {}
|
|
2788
2791
|
},
|
|
2789
2792
|
opts.toolDefsForRound(round)
|
|
@@ -2954,6 +2957,14 @@ var OpenAICompatibleProvider = class extends BaseProvider {
|
|
|
2954
2957
|
}
|
|
2955
2958
|
return msgs;
|
|
2956
2959
|
}
|
|
2960
|
+
/** Provider-specific request fields shared by all four chat paths. */
|
|
2961
|
+
buildChatRequestParams(request) {
|
|
2962
|
+
return {
|
|
2963
|
+
temperature: request.temperature,
|
|
2964
|
+
max_tokens: request.maxTokens,
|
|
2965
|
+
...request.thinking ? { thinking: { type: "enabled" } } : {}
|
|
2966
|
+
};
|
|
2967
|
+
}
|
|
2957
2968
|
/**
|
|
2958
2969
|
* 非流式请求必须把 `request.signal` 交给 SDK —— 否则 Ctrl+C 完全无效。
|
|
2959
2970
|
*
|
|
@@ -2970,10 +2981,8 @@ var OpenAICompatibleProvider = class extends BaseProvider {
|
|
|
2970
2981
|
const response = await this.client.chat.completions.create({
|
|
2971
2982
|
model: request.model,
|
|
2972
2983
|
messages: this.buildMessages(request),
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
stream: false,
|
|
2976
|
-
...request.thinking ? { thinking: { type: "enabled" } } : {}
|
|
2984
|
+
...this.buildChatRequestParams(request),
|
|
2985
|
+
stream: false
|
|
2977
2986
|
}, {
|
|
2978
2987
|
timeout: request.timeout ?? this.defaultTimeout,
|
|
2979
2988
|
signal: request.signal
|
|
@@ -2996,12 +3005,10 @@ var OpenAICompatibleProvider = class extends BaseProvider {
|
|
|
2996
3005
|
const stream = await this.client.chat.completions.create({
|
|
2997
3006
|
model: request.model,
|
|
2998
3007
|
messages: this.buildMessages(request),
|
|
2999
|
-
|
|
3000
|
-
max_tokens: request.maxTokens,
|
|
3008
|
+
...this.buildChatRequestParams(request),
|
|
3001
3009
|
stream: true,
|
|
3002
3010
|
// 请求末尾 usage chunk,供 token 统计使用
|
|
3003
|
-
stream_options: { include_usage: true }
|
|
3004
|
-
...request.thinking ? { thinking: { type: "enabled" } } : {}
|
|
3011
|
+
stream_options: { include_usage: true }
|
|
3005
3012
|
}, {
|
|
3006
3013
|
timeout: request.timeout ?? this.defaultTimeout,
|
|
3007
3014
|
signal: request.signal
|
|
@@ -3077,10 +3084,8 @@ var OpenAICompatibleProvider = class extends BaseProvider {
|
|
|
3077
3084
|
messages: allMessages,
|
|
3078
3085
|
tools: openaiTools,
|
|
3079
3086
|
tool_choice: "auto",
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
stream: false,
|
|
3083
|
-
...request.thinking ? { thinking: { type: "enabled" } } : {}
|
|
3087
|
+
...this.buildChatRequestParams(request),
|
|
3088
|
+
stream: false
|
|
3084
3089
|
}, {
|
|
3085
3090
|
timeout: request.timeout ?? this.defaultTimeout,
|
|
3086
3091
|
// 非流式路径同样必须收 signal,否则 Ctrl+C 期间整个请求不可中断(见 chat() 上方注释)
|
|
@@ -3178,11 +3183,9 @@ var OpenAICompatibleProvider = class extends BaseProvider {
|
|
|
3178
3183
|
messages: allMessages,
|
|
3179
3184
|
tools: openaiTools,
|
|
3180
3185
|
tool_choice: "auto",
|
|
3181
|
-
|
|
3182
|
-
max_tokens: request.maxTokens,
|
|
3186
|
+
...this.buildChatRequestParams(request),
|
|
3183
3187
|
stream: true,
|
|
3184
|
-
stream_options: { include_usage: true }
|
|
3185
|
-
...request.thinking ? { thinking: { type: "enabled" } } : {}
|
|
3188
|
+
stream_options: { include_usage: true }
|
|
3186
3189
|
}, {
|
|
3187
3190
|
timeout: request.timeout ?? this.defaultTimeout,
|
|
3188
3191
|
signal: request.signal
|
|
@@ -3376,6 +3379,18 @@ Rules you MUST follow:
|
|
|
3376
3379
|
- The system will detect and reject phantom claims. Each failed detection wastes a round. Be honest.`;
|
|
3377
3380
|
var DeepSeekProvider = class extends OpenAICompatibleProvider {
|
|
3378
3381
|
defaultBaseUrl = "https://api.deepseek.com/v1";
|
|
3382
|
+
buildChatRequestParams(request) {
|
|
3383
|
+
const thinkingEnabled = request.thinking === true;
|
|
3384
|
+
return {
|
|
3385
|
+
// DeepSeek ignores sampling controls in thinking mode; omit them to keep the
|
|
3386
|
+
// wire request unambiguous. Explicitly disable thinking otherwise because
|
|
3387
|
+
// V4 defaults it to enabled server-side.
|
|
3388
|
+
temperature: thinkingEnabled ? void 0 : request.temperature,
|
|
3389
|
+
max_tokens: request.maxTokens,
|
|
3390
|
+
thinking: { type: thinkingEnabled ? "enabled" : "disabled" },
|
|
3391
|
+
...thinkingEnabled ? { reasoning_effort: request.thinkingEffort ?? "high" } : {}
|
|
3392
|
+
};
|
|
3393
|
+
}
|
|
3379
3394
|
/** 禁用流式工具调用,确保 chatWithTools 覆写(代码块检测)生效 */
|
|
3380
3395
|
enableStreamingToolCalls = false;
|
|
3381
3396
|
/**
|
|
@@ -3396,14 +3411,14 @@ var DeepSeekProvider = class extends OpenAICompatibleProvider {
|
|
|
3396
3411
|
// ── V4 family (2026-04-23+):1M context,支持 Thinking / Non-Thinking 双模式 ──
|
|
3397
3412
|
{
|
|
3398
3413
|
id: "deepseek-v4-pro",
|
|
3399
|
-
displayName: "DeepSeek V4 Pro (1.6T MoE, 49B active)",
|
|
3414
|
+
displayName: "DeepSeek V4 Pro (0813, 1.6T MoE, 49B active)",
|
|
3400
3415
|
contextWindow: 1048576,
|
|
3401
3416
|
supportsStreaming: true,
|
|
3402
3417
|
supportsThinking: true
|
|
3403
3418
|
},
|
|
3404
3419
|
{
|
|
3405
3420
|
id: "deepseek-v4-flash",
|
|
3406
|
-
displayName: "DeepSeek V4 Flash (284B MoE, 13B active)",
|
|
3421
|
+
displayName: "DeepSeek V4 Flash (0731, 284B MoE, 13B active)",
|
|
3407
3422
|
contextWindow: 1048576,
|
|
3408
3423
|
supportsStreaming: true,
|
|
3409
3424
|
supportsThinking: true
|
|
@@ -11077,7 +11092,8 @@ async function runSubAgent(task, maxRounds, agentIndex, ctx, agent) {
|
|
|
11077
11092
|
temperature: ctx.modelParams.temperature,
|
|
11078
11093
|
maxTokens: ctx.modelParams.maxTokens,
|
|
11079
11094
|
timeout: ctx.modelParams.timeout,
|
|
11080
|
-
thinking: ctx.modelParams.thinking
|
|
11095
|
+
thinking: ctx.modelParams.thinking,
|
|
11096
|
+
thinkingEffort: ctx.modelParams.thinkingEffort
|
|
11081
11097
|
},
|
|
11082
11098
|
executeTools: (calls) => subExecutor.executeAll(calls),
|
|
11083
11099
|
systemPromptForRound: () => subSystemPrompt,
|
|
@@ -13635,6 +13651,29 @@ function loadMemoryContent(configDir, maxChars) {
|
|
|
13635
13651
|
}
|
|
13636
13652
|
|
|
13637
13653
|
// src/core/pricing.ts
|
|
13654
|
+
var DEEPSEEK_CNY_PER_USD = 6.9;
|
|
13655
|
+
var DEEPSEEK_TIME_PRICING_EFFECTIVE_AT = /* @__PURE__ */ new Date("2026-08-16T16:00:00.000Z");
|
|
13656
|
+
function deepSeekCnyPricing(cacheRead, input, output) {
|
|
13657
|
+
return {
|
|
13658
|
+
cacheRead: cacheRead / DEEPSEEK_CNY_PER_USD,
|
|
13659
|
+
input: input / DEEPSEEK_CNY_PER_USD,
|
|
13660
|
+
output: output / DEEPSEEK_CNY_PER_USD
|
|
13661
|
+
};
|
|
13662
|
+
}
|
|
13663
|
+
function getDeepSeekV4Pricing(model, at) {
|
|
13664
|
+
const isPro = model.startsWith("deepseek-v4-pro");
|
|
13665
|
+
const isFlash = model.startsWith("deepseek-v4-flash");
|
|
13666
|
+
if (!isPro && !isFlash) return null;
|
|
13667
|
+
if (at < DEEPSEEK_TIME_PRICING_EFFECTIVE_AT) {
|
|
13668
|
+
return isPro ? deepSeekCnyPricing(0.025, 3, 6) : deepSeekCnyPricing(0.02, 1, 2);
|
|
13669
|
+
}
|
|
13670
|
+
const beijingHour = (at.getUTCHours() + 8) % 24;
|
|
13671
|
+
const isPeak = beijingHour >= 9 && beijingHour < 12 || beijingHour >= 14 && beijingHour < 18;
|
|
13672
|
+
if (isPro) {
|
|
13673
|
+
return isPeak ? deepSeekCnyPricing(0.3, 9, 27) : deepSeekCnyPricing(0.15, 4.5, 13.5);
|
|
13674
|
+
}
|
|
13675
|
+
return isPeak ? deepSeekCnyPricing(0.1, 3, 9) : deepSeekCnyPricing(0.05, 1.5, 4.5);
|
|
13676
|
+
}
|
|
13638
13677
|
var PRICING_TABLE = {
|
|
13639
13678
|
// ── Anthropic Claude ──────────────────────────────────────────
|
|
13640
13679
|
"claude-opus-4-8": { input: 15, output: 75, cacheWrite: 18.75, cacheRead: 1.5 },
|
|
@@ -13678,8 +13717,6 @@ var PRICING_TABLE = {
|
|
|
13678
13717
|
// 20% 拍脑袋而非抄文档)——`aicli usage` 因此系统性高报 DeepSeek 成本。
|
|
13679
13718
|
// 待办:官方已公告峰谷定价(北京时间 9-12 点、14-18 点为平时 2 倍),本表仍是单一费率,
|
|
13680
13719
|
// 届时高峰时段会低报;等该策略实际生效后再决定是否引入时段维度。
|
|
13681
|
-
"deepseek-v4-pro": { input: 0.435, output: 0.87, cacheRead: 3625e-6 },
|
|
13682
|
-
"deepseek-v4-flash": { input: 0.14, output: 0.28, cacheRead: 28e-4 },
|
|
13683
13720
|
// Legacy aliases:retires 2026-07-24 UTC 15:59,官方 route 到 V4 Flash。
|
|
13684
13721
|
// 这几条只服务历史 session 的成本回算,保留当时的费率口径,不随现价改动。
|
|
13685
13722
|
"deepseek-chat": { input: 0.14, output: 0.28, cacheRead: 0.028 },
|
|
@@ -13723,11 +13760,15 @@ var PRICING_TABLE = {
|
|
|
13723
13760
|
// Handled via provider check below (FREE_PROVIDERS → genuine $0.00, not "unknown").
|
|
13724
13761
|
};
|
|
13725
13762
|
var FREE_PROVIDERS = /* @__PURE__ */ new Set(["ollama"]);
|
|
13726
|
-
function getPricing(provider, model) {
|
|
13763
|
+
function getPricing(provider, model, at = /* @__PURE__ */ new Date()) {
|
|
13727
13764
|
if (FREE_PROVIDERS.has(provider.toLowerCase())) {
|
|
13728
13765
|
return { input: 0, output: 0 };
|
|
13729
13766
|
}
|
|
13730
13767
|
const key = model.toLowerCase();
|
|
13768
|
+
if (provider.toLowerCase() === "deepseek") {
|
|
13769
|
+
const dynamicPricing = getDeepSeekV4Pricing(key, at);
|
|
13770
|
+
if (dynamicPricing) return dynamicPricing;
|
|
13771
|
+
}
|
|
13731
13772
|
if (PRICING_TABLE[key]) return PRICING_TABLE[key];
|
|
13732
13773
|
const keys = Object.keys(PRICING_TABLE).sort((a, b) => b.length - a.length);
|
|
13733
13774
|
for (const k of keys) {
|
|
@@ -13735,8 +13776,8 @@ function getPricing(provider, model) {
|
|
|
13735
13776
|
}
|
|
13736
13777
|
return null;
|
|
13737
13778
|
}
|
|
13738
|
-
function computeCost(provider, model, usage) {
|
|
13739
|
-
const p = getPricing(provider, model);
|
|
13779
|
+
function computeCost(provider, model, usage, at = /* @__PURE__ */ new Date()) {
|
|
13780
|
+
const p = getPricing(provider, model, at);
|
|
13740
13781
|
if (!p) return null;
|
|
13741
13782
|
const input = usage.inputTokens * p.input;
|
|
13742
13783
|
const output = usage.outputTokens * p.output;
|
|
@@ -14863,11 +14904,24 @@ async function handleModel(args, ctx) {
|
|
|
14863
14904
|
ctx.sendStatus();
|
|
14864
14905
|
}
|
|
14865
14906
|
async function handleThink(args, ctx) {
|
|
14866
|
-
const sub = args[0];
|
|
14907
|
+
const sub = args[0]?.toLowerCase() ?? "toggle";
|
|
14908
|
+
if (sub === "status") {
|
|
14909
|
+
ctx.send({
|
|
14910
|
+
type: "info",
|
|
14911
|
+
message: `Thinking mode: ${ctx.runtimeThinking === null ? "CONFIG" : ctx.runtimeThinking ? "ON" : "OFF"}; effort: ${ctx.runtimeThinkingEffort ?? "config/default (high for DeepSeek V4)"}`
|
|
14912
|
+
});
|
|
14913
|
+
return;
|
|
14914
|
+
}
|
|
14867
14915
|
if (sub === "on") ctx.runtimeThinking = true;
|
|
14868
14916
|
else if (sub === "off") ctx.runtimeThinking = false;
|
|
14869
|
-
else
|
|
14870
|
-
|
|
14917
|
+
else if (sub === "low" || sub === "high" || sub === "max") {
|
|
14918
|
+
ctx.runtimeThinking = true;
|
|
14919
|
+
ctx.runtimeThinkingEffort = sub;
|
|
14920
|
+
} else ctx.runtimeThinking = ctx.runtimeThinking !== true;
|
|
14921
|
+
ctx.send({
|
|
14922
|
+
type: "info",
|
|
14923
|
+
message: `Thinking mode: ${ctx.runtimeThinking ? "ON" : "OFF"}${ctx.runtimeThinking ? ` (${ctx.runtimeThinkingEffort ?? "high"})` : ""}`
|
|
14924
|
+
});
|
|
14871
14925
|
ctx.sendStatus();
|
|
14872
14926
|
}
|
|
14873
14927
|
async function handlePlan(args, ctx) {
|
|
@@ -15380,7 +15434,7 @@ Cache: write=${cacheCreate} read=${cacheRead}` : "";
|
|
|
15380
15434
|
Cost: ${formatCost(cost)}` : "";
|
|
15381
15435
|
let memoryLine = "";
|
|
15382
15436
|
try {
|
|
15383
|
-
const { countPendingMemories } = await import("./persistent-memory-
|
|
15437
|
+
const { countPendingMemories } = await import("./persistent-memory-ANIMO5CF.js");
|
|
15384
15438
|
const pending = countPendingMemories(ctx.config.getConfigDir());
|
|
15385
15439
|
if (pending > 0) memoryLine = `
|
|
15386
15440
|
Memory: \u26A0 ${pending} pending approval \u2014 see the Memory panel or /memory`;
|
|
@@ -16195,7 +16249,7 @@ async function handleTest(args, ctx) {
|
|
|
16195
16249
|
const isCommand = argStr.includes(" ") || /^(mvn|gradle|npm|pytest|cargo|go)\b/.test(argStr);
|
|
16196
16250
|
testArgs = isCommand ? { command: argStr } : { filter: argStr };
|
|
16197
16251
|
}
|
|
16198
|
-
const runTests = ctx.runTests ?? (await import("./run-tests-
|
|
16252
|
+
const runTests = ctx.runTests ?? (await import("./run-tests-TF7UPUWW.js")).executeTests;
|
|
16199
16253
|
const report = await runTests(testArgs);
|
|
16200
16254
|
ctx.send({ type: "info", message: report });
|
|
16201
16255
|
} catch (err) {
|
|
@@ -16453,7 +16507,7 @@ async function handleMemory(args, ctx) {
|
|
|
16453
16507
|
ctx.handleMemoryManage(sub, args[1], sub === "expire" ? args[2] : void 0);
|
|
16454
16508
|
} else if (sub === "export") {
|
|
16455
16509
|
if (args[1] === "md") {
|
|
16456
|
-
const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-
|
|
16510
|
+
const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-ANIMO5CF.js");
|
|
16457
16511
|
ctx.send({
|
|
16458
16512
|
type: "export_data",
|
|
16459
16513
|
format: "md",
|
|
@@ -16884,6 +16938,7 @@ var SessionHandler = class {
|
|
|
16884
16938
|
currentModel;
|
|
16885
16939
|
planMode = false;
|
|
16886
16940
|
runtimeThinking = null;
|
|
16941
|
+
runtimeThinkingEffort = null;
|
|
16887
16942
|
sessionTokenUsage = { inputTokens: 0, outputTokens: 0, cacheCreationTokens: 0, cacheReadTokens: 0 };
|
|
16888
16943
|
unknownPricingWarnings = /* @__PURE__ */ new Set();
|
|
16889
16944
|
/** Accumulate a TokenUsage (with optional cache fields) into sessionTokenUsage. */
|
|
@@ -17022,7 +17077,8 @@ var SessionHandler = class {
|
|
|
17022
17077
|
cwd: process.cwd(),
|
|
17023
17078
|
messageCount: this.sessions.current?.messages.length ?? 0,
|
|
17024
17079
|
planMode: this.planMode,
|
|
17025
|
-
thinkingMode: this.
|
|
17080
|
+
thinkingMode: this.getModelParams().thinking ?? false,
|
|
17081
|
+
thinkingEffort: this.runtimeThinkingEffort ?? this.getModelParams().thinkingEffort,
|
|
17026
17082
|
permissionProfile: this.config.get("defaultPermissionProfile") ?? "legacy",
|
|
17027
17083
|
tokenUsage: { ...this.sessionTokenUsage },
|
|
17028
17084
|
costUsd,
|
|
@@ -17387,6 +17443,7 @@ var SessionHandler = class {
|
|
|
17387
17443
|
maxTokens: modelParams.maxTokens,
|
|
17388
17444
|
timeout: modelParams.timeout,
|
|
17389
17445
|
thinking: modelParams.thinking,
|
|
17446
|
+
thinkingEffort: modelParams.thinkingEffort,
|
|
17390
17447
|
thinkingBudget: modelParams.thinkingBudget,
|
|
17391
17448
|
signal: ac.signal
|
|
17392
17449
|
});
|
|
@@ -17461,6 +17518,7 @@ ${mcpBudgetNote}` : "");
|
|
|
17461
17518
|
maxTokens: modelParams.maxTokens,
|
|
17462
17519
|
timeout: modelParams.timeout,
|
|
17463
17520
|
thinking: modelParams.thinking,
|
|
17521
|
+
thinkingEffort: modelParams.thinkingEffort,
|
|
17464
17522
|
thinkingBudget: modelParams.thinkingBudget,
|
|
17465
17523
|
signal: ac.signal,
|
|
17466
17524
|
...extraMessages.length > 0 ? { _extraMessages: extraMessages } : {}
|
|
@@ -17777,6 +17835,7 @@ ${summaryContent}`,
|
|
|
17777
17835
|
maxTokens: modelParams.maxTokens,
|
|
17778
17836
|
timeout: modelParams.timeout,
|
|
17779
17837
|
thinking: modelParams.thinking,
|
|
17838
|
+
thinkingEffort: modelParams.thinkingEffort,
|
|
17780
17839
|
thinkingBudget: modelParams.thinkingBudget,
|
|
17781
17840
|
signal: ac.signal,
|
|
17782
17841
|
_extraMessages: teeExtraMessages
|
|
@@ -18311,6 +18370,7 @@ Backup saved: ${result.backupPath}` : "";
|
|
|
18311
18370
|
...params,
|
|
18312
18371
|
maxTokens: params.maxTokens ?? DEFAULT_MAX_TOKENS,
|
|
18313
18372
|
thinking: this.runtimeThinking ?? params.thinking,
|
|
18373
|
+
thinkingEffort: this.runtimeThinkingEffort ?? params.thinkingEffort,
|
|
18314
18374
|
thinkingBudget: params.thinkingBudget
|
|
18315
18375
|
};
|
|
18316
18376
|
}
|
|
@@ -154,7 +154,7 @@ ${content}`);
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
async function runTaskMode(config, providers, configManager, topic) {
|
|
157
|
-
const { TaskOrchestrator } = await import("./task-orchestrator-
|
|
157
|
+
const { TaskOrchestrator } = await import("./task-orchestrator-2RAKLFWN.js");
|
|
158
158
|
const orchestrator = new TaskOrchestrator(config, providers, configManager);
|
|
159
159
|
let interrupted = false;
|
|
160
160
|
const onSigint = () => {
|