jinzd-ai-cli 0.4.271 → 0.4.273
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-FPDT2USZ.js → batch-LOW3GM26.js} +2 -2
- package/dist/{chat-index-7MMTGQNA.js → chat-index-2D5GK2DB.js} +2 -2
- package/dist/{chat-index-Q6BKWWAM.js → chat-index-TDU3S2MG.js} +2 -2
- package/dist/{chunk-B5TYJO7V.js → chunk-3FEZSLGI.js} +51 -6
- package/dist/{chunk-BFPF3JF2.js → chunk-4FIDMC2K.js} +3 -3
- package/dist/{chunk-OBULDJSU.js → chunk-CGDYO52A.js} +1 -1
- package/dist/{chunk-FT3WS5PG.js → chunk-EDAUDILT.js} +1 -1
- package/dist/{chunk-PDRAOFGI.js → chunk-FHXLAJJG.js} +1 -1
- package/dist/{chunk-RNDHIERN.js → chunk-FN7DE4HA.js} +3 -3
- package/dist/{chunk-RLAUMACS.js → chunk-FNLWPYP5.js} +1 -1
- package/dist/{chunk-YVTASHS5.js → chunk-FSC6KEWU.js} +51 -6
- package/dist/{chunk-6RPGQ5CG.js → chunk-GHWZVPUV.js} +1 -1
- package/dist/{chunk-5JFRM47R.js → chunk-LEK5WGKV.js} +1 -1
- package/dist/{chunk-VPXNLE7E.js → chunk-M3NXF4GD.js} +2 -2
- package/dist/{chunk-PG7O7N7D.js → chunk-MTQBSOZW.js} +3 -3
- package/dist/{chunk-JQXXPTWL.js → chunk-MX75TNE5.js} +1 -1
- package/dist/{chunk-V26ZMB3D.js → chunk-R4YGDJPL.js} +5 -5
- package/dist/{chunk-PMRU2CAF.js → chunk-T65VFCID.js} +1 -1
- package/dist/{chunk-OSYK6D4G.js → chunk-WSCZRQDR.js} +1 -1
- package/dist/{chunk-ZWEZNKDW.js → chunk-YOVHMQEJ.js} +1 -1
- package/dist/{chunk-4UNRDXZV.js → chunk-Z3UXZ5EI.js} +2 -2
- package/dist/{chunk-2RN4T4XD.js → chunk-ZWCQQZT5.js} +1 -1
- package/dist/{ci-VPN5RWCO.js → ci-C5YMQXCS.js} +4 -4
- package/dist/{ci-format-GKXVCVME.js → ci-format-R6EMNOGZ.js} +2 -2
- package/dist/{constants-Y43DJFGV.js → constants-QJCNMBPJ.js} +1 -1
- package/dist/{doctor-cli-RZGZB2TF.js → doctor-cli-5CM2I6OF.js} +4 -4
- package/dist/electron-server.js +162 -80
- package/dist/{hub-FJWP6SDG.js → hub-7JBSZOSD.js} +2 -2
- package/dist/index.js +23 -23
- package/dist/{persist-A2QSXYFY.js → persist-PQM4BRI4.js} +3 -3
- package/dist/{persistent-memory-IR47JCTF.js → persistent-memory-4E53HW3U.js} +3 -3
- package/dist/{persistent-memory-KX2R67AT.js → persistent-memory-KYRY56PG.js} +3 -3
- package/dist/{pr-NTQ3N4B4.js → pr-NPUGZSXB.js} +4 -4
- package/dist/{run-tests-25CNXJ4N.js → run-tests-5FHQ5IBX.js} +2 -2
- package/dist/{run-tests-UTES6HCT.js → run-tests-SU5CDQKF.js} +2 -2
- package/dist/{server-IGCCSX4B.js → server-77YS5NNN.js} +7 -7
- package/dist/{server-R56CVHCM.js → server-ER36M7TR.js} +149 -67
- package/dist/{task-orchestrator-MFYEKR2I.js → task-orchestrator-56PQ7LGV.js} +7 -7
- package/dist/{usage-FHX7PQQH.js → usage-3YATXRFZ.js} +2 -2
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./chunk-RYQBBEMM.js";
|
|
12
12
|
import {
|
|
13
13
|
persistDiscussion
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-MX75TNE5.js";
|
|
15
15
|
import {
|
|
16
16
|
AUTO_COMPACT_INSTRUCTION,
|
|
17
17
|
McpManager,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
scanProject,
|
|
35
35
|
setupProxy,
|
|
36
36
|
stripRoutingTags
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-4FIDMC2K.js";
|
|
38
38
|
import {
|
|
39
39
|
CNY_PER_USD,
|
|
40
40
|
CostTracker,
|
|
@@ -75,7 +75,7 @@ import {
|
|
|
75
75
|
spawnAgentContext,
|
|
76
76
|
truncateOutput,
|
|
77
77
|
undoStack
|
|
78
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-R4YGDJPL.js";
|
|
79
79
|
import {
|
|
80
80
|
buildReviewPrompt,
|
|
81
81
|
buildSecurityReviewPrompt
|
|
@@ -83,10 +83,12 @@ import {
|
|
|
83
83
|
import {
|
|
84
84
|
thinkingParamsFor
|
|
85
85
|
} from "./chunk-6YZEZFX5.js";
|
|
86
|
-
import "./chunk-
|
|
86
|
+
import "./chunk-GHWZVPUV.js";
|
|
87
87
|
import {
|
|
88
88
|
addMemoryEntry,
|
|
89
|
+
backupMemoryStore,
|
|
89
90
|
clearMemoryEntries,
|
|
91
|
+
countPendingMemories,
|
|
90
92
|
deleteMemoryEntry,
|
|
91
93
|
expireMemoryEntry,
|
|
92
94
|
exportMemoryEntries,
|
|
@@ -96,9 +98,11 @@ import {
|
|
|
96
98
|
listOrphanedProjectMemories,
|
|
97
99
|
memoryStorePath,
|
|
98
100
|
parseWritableScope,
|
|
101
|
+
rebindMemoryProject,
|
|
102
|
+
restoreMemoryEntries,
|
|
99
103
|
updateMemoryApproval,
|
|
100
104
|
updateMemoryEntry
|
|
101
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-Z3UXZ5EI.js";
|
|
102
106
|
import "./chunk-GLSR2NR3.js";
|
|
103
107
|
import "./chunk-UUSRWSSX.js";
|
|
104
108
|
import "./chunk-CKH4KQ4E.js";
|
|
@@ -108,16 +112,16 @@ import "./chunk-5C76XDDF.js";
|
|
|
108
112
|
import {
|
|
109
113
|
SessionManager,
|
|
110
114
|
getContentText
|
|
111
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-CGDYO52A.js";
|
|
112
116
|
import "./chunk-NYNSYLFY.js";
|
|
113
117
|
import {
|
|
114
118
|
scanString
|
|
115
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-3FEZSLGI.js";
|
|
116
120
|
import {
|
|
117
121
|
buildDoctorReport,
|
|
118
122
|
formatDoctorReport,
|
|
119
123
|
loadContextFiles
|
|
120
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-MTQBSOZW.js";
|
|
121
125
|
import {
|
|
122
126
|
describePlugin,
|
|
123
127
|
getActivePluginAssets,
|
|
@@ -132,13 +136,13 @@ import {
|
|
|
132
136
|
runTool,
|
|
133
137
|
setPluginEnabled,
|
|
134
138
|
trustPlugin
|
|
135
|
-
} from "./chunk-
|
|
139
|
+
} from "./chunk-FHXLAJJG.js";
|
|
136
140
|
import {
|
|
137
141
|
ProviderRegistry
|
|
138
142
|
} from "./chunk-AUEX6RNY.js";
|
|
139
143
|
import {
|
|
140
144
|
ConfigManager
|
|
141
|
-
} from "./chunk-
|
|
145
|
+
} from "./chunk-T65VFCID.js";
|
|
142
146
|
import {
|
|
143
147
|
CONTENT_ONLY_STREAM_REMINDER,
|
|
144
148
|
TEE_FINAL_USER_NUDGE,
|
|
@@ -170,7 +174,7 @@ import {
|
|
|
170
174
|
maskConfigSecrets
|
|
171
175
|
} from "./chunk-XNFIYS7G.js";
|
|
172
176
|
import "./chunk-4BKXL7SM.js";
|
|
173
|
-
import "./chunk-
|
|
177
|
+
import "./chunk-WSCZRQDR.js";
|
|
174
178
|
import {
|
|
175
179
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
176
180
|
AUTHOR,
|
|
@@ -186,13 +190,13 @@ import {
|
|
|
186
190
|
SKILLS_DIR_NAME,
|
|
187
191
|
VERSION,
|
|
188
192
|
buildUserIdentityPrompt
|
|
189
|
-
} from "./chunk-
|
|
193
|
+
} from "./chunk-EDAUDILT.js";
|
|
190
194
|
|
|
191
195
|
// src/web/server.ts
|
|
192
196
|
import express from "express";
|
|
193
197
|
import { createServer } from "http";
|
|
194
198
|
import { WebSocketServer } from "ws";
|
|
195
|
-
import { join as join2, dirname as dirname3, resolve as
|
|
199
|
+
import { join as join2, dirname as dirname3, resolve as resolve3, relative, sep as sep2, extname, resolve as resolvePath } from "path";
|
|
196
200
|
import { existsSync as existsSync3, readFileSync as readFileSync3, readdirSync as readdirSync2, statSync as statSync2, realpathSync, createReadStream } from "fs";
|
|
197
201
|
import { networkInterfaces } from "os";
|
|
198
202
|
|
|
@@ -271,33 +275,33 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
|
|
|
271
275
|
}
|
|
272
276
|
/** Resolve a pending confirm from client response */
|
|
273
277
|
resolveConfirm(requestId, approved) {
|
|
274
|
-
const
|
|
275
|
-
if (
|
|
278
|
+
const resolve4 = this.pendingConfirms.get(requestId);
|
|
279
|
+
if (resolve4) {
|
|
276
280
|
this.clearPendingTimer(requestId);
|
|
277
281
|
this.pendingConfirms.delete(requestId);
|
|
278
282
|
this.confirming = false;
|
|
279
|
-
|
|
283
|
+
resolve4(approved);
|
|
280
284
|
}
|
|
281
285
|
}
|
|
282
286
|
/** Resolve a pending batch confirm from client response */
|
|
283
287
|
resolveBatchConfirm(requestId, decision) {
|
|
284
|
-
const
|
|
285
|
-
if (
|
|
288
|
+
const resolve4 = this.pendingBatchConfirms.get(requestId);
|
|
289
|
+
if (resolve4) {
|
|
286
290
|
this.clearPendingTimer(requestId);
|
|
287
291
|
this.pendingBatchConfirms.delete(requestId);
|
|
288
292
|
this.confirming = false;
|
|
289
293
|
if (decision === "all" || decision === "none") {
|
|
290
|
-
|
|
294
|
+
resolve4(decision);
|
|
291
295
|
} else {
|
|
292
|
-
|
|
296
|
+
resolve4(new Set(decision));
|
|
293
297
|
}
|
|
294
298
|
}
|
|
295
299
|
}
|
|
296
300
|
/** Cancel all pending confirms (e.g., on disconnect) */
|
|
297
301
|
cancelAll() {
|
|
298
|
-
for (const
|
|
302
|
+
for (const resolve4 of this.pendingConfirms.values()) resolve4(false);
|
|
299
303
|
this.pendingConfirms.clear();
|
|
300
|
-
for (const
|
|
304
|
+
for (const resolve4 of this.pendingBatchConfirms.values()) resolve4("none");
|
|
301
305
|
this.pendingBatchConfirms.clear();
|
|
302
306
|
this.confirming = false;
|
|
303
307
|
}
|
|
@@ -372,8 +376,8 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
|
|
|
372
376
|
diff: this.getDiffPreview(call)
|
|
373
377
|
};
|
|
374
378
|
this.send(msg);
|
|
375
|
-
return new Promise((
|
|
376
|
-
this.pendingConfirms.set(requestId,
|
|
379
|
+
return new Promise((resolve4) => {
|
|
380
|
+
this.pendingConfirms.set(requestId, resolve4);
|
|
377
381
|
this.pendingTimers.set(requestId, setTimeout(() => {
|
|
378
382
|
if (this.pendingConfirms.has(requestId)) {
|
|
379
383
|
this.resolveConfirm(requestId, false);
|
|
@@ -397,8 +401,8 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
|
|
|
397
401
|
files
|
|
398
402
|
};
|
|
399
403
|
this.send(msg);
|
|
400
|
-
return new Promise((
|
|
401
|
-
this.pendingBatchConfirms.set(requestId,
|
|
404
|
+
return new Promise((resolve4) => {
|
|
405
|
+
this.pendingBatchConfirms.set(requestId, resolve4);
|
|
402
406
|
this.pendingTimers.set(requestId, setTimeout(() => {
|
|
403
407
|
if (this.pendingBatchConfirms.has(requestId)) {
|
|
404
408
|
this.resolveBatchConfirm(requestId, "none");
|
|
@@ -857,8 +861,8 @@ Cache: write=${cacheCreate} read=${cacheRead}` : "";
|
|
|
857
861
|
Cost: ${formatCost(cost)}` : "";
|
|
858
862
|
let memoryLine = "";
|
|
859
863
|
try {
|
|
860
|
-
const { countPendingMemories } = await import("./persistent-memory-
|
|
861
|
-
const pending =
|
|
864
|
+
const { countPendingMemories: countPendingMemories2 } = await import("./persistent-memory-4E53HW3U.js");
|
|
865
|
+
const pending = countPendingMemories2(ctx.config.getConfigDir());
|
|
862
866
|
if (pending > 0) memoryLine = `
|
|
863
867
|
Memory: \u26A0 ${pending} pending approval \u2014 see the Memory panel or /memory`;
|
|
864
868
|
} catch {
|
|
@@ -1162,7 +1166,7 @@ async function handleBranch(args, ctx) {
|
|
|
1162
1166
|
return;
|
|
1163
1167
|
}
|
|
1164
1168
|
const sub = args[0]?.toLowerCase();
|
|
1165
|
-
const
|
|
1169
|
+
const resolve4 = (ref) => {
|
|
1166
1170
|
const r = session.resolveBranchRef(ref);
|
|
1167
1171
|
if (r.ok) return r.id;
|
|
1168
1172
|
if (r.reason === "ambiguous") {
|
|
@@ -1216,7 +1220,7 @@ async function handleBranch(args, ctx) {
|
|
|
1216
1220
|
ctx.send({ type: "error", message: "Usage: /branch switch <id|title>" });
|
|
1217
1221
|
return;
|
|
1218
1222
|
}
|
|
1219
|
-
const id =
|
|
1223
|
+
const id = resolve4(ref);
|
|
1220
1224
|
if (!id) return;
|
|
1221
1225
|
const ok = session.switchBranch(id);
|
|
1222
1226
|
if (ok) {
|
|
@@ -1236,7 +1240,7 @@ async function handleBranch(args, ctx) {
|
|
|
1236
1240
|
ctx.send({ type: "error", message: "Usage: /branch delete <id|title>" });
|
|
1237
1241
|
return;
|
|
1238
1242
|
}
|
|
1239
|
-
const id =
|
|
1243
|
+
const id = resolve4(ref);
|
|
1240
1244
|
if (!id) return;
|
|
1241
1245
|
const ok = session.deleteBranch(id);
|
|
1242
1246
|
if (ok) {
|
|
@@ -1255,7 +1259,7 @@ async function handleBranch(args, ctx) {
|
|
|
1255
1259
|
ctx.send({ type: "error", message: "Usage: /branch rename <id|title> <new title>" });
|
|
1256
1260
|
return;
|
|
1257
1261
|
}
|
|
1258
|
-
const id =
|
|
1262
|
+
const id = resolve4(ref);
|
|
1259
1263
|
if (!id) return;
|
|
1260
1264
|
const ok = session.renameBranch(id, title);
|
|
1261
1265
|
if (ok) {
|
|
@@ -1273,7 +1277,7 @@ async function handleBranch(args, ctx) {
|
|
|
1273
1277
|
ctx.send({ type: "error", message: "Usage: /branch diff <id|title>" });
|
|
1274
1278
|
return;
|
|
1275
1279
|
}
|
|
1276
|
-
const id =
|
|
1280
|
+
const id = resolve4(ref);
|
|
1277
1281
|
if (!id) return;
|
|
1278
1282
|
const d = session.diffBranches(id);
|
|
1279
1283
|
if (!d) {
|
|
@@ -1315,7 +1319,7 @@ async function handleBranch(args, ctx) {
|
|
|
1315
1319
|
ctx.send({ type: "error", message: "Usage: /branch cherry-pick <source-id|title> <msg-index>" });
|
|
1316
1320
|
return;
|
|
1317
1321
|
}
|
|
1318
|
-
const id =
|
|
1322
|
+
const id = resolve4(ref);
|
|
1319
1323
|
if (!id) return;
|
|
1320
1324
|
const idx = parseInt(idxStr, 10);
|
|
1321
1325
|
if (Number.isNaN(idx)) {
|
|
@@ -1670,7 +1674,7 @@ async function handleTest(args, ctx) {
|
|
|
1670
1674
|
const isCommand = argStr.includes(" ") || /^(mvn|gradle|npm|pytest|cargo|go)\b/.test(argStr);
|
|
1671
1675
|
testArgs = isCommand ? { command: argStr } : { filter: argStr };
|
|
1672
1676
|
}
|
|
1673
|
-
const runTests = ctx.runTests ?? (await import("./run-tests-
|
|
1677
|
+
const runTests = ctx.runTests ?? (await import("./run-tests-SU5CDQKF.js")).executeTests;
|
|
1674
1678
|
const report = await runTests(testArgs);
|
|
1675
1679
|
ctx.send({ type: "info", message: report });
|
|
1676
1680
|
} catch (err) {
|
|
@@ -1763,6 +1767,33 @@ Create the necessary files and directory structure. Use write_file and bash tool
|
|
|
1763
1767
|
await ctx.handleChat(scaffoldPrompt);
|
|
1764
1768
|
}
|
|
1765
1769
|
|
|
1770
|
+
// src/core/memory-admin.ts
|
|
1771
|
+
import { resolve as resolve2, sep } from "path";
|
|
1772
|
+
function isWithinDir(base, target) {
|
|
1773
|
+
const b = resolve2(base);
|
|
1774
|
+
const t = resolve2(base, target);
|
|
1775
|
+
return t === b || t.startsWith(b.endsWith(sep) ? b : b + sep);
|
|
1776
|
+
}
|
|
1777
|
+
function checkWebRestorePath(configDir, file) {
|
|
1778
|
+
const trimmed = file?.trim();
|
|
1779
|
+
if (!trimmed) {
|
|
1780
|
+
return { ok: false, reason: "Usage: /memory restore <file> (a backup inside the config directory)" };
|
|
1781
|
+
}
|
|
1782
|
+
if (!isWithinDir(configDir, trimmed)) {
|
|
1783
|
+
return {
|
|
1784
|
+
ok: false,
|
|
1785
|
+
reason: `For safety the Web UI can only restore from inside the config directory (${configDir}). Slash commands bypass tool permission checks, so an arbitrary server-side path would be a read channel around them. Run /memory backup first, or use the terminal REPL for files elsewhere.`
|
|
1786
|
+
};
|
|
1787
|
+
}
|
|
1788
|
+
return { ok: true, resolved: resolve2(configDir, trimmed) };
|
|
1789
|
+
}
|
|
1790
|
+
function parseOutFlag(args) {
|
|
1791
|
+
const i = args.indexOf("--out");
|
|
1792
|
+
if (i < 0) return void 0;
|
|
1793
|
+
const v = args[i + 1];
|
|
1794
|
+
return v && !v.startsWith("--") ? v : void 0;
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1766
1797
|
// src/web/commands/memory-commands.ts
|
|
1767
1798
|
async function handleSystem(args, ctx) {
|
|
1768
1799
|
const text = args.join(" ").trim();
|
|
@@ -1894,6 +1925,57 @@ async function handleIndex(args, ctx) {
|
|
|
1894
1925
|
}
|
|
1895
1926
|
async function handleMemory(args, ctx) {
|
|
1896
1927
|
const sub = args[0];
|
|
1928
|
+
if (sub === "backup") {
|
|
1929
|
+
try {
|
|
1930
|
+
const result = backupMemoryStore(ctx.config.getConfigDir(), parseOutFlag(args.slice(1)));
|
|
1931
|
+
ctx.send({ type: "info", message: `\u2713 Backed up ${result.count} entr${result.count === 1 ? "y" : "ies"} to ${result.backupPath}` });
|
|
1932
|
+
} catch (err) {
|
|
1933
|
+
ctx.send({ type: "error", message: err instanceof Error ? err.message : String(err) });
|
|
1934
|
+
}
|
|
1935
|
+
return;
|
|
1936
|
+
}
|
|
1937
|
+
if (sub === "restore") {
|
|
1938
|
+
const configDir = ctx.config.getConfigDir();
|
|
1939
|
+
const verdict = checkWebRestorePath(configDir, args[1]);
|
|
1940
|
+
if (!verdict.ok) {
|
|
1941
|
+
ctx.send({ type: "error", message: verdict.reason });
|
|
1942
|
+
return;
|
|
1943
|
+
}
|
|
1944
|
+
try {
|
|
1945
|
+
const result = restoreMemoryEntries(configDir, verdict.resolved);
|
|
1946
|
+
const lines = [
|
|
1947
|
+
`\u2713 Restored ${result.imported} entr${result.imported === 1 ? "y" : "ies"} (${result.skipped} duplicate${result.skipped === 1 ? "" : "s"} skipped)`
|
|
1948
|
+
];
|
|
1949
|
+
if (result.backupPath) lines.push(`Pre-restore backup: ${result.backupPath}`);
|
|
1950
|
+
const pending = countPendingMemories(configDir);
|
|
1951
|
+
if (pending > 0) lines.push(`${pending} entr${pending === 1 ? "y" : "ies"} pending approval \u2014 /memory show --pending`);
|
|
1952
|
+
ctx.send({ type: "info", message: lines.join("\n") });
|
|
1953
|
+
ctx.sendMemoryEntries();
|
|
1954
|
+
} catch (err) {
|
|
1955
|
+
ctx.send({ type: "error", message: err instanceof Error ? err.message : String(err) });
|
|
1956
|
+
}
|
|
1957
|
+
return;
|
|
1958
|
+
}
|
|
1959
|
+
if (sub === "rebind") {
|
|
1960
|
+
const id = args[1];
|
|
1961
|
+
const newPath = args.slice(2).join(" ").trim();
|
|
1962
|
+
if (!id || !newPath) {
|
|
1963
|
+
ctx.send({ type: "error", message: "Usage: /memory rebind <id> <new project path> (find orphans with /memory show --orphaned)" });
|
|
1964
|
+
return;
|
|
1965
|
+
}
|
|
1966
|
+
try {
|
|
1967
|
+
const entry = rebindMemoryProject(ctx.config.getConfigDir(), id, newPath);
|
|
1968
|
+
ctx.send({ type: "info", message: `\u2713 Rebound memory ${entry.id.slice(0, 8)} to project ${entry.sourceProject}` });
|
|
1969
|
+
ctx.sendMemoryEntries();
|
|
1970
|
+
} catch (err) {
|
|
1971
|
+
ctx.send({ type: "error", message: err instanceof Error ? err.message : String(err) });
|
|
1972
|
+
}
|
|
1973
|
+
return;
|
|
1974
|
+
}
|
|
1975
|
+
if (sub === "path") {
|
|
1976
|
+
ctx.send({ type: "info", message: memoryStorePath(ctx.config.getConfigDir()) });
|
|
1977
|
+
return;
|
|
1978
|
+
}
|
|
1897
1979
|
if (sub === "add" && args.length > 1) {
|
|
1898
1980
|
const rest = args.slice(1);
|
|
1899
1981
|
const opts = {};
|
|
@@ -1928,7 +2010,7 @@ async function handleMemory(args, ctx) {
|
|
|
1928
2010
|
ctx.handleMemoryManage(sub, args[1], sub === "expire" ? args[2] : void 0);
|
|
1929
2011
|
} else if (sub === "export") {
|
|
1930
2012
|
if (args[1] === "md") {
|
|
1931
|
-
const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-
|
|
2013
|
+
const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-4E53HW3U.js");
|
|
1932
2014
|
ctx.send({
|
|
1933
2015
|
type: "export_data",
|
|
1934
2016
|
format: "md",
|
|
@@ -2580,10 +2662,10 @@ var SessionHandler = class {
|
|
|
2580
2662
|
return;
|
|
2581
2663
|
}
|
|
2582
2664
|
case "ask_user_response": {
|
|
2583
|
-
const
|
|
2584
|
-
if (
|
|
2665
|
+
const resolve4 = this.pendingAskUser.get(msg.requestId);
|
|
2666
|
+
if (resolve4) {
|
|
2585
2667
|
this.pendingAskUser.delete(msg.requestId);
|
|
2586
|
-
|
|
2668
|
+
resolve4(msg.answer);
|
|
2587
2669
|
}
|
|
2588
2670
|
return;
|
|
2589
2671
|
}
|
|
@@ -2596,10 +2678,10 @@ var SessionHandler = class {
|
|
|
2596
2678
|
case "memory_manage":
|
|
2597
2679
|
return this.handleMemoryManage(msg.action, msg.id, msg.expiresAt);
|
|
2598
2680
|
case "auto_pause_response": {
|
|
2599
|
-
const
|
|
2600
|
-
if (
|
|
2681
|
+
const resolve4 = this.pendingAutoPause.get(msg.requestId);
|
|
2682
|
+
if (resolve4) {
|
|
2601
2683
|
this.pendingAutoPause.delete(msg.requestId);
|
|
2602
|
-
|
|
2684
|
+
resolve4({ action: msg.action, message: msg.message });
|
|
2603
2685
|
}
|
|
2604
2686
|
return;
|
|
2605
2687
|
}
|
|
@@ -2614,10 +2696,10 @@ var SessionHandler = class {
|
|
|
2614
2696
|
this.hubOrchestrator?.abort();
|
|
2615
2697
|
return;
|
|
2616
2698
|
case "hub_steer": {
|
|
2617
|
-
const
|
|
2618
|
-
if (
|
|
2699
|
+
const resolve4 = this.pendingHubReview.get(msg.requestId);
|
|
2700
|
+
if (resolve4) {
|
|
2619
2701
|
this.pendingHubReview.delete(msg.requestId);
|
|
2620
|
-
|
|
2702
|
+
resolve4({ action: msg.action, message: msg.message });
|
|
2621
2703
|
}
|
|
2622
2704
|
return;
|
|
2623
2705
|
}
|
|
@@ -2630,9 +2712,9 @@ var SessionHandler = class {
|
|
|
2630
2712
|
runLifecycleHooks(mergePluginHooks(this.config.get("hooks") ?? void 0, this.config.getConfigDir()), "Stop", { sessionId: this.sessions.current?.id }, { configDir: this.config.getConfigDir() });
|
|
2631
2713
|
this.toolExecutor.cancelAll();
|
|
2632
2714
|
if (this.abortController) this.abortController.abort();
|
|
2633
|
-
for (const
|
|
2715
|
+
for (const resolve4 of this.pendingAskUser.values()) resolve4(null);
|
|
2634
2716
|
this.pendingAskUser.clear();
|
|
2635
|
-
for (const
|
|
2717
|
+
for (const resolve4 of this.pendingAutoPause.values()) resolve4({ action: "stop" });
|
|
2636
2718
|
this.pendingAutoPause.clear();
|
|
2637
2719
|
this.saveIfNeeded();
|
|
2638
2720
|
if (this._bashSessionKey) clearBashSession(this._bashSessionKey);
|
|
@@ -2768,9 +2850,9 @@ var SessionHandler = class {
|
|
|
2768
2850
|
this.hubOrchestrator = orchestrator;
|
|
2769
2851
|
orchestrator.onEvent = (event) => this.send({ type: "hub_event", event });
|
|
2770
2852
|
if (config.humanSteer) {
|
|
2771
|
-
orchestrator.onRoundReview = ({ round, maxRounds }) => new Promise((
|
|
2853
|
+
orchestrator.onRoundReview = ({ round, maxRounds }) => new Promise((resolve4) => {
|
|
2772
2854
|
const requestId = `hubrev_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
2773
|
-
this.pendingHubReview.set(requestId,
|
|
2855
|
+
this.pendingHubReview.set(requestId, resolve4);
|
|
2774
2856
|
this.send({ type: "hub_review", requestId, round, maxRounds });
|
|
2775
2857
|
});
|
|
2776
2858
|
}
|
|
@@ -3145,8 +3227,8 @@ Try: /compact to reduce context, /clear to reset, or switch to a larger-context
|
|
|
3145
3227
|
onMcpToolUsed: (name) => this.usedMcpToolNames.add(name),
|
|
3146
3228
|
requestAutoPause: async ({ effectiveRound, maxToolRounds: totalRounds, toolSummary }) => {
|
|
3147
3229
|
const requestId = `pause_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
3148
|
-
const pauseResp = await new Promise((
|
|
3149
|
-
this.pendingAutoPause.set(requestId,
|
|
3230
|
+
const pauseResp = await new Promise((resolve4) => {
|
|
3231
|
+
this.pendingAutoPause.set(requestId, resolve4);
|
|
3150
3232
|
this.send({
|
|
3151
3233
|
type: "auto_pause_request",
|
|
3152
3234
|
requestId,
|
|
@@ -3326,8 +3408,8 @@ ${summaryContent}`,
|
|
|
3326
3408
|
}
|
|
3327
3409
|
if (chunk.done) break;
|
|
3328
3410
|
}
|
|
3329
|
-
await new Promise((
|
|
3330
|
-
fileStream.end((err) => err ? reject(err) :
|
|
3411
|
+
await new Promise((resolve4, reject) => {
|
|
3412
|
+
fileStream.end((err) => err ? reject(err) : resolve4());
|
|
3331
3413
|
});
|
|
3332
3414
|
const verdict = evaluateTeeContent(fullContent, saveToFile, priorContent);
|
|
3333
3415
|
if (verdict.kind === "reject") {
|
|
@@ -3353,7 +3435,7 @@ ${summaryContent}`,
|
|
|
3353
3435
|
} catch (err) {
|
|
3354
3436
|
if (fileStream) {
|
|
3355
3437
|
try {
|
|
3356
|
-
await new Promise((
|
|
3438
|
+
await new Promise((resolve4) => fileStream.end(() => resolve4()));
|
|
3357
3439
|
} catch {
|
|
3358
3440
|
}
|
|
3359
3441
|
}
|
|
@@ -3730,7 +3812,7 @@ Backup saved: ${result.backupPath}` : "";
|
|
|
3730
3812
|
return;
|
|
3731
3813
|
}
|
|
3732
3814
|
try {
|
|
3733
|
-
const { searchChatMemory, loadChatIndex } = await import("./chat-index-
|
|
3815
|
+
const { searchChatMemory, loadChatIndex } = await import("./chat-index-2D5GK2DB.js");
|
|
3734
3816
|
const loaded = loadChatIndex();
|
|
3735
3817
|
if (!loaded || loaded.idx.chunks.length === 0) {
|
|
3736
3818
|
this.send({ type: "memory_hits", query: q, hits: [], indexMissing: true });
|
|
@@ -3766,7 +3848,7 @@ Backup saved: ${result.backupPath}` : "";
|
|
|
3766
3848
|
}
|
|
3767
3849
|
async handleMemoryStatus() {
|
|
3768
3850
|
try {
|
|
3769
|
-
const { getChatIndexStatus } = await import("./chat-index-
|
|
3851
|
+
const { getChatIndexStatus } = await import("./chat-index-2D5GK2DB.js");
|
|
3770
3852
|
const s = getChatIndexStatus();
|
|
3771
3853
|
this.send({
|
|
3772
3854
|
type: "memory_status",
|
|
@@ -3791,7 +3873,7 @@ Backup saved: ${result.backupPath}` : "";
|
|
|
3791
3873
|
type: "info",
|
|
3792
3874
|
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"
|
|
3793
3875
|
});
|
|
3794
|
-
const { buildChatIndex } = await import("./chat-index-
|
|
3876
|
+
const { buildChatIndex } = await import("./chat-index-2D5GK2DB.js");
|
|
3795
3877
|
const stats = await buildChatIndex({
|
|
3796
3878
|
full,
|
|
3797
3879
|
onProgress: (p) => {
|
|
@@ -3946,7 +4028,7 @@ function getModuleDir() {
|
|
|
3946
4028
|
}
|
|
3947
4029
|
} catch {
|
|
3948
4030
|
}
|
|
3949
|
-
return
|
|
4031
|
+
return resolve3(".");
|
|
3950
4032
|
}
|
|
3951
4033
|
async function startWebServer(options = {}) {
|
|
3952
4034
|
const port = options.port ?? 3e3;
|
|
@@ -4195,9 +4277,9 @@ async function startWebServer(options = {}) {
|
|
|
4195
4277
|
const prefix = req.query.prefix || "";
|
|
4196
4278
|
const targetDir = join2(cwd, prefix);
|
|
4197
4279
|
try {
|
|
4198
|
-
const canonicalTarget = realpathSync(
|
|
4199
|
-
const canonicalCwd = realpathSync(
|
|
4200
|
-
if (!canonicalTarget.startsWith(canonicalCwd +
|
|
4280
|
+
const canonicalTarget = realpathSync(resolve3(targetDir));
|
|
4281
|
+
const canonicalCwd = realpathSync(resolve3(cwd));
|
|
4282
|
+
if (!canonicalTarget.startsWith(canonicalCwd + sep2) && canonicalTarget !== canonicalCwd) {
|
|
4201
4283
|
res.json({ files: [] });
|
|
4202
4284
|
return;
|
|
4203
4285
|
}
|
|
@@ -4258,7 +4340,7 @@ async function startWebServer(options = {}) {
|
|
|
4258
4340
|
try {
|
|
4259
4341
|
const canonicalFile = realpathSync(filePath);
|
|
4260
4342
|
const canonicalDir = realpathSync(histDir);
|
|
4261
|
-
if (!canonicalFile.startsWith(canonicalDir +
|
|
4343
|
+
if (!canonicalFile.startsWith(canonicalDir + sep2)) {
|
|
4262
4344
|
res.status(404).json({ error: "Session not found" });
|
|
4263
4345
|
return;
|
|
4264
4346
|
}
|
|
@@ -4279,11 +4361,11 @@ async function startWebServer(options = {}) {
|
|
|
4279
4361
|
return;
|
|
4280
4362
|
}
|
|
4281
4363
|
const cwd = process.cwd();
|
|
4282
|
-
const fullPath =
|
|
4364
|
+
const fullPath = resolve3(join2(cwd, filePath));
|
|
4283
4365
|
try {
|
|
4284
4366
|
const canonicalFull = realpathSync(fullPath);
|
|
4285
|
-
const canonicalCwd = realpathSync(
|
|
4286
|
-
if (!canonicalFull.startsWith(canonicalCwd +
|
|
4367
|
+
const canonicalCwd = realpathSync(resolve3(cwd));
|
|
4368
|
+
if (!canonicalFull.startsWith(canonicalCwd + sep2) && canonicalFull !== canonicalCwd) {
|
|
4287
4369
|
res.json({ error: "Access denied" });
|
|
4288
4370
|
return;
|
|
4289
4371
|
}
|
|
@@ -4503,7 +4585,7 @@ async function startWebServer(options = {}) {
|
|
|
4503
4585
|
});
|
|
4504
4586
|
const MAX_PORT_ATTEMPTS = 10;
|
|
4505
4587
|
let actualPort = port;
|
|
4506
|
-
const result = await new Promise((
|
|
4588
|
+
const result = await new Promise((resolve4, reject) => {
|
|
4507
4589
|
const tryListen = (attempt) => {
|
|
4508
4590
|
server.once("error", (err) => {
|
|
4509
4591
|
if (err.code === "EADDRINUSE" && attempt < MAX_PORT_ATTEMPTS) {
|
|
@@ -4534,7 +4616,7 @@ async function startWebServer(options = {}) {
|
|
|
4534
4616
|
}
|
|
4535
4617
|
console.log(` Press Ctrl+C to stop
|
|
4536
4618
|
`);
|
|
4537
|
-
|
|
4619
|
+
resolve4({ port: actualPort, host, url });
|
|
4538
4620
|
});
|
|
4539
4621
|
};
|
|
4540
4622
|
tryListen(1);
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
ToolRegistry,
|
|
4
4
|
googleSearchContext,
|
|
5
5
|
truncateOutput
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-R4YGDJPL.js";
|
|
7
|
+
import "./chunk-GHWZVPUV.js";
|
|
8
|
+
import "./chunk-Z3UXZ5EI.js";
|
|
9
9
|
import "./chunk-GLSR2NR3.js";
|
|
10
10
|
import "./chunk-UUSRWSSX.js";
|
|
11
11
|
import "./chunk-CKH4KQ4E.js";
|
|
@@ -13,10 +13,10 @@ import "./chunk-BXP6YZ2P.js";
|
|
|
13
13
|
import "./chunk-KHYD3WXE.js";
|
|
14
14
|
import "./chunk-5C76XDDF.js";
|
|
15
15
|
import "./chunk-NYNSYLFY.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-3FEZSLGI.js";
|
|
17
17
|
import {
|
|
18
18
|
runTool
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-FHXLAJJG.js";
|
|
20
20
|
import {
|
|
21
21
|
getDangerLevel,
|
|
22
22
|
runLeanAgentLoop
|
|
@@ -27,10 +27,10 @@ import {
|
|
|
27
27
|
atomicWriteFileSync
|
|
28
28
|
} from "./chunk-IW3Q7AE5.js";
|
|
29
29
|
import "./chunk-4BKXL7SM.js";
|
|
30
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-WSCZRQDR.js";
|
|
31
31
|
import {
|
|
32
32
|
SUBAGENT_ALLOWED_TOOLS
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-EDAUDILT.js";
|
|
34
34
|
|
|
35
35
|
// src/hub/task-orchestrator.ts
|
|
36
36
|
import { createInterface } from "readline";
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
} from "./chunk-JT6UN5C6.js";
|
|
9
9
|
import {
|
|
10
10
|
ConfigManager
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-T65VFCID.js";
|
|
12
12
|
import "./chunk-TU3L3PW7.js";
|
|
13
13
|
import "./chunk-IW3Q7AE5.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-EDAUDILT.js";
|
|
15
15
|
|
|
16
16
|
// src/cli/usage.ts
|
|
17
17
|
function classifyRowCost(row) {
|