jinzd-ai-cli 0.4.246 → 0.4.248
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 +8 -3
- package/README.zh-CN.md +8 -3
- package/dist/{batch-AHW7WALD.js → batch-CC3LCNXM.js} +2 -2
- package/dist/{chat-index-ALUHFJKI.js → chat-index-7MMTGQNA.js} +2 -2
- package/dist/{chat-index-ML5FF5L6.js → chat-index-Q6BKWWAM.js} +1 -1
- package/dist/{chunk-DJDEXHOT.js → chunk-23ZIOVZR.js} +4 -4
- package/dist/{chunk-QYQI7ZWK.js → chunk-2QZMITSL.js} +13 -1
- package/dist/{chunk-IGPFYNZA.js → chunk-6RPGQ5CG.js} +1 -1
- package/dist/{chunk-XK22CVID.js → chunk-BIZFOVNA.js} +1 -1
- package/dist/{chunk-YVMACMXW.js → chunk-EWLXBTSC.js} +1 -1
- package/dist/{chunk-OMSOAFXY.js → chunk-G77EIVBY.js} +1 -1
- package/dist/{chunk-K3CF65QH.js → chunk-GLSR2NR3.js} +1 -1
- package/dist/{chunk-CJ3BPLHZ.js → chunk-GS5XW5UJ.js} +1 -1
- package/dist/{chunk-E44DTERW.js → chunk-GUOLPI33.js} +3 -0
- package/dist/{chunk-6Y42RN5H.js → chunk-HTOKVD7R.js} +4 -4
- package/dist/{chunk-DT77O33T.js → chunk-JQXXPTWL.js} +1 -1
- package/dist/{chunk-PJ3ONBWZ.js → chunk-NYNSYLFY.js} +1 -1
- package/dist/{chunk-KWQKQVPH.js → chunk-OBULDJSU.js} +1 -1
- package/dist/{chunk-LEKOBVOQ.js → chunk-OHV7DYIS.js} +4 -5
- package/dist/{chunk-LZGPGPA6.js → chunk-PNFQDFHK.js} +1 -1
- package/dist/{chunk-BNERFXVO.js → chunk-QCG6UU2S.js} +1 -1
- package/dist/{chunk-Z7JROM3J.js → chunk-SAZGFYBU.js} +1 -1
- package/dist/{chunk-P2LB6S4I.js → chunk-SHG2QSQA.js} +1 -1
- package/dist/{chunk-USJF35NB.js → chunk-U3QWCBRG.js} +1 -1
- package/dist/{chunk-GQYRPBIQ.js → chunk-WYRW2W4O.js} +12 -12
- package/dist/{chunk-WYNPWHXB.js → chunk-Z4LVPM3N.js} +1 -1
- package/dist/{chunk-NV63EYFL.js → chunk-ZWEZNKDW.js} +1 -1
- package/dist/{chunk-YQUBYTDR.js → chunk-ZX3ZYRU7.js} +1 -1
- package/dist/{ci-VOGIC6S4.js → ci-KFVU4CHS.js} +5 -5
- package/dist/{ci-format-BHCSMT5U.js → ci-format-IFFCSCCN.js} +2 -2
- package/dist/{constants-J4OLBH72.js → constants-3C4JLZVQ.js} +1 -1
- package/dist/{doctor-cli-IR3E3XHB.js → doctor-cli-XJOK5LJZ.js} +5 -5
- package/dist/electron-server.js +170 -136
- package/dist/{hub-SFFFYMGO.js → hub-6TQFYGZO.js} +2 -2
- package/dist/index.js +31 -32
- package/dist/{indexer-4WWS3VIL.js → indexer-M2LJGTY2.js} +1 -1
- package/dist/{indexer-2AG4G6B5.js → indexer-VZETNE4H.js} +1 -1
- package/dist/{persist-WGIJ6RXY.js → persist-A2QSXYFY.js} +3 -3
- package/dist/{persistent-memory-EKZ2JF7M.js → persistent-memory-JBWBMA56.js} +2 -2
- package/dist/{persistent-memory-3KH2EVHA.js → persistent-memory-QQXFCUNL.js} +2 -2
- package/dist/{pr-BNS3OHDM.js → pr-TMPU2U2P.js} +5 -5
- package/dist/{run-tests-PW4WC4OG.js → run-tests-2A3CASVZ.js} +2 -2
- package/dist/{run-tests-ZKHXKCQB.js → run-tests-NNML2XVV.js} +2 -2
- package/dist/{server-D2ID3GYA.js → server-6L5XRY4K.js} +113 -93
- package/dist/{server-3HLBEWNZ.js → server-ANNA57CP.js} +8 -8
- package/dist/{task-orchestrator-FMCI4RPX.js → task-orchestrator-URY32ZSQ.js} +8 -9
- package/dist/{usage-DPLNMDSJ.js → usage-J46NVHYR.js} +4 -4
- package/package.json +5 -4
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import "./chunk-3ARPAVNV.js";
|
|
8
8
|
import {
|
|
9
9
|
persistDiscussion
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-JQXXPTWL.js";
|
|
11
11
|
import {
|
|
12
12
|
AuthManager,
|
|
13
13
|
TOKEN_EXPIRY_MS
|
|
@@ -23,12 +23,12 @@ import {
|
|
|
23
23
|
scanDirTree,
|
|
24
24
|
scanProject,
|
|
25
25
|
setupProxy
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-OHV7DYIS.js";
|
|
27
27
|
import {
|
|
28
28
|
computeCost,
|
|
29
29
|
formatCost,
|
|
30
30
|
getPricing
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-GUOLPI33.js";
|
|
32
32
|
import {
|
|
33
33
|
buildReviewPrompt,
|
|
34
34
|
buildSecurityReviewPrompt
|
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
spawnAgentContext,
|
|
64
64
|
truncateOutput,
|
|
65
65
|
undoStack
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-WYRW2W4O.js";
|
|
67
67
|
import {
|
|
68
68
|
addMemoryEntry,
|
|
69
69
|
clearMemoryEntries,
|
|
@@ -77,26 +77,26 @@ import {
|
|
|
77
77
|
parseWritableScope,
|
|
78
78
|
updateMemoryApproval,
|
|
79
79
|
updateMemoryEntry
|
|
80
|
-
} from "./chunk-
|
|
81
|
-
import "./chunk-
|
|
80
|
+
} from "./chunk-SAZGFYBU.js";
|
|
81
|
+
import "./chunk-GLSR2NR3.js";
|
|
82
82
|
import "./chunk-UUSRWSSX.js";
|
|
83
83
|
import "./chunk-CKH4KQ4E.js";
|
|
84
84
|
import "./chunk-BXP6YZ2P.js";
|
|
85
85
|
import {
|
|
86
86
|
SessionManager,
|
|
87
87
|
getContentText
|
|
88
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-OBULDJSU.js";
|
|
89
89
|
import {
|
|
90
90
|
buildDoctorReport,
|
|
91
91
|
formatDoctorReport,
|
|
92
92
|
loadContextFiles
|
|
93
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-23ZIOVZR.js";
|
|
94
94
|
import {
|
|
95
95
|
ProviderRegistry
|
|
96
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-2QZMITSL.js";
|
|
97
97
|
import {
|
|
98
98
|
ConfigManager
|
|
99
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-G77EIVBY.js";
|
|
100
100
|
import {
|
|
101
101
|
describePlugin,
|
|
102
102
|
getActivePluginAssets,
|
|
@@ -111,7 +111,7 @@ import {
|
|
|
111
111
|
runTool,
|
|
112
112
|
setPluginEnabled,
|
|
113
113
|
trustPlugin
|
|
114
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-Z4LVPM3N.js";
|
|
115
115
|
import {
|
|
116
116
|
CONTENT_ONLY_STREAM_REMINDER,
|
|
117
117
|
TEE_FINAL_USER_NUDGE,
|
|
@@ -135,7 +135,7 @@ import {
|
|
|
135
135
|
getGitRoot
|
|
136
136
|
} from "./chunk-HOSJZMQS.js";
|
|
137
137
|
import "./chunk-4BKXL7SM.js";
|
|
138
|
-
import "./chunk-
|
|
138
|
+
import "./chunk-BIZFOVNA.js";
|
|
139
139
|
import {
|
|
140
140
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
141
141
|
AUTHOR,
|
|
@@ -151,10 +151,10 @@ import {
|
|
|
151
151
|
SKILLS_DIR_NAME,
|
|
152
152
|
VERSION,
|
|
153
153
|
buildUserIdentityPrompt
|
|
154
|
-
} from "./chunk-
|
|
155
|
-
import "./chunk-
|
|
154
|
+
} from "./chunk-ZX3ZYRU7.js";
|
|
155
|
+
import "./chunk-6RPGQ5CG.js";
|
|
156
156
|
import "./chunk-KHYD3WXE.js";
|
|
157
|
-
import "./chunk-
|
|
157
|
+
import "./chunk-NYNSYLFY.js";
|
|
158
158
|
import {
|
|
159
159
|
scanString
|
|
160
160
|
} from "./chunk-B5TYJO7V.js";
|
|
@@ -166,8 +166,8 @@ import {
|
|
|
166
166
|
import express from "express";
|
|
167
167
|
import { createServer } from "http";
|
|
168
168
|
import { WebSocketServer } from "ws";
|
|
169
|
-
import { join as
|
|
170
|
-
import { existsSync as
|
|
169
|
+
import { join as join2, dirname as dirname3, resolve as resolve2, relative, sep } from "path";
|
|
170
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3, readdirSync as readdirSync2, statSync as statSync2, realpathSync } from "fs";
|
|
171
171
|
import { networkInterfaces } from "os";
|
|
172
172
|
|
|
173
173
|
// src/web/tool-executor-web.ts
|
|
@@ -243,33 +243,33 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
|
|
|
243
243
|
}
|
|
244
244
|
/** Resolve a pending confirm from client response */
|
|
245
245
|
resolveConfirm(requestId, approved) {
|
|
246
|
-
const
|
|
247
|
-
if (
|
|
246
|
+
const resolve3 = this.pendingConfirms.get(requestId);
|
|
247
|
+
if (resolve3) {
|
|
248
248
|
this.clearPendingTimer(requestId);
|
|
249
249
|
this.pendingConfirms.delete(requestId);
|
|
250
250
|
this.confirming = false;
|
|
251
|
-
|
|
251
|
+
resolve3(approved);
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
/** Resolve a pending batch confirm from client response */
|
|
255
255
|
resolveBatchConfirm(requestId, decision) {
|
|
256
|
-
const
|
|
257
|
-
if (
|
|
256
|
+
const resolve3 = this.pendingBatchConfirms.get(requestId);
|
|
257
|
+
if (resolve3) {
|
|
258
258
|
this.clearPendingTimer(requestId);
|
|
259
259
|
this.pendingBatchConfirms.delete(requestId);
|
|
260
260
|
this.confirming = false;
|
|
261
261
|
if (decision === "all" || decision === "none") {
|
|
262
|
-
|
|
262
|
+
resolve3(decision);
|
|
263
263
|
} else {
|
|
264
|
-
|
|
264
|
+
resolve3(new Set(decision));
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
/** Cancel all pending confirms (e.g., on disconnect) */
|
|
269
269
|
cancelAll() {
|
|
270
|
-
for (const
|
|
270
|
+
for (const resolve3 of this.pendingConfirms.values()) resolve3(false);
|
|
271
271
|
this.pendingConfirms.clear();
|
|
272
|
-
for (const
|
|
272
|
+
for (const resolve3 of this.pendingBatchConfirms.values()) resolve3("none");
|
|
273
273
|
this.pendingBatchConfirms.clear();
|
|
274
274
|
this.confirming = false;
|
|
275
275
|
}
|
|
@@ -345,8 +345,8 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
|
|
|
345
345
|
diff: this.getDiffPreview(call)
|
|
346
346
|
};
|
|
347
347
|
this.send(msg);
|
|
348
|
-
return new Promise((
|
|
349
|
-
this.pendingConfirms.set(requestId,
|
|
348
|
+
return new Promise((resolve3) => {
|
|
349
|
+
this.pendingConfirms.set(requestId, resolve3);
|
|
350
350
|
this.pendingTimers.set(requestId, setTimeout(() => {
|
|
351
351
|
if (this.pendingConfirms.has(requestId)) {
|
|
352
352
|
this.resolveConfirm(requestId, false);
|
|
@@ -370,8 +370,8 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
|
|
|
370
370
|
files
|
|
371
371
|
};
|
|
372
372
|
this.send(msg);
|
|
373
|
-
return new Promise((
|
|
374
|
-
this.pendingBatchConfirms.set(requestId,
|
|
373
|
+
return new Promise((resolve3) => {
|
|
374
|
+
this.pendingBatchConfirms.set(requestId, resolve3);
|
|
375
375
|
this.pendingTimers.set(requestId, setTimeout(() => {
|
|
376
376
|
if (this.pendingBatchConfirms.has(requestId)) {
|
|
377
377
|
this.resolveBatchConfirm(requestId, "none");
|
|
@@ -481,7 +481,7 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
|
|
|
481
481
|
return { callId: call.id, content: rejectionMsg, isError: true };
|
|
482
482
|
}
|
|
483
483
|
}
|
|
484
|
-
this.sendToolCallStart(call);
|
|
484
|
+
if (!toolCallStarted) this.sendToolCallStart(call);
|
|
485
485
|
if (this.sessionAutoMode && networkPermission?.action !== "confirm") {
|
|
486
486
|
const classification = defaultActionClassifier.classify(call, dangerLevel, {
|
|
487
487
|
workspaceRoot: this.workspaceRoot,
|
|
@@ -803,7 +803,7 @@ Cache: write=${cacheCreate} read=${cacheRead}` : "";
|
|
|
803
803
|
Cost: ${formatCost(cost)}` : "";
|
|
804
804
|
let memoryLine = "";
|
|
805
805
|
try {
|
|
806
|
-
const { countPendingMemories } = await import("./persistent-memory-
|
|
806
|
+
const { countPendingMemories } = await import("./persistent-memory-QQXFCUNL.js");
|
|
807
807
|
const pending = countPendingMemories(ctx.config.getConfigDir());
|
|
808
808
|
if (pending > 0) memoryLine = `
|
|
809
809
|
Memory: \u26A0 ${pending} pending approval \u2014 see the Memory panel or /memory`;
|
|
@@ -1110,7 +1110,7 @@ async function handleBranch(args, ctx) {
|
|
|
1110
1110
|
return;
|
|
1111
1111
|
}
|
|
1112
1112
|
const sub = args[0]?.toLowerCase();
|
|
1113
|
-
const
|
|
1113
|
+
const resolve3 = (ref) => {
|
|
1114
1114
|
const r = session.resolveBranchRef(ref);
|
|
1115
1115
|
if (r.ok) return r.id;
|
|
1116
1116
|
if (r.reason === "ambiguous") {
|
|
@@ -1164,7 +1164,7 @@ async function handleBranch(args, ctx) {
|
|
|
1164
1164
|
ctx.send({ type: "error", message: "Usage: /branch switch <id|title>" });
|
|
1165
1165
|
return;
|
|
1166
1166
|
}
|
|
1167
|
-
const id =
|
|
1167
|
+
const id = resolve3(ref);
|
|
1168
1168
|
if (!id) return;
|
|
1169
1169
|
const ok = session.switchBranch(id);
|
|
1170
1170
|
if (ok) {
|
|
@@ -1184,7 +1184,7 @@ async function handleBranch(args, ctx) {
|
|
|
1184
1184
|
ctx.send({ type: "error", message: "Usage: /branch delete <id|title>" });
|
|
1185
1185
|
return;
|
|
1186
1186
|
}
|
|
1187
|
-
const id =
|
|
1187
|
+
const id = resolve3(ref);
|
|
1188
1188
|
if (!id) return;
|
|
1189
1189
|
const ok = session.deleteBranch(id);
|
|
1190
1190
|
if (ok) {
|
|
@@ -1203,7 +1203,7 @@ async function handleBranch(args, ctx) {
|
|
|
1203
1203
|
ctx.send({ type: "error", message: "Usage: /branch rename <id|title> <new title>" });
|
|
1204
1204
|
return;
|
|
1205
1205
|
}
|
|
1206
|
-
const id =
|
|
1206
|
+
const id = resolve3(ref);
|
|
1207
1207
|
if (!id) return;
|
|
1208
1208
|
const ok = session.renameBranch(id, title);
|
|
1209
1209
|
if (ok) {
|
|
@@ -1221,7 +1221,7 @@ async function handleBranch(args, ctx) {
|
|
|
1221
1221
|
ctx.send({ type: "error", message: "Usage: /branch diff <id|title>" });
|
|
1222
1222
|
return;
|
|
1223
1223
|
}
|
|
1224
|
-
const id =
|
|
1224
|
+
const id = resolve3(ref);
|
|
1225
1225
|
if (!id) return;
|
|
1226
1226
|
const d = session.diffBranches(id);
|
|
1227
1227
|
if (!d) {
|
|
@@ -1263,7 +1263,7 @@ async function handleBranch(args, ctx) {
|
|
|
1263
1263
|
ctx.send({ type: "error", message: "Usage: /branch cherry-pick <source-id|title> <msg-index>" });
|
|
1264
1264
|
return;
|
|
1265
1265
|
}
|
|
1266
|
-
const id =
|
|
1266
|
+
const id = resolve3(ref);
|
|
1267
1267
|
if (!id) return;
|
|
1268
1268
|
const idx = parseInt(idxStr, 10);
|
|
1269
1269
|
if (Number.isNaN(idx)) {
|
|
@@ -1612,7 +1612,7 @@ async function handleSecurityReview(args, ctx) {
|
|
|
1612
1612
|
async function handleTest(args, ctx) {
|
|
1613
1613
|
ctx.send({ type: "info", message: "\u{1F9EA} Running tests..." });
|
|
1614
1614
|
try {
|
|
1615
|
-
const { executeTests } = await import("./run-tests-
|
|
1615
|
+
const { executeTests } = await import("./run-tests-2A3CASVZ.js");
|
|
1616
1616
|
const argStr = args.join(" ").trim();
|
|
1617
1617
|
let testArgs = {};
|
|
1618
1618
|
if (argStr) {
|
|
@@ -1769,7 +1769,7 @@ async function handleIndex(args, ctx) {
|
|
|
1769
1769
|
const sub = (args[0] ?? "status").toLowerCase();
|
|
1770
1770
|
const root = process.cwd();
|
|
1771
1771
|
const { loadIndex, clearIndex } = await import("./store-MWNHVGJT.js");
|
|
1772
|
-
const { indexProject } = await import("./indexer-
|
|
1772
|
+
const { indexProject } = await import("./indexer-VZETNE4H.js");
|
|
1773
1773
|
const { loadVectorStore, clearVectorStore } = await import("./vector-store-BBDXB5IQ.js");
|
|
1774
1774
|
if (sub === "status") {
|
|
1775
1775
|
const idx = loadIndex(root);
|
|
@@ -1876,7 +1876,7 @@ async function handleMemory(args, ctx) {
|
|
|
1876
1876
|
ctx.handleMemoryManage(sub, args[1], sub === "expire" ? args[2] : void 0);
|
|
1877
1877
|
} else if (sub === "export") {
|
|
1878
1878
|
if (args[1] === "md") {
|
|
1879
|
-
const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-
|
|
1879
|
+
const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-QQXFCUNL.js");
|
|
1880
1880
|
ctx.send({
|
|
1881
1881
|
type: "export_data",
|
|
1882
1882
|
format: "md",
|
|
@@ -2242,6 +2242,15 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
|
|
|
2242
2242
|
}
|
|
2243
2243
|
|
|
2244
2244
|
// src/web/session-handler.ts
|
|
2245
|
+
var CLI_ONLY_WEB_COMMANDS = /* @__PURE__ */ new Set([
|
|
2246
|
+
"copy",
|
|
2247
|
+
"paste",
|
|
2248
|
+
"exit",
|
|
2249
|
+
"quit",
|
|
2250
|
+
"snapshot",
|
|
2251
|
+
"hooks",
|
|
2252
|
+
"hook"
|
|
2253
|
+
]);
|
|
2245
2254
|
var webCommandHandlers = {
|
|
2246
2255
|
provider: handleProvider,
|
|
2247
2256
|
model: handleModel,
|
|
@@ -2479,10 +2488,10 @@ var SessionHandler = class {
|
|
|
2479
2488
|
return;
|
|
2480
2489
|
}
|
|
2481
2490
|
case "ask_user_response": {
|
|
2482
|
-
const
|
|
2483
|
-
if (
|
|
2491
|
+
const resolve3 = this.pendingAskUser.get(msg.requestId);
|
|
2492
|
+
if (resolve3) {
|
|
2484
2493
|
this.pendingAskUser.delete(msg.requestId);
|
|
2485
|
-
|
|
2494
|
+
resolve3(msg.answer);
|
|
2486
2495
|
}
|
|
2487
2496
|
return;
|
|
2488
2497
|
}
|
|
@@ -2495,10 +2504,10 @@ var SessionHandler = class {
|
|
|
2495
2504
|
case "memory_manage":
|
|
2496
2505
|
return this.handleMemoryManage(msg.action, msg.id, msg.expiresAt);
|
|
2497
2506
|
case "auto_pause_response": {
|
|
2498
|
-
const
|
|
2499
|
-
if (
|
|
2507
|
+
const resolve3 = this.pendingAutoPause.get(msg.requestId);
|
|
2508
|
+
if (resolve3) {
|
|
2500
2509
|
this.pendingAutoPause.delete(msg.requestId);
|
|
2501
|
-
|
|
2510
|
+
resolve3({ action: msg.action, message: msg.message });
|
|
2502
2511
|
}
|
|
2503
2512
|
return;
|
|
2504
2513
|
}
|
|
@@ -2513,10 +2522,10 @@ var SessionHandler = class {
|
|
|
2513
2522
|
this.hubOrchestrator?.abort();
|
|
2514
2523
|
return;
|
|
2515
2524
|
case "hub_steer": {
|
|
2516
|
-
const
|
|
2517
|
-
if (
|
|
2525
|
+
const resolve3 = this.pendingHubReview.get(msg.requestId);
|
|
2526
|
+
if (resolve3) {
|
|
2518
2527
|
this.pendingHubReview.delete(msg.requestId);
|
|
2519
|
-
|
|
2528
|
+
resolve3({ action: msg.action, message: msg.message });
|
|
2520
2529
|
}
|
|
2521
2530
|
return;
|
|
2522
2531
|
}
|
|
@@ -2529,9 +2538,9 @@ var SessionHandler = class {
|
|
|
2529
2538
|
runLifecycleHooks(mergePluginHooks(this.config.get("hooks") ?? void 0, this.config.getConfigDir()), "Stop", { sessionId: this.sessions.current?.id }, { configDir: this.config.getConfigDir() });
|
|
2530
2539
|
this.toolExecutor.cancelAll();
|
|
2531
2540
|
if (this.abortController) this.abortController.abort();
|
|
2532
|
-
for (const
|
|
2541
|
+
for (const resolve3 of this.pendingAskUser.values()) resolve3(null);
|
|
2533
2542
|
this.pendingAskUser.clear();
|
|
2534
|
-
for (const
|
|
2543
|
+
for (const resolve3 of this.pendingAutoPause.values()) resolve3({ action: "stop" });
|
|
2535
2544
|
this.pendingAutoPause.clear();
|
|
2536
2545
|
this.saveIfNeeded();
|
|
2537
2546
|
if (this._bashSessionKey) clearBashSession(this._bashSessionKey);
|
|
@@ -2666,9 +2675,9 @@ var SessionHandler = class {
|
|
|
2666
2675
|
this.hubOrchestrator = orchestrator;
|
|
2667
2676
|
orchestrator.onEvent = (event) => this.send({ type: "hub_event", event });
|
|
2668
2677
|
if (config.humanSteer) {
|
|
2669
|
-
orchestrator.onRoundReview = ({ round, maxRounds }) => new Promise((
|
|
2678
|
+
orchestrator.onRoundReview = ({ round, maxRounds }) => new Promise((resolve3) => {
|
|
2670
2679
|
const requestId = `hubrev_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
2671
|
-
this.pendingHubReview.set(requestId,
|
|
2680
|
+
this.pendingHubReview.set(requestId, resolve3);
|
|
2672
2681
|
this.send({ type: "hub_review", requestId, round, maxRounds });
|
|
2673
2682
|
});
|
|
2674
2683
|
}
|
|
@@ -3026,8 +3035,8 @@ Try: /compact to reduce context, /clear to reset, or switch to a larger-context
|
|
|
3026
3035
|
onMcpToolUsed: (name) => this.usedMcpToolNames.add(name),
|
|
3027
3036
|
requestAutoPause: async ({ effectiveRound, maxToolRounds: totalRounds, toolSummary }) => {
|
|
3028
3037
|
const requestId = `pause_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
3029
|
-
const pauseResp = await new Promise((
|
|
3030
|
-
this.pendingAutoPause.set(requestId,
|
|
3038
|
+
const pauseResp = await new Promise((resolve3) => {
|
|
3039
|
+
this.pendingAutoPause.set(requestId, resolve3);
|
|
3031
3040
|
this.send({
|
|
3032
3041
|
type: "auto_pause_request",
|
|
3033
3042
|
requestId,
|
|
@@ -3206,8 +3215,8 @@ ${summaryContent}`,
|
|
|
3206
3215
|
}
|
|
3207
3216
|
if (chunk.done) break;
|
|
3208
3217
|
}
|
|
3209
|
-
await new Promise((
|
|
3210
|
-
fileStream.end((err) => err ? reject(err) :
|
|
3218
|
+
await new Promise((resolve3, reject) => {
|
|
3219
|
+
fileStream.end((err) => err ? reject(err) : resolve3());
|
|
3211
3220
|
});
|
|
3212
3221
|
const verdict = evaluateTeeContent(fullContent, saveToFile, priorContent);
|
|
3213
3222
|
if (verdict.kind === "reject") {
|
|
@@ -3233,7 +3242,7 @@ ${summaryContent}`,
|
|
|
3233
3242
|
} catch (err) {
|
|
3234
3243
|
if (fileStream) {
|
|
3235
3244
|
try {
|
|
3236
|
-
await new Promise((
|
|
3245
|
+
await new Promise((resolve3) => fileStream.end(() => resolve3()));
|
|
3237
3246
|
} catch {
|
|
3238
3247
|
}
|
|
3239
3248
|
}
|
|
@@ -3281,6 +3290,13 @@ ${summaryContent}`,
|
|
|
3281
3290
|
}
|
|
3282
3291
|
// ── Commands ─────────────────────────────────────────────────────
|
|
3283
3292
|
async handleCommand(name, args) {
|
|
3293
|
+
if (CLI_ONLY_WEB_COMMANDS.has(name)) {
|
|
3294
|
+
this.send({
|
|
3295
|
+
type: "error",
|
|
3296
|
+
message: `/${name} is only available in the terminal REPL. Run \`aicli\` in a terminal and use /${name} there.`
|
|
3297
|
+
});
|
|
3298
|
+
return;
|
|
3299
|
+
}
|
|
3284
3300
|
const handler = webCommandHandlers[name];
|
|
3285
3301
|
if (handler) {
|
|
3286
3302
|
await handler(args, this);
|
|
@@ -3556,7 +3572,7 @@ Backup saved: ${result.backupPath}` : "";
|
|
|
3556
3572
|
return;
|
|
3557
3573
|
}
|
|
3558
3574
|
try {
|
|
3559
|
-
const { searchChatMemory, loadChatIndex } = await import("./chat-index-
|
|
3575
|
+
const { searchChatMemory, loadChatIndex } = await import("./chat-index-7MMTGQNA.js");
|
|
3560
3576
|
const loaded = loadChatIndex();
|
|
3561
3577
|
if (!loaded || loaded.idx.chunks.length === 0) {
|
|
3562
3578
|
this.send({ type: "memory_hits", query: q, hits: [], indexMissing: true });
|
|
@@ -3592,7 +3608,7 @@ Backup saved: ${result.backupPath}` : "";
|
|
|
3592
3608
|
}
|
|
3593
3609
|
async handleMemoryStatus() {
|
|
3594
3610
|
try {
|
|
3595
|
-
const { getChatIndexStatus } = await import("./chat-index-
|
|
3611
|
+
const { getChatIndexStatus } = await import("./chat-index-7MMTGQNA.js");
|
|
3596
3612
|
const s = getChatIndexStatus();
|
|
3597
3613
|
this.send({
|
|
3598
3614
|
type: "memory_status",
|
|
@@ -3617,7 +3633,7 @@ Backup saved: ${result.backupPath}` : "";
|
|
|
3617
3633
|
type: "info",
|
|
3618
3634
|
message: full ? "\u{1F9E0} Rebuilding chat memory index (this may take a while on first run \u2014 ~117 MB embedder)." : "\u{1F9E0} Refreshing chat memory index (incremental)\u2026"
|
|
3619
3635
|
});
|
|
3620
|
-
const { buildChatIndex } = await import("./chat-index-
|
|
3636
|
+
const { buildChatIndex } = await import("./chat-index-7MMTGQNA.js");
|
|
3621
3637
|
const stats = await buildChatIndex({
|
|
3622
3638
|
full,
|
|
3623
3639
|
onProgress: (p) => {
|
|
@@ -3771,7 +3787,7 @@ function getModuleDir() {
|
|
|
3771
3787
|
}
|
|
3772
3788
|
} catch {
|
|
3773
3789
|
}
|
|
3774
|
-
return
|
|
3790
|
+
return resolve2(".");
|
|
3775
3791
|
}
|
|
3776
3792
|
async function startWebServer(options = {}) {
|
|
3777
3793
|
const port = options.port ?? 3e3;
|
|
@@ -3839,8 +3855,8 @@ async function startWebServer(options = {}) {
|
|
|
3839
3855
|
}
|
|
3840
3856
|
}
|
|
3841
3857
|
let skillManager = null;
|
|
3842
|
-
const skillsDir =
|
|
3843
|
-
if (
|
|
3858
|
+
const skillsDir = join2(config.getConfigDir(), SKILLS_DIR_NAME);
|
|
3859
|
+
if (existsSync3(skillsDir)) {
|
|
3844
3860
|
skillManager = new SkillManager(skillsDir, config.get("ui").skillSizeWarn);
|
|
3845
3861
|
skillManager.loadSkills(pluginAssets.skillDirs);
|
|
3846
3862
|
const count = skillManager.listSkills().length;
|
|
@@ -3891,6 +3907,10 @@ async function startWebServer(options = {}) {
|
|
|
3891
3907
|
console.log(` Auth: ${authManager.listUsers().length} user(s) registered`);
|
|
3892
3908
|
} else {
|
|
3893
3909
|
console.log(` Auth: disabled (no users registered)`);
|
|
3910
|
+
if (host === "0.0.0.0" || host === "::") {
|
|
3911
|
+
console.log(" WARNING: Web UI is reachable from the network without authentication.");
|
|
3912
|
+
console.log(" Create a user first for LAN/team use: aicli user create <name>");
|
|
3913
|
+
}
|
|
3894
3914
|
}
|
|
3895
3915
|
const requireAuth = (req, res, next) => {
|
|
3896
3916
|
if (!authManager.isEnabled()) return next();
|
|
@@ -3911,18 +3931,18 @@ async function startWebServer(options = {}) {
|
|
|
3911
3931
|
next();
|
|
3912
3932
|
};
|
|
3913
3933
|
const moduleDir = getModuleDir();
|
|
3914
|
-
let clientDir =
|
|
3915
|
-
if (!
|
|
3916
|
-
clientDir =
|
|
3934
|
+
let clientDir = join2(moduleDir, "web", "client");
|
|
3935
|
+
if (!existsSync3(clientDir)) {
|
|
3936
|
+
clientDir = join2(moduleDir, "client");
|
|
3917
3937
|
}
|
|
3918
|
-
if (!
|
|
3919
|
-
clientDir =
|
|
3938
|
+
if (!existsSync3(clientDir)) {
|
|
3939
|
+
clientDir = join2(moduleDir, "..", "..", "src", "web", "client");
|
|
3920
3940
|
}
|
|
3921
|
-
if (!
|
|
3922
|
-
clientDir =
|
|
3941
|
+
if (!existsSync3(clientDir)) {
|
|
3942
|
+
clientDir = join2(process.cwd(), "src", "web", "client");
|
|
3923
3943
|
}
|
|
3924
3944
|
console.log(` Static files: ${clientDir}`);
|
|
3925
|
-
app.use("/vendor", express.static(
|
|
3945
|
+
app.use("/vendor", express.static(join2(clientDir, "vendor"), { maxAge: "1y", immutable: true }));
|
|
3926
3946
|
app.use(express.static(clientDir));
|
|
3927
3947
|
app.get("/api/status", (_req, res) => {
|
|
3928
3948
|
res.json({
|
|
@@ -3989,10 +4009,10 @@ async function startWebServer(options = {}) {
|
|
|
3989
4009
|
app.get("/api/files", requireAuth, (req, res) => {
|
|
3990
4010
|
const cwd = process.cwd();
|
|
3991
4011
|
const prefix = req.query.prefix || "";
|
|
3992
|
-
const targetDir =
|
|
4012
|
+
const targetDir = join2(cwd, prefix);
|
|
3993
4013
|
try {
|
|
3994
|
-
const canonicalTarget = realpathSync(
|
|
3995
|
-
const canonicalCwd = realpathSync(
|
|
4014
|
+
const canonicalTarget = realpathSync(resolve2(targetDir));
|
|
4015
|
+
const canonicalCwd = realpathSync(resolve2(cwd));
|
|
3996
4016
|
if (!canonicalTarget.startsWith(canonicalCwd + sep) && canonicalTarget !== canonicalCwd) {
|
|
3997
4017
|
res.json({ files: [] });
|
|
3998
4018
|
return;
|
|
@@ -4003,10 +4023,10 @@ async function startWebServer(options = {}) {
|
|
|
4003
4023
|
}
|
|
4004
4024
|
try {
|
|
4005
4025
|
const SKIP = /* @__PURE__ */ new Set(["node_modules", ".git", "dist", "dist-cjs", "release", "__pycache__", ".next", ".nuxt", "coverage", ".cache"]);
|
|
4006
|
-
const entries =
|
|
4026
|
+
const entries = readdirSync2(targetDir, { withFileTypes: true });
|
|
4007
4027
|
const files = entries.filter((e) => !SKIP.has(e.name) && !e.name.startsWith(".")).slice(0, 50).map((e) => ({
|
|
4008
4028
|
name: e.name,
|
|
4009
|
-
path: relative(cwd,
|
|
4029
|
+
path: relative(cwd, join2(targetDir, e.name)).replace(/\\/g, "/"),
|
|
4010
4030
|
isDir: e.isDirectory()
|
|
4011
4031
|
}));
|
|
4012
4032
|
res.json({ files });
|
|
@@ -4046,8 +4066,8 @@ async function startWebServer(options = {}) {
|
|
|
4046
4066
|
try {
|
|
4047
4067
|
const authUser = req._authUser;
|
|
4048
4068
|
const histDir = authUser ? getUserShared(authUser).config.getHistoryDir() : config.getHistoryDir();
|
|
4049
|
-
const filePath =
|
|
4050
|
-
if (!
|
|
4069
|
+
const filePath = join2(histDir, `${id}.json`);
|
|
4070
|
+
if (!existsSync3(filePath)) {
|
|
4051
4071
|
res.status(404).json({ error: "Session not found" });
|
|
4052
4072
|
return;
|
|
4053
4073
|
}
|
|
@@ -4062,7 +4082,7 @@ async function startWebServer(options = {}) {
|
|
|
4062
4082
|
res.status(404).json({ error: "Session not found" });
|
|
4063
4083
|
return;
|
|
4064
4084
|
}
|
|
4065
|
-
const data = JSON.parse(
|
|
4085
|
+
const data = JSON.parse(readFileSync3(filePath, "utf-8"));
|
|
4066
4086
|
res.json({ session: data });
|
|
4067
4087
|
} catch (err) {
|
|
4068
4088
|
res.status(500).json({ error: err instanceof Error ? err.message : String(err) });
|
|
@@ -4075,10 +4095,10 @@ async function startWebServer(options = {}) {
|
|
|
4075
4095
|
return;
|
|
4076
4096
|
}
|
|
4077
4097
|
const cwd = process.cwd();
|
|
4078
|
-
const fullPath =
|
|
4098
|
+
const fullPath = resolve2(join2(cwd, filePath));
|
|
4079
4099
|
try {
|
|
4080
4100
|
const canonicalFull = realpathSync(fullPath);
|
|
4081
|
-
const canonicalCwd = realpathSync(
|
|
4101
|
+
const canonicalCwd = realpathSync(resolve2(cwd));
|
|
4082
4102
|
if (!canonicalFull.startsWith(canonicalCwd + sep) && canonicalFull !== canonicalCwd) {
|
|
4083
4103
|
res.json({ error: "Access denied" });
|
|
4084
4104
|
return;
|
|
@@ -4088,12 +4108,12 @@ async function startWebServer(options = {}) {
|
|
|
4088
4108
|
return;
|
|
4089
4109
|
}
|
|
4090
4110
|
try {
|
|
4091
|
-
const stat =
|
|
4111
|
+
const stat = statSync2(fullPath);
|
|
4092
4112
|
if (stat.size > 512 * 1024) {
|
|
4093
4113
|
res.json({ error: `File too large (${(stat.size / 1024).toFixed(0)} KB, max 512 KB)` });
|
|
4094
4114
|
return;
|
|
4095
4115
|
}
|
|
4096
|
-
const content =
|
|
4116
|
+
const content = readFileSync3(fullPath, "utf-8");
|
|
4097
4117
|
res.json({ content, size: stat.size });
|
|
4098
4118
|
} catch {
|
|
4099
4119
|
res.json({ error: "Cannot read file" });
|
|
@@ -4222,7 +4242,7 @@ async function startWebServer(options = {}) {
|
|
|
4222
4242
|
ws.send(JSON.stringify({ type: "auth_result", success: false, error: err }));
|
|
4223
4243
|
return;
|
|
4224
4244
|
}
|
|
4225
|
-
|
|
4245
|
+
authManager.login(username, password);
|
|
4226
4246
|
authenticatedUser = username;
|
|
4227
4247
|
const userShared = getUserShared(username);
|
|
4228
4248
|
handler = new SessionHandler(ws, userShared);
|
|
@@ -4297,7 +4317,7 @@ async function startWebServer(options = {}) {
|
|
|
4297
4317
|
});
|
|
4298
4318
|
const MAX_PORT_ATTEMPTS = 10;
|
|
4299
4319
|
let actualPort = port;
|
|
4300
|
-
const result = await new Promise((
|
|
4320
|
+
const result = await new Promise((resolve3, reject) => {
|
|
4301
4321
|
const tryListen = (attempt) => {
|
|
4302
4322
|
server.once("error", (err) => {
|
|
4303
4323
|
if (err.code === "EADDRINUSE" && attempt < MAX_PORT_ATTEMPTS) {
|
|
@@ -4328,7 +4348,7 @@ async function startWebServer(options = {}) {
|
|
|
4328
4348
|
}
|
|
4329
4349
|
console.log(` Press Ctrl+C to stop
|
|
4330
4350
|
`);
|
|
4331
|
-
|
|
4351
|
+
resolve3({ port: actualPort, host, url });
|
|
4332
4352
|
});
|
|
4333
4353
|
};
|
|
4334
4354
|
tryListen(1);
|
|
@@ -4348,17 +4368,17 @@ function resolveProjectMcpPath() {
|
|
|
4348
4368
|
const cwd = process.cwd();
|
|
4349
4369
|
const gitRoot = getGitRoot(cwd);
|
|
4350
4370
|
const projectRoot = gitRoot ?? cwd;
|
|
4351
|
-
const configPath =
|
|
4352
|
-
return
|
|
4371
|
+
const configPath = join2(projectRoot, MCP_PROJECT_CONFIG_NAME);
|
|
4372
|
+
return existsSync3(configPath) ? configPath : null;
|
|
4353
4373
|
}
|
|
4354
4374
|
function loadProjectMcpConfig() {
|
|
4355
4375
|
const cwd = process.cwd();
|
|
4356
4376
|
const gitRoot = getGitRoot(cwd);
|
|
4357
4377
|
const projectRoot = gitRoot ?? cwd;
|
|
4358
|
-
const configPath =
|
|
4359
|
-
if (!
|
|
4378
|
+
const configPath = join2(projectRoot, MCP_PROJECT_CONFIG_NAME);
|
|
4379
|
+
if (!existsSync3(configPath)) return null;
|
|
4360
4380
|
try {
|
|
4361
|
-
const raw = JSON.parse(
|
|
4381
|
+
const raw = JSON.parse(readFileSync3(configPath, "utf-8"));
|
|
4362
4382
|
return raw.mcpServers ?? raw;
|
|
4363
4383
|
} catch {
|
|
4364
4384
|
return null;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ToolRegistry
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-WYRW2W4O.js";
|
|
5
|
+
import "./chunk-SAZGFYBU.js";
|
|
6
|
+
import "./chunk-GLSR2NR3.js";
|
|
7
7
|
import "./chunk-UUSRWSSX.js";
|
|
8
8
|
import "./chunk-CKH4KQ4E.js";
|
|
9
9
|
import "./chunk-BXP6YZ2P.js";
|
|
10
10
|
import {
|
|
11
11
|
runTool
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-Z4LVPM3N.js";
|
|
13
13
|
import {
|
|
14
14
|
getDangerLevel,
|
|
15
15
|
schemaToJsonSchema
|
|
@@ -17,13 +17,13 @@ import {
|
|
|
17
17
|
import "./chunk-5ULLIOVC.js";
|
|
18
18
|
import "./chunk-HOSJZMQS.js";
|
|
19
19
|
import "./chunk-4BKXL7SM.js";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-BIZFOVNA.js";
|
|
21
21
|
import {
|
|
22
22
|
VERSION
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-ZX3ZYRU7.js";
|
|
24
|
+
import "./chunk-6RPGQ5CG.js";
|
|
25
25
|
import "./chunk-KHYD3WXE.js";
|
|
26
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-NYNSYLFY.js";
|
|
27
27
|
import "./chunk-B5TYJO7V.js";
|
|
28
28
|
import "./chunk-IW3Q7AE5.js";
|
|
29
29
|
|
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
ToolRegistry,
|
|
4
4
|
googleSearchContext,
|
|
5
5
|
truncateOutput
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-WYRW2W4O.js";
|
|
7
|
+
import "./chunk-SAZGFYBU.js";
|
|
8
|
+
import "./chunk-GLSR2NR3.js";
|
|
9
9
|
import "./chunk-UUSRWSSX.js";
|
|
10
10
|
import "./chunk-CKH4KQ4E.js";
|
|
11
11
|
import "./chunk-BXP6YZ2P.js";
|
|
12
12
|
import {
|
|
13
13
|
runTool
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-Z4LVPM3N.js";
|
|
15
15
|
import {
|
|
16
16
|
getDangerLevel,
|
|
17
17
|
runLeanAgentLoop
|
|
@@ -19,13 +19,13 @@ import {
|
|
|
19
19
|
import "./chunk-5ULLIOVC.js";
|
|
20
20
|
import "./chunk-HOSJZMQS.js";
|
|
21
21
|
import "./chunk-4BKXL7SM.js";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-BIZFOVNA.js";
|
|
23
23
|
import {
|
|
24
24
|
SUBAGENT_ALLOWED_TOOLS
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-ZX3ZYRU7.js";
|
|
26
|
+
import "./chunk-6RPGQ5CG.js";
|
|
27
27
|
import "./chunk-KHYD3WXE.js";
|
|
28
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-NYNSYLFY.js";
|
|
29
29
|
import "./chunk-B5TYJO7V.js";
|
|
30
30
|
import {
|
|
31
31
|
atomicWriteFileSync
|
|
@@ -149,7 +149,6 @@ var TaskToolExecutor = class {
|
|
|
149
149
|
this.onToolCall = onToolCall;
|
|
150
150
|
this.onToolResult = onToolResult;
|
|
151
151
|
}
|
|
152
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
153
152
|
setRoundInfo(_current, _total) {
|
|
154
153
|
}
|
|
155
154
|
async execute(call) {
|