jinzd-ai-cli 0.4.255 → 0.4.257
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 +2 -2
- package/README.zh-CN.md +2 -2
- package/dist/{batch-OWBKG6XZ.js → batch-HCTZJMGR.js} +3 -3
- package/dist/{chunk-X2V76VPG.js → chunk-4VWME5CO.js} +1 -1
- package/dist/{chunk-SVWIUNOA.js → chunk-5DLLJ67Q.js} +1 -1
- package/dist/{chunk-U6OV523Y.js → chunk-BQXVQKMH.js} +1 -1
- package/dist/{chunk-IRSNREEO.js → chunk-DFV7F6S7.js} +3 -3
- package/dist/{chunk-B42HK6GL.js → chunk-DGMSS565.js} +1 -1
- package/dist/{chunk-EWLXBTSC.js → chunk-DQY2DDGS.js} +1 -1
- package/dist/{chunk-3WKUKMBG.js → chunk-ELYDRIKV.js} +4 -4
- package/dist/{chunk-GUOLPI33.js → chunk-EZ6QLHOS.js} +9 -3
- package/dist/{chunk-7QWFFLKV.js → chunk-GOGDUA4G.js} +4 -4
- package/dist/{chunk-PSXIVQ3N.js → chunk-HOS7CGBI.js} +8 -3
- package/dist/{chunk-SMIQ6CBX.js → chunk-HPPK4IA3.js} +1 -1
- package/dist/{chunk-ZRBGH245.js → chunk-MJ6JLSPR.js} +42 -4
- package/dist/{chunk-YJ7VL7VL.js → chunk-NRTYNGEZ.js} +1 -1
- package/dist/{chunk-2UZ23L5P.js → chunk-NX55D52V.js} +2 -2
- package/dist/{chunk-CU5ZNAIX.js → chunk-QEVXWHWN.js} +1 -1
- package/dist/{chunk-PSP4W2MG.js → chunk-QI4AJPRD.js} +38 -20
- package/dist/{chunk-5ULLIOVC.js → chunk-TU3L3PW7.js} +5 -2
- package/dist/{chunk-FOC2YWOF.js → chunk-X2ZXQMN2.js} +1 -1
- package/dist/ci-OGJDKUEN.js +19 -0
- package/dist/{ci-format-CTGDLJTS.js → ci-format-CG6US3KX.js} +2 -2
- package/dist/{constants-LJRYL7IN.js → constants-3UC2F5GC.js} +1 -1
- package/dist/doctor-cli-FPYSCH5H.js +17 -0
- package/dist/electron-server.js +103 -31
- package/dist/{hub-4EEDUJED.js → hub-5NRTE7PL.js} +2 -2
- package/dist/{hub-server-XA7HTVLD.js → hub-server-QGUSMN22.js} +3 -0
- package/dist/index.js +47 -31
- package/dist/{persistent-memory-DMN76UB5.js → persistent-memory-CHPNGWN2.js} +2 -2
- package/dist/{persistent-memory-EEAGHDFR.js → persistent-memory-PNJCHP33.js} +2 -2
- package/dist/{pr-Q74YHWN2.js → pr-KAEI2IK3.js} +7 -7
- package/dist/{run-tests-ADZQ2JWI.js → run-tests-EOHLRWQC.js} +2 -2
- package/dist/{run-tests-N3ES4YMU.js → run-tests-F7Y6POVK.js} +2 -2
- package/dist/{server-HUWVPJKQ.js → server-4NP2ZVLA.js} +7 -7
- package/dist/{server-PMEZ3HDO.js → server-REZPCUHW.js} +17 -15
- package/dist/{task-orchestrator-KLCN25OY.js → task-orchestrator-LTPRJVLH.js} +13 -7
- package/dist/{usage-MNMRX5OE.js → usage-XPBLQ4FZ.js} +5 -5
- package/dist/web/client/app.js +3329 -3312
- package/dist/web/client/index.html +70 -70
- package/package.json +19 -9
- package/dist/ci-V5GVGYZO.js +0 -19
- package/dist/doctor-cli-GOM2GQUK.js +0 -17
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
[](https://www.npmjs.com/package/jinzd-ai-cli)
|
|
13
13
|
[](LICENSE)
|
|
14
|
-
[](https://nodejs.org)
|
|
14
|
+
[](https://nodejs.org)
|
|
15
15
|
[]()
|
|
16
16
|
[](https://github.com/jinzhengdong/ai-cli/releases)
|
|
17
17
|
[](https://github.com/jinzhengdong/ai-cli/actions/workflows/ci.yml)
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
npm install -g jinzd-ai-cli
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
Requires Node.js >= 20. After installation, use `aicli` to start.
|
|
69
|
+
Requires Node.js >= 20.18.1. After installation, use `aicli` to start.
|
|
70
70
|
|
|
71
71
|
### Electron Desktop App (Windows)
|
|
72
72
|
|
package/README.zh-CN.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
[](https://www.npmjs.com/package/jinzd-ai-cli)
|
|
13
13
|
[](LICENSE)
|
|
14
|
-
[](https://nodejs.org)
|
|
14
|
+
[](https://nodejs.org)
|
|
15
15
|
[]()
|
|
16
16
|
[](https://github.com/jinzhengdong/ai-cli/releases)
|
|
17
17
|
[](https://github.com/jinzhengdong/ai-cli/actions/workflows/ci.yml)
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
npm install -g jinzd-ai-cli
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
需要 Node.js >= 20。安装后使用 `aicli` 启动。
|
|
57
|
+
需要 Node.js >= 20.18.1。安装后使用 `aicli` 启动。
|
|
58
58
|
|
|
59
59
|
### Electron 桌面应用(Windows)
|
|
60
60
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ConfigManager
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-DFV7F6S7.js";
|
|
5
|
+
import "./chunk-TU3L3PW7.js";
|
|
6
|
+
import "./chunk-5DLLJ67Q.js";
|
|
7
7
|
import {
|
|
8
8
|
atomicWriteFileSync
|
|
9
9
|
} from "./chunk-IW3Q7AE5.js";
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ConfigError,
|
|
4
4
|
EnvLoader
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-TU3L3PW7.js";
|
|
6
6
|
import {
|
|
7
7
|
CONFIG_DIR_NAME,
|
|
8
8
|
CONFIG_FILE_NAME,
|
|
9
9
|
HISTORY_DIR_NAME,
|
|
10
10
|
PLUGINS_DIR_NAME
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-5DLLJ67Q.js";
|
|
12
12
|
import {
|
|
13
13
|
atomicWriteFileSync
|
|
14
14
|
} from "./chunk-IW3Q7AE5.js";
|
|
@@ -351,7 +351,7 @@ var ConfigManager = class {
|
|
|
351
351
|
return ConfigSchema.parse(raw);
|
|
352
352
|
} catch (err) {
|
|
353
353
|
throw new ConfigError(
|
|
354
|
-
`Config file at ${this.configPath} is invalid. Delete it and run '
|
|
354
|
+
`Config file at ${this.configPath} is invalid. Delete it and run 'aicli config' to recreate.
|
|
355
355
|
${err}`
|
|
356
356
|
);
|
|
357
357
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ProviderRegistry
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MJ6JLSPR.js";
|
|
5
5
|
import {
|
|
6
6
|
ConfigManager
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DFV7F6S7.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-X2ZXQMN2.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-5DLLJ67Q.js";
|
|
30
30
|
|
|
31
31
|
// src/diagnostics/doctor-report.ts
|
|
32
32
|
import { existsSync as existsSync3, statSync as statSync2 } from "fs";
|
|
@@ -39,9 +39,15 @@ var PRICING_TABLE = {
|
|
|
39
39
|
"gemini-1.5-flash": { input: 0.075, output: 0.3 },
|
|
40
40
|
// ── DeepSeek ──────────────────────────────────────────────────
|
|
41
41
|
// V4 family (2026-04-23+):1M context, Thinking / Non-Thinking dual-mode, 384K max output
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
//
|
|
42
|
+
// 费率 2026-08-01 对 api-docs.deepseek.com/quick_start/pricing 官方 USD 表逐项核对。
|
|
43
|
+
// 修正前 pro 三项整齐高 4×(官方降过价未跟)、flash cacheRead 高 10×(像是按 input 的
|
|
44
|
+
// 20% 拍脑袋而非抄文档)——`aicli usage` 因此系统性高报 DeepSeek 成本。
|
|
45
|
+
// 待办:官方已公告峰谷定价(北京时间 9-12 点、14-18 点为平时 2 倍),本表仍是单一费率,
|
|
46
|
+
// 届时高峰时段会低报;等该策略实际生效后再决定是否引入时段维度。
|
|
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
|
+
// Legacy aliases:retires 2026-07-24 UTC 15:59,官方 route 到 V4 Flash。
|
|
50
|
+
// 这几条只服务历史 session 的成本回算,保留当时的费率口径,不随现价改动。
|
|
45
51
|
"deepseek-chat": { input: 0.14, output: 0.28, cacheRead: 0.028 },
|
|
46
52
|
"deepseek-reasoner": { input: 0.14, output: 0.28, cacheRead: 0.028 },
|
|
47
53
|
"deepseek-v3": { input: 0.27, output: 1.1, cacheRead: 0.07 },
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
evaluateCiGate,
|
|
4
4
|
normalizeCiThresholds
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HPPK4IA3.js";
|
|
6
6
|
import {
|
|
7
7
|
buildReviewPrompt,
|
|
8
8
|
buildSecurityReviewPrompt,
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
} from "./chunk-HLWUDRBO.js";
|
|
11
11
|
import {
|
|
12
12
|
ProviderRegistry
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-MJ6JLSPR.js";
|
|
14
14
|
import {
|
|
15
15
|
ConfigManager
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-DFV7F6S7.js";
|
|
17
17
|
import {
|
|
18
18
|
VERSION
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-5DLLJ67Q.js";
|
|
20
20
|
|
|
21
21
|
// src/cli/ci.ts
|
|
22
22
|
import { execFileSync } from "child_process";
|
|
@@ -824,6 +824,7 @@ var BudgetWarner = class {
|
|
|
824
824
|
this.lowAt = Math.min(lowRaw, this.noteAt - 1);
|
|
825
825
|
this.criticalAt = Math.min(criticalRaw, this.lowAt - 1);
|
|
826
826
|
}
|
|
827
|
+
maxToolRounds;
|
|
827
828
|
noteAt;
|
|
828
829
|
lowAt;
|
|
829
830
|
criticalAt;
|
|
@@ -858,6 +859,7 @@ var BudgetWarner = class {
|
|
|
858
859
|
}
|
|
859
860
|
};
|
|
860
861
|
var EMPTY_RESPONSE_NUDGE = "Your previous response was empty \u2014 no text and no tool calls. This usually means the context window is nearly full. Please either: (1) continue the task by calling the next tool you need, or (2) give a concise final text summary of what has been accomplished so far and what remains. Do NOT repeat earlier long outputs.";
|
|
862
|
+
var LENGTH_LIMIT_NUDGE = "Your previous attempt hit the model output token limit (finish_reason=length) before producing ANY answer text or tool call \u2014 the entire output budget was consumed by extended reasoning. Retrying the same way will fail identically. Do NOT reason at length again: start producing output immediately. If the deliverable is long, do NOT try to emit it in one response \u2014 write it to disk in several smaller write_file calls (part 1, part 2, ...), each well under the output limit, and keep any thinking short.";
|
|
861
863
|
function describeFinishReason(fr) {
|
|
862
864
|
if (fr === "length") return "output limit reached (finish_reason=length)";
|
|
863
865
|
if (fr === "content_filter") return "content blocked (finish_reason=content_filter)";
|
|
@@ -865,7 +867,9 @@ function describeFinishReason(fr) {
|
|
|
865
867
|
return "empty response";
|
|
866
868
|
}
|
|
867
869
|
function emptyResponseHint(fr) {
|
|
868
|
-
if (fr === "length")
|
|
870
|
+
if (fr === "length") {
|
|
871
|
+
return "Output token budget exhausted before any answer \u2014 on thinking models max_tokens covers reasoning + answer. Try: raise config.modelParams.<model>.maxTokens, ask for the deliverable in parts, or /model to switch.";
|
|
872
|
+
}
|
|
869
873
|
if (fr === "content_filter") return "Content was blocked by the provider filter.";
|
|
870
874
|
return "Context window may be exhausted or max_tokens too low.";
|
|
871
875
|
}
|
|
@@ -874,10 +878,11 @@ var EmptyResponseGuard = class {
|
|
|
874
878
|
onEmpty(canRetry, finishReason) {
|
|
875
879
|
if (this.retries === 0 && canRetry) {
|
|
876
880
|
this.retries++;
|
|
881
|
+
const isLength = finishReason === "length";
|
|
877
882
|
return {
|
|
878
883
|
action: "nudge",
|
|
879
|
-
injectMessage: EMPTY_RESPONSE_NUDGE,
|
|
880
|
-
displayMessage: `\u26A0 ${describeFinishReason(finishReason)} \u2014 nudging AI to continue...`
|
|
884
|
+
injectMessage: isLength ? LENGTH_LIMIT_NUDGE : EMPTY_RESPONSE_NUDGE,
|
|
885
|
+
displayMessage: isLength ? `\u26A0 ${describeFinishReason(finishReason)} \u2014 the whole output budget went to reasoning; asking AI to write directly in smaller parts...` : `\u26A0 ${describeFinishReason(finishReason)} \u2014 nudging AI to continue...`
|
|
881
886
|
};
|
|
882
887
|
}
|
|
883
888
|
return {
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
detectsHallucinatedFileOp,
|
|
4
4
|
parseToolCallArguments,
|
|
5
5
|
schemaToJsonSchema
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HOS7CGBI.js";
|
|
7
7
|
import {
|
|
8
8
|
AuthError,
|
|
9
9
|
ProviderError,
|
|
10
10
|
ProviderNotFoundError,
|
|
11
11
|
RateLimitError
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-TU3L3PW7.js";
|
|
13
13
|
import {
|
|
14
14
|
atomicWriteFileSync
|
|
15
15
|
} from "./chunk-IW3Q7AE5.js";
|
|
@@ -957,20 +957,49 @@ function isLoopbackBaseUrl(baseUrl) {
|
|
|
957
957
|
if (host === "localhost" || host === "::1" || host === "0.0.0.0") return true;
|
|
958
958
|
return /^127(?:\.\d{1,3}){3}$/.test(host);
|
|
959
959
|
}
|
|
960
|
+
function readRetryCount(headers) {
|
|
961
|
+
if (!headers) return 0;
|
|
962
|
+
const KEY = "x-stainless-retry-count";
|
|
963
|
+
let raw;
|
|
964
|
+
const getter = headers.get;
|
|
965
|
+
if (typeof getter === "function") {
|
|
966
|
+
raw = getter.call(headers, KEY) ?? void 0;
|
|
967
|
+
} else if (Array.isArray(headers)) {
|
|
968
|
+
raw = headers.find(([k]) => k.toLowerCase() === KEY)?.[1];
|
|
969
|
+
} else {
|
|
970
|
+
const entry = Object.entries(headers).find(
|
|
971
|
+
([k]) => k.toLowerCase() === KEY
|
|
972
|
+
);
|
|
973
|
+
raw = entry?.[1];
|
|
974
|
+
}
|
|
975
|
+
const n = Number(raw);
|
|
976
|
+
return Number.isFinite(n) && n > 0 ? n : 0;
|
|
977
|
+
}
|
|
960
978
|
var OpenAICompatibleProvider = class extends BaseProvider {
|
|
961
979
|
client;
|
|
962
980
|
defaultTimeout = 6e4;
|
|
963
981
|
// ms
|
|
982
|
+
/**
|
|
983
|
+
* openai-node 的默认 `maxRetries` 是 **2**,且**超时也算可重试错误**。
|
|
984
|
+
* 对普通 REST 请求这没问题,但 LLM 调用的超时是分钟级:东叔配 `timeouts.deepseek=300000`
|
|
985
|
+
* (5 分钟)本意是「最多等 5 分钟」,实际最坏是 5min × 3 次 = **15 分钟以上的完全静默**
|
|
986
|
+
* ——尤其 DeepSeek/Kimi 走 `enableStreamingToolCalls=false` 的非流式回退路径时,
|
|
987
|
+
* 屏幕上连一个字都不会动,看起来就是卡死(实战:一次 skill 任务空转近 20 分钟)。
|
|
988
|
+
* 故显式降到 1(仍保留一次对瞬时网络抖动的重试),并在 fetch 包装里把重试**打印出来**。
|
|
989
|
+
*/
|
|
990
|
+
defaultMaxRetries = 1;
|
|
964
991
|
/** 子类设为 false 可禁用流式工具调用(虚假声明检测需要完整响应) */
|
|
965
992
|
enableStreamingToolCalls = true;
|
|
966
993
|
async initialize(apiKey, options) {
|
|
967
994
|
if (options?.timeout !== void 0) {
|
|
968
995
|
this.defaultTimeout = options.timeout;
|
|
969
996
|
}
|
|
997
|
+
const maxRetries = typeof options?.maxRetries === "number" ? options.maxRetries : this.defaultMaxRetries;
|
|
970
998
|
const clientOptions = {
|
|
971
999
|
apiKey,
|
|
972
1000
|
baseURL: options?.baseUrl ?? this.defaultBaseUrl,
|
|
973
|
-
timeout: this.defaultTimeout
|
|
1001
|
+
timeout: this.defaultTimeout,
|
|
1002
|
+
maxRetries
|
|
974
1003
|
};
|
|
975
1004
|
const proxyUrl = isLoopbackBaseUrl(clientOptions.baseURL) ? void 0 : options?.proxy;
|
|
976
1005
|
try {
|
|
@@ -985,7 +1014,16 @@ var OpenAICompatibleProvider = class extends BaseProvider {
|
|
|
985
1014
|
bodyTimeout: STREAM_BODY_TIMEOUT,
|
|
986
1015
|
headersTimeout: STREAM_HEADERS_TIMEOUT
|
|
987
1016
|
});
|
|
988
|
-
clientOptions.fetch = ((url, init) =>
|
|
1017
|
+
clientOptions.fetch = ((url, init) => {
|
|
1018
|
+
const retryCount = readRetryCount(init?.headers);
|
|
1019
|
+
if (retryCount > 0) {
|
|
1020
|
+
process.stderr.write(
|
|
1021
|
+
`[${this.info.id}] \u27F3 request retry ${retryCount}/${maxRetries} \u2014 previous attempt failed or timed out
|
|
1022
|
+
`
|
|
1023
|
+
);
|
|
1024
|
+
}
|
|
1025
|
+
return undiciFetch(url, { ...init, dispatcher });
|
|
1026
|
+
});
|
|
989
1027
|
} catch {
|
|
990
1028
|
}
|
|
991
1029
|
this.client = new OpenAI(clientOptions);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
truncateForPersist
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QI4AJPRD.js";
|
|
5
5
|
import {
|
|
6
6
|
APP_NAME,
|
|
7
7
|
CONFIG_DIR_NAME,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
MCP_PROTOCOL_VERSION,
|
|
12
12
|
MCP_TOOL_PREFIX,
|
|
13
13
|
VERSION
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-5DLLJ67Q.js";
|
|
15
15
|
import {
|
|
16
16
|
atomicWriteFileSync
|
|
17
17
|
} from "./chunk-IW3Q7AE5.js";
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
searchPersistentMemories,
|
|
8
8
|
touchMemoryReferences,
|
|
9
9
|
updateMemoryEntry
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-4VWME5CO.js";
|
|
11
11
|
import {
|
|
12
12
|
indexProject
|
|
13
13
|
} from "./chunk-GLSR2NR3.js";
|
|
@@ -23,31 +23,31 @@ import {
|
|
|
23
23
|
runHook,
|
|
24
24
|
runLifecycleHooks,
|
|
25
25
|
runTool
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-X2ZXQMN2.js";
|
|
27
27
|
import {
|
|
28
28
|
buildTruncatedArgumentsError,
|
|
29
29
|
getDangerLevel,
|
|
30
30
|
isFileWriteTool,
|
|
31
31
|
runLeanAgentLoop
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-HOS7CGBI.js";
|
|
33
33
|
import {
|
|
34
34
|
EnvLoader,
|
|
35
35
|
NetworkError,
|
|
36
36
|
ToolError
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-TU3L3PW7.js";
|
|
38
38
|
import {
|
|
39
39
|
fileCheckpoints
|
|
40
40
|
} from "./chunk-4BKXL7SM.js";
|
|
41
41
|
import {
|
|
42
42
|
runTestsTool
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-BQXVQKMH.js";
|
|
44
44
|
import {
|
|
45
45
|
CONFIG_DIR_NAME,
|
|
46
46
|
DEFAULT_MAX_TOOL_OUTPUT_CHARS_CAP,
|
|
47
47
|
SUBAGENT_ALLOWED_TOOLS,
|
|
48
48
|
SUBAGENT_DEFAULT_MAX_ROUNDS,
|
|
49
49
|
SUBAGENT_MAX_ROUNDS_LIMIT
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-5DLLJ67Q.js";
|
|
51
51
|
import {
|
|
52
52
|
loadChatIndex,
|
|
53
53
|
searchChatMemory
|
|
@@ -198,6 +198,7 @@ async function execInPool(sessionKey, command, timeout, cwd, abortSignal) {
|
|
|
198
198
|
let resolved = false;
|
|
199
199
|
const markerStartPattern = `AICLI_MARKER_START:${id}`;
|
|
200
200
|
const markerEndPattern = `AICLI_MARKER_END:${id}`;
|
|
201
|
+
const proc = entry.proc;
|
|
201
202
|
const onData = (chunk) => {
|
|
202
203
|
stdout += IS_WINDOWS2 ? decodeWindowsBuffer(chunk) : chunk.toString("utf-8");
|
|
203
204
|
if (!resolved && stdout.includes(markerEndPattern)) {
|
|
@@ -212,9 +213,26 @@ async function execInPool(sessionKey, command, timeout, cwd, abortSignal) {
|
|
|
212
213
|
const onErr = (chunk) => {
|
|
213
214
|
stderr += IS_WINDOWS2 ? decodeWindowsBuffer(chunk) : chunk.toString("utf-8");
|
|
214
215
|
};
|
|
215
|
-
const
|
|
216
|
+
const finishPoolFailure = (message, exitCode = null) => {
|
|
217
|
+
if (resolved) return;
|
|
218
|
+
resolved = true;
|
|
219
|
+
stdout = stripMarkerOutput(stdout, markerStartPattern, markerEndPattern);
|
|
220
|
+
stderr += `${stderr ? "\n" : ""}[pool terminated] ${message}`;
|
|
221
|
+
cleanup();
|
|
222
|
+
pool.delete(sessionKey);
|
|
223
|
+
resolve7({ stdout, stderr, exitCode: exitCode === 0 ? null : exitCode, timedOut, aborted });
|
|
224
|
+
};
|
|
225
|
+
const onClose = (code, signal) => {
|
|
226
|
+
const detail = signal ? `signal ${signal}` : `exit code ${code ?? "unknown"}`;
|
|
227
|
+
finishPoolFailure(`Shell exited before the completion marker (${detail}).`, code);
|
|
228
|
+
};
|
|
229
|
+
const onStdinError = (err) => {
|
|
230
|
+
finishPoolFailure(`Shell stdin failed: ${err.message}`);
|
|
231
|
+
};
|
|
216
232
|
proc.stdout?.on("data", onData);
|
|
217
233
|
proc.stderr?.on("data", onErr);
|
|
234
|
+
proc.once("close", onClose);
|
|
235
|
+
proc.stdin?.once("error", onStdinError);
|
|
218
236
|
const timeoutTimer = setTimeout(() => {
|
|
219
237
|
if (resolved) return;
|
|
220
238
|
timedOut = true;
|
|
@@ -241,29 +259,26 @@ async function execInPool(sessionKey, command, timeout, cwd, abortSignal) {
|
|
|
241
259
|
abortSignal?.addEventListener("abort", onAbort, { once: true });
|
|
242
260
|
}
|
|
243
261
|
const onError = (err) => {
|
|
244
|
-
|
|
245
|
-
resolved = true;
|
|
246
|
-
stderr += `
|
|
247
|
-
[pool error] ${err.message}`;
|
|
248
|
-
cleanup();
|
|
249
|
-
resolve7({ stdout, stderr, exitCode: null, timedOut, aborted });
|
|
250
|
-
pool.delete(sessionKey);
|
|
262
|
+
finishPoolFailure(`Shell process error: ${err.message}`);
|
|
251
263
|
};
|
|
252
|
-
proc.
|
|
264
|
+
proc.once("error", onError);
|
|
253
265
|
function cleanup() {
|
|
254
266
|
clearTimeout(timeoutTimer);
|
|
255
267
|
abortSignal?.removeEventListener("abort", onAbort);
|
|
256
268
|
proc.stdout?.removeListener("data", onData);
|
|
257
269
|
proc.stderr?.removeListener("data", onErr);
|
|
270
|
+
proc.removeListener("close", onClose);
|
|
258
271
|
proc.removeListener("error", onError);
|
|
272
|
+
proc.stdin?.removeListener("error", onStdinError);
|
|
259
273
|
}
|
|
260
274
|
try {
|
|
261
|
-
proc.stdin
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
pool.delete(sessionKey);
|
|
275
|
+
if (!proc.stdin) {
|
|
276
|
+
finishPoolFailure("Shell stdin is unavailable.");
|
|
277
|
+
} else {
|
|
278
|
+
proc.stdin.write(wrappedCmd + "\n");
|
|
266
279
|
}
|
|
280
|
+
} catch (err) {
|
|
281
|
+
finishPoolFailure(`Shell stdin write failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
267
282
|
}
|
|
268
283
|
});
|
|
269
284
|
}
|
|
@@ -2189,6 +2204,7 @@ var ToolExecutor = class {
|
|
|
2189
2204
|
constructor(registry) {
|
|
2190
2205
|
this.registry = registry;
|
|
2191
2206
|
}
|
|
2207
|
+
registry;
|
|
2192
2208
|
/** 当前 session 消息索引,由 repl.ts / session-handler.ts 在每轮工具执行前设置 */
|
|
2193
2209
|
static currentMessageIndex = 0;
|
|
2194
2210
|
round = 0;
|
|
@@ -5421,6 +5437,8 @@ var SubAgentExecutor = class {
|
|
|
5421
5437
|
this.runId = runId;
|
|
5422
5438
|
this.prefix = agentPrefix(agentIndex);
|
|
5423
5439
|
}
|
|
5440
|
+
registry;
|
|
5441
|
+
runId;
|
|
5424
5442
|
round = 0;
|
|
5425
5443
|
totalRounds = 0;
|
|
5426
5444
|
prefix = PREFIX;
|
|
@@ -62,10 +62,11 @@ var ProviderError = class extends AiCliError {
|
|
|
62
62
|
this.providerId = providerId;
|
|
63
63
|
this.name = "ProviderError";
|
|
64
64
|
}
|
|
65
|
+
providerId;
|
|
65
66
|
};
|
|
66
67
|
var AuthError = class extends ProviderError {
|
|
67
68
|
constructor(providerId) {
|
|
68
|
-
super(providerId, "Invalid or missing API key. Run:
|
|
69
|
+
super(providerId, "Invalid or missing API key. Run: aicli config");
|
|
69
70
|
this.name = "AuthError";
|
|
70
71
|
}
|
|
71
72
|
};
|
|
@@ -84,7 +85,7 @@ var ConfigError = class extends AiCliError {
|
|
|
84
85
|
var ProviderNotFoundError = class extends AiCliError {
|
|
85
86
|
constructor(providerId) {
|
|
86
87
|
super(
|
|
87
|
-
`Provider '${providerId}' is not configured. Run:
|
|
88
|
+
`Provider '${providerId}' is not configured. Run: aicli config`
|
|
88
89
|
);
|
|
89
90
|
this.name = "ProviderNotFoundError";
|
|
90
91
|
}
|
|
@@ -95,6 +96,7 @@ var ToolError = class extends AiCliError {
|
|
|
95
96
|
this.toolName = toolName;
|
|
96
97
|
this.name = "ToolError";
|
|
97
98
|
}
|
|
99
|
+
toolName;
|
|
98
100
|
};
|
|
99
101
|
var NetworkError = class extends AiCliError {
|
|
100
102
|
constructor(message, statusCode, cause) {
|
|
@@ -102,6 +104,7 @@ var NetworkError = class extends AiCliError {
|
|
|
102
104
|
this.statusCode = statusCode;
|
|
103
105
|
this.name = "NetworkError";
|
|
104
106
|
}
|
|
107
|
+
statusCode;
|
|
105
108
|
};
|
|
106
109
|
|
|
107
110
|
export {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
CI_COMMENT_MARKER,
|
|
4
|
+
countSeverity,
|
|
5
|
+
runCi
|
|
6
|
+
} from "./chunk-GOGDUA4G.js";
|
|
7
|
+
import "./chunk-HPPK4IA3.js";
|
|
8
|
+
import "./chunk-HLWUDRBO.js";
|
|
9
|
+
import "./chunk-MJ6JLSPR.js";
|
|
10
|
+
import "./chunk-DFV7F6S7.js";
|
|
11
|
+
import "./chunk-HOS7CGBI.js";
|
|
12
|
+
import "./chunk-TU3L3PW7.js";
|
|
13
|
+
import "./chunk-5DLLJ67Q.js";
|
|
14
|
+
import "./chunk-IW3Q7AE5.js";
|
|
15
|
+
export {
|
|
16
|
+
CI_COMMENT_MARKER,
|
|
17
|
+
countSeverity,
|
|
18
|
+
runCi
|
|
19
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
formatDoctorReport,
|
|
4
|
+
runDoctorCli
|
|
5
|
+
} from "./chunk-ELYDRIKV.js";
|
|
6
|
+
import "./chunk-MJ6JLSPR.js";
|
|
7
|
+
import "./chunk-DFV7F6S7.js";
|
|
8
|
+
import "./chunk-X2ZXQMN2.js";
|
|
9
|
+
import "./chunk-HOS7CGBI.js";
|
|
10
|
+
import "./chunk-TU3L3PW7.js";
|
|
11
|
+
import "./chunk-HOSJZMQS.js";
|
|
12
|
+
import "./chunk-5DLLJ67Q.js";
|
|
13
|
+
import "./chunk-IW3Q7AE5.js";
|
|
14
|
+
export {
|
|
15
|
+
formatDoctorReport,
|
|
16
|
+
runDoctorCli
|
|
17
|
+
};
|