talon-agent 3.33.4 → 3.34.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 (98) hide show
  1. package/package.json +5 -2
  2. package/src/app.ts +16 -8
  3. package/src/backend/claude-sdk/handler.ts +428 -415
  4. package/src/backend/claude-sdk/stream.ts +76 -53
  5. package/src/backend/codex/handler/message.ts +275 -366
  6. package/src/backend/codex/handler/rollout-accounting.ts +137 -0
  7. package/src/backend/openai-agents/handler/message.ts +282 -356
  8. package/src/backend/remote-server/chat-turn.ts +66 -122
  9. package/src/backend/remote-server/index.ts +4 -0
  10. package/src/backend/remote-server/mcp.ts +73 -9
  11. package/src/backend/remote-server/model-catalog/presentation.ts +269 -228
  12. package/src/backend/remote-server/sessions.ts +2 -2
  13. package/src/backend/remote-server/turn.ts +58 -55
  14. package/src/backend/shared/cache-telemetry.ts +17 -1
  15. package/src/backend/shared/handler-to-events.ts +11 -16
  16. package/src/backend/shared/index.ts +14 -15
  17. package/src/backend/shared/result-events.ts +30 -0
  18. package/src/backend/shared/turn-phases.ts +277 -0
  19. package/src/bootstrap.ts +120 -79
  20. package/src/cli/setup.ts +375 -349
  21. package/src/core/background/cron-spec.ts +273 -0
  22. package/src/core/background/heartbeat/agent.ts +167 -104
  23. package/src/core/background/triggers/exit.ts +19 -2
  24. package/src/core/background/triggers/resume.ts +14 -7
  25. package/src/core/background/triggers/state.ts +9 -0
  26. package/src/core/engine/backend-controller/pool.ts +2 -0
  27. package/src/core/engine/backend-controller/state.ts +25 -12
  28. package/src/core/engine/gateway-actions/cron.ts +28 -292
  29. package/src/core/engine/gateway-routes.ts +239 -0
  30. package/src/core/engine/gateway.ts +66 -238
  31. package/src/core/mcp-hub/child-transport.ts +215 -0
  32. package/src/core/mcp-hub/children.ts +72 -13
  33. package/src/core/mcp-hub/index.ts +32 -13
  34. package/src/core/models/active-model.ts +29 -6
  35. package/src/core/vfs/mounts/files.ts +128 -115
  36. package/src/core/weaver/shuttle.ts +33 -2
  37. package/src/core/weaver/weaver.ts +37 -6
  38. package/src/frontend/discord/callbacks/components/agent-buttons.ts +82 -0
  39. package/src/frontend/discord/callbacks/components/backend-select.ts +149 -0
  40. package/src/frontend/discord/callbacks/components/effort.ts +72 -0
  41. package/src/frontend/discord/callbacks/components/index.ts +120 -0
  42. package/src/frontend/discord/callbacks/components/metrics.ts +24 -0
  43. package/src/frontend/discord/callbacks/components/model-nav.ts +93 -0
  44. package/src/frontend/discord/callbacks/components/model-select.ts +118 -0
  45. package/src/frontend/discord/callbacks/components/model.ts +33 -0
  46. package/src/frontend/discord/callbacks/components/pulse.ts +93 -0
  47. package/src/frontend/discord/callbacks/components/settings.ts +243 -0
  48. package/src/frontend/discord/callbacks/components/types.ts +34 -0
  49. package/src/frontend/discord/callbacks/index.ts +4 -4
  50. package/src/frontend/discord/connection.ts +36 -0
  51. package/src/frontend/discord/diagnostics.ts +62 -0
  52. package/src/frontend/discord/guild-policy.ts +89 -0
  53. package/src/frontend/discord/index.ts +44 -305
  54. package/src/frontend/discord/outbound.ts +61 -0
  55. package/src/frontend/discord/ready.ts +73 -0
  56. package/src/frontend/discord/runtime.ts +55 -0
  57. package/src/frontend/native/chat-lifecycle.ts +39 -0
  58. package/src/frontend/native/chat-wire.ts +69 -0
  59. package/src/frontend/native/context.ts +106 -0
  60. package/src/frontend/native/control.ts +78 -0
  61. package/src/frontend/native/emit.ts +167 -0
  62. package/src/frontend/native/empty-chat-sweep.ts +50 -0
  63. package/src/frontend/native/handlers.ts +121 -0
  64. package/src/frontend/native/history.ts +101 -0
  65. package/src/frontend/native/index.ts +90 -1293
  66. package/src/frontend/native/media.ts +43 -0
  67. package/src/frontend/native/models.ts +221 -0
  68. package/src/frontend/native/queue.ts +47 -0
  69. package/src/frontend/native/reset.ts +50 -0
  70. package/src/frontend/native/routes/chats.ts +115 -0
  71. package/src/frontend/native/routes/daemon.ts +70 -0
  72. package/src/frontend/native/routes/host.ts +151 -0
  73. package/src/frontend/native/routes/index.ts +22 -0
  74. package/src/frontend/native/routes/mesh.ts +72 -0
  75. package/src/frontend/native/routes/models.ts +54 -0
  76. package/src/frontend/native/routes/params.ts +29 -0
  77. package/src/frontend/native/routes/pre-auth.ts +94 -0
  78. package/src/frontend/native/routes/table.ts +92 -0
  79. package/src/frontend/native/runtime.ts +109 -0
  80. package/src/frontend/native/server.ts +30 -555
  81. package/src/frontend/native/status.ts +26 -0
  82. package/src/frontend/native/tool-result.ts +48 -0
  83. package/src/frontend/native/turn.ts +341 -0
  84. package/src/frontend/telegram/admin.ts +75 -52
  85. package/src/frontend/whatsapp/access.ts +67 -0
  86. package/src/frontend/whatsapp/connection.ts +280 -0
  87. package/src/frontend/whatsapp/inbound.ts +327 -0
  88. package/src/frontend/whatsapp/index.ts +28 -599
  89. package/src/frontend/whatsapp/runtime.ts +74 -0
  90. package/src/storage/metrics.ts +18 -0
  91. package/src/storage/session-record.ts +29 -0
  92. package/src/storage/sessions.ts +24 -0
  93. package/src/storage/trigger-store.ts +8 -0
  94. package/src/util/boot-timer.ts +31 -0
  95. package/src/util/concurrency.ts +28 -0
  96. package/src/util/watchdog.ts +32 -7
  97. package/src/frontend/discord/callbacks/components.ts +0 -793
  98. package/src/frontend/discord/callbacks/shared.ts +0 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "talon-agent",
3
- "version": "3.33.4",
3
+ "version": "3.34.1",
4
4
  "description": "Multi-frontend AI agent with full tool access, streaming, cron jobs, and plugin system",
5
5
  "author": "Dylan Neve",
6
6
  "license": "MIT",
@@ -83,6 +83,7 @@
83
83
  "lint": "oxlint src/",
84
84
  "depcruise": "node scripts/check-architecture.mjs",
85
85
  "ratchets": "node scripts/check-ratchets.mjs",
86
+ "function-size": "node scripts/check-function-size.mjs",
86
87
  "knip": "knip",
87
88
  "format": "prettier --write src/ prompts/",
88
89
  "format:check": "prettier --check src/ prompts/",
@@ -119,6 +120,7 @@
119
120
  "discord.js": "^14.16.3",
120
121
  "file-type": "^22.0.1",
121
122
  "grammy": "^1.45.1",
123
+ "link-preview-js": "^5.0.0",
122
124
  "liquidjs": "^10.27.0",
123
125
  "marked": "^18.0.0",
124
126
  "mem0ai": "^3.0.13",
@@ -154,6 +156,7 @@
154
156
  "overrides": {
155
157
  "@anthropic-ai/sdk": "^0.104.1",
156
158
  "ip-address": "^10.1.1",
157
- "fast-uri": "^3.1.2"
159
+ "fast-uri": "^3.1.2",
160
+ "link-preview-js": "^5.0.0"
158
161
  }
159
162
  }
package/src/app.ts CHANGED
@@ -27,6 +27,7 @@ import { pruneSettledTriggers } from "./storage/trigger-store.js";
27
27
  import { startWatchdog, stopWatchdog } from "./util/watchdog.js";
28
28
  import { spawnSuccessor } from "./util/respawn.js";
29
29
  import { log, logError, logWarn } from "./util/log.js";
30
+ import { bootPhase, bootReport } from "./util/boot-timer.js";
30
31
  import {
31
32
  getVfs,
32
33
  mountNamespaceFs,
@@ -51,7 +52,7 @@ import {
51
52
  removePidRecordIfOwnedBy,
52
53
  } from "./core/daemon/pidfile.js";
53
54
 
54
- const { config } = await bootstrap();
55
+ const { config } = await bootPhase("bootstrap", () => bootstrap());
55
56
 
56
57
  // Record this process as the daemon. The gateway port is appended once
57
58
  // the gateway binds (it may fall back from the default on EADDRINUSE).
@@ -69,15 +70,19 @@ gateway.onShutdownRequest((reason) => void gracefulShutdown(reason));
69
70
  const configuredFrontends = [...new Set(getFrontends(config))];
70
71
 
71
72
  const frontends: Frontend[] = [];
72
- for (const name of configuredFrontends) {
73
- const frontend = await createFrontendById(name, config, gateway);
74
- frontends.push(frontend);
75
- log("bot", `Frontend: ${getFrontendDescriptor(name)?.label ?? name}`);
76
- }
73
+ await bootPhase("frontends create", async () => {
74
+ for (const name of configuredFrontends) {
75
+ const frontend = await createFrontendById(name, config, gateway);
76
+ frontends.push(frontend);
77
+ log("bot", `Frontend: ${getFrontendDescriptor(name)?.label ?? name}`);
78
+ }
79
+ });
77
80
 
78
81
  // ── Create backend + wire dispatcher ─────────────────────────────────────────
79
82
 
80
- const { backend } = await initBackendAndDispatcher(config, frontends);
83
+ const { backend } = await bootPhase("backend + dispatcher", () =>
84
+ initBackendAndDispatcher(config, frontends),
85
+ );
81
86
  gateway.backend = backend;
82
87
 
83
88
  // Subscribe the gateway to chat-role rebinds so `/model`, `/settings`,
@@ -303,7 +308,10 @@ async function main(): Promise<void> {
303
308
  "Terminal frontend shares stdin with the other frontends; it will run alongside them without blocking startup.",
304
309
  );
305
310
  }
306
- await Promise.all(blockingFrontends.map((frontend) => frontend.start()));
311
+ await bootPhase("frontends start", () =>
312
+ Promise.all(blockingFrontends.map((frontend) => frontend.start())),
313
+ );
314
+ log("bot", `Ready in ${bootReport()}`);
307
315
  for (const frontend of stdinFrontends) {
308
316
  void frontend
309
317
  .start()