jinzd-ai-cli 0.4.155 → 0.4.157

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.
Files changed (31) hide show
  1. package/dist/{batch-LS3IJVBK.js → batch-ATL6V3UE.js} +2 -2
  2. package/dist/{chat-index-IF4EINLQ.js → chat-index-2I7ZHRE5.js} +2 -2
  3. package/dist/{chunk-E5ICQT3P.js → chunk-3HJW556L.js} +4 -4
  4. package/dist/{chunk-JOJRBV2K.js → chunk-62CD2T5F.js} +1 -1
  5. package/dist/{chunk-D6GJTJQH.js → chunk-77DDRYFM.js} +1 -1
  6. package/dist/{chunk-CIZQZ7CC.js → chunk-A4JROOGF.js} +2 -2
  7. package/dist/{chunk-NFRTSL3N.js → chunk-GRFQ2QD5.js} +1 -1
  8. package/dist/{chunk-JXSWY54M.js → chunk-LLQMVGNP.js} +1 -1
  9. package/dist/{chunk-B3LFGPU2.js → chunk-N3VGZTEJ.js} +1 -1
  10. package/dist/chunk-NZ4X6GUC.js +230 -0
  11. package/dist/{chunk-O6MLS5QO.js → chunk-OJL3PY36.js} +0 -226
  12. package/dist/{hub-ZILVZWI2.js → chunk-Q3ZUDA6S.js} +6 -249
  13. package/dist/{persist-3EBOLHFZ.js → chunk-RUJQ5OUB.js} +1 -2
  14. package/dist/{chunk-IBBYW6PM.js → chunk-V5OQOKU3.js} +1 -1
  15. package/dist/{ci-34ZQH43L.js → ci-E7MDZSB6.js} +3 -3
  16. package/dist/{constants-DQ5VJOGS.js → constants-NL5ETRA5.js} +1 -1
  17. package/dist/{doctor-cli-TSCI4ORL.js → doctor-cli-XJNT745O.js} +6 -6
  18. package/dist/electron-server.js +758 -44
  19. package/dist/hub-RXZ5IDBY.js +260 -0
  20. package/dist/{hub-server-OH7AYQIW.js → hub-server-GSTG5MNE.js} +4 -2
  21. package/dist/index.js +40 -40
  22. package/dist/persist-UI6WRBGB.js +12 -0
  23. package/dist/{run-tests-5KWCHBQS.js → run-tests-I3EBH7O6.js} +2 -2
  24. package/dist/{run-tests-5CJRMOMI.js → run-tests-O46AI32W.js} +1 -1
  25. package/dist/{server-35OQV62B.js → server-4PJJHZWM.js} +142 -32
  26. package/dist/{server-DVIP7NLW.js → server-SVBHOHTC.js} +6 -6
  27. package/dist/{task-orchestrator-AXSS7ROD.js → task-orchestrator-NMX3CYW2.js} +6 -6
  28. package/dist/web/client/app.js +173 -0
  29. package/dist/web/client/index.html +31 -0
  30. package/package.json +1 -1
  31. package/dist/{chunk-U5MY24UZ.js → chunk-MM3F43H6.js} +3 -3
@@ -1,12 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  HubAgent,
4
- assignRoleColors,
5
- isConverged,
6
- renderHubBanner,
7
- renderHubEvent
8
- } from "./chunk-O6MLS5QO.js";
9
- import "./chunk-PDX44BCA.js";
4
+ isConverged
5
+ } from "./chunk-NZ4X6GUC.js";
10
6
 
11
7
  // src/hub/discuss.ts
12
8
  var DiscussionOrchestrator = class {
@@ -358,248 +354,9 @@ function resolveRoleProviders(roles, lookup, defaultProvider, defaultModel, avai
358
354
  return { roles: outRoles, assignments, warnings };
359
355
  }
360
356
 
361
- // src/hub/index.ts
362
- import { readFileSync, existsSync } from "fs";
363
- import chalk from "chalk";
364
- async function startHub(options, configManager, providers) {
365
- if (options.listPresets) {
366
- console.log("\n Available discussion presets:\n");
367
- for (const p of listPresets()) {
368
- console.log(` ${p.id.padEnd(16)} ${p.name}`);
369
- console.log(` ${"".padEnd(16)} ${p.description}`);
370
- for (const r of p.roles) {
371
- console.log(` ${"".padEnd(18)} \u2022 ${r.name} (${r.id})`);
372
- }
373
- console.log();
374
- }
375
- return;
376
- }
377
- let roles;
378
- let presetUsed;
379
- if (options.rolesFile) {
380
- if (!existsSync(options.rolesFile)) {
381
- console.error(` \u2717 Roles file not found: ${options.rolesFile}`);
382
- process.exit(1);
383
- }
384
- try {
385
- const raw = readFileSync(options.rolesFile, "utf-8");
386
- const parsed = JSON.parse(raw);
387
- const rawRoles = Array.isArray(parsed) ? parsed : parsed.roles;
388
- if (!Array.isArray(rawRoles) || rawRoles.length === 0) {
389
- throw new Error("roles must be a non-empty array");
390
- }
391
- roles = rawRoles.map((r) => ({
392
- id: r.id ?? r.name?.toLowerCase().replace(/\s+/g, "-") ?? "agent",
393
- name: r.name ?? r.id ?? "Agent",
394
- persona: r.persona ?? r.description ?? `You are ${r.name ?? "an AI assistant"}.`,
395
- ...r.provider && { provider: r.provider },
396
- ...r.model && { model: r.model },
397
- ...r.color && { color: r.color }
398
- }));
399
- } catch (err) {
400
- console.error(` \u2717 Invalid roles file: ${err.message}`);
401
- process.exit(1);
402
- }
403
- } else {
404
- const presetId = options.preset ?? "tech-review";
405
- presetUsed = getPreset(presetId);
406
- if (!presetUsed) {
407
- console.error(` \u2717 Preset "${presetId}" not found. Use --presets to list available presets.`);
408
- process.exit(1);
409
- }
410
- roles = presetUsed.roles;
411
- }
412
- const defaultProvider = options.provider ?? configManager.get("defaultProvider");
413
- const allDefaultModels = configManager.get("defaultModels");
414
- let defaultModel = options.model ?? allDefaultModels[defaultProvider] ?? "";
415
- if (!defaultModel) {
416
- try {
417
- const p = providers.get(defaultProvider);
418
- defaultModel = p.info.defaultModel;
419
- } catch {
420
- console.error(` \u2717 Provider "${defaultProvider}" not configured. Run \`aicli config\` first.`);
421
- process.exit(1);
422
- }
423
- }
424
- if (!providers.has(defaultProvider)) {
425
- console.error(` \u2717 Provider "${defaultProvider}" not available. Check API key configuration.`);
426
- process.exit(1);
427
- }
428
- if (!options.topic?.trim()) {
429
- console.error(" \u2717 Please provide a discussion topic.");
430
- console.error(' Usage: aicli hub "your topic here"');
431
- console.error(' aicli hub --preset brainstorm "your topic here"');
432
- process.exit(1);
433
- }
434
- let context;
435
- const contextFileNames = [];
436
- if (options.contextFiles && options.contextFiles.length > 0) {
437
- const parts = [];
438
- for (const filePath of options.contextFiles) {
439
- if (!existsSync(filePath)) {
440
- console.error(` \u2717 Context file not found: ${filePath}`);
441
- process.exit(1);
442
- }
443
- const content = readFileSync(filePath, "utf-8");
444
- const fileName = filePath.replace(/\\/g, "/").split("/").pop() ?? filePath;
445
- contextFileNames.push(fileName);
446
- parts.push(`### ${fileName}
447
-
448
- ${content}`);
449
- }
450
- context = parts.join("\n\n---\n\n");
451
- }
452
- {
453
- const resolution = resolveRoleProviders(
454
- roles,
455
- {
456
- has: (id) => providers.has(id),
457
- defaultModelFor: (id) => providers.has(id) ? providers.get(id).info.defaultModel : void 0
458
- },
459
- defaultProvider,
460
- defaultModel,
461
- providers.listAvailable().map((p) => p.info.id),
462
- options.mix
463
- );
464
- roles = resolution.roles;
465
- for (const w of resolution.warnings) console.error(chalk.yellow(` \u26A0 ${w}`));
466
- }
467
- const mode = options.mode ?? "discuss";
468
- const config = {
469
- mode,
470
- roles,
471
- defaultProvider,
472
- defaultModel,
473
- maxRounds: options.maxRounds ?? (mode === "task" ? 15 : 10),
474
- enableTools: mode === "task",
475
- maxToolRoundsPerTurn: mode === "task" ? options.taskRounds ?? 30 : void 0,
476
- context,
477
- contextFiles: contextFileNames.length > 0 ? contextFileNames : void 0,
478
- humanSteer: options.steer === true,
479
- voteConverge: options.vote === true
480
- };
481
- if (mode === "discuss") {
482
- if (options.distributed) {
483
- await runDistributedDiscussion(config, providers, options.topic, options.port ?? 9527);
484
- } else {
485
- const state = await runDiscussion(config, providers, options.topic);
486
- if (options.save !== false && state.messages.length > 0) {
487
- try {
488
- const { persistDiscussion } = await import("./persist-3EBOLHFZ.js");
489
- const { path } = await persistDiscussion(state, configManager, defaultProvider, defaultModel);
490
- console.log(chalk.dim(`
491
- \u{1F4BE} Saved to history \u2014 open it in the Web UI and hit \u{1F3AC} to replay.
492
- ${path}`));
493
- } catch (err) {
494
- console.error(chalk.yellow(` \u26A0 Could not save discussion: ${err.message}`));
495
- }
496
- }
497
- }
498
- } else if (mode === "task") {
499
- await runTaskMode(config, providers, configManager, options.topic);
500
- }
501
- }
502
- async function runTaskMode(config, providers, configManager, topic) {
503
- const { TaskOrchestrator } = await import("./task-orchestrator-AXSS7ROD.js");
504
- const orchestrator = new TaskOrchestrator(config, providers, configManager);
505
- let interrupted = false;
506
- const onSigint = () => {
507
- if (interrupted) {
508
- console.log("\n Force exit.");
509
- process.exit(0);
510
- }
511
- interrupted = true;
512
- orchestrator.abort();
513
- };
514
- process.on("SIGINT", onSigint);
515
- console.log();
516
- 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"));
517
- console.log(chalk.bold.white(" \u2551") + chalk.bold.yellow(" \u{1F680} AI-CLI Multi-Agent Hub \u2014 Task Mode ") + chalk.bold.white("\u2551"));
518
- 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"));
519
- console.log(chalk.bold.white(" \u2551") + chalk.dim(` Goal: ${topic.slice(0, 52)}`.padEnd(62)) + chalk.bold.white("\u2551"));
520
- 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"));
521
- if (config.contextFiles && config.contextFiles.length > 0) {
522
- console.log(chalk.bold.white(" \u2551") + chalk.dim(` Context: ${config.contextFiles.join(", ")}`.padEnd(62)) + chalk.bold.white("\u2551"));
523
- }
524
- console.log(chalk.bold.white(" \u2551") + chalk.dim(` Rounds/task: up to ${config.maxToolRoundsPerTurn ?? 15}`.padEnd(62)) + chalk.bold.white("\u2551"));
525
- 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"));
526
- console.log(chalk.bold.white(" \u2551") + chalk.dim(" Plan \u2192 Approve \u2192 Execute \u2192 Review".padEnd(62)) + chalk.bold.white("\u2551"));
527
- 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"));
528
- console.log();
529
- try {
530
- await orchestrator.run(topic);
531
- } catch (err) {
532
- console.error(chalk.red(`
533
- \u2717 Task mode error: ${err.message}`));
534
- } finally {
535
- process.removeListener("SIGINT", onSigint);
536
- }
537
- }
538
- async function runDistributedDiscussion(config, providers, topic, port) {
539
- const { HubServer } = await import("./hub-server-OH7AYQIW.js");
540
- const hub = new HubServer(config, providers, port);
541
- let interrupted = false;
542
- const onSigint = () => {
543
- if (interrupted) {
544
- console.log("\n Force exit.");
545
- hub.shutdown();
546
- process.exit(0);
547
- }
548
- interrupted = true;
549
- hub.abort();
550
- };
551
- process.on("SIGINT", onSigint);
552
- try {
553
- await hub.start(topic);
554
- } catch (err) {
555
- console.error(`
556
- \u2717 Hub error: ${err.message}`);
557
- } finally {
558
- process.removeListener("SIGINT", onSigint);
559
- }
560
- }
561
- async function runDiscussion(config, providers, topic) {
562
- assignRoleColors(config.roles);
563
- const orchestrator = new DiscussionOrchestrator(config, providers);
564
- orchestrator.onEvent = renderHubEvent;
565
- if (config.humanSteer) {
566
- const { createInterface } = await import("readline");
567
- orchestrator.onRoundReview = async ({ round, maxRounds }) => {
568
- const rl = createInterface({ input: process.stdin, output: process.stdout });
569
- const answer = await new Promise((resolve) => {
570
- rl.question(
571
- chalk.cyan(`
572
- \u{1F9ED} Round ${round}/${maxRounds} done. Steer next round? `) + chalk.dim("[Enter=continue \xB7 type guidance \xB7 /stop=end] "),
573
- resolve
574
- );
575
- });
576
- rl.close();
577
- const t = answer.trim();
578
- if (t === "/stop" || t.toLowerCase() === "stop") return { action: "stop" };
579
- return { action: "continue", message: t || void 0 };
580
- };
581
- }
582
- let interrupted = false;
583
- const onSigint = () => {
584
- if (interrupted) {
585
- console.log("\n Force exit.");
586
- process.exit(0);
587
- }
588
- interrupted = true;
589
- orchestrator.abort();
590
- };
591
- process.on("SIGINT", onSigint);
592
- renderHubBanner(topic, config.roles, config.maxRounds ?? 10, config.contextFiles);
593
- try {
594
- return await orchestrator.run(topic);
595
- } catch (err) {
596
- console.error(`
597
- \u2717 Hub error: ${err.message}`);
598
- return orchestrator.getState();
599
- } finally {
600
- process.removeListener("SIGINT", onSigint);
601
- }
602
- }
603
357
  export {
604
- startHub
358
+ DiscussionOrchestrator,
359
+ getPreset,
360
+ listPresets,
361
+ resolveRoleProviders
605
362
  };
@@ -2,8 +2,6 @@
2
2
  import {
3
3
  SessionManager
4
4
  } from "./chunk-TOTEUETI.js";
5
- import "./chunk-SLSWPBK3.js";
6
- import "./chunk-PDX44BCA.js";
7
5
 
8
6
  // src/hub/persist.ts
9
7
  import { join } from "path";
@@ -46,6 +44,7 @@ async function persistDiscussion(state, config, defaultProvider, defaultModel) {
46
44
  await sm.save();
47
45
  return { id: session.id, path: join(config.getHistoryDir(), `${session.id}.json`) };
48
46
  }
47
+
49
48
  export {
50
49
  discussionToMessages,
51
50
  persistDiscussion
@@ -8,7 +8,7 @@ import {
8
8
  CONFIG_FILE_NAME,
9
9
  HISTORY_DIR_NAME,
10
10
  PLUGINS_DIR_NAME
11
- } from "./chunk-B3LFGPU2.js";
11
+ } from "./chunk-N3VGZTEJ.js";
12
12
 
13
13
  // src/config/config-manager.ts
14
14
  import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
@@ -7,14 +7,14 @@ import {
7
7
  import {
8
8
  ProviderRegistry
9
9
  } from "./chunk-AIZOARZY.js";
10
+ import "./chunk-NXXNLLSG.js";
10
11
  import {
11
12
  ConfigManager
12
- } from "./chunk-IBBYW6PM.js";
13
- import "./chunk-NXXNLLSG.js";
13
+ } from "./chunk-V5OQOKU3.js";
14
14
  import "./chunk-2ZD3YTVM.js";
15
15
  import {
16
16
  VERSION
17
- } from "./chunk-B3LFGPU2.js";
17
+ } from "./chunk-N3VGZTEJ.js";
18
18
  import "./chunk-PDX44BCA.js";
19
19
 
20
20
  // src/cli/ci.ts
@@ -36,7 +36,7 @@ import {
36
36
  TEST_TIMEOUT,
37
37
  VERSION,
38
38
  buildUserIdentityPrompt
39
- } from "./chunk-B3LFGPU2.js";
39
+ } from "./chunk-N3VGZTEJ.js";
40
40
  import "./chunk-PDX44BCA.js";
41
41
  export {
42
42
  AGENTIC_BEHAVIOR_GUIDELINE,
@@ -2,26 +2,26 @@
2
2
  import {
3
3
  getConfigDirUsage,
4
4
  listRecentCrashes
5
- } from "./chunk-D6GJTJQH.js";
5
+ } from "./chunk-77DDRYFM.js";
6
6
  import {
7
7
  ProviderRegistry
8
8
  } from "./chunk-AIZOARZY.js";
9
- import {
10
- ConfigManager
11
- } from "./chunk-IBBYW6PM.js";
12
9
  import {
13
10
  getStatsSnapshot,
14
11
  getTopFailingTools,
15
12
  getTopUsedTools,
16
13
  resetStats
17
- } from "./chunk-NFRTSL3N.js";
14
+ } from "./chunk-GRFQ2QD5.js";
18
15
  import "./chunk-NXXNLLSG.js";
16
+ import {
17
+ ConfigManager
18
+ } from "./chunk-V5OQOKU3.js";
19
19
  import "./chunk-2ZD3YTVM.js";
20
20
  import {
21
21
  DEV_STATE_FILE_NAME,
22
22
  MEMORY_FILE_NAME,
23
23
  VERSION
24
- } from "./chunk-B3LFGPU2.js";
24
+ } from "./chunk-N3VGZTEJ.js";
25
25
  import "./chunk-PDX44BCA.js";
26
26
 
27
27
  // src/diagnostics/doctor-cli.ts