jinzd-ai-cli 0.1.58 → 0.1.59

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.
@@ -8,7 +8,7 @@ import { platform } from "os";
8
8
  import chalk from "chalk";
9
9
 
10
10
  // src/core/constants.ts
11
- var VERSION = "0.1.58";
11
+ var VERSION = "0.1.59";
12
12
  var APP_NAME = "ai-cli";
13
13
  var CONFIG_DIR_NAME = ".aicli";
14
14
  var CONFIG_FILE_NAME = "config.json";
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ import {
30
30
  SUBAGENT_MAX_ROUNDS_LIMIT,
31
31
  VERSION,
32
32
  runTestsTool
33
- } from "./chunk-MZ67HRUQ.js";
33
+ } from "./chunk-7RQ6QCDG.js";
34
34
 
35
35
  // src/index.ts
36
36
  import { program } from "commander";
@@ -2112,6 +2112,15 @@ var Session = class _Session {
2112
2112
  this.created = /* @__PURE__ */ new Date();
2113
2113
  this.updated = /* @__PURE__ */ new Date();
2114
2114
  }
2115
+ /**
2116
+ * 更新 session 关联的 provider 和 model(在 /provider 或 /model 切换时调用)。
2117
+ * 保留对话历史和所有状态,仅更新元数据。
2118
+ */
2119
+ updateProvider(provider, model) {
2120
+ this.provider = provider;
2121
+ this.model = model;
2122
+ this.updated = /* @__PURE__ */ new Date();
2123
+ }
2115
2124
  addMessage(message) {
2116
2125
  this.messages.push(message);
2117
2126
  this.updated = /* @__PURE__ */ new Date();
@@ -3705,9 +3714,16 @@ function createDefaultCommands() {
3705
3714
  return;
3706
3715
  }
3707
3716
  await ctx.generateDevStateSnapshot();
3717
+ const session = ctx.sessions.current;
3718
+ const msgCount = session?.messages.length ?? 0;
3708
3719
  ctx.setProvider(targetId);
3709
- ctx.sessions.createSession(targetId, ctx.getCurrentModel());
3710
- ctx.renderer.printSuccess(`Switched to provider: ${targetId}`);
3720
+ if (session) {
3721
+ session.updateProvider(targetId, ctx.getCurrentModel());
3722
+ await ctx.sessions.save();
3723
+ }
3724
+ ctx.renderer.printSuccess(
3725
+ `Switched to provider: ${targetId}` + (msgCount > 0 ? ` (conversation preserved: ${msgCount} messages)` : "")
3726
+ );
3711
3727
  }
3712
3728
  },
3713
3729
  {
@@ -3741,9 +3757,16 @@ function createDefaultCommands() {
3741
3757
  return;
3742
3758
  }
3743
3759
  await ctx.generateDevStateSnapshot();
3760
+ const session = ctx.sessions.current;
3761
+ const msgCount = session?.messages.length ?? 0;
3744
3762
  ctx.setProvider(ctx.getCurrentProvider(), targetModel);
3745
- ctx.sessions.createSession(ctx.getCurrentProvider(), targetModel);
3746
- ctx.renderer.printSuccess(`Switched to model: ${targetModel}`);
3763
+ if (session) {
3764
+ session.updateProvider(ctx.getCurrentProvider(), targetModel);
3765
+ await ctx.sessions.save();
3766
+ }
3767
+ ctx.renderer.printSuccess(
3768
+ `Switched to model: ${targetModel}` + (msgCount > 0 ? ` (conversation preserved: ${msgCount} messages)` : "")
3769
+ );
3747
3770
  }
3748
3771
  },
3749
3772
  {
@@ -4683,7 +4706,7 @@ ${hint}` : "")
4683
4706
  description: "Run project tests and show structured report",
4684
4707
  usage: "/test [command|filter]",
4685
4708
  async execute(args, _ctx) {
4686
- const { executeTests } = await import("./run-tests-VXOSOCFF.js");
4709
+ const { executeTests } = await import("./run-tests-CUBYICNN.js");
4687
4710
  const argStr = args.join(" ").trim();
4688
4711
  let testArgs = {};
4689
4712
  if (argStr) {
@@ -8264,9 +8287,11 @@ var CustomCommandManager = class {
8264
8287
  import { existsSync as existsSync17, readFileSync as readFileSync11, writeFileSync as writeFileSync8, unlinkSync as unlinkSync3, mkdirSync as mkdirSync10 } from "fs";
8265
8288
  import { join as join12 } from "path";
8266
8289
  import { homedir as homedir4 } from "os";
8267
- var DEV_STATE_MAX_CHARS = 4e3;
8290
+ var DEV_STATE_MAX_CHARS = 6e3;
8268
8291
  var SNAPSHOT_PROMPT = `You are about to be replaced by a different AI model. Please generate a structured development state snapshot so the next model can continue seamlessly.
8269
8292
 
8293
+ CRITICAL: Be SPECIFIC and DETAILED. Include exact values, file paths, format requirements, and constraints \u2014 vague summaries are useless to the next model.
8294
+
8270
8295
  Output ONLY the snapshot in the following exact format (no preamble, no explanation):
8271
8296
 
8272
8297
  ## Development State Snapshot
@@ -8274,26 +8299,39 @@ Output ONLY the snapshot in the following exact format (no preamble, no explanat
8274
8299
  ### Current Task
8275
8300
  [1-2 sentence summary of the primary task/goal the user is working on]
8276
8301
 
8302
+ ### Key Parameters & Constraints
8303
+ - [List ALL specific parameters, values, format requirements discovered during this conversation]
8304
+ - [Include exact numbers, dimensions, scoring rules, naming conventions, etc.]
8305
+ - [Example: "\u8003\u8BD5\u65F6\u95F4 90 \u5206\u949F\uFF0C\u6EE1\u5206 200 \u5206\uFF0C\u5355\u9009 40 \u9898\xD72 \u5206 + \u591A\u9009 20 \u9898\xD74 \u5206 + \u5224\u65AD 20 \u9898\xD72 \u5206"]
8306
+ - [Example: "\u6587\u4EF6\u547D\u540D\u683C\u5F0F YYYYMMDD-NN-\u6A21\u8003-\u96BE\u5EA6.md\uFF0C\u4FDD\u5B58\u5230 exam_papers/ \u76EE\u5F55"]
8307
+
8277
8308
  ### Completed Steps
8278
- - [List each completed step as a bullet point]
8309
+ - [List each completed step with specific details (file paths, key outcomes)]
8279
8310
 
8280
8311
  ### In-Progress Work
8281
8312
  - [List any work that was started but not finished]
8282
8313
 
8283
- ### Key Decisions & Context
8284
- - [Important architectural or design decisions made during this conversation]
8285
- - [Any user preferences or constraints that were established]
8314
+ ### Critical Reference Files
8315
+ - [List file paths that the next model MUST read before doing any work]
8316
+ - [Include brief description of each file's purpose]
8317
+ - [Example: "Exam2025.md \u2014 \u91D1\u6807\u771F\u9898\u683C\u5F0F\u53C2\u8003\uFF0890\u5206\u949F/200\u5206/\u9898\u578B\u5206\u5E03\uFF09"]
8318
+ - [Example: "\u51FA\u9898\u98CE\u683C\u6307\u5357.md \u2014 \u91D1\u6807\u98CE\u683C\u89C4\u8303\uFF08\u4EBA\u7269\u8BBE\u5B9A/\u573A\u666F\u6784\u5EFA/\u65F6\u4E8B\u70ED\u70B9\uFF09"]
8286
8319
 
8287
- ### Modified Files
8288
- - [List any files that were created, modified, or discussed, with brief notes]
8320
+ ### Modified/Created Files
8321
+ - [List any files that were created or modified, with brief notes on content]
8322
+
8323
+ ### Key Decisions & Context
8324
+ - [Important decisions, user preferences, or constraints established]
8289
8325
 
8290
8326
  ### Next Steps
8291
8327
  - [What should be done next to continue this work]
8328
+ - [Include specific instructions the next model should follow]
8292
8329
 
8293
8330
  ### Important Notes
8294
8331
  - [Any warnings, caveats, or critical context the next model needs to know]
8332
+ - [Things that went wrong or should be avoided]
8295
8333
 
8296
- If any section has no content, write "(none)" for that section. Be concise but thorough.`;
8334
+ If any section has no content, write "(none)" for that section. Be thorough \u2014 the next model may have access to our conversation messages, but the detailed tool call results (file contents, command outputs) are NOT preserved. This snapshot is the primary source of specific details and context.`;
8297
8335
  function sessionHasMeaningfulContent(messages) {
8298
8336
  if (messages.length < 2) return false;
8299
8337
  const hasUser = messages.some((m) => m.role === "user");
@@ -9484,6 +9522,7 @@ ${memory.content}`);
9484
9522
  `# Development State Handoff
9485
9523
 
9486
9524
  \u4EE5\u4E0B\u662F\u524D\u4E00\u4E2A AI \u6A21\u578B\u751F\u6210\u7684\u5F00\u53D1\u72B6\u6001\u5FEB\u7167\uFF0C\u8BF7\u636E\u6B64\u65E0\u7F1D\u7EE7\u7EED\u7528\u6237\u7684\u5DE5\u4F5C\u3002
9525
+ \u91CD\u8981\uFF1A\u5982\u679C\u5FEB\u7167\u4E2D\u63D0\u5230\u4E86\u5173\u952E\u53C2\u8003\u6587\u4EF6\uFF08\u5982\u6A21\u677F\u3001\u683C\u5F0F\u89C4\u8303\u3001\u98CE\u683C\u6307\u5357\uFF09\uFF0C\u5728\u6267\u884C\u4EFB\u4F55\u751F\u6210/\u521B\u5EFA\u64CD\u4F5C\u4E4B\u524D\uFF0C\u8BF7\u5148\u7528 read_file \u5DE5\u5177\u8BFB\u53D6\u8FD9\u4E9B\u53C2\u8003\u6587\u4EF6\uFF0C\u786E\u4FDD\u4F60\u5B8C\u5168\u7406\u89E3\u683C\u5F0F\u8981\u6C42\u548C\u7EA6\u675F\u6761\u4EF6\u3002\u4E0D\u8981\u51ED\u5047\u8BBE\u884C\u4E8B\uFF0C\u5FC5\u987B\u57FA\u4E8E\u5B9E\u9645\u6587\u4EF6\u5185\u5BB9\u3002
9487
9526
 
9488
9527
  ` + devState
9489
9528
  );
@@ -9623,7 +9662,7 @@ ${response.content.trim()}
9623
9662
  systemPrompt: this.buildCurrentSystemPrompt(),
9624
9663
  stream: false,
9625
9664
  temperature: 0.3,
9626
- maxTokens: modelParams.maxTokens ?? 2048,
9665
+ maxTokens: Math.min(modelParams.maxTokens ?? 4096, 4096),
9627
9666
  timeout: modelParams.timeout ?? 3e4
9628
9667
  });
9629
9668
  spinner.stop();
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  executeTests,
4
4
  runTestsTool
5
- } from "./chunk-MZ67HRUQ.js";
5
+ } from "./chunk-7RQ6QCDG.js";
6
6
  export {
7
7
  executeTests,
8
8
  runTestsTool
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jinzd-ai-cli",
3
- "version": "0.1.58",
3
+ "version": "0.1.59",
4
4
  "description": "Cross-platform REPL-style AI CLI with multi-provider support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",