jinzd-ai-cli 0.3.6 → 0.4.0
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-RS5ALOXF.js → chunk-AE7S6GOW.js} +200 -2718
- package/dist/chunk-MXMU4PSC.js +2531 -0
- package/dist/{chunk-U7YCERTR.js → chunk-ODUVYMY7.js} +1 -1
- package/dist/{chunk-OQK3WSFD.js → chunk-SX52VL4D.js} +1 -1
- package/dist/{hub-Y4UP3NAQ.js → hub-F5PM4DUQ.js} +45 -7
- package/dist/index.js +20 -15
- package/dist/{run-tests-PGGAA5PE.js → run-tests-LX4GMVCW.js} +1 -1
- package/dist/{run-tests-AYU7S4EG.js → run-tests-PVELOOI3.js} +1 -1
- package/dist/{server-2MJUVLUU.js → server-4I75C6R7.js} +14 -12
- package/dist/task-orchestrator-NS7XXP5N.js +500 -0
- package/package.json +2 -1
|
@@ -269,6 +269,7 @@ function listPresets() {
|
|
|
269
269
|
|
|
270
270
|
// src/hub/index.ts
|
|
271
271
|
import { readFileSync, existsSync } from "fs";
|
|
272
|
+
import chalk from "chalk";
|
|
272
273
|
async function startHub(options, configManager, providers) {
|
|
273
274
|
if (options.listPresets) {
|
|
274
275
|
console.log("\n Available discussion presets:\n");
|
|
@@ -349,25 +350,62 @@ ${content}`);
|
|
|
349
350
|
}
|
|
350
351
|
context = parts.join("\n\n---\n\n");
|
|
351
352
|
}
|
|
353
|
+
const mode = options.mode ?? "discuss";
|
|
352
354
|
const config = {
|
|
353
|
-
mode
|
|
355
|
+
mode,
|
|
354
356
|
roles,
|
|
355
357
|
defaultProvider,
|
|
356
358
|
defaultModel,
|
|
357
|
-
maxRounds: options.maxRounds ?? 10,
|
|
358
|
-
enableTools:
|
|
359
|
+
maxRounds: options.maxRounds ?? (mode === "task" ? 15 : 10),
|
|
360
|
+
enableTools: mode === "task",
|
|
361
|
+
maxToolRoundsPerTurn: mode === "task" ? 15 : void 0,
|
|
359
362
|
context,
|
|
360
363
|
contextFiles: contextFileNames.length > 0 ? contextFileNames : void 0
|
|
361
364
|
};
|
|
362
|
-
if (
|
|
365
|
+
if (mode === "discuss") {
|
|
363
366
|
if (options.distributed) {
|
|
364
367
|
await runDistributedDiscussion(config, providers, options.topic, options.port ?? 9527);
|
|
365
368
|
} else {
|
|
366
369
|
await runDiscussion(config, providers, options.topic);
|
|
367
370
|
}
|
|
368
|
-
} else {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
+
} else if (mode === "task") {
|
|
372
|
+
await runTaskMode(config, providers, configManager, options.topic);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
async function runTaskMode(config, providers, configManager, topic) {
|
|
376
|
+
const { TaskOrchestrator } = await import("./task-orchestrator-NS7XXP5N.js");
|
|
377
|
+
const orchestrator = new TaskOrchestrator(config, providers, configManager);
|
|
378
|
+
let interrupted = false;
|
|
379
|
+
const onSigint = () => {
|
|
380
|
+
if (interrupted) {
|
|
381
|
+
console.log("\n Force exit.");
|
|
382
|
+
process.exit(0);
|
|
383
|
+
}
|
|
384
|
+
interrupted = true;
|
|
385
|
+
orchestrator.abort();
|
|
386
|
+
};
|
|
387
|
+
process.on("SIGINT", onSigint);
|
|
388
|
+
console.log();
|
|
389
|
+
console.log(chalk.bold.white(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"));
|
|
390
|
+
console.log(chalk.bold.white(" \u2551") + chalk.bold.yellow(" \u{1F680} AI-CLI Multi-Agent Hub \u2014 Task Mode ") + chalk.bold.white("\u2551"));
|
|
391
|
+
console.log(chalk.bold.white(" \u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563"));
|
|
392
|
+
console.log(chalk.bold.white(" \u2551") + chalk.dim(` Goal: ${topic.slice(0, 52)}`.padEnd(62)) + chalk.bold.white("\u2551"));
|
|
393
|
+
console.log(chalk.bold.white(" \u2551") + chalk.dim(` Team: ${config.roles.map((r) => r.name).join(", ")}`.slice(0, 62).padEnd(62)) + chalk.bold.white("\u2551"));
|
|
394
|
+
if (config.contextFiles && config.contextFiles.length > 0) {
|
|
395
|
+
console.log(chalk.bold.white(" \u2551") + chalk.dim(` Context: ${config.contextFiles.join(", ")}`.padEnd(62)) + chalk.bold.white("\u2551"));
|
|
396
|
+
}
|
|
397
|
+
console.log(chalk.bold.white(" \u2551") + chalk.dim(` Rounds/task: up to ${config.maxToolRoundsPerTurn ?? 15}`.padEnd(62)) + chalk.bold.white("\u2551"));
|
|
398
|
+
console.log(chalk.bold.white(" \u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563"));
|
|
399
|
+
console.log(chalk.bold.white(" \u2551") + chalk.dim(" Plan \u2192 Approve \u2192 Execute \u2192 Review".padEnd(62)) + chalk.bold.white("\u2551"));
|
|
400
|
+
console.log(chalk.bold.white(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"));
|
|
401
|
+
console.log();
|
|
402
|
+
try {
|
|
403
|
+
await orchestrator.run(topic);
|
|
404
|
+
} catch (err) {
|
|
405
|
+
console.error(chalk.red(`
|
|
406
|
+
\u2717 Task mode error: ${err.message}`));
|
|
407
|
+
} finally {
|
|
408
|
+
process.removeListener("SIGINT", onSigint);
|
|
371
409
|
}
|
|
372
410
|
}
|
|
373
411
|
async function runDistributedDiscussion(config, providers, topic, port) {
|
package/dist/index.js
CHANGED
|
@@ -8,35 +8,37 @@ import {
|
|
|
8
8
|
SessionManager,
|
|
9
9
|
SkillManager,
|
|
10
10
|
TOOL_CALL_REMINDER,
|
|
11
|
-
ToolRegistry,
|
|
12
|
-
askUserContext,
|
|
13
11
|
checkPermission,
|
|
14
12
|
clearDevState,
|
|
15
13
|
detectsHallucinatedFileOp,
|
|
16
14
|
formatGitContextForPrompt,
|
|
17
|
-
getActiveMaxChars,
|
|
18
15
|
getContentText,
|
|
19
|
-
getDangerLevel,
|
|
20
16
|
getGitContext,
|
|
21
17
|
getGitRoot,
|
|
22
|
-
googleSearchContext,
|
|
23
18
|
hadPreviousWriteToolCalls,
|
|
24
|
-
initTheme,
|
|
25
|
-
isFileWriteTool,
|
|
26
|
-
lastResponseStore,
|
|
27
19
|
loadDevState,
|
|
28
20
|
parseSimpleYaml,
|
|
29
21
|
renderDiff,
|
|
30
22
|
runHook,
|
|
31
23
|
saveDevState,
|
|
32
24
|
sessionHasMeaningfulContent,
|
|
25
|
+
setupProxy
|
|
26
|
+
} from "./chunk-AE7S6GOW.js";
|
|
27
|
+
import {
|
|
28
|
+
ToolRegistry,
|
|
29
|
+
askUserContext,
|
|
30
|
+
getActiveMaxChars,
|
|
31
|
+
getDangerLevel,
|
|
32
|
+
googleSearchContext,
|
|
33
|
+
initTheme,
|
|
34
|
+
isFileWriteTool,
|
|
35
|
+
lastResponseStore,
|
|
33
36
|
setContextWindow,
|
|
34
|
-
setupProxy,
|
|
35
37
|
spawnAgentContext,
|
|
36
38
|
theme,
|
|
37
39
|
truncateOutput,
|
|
38
40
|
undoStack
|
|
39
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-MXMU4PSC.js";
|
|
40
42
|
import {
|
|
41
43
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
42
44
|
AUTHOR,
|
|
@@ -56,7 +58,7 @@ import {
|
|
|
56
58
|
REPO_URL,
|
|
57
59
|
SKILLS_DIR_NAME,
|
|
58
60
|
VERSION
|
|
59
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-SX52VL4D.js";
|
|
60
62
|
|
|
61
63
|
// src/index.ts
|
|
62
64
|
import { program } from "commander";
|
|
@@ -1907,7 +1909,7 @@ ${hint}` : "")
|
|
|
1907
1909
|
description: "Run project tests and show structured report",
|
|
1908
1910
|
usage: "/test [command|filter]",
|
|
1909
1911
|
async execute(args, _ctx) {
|
|
1910
|
-
const { executeTests } = await import("./run-tests-
|
|
1912
|
+
const { executeTests } = await import("./run-tests-LX4GMVCW.js");
|
|
1911
1913
|
const argStr = args.join(" ").trim();
|
|
1912
1914
|
let testArgs = {};
|
|
1913
1915
|
if (argStr) {
|
|
@@ -5517,7 +5519,7 @@ program.command("web").description("Start Web UI server with browser-based chat
|
|
|
5517
5519
|
console.error("Error: Invalid port number. Must be between 1 and 65535.");
|
|
5518
5520
|
process.exit(1);
|
|
5519
5521
|
}
|
|
5520
|
-
const { startWebServer } = await import("./server-
|
|
5522
|
+
const { startWebServer } = await import("./server-4I75C6R7.js");
|
|
5521
5523
|
await startWebServer({ port, host: options.host });
|
|
5522
5524
|
});
|
|
5523
5525
|
program.command("user [action] [username]").description("Manage Web UI users (list | create <name> | delete <name> | reset-password <name> | migrate <name>)").action(async (action, username) => {
|
|
@@ -5687,6 +5689,7 @@ program.command("help").description("Show a comprehensive guide to all aicli fea
|
|
|
5687
5689
|
` ${Y}--preset <name>${R} Role preset (tech-review/brainstorm/code-review/debate)`,
|
|
5688
5690
|
` ${Y}--roles <file>${R} Custom roles JSON file`,
|
|
5689
5691
|
` ${Y}-c, --context <file>${R} Inject context doc (repeatable: -c a.md -c b.md)`,
|
|
5692
|
+
` ${Y}--task${R} Task mode: agents plan & write code with tools`,
|
|
5690
5693
|
` ${Y}--distributed${R} Distributed mode (WebSocket, multi-process)`,
|
|
5691
5694
|
` ${Y}--max-rounds <n>${R} Max discussion rounds (default: 10)`,
|
|
5692
5695
|
` ${Y}aicli join --human${R} Join as a human participant`,
|
|
@@ -5729,6 +5732,7 @@ program.command("help").description("Show a comprehensive guide to all aicli fea
|
|
|
5729
5732
|
` ${G}aicli -p "explain this" < main.py${R} ${D}# headless + file${R}`,
|
|
5730
5733
|
` ${G}aicli web --host 0.0.0.0${R} ${D}# Web UI on LAN${R}`,
|
|
5731
5734
|
` ${G}aicli hub --preset brainstorm "idea"${R} ${D}# multi-agent brainstorm${R}`,
|
|
5735
|
+
` ${G}aicli hub --task --roles team.json "build app"${R} ${D}# task mode: agents write code${R}`,
|
|
5732
5736
|
` ${G}aicli hub -c spec.md -c api.md "build it"${R} ${D}# hub + docs context${R}`,
|
|
5733
5737
|
"",
|
|
5734
5738
|
`${D} Docs: https://github.com/jinzhengdong/ai-cli${R}`,
|
|
@@ -5737,7 +5741,7 @@ program.command("help").description("Show a comprehensive guide to all aicli fea
|
|
|
5737
5741
|
];
|
|
5738
5742
|
console.log(lines.join("\n"));
|
|
5739
5743
|
});
|
|
5740
|
-
program.command("hub [topic]").description("Start multi-agent hub (discuss / brainstorm with multiple AI roles)").option("--preset <name>", "Use a built-in role preset (default: tech-review)").option("--roles <file>", "Load roles from a JSON file").option("--provider <name>", "Override default AI provider").option("-m, --model <name>", "Override default model").option("--max-rounds <n>", "Max discussion rounds (default: 10)").option("--presets", "List available role presets").option("-c, --context <file>", "Inject context document (repeatable: -c a.md -c b.md)", (val, prev) => prev.concat(val), []).option("--distributed", "Start WebSocket server so remote aicli instances can join as agents").option("--port <n>", "WebSocket port for distributed mode (default: 9527)", "9527").action(async (topic, options) => {
|
|
5744
|
+
program.command("hub [topic]").description("Start multi-agent hub (discuss / brainstorm with multiple AI roles)").option("--preset <name>", "Use a built-in role preset (default: tech-review)").option("--roles <file>", "Load roles from a JSON file").option("--provider <name>", "Override default AI provider").option("-m, --model <name>", "Override default model").option("--max-rounds <n>", "Max discussion rounds (default: 10)").option("--presets", "List available role presets").option("--task", "Task mode: plan \u2192 approve \u2192 execute with tools (agents write code)").option("-c, --context <file>", "Inject context document (repeatable: -c a.md -c b.md)", (val, prev) => prev.concat(val), []).option("--distributed", "Start WebSocket server so remote aicli instances can join as agents").option("--port <n>", "WebSocket port for distributed mode (default: 9527)", "9527").action(async (topic, options) => {
|
|
5741
5745
|
const config = new ConfigManager();
|
|
5742
5746
|
const registry = new ProviderRegistry();
|
|
5743
5747
|
await registry.initialize(
|
|
@@ -5748,7 +5752,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
|
|
|
5748
5752
|
}),
|
|
5749
5753
|
config.get("customProviders")
|
|
5750
5754
|
);
|
|
5751
|
-
const { startHub } = await import("./hub-
|
|
5755
|
+
const { startHub } = await import("./hub-F5PM4DUQ.js");
|
|
5752
5756
|
await startHub(
|
|
5753
5757
|
{
|
|
5754
5758
|
topic: topic ?? "",
|
|
@@ -5756,6 +5760,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
|
|
|
5756
5760
|
rolesFile: options.roles,
|
|
5757
5761
|
provider: options.provider,
|
|
5758
5762
|
model: options.model,
|
|
5763
|
+
mode: options.task === true ? "task" : void 0,
|
|
5759
5764
|
maxRounds: options.maxRounds ? parseInt(options.maxRounds, 10) : void 0,
|
|
5760
5765
|
listPresets: options.presets === true,
|
|
5761
5766
|
contextFiles: options.context?.length ? options.context : void 0,
|
|
@@ -7,27 +7,32 @@ import {
|
|
|
7
7
|
SessionManager,
|
|
8
8
|
SkillManager,
|
|
9
9
|
TOOL_CALL_REMINDER,
|
|
10
|
-
ToolRegistry,
|
|
11
|
-
askUserContext,
|
|
12
10
|
checkPermission,
|
|
13
11
|
detectsHallucinatedFileOp,
|
|
14
12
|
formatGitContextForPrompt,
|
|
15
13
|
getContentText,
|
|
16
|
-
getDangerLevel,
|
|
17
14
|
getGitContext,
|
|
18
15
|
getGitRoot,
|
|
19
|
-
googleSearchContext,
|
|
20
16
|
hadPreviousWriteToolCalls,
|
|
21
|
-
isFileWriteTool,
|
|
22
17
|
loadDevState,
|
|
23
18
|
renderDiff,
|
|
24
19
|
runHook,
|
|
20
|
+
setupProxy
|
|
21
|
+
} from "./chunk-AE7S6GOW.js";
|
|
22
|
+
import {
|
|
23
|
+
AuthManager
|
|
24
|
+
} from "./chunk-CPLT6CD3.js";
|
|
25
|
+
import {
|
|
26
|
+
ToolRegistry,
|
|
27
|
+
askUserContext,
|
|
28
|
+
getDangerLevel,
|
|
29
|
+
googleSearchContext,
|
|
30
|
+
isFileWriteTool,
|
|
25
31
|
setContextWindow,
|
|
26
|
-
setupProxy,
|
|
27
32
|
spawnAgentContext,
|
|
28
33
|
truncateOutput,
|
|
29
34
|
undoStack
|
|
30
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-MXMU4PSC.js";
|
|
31
36
|
import {
|
|
32
37
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
33
38
|
CONTEXT_FILE_CANDIDATES,
|
|
@@ -39,10 +44,7 @@ import {
|
|
|
39
44
|
PLAN_MODE_SYSTEM_ADDON,
|
|
40
45
|
SKILLS_DIR_NAME,
|
|
41
46
|
VERSION
|
|
42
|
-
} from "./chunk-
|
|
43
|
-
import {
|
|
44
|
-
AuthManager
|
|
45
|
-
} from "./chunk-CPLT6CD3.js";
|
|
47
|
+
} from "./chunk-SX52VL4D.js";
|
|
46
48
|
|
|
47
49
|
// src/web/server.ts
|
|
48
50
|
import express from "express";
|
|
@@ -1438,7 +1440,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
|
|
|
1438
1440
|
case "test": {
|
|
1439
1441
|
this.send({ type: "info", message: "\u{1F9EA} Running tests..." });
|
|
1440
1442
|
try {
|
|
1441
|
-
const { executeTests } = await import("./run-tests-
|
|
1443
|
+
const { executeTests } = await import("./run-tests-LX4GMVCW.js");
|
|
1442
1444
|
const argStr = args.join(" ").trim();
|
|
1443
1445
|
let testArgs = {};
|
|
1444
1446
|
if (argStr) {
|