jinzd-ai-cli 0.2.16 → 0.2.18

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.
@@ -1161,6 +1161,7 @@ var OpenAICompatibleProvider = class extends BaseProvider {
1161
1161
  timeout: request.timeout ?? this.defaultTimeout,
1162
1162
  signal: request.signal
1163
1163
  });
1164
+ let thinkingStarted = false;
1164
1165
  for await (const chunk of stream) {
1165
1166
  const choice = chunk.choices[0];
1166
1167
  const done = choice?.finish_reason != null && choice.finish_reason !== "";
@@ -1175,7 +1176,20 @@ var OpenAICompatibleProvider = class extends BaseProvider {
1175
1176
  };
1176
1177
  continue;
1177
1178
  }
1179
+ const reasoningDelta = choice?.delta?.reasoning_content;
1180
+ if (reasoningDelta) {
1181
+ if (!thinkingStarted) {
1182
+ yield { delta: "<think>", done: false };
1183
+ thinkingStarted = true;
1184
+ }
1185
+ yield { delta: reasoningDelta, done: false };
1186
+ continue;
1187
+ }
1178
1188
  const delta = choice?.delta?.content ?? "";
1189
+ if (thinkingStarted && delta) {
1190
+ thinkingStarted = false;
1191
+ yield { delta: "</think>", done: false };
1192
+ }
1179
1193
  yield { delta, done };
1180
1194
  }
1181
1195
  } catch (err) {
@@ -1326,9 +1340,14 @@ var OpenAICompatibleProvider = class extends BaseProvider {
1326
1340
  });
1327
1341
  const toolCallAccumulators = /* @__PURE__ */ new Map();
1328
1342
  let toolCallsEnded = false;
1343
+ let thinkingStarted = false;
1329
1344
  for await (const chunk of stream) {
1330
1345
  const choice = chunk.choices[0];
1331
1346
  if (!choice && chunk.usage) {
1347
+ if (thinkingStarted) {
1348
+ yield { type: "thinking_end" };
1349
+ thinkingStarted = false;
1350
+ }
1332
1351
  if (!toolCallsEnded && toolCallAccumulators.size > 0) {
1333
1352
  for (const [idx] of toolCallAccumulators) {
1334
1353
  yield { type: "tool_call_end", index: idx };
@@ -1346,6 +1365,19 @@ var OpenAICompatibleProvider = class extends BaseProvider {
1346
1365
  }
1347
1366
  if (!choice) continue;
1348
1367
  const delta = choice.delta;
1368
+ const reasoningDelta = delta?.reasoning_content;
1369
+ if (reasoningDelta) {
1370
+ if (!thinkingStarted) {
1371
+ yield { type: "thinking_start" };
1372
+ thinkingStarted = true;
1373
+ }
1374
+ yield { type: "thinking_delta", delta: reasoningDelta };
1375
+ continue;
1376
+ }
1377
+ if (thinkingStarted && (delta?.content || delta?.tool_calls)) {
1378
+ yield { type: "thinking_end" };
1379
+ thinkingStarted = false;
1380
+ }
1349
1381
  if (delta?.content) {
1350
1382
  yield { type: "text_delta", delta: delta.content };
1351
1383
  }
@@ -1461,15 +1493,17 @@ var DeepSeekProvider = class extends OpenAICompatibleProvider {
1461
1493
  models: [
1462
1494
  {
1463
1495
  id: "deepseek-chat",
1464
- displayName: "DeepSeek Chat (V3)",
1496
+ displayName: "DeepSeek Chat (V3.2)",
1465
1497
  contextWindow: 131072,
1466
- supportsStreaming: true
1498
+ supportsStreaming: true,
1499
+ supportsThinking: true
1467
1500
  },
1468
1501
  {
1469
1502
  id: "deepseek-reasoner",
1470
1503
  displayName: "DeepSeek Reasoner (R1)",
1471
1504
  contextWindow: 65536,
1472
- supportsStreaming: true
1505
+ supportsStreaming: true,
1506
+ supportsThinking: true
1473
1507
  }
1474
1508
  ]
1475
1509
  };
package/dist/index.js CHANGED
@@ -35,7 +35,7 @@ import {
35
35
  theme,
36
36
  truncateOutput,
37
37
  undoStack
38
- } from "./chunk-7AOBBUIU.js";
38
+ } from "./chunk-LXBTSYBY.js";
39
39
  import {
40
40
  AGENTIC_BEHAVIOR_GUIDELINE,
41
41
  AUTHOR,
@@ -4521,14 +4521,18 @@ Session '${this.resumeSessionId}' not found.
4521
4521
  return ac;
4522
4522
  }
4523
4523
  /**
4524
- * 流式生成结束后调用(finally 块中):清理 ESC 监听器,还原 stdin 暂停状态。
4524
+ * 流式生成结束后调用(finally 块中):清理 ESC 监听器。
4525
+ * 若 interjection listener 仍活跃(agentic 循环中),保持 stdin 流动以接收用户输入;
4526
+ * 否则还原为 rl.pause() 时的暂停状态。
4525
4527
  */
4526
4528
  teardownStreamInterrupt() {
4527
4529
  if (this._escHandler) {
4528
4530
  process.stdin.removeListener("data", this._escHandler);
4529
4531
  this._escHandler = null;
4530
4532
  }
4531
- process.stdin.pause();
4533
+ if (!this._interjectionHandler) {
4534
+ process.stdin.pause();
4535
+ }
4532
4536
  this.streamAbortController = null;
4533
4537
  }
4534
4538
  /**
@@ -5059,9 +5063,6 @@ You have a maximum of ${MAX_TOOL_ROUNDS} tool call rounds for this task. Plan ef
5059
5063
  spawnAgentContext.systemPrompt = systemPrompt;
5060
5064
  spawnAgentContext.modelParams = modelParams;
5061
5065
  spawnAgentContext.configManager = this.config;
5062
- if (this._interjectionHandler) {
5063
- process.stdin.removeListener("data", this._interjectionHandler);
5064
- }
5065
5066
  const toolResults = await this.toolExecutor.executeAll(result.toolCalls);
5066
5067
  const thisRoundTools = result.toolCalls.map((tc) => tc.name);
5067
5068
  roundToolHistory.push({ round: round + 1, tools: thisRoundTools });
@@ -5090,7 +5091,6 @@ You have a maximum of ${MAX_TOOL_ROUNDS} tool call rounds for this task. Plan ef
5090
5091
  }
5091
5092
  }
5092
5093
  if (this._interjectionHandler) {
5093
- process.stdin.on("data", this._interjectionHandler);
5094
5094
  process.stdin.resume();
5095
5095
  }
5096
5096
  const reasoningContent = "reasoningContent" in result ? result.reasoningContent : void 0;
@@ -5507,7 +5507,7 @@ program.command("web").description("Start Web UI server with browser-based chat
5507
5507
  console.error("Error: Invalid port number. Must be between 1 and 65535.");
5508
5508
  process.exit(1);
5509
5509
  }
5510
- const { startWebServer } = await import("./server-DX32VWI3.js");
5510
+ const { startWebServer } = await import("./server-YQKOLA5A.js");
5511
5511
  await startWebServer({ port, host: options.host });
5512
5512
  });
5513
5513
  program.command("user [action] [username]").description("Manage Web UI users (list | create <name> | delete <name> | reset-password <name> | migrate <name>)").action(async (action, username) => {
@@ -23,7 +23,7 @@ import {
23
23
  setupProxy,
24
24
  spawnAgentContext,
25
25
  truncateOutput
26
- } from "./chunk-7AOBBUIU.js";
26
+ } from "./chunk-LXBTSYBY.js";
27
27
  import {
28
28
  AGENTIC_BEHAVIOR_GUIDELINE,
29
29
  CONTEXT_FILE_CANDIDATES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jinzd-ai-cli",
3
- "version": "0.2.16",
3
+ "version": "0.2.18",
4
4
  "description": "Cross-platform REPL-style AI CLI with multi-provider support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",