@songsid/agend 2.1.4-beta.3 → 2.1.4-beta.30

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 (139) hide show
  1. package/README.md +1 -1
  2. package/README.zh-TW.md +1 -1
  3. package/dist/agent-endpoint.js +1 -1
  4. package/dist/agent-endpoint.js.map +1 -1
  5. package/dist/backend/antigravity.d.ts +9 -5
  6. package/dist/backend/antigravity.js +155 -30
  7. package/dist/backend/antigravity.js.map +1 -1
  8. package/dist/backend/claude-code.d.ts +23 -21
  9. package/dist/backend/claude-code.js +47 -24
  10. package/dist/backend/claude-code.js.map +1 -1
  11. package/dist/backend/codex.d.ts +17 -0
  12. package/dist/backend/codex.js +122 -7
  13. package/dist/backend/codex.js.map +1 -1
  14. package/dist/backend/kiro.d.ts +1 -0
  15. package/dist/backend/kiro.js +14 -0
  16. package/dist/backend/kiro.js.map +1 -1
  17. package/dist/backend/opencode.d.ts +27 -11
  18. package/dist/backend/opencode.js +48 -37
  19. package/dist/backend/opencode.js.map +1 -1
  20. package/dist/backend/types.d.ts +14 -0
  21. package/dist/backend/types.js +7 -0
  22. package/dist/backend/types.js.map +1 -1
  23. package/dist/channel/adapters/discord.js +106 -19
  24. package/dist/channel/adapters/discord.js.map +1 -1
  25. package/dist/channel/adapters/telegram.js +5 -3
  26. package/dist/channel/adapters/telegram.js.map +1 -1
  27. package/dist/channel/agy-mcp-launcher.d.ts +2 -0
  28. package/dist/channel/agy-mcp-launcher.js +28 -0
  29. package/dist/channel/agy-mcp-launcher.js.map +1 -0
  30. package/dist/channel/mcp-server.js +6 -20
  31. package/dist/channel/mcp-server.js.map +1 -1
  32. package/dist/channel/mcp-tools.js +4 -2
  33. package/dist/channel/mcp-tools.js.map +1 -1
  34. package/dist/channel/types.d.ts +1 -1
  35. package/dist/classic-channel-manager.d.ts +40 -3
  36. package/dist/classic-channel-manager.js +218 -31
  37. package/dist/classic-channel-manager.js.map +1 -1
  38. package/dist/cli.js +148 -33
  39. package/dist/cli.js.map +1 -1
  40. package/dist/completion-install.d.ts +70 -0
  41. package/dist/completion-install.js +152 -0
  42. package/dist/completion-install.js.map +1 -0
  43. package/dist/completion.d.ts +7 -1
  44. package/dist/completion.js +14 -4
  45. package/dist/completion.js.map +1 -1
  46. package/dist/config-validator.js +38 -7
  47. package/dist/config-validator.js.map +1 -1
  48. package/dist/config.d.ts +2 -0
  49. package/dist/config.js +10 -1
  50. package/dist/config.js.map +1 -1
  51. package/dist/daemon.d.ts +173 -5
  52. package/dist/daemon.js +721 -83
  53. package/dist/daemon.js.map +1 -1
  54. package/dist/doctor.d.ts +26 -0
  55. package/dist/doctor.js +216 -0
  56. package/dist/doctor.js.map +1 -0
  57. package/dist/fleet-context.d.ts +47 -0
  58. package/dist/fleet-manager.d.ts +247 -10
  59. package/dist/fleet-manager.js +1978 -384
  60. package/dist/fleet-manager.js.map +1 -1
  61. package/dist/fleet-yaml-slim.d.ts +10 -0
  62. package/dist/fleet-yaml-slim.js +59 -0
  63. package/dist/fleet-yaml-slim.js.map +1 -0
  64. package/dist/general-knowledge/skills/backend-providers/SKILL.md +114 -0
  65. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +3 -1
  66. package/dist/general-knowledge/skills/delegation-playbook/SKILL.md +52 -0
  67. package/dist/general-knowledge/skills/development-workflow/SKILL.md +28 -0
  68. package/dist/general-knowledge/skills/fleet-config/SKILL.md +1 -0
  69. package/dist/general-knowledge/skills/fleet-health/SKILL.md +1 -0
  70. package/dist/general-knowledge/skills/fleet-restart/SKILL.md +1 -0
  71. package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +1 -0
  72. package/dist/general-knowledge/skills/model-discovery/SKILL.md +64 -16
  73. package/dist/general-knowledge/skills/multi-channel/SKILL.md +1 -0
  74. package/dist/general-knowledge/skills/scheduling/SKILL.md +1 -0
  75. package/dist/general-knowledge/skills/session-management/SKILL.md +1 -0
  76. package/dist/general-knowledge/skills/tui-effort/SKILL.md +1 -0
  77. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +30 -0
  78. package/dist/instance-lifecycle.d.ts +28 -0
  79. package/dist/instance-lifecycle.js +79 -5
  80. package/dist/instance-lifecycle.js.map +1 -1
  81. package/dist/instructions.d.ts +12 -0
  82. package/dist/instructions.js +35 -1
  83. package/dist/instructions.js.map +1 -1
  84. package/dist/locale.js +746 -288
  85. package/dist/locale.js.map +1 -1
  86. package/dist/login-flows.d.ts +85 -0
  87. package/dist/login-flows.js +159 -0
  88. package/dist/login-flows.js.map +1 -0
  89. package/dist/login-manager.d.ts +63 -0
  90. package/dist/login-manager.js +134 -0
  91. package/dist/login-manager.js.map +1 -0
  92. package/dist/outbound-handlers.d.ts +8 -0
  93. package/dist/outbound-handlers.js +44 -5
  94. package/dist/outbound-handlers.js.map +1 -1
  95. package/dist/outbound-schemas.d.ts +5 -0
  96. package/dist/outbound-schemas.js +7 -0
  97. package/dist/outbound-schemas.js.map +1 -1
  98. package/dist/quickstart.js +25 -0
  99. package/dist/quickstart.js.map +1 -1
  100. package/dist/restart-progress.d.ts +2 -0
  101. package/dist/restart-progress.js +3 -0
  102. package/dist/restart-progress.js.map +1 -1
  103. package/dist/scheduler/db.d.ts +12 -0
  104. package/dist/scheduler/db.js +59 -0
  105. package/dist/scheduler/db.js.map +1 -1
  106. package/dist/service-installer.d.ts +11 -0
  107. package/dist/service-installer.js +84 -18
  108. package/dist/service-installer.js.map +1 -1
  109. package/dist/settings-api.js +1 -1
  110. package/dist/settings-api.js.map +1 -1
  111. package/dist/setup-wizard.js +2 -2
  112. package/dist/setup-wizard.js.map +1 -1
  113. package/dist/tips.d.ts +44 -0
  114. package/dist/tips.js +355 -0
  115. package/dist/tips.js.map +1 -0
  116. package/dist/tmux-manager.d.ts +6 -0
  117. package/dist/tmux-manager.js +12 -0
  118. package/dist/tmux-manager.js.map +1 -1
  119. package/dist/tool-progress.d.ts +40 -0
  120. package/dist/tool-progress.js +289 -0
  121. package/dist/tool-progress.js.map +1 -0
  122. package/dist/topic-commands.d.ts +36 -4
  123. package/dist/topic-commands.js +322 -64
  124. package/dist/topic-commands.js.map +1 -1
  125. package/dist/transcript-monitor.d.ts +15 -2
  126. package/dist/transcript-monitor.js +63 -17
  127. package/dist/transcript-monitor.js.map +1 -1
  128. package/dist/transcript-sources.d.ts +131 -0
  129. package/dist/transcript-sources.js +580 -0
  130. package/dist/transcript-sources.js.map +1 -0
  131. package/dist/types.d.ts +11 -0
  132. package/dist/ui/dashboard.html +55 -32
  133. package/dist/ui/settings.html +120 -51
  134. package/dist/ui/view.html +23 -15
  135. package/dist/usage/usage-api.d.ts +8 -2
  136. package/dist/usage/usage-api.js +24 -3
  137. package/dist/usage/usage-api.js.map +1 -1
  138. package/dist/workflow-templates/default.md +2 -1
  139. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -19,6 +19,8 @@ import { getUpdateSelector, lookupTargetVersion, reportUpdateRestart, shouldSkip
19
19
  import { clearUpdateMarker, markUpdateInProgress, setUpdateProgressStage } from "./update-marker.js";
20
20
  import { acquireFleetLock, releaseProcessFleetLock, setProcessFleetLock } from "./fleet-lock.js";
21
21
  import { SYSTEMD_RESTART_TIMEOUT_MS } from "./service-installer.js";
22
+ import { loadRawFleetConfig } from "./config.js";
23
+ import { setLocale, t } from "./locale.js";
22
24
  /** Prefix tmux args with -L when socket isolation is active. */
23
25
  function tmuxArgs(args) {
24
26
  const socket = getTmuxSocketName();
@@ -28,6 +30,14 @@ const __filename = fileURLToPath(import.meta.url);
28
30
  const __dirname = dirname(__filename);
29
31
  const DATA_DIR = getAgendHome();
30
32
  const FLEET_CONFIG_PATH = join(DATA_DIR, "fleet.yaml");
33
+ // CLI commands run outside FleetManager. Honor an explicit fleet locale while
34
+ // keeping the historical English CLI default when config is missing/unset.
35
+ try {
36
+ const configuredLocale = loadRawFleetConfig(FLEET_CONFIG_PATH).defaults?.locale;
37
+ if (configuredLocale === "en" || configuredLocale === "zh-TW")
38
+ setLocale(configuredLocale);
39
+ }
40
+ catch { /* malformed or missing config: keep the English CLI default */ }
31
41
  const program = new Command();
32
42
  function claimFleetSingleton() {
33
43
  try {
@@ -824,9 +834,18 @@ program
824
834
  if (check === "mcp") {
825
835
  await doctorMcp();
826
836
  }
827
- else {
837
+ else if (check) {
828
838
  console.log("Usage: agend doctor mcp");
829
839
  console.log(" mcp — Check fleet MCP health (IPC sockets, MCP configs, backends)");
840
+ process.exitCode = 2;
841
+ }
842
+ else {
843
+ const { inspectService } = await import("./service-installer.js");
844
+ const { collectDoctorReport, formatDoctorReport } = await import("./doctor.js");
845
+ const report = await collectDoctorReport(DATA_DIR, inspectService());
846
+ console.log(formatDoctorReport(report));
847
+ if (report.errors > 0)
848
+ process.exitCode = 1;
830
849
  }
831
850
  });
832
851
  async function doctorMcp() {
@@ -1273,7 +1292,10 @@ program
1273
1292
  if (agendPath) {
1274
1293
  try {
1275
1294
  // Use the NEW binary to install service (old binary's templates may be deleted)
1276
- const installResult = spawnSync(agendPath, ["install"], { encoding: "utf-8", timeout: 15000 });
1295
+ // `agend install` activates by default. During update the existing
1296
+ // restart stage owns stop/start and progress reporting, so only refresh
1297
+ // the service file here to avoid restarting the fleet twice.
1298
+ const installResult = spawnSync(agendPath, ["install", "--no-activate"], { encoding: "utf-8", timeout: 15000 });
1277
1299
  if (installResult.status === 0) {
1278
1300
  console.log(` ✓ Service updated`);
1279
1301
  }
@@ -1285,6 +1307,20 @@ program
1285
1307
  console.log(` ⚠ Service file update failed (non-fatal): ${e.message}`);
1286
1308
  }
1287
1309
  }
1310
+ // ── Refresh installed shell completions ──
1311
+ // The completion script embeds this version's subcommand names, so a
1312
+ // previously installed static file goes stale on update. --refresh only
1313
+ // rewrites artifacts that already exist — an update never starts
1314
+ // installing completions the user didn't ask for. Run through the NEW
1315
+ // binary so the regenerated names are the new version's.
1316
+ try {
1317
+ spawnSync(agendPath, ["completion", "install", "--refresh"], {
1318
+ encoding: "utf-8",
1319
+ timeout: 15_000,
1320
+ stdio: "ignore",
1321
+ });
1322
+ }
1323
+ catch { /* cosmetic — never block an update on completion refresh */ }
1288
1324
  // ── Restart fleet ──
1289
1325
  // Run the restart through the NEWLY-INSTALLED binary (agendPath), not inline.
1290
1326
  // The inline restart would execute the OLD binary's code — exactly the logic
@@ -1332,8 +1368,9 @@ program
1332
1368
  // === Install/Uninstall ===
1333
1369
  program
1334
1370
  .command("install")
1335
- .description("Install as system service")
1336
- .option("--activate", "Stop manual fleet and load the service immediately")
1371
+ .description(t("install.description"))
1372
+ .option("--activate", "Deprecated; service activation is now the default")
1373
+ .option("--no-activate", "Write the service file without activating it")
1337
1374
  .action(async (opts) => {
1338
1375
  const { installService, activateService, detectPlatform } = await import("./service-installer.js");
1339
1376
  const execPath = process.argv[1];
@@ -1344,33 +1381,81 @@ program
1344
1381
  workingDirectory: DATA_DIR,
1345
1382
  logPath: join(DATA_DIR, "fleet.log"),
1346
1383
  });
1347
- console.log(`Service installed at: ${svcPath}`);
1348
- if (opts.activate) {
1384
+ console.log(t("install.path", svcPath));
1385
+ if (opts.activate !== false) {
1349
1386
  const pidPath = join(DATA_DIR, "fleet.pid");
1350
- activateService(svcPath, pidPath);
1351
- console.log("Service activated.");
1352
- }
1353
- else {
1354
- const plat = detectPlatform();
1355
- if (plat === "macos") {
1356
- console.log(`Run: launchctl load ${svcPath}`);
1387
+ try {
1388
+ activateService(svcPath, pidPath);
1389
+ console.log(t("install.running"));
1357
1390
  }
1358
- else {
1359
- console.log(`Run: systemctl --user enable --now com.agend.fleet`);
1391
+ catch (err) {
1392
+ console.error(t("install.start_failed", err.message));
1393
+ const plat = detectPlatform();
1394
+ if (plat === "macos") {
1395
+ console.error(`Run manually: launchctl load ${svcPath}`);
1396
+ }
1397
+ else {
1398
+ console.error("Run manually: systemctl --user daemon-reload && systemctl --user enable --now com.agend.fleet");
1399
+ }
1400
+ process.exitCode = 1;
1360
1401
  }
1361
1402
  }
1403
+ else {
1404
+ console.log(t("install.updated"));
1405
+ }
1362
1406
  });
1363
1407
  program
1364
1408
  .command("uninstall")
1365
- .description("Remove system service")
1366
- .action(async () => {
1367
- const { uninstallService } = await import("./service-installer.js");
1368
- const removed = uninstallService("com.agend.fleet");
1369
- if (removed) {
1370
- console.log("Service uninstalled");
1409
+ .description(t("uninstall.description"))
1410
+ .option("-f, --force", t("uninstall.force_help"))
1411
+ .action(async (opts) => {
1412
+ const { inspectService, isServiceRemovalConfirmed, uninstallService } = await import("./service-installer.js");
1413
+ const service = inspectService("com.agend.fleet");
1414
+ if (!service.installed) {
1415
+ console.log(t("uninstall.none"));
1416
+ return;
1371
1417
  }
1372
- else {
1373
- console.log("No service found to uninstall");
1418
+ const state = (value, yes, no) => value == null ? t("uninstall.unknown") : value ? yes : no;
1419
+ console.log(t("uninstall.found"));
1420
+ console.log(` ${t("uninstall.manager", service.manager ?? t("uninstall.unknown"))}`);
1421
+ console.log(` ${t("uninstall.path", service.path ?? t("uninstall.unknown"))}`);
1422
+ console.log(` ${t("uninstall.enabled", state(service.enabled, t("uninstall.yes"), t("uninstall.no")))}`);
1423
+ console.log(` ${t("uninstall.active", state(service.active, t("uninstall.running"), t("uninstall.inactive")))}`);
1424
+ if (!opts.force && !process.stdin.isTTY) {
1425
+ console.log(t("uninstall.non_interactive"));
1426
+ process.exitCode = 1;
1427
+ return;
1428
+ }
1429
+ if (!opts.force) {
1430
+ const { createInterface } = await import("node:readline/promises");
1431
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
1432
+ let answer = "";
1433
+ try {
1434
+ answer = await rl.question(t("uninstall.confirm"));
1435
+ }
1436
+ catch {
1437
+ console.log(t("uninstall.cancelled_force"));
1438
+ return;
1439
+ }
1440
+ finally {
1441
+ rl.close();
1442
+ }
1443
+ if (!isServiceRemovalConfirmed(answer)) {
1444
+ console.log(t("uninstall.cancelled"));
1445
+ return;
1446
+ }
1447
+ }
1448
+ try {
1449
+ if (uninstallService("com.agend.fleet")) {
1450
+ console.log(t("uninstall.removed"));
1451
+ }
1452
+ else {
1453
+ console.log(t("uninstall.none"));
1454
+ }
1455
+ }
1456
+ catch (err) {
1457
+ console.error(t("uninstall.failed", err.message));
1458
+ process.exitCode = 1;
1374
1459
  }
1375
1460
  });
1376
1461
  program
@@ -2388,29 +2473,59 @@ program
2388
2473
  });
2389
2474
  program
2390
2475
  .command("completion")
2391
- .description("Print a shell completion script (bash or zsh)")
2392
- .argument("<shell>", `Shell to generate for (${COMPLETION_SHELLS.join(", ")})`)
2476
+ .description("Print a shell completion script, or install it (bash or zsh)")
2477
+ .argument("<target>", `"install", or a shell to print for (${COMPLETION_SHELLS.join(", ")})`)
2478
+ .argument("[shell]", "with install: limit to one shell (default: detect)")
2479
+ .option("--modify-rc", "with install: authorize adding the zsh eval line to ~/.zshrc")
2480
+ .option("--refresh", "with install: only rewrite artifacts that already exist (used by agend update)")
2393
2481
  .addHelpText("after", `
2394
- Install:
2482
+ Recommended:
2483
+ agend completion install # bash: static file, no rc edit; zsh: prints what to do
2484
+ agend completion install --modify-rc # also add the zsh line to ~/.zshrc
2485
+
2486
+ Manual (fallback):
2395
2487
  bash echo 'eval "$(agend completion bash)"' >> ~/.bashrc
2396
2488
  zsh echo 'eval "$(agend completion zsh)"' >> ~/.zshrc
2397
2489
 
2398
2490
  Then reload the shell. Tab-completes instance names for \`agend attach\` and
2399
2491
  \`agend fleet start|stop|restart\`, and subcommands elsewhere.`)
2400
- .action((shell) => {
2401
- if (!COMPLETION_SHELLS.includes(shell)) {
2402
- console.error(`Unsupported shell: ${shell}. Supported: ${COMPLETION_SHELLS.join(", ")}`);
2403
- process.exit(2);
2404
- }
2492
+ .action(async (target, shellArg, opts) => {
2405
2493
  // Subcommand names come from commander itself, so the script can't drift
2406
2494
  // out of sync with the CLI the way a hardcoded list would.
2407
2495
  const fleetCmd = program.commands.find(c => c.name() === "fleet");
2408
- console.log(completionScript(shell, {
2496
+ const spec = {
2409
2497
  topLevel: program.commands.map(c => c.name()),
2410
2498
  fleetSub: fleetCmd?.commands.map(c => c.name()) ?? [],
2411
2499
  instanceCommands: ["attach"],
2412
2500
  fleetInstanceCommands: ["start", "stop", "restart"],
2413
- }));
2501
+ };
2502
+ if (target === "install") {
2503
+ const { detectShells, installCompletions } = await import("./completion-install.js");
2504
+ const { zshCompletion } = await import("./completion.js");
2505
+ if (shellArg && !COMPLETION_SHELLS.includes(shellArg)) {
2506
+ console.error(`Unsupported shell: ${shellArg}. Supported: ${COMPLETION_SHELLS.join(", ")}`);
2507
+ process.exit(2);
2508
+ }
2509
+ const shells = shellArg ? [shellArg] : detectShells();
2510
+ if (shells.length === 0) {
2511
+ console.log(" No bash or zsh detected — nothing to install.");
2512
+ return;
2513
+ }
2514
+ const results = installCompletions({ bash: completionScript("bash", spec), zshFpath: zshCompletion(spec, "fpath") }, shells, { modifyRc: opts.modifyRc, refresh: opts.refresh });
2515
+ for (const r of results) {
2516
+ if (r.status === "hint")
2517
+ console.log(` ${r.shell}: ${r.hint}`);
2518
+ else if (r.status === "skipped") { /* refresh mode, nothing was installed before */ }
2519
+ else
2520
+ console.log(` ${r.shell}: completion ${r.status}${r.path ? ` (${r.path})` : ""}`);
2521
+ }
2522
+ return;
2523
+ }
2524
+ if (!COMPLETION_SHELLS.includes(target)) {
2525
+ console.error(`Unsupported target: ${target}. Supported: install, ${COMPLETION_SHELLS.join(", ")}`);
2526
+ process.exit(2);
2527
+ }
2528
+ console.log(completionScript(target, spec));
2414
2529
  });
2415
2530
  program
2416
2531
  .command("health").description("Fleet health check — shows problems and diagnostics")