@circuitwall/jarela 2.7.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (730) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-path-routes-manifest.json +2 -1
  3. package/.next/standalone/.next/build-manifest.json +2 -2
  4. package/.next/standalone/.next/prerender-manifest.json +3 -3
  5. package/.next/standalone/.next/routes-manifest.json +6 -0
  6. package/.next/standalone/.next/server/app/_global-error/page.js +68 -68
  7. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_not-found/page.js +58 -58
  14. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/standalone/.next/server/app/_not-found.html +2 -2
  16. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  17. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  18. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  19. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  20. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  21. package/.next/standalone/.next/server/app/api/v1/access/[identity]/route.js +127 -127
  22. package/.next/standalone/.next/server/app/api/v1/access/route.js +372 -372
  23. package/.next/standalone/.next/server/app/api/v1/agents/[id]/compact/route.js +79 -79
  24. package/.next/standalone/.next/server/app/api/v1/agents/[id]/display-filters/route.js +641 -641
  25. package/.next/standalone/.next/server/app/api/v1/agents/[id]/duplicate/route.js +723 -723
  26. package/.next/standalone/.next/server/app/api/v1/agents/[id]/route.js +100 -100
  27. package/.next/standalone/.next/server/app/api/v1/agents/[id]/thread/route.js +65 -65
  28. package/.next/standalone/.next/server/app/api/v1/agents/recent-replies/route.js +227 -227
  29. package/.next/standalone/.next/server/app/api/v1/agents/route.js +16 -16
  30. package/.next/standalone/.next/server/app/api/v1/allowed-sites/[hostname]/route.js +384 -384
  31. package/.next/standalone/.next/server/app/api/v1/allowed-sites/route.js +9 -9
  32. package/.next/standalone/.next/server/app/api/v1/artifacts/lifecycle/route.js +23 -23
  33. package/.next/standalone/.next/server/app/api/v1/attachments/files/route.js +203 -203
  34. package/.next/standalone/.next/server/app/api/v1/attachments/images/route.js +17 -17
  35. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js +2 -2
  36. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js.nft.json +1 -1
  37. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/ignores/[remote_jid]/route.js +760 -760
  38. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/ignores/route.js +699 -699
  39. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js +30 -30
  40. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js +37 -37
  42. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js.nft.json +1 -1
  43. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js +480 -480
  44. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js.nft.json +1 -1
  45. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/routes/[route_id]/route.js +675 -675
  46. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/routes/route.js +559 -559
  47. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js +23 -23
  48. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js.nft.json +1 -1
  49. package/.next/standalone/.next/server/app/api/v1/bridges/kinds/route.js +37 -37
  50. package/.next/standalone/.next/server/app/api/v1/bridges/route.js +1269 -1269
  51. package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js +199 -199
  52. package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js.nft.json +1 -1
  53. package/.next/standalone/.next/server/app/api/v1/config/route.js +99 -99
  54. package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js +23 -23
  55. package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js.nft.json +1 -1
  56. package/.next/standalone/.next/server/app/api/v1/credentials/route.js +169 -169
  57. package/.next/standalone/.next/server/app/api/v1/credentials/route.js.nft.json +1 -1
  58. package/.next/standalone/.next/server/app/api/v1/dashboard/currency/route.js +515 -515
  59. package/.next/standalone/.next/server/app/api/v1/dashboard/metrics/route.js +380 -380
  60. package/.next/standalone/.next/server/app/api/v1/dashboard/metrics/route.js.nft.json +1 -1
  61. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing/route.js +256 -256
  62. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing/route.js.nft.json +1 -1
  63. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js +80 -97
  64. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js.nft.json +1 -1
  65. package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js +677 -677
  66. package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js.nft.json +1 -1
  67. package/.next/standalone/.next/server/app/api/v1/documents/recall-policy/route.js +856 -0
  68. package/.next/standalone/.next/server/app/api/v1/documents/recall-policy/route.js.nft.json +1 -0
  69. package/.next/standalone/.next/server/app/api/v1/documents/recall-policy/route_client-reference-manifest.js +1 -0
  70. package/.next/standalone/.next/server/app/api/v1/documents/search/route.js +299 -247
  71. package/.next/standalone/.next/server/app/api/v1/documents/settings/route.js +486 -486
  72. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js +18 -11
  73. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js.nft.json +1 -1
  74. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js +666 -666
  75. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js.nft.json +1 -1
  76. package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js +128 -100
  77. package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js.nft.json +1 -1
  78. package/.next/standalone/.next/server/app/api/v1/env/route.js +207 -207
  79. package/.next/standalone/.next/server/app/api/v1/env-sync/allowlist/route.js +128 -128
  80. package/.next/standalone/.next/server/app/api/v1/env-sync/route.js +16 -16
  81. package/.next/standalone/.next/server/app/api/v1/events/route.js +154 -154
  82. package/.next/standalone/.next/server/app/api/v1/events/route.js.nft.json +1 -1
  83. package/.next/standalone/.next/server/app/api/v1/events/test/route.js +16 -16
  84. package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js +97 -97
  85. package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js.nft.json +1 -1
  86. package/.next/standalone/.next/server/app/api/v1/extension/browser/activate/route.js +188 -188
  87. package/.next/standalone/.next/server/app/api/v1/extension/browser/foreground/route.js +93 -93
  88. package/.next/standalone/.next/server/app/api/v1/extension/browser/history/route.js +9 -9
  89. package/.next/standalone/.next/server/app/api/v1/extension/browser/poll/route.js +93 -93
  90. package/.next/standalone/.next/server/app/api/v1/extension/browser/progress/route.js +69 -69
  91. package/.next/standalone/.next/server/app/api/v1/extension/browser/result/route.js +69 -69
  92. package/.next/standalone/.next/server/app/api/v1/extension/browser/retry/route.js +65 -65
  93. package/.next/standalone/.next/server/app/api/v1/extension/browser/status/route.js +223 -223
  94. package/.next/standalone/.next/server/app/api/v1/extension/browser/tabs/route.js +44 -44
  95. package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js +93 -93
  96. package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js.nft.json +1 -1
  97. package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js +44 -44
  98. package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js.nft.json +1 -1
  99. package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js +16 -16
  100. package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js.nft.json +1 -1
  101. package/.next/standalone/.next/server/app/api/v1/extensions/route.js +722 -722
  102. package/.next/standalone/.next/server/app/api/v1/extensions/route.js.nft.json +1 -1
  103. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js +481 -481
  104. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js.nft.json +1 -1
  105. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js +378 -378
  106. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js.nft.json +1 -1
  107. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js +510 -510
  108. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js.nft.json +1 -1
  109. package/.next/standalone/.next/server/app/api/v1/files/[name]/route.js +17 -17
  110. package/.next/standalone/.next/server/app/api/v1/fs/browse/route.js +33 -33
  111. package/.next/standalone/.next/server/app/api/v1/harnesses/[id]/route.js +397 -397
  112. package/.next/standalone/.next/server/app/api/v1/harnesses/default/route.js +129 -129
  113. package/.next/standalone/.next/server/app/api/v1/harnesses/route.js +9 -9
  114. package/.next/standalone/.next/server/app/api/v1/health/probes/route.js +757 -757
  115. package/.next/standalone/.next/server/app/api/v1/health/probes/route.js.nft.json +1 -1
  116. package/.next/standalone/.next/server/app/api/v1/health/route.js +228 -228
  117. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/route.js +37 -37
  118. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js +198 -198
  119. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js.nft.json +1 -1
  120. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/callback/route.js +9 -9
  121. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/start/route.js +845 -845
  122. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/status/route.js +23 -23
  123. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/callback/route.js +106 -106
  124. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/start/route.js +747 -747
  125. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/status/route.js +37 -37
  126. package/.next/standalone/.next/server/app/api/v1/integrations/route.js +37 -37
  127. package/.next/standalone/.next/server/app/api/v1/lifecycle/adoption/route.js +420 -420
  128. package/.next/standalone/.next/server/app/api/v1/local-file/route.js +34 -34
  129. package/.next/standalone/.next/server/app/api/v1/logs/route.js +819 -819
  130. package/.next/standalone/.next/server/app/api/v1/maps/embed/route.js +217 -217
  131. package/.next/standalone/.next/server/app/api/v1/mcp-servers/[name]/route.js +1034 -1034
  132. package/.next/standalone/.next/server/app/api/v1/mcp-servers/registry/route.js +2 -2
  133. package/.next/standalone/.next/server/app/api/v1/mcp-servers/route.js +58 -58
  134. package/.next/standalone/.next/server/app/api/v1/memory/[namespace]/[key]/route.js +150 -150
  135. package/.next/standalone/.next/server/app/api/v1/memory/policy/route.js +72 -72
  136. package/.next/standalone/.next/server/app/api/v1/memory/route.js +9 -9
  137. package/.next/standalone/.next/server/app/api/v1/memory/search/route.js +16 -16
  138. package/.next/standalone/.next/server/app/api/v1/models/[name]/compact-threads/route.js +72 -72
  139. package/.next/standalone/.next/server/app/api/v1/models/[name]/route.js +87 -538
  140. package/.next/standalone/.next/server/app/api/v1/models/[name]/route.js.nft.json +1 -1
  141. package/.next/standalone/.next/server/app/api/v1/models/route.js +273 -722
  142. package/.next/standalone/.next/server/app/api/v1/models/route.js.nft.json +1 -1
  143. package/.next/standalone/.next/server/app/api/v1/packages/catalog/route.js +73 -73
  144. package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js +248 -239
  145. package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js.nft.json +1 -1
  146. package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js +128 -128
  147. package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js.nft.json +1 -1
  148. package/.next/standalone/.next/server/app/api/v1/packages/install/route.js +44 -44
  149. package/.next/standalone/.next/server/app/api/v1/packages/install/route.js.nft.json +1 -1
  150. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js +72 -72
  151. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js.nft.json +1 -1
  152. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js +37 -37
  153. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js.nft.json +1 -1
  154. package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js +81 -81
  155. package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js.nft.json +1 -1
  156. package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js +34 -25
  157. package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js.nft.json +1 -1
  158. package/.next/standalone/.next/server/app/api/v1/packages/route.js +48 -39
  159. package/.next/standalone/.next/server/app/api/v1/packages/route.js.nft.json +1 -1
  160. package/.next/standalone/.next/server/app/api/v1/page-capture/route.js +51 -51
  161. package/.next/standalone/.next/server/app/api/v1/page-capture/route.js.nft.json +1 -1
  162. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js +863 -863
  163. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js.nft.json +1 -1
  164. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js +230 -230
  165. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js.nft.json +1 -1
  166. package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js +44 -44
  167. package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js.nft.json +1 -1
  168. package/.next/standalone/.next/server/app/api/v1/profile/location/route.js +138 -138
  169. package/.next/standalone/.next/server/app/api/v1/profile/route.js +51 -51
  170. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/models/route.js +853 -680
  171. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/probe/route.js +65 -65
  172. package/.next/standalone/.next/server/app/api/v1/providers/github-copilot/auth/route.js +171 -171
  173. package/.next/standalone/.next/server/app/api/v1/providers/route.js +96 -96
  174. package/.next/standalone/.next/server/app/api/v1/proxy-config/route.js +157 -157
  175. package/.next/standalone/.next/server/app/api/v1/redaction/init/route.js +47 -47
  176. package/.next/standalone/.next/server/app/api/v1/redaction/route.js +206 -206
  177. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/route.js +140 -140
  178. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js +166 -166
  179. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js.nft.json +1 -1
  180. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/route.js +52 -52
  181. package/.next/standalone/.next/server/app/api/v1/security/idle-timeout/route.js +722 -722
  182. package/.next/standalone/.next/server/app/api/v1/security/pin/route.js +23 -23
  183. package/.next/standalone/.next/server/app/api/v1/security/state/route.js +243 -243
  184. package/.next/standalone/.next/server/app/api/v1/security/unlock/route.js +518 -518
  185. package/.next/standalone/.next/server/app/api/v1/security/verify-pin/route.js +9 -9
  186. package/.next/standalone/.next/server/app/api/v1/setup/test-key/route.js +25 -25
  187. package/.next/standalone/.next/server/app/api/v1/skills/[id]/route.js +9 -9
  188. package/.next/standalone/.next/server/app/api/v1/skills/repos/[id]/route.js +609 -609
  189. package/.next/standalone/.next/server/app/api/v1/skills/repos/route.js +129 -129
  190. package/.next/standalone/.next/server/app/api/v1/skills/route.js +9 -9
  191. package/.next/standalone/.next/server/app/api/v1/system/abort/route.js +112 -112
  192. package/.next/standalone/.next/server/app/api/v1/system/restart/route.js +86 -86
  193. package/.next/standalone/.next/server/app/api/v1/system/restart/route.js.nft.json +1 -1
  194. package/.next/standalone/.next/server/app/api/v1/tailscale/route.js +9 -9
  195. package/.next/standalone/.next/server/app/api/v1/tasks/[agent_id]/route.js +83 -83
  196. package/.next/standalone/.next/server/app/api/v1/tasks/route.js +23 -23
  197. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route.js +121 -121
  198. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/context-pin/route.js +139 -139
  199. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/messages/[message_id]/route.js +51 -51
  200. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/route.js +58 -58
  201. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js +1182 -1182
  202. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js.nft.json +1 -1
  203. package/.next/standalone/.next/server/app/api/v1/threads/route.js +158 -158
  204. package/.next/standalone/.next/server/app/api/v1/tools/route.js +137 -137
  205. package/.next/standalone/.next/server/app/api/v1/tools/route.js.nft.json +1 -1
  206. package/.next/standalone/.next/server/app/api/v1/update/apply/route.js +73 -73
  207. package/.next/standalone/.next/server/app/api/v1/update/apply/route.js.nft.json +1 -1
  208. package/.next/standalone/.next/server/app/api/v1/update/route.js +72 -72
  209. package/.next/standalone/.next/server/app/api/v1/voice/transcribe/route.js +30 -30
  210. package/.next/standalone/.next/server/app/api/v1/voice/tts/route.js +79 -79
  211. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/route.js +9 -9
  212. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js +45 -45
  213. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js.nft.json +1 -1
  214. package/.next/standalone/.next/server/app/api/v1/watchers/reaction-scripts/route.js +2 -2
  215. package/.next/standalone/.next/server/app/api/v1/watchers/route.js +37 -37
  216. package/.next/standalone/.next/server/app/api/v1/watchers/route.js.nft.json +1 -1
  217. package/.next/standalone/.next/server/app/icon.svg/route.js +55 -55
  218. package/.next/standalone/.next/server/app/manifest.webmanifest/route.js +18 -18
  219. package/.next/standalone/.next/server/app/page.js +2112 -1235
  220. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  221. package/.next/standalone/.next/server/app/setup/page.js +91 -91
  222. package/.next/standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  223. package/.next/standalone/.next/server/app-paths-manifest.json +2 -1
  224. package/.next/standalone/.next/server/chunks/1244.js +136 -4
  225. package/.next/standalone/.next/server/chunks/1387.js +733 -57
  226. package/.next/standalone/.next/server/chunks/1433.js +1 -1
  227. package/.next/standalone/.next/server/chunks/210.js +3 -3
  228. package/.next/standalone/.next/server/chunks/2175.js +874 -0
  229. package/.next/standalone/.next/server/chunks/3042.js +34 -32
  230. package/.next/standalone/.next/server/chunks/309.js +21 -40
  231. package/.next/standalone/.next/server/chunks/3272.js +21 -40
  232. package/.next/standalone/.next/server/chunks/{540.js → 3326.js} +189 -61
  233. package/.next/standalone/.next/server/chunks/{6142.js → 3479.js} +170 -159
  234. package/.next/standalone/.next/server/chunks/3566.js +1 -1
  235. package/.next/standalone/.next/server/chunks/{5323.js → 3692.js} +31 -3
  236. package/.next/standalone/.next/server/chunks/4189.js +14 -2
  237. package/.next/standalone/.next/server/chunks/4377.js +2 -2
  238. package/.next/standalone/.next/server/chunks/4596.js +18 -9
  239. package/.next/standalone/.next/server/chunks/{639.js → 4728.js} +23676 -22755
  240. package/.next/standalone/.next/server/chunks/4955.js +81 -14
  241. package/.next/standalone/.next/server/chunks/5290.js +136 -5
  242. package/.next/standalone/.next/server/chunks/{2267.js → 6408.js} +990 -926
  243. package/.next/standalone/.next/server/chunks/{9667.js → 6911.js} +31 -3
  244. package/.next/standalone/.next/server/chunks/7033.js +7 -4
  245. package/.next/standalone/.next/server/chunks/7377.js +7 -4
  246. package/.next/standalone/.next/server/chunks/8461.js +31 -29
  247. package/.next/standalone/.next/server/chunks/9032.js +3 -3
  248. package/.next/standalone/.next/server/chunks/9174.js +18 -9
  249. package/.next/standalone/.next/server/chunks/9408.js +37 -15
  250. package/.next/standalone/.next/server/chunks/9824.js +2288 -2288
  251. package/.next/standalone/.next/server/middleware-build-manifest.js +2 -2
  252. package/.next/standalone/.next/server/middleware.js +104638 -104532
  253. package/.next/standalone/.next/server/pages/404.html +2 -2
  254. package/.next/standalone/.next/server/pages/500.html +1 -1
  255. package/.next/standalone/.next/server/preview-props.json +3 -3
  256. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  257. package/.next/standalone/.next/static/2BAUJZ7x8eXCYpuZ-Kp7h/_buildManifest.js +1 -0
  258. package/.next/standalone/.next/static/chunks/{877-145c9df8aa0aee63.js → 877-367eb49b20edd3d6.js} +38 -16
  259. package/.next/standalone/.next/static/chunks/app/_global-error/page-6cda89771c3f8ea4.js +17 -0
  260. package/.next/standalone/.next/static/chunks/app/api/v1/access/[identity]/route-6cda89771c3f8ea4.js +17 -0
  261. package/.next/standalone/.next/static/chunks/app/api/v1/access/route-6cda89771c3f8ea4.js +17 -0
  262. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/compact/route-6cda89771c3f8ea4.js +17 -0
  263. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/display-filters/route-6cda89771c3f8ea4.js +17 -0
  264. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/duplicate/route-6cda89771c3f8ea4.js +17 -0
  265. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/route-6cda89771c3f8ea4.js +17 -0
  266. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/thread/route-6cda89771c3f8ea4.js +17 -0
  267. package/.next/standalone/.next/static/chunks/app/api/v1/agents/recent-replies/route-6cda89771c3f8ea4.js +17 -0
  268. package/.next/standalone/.next/static/chunks/app/api/v1/agents/route-6cda89771c3f8ea4.js +17 -0
  269. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/[hostname]/route-6cda89771c3f8ea4.js +17 -0
  270. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/route-6cda89771c3f8ea4.js +17 -0
  271. package/.next/standalone/.next/static/chunks/app/api/v1/artifacts/lifecycle/route-6cda89771c3f8ea4.js +17 -0
  272. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/files/route-6cda89771c3f8ea4.js +17 -0
  273. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/images/route-6cda89771c3f8ea4.js +17 -0
  274. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/chats/route-6cda89771c3f8ea4.js +17 -0
  275. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/[remote_jid]/route-6cda89771c3f8ea4.js +17 -0
  276. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/route-6cda89771c3f8ea4.js +17 -0
  277. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/lookup/route-6cda89771c3f8ea4.js +17 -0
  278. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/pair/route-6cda89771c3f8ea4.js +17 -0
  279. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/route-6cda89771c3f8ea4.js +17 -0
  280. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/[route_id]/route-6cda89771c3f8ea4.js +17 -0
  281. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/route-6cda89771c3f8ea4.js +17 -0
  282. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/status/route-6cda89771c3f8ea4.js +17 -0
  283. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/kinds/route-6cda89771c3f8ea4.js +17 -0
  284. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/route-6cda89771c3f8ea4.js +17 -0
  285. package/.next/standalone/.next/static/chunks/app/api/v1/builtin-tools/route-6cda89771c3f8ea4.js +17 -0
  286. package/.next/standalone/.next/static/chunks/app/api/v1/config/route-6cda89771c3f8ea4.js +17 -0
  287. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/[id]/route-6cda89771c3f8ea4.js +17 -0
  288. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/route-6cda89771c3f8ea4.js +17 -0
  289. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/currency/route-6cda89771c3f8ea4.js +17 -0
  290. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/metrics/route-6cda89771c3f8ea4.js +17 -0
  291. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing/route-6cda89771c3f8ea4.js +17 -0
  292. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing-task/route-6cda89771c3f8ea4.js +17 -0
  293. package/.next/standalone/.next/static/chunks/app/api/v1/delegations/codex/[job_id]/route-6cda89771c3f8ea4.js +17 -0
  294. package/.next/standalone/.next/static/chunks/app/api/v1/documents/recall-policy/route-6cda89771c3f8ea4.js +17 -0
  295. package/.next/standalone/.next/static/chunks/app/api/v1/documents/search/route-6cda89771c3f8ea4.js +17 -0
  296. package/.next/standalone/.next/static/chunks/app/api/v1/documents/settings/route-6cda89771c3f8ea4.js +17 -0
  297. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/reindex/route-6cda89771c3f8ea4.js +17 -0
  298. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/route-6cda89771c3f8ea4.js +17 -0
  299. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/route-6cda89771c3f8ea4.js +17 -0
  300. package/.next/standalone/.next/static/chunks/app/api/v1/env/route-6cda89771c3f8ea4.js +17 -0
  301. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/allowlist/route-6cda89771c3f8ea4.js +17 -0
  302. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/route-6cda89771c3f8ea4.js +17 -0
  303. package/.next/standalone/.next/static/chunks/app/api/v1/events/route-6cda89771c3f8ea4.js +17 -0
  304. package/.next/standalone/.next/static/chunks/app/api/v1/events/test/route-6cda89771c3f8ea4.js +17 -0
  305. package/.next/standalone/.next/static/chunks/app/api/v1/extension/agents/route-6cda89771c3f8ea4.js +17 -0
  306. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/activate/route-6cda89771c3f8ea4.js +17 -0
  307. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/foreground/route-6cda89771c3f8ea4.js +17 -0
  308. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/history/route-6cda89771c3f8ea4.js +17 -0
  309. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/poll/route-6cda89771c3f8ea4.js +17 -0
  310. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/progress/route-6cda89771c3f8ea4.js +17 -0
  311. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/result/route-6cda89771c3f8ea4.js +17 -0
  312. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/retry/route-6cda89771c3f8ea4.js +17 -0
  313. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/status/route-6cda89771c3f8ea4.js +17 -0
  314. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/tabs/route-6cda89771c3f8ea4.js +17 -0
  315. package/.next/standalone/.next/static/chunks/app/api/v1/extension/fill/route-6cda89771c3f8ea4.js +17 -0
  316. package/.next/standalone/.next/static/chunks/app/api/v1/extension/refine/route-6cda89771c3f8ea4.js +17 -0
  317. package/.next/standalone/.next/static/chunks/app/api/v1/extension/turn/route-6cda89771c3f8ea4.js +17 -0
  318. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/route-6cda89771c3f8ea4.js +17 -0
  319. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/config/route-6cda89771c3f8ea4.js +17 -0
  320. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/route-6cda89771c3f8ea4.js +17 -0
  321. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/secrets/route-6cda89771c3f8ea4.js +17 -0
  322. package/.next/standalone/.next/static/chunks/app/api/v1/files/[name]/route-6cda89771c3f8ea4.js +17 -0
  323. package/.next/standalone/.next/static/chunks/app/api/v1/fs/browse/route-6cda89771c3f8ea4.js +17 -0
  324. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/[id]/route-6cda89771c3f8ea4.js +17 -0
  325. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/default/route-6cda89771c3f8ea4.js +17 -0
  326. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/route-6cda89771c3f8ea4.js +17 -0
  327. package/.next/standalone/.next/static/chunks/app/api/v1/health/probes/route-6cda89771c3f8ea4.js +17 -0
  328. package/.next/standalone/.next/static/chunks/app/api/v1/health/route-6cda89771c3f8ea4.js +17 -0
  329. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/route-6cda89771c3f8ea4.js +17 -0
  330. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/test/route-6cda89771c3f8ea4.js +17 -0
  331. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/callback/route-6cda89771c3f8ea4.js +17 -0
  332. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/start/route-6cda89771c3f8ea4.js +17 -0
  333. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/status/route-6cda89771c3f8ea4.js +17 -0
  334. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/callback/route-6cda89771c3f8ea4.js +17 -0
  335. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/start/route-6cda89771c3f8ea4.js +17 -0
  336. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/status/route-6cda89771c3f8ea4.js +17 -0
  337. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/route-6cda89771c3f8ea4.js +17 -0
  338. package/.next/standalone/.next/static/chunks/app/api/v1/lifecycle/adoption/route-6cda89771c3f8ea4.js +17 -0
  339. package/.next/standalone/.next/static/chunks/app/api/v1/local-file/route-6cda89771c3f8ea4.js +17 -0
  340. package/.next/standalone/.next/static/chunks/app/api/v1/logs/route-6cda89771c3f8ea4.js +17 -0
  341. package/.next/standalone/.next/static/chunks/app/api/v1/maps/embed/route-6cda89771c3f8ea4.js +17 -0
  342. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/[name]/route-6cda89771c3f8ea4.js +17 -0
  343. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/registry/route-6cda89771c3f8ea4.js +17 -0
  344. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/route-6cda89771c3f8ea4.js +17 -0
  345. package/.next/standalone/.next/static/chunks/app/api/v1/memory/[namespace]/[key]/route-6cda89771c3f8ea4.js +17 -0
  346. package/.next/standalone/.next/static/chunks/app/api/v1/memory/policy/route-6cda89771c3f8ea4.js +17 -0
  347. package/.next/standalone/.next/static/chunks/app/api/v1/memory/route-6cda89771c3f8ea4.js +17 -0
  348. package/.next/standalone/.next/static/chunks/app/api/v1/memory/search/route-6cda89771c3f8ea4.js +17 -0
  349. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/compact-threads/route-6cda89771c3f8ea4.js +17 -0
  350. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/route-6cda89771c3f8ea4.js +17 -0
  351. package/.next/standalone/.next/static/chunks/app/api/v1/models/route-6cda89771c3f8ea4.js +17 -0
  352. package/.next/standalone/.next/static/chunks/app/api/v1/packages/catalog/route-6cda89771c3f8ea4.js +17 -0
  353. package/.next/standalone/.next/static/chunks/app/api/v1/packages/defaults/[id]/route-6cda89771c3f8ea4.js +17 -0
  354. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/[id]/route-6cda89771c3f8ea4.js +17 -0
  355. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/route-6cda89771c3f8ea4.js +17 -0
  356. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/enabled/route-6cda89771c3f8ea4.js +17 -0
  357. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/route-6cda89771c3f8ea4.js +17 -0
  358. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/route-6cda89771c3f8ea4.js +17 -0
  359. package/.next/standalone/.next/static/chunks/app/api/v1/packages/reload/route-6cda89771c3f8ea4.js +17 -0
  360. package/.next/standalone/.next/static/chunks/app/api/v1/packages/route-6cda89771c3f8ea4.js +17 -0
  361. package/.next/standalone/.next/static/chunks/app/api/v1/page-capture/route-6cda89771c3f8ea4.js +17 -0
  362. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/approve/route-6cda89771c3f8ea4.js +17 -0
  363. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/deny/route-6cda89771c3f8ea4.js +17 -0
  364. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/route-6cda89771c3f8ea4.js +17 -0
  365. package/.next/standalone/.next/static/chunks/app/api/v1/profile/location/route-6cda89771c3f8ea4.js +17 -0
  366. package/.next/standalone/.next/static/chunks/app/api/v1/profile/route-6cda89771c3f8ea4.js +17 -0
  367. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/models/route-6cda89771c3f8ea4.js +17 -0
  368. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/probe/route-6cda89771c3f8ea4.js +17 -0
  369. package/.next/standalone/.next/static/chunks/app/api/v1/providers/github-copilot/auth/route-6cda89771c3f8ea4.js +17 -0
  370. package/.next/standalone/.next/static/chunks/app/api/v1/providers/route-6cda89771c3f8ea4.js +17 -0
  371. package/.next/standalone/.next/static/chunks/app/api/v1/proxy-config/route-6cda89771c3f8ea4.js +17 -0
  372. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/init/route-6cda89771c3f8ea4.js +17 -0
  373. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/route-6cda89771c3f8ea4.js +17 -0
  374. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/route-6cda89771c3f8ea4.js +17 -0
  375. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/run/route-6cda89771c3f8ea4.js +17 -0
  376. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/route-6cda89771c3f8ea4.js +17 -0
  377. package/.next/standalone/.next/static/chunks/app/api/v1/security/idle-timeout/route-6cda89771c3f8ea4.js +17 -0
  378. package/.next/standalone/.next/static/chunks/app/api/v1/security/pin/route-6cda89771c3f8ea4.js +17 -0
  379. package/.next/standalone/.next/static/chunks/app/api/v1/security/state/route-6cda89771c3f8ea4.js +17 -0
  380. package/.next/standalone/.next/static/chunks/app/api/v1/security/unlock/route-6cda89771c3f8ea4.js +17 -0
  381. package/.next/standalone/.next/static/chunks/app/api/v1/security/verify-pin/route-6cda89771c3f8ea4.js +17 -0
  382. package/.next/standalone/.next/static/chunks/app/api/v1/setup/test-key/route-6cda89771c3f8ea4.js +17 -0
  383. package/.next/standalone/.next/static/chunks/app/api/v1/skills/[id]/route-6cda89771c3f8ea4.js +17 -0
  384. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/[id]/route-6cda89771c3f8ea4.js +17 -0
  385. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/route-6cda89771c3f8ea4.js +17 -0
  386. package/.next/standalone/.next/static/chunks/app/api/v1/skills/route-6cda89771c3f8ea4.js +17 -0
  387. package/.next/standalone/.next/static/chunks/app/api/v1/system/abort/route-6cda89771c3f8ea4.js +17 -0
  388. package/.next/standalone/.next/static/chunks/app/api/v1/system/restart/route-6cda89771c3f8ea4.js +17 -0
  389. package/.next/standalone/.next/static/chunks/app/api/v1/tailscale/route-6cda89771c3f8ea4.js +17 -0
  390. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/[agent_id]/route-6cda89771c3f8ea4.js +17 -0
  391. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/route-6cda89771c3f8ea4.js +17 -0
  392. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/activity/route-6cda89771c3f8ea4.js +17 -0
  393. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/context-pin/route-6cda89771c3f8ea4.js +17 -0
  394. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/messages/[message_id]/route-6cda89771c3f8ea4.js +17 -0
  395. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/route-6cda89771c3f8ea4.js +17 -0
  396. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/run/route-6cda89771c3f8ea4.js +17 -0
  397. package/.next/standalone/.next/static/chunks/app/api/v1/threads/route-6cda89771c3f8ea4.js +17 -0
  398. package/.next/standalone/.next/static/chunks/app/api/v1/tools/route-6cda89771c3f8ea4.js +17 -0
  399. package/.next/standalone/.next/static/chunks/app/api/v1/update/apply/route-6cda89771c3f8ea4.js +17 -0
  400. package/.next/standalone/.next/static/chunks/app/api/v1/update/route-6cda89771c3f8ea4.js +17 -0
  401. package/.next/standalone/.next/static/chunks/app/api/v1/voice/transcribe/route-6cda89771c3f8ea4.js +17 -0
  402. package/.next/standalone/.next/static/chunks/app/api/v1/voice/tts/route-6cda89771c3f8ea4.js +17 -0
  403. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/route-6cda89771c3f8ea4.js +17 -0
  404. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/run/route-6cda89771c3f8ea4.js +17 -0
  405. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/reaction-scripts/route-6cda89771c3f8ea4.js +17 -0
  406. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/route-6cda89771c3f8ea4.js +17 -0
  407. package/.next/standalone/.next/static/chunks/app/manifest.webmanifest/route-6cda89771c3f8ea4.js +17 -0
  408. package/.next/standalone/.next/static/chunks/app/{page-64585ef79400f17f.js → page-a584dfa806a1afdb.js} +1082 -205
  409. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-6cda89771c3f8ea4.js +17 -0
  410. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-6cda89771c3f8ea4.js +17 -0
  411. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-6cda89771c3f8ea4.js +17 -0
  412. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-6cda89771c3f8ea4.js +17 -0
  413. package/.next/standalone/.next/static/css/19e1cd815490b47c.css +5 -0
  414. package/.next/standalone/docs/adoption/changesets.json +148 -0
  415. package/.next/standalone/package.json +5 -4
  416. package/CHANGELOG.md +51 -0
  417. package/README.md +115 -1
  418. package/api/client.startup.test.ts +29 -0
  419. package/api/client.ts +9 -2
  420. package/api/types.ts +20 -1
  421. package/app/api/v1/dashboard/pricing-task/route.ts +3 -1
  422. package/app/api/v1/documents/recall-policy/route.test.ts +59 -0
  423. package/app/api/v1/documents/recall-policy/route.ts +20 -0
  424. package/app/api/v1/documents/search/route.test.ts +36 -0
  425. package/app/api/v1/documents/search/route.ts +17 -5
  426. package/app/api/v1/documents/sources/[id]/reindex/route.test.ts +44 -0
  427. package/app/api/v1/documents/sources/[id]/reindex/route.ts +4 -1
  428. package/app/api/v1/documents/sources/route.test.ts +67 -0
  429. package/app/api/v1/documents/sources/route.ts +20 -2
  430. package/app/api/v1/models/[name]/route.ts +2 -0
  431. package/app/api/v1/models/route.ts +4 -0
  432. package/app/api/v1/providers/[provider]/models/route.test.ts +28 -0
  433. package/app/api/v1/providers/[provider]/models/route.ts +16 -2
  434. package/app/globals.css +51 -4
  435. package/components/agents/AgentsPanel.tsx +2 -2
  436. package/components/agents/agent-editor/AdvancedSection.tsx +1 -1
  437. package/components/agents/agent-editor/ModelSection.tsx +2 -2
  438. package/components/bridges/BridgeEditor.tsx +1 -1
  439. package/components/bridges/BridgesPanel.tsx +1 -1
  440. package/components/chat/InputBar.tsx +1 -1
  441. package/components/chat/MessageList.tsx +3 -3
  442. package/components/chat/useUserProfileAndAgent.test.tsx +43 -1
  443. package/components/chat/useUserProfileAndAgent.ts +16 -5
  444. package/components/credentials/CredentialsPanel.tsx +1 -1
  445. package/components/dashboard/CostBreakdown.test.tsx +34 -0
  446. package/components/dashboard/CostBreakdown.tsx +21 -0
  447. package/components/dashboard/DashboardPanel.test.tsx +9 -0
  448. package/components/dashboard/DashboardPanel.tsx +3 -3
  449. package/components/dashboard/Donuts.tsx +5 -2
  450. package/components/dashboard/ModelPricingSection.test.tsx +42 -0
  451. package/components/dashboard/ModelPricingSection.tsx +23 -21
  452. package/components/dashboard/Series.test.tsx +1 -0
  453. package/components/dashboard/Series.tsx +5 -0
  454. package/components/dashboard/SummaryCards.tsx +39 -27
  455. package/components/dashboard/VendorModelReportSection.tsx +2 -0
  456. package/components/documents/AddSourceFields.tsx +52 -15
  457. package/components/documents/AddSourceForm.tsx +61 -19
  458. package/components/documents/DocumentsPanel.tsx +22 -2
  459. package/components/documents/RecallExclusions.tsx +73 -0
  460. package/components/documents/SearchProbe.tsx +42 -5
  461. package/components/documents/helpers.ts +17 -3
  462. package/components/documents/indexing-controls.test.tsx +137 -0
  463. package/components/documents/useDocumentsPanel.test.tsx +87 -0
  464. package/components/documents/useDocumentsPanel.ts +47 -6
  465. package/components/env/EnvVarsPanel.tsx +1 -1
  466. package/components/harness/HarnessPanel.tsx +2 -2
  467. package/components/integrations/NetworkPanel.tsx +1 -1
  468. package/components/layout/AgentCardControls.test.tsx +162 -0
  469. package/components/layout/AgentCardControls.tsx +126 -0
  470. package/components/layout/AgentSwitcher.test.tsx +37 -0
  471. package/components/layout/AgentSwitcher.tsx +28 -3
  472. package/components/layout/AppShell.tsx +16 -9
  473. package/components/layout/MenuPanel.test.tsx +125 -2
  474. package/components/layout/MenuPanel.tsx +96 -2
  475. package/components/logs/LogsPanel.tsx +1 -1
  476. package/components/mcp/MCPPanel.tsx +1 -1
  477. package/components/memory/UnifiedMemoryPanel.tsx +4 -4
  478. package/components/models/CapBadges.tsx +1 -1
  479. package/components/models/EmbeddingModelSection.test.tsx +41 -0
  480. package/components/models/EmbeddingModelSection.tsx +5 -0
  481. package/components/models/ModelFeatureGuide.tsx +16 -8
  482. package/components/models/ModelsPanel.tsx +8 -3
  483. package/components/models/model-editor/ModelEditorBody.tsx +1 -0
  484. package/components/models/model-editor/ModelIdSection.tsx +5 -0
  485. package/components/profile/ProfileEditor.test.tsx +70 -0
  486. package/components/profile/ProfileEditor.tsx +6 -2
  487. package/components/profile/ProfilePanel.test.tsx +6 -0
  488. package/components/profile/ProfilePanel.tsx +1 -1
  489. package/components/scheduled-tasks/ScheduledTasksPanel.tsx +1 -1
  490. package/components/settings/AppearancePanel.tsx +1 -1
  491. package/components/settings/SettingsPanel.test.tsx +23 -0
  492. package/components/settings/SettingsPanel.tsx +2 -2
  493. package/components/skills/SkillsPanel.tsx +1 -1
  494. package/components/tools/BrowserPanel.tsx +1 -1
  495. package/components/tools/PackagesPanel.tsx +1 -1
  496. package/components/tools/UnifiedPackageList.tsx +1 -1
  497. package/components/ui/PanelHeader.tsx +1 -1
  498. package/components/ui/SubTabBar.tsx +1 -1
  499. package/docs/INSTALL.md +7 -5
  500. package/hooks/useAgents.ts +2 -2
  501. package/lib/agents/prepare/system-prompt.test.ts +65 -0
  502. package/lib/agents/prepare/system-prompt.ts +27 -20
  503. package/lib/agents/prompt-registry.test.ts +42 -0
  504. package/lib/agents/prompt-registry.ts +21 -0
  505. package/lib/bridges/whatsapp.inbound.test.ts +38 -1
  506. package/lib/bridges/whatsapp.ts +10 -33
  507. package/lib/db/index.ts +2 -0
  508. package/lib/db/migrations.test.ts +10 -0
  509. package/lib/db/migrations.ts +10 -0
  510. package/lib/db/statement-cache.test.ts +77 -0
  511. package/lib/db/statement-cache.ts +31 -0
  512. package/lib/documents/indexer.test.ts +16 -1
  513. package/lib/documents/indexer.ts +8 -7
  514. package/lib/documents/mail-source-config.ts +31 -0
  515. package/lib/documents/recall-policy.ts +24 -0
  516. package/lib/documents/remote/icloud.ts +56 -0
  517. package/lib/documents/remote/index.ts +4 -1
  518. package/lib/documents/remote/mail.test.ts +232 -0
  519. package/lib/documents/remote/mail.ts +48 -40
  520. package/lib/documents/search.test.ts +81 -2
  521. package/lib/documents/search.ts +47 -7
  522. package/lib/embeddings/cache.test.ts +16 -2
  523. package/lib/embeddings/index.test.ts +7 -0
  524. package/lib/embeddings/index.ts +12 -1
  525. package/lib/integrations/deepseek-web/manifest.ts +68 -0
  526. package/lib/integrations/gmail/manifest.ts +2 -3
  527. package/lib/integrations/icloud/manifest.ts +19 -5
  528. package/lib/integrations/registry.test.ts +8 -0
  529. package/lib/integrations/registry.ts +2 -0
  530. package/lib/lifecycle/changeset-build.test.ts +3 -0
  531. package/lib/lifecycle/changeset-build.ts +6 -0
  532. package/lib/lifecycle/changesets.ts +9 -0
  533. package/lib/pricing/llm-extract.ts +1 -1
  534. package/lib/pricing/maintenance-task.ts +19 -3
  535. package/lib/pricing/model-updates.test.ts +192 -0
  536. package/lib/pricing/model-updates.ts +205 -0
  537. package/lib/stores/app-settings.ts +17 -1
  538. package/lib/stores/dashboard-metrics-cache.test.ts +44 -0
  539. package/lib/stores/dashboard-metrics.test.ts +47 -4
  540. package/lib/stores/dashboard-metrics.ts +73 -8
  541. package/lib/stores/document-sources.ts +1 -0
  542. package/lib/stores/integrations.test.ts +20 -0
  543. package/lib/stores/integrations.ts +15 -4
  544. package/lib/stores/langgraph-store.test.ts +53 -0
  545. package/lib/stores/langgraph-store.ts +9 -21
  546. package/lib/stores/model-metadata.ts +89 -0
  547. package/lib/stores/threads.test.ts +34 -0
  548. package/lib/stores/threads.ts +17 -20
  549. package/lib/stores/tool-stats.test.ts +31 -0
  550. package/lib/stores/tool-stats.ts +16 -0
  551. package/lib/stores/version-adoption.test.ts +8 -0
  552. package/lib/stores/version-adoption.ts +5 -2
  553. package/lib/tools/general/documents.test.ts +5 -0
  554. package/lib/tools/general/pricing-maintenance.test.ts +5 -0
  555. package/lib/tools/general/pricing-maintenance.ts +4 -1
  556. package/lib/tools/packages/default-packages/icloud.test.ts +49 -0
  557. package/lib/tools/packages/default-packages/icloud.ts +8 -6
  558. package/lib/tools/packages/default-packages.test.ts +16 -0
  559. package/lib/tools/packages/langchain-packages.ts +2 -2
  560. package/lib/tools/runtime/category-filter.test.ts +22 -0
  561. package/lib/tools/web/deepseek.test.ts +76 -0
  562. package/lib/tools/web/deepseek.ts +68 -0
  563. package/lib/tools/web/fetch.test.ts +130 -2
  564. package/lib/tools/web/fetch.ts +48 -1
  565. package/lib/tools/web/search.test.ts +139 -2
  566. package/lib/tools/web/search.ts +48 -1
  567. package/lib/triggers/handlers/scheduled-task.test.ts +18 -0
  568. package/lib/triggers/handlers/scheduled-task.ts +6 -0
  569. package/lib/ui/feature-readiness.test.ts +7 -0
  570. package/lib/ui/feature-readiness.ts +2 -1
  571. package/package.json +5 -4
  572. package/scripts/check-npm-package.mjs +1 -0
  573. package/scripts/jarela-bin.mjs +3 -0
  574. package/scripts/runtime-version.mjs +19 -0
  575. package/scripts/start-prod.mjs +3 -0
  576. package/.next/standalone/.next/static/6qLnqWdsfBTJOAJApUYXy/_buildManifest.js +0 -1
  577. package/.next/standalone/.next/static/chunks/app/_global-error/page-f6b126e5c5b11551.js +0 -17
  578. package/.next/standalone/.next/static/chunks/app/api/v1/access/[identity]/route-f6b126e5c5b11551.js +0 -17
  579. package/.next/standalone/.next/static/chunks/app/api/v1/access/route-f6b126e5c5b11551.js +0 -17
  580. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/compact/route-f6b126e5c5b11551.js +0 -17
  581. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/display-filters/route-f6b126e5c5b11551.js +0 -17
  582. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/duplicate/route-f6b126e5c5b11551.js +0 -17
  583. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/route-f6b126e5c5b11551.js +0 -17
  584. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/thread/route-f6b126e5c5b11551.js +0 -17
  585. package/.next/standalone/.next/static/chunks/app/api/v1/agents/recent-replies/route-f6b126e5c5b11551.js +0 -17
  586. package/.next/standalone/.next/static/chunks/app/api/v1/agents/route-f6b126e5c5b11551.js +0 -17
  587. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/[hostname]/route-f6b126e5c5b11551.js +0 -17
  588. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/route-f6b126e5c5b11551.js +0 -17
  589. package/.next/standalone/.next/static/chunks/app/api/v1/artifacts/lifecycle/route-f6b126e5c5b11551.js +0 -17
  590. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/files/route-f6b126e5c5b11551.js +0 -17
  591. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/images/route-f6b126e5c5b11551.js +0 -17
  592. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/chats/route-f6b126e5c5b11551.js +0 -17
  593. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/[remote_jid]/route-f6b126e5c5b11551.js +0 -17
  594. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/route-f6b126e5c5b11551.js +0 -17
  595. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/lookup/route-f6b126e5c5b11551.js +0 -17
  596. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/pair/route-f6b126e5c5b11551.js +0 -17
  597. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/route-f6b126e5c5b11551.js +0 -17
  598. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/[route_id]/route-f6b126e5c5b11551.js +0 -17
  599. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/route-f6b126e5c5b11551.js +0 -17
  600. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/status/route-f6b126e5c5b11551.js +0 -17
  601. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/kinds/route-f6b126e5c5b11551.js +0 -17
  602. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/route-f6b126e5c5b11551.js +0 -17
  603. package/.next/standalone/.next/static/chunks/app/api/v1/builtin-tools/route-f6b126e5c5b11551.js +0 -17
  604. package/.next/standalone/.next/static/chunks/app/api/v1/config/route-f6b126e5c5b11551.js +0 -17
  605. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/[id]/route-f6b126e5c5b11551.js +0 -17
  606. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/route-f6b126e5c5b11551.js +0 -17
  607. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/currency/route-f6b126e5c5b11551.js +0 -17
  608. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/metrics/route-f6b126e5c5b11551.js +0 -17
  609. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing/route-f6b126e5c5b11551.js +0 -17
  610. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing-task/route-f6b126e5c5b11551.js +0 -17
  611. package/.next/standalone/.next/static/chunks/app/api/v1/delegations/codex/[job_id]/route-f6b126e5c5b11551.js +0 -17
  612. package/.next/standalone/.next/static/chunks/app/api/v1/documents/search/route-f6b126e5c5b11551.js +0 -17
  613. package/.next/standalone/.next/static/chunks/app/api/v1/documents/settings/route-f6b126e5c5b11551.js +0 -17
  614. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/reindex/route-f6b126e5c5b11551.js +0 -17
  615. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/route-f6b126e5c5b11551.js +0 -17
  616. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/route-f6b126e5c5b11551.js +0 -17
  617. package/.next/standalone/.next/static/chunks/app/api/v1/env/route-f6b126e5c5b11551.js +0 -17
  618. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/allowlist/route-f6b126e5c5b11551.js +0 -17
  619. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/route-f6b126e5c5b11551.js +0 -17
  620. package/.next/standalone/.next/static/chunks/app/api/v1/events/route-f6b126e5c5b11551.js +0 -17
  621. package/.next/standalone/.next/static/chunks/app/api/v1/events/test/route-f6b126e5c5b11551.js +0 -17
  622. package/.next/standalone/.next/static/chunks/app/api/v1/extension/agents/route-f6b126e5c5b11551.js +0 -17
  623. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/activate/route-f6b126e5c5b11551.js +0 -17
  624. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/foreground/route-f6b126e5c5b11551.js +0 -17
  625. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/history/route-f6b126e5c5b11551.js +0 -17
  626. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/poll/route-f6b126e5c5b11551.js +0 -17
  627. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/progress/route-f6b126e5c5b11551.js +0 -17
  628. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/result/route-f6b126e5c5b11551.js +0 -17
  629. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/retry/route-f6b126e5c5b11551.js +0 -17
  630. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/status/route-f6b126e5c5b11551.js +0 -17
  631. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/tabs/route-f6b126e5c5b11551.js +0 -17
  632. package/.next/standalone/.next/static/chunks/app/api/v1/extension/fill/route-f6b126e5c5b11551.js +0 -17
  633. package/.next/standalone/.next/static/chunks/app/api/v1/extension/refine/route-f6b126e5c5b11551.js +0 -17
  634. package/.next/standalone/.next/static/chunks/app/api/v1/extension/turn/route-f6b126e5c5b11551.js +0 -17
  635. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/route-f6b126e5c5b11551.js +0 -17
  636. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/config/route-f6b126e5c5b11551.js +0 -17
  637. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/route-f6b126e5c5b11551.js +0 -17
  638. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/secrets/route-f6b126e5c5b11551.js +0 -17
  639. package/.next/standalone/.next/static/chunks/app/api/v1/files/[name]/route-f6b126e5c5b11551.js +0 -17
  640. package/.next/standalone/.next/static/chunks/app/api/v1/fs/browse/route-f6b126e5c5b11551.js +0 -17
  641. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/[id]/route-f6b126e5c5b11551.js +0 -17
  642. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/default/route-f6b126e5c5b11551.js +0 -17
  643. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/route-f6b126e5c5b11551.js +0 -17
  644. package/.next/standalone/.next/static/chunks/app/api/v1/health/probes/route-f6b126e5c5b11551.js +0 -17
  645. package/.next/standalone/.next/static/chunks/app/api/v1/health/route-f6b126e5c5b11551.js +0 -17
  646. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/route-f6b126e5c5b11551.js +0 -17
  647. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/test/route-f6b126e5c5b11551.js +0 -17
  648. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/callback/route-f6b126e5c5b11551.js +0 -17
  649. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/start/route-f6b126e5c5b11551.js +0 -17
  650. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/status/route-f6b126e5c5b11551.js +0 -17
  651. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/callback/route-f6b126e5c5b11551.js +0 -17
  652. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/start/route-f6b126e5c5b11551.js +0 -17
  653. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/status/route-f6b126e5c5b11551.js +0 -17
  654. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/route-f6b126e5c5b11551.js +0 -17
  655. package/.next/standalone/.next/static/chunks/app/api/v1/lifecycle/adoption/route-f6b126e5c5b11551.js +0 -17
  656. package/.next/standalone/.next/static/chunks/app/api/v1/local-file/route-f6b126e5c5b11551.js +0 -17
  657. package/.next/standalone/.next/static/chunks/app/api/v1/logs/route-f6b126e5c5b11551.js +0 -17
  658. package/.next/standalone/.next/static/chunks/app/api/v1/maps/embed/route-f6b126e5c5b11551.js +0 -17
  659. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/[name]/route-f6b126e5c5b11551.js +0 -17
  660. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/registry/route-f6b126e5c5b11551.js +0 -17
  661. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/route-f6b126e5c5b11551.js +0 -17
  662. package/.next/standalone/.next/static/chunks/app/api/v1/memory/[namespace]/[key]/route-f6b126e5c5b11551.js +0 -17
  663. package/.next/standalone/.next/static/chunks/app/api/v1/memory/policy/route-f6b126e5c5b11551.js +0 -17
  664. package/.next/standalone/.next/static/chunks/app/api/v1/memory/route-f6b126e5c5b11551.js +0 -17
  665. package/.next/standalone/.next/static/chunks/app/api/v1/memory/search/route-f6b126e5c5b11551.js +0 -17
  666. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/compact-threads/route-f6b126e5c5b11551.js +0 -17
  667. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/route-f6b126e5c5b11551.js +0 -17
  668. package/.next/standalone/.next/static/chunks/app/api/v1/models/route-f6b126e5c5b11551.js +0 -17
  669. package/.next/standalone/.next/static/chunks/app/api/v1/packages/catalog/route-f6b126e5c5b11551.js +0 -17
  670. package/.next/standalone/.next/static/chunks/app/api/v1/packages/defaults/[id]/route-f6b126e5c5b11551.js +0 -17
  671. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/[id]/route-f6b126e5c5b11551.js +0 -17
  672. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/route-f6b126e5c5b11551.js +0 -17
  673. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/enabled/route-f6b126e5c5b11551.js +0 -17
  674. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/route-f6b126e5c5b11551.js +0 -17
  675. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/route-f6b126e5c5b11551.js +0 -17
  676. package/.next/standalone/.next/static/chunks/app/api/v1/packages/reload/route-f6b126e5c5b11551.js +0 -17
  677. package/.next/standalone/.next/static/chunks/app/api/v1/packages/route-f6b126e5c5b11551.js +0 -17
  678. package/.next/standalone/.next/static/chunks/app/api/v1/page-capture/route-f6b126e5c5b11551.js +0 -17
  679. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/approve/route-f6b126e5c5b11551.js +0 -17
  680. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/deny/route-f6b126e5c5b11551.js +0 -17
  681. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/route-f6b126e5c5b11551.js +0 -17
  682. package/.next/standalone/.next/static/chunks/app/api/v1/profile/location/route-f6b126e5c5b11551.js +0 -17
  683. package/.next/standalone/.next/static/chunks/app/api/v1/profile/route-f6b126e5c5b11551.js +0 -17
  684. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/models/route-f6b126e5c5b11551.js +0 -17
  685. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/probe/route-f6b126e5c5b11551.js +0 -17
  686. package/.next/standalone/.next/static/chunks/app/api/v1/providers/github-copilot/auth/route-f6b126e5c5b11551.js +0 -17
  687. package/.next/standalone/.next/static/chunks/app/api/v1/providers/route-f6b126e5c5b11551.js +0 -17
  688. package/.next/standalone/.next/static/chunks/app/api/v1/proxy-config/route-f6b126e5c5b11551.js +0 -17
  689. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/init/route-f6b126e5c5b11551.js +0 -17
  690. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/route-f6b126e5c5b11551.js +0 -17
  691. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/route-f6b126e5c5b11551.js +0 -17
  692. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/run/route-f6b126e5c5b11551.js +0 -17
  693. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/route-f6b126e5c5b11551.js +0 -17
  694. package/.next/standalone/.next/static/chunks/app/api/v1/security/idle-timeout/route-f6b126e5c5b11551.js +0 -17
  695. package/.next/standalone/.next/static/chunks/app/api/v1/security/pin/route-f6b126e5c5b11551.js +0 -17
  696. package/.next/standalone/.next/static/chunks/app/api/v1/security/state/route-f6b126e5c5b11551.js +0 -17
  697. package/.next/standalone/.next/static/chunks/app/api/v1/security/unlock/route-f6b126e5c5b11551.js +0 -17
  698. package/.next/standalone/.next/static/chunks/app/api/v1/security/verify-pin/route-f6b126e5c5b11551.js +0 -17
  699. package/.next/standalone/.next/static/chunks/app/api/v1/setup/test-key/route-f6b126e5c5b11551.js +0 -17
  700. package/.next/standalone/.next/static/chunks/app/api/v1/skills/[id]/route-f6b126e5c5b11551.js +0 -17
  701. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/[id]/route-f6b126e5c5b11551.js +0 -17
  702. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/route-f6b126e5c5b11551.js +0 -17
  703. package/.next/standalone/.next/static/chunks/app/api/v1/skills/route-f6b126e5c5b11551.js +0 -17
  704. package/.next/standalone/.next/static/chunks/app/api/v1/system/abort/route-f6b126e5c5b11551.js +0 -17
  705. package/.next/standalone/.next/static/chunks/app/api/v1/system/restart/route-f6b126e5c5b11551.js +0 -17
  706. package/.next/standalone/.next/static/chunks/app/api/v1/tailscale/route-f6b126e5c5b11551.js +0 -17
  707. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/[agent_id]/route-f6b126e5c5b11551.js +0 -17
  708. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/route-f6b126e5c5b11551.js +0 -17
  709. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/activity/route-f6b126e5c5b11551.js +0 -17
  710. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/context-pin/route-f6b126e5c5b11551.js +0 -17
  711. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/messages/[message_id]/route-f6b126e5c5b11551.js +0 -17
  712. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/route-f6b126e5c5b11551.js +0 -17
  713. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/run/route-f6b126e5c5b11551.js +0 -17
  714. package/.next/standalone/.next/static/chunks/app/api/v1/threads/route-f6b126e5c5b11551.js +0 -17
  715. package/.next/standalone/.next/static/chunks/app/api/v1/tools/route-f6b126e5c5b11551.js +0 -17
  716. package/.next/standalone/.next/static/chunks/app/api/v1/update/apply/route-f6b126e5c5b11551.js +0 -17
  717. package/.next/standalone/.next/static/chunks/app/api/v1/update/route-f6b126e5c5b11551.js +0 -17
  718. package/.next/standalone/.next/static/chunks/app/api/v1/voice/transcribe/route-f6b126e5c5b11551.js +0 -17
  719. package/.next/standalone/.next/static/chunks/app/api/v1/voice/tts/route-f6b126e5c5b11551.js +0 -17
  720. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/route-f6b126e5c5b11551.js +0 -17
  721. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/run/route-f6b126e5c5b11551.js +0 -17
  722. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/reaction-scripts/route-f6b126e5c5b11551.js +0 -17
  723. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/route-f6b126e5c5b11551.js +0 -17
  724. package/.next/standalone/.next/static/chunks/app/manifest.webmanifest/route-f6b126e5c5b11551.js +0 -17
  725. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-f6b126e5c5b11551.js +0 -17
  726. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-f6b126e5c5b11551.js +0 -17
  727. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-f6b126e5c5b11551.js +0 -17
  728. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-f6b126e5c5b11551.js +0 -17
  729. package/.next/standalone/.next/static/css/c4a8bed1da2c748f.css +0 -5
  730. /package/.next/standalone/.next/static/{6qLnqWdsfBTJOAJApUYXy → 2BAUJZ7x8eXCYpuZ-Kp7h}/_ssgManifest.js +0 -0
@@ -19,1419 +19,1419 @@ module.exports = require("node:async_hooks");
19
19
 
20
20
  /***/ }),
21
21
 
22
- /***/ 41720:
22
+ /***/ 26522:
23
23
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
24
24
 
25
+ __webpack_require__.r(__webpack_exports__);
25
26
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
26
- /* harmony export */ BM: () => (/* binding */ upsertAgentConfig),
27
- /* harmony export */ E1: () => (/* binding */ updateAgentDisplayFilters),
28
- /* harmony export */ P2: () => (/* binding */ parseCitationStrictness),
29
- /* harmony export */ S2: () => (/* binding */ getAgentToolCredentials),
30
- /* harmony export */ SJ: () => (/* binding */ generateAgentId),
31
- /* harmony export */ TG: () => (/* binding */ getAgentTools),
32
- /* harmony export */ bg: () => (/* binding */ parseDelegateTargets),
33
- /* harmony export */ d2: () => (/* binding */ DISPLAY_FILTER_KEYS),
34
- /* harmony export */ fg: () => (/* binding */ getAgentTierProportions),
35
- /* harmony export */ mJ: () => (/* binding */ getAgentConfig),
36
- /* harmony export */ nV: () => (/* binding */ getAgentDisplayFilters),
37
- /* harmony export */ vU: () => (/* binding */ getDefaultAgentConfig),
38
- /* harmony export */ vi: () => (/* binding */ DISPLAY_FILTER_DEFAULTS),
39
- /* harmony export */ vv: () => (/* binding */ duplicateAgentConfig),
40
- /* harmony export */ xi: () => (/* binding */ deleteAgentConfig),
41
- /* harmony export */ zb: () => (/* binding */ listAgentConfigs)
27
+ /* harmony export */ handler: () => (/* binding */ handler),
28
+ /* harmony export */ patchFetch: () => (/* binding */ patchFetch),
29
+ /* harmony export */ routeModule: () => (/* binding */ routeModule),
30
+ /* harmony export */ serverHooks: () => (/* binding */ serverHooks),
31
+ /* harmony export */ workAsyncStorage: () => (/* binding */ workAsyncStorage),
32
+ /* harmony export */ workUnitAsyncStorage: () => (/* binding */ workUnitAsyncStorage)
42
33
  /* harmony export */ });
43
- /* harmony import */ var _lib_db__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(251244);
44
- /* harmony import */ var _lib_db_transaction__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(999043);
45
- /* harmony import */ var _lib_agents_usage_profile__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(149720);
34
+ /* harmony import */ var next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(319225);
35
+ /* 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__);
36
+ /* harmony import */ var next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(684006);
37
+ /* harmony import */ var next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8317);
38
+ /* 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__);
39
+ /* harmony import */ var next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(799373);
40
+ /* 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__);
41
+ /* harmony import */ var next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(434775);
42
+ /* 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__);
43
+ /* harmony import */ var next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(524235);
44
+ /* 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__);
45
+ /* harmony import */ var next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(200261);
46
+ /* 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__);
47
+ /* harmony import */ var next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(754365);
48
+ /* 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__);
49
+ /* harmony import */ var next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(590771);
50
+ /* 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__);
51
+ /* harmony import */ var next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(473461);
52
+ /* 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__);
53
+ /* harmony import */ var next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(767798);
54
+ /* harmony import */ var next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(192280);
55
+ /* harmony import */ var next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(662018);
56
+ /* 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__);
57
+ /* harmony import */ var next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(445696);
58
+ /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(347929);
59
+ /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__);
60
+ /* harmony import */ var next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(986439);
61
+ /* 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__);
62
+ /* harmony import */ var next_dist_server_lib_route_cache_key__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(710246);
63
+ /* 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__);
64
+ /* harmony import */ var next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(137527);
65
+ /* 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__);
46
66
 
47
67
 
48
68
 
49
- const now = ()=>new Date().toISOString();
50
- /** Coerce arbitrary input (DB row TEXT, API body, undefined) to the enum.
51
- * Returns `null` for null/undefined/unknown values so callers can default. */ function parseCitationStrictness(value) {
52
- if (value === "off" || value === "informational" || value === "standard" || value === "strict") {
53
- return value;
54
- }
55
- return null;
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+ // We inject the nextConfigOutput here so that we can use them in the route
85
+ // module.
86
+ const nextConfigOutput = "standalone"
87
+ const routeModule = new next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__.AppRouteRouteModule({
88
+ definition: {
89
+ kind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
90
+ page: "/api/v1/bridges/route",
91
+ pathname: "/api/v1/bridges",
92
+ filename: "route",
93
+ bundlePath: "app/api/v1/bridges/route"
94
+ },
95
+ distDir: ".next" || 0,
96
+ relativeProjectDir: false || '',
97
+ resolvedPagePath: "/home/runner/work/jarela/jarela/app/api/v1/bridges/route.ts",
98
+ nextConfigOutput,
99
+ // The lazy require factory ensures that:
100
+ // - In dev: devRequestTimingInternalsEnd is set before userland executes,
101
+ // correctly attributing module load time to application-code rather than
102
+ // framework internals.
103
+ // - In all modes: async modules (route files with top-level await) are
104
+ // handled correctly — require() returns a Promise for such modules, which
105
+ // ensureUserland() awaits before the first request is handled.
106
+ userland: ()=>__webpack_require__(165581),
107
+ // In Turbopack dev mode, also provide a synchronous per-request getter so
108
+ // server HMR updates are picked up without re-executing the entry chunk.
109
+ // Using require() (synchronous) avoids adding async overhead that would be
110
+ // incorrectly attributed to application-code time in devRequestTiming.
111
+ ... false ? 0 : {}
112
+ });
113
+ // Pull out the exports that we need to expose from the module. This should
114
+ // be eliminated when we've moved the other routes to the new format. These
115
+ // are used to hook into the route.
116
+ const { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;
117
+ function patchFetch() {
118
+ return (0,next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__.patchFetch)({
119
+ workAsyncStorage,
120
+ workUnitAsyncStorage
121
+ });
56
122
  }
57
- /**
58
- * Parse the JSON-encoded per-agent override of context tier proportions.
59
- * Returns `null` for NULL, blank, malformed JSON, or any payload that
60
- * doesn't have three finite non-negative numeric fields. Callers fall
61
- * back to the model config's value (or built-in defaults) on null.
62
- */ function getAgentTierProportions(row) {
63
- const raw = row.context_tier_proportions;
64
- if (!raw) return null;
65
- try {
66
- const parsed = JSON.parse(raw);
67
- const hot = Number(parsed.hot);
68
- const warm = Number(parsed.warm);
69
- const facts = Number(parsed.facts);
70
- if (![
71
- hot,
72
- warm,
73
- facts
74
- ].every((n)=>Number.isFinite(n) && n >= 0)) return null;
75
- if (hot + warm + facts <= 0) return null;
76
- return {
77
- hot,
78
- warm,
79
- facts
80
- };
81
- } catch {
82
- return null;
123
+
124
+ async function handler(req, res, ctx) {
125
+ if (ctx.requestMeta) {
126
+ (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.setRequestMeta)(req, ctx.requestMeta);
83
127
  }
84
- }
85
- function listAgentConfigs() {
86
- // Default agent always first; then by the timestamp of each agent's latest message.
87
- return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare(`SELECT a.*
88
- FROM agent_configs a
89
- LEFT JOIN (
90
- SELECT t.agent_id, MAX(m.created_at) AS last_message_at
91
- FROM threads t
92
- JOIN messages m ON m.thread_id = t.thread_id
93
- GROUP BY t.agent_id
94
- ) latest ON latest.agent_id = a.id
95
- ORDER BY a.is_default DESC, COALESCE(latest.last_message_at, a.created_at) DESC, a.id ASC`).all();
96
- }
97
- function getDefaultAgentConfig() {
98
- return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("SELECT * FROM agent_configs WHERE is_default=1 LIMIT 1").get() ?? null;
99
- }
100
- function getAgentConfig(id) {
101
- return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("SELECT * FROM agent_configs WHERE id=?").get(id) ?? null;
102
- }
103
- /**
104
- * Parse the JSON-encoded delegate whitelist into a deduped string[]. Returns
105
- * an empty array for NULL, blank, or malformed JSON (delegation is opt-in).
106
- */ /**
107
- * Parse the agent's tool allowlist (`tools` column, stored as a JSON string).
108
- * Returns an empty array on NULL/blank/malformed JSON — same defensive shape
109
- * as parseDelegateTargets. Callers that previously did `JSON.parse(cfg.tools)`
110
- * inline should switch to this getter so the serialization contract stays
111
- * owned by this store.
112
- */ function getAgentTools(cfg) {
113
- if (!cfg?.tools) return [];
114
- try {
115
- const parsed = JSON.parse(cfg.tools);
116
- if (!Array.isArray(parsed)) return [];
117
- return parsed.filter((x)=>typeof x === "string" && x.length > 0);
118
- } catch {
119
- return [];
128
+ if (routeModule.isDev) {
129
+ (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.addRequestMeta)(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());
120
130
  }
121
- }
122
- function parseDelegateTargets(raw) {
123
- if (!raw) return [];
124
- try {
125
- const parsed = JSON.parse(raw);
126
- if (!Array.isArray(parsed)) return [];
127
- const ids = parsed.filter((x)=>typeof x === "string" && x.length > 0);
128
- return Array.from(new Set(ids));
129
- } catch {
130
- return [];
131
+ let srcPage = "/api/v1/bridges/route";
132
+ // turbopack doesn't normalize `/index` in the page name
133
+ // so we need to to process dynamic routes properly
134
+ // TODO: fix turbopack providing differing value from webpack
135
+ if (false) {} else if (srcPage === '/index') {
136
+ // we always normalize /index specifically
137
+ srcPage = '/';
131
138
  }
139
+ const multiZoneDraftMode = false;
140
+ // Registering `instrumentation.ts` usually installs the tracer provider, so
141
+ // do it before starting the request span. The span is started before
142
+ // `prepare`, so route module preparation is part of the request's trace.
143
+ // When this request triggers registration, the lifecycle spans of
144
+ // `instrumentation.ts` are emitted inside the request span.
145
+ const { instrumentation } = await routeModule.ensureInstrumentation(req, {
146
+ deferSpans: true
147
+ });
148
+ return routeModule.traceRequest(req, {
149
+ tracer: (0,next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.getTracer)(),
150
+ spanName: `${req.method || 'GET'} ${srcPage}`,
151
+ httpTarget: req.url,
152
+ instrumentation
153
+ }, (requestSpan, requestRootSpan)=>handleRequest(req, res, ctx, srcPage, multiZoneDraftMode, requestSpan, requestRootSpan));
132
154
  }
133
- /**
134
- * Parse the per-agent `{ toolName: credentialId }` override map stored in
135
- * the `tool_credentials` column. Returns an empty record on NULL / blank /
136
- * malformed JSON / non-string entries so downstream code can treat the
137
- * result as a plain lookup without further validation.
138
- */ function getAgentToolCredentials(cfg) {
139
- if (!cfg?.tool_credentials) return {};
140
- try {
141
- const parsed = JSON.parse(cfg.tool_credentials);
142
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
143
- const out = {};
144
- for (const [k, v] of Object.entries(parsed)){
145
- if (typeof v === "string" && v.length > 0) out[k] = v;
146
- }
147
- return out;
148
- } catch {
149
- return {};
155
+ async function handleRequest(req, res, ctx, srcPage, multiZoneDraftMode, requestSpan, requestRootSpan) {
156
+ const prepareResult = await routeModule.prepare(req, res, {
157
+ srcPage,
158
+ multiZoneDraftMode
159
+ });
160
+ if (!prepareResult) {
161
+ res.statusCode = 400;
162
+ res.end('Bad Request');
163
+ ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());
164
+ return null;
150
165
  }
151
- }
152
- function upsertAgentConfig(input) {
153
- return (0,_lib_db_transaction__WEBPACK_IMPORTED_MODULE_1__/* .withDbTransaction */ .J)(()=>upsertAgentConfigTransaction(input));
154
- }
155
- function upsertAgentConfigTransaction(input) {
156
- const t = now();
157
- const db = (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)();
158
- const existing = getAgentConfig(input.id);
159
- const created_at = existing?.created_at ?? t;
160
- const mbti = input.adaptive_mbti ?? existing?.adaptive_mbti ?? "INTJ";
161
- const strength = input.adaptive_persona_strength ?? existing?.adaptive_persona_strength ?? _lib_agents_usage_profile__WEBPACK_IMPORTED_MODULE_2__/* .DEFAULT_PERSONA_STYLE */ .vs.strength;
162
- const empathy = input.adaptive_empathy ?? existing?.adaptive_empathy ?? _lib_agents_usage_profile__WEBPACK_IMPORTED_MODULE_2__/* .DEFAULT_PERSONA_STYLE */ .vs.empathy;
163
- const expressiveness = input.adaptive_expressiveness ?? existing?.adaptive_expressiveness ?? _lib_agents_usage_profile__WEBPACK_IMPORTED_MODULE_2__/* .DEFAULT_PERSONA_STYLE */ .vs.expressiveness;
164
- const verbosity = input.adaptive_verbosity ?? existing?.adaptive_verbosity ?? _lib_agents_usage_profile__WEBPACK_IMPORTED_MODULE_2__/* .DEFAULT_PERSONA_STYLE */ .vs.verbosity;
165
- if (input.is_default) db.prepare("UPDATE agent_configs SET is_default=0").run();
166
- // harness_id: explicit `undefined` means "keep existing"; explicit `null`
167
- // means "use the global default". Empty string is normalised to null too,
168
- // matching how the AgentEditor sends "" for the inherit option.
169
- const harnessId = input.harness_id === undefined ? existing?.harness_id ?? null : input.harness_id && input.harness_id.length > 0 ? input.harness_id : null;
170
- // delegate_targets: undefined = keep existing; explicit empty array clears.
171
- 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))));
172
- // context_tier_proportions: undefined = keep existing; null = clear and
173
- // inherit from the model; object = serialise as JSON. Negative values are
174
- // clamped to 0 so the upsert can't poison the column with bad data.
175
- const tierProportions = input.context_tier_proportions === undefined ? existing?.context_tier_proportions ?? null : input.context_tier_proportions === null ? null : JSON.stringify({
176
- hot: Math.max(0, Number(input.context_tier_proportions.hot) || 0),
177
- warm: Math.max(0, Number(input.context_tier_proportions.warm) || 0),
178
- facts: Math.max(0, Number(input.context_tier_proportions.facts) || 0)
179
- });
180
- // Anti-hallucination override: `undefined` keeps existing; `null` clears
181
- // the override (inherits env). Empty-string model is normalised to null
182
- // so the editor can ship "" for the inherit option.
183
- 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;
184
- 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;
185
- const citationStrictness = input.citation_strictness === undefined ? parseCitationStrictness(existing?.citation_strictness) ?? "off" : parseCitationStrictness(input.citation_strictness) ?? "off";
186
- const toolCredentials = serialiseToolCredentials(input.tool_credentials, existing?.tool_credentials ?? null);
187
- const VALID_ROUTER_POLICIES = new Set([
188
- "cheap",
189
- "fast",
190
- "balanced",
191
- "quality"
192
- ]);
193
- 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;
194
- const routerEnabled = input.router_enabled === undefined ? existing?.router_enabled ?? null : input.router_enabled === null ? null : input.router_enabled ? 1 : 0;
195
- const VALID_USAGE_STRATEGIES = new Set([
196
- "cost_saving",
197
- "fast",
198
- "balanced",
199
- "high_reasoning"
200
- ]);
201
- 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;
202
- const requestedWarmSummaryLimit = input.warm_summary_limit ?? existing?.warm_summary_limit ?? 50;
203
- const warmSummaryLimit = Number.isFinite(requestedWarmSummaryLimit) ? Math.max(0, Math.floor(requestedWarmSummaryLimit)) : existing?.warm_summary_limit ?? 50;
204
- db.prepare(`INSERT OR REPLACE INTO agent_configs
205
- (id, name, icon, identity, instructions, tools, model_config_name, is_default,
206
- history_limit, history_window_hours, warm_summary_limit, never_reply,
207
- hot_turn_limit,
208
- adaptive_persona_enabled, adaptive_persona_strength, adaptive_empathy, adaptive_expressiveness, adaptive_verbosity, adaptive_mbti,
209
- voice_enabled, voice_model, voice_name, voice_stt_model, voice_auto_speak,
210
- harness_id, delegate_targets, context_tier_proportions,
211
- anti_hallucination_mode, anti_hallucination_model_config, citation_strictness,
212
- tool_credentials, router_policy, router_enabled, usage_strategy, usage_profile, display_filters,
213
- created_at, updated_at)
214
- 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"
215
- // (important for PATCH-style updates that omit the field).
216
- 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, input.usage_profile ?? existing?.usage_profile ?? "custom", existing?.display_filters ?? null, created_at, t);
217
- return getAgentConfig(input.id);
218
- }
219
- function clampPercent(next, fallback) {
220
- const n = Number.isFinite(next) ? Number(next) : fallback;
221
- return Math.max(0, Math.min(100, Math.round(n)));
222
- }
223
- function serialiseToolCredentials(input, existing) {
224
- if (input === undefined) return existing;
225
- const cleaned = {};
226
- for (const [k, v] of Object.entries(input)){
227
- if (typeof k === "string" && k.length > 0 && typeof v === "string" && v.length > 0) {
228
- cleaned[k] = v;
166
+ const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest, previewProps } = prepareResult;
167
+ const normalizedSrcPage = (0,next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__.normalizeAppPath)(srcPage);
168
+ // Only this route's prerenders can establish ISR or admit generated params.
169
+ 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]));
170
+ let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || isPrerendered);
171
+ const render404 = async ()=>{
172
+ // TODO: should route-module itself handle rendering the 404
173
+ if (routerServerContext == null ? void 0 : routerServerContext.render404) {
174
+ await routerServerContext.render404(req, res, parsedUrl, false);
175
+ } else {
176
+ res.end('This page could not be found');
229
177
  }
230
- }
231
- if (Object.keys(cleaned).length === 0) return null;
232
- return JSON.stringify(cleaned);
233
- }
234
- function deleteAgentConfig(id) {
235
- return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("DELETE FROM agent_configs WHERE id=?").run(id).changes > 0;
236
- }
237
- function generateAgentId(name) {
238
- const slug = name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
239
- const suffix = Math.random().toString(36).slice(2, 6);
240
- return slug ? `${slug}-${suffix}` : `agent-${suffix}`;
241
- }
242
- const DUPLICATE_RESET_COLUMNS = new Set([
243
- "id",
244
- "name",
245
- "is_default",
246
- "created_at",
247
- "updated_at"
248
- ]);
249
- /**
250
- * Copy an agent's full configuration into a new, non-default agent so the
251
- * user can reuse a tuned setup as a starting point. Columns are discovered
252
- * from the table so settings added later are copied too. Conversation state
253
- * (threads, messages) is never copied. Returns null if the source is missing.
254
- */ function duplicateAgentConfig(sourceId, name) {
255
- return (0,_lib_db_transaction__WEBPACK_IMPORTED_MODULE_1__/* .withDbTransaction */ .J)(()=>{
256
- const source = getAgentConfig(sourceId);
257
- if (!source) return null;
258
- const db = (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)();
259
- const newName = name?.trim() || `${source.name} (copy)`;
260
- let id = generateAgentId(newName);
261
- // INSERT would fail on a collision, but never silently replace (unlike upsert).
262
- while(getAgentConfig(id))id = generateAgentId(newName);
263
- const columns = db.prepare("PRAGMA table_info(agent_configs)").all().map((c)=>c.name).filter((c)=>!DUPLICATE_RESET_COLUMNS.has(c)).map((c)=>`"${c.replace(/"/g, '""')}"`).join(", ");
264
- const t = now();
265
- db.prepare(`INSERT INTO agent_configs (id, name, is_default, created_at, updated_at, ${columns})
266
- SELECT ?, ?, 0, ?, ?, ${columns} FROM agent_configs WHERE id = ?`).run(id, newName, t, t, sourceId);
267
- return getAgentConfig(id);
268
- });
269
- }
270
- // ── ADR-0022: per-agent message-channel display filters ─────────────────
271
- // Canonical channel keys mirrored in `hooks/useMessageFilters.ts`. Kept
272
- // in sync there by importing this constant — single source of truth.
273
- const DISPLAY_FILTER_KEYS = [
274
- "scheduled_task",
275
- "watcher",
276
- "bridge",
277
- "extension",
278
- "page_capture",
279
- "synthetic",
280
- "tool_use",
281
- "thinking"
282
- ];
283
- const DISPLAY_FILTER_DEFAULTS = {
284
- scheduled_task: true,
285
- watcher: true,
286
- bridge: true,
287
- extension: true,
288
- page_capture: true,
289
- synthetic: true,
290
- tool_use: true,
291
- thinking: true
292
- };
293
- function parseDisplayFilters(raw) {
294
- if (!raw) return {
295
- ...DISPLAY_FILTER_DEFAULTS
178
+ return null;
296
179
  };
297
- try {
298
- const parsed = JSON.parse(raw);
299
- // Merge over defaults so newly-added channels stay visible on old rows.
300
- return {
301
- ...DISPLAY_FILTER_DEFAULTS,
302
- ...parsed
303
- };
304
- } catch {
305
- return {
306
- ...DISPLAY_FILTER_DEFAULTS
307
- };
180
+ if (isIsr && !isDraftMode) {
181
+ const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];
182
+ if (prerenderInfo) {
183
+ if (prerenderInfo.fallback === false && !isPrerendered) {
184
+ if (nextConfig.adapterPath) {
185
+ return await render404();
186
+ }
187
+ throw new next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError();
188
+ }
189
+ }
308
190
  }
309
- }
310
- function getAgentDisplayFilters(id) {
311
- const row = getAgentConfig(id);
312
- if (!row) return null;
313
- return parseDisplayFilters(row.display_filters);
314
- }
315
- /**
316
- * Merge a partial filter map into the agent's stored prefs. Pass `null` to
317
- * reset to defaults (clears the column). Safe against concurrent toggles
318
- * from multiple browser tabs because the merge happens server-side.
319
- */ function updateAgentDisplayFilters(id, patch) {
320
- const row = getAgentConfig(id);
321
- if (!row) return null;
322
- if (patch === null) {
323
- (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("UPDATE agent_configs SET display_filters=NULL, updated_at=? WHERE id=?").run(now(), id);
324
- return {
325
- ...DISPLAY_FILTER_DEFAULTS
326
- };
191
+ let cacheKey = null;
192
+ if (isIsr && !routeModule.isDev && !isDraftMode) {
193
+ cacheKey = resolvedPathname;
194
+ // ensure /index and / is normalized to one key
195
+ cacheKey = cacheKey === '/index' ? '/' : cacheKey;
327
196
  }
328
- const current = parseDisplayFilters(row.display_filters);
329
- const next = {
330
- ...current
331
- };
332
- for (const k of DISPLAY_FILTER_KEYS){
333
- if (k in patch && typeof patch[k] === "boolean") next[k] = patch[k];
197
+ // Before rendering (which initializes component tree modules), we have to
198
+ // set the reference manifests to our global store so Server Action's
199
+ // encryption util can access to them at the top level of the page module.
200
+ if (serverActionsManifest && clientReferenceManifest) {
201
+ (0,next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__.setManifestsSingleton)({
202
+ page: srcPage,
203
+ clientReferenceManifest,
204
+ serverActionsManifest
205
+ });
334
206
  }
335
- (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);
336
- return next;
337
- }
338
-
339
-
340
- /***/ }),
341
-
342
- /***/ 51455:
343
- /***/ ((module) => {
344
-
345
- module.exports = require("node:fs/promises");
346
-
347
- /***/ }),
348
-
349
- /***/ 55591:
350
- /***/ ((module) => {
351
-
352
- module.exports = require("https");
353
-
354
- /***/ }),
355
-
356
- /***/ 74075:
357
- /***/ ((module) => {
358
-
359
- module.exports = require("zlib");
360
-
361
- /***/ }),
362
-
363
- /***/ 79868:
364
- /***/ ((module) => {
365
-
366
- module.exports = require("node:sqlite");
367
-
368
- /***/ }),
369
-
370
- /***/ 108128:
371
- /***/ ((module) => {
372
-
373
- module.exports = require("next/dist/server/runtime-reacts.external.js");
374
-
375
- /***/ }),
376
-
377
- /***/ 116602:
378
- /***/ ((module) => {
379
-
380
- module.exports = import("@whiskeysockets/baileys");;
381
-
382
- /***/ }),
383
-
384
- /***/ 149720:
385
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
386
-
387
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
388
- /* harmony export */ Ng: () => (/* binding */ USAGE_PROFILE_VALUES),
389
- /* harmony export */ R3: () => (/* binding */ USAGE_PROFILES),
390
- /* harmony export */ vs: () => (/* binding */ DEFAULT_PERSONA_STYLE)
391
- /* harmony export */ });
392
- const USAGE_PROFILE_VALUES = [
393
- "home",
394
- "work",
395
- "dev",
396
- "custom"
397
- ];
398
- const DEFAULT_PERSONA_STYLE = {
399
- strength: 50,
400
- empathy: 50,
401
- expressiveness: 50,
402
- verbosity: 50
403
- };
404
- const USAGE_PROFILES = {
405
- home: {
406
- label: "Home",
407
- hint: "Friendly summaries, chat-first layout, everyday integrations",
408
- compactChat: true,
409
- style: {
410
- strength: 40,
411
- empathy: 80,
412
- expressiveness: 65,
413
- verbosity: 25
414
- },
415
- responseInstruction: "Lead with a short useful summary and the next action. Use approachable, plain language. Avoid technical jargon and routine diagnostic narration. Expand after the summary when asked, when troubleshooting needs it, or when risk or complexity requires it.",
416
- citationStrictness: "standard"
417
- },
418
- work: {
419
- label: "Work",
420
- hint: "Professional decisions, next steps, balanced detail",
421
- compactChat: true,
422
- style: {
423
- strength: 30,
424
- empathy: 55,
425
- expressiveness: 35,
426
- verbosity: 45
427
- },
428
- responseInstruction: "Be professional and outcome-focused. Lead with the decision or result, then action items, owners and deadlines only when known. Separate decisions, assumptions, and open questions. Add rationale and tradeoffs where useful, not a routine execution log.",
429
- citationStrictness: "standard"
430
- },
431
- dev: {
432
- label: "Developer",
433
- hint: "Full diagnostics, evidence-backed claims, explicit validation",
434
- compactChat: false,
435
- style: {
436
- strength: 20,
437
- empathy: 30,
438
- expressiveness: 20,
439
- verbosity: 60
207
+ const method = req.method || 'GET';
208
+ const tracer = (0,next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.getTracer)();
209
+ const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);
210
+ const isMinimalMode = Boolean((0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'minimalMode'));
211
+ const incrementalCache = (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, previewProps, prerenderManifest, isMinimalMode);
212
+ incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();
213
+ globalThis.__incrementalCache = incrementalCache;
214
+ const context = {
215
+ params,
216
+ previewProps,
217
+ renderOpts: {
218
+ experimental: {
219
+ authInterrupts: Boolean(nextConfig.experimental.authInterrupts),
220
+ useCacheTimeout: nextConfig.experimental.useCacheTimeout,
221
+ durableUseCacheEntries: Boolean(nextConfig.experimental.durableUseCacheEntries)
222
+ },
223
+ cacheComponents: Boolean(nextConfig.cacheComponents),
224
+ validationLevel: nextConfig.experimental.instantInsights.validationLevel,
225
+ isDraftMode,
226
+ incrementalCache,
227
+ hmrRefreshHash: (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'hmrRefreshHash'),
228
+ cacheLifeProfiles: nextConfig.cacheLife,
229
+ staticPageGenerationTimeout: nextConfig.staticPageGenerationTimeout,
230
+ waitUntil: ctx.waitUntil,
231
+ onClose: (cb)=>{
232
+ res.on('close', cb);
233
+ },
234
+ onAfterTaskError: undefined
440
235
  },
441
- responseInstruction: "Be precise and evidence-first. Ground every factual claim in observed tool results or provided sources. Distinguish observations from inferences, assumptions, and unknowns; assumptions do not substantiate factual claims. Name relevant files, commands, test results, validation limits, and reproducible next checks. Give a compact evidence summary when brevity is requested, not an unsupported conclusion.",
442
- citationStrictness: "strict"
443
- },
444
- custom: {
445
- label: "Custom / Everything",
446
- hint: "All integrations, full diagnostics, no added response-style rules",
447
- compactChat: false,
448
- style: null,
449
- responseInstruction: "No preset response organization. Follow the agent instructions, explicit user requests, and any enabled style controls.",
450
- citationStrictness: "off"
236
+ sharedContext: {
237
+ buildId,
238
+ deploymentId
239
+ }
240
+ };
241
+ const nodeNextReq = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextRequest(req);
242
+ const nodeNextRes = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextResponse(res);
243
+ 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));
244
+ const responseGenerator = async ({ previousCacheEntry })=>{
245
+ try {
246
+ if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {
247
+ res.statusCode = 404;
248
+ // on-demand revalidate always sets this header
249
+ res.setHeader('x-nextjs-cache', 'REVALIDATED');
250
+ res.end('This page could not be found');
251
+ return null;
252
+ }
253
+ const response = cacheKey === null ? await routeModule.handle(nextReq, context) : await routeModule.prerender(nextReq, context);
254
+ req.fetchMetrics = context.renderOpts.fetchMetrics;
255
+ let pendingWaitUntil = context.renderOpts.pendingWaitUntil;
256
+ // Attempt using provided waitUntil if available
257
+ // if it's not we fallback to sendResponse's handling
258
+ if (pendingWaitUntil) {
259
+ if (ctx.waitUntil) {
260
+ ctx.waitUntil(pendingWaitUntil);
261
+ pendingWaitUntil = undefined;
262
+ }
263
+ }
264
+ const cacheTags = context.renderOpts.collectedTags;
265
+ // If the request is for a static response, we can cache it so long
266
+ // as it's not edge.
267
+ if (isIsr) {
268
+ const blob = await response.blob();
269
+ // Copy the headers from the response.
270
+ const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.toNodeOutgoingHttpHeaders)(response.headers);
271
+ if (cacheTags) {
272
+ headers[next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER] = cacheTags;
273
+ }
274
+ if (!headers['content-type'] && blob.type) {
275
+ headers['content-type'] = blob.type;
276
+ }
277
+ const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;
278
+ 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
279
+ // explicit `expire` (e.g. via `cacheLife`). This mirrors the
280
+ // build-time fallback in `build/index.ts` so cache entries
281
+ // and the response Cache-Control header agree on the route's
282
+ // effective expire. Routes that opt out of revalidation
283
+ // (`revalidate: false`) or that are dynamic (`revalidate: 0`)
284
+ // keep `expire: undefined`.
285
+ revalidate !== false && revalidate > 0 ? nextConfig.expireTime : undefined : context.renderOpts.collectedExpire;
286
+ // Create the cache entry for the response.
287
+ const cacheEntry = {
288
+ value: {
289
+ kind: next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__.CachedRouteKind.APP_ROUTE,
290
+ status: response.status,
291
+ body: Buffer.from(await blob.arrayBuffer()),
292
+ headers
293
+ },
294
+ cacheControl: {
295
+ revalidate,
296
+ expire
297
+ }
298
+ };
299
+ return cacheEntry;
300
+ } else {
301
+ // send response without caching if not ISR
302
+ await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, response, pendingWaitUntil);
303
+ return null;
304
+ }
305
+ } catch (err) {
306
+ // if this is a background revalidate we need to report
307
+ // the request error here as it won't be bubbled
308
+ if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {
309
+ const silenceLog = false;
310
+ await routeModule.onRequestError(req, err, {
311
+ routerKind: 'App Router',
312
+ routePath: srcPage,
313
+ routeType: 'route',
314
+ revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
315
+ isStaticGeneration: cacheKey !== null,
316
+ isOnDemandRevalidate
317
+ })
318
+ }, silenceLog, routerServerContext);
319
+ }
320
+ throw err;
321
+ }
322
+ };
323
+ const handleResponse = async (currentSpan)=>{
324
+ try {
325
+ var _cacheEntry_value;
326
+ const cacheEntry = await routeModule.handleResponse({
327
+ req,
328
+ nextConfig,
329
+ cacheKey,
330
+ routeKind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
331
+ isFallback: false,
332
+ previewProps,
333
+ prerenderManifest,
334
+ isRoutePPREnabled: false,
335
+ isOnDemandRevalidate,
336
+ revalidateOnlyGenerated,
337
+ responseGenerator,
338
+ waitUntil: ctx.waitUntil,
339
+ isMinimalMode
340
+ });
341
+ if (cacheEntry !== null && 'error' in cacheEntry) {
342
+ throw cacheEntry.error;
343
+ }
344
+ // we don't create a cacheEntry for ISR
345
+ if (!isIsr) {
346
+ return;
347
+ }
348
+ 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) {
349
+ var _cacheEntry_value1;
350
+ throw new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`);
351
+ }
352
+ if (!isMinimalMode) {
353
+ res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');
354
+ }
355
+ // Draft mode should never be cached
356
+ if (isDraftMode) {
357
+ res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');
358
+ }
359
+ const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers);
360
+ if (!(isMinimalMode && isIsr)) {
361
+ headers.delete(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER);
362
+ }
363
+ // If cache control is already set on the response we don't
364
+ // override it to allow users to customize it via next.config
365
+ if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {
366
+ headers.set('Cache-Control', (0,next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__.getCacheControlHeader)(cacheEntry.cacheControl));
367
+ }
368
+ 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'.
369
+ new Response(cacheEntry.value.body, {
370
+ headers,
371
+ status: cacheEntry.value.status || 200
372
+ }));
373
+ return;
374
+ } catch (err) {
375
+ if (!(err instanceof next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError)) {
376
+ const silenceLog = false;
377
+ await routeModule.onRequestError(req, err, {
378
+ routerKind: 'App Router',
379
+ routePath: normalizedSrcPage,
380
+ routeType: 'route',
381
+ revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
382
+ isStaticGeneration: cacheKey !== null,
383
+ isOnDemandRevalidate
384
+ })
385
+ }, silenceLog, routerServerContext);
386
+ }
387
+ // rethrow so that we can handle serving error page
388
+ // If this is during static generation, throw the error again.
389
+ if (isIsr) throw err;
390
+ // Otherwise, send a 500 response unless the original response has
391
+ // already committed. In that case, preserve its status code for
392
+ // telemetry while still recording the failure and terminating a response
393
+ // that the failed pipeline left open.
394
+ if (res.headersSent) {
395
+ if (currentSpan) {
396
+ const error = err instanceof Error ? err : new Error('Unknown app route error');
397
+ currentSpan.recordException(error);
398
+ currentSpan.setStatus({
399
+ code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR,
400
+ message: error.message
401
+ });
402
+ currentSpan.setAttribute('error.type', error.name);
403
+ }
404
+ if (!res.writableEnded && !res.destroyed) {
405
+ res.end();
406
+ }
407
+ } else {
408
+ await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, new Response(null, {
409
+ status: 500
410
+ }));
411
+ }
412
+ return;
413
+ } finally{
414
+ ;
415
+ (()=>{
416
+ if (!currentSpan) {
417
+ return;
418
+ }
419
+ let statusCode = res.statusCode;
420
+ currentSpan.setAttributes({
421
+ 'http.status_code': statusCode,
422
+ 'next.rsc': false
423
+ });
424
+ if (statusCode && statusCode >= 500) {
425
+ // For 5xx status codes: SHOULD be set to 'Error' span status.
426
+ // x-ref: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
427
+ currentSpan.setStatus({
428
+ code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR
429
+ });
430
+ // For span status 'Error', SHOULD set 'error.type' attribute.
431
+ currentSpan.setAttribute('error.type', statusCode.toString());
432
+ }
433
+ const rootSpanAttributes = tracer.getRootSpanAttributes();
434
+ // We were unable to get attributes, probably OTEL is not enabled
435
+ if (!rootSpanAttributes) {
436
+ return;
437
+ }
438
+ if (rootSpanAttributes.get('next.span_type') !== next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest) {
439
+ console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);
440
+ return;
441
+ }
442
+ const route = rootSpanAttributes.get('next.route') || normalizedSrcPage;
443
+ const name = `${method} ${route}`;
444
+ currentSpan.setAttributes({
445
+ 'next.route': route,
446
+ 'http.route': route,
447
+ 'next.span_name': name
448
+ });
449
+ currentSpan.updateName(name);
450
+ // Propagate http.route to the request's root span if it isn't the
451
+ // request span (e.g. a platform-created HTTP span in adapter
452
+ // deployments).
453
+ if (requestRootSpan && requestRootSpan !== currentSpan) {
454
+ requestRootSpan.setAttribute('http.route', route);
455
+ requestRootSpan.updateName(name);
456
+ }
457
+ })();
458
+ }
459
+ };
460
+ // When invoked directly, the request span was started before `prepare`;
461
+ // record the request target as normalized by it. next-server's request span
462
+ // already has it.
463
+ if (!isWrappedByNextServer && req.url !== undefined) {
464
+ requestSpan == null ? void 0 : requestSpan.setAttribute('http.target', req.url);
451
465
  }
452
- };
453
-
454
-
455
- /***/ }),
466
+ await handleResponse(requestSpan);
467
+ }
456
468
 
457
- /***/ 157075:
458
- /***/ ((module) => {
469
+ //# sourceMappingURL=app-route.js.map
459
470
 
460
- module.exports = require("node:stream");
461
471
 
462
472
  /***/ }),
463
473
 
464
- /***/ 165581:
474
+ /***/ 41720:
465
475
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
466
476
 
467
- __webpack_require__.r(__webpack_exports__);
468
477
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
469
- /* harmony export */ GET: () => (/* binding */ GET),
470
- /* harmony export */ POST: () => (/* binding */ POST)
478
+ /* harmony export */ BM: () => (/* binding */ upsertAgentConfig),
479
+ /* harmony export */ E1: () => (/* binding */ updateAgentDisplayFilters),
480
+ /* harmony export */ P2: () => (/* binding */ parseCitationStrictness),
481
+ /* harmony export */ S2: () => (/* binding */ getAgentToolCredentials),
482
+ /* harmony export */ SJ: () => (/* binding */ generateAgentId),
483
+ /* harmony export */ TG: () => (/* binding */ getAgentTools),
484
+ /* harmony export */ bg: () => (/* binding */ parseDelegateTargets),
485
+ /* harmony export */ d2: () => (/* binding */ DISPLAY_FILTER_KEYS),
486
+ /* harmony export */ fg: () => (/* binding */ getAgentTierProportions),
487
+ /* harmony export */ mJ: () => (/* binding */ getAgentConfig),
488
+ /* harmony export */ nV: () => (/* binding */ getAgentDisplayFilters),
489
+ /* harmony export */ vU: () => (/* binding */ getDefaultAgentConfig),
490
+ /* harmony export */ vi: () => (/* binding */ DISPLAY_FILTER_DEFAULTS),
491
+ /* harmony export */ vv: () => (/* binding */ duplicateAgentConfig),
492
+ /* harmony export */ xi: () => (/* binding */ deleteAgentConfig),
493
+ /* harmony export */ zb: () => (/* binding */ listAgentConfigs)
471
494
  /* harmony export */ });
472
- /* harmony import */ var next_server__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(945592);
473
- /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(497377);
474
- /* harmony import */ var _lib_stores_bridges__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(478361);
475
- /* harmony import */ var _lib_api_serializers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(685678);
476
- /* harmony import */ var _lib_api_responses__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(739947);
477
- /* harmony import */ var _lib_bridges_registry__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(870309);
478
-
479
-
480
-
495
+ /* harmony import */ var _lib_db__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(251244);
496
+ /* harmony import */ var _lib_db_transaction__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(999043);
497
+ /* harmony import */ var _lib_agents_usage_profile__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(149720);
481
498
 
482
499
 
483
500
 
484
- function GET() {
485
- return (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_3__/* .cachedJson */ .Bm)((0,_lib_stores_bridges__WEBPACK_IMPORTED_MODULE_1__/* .listBridges */ .X9)().map(_lib_api_serializers__WEBPACK_IMPORTED_MODULE_2__/* .bridgeToResponse */ .aX), 15);
501
+ const now = ()=>new Date().toISOString();
502
+ /** Coerce arbitrary input (DB row TEXT, API body, undefined) to the enum.
503
+ * Returns `null` for null/undefined/unknown values so callers can default. */ function parseCitationStrictness(value) {
504
+ if (value === "off" || value === "informational" || value === "standard" || value === "strict") {
505
+ return value;
506
+ }
507
+ return null;
486
508
  }
487
- const CreateSchema = zod__WEBPACK_IMPORTED_MODULE_5__/* .object */ .Ikc({
488
- kind: zod__WEBPACK_IMPORTED_MODULE_5__/* .string */ .YjP().trim().min(1).refine(_lib_bridges_registry__WEBPACK_IMPORTED_MODULE_4__/* .isBridgeKind */ .M4, "Unknown bridge kind"),
489
- name: zod__WEBPACK_IMPORTED_MODULE_5__/* .string */ .YjP().trim().min(1).max(120)
490
- });
491
- async function POST(req) {
492
- const parsed = await (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_3__/* .validateBody */ .Jb)(req, CreateSchema);
493
- if (parsed instanceof next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse) return parsed;
494
- const row = (0,_lib_stores_bridges__WEBPACK_IMPORTED_MODULE_1__/* .createBridge */ .OO)(parsed);
495
- return (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_3__/* .createdResponse */ .K2)((0,_lib_api_serializers__WEBPACK_IMPORTED_MODULE_2__/* .bridgeToResponse */ .aX)(row));
509
+ /**
510
+ * Parse the JSON-encoded per-agent override of context tier proportions.
511
+ * Returns `null` for NULL, blank, malformed JSON, or any payload that
512
+ * doesn't have three finite non-negative numeric fields. Callers fall
513
+ * back to the model config's value (or built-in defaults) on null.
514
+ */ function getAgentTierProportions(row) {
515
+ const raw = row.context_tier_proportions;
516
+ if (!raw) return null;
517
+ try {
518
+ const parsed = JSON.parse(raw);
519
+ const hot = Number(parsed.hot);
520
+ const warm = Number(parsed.warm);
521
+ const facts = Number(parsed.facts);
522
+ if (![
523
+ hot,
524
+ warm,
525
+ facts
526
+ ].every((n)=>Number.isFinite(n) && n >= 0)) return null;
527
+ if (hot + warm + facts <= 0) return null;
528
+ return {
529
+ hot,
530
+ warm,
531
+ facts
532
+ };
533
+ } catch {
534
+ return null;
535
+ }
496
536
  }
497
-
498
-
499
- /***/ }),
500
-
501
- /***/ 176760:
502
- /***/ ((module) => {
503
-
504
- module.exports = require("node:path");
505
-
506
- /***/ }),
507
-
508
- /***/ 200261:
509
- /***/ ((module) => {
510
-
511
- module.exports = require("next/dist/shared/lib/router/utils/app-paths");
512
-
513
- /***/ }),
514
-
515
- /***/ 253638:
516
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
517
-
518
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
519
- /* harmony export */ p: () => (/* binding */ parseJsonSafe)
520
- /* harmony export */ });
521
- // JSON.parse with a fallback value when the input is malformed (or empty).
522
- // Used everywhere we read responses from external APIs — they're contractually
523
- // JSON but a transient 502 / proxy interstitial occasionally returns HTML.
524
- function parseJsonSafe(text, fallback) {
537
+ function listAgentConfigs() {
538
+ // Default agent always first; then by the timestamp of each agent's latest message.
539
+ return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare(`SELECT a.*
540
+ FROM agent_configs a
541
+ LEFT JOIN (
542
+ SELECT t.agent_id, MAX(m.created_at) AS last_message_at
543
+ FROM threads t
544
+ JOIN messages m ON m.thread_id = t.thread_id
545
+ GROUP BY t.agent_id
546
+ ) latest ON latest.agent_id = a.id
547
+ ORDER BY a.is_default DESC, COALESCE(latest.last_message_at, a.created_at) DESC, a.id ASC`).all();
548
+ }
549
+ function getDefaultAgentConfig() {
550
+ return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("SELECT * FROM agent_configs WHERE is_default=1 LIMIT 1").get() ?? null;
551
+ }
552
+ function getAgentConfig(id) {
553
+ return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("SELECT * FROM agent_configs WHERE id=?").get(id) ?? null;
554
+ }
555
+ /**
556
+ * Parse the JSON-encoded delegate whitelist into a deduped string[]. Returns
557
+ * an empty array for NULL, blank, or malformed JSON (delegation is opt-in).
558
+ */ /**
559
+ * Parse the agent's tool allowlist (`tools` column, stored as a JSON string).
560
+ * Returns an empty array on NULL/blank/malformed JSON — same defensive shape
561
+ * as parseDelegateTargets. Callers that previously did `JSON.parse(cfg.tools)`
562
+ * inline should switch to this getter so the serialization contract stays
563
+ * owned by this store.
564
+ */ function getAgentTools(cfg) {
565
+ if (!cfg?.tools) return [];
566
+ try {
567
+ const parsed = JSON.parse(cfg.tools);
568
+ if (!Array.isArray(parsed)) return [];
569
+ return parsed.filter((x)=>typeof x === "string" && x.length > 0);
570
+ } catch {
571
+ return [];
572
+ }
573
+ }
574
+ function parseDelegateTargets(raw) {
575
+ if (!raw) return [];
576
+ try {
577
+ const parsed = JSON.parse(raw);
578
+ if (!Array.isArray(parsed)) return [];
579
+ const ids = parsed.filter((x)=>typeof x === "string" && x.length > 0);
580
+ return Array.from(new Set(ids));
581
+ } catch {
582
+ return [];
583
+ }
584
+ }
585
+ /**
586
+ * Parse the per-agent `{ toolName: credentialId }` override map stored in
587
+ * the `tool_credentials` column. Returns an empty record on NULL / blank /
588
+ * malformed JSON / non-string entries so downstream code can treat the
589
+ * result as a plain lookup without further validation.
590
+ */ function getAgentToolCredentials(cfg) {
591
+ if (!cfg?.tool_credentials) return {};
525
592
  try {
526
- return JSON.parse(text);
593
+ const parsed = JSON.parse(cfg.tool_credentials);
594
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
595
+ const out = {};
596
+ for (const [k, v] of Object.entries(parsed)){
597
+ if (typeof v === "string" && v.length > 0) out[k] = v;
598
+ }
599
+ return out;
527
600
  } catch {
528
- return fallback;
601
+ return {};
529
602
  }
530
603
  }
531
-
532
-
533
- /***/ }),
534
-
535
- /***/ 257975:
536
- /***/ ((module) => {
537
-
538
- module.exports = require("node:util");
539
-
540
- /***/ }),
541
-
542
- /***/ 309956:
543
- /***/ ((module) => {
544
-
545
- module.exports = require("undici");
546
-
547
- /***/ }),
548
-
549
- /***/ 328354:
550
- /***/ ((module) => {
551
-
552
- module.exports = require("util");
553
-
554
- /***/ }),
555
-
556
- /***/ 333873:
557
- /***/ ((module) => {
558
-
559
- module.exports = require("path");
560
-
561
- /***/ }),
562
-
563
- /***/ 344708:
564
- /***/ ((module) => {
565
-
566
- module.exports = require("node:https");
567
-
568
- /***/ }),
569
-
570
- /***/ 379551:
571
- /***/ ((module) => {
572
-
573
- module.exports = require("url");
574
-
575
- /***/ }),
576
-
577
- /***/ 380481:
578
- /***/ ((module) => {
579
-
580
- module.exports = require("node:readline");
581
-
582
- /***/ }),
583
-
584
- /***/ 399253:
585
- /***/ ((module) => {
586
-
587
- module.exports = import("@huggingface/transformers");;
588
-
589
- /***/ }),
590
-
591
- /***/ 419121:
592
- /***/ ((module) => {
593
-
594
- module.exports = require("next/dist/server/app-render/action-async-storage.external.js");
595
-
596
- /***/ }),
597
-
598
- /***/ 455511:
599
- /***/ ((module) => {
600
-
601
- module.exports = require("crypto");
602
-
603
- /***/ }),
604
-
605
- /***/ 489793:
606
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
607
-
608
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
609
- /* harmony export */ RX: () => (/* binding */ DEFAULT_HARNESS_ID),
610
- /* harmony export */ YX: () => (/* binding */ CUSTOM_HARNESS_ID_PREFIX),
611
- /* harmony export */ cX: () => (/* binding */ HARNESS_SECTION_KEYS),
612
- /* harmony export */ vf: () => (/* binding */ isBuiltinHarnessId)
613
- /* harmony export */ });
614
- /* unused harmony exports BUILTIN_HARNESS_ID_PREFIX, SECTION_DISPLAY */
615
- const HARNESS_SECTION_KEYS = [
616
- "capabilities",
617
- "plan_first",
618
- "presentation",
619
- "citation",
620
- "self_config"
604
+ function upsertAgentConfig(input) {
605
+ return (0,_lib_db_transaction__WEBPACK_IMPORTED_MODULE_1__/* .withDbTransaction */ .J)(()=>upsertAgentConfigTransaction(input));
606
+ }
607
+ function upsertAgentConfigTransaction(input) {
608
+ const t = now();
609
+ const db = (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)();
610
+ const existing = getAgentConfig(input.id);
611
+ const created_at = existing?.created_at ?? t;
612
+ const mbti = input.adaptive_mbti ?? existing?.adaptive_mbti ?? "INTJ";
613
+ const strength = input.adaptive_persona_strength ?? existing?.adaptive_persona_strength ?? _lib_agents_usage_profile__WEBPACK_IMPORTED_MODULE_2__/* .DEFAULT_PERSONA_STYLE */ .vs.strength;
614
+ const empathy = input.adaptive_empathy ?? existing?.adaptive_empathy ?? _lib_agents_usage_profile__WEBPACK_IMPORTED_MODULE_2__/* .DEFAULT_PERSONA_STYLE */ .vs.empathy;
615
+ const expressiveness = input.adaptive_expressiveness ?? existing?.adaptive_expressiveness ?? _lib_agents_usage_profile__WEBPACK_IMPORTED_MODULE_2__/* .DEFAULT_PERSONA_STYLE */ .vs.expressiveness;
616
+ const verbosity = input.adaptive_verbosity ?? existing?.adaptive_verbosity ?? _lib_agents_usage_profile__WEBPACK_IMPORTED_MODULE_2__/* .DEFAULT_PERSONA_STYLE */ .vs.verbosity;
617
+ if (input.is_default) db.prepare("UPDATE agent_configs SET is_default=0").run();
618
+ // harness_id: explicit `undefined` means "keep existing"; explicit `null`
619
+ // means "use the global default". Empty string is normalised to null too,
620
+ // matching how the AgentEditor sends "" for the inherit option.
621
+ const harnessId = input.harness_id === undefined ? existing?.harness_id ?? null : input.harness_id && input.harness_id.length > 0 ? input.harness_id : null;
622
+ // delegate_targets: undefined = keep existing; explicit empty array clears.
623
+ 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))));
624
+ // context_tier_proportions: undefined = keep existing; null = clear and
625
+ // inherit from the model; object = serialise as JSON. Negative values are
626
+ // clamped to 0 so the upsert can't poison the column with bad data.
627
+ const tierProportions = input.context_tier_proportions === undefined ? existing?.context_tier_proportions ?? null : input.context_tier_proportions === null ? null : JSON.stringify({
628
+ hot: Math.max(0, Number(input.context_tier_proportions.hot) || 0),
629
+ warm: Math.max(0, Number(input.context_tier_proportions.warm) || 0),
630
+ facts: Math.max(0, Number(input.context_tier_proportions.facts) || 0)
631
+ });
632
+ // Anti-hallucination override: `undefined` keeps existing; `null` clears
633
+ // the override (inherits env). Empty-string model is normalised to null
634
+ // so the editor can ship "" for the inherit option.
635
+ 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;
636
+ 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;
637
+ const citationStrictness = input.citation_strictness === undefined ? parseCitationStrictness(existing?.citation_strictness) ?? "off" : parseCitationStrictness(input.citation_strictness) ?? "off";
638
+ const toolCredentials = serialiseToolCredentials(input.tool_credentials, existing?.tool_credentials ?? null);
639
+ const VALID_ROUTER_POLICIES = new Set([
640
+ "cheap",
641
+ "fast",
642
+ "balanced",
643
+ "quality"
644
+ ]);
645
+ 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;
646
+ const routerEnabled = input.router_enabled === undefined ? existing?.router_enabled ?? null : input.router_enabled === null ? null : input.router_enabled ? 1 : 0;
647
+ const VALID_USAGE_STRATEGIES = new Set([
648
+ "cost_saving",
649
+ "fast",
650
+ "balanced",
651
+ "high_reasoning"
652
+ ]);
653
+ 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;
654
+ const requestedWarmSummaryLimit = input.warm_summary_limit ?? existing?.warm_summary_limit ?? 50;
655
+ const warmSummaryLimit = Number.isFinite(requestedWarmSummaryLimit) ? Math.max(0, Math.floor(requestedWarmSummaryLimit)) : existing?.warm_summary_limit ?? 50;
656
+ db.prepare(`INSERT OR REPLACE INTO agent_configs
657
+ (id, name, icon, identity, instructions, tools, model_config_name, is_default,
658
+ history_limit, history_window_hours, warm_summary_limit, never_reply,
659
+ hot_turn_limit,
660
+ adaptive_persona_enabled, adaptive_persona_strength, adaptive_empathy, adaptive_expressiveness, adaptive_verbosity, adaptive_mbti,
661
+ voice_enabled, voice_model, voice_name, voice_stt_model, voice_auto_speak,
662
+ harness_id, delegate_targets, context_tier_proportions,
663
+ anti_hallucination_mode, anti_hallucination_model_config, citation_strictness,
664
+ tool_credentials, router_policy, router_enabled, usage_strategy, usage_profile, display_filters,
665
+ created_at, updated_at)
666
+ 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"
667
+ // (important for PATCH-style updates that omit the field).
668
+ 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, input.usage_profile ?? existing?.usage_profile ?? "custom", existing?.display_filters ?? null, created_at, t);
669
+ return getAgentConfig(input.id);
670
+ }
671
+ function clampPercent(next, fallback) {
672
+ const n = Number.isFinite(next) ? Number(next) : fallback;
673
+ return Math.max(0, Math.min(100, Math.round(n)));
674
+ }
675
+ function serialiseToolCredentials(input, existing) {
676
+ if (input === undefined) return existing;
677
+ const cleaned = {};
678
+ for (const [k, v] of Object.entries(input)){
679
+ if (typeof k === "string" && k.length > 0 && typeof v === "string" && v.length > 0) {
680
+ cleaned[k] = v;
681
+ }
682
+ }
683
+ if (Object.keys(cleaned).length === 0) return null;
684
+ return JSON.stringify(cleaned);
685
+ }
686
+ function deleteAgentConfig(id) {
687
+ return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("DELETE FROM agent_configs WHERE id=?").run(id).changes > 0;
688
+ }
689
+ function generateAgentId(name) {
690
+ const slug = name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
691
+ const suffix = Math.random().toString(36).slice(2, 6);
692
+ return slug ? `${slug}-${suffix}` : `agent-${suffix}`;
693
+ }
694
+ const DUPLICATE_RESET_COLUMNS = new Set([
695
+ "id",
696
+ "name",
697
+ "is_default",
698
+ "created_at",
699
+ "updated_at"
700
+ ]);
701
+ /**
702
+ * Copy an agent's full configuration into a new, non-default agent so the
703
+ * user can reuse a tuned setup as a starting point. Columns are discovered
704
+ * from the table so settings added later are copied too. Conversation state
705
+ * (threads, messages) is never copied. Returns null if the source is missing.
706
+ */ function duplicateAgentConfig(sourceId, name) {
707
+ return (0,_lib_db_transaction__WEBPACK_IMPORTED_MODULE_1__/* .withDbTransaction */ .J)(()=>{
708
+ const source = getAgentConfig(sourceId);
709
+ if (!source) return null;
710
+ const db = (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)();
711
+ const newName = name?.trim() || `${source.name} (copy)`;
712
+ let id = generateAgentId(newName);
713
+ // INSERT would fail on a collision, but never silently replace (unlike upsert).
714
+ while(getAgentConfig(id))id = generateAgentId(newName);
715
+ const columns = db.prepare("PRAGMA table_info(agent_configs)").all().map((c)=>c.name).filter((c)=>!DUPLICATE_RESET_COLUMNS.has(c)).map((c)=>`"${c.replace(/"/g, '""')}"`).join(", ");
716
+ const t = now();
717
+ db.prepare(`INSERT INTO agent_configs (id, name, is_default, created_at, updated_at, ${columns})
718
+ SELECT ?, ?, 0, ?, ?, ${columns} FROM agent_configs WHERE id = ?`).run(id, newName, t, t, sourceId);
719
+ return getAgentConfig(id);
720
+ });
721
+ }
722
+ // ── ADR-0022: per-agent message-channel display filters ─────────────────
723
+ // Canonical channel keys mirrored in `hooks/useMessageFilters.ts`. Kept
724
+ // in sync there by importing this constant — single source of truth.
725
+ const DISPLAY_FILTER_KEYS = [
726
+ "scheduled_task",
727
+ "watcher",
728
+ "bridge",
729
+ "extension",
730
+ "page_capture",
731
+ "synthetic",
732
+ "tool_use",
733
+ "thinking"
621
734
  ];
622
- const BUILTIN_HARNESS_ID_PREFIX = "builtin:";
623
- const CUSTOM_HARNESS_ID_PREFIX = "custom:";
624
- const DEFAULT_HARNESS_ID = "builtin:default";
625
- function isBuiltinHarnessId(id) {
626
- return id.startsWith(BUILTIN_HARNESS_ID_PREFIX);
735
+ const DISPLAY_FILTER_DEFAULTS = {
736
+ scheduled_task: true,
737
+ watcher: true,
738
+ bridge: true,
739
+ extension: true,
740
+ page_capture: true,
741
+ synthetic: true,
742
+ tool_use: true,
743
+ thinking: true
744
+ };
745
+ function parseDisplayFilters(raw) {
746
+ if (!raw) return {
747
+ ...DISPLAY_FILTER_DEFAULTS
748
+ };
749
+ try {
750
+ const parsed = JSON.parse(raw);
751
+ // Merge over defaults so newly-added channels stay visible on old rows.
752
+ return {
753
+ ...DISPLAY_FILTER_DEFAULTS,
754
+ ...parsed
755
+ };
756
+ } catch {
757
+ return {
758
+ ...DISPLAY_FILTER_DEFAULTS
759
+ };
760
+ }
627
761
  }
628
- const SECTION_DISPLAY = {
629
- capabilities: {
630
- title: "Host capabilities",
631
- hint: "What the surrounding app can do — notifications, scheduling, watchers, document indexing."
632
- },
633
- plan_first: {
634
- title: "Plan-first acknowledgment",
635
- hint: "Acknowledge-before-acting rules, action principle, anti-fabrication, follow-through."
636
- },
637
- presentation: {
638
- title: "Output formatting",
639
- hint: "Markdown / HTML extras, code fences, images, maps, citation refs block."
640
- },
641
- citation: {
642
- title: "Source attribution",
643
- hint: "Anti-hallucination rules: every substantive claim must be tagged with its source."
644
- },
645
- self_config: {
646
- title: "Self-configuration proposals",
647
- hint: "Lets the agent propose config changes (install MCP, edit agent, set keys) for user approval."
762
+ function getAgentDisplayFilters(id) {
763
+ const row = getAgentConfig(id);
764
+ if (!row) return null;
765
+ return parseDisplayFilters(row.display_filters);
766
+ }
767
+ /**
768
+ * Merge a partial filter map into the agent's stored prefs. Pass `null` to
769
+ * reset to defaults (clears the column). Safe against concurrent toggles
770
+ * from multiple browser tabs because the merge happens server-side.
771
+ */ function updateAgentDisplayFilters(id, patch) {
772
+ const row = getAgentConfig(id);
773
+ if (!row) return null;
774
+ if (patch === null) {
775
+ (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("UPDATE agent_configs SET display_filters=NULL, updated_at=? WHERE id=?").run(now(), id);
776
+ return {
777
+ ...DISPLAY_FILTER_DEFAULTS
778
+ };
648
779
  }
649
- };
780
+ const current = parseDisplayFilters(row.display_filters);
781
+ const next = {
782
+ ...current
783
+ };
784
+ for (const k of DISPLAY_FILTER_KEYS){
785
+ if (k in patch && typeof patch[k] === "boolean") next[k] = patch[k];
786
+ }
787
+ (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);
788
+ return next;
789
+ }
650
790
 
651
791
 
652
792
  /***/ }),
653
793
 
654
- /***/ 524318:
655
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
656
-
657
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
658
- /* harmony export */ u_: () => (/* binding */ DEFAULT_HOT_TURN_LIMIT)
659
- /* harmony export */ });
660
- /* harmony import */ var _lib_agents_harness_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(489793);
661
- const DEFAULT_HOT_TURN_LIMIT = 12;
662
-
794
+ /***/ 51455:
795
+ /***/ ((module) => {
663
796
 
797
+ module.exports = require("node:fs/promises");
664
798
 
665
799
  /***/ }),
666
800
 
667
- /***/ 529294:
801
+ /***/ 55591:
668
802
  /***/ ((module) => {
669
803
 
670
- module.exports = require("next/dist/server/app-render/work-async-storage.external.js");
804
+ module.exports = require("https");
671
805
 
672
806
  /***/ }),
673
807
 
674
- /***/ 594735:
808
+ /***/ 74075:
675
809
  /***/ ((module) => {
676
810
 
677
- module.exports = require("events");
811
+ module.exports = require("zlib");
678
812
 
679
813
  /***/ }),
680
814
 
681
- /***/ 629021:
815
+ /***/ 79868:
682
816
  /***/ ((module) => {
683
817
 
684
- module.exports = require("fs");
818
+ module.exports = require("node:sqlite");
685
819
 
686
820
  /***/ }),
687
821
 
688
- /***/ 638522:
822
+ /***/ 108128:
689
823
  /***/ ((module) => {
690
824
 
691
- module.exports = require("node:zlib");
825
+ module.exports = require("next/dist/server/runtime-reacts.external.js");
692
826
 
693
827
  /***/ }),
694
828
 
695
- /***/ 663033:
829
+ /***/ 116602:
696
830
  /***/ ((module) => {
697
831
 
698
- module.exports = require("next/dist/server/app-render/work-unit-async-storage.external.js");
832
+ module.exports = import("@whiskeysockets/baileys");;
699
833
 
700
834
  /***/ }),
701
835
 
702
- /***/ 685678:
836
+ /***/ 149720:
703
837
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
704
838
 
705
839
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
706
- /* harmony export */ G4: () => (/* binding */ resolveContextWindowTokens),
707
- /* harmony export */ S6: () => (/* binding */ agentToResponse),
708
- /* harmony export */ aX: () => (/* binding */ bridgeToResponse),
709
- /* harmony export */ mX: () => (/* binding */ messageToResponse),
710
- /* harmony export */ sU: () => (/* binding */ mcpServerToResponse)
840
+ /* harmony export */ Ng: () => (/* binding */ USAGE_PROFILE_VALUES),
841
+ /* harmony export */ R3: () => (/* binding */ USAGE_PROFILES),
842
+ /* harmony export */ vs: () => (/* binding */ DEFAULT_PERSONA_STYLE)
711
843
  /* harmony export */ });
712
- /* unused harmony exports messageUsageToResponse, parseToolEventsForResponse, parseMessageMetadataForResponse */
713
- /* harmony import */ var _api_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(524318);
714
- /* harmony import */ var _lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(41720);
715
- /* harmony import */ var _lib_utils_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(253638);
716
- // Row → JSON-response serializers shared between list (`route.ts`) and
717
- // item (`[id]/route.ts`) handlers. Keeping these in one place stops the
718
- // list and item shapes from drifting (they were copy-pasted before).
719
-
720
-
721
-
722
- function agentToResponse(a) {
723
- return {
724
- id: a.id,
725
- usage_profile: a.usage_profile ?? "custom",
726
- name: a.name,
727
- icon: a.icon,
728
- identity: a.identity,
729
- instructions: a.instructions,
730
- tools: (0,_lib_utils_json__WEBPACK_IMPORTED_MODULE_2__/* .parseJsonSafe */ .p)(a.tools, []),
731
- model_config_name: a.model_config_name,
732
- is_default: !!a.is_default,
733
- history_limit: a.history_limit,
734
- history_window_hours: a.history_window_hours,
735
- hot_turn_limit: a.hot_turn_limit ?? _api_types__WEBPACK_IMPORTED_MODULE_0__/* .DEFAULT_HOT_TURN_LIMIT */ .u_,
736
- warm_summary_limit: a.warm_summary_limit,
737
- never_reply: !!a.never_reply,
738
- adaptive_persona_enabled: !!a.adaptive_persona_enabled,
739
- adaptive_persona_strength: a.adaptive_persona_strength,
740
- adaptive_empathy: a.adaptive_empathy,
741
- adaptive_expressiveness: a.adaptive_expressiveness,
742
- adaptive_verbosity: a.adaptive_verbosity,
743
- adaptive_mbti: a.adaptive_mbti,
744
- voice_enabled: !!a.voice_enabled,
745
- voice_model: a.voice_model,
746
- voice_name: a.voice_name,
747
- voice_stt_model: a.voice_stt_model,
748
- voice_auto_speak: !!a.voice_auto_speak,
749
- harness_id: a.harness_id,
750
- delegate_targets: (0,_lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_1__/* .parseDelegateTargets */ .bg)(a.delegate_targets),
751
- context_tier_proportions: (0,_lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_1__/* .getAgentTierProportions */ .fg)(a),
752
- anti_hallucination_mode: a.anti_hallucination_mode === "off" || a.anti_hallucination_mode === "regex" || a.anti_hallucination_mode === "model" ? a.anti_hallucination_mode : null,
753
- anti_hallucination_model_config: a.anti_hallucination_model_config,
754
- citation_strictness: (0,_lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_1__/* .parseCitationStrictness */ .P2)(a.citation_strictness) ?? "off",
755
- tool_credentials: (0,_lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_1__/* .getAgentToolCredentials */ .S2)(a),
756
- router_policy: a.router_policy === "cheap" || a.router_policy === "fast" || a.router_policy === "balanced" || a.router_policy === "quality" ? a.router_policy : null,
757
- router_enabled: a.router_enabled === 1 ? true : a.router_enabled === 0 ? false : null,
758
- usage_strategy: a.usage_strategy === "cost_saving" || a.usage_strategy === "balanced" || a.usage_strategy === "high_reasoning" ? a.usage_strategy : null,
759
- created_at: a.created_at,
760
- updated_at: a.updated_at
761
- };
762
- }
763
- function bridgeToResponse(r) {
764
- return {
765
- id: r.id,
766
- kind: r.kind,
767
- name: r.name,
768
- status: r.status,
769
- last_error: r.last_error,
770
- paired_id: r.paired_id,
771
- enabled: r.enabled === 1,
772
- event_subscriptions: {
773
- group_profile_updates: r.forward_group_profile_updates === 1,
774
- group_participants_updates: r.forward_group_participants_updates === 1
775
- },
776
- created_at: r.created_at,
777
- updated_at: r.updated_at
778
- };
779
- }
780
- function mcpServerToResponse(r) {
781
- return {
782
- name: r.name,
783
- transport: r.transport,
784
- spec: (0,_lib_utils_json__WEBPACK_IMPORTED_MODULE_2__/* .parseJsonSafe */ .p)(r.spec, null),
785
- enabled: r.enabled === 1,
786
- last_error: r.last_error,
787
- created_at: r.created_at,
788
- updated_at: r.updated_at
789
- };
790
- }
791
- /**
792
- * Shape a `message_usage` row into the over-the-wire `usage` object the
793
- * chat panel's `ContextUsageBar` consumes. Returns `null` for messages
794
- * that have no snapshot (user turns and legacy assistant rows recorded
795
- * before the per-turn snapshot landed in ADR-0041).
796
- *
797
- * Anthropic prompt-cache tokens (PR #181 + the cache-fidelity follow-up)
798
- * are surfaced as additive fields so future UI work can render a
799
- * "served from cache" badge without another wire change. Both are
800
- * `null` for rows that predate cache plumbing or for providers that
801
- * don't expose a cache breakdown.
802
- */ function messageUsageToResponse(u) {
803
- if (!u) return null;
804
- return {
805
- input_tokens: u.input_tokens,
806
- output_tokens: u.output_tokens,
807
- hot_tokens: u.hot_tokens,
808
- warm_tokens: u.warm_tokens,
809
- facts_tokens: u.facts_tokens,
810
- overhead_tokens: u.overhead_tokens,
811
- hot_budget_tokens: u.hot_budget_tokens,
812
- warm_budget_tokens: u.warm_budget_tokens,
813
- facts_budget_tokens: u.facts_budget_tokens,
814
- context_window_tokens: u.context_window_tokens,
815
- cache_creation_input_tokens: u.cache_creation_input_tokens,
816
- cache_read_input_tokens: u.cache_read_input_tokens,
817
- thinking_tokens: u.thinking_tokens ?? null,
818
- cost_usd: u.cost_usd ?? null
819
- };
820
- }
821
- /**
822
- * Shape one message row into its over-the-wire form, attaching its
823
- * per-turn `usage` snapshot when one exists. Pure data-shaping helper
824
- * extracted from the threads GET route so the wire contract has unit
825
- * coverage.
826
- */ function messageToResponse(m, usageById) {
827
- return {
828
- id: m.msg_id,
829
- seq: m.seq,
830
- role: m.role,
831
- content: m.content,
832
- created_at: m.created_at,
833
- transcript_status: m.transcript_status,
834
- status_reason: m.status_reason,
835
- tool_events: parseToolEventsForResponse(m.tool_events),
836
- category: m.category ?? null,
837
- usage: messageUsageToResponse(usageById.get(m.msg_id)),
838
- metadata: parseMessageMetadataForResponse(m.metadata)
839
- };
840
- }
841
- /** Tolerant `tool_events` JSON parser shared with the route. Bad JSON
842
- * and non-array payloads collapse to `undefined` so the wire shape
843
- * always matches the typed client expectation. */ function parseToolEventsForResponse(raw) {
844
- if (!raw) return undefined;
845
- try {
846
- const parsed = JSON.parse(raw);
847
- return Array.isArray(parsed) ? parsed : undefined;
848
- } catch {
849
- return undefined;
850
- }
851
- }
852
- /** Tolerant `metadata` JSON parser. Returns `null` for missing/blank/
853
- * malformed/non-object payloads so the wire shape stays a plain object
854
- * or null — readers can rely on `metadata?.citations?...` chaining. */ function parseMessageMetadataForResponse(raw) {
855
- if (!raw) return null;
856
- try {
857
- const parsed = JSON.parse(raw);
858
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
859
- return parsed;
860
- } catch {
861
- return null;
844
+ const USAGE_PROFILE_VALUES = [
845
+ "home",
846
+ "work",
847
+ "dev",
848
+ "custom"
849
+ ];
850
+ const DEFAULT_PERSONA_STYLE = {
851
+ strength: 50,
852
+ empathy: 50,
853
+ expressiveness: 50,
854
+ verbosity: 50
855
+ };
856
+ const USAGE_PROFILES = {
857
+ home: {
858
+ label: "Home",
859
+ hint: "Friendly summaries, chat-first layout, everyday integrations",
860
+ compactChat: true,
861
+ style: {
862
+ strength: 40,
863
+ empathy: 80,
864
+ expressiveness: 65,
865
+ verbosity: 25
866
+ },
867
+ responseInstruction: "Lead with a short useful summary and the next action. Use approachable, plain language. Avoid technical jargon and routine diagnostic narration. Expand after the summary when asked, when troubleshooting needs it, or when risk or complexity requires it.",
868
+ citationStrictness: "standard"
869
+ },
870
+ work: {
871
+ label: "Work",
872
+ hint: "Professional decisions, next steps, balanced detail",
873
+ compactChat: true,
874
+ style: {
875
+ strength: 30,
876
+ empathy: 55,
877
+ expressiveness: 35,
878
+ verbosity: 45
879
+ },
880
+ responseInstruction: "Be professional and outcome-focused. Lead with the decision or result, then action items, owners and deadlines only when known. Separate decisions, assumptions, and open questions. Add rationale and tradeoffs where useful, not a routine execution log.",
881
+ citationStrictness: "standard"
882
+ },
883
+ dev: {
884
+ label: "Developer",
885
+ hint: "Full diagnostics, evidence-backed claims, explicit validation",
886
+ compactChat: false,
887
+ style: {
888
+ strength: 20,
889
+ empathy: 30,
890
+ expressiveness: 20,
891
+ verbosity: 60
892
+ },
893
+ responseInstruction: "Be precise and evidence-first. Ground every factual claim in observed tool results or provided sources. Distinguish observations from inferences, assumptions, and unknowns; assumptions do not substantiate factual claims. Name relevant files, commands, test results, validation limits, and reproducible next checks. Give a compact evidence summary when brevity is requested, not an unsupported conclusion.",
894
+ citationStrictness: "strict"
895
+ },
896
+ custom: {
897
+ label: "Custom / Everything",
898
+ hint: "All integrations, full diagnostics, no added response-style rules",
899
+ compactChat: false,
900
+ style: null,
901
+ responseInstruction: "No preset response organization. Follow the agent instructions, explicit user requests, and any enabled style controls.",
902
+ citationStrictness: "off"
862
903
  }
904
+ };
905
+
906
+
907
+ /***/ }),
908
+
909
+ /***/ 157075:
910
+ /***/ ((module) => {
911
+
912
+ module.exports = require("node:stream");
913
+
914
+ /***/ }),
915
+
916
+ /***/ 165581:
917
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
918
+
919
+ __webpack_require__.r(__webpack_exports__);
920
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
921
+ /* harmony export */ GET: () => (/* binding */ GET),
922
+ /* harmony export */ POST: () => (/* binding */ POST)
923
+ /* harmony export */ });
924
+ /* harmony import */ var next_server__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(945592);
925
+ /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(497377);
926
+ /* harmony import */ var _lib_stores_bridges__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(478361);
927
+ /* harmony import */ var _lib_api_serializers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(685678);
928
+ /* harmony import */ var _lib_api_responses__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(739947);
929
+ /* harmony import */ var _lib_bridges_registry__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(870309);
930
+
931
+
932
+
933
+
934
+
935
+
936
+ function GET() {
937
+ return (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_3__/* .cachedJson */ .Bm)((0,_lib_stores_bridges__WEBPACK_IMPORTED_MODULE_1__/* .listBridges */ .X9)().map(_lib_api_serializers__WEBPACK_IMPORTED_MODULE_2__/* .bridgeToResponse */ .aX), 15);
863
938
  }
864
- /**
865
- * Resolve the bar's 100% baseline. Per-row `context_window_tokens`
866
- * (snapshotted at run time) wins so the bar matches the cap the agent
867
- * actually applied; legacy rows fall back to the model-config value;
868
- * unconfigured agents fall back to the default. Centralised so the
869
- * route and the UI share the same precedence rule.
870
- */ function resolveContextWindowTokens(modelConfiguredTokens, defaultTokens) {
871
- if (typeof modelConfiguredTokens === "number" && modelConfiguredTokens > 0) {
872
- return modelConfiguredTokens;
873
- }
874
- return defaultTokens;
939
+ const CreateSchema = zod__WEBPACK_IMPORTED_MODULE_5__/* .object */ .Ikc({
940
+ kind: zod__WEBPACK_IMPORTED_MODULE_5__/* .string */ .YjP().trim().min(1).refine(_lib_bridges_registry__WEBPACK_IMPORTED_MODULE_4__/* .isBridgeKind */ .M4, "Unknown bridge kind"),
941
+ name: zod__WEBPACK_IMPORTED_MODULE_5__/* .string */ .YjP().trim().min(1).max(120)
942
+ });
943
+ async function POST(req) {
944
+ const parsed = await (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_3__/* .validateBody */ .Jb)(req, CreateSchema);
945
+ if (parsed instanceof next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse) return parsed;
946
+ const row = (0,_lib_stores_bridges__WEBPACK_IMPORTED_MODULE_1__/* .createBridge */ .OO)(parsed);
947
+ return (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_3__/* .createdResponse */ .K2)((0,_lib_api_serializers__WEBPACK_IMPORTED_MODULE_2__/* .bridgeToResponse */ .aX)(row));
875
948
  }
876
949
 
877
950
 
878
951
  /***/ }),
879
952
 
880
- /***/ 710846:
953
+ /***/ 176760:
881
954
  /***/ ((module) => {
882
955
 
883
- module.exports = require("next/dist/compiled/next-server/app-page.runtime.prod.js");
956
+ module.exports = require("node:path");
884
957
 
885
958
  /***/ }),
886
959
 
887
- /***/ 731421:
960
+ /***/ 200261:
888
961
  /***/ ((module) => {
889
962
 
890
- module.exports = require("node:child_process");
963
+ module.exports = require("next/dist/shared/lib/router/utils/app-paths");
891
964
 
892
965
  /***/ }),
893
966
 
894
- /***/ 739947:
967
+ /***/ 253638:
895
968
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
896
969
 
897
970
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
898
- /* harmony export */ Bm: () => (/* binding */ cachedJson),
899
- /* harmony export */ HN: () => (/* binding */ notFoundResponse),
900
- /* harmony export */ Jb: () => (/* binding */ validateBody),
901
- /* harmony export */ K2: () => (/* binding */ createdResponse),
902
- /* harmony export */ Ng: () => (/* binding */ noStoreJson),
903
- /* harmony export */ yj: () => (/* binding */ errorResponse)
971
+ /* harmony export */ p: () => (/* binding */ parseJsonSafe)
904
972
  /* harmony export */ });
905
- /* harmony import */ var next_server__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(945592);
906
- // Shared HTTP response builders for app/api/v1/** route handlers.
907
- //
908
- // Goal: every error/success payload across the v1 surface has the same
909
- // shape. Before this lived inline, response bodies drifted —
910
- // `{error: "x"}` vs `{message: "x"}`, 400 vs 422 for the same condition,
911
- // some routes returned Zod's raw issue array, others stringified it.
912
-
913
- function errorResponse(message, status = 400) {
914
- return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json({
915
- error: message
916
- }, {
917
- status
918
- });
919
- }
920
- function notFoundResponse(message = "Not found") {
921
- return errorResponse(message, 404);
922
- }
923
- function createdResponse(data) {
924
- return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
925
- status: 201
926
- });
927
- }
928
- // Wrap a 200 JSON response with a private Cache-Control header. Use on safe
929
- // GET endpoints that serve user-scoped data the client refetches often (panel
930
- // mounts, navigation back/forward) but mutates rarely. The TTL is short
931
- // enough that explicit mutations — which patch the client-side ApiClient
932
- // cache in place — stay observably consistent without an extra roundtrip.
933
- //
934
- // swrSeconds (optional): stale-while-revalidate window. When set, the browser
935
- // serves the cached response immediately and refreshes in the background,
936
- // making navigation feel instant. Use for data that can tolerate brief
937
- // staleness (tool list, agent configs, model list). Omit for real-time data
938
- // (dashboard metrics, credential state).
939
- function cachedJson(data, maxAgeSeconds, swrSeconds) {
940
- const swr = swrSeconds ? `, stale-while-revalidate=${swrSeconds}` : "";
941
- return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
942
- headers: {
943
- "Cache-Control": `private, max-age=${maxAgeSeconds}${swr}`
944
- }
945
- });
946
- }
947
- // Use for endpoints whose response contains live state that must never be
948
- // served from cache — credentials, connection status, live config values.
949
- function noStoreJson(data) {
950
- return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
951
- headers: {
952
- "Cache-Control": "no-store"
953
- }
954
- });
955
- }
956
- // Validate a JSON request body against a zod schema.
957
- // Returns either the parsed data or a 400 NextResponse explaining the issue.
958
- // Caller pattern:
959
- // const parsed = await validateBody(req, Schema);
960
- // if (parsed instanceof NextResponse) return parsed;
961
- // // use parsed.field
962
- async function validateBody(req, schema) {
963
- let raw;
973
+ // JSON.parse with a fallback value when the input is malformed (or empty).
974
+ // Used everywhere we read responses from external APIs — they're contractually
975
+ // JSON but a transient 502 / proxy interstitial occasionally returns HTML.
976
+ function parseJsonSafe(text, fallback) {
964
977
  try {
965
- raw = await req.json();
978
+ return JSON.parse(text);
966
979
  } catch {
967
- return errorResponse("Request body must be valid JSON", 400);
968
- }
969
- const parsed = schema.safeParse(raw);
970
- if (!parsed.success) {
971
- return errorResponse(parsed.error.issues[0]?.message ?? "invalid body", 400);
980
+ return fallback;
972
981
  }
973
- return parsed.data;
974
982
  }
975
983
 
976
984
 
977
985
  /***/ }),
978
986
 
979
- /***/ 744870:
987
+ /***/ 257975:
988
+ /***/ ((module) => {
989
+
990
+ module.exports = require("node:util");
991
+
992
+ /***/ }),
993
+
994
+ /***/ 309956:
995
+ /***/ ((module) => {
996
+
997
+ module.exports = require("undici");
998
+
999
+ /***/ }),
1000
+
1001
+ /***/ 328354:
1002
+ /***/ ((module) => {
1003
+
1004
+ module.exports = require("util");
1005
+
1006
+ /***/ }),
1007
+
1008
+ /***/ 333873:
1009
+ /***/ ((module) => {
1010
+
1011
+ module.exports = require("path");
1012
+
1013
+ /***/ }),
1014
+
1015
+ /***/ 344708:
1016
+ /***/ ((module) => {
1017
+
1018
+ module.exports = require("node:https");
1019
+
1020
+ /***/ }),
1021
+
1022
+ /***/ 379551:
1023
+ /***/ ((module) => {
1024
+
1025
+ module.exports = require("url");
1026
+
1027
+ /***/ }),
1028
+
1029
+ /***/ 380481:
1030
+ /***/ ((module) => {
1031
+
1032
+ module.exports = require("node:readline");
1033
+
1034
+ /***/ }),
1035
+
1036
+ /***/ 399253:
1037
+ /***/ ((module) => {
1038
+
1039
+ module.exports = import("@huggingface/transformers");;
1040
+
1041
+ /***/ }),
1042
+
1043
+ /***/ 419121:
1044
+ /***/ ((module) => {
1045
+
1046
+ module.exports = require("next/dist/server/app-render/action-async-storage.external.js");
1047
+
1048
+ /***/ }),
1049
+
1050
+ /***/ 455511:
980
1051
  /***/ ((module) => {
981
1052
 
982
- module.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js");
1053
+ module.exports = require("crypto");
983
1054
 
984
1055
  /***/ }),
985
1056
 
986
- /***/ 763921:
1057
+ /***/ 489793:
987
1058
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
988
1059
 
989
- __webpack_require__.r(__webpack_exports__);
990
1060
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
991
- /* harmony export */ handler: () => (/* binding */ handler),
992
- /* harmony export */ patchFetch: () => (/* binding */ patchFetch),
993
- /* harmony export */ routeModule: () => (/* binding */ routeModule),
994
- /* harmony export */ serverHooks: () => (/* binding */ serverHooks),
995
- /* harmony export */ workAsyncStorage: () => (/* binding */ workAsyncStorage),
996
- /* harmony export */ workUnitAsyncStorage: () => (/* binding */ workUnitAsyncStorage)
1061
+ /* harmony export */ RX: () => (/* binding */ DEFAULT_HARNESS_ID),
1062
+ /* harmony export */ YX: () => (/* binding */ CUSTOM_HARNESS_ID_PREFIX),
1063
+ /* harmony export */ cX: () => (/* binding */ HARNESS_SECTION_KEYS),
1064
+ /* harmony export */ vf: () => (/* binding */ isBuiltinHarnessId)
997
1065
  /* harmony export */ });
998
- /* harmony import */ var next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(319225);
999
- /* 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__);
1000
- /* harmony import */ var next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(684006);
1001
- /* harmony import */ var next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8317);
1002
- /* 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__);
1003
- /* harmony import */ var next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(799373);
1004
- /* 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__);
1005
- /* harmony import */ var next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(434775);
1006
- /* 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__);
1007
- /* harmony import */ var next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(524235);
1008
- /* 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__);
1009
- /* harmony import */ var next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(200261);
1010
- /* 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__);
1011
- /* harmony import */ var next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(754365);
1012
- /* 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__);
1013
- /* harmony import */ var next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(590771);
1014
- /* 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__);
1015
- /* harmony import */ var next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(473461);
1016
- /* 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__);
1017
- /* harmony import */ var next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(767798);
1018
- /* harmony import */ var next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(192280);
1019
- /* harmony import */ var next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(662018);
1020
- /* 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__);
1021
- /* harmony import */ var next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(445696);
1022
- /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(347929);
1023
- /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__);
1024
- /* harmony import */ var next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(986439);
1025
- /* 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__);
1026
- /* harmony import */ var next_dist_server_lib_route_cache_key__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(710246);
1027
- /* 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__);
1028
- /* harmony import */ var next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(137527);
1029
- /* 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__);
1066
+ /* unused harmony exports BUILTIN_HARNESS_ID_PREFIX, SECTION_DISPLAY */
1067
+ const HARNESS_SECTION_KEYS = [
1068
+ "capabilities",
1069
+ "plan_first",
1070
+ "presentation",
1071
+ "citation",
1072
+ "self_config"
1073
+ ];
1074
+ const BUILTIN_HARNESS_ID_PREFIX = "builtin:";
1075
+ const CUSTOM_HARNESS_ID_PREFIX = "custom:";
1076
+ const DEFAULT_HARNESS_ID = "builtin:default";
1077
+ function isBuiltinHarnessId(id) {
1078
+ return id.startsWith(BUILTIN_HARNESS_ID_PREFIX);
1079
+ }
1080
+ const SECTION_DISPLAY = {
1081
+ capabilities: {
1082
+ title: "Host capabilities",
1083
+ hint: "What the surrounding app can do — notifications, scheduling, watchers, document indexing."
1084
+ },
1085
+ plan_first: {
1086
+ title: "Plan-first acknowledgment",
1087
+ hint: "Acknowledge-before-acting rules, action principle, anti-fabrication, follow-through."
1088
+ },
1089
+ presentation: {
1090
+ title: "Output formatting",
1091
+ hint: "Markdown / HTML extras, code fences, images, maps, citation refs block."
1092
+ },
1093
+ citation: {
1094
+ title: "Source attribution",
1095
+ hint: "Anti-hallucination rules: every substantive claim must be tagged with its source."
1096
+ },
1097
+ self_config: {
1098
+ title: "Self-configuration proposals",
1099
+ hint: "Lets the agent propose config changes (install MCP, edit agent, set keys) for user approval."
1100
+ }
1101
+ };
1030
1102
 
1031
1103
 
1104
+ /***/ }),
1032
1105
 
1106
+ /***/ 524318:
1107
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1033
1108
 
1109
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1110
+ /* harmony export */ u_: () => (/* binding */ DEFAULT_HOT_TURN_LIMIT)
1111
+ /* harmony export */ });
1112
+ /* harmony import */ var _lib_agents_harness_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(489793);
1113
+ const DEFAULT_HOT_TURN_LIMIT = 12;
1034
1114
 
1035
1115
 
1036
1116
 
1117
+ /***/ }),
1037
1118
 
1119
+ /***/ 529294:
1120
+ /***/ ((module) => {
1038
1121
 
1122
+ module.exports = require("next/dist/server/app-render/work-async-storage.external.js");
1039
1123
 
1124
+ /***/ }),
1040
1125
 
1126
+ /***/ 594735:
1127
+ /***/ ((module) => {
1041
1128
 
1129
+ module.exports = require("events");
1042
1130
 
1131
+ /***/ }),
1043
1132
 
1133
+ /***/ 629021:
1134
+ /***/ ((module) => {
1044
1135
 
1136
+ module.exports = require("fs");
1045
1137
 
1138
+ /***/ }),
1046
1139
 
1140
+ /***/ 638522:
1141
+ /***/ ((module) => {
1047
1142
 
1048
- // We inject the nextConfigOutput here so that we can use them in the route
1049
- // module.
1050
- const nextConfigOutput = "standalone"
1051
- const routeModule = new next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__.AppRouteRouteModule({
1052
- definition: {
1053
- kind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
1054
- page: "/api/v1/bridges/route",
1055
- pathname: "/api/v1/bridges",
1056
- filename: "route",
1057
- bundlePath: "app/api/v1/bridges/route"
1058
- },
1059
- distDir: ".next" || 0,
1060
- relativeProjectDir: false || '',
1061
- resolvedPagePath: "/home/runner/work/jarela/jarela/app/api/v1/bridges/route.ts",
1062
- nextConfigOutput,
1063
- // The lazy require factory ensures that:
1064
- // - In dev: devRequestTimingInternalsEnd is set before userland executes,
1065
- // correctly attributing module load time to application-code rather than
1066
- // framework internals.
1067
- // - In all modes: async modules (route files with top-level await) are
1068
- // handled correctly — require() returns a Promise for such modules, which
1069
- // ensureUserland() awaits before the first request is handled.
1070
- userland: ()=>__webpack_require__(165581),
1071
- // In Turbopack dev mode, also provide a synchronous per-request getter so
1072
- // server HMR updates are picked up without re-executing the entry chunk.
1073
- // Using require() (synchronous) avoids adding async overhead that would be
1074
- // incorrectly attributed to application-code time in devRequestTiming.
1075
- ... false ? 0 : {}
1076
- });
1077
- // Pull out the exports that we need to expose from the module. This should
1078
- // be eliminated when we've moved the other routes to the new format. These
1079
- // are used to hook into the route.
1080
- const { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;
1081
- function patchFetch() {
1082
- return (0,next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__.patchFetch)({
1083
- workAsyncStorage,
1084
- workUnitAsyncStorage
1085
- });
1143
+ module.exports = require("node:zlib");
1144
+
1145
+ /***/ }),
1146
+
1147
+ /***/ 663033:
1148
+ /***/ ((module) => {
1149
+
1150
+ module.exports = require("next/dist/server/app-render/work-unit-async-storage.external.js");
1151
+
1152
+ /***/ }),
1153
+
1154
+ /***/ 685678:
1155
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1156
+
1157
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1158
+ /* harmony export */ G4: () => (/* binding */ resolveContextWindowTokens),
1159
+ /* harmony export */ S6: () => (/* binding */ agentToResponse),
1160
+ /* harmony export */ aX: () => (/* binding */ bridgeToResponse),
1161
+ /* harmony export */ mX: () => (/* binding */ messageToResponse),
1162
+ /* harmony export */ sU: () => (/* binding */ mcpServerToResponse)
1163
+ /* harmony export */ });
1164
+ /* unused harmony exports messageUsageToResponse, parseToolEventsForResponse, parseMessageMetadataForResponse */
1165
+ /* harmony import */ var _api_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(524318);
1166
+ /* harmony import */ var _lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(41720);
1167
+ /* harmony import */ var _lib_utils_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(253638);
1168
+ // Row → JSON-response serializers shared between list (`route.ts`) and
1169
+ // item (`[id]/route.ts`) handlers. Keeping these in one place stops the
1170
+ // list and item shapes from drifting (they were copy-pasted before).
1171
+
1172
+
1173
+
1174
+ function agentToResponse(a) {
1175
+ return {
1176
+ id: a.id,
1177
+ usage_profile: a.usage_profile ?? "custom",
1178
+ name: a.name,
1179
+ icon: a.icon,
1180
+ identity: a.identity,
1181
+ instructions: a.instructions,
1182
+ tools: (0,_lib_utils_json__WEBPACK_IMPORTED_MODULE_2__/* .parseJsonSafe */ .p)(a.tools, []),
1183
+ model_config_name: a.model_config_name,
1184
+ is_default: !!a.is_default,
1185
+ history_limit: a.history_limit,
1186
+ history_window_hours: a.history_window_hours,
1187
+ hot_turn_limit: a.hot_turn_limit ?? _api_types__WEBPACK_IMPORTED_MODULE_0__/* .DEFAULT_HOT_TURN_LIMIT */ .u_,
1188
+ warm_summary_limit: a.warm_summary_limit,
1189
+ never_reply: !!a.never_reply,
1190
+ adaptive_persona_enabled: !!a.adaptive_persona_enabled,
1191
+ adaptive_persona_strength: a.adaptive_persona_strength,
1192
+ adaptive_empathy: a.adaptive_empathy,
1193
+ adaptive_expressiveness: a.adaptive_expressiveness,
1194
+ adaptive_verbosity: a.adaptive_verbosity,
1195
+ adaptive_mbti: a.adaptive_mbti,
1196
+ voice_enabled: !!a.voice_enabled,
1197
+ voice_model: a.voice_model,
1198
+ voice_name: a.voice_name,
1199
+ voice_stt_model: a.voice_stt_model,
1200
+ voice_auto_speak: !!a.voice_auto_speak,
1201
+ harness_id: a.harness_id,
1202
+ delegate_targets: (0,_lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_1__/* .parseDelegateTargets */ .bg)(a.delegate_targets),
1203
+ context_tier_proportions: (0,_lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_1__/* .getAgentTierProportions */ .fg)(a),
1204
+ anti_hallucination_mode: a.anti_hallucination_mode === "off" || a.anti_hallucination_mode === "regex" || a.anti_hallucination_mode === "model" ? a.anti_hallucination_mode : null,
1205
+ anti_hallucination_model_config: a.anti_hallucination_model_config,
1206
+ citation_strictness: (0,_lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_1__/* .parseCitationStrictness */ .P2)(a.citation_strictness) ?? "off",
1207
+ tool_credentials: (0,_lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_1__/* .getAgentToolCredentials */ .S2)(a),
1208
+ router_policy: a.router_policy === "cheap" || a.router_policy === "fast" || a.router_policy === "balanced" || a.router_policy === "quality" ? a.router_policy : null,
1209
+ router_enabled: a.router_enabled === 1 ? true : a.router_enabled === 0 ? false : null,
1210
+ usage_strategy: a.usage_strategy === "cost_saving" || a.usage_strategy === "balanced" || a.usage_strategy === "high_reasoning" ? a.usage_strategy : null,
1211
+ created_at: a.created_at,
1212
+ updated_at: a.updated_at
1213
+ };
1214
+ }
1215
+ function bridgeToResponse(r) {
1216
+ return {
1217
+ id: r.id,
1218
+ kind: r.kind,
1219
+ name: r.name,
1220
+ status: r.status,
1221
+ last_error: r.last_error,
1222
+ paired_id: r.paired_id,
1223
+ enabled: r.enabled === 1,
1224
+ event_subscriptions: {
1225
+ group_profile_updates: r.forward_group_profile_updates === 1,
1226
+ group_participants_updates: r.forward_group_participants_updates === 1
1227
+ },
1228
+ created_at: r.created_at,
1229
+ updated_at: r.updated_at
1230
+ };
1231
+ }
1232
+ function mcpServerToResponse(r) {
1233
+ return {
1234
+ name: r.name,
1235
+ transport: r.transport,
1236
+ spec: (0,_lib_utils_json__WEBPACK_IMPORTED_MODULE_2__/* .parseJsonSafe */ .p)(r.spec, null),
1237
+ enabled: r.enabled === 1,
1238
+ last_error: r.last_error,
1239
+ created_at: r.created_at,
1240
+ updated_at: r.updated_at
1241
+ };
1242
+ }
1243
+ /**
1244
+ * Shape a `message_usage` row into the over-the-wire `usage` object the
1245
+ * chat panel's `ContextUsageBar` consumes. Returns `null` for messages
1246
+ * that have no snapshot (user turns and legacy assistant rows recorded
1247
+ * before the per-turn snapshot landed in ADR-0041).
1248
+ *
1249
+ * Anthropic prompt-cache tokens (PR #181 + the cache-fidelity follow-up)
1250
+ * are surfaced as additive fields so future UI work can render a
1251
+ * "served from cache" badge without another wire change. Both are
1252
+ * `null` for rows that predate cache plumbing or for providers that
1253
+ * don't expose a cache breakdown.
1254
+ */ function messageUsageToResponse(u) {
1255
+ if (!u) return null;
1256
+ return {
1257
+ input_tokens: u.input_tokens,
1258
+ output_tokens: u.output_tokens,
1259
+ hot_tokens: u.hot_tokens,
1260
+ warm_tokens: u.warm_tokens,
1261
+ facts_tokens: u.facts_tokens,
1262
+ overhead_tokens: u.overhead_tokens,
1263
+ hot_budget_tokens: u.hot_budget_tokens,
1264
+ warm_budget_tokens: u.warm_budget_tokens,
1265
+ facts_budget_tokens: u.facts_budget_tokens,
1266
+ context_window_tokens: u.context_window_tokens,
1267
+ cache_creation_input_tokens: u.cache_creation_input_tokens,
1268
+ cache_read_input_tokens: u.cache_read_input_tokens,
1269
+ thinking_tokens: u.thinking_tokens ?? null,
1270
+ cost_usd: u.cost_usd ?? null
1271
+ };
1086
1272
  }
1087
-
1088
- async function handler(req, res, ctx) {
1089
- if (ctx.requestMeta) {
1090
- (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.setRequestMeta)(req, ctx.requestMeta);
1091
- }
1092
- if (routeModule.isDev) {
1093
- (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.addRequestMeta)(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());
1094
- }
1095
- let srcPage = "/api/v1/bridges/route";
1096
- // turbopack doesn't normalize `/index` in the page name
1097
- // so we need to to process dynamic routes properly
1098
- // TODO: fix turbopack providing differing value from webpack
1099
- if (false) {} else if (srcPage === '/index') {
1100
- // we always normalize /index specifically
1101
- srcPage = '/';
1102
- }
1103
- const multiZoneDraftMode = false;
1104
- // Registering `instrumentation.ts` usually installs the tracer provider, so
1105
- // do it before starting the request span. The span is started before
1106
- // `prepare`, so route module preparation is part of the request's trace.
1107
- // When this request triggers registration, the lifecycle spans of
1108
- // `instrumentation.ts` are emitted inside the request span.
1109
- const { instrumentation } = await routeModule.ensureInstrumentation(req, {
1110
- deferSpans: true
1111
- });
1112
- return routeModule.traceRequest(req, {
1113
- tracer: (0,next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.getTracer)(),
1114
- spanName: `${req.method || 'GET'} ${srcPage}`,
1115
- httpTarget: req.url,
1116
- instrumentation
1117
- }, (requestSpan, requestRootSpan)=>handleRequest(req, res, ctx, srcPage, multiZoneDraftMode, requestSpan, requestRootSpan));
1273
+ /**
1274
+ * Shape one message row into its over-the-wire form, attaching its
1275
+ * per-turn `usage` snapshot when one exists. Pure data-shaping helper
1276
+ * extracted from the threads GET route so the wire contract has unit
1277
+ * coverage.
1278
+ */ function messageToResponse(m, usageById) {
1279
+ return {
1280
+ id: m.msg_id,
1281
+ seq: m.seq,
1282
+ role: m.role,
1283
+ content: m.content,
1284
+ created_at: m.created_at,
1285
+ transcript_status: m.transcript_status,
1286
+ status_reason: m.status_reason,
1287
+ tool_events: parseToolEventsForResponse(m.tool_events),
1288
+ category: m.category ?? null,
1289
+ usage: messageUsageToResponse(usageById.get(m.msg_id)),
1290
+ metadata: parseMessageMetadataForResponse(m.metadata)
1291
+ };
1118
1292
  }
1119
- async function handleRequest(req, res, ctx, srcPage, multiZoneDraftMode, requestSpan, requestRootSpan) {
1120
- const prepareResult = await routeModule.prepare(req, res, {
1121
- srcPage,
1122
- multiZoneDraftMode
1123
- });
1124
- if (!prepareResult) {
1125
- res.statusCode = 400;
1126
- res.end('Bad Request');
1127
- ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());
1128
- return null;
1293
+ /** Tolerant `tool_events` JSON parser shared with the route. Bad JSON
1294
+ * and non-array payloads collapse to `undefined` so the wire shape
1295
+ * always matches the typed client expectation. */ function parseToolEventsForResponse(raw) {
1296
+ if (!raw) return undefined;
1297
+ try {
1298
+ const parsed = JSON.parse(raw);
1299
+ return Array.isArray(parsed) ? parsed : undefined;
1300
+ } catch {
1301
+ return undefined;
1129
1302
  }
1130
- const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest, previewProps } = prepareResult;
1131
- const normalizedSrcPage = (0,next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__.normalizeAppPath)(srcPage);
1132
- // Only this route's prerenders can establish ISR or admit generated params.
1133
- 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]));
1134
- let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || isPrerendered);
1135
- const render404 = async ()=>{
1136
- // TODO: should route-module itself handle rendering the 404
1137
- if (routerServerContext == null ? void 0 : routerServerContext.render404) {
1138
- await routerServerContext.render404(req, res, parsedUrl, false);
1139
- } else {
1140
- res.end('This page could not be found');
1141
- }
1303
+ }
1304
+ /** Tolerant `metadata` JSON parser. Returns `null` for missing/blank/
1305
+ * malformed/non-object payloads so the wire shape stays a plain object
1306
+ * or null — readers can rely on `metadata?.citations?...` chaining. */ function parseMessageMetadataForResponse(raw) {
1307
+ if (!raw) return null;
1308
+ try {
1309
+ const parsed = JSON.parse(raw);
1310
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
1311
+ return parsed;
1312
+ } catch {
1142
1313
  return null;
1143
- };
1144
- if (isIsr && !isDraftMode) {
1145
- const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];
1146
- if (prerenderInfo) {
1147
- if (prerenderInfo.fallback === false && !isPrerendered) {
1148
- if (nextConfig.adapterPath) {
1149
- return await render404();
1150
- }
1151
- throw new next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError();
1152
- }
1153
- }
1154
- }
1155
- let cacheKey = null;
1156
- if (isIsr && !routeModule.isDev && !isDraftMode) {
1157
- cacheKey = resolvedPathname;
1158
- // ensure /index and / is normalized to one key
1159
- cacheKey = cacheKey === '/index' ? '/' : cacheKey;
1160
- }
1161
- // Before rendering (which initializes component tree modules), we have to
1162
- // set the reference manifests to our global store so Server Action's
1163
- // encryption util can access to them at the top level of the page module.
1164
- if (serverActionsManifest && clientReferenceManifest) {
1165
- (0,next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__.setManifestsSingleton)({
1166
- page: srcPage,
1167
- clientReferenceManifest,
1168
- serverActionsManifest
1169
- });
1170
1314
  }
1171
- const method = req.method || 'GET';
1172
- const tracer = (0,next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.getTracer)();
1173
- const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);
1174
- const isMinimalMode = Boolean((0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'minimalMode'));
1175
- const incrementalCache = (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, previewProps, prerenderManifest, isMinimalMode);
1176
- incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();
1177
- globalThis.__incrementalCache = incrementalCache;
1178
- const context = {
1179
- params,
1180
- previewProps,
1181
- renderOpts: {
1182
- experimental: {
1183
- authInterrupts: Boolean(nextConfig.experimental.authInterrupts),
1184
- useCacheTimeout: nextConfig.experimental.useCacheTimeout,
1185
- durableUseCacheEntries: Boolean(nextConfig.experimental.durableUseCacheEntries)
1186
- },
1187
- cacheComponents: Boolean(nextConfig.cacheComponents),
1188
- validationLevel: nextConfig.experimental.instantInsights.validationLevel,
1189
- isDraftMode,
1190
- incrementalCache,
1191
- hmrRefreshHash: (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'hmrRefreshHash'),
1192
- cacheLifeProfiles: nextConfig.cacheLife,
1193
- staticPageGenerationTimeout: nextConfig.staticPageGenerationTimeout,
1194
- waitUntil: ctx.waitUntil,
1195
- onClose: (cb)=>{
1196
- res.on('close', cb);
1197
- },
1198
- onAfterTaskError: undefined
1199
- },
1200
- sharedContext: {
1201
- buildId,
1202
- deploymentId
1203
- }
1204
- };
1205
- const nodeNextReq = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextRequest(req);
1206
- const nodeNextRes = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextResponse(res);
1207
- 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));
1208
- const responseGenerator = async ({ previousCacheEntry })=>{
1209
- try {
1210
- if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {
1211
- res.statusCode = 404;
1212
- // on-demand revalidate always sets this header
1213
- res.setHeader('x-nextjs-cache', 'REVALIDATED');
1214
- res.end('This page could not be found');
1215
- return null;
1216
- }
1217
- const response = cacheKey === null ? await routeModule.handle(nextReq, context) : await routeModule.prerender(nextReq, context);
1218
- req.fetchMetrics = context.renderOpts.fetchMetrics;
1219
- let pendingWaitUntil = context.renderOpts.pendingWaitUntil;
1220
- // Attempt using provided waitUntil if available
1221
- // if it's not we fallback to sendResponse's handling
1222
- if (pendingWaitUntil) {
1223
- if (ctx.waitUntil) {
1224
- ctx.waitUntil(pendingWaitUntil);
1225
- pendingWaitUntil = undefined;
1226
- }
1227
- }
1228
- const cacheTags = context.renderOpts.collectedTags;
1229
- // If the request is for a static response, we can cache it so long
1230
- // as it's not edge.
1231
- if (isIsr) {
1232
- const blob = await response.blob();
1233
- // Copy the headers from the response.
1234
- const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.toNodeOutgoingHttpHeaders)(response.headers);
1235
- if (cacheTags) {
1236
- headers[next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER] = cacheTags;
1237
- }
1238
- if (!headers['content-type'] && blob.type) {
1239
- headers['content-type'] = blob.type;
1240
- }
1241
- const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;
1242
- 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
1243
- // explicit `expire` (e.g. via `cacheLife`). This mirrors the
1244
- // build-time fallback in `build/index.ts` so cache entries
1245
- // and the response Cache-Control header agree on the route's
1246
- // effective expire. Routes that opt out of revalidation
1247
- // (`revalidate: false`) or that are dynamic (`revalidate: 0`)
1248
- // keep `expire: undefined`.
1249
- revalidate !== false && revalidate > 0 ? nextConfig.expireTime : undefined : context.renderOpts.collectedExpire;
1250
- // Create the cache entry for the response.
1251
- const cacheEntry = {
1252
- value: {
1253
- kind: next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__.CachedRouteKind.APP_ROUTE,
1254
- status: response.status,
1255
- body: Buffer.from(await blob.arrayBuffer()),
1256
- headers
1257
- },
1258
- cacheControl: {
1259
- revalidate,
1260
- expire
1261
- }
1262
- };
1263
- return cacheEntry;
1264
- } else {
1265
- // send response without caching if not ISR
1266
- await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, response, pendingWaitUntil);
1267
- return null;
1268
- }
1269
- } catch (err) {
1270
- // if this is a background revalidate we need to report
1271
- // the request error here as it won't be bubbled
1272
- if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {
1273
- const silenceLog = false;
1274
- await routeModule.onRequestError(req, err, {
1275
- routerKind: 'App Router',
1276
- routePath: srcPage,
1277
- routeType: 'route',
1278
- revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
1279
- isStaticGeneration: cacheKey !== null,
1280
- isOnDemandRevalidate
1281
- })
1282
- }, silenceLog, routerServerContext);
1283
- }
1284
- throw err;
1315
+ }
1316
+ /**
1317
+ * Resolve the bar's 100% baseline. Per-row `context_window_tokens`
1318
+ * (snapshotted at run time) wins so the bar matches the cap the agent
1319
+ * actually applied; legacy rows fall back to the model-config value;
1320
+ * unconfigured agents fall back to the default. Centralised so the
1321
+ * route and the UI share the same precedence rule.
1322
+ */ function resolveContextWindowTokens(modelConfiguredTokens, defaultTokens) {
1323
+ if (typeof modelConfiguredTokens === "number" && modelConfiguredTokens > 0) {
1324
+ return modelConfiguredTokens;
1325
+ }
1326
+ return defaultTokens;
1327
+ }
1328
+
1329
+
1330
+ /***/ }),
1331
+
1332
+ /***/ 710846:
1333
+ /***/ ((module) => {
1334
+
1335
+ module.exports = require("next/dist/compiled/next-server/app-page.runtime.prod.js");
1336
+
1337
+ /***/ }),
1338
+
1339
+ /***/ 731421:
1340
+ /***/ ((module) => {
1341
+
1342
+ module.exports = require("node:child_process");
1343
+
1344
+ /***/ }),
1345
+
1346
+ /***/ 739947:
1347
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1348
+
1349
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1350
+ /* harmony export */ Bm: () => (/* binding */ cachedJson),
1351
+ /* harmony export */ HN: () => (/* binding */ notFoundResponse),
1352
+ /* harmony export */ Jb: () => (/* binding */ validateBody),
1353
+ /* harmony export */ K2: () => (/* binding */ createdResponse),
1354
+ /* harmony export */ Ng: () => (/* binding */ noStoreJson),
1355
+ /* harmony export */ yj: () => (/* binding */ errorResponse)
1356
+ /* harmony export */ });
1357
+ /* harmony import */ var next_server__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(945592);
1358
+ // Shared HTTP response builders for app/api/v1/** route handlers.
1359
+ //
1360
+ // Goal: every error/success payload across the v1 surface has the same
1361
+ // shape. Before this lived inline, response bodies drifted —
1362
+ // `{error: "x"}` vs `{message: "x"}`, 400 vs 422 for the same condition,
1363
+ // some routes returned Zod's raw issue array, others stringified it.
1364
+
1365
+ function errorResponse(message, status = 400) {
1366
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json({
1367
+ error: message
1368
+ }, {
1369
+ status
1370
+ });
1371
+ }
1372
+ function notFoundResponse(message = "Not found") {
1373
+ return errorResponse(message, 404);
1374
+ }
1375
+ function createdResponse(data) {
1376
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
1377
+ status: 201
1378
+ });
1379
+ }
1380
+ // Wrap a 200 JSON response with a private Cache-Control header. Use on safe
1381
+ // GET endpoints that serve user-scoped data the client refetches often (panel
1382
+ // mounts, navigation back/forward) but mutates rarely. The TTL is short
1383
+ // enough that explicit mutations — which patch the client-side ApiClient
1384
+ // cache in place — stay observably consistent without an extra roundtrip.
1385
+ //
1386
+ // swrSeconds (optional): stale-while-revalidate window. When set, the browser
1387
+ // serves the cached response immediately and refreshes in the background,
1388
+ // making navigation feel instant. Use for data that can tolerate brief
1389
+ // staleness (tool list, agent configs, model list). Omit for real-time data
1390
+ // (dashboard metrics, credential state).
1391
+ function cachedJson(data, maxAgeSeconds, swrSeconds) {
1392
+ const swr = swrSeconds ? `, stale-while-revalidate=${swrSeconds}` : "";
1393
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
1394
+ headers: {
1395
+ "Cache-Control": `private, max-age=${maxAgeSeconds}${swr}`
1285
1396
  }
1286
- };
1287
- const handleResponse = async (currentSpan)=>{
1288
- try {
1289
- var _cacheEntry_value;
1290
- const cacheEntry = await routeModule.handleResponse({
1291
- req,
1292
- nextConfig,
1293
- cacheKey,
1294
- routeKind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
1295
- isFallback: false,
1296
- previewProps,
1297
- prerenderManifest,
1298
- isRoutePPREnabled: false,
1299
- isOnDemandRevalidate,
1300
- revalidateOnlyGenerated,
1301
- responseGenerator,
1302
- waitUntil: ctx.waitUntil,
1303
- isMinimalMode
1304
- });
1305
- if (cacheEntry !== null && 'error' in cacheEntry) {
1306
- throw cacheEntry.error;
1307
- }
1308
- // we don't create a cacheEntry for ISR
1309
- if (!isIsr) {
1310
- return;
1311
- }
1312
- 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) {
1313
- var _cacheEntry_value1;
1314
- throw new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`);
1315
- }
1316
- if (!isMinimalMode) {
1317
- res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');
1318
- }
1319
- // Draft mode should never be cached
1320
- if (isDraftMode) {
1321
- res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');
1322
- }
1323
- const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers);
1324
- if (!(isMinimalMode && isIsr)) {
1325
- headers.delete(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER);
1326
- }
1327
- // If cache control is already set on the response we don't
1328
- // override it to allow users to customize it via next.config
1329
- if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {
1330
- headers.set('Cache-Control', (0,next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__.getCacheControlHeader)(cacheEntry.cacheControl));
1331
- }
1332
- 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'.
1333
- new Response(cacheEntry.value.body, {
1334
- headers,
1335
- status: cacheEntry.value.status || 200
1336
- }));
1337
- return;
1338
- } catch (err) {
1339
- if (!(err instanceof next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError)) {
1340
- const silenceLog = false;
1341
- await routeModule.onRequestError(req, err, {
1342
- routerKind: 'App Router',
1343
- routePath: normalizedSrcPage,
1344
- routeType: 'route',
1345
- revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
1346
- isStaticGeneration: cacheKey !== null,
1347
- isOnDemandRevalidate
1348
- })
1349
- }, silenceLog, routerServerContext);
1350
- }
1351
- // rethrow so that we can handle serving error page
1352
- // If this is during static generation, throw the error again.
1353
- if (isIsr) throw err;
1354
- // Otherwise, send a 500 response unless the original response has
1355
- // already committed. In that case, preserve its status code for
1356
- // telemetry while still recording the failure and terminating a response
1357
- // that the failed pipeline left open.
1358
- if (res.headersSent) {
1359
- if (currentSpan) {
1360
- const error = err instanceof Error ? err : new Error('Unknown app route error');
1361
- currentSpan.recordException(error);
1362
- currentSpan.setStatus({
1363
- code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR,
1364
- message: error.message
1365
- });
1366
- currentSpan.setAttribute('error.type', error.name);
1367
- }
1368
- if (!res.writableEnded && !res.destroyed) {
1369
- res.end();
1370
- }
1371
- } else {
1372
- await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, new Response(null, {
1373
- status: 500
1374
- }));
1375
- }
1376
- return;
1377
- } finally{
1378
- ;
1379
- (()=>{
1380
- if (!currentSpan) {
1381
- return;
1382
- }
1383
- let statusCode = res.statusCode;
1384
- currentSpan.setAttributes({
1385
- 'http.status_code': statusCode,
1386
- 'next.rsc': false
1387
- });
1388
- if (statusCode && statusCode >= 500) {
1389
- // For 5xx status codes: SHOULD be set to 'Error' span status.
1390
- // x-ref: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
1391
- currentSpan.setStatus({
1392
- code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR
1393
- });
1394
- // For span status 'Error', SHOULD set 'error.type' attribute.
1395
- currentSpan.setAttribute('error.type', statusCode.toString());
1396
- }
1397
- const rootSpanAttributes = tracer.getRootSpanAttributes();
1398
- // We were unable to get attributes, probably OTEL is not enabled
1399
- if (!rootSpanAttributes) {
1400
- return;
1401
- }
1402
- if (rootSpanAttributes.get('next.span_type') !== next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest) {
1403
- console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);
1404
- return;
1405
- }
1406
- const route = rootSpanAttributes.get('next.route') || normalizedSrcPage;
1407
- const name = `${method} ${route}`;
1408
- currentSpan.setAttributes({
1409
- 'next.route': route,
1410
- 'http.route': route,
1411
- 'next.span_name': name
1412
- });
1413
- currentSpan.updateName(name);
1414
- // Propagate http.route to the request's root span if it isn't the
1415
- // request span (e.g. a platform-created HTTP span in adapter
1416
- // deployments).
1417
- if (requestRootSpan && requestRootSpan !== currentSpan) {
1418
- requestRootSpan.setAttribute('http.route', route);
1419
- requestRootSpan.updateName(name);
1420
- }
1421
- })();
1397
+ });
1398
+ }
1399
+ // Use for endpoints whose response contains live state that must never be
1400
+ // served from cache — credentials, connection status, live config values.
1401
+ function noStoreJson(data) {
1402
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
1403
+ headers: {
1404
+ "Cache-Control": "no-store"
1422
1405
  }
1423
- };
1424
- // When invoked directly, the request span was started before `prepare`;
1425
- // record the request target as normalized by it. next-server's request span
1426
- // already has it.
1427
- if (!isWrappedByNextServer && req.url !== undefined) {
1428
- requestSpan == null ? void 0 : requestSpan.setAttribute('http.target', req.url);
1406
+ });
1407
+ }
1408
+ // Validate a JSON request body against a zod schema.
1409
+ // Returns either the parsed data or a 400 NextResponse explaining the issue.
1410
+ // Caller pattern:
1411
+ // const parsed = await validateBody(req, Schema);
1412
+ // if (parsed instanceof NextResponse) return parsed;
1413
+ // // use parsed.field
1414
+ async function validateBody(req, schema) {
1415
+ let raw;
1416
+ try {
1417
+ raw = await req.json();
1418
+ } catch {
1419
+ return errorResponse("Request body must be valid JSON", 400);
1429
1420
  }
1430
- await handleResponse(requestSpan);
1421
+ const parsed = schema.safeParse(raw);
1422
+ if (!parsed.success) {
1423
+ return errorResponse(parsed.error.issues[0]?.message ?? "invalid body", 400);
1424
+ }
1425
+ return parsed.data;
1431
1426
  }
1432
1427
 
1433
- //# sourceMappingURL=app-route.js.map
1434
1428
 
1429
+ /***/ }),
1430
+
1431
+ /***/ 744870:
1432
+ /***/ ((module) => {
1433
+
1434
+ module.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js");
1435
1435
 
1436
1436
  /***/ }),
1437
1437
 
@@ -1867,7 +1867,7 @@ module.exports = require("next/dist/shared/lib/no-fallback-error.external");
1867
1867
  var __webpack_require__ = require("../../../../webpack-runtime.js");
1868
1868
  __webpack_require__.C(exports);
1869
1869
  var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
1870
- var __webpack_exports__ = __webpack_require__.X(0, [2970,7377,1813,4891,4992,1244,309], () => (__webpack_exec__(763921)));
1870
+ var __webpack_exports__ = __webpack_require__.X(0, [2970,7377,1813,4891,4992,1244,309], () => (__webpack_exec__(26522)));
1871
1871
  module.exports = __webpack_exports__;
1872
1872
 
1873
1873
  })();