jinzd-ai-cli 0.4.103 → 0.4.105
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 +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/{agent-client-6GX6QQDU.js → agent-client-25TIQ6AP.js} +1 -0
- package/dist/{auth-MSUWO6SE.js → auth-SC6KHHI3.js} +1 -0
- package/dist/{batch-LNTG2IRQ.js → batch-NPK4USGH.js} +3 -2
- package/dist/{chat-index-W2UZ34ZI.js → chat-index-7OHUKJY5.js} +1 -0
- package/dist/{chat-index-QKFH7ZP6.js → chat-index-ADG2GPCC.js} +1 -0
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/{chunk-SN56X6RE.js → chunk-B6NUQVYK.js} +1 -1
- package/dist/{chunk-VOWVIR2U.js → chunk-F7XJ67XB.js} +30 -112
- package/dist/chunk-HOSJZMQS.js +97 -0
- package/dist/{chunk-OVYOYUP7.js → chunk-LVX667WL.js} +89 -36
- package/dist/{chunk-JHPSWYO3.js → chunk-LX5FXZVP.js} +7 -4
- package/dist/chunk-PDX44BCA.js +11 -0
- package/dist/{chunk-RZWWODW7.js → chunk-RFKT3T5S.js} +199 -74
- package/dist/{chunk-DGXUO7D4.js → chunk-VOF6OTZB.js} +89 -39
- package/dist/constants-HK5BB5EZ.js +78 -0
- package/dist/electron-server.js +289 -129
- package/dist/{file-checkpoint-CGH6OJVI.js → file-checkpoint-UHSMHCRU.js} +1 -0
- package/dist/{file-checkpoint-NKBHGC7L.js → file-checkpoint-ZN7KE3TN.js} +1 -0
- package/dist/git-context-7KIP4X2V.js +12 -0
- package/dist/{hub-4YGZ4XHN.js → hub-5VFGLTHY.js} +3 -2
- package/dist/{hub-server-BYXNQGDY.js → hub-server-AUMVPNU6.js} +1 -0
- package/dist/index.js +98 -47
- package/dist/{indexer-C7QYYHSZ.js → indexer-XGY7XGJM.js} +1 -0
- package/dist/{indexer-O5FCGFBJ.js → indexer-Z6AQTGBK.js} +1 -0
- package/dist/project-trust-EBGHD7LE.js +67 -0
- package/dist/project-trust-IFM7FXEV.js +68 -0
- package/dist/{run-tests-SN74WT4Z.js → run-tests-IMVI43CZ.js} +2 -1
- package/dist/{run-tests-3YOJEN2Q.js → run-tests-VQ3YZB75.js} +3 -2
- package/dist/{semantic-3KJPAUW6.js → semantic-FR2ZSQLY.js} +1 -0
- package/dist/{semantic-YDRPPVWK.js → semantic-UFKVYKFE.js} +3 -2
- package/dist/{server-BG4WR6RF.js → server-XDBIWNRW.js} +9 -8
- package/dist/{server-TNPDHGQT.js → server-ZVY3CKTJ.js} +65 -28
- package/dist/{store-S24SPPDZ.js → store-JDEW743P.js} +1 -0
- package/dist/{store-247B3TAU.js → store-Q7NMUCPP.js} +1 -0
- package/dist/{task-orchestrator-MUIH3XBY.js → task-orchestrator-UEZOFXQX.js} +9 -8
- package/dist/{vector-store-NDUFLNGN.js → vector-store-AK6J3RIA.js} +1 -0
- package/dist/{vector-store-QARQ2P6D.js → vector-store-MCQ77OOJ.js} +1 -0
- package/package.json +1 -1
- package/dist/{chunk-KJLJPUY2.js → chunk-3BICTI5M.js} +3 -3
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
renderHubBanner,
|
|
6
6
|
renderHubEvent
|
|
7
7
|
} from "./chunk-YJ2CUK5O.js";
|
|
8
|
+
import "./chunk-PDX44BCA.js";
|
|
8
9
|
|
|
9
10
|
// src/hub/discuss.ts
|
|
10
11
|
var DiscussionOrchestrator = class {
|
|
@@ -385,7 +386,7 @@ ${content}`);
|
|
|
385
386
|
}
|
|
386
387
|
}
|
|
387
388
|
async function runTaskMode(config, providers, configManager, topic) {
|
|
388
|
-
const { TaskOrchestrator } = await import("./task-orchestrator-
|
|
389
|
+
const { TaskOrchestrator } = await import("./task-orchestrator-UEZOFXQX.js");
|
|
389
390
|
const orchestrator = new TaskOrchestrator(config, providers, configManager);
|
|
390
391
|
let interrupted = false;
|
|
391
392
|
const onSigint = () => {
|
|
@@ -421,7 +422,7 @@ async function runTaskMode(config, providers, configManager, topic) {
|
|
|
421
422
|
}
|
|
422
423
|
}
|
|
423
424
|
async function runDistributedDiscussion(config, providers, topic, port) {
|
|
424
|
-
const { HubServer } = await import("./hub-server-
|
|
425
|
+
const { HubServer } = await import("./hub-server-AUMVPNU6.js");
|
|
425
426
|
const hub = new HubServer(config, providers, port);
|
|
426
427
|
let interrupted = false;
|
|
427
428
|
const onSigint = () => {
|
package/dist/index.js
CHANGED
|
@@ -16,10 +16,7 @@ import {
|
|
|
16
16
|
extractWrittenFilePaths,
|
|
17
17
|
findPhantomClaims,
|
|
18
18
|
formatCost,
|
|
19
|
-
formatGitContextForPrompt,
|
|
20
19
|
getContentText,
|
|
21
|
-
getGitContext,
|
|
22
|
-
getGitRoot,
|
|
23
20
|
getPricing,
|
|
24
21
|
hadPreviousWriteToolCalls,
|
|
25
22
|
loadDevState,
|
|
@@ -28,10 +25,10 @@ import {
|
|
|
28
25
|
saveDevState,
|
|
29
26
|
sessionHasMeaningfulContent,
|
|
30
27
|
setupProxy
|
|
31
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-F7XJ67XB.js";
|
|
32
29
|
import {
|
|
33
30
|
ConfigManager
|
|
34
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-B6NUQVYK.js";
|
|
35
32
|
import {
|
|
36
33
|
ToolExecutor,
|
|
37
34
|
ToolRegistry,
|
|
@@ -50,25 +47,11 @@ import {
|
|
|
50
47
|
spawnAgentContext,
|
|
51
48
|
theme,
|
|
52
49
|
undoStack
|
|
53
|
-
} from "./chunk-
|
|
54
|
-
import "./chunk-
|
|
55
|
-
import {
|
|
56
|
-
fileCheckpoints
|
|
57
|
-
} from "./chunk-4BKXL7SM.js";
|
|
58
|
-
import {
|
|
59
|
-
DEFAULT_PATTERNS,
|
|
60
|
-
buildChatIndex,
|
|
61
|
-
clearChatIndex,
|
|
62
|
-
getChatIndexStatus,
|
|
63
|
-
scanString,
|
|
64
|
-
searchChatMemory
|
|
65
|
-
} from "./chunk-ANYYM4CF.js";
|
|
66
|
-
import "./chunk-NHNWUBXB.js";
|
|
67
|
-
import "./chunk-KJLJPUY2.js";
|
|
68
|
-
import "./chunk-6VRJGH25.js";
|
|
50
|
+
} from "./chunk-RFKT3T5S.js";
|
|
51
|
+
import "./chunk-3BICTI5M.js";
|
|
69
52
|
import "./chunk-2DXY7UGF.js";
|
|
70
|
-
import "./chunk-
|
|
71
|
-
import "./chunk-
|
|
53
|
+
import "./chunk-LVX667WL.js";
|
|
54
|
+
import "./chunk-2ZD3YTVM.js";
|
|
72
55
|
import {
|
|
73
56
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
74
57
|
AUTHOR,
|
|
@@ -90,7 +73,27 @@ import {
|
|
|
90
73
|
SKILLS_DIR_NAME,
|
|
91
74
|
VERSION,
|
|
92
75
|
buildUserIdentityPrompt
|
|
93
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-LX5FXZVP.js";
|
|
77
|
+
import {
|
|
78
|
+
formatGitContextForPrompt,
|
|
79
|
+
getGitContext,
|
|
80
|
+
getGitRoot
|
|
81
|
+
} from "./chunk-HOSJZMQS.js";
|
|
82
|
+
import {
|
|
83
|
+
fileCheckpoints
|
|
84
|
+
} from "./chunk-4BKXL7SM.js";
|
|
85
|
+
import {
|
|
86
|
+
DEFAULT_PATTERNS,
|
|
87
|
+
buildChatIndex,
|
|
88
|
+
clearChatIndex,
|
|
89
|
+
getChatIndexStatus,
|
|
90
|
+
scanString,
|
|
91
|
+
searchChatMemory
|
|
92
|
+
} from "./chunk-ANYYM4CF.js";
|
|
93
|
+
import "./chunk-KHYD3WXE.js";
|
|
94
|
+
import "./chunk-NHNWUBXB.js";
|
|
95
|
+
import "./chunk-6VRJGH25.js";
|
|
96
|
+
import "./chunk-PDX44BCA.js";
|
|
94
97
|
|
|
95
98
|
// src/index.ts
|
|
96
99
|
import { program } from "commander";
|
|
@@ -264,12 +267,12 @@ var Renderer = class {
|
|
|
264
267
|
console.log(tool("search_code", 'Semantic (meaning-based) code search via local embeddings \u2014 "grep by meaning", bilingual'));
|
|
265
268
|
console.log(tool("recall_memory", 'Semantic recall over past chat sessions \u2014 "remember when we discussed X" across history (v0.4.89+)'));
|
|
266
269
|
console.log(HR);
|
|
267
|
-
console.log(theme.dim(" REPL Commands (
|
|
268
|
-
console.log(theme.dim(" /help /about /provider /model /clear /compact /plan
|
|
269
|
-
console.log(theme.dim(" /system /context /status /search /undo /export /copy
|
|
270
|
-
console.log(theme.dim(" /cost /init /skill /tools /plugins /mcp /config
|
|
271
|
-
console.log(theme.dim(" /review /security-review /security /rewind /commands
|
|
272
|
-
console.log(theme.dim(" /scaffold /add-dir /memory /profile /doctor /bug /think"));
|
|
270
|
+
console.log(theme.dim(" REPL Commands (44):"));
|
|
271
|
+
console.log(theme.dim(" /help /about /provider /model /route /clear /compact /plan"));
|
|
272
|
+
console.log(theme.dim(" /session /system /context /status /search /undo /export /copy"));
|
|
273
|
+
console.log(theme.dim(" /paste /cost /init /skill /tools /plugins /mcp /config"));
|
|
274
|
+
console.log(theme.dim(" /checkpoint /review /security-review /security /rewind /commands"));
|
|
275
|
+
console.log(theme.dim(" /test /scaffold /add-dir /memory /profile /doctor /bug /think"));
|
|
273
276
|
console.log(theme.dim(" /diff /fork /branch /index /yolo /exit"));
|
|
274
277
|
console.log(HR);
|
|
275
278
|
console.log(theme.dim(" Key Features:"));
|
|
@@ -346,6 +349,14 @@ var Renderer = class {
|
|
|
346
349
|
console.log(feat("Session sensitive-data redaction (v0.4.88+): unified redactor scrubs passwords/tokens/keys from every message before it hits disk; /security status and scan to audit"));
|
|
347
350
|
console.log(feat('Chat memory recall (B4, v0.4.89+): "human-like long-term memory" \u2014 semantic index over all past sessions + recall_memory AI tool + /memory rebuild|refresh|status|recall, AI auto-recalls on "last time"/"\u4E0A\u6B21"'));
|
|
348
351
|
console.log(feat("Web UI Memory panel (B4, v0.4.90+): \u{1F9E0} Memory sidebar tab \u2014 cross-session semantic search with \u2795 Inject-to-input (quotes hit into chat box for user-reviewed recall) and \u2197 jump-to-session"));
|
|
352
|
+
console.log(feat("Ctrl+C tool interrupt (v0.4.92+): pressing Ctrl+C during a long-running tool call (bash/run_tests/etc.) actually aborts the child process and returns control to the REPL"));
|
|
353
|
+
console.log(feat("Skill size warning threshold (v0.4.93+): config.skills.maxSize (default 10000 chars) \u2014 warn when a loaded skill pack exceeds budget, configurable per project"));
|
|
354
|
+
console.log(feat("DeepSeek V4 family (v0.4.94+): deepseek-pro / deepseek-flash with reasoning_content thinking mode \u2014 full roundtrip persisted across multi-turn (v0.4.95\u20130.4.97)"));
|
|
355
|
+
console.log(feat("Smart model routing (/route, config.routing): per-message model override by tag/keyword/length rules \u2014 e.g. route short msgs to Haiku, code-heavy to Opus; /route test <msg> previews decision"));
|
|
356
|
+
console.log(feat("Write-task auto-test suppression (v0.4.98+): AI no longer chains run_tests after write_file/edit_file unless explicitly asked \u2014 keeps single-file edits from ballooning into test runs"));
|
|
357
|
+
console.log(feat("Tool history ordering (v0.4.100+): preserve original tool-call order across multi-turn rounds \u2014 fixes reasoning drift on long agentic loops"));
|
|
358
|
+
console.log(feat("save_last_response Web mode (v0.4.101\u20130.4.102+): hidden from CLI-only contexts and tee-streams chunks to disk in Web UI as the response arrives"));
|
|
359
|
+
console.log(feat("write_file long-content guidance (v0.4.103+): tool description no longer encourages AI to chunk long files \u2014 single-shot writes prevented from being split into truncated parts"));
|
|
349
360
|
console.log();
|
|
350
361
|
}
|
|
351
362
|
printPrompt(provider, _model) {
|
|
@@ -959,6 +970,7 @@ function createDefaultCommands() {
|
|
|
959
970
|
" /about - About ai-cli & author info",
|
|
960
971
|
" /provider <name> - Switch AI provider",
|
|
961
972
|
" /model <name> - Switch model",
|
|
973
|
+
" /route [on|off|show|test <msg>] - Smart model routing rules (per-message model override)",
|
|
962
974
|
" /clear - Clear conversation history",
|
|
963
975
|
" /compact [instruction] - Summarize & compress history (keep last 4 messages)",
|
|
964
976
|
" /plan [execute|exit|status] - Enter/manage Plan Mode (read-only planning)",
|
|
@@ -1576,8 +1588,30 @@ ${text}
|
|
|
1576
1588
|
{
|
|
1577
1589
|
name: "mcp",
|
|
1578
1590
|
description: "Show MCP server connections and tools",
|
|
1579
|
-
usage: "/mcp [reconnect [serverId]]",
|
|
1591
|
+
usage: "/mcp [reconnect [serverId] | trust-project]",
|
|
1580
1592
|
async execute(args, ctx) {
|
|
1593
|
+
if (args[0] === "trust-project") {
|
|
1594
|
+
const { join: join6 } = await import("path");
|
|
1595
|
+
const { existsSync: existsSync6 } = await import("fs");
|
|
1596
|
+
const { getGitRoot: getGitRoot2 } = await import("./git-context-7KIP4X2V.js");
|
|
1597
|
+
const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-HK5BB5EZ.js");
|
|
1598
|
+
const { approveProject, hashMcpFile } = await import("./project-trust-IFM7FXEV.js");
|
|
1599
|
+
const cwd = process.cwd();
|
|
1600
|
+
const projectRoot = getGitRoot2(cwd) ?? cwd;
|
|
1601
|
+
const mcpPath = join6(projectRoot, MCP_PROJECT_CONFIG_NAME2);
|
|
1602
|
+
console.log();
|
|
1603
|
+
if (!existsSync6(mcpPath)) {
|
|
1604
|
+
console.log(theme.dim(` No .mcp.json in ${projectRoot}.`));
|
|
1605
|
+
console.log();
|
|
1606
|
+
return;
|
|
1607
|
+
}
|
|
1608
|
+
approveProject(ctx.config.getConfigDir(), mcpPath);
|
|
1609
|
+
console.log(theme.success(` \u2713 Approved ${mcpPath}`));
|
|
1610
|
+
console.log(theme.dim(` sha256:${hashMcpFile(mcpPath).slice(0, 16)}\u2026`));
|
|
1611
|
+
console.log(theme.dim(` Restart aicli to load these MCP servers.`));
|
|
1612
|
+
console.log();
|
|
1613
|
+
return;
|
|
1614
|
+
}
|
|
1581
1615
|
const manager = ctx.getMcpManager();
|
|
1582
1616
|
if (!manager) {
|
|
1583
1617
|
console.log();
|
|
@@ -2483,9 +2517,9 @@ ${hint}` : "")
|
|
|
2483
2517
|
async execute(args, ctx) {
|
|
2484
2518
|
const sub = (args[0] ?? "status").toLowerCase();
|
|
2485
2519
|
const root = process.cwd();
|
|
2486
|
-
const { loadIndex, clearIndex } = await import("./store-
|
|
2487
|
-
const { indexProject } = await import("./indexer-
|
|
2488
|
-
const { loadVectorStore, clearVectorStore } = await import("./vector-store-
|
|
2520
|
+
const { loadIndex, clearIndex } = await import("./store-JDEW743P.js");
|
|
2521
|
+
const { indexProject } = await import("./indexer-XGY7XGJM.js");
|
|
2522
|
+
const { loadVectorStore, clearVectorStore } = await import("./vector-store-MCQ77OOJ.js");
|
|
2489
2523
|
if (sub === "status") {
|
|
2490
2524
|
const idx = loadIndex(root);
|
|
2491
2525
|
const vec = loadVectorStore(root);
|
|
@@ -2544,7 +2578,7 @@ ${hint}` : "")
|
|
|
2544
2578
|
}
|
|
2545
2579
|
console.log(theme.dim(` Building semantic index for ${idx.symbolCount} symbols\u2026`));
|
|
2546
2580
|
console.log(theme.dim(" (First run downloads ~117 MB embedding model to ~/.aicli/models/)"));
|
|
2547
|
-
const { rebuildSemanticIndex } = await import("./semantic-
|
|
2581
|
+
const { rebuildSemanticIndex } = await import("./semantic-UFKVYKFE.js");
|
|
2548
2582
|
try {
|
|
2549
2583
|
const stats = await rebuildSemanticIndex(root, {
|
|
2550
2584
|
onProgress: (done, total) => {
|
|
@@ -2610,7 +2644,7 @@ ${hint}` : "")
|
|
|
2610
2644
|
usage: "/test [command|filter]",
|
|
2611
2645
|
async execute(args, ctx) {
|
|
2612
2646
|
try {
|
|
2613
|
-
const { executeTests } = await import("./run-tests-
|
|
2647
|
+
const { executeTests } = await import("./run-tests-VQ3YZB75.js");
|
|
2614
2648
|
const argStr = args.join(" ").trim();
|
|
2615
2649
|
let testArgs = {};
|
|
2616
2650
|
if (argStr) {
|
|
@@ -5013,8 +5047,8 @@ Session '${this.resumeSessionId}' not found.
|
|
|
5013
5047
|
}
|
|
5014
5048
|
void (async () => {
|
|
5015
5049
|
try {
|
|
5016
|
-
const { indexProject } = await import("./indexer-
|
|
5017
|
-
const { loadIndex } = await import("./store-
|
|
5050
|
+
const { indexProject } = await import("./indexer-XGY7XGJM.js");
|
|
5051
|
+
const { loadIndex } = await import("./store-JDEW743P.js");
|
|
5018
5052
|
const root = process.cwd();
|
|
5019
5053
|
const existed = loadIndex(root);
|
|
5020
5054
|
const { stats } = await indexProject(root);
|
|
@@ -5034,7 +5068,7 @@ Session '${this.resumeSessionId}' not found.
|
|
|
5034
5068
|
})();
|
|
5035
5069
|
void (async () => {
|
|
5036
5070
|
try {
|
|
5037
|
-
const { getChatIndexStatus: getChatIndexStatus2, buildChatIndex: buildChatIndex2 } = await import("./chat-index-
|
|
5071
|
+
const { getChatIndexStatus: getChatIndexStatus2, buildChatIndex: buildChatIndex2 } = await import("./chat-index-7OHUKJY5.js");
|
|
5038
5072
|
const initial = getChatIndexStatus2();
|
|
5039
5073
|
this.chatMemoryStatus = {
|
|
5040
5074
|
exists: initial.exists,
|
|
@@ -5062,7 +5096,23 @@ Session '${this.resumeSessionId}' not found.
|
|
|
5062
5096
|
})();
|
|
5063
5097
|
const globalMcpServers = this.config.get("mcpServers") ?? {};
|
|
5064
5098
|
const projectMcpResult = this.loadProjectMcpConfig();
|
|
5065
|
-
|
|
5099
|
+
let projectMcpServers = {};
|
|
5100
|
+
if (projectMcpResult) {
|
|
5101
|
+
const { checkTrust } = await import("./project-trust-IFM7FXEV.js");
|
|
5102
|
+
const verdict = checkTrust(this.config.getConfigDir(), projectMcpResult.filePath);
|
|
5103
|
+
if (verdict.trusted) {
|
|
5104
|
+
projectMcpServers = projectMcpResult.servers;
|
|
5105
|
+
} else {
|
|
5106
|
+
process.stderr.write(
|
|
5107
|
+
`
|
|
5108
|
+
\u26A0 Project .mcp.json found at ${projectMcpResult.filePath} (${verdict.reason === "unknown" ? "never seen before" : "content changed since last approval"}).
|
|
5109
|
+
Servers: ${Object.keys(projectMcpResult.servers).join(", ")}
|
|
5110
|
+
Skipped to prevent accidental RCE. Run "/mcp trust-project" to approve and load.
|
|
5111
|
+
|
|
5112
|
+
`
|
|
5113
|
+
);
|
|
5114
|
+
}
|
|
5115
|
+
}
|
|
5066
5116
|
const mergedMcpServers = { ...globalMcpServers, ...projectMcpServers };
|
|
5067
5117
|
for (const id of Object.keys(globalMcpServers)) {
|
|
5068
5118
|
this.mcpServerSources.set(id, "global");
|
|
@@ -6090,8 +6140,9 @@ ${mcpBudgetNote}` : "");
|
|
|
6090
6140
|
process.stdout.write("\n");
|
|
6091
6141
|
}
|
|
6092
6142
|
const correctionMsg = phantomPaths.length > 0 ? buildPhantomCorrectionMessage(phantomPaths) : HALLUCINATION_CORRECTION_MESSAGE;
|
|
6143
|
+
const reasoningField = "reasoningContent" in result && result.reasoningContent ? { reasoning_content: result.reasoningContent } : this.currentProvider === "deepseek" ? { reasoning_content: "" } : {};
|
|
6093
6144
|
extraMessages.push(
|
|
6094
|
-
{ role: "assistant", content: result.content },
|
|
6145
|
+
{ role: "assistant", content: result.content, ...reasoningField },
|
|
6095
6146
|
{ role: "user", content: correctionMsg }
|
|
6096
6147
|
);
|
|
6097
6148
|
spinner.start(`Retrying... (round ${round + 2}/${maxToolRounds})`);
|
|
@@ -6749,11 +6800,11 @@ program.command("web").description("Start Web UI server with browser-based chat
|
|
|
6749
6800
|
console.error("Error: Invalid port number. Must be between 1 and 65535.");
|
|
6750
6801
|
process.exit(1);
|
|
6751
6802
|
}
|
|
6752
|
-
const { startWebServer } = await import("./server-
|
|
6803
|
+
const { startWebServer } = await import("./server-ZVY3CKTJ.js");
|
|
6753
6804
|
await startWebServer({ port, host: options.host });
|
|
6754
6805
|
});
|
|
6755
6806
|
program.command("user [action] [username]").description("Manage Web UI users (list | create <name> | delete <name> | reset-password <name> | migrate <name>)").action(async (action, username) => {
|
|
6756
|
-
const { AuthManager } = await import("./auth-
|
|
6807
|
+
const { AuthManager } = await import("./auth-SC6KHHI3.js");
|
|
6757
6808
|
const config = new ConfigManager();
|
|
6758
6809
|
const auth = new AuthManager(config.getConfigDir());
|
|
6759
6810
|
if (!action || action === "list") {
|
|
@@ -6872,7 +6923,7 @@ program.command("sessions").description("List recent conversation sessions").act
|
|
|
6872
6923
|
});
|
|
6873
6924
|
program.command("batch <action> [arg] [arg2]").description("Anthropic Message Batches: submit | list | status <id> | results <id> [out] | cancel <id>").option("--dry-run", "Parse and validate input without submitting (submit only)").action(async (action, arg, arg2, options) => {
|
|
6874
6925
|
try {
|
|
6875
|
-
const batch = await import("./batch-
|
|
6926
|
+
const batch = await import("./batch-NPK4USGH.js");
|
|
6876
6927
|
switch (action) {
|
|
6877
6928
|
case "submit":
|
|
6878
6929
|
if (!arg) {
|
|
@@ -6915,7 +6966,7 @@ program.command("batch <action> [arg] [arg2]").description("Anthropic Message Ba
|
|
|
6915
6966
|
}
|
|
6916
6967
|
});
|
|
6917
6968
|
program.command("mcp-serve").description("Start an MCP server over STDIO, exposing aicli's built-in tools to Claude Desktop / Cursor / other MCP clients").option("--allow-destructive", "Allow bash / run_interactive / task_create (always destructive in MCP mode)").option("--allow-outside-cwd", "Allow tool path arguments to escape the sandbox root \u2014 disabled by default").option("--tools <list>", "Comma-separated whitelist of tools to expose (default: all eligible tools)").option("--cwd <path>", "Working directory AND sandbox root (default: current directory)").action(async (options) => {
|
|
6918
|
-
const { startMcpServer } = await import("./server-
|
|
6969
|
+
const { startMcpServer } = await import("./server-XDBIWNRW.js");
|
|
6919
6970
|
await startMcpServer({
|
|
6920
6971
|
allowDestructive: !!options.allowDestructive,
|
|
6921
6972
|
allowOutsideCwd: !!options.allowOutsideCwd,
|
|
@@ -7042,7 +7093,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
|
|
|
7042
7093
|
}),
|
|
7043
7094
|
config.get("customProviders")
|
|
7044
7095
|
);
|
|
7045
|
-
const { startHub } = await import("./hub-
|
|
7096
|
+
const { startHub } = await import("./hub-5VFGLTHY.js");
|
|
7046
7097
|
await startHub(
|
|
7047
7098
|
{
|
|
7048
7099
|
topic: topic ?? "",
|
|
@@ -7073,7 +7124,7 @@ program.command("join").description("Join a running hub as a remote AI agent").o
|
|
|
7073
7124
|
}),
|
|
7074
7125
|
config.get("customProviders")
|
|
7075
7126
|
);
|
|
7076
|
-
const { joinHub } = await import("./agent-client-
|
|
7127
|
+
const { joinHub } = await import("./agent-client-25TIQ6AP.js");
|
|
7077
7128
|
await joinHub(
|
|
7078
7129
|
{
|
|
7079
7130
|
port: parseInt(options.port ?? "9527", 10),
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__require
|
|
3
|
+
} from "./chunk-3RG5ZIWI.js";
|
|
4
|
+
|
|
5
|
+
// src/mcp/project-trust.ts
|
|
6
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
|
|
7
|
+
import { createHash } from "crypto";
|
|
8
|
+
import { join, dirname } from "path";
|
|
9
|
+
var TRUST_FILE = "mcp-project-trust.json";
|
|
10
|
+
function hashMcpFile(filePath) {
|
|
11
|
+
const buf = readFileSync(filePath);
|
|
12
|
+
return createHash("sha256").update(buf).digest("hex");
|
|
13
|
+
}
|
|
14
|
+
function loadStore(baseDir) {
|
|
15
|
+
const file = join(baseDir, TRUST_FILE);
|
|
16
|
+
if (existsSync(file)) {
|
|
17
|
+
try {
|
|
18
|
+
const parsed = JSON.parse(readFileSync(file, "utf-8"));
|
|
19
|
+
if (parsed && typeof parsed === "object" && Array.isArray(parsed.entries)) {
|
|
20
|
+
return parsed;
|
|
21
|
+
}
|
|
22
|
+
} catch {
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return { version: 1, entries: [] };
|
|
26
|
+
}
|
|
27
|
+
function saveStore(baseDir, store) {
|
|
28
|
+
mkdirSync(dirname(join(baseDir, TRUST_FILE)), { recursive: true });
|
|
29
|
+
const file = join(baseDir, TRUST_FILE);
|
|
30
|
+
const tmp = file + ".tmp";
|
|
31
|
+
writeFileSync(tmp, JSON.stringify(store, null, 2), "utf-8");
|
|
32
|
+
try {
|
|
33
|
+
const { renameSync } = __require("fs");
|
|
34
|
+
renameSync(tmp, file);
|
|
35
|
+
} catch {
|
|
36
|
+
writeFileSync(file, JSON.stringify(store, null, 2), "utf-8");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function checkTrust(baseDir, mcpPath) {
|
|
40
|
+
if (!existsSync(mcpPath)) return { trusted: true };
|
|
41
|
+
const currentHash = hashMcpFile(mcpPath);
|
|
42
|
+
const store = loadStore(baseDir);
|
|
43
|
+
const entry = store.entries.find((e) => e.path === mcpPath);
|
|
44
|
+
if (!entry) return { trusted: false, reason: "unknown", currentHash };
|
|
45
|
+
if (entry.hash !== currentHash) {
|
|
46
|
+
return { trusted: false, reason: "changed", previousHash: entry.hash, currentHash };
|
|
47
|
+
}
|
|
48
|
+
return { trusted: true };
|
|
49
|
+
}
|
|
50
|
+
function approveProject(baseDir, mcpPath) {
|
|
51
|
+
const currentHash = hashMcpFile(mcpPath);
|
|
52
|
+
const store = loadStore(baseDir);
|
|
53
|
+
const idx = store.entries.findIndex((e) => e.path === mcpPath);
|
|
54
|
+
const entry = {
|
|
55
|
+
path: mcpPath,
|
|
56
|
+
hash: currentHash,
|
|
57
|
+
approvedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
58
|
+
};
|
|
59
|
+
if (idx >= 0) store.entries[idx] = entry;
|
|
60
|
+
else store.entries.push(entry);
|
|
61
|
+
saveStore(baseDir, store);
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
approveProject,
|
|
65
|
+
checkTrust,
|
|
66
|
+
hashMcpFile
|
|
67
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
__require
|
|
4
|
+
} from "./chunk-PDX44BCA.js";
|
|
5
|
+
|
|
6
|
+
// src/mcp/project-trust.ts
|
|
7
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
|
|
8
|
+
import { createHash } from "crypto";
|
|
9
|
+
import { join, dirname } from "path";
|
|
10
|
+
var TRUST_FILE = "mcp-project-trust.json";
|
|
11
|
+
function hashMcpFile(filePath) {
|
|
12
|
+
const buf = readFileSync(filePath);
|
|
13
|
+
return createHash("sha256").update(buf).digest("hex");
|
|
14
|
+
}
|
|
15
|
+
function loadStore(baseDir) {
|
|
16
|
+
const file = join(baseDir, TRUST_FILE);
|
|
17
|
+
if (existsSync(file)) {
|
|
18
|
+
try {
|
|
19
|
+
const parsed = JSON.parse(readFileSync(file, "utf-8"));
|
|
20
|
+
if (parsed && typeof parsed === "object" && Array.isArray(parsed.entries)) {
|
|
21
|
+
return parsed;
|
|
22
|
+
}
|
|
23
|
+
} catch {
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return { version: 1, entries: [] };
|
|
27
|
+
}
|
|
28
|
+
function saveStore(baseDir, store) {
|
|
29
|
+
mkdirSync(dirname(join(baseDir, TRUST_FILE)), { recursive: true });
|
|
30
|
+
const file = join(baseDir, TRUST_FILE);
|
|
31
|
+
const tmp = file + ".tmp";
|
|
32
|
+
writeFileSync(tmp, JSON.stringify(store, null, 2), "utf-8");
|
|
33
|
+
try {
|
|
34
|
+
const { renameSync } = __require("fs");
|
|
35
|
+
renameSync(tmp, file);
|
|
36
|
+
} catch {
|
|
37
|
+
writeFileSync(file, JSON.stringify(store, null, 2), "utf-8");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function checkTrust(baseDir, mcpPath) {
|
|
41
|
+
if (!existsSync(mcpPath)) return { trusted: true };
|
|
42
|
+
const currentHash = hashMcpFile(mcpPath);
|
|
43
|
+
const store = loadStore(baseDir);
|
|
44
|
+
const entry = store.entries.find((e) => e.path === mcpPath);
|
|
45
|
+
if (!entry) return { trusted: false, reason: "unknown", currentHash };
|
|
46
|
+
if (entry.hash !== currentHash) {
|
|
47
|
+
return { trusted: false, reason: "changed", previousHash: entry.hash, currentHash };
|
|
48
|
+
}
|
|
49
|
+
return { trusted: true };
|
|
50
|
+
}
|
|
51
|
+
function approveProject(baseDir, mcpPath) {
|
|
52
|
+
const currentHash = hashMcpFile(mcpPath);
|
|
53
|
+
const store = loadStore(baseDir);
|
|
54
|
+
const idx = store.entries.findIndex((e) => e.path === mcpPath);
|
|
55
|
+
const entry = {
|
|
56
|
+
path: mcpPath,
|
|
57
|
+
hash: currentHash,
|
|
58
|
+
approvedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
59
|
+
};
|
|
60
|
+
if (idx >= 0) store.entries[idx] = entry;
|
|
61
|
+
else store.entries.push(entry);
|
|
62
|
+
saveStore(baseDir, store);
|
|
63
|
+
}
|
|
64
|
+
export {
|
|
65
|
+
approveProject,
|
|
66
|
+
checkTrust,
|
|
67
|
+
hashMcpFile
|
|
68
|
+
};
|
|
@@ -5,10 +5,11 @@ import {
|
|
|
5
5
|
pathTokens,
|
|
6
6
|
rebuildSemanticIndex,
|
|
7
7
|
semanticSearch
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-6VRJGH25.js";
|
|
8
|
+
} from "./chunk-3BICTI5M.js";
|
|
10
9
|
import "./chunk-2DXY7UGF.js";
|
|
11
10
|
import "./chunk-KHYD3WXE.js";
|
|
11
|
+
import "./chunk-6VRJGH25.js";
|
|
12
|
+
import "./chunk-PDX44BCA.js";
|
|
12
13
|
export {
|
|
13
14
|
buildEmbeddingText,
|
|
14
15
|
hasSemanticIndex,
|
|
@@ -3,19 +3,20 @@ import {
|
|
|
3
3
|
ToolRegistry,
|
|
4
4
|
getDangerLevel,
|
|
5
5
|
schemaToJsonSchema
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RFKT3T5S.js";
|
|
7
|
+
import "./chunk-3BICTI5M.js";
|
|
8
|
+
import "./chunk-2DXY7UGF.js";
|
|
9
|
+
import "./chunk-LVX667WL.js";
|
|
7
10
|
import "./chunk-2ZD3YTVM.js";
|
|
11
|
+
import {
|
|
12
|
+
VERSION
|
|
13
|
+
} from "./chunk-LX5FXZVP.js";
|
|
8
14
|
import "./chunk-4BKXL7SM.js";
|
|
9
15
|
import "./chunk-ANYYM4CF.js";
|
|
16
|
+
import "./chunk-KHYD3WXE.js";
|
|
10
17
|
import "./chunk-NHNWUBXB.js";
|
|
11
|
-
import "./chunk-KJLJPUY2.js";
|
|
12
18
|
import "./chunk-6VRJGH25.js";
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-KHYD3WXE.js";
|
|
15
|
-
import "./chunk-OVYOYUP7.js";
|
|
16
|
-
import {
|
|
17
|
-
VERSION
|
|
18
|
-
} from "./chunk-JHPSWYO3.js";
|
|
19
|
+
import "./chunk-PDX44BCA.js";
|
|
19
20
|
|
|
20
21
|
// src/mcp/server.ts
|
|
21
22
|
import { createInterface } from "readline";
|