@circuitwall/jarela 2.7.0 → 3.0.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 (730) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-path-routes-manifest.json +2 -1
  3. package/.next/standalone/.next/build-manifest.json +2 -2
  4. package/.next/standalone/.next/prerender-manifest.json +3 -3
  5. package/.next/standalone/.next/routes-manifest.json +6 -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 +58 -58
  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 +127 -127
  22. package/.next/standalone/.next/server/app/api/v1/access/route.js +372 -372
  23. package/.next/standalone/.next/server/app/api/v1/agents/[id]/compact/route.js +79 -79
  24. package/.next/standalone/.next/server/app/api/v1/agents/[id]/display-filters/route.js +641 -641
  25. package/.next/standalone/.next/server/app/api/v1/agents/[id]/duplicate/route.js +723 -723
  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 +65 -65
  28. package/.next/standalone/.next/server/app/api/v1/agents/recent-replies/route.js +227 -227
  29. package/.next/standalone/.next/server/app/api/v1/agents/route.js +16 -16
  30. package/.next/standalone/.next/server/app/api/v1/allowed-sites/[hostname]/route.js +384 -384
  31. package/.next/standalone/.next/server/app/api/v1/allowed-sites/route.js +9 -9
  32. package/.next/standalone/.next/server/app/api/v1/artifacts/lifecycle/route.js +23 -23
  33. package/.next/standalone/.next/server/app/api/v1/attachments/files/route.js +203 -203
  34. package/.next/standalone/.next/server/app/api/v1/attachments/images/route.js +17 -17
  35. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js +2 -2
  36. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js.nft.json +1 -1
  37. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/ignores/[remote_jid]/route.js +760 -760
  38. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/ignores/route.js +699 -699
  39. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js +30 -30
  40. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js +37 -37
  42. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js.nft.json +1 -1
  43. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js +480 -480
  44. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js.nft.json +1 -1
  45. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/routes/[route_id]/route.js +675 -675
  46. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/routes/route.js +559 -559
  47. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js +23 -23
  48. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js.nft.json +1 -1
  49. package/.next/standalone/.next/server/app/api/v1/bridges/kinds/route.js +37 -37
  50. package/.next/standalone/.next/server/app/api/v1/bridges/route.js +1269 -1269
  51. package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js +199 -199
  52. package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js.nft.json +1 -1
  53. package/.next/standalone/.next/server/app/api/v1/config/route.js +99 -99
  54. package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js +23 -23
  55. package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js.nft.json +1 -1
  56. package/.next/standalone/.next/server/app/api/v1/credentials/route.js +169 -169
  57. package/.next/standalone/.next/server/app/api/v1/credentials/route.js.nft.json +1 -1
  58. package/.next/standalone/.next/server/app/api/v1/dashboard/currency/route.js +515 -515
  59. package/.next/standalone/.next/server/app/api/v1/dashboard/metrics/route.js +380 -380
  60. package/.next/standalone/.next/server/app/api/v1/dashboard/metrics/route.js.nft.json +1 -1
  61. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing/route.js +256 -256
  62. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing/route.js.nft.json +1 -1
  63. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js +80 -97
  64. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js.nft.json +1 -1
  65. package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js +677 -677
  66. package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js.nft.json +1 -1
  67. package/.next/standalone/.next/server/app/api/v1/documents/recall-policy/route.js +856 -0
  68. package/.next/standalone/.next/server/app/api/v1/documents/recall-policy/route.js.nft.json +1 -0
  69. package/.next/standalone/.next/server/app/api/v1/documents/recall-policy/route_client-reference-manifest.js +1 -0
  70. package/.next/standalone/.next/server/app/api/v1/documents/search/route.js +299 -247
  71. package/.next/standalone/.next/server/app/api/v1/documents/settings/route.js +486 -486
  72. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js +18 -11
  73. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js.nft.json +1 -1
  74. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js +666 -666
  75. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js.nft.json +1 -1
  76. package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js +128 -100
  77. package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js.nft.json +1 -1
  78. package/.next/standalone/.next/server/app/api/v1/env/route.js +207 -207
  79. package/.next/standalone/.next/server/app/api/v1/env-sync/allowlist/route.js +128 -128
  80. package/.next/standalone/.next/server/app/api/v1/env-sync/route.js +16 -16
  81. package/.next/standalone/.next/server/app/api/v1/events/route.js +154 -154
  82. package/.next/standalone/.next/server/app/api/v1/events/route.js.nft.json +1 -1
  83. package/.next/standalone/.next/server/app/api/v1/events/test/route.js +16 -16
  84. package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js +97 -97
  85. package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js.nft.json +1 -1
  86. package/.next/standalone/.next/server/app/api/v1/extension/browser/activate/route.js +188 -188
  87. package/.next/standalone/.next/server/app/api/v1/extension/browser/foreground/route.js +93 -93
  88. package/.next/standalone/.next/server/app/api/v1/extension/browser/history/route.js +9 -9
  89. package/.next/standalone/.next/server/app/api/v1/extension/browser/poll/route.js +93 -93
  90. package/.next/standalone/.next/server/app/api/v1/extension/browser/progress/route.js +69 -69
  91. package/.next/standalone/.next/server/app/api/v1/extension/browser/result/route.js +69 -69
  92. package/.next/standalone/.next/server/app/api/v1/extension/browser/retry/route.js +65 -65
  93. package/.next/standalone/.next/server/app/api/v1/extension/browser/status/route.js +223 -223
  94. package/.next/standalone/.next/server/app/api/v1/extension/browser/tabs/route.js +44 -44
  95. package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js +93 -93
  96. package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js.nft.json +1 -1
  97. package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js +44 -44
  98. package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js.nft.json +1 -1
  99. package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js +16 -16
  100. package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js.nft.json +1 -1
  101. package/.next/standalone/.next/server/app/api/v1/extensions/route.js +722 -722
  102. package/.next/standalone/.next/server/app/api/v1/extensions/route.js.nft.json +1 -1
  103. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js +481 -481
  104. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js.nft.json +1 -1
  105. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js +378 -378
  106. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js.nft.json +1 -1
  107. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js +510 -510
  108. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js.nft.json +1 -1
  109. package/.next/standalone/.next/server/app/api/v1/files/[name]/route.js +17 -17
  110. package/.next/standalone/.next/server/app/api/v1/fs/browse/route.js +33 -33
  111. package/.next/standalone/.next/server/app/api/v1/harnesses/[id]/route.js +397 -397
  112. package/.next/standalone/.next/server/app/api/v1/harnesses/default/route.js +129 -129
  113. package/.next/standalone/.next/server/app/api/v1/harnesses/route.js +9 -9
  114. package/.next/standalone/.next/server/app/api/v1/health/probes/route.js +757 -757
  115. package/.next/standalone/.next/server/app/api/v1/health/probes/route.js.nft.json +1 -1
  116. package/.next/standalone/.next/server/app/api/v1/health/route.js +228 -228
  117. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/route.js +37 -37
  118. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js +198 -198
  119. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js.nft.json +1 -1
  120. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/callback/route.js +9 -9
  121. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/start/route.js +845 -845
  122. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/status/route.js +23 -23
  123. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/callback/route.js +106 -106
  124. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/start/route.js +747 -747
  125. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/status/route.js +37 -37
  126. package/.next/standalone/.next/server/app/api/v1/integrations/route.js +37 -37
  127. package/.next/standalone/.next/server/app/api/v1/lifecycle/adoption/route.js +420 -420
  128. package/.next/standalone/.next/server/app/api/v1/local-file/route.js +34 -34
  129. package/.next/standalone/.next/server/app/api/v1/logs/route.js +819 -819
  130. package/.next/standalone/.next/server/app/api/v1/maps/embed/route.js +217 -217
  131. package/.next/standalone/.next/server/app/api/v1/mcp-servers/[name]/route.js +1034 -1034
  132. package/.next/standalone/.next/server/app/api/v1/mcp-servers/registry/route.js +2 -2
  133. package/.next/standalone/.next/server/app/api/v1/mcp-servers/route.js +58 -58
  134. package/.next/standalone/.next/server/app/api/v1/memory/[namespace]/[key]/route.js +150 -150
  135. package/.next/standalone/.next/server/app/api/v1/memory/policy/route.js +72 -72
  136. package/.next/standalone/.next/server/app/api/v1/memory/route.js +9 -9
  137. package/.next/standalone/.next/server/app/api/v1/memory/search/route.js +16 -16
  138. package/.next/standalone/.next/server/app/api/v1/models/[name]/compact-threads/route.js +72 -72
  139. package/.next/standalone/.next/server/app/api/v1/models/[name]/route.js +87 -538
  140. package/.next/standalone/.next/server/app/api/v1/models/[name]/route.js.nft.json +1 -1
  141. package/.next/standalone/.next/server/app/api/v1/models/route.js +273 -722
  142. package/.next/standalone/.next/server/app/api/v1/models/route.js.nft.json +1 -1
  143. package/.next/standalone/.next/server/app/api/v1/packages/catalog/route.js +73 -73
  144. package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js +248 -239
  145. package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js.nft.json +1 -1
  146. package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js +128 -128
  147. package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js.nft.json +1 -1
  148. package/.next/standalone/.next/server/app/api/v1/packages/install/route.js +44 -44
  149. package/.next/standalone/.next/server/app/api/v1/packages/install/route.js.nft.json +1 -1
  150. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js +72 -72
  151. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js.nft.json +1 -1
  152. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js +37 -37
  153. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js.nft.json +1 -1
  154. package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js +81 -81
  155. package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js.nft.json +1 -1
  156. package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js +34 -25
  157. package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js.nft.json +1 -1
  158. package/.next/standalone/.next/server/app/api/v1/packages/route.js +48 -39
  159. package/.next/standalone/.next/server/app/api/v1/packages/route.js.nft.json +1 -1
  160. package/.next/standalone/.next/server/app/api/v1/page-capture/route.js +51 -51
  161. package/.next/standalone/.next/server/app/api/v1/page-capture/route.js.nft.json +1 -1
  162. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js +863 -863
  163. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js.nft.json +1 -1
  164. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js +230 -230
  165. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js.nft.json +1 -1
  166. package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js +44 -44
  167. package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js.nft.json +1 -1
  168. package/.next/standalone/.next/server/app/api/v1/profile/location/route.js +138 -138
  169. package/.next/standalone/.next/server/app/api/v1/profile/route.js +51 -51
  170. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/models/route.js +853 -680
  171. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/probe/route.js +65 -65
  172. package/.next/standalone/.next/server/app/api/v1/providers/github-copilot/auth/route.js +171 -171
  173. package/.next/standalone/.next/server/app/api/v1/providers/route.js +96 -96
  174. package/.next/standalone/.next/server/app/api/v1/proxy-config/route.js +157 -157
  175. package/.next/standalone/.next/server/app/api/v1/redaction/init/route.js +47 -47
  176. package/.next/standalone/.next/server/app/api/v1/redaction/route.js +206 -206
  177. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/route.js +140 -140
  178. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js +166 -166
  179. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js.nft.json +1 -1
  180. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/route.js +52 -52
  181. package/.next/standalone/.next/server/app/api/v1/security/idle-timeout/route.js +722 -722
  182. package/.next/standalone/.next/server/app/api/v1/security/pin/route.js +23 -23
  183. package/.next/standalone/.next/server/app/api/v1/security/state/route.js +243 -243
  184. package/.next/standalone/.next/server/app/api/v1/security/unlock/route.js +518 -518
  185. package/.next/standalone/.next/server/app/api/v1/security/verify-pin/route.js +9 -9
  186. package/.next/standalone/.next/server/app/api/v1/setup/test-key/route.js +25 -25
  187. package/.next/standalone/.next/server/app/api/v1/skills/[id]/route.js +9 -9
  188. package/.next/standalone/.next/server/app/api/v1/skills/repos/[id]/route.js +609 -609
  189. package/.next/standalone/.next/server/app/api/v1/skills/repos/route.js +129 -129
  190. package/.next/standalone/.next/server/app/api/v1/skills/route.js +9 -9
  191. package/.next/standalone/.next/server/app/api/v1/system/abort/route.js +112 -112
  192. package/.next/standalone/.next/server/app/api/v1/system/restart/route.js +86 -86
  193. package/.next/standalone/.next/server/app/api/v1/system/restart/route.js.nft.json +1 -1
  194. package/.next/standalone/.next/server/app/api/v1/tailscale/route.js +9 -9
  195. package/.next/standalone/.next/server/app/api/v1/tasks/[agent_id]/route.js +83 -83
  196. package/.next/standalone/.next/server/app/api/v1/tasks/route.js +23 -23
  197. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route.js +121 -121
  198. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/context-pin/route.js +139 -139
  199. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/messages/[message_id]/route.js +51 -51
  200. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/route.js +58 -58
  201. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js +1182 -1182
  202. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js.nft.json +1 -1
  203. package/.next/standalone/.next/server/app/api/v1/threads/route.js +158 -158
  204. package/.next/standalone/.next/server/app/api/v1/tools/route.js +137 -137
  205. package/.next/standalone/.next/server/app/api/v1/tools/route.js.nft.json +1 -1
  206. package/.next/standalone/.next/server/app/api/v1/update/apply/route.js +73 -73
  207. package/.next/standalone/.next/server/app/api/v1/update/apply/route.js.nft.json +1 -1
  208. package/.next/standalone/.next/server/app/api/v1/update/route.js +72 -72
  209. package/.next/standalone/.next/server/app/api/v1/voice/transcribe/route.js +30 -30
  210. package/.next/standalone/.next/server/app/api/v1/voice/tts/route.js +79 -79
  211. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/route.js +9 -9
  212. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js +45 -45
  213. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js.nft.json +1 -1
  214. package/.next/standalone/.next/server/app/api/v1/watchers/reaction-scripts/route.js +2 -2
  215. package/.next/standalone/.next/server/app/api/v1/watchers/route.js +37 -37
  216. package/.next/standalone/.next/server/app/api/v1/watchers/route.js.nft.json +1 -1
  217. package/.next/standalone/.next/server/app/icon.svg/route.js +55 -55
  218. package/.next/standalone/.next/server/app/manifest.webmanifest/route.js +18 -18
  219. package/.next/standalone/.next/server/app/page.js +2112 -1235
  220. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  221. package/.next/standalone/.next/server/app/setup/page.js +91 -91
  222. package/.next/standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  223. package/.next/standalone/.next/server/app-paths-manifest.json +2 -1
  224. package/.next/standalone/.next/server/chunks/1244.js +136 -4
  225. package/.next/standalone/.next/server/chunks/1387.js +733 -57
  226. package/.next/standalone/.next/server/chunks/1433.js +1 -1
  227. package/.next/standalone/.next/server/chunks/210.js +3 -3
  228. package/.next/standalone/.next/server/chunks/2175.js +874 -0
  229. package/.next/standalone/.next/server/chunks/3042.js +34 -32
  230. package/.next/standalone/.next/server/chunks/309.js +21 -40
  231. package/.next/standalone/.next/server/chunks/3272.js +21 -40
  232. package/.next/standalone/.next/server/chunks/{540.js → 3326.js} +189 -61
  233. package/.next/standalone/.next/server/chunks/{6142.js → 3479.js} +170 -159
  234. package/.next/standalone/.next/server/chunks/3566.js +1 -1
  235. package/.next/standalone/.next/server/chunks/{5323.js → 3692.js} +31 -3
  236. package/.next/standalone/.next/server/chunks/4189.js +14 -2
  237. package/.next/standalone/.next/server/chunks/4377.js +2 -2
  238. package/.next/standalone/.next/server/chunks/4596.js +18 -9
  239. package/.next/standalone/.next/server/chunks/{639.js → 4728.js} +23676 -22755
  240. package/.next/standalone/.next/server/chunks/4955.js +81 -14
  241. package/.next/standalone/.next/server/chunks/5290.js +136 -5
  242. package/.next/standalone/.next/server/chunks/{2267.js → 6408.js} +990 -926
  243. package/.next/standalone/.next/server/chunks/{9667.js → 6911.js} +31 -3
  244. package/.next/standalone/.next/server/chunks/7033.js +7 -4
  245. package/.next/standalone/.next/server/chunks/7377.js +7 -4
  246. package/.next/standalone/.next/server/chunks/8461.js +31 -29
  247. package/.next/standalone/.next/server/chunks/9032.js +3 -3
  248. package/.next/standalone/.next/server/chunks/9174.js +18 -9
  249. package/.next/standalone/.next/server/chunks/9408.js +37 -15
  250. package/.next/standalone/.next/server/chunks/9824.js +2288 -2288
  251. package/.next/standalone/.next/server/middleware-build-manifest.js +2 -2
  252. package/.next/standalone/.next/server/middleware.js +104638 -104532
  253. package/.next/standalone/.next/server/pages/404.html +2 -2
  254. package/.next/standalone/.next/server/pages/500.html +1 -1
  255. package/.next/standalone/.next/server/preview-props.json +3 -3
  256. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  257. package/.next/standalone/.next/static/2BAUJZ7x8eXCYpuZ-Kp7h/_buildManifest.js +1 -0
  258. package/.next/standalone/.next/static/chunks/{877-145c9df8aa0aee63.js → 877-367eb49b20edd3d6.js} +38 -16
  259. package/.next/standalone/.next/static/chunks/app/_global-error/page-6cda89771c3f8ea4.js +17 -0
  260. package/.next/standalone/.next/static/chunks/app/api/v1/access/[identity]/route-6cda89771c3f8ea4.js +17 -0
  261. package/.next/standalone/.next/static/chunks/app/api/v1/access/route-6cda89771c3f8ea4.js +17 -0
  262. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/compact/route-6cda89771c3f8ea4.js +17 -0
  263. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/display-filters/route-6cda89771c3f8ea4.js +17 -0
  264. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/duplicate/route-6cda89771c3f8ea4.js +17 -0
  265. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/route-6cda89771c3f8ea4.js +17 -0
  266. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/thread/route-6cda89771c3f8ea4.js +17 -0
  267. package/.next/standalone/.next/static/chunks/app/api/v1/agents/recent-replies/route-6cda89771c3f8ea4.js +17 -0
  268. package/.next/standalone/.next/static/chunks/app/api/v1/agents/route-6cda89771c3f8ea4.js +17 -0
  269. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/[hostname]/route-6cda89771c3f8ea4.js +17 -0
  270. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/route-6cda89771c3f8ea4.js +17 -0
  271. package/.next/standalone/.next/static/chunks/app/api/v1/artifacts/lifecycle/route-6cda89771c3f8ea4.js +17 -0
  272. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/files/route-6cda89771c3f8ea4.js +17 -0
  273. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/images/route-6cda89771c3f8ea4.js +17 -0
  274. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/chats/route-6cda89771c3f8ea4.js +17 -0
  275. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/[remote_jid]/route-6cda89771c3f8ea4.js +17 -0
  276. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/route-6cda89771c3f8ea4.js +17 -0
  277. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/lookup/route-6cda89771c3f8ea4.js +17 -0
  278. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/pair/route-6cda89771c3f8ea4.js +17 -0
  279. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/route-6cda89771c3f8ea4.js +17 -0
  280. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/[route_id]/route-6cda89771c3f8ea4.js +17 -0
  281. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/route-6cda89771c3f8ea4.js +17 -0
  282. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/status/route-6cda89771c3f8ea4.js +17 -0
  283. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/kinds/route-6cda89771c3f8ea4.js +17 -0
  284. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/route-6cda89771c3f8ea4.js +17 -0
  285. package/.next/standalone/.next/static/chunks/app/api/v1/builtin-tools/route-6cda89771c3f8ea4.js +17 -0
  286. package/.next/standalone/.next/static/chunks/app/api/v1/config/route-6cda89771c3f8ea4.js +17 -0
  287. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/[id]/route-6cda89771c3f8ea4.js +17 -0
  288. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/route-6cda89771c3f8ea4.js +17 -0
  289. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/currency/route-6cda89771c3f8ea4.js +17 -0
  290. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/metrics/route-6cda89771c3f8ea4.js +17 -0
  291. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing/route-6cda89771c3f8ea4.js +17 -0
  292. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing-task/route-6cda89771c3f8ea4.js +17 -0
  293. package/.next/standalone/.next/static/chunks/app/api/v1/delegations/codex/[job_id]/route-6cda89771c3f8ea4.js +17 -0
  294. package/.next/standalone/.next/static/chunks/app/api/v1/documents/recall-policy/route-6cda89771c3f8ea4.js +17 -0
  295. package/.next/standalone/.next/static/chunks/app/api/v1/documents/search/route-6cda89771c3f8ea4.js +17 -0
  296. package/.next/standalone/.next/static/chunks/app/api/v1/documents/settings/route-6cda89771c3f8ea4.js +17 -0
  297. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/reindex/route-6cda89771c3f8ea4.js +17 -0
  298. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/route-6cda89771c3f8ea4.js +17 -0
  299. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/route-6cda89771c3f8ea4.js +17 -0
  300. package/.next/standalone/.next/static/chunks/app/api/v1/env/route-6cda89771c3f8ea4.js +17 -0
  301. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/allowlist/route-6cda89771c3f8ea4.js +17 -0
  302. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/route-6cda89771c3f8ea4.js +17 -0
  303. package/.next/standalone/.next/static/chunks/app/api/v1/events/route-6cda89771c3f8ea4.js +17 -0
  304. package/.next/standalone/.next/static/chunks/app/api/v1/events/test/route-6cda89771c3f8ea4.js +17 -0
  305. package/.next/standalone/.next/static/chunks/app/api/v1/extension/agents/route-6cda89771c3f8ea4.js +17 -0
  306. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/activate/route-6cda89771c3f8ea4.js +17 -0
  307. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/foreground/route-6cda89771c3f8ea4.js +17 -0
  308. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/history/route-6cda89771c3f8ea4.js +17 -0
  309. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/poll/route-6cda89771c3f8ea4.js +17 -0
  310. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/progress/route-6cda89771c3f8ea4.js +17 -0
  311. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/result/route-6cda89771c3f8ea4.js +17 -0
  312. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/retry/route-6cda89771c3f8ea4.js +17 -0
  313. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/status/route-6cda89771c3f8ea4.js +17 -0
  314. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/tabs/route-6cda89771c3f8ea4.js +17 -0
  315. package/.next/standalone/.next/static/chunks/app/api/v1/extension/fill/route-6cda89771c3f8ea4.js +17 -0
  316. package/.next/standalone/.next/static/chunks/app/api/v1/extension/refine/route-6cda89771c3f8ea4.js +17 -0
  317. package/.next/standalone/.next/static/chunks/app/api/v1/extension/turn/route-6cda89771c3f8ea4.js +17 -0
  318. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/route-6cda89771c3f8ea4.js +17 -0
  319. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/config/route-6cda89771c3f8ea4.js +17 -0
  320. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/route-6cda89771c3f8ea4.js +17 -0
  321. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/secrets/route-6cda89771c3f8ea4.js +17 -0
  322. package/.next/standalone/.next/static/chunks/app/api/v1/files/[name]/route-6cda89771c3f8ea4.js +17 -0
  323. package/.next/standalone/.next/static/chunks/app/api/v1/fs/browse/route-6cda89771c3f8ea4.js +17 -0
  324. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/[id]/route-6cda89771c3f8ea4.js +17 -0
  325. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/default/route-6cda89771c3f8ea4.js +17 -0
  326. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/route-6cda89771c3f8ea4.js +17 -0
  327. package/.next/standalone/.next/static/chunks/app/api/v1/health/probes/route-6cda89771c3f8ea4.js +17 -0
  328. package/.next/standalone/.next/static/chunks/app/api/v1/health/route-6cda89771c3f8ea4.js +17 -0
  329. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/route-6cda89771c3f8ea4.js +17 -0
  330. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/test/route-6cda89771c3f8ea4.js +17 -0
  331. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/callback/route-6cda89771c3f8ea4.js +17 -0
  332. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/start/route-6cda89771c3f8ea4.js +17 -0
  333. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/status/route-6cda89771c3f8ea4.js +17 -0
  334. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/callback/route-6cda89771c3f8ea4.js +17 -0
  335. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/start/route-6cda89771c3f8ea4.js +17 -0
  336. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/status/route-6cda89771c3f8ea4.js +17 -0
  337. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/route-6cda89771c3f8ea4.js +17 -0
  338. package/.next/standalone/.next/static/chunks/app/api/v1/lifecycle/adoption/route-6cda89771c3f8ea4.js +17 -0
  339. package/.next/standalone/.next/static/chunks/app/api/v1/local-file/route-6cda89771c3f8ea4.js +17 -0
  340. package/.next/standalone/.next/static/chunks/app/api/v1/logs/route-6cda89771c3f8ea4.js +17 -0
  341. package/.next/standalone/.next/static/chunks/app/api/v1/maps/embed/route-6cda89771c3f8ea4.js +17 -0
  342. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/[name]/route-6cda89771c3f8ea4.js +17 -0
  343. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/registry/route-6cda89771c3f8ea4.js +17 -0
  344. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/route-6cda89771c3f8ea4.js +17 -0
  345. package/.next/standalone/.next/static/chunks/app/api/v1/memory/[namespace]/[key]/route-6cda89771c3f8ea4.js +17 -0
  346. package/.next/standalone/.next/static/chunks/app/api/v1/memory/policy/route-6cda89771c3f8ea4.js +17 -0
  347. package/.next/standalone/.next/static/chunks/app/api/v1/memory/route-6cda89771c3f8ea4.js +17 -0
  348. package/.next/standalone/.next/static/chunks/app/api/v1/memory/search/route-6cda89771c3f8ea4.js +17 -0
  349. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/compact-threads/route-6cda89771c3f8ea4.js +17 -0
  350. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/route-6cda89771c3f8ea4.js +17 -0
  351. package/.next/standalone/.next/static/chunks/app/api/v1/models/route-6cda89771c3f8ea4.js +17 -0
  352. package/.next/standalone/.next/static/chunks/app/api/v1/packages/catalog/route-6cda89771c3f8ea4.js +17 -0
  353. package/.next/standalone/.next/static/chunks/app/api/v1/packages/defaults/[id]/route-6cda89771c3f8ea4.js +17 -0
  354. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/[id]/route-6cda89771c3f8ea4.js +17 -0
  355. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/route-6cda89771c3f8ea4.js +17 -0
  356. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/enabled/route-6cda89771c3f8ea4.js +17 -0
  357. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/route-6cda89771c3f8ea4.js +17 -0
  358. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/route-6cda89771c3f8ea4.js +17 -0
  359. package/.next/standalone/.next/static/chunks/app/api/v1/packages/reload/route-6cda89771c3f8ea4.js +17 -0
  360. package/.next/standalone/.next/static/chunks/app/api/v1/packages/route-6cda89771c3f8ea4.js +17 -0
  361. package/.next/standalone/.next/static/chunks/app/api/v1/page-capture/route-6cda89771c3f8ea4.js +17 -0
  362. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/approve/route-6cda89771c3f8ea4.js +17 -0
  363. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/deny/route-6cda89771c3f8ea4.js +17 -0
  364. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/route-6cda89771c3f8ea4.js +17 -0
  365. package/.next/standalone/.next/static/chunks/app/api/v1/profile/location/route-6cda89771c3f8ea4.js +17 -0
  366. package/.next/standalone/.next/static/chunks/app/api/v1/profile/route-6cda89771c3f8ea4.js +17 -0
  367. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/models/route-6cda89771c3f8ea4.js +17 -0
  368. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/probe/route-6cda89771c3f8ea4.js +17 -0
  369. package/.next/standalone/.next/static/chunks/app/api/v1/providers/github-copilot/auth/route-6cda89771c3f8ea4.js +17 -0
  370. package/.next/standalone/.next/static/chunks/app/api/v1/providers/route-6cda89771c3f8ea4.js +17 -0
  371. package/.next/standalone/.next/static/chunks/app/api/v1/proxy-config/route-6cda89771c3f8ea4.js +17 -0
  372. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/init/route-6cda89771c3f8ea4.js +17 -0
  373. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/route-6cda89771c3f8ea4.js +17 -0
  374. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/route-6cda89771c3f8ea4.js +17 -0
  375. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/run/route-6cda89771c3f8ea4.js +17 -0
  376. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/route-6cda89771c3f8ea4.js +17 -0
  377. package/.next/standalone/.next/static/chunks/app/api/v1/security/idle-timeout/route-6cda89771c3f8ea4.js +17 -0
  378. package/.next/standalone/.next/static/chunks/app/api/v1/security/pin/route-6cda89771c3f8ea4.js +17 -0
  379. package/.next/standalone/.next/static/chunks/app/api/v1/security/state/route-6cda89771c3f8ea4.js +17 -0
  380. package/.next/standalone/.next/static/chunks/app/api/v1/security/unlock/route-6cda89771c3f8ea4.js +17 -0
  381. package/.next/standalone/.next/static/chunks/app/api/v1/security/verify-pin/route-6cda89771c3f8ea4.js +17 -0
  382. package/.next/standalone/.next/static/chunks/app/api/v1/setup/test-key/route-6cda89771c3f8ea4.js +17 -0
  383. package/.next/standalone/.next/static/chunks/app/api/v1/skills/[id]/route-6cda89771c3f8ea4.js +17 -0
  384. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/[id]/route-6cda89771c3f8ea4.js +17 -0
  385. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/route-6cda89771c3f8ea4.js +17 -0
  386. package/.next/standalone/.next/static/chunks/app/api/v1/skills/route-6cda89771c3f8ea4.js +17 -0
  387. package/.next/standalone/.next/static/chunks/app/api/v1/system/abort/route-6cda89771c3f8ea4.js +17 -0
  388. package/.next/standalone/.next/static/chunks/app/api/v1/system/restart/route-6cda89771c3f8ea4.js +17 -0
  389. package/.next/standalone/.next/static/chunks/app/api/v1/tailscale/route-6cda89771c3f8ea4.js +17 -0
  390. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/[agent_id]/route-6cda89771c3f8ea4.js +17 -0
  391. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/route-6cda89771c3f8ea4.js +17 -0
  392. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/activity/route-6cda89771c3f8ea4.js +17 -0
  393. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/context-pin/route-6cda89771c3f8ea4.js +17 -0
  394. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/messages/[message_id]/route-6cda89771c3f8ea4.js +17 -0
  395. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/route-6cda89771c3f8ea4.js +17 -0
  396. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/run/route-6cda89771c3f8ea4.js +17 -0
  397. package/.next/standalone/.next/static/chunks/app/api/v1/threads/route-6cda89771c3f8ea4.js +17 -0
  398. package/.next/standalone/.next/static/chunks/app/api/v1/tools/route-6cda89771c3f8ea4.js +17 -0
  399. package/.next/standalone/.next/static/chunks/app/api/v1/update/apply/route-6cda89771c3f8ea4.js +17 -0
  400. package/.next/standalone/.next/static/chunks/app/api/v1/update/route-6cda89771c3f8ea4.js +17 -0
  401. package/.next/standalone/.next/static/chunks/app/api/v1/voice/transcribe/route-6cda89771c3f8ea4.js +17 -0
  402. package/.next/standalone/.next/static/chunks/app/api/v1/voice/tts/route-6cda89771c3f8ea4.js +17 -0
  403. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/route-6cda89771c3f8ea4.js +17 -0
  404. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/run/route-6cda89771c3f8ea4.js +17 -0
  405. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/reaction-scripts/route-6cda89771c3f8ea4.js +17 -0
  406. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/route-6cda89771c3f8ea4.js +17 -0
  407. package/.next/standalone/.next/static/chunks/app/manifest.webmanifest/route-6cda89771c3f8ea4.js +17 -0
  408. package/.next/standalone/.next/static/chunks/app/{page-64585ef79400f17f.js → page-a584dfa806a1afdb.js} +1082 -205
  409. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-6cda89771c3f8ea4.js +17 -0
  410. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-6cda89771c3f8ea4.js +17 -0
  411. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-6cda89771c3f8ea4.js +17 -0
  412. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-6cda89771c3f8ea4.js +17 -0
  413. package/.next/standalone/.next/static/css/19e1cd815490b47c.css +5 -0
  414. package/.next/standalone/docs/adoption/changesets.json +148 -0
  415. package/.next/standalone/package.json +5 -4
  416. package/CHANGELOG.md +51 -0
  417. package/README.md +115 -1
  418. package/api/client.startup.test.ts +29 -0
  419. package/api/client.ts +9 -2
  420. package/api/types.ts +20 -1
  421. package/app/api/v1/dashboard/pricing-task/route.ts +3 -1
  422. package/app/api/v1/documents/recall-policy/route.test.ts +59 -0
  423. package/app/api/v1/documents/recall-policy/route.ts +20 -0
  424. package/app/api/v1/documents/search/route.test.ts +36 -0
  425. package/app/api/v1/documents/search/route.ts +17 -5
  426. package/app/api/v1/documents/sources/[id]/reindex/route.test.ts +44 -0
  427. package/app/api/v1/documents/sources/[id]/reindex/route.ts +4 -1
  428. package/app/api/v1/documents/sources/route.test.ts +67 -0
  429. package/app/api/v1/documents/sources/route.ts +20 -2
  430. package/app/api/v1/models/[name]/route.ts +2 -0
  431. package/app/api/v1/models/route.ts +4 -0
  432. package/app/api/v1/providers/[provider]/models/route.test.ts +28 -0
  433. package/app/api/v1/providers/[provider]/models/route.ts +16 -2
  434. package/app/globals.css +51 -4
  435. package/components/agents/AgentsPanel.tsx +2 -2
  436. package/components/agents/agent-editor/AdvancedSection.tsx +1 -1
  437. package/components/agents/agent-editor/ModelSection.tsx +2 -2
  438. package/components/bridges/BridgeEditor.tsx +1 -1
  439. package/components/bridges/BridgesPanel.tsx +1 -1
  440. package/components/chat/InputBar.tsx +1 -1
  441. package/components/chat/MessageList.tsx +3 -3
  442. package/components/chat/useUserProfileAndAgent.test.tsx +43 -1
  443. package/components/chat/useUserProfileAndAgent.ts +16 -5
  444. package/components/credentials/CredentialsPanel.tsx +1 -1
  445. package/components/dashboard/CostBreakdown.test.tsx +34 -0
  446. package/components/dashboard/CostBreakdown.tsx +21 -0
  447. package/components/dashboard/DashboardPanel.test.tsx +9 -0
  448. package/components/dashboard/DashboardPanel.tsx +3 -3
  449. package/components/dashboard/Donuts.tsx +5 -2
  450. package/components/dashboard/ModelPricingSection.test.tsx +42 -0
  451. package/components/dashboard/ModelPricingSection.tsx +23 -21
  452. package/components/dashboard/Series.test.tsx +1 -0
  453. package/components/dashboard/Series.tsx +5 -0
  454. package/components/dashboard/SummaryCards.tsx +39 -27
  455. package/components/dashboard/VendorModelReportSection.tsx +2 -0
  456. package/components/documents/AddSourceFields.tsx +52 -15
  457. package/components/documents/AddSourceForm.tsx +61 -19
  458. package/components/documents/DocumentsPanel.tsx +22 -2
  459. package/components/documents/RecallExclusions.tsx +73 -0
  460. package/components/documents/SearchProbe.tsx +42 -5
  461. package/components/documents/helpers.ts +17 -3
  462. package/components/documents/indexing-controls.test.tsx +137 -0
  463. package/components/documents/useDocumentsPanel.test.tsx +87 -0
  464. package/components/documents/useDocumentsPanel.ts +47 -6
  465. package/components/env/EnvVarsPanel.tsx +1 -1
  466. package/components/harness/HarnessPanel.tsx +2 -2
  467. package/components/integrations/NetworkPanel.tsx +1 -1
  468. package/components/layout/AgentCardControls.test.tsx +162 -0
  469. package/components/layout/AgentCardControls.tsx +126 -0
  470. package/components/layout/AgentSwitcher.test.tsx +37 -0
  471. package/components/layout/AgentSwitcher.tsx +28 -3
  472. package/components/layout/AppShell.tsx +16 -9
  473. package/components/layout/MenuPanel.test.tsx +125 -2
  474. package/components/layout/MenuPanel.tsx +96 -2
  475. package/components/logs/LogsPanel.tsx +1 -1
  476. package/components/mcp/MCPPanel.tsx +1 -1
  477. package/components/memory/UnifiedMemoryPanel.tsx +4 -4
  478. package/components/models/CapBadges.tsx +1 -1
  479. package/components/models/EmbeddingModelSection.test.tsx +41 -0
  480. package/components/models/EmbeddingModelSection.tsx +5 -0
  481. package/components/models/ModelFeatureGuide.tsx +16 -8
  482. package/components/models/ModelsPanel.tsx +8 -3
  483. package/components/models/model-editor/ModelEditorBody.tsx +1 -0
  484. package/components/models/model-editor/ModelIdSection.tsx +5 -0
  485. package/components/profile/ProfileEditor.test.tsx +70 -0
  486. package/components/profile/ProfileEditor.tsx +6 -2
  487. package/components/profile/ProfilePanel.test.tsx +6 -0
  488. package/components/profile/ProfilePanel.tsx +1 -1
  489. package/components/scheduled-tasks/ScheduledTasksPanel.tsx +1 -1
  490. package/components/settings/AppearancePanel.tsx +1 -1
  491. package/components/settings/SettingsPanel.test.tsx +23 -0
  492. package/components/settings/SettingsPanel.tsx +2 -2
  493. package/components/skills/SkillsPanel.tsx +1 -1
  494. package/components/tools/BrowserPanel.tsx +1 -1
  495. package/components/tools/PackagesPanel.tsx +1 -1
  496. package/components/tools/UnifiedPackageList.tsx +1 -1
  497. package/components/ui/PanelHeader.tsx +1 -1
  498. package/components/ui/SubTabBar.tsx +1 -1
  499. package/docs/INSTALL.md +7 -5
  500. package/hooks/useAgents.ts +2 -2
  501. package/lib/agents/prepare/system-prompt.test.ts +65 -0
  502. package/lib/agents/prepare/system-prompt.ts +27 -20
  503. package/lib/agents/prompt-registry.test.ts +42 -0
  504. package/lib/agents/prompt-registry.ts +21 -0
  505. package/lib/bridges/whatsapp.inbound.test.ts +38 -1
  506. package/lib/bridges/whatsapp.ts +10 -33
  507. package/lib/db/index.ts +2 -0
  508. package/lib/db/migrations.test.ts +10 -0
  509. package/lib/db/migrations.ts +10 -0
  510. package/lib/db/statement-cache.test.ts +77 -0
  511. package/lib/db/statement-cache.ts +31 -0
  512. package/lib/documents/indexer.test.ts +16 -1
  513. package/lib/documents/indexer.ts +8 -7
  514. package/lib/documents/mail-source-config.ts +31 -0
  515. package/lib/documents/recall-policy.ts +24 -0
  516. package/lib/documents/remote/icloud.ts +56 -0
  517. package/lib/documents/remote/index.ts +4 -1
  518. package/lib/documents/remote/mail.test.ts +232 -0
  519. package/lib/documents/remote/mail.ts +48 -40
  520. package/lib/documents/search.test.ts +81 -2
  521. package/lib/documents/search.ts +47 -7
  522. package/lib/embeddings/cache.test.ts +16 -2
  523. package/lib/embeddings/index.test.ts +7 -0
  524. package/lib/embeddings/index.ts +12 -1
  525. package/lib/integrations/deepseek-web/manifest.ts +68 -0
  526. package/lib/integrations/gmail/manifest.ts +2 -3
  527. package/lib/integrations/icloud/manifest.ts +19 -5
  528. package/lib/integrations/registry.test.ts +8 -0
  529. package/lib/integrations/registry.ts +2 -0
  530. package/lib/lifecycle/changeset-build.test.ts +3 -0
  531. package/lib/lifecycle/changeset-build.ts +6 -0
  532. package/lib/lifecycle/changesets.ts +9 -0
  533. package/lib/pricing/llm-extract.ts +1 -1
  534. package/lib/pricing/maintenance-task.ts +19 -3
  535. package/lib/pricing/model-updates.test.ts +192 -0
  536. package/lib/pricing/model-updates.ts +205 -0
  537. package/lib/stores/app-settings.ts +17 -1
  538. package/lib/stores/dashboard-metrics-cache.test.ts +44 -0
  539. package/lib/stores/dashboard-metrics.test.ts +47 -4
  540. package/lib/stores/dashboard-metrics.ts +73 -8
  541. package/lib/stores/document-sources.ts +1 -0
  542. package/lib/stores/integrations.test.ts +20 -0
  543. package/lib/stores/integrations.ts +15 -4
  544. package/lib/stores/langgraph-store.test.ts +53 -0
  545. package/lib/stores/langgraph-store.ts +9 -21
  546. package/lib/stores/model-metadata.ts +89 -0
  547. package/lib/stores/threads.test.ts +34 -0
  548. package/lib/stores/threads.ts +17 -20
  549. package/lib/stores/tool-stats.test.ts +31 -0
  550. package/lib/stores/tool-stats.ts +16 -0
  551. package/lib/stores/version-adoption.test.ts +8 -0
  552. package/lib/stores/version-adoption.ts +5 -2
  553. package/lib/tools/general/documents.test.ts +5 -0
  554. package/lib/tools/general/pricing-maintenance.test.ts +5 -0
  555. package/lib/tools/general/pricing-maintenance.ts +4 -1
  556. package/lib/tools/packages/default-packages/icloud.test.ts +49 -0
  557. package/lib/tools/packages/default-packages/icloud.ts +8 -6
  558. package/lib/tools/packages/default-packages.test.ts +16 -0
  559. package/lib/tools/packages/langchain-packages.ts +2 -2
  560. package/lib/tools/runtime/category-filter.test.ts +22 -0
  561. package/lib/tools/web/deepseek.test.ts +76 -0
  562. package/lib/tools/web/deepseek.ts +68 -0
  563. package/lib/tools/web/fetch.test.ts +130 -2
  564. package/lib/tools/web/fetch.ts +48 -1
  565. package/lib/tools/web/search.test.ts +139 -2
  566. package/lib/tools/web/search.ts +48 -1
  567. package/lib/triggers/handlers/scheduled-task.test.ts +18 -0
  568. package/lib/triggers/handlers/scheduled-task.ts +6 -0
  569. package/lib/ui/feature-readiness.test.ts +7 -0
  570. package/lib/ui/feature-readiness.ts +2 -1
  571. package/package.json +5 -4
  572. package/scripts/check-npm-package.mjs +1 -0
  573. package/scripts/jarela-bin.mjs +3 -0
  574. package/scripts/runtime-version.mjs +19 -0
  575. package/scripts/start-prod.mjs +3 -0
  576. package/.next/standalone/.next/static/6qLnqWdsfBTJOAJApUYXy/_buildManifest.js +0 -1
  577. package/.next/standalone/.next/static/chunks/app/_global-error/page-f6b126e5c5b11551.js +0 -17
  578. package/.next/standalone/.next/static/chunks/app/api/v1/access/[identity]/route-f6b126e5c5b11551.js +0 -17
  579. package/.next/standalone/.next/static/chunks/app/api/v1/access/route-f6b126e5c5b11551.js +0 -17
  580. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/compact/route-f6b126e5c5b11551.js +0 -17
  581. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/display-filters/route-f6b126e5c5b11551.js +0 -17
  582. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/duplicate/route-f6b126e5c5b11551.js +0 -17
  583. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/route-f6b126e5c5b11551.js +0 -17
  584. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/thread/route-f6b126e5c5b11551.js +0 -17
  585. package/.next/standalone/.next/static/chunks/app/api/v1/agents/recent-replies/route-f6b126e5c5b11551.js +0 -17
  586. package/.next/standalone/.next/static/chunks/app/api/v1/agents/route-f6b126e5c5b11551.js +0 -17
  587. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/[hostname]/route-f6b126e5c5b11551.js +0 -17
  588. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/route-f6b126e5c5b11551.js +0 -17
  589. package/.next/standalone/.next/static/chunks/app/api/v1/artifacts/lifecycle/route-f6b126e5c5b11551.js +0 -17
  590. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/files/route-f6b126e5c5b11551.js +0 -17
  591. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/images/route-f6b126e5c5b11551.js +0 -17
  592. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/chats/route-f6b126e5c5b11551.js +0 -17
  593. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/[remote_jid]/route-f6b126e5c5b11551.js +0 -17
  594. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/route-f6b126e5c5b11551.js +0 -17
  595. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/lookup/route-f6b126e5c5b11551.js +0 -17
  596. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/pair/route-f6b126e5c5b11551.js +0 -17
  597. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/route-f6b126e5c5b11551.js +0 -17
  598. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/[route_id]/route-f6b126e5c5b11551.js +0 -17
  599. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/route-f6b126e5c5b11551.js +0 -17
  600. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/status/route-f6b126e5c5b11551.js +0 -17
  601. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/kinds/route-f6b126e5c5b11551.js +0 -17
  602. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/route-f6b126e5c5b11551.js +0 -17
  603. package/.next/standalone/.next/static/chunks/app/api/v1/builtin-tools/route-f6b126e5c5b11551.js +0 -17
  604. package/.next/standalone/.next/static/chunks/app/api/v1/config/route-f6b126e5c5b11551.js +0 -17
  605. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/[id]/route-f6b126e5c5b11551.js +0 -17
  606. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/route-f6b126e5c5b11551.js +0 -17
  607. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/currency/route-f6b126e5c5b11551.js +0 -17
  608. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/metrics/route-f6b126e5c5b11551.js +0 -17
  609. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing/route-f6b126e5c5b11551.js +0 -17
  610. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing-task/route-f6b126e5c5b11551.js +0 -17
  611. package/.next/standalone/.next/static/chunks/app/api/v1/delegations/codex/[job_id]/route-f6b126e5c5b11551.js +0 -17
  612. package/.next/standalone/.next/static/chunks/app/api/v1/documents/search/route-f6b126e5c5b11551.js +0 -17
  613. package/.next/standalone/.next/static/chunks/app/api/v1/documents/settings/route-f6b126e5c5b11551.js +0 -17
  614. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/reindex/route-f6b126e5c5b11551.js +0 -17
  615. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/route-f6b126e5c5b11551.js +0 -17
  616. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/route-f6b126e5c5b11551.js +0 -17
  617. package/.next/standalone/.next/static/chunks/app/api/v1/env/route-f6b126e5c5b11551.js +0 -17
  618. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/allowlist/route-f6b126e5c5b11551.js +0 -17
  619. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/route-f6b126e5c5b11551.js +0 -17
  620. package/.next/standalone/.next/static/chunks/app/api/v1/events/route-f6b126e5c5b11551.js +0 -17
  621. package/.next/standalone/.next/static/chunks/app/api/v1/events/test/route-f6b126e5c5b11551.js +0 -17
  622. package/.next/standalone/.next/static/chunks/app/api/v1/extension/agents/route-f6b126e5c5b11551.js +0 -17
  623. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/activate/route-f6b126e5c5b11551.js +0 -17
  624. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/foreground/route-f6b126e5c5b11551.js +0 -17
  625. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/history/route-f6b126e5c5b11551.js +0 -17
  626. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/poll/route-f6b126e5c5b11551.js +0 -17
  627. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/progress/route-f6b126e5c5b11551.js +0 -17
  628. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/result/route-f6b126e5c5b11551.js +0 -17
  629. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/retry/route-f6b126e5c5b11551.js +0 -17
  630. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/status/route-f6b126e5c5b11551.js +0 -17
  631. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/tabs/route-f6b126e5c5b11551.js +0 -17
  632. package/.next/standalone/.next/static/chunks/app/api/v1/extension/fill/route-f6b126e5c5b11551.js +0 -17
  633. package/.next/standalone/.next/static/chunks/app/api/v1/extension/refine/route-f6b126e5c5b11551.js +0 -17
  634. package/.next/standalone/.next/static/chunks/app/api/v1/extension/turn/route-f6b126e5c5b11551.js +0 -17
  635. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/route-f6b126e5c5b11551.js +0 -17
  636. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/config/route-f6b126e5c5b11551.js +0 -17
  637. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/route-f6b126e5c5b11551.js +0 -17
  638. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/secrets/route-f6b126e5c5b11551.js +0 -17
  639. package/.next/standalone/.next/static/chunks/app/api/v1/files/[name]/route-f6b126e5c5b11551.js +0 -17
  640. package/.next/standalone/.next/static/chunks/app/api/v1/fs/browse/route-f6b126e5c5b11551.js +0 -17
  641. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/[id]/route-f6b126e5c5b11551.js +0 -17
  642. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/default/route-f6b126e5c5b11551.js +0 -17
  643. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/route-f6b126e5c5b11551.js +0 -17
  644. package/.next/standalone/.next/static/chunks/app/api/v1/health/probes/route-f6b126e5c5b11551.js +0 -17
  645. package/.next/standalone/.next/static/chunks/app/api/v1/health/route-f6b126e5c5b11551.js +0 -17
  646. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/route-f6b126e5c5b11551.js +0 -17
  647. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/test/route-f6b126e5c5b11551.js +0 -17
  648. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/callback/route-f6b126e5c5b11551.js +0 -17
  649. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/start/route-f6b126e5c5b11551.js +0 -17
  650. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/status/route-f6b126e5c5b11551.js +0 -17
  651. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/callback/route-f6b126e5c5b11551.js +0 -17
  652. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/start/route-f6b126e5c5b11551.js +0 -17
  653. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/status/route-f6b126e5c5b11551.js +0 -17
  654. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/route-f6b126e5c5b11551.js +0 -17
  655. package/.next/standalone/.next/static/chunks/app/api/v1/lifecycle/adoption/route-f6b126e5c5b11551.js +0 -17
  656. package/.next/standalone/.next/static/chunks/app/api/v1/local-file/route-f6b126e5c5b11551.js +0 -17
  657. package/.next/standalone/.next/static/chunks/app/api/v1/logs/route-f6b126e5c5b11551.js +0 -17
  658. package/.next/standalone/.next/static/chunks/app/api/v1/maps/embed/route-f6b126e5c5b11551.js +0 -17
  659. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/[name]/route-f6b126e5c5b11551.js +0 -17
  660. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/registry/route-f6b126e5c5b11551.js +0 -17
  661. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/route-f6b126e5c5b11551.js +0 -17
  662. package/.next/standalone/.next/static/chunks/app/api/v1/memory/[namespace]/[key]/route-f6b126e5c5b11551.js +0 -17
  663. package/.next/standalone/.next/static/chunks/app/api/v1/memory/policy/route-f6b126e5c5b11551.js +0 -17
  664. package/.next/standalone/.next/static/chunks/app/api/v1/memory/route-f6b126e5c5b11551.js +0 -17
  665. package/.next/standalone/.next/static/chunks/app/api/v1/memory/search/route-f6b126e5c5b11551.js +0 -17
  666. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/compact-threads/route-f6b126e5c5b11551.js +0 -17
  667. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/route-f6b126e5c5b11551.js +0 -17
  668. package/.next/standalone/.next/static/chunks/app/api/v1/models/route-f6b126e5c5b11551.js +0 -17
  669. package/.next/standalone/.next/static/chunks/app/api/v1/packages/catalog/route-f6b126e5c5b11551.js +0 -17
  670. package/.next/standalone/.next/static/chunks/app/api/v1/packages/defaults/[id]/route-f6b126e5c5b11551.js +0 -17
  671. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/[id]/route-f6b126e5c5b11551.js +0 -17
  672. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/route-f6b126e5c5b11551.js +0 -17
  673. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/enabled/route-f6b126e5c5b11551.js +0 -17
  674. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/route-f6b126e5c5b11551.js +0 -17
  675. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/route-f6b126e5c5b11551.js +0 -17
  676. package/.next/standalone/.next/static/chunks/app/api/v1/packages/reload/route-f6b126e5c5b11551.js +0 -17
  677. package/.next/standalone/.next/static/chunks/app/api/v1/packages/route-f6b126e5c5b11551.js +0 -17
  678. package/.next/standalone/.next/static/chunks/app/api/v1/page-capture/route-f6b126e5c5b11551.js +0 -17
  679. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/approve/route-f6b126e5c5b11551.js +0 -17
  680. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/deny/route-f6b126e5c5b11551.js +0 -17
  681. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/route-f6b126e5c5b11551.js +0 -17
  682. package/.next/standalone/.next/static/chunks/app/api/v1/profile/location/route-f6b126e5c5b11551.js +0 -17
  683. package/.next/standalone/.next/static/chunks/app/api/v1/profile/route-f6b126e5c5b11551.js +0 -17
  684. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/models/route-f6b126e5c5b11551.js +0 -17
  685. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/probe/route-f6b126e5c5b11551.js +0 -17
  686. package/.next/standalone/.next/static/chunks/app/api/v1/providers/github-copilot/auth/route-f6b126e5c5b11551.js +0 -17
  687. package/.next/standalone/.next/static/chunks/app/api/v1/providers/route-f6b126e5c5b11551.js +0 -17
  688. package/.next/standalone/.next/static/chunks/app/api/v1/proxy-config/route-f6b126e5c5b11551.js +0 -17
  689. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/init/route-f6b126e5c5b11551.js +0 -17
  690. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/route-f6b126e5c5b11551.js +0 -17
  691. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/route-f6b126e5c5b11551.js +0 -17
  692. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/run/route-f6b126e5c5b11551.js +0 -17
  693. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/route-f6b126e5c5b11551.js +0 -17
  694. package/.next/standalone/.next/static/chunks/app/api/v1/security/idle-timeout/route-f6b126e5c5b11551.js +0 -17
  695. package/.next/standalone/.next/static/chunks/app/api/v1/security/pin/route-f6b126e5c5b11551.js +0 -17
  696. package/.next/standalone/.next/static/chunks/app/api/v1/security/state/route-f6b126e5c5b11551.js +0 -17
  697. package/.next/standalone/.next/static/chunks/app/api/v1/security/unlock/route-f6b126e5c5b11551.js +0 -17
  698. package/.next/standalone/.next/static/chunks/app/api/v1/security/verify-pin/route-f6b126e5c5b11551.js +0 -17
  699. package/.next/standalone/.next/static/chunks/app/api/v1/setup/test-key/route-f6b126e5c5b11551.js +0 -17
  700. package/.next/standalone/.next/static/chunks/app/api/v1/skills/[id]/route-f6b126e5c5b11551.js +0 -17
  701. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/[id]/route-f6b126e5c5b11551.js +0 -17
  702. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/route-f6b126e5c5b11551.js +0 -17
  703. package/.next/standalone/.next/static/chunks/app/api/v1/skills/route-f6b126e5c5b11551.js +0 -17
  704. package/.next/standalone/.next/static/chunks/app/api/v1/system/abort/route-f6b126e5c5b11551.js +0 -17
  705. package/.next/standalone/.next/static/chunks/app/api/v1/system/restart/route-f6b126e5c5b11551.js +0 -17
  706. package/.next/standalone/.next/static/chunks/app/api/v1/tailscale/route-f6b126e5c5b11551.js +0 -17
  707. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/[agent_id]/route-f6b126e5c5b11551.js +0 -17
  708. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/route-f6b126e5c5b11551.js +0 -17
  709. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/activity/route-f6b126e5c5b11551.js +0 -17
  710. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/context-pin/route-f6b126e5c5b11551.js +0 -17
  711. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/messages/[message_id]/route-f6b126e5c5b11551.js +0 -17
  712. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/route-f6b126e5c5b11551.js +0 -17
  713. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/run/route-f6b126e5c5b11551.js +0 -17
  714. package/.next/standalone/.next/static/chunks/app/api/v1/threads/route-f6b126e5c5b11551.js +0 -17
  715. package/.next/standalone/.next/static/chunks/app/api/v1/tools/route-f6b126e5c5b11551.js +0 -17
  716. package/.next/standalone/.next/static/chunks/app/api/v1/update/apply/route-f6b126e5c5b11551.js +0 -17
  717. package/.next/standalone/.next/static/chunks/app/api/v1/update/route-f6b126e5c5b11551.js +0 -17
  718. package/.next/standalone/.next/static/chunks/app/api/v1/voice/transcribe/route-f6b126e5c5b11551.js +0 -17
  719. package/.next/standalone/.next/static/chunks/app/api/v1/voice/tts/route-f6b126e5c5b11551.js +0 -17
  720. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/route-f6b126e5c5b11551.js +0 -17
  721. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/run/route-f6b126e5c5b11551.js +0 -17
  722. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/reaction-scripts/route-f6b126e5c5b11551.js +0 -17
  723. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/route-f6b126e5c5b11551.js +0 -17
  724. package/.next/standalone/.next/static/chunks/app/manifest.webmanifest/route-f6b126e5c5b11551.js +0 -17
  725. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-f6b126e5c5b11551.js +0 -17
  726. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-f6b126e5c5b11551.js +0 -17
  727. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-f6b126e5c5b11551.js +0 -17
  728. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-f6b126e5c5b11551.js +0 -17
  729. package/.next/standalone/.next/static/css/c4a8bed1da2c748f.css +0 -5
  730. /package/.next/standalone/.next/static/{6qLnqWdsfBTJOAJApUYXy → 2BAUJZ7x8eXCYpuZ-Kp7h}/_ssgManifest.js +0 -0
@@ -650,813 +650,778 @@ const SECTION_DISPLAY = {
650
650
 
651
651
  /***/ }),
652
652
 
653
- /***/ 521907:
653
+ /***/ 524318:
654
654
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
655
655
 
656
- __webpack_require__.r(__webpack_exports__);
657
656
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
658
- /* harmony export */ handler: () => (/* binding */ handler),
659
- /* harmony export */ patchFetch: () => (/* binding */ patchFetch),
660
- /* harmony export */ routeModule: () => (/* binding */ routeModule),
661
- /* harmony export */ serverHooks: () => (/* binding */ serverHooks),
662
- /* harmony export */ workAsyncStorage: () => (/* binding */ workAsyncStorage),
663
- /* harmony export */ workUnitAsyncStorage: () => (/* binding */ workUnitAsyncStorage)
657
+ /* harmony export */ u_: () => (/* binding */ DEFAULT_HOT_TURN_LIMIT)
664
658
  /* harmony export */ });
665
- /* harmony import */ var next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(319225);
666
- /* 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__);
667
- /* harmony import */ var next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(684006);
668
- /* harmony import */ var next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8317);
669
- /* 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__);
670
- /* harmony import */ var next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(799373);
671
- /* 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__);
672
- /* harmony import */ var next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(434775);
673
- /* 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__);
674
- /* harmony import */ var next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(524235);
675
- /* 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__);
676
- /* harmony import */ var next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(200261);
677
- /* 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__);
678
- /* harmony import */ var next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(754365);
679
- /* 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__);
680
- /* harmony import */ var next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(590771);
681
- /* 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__);
682
- /* harmony import */ var next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(473461);
683
- /* 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__);
684
- /* harmony import */ var next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(767798);
685
- /* harmony import */ var next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(192280);
686
- /* harmony import */ var next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(662018);
687
- /* 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__);
688
- /* harmony import */ var next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(445696);
689
- /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(347929);
690
- /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__);
691
- /* harmony import */ var next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(986439);
692
- /* 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__);
693
- /* harmony import */ var next_dist_server_lib_route_cache_key__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(710246);
694
- /* 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__);
695
- /* harmony import */ var next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(137527);
696
- /* 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__);
659
+ /* harmony import */ var _lib_agents_harness_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(489793);
660
+ const DEFAULT_HOT_TURN_LIMIT = 12;
697
661
 
698
662
 
699
663
 
664
+ /***/ }),
700
665
 
666
+ /***/ 529294:
667
+ /***/ ((module) => {
701
668
 
669
+ module.exports = require("next/dist/server/app-render/work-async-storage.external.js");
702
670
 
671
+ /***/ }),
703
672
 
673
+ /***/ 590347:
674
+ /***/ ((module) => {
704
675
 
676
+ module.exports = import("@langchain/mcp-adapters");;
705
677
 
678
+ /***/ }),
706
679
 
680
+ /***/ 594735:
681
+ /***/ ((module) => {
707
682
 
683
+ module.exports = require("events");
708
684
 
685
+ /***/ }),
709
686
 
687
+ /***/ 629021:
688
+ /***/ ((module) => {
710
689
 
690
+ module.exports = require("fs");
711
691
 
692
+ /***/ }),
712
693
 
694
+ /***/ 638522:
695
+ /***/ ((module) => {
713
696
 
697
+ module.exports = require("node:zlib");
714
698
 
715
- // We inject the nextConfigOutput here so that we can use them in the route
716
- // module.
717
- const nextConfigOutput = "standalone"
718
- const routeModule = new next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__.AppRouteRouteModule({
719
- definition: {
720
- kind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
721
- page: "/api/v1/mcp-servers/[name]/route",
722
- pathname: "/api/v1/mcp-servers/[name]",
723
- filename: "route",
724
- bundlePath: "app/api/v1/mcp-servers/[name]/route"
725
- },
726
- distDir: ".next" || 0,
727
- relativeProjectDir: false || '',
728
- resolvedPagePath: "/home/runner/work/jarela/jarela/app/api/v1/mcp-servers/[name]/route.ts",
729
- nextConfigOutput,
730
- // The lazy require factory ensures that:
731
- // - In dev: devRequestTimingInternalsEnd is set before userland executes,
732
- // correctly attributing module load time to application-code rather than
733
- // framework internals.
734
- // - In all modes: async modules (route files with top-level await) are
735
- // handled correctly — require() returns a Promise for such modules, which
736
- // ensureUserland() awaits before the first request is handled.
737
- userland: ()=>__webpack_require__(754172),
738
- // In Turbopack dev mode, also provide a synchronous per-request getter so
739
- // server HMR updates are picked up without re-executing the entry chunk.
740
- // Using require() (synchronous) avoids adding async overhead that would be
741
- // incorrectly attributed to application-code time in devRequestTiming.
742
- ... false ? 0 : {}
743
- });
744
- // Pull out the exports that we need to expose from the module. This should
745
- // be eliminated when we've moved the other routes to the new format. These
746
- // are used to hook into the route.
747
- const { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;
748
- function patchFetch() {
749
- return (0,next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__.patchFetch)({
750
- workAsyncStorage,
751
- workUnitAsyncStorage
752
- });
753
- }
699
+ /***/ }),
754
700
 
755
- async function handler(req, res, ctx) {
756
- if (ctx.requestMeta) {
757
- (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.setRequestMeta)(req, ctx.requestMeta);
758
- }
759
- if (routeModule.isDev) {
760
- (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.addRequestMeta)(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());
761
- }
762
- let srcPage = "/api/v1/mcp-servers/[name]/route";
763
- // turbopack doesn't normalize `/index` in the page name
764
- // so we need to to process dynamic routes properly
765
- // TODO: fix turbopack providing differing value from webpack
766
- if (false) {} else if (srcPage === '/index') {
767
- // we always normalize /index specifically
768
- srcPage = '/';
769
- }
770
- const multiZoneDraftMode = false;
771
- // Registering `instrumentation.ts` usually installs the tracer provider, so
772
- // do it before starting the request span. The span is started before
773
- // `prepare`, so route module preparation is part of the request's trace.
774
- // When this request triggers registration, the lifecycle spans of
775
- // `instrumentation.ts` are emitted inside the request span.
776
- const { instrumentation } = await routeModule.ensureInstrumentation(req, {
777
- deferSpans: true
778
- });
779
- return routeModule.traceRequest(req, {
780
- tracer: (0,next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.getTracer)(),
781
- spanName: `${req.method || 'GET'} ${srcPage}`,
782
- httpTarget: req.url,
783
- instrumentation
784
- }, (requestSpan, requestRootSpan)=>handleRequest(req, res, ctx, srcPage, multiZoneDraftMode, requestSpan, requestRootSpan));
701
+ /***/ 663033:
702
+ /***/ ((module) => {
703
+
704
+ module.exports = require("next/dist/server/app-render/work-unit-async-storage.external.js");
705
+
706
+ /***/ }),
707
+
708
+ /***/ 685678:
709
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
710
+
711
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
712
+ /* harmony export */ G4: () => (/* binding */ resolveContextWindowTokens),
713
+ /* harmony export */ S6: () => (/* binding */ agentToResponse),
714
+ /* harmony export */ aX: () => (/* binding */ bridgeToResponse),
715
+ /* harmony export */ mX: () => (/* binding */ messageToResponse),
716
+ /* harmony export */ sU: () => (/* binding */ mcpServerToResponse)
717
+ /* harmony export */ });
718
+ /* unused harmony exports messageUsageToResponse, parseToolEventsForResponse, parseMessageMetadataForResponse */
719
+ /* harmony import */ var _api_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(524318);
720
+ /* harmony import */ var _lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(41720);
721
+ /* harmony import */ var _lib_utils_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(253638);
722
+ // Row → JSON-response serializers shared between list (`route.ts`) and
723
+ // item (`[id]/route.ts`) handlers. Keeping these in one place stops the
724
+ // list and item shapes from drifting (they were copy-pasted before).
725
+
726
+
727
+
728
+ function agentToResponse(a) {
729
+ return {
730
+ id: a.id,
731
+ usage_profile: a.usage_profile ?? "custom",
732
+ name: a.name,
733
+ icon: a.icon,
734
+ identity: a.identity,
735
+ instructions: a.instructions,
736
+ tools: (0,_lib_utils_json__WEBPACK_IMPORTED_MODULE_2__/* .parseJsonSafe */ .p)(a.tools, []),
737
+ model_config_name: a.model_config_name,
738
+ is_default: !!a.is_default,
739
+ history_limit: a.history_limit,
740
+ history_window_hours: a.history_window_hours,
741
+ hot_turn_limit: a.hot_turn_limit ?? _api_types__WEBPACK_IMPORTED_MODULE_0__/* .DEFAULT_HOT_TURN_LIMIT */ .u_,
742
+ warm_summary_limit: a.warm_summary_limit,
743
+ never_reply: !!a.never_reply,
744
+ adaptive_persona_enabled: !!a.adaptive_persona_enabled,
745
+ adaptive_persona_strength: a.adaptive_persona_strength,
746
+ adaptive_empathy: a.adaptive_empathy,
747
+ adaptive_expressiveness: a.adaptive_expressiveness,
748
+ adaptive_verbosity: a.adaptive_verbosity,
749
+ adaptive_mbti: a.adaptive_mbti,
750
+ voice_enabled: !!a.voice_enabled,
751
+ voice_model: a.voice_model,
752
+ voice_name: a.voice_name,
753
+ voice_stt_model: a.voice_stt_model,
754
+ voice_auto_speak: !!a.voice_auto_speak,
755
+ harness_id: a.harness_id,
756
+ delegate_targets: (0,_lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_1__/* .parseDelegateTargets */ .bg)(a.delegate_targets),
757
+ context_tier_proportions: (0,_lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_1__/* .getAgentTierProportions */ .fg)(a),
758
+ anti_hallucination_mode: a.anti_hallucination_mode === "off" || a.anti_hallucination_mode === "regex" || a.anti_hallucination_mode === "model" ? a.anti_hallucination_mode : null,
759
+ anti_hallucination_model_config: a.anti_hallucination_model_config,
760
+ citation_strictness: (0,_lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_1__/* .parseCitationStrictness */ .P2)(a.citation_strictness) ?? "off",
761
+ tool_credentials: (0,_lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_1__/* .getAgentToolCredentials */ .S2)(a),
762
+ router_policy: a.router_policy === "cheap" || a.router_policy === "fast" || a.router_policy === "balanced" || a.router_policy === "quality" ? a.router_policy : null,
763
+ router_enabled: a.router_enabled === 1 ? true : a.router_enabled === 0 ? false : null,
764
+ usage_strategy: a.usage_strategy === "cost_saving" || a.usage_strategy === "balanced" || a.usage_strategy === "high_reasoning" ? a.usage_strategy : null,
765
+ created_at: a.created_at,
766
+ updated_at: a.updated_at
767
+ };
785
768
  }
786
- async function handleRequest(req, res, ctx, srcPage, multiZoneDraftMode, requestSpan, requestRootSpan) {
787
- const prepareResult = await routeModule.prepare(req, res, {
788
- srcPage,
789
- multiZoneDraftMode
790
- });
791
- if (!prepareResult) {
792
- res.statusCode = 400;
793
- res.end('Bad Request');
794
- ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());
795
- return null;
796
- }
797
- const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest, previewProps } = prepareResult;
798
- const normalizedSrcPage = (0,next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__.normalizeAppPath)(srcPage);
799
- // Only this route's prerenders can establish ISR or admit generated params.
800
- 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]));
801
- let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || isPrerendered);
802
- const render404 = async ()=>{
803
- // TODO: should route-module itself handle rendering the 404
804
- if (routerServerContext == null ? void 0 : routerServerContext.render404) {
805
- await routerServerContext.render404(req, res, parsedUrl, false);
806
- } else {
807
- res.end('This page could not be found');
808
- }
809
- return null;
769
+ function bridgeToResponse(r) {
770
+ return {
771
+ id: r.id,
772
+ kind: r.kind,
773
+ name: r.name,
774
+ status: r.status,
775
+ last_error: r.last_error,
776
+ paired_id: r.paired_id,
777
+ enabled: r.enabled === 1,
778
+ event_subscriptions: {
779
+ group_profile_updates: r.forward_group_profile_updates === 1,
780
+ group_participants_updates: r.forward_group_participants_updates === 1
781
+ },
782
+ created_at: r.created_at,
783
+ updated_at: r.updated_at
810
784
  };
811
- if (isIsr && !isDraftMode) {
812
- const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];
813
- if (prerenderInfo) {
814
- if (prerenderInfo.fallback === false && !isPrerendered) {
815
- if (nextConfig.adapterPath) {
816
- return await render404();
817
- }
818
- throw new next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError();
819
- }
820
- }
821
- }
822
- let cacheKey = null;
823
- if (isIsr && !routeModule.isDev && !isDraftMode) {
824
- cacheKey = resolvedPathname;
825
- // ensure /index and / is normalized to one key
826
- cacheKey = cacheKey === '/index' ? '/' : cacheKey;
827
- }
828
- // Before rendering (which initializes component tree modules), we have to
829
- // set the reference manifests to our global store so Server Action's
830
- // encryption util can access to them at the top level of the page module.
831
- if (serverActionsManifest && clientReferenceManifest) {
832
- (0,next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__.setManifestsSingleton)({
833
- page: srcPage,
834
- clientReferenceManifest,
835
- serverActionsManifest
836
- });
837
- }
838
- const method = req.method || 'GET';
839
- const tracer = (0,next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.getTracer)();
840
- const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);
841
- const isMinimalMode = Boolean((0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'minimalMode'));
842
- const incrementalCache = (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, previewProps, prerenderManifest, isMinimalMode);
843
- incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();
844
- globalThis.__incrementalCache = incrementalCache;
845
- const context = {
846
- params,
847
- previewProps,
848
- renderOpts: {
849
- experimental: {
850
- authInterrupts: Boolean(nextConfig.experimental.authInterrupts),
851
- useCacheTimeout: nextConfig.experimental.useCacheTimeout,
852
- durableUseCacheEntries: Boolean(nextConfig.experimental.durableUseCacheEntries)
853
- },
854
- cacheComponents: Boolean(nextConfig.cacheComponents),
855
- validationLevel: nextConfig.experimental.instantInsights.validationLevel,
856
- isDraftMode,
857
- incrementalCache,
858
- hmrRefreshHash: (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'hmrRefreshHash'),
859
- cacheLifeProfiles: nextConfig.cacheLife,
860
- staticPageGenerationTimeout: nextConfig.staticPageGenerationTimeout,
861
- waitUntil: ctx.waitUntil,
862
- onClose: (cb)=>{
863
- res.on('close', cb);
864
- },
865
- onAfterTaskError: undefined
866
- },
867
- sharedContext: {
868
- buildId,
869
- deploymentId
870
- }
871
- };
872
- const nodeNextReq = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextRequest(req);
873
- const nodeNextRes = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextResponse(res);
874
- 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));
875
- const responseGenerator = async ({ previousCacheEntry })=>{
876
- try {
877
- if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {
878
- res.statusCode = 404;
879
- // on-demand revalidate always sets this header
880
- res.setHeader('x-nextjs-cache', 'REVALIDATED');
881
- res.end('This page could not be found');
882
- return null;
883
- }
884
- const response = cacheKey === null ? await routeModule.handle(nextReq, context) : await routeModule.prerender(nextReq, context);
885
- req.fetchMetrics = context.renderOpts.fetchMetrics;
886
- let pendingWaitUntil = context.renderOpts.pendingWaitUntil;
887
- // Attempt using provided waitUntil if available
888
- // if it's not we fallback to sendResponse's handling
889
- if (pendingWaitUntil) {
890
- if (ctx.waitUntil) {
891
- ctx.waitUntil(pendingWaitUntil);
892
- pendingWaitUntil = undefined;
893
- }
894
- }
895
- const cacheTags = context.renderOpts.collectedTags;
896
- // If the request is for a static response, we can cache it so long
897
- // as it's not edge.
898
- if (isIsr) {
899
- const blob = await response.blob();
900
- // Copy the headers from the response.
901
- const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.toNodeOutgoingHttpHeaders)(response.headers);
902
- if (cacheTags) {
903
- headers[next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER] = cacheTags;
904
- }
905
- if (!headers['content-type'] && blob.type) {
906
- headers['content-type'] = blob.type;
907
- }
908
- const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;
909
- 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
910
- // explicit `expire` (e.g. via `cacheLife`). This mirrors the
911
- // build-time fallback in `build/index.ts` so cache entries
912
- // and the response Cache-Control header agree on the route's
913
- // effective expire. Routes that opt out of revalidation
914
- // (`revalidate: false`) or that are dynamic (`revalidate: 0`)
915
- // keep `expire: undefined`.
916
- revalidate !== false && revalidate > 0 ? nextConfig.expireTime : undefined : context.renderOpts.collectedExpire;
917
- // Create the cache entry for the response.
918
- const cacheEntry = {
919
- value: {
920
- kind: next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__.CachedRouteKind.APP_ROUTE,
921
- status: response.status,
922
- body: Buffer.from(await blob.arrayBuffer()),
923
- headers
924
- },
925
- cacheControl: {
926
- revalidate,
927
- expire
928
- }
929
- };
930
- return cacheEntry;
931
- } else {
932
- // send response without caching if not ISR
933
- await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, response, pendingWaitUntil);
934
- return null;
935
- }
936
- } catch (err) {
937
- // if this is a background revalidate we need to report
938
- // the request error here as it won't be bubbled
939
- if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {
940
- const silenceLog = false;
941
- await routeModule.onRequestError(req, err, {
942
- routerKind: 'App Router',
943
- routePath: srcPage,
944
- routeType: 'route',
945
- revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
946
- isStaticGeneration: cacheKey !== null,
947
- isOnDemandRevalidate
948
- })
949
- }, silenceLog, routerServerContext);
950
- }
951
- throw err;
952
- }
953
- };
954
- const handleResponse = async (currentSpan)=>{
955
- try {
956
- var _cacheEntry_value;
957
- const cacheEntry = await routeModule.handleResponse({
958
- req,
959
- nextConfig,
960
- cacheKey,
961
- routeKind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
962
- isFallback: false,
963
- previewProps,
964
- prerenderManifest,
965
- isRoutePPREnabled: false,
966
- isOnDemandRevalidate,
967
- revalidateOnlyGenerated,
968
- responseGenerator,
969
- waitUntil: ctx.waitUntil,
970
- isMinimalMode
971
- });
972
- if (cacheEntry !== null && 'error' in cacheEntry) {
973
- throw cacheEntry.error;
974
- }
975
- // we don't create a cacheEntry for ISR
976
- if (!isIsr) {
977
- return;
978
- }
979
- 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) {
980
- var _cacheEntry_value1;
981
- throw new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`);
982
- }
983
- if (!isMinimalMode) {
984
- res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');
985
- }
986
- // Draft mode should never be cached
987
- if (isDraftMode) {
988
- res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');
989
- }
990
- const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers);
991
- if (!(isMinimalMode && isIsr)) {
992
- headers.delete(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER);
993
- }
994
- // If cache control is already set on the response we don't
995
- // override it to allow users to customize it via next.config
996
- if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {
997
- headers.set('Cache-Control', (0,next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__.getCacheControlHeader)(cacheEntry.cacheControl));
998
- }
999
- 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'.
1000
- new Response(cacheEntry.value.body, {
1001
- headers,
1002
- status: cacheEntry.value.status || 200
1003
- }));
1004
- return;
1005
- } catch (err) {
1006
- if (!(err instanceof next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError)) {
1007
- const silenceLog = false;
1008
- await routeModule.onRequestError(req, err, {
1009
- routerKind: 'App Router',
1010
- routePath: normalizedSrcPage,
1011
- routeType: 'route',
1012
- revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
1013
- isStaticGeneration: cacheKey !== null,
1014
- isOnDemandRevalidate
1015
- })
1016
- }, silenceLog, routerServerContext);
1017
- }
1018
- // rethrow so that we can handle serving error page
1019
- // If this is during static generation, throw the error again.
1020
- if (isIsr) throw err;
1021
- // Otherwise, send a 500 response unless the original response has
1022
- // already committed. In that case, preserve its status code for
1023
- // telemetry while still recording the failure and terminating a response
1024
- // that the failed pipeline left open.
1025
- if (res.headersSent) {
1026
- if (currentSpan) {
1027
- const error = err instanceof Error ? err : new Error('Unknown app route error');
1028
- currentSpan.recordException(error);
1029
- currentSpan.setStatus({
1030
- code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR,
1031
- message: error.message
1032
- });
1033
- currentSpan.setAttribute('error.type', error.name);
1034
- }
1035
- if (!res.writableEnded && !res.destroyed) {
1036
- res.end();
1037
- }
1038
- } else {
1039
- await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, new Response(null, {
1040
- status: 500
1041
- }));
1042
- }
1043
- return;
1044
- } finally{
1045
- ;
1046
- (()=>{
1047
- if (!currentSpan) {
1048
- return;
1049
- }
1050
- let statusCode = res.statusCode;
1051
- currentSpan.setAttributes({
1052
- 'http.status_code': statusCode,
1053
- 'next.rsc': false
1054
- });
1055
- if (statusCode && statusCode >= 500) {
1056
- // For 5xx status codes: SHOULD be set to 'Error' span status.
1057
- // x-ref: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
1058
- currentSpan.setStatus({
1059
- code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR
1060
- });
1061
- // For span status 'Error', SHOULD set 'error.type' attribute.
1062
- currentSpan.setAttribute('error.type', statusCode.toString());
1063
- }
1064
- const rootSpanAttributes = tracer.getRootSpanAttributes();
1065
- // We were unable to get attributes, probably OTEL is not enabled
1066
- if (!rootSpanAttributes) {
1067
- return;
1068
- }
1069
- if (rootSpanAttributes.get('next.span_type') !== next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest) {
1070
- console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);
1071
- return;
1072
- }
1073
- const route = rootSpanAttributes.get('next.route') || normalizedSrcPage;
1074
- const name = `${method} ${route}`;
1075
- currentSpan.setAttributes({
1076
- 'next.route': route,
1077
- 'http.route': route,
1078
- 'next.span_name': name
1079
- });
1080
- currentSpan.updateName(name);
1081
- // Propagate http.route to the request's root span if it isn't the
1082
- // request span (e.g. a platform-created HTTP span in adapter
1083
- // deployments).
1084
- if (requestRootSpan && requestRootSpan !== currentSpan) {
1085
- requestRootSpan.setAttribute('http.route', route);
1086
- requestRootSpan.updateName(name);
1087
- }
1088
- })();
1089
- }
785
+ }
786
+ function mcpServerToResponse(r) {
787
+ return {
788
+ name: r.name,
789
+ transport: r.transport,
790
+ spec: (0,_lib_utils_json__WEBPACK_IMPORTED_MODULE_2__/* .parseJsonSafe */ .p)(r.spec, null),
791
+ enabled: r.enabled === 1,
792
+ last_error: r.last_error,
793
+ created_at: r.created_at,
794
+ updated_at: r.updated_at
1090
795
  };
1091
- // When invoked directly, the request span was started before `prepare`;
1092
- // record the request target as normalized by it. next-server's request span
1093
- // already has it.
1094
- if (!isWrappedByNextServer && req.url !== undefined) {
1095
- requestSpan == null ? void 0 : requestSpan.setAttribute('http.target', req.url);
796
+ }
797
+ /**
798
+ * Shape a `message_usage` row into the over-the-wire `usage` object the
799
+ * chat panel's `ContextUsageBar` consumes. Returns `null` for messages
800
+ * that have no snapshot (user turns and legacy assistant rows recorded
801
+ * before the per-turn snapshot landed in ADR-0041).
802
+ *
803
+ * Anthropic prompt-cache tokens (PR #181 + the cache-fidelity follow-up)
804
+ * are surfaced as additive fields so future UI work can render a
805
+ * "served from cache" badge without another wire change. Both are
806
+ * `null` for rows that predate cache plumbing or for providers that
807
+ * don't expose a cache breakdown.
808
+ */ function messageUsageToResponse(u) {
809
+ if (!u) return null;
810
+ return {
811
+ input_tokens: u.input_tokens,
812
+ output_tokens: u.output_tokens,
813
+ hot_tokens: u.hot_tokens,
814
+ warm_tokens: u.warm_tokens,
815
+ facts_tokens: u.facts_tokens,
816
+ overhead_tokens: u.overhead_tokens,
817
+ hot_budget_tokens: u.hot_budget_tokens,
818
+ warm_budget_tokens: u.warm_budget_tokens,
819
+ facts_budget_tokens: u.facts_budget_tokens,
820
+ context_window_tokens: u.context_window_tokens,
821
+ cache_creation_input_tokens: u.cache_creation_input_tokens,
822
+ cache_read_input_tokens: u.cache_read_input_tokens,
823
+ thinking_tokens: u.thinking_tokens ?? null,
824
+ cost_usd: u.cost_usd ?? null
825
+ };
826
+ }
827
+ /**
828
+ * Shape one message row into its over-the-wire form, attaching its
829
+ * per-turn `usage` snapshot when one exists. Pure data-shaping helper
830
+ * extracted from the threads GET route so the wire contract has unit
831
+ * coverage.
832
+ */ function messageToResponse(m, usageById) {
833
+ return {
834
+ id: m.msg_id,
835
+ seq: m.seq,
836
+ role: m.role,
837
+ content: m.content,
838
+ created_at: m.created_at,
839
+ transcript_status: m.transcript_status,
840
+ status_reason: m.status_reason,
841
+ tool_events: parseToolEventsForResponse(m.tool_events),
842
+ category: m.category ?? null,
843
+ usage: messageUsageToResponse(usageById.get(m.msg_id)),
844
+ metadata: parseMessageMetadataForResponse(m.metadata)
845
+ };
846
+ }
847
+ /** Tolerant `tool_events` JSON parser shared with the route. Bad JSON
848
+ * and non-array payloads collapse to `undefined` so the wire shape
849
+ * always matches the typed client expectation. */ function parseToolEventsForResponse(raw) {
850
+ if (!raw) return undefined;
851
+ try {
852
+ const parsed = JSON.parse(raw);
853
+ return Array.isArray(parsed) ? parsed : undefined;
854
+ } catch {
855
+ return undefined;
1096
856
  }
1097
- await handleResponse(requestSpan);
857
+ }
858
+ /** Tolerant `metadata` JSON parser. Returns `null` for missing/blank/
859
+ * malformed/non-object payloads so the wire shape stays a plain object
860
+ * or null — readers can rely on `metadata?.citations?...` chaining. */ function parseMessageMetadataForResponse(raw) {
861
+ if (!raw) return null;
862
+ try {
863
+ const parsed = JSON.parse(raw);
864
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
865
+ return parsed;
866
+ } catch {
867
+ return null;
868
+ }
869
+ }
870
+ /**
871
+ * Resolve the bar's 100% baseline. Per-row `context_window_tokens`
872
+ * (snapshotted at run time) wins so the bar matches the cap the agent
873
+ * actually applied; legacy rows fall back to the model-config value;
874
+ * unconfigured agents fall back to the default. Centralised so the
875
+ * route and the UI share the same precedence rule.
876
+ */ function resolveContextWindowTokens(modelConfiguredTokens, defaultTokens) {
877
+ if (typeof modelConfiguredTokens === "number" && modelConfiguredTokens > 0) {
878
+ return modelConfiguredTokens;
879
+ }
880
+ return defaultTokens;
1098
881
  }
1099
882
 
1100
- //# sourceMappingURL=app-route.js.map
1101
883
 
884
+ /***/ }),
885
+
886
+ /***/ 710846:
887
+ /***/ ((module) => {
888
+
889
+ module.exports = require("next/dist/compiled/next-server/app-page.runtime.prod.js");
1102
890
 
1103
891
  /***/ }),
1104
892
 
1105
- /***/ 524318:
893
+ /***/ 731421:
894
+ /***/ ((module) => {
895
+
896
+ module.exports = require("node:child_process");
897
+
898
+ /***/ }),
899
+
900
+ /***/ 739947:
1106
901
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1107
902
 
1108
903
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1109
- /* harmony export */ u_: () => (/* binding */ DEFAULT_HOT_TURN_LIMIT)
904
+ /* harmony export */ Bm: () => (/* binding */ cachedJson),
905
+ /* harmony export */ HN: () => (/* binding */ notFoundResponse),
906
+ /* harmony export */ Jb: () => (/* binding */ validateBody),
907
+ /* harmony export */ K2: () => (/* binding */ createdResponse),
908
+ /* harmony export */ Ng: () => (/* binding */ noStoreJson),
909
+ /* harmony export */ yj: () => (/* binding */ errorResponse)
1110
910
  /* harmony export */ });
1111
- /* harmony import */ var _lib_agents_harness_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(489793);
1112
- const DEFAULT_HOT_TURN_LIMIT = 12;
911
+ /* harmony import */ var next_server__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(945592);
912
+ // Shared HTTP response builders for app/api/v1/** route handlers.
913
+ //
914
+ // Goal: every error/success payload across the v1 surface has the same
915
+ // shape. Before this lived inline, response bodies drifted —
916
+ // `{error: "x"}` vs `{message: "x"}`, 400 vs 422 for the same condition,
917
+ // some routes returned Zod's raw issue array, others stringified it.
1113
918
 
919
+ function errorResponse(message, status = 400) {
920
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json({
921
+ error: message
922
+ }, {
923
+ status
924
+ });
925
+ }
926
+ function notFoundResponse(message = "Not found") {
927
+ return errorResponse(message, 404);
928
+ }
929
+ function createdResponse(data) {
930
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
931
+ status: 201
932
+ });
933
+ }
934
+ // Wrap a 200 JSON response with a private Cache-Control header. Use on safe
935
+ // GET endpoints that serve user-scoped data the client refetches often (panel
936
+ // mounts, navigation back/forward) but mutates rarely. The TTL is short
937
+ // enough that explicit mutations — which patch the client-side ApiClient
938
+ // cache in place — stay observably consistent without an extra roundtrip.
939
+ //
940
+ // swrSeconds (optional): stale-while-revalidate window. When set, the browser
941
+ // serves the cached response immediately and refreshes in the background,
942
+ // making navigation feel instant. Use for data that can tolerate brief
943
+ // staleness (tool list, agent configs, model list). Omit for real-time data
944
+ // (dashboard metrics, credential state).
945
+ function cachedJson(data, maxAgeSeconds, swrSeconds) {
946
+ const swr = swrSeconds ? `, stale-while-revalidate=${swrSeconds}` : "";
947
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
948
+ headers: {
949
+ "Cache-Control": `private, max-age=${maxAgeSeconds}${swr}`
950
+ }
951
+ });
952
+ }
953
+ // Use for endpoints whose response contains live state that must never be
954
+ // served from cache — credentials, connection status, live config values.
955
+ function noStoreJson(data) {
956
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
957
+ headers: {
958
+ "Cache-Control": "no-store"
959
+ }
960
+ });
961
+ }
962
+ // Validate a JSON request body against a zod schema.
963
+ // Returns either the parsed data or a 400 NextResponse explaining the issue.
964
+ // Caller pattern:
965
+ // const parsed = await validateBody(req, Schema);
966
+ // if (parsed instanceof NextResponse) return parsed;
967
+ // // use parsed.field
968
+ async function validateBody(req, schema) {
969
+ let raw;
970
+ try {
971
+ raw = await req.json();
972
+ } catch {
973
+ return errorResponse("Request body must be valid JSON", 400);
974
+ }
975
+ const parsed = schema.safeParse(raw);
976
+ if (!parsed.success) {
977
+ return errorResponse(parsed.error.issues[0]?.message ?? "invalid body", 400);
978
+ }
979
+ return parsed.data;
980
+ }
1114
981
 
1115
982
 
1116
983
  /***/ }),
1117
984
 
1118
- /***/ 529294:
985
+ /***/ 744870:
1119
986
  /***/ ((module) => {
1120
987
 
1121
- module.exports = require("next/dist/server/app-render/work-async-storage.external.js");
988
+ module.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js");
1122
989
 
1123
990
  /***/ }),
1124
991
 
1125
- /***/ 590347:
1126
- /***/ ((module) => {
992
+ /***/ 754172:
993
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1127
994
 
1128
- module.exports = import("@langchain/mcp-adapters");;
995
+ __webpack_require__.r(__webpack_exports__);
996
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
997
+ /* harmony export */ DELETE: () => (/* binding */ DELETE),
998
+ /* harmony export */ GET: () => (/* binding */ GET),
999
+ /* harmony export */ PUT: () => (/* binding */ PUT)
1000
+ /* harmony export */ });
1001
+ /* harmony import */ var next_server__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(945592);
1002
+ /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(497377);
1003
+ /* harmony import */ var _lib_stores_mcp_servers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(42666);
1004
+ /* harmony import */ var _lib_mcp_client__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(777955);
1005
+ /* harmony import */ var _lib_api_serializers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(685678);
1006
+ /* harmony import */ var _lib_api_responses__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(739947);
1007
+ /* harmony import */ var _lib_utils_json__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(253638);
1129
1008
 
1130
- /***/ }),
1131
1009
 
1132
- /***/ 594735:
1133
- /***/ ((module) => {
1134
1010
 
1135
- module.exports = require("events");
1136
1011
 
1137
- /***/ }),
1138
1012
 
1139
- /***/ 629021:
1140
- /***/ ((module) => {
1141
1013
 
1142
- module.exports = require("fs");
1014
+
1015
+ const PutBody = zod__WEBPACK_IMPORTED_MODULE_5__/* .object */ .Ikc({
1016
+ transport: zod__WEBPACK_IMPORTED_MODULE_5__/* ["enum"] */ .k5n([
1017
+ "stdio",
1018
+ "http"
1019
+ ]).optional(),
1020
+ spec: zod__WEBPACK_IMPORTED_MODULE_5__/* .record */ .g1P(zod__WEBPACK_IMPORTED_MODULE_5__/* .string */ .YjP(), zod__WEBPACK_IMPORTED_MODULE_5__/* .unknown */ .L5J()).optional(),
1021
+ enabled: zod__WEBPACK_IMPORTED_MODULE_5__/* .boolean */ .zMY().optional()
1022
+ });
1023
+ async function GET(_req, { params }) {
1024
+ const { name } = await params;
1025
+ const r = (0,_lib_stores_mcp_servers__WEBPACK_IMPORTED_MODULE_1__/* .getMcpServer */ .cw)(name);
1026
+ if (!r) return (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_4__/* .notFoundResponse */ .HN)("MCP server not found");
1027
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json((0,_lib_api_serializers__WEBPACK_IMPORTED_MODULE_3__/* .mcpServerToResponse */ .sU)(r));
1028
+ }
1029
+ async function PUT(req, { params }) {
1030
+ const { name } = await params;
1031
+ const existing = (0,_lib_stores_mcp_servers__WEBPACK_IMPORTED_MODULE_1__/* .getMcpServer */ .cw)(name);
1032
+ if (!existing) return (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_4__/* .notFoundResponse */ .HN)("MCP server not found");
1033
+ const body = await (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_4__/* .validateBody */ .Jb)(req, PutBody);
1034
+ if (body instanceof next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse) return body;
1035
+ const row = (0,_lib_stores_mcp_servers__WEBPACK_IMPORTED_MODULE_1__/* .upsertMcpServer */ .te)({
1036
+ name,
1037
+ transport: body.transport ?? existing.transport,
1038
+ spec: body.spec ?? (0,_lib_utils_json__WEBPACK_IMPORTED_MODULE_6__/* .parseJsonSafe */ .p)(existing.spec, {}),
1039
+ enabled: body.enabled ?? existing.enabled === 1
1040
+ });
1041
+ (0,_lib_mcp_client__WEBPACK_IMPORTED_MODULE_2__/* .invalidateMcpTools */ .H_)();
1042
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json((0,_lib_api_serializers__WEBPACK_IMPORTED_MODULE_3__/* .mcpServerToResponse */ .sU)(row));
1043
+ }
1044
+ async function DELETE(_req, { params }) {
1045
+ const { name } = await params;
1046
+ const ok = (0,_lib_stores_mcp_servers__WEBPACK_IMPORTED_MODULE_1__/* .deleteMcpServer */ .le)(name);
1047
+ if (!ok) return (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_4__/* .notFoundResponse */ .HN)("MCP server not found");
1048
+ (0,_lib_mcp_client__WEBPACK_IMPORTED_MODULE_2__/* .invalidateMcpTools */ .H_)();
1049
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json({
1050
+ deleted: true
1051
+ });
1052
+ }
1053
+
1143
1054
 
1144
1055
  /***/ }),
1145
1056
 
1146
- /***/ 638522:
1057
+ /***/ 775919:
1147
1058
  /***/ ((module) => {
1148
1059
 
1149
- module.exports = require("node:zlib");
1060
+ module.exports = require("node:worker_threads");
1150
1061
 
1151
1062
  /***/ }),
1152
1063
 
1153
- /***/ 663033:
1064
+ /***/ 777030:
1154
1065
  /***/ ((module) => {
1155
1066
 
1156
- module.exports = require("next/dist/server/app-render/work-unit-async-storage.external.js");
1067
+ module.exports = require("node:net");
1157
1068
 
1158
1069
  /***/ }),
1159
1070
 
1160
- /***/ 685678:
1071
+ /***/ 777955:
1161
1072
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1162
1073
 
1163
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1164
- /* harmony export */ G4: () => (/* binding */ resolveContextWindowTokens),
1165
- /* harmony export */ S6: () => (/* binding */ agentToResponse),
1166
- /* harmony export */ aX: () => (/* binding */ bridgeToResponse),
1167
- /* harmony export */ mX: () => (/* binding */ messageToResponse),
1168
- /* harmony export */ sU: () => (/* binding */ mcpServerToResponse)
1169
- /* harmony export */ });
1170
- /* unused harmony exports messageUsageToResponse, parseToolEventsForResponse, parseMessageMetadataForResponse */
1171
- /* harmony import */ var _api_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(524318);
1172
- /* harmony import */ var _lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(41720);
1173
- /* harmony import */ var _lib_utils_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(253638);
1174
- // Row → JSON-response serializers shared between list (`route.ts`) and
1175
- // item (`[id]/route.ts`) handlers. Keeping these in one place stops the
1176
- // list and item shapes from drifting (they were copy-pasted before).
1177
1074
 
1075
+ // EXPORTS
1076
+ __webpack_require__.d(__webpack_exports__, {
1077
+ k2: () => (/* binding */ getMcpToolMeta),
1078
+ a2: () => (/* binding */ getMcpTools),
1079
+ H_: () => (/* binding */ invalidateMcpTools)
1080
+ });
1178
1081
 
1082
+ // UNUSED EXPORTS: buildSubprocessEnv
1179
1083
 
1180
- function agentToResponse(a) {
1181
- return {
1182
- id: a.id,
1183
- usage_profile: a.usage_profile ?? "custom",
1184
- name: a.name,
1185
- icon: a.icon,
1186
- identity: a.identity,
1187
- instructions: a.instructions,
1188
- tools: (0,_lib_utils_json__WEBPACK_IMPORTED_MODULE_2__/* .parseJsonSafe */ .p)(a.tools, []),
1189
- model_config_name: a.model_config_name,
1190
- is_default: !!a.is_default,
1191
- history_limit: a.history_limit,
1192
- history_window_hours: a.history_window_hours,
1193
- hot_turn_limit: a.hot_turn_limit ?? _api_types__WEBPACK_IMPORTED_MODULE_0__/* .DEFAULT_HOT_TURN_LIMIT */ .u_,
1194
- warm_summary_limit: a.warm_summary_limit,
1195
- never_reply: !!a.never_reply,
1196
- adaptive_persona_enabled: !!a.adaptive_persona_enabled,
1197
- adaptive_persona_strength: a.adaptive_persona_strength,
1198
- adaptive_empathy: a.adaptive_empathy,
1199
- adaptive_expressiveness: a.adaptive_expressiveness,
1200
- adaptive_verbosity: a.adaptive_verbosity,
1201
- adaptive_mbti: a.adaptive_mbti,
1202
- voice_enabled: !!a.voice_enabled,
1203
- voice_model: a.voice_model,
1204
- voice_name: a.voice_name,
1205
- voice_stt_model: a.voice_stt_model,
1206
- voice_auto_speak: !!a.voice_auto_speak,
1207
- harness_id: a.harness_id,
1208
- delegate_targets: (0,_lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_1__/* .parseDelegateTargets */ .bg)(a.delegate_targets),
1209
- context_tier_proportions: (0,_lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_1__/* .getAgentTierProportions */ .fg)(a),
1210
- anti_hallucination_mode: a.anti_hallucination_mode === "off" || a.anti_hallucination_mode === "regex" || a.anti_hallucination_mode === "model" ? a.anti_hallucination_mode : null,
1211
- anti_hallucination_model_config: a.anti_hallucination_model_config,
1212
- citation_strictness: (0,_lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_1__/* .parseCitationStrictness */ .P2)(a.citation_strictness) ?? "off",
1213
- tool_credentials: (0,_lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_1__/* .getAgentToolCredentials */ .S2)(a),
1214
- router_policy: a.router_policy === "cheap" || a.router_policy === "fast" || a.router_policy === "balanced" || a.router_policy === "quality" ? a.router_policy : null,
1215
- router_enabled: a.router_enabled === 1 ? true : a.router_enabled === 0 ? false : null,
1216
- usage_strategy: a.usage_strategy === "cost_saving" || a.usage_strategy === "balanced" || a.usage_strategy === "high_reasoning" ? a.usage_strategy : null,
1217
- created_at: a.created_at,
1218
- updated_at: a.updated_at
1219
- };
1220
- }
1221
- function bridgeToResponse(r) {
1222
- return {
1223
- id: r.id,
1224
- kind: r.kind,
1225
- name: r.name,
1226
- status: r.status,
1227
- last_error: r.last_error,
1228
- paired_id: r.paired_id,
1229
- enabled: r.enabled === 1,
1230
- event_subscriptions: {
1231
- group_profile_updates: r.forward_group_profile_updates === 1,
1232
- group_participants_updates: r.forward_group_participants_updates === 1
1233
- },
1234
- created_at: r.created_at,
1235
- updated_at: r.updated_at
1236
- };
1237
- }
1238
- function mcpServerToResponse(r) {
1084
+ // EXTERNAL MODULE: ./lib/stores/mcp-servers.ts
1085
+ var mcp_servers = __webpack_require__(42666);
1086
+ // EXTERNAL MODULE: ./lib/env/allowlist.ts
1087
+ var allowlist = __webpack_require__(423593);
1088
+ // EXTERNAL MODULE: ./lib/tools/security/subprocess-env.ts
1089
+ var subprocess_env = __webpack_require__(813638);
1090
+ // EXTERNAL MODULE: ./lib/utils/error.ts
1091
+ var error = __webpack_require__(922032);
1092
+ ;// ./lib/mcp/tool-results.ts
1093
+ // Plain-argument tool invocation drops LangChain artifacts. Keep structured
1094
+ // output usable by the agent without exposing private MCP protocol metadata.
1095
+ const includeMcpStructuredContent = ({ result: [content, artifacts] })=>{
1096
+ const structured = artifacts.find((artifact)=>artifact.type === "mcp_structured_content");
1097
+ if (!structured) return;
1239
1098
  return {
1240
- name: r.name,
1241
- transport: r.transport,
1242
- spec: (0,_lib_utils_json__WEBPACK_IMPORTED_MODULE_2__/* .parseJsonSafe */ .p)(r.spec, null),
1243
- enabled: r.enabled === 1,
1244
- last_error: r.last_error,
1245
- created_at: r.created_at,
1246
- updated_at: r.updated_at
1099
+ result: [
1100
+ [
1101
+ ...typeof content === "string" ? content ? [
1102
+ {
1103
+ type: "text",
1104
+ text: content
1105
+ }
1106
+ ] : [] : content,
1107
+ {
1108
+ type: "text",
1109
+ text: `Structured result (JSON):\n${JSON.stringify(structured.data)}`
1110
+ }
1111
+ ],
1112
+ artifacts
1113
+ ]
1247
1114
  };
1248
- }
1115
+ };
1116
+
1117
+ ;// ./lib/mcp/client.ts
1118
+
1119
+
1120
+
1121
+
1122
+
1123
+ // Singleton MCP client manager. Connects to enabled servers on first access,
1124
+ // caches the resulting StructuredTools, and invalidates on configuration
1125
+ // changes (when the API CRUD endpoints touch the table they call refresh()).
1126
+ //
1127
+ // We intentionally don't keep stdio child processes alive forever — the
1128
+ // MultiServerMCPClient owns connections, and if a server is disabled or
1129
+ // removed we close the existing client and rebuild on next access.
1130
+ let cachedTools = null;
1131
+ let cacheKey = ""; // hash of the enabled server set; cache invalidated on change
1132
+ let pending = null;
1133
+ let activeClient = null;
1134
+ // Incremented by invalidateMcpTools(); captured by getMcpTools() at the start
1135
+ // of each async run so a stale in-flight promise can detect it was superseded.
1136
+ let generation = 0;
1137
+ const mcpToolMeta = new Map();
1249
1138
  /**
1250
- * Shape a `message_usage` row into the over-the-wire `usage` object the
1251
- * chat panel's `ContextUsageBar` consumes. Returns `null` for messages
1252
- * that have no snapshot (user turns and legacy assistant rows recorded
1253
- * before the per-turn snapshot landed in ADR-0041).
1139
+ * Return the declared metadata for an MCP tool (category, group,
1140
+ * credentials_required). Populated when getMcpTools() connects to servers;
1141
+ * sourced from the tool's `metadata` object which @langchain/mcp-adapters
1142
+ * populates from the MCP tool's `annotations` field.
1254
1143
  *
1255
- * Anthropic prompt-cache tokens (PR #181 + the cache-fidelity follow-up)
1256
- * are surfaced as additive fields so future UI work can render a
1257
- * "served from cache" badge without another wire change. Both are
1258
- * `null` for rows that predate cache plumbing or for providers that
1259
- * don't expose a cache breakdown.
1260
- */ function messageUsageToResponse(u) {
1261
- if (!u) return null;
1262
- return {
1263
- input_tokens: u.input_tokens,
1264
- output_tokens: u.output_tokens,
1265
- hot_tokens: u.hot_tokens,
1266
- warm_tokens: u.warm_tokens,
1267
- facts_tokens: u.facts_tokens,
1268
- overhead_tokens: u.overhead_tokens,
1269
- hot_budget_tokens: u.hot_budget_tokens,
1270
- warm_budget_tokens: u.warm_budget_tokens,
1271
- facts_budget_tokens: u.facts_budget_tokens,
1272
- context_window_tokens: u.context_window_tokens,
1273
- cache_creation_input_tokens: u.cache_creation_input_tokens,
1274
- cache_read_input_tokens: u.cache_read_input_tokens,
1275
- thinking_tokens: u.thinking_tokens ?? null,
1276
- cost_usd: u.cost_usd ?? null
1277
- };
1144
+ * Returns stale (pre-invalidation) values during reconnect — intentional:
1145
+ * stale metadata is better than empty metadata for the credentials badge.
1146
+ */ function getMcpToolMeta(name) {
1147
+ return mcpToolMeta.get(name);
1278
1148
  }
1279
- /**
1280
- * Shape one message row into its over-the-wire form, attaching its
1281
- * per-turn `usage` snapshot when one exists. Pure data-shaping helper
1282
- * extracted from the threads GET route so the wire contract has unit
1283
- * coverage.
1284
- */ function messageToResponse(m, usageById) {
1285
- return {
1286
- id: m.msg_id,
1287
- seq: m.seq,
1288
- role: m.role,
1289
- content: m.content,
1290
- created_at: m.created_at,
1291
- transcript_status: m.transcript_status,
1292
- status_reason: m.status_reason,
1293
- tool_events: parseToolEventsForResponse(m.tool_events),
1294
- category: m.category ?? null,
1295
- usage: messageUsageToResponse(usageById.get(m.msg_id)),
1296
- metadata: parseMessageMetadataForResponse(m.metadata)
1297
- };
1149
+ function specHash(rows) {
1150
+ // Only enabled servers matter. Order by name so the hash is stable.
1151
+ return rows.filter((r)=>r.enabled === 1).sort((a, b)=>a.name.localeCompare(b.name)).map((r)=>`${r.name}:${r.transport}:${r.spec}`).join("|");
1298
1152
  }
1299
- /** Tolerant `tool_events` JSON parser shared with the route. Bad JSON
1300
- * and non-array payloads collapse to `undefined` so the wire shape
1301
- * always matches the typed client expectation. */ function parseToolEventsForResponse(raw) {
1302
- if (!raw) return undefined;
1153
+ async function getMcpTools() {
1154
+ const rows = (0,mcp_servers/* listMcpServers */.n7)();
1155
+ const enabled = rows.filter((r)=>r.enabled === 1);
1156
+ const key = specHash(rows);
1157
+ if (cachedTools && cacheKey === key) return cachedTools;
1158
+ if (pending) return pending;
1159
+ if (enabled.length === 0) {
1160
+ cachedTools = [];
1161
+ cacheKey = key;
1162
+ return cachedTools;
1163
+ }
1164
+ const myGen = generation; // capture before async work; invalidation will increment this
1165
+ pending = (async ()=>{
1166
+ // Close prior client if we're rebuilding due to a config change.
1167
+ if (activeClient) {
1168
+ try {
1169
+ await activeClient.close();
1170
+ } catch {}
1171
+ activeClient = null;
1172
+ }
1173
+ const { MCPAdapter } = await Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, 590347));
1174
+ // Connect each server in its own client so one broken server (e.g. missing
1175
+ // `uvx` on PATH, bad API key) doesn't poison the others. Previously a
1176
+ // single MCPAdapter.listTools() throw would mark ALL enabled
1177
+ // servers with the same error message — confusing because the UI showed
1178
+ // e.g. google-maps tagged with the `time` server's connection error.
1179
+ const tools = [];
1180
+ const newMeta = new Map(); // built in isolation; written atomically
1181
+ const subClients = [];
1182
+ for (const row of enabled){
1183
+ let serverConfig;
1184
+ try {
1185
+ const spec = JSON.parse(row.spec);
1186
+ if (row.transport === "stdio") {
1187
+ const s = spec;
1188
+ serverConfig = {
1189
+ transport: "stdio",
1190
+ command: s.command,
1191
+ args: s.args ?? [],
1192
+ mode: "auto",
1193
+ elicitation: false,
1194
+ // Inherit host env (PATH, HOME, proxies, registry configs) and
1195
+ // layer spec.env on top. See buildSubprocessEnv below.
1196
+ env: buildSubprocessEnv(s.env ?? {})
1197
+ };
1198
+ } else {
1199
+ const s = spec;
1200
+ serverConfig = {
1201
+ transport: "http",
1202
+ url: s.url,
1203
+ headers: s.headers ?? {},
1204
+ mode: "auto",
1205
+ elicitation: false
1206
+ };
1207
+ }
1208
+ } catch (err) {
1209
+ (0,mcp_servers/* setMcpServerError */.KA)(row.name, `bad spec: ${(0,error/* errorMessage */.g)(err)}`);
1210
+ continue;
1211
+ }
1212
+ try {
1213
+ const client = new MCPAdapter({
1214
+ servers: {
1215
+ [row.name]: serverConfig
1216
+ },
1217
+ throwOnLoadError: false,
1218
+ prefixToolNameWithServerName: false,
1219
+ onConnectionError: "throw",
1220
+ afterToolCall: includeMcpStructuredContent
1221
+ });
1222
+ const serverTools = await client.listTools();
1223
+ tools.push(...serverTools);
1224
+ for (const t of serverTools){
1225
+ const raw = t.metadata ?? {};
1226
+ // @langchain/mcp-adapters may nest annotations under metadata.annotations
1227
+ // or spread them directly into metadata — handle both shapes.
1228
+ const ann = raw.annotations ?? raw;
1229
+ newMeta.set(t.name, {
1230
+ category: typeof ann.category === "string" ? ann.category : undefined,
1231
+ group: typeof ann.group === "string" ? ann.group : undefined,
1232
+ credentials_required: Array.isArray(ann.credentials_required) ? ann.credentials_required.filter((c)=>typeof c === "string") : undefined,
1233
+ integration: typeof ann.integration === "string" ? ann.integration : undefined,
1234
+ server_name: row.name
1235
+ });
1236
+ }
1237
+ subClients.push(client);
1238
+ (0,mcp_servers/* setMcpServerError */.KA)(row.name, null);
1239
+ } catch (err) {
1240
+ const msg = (0,error/* errorMessage */.g)(err);
1241
+ console.error(`[mcp] server "${row.name}" failed:`, msg);
1242
+ (0,mcp_servers/* setMcpServerError */.KA)(row.name, msg);
1243
+ }
1244
+ }
1245
+ // If invalidateMcpTools() was called while we were connecting, our results
1246
+ // are stale — discard them and let the next caller reconnect fresh.
1247
+ if (generation !== myGen) return cachedTools ?? [];
1248
+ // Atomically replace metadata so callers never see a partial update.
1249
+ mcpToolMeta.clear();
1250
+ for (const [k, v] of newMeta)mcpToolMeta.set(k, v);
1251
+ activeClient = {
1252
+ close: async ()=>{
1253
+ await Promise.allSettled(subClients.map((c)=>c.close()));
1254
+ }
1255
+ };
1256
+ cachedTools = tools;
1257
+ cacheKey = key;
1258
+ return tools;
1259
+ })();
1303
1260
  try {
1304
- const parsed = JSON.parse(raw);
1305
- return Array.isArray(parsed) ? parsed : undefined;
1306
- } catch {
1307
- return undefined;
1261
+ return await pending;
1262
+ } finally{
1263
+ pending = null;
1308
1264
  }
1309
1265
  }
1310
- /** Tolerant `metadata` JSON parser. Returns `null` for missing/blank/
1311
- * malformed/non-object payloads so the wire shape stays a plain object
1312
- * or null — readers can rely on `metadata?.citations?...` chaining. */ function parseMessageMetadataForResponse(raw) {
1313
- if (!raw) return null;
1314
- try {
1315
- const parsed = JSON.parse(raw);
1316
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
1317
- return parsed;
1318
- } catch {
1319
- return null;
1266
+ // Called by API endpoints when a server is added/edited/deleted/toggled so
1267
+ // the next getAllTools() call re-resolves connections.
1268
+ function invalidateMcpTools() {
1269
+ cachedTools = null;
1270
+ cacheKey = "";
1271
+ pending = null; // clear dedup guard so the next caller starts a fresh connect
1272
+ generation++; // signal any in-flight promise to discard its writes
1273
+ // mcpToolMeta intentionally NOT cleared: stale metadata (category, group,
1274
+ // credentials_required) is better than empty during the reconnect window —
1275
+ // the credentials badge stays visible instead of silently disappearing.
1276
+ // The map is replaced atomically once the new connection completes.
1277
+ if (activeClient) {
1278
+ activeClient.close().catch(()=>{});
1279
+ activeClient = null;
1320
1280
  }
1321
1281
  }
1322
- /**
1323
- * Resolve the bar's 100% baseline. Per-row `context_window_tokens`
1324
- * (snapshotted at run time) wins so the bar matches the cap the agent
1325
- * actually applied; legacy rows fall back to the model-config value;
1326
- * unconfigured agents fall back to the default. Centralised so the
1327
- * route and the UI share the same precedence rule.
1328
- */ function resolveContextWindowTokens(modelConfiguredTokens, defaultTokens) {
1329
- if (typeof modelConfiguredTokens === "number" && modelConfiguredTokens > 0) {
1330
- return modelConfiguredTokens;
1282
+ // ── Subprocess environment ──────────────────────────────────────────────────
1283
+ // Be transparent: whatever the host can reach, the subprocess can reach.
1284
+ //
1285
+ // Why this design:
1286
+ // - On a clean machine (no JFrog, no special config), uv/npm fall through to
1287
+ // their public defaults. Nothing extra needed.
1288
+ // - On a corporate machine (JFrog or Artifactory in env / ~/.config/uv/uv.toml /
1289
+ // ~/.npmrc), public PyPI/npm are usually blocked at the network layer.
1290
+ // The user's existing config is the ONLY thing that works — so inherit it.
1291
+ // - Per-server overrides still work: spec.env wins over inherited env, so a
1292
+ // user who wants this specific server pinned to a custom registry can do
1293
+ // so without affecting everything else.
1294
+ //
1295
+ // The MCP SDK's default behavior (a curated minimal env) breaks corporate
1296
+ // installs because it strips registry env vars; we explicitly opt out of that.
1297
+ // Only a few env vars are worth scrubbing — the ones that actively confuse
1298
+ // stdio MCP processes or leak our internal state. Everything else flows.
1299
+ const SCRUBBED_VARS = new Set([
1300
+ // Our own DB path — irrelevant to MCP servers, and exposes our layout.
1301
+ "JARELA_DB_DIR",
1302
+ // Defensive: don't leak npm/yarn auth tokens into a stdio child unless
1303
+ // the server explicitly opted in via spec.env. (Most public MCP packages
1304
+ // don't need auth to install.)
1305
+ "NPM_TOKEN",
1306
+ "NODE_AUTH_TOKEN"
1307
+ ]);
1308
+ function buildSubprocessEnv(userEnv) {
1309
+ const out = {};
1310
+ // 1. Inherit the host process env wholesale. This carries through:
1311
+ // - PATH (so uvx, npx, python, node are findable)
1312
+ // - HOME (so uv/pip/npm read user-level config files like ~/.config/uv/uv.toml,
1313
+ // ~/.npmrc, ~/.pip/pip.conf — which may pin JFrog, Artifactory, etc.)
1314
+ // - HTTP_PROXY / HTTPS_PROXY / NO_PROXY (corporate proxy routing)
1315
+ // - UV_INDEX_URL / PIP_INDEX_URL / npm_config_registry if the user set
1316
+ // them — letting their JFrog or Artifactory setup work transparently
1317
+ // - Locale, terminal, etc.
1318
+ for (const [k, v] of Object.entries(process.env)){
1319
+ if (typeof v !== "string") continue;
1320
+ if (SCRUBBED_VARS.has(k)) continue;
1321
+ out[k] = v;
1331
1322
  }
1332
- return defaultTokens;
1323
+ // 1b. Merge in the env-sync full shell-env snapshot (lib/tools/subprocess-env.ts).
1324
+ // Covers vars the user's rc files export that never made it into
1325
+ // Jarela's own process.env — e.g. running as a launchd/systemd service.
1326
+ for (const [k, v] of Object.entries((0,subprocess_env/* getFullShellEnv */.l9)())){
1327
+ if (SCRUBBED_VARS.has(k)) continue;
1328
+ out[k] = v;
1329
+ }
1330
+ // 2. Inject env-sync-managed credentials from the encrypted integration
1331
+ // store. Service-mode installs (launchd, systemd, brew services)
1332
+ // start with no shell env, so ANTHROPIC_API_KEY / GITHUB_TOKEN / …
1333
+ // have to come from the store or downstream tools see nothing. This
1334
+ // layer goes after process.env so that when the store has been
1335
+ // refreshed by env-sync, the new value wins over a stale shell
1336
+ // export.
1337
+ for (const [k, v] of Object.entries((0,allowlist/* getInjectedSubprocessEnv */.xJ)())){
1338
+ out[k] = v;
1339
+ }
1340
+ // 3. Per-server spec.env layered on top — user's explicit config always
1341
+ // wins. Use this to (a) supply API keys, (b) pin THIS server to a
1342
+ // specific registry without affecting the rest, or (c) unset something
1343
+ // via empty string.
1344
+ for (const [k, v] of Object.entries(userEnv)){
1345
+ if (typeof v === "string") out[k] = v;
1346
+ }
1347
+ return out;
1333
1348
  }
1334
1349
 
1335
1350
 
1336
1351
  /***/ }),
1337
1352
 
1338
- /***/ 710846:
1353
+ /***/ 781630:
1339
1354
  /***/ ((module) => {
1340
1355
 
1341
- module.exports = require("next/dist/compiled/next-server/app-page.runtime.prod.js");
1356
+ module.exports = require("http");
1342
1357
 
1343
1358
  /***/ }),
1344
1359
 
1345
- /***/ 731421:
1360
+ /***/ 848161:
1346
1361
  /***/ ((module) => {
1347
1362
 
1348
- module.exports = require("node:child_process");
1363
+ module.exports = require("node:os");
1349
1364
 
1350
1365
  /***/ }),
1351
1366
 
1352
- /***/ 739947:
1353
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1354
-
1355
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1356
- /* harmony export */ Bm: () => (/* binding */ cachedJson),
1357
- /* harmony export */ HN: () => (/* binding */ notFoundResponse),
1358
- /* harmony export */ Jb: () => (/* binding */ validateBody),
1359
- /* harmony export */ K2: () => (/* binding */ createdResponse),
1360
- /* harmony export */ Ng: () => (/* binding */ noStoreJson),
1361
- /* harmony export */ yj: () => (/* binding */ errorResponse)
1362
- /* harmony export */ });
1363
- /* harmony import */ var next_server__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(945592);
1364
- // Shared HTTP response builders for app/api/v1/** route handlers.
1365
- //
1366
- // Goal: every error/success payload across the v1 surface has the same
1367
- // shape. Before this lived inline, response bodies drifted —
1368
- // `{error: "x"}` vs `{message: "x"}`, 400 vs 422 for the same condition,
1369
- // some routes returned Zod's raw issue array, others stringified it.
1370
-
1371
- function errorResponse(message, status = 400) {
1372
- return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json({
1373
- error: message
1374
- }, {
1375
- status
1376
- });
1377
- }
1378
- function notFoundResponse(message = "Not found") {
1379
- return errorResponse(message, 404);
1380
- }
1381
- function createdResponse(data) {
1382
- return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
1383
- status: 201
1384
- });
1385
- }
1386
- // Wrap a 200 JSON response with a private Cache-Control header. Use on safe
1387
- // GET endpoints that serve user-scoped data the client refetches often (panel
1388
- // mounts, navigation back/forward) but mutates rarely. The TTL is short
1389
- // enough that explicit mutations — which patch the client-side ApiClient
1390
- // cache in place — stay observably consistent without an extra roundtrip.
1391
- //
1392
- // swrSeconds (optional): stale-while-revalidate window. When set, the browser
1393
- // serves the cached response immediately and refreshes in the background,
1394
- // making navigation feel instant. Use for data that can tolerate brief
1395
- // staleness (tool list, agent configs, model list). Omit for real-time data
1396
- // (dashboard metrics, credential state).
1397
- function cachedJson(data, maxAgeSeconds, swrSeconds) {
1398
- const swr = swrSeconds ? `, stale-while-revalidate=${swrSeconds}` : "";
1399
- return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
1400
- headers: {
1401
- "Cache-Control": `private, max-age=${maxAgeSeconds}${swr}`
1402
- }
1403
- });
1404
- }
1405
- // Use for endpoints whose response contains live state that must never be
1406
- // served from cache — credentials, connection status, live config values.
1407
- function noStoreJson(data) {
1408
- return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
1409
- headers: {
1410
- "Cache-Control": "no-store"
1411
- }
1412
- });
1413
- }
1414
- // Validate a JSON request body against a zod schema.
1415
- // Returns either the parsed data or a 400 NextResponse explaining the issue.
1416
- // Caller pattern:
1417
- // const parsed = await validateBody(req, Schema);
1418
- // if (parsed instanceof NextResponse) return parsed;
1419
- // // use parsed.field
1420
- async function validateBody(req, schema) {
1421
- let raw;
1422
- try {
1423
- raw = await req.json();
1424
- } catch {
1425
- return errorResponse("Request body must be valid JSON", 400);
1426
- }
1427
- const parsed = schema.safeParse(raw);
1428
- if (!parsed.success) {
1429
- return errorResponse(parsed.error.issues[0]?.message ?? "invalid body", 400);
1430
- }
1431
- return parsed.data;
1432
- }
1433
-
1367
+ /***/ 903295:
1368
+ /***/ ((module) => {
1369
+
1370
+ module.exports = require("next/dist/server/app-render/after-task-async-storage.external.js");
1434
1371
 
1435
1372
  /***/ }),
1436
1373
 
1437
- /***/ 744870:
1374
+ /***/ 927910:
1438
1375
  /***/ ((module) => {
1439
1376
 
1440
- module.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js");
1377
+ module.exports = require("stream");
1441
1378
 
1442
1379
  /***/ }),
1443
1380
 
1444
- /***/ 754172:
1381
+ /***/ 931768:
1445
1382
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1446
1383
 
1447
1384
  __webpack_require__.r(__webpack_exports__);
1448
1385
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1449
- /* harmony export */ DELETE: () => (/* binding */ DELETE),
1450
- /* harmony export */ GET: () => (/* binding */ GET),
1451
- /* harmony export */ PUT: () => (/* binding */ PUT)
1386
+ /* harmony export */ handler: () => (/* binding */ handler),
1387
+ /* harmony export */ patchFetch: () => (/* binding */ patchFetch),
1388
+ /* harmony export */ routeModule: () => (/* binding */ routeModule),
1389
+ /* harmony export */ serverHooks: () => (/* binding */ serverHooks),
1390
+ /* harmony export */ workAsyncStorage: () => (/* binding */ workAsyncStorage),
1391
+ /* harmony export */ workUnitAsyncStorage: () => (/* binding */ workUnitAsyncStorage)
1452
1392
  /* harmony export */ });
1453
- /* harmony import */ var next_server__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(945592);
1454
- /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(497377);
1455
- /* harmony import */ var _lib_stores_mcp_servers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(42666);
1456
- /* harmony import */ var _lib_mcp_client__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(777955);
1457
- /* harmony import */ var _lib_api_serializers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(685678);
1458
- /* harmony import */ var _lib_api_responses__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(739947);
1459
- /* harmony import */ var _lib_utils_json__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(253638);
1393
+ /* harmony import */ var next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(319225);
1394
+ /* 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__);
1395
+ /* harmony import */ var next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(684006);
1396
+ /* harmony import */ var next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8317);
1397
+ /* 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__);
1398
+ /* harmony import */ var next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(799373);
1399
+ /* 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__);
1400
+ /* harmony import */ var next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(434775);
1401
+ /* 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__);
1402
+ /* harmony import */ var next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(524235);
1403
+ /* 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__);
1404
+ /* harmony import */ var next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(200261);
1405
+ /* 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__);
1406
+ /* harmony import */ var next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(754365);
1407
+ /* 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__);
1408
+ /* harmony import */ var next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(590771);
1409
+ /* 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__);
1410
+ /* harmony import */ var next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(473461);
1411
+ /* 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__);
1412
+ /* harmony import */ var next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(767798);
1413
+ /* harmony import */ var next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(192280);
1414
+ /* harmony import */ var next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(662018);
1415
+ /* 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__);
1416
+ /* harmony import */ var next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(445696);
1417
+ /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(347929);
1418
+ /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__);
1419
+ /* harmony import */ var next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(986439);
1420
+ /* 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__);
1421
+ /* harmony import */ var next_dist_server_lib_route_cache_key__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(710246);
1422
+ /* 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__);
1423
+ /* harmony import */ var next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(137527);
1424
+ /* 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__);
1460
1425
 
1461
1426
 
1462
1427
 
@@ -1464,369 +1429,404 @@ __webpack_require__.r(__webpack_exports__);
1464
1429
 
1465
1430
 
1466
1431
 
1467
- const PutBody = zod__WEBPACK_IMPORTED_MODULE_5__/* .object */ .Ikc({
1468
- transport: zod__WEBPACK_IMPORTED_MODULE_5__/* ["enum"] */ .k5n([
1469
- "stdio",
1470
- "http"
1471
- ]).optional(),
1472
- spec: zod__WEBPACK_IMPORTED_MODULE_5__/* .record */ .g1P(zod__WEBPACK_IMPORTED_MODULE_5__/* .string */ .YjP(), zod__WEBPACK_IMPORTED_MODULE_5__/* .unknown */ .L5J()).optional(),
1473
- enabled: zod__WEBPACK_IMPORTED_MODULE_5__/* .boolean */ .zMY().optional()
1474
- });
1475
- async function GET(_req, { params }) {
1476
- const { name } = await params;
1477
- const r = (0,_lib_stores_mcp_servers__WEBPACK_IMPORTED_MODULE_1__/* .getMcpServer */ .cw)(name);
1478
- if (!r) return (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_4__/* .notFoundResponse */ .HN)("MCP server not found");
1479
- return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json((0,_lib_api_serializers__WEBPACK_IMPORTED_MODULE_3__/* .mcpServerToResponse */ .sU)(r));
1480
- }
1481
- async function PUT(req, { params }) {
1482
- const { name } = await params;
1483
- const existing = (0,_lib_stores_mcp_servers__WEBPACK_IMPORTED_MODULE_1__/* .getMcpServer */ .cw)(name);
1484
- if (!existing) return (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_4__/* .notFoundResponse */ .HN)("MCP server not found");
1485
- const body = await (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_4__/* .validateBody */ .Jb)(req, PutBody);
1486
- if (body instanceof next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse) return body;
1487
- const row = (0,_lib_stores_mcp_servers__WEBPACK_IMPORTED_MODULE_1__/* .upsertMcpServer */ .te)({
1488
- name,
1489
- transport: body.transport ?? existing.transport,
1490
- spec: body.spec ?? (0,_lib_utils_json__WEBPACK_IMPORTED_MODULE_6__/* .parseJsonSafe */ .p)(existing.spec, {}),
1491
- enabled: body.enabled ?? existing.enabled === 1
1492
- });
1493
- (0,_lib_mcp_client__WEBPACK_IMPORTED_MODULE_2__/* .invalidateMcpTools */ .H_)();
1494
- return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json((0,_lib_api_serializers__WEBPACK_IMPORTED_MODULE_3__/* .mcpServerToResponse */ .sU)(row));
1495
- }
1496
- async function DELETE(_req, { params }) {
1497
- const { name } = await params;
1498
- const ok = (0,_lib_stores_mcp_servers__WEBPACK_IMPORTED_MODULE_1__/* .deleteMcpServer */ .le)(name);
1499
- if (!ok) return (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_4__/* .notFoundResponse */ .HN)("MCP server not found");
1500
- (0,_lib_mcp_client__WEBPACK_IMPORTED_MODULE_2__/* .invalidateMcpTools */ .H_)();
1501
- return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json({
1502
- deleted: true
1503
- });
1504
- }
1505
1432
 
1506
1433
 
1507
- /***/ }),
1508
1434
 
1509
- /***/ 775919:
1510
- /***/ ((module) => {
1511
1435
 
1512
- module.exports = require("node:worker_threads");
1513
1436
 
1514
- /***/ }),
1515
1437
 
1516
- /***/ 777030:
1517
- /***/ ((module) => {
1518
1438
 
1519
- module.exports = require("node:net");
1520
1439
 
1521
- /***/ }),
1522
1440
 
1523
- /***/ 777955:
1524
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1525
1441
 
1526
1442
 
1527
- // EXPORTS
1528
- __webpack_require__.d(__webpack_exports__, {
1529
- k2: () => (/* binding */ getMcpToolMeta),
1530
- a2: () => (/* binding */ getMcpTools),
1531
- H_: () => (/* binding */ invalidateMcpTools)
1443
+ // We inject the nextConfigOutput here so that we can use them in the route
1444
+ // module.
1445
+ const nextConfigOutput = "standalone"
1446
+ const routeModule = new next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__.AppRouteRouteModule({
1447
+ definition: {
1448
+ kind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
1449
+ page: "/api/v1/mcp-servers/[name]/route",
1450
+ pathname: "/api/v1/mcp-servers/[name]",
1451
+ filename: "route",
1452
+ bundlePath: "app/api/v1/mcp-servers/[name]/route"
1453
+ },
1454
+ distDir: ".next" || 0,
1455
+ relativeProjectDir: false || '',
1456
+ resolvedPagePath: "/home/runner/work/jarela/jarela/app/api/v1/mcp-servers/[name]/route.ts",
1457
+ nextConfigOutput,
1458
+ // The lazy require factory ensures that:
1459
+ // - In dev: devRequestTimingInternalsEnd is set before userland executes,
1460
+ // correctly attributing module load time to application-code rather than
1461
+ // framework internals.
1462
+ // - In all modes: async modules (route files with top-level await) are
1463
+ // handled correctly — require() returns a Promise for such modules, which
1464
+ // ensureUserland() awaits before the first request is handled.
1465
+ userland: ()=>__webpack_require__(754172),
1466
+ // In Turbopack dev mode, also provide a synchronous per-request getter so
1467
+ // server HMR updates are picked up without re-executing the entry chunk.
1468
+ // Using require() (synchronous) avoids adding async overhead that would be
1469
+ // incorrectly attributed to application-code time in devRequestTiming.
1470
+ ... false ? 0 : {}
1532
1471
  });
1533
-
1534
- // UNUSED EXPORTS: buildSubprocessEnv
1535
-
1536
- // EXTERNAL MODULE: ./lib/stores/mcp-servers.ts
1537
- var mcp_servers = __webpack_require__(42666);
1538
- // EXTERNAL MODULE: ./lib/env/allowlist.ts
1539
- var allowlist = __webpack_require__(423593);
1540
- // EXTERNAL MODULE: ./lib/tools/security/subprocess-env.ts
1541
- var subprocess_env = __webpack_require__(813638);
1542
- // EXTERNAL MODULE: ./lib/utils/error.ts
1543
- var error = __webpack_require__(922032);
1544
- ;// ./lib/mcp/tool-results.ts
1545
- // Plain-argument tool invocation drops LangChain artifacts. Keep structured
1546
- // output usable by the agent without exposing private MCP protocol metadata.
1547
- const includeMcpStructuredContent = ({ result: [content, artifacts] })=>{
1548
- const structured = artifacts.find((artifact)=>artifact.type === "mcp_structured_content");
1549
- if (!structured) return;
1550
- return {
1551
- result: [
1552
- [
1553
- ...typeof content === "string" ? content ? [
1554
- {
1555
- type: "text",
1556
- text: content
1557
- }
1558
- ] : [] : content,
1559
- {
1560
- type: "text",
1561
- text: `Structured result (JSON):\n${JSON.stringify(structured.data)}`
1562
- }
1563
- ],
1564
- artifacts
1565
- ]
1566
- };
1567
- };
1568
-
1569
- ;// ./lib/mcp/client.ts
1570
-
1571
-
1572
-
1573
-
1574
-
1575
- // Singleton MCP client manager. Connects to enabled servers on first access,
1576
- // caches the resulting StructuredTools, and invalidates on configuration
1577
- // changes (when the API CRUD endpoints touch the table they call refresh()).
1578
- //
1579
- // We intentionally don't keep stdio child processes alive forever — the
1580
- // MultiServerMCPClient owns connections, and if a server is disabled or
1581
- // removed we close the existing client and rebuild on next access.
1582
- let cachedTools = null;
1583
- let cacheKey = ""; // hash of the enabled server set; cache invalidated on change
1584
- let pending = null;
1585
- let activeClient = null;
1586
- // Incremented by invalidateMcpTools(); captured by getMcpTools() at the start
1587
- // of each async run so a stale in-flight promise can detect it was superseded.
1588
- let generation = 0;
1589
- const mcpToolMeta = new Map();
1590
- /**
1591
- * Return the declared metadata for an MCP tool (category, group,
1592
- * credentials_required). Populated when getMcpTools() connects to servers;
1593
- * sourced from the tool's `metadata` object which @langchain/mcp-adapters
1594
- * populates from the MCP tool's `annotations` field.
1595
- *
1596
- * Returns stale (pre-invalidation) values during reconnect — intentional:
1597
- * stale metadata is better than empty metadata for the credentials badge.
1598
- */ function getMcpToolMeta(name) {
1599
- return mcpToolMeta.get(name);
1600
- }
1601
- function specHash(rows) {
1602
- // Only enabled servers matter. Order by name so the hash is stable.
1603
- return rows.filter((r)=>r.enabled === 1).sort((a, b)=>a.name.localeCompare(b.name)).map((r)=>`${r.name}:${r.transport}:${r.spec}`).join("|");
1472
+ // Pull out the exports that we need to expose from the module. This should
1473
+ // be eliminated when we've moved the other routes to the new format. These
1474
+ // are used to hook into the route.
1475
+ const { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;
1476
+ function patchFetch() {
1477
+ return (0,next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__.patchFetch)({
1478
+ workAsyncStorage,
1479
+ workUnitAsyncStorage
1480
+ });
1604
1481
  }
1605
- async function getMcpTools() {
1606
- const rows = (0,mcp_servers/* listMcpServers */.n7)();
1607
- const enabled = rows.filter((r)=>r.enabled === 1);
1608
- const key = specHash(rows);
1609
- if (cachedTools && cacheKey === key) return cachedTools;
1610
- if (pending) return pending;
1611
- if (enabled.length === 0) {
1612
- cachedTools = [];
1613
- cacheKey = key;
1614
- return cachedTools;
1482
+
1483
+ async function handler(req, res, ctx) {
1484
+ if (ctx.requestMeta) {
1485
+ (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.setRequestMeta)(req, ctx.requestMeta);
1486
+ }
1487
+ if (routeModule.isDev) {
1488
+ (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.addRequestMeta)(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());
1489
+ }
1490
+ let srcPage = "/api/v1/mcp-servers/[name]/route";
1491
+ // turbopack doesn't normalize `/index` in the page name
1492
+ // so we need to to process dynamic routes properly
1493
+ // TODO: fix turbopack providing differing value from webpack
1494
+ if (false) {} else if (srcPage === '/index') {
1495
+ // we always normalize /index specifically
1496
+ srcPage = '/';
1497
+ }
1498
+ const multiZoneDraftMode = false;
1499
+ // Registering `instrumentation.ts` usually installs the tracer provider, so
1500
+ // do it before starting the request span. The span is started before
1501
+ // `prepare`, so route module preparation is part of the request's trace.
1502
+ // When this request triggers registration, the lifecycle spans of
1503
+ // `instrumentation.ts` are emitted inside the request span.
1504
+ const { instrumentation } = await routeModule.ensureInstrumentation(req, {
1505
+ deferSpans: true
1506
+ });
1507
+ return routeModule.traceRequest(req, {
1508
+ tracer: (0,next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.getTracer)(),
1509
+ spanName: `${req.method || 'GET'} ${srcPage}`,
1510
+ httpTarget: req.url,
1511
+ instrumentation
1512
+ }, (requestSpan, requestRootSpan)=>handleRequest(req, res, ctx, srcPage, multiZoneDraftMode, requestSpan, requestRootSpan));
1513
+ }
1514
+ async function handleRequest(req, res, ctx, srcPage, multiZoneDraftMode, requestSpan, requestRootSpan) {
1515
+ const prepareResult = await routeModule.prepare(req, res, {
1516
+ srcPage,
1517
+ multiZoneDraftMode
1518
+ });
1519
+ if (!prepareResult) {
1520
+ res.statusCode = 400;
1521
+ res.end('Bad Request');
1522
+ ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());
1523
+ return null;
1615
1524
  }
1616
- const myGen = generation; // capture before async work; invalidation will increment this
1617
- pending = (async ()=>{
1618
- // Close prior client if we're rebuilding due to a config change.
1619
- if (activeClient) {
1620
- try {
1621
- await activeClient.close();
1622
- } catch {}
1623
- activeClient = null;
1525
+ const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest, previewProps } = prepareResult;
1526
+ const normalizedSrcPage = (0,next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__.normalizeAppPath)(srcPage);
1527
+ // Only this route's prerenders can establish ISR or admit generated params.
1528
+ 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]));
1529
+ let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || isPrerendered);
1530
+ const render404 = async ()=>{
1531
+ // TODO: should route-module itself handle rendering the 404
1532
+ if (routerServerContext == null ? void 0 : routerServerContext.render404) {
1533
+ await routerServerContext.render404(req, res, parsedUrl, false);
1534
+ } else {
1535
+ res.end('This page could not be found');
1624
1536
  }
1625
- const { MCPAdapter } = await Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, 590347));
1626
- // Connect each server in its own client so one broken server (e.g. missing
1627
- // `uvx` on PATH, bad API key) doesn't poison the others. Previously a
1628
- // single MCPAdapter.listTools() throw would mark ALL enabled
1629
- // servers with the same error message — confusing because the UI showed
1630
- // e.g. google-maps tagged with the `time` server's connection error.
1631
- const tools = [];
1632
- const newMeta = new Map(); // built in isolation; written atomically
1633
- const subClients = [];
1634
- for (const row of enabled){
1635
- let serverConfig;
1636
- try {
1637
- const spec = JSON.parse(row.spec);
1638
- if (row.transport === "stdio") {
1639
- const s = spec;
1640
- serverConfig = {
1641
- transport: "stdio",
1642
- command: s.command,
1643
- args: s.args ?? [],
1644
- mode: "auto",
1645
- elicitation: false,
1646
- // Inherit host env (PATH, HOME, proxies, registry configs) and
1647
- // layer spec.env on top. See buildSubprocessEnv below.
1648
- env: buildSubprocessEnv(s.env ?? {})
1649
- };
1650
- } else {
1651
- const s = spec;
1652
- serverConfig = {
1653
- transport: "http",
1654
- url: s.url,
1655
- headers: s.headers ?? {},
1656
- mode: "auto",
1657
- elicitation: false
1658
- };
1537
+ return null;
1538
+ };
1539
+ if (isIsr && !isDraftMode) {
1540
+ const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];
1541
+ if (prerenderInfo) {
1542
+ if (prerenderInfo.fallback === false && !isPrerendered) {
1543
+ if (nextConfig.adapterPath) {
1544
+ return await render404();
1545
+ }
1546
+ throw new next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError();
1547
+ }
1548
+ }
1549
+ }
1550
+ let cacheKey = null;
1551
+ if (isIsr && !routeModule.isDev && !isDraftMode) {
1552
+ cacheKey = resolvedPathname;
1553
+ // ensure /index and / is normalized to one key
1554
+ cacheKey = cacheKey === '/index' ? '/' : cacheKey;
1555
+ }
1556
+ // Before rendering (which initializes component tree modules), we have to
1557
+ // set the reference manifests to our global store so Server Action's
1558
+ // encryption util can access to them at the top level of the page module.
1559
+ if (serverActionsManifest && clientReferenceManifest) {
1560
+ (0,next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__.setManifestsSingleton)({
1561
+ page: srcPage,
1562
+ clientReferenceManifest,
1563
+ serverActionsManifest
1564
+ });
1565
+ }
1566
+ const method = req.method || 'GET';
1567
+ const tracer = (0,next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.getTracer)();
1568
+ const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);
1569
+ const isMinimalMode = Boolean((0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'minimalMode'));
1570
+ const incrementalCache = (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, previewProps, prerenderManifest, isMinimalMode);
1571
+ incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();
1572
+ globalThis.__incrementalCache = incrementalCache;
1573
+ const context = {
1574
+ params,
1575
+ previewProps,
1576
+ renderOpts: {
1577
+ experimental: {
1578
+ authInterrupts: Boolean(nextConfig.experimental.authInterrupts),
1579
+ useCacheTimeout: nextConfig.experimental.useCacheTimeout,
1580
+ durableUseCacheEntries: Boolean(nextConfig.experimental.durableUseCacheEntries)
1581
+ },
1582
+ cacheComponents: Boolean(nextConfig.cacheComponents),
1583
+ validationLevel: nextConfig.experimental.instantInsights.validationLevel,
1584
+ isDraftMode,
1585
+ incrementalCache,
1586
+ hmrRefreshHash: (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'hmrRefreshHash'),
1587
+ cacheLifeProfiles: nextConfig.cacheLife,
1588
+ staticPageGenerationTimeout: nextConfig.staticPageGenerationTimeout,
1589
+ waitUntil: ctx.waitUntil,
1590
+ onClose: (cb)=>{
1591
+ res.on('close', cb);
1592
+ },
1593
+ onAfterTaskError: undefined
1594
+ },
1595
+ sharedContext: {
1596
+ buildId,
1597
+ deploymentId
1598
+ }
1599
+ };
1600
+ const nodeNextReq = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextRequest(req);
1601
+ const nodeNextRes = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextResponse(res);
1602
+ 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));
1603
+ const responseGenerator = async ({ previousCacheEntry })=>{
1604
+ try {
1605
+ if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {
1606
+ res.statusCode = 404;
1607
+ // on-demand revalidate always sets this header
1608
+ res.setHeader('x-nextjs-cache', 'REVALIDATED');
1609
+ res.end('This page could not be found');
1610
+ return null;
1611
+ }
1612
+ const response = cacheKey === null ? await routeModule.handle(nextReq, context) : await routeModule.prerender(nextReq, context);
1613
+ req.fetchMetrics = context.renderOpts.fetchMetrics;
1614
+ let pendingWaitUntil = context.renderOpts.pendingWaitUntil;
1615
+ // Attempt using provided waitUntil if available
1616
+ // if it's not we fallback to sendResponse's handling
1617
+ if (pendingWaitUntil) {
1618
+ if (ctx.waitUntil) {
1619
+ ctx.waitUntil(pendingWaitUntil);
1620
+ pendingWaitUntil = undefined;
1621
+ }
1622
+ }
1623
+ const cacheTags = context.renderOpts.collectedTags;
1624
+ // If the request is for a static response, we can cache it so long
1625
+ // as it's not edge.
1626
+ if (isIsr) {
1627
+ const blob = await response.blob();
1628
+ // Copy the headers from the response.
1629
+ const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.toNodeOutgoingHttpHeaders)(response.headers);
1630
+ if (cacheTags) {
1631
+ headers[next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER] = cacheTags;
1632
+ }
1633
+ if (!headers['content-type'] && blob.type) {
1634
+ headers['content-type'] = blob.type;
1635
+ }
1636
+ const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;
1637
+ 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
1638
+ // explicit `expire` (e.g. via `cacheLife`). This mirrors the
1639
+ // build-time fallback in `build/index.ts` so cache entries
1640
+ // and the response Cache-Control header agree on the route's
1641
+ // effective expire. Routes that opt out of revalidation
1642
+ // (`revalidate: false`) or that are dynamic (`revalidate: 0`)
1643
+ // keep `expire: undefined`.
1644
+ revalidate !== false && revalidate > 0 ? nextConfig.expireTime : undefined : context.renderOpts.collectedExpire;
1645
+ // Create the cache entry for the response.
1646
+ const cacheEntry = {
1647
+ value: {
1648
+ kind: next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__.CachedRouteKind.APP_ROUTE,
1649
+ status: response.status,
1650
+ body: Buffer.from(await blob.arrayBuffer()),
1651
+ headers
1652
+ },
1653
+ cacheControl: {
1654
+ revalidate,
1655
+ expire
1656
+ }
1657
+ };
1658
+ return cacheEntry;
1659
+ } else {
1660
+ // send response without caching if not ISR
1661
+ await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, response, pendingWaitUntil);
1662
+ return null;
1663
+ }
1664
+ } catch (err) {
1665
+ // if this is a background revalidate we need to report
1666
+ // the request error here as it won't be bubbled
1667
+ if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {
1668
+ const silenceLog = false;
1669
+ await routeModule.onRequestError(req, err, {
1670
+ routerKind: 'App Router',
1671
+ routePath: srcPage,
1672
+ routeType: 'route',
1673
+ revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
1674
+ isStaticGeneration: cacheKey !== null,
1675
+ isOnDemandRevalidate
1676
+ })
1677
+ }, silenceLog, routerServerContext);
1678
+ }
1679
+ throw err;
1680
+ }
1681
+ };
1682
+ const handleResponse = async (currentSpan)=>{
1683
+ try {
1684
+ var _cacheEntry_value;
1685
+ const cacheEntry = await routeModule.handleResponse({
1686
+ req,
1687
+ nextConfig,
1688
+ cacheKey,
1689
+ routeKind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
1690
+ isFallback: false,
1691
+ previewProps,
1692
+ prerenderManifest,
1693
+ isRoutePPREnabled: false,
1694
+ isOnDemandRevalidate,
1695
+ revalidateOnlyGenerated,
1696
+ responseGenerator,
1697
+ waitUntil: ctx.waitUntil,
1698
+ isMinimalMode
1699
+ });
1700
+ if (cacheEntry !== null && 'error' in cacheEntry) {
1701
+ throw cacheEntry.error;
1702
+ }
1703
+ // we don't create a cacheEntry for ISR
1704
+ if (!isIsr) {
1705
+ return;
1706
+ }
1707
+ 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) {
1708
+ var _cacheEntry_value1;
1709
+ throw new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`);
1710
+ }
1711
+ if (!isMinimalMode) {
1712
+ res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');
1713
+ }
1714
+ // Draft mode should never be cached
1715
+ if (isDraftMode) {
1716
+ res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');
1717
+ }
1718
+ const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers);
1719
+ if (!(isMinimalMode && isIsr)) {
1720
+ headers.delete(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER);
1721
+ }
1722
+ // If cache control is already set on the response we don't
1723
+ // override it to allow users to customize it via next.config
1724
+ if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {
1725
+ headers.set('Cache-Control', (0,next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__.getCacheControlHeader)(cacheEntry.cacheControl));
1726
+ }
1727
+ 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'.
1728
+ new Response(cacheEntry.value.body, {
1729
+ headers,
1730
+ status: cacheEntry.value.status || 200
1731
+ }));
1732
+ return;
1733
+ } catch (err) {
1734
+ if (!(err instanceof next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError)) {
1735
+ const silenceLog = false;
1736
+ await routeModule.onRequestError(req, err, {
1737
+ routerKind: 'App Router',
1738
+ routePath: normalizedSrcPage,
1739
+ routeType: 'route',
1740
+ revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
1741
+ isStaticGeneration: cacheKey !== null,
1742
+ isOnDemandRevalidate
1743
+ })
1744
+ }, silenceLog, routerServerContext);
1745
+ }
1746
+ // rethrow so that we can handle serving error page
1747
+ // If this is during static generation, throw the error again.
1748
+ if (isIsr) throw err;
1749
+ // Otherwise, send a 500 response unless the original response has
1750
+ // already committed. In that case, preserve its status code for
1751
+ // telemetry while still recording the failure and terminating a response
1752
+ // that the failed pipeline left open.
1753
+ if (res.headersSent) {
1754
+ if (currentSpan) {
1755
+ const error = err instanceof Error ? err : new Error('Unknown app route error');
1756
+ currentSpan.recordException(error);
1757
+ currentSpan.setStatus({
1758
+ code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR,
1759
+ message: error.message
1760
+ });
1761
+ currentSpan.setAttribute('error.type', error.name);
1659
1762
  }
1660
- } catch (err) {
1661
- (0,mcp_servers/* setMcpServerError */.KA)(row.name, `bad spec: ${(0,error/* errorMessage */.g)(err)}`);
1662
- continue;
1763
+ if (!res.writableEnded && !res.destroyed) {
1764
+ res.end();
1765
+ }
1766
+ } else {
1767
+ await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, new Response(null, {
1768
+ status: 500
1769
+ }));
1663
1770
  }
1664
- try {
1665
- const client = new MCPAdapter({
1666
- servers: {
1667
- [row.name]: serverConfig
1668
- },
1669
- throwOnLoadError: false,
1670
- prefixToolNameWithServerName: false,
1671
- onConnectionError: "throw",
1672
- afterToolCall: includeMcpStructuredContent
1771
+ return;
1772
+ } finally{
1773
+ ;
1774
+ (()=>{
1775
+ if (!currentSpan) {
1776
+ return;
1777
+ }
1778
+ let statusCode = res.statusCode;
1779
+ currentSpan.setAttributes({
1780
+ 'http.status_code': statusCode,
1781
+ 'next.rsc': false
1673
1782
  });
1674
- const serverTools = await client.listTools();
1675
- tools.push(...serverTools);
1676
- for (const t of serverTools){
1677
- const raw = t.metadata ?? {};
1678
- // @langchain/mcp-adapters may nest annotations under metadata.annotations
1679
- // or spread them directly into metadata — handle both shapes.
1680
- const ann = raw.annotations ?? raw;
1681
- newMeta.set(t.name, {
1682
- category: typeof ann.category === "string" ? ann.category : undefined,
1683
- group: typeof ann.group === "string" ? ann.group : undefined,
1684
- credentials_required: Array.isArray(ann.credentials_required) ? ann.credentials_required.filter((c)=>typeof c === "string") : undefined,
1685
- integration: typeof ann.integration === "string" ? ann.integration : undefined,
1686
- server_name: row.name
1783
+ if (statusCode && statusCode >= 500) {
1784
+ // For 5xx status codes: SHOULD be set to 'Error' span status.
1785
+ // x-ref: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
1786
+ currentSpan.setStatus({
1787
+ code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR
1687
1788
  });
1789
+ // For span status 'Error', SHOULD set 'error.type' attribute.
1790
+ currentSpan.setAttribute('error.type', statusCode.toString());
1688
1791
  }
1689
- subClients.push(client);
1690
- (0,mcp_servers/* setMcpServerError */.KA)(row.name, null);
1691
- } catch (err) {
1692
- const msg = (0,error/* errorMessage */.g)(err);
1693
- console.error(`[mcp] server "${row.name}" failed:`, msg);
1694
- (0,mcp_servers/* setMcpServerError */.KA)(row.name, msg);
1695
- }
1792
+ const rootSpanAttributes = tracer.getRootSpanAttributes();
1793
+ // We were unable to get attributes, probably OTEL is not enabled
1794
+ if (!rootSpanAttributes) {
1795
+ return;
1796
+ }
1797
+ if (rootSpanAttributes.get('next.span_type') !== next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest) {
1798
+ console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);
1799
+ return;
1800
+ }
1801
+ const route = rootSpanAttributes.get('next.route') || normalizedSrcPage;
1802
+ const name = `${method} ${route}`;
1803
+ currentSpan.setAttributes({
1804
+ 'next.route': route,
1805
+ 'http.route': route,
1806
+ 'next.span_name': name
1807
+ });
1808
+ currentSpan.updateName(name);
1809
+ // Propagate http.route to the request's root span if it isn't the
1810
+ // request span (e.g. a platform-created HTTP span in adapter
1811
+ // deployments).
1812
+ if (requestRootSpan && requestRootSpan !== currentSpan) {
1813
+ requestRootSpan.setAttribute('http.route', route);
1814
+ requestRootSpan.updateName(name);
1815
+ }
1816
+ })();
1696
1817
  }
1697
- // If invalidateMcpTools() was called while we were connecting, our results
1698
- // are stale — discard them and let the next caller reconnect fresh.
1699
- if (generation !== myGen) return cachedTools ?? [];
1700
- // Atomically replace metadata so callers never see a partial update.
1701
- mcpToolMeta.clear();
1702
- for (const [k, v] of newMeta)mcpToolMeta.set(k, v);
1703
- activeClient = {
1704
- close: async ()=>{
1705
- await Promise.allSettled(subClients.map((c)=>c.close()));
1706
- }
1707
- };
1708
- cachedTools = tools;
1709
- cacheKey = key;
1710
- return tools;
1711
- })();
1712
- try {
1713
- return await pending;
1714
- } finally{
1715
- pending = null;
1716
- }
1717
- }
1718
- // Called by API endpoints when a server is added/edited/deleted/toggled so
1719
- // the next getAllTools() call re-resolves connections.
1720
- function invalidateMcpTools() {
1721
- cachedTools = null;
1722
- cacheKey = "";
1723
- pending = null; // clear dedup guard so the next caller starts a fresh connect
1724
- generation++; // signal any in-flight promise to discard its writes
1725
- // mcpToolMeta intentionally NOT cleared: stale metadata (category, group,
1726
- // credentials_required) is better than empty during the reconnect window —
1727
- // the credentials badge stays visible instead of silently disappearing.
1728
- // The map is replaced atomically once the new connection completes.
1729
- if (activeClient) {
1730
- activeClient.close().catch(()=>{});
1731
- activeClient = null;
1732
- }
1733
- }
1734
- // ── Subprocess environment ──────────────────────────────────────────────────
1735
- // Be transparent: whatever the host can reach, the subprocess can reach.
1736
- //
1737
- // Why this design:
1738
- // - On a clean machine (no JFrog, no special config), uv/npm fall through to
1739
- // their public defaults. Nothing extra needed.
1740
- // - On a corporate machine (JFrog or Artifactory in env / ~/.config/uv/uv.toml /
1741
- // ~/.npmrc), public PyPI/npm are usually blocked at the network layer.
1742
- // The user's existing config is the ONLY thing that works — so inherit it.
1743
- // - Per-server overrides still work: spec.env wins over inherited env, so a
1744
- // user who wants this specific server pinned to a custom registry can do
1745
- // so without affecting everything else.
1746
- //
1747
- // The MCP SDK's default behavior (a curated minimal env) breaks corporate
1748
- // installs because it strips registry env vars; we explicitly opt out of that.
1749
- // Only a few env vars are worth scrubbing — the ones that actively confuse
1750
- // stdio MCP processes or leak our internal state. Everything else flows.
1751
- const SCRUBBED_VARS = new Set([
1752
- // Our own DB path — irrelevant to MCP servers, and exposes our layout.
1753
- "JARELA_DB_DIR",
1754
- // Defensive: don't leak npm/yarn auth tokens into a stdio child unless
1755
- // the server explicitly opted in via spec.env. (Most public MCP packages
1756
- // don't need auth to install.)
1757
- "NPM_TOKEN",
1758
- "NODE_AUTH_TOKEN"
1759
- ]);
1760
- function buildSubprocessEnv(userEnv) {
1761
- const out = {};
1762
- // 1. Inherit the host process env wholesale. This carries through:
1763
- // - PATH (so uvx, npx, python, node are findable)
1764
- // - HOME (so uv/pip/npm read user-level config files like ~/.config/uv/uv.toml,
1765
- // ~/.npmrc, ~/.pip/pip.conf — which may pin JFrog, Artifactory, etc.)
1766
- // - HTTP_PROXY / HTTPS_PROXY / NO_PROXY (corporate proxy routing)
1767
- // - UV_INDEX_URL / PIP_INDEX_URL / npm_config_registry if the user set
1768
- // them — letting their JFrog or Artifactory setup work transparently
1769
- // - Locale, terminal, etc.
1770
- for (const [k, v] of Object.entries(process.env)){
1771
- if (typeof v !== "string") continue;
1772
- if (SCRUBBED_VARS.has(k)) continue;
1773
- out[k] = v;
1774
- }
1775
- // 1b. Merge in the env-sync full shell-env snapshot (lib/tools/subprocess-env.ts).
1776
- // Covers vars the user's rc files export that never made it into
1777
- // Jarela's own process.env — e.g. running as a launchd/systemd service.
1778
- for (const [k, v] of Object.entries((0,subprocess_env/* getFullShellEnv */.l9)())){
1779
- if (SCRUBBED_VARS.has(k)) continue;
1780
- out[k] = v;
1781
- }
1782
- // 2. Inject env-sync-managed credentials from the encrypted integration
1783
- // store. Service-mode installs (launchd, systemd, brew services)
1784
- // start with no shell env, so ANTHROPIC_API_KEY / GITHUB_TOKEN / …
1785
- // have to come from the store or downstream tools see nothing. This
1786
- // layer goes after process.env so that when the store has been
1787
- // refreshed by env-sync, the new value wins over a stale shell
1788
- // export.
1789
- for (const [k, v] of Object.entries((0,allowlist/* getInjectedSubprocessEnv */.xJ)())){
1790
- out[k] = v;
1791
- }
1792
- // 3. Per-server spec.env layered on top — user's explicit config always
1793
- // wins. Use this to (a) supply API keys, (b) pin THIS server to a
1794
- // specific registry without affecting the rest, or (c) unset something
1795
- // via empty string.
1796
- for (const [k, v] of Object.entries(userEnv)){
1797
- if (typeof v === "string") out[k] = v;
1818
+ };
1819
+ // When invoked directly, the request span was started before `prepare`;
1820
+ // record the request target as normalized by it. next-server's request span
1821
+ // already has it.
1822
+ if (!isWrappedByNextServer && req.url !== undefined) {
1823
+ requestSpan == null ? void 0 : requestSpan.setAttribute('http.target', req.url);
1798
1824
  }
1799
- return out;
1825
+ await handleResponse(requestSpan);
1800
1826
  }
1801
1827
 
1828
+ //# sourceMappingURL=app-route.js.map
1802
1829
 
1803
- /***/ }),
1804
-
1805
- /***/ 781630:
1806
- /***/ ((module) => {
1807
-
1808
- module.exports = require("http");
1809
-
1810
- /***/ }),
1811
-
1812
- /***/ 848161:
1813
- /***/ ((module) => {
1814
-
1815
- module.exports = require("node:os");
1816
-
1817
- /***/ }),
1818
-
1819
- /***/ 903295:
1820
- /***/ ((module) => {
1821
-
1822
- module.exports = require("next/dist/server/app-render/after-task-async-storage.external.js");
1823
-
1824
- /***/ }),
1825
-
1826
- /***/ 927910:
1827
- /***/ ((module) => {
1828
-
1829
- module.exports = require("stream");
1830
1830
 
1831
1831
  /***/ }),
1832
1832
 
@@ -1872,7 +1872,7 @@ module.exports = require("next/dist/shared/lib/no-fallback-error.external");
1872
1872
  var __webpack_require__ = require("../../../../../webpack-runtime.js");
1873
1873
  __webpack_require__.C(exports);
1874
1874
  var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
1875
- var __webpack_exports__ = __webpack_require__.X(0, [2970,7377,1813,4891,4992,1244], () => (__webpack_exec__(521907)));
1875
+ var __webpack_exports__ = __webpack_require__.X(0, [2970,7377,1813,4891,4992,1244], () => (__webpack_exec__(931768)));
1876
1876
  module.exports = __webpack_exports__;
1877
1877
 
1878
1878
  })();