@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,6 @@
1
1
  "use strict";
2
- exports.id = 424;
3
- exports.ids = [424,3944,8154];
2
+ exports.id = 1388;
3
+ exports.ids = [1388,8154];
4
4
  exports.modules = {
5
5
 
6
6
  /***/ 2522:
@@ -27,9 +27,6 @@ const state = (0,global_state/* getOrCreateGlobal */.X)("__jarela_trigger_regist
27
27
  function registerTriggerHandler(handler) {
28
28
  state.handlers.set(handler.kind, handler);
29
29
  }
30
- function getTriggerHandler(kind) {
31
- return state.handlers.get(kind);
32
- }
33
30
  function registry_listTriggerHandlers() {
34
31
  return Array.from(state.handlers.values());
35
32
  }
@@ -1364,120 +1361,6 @@ registerHandlers();
1364
1361
 
1365
1362
 
1366
1363
 
1367
- /***/ }),
1368
-
1369
- /***/ 3944:
1370
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1371
-
1372
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1373
- /* harmony export */ M6: () => (/* binding */ enqueueThreadRun),
1374
- /* harmony export */ Zm: () => (/* binding */ QueueFullError),
1375
- /* harmony export */ getQueueDepth: () => (/* binding */ getQueueDepth),
1376
- /* harmony export */ vR: () => (/* binding */ QueueExpiredError)
1377
- /* harmony export */ });
1378
- /* unused harmony export __resetForTests */
1379
- /* harmony import */ var _lib_utils_global_state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15559);
1380
- // Per-thread priority queue for agent runs.
1381
- //
1382
- // A thread can have one active run. Waiting interactive runs are selected
1383
- // before waiting background runs, while FIFO order is preserved within each
1384
- // lane. Different threads drain independently.
1385
- //
1386
- // In-memory + single-process. Multi-instance deployment would need a shared
1387
- // lock (Redis, Postgres advisory locks) — explicitly out of scope.
1388
-
1389
- const queues = (0,_lib_utils_global_state__WEBPACK_IMPORTED_MODULE_0__/* .getOrCreateGlobal */ .X)("__jarela_thread_run_queues", ()=>new Map());
1390
- const DEFAULT_MAX_DEPTH = 16;
1391
- const sourceLanes = {
1392
- user: "interactive",
1393
- bridge: "interactive",
1394
- delegate: "interactive",
1395
- scheduler: "background",
1396
- watcher: "background",
1397
- trigger: "background",
1398
- extension: "background"
1399
- };
1400
- class QueueFullError extends Error {
1401
- constructor(thread_id, depth){
1402
- super(`Per-thread run queue full for thread ${thread_id} (depth=${depth})`);
1403
- this.name = "QueueFullError";
1404
- }
1405
- }
1406
- class QueueExpiredError extends Error {
1407
- constructor(thread_id, expiresAt){
1408
- super(`Queued run expired for thread ${thread_id} at ${expiresAt}`);
1409
- this.name = "QueueExpiredError";
1410
- }
1411
- }
1412
- function depth(queue) {
1413
- return (queue.active ? 1 : 0) + queue.interactive.length + queue.background.length;
1414
- }
1415
- function drain(thread_id, queue) {
1416
- if (queue.active) return;
1417
- const job = queue.interactive.shift() ?? queue.background.shift();
1418
- if (!job) {
1419
- if (queues.get(thread_id) === queue) queues.delete(thread_id);
1420
- return;
1421
- }
1422
- queue.active = job;
1423
- Promise.resolve().then(()=>{
1424
- if (job.expiresAt !== undefined && Date.now() >= job.expiresAt) {
1425
- throw new QueueExpiredError(thread_id, job.expiresAt);
1426
- }
1427
- return job.runner();
1428
- }).then((value)=>{
1429
- finish(thread_id, queue);
1430
- job.resolve(value);
1431
- }, (error)=>{
1432
- finish(thread_id, queue);
1433
- job.reject(error);
1434
- });
1435
- }
1436
- function finish(thread_id, queue) {
1437
- queue.active = undefined;
1438
- if (queues.get(thread_id) === queue) drain(thread_id, queue);
1439
- }
1440
- function enqueueThreadRun(thread_id, source, runner, options = {}) {
1441
- const queue = queues.get(thread_id) ?? {
1442
- interactive: [],
1443
- background: []
1444
- };
1445
- const currentDepth = depth(queue);
1446
- const max = options.maxDepth ?? DEFAULT_MAX_DEPTH;
1447
- if (currentDepth >= max) {
1448
- throw new QueueFullError(thread_id, currentDepth);
1449
- }
1450
- const lane = options.lane ?? sourceLanes[source];
1451
- const position = queue.active ? 1 + queue.interactive.length + (lane === "background" ? queue.background.length : 0) : queue.interactive.length + (lane === "background" ? queue.background.length : 0);
1452
- let resolve;
1453
- let reject;
1454
- const result = new Promise((res, rej)=>{
1455
- resolve = res;
1456
- reject = rej;
1457
- });
1458
- const job = {
1459
- runner,
1460
- expiresAt: options.expiresAt,
1461
- resolve,
1462
- reject
1463
- };
1464
- queue[lane].push(job);
1465
- queues.set(thread_id, queue);
1466
- drain(thread_id, queue);
1467
- return {
1468
- result,
1469
- position
1470
- };
1471
- }
1472
- /** Current queue depth for a thread, including the active job. */ function getQueueDepth(thread_id) {
1473
- const queue = queues.get(thread_id);
1474
- return queue ? depth(queue) : 0;
1475
- }
1476
- /** Reset all queue state. Test-only — never call from production code. */ function __resetForTests() {
1477
- queues.clear();
1478
- }
1479
-
1480
-
1481
1364
  /***/ }),
1482
1365
 
1483
1366
  /***/ 5209:
@@ -1490,18 +1373,20 @@ function enqueueThreadRun(thread_id, source, runner, options = {}) {
1490
1373
  /* harmony import */ var _lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(41720);
1491
1374
  /* harmony import */ var _lib_stores_threads__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(83042);
1492
1375
  /* harmony import */ var _lib_stores_memory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(80956);
1493
- /* harmony import */ var _lib_agents_warm_summary_background__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(79640);
1494
- /* harmony import */ var _lib_env_config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(67500);
1376
+ /* harmony import */ var _lib_agents_warm_summary_background__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(36923);
1377
+ /* harmony import */ var _lib_agents_thread_compaction_state__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(87313);
1378
+ /* harmony import */ var _lib_env_config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(67500);
1379
+
1495
1380
 
1496
1381
 
1497
1382
 
1498
1383
 
1499
1384
 
1500
1385
  function maxThreadMessages() {
1501
- return (0,_lib_env_config__WEBPACK_IMPORTED_MODULE_4__/* .getConfig */ .z)().maxThreadMessages;
1386
+ return (0,_lib_env_config__WEBPACK_IMPORTED_MODULE_5__/* .getConfig */ .z)().maxThreadMessages;
1502
1387
  }
1503
1388
  function maxSessionArchives() {
1504
- return (0,_lib_env_config__WEBPACK_IMPORTED_MODULE_4__/* .getConfig */ .z)().maxSessionArchives;
1389
+ return (0,_lib_env_config__WEBPACK_IMPORTED_MODULE_5__/* .getConfig */ .z)().maxSessionArchives;
1505
1390
  }
1506
1391
  function autoCompactionKeepLast(cap) {
1507
1392
  return Math.max(1, cap - Math.max(20, Math.ceil(cap * 0.1)));
@@ -1532,19 +1417,43 @@ async function compactAgentThread(agentId, keepLast = maxThreadMessages(), reset
1532
1417
  const lastRow = rows[rows.length - 1];
1533
1418
  const boundaryRow = fullSessionReset ? null : rows[Math.max(0, rows.length - keepLast)] ?? lastRow;
1534
1419
  const boundarySeq = fullSessionReset ? lastRow.seq + 1 : boundaryRow.seq;
1535
- const context = await (0,_lib_agents_warm_summary_background__WEBPACK_IMPORTED_MODULE_3__/* .trackManualCompaction */ .bO)(thread.thread_id, boundarySeq, ()=>(0,_lib_agents_warm_summary_background__WEBPACK_IMPORTED_MODULE_3__/* .compactThreadWarmContext */ .gQ)(thread.thread_id, boundarySeq, {
1536
- expectedHotSinceSeq: thread.hot_since_seq ?? null,
1537
- alignTopicBoundary: !fullSessionReset
1538
- }));
1420
+ if ((0,_lib_agents_warm_summary_background__WEBPACK_IMPORTED_MODULE_3__/* .isManualCompactionRunning */ .xU)(thread.thread_id)) {
1421
+ return {
1422
+ compacted: false,
1423
+ reason: "already compacting"
1424
+ };
1425
+ }
1426
+ let context;
1427
+ try {
1428
+ context = await (0,_lib_agents_warm_summary_background__WEBPACK_IMPORTED_MODULE_3__/* .trackManualCompaction */ .bO)(thread.thread_id, boundarySeq, (attempt)=>(0,_lib_agents_warm_summary_background__WEBPACK_IMPORTED_MODULE_3__/* .compactThreadWarmContext */ .gQ)(thread.thread_id, boundarySeq, {
1429
+ expectedHotSinceSeq: thread.hot_since_seq ?? null,
1430
+ alignTopicBoundary: !fullSessionReset,
1431
+ attempt
1432
+ }));
1433
+ } catch (err) {
1434
+ if (err instanceof _lib_agents_thread_compaction_state__WEBPACK_IMPORTED_MODULE_4__/* .CompactionTimeoutError */ .nQ) return {
1435
+ compacted: false,
1436
+ reason: "timed out"
1437
+ };
1438
+ throw err;
1439
+ }
1539
1440
  if (!context) return {
1540
1441
  compacted: false,
1541
- reason: "summary was not committed"
1442
+ reason: "no summary produced"
1542
1443
  };
1444
+ // Automation channels (bridge, watcher, scheduled task) are compacted at the
1445
+ // same boundary; a bridge-only agent has nothing but channel recaps.
1446
+ const channelRecaps = context.channels.filter((c)=>!!c.summary);
1447
+ const archivedSummary = [
1448
+ context.summary,
1449
+ ...channelRecaps.map((c)=>c.summary)
1450
+ ].filter(Boolean).join("\n\n");
1451
+ const messageCount = context.sourceMessages + channelRecaps.reduce((n, c)=>n + c.sourceMessages, 0);
1543
1452
  (0,_lib_stores_memory__WEBPACK_IMPORTED_MODULE_2__/* .putMemory */ .Ri)("sessions", `${agentId}/${Date.now()}`, {
1544
- summary: context.summary,
1453
+ summary: archivedSummary,
1545
1454
  agent_id: agentId,
1546
1455
  agent_name: agent.name,
1547
- message_count: context.sourceMessages,
1456
+ message_count: messageCount,
1548
1457
  compacted_at: new Date().toISOString()
1549
1458
  });
1550
1459
  const archivePruned = pruneSessionArchives(agentId, maxSessionArchives());
@@ -1553,7 +1462,7 @@ async function compactAgentThread(agentId, keepLast = maxThreadMessages(), reset
1553
1462
  return {
1554
1463
  compacted: true,
1555
1464
  summary: context.summary,
1556
- message_count: context.sourceMessages,
1465
+ message_count: messageCount,
1557
1466
  context_chars: context.sourceChars,
1558
1467
  pruned,
1559
1468
  archive_pruned: archivePruned,
@@ -2219,7 +2128,7 @@ __webpack_require__.d(__webpack_exports__, {
2219
2128
  rw: () => (/* reexport */ applyToolBindBudget),
2220
2129
  o8: () => (/* reexport */ executeTool),
2221
2130
  tA: () => (/* reexport */ getAllToolCatalogAsync),
2222
- n0: () => (/* reexport */ runtime_getAllToolsAsync),
2131
+ n0: () => (/* reexport */ getAllToolsAsync),
2223
2132
  sT: () => (/* reexport */ getBuiltinToolNames),
2224
2133
  vL: () => (/* reexport */ getDefaultAgentToolNames),
2225
2134
  iD: () => (/* reexport */ isHotLoadTool),
@@ -2227,7 +2136,7 @@ __webpack_require__.d(__webpack_exports__, {
2227
2136
  pe: () => (/* reexport */ toOpenAITools)
2228
2137
  });
2229
2138
 
2230
- // UNUSED EXPORTS: allBuiltins, builtinNames, getAllTools, getDefaultAgentToolNamesAsync, getPackagesDir, getToolCapability, getToolCategory, getToolCredentialsRequired, getToolGroup, getToolIntegration, getToolSource, getToolsDir, initTools, loadExternal, loadLangChainPackages, registerTools, reloadLangChainPackages, toCatalogEntry
2139
+ // UNUSED EXPORTS: allBuiltins, builtinNames, getAllTools, getPackagesDir, getToolCategory, getToolCredentialsRequired, getToolIntegration, getToolSource, getToolsDir, initTools, loadExternal, loadLangChainPackages, registerTools, reloadLangChainPackages, toCatalogEntry
2231
2140
 
2232
2141
  // EXTERNAL MODULE: ./lib/tools/runtime/external.ts
2233
2142
  var external = __webpack_require__(16836);
@@ -2382,7 +2291,7 @@ const memoryUpsertTool = (0,tools/* tool */.z6)(async ({ namespace, key, record
2382
2291
  });
2383
2292
  }, {
2384
2293
  name: "memory_upsert",
2385
- description: "Store a durable, structured memory record for proactive semantic recall. Use namespace='facts' for information that should surface in future conversations. Store explicit user preferences, verified facts, decisions, constraints, and reusable project context; do not store transient chat details or secrets. Use an expiry for temporary facts, and status='archived' to soft-retire a record instead of deleting it.",
2294
+ description: "Store a durable, structured memory record for proactive semantic recall. Use namespace='facts' for information that should surface in future conversations. Store explicit user preferences, verified facts, decisions, constraints, and reusable project context; do not store transient chat details or secrets. Use an expiry for temporary facts, and status='archived' to soft-retire a record instead of deleting it. Save proactively in the same turn the information appears so other agents can use it immediately; do not defer to background compaction.",
2386
2295
  schema: schemas/* object */.Ikc({
2387
2296
  namespace: schemas/* string */.YjP().describe("Memory namespace. Use 'facts' for proactively recalled durable knowledge."),
2388
2297
  key: schemas/* string */.YjP().describe("Stable, descriptive key such as 'user-research-preference' or 'project-auth-decision'."),
@@ -3842,10 +3751,13 @@ function fuzzyUniqueRange(raw, oldString) {
3842
3751
  if (oldLines.some((line)=>line.length === 0)) return [];
3843
3752
  const rawLines = raw.split(/\r\n|\r|\n/);
3844
3753
  const rawLineStarts = [];
3754
+ const eol = /\r\n|\r|\n/g;
3845
3755
  let offset = 0;
3846
3756
  for (const line of rawLines){
3847
3757
  rawLineStarts.push(offset);
3848
- offset += line.length + 1;
3758
+ eol.lastIndex = offset + line.length;
3759
+ const brk = eol.exec(raw);
3760
+ offset = offset + line.length + (brk ? brk[0].length : 0);
3849
3761
  }
3850
3762
  const scores = [];
3851
3763
  for(let i = 0; i + oldLines.length <= rawLines.length; i++){
@@ -3902,7 +3814,9 @@ function findAllExact(haystack, needle) {
3902
3814
  function findWithTransforms(raw, oldString, fns) {
3903
3815
  const bufT = composeTransforms(raw, fns);
3904
3816
  const oldT = composeTransforms(oldString, fns);
3905
- if (oldT.text.length === 0) return [];
3817
+ // A needle that normalizes to bare whitespace would match an arbitrary
3818
+ // line break, so it can never identify an edit target.
3819
+ if (oldT.text.trim().length === 0) return [];
3906
3820
  const starts = findAllExact(bufT.text, oldT.text);
3907
3821
  return starts.map((s)=>({
3908
3822
  start: bufT.toOriginal[s],
@@ -8390,8 +8304,8 @@ const getIntegrationSetupTool = (0,tools/* tool */.z6)(async ({ id })=>{
8390
8304
  }
8391
8305
  });
8392
8306
 
8393
- // EXTERNAL MODULE: ./lib/stores/version-adoption.ts + 2 modules
8394
- var version_adoption = __webpack_require__(95936);
8307
+ // EXTERNAL MODULE: ./lib/stores/version-adoption.ts + 4 modules
8308
+ var version_adoption = __webpack_require__(96570);
8395
8309
  ;// ./lib/tools/general/workflow-progress.ts
8396
8310
 
8397
8311
 
@@ -8423,7 +8337,8 @@ const workflowProgressSchema = schemas/* object */.Ikc({
8423
8337
  validation_evidence: schemas/* string */.YjP().trim().min(1).max(500).optional().describe("Exact check performed and observed result. Required when marking a version_adoption item done."),
8424
8338
  summary: schemas/* string */.YjP().max(300).optional().describe("Optional short workflow summary shown in the chat checklist."),
8425
8339
  detail: schemas/* string */.YjP().max(300).optional().describe("Optional live progress text to stream immediately to the UI."),
8426
- needs_attention_reason: schemas/* string */.YjP().max(300).optional().describe("Optional reason shown when the item or workflow needs user attention.")
8340
+ needs_attention_reason: schemas/* string */.YjP().max(300).optional().describe("Optional reason shown when the item or workflow needs user attention."),
8341
+ needs_user: schemas/* boolean */.zMY().optional().describe("For version_adoption only: set true when item_id cannot progress without the user's input or approval.")
8427
8342
  });
8428
8343
  function versionAdoptionPhase(phase) {
8429
8344
  return phase === "impact_radius" || phase === "adoption" || phase === "complete" ? phase : undefined;
@@ -8517,7 +8432,7 @@ const workflowProgressTool = (0,tools/* tool */.z6)(async (input, config)=>{
8517
8432
  }
8518
8433
  }, {
8519
8434
  name: "workflow_progress",
8520
- description: "Report structured progress for a substantial multi-step task. Use only when the task has several dependent phases, likely spans turns, or needs explicit verification; skip simple tasks and work already covered by native tool progress. For agent-created workflows, send the full current items snapshot on every call and reuse the same workflow_id. Keep secrets and private data out of workflow fields. Mark items done only with observed validation evidence; use needs_attention for blockers; phase=complete requires every item done or skipped. " + "Every item needs input, expected output, and concrete validation criteria. Completed items also need observed validation_evidence. The system-owned version_adoption workflow has its own durable checklist.",
8435
+ description: "Report structured progress for a substantial multi-step task. Use only when the task has several dependent phases, likely spans turns, or needs explicit verification; skip simple tasks and work already covered by native tool progress. For agent-created workflows, send the full current items snapshot on every call and reuse the same workflow_id. Keep secrets and private data out of workflow fields. Mark items done only with observed validation evidence; use needs_attention for blockers; phase=complete requires every item done or skipped. " + "A rejected update, or a step left checking or needs_attention at the end of the turn, is retried automatically (at most 3 attempts per step); set needs_user=true on a step that only the user can unblock. " + "Every item needs input, expected output, and concrete validation criteria. Completed items also need observed validation_evidence. The system-owned version_adoption workflow has its own durable checklist.",
8521
8436
  schema: workflowProgressSchema
8522
8437
  });
8523
8438
  (0,langchain_package/* registerLangChainPackage */.p)({
@@ -8583,6 +8498,8 @@ const compactContextTool = (0,tools/* tool */.z6)(async (_input, config)=>{
8583
8498
  var default_packages = __webpack_require__(93375);
8584
8499
  // EXTERNAL MODULE: ./lib/tools/communications/gmail.ts
8585
8500
  var gmail = __webpack_require__(36282);
8501
+ // EXTERNAL MODULE: ./lib/utils/source-link.ts
8502
+ var source_link = __webpack_require__(12262);
8586
8503
  // EXTERNAL MODULE: ./lib/integrations/gmail-oauth.ts
8587
8504
  var gmail_oauth = __webpack_require__(87246);
8588
8505
  ;// ./lib/tools/communications/calendar.ts
@@ -8613,6 +8530,7 @@ var gmail_oauth = __webpack_require__(87246);
8613
8530
 
8614
8531
 
8615
8532
 
8533
+
8616
8534
  const CALENDAR_BASE = "https://www.googleapis.com/calendar/v3";
8617
8535
  const calendarFetch = (auth, path, init)=>(0,gmail_oauth/* googleFetch */.sI)(auth, "Calendar", CALENDAR_BASE, path, init);
8618
8536
  const RFC3339_DATETIME = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/;
@@ -8635,7 +8553,8 @@ function slimEvent(e) {
8635
8553
  response: a.responseStatus ?? null
8636
8554
  })),
8637
8555
  meet_link: e.hangoutLink ?? null,
8638
- html_link: e.htmlLink ?? null
8556
+ html_link: e.htmlLink ?? null,
8557
+ cite_as: (0,source_link/* citeAs */.w)(e.summary, e.htmlLink, "Calendar event")
8639
8558
  };
8640
8559
  }
8641
8560
  // ── Tools ───────────────────────────────────────────────────────────────────
@@ -8917,6 +8836,7 @@ var microsoft_oauth = __webpack_require__(89080);
8917
8836
 
8918
8837
 
8919
8838
 
8839
+
8920
8840
  function outlook_calendar_slimEvent(e) {
8921
8841
  return {
8922
8842
  id: e.id,
@@ -8935,7 +8855,8 @@ function outlook_calendar_slimEvent(e) {
8935
8855
  is_cancelled: e.isCancelled === true,
8936
8856
  show_as: e.showAs ?? null,
8937
8857
  teams_link: e.onlineMeeting?.joinUrl ?? null,
8938
- web_link: e.webLink ?? null
8858
+ web_link: e.webLink ?? null,
8859
+ cite_as: (0,source_link/* citeAs */.w)(e.subject, e.webLink, "Outlook event")
8939
8860
  };
8940
8861
  }
8941
8862
  // ── Tools ───────────────────────────────────────────────────────────────────
@@ -9222,11 +9143,6 @@ var optional_package = __webpack_require__(71239);
9222
9143
  const msTodoReadTools = (0,optional_package/* optionalTools */.am)("@circuitwall/ms-todo-langchain", "msTodoReadTools");
9223
9144
  const msTodoWriteTools = (0,optional_package/* optionalTools */.am)("@circuitwall/ms-todo-langchain", "msTodoWriteTools");
9224
9145
  const setAuthResolver = (0,optional_package/* optionalFunction */.rz)("@circuitwall/ms-todo-langchain", "setAuthResolver", ()=>undefined);
9225
- // Exposed for the integrations test endpoint, matching the gmail/outlook
9226
- // `_resolveXxxAuth` probe convention.
9227
- function _resolveMsTodoAuth() {
9228
- return resolveMicrosoftAuth();
9229
- }
9230
9146
  // Bridge: the package calls this on every tool invocation. We resolve
9231
9147
  // the user's Microsoft credentials from Jarela's encrypted store (or env
9232
9148
  // vars) and exchange them for a short-lived access token via the shared
@@ -9473,8 +9389,8 @@ const msPeopleResolveTool = (0,tools/* tool */.z6)(async (args)=>{
9473
9389
  }
9474
9390
  });
9475
9391
 
9476
- // EXTERNAL MODULE: ./lib/agents/run-thread.ts + 22 modules
9477
- var run_thread = __webpack_require__(90424);
9392
+ // EXTERNAL MODULE: ./lib/agents/run-thread.ts + 23 modules
9393
+ var run_thread = __webpack_require__(91388);
9478
9394
  // EXTERNAL MODULE: ./lib/agents/model-router.ts + 1 modules
9479
9395
  var model_router = __webpack_require__(56236);
9480
9396
  // EXTERNAL MODULE: ./lib/agents/stream-collector.ts
@@ -9906,7 +9822,7 @@ const listToolsTool = (0,tools/* tool */.z6)(async ({ query, names, category, ca
9906
9822
  })
9907
9823
  });
9908
9824
  async function loadInputSchemas() {
9909
- const tools = await runtime_getAllToolsAsync();
9825
+ const tools = await getAllToolsAsync();
9910
9826
  return new Map(toOpenAITools(tools).map((toolDef)=>[
9911
9827
  toolDef.function.name,
9912
9828
  toolDef.function.parameters
@@ -12925,7 +12841,7 @@ function getAllTools(policy) {
12925
12841
  ...ext.tools.filter((t)=>!(0,disabled_dropin_tools/* isDropinDisabled */.H)(t.name)).map(wallclock/* wrapWithWallclock */.ZW)
12926
12842
  ], policy);
12927
12843
  }
12928
- async function runtime_getAllToolsAsync(policy) {
12844
+ async function getAllToolsAsync(policy) {
12929
12845
  try {
12930
12846
  await (0,langchain_packages/* loadLangChainPackages */.Jv)();
12931
12847
  } catch (err) {
@@ -13069,9 +12985,6 @@ function getToolSource(name) {
13069
12985
  if (catalog_loadExternal().tools.some((t)=>t.name === name)) return "external";
13070
12986
  return "mcp";
13071
12987
  }
13072
- function getToolCapability(name) {
13073
- return registeredCapability(name) ?? "execute";
13074
- }
13075
12988
  function getToolCategory(name) {
13076
12989
  const builtin = (0,registry/* registeredCategory */.RY)(name);
13077
12990
  if (builtin) return builtin;
@@ -13081,15 +12994,6 @@ function getToolCategory(name) {
13081
12994
  const mcpCat = (0,client/* getMcpToolMeta */.k2)(name)?.category;
13082
12995
  return (0,categories/* normalizeToolCategory */.eb)(mcpCat);
13083
12996
  }
13084
- function getToolGroup(name) {
13085
- const cat = getToolCategory(name);
13086
- if (cat === "MCP") return null;
13087
- const builtinGroup = registeredGroup(name);
13088
- if (builtinGroup !== undefined) return builtinGroup;
13089
- const mcpGroup = getMcpToolMeta(name)?.group;
13090
- if (mcpGroup !== undefined) return mcpGroup;
13091
- return groupForCategory(cat);
13092
- }
13093
12997
  function getToolCredentialsRequired(name) {
13094
12998
  if (registeredCategory(name)) return [];
13095
12999
  const ext = catalog_loadExternal().credentialsRequired.get(name);
@@ -13122,10 +13026,6 @@ function unconfiguredReason(entry) {
13122
13026
  function getDefaultAgentToolNames() {
13123
13027
  return getAllTools().filter((t)=>isDefaultBasicTool(t.name, getToolCategory(t.name))).map((t)=>t.name);
13124
13028
  }
13125
- async function getDefaultAgentToolNamesAsync() {
13126
- const tools = await getAllToolsAsync();
13127
- return tools.filter((t)=>isDefaultBasicTool(t.name, getToolCategory(t.name))).map((t)=>t.name);
13128
- }
13129
13029
  function isDefaultBasicTool(name, category) {
13130
13030
  return (0,categories/* isBasicToolCategory */.D6)(category) && !DEFAULT_EXCLUDED_BASIC_TOOLS.has(name);
13131
13031
  }
@@ -14575,7 +14475,7 @@ function cookiePathMatches(reqPath, cookiePath) {
14575
14475
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
14576
14476
  /* harmony export */ V: () => (/* binding */ collectStream)
14577
14477
  /* harmony export */ });
14578
- /* harmony import */ var _lib_agents_run_thread__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(90424);
14478
+ /* harmony import */ var _lib_agents_run_thread__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(91388);
14579
14479
  /* harmony import */ var _lib_utils_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(22032);
14580
14480
  // Shared collector for agent stream consumers.
14581
14481
  //
@@ -14720,17 +14620,16 @@ function cookiePathMatches(reqPath, cookiePath) {
14720
14620
  /* harmony export */ $: () => (/* binding */ moveThreadContextBoundary)
14721
14621
  /* harmony export */ });
14722
14622
  /* harmony import */ var _lib_stores_threads__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(83042);
14723
- /* harmony import */ var _lib_agents_warm_summary_background__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(79640);
14623
+ /* harmony import */ var _lib_agents_warm_summary_background__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(36923);
14724
14624
 
14725
14625
 
14726
14626
  // Every caller of moveThreadContextBoundary represents a user-initiated
14727
14627
  // boundary change (drag the line, the manual /compact command, or the agent's
14728
- // compact_context tool acting on the user's say-so) — the
14729
- // auto-detector's own commit (lib/agents/warm-summary-background.ts
14730
- // commitBoundaryCompaction) calls setThreadContextPin directly instead, so
14731
- // it never re-arms this lock. Suppresses the hot-turn-limit compaction in
14732
- // lib/agents/run-thread.ts for the next N eligible turns so a manual
14733
- // choice doesn't get silently re-moved on the very next turn.
14628
+ // compact_context tool acting on the user's say-so). Suppresses the
14629
+ // hot-turn-limit compaction in lib/agents/run-thread.ts for the next N
14630
+ // eligible turns so a manual choice doesn't get silently re-moved on the very
14631
+ // next turn. The auto-detector arms a shorter cooldown of its own
14632
+ // (hotTurnCooldownUntil) so it doesn't re-run on every turn either.
14734
14633
  // Counted in messages (~2 per turn: one user + one assistant row) since
14735
14634
  // that's what's already on the thread row — no extra query or per-turn
14736
14635
  // write needed to check it.
@@ -15407,7 +15306,7 @@ async function spillFileBuffer(raw, media_type, filename) {
15407
15306
  /* harmony export */ runAgentTurn: () => (/* binding */ runAgentTurn)
15408
15307
  /* harmony export */ });
15409
15308
  /* unused harmony export AgentTurnStreamError */
15410
- /* harmony import */ var _lib_agents_run_thread__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(90424);
15309
+ /* harmony import */ var _lib_agents_run_thread__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(91388);
15411
15310
  /* harmony import */ var _lib_agents_transcript_draft__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(87627);
15412
15311
  /* harmony import */ var _api_message_content__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(9104);
15413
15312
  /* harmony import */ var _lib_agents_model_router__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(56236);
@@ -15581,436 +15480,6 @@ class AgentTurnStreamError extends Error {
15581
15480
  }
15582
15481
 
15583
15482
 
15584
- /***/ }),
15585
-
15586
- /***/ 62174:
15587
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
15588
-
15589
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
15590
- /* harmony export */ $V: () => (/* binding */ getLatestMessageUsageForThread),
15591
- /* harmony export */ kw: () => (/* binding */ getMessageUsageByIds),
15592
- /* harmony export */ up: () => (/* binding */ recordMessageUsage)
15593
- /* harmony export */ });
15594
- /* harmony import */ var _lib_db__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(46);
15595
- // ADR-0041. Immutable per-assistant-turn snapshot of LLM usage.
15596
- //
15597
- // Written once when an assistant turn is persisted (see
15598
- // `persistAssistantMessage` in lib/agents/run-thread.ts). Never updated.
15599
- // The dashboard reads this table in preference to recomputing tokens /
15600
- // cost from `messages.content` + current agent_configs joins.
15601
-
15602
- function recordMessageUsage(input) {
15603
- const db = (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)();
15604
- const t = input.tier_usage ?? null;
15605
- db.prepare(`INSERT OR IGNORE INTO message_usage (
15606
- message_id, thread_id, agent_id, agent_name, provider, model_id,
15607
- model_config_name, input_tokens, output_tokens,
15608
- input_rate_usd_per_mtok, output_rate_usd_per_mtok, cost_usd, created_at,
15609
- hot_tokens, warm_tokens, facts_tokens, overhead_tokens,
15610
- hot_budget_tokens, warm_budget_tokens, facts_budget_tokens, context_window_tokens,
15611
- cache_creation_input_tokens, cache_read_input_tokens, thinking_tokens
15612
- ) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`).run(input.message_id, input.thread_id, input.agent_id, input.agent_name, input.provider, input.model_id, input.model_config_name, input.input_tokens, input.output_tokens, input.input_rate_usd_per_mtok, input.output_rate_usd_per_mtok, input.cost_usd, new Date().toISOString(), t?.hot_tokens ?? null, t?.warm_tokens ?? null, t?.facts_tokens ?? null, t?.overhead_tokens ?? null, t?.hot_budget_tokens ?? null, t?.warm_budget_tokens ?? null, t?.facts_budget_tokens ?? null, t?.context_window_tokens ?? null, input.cache_creation_input_tokens ?? null, input.cache_read_input_tokens ?? null, input.thinking_tokens ?? null);
15613
- }
15614
- function getMessageUsageByIds(messageIds) {
15615
- const out = new Map();
15616
- if (messageIds.length === 0) return out;
15617
- const placeholders = messageIds.map(()=>"?").join(",");
15618
- const rows = (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare(`SELECT * FROM message_usage WHERE message_id IN (${placeholders})`).all(...messageIds);
15619
- for (const row of rows)out.set(row.message_id, row);
15620
- return out;
15621
- }
15622
- function getLatestMessageUsageForThread(threadId) {
15623
- return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("SELECT * FROM message_usage WHERE thread_id=? ORDER BY created_at DESC LIMIT 1").get(threadId) ?? null;
15624
- }
15625
-
15626
-
15627
- /***/ }),
15628
-
15629
- /***/ 66963:
15630
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
15631
-
15632
-
15633
- // EXPORTS
15634
- __webpack_require__.d(__webpack_exports__, {
15635
- w: () => (/* binding */ getCheckpointer)
15636
- });
15637
-
15638
- // EXTERNAL MODULE: external "node:path"
15639
- var external_node_path_ = __webpack_require__(76760);
15640
- // EXTERNAL MODULE: ./lib/db/data-dir.ts
15641
- var data_dir = __webpack_require__(57477);
15642
- // EXTERNAL MODULE: external "node:sqlite"
15643
- var external_node_sqlite_ = __webpack_require__(80099);
15644
- // EXTERNAL MODULE: ./node_modules/@langchain/langgraph-checkpoint/dist/index.js + 86 modules
15645
- var dist = __webpack_require__(8808);
15646
- ;// ./lib/agents/sqlite-checkpoint-saver.ts
15647
-
15648
-
15649
- // In-tree LangGraph checkpoint saver backed by node:sqlite.
15650
- //
15651
- // Schema-compatible drop-in replacement for SqliteSaver from
15652
- // @langchain/langgraph-checkpoint-sqlite. The DDL is byte-identical so an
15653
- // existing checkpoints.db keeps working without migration.
15654
- const VALID_FILTER_KEYS = [
15655
- "source",
15656
- "step",
15657
- "parents"
15658
- ];
15659
- function buildLatestSelect(includeCheckpointId) {
15660
- return `
15661
- SELECT
15662
- thread_id,
15663
- checkpoint_ns,
15664
- checkpoint_id,
15665
- parent_checkpoint_id,
15666
- type,
15667
- checkpoint,
15668
- metadata,
15669
- (
15670
- SELECT
15671
- json_group_array(
15672
- json_object(
15673
- 'task_id', pw.task_id,
15674
- 'channel', pw.channel,
15675
- 'type', pw.type,
15676
- 'value', CAST(pw.value AS TEXT)
15677
- )
15678
- )
15679
- FROM writes as pw
15680
- WHERE pw.thread_id = checkpoints.thread_id
15681
- AND pw.checkpoint_ns = checkpoints.checkpoint_ns
15682
- AND pw.checkpoint_id = checkpoints.checkpoint_id
15683
- ) as pending_writes,
15684
- (
15685
- SELECT
15686
- json_group_array(
15687
- json_object(
15688
- 'type', ps.type,
15689
- 'value', CAST(ps.value AS TEXT)
15690
- )
15691
- )
15692
- FROM writes as ps
15693
- WHERE ps.thread_id = checkpoints.thread_id
15694
- AND ps.checkpoint_ns = checkpoints.checkpoint_ns
15695
- AND ps.checkpoint_id = checkpoints.parent_checkpoint_id
15696
- AND ps.channel = '${dist/* TASKS */.n3}'
15697
- ORDER BY ps.idx
15698
- ) as pending_sends
15699
- FROM checkpoints
15700
- WHERE thread_id = ? AND checkpoint_ns = ? ${includeCheckpointId ? "AND checkpoint_id = ?" : "ORDER BY checkpoint_id DESC LIMIT 1"}`;
15701
- }
15702
- // node:sqlite rejects `undefined` parameter binds; coerce to null.
15703
- function nv(v) {
15704
- return v === undefined ? null : v;
15705
- }
15706
- class NodeSqliteSaver extends dist/* BaseCheckpointSaver */.R1 {
15707
- constructor(db, serde){
15708
- super(serde), this.isSetup = false;
15709
- this.db = db;
15710
- }
15711
- static fromConnString(connStringOrLocalPath) {
15712
- return new NodeSqliteSaver(new external_node_sqlite_.DatabaseSync(connStringOrLocalPath));
15713
- }
15714
- setup() {
15715
- if (this.isSetup) return;
15716
- this.db.exec("PRAGMA journal_mode=WAL");
15717
- this.db.exec(`
15718
- CREATE TABLE IF NOT EXISTS checkpoints (
15719
- thread_id TEXT NOT NULL,
15720
- checkpoint_ns TEXT NOT NULL DEFAULT '',
15721
- checkpoint_id TEXT NOT NULL,
15722
- parent_checkpoint_id TEXT,
15723
- type TEXT,
15724
- checkpoint BLOB,
15725
- metadata BLOB,
15726
- PRIMARY KEY (thread_id, checkpoint_ns, checkpoint_id)
15727
- );`);
15728
- this.db.exec(`
15729
- CREATE TABLE IF NOT EXISTS writes (
15730
- thread_id TEXT NOT NULL,
15731
- checkpoint_ns TEXT NOT NULL DEFAULT '',
15732
- checkpoint_id TEXT NOT NULL,
15733
- task_id TEXT NOT NULL,
15734
- idx INTEGER NOT NULL,
15735
- channel TEXT NOT NULL,
15736
- type TEXT,
15737
- value BLOB,
15738
- PRIMARY KEY (thread_id, checkpoint_ns, checkpoint_id, task_id, idx)
15739
- );`);
15740
- this.withoutCheckpoint = this.db.prepare(buildLatestSelect(false));
15741
- this.withCheckpoint = this.db.prepare(buildLatestSelect(true));
15742
- this.isSetup = true;
15743
- }
15744
- txn(fn) {
15745
- this.db.exec("BEGIN");
15746
- try {
15747
- const result = fn();
15748
- this.db.exec("COMMIT");
15749
- return result;
15750
- } catch (err) {
15751
- try {
15752
- this.db.exec("ROLLBACK");
15753
- } catch {
15754
- // ignore rollback failure; surface the original error
15755
- }
15756
- throw err;
15757
- }
15758
- }
15759
- async decodeRowState(row) {
15760
- const pendingWrites = await Promise.all(JSON.parse(String(row.pending_writes ?? "[]")).map(async (write)=>{
15761
- return [
15762
- write.task_id,
15763
- write.channel,
15764
- await this.serde.loadsTyped(write.type ?? "json", write.value ?? "")
15765
- ];
15766
- }));
15767
- const checkpoint = await this.serde.loadsTyped(row.type ?? "json", row.checkpoint);
15768
- if (checkpoint.v < 4 && row.parent_checkpoint_id != null) {
15769
- await this.migratePendingSends(checkpoint, row.thread_id, row.parent_checkpoint_id);
15770
- }
15771
- const metadata = await this.serde.loadsTyped(row.type ?? "json", row.metadata);
15772
- return {
15773
- pendingWrites,
15774
- checkpoint,
15775
- metadata
15776
- };
15777
- }
15778
- async getTuple(config) {
15779
- this.setup();
15780
- const { thread_id, checkpoint_ns = "", checkpoint_id } = config.configurable ?? {};
15781
- const args = [
15782
- nv(thread_id),
15783
- checkpoint_ns
15784
- ];
15785
- if (checkpoint_id) args.push(checkpoint_id);
15786
- const stmt = checkpoint_id ? this.withCheckpoint : this.withoutCheckpoint;
15787
- const row = stmt.get(...args);
15788
- if (row === undefined) return undefined;
15789
- let finalConfig = config;
15790
- if (!checkpoint_id) {
15791
- finalConfig = {
15792
- configurable: {
15793
- thread_id: row.thread_id,
15794
- checkpoint_ns,
15795
- checkpoint_id: row.checkpoint_id
15796
- }
15797
- };
15798
- }
15799
- if (finalConfig.configurable?.thread_id === undefined || finalConfig.configurable?.checkpoint_id === undefined) {
15800
- throw new Error("Missing thread_id or checkpoint_id");
15801
- }
15802
- const { pendingWrites, checkpoint, metadata } = await this.decodeRowState(row);
15803
- return {
15804
- checkpoint,
15805
- config: finalConfig,
15806
- metadata,
15807
- parentConfig: row.parent_checkpoint_id ? {
15808
- configurable: {
15809
- thread_id: row.thread_id,
15810
- checkpoint_ns,
15811
- checkpoint_id: row.parent_checkpoint_id
15812
- }
15813
- } : undefined,
15814
- pendingWrites
15815
- };
15816
- }
15817
- async *list(config, options) {
15818
- const { limit, before, filter } = options ?? {};
15819
- this.setup();
15820
- const thread_id = config.configurable?.thread_id;
15821
- const checkpoint_ns = config.configurable?.checkpoint_ns;
15822
- let sql = `
15823
- SELECT
15824
- thread_id,
15825
- checkpoint_ns,
15826
- checkpoint_id,
15827
- parent_checkpoint_id,
15828
- type,
15829
- checkpoint,
15830
- metadata,
15831
- (
15832
- SELECT
15833
- json_group_array(
15834
- json_object(
15835
- 'task_id', pw.task_id,
15836
- 'channel', pw.channel,
15837
- 'type', pw.type,
15838
- 'value', CAST(pw.value AS TEXT)
15839
- )
15840
- )
15841
- FROM writes as pw
15842
- WHERE pw.thread_id = checkpoints.thread_id
15843
- AND pw.checkpoint_ns = checkpoints.checkpoint_ns
15844
- AND pw.checkpoint_id = checkpoints.checkpoint_id
15845
- ) as pending_writes,
15846
- (
15847
- SELECT
15848
- json_group_array(
15849
- json_object(
15850
- 'type', ps.type,
15851
- 'value', CAST(ps.value AS TEXT)
15852
- )
15853
- )
15854
- FROM writes as ps
15855
- WHERE ps.thread_id = checkpoints.thread_id
15856
- AND ps.checkpoint_ns = checkpoints.checkpoint_ns
15857
- AND ps.checkpoint_id = checkpoints.parent_checkpoint_id
15858
- AND ps.channel = '${dist/* TASKS */.n3}'
15859
- ORDER BY ps.idx
15860
- ) as pending_sends
15861
- FROM checkpoints\n`;
15862
- const whereClause = [];
15863
- if (thread_id !== undefined && thread_id !== null) whereClause.push("thread_id = ?");
15864
- if (checkpoint_ns !== undefined && checkpoint_ns !== null) {
15865
- whereClause.push("checkpoint_ns = ?");
15866
- }
15867
- if (before?.configurable?.checkpoint_id !== undefined) {
15868
- whereClause.push("checkpoint_id < ?");
15869
- }
15870
- const sanitizedFilter = Object.fromEntries(Object.entries(filter ?? {}).filter(([key, value])=>value !== undefined && VALID_FILTER_KEYS.includes(key)));
15871
- whereClause.push(...Object.entries(sanitizedFilter).map(([key])=>`jsonb(CAST(metadata AS TEXT))->'$.${key}' = ?`));
15872
- if (whereClause.length > 0) sql += `WHERE\n ${whereClause.join(" AND\n ")}\n`;
15873
- sql += "\nORDER BY checkpoint_id DESC";
15874
- if (limit) sql += ` LIMIT ${parseInt(String(limit), 10)}`;
15875
- const args = [
15876
- thread_id,
15877
- checkpoint_ns,
15878
- before?.configurable?.checkpoint_id,
15879
- ...Object.values(sanitizedFilter).map((value)=>JSON.stringify(value))
15880
- ].filter((value)=>value !== undefined && value !== null);
15881
- const rows = this.db.prepare(sql).all(...args);
15882
- for (const row of rows){
15883
- const { pendingWrites, checkpoint, metadata } = await this.decodeRowState(row);
15884
- yield {
15885
- config: {
15886
- configurable: {
15887
- thread_id: row.thread_id,
15888
- checkpoint_ns: row.checkpoint_ns,
15889
- checkpoint_id: row.checkpoint_id
15890
- }
15891
- },
15892
- checkpoint,
15893
- metadata,
15894
- parentConfig: row.parent_checkpoint_id ? {
15895
- configurable: {
15896
- thread_id: row.thread_id,
15897
- checkpoint_ns: row.checkpoint_ns,
15898
- checkpoint_id: row.parent_checkpoint_id
15899
- }
15900
- } : undefined,
15901
- pendingWrites
15902
- };
15903
- }
15904
- }
15905
- async put(config, checkpoint, metadata) {
15906
- this.setup();
15907
- if (!config.configurable) throw new Error("Empty configuration supplied.");
15908
- const thread_id = config.configurable?.thread_id;
15909
- const checkpoint_ns = config.configurable?.checkpoint_ns ?? "";
15910
- const parent_checkpoint_id = config.configurable?.checkpoint_id;
15911
- if (!thread_id) {
15912
- throw new Error(`Missing "thread_id" field in passed "config.configurable".`);
15913
- }
15914
- const preparedCheckpoint = (0,dist/* copyCheckpoint */.IE)(checkpoint);
15915
- const [[type1, serializedCheckpoint], [type2, serializedMetadata]] = await Promise.all([
15916
- this.serde.dumpsTyped(preparedCheckpoint),
15917
- this.serde.dumpsTyped(metadata)
15918
- ]);
15919
- if (type1 !== type2) {
15920
- throw new Error("Failed to serialized checkpoint and metadata to the same type.");
15921
- }
15922
- this.db.prepare(`INSERT OR REPLACE INTO checkpoints (thread_id, checkpoint_ns, checkpoint_id, parent_checkpoint_id, type, checkpoint, metadata) VALUES (?, ?, ?, ?, ?, ?, ?)`).run(thread_id, checkpoint_ns, checkpoint.id, nv(parent_checkpoint_id), type1, serializedCheckpoint, serializedMetadata);
15923
- return {
15924
- configurable: {
15925
- thread_id,
15926
- checkpoint_ns,
15927
- checkpoint_id: checkpoint.id
15928
- }
15929
- };
15930
- }
15931
- async putWrites(config, writes, taskId) {
15932
- this.setup();
15933
- if (!config.configurable) throw new Error("Empty configuration supplied.");
15934
- if (!config.configurable?.thread_id) {
15935
- throw new Error("Missing thread_id field in config.configurable.");
15936
- }
15937
- if (!config.configurable?.checkpoint_id) {
15938
- throw new Error("Missing checkpoint_id field in config.configurable.");
15939
- }
15940
- const stmt = this.db.prepare(`
15941
- INSERT OR REPLACE INTO writes
15942
- (thread_id, checkpoint_ns, checkpoint_id, task_id, idx, channel, type, value)
15943
- VALUES (?, ?, ?, ?, ?, ?, ?, ?)
15944
- `);
15945
- const rows = await Promise.all(writes.map(async (write, idx)=>{
15946
- const [type, serializedWrite] = await this.serde.dumpsTyped(write[1]);
15947
- return [
15948
- config.configurable?.thread_id,
15949
- config.configurable?.checkpoint_ns ?? "",
15950
- config.configurable?.checkpoint_id,
15951
- taskId,
15952
- idx,
15953
- write[0],
15954
- type,
15955
- serializedWrite
15956
- ];
15957
- }));
15958
- this.txn(()=>{
15959
- for (const row of rows)stmt.run(...row);
15960
- });
15961
- }
15962
- async deleteThread(threadId) {
15963
- this.setup();
15964
- this.txn(()=>{
15965
- this.db.prepare(`DELETE FROM checkpoints WHERE thread_id = ?`).run(threadId);
15966
- this.db.prepare(`DELETE FROM writes WHERE thread_id = ?`).run(threadId);
15967
- });
15968
- }
15969
- async migratePendingSends(checkpoint, threadId, parentCheckpointId) {
15970
- const row = this.db.prepare(`
15971
- SELECT
15972
- checkpoint_id,
15973
- json_group_array(
15974
- json_object(
15975
- 'type', ps.type,
15976
- 'value', CAST(ps.value AS TEXT)
15977
- )
15978
- ) as pending_sends
15979
- FROM writes as ps
15980
- WHERE ps.thread_id = ?
15981
- AND ps.checkpoint_id = ?
15982
- AND ps.channel = '${dist/* TASKS */.n3}'
15983
- ORDER BY ps.idx
15984
- `).get(threadId, parentCheckpointId);
15985
- const pendingSendsJson = String(row?.pending_sends ?? "[]");
15986
- const mutable = checkpoint;
15987
- mutable.channel_values ??= {};
15988
- mutable.channel_values[dist/* TASKS */.n3] = await Promise.all(JSON.parse(pendingSendsJson).map(({ type, value })=>this.serde.loadsTyped(type ?? "json", value ?? "")));
15989
- mutable.channel_versions[dist/* TASKS */.n3] = Object.keys(checkpoint.channel_versions).length > 0 ? (0,dist/* maxChannelVersion */.qU)(...Object.values(checkpoint.channel_versions)) : this.getNextVersion(undefined);
15990
- }
15991
- }
15992
-
15993
- ;// ./lib/agents/checkpointer.ts
15994
-
15995
-
15996
-
15997
- // Persistent graph state per thread_id. Multi-step plans, scratchpad messages,
15998
- // and any pending tool-call sequence survive process restarts and resume on
15999
- // the next agent.stream() with the same thread_id.
16000
- //
16001
- // Stored in a separate DB file (~/.jarela/checkpoints.db) so LangGraph
16002
- // manages its own schema independently of our own migrations under
16003
- // lib/db/. Both files use WAL mode via the same node:sqlite driver.
16004
- const CHECKPOINT_PATH = (0,external_node_path_.join)((0,data_dir/* getDataDir */.o)(), "checkpoints.db");
16005
- let _saver = null;
16006
- function getCheckpointer() {
16007
- if (!_saver) {
16008
- _saver = NodeSqliteSaver.fromConnString(CHECKPOINT_PATH);
16009
- }
16010
- return _saver;
16011
- }
16012
-
16013
-
16014
15483
  /***/ }),
16015
15484
 
16016
15485
  /***/ 67032:
@@ -16163,387 +15632,6 @@ function setUserPreset(preset) {
16163
15632
  }
16164
15633
 
16165
15634
 
16166
- /***/ }),
16167
-
16168
- /***/ 68564:
16169
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
16170
-
16171
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
16172
- /* harmony export */ AD: () => (/* binding */ startRun),
16173
- /* harmony export */ B1: () => (/* binding */ subscribe),
16174
- /* harmony export */ Cs: () => (/* binding */ waitForRun),
16175
- /* harmony export */ ES: () => (/* binding */ abortAllRuns),
16176
- /* harmony export */ JH: () => (/* binding */ finishRun),
16177
- /* harmony export */ KD: () => (/* binding */ abortRun),
16178
- /* harmony export */ Mh: () => (/* binding */ getRun),
16179
- /* harmony export */ QK: () => (/* binding */ drainSteering),
16180
- /* harmony export */ mq: () => (/* binding */ broadcast),
16181
- /* harmony export */ mx: () => (/* binding */ pushSteering)
16182
- /* harmony export */ });
16183
- /* unused harmony export waitForRunsToSettle */
16184
- /* harmony import */ var _lib_env_config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67500);
16185
- /* harmony import */ var _lib_utils_global_state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15559);
16186
-
16187
-
16188
- // Read once at module init. JARELA_RUN_BUFFER_SIZE / JARELA_RUN_REGISTRY_TTL_MS
16189
- // override the defaults.
16190
- const MAX_BUFFERED = (0,_lib_env_config__WEBPACK_IMPORTED_MODULE_0__/* .getConfig */ .z)().runBufferSize;
16191
- const RECENT_TTL_MS = (0,_lib_env_config__WEBPACK_IMPORTED_MODULE_0__/* .getConfig */ .z)().runRegistryTtlMs;
16192
- // Idle (no-progress) ceiling and wall-clock ceiling: read fresh per-run
16193
- // from getConfig() so non-restart-required env reloads take effect.
16194
- function runIdleMs() {
16195
- return (0,_lib_env_config__WEBPACK_IMPORTED_MODULE_0__/* .getConfig */ .z)().runIdleMs;
16196
- }
16197
- function runMaxMs() {
16198
- return (0,_lib_env_config__WEBPACK_IMPORTED_MODULE_0__/* .getConfig */ .z)().runMaxMs;
16199
- }
16200
- const registryState = (0,_lib_utils_global_state__WEBPACK_IMPORTED_MODULE_1__/* .getOrCreateGlobal */ .X)("__jarela_active_run_registry", ()=>({
16201
- runs: new Map(),
16202
- waiters: new Map()
16203
- }));
16204
- const runs = registryState.runs;
16205
- // Cold-attach waiters: subscribers that opened a GET /run before the
16206
- // server-side run actually called startRun (typical for triggers /
16207
- // scheduler / watcher, which submit through `after()` + the per-thread
16208
- // queue, so there's a real delay between the user clicking "Run now"
16209
- // and the registry entry appearing). Resolved by `startRun` below.
16210
- const waiters = registryState.waiters;
16211
- /** Wait up to `timeoutMs` for a run to be registered on `thread_id`.
16212
- * Resolves immediately with the current run if one is already active,
16213
- * with the new run when `startRun` fires inside the window, or with
16214
- * `null` on timeout. `timeoutMs <= 0` short-circuits to the current
16215
- * state without waiting. Caller is responsible for closing the SSE
16216
- * stream when this resolves null. */ function waitForRun(thread_id, timeoutMs) {
16217
- const existing = runs.get(thread_id);
16218
- if (existing) return Promise.resolve(existing);
16219
- if (timeoutMs <= 0) return Promise.resolve(null);
16220
- return new Promise((resolve)=>{
16221
- let set = waiters.get(thread_id);
16222
- if (!set) {
16223
- set = new Set();
16224
- waiters.set(thread_id, set);
16225
- }
16226
- const fn = (run)=>{
16227
- clearTimeout(timer);
16228
- resolve(run);
16229
- };
16230
- set.add(fn);
16231
- const timer = setTimeout(()=>{
16232
- const cur = waiters.get(thread_id);
16233
- cur?.delete(fn);
16234
- if (cur && cur.size === 0) waiters.delete(thread_id);
16235
- resolve(null);
16236
- }, timeoutMs);
16237
- timer.unref?.();
16238
- });
16239
- }
16240
- function startRun(thread_id, agent_id) {
16241
- // If a stale completed run exists, drop it before starting a new one.
16242
- const existing = runs.get(thread_id);
16243
- if (existing && existing.status === "running") {
16244
- throw new Error(`A run is already active for thread ${thread_id}`);
16245
- }
16246
- const now = Date.now();
16247
- const run = {
16248
- thread_id,
16249
- agent_id,
16250
- started_at: now,
16251
- finished_at: null,
16252
- status: "running",
16253
- events: [],
16254
- subscribers: new Set(),
16255
- final_text: "",
16256
- abort: new AbortController(),
16257
- last_chunk_at: now,
16258
- inflight_tools: new Set(),
16259
- tool_started_at: new Map(),
16260
- tool_time_ms_done: 0,
16261
- steering: []
16262
- };
16263
- runs.set(thread_id, run);
16264
- // Wake any GET subscribers that attached before the run was registered.
16265
- const pending = waiters.get(thread_id);
16266
- if (pending) {
16267
- waiters.delete(thread_id);
16268
- for (const fn of pending){
16269
- try {
16270
- fn(run);
16271
- } catch {}
16272
- }
16273
- }
16274
- scheduleIdleWatchdog(run);
16275
- scheduleMaxWatchdog(run);
16276
- return run;
16277
- }
16278
- // Synthesise a typed error chunk for the watchdog termination paths and
16279
- // fan it out to subscribers BEFORE flipping `status` to "error". The order
16280
- // matters: `broadcast()`'s status guard drops any chunk delivered after
16281
- // `finishRun()` has run, so calling finishRun first would silently swallow
16282
- // the error and the client's EventSource would just see the connection
16283
- // close with no terminal event — bubble keeps spinning, no toast. Doing
16284
- // it the other way around lets the client receive a real error event,
16285
- // render a "Run timed out" toast, and (if the consumer wires it up)
16286
- // trigger an auto-retry path. Followed by `done` so the consumer's
16287
- // for-await loop can break cleanly without waiting for an EOF.
16288
- function emitWatchdogTermination(run, code, message) {
16289
- if (run.status !== "running") return;
16290
- // Direct registry mutation so the broadcast goes through the regular
16291
- // path (subscribers + buffer + seq stamp) without re-entering any of
16292
- // the watchdog scheduling. Mirrors broadcast() but bypasses the
16293
- // status check we'd otherwise be racing against.
16294
- run.last_chunk_at = Date.now();
16295
- const errChunk = {
16296
- type: "error",
16297
- data: {
16298
- message,
16299
- code
16300
- }
16301
- };
16302
- if (run.events.length < MAX_BUFFERED) run.events.push(errChunk);
16303
- for (const fn of run.subscribers){
16304
- try {
16305
- fn(errChunk);
16306
- } catch {}
16307
- }
16308
- // Pair with a synthetic `done` so the client's consume() loop breaks
16309
- // on a terminal event rather than waiting for the EventSource to close.
16310
- const doneChunk = {
16311
- type: "done",
16312
- data: {}
16313
- };
16314
- if (run.events.length < MAX_BUFFERED) run.events.push(doneChunk);
16315
- for (const fn of run.subscribers){
16316
- try {
16317
- fn(doneChunk);
16318
- } catch {}
16319
- }
16320
- }
16321
- // Self-rearming idle watchdog. Fires when no chunk has arrived for
16322
- // `idleMs`; otherwise reschedules itself for `(last_chunk_at + idleMs) -
16323
- // now`. We never carry a handle on the run — the closure just bails if
16324
- // the run is no longer the registry's entry or no longer running.
16325
- function scheduleIdleWatchdog(run) {
16326
- const idleMs = runIdleMs();
16327
- const fireIn = Math.max(0, run.last_chunk_at + idleMs - Date.now());
16328
- setTimeout(()=>{
16329
- const cur = runs.get(run.thread_id);
16330
- if (cur !== run) return;
16331
- if (run.status !== "running") return;
16332
- const idle = Date.now() - run.last_chunk_at;
16333
- if (idle < idleMs) {
16334
- scheduleIdleWatchdog(run);
16335
- return;
16336
- }
16337
- if (run.inflight_tools.size > 0) {
16338
- // Tool execution in progress — silence here is the tool working,
16339
- // not a wedged provider stream. Skip the kill, re-check in idleMs.
16340
- // The tool_result will bump last_chunk_at when it lands.
16341
- setTimeout(()=>scheduleIdleWatchdog(run), idleMs).unref?.();
16342
- return;
16343
- }
16344
- console.warn(`[run-registry] idle watchdog: force-finishing stalled run for thread ${run.thread_id} after ${idle}ms of no progress`);
16345
- emitWatchdogTermination(run, "run_idle_timeout", `Run timed out — no progress for ${Math.round(idle / 1000)}s. The provider stream went silent before the agent finished. Try again, or split the request into smaller steps.`);
16346
- try {
16347
- run.abort.abort("run_idle_timeout");
16348
- } catch {}
16349
- finishRun(run, "error");
16350
- }, fireIn).unref?.();
16351
- }
16352
- // Wall-clock elapsed minus time spent inside tool calls (both completed and
16353
- // currently in flight). The wall-clock watchdog uses this so a 5-minute
16354
- // shell exec or a slow MCP roundtrip doesn't burn the agent's budget;
16355
- // tools enforce their own timeouts. See ActiveRun.tool_started_at for the
16356
- // rationale.
16357
- function effectiveElapsedMs(run, now) {
16358
- let inflightToolMs = 0;
16359
- for (const startedAt of run.tool_started_at.values()){
16360
- inflightToolMs += Math.max(0, now - startedAt);
16361
- }
16362
- return Math.max(0, now - run.started_at - run.tool_time_ms_done - inflightToolMs);
16363
- }
16364
- function scheduleMaxWatchdog(run) {
16365
- const max = runMaxMs();
16366
- const now = Date.now();
16367
- const fireIn = Math.max(0, max - effectiveElapsedMs(run, now));
16368
- setTimeout(()=>{
16369
- const cur = runs.get(run.thread_id);
16370
- if (cur !== run) return;
16371
- if (run.status !== "running") return;
16372
- const elapsed = effectiveElapsedMs(run, Date.now());
16373
- if (elapsed < max) {
16374
- // Tool time pushed the effective elapsed back below the ceiling —
16375
- // re-arm for the remaining budget. Without this, a tool that runs
16376
- // for longer than `max` between firing and resolving would let
16377
- // the next setTimeout overshoot.
16378
- scheduleMaxWatchdog(run);
16379
- return;
16380
- }
16381
- console.warn(`[run-registry] wall-clock watchdog: force-finishing run for thread ${run.thread_id} after ${elapsed}ms of agent time (excluding tool execution)`);
16382
- emitWatchdogTermination(run, "run_max_timeout", `Run exceeded the wall-clock limit (${Math.round(max / 1000)}s of agent time, excluding tool execution). The agent was force-stopped. Try a smaller scope or raise JARELA_RUN_MAX_MS if this is expected.`);
16383
- try {
16384
- run.abort.abort("run_watchdog_timeout");
16385
- } catch {}
16386
- finishRun(run, "error");
16387
- }, fireIn).unref?.();
16388
- }
16389
- function broadcast(run, chunk) {
16390
- // Identity-check: a superseded run must not smear trailing chunks onto
16391
- // the replacement entry in the registry.
16392
- if (runs.get(run.thread_id) !== run) return;
16393
- run.last_chunk_at = Date.now();
16394
- // Heartbeats exist solely to reset the idle watchdog when the provider
16395
- // is producing chunks that don't surface downstream (most commonly
16396
- // partial tool-call args while the model streams a large file_write
16397
- // body). The last_chunk_at bump above is the entire payload — don't
16398
- // buffer, don't fan out to subscribers, or the SSE wire would carry
16399
- // meaningless tick events.
16400
- if (chunk.type === "heartbeat") return;
16401
- if (chunk.type === "text_delta") {
16402
- run.final_text += chunk.data.delta ?? "";
16403
- } else if (chunk.type === "reset_text") {
16404
- // Output-validator retry (ADR-0037) discarding a flagged completed
16405
- // reply — see StreamChunk in base.ts.
16406
- run.final_text = "";
16407
- } else if (chunk.type === "tool_call") {
16408
- const id = chunk.data.id;
16409
- if (id) {
16410
- run.inflight_tools.add(id);
16411
- run.tool_started_at.set(id, Date.now());
16412
- }
16413
- } else if (chunk.type === "tool_result") {
16414
- const id = chunk.data.id;
16415
- if (id) {
16416
- run.inflight_tools.delete(id);
16417
- const startedAt = run.tool_started_at.get(id);
16418
- if (startedAt !== undefined) {
16419
- run.tool_time_ms_done += Math.max(0, Date.now() - startedAt);
16420
- run.tool_started_at.delete(id);
16421
- // The tool just gave the agent its budget back; re-arm the
16422
- // wall-clock watchdog against the new effective elapsed.
16423
- scheduleMaxWatchdog(run);
16424
- }
16425
- }
16426
- }
16427
- if (run.events.length < MAX_BUFFERED) {
16428
- run.events.push(chunk);
16429
- }
16430
- for (const fn of run.subscribers){
16431
- try {
16432
- fn(chunk);
16433
- } catch {}
16434
- }
16435
- }
16436
- function finishRun(run, status) {
16437
- // Identity-check: a stale run finishing late must not flip the
16438
- // replacement's status or evict it from the registry.
16439
- if (runs.get(run.thread_id) !== run) return;
16440
- run.status = status;
16441
- run.finished_at = Date.now();
16442
- // Drop subscribers — late attachers should NOT keep getting events on a
16443
- // dead run. They'll get the buffered events on subscribe and that's it.
16444
- run.subscribers.clear();
16445
- // Auto-evict after TTL so memory doesn't grow with every conversation.
16446
- setTimeout(()=>{
16447
- const cur = runs.get(run.thread_id);
16448
- if (cur === run) runs.delete(run.thread_id);
16449
- }, RECENT_TTL_MS).unref?.();
16450
- }
16451
- function getRun(thread_id) {
16452
- return runs.get(thread_id) ?? null;
16453
- }
16454
- // Signal the agent stream to cancel. The stream loop in the route is wired
16455
- // to listen on the AbortController and exit early, emitting an error chunk
16456
- // the client (and the queue-drain hook) can react to. Idempotent.
16457
- function abortRun(thread_id, reason = "user_interrupted") {
16458
- const run = runs.get(thread_id);
16459
- if (!run || run.status !== "running") return false;
16460
- if (!run.abort.signal.aborted) {
16461
- try {
16462
- run.abort.abort(reason);
16463
- } catch {}
16464
- }
16465
- return true;
16466
- }
16467
- // Queue a user message typed while `thread_id` is streaming (ADR-0080).
16468
- // Returns false when there is nothing to steer, so the caller can fall back
16469
- // to starting a fresh turn.
16470
- function pushSteering(thread_id, text) {
16471
- const run = runs.get(thread_id);
16472
- if (!run || run.status !== "running" || run.abort.signal.aborted) return false;
16473
- const trimmed = text.trim();
16474
- if (!trimmed) return false;
16475
- run.steering.push(trimmed);
16476
- return true;
16477
- }
16478
- // Take everything queued so far, in arrival order. Deliberately not merged
16479
- // into a summary — collapsing several messages loses the user's intent.
16480
- function drainSteering(thread_id) {
16481
- const run = runs.get(thread_id);
16482
- if (!run || run.steering.length === 0) return [];
16483
- return run.steering.splice(0, run.steering.length);
16484
- }
16485
- // Abort every currently-running run. Used by the graceful-shutdown path so
16486
- // LangGraph stream loops bail out instead of continuing past process exit.
16487
- // Returns the number of runs that were signalled.
16488
- function abortAllRuns(reason = "server_shutdown") {
16489
- let count = 0;
16490
- for (const run of runs.values()){
16491
- if (run.status !== "running") continue;
16492
- if (run.abort.signal.aborted) continue;
16493
- try {
16494
- run.abort.abort(reason);
16495
- count++;
16496
- } catch {}
16497
- }
16498
- return count;
16499
- }
16500
- // Poll until every run has transitioned out of "running" (or until the
16501
- // caller-supplied deadline elapses). Used during graceful shutdown after
16502
- // `abortAllRuns()` so the stream `finally` blocks have a chance to flush
16503
- // the trailing error chunk and call `finishRun()`. Resolves to the count
16504
- // of runs still stuck in "running" when the deadline hit (0 = clean).
16505
- async function waitForRunsToSettle(timeoutMs) {
16506
- const deadline = Date.now() + Math.max(0, timeoutMs);
16507
- while(Date.now() < deadline){
16508
- let stillRunning = 0;
16509
- for (const run of runs.values())if (run.status === "running") stillRunning++;
16510
- if (stillRunning === 0) return 0;
16511
- await new Promise((resolve)=>setTimeout(resolve, 50));
16512
- }
16513
- let stillRunning = 0;
16514
- for (const run of runs.values())if (run.status === "running") stillRunning++;
16515
- return stillRunning;
16516
- }
16517
- // Replays buffered events synchronously, then subscribes for live ones.
16518
- // Returns an unsubscribe fn. Caller is responsible for calling it.
16519
- function subscribe(thread_id, onEvent) {
16520
- const run = runs.get(thread_id);
16521
- if (!run) return {
16522
- run: null,
16523
- unsubscribe: ()=>{}
16524
- };
16525
- // Replay buffered events first (so the new subscriber catches up).
16526
- for (const ev of run.events){
16527
- try {
16528
- onEvent(ev);
16529
- } catch {}
16530
- }
16531
- if (run.status !== "running") {
16532
- return {
16533
- run,
16534
- unsubscribe: ()=>{}
16535
- };
16536
- }
16537
- run.subscribers.add(onEvent);
16538
- return {
16539
- run,
16540
- unsubscribe: ()=>{
16541
- run.subscribers.delete(onEvent);
16542
- }
16543
- };
16544
- }
16545
-
16546
-
16547
15635
  /***/ }),
16548
15636
 
16549
15637
  /***/ 69428:
@@ -17977,7 +17065,7 @@ function persistAssistantDraftChunk(draft, chunk) {
17977
17065
 
17978
17066
  /***/ }),
17979
17067
 
17980
- /***/ 90424:
17068
+ /***/ 91388:
17981
17069
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
17982
17070
 
17983
17071
 
@@ -17995,7 +17083,7 @@ __webpack_require__.d(__webpack_exports__, {
17995
17083
  IC: () => (/* binding */ withInterruptMarker)
17996
17084
  });
17997
17085
 
17998
- // UNUSED EXPORTS: INTERRUPT_MARKER, MAX_RATE_LIMIT_RETRY_AFTER_MS, appendHistoryMessage, buildFabricationNudge, buildRetryContextSummary, contentText, isHotContextNearBudget, looksLikeStall, rateLimitRetryDelayMs, retryTextOverlapRatio, shouldRetryTransientError, toolCallSignature, transientRetryDelayMs
17086
+ // UNUSED EXPORTS: INTERRUPT_MARKER, MAX_RATE_LIMIT_RETRY_AFTER_MS, appendHistoryMessage, buildFabricationNudge, buildRetryContextSummary, contentText, hotTurnCooldownUntil, isHotContextNearBudget, looksLikeStall, rateLimitRetryDelayMs, retryTextOverlapRatio, shouldRetryTransientError, toolCallSignature, transientRetryDelayMs
17999
17087
 
18000
17088
  // EXTERNAL MODULE: ./lib/agents/action-vocabulary.ts
18001
17089
  var action_vocabulary = __webpack_require__(95350);
@@ -20133,8 +19221,8 @@ var registry = __webpack_require__(32068);
20133
19221
  var attachments_reference = __webpack_require__(43424);
20134
19222
  // EXTERNAL MODULE: ./lib/agents/thread-compaction.ts
20135
19223
  var thread_compaction = __webpack_require__(5209);
20136
- // EXTERNAL MODULE: ./lib/agents/warm-summary-background.ts
20137
- var warm_summary_background = __webpack_require__(79640);
19224
+ // EXTERNAL MODULE: ./lib/agents/warm-summary-background.ts + 1 modules
19225
+ var warm_summary_background = __webpack_require__(36923);
20138
19226
  // EXTERNAL MODULE: ./lib/agents/context-boundary.ts
20139
19227
  var context_boundary = __webpack_require__(39583);
20140
19228
  // EXTERNAL MODULE: ./lib/api/foreground-presence.ts
@@ -20311,6 +19399,194 @@ const SUMMARY_PATTERNS = [
20311
19399
 
20312
19400
 
20313
19401
 
19402
+ ;// ./lib/agents/workflow-step-retry.ts
19403
+ // Workflow-step contract enforcement. Every workflow_progress step promises
19404
+ // an input, an output, and a validation check; a model can still end a turn
19405
+ // with a rejected update, a step left mid-flight, or a step whose validation
19406
+ // failed. This module detects those breaches from the turn's own tool results
19407
+ // (code, not model judgement) and builds the targeted auto-retry nudge.
19408
+ /** Total attempts per step: the original attempt plus two automatic retries. */ const WORKFLOW_STEP_MAX_ATTEMPTS = 3;
19409
+ const WORKFLOW_STEP_AUTO_RETRIES = WORKFLOW_STEP_MAX_ATTEMPTS - 1;
19410
+ /** Hard cap on automatic workflow retries in one turn, across all steps. */ const WORKFLOW_TURN_AUTO_RETRY_LIMIT = 6;
19411
+ function asObject(value) {
19412
+ if (typeof value === "string") {
19413
+ try {
19414
+ return asObject(JSON.parse(value));
19415
+ } catch {
19416
+ return null;
19417
+ }
19418
+ }
19419
+ if (value && typeof value === "object" && !Array.isArray(value)) {
19420
+ const obj = value;
19421
+ // LangChain ToolMessage-ish wrappers carry the JSON string in `content`
19422
+ // or `kwargs.content`.
19423
+ if (obj.workflow_id === undefined) {
19424
+ // invoke_tool envelope: { ok, tool, status, result }.
19425
+ if (obj.tool === "workflow_progress" && obj.result !== undefined) return asObject(obj.result);
19426
+ const kwargs = asPlainObject(obj.kwargs);
19427
+ const content = obj.content ?? kwargs?.content;
19428
+ if (typeof content === "string") return asObject(content);
19429
+ }
19430
+ return obj;
19431
+ }
19432
+ return null;
19433
+ }
19434
+ function asPlainObject(value) {
19435
+ return value && typeof value === "object" && !Array.isArray(value) ? value : null;
19436
+ }
19437
+ function str(value) {
19438
+ return typeof value === "string" && value.trim() ? value.trim() : null;
19439
+ }
19440
+ /** Normalizes a direct workflow_progress call or an invoke_tool proxy of one. */ function workflowProgressArgs(name, args) {
19441
+ const obj = asPlainObject(args);
19442
+ if (!obj) return null;
19443
+ if (name === "workflow_progress") return obj;
19444
+ if (name === "invoke_tool" && obj.name === "workflow_progress") {
19445
+ const inner = obj.args_json ?? obj.args;
19446
+ return asObject(inner);
19447
+ }
19448
+ return null;
19449
+ }
19450
+ function labelFor(itemId, items) {
19451
+ if (!itemId) return "workflow update";
19452
+ if (Array.isArray(items)) {
19453
+ for (const raw of items){
19454
+ const item = asPlainObject(raw);
19455
+ if (item?.id === itemId && str(item.label)) return str(item.label);
19456
+ }
19457
+ }
19458
+ return itemId.replace(/[_-]/g, " ");
19459
+ }
19460
+ function rejectedItemId(args) {
19461
+ if (!args) return null;
19462
+ if (str(args.item_id)) return str(args.item_id);
19463
+ if (Array.isArray(args.items)) {
19464
+ for (const raw of args.items){
19465
+ const item = asPlainObject(raw);
19466
+ if (item?.status === "done" && !str(item.validation_evidence) && str(item.id)) return str(item.id);
19467
+ }
19468
+ }
19469
+ return null;
19470
+ }
19471
+ /**
19472
+ * Returns the contract breaches still standing at the end of the turn, in
19473
+ * the order the workflows were last touched. A later accepted update for the
19474
+ * same workflow clears an earlier rejection.
19475
+ */ function collectWorkflowContractFailures(observations) {
19476
+ const latest = new Map();
19477
+ for (const { args, result } of observations){
19478
+ const payload = asObject(result);
19479
+ const callArgs = asPlainObject(args);
19480
+ const workflowId = str(payload?.workflow_id) ?? str(callArgs?.workflow_id);
19481
+ if (!workflowId) continue;
19482
+ const previous = latest.get(workflowId) ?? {
19483
+ rejected: null,
19484
+ checklist: [],
19485
+ phase: null,
19486
+ error: null,
19487
+ needsUser: new Set()
19488
+ };
19489
+ latest.delete(workflowId);
19490
+ if (payload?.ok === false) {
19491
+ const itemId = rejectedItemId(callArgs);
19492
+ latest.set(workflowId, {
19493
+ ...previous,
19494
+ rejected: {
19495
+ itemId,
19496
+ label: labelFor(itemId, callArgs?.items ?? previous.checklist),
19497
+ error: str(payload.error) ?? "the update was rejected"
19498
+ }
19499
+ });
19500
+ continue;
19501
+ }
19502
+ const state = asPlainObject(payload?.state);
19503
+ const needsUser = new Set(previous.needsUser);
19504
+ const updatedItemId = str(callArgs?.item_id);
19505
+ if (updatedItemId) {
19506
+ if (callArgs?.needs_user === true) needsUser.add(updatedItemId);
19507
+ else needsUser.delete(updatedItemId);
19508
+ }
19509
+ latest.set(workflowId, {
19510
+ rejected: null,
19511
+ checklist: Array.isArray(state?.checklist) ? state.checklist : previous.checklist,
19512
+ phase: typeof state?.phase === "string" ? state.phase : null,
19513
+ error: str(state?.error),
19514
+ needsUser
19515
+ });
19516
+ }
19517
+ const failures = [];
19518
+ for (const [workflowId, entry] of latest){
19519
+ if (entry.rejected) {
19520
+ const { itemId, label, error } = entry.rejected;
19521
+ failures.push({
19522
+ key: `${workflowId}:${itemId ?? "*"}`,
19523
+ workflowId,
19524
+ itemId,
19525
+ label,
19526
+ reason: `workflow_progress rejected the update: ${error}`
19527
+ });
19528
+ continue;
19529
+ }
19530
+ if (entry.phase === "complete") continue;
19531
+ for (const raw of entry.checklist){
19532
+ const item = asPlainObject(raw);
19533
+ const itemId = str(item?.id);
19534
+ if (!item || !itemId || item.needs_user === true || entry.needsUser.has(itemId)) continue;
19535
+ const label = str(item.label) ?? itemId;
19536
+ if (item.status === "checking") {
19537
+ failures.push({
19538
+ key: `${workflowId}:${itemId}`,
19539
+ workflowId,
19540
+ itemId,
19541
+ label,
19542
+ reason: "the step was started but the turn ended before its output was validated"
19543
+ });
19544
+ } else if (item.status === "needs_attention") {
19545
+ const why = entry.error;
19546
+ failures.push({
19547
+ key: `${workflowId}:${itemId}`,
19548
+ workflowId,
19549
+ itemId,
19550
+ label,
19551
+ reason: `the step's validation did not pass (needs_attention${why ? `: ${why}` : ""})`
19552
+ });
19553
+ }
19554
+ }
19555
+ }
19556
+ return failures;
19557
+ }
19558
+ /** Splits failures into those with automatic retries left and those exhausted. */ function planWorkflowStepRetries(failures, spent = {}) {
19559
+ const retry = [];
19560
+ const exhausted = [];
19561
+ for (const failure of failures){
19562
+ const used = spent[failure.key] ?? 0;
19563
+ if (used < WORKFLOW_STEP_AUTO_RETRIES) retry.push({
19564
+ ...failure,
19565
+ attempt: used + 2
19566
+ });
19567
+ else exhausted.push(failure);
19568
+ }
19569
+ return {
19570
+ retry,
19571
+ exhausted
19572
+ };
19573
+ }
19574
+ function workflowStepRetryInstruction(workflowId, itemId, label) {
19575
+ if (!itemId) {
19576
+ return `Resend the \`workflow_progress\` update for workflow \`${workflowId}\` so it satisfies the contract.`;
19577
+ }
19578
+ const progressUpdate = workflowId === "version_adoption" ? `Call \`workflow_progress\` with \`workflow_id: "version_adoption"\`, \`item_id: "${itemId}"\`, and \`status: "checking"\`` : `Call \`workflow_progress\` for workflow \`${workflowId}\` with the complete items snapshot, setting this step to \`checking\``;
19579
+ return `${progressUpdate}, then redo "${label}" from its stated input and run its validation again. Finally mark it \`done\` with newly observed \`validation_evidence\`, or \`needs_attention\` with the reason.`;
19580
+ }
19581
+ function buildWorkflowStepRetryNudge(retries) {
19582
+ const lines = retries.map((failure)=>`- "${failure.label}" in \`${failure.workflowId}\` (attempt ${failure.attempt} of ${WORKFLOW_STEP_MAX_ATTEMPTS}): ${failure.reason}. ${workflowStepRetryInstruction(failure.workflowId, failure.itemId, failure.label)}`);
19583
+ return [
19584
+ `↻ Auto-retry: ${retries.length === 1 ? "a workflow step has" : `${retries.length} workflow steps have`} not met the step contract (input → output → validation):`,
19585
+ ...lines,
19586
+ "Work only on these steps and leave the others unchanged. Do not reuse earlier evidence or claim a result you did not observe. If a step is genuinely paused for the user's approval or input, mark it `needs_attention` with `needs_user: true` and say what you need instead of retrying."
19587
+ ].join("\n");
19588
+ }
19589
+
20314
19590
  // EXTERNAL MODULE: external "node:os"
20315
19591
  var external_node_os_ = __webpack_require__(48161);
20316
19592
  var external_node_os_default = /*#__PURE__*/__webpack_require__.n(external_node_os_);
@@ -20769,7 +20045,7 @@ function buildSharedToolCatalogContext() {
20769
20045
  return [
20770
20046
  "--- Tool usage SOP ---",
20771
20047
  "Static cross-agent procedure. The per-turn bound list and counts appear later under \"Enabled tools\".",
20772
- `0. Classify the request. Informational answers may be direct; read/retrieve requests need a read tool; write/change requests need a state-changing tool; destructive requests also need the required confirmation. ${(0,action_vocabulary/* formatActionVocabularyInstruction */.q2)()} For substantial tasks with several dependent phases, likely cross-turn progress, or explicit verification, use workflow_progress to create and update a concise checklist; skip simple tasks and work already covered by native tool progress. This contract applies to every built-in Jarela workflow and every workflow you create or follow: each step must state its input, expected output, and concrete validation criteria; validate each output before passing it to a later step. Prefer executable checks whenever code can verify the result, and record observed validation_evidence before marking an item done. Keep a stable workflow_id, send the complete current item list on each update, and keep secrets or private data out of checklist fields. Use needs_attention for blockers; set phase=complete only when all items are done or skipped. Never claim an output or validation result that you did not observe.`,
20048
+ `0. Classify the request. Informational answers may be direct; read/retrieve requests need a read tool; write/change requests need a state-changing tool; destructive requests also need the required confirmation. ${(0,action_vocabulary/* formatActionVocabularyInstruction */.q2)()} For substantial tasks with several dependent phases, likely cross-turn progress, or explicit verification, use workflow_progress to create and update a concise checklist; skip simple tasks and work already covered by native tool progress. This contract applies to every built-in Jarela workflow and every workflow you create or follow: each step must state its input, expected output, and concrete validation criteria; validate each output before passing it to a later step. Prefer executable checks whenever code can verify the result, and record observed validation_evidence before marking an item done. Keep a stable workflow_id, send the complete current item list on each update, and keep secrets or private data out of checklist fields. Use needs_attention for blockers, with needs_user=true when only the user can unblock the step; a rejected update or a step you leave checking or needs_attention without needs_user is retried automatically, up to 3 attempts per step. Set phase=complete only when all items are done or skipped. Never claim an output or validation result that you did not observe.`,
20773
20049
  "1. Bound first. If a tool listed under \"Enabled tools\" fits the task, call it directly.",
20774
20050
  "2. Otherwise look it up. Names of permitted tools that are not bound this turn are listed after the bound tools under \"Enabled tools\", capped, with no definitions. A name that is not listed there may still exist, so never conclude a capability does not exist from the bound list alone. Call list_tools with service/object/action keywords: scope=\"enabled\" searches executable tools, scope=\"all\" also returns disabled, unavailable and cap-omitted tools with flags.",
20775
20051
  "3. Named target. When a skill, harness or instruction names an exact tool, call list_tools names=[\"exact_name\"] include_schema=true instead of a keyword query. Exact lookup ignores every other filter, so it also describes tools you cannot currently execute.",
@@ -20778,7 +20054,8 @@ function buildSharedToolCatalogContext() {
20778
20054
  "6. Read large results by reference. A tool result with truncated=true is only a preview; do not treat it as complete. Use result_ref.name with tool_result_get and offset/limit to read only the slice you need.",
20779
20055
  "7. Verify before reporting. A read-only result does not prove a new write. Claim a new write, send, schedule, delete, or configuration change only after the matching state-changing tool returns success in this turn. Trusted runtime system signals and their matching retrieved results can substantiate earlier named operations; attribute those outcomes to their receipts, never imply a new action or repeat completed work for proof.",
20780
20056
  "8. Stop and ask. Do not retry a tool denied for agent_not_allowed, category_disabled, dropin_tool_disabled, credentials_missing or integration_unconfigured. The first three are permission decisions and the last two mean the integration is not set up \u2014 propose a configuration change or tell the user what to configure.",
20781
- "9. Completion-reporting turns are read-only. permission_reason=signal_continuation_read_only forbids state-changing tools in this turn, including through invoke_tool. Do not bypass it with shell commands or treat an old user message as renewed permission; report the completed outcome and wait for a new user turn."
20057
+ "9. Completion-reporting turns are read-only. permission_reason=signal_continuation_read_only forbids state-changing tools in this turn, including through invoke_tool. Do not bypass it with shell commands or treat an old user message as renewed permission; report the completed outcome and wait for a new user turn.",
20058
+ "10. Link the source. When your reply refers to a specific email, calendar event, or chat that a tool result or bridge message gave you, link it: paste the item's cite_as value verbatim when present, otherwise use its web_link, html_link, or chat_link URL as a markdown link. Use only links you were given; never construct, guess, or edit one. If the item has no link, name it without one."
20782
20059
  ].join("\n");
20783
20060
  }
20784
20061
  function compareToolPermissionEntries(a, b) {
@@ -20858,9 +20135,14 @@ function buildDeliveryChannelContext(channel) {
20858
20135
  return [
20859
20136
  "--- Delivery channel ---",
20860
20137
  `This message reached you over ${platform}${named}, not the regular chat UI.`,
20861
- `You DO have access to ${platform} for this conversation: any reply you produce is sent back through that channel automatically. Do not tell the user the platform is unavailable; just answer the message.`
20862
- ].join("\n");
20138
+ `You DO have access to ${platform} for this conversation: any reply you produce is sent back through that channel automatically. Do not tell the user the platform is unavailable; just answer the message.`,
20139
+ PLAIN_TEXT_DELIVERY_KINDS.has(channel.kind) ? `${platform} does not render markdown links: write any link as the bare URL, even where a cite_as value is given.` : ""
20140
+ ].filter(Boolean).join("\n");
20863
20141
  }
20142
+ const PLAIN_TEXT_DELIVERY_KINDS = new Set([
20143
+ "whatsapp",
20144
+ "sms"
20145
+ ]);
20864
20146
  function buildUserContext() {
20865
20147
  const userProfile = (0,user_profile/* getUserProfile */.VM)();
20866
20148
  const parts = [];
@@ -20944,7 +20226,7 @@ function buildSourceLinkContext(agent, manifest) {
20944
20226
  "--- Citation format ---",
20945
20227
  intro,
20946
20228
  "PRIMARY (inline links): cite by writing a standard markdown link inline: `[short label](https://example.com/path)` or `[file name](/abs/path.ts)` or `[earlier reply](#msg-<id>)`. Wrap the cited PHRASE itself as the link text when natural — `Jade has [ice skating at 16:00](?thread=…&agent=…)` reads better than a trailing `[1]`.",
20947
- "When a tool result contains a `cite_as` field (delegate_to_agent does, and so do some integrations), paste that exact value somewhere in your reply — it's a pre-built markdown link to the source. Anything you summarize from a delegate or from a web/file tool result MUST carry at least one inline link back to where it came from; a summary with zero links reads as if you made the facts up.",
20229
+ "When a tool result contains a `cite_as` field (delegate_to_agent does, and so do the email and calendar tools), paste that exact value somewhere in your reply — it's a pre-built markdown link to the source. Anything you summarize from a delegate or from a web/file tool result MUST carry at least one inline link back to where it came from; a summary with zero links reads as if you made the facts up.",
20948
20230
  "For web_search / fetch_webpage results, the URL is right there in the tool output — use it: `[headline or short label](https://...)`. For file_read results, link the absolute path: `[filename.ext](/abs/path/filename.ext)`.",
20949
20231
  "FALLBACK (declared refs block): if a source is awkward to cite inline (e.g. you summarized 4 articles in one paragraph), you MAY end your reply with a fenced block exactly like this:",
20950
20232
  "```jarela-references",
@@ -21023,11 +20305,16 @@ function buildMemoryContext(budget) {
21023
20305
  const writeGuidance = policy === "important" ? "Store only explicit preferences, verified facts, durable decisions, constraints, and project context. Do not store inferred details, routine status, contacts, or transient tasks." : policy === "detailed" ? "Store relevant durable details, including recurring workflow context and task state, but never secrets or raw private transcripts. Prefer concise records over duplicates." : "Store explicit preferences, verified facts, durable decisions, constraints, and project context. Store task details only when they will matter across sessions.";
21024
20306
  return [
21025
20307
  "--- Memory & recall ---",
21026
- "You have long-term memory across sessions.",
20308
+ "You have long-term memory across sessions, shared with every other Jarela agent. A record you save is available to other agents immediately. Background compaction also extracts facts later, but it runs late and can miss details, so it is a backstop, not your save step.",
21027
20309
  `- Hot conversation history is budgeted by model context size: ${(0,context_budget/* formatContextBudgetSummary */.qm)(budget)}.`,
21028
20310
  `- Active memory policy: ${policy}. ${writeGuidance}`,
21029
- "- Use memory_upsert proactively for structured records. Use namespace='facts', concise tags, confidence='explicit' for user-stated information, observed_at when the information was true, and expires_at for temporary facts. Keep memory_write only for legacy/free-form notes.",
21030
- "- Use memory_search proactively when relevant saved facts or prior conversations could help. Use memory_read / memory_list to inspect known entries."
20311
+ "- Use memory_search proactively when relevant saved facts or prior conversations could help. Use memory_read / memory_list to inspect known entries.",
20312
+ "Proactive save procedure — run it whenever information fits the active memory policy, without waiting to be asked:",
20313
+ "1. Trigger: the user states a preference, a fact about themselves or their work, a decision, a constraint, or a correction to something saved; or a tool result verifies a durable fact. Routine status, one-off chatter, secrets, credentials, and raw transcripts never qualify.",
20314
+ "2. Check: memory_search (or memory_read for a known key) for an existing record on the same subject. Update that stable key rather than creating a duplicate or contradictory copy.",
20315
+ "3. Write: call memory_upsert in the same turn, before your final reply, with namespace='facts', a stable descriptive key, standalone content, concise tags, confidence='explicit' for user-stated information ('verified' when tool-backed, 'inferred' only when useful and reversible), observed_at when the information became true, and expires_at for temporary facts. Keep memory_write only for legacy/free-form notes.",
20316
+ "4. Validate: the memory_upsert result must contain ok:true and the key you sent. If it failed, correct the arguments and retry once; if it still fails, tell the user it was not saved.",
20317
+ "5. Cite: end your reply with one short line naming each saved key, for example 'Saved to memory: facts/answer-format-preference'. Omit the line when nothing was saved."
21031
20318
  ].join("\n");
21032
20319
  }
21033
20320
  function buildAutomaticRecallGuidance(autoRecallEnabled, autoFactsEnabled) {
@@ -21406,17 +20693,27 @@ const SOURCE_PRODUCING_TOOLS_RESULT = new Set([
21406
20693
  "fetch_webpage",
21407
20694
  "web_fetch"
21408
20695
  ]);
21409
- // Strip query/fragment for URLs and normalize backslashes for paths so a
21410
- // citation that drops `?utm=...` or uses forward slashes on Windows still
21411
- // matches the visited entry. Also fold `~/...` to the resolved home dir
21412
- // so `~/Downloads/x` and `C:\Users\andre\Downloads\x` de-dupe.
20696
+ const TRACKING_PARAM_RE = /^(?:utm(?:_.*)?|fbclid|gclid|dclid|msclkid|mc_cid|mc_eid|igshid|ref_src)$/i;
20697
+ // Drop tracking params and in-page anchors for URLs and normalize
20698
+ // backslashes for paths so a citation that adds `?utm_source=...` or uses
20699
+ // forward slashes on Windows still matches the visited entry. Identifying
20700
+ // query params (Outlook `?ItemID=`, `watch?v=`) and hash routes (Gmail
20701
+ // `#all/<id>`) are kept verbatim: they are case-sensitive and are the only
20702
+ // thing that distinguishes two message permalinks. Also fold `~/...` to the
20703
+ // resolved home dir so `~/Downloads/x` and `C:\Users\andre\Downloads\x` de-dupe.
21413
20704
  function normalizeSource(raw) {
21414
20705
  const trimmed = raw.trim();
21415
20706
  if (!trimmed) return "";
21416
20707
  if (/^https?:\/\//i.test(trimmed)) {
21417
20708
  try {
21418
20709
  const u = new URL(trimmed);
21419
- return `${u.protocol}//${u.host}${u.pathname}`.replace(/\/+$/, "").toLowerCase();
20710
+ const base = `${u.protocol}//${u.host}${u.pathname}`.replace(/\/+$/, "").toLowerCase();
20711
+ const params = [
20712
+ ...u.searchParams
20713
+ ].filter(([key])=>!TRACKING_PARAM_RE.test(key)).sort(([a], [b])=>a < b ? -1 : a > b ? 1 : 0);
20714
+ const query = params.length > 0 ? `?${new URLSearchParams(params).toString()}` : "";
20715
+ const hashRoute = u.hash.includes("/") ? u.hash : "";
20716
+ return base + query + hashRoute;
21420
20717
  } catch {
21421
20718
  return trimmed.toLowerCase();
21422
20719
  }
@@ -21765,15 +21062,8 @@ ${sent}`;
21765
21062
  */ function parseCitationVerdict(text) {
21766
21063
  if (!text) return null;
21767
21064
  const stripped = text.replace(/```(?:json)?\s*/gi, "").replace(/```/g, "").trim();
21768
- const m = /\{[^]*"claims"[^]*\}/.exec(stripped);
21769
- if (!m) return null;
21770
- let parsed;
21771
- try {
21772
- parsed = JSON.parse(m[0]);
21773
- } catch {
21774
- return null;
21775
- }
21776
- if (!parsed || typeof parsed !== "object") return null;
21065
+ const parsed = findClaimsObject(stripped);
21066
+ if (!parsed) return null;
21777
21067
  const claimsRaw = parsed.claims;
21778
21068
  if (!Array.isArray(claimsRaw)) return null;
21779
21069
  const claims = [];
@@ -21800,6 +21090,41 @@ ${sent}`;
21800
21090
  }
21801
21091
  return claims;
21802
21092
  }
21093
+ // Models often wrap the verdict in prose that itself contains braces, so a
21094
+ // single greedy `{...}` match can start or end in the wrong place. Try each
21095
+ // `{` as a start and parse the balanced object it opens (string-aware).
21096
+ function findClaimsObject(text) {
21097
+ for(let start = text.indexOf("{"); start !== -1; start = text.indexOf("{", start + 1)){
21098
+ const end = balancedObjectEnd(text, start);
21099
+ if (end === -1) continue;
21100
+ const candidate = text.slice(start, end + 1);
21101
+ if (!candidate.includes('"claims"')) continue;
21102
+ try {
21103
+ const parsed = JSON.parse(candidate);
21104
+ if (parsed && typeof parsed === "object" && "claims" in parsed) return parsed;
21105
+ } catch {}
21106
+ }
21107
+ return null;
21108
+ }
21109
+ function balancedObjectEnd(text, start) {
21110
+ let depth = 0;
21111
+ let inString = false;
21112
+ for(let i = start; i < text.length; i++){
21113
+ const ch = text[i];
21114
+ if (inString) {
21115
+ if (ch === "\\") i++;
21116
+ else if (ch === '"') inString = false;
21117
+ } else if (ch === '"') {
21118
+ inString = true;
21119
+ } else if (ch === "{") {
21120
+ depth++;
21121
+ } else if (ch === "}") {
21122
+ depth--;
21123
+ if (depth === 0) return i;
21124
+ }
21125
+ }
21126
+ return -1;
21127
+ }
21803
21128
  function collectStringsFromPayload(payload, out) {
21804
21129
  if (!payload) return;
21805
21130
  if (typeof payload === "string") {
@@ -21893,6 +21218,7 @@ var transaction = __webpack_require__(99043);
21893
21218
 
21894
21219
 
21895
21220
 
21221
+
21896
21222
 
21897
21223
 
21898
21224
  const SELF_CONFIG_TOOLS = [
@@ -21962,17 +21288,31 @@ function hotTurnBoundary(threadId, agentCfg, scope, bridgeKey) {
21962
21288
  const boundary = userMessages[userMessages.length - turnLimit];
21963
21289
  return boundary?.seq ?? null;
21964
21290
  }
21965
- async function maybeAutoCompactOversizedThread(agentId, threadId, messageCount, onCompacting, preserveNewestMessages = 0) {
21291
+ // The topic-aware boundary keeps the whole active topic hot, so user turns
21292
+ // since the pin usually still exceed the limit right after a commit. Without a
21293
+ // cooldown every following turn re-runs the topic LLM pass only to land on the
21294
+ // same pin. Skip the next half-limit turns (2 rows per turn) before re-checking.
21295
+ function hotTurnCooldownUntil(messageCount, hotTurnLimit) {
21296
+ const turnLimit = hotTurnLimit ?? types/* DEFAULT_HOT_TURN_LIMIT */.u_;
21297
+ const skipTurns = Math.max(1, Math.ceil(Math.max(1, turnLimit) / 2));
21298
+ return messageCount + skipTurns * 2 + 1;
21299
+ }
21300
+ async function maybeAutoCompactOversizedThread(agentId, threadId, onCompacting, preserveNewestMessages = 0) {
21966
21301
  const cap = (0,config/* getConfig */.z)().maxThreadMessages;
21967
21302
  const keepLast = (0,thread_compaction/* autoCompactionKeepLast */.E)(cap);
21968
21303
  const retainedMessages = keepLast + preserveNewestMessages;
21969
21304
  const triggerAt = cap + (cap - keepLast);
21970
- if (!Number.isFinite(cap) || cap <= 0 || messageCount < triggerAt) return;
21305
+ if (!Number.isFinite(cap) || cap <= 0) return;
21306
+ // Only foreground rows are ever pruned; counting bridge/watcher/scheduled
21307
+ // rows would re-trigger an LLM compaction on every turn of a busy bridge
21308
+ // agent without ever bringing the count back under the cap.
21309
+ const messageCount = (0,threads/* countForegroundThreadMessages */.Tb)(threadId);
21310
+ if (messageCount < triggerAt) return;
21971
21311
  try {
21972
21312
  // A pin that already keeps the hot tier within the retained range must not
21973
21313
  // be pulled back to the cutoff, nor re-summarised by an LLM on every turn.
21974
21314
  const pinSeq = (0,threads/* getThread */.fG)(threadId)?.hot_since_seq ?? null;
21975
- if (pinSeq !== null && (0,threads/* countThreadMessagesFromSeq */.fW)(threadId, pinSeq) <= retainedMessages) {
21315
+ if (pinSeq !== null && (0,threads/* countForegroundThreadMessages */.Tb)(threadId, pinSeq) <= retainedMessages) {
21976
21316
  (0,threads/* pruneThreadMessages */.vC)(threadId, retainedMessages, pinSeq);
21977
21317
  return;
21978
21318
  }
@@ -22011,7 +21351,6 @@ async function persistThreadRunUserMessage(req) {
22011
21351
  if (!trimmed && !req.attachments?.length) {
22012
21352
  throw new RunThreadError(400, "message required", "message_required");
22013
21353
  }
22014
- const messageCountBefore = thread.message_count;
22015
21354
  const autoBoundaryScope = req.context_profile?.history_scope ?? (req.user_category === "bridge" ? "bridge" : "foreground");
22016
21355
  const idleMsBefore = isAutoBoundaryEligibleCategory(req.user_category) ? conversationIdleMs(req.thread_id, autoBoundaryScope, req.history_bridge_key ?? undefined) : null;
22017
21356
  const spilledAttachments = req.attachments?.length ? await (0,spill/* spillAttachments */.fX)(req.attachments) : undefined;
@@ -22031,7 +21370,6 @@ async function persistThreadRunUserMessage(req) {
22031
21370
  });
22032
21371
  return {
22033
21372
  attachments: spilledAttachments,
22034
- messageCountBefore,
22035
21373
  idleMsBefore,
22036
21374
  userMessageId: userMessage.msg_id,
22037
21375
  storedContent: stored
@@ -22178,7 +21516,7 @@ function appendHistoryMessage(history, injected) {
22178
21516
  let toolPermissionMap = baseToolPermissionMap;
22179
21517
  let allowedTools = requestedAllowedTools;
22180
21518
  if (!req._skip_persist_message && isAutoBoundaryEligibleCategory(req.user_category) && !hasPendingQueuedUserMessage(req.thread_id)) {
22181
- await maybeAutoCompactOversizedThread(agentCfg.id, req.thread_id, req._message_count_before_user ?? thread.message_count, req._onCompacting, req._user_message_persisted ? 2 : 0);
21519
+ await maybeAutoCompactOversizedThread(agentCfg.id, req.thread_id, req._onCompacting, req._user_message_persisted ? 2 : 0);
22182
21520
  }
22183
21521
  // Persist the user turn (including any attachments) before the LLM stream
22184
21522
  // so reload-mid-stream still shows the prompt. The stall-retry path sets
@@ -22220,7 +21558,11 @@ function appendHistoryMessage(history, injected) {
22220
21558
  const locked = !!latestThread && latestThread.message_count < (latestThread.auto_boundary_locked_until_msg_count ?? 0);
22221
21559
  if (!locked) {
22222
21560
  const boundary = hotTurnBoundary(req.thread_id, agentCfg, autoBoundaryScope);
22223
- if (boundary !== null) (0,warm_summary_background/* kickBoundaryCompaction */.Wg)(req.thread_id, boundary);
21561
+ if (boundary !== null) {
21562
+ (0,warm_summary_background/* kickBoundaryCompaction */.Wg)(req.thread_id, boundary, {
21563
+ autoBoundaryLockedUntilMessageCount: hotTurnCooldownUntil(latestThread?.message_count ?? 0, agentCfg.hot_turn_limit)
21564
+ });
21565
+ }
22224
21566
  }
22225
21567
  }
22226
21568
  }
@@ -22702,6 +22044,10 @@ async function* stallRetryStream(inner, originalReq, allowedTools, retriesLeft,
22702
22044
  // turns where the model's claimed action didn't actually happen.
22703
22045
  const toolCallIds = new Map();
22704
22046
  const failedProxyCallIds = new Set();
22047
+ // workflow_progress calls (direct or proxied) awaiting their result, so the
22048
+ // step contract can be checked from observed tool output at turn end.
22049
+ const pendingWorkflowArgs = new Map();
22050
+ const workflowObservations = [];
22705
22051
  let loopedToolName = null;
22706
22052
  let doneChunk = null;
22707
22053
  let sawError = false;
@@ -22717,7 +22063,11 @@ async function* stallRetryStream(inner, originalReq, allowedTools, retriesLeft,
22717
22063
  const name = unwrapInvokedToolName(rawName, args);
22718
22064
  if (name) {
22719
22065
  toolNames.push(name);
22720
- if (typeof data?.id === "string") toolCallIds.set(data.id, name);
22066
+ if (typeof data?.id === "string") {
22067
+ toolCallIds.set(data.id, name);
22068
+ const workflowArgs = workflowProgressArgs(rawName, args);
22069
+ if (workflowArgs) pendingWorkflowArgs.set(data.id, workflowArgs);
22070
+ }
22721
22071
  const sig = toolCallSignature(rawName, args);
22722
22072
  const count = (signatureCounts.get(sig) ?? 0) + 1;
22723
22073
  signatureCounts.set(sig, count);
@@ -22745,6 +22095,13 @@ async function* stallRetryStream(inner, originalReq, allowedTools, retriesLeft,
22745
22095
  failedProxyCallIds.add(data.id);
22746
22096
  }
22747
22097
  }
22098
+ if (typeof data?.id === "string" && pendingWorkflowArgs.has(data.id)) {
22099
+ workflowObservations.push({
22100
+ args: pendingWorkflowArgs.get(data.id),
22101
+ result: data.result
22102
+ });
22103
+ pendingWorkflowArgs.delete(data.id);
22104
+ }
22748
22105
  const summary = summarizeRetryValue(data?.result).trim();
22749
22106
  if (summary) {
22750
22107
  const clipped = summary.length > 240 ? `${summary.slice(0, 237)}...` : summary;
@@ -22860,6 +22217,10 @@ async function* stallRetryStream(inner, originalReq, allowedTools, retriesLeft,
22860
22217
  }
22861
22218
  const citationFail = uncitedHighClaims.length > 0;
22862
22219
  if (!stalled && !looped && fabrication.ok && !citationFail) {
22220
+ if (!sawError && workflowObservations.length > 0) {
22221
+ yield* workflowStepRetryStream(workflowObservations, originalReq, retriesLeft, attemptAbort, doneChunk, textBuf, toolNames, toolResultSummaries);
22222
+ return;
22223
+ }
22863
22224
  if (doneChunk) yield doneChunk;
22864
22225
  return;
22865
22226
  }
@@ -22978,6 +22339,64 @@ async function* stallRetryStream(inner, originalReq, allowedTools, retriesLeft,
22978
22339
  }
22979
22340
  }
22980
22341
  }
22342
+ // Workflow step contract auto-retry. Runs only after every other quality
22343
+ // gate passed, and has its own per-step budget (WORKFLOW_STEP_MAX_ATTEMPTS)
22344
+ // so a stall retry earlier in the turn never starves it. The retry is an
22345
+ // append-mode continuation: the turn's work stays visible, followed by the
22346
+ // model redoing only the failed steps.
22347
+ async function* workflowStepRetryStream(observations, originalReq, stallRetriesLeft, attemptAbort, doneChunk, textBuf, toolNames, toolResultSummaries) {
22348
+ const spent = originalReq._workflow_step_retries ?? {};
22349
+ const failures = collectWorkflowContractFailures(observations);
22350
+ const { retry, exhausted } = planWorkflowStepRetries(failures, spent);
22351
+ const spentTotal = Object.values(spent).reduce((sum, n)=>sum + n, 0);
22352
+ if (retry.length === 0 || spentTotal >= WORKFLOW_TURN_AUTO_RETRY_LIMIT) {
22353
+ const unresolved = [
22354
+ ...exhausted,
22355
+ ...retry
22356
+ ];
22357
+ if (unresolved.length > 0) {
22358
+ console.warn(`[workflow-retry] contract still failing after auto-retry: ${unresolved.map((f)=>f.key).join(", ")} thread=${originalReq.thread_id}`);
22359
+ yield {
22360
+ type: "text_delta",
22361
+ data: {
22362
+ delta: `\n\n*⚠️ Workflow step${unresolved.length === 1 ? "" : "s"} still failing the step contract after automatic retries: ${unresolved.slice(0, 4).map((f)=>`"${f.label}"`).join(", ")}. Use the step's retry button or review it manually.*`
22363
+ }
22364
+ };
22365
+ }
22366
+ if (doneChunk) yield doneChunk;
22367
+ return;
22368
+ }
22369
+ console.warn(`[workflow-retry] retrying ${retry.map((f)=>`${f.key}#${f.attempt}`).join(", ")} thread=${originalReq.thread_id}`);
22370
+ yield {
22371
+ type: "text_delta",
22372
+ data: {
22373
+ delta: "\n\n↻ "
22374
+ }
22375
+ };
22376
+ const nudge = buildWorkflowStepRetryNudge(retry);
22377
+ const retryContext = buildRetryContextSummary(textBuf, [
22378
+ ...toolNames
22379
+ ], [
22380
+ ...toolResultSummaries
22381
+ ]);
22382
+ const nudgeWithContext = retryContext ? `${nudge}\n\n${retryContext}` : nudge;
22383
+ const nextSpent = {
22384
+ ...spent
22385
+ };
22386
+ for (const failure of retry)nextSpent[failure.key] = (nextSpent[failure.key] ?? 0) + 1;
22387
+ attemptAbort.abort("workflow_step_retry");
22388
+ const next = await prepareThreadRun({
22389
+ ...originalReq,
22390
+ message: nudgeWithContext,
22391
+ attachments: undefined,
22392
+ _stall_retries_left: stallRetriesLeft,
22393
+ _workflow_step_retries: nextSpent,
22394
+ _retry_count: (originalReq._retry_count ?? 0) + 1,
22395
+ _skip_persist_message: true,
22396
+ _history_append_message: nudgeWithContext
22397
+ });
22398
+ for await (const chunk of next.stream)yield chunk;
22399
+ }
22981
22400
  // Footer appended to an assistant message that was cut off by the user
22982
22401
  // (Stop button or steer-while-streaming). Both human readers and the LLM
22983
22402
  // see this on the next turn — the agent treats it as "the previous reply
@@ -23832,4 +23251,4 @@ function recordWatcherPollError(id, error) {
23832
23251
 
23833
23252
  };
23834
23253
  ;
23835
- //# sourceMappingURL=424.js.map
23254
+ //# sourceMappingURL=1388.js.map