@circuitwall/jarela 2.2.1 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (703) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-path-routes-manifest.json +2 -1
  3. package/.next/standalone/.next/build-manifest.json +2 -2
  4. package/.next/standalone/.next/prerender-manifest.json +3 -3
  5. package/.next/standalone/.next/routes-manifest.json +8 -0
  6. package/.next/standalone/.next/server/app/_global-error/page.js +68 -68
  7. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_not-found/page.js +76 -76
  14. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/standalone/.next/server/app/_not-found.html +2 -2
  16. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  17. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  18. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  19. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  20. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  21. package/.next/standalone/.next/server/app/api/v1/access/[identity]/route.js +100 -93
  22. package/.next/standalone/.next/server/app/api/v1/access/route.js +176 -169
  23. package/.next/standalone/.next/server/app/api/v1/agents/[id]/compact/route.js +89 -56
  24. package/.next/standalone/.next/server/app/api/v1/agents/[id]/compact/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/api/v1/agents/[id]/display-filters/route.js +139 -127
  26. package/.next/standalone/.next/server/app/api/v1/agents/[id]/route.js +107 -100
  27. package/.next/standalone/.next/server/app/api/v1/agents/[id]/thread/route.js +765 -753
  28. package/.next/standalone/.next/server/app/api/v1/agents/route.js +72 -65
  29. package/.next/standalone/.next/server/app/api/v1/allowed-sites/[hostname]/route.js +371 -364
  30. package/.next/standalone/.next/server/app/api/v1/allowed-sites/route.js +809 -802
  31. package/.next/standalone/.next/server/app/api/v1/artifacts/lifecycle/route.js +9 -2
  32. package/.next/standalone/.next/server/app/api/v1/attachments/files/route.js +49 -49
  33. package/.next/standalone/.next/server/app/api/v1/attachments/images/route.js +910 -910
  34. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js +583 -16
  35. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/ignores/[remote_jid]/route.js +41 -30
  37. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/ignores/route.js +48 -37
  38. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js +697 -130
  39. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js.nft.json +1 -1
  40. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js +703 -136
  41. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js +796 -229
  43. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/routes/[route_id]/route.js +762 -746
  45. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/routes/route.js +1050 -1034
  46. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js +673 -106
  47. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/api/v1/bridges/kinds/route.js +811 -804
  49. package/.next/standalone/.next/server/app/api/v1/bridges/kinds/route.js.nft.json +1 -1
  50. package/.next/standalone/.next/server/app/api/v1/bridges/route.js +718 -706
  51. package/.next/standalone/.next/server/app/api/v1/bridges/route.js.nft.json +1 -1
  52. package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js +9 -9
  53. package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js.nft.json +1 -1
  54. package/.next/standalone/.next/server/app/api/v1/config/route.js +85 -85
  55. package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js +709 -709
  56. package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js.nft.json +1 -1
  57. package/.next/standalone/.next/server/app/api/v1/credentials/route.js +2 -2
  58. package/.next/standalone/.next/server/app/api/v1/credentials/route.js.nft.json +1 -1
  59. package/.next/standalone/.next/server/app/api/v1/dashboard/currency/route.js +10 -10
  60. package/.next/standalone/.next/server/app/api/v1/dashboard/metrics/route.js +796 -784
  61. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing/route.js +30 -23
  62. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js +86 -86
  63. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js.nft.json +1 -1
  64. package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js +57 -57
  65. package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js.nft.json +1 -1
  66. package/.next/standalone/.next/server/app/api/v1/documents/search/route.js +385 -378
  67. package/.next/standalone/.next/server/app/api/v1/documents/settings/route.js +51 -44
  68. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js +65 -65
  69. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js.nft.json +1 -1
  70. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js +122 -122
  71. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js.nft.json +1 -1
  72. package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js +37 -37
  73. package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js.nft.json +1 -1
  74. package/.next/standalone/.next/server/app/api/v1/env/route.js +9 -9
  75. package/.next/standalone/.next/server/app/api/v1/env-sync/allowlist/route.js +375 -368
  76. package/.next/standalone/.next/server/app/api/v1/env-sync/route.js +51 -44
  77. package/.next/standalone/.next/server/app/api/v1/events/route.js +745 -178
  78. package/.next/standalone/.next/server/app/api/v1/events/route.js.nft.json +1 -1
  79. package/.next/standalone/.next/server/app/api/v1/events/test/route.js +77 -77
  80. package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js +763 -763
  81. package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js.nft.json +1 -1
  82. package/.next/standalone/.next/server/app/api/v1/extension/browser/activate/route.js +51 -44
  83. package/.next/standalone/.next/server/app/api/v1/extension/browser/foreground/route.js +16 -9
  84. package/.next/standalone/.next/server/app/api/v1/extension/browser/history/route.js +72 -65
  85. package/.next/standalone/.next/server/app/api/v1/extension/browser/poll/route.js +41 -34
  86. package/.next/standalone/.next/server/app/api/v1/extension/browser/progress/route.js +211 -204
  87. package/.next/standalone/.next/server/app/api/v1/extension/browser/result/route.js +140 -133
  88. package/.next/standalone/.next/server/app/api/v1/extension/browser/retry/route.js +113 -106
  89. package/.next/standalone/.next/server/app/api/v1/extension/browser/status/route.js +121 -114
  90. package/.next/standalone/.next/server/app/api/v1/extension/browser/tabs/route.js +141 -134
  91. package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js +690 -690
  92. package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js.nft.json +1 -1
  93. package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js +93 -93
  94. package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js.nft.json +1 -1
  95. package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js +9 -9
  96. package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js.nft.json +1 -1
  97. package/.next/standalone/.next/server/app/api/v1/extensions/route.js +185 -185
  98. package/.next/standalone/.next/server/app/api/v1/extensions/route.js.nft.json +1 -1
  99. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js +171 -171
  100. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js.nft.json +1 -1
  101. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js +396 -396
  102. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js.nft.json +1 -1
  103. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js +212 -212
  104. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js.nft.json +1 -1
  105. package/.next/standalone/.next/server/app/api/v1/files/[name]/route.js +235 -235
  106. package/.next/standalone/.next/server/app/api/v1/fs/browse/route.js +26 -26
  107. package/.next/standalone/.next/server/app/api/v1/harnesses/[id]/route.js +228 -221
  108. package/.next/standalone/.next/server/app/api/v1/harnesses/default/route.js +65 -58
  109. package/.next/standalone/.next/server/app/api/v1/harnesses/route.js +79 -72
  110. package/.next/standalone/.next/server/app/api/v1/health/probes/route.js +9 -9
  111. package/.next/standalone/.next/server/app/api/v1/health/probes/route.js.nft.json +1 -1
  112. package/.next/standalone/.next/server/app/api/v1/health/route.js +783 -771
  113. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/route.js +140 -133
  114. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js +9 -9
  115. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js.nft.json +1 -1
  116. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/callback/route.js +370 -363
  117. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/start/route.js +240 -233
  118. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/status/route.js +689 -682
  119. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/callback/route.js +886 -879
  120. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/start/route.js +115 -108
  121. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/status/route.js +955 -948
  122. package/.next/standalone/.next/server/app/api/v1/integrations/route.js +223 -216
  123. package/.next/standalone/.next/server/app/api/v1/lifecycle/adoption/route.js +876 -847
  124. package/.next/standalone/.next/server/app/api/v1/lifecycle/adoption/route.js.nft.json +1 -1
  125. package/.next/standalone/.next/server/app/api/v1/local-file/route.js +26 -26
  126. package/.next/standalone/.next/server/app/api/v1/logs/route.js +70 -70
  127. package/.next/standalone/.next/server/app/api/v1/maps/embed/route.js +79 -72
  128. package/.next/standalone/.next/server/app/api/v1/mcp-servers/[name]/route.js +991 -979
  129. package/.next/standalone/.next/server/app/api/v1/mcp-servers/registry/route.js +196 -196
  130. package/.next/standalone/.next/server/app/api/v1/mcp-servers/route.js +19 -7
  131. package/.next/standalone/.next/server/app/api/v1/memory/[namespace]/[key]/route.js +539 -532
  132. package/.next/standalone/.next/server/app/api/v1/memory/policy/route.js +86 -79
  133. package/.next/standalone/.next/server/app/api/v1/memory/route.js +58 -51
  134. package/.next/standalone/.next/server/app/api/v1/memory/search/route.js +138 -131
  135. package/.next/standalone/.next/server/app/api/v1/models/[name]/compact-threads/route.js +381 -369
  136. package/.next/standalone/.next/server/app/api/v1/models/[name]/compact-threads/route.js.nft.json +1 -1
  137. package/.next/standalone/.next/server/app/api/v1/models/[name]/route.js +150 -143
  138. package/.next/standalone/.next/server/app/api/v1/models/route.js +634 -627
  139. package/.next/standalone/.next/server/app/api/v1/packages/catalog/route.js +445 -445
  140. package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js +120 -120
  141. package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js.nft.json +1 -1
  142. package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js +234 -234
  143. package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js.nft.json +1 -1
  144. package/.next/standalone/.next/server/app/api/v1/packages/install/route.js +407 -407
  145. package/.next/standalone/.next/server/app/api/v1/packages/install/route.js.nft.json +1 -1
  146. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js +37 -37
  147. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js.nft.json +1 -1
  148. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js +107 -107
  149. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js.nft.json +1 -1
  150. package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js +228 -228
  151. package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js.nft.json +1 -1
  152. package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js +9 -9
  153. package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js.nft.json +1 -1
  154. package/.next/standalone/.next/server/app/api/v1/packages/route.js +148 -148
  155. package/.next/standalone/.next/server/app/api/v1/packages/route.js.nft.json +1 -1
  156. package/.next/standalone/.next/server/app/api/v1/page-capture/route.js +787 -787
  157. package/.next/standalone/.next/server/app/api/v1/page-capture/route.js.nft.json +1 -1
  158. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js +529 -514
  159. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js.nft.json +1 -1
  160. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js +181 -181
  161. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js.nft.json +1 -1
  162. package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js +258 -258
  163. package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js.nft.json +1 -1
  164. package/.next/standalone/.next/server/app/api/v1/profile/location/route.js +37 -30
  165. package/.next/standalone/.next/server/app/api/v1/profile/route.js +171 -164
  166. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/models/route.js +51 -44
  167. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/probe/route.js +15 -8
  168. package/.next/standalone/.next/server/app/api/v1/providers/github-copilot/auth/route.js +171 -164
  169. package/.next/standalone/.next/server/app/api/v1/providers/route.js +101 -94
  170. package/.next/standalone/.next/server/app/api/v1/proxy-config/route.js +457 -450
  171. package/.next/standalone/.next/server/app/api/v1/redaction/init/route.js +44 -37
  172. package/.next/standalone/.next/server/app/api/v1/redaction/route.js +65 -58
  173. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/route.js +617 -605
  174. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js +44 -44
  175. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js.nft.json +1 -1
  176. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/route.js +739 -732
  177. package/.next/standalone/.next/server/app/api/v1/security/idle-timeout/route.js +329 -322
  178. package/.next/standalone/.next/server/app/api/v1/security/pin/route.js +204 -197
  179. package/.next/standalone/.next/server/app/api/v1/security/state/route.js +58 -51
  180. package/.next/standalone/.next/server/app/api/v1/security/unlock/route.js +183 -176
  181. package/.next/standalone/.next/server/app/api/v1/security/verify-pin/route.js +194 -187
  182. package/.next/standalone/.next/server/app/api/v1/setup/test-key/route.js +26 -26
  183. package/.next/standalone/.next/server/app/api/v1/skills/[id]/route.js +776 -769
  184. package/.next/standalone/.next/server/app/api/v1/skills/repos/[id]/route.js +122 -115
  185. package/.next/standalone/.next/server/app/api/v1/skills/repos/route.js +334 -327
  186. package/.next/standalone/.next/server/app/api/v1/skills/route.js +873 -866
  187. package/.next/standalone/.next/server/app/api/v1/system/abort/route.js +838 -808
  188. package/.next/standalone/.next/server/app/api/v1/system/restart/route.js +177 -177
  189. package/.next/standalone/.next/server/app/api/v1/system/restart/route.js.nft.json +1 -1
  190. package/.next/standalone/.next/server/app/api/v1/tailscale/route.js +164 -164
  191. package/.next/standalone/.next/server/app/api/v1/tasks/[agent_id]/route.js +122 -115
  192. package/.next/standalone/.next/server/app/api/v1/tasks/route.js +30 -23
  193. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route.js +1436 -0
  194. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route.js.nft.json +1 -0
  195. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route_client-reference-manifest.js +1 -0
  196. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/context-pin/route.js +638 -631
  197. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/context-pin/route.js.nft.json +1 -1
  198. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/route.js +60 -439
  199. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/route.js.nft.json +1 -1
  200. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js +172 -173
  201. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js.nft.json +1 -1
  202. package/.next/standalone/.next/server/app/api/v1/threads/route.js +925 -913
  203. package/.next/standalone/.next/server/app/api/v1/tools/route.js +2 -2
  204. package/.next/standalone/.next/server/app/api/v1/tools/route.js.nft.json +1 -1
  205. package/.next/standalone/.next/server/app/api/v1/update/apply/route.js +17 -17
  206. package/.next/standalone/.next/server/app/api/v1/update/apply/route.js.nft.json +1 -1
  207. package/.next/standalone/.next/server/app/api/v1/update/route.js +570 -570
  208. package/.next/standalone/.next/server/app/api/v1/voice/transcribe/route.js +241 -229
  209. package/.next/standalone/.next/server/app/api/v1/voice/tts/route.js +989 -977
  210. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/route.js +40 -28
  211. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js +72 -72
  212. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js.nft.json +1 -1
  213. package/.next/standalone/.next/server/app/api/v1/watchers/reaction-scripts/route.js +128 -128
  214. package/.next/standalone/.next/server/app/api/v1/watchers/route.js +164 -164
  215. package/.next/standalone/.next/server/app/api/v1/watchers/route.js.nft.json +1 -1
  216. package/.next/standalone/.next/server/app/icon.svg/route.js +62 -62
  217. package/.next/standalone/.next/server/app/manifest.webmanifest/route.js +436 -436
  218. package/.next/standalone/.next/server/app/page.js +1179 -743
  219. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  220. package/.next/standalone/.next/server/app/setup/page.js +99 -91
  221. package/.next/standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  222. package/.next/standalone/.next/server/app-paths-manifest.json +2 -1
  223. package/.next/standalone/.next/server/chunks/{424.js → 1388.js} +441 -1022
  224. package/.next/standalone/.next/server/chunks/1433.js +1 -1
  225. package/.next/standalone/.next/server/chunks/1638.js +1 -2
  226. package/.next/standalone/.next/server/chunks/1738.js +1 -1
  227. package/.next/standalone/.next/server/chunks/2068.js +47 -10
  228. package/.next/standalone/.next/server/chunks/210.js +3 -3
  229. package/.next/standalone/.next/server/chunks/2151.js +31 -1
  230. package/.next/standalone/.next/server/chunks/2207.js +1 -0
  231. package/.next/standalone/.next/server/chunks/2447.js +10 -5
  232. package/.next/standalone/.next/server/chunks/2471.js +45 -45
  233. package/.next/standalone/.next/server/chunks/2504.js +1 -1
  234. package/.next/standalone/.next/server/chunks/2695.js +17 -17
  235. package/.next/standalone/.next/server/chunks/3042.js +24 -16
  236. package/.next/standalone/.next/server/chunks/{4540.js → 309.js} +104 -38
  237. package/.next/standalone/.next/server/chunks/{2350.js → 3272.js} +104 -37
  238. package/.next/standalone/.next/server/chunks/3399.js +526 -526
  239. package/.next/standalone/.next/server/chunks/3524.js +150 -67
  240. package/.next/standalone/.next/server/chunks/3566.js +1 -1
  241. package/.next/standalone/.next/server/chunks/4189.js +946 -0
  242. package/.next/standalone/.next/server/chunks/4433.js +146 -146
  243. package/.next/standalone/.next/server/chunks/4508.js +3 -3
  244. package/.next/standalone/.next/server/chunks/4588.js +1 -0
  245. package/.next/standalone/.next/server/chunks/46.js +78 -28
  246. package/.next/standalone/.next/server/chunks/466.js +12 -0
  247. package/.next/standalone/.next/server/chunks/4868.js +206 -206
  248. package/.next/standalone/.next/server/chunks/4992.js +13 -0
  249. package/.next/standalone/.next/server/chunks/5120.js +963 -0
  250. package/.next/standalone/.next/server/chunks/5701.js +1 -1
  251. package/.next/standalone/.next/server/chunks/5900.js +1 -1
  252. package/.next/standalone/.next/server/chunks/5908.js +63 -42
  253. package/.next/standalone/.next/server/chunks/6142.js +10 -2
  254. package/.next/standalone/.next/server/chunks/6210.js +1 -0
  255. package/.next/standalone/.next/server/chunks/6213.js +1 -1
  256. package/.next/standalone/.next/server/chunks/6649.js +3 -3
  257. package/.next/standalone/.next/server/chunks/6703.js +3 -3
  258. package/.next/standalone/.next/server/chunks/7445.js +1 -0
  259. package/.next/standalone/.next/server/chunks/8067.js +12 -0
  260. package/.next/standalone/.next/server/chunks/8461.js +24 -17
  261. package/.next/standalone/.next/server/chunks/8558.js +1 -1
  262. package/.next/standalone/.next/server/chunks/8724.js +1 -1
  263. package/.next/standalone/.next/server/chunks/8849.js +91 -91
  264. package/.next/standalone/.next/server/chunks/9032.js +4 -3
  265. package/.next/standalone/.next/server/chunks/{2563.js → 9164.js} +33389 -31418
  266. package/.next/standalone/.next/server/chunks/9237.js +396 -396
  267. package/.next/standalone/.next/server/chunks/{9640.js → 9304.js} +1672 -575
  268. package/.next/standalone/.next/server/chunks/9406.js +1 -1
  269. package/.next/standalone/.next/server/chunks/9590.js +68 -18
  270. package/.next/standalone/.next/server/chunks/9824.js +98 -98
  271. package/.next/standalone/.next/server/chunks/9826.js +1 -0
  272. package/.next/standalone/.next/server/middleware-build-manifest.js +2 -2
  273. package/.next/standalone/.next/server/middleware.js +486 -415
  274. package/.next/standalone/.next/server/pages/404.html +2 -2
  275. package/.next/standalone/.next/server/pages/500.html +1 -1
  276. package/.next/standalone/.next/server/preview-props.json +3 -3
  277. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  278. package/.next/standalone/.next/static/chunks/{1395-a340fb0a345382a4.js → 1395-e4a99912b8f83044.js} +13 -1
  279. package/.next/standalone/.next/static/chunks/app/_global-error/{page-36cb8b428b38b26a.js → page-6fc5f8e744c81802.js} +1 -1
  280. package/.next/standalone/.next/static/chunks/app/api/v1/access/[identity]/{route-36cb8b428b38b26a.js → route-6fc5f8e744c81802.js} +1 -1
  281. package/.next/standalone/.next/static/chunks/app/api/v1/access/{route-36cb8b428b38b26a.js → route-6fc5f8e744c81802.js} +1 -1
  282. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/compact/{route-36cb8b428b38b26a.js → route-6fc5f8e744c81802.js} +1 -1
  283. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/display-filters/route-6fc5f8e744c81802.js +17 -0
  284. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/route-6fc5f8e744c81802.js +17 -0
  285. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/thread/route-6fc5f8e744c81802.js +17 -0
  286. package/.next/standalone/.next/static/chunks/app/api/v1/agents/route-6fc5f8e744c81802.js +17 -0
  287. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/[hostname]/route-6fc5f8e744c81802.js +17 -0
  288. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/route-6fc5f8e744c81802.js +17 -0
  289. package/.next/standalone/.next/static/chunks/app/api/v1/artifacts/lifecycle/route-6fc5f8e744c81802.js +17 -0
  290. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/files/route-6fc5f8e744c81802.js +17 -0
  291. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/images/route-6fc5f8e744c81802.js +17 -0
  292. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/chats/route-6fc5f8e744c81802.js +17 -0
  293. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/[remote_jid]/route-6fc5f8e744c81802.js +17 -0
  294. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/route-6fc5f8e744c81802.js +17 -0
  295. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/lookup/route-6fc5f8e744c81802.js +17 -0
  296. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/pair/route-6fc5f8e744c81802.js +17 -0
  297. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/route-6fc5f8e744c81802.js +17 -0
  298. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/[route_id]/route-6fc5f8e744c81802.js +17 -0
  299. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/route-6fc5f8e744c81802.js +17 -0
  300. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/status/route-6fc5f8e744c81802.js +17 -0
  301. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/kinds/route-6fc5f8e744c81802.js +17 -0
  302. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/route-6fc5f8e744c81802.js +17 -0
  303. package/.next/standalone/.next/static/chunks/app/api/v1/builtin-tools/route-6fc5f8e744c81802.js +17 -0
  304. package/.next/standalone/.next/static/chunks/app/api/v1/config/route-6fc5f8e744c81802.js +17 -0
  305. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/[id]/route-6fc5f8e744c81802.js +17 -0
  306. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/route-6fc5f8e744c81802.js +17 -0
  307. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/currency/route-6fc5f8e744c81802.js +17 -0
  308. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/metrics/route-6fc5f8e744c81802.js +17 -0
  309. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing/route-6fc5f8e744c81802.js +17 -0
  310. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing-task/route-6fc5f8e744c81802.js +17 -0
  311. package/.next/standalone/.next/static/chunks/app/api/v1/delegations/codex/[job_id]/route-6fc5f8e744c81802.js +17 -0
  312. package/.next/standalone/.next/static/chunks/app/api/v1/documents/search/route-6fc5f8e744c81802.js +17 -0
  313. package/.next/standalone/.next/static/chunks/app/api/v1/documents/settings/route-6fc5f8e744c81802.js +17 -0
  314. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/reindex/route-6fc5f8e744c81802.js +17 -0
  315. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/route-6fc5f8e744c81802.js +17 -0
  316. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/route-6fc5f8e744c81802.js +17 -0
  317. package/.next/standalone/.next/static/chunks/app/api/v1/env/route-6fc5f8e744c81802.js +17 -0
  318. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/allowlist/route-6fc5f8e744c81802.js +17 -0
  319. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/route-6fc5f8e744c81802.js +17 -0
  320. package/.next/standalone/.next/static/chunks/app/api/v1/events/route-6fc5f8e744c81802.js +17 -0
  321. package/.next/standalone/.next/static/chunks/app/api/v1/events/test/route-6fc5f8e744c81802.js +17 -0
  322. package/.next/standalone/.next/static/chunks/app/api/v1/extension/agents/route-6fc5f8e744c81802.js +17 -0
  323. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/activate/route-6fc5f8e744c81802.js +17 -0
  324. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/foreground/route-6fc5f8e744c81802.js +17 -0
  325. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/history/route-6fc5f8e744c81802.js +17 -0
  326. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/poll/route-6fc5f8e744c81802.js +17 -0
  327. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/progress/route-6fc5f8e744c81802.js +17 -0
  328. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/result/route-6fc5f8e744c81802.js +17 -0
  329. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/retry/route-6fc5f8e744c81802.js +17 -0
  330. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/status/route-6fc5f8e744c81802.js +17 -0
  331. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/tabs/route-6fc5f8e744c81802.js +17 -0
  332. package/.next/standalone/.next/static/chunks/app/api/v1/extension/fill/route-6fc5f8e744c81802.js +17 -0
  333. package/.next/standalone/.next/static/chunks/app/api/v1/extension/refine/route-6fc5f8e744c81802.js +17 -0
  334. package/.next/standalone/.next/static/chunks/app/api/v1/extension/turn/route-6fc5f8e744c81802.js +17 -0
  335. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/route-6fc5f8e744c81802.js +17 -0
  336. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/config/route-6fc5f8e744c81802.js +17 -0
  337. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/route-6fc5f8e744c81802.js +17 -0
  338. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/secrets/route-6fc5f8e744c81802.js +17 -0
  339. package/.next/standalone/.next/static/chunks/app/api/v1/files/[name]/route-6fc5f8e744c81802.js +17 -0
  340. package/.next/standalone/.next/static/chunks/app/api/v1/fs/browse/route-6fc5f8e744c81802.js +17 -0
  341. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/[id]/route-6fc5f8e744c81802.js +17 -0
  342. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/default/route-6fc5f8e744c81802.js +17 -0
  343. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/route-6fc5f8e744c81802.js +17 -0
  344. package/.next/standalone/.next/static/chunks/app/api/v1/health/probes/route-6fc5f8e744c81802.js +17 -0
  345. package/.next/standalone/.next/static/chunks/app/api/v1/health/route-6fc5f8e744c81802.js +17 -0
  346. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/route-6fc5f8e744c81802.js +17 -0
  347. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/test/route-6fc5f8e744c81802.js +17 -0
  348. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/callback/route-6fc5f8e744c81802.js +17 -0
  349. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/start/route-6fc5f8e744c81802.js +17 -0
  350. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/status/route-6fc5f8e744c81802.js +17 -0
  351. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/callback/route-6fc5f8e744c81802.js +17 -0
  352. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/start/route-6fc5f8e744c81802.js +17 -0
  353. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/status/route-6fc5f8e744c81802.js +17 -0
  354. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/route-6fc5f8e744c81802.js +17 -0
  355. package/.next/standalone/.next/static/chunks/app/api/v1/lifecycle/adoption/route-6fc5f8e744c81802.js +17 -0
  356. package/.next/standalone/.next/static/chunks/app/api/v1/local-file/route-6fc5f8e744c81802.js +17 -0
  357. package/.next/standalone/.next/static/chunks/app/api/v1/logs/route-6fc5f8e744c81802.js +17 -0
  358. package/.next/standalone/.next/static/chunks/app/api/v1/maps/embed/route-6fc5f8e744c81802.js +17 -0
  359. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/[name]/route-6fc5f8e744c81802.js +17 -0
  360. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/registry/route-6fc5f8e744c81802.js +17 -0
  361. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/route-6fc5f8e744c81802.js +17 -0
  362. package/.next/standalone/.next/static/chunks/app/api/v1/memory/[namespace]/[key]/route-6fc5f8e744c81802.js +17 -0
  363. package/.next/standalone/.next/static/chunks/app/api/v1/memory/policy/route-6fc5f8e744c81802.js +17 -0
  364. package/.next/standalone/.next/static/chunks/app/api/v1/memory/route-6fc5f8e744c81802.js +17 -0
  365. package/.next/standalone/.next/static/chunks/app/api/v1/memory/search/route-6fc5f8e744c81802.js +17 -0
  366. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/compact-threads/route-6fc5f8e744c81802.js +17 -0
  367. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/route-6fc5f8e744c81802.js +17 -0
  368. package/.next/standalone/.next/static/chunks/app/api/v1/models/route-6fc5f8e744c81802.js +17 -0
  369. package/.next/standalone/.next/static/chunks/app/api/v1/packages/catalog/route-6fc5f8e744c81802.js +17 -0
  370. package/.next/standalone/.next/static/chunks/app/api/v1/packages/defaults/[id]/route-6fc5f8e744c81802.js +17 -0
  371. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/[id]/route-6fc5f8e744c81802.js +17 -0
  372. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/route-6fc5f8e744c81802.js +17 -0
  373. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/enabled/route-6fc5f8e744c81802.js +17 -0
  374. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/route-6fc5f8e744c81802.js +17 -0
  375. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/route-6fc5f8e744c81802.js +17 -0
  376. package/.next/standalone/.next/static/chunks/app/api/v1/packages/reload/route-6fc5f8e744c81802.js +17 -0
  377. package/.next/standalone/.next/static/chunks/app/api/v1/packages/route-6fc5f8e744c81802.js +17 -0
  378. package/.next/standalone/.next/static/chunks/app/api/v1/page-capture/route-6fc5f8e744c81802.js +17 -0
  379. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/approve/route-6fc5f8e744c81802.js +17 -0
  380. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/deny/route-6fc5f8e744c81802.js +17 -0
  381. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/route-6fc5f8e744c81802.js +17 -0
  382. package/.next/standalone/.next/static/chunks/app/api/v1/profile/location/route-6fc5f8e744c81802.js +17 -0
  383. package/.next/standalone/.next/static/chunks/app/api/v1/profile/route-6fc5f8e744c81802.js +17 -0
  384. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/models/route-6fc5f8e744c81802.js +17 -0
  385. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/probe/route-6fc5f8e744c81802.js +17 -0
  386. package/.next/standalone/.next/static/chunks/app/api/v1/providers/github-copilot/auth/route-6fc5f8e744c81802.js +17 -0
  387. package/.next/standalone/.next/static/chunks/app/api/v1/providers/route-6fc5f8e744c81802.js +17 -0
  388. package/.next/standalone/.next/static/chunks/app/api/v1/proxy-config/route-6fc5f8e744c81802.js +17 -0
  389. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/init/route-6fc5f8e744c81802.js +17 -0
  390. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/route-6fc5f8e744c81802.js +17 -0
  391. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/route-6fc5f8e744c81802.js +17 -0
  392. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/run/route-6fc5f8e744c81802.js +17 -0
  393. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/route-6fc5f8e744c81802.js +17 -0
  394. package/.next/standalone/.next/static/chunks/app/api/v1/security/idle-timeout/route-6fc5f8e744c81802.js +17 -0
  395. package/.next/standalone/.next/static/chunks/app/api/v1/security/pin/route-6fc5f8e744c81802.js +17 -0
  396. package/.next/standalone/.next/static/chunks/app/api/v1/security/state/route-6fc5f8e744c81802.js +17 -0
  397. package/.next/standalone/.next/static/chunks/app/api/v1/security/unlock/route-6fc5f8e744c81802.js +17 -0
  398. package/.next/standalone/.next/static/chunks/app/api/v1/security/verify-pin/route-6fc5f8e744c81802.js +17 -0
  399. package/.next/standalone/.next/static/chunks/app/api/v1/setup/test-key/route-6fc5f8e744c81802.js +17 -0
  400. package/.next/standalone/.next/static/chunks/app/api/v1/skills/[id]/route-6fc5f8e744c81802.js +17 -0
  401. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/[id]/route-6fc5f8e744c81802.js +17 -0
  402. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/route-6fc5f8e744c81802.js +17 -0
  403. package/.next/standalone/.next/static/chunks/app/api/v1/skills/route-6fc5f8e744c81802.js +17 -0
  404. package/.next/standalone/.next/static/chunks/app/api/v1/system/abort/route-6fc5f8e744c81802.js +17 -0
  405. package/.next/standalone/.next/static/chunks/app/api/v1/system/restart/route-6fc5f8e744c81802.js +17 -0
  406. package/.next/standalone/.next/static/chunks/app/api/v1/tailscale/route-6fc5f8e744c81802.js +17 -0
  407. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/[agent_id]/route-6fc5f8e744c81802.js +17 -0
  408. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/route-6fc5f8e744c81802.js +17 -0
  409. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/activity/route-6fc5f8e744c81802.js +17 -0
  410. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/context-pin/route-6fc5f8e744c81802.js +17 -0
  411. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/route-6fc5f8e744c81802.js +17 -0
  412. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/run/route-6fc5f8e744c81802.js +17 -0
  413. package/.next/standalone/.next/static/chunks/app/api/v1/threads/route-6fc5f8e744c81802.js +17 -0
  414. package/.next/standalone/.next/static/chunks/app/api/v1/tools/route-6fc5f8e744c81802.js +17 -0
  415. package/.next/standalone/.next/static/chunks/app/api/v1/update/apply/route-6fc5f8e744c81802.js +17 -0
  416. package/.next/standalone/.next/static/chunks/app/api/v1/update/route-6fc5f8e744c81802.js +17 -0
  417. package/.next/standalone/.next/static/chunks/app/api/v1/voice/transcribe/route-6fc5f8e744c81802.js +17 -0
  418. package/.next/standalone/.next/static/chunks/app/api/v1/voice/tts/route-6fc5f8e744c81802.js +17 -0
  419. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/route-6fc5f8e744c81802.js +17 -0
  420. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/run/route-6fc5f8e744c81802.js +17 -0
  421. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/reaction-scripts/route-6fc5f8e744c81802.js +17 -0
  422. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/route-6fc5f8e744c81802.js +17 -0
  423. package/.next/standalone/.next/static/chunks/app/manifest.webmanifest/route-6fc5f8e744c81802.js +17 -0
  424. package/.next/standalone/.next/static/chunks/app/{page-7017f07f8a7a083c.js → page-04748847c6ff866f.js} +1013 -585
  425. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-6fc5f8e744c81802.js +17 -0
  426. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-6fc5f8e744c81802.js +17 -0
  427. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-6fc5f8e744c81802.js +17 -0
  428. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-6fc5f8e744c81802.js +17 -0
  429. package/.next/standalone/.next/static/css/{d80058f0b9b41c09.css → 2669e8744cc8c212.css} +2 -2
  430. package/.next/standalone/docs/adoption/changesets.json +358 -0
  431. package/.next/standalone/lib/skills/builtins/memory-organization/SKILL.md +16 -0
  432. package/.next/standalone/package.json +3 -3
  433. package/CHANGELOG.md +44 -0
  434. package/api/client.ts +9 -0
  435. package/api/types.ts +29 -0
  436. package/app/api/v1/lifecycle/adoption/route.ts +14 -2
  437. package/app/api/v1/models/[name]/compact-threads/route.ts +14 -11
  438. package/app/api/v1/threads/[thread_id]/activity/route.ts +19 -0
  439. package/app/api/v1/threads/[thread_id]/context-pin/route.test.ts +1 -0
  440. package/app/api/v1/threads/[thread_id]/context-pin/route.ts +2 -1
  441. package/app/api/v1/threads/[thread_id]/route.ts +5 -1
  442. package/app/api/v1/threads/[thread_id]/run/route.ts +0 -1
  443. package/components/chat/ChatView.tsx +52 -11
  444. package/components/chat/ContextBoundary.test.tsx +68 -1
  445. package/components/chat/ContextBoundary.tsx +92 -13
  446. package/components/chat/MessageBubble.tsx +12 -0
  447. package/components/chat/MessageList.test.tsx +31 -0
  448. package/components/chat/MessageList.tsx +49 -28
  449. package/components/chat/ToolList.test.tsx +92 -16
  450. package/components/chat/ToolList.tsx +59 -4
  451. package/components/chat/chat-helpers.test.tsx +24 -1
  452. package/components/chat/chat-helpers.ts +47 -4
  453. package/components/chat/useThreadActivity.test.tsx +113 -0
  454. package/components/chat/useThreadActivity.ts +94 -0
  455. package/components/chat/useThreadData.ts +16 -16
  456. package/components/chat/workflow-step-retry.ts +25 -0
  457. package/components/integrations/NetworkSection.tsx +2 -2
  458. package/components/ui/BootScreen.tsx +17 -0
  459. package/components/ui/WorkflowChecklist.tsx +71 -33
  460. package/hooks/useSSE.ts +28 -3
  461. package/lib/agents/citation-checker.test.ts +40 -2
  462. package/lib/agents/citation-checker.ts +56 -11
  463. package/lib/agents/compaction-pipeline.test.ts +202 -0
  464. package/lib/agents/compaction-pipeline.ts +483 -0
  465. package/lib/agents/context-boundary.ts +5 -6
  466. package/lib/agents/conversation-summary.ts +37 -21
  467. package/lib/agents/instruction-edits.test.ts +120 -0
  468. package/lib/agents/instruction-edits.ts +65 -42
  469. package/lib/agents/prepare/history-window.test.ts +18 -0
  470. package/lib/agents/prepare/history-window.ts +11 -2
  471. package/lib/agents/prepare/request.ts +4 -2
  472. package/lib/agents/prepare/system-prompt.test.ts +49 -0
  473. package/lib/agents/prepare/system-prompt.ts +16 -5
  474. package/lib/agents/prompt-registry.test.ts +5 -140
  475. package/lib/agents/prompt-registry.ts +45 -1
  476. package/lib/agents/prompt-variants.ts +146 -0
  477. package/lib/agents/proposals.test.ts +76 -0
  478. package/lib/agents/proposals.ts +13 -5
  479. package/lib/agents/run-registry.test.ts +22 -0
  480. package/lib/agents/run-registry.ts +29 -0
  481. package/lib/agents/run-thread.auto-boundary.test.ts +125 -5
  482. package/lib/agents/run-thread.retry.test.ts +67 -1
  483. package/lib/agents/run-thread.ts +110 -10
  484. package/lib/agents/sqlite-checkpoint-saver.test.ts +91 -0
  485. package/lib/agents/thread-activity.test.ts +31 -0
  486. package/lib/agents/thread-activity.ts +27 -0
  487. package/lib/agents/thread-compaction-state.test.ts +82 -0
  488. package/lib/agents/thread-compaction-state.ts +121 -0
  489. package/lib/agents/thread-compaction.test.ts +83 -4
  490. package/lib/agents/thread-compaction.ts +34 -11
  491. package/lib/agents/warm-summary-background.test.ts +219 -5
  492. package/lib/agents/warm-summary-background.ts +346 -143
  493. package/lib/agents/warm-topics.test.ts +191 -0
  494. package/lib/agents/warm-topics.ts +317 -0
  495. package/lib/agents/workflow-step-retry.test.ts +96 -0
  496. package/lib/agents/workflow-step-retry.ts +216 -0
  497. package/lib/api/browser-control.ts +0 -3
  498. package/lib/bridges/dispatcher.ts +1 -0
  499. package/lib/bridges/message-role.test.ts +81 -0
  500. package/lib/bridges/message-role.ts +23 -10
  501. package/lib/bridges/types.ts +6 -0
  502. package/lib/bridges/whatsapp-link.test.ts +32 -0
  503. package/lib/bridges/whatsapp-link.ts +21 -0
  504. package/lib/bridges/whatsapp.inbound.test.ts +239 -0
  505. package/lib/bridges/whatsapp.sender.test.ts +80 -1
  506. package/lib/bridges/whatsapp.ts +76 -38
  507. package/lib/db/migrations.ts +5 -0
  508. package/lib/env/config.ts +2 -0
  509. package/lib/env/schema.ts +12 -0
  510. package/lib/lifecycle/changeset-build.test.ts +93 -0
  511. package/lib/lifecycle/changeset-build.ts +210 -0
  512. package/lib/lifecycle/changesets.test.ts +101 -0
  513. package/lib/lifecycle/changesets.ts +166 -0
  514. package/lib/lifecycle/surface-collect.test.ts +88 -0
  515. package/lib/lifecycle/surface-collect.ts +64 -0
  516. package/lib/lifecycle/surface-snapshot.test.ts +104 -0
  517. package/lib/lifecycle/surface-snapshot.ts +210 -0
  518. package/lib/memory/record.ts +0 -2
  519. package/lib/pricing/snapshot.test.ts +70 -0
  520. package/lib/pricing/snapshot.ts +10 -2
  521. package/lib/providers/external.ts +0 -2
  522. package/lib/proxy/dispatcher.test.ts +119 -1
  523. package/lib/proxy/dispatcher.ts +22 -9
  524. package/lib/skills/builtins/memory-organization/SKILL.md +16 -0
  525. package/lib/stores/agent-configs.ts +10 -5
  526. package/lib/stores/bridges.test.ts +81 -0
  527. package/lib/stores/bridges.ts +9 -8
  528. package/lib/stores/proxy-config.test.ts +120 -0
  529. package/lib/stores/proxy-config.ts +22 -4
  530. package/lib/stores/threads.test.ts +9 -0
  531. package/lib/stores/threads.ts +33 -19
  532. package/lib/stores/version-adoption.test.ts +96 -0
  533. package/lib/stores/version-adoption.ts +239 -26
  534. package/lib/stores/workflow-progress.ts +3 -0
  535. package/lib/tools/communications/calendar.test.ts +43 -2
  536. package/lib/tools/communications/calendar.ts +2 -0
  537. package/lib/tools/communications/gmail.test.ts +51 -1
  538. package/lib/tools/communications/gmail.ts +44 -2
  539. package/lib/tools/communications/ms-todo.ts +0 -7
  540. package/lib/tools/communications/outlook-calendar.ts +2 -0
  541. package/lib/tools/communications/outlook.test.ts +33 -2
  542. package/lib/tools/communications/outlook.ts +2 -0
  543. package/lib/tools/filesystem/edit-match.test.ts +133 -0
  544. package/lib/tools/filesystem/edit-match.ts +7 -2
  545. package/lib/tools/general/memory.ts +1 -1
  546. package/lib/tools/general/workflow-progress.ts +2 -0
  547. package/lib/tools/runtime/catalog.ts +1 -25
  548. package/lib/tools/support/result-refs.test.ts +131 -0
  549. package/lib/tools/support/result-refs.ts +41 -9
  550. package/lib/triggers/registry.ts +0 -4
  551. package/lib/utils/source-link.test.ts +51 -0
  552. package/lib/utils/source-link.ts +45 -0
  553. package/package.json +3 -3
  554. package/scripts/install-to-system.ps1 +39 -11
  555. package/scripts/install-to-system.sh +37 -3
  556. package/.next/standalone/.next/server/chunks/3979.js +0 -581
  557. package/.next/standalone/.next/server/chunks/5936.js +0 -594
  558. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/display-filters/route-36cb8b428b38b26a.js +0 -17
  559. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/route-36cb8b428b38b26a.js +0 -17
  560. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/thread/route-36cb8b428b38b26a.js +0 -17
  561. package/.next/standalone/.next/static/chunks/app/api/v1/agents/route-36cb8b428b38b26a.js +0 -17
  562. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/[hostname]/route-36cb8b428b38b26a.js +0 -17
  563. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/route-36cb8b428b38b26a.js +0 -17
  564. package/.next/standalone/.next/static/chunks/app/api/v1/artifacts/lifecycle/route-36cb8b428b38b26a.js +0 -17
  565. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/files/route-36cb8b428b38b26a.js +0 -17
  566. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/images/route-36cb8b428b38b26a.js +0 -17
  567. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/chats/route-36cb8b428b38b26a.js +0 -17
  568. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/[remote_jid]/route-36cb8b428b38b26a.js +0 -17
  569. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/route-36cb8b428b38b26a.js +0 -17
  570. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/lookup/route-36cb8b428b38b26a.js +0 -17
  571. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/pair/route-36cb8b428b38b26a.js +0 -17
  572. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/route-36cb8b428b38b26a.js +0 -17
  573. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/[route_id]/route-36cb8b428b38b26a.js +0 -17
  574. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/route-36cb8b428b38b26a.js +0 -17
  575. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/status/route-36cb8b428b38b26a.js +0 -17
  576. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/kinds/route-36cb8b428b38b26a.js +0 -17
  577. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/route-36cb8b428b38b26a.js +0 -17
  578. package/.next/standalone/.next/static/chunks/app/api/v1/builtin-tools/route-36cb8b428b38b26a.js +0 -17
  579. package/.next/standalone/.next/static/chunks/app/api/v1/config/route-36cb8b428b38b26a.js +0 -17
  580. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/[id]/route-36cb8b428b38b26a.js +0 -17
  581. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/route-36cb8b428b38b26a.js +0 -17
  582. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/currency/route-36cb8b428b38b26a.js +0 -17
  583. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/metrics/route-36cb8b428b38b26a.js +0 -17
  584. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing/route-36cb8b428b38b26a.js +0 -17
  585. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing-task/route-36cb8b428b38b26a.js +0 -17
  586. package/.next/standalone/.next/static/chunks/app/api/v1/delegations/codex/[job_id]/route-36cb8b428b38b26a.js +0 -17
  587. package/.next/standalone/.next/static/chunks/app/api/v1/documents/search/route-36cb8b428b38b26a.js +0 -17
  588. package/.next/standalone/.next/static/chunks/app/api/v1/documents/settings/route-36cb8b428b38b26a.js +0 -17
  589. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/reindex/route-36cb8b428b38b26a.js +0 -17
  590. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/route-36cb8b428b38b26a.js +0 -17
  591. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/route-36cb8b428b38b26a.js +0 -17
  592. package/.next/standalone/.next/static/chunks/app/api/v1/env/route-36cb8b428b38b26a.js +0 -17
  593. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/allowlist/route-36cb8b428b38b26a.js +0 -17
  594. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/route-36cb8b428b38b26a.js +0 -17
  595. package/.next/standalone/.next/static/chunks/app/api/v1/events/route-36cb8b428b38b26a.js +0 -17
  596. package/.next/standalone/.next/static/chunks/app/api/v1/events/test/route-36cb8b428b38b26a.js +0 -17
  597. package/.next/standalone/.next/static/chunks/app/api/v1/extension/agents/route-36cb8b428b38b26a.js +0 -17
  598. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/activate/route-36cb8b428b38b26a.js +0 -17
  599. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/foreground/route-36cb8b428b38b26a.js +0 -17
  600. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/history/route-36cb8b428b38b26a.js +0 -17
  601. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/poll/route-36cb8b428b38b26a.js +0 -17
  602. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/progress/route-36cb8b428b38b26a.js +0 -17
  603. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/result/route-36cb8b428b38b26a.js +0 -17
  604. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/retry/route-36cb8b428b38b26a.js +0 -17
  605. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/status/route-36cb8b428b38b26a.js +0 -17
  606. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/tabs/route-36cb8b428b38b26a.js +0 -17
  607. package/.next/standalone/.next/static/chunks/app/api/v1/extension/fill/route-36cb8b428b38b26a.js +0 -17
  608. package/.next/standalone/.next/static/chunks/app/api/v1/extension/refine/route-36cb8b428b38b26a.js +0 -17
  609. package/.next/standalone/.next/static/chunks/app/api/v1/extension/turn/route-36cb8b428b38b26a.js +0 -17
  610. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/route-36cb8b428b38b26a.js +0 -17
  611. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/config/route-36cb8b428b38b26a.js +0 -17
  612. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/route-36cb8b428b38b26a.js +0 -17
  613. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/secrets/route-36cb8b428b38b26a.js +0 -17
  614. package/.next/standalone/.next/static/chunks/app/api/v1/files/[name]/route-36cb8b428b38b26a.js +0 -17
  615. package/.next/standalone/.next/static/chunks/app/api/v1/fs/browse/route-36cb8b428b38b26a.js +0 -17
  616. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/[id]/route-36cb8b428b38b26a.js +0 -17
  617. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/default/route-36cb8b428b38b26a.js +0 -17
  618. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/route-36cb8b428b38b26a.js +0 -17
  619. package/.next/standalone/.next/static/chunks/app/api/v1/health/probes/route-36cb8b428b38b26a.js +0 -17
  620. package/.next/standalone/.next/static/chunks/app/api/v1/health/route-36cb8b428b38b26a.js +0 -17
  621. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/route-36cb8b428b38b26a.js +0 -17
  622. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/test/route-36cb8b428b38b26a.js +0 -17
  623. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/callback/route-36cb8b428b38b26a.js +0 -17
  624. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/start/route-36cb8b428b38b26a.js +0 -17
  625. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/status/route-36cb8b428b38b26a.js +0 -17
  626. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/callback/route-36cb8b428b38b26a.js +0 -17
  627. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/start/route-36cb8b428b38b26a.js +0 -17
  628. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/status/route-36cb8b428b38b26a.js +0 -17
  629. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/route-36cb8b428b38b26a.js +0 -17
  630. package/.next/standalone/.next/static/chunks/app/api/v1/lifecycle/adoption/route-36cb8b428b38b26a.js +0 -17
  631. package/.next/standalone/.next/static/chunks/app/api/v1/local-file/route-36cb8b428b38b26a.js +0 -17
  632. package/.next/standalone/.next/static/chunks/app/api/v1/logs/route-36cb8b428b38b26a.js +0 -17
  633. package/.next/standalone/.next/static/chunks/app/api/v1/maps/embed/route-36cb8b428b38b26a.js +0 -17
  634. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/[name]/route-36cb8b428b38b26a.js +0 -17
  635. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/registry/route-36cb8b428b38b26a.js +0 -17
  636. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/route-36cb8b428b38b26a.js +0 -17
  637. package/.next/standalone/.next/static/chunks/app/api/v1/memory/[namespace]/[key]/route-36cb8b428b38b26a.js +0 -17
  638. package/.next/standalone/.next/static/chunks/app/api/v1/memory/policy/route-36cb8b428b38b26a.js +0 -17
  639. package/.next/standalone/.next/static/chunks/app/api/v1/memory/route-36cb8b428b38b26a.js +0 -17
  640. package/.next/standalone/.next/static/chunks/app/api/v1/memory/search/route-36cb8b428b38b26a.js +0 -17
  641. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/compact-threads/route-36cb8b428b38b26a.js +0 -17
  642. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/route-36cb8b428b38b26a.js +0 -17
  643. package/.next/standalone/.next/static/chunks/app/api/v1/models/route-36cb8b428b38b26a.js +0 -17
  644. package/.next/standalone/.next/static/chunks/app/api/v1/packages/catalog/route-36cb8b428b38b26a.js +0 -17
  645. package/.next/standalone/.next/static/chunks/app/api/v1/packages/defaults/[id]/route-36cb8b428b38b26a.js +0 -17
  646. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/[id]/route-36cb8b428b38b26a.js +0 -17
  647. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/route-36cb8b428b38b26a.js +0 -17
  648. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/enabled/route-36cb8b428b38b26a.js +0 -17
  649. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/route-36cb8b428b38b26a.js +0 -17
  650. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/route-36cb8b428b38b26a.js +0 -17
  651. package/.next/standalone/.next/static/chunks/app/api/v1/packages/reload/route-36cb8b428b38b26a.js +0 -17
  652. package/.next/standalone/.next/static/chunks/app/api/v1/packages/route-36cb8b428b38b26a.js +0 -17
  653. package/.next/standalone/.next/static/chunks/app/api/v1/page-capture/route-36cb8b428b38b26a.js +0 -17
  654. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/approve/route-36cb8b428b38b26a.js +0 -17
  655. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/deny/route-36cb8b428b38b26a.js +0 -17
  656. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/route-36cb8b428b38b26a.js +0 -17
  657. package/.next/standalone/.next/static/chunks/app/api/v1/profile/location/route-36cb8b428b38b26a.js +0 -17
  658. package/.next/standalone/.next/static/chunks/app/api/v1/profile/route-36cb8b428b38b26a.js +0 -17
  659. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/models/route-36cb8b428b38b26a.js +0 -17
  660. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/probe/route-36cb8b428b38b26a.js +0 -17
  661. package/.next/standalone/.next/static/chunks/app/api/v1/providers/github-copilot/auth/route-36cb8b428b38b26a.js +0 -17
  662. package/.next/standalone/.next/static/chunks/app/api/v1/providers/route-36cb8b428b38b26a.js +0 -17
  663. package/.next/standalone/.next/static/chunks/app/api/v1/proxy-config/route-36cb8b428b38b26a.js +0 -17
  664. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/init/route-36cb8b428b38b26a.js +0 -17
  665. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/route-36cb8b428b38b26a.js +0 -17
  666. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/route-36cb8b428b38b26a.js +0 -17
  667. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/run/route-36cb8b428b38b26a.js +0 -17
  668. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/route-36cb8b428b38b26a.js +0 -17
  669. package/.next/standalone/.next/static/chunks/app/api/v1/security/idle-timeout/route-36cb8b428b38b26a.js +0 -17
  670. package/.next/standalone/.next/static/chunks/app/api/v1/security/pin/route-36cb8b428b38b26a.js +0 -17
  671. package/.next/standalone/.next/static/chunks/app/api/v1/security/state/route-36cb8b428b38b26a.js +0 -17
  672. package/.next/standalone/.next/static/chunks/app/api/v1/security/unlock/route-36cb8b428b38b26a.js +0 -17
  673. package/.next/standalone/.next/static/chunks/app/api/v1/security/verify-pin/route-36cb8b428b38b26a.js +0 -17
  674. package/.next/standalone/.next/static/chunks/app/api/v1/setup/test-key/route-36cb8b428b38b26a.js +0 -17
  675. package/.next/standalone/.next/static/chunks/app/api/v1/skills/[id]/route-36cb8b428b38b26a.js +0 -17
  676. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/[id]/route-36cb8b428b38b26a.js +0 -17
  677. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/route-36cb8b428b38b26a.js +0 -17
  678. package/.next/standalone/.next/static/chunks/app/api/v1/skills/route-36cb8b428b38b26a.js +0 -17
  679. package/.next/standalone/.next/static/chunks/app/api/v1/system/abort/route-36cb8b428b38b26a.js +0 -17
  680. package/.next/standalone/.next/static/chunks/app/api/v1/system/restart/route-36cb8b428b38b26a.js +0 -17
  681. package/.next/standalone/.next/static/chunks/app/api/v1/tailscale/route-36cb8b428b38b26a.js +0 -17
  682. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/[agent_id]/route-36cb8b428b38b26a.js +0 -17
  683. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/route-36cb8b428b38b26a.js +0 -17
  684. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/context-pin/route-36cb8b428b38b26a.js +0 -17
  685. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/route-36cb8b428b38b26a.js +0 -17
  686. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/run/route-36cb8b428b38b26a.js +0 -17
  687. package/.next/standalone/.next/static/chunks/app/api/v1/threads/route-36cb8b428b38b26a.js +0 -17
  688. package/.next/standalone/.next/static/chunks/app/api/v1/tools/route-36cb8b428b38b26a.js +0 -17
  689. package/.next/standalone/.next/static/chunks/app/api/v1/update/apply/route-36cb8b428b38b26a.js +0 -17
  690. package/.next/standalone/.next/static/chunks/app/api/v1/update/route-36cb8b428b38b26a.js +0 -17
  691. package/.next/standalone/.next/static/chunks/app/api/v1/voice/transcribe/route-36cb8b428b38b26a.js +0 -17
  692. package/.next/standalone/.next/static/chunks/app/api/v1/voice/tts/route-36cb8b428b38b26a.js +0 -17
  693. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/route-36cb8b428b38b26a.js +0 -17
  694. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/run/route-36cb8b428b38b26a.js +0 -17
  695. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/reaction-scripts/route-36cb8b428b38b26a.js +0 -17
  696. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/route-36cb8b428b38b26a.js +0 -17
  697. package/.next/standalone/.next/static/chunks/app/manifest.webmanifest/route-36cb8b428b38b26a.js +0 -17
  698. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-36cb8b428b38b26a.js +0 -17
  699. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-36cb8b428b38b26a.js +0 -17
  700. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-36cb8b428b38b26a.js +0 -17
  701. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-36cb8b428b38b26a.js +0 -17
  702. /package/.next/standalone/.next/static/{NUrC9xax1sp1Q70nlFqS6 → hwujW4hR1b-r3k5WdMxZO}/_buildManifest.js +0 -0
  703. /package/.next/standalone/.next/static/{NUrC9xax1sp1Q70nlFqS6 → hwujW4hR1b-r3k5WdMxZO}/_ssgManifest.js +0 -0
@@ -33,1103 +33,1115 @@ 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) => {
593
-
594
- module.exports = require("node:os");
595
-
596
- /***/ }),
597
-
598
- /***/ 51455:
599
- /***/ ((module) => {
600
-
601
- module.exports = require("node:fs/promises");
602
-
603
- /***/ }),
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
+ }
604
474
 
605
- /***/ 55511:
606
- /***/ ((module) => {
475
+ //# sourceMappingURL=app-route.js.map
607
476
 
608
- module.exports = require("crypto");
609
477
 
610
478
  /***/ }),
611
479
 
612
- /***/ 55591:
480
+ /***/ 8128:
613
481
  /***/ ((module) => {
614
482
 
615
- module.exports = require("https");
483
+ module.exports = require("next/dist/server/runtime-reacts.external.js");
616
484
 
617
485
  /***/ }),
618
486
 
619
- /***/ 57075:
487
+ /***/ 9956:
620
488
  /***/ ((module) => {
621
489
 
622
- module.exports = require("node:stream");
490
+ module.exports = require("undici");
623
491
 
624
492
  /***/ }),
625
493
 
626
- /***/ 57975:
494
+ /***/ 10846:
627
495
  /***/ ((module) => {
628
496
 
629
- module.exports = require("node:util");
497
+ module.exports = require("next/dist/compiled/next-server/app-page.runtime.prod.js");
630
498
 
631
499
  /***/ }),
632
500
 
633
- /***/ 63033:
501
+ /***/ 16698:
634
502
  /***/ ((module) => {
635
503
 
636
- module.exports = require("next/dist/server/app-render/work-unit-async-storage.external.js");
504
+ module.exports = require("node:async_hooks");
637
505
 
638
506
  /***/ }),
639
507
 
640
- /***/ 67118:
508
+ /***/ 17127:
641
509
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
642
510
 
511
+ __webpack_require__.r(__webpack_exports__);
643
512
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
644
- /* harmony export */ D: () => (/* binding */ resolveGoogleApiKey),
645
- /* harmony export */ _: () => (/* binding */ timeoutSignal)
513
+ /* harmony export */ POST: () => (/* binding */ POST)
646
514
  /* harmony export */ });
647
- /* harmony import */ var _lib_stores_integrations__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(78228);
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.
648
526
 
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
- }
660
527
 
661
528
 
662
- /***/ }),
663
529
 
664
- /***/ 73024:
665
- /***/ ((module) => {
666
530
 
667
- module.exports = require("node:fs");
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
+ }
573
+
668
574
 
669
575
  /***/ }),
670
576
 
671
- /***/ 75919:
577
+ /***/ 19121:
672
578
  /***/ ((module) => {
673
579
 
674
- module.exports = require("node:worker_threads");
580
+ module.exports = require("next/dist/server/app-render/action-async-storage.external.js");
675
581
 
676
582
  /***/ }),
677
583
 
678
- /***/ 76760:
584
+ /***/ 27910:
679
585
  /***/ ((module) => {
680
586
 
681
- module.exports = require("node:path");
587
+ module.exports = require("stream");
682
588
 
683
589
  /***/ }),
684
590
 
685
- /***/ 77598:
591
+ /***/ 28354:
686
592
  /***/ ((module) => {
687
593
 
688
- module.exports = require("node:crypto");
594
+ module.exports = require("util");
689
595
 
690
596
  /***/ }),
691
597
 
692
- /***/ 79346:
693
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
598
+ /***/ 29021:
599
+ /***/ ((module) => {
694
600
 
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__);
601
+ module.exports = require("fs");
736
602
 
603
+ /***/ }),
737
604
 
605
+ /***/ 29294:
606
+ /***/ ((module) => {
738
607
 
608
+ module.exports = require("next/dist/server/app-render/work-async-storage.external.js");
739
609
 
610
+ /***/ }),
740
611
 
612
+ /***/ 31421:
613
+ /***/ ((module) => {
741
614
 
615
+ module.exports = require("node:child_process");
742
616
 
617
+ /***/ }),
743
618
 
619
+ /***/ 33873:
620
+ /***/ ((module) => {
744
621
 
622
+ module.exports = require("path");
745
623
 
624
+ /***/ }),
746
625
 
626
+ /***/ 37067:
627
+ /***/ ((module) => {
747
628
 
629
+ module.exports = require("node:http");
748
630
 
631
+ /***/ }),
749
632
 
633
+ /***/ 38522:
634
+ /***/ ((module) => {
750
635
 
636
+ module.exports = require("node:zlib");
751
637
 
638
+ /***/ }),
752
639
 
640
+ /***/ 39947:
641
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
753
642
 
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
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.
658
+
659
+ function errorResponse(message, status = 400) {
660
+ return next_server__WEBPACK_IMPORTED_MODULE_0__.NextResponse.json({
661
+ error: message
662
+ }, {
663
+ status
791
664
  });
792
665
  }
793
-
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
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
813
672
  });
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;
819
- }
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');
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}`
831
690
  }
832
- 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
- }
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"
843
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);
844
714
  }
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;
850
- }
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
- });
715
+ const parsed = schema.safeParse(raw);
716
+ if (!parsed.success) {
717
+ return errorResponse(parsed.error.issues[0]?.message ?? "invalid body", 400);
860
718
  }
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;
719
+ return parsed.data;
720
+ }
721
+
722
+
723
+ /***/ }),
724
+
725
+ /***/ 41720:
726
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
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);
748
+
749
+
750
+
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;
756
+ }
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 {
784
+ return null;
785
+ }
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 [];
822
+ }
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 [];
833
+ }
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 existingMbti = toMbti(existing?.adaptive_mbti);
863
+ const mbti = input.adaptive_mbti ?? existingMbti ?? "INTJ";
864
+ const preset = _lib_agents_adaptive_persona_presets__WEBPACK_IMPORTED_MODULE_2__/* .MBTI_PRESETS */ .e[mbti];
865
+ // Omitted sliders keep their tuned values; they only fall back to the
866
+ // preset when the type changes or the agent is new. Otherwise every
867
+ // partial update (approved proposals, tool edits) reset them.
868
+ const keepTuned = existing !== null && existing !== undefined && mbti === existingMbti;
869
+ const strength = input.adaptive_persona_strength ?? (keepTuned ? existing.adaptive_persona_strength : preset.strength);
870
+ const empathy = input.adaptive_empathy ?? (keepTuned ? existing.adaptive_empathy : preset.empathy);
871
+ const expressiveness = input.adaptive_expressiveness ?? (keepTuned ? existing.adaptive_expressiveness : preset.expressiveness);
872
+ const verbosity = input.adaptive_verbosity ?? (keepTuned ? existing.adaptive_verbosity : preset.verbosity);
873
+ if (input.is_default) db.prepare("UPDATE agent_configs SET is_default=0").run();
874
+ // harness_id: explicit `undefined` means "keep existing"; explicit `null`
875
+ // means "use the global default". Empty string is normalised to null too,
876
+ // matching how the AgentEditor sends "" for the inherit option.
877
+ const harnessId = input.harness_id === undefined ? existing?.harness_id ?? null : input.harness_id && input.harness_id.length > 0 ? input.harness_id : null;
878
+ // delegate_targets: undefined = keep existing; explicit empty array clears.
879
+ 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))));
880
+ // context_tier_proportions: undefined = keep existing; null = clear and
881
+ // inherit from the model; object = serialise as JSON. Negative values are
882
+ // clamped to 0 so the upsert can't poison the column with bad data.
883
+ const tierProportions = input.context_tier_proportions === undefined ? existing?.context_tier_proportions ?? null : input.context_tier_proportions === null ? null : JSON.stringify({
884
+ hot: Math.max(0, Number(input.context_tier_proportions.hot) || 0),
885
+ warm: Math.max(0, Number(input.context_tier_proportions.warm) || 0),
886
+ facts: Math.max(0, Number(input.context_tier_proportions.facts) || 0)
887
+ });
888
+ // Anti-hallucination override: `undefined` keeps existing; `null` clears
889
+ // the override (inherits env). Empty-string model is normalised to null
890
+ // so the editor can ship "" for the inherit option.
891
+ 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;
892
+ 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;
893
+ const citationStrictness = input.citation_strictness === undefined ? parseCitationStrictness(existing?.citation_strictness) ?? "off" : parseCitationStrictness(input.citation_strictness) ?? "off";
894
+ const toolCredentials = serialiseToolCredentials(input.tool_credentials, existing?.tool_credentials ?? null);
895
+ const VALID_ROUTER_POLICIES = new Set([
896
+ "cheap",
897
+ "fast",
898
+ "balanced",
899
+ "quality"
900
+ ]);
901
+ 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;
902
+ const routerEnabled = input.router_enabled === undefined ? existing?.router_enabled ?? null : input.router_enabled === null ? null : input.router_enabled ? 1 : 0;
903
+ const VALID_USAGE_STRATEGIES = new Set([
904
+ "cost_saving",
905
+ "fast",
906
+ "balanced",
907
+ "high_reasoning"
908
+ ]);
909
+ 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;
910
+ const requestedWarmSummaryLimit = input.warm_summary_limit ?? existing?.warm_summary_limit ?? 50;
911
+ const warmSummaryLimit = Number.isFinite(requestedWarmSummaryLimit) ? Math.max(0, Math.floor(requestedWarmSummaryLimit)) : existing?.warm_summary_limit ?? 50;
912
+ db.prepare(`INSERT OR REPLACE INTO agent_configs
913
+ (id, name, icon, identity, instructions, tools, model_config_name, is_default,
914
+ history_limit, history_window_hours, warm_summary_limit, never_reply,
915
+ hot_turn_limit,
916
+ adaptive_persona_enabled, adaptive_persona_strength, adaptive_empathy, adaptive_expressiveness, adaptive_verbosity, adaptive_mbti,
917
+ voice_enabled, voice_model, voice_name, voice_stt_model, voice_auto_speak,
918
+ harness_id, delegate_targets, context_tier_proportions,
919
+ anti_hallucination_mode, anti_hallucination_model_config, citation_strictness,
920
+ tool_credentials, router_policy, router_enabled, usage_strategy,
921
+ created_at, updated_at)
922
+ 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"
923
+ // (important for PATCH-style updates that omit the field).
924
+ 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);
925
+ return getAgentConfig(input.id);
926
+ }
927
+ function clampPercent(next, fallback) {
928
+ const n = Number.isFinite(next) ? Number(next) : fallback;
929
+ return Math.max(0, Math.min(100, Math.round(n)));
930
+ }
931
+ function serialiseToolCredentials(input, existing) {
932
+ if (input === undefined) return existing;
933
+ const cleaned = {};
934
+ for (const [k, v] of Object.entries(input)){
935
+ if (typeof k === "string" && k.length > 0 && typeof v === "string" && v.length > 0) {
936
+ cleaned[k] = v;
1112
937
  }
938
+ }
939
+ if (Object.keys(cleaned).length === 0) return null;
940
+ return JSON.stringify(cleaned);
941
+ }
942
+ function toMbti(v) {
943
+ if (!v) return null;
944
+ return v in _lib_agents_adaptive_persona_presets__WEBPACK_IMPORTED_MODULE_2__/* .MBTI_PRESETS */ .e ? v : null;
945
+ }
946
+ function deleteAgentConfig(id) {
947
+ return (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("DELETE FROM agent_configs WHERE id=?").run(id).changes > 0;
948
+ }
949
+ function generateAgentId(name) {
950
+ const slug = name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
951
+ const suffix = Math.random().toString(36).slice(2, 6);
952
+ return slug ? `${slug}-${suffix}` : `agent-${suffix}`;
953
+ }
954
+ // ── ADR-0022: per-agent message-channel display filters ─────────────────
955
+ // Canonical channel keys mirrored in `hooks/useMessageFilters.ts`. Kept
956
+ // in sync there by importing this constant — single source of truth.
957
+ const DISPLAY_FILTER_KEYS = [
958
+ "scheduled_task",
959
+ "watcher",
960
+ "bridge",
961
+ "extension",
962
+ "page_capture",
963
+ "synthetic",
964
+ "tool_use",
965
+ "thinking"
966
+ ];
967
+ const DISPLAY_FILTER_DEFAULTS = {
968
+ scheduled_task: true,
969
+ watcher: true,
970
+ bridge: true,
971
+ extension: true,
972
+ page_capture: true,
973
+ synthetic: true,
974
+ tool_use: true,
975
+ thinking: true
976
+ };
977
+ function parseDisplayFilters(raw) {
978
+ if (!raw) return {
979
+ ...DISPLAY_FILTER_DEFAULTS
1113
980
  };
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);
981
+ try {
982
+ const parsed = JSON.parse(raw);
983
+ // Merge over defaults so newly-added channels stay visible on old rows.
984
+ return {
985
+ ...DISPLAY_FILTER_DEFAULTS,
986
+ ...parsed
987
+ };
988
+ } catch {
989
+ return {
990
+ ...DISPLAY_FILTER_DEFAULTS
991
+ };
992
+ }
993
+ }
994
+ function getAgentDisplayFilters(id) {
995
+ const row = getAgentConfig(id);
996
+ if (!row) return null;
997
+ return parseDisplayFilters(row.display_filters);
998
+ }
999
+ /**
1000
+ * Merge a partial filter map into the agent's stored prefs. Pass `null` to
1001
+ * reset to defaults (clears the column). Safe against concurrent toggles
1002
+ * from multiple browser tabs because the merge happens server-side.
1003
+ */ function updateAgentDisplayFilters(id, patch) {
1004
+ const row = getAgentConfig(id);
1005
+ if (!row) return null;
1006
+ if (patch === null) {
1007
+ (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)().prepare("UPDATE agent_configs SET display_filters=NULL, updated_at=? WHERE id=?").run(now(), id);
1008
+ return {
1009
+ ...DISPLAY_FILTER_DEFAULTS
1010
+ };
1011
+ }
1012
+ const current = parseDisplayFilters(row.display_filters);
1013
+ const next = {
1014
+ ...current
1015
+ };
1016
+ for (const k of DISPLAY_FILTER_KEYS){
1017
+ if (k in patch && typeof patch[k] === "boolean") next[k] = patch[k];
1128
1018
  }
1019
+ (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);
1020
+ return next;
1021
+ }
1022
+
1023
+
1024
+ /***/ }),
1025
+
1026
+ /***/ 44708:
1027
+ /***/ ((module) => {
1028
+
1029
+ module.exports = require("node:https");
1030
+
1031
+ /***/ }),
1032
+
1033
+ /***/ 44870:
1034
+ /***/ ((module) => {
1035
+
1036
+ module.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js");
1037
+
1038
+ /***/ }),
1039
+
1040
+ /***/ 48161:
1041
+ /***/ ((module) => {
1042
+
1043
+ module.exports = require("node:os");
1044
+
1045
+ /***/ }),
1046
+
1047
+ /***/ 51455:
1048
+ /***/ ((module) => {
1049
+
1050
+ module.exports = require("node:fs/promises");
1051
+
1052
+ /***/ }),
1053
+
1054
+ /***/ 55511:
1055
+ /***/ ((module) => {
1056
+
1057
+ module.exports = require("crypto");
1058
+
1059
+ /***/ }),
1060
+
1061
+ /***/ 55591:
1062
+ /***/ ((module) => {
1063
+
1064
+ module.exports = require("https");
1065
+
1066
+ /***/ }),
1067
+
1068
+ /***/ 57075:
1069
+ /***/ ((module) => {
1070
+
1071
+ module.exports = require("node:stream");
1072
+
1073
+ /***/ }),
1074
+
1075
+ /***/ 57975:
1076
+ /***/ ((module) => {
1077
+
1078
+ module.exports = require("node:util");
1079
+
1080
+ /***/ }),
1081
+
1082
+ /***/ 63033:
1083
+ /***/ ((module) => {
1084
+
1085
+ module.exports = require("next/dist/server/app-render/work-unit-async-storage.external.js");
1086
+
1087
+ /***/ }),
1088
+
1089
+ /***/ 67118:
1090
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1091
+
1092
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1093
+ /* harmony export */ D: () => (/* binding */ resolveGoogleApiKey),
1094
+ /* harmony export */ _: () => (/* binding */ timeoutSignal)
1095
+ /* harmony export */ });
1096
+ /* harmony import */ var _lib_stores_integrations__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(78228);
1097
+
1098
+ function timeoutSignal(ms) {
1099
+ const c = new AbortController();
1100
+ setTimeout(()=>c.abort(new Error(`timeout after ${ms}ms`)), ms).unref?.();
1101
+ return c.signal;
1102
+ }
1103
+ function resolveGoogleApiKey() {
1104
+ const raw = (0,_lib_stores_integrations__WEBPACK_IMPORTED_MODULE_0__/* .getIntegrationRaw */ .$G)("google");
1105
+ const fromStore = raw?.api_key?.trim();
1106
+ if (fromStore) return fromStore;
1107
+ return (process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY || "").trim() || null;
1129
1108
  }
1130
1109
 
1131
- //# sourceMappingURL=app-route.js.map
1132
1110
 
1111
+ /***/ }),
1112
+
1113
+ /***/ 73024:
1114
+ /***/ ((module) => {
1115
+
1116
+ module.exports = require("node:fs");
1117
+
1118
+ /***/ }),
1119
+
1120
+ /***/ 75919:
1121
+ /***/ ((module) => {
1122
+
1123
+ module.exports = require("node:worker_threads");
1124
+
1125
+ /***/ }),
1126
+
1127
+ /***/ 76760:
1128
+ /***/ ((module) => {
1129
+
1130
+ module.exports = require("node:path");
1131
+
1132
+ /***/ }),
1133
+
1134
+ /***/ 77030:
1135
+ /***/ ((module) => {
1136
+
1137
+ module.exports = require("node:net");
1138
+
1139
+ /***/ }),
1140
+
1141
+ /***/ 77598:
1142
+ /***/ ((module) => {
1143
+
1144
+ module.exports = require("node:crypto");
1133
1145
 
1134
1146
  /***/ }),
1135
1147
 
@@ -1369,7 +1381,7 @@ module.exports = import("@huggingface/transformers");;
1369
1381
  var __webpack_require__ = require("../../../../../webpack-runtime.js");
1370
1382
  __webpack_require__.C(exports);
1371
1383
  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)));
1384
+ var __webpack_exports__ = __webpack_require__.X(0, [2970,7377,1813,7981,4992,46], () => (__webpack_exec__(6039)));
1373
1385
  module.exports = __webpack_exports__;
1374
1386
 
1375
1387
  })();