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.
@@ -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 defaultProvider = options.provider ?? configManager.get("defaultProvider");
11
- const allDefaultModels = configManager.get("defaultModels");
12
- let defaultModel = options.model ?? allDefaultModels[defaultProvider] ?? "";
13
- if (!defaultModel) {
14
- try {
15
- const p = providers.get(defaultProvider);
16
- defaultModel = p.info.defaultModel;
17
- } catch {
18
- console.error(` \u2717 Provider "${defaultProvider}" not configured.`);
19
- process.exit(1);
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
- console.log(chalk.dim(` Provider: ${defaultProvider} / ${defaultModel}`));
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
- console.log(chalk.bold.cyan(` \u{1F4AD} Your turn to speak (Round ${msg.round}/${msg.maxRounds})...`));
77
- try {
78
- const response = await generateResponse(
79
- topic,
80
- msg.history,
81
- msg.round,
82
- msg.maxRounds,
83
- myRoleId,
84
- myRoleName,
85
- persona,
86
- providers,
87
- defaultProvider,
88
- defaultModel
89
- );
90
- const passed = response.toUpperCase().startsWith(PASS_MARKER) || response.toUpperCase() === PASS_MARKER;
91
- if (passed) {
92
- console.log(chalk.dim(" [PASS \u2014 nothing to add]\n"));
93
- } else {
94
- console.log(chalk.cyan(` \u250C\u2500 ${myRoleName} (you)`));
95
- for (const line of response.split("\n")) {
96
- console.log(chalk.cyan(" \u2502 ") + line);
97
- }
98
- console.log(chalk.cyan(" \u2514" + "\u2500".repeat(50)));
99
- console.log();
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
  };
@@ -16,7 +16,7 @@ import {
16
16
  SUBAGENT_MAX_ROUNDS_LIMIT,
17
17
  VERSION,
18
18
  runTestsTool
19
- } from "./chunk-UEOKNL7V.js";
19
+ } from "./chunk-NLSQEHZU.js";
20
20
 
21
21
  // src/config/config-manager.ts
22
22
  import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
@@ -6,7 +6,7 @@ import { platform } from "os";
6
6
  import chalk from "chalk";
7
7
 
8
8
  // src/core/constants.ts
9
- var VERSION = "0.3.2";
9
+ var VERSION = "0.3.3";
10
10
  var APP_NAME = "ai-cli";
11
11
  var CONFIG_DIR_NAME = ".aicli";
12
12
  var CONFIG_FILE_NAME = "config.json";
@@ -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.3.2";
11
+ var VERSION = "0.3.3";
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
@@ -36,7 +36,7 @@ import {
36
36
  theme,
37
37
  truncateOutput,
38
38
  undoStack
39
- } from "./chunk-GBP4DNBU.js";
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-UEOKNL7V.js";
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-6VOBLE77.js");
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-YFR3DO2P.js");
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-OGXLZR5O.js");
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
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  executeTests,
3
3
  runTestsTool
4
- } from "./chunk-AJ26XC7E.js";
4
+ } from "./chunk-IPGCPV3X.js";
5
5
  export {
6
6
  executeTests,
7
7
  runTestsTool
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  executeTests,
4
4
  runTestsTool
5
- } from "./chunk-UEOKNL7V.js";
5
+ } from "./chunk-NLSQEHZU.js";
6
6
  export {
7
7
  executeTests,
8
8
  runTestsTool
@@ -27,7 +27,7 @@ import {
27
27
  spawnAgentContext,
28
28
  truncateOutput,
29
29
  undoStack
30
- } from "./chunk-GBP4DNBU.js";
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-UEOKNL7V.js";
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-6VOBLE77.js");
1441
+ const { executeTests } = await import("./run-tests-WGSNA7K4.js");
1442
1442
  const argStr = args.join(" ").trim();
1443
1443
  let testArgs = {};
1444
1444
  if (argStr) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jinzd-ai-cli",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "Cross-platform REPL-style AI CLI with multi-provider support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",