@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
@@ -68,762 +68,318 @@ module.exports = require("next/dist/server/app-render/action-async-storage.exter
68
68
 
69
69
  /***/ }),
70
70
 
71
- /***/ 27823:
72
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
71
+ /***/ 27910:
72
+ /***/ ((module) => {
73
73
 
74
- __webpack_require__.r(__webpack_exports__);
75
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
76
- /* harmony export */ handler: () => (/* binding */ handler),
77
- /* harmony export */ patchFetch: () => (/* binding */ patchFetch),
78
- /* harmony export */ routeModule: () => (/* binding */ routeModule),
79
- /* harmony export */ serverHooks: () => (/* binding */ serverHooks),
80
- /* harmony export */ workAsyncStorage: () => (/* binding */ workAsyncStorage),
81
- /* harmony export */ workUnitAsyncStorage: () => (/* binding */ workUnitAsyncStorage)
82
- /* harmony export */ });
83
- /* harmony import */ var next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(19225);
84
- /* 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__);
85
- /* harmony import */ var next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84006);
86
- /* harmony import */ var next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8317);
87
- /* 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__);
88
- /* harmony import */ var next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(99373);
89
- /* 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__);
90
- /* harmony import */ var next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(34775);
91
- /* 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__);
92
- /* harmony import */ var next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(24235);
93
- /* 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__);
94
- /* harmony import */ var next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(261);
95
- /* 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__);
96
- /* harmony import */ var next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(54365);
97
- /* 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__);
98
- /* harmony import */ var next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(90771);
99
- /* 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__);
100
- /* harmony import */ var next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(73461);
101
- /* 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__);
102
- /* harmony import */ var next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(67798);
103
- /* harmony import */ var next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(92280);
104
- /* harmony import */ var next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(62018);
105
- /* 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__);
106
- /* harmony import */ var next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(45696);
107
- /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(47929);
108
- /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__);
109
- /* harmony import */ var next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(86439);
110
- /* 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__);
111
- /* harmony import */ var next_dist_server_lib_route_cache_key__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(10246);
112
- /* 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__);
113
- /* harmony import */ var next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(37527);
114
- /* 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__);
74
+ module.exports = require("stream");
75
+
76
+ /***/ }),
77
+
78
+ /***/ 28354:
79
+ /***/ ((module) => {
80
+
81
+ module.exports = require("util");
115
82
 
83
+ /***/ }),
84
+
85
+ /***/ 29021:
86
+ /***/ ((module) => {
116
87
 
88
+ module.exports = require("fs");
117
89
 
90
+ /***/ }),
118
91
 
92
+ /***/ 29294:
93
+ /***/ ((module) => {
119
94
 
95
+ module.exports = require("next/dist/server/app-render/work-async-storage.external.js");
120
96
 
97
+ /***/ }),
121
98
 
99
+ /***/ 31421:
100
+ /***/ ((module) => {
122
101
 
102
+ module.exports = require("node:child_process");
123
103
 
104
+ /***/ }),
124
105
 
106
+ /***/ 33873:
107
+ /***/ ((module) => {
125
108
 
109
+ module.exports = require("path");
126
110
 
111
+ /***/ }),
127
112
 
113
+ /***/ 36766:
114
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
128
115
 
116
+ __webpack_require__.r(__webpack_exports__);
117
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
118
+ /* harmony export */ GET: () => (/* binding */ GET),
119
+ /* harmony export */ POST: () => (/* binding */ POST)
120
+ /* harmony export */ });
121
+ /* harmony import */ var next_server__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23211);
122
+ /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(97377);
123
+ /* harmony import */ var _lib_stores_threads__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(83042);
124
+ /* harmony import */ var _lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(41720);
125
+ /* harmony import */ var _lib_api_responses__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(39947);
126
+ /**
127
+ * @public — `GET /api/v1/threads` (list), `POST /api/v1/threads` (create)
128
+ *
129
+ * Thread lifecycle. Threads are the unit of conversation history; every
130
+ * agent run lives inside one. See `docs/api.md`.
131
+ */
129
132
 
130
133
 
131
134
 
132
135
 
133
- // We inject the nextConfigOutput here so that we can use them in the route
134
- // module.
135
- const nextConfigOutput = "standalone"
136
- const routeModule = new next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__.AppRouteRouteModule({
137
- definition: {
138
- kind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
139
- page: "/api/v1/threads/route",
140
- pathname: "/api/v1/threads",
141
- filename: "route",
142
- bundlePath: "app/api/v1/threads/route"
143
- },
144
- distDir: ".next" || 0,
145
- relativeProjectDir: false || '',
146
- resolvedPagePath: "/home/runner/work/jarela/jarela/app/api/v1/threads/route.ts",
147
- nextConfigOutput,
148
- // The lazy require factory ensures that:
149
- // - In dev: devRequestTimingInternalsEnd is set before userland executes,
150
- // correctly attributing module load time to application-code rather than
151
- // framework internals.
152
- // - In all modes: async modules (route files with top-level await) are
153
- // handled correctly — require() returns a Promise for such modules, which
154
- // ensureUserland() awaits before the first request is handled.
155
- userland: ()=>__webpack_require__(36766),
156
- // In Turbopack dev mode, also provide a synchronous per-request getter so
157
- // server HMR updates are picked up without re-executing the entry chunk.
158
- // Using require() (synchronous) avoids adding async overhead that would be
159
- // incorrectly attributed to application-code time in devRequestTiming.
160
- ... false ? 0 : {}
136
+ const CreateBody = zod__WEBPACK_IMPORTED_MODULE_4__/* .object */ .Ikc({
137
+ agent_id: zod__WEBPACK_IMPORTED_MODULE_4__/* .string */ .YjP().min(1, "agent_id required"),
138
+ title: zod__WEBPACK_IMPORTED_MODULE_4__/* .string */ .YjP().optional()
161
139
  });
162
- // Pull out the exports that we need to expose from the module. This should
163
- // be eliminated when we've moved the other routes to the new format. These
164
- // are used to hook into the route.
165
- const { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;
166
- function patchFetch() {
167
- return (0,next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__.patchFetch)({
168
- workAsyncStorage,
169
- workUnitAsyncStorage
170
- });
140
+ function GET(req) {
141
+ const { searchParams } = req.nextUrl;
142
+ const limit = Number(searchParams.get("limit") ?? 50);
143
+ const offset = Number(searchParams.get("offset") ?? 0);
144
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json((0,_lib_stores_threads__WEBPACK_IMPORTED_MODULE_1__/* .listThreads */ .Mi)(limit, offset));
145
+ }
146
+ async function POST(req) {
147
+ const body = await (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_3__/* .validateBody */ .Jb)(req, CreateBody);
148
+ if (body instanceof next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse) return body;
149
+ if (!(0,_lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_2__/* .getAgentConfig */ .mJ)(body.agent_id)) return (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_3__/* .notFoundResponse */ .HN)(`Agent "${body.agent_id}" not found`);
150
+ const thread = (0,_lib_stores_threads__WEBPACK_IMPORTED_MODULE_1__/* .createThread */ .Nw)(body.agent_id, body.title);
151
+ return (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_3__/* .createdResponse */ .K2)(thread);
171
152
  }
172
153
 
173
- async function handler(req, res, ctx) {
174
- if (ctx.requestMeta) {
175
- (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.setRequestMeta)(req, ctx.requestMeta);
176
- }
177
- if (routeModule.isDev) {
178
- (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.addRequestMeta)(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());
179
- }
180
- let srcPage = "/api/v1/threads/route";
181
- // turbopack doesn't normalize `/index` in the page name
182
- // so we need to to process dynamic routes properly
183
- // TODO: fix turbopack providing differing value from webpack
184
- if (false) {} else if (srcPage === '/index') {
185
- // we always normalize /index specifically
186
- srcPage = '/';
187
- }
188
- const multiZoneDraftMode = false;
189
- const prepareResult = await routeModule.prepare(req, res, {
190
- srcPage,
191
- multiZoneDraftMode
154
+
155
+ /***/ }),
156
+
157
+ /***/ 37067:
158
+ /***/ ((module) => {
159
+
160
+ module.exports = require("node:http");
161
+
162
+ /***/ }),
163
+
164
+ /***/ 38522:
165
+ /***/ ((module) => {
166
+
167
+ module.exports = require("node:zlib");
168
+
169
+ /***/ }),
170
+
171
+ /***/ 39947:
172
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
173
+
174
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
175
+ /* harmony export */ Bm: () => (/* binding */ cachedJson),
176
+ /* harmony export */ HN: () => (/* binding */ notFoundResponse),
177
+ /* harmony export */ Jb: () => (/* binding */ validateBody),
178
+ /* harmony export */ K2: () => (/* binding */ createdResponse),
179
+ /* harmony export */ Ng: () => (/* binding */ noStoreJson),
180
+ /* harmony export */ yj: () => (/* binding */ errorResponse)
181
+ /* harmony export */ });
182
+ /* harmony import */ var next_server__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23211);
183
+ // Shared HTTP response builders for app/api/v1/** route handlers.
184
+ //
185
+ // Goal: every error/success payload across the v1 surface has the same
186
+ // shape. Before this lived inline, response bodies drifted —
187
+ // `{error: "x"}` vs `{message: "x"}`, 400 vs 422 for the same condition,
188
+ // some routes returned Zod's raw issue array, others stringified it.
189
+
190
+ function errorResponse(message, status = 400) {
191
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json({
192
+ error: message
193
+ }, {
194
+ status
192
195
  });
193
- if (!prepareResult) {
194
- res.statusCode = 400;
195
- res.end('Bad Request');
196
- ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());
197
- return null;
198
- }
199
- const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest, previewProps } = prepareResult;
200
- const normalizedSrcPage = (0,next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__.normalizeAppPath)(srcPage);
201
- // Only this route's prerenders can establish ISR or admit generated params.
202
- 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]));
203
- let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || isPrerendered);
204
- const render404 = async ()=>{
205
- // TODO: should route-module itself handle rendering the 404
206
- if (routerServerContext == null ? void 0 : routerServerContext.render404) {
207
- await routerServerContext.render404(req, res, parsedUrl, false);
208
- } else {
209
- res.end('This page could not be found');
210
- }
211
- return null;
212
- };
213
- if (isIsr && !isDraftMode) {
214
- const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];
215
- if (prerenderInfo) {
216
- if (prerenderInfo.fallback === false && !isPrerendered) {
217
- if (nextConfig.adapterPath) {
218
- return await render404();
219
- }
220
- throw new next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError();
221
- }
196
+ }
197
+ function notFoundResponse(message = "Not found") {
198
+ return errorResponse(message, 404);
199
+ }
200
+ function createdResponse(data) {
201
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
202
+ status: 201
203
+ });
204
+ }
205
+ // Wrap a 200 JSON response with a private Cache-Control header. Use on safe
206
+ // GET endpoints that serve user-scoped data the client refetches often (panel
207
+ // mounts, navigation back/forward) but mutates rarely. The TTL is short
208
+ // enough that explicit mutations — which patch the client-side ApiClient
209
+ // cache in place — stay observably consistent without an extra roundtrip.
210
+ //
211
+ // swrSeconds (optional): stale-while-revalidate window. When set, the browser
212
+ // serves the cached response immediately and refreshes in the background,
213
+ // making navigation feel instant. Use for data that can tolerate brief
214
+ // staleness (tool list, agent configs, model list). Omit for real-time data
215
+ // (dashboard metrics, credential state).
216
+ function cachedJson(data, maxAgeSeconds, swrSeconds) {
217
+ const swr = swrSeconds ? `, stale-while-revalidate=${swrSeconds}` : "";
218
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
219
+ headers: {
220
+ "Cache-Control": `private, max-age=${maxAgeSeconds}${swr}`
222
221
  }
222
+ });
223
+ }
224
+ // Use for endpoints whose response contains live state that must never be
225
+ // served from cache — credentials, connection status, live config values.
226
+ function noStoreJson(data) {
227
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
228
+ headers: {
229
+ "Cache-Control": "no-store"
230
+ }
231
+ });
232
+ }
233
+ // Validate a JSON request body against a zod schema.
234
+ // Returns either the parsed data or a 400 NextResponse explaining the issue.
235
+ // Caller pattern:
236
+ // const parsed = await validateBody(req, Schema);
237
+ // if (parsed instanceof NextResponse) return parsed;
238
+ // // use parsed.field
239
+ async function validateBody(req, schema) {
240
+ let raw;
241
+ try {
242
+ raw = await req.json();
243
+ } catch {
244
+ return errorResponse("Request body must be valid JSON", 400);
223
245
  }
224
- let cacheKey = null;
225
- if (isIsr && !routeModule.isDev && !isDraftMode) {
226
- cacheKey = resolvedPathname;
227
- // ensure /index and / is normalized to one key
228
- cacheKey = cacheKey === '/index' ? '/' : cacheKey;
229
- }
230
- // Before rendering (which initializes component tree modules), we have to
231
- // set the reference manifests to our global store so Server Action's
232
- // encryption util can access to them at the top level of the page module.
233
- if (serverActionsManifest && clientReferenceManifest) {
234
- (0,next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__.setManifestsSingleton)({
235
- page: srcPage,
236
- clientReferenceManifest,
237
- serverActionsManifest
238
- });
246
+ const parsed = schema.safeParse(raw);
247
+ if (!parsed.success) {
248
+ return errorResponse(parsed.error.issues[0]?.message ?? "invalid body", 400);
239
249
  }
240
- const method = req.method || 'GET';
241
- const tracer = (0,next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.getTracer)();
242
- const activeSpan = tracer.getActiveScopeSpan();
243
- const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);
244
- const isMinimalMode = Boolean((0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'minimalMode'));
245
- const incrementalCache = (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, previewProps, prerenderManifest, isMinimalMode);
246
- incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();
247
- globalThis.__incrementalCache = incrementalCache;
248
- const context = {
249
- params,
250
- previewProps,
251
- renderOpts: {
252
- experimental: {
253
- authInterrupts: Boolean(nextConfig.experimental.authInterrupts),
254
- useCacheTimeout: nextConfig.experimental.useCacheTimeout,
255
- durableUseCacheEntries: Boolean(nextConfig.experimental.durableUseCacheEntries)
256
- },
257
- cacheComponents: Boolean(nextConfig.cacheComponents),
258
- validationLevel: nextConfig.experimental.instantInsights.validationLevel,
259
- isDraftMode,
260
- incrementalCache,
261
- hmrRefreshHash: (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'hmrRefreshHash'),
262
- cacheLifeProfiles: nextConfig.cacheLife,
263
- staticPageGenerationTimeout: nextConfig.staticPageGenerationTimeout,
264
- waitUntil: ctx.waitUntil,
265
- onClose: (cb)=>{
266
- res.on('close', cb);
267
- },
268
- onAfterTaskError: undefined
269
- },
270
- sharedContext: {
271
- buildId,
272
- deploymentId
250
+ return parsed.data;
251
+ }
252
+
253
+
254
+ /***/ }),
255
+
256
+ /***/ 41720:
257
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
258
+
259
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
260
+ /* harmony export */ BM: () => (/* binding */ upsertAgentConfig),
261
+ /* harmony export */ E1: () => (/* binding */ updateAgentDisplayFilters),
262
+ /* harmony export */ P2: () => (/* binding */ parseCitationStrictness),
263
+ /* harmony export */ S2: () => (/* binding */ getAgentToolCredentials),
264
+ /* harmony export */ SJ: () => (/* binding */ generateAgentId),
265
+ /* harmony export */ TG: () => (/* binding */ getAgentTools),
266
+ /* harmony export */ bg: () => (/* binding */ parseDelegateTargets),
267
+ /* harmony export */ d2: () => (/* binding */ DISPLAY_FILTER_KEYS),
268
+ /* harmony export */ fg: () => (/* binding */ getAgentTierProportions),
269
+ /* harmony export */ mJ: () => (/* binding */ getAgentConfig),
270
+ /* harmony export */ nV: () => (/* binding */ getAgentDisplayFilters),
271
+ /* harmony export */ vU: () => (/* binding */ getDefaultAgentConfig),
272
+ /* harmony export */ vi: () => (/* binding */ DISPLAY_FILTER_DEFAULTS),
273
+ /* harmony export */ xi: () => (/* binding */ deleteAgentConfig),
274
+ /* harmony export */ zb: () => (/* binding */ listAgentConfigs)
275
+ /* harmony export */ });
276
+ /* harmony import */ var _lib_db__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(46);
277
+ /* harmony import */ var _lib_db_transaction__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(99043);
278
+ /* harmony import */ var _lib_agents_adaptive_persona_presets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(66849);
279
+
280
+
281
+
282
+ const now = ()=>new Date().toISOString();
283
+ /** Coerce arbitrary input (DB row TEXT, API body, undefined) to the enum.
284
+ * Returns `null` for null/undefined/unknown values so callers can default. */ function parseCitationStrictness(value) {
285
+ if (value === "off" || value === "informational" || value === "standard" || value === "strict") {
286
+ return value;
287
+ }
288
+ return null;
289
+ }
290
+ /**
291
+ * Parse the JSON-encoded per-agent override of context tier proportions.
292
+ * Returns `null` for NULL, blank, malformed JSON, or any payload that
293
+ * doesn't have three finite non-negative numeric fields. Callers fall
294
+ * back to the model config's value (or built-in defaults) on null.
295
+ */ function getAgentTierProportions(row) {
296
+ const raw = row.context_tier_proportions;
297
+ if (!raw) return null;
298
+ try {
299
+ const parsed = JSON.parse(raw);
300
+ const hot = Number(parsed.hot);
301
+ const warm = Number(parsed.warm);
302
+ const facts = Number(parsed.facts);
303
+ if (![
304
+ hot,
305
+ warm,
306
+ facts
307
+ ].every((n)=>Number.isFinite(n) && n >= 0)) return null;
308
+ if (hot + warm + facts <= 0) return null;
309
+ return {
310
+ hot,
311
+ warm,
312
+ facts
313
+ };
314
+ } catch {
315
+ return null;
316
+ }
317
+ }
318
+ function listAgentConfigs() {
319
+ // Default agent always first; then by the timestamp of each agent's latest message.
320
+ return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare(`SELECT a.*
321
+ FROM agent_configs a
322
+ LEFT JOIN (
323
+ SELECT t.agent_id, MAX(m.created_at) AS last_message_at
324
+ FROM threads t
325
+ JOIN messages m ON m.thread_id = t.thread_id
326
+ GROUP BY t.agent_id
327
+ ) latest ON latest.agent_id = a.id
328
+ ORDER BY a.is_default DESC, COALESCE(latest.last_message_at, a.created_at) DESC, a.id ASC`).all();
329
+ }
330
+ function getDefaultAgentConfig() {
331
+ return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("SELECT * FROM agent_configs WHERE is_default=1 LIMIT 1").get() ?? null;
332
+ }
333
+ function getAgentConfig(id) {
334
+ return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("SELECT * FROM agent_configs WHERE id=?").get(id) ?? null;
335
+ }
336
+ /**
337
+ * Parse the JSON-encoded delegate whitelist into a deduped string[]. Returns
338
+ * an empty array for NULL, blank, or malformed JSON (delegation is opt-in).
339
+ */ /**
340
+ * Parse the agent's tool allowlist (`tools` column, stored as a JSON string).
341
+ * Returns an empty array on NULL/blank/malformed JSON — same defensive shape
342
+ * as parseDelegateTargets. Callers that previously did `JSON.parse(cfg.tools)`
343
+ * inline should switch to this getter so the serialization contract stays
344
+ * owned by this store.
345
+ */ function getAgentTools(cfg) {
346
+ if (!cfg?.tools) return [];
347
+ try {
348
+ const parsed = JSON.parse(cfg.tools);
349
+ if (!Array.isArray(parsed)) return [];
350
+ return parsed.filter((x)=>typeof x === "string" && x.length > 0);
351
+ } catch {
352
+ return [];
353
+ }
354
+ }
355
+ function parseDelegateTargets(raw) {
356
+ if (!raw) return [];
357
+ try {
358
+ const parsed = JSON.parse(raw);
359
+ if (!Array.isArray(parsed)) return [];
360
+ const ids = parsed.filter((x)=>typeof x === "string" && x.length > 0);
361
+ return Array.from(new Set(ids));
362
+ } catch {
363
+ return [];
364
+ }
365
+ }
366
+ /**
367
+ * Parse the per-agent `{ toolName: credentialId }` override map stored in
368
+ * the `tool_credentials` column. Returns an empty record on NULL / blank /
369
+ * malformed JSON / non-string entries so downstream code can treat the
370
+ * result as a plain lookup without further validation.
371
+ */ function getAgentToolCredentials(cfg) {
372
+ if (!cfg?.tool_credentials) return {};
373
+ try {
374
+ const parsed = JSON.parse(cfg.tool_credentials);
375
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
376
+ const out = {};
377
+ for (const [k, v] of Object.entries(parsed)){
378
+ if (typeof v === "string" && v.length > 0) out[k] = v;
273
379
  }
274
- };
275
- const nodeNextReq = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextRequest(req);
276
- const nodeNextRes = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextResponse(res);
277
- 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));
278
- const responseGenerator = async ({ previousCacheEntry })=>{
279
- try {
280
- if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {
281
- res.statusCode = 404;
282
- // on-demand revalidate always sets this header
283
- res.setHeader('x-nextjs-cache', 'REVALIDATED');
284
- res.end('This page could not be found');
285
- return null;
286
- }
287
- const response = cacheKey === null ? await routeModule.handle(nextReq, context) : await routeModule.prerender(nextReq, context);
288
- req.fetchMetrics = context.renderOpts.fetchMetrics;
289
- let pendingWaitUntil = context.renderOpts.pendingWaitUntil;
290
- // Attempt using provided waitUntil if available
291
- // if it's not we fallback to sendResponse's handling
292
- if (pendingWaitUntil) {
293
- if (ctx.waitUntil) {
294
- ctx.waitUntil(pendingWaitUntil);
295
- pendingWaitUntil = undefined;
296
- }
297
- }
298
- const cacheTags = context.renderOpts.collectedTags;
299
- // If the request is for a static response, we can cache it so long
300
- // as it's not edge.
301
- if (isIsr) {
302
- const blob = await response.blob();
303
- // Copy the headers from the response.
304
- const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.toNodeOutgoingHttpHeaders)(response.headers);
305
- if (cacheTags) {
306
- headers[next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER] = cacheTags;
307
- }
308
- if (!headers['content-type'] && blob.type) {
309
- headers['content-type'] = blob.type;
310
- }
311
- const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;
312
- 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
313
- // explicit `expire` (e.g. via `cacheLife`). This mirrors the
314
- // build-time fallback in `build/index.ts` so cache entries
315
- // and the response Cache-Control header agree on the route's
316
- // effective expire. Routes that opt out of revalidation
317
- // (`revalidate: false`) or that are dynamic (`revalidate: 0`)
318
- // keep `expire: undefined`.
319
- revalidate !== false && revalidate > 0 ? nextConfig.expireTime : undefined : context.renderOpts.collectedExpire;
320
- // Create the cache entry for the response.
321
- const cacheEntry = {
322
- value: {
323
- kind: next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__.CachedRouteKind.APP_ROUTE,
324
- status: response.status,
325
- body: Buffer.from(await blob.arrayBuffer()),
326
- headers
327
- },
328
- cacheControl: {
329
- revalidate,
330
- expire
331
- }
332
- };
333
- return cacheEntry;
334
- } else {
335
- // send response without caching if not ISR
336
- await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, response, pendingWaitUntil);
337
- return null;
338
- }
339
- } catch (err) {
340
- // if this is a background revalidate we need to report
341
- // the request error here as it won't be bubbled
342
- if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {
343
- const silenceLog = false;
344
- await routeModule.onRequestError(req, err, {
345
- routerKind: 'App Router',
346
- routePath: srcPage,
347
- routeType: 'route',
348
- revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
349
- isStaticGeneration: cacheKey !== null,
350
- isOnDemandRevalidate
351
- })
352
- }, silenceLog, routerServerContext);
353
- }
354
- throw err;
355
- }
356
- };
357
- const handleResponse = async (currentSpan, parentSpan)=>{
358
- try {
359
- var _cacheEntry_value;
360
- const cacheEntry = await routeModule.handleResponse({
361
- req,
362
- nextConfig,
363
- cacheKey,
364
- routeKind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
365
- isFallback: false,
366
- previewProps,
367
- prerenderManifest,
368
- isRoutePPREnabled: false,
369
- isOnDemandRevalidate,
370
- revalidateOnlyGenerated,
371
- responseGenerator,
372
- waitUntil: ctx.waitUntil,
373
- isMinimalMode
374
- });
375
- if (cacheEntry !== null && 'error' in cacheEntry) {
376
- throw cacheEntry.error;
377
- }
378
- // we don't create a cacheEntry for ISR
379
- if (!isIsr) {
380
- return;
381
- }
382
- 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) {
383
- var _cacheEntry_value1;
384
- throw new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`);
385
- }
386
- if (!isMinimalMode) {
387
- res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');
388
- }
389
- // Draft mode should never be cached
390
- if (isDraftMode) {
391
- res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');
392
- }
393
- const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers);
394
- if (!(isMinimalMode && isIsr)) {
395
- headers.delete(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER);
396
- }
397
- // If cache control is already set on the response we don't
398
- // override it to allow users to customize it via next.config
399
- if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {
400
- headers.set('Cache-Control', (0,next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__.getCacheControlHeader)(cacheEntry.cacheControl));
401
- }
402
- 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'.
403
- new Response(cacheEntry.value.body, {
404
- headers,
405
- status: cacheEntry.value.status || 200
406
- }));
407
- return;
408
- } catch (err) {
409
- if (!(err instanceof next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError)) {
410
- const silenceLog = false;
411
- await routeModule.onRequestError(req, err, {
412
- routerKind: 'App Router',
413
- routePath: normalizedSrcPage,
414
- routeType: 'route',
415
- revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
416
- isStaticGeneration: cacheKey !== null,
417
- isOnDemandRevalidate
418
- })
419
- }, silenceLog, routerServerContext);
420
- }
421
- // rethrow so that we can handle serving error page
422
- // If this is during static generation, throw the error again.
423
- if (isIsr) throw err;
424
- // Otherwise, send a 500 response unless the original response has
425
- // already committed. In that case, preserve its status code for
426
- // telemetry while still recording the failure and terminating a response
427
- // that the failed pipeline left open.
428
- if (res.headersSent) {
429
- if (currentSpan) {
430
- const error = err instanceof Error ? err : new Error('Unknown app route error');
431
- currentSpan.recordException(error);
432
- currentSpan.setStatus({
433
- code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR,
434
- message: error.message
435
- });
436
- currentSpan.setAttribute('error.type', error.name);
437
- }
438
- if (!res.writableEnded && !res.destroyed) {
439
- res.end();
440
- }
441
- } else {
442
- await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, new Response(null, {
443
- status: 500
444
- }));
445
- }
446
- return;
447
- } finally{
448
- ;
449
- (()=>{
450
- if (!currentSpan) {
451
- return;
452
- }
453
- let statusCode = res.statusCode;
454
- currentSpan.setAttributes({
455
- 'http.status_code': statusCode,
456
- 'next.rsc': false
457
- });
458
- if (statusCode && statusCode >= 500) {
459
- // For 5xx status codes: SHOULD be set to 'Error' span status.
460
- // x-ref: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
461
- currentSpan.setStatus({
462
- code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR
463
- });
464
- // For span status 'Error', SHOULD set 'error.type' attribute.
465
- currentSpan.setAttribute('error.type', statusCode.toString());
466
- }
467
- const rootSpanAttributes = tracer.getRootSpanAttributes();
468
- // We were unable to get attributes, probably OTEL is not enabled
469
- if (!rootSpanAttributes) {
470
- return;
471
- }
472
- if (rootSpanAttributes.get('next.span_type') !== next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest) {
473
- console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);
474
- return;
475
- }
476
- const route = rootSpanAttributes.get('next.route') || normalizedSrcPage;
477
- const name = `${method} ${route}`;
478
- currentSpan.setAttributes({
479
- 'next.route': route,
480
- 'http.route': route,
481
- 'next.span_name': name
482
- });
483
- currentSpan.updateName(name);
484
- // Propagate http.route to the parent span if one exists (e.g.
485
- // a platform-created HTTP span in adapter deployments).
486
- if (parentSpan && parentSpan !== currentSpan) {
487
- parentSpan.setAttribute('http.route', route);
488
- parentSpan.updateName(name);
489
- }
490
- })();
491
- }
492
- };
493
- // TODO: activeSpan code path is for when wrapped by
494
- // next-server can be removed when this is no longer used
495
- if (isWrappedByNextServer && activeSpan) {
496
- await handleResponse(activeSpan, undefined);
497
- } else {
498
- let parentSpan = tracer.getActiveScopeSpan();
499
- await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest, {
500
- spanName: `${method} ${srcPage}`,
501
- kind: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanKind.SERVER,
502
- attributes: {
503
- 'http.method': method,
504
- 'http.target': req.url
505
- }
506
- }, (span)=>handleResponse(span, parentSpan)), undefined, !isWrappedByNextServer);
507
- }
508
- }
509
-
510
- //# sourceMappingURL=app-route.js.map
511
-
512
-
513
- /***/ }),
514
-
515
- /***/ 27910:
516
- /***/ ((module) => {
517
-
518
- module.exports = require("stream");
519
-
520
- /***/ }),
521
-
522
- /***/ 28354:
523
- /***/ ((module) => {
524
-
525
- module.exports = require("util");
526
-
527
- /***/ }),
528
-
529
- /***/ 29021:
530
- /***/ ((module) => {
531
-
532
- module.exports = require("fs");
533
-
534
- /***/ }),
535
-
536
- /***/ 29294:
537
- /***/ ((module) => {
538
-
539
- module.exports = require("next/dist/server/app-render/work-async-storage.external.js");
540
-
541
- /***/ }),
542
-
543
- /***/ 31421:
544
- /***/ ((module) => {
545
-
546
- module.exports = require("node:child_process");
547
-
548
- /***/ }),
549
-
550
- /***/ 33873:
551
- /***/ ((module) => {
552
-
553
- module.exports = require("path");
554
-
555
- /***/ }),
556
-
557
- /***/ 36766:
558
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
559
-
560
- __webpack_require__.r(__webpack_exports__);
561
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
562
- /* harmony export */ GET: () => (/* binding */ GET),
563
- /* harmony export */ POST: () => (/* binding */ POST)
564
- /* harmony export */ });
565
- /* harmony import */ var next_server__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23211);
566
- /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(97377);
567
- /* harmony import */ var _lib_stores_threads__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(83042);
568
- /* harmony import */ var _lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(41720);
569
- /* harmony import */ var _lib_api_responses__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(39947);
570
- /**
571
- * @public — `GET /api/v1/threads` (list), `POST /api/v1/threads` (create)
572
- *
573
- * Thread lifecycle. Threads are the unit of conversation history; every
574
- * agent run lives inside one. See `docs/api.md`.
575
- */
576
-
577
-
578
-
579
-
580
- const CreateBody = zod__WEBPACK_IMPORTED_MODULE_4__/* .object */ .Ikc({
581
- agent_id: zod__WEBPACK_IMPORTED_MODULE_4__/* .string */ .YjP().min(1, "agent_id required"),
582
- title: zod__WEBPACK_IMPORTED_MODULE_4__/* .string */ .YjP().optional()
583
- });
584
- function GET(req) {
585
- const { searchParams } = req.nextUrl;
586
- const limit = Number(searchParams.get("limit") ?? 50);
587
- const offset = Number(searchParams.get("offset") ?? 0);
588
- return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json((0,_lib_stores_threads__WEBPACK_IMPORTED_MODULE_1__/* .listThreads */ .Mi)(limit, offset));
589
- }
590
- async function POST(req) {
591
- const body = await (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_3__/* .validateBody */ .Jb)(req, CreateBody);
592
- if (body instanceof next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse) return body;
593
- if (!(0,_lib_stores_agent_configs__WEBPACK_IMPORTED_MODULE_2__/* .getAgentConfig */ .mJ)(body.agent_id)) return (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_3__/* .notFoundResponse */ .HN)(`Agent "${body.agent_id}" not found`);
594
- const thread = (0,_lib_stores_threads__WEBPACK_IMPORTED_MODULE_1__/* .createThread */ .Nw)(body.agent_id, body.title);
595
- return (0,_lib_api_responses__WEBPACK_IMPORTED_MODULE_3__/* .createdResponse */ .K2)(thread);
596
- }
597
-
598
-
599
- /***/ }),
600
-
601
- /***/ 37067:
602
- /***/ ((module) => {
603
-
604
- module.exports = require("node:http");
605
-
606
- /***/ }),
607
-
608
- /***/ 38522:
609
- /***/ ((module) => {
610
-
611
- module.exports = require("node:zlib");
612
-
613
- /***/ }),
614
-
615
- /***/ 39947:
616
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
617
-
618
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
619
- /* harmony export */ Bm: () => (/* binding */ cachedJson),
620
- /* harmony export */ HN: () => (/* binding */ notFoundResponse),
621
- /* harmony export */ Jb: () => (/* binding */ validateBody),
622
- /* harmony export */ K2: () => (/* binding */ createdResponse),
623
- /* harmony export */ Ng: () => (/* binding */ noStoreJson),
624
- /* harmony export */ yj: () => (/* binding */ errorResponse)
625
- /* harmony export */ });
626
- /* harmony import */ var next_server__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23211);
627
- // Shared HTTP response builders for app/api/v1/** route handlers.
628
- //
629
- // Goal: every error/success payload across the v1 surface has the same
630
- // shape. Before this lived inline, response bodies drifted —
631
- // `{error: "x"}` vs `{message: "x"}`, 400 vs 422 for the same condition,
632
- // some routes returned Zod's raw issue array, others stringified it.
633
-
634
- function errorResponse(message, status = 400) {
635
- return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json({
636
- error: message
637
- }, {
638
- status
639
- });
640
- }
641
- function notFoundResponse(message = "Not found") {
642
- return errorResponse(message, 404);
643
- }
644
- function createdResponse(data) {
645
- return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
646
- status: 201
647
- });
648
- }
649
- // Wrap a 200 JSON response with a private Cache-Control header. Use on safe
650
- // GET endpoints that serve user-scoped data the client refetches often (panel
651
- // mounts, navigation back/forward) but mutates rarely. The TTL is short
652
- // enough that explicit mutations — which patch the client-side ApiClient
653
- // cache in place — stay observably consistent without an extra roundtrip.
654
- //
655
- // swrSeconds (optional): stale-while-revalidate window. When set, the browser
656
- // serves the cached response immediately and refreshes in the background,
657
- // making navigation feel instant. Use for data that can tolerate brief
658
- // staleness (tool list, agent configs, model list). Omit for real-time data
659
- // (dashboard metrics, credential state).
660
- function cachedJson(data, maxAgeSeconds, swrSeconds) {
661
- const swr = swrSeconds ? `, stale-while-revalidate=${swrSeconds}` : "";
662
- return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
663
- headers: {
664
- "Cache-Control": `private, max-age=${maxAgeSeconds}${swr}`
665
- }
666
- });
667
- }
668
- // Use for endpoints whose response contains live state that must never be
669
- // served from cache — credentials, connection status, live config values.
670
- function noStoreJson(data) {
671
- return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json(data, {
672
- headers: {
673
- "Cache-Control": "no-store"
674
- }
675
- });
676
- }
677
- // Validate a JSON request body against a zod schema.
678
- // Returns either the parsed data or a 400 NextResponse explaining the issue.
679
- // Caller pattern:
680
- // const parsed = await validateBody(req, Schema);
681
- // if (parsed instanceof NextResponse) return parsed;
682
- // // use parsed.field
683
- async function validateBody(req, schema) {
684
- let raw;
685
- try {
686
- raw = await req.json();
687
- } catch {
688
- return errorResponse("Request body must be valid JSON", 400);
689
- }
690
- const parsed = schema.safeParse(raw);
691
- if (!parsed.success) {
692
- return errorResponse(parsed.error.issues[0]?.message ?? "invalid body", 400);
693
- }
694
- return parsed.data;
695
- }
696
-
697
-
698
- /***/ }),
699
-
700
- /***/ 41720:
701
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
702
-
703
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
704
- /* harmony export */ BM: () => (/* binding */ upsertAgentConfig),
705
- /* harmony export */ E1: () => (/* binding */ updateAgentDisplayFilters),
706
- /* harmony export */ P2: () => (/* binding */ parseCitationStrictness),
707
- /* harmony export */ S2: () => (/* binding */ getAgentToolCredentials),
708
- /* harmony export */ SJ: () => (/* binding */ generateAgentId),
709
- /* harmony export */ TG: () => (/* binding */ getAgentTools),
710
- /* harmony export */ bg: () => (/* binding */ parseDelegateTargets),
711
- /* harmony export */ d2: () => (/* binding */ DISPLAY_FILTER_KEYS),
712
- /* harmony export */ fg: () => (/* binding */ getAgentTierProportions),
713
- /* harmony export */ mJ: () => (/* binding */ getAgentConfig),
714
- /* harmony export */ nV: () => (/* binding */ getAgentDisplayFilters),
715
- /* harmony export */ vU: () => (/* binding */ getDefaultAgentConfig),
716
- /* harmony export */ vi: () => (/* binding */ DISPLAY_FILTER_DEFAULTS),
717
- /* harmony export */ xi: () => (/* binding */ deleteAgentConfig),
718
- /* harmony export */ zb: () => (/* binding */ listAgentConfigs)
719
- /* harmony export */ });
720
- /* harmony import */ var _lib_db__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(46);
721
- /* harmony import */ var _lib_db_transaction__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(99043);
722
- /* harmony import */ var _lib_agents_adaptive_persona_presets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(66849);
723
-
724
-
725
-
726
- const now = ()=>new Date().toISOString();
727
- /** Coerce arbitrary input (DB row TEXT, API body, undefined) to the enum.
728
- * Returns `null` for null/undefined/unknown values so callers can default. */ function parseCitationStrictness(value) {
729
- if (value === "off" || value === "informational" || value === "standard" || value === "strict") {
730
- return value;
731
- }
732
- return null;
733
- }
734
- /**
735
- * Parse the JSON-encoded per-agent override of context tier proportions.
736
- * Returns `null` for NULL, blank, malformed JSON, or any payload that
737
- * doesn't have three finite non-negative numeric fields. Callers fall
738
- * back to the model config's value (or built-in defaults) on null.
739
- */ function getAgentTierProportions(row) {
740
- const raw = row.context_tier_proportions;
741
- if (!raw) return null;
742
- try {
743
- const parsed = JSON.parse(raw);
744
- const hot = Number(parsed.hot);
745
- const warm = Number(parsed.warm);
746
- const facts = Number(parsed.facts);
747
- if (![
748
- hot,
749
- warm,
750
- facts
751
- ].every((n)=>Number.isFinite(n) && n >= 0)) return null;
752
- if (hot + warm + facts <= 0) return null;
753
- return {
754
- hot,
755
- warm,
756
- facts
757
- };
758
- } catch {
759
- return null;
760
- }
761
- }
762
- function listAgentConfigs() {
763
- // Default agent always first; then by the timestamp of each agent's latest message.
764
- return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare(`SELECT a.*
765
- FROM agent_configs a
766
- LEFT JOIN (
767
- SELECT t.agent_id, MAX(m.created_at) AS last_message_at
768
- FROM threads t
769
- JOIN messages m ON m.thread_id = t.thread_id
770
- GROUP BY t.agent_id
771
- ) latest ON latest.agent_id = a.id
772
- ORDER BY a.is_default DESC, COALESCE(latest.last_message_at, a.created_at) DESC, a.id ASC`).all();
773
- }
774
- function getDefaultAgentConfig() {
775
- return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("SELECT * FROM agent_configs WHERE is_default=1 LIMIT 1").get() ?? null;
776
- }
777
- function getAgentConfig(id) {
778
- return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("SELECT * FROM agent_configs WHERE id=?").get(id) ?? null;
779
- }
780
- /**
781
- * Parse the JSON-encoded delegate whitelist into a deduped string[]. Returns
782
- * an empty array for NULL, blank, or malformed JSON (delegation is opt-in).
783
- */ /**
784
- * Parse the agent's tool allowlist (`tools` column, stored as a JSON string).
785
- * Returns an empty array on NULL/blank/malformed JSON — same defensive shape
786
- * as parseDelegateTargets. Callers that previously did `JSON.parse(cfg.tools)`
787
- * inline should switch to this getter so the serialization contract stays
788
- * owned by this store.
789
- */ function getAgentTools(cfg) {
790
- if (!cfg?.tools) return [];
791
- try {
792
- const parsed = JSON.parse(cfg.tools);
793
- if (!Array.isArray(parsed)) return [];
794
- return parsed.filter((x)=>typeof x === "string" && x.length > 0);
795
- } catch {
796
- return [];
797
- }
798
- }
799
- function parseDelegateTargets(raw) {
800
- if (!raw) return [];
801
- try {
802
- const parsed = JSON.parse(raw);
803
- if (!Array.isArray(parsed)) return [];
804
- const ids = parsed.filter((x)=>typeof x === "string" && x.length > 0);
805
- return Array.from(new Set(ids));
806
- } catch {
807
- return [];
808
- }
809
- }
810
- /**
811
- * Parse the per-agent `{ toolName: credentialId }` override map stored in
812
- * the `tool_credentials` column. Returns an empty record on NULL / blank /
813
- * malformed JSON / non-string entries so downstream code can treat the
814
- * result as a plain lookup without further validation.
815
- */ function getAgentToolCredentials(cfg) {
816
- if (!cfg?.tool_credentials) return {};
817
- try {
818
- const parsed = JSON.parse(cfg.tool_credentials);
819
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
820
- const out = {};
821
- for (const [k, v] of Object.entries(parsed)){
822
- if (typeof v === "string" && v.length > 0) out[k] = v;
823
- }
824
- return out;
825
- } catch {
826
- return {};
380
+ return out;
381
+ } catch {
382
+ return {};
827
383
  }
828
384
  }
829
385
  function upsertAgentConfig(input) {
@@ -834,12 +390,17 @@ function upsertAgentConfigTransaction(input) {
834
390
  const db = (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)();
835
391
  const existing = getAgentConfig(input.id);
836
392
  const created_at = existing?.created_at ?? t;
837
- const mbti = input.adaptive_mbti ?? toMbti(existing?.adaptive_mbti) ?? "INTJ";
393
+ const existingMbti = toMbti(existing?.adaptive_mbti);
394
+ const mbti = input.adaptive_mbti ?? existingMbti ?? "INTJ";
838
395
  const preset = _lib_agents_adaptive_persona_presets__WEBPACK_IMPORTED_MODULE_2__/* .MBTI_PRESETS */ .e[mbti];
839
- const strength = input.adaptive_persona_strength ?? preset.strength;
840
- const empathy = input.adaptive_empathy ?? preset.empathy;
841
- const expressiveness = input.adaptive_expressiveness ?? preset.expressiveness;
842
- const verbosity = input.adaptive_verbosity ?? preset.verbosity;
396
+ // Omitted sliders keep their tuned values; they only fall back to the
397
+ // preset when the type changes or the agent is new. Otherwise every
398
+ // partial update (approved proposals, tool edits) reset them.
399
+ const keepTuned = existing !== null && existing !== undefined && mbti === existingMbti;
400
+ const strength = input.adaptive_persona_strength ?? (keepTuned ? existing.adaptive_persona_strength : preset.strength);
401
+ const empathy = input.adaptive_empathy ?? (keepTuned ? existing.adaptive_empathy : preset.empathy);
402
+ const expressiveness = input.adaptive_expressiveness ?? (keepTuned ? existing.adaptive_expressiveness : preset.expressiveness);
403
+ const verbosity = input.adaptive_verbosity ?? (keepTuned ? existing.adaptive_verbosity : preset.verbosity);
843
404
  if (input.is_default) db.prepare("UPDATE agent_configs SET is_default=0").run();
844
405
  // harness_id: explicit `undefined` means "keep existing"; explicit `null`
845
406
  // means "use the global default". Empty string is normalised to null too,
@@ -905,189 +466,640 @@ function serialiseToolCredentials(input, existing) {
905
466
  if (typeof k === "string" && k.length > 0 && typeof v === "string" && v.length > 0) {
906
467
  cleaned[k] = v;
907
468
  }
908
- }
909
- if (Object.keys(cleaned).length === 0) return null;
910
- return JSON.stringify(cleaned);
911
- }
912
- function toMbti(v) {
913
- if (!v) return null;
914
- return v in _lib_agents_adaptive_persona_presets__WEBPACK_IMPORTED_MODULE_2__/* .MBTI_PRESETS */ .e ? v : null;
915
- }
916
- function deleteAgentConfig(id) {
917
- return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("DELETE FROM agent_configs WHERE id=?").run(id).changes > 0;
918
- }
919
- function generateAgentId(name) {
920
- const slug = name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
921
- const suffix = Math.random().toString(36).slice(2, 6);
922
- return slug ? `${slug}-${suffix}` : `agent-${suffix}`;
923
- }
924
- // ── ADR-0022: per-agent message-channel display filters ─────────────────
925
- // Canonical channel keys mirrored in `hooks/useMessageFilters.ts`. Kept
926
- // in sync there by importing this constant — single source of truth.
927
- const DISPLAY_FILTER_KEYS = [
928
- "scheduled_task",
929
- "watcher",
930
- "bridge",
931
- "extension",
932
- "page_capture",
933
- "synthetic",
934
- "tool_use",
935
- "thinking"
936
- ];
937
- const DISPLAY_FILTER_DEFAULTS = {
938
- scheduled_task: true,
939
- watcher: true,
940
- bridge: true,
941
- extension: true,
942
- page_capture: true,
943
- synthetic: true,
944
- tool_use: true,
945
- thinking: true
946
- };
947
- function parseDisplayFilters(raw) {
948
- if (!raw) return {
949
- ...DISPLAY_FILTER_DEFAULTS
950
- };
951
- try {
952
- const parsed = JSON.parse(raw);
953
- // Merge over defaults so newly-added channels stay visible on old rows.
954
- return {
955
- ...DISPLAY_FILTER_DEFAULTS,
956
- ...parsed
957
- };
958
- } catch {
959
- return {
960
- ...DISPLAY_FILTER_DEFAULTS
961
- };
962
- }
963
- }
964
- function getAgentDisplayFilters(id) {
965
- const row = getAgentConfig(id);
966
- if (!row) return null;
967
- return parseDisplayFilters(row.display_filters);
968
- }
969
- /**
970
- * Merge a partial filter map into the agent's stored prefs. Pass `null` to
971
- * reset to defaults (clears the column). Safe against concurrent toggles
972
- * from multiple browser tabs because the merge happens server-side.
973
- */ function updateAgentDisplayFilters(id, patch) {
974
- const row = getAgentConfig(id);
975
- if (!row) return null;
976
- if (patch === null) {
977
- (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("UPDATE agent_configs SET display_filters=NULL, updated_at=? WHERE id=?").run(now(), id);
978
- return {
979
- ...DISPLAY_FILTER_DEFAULTS
980
- };
981
- }
982
- const current = parseDisplayFilters(row.display_filters);
983
- const next = {
984
- ...current
469
+ }
470
+ if (Object.keys(cleaned).length === 0) return null;
471
+ return JSON.stringify(cleaned);
472
+ }
473
+ function toMbti(v) {
474
+ if (!v) return null;
475
+ return v in _lib_agents_adaptive_persona_presets__WEBPACK_IMPORTED_MODULE_2__/* .MBTI_PRESETS */ .e ? v : null;
476
+ }
477
+ function deleteAgentConfig(id) {
478
+ return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("DELETE FROM agent_configs WHERE id=?").run(id).changes > 0;
479
+ }
480
+ function generateAgentId(name) {
481
+ const slug = name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
482
+ const suffix = Math.random().toString(36).slice(2, 6);
483
+ return slug ? `${slug}-${suffix}` : `agent-${suffix}`;
484
+ }
485
+ // ── ADR-0022: per-agent message-channel display filters ─────────────────
486
+ // Canonical channel keys mirrored in `hooks/useMessageFilters.ts`. Kept
487
+ // in sync there by importing this constant — single source of truth.
488
+ const DISPLAY_FILTER_KEYS = [
489
+ "scheduled_task",
490
+ "watcher",
491
+ "bridge",
492
+ "extension",
493
+ "page_capture",
494
+ "synthetic",
495
+ "tool_use",
496
+ "thinking"
497
+ ];
498
+ const DISPLAY_FILTER_DEFAULTS = {
499
+ scheduled_task: true,
500
+ watcher: true,
501
+ bridge: true,
502
+ extension: true,
503
+ page_capture: true,
504
+ synthetic: true,
505
+ tool_use: true,
506
+ thinking: true
507
+ };
508
+ function parseDisplayFilters(raw) {
509
+ if (!raw) return {
510
+ ...DISPLAY_FILTER_DEFAULTS
511
+ };
512
+ try {
513
+ const parsed = JSON.parse(raw);
514
+ // Merge over defaults so newly-added channels stay visible on old rows.
515
+ return {
516
+ ...DISPLAY_FILTER_DEFAULTS,
517
+ ...parsed
518
+ };
519
+ } catch {
520
+ return {
521
+ ...DISPLAY_FILTER_DEFAULTS
522
+ };
523
+ }
524
+ }
525
+ function getAgentDisplayFilters(id) {
526
+ const row = getAgentConfig(id);
527
+ if (!row) return null;
528
+ return parseDisplayFilters(row.display_filters);
529
+ }
530
+ /**
531
+ * Merge a partial filter map into the agent's stored prefs. Pass `null` to
532
+ * reset to defaults (clears the column). Safe against concurrent toggles
533
+ * from multiple browser tabs because the merge happens server-side.
534
+ */ function updateAgentDisplayFilters(id, patch) {
535
+ const row = getAgentConfig(id);
536
+ if (!row) return null;
537
+ if (patch === null) {
538
+ (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("UPDATE agent_configs SET display_filters=NULL, updated_at=? WHERE id=?").run(now(), id);
539
+ return {
540
+ ...DISPLAY_FILTER_DEFAULTS
541
+ };
542
+ }
543
+ const current = parseDisplayFilters(row.display_filters);
544
+ const next = {
545
+ ...current
546
+ };
547
+ for (const k of DISPLAY_FILTER_KEYS){
548
+ if (k in patch && typeof patch[k] === "boolean") next[k] = patch[k];
549
+ }
550
+ (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);
551
+ return next;
552
+ }
553
+
554
+
555
+ /***/ }),
556
+
557
+ /***/ 44708:
558
+ /***/ ((module) => {
559
+
560
+ module.exports = require("node:https");
561
+
562
+ /***/ }),
563
+
564
+ /***/ 44870:
565
+ /***/ ((module) => {
566
+
567
+ module.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js");
568
+
569
+ /***/ }),
570
+
571
+ /***/ 48161:
572
+ /***/ ((module) => {
573
+
574
+ module.exports = require("node:os");
575
+
576
+ /***/ }),
577
+
578
+ /***/ 51455:
579
+ /***/ ((module) => {
580
+
581
+ module.exports = require("node:fs/promises");
582
+
583
+ /***/ }),
584
+
585
+ /***/ 55511:
586
+ /***/ ((module) => {
587
+
588
+ module.exports = require("crypto");
589
+
590
+ /***/ }),
591
+
592
+ /***/ 55591:
593
+ /***/ ((module) => {
594
+
595
+ module.exports = require("https");
596
+
597
+ /***/ }),
598
+
599
+ /***/ 57075:
600
+ /***/ ((module) => {
601
+
602
+ module.exports = require("node:stream");
603
+
604
+ /***/ }),
605
+
606
+ /***/ 57975:
607
+ /***/ ((module) => {
608
+
609
+ module.exports = require("node:util");
610
+
611
+ /***/ }),
612
+
613
+ /***/ 63033:
614
+ /***/ ((module) => {
615
+
616
+ module.exports = require("next/dist/server/app-render/work-unit-async-storage.external.js");
617
+
618
+ /***/ }),
619
+
620
+ /***/ 73024:
621
+ /***/ ((module) => {
622
+
623
+ module.exports = require("node:fs");
624
+
625
+ /***/ }),
626
+
627
+ /***/ 75919:
628
+ /***/ ((module) => {
629
+
630
+ module.exports = require("node:worker_threads");
631
+
632
+ /***/ }),
633
+
634
+ /***/ 76760:
635
+ /***/ ((module) => {
636
+
637
+ module.exports = require("node:path");
638
+
639
+ /***/ }),
640
+
641
+ /***/ 77030:
642
+ /***/ ((module) => {
643
+
644
+ module.exports = require("node:net");
645
+
646
+ /***/ }),
647
+
648
+ /***/ 77598:
649
+ /***/ ((module) => {
650
+
651
+ module.exports = require("node:crypto");
652
+
653
+ /***/ }),
654
+
655
+ /***/ 79428:
656
+ /***/ ((module) => {
657
+
658
+ module.exports = require("buffer");
659
+
660
+ /***/ }),
661
+
662
+ /***/ 80058:
663
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
664
+
665
+ __webpack_require__.r(__webpack_exports__);
666
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
667
+ /* harmony export */ handler: () => (/* binding */ handler),
668
+ /* harmony export */ patchFetch: () => (/* binding */ patchFetch),
669
+ /* harmony export */ routeModule: () => (/* binding */ routeModule),
670
+ /* harmony export */ serverHooks: () => (/* binding */ serverHooks),
671
+ /* harmony export */ workAsyncStorage: () => (/* binding */ workAsyncStorage),
672
+ /* harmony export */ workUnitAsyncStorage: () => (/* binding */ workUnitAsyncStorage)
673
+ /* harmony export */ });
674
+ /* harmony import */ var next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(19225);
675
+ /* 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__);
676
+ /* harmony import */ var next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84006);
677
+ /* harmony import */ var next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8317);
678
+ /* 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__);
679
+ /* harmony import */ var next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(99373);
680
+ /* 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__);
681
+ /* harmony import */ var next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(34775);
682
+ /* 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__);
683
+ /* harmony import */ var next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(24235);
684
+ /* 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__);
685
+ /* harmony import */ var next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(261);
686
+ /* 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__);
687
+ /* harmony import */ var next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(54365);
688
+ /* 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__);
689
+ /* harmony import */ var next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(90771);
690
+ /* 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__);
691
+ /* harmony import */ var next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(73461);
692
+ /* 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__);
693
+ /* harmony import */ var next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(67798);
694
+ /* harmony import */ var next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(92280);
695
+ /* harmony import */ var next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(62018);
696
+ /* 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__);
697
+ /* harmony import */ var next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(45696);
698
+ /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(47929);
699
+ /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__);
700
+ /* harmony import */ var next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(86439);
701
+ /* 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__);
702
+ /* harmony import */ var next_dist_server_lib_route_cache_key__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(10246);
703
+ /* 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__);
704
+ /* harmony import */ var next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(37527);
705
+ /* 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__);
706
+
707
+
708
+
709
+
710
+
711
+
712
+
713
+
714
+
715
+
716
+
717
+
718
+
719
+
720
+
721
+
722
+
723
+
724
+ // We inject the nextConfigOutput here so that we can use them in the route
725
+ // module.
726
+ const nextConfigOutput = "standalone"
727
+ const routeModule = new next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__.AppRouteRouteModule({
728
+ definition: {
729
+ kind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
730
+ page: "/api/v1/threads/route",
731
+ pathname: "/api/v1/threads",
732
+ filename: "route",
733
+ bundlePath: "app/api/v1/threads/route"
734
+ },
735
+ distDir: ".next" || 0,
736
+ relativeProjectDir: false || '',
737
+ resolvedPagePath: "/home/runner/work/jarela/jarela/app/api/v1/threads/route.ts",
738
+ nextConfigOutput,
739
+ // The lazy require factory ensures that:
740
+ // - In dev: devRequestTimingInternalsEnd is set before userland executes,
741
+ // correctly attributing module load time to application-code rather than
742
+ // framework internals.
743
+ // - In all modes: async modules (route files with top-level await) are
744
+ // handled correctly — require() returns a Promise for such modules, which
745
+ // ensureUserland() awaits before the first request is handled.
746
+ userland: ()=>__webpack_require__(36766),
747
+ // In Turbopack dev mode, also provide a synchronous per-request getter so
748
+ // server HMR updates are picked up without re-executing the entry chunk.
749
+ // Using require() (synchronous) avoids adding async overhead that would be
750
+ // incorrectly attributed to application-code time in devRequestTiming.
751
+ ... false ? 0 : {}
752
+ });
753
+ // Pull out the exports that we need to expose from the module. This should
754
+ // be eliminated when we've moved the other routes to the new format. These
755
+ // are used to hook into the route.
756
+ const { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;
757
+ function patchFetch() {
758
+ return (0,next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__.patchFetch)({
759
+ workAsyncStorage,
760
+ workUnitAsyncStorage
761
+ });
762
+ }
763
+
764
+ async function handler(req, res, ctx) {
765
+ if (ctx.requestMeta) {
766
+ (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.setRequestMeta)(req, ctx.requestMeta);
767
+ }
768
+ if (routeModule.isDev) {
769
+ (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.addRequestMeta)(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());
770
+ }
771
+ let srcPage = "/api/v1/threads/route";
772
+ // turbopack doesn't normalize `/index` in the page name
773
+ // so we need to to process dynamic routes properly
774
+ // TODO: fix turbopack providing differing value from webpack
775
+ if (false) {} else if (srcPage === '/index') {
776
+ // we always normalize /index specifically
777
+ srcPage = '/';
778
+ }
779
+ const multiZoneDraftMode = false;
780
+ const prepareResult = await routeModule.prepare(req, res, {
781
+ srcPage,
782
+ multiZoneDraftMode
783
+ });
784
+ if (!prepareResult) {
785
+ res.statusCode = 400;
786
+ res.end('Bad Request');
787
+ ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());
788
+ return null;
789
+ }
790
+ const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest, previewProps } = prepareResult;
791
+ const normalizedSrcPage = (0,next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__.normalizeAppPath)(srcPage);
792
+ // Only this route's prerenders can establish ISR or admit generated params.
793
+ 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]));
794
+ let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || isPrerendered);
795
+ const render404 = async ()=>{
796
+ // TODO: should route-module itself handle rendering the 404
797
+ if (routerServerContext == null ? void 0 : routerServerContext.render404) {
798
+ await routerServerContext.render404(req, res, parsedUrl, false);
799
+ } else {
800
+ res.end('This page could not be found');
801
+ }
802
+ return null;
803
+ };
804
+ if (isIsr && !isDraftMode) {
805
+ const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];
806
+ if (prerenderInfo) {
807
+ if (prerenderInfo.fallback === false && !isPrerendered) {
808
+ if (nextConfig.adapterPath) {
809
+ return await render404();
810
+ }
811
+ throw new next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError();
812
+ }
813
+ }
814
+ }
815
+ let cacheKey = null;
816
+ if (isIsr && !routeModule.isDev && !isDraftMode) {
817
+ cacheKey = resolvedPathname;
818
+ // ensure /index and / is normalized to one key
819
+ cacheKey = cacheKey === '/index' ? '/' : cacheKey;
820
+ }
821
+ // Before rendering (which initializes component tree modules), we have to
822
+ // set the reference manifests to our global store so Server Action's
823
+ // encryption util can access to them at the top level of the page module.
824
+ if (serverActionsManifest && clientReferenceManifest) {
825
+ (0,next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__.setManifestsSingleton)({
826
+ page: srcPage,
827
+ clientReferenceManifest,
828
+ serverActionsManifest
829
+ });
830
+ }
831
+ const method = req.method || 'GET';
832
+ const tracer = (0,next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.getTracer)();
833
+ const activeSpan = tracer.getActiveScopeSpan();
834
+ const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);
835
+ const isMinimalMode = Boolean((0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'minimalMode'));
836
+ const incrementalCache = (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, previewProps, prerenderManifest, isMinimalMode);
837
+ incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();
838
+ globalThis.__incrementalCache = incrementalCache;
839
+ const context = {
840
+ params,
841
+ previewProps,
842
+ renderOpts: {
843
+ experimental: {
844
+ authInterrupts: Boolean(nextConfig.experimental.authInterrupts),
845
+ useCacheTimeout: nextConfig.experimental.useCacheTimeout,
846
+ durableUseCacheEntries: Boolean(nextConfig.experimental.durableUseCacheEntries)
847
+ },
848
+ cacheComponents: Boolean(nextConfig.cacheComponents),
849
+ validationLevel: nextConfig.experimental.instantInsights.validationLevel,
850
+ isDraftMode,
851
+ incrementalCache,
852
+ hmrRefreshHash: (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'hmrRefreshHash'),
853
+ cacheLifeProfiles: nextConfig.cacheLife,
854
+ staticPageGenerationTimeout: nextConfig.staticPageGenerationTimeout,
855
+ waitUntil: ctx.waitUntil,
856
+ onClose: (cb)=>{
857
+ res.on('close', cb);
858
+ },
859
+ onAfterTaskError: undefined
860
+ },
861
+ sharedContext: {
862
+ buildId,
863
+ deploymentId
864
+ }
865
+ };
866
+ const nodeNextReq = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextRequest(req);
867
+ const nodeNextRes = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextResponse(res);
868
+ 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));
869
+ const responseGenerator = async ({ previousCacheEntry })=>{
870
+ try {
871
+ if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {
872
+ res.statusCode = 404;
873
+ // on-demand revalidate always sets this header
874
+ res.setHeader('x-nextjs-cache', 'REVALIDATED');
875
+ res.end('This page could not be found');
876
+ return null;
877
+ }
878
+ const response = cacheKey === null ? await routeModule.handle(nextReq, context) : await routeModule.prerender(nextReq, context);
879
+ req.fetchMetrics = context.renderOpts.fetchMetrics;
880
+ let pendingWaitUntil = context.renderOpts.pendingWaitUntil;
881
+ // Attempt using provided waitUntil if available
882
+ // if it's not we fallback to sendResponse's handling
883
+ if (pendingWaitUntil) {
884
+ if (ctx.waitUntil) {
885
+ ctx.waitUntil(pendingWaitUntil);
886
+ pendingWaitUntil = undefined;
887
+ }
888
+ }
889
+ const cacheTags = context.renderOpts.collectedTags;
890
+ // If the request is for a static response, we can cache it so long
891
+ // as it's not edge.
892
+ if (isIsr) {
893
+ const blob = await response.blob();
894
+ // Copy the headers from the response.
895
+ const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.toNodeOutgoingHttpHeaders)(response.headers);
896
+ if (cacheTags) {
897
+ headers[next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER] = cacheTags;
898
+ }
899
+ if (!headers['content-type'] && blob.type) {
900
+ headers['content-type'] = blob.type;
901
+ }
902
+ const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;
903
+ 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
904
+ // explicit `expire` (e.g. via `cacheLife`). This mirrors the
905
+ // build-time fallback in `build/index.ts` so cache entries
906
+ // and the response Cache-Control header agree on the route's
907
+ // effective expire. Routes that opt out of revalidation
908
+ // (`revalidate: false`) or that are dynamic (`revalidate: 0`)
909
+ // keep `expire: undefined`.
910
+ revalidate !== false && revalidate > 0 ? nextConfig.expireTime : undefined : context.renderOpts.collectedExpire;
911
+ // Create the cache entry for the response.
912
+ const cacheEntry = {
913
+ value: {
914
+ kind: next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__.CachedRouteKind.APP_ROUTE,
915
+ status: response.status,
916
+ body: Buffer.from(await blob.arrayBuffer()),
917
+ headers
918
+ },
919
+ cacheControl: {
920
+ revalidate,
921
+ expire
922
+ }
923
+ };
924
+ return cacheEntry;
925
+ } else {
926
+ // send response without caching if not ISR
927
+ await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, response, pendingWaitUntil);
928
+ return null;
929
+ }
930
+ } catch (err) {
931
+ // if this is a background revalidate we need to report
932
+ // the request error here as it won't be bubbled
933
+ if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {
934
+ const silenceLog = false;
935
+ await routeModule.onRequestError(req, err, {
936
+ routerKind: 'App Router',
937
+ routePath: srcPage,
938
+ routeType: 'route',
939
+ revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
940
+ isStaticGeneration: cacheKey !== null,
941
+ isOnDemandRevalidate
942
+ })
943
+ }, silenceLog, routerServerContext);
944
+ }
945
+ throw err;
946
+ }
947
+ };
948
+ const handleResponse = async (currentSpan, parentSpan)=>{
949
+ try {
950
+ var _cacheEntry_value;
951
+ const cacheEntry = await routeModule.handleResponse({
952
+ req,
953
+ nextConfig,
954
+ cacheKey,
955
+ routeKind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
956
+ isFallback: false,
957
+ previewProps,
958
+ prerenderManifest,
959
+ isRoutePPREnabled: false,
960
+ isOnDemandRevalidate,
961
+ revalidateOnlyGenerated,
962
+ responseGenerator,
963
+ waitUntil: ctx.waitUntil,
964
+ isMinimalMode
965
+ });
966
+ if (cacheEntry !== null && 'error' in cacheEntry) {
967
+ throw cacheEntry.error;
968
+ }
969
+ // we don't create a cacheEntry for ISR
970
+ if (!isIsr) {
971
+ return;
972
+ }
973
+ 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) {
974
+ var _cacheEntry_value1;
975
+ throw new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`);
976
+ }
977
+ if (!isMinimalMode) {
978
+ res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');
979
+ }
980
+ // Draft mode should never be cached
981
+ if (isDraftMode) {
982
+ res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');
983
+ }
984
+ const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers);
985
+ if (!(isMinimalMode && isIsr)) {
986
+ headers.delete(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER);
987
+ }
988
+ // If cache control is already set on the response we don't
989
+ // override it to allow users to customize it via next.config
990
+ if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {
991
+ headers.set('Cache-Control', (0,next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__.getCacheControlHeader)(cacheEntry.cacheControl));
992
+ }
993
+ 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'.
994
+ new Response(cacheEntry.value.body, {
995
+ headers,
996
+ status: cacheEntry.value.status || 200
997
+ }));
998
+ return;
999
+ } catch (err) {
1000
+ if (!(err instanceof next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError)) {
1001
+ const silenceLog = false;
1002
+ await routeModule.onRequestError(req, err, {
1003
+ routerKind: 'App Router',
1004
+ routePath: normalizedSrcPage,
1005
+ routeType: 'route',
1006
+ revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
1007
+ isStaticGeneration: cacheKey !== null,
1008
+ isOnDemandRevalidate
1009
+ })
1010
+ }, silenceLog, routerServerContext);
1011
+ }
1012
+ // rethrow so that we can handle serving error page
1013
+ // If this is during static generation, throw the error again.
1014
+ if (isIsr) throw err;
1015
+ // Otherwise, send a 500 response unless the original response has
1016
+ // already committed. In that case, preserve its status code for
1017
+ // telemetry while still recording the failure and terminating a response
1018
+ // that the failed pipeline left open.
1019
+ if (res.headersSent) {
1020
+ if (currentSpan) {
1021
+ const error = err instanceof Error ? err : new Error('Unknown app route error');
1022
+ currentSpan.recordException(error);
1023
+ currentSpan.setStatus({
1024
+ code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR,
1025
+ message: error.message
1026
+ });
1027
+ currentSpan.setAttribute('error.type', error.name);
1028
+ }
1029
+ if (!res.writableEnded && !res.destroyed) {
1030
+ res.end();
1031
+ }
1032
+ } else {
1033
+ await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, new Response(null, {
1034
+ status: 500
1035
+ }));
1036
+ }
1037
+ return;
1038
+ } finally{
1039
+ ;
1040
+ (()=>{
1041
+ if (!currentSpan) {
1042
+ return;
1043
+ }
1044
+ let statusCode = res.statusCode;
1045
+ currentSpan.setAttributes({
1046
+ 'http.status_code': statusCode,
1047
+ 'next.rsc': false
1048
+ });
1049
+ if (statusCode && statusCode >= 500) {
1050
+ // For 5xx status codes: SHOULD be set to 'Error' span status.
1051
+ // x-ref: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
1052
+ currentSpan.setStatus({
1053
+ code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR
1054
+ });
1055
+ // For span status 'Error', SHOULD set 'error.type' attribute.
1056
+ currentSpan.setAttribute('error.type', statusCode.toString());
1057
+ }
1058
+ const rootSpanAttributes = tracer.getRootSpanAttributes();
1059
+ // We were unable to get attributes, probably OTEL is not enabled
1060
+ if (!rootSpanAttributes) {
1061
+ return;
1062
+ }
1063
+ if (rootSpanAttributes.get('next.span_type') !== next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest) {
1064
+ console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);
1065
+ return;
1066
+ }
1067
+ const route = rootSpanAttributes.get('next.route') || normalizedSrcPage;
1068
+ const name = `${method} ${route}`;
1069
+ currentSpan.setAttributes({
1070
+ 'next.route': route,
1071
+ 'http.route': route,
1072
+ 'next.span_name': name
1073
+ });
1074
+ currentSpan.updateName(name);
1075
+ // Propagate http.route to the parent span if one exists (e.g.
1076
+ // a platform-created HTTP span in adapter deployments).
1077
+ if (parentSpan && parentSpan !== currentSpan) {
1078
+ parentSpan.setAttribute('http.route', route);
1079
+ parentSpan.updateName(name);
1080
+ }
1081
+ })();
1082
+ }
985
1083
  };
986
- for (const k of DISPLAY_FILTER_KEYS){
987
- if (k in patch && typeof patch[k] === "boolean") next[k] = patch[k];
1084
+ // TODO: activeSpan code path is for when wrapped by
1085
+ // next-server can be removed when this is no longer used
1086
+ if (isWrappedByNextServer && activeSpan) {
1087
+ await handleResponse(activeSpan, undefined);
1088
+ } else {
1089
+ let parentSpan = tracer.getActiveScopeSpan();
1090
+ await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest, {
1091
+ spanName: `${method} ${srcPage}`,
1092
+ kind: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanKind.SERVER,
1093
+ attributes: {
1094
+ 'http.method': method,
1095
+ 'http.target': req.url
1096
+ }
1097
+ }, (span)=>handleResponse(span, parentSpan)), undefined, !isWrappedByNextServer);
988
1098
  }
989
- (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);
990
- return next;
991
1099
  }
992
1100
 
1101
+ //# sourceMappingURL=app-route.js.map
993
1102
 
994
- /***/ }),
995
-
996
- /***/ 44708:
997
- /***/ ((module) => {
998
-
999
- module.exports = require("node:https");
1000
-
1001
- /***/ }),
1002
-
1003
- /***/ 44870:
1004
- /***/ ((module) => {
1005
-
1006
- module.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js");
1007
-
1008
- /***/ }),
1009
-
1010
- /***/ 48161:
1011
- /***/ ((module) => {
1012
-
1013
- module.exports = require("node:os");
1014
-
1015
- /***/ }),
1016
-
1017
- /***/ 51455:
1018
- /***/ ((module) => {
1019
-
1020
- module.exports = require("node:fs/promises");
1021
-
1022
- /***/ }),
1023
-
1024
- /***/ 55511:
1025
- /***/ ((module) => {
1026
-
1027
- module.exports = require("crypto");
1028
-
1029
- /***/ }),
1030
-
1031
- /***/ 55591:
1032
- /***/ ((module) => {
1033
-
1034
- module.exports = require("https");
1035
-
1036
- /***/ }),
1037
-
1038
- /***/ 57075:
1039
- /***/ ((module) => {
1040
-
1041
- module.exports = require("node:stream");
1042
-
1043
- /***/ }),
1044
-
1045
- /***/ 57975:
1046
- /***/ ((module) => {
1047
-
1048
- module.exports = require("node:util");
1049
-
1050
- /***/ }),
1051
-
1052
- /***/ 63033:
1053
- /***/ ((module) => {
1054
-
1055
- module.exports = require("next/dist/server/app-render/work-unit-async-storage.external.js");
1056
-
1057
- /***/ }),
1058
-
1059
- /***/ 73024:
1060
- /***/ ((module) => {
1061
-
1062
- module.exports = require("node:fs");
1063
-
1064
- /***/ }),
1065
-
1066
- /***/ 75919:
1067
- /***/ ((module) => {
1068
-
1069
- module.exports = require("node:worker_threads");
1070
-
1071
- /***/ }),
1072
-
1073
- /***/ 76760:
1074
- /***/ ((module) => {
1075
-
1076
- module.exports = require("node:path");
1077
-
1078
- /***/ }),
1079
-
1080
- /***/ 77598:
1081
- /***/ ((module) => {
1082
-
1083
- module.exports = require("node:crypto");
1084
-
1085
- /***/ }),
1086
-
1087
- /***/ 79428:
1088
- /***/ ((module) => {
1089
-
1090
- module.exports = require("buffer");
1091
1103
 
1092
1104
  /***/ }),
1093
1105
 
@@ -1140,7 +1152,7 @@ module.exports = import("@huggingface/transformers");;
1140
1152
  var __webpack_require__ = require("../../../../webpack-runtime.js");
1141
1153
  __webpack_require__.C(exports);
1142
1154
  var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
1143
- var __webpack_exports__ = __webpack_require__.X(0, [2970,7377,1813,7981,4992,46,3042], () => (__webpack_exec__(27823)));
1155
+ var __webpack_exports__ = __webpack_require__.X(0, [2970,7377,1813,7981,4992,46,3042], () => (__webpack_exec__(80058)));
1144
1156
  module.exports = __webpack_exports__;
1145
1157
 
1146
1158
  })();