@circuitwall/jarela 2.2.1 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (651) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-path-routes-manifest.json +6 -5
  3. package/.next/standalone/.next/build-manifest.json +2 -2
  4. package/.next/standalone/.next/prerender-manifest.json +3 -3
  5. package/.next/standalone/.next/routes-manifest.json +8 -0
  6. package/.next/standalone/.next/server/app/_global-error/page.js +68 -68
  7. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_not-found/page.js +76 -76
  14. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/standalone/.next/server/app/_not-found.html +2 -2
  16. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  17. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  18. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  19. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  20. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  21. package/.next/standalone/.next/server/app/api/v1/access/[identity]/route.js +93 -93
  22. package/.next/standalone/.next/server/app/api/v1/access/route.js +169 -169
  23. package/.next/standalone/.next/server/app/api/v1/agents/[id]/compact/route.js +82 -56
  24. package/.next/standalone/.next/server/app/api/v1/agents/[id]/compact/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/api/v1/agents/[id]/display-filters/route.js +122 -122
  26. package/.next/standalone/.next/server/app/api/v1/agents/[id]/route.js +100 -100
  27. package/.next/standalone/.next/server/app/api/v1/agents/[id]/thread/route.js +753 -753
  28. package/.next/standalone/.next/server/app/api/v1/agents/route.js +65 -65
  29. package/.next/standalone/.next/server/app/api/v1/allowed-sites/[hostname]/route.js +364 -364
  30. package/.next/standalone/.next/server/app/api/v1/allowed-sites/route.js +802 -802
  31. package/.next/standalone/.next/server/app/api/v1/artifacts/lifecycle/route.js +2 -2
  32. package/.next/standalone/.next/server/app/api/v1/attachments/files/route.js +49 -49
  33. package/.next/standalone/.next/server/app/api/v1/attachments/images/route.js +910 -910
  34. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js +589 -16
  35. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/ignores/[remote_jid]/route.js +23 -23
  37. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/ignores/route.js +30 -30
  38. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js +703 -130
  39. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js.nft.json +1 -1
  40. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js +708 -135
  41. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js +802 -229
  43. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/routes/[route_id]/route.js +739 -739
  45. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/routes/route.js +1035 -1035
  46. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js +679 -106
  47. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/api/v1/bridges/kinds/route.js +804 -804
  49. package/.next/standalone/.next/server/app/api/v1/bridges/route.js +700 -700
  50. package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js +9 -9
  51. package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js.nft.json +1 -1
  52. package/.next/standalone/.next/server/app/api/v1/config/route.js +85 -85
  53. package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js +709 -709
  54. package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js.nft.json +1 -1
  55. package/.next/standalone/.next/server/app/api/v1/credentials/route.js +2 -2
  56. package/.next/standalone/.next/server/app/api/v1/credentials/route.js.nft.json +1 -1
  57. package/.next/standalone/.next/server/app/api/v1/dashboard/currency/route.js +10 -10
  58. package/.next/standalone/.next/server/app/api/v1/dashboard/metrics/route.js +784 -784
  59. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing/route.js +23 -23
  60. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js +86 -86
  61. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js.nft.json +1 -1
  62. package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js +57 -57
  63. package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js.nft.json +1 -1
  64. package/.next/standalone/.next/server/app/api/v1/documents/search/route.js +523 -523
  65. package/.next/standalone/.next/server/app/api/v1/documents/settings/route.js +44 -44
  66. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js +65 -65
  67. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js.nft.json +1 -1
  68. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js +122 -122
  69. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js.nft.json +1 -1
  70. package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js +37 -37
  71. package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js.nft.json +1 -1
  72. package/.next/standalone/.next/server/app/api/v1/env/route.js +9 -9
  73. package/.next/standalone/.next/server/app/api/v1/env-sync/allowlist/route.js +368 -368
  74. package/.next/standalone/.next/server/app/api/v1/env-sync/route.js +44 -44
  75. package/.next/standalone/.next/server/app/api/v1/events/route.js +751 -178
  76. package/.next/standalone/.next/server/app/api/v1/events/route.js.nft.json +1 -1
  77. package/.next/standalone/.next/server/app/api/v1/events/test/route.js +77 -77
  78. package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js +763 -763
  79. package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js.nft.json +1 -1
  80. package/.next/standalone/.next/server/app/api/v1/extension/browser/activate/route.js +44 -44
  81. package/.next/standalone/.next/server/app/api/v1/extension/browser/foreground/route.js +9 -9
  82. package/.next/standalone/.next/server/app/api/v1/extension/browser/history/route.js +65 -65
  83. package/.next/standalone/.next/server/app/api/v1/extension/browser/poll/route.js +34 -34
  84. package/.next/standalone/.next/server/app/api/v1/extension/browser/progress/route.js +204 -204
  85. package/.next/standalone/.next/server/app/api/v1/extension/browser/result/route.js +133 -133
  86. package/.next/standalone/.next/server/app/api/v1/extension/browser/retry/route.js +106 -106
  87. package/.next/standalone/.next/server/app/api/v1/extension/browser/status/route.js +114 -114
  88. package/.next/standalone/.next/server/app/api/v1/extension/browser/tabs/route.js +134 -134
  89. package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js +690 -690
  90. package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js.nft.json +1 -1
  91. package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js +93 -93
  92. package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js.nft.json +1 -1
  93. package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js +9 -9
  94. package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js.nft.json +1 -1
  95. package/.next/standalone/.next/server/app/api/v1/extensions/route.js +185 -185
  96. package/.next/standalone/.next/server/app/api/v1/extensions/route.js.nft.json +1 -1
  97. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js +171 -171
  98. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js.nft.json +1 -1
  99. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js +396 -396
  100. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js.nft.json +1 -1
  101. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js +212 -212
  102. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js.nft.json +1 -1
  103. package/.next/standalone/.next/server/app/api/v1/files/[name]/route.js +235 -235
  104. package/.next/standalone/.next/server/app/api/v1/fs/browse/route.js +26 -26
  105. package/.next/standalone/.next/server/app/api/v1/harnesses/[id]/route.js +221 -221
  106. package/.next/standalone/.next/server/app/api/v1/harnesses/default/route.js +58 -58
  107. package/.next/standalone/.next/server/app/api/v1/harnesses/route.js +72 -72
  108. package/.next/standalone/.next/server/app/api/v1/health/probes/route.js +9 -9
  109. package/.next/standalone/.next/server/app/api/v1/health/probes/route.js.nft.json +1 -1
  110. package/.next/standalone/.next/server/app/api/v1/health/route.js +772 -772
  111. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/route.js +133 -133
  112. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js +9 -9
  113. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js.nft.json +1 -1
  114. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/callback/route.js +363 -363
  115. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/start/route.js +233 -233
  116. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/status/route.js +682 -682
  117. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/callback/route.js +879 -879
  118. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/start/route.js +108 -108
  119. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/status/route.js +952 -952
  120. package/.next/standalone/.next/server/app/api/v1/integrations/route.js +216 -216
  121. package/.next/standalone/.next/server/app/api/v1/lifecycle/adoption/route.js +864 -847
  122. package/.next/standalone/.next/server/app/api/v1/lifecycle/adoption/route.js.nft.json +1 -1
  123. package/.next/standalone/.next/server/app/api/v1/local-file/route.js +26 -26
  124. package/.next/standalone/.next/server/app/api/v1/logs/route.js +70 -70
  125. package/.next/standalone/.next/server/app/api/v1/maps/embed/route.js +72 -72
  126. package/.next/standalone/.next/server/app/api/v1/mcp-servers/[name]/route.js +979 -979
  127. package/.next/standalone/.next/server/app/api/v1/mcp-servers/registry/route.js +196 -196
  128. package/.next/standalone/.next/server/app/api/v1/mcp-servers/route.js +2 -2
  129. package/.next/standalone/.next/server/app/api/v1/memory/[namespace]/[key]/route.js +381 -381
  130. package/.next/standalone/.next/server/app/api/v1/memory/policy/route.js +79 -79
  131. package/.next/standalone/.next/server/app/api/v1/memory/route.js +51 -51
  132. package/.next/standalone/.next/server/app/api/v1/memory/search/route.js +131 -131
  133. package/.next/standalone/.next/server/app/api/v1/models/[name]/compact-threads/route.js +374 -369
  134. package/.next/standalone/.next/server/app/api/v1/models/[name]/compact-threads/route.js.nft.json +1 -1
  135. package/.next/standalone/.next/server/app/api/v1/models/[name]/route.js +143 -143
  136. package/.next/standalone/.next/server/app/api/v1/models/route.js +543 -543
  137. package/.next/standalone/.next/server/app/api/v1/packages/catalog/route.js +445 -445
  138. package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js +120 -120
  139. package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js.nft.json +1 -1
  140. package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js +234 -234
  141. package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js.nft.json +1 -1
  142. package/.next/standalone/.next/server/app/api/v1/packages/install/route.js +407 -407
  143. package/.next/standalone/.next/server/app/api/v1/packages/install/route.js.nft.json +1 -1
  144. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js +37 -37
  145. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js.nft.json +1 -1
  146. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js +107 -107
  147. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js.nft.json +1 -1
  148. package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js +228 -228
  149. package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js.nft.json +1 -1
  150. package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js +9 -9
  151. package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js.nft.json +1 -1
  152. package/.next/standalone/.next/server/app/api/v1/packages/route.js +148 -148
  153. package/.next/standalone/.next/server/app/api/v1/packages/route.js.nft.json +1 -1
  154. package/.next/standalone/.next/server/app/api/v1/page-capture/route.js +787 -787
  155. package/.next/standalone/.next/server/app/api/v1/page-capture/route.js.nft.json +1 -1
  156. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js +507 -507
  157. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js.nft.json +1 -1
  158. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js +181 -181
  159. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js.nft.json +1 -1
  160. package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js +258 -258
  161. package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js.nft.json +1 -1
  162. package/.next/standalone/.next/server/app/api/v1/profile/location/route.js +30 -30
  163. package/.next/standalone/.next/server/app/api/v1/profile/route.js +164 -164
  164. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/models/route.js +44 -44
  165. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/probe/route.js +9 -9
  166. package/.next/standalone/.next/server/app/api/v1/providers/github-copilot/auth/route.js +164 -164
  167. package/.next/standalone/.next/server/app/api/v1/providers/route.js +94 -94
  168. package/.next/standalone/.next/server/app/api/v1/proxy-config/route.js +450 -450
  169. package/.next/standalone/.next/server/app/api/v1/redaction/init/route.js +37 -37
  170. package/.next/standalone/.next/server/app/api/v1/redaction/route.js +58 -58
  171. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/route.js +600 -600
  172. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js +44 -44
  173. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js.nft.json +1 -1
  174. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/route.js +732 -732
  175. package/.next/standalone/.next/server/app/api/v1/security/idle-timeout/route.js +359 -359
  176. package/.next/standalone/.next/server/app/api/v1/security/pin/route.js +197 -197
  177. package/.next/standalone/.next/server/app/api/v1/security/state/route.js +51 -51
  178. package/.next/standalone/.next/server/app/api/v1/security/unlock/route.js +176 -176
  179. package/.next/standalone/.next/server/app/api/v1/security/verify-pin/route.js +190 -190
  180. package/.next/standalone/.next/server/app/api/v1/setup/test-key/route.js +26 -26
  181. package/.next/standalone/.next/server/app/api/v1/skills/[id]/route.js +770 -770
  182. package/.next/standalone/.next/server/app/api/v1/skills/repos/[id]/route.js +115 -115
  183. package/.next/standalone/.next/server/app/api/v1/skills/repos/route.js +327 -327
  184. package/.next/standalone/.next/server/app/api/v1/skills/route.js +870 -870
  185. package/.next/standalone/.next/server/app/api/v1/system/abort/route.js +838 -808
  186. package/.next/standalone/.next/server/app/api/v1/system/restart/route.js +177 -177
  187. package/.next/standalone/.next/server/app/api/v1/system/restart/route.js.nft.json +1 -1
  188. package/.next/standalone/.next/server/app/api/v1/tailscale/route.js +164 -164
  189. package/.next/standalone/.next/server/app/api/v1/tasks/[agent_id]/route.js +115 -115
  190. package/.next/standalone/.next/server/app/api/v1/tasks/route.js +23 -23
  191. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route.js +1429 -0
  192. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route.js.nft.json +1 -0
  193. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route_client-reference-manifest.js +1 -0
  194. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/context-pin/route.js +635 -634
  195. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/context-pin/route.js.nft.json +1 -1
  196. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/route.js +53 -439
  197. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/route.js.nft.json +1 -1
  198. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js +172 -172
  199. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js.nft.json +1 -1
  200. package/.next/standalone/.next/server/app/api/v1/threads/route.js +908 -908
  201. package/.next/standalone/.next/server/app/api/v1/tools/route.js +2 -2
  202. package/.next/standalone/.next/server/app/api/v1/tools/route.js.nft.json +1 -1
  203. package/.next/standalone/.next/server/app/api/v1/update/apply/route.js +17 -17
  204. package/.next/standalone/.next/server/app/api/v1/update/apply/route.js.nft.json +1 -1
  205. package/.next/standalone/.next/server/app/api/v1/update/route.js +570 -570
  206. package/.next/standalone/.next/server/app/api/v1/voice/transcribe/route.js +224 -224
  207. package/.next/standalone/.next/server/app/api/v1/voice/tts/route.js +975 -975
  208. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/route.js +23 -23
  209. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js +72 -72
  210. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js.nft.json +1 -1
  211. package/.next/standalone/.next/server/app/api/v1/watchers/reaction-scripts/route.js +128 -128
  212. package/.next/standalone/.next/server/app/api/v1/watchers/route.js +164 -164
  213. package/.next/standalone/.next/server/app/api/v1/watchers/route.js.nft.json +1 -1
  214. package/.next/standalone/.next/server/app/icon.svg/route.js +62 -62
  215. package/.next/standalone/.next/server/app/manifest.webmanifest/route.js +436 -436
  216. package/.next/standalone/.next/server/app/page.js +1243 -854
  217. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  218. package/.next/standalone/.next/server/app/setup/page.js +91 -91
  219. package/.next/standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  220. package/.next/standalone/.next/server/app-paths-manifest.json +6 -5
  221. package/.next/standalone/.next/server/chunks/{424.js → 1388.js} +335 -986
  222. package/.next/standalone/.next/server/chunks/1433.js +1 -1
  223. package/.next/standalone/.next/server/chunks/1638.js +1 -2
  224. package/.next/standalone/.next/server/chunks/1738.js +1 -1
  225. package/.next/standalone/.next/server/chunks/210.js +6 -6
  226. package/.next/standalone/.next/server/chunks/2151.js +31 -1
  227. package/.next/standalone/.next/server/chunks/2207.js +1 -0
  228. package/.next/standalone/.next/server/chunks/2471.js +28 -28
  229. package/.next/standalone/.next/server/chunks/2504.js +1 -1
  230. package/.next/standalone/.next/server/chunks/2695.js +17 -17
  231. package/.next/standalone/.next/server/chunks/3042.js +14 -8
  232. package/.next/standalone/.next/server/chunks/3399.js +1 -1
  233. package/.next/standalone/.next/server/chunks/3566.js +1 -1
  234. package/.next/standalone/.next/server/chunks/4189.js +946 -0
  235. package/.next/standalone/.next/server/chunks/{9590.js → 423.js} +8 -3
  236. package/.next/standalone/.next/server/chunks/4433.js +146 -146
  237. package/.next/standalone/.next/server/chunks/4508.js +1 -1
  238. package/.next/standalone/.next/server/chunks/4588.js +1 -0
  239. package/.next/standalone/.next/server/chunks/46.js +5 -0
  240. package/.next/standalone/.next/server/chunks/466.js +12 -0
  241. package/.next/standalone/.next/server/chunks/4868.js +206 -206
  242. package/.next/standalone/.next/server/chunks/4992.js +13 -0
  243. package/.next/standalone/.next/server/chunks/5120.js +963 -0
  244. package/.next/standalone/.next/server/chunks/5701.js +1 -1
  245. package/.next/standalone/.next/server/chunks/5900.js +1 -1
  246. package/.next/standalone/.next/server/chunks/6210.js +1 -0
  247. package/.next/standalone/.next/server/chunks/6213.js +1 -1
  248. package/.next/standalone/.next/server/chunks/6649.js +2 -2
  249. package/.next/standalone/.next/server/chunks/6703.js +3 -3
  250. package/.next/standalone/.next/server/chunks/7445.js +1 -0
  251. package/.next/standalone/.next/server/chunks/8067.js +12 -0
  252. package/.next/standalone/.next/server/chunks/8461.js +14 -9
  253. package/.next/standalone/.next/server/chunks/8558.js +1 -1
  254. package/.next/standalone/.next/server/chunks/8724.js +1 -1
  255. package/.next/standalone/.next/server/chunks/8849.js +91 -91
  256. package/.next/standalone/.next/server/chunks/9032.js +6 -5
  257. package/.next/standalone/.next/server/chunks/{2563.js → 9164.js} +33173 -31461
  258. package/.next/standalone/.next/server/chunks/9237.js +396 -396
  259. package/.next/standalone/.next/server/chunks/{9640.js → 9304.js} +1628 -570
  260. package/.next/standalone/.next/server/chunks/9406.js +1 -1
  261. package/.next/standalone/.next/server/chunks/9824.js +98 -98
  262. package/.next/standalone/.next/server/chunks/9826.js +1 -0
  263. package/.next/standalone/.next/server/middleware-build-manifest.js +2 -2
  264. package/.next/standalone/.next/server/middleware.js +415 -397
  265. package/.next/standalone/.next/server/pages/404.html +2 -2
  266. package/.next/standalone/.next/server/pages/500.html +1 -1
  267. package/.next/standalone/.next/server/preview-props.json +3 -3
  268. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  269. package/.next/standalone/.next/static/chunks/{1395-a340fb0a345382a4.js → 1395-e4a99912b8f83044.js} +13 -1
  270. package/.next/standalone/.next/static/chunks/app/_global-error/{page-36cb8b428b38b26a.js → page-6fc5f8e744c81802.js} +1 -1
  271. package/.next/standalone/.next/static/chunks/app/api/v1/access/[identity]/{route-36cb8b428b38b26a.js → route-6fc5f8e744c81802.js} +1 -1
  272. package/.next/standalone/.next/static/chunks/app/api/v1/access/{route-36cb8b428b38b26a.js → route-6fc5f8e744c81802.js} +1 -1
  273. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/compact/{route-36cb8b428b38b26a.js → route-6fc5f8e744c81802.js} +1 -1
  274. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/display-filters/route-6fc5f8e744c81802.js +17 -0
  275. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/route-6fc5f8e744c81802.js +17 -0
  276. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/thread/route-6fc5f8e744c81802.js +17 -0
  277. package/.next/standalone/.next/static/chunks/app/api/v1/agents/route-6fc5f8e744c81802.js +17 -0
  278. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/[hostname]/route-6fc5f8e744c81802.js +17 -0
  279. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/route-6fc5f8e744c81802.js +17 -0
  280. package/.next/standalone/.next/static/chunks/app/api/v1/artifacts/lifecycle/route-6fc5f8e744c81802.js +17 -0
  281. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/files/route-6fc5f8e744c81802.js +17 -0
  282. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/images/route-6fc5f8e744c81802.js +17 -0
  283. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/chats/route-6fc5f8e744c81802.js +17 -0
  284. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/[remote_jid]/route-6fc5f8e744c81802.js +17 -0
  285. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/route-6fc5f8e744c81802.js +17 -0
  286. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/lookup/route-6fc5f8e744c81802.js +17 -0
  287. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/pair/route-6fc5f8e744c81802.js +17 -0
  288. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/route-6fc5f8e744c81802.js +17 -0
  289. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/[route_id]/route-6fc5f8e744c81802.js +17 -0
  290. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/route-6fc5f8e744c81802.js +17 -0
  291. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/status/route-6fc5f8e744c81802.js +17 -0
  292. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/kinds/route-6fc5f8e744c81802.js +17 -0
  293. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/route-6fc5f8e744c81802.js +17 -0
  294. package/.next/standalone/.next/static/chunks/app/api/v1/builtin-tools/route-6fc5f8e744c81802.js +17 -0
  295. package/.next/standalone/.next/static/chunks/app/api/v1/config/route-6fc5f8e744c81802.js +17 -0
  296. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/[id]/route-6fc5f8e744c81802.js +17 -0
  297. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/route-6fc5f8e744c81802.js +17 -0
  298. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/currency/route-6fc5f8e744c81802.js +17 -0
  299. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/metrics/route-6fc5f8e744c81802.js +17 -0
  300. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing/route-6fc5f8e744c81802.js +17 -0
  301. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing-task/route-6fc5f8e744c81802.js +17 -0
  302. package/.next/standalone/.next/static/chunks/app/api/v1/delegations/codex/[job_id]/route-6fc5f8e744c81802.js +17 -0
  303. package/.next/standalone/.next/static/chunks/app/api/v1/documents/search/route-6fc5f8e744c81802.js +17 -0
  304. package/.next/standalone/.next/static/chunks/app/api/v1/documents/settings/route-6fc5f8e744c81802.js +17 -0
  305. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/reindex/route-6fc5f8e744c81802.js +17 -0
  306. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/route-6fc5f8e744c81802.js +17 -0
  307. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/route-6fc5f8e744c81802.js +17 -0
  308. package/.next/standalone/.next/static/chunks/app/api/v1/env/route-6fc5f8e744c81802.js +17 -0
  309. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/allowlist/route-6fc5f8e744c81802.js +17 -0
  310. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/route-6fc5f8e744c81802.js +17 -0
  311. package/.next/standalone/.next/static/chunks/app/api/v1/events/route-6fc5f8e744c81802.js +17 -0
  312. package/.next/standalone/.next/static/chunks/app/api/v1/events/test/route-6fc5f8e744c81802.js +17 -0
  313. package/.next/standalone/.next/static/chunks/app/api/v1/extension/agents/route-6fc5f8e744c81802.js +17 -0
  314. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/activate/route-6fc5f8e744c81802.js +17 -0
  315. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/foreground/route-6fc5f8e744c81802.js +17 -0
  316. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/history/route-6fc5f8e744c81802.js +17 -0
  317. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/poll/route-6fc5f8e744c81802.js +17 -0
  318. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/progress/route-6fc5f8e744c81802.js +17 -0
  319. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/result/route-6fc5f8e744c81802.js +17 -0
  320. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/retry/route-6fc5f8e744c81802.js +17 -0
  321. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/status/route-6fc5f8e744c81802.js +17 -0
  322. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/tabs/route-6fc5f8e744c81802.js +17 -0
  323. package/.next/standalone/.next/static/chunks/app/api/v1/extension/fill/route-6fc5f8e744c81802.js +17 -0
  324. package/.next/standalone/.next/static/chunks/app/api/v1/extension/refine/route-6fc5f8e744c81802.js +17 -0
  325. package/.next/standalone/.next/static/chunks/app/api/v1/extension/turn/route-6fc5f8e744c81802.js +17 -0
  326. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/route-6fc5f8e744c81802.js +17 -0
  327. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/config/route-6fc5f8e744c81802.js +17 -0
  328. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/route-6fc5f8e744c81802.js +17 -0
  329. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/secrets/route-6fc5f8e744c81802.js +17 -0
  330. package/.next/standalone/.next/static/chunks/app/api/v1/files/[name]/route-6fc5f8e744c81802.js +17 -0
  331. package/.next/standalone/.next/static/chunks/app/api/v1/fs/browse/route-6fc5f8e744c81802.js +17 -0
  332. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/[id]/route-6fc5f8e744c81802.js +17 -0
  333. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/default/route-6fc5f8e744c81802.js +17 -0
  334. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/route-6fc5f8e744c81802.js +17 -0
  335. package/.next/standalone/.next/static/chunks/app/api/v1/health/probes/route-6fc5f8e744c81802.js +17 -0
  336. package/.next/standalone/.next/static/chunks/app/api/v1/health/route-6fc5f8e744c81802.js +17 -0
  337. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/route-6fc5f8e744c81802.js +17 -0
  338. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/test/route-6fc5f8e744c81802.js +17 -0
  339. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/callback/route-6fc5f8e744c81802.js +17 -0
  340. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/start/route-6fc5f8e744c81802.js +17 -0
  341. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/status/route-6fc5f8e744c81802.js +17 -0
  342. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/callback/route-6fc5f8e744c81802.js +17 -0
  343. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/start/route-6fc5f8e744c81802.js +17 -0
  344. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/status/route-6fc5f8e744c81802.js +17 -0
  345. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/route-6fc5f8e744c81802.js +17 -0
  346. package/.next/standalone/.next/static/chunks/app/api/v1/lifecycle/adoption/route-6fc5f8e744c81802.js +17 -0
  347. package/.next/standalone/.next/static/chunks/app/api/v1/local-file/route-6fc5f8e744c81802.js +17 -0
  348. package/.next/standalone/.next/static/chunks/app/api/v1/logs/route-6fc5f8e744c81802.js +17 -0
  349. package/.next/standalone/.next/static/chunks/app/api/v1/maps/embed/route-6fc5f8e744c81802.js +17 -0
  350. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/[name]/route-6fc5f8e744c81802.js +17 -0
  351. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/registry/route-6fc5f8e744c81802.js +17 -0
  352. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/route-6fc5f8e744c81802.js +17 -0
  353. package/.next/standalone/.next/static/chunks/app/api/v1/memory/[namespace]/[key]/route-6fc5f8e744c81802.js +17 -0
  354. package/.next/standalone/.next/static/chunks/app/api/v1/memory/policy/route-6fc5f8e744c81802.js +17 -0
  355. package/.next/standalone/.next/static/chunks/app/api/v1/memory/route-6fc5f8e744c81802.js +17 -0
  356. package/.next/standalone/.next/static/chunks/app/api/v1/memory/search/route-6fc5f8e744c81802.js +17 -0
  357. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/compact-threads/route-6fc5f8e744c81802.js +17 -0
  358. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/route-6fc5f8e744c81802.js +17 -0
  359. package/.next/standalone/.next/static/chunks/app/api/v1/models/route-6fc5f8e744c81802.js +17 -0
  360. package/.next/standalone/.next/static/chunks/app/api/v1/packages/catalog/route-6fc5f8e744c81802.js +17 -0
  361. package/.next/standalone/.next/static/chunks/app/api/v1/packages/defaults/[id]/route-6fc5f8e744c81802.js +17 -0
  362. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/[id]/route-6fc5f8e744c81802.js +17 -0
  363. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/route-6fc5f8e744c81802.js +17 -0
  364. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/enabled/route-6fc5f8e744c81802.js +17 -0
  365. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/route-6fc5f8e744c81802.js +17 -0
  366. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/route-6fc5f8e744c81802.js +17 -0
  367. package/.next/standalone/.next/static/chunks/app/api/v1/packages/reload/route-6fc5f8e744c81802.js +17 -0
  368. package/.next/standalone/.next/static/chunks/app/api/v1/packages/route-6fc5f8e744c81802.js +17 -0
  369. package/.next/standalone/.next/static/chunks/app/api/v1/page-capture/route-6fc5f8e744c81802.js +17 -0
  370. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/approve/route-6fc5f8e744c81802.js +17 -0
  371. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/deny/route-6fc5f8e744c81802.js +17 -0
  372. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/route-6fc5f8e744c81802.js +17 -0
  373. package/.next/standalone/.next/static/chunks/app/api/v1/profile/location/route-6fc5f8e744c81802.js +17 -0
  374. package/.next/standalone/.next/static/chunks/app/api/v1/profile/route-6fc5f8e744c81802.js +17 -0
  375. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/models/route-6fc5f8e744c81802.js +17 -0
  376. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/probe/route-6fc5f8e744c81802.js +17 -0
  377. package/.next/standalone/.next/static/chunks/app/api/v1/providers/github-copilot/auth/route-6fc5f8e744c81802.js +17 -0
  378. package/.next/standalone/.next/static/chunks/app/api/v1/providers/route-6fc5f8e744c81802.js +17 -0
  379. package/.next/standalone/.next/static/chunks/app/api/v1/proxy-config/route-6fc5f8e744c81802.js +17 -0
  380. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/init/route-6fc5f8e744c81802.js +17 -0
  381. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/route-6fc5f8e744c81802.js +17 -0
  382. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/route-6fc5f8e744c81802.js +17 -0
  383. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/run/route-6fc5f8e744c81802.js +17 -0
  384. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/route-6fc5f8e744c81802.js +17 -0
  385. package/.next/standalone/.next/static/chunks/app/api/v1/security/idle-timeout/route-6fc5f8e744c81802.js +17 -0
  386. package/.next/standalone/.next/static/chunks/app/api/v1/security/pin/route-6fc5f8e744c81802.js +17 -0
  387. package/.next/standalone/.next/static/chunks/app/api/v1/security/state/route-6fc5f8e744c81802.js +17 -0
  388. package/.next/standalone/.next/static/chunks/app/api/v1/security/unlock/route-6fc5f8e744c81802.js +17 -0
  389. package/.next/standalone/.next/static/chunks/app/api/v1/security/verify-pin/route-6fc5f8e744c81802.js +17 -0
  390. package/.next/standalone/.next/static/chunks/app/api/v1/setup/test-key/route-6fc5f8e744c81802.js +17 -0
  391. package/.next/standalone/.next/static/chunks/app/api/v1/skills/[id]/route-6fc5f8e744c81802.js +17 -0
  392. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/[id]/route-6fc5f8e744c81802.js +17 -0
  393. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/route-6fc5f8e744c81802.js +17 -0
  394. package/.next/standalone/.next/static/chunks/app/api/v1/skills/route-6fc5f8e744c81802.js +17 -0
  395. package/.next/standalone/.next/static/chunks/app/api/v1/system/abort/route-6fc5f8e744c81802.js +17 -0
  396. package/.next/standalone/.next/static/chunks/app/api/v1/system/restart/route-6fc5f8e744c81802.js +17 -0
  397. package/.next/standalone/.next/static/chunks/app/api/v1/tailscale/route-6fc5f8e744c81802.js +17 -0
  398. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/[agent_id]/route-6fc5f8e744c81802.js +17 -0
  399. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/route-6fc5f8e744c81802.js +17 -0
  400. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/activity/route-6fc5f8e744c81802.js +17 -0
  401. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/context-pin/route-6fc5f8e744c81802.js +17 -0
  402. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/route-6fc5f8e744c81802.js +17 -0
  403. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/run/route-6fc5f8e744c81802.js +17 -0
  404. package/.next/standalone/.next/static/chunks/app/api/v1/threads/route-6fc5f8e744c81802.js +17 -0
  405. package/.next/standalone/.next/static/chunks/app/api/v1/tools/route-6fc5f8e744c81802.js +17 -0
  406. package/.next/standalone/.next/static/chunks/app/api/v1/update/apply/route-6fc5f8e744c81802.js +17 -0
  407. package/.next/standalone/.next/static/chunks/app/api/v1/update/route-6fc5f8e744c81802.js +17 -0
  408. package/.next/standalone/.next/static/chunks/app/api/v1/voice/transcribe/route-6fc5f8e744c81802.js +17 -0
  409. package/.next/standalone/.next/static/chunks/app/api/v1/voice/tts/route-6fc5f8e744c81802.js +17 -0
  410. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/route-6fc5f8e744c81802.js +17 -0
  411. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/run/route-6fc5f8e744c81802.js +17 -0
  412. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/reaction-scripts/route-6fc5f8e744c81802.js +17 -0
  413. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/route-6fc5f8e744c81802.js +17 -0
  414. package/.next/standalone/.next/static/chunks/app/manifest.webmanifest/route-6fc5f8e744c81802.js +17 -0
  415. package/.next/standalone/.next/static/chunks/app/{page-7017f07f8a7a083c.js → page-213a623b37226452.js} +1041 -652
  416. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-6fc5f8e744c81802.js +17 -0
  417. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-6fc5f8e744c81802.js +17 -0
  418. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-6fc5f8e744c81802.js +17 -0
  419. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-6fc5f8e744c81802.js +17 -0
  420. package/.next/standalone/.next/static/css/{d80058f0b9b41c09.css → 312542a5725ba0d5.css} +2 -2
  421. package/.next/standalone/docs/adoption/changesets.json +309 -0
  422. package/.next/standalone/lib/skills/builtins/memory-organization/SKILL.md +16 -0
  423. package/.next/standalone/package.json +3 -3
  424. package/CHANGELOG.md +25 -0
  425. package/api/client.ts +9 -0
  426. package/api/types.ts +29 -0
  427. package/app/api/v1/lifecycle/adoption/route.ts +14 -2
  428. package/app/api/v1/models/[name]/compact-threads/route.ts +14 -11
  429. package/app/api/v1/threads/[thread_id]/activity/route.ts +19 -0
  430. package/app/api/v1/threads/[thread_id]/context-pin/route.test.ts +1 -0
  431. package/app/api/v1/threads/[thread_id]/context-pin/route.ts +2 -1
  432. package/app/api/v1/threads/[thread_id]/route.ts +5 -1
  433. package/components/chat/ChatView.tsx +52 -11
  434. package/components/chat/ContextBoundary.test.tsx +68 -1
  435. package/components/chat/ContextBoundary.tsx +92 -13
  436. package/components/chat/MessageList.test.tsx +31 -0
  437. package/components/chat/MessageList.tsx +49 -28
  438. package/components/chat/ToolList.test.tsx +92 -16
  439. package/components/chat/ToolList.tsx +59 -4
  440. package/components/chat/chat-helpers.test.tsx +24 -1
  441. package/components/chat/chat-helpers.ts +47 -4
  442. package/components/chat/useThreadActivity.test.tsx +113 -0
  443. package/components/chat/useThreadActivity.ts +94 -0
  444. package/components/chat/useThreadData.ts +16 -16
  445. package/components/chat/workflow-step-retry.ts +25 -0
  446. package/components/ui/BootScreen.tsx +17 -0
  447. package/components/ui/WorkflowChecklist.tsx +71 -33
  448. package/hooks/useSSE.ts +28 -3
  449. package/lib/agents/compaction-pipeline.test.ts +202 -0
  450. package/lib/agents/compaction-pipeline.ts +483 -0
  451. package/lib/agents/conversation-summary.ts +37 -21
  452. package/lib/agents/prepare/history-window.test.ts +18 -0
  453. package/lib/agents/prepare/history-window.ts +11 -2
  454. package/lib/agents/prepare/request.ts +4 -0
  455. package/lib/agents/prepare/system-prompt.test.ts +39 -0
  456. package/lib/agents/prepare/system-prompt.ts +8 -3
  457. package/lib/agents/prompt-registry.test.ts +5 -140
  458. package/lib/agents/prompt-registry.ts +45 -1
  459. package/lib/agents/prompt-variants.ts +146 -0
  460. package/lib/agents/run-registry.test.ts +22 -0
  461. package/lib/agents/run-registry.ts +29 -0
  462. package/lib/agents/run-thread.retry.test.ts +67 -1
  463. package/lib/agents/run-thread.ts +86 -1
  464. package/lib/agents/thread-activity.test.ts +31 -0
  465. package/lib/agents/thread-activity.ts +27 -0
  466. package/lib/agents/thread-compaction-state.test.ts +82 -0
  467. package/lib/agents/thread-compaction-state.ts +121 -0
  468. package/lib/agents/thread-compaction.test.ts +83 -4
  469. package/lib/agents/thread-compaction.ts +34 -11
  470. package/lib/agents/warm-summary-background.test.ts +219 -5
  471. package/lib/agents/warm-summary-background.ts +325 -142
  472. package/lib/agents/warm-topics.test.ts +37 -0
  473. package/lib/agents/warm-topics.ts +297 -0
  474. package/lib/agents/workflow-step-retry.test.ts +96 -0
  475. package/lib/agents/workflow-step-retry.ts +216 -0
  476. package/lib/api/browser-control.ts +0 -3
  477. package/lib/db/migrations.ts +5 -0
  478. package/lib/env/config.ts +2 -0
  479. package/lib/env/schema.ts +12 -0
  480. package/lib/lifecycle/changeset-build.test.ts +93 -0
  481. package/lib/lifecycle/changeset-build.ts +210 -0
  482. package/lib/lifecycle/changesets.test.ts +101 -0
  483. package/lib/lifecycle/changesets.ts +166 -0
  484. package/lib/lifecycle/surface-collect.test.ts +88 -0
  485. package/lib/lifecycle/surface-collect.ts +64 -0
  486. package/lib/lifecycle/surface-snapshot.test.ts +104 -0
  487. package/lib/lifecycle/surface-snapshot.ts +210 -0
  488. package/lib/memory/record.ts +0 -2
  489. package/lib/providers/external.ts +0 -2
  490. package/lib/skills/builtins/memory-organization/SKILL.md +16 -0
  491. package/lib/stores/threads.test.ts +9 -0
  492. package/lib/stores/threads.ts +21 -11
  493. package/lib/stores/version-adoption.test.ts +96 -0
  494. package/lib/stores/version-adoption.ts +239 -26
  495. package/lib/stores/workflow-progress.ts +3 -0
  496. package/lib/tools/communications/ms-todo.ts +0 -7
  497. package/lib/tools/general/memory.ts +1 -1
  498. package/lib/tools/general/workflow-progress.ts +2 -0
  499. package/lib/tools/runtime/catalog.ts +1 -25
  500. package/lib/triggers/registry.ts +0 -4
  501. package/package.json +3 -3
  502. package/scripts/install-to-system.ps1 +39 -11
  503. package/scripts/install-to-system.sh +37 -3
  504. package/.next/standalone/.next/server/chunks/3979.js +0 -581
  505. package/.next/standalone/.next/server/chunks/5936.js +0 -594
  506. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/display-filters/route-36cb8b428b38b26a.js +0 -17
  507. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/route-36cb8b428b38b26a.js +0 -17
  508. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/thread/route-36cb8b428b38b26a.js +0 -17
  509. package/.next/standalone/.next/static/chunks/app/api/v1/agents/route-36cb8b428b38b26a.js +0 -17
  510. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/[hostname]/route-36cb8b428b38b26a.js +0 -17
  511. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/route-36cb8b428b38b26a.js +0 -17
  512. package/.next/standalone/.next/static/chunks/app/api/v1/artifacts/lifecycle/route-36cb8b428b38b26a.js +0 -17
  513. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/files/route-36cb8b428b38b26a.js +0 -17
  514. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/images/route-36cb8b428b38b26a.js +0 -17
  515. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/chats/route-36cb8b428b38b26a.js +0 -17
  516. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/[remote_jid]/route-36cb8b428b38b26a.js +0 -17
  517. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/route-36cb8b428b38b26a.js +0 -17
  518. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/lookup/route-36cb8b428b38b26a.js +0 -17
  519. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/pair/route-36cb8b428b38b26a.js +0 -17
  520. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/route-36cb8b428b38b26a.js +0 -17
  521. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/[route_id]/route-36cb8b428b38b26a.js +0 -17
  522. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/route-36cb8b428b38b26a.js +0 -17
  523. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/status/route-36cb8b428b38b26a.js +0 -17
  524. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/kinds/route-36cb8b428b38b26a.js +0 -17
  525. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/route-36cb8b428b38b26a.js +0 -17
  526. package/.next/standalone/.next/static/chunks/app/api/v1/builtin-tools/route-36cb8b428b38b26a.js +0 -17
  527. package/.next/standalone/.next/static/chunks/app/api/v1/config/route-36cb8b428b38b26a.js +0 -17
  528. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/[id]/route-36cb8b428b38b26a.js +0 -17
  529. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/route-36cb8b428b38b26a.js +0 -17
  530. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/currency/route-36cb8b428b38b26a.js +0 -17
  531. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/metrics/route-36cb8b428b38b26a.js +0 -17
  532. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing/route-36cb8b428b38b26a.js +0 -17
  533. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing-task/route-36cb8b428b38b26a.js +0 -17
  534. package/.next/standalone/.next/static/chunks/app/api/v1/delegations/codex/[job_id]/route-36cb8b428b38b26a.js +0 -17
  535. package/.next/standalone/.next/static/chunks/app/api/v1/documents/search/route-36cb8b428b38b26a.js +0 -17
  536. package/.next/standalone/.next/static/chunks/app/api/v1/documents/settings/route-36cb8b428b38b26a.js +0 -17
  537. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/reindex/route-36cb8b428b38b26a.js +0 -17
  538. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/route-36cb8b428b38b26a.js +0 -17
  539. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/route-36cb8b428b38b26a.js +0 -17
  540. package/.next/standalone/.next/static/chunks/app/api/v1/env/route-36cb8b428b38b26a.js +0 -17
  541. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/allowlist/route-36cb8b428b38b26a.js +0 -17
  542. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/route-36cb8b428b38b26a.js +0 -17
  543. package/.next/standalone/.next/static/chunks/app/api/v1/events/route-36cb8b428b38b26a.js +0 -17
  544. package/.next/standalone/.next/static/chunks/app/api/v1/events/test/route-36cb8b428b38b26a.js +0 -17
  545. package/.next/standalone/.next/static/chunks/app/api/v1/extension/agents/route-36cb8b428b38b26a.js +0 -17
  546. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/activate/route-36cb8b428b38b26a.js +0 -17
  547. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/foreground/route-36cb8b428b38b26a.js +0 -17
  548. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/history/route-36cb8b428b38b26a.js +0 -17
  549. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/poll/route-36cb8b428b38b26a.js +0 -17
  550. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/progress/route-36cb8b428b38b26a.js +0 -17
  551. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/result/route-36cb8b428b38b26a.js +0 -17
  552. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/retry/route-36cb8b428b38b26a.js +0 -17
  553. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/status/route-36cb8b428b38b26a.js +0 -17
  554. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/tabs/route-36cb8b428b38b26a.js +0 -17
  555. package/.next/standalone/.next/static/chunks/app/api/v1/extension/fill/route-36cb8b428b38b26a.js +0 -17
  556. package/.next/standalone/.next/static/chunks/app/api/v1/extension/refine/route-36cb8b428b38b26a.js +0 -17
  557. package/.next/standalone/.next/static/chunks/app/api/v1/extension/turn/route-36cb8b428b38b26a.js +0 -17
  558. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/route-36cb8b428b38b26a.js +0 -17
  559. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/config/route-36cb8b428b38b26a.js +0 -17
  560. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/route-36cb8b428b38b26a.js +0 -17
  561. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/secrets/route-36cb8b428b38b26a.js +0 -17
  562. package/.next/standalone/.next/static/chunks/app/api/v1/files/[name]/route-36cb8b428b38b26a.js +0 -17
  563. package/.next/standalone/.next/static/chunks/app/api/v1/fs/browse/route-36cb8b428b38b26a.js +0 -17
  564. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/[id]/route-36cb8b428b38b26a.js +0 -17
  565. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/default/route-36cb8b428b38b26a.js +0 -17
  566. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/route-36cb8b428b38b26a.js +0 -17
  567. package/.next/standalone/.next/static/chunks/app/api/v1/health/probes/route-36cb8b428b38b26a.js +0 -17
  568. package/.next/standalone/.next/static/chunks/app/api/v1/health/route-36cb8b428b38b26a.js +0 -17
  569. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/route-36cb8b428b38b26a.js +0 -17
  570. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/test/route-36cb8b428b38b26a.js +0 -17
  571. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/callback/route-36cb8b428b38b26a.js +0 -17
  572. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/start/route-36cb8b428b38b26a.js +0 -17
  573. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/status/route-36cb8b428b38b26a.js +0 -17
  574. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/callback/route-36cb8b428b38b26a.js +0 -17
  575. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/start/route-36cb8b428b38b26a.js +0 -17
  576. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/status/route-36cb8b428b38b26a.js +0 -17
  577. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/route-36cb8b428b38b26a.js +0 -17
  578. package/.next/standalone/.next/static/chunks/app/api/v1/lifecycle/adoption/route-36cb8b428b38b26a.js +0 -17
  579. package/.next/standalone/.next/static/chunks/app/api/v1/local-file/route-36cb8b428b38b26a.js +0 -17
  580. package/.next/standalone/.next/static/chunks/app/api/v1/logs/route-36cb8b428b38b26a.js +0 -17
  581. package/.next/standalone/.next/static/chunks/app/api/v1/maps/embed/route-36cb8b428b38b26a.js +0 -17
  582. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/[name]/route-36cb8b428b38b26a.js +0 -17
  583. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/registry/route-36cb8b428b38b26a.js +0 -17
  584. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/route-36cb8b428b38b26a.js +0 -17
  585. package/.next/standalone/.next/static/chunks/app/api/v1/memory/[namespace]/[key]/route-36cb8b428b38b26a.js +0 -17
  586. package/.next/standalone/.next/static/chunks/app/api/v1/memory/policy/route-36cb8b428b38b26a.js +0 -17
  587. package/.next/standalone/.next/static/chunks/app/api/v1/memory/route-36cb8b428b38b26a.js +0 -17
  588. package/.next/standalone/.next/static/chunks/app/api/v1/memory/search/route-36cb8b428b38b26a.js +0 -17
  589. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/compact-threads/route-36cb8b428b38b26a.js +0 -17
  590. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/route-36cb8b428b38b26a.js +0 -17
  591. package/.next/standalone/.next/static/chunks/app/api/v1/models/route-36cb8b428b38b26a.js +0 -17
  592. package/.next/standalone/.next/static/chunks/app/api/v1/packages/catalog/route-36cb8b428b38b26a.js +0 -17
  593. package/.next/standalone/.next/static/chunks/app/api/v1/packages/defaults/[id]/route-36cb8b428b38b26a.js +0 -17
  594. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/[id]/route-36cb8b428b38b26a.js +0 -17
  595. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/route-36cb8b428b38b26a.js +0 -17
  596. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/enabled/route-36cb8b428b38b26a.js +0 -17
  597. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/route-36cb8b428b38b26a.js +0 -17
  598. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/route-36cb8b428b38b26a.js +0 -17
  599. package/.next/standalone/.next/static/chunks/app/api/v1/packages/reload/route-36cb8b428b38b26a.js +0 -17
  600. package/.next/standalone/.next/static/chunks/app/api/v1/packages/route-36cb8b428b38b26a.js +0 -17
  601. package/.next/standalone/.next/static/chunks/app/api/v1/page-capture/route-36cb8b428b38b26a.js +0 -17
  602. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/approve/route-36cb8b428b38b26a.js +0 -17
  603. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/deny/route-36cb8b428b38b26a.js +0 -17
  604. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/route-36cb8b428b38b26a.js +0 -17
  605. package/.next/standalone/.next/static/chunks/app/api/v1/profile/location/route-36cb8b428b38b26a.js +0 -17
  606. package/.next/standalone/.next/static/chunks/app/api/v1/profile/route-36cb8b428b38b26a.js +0 -17
  607. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/models/route-36cb8b428b38b26a.js +0 -17
  608. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/probe/route-36cb8b428b38b26a.js +0 -17
  609. package/.next/standalone/.next/static/chunks/app/api/v1/providers/github-copilot/auth/route-36cb8b428b38b26a.js +0 -17
  610. package/.next/standalone/.next/static/chunks/app/api/v1/providers/route-36cb8b428b38b26a.js +0 -17
  611. package/.next/standalone/.next/static/chunks/app/api/v1/proxy-config/route-36cb8b428b38b26a.js +0 -17
  612. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/init/route-36cb8b428b38b26a.js +0 -17
  613. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/route-36cb8b428b38b26a.js +0 -17
  614. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/route-36cb8b428b38b26a.js +0 -17
  615. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/run/route-36cb8b428b38b26a.js +0 -17
  616. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/route-36cb8b428b38b26a.js +0 -17
  617. package/.next/standalone/.next/static/chunks/app/api/v1/security/idle-timeout/route-36cb8b428b38b26a.js +0 -17
  618. package/.next/standalone/.next/static/chunks/app/api/v1/security/pin/route-36cb8b428b38b26a.js +0 -17
  619. package/.next/standalone/.next/static/chunks/app/api/v1/security/state/route-36cb8b428b38b26a.js +0 -17
  620. package/.next/standalone/.next/static/chunks/app/api/v1/security/unlock/route-36cb8b428b38b26a.js +0 -17
  621. package/.next/standalone/.next/static/chunks/app/api/v1/security/verify-pin/route-36cb8b428b38b26a.js +0 -17
  622. package/.next/standalone/.next/static/chunks/app/api/v1/setup/test-key/route-36cb8b428b38b26a.js +0 -17
  623. package/.next/standalone/.next/static/chunks/app/api/v1/skills/[id]/route-36cb8b428b38b26a.js +0 -17
  624. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/[id]/route-36cb8b428b38b26a.js +0 -17
  625. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/route-36cb8b428b38b26a.js +0 -17
  626. package/.next/standalone/.next/static/chunks/app/api/v1/skills/route-36cb8b428b38b26a.js +0 -17
  627. package/.next/standalone/.next/static/chunks/app/api/v1/system/abort/route-36cb8b428b38b26a.js +0 -17
  628. package/.next/standalone/.next/static/chunks/app/api/v1/system/restart/route-36cb8b428b38b26a.js +0 -17
  629. package/.next/standalone/.next/static/chunks/app/api/v1/tailscale/route-36cb8b428b38b26a.js +0 -17
  630. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/[agent_id]/route-36cb8b428b38b26a.js +0 -17
  631. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/route-36cb8b428b38b26a.js +0 -17
  632. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/context-pin/route-36cb8b428b38b26a.js +0 -17
  633. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/route-36cb8b428b38b26a.js +0 -17
  634. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/run/route-36cb8b428b38b26a.js +0 -17
  635. package/.next/standalone/.next/static/chunks/app/api/v1/threads/route-36cb8b428b38b26a.js +0 -17
  636. package/.next/standalone/.next/static/chunks/app/api/v1/tools/route-36cb8b428b38b26a.js +0 -17
  637. package/.next/standalone/.next/static/chunks/app/api/v1/update/apply/route-36cb8b428b38b26a.js +0 -17
  638. package/.next/standalone/.next/static/chunks/app/api/v1/update/route-36cb8b428b38b26a.js +0 -17
  639. package/.next/standalone/.next/static/chunks/app/api/v1/voice/transcribe/route-36cb8b428b38b26a.js +0 -17
  640. package/.next/standalone/.next/static/chunks/app/api/v1/voice/tts/route-36cb8b428b38b26a.js +0 -17
  641. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/route-36cb8b428b38b26a.js +0 -17
  642. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/run/route-36cb8b428b38b26a.js +0 -17
  643. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/reaction-scripts/route-36cb8b428b38b26a.js +0 -17
  644. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/route-36cb8b428b38b26a.js +0 -17
  645. package/.next/standalone/.next/static/chunks/app/manifest.webmanifest/route-36cb8b428b38b26a.js +0 -17
  646. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-36cb8b428b38b26a.js +0 -17
  647. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-36cb8b428b38b26a.js +0 -17
  648. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-36cb8b428b38b26a.js +0 -17
  649. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-36cb8b428b38b26a.js +0 -17
  650. /package/.next/standalone/.next/static/{NUrC9xax1sp1Q70nlFqS6 → bMRK5y3ruT7c3WtBfCQOG}/_buildManifest.js +0 -0
  651. /package/.next/standalone/.next/static/{NUrC9xax1sp1Q70nlFqS6 → bMRK5y3ruT7c3WtBfCQOG}/_ssgManifest.js +0 -0
@@ -349,1061 +349,1061 @@ function buildSubprocessEnv(userEnv) {
349
349
 
350
350
  /***/ }),
351
351
 
352
- /***/ 31421:
353
- /***/ ((module) => {
354
-
355
- module.exports = require("node:child_process");
352
+ /***/ 30977:
353
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
356
354
 
357
- /***/ }),
355
+ __webpack_require__.r(__webpack_exports__);
356
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
357
+ /* harmony export */ handler: () => (/* binding */ handler),
358
+ /* harmony export */ patchFetch: () => (/* binding */ patchFetch),
359
+ /* harmony export */ routeModule: () => (/* binding */ routeModule),
360
+ /* harmony export */ serverHooks: () => (/* binding */ serverHooks),
361
+ /* harmony export */ workAsyncStorage: () => (/* binding */ workAsyncStorage),
362
+ /* harmony export */ workUnitAsyncStorage: () => (/* binding */ workUnitAsyncStorage)
363
+ /* harmony export */ });
364
+ /* harmony import */ var next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(19225);
365
+ /* 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__);
366
+ /* harmony import */ var next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84006);
367
+ /* harmony import */ var next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8317);
368
+ /* 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__);
369
+ /* harmony import */ var next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(99373);
370
+ /* 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__);
371
+ /* harmony import */ var next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(34775);
372
+ /* 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__);
373
+ /* harmony import */ var next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(24235);
374
+ /* 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__);
375
+ /* harmony import */ var next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(261);
376
+ /* 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__);
377
+ /* harmony import */ var next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(54365);
378
+ /* 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__);
379
+ /* harmony import */ var next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(90771);
380
+ /* 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__);
381
+ /* harmony import */ var next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(73461);
382
+ /* 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__);
383
+ /* harmony import */ var next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(67798);
384
+ /* harmony import */ var next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(92280);
385
+ /* harmony import */ var next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(62018);
386
+ /* 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__);
387
+ /* harmony import */ var next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(45696);
388
+ /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(47929);
389
+ /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__);
390
+ /* harmony import */ var next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(86439);
391
+ /* 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__);
392
+ /* harmony import */ var next_dist_server_lib_route_cache_key__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(10246);
393
+ /* 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__);
394
+ /* harmony import */ var next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(37527);
395
+ /* 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__);
358
396
 
359
- /***/ 33873:
360
- /***/ ((module) => {
361
397
 
362
- module.exports = require("path");
363
398
 
364
- /***/ }),
365
399
 
366
- /***/ 37067:
367
- /***/ ((module) => {
368
400
 
369
- module.exports = require("node:http");
370
401
 
371
- /***/ }),
372
402
 
373
- /***/ 38522:
374
- /***/ ((module) => {
375
403
 
376
- module.exports = require("node:zlib");
377
404
 
378
- /***/ }),
379
405
 
380
- /***/ 39947:
381
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
382
406
 
383
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
384
- /* harmony export */ Bm: () => (/* binding */ cachedJson),
385
- /* harmony export */ HN: () => (/* binding */ notFoundResponse),
386
- /* harmony export */ Jb: () => (/* binding */ validateBody),
387
- /* harmony export */ K2: () => (/* binding */ createdResponse),
388
- /* harmony export */ Ng: () => (/* binding */ noStoreJson),
389
- /* harmony export */ yj: () => (/* binding */ errorResponse)
390
- /* harmony export */ });
391
- /* harmony import */ var next_server__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23211);
392
- // Shared HTTP response builders for app/api/v1/** route handlers.
393
- //
394
- // Goal: every error/success payload across the v1 surface has the same
395
- // shape. Before this lived inline, response bodies drifted —
396
- // `{error: "x"}` vs `{message: "x"}`, 400 vs 422 for the same condition,
397
- // some routes returned Zod's raw issue array, others stringified it.
398
407
 
399
- function errorResponse(message, status = 400) {
400
- return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json({
401
- error: message
402
- }, {
403
- status
404
- });
405
- }
406
- function notFoundResponse(message = "Not found") {
407
- return errorResponse(message, 404);
408
- }
409
- function createdResponse(data) {
410
- return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
411
- status: 201
412
- });
413
- }
414
- // Wrap a 200 JSON response with a private Cache-Control header. Use on safe
415
- // GET endpoints that serve user-scoped data the client refetches often (panel
416
- // mounts, navigation back/forward) but mutates rarely. The TTL is short
417
- // enough that explicit mutations — which patch the client-side ApiClient
418
- // cache in place — stay observably consistent without an extra roundtrip.
419
- //
420
- // swrSeconds (optional): stale-while-revalidate window. When set, the browser
421
- // serves the cached response immediately and refreshes in the background,
422
- // making navigation feel instant. Use for data that can tolerate brief
423
- // staleness (tool list, agent configs, model list). Omit for real-time data
424
- // (dashboard metrics, credential state).
425
- function cachedJson(data, maxAgeSeconds, swrSeconds) {
426
- const swr = swrSeconds ? `, stale-while-revalidate=${swrSeconds}` : "";
427
- return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
428
- headers: {
429
- "Cache-Control": `private, max-age=${maxAgeSeconds}${swr}`
430
- }
431
- });
432
- }
433
- // Use for endpoints whose response contains live state that must never be
434
- // served from cache — credentials, connection status, live config values.
435
- function noStoreJson(data) {
436
- return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
437
- headers: {
438
- "Cache-Control": "no-store"
439
- }
440
- });
441
- }
442
- // Validate a JSON request body against a zod schema.
443
- // Returns either the parsed data or a 400 NextResponse explaining the issue.
444
- // Caller pattern:
445
- // const parsed = await validateBody(req, Schema);
446
- // if (parsed instanceof NextResponse) return parsed;
447
- // // use parsed.field
448
- async function validateBody(req, schema) {
449
- let raw;
450
- try {
451
- raw = await req.json();
452
- } catch {
453
- return errorResponse("Request body must be valid JSON", 400);
454
- }
455
- const parsed = schema.safeParse(raw);
456
- if (!parsed.success) {
457
- return errorResponse(parsed.error.issues[0]?.message ?? "invalid body", 400);
458
- }
459
- return parsed.data;
460
- }
461
408
 
462
409
 
463
- /***/ }),
464
410
 
465
- /***/ 41720:
466
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
467
411
 
468
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
469
- /* harmony export */ BM: () => (/* binding */ upsertAgentConfig),
470
- /* harmony export */ E1: () => (/* binding */ updateAgentDisplayFilters),
471
- /* harmony export */ P2: () => (/* binding */ parseCitationStrictness),
472
- /* harmony export */ S2: () => (/* binding */ getAgentToolCredentials),
473
- /* harmony export */ SJ: () => (/* binding */ generateAgentId),
474
- /* harmony export */ TG: () => (/* binding */ getAgentTools),
475
- /* harmony export */ bg: () => (/* binding */ parseDelegateTargets),
476
- /* harmony export */ d2: () => (/* binding */ DISPLAY_FILTER_KEYS),
477
- /* harmony export */ fg: () => (/* binding */ getAgentTierProportions),
478
- /* harmony export */ mJ: () => (/* binding */ getAgentConfig),
479
- /* harmony export */ nV: () => (/* binding */ getAgentDisplayFilters),
480
- /* harmony export */ vU: () => (/* binding */ getDefaultAgentConfig),
481
- /* harmony export */ vi: () => (/* binding */ DISPLAY_FILTER_DEFAULTS),
482
- /* harmony export */ xi: () => (/* binding */ deleteAgentConfig),
483
- /* harmony export */ zb: () => (/* binding */ listAgentConfigs)
484
- /* harmony export */ });
485
- /* harmony import */ var _lib_db__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(46);
486
- /* harmony import */ var _lib_db_transaction__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(99043);
487
- /* harmony import */ var _lib_agents_adaptive_persona_presets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(66849);
488
412
 
489
413
 
414
+ // We inject the nextConfigOutput here so that we can use them in the route
415
+ // module.
416
+ const nextConfigOutput = "standalone"
417
+ const routeModule = new next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__.AppRouteRouteModule({
418
+ definition: {
419
+ kind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
420
+ page: "/api/v1/mcp-servers/[name]/route",
421
+ pathname: "/api/v1/mcp-servers/[name]",
422
+ filename: "route",
423
+ bundlePath: "app/api/v1/mcp-servers/[name]/route"
424
+ },
425
+ distDir: ".next" || 0,
426
+ relativeProjectDir: false || '',
427
+ resolvedPagePath: "/home/runner/work/jarela/jarela/app/api/v1/mcp-servers/[name]/route.ts",
428
+ nextConfigOutput,
429
+ // The lazy require factory ensures that:
430
+ // - In dev: devRequestTimingInternalsEnd is set before userland executes,
431
+ // correctly attributing module load time to application-code rather than
432
+ // framework internals.
433
+ // - In all modes: async modules (route files with top-level await) are
434
+ // handled correctly — require() returns a Promise for such modules, which
435
+ // ensureUserland() awaits before the first request is handled.
436
+ userland: ()=>__webpack_require__(54172),
437
+ // In Turbopack dev mode, also provide a synchronous per-request getter so
438
+ // server HMR updates are picked up without re-executing the entry chunk.
439
+ // Using require() (synchronous) avoids adding async overhead that would be
440
+ // incorrectly attributed to application-code time in devRequestTiming.
441
+ ... false ? 0 : {}
442
+ });
443
+ // Pull out the exports that we need to expose from the module. This should
444
+ // be eliminated when we've moved the other routes to the new format. These
445
+ // are used to hook into the route.
446
+ const { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;
447
+ function patchFetch() {
448
+ return (0,next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__.patchFetch)({
449
+ workAsyncStorage,
450
+ workUnitAsyncStorage
451
+ });
452
+ }
490
453
 
491
- const now = ()=>new Date().toISOString();
492
- /** Coerce arbitrary input (DB row TEXT, API body, undefined) to the enum.
493
- * Returns `null` for null/undefined/unknown values so callers can default. */ function parseCitationStrictness(value) {
494
- if (value === "off" || value === "informational" || value === "standard" || value === "strict") {
495
- return value;
454
+ async function handler(req, res, ctx) {
455
+ if (ctx.requestMeta) {
456
+ (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.setRequestMeta)(req, ctx.requestMeta);
496
457
  }
497
- return null;
498
- }
499
- /**
500
- * Parse the JSON-encoded per-agent override of context tier proportions.
501
- * Returns `null` for NULL, blank, malformed JSON, or any payload that
502
- * doesn't have three finite non-negative numeric fields. Callers fall
503
- * back to the model config's value (or built-in defaults) on null.
504
- */ function getAgentTierProportions(row) {
505
- const raw = row.context_tier_proportions;
506
- if (!raw) return null;
507
- try {
508
- const parsed = JSON.parse(raw);
509
- const hot = Number(parsed.hot);
510
- const warm = Number(parsed.warm);
511
- const facts = Number(parsed.facts);
512
- if (![
513
- hot,
514
- warm,
515
- facts
516
- ].every((n)=>Number.isFinite(n) && n >= 0)) return null;
517
- if (hot + warm + facts <= 0) return null;
518
- return {
519
- hot,
520
- warm,
521
- facts
522
- };
523
- } catch {
458
+ if (routeModule.isDev) {
459
+ (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.addRequestMeta)(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());
460
+ }
461
+ let srcPage = "/api/v1/mcp-servers/[name]/route";
462
+ // turbopack doesn't normalize `/index` in the page name
463
+ // so we need to to process dynamic routes properly
464
+ // TODO: fix turbopack providing differing value from webpack
465
+ if (false) {} else if (srcPage === '/index') {
466
+ // we always normalize /index specifically
467
+ srcPage = '/';
468
+ }
469
+ const multiZoneDraftMode = false;
470
+ const prepareResult = await routeModule.prepare(req, res, {
471
+ srcPage,
472
+ multiZoneDraftMode
473
+ });
474
+ if (!prepareResult) {
475
+ res.statusCode = 400;
476
+ res.end('Bad Request');
477
+ ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());
524
478
  return null;
525
479
  }
526
- }
527
- function listAgentConfigs() {
528
- // Default agent always first; then by the timestamp of each agent's latest message.
529
- return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare(`SELECT a.*
530
- FROM agent_configs a
531
- LEFT JOIN (
532
- SELECT t.agent_id, MAX(m.created_at) AS last_message_at
533
- FROM threads t
534
- JOIN messages m ON m.thread_id = t.thread_id
535
- GROUP BY t.agent_id
536
- ) latest ON latest.agent_id = a.id
537
- ORDER BY a.is_default DESC, COALESCE(latest.last_message_at, a.created_at) DESC, a.id ASC`).all();
538
- }
539
- function getDefaultAgentConfig() {
540
- return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("SELECT * FROM agent_configs WHERE is_default=1 LIMIT 1").get() ?? null;
541
- }
542
- function getAgentConfig(id) {
543
- return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("SELECT * FROM agent_configs WHERE id=?").get(id) ?? null;
544
- }
545
- /**
546
- * Parse the JSON-encoded delegate whitelist into a deduped string[]. Returns
547
- * an empty array for NULL, blank, or malformed JSON (delegation is opt-in).
548
- */ /**
549
- * Parse the agent's tool allowlist (`tools` column, stored as a JSON string).
550
- * Returns an empty array on NULL/blank/malformed JSON — same defensive shape
551
- * as parseDelegateTargets. Callers that previously did `JSON.parse(cfg.tools)`
552
- * inline should switch to this getter so the serialization contract stays
553
- * owned by this store.
554
- */ function getAgentTools(cfg) {
555
- if (!cfg?.tools) return [];
556
- try {
557
- const parsed = JSON.parse(cfg.tools);
558
- if (!Array.isArray(parsed)) return [];
559
- return parsed.filter((x)=>typeof x === "string" && x.length > 0);
560
- } catch {
561
- return [];
562
- }
563
- }
564
- function parseDelegateTargets(raw) {
565
- if (!raw) return [];
566
- try {
567
- const parsed = JSON.parse(raw);
568
- if (!Array.isArray(parsed)) return [];
569
- const ids = parsed.filter((x)=>typeof x === "string" && x.length > 0);
570
- return Array.from(new Set(ids));
571
- } catch {
572
- return [];
573
- }
574
- }
575
- /**
576
- * Parse the per-agent `{ toolName: credentialId }` override map stored in
577
- * the `tool_credentials` column. Returns an empty record on NULL / blank /
578
- * malformed JSON / non-string entries so downstream code can treat the
579
- * result as a plain lookup without further validation.
580
- */ function getAgentToolCredentials(cfg) {
581
- if (!cfg?.tool_credentials) return {};
582
- try {
583
- const parsed = JSON.parse(cfg.tool_credentials);
584
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
585
- const out = {};
586
- for (const [k, v] of Object.entries(parsed)){
587
- if (typeof v === "string" && v.length > 0) out[k] = v;
480
+ const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest, previewProps } = prepareResult;
481
+ const normalizedSrcPage = (0,next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__.normalizeAppPath)(srcPage);
482
+ // Only this route's prerenders can establish ISR or admit generated params.
483
+ 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]));
484
+ let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || isPrerendered);
485
+ const render404 = async ()=>{
486
+ // TODO: should route-module itself handle rendering the 404
487
+ if (routerServerContext == null ? void 0 : routerServerContext.render404) {
488
+ await routerServerContext.render404(req, res, parsedUrl, false);
489
+ } else {
490
+ res.end('This page could not be found');
588
491
  }
589
- return out;
590
- } catch {
591
- return {};
592
- }
593
- }
594
- function upsertAgentConfig(input) {
595
- return (0,_lib_db_transaction__WEBPACK_IMPORTED_MODULE_1__/* .withDbTransaction */ .J)(()=>upsertAgentConfigTransaction(input));
596
- }
597
- function upsertAgentConfigTransaction(input) {
598
- const t = now();
599
- const db = (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)();
600
- const existing = getAgentConfig(input.id);
601
- const created_at = existing?.created_at ?? t;
602
- const mbti = input.adaptive_mbti ?? toMbti(existing?.adaptive_mbti) ?? "INTJ";
603
- const preset = _lib_agents_adaptive_persona_presets__WEBPACK_IMPORTED_MODULE_2__/* .MBTI_PRESETS */ .e[mbti];
604
- const strength = input.adaptive_persona_strength ?? preset.strength;
605
- const empathy = input.adaptive_empathy ?? preset.empathy;
606
- const expressiveness = input.adaptive_expressiveness ?? preset.expressiveness;
607
- const verbosity = input.adaptive_verbosity ?? preset.verbosity;
608
- if (input.is_default) db.prepare("UPDATE agent_configs SET is_default=0").run();
609
- // harness_id: explicit `undefined` means "keep existing"; explicit `null`
610
- // means "use the global default". Empty string is normalised to null too,
611
- // matching how the AgentEditor sends "" for the inherit option.
612
- const harnessId = input.harness_id === undefined ? existing?.harness_id ?? null : input.harness_id && input.harness_id.length > 0 ? input.harness_id : null;
613
- // delegate_targets: undefined = keep existing; explicit empty array clears.
614
- const delegateTargets = input.delegate_targets === undefined ? existing?.delegate_targets ?? null : JSON.stringify(Array.from(new Set(input.delegate_targets.filter((id)=>id && id !== input.id))));
615
- // context_tier_proportions: undefined = keep existing; null = clear and
616
- // inherit from the model; object = serialise as JSON. Negative values are
617
- // clamped to 0 so the upsert can't poison the column with bad data.
618
- const tierProportions = input.context_tier_proportions === undefined ? existing?.context_tier_proportions ?? null : input.context_tier_proportions === null ? null : JSON.stringify({
619
- hot: Math.max(0, Number(input.context_tier_proportions.hot) || 0),
620
- warm: Math.max(0, Number(input.context_tier_proportions.warm) || 0),
621
- facts: Math.max(0, Number(input.context_tier_proportions.facts) || 0)
622
- });
623
- // Anti-hallucination override: `undefined` keeps existing; `null` clears
624
- // the override (inherits env). Empty-string model is normalised to null
625
- // so the editor can ship "" for the inherit option.
626
- const antiHallucMode = input.anti_hallucination_mode === undefined ? existing?.anti_hallucination_mode ?? null : input.anti_hallucination_mode === null ? null : input.anti_hallucination_mode === "off" || input.anti_hallucination_mode === "regex" || input.anti_hallucination_mode === "model" ? input.anti_hallucination_mode : null;
627
- const antiHallucModel = input.anti_hallucination_model_config === undefined ? existing?.anti_hallucination_model_config ?? null : input.anti_hallucination_model_config && input.anti_hallucination_model_config.trim().length > 0 ? input.anti_hallucination_model_config.trim() : null;
628
- const citationStrictness = input.citation_strictness === undefined ? parseCitationStrictness(existing?.citation_strictness) ?? "off" : parseCitationStrictness(input.citation_strictness) ?? "off";
629
- const toolCredentials = serialiseToolCredentials(input.tool_credentials, existing?.tool_credentials ?? null);
630
- const VALID_ROUTER_POLICIES = new Set([
631
- "cheap",
632
- "fast",
633
- "balanced",
634
- "quality"
635
- ]);
636
- const routerPolicy = input.router_policy === undefined ? existing?.router_policy ?? null : input.router_policy !== null && VALID_ROUTER_POLICIES.has(input.router_policy) ? input.router_policy : null;
637
- const routerEnabled = input.router_enabled === undefined ? existing?.router_enabled ?? null : input.router_enabled === null ? null : input.router_enabled ? 1 : 0;
638
- const VALID_USAGE_STRATEGIES = new Set([
639
- "cost_saving",
640
- "fast",
641
- "balanced",
642
- "high_reasoning"
643
- ]);
644
- const usageStrategy = input.usage_strategy === undefined ? existing?.usage_strategy ?? null : input.usage_strategy !== null && VALID_USAGE_STRATEGIES.has(input.usage_strategy) ? input.usage_strategy : null;
645
- const requestedWarmSummaryLimit = input.warm_summary_limit ?? existing?.warm_summary_limit ?? 50;
646
- const warmSummaryLimit = Number.isFinite(requestedWarmSummaryLimit) ? Math.max(0, Math.floor(requestedWarmSummaryLimit)) : existing?.warm_summary_limit ?? 50;
647
- db.prepare(`INSERT OR REPLACE INTO agent_configs
648
- (id, name, icon, identity, instructions, tools, model_config_name, is_default,
649
- history_limit, history_window_hours, warm_summary_limit, never_reply,
650
- hot_turn_limit,
651
- adaptive_persona_enabled, adaptive_persona_strength, adaptive_empathy, adaptive_expressiveness, adaptive_verbosity, adaptive_mbti,
652
- voice_enabled, voice_model, voice_name, voice_stt_model, voice_auto_speak,
653
- harness_id, delegate_targets, context_tier_proportions,
654
- anti_hallucination_mode, anti_hallucination_model_config, citation_strictness,
655
- tool_credentials, router_policy, router_enabled, usage_strategy,
656
- created_at, updated_at)
657
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(input.id, input.name, input.icon ?? null, input.identity, input.instructions, JSON.stringify(input.tools), input.model_config_name ?? null, input.is_default ? 1 : existing?.is_default ?? 0, input.history_limit ?? existing?.history_limit ?? 50, input.history_window_hours ?? existing?.history_window_hours ?? 8, warmSummaryLimit, // never_reply is a boolean toggle — explicit `undefined` means "keep existing"
658
- // (important for PATCH-style updates that omit the field).
659
- input.never_reply === undefined ? existing?.never_reply ?? 0 : input.never_reply ? 1 : 0, Math.max(0, Math.floor(input.hot_turn_limit ?? existing?.hot_turn_limit ?? 12)), input.adaptive_persona_enabled === undefined ? existing?.adaptive_persona_enabled ?? 0 : input.adaptive_persona_enabled ? 1 : 0, clampPercent(strength, existing?.adaptive_persona_strength ?? 50), clampPercent(empathy, existing?.adaptive_empathy ?? 50), clampPercent(expressiveness, existing?.adaptive_expressiveness ?? 50), clampPercent(verbosity, existing?.adaptive_verbosity ?? 50), mbti, input.voice_enabled === undefined ? existing?.voice_enabled ?? 0 : input.voice_enabled ? 1 : 0, (input.voice_model ?? existing?.voice_model ?? "gemini-2.5-flash-preview-tts").trim() || "gemini-2.5-flash-preview-tts", (input.voice_name ?? existing?.voice_name ?? "Kore").trim() || "Kore", (input.voice_stt_model ?? existing?.voice_stt_model ?? "gemini-2.5-flash").trim() || "gemini-2.5-flash", input.voice_auto_speak === undefined ? existing?.voice_auto_speak ?? 1 : input.voice_auto_speak ? 1 : 0, harnessId, delegateTargets, tierProportions, antiHallucMode, antiHallucModel, citationStrictness, toolCredentials, routerPolicy, routerEnabled, usageStrategy, created_at, t);
660
- return getAgentConfig(input.id);
661
- }
662
- function clampPercent(next, fallback) {
663
- const n = Number.isFinite(next) ? Number(next) : fallback;
664
- return Math.max(0, Math.min(100, Math.round(n)));
665
- }
666
- function serialiseToolCredentials(input, existing) {
667
- if (input === undefined) return existing;
668
- const cleaned = {};
669
- for (const [k, v] of Object.entries(input)){
670
- if (typeof k === "string" && k.length > 0 && typeof v === "string" && v.length > 0) {
671
- cleaned[k] = v;
492
+ return null;
493
+ };
494
+ if (isIsr && !isDraftMode) {
495
+ const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];
496
+ if (prerenderInfo) {
497
+ if (prerenderInfo.fallback === false && !isPrerendered) {
498
+ if (nextConfig.adapterPath) {
499
+ return await render404();
500
+ }
501
+ throw new next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError();
502
+ }
672
503
  }
673
504
  }
674
- if (Object.keys(cleaned).length === 0) return null;
675
- return JSON.stringify(cleaned);
676
- }
677
- function toMbti(v) {
678
- if (!v) return null;
679
- return v in _lib_agents_adaptive_persona_presets__WEBPACK_IMPORTED_MODULE_2__/* .MBTI_PRESETS */ .e ? v : null;
680
- }
681
- function deleteAgentConfig(id) {
682
- return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("DELETE FROM agent_configs WHERE id=?").run(id).changes > 0;
683
- }
684
- function generateAgentId(name) {
685
- const slug = name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
686
- const suffix = Math.random().toString(36).slice(2, 6);
687
- return slug ? `${slug}-${suffix}` : `agent-${suffix}`;
688
- }
689
- // ── ADR-0022: per-agent message-channel display filters ─────────────────
690
- // Canonical channel keys mirrored in `hooks/useMessageFilters.ts`. Kept
691
- // in sync there by importing this constant — single source of truth.
692
- const DISPLAY_FILTER_KEYS = [
693
- "scheduled_task",
694
- "watcher",
695
- "bridge",
696
- "extension",
697
- "page_capture",
698
- "synthetic",
699
- "tool_use",
700
- "thinking"
701
- ];
702
- const DISPLAY_FILTER_DEFAULTS = {
703
- scheduled_task: true,
704
- watcher: true,
705
- bridge: true,
706
- extension: true,
707
- page_capture: true,
708
- synthetic: true,
709
- tool_use: true,
710
- thinking: true
711
- };
712
- function parseDisplayFilters(raw) {
713
- if (!raw) return {
714
- ...DISPLAY_FILTER_DEFAULTS
715
- };
716
- try {
717
- const parsed = JSON.parse(raw);
718
- // Merge over defaults so newly-added channels stay visible on old rows.
719
- return {
720
- ...DISPLAY_FILTER_DEFAULTS,
721
- ...parsed
722
- };
723
- } catch {
724
- return {
725
- ...DISPLAY_FILTER_DEFAULTS
726
- };
505
+ let cacheKey = null;
506
+ if (isIsr && !routeModule.isDev && !isDraftMode) {
507
+ cacheKey = resolvedPathname;
508
+ // ensure /index and / is normalized to one key
509
+ cacheKey = cacheKey === '/index' ? '/' : cacheKey;
727
510
  }
728
- }
729
- function getAgentDisplayFilters(id) {
730
- const row = getAgentConfig(id);
731
- if (!row) return null;
732
- return parseDisplayFilters(row.display_filters);
733
- }
734
- /**
735
- * Merge a partial filter map into the agent's stored prefs. Pass `null` to
736
- * reset to defaults (clears the column). Safe against concurrent toggles
737
- * from multiple browser tabs because the merge happens server-side.
738
- */ function updateAgentDisplayFilters(id, patch) {
739
- const row = getAgentConfig(id);
740
- if (!row) return null;
741
- if (patch === null) {
742
- (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("UPDATE agent_configs SET display_filters=NULL, updated_at=? WHERE id=?").run(now(), id);
743
- return {
744
- ...DISPLAY_FILTER_DEFAULTS
745
- };
511
+ // Before rendering (which initializes component tree modules), we have to
512
+ // set the reference manifests to our global store so Server Action's
513
+ // encryption util can access to them at the top level of the page module.
514
+ if (serverActionsManifest && clientReferenceManifest) {
515
+ (0,next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__.setManifestsSingleton)({
516
+ page: srcPage,
517
+ clientReferenceManifest,
518
+ serverActionsManifest
519
+ });
746
520
  }
747
- const current = parseDisplayFilters(row.display_filters);
748
- const next = {
749
- ...current
750
- };
751
- for (const k of DISPLAY_FILTER_KEYS){
752
- if (k in patch && typeof patch[k] === "boolean") next[k] = patch[k];
753
- }
754
- (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("UPDATE agent_configs SET display_filters=?, updated_at=? WHERE id=?").run(JSON.stringify(next), now(), id);
755
- return next;
756
- }
757
-
758
-
759
- /***/ }),
760
-
761
- /***/ 42666:
762
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
763
-
764
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
765
- /* harmony export */ KA: () => (/* binding */ setMcpServerError),
766
- /* harmony export */ cw: () => (/* binding */ getMcpServer),
767
- /* harmony export */ le: () => (/* binding */ deleteMcpServer),
768
- /* harmony export */ n7: () => (/* binding */ listMcpServers),
769
- /* harmony export */ te: () => (/* binding */ upsertMcpServer)
770
- /* harmony export */ });
771
- /* harmony import */ var _lib_db__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(46);
772
- /* harmony import */ var _lib_crypto_envelope__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(10938);
773
-
774
-
775
- const now = ()=>new Date().toISOString();
776
- // `spec` may contain MCP env vars like GITHUB_TOKEN, GOOGLE_MAPS_API_KEY,
777
- // BRAVE_API_KEY etc. — encrypted at rest (ADR-0005). Decrypt on read.
778
- function decryptRow(row) {
779
- return {
780
- ...row,
781
- spec: (0,_lib_crypto_envelope__WEBPACK_IMPORTED_MODULE_1__/* .decryptIfNeeded */ .qU)(row.spec)
521
+ const method = req.method || 'GET';
522
+ const tracer = (0,next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.getTracer)();
523
+ const activeSpan = tracer.getActiveScopeSpan();
524
+ const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);
525
+ const isMinimalMode = Boolean((0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'minimalMode'));
526
+ const incrementalCache = (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, previewProps, prerenderManifest, isMinimalMode);
527
+ incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();
528
+ globalThis.__incrementalCache = incrementalCache;
529
+ const context = {
530
+ params,
531
+ previewProps,
532
+ renderOpts: {
533
+ experimental: {
534
+ authInterrupts: Boolean(nextConfig.experimental.authInterrupts),
535
+ useCacheTimeout: nextConfig.experimental.useCacheTimeout,
536
+ durableUseCacheEntries: Boolean(nextConfig.experimental.durableUseCacheEntries)
537
+ },
538
+ cacheComponents: Boolean(nextConfig.cacheComponents),
539
+ validationLevel: nextConfig.experimental.instantInsights.validationLevel,
540
+ isDraftMode,
541
+ incrementalCache,
542
+ hmrRefreshHash: (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'hmrRefreshHash'),
543
+ cacheLifeProfiles: nextConfig.cacheLife,
544
+ staticPageGenerationTimeout: nextConfig.staticPageGenerationTimeout,
545
+ waitUntil: ctx.waitUntil,
546
+ onClose: (cb)=>{
547
+ res.on('close', cb);
548
+ },
549
+ onAfterTaskError: undefined
550
+ },
551
+ sharedContext: {
552
+ buildId,
553
+ deploymentId
554
+ }
782
555
  };
556
+ const nodeNextReq = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextRequest(req);
557
+ const nodeNextRes = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextResponse(res);
558
+ 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));
559
+ const responseGenerator = async ({ previousCacheEntry })=>{
560
+ try {
561
+ if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {
562
+ res.statusCode = 404;
563
+ // on-demand revalidate always sets this header
564
+ res.setHeader('x-nextjs-cache', 'REVALIDATED');
565
+ res.end('This page could not be found');
566
+ return null;
567
+ }
568
+ const response = cacheKey === null ? await routeModule.handle(nextReq, context) : await routeModule.prerender(nextReq, context);
569
+ req.fetchMetrics = context.renderOpts.fetchMetrics;
570
+ let pendingWaitUntil = context.renderOpts.pendingWaitUntil;
571
+ // Attempt using provided waitUntil if available
572
+ // if it's not we fallback to sendResponse's handling
573
+ if (pendingWaitUntil) {
574
+ if (ctx.waitUntil) {
575
+ ctx.waitUntil(pendingWaitUntil);
576
+ pendingWaitUntil = undefined;
577
+ }
578
+ }
579
+ const cacheTags = context.renderOpts.collectedTags;
580
+ // If the request is for a static response, we can cache it so long
581
+ // as it's not edge.
582
+ if (isIsr) {
583
+ const blob = await response.blob();
584
+ // Copy the headers from the response.
585
+ const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.toNodeOutgoingHttpHeaders)(response.headers);
586
+ if (cacheTags) {
587
+ headers[next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER] = cacheTags;
588
+ }
589
+ if (!headers['content-type'] && blob.type) {
590
+ headers['content-type'] = blob.type;
591
+ }
592
+ const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;
593
+ 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
594
+ // explicit `expire` (e.g. via `cacheLife`). This mirrors the
595
+ // build-time fallback in `build/index.ts` so cache entries
596
+ // and the response Cache-Control header agree on the route's
597
+ // effective expire. Routes that opt out of revalidation
598
+ // (`revalidate: false`) or that are dynamic (`revalidate: 0`)
599
+ // keep `expire: undefined`.
600
+ revalidate !== false && revalidate > 0 ? nextConfig.expireTime : undefined : context.renderOpts.collectedExpire;
601
+ // Create the cache entry for the response.
602
+ const cacheEntry = {
603
+ value: {
604
+ kind: next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__.CachedRouteKind.APP_ROUTE,
605
+ status: response.status,
606
+ body: Buffer.from(await blob.arrayBuffer()),
607
+ headers
608
+ },
609
+ cacheControl: {
610
+ revalidate,
611
+ expire
612
+ }
613
+ };
614
+ return cacheEntry;
615
+ } else {
616
+ // send response without caching if not ISR
617
+ await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, response, pendingWaitUntil);
618
+ return null;
619
+ }
620
+ } catch (err) {
621
+ // if this is a background revalidate we need to report
622
+ // the request error here as it won't be bubbled
623
+ if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {
624
+ const silenceLog = false;
625
+ await routeModule.onRequestError(req, err, {
626
+ routerKind: 'App Router',
627
+ routePath: srcPage,
628
+ routeType: 'route',
629
+ revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
630
+ isStaticGeneration: cacheKey !== null,
631
+ isOnDemandRevalidate
632
+ })
633
+ }, silenceLog, routerServerContext);
634
+ }
635
+ throw err;
636
+ }
637
+ };
638
+ const handleResponse = async (currentSpan, parentSpan)=>{
639
+ try {
640
+ var _cacheEntry_value;
641
+ const cacheEntry = await routeModule.handleResponse({
642
+ req,
643
+ nextConfig,
644
+ cacheKey,
645
+ routeKind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
646
+ isFallback: false,
647
+ previewProps,
648
+ prerenderManifest,
649
+ isRoutePPREnabled: false,
650
+ isOnDemandRevalidate,
651
+ revalidateOnlyGenerated,
652
+ responseGenerator,
653
+ waitUntil: ctx.waitUntil,
654
+ isMinimalMode
655
+ });
656
+ if (cacheEntry !== null && 'error' in cacheEntry) {
657
+ throw cacheEntry.error;
658
+ }
659
+ // we don't create a cacheEntry for ISR
660
+ if (!isIsr) {
661
+ return;
662
+ }
663
+ 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) {
664
+ var _cacheEntry_value1;
665
+ throw new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`);
666
+ }
667
+ if (!isMinimalMode) {
668
+ res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');
669
+ }
670
+ // Draft mode should never be cached
671
+ if (isDraftMode) {
672
+ res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');
673
+ }
674
+ const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers);
675
+ if (!(isMinimalMode && isIsr)) {
676
+ headers.delete(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER);
677
+ }
678
+ // If cache control is already set on the response we don't
679
+ // override it to allow users to customize it via next.config
680
+ if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {
681
+ headers.set('Cache-Control', (0,next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__.getCacheControlHeader)(cacheEntry.cacheControl));
682
+ }
683
+ 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'.
684
+ new Response(cacheEntry.value.body, {
685
+ headers,
686
+ status: cacheEntry.value.status || 200
687
+ }));
688
+ return;
689
+ } catch (err) {
690
+ if (!(err instanceof next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError)) {
691
+ const silenceLog = false;
692
+ await routeModule.onRequestError(req, err, {
693
+ routerKind: 'App Router',
694
+ routePath: normalizedSrcPage,
695
+ routeType: 'route',
696
+ revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
697
+ isStaticGeneration: cacheKey !== null,
698
+ isOnDemandRevalidate
699
+ })
700
+ }, silenceLog, routerServerContext);
701
+ }
702
+ // rethrow so that we can handle serving error page
703
+ // If this is during static generation, throw the error again.
704
+ if (isIsr) throw err;
705
+ // Otherwise, send a 500 response unless the original response has
706
+ // already committed. In that case, preserve its status code for
707
+ // telemetry while still recording the failure and terminating a response
708
+ // that the failed pipeline left open.
709
+ if (res.headersSent) {
710
+ if (currentSpan) {
711
+ const error = err instanceof Error ? err : new Error('Unknown app route error');
712
+ currentSpan.recordException(error);
713
+ currentSpan.setStatus({
714
+ code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR,
715
+ message: error.message
716
+ });
717
+ currentSpan.setAttribute('error.type', error.name);
718
+ }
719
+ if (!res.writableEnded && !res.destroyed) {
720
+ res.end();
721
+ }
722
+ } else {
723
+ await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, new Response(null, {
724
+ status: 500
725
+ }));
726
+ }
727
+ return;
728
+ } finally{
729
+ ;
730
+ (()=>{
731
+ if (!currentSpan) {
732
+ return;
733
+ }
734
+ let statusCode = res.statusCode;
735
+ currentSpan.setAttributes({
736
+ 'http.status_code': statusCode,
737
+ 'next.rsc': false
738
+ });
739
+ if (statusCode && statusCode >= 500) {
740
+ // For 5xx status codes: SHOULD be set to 'Error' span status.
741
+ // x-ref: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
742
+ currentSpan.setStatus({
743
+ code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR
744
+ });
745
+ // For span status 'Error', SHOULD set 'error.type' attribute.
746
+ currentSpan.setAttribute('error.type', statusCode.toString());
747
+ }
748
+ const rootSpanAttributes = tracer.getRootSpanAttributes();
749
+ // We were unable to get attributes, probably OTEL is not enabled
750
+ if (!rootSpanAttributes) {
751
+ return;
752
+ }
753
+ if (rootSpanAttributes.get('next.span_type') !== next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest) {
754
+ console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);
755
+ return;
756
+ }
757
+ const route = rootSpanAttributes.get('next.route') || normalizedSrcPage;
758
+ const name = `${method} ${route}`;
759
+ currentSpan.setAttributes({
760
+ 'next.route': route,
761
+ 'http.route': route,
762
+ 'next.span_name': name
763
+ });
764
+ currentSpan.updateName(name);
765
+ // Propagate http.route to the parent span if one exists (e.g.
766
+ // a platform-created HTTP span in adapter deployments).
767
+ if (parentSpan && parentSpan !== currentSpan) {
768
+ parentSpan.setAttribute('http.route', route);
769
+ parentSpan.updateName(name);
770
+ }
771
+ })();
772
+ }
773
+ };
774
+ // TODO: activeSpan code path is for when wrapped by
775
+ // next-server can be removed when this is no longer used
776
+ if (isWrappedByNextServer && activeSpan) {
777
+ await handleResponse(activeSpan, undefined);
778
+ } else {
779
+ let parentSpan = tracer.getActiveScopeSpan();
780
+ await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest, {
781
+ spanName: `${method} ${srcPage}`,
782
+ kind: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanKind.SERVER,
783
+ attributes: {
784
+ 'http.method': method,
785
+ 'http.target': req.url
786
+ }
787
+ }, (span)=>handleResponse(span, parentSpan)), undefined, !isWrappedByNextServer);
788
+ }
783
789
  }
784
- function listMcpServers() {
785
- const rows = (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("SELECT * FROM mcp_servers ORDER BY name ASC").all();
786
- return rows.map(decryptRow);
787
- }
788
- function getMcpServer(name) {
789
- const row = (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("SELECT * FROM mcp_servers WHERE name=?").get(name) ?? null;
790
- return row ? decryptRow(row) : null;
791
- }
792
- function upsertMcpServer(input) {
793
- const t = now();
794
- const existing = getMcpServer(input.name);
795
- const created_at = existing?.created_at ?? t;
796
- const enabled = input.enabled === false ? 0 : 1;
797
- (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare(`INSERT OR REPLACE INTO mcp_servers (name, transport, spec, enabled, last_error, created_at, updated_at)
798
- VALUES (?, ?, ?, ?, NULL, ?, ?)`).run(input.name, input.transport, (0,_lib_crypto_envelope__WEBPACK_IMPORTED_MODULE_1__/* .encrypt */ .w)(JSON.stringify(input.spec)), enabled, created_at, t);
799
- return getMcpServer(input.name);
800
- }
801
- function deleteMcpServer(name) {
802
- return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("DELETE FROM mcp_servers WHERE name=?").run(name).changes > 0;
803
- }
804
- function setMcpServerError(name, error) {
805
- (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("UPDATE mcp_servers SET last_error=?, updated_at=? WHERE name=?").run(error, now(), name);
806
- }
807
-
808
-
809
- /***/ }),
810
-
811
- /***/ 44708:
812
- /***/ ((module) => {
813
-
814
- module.exports = require("node:https");
815
-
816
- /***/ }),
817
-
818
- /***/ 44870:
819
- /***/ ((module) => {
820
-
821
- module.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js");
822
-
823
- /***/ }),
824
-
825
- /***/ 48161:
826
- /***/ ((module) => {
827
-
828
- module.exports = require("node:os");
829
-
830
- /***/ }),
831
-
832
- /***/ 51455:
833
- /***/ ((module) => {
834
-
835
- module.exports = require("node:fs/promises");
836
-
837
- /***/ }),
838
-
839
- /***/ 53638:
840
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
841
-
842
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
843
- /* harmony export */ p: () => (/* binding */ parseJsonSafe)
844
- /* harmony export */ });
845
- // JSON.parse with a fallback value when the input is malformed (or empty).
846
- // Used everywhere we read responses from external APIs — they're contractually
847
- // JSON but a transient 502 / proxy interstitial occasionally returns HTML.
848
- function parseJsonSafe(text, fallback) {
849
- try {
850
- return JSON.parse(text);
851
- } catch {
852
- return fallback;
853
- }
854
- }
855
-
856
-
857
- /***/ }),
858
-
859
- /***/ 54172:
860
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
861
-
862
- __webpack_require__.r(__webpack_exports__);
863
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
864
- /* harmony export */ DELETE: () => (/* binding */ DELETE),
865
- /* harmony export */ GET: () => (/* binding */ GET),
866
- /* harmony export */ PUT: () => (/* binding */ PUT)
867
- /* harmony export */ });
868
- /* harmony import */ var next_server__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23211);
869
- /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(97377);
870
- /* harmony import */ var _lib_stores_mcp_servers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(42666);
871
- /* harmony import */ var _lib_mcp_client__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(30572);
872
- /* harmony import */ var _lib_api_serializers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(85678);
873
- /* harmony import */ var _lib_api_responses__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(39947);
874
- /* harmony import */ var _lib_utils_json__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(53638);
875
-
876
-
877
-
878
-
879
-
880
-
881
-
882
- const PutBody = zod__WEBPACK_IMPORTED_MODULE_5__/* .object */ .Ikc({
883
- transport: zod__WEBPACK_IMPORTED_MODULE_5__/* ["enum"] */ .k5n([
884
- "stdio",
885
- "http"
886
- ]).optional(),
887
- spec: zod__WEBPACK_IMPORTED_MODULE_5__/* .record */ .g1P(zod__WEBPACK_IMPORTED_MODULE_5__/* .string */ .YjP(), zod__WEBPACK_IMPORTED_MODULE_5__/* .unknown */ .L5J()).optional(),
888
- enabled: zod__WEBPACK_IMPORTED_MODULE_5__/* .boolean */ .zMY().optional()
889
- });
890
- async function GET(_req, { params }) {
891
- const { name } = await params;
892
- const r = (0,_lib_stores_mcp_servers__WEBPACK_IMPORTED_MODULE_1__/* .getMcpServer */ .cw)(name);
893
- if (!r) return (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_4__/* .notFoundResponse */ .HN)("MCP server not found");
894
- return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json((0,_lib_api_serializers__WEBPACK_IMPORTED_MODULE_3__/* .mcpServerToResponse */ .sU)(r));
895
- }
896
- async function PUT(req, { params }) {
897
- const { name } = await params;
898
- const existing = (0,_lib_stores_mcp_servers__WEBPACK_IMPORTED_MODULE_1__/* .getMcpServer */ .cw)(name);
899
- if (!existing) return (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_4__/* .notFoundResponse */ .HN)("MCP server not found");
900
- const body = await (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_4__/* .validateBody */ .Jb)(req, PutBody);
901
- if (body instanceof next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse) return body;
902
- const row = (0,_lib_stores_mcp_servers__WEBPACK_IMPORTED_MODULE_1__/* .upsertMcpServer */ .te)({
903
- name,
904
- transport: body.transport ?? existing.transport,
905
- spec: body.spec ?? (0,_lib_utils_json__WEBPACK_IMPORTED_MODULE_6__/* .parseJsonSafe */ .p)(existing.spec, {}),
906
- enabled: body.enabled ?? existing.enabled === 1
907
- });
908
- (0,_lib_mcp_client__WEBPACK_IMPORTED_MODULE_2__/* .invalidateMcpTools */ .H_)();
909
- return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json((0,_lib_api_serializers__WEBPACK_IMPORTED_MODULE_3__/* .mcpServerToResponse */ .sU)(row));
910
- }
911
- async function DELETE(_req, { params }) {
912
- const { name } = await params;
913
- const ok = (0,_lib_stores_mcp_servers__WEBPACK_IMPORTED_MODULE_1__/* .deleteMcpServer */ .le)(name);
914
- if (!ok) return (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_4__/* .notFoundResponse */ .HN)("MCP server not found");
915
- (0,_lib_mcp_client__WEBPACK_IMPORTED_MODULE_2__/* .invalidateMcpTools */ .H_)();
916
- return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json({
917
- deleted: true
918
- });
919
- }
920
-
921
790
 
922
- /***/ }),
923
-
924
- /***/ 55511:
925
- /***/ ((module) => {
926
-
927
- module.exports = require("crypto");
928
-
929
- /***/ }),
930
-
931
- /***/ 55591:
932
- /***/ ((module) => {
791
+ //# sourceMappingURL=app-route.js.map
933
792
 
934
- module.exports = require("https");
935
793
 
936
794
  /***/ }),
937
795
 
938
- /***/ 57075:
796
+ /***/ 31421:
939
797
  /***/ ((module) => {
940
798
 
941
- module.exports = require("node:stream");
799
+ module.exports = require("node:child_process");
942
800
 
943
801
  /***/ }),
944
802
 
945
- /***/ 57975:
803
+ /***/ 33873:
946
804
  /***/ ((module) => {
947
805
 
948
- module.exports = require("node:util");
806
+ module.exports = require("path");
949
807
 
950
808
  /***/ }),
951
809
 
952
- /***/ 63033:
810
+ /***/ 37067:
953
811
  /***/ ((module) => {
954
812
 
955
- module.exports = require("next/dist/server/app-render/work-unit-async-storage.external.js");
813
+ module.exports = require("node:http");
956
814
 
957
815
  /***/ }),
958
816
 
959
- /***/ 73024:
817
+ /***/ 38522:
960
818
  /***/ ((module) => {
961
819
 
962
- module.exports = require("node:fs");
820
+ module.exports = require("node:zlib");
963
821
 
964
822
  /***/ }),
965
823
 
966
- /***/ 73995:
824
+ /***/ 39947:
967
825
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
968
826
 
969
- __webpack_require__.r(__webpack_exports__);
970
827
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
971
- /* harmony export */ handler: () => (/* binding */ handler),
972
- /* harmony export */ patchFetch: () => (/* binding */ patchFetch),
973
- /* harmony export */ routeModule: () => (/* binding */ routeModule),
974
- /* harmony export */ serverHooks: () => (/* binding */ serverHooks),
975
- /* harmony export */ workAsyncStorage: () => (/* binding */ workAsyncStorage),
976
- /* harmony export */ workUnitAsyncStorage: () => (/* binding */ workUnitAsyncStorage)
828
+ /* harmony export */ Bm: () => (/* binding */ cachedJson),
829
+ /* harmony export */ HN: () => (/* binding */ notFoundResponse),
830
+ /* harmony export */ Jb: () => (/* binding */ validateBody),
831
+ /* harmony export */ K2: () => (/* binding */ createdResponse),
832
+ /* harmony export */ Ng: () => (/* binding */ noStoreJson),
833
+ /* harmony export */ yj: () => (/* binding */ errorResponse)
977
834
  /* harmony export */ });
978
- /* harmony import */ var next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(19225);
979
- /* 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__);
980
- /* harmony import */ var next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84006);
981
- /* harmony import */ var next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8317);
982
- /* 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__);
983
- /* harmony import */ var next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(99373);
984
- /* 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__);
985
- /* harmony import */ var next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(34775);
986
- /* 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__);
987
- /* harmony import */ var next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(24235);
988
- /* 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__);
989
- /* harmony import */ var next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(261);
990
- /* 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__);
991
- /* harmony import */ var next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(54365);
992
- /* 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__);
993
- /* harmony import */ var next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(90771);
994
- /* 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__);
995
- /* harmony import */ var next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(73461);
996
- /* 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__);
997
- /* harmony import */ var next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(67798);
998
- /* harmony import */ var next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(92280);
999
- /* harmony import */ var next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(62018);
1000
- /* 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__);
1001
- /* harmony import */ var next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(45696);
1002
- /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(47929);
1003
- /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__);
1004
- /* harmony import */ var next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(86439);
1005
- /* 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__);
1006
- /* harmony import */ var next_dist_server_lib_route_cache_key__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(10246);
1007
- /* 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__);
1008
- /* harmony import */ var next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(37527);
1009
- /* 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__);
1010
-
1011
-
1012
-
1013
-
1014
-
1015
-
1016
-
1017
-
1018
-
1019
-
1020
-
1021
-
1022
-
1023
-
1024
-
1025
-
1026
-
835
+ /* harmony import */ var next_server__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23211);
836
+ // Shared HTTP response builders for app/api/v1/** route handlers.
837
+ //
838
+ // Goal: every error/success payload across the v1 surface has the same
839
+ // shape. Before this lived inline, response bodies drifted —
840
+ // `{error: "x"}` vs `{message: "x"}`, 400 vs 422 for the same condition,
841
+ // some routes returned Zod's raw issue array, others stringified it.
1027
842
 
1028
- // We inject the nextConfigOutput here so that we can use them in the route
1029
- // module.
1030
- const nextConfigOutput = "standalone"
1031
- const routeModule = new next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__.AppRouteRouteModule({
1032
- definition: {
1033
- kind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
1034
- page: "/api/v1/mcp-servers/[name]/route",
1035
- pathname: "/api/v1/mcp-servers/[name]",
1036
- filename: "route",
1037
- bundlePath: "app/api/v1/mcp-servers/[name]/route"
1038
- },
1039
- distDir: ".next" || 0,
1040
- relativeProjectDir: false || '',
1041
- resolvedPagePath: "/home/runner/work/jarela/jarela/app/api/v1/mcp-servers/[name]/route.ts",
1042
- nextConfigOutput,
1043
- // The lazy require factory ensures that:
1044
- // - In dev: devRequestTimingInternalsEnd is set before userland executes,
1045
- // correctly attributing module load time to application-code rather than
1046
- // framework internals.
1047
- // - In all modes: async modules (route files with top-level await) are
1048
- // handled correctly — require() returns a Promise for such modules, which
1049
- // ensureUserland() awaits before the first request is handled.
1050
- userland: ()=>__webpack_require__(54172),
1051
- // In Turbopack dev mode, also provide a synchronous per-request getter so
1052
- // server HMR updates are picked up without re-executing the entry chunk.
1053
- // Using require() (synchronous) avoids adding async overhead that would be
1054
- // incorrectly attributed to application-code time in devRequestTiming.
1055
- ... false ? 0 : {}
1056
- });
1057
- // Pull out the exports that we need to expose from the module. This should
1058
- // be eliminated when we've moved the other routes to the new format. These
1059
- // are used to hook into the route.
1060
- const { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;
1061
- function patchFetch() {
1062
- return (0,next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__.patchFetch)({
1063
- workAsyncStorage,
1064
- workUnitAsyncStorage
843
+ function errorResponse(message, status = 400) {
844
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json({
845
+ error: message
846
+ }, {
847
+ status
1065
848
  });
1066
849
  }
1067
-
1068
- async function handler(req, res, ctx) {
1069
- if (ctx.requestMeta) {
1070
- (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.setRequestMeta)(req, ctx.requestMeta);
1071
- }
1072
- if (routeModule.isDev) {
1073
- (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.addRequestMeta)(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());
850
+ function notFoundResponse(message = "Not found") {
851
+ return errorResponse(message, 404);
852
+ }
853
+ function createdResponse(data) {
854
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
855
+ status: 201
856
+ });
857
+ }
858
+ // Wrap a 200 JSON response with a private Cache-Control header. Use on safe
859
+ // GET endpoints that serve user-scoped data the client refetches often (panel
860
+ // mounts, navigation back/forward) but mutates rarely. The TTL is short
861
+ // enough that explicit mutations — which patch the client-side ApiClient
862
+ // cache in place — stay observably consistent without an extra roundtrip.
863
+ //
864
+ // swrSeconds (optional): stale-while-revalidate window. When set, the browser
865
+ // serves the cached response immediately and refreshes in the background,
866
+ // making navigation feel instant. Use for data that can tolerate brief
867
+ // staleness (tool list, agent configs, model list). Omit for real-time data
868
+ // (dashboard metrics, credential state).
869
+ function cachedJson(data, maxAgeSeconds, swrSeconds) {
870
+ const swr = swrSeconds ? `, stale-while-revalidate=${swrSeconds}` : "";
871
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
872
+ headers: {
873
+ "Cache-Control": `private, max-age=${maxAgeSeconds}${swr}`
874
+ }
875
+ });
876
+ }
877
+ // Use for endpoints whose response contains live state that must never be
878
+ // served from cache — credentials, connection status, live config values.
879
+ function noStoreJson(data) {
880
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
881
+ headers: {
882
+ "Cache-Control": "no-store"
883
+ }
884
+ });
885
+ }
886
+ // Validate a JSON request body against a zod schema.
887
+ // Returns either the parsed data or a 400 NextResponse explaining the issue.
888
+ // Caller pattern:
889
+ // const parsed = await validateBody(req, Schema);
890
+ // if (parsed instanceof NextResponse) return parsed;
891
+ // // use parsed.field
892
+ async function validateBody(req, schema) {
893
+ let raw;
894
+ try {
895
+ raw = await req.json();
896
+ } catch {
897
+ return errorResponse("Request body must be valid JSON", 400);
1074
898
  }
1075
- let srcPage = "/api/v1/mcp-servers/[name]/route";
1076
- // turbopack doesn't normalize `/index` in the page name
1077
- // so we need to to process dynamic routes properly
1078
- // TODO: fix turbopack providing differing value from webpack
1079
- if (false) {} else if (srcPage === '/index') {
1080
- // we always normalize /index specifically
1081
- srcPage = '/';
899
+ const parsed = schema.safeParse(raw);
900
+ if (!parsed.success) {
901
+ return errorResponse(parsed.error.issues[0]?.message ?? "invalid body", 400);
1082
902
  }
1083
- const multiZoneDraftMode = false;
1084
- const prepareResult = await routeModule.prepare(req, res, {
1085
- srcPage,
1086
- multiZoneDraftMode
1087
- });
1088
- if (!prepareResult) {
1089
- res.statusCode = 400;
1090
- res.end('Bad Request');
1091
- ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());
1092
- return null;
903
+ return parsed.data;
904
+ }
905
+
906
+
907
+ /***/ }),
908
+
909
+ /***/ 41720:
910
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
911
+
912
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
913
+ /* harmony export */ BM: () => (/* binding */ upsertAgentConfig),
914
+ /* harmony export */ E1: () => (/* binding */ updateAgentDisplayFilters),
915
+ /* harmony export */ P2: () => (/* binding */ parseCitationStrictness),
916
+ /* harmony export */ S2: () => (/* binding */ getAgentToolCredentials),
917
+ /* harmony export */ SJ: () => (/* binding */ generateAgentId),
918
+ /* harmony export */ TG: () => (/* binding */ getAgentTools),
919
+ /* harmony export */ bg: () => (/* binding */ parseDelegateTargets),
920
+ /* harmony export */ d2: () => (/* binding */ DISPLAY_FILTER_KEYS),
921
+ /* harmony export */ fg: () => (/* binding */ getAgentTierProportions),
922
+ /* harmony export */ mJ: () => (/* binding */ getAgentConfig),
923
+ /* harmony export */ nV: () => (/* binding */ getAgentDisplayFilters),
924
+ /* harmony export */ vU: () => (/* binding */ getDefaultAgentConfig),
925
+ /* harmony export */ vi: () => (/* binding */ DISPLAY_FILTER_DEFAULTS),
926
+ /* harmony export */ xi: () => (/* binding */ deleteAgentConfig),
927
+ /* harmony export */ zb: () => (/* binding */ listAgentConfigs)
928
+ /* harmony export */ });
929
+ /* harmony import */ var _lib_db__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(46);
930
+ /* harmony import */ var _lib_db_transaction__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(99043);
931
+ /* harmony import */ var _lib_agents_adaptive_persona_presets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(66849);
932
+
933
+
934
+
935
+ const now = ()=>new Date().toISOString();
936
+ /** Coerce arbitrary input (DB row TEXT, API body, undefined) to the enum.
937
+ * Returns `null` for null/undefined/unknown values so callers can default. */ function parseCitationStrictness(value) {
938
+ if (value === "off" || value === "informational" || value === "standard" || value === "strict") {
939
+ return value;
1093
940
  }
1094
- const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest, previewProps } = prepareResult;
1095
- const normalizedSrcPage = (0,next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__.normalizeAppPath)(srcPage);
1096
- // Only this route's prerenders can establish ISR or admit generated params.
1097
- 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]));
1098
- let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || isPrerendered);
1099
- const render404 = async ()=>{
1100
- // TODO: should route-module itself handle rendering the 404
1101
- if (routerServerContext == null ? void 0 : routerServerContext.render404) {
1102
- await routerServerContext.render404(req, res, parsedUrl, false);
1103
- } else {
1104
- res.end('This page could not be found');
1105
- }
941
+ return null;
942
+ }
943
+ /**
944
+ * Parse the JSON-encoded per-agent override of context tier proportions.
945
+ * Returns `null` for NULL, blank, malformed JSON, or any payload that
946
+ * doesn't have three finite non-negative numeric fields. Callers fall
947
+ * back to the model config's value (or built-in defaults) on null.
948
+ */ function getAgentTierProportions(row) {
949
+ const raw = row.context_tier_proportions;
950
+ if (!raw) return null;
951
+ try {
952
+ const parsed = JSON.parse(raw);
953
+ const hot = Number(parsed.hot);
954
+ const warm = Number(parsed.warm);
955
+ const facts = Number(parsed.facts);
956
+ if (![
957
+ hot,
958
+ warm,
959
+ facts
960
+ ].every((n)=>Number.isFinite(n) && n >= 0)) return null;
961
+ if (hot + warm + facts <= 0) return null;
962
+ return {
963
+ hot,
964
+ warm,
965
+ facts
966
+ };
967
+ } catch {
1106
968
  return null;
1107
- };
1108
- if (isIsr && !isDraftMode) {
1109
- const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];
1110
- if (prerenderInfo) {
1111
- if (prerenderInfo.fallback === false && !isPrerendered) {
1112
- if (nextConfig.adapterPath) {
1113
- return await render404();
1114
- }
1115
- throw new next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError();
1116
- }
1117
- }
1118
969
  }
1119
- let cacheKey = null;
1120
- if (isIsr && !routeModule.isDev && !isDraftMode) {
1121
- cacheKey = resolvedPathname;
1122
- // ensure /index and / is normalized to one key
1123
- cacheKey = cacheKey === '/index' ? '/' : cacheKey;
970
+ }
971
+ function listAgentConfigs() {
972
+ // Default agent always first; then by the timestamp of each agent's latest message.
973
+ return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare(`SELECT a.*
974
+ FROM agent_configs a
975
+ LEFT JOIN (
976
+ SELECT t.agent_id, MAX(m.created_at) AS last_message_at
977
+ FROM threads t
978
+ JOIN messages m ON m.thread_id = t.thread_id
979
+ GROUP BY t.agent_id
980
+ ) latest ON latest.agent_id = a.id
981
+ ORDER BY a.is_default DESC, COALESCE(latest.last_message_at, a.created_at) DESC, a.id ASC`).all();
982
+ }
983
+ function getDefaultAgentConfig() {
984
+ return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("SELECT * FROM agent_configs WHERE is_default=1 LIMIT 1").get() ?? null;
985
+ }
986
+ function getAgentConfig(id) {
987
+ return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("SELECT * FROM agent_configs WHERE id=?").get(id) ?? null;
988
+ }
989
+ /**
990
+ * Parse the JSON-encoded delegate whitelist into a deduped string[]. Returns
991
+ * an empty array for NULL, blank, or malformed JSON (delegation is opt-in).
992
+ */ /**
993
+ * Parse the agent's tool allowlist (`tools` column, stored as a JSON string).
994
+ * Returns an empty array on NULL/blank/malformed JSON — same defensive shape
995
+ * as parseDelegateTargets. Callers that previously did `JSON.parse(cfg.tools)`
996
+ * inline should switch to this getter so the serialization contract stays
997
+ * owned by this store.
998
+ */ function getAgentTools(cfg) {
999
+ if (!cfg?.tools) return [];
1000
+ try {
1001
+ const parsed = JSON.parse(cfg.tools);
1002
+ if (!Array.isArray(parsed)) return [];
1003
+ return parsed.filter((x)=>typeof x === "string" && x.length > 0);
1004
+ } catch {
1005
+ return [];
1124
1006
  }
1125
- // Before rendering (which initializes component tree modules), we have to
1126
- // set the reference manifests to our global store so Server Action's
1127
- // encryption util can access to them at the top level of the page module.
1128
- if (serverActionsManifest && clientReferenceManifest) {
1129
- (0,next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__.setManifestsSingleton)({
1130
- page: srcPage,
1131
- clientReferenceManifest,
1132
- serverActionsManifest
1133
- });
1007
+ }
1008
+ function parseDelegateTargets(raw) {
1009
+ if (!raw) return [];
1010
+ try {
1011
+ const parsed = JSON.parse(raw);
1012
+ if (!Array.isArray(parsed)) return [];
1013
+ const ids = parsed.filter((x)=>typeof x === "string" && x.length > 0);
1014
+ return Array.from(new Set(ids));
1015
+ } catch {
1016
+ return [];
1134
1017
  }
1135
- const method = req.method || 'GET';
1136
- const tracer = (0,next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.getTracer)();
1137
- const activeSpan = tracer.getActiveScopeSpan();
1138
- const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);
1139
- const isMinimalMode = Boolean((0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'minimalMode'));
1140
- const incrementalCache = (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, previewProps, prerenderManifest, isMinimalMode);
1141
- incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();
1142
- globalThis.__incrementalCache = incrementalCache;
1143
- const context = {
1144
- params,
1145
- previewProps,
1146
- renderOpts: {
1147
- experimental: {
1148
- authInterrupts: Boolean(nextConfig.experimental.authInterrupts),
1149
- useCacheTimeout: nextConfig.experimental.useCacheTimeout,
1150
- durableUseCacheEntries: Boolean(nextConfig.experimental.durableUseCacheEntries)
1151
- },
1152
- cacheComponents: Boolean(nextConfig.cacheComponents),
1153
- validationLevel: nextConfig.experimental.instantInsights.validationLevel,
1154
- isDraftMode,
1155
- incrementalCache,
1156
- hmrRefreshHash: (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'hmrRefreshHash'),
1157
- cacheLifeProfiles: nextConfig.cacheLife,
1158
- staticPageGenerationTimeout: nextConfig.staticPageGenerationTimeout,
1159
- waitUntil: ctx.waitUntil,
1160
- onClose: (cb)=>{
1161
- res.on('close', cb);
1162
- },
1163
- onAfterTaskError: undefined
1164
- },
1165
- sharedContext: {
1166
- buildId,
1167
- deploymentId
1018
+ }
1019
+ /**
1020
+ * Parse the per-agent `{ toolName: credentialId }` override map stored in
1021
+ * the `tool_credentials` column. Returns an empty record on NULL / blank /
1022
+ * malformed JSON / non-string entries so downstream code can treat the
1023
+ * result as a plain lookup without further validation.
1024
+ */ function getAgentToolCredentials(cfg) {
1025
+ if (!cfg?.tool_credentials) return {};
1026
+ try {
1027
+ const parsed = JSON.parse(cfg.tool_credentials);
1028
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
1029
+ const out = {};
1030
+ for (const [k, v] of Object.entries(parsed)){
1031
+ if (typeof v === "string" && v.length > 0) out[k] = v;
1168
1032
  }
1169
- };
1170
- const nodeNextReq = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextRequest(req);
1171
- const nodeNextRes = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextResponse(res);
1172
- 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));
1173
- const responseGenerator = async ({ previousCacheEntry })=>{
1174
- try {
1175
- if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {
1176
- res.statusCode = 404;
1177
- // on-demand revalidate always sets this header
1178
- res.setHeader('x-nextjs-cache', 'REVALIDATED');
1179
- res.end('This page could not be found');
1180
- return null;
1181
- }
1182
- const response = cacheKey === null ? await routeModule.handle(nextReq, context) : await routeModule.prerender(nextReq, context);
1183
- req.fetchMetrics = context.renderOpts.fetchMetrics;
1184
- let pendingWaitUntil = context.renderOpts.pendingWaitUntil;
1185
- // Attempt using provided waitUntil if available
1186
- // if it's not we fallback to sendResponse's handling
1187
- if (pendingWaitUntil) {
1188
- if (ctx.waitUntil) {
1189
- ctx.waitUntil(pendingWaitUntil);
1190
- pendingWaitUntil = undefined;
1191
- }
1192
- }
1193
- const cacheTags = context.renderOpts.collectedTags;
1194
- // If the request is for a static response, we can cache it so long
1195
- // as it's not edge.
1196
- if (isIsr) {
1197
- const blob = await response.blob();
1198
- // Copy the headers from the response.
1199
- const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.toNodeOutgoingHttpHeaders)(response.headers);
1200
- if (cacheTags) {
1201
- headers[next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER] = cacheTags;
1202
- }
1203
- if (!headers['content-type'] && blob.type) {
1204
- headers['content-type'] = blob.type;
1205
- }
1206
- const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;
1207
- 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
1208
- // explicit `expire` (e.g. via `cacheLife`). This mirrors the
1209
- // build-time fallback in `build/index.ts` so cache entries
1210
- // and the response Cache-Control header agree on the route's
1211
- // effective expire. Routes that opt out of revalidation
1212
- // (`revalidate: false`) or that are dynamic (`revalidate: 0`)
1213
- // keep `expire: undefined`.
1214
- revalidate !== false && revalidate > 0 ? nextConfig.expireTime : undefined : context.renderOpts.collectedExpire;
1215
- // Create the cache entry for the response.
1216
- const cacheEntry = {
1217
- value: {
1218
- kind: next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__.CachedRouteKind.APP_ROUTE,
1219
- status: response.status,
1220
- body: Buffer.from(await blob.arrayBuffer()),
1221
- headers
1222
- },
1223
- cacheControl: {
1224
- revalidate,
1225
- expire
1226
- }
1227
- };
1228
- return cacheEntry;
1229
- } else {
1230
- // send response without caching if not ISR
1231
- await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, response, pendingWaitUntil);
1232
- return null;
1233
- }
1234
- } catch (err) {
1235
- // if this is a background revalidate we need to report
1236
- // the request error here as it won't be bubbled
1237
- if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {
1238
- const silenceLog = false;
1239
- await routeModule.onRequestError(req, err, {
1240
- routerKind: 'App Router',
1241
- routePath: srcPage,
1242
- routeType: 'route',
1243
- revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
1244
- isStaticGeneration: cacheKey !== null,
1245
- isOnDemandRevalidate
1246
- })
1247
- }, silenceLog, routerServerContext);
1248
- }
1249
- throw err;
1033
+ return out;
1034
+ } catch {
1035
+ return {};
1036
+ }
1037
+ }
1038
+ function upsertAgentConfig(input) {
1039
+ return (0,_lib_db_transaction__WEBPACK_IMPORTED_MODULE_1__/* .withDbTransaction */ .J)(()=>upsertAgentConfigTransaction(input));
1040
+ }
1041
+ function upsertAgentConfigTransaction(input) {
1042
+ const t = now();
1043
+ const db = (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)();
1044
+ const existing = getAgentConfig(input.id);
1045
+ const created_at = existing?.created_at ?? t;
1046
+ const mbti = input.adaptive_mbti ?? toMbti(existing?.adaptive_mbti) ?? "INTJ";
1047
+ const preset = _lib_agents_adaptive_persona_presets__WEBPACK_IMPORTED_MODULE_2__/* .MBTI_PRESETS */ .e[mbti];
1048
+ const strength = input.adaptive_persona_strength ?? preset.strength;
1049
+ const empathy = input.adaptive_empathy ?? preset.empathy;
1050
+ const expressiveness = input.adaptive_expressiveness ?? preset.expressiveness;
1051
+ const verbosity = input.adaptive_verbosity ?? preset.verbosity;
1052
+ if (input.is_default) db.prepare("UPDATE agent_configs SET is_default=0").run();
1053
+ // harness_id: explicit `undefined` means "keep existing"; explicit `null`
1054
+ // means "use the global default". Empty string is normalised to null too,
1055
+ // matching how the AgentEditor sends "" for the inherit option.
1056
+ const harnessId = input.harness_id === undefined ? existing?.harness_id ?? null : input.harness_id && input.harness_id.length > 0 ? input.harness_id : null;
1057
+ // delegate_targets: undefined = keep existing; explicit empty array clears.
1058
+ const delegateTargets = input.delegate_targets === undefined ? existing?.delegate_targets ?? null : JSON.stringify(Array.from(new Set(input.delegate_targets.filter((id)=>id && id !== input.id))));
1059
+ // context_tier_proportions: undefined = keep existing; null = clear and
1060
+ // inherit from the model; object = serialise as JSON. Negative values are
1061
+ // clamped to 0 so the upsert can't poison the column with bad data.
1062
+ const tierProportions = input.context_tier_proportions === undefined ? existing?.context_tier_proportions ?? null : input.context_tier_proportions === null ? null : JSON.stringify({
1063
+ hot: Math.max(0, Number(input.context_tier_proportions.hot) || 0),
1064
+ warm: Math.max(0, Number(input.context_tier_proportions.warm) || 0),
1065
+ facts: Math.max(0, Number(input.context_tier_proportions.facts) || 0)
1066
+ });
1067
+ // Anti-hallucination override: `undefined` keeps existing; `null` clears
1068
+ // the override (inherits env). Empty-string model is normalised to null
1069
+ // so the editor can ship "" for the inherit option.
1070
+ const antiHallucMode = input.anti_hallucination_mode === undefined ? existing?.anti_hallucination_mode ?? null : input.anti_hallucination_mode === null ? null : input.anti_hallucination_mode === "off" || input.anti_hallucination_mode === "regex" || input.anti_hallucination_mode === "model" ? input.anti_hallucination_mode : null;
1071
+ const antiHallucModel = input.anti_hallucination_model_config === undefined ? existing?.anti_hallucination_model_config ?? null : input.anti_hallucination_model_config && input.anti_hallucination_model_config.trim().length > 0 ? input.anti_hallucination_model_config.trim() : null;
1072
+ const citationStrictness = input.citation_strictness === undefined ? parseCitationStrictness(existing?.citation_strictness) ?? "off" : parseCitationStrictness(input.citation_strictness) ?? "off";
1073
+ const toolCredentials = serialiseToolCredentials(input.tool_credentials, existing?.tool_credentials ?? null);
1074
+ const VALID_ROUTER_POLICIES = new Set([
1075
+ "cheap",
1076
+ "fast",
1077
+ "balanced",
1078
+ "quality"
1079
+ ]);
1080
+ const routerPolicy = input.router_policy === undefined ? existing?.router_policy ?? null : input.router_policy !== null && VALID_ROUTER_POLICIES.has(input.router_policy) ? input.router_policy : null;
1081
+ const routerEnabled = input.router_enabled === undefined ? existing?.router_enabled ?? null : input.router_enabled === null ? null : input.router_enabled ? 1 : 0;
1082
+ const VALID_USAGE_STRATEGIES = new Set([
1083
+ "cost_saving",
1084
+ "fast",
1085
+ "balanced",
1086
+ "high_reasoning"
1087
+ ]);
1088
+ const usageStrategy = input.usage_strategy === undefined ? existing?.usage_strategy ?? null : input.usage_strategy !== null && VALID_USAGE_STRATEGIES.has(input.usage_strategy) ? input.usage_strategy : null;
1089
+ const requestedWarmSummaryLimit = input.warm_summary_limit ?? existing?.warm_summary_limit ?? 50;
1090
+ const warmSummaryLimit = Number.isFinite(requestedWarmSummaryLimit) ? Math.max(0, Math.floor(requestedWarmSummaryLimit)) : existing?.warm_summary_limit ?? 50;
1091
+ db.prepare(`INSERT OR REPLACE INTO agent_configs
1092
+ (id, name, icon, identity, instructions, tools, model_config_name, is_default,
1093
+ history_limit, history_window_hours, warm_summary_limit, never_reply,
1094
+ hot_turn_limit,
1095
+ adaptive_persona_enabled, adaptive_persona_strength, adaptive_empathy, adaptive_expressiveness, adaptive_verbosity, adaptive_mbti,
1096
+ voice_enabled, voice_model, voice_name, voice_stt_model, voice_auto_speak,
1097
+ harness_id, delegate_targets, context_tier_proportions,
1098
+ anti_hallucination_mode, anti_hallucination_model_config, citation_strictness,
1099
+ tool_credentials, router_policy, router_enabled, usage_strategy,
1100
+ created_at, updated_at)
1101
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(input.id, input.name, input.icon ?? null, input.identity, input.instructions, JSON.stringify(input.tools), input.model_config_name ?? null, input.is_default ? 1 : existing?.is_default ?? 0, input.history_limit ?? existing?.history_limit ?? 50, input.history_window_hours ?? existing?.history_window_hours ?? 8, warmSummaryLimit, // never_reply is a boolean toggle — explicit `undefined` means "keep existing"
1102
+ // (important for PATCH-style updates that omit the field).
1103
+ input.never_reply === undefined ? existing?.never_reply ?? 0 : input.never_reply ? 1 : 0, Math.max(0, Math.floor(input.hot_turn_limit ?? existing?.hot_turn_limit ?? 12)), input.adaptive_persona_enabled === undefined ? existing?.adaptive_persona_enabled ?? 0 : input.adaptive_persona_enabled ? 1 : 0, clampPercent(strength, existing?.adaptive_persona_strength ?? 50), clampPercent(empathy, existing?.adaptive_empathy ?? 50), clampPercent(expressiveness, existing?.adaptive_expressiveness ?? 50), clampPercent(verbosity, existing?.adaptive_verbosity ?? 50), mbti, input.voice_enabled === undefined ? existing?.voice_enabled ?? 0 : input.voice_enabled ? 1 : 0, (input.voice_model ?? existing?.voice_model ?? "gemini-2.5-flash-preview-tts").trim() || "gemini-2.5-flash-preview-tts", (input.voice_name ?? existing?.voice_name ?? "Kore").trim() || "Kore", (input.voice_stt_model ?? existing?.voice_stt_model ?? "gemini-2.5-flash").trim() || "gemini-2.5-flash", input.voice_auto_speak === undefined ? existing?.voice_auto_speak ?? 1 : input.voice_auto_speak ? 1 : 0, harnessId, delegateTargets, tierProportions, antiHallucMode, antiHallucModel, citationStrictness, toolCredentials, routerPolicy, routerEnabled, usageStrategy, created_at, t);
1104
+ return getAgentConfig(input.id);
1105
+ }
1106
+ function clampPercent(next, fallback) {
1107
+ const n = Number.isFinite(next) ? Number(next) : fallback;
1108
+ return Math.max(0, Math.min(100, Math.round(n)));
1109
+ }
1110
+ function serialiseToolCredentials(input, existing) {
1111
+ if (input === undefined) return existing;
1112
+ const cleaned = {};
1113
+ for (const [k, v] of Object.entries(input)){
1114
+ if (typeof k === "string" && k.length > 0 && typeof v === "string" && v.length > 0) {
1115
+ cleaned[k] = v;
1250
1116
  }
1117
+ }
1118
+ if (Object.keys(cleaned).length === 0) return null;
1119
+ return JSON.stringify(cleaned);
1120
+ }
1121
+ function toMbti(v) {
1122
+ if (!v) return null;
1123
+ return v in _lib_agents_adaptive_persona_presets__WEBPACK_IMPORTED_MODULE_2__/* .MBTI_PRESETS */ .e ? v : null;
1124
+ }
1125
+ function deleteAgentConfig(id) {
1126
+ return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("DELETE FROM agent_configs WHERE id=?").run(id).changes > 0;
1127
+ }
1128
+ function generateAgentId(name) {
1129
+ const slug = name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
1130
+ const suffix = Math.random().toString(36).slice(2, 6);
1131
+ return slug ? `${slug}-${suffix}` : `agent-${suffix}`;
1132
+ }
1133
+ // ── ADR-0022: per-agent message-channel display filters ─────────────────
1134
+ // Canonical channel keys mirrored in `hooks/useMessageFilters.ts`. Kept
1135
+ // in sync there by importing this constant — single source of truth.
1136
+ const DISPLAY_FILTER_KEYS = [
1137
+ "scheduled_task",
1138
+ "watcher",
1139
+ "bridge",
1140
+ "extension",
1141
+ "page_capture",
1142
+ "synthetic",
1143
+ "tool_use",
1144
+ "thinking"
1145
+ ];
1146
+ const DISPLAY_FILTER_DEFAULTS = {
1147
+ scheduled_task: true,
1148
+ watcher: true,
1149
+ bridge: true,
1150
+ extension: true,
1151
+ page_capture: true,
1152
+ synthetic: true,
1153
+ tool_use: true,
1154
+ thinking: true
1155
+ };
1156
+ function parseDisplayFilters(raw) {
1157
+ if (!raw) return {
1158
+ ...DISPLAY_FILTER_DEFAULTS
1251
1159
  };
1252
- const handleResponse = async (currentSpan, parentSpan)=>{
1253
- try {
1254
- var _cacheEntry_value;
1255
- const cacheEntry = await routeModule.handleResponse({
1256
- req,
1257
- nextConfig,
1258
- cacheKey,
1259
- routeKind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
1260
- isFallback: false,
1261
- previewProps,
1262
- prerenderManifest,
1263
- isRoutePPREnabled: false,
1264
- isOnDemandRevalidate,
1265
- revalidateOnlyGenerated,
1266
- responseGenerator,
1267
- waitUntil: ctx.waitUntil,
1268
- isMinimalMode
1269
- });
1270
- if (cacheEntry !== null && 'error' in cacheEntry) {
1271
- throw cacheEntry.error;
1272
- }
1273
- // we don't create a cacheEntry for ISR
1274
- if (!isIsr) {
1275
- return;
1276
- }
1277
- 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) {
1278
- var _cacheEntry_value1;
1279
- throw new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`);
1280
- }
1281
- if (!isMinimalMode) {
1282
- res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');
1283
- }
1284
- // Draft mode should never be cached
1285
- if (isDraftMode) {
1286
- res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');
1287
- }
1288
- const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers);
1289
- if (!(isMinimalMode && isIsr)) {
1290
- headers.delete(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER);
1291
- }
1292
- // If cache control is already set on the response we don't
1293
- // override it to allow users to customize it via next.config
1294
- if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {
1295
- headers.set('Cache-Control', (0,next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__.getCacheControlHeader)(cacheEntry.cacheControl));
1296
- }
1297
- 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'.
1298
- new Response(cacheEntry.value.body, {
1299
- headers,
1300
- status: cacheEntry.value.status || 200
1301
- }));
1302
- return;
1303
- } catch (err) {
1304
- if (!(err instanceof next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError)) {
1305
- const silenceLog = false;
1306
- await routeModule.onRequestError(req, err, {
1307
- routerKind: 'App Router',
1308
- routePath: normalizedSrcPage,
1309
- routeType: 'route',
1310
- revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
1311
- isStaticGeneration: cacheKey !== null,
1312
- isOnDemandRevalidate
1313
- })
1314
- }, silenceLog, routerServerContext);
1315
- }
1316
- // rethrow so that we can handle serving error page
1317
- // If this is during static generation, throw the error again.
1318
- if (isIsr) throw err;
1319
- // Otherwise, send a 500 response unless the original response has
1320
- // already committed. In that case, preserve its status code for
1321
- // telemetry while still recording the failure and terminating a response
1322
- // that the failed pipeline left open.
1323
- if (res.headersSent) {
1324
- if (currentSpan) {
1325
- const error = err instanceof Error ? err : new Error('Unknown app route error');
1326
- currentSpan.recordException(error);
1327
- currentSpan.setStatus({
1328
- code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR,
1329
- message: error.message
1330
- });
1331
- currentSpan.setAttribute('error.type', error.name);
1332
- }
1333
- if (!res.writableEnded && !res.destroyed) {
1334
- res.end();
1335
- }
1336
- } else {
1337
- await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, new Response(null, {
1338
- status: 500
1339
- }));
1340
- }
1341
- return;
1342
- } finally{
1343
- ;
1344
- (()=>{
1345
- if (!currentSpan) {
1346
- return;
1347
- }
1348
- let statusCode = res.statusCode;
1349
- currentSpan.setAttributes({
1350
- 'http.status_code': statusCode,
1351
- 'next.rsc': false
1352
- });
1353
- if (statusCode && statusCode >= 500) {
1354
- // For 5xx status codes: SHOULD be set to 'Error' span status.
1355
- // x-ref: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
1356
- currentSpan.setStatus({
1357
- code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR
1358
- });
1359
- // For span status 'Error', SHOULD set 'error.type' attribute.
1360
- currentSpan.setAttribute('error.type', statusCode.toString());
1361
- }
1362
- const rootSpanAttributes = tracer.getRootSpanAttributes();
1363
- // We were unable to get attributes, probably OTEL is not enabled
1364
- if (!rootSpanAttributes) {
1365
- return;
1366
- }
1367
- if (rootSpanAttributes.get('next.span_type') !== next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest) {
1368
- console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);
1369
- return;
1370
- }
1371
- const route = rootSpanAttributes.get('next.route') || normalizedSrcPage;
1372
- const name = `${method} ${route}`;
1373
- currentSpan.setAttributes({
1374
- 'next.route': route,
1375
- 'http.route': route,
1376
- 'next.span_name': name
1377
- });
1378
- currentSpan.updateName(name);
1379
- // Propagate http.route to the parent span if one exists (e.g.
1380
- // a platform-created HTTP span in adapter deployments).
1381
- if (parentSpan && parentSpan !== currentSpan) {
1382
- parentSpan.setAttribute('http.route', route);
1383
- parentSpan.updateName(name);
1384
- }
1385
- })();
1386
- }
1160
+ try {
1161
+ const parsed = JSON.parse(raw);
1162
+ // Merge over defaults so newly-added channels stay visible on old rows.
1163
+ return {
1164
+ ...DISPLAY_FILTER_DEFAULTS,
1165
+ ...parsed
1166
+ };
1167
+ } catch {
1168
+ return {
1169
+ ...DISPLAY_FILTER_DEFAULTS
1170
+ };
1171
+ }
1172
+ }
1173
+ function getAgentDisplayFilters(id) {
1174
+ const row = getAgentConfig(id);
1175
+ if (!row) return null;
1176
+ return parseDisplayFilters(row.display_filters);
1177
+ }
1178
+ /**
1179
+ * Merge a partial filter map into the agent's stored prefs. Pass `null` to
1180
+ * reset to defaults (clears the column). Safe against concurrent toggles
1181
+ * from multiple browser tabs because the merge happens server-side.
1182
+ */ function updateAgentDisplayFilters(id, patch) {
1183
+ const row = getAgentConfig(id);
1184
+ if (!row) return null;
1185
+ if (patch === null) {
1186
+ (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("UPDATE agent_configs SET display_filters=NULL, updated_at=? WHERE id=?").run(now(), id);
1187
+ return {
1188
+ ...DISPLAY_FILTER_DEFAULTS
1189
+ };
1190
+ }
1191
+ const current = parseDisplayFilters(row.display_filters);
1192
+ const next = {
1193
+ ...current
1387
1194
  };
1388
- // TODO: activeSpan code path is for when wrapped by
1389
- // next-server can be removed when this is no longer used
1390
- if (isWrappedByNextServer && activeSpan) {
1391
- await handleResponse(activeSpan, undefined);
1392
- } else {
1393
- let parentSpan = tracer.getActiveScopeSpan();
1394
- await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest, {
1395
- spanName: `${method} ${srcPage}`,
1396
- kind: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanKind.SERVER,
1397
- attributes: {
1398
- 'http.method': method,
1399
- 'http.target': req.url
1400
- }
1401
- }, (span)=>handleResponse(span, parentSpan)), undefined, !isWrappedByNextServer);
1195
+ for (const k of DISPLAY_FILTER_KEYS){
1196
+ if (k in patch && typeof patch[k] === "boolean") next[k] = patch[k];
1402
1197
  }
1198
+ (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("UPDATE agent_configs SET display_filters=?, updated_at=? WHERE id=?").run(JSON.stringify(next), now(), id);
1199
+ return next;
1403
1200
  }
1404
1201
 
1405
- //# sourceMappingURL=app-route.js.map
1406
1202
 
1203
+ /***/ }),
1204
+
1205
+ /***/ 42666:
1206
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1207
+
1208
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1209
+ /* harmony export */ KA: () => (/* binding */ setMcpServerError),
1210
+ /* harmony export */ cw: () => (/* binding */ getMcpServer),
1211
+ /* harmony export */ le: () => (/* binding */ deleteMcpServer),
1212
+ /* harmony export */ n7: () => (/* binding */ listMcpServers),
1213
+ /* harmony export */ te: () => (/* binding */ upsertMcpServer)
1214
+ /* harmony export */ });
1215
+ /* harmony import */ var _lib_db__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(46);
1216
+ /* harmony import */ var _lib_crypto_envelope__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(10938);
1217
+
1218
+
1219
+ const now = ()=>new Date().toISOString();
1220
+ // `spec` may contain MCP env vars like GITHUB_TOKEN, GOOGLE_MAPS_API_KEY,
1221
+ // BRAVE_API_KEY etc. — encrypted at rest (ADR-0005). Decrypt on read.
1222
+ function decryptRow(row) {
1223
+ return {
1224
+ ...row,
1225
+ spec: (0,_lib_crypto_envelope__WEBPACK_IMPORTED_MODULE_1__/* .decryptIfNeeded */ .qU)(row.spec)
1226
+ };
1227
+ }
1228
+ function listMcpServers() {
1229
+ const rows = (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("SELECT * FROM mcp_servers ORDER BY name ASC").all();
1230
+ return rows.map(decryptRow);
1231
+ }
1232
+ function getMcpServer(name) {
1233
+ const row = (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("SELECT * FROM mcp_servers WHERE name=?").get(name) ?? null;
1234
+ return row ? decryptRow(row) : null;
1235
+ }
1236
+ function upsertMcpServer(input) {
1237
+ const t = now();
1238
+ const existing = getMcpServer(input.name);
1239
+ const created_at = existing?.created_at ?? t;
1240
+ const enabled = input.enabled === false ? 0 : 1;
1241
+ (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare(`INSERT OR REPLACE INTO mcp_servers (name, transport, spec, enabled, last_error, created_at, updated_at)
1242
+ VALUES (?, ?, ?, ?, NULL, ?, ?)`).run(input.name, input.transport, (0,_lib_crypto_envelope__WEBPACK_IMPORTED_MODULE_1__/* .encrypt */ .w)(JSON.stringify(input.spec)), enabled, created_at, t);
1243
+ return getMcpServer(input.name);
1244
+ }
1245
+ function deleteMcpServer(name) {
1246
+ return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("DELETE FROM mcp_servers WHERE name=?").run(name).changes > 0;
1247
+ }
1248
+ function setMcpServerError(name, error) {
1249
+ (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("UPDATE mcp_servers SET last_error=?, updated_at=? WHERE name=?").run(error, now(), name);
1250
+ }
1251
+
1252
+
1253
+ /***/ }),
1254
+
1255
+ /***/ 44708:
1256
+ /***/ ((module) => {
1257
+
1258
+ module.exports = require("node:https");
1259
+
1260
+ /***/ }),
1261
+
1262
+ /***/ 44870:
1263
+ /***/ ((module) => {
1264
+
1265
+ module.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js");
1266
+
1267
+ /***/ }),
1268
+
1269
+ /***/ 48161:
1270
+ /***/ ((module) => {
1271
+
1272
+ module.exports = require("node:os");
1273
+
1274
+ /***/ }),
1275
+
1276
+ /***/ 51455:
1277
+ /***/ ((module) => {
1278
+
1279
+ module.exports = require("node:fs/promises");
1280
+
1281
+ /***/ }),
1282
+
1283
+ /***/ 53638:
1284
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1285
+
1286
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1287
+ /* harmony export */ p: () => (/* binding */ parseJsonSafe)
1288
+ /* harmony export */ });
1289
+ // JSON.parse with a fallback value when the input is malformed (or empty).
1290
+ // Used everywhere we read responses from external APIs — they're contractually
1291
+ // JSON but a transient 502 / proxy interstitial occasionally returns HTML.
1292
+ function parseJsonSafe(text, fallback) {
1293
+ try {
1294
+ return JSON.parse(text);
1295
+ } catch {
1296
+ return fallback;
1297
+ }
1298
+ }
1299
+
1300
+
1301
+ /***/ }),
1302
+
1303
+ /***/ 54172:
1304
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1305
+
1306
+ __webpack_require__.r(__webpack_exports__);
1307
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1308
+ /* harmony export */ DELETE: () => (/* binding */ DELETE),
1309
+ /* harmony export */ GET: () => (/* binding */ GET),
1310
+ /* harmony export */ PUT: () => (/* binding */ PUT)
1311
+ /* harmony export */ });
1312
+ /* harmony import */ var next_server__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23211);
1313
+ /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(97377);
1314
+ /* harmony import */ var _lib_stores_mcp_servers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(42666);
1315
+ /* harmony import */ var _lib_mcp_client__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(30572);
1316
+ /* harmony import */ var _lib_api_serializers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(85678);
1317
+ /* harmony import */ var _lib_api_responses__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(39947);
1318
+ /* harmony import */ var _lib_utils_json__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(53638);
1319
+
1320
+
1321
+
1322
+
1323
+
1324
+
1325
+
1326
+ const PutBody = zod__WEBPACK_IMPORTED_MODULE_5__/* .object */ .Ikc({
1327
+ transport: zod__WEBPACK_IMPORTED_MODULE_5__/* ["enum"] */ .k5n([
1328
+ "stdio",
1329
+ "http"
1330
+ ]).optional(),
1331
+ spec: zod__WEBPACK_IMPORTED_MODULE_5__/* .record */ .g1P(zod__WEBPACK_IMPORTED_MODULE_5__/* .string */ .YjP(), zod__WEBPACK_IMPORTED_MODULE_5__/* .unknown */ .L5J()).optional(),
1332
+ enabled: zod__WEBPACK_IMPORTED_MODULE_5__/* .boolean */ .zMY().optional()
1333
+ });
1334
+ async function GET(_req, { params }) {
1335
+ const { name } = await params;
1336
+ const r = (0,_lib_stores_mcp_servers__WEBPACK_IMPORTED_MODULE_1__/* .getMcpServer */ .cw)(name);
1337
+ if (!r) return (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_4__/* .notFoundResponse */ .HN)("MCP server not found");
1338
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json((0,_lib_api_serializers__WEBPACK_IMPORTED_MODULE_3__/* .mcpServerToResponse */ .sU)(r));
1339
+ }
1340
+ async function PUT(req, { params }) {
1341
+ const { name } = await params;
1342
+ const existing = (0,_lib_stores_mcp_servers__WEBPACK_IMPORTED_MODULE_1__/* .getMcpServer */ .cw)(name);
1343
+ if (!existing) return (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_4__/* .notFoundResponse */ .HN)("MCP server not found");
1344
+ const body = await (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_4__/* .validateBody */ .Jb)(req, PutBody);
1345
+ if (body instanceof next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse) return body;
1346
+ const row = (0,_lib_stores_mcp_servers__WEBPACK_IMPORTED_MODULE_1__/* .upsertMcpServer */ .te)({
1347
+ name,
1348
+ transport: body.transport ?? existing.transport,
1349
+ spec: body.spec ?? (0,_lib_utils_json__WEBPACK_IMPORTED_MODULE_6__/* .parseJsonSafe */ .p)(existing.spec, {}),
1350
+ enabled: body.enabled ?? existing.enabled === 1
1351
+ });
1352
+ (0,_lib_mcp_client__WEBPACK_IMPORTED_MODULE_2__/* .invalidateMcpTools */ .H_)();
1353
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json((0,_lib_api_serializers__WEBPACK_IMPORTED_MODULE_3__/* .mcpServerToResponse */ .sU)(row));
1354
+ }
1355
+ async function DELETE(_req, { params }) {
1356
+ const { name } = await params;
1357
+ const ok = (0,_lib_stores_mcp_servers__WEBPACK_IMPORTED_MODULE_1__/* .deleteMcpServer */ .le)(name);
1358
+ if (!ok) return (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_4__/* .notFoundResponse */ .HN)("MCP server not found");
1359
+ (0,_lib_mcp_client__WEBPACK_IMPORTED_MODULE_2__/* .invalidateMcpTools */ .H_)();
1360
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json({
1361
+ deleted: true
1362
+ });
1363
+ }
1364
+
1365
+
1366
+ /***/ }),
1367
+
1368
+ /***/ 55511:
1369
+ /***/ ((module) => {
1370
+
1371
+ module.exports = require("crypto");
1372
+
1373
+ /***/ }),
1374
+
1375
+ /***/ 55591:
1376
+ /***/ ((module) => {
1377
+
1378
+ module.exports = require("https");
1379
+
1380
+ /***/ }),
1381
+
1382
+ /***/ 57075:
1383
+ /***/ ((module) => {
1384
+
1385
+ module.exports = require("node:stream");
1386
+
1387
+ /***/ }),
1388
+
1389
+ /***/ 57975:
1390
+ /***/ ((module) => {
1391
+
1392
+ module.exports = require("node:util");
1393
+
1394
+ /***/ }),
1395
+
1396
+ /***/ 63033:
1397
+ /***/ ((module) => {
1398
+
1399
+ module.exports = require("next/dist/server/app-render/work-unit-async-storage.external.js");
1400
+
1401
+ /***/ }),
1402
+
1403
+ /***/ 73024:
1404
+ /***/ ((module) => {
1405
+
1406
+ module.exports = require("node:fs");
1407
1407
 
1408
1408
  /***/ }),
1409
1409
 
@@ -1717,7 +1717,7 @@ module.exports = import("@huggingface/transformers");;
1717
1717
  var __webpack_require__ = require("../../../../../webpack-runtime.js");
1718
1718
  __webpack_require__.C(exports);
1719
1719
  var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
1720
- var __webpack_exports__ = __webpack_require__.X(0, [2970,7377,1813,7981,4992,46], () => (__webpack_exec__(73995)));
1720
+ var __webpack_exports__ = __webpack_require__.X(0, [2970,7377,1813,7981,4992,46], () => (__webpack_exec__(30977)));
1721
1721
  module.exports = __webpack_exports__;
1722
1722
 
1723
1723
  })();