deepseeker-code 1.0.56 → 1.0.57
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/cli.mjs +71 -10
- package/package.json +4 -3
package/dist/cli.mjs
CHANGED
|
@@ -913,10 +913,11 @@ var init_ticket = __esm({
|
|
|
913
913
|
}
|
|
914
914
|
const tools = fm["tools"] !== void 0 ? parseToolsValue(fm["tools"]) : void 0;
|
|
915
915
|
if (tools && tools.length === 0) return { ok: false, error: ticketMsg(locale2, "badTools") };
|
|
916
|
+
const setup = (fm["setup"] ?? "").trim() || void 0;
|
|
916
917
|
const body = bodyRaw.trim();
|
|
917
918
|
if (!body) return { ok: false, error: ticketMsg(locale2, "emptyBody") };
|
|
918
919
|
const title = (fm["title"] ?? "").trim() || body.split(/\r?\n/).find((l) => l.trim())?.slice(0, 40) || ticketMsg(locale2, "untitled");
|
|
919
|
-
return { ok: true, ticket: { title, accept, budgetYuan, timeoutMin, tools: tools && tools.length > 0 ? tools : void 0, body } };
|
|
920
|
+
return { ok: true, ticket: { title, accept, setup, budgetYuan, timeoutMin, tools: tools && tools.length > 0 ? tools : void 0, body } };
|
|
920
921
|
};
|
|
921
922
|
readBatchTicket = async (filePath, locale2 = "zh") => {
|
|
922
923
|
let source;
|
|
@@ -1069,6 +1070,7 @@ var init_batchStrings = __esm({
|
|
|
1069
1070
|
---
|
|
1070
1071
|
title: \u4FEE\u590D\u65E5\u671F\u89E3\u6790 bug
|
|
1071
1072
|
accept: npm test
|
|
1073
|
+
setup: pnpm install # \u53EF\u9009\uFF1Aagent \u524D\u5728 worktree \u5185\u5907\u73AF\u5883\uFF08\u5E72\u51C0\u68C0\u51FA\u65E0 node_modules\uFF0C\u9A8C\u6536\u4F9D\u8D56\u73AF\u5883\u65F6\u5148\u88C5\uFF09
|
|
1072
1074
|
budget-yuan: 0.5 # \u53EF\u9009\uFF1A\u672C\u4EFB\u52A1\u82B1\u8D39\u4E0A\u9650\uFF08\u5143\uFF09
|
|
1073
1075
|
timeout-min: 30 # \u53EF\u9009\uFF1Aagent \u9636\u6BB5\u8D85\u65F6\uFF08\u5206\u949F\uFF0C\u7F3A\u7701 30\uFF09
|
|
1074
1076
|
tools: run_command # \u53EF\u9009\uFF1A\u663E\u5F0F\u89E3\u9501\u9AD8\u5371\u5DE5\u5177\uFF08\u7F3A\u7701\u7981 run_command/delete_path\uFF09
|
|
@@ -1091,6 +1093,8 @@ var init_batchStrings = __esm({
|
|
|
1091
1093
|
// —— batchRunner 控制台进度 ——
|
|
1092
1094
|
ticketRejected: (id, err) => `\u{1F6AB} [${id}] \u5DE5\u5355\u88AB\u62D2\uFF1A${err}`,
|
|
1093
1095
|
taskMeta: (budget, timeoutMin, accept) => ` \u9884\u7B97 ${budget !== void 0 ? `\xA5${budget}` : "\u4E0D\u9650"} \xB7 \u8D85\u65F6 ${timeoutMin}min \xB7 \u9A8C\u6536 \`${accept}\``,
|
|
1096
|
+
setupLine: (cmd) => `\u{1F6E0}\uFE0F setup\uFF1A\`${cmd}\`\uFF08worktree \u5185\u5907\u73AF\u5883\uFF09`,
|
|
1097
|
+
setupFail: (cmd, code) => `\u73AF\u5883\u51C6\u5907\u5931\u8D25\uFF08setup \`${cmd}\` exit ${code ?? "null"}\uFF09\u2014\u2014\u8DF3\u8FC7 agent \u9636\u6BB5\uFF0C\u4EFB\u52A1\u8BB0\u5931\u8D25`,
|
|
1094
1098
|
roundLine: (ts2, round) => ` [${ts2}] \u8F6E ${round}`,
|
|
1095
1099
|
wtCreateFail: (e) => `\u521B\u5EFA worktree \u5931\u8D25\uFF08\u9700\u8981\u4E3B\u5DE5\u4F5C\u533A\u662F git \u4ED3\u5E93\uFF09\uFF1A${e}`,
|
|
1096
1100
|
agentErrorLine: (id, err) => `\u{1F4A5} [${id}] agent \u5F02\u5E38\uFF1A${err}`,
|
|
@@ -1114,6 +1118,7 @@ var init_batchStrings = __esm({
|
|
|
1114
1118
|
"accept-failed": "\u274C \u9A8C\u6536\u672A\u8FC7",
|
|
1115
1119
|
timeout: "\u23F1\uFE0F \u8D85\u65F6\u622A\u65AD",
|
|
1116
1120
|
error: "\u{1F4A5} agent \u5F02\u5E38",
|
|
1121
|
+
"setup-failed": "\u{1F6E0}\uFE0F \u73AF\u5883\u51C6\u5907\u5931\u8D25",
|
|
1117
1122
|
rejected: "\u{1F6AB} \u5DE5\u5355\u88AB\u62D2"
|
|
1118
1123
|
})[s],
|
|
1119
1124
|
// —— 验收命令执行(输出嵌入报告) ——
|
|
@@ -1168,6 +1173,7 @@ Ticket format (Markdown; frontmatter \`accept\` is required \u2014 no acceptance
|
|
|
1168
1173
|
---
|
|
1169
1174
|
title: Fix date parsing bug
|
|
1170
1175
|
accept: npm test # required: acceptance command (exit 0 = pass)
|
|
1176
|
+
setup: pnpm install # optional: prep env inside the worktree before the agent (fresh checkout has no node_modules)
|
|
1171
1177
|
budget-yuan: 0.5 # optional: per-task cost cap (yuan)
|
|
1172
1178
|
timeout-min: 30 # optional: agent-phase timeout (minutes, default 30)
|
|
1173
1179
|
tools: run_command # optional: unlock risky tools (run_command/delete_path denied by default)
|
|
@@ -1190,6 +1196,8 @@ changes are harvested onto an isolated git worktree (temp branch), kept for manu
|
|
|
1190
1196
|
reportMissing: "(report missing)",
|
|
1191
1197
|
ticketRejected: (id, err) => `\u{1F6AB} [${id}] Ticket rejected: ${err}`,
|
|
1192
1198
|
taskMeta: (budget, timeoutMin, accept) => ` Budget ${budget !== void 0 ? `\xA5${budget}` : "uncapped"} \xB7 timeout ${timeoutMin}min \xB7 accept \`${accept}\``,
|
|
1199
|
+
setupLine: (cmd) => `\u{1F6E0}\uFE0F setup: \`${cmd}\` (preparing the environment inside the worktree)`,
|
|
1200
|
+
setupFail: (cmd, code) => `Setup failed (\`${cmd}\` exit ${code ?? "null"}) \u2014 agent phase skipped, task marked failed`,
|
|
1193
1201
|
roundLine: (ts2, round) => ` [${ts2}] round ${round}`,
|
|
1194
1202
|
wtCreateFail: (e) => `Failed to create worktree (the main workspace must be a git repo): ${e}`,
|
|
1195
1203
|
agentErrorLine: (id, err) => `\u{1F4A5} [${id}] agent error: ${err}`,
|
|
@@ -1212,6 +1220,7 @@ changes are harvested onto an isolated git worktree (temp branch), kept for manu
|
|
|
1212
1220
|
"accept-failed": "\u274C acceptance failed",
|
|
1213
1221
|
timeout: "\u23F1\uFE0F timed out",
|
|
1214
1222
|
error: "\u{1F4A5} agent error",
|
|
1223
|
+
"setup-failed": "\u{1F6E0}\uFE0F setup failed",
|
|
1215
1224
|
rejected: "\u{1F6AB} ticket rejected"
|
|
1216
1225
|
})[s],
|
|
1217
1226
|
spawnFail: (e) => `Spawn failed: ${e}`,
|
|
@@ -12815,13 +12824,29 @@ var init_usageLog = __esm({
|
|
|
12815
12824
|
});
|
|
12816
12825
|
|
|
12817
12826
|
// ../core/src/config/prices.ts
|
|
12818
|
-
var MODEL_PRICES, envPrice, ENV_OVERRIDE, priceFor, calcCostYuan;
|
|
12827
|
+
var MODEL_PRICES, PRICES_VERIFIED_AT, PRICES_STALE_DAYS, pricesAgeDays, isBeijingPeak, envPrice, ENV_OVERRIDE, priceFor, calcCostYuan;
|
|
12819
12828
|
var init_prices = __esm({
|
|
12820
12829
|
"../core/src/config/prices.ts"() {
|
|
12821
12830
|
"use strict";
|
|
12822
12831
|
MODEL_PRICES = {
|
|
12823
|
-
"deepseek-flash": {
|
|
12824
|
-
|
|
12832
|
+
"deepseek-flash": {
|
|
12833
|
+
idle: { input: 1, output: 4, cacheHit: 0.02 },
|
|
12834
|
+
peak: { input: 2, output: 8, cacheHit: 0.04 }
|
|
12835
|
+
},
|
|
12836
|
+
"deepseek-v4-pro": {
|
|
12837
|
+
idle: { input: 4.5, output: 13.5, cacheHit: 0.15 },
|
|
12838
|
+
peak: { input: 9, output: 27, cacheHit: 0.3 }
|
|
12839
|
+
}
|
|
12840
|
+
};
|
|
12841
|
+
PRICES_VERIFIED_AT = "2026-10-16";
|
|
12842
|
+
PRICES_STALE_DAYS = 30;
|
|
12843
|
+
pricesAgeDays = () => Math.max(0, Math.floor((Date.now() - Date.parse(`${PRICES_VERIFIED_AT}T00:00:00Z`)) / 864e5));
|
|
12844
|
+
isBeijingPeak = (ts2 = /* @__PURE__ */ new Date()) => {
|
|
12845
|
+
const bj = new Date(ts2.getTime() + 8 * 36e5);
|
|
12846
|
+
const day = bj.getUTCDay();
|
|
12847
|
+
if (day === 0 || day === 6) return false;
|
|
12848
|
+
const h = bj.getUTCHours();
|
|
12849
|
+
return h >= 9 && h < 12 || h >= 14 && h < 18;
|
|
12825
12850
|
};
|
|
12826
12851
|
envPrice = (name) => {
|
|
12827
12852
|
const raw = process.env[name];
|
|
@@ -12836,8 +12861,9 @@ var init_prices = __esm({
|
|
|
12836
12861
|
if (input === void 0 && output === void 0 && cacheHit === void 0) return null;
|
|
12837
12862
|
return { input, output, cacheHit };
|
|
12838
12863
|
})();
|
|
12839
|
-
priceFor = (model) => {
|
|
12840
|
-
const
|
|
12864
|
+
priceFor = (model, ts2) => {
|
|
12865
|
+
const tier = MODEL_PRICES[model];
|
|
12866
|
+
const base = tier ? isBeijingPeak(ts2 ?? /* @__PURE__ */ new Date()) ? tier.peak : tier.idle : void 0;
|
|
12841
12867
|
if (!ENV_OVERRIDE) return base ?? null;
|
|
12842
12868
|
const input = ENV_OVERRIDE.input ?? base?.input;
|
|
12843
12869
|
const output = ENV_OVERRIDE.output ?? base?.output;
|
|
@@ -12845,8 +12871,8 @@ var init_prices = __esm({
|
|
|
12845
12871
|
if (input === void 0 || output === void 0 || cacheHit === void 0) return null;
|
|
12846
12872
|
return { input, output, cacheHit };
|
|
12847
12873
|
};
|
|
12848
|
-
calcCostYuan = (model, u) => {
|
|
12849
|
-
const p = priceFor(model);
|
|
12874
|
+
calcCostYuan = (model, u, ts2) => {
|
|
12875
|
+
const p = priceFor(model, ts2);
|
|
12850
12876
|
if (!p) return null;
|
|
12851
12877
|
const cached2 = Math.max(0, u.cachedTokens ?? 0);
|
|
12852
12878
|
const miss = Math.max(0, (u.promptTokens ?? 0) - cached2);
|
|
@@ -17163,6 +17189,7 @@ var init_inspect = __esm({
|
|
|
17163
17189
|
usageTopTools: (tools) => ` \u5E38\u7528\u5DE5\u5177: ${tools.join("\u3001") || "\uFF08\u65E0\uFF09"}`,
|
|
17164
17190
|
usageWeekCost: (cost, saved, unpriced) => ` \u8FD1 7 \u5929\u82B1\u8D39 \xA5${cost}\uFF08\u7F13\u5B58\u547D\u4E2D\u5DF2\u7701 \xA5${saved}\uFF09${unpriced > 0 ? ` \xB7 ${unpriced} \u6761\u65E0\u4EF7\u8BB0\u5F55\u672A\u8BA1` : ""}`,
|
|
17165
17191
|
usageTopSessions: (tops) => ` \u8D39\u7528 top \u4F1A\u8BDD: ${tops}`,
|
|
17192
|
+
usagePriceStale: (days, at) => ` \u26A0\uFE0F \u4EF7\u683C\u8868 ${at} \u6838\u5B9E\u540E\u5DF2 ${days} \u5929\u672A\u590D\u6838\u2014\u2014\u5B98\u7F51\u82E5\u5DF2\u8C03\u4EF7\uFF0C\u4E0A\u65B9\u82B1\u8D39\u4F1A\u5931\u771F\uFF08\u53EF\u8BBE DEEP_SEEK_PRICE_* \u4E34\u65F6\u6821\u51C6\uFF09\u3002`,
|
|
17166
17193
|
usageTip: " \u63D0\u793A\uFF1A\u5E76\u884C workflow \u4F1A\u653E\u5927\u5B50 agent \u7528\u91CF\uFF1B\u7F13\u5B58\u547D\u4E2D\u7387\u8D8A\u9AD8\uFF0C\u8F93\u5165\u6210\u672C\u8D8A\u4F4E\u3002",
|
|
17167
17194
|
ctxHead: "\u{1F9E0} \u4E0A\u4E0B\u6587\u6CBB\u7406",
|
|
17168
17195
|
ctxWindow: (window, threshold, ratio, keep) => ` \u7A97\u53E3\u4E0A\u9650: ${window} | \u538B\u7F29\u9608\u503C: ${threshold}\uFF08${ratio}\xD7\uFF09 | \u4FDD\u7559\u6700\u8FD1: ${keep} \u5BF9\u8BDD\u5355\u5143`,
|
|
@@ -17209,6 +17236,7 @@ var init_inspect = __esm({
|
|
|
17209
17236
|
usageTopTools: (tools) => ` Top tools: ${tools.join(", ") || "(none)"}`,
|
|
17210
17237
|
usageWeekCost: (cost, saved, unpriced) => ` 7-day spend \xA5${cost} (cache hits saved \xA5${saved})${unpriced > 0 ? ` \xB7 ${unpriced} unpriced records excluded` : ""}`,
|
|
17211
17238
|
usageTopSessions: (tops) => ` Costliest sessions: ${tops}`,
|
|
17239
|
+
usagePriceStale: (days, at) => ` \u26A0\uFE0F Price table verified on ${at}, ${days} days ago \u2014 if official pricing changed, costs above may drift (set DEEP_SEEK_PRICE_* to correct).`,
|
|
17212
17240
|
usageTip: " Tip: parallel workflows multiply sub-agent usage; higher cache hit rate means lower input cost.",
|
|
17213
17241
|
ctxHead: "\u{1F9E0} Context governance",
|
|
17214
17242
|
ctxWindow: (window, threshold, ratio, keep) => ` Window cap: ${window} | Compact threshold: ${threshold} (${ratio}\xD7) | Keep recent: ${keep} dialogue units`,
|
|
@@ -17319,12 +17347,13 @@ var init_inspect = __esm({
|
|
|
17319
17347
|
const bySession = /* @__PURE__ */ new Map();
|
|
17320
17348
|
let weekCost = 0, weekSaved = 0, pricedRuns = 0;
|
|
17321
17349
|
for (const r of weekRecords) {
|
|
17322
|
-
const
|
|
17350
|
+
const at = Number.isNaN(Date.parse(String(r.ts))) ? void 0 : new Date(r.ts);
|
|
17351
|
+
const c = r.costYuan ?? calcCostYuan(r.model, r, at);
|
|
17323
17352
|
if (c == null) continue;
|
|
17324
17353
|
pricedRuns++;
|
|
17325
17354
|
weekCost += c;
|
|
17326
17355
|
bySession.set(r.sessionId, (bySession.get(r.sessionId) ?? 0) + c);
|
|
17327
|
-
const p = priceFor(r.model);
|
|
17356
|
+
const p = priceFor(r.model, at);
|
|
17328
17357
|
if (p) weekSaved += (r.cachedTokens ?? 0) * (p.input - p.cacheHit) / 1e6;
|
|
17329
17358
|
}
|
|
17330
17359
|
if (pricedRuns > 0) {
|
|
@@ -17334,6 +17363,8 @@ var init_inspect = __esm({
|
|
|
17334
17363
|
if (tops) lines.push(t("usageTopSessions")(tops));
|
|
17335
17364
|
}
|
|
17336
17365
|
}
|
|
17366
|
+
const staleDays = pricesAgeDays();
|
|
17367
|
+
if (staleDays >= PRICES_STALE_DAYS) lines.push(t("usagePriceStale")(staleDays, PRICES_VERIFIED_AT));
|
|
17337
17368
|
lines.push(t("usageTip"));
|
|
17338
17369
|
return lines.join("\n");
|
|
17339
17370
|
};
|
|
@@ -18357,6 +18388,36 @@ ${parsed.error}`);
|
|
|
18357
18388
|
return { status: "error", cost: cost2, budgetTruncated: false };
|
|
18358
18389
|
}
|
|
18359
18390
|
setSessionWorktree(sessionId, wt);
|
|
18391
|
+
if (t.setup) {
|
|
18392
|
+
emit2(T.setupLine(t.setup));
|
|
18393
|
+
const s = await runAcceptCommand(t.setup, wt.path);
|
|
18394
|
+
if (s.code !== 0 || s.timedOut) {
|
|
18395
|
+
const msg = `${T.setupFail(t.setup, s.code)}${s.timedOut ? T.acceptTimeoutSuffix : ""}
|
|
18396
|
+
|
|
18397
|
+
\`\`\`
|
|
18398
|
+
${s.output}
|
|
18399
|
+
\`\`\``;
|
|
18400
|
+
await killBackgroundTasksUnder(wt.path).catch(() => {
|
|
18401
|
+
});
|
|
18402
|
+
const cost2 = await collectSessionCost(sessionId);
|
|
18403
|
+
await finishTicket(task.id, buildReport({
|
|
18404
|
+
id: task.id,
|
|
18405
|
+
ticket: t,
|
|
18406
|
+
status: "setup-failed",
|
|
18407
|
+
budgetTruncated: false,
|
|
18408
|
+
cost: cost2,
|
|
18409
|
+
receipt: void 0,
|
|
18410
|
+
finalText: "",
|
|
18411
|
+
accept: null,
|
|
18412
|
+
deniedTools: [],
|
|
18413
|
+
diff: T.diffNone,
|
|
18414
|
+
wt,
|
|
18415
|
+
errorMessage: msg
|
|
18416
|
+
}));
|
|
18417
|
+
emit2(`\u{1F6E0}\uFE0F [${task.id}] ${T.setupFail(t.setup, s.code)}`);
|
|
18418
|
+
return { status: "setup-failed", cost: cost2, budgetTruncated: false };
|
|
18419
|
+
}
|
|
18420
|
+
}
|
|
18360
18421
|
const ac = new AbortController();
|
|
18361
18422
|
const timer = setTimeout(() => ac.abort(new Error(T.timeoutAbort(timeoutMin))), timeoutMin * 6e4);
|
|
18362
18423
|
let receipt;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deepseeker-code",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.57",
|
|
4
4
|
"description": "DeepSeeker-Code 终端客户端(React Ink,in-process 直驱 runAgent)",
|
|
5
5
|
"homepage": "https://github.com/xknk/deepSeekCode#readme",
|
|
6
6
|
"repository": {
|
|
@@ -40,10 +40,11 @@
|
|
|
40
40
|
"node": ">=20"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"
|
|
44
|
-
"react": "18",
|
|
43
|
+
"ajv": "^8.20.0",
|
|
45
44
|
"ignore": "^7.0.5",
|
|
45
|
+
"ink": "5",
|
|
46
46
|
"openai": "^6.42.0",
|
|
47
|
+
"react": "18",
|
|
47
48
|
"undici": "^8.8.0",
|
|
48
49
|
"vscode-ripgrep": "^1.13.2"
|
|
49
50
|
},
|