@circuitwall/jarela 2.2.1 → 2.3.0

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