@circuitwall/jarela 2.2.1 → 2.3.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 (651) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-path-routes-manifest.json +6 -5
  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 +93 -93
  22. package/.next/standalone/.next/server/app/api/v1/access/route.js +169 -169
  23. package/.next/standalone/.next/server/app/api/v1/agents/[id]/compact/route.js +82 -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 +122 -122
  26. package/.next/standalone/.next/server/app/api/v1/agents/[id]/route.js +100 -100
  27. package/.next/standalone/.next/server/app/api/v1/agents/[id]/thread/route.js +753 -753
  28. package/.next/standalone/.next/server/app/api/v1/agents/route.js +65 -65
  29. package/.next/standalone/.next/server/app/api/v1/allowed-sites/[hostname]/route.js +364 -364
  30. package/.next/standalone/.next/server/app/api/v1/allowed-sites/route.js +802 -802
  31. package/.next/standalone/.next/server/app/api/v1/artifacts/lifecycle/route.js +2 -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 +589 -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 +23 -23
  37. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/ignores/route.js +30 -30
  38. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js +703 -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 +708 -135
  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 +802 -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 +739 -739
  45. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/routes/route.js +1035 -1035
  46. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js +679 -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 +804 -804
  49. package/.next/standalone/.next/server/app/api/v1/bridges/route.js +700 -700
  50. package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js +9 -9
  51. package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js.nft.json +1 -1
  52. package/.next/standalone/.next/server/app/api/v1/config/route.js +85 -85
  53. package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js +709 -709
  54. package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js.nft.json +1 -1
  55. package/.next/standalone/.next/server/app/api/v1/credentials/route.js +2 -2
  56. package/.next/standalone/.next/server/app/api/v1/credentials/route.js.nft.json +1 -1
  57. package/.next/standalone/.next/server/app/api/v1/dashboard/currency/route.js +10 -10
  58. package/.next/standalone/.next/server/app/api/v1/dashboard/metrics/route.js +784 -784
  59. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing/route.js +23 -23
  60. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js +86 -86
  61. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js.nft.json +1 -1
  62. package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js +57 -57
  63. package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js.nft.json +1 -1
  64. package/.next/standalone/.next/server/app/api/v1/documents/search/route.js +523 -523
  65. package/.next/standalone/.next/server/app/api/v1/documents/settings/route.js +44 -44
  66. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js +65 -65
  67. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js.nft.json +1 -1
  68. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js +122 -122
  69. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js.nft.json +1 -1
  70. package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js +37 -37
  71. package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js.nft.json +1 -1
  72. package/.next/standalone/.next/server/app/api/v1/env/route.js +9 -9
  73. package/.next/standalone/.next/server/app/api/v1/env-sync/allowlist/route.js +368 -368
  74. package/.next/standalone/.next/server/app/api/v1/env-sync/route.js +44 -44
  75. package/.next/standalone/.next/server/app/api/v1/events/route.js +751 -178
  76. package/.next/standalone/.next/server/app/api/v1/events/route.js.nft.json +1 -1
  77. package/.next/standalone/.next/server/app/api/v1/events/test/route.js +77 -77
  78. package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js +763 -763
  79. package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js.nft.json +1 -1
  80. package/.next/standalone/.next/server/app/api/v1/extension/browser/activate/route.js +44 -44
  81. package/.next/standalone/.next/server/app/api/v1/extension/browser/foreground/route.js +9 -9
  82. package/.next/standalone/.next/server/app/api/v1/extension/browser/history/route.js +65 -65
  83. package/.next/standalone/.next/server/app/api/v1/extension/browser/poll/route.js +34 -34
  84. package/.next/standalone/.next/server/app/api/v1/extension/browser/progress/route.js +204 -204
  85. package/.next/standalone/.next/server/app/api/v1/extension/browser/result/route.js +133 -133
  86. package/.next/standalone/.next/server/app/api/v1/extension/browser/retry/route.js +106 -106
  87. package/.next/standalone/.next/server/app/api/v1/extension/browser/status/route.js +114 -114
  88. package/.next/standalone/.next/server/app/api/v1/extension/browser/tabs/route.js +134 -134
  89. package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js +690 -690
  90. package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js.nft.json +1 -1
  91. package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js +93 -93
  92. package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js.nft.json +1 -1
  93. package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js +9 -9
  94. package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js.nft.json +1 -1
  95. package/.next/standalone/.next/server/app/api/v1/extensions/route.js +185 -185
  96. package/.next/standalone/.next/server/app/api/v1/extensions/route.js.nft.json +1 -1
  97. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js +171 -171
  98. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js.nft.json +1 -1
  99. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js +396 -396
  100. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js.nft.json +1 -1
  101. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js +212 -212
  102. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js.nft.json +1 -1
  103. package/.next/standalone/.next/server/app/api/v1/files/[name]/route.js +235 -235
  104. package/.next/standalone/.next/server/app/api/v1/fs/browse/route.js +26 -26
  105. package/.next/standalone/.next/server/app/api/v1/harnesses/[id]/route.js +221 -221
  106. package/.next/standalone/.next/server/app/api/v1/harnesses/default/route.js +58 -58
  107. package/.next/standalone/.next/server/app/api/v1/harnesses/route.js +72 -72
  108. package/.next/standalone/.next/server/app/api/v1/health/probes/route.js +9 -9
  109. package/.next/standalone/.next/server/app/api/v1/health/probes/route.js.nft.json +1 -1
  110. package/.next/standalone/.next/server/app/api/v1/health/route.js +772 -772
  111. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/route.js +133 -133
  112. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js +9 -9
  113. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js.nft.json +1 -1
  114. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/callback/route.js +363 -363
  115. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/start/route.js +233 -233
  116. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/status/route.js +682 -682
  117. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/callback/route.js +879 -879
  118. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/start/route.js +108 -108
  119. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/status/route.js +952 -952
  120. package/.next/standalone/.next/server/app/api/v1/integrations/route.js +216 -216
  121. package/.next/standalone/.next/server/app/api/v1/lifecycle/adoption/route.js +864 -847
  122. package/.next/standalone/.next/server/app/api/v1/lifecycle/adoption/route.js.nft.json +1 -1
  123. package/.next/standalone/.next/server/app/api/v1/local-file/route.js +26 -26
  124. package/.next/standalone/.next/server/app/api/v1/logs/route.js +70 -70
  125. package/.next/standalone/.next/server/app/api/v1/maps/embed/route.js +72 -72
  126. package/.next/standalone/.next/server/app/api/v1/mcp-servers/[name]/route.js +979 -979
  127. package/.next/standalone/.next/server/app/api/v1/mcp-servers/registry/route.js +196 -196
  128. package/.next/standalone/.next/server/app/api/v1/mcp-servers/route.js +2 -2
  129. package/.next/standalone/.next/server/app/api/v1/memory/[namespace]/[key]/route.js +381 -381
  130. package/.next/standalone/.next/server/app/api/v1/memory/policy/route.js +79 -79
  131. package/.next/standalone/.next/server/app/api/v1/memory/route.js +51 -51
  132. package/.next/standalone/.next/server/app/api/v1/memory/search/route.js +131 -131
  133. package/.next/standalone/.next/server/app/api/v1/models/[name]/compact-threads/route.js +374 -369
  134. package/.next/standalone/.next/server/app/api/v1/models/[name]/compact-threads/route.js.nft.json +1 -1
  135. package/.next/standalone/.next/server/app/api/v1/models/[name]/route.js +143 -143
  136. package/.next/standalone/.next/server/app/api/v1/models/route.js +543 -543
  137. package/.next/standalone/.next/server/app/api/v1/packages/catalog/route.js +445 -445
  138. package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js +120 -120
  139. package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js.nft.json +1 -1
  140. package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js +234 -234
  141. package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js.nft.json +1 -1
  142. package/.next/standalone/.next/server/app/api/v1/packages/install/route.js +407 -407
  143. package/.next/standalone/.next/server/app/api/v1/packages/install/route.js.nft.json +1 -1
  144. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js +37 -37
  145. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js.nft.json +1 -1
  146. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js +107 -107
  147. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js.nft.json +1 -1
  148. package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js +228 -228
  149. package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js.nft.json +1 -1
  150. package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js +9 -9
  151. package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js.nft.json +1 -1
  152. package/.next/standalone/.next/server/app/api/v1/packages/route.js +148 -148
  153. package/.next/standalone/.next/server/app/api/v1/packages/route.js.nft.json +1 -1
  154. package/.next/standalone/.next/server/app/api/v1/page-capture/route.js +787 -787
  155. package/.next/standalone/.next/server/app/api/v1/page-capture/route.js.nft.json +1 -1
  156. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js +507 -507
  157. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js.nft.json +1 -1
  158. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js +181 -181
  159. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js.nft.json +1 -1
  160. package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js +258 -258
  161. package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js.nft.json +1 -1
  162. package/.next/standalone/.next/server/app/api/v1/profile/location/route.js +30 -30
  163. package/.next/standalone/.next/server/app/api/v1/profile/route.js +164 -164
  164. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/models/route.js +44 -44
  165. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/probe/route.js +9 -9
  166. package/.next/standalone/.next/server/app/api/v1/providers/github-copilot/auth/route.js +164 -164
  167. package/.next/standalone/.next/server/app/api/v1/providers/route.js +94 -94
  168. package/.next/standalone/.next/server/app/api/v1/proxy-config/route.js +450 -450
  169. package/.next/standalone/.next/server/app/api/v1/redaction/init/route.js +37 -37
  170. package/.next/standalone/.next/server/app/api/v1/redaction/route.js +58 -58
  171. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/route.js +600 -600
  172. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js +44 -44
  173. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js.nft.json +1 -1
  174. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/route.js +732 -732
  175. package/.next/standalone/.next/server/app/api/v1/security/idle-timeout/route.js +359 -359
  176. package/.next/standalone/.next/server/app/api/v1/security/pin/route.js +197 -197
  177. package/.next/standalone/.next/server/app/api/v1/security/state/route.js +51 -51
  178. package/.next/standalone/.next/server/app/api/v1/security/unlock/route.js +176 -176
  179. package/.next/standalone/.next/server/app/api/v1/security/verify-pin/route.js +190 -190
  180. package/.next/standalone/.next/server/app/api/v1/setup/test-key/route.js +26 -26
  181. package/.next/standalone/.next/server/app/api/v1/skills/[id]/route.js +770 -770
  182. package/.next/standalone/.next/server/app/api/v1/skills/repos/[id]/route.js +115 -115
  183. package/.next/standalone/.next/server/app/api/v1/skills/repos/route.js +327 -327
  184. package/.next/standalone/.next/server/app/api/v1/skills/route.js +870 -870
  185. package/.next/standalone/.next/server/app/api/v1/system/abort/route.js +838 -808
  186. package/.next/standalone/.next/server/app/api/v1/system/restart/route.js +177 -177
  187. package/.next/standalone/.next/server/app/api/v1/system/restart/route.js.nft.json +1 -1
  188. package/.next/standalone/.next/server/app/api/v1/tailscale/route.js +164 -164
  189. package/.next/standalone/.next/server/app/api/v1/tasks/[agent_id]/route.js +115 -115
  190. package/.next/standalone/.next/server/app/api/v1/tasks/route.js +23 -23
  191. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route.js +1429 -0
  192. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route.js.nft.json +1 -0
  193. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route_client-reference-manifest.js +1 -0
  194. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/context-pin/route.js +635 -634
  195. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/context-pin/route.js.nft.json +1 -1
  196. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/route.js +53 -439
  197. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/route.js.nft.json +1 -1
  198. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js +172 -172
  199. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js.nft.json +1 -1
  200. package/.next/standalone/.next/server/app/api/v1/threads/route.js +908 -908
  201. package/.next/standalone/.next/server/app/api/v1/tools/route.js +2 -2
  202. package/.next/standalone/.next/server/app/api/v1/tools/route.js.nft.json +1 -1
  203. package/.next/standalone/.next/server/app/api/v1/update/apply/route.js +17 -17
  204. package/.next/standalone/.next/server/app/api/v1/update/apply/route.js.nft.json +1 -1
  205. package/.next/standalone/.next/server/app/api/v1/update/route.js +570 -570
  206. package/.next/standalone/.next/server/app/api/v1/voice/transcribe/route.js +224 -224
  207. package/.next/standalone/.next/server/app/api/v1/voice/tts/route.js +975 -975
  208. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/route.js +23 -23
  209. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js +72 -72
  210. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js.nft.json +1 -1
  211. package/.next/standalone/.next/server/app/api/v1/watchers/reaction-scripts/route.js +128 -128
  212. package/.next/standalone/.next/server/app/api/v1/watchers/route.js +164 -164
  213. package/.next/standalone/.next/server/app/api/v1/watchers/route.js.nft.json +1 -1
  214. package/.next/standalone/.next/server/app/icon.svg/route.js +62 -62
  215. package/.next/standalone/.next/server/app/manifest.webmanifest/route.js +436 -436
  216. package/.next/standalone/.next/server/app/page.js +1243 -854
  217. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  218. package/.next/standalone/.next/server/app/setup/page.js +91 -91
  219. package/.next/standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  220. package/.next/standalone/.next/server/app-paths-manifest.json +6 -5
  221. package/.next/standalone/.next/server/chunks/{424.js → 1388.js} +335 -986
  222. package/.next/standalone/.next/server/chunks/1433.js +1 -1
  223. package/.next/standalone/.next/server/chunks/1638.js +1 -2
  224. package/.next/standalone/.next/server/chunks/1738.js +1 -1
  225. package/.next/standalone/.next/server/chunks/210.js +6 -6
  226. package/.next/standalone/.next/server/chunks/2151.js +31 -1
  227. package/.next/standalone/.next/server/chunks/2207.js +1 -0
  228. package/.next/standalone/.next/server/chunks/2471.js +28 -28
  229. package/.next/standalone/.next/server/chunks/2504.js +1 -1
  230. package/.next/standalone/.next/server/chunks/2695.js +17 -17
  231. package/.next/standalone/.next/server/chunks/3042.js +14 -8
  232. package/.next/standalone/.next/server/chunks/3399.js +1 -1
  233. package/.next/standalone/.next/server/chunks/3566.js +1 -1
  234. package/.next/standalone/.next/server/chunks/4189.js +946 -0
  235. package/.next/standalone/.next/server/chunks/{9590.js → 423.js} +8 -3
  236. package/.next/standalone/.next/server/chunks/4433.js +146 -146
  237. package/.next/standalone/.next/server/chunks/4508.js +1 -1
  238. package/.next/standalone/.next/server/chunks/4588.js +1 -0
  239. package/.next/standalone/.next/server/chunks/46.js +5 -0
  240. package/.next/standalone/.next/server/chunks/466.js +12 -0
  241. package/.next/standalone/.next/server/chunks/4868.js +206 -206
  242. package/.next/standalone/.next/server/chunks/4992.js +13 -0
  243. package/.next/standalone/.next/server/chunks/5120.js +963 -0
  244. package/.next/standalone/.next/server/chunks/5701.js +1 -1
  245. package/.next/standalone/.next/server/chunks/5900.js +1 -1
  246. package/.next/standalone/.next/server/chunks/6210.js +1 -0
  247. package/.next/standalone/.next/server/chunks/6213.js +1 -1
  248. package/.next/standalone/.next/server/chunks/6649.js +2 -2
  249. package/.next/standalone/.next/server/chunks/6703.js +3 -3
  250. package/.next/standalone/.next/server/chunks/7445.js +1 -0
  251. package/.next/standalone/.next/server/chunks/8067.js +12 -0
  252. package/.next/standalone/.next/server/chunks/8461.js +14 -9
  253. package/.next/standalone/.next/server/chunks/8558.js +1 -1
  254. package/.next/standalone/.next/server/chunks/8724.js +1 -1
  255. package/.next/standalone/.next/server/chunks/8849.js +91 -91
  256. package/.next/standalone/.next/server/chunks/9032.js +6 -5
  257. package/.next/standalone/.next/server/chunks/{2563.js → 9164.js} +33173 -31461
  258. package/.next/standalone/.next/server/chunks/9237.js +396 -396
  259. package/.next/standalone/.next/server/chunks/{9640.js → 9304.js} +1628 -570
  260. package/.next/standalone/.next/server/chunks/9406.js +1 -1
  261. package/.next/standalone/.next/server/chunks/9824.js +98 -98
  262. package/.next/standalone/.next/server/chunks/9826.js +1 -0
  263. package/.next/standalone/.next/server/middleware-build-manifest.js +2 -2
  264. package/.next/standalone/.next/server/middleware.js +415 -397
  265. package/.next/standalone/.next/server/pages/404.html +2 -2
  266. package/.next/standalone/.next/server/pages/500.html +1 -1
  267. package/.next/standalone/.next/server/preview-props.json +3 -3
  268. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  269. package/.next/standalone/.next/static/chunks/{1395-a340fb0a345382a4.js → 1395-e4a99912b8f83044.js} +13 -1
  270. package/.next/standalone/.next/static/chunks/app/_global-error/{page-36cb8b428b38b26a.js → page-6fc5f8e744c81802.js} +1 -1
  271. package/.next/standalone/.next/static/chunks/app/api/v1/access/[identity]/{route-36cb8b428b38b26a.js → route-6fc5f8e744c81802.js} +1 -1
  272. package/.next/standalone/.next/static/chunks/app/api/v1/access/{route-36cb8b428b38b26a.js → route-6fc5f8e744c81802.js} +1 -1
  273. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/compact/{route-36cb8b428b38b26a.js → route-6fc5f8e744c81802.js} +1 -1
  274. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/display-filters/route-6fc5f8e744c81802.js +17 -0
  275. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/route-6fc5f8e744c81802.js +17 -0
  276. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/thread/route-6fc5f8e744c81802.js +17 -0
  277. package/.next/standalone/.next/static/chunks/app/api/v1/agents/route-6fc5f8e744c81802.js +17 -0
  278. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/[hostname]/route-6fc5f8e744c81802.js +17 -0
  279. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/route-6fc5f8e744c81802.js +17 -0
  280. package/.next/standalone/.next/static/chunks/app/api/v1/artifacts/lifecycle/route-6fc5f8e744c81802.js +17 -0
  281. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/files/route-6fc5f8e744c81802.js +17 -0
  282. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/images/route-6fc5f8e744c81802.js +17 -0
  283. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/chats/route-6fc5f8e744c81802.js +17 -0
  284. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/[remote_jid]/route-6fc5f8e744c81802.js +17 -0
  285. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/route-6fc5f8e744c81802.js +17 -0
  286. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/lookup/route-6fc5f8e744c81802.js +17 -0
  287. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/pair/route-6fc5f8e744c81802.js +17 -0
  288. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/route-6fc5f8e744c81802.js +17 -0
  289. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/[route_id]/route-6fc5f8e744c81802.js +17 -0
  290. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/route-6fc5f8e744c81802.js +17 -0
  291. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/status/route-6fc5f8e744c81802.js +17 -0
  292. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/kinds/route-6fc5f8e744c81802.js +17 -0
  293. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/route-6fc5f8e744c81802.js +17 -0
  294. package/.next/standalone/.next/static/chunks/app/api/v1/builtin-tools/route-6fc5f8e744c81802.js +17 -0
  295. package/.next/standalone/.next/static/chunks/app/api/v1/config/route-6fc5f8e744c81802.js +17 -0
  296. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/[id]/route-6fc5f8e744c81802.js +17 -0
  297. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/route-6fc5f8e744c81802.js +17 -0
  298. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/currency/route-6fc5f8e744c81802.js +17 -0
  299. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/metrics/route-6fc5f8e744c81802.js +17 -0
  300. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing/route-6fc5f8e744c81802.js +17 -0
  301. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing-task/route-6fc5f8e744c81802.js +17 -0
  302. package/.next/standalone/.next/static/chunks/app/api/v1/delegations/codex/[job_id]/route-6fc5f8e744c81802.js +17 -0
  303. package/.next/standalone/.next/static/chunks/app/api/v1/documents/search/route-6fc5f8e744c81802.js +17 -0
  304. package/.next/standalone/.next/static/chunks/app/api/v1/documents/settings/route-6fc5f8e744c81802.js +17 -0
  305. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/reindex/route-6fc5f8e744c81802.js +17 -0
  306. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/route-6fc5f8e744c81802.js +17 -0
  307. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/route-6fc5f8e744c81802.js +17 -0
  308. package/.next/standalone/.next/static/chunks/app/api/v1/env/route-6fc5f8e744c81802.js +17 -0
  309. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/allowlist/route-6fc5f8e744c81802.js +17 -0
  310. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/route-6fc5f8e744c81802.js +17 -0
  311. package/.next/standalone/.next/static/chunks/app/api/v1/events/route-6fc5f8e744c81802.js +17 -0
  312. package/.next/standalone/.next/static/chunks/app/api/v1/events/test/route-6fc5f8e744c81802.js +17 -0
  313. package/.next/standalone/.next/static/chunks/app/api/v1/extension/agents/route-6fc5f8e744c81802.js +17 -0
  314. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/activate/route-6fc5f8e744c81802.js +17 -0
  315. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/foreground/route-6fc5f8e744c81802.js +17 -0
  316. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/history/route-6fc5f8e744c81802.js +17 -0
  317. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/poll/route-6fc5f8e744c81802.js +17 -0
  318. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/progress/route-6fc5f8e744c81802.js +17 -0
  319. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/result/route-6fc5f8e744c81802.js +17 -0
  320. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/retry/route-6fc5f8e744c81802.js +17 -0
  321. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/status/route-6fc5f8e744c81802.js +17 -0
  322. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/tabs/route-6fc5f8e744c81802.js +17 -0
  323. package/.next/standalone/.next/static/chunks/app/api/v1/extension/fill/route-6fc5f8e744c81802.js +17 -0
  324. package/.next/standalone/.next/static/chunks/app/api/v1/extension/refine/route-6fc5f8e744c81802.js +17 -0
  325. package/.next/standalone/.next/static/chunks/app/api/v1/extension/turn/route-6fc5f8e744c81802.js +17 -0
  326. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/route-6fc5f8e744c81802.js +17 -0
  327. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/config/route-6fc5f8e744c81802.js +17 -0
  328. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/route-6fc5f8e744c81802.js +17 -0
  329. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/secrets/route-6fc5f8e744c81802.js +17 -0
  330. package/.next/standalone/.next/static/chunks/app/api/v1/files/[name]/route-6fc5f8e744c81802.js +17 -0
  331. package/.next/standalone/.next/static/chunks/app/api/v1/fs/browse/route-6fc5f8e744c81802.js +17 -0
  332. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/[id]/route-6fc5f8e744c81802.js +17 -0
  333. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/default/route-6fc5f8e744c81802.js +17 -0
  334. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/route-6fc5f8e744c81802.js +17 -0
  335. package/.next/standalone/.next/static/chunks/app/api/v1/health/probes/route-6fc5f8e744c81802.js +17 -0
  336. package/.next/standalone/.next/static/chunks/app/api/v1/health/route-6fc5f8e744c81802.js +17 -0
  337. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/route-6fc5f8e744c81802.js +17 -0
  338. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/test/route-6fc5f8e744c81802.js +17 -0
  339. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/callback/route-6fc5f8e744c81802.js +17 -0
  340. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/start/route-6fc5f8e744c81802.js +17 -0
  341. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/status/route-6fc5f8e744c81802.js +17 -0
  342. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/callback/route-6fc5f8e744c81802.js +17 -0
  343. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/start/route-6fc5f8e744c81802.js +17 -0
  344. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/status/route-6fc5f8e744c81802.js +17 -0
  345. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/route-6fc5f8e744c81802.js +17 -0
  346. package/.next/standalone/.next/static/chunks/app/api/v1/lifecycle/adoption/route-6fc5f8e744c81802.js +17 -0
  347. package/.next/standalone/.next/static/chunks/app/api/v1/local-file/route-6fc5f8e744c81802.js +17 -0
  348. package/.next/standalone/.next/static/chunks/app/api/v1/logs/route-6fc5f8e744c81802.js +17 -0
  349. package/.next/standalone/.next/static/chunks/app/api/v1/maps/embed/route-6fc5f8e744c81802.js +17 -0
  350. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/[name]/route-6fc5f8e744c81802.js +17 -0
  351. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/registry/route-6fc5f8e744c81802.js +17 -0
  352. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/route-6fc5f8e744c81802.js +17 -0
  353. package/.next/standalone/.next/static/chunks/app/api/v1/memory/[namespace]/[key]/route-6fc5f8e744c81802.js +17 -0
  354. package/.next/standalone/.next/static/chunks/app/api/v1/memory/policy/route-6fc5f8e744c81802.js +17 -0
  355. package/.next/standalone/.next/static/chunks/app/api/v1/memory/route-6fc5f8e744c81802.js +17 -0
  356. package/.next/standalone/.next/static/chunks/app/api/v1/memory/search/route-6fc5f8e744c81802.js +17 -0
  357. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/compact-threads/route-6fc5f8e744c81802.js +17 -0
  358. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/route-6fc5f8e744c81802.js +17 -0
  359. package/.next/standalone/.next/static/chunks/app/api/v1/models/route-6fc5f8e744c81802.js +17 -0
  360. package/.next/standalone/.next/static/chunks/app/api/v1/packages/catalog/route-6fc5f8e744c81802.js +17 -0
  361. package/.next/standalone/.next/static/chunks/app/api/v1/packages/defaults/[id]/route-6fc5f8e744c81802.js +17 -0
  362. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/[id]/route-6fc5f8e744c81802.js +17 -0
  363. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/route-6fc5f8e744c81802.js +17 -0
  364. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/enabled/route-6fc5f8e744c81802.js +17 -0
  365. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/route-6fc5f8e744c81802.js +17 -0
  366. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/route-6fc5f8e744c81802.js +17 -0
  367. package/.next/standalone/.next/static/chunks/app/api/v1/packages/reload/route-6fc5f8e744c81802.js +17 -0
  368. package/.next/standalone/.next/static/chunks/app/api/v1/packages/route-6fc5f8e744c81802.js +17 -0
  369. package/.next/standalone/.next/static/chunks/app/api/v1/page-capture/route-6fc5f8e744c81802.js +17 -0
  370. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/approve/route-6fc5f8e744c81802.js +17 -0
  371. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/deny/route-6fc5f8e744c81802.js +17 -0
  372. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/route-6fc5f8e744c81802.js +17 -0
  373. package/.next/standalone/.next/static/chunks/app/api/v1/profile/location/route-6fc5f8e744c81802.js +17 -0
  374. package/.next/standalone/.next/static/chunks/app/api/v1/profile/route-6fc5f8e744c81802.js +17 -0
  375. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/models/route-6fc5f8e744c81802.js +17 -0
  376. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/probe/route-6fc5f8e744c81802.js +17 -0
  377. package/.next/standalone/.next/static/chunks/app/api/v1/providers/github-copilot/auth/route-6fc5f8e744c81802.js +17 -0
  378. package/.next/standalone/.next/static/chunks/app/api/v1/providers/route-6fc5f8e744c81802.js +17 -0
  379. package/.next/standalone/.next/static/chunks/app/api/v1/proxy-config/route-6fc5f8e744c81802.js +17 -0
  380. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/init/route-6fc5f8e744c81802.js +17 -0
  381. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/route-6fc5f8e744c81802.js +17 -0
  382. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/route-6fc5f8e744c81802.js +17 -0
  383. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/run/route-6fc5f8e744c81802.js +17 -0
  384. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/route-6fc5f8e744c81802.js +17 -0
  385. package/.next/standalone/.next/static/chunks/app/api/v1/security/idle-timeout/route-6fc5f8e744c81802.js +17 -0
  386. package/.next/standalone/.next/static/chunks/app/api/v1/security/pin/route-6fc5f8e744c81802.js +17 -0
  387. package/.next/standalone/.next/static/chunks/app/api/v1/security/state/route-6fc5f8e744c81802.js +17 -0
  388. package/.next/standalone/.next/static/chunks/app/api/v1/security/unlock/route-6fc5f8e744c81802.js +17 -0
  389. package/.next/standalone/.next/static/chunks/app/api/v1/security/verify-pin/route-6fc5f8e744c81802.js +17 -0
  390. package/.next/standalone/.next/static/chunks/app/api/v1/setup/test-key/route-6fc5f8e744c81802.js +17 -0
  391. package/.next/standalone/.next/static/chunks/app/api/v1/skills/[id]/route-6fc5f8e744c81802.js +17 -0
  392. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/[id]/route-6fc5f8e744c81802.js +17 -0
  393. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/route-6fc5f8e744c81802.js +17 -0
  394. package/.next/standalone/.next/static/chunks/app/api/v1/skills/route-6fc5f8e744c81802.js +17 -0
  395. package/.next/standalone/.next/static/chunks/app/api/v1/system/abort/route-6fc5f8e744c81802.js +17 -0
  396. package/.next/standalone/.next/static/chunks/app/api/v1/system/restart/route-6fc5f8e744c81802.js +17 -0
  397. package/.next/standalone/.next/static/chunks/app/api/v1/tailscale/route-6fc5f8e744c81802.js +17 -0
  398. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/[agent_id]/route-6fc5f8e744c81802.js +17 -0
  399. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/route-6fc5f8e744c81802.js +17 -0
  400. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/activity/route-6fc5f8e744c81802.js +17 -0
  401. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/context-pin/route-6fc5f8e744c81802.js +17 -0
  402. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/route-6fc5f8e744c81802.js +17 -0
  403. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/run/route-6fc5f8e744c81802.js +17 -0
  404. package/.next/standalone/.next/static/chunks/app/api/v1/threads/route-6fc5f8e744c81802.js +17 -0
  405. package/.next/standalone/.next/static/chunks/app/api/v1/tools/route-6fc5f8e744c81802.js +17 -0
  406. package/.next/standalone/.next/static/chunks/app/api/v1/update/apply/route-6fc5f8e744c81802.js +17 -0
  407. package/.next/standalone/.next/static/chunks/app/api/v1/update/route-6fc5f8e744c81802.js +17 -0
  408. package/.next/standalone/.next/static/chunks/app/api/v1/voice/transcribe/route-6fc5f8e744c81802.js +17 -0
  409. package/.next/standalone/.next/static/chunks/app/api/v1/voice/tts/route-6fc5f8e744c81802.js +17 -0
  410. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/route-6fc5f8e744c81802.js +17 -0
  411. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/run/route-6fc5f8e744c81802.js +17 -0
  412. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/reaction-scripts/route-6fc5f8e744c81802.js +17 -0
  413. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/route-6fc5f8e744c81802.js +17 -0
  414. package/.next/standalone/.next/static/chunks/app/manifest.webmanifest/route-6fc5f8e744c81802.js +17 -0
  415. package/.next/standalone/.next/static/chunks/app/{page-7017f07f8a7a083c.js → page-213a623b37226452.js} +1041 -652
  416. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-6fc5f8e744c81802.js +17 -0
  417. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-6fc5f8e744c81802.js +17 -0
  418. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-6fc5f8e744c81802.js +17 -0
  419. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-6fc5f8e744c81802.js +17 -0
  420. package/.next/standalone/.next/static/css/{d80058f0b9b41c09.css → 312542a5725ba0d5.css} +2 -2
  421. package/.next/standalone/docs/adoption/changesets.json +309 -0
  422. package/.next/standalone/lib/skills/builtins/memory-organization/SKILL.md +16 -0
  423. package/.next/standalone/package.json +3 -3
  424. package/CHANGELOG.md +25 -0
  425. package/api/client.ts +9 -0
  426. package/api/types.ts +29 -0
  427. package/app/api/v1/lifecycle/adoption/route.ts +14 -2
  428. package/app/api/v1/models/[name]/compact-threads/route.ts +14 -11
  429. package/app/api/v1/threads/[thread_id]/activity/route.ts +19 -0
  430. package/app/api/v1/threads/[thread_id]/context-pin/route.test.ts +1 -0
  431. package/app/api/v1/threads/[thread_id]/context-pin/route.ts +2 -1
  432. package/app/api/v1/threads/[thread_id]/route.ts +5 -1
  433. package/components/chat/ChatView.tsx +52 -11
  434. package/components/chat/ContextBoundary.test.tsx +68 -1
  435. package/components/chat/ContextBoundary.tsx +92 -13
  436. package/components/chat/MessageList.test.tsx +31 -0
  437. package/components/chat/MessageList.tsx +49 -28
  438. package/components/chat/ToolList.test.tsx +92 -16
  439. package/components/chat/ToolList.tsx +59 -4
  440. package/components/chat/chat-helpers.test.tsx +24 -1
  441. package/components/chat/chat-helpers.ts +47 -4
  442. package/components/chat/useThreadActivity.test.tsx +113 -0
  443. package/components/chat/useThreadActivity.ts +94 -0
  444. package/components/chat/useThreadData.ts +16 -16
  445. package/components/chat/workflow-step-retry.ts +25 -0
  446. package/components/ui/BootScreen.tsx +17 -0
  447. package/components/ui/WorkflowChecklist.tsx +71 -33
  448. package/hooks/useSSE.ts +28 -3
  449. package/lib/agents/compaction-pipeline.test.ts +202 -0
  450. package/lib/agents/compaction-pipeline.ts +483 -0
  451. package/lib/agents/conversation-summary.ts +37 -21
  452. package/lib/agents/prepare/history-window.test.ts +18 -0
  453. package/lib/agents/prepare/history-window.ts +11 -2
  454. package/lib/agents/prepare/request.ts +4 -0
  455. package/lib/agents/prepare/system-prompt.test.ts +39 -0
  456. package/lib/agents/prepare/system-prompt.ts +8 -3
  457. package/lib/agents/prompt-registry.test.ts +5 -140
  458. package/lib/agents/prompt-registry.ts +45 -1
  459. package/lib/agents/prompt-variants.ts +146 -0
  460. package/lib/agents/run-registry.test.ts +22 -0
  461. package/lib/agents/run-registry.ts +29 -0
  462. package/lib/agents/run-thread.retry.test.ts +67 -1
  463. package/lib/agents/run-thread.ts +86 -1
  464. package/lib/agents/thread-activity.test.ts +31 -0
  465. package/lib/agents/thread-activity.ts +27 -0
  466. package/lib/agents/thread-compaction-state.test.ts +82 -0
  467. package/lib/agents/thread-compaction-state.ts +121 -0
  468. package/lib/agents/thread-compaction.test.ts +83 -4
  469. package/lib/agents/thread-compaction.ts +34 -11
  470. package/lib/agents/warm-summary-background.test.ts +219 -5
  471. package/lib/agents/warm-summary-background.ts +325 -142
  472. package/lib/agents/warm-topics.test.ts +37 -0
  473. package/lib/agents/warm-topics.ts +297 -0
  474. package/lib/agents/workflow-step-retry.test.ts +96 -0
  475. package/lib/agents/workflow-step-retry.ts +216 -0
  476. package/lib/api/browser-control.ts +0 -3
  477. package/lib/db/migrations.ts +5 -0
  478. package/lib/env/config.ts +2 -0
  479. package/lib/env/schema.ts +12 -0
  480. package/lib/lifecycle/changeset-build.test.ts +93 -0
  481. package/lib/lifecycle/changeset-build.ts +210 -0
  482. package/lib/lifecycle/changesets.test.ts +101 -0
  483. package/lib/lifecycle/changesets.ts +166 -0
  484. package/lib/lifecycle/surface-collect.test.ts +88 -0
  485. package/lib/lifecycle/surface-collect.ts +64 -0
  486. package/lib/lifecycle/surface-snapshot.test.ts +104 -0
  487. package/lib/lifecycle/surface-snapshot.ts +210 -0
  488. package/lib/memory/record.ts +0 -2
  489. package/lib/providers/external.ts +0 -2
  490. package/lib/skills/builtins/memory-organization/SKILL.md +16 -0
  491. package/lib/stores/threads.test.ts +9 -0
  492. package/lib/stores/threads.ts +21 -11
  493. package/lib/stores/version-adoption.test.ts +96 -0
  494. package/lib/stores/version-adoption.ts +239 -26
  495. package/lib/stores/workflow-progress.ts +3 -0
  496. package/lib/tools/communications/ms-todo.ts +0 -7
  497. package/lib/tools/general/memory.ts +1 -1
  498. package/lib/tools/general/workflow-progress.ts +2 -0
  499. package/lib/tools/runtime/catalog.ts +1 -25
  500. package/lib/triggers/registry.ts +0 -4
  501. package/package.json +3 -3
  502. package/scripts/install-to-system.ps1 +39 -11
  503. package/scripts/install-to-system.sh +37 -3
  504. package/.next/standalone/.next/server/chunks/3979.js +0 -581
  505. package/.next/standalone/.next/server/chunks/5936.js +0 -594
  506. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/display-filters/route-36cb8b428b38b26a.js +0 -17
  507. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/route-36cb8b428b38b26a.js +0 -17
  508. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/thread/route-36cb8b428b38b26a.js +0 -17
  509. package/.next/standalone/.next/static/chunks/app/api/v1/agents/route-36cb8b428b38b26a.js +0 -17
  510. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/[hostname]/route-36cb8b428b38b26a.js +0 -17
  511. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/route-36cb8b428b38b26a.js +0 -17
  512. package/.next/standalone/.next/static/chunks/app/api/v1/artifacts/lifecycle/route-36cb8b428b38b26a.js +0 -17
  513. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/files/route-36cb8b428b38b26a.js +0 -17
  514. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/images/route-36cb8b428b38b26a.js +0 -17
  515. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/chats/route-36cb8b428b38b26a.js +0 -17
  516. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/[remote_jid]/route-36cb8b428b38b26a.js +0 -17
  517. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/route-36cb8b428b38b26a.js +0 -17
  518. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/lookup/route-36cb8b428b38b26a.js +0 -17
  519. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/pair/route-36cb8b428b38b26a.js +0 -17
  520. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/route-36cb8b428b38b26a.js +0 -17
  521. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/[route_id]/route-36cb8b428b38b26a.js +0 -17
  522. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/route-36cb8b428b38b26a.js +0 -17
  523. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/status/route-36cb8b428b38b26a.js +0 -17
  524. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/kinds/route-36cb8b428b38b26a.js +0 -17
  525. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/route-36cb8b428b38b26a.js +0 -17
  526. package/.next/standalone/.next/static/chunks/app/api/v1/builtin-tools/route-36cb8b428b38b26a.js +0 -17
  527. package/.next/standalone/.next/static/chunks/app/api/v1/config/route-36cb8b428b38b26a.js +0 -17
  528. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/[id]/route-36cb8b428b38b26a.js +0 -17
  529. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/route-36cb8b428b38b26a.js +0 -17
  530. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/currency/route-36cb8b428b38b26a.js +0 -17
  531. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/metrics/route-36cb8b428b38b26a.js +0 -17
  532. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing/route-36cb8b428b38b26a.js +0 -17
  533. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing-task/route-36cb8b428b38b26a.js +0 -17
  534. package/.next/standalone/.next/static/chunks/app/api/v1/delegations/codex/[job_id]/route-36cb8b428b38b26a.js +0 -17
  535. package/.next/standalone/.next/static/chunks/app/api/v1/documents/search/route-36cb8b428b38b26a.js +0 -17
  536. package/.next/standalone/.next/static/chunks/app/api/v1/documents/settings/route-36cb8b428b38b26a.js +0 -17
  537. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/reindex/route-36cb8b428b38b26a.js +0 -17
  538. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/route-36cb8b428b38b26a.js +0 -17
  539. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/route-36cb8b428b38b26a.js +0 -17
  540. package/.next/standalone/.next/static/chunks/app/api/v1/env/route-36cb8b428b38b26a.js +0 -17
  541. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/allowlist/route-36cb8b428b38b26a.js +0 -17
  542. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/route-36cb8b428b38b26a.js +0 -17
  543. package/.next/standalone/.next/static/chunks/app/api/v1/events/route-36cb8b428b38b26a.js +0 -17
  544. package/.next/standalone/.next/static/chunks/app/api/v1/events/test/route-36cb8b428b38b26a.js +0 -17
  545. package/.next/standalone/.next/static/chunks/app/api/v1/extension/agents/route-36cb8b428b38b26a.js +0 -17
  546. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/activate/route-36cb8b428b38b26a.js +0 -17
  547. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/foreground/route-36cb8b428b38b26a.js +0 -17
  548. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/history/route-36cb8b428b38b26a.js +0 -17
  549. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/poll/route-36cb8b428b38b26a.js +0 -17
  550. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/progress/route-36cb8b428b38b26a.js +0 -17
  551. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/result/route-36cb8b428b38b26a.js +0 -17
  552. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/retry/route-36cb8b428b38b26a.js +0 -17
  553. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/status/route-36cb8b428b38b26a.js +0 -17
  554. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/tabs/route-36cb8b428b38b26a.js +0 -17
  555. package/.next/standalone/.next/static/chunks/app/api/v1/extension/fill/route-36cb8b428b38b26a.js +0 -17
  556. package/.next/standalone/.next/static/chunks/app/api/v1/extension/refine/route-36cb8b428b38b26a.js +0 -17
  557. package/.next/standalone/.next/static/chunks/app/api/v1/extension/turn/route-36cb8b428b38b26a.js +0 -17
  558. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/route-36cb8b428b38b26a.js +0 -17
  559. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/config/route-36cb8b428b38b26a.js +0 -17
  560. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/route-36cb8b428b38b26a.js +0 -17
  561. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/secrets/route-36cb8b428b38b26a.js +0 -17
  562. package/.next/standalone/.next/static/chunks/app/api/v1/files/[name]/route-36cb8b428b38b26a.js +0 -17
  563. package/.next/standalone/.next/static/chunks/app/api/v1/fs/browse/route-36cb8b428b38b26a.js +0 -17
  564. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/[id]/route-36cb8b428b38b26a.js +0 -17
  565. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/default/route-36cb8b428b38b26a.js +0 -17
  566. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/route-36cb8b428b38b26a.js +0 -17
  567. package/.next/standalone/.next/static/chunks/app/api/v1/health/probes/route-36cb8b428b38b26a.js +0 -17
  568. package/.next/standalone/.next/static/chunks/app/api/v1/health/route-36cb8b428b38b26a.js +0 -17
  569. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/route-36cb8b428b38b26a.js +0 -17
  570. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/test/route-36cb8b428b38b26a.js +0 -17
  571. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/callback/route-36cb8b428b38b26a.js +0 -17
  572. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/start/route-36cb8b428b38b26a.js +0 -17
  573. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/status/route-36cb8b428b38b26a.js +0 -17
  574. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/callback/route-36cb8b428b38b26a.js +0 -17
  575. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/start/route-36cb8b428b38b26a.js +0 -17
  576. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/status/route-36cb8b428b38b26a.js +0 -17
  577. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/route-36cb8b428b38b26a.js +0 -17
  578. package/.next/standalone/.next/static/chunks/app/api/v1/lifecycle/adoption/route-36cb8b428b38b26a.js +0 -17
  579. package/.next/standalone/.next/static/chunks/app/api/v1/local-file/route-36cb8b428b38b26a.js +0 -17
  580. package/.next/standalone/.next/static/chunks/app/api/v1/logs/route-36cb8b428b38b26a.js +0 -17
  581. package/.next/standalone/.next/static/chunks/app/api/v1/maps/embed/route-36cb8b428b38b26a.js +0 -17
  582. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/[name]/route-36cb8b428b38b26a.js +0 -17
  583. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/registry/route-36cb8b428b38b26a.js +0 -17
  584. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/route-36cb8b428b38b26a.js +0 -17
  585. package/.next/standalone/.next/static/chunks/app/api/v1/memory/[namespace]/[key]/route-36cb8b428b38b26a.js +0 -17
  586. package/.next/standalone/.next/static/chunks/app/api/v1/memory/policy/route-36cb8b428b38b26a.js +0 -17
  587. package/.next/standalone/.next/static/chunks/app/api/v1/memory/route-36cb8b428b38b26a.js +0 -17
  588. package/.next/standalone/.next/static/chunks/app/api/v1/memory/search/route-36cb8b428b38b26a.js +0 -17
  589. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/compact-threads/route-36cb8b428b38b26a.js +0 -17
  590. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/route-36cb8b428b38b26a.js +0 -17
  591. package/.next/standalone/.next/static/chunks/app/api/v1/models/route-36cb8b428b38b26a.js +0 -17
  592. package/.next/standalone/.next/static/chunks/app/api/v1/packages/catalog/route-36cb8b428b38b26a.js +0 -17
  593. package/.next/standalone/.next/static/chunks/app/api/v1/packages/defaults/[id]/route-36cb8b428b38b26a.js +0 -17
  594. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/[id]/route-36cb8b428b38b26a.js +0 -17
  595. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/route-36cb8b428b38b26a.js +0 -17
  596. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/enabled/route-36cb8b428b38b26a.js +0 -17
  597. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/route-36cb8b428b38b26a.js +0 -17
  598. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/route-36cb8b428b38b26a.js +0 -17
  599. package/.next/standalone/.next/static/chunks/app/api/v1/packages/reload/route-36cb8b428b38b26a.js +0 -17
  600. package/.next/standalone/.next/static/chunks/app/api/v1/packages/route-36cb8b428b38b26a.js +0 -17
  601. package/.next/standalone/.next/static/chunks/app/api/v1/page-capture/route-36cb8b428b38b26a.js +0 -17
  602. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/approve/route-36cb8b428b38b26a.js +0 -17
  603. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/deny/route-36cb8b428b38b26a.js +0 -17
  604. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/route-36cb8b428b38b26a.js +0 -17
  605. package/.next/standalone/.next/static/chunks/app/api/v1/profile/location/route-36cb8b428b38b26a.js +0 -17
  606. package/.next/standalone/.next/static/chunks/app/api/v1/profile/route-36cb8b428b38b26a.js +0 -17
  607. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/models/route-36cb8b428b38b26a.js +0 -17
  608. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/probe/route-36cb8b428b38b26a.js +0 -17
  609. package/.next/standalone/.next/static/chunks/app/api/v1/providers/github-copilot/auth/route-36cb8b428b38b26a.js +0 -17
  610. package/.next/standalone/.next/static/chunks/app/api/v1/providers/route-36cb8b428b38b26a.js +0 -17
  611. package/.next/standalone/.next/static/chunks/app/api/v1/proxy-config/route-36cb8b428b38b26a.js +0 -17
  612. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/init/route-36cb8b428b38b26a.js +0 -17
  613. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/route-36cb8b428b38b26a.js +0 -17
  614. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/route-36cb8b428b38b26a.js +0 -17
  615. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/run/route-36cb8b428b38b26a.js +0 -17
  616. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/route-36cb8b428b38b26a.js +0 -17
  617. package/.next/standalone/.next/static/chunks/app/api/v1/security/idle-timeout/route-36cb8b428b38b26a.js +0 -17
  618. package/.next/standalone/.next/static/chunks/app/api/v1/security/pin/route-36cb8b428b38b26a.js +0 -17
  619. package/.next/standalone/.next/static/chunks/app/api/v1/security/state/route-36cb8b428b38b26a.js +0 -17
  620. package/.next/standalone/.next/static/chunks/app/api/v1/security/unlock/route-36cb8b428b38b26a.js +0 -17
  621. package/.next/standalone/.next/static/chunks/app/api/v1/security/verify-pin/route-36cb8b428b38b26a.js +0 -17
  622. package/.next/standalone/.next/static/chunks/app/api/v1/setup/test-key/route-36cb8b428b38b26a.js +0 -17
  623. package/.next/standalone/.next/static/chunks/app/api/v1/skills/[id]/route-36cb8b428b38b26a.js +0 -17
  624. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/[id]/route-36cb8b428b38b26a.js +0 -17
  625. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/route-36cb8b428b38b26a.js +0 -17
  626. package/.next/standalone/.next/static/chunks/app/api/v1/skills/route-36cb8b428b38b26a.js +0 -17
  627. package/.next/standalone/.next/static/chunks/app/api/v1/system/abort/route-36cb8b428b38b26a.js +0 -17
  628. package/.next/standalone/.next/static/chunks/app/api/v1/system/restart/route-36cb8b428b38b26a.js +0 -17
  629. package/.next/standalone/.next/static/chunks/app/api/v1/tailscale/route-36cb8b428b38b26a.js +0 -17
  630. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/[agent_id]/route-36cb8b428b38b26a.js +0 -17
  631. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/route-36cb8b428b38b26a.js +0 -17
  632. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/context-pin/route-36cb8b428b38b26a.js +0 -17
  633. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/route-36cb8b428b38b26a.js +0 -17
  634. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/run/route-36cb8b428b38b26a.js +0 -17
  635. package/.next/standalone/.next/static/chunks/app/api/v1/threads/route-36cb8b428b38b26a.js +0 -17
  636. package/.next/standalone/.next/static/chunks/app/api/v1/tools/route-36cb8b428b38b26a.js +0 -17
  637. package/.next/standalone/.next/static/chunks/app/api/v1/update/apply/route-36cb8b428b38b26a.js +0 -17
  638. package/.next/standalone/.next/static/chunks/app/api/v1/update/route-36cb8b428b38b26a.js +0 -17
  639. package/.next/standalone/.next/static/chunks/app/api/v1/voice/transcribe/route-36cb8b428b38b26a.js +0 -17
  640. package/.next/standalone/.next/static/chunks/app/api/v1/voice/tts/route-36cb8b428b38b26a.js +0 -17
  641. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/route-36cb8b428b38b26a.js +0 -17
  642. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/run/route-36cb8b428b38b26a.js +0 -17
  643. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/reaction-scripts/route-36cb8b428b38b26a.js +0 -17
  644. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/route-36cb8b428b38b26a.js +0 -17
  645. package/.next/standalone/.next/static/chunks/app/manifest.webmanifest/route-36cb8b428b38b26a.js +0 -17
  646. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-36cb8b428b38b26a.js +0 -17
  647. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-36cb8b428b38b26a.js +0 -17
  648. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-36cb8b428b38b26a.js +0 -17
  649. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-36cb8b428b38b26a.js +0 -17
  650. /package/.next/standalone/.next/static/{NUrC9xax1sp1Q70nlFqS6 → bMRK5y3ruT7c3WtBfCQOG}/_buildManifest.js +0 -0
  651. /package/.next/standalone/.next/static/{NUrC9xax1sp1Q70nlFqS6 → bMRK5y3ruT7c3WtBfCQOG}/_ssgManifest.js +0 -0
@@ -94,884 +94,914 @@ module.exports = require("next/dist/server/app-render/work-async-storage.externa
94
94
 
95
95
  /***/ }),
96
96
 
97
- /***/ 33873:
98
- /***/ ((module) => {
97
+ /***/ 29419:
98
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
99
99
 
100
- module.exports = require("path");
100
+ __webpack_require__.r(__webpack_exports__);
101
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
102
+ /* harmony export */ handler: () => (/* binding */ handler),
103
+ /* harmony export */ patchFetch: () => (/* binding */ patchFetch),
104
+ /* harmony export */ routeModule: () => (/* binding */ routeModule),
105
+ /* harmony export */ serverHooks: () => (/* binding */ serverHooks),
106
+ /* harmony export */ workAsyncStorage: () => (/* binding */ workAsyncStorage),
107
+ /* harmony export */ workUnitAsyncStorage: () => (/* binding */ workUnitAsyncStorage)
108
+ /* harmony export */ });
109
+ /* harmony import */ var next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(19225);
110
+ /* harmony import */ var next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__);
111
+ /* harmony import */ var next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84006);
112
+ /* harmony import */ var next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8317);
113
+ /* harmony import */ var next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__);
114
+ /* harmony import */ var next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(99373);
115
+ /* harmony import */ var next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__);
116
+ /* harmony import */ var next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(34775);
117
+ /* harmony import */ var next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__);
118
+ /* harmony import */ var next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(24235);
119
+ /* harmony import */ var next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__);
120
+ /* harmony import */ var next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(261);
121
+ /* harmony import */ var next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__);
122
+ /* harmony import */ var next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(54365);
123
+ /* harmony import */ var next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__);
124
+ /* harmony import */ var next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(90771);
125
+ /* harmony import */ var next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8__);
126
+ /* harmony import */ var next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(73461);
127
+ /* harmony import */ var next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__);
128
+ /* harmony import */ var next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(67798);
129
+ /* harmony import */ var next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(92280);
130
+ /* harmony import */ var next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(62018);
131
+ /* harmony import */ var next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__);
132
+ /* harmony import */ var next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(45696);
133
+ /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(47929);
134
+ /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__);
135
+ /* harmony import */ var next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(86439);
136
+ /* harmony import */ var next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__);
137
+ /* harmony import */ var next_dist_server_lib_route_cache_key__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(10246);
138
+ /* harmony import */ var next_dist_server_lib_route_cache_key__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(next_dist_server_lib_route_cache_key__WEBPACK_IMPORTED_MODULE_16__);
139
+ /* harmony import */ var next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(37527);
140
+ /* harmony import */ var next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__);
101
141
 
102
- /***/ }),
103
142
 
104
- /***/ 44870:
105
- /***/ ((module) => {
106
143
 
107
- module.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js");
108
144
 
109
- /***/ }),
110
145
 
111
- /***/ 48161:
112
- /***/ ((module) => {
113
146
 
114
- module.exports = require("node:os");
115
147
 
116
- /***/ }),
117
148
 
118
- /***/ 55511:
119
- /***/ ((module) => {
120
149
 
121
- module.exports = require("crypto");
122
150
 
123
- /***/ }),
124
151
 
125
- /***/ 63033:
126
- /***/ ((module) => {
127
152
 
128
- module.exports = require("next/dist/server/app-render/work-unit-async-storage.external.js");
129
153
 
130
- /***/ }),
131
154
 
132
- /***/ 68564:
133
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
134
155
 
135
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
136
- /* harmony export */ AD: () => (/* binding */ startRun),
137
- /* harmony export */ B1: () => (/* binding */ subscribe),
138
- /* harmony export */ Cs: () => (/* binding */ waitForRun),
139
- /* harmony export */ ES: () => (/* binding */ abortAllRuns),
140
- /* harmony export */ JH: () => (/* binding */ finishRun),
141
- /* harmony export */ KD: () => (/* binding */ abortRun),
142
- /* harmony export */ Mh: () => (/* binding */ getRun),
143
- /* harmony export */ QK: () => (/* binding */ drainSteering),
144
- /* harmony export */ mq: () => (/* binding */ broadcast),
145
- /* harmony export */ mx: () => (/* binding */ pushSteering)
146
- /* harmony export */ });
147
- /* unused harmony export waitForRunsToSettle */
148
- /* harmony import */ var _lib_env_config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67500);
149
- /* harmony import */ var _lib_utils_global_state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15559);
150
156
 
151
157
 
152
- // Read once at module init. JARELA_RUN_BUFFER_SIZE / JARELA_RUN_REGISTRY_TTL_MS
153
- // override the defaults.
154
- const MAX_BUFFERED = (0,_lib_env_config__WEBPACK_IMPORTED_MODULE_0__/* .getConfig */ .z)().runBufferSize;
155
- const RECENT_TTL_MS = (0,_lib_env_config__WEBPACK_IMPORTED_MODULE_0__/* .getConfig */ .z)().runRegistryTtlMs;
156
- // Idle (no-progress) ceiling and wall-clock ceiling: read fresh per-run
157
- // from getConfig() so non-restart-required env reloads take effect.
158
- function runIdleMs() {
159
- return (0,_lib_env_config__WEBPACK_IMPORTED_MODULE_0__/* .getConfig */ .z)().runIdleMs;
160
- }
161
- function runMaxMs() {
162
- return (0,_lib_env_config__WEBPACK_IMPORTED_MODULE_0__/* .getConfig */ .z)().runMaxMs;
163
- }
164
- const registryState = (0,_lib_utils_global_state__WEBPACK_IMPORTED_MODULE_1__/* .getOrCreateGlobal */ .X)("__jarela_active_run_registry", ()=>({
165
- runs: new Map(),
166
- waiters: new Map()
167
- }));
168
- const runs = registryState.runs;
169
- // Cold-attach waiters: subscribers that opened a GET /run before the
170
- // server-side run actually called startRun (typical for triggers /
171
- // scheduler / watcher, which submit through `after()` + the per-thread
172
- // queue, so there's a real delay between the user clicking "Run now"
173
- // and the registry entry appearing). Resolved by `startRun` below.
174
- const waiters = registryState.waiters;
175
- /** Wait up to `timeoutMs` for a run to be registered on `thread_id`.
176
- * Resolves immediately with the current run if one is already active,
177
- * with the new run when `startRun` fires inside the window, or with
178
- * `null` on timeout. `timeoutMs <= 0` short-circuits to the current
179
- * state without waiting. Caller is responsible for closing the SSE
180
- * stream when this resolves null. */ function waitForRun(thread_id, timeoutMs) {
181
- const existing = runs.get(thread_id);
182
- if (existing) return Promise.resolve(existing);
183
- if (timeoutMs <= 0) return Promise.resolve(null);
184
- return new Promise((resolve)=>{
185
- let set = waiters.get(thread_id);
186
- if (!set) {
187
- set = new Set();
188
- waiters.set(thread_id, set);
189
- }
190
- const fn = (run)=>{
191
- clearTimeout(timer);
192
- resolve(run);
193
- };
194
- set.add(fn);
195
- const timer = setTimeout(()=>{
196
- const cur = waiters.get(thread_id);
197
- cur?.delete(fn);
198
- if (cur && cur.size === 0) waiters.delete(thread_id);
199
- resolve(null);
200
- }, timeoutMs);
201
- timer.unref?.();
158
+
159
+ // We inject the nextConfigOutput here so that we can use them in the route
160
+ // module.
161
+ const nextConfigOutput = "standalone"
162
+ const routeModule = new next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__.AppRouteRouteModule({
163
+ definition: {
164
+ kind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
165
+ page: "/api/v1/system/abort/route",
166
+ pathname: "/api/v1/system/abort",
167
+ filename: "route",
168
+ bundlePath: "app/api/v1/system/abort/route"
169
+ },
170
+ distDir: ".next" || 0,
171
+ relativeProjectDir: false || '',
172
+ resolvedPagePath: "/home/runner/work/jarela/jarela/app/api/v1/system/abort/route.ts",
173
+ nextConfigOutput,
174
+ // The lazy require factory ensures that:
175
+ // - In dev: devRequestTimingInternalsEnd is set before userland executes,
176
+ // correctly attributing module load time to application-code rather than
177
+ // framework internals.
178
+ // - In all modes: async modules (route files with top-level await) are
179
+ // handled correctly — require() returns a Promise for such modules, which
180
+ // ensureUserland() awaits before the first request is handled.
181
+ userland: ()=>__webpack_require__(5839),
182
+ // In Turbopack dev mode, also provide a synchronous per-request getter so
183
+ // server HMR updates are picked up without re-executing the entry chunk.
184
+ // Using require() (synchronous) avoids adding async overhead that would be
185
+ // incorrectly attributed to application-code time in devRequestTiming.
186
+ ... false ? 0 : {}
187
+ });
188
+ // Pull out the exports that we need to expose from the module. This should
189
+ // be eliminated when we've moved the other routes to the new format. These
190
+ // are used to hook into the route.
191
+ const { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;
192
+ function patchFetch() {
193
+ return (0,next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__.patchFetch)({
194
+ workAsyncStorage,
195
+ workUnitAsyncStorage
202
196
  });
203
197
  }
204
- function startRun(thread_id, agent_id) {
205
- // If a stale completed run exists, drop it before starting a new one.
206
- const existing = runs.get(thread_id);
207
- if (existing && existing.status === "running") {
208
- throw new Error(`A run is already active for thread ${thread_id}`);
198
+
199
+ async function handler(req, res, ctx) {
200
+ if (ctx.requestMeta) {
201
+ (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.setRequestMeta)(req, ctx.requestMeta);
209
202
  }
210
- const now = Date.now();
211
- const run = {
212
- thread_id,
213
- agent_id,
214
- started_at: now,
215
- finished_at: null,
216
- status: "running",
217
- events: [],
218
- subscribers: new Set(),
219
- final_text: "",
220
- abort: new AbortController(),
221
- last_chunk_at: now,
222
- inflight_tools: new Set(),
223
- tool_started_at: new Map(),
224
- tool_time_ms_done: 0,
225
- steering: []
203
+ if (routeModule.isDev) {
204
+ (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.addRequestMeta)(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());
205
+ }
206
+ let srcPage = "/api/v1/system/abort/route";
207
+ // turbopack doesn't normalize `/index` in the page name
208
+ // so we need to to process dynamic routes properly
209
+ // TODO: fix turbopack providing differing value from webpack
210
+ if (false) {} else if (srcPage === '/index') {
211
+ // we always normalize /index specifically
212
+ srcPage = '/';
213
+ }
214
+ const multiZoneDraftMode = false;
215
+ const prepareResult = await routeModule.prepare(req, res, {
216
+ srcPage,
217
+ multiZoneDraftMode
218
+ });
219
+ if (!prepareResult) {
220
+ res.statusCode = 400;
221
+ res.end('Bad Request');
222
+ ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());
223
+ return null;
224
+ }
225
+ const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest, previewProps } = prepareResult;
226
+ const normalizedSrcPage = (0,next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__.normalizeAppPath)(srcPage);
227
+ // Only this route's prerenders can establish ISR or admit generated params.
228
+ const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]) && (routeModule.isDev || (0,next_dist_server_lib_route_cache_key__WEBPACK_IMPORTED_MODULE_16__.isRouteCacheOwner)(resolvedPathname, routeModule.cacheOwner, prerenderManifest.routes[resolvedPathname]));
229
+ let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || isPrerendered);
230
+ const render404 = async ()=>{
231
+ // TODO: should route-module itself handle rendering the 404
232
+ if (routerServerContext == null ? void 0 : routerServerContext.render404) {
233
+ await routerServerContext.render404(req, res, parsedUrl, false);
234
+ } else {
235
+ res.end('This page could not be found');
236
+ }
237
+ return null;
226
238
  };
227
- runs.set(thread_id, run);
228
- // Wake any GET subscribers that attached before the run was registered.
229
- const pending = waiters.get(thread_id);
230
- if (pending) {
231
- waiters.delete(thread_id);
232
- for (const fn of pending){
233
- try {
234
- fn(run);
235
- } catch {}
239
+ if (isIsr && !isDraftMode) {
240
+ const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];
241
+ if (prerenderInfo) {
242
+ if (prerenderInfo.fallback === false && !isPrerendered) {
243
+ if (nextConfig.adapterPath) {
244
+ return await render404();
245
+ }
246
+ throw new next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError();
247
+ }
236
248
  }
237
249
  }
238
- scheduleIdleWatchdog(run);
239
- scheduleMaxWatchdog(run);
240
- return run;
241
- }
242
- // Synthesise a typed error chunk for the watchdog termination paths and
243
- // fan it out to subscribers BEFORE flipping `status` to "error". The order
244
- // matters: `broadcast()`'s status guard drops any chunk delivered after
245
- // `finishRun()` has run, so calling finishRun first would silently swallow
246
- // the error and the client's EventSource would just see the connection
247
- // close with no terminal event — bubble keeps spinning, no toast. Doing
248
- // it the other way around lets the client receive a real error event,
249
- // render a "Run timed out" toast, and (if the consumer wires it up)
250
- // trigger an auto-retry path. Followed by `done` so the consumer's
251
- // for-await loop can break cleanly without waiting for an EOF.
252
- function emitWatchdogTermination(run, code, message) {
253
- if (run.status !== "running") return;
254
- // Direct registry mutation so the broadcast goes through the regular
255
- // path (subscribers + buffer + seq stamp) without re-entering any of
256
- // the watchdog scheduling. Mirrors broadcast() but bypasses the
257
- // status check we'd otherwise be racing against.
258
- run.last_chunk_at = Date.now();
259
- const errChunk = {
260
- type: "error",
261
- data: {
262
- message,
263
- code
264
- }
265
- };
266
- if (run.events.length < MAX_BUFFERED) run.events.push(errChunk);
267
- for (const fn of run.subscribers){
268
- try {
269
- fn(errChunk);
270
- } catch {}
271
- }
272
- // Pair with a synthetic `done` so the client's consume() loop breaks
273
- // on a terminal event rather than waiting for the EventSource to close.
274
- const doneChunk = {
275
- type: "done",
276
- data: {}
277
- };
278
- if (run.events.length < MAX_BUFFERED) run.events.push(doneChunk);
279
- for (const fn of run.subscribers){
280
- try {
281
- fn(doneChunk);
282
- } catch {}
250
+ let cacheKey = null;
251
+ if (isIsr && !routeModule.isDev && !isDraftMode) {
252
+ cacheKey = resolvedPathname;
253
+ // ensure /index and / is normalized to one key
254
+ cacheKey = cacheKey === '/index' ? '/' : cacheKey;
283
255
  }
284
- }
285
- // Self-rearming idle watchdog. Fires when no chunk has arrived for
286
- // `idleMs`; otherwise reschedules itself for `(last_chunk_at + idleMs) -
287
- // now`. We never carry a handle on the run — the closure just bails if
288
- // the run is no longer the registry's entry or no longer running.
289
- function scheduleIdleWatchdog(run) {
290
- const idleMs = runIdleMs();
291
- const fireIn = Math.max(0, run.last_chunk_at + idleMs - Date.now());
292
- setTimeout(()=>{
293
- const cur = runs.get(run.thread_id);
294
- if (cur !== run) return;
295
- if (run.status !== "running") return;
296
- const idle = Date.now() - run.last_chunk_at;
297
- if (idle < idleMs) {
298
- scheduleIdleWatchdog(run);
299
- return;
300
- }
301
- if (run.inflight_tools.size > 0) {
302
- // Tool execution in progress — silence here is the tool working,
303
- // not a wedged provider stream. Skip the kill, re-check in idleMs.
304
- // The tool_result will bump last_chunk_at when it lands.
305
- setTimeout(()=>scheduleIdleWatchdog(run), idleMs).unref?.();
306
- return;
307
- }
308
- console.warn(`[run-registry] idle watchdog: force-finishing stalled run for thread ${run.thread_id} after ${idle}ms of no progress`);
309
- 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.`);
310
- try {
311
- run.abort.abort("run_idle_timeout");
312
- } catch {}
313
- finishRun(run, "error");
314
- }, fireIn).unref?.();
315
- }
316
- // Wall-clock elapsed minus time spent inside tool calls (both completed and
317
- // currently in flight). The wall-clock watchdog uses this so a 5-minute
318
- // shell exec or a slow MCP roundtrip doesn't burn the agent's budget;
319
- // tools enforce their own timeouts. See ActiveRun.tool_started_at for the
320
- // rationale.
321
- function effectiveElapsedMs(run, now) {
322
- let inflightToolMs = 0;
323
- for (const startedAt of run.tool_started_at.values()){
324
- inflightToolMs += Math.max(0, now - startedAt);
256
+ // Before rendering (which initializes component tree modules), we have to
257
+ // set the reference manifests to our global store so Server Action's
258
+ // encryption util can access to them at the top level of the page module.
259
+ if (serverActionsManifest && clientReferenceManifest) {
260
+ (0,next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__.setManifestsSingleton)({
261
+ page: srcPage,
262
+ clientReferenceManifest,
263
+ serverActionsManifest
264
+ });
325
265
  }
326
- return Math.max(0, now - run.started_at - run.tool_time_ms_done - inflightToolMs);
327
- }
328
- function scheduleMaxWatchdog(run) {
329
- const max = runMaxMs();
330
- const now = Date.now();
331
- const fireIn = Math.max(0, max - effectiveElapsedMs(run, now));
332
- setTimeout(()=>{
333
- const cur = runs.get(run.thread_id);
334
- if (cur !== run) return;
335
- if (run.status !== "running") return;
336
- const elapsed = effectiveElapsedMs(run, Date.now());
337
- if (elapsed < max) {
338
- // Tool time pushed the effective elapsed back below the ceiling —
339
- // re-arm for the remaining budget. Without this, a tool that runs
340
- // for longer than `max` between firing and resolving would let
341
- // the next setTimeout overshoot.
342
- scheduleMaxWatchdog(run);
343
- return;
266
+ const method = req.method || 'GET';
267
+ const tracer = (0,next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.getTracer)();
268
+ const activeSpan = tracer.getActiveScopeSpan();
269
+ const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);
270
+ const isMinimalMode = Boolean((0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'minimalMode'));
271
+ const incrementalCache = (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, previewProps, prerenderManifest, isMinimalMode);
272
+ incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();
273
+ globalThis.__incrementalCache = incrementalCache;
274
+ const context = {
275
+ params,
276
+ previewProps,
277
+ renderOpts: {
278
+ experimental: {
279
+ authInterrupts: Boolean(nextConfig.experimental.authInterrupts),
280
+ useCacheTimeout: nextConfig.experimental.useCacheTimeout,
281
+ durableUseCacheEntries: Boolean(nextConfig.experimental.durableUseCacheEntries)
282
+ },
283
+ cacheComponents: Boolean(nextConfig.cacheComponents),
284
+ validationLevel: nextConfig.experimental.instantInsights.validationLevel,
285
+ isDraftMode,
286
+ incrementalCache,
287
+ hmrRefreshHash: (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'hmrRefreshHash'),
288
+ cacheLifeProfiles: nextConfig.cacheLife,
289
+ staticPageGenerationTimeout: nextConfig.staticPageGenerationTimeout,
290
+ waitUntil: ctx.waitUntil,
291
+ onClose: (cb)=>{
292
+ res.on('close', cb);
293
+ },
294
+ onAfterTaskError: undefined
295
+ },
296
+ sharedContext: {
297
+ buildId,
298
+ deploymentId
344
299
  }
345
- console.warn(`[run-registry] wall-clock watchdog: force-finishing run for thread ${run.thread_id} after ${elapsed}ms of agent time (excluding tool execution)`);
346
- 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.`);
300
+ };
301
+ const nodeNextReq = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextRequest(req);
302
+ const nodeNextRes = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextResponse(res);
303
+ const nextReq = next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8__.NextRequestAdapter.fromNodeNextRequest(nodeNextReq, (0,next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8__.signalFromNodeResponse)(res));
304
+ const responseGenerator = async ({ previousCacheEntry })=>{
347
305
  try {
348
- run.abort.abort("run_watchdog_timeout");
349
- } catch {}
350
- finishRun(run, "error");
351
- }, fireIn).unref?.();
352
- }
353
- function broadcast(run, chunk) {
354
- // Identity-check: a superseded run must not smear trailing chunks onto
355
- // the replacement entry in the registry.
356
- if (runs.get(run.thread_id) !== run) return;
357
- run.last_chunk_at = Date.now();
358
- // Heartbeats exist solely to reset the idle watchdog when the provider
359
- // is producing chunks that don't surface downstream (most commonly
360
- // partial tool-call args while the model streams a large file_write
361
- // body). The last_chunk_at bump above is the entire payload — don't
362
- // buffer, don't fan out to subscribers, or the SSE wire would carry
363
- // meaningless tick events.
364
- if (chunk.type === "heartbeat") return;
365
- if (chunk.type === "text_delta") {
366
- run.final_text += chunk.data.delta ?? "";
367
- } else if (chunk.type === "reset_text") {
368
- // Output-validator retry (ADR-0037) discarding a flagged completed
369
- // reply — see StreamChunk in base.ts.
370
- run.final_text = "";
371
- } else if (chunk.type === "tool_call") {
372
- const id = chunk.data.id;
373
- if (id) {
374
- run.inflight_tools.add(id);
375
- run.tool_started_at.set(id, Date.now());
376
- }
377
- } else if (chunk.type === "tool_result") {
378
- const id = chunk.data.id;
379
- if (id) {
380
- run.inflight_tools.delete(id);
381
- const startedAt = run.tool_started_at.get(id);
382
- if (startedAt !== undefined) {
383
- run.tool_time_ms_done += Math.max(0, Date.now() - startedAt);
384
- run.tool_started_at.delete(id);
385
- // The tool just gave the agent its budget back; re-arm the
386
- // wall-clock watchdog against the new effective elapsed.
387
- scheduleMaxWatchdog(run);
306
+ if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {
307
+ res.statusCode = 404;
308
+ // on-demand revalidate always sets this header
309
+ res.setHeader('x-nextjs-cache', 'REVALIDATED');
310
+ res.end('This page could not be found');
311
+ return null;
388
312
  }
389
- }
390
- }
391
- if (run.events.length < MAX_BUFFERED) {
392
- run.events.push(chunk);
393
- }
394
- for (const fn of run.subscribers){
395
- try {
396
- fn(chunk);
397
- } catch {}
398
- }
399
- }
400
- function finishRun(run, status) {
401
- // Identity-check: a stale run finishing late must not flip the
402
- // replacement's status or evict it from the registry.
403
- if (runs.get(run.thread_id) !== run) return;
404
- run.status = status;
405
- run.finished_at = Date.now();
406
- // Drop subscribers — late attachers should NOT keep getting events on a
407
- // dead run. They'll get the buffered events on subscribe and that's it.
408
- run.subscribers.clear();
409
- // Auto-evict after TTL so memory doesn't grow with every conversation.
410
- setTimeout(()=>{
411
- const cur = runs.get(run.thread_id);
412
- if (cur === run) runs.delete(run.thread_id);
413
- }, RECENT_TTL_MS).unref?.();
414
- }
415
- function getRun(thread_id) {
416
- return runs.get(thread_id) ?? null;
417
- }
418
- // Signal the agent stream to cancel. The stream loop in the route is wired
419
- // to listen on the AbortController and exit early, emitting an error chunk
420
- // the client (and the queue-drain hook) can react to. Idempotent.
421
- function abortRun(thread_id, reason = "user_interrupted") {
422
- const run = runs.get(thread_id);
423
- if (!run || run.status !== "running") return false;
424
- if (!run.abort.signal.aborted) {
425
- try {
426
- run.abort.abort(reason);
427
- } catch {}
428
- }
429
- return true;
430
- }
431
- // Queue a user message typed while `thread_id` is streaming (ADR-0080).
432
- // Returns false when there is nothing to steer, so the caller can fall back
433
- // to starting a fresh turn.
434
- function pushSteering(thread_id, text) {
435
- const run = runs.get(thread_id);
436
- if (!run || run.status !== "running" || run.abort.signal.aborted) return false;
437
- const trimmed = text.trim();
438
- if (!trimmed) return false;
439
- run.steering.push(trimmed);
440
- return true;
441
- }
442
- // Take everything queued so far, in arrival order. Deliberately not merged
443
- // into a summary — collapsing several messages loses the user's intent.
444
- function drainSteering(thread_id) {
445
- const run = runs.get(thread_id);
446
- if (!run || run.steering.length === 0) return [];
447
- return run.steering.splice(0, run.steering.length);
448
- }
449
- // Abort every currently-running run. Used by the graceful-shutdown path so
450
- // LangGraph stream loops bail out instead of continuing past process exit.
451
- // Returns the number of runs that were signalled.
452
- function abortAllRuns(reason = "server_shutdown") {
453
- let count = 0;
454
- for (const run of runs.values()){
455
- if (run.status !== "running") continue;
456
- if (run.abort.signal.aborted) continue;
457
- try {
458
- run.abort.abort(reason);
459
- count++;
460
- } catch {}
461
- }
462
- return count;
463
- }
464
- // Poll until every run has transitioned out of "running" (or until the
465
- // caller-supplied deadline elapses). Used during graceful shutdown after
466
- // `abortAllRuns()` so the stream `finally` blocks have a chance to flush
467
- // the trailing error chunk and call `finishRun()`. Resolves to the count
468
- // of runs still stuck in "running" when the deadline hit (0 = clean).
469
- async function waitForRunsToSettle(timeoutMs) {
470
- const deadline = Date.now() + Math.max(0, timeoutMs);
471
- while(Date.now() < deadline){
472
- let stillRunning = 0;
473
- for (const run of runs.values())if (run.status === "running") stillRunning++;
474
- if (stillRunning === 0) return 0;
475
- await new Promise((resolve)=>setTimeout(resolve, 50));
476
- }
477
- let stillRunning = 0;
478
- for (const run of runs.values())if (run.status === "running") stillRunning++;
479
- return stillRunning;
480
- }
481
- // Replays buffered events synchronously, then subscribes for live ones.
482
- // Returns an unsubscribe fn. Caller is responsible for calling it.
483
- function subscribe(thread_id, onEvent) {
484
- const run = runs.get(thread_id);
485
- if (!run) return {
486
- run: null,
487
- unsubscribe: ()=>{}
313
+ const response = cacheKey === null ? await routeModule.handle(nextReq, context) : await routeModule.prerender(nextReq, context);
314
+ req.fetchMetrics = context.renderOpts.fetchMetrics;
315
+ let pendingWaitUntil = context.renderOpts.pendingWaitUntil;
316
+ // Attempt using provided waitUntil if available
317
+ // if it's not we fallback to sendResponse's handling
318
+ if (pendingWaitUntil) {
319
+ if (ctx.waitUntil) {
320
+ ctx.waitUntil(pendingWaitUntil);
321
+ pendingWaitUntil = undefined;
322
+ }
323
+ }
324
+ const cacheTags = context.renderOpts.collectedTags;
325
+ // If the request is for a static response, we can cache it so long
326
+ // as it's not edge.
327
+ if (isIsr) {
328
+ const blob = await response.blob();
329
+ // Copy the headers from the response.
330
+ const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.toNodeOutgoingHttpHeaders)(response.headers);
331
+ if (cacheTags) {
332
+ headers[next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER] = cacheTags;
333
+ }
334
+ if (!headers['content-type'] && blob.type) {
335
+ headers['content-type'] = blob.type;
336
+ }
337
+ const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;
338
+ const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.INFINITE_CACHE ? // route has a numeric `revalidate` but didn't declare an
339
+ // explicit `expire` (e.g. via `cacheLife`). This mirrors the
340
+ // build-time fallback in `build/index.ts` so cache entries
341
+ // and the response Cache-Control header agree on the route's
342
+ // effective expire. Routes that opt out of revalidation
343
+ // (`revalidate: false`) or that are dynamic (`revalidate: 0`)
344
+ // keep `expire: undefined`.
345
+ revalidate !== false && revalidate > 0 ? nextConfig.expireTime : undefined : context.renderOpts.collectedExpire;
346
+ // Create the cache entry for the response.
347
+ const cacheEntry = {
348
+ value: {
349
+ kind: next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__.CachedRouteKind.APP_ROUTE,
350
+ status: response.status,
351
+ body: Buffer.from(await blob.arrayBuffer()),
352
+ headers
353
+ },
354
+ cacheControl: {
355
+ revalidate,
356
+ expire
357
+ }
358
+ };
359
+ return cacheEntry;
360
+ } else {
361
+ // send response without caching if not ISR
362
+ await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, response, pendingWaitUntil);
363
+ return null;
364
+ }
365
+ } catch (err) {
366
+ // if this is a background revalidate we need to report
367
+ // the request error here as it won't be bubbled
368
+ if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {
369
+ const silenceLog = false;
370
+ await routeModule.onRequestError(req, err, {
371
+ routerKind: 'App Router',
372
+ routePath: srcPage,
373
+ routeType: 'route',
374
+ revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
375
+ isStaticGeneration: cacheKey !== null,
376
+ isOnDemandRevalidate
377
+ })
378
+ }, silenceLog, routerServerContext);
379
+ }
380
+ throw err;
381
+ }
488
382
  };
489
- // Replay buffered events first (so the new subscriber catches up).
490
- for (const ev of run.events){
383
+ const handleResponse = async (currentSpan, parentSpan)=>{
491
384
  try {
492
- onEvent(ev);
493
- } catch {}
494
- }
495
- if (run.status !== "running") {
496
- return {
497
- run,
498
- unsubscribe: ()=>{}
499
- };
500
- }
501
- run.subscribers.add(onEvent);
502
- return {
503
- run,
504
- unsubscribe: ()=>{
505
- run.subscribers.delete(onEvent);
385
+ var _cacheEntry_value;
386
+ const cacheEntry = await routeModule.handleResponse({
387
+ req,
388
+ nextConfig,
389
+ cacheKey,
390
+ routeKind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
391
+ isFallback: false,
392
+ previewProps,
393
+ prerenderManifest,
394
+ isRoutePPREnabled: false,
395
+ isOnDemandRevalidate,
396
+ revalidateOnlyGenerated,
397
+ responseGenerator,
398
+ waitUntil: ctx.waitUntil,
399
+ isMinimalMode
400
+ });
401
+ if (cacheEntry !== null && 'error' in cacheEntry) {
402
+ throw cacheEntry.error;
403
+ }
404
+ // we don't create a cacheEntry for ISR
405
+ if (!isIsr) {
406
+ return;
407
+ }
408
+ if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__.CachedRouteKind.APP_ROUTE) {
409
+ var _cacheEntry_value1;
410
+ throw new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`);
411
+ }
412
+ if (!isMinimalMode) {
413
+ res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');
414
+ }
415
+ // Draft mode should never be cached
416
+ if (isDraftMode) {
417
+ res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');
418
+ }
419
+ const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers);
420
+ if (!(isMinimalMode && isIsr)) {
421
+ headers.delete(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER);
422
+ }
423
+ // If cache control is already set on the response we don't
424
+ // override it to allow users to customize it via next.config
425
+ if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {
426
+ headers.set('Cache-Control', (0,next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__.getCacheControlHeader)(cacheEntry.cacheControl));
427
+ }
428
+ await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.
429
+ new Response(cacheEntry.value.body, {
430
+ headers,
431
+ status: cacheEntry.value.status || 200
432
+ }));
433
+ return;
434
+ } catch (err) {
435
+ if (!(err instanceof next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError)) {
436
+ const silenceLog = false;
437
+ await routeModule.onRequestError(req, err, {
438
+ routerKind: 'App Router',
439
+ routePath: normalizedSrcPage,
440
+ routeType: 'route',
441
+ revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
442
+ isStaticGeneration: cacheKey !== null,
443
+ isOnDemandRevalidate
444
+ })
445
+ }, silenceLog, routerServerContext);
446
+ }
447
+ // rethrow so that we can handle serving error page
448
+ // If this is during static generation, throw the error again.
449
+ if (isIsr) throw err;
450
+ // Otherwise, send a 500 response unless the original response has
451
+ // already committed. In that case, preserve its status code for
452
+ // telemetry while still recording the failure and terminating a response
453
+ // that the failed pipeline left open.
454
+ if (res.headersSent) {
455
+ if (currentSpan) {
456
+ const error = err instanceof Error ? err : new Error('Unknown app route error');
457
+ currentSpan.recordException(error);
458
+ currentSpan.setStatus({
459
+ code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR,
460
+ message: error.message
461
+ });
462
+ currentSpan.setAttribute('error.type', error.name);
463
+ }
464
+ if (!res.writableEnded && !res.destroyed) {
465
+ res.end();
466
+ }
467
+ } else {
468
+ await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, new Response(null, {
469
+ status: 500
470
+ }));
471
+ }
472
+ return;
473
+ } finally{
474
+ ;
475
+ (()=>{
476
+ if (!currentSpan) {
477
+ return;
478
+ }
479
+ let statusCode = res.statusCode;
480
+ currentSpan.setAttributes({
481
+ 'http.status_code': statusCode,
482
+ 'next.rsc': false
483
+ });
484
+ if (statusCode && statusCode >= 500) {
485
+ // For 5xx status codes: SHOULD be set to 'Error' span status.
486
+ // x-ref: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
487
+ currentSpan.setStatus({
488
+ code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR
489
+ });
490
+ // For span status 'Error', SHOULD set 'error.type' attribute.
491
+ currentSpan.setAttribute('error.type', statusCode.toString());
492
+ }
493
+ const rootSpanAttributes = tracer.getRootSpanAttributes();
494
+ // We were unable to get attributes, probably OTEL is not enabled
495
+ if (!rootSpanAttributes) {
496
+ return;
497
+ }
498
+ if (rootSpanAttributes.get('next.span_type') !== next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest) {
499
+ console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);
500
+ return;
501
+ }
502
+ const route = rootSpanAttributes.get('next.route') || normalizedSrcPage;
503
+ const name = `${method} ${route}`;
504
+ currentSpan.setAttributes({
505
+ 'next.route': route,
506
+ 'http.route': route,
507
+ 'next.span_name': name
508
+ });
509
+ currentSpan.updateName(name);
510
+ // Propagate http.route to the parent span if one exists (e.g.
511
+ // a platform-created HTTP span in adapter deployments).
512
+ if (parentSpan && parentSpan !== currentSpan) {
513
+ parentSpan.setAttribute('http.route', route);
514
+ parentSpan.updateName(name);
515
+ }
516
+ })();
506
517
  }
507
518
  };
519
+ // TODO: activeSpan code path is for when wrapped by
520
+ // next-server can be removed when this is no longer used
521
+ if (isWrappedByNextServer && activeSpan) {
522
+ await handleResponse(activeSpan, undefined);
523
+ } else {
524
+ let parentSpan = tracer.getActiveScopeSpan();
525
+ await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest, {
526
+ spanName: `${method} ${srcPage}`,
527
+ kind: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanKind.SERVER,
528
+ attributes: {
529
+ 'http.method': method,
530
+ 'http.target': req.url
531
+ }
532
+ }, (span)=>handleResponse(span, parentSpan)), undefined, !isWrappedByNextServer);
533
+ }
508
534
  }
509
535
 
510
-
511
- /***/ }),
512
-
513
- /***/ 73024:
514
- /***/ ((module) => {
515
-
516
- module.exports = require("node:fs");
517
-
518
- /***/ }),
519
-
520
- /***/ 76760:
521
- /***/ ((module) => {
522
-
523
- module.exports = require("node:path");
524
-
525
- /***/ }),
526
-
527
- /***/ 86439:
528
- /***/ ((module) => {
529
-
530
- module.exports = require("next/dist/shared/lib/no-fallback-error.external");
531
-
532
- /***/ }),
533
-
534
- /***/ 95441:
535
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
536
-
537
- __webpack_require__.r(__webpack_exports__);
538
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
539
- /* harmony export */ handler: () => (/* binding */ handler),
540
- /* harmony export */ patchFetch: () => (/* binding */ patchFetch),
541
- /* harmony export */ routeModule: () => (/* binding */ routeModule),
542
- /* harmony export */ serverHooks: () => (/* binding */ serverHooks),
543
- /* harmony export */ workAsyncStorage: () => (/* binding */ workAsyncStorage),
544
- /* harmony export */ workUnitAsyncStorage: () => (/* binding */ workUnitAsyncStorage)
545
- /* harmony export */ });
546
- /* harmony import */ var next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(19225);
547
- /* harmony import */ var next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__);
548
- /* harmony import */ var next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84006);
549
- /* harmony import */ var next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8317);
550
- /* harmony import */ var next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__);
551
- /* harmony import */ var next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(99373);
552
- /* harmony import */ var next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__);
553
- /* harmony import */ var next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(34775);
554
- /* harmony import */ var next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__);
555
- /* harmony import */ var next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(24235);
556
- /* harmony import */ var next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__);
557
- /* harmony import */ var next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(261);
558
- /* harmony import */ var next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__);
559
- /* harmony import */ var next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(54365);
560
- /* harmony import */ var next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__);
561
- /* harmony import */ var next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(90771);
562
- /* harmony import */ var next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8__);
563
- /* harmony import */ var next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(73461);
564
- /* harmony import */ var next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__);
565
- /* harmony import */ var next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(67798);
566
- /* harmony import */ var next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(92280);
567
- /* harmony import */ var next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(62018);
568
- /* harmony import */ var next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__);
569
- /* harmony import */ var next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(45696);
570
- /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(47929);
571
- /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__);
572
- /* harmony import */ var next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(86439);
573
- /* harmony import */ var next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__);
574
- /* harmony import */ var next_dist_server_lib_route_cache_key__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(10246);
575
- /* harmony import */ var next_dist_server_lib_route_cache_key__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(next_dist_server_lib_route_cache_key__WEBPACK_IMPORTED_MODULE_16__);
576
- /* harmony import */ var next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(37527);
577
- /* harmony import */ var next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__);
536
+ //# sourceMappingURL=app-route.js.map
578
537
 
579
538
 
539
+ /***/ }),
580
540
 
541
+ /***/ 33873:
542
+ /***/ ((module) => {
581
543
 
544
+ module.exports = require("path");
582
545
 
546
+ /***/ }),
583
547
 
548
+ /***/ 44870:
549
+ /***/ ((module) => {
584
550
 
551
+ module.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js");
585
552
 
553
+ /***/ }),
586
554
 
555
+ /***/ 48161:
556
+ /***/ ((module) => {
587
557
 
558
+ module.exports = require("node:os");
588
559
 
560
+ /***/ }),
589
561
 
562
+ /***/ 55511:
563
+ /***/ ((module) => {
590
564
 
565
+ module.exports = require("crypto");
591
566
 
567
+ /***/ }),
592
568
 
569
+ /***/ 63033:
570
+ /***/ ((module) => {
593
571
 
572
+ module.exports = require("next/dist/server/app-render/work-unit-async-storage.external.js");
594
573
 
574
+ /***/ }),
595
575
 
596
- // We inject the nextConfigOutput here so that we can use them in the route
597
- // module.
598
- const nextConfigOutput = "standalone"
599
- const routeModule = new next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__.AppRouteRouteModule({
600
- definition: {
601
- kind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
602
- page: "/api/v1/system/abort/route",
603
- pathname: "/api/v1/system/abort",
604
- filename: "route",
605
- bundlePath: "app/api/v1/system/abort/route"
606
- },
607
- distDir: ".next" || 0,
608
- relativeProjectDir: false || '',
609
- resolvedPagePath: "/home/runner/work/jarela/jarela/app/api/v1/system/abort/route.ts",
610
- nextConfigOutput,
611
- // The lazy require factory ensures that:
612
- // - In dev: devRequestTimingInternalsEnd is set before userland executes,
613
- // correctly attributing module load time to application-code rather than
614
- // framework internals.
615
- // - In all modes: async modules (route files with top-level await) are
616
- // handled correctly — require() returns a Promise for such modules, which
617
- // ensureUserland() awaits before the first request is handled.
618
- userland: ()=>__webpack_require__(5839),
619
- // In Turbopack dev mode, also provide a synchronous per-request getter so
620
- // server HMR updates are picked up without re-executing the entry chunk.
621
- // Using require() (synchronous) avoids adding async overhead that would be
622
- // incorrectly attributed to application-code time in devRequestTiming.
623
- ... false ? 0 : {}
624
- });
625
- // Pull out the exports that we need to expose from the module. This should
626
- // be eliminated when we've moved the other routes to the new format. These
627
- // are used to hook into the route.
628
- const { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;
629
- function patchFetch() {
630
- return (0,next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__.patchFetch)({
631
- workAsyncStorage,
632
- workUnitAsyncStorage
633
- });
634
- }
576
+ /***/ 68564:
577
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
635
578
 
636
- async function handler(req, res, ctx) {
637
- if (ctx.requestMeta) {
638
- (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.setRequestMeta)(req, ctx.requestMeta);
639
- }
640
- if (routeModule.isDev) {
641
- (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.addRequestMeta)(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());
642
- }
643
- let srcPage = "/api/v1/system/abort/route";
644
- // turbopack doesn't normalize `/index` in the page name
645
- // so we need to to process dynamic routes properly
646
- // TODO: fix turbopack providing differing value from webpack
647
- if (false) {} else if (srcPage === '/index') {
648
- // we always normalize /index specifically
649
- srcPage = '/';
650
- }
651
- const multiZoneDraftMode = false;
652
- const prepareResult = await routeModule.prepare(req, res, {
653
- srcPage,
654
- multiZoneDraftMode
579
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
580
+ /* harmony export */ AD: () => (/* binding */ startRun),
581
+ /* harmony export */ B1: () => (/* binding */ subscribe),
582
+ /* harmony export */ Cs: () => (/* binding */ waitForRun),
583
+ /* harmony export */ ES: () => (/* binding */ abortAllRuns),
584
+ /* harmony export */ JH: () => (/* binding */ finishRun),
585
+ /* harmony export */ KD: () => (/* binding */ abortRun),
586
+ /* harmony export */ Mh: () => (/* binding */ getRun),
587
+ /* harmony export */ QK: () => (/* binding */ drainSteering),
588
+ /* harmony export */ mq: () => (/* binding */ broadcast),
589
+ /* harmony export */ mx: () => (/* binding */ pushSteering)
590
+ /* harmony export */ });
591
+ /* unused harmony export waitForRunsToSettle */
592
+ /* harmony import */ var _lib_env_config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67500);
593
+ /* harmony import */ var _lib_utils_global_state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15559);
594
+
595
+
596
+ // Read once at module init. JARELA_RUN_BUFFER_SIZE / JARELA_RUN_REGISTRY_TTL_MS
597
+ // override the defaults.
598
+ const MAX_BUFFERED = (0,_lib_env_config__WEBPACK_IMPORTED_MODULE_0__/* .getConfig */ .z)().runBufferSize;
599
+ const RECENT_TTL_MS = (0,_lib_env_config__WEBPACK_IMPORTED_MODULE_0__/* .getConfig */ .z)().runRegistryTtlMs;
600
+ // Idle (no-progress) ceiling and wall-clock ceiling: read fresh per-run
601
+ // from getConfig() so non-restart-required env reloads take effect.
602
+ function runIdleMs() {
603
+ return (0,_lib_env_config__WEBPACK_IMPORTED_MODULE_0__/* .getConfig */ .z)().runIdleMs;
604
+ }
605
+ function runMaxMs() {
606
+ return (0,_lib_env_config__WEBPACK_IMPORTED_MODULE_0__/* .getConfig */ .z)().runMaxMs;
607
+ }
608
+ const registryState = (0,_lib_utils_global_state__WEBPACK_IMPORTED_MODULE_1__/* .getOrCreateGlobal */ .X)("__jarela_active_run_registry", ()=>({
609
+ runs: new Map(),
610
+ waiters: new Map()
611
+ }));
612
+ const runs = registryState.runs;
613
+ // Cold-attach waiters: subscribers that opened a GET /run before the
614
+ // server-side run actually called startRun (typical for triggers /
615
+ // scheduler / watcher, which submit through `after()` + the per-thread
616
+ // queue, so there's a real delay between the user clicking "Run now"
617
+ // and the registry entry appearing). Resolved by `startRun` below.
618
+ const waiters = registryState.waiters;
619
+ /** Wait up to `timeoutMs` for a run to be registered on `thread_id`.
620
+ * Resolves immediately with the current run if one is already active,
621
+ * with the new run when `startRun` fires inside the window, or with
622
+ * `null` on timeout. `timeoutMs <= 0` short-circuits to the current
623
+ * state without waiting. Caller is responsible for closing the SSE
624
+ * stream when this resolves null. */ function waitForRun(thread_id, timeoutMs) {
625
+ const existing = runs.get(thread_id);
626
+ if (existing) return Promise.resolve(existing);
627
+ if (timeoutMs <= 0) return Promise.resolve(null);
628
+ return new Promise((resolve)=>{
629
+ let set = waiters.get(thread_id);
630
+ if (!set) {
631
+ set = new Set();
632
+ waiters.set(thread_id, set);
633
+ }
634
+ const fn = (run)=>{
635
+ clearTimeout(timer);
636
+ resolve(run);
637
+ };
638
+ set.add(fn);
639
+ const timer = setTimeout(()=>{
640
+ const cur = waiters.get(thread_id);
641
+ cur?.delete(fn);
642
+ if (cur && cur.size === 0) waiters.delete(thread_id);
643
+ resolve(null);
644
+ }, timeoutMs);
645
+ timer.unref?.();
655
646
  });
656
- if (!prepareResult) {
657
- res.statusCode = 400;
658
- res.end('Bad Request');
659
- ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());
660
- return null;
647
+ }
648
+ function startRun(thread_id, agent_id) {
649
+ // If a stale completed run exists, drop it before starting a new one.
650
+ const existing = runs.get(thread_id);
651
+ if (existing && existing.status === "running") {
652
+ throw new Error(`A run is already active for thread ${thread_id}`);
661
653
  }
662
- const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest, previewProps } = prepareResult;
663
- const normalizedSrcPage = (0,next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__.normalizeAppPath)(srcPage);
664
- // Only this route's prerenders can establish ISR or admit generated params.
665
- const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]) && (routeModule.isDev || (0,next_dist_server_lib_route_cache_key__WEBPACK_IMPORTED_MODULE_16__.isRouteCacheOwner)(resolvedPathname, routeModule.cacheOwner, prerenderManifest.routes[resolvedPathname]));
666
- let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || isPrerendered);
667
- const render404 = async ()=>{
668
- // TODO: should route-module itself handle rendering the 404
669
- if (routerServerContext == null ? void 0 : routerServerContext.render404) {
670
- await routerServerContext.render404(req, res, parsedUrl, false);
671
- } else {
672
- res.end('This page could not be found');
673
- }
674
- return null;
654
+ const now = Date.now();
655
+ const run = {
656
+ thread_id,
657
+ agent_id,
658
+ started_at: now,
659
+ finished_at: null,
660
+ status: "running",
661
+ events: [],
662
+ subscribers: new Set(),
663
+ final_text: "",
664
+ abort: new AbortController(),
665
+ last_chunk_at: now,
666
+ inflight_tools: new Set(),
667
+ tool_started_at: new Map(),
668
+ tool_time_ms_done: 0,
669
+ steering: [],
670
+ phase: "starting",
671
+ phase_label: "Starting…"
675
672
  };
676
- if (isIsr && !isDraftMode) {
677
- const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];
678
- if (prerenderInfo) {
679
- if (prerenderInfo.fallback === false && !isPrerendered) {
680
- if (nextConfig.adapterPath) {
681
- return await render404();
682
- }
683
- throw new next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError();
684
- }
673
+ runs.set(thread_id, run);
674
+ // Wake any GET subscribers that attached before the run was registered.
675
+ const pending = waiters.get(thread_id);
676
+ if (pending) {
677
+ waiters.delete(thread_id);
678
+ for (const fn of pending){
679
+ try {
680
+ fn(run);
681
+ } catch {}
685
682
  }
686
- }
687
- let cacheKey = null;
688
- if (isIsr && !routeModule.isDev && !isDraftMode) {
689
- cacheKey = resolvedPathname;
690
- // ensure /index and / is normalized to one key
691
- cacheKey = cacheKey === '/index' ? '/' : cacheKey;
692
- }
693
- // Before rendering (which initializes component tree modules), we have to
694
- // set the reference manifests to our global store so Server Action's
695
- // encryption util can access to them at the top level of the page module.
696
- if (serverActionsManifest && clientReferenceManifest) {
697
- (0,next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__.setManifestsSingleton)({
698
- page: srcPage,
699
- clientReferenceManifest,
700
- serverActionsManifest
701
- });
702
- }
703
- const method = req.method || 'GET';
704
- const tracer = (0,next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.getTracer)();
705
- const activeSpan = tracer.getActiveScopeSpan();
706
- const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);
707
- const isMinimalMode = Boolean((0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'minimalMode'));
708
- const incrementalCache = (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, previewProps, prerenderManifest, isMinimalMode);
709
- incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();
710
- globalThis.__incrementalCache = incrementalCache;
711
- const context = {
712
- params,
713
- previewProps,
714
- renderOpts: {
715
- experimental: {
716
- authInterrupts: Boolean(nextConfig.experimental.authInterrupts),
717
- useCacheTimeout: nextConfig.experimental.useCacheTimeout,
718
- durableUseCacheEntries: Boolean(nextConfig.experimental.durableUseCacheEntries)
719
- },
720
- cacheComponents: Boolean(nextConfig.cacheComponents),
721
- validationLevel: nextConfig.experimental.instantInsights.validationLevel,
722
- isDraftMode,
723
- incrementalCache,
724
- hmrRefreshHash: (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'hmrRefreshHash'),
725
- cacheLifeProfiles: nextConfig.cacheLife,
726
- staticPageGenerationTimeout: nextConfig.staticPageGenerationTimeout,
727
- waitUntil: ctx.waitUntil,
728
- onClose: (cb)=>{
729
- res.on('close', cb);
730
- },
731
- onAfterTaskError: undefined
732
- },
733
- sharedContext: {
734
- buildId,
735
- deploymentId
683
+ }
684
+ scheduleIdleWatchdog(run);
685
+ scheduleMaxWatchdog(run);
686
+ return run;
687
+ }
688
+ // Synthesise a typed error chunk for the watchdog termination paths and
689
+ // fan it out to subscribers BEFORE flipping `status` to "error". The order
690
+ // matters: `broadcast()`'s status guard drops any chunk delivered after
691
+ // `finishRun()` has run, so calling finishRun first would silently swallow
692
+ // the error and the client's EventSource would just see the connection
693
+ // close with no terminal event — bubble keeps spinning, no toast. Doing
694
+ // it the other way around lets the client receive a real error event,
695
+ // render a "Run timed out" toast, and (if the consumer wires it up)
696
+ // trigger an auto-retry path. Followed by `done` so the consumer's
697
+ // for-await loop can break cleanly without waiting for an EOF.
698
+ function emitWatchdogTermination(run, code, message) {
699
+ if (run.status !== "running") return;
700
+ // Direct registry mutation so the broadcast goes through the regular
701
+ // path (subscribers + buffer + seq stamp) without re-entering any of
702
+ // the watchdog scheduling. Mirrors broadcast() but bypasses the
703
+ // status check we'd otherwise be racing against.
704
+ run.last_chunk_at = Date.now();
705
+ const errChunk = {
706
+ type: "error",
707
+ data: {
708
+ message,
709
+ code
736
710
  }
737
711
  };
738
- const nodeNextReq = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextRequest(req);
739
- const nodeNextRes = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextResponse(res);
740
- const nextReq = next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8__.NextRequestAdapter.fromNodeNextRequest(nodeNextReq, (0,next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8__.signalFromNodeResponse)(res));
741
- const responseGenerator = async ({ previousCacheEntry })=>{
712
+ if (run.events.length < MAX_BUFFERED) run.events.push(errChunk);
713
+ for (const fn of run.subscribers){
742
714
  try {
743
- if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {
744
- res.statusCode = 404;
745
- // on-demand revalidate always sets this header
746
- res.setHeader('x-nextjs-cache', 'REVALIDATED');
747
- res.end('This page could not be found');
748
- return null;
749
- }
750
- const response = cacheKey === null ? await routeModule.handle(nextReq, context) : await routeModule.prerender(nextReq, context);
751
- req.fetchMetrics = context.renderOpts.fetchMetrics;
752
- let pendingWaitUntil = context.renderOpts.pendingWaitUntil;
753
- // Attempt using provided waitUntil if available
754
- // if it's not we fallback to sendResponse's handling
755
- if (pendingWaitUntil) {
756
- if (ctx.waitUntil) {
757
- ctx.waitUntil(pendingWaitUntil);
758
- pendingWaitUntil = undefined;
759
- }
760
- }
761
- const cacheTags = context.renderOpts.collectedTags;
762
- // If the request is for a static response, we can cache it so long
763
- // as it's not edge.
764
- if (isIsr) {
765
- const blob = await response.blob();
766
- // Copy the headers from the response.
767
- const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.toNodeOutgoingHttpHeaders)(response.headers);
768
- if (cacheTags) {
769
- headers[next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER] = cacheTags;
770
- }
771
- if (!headers['content-type'] && blob.type) {
772
- headers['content-type'] = blob.type;
773
- }
774
- const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;
775
- const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.INFINITE_CACHE ? // route has a numeric `revalidate` but didn't declare an
776
- // explicit `expire` (e.g. via `cacheLife`). This mirrors the
777
- // build-time fallback in `build/index.ts` so cache entries
778
- // and the response Cache-Control header agree on the route's
779
- // effective expire. Routes that opt out of revalidation
780
- // (`revalidate: false`) or that are dynamic (`revalidate: 0`)
781
- // keep `expire: undefined`.
782
- revalidate !== false && revalidate > 0 ? nextConfig.expireTime : undefined : context.renderOpts.collectedExpire;
783
- // Create the cache entry for the response.
784
- const cacheEntry = {
785
- value: {
786
- kind: next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__.CachedRouteKind.APP_ROUTE,
787
- status: response.status,
788
- body: Buffer.from(await blob.arrayBuffer()),
789
- headers
790
- },
791
- cacheControl: {
792
- revalidate,
793
- expire
794
- }
795
- };
796
- return cacheEntry;
797
- } else {
798
- // send response without caching if not ISR
799
- await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, response, pendingWaitUntil);
800
- return null;
801
- }
802
- } catch (err) {
803
- // if this is a background revalidate we need to report
804
- // the request error here as it won't be bubbled
805
- if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {
806
- const silenceLog = false;
807
- await routeModule.onRequestError(req, err, {
808
- routerKind: 'App Router',
809
- routePath: srcPage,
810
- routeType: 'route',
811
- revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
812
- isStaticGeneration: cacheKey !== null,
813
- isOnDemandRevalidate
814
- })
815
- }, silenceLog, routerServerContext);
816
- }
817
- throw err;
818
- }
715
+ fn(errChunk);
716
+ } catch {}
717
+ }
718
+ // Pair with a synthetic `done` so the client's consume() loop breaks
719
+ // on a terminal event rather than waiting for the EventSource to close.
720
+ const doneChunk = {
721
+ type: "done",
722
+ data: {}
819
723
  };
820
- const handleResponse = async (currentSpan, parentSpan)=>{
724
+ if (run.events.length < MAX_BUFFERED) run.events.push(doneChunk);
725
+ for (const fn of run.subscribers){
821
726
  try {
822
- var _cacheEntry_value;
823
- const cacheEntry = await routeModule.handleResponse({
824
- req,
825
- nextConfig,
826
- cacheKey,
827
- routeKind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
828
- isFallback: false,
829
- previewProps,
830
- prerenderManifest,
831
- isRoutePPREnabled: false,
832
- isOnDemandRevalidate,
833
- revalidateOnlyGenerated,
834
- responseGenerator,
835
- waitUntil: ctx.waitUntil,
836
- isMinimalMode
837
- });
838
- if (cacheEntry !== null && 'error' in cacheEntry) {
839
- throw cacheEntry.error;
840
- }
841
- // we don't create a cacheEntry for ISR
842
- if (!isIsr) {
843
- return;
844
- }
845
- if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__.CachedRouteKind.APP_ROUTE) {
846
- var _cacheEntry_value1;
847
- throw new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`);
848
- }
849
- if (!isMinimalMode) {
850
- res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');
851
- }
852
- // Draft mode should never be cached
853
- if (isDraftMode) {
854
- res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');
855
- }
856
- const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers);
857
- if (!(isMinimalMode && isIsr)) {
858
- headers.delete(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER);
859
- }
860
- // If cache control is already set on the response we don't
861
- // override it to allow users to customize it via next.config
862
- if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {
863
- headers.set('Cache-Control', (0,next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__.getCacheControlHeader)(cacheEntry.cacheControl));
864
- }
865
- await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.
866
- new Response(cacheEntry.value.body, {
867
- headers,
868
- status: cacheEntry.value.status || 200
869
- }));
727
+ fn(doneChunk);
728
+ } catch {}
729
+ }
730
+ }
731
+ // Self-rearming idle watchdog. Fires when no chunk has arrived for
732
+ // `idleMs`; otherwise reschedules itself for `(last_chunk_at + idleMs) -
733
+ // now`. We never carry a handle on the run — the closure just bails if
734
+ // the run is no longer the registry's entry or no longer running.
735
+ function scheduleIdleWatchdog(run) {
736
+ const idleMs = runIdleMs();
737
+ const fireIn = Math.max(0, run.last_chunk_at + idleMs - Date.now());
738
+ setTimeout(()=>{
739
+ const cur = runs.get(run.thread_id);
740
+ if (cur !== run) return;
741
+ if (run.status !== "running") return;
742
+ const idle = Date.now() - run.last_chunk_at;
743
+ if (idle < idleMs) {
744
+ scheduleIdleWatchdog(run);
870
745
  return;
871
- } catch (err) {
872
- if (!(err instanceof next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError)) {
873
- const silenceLog = false;
874
- await routeModule.onRequestError(req, err, {
875
- routerKind: 'App Router',
876
- routePath: normalizedSrcPage,
877
- routeType: 'route',
878
- revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
879
- isStaticGeneration: cacheKey !== null,
880
- isOnDemandRevalidate
881
- })
882
- }, silenceLog, routerServerContext);
883
- }
884
- // rethrow so that we can handle serving error page
885
- // If this is during static generation, throw the error again.
886
- if (isIsr) throw err;
887
- // Otherwise, send a 500 response unless the original response has
888
- // already committed. In that case, preserve its status code for
889
- // telemetry while still recording the failure and terminating a response
890
- // that the failed pipeline left open.
891
- if (res.headersSent) {
892
- if (currentSpan) {
893
- const error = err instanceof Error ? err : new Error('Unknown app route error');
894
- currentSpan.recordException(error);
895
- currentSpan.setStatus({
896
- code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR,
897
- message: error.message
898
- });
899
- currentSpan.setAttribute('error.type', error.name);
900
- }
901
- if (!res.writableEnded && !res.destroyed) {
902
- res.end();
903
- }
904
- } else {
905
- await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, new Response(null, {
906
- status: 500
907
- }));
908
- }
746
+ }
747
+ if (run.inflight_tools.size > 0) {
748
+ // Tool execution in progress — silence here is the tool working,
749
+ // not a wedged provider stream. Skip the kill, re-check in idleMs.
750
+ // The tool_result will bump last_chunk_at when it lands.
751
+ setTimeout(()=>scheduleIdleWatchdog(run), idleMs).unref?.();
752
+ return;
753
+ }
754
+ console.warn(`[run-registry] idle watchdog: force-finishing stalled run for thread ${run.thread_id} after ${idle}ms of no progress`);
755
+ 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.`);
756
+ try {
757
+ run.abort.abort("run_idle_timeout");
758
+ } catch {}
759
+ finishRun(run, "error");
760
+ }, fireIn).unref?.();
761
+ }
762
+ // Wall-clock elapsed minus time spent inside tool calls (both completed and
763
+ // currently in flight). The wall-clock watchdog uses this so a 5-minute
764
+ // shell exec or a slow MCP roundtrip doesn't burn the agent's budget;
765
+ // tools enforce their own timeouts. See ActiveRun.tool_started_at for the
766
+ // rationale.
767
+ function effectiveElapsedMs(run, now) {
768
+ let inflightToolMs = 0;
769
+ for (const startedAt of run.tool_started_at.values()){
770
+ inflightToolMs += Math.max(0, now - startedAt);
771
+ }
772
+ return Math.max(0, now - run.started_at - run.tool_time_ms_done - inflightToolMs);
773
+ }
774
+ function scheduleMaxWatchdog(run) {
775
+ const max = runMaxMs();
776
+ const now = Date.now();
777
+ const fireIn = Math.max(0, max - effectiveElapsedMs(run, now));
778
+ setTimeout(()=>{
779
+ const cur = runs.get(run.thread_id);
780
+ if (cur !== run) return;
781
+ if (run.status !== "running") return;
782
+ const elapsed = effectiveElapsedMs(run, Date.now());
783
+ if (elapsed < max) {
784
+ // Tool time pushed the effective elapsed back below the ceiling —
785
+ // re-arm for the remaining budget. Without this, a tool that runs
786
+ // for longer than `max` between firing and resolving would let
787
+ // the next setTimeout overshoot.
788
+ scheduleMaxWatchdog(run);
909
789
  return;
910
- } finally{
911
- ;
912
- (()=>{
913
- if (!currentSpan) {
914
- return;
915
- }
916
- let statusCode = res.statusCode;
917
- currentSpan.setAttributes({
918
- 'http.status_code': statusCode,
919
- 'next.rsc': false
920
- });
921
- if (statusCode && statusCode >= 500) {
922
- // For 5xx status codes: SHOULD be set to 'Error' span status.
923
- // x-ref: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
924
- currentSpan.setStatus({
925
- code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR
926
- });
927
- // For span status 'Error', SHOULD set 'error.type' attribute.
928
- currentSpan.setAttribute('error.type', statusCode.toString());
929
- }
930
- const rootSpanAttributes = tracer.getRootSpanAttributes();
931
- // We were unable to get attributes, probably OTEL is not enabled
932
- if (!rootSpanAttributes) {
933
- return;
934
- }
935
- if (rootSpanAttributes.get('next.span_type') !== next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest) {
936
- console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);
937
- return;
938
- }
939
- const route = rootSpanAttributes.get('next.route') || normalizedSrcPage;
940
- const name = `${method} ${route}`;
941
- currentSpan.setAttributes({
942
- 'next.route': route,
943
- 'http.route': route,
944
- 'next.span_name': name
945
- });
946
- currentSpan.updateName(name);
947
- // Propagate http.route to the parent span if one exists (e.g.
948
- // a platform-created HTTP span in adapter deployments).
949
- if (parentSpan && parentSpan !== currentSpan) {
950
- parentSpan.setAttribute('http.route', route);
951
- parentSpan.updateName(name);
952
- }
953
- })();
954
790
  }
791
+ console.warn(`[run-registry] wall-clock watchdog: force-finishing run for thread ${run.thread_id} after ${elapsed}ms of agent time (excluding tool execution)`);
792
+ 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.`);
793
+ try {
794
+ run.abort.abort("run_watchdog_timeout");
795
+ } catch {}
796
+ finishRun(run, "error");
797
+ }, fireIn).unref?.();
798
+ }
799
+ // Mirrors the labels hooks/useSSE.ts derives from the same chunks.
800
+ function trackPhase(run, chunk) {
801
+ const data = chunk.data ?? {};
802
+ const set = (phase, label)=>{
803
+ run.phase = phase;
804
+ run.phase_label = label;
955
805
  };
956
- // TODO: activeSpan code path is for when wrapped by
957
- // next-server can be removed when this is no longer used
958
- if (isWrappedByNextServer && activeSpan) {
959
- await handleResponse(activeSpan, undefined);
960
- } else {
961
- let parentSpan = tracer.getActiveScopeSpan();
962
- await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest, {
963
- spanName: `${method} ${srcPage}`,
964
- kind: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanKind.SERVER,
965
- attributes: {
966
- 'http.method': method,
967
- 'http.target': req.url
968
- }
969
- }, (span)=>handleResponse(span, parentSpan)), undefined, !isWrappedByNextServer);
806
+ if (chunk.type === "status") {
807
+ const phase = typeof data.phase === "string" && data.phase ? data.phase : run.phase;
808
+ const label = typeof data.label === "string" && data.label.trim() ? data.label : "Thinking…";
809
+ set(phase, label);
810
+ } else if (chunk.type === "text_delta") {
811
+ set("responding", "Responding…");
812
+ } else if (chunk.type === "thinking_delta") {
813
+ if (run.inflight_tools.size === 0) set("thinking", "Thinking…");
814
+ } else if (chunk.type === "tool_call") {
815
+ const name = typeof data.name === "string" && data.name ? data.name : "tool";
816
+ set("tool", `Using ${name}…`);
817
+ } else if (chunk.type === "tool_result") {
818
+ const remaining = typeof data.id === "string" ? [
819
+ ...run.inflight_tools
820
+ ].filter((id)=>id !== data.id) : [
821
+ ...run.inflight_tools
822
+ ];
823
+ if (remaining.length === 0) set("thinking", "Thinking…");
824
+ }
825
+ }
826
+ function broadcast(run, chunk) {
827
+ // Identity-check: a superseded run must not smear trailing chunks onto
828
+ // the replacement entry in the registry.
829
+ if (runs.get(run.thread_id) !== run) return;
830
+ run.last_chunk_at = Date.now();
831
+ // Heartbeats exist solely to reset the idle watchdog when the provider
832
+ // is producing chunks that don't surface downstream (most commonly
833
+ // partial tool-call args while the model streams a large file_write
834
+ // body). The last_chunk_at bump above is the entire payload — don't
835
+ // buffer, don't fan out to subscribers, or the SSE wire would carry
836
+ // meaningless tick events.
837
+ if (chunk.type === "heartbeat") return;
838
+ trackPhase(run, chunk);
839
+ if (chunk.type === "text_delta") {
840
+ run.final_text += chunk.data.delta ?? "";
841
+ } else if (chunk.type === "reset_text") {
842
+ // Output-validator retry (ADR-0037) discarding a flagged completed
843
+ // reply — see StreamChunk in base.ts.
844
+ run.final_text = "";
845
+ } else if (chunk.type === "tool_call") {
846
+ const id = chunk.data.id;
847
+ if (id) {
848
+ run.inflight_tools.add(id);
849
+ run.tool_started_at.set(id, Date.now());
850
+ }
851
+ } else if (chunk.type === "tool_result") {
852
+ const id = chunk.data.id;
853
+ if (id) {
854
+ run.inflight_tools.delete(id);
855
+ const startedAt = run.tool_started_at.get(id);
856
+ if (startedAt !== undefined) {
857
+ run.tool_time_ms_done += Math.max(0, Date.now() - startedAt);
858
+ run.tool_started_at.delete(id);
859
+ // The tool just gave the agent its budget back; re-arm the
860
+ // wall-clock watchdog against the new effective elapsed.
861
+ scheduleMaxWatchdog(run);
862
+ }
863
+ }
864
+ }
865
+ if (run.events.length < MAX_BUFFERED) {
866
+ run.events.push(chunk);
867
+ }
868
+ for (const fn of run.subscribers){
869
+ try {
870
+ fn(chunk);
871
+ } catch {}
872
+ }
873
+ }
874
+ function finishRun(run, status) {
875
+ // Identity-check: a stale run finishing late must not flip the
876
+ // replacement's status or evict it from the registry.
877
+ if (runs.get(run.thread_id) !== run) return;
878
+ run.status = status;
879
+ run.finished_at = Date.now();
880
+ // Drop subscribers — late attachers should NOT keep getting events on a
881
+ // dead run. They'll get the buffered events on subscribe and that's it.
882
+ run.subscribers.clear();
883
+ // Auto-evict after TTL so memory doesn't grow with every conversation.
884
+ setTimeout(()=>{
885
+ const cur = runs.get(run.thread_id);
886
+ if (cur === run) runs.delete(run.thread_id);
887
+ }, RECENT_TTL_MS).unref?.();
888
+ }
889
+ function getRun(thread_id) {
890
+ return runs.get(thread_id) ?? null;
891
+ }
892
+ // Signal the agent stream to cancel. The stream loop in the route is wired
893
+ // to listen on the AbortController and exit early, emitting an error chunk
894
+ // the client (and the queue-drain hook) can react to. Idempotent.
895
+ function abortRun(thread_id, reason = "user_interrupted") {
896
+ const run = runs.get(thread_id);
897
+ if (!run || run.status !== "running") return false;
898
+ if (!run.abort.signal.aborted) {
899
+ try {
900
+ run.abort.abort(reason);
901
+ } catch {}
902
+ }
903
+ return true;
904
+ }
905
+ // Queue a user message typed while `thread_id` is streaming (ADR-0080).
906
+ // Returns false when there is nothing to steer, so the caller can fall back
907
+ // to starting a fresh turn.
908
+ function pushSteering(thread_id, text) {
909
+ const run = runs.get(thread_id);
910
+ if (!run || run.status !== "running" || run.abort.signal.aborted) return false;
911
+ const trimmed = text.trim();
912
+ if (!trimmed) return false;
913
+ run.steering.push(trimmed);
914
+ return true;
915
+ }
916
+ // Take everything queued so far, in arrival order. Deliberately not merged
917
+ // into a summary — collapsing several messages loses the user's intent.
918
+ function drainSteering(thread_id) {
919
+ const run = runs.get(thread_id);
920
+ if (!run || run.steering.length === 0) return [];
921
+ return run.steering.splice(0, run.steering.length);
922
+ }
923
+ // Abort every currently-running run. Used by the graceful-shutdown path so
924
+ // LangGraph stream loops bail out instead of continuing past process exit.
925
+ // Returns the number of runs that were signalled.
926
+ function abortAllRuns(reason = "server_shutdown") {
927
+ let count = 0;
928
+ for (const run of runs.values()){
929
+ if (run.status !== "running") continue;
930
+ if (run.abort.signal.aborted) continue;
931
+ try {
932
+ run.abort.abort(reason);
933
+ count++;
934
+ } catch {}
935
+ }
936
+ return count;
937
+ }
938
+ // Poll until every run has transitioned out of "running" (or until the
939
+ // caller-supplied deadline elapses). Used during graceful shutdown after
940
+ // `abortAllRuns()` so the stream `finally` blocks have a chance to flush
941
+ // the trailing error chunk and call `finishRun()`. Resolves to the count
942
+ // of runs still stuck in "running" when the deadline hit (0 = clean).
943
+ async function waitForRunsToSettle(timeoutMs) {
944
+ const deadline = Date.now() + Math.max(0, timeoutMs);
945
+ while(Date.now() < deadline){
946
+ let stillRunning = 0;
947
+ for (const run of runs.values())if (run.status === "running") stillRunning++;
948
+ if (stillRunning === 0) return 0;
949
+ await new Promise((resolve)=>setTimeout(resolve, 50));
950
+ }
951
+ let stillRunning = 0;
952
+ for (const run of runs.values())if (run.status === "running") stillRunning++;
953
+ return stillRunning;
954
+ }
955
+ // Replays buffered events synchronously, then subscribes for live ones.
956
+ // Returns an unsubscribe fn. Caller is responsible for calling it.
957
+ function subscribe(thread_id, onEvent) {
958
+ const run = runs.get(thread_id);
959
+ if (!run) return {
960
+ run: null,
961
+ unsubscribe: ()=>{}
962
+ };
963
+ // Replay buffered events first (so the new subscriber catches up).
964
+ for (const ev of run.events){
965
+ try {
966
+ onEvent(ev);
967
+ } catch {}
968
+ }
969
+ if (run.status !== "running") {
970
+ return {
971
+ run,
972
+ unsubscribe: ()=>{}
973
+ };
970
974
  }
975
+ run.subscribers.add(onEvent);
976
+ return {
977
+ run,
978
+ unsubscribe: ()=>{
979
+ run.subscribers.delete(onEvent);
980
+ }
981
+ };
971
982
  }
972
983
 
973
- //# sourceMappingURL=app-route.js.map
974
984
 
985
+ /***/ }),
986
+
987
+ /***/ 73024:
988
+ /***/ ((module) => {
989
+
990
+ module.exports = require("node:fs");
991
+
992
+ /***/ }),
993
+
994
+ /***/ 76760:
995
+ /***/ ((module) => {
996
+
997
+ module.exports = require("node:path");
998
+
999
+ /***/ }),
1000
+
1001
+ /***/ 86439:
1002
+ /***/ ((module) => {
1003
+
1004
+ module.exports = require("next/dist/shared/lib/no-fallback-error.external");
975
1005
 
976
1006
  /***/ })
977
1007
 
@@ -982,7 +1012,7 @@ async function handler(req, res, ctx) {
982
1012
  var __webpack_require__ = require("../../../../../webpack-runtime.js");
983
1013
  __webpack_require__.C(exports);
984
1014
  var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
985
- var __webpack_exports__ = __webpack_require__.X(0, [2970,7377,1813,4992], () => (__webpack_exec__(95441)));
1015
+ var __webpack_exports__ = __webpack_require__.X(0, [2970,7377,1813,4992], () => (__webpack_exec__(29419)));
986
1016
  module.exports = __webpack_exports__;
987
1017
 
988
1018
  })();