@circuitwall/jarela 2.2.1 → 2.4.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 (703) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-path-routes-manifest.json +2 -1
  3. package/.next/standalone/.next/build-manifest.json +2 -2
  4. package/.next/standalone/.next/prerender-manifest.json +3 -3
  5. package/.next/standalone/.next/routes-manifest.json +8 -0
  6. package/.next/standalone/.next/server/app/_global-error/page.js +68 -68
  7. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_not-found/page.js +76 -76
  14. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/standalone/.next/server/app/_not-found.html +2 -2
  16. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  17. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  18. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  19. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  20. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  21. package/.next/standalone/.next/server/app/api/v1/access/[identity]/route.js +100 -93
  22. package/.next/standalone/.next/server/app/api/v1/access/route.js +176 -169
  23. package/.next/standalone/.next/server/app/api/v1/agents/[id]/compact/route.js +89 -56
  24. package/.next/standalone/.next/server/app/api/v1/agents/[id]/compact/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/api/v1/agents/[id]/display-filters/route.js +139 -127
  26. package/.next/standalone/.next/server/app/api/v1/agents/[id]/route.js +107 -100
  27. package/.next/standalone/.next/server/app/api/v1/agents/[id]/thread/route.js +765 -753
  28. package/.next/standalone/.next/server/app/api/v1/agents/route.js +72 -65
  29. package/.next/standalone/.next/server/app/api/v1/allowed-sites/[hostname]/route.js +371 -364
  30. package/.next/standalone/.next/server/app/api/v1/allowed-sites/route.js +809 -802
  31. package/.next/standalone/.next/server/app/api/v1/artifacts/lifecycle/route.js +9 -2
  32. package/.next/standalone/.next/server/app/api/v1/attachments/files/route.js +49 -49
  33. package/.next/standalone/.next/server/app/api/v1/attachments/images/route.js +910 -910
  34. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js +583 -16
  35. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/ignores/[remote_jid]/route.js +41 -30
  37. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/ignores/route.js +48 -37
  38. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js +697 -130
  39. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js.nft.json +1 -1
  40. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js +703 -136
  41. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js +796 -229
  43. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/routes/[route_id]/route.js +762 -746
  45. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/routes/route.js +1050 -1034
  46. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js +673 -106
  47. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/api/v1/bridges/kinds/route.js +811 -804
  49. package/.next/standalone/.next/server/app/api/v1/bridges/kinds/route.js.nft.json +1 -1
  50. package/.next/standalone/.next/server/app/api/v1/bridges/route.js +718 -706
  51. package/.next/standalone/.next/server/app/api/v1/bridges/route.js.nft.json +1 -1
  52. package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js +9 -9
  53. package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js.nft.json +1 -1
  54. package/.next/standalone/.next/server/app/api/v1/config/route.js +85 -85
  55. package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js +709 -709
  56. package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js.nft.json +1 -1
  57. package/.next/standalone/.next/server/app/api/v1/credentials/route.js +2 -2
  58. package/.next/standalone/.next/server/app/api/v1/credentials/route.js.nft.json +1 -1
  59. package/.next/standalone/.next/server/app/api/v1/dashboard/currency/route.js +10 -10
  60. package/.next/standalone/.next/server/app/api/v1/dashboard/metrics/route.js +796 -784
  61. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing/route.js +30 -23
  62. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js +86 -86
  63. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js.nft.json +1 -1
  64. package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js +57 -57
  65. package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js.nft.json +1 -1
  66. package/.next/standalone/.next/server/app/api/v1/documents/search/route.js +385 -378
  67. package/.next/standalone/.next/server/app/api/v1/documents/settings/route.js +51 -44
  68. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js +65 -65
  69. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js.nft.json +1 -1
  70. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js +122 -122
  71. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js.nft.json +1 -1
  72. package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js +37 -37
  73. package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js.nft.json +1 -1
  74. package/.next/standalone/.next/server/app/api/v1/env/route.js +9 -9
  75. package/.next/standalone/.next/server/app/api/v1/env-sync/allowlist/route.js +375 -368
  76. package/.next/standalone/.next/server/app/api/v1/env-sync/route.js +51 -44
  77. package/.next/standalone/.next/server/app/api/v1/events/route.js +745 -178
  78. package/.next/standalone/.next/server/app/api/v1/events/route.js.nft.json +1 -1
  79. package/.next/standalone/.next/server/app/api/v1/events/test/route.js +77 -77
  80. package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js +763 -763
  81. package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js.nft.json +1 -1
  82. package/.next/standalone/.next/server/app/api/v1/extension/browser/activate/route.js +51 -44
  83. package/.next/standalone/.next/server/app/api/v1/extension/browser/foreground/route.js +16 -9
  84. package/.next/standalone/.next/server/app/api/v1/extension/browser/history/route.js +72 -65
  85. package/.next/standalone/.next/server/app/api/v1/extension/browser/poll/route.js +41 -34
  86. package/.next/standalone/.next/server/app/api/v1/extension/browser/progress/route.js +211 -204
  87. package/.next/standalone/.next/server/app/api/v1/extension/browser/result/route.js +140 -133
  88. package/.next/standalone/.next/server/app/api/v1/extension/browser/retry/route.js +113 -106
  89. package/.next/standalone/.next/server/app/api/v1/extension/browser/status/route.js +121 -114
  90. package/.next/standalone/.next/server/app/api/v1/extension/browser/tabs/route.js +141 -134
  91. package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js +690 -690
  92. package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js.nft.json +1 -1
  93. package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js +93 -93
  94. package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js.nft.json +1 -1
  95. package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js +9 -9
  96. package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js.nft.json +1 -1
  97. package/.next/standalone/.next/server/app/api/v1/extensions/route.js +185 -185
  98. package/.next/standalone/.next/server/app/api/v1/extensions/route.js.nft.json +1 -1
  99. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js +171 -171
  100. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js.nft.json +1 -1
  101. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js +396 -396
  102. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js.nft.json +1 -1
  103. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js +212 -212
  104. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js.nft.json +1 -1
  105. package/.next/standalone/.next/server/app/api/v1/files/[name]/route.js +235 -235
  106. package/.next/standalone/.next/server/app/api/v1/fs/browse/route.js +26 -26
  107. package/.next/standalone/.next/server/app/api/v1/harnesses/[id]/route.js +228 -221
  108. package/.next/standalone/.next/server/app/api/v1/harnesses/default/route.js +65 -58
  109. package/.next/standalone/.next/server/app/api/v1/harnesses/route.js +79 -72
  110. package/.next/standalone/.next/server/app/api/v1/health/probes/route.js +9 -9
  111. package/.next/standalone/.next/server/app/api/v1/health/probes/route.js.nft.json +1 -1
  112. package/.next/standalone/.next/server/app/api/v1/health/route.js +783 -771
  113. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/route.js +140 -133
  114. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js +9 -9
  115. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js.nft.json +1 -1
  116. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/callback/route.js +370 -363
  117. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/start/route.js +240 -233
  118. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/status/route.js +689 -682
  119. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/callback/route.js +886 -879
  120. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/start/route.js +115 -108
  121. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/status/route.js +955 -948
  122. package/.next/standalone/.next/server/app/api/v1/integrations/route.js +223 -216
  123. package/.next/standalone/.next/server/app/api/v1/lifecycle/adoption/route.js +876 -847
  124. package/.next/standalone/.next/server/app/api/v1/lifecycle/adoption/route.js.nft.json +1 -1
  125. package/.next/standalone/.next/server/app/api/v1/local-file/route.js +26 -26
  126. package/.next/standalone/.next/server/app/api/v1/logs/route.js +70 -70
  127. package/.next/standalone/.next/server/app/api/v1/maps/embed/route.js +79 -72
  128. package/.next/standalone/.next/server/app/api/v1/mcp-servers/[name]/route.js +991 -979
  129. package/.next/standalone/.next/server/app/api/v1/mcp-servers/registry/route.js +196 -196
  130. package/.next/standalone/.next/server/app/api/v1/mcp-servers/route.js +19 -7
  131. package/.next/standalone/.next/server/app/api/v1/memory/[namespace]/[key]/route.js +539 -532
  132. package/.next/standalone/.next/server/app/api/v1/memory/policy/route.js +86 -79
  133. package/.next/standalone/.next/server/app/api/v1/memory/route.js +58 -51
  134. package/.next/standalone/.next/server/app/api/v1/memory/search/route.js +138 -131
  135. package/.next/standalone/.next/server/app/api/v1/models/[name]/compact-threads/route.js +381 -369
  136. package/.next/standalone/.next/server/app/api/v1/models/[name]/compact-threads/route.js.nft.json +1 -1
  137. package/.next/standalone/.next/server/app/api/v1/models/[name]/route.js +150 -143
  138. package/.next/standalone/.next/server/app/api/v1/models/route.js +634 -627
  139. package/.next/standalone/.next/server/app/api/v1/packages/catalog/route.js +445 -445
  140. package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js +120 -120
  141. package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js.nft.json +1 -1
  142. package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js +234 -234
  143. package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js.nft.json +1 -1
  144. package/.next/standalone/.next/server/app/api/v1/packages/install/route.js +407 -407
  145. package/.next/standalone/.next/server/app/api/v1/packages/install/route.js.nft.json +1 -1
  146. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js +37 -37
  147. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js.nft.json +1 -1
  148. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js +107 -107
  149. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js.nft.json +1 -1
  150. package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js +228 -228
  151. package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js.nft.json +1 -1
  152. package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js +9 -9
  153. package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js.nft.json +1 -1
  154. package/.next/standalone/.next/server/app/api/v1/packages/route.js +148 -148
  155. package/.next/standalone/.next/server/app/api/v1/packages/route.js.nft.json +1 -1
  156. package/.next/standalone/.next/server/app/api/v1/page-capture/route.js +787 -787
  157. package/.next/standalone/.next/server/app/api/v1/page-capture/route.js.nft.json +1 -1
  158. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js +529 -514
  159. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js.nft.json +1 -1
  160. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js +181 -181
  161. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js.nft.json +1 -1
  162. package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js +258 -258
  163. package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js.nft.json +1 -1
  164. package/.next/standalone/.next/server/app/api/v1/profile/location/route.js +37 -30
  165. package/.next/standalone/.next/server/app/api/v1/profile/route.js +171 -164
  166. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/models/route.js +51 -44
  167. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/probe/route.js +15 -8
  168. package/.next/standalone/.next/server/app/api/v1/providers/github-copilot/auth/route.js +171 -164
  169. package/.next/standalone/.next/server/app/api/v1/providers/route.js +101 -94
  170. package/.next/standalone/.next/server/app/api/v1/proxy-config/route.js +457 -450
  171. package/.next/standalone/.next/server/app/api/v1/redaction/init/route.js +44 -37
  172. package/.next/standalone/.next/server/app/api/v1/redaction/route.js +65 -58
  173. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/route.js +617 -605
  174. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js +44 -44
  175. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js.nft.json +1 -1
  176. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/route.js +739 -732
  177. package/.next/standalone/.next/server/app/api/v1/security/idle-timeout/route.js +329 -322
  178. package/.next/standalone/.next/server/app/api/v1/security/pin/route.js +204 -197
  179. package/.next/standalone/.next/server/app/api/v1/security/state/route.js +58 -51
  180. package/.next/standalone/.next/server/app/api/v1/security/unlock/route.js +183 -176
  181. package/.next/standalone/.next/server/app/api/v1/security/verify-pin/route.js +194 -187
  182. package/.next/standalone/.next/server/app/api/v1/setup/test-key/route.js +26 -26
  183. package/.next/standalone/.next/server/app/api/v1/skills/[id]/route.js +776 -769
  184. package/.next/standalone/.next/server/app/api/v1/skills/repos/[id]/route.js +122 -115
  185. package/.next/standalone/.next/server/app/api/v1/skills/repos/route.js +334 -327
  186. package/.next/standalone/.next/server/app/api/v1/skills/route.js +873 -866
  187. package/.next/standalone/.next/server/app/api/v1/system/abort/route.js +838 -808
  188. package/.next/standalone/.next/server/app/api/v1/system/restart/route.js +177 -177
  189. package/.next/standalone/.next/server/app/api/v1/system/restart/route.js.nft.json +1 -1
  190. package/.next/standalone/.next/server/app/api/v1/tailscale/route.js +164 -164
  191. package/.next/standalone/.next/server/app/api/v1/tasks/[agent_id]/route.js +122 -115
  192. package/.next/standalone/.next/server/app/api/v1/tasks/route.js +30 -23
  193. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route.js +1436 -0
  194. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route.js.nft.json +1 -0
  195. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route_client-reference-manifest.js +1 -0
  196. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/context-pin/route.js +638 -631
  197. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/context-pin/route.js.nft.json +1 -1
  198. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/route.js +60 -439
  199. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/route.js.nft.json +1 -1
  200. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js +172 -173
  201. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js.nft.json +1 -1
  202. package/.next/standalone/.next/server/app/api/v1/threads/route.js +925 -913
  203. package/.next/standalone/.next/server/app/api/v1/tools/route.js +2 -2
  204. package/.next/standalone/.next/server/app/api/v1/tools/route.js.nft.json +1 -1
  205. package/.next/standalone/.next/server/app/api/v1/update/apply/route.js +17 -17
  206. package/.next/standalone/.next/server/app/api/v1/update/apply/route.js.nft.json +1 -1
  207. package/.next/standalone/.next/server/app/api/v1/update/route.js +570 -570
  208. package/.next/standalone/.next/server/app/api/v1/voice/transcribe/route.js +241 -229
  209. package/.next/standalone/.next/server/app/api/v1/voice/tts/route.js +989 -977
  210. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/route.js +40 -28
  211. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js +72 -72
  212. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js.nft.json +1 -1
  213. package/.next/standalone/.next/server/app/api/v1/watchers/reaction-scripts/route.js +128 -128
  214. package/.next/standalone/.next/server/app/api/v1/watchers/route.js +164 -164
  215. package/.next/standalone/.next/server/app/api/v1/watchers/route.js.nft.json +1 -1
  216. package/.next/standalone/.next/server/app/icon.svg/route.js +62 -62
  217. package/.next/standalone/.next/server/app/manifest.webmanifest/route.js +436 -436
  218. package/.next/standalone/.next/server/app/page.js +1179 -743
  219. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  220. package/.next/standalone/.next/server/app/setup/page.js +99 -91
  221. package/.next/standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  222. package/.next/standalone/.next/server/app-paths-manifest.json +2 -1
  223. package/.next/standalone/.next/server/chunks/{424.js → 1388.js} +441 -1022
  224. package/.next/standalone/.next/server/chunks/1433.js +1 -1
  225. package/.next/standalone/.next/server/chunks/1638.js +1 -2
  226. package/.next/standalone/.next/server/chunks/1738.js +1 -1
  227. package/.next/standalone/.next/server/chunks/2068.js +47 -10
  228. package/.next/standalone/.next/server/chunks/210.js +3 -3
  229. package/.next/standalone/.next/server/chunks/2151.js +31 -1
  230. package/.next/standalone/.next/server/chunks/2207.js +1 -0
  231. package/.next/standalone/.next/server/chunks/2447.js +10 -5
  232. package/.next/standalone/.next/server/chunks/2471.js +45 -45
  233. package/.next/standalone/.next/server/chunks/2504.js +1 -1
  234. package/.next/standalone/.next/server/chunks/2695.js +17 -17
  235. package/.next/standalone/.next/server/chunks/3042.js +24 -16
  236. package/.next/standalone/.next/server/chunks/{4540.js → 309.js} +104 -38
  237. package/.next/standalone/.next/server/chunks/{2350.js → 3272.js} +104 -37
  238. package/.next/standalone/.next/server/chunks/3399.js +526 -526
  239. package/.next/standalone/.next/server/chunks/3524.js +150 -67
  240. package/.next/standalone/.next/server/chunks/3566.js +1 -1
  241. package/.next/standalone/.next/server/chunks/4189.js +946 -0
  242. package/.next/standalone/.next/server/chunks/4433.js +146 -146
  243. package/.next/standalone/.next/server/chunks/4508.js +3 -3
  244. package/.next/standalone/.next/server/chunks/4588.js +1 -0
  245. package/.next/standalone/.next/server/chunks/46.js +78 -28
  246. package/.next/standalone/.next/server/chunks/466.js +12 -0
  247. package/.next/standalone/.next/server/chunks/4868.js +206 -206
  248. package/.next/standalone/.next/server/chunks/4992.js +13 -0
  249. package/.next/standalone/.next/server/chunks/5120.js +963 -0
  250. package/.next/standalone/.next/server/chunks/5701.js +1 -1
  251. package/.next/standalone/.next/server/chunks/5900.js +1 -1
  252. package/.next/standalone/.next/server/chunks/5908.js +63 -42
  253. package/.next/standalone/.next/server/chunks/6142.js +10 -2
  254. package/.next/standalone/.next/server/chunks/6210.js +1 -0
  255. package/.next/standalone/.next/server/chunks/6213.js +1 -1
  256. package/.next/standalone/.next/server/chunks/6649.js +3 -3
  257. package/.next/standalone/.next/server/chunks/6703.js +3 -3
  258. package/.next/standalone/.next/server/chunks/7445.js +1 -0
  259. package/.next/standalone/.next/server/chunks/8067.js +12 -0
  260. package/.next/standalone/.next/server/chunks/8461.js +24 -17
  261. package/.next/standalone/.next/server/chunks/8558.js +1 -1
  262. package/.next/standalone/.next/server/chunks/8724.js +1 -1
  263. package/.next/standalone/.next/server/chunks/8849.js +91 -91
  264. package/.next/standalone/.next/server/chunks/9032.js +4 -3
  265. package/.next/standalone/.next/server/chunks/{2563.js → 9164.js} +33389 -31418
  266. package/.next/standalone/.next/server/chunks/9237.js +396 -396
  267. package/.next/standalone/.next/server/chunks/{9640.js → 9304.js} +1672 -575
  268. package/.next/standalone/.next/server/chunks/9406.js +1 -1
  269. package/.next/standalone/.next/server/chunks/9590.js +68 -18
  270. package/.next/standalone/.next/server/chunks/9824.js +98 -98
  271. package/.next/standalone/.next/server/chunks/9826.js +1 -0
  272. package/.next/standalone/.next/server/middleware-build-manifest.js +2 -2
  273. package/.next/standalone/.next/server/middleware.js +486 -415
  274. package/.next/standalone/.next/server/pages/404.html +2 -2
  275. package/.next/standalone/.next/server/pages/500.html +1 -1
  276. package/.next/standalone/.next/server/preview-props.json +3 -3
  277. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  278. package/.next/standalone/.next/static/chunks/{1395-a340fb0a345382a4.js → 1395-e4a99912b8f83044.js} +13 -1
  279. package/.next/standalone/.next/static/chunks/app/_global-error/{page-36cb8b428b38b26a.js → page-6fc5f8e744c81802.js} +1 -1
  280. package/.next/standalone/.next/static/chunks/app/api/v1/access/[identity]/{route-36cb8b428b38b26a.js → route-6fc5f8e744c81802.js} +1 -1
  281. package/.next/standalone/.next/static/chunks/app/api/v1/access/{route-36cb8b428b38b26a.js → route-6fc5f8e744c81802.js} +1 -1
  282. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/compact/{route-36cb8b428b38b26a.js → route-6fc5f8e744c81802.js} +1 -1
  283. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/display-filters/route-6fc5f8e744c81802.js +17 -0
  284. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/route-6fc5f8e744c81802.js +17 -0
  285. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/thread/route-6fc5f8e744c81802.js +17 -0
  286. package/.next/standalone/.next/static/chunks/app/api/v1/agents/route-6fc5f8e744c81802.js +17 -0
  287. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/[hostname]/route-6fc5f8e744c81802.js +17 -0
  288. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/route-6fc5f8e744c81802.js +17 -0
  289. package/.next/standalone/.next/static/chunks/app/api/v1/artifacts/lifecycle/route-6fc5f8e744c81802.js +17 -0
  290. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/files/route-6fc5f8e744c81802.js +17 -0
  291. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/images/route-6fc5f8e744c81802.js +17 -0
  292. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/chats/route-6fc5f8e744c81802.js +17 -0
  293. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/[remote_jid]/route-6fc5f8e744c81802.js +17 -0
  294. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/route-6fc5f8e744c81802.js +17 -0
  295. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/lookup/route-6fc5f8e744c81802.js +17 -0
  296. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/pair/route-6fc5f8e744c81802.js +17 -0
  297. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/route-6fc5f8e744c81802.js +17 -0
  298. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/[route_id]/route-6fc5f8e744c81802.js +17 -0
  299. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/route-6fc5f8e744c81802.js +17 -0
  300. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/status/route-6fc5f8e744c81802.js +17 -0
  301. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/kinds/route-6fc5f8e744c81802.js +17 -0
  302. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/route-6fc5f8e744c81802.js +17 -0
  303. package/.next/standalone/.next/static/chunks/app/api/v1/builtin-tools/route-6fc5f8e744c81802.js +17 -0
  304. package/.next/standalone/.next/static/chunks/app/api/v1/config/route-6fc5f8e744c81802.js +17 -0
  305. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/[id]/route-6fc5f8e744c81802.js +17 -0
  306. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/route-6fc5f8e744c81802.js +17 -0
  307. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/currency/route-6fc5f8e744c81802.js +17 -0
  308. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/metrics/route-6fc5f8e744c81802.js +17 -0
  309. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing/route-6fc5f8e744c81802.js +17 -0
  310. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing-task/route-6fc5f8e744c81802.js +17 -0
  311. package/.next/standalone/.next/static/chunks/app/api/v1/delegations/codex/[job_id]/route-6fc5f8e744c81802.js +17 -0
  312. package/.next/standalone/.next/static/chunks/app/api/v1/documents/search/route-6fc5f8e744c81802.js +17 -0
  313. package/.next/standalone/.next/static/chunks/app/api/v1/documents/settings/route-6fc5f8e744c81802.js +17 -0
  314. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/reindex/route-6fc5f8e744c81802.js +17 -0
  315. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/route-6fc5f8e744c81802.js +17 -0
  316. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/route-6fc5f8e744c81802.js +17 -0
  317. package/.next/standalone/.next/static/chunks/app/api/v1/env/route-6fc5f8e744c81802.js +17 -0
  318. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/allowlist/route-6fc5f8e744c81802.js +17 -0
  319. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/route-6fc5f8e744c81802.js +17 -0
  320. package/.next/standalone/.next/static/chunks/app/api/v1/events/route-6fc5f8e744c81802.js +17 -0
  321. package/.next/standalone/.next/static/chunks/app/api/v1/events/test/route-6fc5f8e744c81802.js +17 -0
  322. package/.next/standalone/.next/static/chunks/app/api/v1/extension/agents/route-6fc5f8e744c81802.js +17 -0
  323. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/activate/route-6fc5f8e744c81802.js +17 -0
  324. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/foreground/route-6fc5f8e744c81802.js +17 -0
  325. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/history/route-6fc5f8e744c81802.js +17 -0
  326. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/poll/route-6fc5f8e744c81802.js +17 -0
  327. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/progress/route-6fc5f8e744c81802.js +17 -0
  328. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/result/route-6fc5f8e744c81802.js +17 -0
  329. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/retry/route-6fc5f8e744c81802.js +17 -0
  330. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/status/route-6fc5f8e744c81802.js +17 -0
  331. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/tabs/route-6fc5f8e744c81802.js +17 -0
  332. package/.next/standalone/.next/static/chunks/app/api/v1/extension/fill/route-6fc5f8e744c81802.js +17 -0
  333. package/.next/standalone/.next/static/chunks/app/api/v1/extension/refine/route-6fc5f8e744c81802.js +17 -0
  334. package/.next/standalone/.next/static/chunks/app/api/v1/extension/turn/route-6fc5f8e744c81802.js +17 -0
  335. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/route-6fc5f8e744c81802.js +17 -0
  336. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/config/route-6fc5f8e744c81802.js +17 -0
  337. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/route-6fc5f8e744c81802.js +17 -0
  338. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/secrets/route-6fc5f8e744c81802.js +17 -0
  339. package/.next/standalone/.next/static/chunks/app/api/v1/files/[name]/route-6fc5f8e744c81802.js +17 -0
  340. package/.next/standalone/.next/static/chunks/app/api/v1/fs/browse/route-6fc5f8e744c81802.js +17 -0
  341. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/[id]/route-6fc5f8e744c81802.js +17 -0
  342. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/default/route-6fc5f8e744c81802.js +17 -0
  343. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/route-6fc5f8e744c81802.js +17 -0
  344. package/.next/standalone/.next/static/chunks/app/api/v1/health/probes/route-6fc5f8e744c81802.js +17 -0
  345. package/.next/standalone/.next/static/chunks/app/api/v1/health/route-6fc5f8e744c81802.js +17 -0
  346. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/route-6fc5f8e744c81802.js +17 -0
  347. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/test/route-6fc5f8e744c81802.js +17 -0
  348. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/callback/route-6fc5f8e744c81802.js +17 -0
  349. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/start/route-6fc5f8e744c81802.js +17 -0
  350. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/status/route-6fc5f8e744c81802.js +17 -0
  351. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/callback/route-6fc5f8e744c81802.js +17 -0
  352. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/start/route-6fc5f8e744c81802.js +17 -0
  353. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/status/route-6fc5f8e744c81802.js +17 -0
  354. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/route-6fc5f8e744c81802.js +17 -0
  355. package/.next/standalone/.next/static/chunks/app/api/v1/lifecycle/adoption/route-6fc5f8e744c81802.js +17 -0
  356. package/.next/standalone/.next/static/chunks/app/api/v1/local-file/route-6fc5f8e744c81802.js +17 -0
  357. package/.next/standalone/.next/static/chunks/app/api/v1/logs/route-6fc5f8e744c81802.js +17 -0
  358. package/.next/standalone/.next/static/chunks/app/api/v1/maps/embed/route-6fc5f8e744c81802.js +17 -0
  359. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/[name]/route-6fc5f8e744c81802.js +17 -0
  360. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/registry/route-6fc5f8e744c81802.js +17 -0
  361. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/route-6fc5f8e744c81802.js +17 -0
  362. package/.next/standalone/.next/static/chunks/app/api/v1/memory/[namespace]/[key]/route-6fc5f8e744c81802.js +17 -0
  363. package/.next/standalone/.next/static/chunks/app/api/v1/memory/policy/route-6fc5f8e744c81802.js +17 -0
  364. package/.next/standalone/.next/static/chunks/app/api/v1/memory/route-6fc5f8e744c81802.js +17 -0
  365. package/.next/standalone/.next/static/chunks/app/api/v1/memory/search/route-6fc5f8e744c81802.js +17 -0
  366. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/compact-threads/route-6fc5f8e744c81802.js +17 -0
  367. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/route-6fc5f8e744c81802.js +17 -0
  368. package/.next/standalone/.next/static/chunks/app/api/v1/models/route-6fc5f8e744c81802.js +17 -0
  369. package/.next/standalone/.next/static/chunks/app/api/v1/packages/catalog/route-6fc5f8e744c81802.js +17 -0
  370. package/.next/standalone/.next/static/chunks/app/api/v1/packages/defaults/[id]/route-6fc5f8e744c81802.js +17 -0
  371. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/[id]/route-6fc5f8e744c81802.js +17 -0
  372. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/route-6fc5f8e744c81802.js +17 -0
  373. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/enabled/route-6fc5f8e744c81802.js +17 -0
  374. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/route-6fc5f8e744c81802.js +17 -0
  375. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/route-6fc5f8e744c81802.js +17 -0
  376. package/.next/standalone/.next/static/chunks/app/api/v1/packages/reload/route-6fc5f8e744c81802.js +17 -0
  377. package/.next/standalone/.next/static/chunks/app/api/v1/packages/route-6fc5f8e744c81802.js +17 -0
  378. package/.next/standalone/.next/static/chunks/app/api/v1/page-capture/route-6fc5f8e744c81802.js +17 -0
  379. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/approve/route-6fc5f8e744c81802.js +17 -0
  380. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/deny/route-6fc5f8e744c81802.js +17 -0
  381. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/route-6fc5f8e744c81802.js +17 -0
  382. package/.next/standalone/.next/static/chunks/app/api/v1/profile/location/route-6fc5f8e744c81802.js +17 -0
  383. package/.next/standalone/.next/static/chunks/app/api/v1/profile/route-6fc5f8e744c81802.js +17 -0
  384. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/models/route-6fc5f8e744c81802.js +17 -0
  385. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/probe/route-6fc5f8e744c81802.js +17 -0
  386. package/.next/standalone/.next/static/chunks/app/api/v1/providers/github-copilot/auth/route-6fc5f8e744c81802.js +17 -0
  387. package/.next/standalone/.next/static/chunks/app/api/v1/providers/route-6fc5f8e744c81802.js +17 -0
  388. package/.next/standalone/.next/static/chunks/app/api/v1/proxy-config/route-6fc5f8e744c81802.js +17 -0
  389. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/init/route-6fc5f8e744c81802.js +17 -0
  390. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/route-6fc5f8e744c81802.js +17 -0
  391. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/route-6fc5f8e744c81802.js +17 -0
  392. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/run/route-6fc5f8e744c81802.js +17 -0
  393. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/route-6fc5f8e744c81802.js +17 -0
  394. package/.next/standalone/.next/static/chunks/app/api/v1/security/idle-timeout/route-6fc5f8e744c81802.js +17 -0
  395. package/.next/standalone/.next/static/chunks/app/api/v1/security/pin/route-6fc5f8e744c81802.js +17 -0
  396. package/.next/standalone/.next/static/chunks/app/api/v1/security/state/route-6fc5f8e744c81802.js +17 -0
  397. package/.next/standalone/.next/static/chunks/app/api/v1/security/unlock/route-6fc5f8e744c81802.js +17 -0
  398. package/.next/standalone/.next/static/chunks/app/api/v1/security/verify-pin/route-6fc5f8e744c81802.js +17 -0
  399. package/.next/standalone/.next/static/chunks/app/api/v1/setup/test-key/route-6fc5f8e744c81802.js +17 -0
  400. package/.next/standalone/.next/static/chunks/app/api/v1/skills/[id]/route-6fc5f8e744c81802.js +17 -0
  401. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/[id]/route-6fc5f8e744c81802.js +17 -0
  402. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/route-6fc5f8e744c81802.js +17 -0
  403. package/.next/standalone/.next/static/chunks/app/api/v1/skills/route-6fc5f8e744c81802.js +17 -0
  404. package/.next/standalone/.next/static/chunks/app/api/v1/system/abort/route-6fc5f8e744c81802.js +17 -0
  405. package/.next/standalone/.next/static/chunks/app/api/v1/system/restart/route-6fc5f8e744c81802.js +17 -0
  406. package/.next/standalone/.next/static/chunks/app/api/v1/tailscale/route-6fc5f8e744c81802.js +17 -0
  407. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/[agent_id]/route-6fc5f8e744c81802.js +17 -0
  408. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/route-6fc5f8e744c81802.js +17 -0
  409. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/activity/route-6fc5f8e744c81802.js +17 -0
  410. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/context-pin/route-6fc5f8e744c81802.js +17 -0
  411. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/route-6fc5f8e744c81802.js +17 -0
  412. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/run/route-6fc5f8e744c81802.js +17 -0
  413. package/.next/standalone/.next/static/chunks/app/api/v1/threads/route-6fc5f8e744c81802.js +17 -0
  414. package/.next/standalone/.next/static/chunks/app/api/v1/tools/route-6fc5f8e744c81802.js +17 -0
  415. package/.next/standalone/.next/static/chunks/app/api/v1/update/apply/route-6fc5f8e744c81802.js +17 -0
  416. package/.next/standalone/.next/static/chunks/app/api/v1/update/route-6fc5f8e744c81802.js +17 -0
  417. package/.next/standalone/.next/static/chunks/app/api/v1/voice/transcribe/route-6fc5f8e744c81802.js +17 -0
  418. package/.next/standalone/.next/static/chunks/app/api/v1/voice/tts/route-6fc5f8e744c81802.js +17 -0
  419. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/route-6fc5f8e744c81802.js +17 -0
  420. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/run/route-6fc5f8e744c81802.js +17 -0
  421. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/reaction-scripts/route-6fc5f8e744c81802.js +17 -0
  422. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/route-6fc5f8e744c81802.js +17 -0
  423. package/.next/standalone/.next/static/chunks/app/manifest.webmanifest/route-6fc5f8e744c81802.js +17 -0
  424. package/.next/standalone/.next/static/chunks/app/{page-7017f07f8a7a083c.js → page-04748847c6ff866f.js} +1013 -585
  425. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-6fc5f8e744c81802.js +17 -0
  426. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-6fc5f8e744c81802.js +17 -0
  427. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-6fc5f8e744c81802.js +17 -0
  428. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-6fc5f8e744c81802.js +17 -0
  429. package/.next/standalone/.next/static/css/{d80058f0b9b41c09.css → 2669e8744cc8c212.css} +2 -2
  430. package/.next/standalone/docs/adoption/changesets.json +358 -0
  431. package/.next/standalone/lib/skills/builtins/memory-organization/SKILL.md +16 -0
  432. package/.next/standalone/package.json +3 -3
  433. package/CHANGELOG.md +44 -0
  434. package/api/client.ts +9 -0
  435. package/api/types.ts +29 -0
  436. package/app/api/v1/lifecycle/adoption/route.ts +14 -2
  437. package/app/api/v1/models/[name]/compact-threads/route.ts +14 -11
  438. package/app/api/v1/threads/[thread_id]/activity/route.ts +19 -0
  439. package/app/api/v1/threads/[thread_id]/context-pin/route.test.ts +1 -0
  440. package/app/api/v1/threads/[thread_id]/context-pin/route.ts +2 -1
  441. package/app/api/v1/threads/[thread_id]/route.ts +5 -1
  442. package/app/api/v1/threads/[thread_id]/run/route.ts +0 -1
  443. package/components/chat/ChatView.tsx +52 -11
  444. package/components/chat/ContextBoundary.test.tsx +68 -1
  445. package/components/chat/ContextBoundary.tsx +92 -13
  446. package/components/chat/MessageBubble.tsx +12 -0
  447. package/components/chat/MessageList.test.tsx +31 -0
  448. package/components/chat/MessageList.tsx +49 -28
  449. package/components/chat/ToolList.test.tsx +92 -16
  450. package/components/chat/ToolList.tsx +59 -4
  451. package/components/chat/chat-helpers.test.tsx +24 -1
  452. package/components/chat/chat-helpers.ts +47 -4
  453. package/components/chat/useThreadActivity.test.tsx +113 -0
  454. package/components/chat/useThreadActivity.ts +94 -0
  455. package/components/chat/useThreadData.ts +16 -16
  456. package/components/chat/workflow-step-retry.ts +25 -0
  457. package/components/integrations/NetworkSection.tsx +2 -2
  458. package/components/ui/BootScreen.tsx +17 -0
  459. package/components/ui/WorkflowChecklist.tsx +71 -33
  460. package/hooks/useSSE.ts +28 -3
  461. package/lib/agents/citation-checker.test.ts +40 -2
  462. package/lib/agents/citation-checker.ts +56 -11
  463. package/lib/agents/compaction-pipeline.test.ts +202 -0
  464. package/lib/agents/compaction-pipeline.ts +483 -0
  465. package/lib/agents/context-boundary.ts +5 -6
  466. package/lib/agents/conversation-summary.ts +37 -21
  467. package/lib/agents/instruction-edits.test.ts +120 -0
  468. package/lib/agents/instruction-edits.ts +65 -42
  469. package/lib/agents/prepare/history-window.test.ts +18 -0
  470. package/lib/agents/prepare/history-window.ts +11 -2
  471. package/lib/agents/prepare/request.ts +4 -2
  472. package/lib/agents/prepare/system-prompt.test.ts +49 -0
  473. package/lib/agents/prepare/system-prompt.ts +16 -5
  474. package/lib/agents/prompt-registry.test.ts +5 -140
  475. package/lib/agents/prompt-registry.ts +45 -1
  476. package/lib/agents/prompt-variants.ts +146 -0
  477. package/lib/agents/proposals.test.ts +76 -0
  478. package/lib/agents/proposals.ts +13 -5
  479. package/lib/agents/run-registry.test.ts +22 -0
  480. package/lib/agents/run-registry.ts +29 -0
  481. package/lib/agents/run-thread.auto-boundary.test.ts +125 -5
  482. package/lib/agents/run-thread.retry.test.ts +67 -1
  483. package/lib/agents/run-thread.ts +110 -10
  484. package/lib/agents/sqlite-checkpoint-saver.test.ts +91 -0
  485. package/lib/agents/thread-activity.test.ts +31 -0
  486. package/lib/agents/thread-activity.ts +27 -0
  487. package/lib/agents/thread-compaction-state.test.ts +82 -0
  488. package/lib/agents/thread-compaction-state.ts +121 -0
  489. package/lib/agents/thread-compaction.test.ts +83 -4
  490. package/lib/agents/thread-compaction.ts +34 -11
  491. package/lib/agents/warm-summary-background.test.ts +219 -5
  492. package/lib/agents/warm-summary-background.ts +346 -143
  493. package/lib/agents/warm-topics.test.ts +191 -0
  494. package/lib/agents/warm-topics.ts +317 -0
  495. package/lib/agents/workflow-step-retry.test.ts +96 -0
  496. package/lib/agents/workflow-step-retry.ts +216 -0
  497. package/lib/api/browser-control.ts +0 -3
  498. package/lib/bridges/dispatcher.ts +1 -0
  499. package/lib/bridges/message-role.test.ts +81 -0
  500. package/lib/bridges/message-role.ts +23 -10
  501. package/lib/bridges/types.ts +6 -0
  502. package/lib/bridges/whatsapp-link.test.ts +32 -0
  503. package/lib/bridges/whatsapp-link.ts +21 -0
  504. package/lib/bridges/whatsapp.inbound.test.ts +239 -0
  505. package/lib/bridges/whatsapp.sender.test.ts +80 -1
  506. package/lib/bridges/whatsapp.ts +76 -38
  507. package/lib/db/migrations.ts +5 -0
  508. package/lib/env/config.ts +2 -0
  509. package/lib/env/schema.ts +12 -0
  510. package/lib/lifecycle/changeset-build.test.ts +93 -0
  511. package/lib/lifecycle/changeset-build.ts +210 -0
  512. package/lib/lifecycle/changesets.test.ts +101 -0
  513. package/lib/lifecycle/changesets.ts +166 -0
  514. package/lib/lifecycle/surface-collect.test.ts +88 -0
  515. package/lib/lifecycle/surface-collect.ts +64 -0
  516. package/lib/lifecycle/surface-snapshot.test.ts +104 -0
  517. package/lib/lifecycle/surface-snapshot.ts +210 -0
  518. package/lib/memory/record.ts +0 -2
  519. package/lib/pricing/snapshot.test.ts +70 -0
  520. package/lib/pricing/snapshot.ts +10 -2
  521. package/lib/providers/external.ts +0 -2
  522. package/lib/proxy/dispatcher.test.ts +119 -1
  523. package/lib/proxy/dispatcher.ts +22 -9
  524. package/lib/skills/builtins/memory-organization/SKILL.md +16 -0
  525. package/lib/stores/agent-configs.ts +10 -5
  526. package/lib/stores/bridges.test.ts +81 -0
  527. package/lib/stores/bridges.ts +9 -8
  528. package/lib/stores/proxy-config.test.ts +120 -0
  529. package/lib/stores/proxy-config.ts +22 -4
  530. package/lib/stores/threads.test.ts +9 -0
  531. package/lib/stores/threads.ts +33 -19
  532. package/lib/stores/version-adoption.test.ts +96 -0
  533. package/lib/stores/version-adoption.ts +239 -26
  534. package/lib/stores/workflow-progress.ts +3 -0
  535. package/lib/tools/communications/calendar.test.ts +43 -2
  536. package/lib/tools/communications/calendar.ts +2 -0
  537. package/lib/tools/communications/gmail.test.ts +51 -1
  538. package/lib/tools/communications/gmail.ts +44 -2
  539. package/lib/tools/communications/ms-todo.ts +0 -7
  540. package/lib/tools/communications/outlook-calendar.ts +2 -0
  541. package/lib/tools/communications/outlook.test.ts +33 -2
  542. package/lib/tools/communications/outlook.ts +2 -0
  543. package/lib/tools/filesystem/edit-match.test.ts +133 -0
  544. package/lib/tools/filesystem/edit-match.ts +7 -2
  545. package/lib/tools/general/memory.ts +1 -1
  546. package/lib/tools/general/workflow-progress.ts +2 -0
  547. package/lib/tools/runtime/catalog.ts +1 -25
  548. package/lib/tools/support/result-refs.test.ts +131 -0
  549. package/lib/tools/support/result-refs.ts +41 -9
  550. package/lib/triggers/registry.ts +0 -4
  551. package/lib/utils/source-link.test.ts +51 -0
  552. package/lib/utils/source-link.ts +45 -0
  553. package/package.json +3 -3
  554. package/scripts/install-to-system.ps1 +39 -11
  555. package/scripts/install-to-system.sh +37 -3
  556. package/.next/standalone/.next/server/chunks/3979.js +0 -581
  557. package/.next/standalone/.next/server/chunks/5936.js +0 -594
  558. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/display-filters/route-36cb8b428b38b26a.js +0 -17
  559. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/route-36cb8b428b38b26a.js +0 -17
  560. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/thread/route-36cb8b428b38b26a.js +0 -17
  561. package/.next/standalone/.next/static/chunks/app/api/v1/agents/route-36cb8b428b38b26a.js +0 -17
  562. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/[hostname]/route-36cb8b428b38b26a.js +0 -17
  563. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/route-36cb8b428b38b26a.js +0 -17
  564. package/.next/standalone/.next/static/chunks/app/api/v1/artifacts/lifecycle/route-36cb8b428b38b26a.js +0 -17
  565. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/files/route-36cb8b428b38b26a.js +0 -17
  566. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/images/route-36cb8b428b38b26a.js +0 -17
  567. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/chats/route-36cb8b428b38b26a.js +0 -17
  568. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/[remote_jid]/route-36cb8b428b38b26a.js +0 -17
  569. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/route-36cb8b428b38b26a.js +0 -17
  570. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/lookup/route-36cb8b428b38b26a.js +0 -17
  571. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/pair/route-36cb8b428b38b26a.js +0 -17
  572. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/route-36cb8b428b38b26a.js +0 -17
  573. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/[route_id]/route-36cb8b428b38b26a.js +0 -17
  574. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/route-36cb8b428b38b26a.js +0 -17
  575. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/status/route-36cb8b428b38b26a.js +0 -17
  576. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/kinds/route-36cb8b428b38b26a.js +0 -17
  577. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/route-36cb8b428b38b26a.js +0 -17
  578. package/.next/standalone/.next/static/chunks/app/api/v1/builtin-tools/route-36cb8b428b38b26a.js +0 -17
  579. package/.next/standalone/.next/static/chunks/app/api/v1/config/route-36cb8b428b38b26a.js +0 -17
  580. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/[id]/route-36cb8b428b38b26a.js +0 -17
  581. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/route-36cb8b428b38b26a.js +0 -17
  582. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/currency/route-36cb8b428b38b26a.js +0 -17
  583. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/metrics/route-36cb8b428b38b26a.js +0 -17
  584. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing/route-36cb8b428b38b26a.js +0 -17
  585. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing-task/route-36cb8b428b38b26a.js +0 -17
  586. package/.next/standalone/.next/static/chunks/app/api/v1/delegations/codex/[job_id]/route-36cb8b428b38b26a.js +0 -17
  587. package/.next/standalone/.next/static/chunks/app/api/v1/documents/search/route-36cb8b428b38b26a.js +0 -17
  588. package/.next/standalone/.next/static/chunks/app/api/v1/documents/settings/route-36cb8b428b38b26a.js +0 -17
  589. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/reindex/route-36cb8b428b38b26a.js +0 -17
  590. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/route-36cb8b428b38b26a.js +0 -17
  591. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/route-36cb8b428b38b26a.js +0 -17
  592. package/.next/standalone/.next/static/chunks/app/api/v1/env/route-36cb8b428b38b26a.js +0 -17
  593. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/allowlist/route-36cb8b428b38b26a.js +0 -17
  594. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/route-36cb8b428b38b26a.js +0 -17
  595. package/.next/standalone/.next/static/chunks/app/api/v1/events/route-36cb8b428b38b26a.js +0 -17
  596. package/.next/standalone/.next/static/chunks/app/api/v1/events/test/route-36cb8b428b38b26a.js +0 -17
  597. package/.next/standalone/.next/static/chunks/app/api/v1/extension/agents/route-36cb8b428b38b26a.js +0 -17
  598. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/activate/route-36cb8b428b38b26a.js +0 -17
  599. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/foreground/route-36cb8b428b38b26a.js +0 -17
  600. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/history/route-36cb8b428b38b26a.js +0 -17
  601. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/poll/route-36cb8b428b38b26a.js +0 -17
  602. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/progress/route-36cb8b428b38b26a.js +0 -17
  603. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/result/route-36cb8b428b38b26a.js +0 -17
  604. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/retry/route-36cb8b428b38b26a.js +0 -17
  605. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/status/route-36cb8b428b38b26a.js +0 -17
  606. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/tabs/route-36cb8b428b38b26a.js +0 -17
  607. package/.next/standalone/.next/static/chunks/app/api/v1/extension/fill/route-36cb8b428b38b26a.js +0 -17
  608. package/.next/standalone/.next/static/chunks/app/api/v1/extension/refine/route-36cb8b428b38b26a.js +0 -17
  609. package/.next/standalone/.next/static/chunks/app/api/v1/extension/turn/route-36cb8b428b38b26a.js +0 -17
  610. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/route-36cb8b428b38b26a.js +0 -17
  611. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/config/route-36cb8b428b38b26a.js +0 -17
  612. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/route-36cb8b428b38b26a.js +0 -17
  613. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/secrets/route-36cb8b428b38b26a.js +0 -17
  614. package/.next/standalone/.next/static/chunks/app/api/v1/files/[name]/route-36cb8b428b38b26a.js +0 -17
  615. package/.next/standalone/.next/static/chunks/app/api/v1/fs/browse/route-36cb8b428b38b26a.js +0 -17
  616. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/[id]/route-36cb8b428b38b26a.js +0 -17
  617. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/default/route-36cb8b428b38b26a.js +0 -17
  618. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/route-36cb8b428b38b26a.js +0 -17
  619. package/.next/standalone/.next/static/chunks/app/api/v1/health/probes/route-36cb8b428b38b26a.js +0 -17
  620. package/.next/standalone/.next/static/chunks/app/api/v1/health/route-36cb8b428b38b26a.js +0 -17
  621. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/route-36cb8b428b38b26a.js +0 -17
  622. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/test/route-36cb8b428b38b26a.js +0 -17
  623. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/callback/route-36cb8b428b38b26a.js +0 -17
  624. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/start/route-36cb8b428b38b26a.js +0 -17
  625. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/status/route-36cb8b428b38b26a.js +0 -17
  626. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/callback/route-36cb8b428b38b26a.js +0 -17
  627. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/start/route-36cb8b428b38b26a.js +0 -17
  628. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/status/route-36cb8b428b38b26a.js +0 -17
  629. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/route-36cb8b428b38b26a.js +0 -17
  630. package/.next/standalone/.next/static/chunks/app/api/v1/lifecycle/adoption/route-36cb8b428b38b26a.js +0 -17
  631. package/.next/standalone/.next/static/chunks/app/api/v1/local-file/route-36cb8b428b38b26a.js +0 -17
  632. package/.next/standalone/.next/static/chunks/app/api/v1/logs/route-36cb8b428b38b26a.js +0 -17
  633. package/.next/standalone/.next/static/chunks/app/api/v1/maps/embed/route-36cb8b428b38b26a.js +0 -17
  634. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/[name]/route-36cb8b428b38b26a.js +0 -17
  635. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/registry/route-36cb8b428b38b26a.js +0 -17
  636. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/route-36cb8b428b38b26a.js +0 -17
  637. package/.next/standalone/.next/static/chunks/app/api/v1/memory/[namespace]/[key]/route-36cb8b428b38b26a.js +0 -17
  638. package/.next/standalone/.next/static/chunks/app/api/v1/memory/policy/route-36cb8b428b38b26a.js +0 -17
  639. package/.next/standalone/.next/static/chunks/app/api/v1/memory/route-36cb8b428b38b26a.js +0 -17
  640. package/.next/standalone/.next/static/chunks/app/api/v1/memory/search/route-36cb8b428b38b26a.js +0 -17
  641. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/compact-threads/route-36cb8b428b38b26a.js +0 -17
  642. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/route-36cb8b428b38b26a.js +0 -17
  643. package/.next/standalone/.next/static/chunks/app/api/v1/models/route-36cb8b428b38b26a.js +0 -17
  644. package/.next/standalone/.next/static/chunks/app/api/v1/packages/catalog/route-36cb8b428b38b26a.js +0 -17
  645. package/.next/standalone/.next/static/chunks/app/api/v1/packages/defaults/[id]/route-36cb8b428b38b26a.js +0 -17
  646. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/[id]/route-36cb8b428b38b26a.js +0 -17
  647. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/route-36cb8b428b38b26a.js +0 -17
  648. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/enabled/route-36cb8b428b38b26a.js +0 -17
  649. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/route-36cb8b428b38b26a.js +0 -17
  650. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/route-36cb8b428b38b26a.js +0 -17
  651. package/.next/standalone/.next/static/chunks/app/api/v1/packages/reload/route-36cb8b428b38b26a.js +0 -17
  652. package/.next/standalone/.next/static/chunks/app/api/v1/packages/route-36cb8b428b38b26a.js +0 -17
  653. package/.next/standalone/.next/static/chunks/app/api/v1/page-capture/route-36cb8b428b38b26a.js +0 -17
  654. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/approve/route-36cb8b428b38b26a.js +0 -17
  655. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/deny/route-36cb8b428b38b26a.js +0 -17
  656. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/route-36cb8b428b38b26a.js +0 -17
  657. package/.next/standalone/.next/static/chunks/app/api/v1/profile/location/route-36cb8b428b38b26a.js +0 -17
  658. package/.next/standalone/.next/static/chunks/app/api/v1/profile/route-36cb8b428b38b26a.js +0 -17
  659. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/models/route-36cb8b428b38b26a.js +0 -17
  660. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/probe/route-36cb8b428b38b26a.js +0 -17
  661. package/.next/standalone/.next/static/chunks/app/api/v1/providers/github-copilot/auth/route-36cb8b428b38b26a.js +0 -17
  662. package/.next/standalone/.next/static/chunks/app/api/v1/providers/route-36cb8b428b38b26a.js +0 -17
  663. package/.next/standalone/.next/static/chunks/app/api/v1/proxy-config/route-36cb8b428b38b26a.js +0 -17
  664. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/init/route-36cb8b428b38b26a.js +0 -17
  665. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/route-36cb8b428b38b26a.js +0 -17
  666. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/route-36cb8b428b38b26a.js +0 -17
  667. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/run/route-36cb8b428b38b26a.js +0 -17
  668. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/route-36cb8b428b38b26a.js +0 -17
  669. package/.next/standalone/.next/static/chunks/app/api/v1/security/idle-timeout/route-36cb8b428b38b26a.js +0 -17
  670. package/.next/standalone/.next/static/chunks/app/api/v1/security/pin/route-36cb8b428b38b26a.js +0 -17
  671. package/.next/standalone/.next/static/chunks/app/api/v1/security/state/route-36cb8b428b38b26a.js +0 -17
  672. package/.next/standalone/.next/static/chunks/app/api/v1/security/unlock/route-36cb8b428b38b26a.js +0 -17
  673. package/.next/standalone/.next/static/chunks/app/api/v1/security/verify-pin/route-36cb8b428b38b26a.js +0 -17
  674. package/.next/standalone/.next/static/chunks/app/api/v1/setup/test-key/route-36cb8b428b38b26a.js +0 -17
  675. package/.next/standalone/.next/static/chunks/app/api/v1/skills/[id]/route-36cb8b428b38b26a.js +0 -17
  676. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/[id]/route-36cb8b428b38b26a.js +0 -17
  677. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/route-36cb8b428b38b26a.js +0 -17
  678. package/.next/standalone/.next/static/chunks/app/api/v1/skills/route-36cb8b428b38b26a.js +0 -17
  679. package/.next/standalone/.next/static/chunks/app/api/v1/system/abort/route-36cb8b428b38b26a.js +0 -17
  680. package/.next/standalone/.next/static/chunks/app/api/v1/system/restart/route-36cb8b428b38b26a.js +0 -17
  681. package/.next/standalone/.next/static/chunks/app/api/v1/tailscale/route-36cb8b428b38b26a.js +0 -17
  682. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/[agent_id]/route-36cb8b428b38b26a.js +0 -17
  683. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/route-36cb8b428b38b26a.js +0 -17
  684. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/context-pin/route-36cb8b428b38b26a.js +0 -17
  685. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/route-36cb8b428b38b26a.js +0 -17
  686. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/run/route-36cb8b428b38b26a.js +0 -17
  687. package/.next/standalone/.next/static/chunks/app/api/v1/threads/route-36cb8b428b38b26a.js +0 -17
  688. package/.next/standalone/.next/static/chunks/app/api/v1/tools/route-36cb8b428b38b26a.js +0 -17
  689. package/.next/standalone/.next/static/chunks/app/api/v1/update/apply/route-36cb8b428b38b26a.js +0 -17
  690. package/.next/standalone/.next/static/chunks/app/api/v1/update/route-36cb8b428b38b26a.js +0 -17
  691. package/.next/standalone/.next/static/chunks/app/api/v1/voice/transcribe/route-36cb8b428b38b26a.js +0 -17
  692. package/.next/standalone/.next/static/chunks/app/api/v1/voice/tts/route-36cb8b428b38b26a.js +0 -17
  693. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/route-36cb8b428b38b26a.js +0 -17
  694. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/run/route-36cb8b428b38b26a.js +0 -17
  695. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/reaction-scripts/route-36cb8b428b38b26a.js +0 -17
  696. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/route-36cb8b428b38b26a.js +0 -17
  697. package/.next/standalone/.next/static/chunks/app/manifest.webmanifest/route-36cb8b428b38b26a.js +0 -17
  698. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-36cb8b428b38b26a.js +0 -17
  699. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-36cb8b428b38b26a.js +0 -17
  700. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-36cb8b428b38b26a.js +0 -17
  701. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-36cb8b428b38b26a.js +0 -17
  702. /package/.next/standalone/.next/static/{NUrC9xax1sp1Q70nlFqS6 → hwujW4hR1b-r3k5WdMxZO}/_buildManifest.js +0 -0
  703. /package/.next/standalone/.next/static/{NUrC9xax1sp1Q70nlFqS6 → hwujW4hR1b-r3k5WdMxZO}/_ssgManifest.js +0 -0
@@ -1,6 +1,8 @@
1
1
  import { getProvider } from "@/lib/providers";
2
2
  import type { ModelProvider, ProviderParams } from "@/lib/providers/types";
3
- import { summarizeTranscript, transcriptText, extractTopicSegments, validateTopicSegments, type SummaryTopicSegment } from "@/lib/agents/conversation-summary";
3
+ import { summarizeTranscript, transcriptText, extractTopicSegments, validateTopicSegments, parseStoredTopics, type SummaryTopicSegment } from "@/lib/agents/conversation-summary";
4
+ import { canMergeIntoTopics, finalizeFreshTopics, mergeWarmTopics, renderTopicRecaps, slugifyForMemoryKey } from "@/lib/agents/warm-topics";
5
+ import { formatTranscriptRow, runCompactionPipeline, type CompactionSource, type PipelineSourceRow } from "@/lib/agents/compaction-pipeline";
4
6
  import { takeRecentWarmMessages, warmSummaryMessageLimit, wrapWarmSummary, AUTOMATION_CHANNEL_ORDER } from "@/lib/agents/prepare/history-window";
5
7
  import { getAgentConfig, getAgentTierProportions } from "@/lib/stores/agent-configs";
6
8
  import { getModelParams, resolveRunnableModelConfig } from "@/lib/stores/model-config";
@@ -13,15 +15,43 @@ import {
13
15
  getThread,
14
16
  getThreadMessageBySeq,
15
17
  getThreadChannelSummary,
18
+ listThreadChannelSummaries,
19
+ setAutoBoundaryLock,
16
20
  } from "@/lib/stores/threads";
21
+ import { getOrCreateGlobal } from "@/lib/utils/global-state";
22
+ import {
23
+ getCompactionAttempt,
24
+ isCompactionRunning,
25
+ runTrackedCompaction,
26
+ type CompactionAttempt,
27
+ } from "@/lib/agents/thread-compaction-state";
28
+
29
+ /** Automation-channel recaps committed at the thread's current boundary. */
30
+ export function currentChannelSummaries(
31
+ threadId: string,
32
+ hotSinceSeq: number | null | undefined,
33
+ ): Array<{ channel: string; summary: string; computed_at: string; topics: SummaryTopicSegment[] | null }> {
34
+ if (hotSinceSeq == null) return [];
35
+ const order: readonly string[] = AUTOMATION_CHANNEL_ORDER;
36
+ return listThreadChannelSummaries(threadId)
37
+ .filter((row) => row.summary_before_seq === hotSinceSeq && row.summary.trim().length > 0)
38
+ .sort((a, b) => order.indexOf(a.channel) - order.indexOf(b.channel))
39
+ .map((row) => ({
40
+ channel: row.channel,
41
+ summary: row.summary,
42
+ computed_at: row.computed_at,
43
+ topics: parseStoredTopics(row.topics),
44
+ }));
45
+ }
17
46
 
18
47
  const MAX_TOPIC_PREVIEW_CHARS = 24_000;
19
48
 
20
- const activeRefreshes = new Set<string>();
21
- // Boundaries an automatic compaction has proposed but not yet committed.
22
- // The pin only moves once the recap that replaces the cut-off messages is
23
- // stored, so the turn that proposes it still runs on the old boundary.
24
- const pendingBoundaries = new Map<string, number>();
49
+ // Automatic ("auto"), summary-refresh ("refresh") and manual /compact
50
+ // ("manual") attempts are tracked per thread in thread-compaction-state, so
51
+ // every route bundle reports the same compaction and each one has a deadline.
52
+ // An auto boundary is proposed but not committed until its recap is stored,
53
+ // so the turn that proposes it still runs on the old boundary.
54
+ //
25
55
  // A boundary request that arrived while a prior one for the same thread was
26
56
  // still in flight. Last-write-wins: kickBoundaryCompaction used to silently
27
57
  // drop any request that arrived while one was already running (dragging
@@ -31,19 +61,23 @@ const pendingBoundaries = new Map<string, number>();
31
61
  // later request was ignored. Queuing the latest one and re-running it once
32
62
  // the in-flight commit settles makes the boundary always converge on what
33
63
  // the caller most recently asked for.
34
- const queuedBoundaries = new Map<string, {
64
+ const queuedBoundaries = getOrCreateGlobal("__jarela_queued_compaction_boundaries", () => new Map<string, {
35
65
  boundarySeq: number;
36
66
  options: Pick<WarmContextCompactionOptions, "autoBoundaryLockedUntilMessageCount">;
37
- }>();
67
+ }>());
68
+
69
+ function backgroundCompactionRunning(threadId: string): boolean {
70
+ return isCompactionRunning(threadId, "auto") || isCompactionRunning(threadId, "refresh");
71
+ }
38
72
 
39
73
  export function kickWarmSummaryRefresh(threadId: string): void {
40
- if (!threadId || activeRefreshes.has(threadId)) return;
41
- activeRefreshes.add(threadId);
42
- queueMicrotask(() => {
43
- void refreshWarmSummary(threadId).finally(() => {
44
- activeRefreshes.delete(threadId);
45
- });
46
- });
74
+ if (!threadId || backgroundCompactionRunning(threadId)) return;
75
+ const thread = getThread(threadId);
76
+ void runTrackedCompaction(threadId, "refresh", thread?.hot_since_seq ?? null, async (attempt) => {
77
+ await Promise.resolve();
78
+ await refreshWarmSummary(threadId, attempt);
79
+ }).catch((err) => console.warn(`[warm-summary] refresh failed thread=${threadId}: ${String(err)}`))
80
+ .finally(() => drainQueuedBoundary(threadId));
47
81
  }
48
82
 
49
83
  /**
@@ -59,26 +93,27 @@ export function pendingCompactionBoundary(threadId: string): string | null {
59
93
 
60
94
  export function pendingCompactionBoundarySeq(threadId: string): number | null {
61
95
  return queuedBoundaries.get(threadId)?.boundarySeq
62
- ?? pendingBoundaries.get(threadId)
63
- ?? manualBoundaries.get(threadId)
96
+ ?? getCompactionAttempt(threadId, "auto")?.boundarySeq
97
+ ?? getCompactionAttempt(threadId, "manual")?.boundarySeq
64
98
  ?? null;
65
99
  }
66
100
 
67
- // Manual /compact runs outside the auto-compaction queue; track it so a
68
- // client that reloads the thread mid-compaction still sees it pending.
69
- const manualBoundaries = new Map<string, number>();
101
+ /** A manual /compact holds the thread (the UI queues sends); auto ones don't. */
102
+ export function isManualCompactionRunning(threadId: string): boolean {
103
+ return isCompactionRunning(threadId, "manual");
104
+ }
70
105
 
71
- export async function trackManualCompaction<T>(
106
+ /**
107
+ * Run a manual /compact as the thread's single manual attempt. Pass the
108
+ * attempt to compactThreadWarmContext so a result that arrives after the
109
+ * deadline is discarded rather than committed.
110
+ */
111
+ export function trackManualCompaction<T>(
72
112
  threadId: string,
73
113
  boundarySeq: number,
74
- run: () => Promise<T>,
114
+ run: (attempt: CompactionAttempt) => Promise<T>,
75
115
  ): Promise<T> {
76
- manualBoundaries.set(threadId, boundarySeq);
77
- try {
78
- return await run();
79
- } finally {
80
- if (manualBoundaries.get(threadId) === boundarySeq) manualBoundaries.delete(threadId);
81
- }
116
+ return runTrackedCompaction(threadId, "manual", boundarySeq, run);
82
117
  }
83
118
 
84
119
  /**
@@ -99,13 +134,29 @@ export function kickBoundaryCompaction(
99
134
  options: Pick<WarmContextCompactionOptions, "autoBoundaryLockedUntilMessageCount"> = {},
100
135
  ): void {
101
136
  if (!threadId || !Number.isSafeInteger(boundarySeq) || boundarySeq <= 0) return;
102
- if (activeRefreshes.has(threadId) || pendingBoundaries.has(threadId)) {
137
+ if (backgroundCompactionRunning(threadId)) {
103
138
  queuedBoundaries.set(threadId, { boundarySeq, options });
104
139
  return;
105
140
  }
106
141
  runBoundaryCompaction(threadId, boundarySeq, options);
107
142
  }
108
143
 
144
+ // Called whenever a background attempt settles. A queued boundary that a
145
+ // summary refresh was blocking used to be stranded here forever, which kept
146
+ // the thread reporting a pending compaction until restart.
147
+ function drainQueuedBoundary(threadId: string): void {
148
+ if (backgroundCompactionRunning(threadId)) return;
149
+ const queued = queuedBoundaries.get(threadId);
150
+ if (!queued) return;
151
+ queuedBoundaries.delete(threadId);
152
+ // Skip a no-op re-run if the boundary that just committed already
153
+ // matches what was queued — the queued request was superseded by
154
+ // the very commit it was waiting behind.
155
+ const settled = getThread(threadId);
156
+ const alreadySettled = queued.boundarySeq === (settled?.hot_since_seq ?? null);
157
+ if (!alreadySettled) runBoundaryCompaction(threadId, queued.boundarySeq, queued.options);
158
+ }
159
+
109
160
  function runBoundaryCompaction(
110
161
  threadId: string,
111
162
  boundarySeq: number,
@@ -113,40 +164,47 @@ function runBoundaryCompaction(
113
164
  ): void {
114
165
  const baseThread = getThread(threadId);
115
166
  const basePinSeq = baseThread?.hot_since_seq ?? null;
116
- pendingBoundaries.set(threadId, boundarySeq);
117
- activeRefreshes.add(threadId);
118
- queueMicrotask(() => {
119
- void commitBoundaryCompaction(threadId, boundarySeq, basePinSeq, options)
120
- .catch((err) => console.warn(`[context-boundary:auto] compaction failed thread=${threadId}: ${String(err)}`))
121
- .finally(() => {
122
- pendingBoundaries.delete(threadId);
123
- activeRefreshes.delete(threadId);
124
- const queued = queuedBoundaries.get(threadId);
125
- if (!queued) return;
126
- queuedBoundaries.delete(threadId);
127
- // Skip a no-op re-run if the boundary that just committed already
128
- // matches what was queued — the queued request was superseded by
129
- // the very commit it was waiting behind.
130
- const settled = getThread(threadId);
131
- const alreadySettled = queued.boundarySeq === (settled?.hot_since_seq ?? null);
132
- if (!alreadySettled) runBoundaryCompaction(threadId, queued.boundarySeq, queued.options);
133
- });
134
- });
167
+ const baseLock = baseThread?.auto_boundary_locked_until_msg_count ?? 0;
168
+ void runTrackedCompaction(threadId, "auto", boundarySeq, async (attempt) => {
169
+ await Promise.resolve();
170
+ await commitBoundaryCompaction(threadId, boundarySeq, basePinSeq, baseLock, options, attempt);
171
+ })
172
+ .catch((err) => console.warn(`[context-boundary:auto] compaction failed thread=${threadId}: ${String(err)}`))
173
+ .finally(() => drainQueuedBoundary(threadId));
135
174
  }
136
-
137
175
  async function commitBoundaryCompaction(
138
176
  threadId: string,
139
177
  boundarySeq: number,
140
178
  basePinSeq: number | null,
179
+ baseLock: number,
141
180
  options: Pick<WarmContextCompactionOptions, "autoBoundaryLockedUntilMessageCount">,
181
+ attempt?: CompactionAttempt,
142
182
  ): Promise<void> {
143
183
  const committed = await compactThreadWarmContext(threadId, boundarySeq, {
144
184
  expectedHotSinceSeq: basePinSeq,
145
185
  alignTopicBoundary: true,
146
186
  allowEmptySummary: true,
147
187
  ...options,
188
+ attempt,
148
189
  });
149
- if (!committed) return;
190
+ if (!committed) {
191
+ // A pass that resolved to no change (the active topic still starts at the
192
+ // current pin) must not be retried on every following turn either. Skip
193
+ // it when the boundary or lock changed mid-pass (e.g. the user cleared or
194
+ // moved the boundary): that newer state wins over this stale pass.
195
+ const lockUntil = options.autoBoundaryLockedUntilMessageCount;
196
+ const current = getThread(threadId);
197
+ if (
198
+ lockUntil !== undefined &&
199
+ current &&
200
+ (current.hot_since_seq ?? null) === basePinSeq &&
201
+ (current.auto_boundary_locked_until_msg_count ?? 0) === baseLock &&
202
+ lockUntil > baseLock
203
+ ) {
204
+ setAutoBoundaryLock(threadId, lockUntil);
205
+ }
206
+ return;
207
+ }
150
208
  console.info(
151
209
  `[context-boundary:auto] thread=${threadId} committed boundary_seq=${committed.boundarySeq} warm_msgs=${committed.sourceMessages}`,
152
210
  );
@@ -223,13 +281,14 @@ export async function findTopicBoundary(threadId: string, boundarySeq: number):
223
281
  }
224
282
  }
225
283
 
226
- export async function refreshWarmSummary(threadId: string): Promise<void> {
284
+ export async function refreshWarmSummary(threadId: string, attempt?: CompactionAttempt): Promise<void> {
227
285
  const thread = getThread(threadId);
228
286
  if (!thread?.hot_since_seq) return;
229
287
  await compactThreadWarmContext(threadId, thread.hot_since_seq, {
230
288
  expectedHotSinceSeq: thread.hot_since_seq,
231
289
  alignTopicBoundary: false,
232
290
  allowEmptySummary: true,
291
+ attempt,
233
292
  });
234
293
  }
235
294
 
@@ -241,6 +300,9 @@ interface BuiltSummary {
241
300
  // Per-topic segmentation of the same range (see SummaryTopicSegment). Empty
242
301
  // when the summarizer didn't return a `jarela-topics` fence.
243
302
  topics: SummaryTopicSegment[];
303
+ // Topics produced by this pass only; their extracted facts get uplifted.
304
+ // Stored topics merged in earlier were uplifted when they were fresh.
305
+ freshTopics: SummaryTopicSegment[];
244
306
  }
245
307
 
246
308
  export interface CommittedWarmContext {
@@ -250,6 +312,8 @@ export interface CommittedWarmContext {
250
312
  sourceMessages: number;
251
313
  sourceChars: number;
252
314
  topics: SummaryTopicSegment[];
315
+ /** Per automation channel (ADR-0044), committed at the same boundary. */
316
+ channels: Array<{ channel: string; summary: string; sourceMessages: number }>;
253
317
  }
254
318
 
255
319
  export interface WarmContextCompactionOptions {
@@ -258,6 +322,9 @@ export interface WarmContextCompactionOptions {
258
322
  alignTopicBoundary?: boolean;
259
323
  allowEmptySummary?: boolean;
260
324
  autoBoundaryLockedUntilMessageCount?: number;
325
+ /** The tracked attempt this compaction runs under; once it is no longer
326
+ * current (deadline passed or replaced) the result is not committed. */
327
+ attempt?: Pick<CompactionAttempt, "isCurrent">;
261
328
  providerOverride?: {
262
329
  provider: Pick<ModelProvider, "chat">;
263
330
  modelId: string;
@@ -289,13 +356,24 @@ export async function compactThreadWarmContext(
289
356
  if (!boundaryRow) return null;
290
357
  const boundary = boundaryRow.created_at;
291
358
  const built = await buildSummaryBefore(threadId, boundary, boundarySeq, options.providerOverride);
292
- if (!built || (!built.summary && !options.allowEmptySummary)) return null;
359
+ if (!built) return null;
360
+ if (options.attempt && !options.attempt.isCurrent()) return null;
293
361
 
294
362
  const channelSummaries = await Promise.all(AUTOMATION_CHANNEL_ORDER.map(async (channel) => {
295
363
  const channelSummary = await buildAutomationChannelSummaryBefore(threadId, channel, boundarySeq, options.providerOverride);
296
364
  if (!channelSummary) throw new Error(`Could not build ${channel} warm summary`);
297
- return { channel, summary: channelSummary.summary };
365
+ return {
366
+ channel,
367
+ summary: channelSummary.summary,
368
+ sourceMessages: channelSummary.sourceMessages,
369
+ topics: channelSummary.topics ? JSON.stringify(channelSummary.topics) : null,
370
+ };
298
371
  }));
372
+ // A thread whose only activity is automation (e.g. a bridge-only agent) has
373
+ // an empty chat summary but real channel recaps — that is still a result.
374
+ const anySummary = !!built.summary || channelSummaries.some((c) => !!c.summary);
375
+ if (!anySummary && !options.allowEmptySummary) return null;
376
+ if (options.attempt && !options.attempt.isCurrent()) return null;
299
377
 
300
378
  const committed = commitThreadWarmContext(threadId, {
301
379
  hotSince: boundary,
@@ -311,11 +389,13 @@ export async function compactThreadWarmContext(
311
389
  ? options.expectedWarmSummary
312
390
  : (baseThread.warm_summary ?? null),
313
391
  autoBoundaryLockedUntilMessageCount: options.autoBoundaryLockedUntilMessageCount,
314
- channelSummaries,
392
+ channelSummaries: channelSummaries.map(({ channel, summary, topics }) => ({ channel, summary, topics })),
315
393
  });
316
394
  if (!committed) return null;
317
- upliftTopicFacts(built.topics);
318
- return { boundary, boundarySeq, ...built };
395
+ upliftTopicFacts(built.freshTopics);
396
+ const { freshTopics: _fresh, ...context } = built;
397
+ const channels = channelSummaries.map(({ channel, summary, sourceMessages }) => ({ channel, summary, sourceMessages }));
398
+ return { boundary, boundarySeq, ...context, channels };
319
399
  }
320
400
 
321
401
  /**
@@ -351,40 +431,55 @@ async function buildSummaryBefore(
351
431
  ? providerParams.context_window_tokens
352
432
  : 32768;
353
433
  const summaryInputChars = Math.max(4000, Math.min(120000, Math.round(contextTokens * 3)));
354
- const eligibleRows = takeRecentWarmMessages(rows.filter((m) => m.seq < boundarySeq), agent.warm_summary_limit);
355
- const selectedRows: typeof eligibleRows = [];
356
- const selectedTranscript: string[] = [];
357
- let selectedTranscriptChars = 0;
358
- for (let index = eligibleRows.length - 1; index >= 0; index -= 1) {
359
- const row = eligibleRows[index];
360
- const formatted = `[seq=${row.seq}] [${row.created_at}] ${row.role === "user" ? "User" : "Assistant"}: ${transcriptText(row.content)}`;
361
- const addedChars = formatted.length + (selectedTranscript.length > 0 ? 2 : 0);
362
- if (selectedTranscriptChars + addedChars > summaryInputChars) break;
363
- selectedRows.unshift(row);
364
- selectedTranscript.unshift(formatted);
365
- selectedTranscriptChars += addedChars;
434
+ const provider = providerOverride?.provider ?? getProvider(modelCfg.provider);
435
+ const modelId = providerOverride?.modelId ?? modelCfg.model_id;
436
+ const summaryParams = providerParams.max_tokens
437
+ ? providerParams
438
+ : { ...providerParams, max_tokens: 1024 };
439
+
440
+ const outcome = await runTopicCompaction({
441
+ threadId,
442
+ source: "chat",
443
+ rows,
444
+ storedTopics: parseStoredTopics(thread.warm_summary_topics),
445
+ storedBeforeSeq: thread.warm_summary_before_seq,
446
+ boundarySeq,
447
+ warmSummaryLimit: agent.warm_summary_limit,
448
+ summaryInputChars,
449
+ provider,
450
+ modelId,
451
+ params: summaryParams,
452
+ });
453
+ if (outcome.status === "empty") {
454
+ return { summary: "", sourceMessages: outcome.sourceMessages, sourceChars: outcome.sourceChars, topics: [], freshTopics: [] };
455
+ }
456
+ if (outcome.status === "topics") {
457
+ return {
458
+ summary: wrapTopicSummary(outcome.topics),
459
+ sourceMessages: outcome.sourceMessages,
460
+ sourceChars: outcome.sourceChars,
461
+ topics: outcome.topics,
462
+ freshTopics: outcome.freshTopics,
463
+ };
366
464
  }
465
+ console.warn(`[warm-summary] thread=${threadId} compaction pipeline failed validation; using single-call summary`);
466
+
467
+ const eligibleRows = takeRecentWarmMessages(rows.filter((m) => m.seq < boundarySeq), agent.warm_summary_limit);
468
+ const { selectedRows, transcript } = selectTranscriptRows(eligibleRows, summaryInputChars);
367
469
  const selectedSourceChars = selectedRows.reduce((total, row) => total + transcriptText(row.content).length, 0);
368
470
  if (selectedSourceChars < 24 || selectedRows.length < 2) {
369
- return { summary: "", sourceMessages: selectedRows.length, sourceChars: selectedSourceChars, topics: [] };
471
+ return { summary: "", sourceMessages: selectedRows.length, sourceChars: selectedSourceChars, topics: [], freshTopics: [] };
370
472
  }
371
473
 
372
- const transcript = selectedTranscript.join("\n\n").trim();
373
474
  if (!transcript) return null;
374
475
 
375
- const provider = providerOverride?.provider ?? getProvider(modelCfg.provider);
376
- const modelId = providerOverride?.modelId ?? modelCfg.model_id;
377
- const summaryParams = providerParams.max_tokens
378
- ? providerParams
379
- : { ...providerParams, max_tokens: 1024 };
380
-
381
476
  const raw = (await summarizeTranscript(provider, modelId, summaryParams, transcript)).trim();
382
477
  if (!raw) return null;
383
478
  const { body, topics } = extractTopicSegments(raw);
384
- const validatedTopics = validateTopicSegments(topics, rows, selectedRows, {
479
+ const validatedTopics = finalizeFreshTopics(validateTopicSegments(topics, rows, selectedRows, {
385
480
  boundarySeq,
386
481
  allowPartialStart: true,
387
- });
482
+ }), selectedRows);
388
483
  const summarizedSeqs = new Set(validatedTopics.flatMap((topic) =>
389
484
  selectedRows
390
485
  .filter((row) => row.seq >= topic.start_seq! && row.seq <= topic.end_seq!)
@@ -393,31 +488,119 @@ async function buildSummaryBefore(
393
488
  const summarizedRows = validatedTopics.length > 0
394
489
  ? selectedRows.filter((row) => summarizedSeqs.has(row.seq))
395
490
  : selectedRows;
396
- const summary = validatedTopics.length > 0
397
- ? renderTopicRecaps(validatedTopics)
398
- : body;
399
- if (!summary) return null;
491
+ if (validatedTopics.length === 0 && !body) return null;
400
492
  const sourceMessages = summarizedRows.length;
401
493
  const sourceChars = summarizedRows.reduce((total, row) => total + transcriptText(row.content).length, 0);
402
494
 
403
495
  return {
404
- summary: [
405
- "--- Warm context summary ---",
406
- "Compressed recap of recent messages immediately before the hot window:",
407
- summary,
408
- ].join("\n"),
496
+ summary: validatedTopics.length > 0 ? wrapTopicSummary(validatedTopics) : wrapTopicSummary(null, body),
409
497
  sourceMessages,
410
498
  sourceChars,
411
499
  topics: validatedTopics,
500
+ freshTopics: validatedTopics,
412
501
  };
413
502
  }
414
503
 
415
- function renderTopicRecaps(topics: readonly SummaryTopicSegment[]): string {
416
- return topics.map((topic) =>
417
- `### ${topic.title}${topic.partial_start ? " (partial; earlier messages omitted)" : ""}\n${topic.recap}`,
418
- ).join("\n\n");
504
+ type TopicCompactionOutcome =
505
+ | { status: "empty"; sourceMessages: number; sourceChars: number }
506
+ | { status: "topics"; topics: SummaryTopicSegment[]; freshTopics: SummaryTopicSegment[]; sourceMessages: number; sourceChars: number }
507
+ | { status: "failed" };
508
+
509
+ interface TopicCompactionInput<T extends PipelineSourceRow> {
510
+ threadId: string;
511
+ source: CompactionSource;
512
+ /** Every row of this message stream, ascending by seq. */
513
+ rows: readonly T[];
514
+ storedTopics: SummaryTopicSegment[] | null;
515
+ storedBeforeSeq: number | null | undefined;
516
+ boundarySeq: number;
517
+ warmSummaryLimit: number | null | undefined;
518
+ summaryInputChars: number;
519
+ provider: Pick<ModelProvider, "chat">;
520
+ modelId: string;
521
+ params: ProviderParams;
419
522
  }
420
523
 
524
+ /**
525
+ * Shared by chat and every automation channel: run the compaction pipeline
526
+ * (lib/agents/compaction-pipeline.ts) over one message stream. Incremental
527
+ * when the stored topics can be extended — only rows that aged out of hot
528
+ * since the last pass are folded in; otherwise the recent warm window is
529
+ * regrouped from scratch. "failed" tells the caller to use its single-call
530
+ * fallback.
531
+ */
532
+ async function runTopicCompaction<T extends PipelineSourceRow>(input: TopicCompactionInput<T>): Promise<TopicCompactionOutcome> {
533
+ const { threadId, source, rows, storedTopics, storedBeforeSeq, boundarySeq } = input;
534
+ const messageLimit = warmSummaryMessageLimit(input.warmSummaryLimit);
535
+ const incremental = messageLimit > 0 && canMergeIntoTopics(storedTopics, storedBeforeSeq, boundarySeq);
536
+ const priorTopics = incremental ? storedTopics! : [];
537
+ const candidates = incremental
538
+ ? rows.filter((m) => m.seq >= storedBeforeSeq! && m.seq < boundarySeq)
539
+ : takeRecentWarmMessages(rows.filter((m) => m.seq < boundarySeq), input.warmSummaryLimit);
540
+ const { selectedRows } = selectTranscriptRows(candidates, input.summaryInputChars);
541
+ if (incremental && selectedRows.length === 0) {
542
+ const kept = mergeWarmTopics(priorTopics, [], messageLimit);
543
+ return { status: "topics", topics: kept.topics, freshTopics: [], sourceMessages: kept.sourceMessages, sourceChars: kept.sourceChars };
544
+ }
545
+ const selectedChars = selectedRows.reduce((total, row) => total + transcriptText(row.content).length, 0);
546
+ if (!incremental && (selectedChars < 24 || selectedRows.length < 2)) {
547
+ return { status: "empty", sourceMessages: selectedRows.length, sourceChars: selectedChars };
548
+ }
549
+ const firstSeq = selectedRows[0]?.seq ?? boundarySeq;
550
+ const label = `[warm-summary] thread=${threadId} source=${source} ${incremental ? "merge" : "rebuild"}`;
551
+ const pipeline = await runCompactionPipeline({
552
+ provider: input.provider,
553
+ modelId: input.modelId,
554
+ params: input.params,
555
+ rows: selectedRows,
556
+ priorTopics,
557
+ messageLimit: messageLimit > 0 ? messageLimit : selectedRows.length,
558
+ partialStart: !incremental && rows.some((m) => m.seq < firstSeq),
559
+ source,
560
+ log: (message) => console.info(`${label} ${message}`),
561
+ }).catch((err: unknown) => {
562
+ console.warn(`${label} compaction pipeline threw:`, err);
563
+ return null;
564
+ });
565
+ if (!pipeline) return { status: "failed" };
566
+ return {
567
+ status: "topics",
568
+ topics: pipeline.topics,
569
+ freshTopics: pipeline.freshTopics,
570
+ sourceMessages: pipeline.sourceMessages,
571
+ sourceChars: pipeline.sourceChars,
572
+ };
573
+ }
574
+
575
+ function selectTranscriptRows<T extends { seq: number; created_at: string; role: string; content: string }>(
576
+ rows: readonly T[],
577
+ budgetChars: number,
578
+ ): { selectedRows: T[]; transcript: string } {
579
+ // Newest first, so a budget overflow drops the oldest messages.
580
+ const selectedRows: T[] = [];
581
+ const parts: string[] = [];
582
+ let chars = 0;
583
+ for (let index = rows.length - 1; index >= 0; index -= 1) {
584
+ const row = rows[index];
585
+ const formatted = formatTranscriptRow(row);
586
+ const added = formatted.length + (parts.length > 0 ? 2 : 0);
587
+ if (chars + added > budgetChars) break;
588
+ selectedRows.unshift(row);
589
+ parts.unshift(formatted);
590
+ chars += added;
591
+ }
592
+ return { selectedRows, transcript: parts.join("\n\n").trim() };
593
+ }
594
+
595
+ function wrapTopicSummary(topics: readonly SummaryTopicSegment[] | null, body = ""): string {
596
+ return [
597
+ "--- Warm context summary ---",
598
+ "Compressed recap of recent messages immediately before the hot window:",
599
+ topics ? renderTopicRecaps(topics) : body,
600
+ ].join("\n");
601
+ }
602
+
603
+
421
604
  // Batched uplift (once per compaction pass, covering every topic segment
422
605
  // together — not fired per-segment as each is identified). Direct writes,
423
606
  // same as the agent-facing memory_upsert tool: background compaction has
@@ -428,7 +611,9 @@ export function upliftTopicFacts(topics: readonly SummaryTopicSegment[]): void {
428
611
  const seenKeys = new Set<string>();
429
612
  for (const topic of topics) {
430
613
  for (const fact of topic.facts) {
431
- const key = slugifyForMemoryKey(fact.subject);
614
+ // The agent already saved this one during the turn; don't overwrite it.
615
+ if (fact.origin === "agent") continue;
616
+ const key = fact.key?.startsWith("facts/") ? fact.key.slice("facts/".length) : slugifyForMemoryKey(fact.subject);
432
617
  if (!key || seenKeys.has(key)) continue;
433
618
  seenKeys.add(key);
434
619
  putMemory("facts", key, {
@@ -449,34 +634,45 @@ export function upliftTopicFacts(topics: readonly SummaryTopicSegment[]): void {
449
634
  }
450
635
  }
451
636
 
452
- function slugifyForMemoryKey(subject: string): string {
453
- return subject
454
- .toLowerCase()
455
- .replace(/[^a-z0-9]+/g, "-")
456
- .replace(/^-+|-+$/g, "")
457
- .slice(0, 80);
458
- }
459
-
460
637
  export interface BuiltChannelSummary {
461
638
  /** "" when there was too little automation activity to summarise. */
462
639
  summary: string;
463
640
  sourceMessages: number;
464
641
  sourceChars: number;
642
+ /** Stored topics when the compaction pipeline produced them; null for the single-call fallback. */
643
+ topics: SummaryTopicSegment[] | null;
644
+ }
645
+
646
+ const AUTOMATION_COMPACTION_SOURCES: readonly CompactionSource[] = ["scheduled_task", "watcher", "bridge"];
647
+
648
+ function automationCompactionSource(channel: string): CompactionSource {
649
+ return (AUTOMATION_COMPACTION_SOURCES as readonly string[]).includes(channel) ? channel as CompactionSource : "scheduled_task";
650
+ }
651
+
652
+ // ADR-0044 channels never uplift facts to memory, so the only facts a channel
653
+ // topic keeps are memory the agent itself saved there (verified in code).
654
+ function keepSavedFactsOnly(topics: readonly SummaryTopicSegment[]): SummaryTopicSegment[] {
655
+ return topics.map((topic) => ({ ...topic, facts: topic.facts.filter((fact) => fact.origin === "agent") }));
656
+ }
657
+
658
+ function wrapChannelSummary(channel: string, body: string): string {
659
+ return [
660
+ `--- ${channel} activity summary ---`,
661
+ "Compressed recap of automation activity outside the hot window:",
662
+ body,
663
+ ].join("\n");
465
664
  }
466
665
 
467
666
  // ADR-0044 — the automation-channel counterpart to buildSummaryBefore. Chat
468
- // keeps using buildSummaryBefore/compactThreadWarmContext unchanged (the
469
- // legacy threads.warm_summary* columns ARE the "chat" channel's summary,
470
- // per the ADR's fallback design); this covers scheduled_task/watcher/bridge,
471
- // each cached in its own thread_channel_summaries row.
667
+ // keeps using buildSummaryBefore/compactThreadWarmContext (the legacy
668
+ // threads.warm_summary* columns ARE the "chat" channel's summary, per the
669
+ // ADR's fallback design); this covers scheduled_task/watcher/bridge, each
670
+ // cached in its own thread_channel_summaries row.
472
671
  //
473
- // Deliberately simpler than buildSummaryBefore: no extend-prior-summary
474
- // optimisation (thread_channel_summaries has no source_messages/source_chars
475
- // columns to carry a running count across calls) and no topic-fact uplift —
476
- // automation activity logs are far lower volume than interactive chat and
477
- // far less likely to carry durable personal facts worth extracting. Every
478
- // call re-summarises the full channel history below the boundary from
479
- // scratch; acceptable given the expected message counts.
672
+ // Same compaction pipeline as chat (group -> recap -> merge, incremental into
673
+ // the channel's stored topics), with source-specific prompt wording. Unlike
674
+ // chat there is no topic-fact uplift: automation logs rarely carry durable
675
+ // personal facts, so channel topics only keep memory the agent saved itself.
480
676
  async function buildAutomationChannelSummaryBefore(
481
677
  threadId: string,
482
678
  channel: string,
@@ -497,43 +693,52 @@ async function buildAutomationChannelSummaryBefore(
497
693
  const providerParams = tier ? { ...baseParams, context_tier_proportions: tier } : baseParams;
498
694
 
499
695
  const rows = getMessagesByAutomationCategory(threadId, channel);
500
- const eligibleRows = rows.filter((m) => m.seq < boundarySeq);
501
- const warmRows = takeRecentWarmMessages(
502
- eligibleRows,
503
- agent.warm_summary_limit,
504
- );
505
-
506
696
  const contextTokens = typeof providerParams.context_window_tokens === "number"
507
697
  ? providerParams.context_window_tokens
508
698
  : 32768;
509
699
  const summaryInputChars = Math.max(4000, Math.min(120000, Math.round(contextTokens * 3)));
700
+ const provider = providerOverride?.provider ?? getProvider(modelCfg.provider);
701
+ const modelId = providerOverride?.modelId ?? modelCfg.model_id;
702
+ const summaryParams = providerParams.max_tokens
703
+ ? providerParams
704
+ : { ...providerParams, max_tokens: 1024 };
510
705
 
511
- const selectedRows: typeof warmRows = [];
512
- const selectedTranscript: string[] = [];
513
- let selectedTranscriptChars = 0;
514
- for (let index = warmRows.length - 1; index >= 0; index -= 1) {
515
- const row = warmRows[index];
516
- const formatted = `[seq=${row.seq}] [${row.created_at}] ${row.role === "user" ? "User" : "Assistant"}: ${transcriptText(row.content)}`;
517
- const addedChars = formatted.length + (selectedTranscript.length > 0 ? 2 : 0);
518
- if (selectedTranscriptChars + addedChars > summaryInputChars) break;
519
- selectedRows.unshift(row);
520
- selectedTranscript.unshift(formatted);
521
- selectedTranscriptChars += addedChars;
706
+ const stored = getThreadChannelSummary(threadId, channel);
707
+ const outcome = await runTopicCompaction({
708
+ threadId,
709
+ source: automationCompactionSource(channel),
710
+ rows,
711
+ storedTopics: parseStoredTopics(stored?.topics ?? null),
712
+ storedBeforeSeq: stored?.summary_before_seq,
713
+ boundarySeq,
714
+ warmSummaryLimit: agent.warm_summary_limit,
715
+ summaryInputChars,
716
+ provider,
717
+ modelId,
718
+ params: summaryParams,
719
+ });
720
+ if (outcome.status === "empty") {
721
+ return { summary: "", sourceMessages: outcome.sourceMessages, sourceChars: outcome.sourceChars, topics: null };
722
+ }
723
+ if (outcome.status === "topics") {
724
+ const topics = keepSavedFactsOnly(outcome.topics);
725
+ return {
726
+ summary: topics.length > 0 ? wrapChannelSummary(channel, renderTopicRecaps(topics)) : "",
727
+ sourceMessages: outcome.sourceMessages,
728
+ sourceChars: outcome.sourceChars,
729
+ topics,
730
+ };
522
731
  }
732
+ console.warn(`[warm-summary] thread=${threadId} ${channel} compaction pipeline failed validation; using single-call summary`);
733
+
734
+ const eligibleRows = takeRecentWarmMessages(rows.filter((m) => m.seq < boundarySeq), agent.warm_summary_limit);
735
+ const { selectedRows, transcript } = selectTranscriptRows(eligibleRows, summaryInputChars);
523
736
  const sourceChars = selectedRows.reduce((total, row) => total + transcriptText(row.content).length, 0);
524
737
  if (sourceChars < 24 || selectedRows.length < 2) {
525
- return { summary: "", sourceMessages: selectedRows.length, sourceChars };
738
+ return { summary: "", sourceMessages: selectedRows.length, sourceChars, topics: null };
526
739
  }
527
-
528
- const transcript = selectedTranscript.join("\n\n").trim();
529
740
  if (!transcript) return null;
530
741
 
531
- const provider = providerOverride?.provider ?? getProvider(modelCfg.provider);
532
- const modelId = providerOverride?.modelId ?? modelCfg.model_id;
533
- const summaryParams = providerParams.max_tokens
534
- ? providerParams
535
- : { ...providerParams, max_tokens: 1024 };
536
-
537
742
  const raw = (await summarizeTranscript(provider, modelId, summaryParams, transcript)).trim();
538
743
  if (!raw) return null;
539
744
  const { body, topics } = extractTopicSegments(raw);
@@ -542,7 +747,7 @@ async function buildAutomationChannelSummaryBefore(
542
747
  allowPartialStart: true,
543
748
  });
544
749
  const summary = validatedTopics.length > 0
545
- ? renderTopicRecaps(validatedTopics)
750
+ ? renderTopicRecaps(validatedTopics.map((topic) => ({ ...topic, facts: [] })))
546
751
  : body;
547
752
  if (!summary) return null;
548
753
  const summarizedSeqs = new Set(validatedTopics.flatMap((topic) =>
@@ -556,13 +761,10 @@ async function buildAutomationChannelSummaryBefore(
556
761
  const summarizedChars = summarizedRows.reduce((total, row) => total + transcriptText(row.content).length, 0);
557
762
 
558
763
  return {
559
- summary: [
560
- `--- ${channel} activity summary ---`,
561
- "Compressed recap of automation activity outside the hot window:",
562
- summary,
563
- ].join("\n"),
764
+ summary: wrapChannelSummary(channel, summary),
564
765
  sourceMessages: summarizedRows.length,
565
766
  sourceChars: summarizedChars,
767
+ topics: null,
566
768
  };
567
769
  }
568
770
 
@@ -586,6 +788,7 @@ export async function compactAutomationChannelWarmContext(
586
788
  summary: built.summary,
587
789
  summaryBefore: boundary,
588
790
  summaryBeforeSeq: boundarySeq,
791
+ topics: built.topics ? JSON.stringify(built.topics) : null,
589
792
  });
590
793
  return built;
591
794
  }