@songsid/agend 2.3.0-beta.10 → 2.3.0-beta.12

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 (63) hide show
  1. package/dist/agent-whats-new.js +14 -9
  2. package/dist/agent-whats-new.js.map +1 -1
  3. package/dist/channel/adapters/discord-client-retirement.d.ts +5 -0
  4. package/dist/channel/adapters/discord-client-retirement.js +57 -0
  5. package/dist/channel/adapters/discord-client-retirement.js.map +1 -0
  6. package/dist/channel/adapters/discord.d.ts +2 -0
  7. package/dist/channel/adapters/discord.js +14 -4
  8. package/dist/channel/adapters/discord.js.map +1 -1
  9. package/dist/cli.js +12 -79
  10. package/dist/cli.js.map +1 -1
  11. package/dist/daemon.d.ts +3 -0
  12. package/dist/daemon.js +25 -0
  13. package/dist/daemon.js.map +1 -1
  14. package/dist/fleet-manager.d.ts +8 -1
  15. package/dist/fleet-manager.js +101 -33
  16. package/dist/fleet-manager.js.map +1 -1
  17. package/dist/fleet-process-handlers.d.ts +18 -0
  18. package/dist/fleet-process-handlers.js +69 -0
  19. package/dist/fleet-process-handlers.js.map +1 -0
  20. package/dist/general-knowledge/skills/web-appearance/SKILL.md +1 -1
  21. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +8 -2
  22. package/dist/instance-lifecycle.d.ts +2 -0
  23. package/dist/instance-lifecycle.js +11 -6
  24. package/dist/instance-lifecycle.js.map +1 -1
  25. package/dist/outbound-schemas.js +1 -1
  26. package/dist/outbound-schemas.js.map +1 -1
  27. package/dist/settings-api.d.ts +4 -0
  28. package/dist/settings-api.js +23 -0
  29. package/dist/settings-api.js.map +1 -1
  30. package/dist/ui/app-effects.js +13 -1
  31. package/dist/ui/chat-render.js +16 -1
  32. package/dist/ui/chat-store.js +32 -10
  33. package/dist/ui/chat-strings.js +16 -0
  34. package/dist/ui/chat-thread.js +14 -1
  35. package/dist/ui/panel-chat.js +57 -9
  36. package/dist/ui/panel-fleet.js +2 -1
  37. package/dist/ui/panel-settings.js +24 -0
  38. package/dist/ui/settings-strings.js +2 -0
  39. package/dist/ui/shared/app-i18n.js +1 -1
  40. package/dist/ui/shared/app-route.js +18 -0
  41. package/dist/ui/shared/app-shell.js +17 -18
  42. package/dist/ui/shared/app.css +1 -1
  43. package/dist/ui/shared/effect-owner-source.js +8 -1
  44. package/dist/ui/shared/effect-registry.js +10 -2
  45. package/dist/ui/shared/owner-css.js +30 -1
  46. package/dist/web-api.d.ts +6 -2
  47. package/dist/web-api.js +50 -14
  48. package/dist/web-api.js.map +1 -1
  49. package/dist/web-chat-history.d.ts +4 -0
  50. package/dist/web-chat-history.js +7 -2
  51. package/dist/web-chat-history.js.map +1 -1
  52. package/dist/web-image-meta.d.ts +13 -0
  53. package/dist/web-image-meta.js +62 -0
  54. package/dist/web-image-meta.js.map +1 -1
  55. package/dist/web-owner-css-store.d.ts +43 -1
  56. package/dist/web-owner-css-store.js +65 -9
  57. package/dist/web-owner-css-store.js.map +1 -1
  58. package/dist/web-settings-tools.js +7 -4
  59. package/dist/web-settings-tools.js.map +1 -1
  60. package/dist/web-upload.d.ts +13 -0
  61. package/dist/web-upload.js +39 -3
  62. package/dist/web-upload.js.map +1 -1
  63. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import "./node-warnings.js";
3
+ import { installFleetProcessHandlers } from "./fleet-process-handlers.js";
3
4
  import { applyNetworkReliabilityDefaults } from "./network-family.js";
4
5
  // Preserve Node's dual-stack Happy Eyeballs behavior, but avoid its 250ms
5
6
  // premature-connect failure on WSL/VPN/high-load hosts (#658).
@@ -275,67 +276,16 @@ fleet
275
276
  // without these a Ctrl-C or `systemctl stop` in that window got Node's default
276
277
  // behaviour: instant death with fleet.pid already written, databases unclosed,
277
278
  // and every tmux window orphaned.
278
- let stopping = false;
279
- const shutdown = async () => {
280
- if (stopping)
281
- return; // SIGINT and SIGTERM share this, and crash paths call stopAll too
282
- stopping = true;
283
- console.log("\nStopping fleet...");
284
- // stopAll fences new profile requests synchronously, before it awaits
285
- // the shared owner's stop/save. Stopping the env handle first would leave
286
- // the manager open to replacing that closed owner during the save.
287
- await fm.stopAll().catch(err => console.error("Shutdown error:", err));
288
- process.exit(0);
289
- };
290
- process.on("SIGINT", shutdown);
291
- process.on("SIGTERM", () => {
292
- // The restart that interrupted a fleet used to leave no trace of who asked.
293
- console.log(describeSignalSource(DATA_DIR, "SIGTERM"));
294
- void shutdown();
295
- });
296
- process.on("uncaughtException", (err) => {
297
- // An uncaught exception leaves unknown state — still the one case worth
298
- // tearing down for.
299
- console.error("Uncaught exception:", err);
300
- if (stopping)
301
- return;
302
- stopping = true;
303
- fm.stopAll().catch(() => { }).finally(() => process.exit(1));
304
- });
305
- process.on("unhandledRejection", (err) => {
306
- const msg = err instanceof Error ? err.message : String(err);
307
- // 409 = another bot poller exists — the adapter retries, don't crash.
308
- if (msg.includes("409") && msg.includes("getUpdates")) {
309
- console.error("Bot polling conflict (409) — retrying...");
310
- return;
311
- }
312
- // Do NOT take the fleet down. A rejected promise in one instance's tmux
313
- // call, health tick, or model switch used to stop every other working
314
- // instance and exit(1) — the widest blast radius in the process. The
315
- // per-instance health check and crash recovery handle a genuinely broken
316
- // instance on their own.
317
- //
318
- // Surviving quietly would be its own failure mode, so this reports to the
319
- // General topic as well as the log: the operator must not have to read
320
- // daemon.log to learn the fleet swallowed a fault. notifyFleetError()
321
- // throttles repeats, since these usually arrive from a loop.
322
- console.error("Unhandled rejection (fleet continues):", err);
323
- if (err instanceof Error && err.stack)
324
- console.error(err.stack);
325
- try {
326
- fm.notifyFleetError(`⚠️ Fleet caught an unhandled error and kept running:\n\`${msg}\`\nSee daemon.log for the stack trace.`);
327
- }
328
- catch (notifyErr) {
329
- // Never let the reporting path itself become an unhandled rejection.
330
- console.error("Failed to report unhandled rejection:", notifyErr);
331
- }
279
+ const handlers = installFleetProcessHandlers({
280
+ dataDir: DATA_DIR, manager: fm, runtime: process, console,
281
+ describeSignal: () => describeSignalSource(DATA_DIR, "SIGTERM"),
332
282
  });
333
283
  await fm.startCpuProfileControl().catch(err => console.warn(`Local profile control unavailable: ${String(err)}`));
334
284
  await fm.startSettingsConfirmationControl().catch(err => console.warn(`Local Settings confirmation unavailable: ${String(err)}`));
335
- if (stopping)
285
+ if (handlers.stopping)
336
286
  return;
337
287
  cpuProfile = await fm.startEnvironmentCpuProfile();
338
- if (stopping) {
288
+ if (handlers.stopping) {
339
289
  await cpuProfile?.stop("startup superseded by shutdown");
340
290
  return;
341
291
  }
@@ -559,31 +509,14 @@ fleet
559
509
  return;
560
510
  const { FleetManager } = await import("./fleet-manager.js");
561
511
  const fm = new FleetManager(DATA_DIR);
512
+ const handlers = installFleetProcessHandlers({
513
+ dataDir: DATA_DIR, manager: fm, runtime: process, console,
514
+ describeSignal: () => describeSignalSource(DATA_DIR, "SIGTERM"),
515
+ });
516
+ if (handlers.stopping)
517
+ return;
562
518
  await fm.startAll(FLEET_CONFIG_PATH);
563
519
  console.log("Fleet restarted with new code");
564
- // Keep process alive (same as fleet start)
565
- const shutdown = async () => {
566
- console.log("\nStopping fleet...");
567
- await fm.stopAll();
568
- process.exit(0);
569
- };
570
- process.on("SIGINT", shutdown);
571
- process.on("SIGTERM", shutdown);
572
- process.on("uncaughtException", async (err) => {
573
- console.error("Uncaught exception:", err);
574
- await fm.stopAll().catch(() => { });
575
- process.exit(1);
576
- });
577
- process.on("unhandledRejection", async (err) => {
578
- const msg = err instanceof Error ? err.message : String(err);
579
- if (msg.includes("409") && msg.includes("getUpdates")) {
580
- console.error("Bot polling conflict (409) — retrying...");
581
- return;
582
- }
583
- console.error("Unhandled rejection:", err);
584
- await fm.stopAll().catch(() => { });
585
- process.exit(1);
586
- });
587
520
  }
588
521
  else {
589
522
  // Instance-only restart (existing behavior)