jinzd-ai-cli 0.4.333 → 0.4.337
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-TYKULVIK.js → batch-GUQLUOXL.js} +2 -2
- package/dist/{chunk-NRDCQGAN.js → chunk-56IOLQ5E.js} +1 -1
- package/dist/{chunk-ZQFOY5FB.js → chunk-5WUOBFYG.js} +23 -23
- package/dist/{chunk-W4P2KJZN.js → chunk-6SFS6IJH.js} +67 -0
- package/dist/{chunk-JTXHWIBO.js → chunk-7TU4KHMK.js} +1 -1
- package/dist/{chunk-A4KKNBG3.js → chunk-DQBWJG32.js} +422 -236
- package/dist/{chunk-K4AYNZF7.js → chunk-EGRKGP4P.js} +1 -1
- package/dist/{chunk-H4UIWMA5.js → chunk-HXENKVWP.js} +4 -4
- package/dist/{chunk-4TKEA7RE.js → chunk-MAUNCANT.js} +1 -1
- package/dist/{chunk-YIEOU7NG.js → chunk-PWXVC6UZ.js} +5 -5
- package/dist/{chunk-6WQCZTAJ.js → chunk-RVB4GCSQ.js} +4 -4
- package/dist/{chunk-5MUAJ742.js → chunk-SSQARJMS.js} +2 -2
- package/dist/{chunk-3JGBKYCN.js → chunk-VHLZ2ZUQ.js} +7 -7
- package/dist/{chunk-YUQYVOY2.js → chunk-WL4NXDYT.js} +1 -1
- package/dist/{chunk-4RVLGIK3.js → chunk-XF2F2V5Y.js} +1 -1
- package/dist/{chunk-ZQ5HR7XN.js → chunk-YYO6TMOA.js} +1 -1
- package/dist/{ci-MYKIATCI.js → ci-FSMBWLMM.js} +6 -6
- package/dist/{ci-format-QOXT6E3A.js → ci-format-BONCHM6H.js} +2 -2
- package/dist/{constants-C55HE2E5.js → constants-ARJE6QPN.js} +1 -1
- package/dist/{constants-WK2I2UCZ.js → constants-RMAQCGVM.js} +1 -1
- package/dist/{doctor-cli-63GBR2D3.js → doctor-cli-T7D4DPWU.js} +6 -6
- package/dist/electron-server.js +519 -266
- package/dist/{hub-J4FZ4GXX.js → hub-KCYDY3U6.js} +1 -1
- package/dist/index.js +19 -19
- package/dist/{persistent-memory-AEIRTKWX.js → persistent-memory-3RG5Z6WK.js} +2 -2
- package/dist/{persistent-memory-6JN7AWD6.js → persistent-memory-ZO6NGZIV.js} +2 -2
- package/dist/{pr-C53TJRXV.js → pr-W2PPGBYA.js} +6 -6
- package/dist/{run-tests-BKFV3HUZ.js → run-tests-72HGJXD4.js} +2 -2
- package/dist/{run-tests-CZLZW5RL.js → run-tests-BWJEL7PA.js} +2 -2
- package/dist/{server-2GYX4CJC.js → server-WTLNIO23.js} +6 -6
- package/dist/{server-2UB74CEK.js → server-Y3N6RMIN.js} +15 -15
- package/dist/{task-orchestrator-EVONAO6V.js → task-orchestrator-QYCG7NVG.js} +6 -6
- package/dist/{usage-6Y7K2GNN.js → usage-5L4ZQENO.js} +2 -2
- package/dist/web/client/app.js +8 -4
- package/dist/web/client/app.js.br +0 -0
- package/dist/web/client/app.js.gz +0 -0
- package/dist/web/client/vendor/purify.es.mjs +272 -196
- package/dist/web/client/vendor/purify.es.mjs.br +0 -0
- package/dist/web/client/vendor/purify.es.mjs.gz +0 -0
- package/package.json +6 -3
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
} from "./chunk-RS7SKYTS.js";
|
|
5
5
|
import {
|
|
6
6
|
ConfigManager
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-5WUOBFYG.js";
|
|
8
8
|
import "./chunk-TU3L3PW7.js";
|
|
9
9
|
import {
|
|
10
10
|
atomicWriteFileSync
|
|
11
11
|
} from "./chunk-BMLQPSHP.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-7TU4KHMK.js";
|
|
13
13
|
|
|
14
14
|
// src/cli/batch.ts
|
|
15
15
|
import Anthropic from "@anthropic-ai/sdk";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
CONFIG_FILE_NAME,
|
|
12
12
|
HISTORY_DIR_NAME,
|
|
13
13
|
PLUGINS_DIR_NAME
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-7TU4KHMK.js";
|
|
15
15
|
|
|
16
16
|
// src/config/config-manager.ts
|
|
17
17
|
import { readFileSync, existsSync, mkdirSync } from "fs";
|
|
@@ -66,24 +66,24 @@ var UserProfileSchema = z.object({
|
|
|
66
66
|
locale: z.string().max(20).optional(),
|
|
67
67
|
/** 自定义人设补充(自由格式,直接注入 system prompt) */
|
|
68
68
|
extra: z.string().max(5e3).optional()
|
|
69
|
-
}).
|
|
69
|
+
}).prefault({});
|
|
70
70
|
var ConfigSchema = z.object({
|
|
71
71
|
version: z.string().default("1.0.0"),
|
|
72
72
|
// 用户身份档案 — 跨 Provider 的 "灵魂"
|
|
73
73
|
userProfile: UserProfileSchema,
|
|
74
74
|
defaultProvider: z.string().default("claude"),
|
|
75
75
|
// 每个 provider 的默认模型(key 为 provider ID)
|
|
76
|
-
defaultModels: z.record(z.string()).default({}),
|
|
76
|
+
defaultModels: z.record(z.string(), z.string()).default({}),
|
|
77
77
|
// API Keys:放宽为任意 record,支持自定义 provider ID
|
|
78
|
-
apiKeys: z.record(z.string()).default({}),
|
|
79
|
-
customBaseUrls: z.record(z.string()).default({}),
|
|
78
|
+
apiKeys: z.record(z.string(), z.string()).default({}),
|
|
79
|
+
customBaseUrls: z.record(z.string(), z.string()).default({}),
|
|
80
80
|
// Per-provider timeout in ms (e.g. { deepseek: 60000 })
|
|
81
81
|
// ⚠️ Timeout 优先级说明(L5):
|
|
82
82
|
// 1. modelParams[modelId].timeout — 最高优先级,精确到具体模型(如 deepseek-reasoner 需要更长超时)
|
|
83
83
|
// 2. timeouts[providerId] — Provider 级默认,覆盖内置默认值
|
|
84
84
|
// 3. 内置 Provider 的硬编码默认值 — 最低兜底(如 OpenAI 兼容系列默认 60000ms)
|
|
85
85
|
// 实现位置:src/providers/registry.ts initialize(),将 timeouts[id] 注入 provider
|
|
86
|
-
timeouts: z.record(z.number()).default({}),
|
|
86
|
+
timeouts: z.record(z.string(), z.number()).default({}),
|
|
87
87
|
// HTTP/HTTPS 代理地址(Node.js 不自动使用系统代理,需显式配置)
|
|
88
88
|
// 例:http://127.0.0.1:10809
|
|
89
89
|
// 也可通过环境变量 HTTPS_PROXY / HTTP_PROXY 覆盖
|
|
@@ -91,7 +91,7 @@ var ConfigSchema = z.object({
|
|
|
91
91
|
// 自定义 Provider 列表(OpenAI 兼容接口,无需改代码)
|
|
92
92
|
customProviders: z.array(CustomProviderConfigSchema).default([]),
|
|
93
93
|
// 按模型 ID 存储的推理参数(key 为模型 ID,如 "deepseek-chat")
|
|
94
|
-
modelParams: z.record(ModelParamsSchema).default({}),
|
|
94
|
+
modelParams: z.record(z.string(), ModelParamsSchema).default({}),
|
|
95
95
|
ui: z.object({
|
|
96
96
|
streaming: z.boolean().default(true),
|
|
97
97
|
markdownRendering: z.boolean().default(true),
|
|
@@ -125,12 +125,12 @@ var ConfigSchema = z.object({
|
|
|
125
125
|
toolResult: z.string().optional(),
|
|
126
126
|
heading: z.string().optional()
|
|
127
127
|
}).optional()
|
|
128
|
-
}).
|
|
128
|
+
}).prefault({}),
|
|
129
129
|
session: z.object({
|
|
130
130
|
autoSave: z.boolean().default(true),
|
|
131
131
|
maxHistoryDays: z.number().default(30),
|
|
132
132
|
systemPrompt: z.string().max(1e5).optional()
|
|
133
|
-
}).
|
|
133
|
+
}).prefault({}),
|
|
134
134
|
// 项目上下文文件配置
|
|
135
135
|
// 启动时自动读取并注入 system prompt,类似 Claude Code 的 CLAUDE.md / Codex AGENTS.md 机制
|
|
136
136
|
// 默认按顺序查找:AICLI.override.md → AGENTS.override.md → AICLI.md → CLAUDE.md → AGENTS.md
|
|
@@ -140,13 +140,13 @@ var ConfigSchema = z.object({
|
|
|
140
140
|
projectDocFallbackFilenames: z.array(z.string().max(500)).max(20).default([]),
|
|
141
141
|
projectDocMaxBytes: z.number().int().positive().default(32 * 1024),
|
|
142
142
|
showLoadedContextSources: z.boolean().default(false)
|
|
143
|
-
}).
|
|
143
|
+
}).prefault({}),
|
|
144
144
|
// 持久记忆注入配置(MEM-005)
|
|
145
145
|
// maxChars: 注入 system prompt 的字符预算,超出丢最老条目并显式标注截断。
|
|
146
146
|
// 注意 CJK ≈ 1 字符/token——中文记忆的 token 开销约等于字符数。
|
|
147
147
|
memory: z.object({
|
|
148
148
|
maxChars: z.number().int().positive().max(2e5).default(1e4)
|
|
149
|
-
}).
|
|
149
|
+
}).prefault({}),
|
|
150
150
|
// Google Custom Search API 的 Search Engine ID (cx 参数)
|
|
151
151
|
// API Key 通过 apiKeys['google-search'] 或 AICLI_API_KEY_GOOGLESEARCH 环境变量配置
|
|
152
152
|
// CX 也可通过 AICLI_GOOGLE_CX 环境变量覆盖
|
|
@@ -158,7 +158,7 @@ var ConfigSchema = z.object({
|
|
|
158
158
|
// 仍想用 API 版?把 enabled 设为 true,并务必到 GCP Console 把 Custom Search Quota 设硬上限。
|
|
159
159
|
googleSearch: z.object({
|
|
160
160
|
enabled: z.boolean().default(false)
|
|
161
|
-
}).
|
|
161
|
+
}).prefault({ enabled: false }),
|
|
162
162
|
// MCP (Model Context Protocol) 全局开关(v0.4.135+)
|
|
163
163
|
// false 时启动跳过 connectAll(),所有 MCP 服务器都不连,节省冷启动时间 + 工具定义 token。
|
|
164
164
|
// 对应你的 skills(whitelist 不依赖 MCP 工具时)完全不受影响。
|
|
@@ -167,10 +167,10 @@ var ConfigSchema = z.object({
|
|
|
167
167
|
// 声明外部 MCP 服务器,启动时自动连接、发现工具并注册
|
|
168
168
|
// 配置格式兼容 Claude Desktop(command + args + env)
|
|
169
169
|
// 示例:{ "filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path"] } }
|
|
170
|
-
mcpServers: z.record(z.object({
|
|
170
|
+
mcpServers: z.record(z.string(), z.object({
|
|
171
171
|
command: z.string().max(500),
|
|
172
172
|
args: z.array(z.string()).max(100).default([]),
|
|
173
|
-
env: z.record(z.string()).optional(),
|
|
173
|
+
env: z.record(z.string(), z.string()).optional(),
|
|
174
174
|
timeout: z.number().int().min(100).max(3e5).default(3e4)
|
|
175
175
|
})).default({}),
|
|
176
176
|
// Hooks 生命周期(v0.4.212+):兼容旧 pre/post 字符串,同时支持 events.<EventName> 结构化 JSON hook。
|
|
@@ -178,7 +178,7 @@ var ConfigSchema = z.object({
|
|
|
178
178
|
enabled: z.boolean().default(true),
|
|
179
179
|
preToolExecution: z.string().optional(),
|
|
180
180
|
postToolExecution: z.string().optional(),
|
|
181
|
-
events: z.record(z.union([
|
|
181
|
+
events: z.record(z.string(), z.union([
|
|
182
182
|
z.string(),
|
|
183
183
|
z.object({
|
|
184
184
|
command: z.string(),
|
|
@@ -216,12 +216,12 @@ var ConfigSchema = z.object({
|
|
|
216
216
|
google_search: z.enum(["allow", "confirm", "deny"]).optional(),
|
|
217
217
|
shell: z.enum(["allow", "confirm", "deny"]).optional(),
|
|
218
218
|
mcp: z.enum(["allow", "confirm", "deny"]).optional()
|
|
219
|
-
}).
|
|
220
|
-
}).
|
|
219
|
+
}).prefault({})
|
|
220
|
+
}).prefault({ enabled: false, defaultAction: "confirm", allowDomains: [], denyDomains: [], allowPorts: [], denyPorts: [], allowPrivateNetwork: false, tools: {} }),
|
|
221
221
|
// 权限 Profile(v0.4.211+):legacy 保持旧行为;其余 profile 提供更清晰的安全边界。
|
|
222
222
|
defaultPermissionProfile: z.enum(["legacy", "read-only", "workspace-write", "danger-full-access"]).default("legacy"),
|
|
223
223
|
allowedPermissionProfiles: z.array(z.string().max(50)).max(20).default(["legacy", "read-only", "workspace-write", "danger-full-access"]),
|
|
224
|
-
permissionProfiles: z.record(z.object({
|
|
224
|
+
permissionProfiles: z.record(z.string(), z.object({
|
|
225
225
|
extends: z.enum(["legacy", "read-only", "workspace-write", "danger-full-access"]).optional(),
|
|
226
226
|
defaultAction: z.enum(["auto-approve", "deny", "confirm"]).optional(),
|
|
227
227
|
workspaceRoots: z.array(z.string()).optional(),
|
|
@@ -296,7 +296,7 @@ var ConfigSchema = z.object({
|
|
|
296
296
|
redactOnSend: z.boolean().default(false),
|
|
297
297
|
mode: z.enum(["default", "strict", "off"]).default("default"),
|
|
298
298
|
customPatterns: z.array(z.string().max(200)).max(50).default([])
|
|
299
|
-
}).
|
|
299
|
+
}).prefault({}),
|
|
300
300
|
// 智能模型路由(v0.4.68+)
|
|
301
301
|
// 按用户每轮输入的内容/标签/长度动态选择模型,在同一 provider 内切换,
|
|
302
302
|
// 例:短问题走 haiku(省钱),planning 走 opus(质量)。
|
|
@@ -316,7 +316,7 @@ var ConfigSchema = z.object({
|
|
|
316
316
|
name: z.string().max(100).optional()
|
|
317
317
|
})).default([]),
|
|
318
318
|
fallback: z.string().optional()
|
|
319
|
-
}).
|
|
319
|
+
}).prefault({ enabled: false, rules: [] }),
|
|
320
320
|
// Provider 容错(v0.4.144+):网络抖动 / 5xx / 429 时,先在当前 provider 上做指数退避重试,
|
|
321
321
|
// 仍失败则按顺序尝试 chain 里的 fallback provider。auth / 400 / 422 等"硬失败"直接跳过同
|
|
322
322
|
// provider 重试,但仍会尝试 chain(不同 key/schema 可能能成功)。
|
|
@@ -336,7 +336,7 @@ var ConfigSchema = z.object({
|
|
|
336
336
|
provider: z.string().max(100),
|
|
337
337
|
model: z.string().optional()
|
|
338
338
|
})).default([])
|
|
339
|
-
}).
|
|
339
|
+
}).prefault({ enabled: false, retries: 2, initialBackoffMs: 500, maxBackoffMs: 8e3, chain: [] })
|
|
340
340
|
});
|
|
341
341
|
|
|
342
342
|
// src/config/config-manager.ts
|
|
@@ -503,7 +503,7 @@ ${err}`
|
|
|
503
503
|
const draft = { ...this.config, [key]: value };
|
|
504
504
|
const result = ConfigSchema.safeParse(draft);
|
|
505
505
|
if (!result.success) {
|
|
506
|
-
const firstErr = result.error.
|
|
506
|
+
const firstErr = result.error.issues[0];
|
|
507
507
|
throw new ConfigError(
|
|
508
508
|
`Invalid transient config value for "${String(key)}": ${firstErr?.message ?? "validation failed"}`
|
|
509
509
|
);
|
|
@@ -555,7 +555,7 @@ ${err}`
|
|
|
555
555
|
current[keys[keys.length - 1]] = value;
|
|
556
556
|
const result = ConfigSchema.safeParse(draft);
|
|
557
557
|
if (!result.success) {
|
|
558
|
-
const firstErr = result.error.
|
|
558
|
+
const firstErr = result.error.issues[0];
|
|
559
559
|
throw new ConfigError(`Invalid config value for "${path}": ${firstErr?.message ?? "validation failed"}`);
|
|
560
560
|
}
|
|
561
561
|
this.config = result.data;
|
|
@@ -4,6 +4,72 @@
|
|
|
4
4
|
function isFileWriteTool(name) {
|
|
5
5
|
return name === "write_file" || name === "edit_file" || name === "notebook_edit";
|
|
6
6
|
}
|
|
7
|
+
var READ_ONLY_CMDLETS = new Set([
|
|
8
|
+
"Get-ChildItem",
|
|
9
|
+
"gci",
|
|
10
|
+
"Get-Content",
|
|
11
|
+
"gc",
|
|
12
|
+
"Get-Item",
|
|
13
|
+
"gi",
|
|
14
|
+
"Get-ItemProperty",
|
|
15
|
+
"gp",
|
|
16
|
+
"Get-ItemPropertyValue",
|
|
17
|
+
"Get-Location",
|
|
18
|
+
"gl",
|
|
19
|
+
"Test-Path",
|
|
20
|
+
"Resolve-Path",
|
|
21
|
+
"Split-Path",
|
|
22
|
+
"Join-Path",
|
|
23
|
+
"Get-Command",
|
|
24
|
+
"gcm",
|
|
25
|
+
"Get-Service",
|
|
26
|
+
"gsv",
|
|
27
|
+
"Get-Process",
|
|
28
|
+
"gps",
|
|
29
|
+
"Get-Date",
|
|
30
|
+
"Get-Alias",
|
|
31
|
+
"Get-Module",
|
|
32
|
+
"Get-PSDrive",
|
|
33
|
+
"Get-Acl",
|
|
34
|
+
"Get-FileHash",
|
|
35
|
+
"Get-CimInstance",
|
|
36
|
+
"Get-NetTCPConnection",
|
|
37
|
+
"Get-NetIPAddress",
|
|
38
|
+
"Get-WinEvent",
|
|
39
|
+
"Get-ComputerInfo",
|
|
40
|
+
"Get-Culture",
|
|
41
|
+
"Get-ExecutionPolicy",
|
|
42
|
+
"Get-Unique",
|
|
43
|
+
"Select-Object",
|
|
44
|
+
"select",
|
|
45
|
+
"Where-Object",
|
|
46
|
+
"Sort-Object",
|
|
47
|
+
"Measure-Object",
|
|
48
|
+
"Group-Object",
|
|
49
|
+
"Compare-Object",
|
|
50
|
+
"Select-String",
|
|
51
|
+
"sls",
|
|
52
|
+
"Format-Table",
|
|
53
|
+
"ft",
|
|
54
|
+
"Format-List",
|
|
55
|
+
"fl",
|
|
56
|
+
"Format-Wide",
|
|
57
|
+
"Out-String",
|
|
58
|
+
"Write-Output",
|
|
59
|
+
"Write-Host",
|
|
60
|
+
"ConvertTo-Json",
|
|
61
|
+
"ConvertFrom-Json",
|
|
62
|
+
"ConvertTo-Csv",
|
|
63
|
+
"ConvertFrom-Csv"
|
|
64
|
+
].map((name) => name.toLowerCase()));
|
|
65
|
+
function isReadOnlyCmdletChain(cmd) {
|
|
66
|
+
const normalized = cmd.trim().replace(/\s2>\s*\$null\b/gi, " ").replace(/\s2>&1\b/g, " ").replace(/\$(?:env:\w+|null|true|false)\b/gi, "X");
|
|
67
|
+
if (!normalized || /[&`$<>\n\r(){}]|::/.test(normalized)) return false;
|
|
68
|
+
return normalized.split(/[;|]/).every((segment) => {
|
|
69
|
+
const name = segment.trim().split(/\s+/)[0].toLowerCase();
|
|
70
|
+
return READ_ONLY_CMDLETS.has(name);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
7
73
|
function getDangerLevel(toolName, args) {
|
|
8
74
|
if (toolName.startsWith("mcp__")) {
|
|
9
75
|
const rawName = toolName.split("__").pop() ?? "";
|
|
@@ -33,6 +99,7 @@ function getDangerLevel(toolName, args) {
|
|
|
33
99
|
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
100
|
if (/\bcmd(\.exe)?\s+\/[ck]\b/i.test(cmd)) return "write";
|
|
35
101
|
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";
|
|
102
|
+
if (isReadOnlyCmdletChain(cmd)) return "safe";
|
|
36
103
|
return "write";
|
|
37
104
|
}
|
|
38
105
|
if (toolName === "run_tests") return "write";
|