jinzd-ai-cli 0.4.329 → 0.4.331
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 +4 -4
- package/README.zh-CN.md +4 -4
- package/dist/{batch-NNYRIS4U.js → batch-OOHC5POO.js} +2 -2
- package/dist/{chunk-BRZZ3QAI.js → chunk-2BAFLDDL.js} +44 -7
- package/dist/{chunk-XF2S7LNM.js → chunk-56ME7PB2.js} +1 -1
- package/dist/{chunk-DRNRQ6SD.js → chunk-6BGW25LG.js} +1 -1
- package/dist/{chunk-E2W2MI6H.js → chunk-C6GA7H5D.js} +1 -72
- package/dist/{chunk-2CNJ25U7.js → chunk-CM5C7ZSM.js} +9 -3
- package/dist/{chunk-IUC3DRGB.js → chunk-DTVN2LDU.js} +1 -1
- package/dist/{chunk-ABIR2TGW.js → chunk-EWARNWJ4.js} +4 -4
- package/dist/{chunk-YDH5ZWOQ.js → chunk-IJNDIOOQ.js} +1 -1
- package/dist/{chunk-LSSOPLKJ.js → chunk-L3FDFFD2.js} +9 -9
- package/dist/{chunk-TYQODNI7.js → chunk-MJSK6ZYR.js} +4 -4
- package/dist/{chunk-C2Z77RTU.js → chunk-MN25ELTF.js} +15 -4
- package/dist/{chunk-72AR23R2.js → chunk-NOLK5C4U.js} +54 -2
- package/dist/{chunk-SS3PG7LP.js → chunk-Q26V2PNA.js} +1 -1
- package/dist/{chunk-I5KLH7TL.js → chunk-QFF2PTI3.js} +53 -43
- package/dist/{chunk-LKSMXCFL.js → chunk-R3XIU7NS.js} +1 -1
- package/dist/{chunk-MPCQG7LV.js → chunk-RZDRBFAB.js} +9 -7
- package/dist/{chunk-LRRBYGHE.js → chunk-TF2FNRDZ.js} +1 -1
- package/dist/chunk-W4P2KJZN.js +75 -0
- package/dist/{chunk-6UDKGZ3D.js → chunk-YCDF6FNR.js} +1 -1
- package/dist/{ci-ODKA57IG.js → ci-HNYUXJUE.js} +7 -6
- package/dist/{ci-format-QDC4XKYZ.js → ci-format-ZLBEAU7Z.js} +2 -2
- package/dist/{constants-MG7EGG5J.js → constants-4EH6Y6VI.js} +1 -1
- package/dist/{constants-BYWEJLAI.js → constants-JM6MK5SS.js} +1 -1
- package/dist/{doctor-cli-LYZSHYR6.js → doctor-cli-VCNERMX5.js} +7 -6
- package/dist/electron-server.js +292 -178
- package/dist/{hub-GRHYVLGV.js → hub-3OXLWTEP.js} +8 -18
- package/dist/{hub-server-JLC7CNP7.js → hub-server-LJWXNEWK.js} +2 -1
- package/dist/index.js +23 -21
- package/dist/{persistent-memory-OCDFR4BH.js → persistent-memory-LMVWIHMX.js} +2 -2
- package/dist/{persistent-memory-O6GWHGJH.js → persistent-memory-PAS7NAPQ.js} +2 -2
- package/dist/{pr-LDUIDU27.js → pr-IMR62OHN.js} +7 -6
- package/dist/{run-tests-YTRU22LY.js → run-tests-2TVEWCQI.js} +2 -2
- package/dist/{run-tests-LTYJACRX.js → run-tests-MQVGE6FK.js} +2 -2
- package/dist/{server-ZTFB3KMS.js → server-55X6MCGX.js} +7 -6
- package/dist/{server-2NZN22XP.js → server-6MS2NGEJ.js} +30 -20
- package/dist/{task-orchestrator-URFLWSPI.js → task-orchestrator-KIDJB7NP.js} +9 -7
- package/dist/{usage-IP6G4Q2K.js → usage-X2CQYAUA.js} +3 -3
- package/dist/web/client/app.js +19 -0
- package/dist/web/client/app.js.br +0 -0
- package/dist/web/client/app.js.gz +0 -0
- package/package.json +1 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
detectsHallucinatedFileOp,
|
|
4
|
-
parseToolCallArguments,
|
|
5
3
|
schemaToJsonSchema
|
|
6
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-W4P2KJZN.js";
|
|
5
|
+
import {
|
|
6
|
+
detectsHallucinatedFileOp,
|
|
7
|
+
parseToolCallArguments
|
|
8
|
+
} from "./chunk-C6GA7H5D.js";
|
|
7
9
|
import {
|
|
8
10
|
AuthError,
|
|
9
11
|
ProviderError,
|
|
@@ -15,7 +17,7 @@ import {
|
|
|
15
17
|
} from "./chunk-BMLQPSHP.js";
|
|
16
18
|
import {
|
|
17
19
|
DEFAULT_MAX_TOKENS
|
|
18
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-YCDF6FNR.js";
|
|
19
21
|
|
|
20
22
|
// src/providers/claude.ts
|
|
21
23
|
import Anthropic from "@anthropic-ai/sdk";
|
|
@@ -1743,7 +1745,9 @@ var DeepSeekProvider = class extends OpenAICompatibleProvider {
|
|
|
1743
1745
|
},
|
|
1744
1746
|
{
|
|
1745
1747
|
id: "deepseek-v4-pro",
|
|
1746
|
-
|
|
1748
|
+
// 2026-09-11 官方撤回了「9-14 起路由到 Flash」,Pro 照常服务、按 Pro 价计费(见 pricing.ts)。
|
|
1749
|
+
// 价格约为 Flash 的 4 倍且不收图片,但 Flash 替代不了它的能力档,故保留。
|
|
1750
|
+
displayName: "DeepSeek V4 Pro (0813, text-only)",
|
|
1747
1751
|
contextWindow: 1048576,
|
|
1748
1752
|
supportsStreaming: true,
|
|
1749
1753
|
supportsThinking: true
|
|
@@ -1802,20 +1806,24 @@ var DeepSeekProvider = class extends OpenAICompatibleProvider {
|
|
|
1802
1806
|
var ZHIPU_CONFIG = {
|
|
1803
1807
|
id: "zhipu",
|
|
1804
1808
|
displayName: "Zhipu (GLM)",
|
|
1805
|
-
defaultModel: "glm-
|
|
1809
|
+
defaultModel: "glm-5.3-flash",
|
|
1806
1810
|
apiKeyEnvVar: "AICLI_API_KEY_ZHIPU",
|
|
1807
1811
|
baseUrl: "https://open.bigmodel.cn/api/paas/v4",
|
|
1808
1812
|
defaultTimeout: 3e5,
|
|
1809
1813
|
models: [
|
|
1810
1814
|
{ id: "glm-5.3", displayName: "GLM-5.3 (2026-08 Flagship, 1M, Coding/Security, \u59CB\u7EC8\u601D\u8003)", contextWindow: 1048576, supportsStreaming: true, supportsThinking: true },
|
|
1815
|
+
// GLM-5.3-FlashX(2026-10):Flash 与 5.3 之间的一档,¥2/¥7、缓存命中 ¥0.57(官方定价页)。
|
|
1816
|
+
// 2026-10-18 实测:同样始终思考(`disabled` → 400/1210),`low` 档 200,base64 图片可识别。
|
|
1817
|
+
{ id: "glm-5.3-flashx", displayName: "GLM-5.3 FlashX (\u539F\u751F\u591A\u6A21\u6001, 1M, \u4EF7\u683C\u7EA6\u4E3A 5.3 \u7684 1/4, \u59CB\u7EC8\u601D\u8003)", contextWindow: 1048576, supportsStreaming: true, supportsThinking: true },
|
|
1811
1818
|
{ id: "glm-5.3-flash", displayName: "GLM-5.3 Flash (\u539F\u751F\u591A\u6A21\u6001, 1M, \u8F93\u5165\u7EA6\u4E3A 5.3 \u7684 1/10, \u59CB\u7EC8\u601D\u8003)", contextWindow: 1048576, supportsStreaming: true, supportsThinking: true },
|
|
1812
|
-
|
|
1813
|
-
{ id: "glm-
|
|
1814
|
-
// 2026-10-
|
|
1815
|
-
//
|
|
1816
|
-
//
|
|
1817
|
-
//
|
|
1818
|
-
|
|
1819
|
+
// 免费(输入/输出/缓存全免,官方定价页「更多文本模型」)。2026-10-18 实测 200,但慢(一句 ok 约 15s)。
|
|
1820
|
+
{ id: "glm-4.7-flash", displayName: "GLM-4.7 Flash (\u514D\u8D39, 200K)", contextWindow: 2e5, supportsStreaming: true }
|
|
1821
|
+
// 2026-10-18 按「老模型没有价格优势就下架」清理(端点仍可用,`/model` 照收,pricing.ts 保留费率供历史回算):
|
|
1822
|
+
// - glm-5.2:与 glm-5.3 同价(¥8/¥28/缓存 ¥2),已被取代
|
|
1823
|
+
// - glm-5v-turbo:¥5/¥22 起,比同样原生多模态的 glm-5.3-flash(¥0.8/¥2.8)贵 6–8 倍
|
|
1824
|
+
// - glm-4.6:已不在官方定价页上,且旧价高于 glm-5.3-flash
|
|
1825
|
+
// 更早的 2026-10-07 清理:glm-5.1-reasoning / glm-5.1-air 官方从未存在(取自第三方标注,同 v0.4.198
|
|
1826
|
+
// 的 `glm-5.2[1m]`),glm-5 / glm-5.1 已被取代。
|
|
1819
1827
|
]
|
|
1820
1828
|
};
|
|
1821
1829
|
var REASONING_EFFORT_MODELS = /^glm-5/i;
|
|
@@ -1881,7 +1889,10 @@ var KimiProvider = class _KimiProvider extends OpenAICompatibleProvider {
|
|
|
1881
1889
|
*/
|
|
1882
1890
|
static TEMP_1_MODELS = /* @__PURE__ */ new Set([
|
|
1883
1891
|
"kimi-k3",
|
|
1892
|
+
"kimi-k2.7-code",
|
|
1893
|
+
"kimi-k2.7-code-highspeed",
|
|
1884
1894
|
"kimi-k2.6",
|
|
1895
|
+
// 已 404 的旧 code 仍留在这里:config 自愈迁移之外的显式 `/model kimi-k2.5` 不该先撞 temperature 400
|
|
1885
1896
|
"kimi-k2.5",
|
|
1886
1897
|
"kimi-k2-thinking",
|
|
1887
1898
|
"kimi-k2-thinking-turbo"
|
|
@@ -1902,7 +1913,7 @@ var KimiProvider = class _KimiProvider extends OpenAICompatibleProvider {
|
|
|
1902
1913
|
info = {
|
|
1903
1914
|
id: "kimi",
|
|
1904
1915
|
displayName: "Kimi (Moonshot AI)",
|
|
1905
|
-
defaultModel: "kimi-k2.
|
|
1916
|
+
defaultModel: "kimi-k2.7-code",
|
|
1906
1917
|
apiKeyEnvVar: "AICLI_API_KEY_KIMI",
|
|
1907
1918
|
requiresApiKey: true,
|
|
1908
1919
|
baseUrl: this.defaultBaseUrl,
|
|
@@ -1912,39 +1923,33 @@ var KimiProvider = class _KimiProvider extends OpenAICompatibleProvider {
|
|
|
1912
1923
|
// - contextWindow 1M(1048576);code 就是 `kimi-k3`(UI 名 "K3 · Max" ≠ API code)
|
|
1913
1924
|
// - temperature 固定 1.0(已并入 TEMP_1_MODELS)
|
|
1914
1925
|
// - vision 走 base64 / ms://file-id(不收公网 URL)——本版未接图片输入路径,仅文本/工具
|
|
1915
|
-
//
|
|
1926
|
+
// 默认用 kimi-k2.7-code(K3 输出 $15/MTok,约为它的 4 倍,按需 /model kimi-k3)。
|
|
1916
1927
|
{
|
|
1917
1928
|
id: "kimi-k3",
|
|
1918
1929
|
displayName: "Kimi K3",
|
|
1919
1930
|
contextWindow: 1048576,
|
|
1920
1931
|
supportsStreaming: true
|
|
1921
1932
|
},
|
|
1922
|
-
// Kimi K2.
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
supportsStreaming: true
|
|
1928
|
-
},
|
|
1929
|
-
{
|
|
1930
|
-
id: "kimi-k2.5",
|
|
1931
|
-
displayName: "Kimi K2.5",
|
|
1932
|
-
contextWindow: 262144,
|
|
1933
|
-
supportsStreaming: true
|
|
1934
|
-
},
|
|
1935
|
-
// Kimi K2 Thinking 系列(支持多步推理 + 工具调用)
|
|
1933
|
+
// Kimi K2.7 Code(官方 platform.kimi.com/docs/guide/kimi-k2-7-code-quickstart,2026-10-18 核对):
|
|
1934
|
+
// - 256K 上下文;虽名为 Coding 模型,官方写明也支持对话与 Agent 任务
|
|
1935
|
+
// - 思考默认开启且**关不掉**(关闭报错)——本 provider 不发 thinking 字段,正好不踩
|
|
1936
|
+
// - temperature 固定 1.0(已并入 TEMP_1_MODELS);tool_choice 只收 auto / none
|
|
1937
|
+
// - 价格与 K2.6 相同($0.95/$4.00),各项基准提升 10–30%,故取代 K2.6 成为默认
|
|
1936
1938
|
{
|
|
1937
|
-
id: "kimi-k2-
|
|
1938
|
-
displayName: "Kimi K2
|
|
1939
|
+
id: "kimi-k2.7-code",
|
|
1940
|
+
displayName: "Kimi K2.7 Code",
|
|
1939
1941
|
contextWindow: 262144,
|
|
1940
1942
|
supportsStreaming: true
|
|
1941
1943
|
},
|
|
1944
|
+
// 同一模型的高速版:输出约 5–6 倍速,价格翻倍。
|
|
1942
1945
|
{
|
|
1943
|
-
id: "kimi-k2-
|
|
1944
|
-
displayName: "Kimi K2
|
|
1946
|
+
id: "kimi-k2.7-code-highspeed",
|
|
1947
|
+
displayName: "Kimi K2.7 Code Highspeed (2x price, ~5x speed)",
|
|
1945
1948
|
contextWindow: 262144,
|
|
1946
1949
|
supportsStreaming: true
|
|
1947
1950
|
}
|
|
1951
|
+
// 2026-10-18 下架:kimi-k2.6 与 K2.7 Code 同价、已被取代(端点仍可用,`/model` 照收);
|
|
1952
|
+
// kimi-k2.5 / kimi-k2-thinking / kimi-k2-thinking-turbo 端点已 404,由 config 自愈迁移到 kimi-k2.7-code。
|
|
1948
1953
|
]
|
|
1949
1954
|
};
|
|
1950
1955
|
/**
|
|
@@ -2056,11 +2061,10 @@ var MINIMAX_CONFIG = {
|
|
|
2056
2061
|
apiKeyEnvVar: "AICLI_API_KEY_MINIMAX",
|
|
2057
2062
|
baseUrl: "https://api.minimaxi.com/v1",
|
|
2058
2063
|
models: [
|
|
2059
|
-
{ id: "MiniMax-M3", displayName: "MiniMax M3\uFF08\u65D7\u8230\uFF0C1M \u4E0A\u4E0B\u6587\uFF09", contextWindow: 1e6, supportsStreaming: true }
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
{ id: "MiniMax-M2.5-highspeed", displayName: "MiniMax M2.5 Highspeed", contextWindow: 1e6, supportsStreaming: true }
|
|
2064
|
+
{ id: "MiniMax-M3", displayName: "MiniMax M3\uFF08\u65D7\u8230\uFF0C1M \u4E0A\u4E0B\u6587\uFF09", contextWindow: 1e6, supportsStreaming: true }
|
|
2065
|
+
// 2026-10-18 按「老模型没有价格优势就下架」清理(官方定价页 platform.minimax.cn/docs/guides/pricing):
|
|
2066
|
+
// M3「永久五折」后 ¥2.1/¥8.4,与 M2.7 同价、比 M2.x highspeed 便宜一半;M2.5 / M2.1 / M2 官方已归入
|
|
2067
|
+
// 「历史模型」。端点仍可用,`/model` 照收,pricing.ts 保留费率供历史回算。
|
|
2064
2068
|
]
|
|
2065
2069
|
};
|
|
2066
2070
|
var MiniMaxProvider = createStaticProviderClass(MINIMAX_CONFIG);
|
|
@@ -2069,14 +2073,20 @@ var MiniMaxProvider = createStaticProviderClass(MINIMAX_CONFIG);
|
|
|
2069
2073
|
var QWEN_CONFIG = {
|
|
2070
2074
|
id: "qwen",
|
|
2071
2075
|
displayName: "Qwen (Alibaba Cloud)",
|
|
2072
|
-
defaultModel: "
|
|
2076
|
+
defaultModel: "qwen3.8-flash",
|
|
2073
2077
|
apiKeyEnvVar: "AICLI_API_KEY_QWEN",
|
|
2074
2078
|
baseUrl: "https://dashscope.aliyuncs.com/compatible-mode/v1",
|
|
2079
|
+
// 2026-10-18 按百炼官方文档更新(help.aliyun.com/zh/model-studio/models、/model-pricing、/deep-thinking)。
|
|
2080
|
+
// **未经真实端点实测**(本机无 Qwen key)。三款 qwen3.x 默认开启思考、支持非流式调用、纯文本输入;
|
|
2081
|
+
// 思考与非思考输出同价。上下文按官方价格阶梯的上限 1M 记。
|
|
2075
2082
|
models: [
|
|
2076
|
-
{ id: "
|
|
2077
|
-
{ id: "
|
|
2078
|
-
{ id: "
|
|
2079
|
-
|
|
2083
|
+
{ id: "qwen3.8-max", displayName: "Qwen3.8 Max\uFF08\u65D7\u8230\uFF0C1M\uFF0C\xA512/\xA536\uFF09", contextWindow: 1e6, supportsStreaming: true },
|
|
2084
|
+
{ id: "qwen3.7-plus", displayName: "Qwen3.7 Plus\uFF081M\uFF0C\u2264256K \xA52/\xA58\uFF09", contextWindow: 1e6, supportsStreaming: true },
|
|
2085
|
+
{ id: "qwen3.8-flash", displayName: "Qwen3.8 Flash\uFF081M\uFF0C\xA50.8/\xA52.7\uFF09", contextWindow: 1e6, supportsStreaming: true },
|
|
2086
|
+
// 老模型里唯一有价格优势的:≤128K ¥0.15/¥1.5,最便宜。默认不开思考。
|
|
2087
|
+
{ id: "qwen-flash", displayName: "Qwen Flash\uFF08\u6700\u4FBF\u5B9C\uFF0C\u2264128K \xA50.15/\xA51.5\uFF09", contextWindow: 1e6, supportsStreaming: true }
|
|
2088
|
+
// 下架(端点若仍可用,`/model` 照收):qwen-max ¥2.4/¥9.6 比 qwen3.7-plus 还贵;qwen-plus 价格不如
|
|
2089
|
+
// qwen-flash、能力不如 qwen3.8-flash;qwen-turbo / qwen-coder-plus 已不在官方价格页上。
|
|
2080
2090
|
]
|
|
2081
2091
|
};
|
|
2082
2092
|
var QwenProvider = createStaticProviderClass(QWEN_CONFIG);
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
MEMORY_FILE_NAME,
|
|
13
13
|
MEMORY_MAX_CHARS,
|
|
14
14
|
MEMORY_STORE_FILE_NAME
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-DTVN2LDU.js";
|
|
16
16
|
|
|
17
17
|
// src/memory/persistent-memory.ts
|
|
18
18
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, statSync } from "fs";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
searchPersistentMemories,
|
|
12
12
|
touchMemoryReferences,
|
|
13
13
|
updateMemoryEntry
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-56ME7PB2.js";
|
|
15
15
|
import {
|
|
16
16
|
indexProject
|
|
17
17
|
} from "./chunk-RWRZVQCB.js";
|
|
@@ -30,13 +30,15 @@ import {
|
|
|
30
30
|
runHook,
|
|
31
31
|
runLifecycleHooks,
|
|
32
32
|
runTool
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-Q26V2PNA.js";
|
|
34
34
|
import {
|
|
35
|
-
buildTruncatedArgumentsError,
|
|
36
35
|
getDangerLevel,
|
|
37
|
-
isFileWriteTool
|
|
36
|
+
isFileWriteTool
|
|
37
|
+
} from "./chunk-W4P2KJZN.js";
|
|
38
|
+
import {
|
|
39
|
+
buildTruncatedArgumentsError,
|
|
38
40
|
runLeanAgentLoop
|
|
39
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-C6GA7H5D.js";
|
|
40
42
|
import {
|
|
41
43
|
EnvLoader,
|
|
42
44
|
NetworkError,
|
|
@@ -64,7 +66,7 @@ import {
|
|
|
64
66
|
recoverGbkMojibake,
|
|
65
67
|
runTestsTool,
|
|
66
68
|
shellInvocation
|
|
67
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-6BGW25LG.js";
|
|
68
70
|
import {
|
|
69
71
|
CONFIG_DIR_NAME,
|
|
70
72
|
DEFAULT_MAX_TOOL_OUTPUT_CHARS_CAP,
|
|
@@ -73,7 +75,7 @@ import {
|
|
|
73
75
|
SUBAGENT_ALLOWED_TOOLS,
|
|
74
76
|
SUBAGENT_DEFAULT_MAX_ROUNDS,
|
|
75
77
|
SUBAGENT_MAX_ROUNDS_LIMIT
|
|
76
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-YCDF6FNR.js";
|
|
77
79
|
import {
|
|
78
80
|
getCurrentSessionKey,
|
|
79
81
|
getExecutionConfigDir,
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/tools/types.ts
|
|
4
|
+
function isFileWriteTool(name) {
|
|
5
|
+
return name === "write_file" || name === "edit_file" || name === "notebook_edit";
|
|
6
|
+
}
|
|
7
|
+
function getDangerLevel(toolName, args) {
|
|
8
|
+
if (toolName.startsWith("mcp__")) {
|
|
9
|
+
const rawName = toolName.split("__").pop() ?? "";
|
|
10
|
+
const normalized = rawName.toLowerCase().replace(/[^a-z0-9]+/g, "_");
|
|
11
|
+
if (/^(read|get|list|search|find|query|fetch|status|describe|inspect|show|lookup)(?:_|$)/.test(normalized)) {
|
|
12
|
+
return "safe";
|
|
13
|
+
}
|
|
14
|
+
return "write";
|
|
15
|
+
}
|
|
16
|
+
if (toolName === "bash") {
|
|
17
|
+
const cmd = String(args["command"] ?? "");
|
|
18
|
+
if (/\bgit\s+(?:clean\b|reset\s+--hard\b|push\b[^\n]*(?:--force\b|\s-f\b))/i.test(cmd)) return "destructive";
|
|
19
|
+
if (/\brm\s+[^\n]*(?:-\w*[rRfF]\w*|--recursive|--force)\b/.test(cmd)) return "destructive";
|
|
20
|
+
if (/\brm\s+\S/.test(cmd)) return "destructive";
|
|
21
|
+
if (/\brmdir\b|\bmkfs\b|\bdd\s+if=|\bshred\b|\bfdisk\b|\bparted\b/.test(cmd)) return "destructive";
|
|
22
|
+
if (/(?:^|[;&|(\n]\s*)format(?:\.com)?\s+[A-Za-z]:/im.test(cmd)) return "destructive";
|
|
23
|
+
if (/\bshutdown\b|\breboot\b|\bhalt\b|\bpoweroff\b/.test(cmd)) return "destructive";
|
|
24
|
+
if (/\bkill\s+-9\b|\bkillall\b/.test(cmd)) return "destructive";
|
|
25
|
+
if (/\bRemove-Item\b|\bri\s+\S/i.test(cmd)) return "destructive";
|
|
26
|
+
if (/\brd\s+\/s\b|\brmdir\s+\/s\b/i.test(cmd)) return "destructive";
|
|
27
|
+
if (/\bdel\s+\S/.test(cmd)) return "destructive";
|
|
28
|
+
if (/\bShutdown(-Computer)?\b|\bRestart-Computer\b/i.test(cmd)) return "destructive";
|
|
29
|
+
if (/(?:^|[\s|;&])>>?\s*\S/.test(cmd)) return "write";
|
|
30
|
+
if (/\btee\b|\bcp\b|\bmv\b|\bln\s+-s/.test(cmd)) return "write";
|
|
31
|
+
if (/\bchmod\b|\bchown\b/.test(cmd)) return "write";
|
|
32
|
+
if (/\bSet-Content\b|\bOut-File\b|\bAdd-Content\b|\bCopy-Item\b|\bMove-Item\b|\bSet-ItemProperty\b|\bNew-ItemProperty\b/i.test(cmd)) return "write";
|
|
33
|
+
if (/\b(python3?|node|deno|bun|perl|ruby|php|bash|sh|zsh|pwsh|powershell)(\.exe)?\b[^\n]*?\s-(?:Command|EncodedCommand|c|e|p|r)\b/i.test(cmd)) return "write";
|
|
34
|
+
if (/\bcmd(\.exe)?\s+\/[ck]\b/i.test(cmd)) return "write";
|
|
35
|
+
if (!/[;&|`$<>\n\r(){}]/.test(cmd) && (/^(?:pwd|ls|cat|head|tail|wc|Get-ChildItem|Get-Location|Get-Content)(?:\s+[\w ./\\:*?=,@'"-]+)?\s*$/i.test(cmd.trim()) || /^echo(?:\s+[\w .,'"-]+)?\s*$/.test(cmd.trim()) || /^(?:node|python3?)\s+(?:-v|--version)\s*$/.test(cmd.trim()) || /^git\s+(?:status|log)(?:\s+(?:--short|--porcelain|--oneline|-\d+))*\s*$/.test(cmd.trim()))) return "safe";
|
|
36
|
+
return "write";
|
|
37
|
+
}
|
|
38
|
+
if (toolName === "run_tests") return "write";
|
|
39
|
+
if (toolName === "write_file") return "write";
|
|
40
|
+
if (toolName === "edit_file") return "write";
|
|
41
|
+
if (toolName === "save_last_response") return "write";
|
|
42
|
+
if (toolName === "run_interactive") {
|
|
43
|
+
const exe = String(args["executable"] ?? "").toLowerCase();
|
|
44
|
+
if (/\b(rm|rmdir|del|format|mkfs|Remove-Item)\b/i.test(exe)) return "destructive";
|
|
45
|
+
if (/\b(bash|sh|zsh|cmd|powershell|pwsh|python|node|ruby|perl)\b/i.test(exe)) return "write";
|
|
46
|
+
return "write";
|
|
47
|
+
}
|
|
48
|
+
if (toolName === "task_create" || toolName === "task_stop") return "write";
|
|
49
|
+
if (toolName === "task_list") return "safe";
|
|
50
|
+
if (toolName === "git_commit") return "write";
|
|
51
|
+
if (toolName === "git_status" || toolName === "git_diff" || toolName === "git_log") return "safe";
|
|
52
|
+
if (toolName === "notebook_edit") return "write";
|
|
53
|
+
if (toolName === "read_file" || toolName === "list_dir" || toolName === "grep_files" || toolName === "glob_files" || toolName === "web_fetch" || toolName === "save_memory" || toolName === "ask_user" || toolName === "write_todos" || toolName === "google_search" || toolName === "spawn_agent") return "safe";
|
|
54
|
+
return "write";
|
|
55
|
+
}
|
|
56
|
+
function schemaToJsonSchema(schema) {
|
|
57
|
+
const result = {
|
|
58
|
+
type: schema.type,
|
|
59
|
+
description: schema.description
|
|
60
|
+
};
|
|
61
|
+
if (schema.enum) result["enum"] = schema.enum;
|
|
62
|
+
if (schema.items) result["items"] = schemaToJsonSchema(schema.items);
|
|
63
|
+
if (schema.properties) {
|
|
64
|
+
result["properties"] = Object.fromEntries(
|
|
65
|
+
Object.entries(schema.properties).map(([k, v]) => [k, schemaToJsonSchema(v)])
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export {
|
|
72
|
+
isFileWriteTool,
|
|
73
|
+
getDangerLevel,
|
|
74
|
+
schemaToJsonSchema
|
|
75
|
+
};
|
|
@@ -3,16 +3,17 @@ import {
|
|
|
3
3
|
CI_COMMENT_MARKER,
|
|
4
4
|
countSeverity,
|
|
5
5
|
runCi
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-MJSK6ZYR.js";
|
|
7
|
+
import "./chunk-IJNDIOOQ.js";
|
|
8
8
|
import "./chunk-HLWUDRBO.js";
|
|
9
9
|
import "./chunk-6YZEZFX5.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-QFF2PTI3.js";
|
|
11
|
+
import "./chunk-CM5C7ZSM.js";
|
|
12
|
+
import "./chunk-W4P2KJZN.js";
|
|
13
|
+
import "./chunk-C6GA7H5D.js";
|
|
13
14
|
import "./chunk-TU3L3PW7.js";
|
|
14
15
|
import "./chunk-BMLQPSHP.js";
|
|
15
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-YCDF6FNR.js";
|
|
16
17
|
export {
|
|
17
18
|
CI_COMMENT_MARKER,
|
|
18
19
|
countSeverity,
|
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
import {
|
|
3
3
|
formatDoctorReport,
|
|
4
4
|
runDoctorCli
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-EWARNWJ4.js";
|
|
6
|
+
import "./chunk-Q26V2PNA.js";
|
|
7
7
|
import "./chunk-RS7SKYTS.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-QFF2PTI3.js";
|
|
9
|
+
import "./chunk-CM5C7ZSM.js";
|
|
10
|
+
import "./chunk-W4P2KJZN.js";
|
|
11
|
+
import "./chunk-C6GA7H5D.js";
|
|
11
12
|
import "./chunk-TU3L3PW7.js";
|
|
12
13
|
import "./chunk-HOSJZMQS.js";
|
|
13
14
|
import "./chunk-BMLQPSHP.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-YCDF6FNR.js";
|
|
15
16
|
export {
|
|
16
17
|
formatDoctorReport,
|
|
17
18
|
runDoctorCli
|