@songsid/agend 2.1.3 → 2.1.4-beta.10

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 (116) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2 -2
  3. package/README.zh-TW.md +2 -2
  4. package/dist/backend/antigravity.d.ts +1 -0
  5. package/dist/backend/antigravity.js +1 -0
  6. package/dist/backend/antigravity.js.map +1 -1
  7. package/dist/backend/claude-code.d.ts +1 -0
  8. package/dist/backend/claude-code.js +24 -2
  9. package/dist/backend/claude-code.js.map +1 -1
  10. package/dist/backend/codex.d.ts +1 -0
  11. package/dist/backend/codex.js +43 -4
  12. package/dist/backend/codex.js.map +1 -1
  13. package/dist/backend/gemini-cli.d.ts +1 -0
  14. package/dist/backend/gemini-cli.js +1 -0
  15. package/dist/backend/gemini-cli.js.map +1 -1
  16. package/dist/backend/grok.d.ts +1 -0
  17. package/dist/backend/grok.js +1 -0
  18. package/dist/backend/grok.js.map +1 -1
  19. package/dist/backend/kiro.d.ts +1 -0
  20. package/dist/backend/kiro.js +1 -0
  21. package/dist/backend/kiro.js.map +1 -1
  22. package/dist/backend/mock.d.ts +1 -0
  23. package/dist/backend/mock.js +1 -0
  24. package/dist/backend/mock.js.map +1 -1
  25. package/dist/backend/opencode.d.ts +40 -0
  26. package/dist/backend/opencode.js +83 -5
  27. package/dist/backend/opencode.js.map +1 -1
  28. package/dist/backend/types.d.ts +10 -0
  29. package/dist/backend/types.js +7 -0
  30. package/dist/backend/types.js.map +1 -1
  31. package/dist/channel/adapters/discord.js +24 -7
  32. package/dist/channel/adapters/discord.js.map +1 -1
  33. package/dist/channel/mcp-server.js +6 -20
  34. package/dist/channel/mcp-server.js.map +1 -1
  35. package/dist/channel/mcp-tools.js +1 -1
  36. package/dist/channel/mcp-tools.js.map +1 -1
  37. package/dist/channel/types.d.ts +1 -1
  38. package/dist/classic-channel-manager.d.ts +34 -3
  39. package/dist/classic-channel-manager.js +190 -31
  40. package/dist/classic-channel-manager.js.map +1 -1
  41. package/dist/cli.js +74 -23
  42. package/dist/cli.js.map +1 -1
  43. package/dist/completion-install.d.ts +70 -0
  44. package/dist/completion-install.js +152 -0
  45. package/dist/completion-install.js.map +1 -0
  46. package/dist/completion.d.ts +7 -1
  47. package/dist/completion.js +14 -4
  48. package/dist/completion.js.map +1 -1
  49. package/dist/config-validator.js +35 -7
  50. package/dist/config-validator.js.map +1 -1
  51. package/dist/config.js +1 -0
  52. package/dist/config.js.map +1 -1
  53. package/dist/daemon.d.ts +53 -9
  54. package/dist/daemon.js +222 -86
  55. package/dist/daemon.js.map +1 -1
  56. package/dist/fleet-context.d.ts +8 -0
  57. package/dist/fleet-manager.d.ts +136 -5
  58. package/dist/fleet-manager.js +1088 -316
  59. package/dist/fleet-manager.js.map +1 -1
  60. package/dist/general-knowledge/skills/backend-providers/SKILL.md +114 -0
  61. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +3 -1
  62. package/dist/general-knowledge/skills/delegation-playbook/SKILL.md +52 -0
  63. package/dist/general-knowledge/skills/development-workflow/SKILL.md +28 -0
  64. package/dist/general-knowledge/skills/fleet-config/SKILL.md +1 -0
  65. package/dist/general-knowledge/skills/fleet-health/SKILL.md +1 -0
  66. package/dist/general-knowledge/skills/fleet-restart/SKILL.md +1 -0
  67. package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +1 -0
  68. package/dist/general-knowledge/skills/model-discovery/SKILL.md +1 -0
  69. package/dist/general-knowledge/skills/multi-channel/SKILL.md +1 -0
  70. package/dist/general-knowledge/skills/scheduling/SKILL.md +1 -0
  71. package/dist/general-knowledge/skills/session-management/SKILL.md +1 -0
  72. package/dist/general-knowledge/skills/tui-effort/SKILL.md +1 -0
  73. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +30 -0
  74. package/dist/instance-lifecycle.d.ts +10 -0
  75. package/dist/instance-lifecycle.js +50 -33
  76. package/dist/instance-lifecycle.js.map +1 -1
  77. package/dist/instructions.d.ts +12 -0
  78. package/dist/instructions.js +33 -0
  79. package/dist/instructions.js.map +1 -1
  80. package/dist/locale.js +130 -0
  81. package/dist/locale.js.map +1 -1
  82. package/dist/outbound-schemas.d.ts +2 -1
  83. package/dist/outbound-schemas.js +1 -0
  84. package/dist/outbound-schemas.js.map +1 -1
  85. package/dist/quickstart.js +29 -2
  86. package/dist/quickstart.js.map +1 -1
  87. package/dist/restart-progress.d.ts +7 -1
  88. package/dist/restart-progress.js +27 -6
  89. package/dist/restart-progress.js.map +1 -1
  90. package/dist/setup-wizard.d.ts +4 -2
  91. package/dist/setup-wizard.js +2 -2
  92. package/dist/setup-wizard.js.map +1 -1
  93. package/dist/tool-progress.d.ts +40 -0
  94. package/dist/tool-progress.js +289 -0
  95. package/dist/tool-progress.js.map +1 -0
  96. package/dist/topic-commands.d.ts +26 -0
  97. package/dist/topic-commands.js +117 -1
  98. package/dist/topic-commands.js.map +1 -1
  99. package/dist/transcript-monitor.d.ts +15 -2
  100. package/dist/transcript-monitor.js +63 -17
  101. package/dist/transcript-monitor.js.map +1 -1
  102. package/dist/transcript-sources.d.ts +106 -0
  103. package/dist/transcript-sources.js +428 -0
  104. package/dist/transcript-sources.js.map +1 -0
  105. package/dist/types.d.ts +8 -0
  106. package/dist/ui/dashboard.html +5 -4
  107. package/dist/update-marker.d.ts +30 -0
  108. package/dist/update-marker.js +71 -20
  109. package/dist/update-marker.js.map +1 -1
  110. package/dist/update-progress.d.ts +6 -0
  111. package/dist/update-progress.js +29 -0
  112. package/dist/update-progress.js.map +1 -0
  113. package/dist/web-api.js +2 -2
  114. package/dist/web-api.js.map +1 -1
  115. package/dist/workflow-templates/default.md +2 -1
  116. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -16,7 +16,7 @@ import { hasPausedMarker } from "./pause-marker.js";
16
16
  import { clampContextPercent, parseContextPercent } from "./context-percent.js";
17
17
  import { COMPLETION_SHELLS, completionScript } from "./completion.js";
18
18
  import { getUpdateSelector, lookupTargetVersion, reportUpdateRestart, shouldSkipUpdate, } from "./update-check.js";
19
- import { clearUpdateMarker, markUpdateInProgress } from "./update-marker.js";
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
22
  /** Prefix tmux args with -L when socket isolation is active. */
@@ -598,20 +598,19 @@ const backend = program.command("backend").description("Backend diagnostics");
598
598
  backend
599
599
  .command("doctor")
600
600
  .description("Check backend prerequisites and configuration")
601
- .argument("[backend]", "Backend to check (claude-code, codex, gemini-cli, opencode, kiro-cli)", "claude-code")
601
+ .argument("[backend]", "Backend to check (claude-code, codex, opencode, kiro-cli, antigravity, grok, gemini-cli [deprecated])", "claude-code")
602
602
  .action(async (backendName) => {
603
- const backends = {
604
- "claude-code": { binary: "claude", label: "Claude Code", install: "npm i -g @anthropic-ai/claude-code", auth: "claude (OAuth) or ANTHROPIC_API_KEY" },
605
- "codex": { binary: "codex", label: "OpenAI Codex", install: "npm i -g @openai/codex", auth: "OPENAI_API_KEY" },
606
- "gemini-cli": { binary: "gemini", label: "Gemini CLI", install: "npm i -g @google/gemini-cli", auth: "gemini (Google OAuth)" },
607
- "opencode": { binary: "opencode", label: "OpenCode", install: "go install github.com/opencode-ai/opencode@latest", auth: "Configure provider API key" },
608
- "kiro-cli": { binary: "kiro-cli", label: "Kiro CLI", install: "brew install --cask kiro-cli", auth: "kiro-cli login (AWS Builder ID)" },
609
- };
610
- const info = backends[backendName];
603
+ // Single source of truth for backend metadata — a hand-copied list here is
604
+ // how the doctor previously drifted (missing antigravity/grok entirely).
605
+ const { BACKENDS } = await import("./setup-wizard.js");
606
+ const info = BACKENDS.find(b => b.id === backendName);
611
607
  if (!info) {
612
- console.error(`Unknown backend: ${backendName}. Available: ${Object.keys(backends).join(", ")}`);
608
+ console.error(`Unknown backend: ${backendName}. Available: ${BACKENDS.map(b => b.id).join(", ")}`);
613
609
  process.exit(1);
614
610
  }
611
+ if (info.deprecated) {
612
+ console.warn(`⚠️ ${info.label} is deprecated (stops 2026-06-18). Consider switching to backend: antigravity`);
613
+ }
615
614
  let issues = 0;
616
615
  const ok = (msg) => console.log(` \x1b[32m✓\x1b[0m ${msg}`);
617
616
  const fail = (msg) => { issues++; console.log(` \x1b[31m✗\x1b[0m ${msg}`); };
@@ -1158,6 +1157,7 @@ program
1158
1157
  const targetVersion = lookupTargetVersion(tag);
1159
1158
  if (shouldSkipUpdate(pkgVersion, targetVersion, opts.force)) {
1160
1159
  console.log(`\n ✓ Already up to date (v${pkgVersion})\n`);
1160
+ setUpdateProgressStage(DATA_DIR, "complete", { version: pkgVersion });
1161
1161
  return;
1162
1162
  }
1163
1163
  if (targetVersion) {
@@ -1174,10 +1174,13 @@ program
1174
1174
  // dies here does not silence real alerts.
1175
1175
  markUpdateInProgress(DATA_DIR);
1176
1176
  const failUpdate = (message) => {
1177
- clearUpdateMarker(DATA_DIR);
1177
+ if (!setUpdateProgressStage(DATA_DIR, "failed", { error: message.trim() })) {
1178
+ clearUpdateMarker(DATA_DIR);
1179
+ }
1178
1180
  console.error(message);
1179
1181
  process.exit(1);
1180
1182
  };
1183
+ setUpdateProgressStage(DATA_DIR, "downloading");
1181
1184
  // Detect and remove stale npm link (local build that shadows global install)
1182
1185
  try {
1183
1186
  const agendPath = execSync("which agend", { encoding: "utf-8", stdio: "pipe" }).trim();
@@ -1265,6 +1268,7 @@ program
1265
1268
  }
1266
1269
  const newVersion = (verifyResult.stdout ?? "").trim();
1267
1270
  console.log(` ✓ Installed: ${newVersion}`);
1271
+ setUpdateProgressStage(DATA_DIR, "installed", { version: newVersion.replace(/^v/, "") });
1268
1272
  // ── Update service file ──
1269
1273
  if (agendPath) {
1270
1274
  try {
@@ -1281,6 +1285,20 @@ program
1281
1285
  console.log(` ⚠ Service file update failed (non-fatal): ${e.message}`);
1282
1286
  }
1283
1287
  }
1288
+ // ── Refresh installed shell completions ──
1289
+ // The completion script embeds this version's subcommand names, so a
1290
+ // previously installed static file goes stale on update. --refresh only
1291
+ // rewrites artifacts that already exist — an update never starts
1292
+ // installing completions the user didn't ask for. Run through the NEW
1293
+ // binary so the regenerated names are the new version's.
1294
+ try {
1295
+ spawnSync(agendPath, ["completion", "install", "--refresh"], {
1296
+ encoding: "utf-8",
1297
+ timeout: 15_000,
1298
+ stdio: "ignore",
1299
+ });
1300
+ }
1301
+ catch { /* cosmetic — never block an update on completion refresh */ }
1284
1302
  // ── Restart fleet ──
1285
1303
  // Run the restart through the NEWLY-INSTALLED binary (agendPath), not inline.
1286
1304
  // The inline restart would execute the OLD binary's code — exactly the logic
@@ -1288,6 +1306,7 @@ program
1288
1306
  // restart` (new binary) does the 4-environment service detection (system
1289
1307
  // systemd → user systemd → launchd → detached pid).
1290
1308
  console.log(" Restarting fleet...");
1309
+ setUpdateProgressStage(DATA_DIR, "stopping", { version: newVersion.replace(/^v/, "") });
1291
1310
  // `agend restart` may synchronously wait for a Type=notify service to finish
1292
1311
  // a multi-minute stop/start and send READY=1. Keep this parent wrapper alive
1293
1312
  // longer than the restart command's own bounded wait.
@@ -1299,7 +1318,9 @@ program
1299
1318
  if (!reportUpdateRestart(restartResult.status)) {
1300
1319
  // No new fleet is coming up to clear the marker — do it here, or the next
1301
1320
  // 15 minutes of genuine crashes would go unreported.
1302
- clearUpdateMarker(DATA_DIR);
1321
+ if (!setUpdateProgressStage(DATA_DIR, "failed", { error: "fleet restart failed" })) {
1322
+ clearUpdateMarker(DATA_DIR);
1323
+ }
1303
1324
  process.exitCode = 1;
1304
1325
  }
1305
1326
  });
@@ -2381,29 +2402,59 @@ program
2381
2402
  });
2382
2403
  program
2383
2404
  .command("completion")
2384
- .description("Print a shell completion script (bash or zsh)")
2385
- .argument("<shell>", `Shell to generate for (${COMPLETION_SHELLS.join(", ")})`)
2405
+ .description("Print a shell completion script, or install it (bash or zsh)")
2406
+ .argument("<target>", `"install", or a shell to print for (${COMPLETION_SHELLS.join(", ")})`)
2407
+ .argument("[shell]", "with install: limit to one shell (default: detect)")
2408
+ .option("--modify-rc", "with install: authorize adding the zsh eval line to ~/.zshrc")
2409
+ .option("--refresh", "with install: only rewrite artifacts that already exist (used by agend update)")
2386
2410
  .addHelpText("after", `
2387
- Install:
2411
+ Recommended:
2412
+ agend completion install # bash: static file, no rc edit; zsh: prints what to do
2413
+ agend completion install --modify-rc # also add the zsh line to ~/.zshrc
2414
+
2415
+ Manual (fallback):
2388
2416
  bash echo 'eval "$(agend completion bash)"' >> ~/.bashrc
2389
2417
  zsh echo 'eval "$(agend completion zsh)"' >> ~/.zshrc
2390
2418
 
2391
2419
  Then reload the shell. Tab-completes instance names for \`agend attach\` and
2392
2420
  \`agend fleet start|stop|restart\`, and subcommands elsewhere.`)
2393
- .action((shell) => {
2394
- if (!COMPLETION_SHELLS.includes(shell)) {
2395
- console.error(`Unsupported shell: ${shell}. Supported: ${COMPLETION_SHELLS.join(", ")}`);
2396
- process.exit(2);
2397
- }
2421
+ .action(async (target, shellArg, opts) => {
2398
2422
  // Subcommand names come from commander itself, so the script can't drift
2399
2423
  // out of sync with the CLI the way a hardcoded list would.
2400
2424
  const fleetCmd = program.commands.find(c => c.name() === "fleet");
2401
- console.log(completionScript(shell, {
2425
+ const spec = {
2402
2426
  topLevel: program.commands.map(c => c.name()),
2403
2427
  fleetSub: fleetCmd?.commands.map(c => c.name()) ?? [],
2404
2428
  instanceCommands: ["attach"],
2405
2429
  fleetInstanceCommands: ["start", "stop", "restart"],
2406
- }));
2430
+ };
2431
+ if (target === "install") {
2432
+ const { detectShells, installCompletions } = await import("./completion-install.js");
2433
+ const { zshCompletion } = await import("./completion.js");
2434
+ if (shellArg && !COMPLETION_SHELLS.includes(shellArg)) {
2435
+ console.error(`Unsupported shell: ${shellArg}. Supported: ${COMPLETION_SHELLS.join(", ")}`);
2436
+ process.exit(2);
2437
+ }
2438
+ const shells = shellArg ? [shellArg] : detectShells();
2439
+ if (shells.length === 0) {
2440
+ console.log(" No bash or zsh detected — nothing to install.");
2441
+ return;
2442
+ }
2443
+ const results = installCompletions({ bash: completionScript("bash", spec), zshFpath: zshCompletion(spec, "fpath") }, shells, { modifyRc: opts.modifyRc, refresh: opts.refresh });
2444
+ for (const r of results) {
2445
+ if (r.status === "hint")
2446
+ console.log(` ${r.shell}: ${r.hint}`);
2447
+ else if (r.status === "skipped") { /* refresh mode, nothing was installed before */ }
2448
+ else
2449
+ console.log(` ${r.shell}: completion ${r.status}${r.path ? ` (${r.path})` : ""}`);
2450
+ }
2451
+ return;
2452
+ }
2453
+ if (!COMPLETION_SHELLS.includes(target)) {
2454
+ console.error(`Unsupported target: ${target}. Supported: install, ${COMPLETION_SHELLS.join(", ")}`);
2455
+ process.exit(2);
2456
+ }
2457
+ console.log(completionScript(target, spec));
2407
2458
  });
2408
2459
  program
2409
2460
  .command("health").description("Fleet health check — shows problems and diagnostics")