talon-agent 5.18.1 → 5.19.0

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 (194) hide show
  1. package/LICENSE +202 -21
  2. package/LICENSE-MIT +21 -0
  3. package/NOTICE +16 -0
  4. package/README.md +8 -3
  5. package/package.json +4 -2
  6. package/prompts/system/agent-brief.md +20 -3
  7. package/src/app.ts +13 -0
  8. package/src/backend/claude-sdk/handler.ts +4 -4
  9. package/src/backend/claude-sdk/mcp-ready.ts +16 -2
  10. package/src/backend/claude-sdk/stream.ts +2 -2
  11. package/src/backend/codex/auth.ts +1 -1
  12. package/src/backend/codex/handler/message.ts +11 -11
  13. package/src/backend/codex/init.ts +4 -9
  14. package/src/backend/codex/mcp-config.ts +1 -2
  15. package/src/backend/codex/oauth-incompat.ts +8 -4
  16. package/src/backend/codex/one-shot.ts +1 -1
  17. package/src/backend/openai-agents/builtins.ts +55 -27
  18. package/src/backend/openai-agents/factory.ts +3 -3
  19. package/src/backend/openai-agents/handler/message.ts +3 -5
  20. package/src/backend/openai-agents/mcp-pool.ts +10 -27
  21. package/src/backend/remote-server/chat-turn.ts +6 -6
  22. package/src/backend/remote-server/events.ts +1 -5
  23. package/src/backend/remote-server/index.ts +0 -1
  24. package/src/backend/remote-server/messages.ts +3 -7
  25. package/src/backend/remote-server/one-shot.ts +1 -3
  26. package/src/backend/remote-server/session-helpers.ts +1 -4
  27. package/src/backend/remote-server/sse-stream.ts +8 -9
  28. package/src/backend/runtime/metrics.ts +7 -13
  29. package/src/backend/runtime/sleep.ts +1 -2
  30. package/src/backend/runtime/turn/handle-retry.ts +48 -2
  31. package/src/backend/runtime/turn/handler-to-events.ts +3 -4
  32. package/src/bootstrap.ts +9 -1
  33. package/src/cli/doctor.ts +3 -0
  34. package/src/cli/index.ts +8 -10
  35. package/src/cli/logs.ts +148 -9
  36. package/src/cli/setup.ts +9 -11
  37. package/src/cli/status.ts +29 -0
  38. package/src/core/agent-runtime/README.md +5 -19
  39. package/src/core/agent-runtime/events.ts +3 -39
  40. package/src/core/agent-runtime/model-ref.ts +0 -8
  41. package/src/core/agents/registry.ts +49 -2
  42. package/src/core/auth/expiry-monitor.ts +9 -1
  43. package/src/core/auth/login-flow.ts +9 -1
  44. package/src/core/auth/status.ts +31 -3
  45. package/src/core/background/cron/scheduler.ts +25 -5
  46. package/src/core/background/dream/index.ts +29 -10
  47. package/src/core/background/failure-backoff.ts +30 -0
  48. package/src/core/background/heartbeat/agent.ts +2 -27
  49. package/src/core/background/heartbeat/index.ts +0 -2
  50. package/src/core/background/heartbeat/scheduler.ts +21 -13
  51. package/src/core/background/heartbeat/state.ts +10 -2
  52. package/src/core/background/isolated-agent.ts +6 -2
  53. package/src/core/background/pulse/pulse.ts +9 -0
  54. package/src/core/background/triggers/exit.ts +54 -0
  55. package/src/core/background/triggers/index.ts +1 -3
  56. package/src/core/background/triggers/resume.ts +2 -4
  57. package/src/core/backup/archive/tar.ts +14 -4
  58. package/src/core/backup/restore.ts +21 -13
  59. package/src/core/backup/scheduler.ts +28 -9
  60. package/src/core/backup/snapshot.ts +43 -10
  61. package/src/core/backup/store.ts +7 -19
  62. package/src/core/backup/targets.ts +69 -17
  63. package/src/core/config/index.ts +14 -0
  64. package/src/core/daemon/crash-marker.ts +141 -0
  65. package/src/core/daemon/crash.ts +9 -2
  66. package/src/core/daemon/handoff.ts +15 -0
  67. package/src/core/daemon/health-alerts.ts +297 -0
  68. package/src/core/daemon/log-reader.ts +289 -0
  69. package/src/core/doctor/index.ts +18 -2
  70. package/src/core/doctor/logs.ts +124 -0
  71. package/src/core/doctor/types.ts +1 -1
  72. package/src/core/engine/backend-controller/index.ts +1 -13
  73. package/src/core/engine/backend-router/router.ts +1 -1
  74. package/src/core/engine/dispatcher.ts +55 -2
  75. package/src/core/engine/fault-text.ts +40 -0
  76. package/src/core/engine/gateway-actions/agents/index.ts +3 -2
  77. package/src/core/engine/gateway-actions/agents/report.ts +62 -0
  78. package/src/core/engine/gateway-actions/history.ts +2 -4
  79. package/src/core/engine/gateway-actions/native/exec.ts +13 -16
  80. package/src/core/engine/gateway.ts +60 -1
  81. package/src/core/engine/turn-health.ts +222 -0
  82. package/src/core/errors.ts +2 -2
  83. package/src/core/frontend-runtime/admin-notify.ts +1 -1
  84. package/src/core/frontend-runtime/alerts.ts +130 -0
  85. package/src/core/mcp-hub/children.ts +78 -29
  86. package/src/core/mcp-hub/index.ts +21 -18
  87. package/src/core/mcp-hub/proxy-server.ts +8 -4
  88. package/src/core/mcp-hub/talon-server.ts +5 -12
  89. package/src/core/mesh/credentials/store.ts +16 -1
  90. package/src/core/mesh/devices/service.ts +26 -15
  91. package/src/core/mesh/devices/teleport.ts +14 -2
  92. package/src/core/mesh/links/node-binaries.ts +13 -6
  93. package/src/core/mesh/persist.ts +22 -10
  94. package/src/core/mesh/transfers/device-files.ts +5 -23
  95. package/src/core/mesh/transfers/transfers.ts +16 -3
  96. package/src/core/models/active-model.ts +2 -55
  97. package/src/core/plugin/actions.ts +19 -20
  98. package/src/core/plugin/builtins.ts +80 -90
  99. package/src/core/plugin/index.ts +1 -4
  100. package/src/core/plugin/loader.ts +25 -33
  101. package/src/core/plugin/mcp.ts +3 -5
  102. package/src/core/plugin/registry.ts +19 -35
  103. package/src/core/plugin/types.ts +2 -5
  104. package/src/core/prompt/assemble.ts +15 -3
  105. package/src/core/scripts/lua.ts +6 -2
  106. package/src/core/tasks/table.ts +8 -2
  107. package/src/core/tools/bridge.ts +2 -4
  108. package/src/core/tools/chat/cross-send.ts +1 -1
  109. package/src/core/tools/chat/messaging.ts +1 -1
  110. package/src/core/tools/index.ts +2 -2
  111. package/src/core/tools/mcp-env.ts +2 -59
  112. package/src/core/tools/ops/agents.ts +22 -1
  113. package/src/core/tools/schemas.ts +4 -9
  114. package/src/core/vfs/fusefs.ts +0 -5
  115. package/src/core/vfs/index.ts +9 -2
  116. package/src/core/vfs/mounts/diagnostics.ts +109 -0
  117. package/src/core/vfs/mounts/proc.ts +17 -1
  118. package/src/core/vfs/workspace.ts +7 -3
  119. package/src/core/weaver/shuttle.ts +8 -1
  120. package/src/core/weaver/turn-log.ts +320 -0
  121. package/src/core/weaver/weaver.ts +48 -5
  122. package/src/frontend/discord/actions/index.ts +8 -1
  123. package/src/frontend/discord/diagnostics.ts +82 -6
  124. package/src/frontend/discord/handlers/index.ts +0 -2
  125. package/src/frontend/discord/middleware.ts +7 -13
  126. package/src/frontend/discord/runtime.ts +1 -3
  127. package/src/frontend/health/delivery.ts +115 -0
  128. package/src/frontend/health/outage.ts +116 -0
  129. package/src/frontend/native/bridge/routes/chats.ts +3 -5
  130. package/src/frontend/native/bridge/server.ts +106 -21
  131. package/src/frontend/native/index.ts +1 -1
  132. package/src/frontend/native/media/media.ts +5 -1
  133. package/src/frontend/native/runtime.ts +12 -7
  134. package/src/frontend/native/surface/handlers.ts +1 -1
  135. package/src/frontend/native/surface/memory.ts +1 -1
  136. package/src/frontend/native/surface/models.ts +3 -3
  137. package/src/frontend/native/surface/settings.ts +20 -8
  138. package/src/frontend/native/turn/context.ts +6 -8
  139. package/src/frontend/native/turn/turn-meta.ts +2 -5
  140. package/src/frontend/native/turn/turn.ts +8 -10
  141. package/src/frontend/presentation/format.ts +2 -4
  142. package/src/frontend/presentation/session-status.ts +2 -6
  143. package/src/frontend/teams/actions.ts +8 -1
  144. package/src/frontend/teams/graph.ts +0 -1
  145. package/src/frontend/teams/index.ts +1 -4
  146. package/src/frontend/teams/poll.ts +40 -2
  147. package/src/frontend/teams/runtime.ts +14 -5
  148. package/src/frontend/telegram/actions/index.ts +4 -1
  149. package/src/frontend/telegram/actions/outgoing-log.ts +70 -0
  150. package/src/frontend/telegram/actions/send.ts +12 -0
  151. package/src/frontend/telegram/handlers/context.ts +13 -2
  152. package/src/frontend/telegram/handlers/delivery.ts +12 -9
  153. package/src/frontend/telegram/handlers/index.ts +0 -2
  154. package/src/frontend/telegram/index.ts +35 -9
  155. package/src/frontend/telegram/polling/poll-health.ts +110 -0
  156. package/src/frontend/telegram/userbot.ts +147 -41
  157. package/src/frontend/terminal/builtins/session.ts +2 -2
  158. package/src/frontend/terminal/index.ts +1 -3
  159. package/src/frontend/terminal/renderer.ts +2 -18
  160. package/src/frontend/whatsapp/actions/index.ts +12 -1
  161. package/src/frontend/whatsapp/actions/messaging.ts +7 -2
  162. package/src/frontend/whatsapp/connection/connection.ts +29 -9
  163. package/src/frontend/whatsapp/connection/health.ts +89 -0
  164. package/src/frontend/whatsapp/connection/identity.ts +4 -4
  165. package/src/frontend/whatsapp/runtime.ts +11 -5
  166. package/src/native/blake3.ts +28 -2
  167. package/src/native/fusefs.ts +23 -5
  168. package/src/native/registry.ts +1 -1
  169. package/src/native/warden.ts +33 -5
  170. package/src/plugins/github/index.ts +0 -1
  171. package/src/plugins/mempalace/index.ts +9 -3
  172. package/src/plugins/playwright/index.ts +2 -4
  173. package/src/plugins/playwright/provision.ts +12 -4
  174. package/src/storage/chat-settings.ts +6 -1
  175. package/src/storage/cron.ts +29 -4
  176. package/src/storage/daily-log.ts +43 -47
  177. package/src/storage/db.ts +61 -33
  178. package/src/storage/history.ts +6 -1
  179. package/src/storage/journal.ts +9 -2
  180. package/src/storage/kv.ts +19 -6
  181. package/src/storage/media-index.ts +28 -6
  182. package/src/storage/repositories/chat-settings-repo.ts +8 -2
  183. package/src/storage/repositories/sessions-repo.ts +10 -3
  184. package/src/storage/scripts.ts +24 -13
  185. package/src/storage/sessions.ts +11 -2
  186. package/src/storage/skills.ts +21 -2
  187. package/src/storage/stickers.ts +17 -3
  188. package/src/storage/triggers.ts +8 -3
  189. package/src/storage/turn-meta.ts +25 -7
  190. package/src/util/log.ts +189 -6
  191. package/src/util/logging/turn-scope.ts +85 -0
  192. package/src/util/time.ts +3 -3
  193. package/src/util/watchdog.ts +30 -0
  194. package/src/core/engine/backend-controller/legacy.ts +0 -111
package/LICENSE CHANGED
@@ -1,21 +1,202 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 The Falconry
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/LICENSE-MIT ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 The Falconry
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/NOTICE ADDED
@@ -0,0 +1,16 @@
1
+ Talon
2
+ Copyright 2026 The Falconry
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (see LICENSE).
5
+
6
+ Prior licensing
7
+ ---------------
8
+ Every release up to and including v5.18.1 was published under the MIT
9
+ License, preserved verbatim in LICENSE-MIT. That grant is irrevocable: anyone
10
+ who received those versions keeps their MIT rights to them, and the
11
+ contributions made under it remain available on those terms.
12
+
13
+ The relicensing relies on the MIT License's own permission to sublicense, so
14
+ the earlier contributions are redistributed here under Apache-2.0 with the
15
+ original MIT notice retained. Contributions made from this release onward are
16
+ licensed under Apache-2.0 per section 5 of that licence.
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  [![TypeScript](https://img.shields.io/badge/TypeScript-7.0-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
10
10
  [![Frontends](https://img.shields.io/badge/frontends-Telegram_%7C_WhatsApp_%7C_Discord_%7C_Teams_%7C_Terminal_%7C_App-25D366)](#frontends)
11
11
  [![Backends](https://img.shields.io/badge/backends-Claude_%7C_Kilo_%7C_OpenCode_%7C_Codex_%7C_Antigravity_%7C_OpenAI_Agents-D97706)](#backends)
12
- [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
12
+ [![License: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
13
13
  [![CI](https://github.com/thefalconry/talon/actions/workflows/ci.yml/badge.svg)](https://github.com/thefalconry/talon/actions/workflows/ci.yml)
14
14
 
15
15
  Multi-platform agentic AI harness. Runs on **Telegram**, **WhatsApp**, **Discord**, **Microsoft Teams**, the **Terminal**, and a **cross-platform Desktop/Mobile companion app** (Flutter), with a pluggable backend (**Claude Agent SDK**, **Kilo**, **OpenCode**, **Codex**, **Antigravity**, or **OpenAI Agents**) and full tool access through MCP.
@@ -203,7 +203,7 @@ The WhatsApp frontend drives a real WhatsApp account over Baileys multi-device
203
203
  // The bot account's own number, E.164 digits, no "+". Omit for QR pairing.
204
204
  "pairingNumber": "353871234567",
205
205
  // Who may DM it — bare numbers or full JIDs. Empty disables DMs.
206
- "allowedJids": ["353834733284"],
206
+ "allowedJids": ["447700900102"],
207
207
  // Which groups it serves: "listed" | "with-allowed-user" | "all"
208
208
  "groupPolicy": "with-allowed-user",
209
209
  // In groups: reply only when mentioned/quoted, or to everything
@@ -487,6 +487,7 @@ Config file: `~/.talon/config.json`
487
487
  | `heartbeatIntervalMinutes` | `60` | Heartbeat interval |
488
488
  | `heartbeatModel` | --- | Model for the heartbeat agent (falls back to `model`) |
489
489
  | `heartbeatEffort` | --- | Reasoning effort for the heartbeat agent: `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`. Unset = the model's own default |
490
+ | `alerts` | on | Operator alerts to the admin chat — full disk, crash, error spike, dead frontend — once per fault per cooldown, plus a recovery notice: `{ "enabled": true, "cooldownMinutes": 30 }`. Active alerts also show in `talon status` |
490
491
  | `router` | --- | Plan-aware routing for background work: `{ "enabled": true, "ceilingPercent": 85 }`. Unpinned sub-agents, cron `query` jobs and heartbeats run on whichever backend has the most plan headroom, skipping any whose tightest window is at or above the ceiling. `enabled: false` restores inherit-the-caller's-backend ([Backends](docs/backends.md)) |
491
492
  | `backendBudgets` | --- | Soft token budgets for backends with no usage API, e.g. `{ "openai-agents": { "tokensPer5h": 2000000, "tokensPerDay": 8000000 } }`. Talon's own rolling ledger is measured against these so such a backend still has a headroom signal — and it is what opts an idle backend into routing. `agy` reports its real quota windows (via `agy -p /usage`); a budget there is only a fallback for when that read fails |
492
493
  | `dreamModel` | --- | Model for dream / memory consolidation (falls back to `model`) |
@@ -610,4 +611,8 @@ smoke-tests the CLI and the MCP supervisor from it.
610
611
 
611
612
  ## License
612
613
 
613
- MIT
614
+ Apache License 2.0 — see [LICENSE](LICENSE).
615
+
616
+ Releases up to and including v5.18.1 were published under the MIT License,
617
+ kept at [LICENSE-MIT](LICENSE-MIT). That grant is irrevocable for those
618
+ versions and still covers the contributions made under it — see [NOTICE](NOTICE).
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "talon-agent",
3
- "version": "5.18.1",
3
+ "version": "5.19.0",
4
4
  "description": "Multi-frontend AI agent with full tool access, streaming, cron jobs, and plugin system",
5
5
  "author": "The Falconry",
6
- "license": "MIT",
6
+ "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "https://github.com/thefalconry/talon.git"
@@ -52,6 +52,8 @@
52
52
  "src/login.ts",
53
53
  "prompts/",
54
54
  "README.md",
55
+ "NOTICE",
56
+ "LICENSE-MIT",
55
57
  "tsconfig.json"
56
58
  ],
57
59
  "scripts": {
@@ -19,14 +19,31 @@ a useful result; silence is not.
19
19
 
20
20
  ## Talking to your parent
21
21
 
22
- - `check_inbox()` drains any instructions your parent has sent you. Check it
23
- at natural milestones — after a phase of work, before a long operation, and
24
- before you report. Messages are not delivered to you any other way.
22
+ - `check_inbox()` drains anything sent to you — instructions from your parent
23
+ and notes from peers. Each message names its sender. Check it at natural
24
+ milestones: after a phase of work, before a long operation, and before you
25
+ report. Messages are not delivered to you any other way.
25
26
  - `message_parent(text)` sends an interim note (a finding worth acting on now,
26
27
  a question, a heads-up that this will take a while). Use it sparingly: each
27
28
  one wakes your parent. It does **not** end your run and does **not** count
28
29
  as your result.
29
30
 
31
+ ## Talking to your peers
32
+
33
+ Your parent may have spawned others alongside you. `list_peers()` shows them —
34
+ id, label, and what each was asked to do — and `message_peer(agent_id, text)`
35
+ sends one of them a note directly, without going through your parent.
36
+
37
+ Use it when something you found changes _their_ work and waiting would waste
38
+ it: a fact you both need, a dead end worth not repeating, a correction to
39
+ something you told them earlier. Don't narrate your progress at them — a peer
40
+ pays for every message with context it could have spent on its own job.
41
+
42
+ You can only address peers, and they see your note at their next
43
+ `check_inbox`, so it is not an interrupt. Your report still goes to your
44
+ parent: peer messages are for coordination, never a substitute for
45
+ `report_result`.
46
+
30
47
  ## Delegating further
31
48
 
32
49
  {% if canSpawn %}You may spawn your own sub-agents with `spawn_agent` (current depth {{depth}}, cap {{maxDepth}}) when the work genuinely splits into independent pieces. You are then responsible for them: `wait_for_agent`, `send_to_agent`, `kill_agent`, and folding their reports into yours.{% else %}You are at the maximum sub-agent depth ({{maxDepth}}) — `spawn_agent` will be refused. Do this work yourself.{% endif %}
package/src/app.ts CHANGED
@@ -42,6 +42,12 @@ import {
42
42
  handleUncaughtException,
43
43
  handleUnhandledRejection,
44
44
  } from "./core/daemon/crash.js";
45
+ import { writeCrashMarker } from "./core/daemon/crash-marker.js";
46
+ import {
47
+ announceLastCrash,
48
+ startHealthAlerts,
49
+ stopHealthAlerts,
50
+ } from "./core/daemon/health-alerts.js";
45
51
  import { log, logError, logWarn } from "./util/log.js";
46
52
  import { bootPhase, bootReport } from "./core/daemon/boot-timer.js";
47
53
  import {
@@ -352,6 +358,7 @@ async function gracefulShutdown(signal: string): Promise<void> {
352
358
  await shutdownStep("sub-agents", shutdownAgents);
353
359
  await shutdownStep("watchdog", stopWatchdog);
354
360
  await shutdownStep("resource sampler", stopResourceSampler);
361
+ await shutdownStep("health alerts", stopHealthAlerts);
355
362
  await shutdownStep("upload cleanup", stopUploadCleanup);
356
363
  await shutdownStep("mcp hub", async () => {
357
364
  const { shutdownHub } = await import("./core/mcp-hub/index.js");
@@ -452,6 +459,11 @@ async function main(): Promise<void> {
452
459
  await import("./core/frontend-runtime/admin-notify.js");
453
460
  await notifyAdmin(restoreReport);
454
461
  }
462
+ // Same reasoning for a crash: the process that died couldn't say so,
463
+ // so the marker it left is announced now. The probes start here too —
464
+ // an alert raised before a frontend can carry it is wasted.
465
+ announceLastCrash();
466
+ startHealthAlerts();
455
467
 
456
468
  const bootMs = Math.round(process.uptime() * 1000);
457
469
  recordBootMetrics(bootMs);
@@ -465,6 +477,7 @@ async function main(): Promise<void> {
465
477
 
466
478
  main().catch((err) => {
467
479
  crashCleanup(crashHooks);
480
+ crashStep("crash marker", () => writeCrashMarker("startup", err));
468
481
  crashStep("startup report", () =>
469
482
  logError("bot", "Fatal startup error", err),
470
483
  );
@@ -83,10 +83,10 @@ import {
83
83
  // The SDK's PostToolBatch hook is the canonical loop-terminator — it returns
84
84
  // `{ continue: false }` after `end_turn`/`send`, and the SDK is supposed to
85
85
  // emit a `result` SDKMessage and close the async iterator immediately after.
86
- // In practice (observed 2026-05-19 14:52Z, chat 352042062, contextTokens=251464,
87
- // numApiCalls=50) the SDK can emit `result` and then ghost — the for-await loop
88
- // stays parked forever, holding the dispatcher context and the typing-indicator
89
- // pulse for hours until someone manually `/restart`s.
86
+ // In practice (observed 2026-05-19 on a ~250k-token, 50-API-call turn) the
87
+ // SDK can emit `result` and then ghost — the for-await loop stays parked
88
+ // forever, holding the dispatcher context and the typing-indicator pulse for
89
+ // hours until someone manually `/restart`s.
90
90
  //
91
91
  // Workaround: arm a short timer the moment `result` is processed. If the
92
92
  // iterator hasn't closed by the grace deadline, abort the controller and
@@ -35,9 +35,11 @@ export async function waitForMcpServersReady(
35
35
  while (Date.now() < deadline) {
36
36
  let statuses;
37
37
  try {
38
- statuses = await qi.mcpServerStatus();
38
+ // Bound the call itself: a CLI that never answers the control
39
+ // request would otherwise park here past the deadline.
40
+ statuses = await beforeDeadline(qi.mcpServerStatus(), deadline);
39
41
  } catch {
40
- return; // status query unsupported/failed — don't block the turn
42
+ return; // status query unsupported/failed/timed out — don't block the turn
41
43
  }
42
44
  // Best-effort: a backend (or stub) may report status in an unexpected
43
45
  // shape (undefined / non-array). Treat anything non-iterable as
@@ -52,3 +54,15 @@ export async function waitForMcpServersReady(
52
54
  await new Promise((resolve) => setTimeout(resolve, pollMs));
53
55
  }
54
56
  }
57
+
58
+ /** `promise`, or a rejection once `deadline` (epoch ms) passes first. */
59
+ function beforeDeadline<T>(promise: Promise<T>, deadline: number): Promise<T> {
60
+ let timer: ReturnType<typeof setTimeout> | undefined;
61
+ const expired = new Promise<never>((_, reject) => {
62
+ timer = setTimeout(
63
+ () => reject(new Error("mcpServerStatus timed out")),
64
+ Math.max(0, deadline - Date.now()),
65
+ );
66
+ });
67
+ return Promise.race([promise, expired]).finally(() => clearTimeout(timer));
68
+ }
@@ -2,8 +2,8 @@
2
2
  * Typed stream processing helpers for SDK messages.
3
3
  *
4
4
  * Each function operates on a properly narrowed SDK message type —
5
- * no Record<string, unknown> casts. The StreamState accumulator
6
- * replaces the scattered local variables from the original handler.
5
+ * no Record<string, unknown> casts. StreamState is the turn's single
6
+ * accumulator.
7
7
  */
8
8
 
9
9
  import type {
@@ -302,7 +302,7 @@ export function isChatGptModelMismatchError(message: string): boolean {
302
302
 
303
303
  /**
304
304
  * Detect the *silent* OAuth-incompat exit shape — the one that hit
305
- * Pandario on 2026-05-20 at 23:13Z.
305
+ * a group chat on 2026-05-20 at 23:13Z.
306
306
  *
307
307
  * On a free ChatGPT-OAuth credential the Codex CLI silently rejects
308
308
  * most model strings (only `gpt-5.5` is verified working). Crucially,
@@ -205,17 +205,6 @@ async function maybeFallbackForChatGptMismatch(
205
205
  return await handleMessage({ ...params, model: fallbackModel }, true);
206
206
  }
207
207
 
208
- // ── Model resolution ────────────────────────────────────────────────────────
209
-
210
- /**
211
- * Codex accepts arbitrary model strings; we pass through whatever the
212
- * caller resolved (chat-settings → config) and fall back to the auth-aware
213
- * default: `gpt-5-codex` when an API key is present, `gpt-5.5` when only
214
- * ChatGPT OAuth is configured (because `gpt-5-codex` is rejected with a
215
- * 400 on ChatGPT-mode accounts). A model known to be OAuth-incompat on a
216
- * ChatGPT-OAuth account is swapped pre-emptively rather than letting the
217
- * first turn fail.
218
- */
219
208
  /**
220
209
  * The turn's user prompt: the shared framing every backend emits, plus
221
210
  * whatever this turn's memory retrieval produced. `formatUserPrompt` is
@@ -233,6 +222,17 @@ function buildTurnPrompt(params: QueryParams): string {
233
222
  });
234
223
  }
235
224
 
225
+ // ── Model resolution ────────────────────────────────────────────────────────
226
+
227
+ /**
228
+ * Codex accepts arbitrary model strings; we pass through whatever the
229
+ * caller resolved (chat-settings → config) and fall back to the auth-aware
230
+ * default: `gpt-5-codex` when an API key is present, `gpt-5.5` when only
231
+ * ChatGPT OAuth is configured (because `gpt-5-codex` is rejected with a
232
+ * 400 on ChatGPT-mode accounts). A model known to be OAuth-incompat on a
233
+ * ChatGPT-OAuth account is swapped pre-emptively rather than letting the
234
+ * first turn fail.
235
+ */
236
236
  function resolveCodexModel(chatId: string, requested: string | undefined) {
237
237
  const authInfo = getCodexAuthInfo();
238
238
  const authAwareDefault =
@@ -85,15 +85,10 @@ export function initCodexAgent(
85
85
  // credential fingerprint has changed since last load). The store is
86
86
  // a no-op for non-OAuth credentials but the loader is cheap, so we
87
87
  // call it for all modes uniformly.
88
- // Fire-and-forget: the loader keeps its async signature (historical;
89
- // kv reads are sync now) but `initCodexAgent` is sync and changing it
90
- // to async would ripple through every caller in bootstrap.ts.
91
- // The store is best-effort anyway — if a turn races with the
92
- // first load, `isKnownOAuthIncompat` defaults to false and the
93
- // turn proceeds without the runtime-learned filter (the curated
94
- // list still applies). Errors are already swallowed inside
95
- // `loadOAuthIncompatStore`, so the .catch() here is purely
96
- // defensive against a synchronous throw in the function body.
88
+ // Fire-and-forget: `initCodexAgent` is sync. The store is best-effort —
89
+ // a turn that races the first load runs without the runtime-learned
90
+ // filter (the curated list still applies). The loader swallows its own
91
+ // errors; the .catch() only guards a throw in its body.
97
92
  loadOAuthIncompatStore(computeAuthFingerprint(authInfo)).catch(() => {
98
93
  /* logged inside loadOAuthIncompatStore */
99
94
  });
@@ -12,8 +12,7 @@
12
12
  * hub (`core/mcp-hub`) — Codex connects with `mcp_servers.<name>.url`
13
13
  * (the same transport `codex mcp add --url` configures). The hub hosts
14
14
  * Talon's tools in-process and shares plugin/brave children across
15
- * chats, so Codex no longer spawns a subprocess pair per server per
16
- * turn:
15
+ * chats, so Codex spawns no MCP subprocesses of its own:
17
16
  *
18
17
  * {
19
18
  * mcp_servers: {
@@ -75,6 +75,7 @@
75
75
  * stay synchronous (they only touch the in-memory set).
76
76
  */
77
77
 
78
+ import { scryptSync } from "node:crypto";
78
79
  import { logDebug } from "../../util/log.js";
79
80
  import { files } from "../../util/paths.js";
80
81
  import { kvGet, kvSet } from "../../storage/kv.js";
@@ -118,7 +119,7 @@ let memoryStore: InMemoryStore | null = null;
118
119
  *
119
120
  * Fingerprint shape:
120
121
  * - `mode:source` for ChatGPT OAuth (no token to hash)
121
- * - `mode:source:<first 16 chars of key>` for api-key billing
122
+ * - `mode:source:<scrypt(key), 16 hex>` for api-key billing
122
123
  * - `mode:source` for missing/empty
123
124
  *
124
125
  * Constant-folded by `mode === "none"` — no learning happens without
@@ -127,9 +128,12 @@ let memoryStore: InMemoryStore | null = null;
127
128
  export function computeAuthFingerprint(info: CodexAuthInfo): string {
128
129
  const base = `${info.mode}:${info.source}`;
129
130
  if (info.mode === "api-key" && info.apiKey) {
130
- // First 16 chars is enough to distinguish keys for fingerprint
131
- // purposes without storing the full secret on disk.
132
- return `${base}:${info.apiKey.slice(0, 16)}`;
131
+ // A digest, never key material: the fingerprint is persisted in kv
132
+ // and appears in debug logs.
133
+ // scrypt, not a bare hash: the input is a credential. Computed once
134
+ // per codex init.
135
+ const digest = scryptSync(info.apiKey, "talon.codex.fingerprint", 8);
136
+ return `${base}:${digest.toString("hex")}`;
133
137
  }
134
138
  return base;
135
139
  }
@@ -40,7 +40,7 @@ import { toCodexReasoningEffort } from "./effort.js";
40
40
  * `config.heartbeatModel ?? config.model`. If that's an OAuth-incompat
41
41
  * id (curated `apiKeyOnly: true` or runtime-learned) AND the active
42
42
  * Codex credential is ChatGPT OAuth, swap to `gpt-5.5` to avoid the
43
- * silent exit-1 failure mode that hit Pandario on 2026-05-20 23:13Z.
43
+ * silent exit-1 failure mode that hit a group chat on 2026-05-20 23:13Z.
44
44
  *
45
45
  * Returns the resolved model id, whether a swap occurred, and an
46
46
  * optional reason string for the run log.