jinzd-ai-cli 0.4.268 → 0.4.270
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-2N2YMRX2.js → batch-IMLMUXJL.js} +2 -2
- package/dist/{chunk-UT2WAJJG.js → chunk-75SPJKDY.js} +1 -1
- package/dist/{chunk-RRQZRSXW.js → chunk-BOMB6XCF.js} +1 -1
- package/dist/{chunk-74BK22BM.js → chunk-DIJIYWQE.js} +4 -4
- package/dist/{chunk-VGVKJTHF.js → chunk-F26YTEMB.js} +9 -1
- package/dist/{chunk-Z7CZ72RP.js → chunk-FXCDD7JS.js} +3 -3
- package/dist/{chunk-YLSM7RF6.js → chunk-HOT76ATM.js} +3 -3
- package/dist/{chunk-EPVJS4F6.js → chunk-JJVVCWO4.js} +1 -1
- package/dist/{chunk-R7GERZDA.js → chunk-JT6UN5C6.js} +26 -5
- package/dist/{chunk-2FQGMR34.js → chunk-M3GDYEUH.js} +1 -1
- package/dist/{chunk-7US7K3CD.js → chunk-PLFXDRNX.js} +1 -1
- package/dist/{chunk-WWLXW4SY.js → chunk-TG4PF7FZ.js} +1 -1
- package/dist/{chunk-XDITAGE5.js → chunk-UDUE4DAE.js} +1 -1
- package/dist/{chunk-VNCBY4KY.js → chunk-X3JPBJ6C.js} +163 -3
- package/dist/{chunk-WNG3YVZX.js → chunk-YHLTSZVH.js} +1 -1
- package/dist/{ci-3RWVJSZ3.js → ci-HQVXWJ53.js} +4 -4
- package/dist/{ci-format-M6HVCXCG.js → ci-format-762IL4OM.js} +2 -2
- package/dist/{constants-G6VN7SJL.js → constants-4TPE3JSV.js} +1 -1
- package/dist/{doctor-cli-Y3SVVJBO.js → doctor-cli-3ES6NFVL.js} +4 -4
- package/dist/electron-server.js +300 -55
- package/dist/{hub-5T5HKOAR.js → hub-QXRWPBJP.js} +1 -1
- package/dist/index.js +68 -155
- package/dist/{persistent-memory-XVSSR277.js → persistent-memory-F4JPWYZJ.js} +2 -2
- package/dist/{persistent-memory-YBWIZWQP.js → persistent-memory-URIJJJ3N.js} +2 -2
- package/dist/{pr-NF5IWLH3.js → pr-HVVHZOJ2.js} +4 -4
- package/dist/{run-tests-Y44SCLIO.js → run-tests-UZG6SVJ5.js} +2 -2
- package/dist/{run-tests-33X3D7PV.js → run-tests-WM7TMO2N.js} +2 -2
- package/dist/{server-3LERX42X.js → server-E5OBXT33.js} +5 -5
- package/dist/{server-NJ3ZNPQW.js → server-HPRLFLOI.js} +112 -35
- package/dist/{task-orchestrator-JN2WFZSF.js → task-orchestrator-HJUUL55Y.js} +5 -5
- package/dist/{usage-IFTNXTWC.js → usage-L3DUPHD6.js} +11 -4
- package/dist/web/client/actions.js.br +0 -0
- package/dist/web/client/actions.js.gz +0 -0
- package/dist/web/client/api.js.br +0 -0
- package/dist/web/client/api.js.gz +0 -0
- package/dist/web/client/app.js +3 -6
- package/dist/web/client/app.js.br +0 -0
- package/dist/web/client/app.js.gz +0 -0
- package/dist/web/client/dom.js.br +0 -0
- package/dist/web/client/dom.js.gz +0 -0
- package/dist/web/client/icon.svg.br +0 -0
- package/dist/web/client/icon.svg.gz +0 -0
- package/dist/web/client/index.html.br +0 -0
- package/dist/web/client/index.html.gz +0 -0
- package/dist/web/client/sidebar-tabs.js.br +0 -0
- package/dist/web/client/sidebar-tabs.js.gz +0 -0
- package/dist/web/client/state.js.br +0 -0
- package/dist/web/client/state.js.gz +0 -0
- package/dist/web/client/style.css.br +0 -0
- package/dist/web/client/style.css.gz +0 -0
- package/dist/web/client/sw.js.br +0 -0
- package/dist/web/client/sw.js.gz +0 -0
- package/dist/web/client/templates.js.br +0 -0
- package/dist/web/client/templates.js.gz +0 -0
- package/dist/web/client/util.js +22 -0
- package/dist/web/client/util.js.br +0 -0
- package/dist/web/client/util.js.gz +0 -0
- package/dist/web/client/vendor/daisyui-full.min.css.br +0 -0
- package/dist/web/client/vendor/daisyui-full.min.css.gz +0 -0
- package/dist/web/client/vendor/github-dark.min.css.br +0 -0
- package/dist/web/client/vendor/github-dark.min.css.gz +0 -0
- package/dist/web/client/vendor/github.min.css.br +0 -0
- package/dist/web/client/vendor/github.min.css.gz +0 -0
- package/dist/web/client/vendor/highlight.min.js.br +0 -0
- package/dist/web/client/vendor/highlight.min.js.gz +0 -0
- package/dist/web/client/vendor/marked.min.js.br +0 -0
- package/dist/web/client/vendor/marked.min.js.gz +0 -0
- package/dist/web/client/vendor/tailwind.js.br +0 -0
- package/dist/web/client/vendor/tailwind.js.gz +0 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11,23 +11,28 @@ import {
|
|
|
11
11
|
buildSessionCostReport,
|
|
12
12
|
clearDevState,
|
|
13
13
|
costSourceNote,
|
|
14
|
+
decideModel,
|
|
14
15
|
estimateConversationTokens,
|
|
15
16
|
evaluateContextPressure,
|
|
17
|
+
filterMemoryEntries,
|
|
16
18
|
loadDevState,
|
|
19
|
+
parseMemoryShowFilters,
|
|
17
20
|
parseSimpleYaml,
|
|
18
21
|
persistToolRound,
|
|
19
22
|
readGitDiff,
|
|
20
23
|
saveDevState,
|
|
21
24
|
scanProject,
|
|
22
25
|
sessionHasMeaningfulContent,
|
|
23
|
-
setupProxy
|
|
24
|
-
|
|
26
|
+
setupProxy,
|
|
27
|
+
stripRoutingTags
|
|
28
|
+
} from "./chunk-X3JPBJ6C.js";
|
|
25
29
|
import {
|
|
26
30
|
CostTracker,
|
|
27
31
|
computeCost,
|
|
28
32
|
formatCost,
|
|
29
|
-
getPricing
|
|
30
|
-
|
|
33
|
+
getPricing,
|
|
34
|
+
setCostCurrency
|
|
35
|
+
} from "./chunk-JT6UN5C6.js";
|
|
31
36
|
import {
|
|
32
37
|
buildReviewPrompt,
|
|
33
38
|
buildSecurityReviewPrompt
|
|
@@ -59,7 +64,7 @@ import {
|
|
|
59
64
|
setMaxOutputCap,
|
|
60
65
|
spawnAgentContext,
|
|
61
66
|
undoStack
|
|
62
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-DIJIYWQE.js";
|
|
63
68
|
import {
|
|
64
69
|
addMemoryEntry,
|
|
65
70
|
backupMemoryStore,
|
|
@@ -72,7 +77,6 @@ import {
|
|
|
72
77
|
findSimilarMemory,
|
|
73
78
|
formatMemoryForPrompt,
|
|
74
79
|
isMemoryExpired,
|
|
75
|
-
isMemoryStale,
|
|
76
80
|
listMemoryEntries,
|
|
77
81
|
listOrphanedProjectMemories,
|
|
78
82
|
loadMemoryEntries,
|
|
@@ -85,7 +89,7 @@ import {
|
|
|
85
89
|
touchMemoryReferences,
|
|
86
90
|
updateMemoryApproval,
|
|
87
91
|
updateMemoryEntry
|
|
88
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-YHLTSZVH.js";
|
|
89
93
|
import "./chunk-GLSR2NR3.js";
|
|
90
94
|
import "./chunk-UUSRWSSX.js";
|
|
91
95
|
import "./chunk-CKH4KQ4E.js";
|
|
@@ -103,14 +107,14 @@ import {
|
|
|
103
107
|
formatDoctorReport,
|
|
104
108
|
loadContextFiles,
|
|
105
109
|
writeCrashLog
|
|
106
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-HOT76ATM.js";
|
|
107
111
|
import {
|
|
108
112
|
ProviderRegistry,
|
|
109
113
|
listBuiltInProviderMetadata
|
|
110
114
|
} from "./chunk-AUEX6RNY.js";
|
|
111
115
|
import {
|
|
112
116
|
ConfigManager
|
|
113
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-F26YTEMB.js";
|
|
114
118
|
import {
|
|
115
119
|
describePlugin,
|
|
116
120
|
getActivePluginAssets,
|
|
@@ -127,7 +131,7 @@ import {
|
|
|
127
131
|
trustHook,
|
|
128
132
|
trustPlugin,
|
|
129
133
|
untrustHook
|
|
130
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-M3GDYEUH.js";
|
|
131
135
|
import {
|
|
132
136
|
CONTENT_ONLY_STREAM_REMINDER,
|
|
133
137
|
TEE_FINAL_USER_NUDGE,
|
|
@@ -161,7 +165,7 @@ import {
|
|
|
161
165
|
import {
|
|
162
166
|
fileCheckpoints
|
|
163
167
|
} from "./chunk-4BKXL7SM.js";
|
|
164
|
-
import "./chunk-
|
|
168
|
+
import "./chunk-TG4PF7FZ.js";
|
|
165
169
|
import {
|
|
166
170
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
167
171
|
AUTHOR,
|
|
@@ -179,7 +183,7 @@ import {
|
|
|
179
183
|
SKILLS_DIR_NAME,
|
|
180
184
|
VERSION,
|
|
181
185
|
buildUserIdentityPrompt
|
|
182
|
-
} from "./chunk-
|
|
186
|
+
} from "./chunk-75SPJKDY.js";
|
|
183
187
|
import {
|
|
184
188
|
buildChatIndex,
|
|
185
189
|
clearChatIndex,
|
|
@@ -1262,9 +1266,9 @@ function createToolingCommands() {
|
|
|
1262
1266
|
builtin.push({ name, description: t.definition.description });
|
|
1263
1267
|
}
|
|
1264
1268
|
}
|
|
1265
|
-
const
|
|
1266
|
-
const builtinShown = builtin.filter(
|
|
1267
|
-
const serverShown = [...byServer.entries()].map(([id, rows]) => [id, rows.filter(
|
|
1269
|
+
const matches = (row) => !filter || row.name.toLowerCase().includes(filter) || row.description.toLowerCase().includes(filter);
|
|
1270
|
+
const builtinShown = builtin.filter(matches);
|
|
1271
|
+
const serverShown = [...byServer.entries()].map(([id, rows]) => [id, rows.filter(matches)]).filter(([, rows]) => rows.length > 0);
|
|
1268
1272
|
const total = builtinShown.length + serverShown.reduce((a, [, r]) => a + r.length, 0);
|
|
1269
1273
|
if (total === 0) {
|
|
1270
1274
|
console.log(filter ? `
|
|
@@ -1400,7 +1404,7 @@ No tools match "${filter}".
|
|
|
1400
1404
|
const { join: join6 } = await import("path");
|
|
1401
1405
|
const { existsSync: existsSync6 } = await import("fs");
|
|
1402
1406
|
const { getGitRoot: getGitRoot2 } = await import("./git-context-EXOEHQSF.js");
|
|
1403
|
-
const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-
|
|
1407
|
+
const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-4TPE3JSV.js");
|
|
1404
1408
|
const { approveProject, hashMcpFile } = await import("./project-trust-NKYHL3VZ.js");
|
|
1405
1409
|
const cwd = process.cwd();
|
|
1406
1410
|
const projectRoot = getGitRoot2(cwd) ?? cwd;
|
|
@@ -2353,7 +2357,7 @@ function createReviewCommands() {
|
|
|
2353
2357
|
usage: "/test [command|filter]",
|
|
2354
2358
|
async execute(args, ctx) {
|
|
2355
2359
|
try {
|
|
2356
|
-
const { executeTests } = await import("./run-tests-
|
|
2360
|
+
const { executeTests } = await import("./run-tests-WM7TMO2N.js");
|
|
2357
2361
|
const argStr = args.join(" ").trim();
|
|
2358
2362
|
let testArgs = {};
|
|
2359
2363
|
if (argStr) {
|
|
@@ -2848,41 +2852,17 @@ function createMemoryCommands() {
|
|
|
2848
2852
|
}
|
|
2849
2853
|
return { flags, text: text.join(" ").trim() };
|
|
2850
2854
|
};
|
|
2851
|
-
const asScope = (value) => value === "personal" || value === "project" || value === "session" || value === "team" ? value : void 0;
|
|
2852
2855
|
const asSensitivity = (value) => value === "low" || value === "medium" || value === "high" ? value : void 0;
|
|
2853
2856
|
if (sub === "show" || sub === "view" || sub === "list") {
|
|
2854
|
-
const
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
let entries;
|
|
2859
|
-
if (parsed.flags.orphaned === true) {
|
|
2860
|
-
entries = listOrphanedProjectMemories(configDir);
|
|
2861
|
-
filters.push("orphaned");
|
|
2862
|
-
} else {
|
|
2863
|
-
entries = listMemoryEntries(configDir, { includeExpired: true, includeRejected: true });
|
|
2864
|
-
}
|
|
2865
|
-
if (parsed.flags.pending === true) {
|
|
2866
|
-
entries = entries.filter((m) => !m.approved && !isMemoryExpired(m));
|
|
2867
|
-
filters.push("pending");
|
|
2868
|
-
}
|
|
2869
|
-
if (scopeFilter) {
|
|
2870
|
-
entries = entries.filter((m) => m.scope === scopeFilter);
|
|
2871
|
-
filters.push(`scope:${scopeFilter}`);
|
|
2872
|
-
}
|
|
2873
|
-
if (searchText) {
|
|
2874
|
-
entries = entries.filter((m) => m.content.toLowerCase().includes(searchText) || m.id.startsWith(searchText));
|
|
2875
|
-
filters.push(`search:"${searchText}"`);
|
|
2876
|
-
}
|
|
2877
|
-
const staleDays = typeof parsed.flags.stale === "string" ? Number(parsed.flags.stale) : void 0;
|
|
2878
|
-
if (staleDays !== void 0) {
|
|
2879
|
-
if (!Number.isFinite(staleDays) || staleDays <= 0) {
|
|
2880
|
-
ctx.renderer.renderError("Usage: /memory show --stale <days> (positive number)");
|
|
2881
|
-
return;
|
|
2882
|
-
}
|
|
2883
|
-
entries = entries.filter((m) => isMemoryStale(m, staleDays));
|
|
2884
|
-
filters.push(`stale>${staleDays}d`);
|
|
2857
|
+
const showFilters = parseMemoryShowFilters(args.slice(1));
|
|
2858
|
+
if (showFilters.invalidStale) {
|
|
2859
|
+
ctx.renderer.renderError("Usage: /memory show --stale <days> (positive number)");
|
|
2860
|
+
return;
|
|
2885
2861
|
}
|
|
2862
|
+
const sourceEntries = showFilters.orphaned ? listOrphanedProjectMemories(configDir) : listMemoryEntries(configDir, { includeExpired: true, includeRejected: true });
|
|
2863
|
+
const filtered = filterMemoryEntries(sourceEntries, showFilters);
|
|
2864
|
+
const entries = filtered.entries;
|
|
2865
|
+
const filters = filtered.applied;
|
|
2886
2866
|
if (entries.length === 0) {
|
|
2887
2867
|
ctx.renderer.printInfo(filters.length > 0 ? `No memory entries match [${filters.join(", ")}]` : "Memory is empty");
|
|
2888
2868
|
return;
|
|
@@ -3295,18 +3275,18 @@ function createSessionCommands() {
|
|
|
3295
3275
|
return;
|
|
3296
3276
|
}
|
|
3297
3277
|
const sessions = ctx.sessions.listSessions();
|
|
3298
|
-
const
|
|
3299
|
-
if (
|
|
3278
|
+
const matches = sessions.filter((s) => s.id.startsWith(id));
|
|
3279
|
+
if (matches.length === 0) {
|
|
3300
3280
|
ctx.renderer.renderError(`Session '${id}' not found.`);
|
|
3301
3281
|
return;
|
|
3302
3282
|
}
|
|
3303
|
-
if (
|
|
3304
|
-
console.log(theme.warning(` \u26A0 Ambiguous prefix '${id}' matches ${
|
|
3305
|
-
for (const m of
|
|
3283
|
+
if (matches.length > 1) {
|
|
3284
|
+
console.log(theme.warning(` \u26A0 Ambiguous prefix '${id}' matches ${matches.length} sessions \u2014 loading most recent:`));
|
|
3285
|
+
for (const m of matches.slice(0, 5)) {
|
|
3306
3286
|
console.log(theme.dim(` ${m.id.slice(0, 12)} ${m.title ?? "(untitled)"}`));
|
|
3307
3287
|
}
|
|
3308
3288
|
}
|
|
3309
|
-
const match =
|
|
3289
|
+
const match = matches[0];
|
|
3310
3290
|
ctx.sessions.loadSession(match.id);
|
|
3311
3291
|
ctx.setProvider(match.provider, match.model);
|
|
3312
3292
|
ctx.resetSessionTokenUsage();
|
|
@@ -3365,24 +3345,24 @@ function createSessionCommands() {
|
|
|
3365
3345
|
return;
|
|
3366
3346
|
}
|
|
3367
3347
|
const allSessions = ctx.sessions.listSessions();
|
|
3368
|
-
const
|
|
3369
|
-
if (
|
|
3348
|
+
const matches2 = allSessions.filter((s) => s.messageCount === filterMessages);
|
|
3349
|
+
if (matches2.length === 0) {
|
|
3370
3350
|
ctx.renderer.printInfo(`No sessions with ${filterMessages} message(s) found.`);
|
|
3371
3351
|
return;
|
|
3372
3352
|
}
|
|
3373
3353
|
console.log();
|
|
3374
3354
|
console.log(
|
|
3375
|
-
theme.warning(` Found ${
|
|
3355
|
+
theme.warning(` Found ${matches2.length} session(s) with ${filterMessages} message(s):`)
|
|
3376
3356
|
);
|
|
3377
|
-
for (const s of
|
|
3357
|
+
for (const s of matches2.slice(0, 20)) {
|
|
3378
3358
|
console.log(
|
|
3379
3359
|
theme.dim(
|
|
3380
3360
|
` ${s.id.slice(0, 12)} ${s.provider}/${s.model} ${String(s.messageCount).padStart(4)} msgs ${s.updated.toISOString().slice(0, 10)} ${truncateTitle(s.title ?? "(untitled)", 60)}`
|
|
3381
3361
|
)
|
|
3382
3362
|
);
|
|
3383
3363
|
}
|
|
3384
|
-
if (
|
|
3385
|
-
console.log(theme.dim(` ... and ${
|
|
3364
|
+
if (matches2.length > 20) {
|
|
3365
|
+
console.log(theme.dim(` ... and ${matches2.length - 20} more`));
|
|
3386
3366
|
}
|
|
3387
3367
|
if (dryRun) {
|
|
3388
3368
|
console.log(
|
|
@@ -3393,7 +3373,7 @@ function createSessionCommands() {
|
|
|
3393
3373
|
}
|
|
3394
3374
|
console.log();
|
|
3395
3375
|
const choice2 = await ctx.select(
|
|
3396
|
-
`Delete all ${
|
|
3376
|
+
`Delete all ${matches2.length} matching sessions?`,
|
|
3397
3377
|
[
|
|
3398
3378
|
{ label: "No \u2014 keep them", value: "no" },
|
|
3399
3379
|
{ label: "Yes \u2014 delete permanently", value: "yes", hint: "unlinks all matching history files" }
|
|
@@ -3405,7 +3385,7 @@ function createSessionCommands() {
|
|
|
3405
3385
|
}
|
|
3406
3386
|
let deleted = 0;
|
|
3407
3387
|
let failed = 0;
|
|
3408
|
-
for (const s of
|
|
3388
|
+
for (const s of matches2) {
|
|
3409
3389
|
if (ctx.sessions.deleteSession(s.id)) {
|
|
3410
3390
|
deleted++;
|
|
3411
3391
|
} else {
|
|
@@ -3430,19 +3410,19 @@ function createSessionCommands() {
|
|
|
3430
3410
|
return;
|
|
3431
3411
|
}
|
|
3432
3412
|
const sessions = ctx.sessions.listSessions();
|
|
3433
|
-
const
|
|
3434
|
-
if (
|
|
3413
|
+
const matches = sessions.filter((s) => s.id.startsWith(id));
|
|
3414
|
+
if (matches.length === 0) {
|
|
3435
3415
|
ctx.renderer.renderError(`Session '${id}' not found.`);
|
|
3436
3416
|
return;
|
|
3437
3417
|
}
|
|
3438
|
-
if (
|
|
3439
|
-
ctx.renderer.renderError(`Ambiguous prefix '${id}' matches ${
|
|
3440
|
-
for (const m of
|
|
3418
|
+
if (matches.length > 1) {
|
|
3419
|
+
ctx.renderer.renderError(`Ambiguous prefix '${id}' matches ${matches.length} sessions \u2014 be more specific:`);
|
|
3420
|
+
for (const m of matches.slice(0, 10)) {
|
|
3441
3421
|
console.log(theme.dim(` ${m.id.slice(0, 12)} ${String(m.messageCount).padStart(4)} msgs ${m.updated.toLocaleDateString()} ${m.title ?? "(untitled)"}`));
|
|
3442
3422
|
}
|
|
3443
3423
|
return;
|
|
3444
3424
|
}
|
|
3445
|
-
const match =
|
|
3425
|
+
const match = matches[0];
|
|
3446
3426
|
const isCurrent = ctx.sessions.current?.id === match.id;
|
|
3447
3427
|
console.log();
|
|
3448
3428
|
console.log(theme.warning(" About to permanently delete session (no undo):"));
|
|
@@ -4040,13 +4020,13 @@ No commands match "${filter}".
|
|
|
4040
4020
|
${theme.heading(`Found ${results.length} session(s) containing "${query}"`)}
|
|
4041
4021
|
`);
|
|
4042
4022
|
for (const r of results) {
|
|
4043
|
-
const { sessionMeta, matches
|
|
4023
|
+
const { sessionMeta, matches } = r;
|
|
4044
4024
|
const dateStr = sessionMeta.updated.toLocaleDateString();
|
|
4045
4025
|
console.log(
|
|
4046
4026
|
` ${theme.accent(sessionMeta.id.slice(0, 8))}` + theme.dim(` [${dateStr}] ${sessionMeta.provider} / ${sessionMeta.model}`) + (sessionMeta.title ? `
|
|
4047
4027
|
${theme.dim(" " + sessionMeta.title)}` : "")
|
|
4048
4028
|
);
|
|
4049
|
-
for (const m of
|
|
4029
|
+
for (const m of matches) {
|
|
4050
4030
|
const icon = m.role === "user" ? "\u{1F464}" : "\u{1F916}";
|
|
4051
4031
|
console.log(` ${icon} ${theme.warning(m.snippet)}`);
|
|
4052
4032
|
}
|
|
@@ -4832,74 +4812,6 @@ function installUnicodeBackspaceRepair(input, rl, shouldHandle = () => true) {
|
|
|
4832
4812
|
return () => input.off("keypress", onKeypress);
|
|
4833
4813
|
}
|
|
4834
4814
|
|
|
4835
|
-
// src/core/model-router.ts
|
|
4836
|
-
var TAG_REGEX = /(?:^|\s)#([a-zA-Z][\w-]{0,31})\b/g;
|
|
4837
|
-
function extractTags(message) {
|
|
4838
|
-
const tags = /* @__PURE__ */ new Set();
|
|
4839
|
-
let m;
|
|
4840
|
-
TAG_REGEX.lastIndex = 0;
|
|
4841
|
-
while ((m = TAG_REGEX.exec(message)) !== null) {
|
|
4842
|
-
tags.add(m[1].toLowerCase());
|
|
4843
|
-
}
|
|
4844
|
-
return tags;
|
|
4845
|
-
}
|
|
4846
|
-
function matches(message, matcher) {
|
|
4847
|
-
const trimmed = message.trim();
|
|
4848
|
-
const lower = trimmed.toLowerCase();
|
|
4849
|
-
if (matcher.tag) {
|
|
4850
|
-
const tags = extractTags(trimmed);
|
|
4851
|
-
if (!tags.has(matcher.tag.toLowerCase())) return false;
|
|
4852
|
-
}
|
|
4853
|
-
if (matcher.contains && matcher.contains.length > 0) {
|
|
4854
|
-
const hit = matcher.contains.some((kw) => lower.includes(kw.toLowerCase()));
|
|
4855
|
-
if (!hit) return false;
|
|
4856
|
-
}
|
|
4857
|
-
if (typeof matcher.maxLength === "number") {
|
|
4858
|
-
if (trimmed.length > matcher.maxLength) return false;
|
|
4859
|
-
}
|
|
4860
|
-
if (typeof matcher.minLength === "number") {
|
|
4861
|
-
if (trimmed.length < matcher.minLength) return false;
|
|
4862
|
-
}
|
|
4863
|
-
const hasAnyCondition = !!matcher.tag || matcher.contains && matcher.contains.length > 0 || typeof matcher.maxLength === "number" || typeof matcher.minLength === "number";
|
|
4864
|
-
return !!hasAnyCondition;
|
|
4865
|
-
}
|
|
4866
|
-
function pickModel(message, currentModel, config, availableModels = []) {
|
|
4867
|
-
if (!config.enabled || config.rules.length === 0) {
|
|
4868
|
-
return { model: currentModel, reason: "routing disabled", overridden: false };
|
|
4869
|
-
}
|
|
4870
|
-
const isAvailable = (m) => availableModels.length === 0 || availableModels.includes(m);
|
|
4871
|
-
for (let i = 0; i < config.rules.length; i++) {
|
|
4872
|
-
const rule = config.rules[i];
|
|
4873
|
-
if (!matches(message, rule.match)) continue;
|
|
4874
|
-
if (!isAvailable(rule.model)) continue;
|
|
4875
|
-
if (rule.model === currentModel) {
|
|
4876
|
-
return {
|
|
4877
|
-
model: currentModel,
|
|
4878
|
-
reason: `rule "${rule.name ?? `#${i}`}" matched (same as current)`,
|
|
4879
|
-
overridden: false,
|
|
4880
|
-
ruleIdx: i
|
|
4881
|
-
};
|
|
4882
|
-
}
|
|
4883
|
-
return {
|
|
4884
|
-
model: rule.model,
|
|
4885
|
-
reason: `rule "${rule.name ?? `#${i}`}" matched`,
|
|
4886
|
-
overridden: true,
|
|
4887
|
-
ruleIdx: i
|
|
4888
|
-
};
|
|
4889
|
-
}
|
|
4890
|
-
if (config.fallback && config.fallback !== currentModel && isAvailable(config.fallback)) {
|
|
4891
|
-
return {
|
|
4892
|
-
model: config.fallback,
|
|
4893
|
-
reason: "fallback",
|
|
4894
|
-
overridden: true
|
|
4895
|
-
};
|
|
4896
|
-
}
|
|
4897
|
-
return { model: currentModel, reason: "no rule matched", overridden: false };
|
|
4898
|
-
}
|
|
4899
|
-
function stripRoutingTags(message) {
|
|
4900
|
-
return message.replace(/(?:^|\s)#(fast|deep|default)\b/gi, " ").replace(/\s{2,}/g, " ").trim();
|
|
4901
|
-
}
|
|
4902
|
-
|
|
4903
4815
|
// src/providers/fallback.ts
|
|
4904
4816
|
var TRANSIENT_CODES = /* @__PURE__ */ new Set([
|
|
4905
4817
|
"ECONNRESET",
|
|
@@ -5725,6 +5637,7 @@ Session '${this.resumeSessionId}' not found.
|
|
|
5725
5637
|
}
|
|
5726
5638
|
const cfgOutputCap = this.config.get("maxToolOutputChars");
|
|
5727
5639
|
if (typeof cfgOutputCap === "number" && cfgOutputCap > 0) setMaxOutputCap(cfgOutputCap);
|
|
5640
|
+
setCostCurrency(this.config.get("ui").currency);
|
|
5728
5641
|
if (welcomeModelInfo?.contextWindow) setContextWindow(welcomeModelInfo.contextWindow);
|
|
5729
5642
|
if (this.resumeSessionId) {
|
|
5730
5643
|
const session = this.sessions.current;
|
|
@@ -6242,18 +6155,18 @@ Session '${this.resumeSessionId}' not found.
|
|
|
6242
6155
|
* When routing is disabled or no rule matches, returns the current model unchanged.
|
|
6243
6156
|
*/
|
|
6244
6157
|
computeRoutingDecision(userInput) {
|
|
6245
|
-
const routingConfig = this.config.get("routing");
|
|
6246
|
-
if (!routingConfig || !routingConfig.enabled) {
|
|
6247
|
-
return { model: this.currentModel, reason: "routing disabled", overridden: false };
|
|
6248
|
-
}
|
|
6249
6158
|
let availableModels = [];
|
|
6250
6159
|
try {
|
|
6251
|
-
|
|
6252
|
-
availableModels = provider.info.models.map((m) => m.id);
|
|
6160
|
+
availableModels = this.providers.get(this.currentProvider).info.models.map((m) => m.id);
|
|
6253
6161
|
} catch {
|
|
6254
6162
|
availableModels = [];
|
|
6255
6163
|
}
|
|
6256
|
-
return
|
|
6164
|
+
return decideModel({
|
|
6165
|
+
userInput,
|
|
6166
|
+
currentModel: this.currentModel,
|
|
6167
|
+
routingConfig: this.config.get("routing"),
|
|
6168
|
+
availableModels
|
|
6169
|
+
});
|
|
6257
6170
|
}
|
|
6258
6171
|
// ─── Context 自动管理 ───────────────────────────────────────────────────
|
|
6259
6172
|
/**
|
|
@@ -7649,7 +7562,7 @@ program.command("web").description("Start Web UI server with browser-based chat
|
|
|
7649
7562
|
console.error("Error: Invalid port number. Must be between 1 and 65535.");
|
|
7650
7563
|
process.exit(1);
|
|
7651
7564
|
}
|
|
7652
|
-
const { startWebServer } = await import("./server-
|
|
7565
|
+
const { startWebServer } = await import("./server-HPRLFLOI.js");
|
|
7653
7566
|
await startWebServer({ port, host: options.host });
|
|
7654
7567
|
});
|
|
7655
7568
|
program.command("user [action] [username]").description("Manage Web UI users (list | create <name> | delete <name> | reset-password <name> | logout-all <name> | migrate <name>)").action(async (action, username) => {
|
|
@@ -7816,11 +7729,11 @@ program.command("sessions").description("List recent conversation sessions").opt
|
|
|
7816
7729
|
console.log(footer + "\n");
|
|
7817
7730
|
});
|
|
7818
7731
|
program.command("usage").description("Show token + cost usage grouped by provider/model (cross-session)").option("--days <n>", "Only the last N days (inclusive of today)").option("--month <ym>", "Only a specific month, format YYYY-MM (e.g. 2026-06)").option("--json", "Output as JSON (for scripting)").action(async (options) => {
|
|
7819
|
-
const { runUsageCli } = await import("./usage-
|
|
7732
|
+
const { runUsageCli } = await import("./usage-L3DUPHD6.js");
|
|
7820
7733
|
await runUsageCli(options);
|
|
7821
7734
|
});
|
|
7822
7735
|
program.command("doctor").description("Health check: API keys, config, MCP, recent crashes, tool usage, disk usage").option("--json", "Output as JSON (for scripting)").option("--reset-stats", "Reset accumulated tool usage statistics").action(async (options) => {
|
|
7823
|
-
const { runDoctorCli } = await import("./doctor-cli-
|
|
7736
|
+
const { runDoctorCli } = await import("./doctor-cli-3ES6NFVL.js");
|
|
7824
7737
|
const argv = process.argv.slice(2);
|
|
7825
7738
|
await runDoctorCli({
|
|
7826
7739
|
json: !!options.json || argv.includes("--json"),
|
|
@@ -7829,7 +7742,7 @@ program.command("doctor").description("Health check: API keys, config, MCP, rece
|
|
|
7829
7742
|
});
|
|
7830
7743
|
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) => {
|
|
7831
7744
|
try {
|
|
7832
|
-
const batch = await import("./batch-
|
|
7745
|
+
const batch = await import("./batch-IMLMUXJL.js");
|
|
7833
7746
|
switch (action) {
|
|
7834
7747
|
case "submit":
|
|
7835
7748
|
if (!arg) {
|
|
@@ -7872,7 +7785,7 @@ program.command("batch <action> [arg] [arg2]").description("Anthropic Message Ba
|
|
|
7872
7785
|
}
|
|
7873
7786
|
});
|
|
7874
7787
|
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) => {
|
|
7875
|
-
const { startMcpServer } = await import("./server-
|
|
7788
|
+
const { startMcpServer } = await import("./server-E5OBXT33.js");
|
|
7876
7789
|
await startMcpServer({
|
|
7877
7790
|
allowDestructive: !!options.allowDestructive,
|
|
7878
7791
|
allowOutsideCwd: !!options.allowOutsideCwd,
|
|
@@ -7885,7 +7798,7 @@ program.command("pr <action> [target]").description("PR review helpers: review |
|
|
|
7885
7798
|
console.error(`Unknown pr action: ${action}. Use review | security-review | summarize.`);
|
|
7886
7799
|
process.exit(1);
|
|
7887
7800
|
}
|
|
7888
|
-
const { runPrCli } = await import("./pr-
|
|
7801
|
+
const { runPrCli } = await import("./pr-HVVHZOJ2.js");
|
|
7889
7802
|
const result = await runPrCli({
|
|
7890
7803
|
action,
|
|
7891
7804
|
target,
|
|
@@ -7905,8 +7818,8 @@ program.command("pr <action> [target]").description("PR review helpers: review |
|
|
|
7905
7818
|
process.exit(result.exitCode);
|
|
7906
7819
|
});
|
|
7907
7820
|
program.command("ci").description("Headless PR review (code + security) \u2014 reads git/gh diff, optionally posts to PR. Designed for GitHub Actions.").option("--pr <num>", "PR number or URL; diff fetched via gh pr diff <value>", (v) => /^#?\d+$/.test(v) ? parseInt(v.replace(/^#/, ""), 10) : v).option("--base <ref>", "Base ref for git diff <ref>...HEAD (ignored when --pr set)").option("--post", "Post review as a PR comment (requires gh CLI + GH_TOKEN, needs --pr)").option("--no-update", "Always create a new comment instead of updating the previous aicli review").option("--skip-code", "Skip the code review section").option("--skip-security", "Skip the security review section").option("--detailed", "Use the detailed code-review prompt").option("--max-diff <n>", "Max diff chars sent to the model (default 30000)", (v) => parseInt(v, 10)).option("--provider <id>", "Override provider (default: config.defaultProvider)").option("--model <id>", "Override model").option("--dry-run", "Print result to stdout instead of posting (overrides --post)").option("--json", "Output a structured JSON report").option("--markdown", "Output Markdown report (default)").option("--sarif", "Output SARIF 2.1.0 for code scanning artifacts").option("--fail-on-security-high", "Fail when the security review contains HIGH/CRITICAL findings (default)").option("--no-fail-on-security-high", "Do not fail on security HIGH/CRITICAL findings").option("--fail-on-test-failure", "Fail when the report mentions test failures (default)").option("--no-fail-on-test-failure", "Do not fail on test failure findings").option("--fail-on-lint-failure", "Fail when the report mentions lint/typecheck failures (default)").option("--no-fail-on-lint-failure", "Do not fail on lint/typecheck failure findings").action(async (options) => {
|
|
7908
|
-
const { runCi } = await import("./ci-
|
|
7909
|
-
const { formatCiResult } = await import("./ci-format-
|
|
7821
|
+
const { runCi } = await import("./ci-HQVXWJ53.js");
|
|
7822
|
+
const { formatCiResult } = await import("./ci-format-762IL4OM.js");
|
|
7910
7823
|
const formats = [options.json, options.markdown, options.sarif].filter(Boolean).length;
|
|
7911
7824
|
if (formats > 1) {
|
|
7912
7825
|
console.error("Choose only one output format: --json, --markdown, or --sarif.");
|
|
@@ -8064,7 +7977,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
|
|
|
8064
7977
|
config.get("customProviders"),
|
|
8065
7978
|
config.getConfigDir()
|
|
8066
7979
|
);
|
|
8067
|
-
const { startHub } = await import("./hub-
|
|
7980
|
+
const { startHub } = await import("./hub-QXRWPBJP.js");
|
|
8068
7981
|
await startHub(
|
|
8069
7982
|
{
|
|
8070
7983
|
topic: topic ?? "",
|
|
@@ -28,9 +28,9 @@ import {
|
|
|
28
28
|
touchMemoryReferences,
|
|
29
29
|
updateMemoryApproval,
|
|
30
30
|
updateMemoryEntry
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-YHLTSZVH.js";
|
|
32
32
|
import "./chunk-HOSJZMQS.js";
|
|
33
|
-
import "./chunk-
|
|
33
|
+
import "./chunk-75SPJKDY.js";
|
|
34
34
|
import "./chunk-B5TYJO7V.js";
|
|
35
35
|
import "./chunk-IW3Q7AE5.js";
|
|
36
36
|
export {
|
|
@@ -27,9 +27,9 @@ import {
|
|
|
27
27
|
touchMemoryReferences,
|
|
28
28
|
updateMemoryApproval,
|
|
29
29
|
updateMemoryEntry
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-BOMB6XCF.js";
|
|
31
31
|
import "./chunk-YVTASHS5.js";
|
|
32
|
-
import "./chunk-
|
|
32
|
+
import "./chunk-JJVVCWO4.js";
|
|
33
33
|
import "./chunk-6BUTA5VW.js";
|
|
34
34
|
export {
|
|
35
35
|
addMemoryEntry,
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import {
|
|
3
3
|
countSeverity,
|
|
4
4
|
runCi
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-FXCDD7JS.js";
|
|
6
|
+
import "./chunk-PLFXDRNX.js";
|
|
7
7
|
import {
|
|
8
8
|
buildReviewPrompt,
|
|
9
9
|
buildSecurityReviewPrompt,
|
|
@@ -17,12 +17,12 @@ import {
|
|
|
17
17
|
} from "./chunk-AUEX6RNY.js";
|
|
18
18
|
import {
|
|
19
19
|
ConfigManager
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-F26YTEMB.js";
|
|
21
21
|
import "./chunk-3OBY7WSS.js";
|
|
22
22
|
import "./chunk-TU3L3PW7.js";
|
|
23
23
|
import {
|
|
24
24
|
VERSION
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-75SPJKDY.js";
|
|
26
26
|
import "./chunk-IW3Q7AE5.js";
|
|
27
27
|
|
|
28
28
|
// src/cli/pr.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ToolRegistry
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-DIJIYWQE.js";
|
|
5
|
+
import "./chunk-YHLTSZVH.js";
|
|
6
6
|
import "./chunk-GLSR2NR3.js";
|
|
7
7
|
import "./chunk-UUSRWSSX.js";
|
|
8
8
|
import "./chunk-CKH4KQ4E.js";
|
|
@@ -10,7 +10,7 @@ import "./chunk-BXP6YZ2P.js";
|
|
|
10
10
|
import "./chunk-5C76XDDF.js";
|
|
11
11
|
import {
|
|
12
12
|
runTool
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-M3GDYEUH.js";
|
|
14
14
|
import {
|
|
15
15
|
getDangerLevel,
|
|
16
16
|
schemaToJsonSchema
|
|
@@ -18,10 +18,10 @@ import {
|
|
|
18
18
|
import "./chunk-TU3L3PW7.js";
|
|
19
19
|
import "./chunk-HOSJZMQS.js";
|
|
20
20
|
import "./chunk-4BKXL7SM.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-TG4PF7FZ.js";
|
|
22
22
|
import {
|
|
23
23
|
VERSION
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-75SPJKDY.js";
|
|
25
25
|
import "./chunk-6RPGQ5CG.js";
|
|
26
26
|
import "./chunk-KHYD3WXE.js";
|
|
27
27
|
import "./chunk-NYNSYLFY.js";
|