@songsid/agend 2.1.10 → 2.1.11-beta.1

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 (107) hide show
  1. package/dist/backend/antigravity.js +3 -2
  2. package/dist/backend/antigravity.js.map +1 -1
  3. package/dist/backend/claude-code.d.ts +7 -0
  4. package/dist/backend/claude-code.js +107 -3
  5. package/dist/backend/claude-code.js.map +1 -1
  6. package/dist/backend/cli-env-probe-worker.js +2 -10
  7. package/dist/backend/cli-env-probe-worker.js.map +1 -1
  8. package/dist/backend/cli-env-probe.d.ts +14 -0
  9. package/dist/backend/cli-env-probe.js +13 -0
  10. package/dist/backend/cli-env-probe.js.map +1 -0
  11. package/dist/backend/codex-metadata.d.ts +14 -0
  12. package/dist/backend/codex-metadata.js +70 -0
  13. package/dist/backend/codex-metadata.js.map +1 -0
  14. package/dist/backend/codex.d.ts +1 -2
  15. package/dist/backend/codex.js +112 -65
  16. package/dist/backend/codex.js.map +1 -1
  17. package/dist/backend/effort-metadata.d.ts +32 -0
  18. package/dist/backend/effort-metadata.js +21 -0
  19. package/dist/backend/effort-metadata.js.map +1 -0
  20. package/dist/backend/grok.js +3 -2
  21. package/dist/backend/grok.js.map +1 -1
  22. package/dist/backend/kiro.d.ts +3 -0
  23. package/dist/backend/kiro.js +19 -4
  24. package/dist/backend/kiro.js.map +1 -1
  25. package/dist/backend/muse.js +3 -2
  26. package/dist/backend/muse.js.map +1 -1
  27. package/dist/backend/opencode.d.ts +31 -4
  28. package/dist/backend/opencode.js +66 -23
  29. package/dist/backend/opencode.js.map +1 -1
  30. package/dist/backend/types.d.ts +14 -1
  31. package/dist/backend/types.js.map +1 -1
  32. package/dist/channel/adapters/discord.js +10 -2
  33. package/dist/channel/adapters/discord.js.map +1 -1
  34. package/dist/cli.js +48 -6
  35. package/dist/cli.js.map +1 -1
  36. package/dist/config.js +1 -0
  37. package/dist/config.js.map +1 -1
  38. package/dist/daemon.d.ts +24 -0
  39. package/dist/daemon.js +109 -12
  40. package/dist/daemon.js.map +1 -1
  41. package/dist/doctor.d.ts +3 -1
  42. package/dist/doctor.js +11 -0
  43. package/dist/doctor.js.map +1 -1
  44. package/dist/fleet-context.d.ts +2 -2
  45. package/dist/fleet-control-audit.d.ts +83 -0
  46. package/dist/fleet-control-audit.js +195 -0
  47. package/dist/fleet-control-audit.js.map +1 -0
  48. package/dist/fleet-manager.d.ts +45 -35
  49. package/dist/fleet-manager.js +327 -384
  50. package/dist/fleet-manager.js.map +1 -1
  51. package/dist/full-restart.js +2 -1
  52. package/dist/full-restart.js.map +1 -1
  53. package/dist/general-knowledge/skills/fleet-config/SKILL.md +3 -2
  54. package/dist/host-memory.d.ts +16 -0
  55. package/dist/host-memory.js +32 -0
  56. package/dist/host-memory.js.map +1 -0
  57. package/dist/instance-lifecycle.js +4 -1
  58. package/dist/instance-lifecycle.js.map +1 -1
  59. package/dist/locale.js +62 -16
  60. package/dist/locale.js.map +1 -1
  61. package/dist/log-tail.d.ts +34 -0
  62. package/dist/log-tail.js +66 -0
  63. package/dist/log-tail.js.map +1 -0
  64. package/dist/logger.d.ts +15 -0
  65. package/dist/logger.js +89 -1
  66. package/dist/logger.js.map +1 -1
  67. package/dist/login-controller.d.ts +1 -3
  68. package/dist/login-controller.js +2 -6
  69. package/dist/login-controller.js.map +1 -1
  70. package/dist/login-flows.d.ts +0 -8
  71. package/dist/login-flows.js +1 -11
  72. package/dist/login-flows.js.map +1 -1
  73. package/dist/login-manager.d.ts +5 -20
  74. package/dist/login-manager.js +0 -53
  75. package/dist/login-manager.js.map +1 -1
  76. package/dist/login-window-lock.d.ts +1 -1
  77. package/dist/login-window-lock.js +1 -1
  78. package/dist/memory-pressure.d.ts +41 -0
  79. package/dist/memory-pressure.js +117 -0
  80. package/dist/memory-pressure.js.map +1 -0
  81. package/dist/probe-worker-pool.d.ts +28 -0
  82. package/dist/probe-worker-pool.js +129 -0
  83. package/dist/probe-worker-pool.js.map +1 -0
  84. package/dist/resource-report.d.ts +31 -0
  85. package/dist/resource-report.js +209 -0
  86. package/dist/resource-report.js.map +1 -0
  87. package/dist/rollout-index.d.ts +66 -0
  88. package/dist/rollout-index.js +124 -0
  89. package/dist/rollout-index.js.map +1 -0
  90. package/dist/slash-authz.d.ts +50 -0
  91. package/dist/slash-authz.js +19 -0
  92. package/dist/slash-authz.js.map +1 -0
  93. package/dist/spawn-gate.d.ts +13 -1
  94. package/dist/spawn-gate.js +108 -39
  95. package/dist/spawn-gate.js.map +1 -1
  96. package/dist/storm-window.d.ts +42 -0
  97. package/dist/storm-window.js +84 -1
  98. package/dist/storm-window.js.map +1 -1
  99. package/dist/topic-commands.d.ts +29 -2
  100. package/dist/topic-commands.js +77 -21
  101. package/dist/topic-commands.js.map +1 -1
  102. package/dist/transcript-sources.d.ts +21 -4
  103. package/dist/transcript-sources.js +55 -41
  104. package/dist/transcript-sources.js.map +1 -1
  105. package/dist/types.d.ts +5 -1
  106. package/dist/ui/settings.html +14 -13
  107. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -17,6 +17,7 @@ import { hasPausedMarker } from "./pause-marker.js";
17
17
  import { COMPLETION_SHELLS, completionScript } from "./completion.js";
18
18
  import { getUpdateSelector, lookupTargetVersion, reportUpdateRestart, shouldSkipUpdate, runningFleetPredatesInstall, processStartMs, } from "./update-check.js";
19
19
  import { clearUpdateMarker, markUpdateInProgress, setUpdateProgressStage } from "./update-marker.js";
20
+ import { describeSignalSource, gateFleetControl, recordInstanceControl, withOrigin } from "./fleet-control-audit.js";
20
21
  import { acquireFleetLock, isFleetStartCommandLine, readProcessCommandLine, releaseProcessFleetLock, setProcessFleetLock } from "./fleet-lock.js";
21
22
  import { limitFleetCoreDumps } from "./coredump-filter.js";
22
23
  import { SYSTEMD_RESTART_TIMEOUT_MS } from "./service-installer.js";
@@ -158,7 +159,11 @@ fleet
158
159
  process.exit(0);
159
160
  };
160
161
  process.on("SIGINT", shutdown);
161
- process.on("SIGTERM", shutdown);
162
+ process.on("SIGTERM", () => {
163
+ // The restart that interrupted a fleet used to leave no trace of who asked.
164
+ console.log(describeSignalSource(DATA_DIR, "SIGTERM"));
165
+ void shutdown();
166
+ });
162
167
  process.on("uncaughtException", (err) => {
163
168
  // An uncaught exception leaves unknown state — still the one case worth
164
169
  // tearing down for.
@@ -221,7 +226,12 @@ fleet
221
226
  .command("stop")
222
227
  .description("Stop fleet or specific instance")
223
228
  .argument("[instance]", "Specific instance to stop")
224
- .action(async (instance) => {
229
+ .option("-y, --yes", "Confirm when run from a fleet agent session (this affects every instance)")
230
+ .action(async (instance, opts) => {
231
+ if (instance)
232
+ recordInstanceControl(DATA_DIR, "instance-stop", instance);
233
+ else if (!gateFleetControl(DATA_DIR, "fleet-stop", { yes: opts?.yes }))
234
+ process.exit(1);
225
235
  if (instance) {
226
236
  // Stop a single instance via the RUNNING fleet's HTTP API. Do NOT spawn a
227
237
  // detached FleetManager and call stopInstance(): its in-memory daemons map
@@ -295,11 +305,16 @@ fleet
295
305
  .description("Graceful restart: wait for instances to idle, then restart")
296
306
  .argument("[instance]", "Specific instance to restart (immediate, no idle wait)")
297
307
  .option("--reload", "Full process restart to load new code")
308
+ .option("-y, --yes", "Confirm when run from a fleet agent session (this affects every instance)")
298
309
  .action(async (instance, opts) => {
299
310
  if (instance && opts?.reload) {
300
311
  console.error("--reload restarts the entire fleet process. Cannot combine with instance name.");
301
312
  process.exit(1);
302
313
  }
314
+ if (instance)
315
+ recordInstanceControl(DATA_DIR, "instance-restart", instance);
316
+ else if (!gateFleetControl(DATA_DIR, opts?.reload ? "fleet-restart-reload" : "fleet-restart", { yes: opts?.yes }))
317
+ process.exit(1);
303
318
  if (instance) {
304
319
  // Single instance restart via fleet's HTTP API
305
320
  const { loadFleetConfig } = await import("./config.js");
@@ -446,11 +461,11 @@ fleet
446
461
  });
447
462
  fleet
448
463
  .command("status")
449
- .description("Show fleet status (alias for `agend ls`)")
464
+ .description("Show fleet status, workspace disk usage, unregistered instance directories, and host memory/swap")
450
465
  .option("--json", "Output as JSON")
451
466
  .action(async (opts) => {
452
467
  // Delegate to the `ls` command implementation
453
- await lsAction(opts);
468
+ await lsAction({ ...opts, resources: true });
454
469
  });
455
470
  fleet
456
471
  .command("logs")
@@ -1334,7 +1349,10 @@ program
1334
1349
  .option("--version <ver>", "Specific version to install")
1335
1350
  .option("--beta", "Install beta version")
1336
1351
  .option("--force", "Force reinstall and restart even when already up to date")
1352
+ .option("-y, --yes", "Confirm when run from a fleet agent session (this affects every instance)")
1337
1353
  .action(async (opts) => {
1354
+ if (!gateFleetControl(DATA_DIR, "update", { yes: opts.yes }))
1355
+ process.exit(1);
1338
1356
  const { spawnSync } = await import("node:child_process");
1339
1357
  const tag = getUpdateSelector(opts);
1340
1358
  const pkg = `@songsid/agend@${tag}`;
@@ -1350,6 +1368,9 @@ program
1350
1368
  encoding: "utf-8",
1351
1369
  timeout: SYSTEMD_RESTART_TIMEOUT_MS + 60_000,
1352
1370
  stdio: "inherit",
1371
+ // This update was already confirmed (or interactive); its own restart is
1372
+ // part of it, not a second command for the agent-session guard.
1373
+ env: withOrigin("agend-update"),
1353
1374
  });
1354
1375
  if (!reportUpdateRestart(restartResult.status)) {
1355
1376
  // No new fleet is coming up to clear the marker — do it here, or the next
@@ -1655,7 +1676,10 @@ program
1655
1676
  program
1656
1677
  .command("stop")
1657
1678
  .description("Stop the AgEnD service or detached fleet")
1658
- .action(async () => {
1679
+ .option("-y, --yes", "Confirm when run from a fleet agent session (this affects every instance)")
1680
+ .action(async (opts) => {
1681
+ if (!gateFleetControl(DATA_DIR, "stop", { yes: opts.yes }))
1682
+ process.exit(1);
1659
1683
  const { getServicePath, stopService } = await import("./service-installer.js");
1660
1684
  if (!getServicePath()) {
1661
1685
  // No service — try killing by PID
@@ -1726,7 +1750,10 @@ program
1726
1750
  program
1727
1751
  .command("restart")
1728
1752
  .description("Restart the AgEnD service (auto-detects systemd/launchd/detached)")
1729
- .action(async () => {
1753
+ .option("-y, --yes", "Confirm when run from a fleet agent session (this affects every instance)")
1754
+ .action(async (opts) => {
1755
+ if (!gateFleetControl(DATA_DIR, "restart", { yes: opts.yes }))
1756
+ process.exit(1);
1730
1757
  // Try each runtime environment in order and stop at the first that succeeds.
1731
1758
  // Don't gate on fleet.pid: a fleet under systemd/launchd writes its pid in the
1732
1759
  // service's own HOME, which may differ from what this command resolves (sudo,
@@ -2535,6 +2562,18 @@ async function lsAction(opts) {
2535
2562
  console.log(n);
2536
2563
  return;
2537
2564
  }
2565
+ // Keep the existing JSON row-array contract and the fast completion path.
2566
+ const printResources = async () => {
2567
+ if (!opts.resources || opts.json)
2568
+ return;
2569
+ try {
2570
+ const { collectResourceReport, formatResourceReport } = await import("./resource-report.js");
2571
+ console.log(formatResourceReport(await collectResourceReport(DATA_DIR)));
2572
+ }
2573
+ catch {
2574
+ console.log(t("resources.report_unknown"));
2575
+ }
2576
+ };
2538
2577
  // Load classic channels from classicBot.yaml (keyed by channelId)
2539
2578
  const classicPath = join(DATA_DIR, "classicBot.yaml");
2540
2579
  let classicConfig = null;
@@ -2565,6 +2604,7 @@ async function lsAction(opts) {
2565
2604
  }
2566
2605
  if (allNames.length === 0) {
2567
2606
  console.log("No instances configured.");
2607
+ await printResources();
2568
2608
  return;
2569
2609
  }
2570
2610
  // Resolve tmux pane PIDs for memory measurement (concurrently — one
@@ -2718,6 +2758,7 @@ async function lsAction(opts) {
2718
2758
  const totalGB = totalmem() / (1024 ** 3);
2719
2759
  const usedGB = (totalmem() - freemem()) / (1024 ** 3);
2720
2760
  console.log(`\nInstances: ${runningCount} running, ${pausedCount} paused | Fleet Mem: ${(totalMemMb / 1024).toFixed(1)} GB | System Memory: ${usedGB.toFixed(1)} / ${totalGB.toFixed(1)} GB`);
2761
+ await printResources();
2721
2762
  // #1003: a working completion nobody knew to install. Tell the person at
2722
2763
  // the terminal once per `ls` while nothing is installed — file checks only,
2723
2764
  // no shell spawned, so ls stays fast.
@@ -2732,6 +2773,7 @@ program
2732
2773
  .description("List all instances with status, backend, team, and last activity")
2733
2774
  .option("--json", "Output as JSON")
2734
2775
  .option("--names-only", "Print instance names one per line (for shell completion)")
2776
+ .option("--resources", "Also report workspace disk usage, unregistered instance directories, and host memory/swap (text only)")
2735
2777
  .action(async (opts) => {
2736
2778
  await lsAction(opts);
2737
2779
  });