jinzd-ai-cli 0.3.2 → 0.3.3
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/{agent-client-OGXLZR5O.js → agent-client-YRCQVYHJ.js} +103 -46
- package/dist/{chunk-GBP4DNBU.js → chunk-54GQL2O4.js} +1 -1
- package/dist/{chunk-AJ26XC7E.js → chunk-IPGCPV3X.js} +1 -1
- package/dist/{chunk-UEOKNL7V.js → chunk-NLSQEHZU.js} +1 -1
- package/dist/index.js +8 -7
- package/dist/{run-tests-YDNIQ4L6.js → run-tests-CTA7UEXQ.js} +1 -1
- package/dist/{run-tests-6VOBLE77.js → run-tests-WGSNA7K4.js} +1 -1
- package/dist/{server-YFR3DO2P.js → server-BIZW2NHV.js} +3 -3
- package/package.json +1 -1
|
@@ -3,27 +3,42 @@
|
|
|
3
3
|
// src/hub/agent-client.ts
|
|
4
4
|
import WebSocket from "ws";
|
|
5
5
|
import chalk from "chalk";
|
|
6
|
+
import { createInterface } from "readline";
|
|
6
7
|
var PASS_MARKER = "[PASS]";
|
|
7
8
|
async function joinHub(options, configManager, providers) {
|
|
8
9
|
const host = options.host ?? "localhost";
|
|
9
10
|
const url = `ws://${host}:${options.port}`;
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
let defaultModel =
|
|
13
|
-
if (!
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
const isHuman = options.human === true;
|
|
12
|
+
let defaultProvider = "";
|
|
13
|
+
let defaultModel = "";
|
|
14
|
+
if (!isHuman) {
|
|
15
|
+
defaultProvider = options.provider ?? configManager.get("defaultProvider");
|
|
16
|
+
const allDefaultModels = configManager.get("defaultModels");
|
|
17
|
+
defaultModel = options.model ?? allDefaultModels[defaultProvider] ?? "";
|
|
18
|
+
if (!defaultModel) {
|
|
19
|
+
try {
|
|
20
|
+
const p = providers.get(defaultProvider);
|
|
21
|
+
defaultModel = p.info.defaultModel;
|
|
22
|
+
} catch {
|
|
23
|
+
console.error(` \u2717 Provider "${defaultProvider}" not configured.`);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
20
26
|
}
|
|
21
27
|
}
|
|
28
|
+
let rl = null;
|
|
29
|
+
if (isHuman) {
|
|
30
|
+
rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
31
|
+
}
|
|
22
32
|
console.log();
|
|
23
|
-
console.log(chalk.bold.cyan(" \u{1F916} AI-CLI Agent \u2014 Connecting to Hub"));
|
|
33
|
+
console.log(chalk.bold.cyan(isHuman ? " \u{1F464} AI-CLI Hub \u2014 Human Participant" : " \u{1F916} AI-CLI Agent \u2014 Connecting to Hub"));
|
|
24
34
|
console.log(chalk.dim(` Server: ${url}`));
|
|
25
35
|
if (options.role) console.log(chalk.dim(` Requested role: ${options.role}`));
|
|
26
|
-
|
|
36
|
+
if (isHuman) {
|
|
37
|
+
console.log(chalk.dim(" Mode: HUMAN (you type your responses)"));
|
|
38
|
+
console.log(chalk.dim(" Tip: type [PASS] to skip your turn, empty line to send"));
|
|
39
|
+
} else {
|
|
40
|
+
console.log(chalk.dim(` Provider: ${defaultProvider} / ${defaultModel}`));
|
|
41
|
+
}
|
|
27
42
|
console.log();
|
|
28
43
|
const ws = new WebSocket(url);
|
|
29
44
|
let myRoleId = "";
|
|
@@ -37,6 +52,7 @@ async function joinHub(options, configManager, providers) {
|
|
|
37
52
|
ws.send(JSON.stringify(msg));
|
|
38
53
|
});
|
|
39
54
|
ws.on("close", () => {
|
|
55
|
+
if (rl) rl.close();
|
|
40
56
|
console.log(chalk.dim("\n Disconnected from Hub."));
|
|
41
57
|
process.exit(0);
|
|
42
58
|
});
|
|
@@ -73,42 +89,51 @@ async function joinHub(options, configManager, providers) {
|
|
|
73
89
|
`));
|
|
74
90
|
break;
|
|
75
91
|
case "your_turn": {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
console.
|
|
99
|
-
|
|
92
|
+
let response;
|
|
93
|
+
if (isHuman) {
|
|
94
|
+
console.log(chalk.bold.green(`
|
|
95
|
+
\u270F\uFE0F Your turn to speak, ${myRoleName}! (Round ${msg.round}/${msg.maxRounds})`));
|
|
96
|
+
console.log(chalk.dim(" Type your response (multi-line: end with empty line). [PASS] to skip.\n"));
|
|
97
|
+
response = await readMultiLineInput(rl);
|
|
98
|
+
} else {
|
|
99
|
+
console.log(chalk.bold.cyan(` \u{1F4AD} Your turn to speak (Round ${msg.round}/${msg.maxRounds})...`));
|
|
100
|
+
try {
|
|
101
|
+
response = await generateResponse(
|
|
102
|
+
topic,
|
|
103
|
+
msg.history,
|
|
104
|
+
msg.round,
|
|
105
|
+
msg.maxRounds,
|
|
106
|
+
myRoleId,
|
|
107
|
+
myRoleName,
|
|
108
|
+
persona,
|
|
109
|
+
providers,
|
|
110
|
+
defaultProvider,
|
|
111
|
+
defaultModel
|
|
112
|
+
);
|
|
113
|
+
} catch (err) {
|
|
114
|
+
console.error(chalk.red(` \u2717 Response error: ${err.message}`));
|
|
115
|
+
const errReply = { type: "error", message: err.message };
|
|
116
|
+
ws.send(JSON.stringify(errReply));
|
|
117
|
+
break;
|
|
100
118
|
}
|
|
101
|
-
const reply = {
|
|
102
|
-
type: "response",
|
|
103
|
-
content: passed ? "" : response,
|
|
104
|
-
passed
|
|
105
|
-
};
|
|
106
|
-
ws.send(JSON.stringify(reply));
|
|
107
|
-
} catch (err) {
|
|
108
|
-
console.error(chalk.red(` \u2717 Response error: ${err.message}`));
|
|
109
|
-
const errReply = { type: "error", message: err.message };
|
|
110
|
-
ws.send(JSON.stringify(errReply));
|
|
111
119
|
}
|
|
120
|
+
const passed = response.trim().toUpperCase() === PASS_MARKER || response.trim() === "";
|
|
121
|
+
if (passed) {
|
|
122
|
+
console.log(chalk.dim(" [PASS \u2014 nothing to add]\n"));
|
|
123
|
+
} else if (!isHuman) {
|
|
124
|
+
console.log(chalk.cyan(` \u250C\u2500 ${myRoleName} (you)`));
|
|
125
|
+
for (const line of response.split("\n")) {
|
|
126
|
+
console.log(chalk.cyan(" \u2502 ") + line);
|
|
127
|
+
}
|
|
128
|
+
console.log(chalk.cyan(" \u2514" + "\u2500".repeat(50)));
|
|
129
|
+
console.log();
|
|
130
|
+
}
|
|
131
|
+
const reply = {
|
|
132
|
+
type: "response",
|
|
133
|
+
content: passed ? "" : response.trim(),
|
|
134
|
+
passed
|
|
135
|
+
};
|
|
136
|
+
ws.send(JSON.stringify(reply));
|
|
112
137
|
break;
|
|
113
138
|
}
|
|
114
139
|
case "agent_spoke": {
|
|
@@ -204,6 +229,38 @@ function buildPersonaFromRole(roleId, roleName) {
|
|
|
204
229
|
Respond thoughtfully based on your area of expertise.
|
|
205
230
|
Be constructive, collaborative, and open to other perspectives while maintaining your professional viewpoint.`;
|
|
206
231
|
}
|
|
232
|
+
function readMultiLineInput(rl) {
|
|
233
|
+
return new Promise((resolve) => {
|
|
234
|
+
const lines = [];
|
|
235
|
+
let lastLineEmpty = false;
|
|
236
|
+
const prompt = () => {
|
|
237
|
+
rl.question(chalk.green(" > "), (line) => {
|
|
238
|
+
if (line === "" && lines.length > 0) {
|
|
239
|
+
if (lastLineEmpty) {
|
|
240
|
+
resolve(lines.join("\n"));
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
lastLineEmpty = true;
|
|
244
|
+
lines.push("");
|
|
245
|
+
prompt();
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
if (line === "" && lines.length === 0) {
|
|
249
|
+
resolve(PASS_MARKER);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
if (line.trim().toUpperCase() === PASS_MARKER && lines.length === 0) {
|
|
253
|
+
resolve(PASS_MARKER);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
lastLineEmpty = false;
|
|
257
|
+
lines.push(line);
|
|
258
|
+
prompt();
|
|
259
|
+
});
|
|
260
|
+
};
|
|
261
|
+
prompt();
|
|
262
|
+
});
|
|
263
|
+
}
|
|
207
264
|
export {
|
|
208
265
|
joinHub
|
|
209
266
|
};
|
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
theme,
|
|
37
37
|
truncateOutput,
|
|
38
38
|
undoStack
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-54GQL2O4.js";
|
|
40
40
|
import {
|
|
41
41
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
42
42
|
AUTHOR,
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
REPO_URL,
|
|
57
57
|
SKILLS_DIR_NAME,
|
|
58
58
|
VERSION
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-NLSQEHZU.js";
|
|
60
60
|
|
|
61
61
|
// src/index.ts
|
|
62
62
|
import { program } from "commander";
|
|
@@ -1907,7 +1907,7 @@ ${hint}` : "")
|
|
|
1907
1907
|
description: "Run project tests and show structured report",
|
|
1908
1908
|
usage: "/test [command|filter]",
|
|
1909
1909
|
async execute(args, _ctx) {
|
|
1910
|
-
const { executeTests } = await import("./run-tests-
|
|
1910
|
+
const { executeTests } = await import("./run-tests-WGSNA7K4.js");
|
|
1911
1911
|
const argStr = args.join(" ").trim();
|
|
1912
1912
|
let testArgs = {};
|
|
1913
1913
|
if (argStr) {
|
|
@@ -5517,7 +5517,7 @@ program.command("web").description("Start Web UI server with browser-based chat
|
|
|
5517
5517
|
console.error("Error: Invalid port number. Must be between 1 and 65535.");
|
|
5518
5518
|
process.exit(1);
|
|
5519
5519
|
}
|
|
5520
|
-
const { startWebServer } = await import("./server-
|
|
5520
|
+
const { startWebServer } = await import("./server-BIZW2NHV.js");
|
|
5521
5521
|
await startWebServer({ port, host: options.host });
|
|
5522
5522
|
});
|
|
5523
5523
|
program.command("user [action] [username]").description("Manage Web UI users (list | create <name> | delete <name> | reset-password <name> | migrate <name>)").action(async (action, username) => {
|
|
@@ -5666,7 +5666,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
|
|
|
5666
5666
|
registry
|
|
5667
5667
|
);
|
|
5668
5668
|
});
|
|
5669
|
-
program.command("join").description("Join a running hub as a remote AI agent").option("--port <n>", "Hub WebSocket port (default: 9527)", "9527").option("--host <name>", "Hub host (default: localhost)", "localhost").option("--role <id>", "Request a specific role (e.g. architect, developer)").option("--provider <name>", "Override AI provider for this agent").option("-m, --model <name>", "Override model for this agent").action(async (options) => {
|
|
5669
|
+
program.command("join").description("Join a running hub as a remote AI agent").option("--port <n>", "Hub WebSocket port (default: 9527)", "9527").option("--host <name>", "Hub host (default: localhost)", "localhost").option("--role <id>", "Request a specific role (e.g. architect, developer)").option("--human", "Join as a human participant (type your own responses)").option("--provider <name>", "Override AI provider for this agent").option("-m, --model <name>", "Override model for this agent").action(async (options) => {
|
|
5670
5670
|
const config = new ConfigManager();
|
|
5671
5671
|
const registry = new ProviderRegistry();
|
|
5672
5672
|
await registry.initialize(
|
|
@@ -5677,14 +5677,15 @@ program.command("join").description("Join a running hub as a remote AI agent").o
|
|
|
5677
5677
|
}),
|
|
5678
5678
|
config.get("customProviders")
|
|
5679
5679
|
);
|
|
5680
|
-
const { joinHub } = await import("./agent-client-
|
|
5680
|
+
const { joinHub } = await import("./agent-client-YRCQVYHJ.js");
|
|
5681
5681
|
await joinHub(
|
|
5682
5682
|
{
|
|
5683
5683
|
port: parseInt(options.port ?? "9527", 10),
|
|
5684
5684
|
host: options.host,
|
|
5685
5685
|
role: options.role,
|
|
5686
5686
|
provider: options.provider,
|
|
5687
|
-
model: options.model
|
|
5687
|
+
model: options.model,
|
|
5688
|
+
human: options.human === true
|
|
5688
5689
|
},
|
|
5689
5690
|
config,
|
|
5690
5691
|
registry
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
spawnAgentContext,
|
|
28
28
|
truncateOutput,
|
|
29
29
|
undoStack
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-54GQL2O4.js";
|
|
31
31
|
import {
|
|
32
32
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
33
33
|
CONTEXT_FILE_CANDIDATES,
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
PLAN_MODE_SYSTEM_ADDON,
|
|
40
40
|
SKILLS_DIR_NAME,
|
|
41
41
|
VERSION
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-NLSQEHZU.js";
|
|
43
43
|
import {
|
|
44
44
|
AuthManager
|
|
45
45
|
} from "./chunk-CPLT6CD3.js";
|
|
@@ -1438,7 +1438,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
|
|
|
1438
1438
|
case "test": {
|
|
1439
1439
|
this.send({ type: "info", message: "\u{1F9EA} Running tests..." });
|
|
1440
1440
|
try {
|
|
1441
|
-
const { executeTests } = await import("./run-tests-
|
|
1441
|
+
const { executeTests } = await import("./run-tests-WGSNA7K4.js");
|
|
1442
1442
|
const argStr = args.join(" ").trim();
|
|
1443
1443
|
let testArgs = {};
|
|
1444
1444
|
if (argStr) {
|