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