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
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ConfigManager
4
- } from "./chunk-EWRZMIQE.js";
4
+ } from "./chunk-VGVKJTHF.js";
5
5
  import "./chunk-TU3L3PW7.js";
6
- import "./chunk-THHPKZJ3.js";
6
+ import "./chunk-UT2WAJJG.js";
7
7
  import {
8
8
  atomicWriteFileSync
9
9
  } from "./chunk-IW3Q7AE5.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  CONFIG_DIR_NAME,
4
4
  PLUGINS_DIR_NAME
5
- } from "./chunk-THHPKZJ3.js";
5
+ } from "./chunk-UT2WAJJG.js";
6
6
  import {
7
7
  atomicWriteFileSync
8
8
  } from "./chunk-IW3Q7AE5.js";
@@ -7,7 +7,7 @@ import {
7
7
  searchPersistentMemories,
8
8
  touchMemoryReferences,
9
9
  updateMemoryEntry
10
- } from "./chunk-RVNL7MQG.js";
10
+ } from "./chunk-WNG3YVZX.js";
11
11
  import {
12
12
  indexProject
13
13
  } from "./chunk-GLSR2NR3.js";
@@ -26,7 +26,7 @@ import {
26
26
  runHook,
27
27
  runLifecycleHooks,
28
28
  runTool
29
- } from "./chunk-WPN7LDLM.js";
29
+ } from "./chunk-2FQGMR34.js";
30
30
  import {
31
31
  buildTruncatedArgumentsError,
32
32
  getDangerLevel,
@@ -43,14 +43,14 @@ import {
43
43
  } from "./chunk-4BKXL7SM.js";
44
44
  import {
45
45
  runTestsTool
46
- } from "./chunk-XLLUQEGO.js";
46
+ } from "./chunk-WWLXW4SY.js";
47
47
  import {
48
48
  CONFIG_DIR_NAME,
49
49
  DEFAULT_MAX_TOOL_OUTPUT_CHARS_CAP,
50
50
  SUBAGENT_ALLOWED_TOOLS,
51
51
  SUBAGENT_DEFAULT_MAX_ROUNDS,
52
52
  SUBAGENT_MAX_ROUNDS_LIMIT
53
- } from "./chunk-THHPKZJ3.js";
53
+ } from "./chunk-UT2WAJJG.js";
54
54
  import {
55
55
  loadChatIndex,
56
56
  searchChatMemory
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  VERSION
4
- } from "./chunk-THHPKZJ3.js";
4
+ } from "./chunk-UT2WAJJG.js";
5
5
 
6
6
  // src/cli/ci-format.ts
7
7
  var DEFAULT_CI_THRESHOLDS = {
@@ -1,5 +1,5 @@
1
1
  // src/core/constants.ts
2
- var VERSION = "0.4.267";
2
+ var VERSION = "0.4.268";
3
3
  var APP_NAME = "ai-cli";
4
4
  var CONFIG_DIR_NAME = ".aicli";
5
5
  var CONFIG_FILE_NAME = "config.json";
@@ -82,6 +82,7 @@ var SUBAGENT_ALLOWED_TOOLS = /* @__PURE__ */ new Set([
82
82
  "find_references",
83
83
  "search_code"
84
84
  ]);
85
+ var CONTEXT_PRESSURE_THRESHOLD = 0.8;
85
86
  var TEST_TIMEOUT = 3e5;
86
87
  var AGENTIC_BEHAVIOR_GUIDELINE = `# Important Behavioral Guidelines
87
88
 
@@ -155,6 +156,7 @@ export {
155
156
  SUBAGENT_DEFAULT_MAX_ROUNDS,
156
157
  SUBAGENT_MAX_ROUNDS_LIMIT,
157
158
  SUBAGENT_ALLOWED_TOOLS,
159
+ CONTEXT_PRESSURE_THRESHOLD,
158
160
  TEST_TIMEOUT,
159
161
  AGENTIC_BEHAVIOR_GUIDELINE,
160
162
  buildUserIdentityPrompt,
@@ -6,7 +6,7 @@ import {
6
6
  MEMORY_FILE_NAME,
7
7
  MEMORY_MAX_CHARS,
8
8
  MEMORY_STORE_FILE_NAME
9
- } from "./chunk-7HECI3U5.js";
9
+ } from "./chunk-EPVJS4F6.js";
10
10
  import {
11
11
  atomicWriteFileSync
12
12
  } from "./chunk-6BUTA5VW.js";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/core/constants.ts
4
- var VERSION = "0.4.267";
4
+ var VERSION = "0.4.268";
5
5
  var APP_NAME = "ai-cli";
6
6
  var CONFIG_DIR_NAME = ".aicli";
7
7
  var CONFIG_FILE_NAME = "config.json";
@@ -8,7 +8,7 @@ import {
8
8
  CONFIG_FILE_NAME,
9
9
  HISTORY_DIR_NAME,
10
10
  PLUGINS_DIR_NAME
11
- } from "./chunk-THHPKZJ3.js";
11
+ } from "./chunk-UT2WAJJG.js";
12
12
  import {
13
13
  atomicWriteFileSync
14
14
  } from "./chunk-IW3Q7AE5.js";
@@ -3,18 +3,20 @@ import {
3
3
  computeCost
4
4
  } from "./chunk-R7GERZDA.js";
5
5
  import {
6
+ estimateTokens,
6
7
  truncateForPersist
7
- } from "./chunk-5AEOIETL.js";
8
+ } from "./chunk-74BK22BM.js";
8
9
  import {
9
10
  APP_NAME,
10
11
  CONFIG_DIR_NAME,
12
+ CONTEXT_PRESSURE_THRESHOLD,
11
13
  DEV_STATE_FILE_NAME,
12
14
  MCP_CALL_TIMEOUT,
13
15
  MCP_CONNECT_TIMEOUT,
14
16
  MCP_PROTOCOL_VERSION,
15
17
  MCP_TOOL_PREFIX,
16
18
  VERSION
17
- } from "./chunk-THHPKZJ3.js";
19
+ } from "./chunk-UT2WAJJG.js";
18
20
  import {
19
21
  atomicWriteFileSync
20
22
  } from "./chunk-IW3Q7AE5.js";
@@ -978,6 +980,38 @@ function autoTrimSessionIfNeeded(session, sizeLimit = SESSION_SIZE_LIMIT) {
978
980
  return committedSize < originalSize;
979
981
  }
980
982
 
983
+ // src/core/context-pressure.ts
984
+ function estimateConversationTokens(input) {
985
+ let total = 0;
986
+ if (input.systemPrompt) total += estimateTokens(input.systemPrompt);
987
+ for (const msg of input.messages) {
988
+ if (typeof msg.content === "string") {
989
+ total += estimateTokens(msg.content);
990
+ } else if (Array.isArray(msg.content)) {
991
+ for (const part of msg.content) {
992
+ if (part.type === "text" && part.text) total += estimateTokens(part.text);
993
+ }
994
+ }
995
+ if (msg.toolCalls) {
996
+ for (const tc of msg.toolCalls) {
997
+ total += estimateTokens(JSON.stringify(tc.arguments));
998
+ }
999
+ }
1000
+ }
1001
+ return total;
1002
+ }
1003
+ function evaluateContextPressure(input) {
1004
+ if (input.contextWindow <= 0) return { shouldCompact: false, ratio: null, percent: null };
1005
+ const ratio = input.estimatedTokens / input.contextWindow;
1006
+ const threshold = input.threshold ?? CONTEXT_PRESSURE_THRESHOLD;
1007
+ return {
1008
+ shouldCompact: input.autoCompactEnabled && ratio >= threshold,
1009
+ ratio,
1010
+ percent: Math.round(ratio * 100)
1011
+ };
1012
+ }
1013
+ var AUTO_COMPACT_INSTRUCTION = "Preserve key context, compress old content, ensure seamless continuation";
1014
+
981
1015
  // src/repl/dev-state.ts
982
1016
  import { existsSync as existsSync3, readFileSync as readFileSync3, unlinkSync, mkdirSync as mkdirSync2 } from "fs";
983
1017
  import { join as join3 } from "path";
@@ -1130,6 +1164,119 @@ function applyThinkCommand(sub, state) {
1130
1164
  return stay(`Unknown /think option "${sub}" \u2014 expected on | off | low | high | max | status`);
1131
1165
  }
1132
1166
 
1167
+ // src/core/profile-command.ts
1168
+ var PROFILE_FIELDS = ["name", "nickname", "role", "bio", "interests", "locale", "extra"];
1169
+ function stripSurroundingQuotes(value) {
1170
+ const pairs = [['"', '"'], ["'", "'"], ["\u201C", "\u201D"], ["\u2018", "\u2019"], ["\u300C", "\u300D"]];
1171
+ for (const [open, close] of pairs) {
1172
+ if (value.length >= 2 && value.startsWith(open) && value.endsWith(close)) {
1173
+ return value.slice(open.length, value.length - close.length).trim();
1174
+ }
1175
+ }
1176
+ return value;
1177
+ }
1178
+ function showRows(profile) {
1179
+ const rows = [];
1180
+ if (profile.name) rows.push(["Name", profile.name]);
1181
+ if (profile.nickname) rows.push(["Nickname", profile.nickname]);
1182
+ if (profile.role) rows.push(["Role", profile.role]);
1183
+ if (profile.bio) rows.push(["Bio", profile.bio]);
1184
+ if (profile.interests?.length) rows.push(["Interests", profile.interests.join(", ")]);
1185
+ if (profile.locale) rows.push(["Locale", profile.locale]);
1186
+ if (profile.extra) {
1187
+ rows.push(["Extra", profile.extra.length > 80 ? `${profile.extra.slice(0, 80)}\u2026` : profile.extra]);
1188
+ }
1189
+ return rows;
1190
+ }
1191
+ function applyProfileCommand(args, profile) {
1192
+ const sub = (args[0] ?? "show").toLowerCase();
1193
+ if (sub === "show" || sub === "view") {
1194
+ const rows = showRows(profile);
1195
+ if (rows.length === 0) {
1196
+ return {
1197
+ summary: "No profile configured yet.",
1198
+ rows: [],
1199
+ details: ["Set one with /profile set <field> <value> \u2014 it is injected into every conversation."],
1200
+ changed: false,
1201
+ isError: false
1202
+ };
1203
+ }
1204
+ return {
1205
+ summary: "\u{1F464} Your Profile",
1206
+ rows,
1207
+ details: ["This identity is injected into every AI conversation."],
1208
+ changed: false,
1209
+ isError: false
1210
+ };
1211
+ }
1212
+ if (sub === "clear") {
1213
+ return {
1214
+ profile: {},
1215
+ summary: "Profile cleared. The AI will no longer know who you are.",
1216
+ rows: [],
1217
+ details: [],
1218
+ changed: true,
1219
+ isError: false
1220
+ };
1221
+ }
1222
+ if (sub === "set") {
1223
+ const field = args[1];
1224
+ const value = args.slice(2).join(" ").trim();
1225
+ if (!field || !PROFILE_FIELDS.includes(field)) {
1226
+ return {
1227
+ summary: "Usage: /profile set <field> <value>",
1228
+ rows: [],
1229
+ details: [`Fields: ${PROFILE_FIELDS.join(", ")}`],
1230
+ changed: false,
1231
+ isError: true
1232
+ };
1233
+ }
1234
+ if (!value) {
1235
+ return {
1236
+ summary: `Usage: /profile set ${field} <value>`,
1237
+ rows: [],
1238
+ details: [],
1239
+ changed: false,
1240
+ isError: true
1241
+ };
1242
+ }
1243
+ const updated = { ...profile };
1244
+ if (field === "interests") {
1245
+ updated.interests = value.split(",").map((s) => stripSurroundingQuotes(s.trim())).filter(Boolean);
1246
+ } else {
1247
+ updated[field] = stripSurroundingQuotes(value);
1248
+ }
1249
+ const shown = field === "interests" ? (updated.interests ?? []).join(", ") : stripSurroundingQuotes(value);
1250
+ return {
1251
+ profile: updated,
1252
+ summary: `Profile updated: ${field} = ${shown}`,
1253
+ rows: [],
1254
+ details: [],
1255
+ changed: true,
1256
+ isError: false
1257
+ };
1258
+ }
1259
+ if (sub === "edit") {
1260
+ return {
1261
+ summary: "Interactive editing lives in the setup wizard.",
1262
+ rows: [],
1263
+ details: [
1264
+ "Run `aicli config` in a terminal, or use /profile set <field> <value> here.",
1265
+ `Fields: ${PROFILE_FIELDS.join(", ")}`
1266
+ ],
1267
+ changed: false,
1268
+ isError: false
1269
+ };
1270
+ }
1271
+ return {
1272
+ summary: `Unknown /profile option "${args[0]}" \u2014 expected show | set | clear | edit`,
1273
+ rows: [],
1274
+ details: [],
1275
+ changed: false,
1276
+ isError: true
1277
+ };
1278
+ }
1279
+
1133
1280
  // src/core/git-diff.ts
1134
1281
  import { execFileSync } from "child_process";
1135
1282
  function readGitDiff(options = {}) {
@@ -1178,6 +1325,7 @@ function costSourceNote(source) {
1178
1325
 
1179
1326
  export {
1180
1327
  applyThinkCommand,
1328
+ applyProfileCommand,
1181
1329
  readGitDiff,
1182
1330
  scanDirTree,
1183
1331
  scanProject,
@@ -1187,6 +1335,9 @@ export {
1187
1335
  parseSimpleYaml,
1188
1336
  persistToolRound,
1189
1337
  autoTrimSessionIfNeeded,
1338
+ estimateConversationTokens,
1339
+ evaluateContextPressure,
1340
+ AUTO_COMPACT_INSTRUCTION,
1190
1341
  SNAPSHOT_PROMPT,
1191
1342
  sessionHasMeaningfulContent,
1192
1343
  saveDevState,
@@ -6,7 +6,7 @@ import {
6
6
  MEMORY_FILE_NAME,
7
7
  MEMORY_MAX_CHARS,
8
8
  MEMORY_STORE_FILE_NAME
9
- } from "./chunk-THHPKZJ3.js";
9
+ } from "./chunk-UT2WAJJG.js";
10
10
  import {
11
11
  DEFAULT_PATTERNS,
12
12
  redactString
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  TEST_TIMEOUT
4
- } from "./chunk-THHPKZJ3.js";
4
+ } from "./chunk-UT2WAJJG.js";
5
5
 
6
6
  // src/tools/builtin/run-tests.ts
7
7
  import { execSync, spawnSync } from "child_process";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TEST_TIMEOUT
3
- } from "./chunk-7HECI3U5.js";
3
+ } from "./chunk-EPVJS4F6.js";
4
4
 
5
5
  // src/tools/builtin/run-tests.ts
6
6
  import { execSync, spawnSync } from "child_process";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-AUEX6RNY.js";
5
5
  import {
6
6
  ConfigManager
7
- } from "./chunk-EWRZMIQE.js";
7
+ } from "./chunk-VGVKJTHF.js";
8
8
  import {
9
9
  getActivePluginAssets,
10
10
  getPendingHookTrust,
@@ -14,7 +14,7 @@ import {
14
14
  listHooks,
15
15
  listInstalledPlugins,
16
16
  resetStats
17
- } from "./chunk-WPN7LDLM.js";
17
+ } from "./chunk-2FQGMR34.js";
18
18
  import {
19
19
  getGitRoot
20
20
  } from "./chunk-HOSJZMQS.js";
@@ -26,7 +26,7 @@ import {
26
26
  MCP_PROJECT_CONFIG_NAME,
27
27
  MEMORY_FILE_NAME,
28
28
  VERSION
29
- } from "./chunk-THHPKZJ3.js";
29
+ } from "./chunk-UT2WAJJG.js";
30
30
 
31
31
  // src/diagnostics/doctor-report.ts
32
32
  import { existsSync as existsSync3, statSync as statSync2 } from "fs";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  evaluateCiGate,
4
4
  normalizeCiThresholds
5
- } from "./chunk-6C6FLDGH.js";
5
+ } from "./chunk-7US7K3CD.js";
6
6
  import {
7
7
  buildReviewPrompt,
8
8
  buildSecurityReviewPrompt,
@@ -16,10 +16,10 @@ import {
16
16
  } from "./chunk-AUEX6RNY.js";
17
17
  import {
18
18
  ConfigManager
19
- } from "./chunk-EWRZMIQE.js";
19
+ } from "./chunk-VGVKJTHF.js";
20
20
  import {
21
21
  VERSION
22
- } from "./chunk-THHPKZJ3.js";
22
+ } from "./chunk-UT2WAJJG.js";
23
23
 
24
24
  // src/cli/ci.ts
25
25
  import { execFileSync } from "child_process";
@@ -3,15 +3,15 @@ import {
3
3
  CI_COMMENT_MARKER,
4
4
  countSeverity,
5
5
  runCi
6
- } from "./chunk-5CU72V6P.js";
7
- import "./chunk-6C6FLDGH.js";
6
+ } from "./chunk-Z7CZ72RP.js";
7
+ import "./chunk-7US7K3CD.js";
8
8
  import "./chunk-HLWUDRBO.js";
9
9
  import "./chunk-6YZEZFX5.js";
10
10
  import "./chunk-AUEX6RNY.js";
11
- import "./chunk-EWRZMIQE.js";
11
+ import "./chunk-VGVKJTHF.js";
12
12
  import "./chunk-3OBY7WSS.js";
13
13
  import "./chunk-TU3L3PW7.js";
14
- import "./chunk-THHPKZJ3.js";
14
+ import "./chunk-UT2WAJJG.js";
15
15
  import "./chunk-IW3Q7AE5.js";
16
16
  export {
17
17
  CI_COMMENT_MARKER,
@@ -6,8 +6,8 @@ import {
6
6
  formatCiResult,
7
7
  formatCiSarif,
8
8
  normalizeCiThresholds
9
- } from "./chunk-6C6FLDGH.js";
10
- import "./chunk-THHPKZJ3.js";
9
+ } from "./chunk-7US7K3CD.js";
10
+ import "./chunk-UT2WAJJG.js";
11
11
  export {
12
12
  DEFAULT_CI_THRESHOLDS,
13
13
  detectCiGateSignals,
@@ -38,7 +38,7 @@ import {
38
38
  TEST_TIMEOUT,
39
39
  VERSION,
40
40
  buildUserIdentityPrompt
41
- } from "./chunk-THHPKZJ3.js";
41
+ } from "./chunk-UT2WAJJG.js";
42
42
  export {
43
43
  AGENTIC_BEHAVIOR_GUIDELINE,
44
44
  APP_NAME,
@@ -2,14 +2,14 @@
2
2
  import {
3
3
  formatDoctorReport,
4
4
  runDoctorCli
5
- } from "./chunk-QN7WD2SM.js";
5
+ } from "./chunk-YLSM7RF6.js";
6
6
  import "./chunk-AUEX6RNY.js";
7
- import "./chunk-EWRZMIQE.js";
8
- import "./chunk-WPN7LDLM.js";
7
+ import "./chunk-VGVKJTHF.js";
8
+ import "./chunk-2FQGMR34.js";
9
9
  import "./chunk-3OBY7WSS.js";
10
10
  import "./chunk-TU3L3PW7.js";
11
11
  import "./chunk-HOSJZMQS.js";
12
- import "./chunk-THHPKZJ3.js";
12
+ import "./chunk-UT2WAJJG.js";
13
13
  import "./chunk-IW3Q7AE5.js";
14
14
  export {
15
15
  formatDoctorReport,