jinzd-ai-cli 0.4.267 → 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.
Files changed (31) hide show
  1. package/dist/{batch-GY5MAN5F.js → batch-2N2YMRX2.js} +2 -2
  2. package/dist/{chunk-WPN7LDLM.js → chunk-2FQGMR34.js} +1 -1
  3. package/dist/{chunk-5AEOIETL.js → chunk-74BK22BM.js} +4 -4
  4. package/dist/{chunk-6C6FLDGH.js → chunk-7US7K3CD.js} +1 -1
  5. package/dist/{chunk-7HECI3U5.js → chunk-EPVJS4F6.js} +3 -1
  6. package/dist/{chunk-FI6IWUXW.js → chunk-RRQZRSXW.js} +1 -1
  7. package/dist/{chunk-THHPKZJ3.js → chunk-UT2WAJJG.js} +1 -1
  8. package/dist/{chunk-EWRZMIQE.js → chunk-VGVKJTHF.js} +1 -1
  9. package/dist/{chunk-JH343BDI.js → chunk-VNCBY4KY.js} +153 -2
  10. package/dist/{chunk-RVNL7MQG.js → chunk-WNG3YVZX.js} +1 -1
  11. package/dist/{chunk-XLLUQEGO.js → chunk-WWLXW4SY.js} +1 -1
  12. package/dist/{chunk-ARYCWJN6.js → chunk-XDITAGE5.js} +1 -1
  13. package/dist/{chunk-QN7WD2SM.js → chunk-YLSM7RF6.js} +3 -3
  14. package/dist/{chunk-5CU72V6P.js → chunk-Z7CZ72RP.js} +3 -3
  15. package/dist/{ci-MUEQSNKU.js → ci-3RWVJSZ3.js} +4 -4
  16. package/dist/{ci-format-2ZGGSOFK.js → ci-format-M6HVCXCG.js} +2 -2
  17. package/dist/{constants-SZTJESDF.js → constants-G6VN7SJL.js} +1 -1
  18. package/dist/{doctor-cli-Z272364P.js → doctor-cli-Y3SVVJBO.js} +4 -4
  19. package/dist/electron-server.js +216 -16
  20. package/dist/{hub-MRLGKMRI.js → hub-5T5HKOAR.js} +1 -1
  21. package/dist/index.js +72 -111
  22. package/dist/{persistent-memory-HZASMDJQ.js → persistent-memory-XVSSR277.js} +2 -2
  23. package/dist/{persistent-memory-3FTOC7QT.js → persistent-memory-YBWIZWQP.js} +2 -2
  24. package/dist/{pr-VLLIALRK.js → pr-NF5IWLH3.js} +4 -4
  25. package/dist/{run-tests-NTDZ6DDU.js → run-tests-33X3D7PV.js} +2 -2
  26. package/dist/{run-tests-6MWE6D5S.js → run-tests-Y44SCLIO.js} +2 -2
  27. package/dist/{server-SP3AEHRQ.js → server-3LERX42X.js} +5 -5
  28. package/dist/{server-IALCWKSU.js → server-NJ3ZNPQW.js} +79 -21
  29. package/dist/{task-orchestrator-Q6WFFI4J.js → task-orchestrator-JN2WFZSF.js} +5 -5
  30. package/dist/{usage-DJDLHICZ.js → usage-IFTNXTWC.js} +2 -2
  31. package/package.json +1 -1
@@ -13,20 +13,24 @@ import {
13
13
  TOKEN_EXPIRY_MS
14
14
  } from "./chunk-RYQBBEMM.js";
15
15
  import {
16
+ AUTO_COMPACT_INSTRUCTION,
16
17
  McpManager,
17
18
  SkillManager,
19
+ applyProfileCommand,
18
20
  applyThinkCommand,
19
21
  autoTrimSessionIfNeeded,
20
22
  buildInitPrompt,
21
23
  buildSessionCostReport,
22
24
  costSourceNote,
25
+ estimateConversationTokens,
26
+ evaluateContextPressure,
23
27
  loadDevState,
24
28
  persistToolRound,
25
29
  readGitDiff,
26
30
  scanDirTree,
27
31
  scanProject,
28
32
  setupProxy
29
- } from "./chunk-JH343BDI.js";
33
+ } from "./chunk-VNCBY4KY.js";
30
34
  import {
31
35
  CostTracker,
32
36
  computeCost,
@@ -71,7 +75,7 @@ import {
71
75
  spawnAgentContext,
72
76
  truncateOutput,
73
77
  undoStack
74
- } from "./chunk-5AEOIETL.js";
78
+ } from "./chunk-74BK22BM.js";
75
79
  import {
76
80
  addMemoryEntry,
77
81
  clearMemoryEntries,
@@ -85,7 +89,7 @@ import {
85
89
  parseWritableScope,
86
90
  updateMemoryApproval,
87
91
  updateMemoryEntry
88
- } from "./chunk-RVNL7MQG.js";
92
+ } from "./chunk-WNG3YVZX.js";
89
93
  import "./chunk-GLSR2NR3.js";
90
94
  import "./chunk-UUSRWSSX.js";
91
95
  import "./chunk-CKH4KQ4E.js";
@@ -99,13 +103,13 @@ import {
99
103
  buildDoctorReport,
100
104
  formatDoctorReport,
101
105
  loadContextFiles
102
- } from "./chunk-QN7WD2SM.js";
106
+ } from "./chunk-YLSM7RF6.js";
103
107
  import {
104
108
  ProviderRegistry
105
109
  } from "./chunk-AUEX6RNY.js";
106
110
  import {
107
111
  ConfigManager
108
- } from "./chunk-EWRZMIQE.js";
112
+ } from "./chunk-VGVKJTHF.js";
109
113
  import {
110
114
  describePlugin,
111
115
  getActivePluginAssets,
@@ -120,7 +124,7 @@ import {
120
124
  runTool,
121
125
  setPluginEnabled,
122
126
  trustPlugin
123
- } from "./chunk-WPN7LDLM.js";
127
+ } from "./chunk-2FQGMR34.js";
124
128
  import {
125
129
  CONTENT_ONLY_STREAM_REMINDER,
126
130
  TEE_FINAL_USER_NUDGE,
@@ -145,7 +149,7 @@ import {
145
149
  getGitRoot
146
150
  } from "./chunk-HOSJZMQS.js";
147
151
  import "./chunk-4BKXL7SM.js";
148
- import "./chunk-XLLUQEGO.js";
152
+ import "./chunk-WWLXW4SY.js";
149
153
  import {
150
154
  AGENTIC_BEHAVIOR_GUIDELINE,
151
155
  AUTHOR,
@@ -161,7 +165,7 @@ import {
161
165
  SKILLS_DIR_NAME,
162
166
  VERSION,
163
167
  buildUserIdentityPrompt
164
- } from "./chunk-THHPKZJ3.js";
168
+ } from "./chunk-UT2WAJJG.js";
165
169
  import "./chunk-6RPGQ5CG.js";
166
170
  import "./chunk-KHYD3WXE.js";
167
171
  import "./chunk-NYNSYLFY.js";
@@ -787,6 +791,12 @@ async function handlePlan(args, ctx) {
787
791
  } else if (sub === "execute") {
788
792
  ctx.planMode = false;
789
793
  ctx.send({ type: "info", message: "Plan mode OFF. Executing with all tools enabled." });
794
+ } else if (sub === "status" || sub === "show") {
795
+ ctx.send({ type: "info", message: `Plan mode: ${ctx.planMode ? "ON (read-only tools only)" : "OFF"}` });
796
+ return;
797
+ } else if (sub !== void 0) {
798
+ ctx.send({ type: "error", message: `Unknown /plan option "${sub}" \u2014 expected execute | exit | status` });
799
+ return;
790
800
  } else {
791
801
  ctx.planMode = !ctx.planMode;
792
802
  ctx.send({ type: "info", message: `Plan mode: ${ctx.planMode ? "ON (read-only tools only)" : "OFF"}` });
@@ -835,7 +845,7 @@ Cache: write=${cacheCreate} read=${cacheRead}` : "";
835
845
  Cost: ${formatCost(cost)}` : "";
836
846
  let memoryLine = "";
837
847
  try {
838
- const { countPendingMemories } = await import("./persistent-memory-HZASMDJQ.js");
848
+ const { countPendingMemories } = await import("./persistent-memory-XVSSR277.js");
839
849
  const pending = countPendingMemories(ctx.config.getConfigDir());
840
850
  if (pending > 0) memoryLine = `
841
851
  Memory: \u26A0 ${pending} pending approval \u2014 see the Memory panel or /memory`;
@@ -1648,7 +1658,7 @@ async function handleTest(args, ctx) {
1648
1658
  const isCommand = argStr.includes(" ") || /^(mvn|gradle|npm|pytest|cargo|go)\b/.test(argStr);
1649
1659
  testArgs = isCommand ? { command: argStr } : { filter: argStr };
1650
1660
  }
1651
- const runTests = ctx.runTests ?? (await import("./run-tests-NTDZ6DDU.js")).executeTests;
1661
+ const runTests = ctx.runTests ?? (await import("./run-tests-33X3D7PV.js")).executeTests;
1652
1662
  const report = await runTests(testArgs);
1653
1663
  ctx.send({ type: "info", message: report });
1654
1664
  } catch (err) {
@@ -1906,7 +1916,7 @@ async function handleMemory(args, ctx) {
1906
1916
  ctx.handleMemoryManage(sub, args[1], sub === "expire" ? args[2] : void 0);
1907
1917
  } else if (sub === "export") {
1908
1918
  if (args[1] === "md") {
1909
- const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-HZASMDJQ.js");
1919
+ const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-XVSSR277.js");
1910
1920
  ctx.send({
1911
1921
  type: "export_data",
1912
1922
  format: "md",
@@ -2018,6 +2028,18 @@ async function handleBug(_args, ctx) {
2018
2028
  ];
2019
2029
  ctx.send({ type: "info", message: lines.join("\n") });
2020
2030
  }
2031
+ async function handleProfile(args, ctx) {
2032
+ const outcome = applyProfileCommand(args, ctx.config.get("userProfile") ?? {});
2033
+ if (outcome.profile) {
2034
+ ctx.config.set("userProfile", outcome.profile);
2035
+ ctx.config.save();
2036
+ }
2037
+ const lines = [outcome.summary];
2038
+ for (const [label, value] of outcome.rows) lines.push(` ${label}: ${value}`);
2039
+ for (const line of outcome.details) lines.push(line);
2040
+ ctx.send({ type: outcome.isError ? "error" : "info", message: lines.join("\n") });
2041
+ if (outcome.changed) ctx.sendStatus();
2042
+ }
2021
2043
 
2022
2044
  // src/web/commands/agent-commands.ts
2023
2045
  async function handleAuto(args, ctx) {
@@ -2061,6 +2083,17 @@ async function handlePermissions(args, ctx) {
2061
2083
  }
2062
2084
  async function handleYolo(args, ctx) {
2063
2085
  const sub = args[0]?.toLowerCase();
2086
+ if (sub === "status") {
2087
+ ctx.send({
2088
+ type: "info",
2089
+ message: `YOLO mode: ${ctx.toolExecutor.sessionAutoApprove ? "ON (write tools auto-approved)" : "OFF"}`
2090
+ });
2091
+ return;
2092
+ }
2093
+ if (sub !== void 0 && sub !== "on" && sub !== "off") {
2094
+ ctx.send({ type: "error", message: `Unknown /yolo option "${sub}" \u2014 expected on | off | status` });
2095
+ return;
2096
+ }
2064
2097
  if (sub === "off") {
2065
2098
  ctx.toolExecutor.sessionAutoApprove = false;
2066
2099
  ctx.send({ type: "info", message: "\u{1F512} Auto-approve disabled \u2014 confirmations restored for this session." });
@@ -2272,14 +2305,17 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
2272
2305
  }
2273
2306
 
2274
2307
  // src/web/session-handler.ts
2275
- var CLI_ONLY_WEB_COMMANDS = /* @__PURE__ */ new Set([
2276
- "copy",
2277
- "paste",
2278
- "exit",
2279
- "quit",
2280
- "snapshot",
2281
- "hooks",
2282
- "hook"
2308
+ var CLI_ONLY_WEB_COMMANDS = /* @__PURE__ */ new Map([
2309
+ ["copy", "It copies to the terminal clipboard; use your browser/OS copy instead."],
2310
+ ["paste", "It reads the terminal clipboard; paste directly into the composer instead."],
2311
+ ["exit", "Close the browser tab to end this Web session."],
2312
+ ["quit", "Close the browser tab to end this Web session."],
2313
+ ["snapshot", "Dev-state snapshots are written when the terminal REPL exits."],
2314
+ ["hooks", "Hook trust is granted per machine from the terminal."],
2315
+ ["hook", "Hook trust is granted per machine from the terminal."],
2316
+ // 以下两条并非「终端才有意义」,而是 Web 侧尚未实现——如实说明,别假装是设计。
2317
+ ["route", "Smart model routing is not applied to Web sessions yet (config.routing is REPL-only)."],
2318
+ ["security", "Redaction status and toggles are terminal-only for now; /status shows the current profile."]
2283
2319
  ]);
2284
2320
  var webCommandHandlers = {
2285
2321
  provider: handleProvider,
@@ -2315,6 +2351,7 @@ var webCommandHandlers = {
2315
2351
  config: handleConfig,
2316
2352
  doctor: handleDoctor,
2317
2353
  bug: handleBug,
2354
+ profile: handleProfile,
2318
2355
  auto: handleAuto,
2319
2356
  permissions: handlePermissions,
2320
2357
  yolo: handleYolo,
@@ -2822,6 +2859,7 @@ var SessionHandler = class {
2822
2859
  } else {
2823
2860
  await this.handleChatSimple(provider, session.messages);
2824
2861
  }
2862
+ await this.checkContextPressure();
2825
2863
  } catch (err) {
2826
2864
  const parts = [];
2827
2865
  let current = err;
@@ -3340,10 +3378,11 @@ ${summaryContent}`,
3340
3378
  }
3341
3379
  // ── Commands ─────────────────────────────────────────────────────
3342
3380
  async handleCommand(name, args) {
3343
- if (CLI_ONLY_WEB_COMMANDS.has(name)) {
3381
+ const cliOnlyReason = CLI_ONLY_WEB_COMMANDS.get(name);
3382
+ if (cliOnlyReason) {
3344
3383
  this.send({
3345
3384
  type: "error",
3346
- message: `/${name} is only available in the terminal REPL. Run \`aicli\` in a terminal and use /${name} there.`
3385
+ message: `/${name} is not available in the Web UI. ${cliOnlyReason}`
3347
3386
  });
3348
3387
  return;
3349
3388
  }
@@ -3354,6 +3393,25 @@ ${summaryContent}`,
3354
3393
  this.send({ type: "error", message: `Unknown command: /${name}. Type /help for available commands.` });
3355
3394
  }
3356
3395
  }
3396
+ /**
3397
+ * 到达上下文压力阈值时自动压缩(与 REPL 同一判据,见 core/context-pressure.ts)。
3398
+ * 上下文窗口未知时不动——不基于猜测改用户的对话历史。
3399
+ */
3400
+ async checkContextPressure() {
3401
+ const contextWindow = this.getContextWindowSize();
3402
+ const session = this.sessions.current;
3403
+ const pressure = evaluateContextPressure({
3404
+ autoCompactEnabled: this.config.get("autoCompact") === true,
3405
+ estimatedTokens: contextWindow > 0 && session ? estimateConversationTokens({ systemPrompt: this.activeSystemPrompt, messages: session.messages }) : 0,
3406
+ contextWindow
3407
+ });
3408
+ if (!pressure.shouldCompact) return;
3409
+ this.send({
3410
+ type: "info",
3411
+ message: `\u26A0 Context pressure: ~${pressure.percent}% of the ${contextWindow.toLocaleString()}-token window used. Auto-compacting\u2026`
3412
+ });
3413
+ await this.compactSession(AUTO_COMPACT_INSTRUCTION);
3414
+ }
3357
3415
  async compactSession(instruction) {
3358
3416
  const session = this.sessions.current;
3359
3417
  if (!session || session.messages.length < 6) {
@@ -3,8 +3,8 @@ import {
3
3
  ToolRegistry,
4
4
  googleSearchContext,
5
5
  truncateOutput
6
- } from "./chunk-5AEOIETL.js";
7
- import "./chunk-RVNL7MQG.js";
6
+ } from "./chunk-74BK22BM.js";
7
+ import "./chunk-WNG3YVZX.js";
8
8
  import "./chunk-GLSR2NR3.js";
9
9
  import "./chunk-UUSRWSSX.js";
10
10
  import "./chunk-CKH4KQ4E.js";
@@ -12,7 +12,7 @@ import "./chunk-BXP6YZ2P.js";
12
12
  import "./chunk-5C76XDDF.js";
13
13
  import {
14
14
  runTool
15
- } from "./chunk-WPN7LDLM.js";
15
+ } from "./chunk-2FQGMR34.js";
16
16
  import {
17
17
  getDangerLevel,
18
18
  runLeanAgentLoop
@@ -20,10 +20,10 @@ import {
20
20
  import "./chunk-TU3L3PW7.js";
21
21
  import "./chunk-HOSJZMQS.js";
22
22
  import "./chunk-4BKXL7SM.js";
23
- import "./chunk-XLLUQEGO.js";
23
+ import "./chunk-WWLXW4SY.js";
24
24
  import {
25
25
  SUBAGENT_ALLOWED_TOOLS
26
- } from "./chunk-THHPKZJ3.js";
26
+ } from "./chunk-UT2WAJJG.js";
27
27
  import "./chunk-6RPGQ5CG.js";
28
28
  import "./chunk-KHYD3WXE.js";
29
29
  import "./chunk-NYNSYLFY.js";
@@ -6,9 +6,9 @@ import {
6
6
  } from "./chunk-R7GERZDA.js";
7
7
  import {
8
8
  ConfigManager
9
- } from "./chunk-EWRZMIQE.js";
9
+ } from "./chunk-VGVKJTHF.js";
10
10
  import "./chunk-TU3L3PW7.js";
11
- import "./chunk-THHPKZJ3.js";
11
+ import "./chunk-UT2WAJJG.js";
12
12
  import "./chunk-IW3Q7AE5.js";
13
13
 
14
14
  // src/cli/usage.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jinzd-ai-cli",
3
- "version": "0.4.267",
3
+ "version": "0.4.268",
4
4
  "description": "Cross-platform REPL-style AI CLI with multi-provider support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",