jinzd-ai-cli 0.2.7 → 0.2.9
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/{chunk-AAMGMH6Z.js → chunk-J6SXTNJO.js} +1 -1
- package/dist/{chunk-DFWAW3MP.js → chunk-UR5QRBEG.js} +1 -1
- package/dist/index.js +58 -5
- package/dist/{run-tests-PNIALQ4P.js → run-tests-ITCKU6DW.js} +1 -1
- package/dist/{server-IJRVKF6R.js → server-ZMMVUF7Q.js} +19 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
theme,
|
|
36
36
|
truncateOutput,
|
|
37
37
|
undoStack
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-UR5QRBEG.js";
|
|
39
39
|
import {
|
|
40
40
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
41
41
|
AUTHOR,
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
REPO_URL,
|
|
56
56
|
SKILLS_DIR_NAME,
|
|
57
57
|
VERSION
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-J6SXTNJO.js";
|
|
59
59
|
|
|
60
60
|
// src/index.ts
|
|
61
61
|
import { program } from "commander";
|
|
@@ -1904,7 +1904,7 @@ ${hint}` : "")
|
|
|
1904
1904
|
description: "Run project tests and show structured report",
|
|
1905
1905
|
usage: "/test [command|filter]",
|
|
1906
1906
|
async execute(args, _ctx) {
|
|
1907
|
-
const { executeTests } = await import("./run-tests-
|
|
1907
|
+
const { executeTests } = await import("./run-tests-ITCKU6DW.js");
|
|
1908
1908
|
const argStr = args.join(" ").trim();
|
|
1909
1909
|
let testArgs = {};
|
|
1910
1910
|
if (argStr) {
|
|
@@ -3312,6 +3312,7 @@ ${content}
|
|
|
3312
3312
|
var MAX_TOOL_ROUNDS = 25;
|
|
3313
3313
|
var FREE_ROUND_TOOLS = /* @__PURE__ */ new Set(["write_todos"]);
|
|
3314
3314
|
var MAX_CONSECUTIVE_FREE_ROUNDS = 5;
|
|
3315
|
+
var AUTO_PAUSE_INTERVAL = 10;
|
|
3315
3316
|
function fmtTokens(n) {
|
|
3316
3317
|
if (n >= 1e6) return `${Math.round(n / 1e5) / 10}M`;
|
|
3317
3318
|
if (n >= 1e3) return `${Math.round(n / 1024)}K`;
|
|
@@ -4801,7 +4802,16 @@ Session '${this.resumeSessionId}' not found.
|
|
|
4801
4802
|
}
|
|
4802
4803
|
const apiMessages = [...messages];
|
|
4803
4804
|
const extraMessages = [];
|
|
4804
|
-
const
|
|
4805
|
+
const baseSystemPrompt = (this.buildCurrentSystemPrompt() ?? "") + TOOL_CALL_REMINDER;
|
|
4806
|
+
const roundBudgetHint = `
|
|
4807
|
+
|
|
4808
|
+
[Tool Round Budget]
|
|
4809
|
+
You have a maximum of ${MAX_TOOL_ROUNDS} tool call rounds for this task. Plan efficiently:
|
|
4810
|
+
- Prefer batch operations (e.g. global find-and-replace) over repetitive single edits.
|
|
4811
|
+
- Prioritize the most critical tasks first in case rounds run out.
|
|
4812
|
+
- When remaining rounds are low (\u22645), focus on completing the current task and summarizing.
|
|
4813
|
+
- Every ${AUTO_PAUSE_INTERVAL} rounds the user will be asked whether to continue \u2014 use this as a natural checkpoint to report progress.`;
|
|
4814
|
+
const systemPrompt = baseSystemPrompt + roundBudgetHint;
|
|
4805
4815
|
const modelParams = this.getModelParams();
|
|
4806
4816
|
const useStreaming = this.config.get("ui").streaming;
|
|
4807
4817
|
const spinner = this.renderer.showSpinner("Thinking...");
|
|
@@ -4827,6 +4837,15 @@ Session '${this.resumeSessionId}' not found.
|
|
|
4827
4837
|
`));
|
|
4828
4838
|
extraMessages.push({ role: "user", content: cmd });
|
|
4829
4839
|
}
|
|
4840
|
+
const roundsLeft = MAX_TOOL_ROUNDS - round;
|
|
4841
|
+
if (roundsLeft === 5) {
|
|
4842
|
+
extraMessages.push({
|
|
4843
|
+
role: "user",
|
|
4844
|
+
content: `\u26A0\uFE0F Budget warning: Only ${roundsLeft} tool rounds remaining. Prioritize completing the most critical task. If you cannot finish everything, summarize what's done and what remains.`
|
|
4845
|
+
});
|
|
4846
|
+
process.stdout.write(theme.warning(` \u26A0\uFE0F Low budget: ${roundsLeft} rounds remaining
|
|
4847
|
+
`));
|
|
4848
|
+
}
|
|
4830
4849
|
if (this._userInterjection) {
|
|
4831
4850
|
const msg = this._userInterjection;
|
|
4832
4851
|
this._userInterjection = null;
|
|
@@ -5031,6 +5050,40 @@ Session '${this.resumeSessionId}' not found.
|
|
|
5031
5050
|
`));
|
|
5032
5051
|
extraMessages.push({ role: "user", content: msg });
|
|
5033
5052
|
}
|
|
5053
|
+
const effectiveRound = round + 1;
|
|
5054
|
+
const remaining = MAX_TOOL_ROUNDS - effectiveRound;
|
|
5055
|
+
if (AUTO_PAUSE_INTERVAL > 0 && effectiveRound > 0 && effectiveRound % AUTO_PAUSE_INTERVAL === 0 && remaining > 0) {
|
|
5056
|
+
spinner.stop();
|
|
5057
|
+
process.stdout.write("\n");
|
|
5058
|
+
process.stdout.write(theme.warning(`\u23F8 Auto-pause: ${effectiveRound}/${MAX_TOOL_ROUNDS} rounds used, ${remaining} remaining
|
|
5059
|
+
`));
|
|
5060
|
+
process.stdout.write(theme.dim(" Press ") + theme.info("y") + theme.dim(" to continue, or ") + theme.info("type a message") + theme.dim(" to redirect AI:\n"));
|
|
5061
|
+
process.stdout.write(theme.dim(" (Press ") + theme.info("n") + theme.dim(" or ") + theme.info("Esc") + theme.dim(" to stop)\n"));
|
|
5062
|
+
this.teardownInterjectionListener();
|
|
5063
|
+
const pauseResponse = await new Promise((resolve3) => {
|
|
5064
|
+
const savedOutput = this.rl.output;
|
|
5065
|
+
this.rl.output = process.stdout;
|
|
5066
|
+
this.rl.question(theme.warning(" \u25B8 "), (answer) => {
|
|
5067
|
+
this.rl.output = savedOutput;
|
|
5068
|
+
resolve3(answer.trim());
|
|
5069
|
+
});
|
|
5070
|
+
});
|
|
5071
|
+
this.setupInterjectionListener();
|
|
5072
|
+
if (pauseResponse === "n" || pauseResponse === "N" || pauseResponse === "\x1B") {
|
|
5073
|
+
process.stdout.write(theme.warning("\u26A1 Stopped by user at auto-pause checkpoint\n"));
|
|
5074
|
+
extraMessages.push({
|
|
5075
|
+
role: "user",
|
|
5076
|
+
content: `The user has stopped the task at round ${effectiveRound}/${MAX_TOOL_ROUNDS}. Do not call any more tools. Summarize what has been completed and what remains.`
|
|
5077
|
+
});
|
|
5078
|
+
break;
|
|
5079
|
+
} else if (pauseResponse && pauseResponse !== "y" && pauseResponse !== "Y" && pauseResponse !== "") {
|
|
5080
|
+
process.stdout.write(theme.warning(`\u26A1 Redirect: "${pauseResponse}"
|
|
5081
|
+
`));
|
|
5082
|
+
extraMessages.push({ role: "user", content: pauseResponse });
|
|
5083
|
+
}
|
|
5084
|
+
process.stdout.write(theme.success(`\u25B6 Continuing... (${remaining} rounds left)
|
|
5085
|
+
`));
|
|
5086
|
+
}
|
|
5034
5087
|
const nextRound = round + 2;
|
|
5035
5088
|
spinner.start(
|
|
5036
5089
|
nextRound <= MAX_TOOL_ROUNDS ? `Thinking... (round ${nextRound}/${MAX_TOOL_ROUNDS})` : "Thinking..."
|
|
@@ -5358,7 +5411,7 @@ program.command("web").description("Start Web UI server with browser-based chat
|
|
|
5358
5411
|
console.error("Error: Invalid port number. Must be between 1 and 65535.");
|
|
5359
5412
|
process.exit(1);
|
|
5360
5413
|
}
|
|
5361
|
-
const { startWebServer } = await import("./server-
|
|
5414
|
+
const { startWebServer } = await import("./server-ZMMVUF7Q.js");
|
|
5362
5415
|
await startWebServer({ port, host: options.host });
|
|
5363
5416
|
});
|
|
5364
5417
|
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-
|
|
26
|
+
} from "./chunk-UR5QRBEG.js";
|
|
27
27
|
import {
|
|
28
28
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
29
29
|
CONTEXT_FILE_CANDIDATES,
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
PLAN_MODE_SYSTEM_ADDON,
|
|
36
36
|
SKILLS_DIR_NAME,
|
|
37
37
|
VERSION
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-J6SXTNJO.js";
|
|
39
39
|
import {
|
|
40
40
|
AuthManager
|
|
41
41
|
} from "./chunk-CPLT6CD3.js";
|
|
@@ -641,7 +641,15 @@ var SessionHandler = class {
|
|
|
641
641
|
const session = this.sessions.current;
|
|
642
642
|
const apiMessages = [...messages];
|
|
643
643
|
const extraMessages = [];
|
|
644
|
-
const
|
|
644
|
+
const baseSystemPrompt = (this.buildSystemPrompt() ?? "") + TOOL_CALL_REMINDER;
|
|
645
|
+
const roundBudgetHint = `
|
|
646
|
+
|
|
647
|
+
[Tool Round Budget]
|
|
648
|
+
You have a maximum of ${MAX_TOOL_ROUNDS} tool call rounds for this task. Plan efficiently:
|
|
649
|
+
- Prefer batch operations (e.g. global find-and-replace) over repetitive single edits.
|
|
650
|
+
- Prioritize the most critical tasks first in case rounds run out.
|
|
651
|
+
- When remaining rounds are low (\u22645), focus on completing the current task and summarizing.`;
|
|
652
|
+
const systemPrompt = baseSystemPrompt + roundBudgetHint;
|
|
645
653
|
const modelParams = this.getModelParams();
|
|
646
654
|
const roundUsage = { inputTokens: 0, outputTokens: 0 };
|
|
647
655
|
const supportsStreamingTools = typeof provider.chatWithToolsStream === "function";
|
|
@@ -653,6 +661,14 @@ var SessionHandler = class {
|
|
|
653
661
|
if (ac.signal.aborted) break;
|
|
654
662
|
this.toolExecutor.setRoundInfo(round + 1, MAX_TOOL_ROUNDS);
|
|
655
663
|
this.send({ type: "round_progress", current: round + 1, total: MAX_TOOL_ROUNDS });
|
|
664
|
+
const roundsLeft = MAX_TOOL_ROUNDS - round;
|
|
665
|
+
if (roundsLeft === 5) {
|
|
666
|
+
extraMessages.push({
|
|
667
|
+
role: "user",
|
|
668
|
+
content: `\u26A0\uFE0F Budget warning: Only ${roundsLeft} tool rounds remaining. Prioritize completing the most critical task. If you cannot finish everything, summarize what's done and what remains.`
|
|
669
|
+
});
|
|
670
|
+
this.send({ type: "info", message: `\u26A0\uFE0F Low budget: ${roundsLeft} rounds remaining` });
|
|
671
|
+
}
|
|
656
672
|
if (this.userInterjection) {
|
|
657
673
|
const msg = this.userInterjection;
|
|
658
674
|
this.userInterjection = null;
|