jinzd-ai-cli 0.4.268 → 0.4.269
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-HUOYPVJQ.js} +2 -2
- package/dist/{chunk-UT2WAJJG.js → chunk-3TOMHXDW.js} +1 -1
- package/dist/{chunk-EPVJS4F6.js → chunk-4HTJMLFY.js} +1 -1
- package/dist/{chunk-VGVKJTHF.js → chunk-5IUFUCIT.js} +1 -1
- package/dist/{chunk-2FQGMR34.js → chunk-5PRWBJCI.js} +1 -1
- package/dist/{chunk-YLSM7RF6.js → chunk-6PROC2JO.js} +3 -3
- package/dist/{chunk-7US7K3CD.js → chunk-AAERHPBN.js} +1 -1
- package/dist/{chunk-74BK22BM.js → chunk-DJNGUPM3.js} +4 -4
- package/dist/{chunk-RRQZRSXW.js → chunk-KIHNZBEA.js} +1 -1
- package/dist/{chunk-XDITAGE5.js → chunk-NVN3FHXI.js} +1 -1
- package/dist/{chunk-WNG3YVZX.js → chunk-QPPUYCRF.js} +1 -1
- package/dist/{chunk-VNCBY4KY.js → chunk-S3F5LOV3.js} +162 -2
- package/dist/{chunk-WWLXW4SY.js → chunk-V6KQ67VF.js} +1 -1
- package/dist/{chunk-Z7CZ72RP.js → chunk-XJAGGJVU.js} +3 -3
- package/dist/{ci-3RWVJSZ3.js → ci-4QS2J7BG.js} +4 -4
- package/dist/{ci-format-M6HVCXCG.js → ci-format-6L6M67WC.js} +2 -2
- package/dist/{constants-G6VN7SJL.js → constants-IO5VJLEE.js} +1 -1
- package/dist/{doctor-cli-Y3SVVJBO.js → doctor-cli-ZU4E2DDL.js} +4 -4
- package/dist/electron-server.js +245 -48
- package/dist/{hub-5T5HKOAR.js → hub-AMDWXSKZ.js} +1 -1
- package/dist/index.js +64 -153
- package/dist/{persistent-memory-YBWIZWQP.js → persistent-memory-52SE5K44.js} +2 -2
- package/dist/{persistent-memory-XVSSR277.js → persistent-memory-H4DNDIOQ.js} +2 -2
- package/dist/{pr-NF5IWLH3.js → pr-Z4O5H6I3.js} +4 -4
- package/dist/{run-tests-33X3D7PV.js → run-tests-FZSYHWYX.js} +2 -2
- package/dist/{run-tests-Y44SCLIO.js → run-tests-PYKKYMPA.js} +2 -2
- package/dist/{server-NJ3ZNPQW.js → server-WTJSM2MT.js} +79 -31
- package/dist/{server-3LERX42X.js → server-ZSTVYSYC.js} +5 -5
- package/dist/{task-orchestrator-JN2WFZSF.js → task-orchestrator-PNLI3V36.js} +5 -5
- package/dist/{usage-IFTNXTWC.js → usage-GVFUVYUG.js} +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11,17 +11,21 @@ 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-S3F5LOV3.js";
|
|
25
29
|
import {
|
|
26
30
|
CostTracker,
|
|
27
31
|
computeCost,
|
|
@@ -59,7 +63,7 @@ import {
|
|
|
59
63
|
setMaxOutputCap,
|
|
60
64
|
spawnAgentContext,
|
|
61
65
|
undoStack
|
|
62
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-DJNGUPM3.js";
|
|
63
67
|
import {
|
|
64
68
|
addMemoryEntry,
|
|
65
69
|
backupMemoryStore,
|
|
@@ -72,7 +76,6 @@ import {
|
|
|
72
76
|
findSimilarMemory,
|
|
73
77
|
formatMemoryForPrompt,
|
|
74
78
|
isMemoryExpired,
|
|
75
|
-
isMemoryStale,
|
|
76
79
|
listMemoryEntries,
|
|
77
80
|
listOrphanedProjectMemories,
|
|
78
81
|
loadMemoryEntries,
|
|
@@ -85,7 +88,7 @@ import {
|
|
|
85
88
|
touchMemoryReferences,
|
|
86
89
|
updateMemoryApproval,
|
|
87
90
|
updateMemoryEntry
|
|
88
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-QPPUYCRF.js";
|
|
89
92
|
import "./chunk-GLSR2NR3.js";
|
|
90
93
|
import "./chunk-UUSRWSSX.js";
|
|
91
94
|
import "./chunk-CKH4KQ4E.js";
|
|
@@ -103,14 +106,14 @@ import {
|
|
|
103
106
|
formatDoctorReport,
|
|
104
107
|
loadContextFiles,
|
|
105
108
|
writeCrashLog
|
|
106
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-6PROC2JO.js";
|
|
107
110
|
import {
|
|
108
111
|
ProviderRegistry,
|
|
109
112
|
listBuiltInProviderMetadata
|
|
110
113
|
} from "./chunk-AUEX6RNY.js";
|
|
111
114
|
import {
|
|
112
115
|
ConfigManager
|
|
113
|
-
} from "./chunk-
|
|
116
|
+
} from "./chunk-5IUFUCIT.js";
|
|
114
117
|
import {
|
|
115
118
|
describePlugin,
|
|
116
119
|
getActivePluginAssets,
|
|
@@ -127,7 +130,7 @@ import {
|
|
|
127
130
|
trustHook,
|
|
128
131
|
trustPlugin,
|
|
129
132
|
untrustHook
|
|
130
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-5PRWBJCI.js";
|
|
131
134
|
import {
|
|
132
135
|
CONTENT_ONLY_STREAM_REMINDER,
|
|
133
136
|
TEE_FINAL_USER_NUDGE,
|
|
@@ -161,7 +164,7 @@ import {
|
|
|
161
164
|
import {
|
|
162
165
|
fileCheckpoints
|
|
163
166
|
} from "./chunk-4BKXL7SM.js";
|
|
164
|
-
import "./chunk-
|
|
167
|
+
import "./chunk-V6KQ67VF.js";
|
|
165
168
|
import {
|
|
166
169
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
167
170
|
AUTHOR,
|
|
@@ -179,7 +182,7 @@ import {
|
|
|
179
182
|
SKILLS_DIR_NAME,
|
|
180
183
|
VERSION,
|
|
181
184
|
buildUserIdentityPrompt
|
|
182
|
-
} from "./chunk-
|
|
185
|
+
} from "./chunk-3TOMHXDW.js";
|
|
183
186
|
import {
|
|
184
187
|
buildChatIndex,
|
|
185
188
|
clearChatIndex,
|
|
@@ -1262,9 +1265,9 @@ function createToolingCommands() {
|
|
|
1262
1265
|
builtin.push({ name, description: t.definition.description });
|
|
1263
1266
|
}
|
|
1264
1267
|
}
|
|
1265
|
-
const
|
|
1266
|
-
const builtinShown = builtin.filter(
|
|
1267
|
-
const serverShown = [...byServer.entries()].map(([id, rows]) => [id, rows.filter(
|
|
1268
|
+
const matches = (row) => !filter || row.name.toLowerCase().includes(filter) || row.description.toLowerCase().includes(filter);
|
|
1269
|
+
const builtinShown = builtin.filter(matches);
|
|
1270
|
+
const serverShown = [...byServer.entries()].map(([id, rows]) => [id, rows.filter(matches)]).filter(([, rows]) => rows.length > 0);
|
|
1268
1271
|
const total = builtinShown.length + serverShown.reduce((a, [, r]) => a + r.length, 0);
|
|
1269
1272
|
if (total === 0) {
|
|
1270
1273
|
console.log(filter ? `
|
|
@@ -1400,7 +1403,7 @@ No tools match "${filter}".
|
|
|
1400
1403
|
const { join: join6 } = await import("path");
|
|
1401
1404
|
const { existsSync: existsSync6 } = await import("fs");
|
|
1402
1405
|
const { getGitRoot: getGitRoot2 } = await import("./git-context-EXOEHQSF.js");
|
|
1403
|
-
const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-
|
|
1406
|
+
const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-IO5VJLEE.js");
|
|
1404
1407
|
const { approveProject, hashMcpFile } = await import("./project-trust-NKYHL3VZ.js");
|
|
1405
1408
|
const cwd = process.cwd();
|
|
1406
1409
|
const projectRoot = getGitRoot2(cwd) ?? cwd;
|
|
@@ -2353,7 +2356,7 @@ function createReviewCommands() {
|
|
|
2353
2356
|
usage: "/test [command|filter]",
|
|
2354
2357
|
async execute(args, ctx) {
|
|
2355
2358
|
try {
|
|
2356
|
-
const { executeTests } = await import("./run-tests-
|
|
2359
|
+
const { executeTests } = await import("./run-tests-FZSYHWYX.js");
|
|
2357
2360
|
const argStr = args.join(" ").trim();
|
|
2358
2361
|
let testArgs = {};
|
|
2359
2362
|
if (argStr) {
|
|
@@ -2848,41 +2851,17 @@ function createMemoryCommands() {
|
|
|
2848
2851
|
}
|
|
2849
2852
|
return { flags, text: text.join(" ").trim() };
|
|
2850
2853
|
};
|
|
2851
|
-
const asScope = (value) => value === "personal" || value === "project" || value === "session" || value === "team" ? value : void 0;
|
|
2852
2854
|
const asSensitivity = (value) => value === "low" || value === "medium" || value === "high" ? value : void 0;
|
|
2853
2855
|
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`);
|
|
2856
|
+
const showFilters = parseMemoryShowFilters(args.slice(1));
|
|
2857
|
+
if (showFilters.invalidStale) {
|
|
2858
|
+
ctx.renderer.renderError("Usage: /memory show --stale <days> (positive number)");
|
|
2859
|
+
return;
|
|
2885
2860
|
}
|
|
2861
|
+
const sourceEntries = showFilters.orphaned ? listOrphanedProjectMemories(configDir) : listMemoryEntries(configDir, { includeExpired: true, includeRejected: true });
|
|
2862
|
+
const filtered = filterMemoryEntries(sourceEntries, showFilters);
|
|
2863
|
+
const entries = filtered.entries;
|
|
2864
|
+
const filters = filtered.applied;
|
|
2886
2865
|
if (entries.length === 0) {
|
|
2887
2866
|
ctx.renderer.printInfo(filters.length > 0 ? `No memory entries match [${filters.join(", ")}]` : "Memory is empty");
|
|
2888
2867
|
return;
|
|
@@ -3295,18 +3274,18 @@ function createSessionCommands() {
|
|
|
3295
3274
|
return;
|
|
3296
3275
|
}
|
|
3297
3276
|
const sessions = ctx.sessions.listSessions();
|
|
3298
|
-
const
|
|
3299
|
-
if (
|
|
3277
|
+
const matches = sessions.filter((s) => s.id.startsWith(id));
|
|
3278
|
+
if (matches.length === 0) {
|
|
3300
3279
|
ctx.renderer.renderError(`Session '${id}' not found.`);
|
|
3301
3280
|
return;
|
|
3302
3281
|
}
|
|
3303
|
-
if (
|
|
3304
|
-
console.log(theme.warning(` \u26A0 Ambiguous prefix '${id}' matches ${
|
|
3305
|
-
for (const m of
|
|
3282
|
+
if (matches.length > 1) {
|
|
3283
|
+
console.log(theme.warning(` \u26A0 Ambiguous prefix '${id}' matches ${matches.length} sessions \u2014 loading most recent:`));
|
|
3284
|
+
for (const m of matches.slice(0, 5)) {
|
|
3306
3285
|
console.log(theme.dim(` ${m.id.slice(0, 12)} ${m.title ?? "(untitled)"}`));
|
|
3307
3286
|
}
|
|
3308
3287
|
}
|
|
3309
|
-
const match =
|
|
3288
|
+
const match = matches[0];
|
|
3310
3289
|
ctx.sessions.loadSession(match.id);
|
|
3311
3290
|
ctx.setProvider(match.provider, match.model);
|
|
3312
3291
|
ctx.resetSessionTokenUsage();
|
|
@@ -3365,24 +3344,24 @@ function createSessionCommands() {
|
|
|
3365
3344
|
return;
|
|
3366
3345
|
}
|
|
3367
3346
|
const allSessions = ctx.sessions.listSessions();
|
|
3368
|
-
const
|
|
3369
|
-
if (
|
|
3347
|
+
const matches2 = allSessions.filter((s) => s.messageCount === filterMessages);
|
|
3348
|
+
if (matches2.length === 0) {
|
|
3370
3349
|
ctx.renderer.printInfo(`No sessions with ${filterMessages} message(s) found.`);
|
|
3371
3350
|
return;
|
|
3372
3351
|
}
|
|
3373
3352
|
console.log();
|
|
3374
3353
|
console.log(
|
|
3375
|
-
theme.warning(` Found ${
|
|
3354
|
+
theme.warning(` Found ${matches2.length} session(s) with ${filterMessages} message(s):`)
|
|
3376
3355
|
);
|
|
3377
|
-
for (const s of
|
|
3356
|
+
for (const s of matches2.slice(0, 20)) {
|
|
3378
3357
|
console.log(
|
|
3379
3358
|
theme.dim(
|
|
3380
3359
|
` ${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
3360
|
)
|
|
3382
3361
|
);
|
|
3383
3362
|
}
|
|
3384
|
-
if (
|
|
3385
|
-
console.log(theme.dim(` ... and ${
|
|
3363
|
+
if (matches2.length > 20) {
|
|
3364
|
+
console.log(theme.dim(` ... and ${matches2.length - 20} more`));
|
|
3386
3365
|
}
|
|
3387
3366
|
if (dryRun) {
|
|
3388
3367
|
console.log(
|
|
@@ -3393,7 +3372,7 @@ function createSessionCommands() {
|
|
|
3393
3372
|
}
|
|
3394
3373
|
console.log();
|
|
3395
3374
|
const choice2 = await ctx.select(
|
|
3396
|
-
`Delete all ${
|
|
3375
|
+
`Delete all ${matches2.length} matching sessions?`,
|
|
3397
3376
|
[
|
|
3398
3377
|
{ label: "No \u2014 keep them", value: "no" },
|
|
3399
3378
|
{ label: "Yes \u2014 delete permanently", value: "yes", hint: "unlinks all matching history files" }
|
|
@@ -3405,7 +3384,7 @@ function createSessionCommands() {
|
|
|
3405
3384
|
}
|
|
3406
3385
|
let deleted = 0;
|
|
3407
3386
|
let failed = 0;
|
|
3408
|
-
for (const s of
|
|
3387
|
+
for (const s of matches2) {
|
|
3409
3388
|
if (ctx.sessions.deleteSession(s.id)) {
|
|
3410
3389
|
deleted++;
|
|
3411
3390
|
} else {
|
|
@@ -3430,19 +3409,19 @@ function createSessionCommands() {
|
|
|
3430
3409
|
return;
|
|
3431
3410
|
}
|
|
3432
3411
|
const sessions = ctx.sessions.listSessions();
|
|
3433
|
-
const
|
|
3434
|
-
if (
|
|
3412
|
+
const matches = sessions.filter((s) => s.id.startsWith(id));
|
|
3413
|
+
if (matches.length === 0) {
|
|
3435
3414
|
ctx.renderer.renderError(`Session '${id}' not found.`);
|
|
3436
3415
|
return;
|
|
3437
3416
|
}
|
|
3438
|
-
if (
|
|
3439
|
-
ctx.renderer.renderError(`Ambiguous prefix '${id}' matches ${
|
|
3440
|
-
for (const m of
|
|
3417
|
+
if (matches.length > 1) {
|
|
3418
|
+
ctx.renderer.renderError(`Ambiguous prefix '${id}' matches ${matches.length} sessions \u2014 be more specific:`);
|
|
3419
|
+
for (const m of matches.slice(0, 10)) {
|
|
3441
3420
|
console.log(theme.dim(` ${m.id.slice(0, 12)} ${String(m.messageCount).padStart(4)} msgs ${m.updated.toLocaleDateString()} ${m.title ?? "(untitled)"}`));
|
|
3442
3421
|
}
|
|
3443
3422
|
return;
|
|
3444
3423
|
}
|
|
3445
|
-
const match =
|
|
3424
|
+
const match = matches[0];
|
|
3446
3425
|
const isCurrent = ctx.sessions.current?.id === match.id;
|
|
3447
3426
|
console.log();
|
|
3448
3427
|
console.log(theme.warning(" About to permanently delete session (no undo):"));
|
|
@@ -4040,13 +4019,13 @@ No commands match "${filter}".
|
|
|
4040
4019
|
${theme.heading(`Found ${results.length} session(s) containing "${query}"`)}
|
|
4041
4020
|
`);
|
|
4042
4021
|
for (const r of results) {
|
|
4043
|
-
const { sessionMeta, matches
|
|
4022
|
+
const { sessionMeta, matches } = r;
|
|
4044
4023
|
const dateStr = sessionMeta.updated.toLocaleDateString();
|
|
4045
4024
|
console.log(
|
|
4046
4025
|
` ${theme.accent(sessionMeta.id.slice(0, 8))}` + theme.dim(` [${dateStr}] ${sessionMeta.provider} / ${sessionMeta.model}`) + (sessionMeta.title ? `
|
|
4047
4026
|
${theme.dim(" " + sessionMeta.title)}` : "")
|
|
4048
4027
|
);
|
|
4049
|
-
for (const m of
|
|
4028
|
+
for (const m of matches) {
|
|
4050
4029
|
const icon = m.role === "user" ? "\u{1F464}" : "\u{1F916}";
|
|
4051
4030
|
console.log(` ${icon} ${theme.warning(m.snippet)}`);
|
|
4052
4031
|
}
|
|
@@ -4832,74 +4811,6 @@ function installUnicodeBackspaceRepair(input, rl, shouldHandle = () => true) {
|
|
|
4832
4811
|
return () => input.off("keypress", onKeypress);
|
|
4833
4812
|
}
|
|
4834
4813
|
|
|
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
4814
|
// src/providers/fallback.ts
|
|
4904
4815
|
var TRANSIENT_CODES = /* @__PURE__ */ new Set([
|
|
4905
4816
|
"ECONNRESET",
|
|
@@ -6242,18 +6153,18 @@ Session '${this.resumeSessionId}' not found.
|
|
|
6242
6153
|
* When routing is disabled or no rule matches, returns the current model unchanged.
|
|
6243
6154
|
*/
|
|
6244
6155
|
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
6156
|
let availableModels = [];
|
|
6250
6157
|
try {
|
|
6251
|
-
|
|
6252
|
-
availableModels = provider.info.models.map((m) => m.id);
|
|
6158
|
+
availableModels = this.providers.get(this.currentProvider).info.models.map((m) => m.id);
|
|
6253
6159
|
} catch {
|
|
6254
6160
|
availableModels = [];
|
|
6255
6161
|
}
|
|
6256
|
-
return
|
|
6162
|
+
return decideModel({
|
|
6163
|
+
userInput,
|
|
6164
|
+
currentModel: this.currentModel,
|
|
6165
|
+
routingConfig: this.config.get("routing"),
|
|
6166
|
+
availableModels
|
|
6167
|
+
});
|
|
6257
6168
|
}
|
|
6258
6169
|
// ─── Context 自动管理 ───────────────────────────────────────────────────
|
|
6259
6170
|
/**
|
|
@@ -7649,7 +7560,7 @@ program.command("web").description("Start Web UI server with browser-based chat
|
|
|
7649
7560
|
console.error("Error: Invalid port number. Must be between 1 and 65535.");
|
|
7650
7561
|
process.exit(1);
|
|
7651
7562
|
}
|
|
7652
|
-
const { startWebServer } = await import("./server-
|
|
7563
|
+
const { startWebServer } = await import("./server-WTJSM2MT.js");
|
|
7653
7564
|
await startWebServer({ port, host: options.host });
|
|
7654
7565
|
});
|
|
7655
7566
|
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 +7727,11 @@ program.command("sessions").description("List recent conversation sessions").opt
|
|
|
7816
7727
|
console.log(footer + "\n");
|
|
7817
7728
|
});
|
|
7818
7729
|
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-
|
|
7730
|
+
const { runUsageCli } = await import("./usage-GVFUVYUG.js");
|
|
7820
7731
|
await runUsageCli(options);
|
|
7821
7732
|
});
|
|
7822
7733
|
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-
|
|
7734
|
+
const { runDoctorCli } = await import("./doctor-cli-ZU4E2DDL.js");
|
|
7824
7735
|
const argv = process.argv.slice(2);
|
|
7825
7736
|
await runDoctorCli({
|
|
7826
7737
|
json: !!options.json || argv.includes("--json"),
|
|
@@ -7829,7 +7740,7 @@ program.command("doctor").description("Health check: API keys, config, MCP, rece
|
|
|
7829
7740
|
});
|
|
7830
7741
|
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
7742
|
try {
|
|
7832
|
-
const batch = await import("./batch-
|
|
7743
|
+
const batch = await import("./batch-HUOYPVJQ.js");
|
|
7833
7744
|
switch (action) {
|
|
7834
7745
|
case "submit":
|
|
7835
7746
|
if (!arg) {
|
|
@@ -7872,7 +7783,7 @@ program.command("batch <action> [arg] [arg2]").description("Anthropic Message Ba
|
|
|
7872
7783
|
}
|
|
7873
7784
|
});
|
|
7874
7785
|
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-
|
|
7786
|
+
const { startMcpServer } = await import("./server-ZSTVYSYC.js");
|
|
7876
7787
|
await startMcpServer({
|
|
7877
7788
|
allowDestructive: !!options.allowDestructive,
|
|
7878
7789
|
allowOutsideCwd: !!options.allowOutsideCwd,
|
|
@@ -7885,7 +7796,7 @@ program.command("pr <action> [target]").description("PR review helpers: review |
|
|
|
7885
7796
|
console.error(`Unknown pr action: ${action}. Use review | security-review | summarize.`);
|
|
7886
7797
|
process.exit(1);
|
|
7887
7798
|
}
|
|
7888
|
-
const { runPrCli } = await import("./pr-
|
|
7799
|
+
const { runPrCli } = await import("./pr-Z4O5H6I3.js");
|
|
7889
7800
|
const result = await runPrCli({
|
|
7890
7801
|
action,
|
|
7891
7802
|
target,
|
|
@@ -7905,8 +7816,8 @@ program.command("pr <action> [target]").description("PR review helpers: review |
|
|
|
7905
7816
|
process.exit(result.exitCode);
|
|
7906
7817
|
});
|
|
7907
7818
|
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-
|
|
7819
|
+
const { runCi } = await import("./ci-4QS2J7BG.js");
|
|
7820
|
+
const { formatCiResult } = await import("./ci-format-6L6M67WC.js");
|
|
7910
7821
|
const formats = [options.json, options.markdown, options.sarif].filter(Boolean).length;
|
|
7911
7822
|
if (formats > 1) {
|
|
7912
7823
|
console.error("Choose only one output format: --json, --markdown, or --sarif.");
|
|
@@ -8064,7 +7975,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
|
|
|
8064
7975
|
config.get("customProviders"),
|
|
8065
7976
|
config.getConfigDir()
|
|
8066
7977
|
);
|
|
8067
|
-
const { startHub } = await import("./hub-
|
|
7978
|
+
const { startHub } = await import("./hub-AMDWXSKZ.js");
|
|
8068
7979
|
await startHub(
|
|
8069
7980
|
{
|
|
8070
7981
|
topic: topic ?? "",
|
|
@@ -27,9 +27,9 @@ import {
|
|
|
27
27
|
touchMemoryReferences,
|
|
28
28
|
updateMemoryApproval,
|
|
29
29
|
updateMemoryEntry
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-KIHNZBEA.js";
|
|
31
31
|
import "./chunk-YVTASHS5.js";
|
|
32
|
-
import "./chunk-
|
|
32
|
+
import "./chunk-4HTJMLFY.js";
|
|
33
33
|
import "./chunk-6BUTA5VW.js";
|
|
34
34
|
export {
|
|
35
35
|
addMemoryEntry,
|
|
@@ -28,9 +28,9 @@ import {
|
|
|
28
28
|
touchMemoryReferences,
|
|
29
29
|
updateMemoryApproval,
|
|
30
30
|
updateMemoryEntry
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-QPPUYCRF.js";
|
|
32
32
|
import "./chunk-HOSJZMQS.js";
|
|
33
|
-
import "./chunk-
|
|
33
|
+
import "./chunk-3TOMHXDW.js";
|
|
34
34
|
import "./chunk-B5TYJO7V.js";
|
|
35
35
|
import "./chunk-IW3Q7AE5.js";
|
|
36
36
|
export {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import {
|
|
3
3
|
countSeverity,
|
|
4
4
|
runCi
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-XJAGGJVU.js";
|
|
6
|
+
import "./chunk-AAERHPBN.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-5IUFUCIT.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-3TOMHXDW.js";
|
|
26
26
|
import "./chunk-IW3Q7AE5.js";
|
|
27
27
|
|
|
28
28
|
// src/cli/pr.ts
|