@circuitwall/jarela 2.2.1 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (703) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-path-routes-manifest.json +2 -1
  3. package/.next/standalone/.next/build-manifest.json +2 -2
  4. package/.next/standalone/.next/prerender-manifest.json +3 -3
  5. package/.next/standalone/.next/routes-manifest.json +8 -0
  6. package/.next/standalone/.next/server/app/_global-error/page.js +68 -68
  7. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_not-found/page.js +76 -76
  14. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/standalone/.next/server/app/_not-found.html +2 -2
  16. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  17. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  18. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  19. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  20. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  21. package/.next/standalone/.next/server/app/api/v1/access/[identity]/route.js +100 -93
  22. package/.next/standalone/.next/server/app/api/v1/access/route.js +176 -169
  23. package/.next/standalone/.next/server/app/api/v1/agents/[id]/compact/route.js +89 -56
  24. package/.next/standalone/.next/server/app/api/v1/agents/[id]/compact/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/api/v1/agents/[id]/display-filters/route.js +139 -127
  26. package/.next/standalone/.next/server/app/api/v1/agents/[id]/route.js +107 -100
  27. package/.next/standalone/.next/server/app/api/v1/agents/[id]/thread/route.js +765 -753
  28. package/.next/standalone/.next/server/app/api/v1/agents/route.js +72 -65
  29. package/.next/standalone/.next/server/app/api/v1/allowed-sites/[hostname]/route.js +371 -364
  30. package/.next/standalone/.next/server/app/api/v1/allowed-sites/route.js +809 -802
  31. package/.next/standalone/.next/server/app/api/v1/artifacts/lifecycle/route.js +9 -2
  32. package/.next/standalone/.next/server/app/api/v1/attachments/files/route.js +49 -49
  33. package/.next/standalone/.next/server/app/api/v1/attachments/images/route.js +910 -910
  34. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js +583 -16
  35. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/ignores/[remote_jid]/route.js +41 -30
  37. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/ignores/route.js +48 -37
  38. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js +697 -130
  39. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js.nft.json +1 -1
  40. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js +703 -136
  41. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js +796 -229
  43. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/routes/[route_id]/route.js +762 -746
  45. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/routes/route.js +1050 -1034
  46. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js +673 -106
  47. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/api/v1/bridges/kinds/route.js +811 -804
  49. package/.next/standalone/.next/server/app/api/v1/bridges/kinds/route.js.nft.json +1 -1
  50. package/.next/standalone/.next/server/app/api/v1/bridges/route.js +718 -706
  51. package/.next/standalone/.next/server/app/api/v1/bridges/route.js.nft.json +1 -1
  52. package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js +9 -9
  53. package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js.nft.json +1 -1
  54. package/.next/standalone/.next/server/app/api/v1/config/route.js +85 -85
  55. package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js +709 -709
  56. package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js.nft.json +1 -1
  57. package/.next/standalone/.next/server/app/api/v1/credentials/route.js +2 -2
  58. package/.next/standalone/.next/server/app/api/v1/credentials/route.js.nft.json +1 -1
  59. package/.next/standalone/.next/server/app/api/v1/dashboard/currency/route.js +10 -10
  60. package/.next/standalone/.next/server/app/api/v1/dashboard/metrics/route.js +796 -784
  61. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing/route.js +30 -23
  62. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js +86 -86
  63. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js.nft.json +1 -1
  64. package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js +57 -57
  65. package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js.nft.json +1 -1
  66. package/.next/standalone/.next/server/app/api/v1/documents/search/route.js +385 -378
  67. package/.next/standalone/.next/server/app/api/v1/documents/settings/route.js +51 -44
  68. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js +65 -65
  69. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js.nft.json +1 -1
  70. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js +122 -122
  71. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js.nft.json +1 -1
  72. package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js +37 -37
  73. package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js.nft.json +1 -1
  74. package/.next/standalone/.next/server/app/api/v1/env/route.js +9 -9
  75. package/.next/standalone/.next/server/app/api/v1/env-sync/allowlist/route.js +375 -368
  76. package/.next/standalone/.next/server/app/api/v1/env-sync/route.js +51 -44
  77. package/.next/standalone/.next/server/app/api/v1/events/route.js +745 -178
  78. package/.next/standalone/.next/server/app/api/v1/events/route.js.nft.json +1 -1
  79. package/.next/standalone/.next/server/app/api/v1/events/test/route.js +77 -77
  80. package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js +763 -763
  81. package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js.nft.json +1 -1
  82. package/.next/standalone/.next/server/app/api/v1/extension/browser/activate/route.js +51 -44
  83. package/.next/standalone/.next/server/app/api/v1/extension/browser/foreground/route.js +16 -9
  84. package/.next/standalone/.next/server/app/api/v1/extension/browser/history/route.js +72 -65
  85. package/.next/standalone/.next/server/app/api/v1/extension/browser/poll/route.js +41 -34
  86. package/.next/standalone/.next/server/app/api/v1/extension/browser/progress/route.js +211 -204
  87. package/.next/standalone/.next/server/app/api/v1/extension/browser/result/route.js +140 -133
  88. package/.next/standalone/.next/server/app/api/v1/extension/browser/retry/route.js +113 -106
  89. package/.next/standalone/.next/server/app/api/v1/extension/browser/status/route.js +121 -114
  90. package/.next/standalone/.next/server/app/api/v1/extension/browser/tabs/route.js +141 -134
  91. package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js +690 -690
  92. package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js.nft.json +1 -1
  93. package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js +93 -93
  94. package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js.nft.json +1 -1
  95. package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js +9 -9
  96. package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js.nft.json +1 -1
  97. package/.next/standalone/.next/server/app/api/v1/extensions/route.js +185 -185
  98. package/.next/standalone/.next/server/app/api/v1/extensions/route.js.nft.json +1 -1
  99. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js +171 -171
  100. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js.nft.json +1 -1
  101. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js +396 -396
  102. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js.nft.json +1 -1
  103. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js +212 -212
  104. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js.nft.json +1 -1
  105. package/.next/standalone/.next/server/app/api/v1/files/[name]/route.js +235 -235
  106. package/.next/standalone/.next/server/app/api/v1/fs/browse/route.js +26 -26
  107. package/.next/standalone/.next/server/app/api/v1/harnesses/[id]/route.js +228 -221
  108. package/.next/standalone/.next/server/app/api/v1/harnesses/default/route.js +65 -58
  109. package/.next/standalone/.next/server/app/api/v1/harnesses/route.js +79 -72
  110. package/.next/standalone/.next/server/app/api/v1/health/probes/route.js +9 -9
  111. package/.next/standalone/.next/server/app/api/v1/health/probes/route.js.nft.json +1 -1
  112. package/.next/standalone/.next/server/app/api/v1/health/route.js +783 -771
  113. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/route.js +140 -133
  114. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js +9 -9
  115. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js.nft.json +1 -1
  116. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/callback/route.js +370 -363
  117. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/start/route.js +240 -233
  118. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/status/route.js +689 -682
  119. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/callback/route.js +886 -879
  120. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/start/route.js +115 -108
  121. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/status/route.js +955 -948
  122. package/.next/standalone/.next/server/app/api/v1/integrations/route.js +223 -216
  123. package/.next/standalone/.next/server/app/api/v1/lifecycle/adoption/route.js +876 -847
  124. package/.next/standalone/.next/server/app/api/v1/lifecycle/adoption/route.js.nft.json +1 -1
  125. package/.next/standalone/.next/server/app/api/v1/local-file/route.js +26 -26
  126. package/.next/standalone/.next/server/app/api/v1/logs/route.js +70 -70
  127. package/.next/standalone/.next/server/app/api/v1/maps/embed/route.js +79 -72
  128. package/.next/standalone/.next/server/app/api/v1/mcp-servers/[name]/route.js +991 -979
  129. package/.next/standalone/.next/server/app/api/v1/mcp-servers/registry/route.js +196 -196
  130. package/.next/standalone/.next/server/app/api/v1/mcp-servers/route.js +19 -7
  131. package/.next/standalone/.next/server/app/api/v1/memory/[namespace]/[key]/route.js +539 -532
  132. package/.next/standalone/.next/server/app/api/v1/memory/policy/route.js +86 -79
  133. package/.next/standalone/.next/server/app/api/v1/memory/route.js +58 -51
  134. package/.next/standalone/.next/server/app/api/v1/memory/search/route.js +138 -131
  135. package/.next/standalone/.next/server/app/api/v1/models/[name]/compact-threads/route.js +381 -369
  136. package/.next/standalone/.next/server/app/api/v1/models/[name]/compact-threads/route.js.nft.json +1 -1
  137. package/.next/standalone/.next/server/app/api/v1/models/[name]/route.js +150 -143
  138. package/.next/standalone/.next/server/app/api/v1/models/route.js +634 -627
  139. package/.next/standalone/.next/server/app/api/v1/packages/catalog/route.js +445 -445
  140. package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js +120 -120
  141. package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js.nft.json +1 -1
  142. package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js +234 -234
  143. package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js.nft.json +1 -1
  144. package/.next/standalone/.next/server/app/api/v1/packages/install/route.js +407 -407
  145. package/.next/standalone/.next/server/app/api/v1/packages/install/route.js.nft.json +1 -1
  146. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js +37 -37
  147. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js.nft.json +1 -1
  148. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js +107 -107
  149. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js.nft.json +1 -1
  150. package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js +228 -228
  151. package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js.nft.json +1 -1
  152. package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js +9 -9
  153. package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js.nft.json +1 -1
  154. package/.next/standalone/.next/server/app/api/v1/packages/route.js +148 -148
  155. package/.next/standalone/.next/server/app/api/v1/packages/route.js.nft.json +1 -1
  156. package/.next/standalone/.next/server/app/api/v1/page-capture/route.js +787 -787
  157. package/.next/standalone/.next/server/app/api/v1/page-capture/route.js.nft.json +1 -1
  158. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js +529 -514
  159. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js.nft.json +1 -1
  160. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js +181 -181
  161. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js.nft.json +1 -1
  162. package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js +258 -258
  163. package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js.nft.json +1 -1
  164. package/.next/standalone/.next/server/app/api/v1/profile/location/route.js +37 -30
  165. package/.next/standalone/.next/server/app/api/v1/profile/route.js +171 -164
  166. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/models/route.js +51 -44
  167. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/probe/route.js +15 -8
  168. package/.next/standalone/.next/server/app/api/v1/providers/github-copilot/auth/route.js +171 -164
  169. package/.next/standalone/.next/server/app/api/v1/providers/route.js +101 -94
  170. package/.next/standalone/.next/server/app/api/v1/proxy-config/route.js +457 -450
  171. package/.next/standalone/.next/server/app/api/v1/redaction/init/route.js +44 -37
  172. package/.next/standalone/.next/server/app/api/v1/redaction/route.js +65 -58
  173. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/route.js +617 -605
  174. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js +44 -44
  175. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js.nft.json +1 -1
  176. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/route.js +739 -732
  177. package/.next/standalone/.next/server/app/api/v1/security/idle-timeout/route.js +329 -322
  178. package/.next/standalone/.next/server/app/api/v1/security/pin/route.js +204 -197
  179. package/.next/standalone/.next/server/app/api/v1/security/state/route.js +58 -51
  180. package/.next/standalone/.next/server/app/api/v1/security/unlock/route.js +183 -176
  181. package/.next/standalone/.next/server/app/api/v1/security/verify-pin/route.js +194 -187
  182. package/.next/standalone/.next/server/app/api/v1/setup/test-key/route.js +26 -26
  183. package/.next/standalone/.next/server/app/api/v1/skills/[id]/route.js +776 -769
  184. package/.next/standalone/.next/server/app/api/v1/skills/repos/[id]/route.js +122 -115
  185. package/.next/standalone/.next/server/app/api/v1/skills/repos/route.js +334 -327
  186. package/.next/standalone/.next/server/app/api/v1/skills/route.js +873 -866
  187. package/.next/standalone/.next/server/app/api/v1/system/abort/route.js +838 -808
  188. package/.next/standalone/.next/server/app/api/v1/system/restart/route.js +177 -177
  189. package/.next/standalone/.next/server/app/api/v1/system/restart/route.js.nft.json +1 -1
  190. package/.next/standalone/.next/server/app/api/v1/tailscale/route.js +164 -164
  191. package/.next/standalone/.next/server/app/api/v1/tasks/[agent_id]/route.js +122 -115
  192. package/.next/standalone/.next/server/app/api/v1/tasks/route.js +30 -23
  193. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route.js +1436 -0
  194. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route.js.nft.json +1 -0
  195. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route_client-reference-manifest.js +1 -0
  196. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/context-pin/route.js +638 -631
  197. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/context-pin/route.js.nft.json +1 -1
  198. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/route.js +60 -439
  199. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/route.js.nft.json +1 -1
  200. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js +172 -173
  201. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js.nft.json +1 -1
  202. package/.next/standalone/.next/server/app/api/v1/threads/route.js +925 -913
  203. package/.next/standalone/.next/server/app/api/v1/tools/route.js +2 -2
  204. package/.next/standalone/.next/server/app/api/v1/tools/route.js.nft.json +1 -1
  205. package/.next/standalone/.next/server/app/api/v1/update/apply/route.js +17 -17
  206. package/.next/standalone/.next/server/app/api/v1/update/apply/route.js.nft.json +1 -1
  207. package/.next/standalone/.next/server/app/api/v1/update/route.js +570 -570
  208. package/.next/standalone/.next/server/app/api/v1/voice/transcribe/route.js +241 -229
  209. package/.next/standalone/.next/server/app/api/v1/voice/tts/route.js +989 -977
  210. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/route.js +40 -28
  211. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js +72 -72
  212. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js.nft.json +1 -1
  213. package/.next/standalone/.next/server/app/api/v1/watchers/reaction-scripts/route.js +128 -128
  214. package/.next/standalone/.next/server/app/api/v1/watchers/route.js +164 -164
  215. package/.next/standalone/.next/server/app/api/v1/watchers/route.js.nft.json +1 -1
  216. package/.next/standalone/.next/server/app/icon.svg/route.js +62 -62
  217. package/.next/standalone/.next/server/app/manifest.webmanifest/route.js +436 -436
  218. package/.next/standalone/.next/server/app/page.js +1179 -743
  219. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  220. package/.next/standalone/.next/server/app/setup/page.js +99 -91
  221. package/.next/standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  222. package/.next/standalone/.next/server/app-paths-manifest.json +2 -1
  223. package/.next/standalone/.next/server/chunks/{424.js → 1388.js} +441 -1022
  224. package/.next/standalone/.next/server/chunks/1433.js +1 -1
  225. package/.next/standalone/.next/server/chunks/1638.js +1 -2
  226. package/.next/standalone/.next/server/chunks/1738.js +1 -1
  227. package/.next/standalone/.next/server/chunks/2068.js +47 -10
  228. package/.next/standalone/.next/server/chunks/210.js +3 -3
  229. package/.next/standalone/.next/server/chunks/2151.js +31 -1
  230. package/.next/standalone/.next/server/chunks/2207.js +1 -0
  231. package/.next/standalone/.next/server/chunks/2447.js +10 -5
  232. package/.next/standalone/.next/server/chunks/2471.js +45 -45
  233. package/.next/standalone/.next/server/chunks/2504.js +1 -1
  234. package/.next/standalone/.next/server/chunks/2695.js +17 -17
  235. package/.next/standalone/.next/server/chunks/3042.js +24 -16
  236. package/.next/standalone/.next/server/chunks/{4540.js → 309.js} +104 -38
  237. package/.next/standalone/.next/server/chunks/{2350.js → 3272.js} +104 -37
  238. package/.next/standalone/.next/server/chunks/3399.js +526 -526
  239. package/.next/standalone/.next/server/chunks/3524.js +150 -67
  240. package/.next/standalone/.next/server/chunks/3566.js +1 -1
  241. package/.next/standalone/.next/server/chunks/4189.js +946 -0
  242. package/.next/standalone/.next/server/chunks/4433.js +146 -146
  243. package/.next/standalone/.next/server/chunks/4508.js +3 -3
  244. package/.next/standalone/.next/server/chunks/4588.js +1 -0
  245. package/.next/standalone/.next/server/chunks/46.js +78 -28
  246. package/.next/standalone/.next/server/chunks/466.js +12 -0
  247. package/.next/standalone/.next/server/chunks/4868.js +206 -206
  248. package/.next/standalone/.next/server/chunks/4992.js +13 -0
  249. package/.next/standalone/.next/server/chunks/5120.js +963 -0
  250. package/.next/standalone/.next/server/chunks/5701.js +1 -1
  251. package/.next/standalone/.next/server/chunks/5900.js +1 -1
  252. package/.next/standalone/.next/server/chunks/5908.js +63 -42
  253. package/.next/standalone/.next/server/chunks/6142.js +10 -2
  254. package/.next/standalone/.next/server/chunks/6210.js +1 -0
  255. package/.next/standalone/.next/server/chunks/6213.js +1 -1
  256. package/.next/standalone/.next/server/chunks/6649.js +3 -3
  257. package/.next/standalone/.next/server/chunks/6703.js +3 -3
  258. package/.next/standalone/.next/server/chunks/7445.js +1 -0
  259. package/.next/standalone/.next/server/chunks/8067.js +12 -0
  260. package/.next/standalone/.next/server/chunks/8461.js +24 -17
  261. package/.next/standalone/.next/server/chunks/8558.js +1 -1
  262. package/.next/standalone/.next/server/chunks/8724.js +1 -1
  263. package/.next/standalone/.next/server/chunks/8849.js +91 -91
  264. package/.next/standalone/.next/server/chunks/9032.js +4 -3
  265. package/.next/standalone/.next/server/chunks/{2563.js → 9164.js} +33389 -31418
  266. package/.next/standalone/.next/server/chunks/9237.js +396 -396
  267. package/.next/standalone/.next/server/chunks/{9640.js → 9304.js} +1672 -575
  268. package/.next/standalone/.next/server/chunks/9406.js +1 -1
  269. package/.next/standalone/.next/server/chunks/9590.js +68 -18
  270. package/.next/standalone/.next/server/chunks/9824.js +98 -98
  271. package/.next/standalone/.next/server/chunks/9826.js +1 -0
  272. package/.next/standalone/.next/server/middleware-build-manifest.js +2 -2
  273. package/.next/standalone/.next/server/middleware.js +486 -415
  274. package/.next/standalone/.next/server/pages/404.html +2 -2
  275. package/.next/standalone/.next/server/pages/500.html +1 -1
  276. package/.next/standalone/.next/server/preview-props.json +3 -3
  277. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  278. package/.next/standalone/.next/static/chunks/{1395-a340fb0a345382a4.js → 1395-e4a99912b8f83044.js} +13 -1
  279. package/.next/standalone/.next/static/chunks/app/_global-error/{page-36cb8b428b38b26a.js → page-6fc5f8e744c81802.js} +1 -1
  280. package/.next/standalone/.next/static/chunks/app/api/v1/access/[identity]/{route-36cb8b428b38b26a.js → route-6fc5f8e744c81802.js} +1 -1
  281. package/.next/standalone/.next/static/chunks/app/api/v1/access/{route-36cb8b428b38b26a.js → route-6fc5f8e744c81802.js} +1 -1
  282. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/compact/{route-36cb8b428b38b26a.js → route-6fc5f8e744c81802.js} +1 -1
  283. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/display-filters/route-6fc5f8e744c81802.js +17 -0
  284. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/route-6fc5f8e744c81802.js +17 -0
  285. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/thread/route-6fc5f8e744c81802.js +17 -0
  286. package/.next/standalone/.next/static/chunks/app/api/v1/agents/route-6fc5f8e744c81802.js +17 -0
  287. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/[hostname]/route-6fc5f8e744c81802.js +17 -0
  288. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/route-6fc5f8e744c81802.js +17 -0
  289. package/.next/standalone/.next/static/chunks/app/api/v1/artifacts/lifecycle/route-6fc5f8e744c81802.js +17 -0
  290. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/files/route-6fc5f8e744c81802.js +17 -0
  291. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/images/route-6fc5f8e744c81802.js +17 -0
  292. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/chats/route-6fc5f8e744c81802.js +17 -0
  293. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/[remote_jid]/route-6fc5f8e744c81802.js +17 -0
  294. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/route-6fc5f8e744c81802.js +17 -0
  295. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/lookup/route-6fc5f8e744c81802.js +17 -0
  296. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/pair/route-6fc5f8e744c81802.js +17 -0
  297. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/route-6fc5f8e744c81802.js +17 -0
  298. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/[route_id]/route-6fc5f8e744c81802.js +17 -0
  299. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/route-6fc5f8e744c81802.js +17 -0
  300. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/status/route-6fc5f8e744c81802.js +17 -0
  301. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/kinds/route-6fc5f8e744c81802.js +17 -0
  302. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/route-6fc5f8e744c81802.js +17 -0
  303. package/.next/standalone/.next/static/chunks/app/api/v1/builtin-tools/route-6fc5f8e744c81802.js +17 -0
  304. package/.next/standalone/.next/static/chunks/app/api/v1/config/route-6fc5f8e744c81802.js +17 -0
  305. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/[id]/route-6fc5f8e744c81802.js +17 -0
  306. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/route-6fc5f8e744c81802.js +17 -0
  307. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/currency/route-6fc5f8e744c81802.js +17 -0
  308. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/metrics/route-6fc5f8e744c81802.js +17 -0
  309. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing/route-6fc5f8e744c81802.js +17 -0
  310. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing-task/route-6fc5f8e744c81802.js +17 -0
  311. package/.next/standalone/.next/static/chunks/app/api/v1/delegations/codex/[job_id]/route-6fc5f8e744c81802.js +17 -0
  312. package/.next/standalone/.next/static/chunks/app/api/v1/documents/search/route-6fc5f8e744c81802.js +17 -0
  313. package/.next/standalone/.next/static/chunks/app/api/v1/documents/settings/route-6fc5f8e744c81802.js +17 -0
  314. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/reindex/route-6fc5f8e744c81802.js +17 -0
  315. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/route-6fc5f8e744c81802.js +17 -0
  316. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/route-6fc5f8e744c81802.js +17 -0
  317. package/.next/standalone/.next/static/chunks/app/api/v1/env/route-6fc5f8e744c81802.js +17 -0
  318. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/allowlist/route-6fc5f8e744c81802.js +17 -0
  319. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/route-6fc5f8e744c81802.js +17 -0
  320. package/.next/standalone/.next/static/chunks/app/api/v1/events/route-6fc5f8e744c81802.js +17 -0
  321. package/.next/standalone/.next/static/chunks/app/api/v1/events/test/route-6fc5f8e744c81802.js +17 -0
  322. package/.next/standalone/.next/static/chunks/app/api/v1/extension/agents/route-6fc5f8e744c81802.js +17 -0
  323. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/activate/route-6fc5f8e744c81802.js +17 -0
  324. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/foreground/route-6fc5f8e744c81802.js +17 -0
  325. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/history/route-6fc5f8e744c81802.js +17 -0
  326. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/poll/route-6fc5f8e744c81802.js +17 -0
  327. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/progress/route-6fc5f8e744c81802.js +17 -0
  328. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/result/route-6fc5f8e744c81802.js +17 -0
  329. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/retry/route-6fc5f8e744c81802.js +17 -0
  330. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/status/route-6fc5f8e744c81802.js +17 -0
  331. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/tabs/route-6fc5f8e744c81802.js +17 -0
  332. package/.next/standalone/.next/static/chunks/app/api/v1/extension/fill/route-6fc5f8e744c81802.js +17 -0
  333. package/.next/standalone/.next/static/chunks/app/api/v1/extension/refine/route-6fc5f8e744c81802.js +17 -0
  334. package/.next/standalone/.next/static/chunks/app/api/v1/extension/turn/route-6fc5f8e744c81802.js +17 -0
  335. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/route-6fc5f8e744c81802.js +17 -0
  336. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/config/route-6fc5f8e744c81802.js +17 -0
  337. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/route-6fc5f8e744c81802.js +17 -0
  338. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/secrets/route-6fc5f8e744c81802.js +17 -0
  339. package/.next/standalone/.next/static/chunks/app/api/v1/files/[name]/route-6fc5f8e744c81802.js +17 -0
  340. package/.next/standalone/.next/static/chunks/app/api/v1/fs/browse/route-6fc5f8e744c81802.js +17 -0
  341. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/[id]/route-6fc5f8e744c81802.js +17 -0
  342. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/default/route-6fc5f8e744c81802.js +17 -0
  343. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/route-6fc5f8e744c81802.js +17 -0
  344. package/.next/standalone/.next/static/chunks/app/api/v1/health/probes/route-6fc5f8e744c81802.js +17 -0
  345. package/.next/standalone/.next/static/chunks/app/api/v1/health/route-6fc5f8e744c81802.js +17 -0
  346. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/route-6fc5f8e744c81802.js +17 -0
  347. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/test/route-6fc5f8e744c81802.js +17 -0
  348. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/callback/route-6fc5f8e744c81802.js +17 -0
  349. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/start/route-6fc5f8e744c81802.js +17 -0
  350. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/status/route-6fc5f8e744c81802.js +17 -0
  351. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/callback/route-6fc5f8e744c81802.js +17 -0
  352. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/start/route-6fc5f8e744c81802.js +17 -0
  353. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/status/route-6fc5f8e744c81802.js +17 -0
  354. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/route-6fc5f8e744c81802.js +17 -0
  355. package/.next/standalone/.next/static/chunks/app/api/v1/lifecycle/adoption/route-6fc5f8e744c81802.js +17 -0
  356. package/.next/standalone/.next/static/chunks/app/api/v1/local-file/route-6fc5f8e744c81802.js +17 -0
  357. package/.next/standalone/.next/static/chunks/app/api/v1/logs/route-6fc5f8e744c81802.js +17 -0
  358. package/.next/standalone/.next/static/chunks/app/api/v1/maps/embed/route-6fc5f8e744c81802.js +17 -0
  359. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/[name]/route-6fc5f8e744c81802.js +17 -0
  360. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/registry/route-6fc5f8e744c81802.js +17 -0
  361. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/route-6fc5f8e744c81802.js +17 -0
  362. package/.next/standalone/.next/static/chunks/app/api/v1/memory/[namespace]/[key]/route-6fc5f8e744c81802.js +17 -0
  363. package/.next/standalone/.next/static/chunks/app/api/v1/memory/policy/route-6fc5f8e744c81802.js +17 -0
  364. package/.next/standalone/.next/static/chunks/app/api/v1/memory/route-6fc5f8e744c81802.js +17 -0
  365. package/.next/standalone/.next/static/chunks/app/api/v1/memory/search/route-6fc5f8e744c81802.js +17 -0
  366. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/compact-threads/route-6fc5f8e744c81802.js +17 -0
  367. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/route-6fc5f8e744c81802.js +17 -0
  368. package/.next/standalone/.next/static/chunks/app/api/v1/models/route-6fc5f8e744c81802.js +17 -0
  369. package/.next/standalone/.next/static/chunks/app/api/v1/packages/catalog/route-6fc5f8e744c81802.js +17 -0
  370. package/.next/standalone/.next/static/chunks/app/api/v1/packages/defaults/[id]/route-6fc5f8e744c81802.js +17 -0
  371. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/[id]/route-6fc5f8e744c81802.js +17 -0
  372. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/route-6fc5f8e744c81802.js +17 -0
  373. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/enabled/route-6fc5f8e744c81802.js +17 -0
  374. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/route-6fc5f8e744c81802.js +17 -0
  375. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/route-6fc5f8e744c81802.js +17 -0
  376. package/.next/standalone/.next/static/chunks/app/api/v1/packages/reload/route-6fc5f8e744c81802.js +17 -0
  377. package/.next/standalone/.next/static/chunks/app/api/v1/packages/route-6fc5f8e744c81802.js +17 -0
  378. package/.next/standalone/.next/static/chunks/app/api/v1/page-capture/route-6fc5f8e744c81802.js +17 -0
  379. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/approve/route-6fc5f8e744c81802.js +17 -0
  380. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/deny/route-6fc5f8e744c81802.js +17 -0
  381. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/route-6fc5f8e744c81802.js +17 -0
  382. package/.next/standalone/.next/static/chunks/app/api/v1/profile/location/route-6fc5f8e744c81802.js +17 -0
  383. package/.next/standalone/.next/static/chunks/app/api/v1/profile/route-6fc5f8e744c81802.js +17 -0
  384. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/models/route-6fc5f8e744c81802.js +17 -0
  385. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/probe/route-6fc5f8e744c81802.js +17 -0
  386. package/.next/standalone/.next/static/chunks/app/api/v1/providers/github-copilot/auth/route-6fc5f8e744c81802.js +17 -0
  387. package/.next/standalone/.next/static/chunks/app/api/v1/providers/route-6fc5f8e744c81802.js +17 -0
  388. package/.next/standalone/.next/static/chunks/app/api/v1/proxy-config/route-6fc5f8e744c81802.js +17 -0
  389. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/init/route-6fc5f8e744c81802.js +17 -0
  390. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/route-6fc5f8e744c81802.js +17 -0
  391. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/route-6fc5f8e744c81802.js +17 -0
  392. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/run/route-6fc5f8e744c81802.js +17 -0
  393. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/route-6fc5f8e744c81802.js +17 -0
  394. package/.next/standalone/.next/static/chunks/app/api/v1/security/idle-timeout/route-6fc5f8e744c81802.js +17 -0
  395. package/.next/standalone/.next/static/chunks/app/api/v1/security/pin/route-6fc5f8e744c81802.js +17 -0
  396. package/.next/standalone/.next/static/chunks/app/api/v1/security/state/route-6fc5f8e744c81802.js +17 -0
  397. package/.next/standalone/.next/static/chunks/app/api/v1/security/unlock/route-6fc5f8e744c81802.js +17 -0
  398. package/.next/standalone/.next/static/chunks/app/api/v1/security/verify-pin/route-6fc5f8e744c81802.js +17 -0
  399. package/.next/standalone/.next/static/chunks/app/api/v1/setup/test-key/route-6fc5f8e744c81802.js +17 -0
  400. package/.next/standalone/.next/static/chunks/app/api/v1/skills/[id]/route-6fc5f8e744c81802.js +17 -0
  401. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/[id]/route-6fc5f8e744c81802.js +17 -0
  402. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/route-6fc5f8e744c81802.js +17 -0
  403. package/.next/standalone/.next/static/chunks/app/api/v1/skills/route-6fc5f8e744c81802.js +17 -0
  404. package/.next/standalone/.next/static/chunks/app/api/v1/system/abort/route-6fc5f8e744c81802.js +17 -0
  405. package/.next/standalone/.next/static/chunks/app/api/v1/system/restart/route-6fc5f8e744c81802.js +17 -0
  406. package/.next/standalone/.next/static/chunks/app/api/v1/tailscale/route-6fc5f8e744c81802.js +17 -0
  407. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/[agent_id]/route-6fc5f8e744c81802.js +17 -0
  408. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/route-6fc5f8e744c81802.js +17 -0
  409. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/activity/route-6fc5f8e744c81802.js +17 -0
  410. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/context-pin/route-6fc5f8e744c81802.js +17 -0
  411. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/route-6fc5f8e744c81802.js +17 -0
  412. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/run/route-6fc5f8e744c81802.js +17 -0
  413. package/.next/standalone/.next/static/chunks/app/api/v1/threads/route-6fc5f8e744c81802.js +17 -0
  414. package/.next/standalone/.next/static/chunks/app/api/v1/tools/route-6fc5f8e744c81802.js +17 -0
  415. package/.next/standalone/.next/static/chunks/app/api/v1/update/apply/route-6fc5f8e744c81802.js +17 -0
  416. package/.next/standalone/.next/static/chunks/app/api/v1/update/route-6fc5f8e744c81802.js +17 -0
  417. package/.next/standalone/.next/static/chunks/app/api/v1/voice/transcribe/route-6fc5f8e744c81802.js +17 -0
  418. package/.next/standalone/.next/static/chunks/app/api/v1/voice/tts/route-6fc5f8e744c81802.js +17 -0
  419. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/route-6fc5f8e744c81802.js +17 -0
  420. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/run/route-6fc5f8e744c81802.js +17 -0
  421. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/reaction-scripts/route-6fc5f8e744c81802.js +17 -0
  422. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/route-6fc5f8e744c81802.js +17 -0
  423. package/.next/standalone/.next/static/chunks/app/manifest.webmanifest/route-6fc5f8e744c81802.js +17 -0
  424. package/.next/standalone/.next/static/chunks/app/{page-7017f07f8a7a083c.js → page-04748847c6ff866f.js} +1013 -585
  425. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-6fc5f8e744c81802.js +17 -0
  426. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-6fc5f8e744c81802.js +17 -0
  427. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-6fc5f8e744c81802.js +17 -0
  428. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-6fc5f8e744c81802.js +17 -0
  429. package/.next/standalone/.next/static/css/{d80058f0b9b41c09.css → 2669e8744cc8c212.css} +2 -2
  430. package/.next/standalone/docs/adoption/changesets.json +358 -0
  431. package/.next/standalone/lib/skills/builtins/memory-organization/SKILL.md +16 -0
  432. package/.next/standalone/package.json +3 -3
  433. package/CHANGELOG.md +44 -0
  434. package/api/client.ts +9 -0
  435. package/api/types.ts +29 -0
  436. package/app/api/v1/lifecycle/adoption/route.ts +14 -2
  437. package/app/api/v1/models/[name]/compact-threads/route.ts +14 -11
  438. package/app/api/v1/threads/[thread_id]/activity/route.ts +19 -0
  439. package/app/api/v1/threads/[thread_id]/context-pin/route.test.ts +1 -0
  440. package/app/api/v1/threads/[thread_id]/context-pin/route.ts +2 -1
  441. package/app/api/v1/threads/[thread_id]/route.ts +5 -1
  442. package/app/api/v1/threads/[thread_id]/run/route.ts +0 -1
  443. package/components/chat/ChatView.tsx +52 -11
  444. package/components/chat/ContextBoundary.test.tsx +68 -1
  445. package/components/chat/ContextBoundary.tsx +92 -13
  446. package/components/chat/MessageBubble.tsx +12 -0
  447. package/components/chat/MessageList.test.tsx +31 -0
  448. package/components/chat/MessageList.tsx +49 -28
  449. package/components/chat/ToolList.test.tsx +92 -16
  450. package/components/chat/ToolList.tsx +59 -4
  451. package/components/chat/chat-helpers.test.tsx +24 -1
  452. package/components/chat/chat-helpers.ts +47 -4
  453. package/components/chat/useThreadActivity.test.tsx +113 -0
  454. package/components/chat/useThreadActivity.ts +94 -0
  455. package/components/chat/useThreadData.ts +16 -16
  456. package/components/chat/workflow-step-retry.ts +25 -0
  457. package/components/integrations/NetworkSection.tsx +2 -2
  458. package/components/ui/BootScreen.tsx +17 -0
  459. package/components/ui/WorkflowChecklist.tsx +71 -33
  460. package/hooks/useSSE.ts +28 -3
  461. package/lib/agents/citation-checker.test.ts +40 -2
  462. package/lib/agents/citation-checker.ts +56 -11
  463. package/lib/agents/compaction-pipeline.test.ts +202 -0
  464. package/lib/agents/compaction-pipeline.ts +483 -0
  465. package/lib/agents/context-boundary.ts +5 -6
  466. package/lib/agents/conversation-summary.ts +37 -21
  467. package/lib/agents/instruction-edits.test.ts +120 -0
  468. package/lib/agents/instruction-edits.ts +65 -42
  469. package/lib/agents/prepare/history-window.test.ts +18 -0
  470. package/lib/agents/prepare/history-window.ts +11 -2
  471. package/lib/agents/prepare/request.ts +4 -2
  472. package/lib/agents/prepare/system-prompt.test.ts +49 -0
  473. package/lib/agents/prepare/system-prompt.ts +16 -5
  474. package/lib/agents/prompt-registry.test.ts +5 -140
  475. package/lib/agents/prompt-registry.ts +45 -1
  476. package/lib/agents/prompt-variants.ts +146 -0
  477. package/lib/agents/proposals.test.ts +76 -0
  478. package/lib/agents/proposals.ts +13 -5
  479. package/lib/agents/run-registry.test.ts +22 -0
  480. package/lib/agents/run-registry.ts +29 -0
  481. package/lib/agents/run-thread.auto-boundary.test.ts +125 -5
  482. package/lib/agents/run-thread.retry.test.ts +67 -1
  483. package/lib/agents/run-thread.ts +110 -10
  484. package/lib/agents/sqlite-checkpoint-saver.test.ts +91 -0
  485. package/lib/agents/thread-activity.test.ts +31 -0
  486. package/lib/agents/thread-activity.ts +27 -0
  487. package/lib/agents/thread-compaction-state.test.ts +82 -0
  488. package/lib/agents/thread-compaction-state.ts +121 -0
  489. package/lib/agents/thread-compaction.test.ts +83 -4
  490. package/lib/agents/thread-compaction.ts +34 -11
  491. package/lib/agents/warm-summary-background.test.ts +219 -5
  492. package/lib/agents/warm-summary-background.ts +346 -143
  493. package/lib/agents/warm-topics.test.ts +191 -0
  494. package/lib/agents/warm-topics.ts +317 -0
  495. package/lib/agents/workflow-step-retry.test.ts +96 -0
  496. package/lib/agents/workflow-step-retry.ts +216 -0
  497. package/lib/api/browser-control.ts +0 -3
  498. package/lib/bridges/dispatcher.ts +1 -0
  499. package/lib/bridges/message-role.test.ts +81 -0
  500. package/lib/bridges/message-role.ts +23 -10
  501. package/lib/bridges/types.ts +6 -0
  502. package/lib/bridges/whatsapp-link.test.ts +32 -0
  503. package/lib/bridges/whatsapp-link.ts +21 -0
  504. package/lib/bridges/whatsapp.inbound.test.ts +239 -0
  505. package/lib/bridges/whatsapp.sender.test.ts +80 -1
  506. package/lib/bridges/whatsapp.ts +76 -38
  507. package/lib/db/migrations.ts +5 -0
  508. package/lib/env/config.ts +2 -0
  509. package/lib/env/schema.ts +12 -0
  510. package/lib/lifecycle/changeset-build.test.ts +93 -0
  511. package/lib/lifecycle/changeset-build.ts +210 -0
  512. package/lib/lifecycle/changesets.test.ts +101 -0
  513. package/lib/lifecycle/changesets.ts +166 -0
  514. package/lib/lifecycle/surface-collect.test.ts +88 -0
  515. package/lib/lifecycle/surface-collect.ts +64 -0
  516. package/lib/lifecycle/surface-snapshot.test.ts +104 -0
  517. package/lib/lifecycle/surface-snapshot.ts +210 -0
  518. package/lib/memory/record.ts +0 -2
  519. package/lib/pricing/snapshot.test.ts +70 -0
  520. package/lib/pricing/snapshot.ts +10 -2
  521. package/lib/providers/external.ts +0 -2
  522. package/lib/proxy/dispatcher.test.ts +119 -1
  523. package/lib/proxy/dispatcher.ts +22 -9
  524. package/lib/skills/builtins/memory-organization/SKILL.md +16 -0
  525. package/lib/stores/agent-configs.ts +10 -5
  526. package/lib/stores/bridges.test.ts +81 -0
  527. package/lib/stores/bridges.ts +9 -8
  528. package/lib/stores/proxy-config.test.ts +120 -0
  529. package/lib/stores/proxy-config.ts +22 -4
  530. package/lib/stores/threads.test.ts +9 -0
  531. package/lib/stores/threads.ts +33 -19
  532. package/lib/stores/version-adoption.test.ts +96 -0
  533. package/lib/stores/version-adoption.ts +239 -26
  534. package/lib/stores/workflow-progress.ts +3 -0
  535. package/lib/tools/communications/calendar.test.ts +43 -2
  536. package/lib/tools/communications/calendar.ts +2 -0
  537. package/lib/tools/communications/gmail.test.ts +51 -1
  538. package/lib/tools/communications/gmail.ts +44 -2
  539. package/lib/tools/communications/ms-todo.ts +0 -7
  540. package/lib/tools/communications/outlook-calendar.ts +2 -0
  541. package/lib/tools/communications/outlook.test.ts +33 -2
  542. package/lib/tools/communications/outlook.ts +2 -0
  543. package/lib/tools/filesystem/edit-match.test.ts +133 -0
  544. package/lib/tools/filesystem/edit-match.ts +7 -2
  545. package/lib/tools/general/memory.ts +1 -1
  546. package/lib/tools/general/workflow-progress.ts +2 -0
  547. package/lib/tools/runtime/catalog.ts +1 -25
  548. package/lib/tools/support/result-refs.test.ts +131 -0
  549. package/lib/tools/support/result-refs.ts +41 -9
  550. package/lib/triggers/registry.ts +0 -4
  551. package/lib/utils/source-link.test.ts +51 -0
  552. package/lib/utils/source-link.ts +45 -0
  553. package/package.json +3 -3
  554. package/scripts/install-to-system.ps1 +39 -11
  555. package/scripts/install-to-system.sh +37 -3
  556. package/.next/standalone/.next/server/chunks/3979.js +0 -581
  557. package/.next/standalone/.next/server/chunks/5936.js +0 -594
  558. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/display-filters/route-36cb8b428b38b26a.js +0 -17
  559. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/route-36cb8b428b38b26a.js +0 -17
  560. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/thread/route-36cb8b428b38b26a.js +0 -17
  561. package/.next/standalone/.next/static/chunks/app/api/v1/agents/route-36cb8b428b38b26a.js +0 -17
  562. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/[hostname]/route-36cb8b428b38b26a.js +0 -17
  563. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/route-36cb8b428b38b26a.js +0 -17
  564. package/.next/standalone/.next/static/chunks/app/api/v1/artifacts/lifecycle/route-36cb8b428b38b26a.js +0 -17
  565. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/files/route-36cb8b428b38b26a.js +0 -17
  566. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/images/route-36cb8b428b38b26a.js +0 -17
  567. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/chats/route-36cb8b428b38b26a.js +0 -17
  568. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/[remote_jid]/route-36cb8b428b38b26a.js +0 -17
  569. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/route-36cb8b428b38b26a.js +0 -17
  570. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/lookup/route-36cb8b428b38b26a.js +0 -17
  571. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/pair/route-36cb8b428b38b26a.js +0 -17
  572. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/route-36cb8b428b38b26a.js +0 -17
  573. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/[route_id]/route-36cb8b428b38b26a.js +0 -17
  574. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/route-36cb8b428b38b26a.js +0 -17
  575. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/status/route-36cb8b428b38b26a.js +0 -17
  576. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/kinds/route-36cb8b428b38b26a.js +0 -17
  577. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/route-36cb8b428b38b26a.js +0 -17
  578. package/.next/standalone/.next/static/chunks/app/api/v1/builtin-tools/route-36cb8b428b38b26a.js +0 -17
  579. package/.next/standalone/.next/static/chunks/app/api/v1/config/route-36cb8b428b38b26a.js +0 -17
  580. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/[id]/route-36cb8b428b38b26a.js +0 -17
  581. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/route-36cb8b428b38b26a.js +0 -17
  582. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/currency/route-36cb8b428b38b26a.js +0 -17
  583. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/metrics/route-36cb8b428b38b26a.js +0 -17
  584. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing/route-36cb8b428b38b26a.js +0 -17
  585. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing-task/route-36cb8b428b38b26a.js +0 -17
  586. package/.next/standalone/.next/static/chunks/app/api/v1/delegations/codex/[job_id]/route-36cb8b428b38b26a.js +0 -17
  587. package/.next/standalone/.next/static/chunks/app/api/v1/documents/search/route-36cb8b428b38b26a.js +0 -17
  588. package/.next/standalone/.next/static/chunks/app/api/v1/documents/settings/route-36cb8b428b38b26a.js +0 -17
  589. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/reindex/route-36cb8b428b38b26a.js +0 -17
  590. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/route-36cb8b428b38b26a.js +0 -17
  591. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/route-36cb8b428b38b26a.js +0 -17
  592. package/.next/standalone/.next/static/chunks/app/api/v1/env/route-36cb8b428b38b26a.js +0 -17
  593. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/allowlist/route-36cb8b428b38b26a.js +0 -17
  594. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/route-36cb8b428b38b26a.js +0 -17
  595. package/.next/standalone/.next/static/chunks/app/api/v1/events/route-36cb8b428b38b26a.js +0 -17
  596. package/.next/standalone/.next/static/chunks/app/api/v1/events/test/route-36cb8b428b38b26a.js +0 -17
  597. package/.next/standalone/.next/static/chunks/app/api/v1/extension/agents/route-36cb8b428b38b26a.js +0 -17
  598. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/activate/route-36cb8b428b38b26a.js +0 -17
  599. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/foreground/route-36cb8b428b38b26a.js +0 -17
  600. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/history/route-36cb8b428b38b26a.js +0 -17
  601. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/poll/route-36cb8b428b38b26a.js +0 -17
  602. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/progress/route-36cb8b428b38b26a.js +0 -17
  603. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/result/route-36cb8b428b38b26a.js +0 -17
  604. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/retry/route-36cb8b428b38b26a.js +0 -17
  605. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/status/route-36cb8b428b38b26a.js +0 -17
  606. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/tabs/route-36cb8b428b38b26a.js +0 -17
  607. package/.next/standalone/.next/static/chunks/app/api/v1/extension/fill/route-36cb8b428b38b26a.js +0 -17
  608. package/.next/standalone/.next/static/chunks/app/api/v1/extension/refine/route-36cb8b428b38b26a.js +0 -17
  609. package/.next/standalone/.next/static/chunks/app/api/v1/extension/turn/route-36cb8b428b38b26a.js +0 -17
  610. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/route-36cb8b428b38b26a.js +0 -17
  611. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/config/route-36cb8b428b38b26a.js +0 -17
  612. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/route-36cb8b428b38b26a.js +0 -17
  613. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/secrets/route-36cb8b428b38b26a.js +0 -17
  614. package/.next/standalone/.next/static/chunks/app/api/v1/files/[name]/route-36cb8b428b38b26a.js +0 -17
  615. package/.next/standalone/.next/static/chunks/app/api/v1/fs/browse/route-36cb8b428b38b26a.js +0 -17
  616. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/[id]/route-36cb8b428b38b26a.js +0 -17
  617. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/default/route-36cb8b428b38b26a.js +0 -17
  618. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/route-36cb8b428b38b26a.js +0 -17
  619. package/.next/standalone/.next/static/chunks/app/api/v1/health/probes/route-36cb8b428b38b26a.js +0 -17
  620. package/.next/standalone/.next/static/chunks/app/api/v1/health/route-36cb8b428b38b26a.js +0 -17
  621. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/route-36cb8b428b38b26a.js +0 -17
  622. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/test/route-36cb8b428b38b26a.js +0 -17
  623. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/callback/route-36cb8b428b38b26a.js +0 -17
  624. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/start/route-36cb8b428b38b26a.js +0 -17
  625. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/status/route-36cb8b428b38b26a.js +0 -17
  626. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/callback/route-36cb8b428b38b26a.js +0 -17
  627. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/start/route-36cb8b428b38b26a.js +0 -17
  628. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/status/route-36cb8b428b38b26a.js +0 -17
  629. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/route-36cb8b428b38b26a.js +0 -17
  630. package/.next/standalone/.next/static/chunks/app/api/v1/lifecycle/adoption/route-36cb8b428b38b26a.js +0 -17
  631. package/.next/standalone/.next/static/chunks/app/api/v1/local-file/route-36cb8b428b38b26a.js +0 -17
  632. package/.next/standalone/.next/static/chunks/app/api/v1/logs/route-36cb8b428b38b26a.js +0 -17
  633. package/.next/standalone/.next/static/chunks/app/api/v1/maps/embed/route-36cb8b428b38b26a.js +0 -17
  634. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/[name]/route-36cb8b428b38b26a.js +0 -17
  635. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/registry/route-36cb8b428b38b26a.js +0 -17
  636. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/route-36cb8b428b38b26a.js +0 -17
  637. package/.next/standalone/.next/static/chunks/app/api/v1/memory/[namespace]/[key]/route-36cb8b428b38b26a.js +0 -17
  638. package/.next/standalone/.next/static/chunks/app/api/v1/memory/policy/route-36cb8b428b38b26a.js +0 -17
  639. package/.next/standalone/.next/static/chunks/app/api/v1/memory/route-36cb8b428b38b26a.js +0 -17
  640. package/.next/standalone/.next/static/chunks/app/api/v1/memory/search/route-36cb8b428b38b26a.js +0 -17
  641. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/compact-threads/route-36cb8b428b38b26a.js +0 -17
  642. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/route-36cb8b428b38b26a.js +0 -17
  643. package/.next/standalone/.next/static/chunks/app/api/v1/models/route-36cb8b428b38b26a.js +0 -17
  644. package/.next/standalone/.next/static/chunks/app/api/v1/packages/catalog/route-36cb8b428b38b26a.js +0 -17
  645. package/.next/standalone/.next/static/chunks/app/api/v1/packages/defaults/[id]/route-36cb8b428b38b26a.js +0 -17
  646. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/[id]/route-36cb8b428b38b26a.js +0 -17
  647. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/route-36cb8b428b38b26a.js +0 -17
  648. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/enabled/route-36cb8b428b38b26a.js +0 -17
  649. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/route-36cb8b428b38b26a.js +0 -17
  650. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/route-36cb8b428b38b26a.js +0 -17
  651. package/.next/standalone/.next/static/chunks/app/api/v1/packages/reload/route-36cb8b428b38b26a.js +0 -17
  652. package/.next/standalone/.next/static/chunks/app/api/v1/packages/route-36cb8b428b38b26a.js +0 -17
  653. package/.next/standalone/.next/static/chunks/app/api/v1/page-capture/route-36cb8b428b38b26a.js +0 -17
  654. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/approve/route-36cb8b428b38b26a.js +0 -17
  655. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/deny/route-36cb8b428b38b26a.js +0 -17
  656. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/route-36cb8b428b38b26a.js +0 -17
  657. package/.next/standalone/.next/static/chunks/app/api/v1/profile/location/route-36cb8b428b38b26a.js +0 -17
  658. package/.next/standalone/.next/static/chunks/app/api/v1/profile/route-36cb8b428b38b26a.js +0 -17
  659. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/models/route-36cb8b428b38b26a.js +0 -17
  660. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/probe/route-36cb8b428b38b26a.js +0 -17
  661. package/.next/standalone/.next/static/chunks/app/api/v1/providers/github-copilot/auth/route-36cb8b428b38b26a.js +0 -17
  662. package/.next/standalone/.next/static/chunks/app/api/v1/providers/route-36cb8b428b38b26a.js +0 -17
  663. package/.next/standalone/.next/static/chunks/app/api/v1/proxy-config/route-36cb8b428b38b26a.js +0 -17
  664. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/init/route-36cb8b428b38b26a.js +0 -17
  665. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/route-36cb8b428b38b26a.js +0 -17
  666. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/route-36cb8b428b38b26a.js +0 -17
  667. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/run/route-36cb8b428b38b26a.js +0 -17
  668. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/route-36cb8b428b38b26a.js +0 -17
  669. package/.next/standalone/.next/static/chunks/app/api/v1/security/idle-timeout/route-36cb8b428b38b26a.js +0 -17
  670. package/.next/standalone/.next/static/chunks/app/api/v1/security/pin/route-36cb8b428b38b26a.js +0 -17
  671. package/.next/standalone/.next/static/chunks/app/api/v1/security/state/route-36cb8b428b38b26a.js +0 -17
  672. package/.next/standalone/.next/static/chunks/app/api/v1/security/unlock/route-36cb8b428b38b26a.js +0 -17
  673. package/.next/standalone/.next/static/chunks/app/api/v1/security/verify-pin/route-36cb8b428b38b26a.js +0 -17
  674. package/.next/standalone/.next/static/chunks/app/api/v1/setup/test-key/route-36cb8b428b38b26a.js +0 -17
  675. package/.next/standalone/.next/static/chunks/app/api/v1/skills/[id]/route-36cb8b428b38b26a.js +0 -17
  676. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/[id]/route-36cb8b428b38b26a.js +0 -17
  677. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/route-36cb8b428b38b26a.js +0 -17
  678. package/.next/standalone/.next/static/chunks/app/api/v1/skills/route-36cb8b428b38b26a.js +0 -17
  679. package/.next/standalone/.next/static/chunks/app/api/v1/system/abort/route-36cb8b428b38b26a.js +0 -17
  680. package/.next/standalone/.next/static/chunks/app/api/v1/system/restart/route-36cb8b428b38b26a.js +0 -17
  681. package/.next/standalone/.next/static/chunks/app/api/v1/tailscale/route-36cb8b428b38b26a.js +0 -17
  682. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/[agent_id]/route-36cb8b428b38b26a.js +0 -17
  683. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/route-36cb8b428b38b26a.js +0 -17
  684. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/context-pin/route-36cb8b428b38b26a.js +0 -17
  685. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/route-36cb8b428b38b26a.js +0 -17
  686. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/run/route-36cb8b428b38b26a.js +0 -17
  687. package/.next/standalone/.next/static/chunks/app/api/v1/threads/route-36cb8b428b38b26a.js +0 -17
  688. package/.next/standalone/.next/static/chunks/app/api/v1/tools/route-36cb8b428b38b26a.js +0 -17
  689. package/.next/standalone/.next/static/chunks/app/api/v1/update/apply/route-36cb8b428b38b26a.js +0 -17
  690. package/.next/standalone/.next/static/chunks/app/api/v1/update/route-36cb8b428b38b26a.js +0 -17
  691. package/.next/standalone/.next/static/chunks/app/api/v1/voice/transcribe/route-36cb8b428b38b26a.js +0 -17
  692. package/.next/standalone/.next/static/chunks/app/api/v1/voice/tts/route-36cb8b428b38b26a.js +0 -17
  693. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/route-36cb8b428b38b26a.js +0 -17
  694. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/run/route-36cb8b428b38b26a.js +0 -17
  695. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/reaction-scripts/route-36cb8b428b38b26a.js +0 -17
  696. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/route-36cb8b428b38b26a.js +0 -17
  697. package/.next/standalone/.next/static/chunks/app/manifest.webmanifest/route-36cb8b428b38b26a.js +0 -17
  698. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-36cb8b428b38b26a.js +0 -17
  699. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-36cb8b428b38b26a.js +0 -17
  700. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-36cb8b428b38b26a.js +0 -17
  701. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-36cb8b428b38b26a.js +0 -17
  702. /package/.next/standalone/.next/static/{NUrC9xax1sp1Q70nlFqS6 → hwujW4hR1b-r3k5WdMxZO}/_buildManifest.js +0 -0
  703. /package/.next/standalone/.next/static/{NUrC9xax1sp1Q70nlFqS6 → hwujW4hR1b-r3k5WdMxZO}/_ssgManifest.js +0 -0
@@ -104,848 +104,853 @@ module.exports = require("next/dist/server/app-render/action-async-storage.exter
104
104
 
105
105
  /***/ }),
106
106
 
107
- /***/ 27887:
108
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
107
+ /***/ 27910:
108
+ /***/ ((module) => {
109
109
 
110
- __webpack_require__.r(__webpack_exports__);
111
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
112
- /* harmony export */ handler: () => (/* binding */ handler),
113
- /* harmony export */ patchFetch: () => (/* binding */ patchFetch),
114
- /* harmony export */ routeModule: () => (/* binding */ routeModule),
115
- /* harmony export */ serverHooks: () => (/* binding */ serverHooks),
116
- /* harmony export */ workAsyncStorage: () => (/* binding */ workAsyncStorage),
117
- /* harmony export */ workUnitAsyncStorage: () => (/* binding */ workUnitAsyncStorage)
118
- /* harmony export */ });
119
- /* harmony import */ var next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(19225);
120
- /* 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__);
121
- /* harmony import */ var next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84006);
122
- /* harmony import */ var next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8317);
123
- /* 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__);
124
- /* harmony import */ var next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(99373);
125
- /* 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__);
126
- /* harmony import */ var next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(34775);
127
- /* 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__);
128
- /* harmony import */ var next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(24235);
129
- /* 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__);
130
- /* harmony import */ var next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(261);
131
- /* 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__);
132
- /* harmony import */ var next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(54365);
133
- /* 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__);
134
- /* harmony import */ var next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(90771);
135
- /* 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__);
136
- /* harmony import */ var next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(73461);
137
- /* 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__);
138
- /* harmony import */ var next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(67798);
139
- /* harmony import */ var next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(92280);
140
- /* harmony import */ var next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(62018);
141
- /* 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__);
142
- /* harmony import */ var next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(45696);
143
- /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(47929);
144
- /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__);
145
- /* harmony import */ var next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(86439);
146
- /* 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__);
147
- /* harmony import */ var next_dist_server_lib_route_cache_key__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(10246);
148
- /* 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__);
149
- /* harmony import */ var next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(37527);
150
- /* 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__);
110
+ module.exports = require("stream");
111
+
112
+ /***/ }),
113
+
114
+ /***/ 28354:
115
+ /***/ ((module) => {
116
+
117
+ module.exports = require("util");
118
+
119
+ /***/ }),
120
+
121
+ /***/ 29021:
122
+ /***/ ((module) => {
151
123
 
124
+ module.exports = require("fs");
152
125
 
126
+ /***/ }),
153
127
 
128
+ /***/ 29294:
129
+ /***/ ((module) => {
154
130
 
131
+ module.exports = require("next/dist/server/app-render/work-async-storage.external.js");
155
132
 
133
+ /***/ }),
156
134
 
135
+ /***/ 31421:
136
+ /***/ ((module) => {
157
137
 
138
+ module.exports = require("node:child_process");
158
139
 
140
+ /***/ }),
159
141
 
142
+ /***/ 33873:
143
+ /***/ ((module) => {
160
144
 
145
+ module.exports = require("path");
161
146
 
147
+ /***/ }),
162
148
 
149
+ /***/ 37067:
150
+ /***/ ((module) => {
163
151
 
152
+ module.exports = require("node:http");
164
153
 
154
+ /***/ }),
165
155
 
156
+ /***/ 38522:
157
+ /***/ ((module) => {
166
158
 
159
+ module.exports = require("node:zlib");
167
160
 
161
+ /***/ }),
168
162
 
169
- // We inject the nextConfigOutput here so that we can use them in the route
170
- // module.
171
- const nextConfigOutput = "standalone"
172
- const routeModule = new next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__.AppRouteRouteModule({
173
- definition: {
174
- kind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
175
- page: "/api/v1/agents/[id]/thread/route",
176
- pathname: "/api/v1/agents/[id]/thread",
177
- filename: "route",
178
- bundlePath: "app/api/v1/agents/[id]/thread/route"
179
- },
180
- distDir: ".next" || 0,
181
- relativeProjectDir: false || '',
182
- resolvedPagePath: "/home/runner/work/jarela/jarela/app/api/v1/agents/[id]/thread/route.ts",
183
- nextConfigOutput,
184
- // The lazy require factory ensures that:
185
- // - In dev: devRequestTimingInternalsEnd is set before userland executes,
186
- // correctly attributing module load time to application-code rather than
187
- // framework internals.
188
- // - In all modes: async modules (route files with top-level await) are
189
- // handled correctly — require() returns a Promise for such modules, which
190
- // ensureUserland() awaits before the first request is handled.
191
- userland: ()=>__webpack_require__(14622),
192
- // In Turbopack dev mode, also provide a synchronous per-request getter so
193
- // server HMR updates are picked up without re-executing the entry chunk.
194
- // Using require() (synchronous) avoids adding async overhead that would be
195
- // incorrectly attributed to application-code time in devRequestTiming.
196
- ... false ? 0 : {}
197
- });
198
- // Pull out the exports that we need to expose from the module. This should
199
- // be eliminated when we've moved the other routes to the new format. These
200
- // are used to hook into the route.
201
- const { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;
202
- function patchFetch() {
203
- return (0,next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__.patchFetch)({
204
- workAsyncStorage,
205
- workUnitAsyncStorage
206
- });
207
- }
163
+ /***/ 41720:
164
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
208
165
 
209
- async function handler(req, res, ctx) {
210
- if (ctx.requestMeta) {
211
- (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.setRequestMeta)(req, ctx.requestMeta);
166
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
167
+ /* harmony export */ BM: () => (/* binding */ upsertAgentConfig),
168
+ /* harmony export */ E1: () => (/* binding */ updateAgentDisplayFilters),
169
+ /* harmony export */ P2: () => (/* binding */ parseCitationStrictness),
170
+ /* harmony export */ S2: () => (/* binding */ getAgentToolCredentials),
171
+ /* harmony export */ SJ: () => (/* binding */ generateAgentId),
172
+ /* harmony export */ TG: () => (/* binding */ getAgentTools),
173
+ /* harmony export */ bg: () => (/* binding */ parseDelegateTargets),
174
+ /* harmony export */ d2: () => (/* binding */ DISPLAY_FILTER_KEYS),
175
+ /* harmony export */ fg: () => (/* binding */ getAgentTierProportions),
176
+ /* harmony export */ mJ: () => (/* binding */ getAgentConfig),
177
+ /* harmony export */ nV: () => (/* binding */ getAgentDisplayFilters),
178
+ /* harmony export */ vU: () => (/* binding */ getDefaultAgentConfig),
179
+ /* harmony export */ vi: () => (/* binding */ DISPLAY_FILTER_DEFAULTS),
180
+ /* harmony export */ xi: () => (/* binding */ deleteAgentConfig),
181
+ /* harmony export */ zb: () => (/* binding */ listAgentConfigs)
182
+ /* harmony export */ });
183
+ /* harmony import */ var _lib_db__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(46);
184
+ /* harmony import */ var _lib_db_transaction__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(99043);
185
+ /* harmony import */ var _lib_agents_adaptive_persona_presets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(66849);
186
+
187
+
188
+
189
+ const now = ()=>new Date().toISOString();
190
+ /** Coerce arbitrary input (DB row TEXT, API body, undefined) to the enum.
191
+ * Returns `null` for null/undefined/unknown values so callers can default. */ function parseCitationStrictness(value) {
192
+ if (value === "off" || value === "informational" || value === "standard" || value === "strict") {
193
+ return value;
212
194
  }
213
- if (routeModule.isDev) {
214
- (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.addRequestMeta)(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());
195
+ return null;
196
+ }
197
+ /**
198
+ * Parse the JSON-encoded per-agent override of context tier proportions.
199
+ * Returns `null` for NULL, blank, malformed JSON, or any payload that
200
+ * doesn't have three finite non-negative numeric fields. Callers fall
201
+ * back to the model config's value (or built-in defaults) on null.
202
+ */ function getAgentTierProportions(row) {
203
+ const raw = row.context_tier_proportions;
204
+ if (!raw) return null;
205
+ try {
206
+ const parsed = JSON.parse(raw);
207
+ const hot = Number(parsed.hot);
208
+ const warm = Number(parsed.warm);
209
+ const facts = Number(parsed.facts);
210
+ if (![
211
+ hot,
212
+ warm,
213
+ facts
214
+ ].every((n)=>Number.isFinite(n) && n >= 0)) return null;
215
+ if (hot + warm + facts <= 0) return null;
216
+ return {
217
+ hot,
218
+ warm,
219
+ facts
220
+ };
221
+ } catch {
222
+ return null;
215
223
  }
216
- let srcPage = "/api/v1/agents/[id]/thread/route";
217
- // turbopack doesn't normalize `/index` in the page name
218
- // so we need to to process dynamic routes properly
219
- // TODO: fix turbopack providing differing value from webpack
220
- if (false) {} else if (srcPage === '/index') {
221
- // we always normalize /index specifically
222
- srcPage = '/';
224
+ }
225
+ function listAgentConfigs() {
226
+ // Default agent always first; then by the timestamp of each agent's latest message.
227
+ return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare(`SELECT a.*
228
+ FROM agent_configs a
229
+ LEFT JOIN (
230
+ SELECT t.agent_id, MAX(m.created_at) AS last_message_at
231
+ FROM threads t
232
+ JOIN messages m ON m.thread_id = t.thread_id
233
+ GROUP BY t.agent_id
234
+ ) latest ON latest.agent_id = a.id
235
+ ORDER BY a.is_default DESC, COALESCE(latest.last_message_at, a.created_at) DESC, a.id ASC`).all();
236
+ }
237
+ function getDefaultAgentConfig() {
238
+ return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("SELECT * FROM agent_configs WHERE is_default=1 LIMIT 1").get() ?? null;
239
+ }
240
+ function getAgentConfig(id) {
241
+ return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("SELECT * FROM agent_configs WHERE id=?").get(id) ?? null;
242
+ }
243
+ /**
244
+ * Parse the JSON-encoded delegate whitelist into a deduped string[]. Returns
245
+ * an empty array for NULL, blank, or malformed JSON (delegation is opt-in).
246
+ */ /**
247
+ * Parse the agent's tool allowlist (`tools` column, stored as a JSON string).
248
+ * Returns an empty array on NULL/blank/malformed JSON — same defensive shape
249
+ * as parseDelegateTargets. Callers that previously did `JSON.parse(cfg.tools)`
250
+ * inline should switch to this getter so the serialization contract stays
251
+ * owned by this store.
252
+ */ function getAgentTools(cfg) {
253
+ if (!cfg?.tools) return [];
254
+ try {
255
+ const parsed = JSON.parse(cfg.tools);
256
+ if (!Array.isArray(parsed)) return [];
257
+ return parsed.filter((x)=>typeof x === "string" && x.length > 0);
258
+ } catch {
259
+ return [];
223
260
  }
224
- const multiZoneDraftMode = false;
225
- const prepareResult = await routeModule.prepare(req, res, {
226
- srcPage,
227
- multiZoneDraftMode
228
- });
229
- if (!prepareResult) {
230
- res.statusCode = 400;
231
- res.end('Bad Request');
232
- ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());
233
- return null;
261
+ }
262
+ function parseDelegateTargets(raw) {
263
+ if (!raw) return [];
264
+ try {
265
+ const parsed = JSON.parse(raw);
266
+ if (!Array.isArray(parsed)) return [];
267
+ const ids = parsed.filter((x)=>typeof x === "string" && x.length > 0);
268
+ return Array.from(new Set(ids));
269
+ } catch {
270
+ return [];
234
271
  }
235
- const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest, previewProps } = prepareResult;
236
- const normalizedSrcPage = (0,next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__.normalizeAppPath)(srcPage);
237
- // Only this route's prerenders can establish ISR or admit generated params.
238
- 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]));
239
- let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || isPrerendered);
240
- const render404 = async ()=>{
241
- // TODO: should route-module itself handle rendering the 404
242
- if (routerServerContext == null ? void 0 : routerServerContext.render404) {
243
- await routerServerContext.render404(req, res, parsedUrl, false);
244
- } else {
245
- res.end('This page could not be found');
246
- }
247
- return null;
248
- };
249
- if (isIsr && !isDraftMode) {
250
- const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];
251
- if (prerenderInfo) {
252
- if (prerenderInfo.fallback === false && !isPrerendered) {
253
- if (nextConfig.adapterPath) {
254
- return await render404();
255
- }
256
- throw new next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError();
257
- }
272
+ }
273
+ /**
274
+ * Parse the per-agent `{ toolName: credentialId }` override map stored in
275
+ * the `tool_credentials` column. Returns an empty record on NULL / blank /
276
+ * malformed JSON / non-string entries so downstream code can treat the
277
+ * result as a plain lookup without further validation.
278
+ */ function getAgentToolCredentials(cfg) {
279
+ if (!cfg?.tool_credentials) return {};
280
+ try {
281
+ const parsed = JSON.parse(cfg.tool_credentials);
282
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
283
+ const out = {};
284
+ for (const [k, v] of Object.entries(parsed)){
285
+ if (typeof v === "string" && v.length > 0) out[k] = v;
258
286
  }
287
+ return out;
288
+ } catch {
289
+ return {};
259
290
  }
260
- let cacheKey = null;
261
- if (isIsr && !routeModule.isDev && !isDraftMode) {
262
- cacheKey = resolvedPathname;
263
- // ensure /index and / is normalized to one key
264
- cacheKey = cacheKey === '/index' ? '/' : cacheKey;
291
+ }
292
+ function upsertAgentConfig(input) {
293
+ return (0,_lib_db_transaction__WEBPACK_IMPORTED_MODULE_1__/* .withDbTransaction */ .J)(()=>upsertAgentConfigTransaction(input));
294
+ }
295
+ function upsertAgentConfigTransaction(input) {
296
+ const t = now();
297
+ const db = (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)();
298
+ const existing = getAgentConfig(input.id);
299
+ const created_at = existing?.created_at ?? t;
300
+ const existingMbti = toMbti(existing?.adaptive_mbti);
301
+ const mbti = input.adaptive_mbti ?? existingMbti ?? "INTJ";
302
+ const preset = _lib_agents_adaptive_persona_presets__WEBPACK_IMPORTED_MODULE_2__/* .MBTI_PRESETS */ .e[mbti];
303
+ // Omitted sliders keep their tuned values; they only fall back to the
304
+ // preset when the type changes or the agent is new. Otherwise every
305
+ // partial update (approved proposals, tool edits) reset them.
306
+ const keepTuned = existing !== null && existing !== undefined && mbti === existingMbti;
307
+ const strength = input.adaptive_persona_strength ?? (keepTuned ? existing.adaptive_persona_strength : preset.strength);
308
+ const empathy = input.adaptive_empathy ?? (keepTuned ? existing.adaptive_empathy : preset.empathy);
309
+ const expressiveness = input.adaptive_expressiveness ?? (keepTuned ? existing.adaptive_expressiveness : preset.expressiveness);
310
+ const verbosity = input.adaptive_verbosity ?? (keepTuned ? existing.adaptive_verbosity : preset.verbosity);
311
+ if (input.is_default) db.prepare("UPDATE agent_configs SET is_default=0").run();
312
+ // harness_id: explicit `undefined` means "keep existing"; explicit `null`
313
+ // means "use the global default". Empty string is normalised to null too,
314
+ // matching how the AgentEditor sends "" for the inherit option.
315
+ const harnessId = input.harness_id === undefined ? existing?.harness_id ?? null : input.harness_id && input.harness_id.length > 0 ? input.harness_id : null;
316
+ // delegate_targets: undefined = keep existing; explicit empty array clears.
317
+ 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))));
318
+ // context_tier_proportions: undefined = keep existing; null = clear and
319
+ // inherit from the model; object = serialise as JSON. Negative values are
320
+ // clamped to 0 so the upsert can't poison the column with bad data.
321
+ const tierProportions = input.context_tier_proportions === undefined ? existing?.context_tier_proportions ?? null : input.context_tier_proportions === null ? null : JSON.stringify({
322
+ hot: Math.max(0, Number(input.context_tier_proportions.hot) || 0),
323
+ warm: Math.max(0, Number(input.context_tier_proportions.warm) || 0),
324
+ facts: Math.max(0, Number(input.context_tier_proportions.facts) || 0)
325
+ });
326
+ // Anti-hallucination override: `undefined` keeps existing; `null` clears
327
+ // the override (inherits env). Empty-string model is normalised to null
328
+ // so the editor can ship "" for the inherit option.
329
+ 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;
330
+ 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;
331
+ const citationStrictness = input.citation_strictness === undefined ? parseCitationStrictness(existing?.citation_strictness) ?? "off" : parseCitationStrictness(input.citation_strictness) ?? "off";
332
+ const toolCredentials = serialiseToolCredentials(input.tool_credentials, existing?.tool_credentials ?? null);
333
+ const VALID_ROUTER_POLICIES = new Set([
334
+ "cheap",
335
+ "fast",
336
+ "balanced",
337
+ "quality"
338
+ ]);
339
+ 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;
340
+ const routerEnabled = input.router_enabled === undefined ? existing?.router_enabled ?? null : input.router_enabled === null ? null : input.router_enabled ? 1 : 0;
341
+ const VALID_USAGE_STRATEGIES = new Set([
342
+ "cost_saving",
343
+ "fast",
344
+ "balanced",
345
+ "high_reasoning"
346
+ ]);
347
+ 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;
348
+ const requestedWarmSummaryLimit = input.warm_summary_limit ?? existing?.warm_summary_limit ?? 50;
349
+ const warmSummaryLimit = Number.isFinite(requestedWarmSummaryLimit) ? Math.max(0, Math.floor(requestedWarmSummaryLimit)) : existing?.warm_summary_limit ?? 50;
350
+ db.prepare(`INSERT OR REPLACE INTO agent_configs
351
+ (id, name, icon, identity, instructions, tools, model_config_name, is_default,
352
+ history_limit, history_window_hours, warm_summary_limit, never_reply,
353
+ hot_turn_limit,
354
+ adaptive_persona_enabled, adaptive_persona_strength, adaptive_empathy, adaptive_expressiveness, adaptive_verbosity, adaptive_mbti,
355
+ voice_enabled, voice_model, voice_name, voice_stt_model, voice_auto_speak,
356
+ harness_id, delegate_targets, context_tier_proportions,
357
+ anti_hallucination_mode, anti_hallucination_model_config, citation_strictness,
358
+ tool_credentials, router_policy, router_enabled, usage_strategy,
359
+ created_at, updated_at)
360
+ 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"
361
+ // (important for PATCH-style updates that omit the field).
362
+ input.never_reply === undefined ? existing?.never_reply ?? 0 : input.never_reply ? 1 : 0, Math.max(0, Math.floor(input.hot_turn_limit ?? existing?.hot_turn_limit ?? 12)), input.adaptive_persona_enabled === undefined ? existing?.adaptive_persona_enabled ?? 0 : input.adaptive_persona_enabled ? 1 : 0, clampPercent(strength, existing?.adaptive_persona_strength ?? 50), clampPercent(empathy, existing?.adaptive_empathy ?? 50), clampPercent(expressiveness, existing?.adaptive_expressiveness ?? 50), clampPercent(verbosity, existing?.adaptive_verbosity ?? 50), mbti, input.voice_enabled === undefined ? existing?.voice_enabled ?? 0 : input.voice_enabled ? 1 : 0, (input.voice_model ?? existing?.voice_model ?? "gemini-2.5-flash-preview-tts").trim() || "gemini-2.5-flash-preview-tts", (input.voice_name ?? existing?.voice_name ?? "Kore").trim() || "Kore", (input.voice_stt_model ?? existing?.voice_stt_model ?? "gemini-2.5-flash").trim() || "gemini-2.5-flash", input.voice_auto_speak === undefined ? existing?.voice_auto_speak ?? 1 : input.voice_auto_speak ? 1 : 0, harnessId, delegateTargets, tierProportions, antiHallucMode, antiHallucModel, citationStrictness, toolCredentials, routerPolicy, routerEnabled, usageStrategy, created_at, t);
363
+ return getAgentConfig(input.id);
364
+ }
365
+ function clampPercent(next, fallback) {
366
+ const n = Number.isFinite(next) ? Number(next) : fallback;
367
+ return Math.max(0, Math.min(100, Math.round(n)));
368
+ }
369
+ function serialiseToolCredentials(input, existing) {
370
+ if (input === undefined) return existing;
371
+ const cleaned = {};
372
+ for (const [k, v] of Object.entries(input)){
373
+ if (typeof k === "string" && k.length > 0 && typeof v === "string" && v.length > 0) {
374
+ cleaned[k] = v;
375
+ }
265
376
  }
266
- // Before rendering (which initializes component tree modules), we have to
267
- // set the reference manifests to our global store so Server Action's
268
- // encryption util can access to them at the top level of the page module.
269
- if (serverActionsManifest && clientReferenceManifest) {
270
- (0,next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__.setManifestsSingleton)({
271
- page: srcPage,
272
- clientReferenceManifest,
273
- serverActionsManifest
274
- });
377
+ if (Object.keys(cleaned).length === 0) return null;
378
+ return JSON.stringify(cleaned);
379
+ }
380
+ function toMbti(v) {
381
+ if (!v) return null;
382
+ return v in _lib_agents_adaptive_persona_presets__WEBPACK_IMPORTED_MODULE_2__/* .MBTI_PRESETS */ .e ? v : null;
383
+ }
384
+ function deleteAgentConfig(id) {
385
+ return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("DELETE FROM agent_configs WHERE id=?").run(id).changes > 0;
386
+ }
387
+ function generateAgentId(name) {
388
+ const slug = name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
389
+ const suffix = Math.random().toString(36).slice(2, 6);
390
+ return slug ? `${slug}-${suffix}` : `agent-${suffix}`;
391
+ }
392
+ // ── ADR-0022: per-agent message-channel display filters ─────────────────
393
+ // Canonical channel keys mirrored in `hooks/useMessageFilters.ts`. Kept
394
+ // in sync there by importing this constant — single source of truth.
395
+ const DISPLAY_FILTER_KEYS = [
396
+ "scheduled_task",
397
+ "watcher",
398
+ "bridge",
399
+ "extension",
400
+ "page_capture",
401
+ "synthetic",
402
+ "tool_use",
403
+ "thinking"
404
+ ];
405
+ const DISPLAY_FILTER_DEFAULTS = {
406
+ scheduled_task: true,
407
+ watcher: true,
408
+ bridge: true,
409
+ extension: true,
410
+ page_capture: true,
411
+ synthetic: true,
412
+ tool_use: true,
413
+ thinking: true
414
+ };
415
+ function parseDisplayFilters(raw) {
416
+ if (!raw) return {
417
+ ...DISPLAY_FILTER_DEFAULTS
418
+ };
419
+ try {
420
+ const parsed = JSON.parse(raw);
421
+ // Merge over defaults so newly-added channels stay visible on old rows.
422
+ return {
423
+ ...DISPLAY_FILTER_DEFAULTS,
424
+ ...parsed
425
+ };
426
+ } catch {
427
+ return {
428
+ ...DISPLAY_FILTER_DEFAULTS
429
+ };
275
430
  }
276
- const method = req.method || 'GET';
277
- const tracer = (0,next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.getTracer)();
278
- const activeSpan = tracer.getActiveScopeSpan();
279
- const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);
280
- const isMinimalMode = Boolean((0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'minimalMode'));
281
- const incrementalCache = (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, previewProps, prerenderManifest, isMinimalMode);
282
- incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();
283
- globalThis.__incrementalCache = incrementalCache;
284
- const context = {
285
- params,
286
- previewProps,
287
- renderOpts: {
288
- experimental: {
289
- authInterrupts: Boolean(nextConfig.experimental.authInterrupts),
290
- useCacheTimeout: nextConfig.experimental.useCacheTimeout,
291
- durableUseCacheEntries: Boolean(nextConfig.experimental.durableUseCacheEntries)
292
- },
293
- cacheComponents: Boolean(nextConfig.cacheComponents),
294
- validationLevel: nextConfig.experimental.instantInsights.validationLevel,
295
- isDraftMode,
296
- incrementalCache,
297
- hmrRefreshHash: (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'hmrRefreshHash'),
298
- cacheLifeProfiles: nextConfig.cacheLife,
299
- staticPageGenerationTimeout: nextConfig.staticPageGenerationTimeout,
300
- waitUntil: ctx.waitUntil,
301
- onClose: (cb)=>{
302
- res.on('close', cb);
303
- },
304
- onAfterTaskError: undefined
305
- },
306
- sharedContext: {
307
- buildId,
308
- deploymentId
309
- }
431
+ }
432
+ function getAgentDisplayFilters(id) {
433
+ const row = getAgentConfig(id);
434
+ if (!row) return null;
435
+ return parseDisplayFilters(row.display_filters);
436
+ }
437
+ /**
438
+ * Merge a partial filter map into the agent's stored prefs. Pass `null` to
439
+ * reset to defaults (clears the column). Safe against concurrent toggles
440
+ * from multiple browser tabs because the merge happens server-side.
441
+ */ function updateAgentDisplayFilters(id, patch) {
442
+ const row = getAgentConfig(id);
443
+ if (!row) return null;
444
+ if (patch === null) {
445
+ (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("UPDATE agent_configs SET display_filters=NULL, updated_at=? WHERE id=?").run(now(), id);
446
+ return {
447
+ ...DISPLAY_FILTER_DEFAULTS
448
+ };
449
+ }
450
+ const current = parseDisplayFilters(row.display_filters);
451
+ const next = {
452
+ ...current
310
453
  };
311
- const nodeNextReq = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextRequest(req);
312
- const nodeNextRes = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextResponse(res);
313
- 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));
314
- const responseGenerator = async ({ previousCacheEntry })=>{
315
- try {
316
- if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {
317
- res.statusCode = 404;
318
- // on-demand revalidate always sets this header
319
- res.setHeader('x-nextjs-cache', 'REVALIDATED');
320
- res.end('This page could not be found');
321
- return null;
322
- }
323
- const response = cacheKey === null ? await routeModule.handle(nextReq, context) : await routeModule.prerender(nextReq, context);
324
- req.fetchMetrics = context.renderOpts.fetchMetrics;
325
- let pendingWaitUntil = context.renderOpts.pendingWaitUntil;
326
- // Attempt using provided waitUntil if available
327
- // if it's not we fallback to sendResponse's handling
328
- if (pendingWaitUntil) {
329
- if (ctx.waitUntil) {
330
- ctx.waitUntil(pendingWaitUntil);
331
- pendingWaitUntil = undefined;
332
- }
333
- }
334
- const cacheTags = context.renderOpts.collectedTags;
335
- // If the request is for a static response, we can cache it so long
336
- // as it's not edge.
337
- if (isIsr) {
338
- const blob = await response.blob();
339
- // Copy the headers from the response.
340
- const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.toNodeOutgoingHttpHeaders)(response.headers);
341
- if (cacheTags) {
342
- headers[next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER] = cacheTags;
343
- }
344
- if (!headers['content-type'] && blob.type) {
345
- headers['content-type'] = blob.type;
346
- }
347
- const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;
348
- 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
349
- // explicit `expire` (e.g. via `cacheLife`). This mirrors the
350
- // build-time fallback in `build/index.ts` so cache entries
351
- // and the response Cache-Control header agree on the route's
352
- // effective expire. Routes that opt out of revalidation
353
- // (`revalidate: false`) or that are dynamic (`revalidate: 0`)
354
- // keep `expire: undefined`.
355
- revalidate !== false && revalidate > 0 ? nextConfig.expireTime : undefined : context.renderOpts.collectedExpire;
356
- // Create the cache entry for the response.
357
- const cacheEntry = {
358
- value: {
359
- kind: next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__.CachedRouteKind.APP_ROUTE,
360
- status: response.status,
361
- body: Buffer.from(await blob.arrayBuffer()),
362
- headers
363
- },
364
- cacheControl: {
365
- revalidate,
366
- expire
367
- }
368
- };
369
- return cacheEntry;
370
- } else {
371
- // send response without caching if not ISR
372
- await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, response, pendingWaitUntil);
373
- return null;
374
- }
375
- } catch (err) {
376
- // if this is a background revalidate we need to report
377
- // the request error here as it won't be bubbled
378
- if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {
379
- const silenceLog = false;
380
- await routeModule.onRequestError(req, err, {
381
- routerKind: 'App Router',
382
- routePath: srcPage,
383
- routeType: 'route',
384
- revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
385
- isStaticGeneration: cacheKey !== null,
386
- isOnDemandRevalidate
387
- })
388
- }, silenceLog, routerServerContext);
389
- }
390
- throw err;
391
- }
392
- };
393
- const handleResponse = async (currentSpan, parentSpan)=>{
394
- try {
395
- var _cacheEntry_value;
396
- const cacheEntry = await routeModule.handleResponse({
397
- req,
398
- nextConfig,
399
- cacheKey,
400
- routeKind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
401
- isFallback: false,
402
- previewProps,
403
- prerenderManifest,
404
- isRoutePPREnabled: false,
405
- isOnDemandRevalidate,
406
- revalidateOnlyGenerated,
407
- responseGenerator,
408
- waitUntil: ctx.waitUntil,
409
- isMinimalMode
410
- });
411
- if (cacheEntry !== null && 'error' in cacheEntry) {
412
- throw cacheEntry.error;
413
- }
414
- // we don't create a cacheEntry for ISR
415
- if (!isIsr) {
416
- return;
417
- }
418
- 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) {
419
- var _cacheEntry_value1;
420
- throw new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`);
421
- }
422
- if (!isMinimalMode) {
423
- res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');
424
- }
425
- // Draft mode should never be cached
426
- if (isDraftMode) {
427
- res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');
428
- }
429
- const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers);
430
- if (!(isMinimalMode && isIsr)) {
431
- headers.delete(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER);
432
- }
433
- // If cache control is already set on the response we don't
434
- // override it to allow users to customize it via next.config
435
- if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {
436
- headers.set('Cache-Control', (0,next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__.getCacheControlHeader)(cacheEntry.cacheControl));
437
- }
438
- 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'.
439
- new Response(cacheEntry.value.body, {
440
- headers,
441
- status: cacheEntry.value.status || 200
442
- }));
443
- return;
444
- } catch (err) {
445
- if (!(err instanceof next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError)) {
446
- const silenceLog = false;
447
- await routeModule.onRequestError(req, err, {
448
- routerKind: 'App Router',
449
- routePath: normalizedSrcPage,
450
- routeType: 'route',
451
- revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
452
- isStaticGeneration: cacheKey !== null,
453
- isOnDemandRevalidate
454
- })
455
- }, silenceLog, routerServerContext);
456
- }
457
- // rethrow so that we can handle serving error page
458
- // If this is during static generation, throw the error again.
459
- if (isIsr) throw err;
460
- // Otherwise, send a 500 response unless the original response has
461
- // already committed. In that case, preserve its status code for
462
- // telemetry while still recording the failure and terminating a response
463
- // that the failed pipeline left open.
464
- if (res.headersSent) {
465
- if (currentSpan) {
466
- const error = err instanceof Error ? err : new Error('Unknown app route error');
467
- currentSpan.recordException(error);
468
- currentSpan.setStatus({
469
- code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR,
470
- message: error.message
471
- });
472
- currentSpan.setAttribute('error.type', error.name);
473
- }
474
- if (!res.writableEnded && !res.destroyed) {
475
- res.end();
476
- }
477
- } else {
478
- await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, new Response(null, {
479
- status: 500
480
- }));
481
- }
482
- return;
483
- } finally{
484
- ;
485
- (()=>{
486
- if (!currentSpan) {
487
- return;
488
- }
489
- let statusCode = res.statusCode;
490
- currentSpan.setAttributes({
491
- 'http.status_code': statusCode,
492
- 'next.rsc': false
493
- });
494
- if (statusCode && statusCode >= 500) {
495
- // For 5xx status codes: SHOULD be set to 'Error' span status.
496
- // x-ref: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
497
- currentSpan.setStatus({
498
- code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR
499
- });
500
- // For span status 'Error', SHOULD set 'error.type' attribute.
501
- currentSpan.setAttribute('error.type', statusCode.toString());
502
- }
503
- const rootSpanAttributes = tracer.getRootSpanAttributes();
504
- // We were unable to get attributes, probably OTEL is not enabled
505
- if (!rootSpanAttributes) {
506
- return;
507
- }
508
- if (rootSpanAttributes.get('next.span_type') !== next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest) {
509
- console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);
510
- return;
511
- }
512
- const route = rootSpanAttributes.get('next.route') || normalizedSrcPage;
513
- const name = `${method} ${route}`;
514
- currentSpan.setAttributes({
515
- 'next.route': route,
516
- 'http.route': route,
517
- 'next.span_name': name
518
- });
519
- currentSpan.updateName(name);
520
- // Propagate http.route to the parent span if one exists (e.g.
521
- // a platform-created HTTP span in adapter deployments).
522
- if (parentSpan && parentSpan !== currentSpan) {
523
- parentSpan.setAttribute('http.route', route);
524
- parentSpan.updateName(name);
525
- }
526
- })();
527
- }
528
- };
529
- // TODO: activeSpan code path is for when wrapped by
530
- // next-server can be removed when this is no longer used
531
- if (isWrappedByNextServer && activeSpan) {
532
- await handleResponse(activeSpan, undefined);
533
- } else {
534
- let parentSpan = tracer.getActiveScopeSpan();
535
- await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest, {
536
- spanName: `${method} ${srcPage}`,
537
- kind: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanKind.SERVER,
538
- attributes: {
539
- 'http.method': method,
540
- 'http.target': req.url
541
- }
542
- }, (span)=>handleResponse(span, parentSpan)), undefined, !isWrappedByNextServer);
454
+ for (const k of DISPLAY_FILTER_KEYS){
455
+ if (k in patch && typeof patch[k] === "boolean") next[k] = patch[k];
543
456
  }
457
+ (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);
458
+ return next;
544
459
  }
545
460
 
546
- //# sourceMappingURL=app-route.js.map
547
-
548
461
 
549
462
  /***/ }),
550
463
 
551
- /***/ 27910:
552
- /***/ ((module) => {
553
-
554
- module.exports = require("stream");
555
-
556
- /***/ }),
557
-
558
- /***/ 28354:
464
+ /***/ 44708:
559
465
  /***/ ((module) => {
560
466
 
561
- module.exports = require("util");
467
+ module.exports = require("node:https");
562
468
 
563
469
  /***/ }),
564
470
 
565
- /***/ 29021:
471
+ /***/ 44870:
566
472
  /***/ ((module) => {
567
473
 
568
- module.exports = require("fs");
474
+ module.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js");
569
475
 
570
476
  /***/ }),
571
477
 
572
- /***/ 29294:
478
+ /***/ 48161:
573
479
  /***/ ((module) => {
574
480
 
575
- module.exports = require("next/dist/server/app-render/work-async-storage.external.js");
481
+ module.exports = require("node:os");
576
482
 
577
483
  /***/ }),
578
484
 
579
- /***/ 31421:
485
+ /***/ 51455:
580
486
  /***/ ((module) => {
581
487
 
582
- module.exports = require("node:child_process");
488
+ module.exports = require("node:fs/promises");
583
489
 
584
490
  /***/ }),
585
491
 
586
- /***/ 33873:
492
+ /***/ 55511:
587
493
  /***/ ((module) => {
588
494
 
589
- module.exports = require("path");
495
+ module.exports = require("crypto");
590
496
 
591
497
  /***/ }),
592
498
 
593
- /***/ 37067:
499
+ /***/ 55591:
594
500
  /***/ ((module) => {
595
501
 
596
- module.exports = require("node:http");
502
+ module.exports = require("https");
597
503
 
598
504
  /***/ }),
599
505
 
600
- /***/ 38522:
506
+ /***/ 57075:
601
507
  /***/ ((module) => {
602
508
 
603
- module.exports = require("node:zlib");
509
+ module.exports = require("node:stream");
604
510
 
605
511
  /***/ }),
606
512
 
607
- /***/ 41720:
513
+ /***/ 57901:
608
514
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
609
515
 
516
+ __webpack_require__.r(__webpack_exports__);
610
517
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
611
- /* harmony export */ BM: () => (/* binding */ upsertAgentConfig),
612
- /* harmony export */ E1: () => (/* binding */ updateAgentDisplayFilters),
613
- /* harmony export */ P2: () => (/* binding */ parseCitationStrictness),
614
- /* harmony export */ S2: () => (/* binding */ getAgentToolCredentials),
615
- /* harmony export */ SJ: () => (/* binding */ generateAgentId),
616
- /* harmony export */ TG: () => (/* binding */ getAgentTools),
617
- /* harmony export */ bg: () => (/* binding */ parseDelegateTargets),
618
- /* harmony export */ d2: () => (/* binding */ DISPLAY_FILTER_KEYS),
619
- /* harmony export */ fg: () => (/* binding */ getAgentTierProportions),
620
- /* harmony export */ mJ: () => (/* binding */ getAgentConfig),
621
- /* harmony export */ nV: () => (/* binding */ getAgentDisplayFilters),
622
- /* harmony export */ vU: () => (/* binding */ getDefaultAgentConfig),
623
- /* harmony export */ vi: () => (/* binding */ DISPLAY_FILTER_DEFAULTS),
624
- /* harmony export */ xi: () => (/* binding */ deleteAgentConfig),
625
- /* harmony export */ zb: () => (/* binding */ listAgentConfigs)
518
+ /* harmony export */ handler: () => (/* binding */ handler),
519
+ /* harmony export */ patchFetch: () => (/* binding */ patchFetch),
520
+ /* harmony export */ routeModule: () => (/* binding */ routeModule),
521
+ /* harmony export */ serverHooks: () => (/* binding */ serverHooks),
522
+ /* harmony export */ workAsyncStorage: () => (/* binding */ workAsyncStorage),
523
+ /* harmony export */ workUnitAsyncStorage: () => (/* binding */ workUnitAsyncStorage)
626
524
  /* harmony export */ });
627
- /* harmony import */ var _lib_db__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(46);
628
- /* harmony import */ var _lib_db_transaction__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(99043);
629
- /* harmony import */ var _lib_agents_adaptive_persona_presets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(66849);
525
+ /* harmony import */ var next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(19225);
526
+ /* 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__);
527
+ /* harmony import */ var next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84006);
528
+ /* harmony import */ var next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8317);
529
+ /* 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__);
530
+ /* harmony import */ var next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(99373);
531
+ /* 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__);
532
+ /* harmony import */ var next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(34775);
533
+ /* 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__);
534
+ /* harmony import */ var next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(24235);
535
+ /* 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__);
536
+ /* harmony import */ var next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(261);
537
+ /* 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__);
538
+ /* harmony import */ var next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(54365);
539
+ /* 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__);
540
+ /* harmony import */ var next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(90771);
541
+ /* 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__);
542
+ /* harmony import */ var next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(73461);
543
+ /* 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__);
544
+ /* harmony import */ var next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(67798);
545
+ /* harmony import */ var next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(92280);
546
+ /* harmony import */ var next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(62018);
547
+ /* 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__);
548
+ /* harmony import */ var next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(45696);
549
+ /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(47929);
550
+ /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__);
551
+ /* harmony import */ var next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(86439);
552
+ /* 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__);
553
+ /* harmony import */ var next_dist_server_lib_route_cache_key__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(10246);
554
+ /* 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__);
555
+ /* harmony import */ var next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(37527);
556
+ /* 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__);
630
557
 
631
558
 
632
559
 
633
- const now = ()=>new Date().toISOString();
634
- /** Coerce arbitrary input (DB row TEXT, API body, undefined) to the enum.
635
- * Returns `null` for null/undefined/unknown values so callers can default. */ function parseCitationStrictness(value) {
636
- if (value === "off" || value === "informational" || value === "standard" || value === "strict") {
637
- return value;
638
- }
639
- return null;
640
- }
641
- /**
642
- * Parse the JSON-encoded per-agent override of context tier proportions.
643
- * Returns `null` for NULL, blank, malformed JSON, or any payload that
644
- * doesn't have three finite non-negative numeric fields. Callers fall
645
- * back to the model config's value (or built-in defaults) on null.
646
- */ function getAgentTierProportions(row) {
647
- const raw = row.context_tier_proportions;
648
- if (!raw) return null;
649
- try {
650
- const parsed = JSON.parse(raw);
651
- const hot = Number(parsed.hot);
652
- const warm = Number(parsed.warm);
653
- const facts = Number(parsed.facts);
654
- if (![
655
- hot,
656
- warm,
657
- facts
658
- ].every((n)=>Number.isFinite(n) && n >= 0)) return null;
659
- if (hot + warm + facts <= 0) return null;
660
- return {
661
- hot,
662
- warm,
663
- facts
664
- };
665
- } catch {
666
- return null;
667
- }
668
- }
669
- function listAgentConfigs() {
670
- // Default agent always first; then by the timestamp of each agent's latest message.
671
- return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare(`SELECT a.*
672
- FROM agent_configs a
673
- LEFT JOIN (
674
- SELECT t.agent_id, MAX(m.created_at) AS last_message_at
675
- FROM threads t
676
- JOIN messages m ON m.thread_id = t.thread_id
677
- GROUP BY t.agent_id
678
- ) latest ON latest.agent_id = a.id
679
- ORDER BY a.is_default DESC, COALESCE(latest.last_message_at, a.created_at) DESC, a.id ASC`).all();
680
- }
681
- function getDefaultAgentConfig() {
682
- return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("SELECT * FROM agent_configs WHERE is_default=1 LIMIT 1").get() ?? null;
683
- }
684
- function getAgentConfig(id) {
685
- return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("SELECT * FROM agent_configs WHERE id=?").get(id) ?? null;
560
+
561
+
562
+
563
+
564
+
565
+
566
+
567
+
568
+
569
+
570
+
571
+
572
+
573
+
574
+
575
+ // We inject the nextConfigOutput here so that we can use them in the route
576
+ // module.
577
+ const nextConfigOutput = "standalone"
578
+ const routeModule = new next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__.AppRouteRouteModule({
579
+ definition: {
580
+ kind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
581
+ page: "/api/v1/agents/[id]/thread/route",
582
+ pathname: "/api/v1/agents/[id]/thread",
583
+ filename: "route",
584
+ bundlePath: "app/api/v1/agents/[id]/thread/route"
585
+ },
586
+ distDir: ".next" || 0,
587
+ relativeProjectDir: false || '',
588
+ resolvedPagePath: "/home/runner/work/jarela/jarela/app/api/v1/agents/[id]/thread/route.ts",
589
+ nextConfigOutput,
590
+ // The lazy require factory ensures that:
591
+ // - In dev: devRequestTimingInternalsEnd is set before userland executes,
592
+ // correctly attributing module load time to application-code rather than
593
+ // framework internals.
594
+ // - In all modes: async modules (route files with top-level await) are
595
+ // handled correctly — require() returns a Promise for such modules, which
596
+ // ensureUserland() awaits before the first request is handled.
597
+ userland: ()=>__webpack_require__(14622),
598
+ // In Turbopack dev mode, also provide a synchronous per-request getter so
599
+ // server HMR updates are picked up without re-executing the entry chunk.
600
+ // Using require() (synchronous) avoids adding async overhead that would be
601
+ // incorrectly attributed to application-code time in devRequestTiming.
602
+ ... false ? 0 : {}
603
+ });
604
+ // Pull out the exports that we need to expose from the module. This should
605
+ // be eliminated when we've moved the other routes to the new format. These
606
+ // are used to hook into the route.
607
+ const { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;
608
+ function patchFetch() {
609
+ return (0,next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__.patchFetch)({
610
+ workAsyncStorage,
611
+ workUnitAsyncStorage
612
+ });
686
613
  }
687
- /**
688
- * Parse the JSON-encoded delegate whitelist into a deduped string[]. Returns
689
- * an empty array for NULL, blank, or malformed JSON (delegation is opt-in).
690
- */ /**
691
- * Parse the agent's tool allowlist (`tools` column, stored as a JSON string).
692
- * Returns an empty array on NULL/blank/malformed JSON — same defensive shape
693
- * as parseDelegateTargets. Callers that previously did `JSON.parse(cfg.tools)`
694
- * inline should switch to this getter so the serialization contract stays
695
- * owned by this store.
696
- */ function getAgentTools(cfg) {
697
- if (!cfg?.tools) return [];
698
- try {
699
- const parsed = JSON.parse(cfg.tools);
700
- if (!Array.isArray(parsed)) return [];
701
- return parsed.filter((x)=>typeof x === "string" && x.length > 0);
702
- } catch {
703
- return [];
614
+
615
+ async function handler(req, res, ctx) {
616
+ if (ctx.requestMeta) {
617
+ (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.setRequestMeta)(req, ctx.requestMeta);
704
618
  }
705
- }
706
- function parseDelegateTargets(raw) {
707
- if (!raw) return [];
708
- try {
709
- const parsed = JSON.parse(raw);
710
- if (!Array.isArray(parsed)) return [];
711
- const ids = parsed.filter((x)=>typeof x === "string" && x.length > 0);
712
- return Array.from(new Set(ids));
713
- } catch {
714
- return [];
619
+ if (routeModule.isDev) {
620
+ (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.addRequestMeta)(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());
715
621
  }
716
- }
717
- /**
718
- * Parse the per-agent `{ toolName: credentialId }` override map stored in
719
- * the `tool_credentials` column. Returns an empty record on NULL / blank /
720
- * malformed JSON / non-string entries so downstream code can treat the
721
- * result as a plain lookup without further validation.
722
- */ function getAgentToolCredentials(cfg) {
723
- if (!cfg?.tool_credentials) return {};
724
- try {
725
- const parsed = JSON.parse(cfg.tool_credentials);
726
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
727
- const out = {};
728
- for (const [k, v] of Object.entries(parsed)){
729
- if (typeof v === "string" && v.length > 0) out[k] = v;
730
- }
731
- return out;
732
- } catch {
733
- return {};
622
+ let srcPage = "/api/v1/agents/[id]/thread/route";
623
+ // turbopack doesn't normalize `/index` in the page name
624
+ // so we need to to process dynamic routes properly
625
+ // TODO: fix turbopack providing differing value from webpack
626
+ if (false) {} else if (srcPage === '/index') {
627
+ // we always normalize /index specifically
628
+ srcPage = '/';
734
629
  }
735
- }
736
- function upsertAgentConfig(input) {
737
- return (0,_lib_db_transaction__WEBPACK_IMPORTED_MODULE_1__/* .withDbTransaction */ .J)(()=>upsertAgentConfigTransaction(input));
738
- }
739
- function upsertAgentConfigTransaction(input) {
740
- const t = now();
741
- const db = (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)();
742
- const existing = getAgentConfig(input.id);
743
- const created_at = existing?.created_at ?? t;
744
- const mbti = input.adaptive_mbti ?? toMbti(existing?.adaptive_mbti) ?? "INTJ";
745
- const preset = _lib_agents_adaptive_persona_presets__WEBPACK_IMPORTED_MODULE_2__/* .MBTI_PRESETS */ .e[mbti];
746
- const strength = input.adaptive_persona_strength ?? preset.strength;
747
- const empathy = input.adaptive_empathy ?? preset.empathy;
748
- const expressiveness = input.adaptive_expressiveness ?? preset.expressiveness;
749
- const verbosity = input.adaptive_verbosity ?? preset.verbosity;
750
- if (input.is_default) db.prepare("UPDATE agent_configs SET is_default=0").run();
751
- // harness_id: explicit `undefined` means "keep existing"; explicit `null`
752
- // means "use the global default". Empty string is normalised to null too,
753
- // matching how the AgentEditor sends "" for the inherit option.
754
- const harnessId = input.harness_id === undefined ? existing?.harness_id ?? null : input.harness_id && input.harness_id.length > 0 ? input.harness_id : null;
755
- // delegate_targets: undefined = keep existing; explicit empty array clears.
756
- 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))));
757
- // context_tier_proportions: undefined = keep existing; null = clear and
758
- // inherit from the model; object = serialise as JSON. Negative values are
759
- // clamped to 0 so the upsert can't poison the column with bad data.
760
- const tierProportions = input.context_tier_proportions === undefined ? existing?.context_tier_proportions ?? null : input.context_tier_proportions === null ? null : JSON.stringify({
761
- hot: Math.max(0, Number(input.context_tier_proportions.hot) || 0),
762
- warm: Math.max(0, Number(input.context_tier_proportions.warm) || 0),
763
- facts: Math.max(0, Number(input.context_tier_proportions.facts) || 0)
630
+ const multiZoneDraftMode = false;
631
+ const prepareResult = await routeModule.prepare(req, res, {
632
+ srcPage,
633
+ multiZoneDraftMode
764
634
  });
765
- // Anti-hallucination override: `undefined` keeps existing; `null` clears
766
- // the override (inherits env). Empty-string model is normalised to null
767
- // so the editor can ship "" for the inherit option.
768
- 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;
769
- 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;
770
- const citationStrictness = input.citation_strictness === undefined ? parseCitationStrictness(existing?.citation_strictness) ?? "off" : parseCitationStrictness(input.citation_strictness) ?? "off";
771
- const toolCredentials = serialiseToolCredentials(input.tool_credentials, existing?.tool_credentials ?? null);
772
- const VALID_ROUTER_POLICIES = new Set([
773
- "cheap",
774
- "fast",
775
- "balanced",
776
- "quality"
777
- ]);
778
- 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;
779
- const routerEnabled = input.router_enabled === undefined ? existing?.router_enabled ?? null : input.router_enabled === null ? null : input.router_enabled ? 1 : 0;
780
- const VALID_USAGE_STRATEGIES = new Set([
781
- "cost_saving",
782
- "fast",
783
- "balanced",
784
- "high_reasoning"
785
- ]);
786
- 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;
787
- const requestedWarmSummaryLimit = input.warm_summary_limit ?? existing?.warm_summary_limit ?? 50;
788
- const warmSummaryLimit = Number.isFinite(requestedWarmSummaryLimit) ? Math.max(0, Math.floor(requestedWarmSummaryLimit)) : existing?.warm_summary_limit ?? 50;
789
- db.prepare(`INSERT OR REPLACE INTO agent_configs
790
- (id, name, icon, identity, instructions, tools, model_config_name, is_default,
791
- history_limit, history_window_hours, warm_summary_limit, never_reply,
792
- hot_turn_limit,
793
- adaptive_persona_enabled, adaptive_persona_strength, adaptive_empathy, adaptive_expressiveness, adaptive_verbosity, adaptive_mbti,
794
- voice_enabled, voice_model, voice_name, voice_stt_model, voice_auto_speak,
795
- harness_id, delegate_targets, context_tier_proportions,
796
- anti_hallucination_mode, anti_hallucination_model_config, citation_strictness,
797
- tool_credentials, router_policy, router_enabled, usage_strategy,
798
- created_at, updated_at)
799
- 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"
800
- // (important for PATCH-style updates that omit the field).
801
- input.never_reply === undefined ? existing?.never_reply ?? 0 : input.never_reply ? 1 : 0, Math.max(0, Math.floor(input.hot_turn_limit ?? existing?.hot_turn_limit ?? 12)), input.adaptive_persona_enabled === undefined ? existing?.adaptive_persona_enabled ?? 0 : input.adaptive_persona_enabled ? 1 : 0, clampPercent(strength, existing?.adaptive_persona_strength ?? 50), clampPercent(empathy, existing?.adaptive_empathy ?? 50), clampPercent(expressiveness, existing?.adaptive_expressiveness ?? 50), clampPercent(verbosity, existing?.adaptive_verbosity ?? 50), mbti, input.voice_enabled === undefined ? existing?.voice_enabled ?? 0 : input.voice_enabled ? 1 : 0, (input.voice_model ?? existing?.voice_model ?? "gemini-2.5-flash-preview-tts").trim() || "gemini-2.5-flash-preview-tts", (input.voice_name ?? existing?.voice_name ?? "Kore").trim() || "Kore", (input.voice_stt_model ?? existing?.voice_stt_model ?? "gemini-2.5-flash").trim() || "gemini-2.5-flash", input.voice_auto_speak === undefined ? existing?.voice_auto_speak ?? 1 : input.voice_auto_speak ? 1 : 0, harnessId, delegateTargets, tierProportions, antiHallucMode, antiHallucModel, citationStrictness, toolCredentials, routerPolicy, routerEnabled, usageStrategy, created_at, t);
802
- return getAgentConfig(input.id);
803
- }
804
- function clampPercent(next, fallback) {
805
- const n = Number.isFinite(next) ? Number(next) : fallback;
806
- return Math.max(0, Math.min(100, Math.round(n)));
807
- }
808
- function serialiseToolCredentials(input, existing) {
809
- if (input === undefined) return existing;
810
- const cleaned = {};
811
- for (const [k, v] of Object.entries(input)){
812
- if (typeof k === "string" && k.length > 0 && typeof v === "string" && v.length > 0) {
813
- cleaned[k] = v;
635
+ if (!prepareResult) {
636
+ res.statusCode = 400;
637
+ res.end('Bad Request');
638
+ ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());
639
+ return null;
640
+ }
641
+ const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest, previewProps } = prepareResult;
642
+ const normalizedSrcPage = (0,next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__.normalizeAppPath)(srcPage);
643
+ // Only this route's prerenders can establish ISR or admit generated params.
644
+ 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]));
645
+ let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || isPrerendered);
646
+ const render404 = async ()=>{
647
+ // TODO: should route-module itself handle rendering the 404
648
+ if (routerServerContext == null ? void 0 : routerServerContext.render404) {
649
+ await routerServerContext.render404(req, res, parsedUrl, false);
650
+ } else {
651
+ res.end('This page could not be found');
652
+ }
653
+ return null;
654
+ };
655
+ if (isIsr && !isDraftMode) {
656
+ const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];
657
+ if (prerenderInfo) {
658
+ if (prerenderInfo.fallback === false && !isPrerendered) {
659
+ if (nextConfig.adapterPath) {
660
+ return await render404();
661
+ }
662
+ throw new next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError();
663
+ }
814
664
  }
815
665
  }
816
- if (Object.keys(cleaned).length === 0) return null;
817
- return JSON.stringify(cleaned);
818
- }
819
- function toMbti(v) {
820
- if (!v) return null;
821
- return v in _lib_agents_adaptive_persona_presets__WEBPACK_IMPORTED_MODULE_2__/* .MBTI_PRESETS */ .e ? v : null;
822
- }
823
- function deleteAgentConfig(id) {
824
- return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("DELETE FROM agent_configs WHERE id=?").run(id).changes > 0;
825
- }
826
- function generateAgentId(name) {
827
- const slug = name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
828
- const suffix = Math.random().toString(36).slice(2, 6);
829
- return slug ? `${slug}-${suffix}` : `agent-${suffix}`;
830
- }
831
- // ── ADR-0022: per-agent message-channel display filters ─────────────────
832
- // Canonical channel keys mirrored in `hooks/useMessageFilters.ts`. Kept
833
- // in sync there by importing this constant — single source of truth.
834
- const DISPLAY_FILTER_KEYS = [
835
- "scheduled_task",
836
- "watcher",
837
- "bridge",
838
- "extension",
839
- "page_capture",
840
- "synthetic",
841
- "tool_use",
842
- "thinking"
843
- ];
844
- const DISPLAY_FILTER_DEFAULTS = {
845
- scheduled_task: true,
846
- watcher: true,
847
- bridge: true,
848
- extension: true,
849
- page_capture: true,
850
- synthetic: true,
851
- tool_use: true,
852
- thinking: true
853
- };
854
- function parseDisplayFilters(raw) {
855
- if (!raw) return {
856
- ...DISPLAY_FILTER_DEFAULTS
666
+ let cacheKey = null;
667
+ if (isIsr && !routeModule.isDev && !isDraftMode) {
668
+ cacheKey = resolvedPathname;
669
+ // ensure /index and / is normalized to one key
670
+ cacheKey = cacheKey === '/index' ? '/' : cacheKey;
671
+ }
672
+ // Before rendering (which initializes component tree modules), we have to
673
+ // set the reference manifests to our global store so Server Action's
674
+ // encryption util can access to them at the top level of the page module.
675
+ if (serverActionsManifest && clientReferenceManifest) {
676
+ (0,next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__.setManifestsSingleton)({
677
+ page: srcPage,
678
+ clientReferenceManifest,
679
+ serverActionsManifest
680
+ });
681
+ }
682
+ const method = req.method || 'GET';
683
+ const tracer = (0,next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.getTracer)();
684
+ const activeSpan = tracer.getActiveScopeSpan();
685
+ const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);
686
+ const isMinimalMode = Boolean((0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'minimalMode'));
687
+ const incrementalCache = (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, previewProps, prerenderManifest, isMinimalMode);
688
+ incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();
689
+ globalThis.__incrementalCache = incrementalCache;
690
+ const context = {
691
+ params,
692
+ previewProps,
693
+ renderOpts: {
694
+ experimental: {
695
+ authInterrupts: Boolean(nextConfig.experimental.authInterrupts),
696
+ useCacheTimeout: nextConfig.experimental.useCacheTimeout,
697
+ durableUseCacheEntries: Boolean(nextConfig.experimental.durableUseCacheEntries)
698
+ },
699
+ cacheComponents: Boolean(nextConfig.cacheComponents),
700
+ validationLevel: nextConfig.experimental.instantInsights.validationLevel,
701
+ isDraftMode,
702
+ incrementalCache,
703
+ hmrRefreshHash: (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'hmrRefreshHash'),
704
+ cacheLifeProfiles: nextConfig.cacheLife,
705
+ staticPageGenerationTimeout: nextConfig.staticPageGenerationTimeout,
706
+ waitUntil: ctx.waitUntil,
707
+ onClose: (cb)=>{
708
+ res.on('close', cb);
709
+ },
710
+ onAfterTaskError: undefined
711
+ },
712
+ sharedContext: {
713
+ buildId,
714
+ deploymentId
715
+ }
716
+ };
717
+ const nodeNextReq = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextRequest(req);
718
+ const nodeNextRes = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextResponse(res);
719
+ 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));
720
+ const responseGenerator = async ({ previousCacheEntry })=>{
721
+ try {
722
+ if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {
723
+ res.statusCode = 404;
724
+ // on-demand revalidate always sets this header
725
+ res.setHeader('x-nextjs-cache', 'REVALIDATED');
726
+ res.end('This page could not be found');
727
+ return null;
728
+ }
729
+ const response = cacheKey === null ? await routeModule.handle(nextReq, context) : await routeModule.prerender(nextReq, context);
730
+ req.fetchMetrics = context.renderOpts.fetchMetrics;
731
+ let pendingWaitUntil = context.renderOpts.pendingWaitUntil;
732
+ // Attempt using provided waitUntil if available
733
+ // if it's not we fallback to sendResponse's handling
734
+ if (pendingWaitUntil) {
735
+ if (ctx.waitUntil) {
736
+ ctx.waitUntil(pendingWaitUntil);
737
+ pendingWaitUntil = undefined;
738
+ }
739
+ }
740
+ const cacheTags = context.renderOpts.collectedTags;
741
+ // If the request is for a static response, we can cache it so long
742
+ // as it's not edge.
743
+ if (isIsr) {
744
+ const blob = await response.blob();
745
+ // Copy the headers from the response.
746
+ const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.toNodeOutgoingHttpHeaders)(response.headers);
747
+ if (cacheTags) {
748
+ headers[next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER] = cacheTags;
749
+ }
750
+ if (!headers['content-type'] && blob.type) {
751
+ headers['content-type'] = blob.type;
752
+ }
753
+ const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;
754
+ 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
755
+ // explicit `expire` (e.g. via `cacheLife`). This mirrors the
756
+ // build-time fallback in `build/index.ts` so cache entries
757
+ // and the response Cache-Control header agree on the route's
758
+ // effective expire. Routes that opt out of revalidation
759
+ // (`revalidate: false`) or that are dynamic (`revalidate: 0`)
760
+ // keep `expire: undefined`.
761
+ revalidate !== false && revalidate > 0 ? nextConfig.expireTime : undefined : context.renderOpts.collectedExpire;
762
+ // Create the cache entry for the response.
763
+ const cacheEntry = {
764
+ value: {
765
+ kind: next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__.CachedRouteKind.APP_ROUTE,
766
+ status: response.status,
767
+ body: Buffer.from(await blob.arrayBuffer()),
768
+ headers
769
+ },
770
+ cacheControl: {
771
+ revalidate,
772
+ expire
773
+ }
774
+ };
775
+ return cacheEntry;
776
+ } else {
777
+ // send response without caching if not ISR
778
+ await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, response, pendingWaitUntil);
779
+ return null;
780
+ }
781
+ } catch (err) {
782
+ // if this is a background revalidate we need to report
783
+ // the request error here as it won't be bubbled
784
+ if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {
785
+ const silenceLog = false;
786
+ await routeModule.onRequestError(req, err, {
787
+ routerKind: 'App Router',
788
+ routePath: srcPage,
789
+ routeType: 'route',
790
+ revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
791
+ isStaticGeneration: cacheKey !== null,
792
+ isOnDemandRevalidate
793
+ })
794
+ }, silenceLog, routerServerContext);
795
+ }
796
+ throw err;
797
+ }
857
798
  };
858
- try {
859
- const parsed = JSON.parse(raw);
860
- // Merge over defaults so newly-added channels stay visible on old rows.
861
- return {
862
- ...DISPLAY_FILTER_DEFAULTS,
863
- ...parsed
864
- };
865
- } catch {
866
- return {
867
- ...DISPLAY_FILTER_DEFAULTS
868
- };
869
- }
870
- }
871
- function getAgentDisplayFilters(id) {
872
- const row = getAgentConfig(id);
873
- if (!row) return null;
874
- return parseDisplayFilters(row.display_filters);
875
- }
876
- /**
877
- * Merge a partial filter map into the agent's stored prefs. Pass `null` to
878
- * reset to defaults (clears the column). Safe against concurrent toggles
879
- * from multiple browser tabs because the merge happens server-side.
880
- */ function updateAgentDisplayFilters(id, patch) {
881
- const row = getAgentConfig(id);
882
- if (!row) return null;
883
- if (patch === null) {
884
- (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("UPDATE agent_configs SET display_filters=NULL, updated_at=? WHERE id=?").run(now(), id);
885
- return {
886
- ...DISPLAY_FILTER_DEFAULTS
887
- };
888
- }
889
- const current = parseDisplayFilters(row.display_filters);
890
- const next = {
891
- ...current
799
+ const handleResponse = async (currentSpan, parentSpan)=>{
800
+ try {
801
+ var _cacheEntry_value;
802
+ const cacheEntry = await routeModule.handleResponse({
803
+ req,
804
+ nextConfig,
805
+ cacheKey,
806
+ routeKind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
807
+ isFallback: false,
808
+ previewProps,
809
+ prerenderManifest,
810
+ isRoutePPREnabled: false,
811
+ isOnDemandRevalidate,
812
+ revalidateOnlyGenerated,
813
+ responseGenerator,
814
+ waitUntil: ctx.waitUntil,
815
+ isMinimalMode
816
+ });
817
+ if (cacheEntry !== null && 'error' in cacheEntry) {
818
+ throw cacheEntry.error;
819
+ }
820
+ // we don't create a cacheEntry for ISR
821
+ if (!isIsr) {
822
+ return;
823
+ }
824
+ 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) {
825
+ var _cacheEntry_value1;
826
+ throw new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`);
827
+ }
828
+ if (!isMinimalMode) {
829
+ res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');
830
+ }
831
+ // Draft mode should never be cached
832
+ if (isDraftMode) {
833
+ res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');
834
+ }
835
+ const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers);
836
+ if (!(isMinimalMode && isIsr)) {
837
+ headers.delete(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER);
838
+ }
839
+ // If cache control is already set on the response we don't
840
+ // override it to allow users to customize it via next.config
841
+ if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {
842
+ headers.set('Cache-Control', (0,next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__.getCacheControlHeader)(cacheEntry.cacheControl));
843
+ }
844
+ 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'.
845
+ new Response(cacheEntry.value.body, {
846
+ headers,
847
+ status: cacheEntry.value.status || 200
848
+ }));
849
+ return;
850
+ } catch (err) {
851
+ if (!(err instanceof next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError)) {
852
+ const silenceLog = false;
853
+ await routeModule.onRequestError(req, err, {
854
+ routerKind: 'App Router',
855
+ routePath: normalizedSrcPage,
856
+ routeType: 'route',
857
+ revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
858
+ isStaticGeneration: cacheKey !== null,
859
+ isOnDemandRevalidate
860
+ })
861
+ }, silenceLog, routerServerContext);
862
+ }
863
+ // rethrow so that we can handle serving error page
864
+ // If this is during static generation, throw the error again.
865
+ if (isIsr) throw err;
866
+ // Otherwise, send a 500 response unless the original response has
867
+ // already committed. In that case, preserve its status code for
868
+ // telemetry while still recording the failure and terminating a response
869
+ // that the failed pipeline left open.
870
+ if (res.headersSent) {
871
+ if (currentSpan) {
872
+ const error = err instanceof Error ? err : new Error('Unknown app route error');
873
+ currentSpan.recordException(error);
874
+ currentSpan.setStatus({
875
+ code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR,
876
+ message: error.message
877
+ });
878
+ currentSpan.setAttribute('error.type', error.name);
879
+ }
880
+ if (!res.writableEnded && !res.destroyed) {
881
+ res.end();
882
+ }
883
+ } else {
884
+ await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, new Response(null, {
885
+ status: 500
886
+ }));
887
+ }
888
+ return;
889
+ } finally{
890
+ ;
891
+ (()=>{
892
+ if (!currentSpan) {
893
+ return;
894
+ }
895
+ let statusCode = res.statusCode;
896
+ currentSpan.setAttributes({
897
+ 'http.status_code': statusCode,
898
+ 'next.rsc': false
899
+ });
900
+ if (statusCode && statusCode >= 500) {
901
+ // For 5xx status codes: SHOULD be set to 'Error' span status.
902
+ // x-ref: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
903
+ currentSpan.setStatus({
904
+ code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR
905
+ });
906
+ // For span status 'Error', SHOULD set 'error.type' attribute.
907
+ currentSpan.setAttribute('error.type', statusCode.toString());
908
+ }
909
+ const rootSpanAttributes = tracer.getRootSpanAttributes();
910
+ // We were unable to get attributes, probably OTEL is not enabled
911
+ if (!rootSpanAttributes) {
912
+ return;
913
+ }
914
+ if (rootSpanAttributes.get('next.span_type') !== next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest) {
915
+ console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);
916
+ return;
917
+ }
918
+ const route = rootSpanAttributes.get('next.route') || normalizedSrcPage;
919
+ const name = `${method} ${route}`;
920
+ currentSpan.setAttributes({
921
+ 'next.route': route,
922
+ 'http.route': route,
923
+ 'next.span_name': name
924
+ });
925
+ currentSpan.updateName(name);
926
+ // Propagate http.route to the parent span if one exists (e.g.
927
+ // a platform-created HTTP span in adapter deployments).
928
+ if (parentSpan && parentSpan !== currentSpan) {
929
+ parentSpan.setAttribute('http.route', route);
930
+ parentSpan.updateName(name);
931
+ }
932
+ })();
933
+ }
892
934
  };
893
- for (const k of DISPLAY_FILTER_KEYS){
894
- if (k in patch && typeof patch[k] === "boolean") next[k] = patch[k];
935
+ // TODO: activeSpan code path is for when wrapped by
936
+ // next-server can be removed when this is no longer used
937
+ if (isWrappedByNextServer && activeSpan) {
938
+ await handleResponse(activeSpan, undefined);
939
+ } else {
940
+ let parentSpan = tracer.getActiveScopeSpan();
941
+ await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest, {
942
+ spanName: `${method} ${srcPage}`,
943
+ kind: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanKind.SERVER,
944
+ attributes: {
945
+ 'http.method': method,
946
+ 'http.target': req.url
947
+ }
948
+ }, (span)=>handleResponse(span, parentSpan)), undefined, !isWrappedByNextServer);
895
949
  }
896
- (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);
897
- return next;
898
950
  }
899
951
 
952
+ //# sourceMappingURL=app-route.js.map
900
953
 
901
- /***/ }),
902
-
903
- /***/ 44708:
904
- /***/ ((module) => {
905
-
906
- module.exports = require("node:https");
907
-
908
- /***/ }),
909
-
910
- /***/ 44870:
911
- /***/ ((module) => {
912
-
913
- module.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js");
914
-
915
- /***/ }),
916
-
917
- /***/ 48161:
918
- /***/ ((module) => {
919
-
920
- module.exports = require("node:os");
921
-
922
- /***/ }),
923
-
924
- /***/ 51455:
925
- /***/ ((module) => {
926
-
927
- module.exports = require("node:fs/promises");
928
-
929
- /***/ }),
930
-
931
- /***/ 55511:
932
- /***/ ((module) => {
933
-
934
- module.exports = require("crypto");
935
-
936
- /***/ }),
937
-
938
- /***/ 55591:
939
- /***/ ((module) => {
940
-
941
- module.exports = require("https");
942
-
943
- /***/ }),
944
-
945
- /***/ 57075:
946
- /***/ ((module) => {
947
-
948
- module.exports = require("node:stream");
949
954
 
950
955
  /***/ }),
951
956
 
@@ -984,6 +989,13 @@ module.exports = require("node:path");
984
989
 
985
990
  /***/ }),
986
991
 
992
+ /***/ 77030:
993
+ /***/ ((module) => {
994
+
995
+ module.exports = require("node:net");
996
+
997
+ /***/ }),
998
+
987
999
  /***/ 77598:
988
1000
  /***/ ((module) => {
989
1001
 
@@ -1047,7 +1059,7 @@ module.exports = import("@huggingface/transformers");;
1047
1059
  var __webpack_require__ = require("../../../../../../webpack-runtime.js");
1048
1060
  __webpack_require__.C(exports);
1049
1061
  var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
1050
- var __webpack_exports__ = __webpack_require__.X(0, [2970,7377,1813,7981,4992,46,3042], () => (__webpack_exec__(27887)));
1062
+ var __webpack_exports__ = __webpack_require__.X(0, [2970,7377,1813,7981,4992,46,3042], () => (__webpack_exec__(57901)));
1051
1063
  module.exports = __webpack_exports__;
1052
1064
 
1053
1065
  })();