jinzd-ai-cli 0.4.266 → 0.4.268
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-FQU6HK3Z.js → batch-2N2YMRX2.js} +2 -2
- package/dist/{chunk-QW76RX6G.js → chunk-2FQGMR34.js} +1 -1
- package/dist/{chunk-Y2X24VYB.js → chunk-74BK22BM.js} +4 -4
- package/dist/{chunk-TJNBSR3I.js → chunk-7US7K3CD.js} +1 -1
- package/dist/{chunk-FA3HGXXM.js → chunk-EPVJS4F6.js} +3 -1
- package/dist/{chunk-V4D7YD24.js → chunk-R7GERZDA.js} +145 -4
- package/dist/{chunk-GWOZET2E.js → chunk-RRQZRSXW.js} +1 -1
- package/dist/{chunk-LGJ7EX2F.js → chunk-UT2WAJJG.js} +1 -1
- package/dist/{chunk-CEJUB4YV.js → chunk-VGVKJTHF.js} +1 -1
- package/dist/{chunk-UCHND2K6.js → chunk-VNCBY4KY.js} +193 -2
- package/dist/{chunk-3O4VLKD4.js → chunk-WNG3YVZX.js} +1 -1
- package/dist/{chunk-N2E6GFLZ.js → chunk-WWLXW4SY.js} +1 -1
- package/dist/{chunk-LHY7ST6X.js → chunk-XDITAGE5.js} +1 -1
- package/dist/{chunk-FIDEG2PG.js → chunk-YLSM7RF6.js} +3 -3
- package/dist/{chunk-XEVURCAM.js → chunk-Z7CZ72RP.js} +3 -3
- package/dist/{ci-GZH3QMME.js → ci-3RWVJSZ3.js} +4 -4
- package/dist/{ci-format-VKP2MGYJ.js → ci-format-M6HVCXCG.js} +2 -2
- package/dist/{constants-ICAF6I3J.js → constants-G6VN7SJL.js} +1 -1
- package/dist/{doctor-cli-CO6BJWRW.js → doctor-cli-Y3SVVJBO.js} +4 -4
- package/dist/electron-server.js +915 -410
- package/dist/{hub-4APIRQ73.js → hub-5T5HKOAR.js} +1 -1
- package/dist/index.js +87 -134
- package/dist/{persistent-memory-YD3SHSUH.js → persistent-memory-XVSSR277.js} +2 -2
- package/dist/{persistent-memory-YPO25MOP.js → persistent-memory-YBWIZWQP.js} +2 -2
- package/dist/{pr-CDOPCAPK.js → pr-NF5IWLH3.js} +4 -4
- package/dist/{run-tests-QNNP2HCD.js → run-tests-33X3D7PV.js} +2 -2
- package/dist/{run-tests-4XRHKHN5.js → run-tests-Y44SCLIO.js} +2 -2
- package/dist/{server-B4A7LHZ5.js → server-3LERX42X.js} +5 -5
- package/dist/{server-53GM3CRH.js → server-NJ3ZNPQW.js} +114 -38
- package/dist/{task-orchestrator-WNV6PT6Z.js → task-orchestrator-JN2WFZSF.js} +5 -5
- package/dist/{usage-E3FEYSBU.js → usage-IFTNXTWC.js} +4 -6
- package/package.json +1 -1
- package/dist/chunk-YRD6M5XI.js +0 -149
|
@@ -158,7 +158,7 @@ ${content}`);
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
async function runTaskMode(config, providers, configManager, topic) {
|
|
161
|
-
const { TaskOrchestrator } = await import("./task-orchestrator-
|
|
161
|
+
const { TaskOrchestrator } = await import("./task-orchestrator-JN2WFZSF.js");
|
|
162
162
|
const orchestrator = new TaskOrchestrator(config, providers, configManager);
|
|
163
163
|
let interrupted = false;
|
|
164
164
|
const onSigint = () => {
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
+
AUTO_COMPACT_INSTRUCTION,
|
|
3
4
|
McpManager,
|
|
4
5
|
SNAPSHOT_PROMPT,
|
|
5
6
|
SkillManager,
|
|
7
|
+
applyProfileCommand,
|
|
6
8
|
applyThinkCommand,
|
|
7
9
|
autoTrimSessionIfNeeded,
|
|
8
10
|
buildInitPrompt,
|
|
11
|
+
buildSessionCostReport,
|
|
9
12
|
clearDevState,
|
|
13
|
+
costSourceNote,
|
|
14
|
+
estimateConversationTokens,
|
|
15
|
+
evaluateContextPressure,
|
|
10
16
|
loadDevState,
|
|
11
17
|
parseSimpleYaml,
|
|
12
18
|
persistToolRound,
|
|
@@ -15,15 +21,13 @@ import {
|
|
|
15
21
|
scanProject,
|
|
16
22
|
sessionHasMeaningfulContent,
|
|
17
23
|
setupProxy
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import {
|
|
20
|
-
CostTracker
|
|
21
|
-
} from "./chunk-V4D7YD24.js";
|
|
24
|
+
} from "./chunk-VNCBY4KY.js";
|
|
22
25
|
import {
|
|
26
|
+
CostTracker,
|
|
23
27
|
computeCost,
|
|
24
28
|
formatCost,
|
|
25
29
|
getPricing
|
|
26
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-R7GERZDA.js";
|
|
27
31
|
import {
|
|
28
32
|
buildReviewPrompt,
|
|
29
33
|
buildSecurityReviewPrompt
|
|
@@ -55,7 +59,7 @@ import {
|
|
|
55
59
|
setMaxOutputCap,
|
|
56
60
|
spawnAgentContext,
|
|
57
61
|
undoStack
|
|
58
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-74BK22BM.js";
|
|
59
63
|
import {
|
|
60
64
|
addMemoryEntry,
|
|
61
65
|
backupMemoryStore,
|
|
@@ -81,7 +85,7 @@ import {
|
|
|
81
85
|
touchMemoryReferences,
|
|
82
86
|
updateMemoryApproval,
|
|
83
87
|
updateMemoryEntry
|
|
84
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-WNG3YVZX.js";
|
|
85
89
|
import "./chunk-GLSR2NR3.js";
|
|
86
90
|
import "./chunk-UUSRWSSX.js";
|
|
87
91
|
import "./chunk-CKH4KQ4E.js";
|
|
@@ -99,14 +103,14 @@ import {
|
|
|
99
103
|
formatDoctorReport,
|
|
100
104
|
loadContextFiles,
|
|
101
105
|
writeCrashLog
|
|
102
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-YLSM7RF6.js";
|
|
103
107
|
import {
|
|
104
108
|
ProviderRegistry,
|
|
105
109
|
listBuiltInProviderMetadata
|
|
106
110
|
} from "./chunk-AUEX6RNY.js";
|
|
107
111
|
import {
|
|
108
112
|
ConfigManager
|
|
109
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-VGVKJTHF.js";
|
|
110
114
|
import {
|
|
111
115
|
describePlugin,
|
|
112
116
|
getActivePluginAssets,
|
|
@@ -123,7 +127,7 @@ import {
|
|
|
123
127
|
trustHook,
|
|
124
128
|
trustPlugin,
|
|
125
129
|
untrustHook
|
|
126
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-2FQGMR34.js";
|
|
127
131
|
import {
|
|
128
132
|
CONTENT_ONLY_STREAM_REMINDER,
|
|
129
133
|
TEE_FINAL_USER_NUDGE,
|
|
@@ -157,13 +161,12 @@ import {
|
|
|
157
161
|
import {
|
|
158
162
|
fileCheckpoints
|
|
159
163
|
} from "./chunk-4BKXL7SM.js";
|
|
160
|
-
import "./chunk-
|
|
164
|
+
import "./chunk-WWLXW4SY.js";
|
|
161
165
|
import {
|
|
162
166
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
163
167
|
AUTHOR,
|
|
164
168
|
AUTHOR_EMAIL,
|
|
165
169
|
CONFIG_DIR_NAME,
|
|
166
|
-
CONTEXT_PRESSURE_THRESHOLD,
|
|
167
170
|
CUSTOM_COMMANDS_DIR_NAME,
|
|
168
171
|
DEFAULT_MAX_TOKENS,
|
|
169
172
|
DEFAULT_MAX_TOOL_ROUNDS,
|
|
@@ -176,7 +179,7 @@ import {
|
|
|
176
179
|
SKILLS_DIR_NAME,
|
|
177
180
|
VERSION,
|
|
178
181
|
buildUserIdentityPrompt
|
|
179
|
-
} from "./chunk-
|
|
182
|
+
} from "./chunk-UT2WAJJG.js";
|
|
180
183
|
import {
|
|
181
184
|
buildChatIndex,
|
|
182
185
|
clearChatIndex,
|
|
@@ -1397,7 +1400,7 @@ No tools match "${filter}".
|
|
|
1397
1400
|
const { join: join6 } = await import("path");
|
|
1398
1401
|
const { existsSync: existsSync6 } = await import("fs");
|
|
1399
1402
|
const { getGitRoot: getGitRoot2 } = await import("./git-context-EXOEHQSF.js");
|
|
1400
|
-
const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-
|
|
1403
|
+
const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-G6VN7SJL.js");
|
|
1401
1404
|
const { approveProject, hashMcpFile } = await import("./project-trust-NKYHL3VZ.js");
|
|
1402
1405
|
const cwd = process.cwd();
|
|
1403
1406
|
const projectRoot = getGitRoot2(cwd) ?? cwd;
|
|
@@ -1601,15 +1604,6 @@ No tools match "${filter}".
|
|
|
1601
1604
|
// src/repl/commands/security-commands.ts
|
|
1602
1605
|
import { platform as platform2 } from "os";
|
|
1603
1606
|
import chalk2 from "chalk";
|
|
1604
|
-
function stripSurroundingQuotes(value) {
|
|
1605
|
-
const pairs = [['"', '"'], ["'", "'"], ["\u201C", "\u201D"], ["\u2018", "\u2019"], ["\u300C", "\u300D"]];
|
|
1606
|
-
for (const [open, close] of pairs) {
|
|
1607
|
-
if (value.length >= 2 && value.startsWith(open) && value.endsWith(close)) {
|
|
1608
|
-
return value.slice(open.length, value.length - close.length).trim();
|
|
1609
|
-
}
|
|
1610
|
-
}
|
|
1611
|
-
return value;
|
|
1612
|
-
}
|
|
1613
1607
|
function createSecurityCommands() {
|
|
1614
1608
|
return [
|
|
1615
1609
|
{
|
|
@@ -1673,58 +1667,32 @@ function createSecurityCommands() {
|
|
|
1673
1667
|
{
|
|
1674
1668
|
name: "profile",
|
|
1675
1669
|
description: 'View or edit your identity profile (the "soul" of AI)',
|
|
1676
|
-
usage: "/profile [show|
|
|
1670
|
+
usage: "/profile [show|set <field> <value>|clear|edit]",
|
|
1677
1671
|
execute(args, ctx) {
|
|
1678
|
-
const
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1672
|
+
const outcome = applyProfileCommand(args, ctx.config.get("userProfile") ?? {});
|
|
1673
|
+
if (outcome.profile) {
|
|
1674
|
+
ctx.config.set("userProfile", outcome.profile);
|
|
1675
|
+
ctx.config.save();
|
|
1676
|
+
}
|
|
1677
|
+
if (outcome.isError) {
|
|
1678
|
+
ctx.renderer.printInfo(outcome.summary);
|
|
1679
|
+
} else if (outcome.changed) {
|
|
1680
|
+
ctx.renderer.printSuccess(outcome.summary);
|
|
1681
|
+
} else if (outcome.rows.length > 0) {
|
|
1682
|
+
console.log(theme.heading(`
|
|
1683
|
+
${outcome.summary}
|
|
1684
|
+
`) + theme.dim("\u2500".repeat(50)));
|
|
1685
|
+
const pad = Math.max(...outcome.rows.map(([label]) => label.length)) + 1;
|
|
1686
|
+
for (const [label, value] of outcome.rows) {
|
|
1687
|
+
console.log(` ${theme.dim((label + ":").padEnd(pad + 1))} ${chalk2.white(value)}`);
|
|
1685
1688
|
}
|
|
1686
|
-
console.log(theme.heading("\n\u{1F464} Your Profile\n") + theme.dim("\u2500".repeat(50)));
|
|
1687
|
-
if (profile.name) console.log(` ${theme.dim("Name:")} ${chalk2.white(profile.name)}`);
|
|
1688
|
-
if (profile.nickname) console.log(` ${theme.dim("Nickname:")} ${theme.accent(profile.nickname)}`);
|
|
1689
|
-
if (profile.role) console.log(` ${theme.dim("Role:")} ${chalk2.white(profile.role)}`);
|
|
1690
|
-
if (profile.bio) console.log(` ${theme.dim("Bio:")} ${chalk2.white(profile.bio)}`);
|
|
1691
|
-
if (profile.interests?.length) console.log(` ${theme.dim("Interests:")} ${chalk2.white(profile.interests.join(", "))}`);
|
|
1692
|
-
if (profile.locale) console.log(` ${theme.dim("Locale:")} ${chalk2.white(profile.locale)}`);
|
|
1693
|
-
if (profile.extra) console.log(` ${theme.dim("Extra:")} ${chalk2.white(profile.extra.slice(0, 80))}${profile.extra.length > 80 ? "\u2026" : ""}`);
|
|
1694
1689
|
console.log(theme.dim("\u2500".repeat(50)));
|
|
1695
|
-
console.log(theme.dim(" This identity is injected into every AI conversation.\n"));
|
|
1696
|
-
} else if (sub === "edit") {
|
|
1697
|
-
ctx.renderer.printInfo("Use /config to open the interactive profile editor, or use:\n /profile set <field> <value>\n Fields: name, nickname, role, bio, interests, locale, extra");
|
|
1698
|
-
} else if (sub === "set") {
|
|
1699
|
-
const field = args[1];
|
|
1700
|
-
const value = args.slice(2).join(" ").trim();
|
|
1701
|
-
const validFields = ["name", "nickname", "role", "bio", "interests", "locale", "extra"];
|
|
1702
|
-
if (!field || !validFields.includes(field)) {
|
|
1703
|
-
ctx.renderer.printInfo(`Usage: /profile set <field> <value>
|
|
1704
|
-
Fields: ${validFields.join(", ")}`);
|
|
1705
|
-
return;
|
|
1706
|
-
}
|
|
1707
|
-
if (!value) {
|
|
1708
|
-
ctx.renderer.printInfo(`Usage: /profile set ${field} <value>`);
|
|
1709
|
-
return;
|
|
1710
|
-
}
|
|
1711
|
-
const updated = { ...profile };
|
|
1712
|
-
if (field === "interests") {
|
|
1713
|
-
updated.interests = value.split(",").map((s) => stripSurroundingQuotes(s.trim())).filter(Boolean);
|
|
1714
|
-
} else {
|
|
1715
|
-
updated[field] = stripSurroundingQuotes(value);
|
|
1716
|
-
}
|
|
1717
|
-
ctx.config.set("userProfile", updated);
|
|
1718
|
-
ctx.config.save();
|
|
1719
|
-
const displayVal = field === "interests" ? updated.interests : value;
|
|
1720
|
-
ctx.renderer.printSuccess(`Profile updated: ${field} = ${JSON.stringify(displayVal)}`);
|
|
1721
|
-
} else if (sub === "clear") {
|
|
1722
|
-
ctx.config.set("userProfile", {});
|
|
1723
|
-
ctx.config.save();
|
|
1724
|
-
ctx.renderer.printSuccess("Profile cleared. AI will no longer know who you are.");
|
|
1725
1690
|
} else {
|
|
1726
|
-
|
|
1691
|
+
console.log(theme.dim(`
|
|
1692
|
+
${outcome.summary}`));
|
|
1727
1693
|
}
|
|
1694
|
+
for (const line of outcome.details) console.log(theme.dim(` ${line}`));
|
|
1695
|
+
console.log();
|
|
1728
1696
|
}
|
|
1729
1697
|
},
|
|
1730
1698
|
// ── /memory ────────────────────────────────────────────────────────────────
|
|
@@ -2385,7 +2353,7 @@ function createReviewCommands() {
|
|
|
2385
2353
|
usage: "/test [command|filter]",
|
|
2386
2354
|
async execute(args, ctx) {
|
|
2387
2355
|
try {
|
|
2388
|
-
const { executeTests } = await import("./run-tests-
|
|
2356
|
+
const { executeTests } = await import("./run-tests-33X3D7PV.js");
|
|
2389
2357
|
const argStr = args.join(" ").trim();
|
|
2390
2358
|
let testArgs = {};
|
|
2391
2359
|
if (argStr) {
|
|
@@ -3772,21 +3740,16 @@ ${text}
|
|
|
3772
3740
|
}
|
|
3773
3741
|
const provider = ctx.getCurrentProvider();
|
|
3774
3742
|
const model = ctx.getCurrentModel();
|
|
3775
|
-
const pricing = getPricing(provider, model);
|
|
3776
3743
|
const accrued = ctx.getSessionAccruedCost();
|
|
3777
|
-
const
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
cacheReadTokens: 0
|
|
3787
|
-
});
|
|
3788
|
-
if (costWithoutCache != null) savings = costWithoutCache - liveCost;
|
|
3789
|
-
}
|
|
3744
|
+
const report = buildSessionCostReport({
|
|
3745
|
+
provider,
|
|
3746
|
+
model,
|
|
3747
|
+
usage: { ...usage, cacheCreationTokens: cacheCreate, cacheReadTokens: cacheRead },
|
|
3748
|
+
accruedUsd: accrued.usd,
|
|
3749
|
+
accrualIncomplete: accrued.incomplete
|
|
3750
|
+
});
|
|
3751
|
+
const cost = report.cost;
|
|
3752
|
+
const savings = report.savings;
|
|
3790
3753
|
console.log();
|
|
3791
3754
|
console.log(theme.heading(" \u{1F4B0} Session Cost & Token Usage"));
|
|
3792
3755
|
console.log(theme.dim(" " + "\u2500".repeat(48)));
|
|
@@ -3805,11 +3768,8 @@ ${text}
|
|
|
3805
3768
|
console.log(theme.dim(" " + "\u2500".repeat(48)));
|
|
3806
3769
|
if (cost != null) {
|
|
3807
3770
|
console.log(theme.dim(" Cost : ") + chalk3.bold.cyan(formatCost(cost).padStart(12)));
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
} else if (!usedAccrual) {
|
|
3811
|
-
console.log(theme.dim(" (estimated at current rates)"));
|
|
3812
|
-
}
|
|
3771
|
+
const note = costSourceNote(report.costSource);
|
|
3772
|
+
if (note) console.log(theme.dim(` ${note}`));
|
|
3813
3773
|
if (savings != null && savings > 0) {
|
|
3814
3774
|
console.log(
|
|
3815
3775
|
theme.dim(" Cache savings : ") + chalk3.green(`-${formatCost(savings)}`.padStart(12)) + theme.dim(` (vs no cache)`)
|
|
@@ -4263,10 +4223,20 @@ function createAgentCommands() {
|
|
|
4263
4223
|
{
|
|
4264
4224
|
name: "yolo",
|
|
4265
4225
|
description: "Toggle session auto-approve for write tools (/yolo)",
|
|
4266
|
-
usage: "/yolo [on|off]",
|
|
4226
|
+
usage: "/yolo [on|off|status]",
|
|
4267
4227
|
execute(args, ctx) {
|
|
4268
4228
|
const sub = args[0]?.toLowerCase();
|
|
4269
4229
|
const executor = ctx.getToolExecutor();
|
|
4230
|
+
if (sub === "status") {
|
|
4231
|
+
console.log(theme.info(` YOLO mode: ${executor.sessionAutoApprove ? "ON (write tools auto-approved)" : "OFF"}`));
|
|
4232
|
+
console.log();
|
|
4233
|
+
return;
|
|
4234
|
+
}
|
|
4235
|
+
if (sub !== void 0 && sub !== "on" && sub !== "off") {
|
|
4236
|
+
console.log(theme.warning(` Unknown /yolo option "${sub}" \u2014 expected on | off | status`));
|
|
4237
|
+
console.log();
|
|
4238
|
+
return;
|
|
4239
|
+
}
|
|
4270
4240
|
if (sub === "off") {
|
|
4271
4241
|
executor.sessionAutoApprove = false;
|
|
4272
4242
|
console.log(theme.info(" \u{1F512} Auto-approve disabled \u2014 confirmations restored for this session."));
|
|
@@ -6297,28 +6267,11 @@ Session '${this.resumeSessionId}' not found.
|
|
|
6297
6267
|
* 估算当前对话的总 token 消耗(system prompt + 所有 session messages)。
|
|
6298
6268
|
*/
|
|
6299
6269
|
estimateConversationTokens() {
|
|
6300
|
-
let total = 0;
|
|
6301
6270
|
const { stable: estStable, volatile: estVolatile } = this.buildCurrentSystemPrompt();
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
for (const msg of session.messages) {
|
|
6307
|
-
if (typeof msg.content === "string") {
|
|
6308
|
-
total += this.estimateTokens(msg.content);
|
|
6309
|
-
} else if (Array.isArray(msg.content)) {
|
|
6310
|
-
for (const part of msg.content) {
|
|
6311
|
-
if (part.type === "text" && part.text) total += this.estimateTokens(part.text);
|
|
6312
|
-
}
|
|
6313
|
-
}
|
|
6314
|
-
if (msg.toolCalls) {
|
|
6315
|
-
for (const tc of msg.toolCalls) {
|
|
6316
|
-
total += this.estimateTokens(JSON.stringify(tc.arguments));
|
|
6317
|
-
}
|
|
6318
|
-
}
|
|
6319
|
-
}
|
|
6320
|
-
}
|
|
6321
|
-
return total;
|
|
6271
|
+
return estimateConversationTokens({
|
|
6272
|
+
systemPrompt: [estStable, estVolatile].filter(Boolean).join("\n\n---\n\n"),
|
|
6273
|
+
messages: this.sessions.current?.messages ?? []
|
|
6274
|
+
});
|
|
6322
6275
|
}
|
|
6323
6276
|
/**
|
|
6324
6277
|
* 估算 agentic 循环当前请求的 token 数(包含 session messages + extraMessages + system prompt)。
|
|
@@ -6357,20 +6310,20 @@ Session '${this.resumeSessionId}' not found.
|
|
|
6357
6310
|
* 在每次 AI 回复后调用。
|
|
6358
6311
|
*/
|
|
6359
6312
|
async checkContextPressure() {
|
|
6360
|
-
if (!this.config.get("autoCompact")) return;
|
|
6361
6313
|
const contextWindow = this.getContextWindowSize();
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6314
|
+
const pressure = evaluateContextPressure({
|
|
6315
|
+
autoCompactEnabled: this.config.get("autoCompact") === true,
|
|
6316
|
+
estimatedTokens: contextWindow > 0 ? this.estimateConversationTokens() : 0,
|
|
6317
|
+
contextWindow
|
|
6318
|
+
});
|
|
6319
|
+
if (!pressure.shouldCompact) return;
|
|
6320
|
+
console.log(
|
|
6321
|
+
theme.warning(
|
|
6322
|
+
`
|
|
6323
|
+
\u26A0 Context pressure: ~${pressure.percent}% of ${fmtTokens(contextWindow)} window used. Auto-compacting...`
|
|
6324
|
+
)
|
|
6325
|
+
);
|
|
6326
|
+
await this.compactSession(AUTO_COMPACT_INSTRUCTION);
|
|
6374
6327
|
}
|
|
6375
6328
|
// ─── Tab 自动补全 ──────────────────────────────────────────────────────
|
|
6376
6329
|
/**
|
|
@@ -7696,7 +7649,7 @@ program.command("web").description("Start Web UI server with browser-based chat
|
|
|
7696
7649
|
console.error("Error: Invalid port number. Must be between 1 and 65535.");
|
|
7697
7650
|
process.exit(1);
|
|
7698
7651
|
}
|
|
7699
|
-
const { startWebServer } = await import("./server-
|
|
7652
|
+
const { startWebServer } = await import("./server-NJ3ZNPQW.js");
|
|
7700
7653
|
await startWebServer({ port, host: options.host });
|
|
7701
7654
|
});
|
|
7702
7655
|
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) => {
|
|
@@ -7863,11 +7816,11 @@ program.command("sessions").description("List recent conversation sessions").opt
|
|
|
7863
7816
|
console.log(footer + "\n");
|
|
7864
7817
|
});
|
|
7865
7818
|
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) => {
|
|
7866
|
-
const { runUsageCli } = await import("./usage-
|
|
7819
|
+
const { runUsageCli } = await import("./usage-IFTNXTWC.js");
|
|
7867
7820
|
await runUsageCli(options);
|
|
7868
7821
|
});
|
|
7869
7822
|
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) => {
|
|
7870
|
-
const { runDoctorCli } = await import("./doctor-cli-
|
|
7823
|
+
const { runDoctorCli } = await import("./doctor-cli-Y3SVVJBO.js");
|
|
7871
7824
|
const argv = process.argv.slice(2);
|
|
7872
7825
|
await runDoctorCli({
|
|
7873
7826
|
json: !!options.json || argv.includes("--json"),
|
|
@@ -7876,7 +7829,7 @@ program.command("doctor").description("Health check: API keys, config, MCP, rece
|
|
|
7876
7829
|
});
|
|
7877
7830
|
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) => {
|
|
7878
7831
|
try {
|
|
7879
|
-
const batch = await import("./batch-
|
|
7832
|
+
const batch = await import("./batch-2N2YMRX2.js");
|
|
7880
7833
|
switch (action) {
|
|
7881
7834
|
case "submit":
|
|
7882
7835
|
if (!arg) {
|
|
@@ -7919,7 +7872,7 @@ program.command("batch <action> [arg] [arg2]").description("Anthropic Message Ba
|
|
|
7919
7872
|
}
|
|
7920
7873
|
});
|
|
7921
7874
|
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) => {
|
|
7922
|
-
const { startMcpServer } = await import("./server-
|
|
7875
|
+
const { startMcpServer } = await import("./server-3LERX42X.js");
|
|
7923
7876
|
await startMcpServer({
|
|
7924
7877
|
allowDestructive: !!options.allowDestructive,
|
|
7925
7878
|
allowOutsideCwd: !!options.allowOutsideCwd,
|
|
@@ -7932,7 +7885,7 @@ program.command("pr <action> [target]").description("PR review helpers: review |
|
|
|
7932
7885
|
console.error(`Unknown pr action: ${action}. Use review | security-review | summarize.`);
|
|
7933
7886
|
process.exit(1);
|
|
7934
7887
|
}
|
|
7935
|
-
const { runPrCli } = await import("./pr-
|
|
7888
|
+
const { runPrCli } = await import("./pr-NF5IWLH3.js");
|
|
7936
7889
|
const result = await runPrCli({
|
|
7937
7890
|
action,
|
|
7938
7891
|
target,
|
|
@@ -7952,8 +7905,8 @@ program.command("pr <action> [target]").description("PR review helpers: review |
|
|
|
7952
7905
|
process.exit(result.exitCode);
|
|
7953
7906
|
});
|
|
7954
7907
|
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) => {
|
|
7955
|
-
const { runCi } = await import("./ci-
|
|
7956
|
-
const { formatCiResult } = await import("./ci-format-
|
|
7908
|
+
const { runCi } = await import("./ci-3RWVJSZ3.js");
|
|
7909
|
+
const { formatCiResult } = await import("./ci-format-M6HVCXCG.js");
|
|
7957
7910
|
const formats = [options.json, options.markdown, options.sarif].filter(Boolean).length;
|
|
7958
7911
|
if (formats > 1) {
|
|
7959
7912
|
console.error("Choose only one output format: --json, --markdown, or --sarif.");
|
|
@@ -8111,7 +8064,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
|
|
|
8111
8064
|
config.get("customProviders"),
|
|
8112
8065
|
config.getConfigDir()
|
|
8113
8066
|
);
|
|
8114
|
-
const { startHub } = await import("./hub-
|
|
8067
|
+
const { startHub } = await import("./hub-5T5HKOAR.js");
|
|
8115
8068
|
await startHub(
|
|
8116
8069
|
{
|
|
8117
8070
|
topic: topic ?? "",
|
|
@@ -28,9 +28,9 @@ import {
|
|
|
28
28
|
touchMemoryReferences,
|
|
29
29
|
updateMemoryApproval,
|
|
30
30
|
updateMemoryEntry
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-WNG3YVZX.js";
|
|
32
32
|
import "./chunk-HOSJZMQS.js";
|
|
33
|
-
import "./chunk-
|
|
33
|
+
import "./chunk-UT2WAJJG.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-RRQZRSXW.js";
|
|
31
31
|
import "./chunk-YVTASHS5.js";
|
|
32
|
-
import "./chunk-
|
|
32
|
+
import "./chunk-EPVJS4F6.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-Z7CZ72RP.js";
|
|
6
|
+
import "./chunk-7US7K3CD.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-VGVKJTHF.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-UT2WAJJG.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-74BK22BM.js";
|
|
5
|
+
import "./chunk-WNG3YVZX.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-2FQGMR34.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-WWLXW4SY.js";
|
|
22
22
|
import {
|
|
23
23
|
VERSION
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-UT2WAJJG.js";
|
|
25
25
|
import "./chunk-6RPGQ5CG.js";
|
|
26
26
|
import "./chunk-KHYD3WXE.js";
|
|
27
27
|
import "./chunk-NYNSYLFY.js";
|