jinzd-ai-cli 0.4.265 → 0.4.267
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{batch-C7SHXRQ2.js → batch-GY5MAN5F.js} +2 -2
- package/dist/{chunk-TJBG4F2R.js → chunk-5AEOIETL.js} +4 -4
- package/dist/{chunk-NOS3QV7G.js → chunk-5CU72V6P.js} +3 -3
- package/dist/{chunk-IFTUBTDA.js → chunk-6C6FLDGH.js} +1 -1
- package/dist/{chunk-M2RKBTVZ.js → chunk-7HECI3U5.js} +1 -1
- package/dist/{chunk-NJLPA6S4.js → chunk-ARYCWJN6.js} +1 -1
- package/dist/{chunk-X6NWK2YK.js → chunk-EWRZMIQE.js} +1 -1
- package/dist/{chunk-YXYOLPDB.js → chunk-FI6IWUXW.js} +1 -1
- package/dist/{chunk-CVI3LSGR.js → chunk-JH343BDI.js} +105 -2
- package/dist/{chunk-E3JRGJCJ.js → chunk-QN7WD2SM.js} +3 -3
- package/dist/{chunk-V4D7YD24.js → chunk-R7GERZDA.js} +145 -4
- package/dist/{chunk-LZBD2VGJ.js → chunk-RVNL7MQG.js} +1 -1
- package/dist/{chunk-Y7KJPNQI.js → chunk-THHPKZJ3.js} +1 -1
- package/dist/{chunk-2MR7EP24.js → chunk-WPN7LDLM.js} +1 -1
- package/dist/{chunk-YDTYBUAB.js → chunk-XLLUQEGO.js} +1 -1
- package/dist/{ci-TDXLI3OM.js → ci-MUEQSNKU.js} +4 -4
- package/dist/{ci-format-AFX2LP4Y.js → ci-format-2ZGGSOFK.js} +2 -2
- package/dist/{constants-66TQEDGO.js → constants-SZTJESDF.js} +1 -1
- package/dist/{doctor-cli-GMCOGCDR.js → doctor-cli-Z272364P.js} +4 -4
- package/dist/electron-server.js +781 -420
- package/dist/{hub-2YXETHPY.js → hub-MRLGKMRI.js} +1 -1
- package/dist/index.js +51 -93
- package/dist/{persistent-memory-WTZO5CQ7.js → persistent-memory-3FTOC7QT.js} +2 -2
- package/dist/{persistent-memory-2DKCETB7.js → persistent-memory-HZASMDJQ.js} +2 -2
- package/dist/{pr-Y2LDG3R7.js → pr-VLLIALRK.js} +4 -4
- package/dist/{run-tests-FIUGDIDL.js → run-tests-6MWE6D5S.js} +2 -2
- package/dist/{run-tests-PWTNSUVP.js → run-tests-NTDZ6DDU.js} +2 -2
- package/dist/{server-OZ4RFDFH.js → server-IALCWKSU.js} +61 -48
- package/dist/{server-ZCG5QD6P.js → server-SP3AEHRQ.js} +5 -5
- package/dist/{task-orchestrator-Q2L6JEUX.js → task-orchestrator-Q6WFFI4J.js} +5 -5
- package/dist/{usage-SDL5Z4CS.js → usage-DJDLHICZ.js} +4 -6
- package/package.json +1 -1
- package/dist/chunk-YRD6M5XI.js +0 -149
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ConfigManager
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-EWRZMIQE.js";
|
|
5
5
|
import "./chunk-TU3L3PW7.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-THHPKZJ3.js";
|
|
7
7
|
import {
|
|
8
8
|
atomicWriteFileSync
|
|
9
9
|
} from "./chunk-IW3Q7AE5.js";
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
searchPersistentMemories,
|
|
8
8
|
touchMemoryReferences,
|
|
9
9
|
updateMemoryEntry
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-RVNL7MQG.js";
|
|
11
11
|
import {
|
|
12
12
|
indexProject
|
|
13
13
|
} from "./chunk-GLSR2NR3.js";
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
runHook,
|
|
27
27
|
runLifecycleHooks,
|
|
28
28
|
runTool
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-WPN7LDLM.js";
|
|
30
30
|
import {
|
|
31
31
|
buildTruncatedArgumentsError,
|
|
32
32
|
getDangerLevel,
|
|
@@ -43,14 +43,14 @@ import {
|
|
|
43
43
|
} from "./chunk-4BKXL7SM.js";
|
|
44
44
|
import {
|
|
45
45
|
runTestsTool
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-XLLUQEGO.js";
|
|
47
47
|
import {
|
|
48
48
|
CONFIG_DIR_NAME,
|
|
49
49
|
DEFAULT_MAX_TOOL_OUTPUT_CHARS_CAP,
|
|
50
50
|
SUBAGENT_ALLOWED_TOOLS,
|
|
51
51
|
SUBAGENT_DEFAULT_MAX_ROUNDS,
|
|
52
52
|
SUBAGENT_MAX_ROUNDS_LIMIT
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-THHPKZJ3.js";
|
|
54
54
|
import {
|
|
55
55
|
loadChatIndex,
|
|
56
56
|
searchChatMemory
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
evaluateCiGate,
|
|
4
4
|
normalizeCiThresholds
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-6C6FLDGH.js";
|
|
6
6
|
import {
|
|
7
7
|
buildReviewPrompt,
|
|
8
8
|
buildSecurityReviewPrompt,
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
} from "./chunk-AUEX6RNY.js";
|
|
17
17
|
import {
|
|
18
18
|
ConfigManager
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-EWRZMIQE.js";
|
|
20
20
|
import {
|
|
21
21
|
VERSION
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-THHPKZJ3.js";
|
|
23
23
|
|
|
24
24
|
// src/cli/ci.ts
|
|
25
25
|
import { execFileSync } from "child_process";
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
computeCost
|
|
4
|
+
} from "./chunk-R7GERZDA.js";
|
|
2
5
|
import {
|
|
3
6
|
truncateForPersist
|
|
4
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-5AEOIETL.js";
|
|
5
8
|
import {
|
|
6
9
|
APP_NAME,
|
|
7
10
|
CONFIG_DIR_NAME,
|
|
@@ -11,7 +14,7 @@ import {
|
|
|
11
14
|
MCP_PROTOCOL_VERSION,
|
|
12
15
|
MCP_TOOL_PREFIX,
|
|
13
16
|
VERSION
|
|
14
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-THHPKZJ3.js";
|
|
15
18
|
import {
|
|
16
19
|
atomicWriteFileSync
|
|
17
20
|
} from "./chunk-IW3Q7AE5.js";
|
|
@@ -1065,6 +1068,68 @@ function clearDevState() {
|
|
|
1065
1068
|
}
|
|
1066
1069
|
}
|
|
1067
1070
|
|
|
1071
|
+
// src/core/think-command.ts
|
|
1072
|
+
var EFFORTS = /* @__PURE__ */ new Set(["low", "high", "max"]);
|
|
1073
|
+
function resolveEffective(state) {
|
|
1074
|
+
if (state.runtimeThinking !== null) return { effective: state.runtimeThinking, origin: "runtime override" };
|
|
1075
|
+
if (state.configuredThinking !== void 0) return { effective: state.configuredThinking, origin: "config" };
|
|
1076
|
+
return { effective: false, origin: "default" };
|
|
1077
|
+
}
|
|
1078
|
+
function effortLine(state, effort) {
|
|
1079
|
+
if (!state.supportsEffort) return `Reasoning effort: n/a for ${state.provider}`;
|
|
1080
|
+
const resolved = effort ?? state.runtimeEffort ?? state.configuredEffort;
|
|
1081
|
+
return `Reasoning effort: ${resolved ?? "high (provider default)"}`;
|
|
1082
|
+
}
|
|
1083
|
+
function applyThinkCommand(sub, state) {
|
|
1084
|
+
const key = (sub ?? "toggle").toLowerCase();
|
|
1085
|
+
const current = resolveEffective(state);
|
|
1086
|
+
const stay = (summary, details = []) => ({
|
|
1087
|
+
runtimeThinking: state.runtimeThinking,
|
|
1088
|
+
runtimeEffort: state.runtimeEffort,
|
|
1089
|
+
effective: current.effective,
|
|
1090
|
+
origin: current.origin,
|
|
1091
|
+
summary,
|
|
1092
|
+
details,
|
|
1093
|
+
changed: false
|
|
1094
|
+
});
|
|
1095
|
+
const enable = (effort) => ({
|
|
1096
|
+
runtimeThinking: true,
|
|
1097
|
+
runtimeEffort: effort ?? state.runtimeEffort,
|
|
1098
|
+
effective: true,
|
|
1099
|
+
origin: "runtime override",
|
|
1100
|
+
summary: effort && state.supportsEffort ? `Extended Thinking: ON (effort: ${effort})` : "Extended Thinking: ON",
|
|
1101
|
+
details: effort && !state.supportsEffort ? [`Note: ${state.provider} has no reasoning-effort levels \u2014 the level is ignored.`] : [],
|
|
1102
|
+
changed: true
|
|
1103
|
+
});
|
|
1104
|
+
const disable = () => ({
|
|
1105
|
+
runtimeThinking: false,
|
|
1106
|
+
// 刻意保留档位:重新开启时不该丢掉用户选过的档
|
|
1107
|
+
runtimeEffort: state.runtimeEffort,
|
|
1108
|
+
effective: false,
|
|
1109
|
+
origin: "runtime override",
|
|
1110
|
+
summary: "Extended Thinking: OFF",
|
|
1111
|
+
details: [],
|
|
1112
|
+
changed: true
|
|
1113
|
+
});
|
|
1114
|
+
if (key === "status") {
|
|
1115
|
+
const details = current.effective ? [effortLine(state, null)] : [
|
|
1116
|
+
"Enable with /think on | low | high | max, or set",
|
|
1117
|
+
"modelParams.<model>.thinking in ~/.aicli/config.json"
|
|
1118
|
+
];
|
|
1119
|
+
return stay(
|
|
1120
|
+
`Extended Thinking: ${current.effective ? "ON" : "OFF"} (${current.origin})`,
|
|
1121
|
+
details
|
|
1122
|
+
);
|
|
1123
|
+
}
|
|
1124
|
+
if (key === "on") return enable(null);
|
|
1125
|
+
if (key === "off") return disable();
|
|
1126
|
+
if (EFFORTS.has(key)) return enable(key);
|
|
1127
|
+
if (key === "toggle") {
|
|
1128
|
+
return current.effective ? disable() : enable(null);
|
|
1129
|
+
}
|
|
1130
|
+
return stay(`Unknown /think option "${sub}" \u2014 expected on | off | low | high | max | status`);
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1068
1133
|
// src/core/git-diff.ts
|
|
1069
1134
|
import { execFileSync } from "child_process";
|
|
1070
1135
|
function readGitDiff(options = {}) {
|
|
@@ -1076,11 +1141,49 @@ function readGitDiff(options = {}) {
|
|
|
1076
1141
|
}).trim();
|
|
1077
1142
|
}
|
|
1078
1143
|
|
|
1144
|
+
// src/core/session-cost.ts
|
|
1145
|
+
function buildSessionCostReport(input) {
|
|
1146
|
+
const { usage } = input;
|
|
1147
|
+
const totalTokens = usage.inputTokens + usage.outputTokens + usage.cacheCreationTokens + usage.cacheReadTokens;
|
|
1148
|
+
if (totalTokens === 0) {
|
|
1149
|
+
return { hasUsage: false, totalTokens: 0, cacheHitPct: null, cost: null, costSource: "unknown", savings: null };
|
|
1150
|
+
}
|
|
1151
|
+
const liveCost = computeCost(input.provider, input.model, usage);
|
|
1152
|
+
const useAccrual = input.accruedUsd > 0;
|
|
1153
|
+
const cost = useAccrual ? input.accruedUsd : liveCost;
|
|
1154
|
+
const costSource = useAccrual ? input.accrualIncomplete ? "accrued-partial" : "accrued" : liveCost != null ? "estimated" : "unknown";
|
|
1155
|
+
let savings = null;
|
|
1156
|
+
if (liveCost != null && usage.cacheReadTokens > 0) {
|
|
1157
|
+
const withoutCache = computeCost(input.provider, input.model, {
|
|
1158
|
+
inputTokens: usage.inputTokens + usage.cacheReadTokens,
|
|
1159
|
+
outputTokens: usage.outputTokens,
|
|
1160
|
+
cacheCreationTokens: usage.cacheCreationTokens,
|
|
1161
|
+
cacheReadTokens: 0
|
|
1162
|
+
});
|
|
1163
|
+
if (withoutCache != null) savings = withoutCache - liveCost;
|
|
1164
|
+
}
|
|
1165
|
+
const cacheHitPct = usage.cacheReadTokens > 0 ? Math.round(usage.cacheReadTokens / (usage.cacheReadTokens + usage.inputTokens) * 100) : null;
|
|
1166
|
+
return { hasUsage: true, totalTokens, cacheHitPct, cost, costSource, savings };
|
|
1167
|
+
}
|
|
1168
|
+
function costSourceNote(source) {
|
|
1169
|
+
switch (source) {
|
|
1170
|
+
case "accrued-partial":
|
|
1171
|
+
return "(partial \u2014 some turns had unknown pricing)";
|
|
1172
|
+
case "estimated":
|
|
1173
|
+
return "(estimated at current rates)";
|
|
1174
|
+
default:
|
|
1175
|
+
return null;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1079
1179
|
export {
|
|
1180
|
+
applyThinkCommand,
|
|
1080
1181
|
readGitDiff,
|
|
1081
1182
|
scanDirTree,
|
|
1082
1183
|
scanProject,
|
|
1083
1184
|
buildInitPrompt,
|
|
1185
|
+
buildSessionCostReport,
|
|
1186
|
+
costSourceNote,
|
|
1084
1187
|
parseSimpleYaml,
|
|
1085
1188
|
persistToolRound,
|
|
1086
1189
|
autoTrimSessionIfNeeded,
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-AUEX6RNY.js";
|
|
5
5
|
import {
|
|
6
6
|
ConfigManager
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-EWRZMIQE.js";
|
|
8
8
|
import {
|
|
9
9
|
getActivePluginAssets,
|
|
10
10
|
getPendingHookTrust,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
listHooks,
|
|
15
15
|
listInstalledPlugins,
|
|
16
16
|
resetStats
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-WPN7LDLM.js";
|
|
18
18
|
import {
|
|
19
19
|
getGitRoot
|
|
20
20
|
} from "./chunk-HOSJZMQS.js";
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
MCP_PROJECT_CONFIG_NAME,
|
|
27
27
|
MEMORY_FILE_NAME,
|
|
28
28
|
VERSION
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-THHPKZJ3.js";
|
|
30
30
|
|
|
31
31
|
// src/diagnostics/doctor-report.ts
|
|
32
32
|
import { existsSync as existsSync3, statSync as statSync2 } from "fs";
|
|
@@ -1,12 +1,150 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
computeCost,
|
|
4
|
-
formatCost
|
|
5
|
-
} from "./chunk-YRD6M5XI.js";
|
|
6
2
|
import {
|
|
7
3
|
atomicWriteFileSync
|
|
8
4
|
} from "./chunk-IW3Q7AE5.js";
|
|
9
5
|
|
|
6
|
+
// src/core/pricing.ts
|
|
7
|
+
var DEEPSEEK_CNY_PER_USD = 6.9;
|
|
8
|
+
var DEEPSEEK_TIME_PRICING_EFFECTIVE_AT = /* @__PURE__ */ new Date("2026-08-16T16:00:00.000Z");
|
|
9
|
+
function deepSeekCnyPricing(cacheRead, input, output) {
|
|
10
|
+
return {
|
|
11
|
+
cacheRead: cacheRead / DEEPSEEK_CNY_PER_USD,
|
|
12
|
+
input: input / DEEPSEEK_CNY_PER_USD,
|
|
13
|
+
output: output / DEEPSEEK_CNY_PER_USD
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function getDeepSeekV4Pricing(model, at) {
|
|
17
|
+
const isPro = model.startsWith("deepseek-v4-pro");
|
|
18
|
+
const isFlash = model.startsWith("deepseek-v4-flash");
|
|
19
|
+
if (!isPro && !isFlash) return null;
|
|
20
|
+
if (at < DEEPSEEK_TIME_PRICING_EFFECTIVE_AT) {
|
|
21
|
+
return isPro ? deepSeekCnyPricing(0.025, 3, 6) : deepSeekCnyPricing(0.02, 1, 2);
|
|
22
|
+
}
|
|
23
|
+
const beijingHour = (at.getUTCHours() + 8) % 24;
|
|
24
|
+
const isPeak = beijingHour >= 9 && beijingHour < 12 || beijingHour >= 14 && beijingHour < 18;
|
|
25
|
+
if (isPro) {
|
|
26
|
+
return isPeak ? deepSeekCnyPricing(0.3, 9, 27) : deepSeekCnyPricing(0.15, 4.5, 13.5);
|
|
27
|
+
}
|
|
28
|
+
return isPeak ? deepSeekCnyPricing(0.1, 3, 9) : deepSeekCnyPricing(0.05, 1.5, 4.5);
|
|
29
|
+
}
|
|
30
|
+
var PRICING_TABLE = {
|
|
31
|
+
// ── Anthropic Claude ──────────────────────────────────────────
|
|
32
|
+
"claude-opus-4-8": { input: 15, output: 75, cacheWrite: 18.75, cacheRead: 1.5 },
|
|
33
|
+
"claude-opus-4-7": { input: 15, output: 75, cacheWrite: 18.75, cacheRead: 1.5 },
|
|
34
|
+
"claude-opus-4-6": { input: 15, output: 75, cacheWrite: 18.75, cacheRead: 1.5 },
|
|
35
|
+
"claude-opus-4-5": { input: 15, output: 75, cacheWrite: 18.75, cacheRead: 1.5 },
|
|
36
|
+
"claude-sonnet-4-6": { input: 3, output: 15, cacheWrite: 3.75, cacheRead: 0.3 },
|
|
37
|
+
"claude-sonnet-4-5-20250929": { input: 3, output: 15, cacheWrite: 3.75, cacheRead: 0.3 },
|
|
38
|
+
"claude-haiku-4-5-20251001": { input: 1, output: 5, cacheWrite: 1.25, cacheRead: 0.1 },
|
|
39
|
+
"claude-haiku-4-5": { input: 1, output: 5, cacheWrite: 1.25, cacheRead: 0.1 },
|
|
40
|
+
// Legacy Claude 3.x families (prefix fallback handles minor date suffixes)
|
|
41
|
+
"claude-3-5-sonnet": { input: 3, output: 15, cacheWrite: 3.75, cacheRead: 0.3 },
|
|
42
|
+
"claude-3-5-haiku": { input: 0.8, output: 4, cacheWrite: 1, cacheRead: 0.08 },
|
|
43
|
+
"claude-3-opus": { input: 15, output: 75, cacheWrite: 18.75, cacheRead: 1.5 },
|
|
44
|
+
// ── OpenAI ────────────────────────────────────────────────────
|
|
45
|
+
// GAP (v0.4.184): the GPT-5 family (gpt-5, gpt-5-mini/nano, gpt-5.4, gpt-5.4-pro)
|
|
46
|
+
// and o4-mini are in the provider's model list but have NO verified pricing yet —
|
|
47
|
+
// left unpriced on purpose so `aicli usage` shows "—" (unknown) rather than a
|
|
48
|
+
// deceptive $0.00. Add real rates when confirmed from the official pricing page.
|
|
49
|
+
"gpt-4o": { input: 2.5, output: 10, cacheRead: 1.25 },
|
|
50
|
+
"gpt-4o-mini": { input: 0.15, output: 0.6, cacheRead: 0.075 },
|
|
51
|
+
"gpt-4-turbo": { input: 10, output: 30 },
|
|
52
|
+
"gpt-4": { input: 30, output: 60 },
|
|
53
|
+
"gpt-4.1": { input: 2, output: 8, cacheRead: 0.5 },
|
|
54
|
+
"gpt-4.1-mini": { input: 0.4, output: 1.6, cacheRead: 0.1 },
|
|
55
|
+
"gpt-4.1-nano": { input: 0.1, output: 0.4, cacheRead: 0.025 },
|
|
56
|
+
"o1": { input: 15, output: 60, cacheRead: 7.5 },
|
|
57
|
+
"o1-mini": { input: 3, output: 12, cacheRead: 1.5 },
|
|
58
|
+
"o3": { input: 10, output: 40, cacheRead: 2.5 },
|
|
59
|
+
"o3-mini": { input: 1.1, output: 4.4, cacheRead: 0.55 },
|
|
60
|
+
// ── Google Gemini ─────────────────────────────────────────────
|
|
61
|
+
"gemini-2.5-pro": { input: 1.25, output: 10 },
|
|
62
|
+
"gemini-2.5-flash": { input: 0.3, output: 2.5 },
|
|
63
|
+
"gemini-2.0-flash": { input: 0.1, output: 0.4 },
|
|
64
|
+
"gemini-1.5-pro": { input: 1.25, output: 5 },
|
|
65
|
+
"gemini-1.5-flash": { input: 0.075, output: 0.3 },
|
|
66
|
+
// ── DeepSeek ──────────────────────────────────────────────────
|
|
67
|
+
// V4 family (2026-04-23+):1M context, Thinking / Non-Thinking dual-mode, 384K max output
|
|
68
|
+
// 费率 2026-08-01 对 api-docs.deepseek.com/quick_start/pricing 官方 USD 表逐项核对。
|
|
69
|
+
// 修正前 pro 三项整齐高 4×(官方降过价未跟)、flash cacheRead 高 10×(像是按 input 的
|
|
70
|
+
// 20% 拍脑袋而非抄文档)——`aicli usage` 因此系统性高报 DeepSeek 成本。
|
|
71
|
+
// 待办:官方已公告峰谷定价(北京时间 9-12 点、14-18 点为平时 2 倍),本表仍是单一费率,
|
|
72
|
+
// 届时高峰时段会低报;等该策略实际生效后再决定是否引入时段维度。
|
|
73
|
+
// Legacy aliases:retires 2026-07-24 UTC 15:59,官方 route 到 V4 Flash。
|
|
74
|
+
// 这几条只服务历史 session 的成本回算,保留当时的费率口径,不随现价改动。
|
|
75
|
+
"deepseek-chat": { input: 0.14, output: 0.28, cacheRead: 0.028 },
|
|
76
|
+
"deepseek-reasoner": { input: 0.14, output: 0.28, cacheRead: 0.028 },
|
|
77
|
+
"deepseek-v3": { input: 0.27, output: 1.1, cacheRead: 0.07 },
|
|
78
|
+
// ── Moonshot Kimi ─────────────────────────────────────────────
|
|
79
|
+
"moonshot-v1-8k": { input: 0.17, output: 0.17 },
|
|
80
|
+
"moonshot-v1-32k": { input: 0.33, output: 0.33 },
|
|
81
|
+
"moonshot-v1-128k": { input: 0.83, output: 0.83 },
|
|
82
|
+
"kimi-k2": { input: 0.6, output: 2.5 },
|
|
83
|
+
"kimi-latest": { input: 0.6, output: 2.5 },
|
|
84
|
+
// Kimi K3(2026-07 旗舰,1M 上下文)官方定价 platform.kimi.ai/pricing/chat-k3:
|
|
85
|
+
// 输入 cache-miss $3.00 / cache-hit $0.30,输出 $15.00(/MTok)。
|
|
86
|
+
"kimi-k3": { input: 3, output: 15, cacheRead: 0.3 },
|
|
87
|
+
// ── Zhipu GLM ─────────────────────────────────────────────────
|
|
88
|
+
"glm-4-plus": { input: 0.7, output: 0.7 },
|
|
89
|
+
"glm-4": { input: 0.14, output: 0.14 },
|
|
90
|
+
"glm-4-flash": { input: 0, output: 0 },
|
|
91
|
+
"glm-4.5": { input: 0.29, output: 1.14 },
|
|
92
|
+
"glm-4.6": { input: 0.6, output: 2.2 },
|
|
93
|
+
"glm-4.6v": { input: 0.6, output: 2.2 },
|
|
94
|
+
"glm-5": { input: 0.85, output: 2.85 },
|
|
95
|
+
// GLM-5.2(2026-06)官方直连 API 定价 $1.40 / $4.40。
|
|
96
|
+
"glm-5.2": { input: 1.4, output: 4.4 },
|
|
97
|
+
// GLM-5V-Turbo(2026-04 视觉编程旗舰)官方直连 API 定价 $1.20 / $4.00。
|
|
98
|
+
"glm-5v-turbo": { input: 1.2, output: 4 },
|
|
99
|
+
"glm-5.1": { input: 0.95, output: 3.15 },
|
|
100
|
+
"glm-5.1-reasoning": { input: 1.4, output: 4.4 },
|
|
101
|
+
"glm-5.1-air": { input: 0.4, output: 1.2 },
|
|
102
|
+
"glm-z1": { input: 0.5, output: 1.5 },
|
|
103
|
+
"glm-z1-air": { input: 0.2, output: 0.6 },
|
|
104
|
+
"glm-z1-flash": { input: 0, output: 0 }
|
|
105
|
+
// ── MiniMax (海螺) ────────────────────────────────────────────
|
|
106
|
+
// GAP (v0.4.184): MiniMax-M3 / M2.x are unpriced — no verified rate anchor yet.
|
|
107
|
+
// Unpriced → `aicli usage` shows "—" (unknown), not a false $0.00. Add when confirmed.
|
|
108
|
+
// ── OpenRouter (pass-through — actual cost depends on underlying model) ──
|
|
109
|
+
// Left empty by design: model IDs are "vendor/model" (e.g. anthropic/claude-sonnet-4)
|
|
110
|
+
// and the real price is set by the underlying model + OpenRouter markup, not statically
|
|
111
|
+
// resolvable here. Shows "—" (unknown) in `aicli usage`.
|
|
112
|
+
// ── Ollama (local, zero cost) ─────────────────────────────────
|
|
113
|
+
// Handled via provider check below (FREE_PROVIDERS → genuine $0.00, not "unknown").
|
|
114
|
+
};
|
|
115
|
+
var FREE_PROVIDERS = /* @__PURE__ */ new Set(["ollama"]);
|
|
116
|
+
function getPricing(provider, model, at = /* @__PURE__ */ new Date()) {
|
|
117
|
+
if (FREE_PROVIDERS.has(provider.toLowerCase())) {
|
|
118
|
+
return { input: 0, output: 0 };
|
|
119
|
+
}
|
|
120
|
+
const key = model.toLowerCase();
|
|
121
|
+
if (provider.toLowerCase() === "deepseek") {
|
|
122
|
+
const dynamicPricing = getDeepSeekV4Pricing(key, at);
|
|
123
|
+
if (dynamicPricing) return dynamicPricing;
|
|
124
|
+
}
|
|
125
|
+
if (PRICING_TABLE[key]) return PRICING_TABLE[key];
|
|
126
|
+
const keys = Object.keys(PRICING_TABLE).sort((a, b) => b.length - a.length);
|
|
127
|
+
for (const k of keys) {
|
|
128
|
+
if (key.startsWith(k)) return PRICING_TABLE[k];
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
function computeCost(provider, model, usage, at = /* @__PURE__ */ new Date()) {
|
|
133
|
+
const p = getPricing(provider, model, at);
|
|
134
|
+
if (!p) return null;
|
|
135
|
+
const input = usage.inputTokens * p.input;
|
|
136
|
+
const output = usage.outputTokens * p.output;
|
|
137
|
+
const cacheWrite = (usage.cacheCreationTokens ?? 0) * (p.cacheWrite ?? p.input);
|
|
138
|
+
const cacheRead = (usage.cacheReadTokens ?? 0) * (p.cacheRead ?? p.input);
|
|
139
|
+
return (input + output + cacheWrite + cacheRead) / 1e6;
|
|
140
|
+
}
|
|
141
|
+
function formatCost(amount) {
|
|
142
|
+
if (amount === 0) return "$0.0000";
|
|
143
|
+
if (amount < 0.01) return `$${amount.toFixed(4)}`;
|
|
144
|
+
if (amount < 1) return `$${amount.toFixed(3)}`;
|
|
145
|
+
return `$${amount.toFixed(2)}`;
|
|
146
|
+
}
|
|
147
|
+
|
|
10
148
|
// src/core/cost-tracker.ts
|
|
11
149
|
import { existsSync, readFileSync } from "fs";
|
|
12
150
|
import { join } from "path";
|
|
@@ -261,5 +399,8 @@ var CostTracker = class _CostTracker {
|
|
|
261
399
|
};
|
|
262
400
|
|
|
263
401
|
export {
|
|
402
|
+
getPricing,
|
|
403
|
+
computeCost,
|
|
404
|
+
formatCost,
|
|
264
405
|
CostTracker
|
|
265
406
|
};
|
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
CI_COMMENT_MARKER,
|
|
4
4
|
countSeverity,
|
|
5
5
|
runCi
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-5CU72V6P.js";
|
|
7
|
+
import "./chunk-6C6FLDGH.js";
|
|
8
8
|
import "./chunk-HLWUDRBO.js";
|
|
9
9
|
import "./chunk-6YZEZFX5.js";
|
|
10
10
|
import "./chunk-AUEX6RNY.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-EWRZMIQE.js";
|
|
12
12
|
import "./chunk-3OBY7WSS.js";
|
|
13
13
|
import "./chunk-TU3L3PW7.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-THHPKZJ3.js";
|
|
15
15
|
import "./chunk-IW3Q7AE5.js";
|
|
16
16
|
export {
|
|
17
17
|
CI_COMMENT_MARKER,
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import {
|
|
3
3
|
formatDoctorReport,
|
|
4
4
|
runDoctorCli
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-QN7WD2SM.js";
|
|
6
6
|
import "./chunk-AUEX6RNY.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-EWRZMIQE.js";
|
|
8
|
+
import "./chunk-WPN7LDLM.js";
|
|
9
9
|
import "./chunk-3OBY7WSS.js";
|
|
10
10
|
import "./chunk-TU3L3PW7.js";
|
|
11
11
|
import "./chunk-HOSJZMQS.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-THHPKZJ3.js";
|
|
13
13
|
import "./chunk-IW3Q7AE5.js";
|
|
14
14
|
export {
|
|
15
15
|
formatDoctorReport,
|