@circuitwall/jarela 2.7.0 → 3.0.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 (730) 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 +6 -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 +58 -58
  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 +127 -127
  22. package/.next/standalone/.next/server/app/api/v1/access/route.js +372 -372
  23. package/.next/standalone/.next/server/app/api/v1/agents/[id]/compact/route.js +79 -79
  24. package/.next/standalone/.next/server/app/api/v1/agents/[id]/display-filters/route.js +641 -641
  25. package/.next/standalone/.next/server/app/api/v1/agents/[id]/duplicate/route.js +723 -723
  26. package/.next/standalone/.next/server/app/api/v1/agents/[id]/route.js +100 -100
  27. package/.next/standalone/.next/server/app/api/v1/agents/[id]/thread/route.js +65 -65
  28. package/.next/standalone/.next/server/app/api/v1/agents/recent-replies/route.js +227 -227
  29. package/.next/standalone/.next/server/app/api/v1/agents/route.js +16 -16
  30. package/.next/standalone/.next/server/app/api/v1/allowed-sites/[hostname]/route.js +384 -384
  31. package/.next/standalone/.next/server/app/api/v1/allowed-sites/route.js +9 -9
  32. package/.next/standalone/.next/server/app/api/v1/artifacts/lifecycle/route.js +23 -23
  33. package/.next/standalone/.next/server/app/api/v1/attachments/files/route.js +203 -203
  34. package/.next/standalone/.next/server/app/api/v1/attachments/images/route.js +17 -17
  35. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js +2 -2
  36. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js.nft.json +1 -1
  37. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/ignores/[remote_jid]/route.js +760 -760
  38. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/ignores/route.js +699 -699
  39. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js +30 -30
  40. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js +37 -37
  42. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js.nft.json +1 -1
  43. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js +480 -480
  44. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js.nft.json +1 -1
  45. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/routes/[route_id]/route.js +675 -675
  46. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/routes/route.js +559 -559
  47. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js +23 -23
  48. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js.nft.json +1 -1
  49. package/.next/standalone/.next/server/app/api/v1/bridges/kinds/route.js +37 -37
  50. package/.next/standalone/.next/server/app/api/v1/bridges/route.js +1269 -1269
  51. package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js +199 -199
  52. package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js.nft.json +1 -1
  53. package/.next/standalone/.next/server/app/api/v1/config/route.js +99 -99
  54. package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js +23 -23
  55. package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js.nft.json +1 -1
  56. package/.next/standalone/.next/server/app/api/v1/credentials/route.js +169 -169
  57. package/.next/standalone/.next/server/app/api/v1/credentials/route.js.nft.json +1 -1
  58. package/.next/standalone/.next/server/app/api/v1/dashboard/currency/route.js +515 -515
  59. package/.next/standalone/.next/server/app/api/v1/dashboard/metrics/route.js +380 -380
  60. package/.next/standalone/.next/server/app/api/v1/dashboard/metrics/route.js.nft.json +1 -1
  61. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing/route.js +256 -256
  62. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing/route.js.nft.json +1 -1
  63. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js +80 -97
  64. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js.nft.json +1 -1
  65. package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js +677 -677
  66. package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js.nft.json +1 -1
  67. package/.next/standalone/.next/server/app/api/v1/documents/recall-policy/route.js +856 -0
  68. package/.next/standalone/.next/server/app/api/v1/documents/recall-policy/route.js.nft.json +1 -0
  69. package/.next/standalone/.next/server/app/api/v1/documents/recall-policy/route_client-reference-manifest.js +1 -0
  70. package/.next/standalone/.next/server/app/api/v1/documents/search/route.js +299 -247
  71. package/.next/standalone/.next/server/app/api/v1/documents/settings/route.js +486 -486
  72. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js +18 -11
  73. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js.nft.json +1 -1
  74. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js +666 -666
  75. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js.nft.json +1 -1
  76. package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js +128 -100
  77. package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js.nft.json +1 -1
  78. package/.next/standalone/.next/server/app/api/v1/env/route.js +207 -207
  79. package/.next/standalone/.next/server/app/api/v1/env-sync/allowlist/route.js +128 -128
  80. package/.next/standalone/.next/server/app/api/v1/env-sync/route.js +16 -16
  81. package/.next/standalone/.next/server/app/api/v1/events/route.js +154 -154
  82. package/.next/standalone/.next/server/app/api/v1/events/route.js.nft.json +1 -1
  83. package/.next/standalone/.next/server/app/api/v1/events/test/route.js +16 -16
  84. package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js +97 -97
  85. package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js.nft.json +1 -1
  86. package/.next/standalone/.next/server/app/api/v1/extension/browser/activate/route.js +188 -188
  87. package/.next/standalone/.next/server/app/api/v1/extension/browser/foreground/route.js +93 -93
  88. package/.next/standalone/.next/server/app/api/v1/extension/browser/history/route.js +9 -9
  89. package/.next/standalone/.next/server/app/api/v1/extension/browser/poll/route.js +93 -93
  90. package/.next/standalone/.next/server/app/api/v1/extension/browser/progress/route.js +69 -69
  91. package/.next/standalone/.next/server/app/api/v1/extension/browser/result/route.js +69 -69
  92. package/.next/standalone/.next/server/app/api/v1/extension/browser/retry/route.js +65 -65
  93. package/.next/standalone/.next/server/app/api/v1/extension/browser/status/route.js +223 -223
  94. package/.next/standalone/.next/server/app/api/v1/extension/browser/tabs/route.js +44 -44
  95. package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js +93 -93
  96. package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js.nft.json +1 -1
  97. package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js +44 -44
  98. package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js.nft.json +1 -1
  99. package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js +16 -16
  100. package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js.nft.json +1 -1
  101. package/.next/standalone/.next/server/app/api/v1/extensions/route.js +722 -722
  102. package/.next/standalone/.next/server/app/api/v1/extensions/route.js.nft.json +1 -1
  103. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js +481 -481
  104. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js.nft.json +1 -1
  105. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js +378 -378
  106. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js.nft.json +1 -1
  107. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js +510 -510
  108. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js.nft.json +1 -1
  109. package/.next/standalone/.next/server/app/api/v1/files/[name]/route.js +17 -17
  110. package/.next/standalone/.next/server/app/api/v1/fs/browse/route.js +33 -33
  111. package/.next/standalone/.next/server/app/api/v1/harnesses/[id]/route.js +397 -397
  112. package/.next/standalone/.next/server/app/api/v1/harnesses/default/route.js +129 -129
  113. package/.next/standalone/.next/server/app/api/v1/harnesses/route.js +9 -9
  114. package/.next/standalone/.next/server/app/api/v1/health/probes/route.js +757 -757
  115. package/.next/standalone/.next/server/app/api/v1/health/probes/route.js.nft.json +1 -1
  116. package/.next/standalone/.next/server/app/api/v1/health/route.js +228 -228
  117. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/route.js +37 -37
  118. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js +198 -198
  119. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js.nft.json +1 -1
  120. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/callback/route.js +9 -9
  121. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/start/route.js +845 -845
  122. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/status/route.js +23 -23
  123. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/callback/route.js +106 -106
  124. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/start/route.js +747 -747
  125. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/status/route.js +37 -37
  126. package/.next/standalone/.next/server/app/api/v1/integrations/route.js +37 -37
  127. package/.next/standalone/.next/server/app/api/v1/lifecycle/adoption/route.js +420 -420
  128. package/.next/standalone/.next/server/app/api/v1/local-file/route.js +34 -34
  129. package/.next/standalone/.next/server/app/api/v1/logs/route.js +819 -819
  130. package/.next/standalone/.next/server/app/api/v1/maps/embed/route.js +217 -217
  131. package/.next/standalone/.next/server/app/api/v1/mcp-servers/[name]/route.js +1034 -1034
  132. package/.next/standalone/.next/server/app/api/v1/mcp-servers/registry/route.js +2 -2
  133. package/.next/standalone/.next/server/app/api/v1/mcp-servers/route.js +58 -58
  134. package/.next/standalone/.next/server/app/api/v1/memory/[namespace]/[key]/route.js +150 -150
  135. package/.next/standalone/.next/server/app/api/v1/memory/policy/route.js +72 -72
  136. package/.next/standalone/.next/server/app/api/v1/memory/route.js +9 -9
  137. package/.next/standalone/.next/server/app/api/v1/memory/search/route.js +16 -16
  138. package/.next/standalone/.next/server/app/api/v1/models/[name]/compact-threads/route.js +72 -72
  139. package/.next/standalone/.next/server/app/api/v1/models/[name]/route.js +87 -538
  140. package/.next/standalone/.next/server/app/api/v1/models/[name]/route.js.nft.json +1 -1
  141. package/.next/standalone/.next/server/app/api/v1/models/route.js +273 -722
  142. package/.next/standalone/.next/server/app/api/v1/models/route.js.nft.json +1 -1
  143. package/.next/standalone/.next/server/app/api/v1/packages/catalog/route.js +73 -73
  144. package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js +248 -239
  145. package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js.nft.json +1 -1
  146. package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js +128 -128
  147. package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js.nft.json +1 -1
  148. package/.next/standalone/.next/server/app/api/v1/packages/install/route.js +44 -44
  149. package/.next/standalone/.next/server/app/api/v1/packages/install/route.js.nft.json +1 -1
  150. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js +72 -72
  151. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js.nft.json +1 -1
  152. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js +37 -37
  153. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js.nft.json +1 -1
  154. package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js +81 -81
  155. package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js.nft.json +1 -1
  156. package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js +34 -25
  157. package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js.nft.json +1 -1
  158. package/.next/standalone/.next/server/app/api/v1/packages/route.js +48 -39
  159. package/.next/standalone/.next/server/app/api/v1/packages/route.js.nft.json +1 -1
  160. package/.next/standalone/.next/server/app/api/v1/page-capture/route.js +51 -51
  161. package/.next/standalone/.next/server/app/api/v1/page-capture/route.js.nft.json +1 -1
  162. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js +863 -863
  163. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js.nft.json +1 -1
  164. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js +230 -230
  165. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js.nft.json +1 -1
  166. package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js +44 -44
  167. package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js.nft.json +1 -1
  168. package/.next/standalone/.next/server/app/api/v1/profile/location/route.js +138 -138
  169. package/.next/standalone/.next/server/app/api/v1/profile/route.js +51 -51
  170. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/models/route.js +853 -680
  171. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/probe/route.js +65 -65
  172. package/.next/standalone/.next/server/app/api/v1/providers/github-copilot/auth/route.js +171 -171
  173. package/.next/standalone/.next/server/app/api/v1/providers/route.js +96 -96
  174. package/.next/standalone/.next/server/app/api/v1/proxy-config/route.js +157 -157
  175. package/.next/standalone/.next/server/app/api/v1/redaction/init/route.js +47 -47
  176. package/.next/standalone/.next/server/app/api/v1/redaction/route.js +206 -206
  177. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/route.js +140 -140
  178. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js +166 -166
  179. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js.nft.json +1 -1
  180. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/route.js +52 -52
  181. package/.next/standalone/.next/server/app/api/v1/security/idle-timeout/route.js +722 -722
  182. package/.next/standalone/.next/server/app/api/v1/security/pin/route.js +23 -23
  183. package/.next/standalone/.next/server/app/api/v1/security/state/route.js +243 -243
  184. package/.next/standalone/.next/server/app/api/v1/security/unlock/route.js +518 -518
  185. package/.next/standalone/.next/server/app/api/v1/security/verify-pin/route.js +9 -9
  186. package/.next/standalone/.next/server/app/api/v1/setup/test-key/route.js +25 -25
  187. package/.next/standalone/.next/server/app/api/v1/skills/[id]/route.js +9 -9
  188. package/.next/standalone/.next/server/app/api/v1/skills/repos/[id]/route.js +609 -609
  189. package/.next/standalone/.next/server/app/api/v1/skills/repos/route.js +129 -129
  190. package/.next/standalone/.next/server/app/api/v1/skills/route.js +9 -9
  191. package/.next/standalone/.next/server/app/api/v1/system/abort/route.js +112 -112
  192. package/.next/standalone/.next/server/app/api/v1/system/restart/route.js +86 -86
  193. package/.next/standalone/.next/server/app/api/v1/system/restart/route.js.nft.json +1 -1
  194. package/.next/standalone/.next/server/app/api/v1/tailscale/route.js +9 -9
  195. package/.next/standalone/.next/server/app/api/v1/tasks/[agent_id]/route.js +83 -83
  196. package/.next/standalone/.next/server/app/api/v1/tasks/route.js +23 -23
  197. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route.js +121 -121
  198. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/context-pin/route.js +139 -139
  199. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/messages/[message_id]/route.js +51 -51
  200. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/route.js +58 -58
  201. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js +1182 -1182
  202. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js.nft.json +1 -1
  203. package/.next/standalone/.next/server/app/api/v1/threads/route.js +158 -158
  204. package/.next/standalone/.next/server/app/api/v1/tools/route.js +137 -137
  205. package/.next/standalone/.next/server/app/api/v1/tools/route.js.nft.json +1 -1
  206. package/.next/standalone/.next/server/app/api/v1/update/apply/route.js +73 -73
  207. package/.next/standalone/.next/server/app/api/v1/update/apply/route.js.nft.json +1 -1
  208. package/.next/standalone/.next/server/app/api/v1/update/route.js +72 -72
  209. package/.next/standalone/.next/server/app/api/v1/voice/transcribe/route.js +30 -30
  210. package/.next/standalone/.next/server/app/api/v1/voice/tts/route.js +79 -79
  211. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/route.js +9 -9
  212. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js +45 -45
  213. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js.nft.json +1 -1
  214. package/.next/standalone/.next/server/app/api/v1/watchers/reaction-scripts/route.js +2 -2
  215. package/.next/standalone/.next/server/app/api/v1/watchers/route.js +37 -37
  216. package/.next/standalone/.next/server/app/api/v1/watchers/route.js.nft.json +1 -1
  217. package/.next/standalone/.next/server/app/icon.svg/route.js +55 -55
  218. package/.next/standalone/.next/server/app/manifest.webmanifest/route.js +18 -18
  219. package/.next/standalone/.next/server/app/page.js +2112 -1235
  220. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  221. package/.next/standalone/.next/server/app/setup/page.js +91 -91
  222. package/.next/standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  223. package/.next/standalone/.next/server/app-paths-manifest.json +2 -1
  224. package/.next/standalone/.next/server/chunks/1244.js +136 -4
  225. package/.next/standalone/.next/server/chunks/1387.js +733 -57
  226. package/.next/standalone/.next/server/chunks/1433.js +1 -1
  227. package/.next/standalone/.next/server/chunks/210.js +3 -3
  228. package/.next/standalone/.next/server/chunks/2175.js +874 -0
  229. package/.next/standalone/.next/server/chunks/3042.js +34 -32
  230. package/.next/standalone/.next/server/chunks/309.js +21 -40
  231. package/.next/standalone/.next/server/chunks/3272.js +21 -40
  232. package/.next/standalone/.next/server/chunks/{540.js → 3326.js} +189 -61
  233. package/.next/standalone/.next/server/chunks/{6142.js → 3479.js} +170 -159
  234. package/.next/standalone/.next/server/chunks/3566.js +1 -1
  235. package/.next/standalone/.next/server/chunks/{5323.js → 3692.js} +31 -3
  236. package/.next/standalone/.next/server/chunks/4189.js +14 -2
  237. package/.next/standalone/.next/server/chunks/4377.js +2 -2
  238. package/.next/standalone/.next/server/chunks/4596.js +18 -9
  239. package/.next/standalone/.next/server/chunks/{639.js → 4728.js} +23676 -22755
  240. package/.next/standalone/.next/server/chunks/4955.js +81 -14
  241. package/.next/standalone/.next/server/chunks/5290.js +136 -5
  242. package/.next/standalone/.next/server/chunks/{2267.js → 6408.js} +990 -926
  243. package/.next/standalone/.next/server/chunks/{9667.js → 6911.js} +31 -3
  244. package/.next/standalone/.next/server/chunks/7033.js +7 -4
  245. package/.next/standalone/.next/server/chunks/7377.js +7 -4
  246. package/.next/standalone/.next/server/chunks/8461.js +31 -29
  247. package/.next/standalone/.next/server/chunks/9032.js +3 -3
  248. package/.next/standalone/.next/server/chunks/9174.js +18 -9
  249. package/.next/standalone/.next/server/chunks/9408.js +37 -15
  250. package/.next/standalone/.next/server/chunks/9824.js +2288 -2288
  251. package/.next/standalone/.next/server/middleware-build-manifest.js +2 -2
  252. package/.next/standalone/.next/server/middleware.js +104638 -104532
  253. package/.next/standalone/.next/server/pages/404.html +2 -2
  254. package/.next/standalone/.next/server/pages/500.html +1 -1
  255. package/.next/standalone/.next/server/preview-props.json +3 -3
  256. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  257. package/.next/standalone/.next/static/2BAUJZ7x8eXCYpuZ-Kp7h/_buildManifest.js +1 -0
  258. package/.next/standalone/.next/static/chunks/{877-145c9df8aa0aee63.js → 877-367eb49b20edd3d6.js} +38 -16
  259. package/.next/standalone/.next/static/chunks/app/_global-error/page-6cda89771c3f8ea4.js +17 -0
  260. package/.next/standalone/.next/static/chunks/app/api/v1/access/[identity]/route-6cda89771c3f8ea4.js +17 -0
  261. package/.next/standalone/.next/static/chunks/app/api/v1/access/route-6cda89771c3f8ea4.js +17 -0
  262. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/compact/route-6cda89771c3f8ea4.js +17 -0
  263. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/display-filters/route-6cda89771c3f8ea4.js +17 -0
  264. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/duplicate/route-6cda89771c3f8ea4.js +17 -0
  265. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/route-6cda89771c3f8ea4.js +17 -0
  266. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/thread/route-6cda89771c3f8ea4.js +17 -0
  267. package/.next/standalone/.next/static/chunks/app/api/v1/agents/recent-replies/route-6cda89771c3f8ea4.js +17 -0
  268. package/.next/standalone/.next/static/chunks/app/api/v1/agents/route-6cda89771c3f8ea4.js +17 -0
  269. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/[hostname]/route-6cda89771c3f8ea4.js +17 -0
  270. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/route-6cda89771c3f8ea4.js +17 -0
  271. package/.next/standalone/.next/static/chunks/app/api/v1/artifacts/lifecycle/route-6cda89771c3f8ea4.js +17 -0
  272. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/files/route-6cda89771c3f8ea4.js +17 -0
  273. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/images/route-6cda89771c3f8ea4.js +17 -0
  274. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/chats/route-6cda89771c3f8ea4.js +17 -0
  275. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/[remote_jid]/route-6cda89771c3f8ea4.js +17 -0
  276. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/route-6cda89771c3f8ea4.js +17 -0
  277. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/lookup/route-6cda89771c3f8ea4.js +17 -0
  278. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/pair/route-6cda89771c3f8ea4.js +17 -0
  279. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/route-6cda89771c3f8ea4.js +17 -0
  280. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/[route_id]/route-6cda89771c3f8ea4.js +17 -0
  281. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/route-6cda89771c3f8ea4.js +17 -0
  282. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/status/route-6cda89771c3f8ea4.js +17 -0
  283. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/kinds/route-6cda89771c3f8ea4.js +17 -0
  284. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/route-6cda89771c3f8ea4.js +17 -0
  285. package/.next/standalone/.next/static/chunks/app/api/v1/builtin-tools/route-6cda89771c3f8ea4.js +17 -0
  286. package/.next/standalone/.next/static/chunks/app/api/v1/config/route-6cda89771c3f8ea4.js +17 -0
  287. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/[id]/route-6cda89771c3f8ea4.js +17 -0
  288. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/route-6cda89771c3f8ea4.js +17 -0
  289. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/currency/route-6cda89771c3f8ea4.js +17 -0
  290. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/metrics/route-6cda89771c3f8ea4.js +17 -0
  291. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing/route-6cda89771c3f8ea4.js +17 -0
  292. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing-task/route-6cda89771c3f8ea4.js +17 -0
  293. package/.next/standalone/.next/static/chunks/app/api/v1/delegations/codex/[job_id]/route-6cda89771c3f8ea4.js +17 -0
  294. package/.next/standalone/.next/static/chunks/app/api/v1/documents/recall-policy/route-6cda89771c3f8ea4.js +17 -0
  295. package/.next/standalone/.next/static/chunks/app/api/v1/documents/search/route-6cda89771c3f8ea4.js +17 -0
  296. package/.next/standalone/.next/static/chunks/app/api/v1/documents/settings/route-6cda89771c3f8ea4.js +17 -0
  297. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/reindex/route-6cda89771c3f8ea4.js +17 -0
  298. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/route-6cda89771c3f8ea4.js +17 -0
  299. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/route-6cda89771c3f8ea4.js +17 -0
  300. package/.next/standalone/.next/static/chunks/app/api/v1/env/route-6cda89771c3f8ea4.js +17 -0
  301. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/allowlist/route-6cda89771c3f8ea4.js +17 -0
  302. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/route-6cda89771c3f8ea4.js +17 -0
  303. package/.next/standalone/.next/static/chunks/app/api/v1/events/route-6cda89771c3f8ea4.js +17 -0
  304. package/.next/standalone/.next/static/chunks/app/api/v1/events/test/route-6cda89771c3f8ea4.js +17 -0
  305. package/.next/standalone/.next/static/chunks/app/api/v1/extension/agents/route-6cda89771c3f8ea4.js +17 -0
  306. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/activate/route-6cda89771c3f8ea4.js +17 -0
  307. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/foreground/route-6cda89771c3f8ea4.js +17 -0
  308. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/history/route-6cda89771c3f8ea4.js +17 -0
  309. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/poll/route-6cda89771c3f8ea4.js +17 -0
  310. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/progress/route-6cda89771c3f8ea4.js +17 -0
  311. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/result/route-6cda89771c3f8ea4.js +17 -0
  312. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/retry/route-6cda89771c3f8ea4.js +17 -0
  313. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/status/route-6cda89771c3f8ea4.js +17 -0
  314. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/tabs/route-6cda89771c3f8ea4.js +17 -0
  315. package/.next/standalone/.next/static/chunks/app/api/v1/extension/fill/route-6cda89771c3f8ea4.js +17 -0
  316. package/.next/standalone/.next/static/chunks/app/api/v1/extension/refine/route-6cda89771c3f8ea4.js +17 -0
  317. package/.next/standalone/.next/static/chunks/app/api/v1/extension/turn/route-6cda89771c3f8ea4.js +17 -0
  318. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/route-6cda89771c3f8ea4.js +17 -0
  319. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/config/route-6cda89771c3f8ea4.js +17 -0
  320. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/route-6cda89771c3f8ea4.js +17 -0
  321. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/secrets/route-6cda89771c3f8ea4.js +17 -0
  322. package/.next/standalone/.next/static/chunks/app/api/v1/files/[name]/route-6cda89771c3f8ea4.js +17 -0
  323. package/.next/standalone/.next/static/chunks/app/api/v1/fs/browse/route-6cda89771c3f8ea4.js +17 -0
  324. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/[id]/route-6cda89771c3f8ea4.js +17 -0
  325. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/default/route-6cda89771c3f8ea4.js +17 -0
  326. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/route-6cda89771c3f8ea4.js +17 -0
  327. package/.next/standalone/.next/static/chunks/app/api/v1/health/probes/route-6cda89771c3f8ea4.js +17 -0
  328. package/.next/standalone/.next/static/chunks/app/api/v1/health/route-6cda89771c3f8ea4.js +17 -0
  329. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/route-6cda89771c3f8ea4.js +17 -0
  330. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/test/route-6cda89771c3f8ea4.js +17 -0
  331. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/callback/route-6cda89771c3f8ea4.js +17 -0
  332. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/start/route-6cda89771c3f8ea4.js +17 -0
  333. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/status/route-6cda89771c3f8ea4.js +17 -0
  334. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/callback/route-6cda89771c3f8ea4.js +17 -0
  335. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/start/route-6cda89771c3f8ea4.js +17 -0
  336. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/status/route-6cda89771c3f8ea4.js +17 -0
  337. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/route-6cda89771c3f8ea4.js +17 -0
  338. package/.next/standalone/.next/static/chunks/app/api/v1/lifecycle/adoption/route-6cda89771c3f8ea4.js +17 -0
  339. package/.next/standalone/.next/static/chunks/app/api/v1/local-file/route-6cda89771c3f8ea4.js +17 -0
  340. package/.next/standalone/.next/static/chunks/app/api/v1/logs/route-6cda89771c3f8ea4.js +17 -0
  341. package/.next/standalone/.next/static/chunks/app/api/v1/maps/embed/route-6cda89771c3f8ea4.js +17 -0
  342. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/[name]/route-6cda89771c3f8ea4.js +17 -0
  343. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/registry/route-6cda89771c3f8ea4.js +17 -0
  344. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/route-6cda89771c3f8ea4.js +17 -0
  345. package/.next/standalone/.next/static/chunks/app/api/v1/memory/[namespace]/[key]/route-6cda89771c3f8ea4.js +17 -0
  346. package/.next/standalone/.next/static/chunks/app/api/v1/memory/policy/route-6cda89771c3f8ea4.js +17 -0
  347. package/.next/standalone/.next/static/chunks/app/api/v1/memory/route-6cda89771c3f8ea4.js +17 -0
  348. package/.next/standalone/.next/static/chunks/app/api/v1/memory/search/route-6cda89771c3f8ea4.js +17 -0
  349. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/compact-threads/route-6cda89771c3f8ea4.js +17 -0
  350. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/route-6cda89771c3f8ea4.js +17 -0
  351. package/.next/standalone/.next/static/chunks/app/api/v1/models/route-6cda89771c3f8ea4.js +17 -0
  352. package/.next/standalone/.next/static/chunks/app/api/v1/packages/catalog/route-6cda89771c3f8ea4.js +17 -0
  353. package/.next/standalone/.next/static/chunks/app/api/v1/packages/defaults/[id]/route-6cda89771c3f8ea4.js +17 -0
  354. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/[id]/route-6cda89771c3f8ea4.js +17 -0
  355. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/route-6cda89771c3f8ea4.js +17 -0
  356. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/enabled/route-6cda89771c3f8ea4.js +17 -0
  357. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/route-6cda89771c3f8ea4.js +17 -0
  358. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/route-6cda89771c3f8ea4.js +17 -0
  359. package/.next/standalone/.next/static/chunks/app/api/v1/packages/reload/route-6cda89771c3f8ea4.js +17 -0
  360. package/.next/standalone/.next/static/chunks/app/api/v1/packages/route-6cda89771c3f8ea4.js +17 -0
  361. package/.next/standalone/.next/static/chunks/app/api/v1/page-capture/route-6cda89771c3f8ea4.js +17 -0
  362. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/approve/route-6cda89771c3f8ea4.js +17 -0
  363. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/deny/route-6cda89771c3f8ea4.js +17 -0
  364. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/route-6cda89771c3f8ea4.js +17 -0
  365. package/.next/standalone/.next/static/chunks/app/api/v1/profile/location/route-6cda89771c3f8ea4.js +17 -0
  366. package/.next/standalone/.next/static/chunks/app/api/v1/profile/route-6cda89771c3f8ea4.js +17 -0
  367. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/models/route-6cda89771c3f8ea4.js +17 -0
  368. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/probe/route-6cda89771c3f8ea4.js +17 -0
  369. package/.next/standalone/.next/static/chunks/app/api/v1/providers/github-copilot/auth/route-6cda89771c3f8ea4.js +17 -0
  370. package/.next/standalone/.next/static/chunks/app/api/v1/providers/route-6cda89771c3f8ea4.js +17 -0
  371. package/.next/standalone/.next/static/chunks/app/api/v1/proxy-config/route-6cda89771c3f8ea4.js +17 -0
  372. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/init/route-6cda89771c3f8ea4.js +17 -0
  373. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/route-6cda89771c3f8ea4.js +17 -0
  374. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/route-6cda89771c3f8ea4.js +17 -0
  375. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/run/route-6cda89771c3f8ea4.js +17 -0
  376. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/route-6cda89771c3f8ea4.js +17 -0
  377. package/.next/standalone/.next/static/chunks/app/api/v1/security/idle-timeout/route-6cda89771c3f8ea4.js +17 -0
  378. package/.next/standalone/.next/static/chunks/app/api/v1/security/pin/route-6cda89771c3f8ea4.js +17 -0
  379. package/.next/standalone/.next/static/chunks/app/api/v1/security/state/route-6cda89771c3f8ea4.js +17 -0
  380. package/.next/standalone/.next/static/chunks/app/api/v1/security/unlock/route-6cda89771c3f8ea4.js +17 -0
  381. package/.next/standalone/.next/static/chunks/app/api/v1/security/verify-pin/route-6cda89771c3f8ea4.js +17 -0
  382. package/.next/standalone/.next/static/chunks/app/api/v1/setup/test-key/route-6cda89771c3f8ea4.js +17 -0
  383. package/.next/standalone/.next/static/chunks/app/api/v1/skills/[id]/route-6cda89771c3f8ea4.js +17 -0
  384. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/[id]/route-6cda89771c3f8ea4.js +17 -0
  385. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/route-6cda89771c3f8ea4.js +17 -0
  386. package/.next/standalone/.next/static/chunks/app/api/v1/skills/route-6cda89771c3f8ea4.js +17 -0
  387. package/.next/standalone/.next/static/chunks/app/api/v1/system/abort/route-6cda89771c3f8ea4.js +17 -0
  388. package/.next/standalone/.next/static/chunks/app/api/v1/system/restart/route-6cda89771c3f8ea4.js +17 -0
  389. package/.next/standalone/.next/static/chunks/app/api/v1/tailscale/route-6cda89771c3f8ea4.js +17 -0
  390. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/[agent_id]/route-6cda89771c3f8ea4.js +17 -0
  391. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/route-6cda89771c3f8ea4.js +17 -0
  392. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/activity/route-6cda89771c3f8ea4.js +17 -0
  393. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/context-pin/route-6cda89771c3f8ea4.js +17 -0
  394. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/messages/[message_id]/route-6cda89771c3f8ea4.js +17 -0
  395. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/route-6cda89771c3f8ea4.js +17 -0
  396. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/run/route-6cda89771c3f8ea4.js +17 -0
  397. package/.next/standalone/.next/static/chunks/app/api/v1/threads/route-6cda89771c3f8ea4.js +17 -0
  398. package/.next/standalone/.next/static/chunks/app/api/v1/tools/route-6cda89771c3f8ea4.js +17 -0
  399. package/.next/standalone/.next/static/chunks/app/api/v1/update/apply/route-6cda89771c3f8ea4.js +17 -0
  400. package/.next/standalone/.next/static/chunks/app/api/v1/update/route-6cda89771c3f8ea4.js +17 -0
  401. package/.next/standalone/.next/static/chunks/app/api/v1/voice/transcribe/route-6cda89771c3f8ea4.js +17 -0
  402. package/.next/standalone/.next/static/chunks/app/api/v1/voice/tts/route-6cda89771c3f8ea4.js +17 -0
  403. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/route-6cda89771c3f8ea4.js +17 -0
  404. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/run/route-6cda89771c3f8ea4.js +17 -0
  405. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/reaction-scripts/route-6cda89771c3f8ea4.js +17 -0
  406. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/route-6cda89771c3f8ea4.js +17 -0
  407. package/.next/standalone/.next/static/chunks/app/manifest.webmanifest/route-6cda89771c3f8ea4.js +17 -0
  408. package/.next/standalone/.next/static/chunks/app/{page-64585ef79400f17f.js → page-a584dfa806a1afdb.js} +1082 -205
  409. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-6cda89771c3f8ea4.js +17 -0
  410. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-6cda89771c3f8ea4.js +17 -0
  411. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-6cda89771c3f8ea4.js +17 -0
  412. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-6cda89771c3f8ea4.js +17 -0
  413. package/.next/standalone/.next/static/css/19e1cd815490b47c.css +5 -0
  414. package/.next/standalone/docs/adoption/changesets.json +148 -0
  415. package/.next/standalone/package.json +5 -4
  416. package/CHANGELOG.md +51 -0
  417. package/README.md +115 -1
  418. package/api/client.startup.test.ts +29 -0
  419. package/api/client.ts +9 -2
  420. package/api/types.ts +20 -1
  421. package/app/api/v1/dashboard/pricing-task/route.ts +3 -1
  422. package/app/api/v1/documents/recall-policy/route.test.ts +59 -0
  423. package/app/api/v1/documents/recall-policy/route.ts +20 -0
  424. package/app/api/v1/documents/search/route.test.ts +36 -0
  425. package/app/api/v1/documents/search/route.ts +17 -5
  426. package/app/api/v1/documents/sources/[id]/reindex/route.test.ts +44 -0
  427. package/app/api/v1/documents/sources/[id]/reindex/route.ts +4 -1
  428. package/app/api/v1/documents/sources/route.test.ts +67 -0
  429. package/app/api/v1/documents/sources/route.ts +20 -2
  430. package/app/api/v1/models/[name]/route.ts +2 -0
  431. package/app/api/v1/models/route.ts +4 -0
  432. package/app/api/v1/providers/[provider]/models/route.test.ts +28 -0
  433. package/app/api/v1/providers/[provider]/models/route.ts +16 -2
  434. package/app/globals.css +51 -4
  435. package/components/agents/AgentsPanel.tsx +2 -2
  436. package/components/agents/agent-editor/AdvancedSection.tsx +1 -1
  437. package/components/agents/agent-editor/ModelSection.tsx +2 -2
  438. package/components/bridges/BridgeEditor.tsx +1 -1
  439. package/components/bridges/BridgesPanel.tsx +1 -1
  440. package/components/chat/InputBar.tsx +1 -1
  441. package/components/chat/MessageList.tsx +3 -3
  442. package/components/chat/useUserProfileAndAgent.test.tsx +43 -1
  443. package/components/chat/useUserProfileAndAgent.ts +16 -5
  444. package/components/credentials/CredentialsPanel.tsx +1 -1
  445. package/components/dashboard/CostBreakdown.test.tsx +34 -0
  446. package/components/dashboard/CostBreakdown.tsx +21 -0
  447. package/components/dashboard/DashboardPanel.test.tsx +9 -0
  448. package/components/dashboard/DashboardPanel.tsx +3 -3
  449. package/components/dashboard/Donuts.tsx +5 -2
  450. package/components/dashboard/ModelPricingSection.test.tsx +42 -0
  451. package/components/dashboard/ModelPricingSection.tsx +23 -21
  452. package/components/dashboard/Series.test.tsx +1 -0
  453. package/components/dashboard/Series.tsx +5 -0
  454. package/components/dashboard/SummaryCards.tsx +39 -27
  455. package/components/dashboard/VendorModelReportSection.tsx +2 -0
  456. package/components/documents/AddSourceFields.tsx +52 -15
  457. package/components/documents/AddSourceForm.tsx +61 -19
  458. package/components/documents/DocumentsPanel.tsx +22 -2
  459. package/components/documents/RecallExclusions.tsx +73 -0
  460. package/components/documents/SearchProbe.tsx +42 -5
  461. package/components/documents/helpers.ts +17 -3
  462. package/components/documents/indexing-controls.test.tsx +137 -0
  463. package/components/documents/useDocumentsPanel.test.tsx +87 -0
  464. package/components/documents/useDocumentsPanel.ts +47 -6
  465. package/components/env/EnvVarsPanel.tsx +1 -1
  466. package/components/harness/HarnessPanel.tsx +2 -2
  467. package/components/integrations/NetworkPanel.tsx +1 -1
  468. package/components/layout/AgentCardControls.test.tsx +162 -0
  469. package/components/layout/AgentCardControls.tsx +126 -0
  470. package/components/layout/AgentSwitcher.test.tsx +37 -0
  471. package/components/layout/AgentSwitcher.tsx +28 -3
  472. package/components/layout/AppShell.tsx +16 -9
  473. package/components/layout/MenuPanel.test.tsx +125 -2
  474. package/components/layout/MenuPanel.tsx +96 -2
  475. package/components/logs/LogsPanel.tsx +1 -1
  476. package/components/mcp/MCPPanel.tsx +1 -1
  477. package/components/memory/UnifiedMemoryPanel.tsx +4 -4
  478. package/components/models/CapBadges.tsx +1 -1
  479. package/components/models/EmbeddingModelSection.test.tsx +41 -0
  480. package/components/models/EmbeddingModelSection.tsx +5 -0
  481. package/components/models/ModelFeatureGuide.tsx +16 -8
  482. package/components/models/ModelsPanel.tsx +8 -3
  483. package/components/models/model-editor/ModelEditorBody.tsx +1 -0
  484. package/components/models/model-editor/ModelIdSection.tsx +5 -0
  485. package/components/profile/ProfileEditor.test.tsx +70 -0
  486. package/components/profile/ProfileEditor.tsx +6 -2
  487. package/components/profile/ProfilePanel.test.tsx +6 -0
  488. package/components/profile/ProfilePanel.tsx +1 -1
  489. package/components/scheduled-tasks/ScheduledTasksPanel.tsx +1 -1
  490. package/components/settings/AppearancePanel.tsx +1 -1
  491. package/components/settings/SettingsPanel.test.tsx +23 -0
  492. package/components/settings/SettingsPanel.tsx +2 -2
  493. package/components/skills/SkillsPanel.tsx +1 -1
  494. package/components/tools/BrowserPanel.tsx +1 -1
  495. package/components/tools/PackagesPanel.tsx +1 -1
  496. package/components/tools/UnifiedPackageList.tsx +1 -1
  497. package/components/ui/PanelHeader.tsx +1 -1
  498. package/components/ui/SubTabBar.tsx +1 -1
  499. package/docs/INSTALL.md +7 -5
  500. package/hooks/useAgents.ts +2 -2
  501. package/lib/agents/prepare/system-prompt.test.ts +65 -0
  502. package/lib/agents/prepare/system-prompt.ts +27 -20
  503. package/lib/agents/prompt-registry.test.ts +42 -0
  504. package/lib/agents/prompt-registry.ts +21 -0
  505. package/lib/bridges/whatsapp.inbound.test.ts +38 -1
  506. package/lib/bridges/whatsapp.ts +10 -33
  507. package/lib/db/index.ts +2 -0
  508. package/lib/db/migrations.test.ts +10 -0
  509. package/lib/db/migrations.ts +10 -0
  510. package/lib/db/statement-cache.test.ts +77 -0
  511. package/lib/db/statement-cache.ts +31 -0
  512. package/lib/documents/indexer.test.ts +16 -1
  513. package/lib/documents/indexer.ts +8 -7
  514. package/lib/documents/mail-source-config.ts +31 -0
  515. package/lib/documents/recall-policy.ts +24 -0
  516. package/lib/documents/remote/icloud.ts +56 -0
  517. package/lib/documents/remote/index.ts +4 -1
  518. package/lib/documents/remote/mail.test.ts +232 -0
  519. package/lib/documents/remote/mail.ts +48 -40
  520. package/lib/documents/search.test.ts +81 -2
  521. package/lib/documents/search.ts +47 -7
  522. package/lib/embeddings/cache.test.ts +16 -2
  523. package/lib/embeddings/index.test.ts +7 -0
  524. package/lib/embeddings/index.ts +12 -1
  525. package/lib/integrations/deepseek-web/manifest.ts +68 -0
  526. package/lib/integrations/gmail/manifest.ts +2 -3
  527. package/lib/integrations/icloud/manifest.ts +19 -5
  528. package/lib/integrations/registry.test.ts +8 -0
  529. package/lib/integrations/registry.ts +2 -0
  530. package/lib/lifecycle/changeset-build.test.ts +3 -0
  531. package/lib/lifecycle/changeset-build.ts +6 -0
  532. package/lib/lifecycle/changesets.ts +9 -0
  533. package/lib/pricing/llm-extract.ts +1 -1
  534. package/lib/pricing/maintenance-task.ts +19 -3
  535. package/lib/pricing/model-updates.test.ts +192 -0
  536. package/lib/pricing/model-updates.ts +205 -0
  537. package/lib/stores/app-settings.ts +17 -1
  538. package/lib/stores/dashboard-metrics-cache.test.ts +44 -0
  539. package/lib/stores/dashboard-metrics.test.ts +47 -4
  540. package/lib/stores/dashboard-metrics.ts +73 -8
  541. package/lib/stores/document-sources.ts +1 -0
  542. package/lib/stores/integrations.test.ts +20 -0
  543. package/lib/stores/integrations.ts +15 -4
  544. package/lib/stores/langgraph-store.test.ts +53 -0
  545. package/lib/stores/langgraph-store.ts +9 -21
  546. package/lib/stores/model-metadata.ts +89 -0
  547. package/lib/stores/threads.test.ts +34 -0
  548. package/lib/stores/threads.ts +17 -20
  549. package/lib/stores/tool-stats.test.ts +31 -0
  550. package/lib/stores/tool-stats.ts +16 -0
  551. package/lib/stores/version-adoption.test.ts +8 -0
  552. package/lib/stores/version-adoption.ts +5 -2
  553. package/lib/tools/general/documents.test.ts +5 -0
  554. package/lib/tools/general/pricing-maintenance.test.ts +5 -0
  555. package/lib/tools/general/pricing-maintenance.ts +4 -1
  556. package/lib/tools/packages/default-packages/icloud.test.ts +49 -0
  557. package/lib/tools/packages/default-packages/icloud.ts +8 -6
  558. package/lib/tools/packages/default-packages.test.ts +16 -0
  559. package/lib/tools/packages/langchain-packages.ts +2 -2
  560. package/lib/tools/runtime/category-filter.test.ts +22 -0
  561. package/lib/tools/web/deepseek.test.ts +76 -0
  562. package/lib/tools/web/deepseek.ts +68 -0
  563. package/lib/tools/web/fetch.test.ts +130 -2
  564. package/lib/tools/web/fetch.ts +48 -1
  565. package/lib/tools/web/search.test.ts +139 -2
  566. package/lib/tools/web/search.ts +48 -1
  567. package/lib/triggers/handlers/scheduled-task.test.ts +18 -0
  568. package/lib/triggers/handlers/scheduled-task.ts +6 -0
  569. package/lib/ui/feature-readiness.test.ts +7 -0
  570. package/lib/ui/feature-readiness.ts +2 -1
  571. package/package.json +5 -4
  572. package/scripts/check-npm-package.mjs +1 -0
  573. package/scripts/jarela-bin.mjs +3 -0
  574. package/scripts/runtime-version.mjs +19 -0
  575. package/scripts/start-prod.mjs +3 -0
  576. package/.next/standalone/.next/static/6qLnqWdsfBTJOAJApUYXy/_buildManifest.js +0 -1
  577. package/.next/standalone/.next/static/chunks/app/_global-error/page-f6b126e5c5b11551.js +0 -17
  578. package/.next/standalone/.next/static/chunks/app/api/v1/access/[identity]/route-f6b126e5c5b11551.js +0 -17
  579. package/.next/standalone/.next/static/chunks/app/api/v1/access/route-f6b126e5c5b11551.js +0 -17
  580. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/compact/route-f6b126e5c5b11551.js +0 -17
  581. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/display-filters/route-f6b126e5c5b11551.js +0 -17
  582. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/duplicate/route-f6b126e5c5b11551.js +0 -17
  583. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/route-f6b126e5c5b11551.js +0 -17
  584. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/thread/route-f6b126e5c5b11551.js +0 -17
  585. package/.next/standalone/.next/static/chunks/app/api/v1/agents/recent-replies/route-f6b126e5c5b11551.js +0 -17
  586. package/.next/standalone/.next/static/chunks/app/api/v1/agents/route-f6b126e5c5b11551.js +0 -17
  587. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/[hostname]/route-f6b126e5c5b11551.js +0 -17
  588. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/route-f6b126e5c5b11551.js +0 -17
  589. package/.next/standalone/.next/static/chunks/app/api/v1/artifacts/lifecycle/route-f6b126e5c5b11551.js +0 -17
  590. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/files/route-f6b126e5c5b11551.js +0 -17
  591. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/images/route-f6b126e5c5b11551.js +0 -17
  592. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/chats/route-f6b126e5c5b11551.js +0 -17
  593. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/[remote_jid]/route-f6b126e5c5b11551.js +0 -17
  594. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/route-f6b126e5c5b11551.js +0 -17
  595. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/lookup/route-f6b126e5c5b11551.js +0 -17
  596. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/pair/route-f6b126e5c5b11551.js +0 -17
  597. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/route-f6b126e5c5b11551.js +0 -17
  598. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/[route_id]/route-f6b126e5c5b11551.js +0 -17
  599. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/route-f6b126e5c5b11551.js +0 -17
  600. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/status/route-f6b126e5c5b11551.js +0 -17
  601. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/kinds/route-f6b126e5c5b11551.js +0 -17
  602. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/route-f6b126e5c5b11551.js +0 -17
  603. package/.next/standalone/.next/static/chunks/app/api/v1/builtin-tools/route-f6b126e5c5b11551.js +0 -17
  604. package/.next/standalone/.next/static/chunks/app/api/v1/config/route-f6b126e5c5b11551.js +0 -17
  605. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/[id]/route-f6b126e5c5b11551.js +0 -17
  606. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/route-f6b126e5c5b11551.js +0 -17
  607. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/currency/route-f6b126e5c5b11551.js +0 -17
  608. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/metrics/route-f6b126e5c5b11551.js +0 -17
  609. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing/route-f6b126e5c5b11551.js +0 -17
  610. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing-task/route-f6b126e5c5b11551.js +0 -17
  611. package/.next/standalone/.next/static/chunks/app/api/v1/delegations/codex/[job_id]/route-f6b126e5c5b11551.js +0 -17
  612. package/.next/standalone/.next/static/chunks/app/api/v1/documents/search/route-f6b126e5c5b11551.js +0 -17
  613. package/.next/standalone/.next/static/chunks/app/api/v1/documents/settings/route-f6b126e5c5b11551.js +0 -17
  614. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/reindex/route-f6b126e5c5b11551.js +0 -17
  615. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/route-f6b126e5c5b11551.js +0 -17
  616. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/route-f6b126e5c5b11551.js +0 -17
  617. package/.next/standalone/.next/static/chunks/app/api/v1/env/route-f6b126e5c5b11551.js +0 -17
  618. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/allowlist/route-f6b126e5c5b11551.js +0 -17
  619. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/route-f6b126e5c5b11551.js +0 -17
  620. package/.next/standalone/.next/static/chunks/app/api/v1/events/route-f6b126e5c5b11551.js +0 -17
  621. package/.next/standalone/.next/static/chunks/app/api/v1/events/test/route-f6b126e5c5b11551.js +0 -17
  622. package/.next/standalone/.next/static/chunks/app/api/v1/extension/agents/route-f6b126e5c5b11551.js +0 -17
  623. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/activate/route-f6b126e5c5b11551.js +0 -17
  624. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/foreground/route-f6b126e5c5b11551.js +0 -17
  625. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/history/route-f6b126e5c5b11551.js +0 -17
  626. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/poll/route-f6b126e5c5b11551.js +0 -17
  627. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/progress/route-f6b126e5c5b11551.js +0 -17
  628. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/result/route-f6b126e5c5b11551.js +0 -17
  629. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/retry/route-f6b126e5c5b11551.js +0 -17
  630. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/status/route-f6b126e5c5b11551.js +0 -17
  631. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/tabs/route-f6b126e5c5b11551.js +0 -17
  632. package/.next/standalone/.next/static/chunks/app/api/v1/extension/fill/route-f6b126e5c5b11551.js +0 -17
  633. package/.next/standalone/.next/static/chunks/app/api/v1/extension/refine/route-f6b126e5c5b11551.js +0 -17
  634. package/.next/standalone/.next/static/chunks/app/api/v1/extension/turn/route-f6b126e5c5b11551.js +0 -17
  635. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/route-f6b126e5c5b11551.js +0 -17
  636. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/config/route-f6b126e5c5b11551.js +0 -17
  637. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/route-f6b126e5c5b11551.js +0 -17
  638. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/secrets/route-f6b126e5c5b11551.js +0 -17
  639. package/.next/standalone/.next/static/chunks/app/api/v1/files/[name]/route-f6b126e5c5b11551.js +0 -17
  640. package/.next/standalone/.next/static/chunks/app/api/v1/fs/browse/route-f6b126e5c5b11551.js +0 -17
  641. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/[id]/route-f6b126e5c5b11551.js +0 -17
  642. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/default/route-f6b126e5c5b11551.js +0 -17
  643. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/route-f6b126e5c5b11551.js +0 -17
  644. package/.next/standalone/.next/static/chunks/app/api/v1/health/probes/route-f6b126e5c5b11551.js +0 -17
  645. package/.next/standalone/.next/static/chunks/app/api/v1/health/route-f6b126e5c5b11551.js +0 -17
  646. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/route-f6b126e5c5b11551.js +0 -17
  647. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/test/route-f6b126e5c5b11551.js +0 -17
  648. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/callback/route-f6b126e5c5b11551.js +0 -17
  649. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/start/route-f6b126e5c5b11551.js +0 -17
  650. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/status/route-f6b126e5c5b11551.js +0 -17
  651. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/callback/route-f6b126e5c5b11551.js +0 -17
  652. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/start/route-f6b126e5c5b11551.js +0 -17
  653. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/status/route-f6b126e5c5b11551.js +0 -17
  654. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/route-f6b126e5c5b11551.js +0 -17
  655. package/.next/standalone/.next/static/chunks/app/api/v1/lifecycle/adoption/route-f6b126e5c5b11551.js +0 -17
  656. package/.next/standalone/.next/static/chunks/app/api/v1/local-file/route-f6b126e5c5b11551.js +0 -17
  657. package/.next/standalone/.next/static/chunks/app/api/v1/logs/route-f6b126e5c5b11551.js +0 -17
  658. package/.next/standalone/.next/static/chunks/app/api/v1/maps/embed/route-f6b126e5c5b11551.js +0 -17
  659. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/[name]/route-f6b126e5c5b11551.js +0 -17
  660. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/registry/route-f6b126e5c5b11551.js +0 -17
  661. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/route-f6b126e5c5b11551.js +0 -17
  662. package/.next/standalone/.next/static/chunks/app/api/v1/memory/[namespace]/[key]/route-f6b126e5c5b11551.js +0 -17
  663. package/.next/standalone/.next/static/chunks/app/api/v1/memory/policy/route-f6b126e5c5b11551.js +0 -17
  664. package/.next/standalone/.next/static/chunks/app/api/v1/memory/route-f6b126e5c5b11551.js +0 -17
  665. package/.next/standalone/.next/static/chunks/app/api/v1/memory/search/route-f6b126e5c5b11551.js +0 -17
  666. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/compact-threads/route-f6b126e5c5b11551.js +0 -17
  667. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/route-f6b126e5c5b11551.js +0 -17
  668. package/.next/standalone/.next/static/chunks/app/api/v1/models/route-f6b126e5c5b11551.js +0 -17
  669. package/.next/standalone/.next/static/chunks/app/api/v1/packages/catalog/route-f6b126e5c5b11551.js +0 -17
  670. package/.next/standalone/.next/static/chunks/app/api/v1/packages/defaults/[id]/route-f6b126e5c5b11551.js +0 -17
  671. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/[id]/route-f6b126e5c5b11551.js +0 -17
  672. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/route-f6b126e5c5b11551.js +0 -17
  673. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/enabled/route-f6b126e5c5b11551.js +0 -17
  674. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/route-f6b126e5c5b11551.js +0 -17
  675. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/route-f6b126e5c5b11551.js +0 -17
  676. package/.next/standalone/.next/static/chunks/app/api/v1/packages/reload/route-f6b126e5c5b11551.js +0 -17
  677. package/.next/standalone/.next/static/chunks/app/api/v1/packages/route-f6b126e5c5b11551.js +0 -17
  678. package/.next/standalone/.next/static/chunks/app/api/v1/page-capture/route-f6b126e5c5b11551.js +0 -17
  679. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/approve/route-f6b126e5c5b11551.js +0 -17
  680. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/deny/route-f6b126e5c5b11551.js +0 -17
  681. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/route-f6b126e5c5b11551.js +0 -17
  682. package/.next/standalone/.next/static/chunks/app/api/v1/profile/location/route-f6b126e5c5b11551.js +0 -17
  683. package/.next/standalone/.next/static/chunks/app/api/v1/profile/route-f6b126e5c5b11551.js +0 -17
  684. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/models/route-f6b126e5c5b11551.js +0 -17
  685. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/probe/route-f6b126e5c5b11551.js +0 -17
  686. package/.next/standalone/.next/static/chunks/app/api/v1/providers/github-copilot/auth/route-f6b126e5c5b11551.js +0 -17
  687. package/.next/standalone/.next/static/chunks/app/api/v1/providers/route-f6b126e5c5b11551.js +0 -17
  688. package/.next/standalone/.next/static/chunks/app/api/v1/proxy-config/route-f6b126e5c5b11551.js +0 -17
  689. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/init/route-f6b126e5c5b11551.js +0 -17
  690. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/route-f6b126e5c5b11551.js +0 -17
  691. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/route-f6b126e5c5b11551.js +0 -17
  692. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/run/route-f6b126e5c5b11551.js +0 -17
  693. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/route-f6b126e5c5b11551.js +0 -17
  694. package/.next/standalone/.next/static/chunks/app/api/v1/security/idle-timeout/route-f6b126e5c5b11551.js +0 -17
  695. package/.next/standalone/.next/static/chunks/app/api/v1/security/pin/route-f6b126e5c5b11551.js +0 -17
  696. package/.next/standalone/.next/static/chunks/app/api/v1/security/state/route-f6b126e5c5b11551.js +0 -17
  697. package/.next/standalone/.next/static/chunks/app/api/v1/security/unlock/route-f6b126e5c5b11551.js +0 -17
  698. package/.next/standalone/.next/static/chunks/app/api/v1/security/verify-pin/route-f6b126e5c5b11551.js +0 -17
  699. package/.next/standalone/.next/static/chunks/app/api/v1/setup/test-key/route-f6b126e5c5b11551.js +0 -17
  700. package/.next/standalone/.next/static/chunks/app/api/v1/skills/[id]/route-f6b126e5c5b11551.js +0 -17
  701. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/[id]/route-f6b126e5c5b11551.js +0 -17
  702. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/route-f6b126e5c5b11551.js +0 -17
  703. package/.next/standalone/.next/static/chunks/app/api/v1/skills/route-f6b126e5c5b11551.js +0 -17
  704. package/.next/standalone/.next/static/chunks/app/api/v1/system/abort/route-f6b126e5c5b11551.js +0 -17
  705. package/.next/standalone/.next/static/chunks/app/api/v1/system/restart/route-f6b126e5c5b11551.js +0 -17
  706. package/.next/standalone/.next/static/chunks/app/api/v1/tailscale/route-f6b126e5c5b11551.js +0 -17
  707. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/[agent_id]/route-f6b126e5c5b11551.js +0 -17
  708. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/route-f6b126e5c5b11551.js +0 -17
  709. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/activity/route-f6b126e5c5b11551.js +0 -17
  710. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/context-pin/route-f6b126e5c5b11551.js +0 -17
  711. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/messages/[message_id]/route-f6b126e5c5b11551.js +0 -17
  712. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/route-f6b126e5c5b11551.js +0 -17
  713. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/run/route-f6b126e5c5b11551.js +0 -17
  714. package/.next/standalone/.next/static/chunks/app/api/v1/threads/route-f6b126e5c5b11551.js +0 -17
  715. package/.next/standalone/.next/static/chunks/app/api/v1/tools/route-f6b126e5c5b11551.js +0 -17
  716. package/.next/standalone/.next/static/chunks/app/api/v1/update/apply/route-f6b126e5c5b11551.js +0 -17
  717. package/.next/standalone/.next/static/chunks/app/api/v1/update/route-f6b126e5c5b11551.js +0 -17
  718. package/.next/standalone/.next/static/chunks/app/api/v1/voice/transcribe/route-f6b126e5c5b11551.js +0 -17
  719. package/.next/standalone/.next/static/chunks/app/api/v1/voice/tts/route-f6b126e5c5b11551.js +0 -17
  720. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/route-f6b126e5c5b11551.js +0 -17
  721. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/run/route-f6b126e5c5b11551.js +0 -17
  722. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/reaction-scripts/route-f6b126e5c5b11551.js +0 -17
  723. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/route-f6b126e5c5b11551.js +0 -17
  724. package/.next/standalone/.next/static/chunks/app/manifest.webmanifest/route-f6b126e5c5b11551.js +0 -17
  725. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-f6b126e5c5b11551.js +0 -17
  726. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-f6b126e5c5b11551.js +0 -17
  727. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-f6b126e5c5b11551.js +0 -17
  728. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-f6b126e5c5b11551.js +0 -17
  729. package/.next/standalone/.next/static/css/c4a8bed1da2c748f.css +0 -5
  730. /package/.next/standalone/.next/static/{6qLnqWdsfBTJOAJApUYXy → 2BAUJZ7x8eXCYpuZ-Kp7h}/_ssgManifest.js +0 -0
@@ -54,61 +54,48 @@ module.exports = require("node:stream");
54
54
 
55
55
  /***/ }),
56
56
 
57
- /***/ 167467:
58
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
59
-
60
- __webpack_require__.r(__webpack_exports__);
61
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
62
- /* harmony export */ handler: () => (/* binding */ handler),
63
- /* harmony export */ patchFetch: () => (/* binding */ patchFetch),
64
- /* harmony export */ routeModule: () => (/* binding */ routeModule),
65
- /* harmony export */ serverHooks: () => (/* binding */ serverHooks),
66
- /* harmony export */ workAsyncStorage: () => (/* binding */ workAsyncStorage),
67
- /* harmony export */ workUnitAsyncStorage: () => (/* binding */ workUnitAsyncStorage)
68
- /* harmony export */ });
69
- /* harmony import */ var next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(319225);
70
- /* 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__);
71
- /* harmony import */ var next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(684006);
72
- /* harmony import */ var next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8317);
73
- /* 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__);
74
- /* harmony import */ var next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(799373);
75
- /* 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__);
76
- /* harmony import */ var next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(434775);
77
- /* 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__);
78
- /* harmony import */ var next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(524235);
79
- /* 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__);
80
- /* harmony import */ var next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(200261);
81
- /* 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__);
82
- /* harmony import */ var next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(754365);
83
- /* 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__);
84
- /* harmony import */ var next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(590771);
85
- /* 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__);
86
- /* harmony import */ var next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(473461);
87
- /* 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__);
88
- /* harmony import */ var next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(767798);
89
- /* harmony import */ var next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(192280);
90
- /* harmony import */ var next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(662018);
91
- /* 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__);
92
- /* harmony import */ var next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(445696);
93
- /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(347929);
94
- /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__);
95
- /* harmony import */ var next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(986439);
96
- /* 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__);
97
- /* harmony import */ var next_dist_server_lib_route_cache_key__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(710246);
98
- /* 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__);
99
- /* harmony import */ var next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(137527);
100
- /* 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__);
101
-
102
-
103
-
104
-
105
-
106
-
107
-
57
+ /***/ 176760:
58
+ /***/ ((module) => {
108
59
 
60
+ module.exports = require("node:path");
109
61
 
62
+ /***/ }),
110
63
 
64
+ /***/ 187246:
65
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
111
66
 
67
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
68
+ /* harmony export */ Ah: () => (/* binding */ updateFlow),
69
+ /* harmony export */ Dd: () => (/* binding */ exchangeCode),
70
+ /* harmony export */ F8: () => (/* binding */ createFlow),
71
+ /* harmony export */ QH: () => (/* binding */ getDefaultGoogleClient),
72
+ /* harmony export */ XG: () => (/* binding */ generatePkce),
73
+ /* harmony export */ iZ: () => (/* binding */ isDefaultGoogleClient),
74
+ /* harmony export */ lv: () => (/* binding */ getFlow),
75
+ /* harmony export */ sI: () => (/* binding */ googleFetch),
76
+ /* harmony export */ wJ: () => (/* binding */ resolveGoogleTokenEndpoint),
77
+ /* harmony export */ wq: () => (/* binding */ resolveGoogleAuth),
78
+ /* harmony export */ xj: () => (/* binding */ buildAuthorizeUrl)
79
+ /* harmony export */ });
80
+ /* unused harmony exports GMAIL_SCOPES, getGoogleAccessToken */
81
+ /* harmony import */ var node_crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(977598);
82
+ /* harmony import */ var node_crypto__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(node_crypto__WEBPACK_IMPORTED_MODULE_0__);
83
+ /* harmony import */ var _lib_stores_integrations__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(478228);
84
+ /* harmony import */ var _lib_utils_oauth_flow_store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(956362);
85
+ /* harmony import */ var _lib_utils_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(253638);
86
+ /* harmony import */ var _lib_utils_error__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(922032);
87
+ /* harmony import */ var _lib_utils_oauth_input__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(522632);
88
+ /* harmony import */ var _lib_utils_http_json__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(312199);
89
+ // Ephemeral state store for the in-app Gmail OAuth flow.
90
+ //
91
+ // The user types client_id + client_secret in the Integrations panel and clicks
92
+ // "Connect Gmail". We POST those to /oauth/start, which stashes them here keyed
93
+ // by a random `state` token and returns the Google authorize URL. The browser
94
+ // opens that URL; Google bounces back to /oauth/callback with `?code&state`,
95
+ // which exchanges the code for a refresh_token and persists the integration.
96
+ // Meanwhile the panel polls /oauth/status to know when to refresh.
97
+ //
98
+ // Pinned to globalThis so HMR in dev doesn't lose pending flows.
112
99
 
113
100
 
114
101
 
@@ -116,845 +103,406 @@ __webpack_require__.r(__webpack_exports__);
116
103
 
117
104
 
118
105
 
119
- // We inject the nextConfigOutput here so that we can use them in the route
120
- // module.
121
- const nextConfigOutput = "standalone"
122
- const routeModule = new next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__.AppRouteRouteModule({
123
- definition: {
124
- kind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
125
- page: "/api/v1/integrations/gmail/oauth/start/route",
126
- pathname: "/api/v1/integrations/gmail/oauth/start",
127
- filename: "route",
128
- bundlePath: "app/api/v1/integrations/gmail/oauth/start/route"
129
- },
130
- distDir: ".next" || 0,
131
- relativeProjectDir: false || '',
132
- resolvedPagePath: "/home/runner/work/jarela/jarela/app/api/v1/integrations/gmail/oauth/start/route.ts",
133
- nextConfigOutput,
134
- // The lazy require factory ensures that:
135
- // - In dev: devRequestTimingInternalsEnd is set before userland executes,
136
- // correctly attributing module load time to application-code rather than
137
- // framework internals.
138
- // - In all modes: async modules (route files with top-level await) are
139
- // handled correctly — require() returns a Promise for such modules, which
140
- // ensureUserland() awaits before the first request is handled.
141
- userland: ()=>__webpack_require__(722158),
142
- // In Turbopack dev mode, also provide a synchronous per-request getter so
143
- // server HMR updates are picked up without re-executing the entry chunk.
144
- // Using require() (synchronous) avoids adding async overhead that would be
145
- // incorrectly attributed to application-code time in devRequestTiming.
146
- ... false ? 0 : {}
106
+ const flowStore = (0,_lib_utils_oauth_flow_store__WEBPACK_IMPORTED_MODULE_2__/* .createOAuthFlowStore */ .R)({
107
+ globalKey: "__ggOauthFlows"
147
108
  });
148
- // Pull out the exports that we need to expose from the module. This should
149
- // be eliminated when we've moved the other routes to the new format. These
150
- // are used to hook into the route.
151
- const { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;
152
- function patchFetch() {
153
- return (0,next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__.patchFetch)({
154
- workAsyncStorage,
155
- workUnitAsyncStorage
156
- });
109
+ const createFlow = flowStore.create;
110
+ const getFlow = flowStore.get;
111
+ const updateFlow = flowStore.update;
112
+ const GMAIL_SCOPES = [
113
+ "https://www.googleapis.com/auth/gmail.modify",
114
+ "https://www.googleapis.com/auth/gmail.compose",
115
+ // Calendar: read/write events on the user's existing calendars. Narrow
116
+ // scope on purpose — doesn't grant create/delete of entire calendars
117
+ // (matches the principle-of-least-privilege the Gmail scopes follow).
118
+ "https://www.googleapis.com/auth/calendar.events",
119
+ // Read-only metadata of the user's calendar list. Required for the
120
+ // calendarList.list endpoint that powers calendarListCalendarsTool —
121
+ // calendar.events alone returns 403 there.
122
+ "https://www.googleapis.com/auth/calendar.readonly"
123
+ ];
124
+ // ---------------------------------------------------------------------------
125
+ // Bundled Jarela-owned OAuth client (Desktop type)
126
+ // ---------------------------------------------------------------------------
127
+ //
128
+ // Google's `oauth2.googleapis.com/token` endpoint requires `client_secret` on
129
+ // every code-exchange and refresh call, even for Desktop clients using PKCE.
130
+ // (Google's "Optional" wording in the OAuth-for-native-apps doc reflects the
131
+ // RFC spec, not the production endpoint's actual behaviour.) Shipping the
132
+ // secret in this repo would attract CVSS-7.5 reports the moment the source
133
+ // hits GitHub, so we keep it server-side: requests for the bundled client_id
134
+ // are routed through `functions/google-oauth-proxy/`, which injects the secret
135
+ // from Secret Manager before forwarding to Google.
136
+ //
137
+ // Forks/self-hosters override the bundled client_id via JARELA_GMAIL_CLIENT_ID
138
+ // and the proxy URL via JARELA_GOOGLE_TOKEN_PROXY. The legacy BYO Advanced
139
+ // fields still accept a full client_id + client_secret pair for users who'd
140
+ // rather use their own GCP project (bypasses the proxy entirely).
141
+ const DEFAULT_DESKTOP_CLIENT_ID = process.env.JARELA_GMAIL_CLIENT_ID?.trim() || "134669812881-for5e5bjirjt9s2f53cvc3lcj5q257c7.apps.googleusercontent.com";
142
+ function getDefaultGoogleClient() {
143
+ return {
144
+ client_id: DEFAULT_DESKTOP_CLIENT_ID
145
+ };
157
146
  }
158
-
159
- async function handler(req, res, ctx) {
160
- if (ctx.requestMeta) {
161
- (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.setRequestMeta)(req, ctx.requestMeta);
162
- }
163
- if (routeModule.isDev) {
164
- (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.addRequestMeta)(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());
165
- }
166
- let srcPage = "/api/v1/integrations/gmail/oauth/start/route";
167
- // turbopack doesn't normalize `/index` in the page name
168
- // so we need to to process dynamic routes properly
169
- // TODO: fix turbopack providing differing value from webpack
170
- if (false) {} else if (srcPage === '/index') {
171
- // we always normalize /index specifically
172
- srcPage = '/';
173
- }
174
- const multiZoneDraftMode = false;
175
- // Registering `instrumentation.ts` usually installs the tracer provider, so
176
- // do it before starting the request span. The span is started before
177
- // `prepare`, so route module preparation is part of the request's trace.
178
- // When this request triggers registration, the lifecycle spans of
179
- // `instrumentation.ts` are emitted inside the request span.
180
- const { instrumentation } = await routeModule.ensureInstrumentation(req, {
181
- deferSpans: true
147
+ // True when the resolved client_id is the bundled Jarela one (NOT a BYO
148
+ // from env or the Advanced credentials panel). Used by the callback to
149
+ // avoid persisting a redundant client_id row — `resolveGoogleAuth` reads
150
+ // it back from the bundle on demand instead.
151
+ function isDefaultGoogleClient(id) {
152
+ return id === getDefaultGoogleClient().client_id;
153
+ }
154
+ // ---------------------------------------------------------------------------
155
+ // Token endpoint resolution: bundled-client traffic goes through Jarela's
156
+ // hosted proxy which injects `client_secret` from Secret Manager. BYO traffic
157
+ // goes direct to Google — the user supplied their own secret and the proxy
158
+ // neither has nor wants it. Self-hosters override the proxy URL via
159
+ // JARELA_GOOGLE_TOKEN_PROXY.
160
+ // ---------------------------------------------------------------------------
161
+ const GOOGLE_TOKEN_ENDPOINT = "https://oauth2.googleapis.com/token";
162
+ const JARELA_TOKEN_PROXY = process.env.JARELA_GOOGLE_TOKEN_PROXY?.trim() || "https://jarela-oauth-proxy-134669812881.europe-west1.run.app";
163
+ function selectTokenEndpoint(clientId, hasClientSecret) {
164
+ if (isDefaultGoogleClient(clientId) && !hasClientSecret) return JARELA_TOKEN_PROXY;
165
+ return GOOGLE_TOKEN_ENDPOINT;
166
+ }
167
+ // Public re-export for callers that need to mirror the routing decision
168
+ // without going through `getGoogleAccessToken` (e.g. the Gmail health
169
+ // probe, which needs precise HTTP-status-aware error mapping).
170
+ const resolveGoogleTokenEndpoint = selectTokenEndpoint;
171
+ function generatePkce() {
172
+ // 32 random bytes → 43-char base64url string (well within the 43-128 spec).
173
+ const verifier = (0,node_crypto__WEBPACK_IMPORTED_MODULE_0__.randomBytes)(32).toString("base64url");
174
+ const challenge = (0,node_crypto__WEBPACK_IMPORTED_MODULE_0__.createHash)("sha256").update(verifier).digest("base64url");
175
+ return {
176
+ verifier,
177
+ challenge
178
+ };
179
+ }
180
+ function buildAuthorizeUrl(opts) {
181
+ const p = new URLSearchParams({
182
+ client_id: opts.clientId,
183
+ redirect_uri: opts.redirectUri,
184
+ response_type: "code",
185
+ scope: GMAIL_SCOPES.join(" "),
186
+ access_type: "offline",
187
+ prompt: "consent",
188
+ include_granted_scopes: "true",
189
+ state: opts.state,
190
+ code_challenge: opts.codeChallenge,
191
+ code_challenge_method: "S256"
182
192
  });
183
- return routeModule.traceRequest(req, {
184
- tracer: (0,next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.getTracer)(),
185
- spanName: `${req.method || 'GET'} ${srcPage}`,
186
- httpTarget: req.url,
187
- instrumentation
188
- }, (requestSpan, requestRootSpan)=>handleRequest(req, res, ctx, srcPage, multiZoneDraftMode, requestSpan, requestRootSpan));
193
+ return `https://accounts.google.com/o/oauth2/v2/auth?${p.toString()}`;
189
194
  }
190
- async function handleRequest(req, res, ctx, srcPage, multiZoneDraftMode, requestSpan, requestRootSpan) {
191
- const prepareResult = await routeModule.prepare(req, res, {
192
- srcPage,
193
- multiZoneDraftMode
195
+ async function exchangeCode(opts) {
196
+ const clientId = (0,_lib_utils_oauth_input__WEBPACK_IMPORTED_MODULE_3__/* .sanitizeOAuthInput */ .d)(opts.clientId) ?? "";
197
+ const clientSecret = opts.clientSecret ? (0,_lib_utils_oauth_input__WEBPACK_IMPORTED_MODULE_3__/* .sanitizeOAuthInput */ .d)(opts.clientSecret) ?? "" : "";
198
+ const body = new URLSearchParams({
199
+ code: opts.code,
200
+ client_id: clientId,
201
+ redirect_uri: opts.redirectUri,
202
+ grant_type: "authorization_code",
203
+ code_verifier: opts.codeVerifier
194
204
  });
195
- if (!prepareResult) {
196
- res.statusCode = 400;
197
- res.end('Bad Request');
198
- ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());
199
- return null;
205
+ if (clientSecret) body.set("client_secret", clientSecret);
206
+ const endpoint = selectTokenEndpoint(clientId, Boolean(clientSecret));
207
+ const res = await fetch(endpoint, {
208
+ method: "POST",
209
+ headers: {
210
+ "Content-Type": "application/x-www-form-urlencoded"
211
+ },
212
+ body: body.toString(),
213
+ signal: AbortSignal.timeout(30000)
214
+ });
215
+ const text = await res.text();
216
+ const parsed = (0,_lib_utils_json__WEBPACK_IMPORTED_MODULE_4__/* .parseJsonSafe */ .p)(text, {});
217
+ if (!res.ok) {
218
+ const err = parsed["error_description"] || parsed["error"] || text || `HTTP ${res.status}`;
219
+ console.error(`[gmail-oauth] token exchange rejected (${res.status}): ${err} | client_id ${(0,_lib_utils_oauth_input__WEBPACK_IMPORTED_MODULE_3__/* .secretFingerprint */ .n)(clientId)} | client_secret ${(0,_lib_utils_oauth_input__WEBPACK_IMPORTED_MODULE_3__/* .secretFingerprint */ .n)(clientSecret)}`);
220
+ throw new Error(err);
200
221
  }
201
- const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest, previewProps } = prepareResult;
202
- const normalizedSrcPage = (0,next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__.normalizeAppPath)(srcPage);
203
- // Only this route's prerenders can establish ISR or admit generated params.
204
- 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]));
205
- let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || isPrerendered);
206
- const render404 = async ()=>{
207
- // TODO: should route-module itself handle rendering the 404
208
- if (routerServerContext == null ? void 0 : routerServerContext.render404) {
209
- await routerServerContext.render404(req, res, parsedUrl, false);
210
- } else {
211
- res.end('This page could not be found');
222
+ return parsed;
223
+ }
224
+ function resolveGoogleAuth() {
225
+ const envId = process.env.GMAIL_CLIENT_ID;
226
+ const envSecret = process.env.GMAIL_CLIENT_SECRET;
227
+ const envRefresh = process.env.GMAIL_REFRESH_TOKEN;
228
+ if (envId && envSecret && envRefresh) {
229
+ return {
230
+ client_id: envId,
231
+ client_secret: envSecret,
232
+ refresh_token: envRefresh
233
+ };
234
+ }
235
+ const saved = (0,_lib_stores_integrations__WEBPACK_IMPORTED_MODULE_1__/* .getIntegrationRaw */ .$G)("gmail");
236
+ if (saved?.refresh_token) {
237
+ // Stored client_id wins when present (BYO path); otherwise fall back to
238
+ // the bundled Jarela client_id. client_secret is only set on the BYO
239
+ // path — the bundled client's secret is injected server-side by the proxy.
240
+ if (saved.client_id && saved.client_secret) {
241
+ return {
242
+ client_id: saved.client_id,
243
+ client_secret: saved.client_secret,
244
+ refresh_token: saved.refresh_token
245
+ };
212
246
  }
213
- return null;
247
+ return {
248
+ client_id: saved.client_id || getDefaultGoogleClient().client_id,
249
+ refresh_token: saved.refresh_token
250
+ };
251
+ }
252
+ return {
253
+ error: "Google account not connected. Open the gear menu → Integrations tab → " + "Gmail card and click Connect Gmail to authorize Gmail + Calendar access."
214
254
  };
215
- if (isIsr && !isDraftMode) {
216
- const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];
217
- if (prerenderInfo) {
218
- if (prerenderInfo.fallback === false && !isPrerendered) {
219
- if (nextConfig.adapterPath) {
220
- return await render404();
221
- }
222
- throw new next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError();
223
- }
255
+ }
256
+ const accessTokenCache = new Map();
257
+ async function getGoogleAccessToken(auth) {
258
+ const key = auth.refresh_token.slice(0, 20);
259
+ const cached = accessTokenCache.get(key);
260
+ if (cached && cached.expires_at > Date.now() + 60000) return cached.token;
261
+ const body = new URLSearchParams({
262
+ client_id: auth.client_id,
263
+ refresh_token: auth.refresh_token,
264
+ grant_type: "refresh_token"
265
+ });
266
+ if (auth.client_secret) body.set("client_secret", auth.client_secret);
267
+ const endpoint = selectTokenEndpoint(auth.client_id, Boolean(auth.client_secret));
268
+ try {
269
+ const res = await fetch(endpoint, {
270
+ method: "POST",
271
+ headers: {
272
+ "Content-Type": "application/x-www-form-urlencoded"
273
+ },
274
+ body: body.toString(),
275
+ signal: AbortSignal.timeout(30000)
276
+ });
277
+ const text = await (0,_lib_utils_http_json__WEBPACK_IMPORTED_MODULE_5__/* .readResponseText */ .BQ)(res);
278
+ if (!res.ok) {
279
+ // Drop any stale cached token so a reconnected (broader-scope) refresh
280
+ // re-exchanges cleanly on the next call.
281
+ accessTokenCache.delete(key);
282
+ return {
283
+ error: `OAuth token refresh failed (${res.status}): ${text.slice(0, 300)}`
284
+ };
224
285
  }
286
+ const parsed = JSON.parse(text);
287
+ if (!parsed.access_token) return {
288
+ error: "OAuth response missing access_token"
289
+ };
290
+ const expires_at = Date.now() + (parsed.expires_in ?? 3000) * 1000;
291
+ accessTokenCache.set(key, {
292
+ token: parsed.access_token,
293
+ expires_at
294
+ });
295
+ return parsed.access_token;
296
+ } catch (err) {
297
+ return {
298
+ error: `OAuth token refresh threw: ${(0,_lib_utils_error__WEBPACK_IMPORTED_MODULE_6__/* .errorMessage */ .g)(err)}`
299
+ };
225
300
  }
226
- let cacheKey = null;
227
- if (isIsr && !routeModule.isDev && !isDraftMode) {
228
- cacheKey = resolvedPathname;
229
- // ensure /index and / is normalized to one key
230
- cacheKey = cacheKey === '/index' ? '/' : cacheKey;
301
+ }
302
+ /**
303
+ * Shared bearer-auth fetch for Google REST APIs (Gmail, Calendar, ...).
304
+ *
305
+ * Behaviour:
306
+ * - Resolves access token from `auth`; if that fails, the error object is
307
+ * surfaced unchanged so callers can pass it back to the agent.
308
+ * - 204 No Content → `{ ok: true }` (used by DELETE endpoints).
309
+ * - Non-2xx response → `{ error: "<service> <status>: <body slice>", url }`.
310
+ * - 2xx with body → parsed JSON if possible, raw text otherwise.
311
+ * - Fetch throws (DNS, abort, timeout) → `{ error: "<service> fetch threw: ..." }`.
312
+ *
313
+ * @param service Short tag used in error messages, e.g. "Gmail" or "Calendar".
314
+ * @param baseUrl Base for relative `path` (e.g. `https://gmail.googleapis.com/gmail/v1/users/me`).
315
+ * @param path Either a full URL (starts with `http`) or path appended to baseUrl.
316
+ */ async function googleFetch(auth, service, baseUrl, path, init) {
317
+ let target;
318
+ try {
319
+ target = path.startsWith("http") ? new URL(path) : new URL(`${baseUrl}${path}`);
320
+ } catch {
321
+ return {
322
+ error: `${service} request URL is invalid.`
323
+ };
231
324
  }
232
- // Before rendering (which initializes component tree modules), we have to
233
- // set the reference manifests to our global store so Server Action's
234
- // encryption util can access to them at the top level of the page module.
235
- if (serverActionsManifest && clientReferenceManifest) {
236
- (0,next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__.setManifestsSingleton)({
237
- page: srcPage,
238
- clientReferenceManifest,
239
- serverActionsManifest
240
- });
325
+ let base;
326
+ try {
327
+ base = new URL(baseUrl);
328
+ } catch {
329
+ return {
330
+ error: `${service} API base URL is invalid.`
331
+ };
241
332
  }
242
- const method = req.method || 'GET';
243
- const tracer = (0,next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.getTracer)();
244
- const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);
245
- const isMinimalMode = Boolean((0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'minimalMode'));
246
- const incrementalCache = (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, previewProps, prerenderManifest, isMinimalMode);
247
- incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();
248
- globalThis.__incrementalCache = incrementalCache;
249
- const context = {
250
- params,
251
- previewProps,
252
- renderOpts: {
253
- experimental: {
254
- authInterrupts: Boolean(nextConfig.experimental.authInterrupts),
255
- useCacheTimeout: nextConfig.experimental.useCacheTimeout,
256
- durableUseCacheEntries: Boolean(nextConfig.experimental.durableUseCacheEntries)
257
- },
258
- cacheComponents: Boolean(nextConfig.cacheComponents),
259
- validationLevel: nextConfig.experimental.instantInsights.validationLevel,
260
- isDraftMode,
261
- incrementalCache,
262
- hmrRefreshHash: (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'hmrRefreshHash'),
263
- cacheLifeProfiles: nextConfig.cacheLife,
264
- staticPageGenerationTimeout: nextConfig.staticPageGenerationTimeout,
265
- waitUntil: ctx.waitUntil,
266
- onClose: (cb)=>{
267
- res.on('close', cb);
333
+ if (target.origin !== base.origin || target.username || target.password) {
334
+ return {
335
+ error: `${service} requests must target ${base.hostname}; refusing to forward credentials.`
336
+ };
337
+ }
338
+ const url = target.toString();
339
+ const token = await getGoogleAccessToken(auth);
340
+ if (typeof token !== "string") return token;
341
+ try {
342
+ const res = await fetch(url, {
343
+ ...init,
344
+ headers: {
345
+ Authorization: `Bearer ${token}`,
346
+ Accept: "application/json",
347
+ "Content-Type": "application/json",
348
+ ...init?.headers ?? {}
268
349
  },
269
- onAfterTaskError: undefined
270
- },
271
- sharedContext: {
272
- buildId,
273
- deploymentId
350
+ signal: AbortSignal.timeout(30000)
351
+ });
352
+ if (res.status === 204) return {
353
+ ok: true
354
+ };
355
+ const text = await (0,_lib_utils_http_json__WEBPACK_IMPORTED_MODULE_5__/* .readResponseText */ .BQ)(res);
356
+ if (!res.ok) {
357
+ return {
358
+ error: `${service} ${res.status}: ${text.slice(0, 500)}`,
359
+ url
360
+ };
274
361
  }
275
- };
276
- const nodeNextReq = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextRequest(req);
277
- const nodeNextRes = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextResponse(res);
278
- 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));
279
- const responseGenerator = async ({ previousCacheEntry })=>{
280
362
  try {
281
- if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {
282
- res.statusCode = 404;
283
- // on-demand revalidate always sets this header
284
- res.setHeader('x-nextjs-cache', 'REVALIDATED');
285
- res.end('This page could not be found');
286
- return null;
287
- }
288
- const response = cacheKey === null ? await routeModule.handle(nextReq, context) : await routeModule.prerender(nextReq, context);
289
- req.fetchMetrics = context.renderOpts.fetchMetrics;
290
- let pendingWaitUntil = context.renderOpts.pendingWaitUntil;
291
- // Attempt using provided waitUntil if available
292
- // if it's not we fallback to sendResponse's handling
293
- if (pendingWaitUntil) {
294
- if (ctx.waitUntil) {
295
- ctx.waitUntil(pendingWaitUntil);
296
- pendingWaitUntil = undefined;
297
- }
363
+ const parsed = JSON.parse(text);
364
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
365
+ return parsed;
298
366
  }
299
- const cacheTags = context.renderOpts.collectedTags;
300
- // If the request is for a static response, we can cache it so long
301
- // as it's not edge.
302
- if (isIsr) {
303
- const blob = await response.blob();
304
- // Copy the headers from the response.
305
- const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.toNodeOutgoingHttpHeaders)(response.headers);
306
- if (cacheTags) {
307
- headers[next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER] = cacheTags;
308
- }
309
- if (!headers['content-type'] && blob.type) {
310
- headers['content-type'] = blob.type;
311
- }
312
- const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;
313
- 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
314
- // explicit `expire` (e.g. via `cacheLife`). This mirrors the
315
- // build-time fallback in `build/index.ts` so cache entries
316
- // and the response Cache-Control header agree on the route's
317
- // effective expire. Routes that opt out of revalidation
318
- // (`revalidate: false`) or that are dynamic (`revalidate: 0`)
319
- // keep `expire: undefined`.
320
- revalidate !== false && revalidate > 0 ? nextConfig.expireTime : undefined : context.renderOpts.collectedExpire;
321
- // Create the cache entry for the response.
322
- const cacheEntry = {
323
- value: {
324
- kind: next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__.CachedRouteKind.APP_ROUTE,
325
- status: response.status,
326
- body: Buffer.from(await blob.arrayBuffer()),
327
- headers
328
- },
329
- cacheControl: {
330
- revalidate,
331
- expire
332
- }
333
- };
334
- return cacheEntry;
335
- } else {
336
- // send response without caching if not ISR
337
- await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, response, pendingWaitUntil);
338
- return null;
339
- }
340
- } catch (err) {
341
- // if this is a background revalidate we need to report
342
- // the request error here as it won't be bubbled
343
- if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {
344
- const silenceLog = false;
345
- await routeModule.onRequestError(req, err, {
346
- routerKind: 'App Router',
347
- routePath: srcPage,
348
- routeType: 'route',
349
- revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
350
- isStaticGeneration: cacheKey !== null,
351
- isOnDemandRevalidate
352
- })
353
- }, silenceLog, routerServerContext);
354
- }
355
- throw err;
356
- }
357
- };
358
- const handleResponse = async (currentSpan)=>{
359
- try {
360
- var _cacheEntry_value;
361
- const cacheEntry = await routeModule.handleResponse({
362
- req,
363
- nextConfig,
364
- cacheKey,
365
- routeKind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
366
- isFallback: false,
367
- previewProps,
368
- prerenderManifest,
369
- isRoutePPREnabled: false,
370
- isOnDemandRevalidate,
371
- revalidateOnlyGenerated,
372
- responseGenerator,
373
- waitUntil: ctx.waitUntil,
374
- isMinimalMode
375
- });
376
- if (cacheEntry !== null && 'error' in cacheEntry) {
377
- throw cacheEntry.error;
378
- }
379
- // we don't create a cacheEntry for ISR
380
- if (!isIsr) {
381
- return;
382
- }
383
- 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) {
384
- var _cacheEntry_value1;
385
- throw new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`);
386
- }
387
- if (!isMinimalMode) {
388
- res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');
389
- }
390
- // Draft mode should never be cached
391
- if (isDraftMode) {
392
- res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');
393
- }
394
- const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers);
395
- if (!(isMinimalMode && isIsr)) {
396
- headers.delete(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER);
397
- }
398
- // If cache control is already set on the response we don't
399
- // override it to allow users to customize it via next.config
400
- if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {
401
- headers.set('Cache-Control', (0,next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__.getCacheControlHeader)(cacheEntry.cacheControl));
402
- }
403
- 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'.
404
- new Response(cacheEntry.value.body, {
405
- headers,
406
- status: cacheEntry.value.status || 200
407
- }));
408
- return;
409
- } catch (err) {
410
- if (!(err instanceof next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError)) {
411
- const silenceLog = false;
412
- await routeModule.onRequestError(req, err, {
413
- routerKind: 'App Router',
414
- routePath: normalizedSrcPage,
415
- routeType: 'route',
416
- revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
417
- isStaticGeneration: cacheKey !== null,
418
- isOnDemandRevalidate
419
- })
420
- }, silenceLog, routerServerContext);
421
- }
422
- // rethrow so that we can handle serving error page
423
- // If this is during static generation, throw the error again.
424
- if (isIsr) throw err;
425
- // Otherwise, send a 500 response unless the original response has
426
- // already committed. In that case, preserve its status code for
427
- // telemetry while still recording the failure and terminating a response
428
- // that the failed pipeline left open.
429
- if (res.headersSent) {
430
- if (currentSpan) {
431
- const error = err instanceof Error ? err : new Error('Unknown app route error');
432
- currentSpan.recordException(error);
433
- currentSpan.setStatus({
434
- code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR,
435
- message: error.message
436
- });
437
- currentSpan.setAttribute('error.type', error.name);
438
- }
439
- if (!res.writableEnded && !res.destroyed) {
440
- res.end();
441
- }
442
- } else {
443
- await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, new Response(null, {
444
- status: 500
445
- }));
446
- }
447
- return;
448
- } finally{
449
- ;
450
- (()=>{
451
- if (!currentSpan) {
452
- return;
453
- }
454
- let statusCode = res.statusCode;
455
- currentSpan.setAttributes({
456
- 'http.status_code': statusCode,
457
- 'next.rsc': false
458
- });
459
- if (statusCode && statusCode >= 500) {
460
- // For 5xx status codes: SHOULD be set to 'Error' span status.
461
- // x-ref: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
462
- currentSpan.setStatus({
463
- code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR
464
- });
465
- // For span status 'Error', SHOULD set 'error.type' attribute.
466
- currentSpan.setAttribute('error.type', statusCode.toString());
467
- }
468
- const rootSpanAttributes = tracer.getRootSpanAttributes();
469
- // We were unable to get attributes, probably OTEL is not enabled
470
- if (!rootSpanAttributes) {
471
- return;
472
- }
473
- if (rootSpanAttributes.get('next.span_type') !== next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest) {
474
- console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);
475
- return;
476
- }
477
- const route = rootSpanAttributes.get('next.route') || normalizedSrcPage;
478
- const name = `${method} ${route}`;
479
- currentSpan.setAttributes({
480
- 'next.route': route,
481
- 'http.route': route,
482
- 'next.span_name': name
483
- });
484
- currentSpan.updateName(name);
485
- // Propagate http.route to the request's root span if it isn't the
486
- // request span (e.g. a platform-created HTTP span in adapter
487
- // deployments).
488
- if (requestRootSpan && requestRootSpan !== currentSpan) {
489
- requestRootSpan.setAttribute('http.route', route);
490
- requestRootSpan.updateName(name);
491
- }
492
- })();
367
+ } catch {
368
+ // Google REST endpoints used here return JSON objects. Do not pass raw
369
+ // text or binary payloads to callers that expect an object response.
493
370
  }
494
- };
495
- // When invoked directly, the request span was started before `prepare`;
496
- // record the request target as normalized by it. next-server's request span
497
- // already has it.
498
- if (!isWrappedByNextServer && req.url !== undefined) {
499
- requestSpan == null ? void 0 : requestSpan.setAttribute('http.target', req.url);
371
+ const magic = Buffer.from(text.slice(0, 4), "latin1").toString("hex");
372
+ const detail = `content-type=${res.headers.get("content-type")}, content-encoding=${res.headers.get("content-encoding")}, length=${text.length}, first-bytes=${magic}`;
373
+ return {
374
+ error: `${service} ${res.status}: expected a JSON object response (${detail})`,
375
+ url
376
+ };
377
+ } catch (err) {
378
+ return {
379
+ error: `${service} fetch threw: ${(0,_lib_utils_error__WEBPACK_IMPORTED_MODULE_6__/* .errorMessage */ .g)(err)}`
380
+ };
500
381
  }
501
- await handleResponse(requestSpan);
502
382
  }
503
383
 
504
- //# sourceMappingURL=app-route.js.map
505
-
506
384
 
507
385
  /***/ }),
508
386
 
509
- /***/ 176760:
387
+ /***/ 200261:
510
388
  /***/ ((module) => {
511
389
 
512
- module.exports = require("node:path");
390
+ module.exports = require("next/dist/shared/lib/router/utils/app-paths");
513
391
 
514
392
  /***/ }),
515
393
 
516
- /***/ 187246:
394
+ /***/ 253638:
517
395
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
518
396
 
519
397
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
520
- /* harmony export */ Ah: () => (/* binding */ updateFlow),
521
- /* harmony export */ Dd: () => (/* binding */ exchangeCode),
522
- /* harmony export */ F8: () => (/* binding */ createFlow),
523
- /* harmony export */ QH: () => (/* binding */ getDefaultGoogleClient),
524
- /* harmony export */ XG: () => (/* binding */ generatePkce),
525
- /* harmony export */ iZ: () => (/* binding */ isDefaultGoogleClient),
526
- /* harmony export */ lv: () => (/* binding */ getFlow),
527
- /* harmony export */ sI: () => (/* binding */ googleFetch),
528
- /* harmony export */ wJ: () => (/* binding */ resolveGoogleTokenEndpoint),
529
- /* harmony export */ wq: () => (/* binding */ resolveGoogleAuth),
530
- /* harmony export */ xj: () => (/* binding */ buildAuthorizeUrl)
398
+ /* harmony export */ p: () => (/* binding */ parseJsonSafe)
531
399
  /* harmony export */ });
532
- /* unused harmony exports GMAIL_SCOPES, getGoogleAccessToken */
533
- /* harmony import */ var node_crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(977598);
534
- /* harmony import */ var node_crypto__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(node_crypto__WEBPACK_IMPORTED_MODULE_0__);
535
- /* harmony import */ var _lib_stores_integrations__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(478228);
536
- /* harmony import */ var _lib_utils_oauth_flow_store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(956362);
537
- /* harmony import */ var _lib_utils_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(253638);
538
- /* harmony import */ var _lib_utils_error__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(922032);
539
- /* harmony import */ var _lib_utils_oauth_input__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(522632);
540
- /* harmony import */ var _lib_utils_http_json__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(312199);
541
- // Ephemeral state store for the in-app Gmail OAuth flow.
542
- //
543
- // The user types client_id + client_secret in the Integrations panel and clicks
544
- // "Connect Gmail". We POST those to /oauth/start, which stashes them here keyed
545
- // by a random `state` token and returns the Google authorize URL. The browser
546
- // opens that URL; Google bounces back to /oauth/callback with `?code&state`,
547
- // which exchanges the code for a refresh_token and persists the integration.
548
- // Meanwhile the panel polls /oauth/status to know when to refresh.
549
- //
550
- // Pinned to globalThis so HMR in dev doesn't lose pending flows.
400
+ // JSON.parse with a fallback value when the input is malformed (or empty).
401
+ // Used everywhere we read responses from external APIs — they're contractually
402
+ // JSON but a transient 502 / proxy interstitial occasionally returns HTML.
403
+ function parseJsonSafe(text, fallback) {
404
+ try {
405
+ return JSON.parse(text);
406
+ } catch {
407
+ return fallback;
408
+ }
409
+ }
551
410
 
552
411
 
412
+ /***/ }),
553
413
 
414
+ /***/ 257975:
415
+ /***/ ((module) => {
554
416
 
417
+ module.exports = require("node:util");
555
418
 
419
+ /***/ }),
556
420
 
421
+ /***/ 309956:
422
+ /***/ ((module) => {
557
423
 
558
- const flowStore = (0,_lib_utils_oauth_flow_store__WEBPACK_IMPORTED_MODULE_2__/* .createOAuthFlowStore */ .R)({
559
- globalKey: "__ggOauthFlows"
560
- });
561
- const createFlow = flowStore.create;
562
- const getFlow = flowStore.get;
563
- const updateFlow = flowStore.update;
564
- const GMAIL_SCOPES = [
565
- "https://www.googleapis.com/auth/gmail.modify",
566
- "https://www.googleapis.com/auth/gmail.compose",
567
- // Calendar: read/write events on the user's existing calendars. Narrow
568
- // scope on purpose — doesn't grant create/delete of entire calendars
569
- // (matches the principle-of-least-privilege the Gmail scopes follow).
570
- "https://www.googleapis.com/auth/calendar.events",
571
- // Read-only metadata of the user's calendar list. Required for the
572
- // calendarList.list endpoint that powers calendarListCalendarsTool —
573
- // calendar.events alone returns 403 there.
574
- "https://www.googleapis.com/auth/calendar.readonly"
575
- ];
576
- // ---------------------------------------------------------------------------
577
- // Bundled Jarela-owned OAuth client (Desktop type)
578
- // ---------------------------------------------------------------------------
579
- //
580
- // Google's `oauth2.googleapis.com/token` endpoint requires `client_secret` on
581
- // every code-exchange and refresh call, even for Desktop clients using PKCE.
582
- // (Google's "Optional" wording in the OAuth-for-native-apps doc reflects the
583
- // RFC spec, not the production endpoint's actual behaviour.) Shipping the
584
- // secret in this repo would attract CVSS-7.5 reports the moment the source
585
- // hits GitHub, so we keep it server-side: requests for the bundled client_id
586
- // are routed through `functions/google-oauth-proxy/`, which injects the secret
587
- // from Secret Manager before forwarding to Google.
588
- //
589
- // Forks/self-hosters override the bundled client_id via JARELA_GMAIL_CLIENT_ID
590
- // and the proxy URL via JARELA_GOOGLE_TOKEN_PROXY. The legacy BYO Advanced
591
- // fields still accept a full client_id + client_secret pair for users who'd
592
- // rather use their own GCP project (bypasses the proxy entirely).
593
- const DEFAULT_DESKTOP_CLIENT_ID = process.env.JARELA_GMAIL_CLIENT_ID?.trim() || "134669812881-for5e5bjirjt9s2f53cvc3lcj5q257c7.apps.googleusercontent.com";
594
- function getDefaultGoogleClient() {
595
- return {
596
- client_id: DEFAULT_DESKTOP_CLIENT_ID
597
- };
598
- }
599
- // True when the resolved client_id is the bundled Jarela one (NOT a BYO
600
- // from env or the Advanced credentials panel). Used by the callback to
601
- // avoid persisting a redundant client_id row — `resolveGoogleAuth` reads
602
- // it back from the bundle on demand instead.
603
- function isDefaultGoogleClient(id) {
604
- return id === getDefaultGoogleClient().client_id;
605
- }
606
- // ---------------------------------------------------------------------------
607
- // Token endpoint resolution: bundled-client traffic goes through Jarela's
608
- // hosted proxy which injects `client_secret` from Secret Manager. BYO traffic
609
- // goes direct to Google — the user supplied their own secret and the proxy
610
- // neither has nor wants it. Self-hosters override the proxy URL via
611
- // JARELA_GOOGLE_TOKEN_PROXY.
612
- // ---------------------------------------------------------------------------
613
- const GOOGLE_TOKEN_ENDPOINT = "https://oauth2.googleapis.com/token";
614
- const JARELA_TOKEN_PROXY = process.env.JARELA_GOOGLE_TOKEN_PROXY?.trim() || "https://jarela-oauth-proxy-134669812881.europe-west1.run.app";
615
- function selectTokenEndpoint(clientId, hasClientSecret) {
616
- if (isDefaultGoogleClient(clientId) && !hasClientSecret) return JARELA_TOKEN_PROXY;
617
- return GOOGLE_TOKEN_ENDPOINT;
618
- }
619
- // Public re-export for callers that need to mirror the routing decision
620
- // without going through `getGoogleAccessToken` (e.g. the Gmail health
621
- // probe, which needs precise HTTP-status-aware error mapping).
622
- const resolveGoogleTokenEndpoint = selectTokenEndpoint;
623
- function generatePkce() {
624
- // 32 random bytes → 43-char base64url string (well within the 43-128 spec).
625
- const verifier = (0,node_crypto__WEBPACK_IMPORTED_MODULE_0__.randomBytes)(32).toString("base64url");
626
- const challenge = (0,node_crypto__WEBPACK_IMPORTED_MODULE_0__.createHash)("sha256").update(verifier).digest("base64url");
627
- return {
628
- verifier,
629
- challenge
630
- };
631
- }
632
- function buildAuthorizeUrl(opts) {
633
- const p = new URLSearchParams({
634
- client_id: opts.clientId,
635
- redirect_uri: opts.redirectUri,
636
- response_type: "code",
637
- scope: GMAIL_SCOPES.join(" "),
638
- access_type: "offline",
639
- prompt: "consent",
640
- include_granted_scopes: "true",
641
- state: opts.state,
642
- code_challenge: opts.codeChallenge,
643
- code_challenge_method: "S256"
644
- });
645
- return `https://accounts.google.com/o/oauth2/v2/auth?${p.toString()}`;
646
- }
647
- async function exchangeCode(opts) {
648
- const clientId = (0,_lib_utils_oauth_input__WEBPACK_IMPORTED_MODULE_3__/* .sanitizeOAuthInput */ .d)(opts.clientId) ?? "";
649
- const clientSecret = opts.clientSecret ? (0,_lib_utils_oauth_input__WEBPACK_IMPORTED_MODULE_3__/* .sanitizeOAuthInput */ .d)(opts.clientSecret) ?? "" : "";
650
- const body = new URLSearchParams({
651
- code: opts.code,
652
- client_id: clientId,
653
- redirect_uri: opts.redirectUri,
654
- grant_type: "authorization_code",
655
- code_verifier: opts.codeVerifier
656
- });
657
- if (clientSecret) body.set("client_secret", clientSecret);
658
- const endpoint = selectTokenEndpoint(clientId, Boolean(clientSecret));
659
- const res = await fetch(endpoint, {
660
- method: "POST",
661
- headers: {
662
- "Content-Type": "application/x-www-form-urlencoded"
663
- },
664
- body: body.toString(),
665
- signal: AbortSignal.timeout(30000)
666
- });
667
- const text = await res.text();
668
- const parsed = (0,_lib_utils_json__WEBPACK_IMPORTED_MODULE_4__/* .parseJsonSafe */ .p)(text, {});
669
- if (!res.ok) {
670
- const err = parsed["error_description"] || parsed["error"] || text || `HTTP ${res.status}`;
671
- console.error(`[gmail-oauth] token exchange rejected (${res.status}): ${err} | client_id ${(0,_lib_utils_oauth_input__WEBPACK_IMPORTED_MODULE_3__/* .secretFingerprint */ .n)(clientId)} | client_secret ${(0,_lib_utils_oauth_input__WEBPACK_IMPORTED_MODULE_3__/* .secretFingerprint */ .n)(clientSecret)}`);
672
- throw new Error(err);
673
- }
674
- return parsed;
675
- }
676
- function resolveGoogleAuth() {
677
- const envId = process.env.GMAIL_CLIENT_ID;
678
- const envSecret = process.env.GMAIL_CLIENT_SECRET;
679
- const envRefresh = process.env.GMAIL_REFRESH_TOKEN;
680
- if (envId && envSecret && envRefresh) {
424
+ module.exports = require("undici");
425
+
426
+ /***/ }),
427
+
428
+ /***/ 312199:
429
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
430
+
431
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
432
+ /* harmony export */ BQ: () => (/* binding */ readResponseText),
433
+ /* harmony export */ WO: () => (/* binding */ readJsonResponse),
434
+ /* harmony export */ Yn: () => (/* binding */ readResponseTextCapped)
435
+ /* harmony export */ });
436
+ // Node's fetch decodes correctly labelled gzip responses. Some upstreams
437
+ // omit Content-Encoding, so detect and decode raw gzip bodies as a fallback.
438
+ async function readResponseTextCapped(res, maxBytes) {
439
+ if (!res.body) {
440
+ const text = await res.text();
441
+ const bytes = new TextEncoder().encode(text);
681
442
  return {
682
- client_id: envId,
683
- client_secret: envSecret,
684
- refresh_token: envRefresh
443
+ text: new TextDecoder().decode(bytes.subarray(0, maxBytes)),
444
+ bytesRead: Math.min(bytes.length, maxBytes),
445
+ truncated: bytes.length > maxBytes
685
446
  };
686
447
  }
687
- const saved = (0,_lib_stores_integrations__WEBPACK_IMPORTED_MODULE_1__/* .getIntegrationRaw */ .$G)("gmail");
688
- if (saved?.refresh_token) {
689
- // Stored client_id wins when present (BYO path); otherwise fall back to
690
- // the bundled Jarela client_id. client_secret is only set on the BYO
691
- // path — the bundled client's secret is injected server-side by the proxy.
692
- if (saved.client_id && saved.client_secret) {
693
- return {
694
- client_id: saved.client_id,
695
- client_secret: saved.client_secret,
696
- refresh_token: saved.refresh_token
697
- };
448
+ const sourceReader = res.body.getReader();
449
+ const prefix = [];
450
+ let prefixBytes = 0;
451
+ let sourceDone = false;
452
+ while(prefixBytes < 2){
453
+ const next = await sourceReader.read();
454
+ if (next.done) {
455
+ sourceDone = true;
456
+ break;
698
457
  }
699
- return {
700
- client_id: saved.client_id || getDefaultGoogleClient().client_id,
701
- refresh_token: saved.refresh_token
702
- };
458
+ if (next.value.byteLength === 0) continue;
459
+ prefix.push(next.value);
460
+ prefixBytes += next.value.byteLength;
703
461
  }
704
- return {
705
- error: "Google account not connected. Open the gear menu → Integrations tab → " + "Gmail card and click Connect Gmail to authorize Gmail + Calendar access."
706
- };
707
- }
708
- const accessTokenCache = new Map();
709
- async function getGoogleAccessToken(auth) {
710
- const key = auth.refresh_token.slice(0, 20);
711
- const cached = accessTokenCache.get(key);
712
- if (cached && cached.expires_at > Date.now() + 60000) return cached.token;
713
- const body = new URLSearchParams({
714
- client_id: auth.client_id,
715
- refresh_token: auth.refresh_token,
716
- grant_type: "refresh_token"
462
+ const signature = new Uint8Array(2);
463
+ let signatureBytes = 0;
464
+ for (const chunk of prefix){
465
+ const take = Math.min(signature.length - signatureBytes, chunk.byteLength);
466
+ signature.set(chunk.subarray(0, take), signatureBytes);
467
+ signatureBytes += take;
468
+ if (signatureBytes === signature.length) break;
469
+ }
470
+ const isGzip = signatureBytes === 2 && signature[0] === 0x1f && signature[1] === 0x8b;
471
+ const source = new ReadableStream({
472
+ start (controller) {
473
+ for (const chunk of prefix)controller.enqueue(chunk);
474
+ if (sourceDone) controller.close();
475
+ },
476
+ async pull (controller) {
477
+ const next = await sourceReader.read();
478
+ if (next.done) controller.close();
479
+ else if (next.value) controller.enqueue(next.value);
480
+ },
481
+ cancel (reason) {
482
+ return sourceReader.cancel(reason);
483
+ }
717
484
  });
718
- if (auth.client_secret) body.set("client_secret", auth.client_secret);
719
- const endpoint = selectTokenEndpoint(auth.client_id, Boolean(auth.client_secret));
485
+ const gunzip = new DecompressionStream("gzip");
486
+ const decoded = isGzip ? source.pipeThrough(gunzip) : source;
487
+ const reader = decoded.getReader();
488
+ const limit = Math.max(0, Math.floor(maxBytes));
489
+ const chunks = [];
490
+ let bytesRead = 0;
491
+ let truncated = false;
720
492
  try {
721
- const res = await fetch(endpoint, {
722
- method: "POST",
723
- headers: {
724
- "Content-Type": "application/x-www-form-urlencoded"
725
- },
726
- body: body.toString(),
727
- signal: AbortSignal.timeout(30000)
728
- });
729
- const text = await (0,_lib_utils_http_json__WEBPACK_IMPORTED_MODULE_5__/* .readResponseText */ .BQ)(res);
730
- if (!res.ok) {
731
- // Drop any stale cached token so a reconnected (broader-scope) refresh
732
- // re-exchanges cleanly on the next call.
733
- accessTokenCache.delete(key);
734
- return {
735
- error: `OAuth token refresh failed (${res.status}): ${text.slice(0, 300)}`
736
- };
737
- }
738
- const parsed = JSON.parse(text);
739
- if (!parsed.access_token) return {
740
- error: "OAuth response missing access_token"
741
- };
742
- const expires_at = Date.now() + (parsed.expires_in ?? 3000) * 1000;
743
- accessTokenCache.set(key, {
744
- token: parsed.access_token,
745
- expires_at
746
- });
747
- return parsed.access_token;
748
- } catch (err) {
749
- return {
750
- error: `OAuth token refresh threw: ${(0,_lib_utils_error__WEBPACK_IMPORTED_MODULE_6__/* .errorMessage */ .g)(err)}`
751
- };
752
- }
753
- }
754
- /**
755
- * Shared bearer-auth fetch for Google REST APIs (Gmail, Calendar, ...).
756
- *
757
- * Behaviour:
758
- * - Resolves access token from `auth`; if that fails, the error object is
759
- * surfaced unchanged so callers can pass it back to the agent.
760
- * - 204 No Content → `{ ok: true }` (used by DELETE endpoints).
761
- * - Non-2xx response → `{ error: "<service> <status>: <body slice>", url }`.
762
- * - 2xx with body → parsed JSON if possible, raw text otherwise.
763
- * - Fetch throws (DNS, abort, timeout) → `{ error: "<service> fetch threw: ..." }`.
764
- *
765
- * @param service Short tag used in error messages, e.g. "Gmail" or "Calendar".
766
- * @param baseUrl Base for relative `path` (e.g. `https://gmail.googleapis.com/gmail/v1/users/me`).
767
- * @param path Either a full URL (starts with `http`) or path appended to baseUrl.
768
- */ async function googleFetch(auth, service, baseUrl, path, init) {
769
- let target;
770
- try {
771
- target = path.startsWith("http") ? new URL(path) : new URL(`${baseUrl}${path}`);
772
- } catch {
773
- return {
774
- error: `${service} request URL is invalid.`
775
- };
776
- }
777
- let base;
778
- try {
779
- base = new URL(baseUrl);
780
- } catch {
781
- return {
782
- error: `${service} API base URL is invalid.`
783
- };
784
- }
785
- if (target.origin !== base.origin || target.username || target.password) {
786
- return {
787
- error: `${service} requests must target ${base.hostname}; refusing to forward credentials.`
788
- };
789
- }
790
- const url = target.toString();
791
- const token = await getGoogleAccessToken(auth);
792
- if (typeof token !== "string") return token;
793
- try {
794
- const res = await fetch(url, {
795
- ...init,
796
- headers: {
797
- Authorization: `Bearer ${token}`,
798
- Accept: "application/json",
799
- "Content-Type": "application/json",
800
- ...init?.headers ?? {}
801
- },
802
- signal: AbortSignal.timeout(30000)
803
- });
804
- if (res.status === 204) return {
805
- ok: true
806
- };
807
- const text = await (0,_lib_utils_http_json__WEBPACK_IMPORTED_MODULE_5__/* .readResponseText */ .BQ)(res);
808
- if (!res.ok) {
809
- return {
810
- error: `${service} ${res.status}: ${text.slice(0, 500)}`,
811
- url
812
- };
813
- }
814
- try {
815
- const parsed = JSON.parse(text);
816
- if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
817
- return parsed;
818
- }
819
- } catch {
820
- // Google REST endpoints used here return JSON objects. Do not pass raw
821
- // text or binary payloads to callers that expect an object response.
822
- }
823
- const magic = Buffer.from(text.slice(0, 4), "latin1").toString("hex");
824
- const detail = `content-type=${res.headers.get("content-type")}, content-encoding=${res.headers.get("content-encoding")}, length=${text.length}, first-bytes=${magic}`;
825
- return {
826
- error: `${service} ${res.status}: expected a JSON object response (${detail})`,
827
- url
828
- };
829
- } catch (err) {
830
- return {
831
- error: `${service} fetch threw: ${(0,_lib_utils_error__WEBPACK_IMPORTED_MODULE_6__/* .errorMessage */ .g)(err)}`
832
- };
833
- }
834
- }
835
-
836
-
837
- /***/ }),
838
-
839
- /***/ 200261:
840
- /***/ ((module) => {
841
-
842
- module.exports = require("next/dist/shared/lib/router/utils/app-paths");
843
-
844
- /***/ }),
845
-
846
- /***/ 253638:
847
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
848
-
849
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
850
- /* harmony export */ p: () => (/* binding */ parseJsonSafe)
851
- /* harmony export */ });
852
- // JSON.parse with a fallback value when the input is malformed (or empty).
853
- // Used everywhere we read responses from external APIs — they're contractually
854
- // JSON but a transient 502 / proxy interstitial occasionally returns HTML.
855
- function parseJsonSafe(text, fallback) {
856
- try {
857
- return JSON.parse(text);
858
- } catch {
859
- return fallback;
860
- }
861
- }
862
-
863
-
864
- /***/ }),
865
-
866
- /***/ 257975:
867
- /***/ ((module) => {
868
-
869
- module.exports = require("node:util");
870
-
871
- /***/ }),
872
-
873
- /***/ 309956:
874
- /***/ ((module) => {
875
-
876
- module.exports = require("undici");
877
-
878
- /***/ }),
879
-
880
- /***/ 312199:
881
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
882
-
883
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
884
- /* harmony export */ BQ: () => (/* binding */ readResponseText),
885
- /* harmony export */ WO: () => (/* binding */ readJsonResponse),
886
- /* harmony export */ Yn: () => (/* binding */ readResponseTextCapped)
887
- /* harmony export */ });
888
- // Node's fetch decodes correctly labelled gzip responses. Some upstreams
889
- // omit Content-Encoding, so detect and decode raw gzip bodies as a fallback.
890
- async function readResponseTextCapped(res, maxBytes) {
891
- if (!res.body) {
892
- const text = await res.text();
893
- const bytes = new TextEncoder().encode(text);
894
- return {
895
- text: new TextDecoder().decode(bytes.subarray(0, maxBytes)),
896
- bytesRead: Math.min(bytes.length, maxBytes),
897
- truncated: bytes.length > maxBytes
898
- };
899
- }
900
- const sourceReader = res.body.getReader();
901
- const prefix = [];
902
- let prefixBytes = 0;
903
- let sourceDone = false;
904
- while(prefixBytes < 2){
905
- const next = await sourceReader.read();
906
- if (next.done) {
907
- sourceDone = true;
908
- break;
909
- }
910
- if (next.value.byteLength === 0) continue;
911
- prefix.push(next.value);
912
- prefixBytes += next.value.byteLength;
913
- }
914
- const signature = new Uint8Array(2);
915
- let signatureBytes = 0;
916
- for (const chunk of prefix){
917
- const take = Math.min(signature.length - signatureBytes, chunk.byteLength);
918
- signature.set(chunk.subarray(0, take), signatureBytes);
919
- signatureBytes += take;
920
- if (signatureBytes === signature.length) break;
921
- }
922
- const isGzip = signatureBytes === 2 && signature[0] === 0x1f && signature[1] === 0x8b;
923
- const source = new ReadableStream({
924
- start (controller) {
925
- for (const chunk of prefix)controller.enqueue(chunk);
926
- if (sourceDone) controller.close();
927
- },
928
- async pull (controller) {
929
- const next = await sourceReader.read();
930
- if (next.done) controller.close();
931
- else if (next.value) controller.enqueue(next.value);
932
- },
933
- cancel (reason) {
934
- return sourceReader.cancel(reason);
935
- }
936
- });
937
- const gunzip = new DecompressionStream("gzip");
938
- const decoded = isGzip ? source.pipeThrough(gunzip) : source;
939
- const reader = decoded.getReader();
940
- const limit = Math.max(0, Math.floor(maxBytes));
941
- const chunks = [];
942
- let bytesRead = 0;
943
- let truncated = false;
944
- try {
945
- while(true){
946
- const next = await reader.read();
947
- if (next.done) break;
948
- if (!next.value.byteLength) continue;
949
- const remaining = limit - bytesRead;
950
- const kept = Math.min(remaining, next.value.byteLength);
951
- if (kept > 0) chunks.push(next.value.subarray(0, kept));
952
- bytesRead += kept;
953
- if (kept < next.value.byteLength) {
954
- truncated = true;
955
- await reader.cancel();
956
- break;
957
- }
493
+ while(true){
494
+ const next = await reader.read();
495
+ if (next.done) break;
496
+ if (!next.value.byteLength) continue;
497
+ const remaining = limit - bytesRead;
498
+ const kept = Math.min(remaining, next.value.byteLength);
499
+ if (kept > 0) chunks.push(next.value.subarray(0, kept));
500
+ bytesRead += kept;
501
+ if (kept < next.value.byteLength) {
502
+ truncated = true;
503
+ await reader.cancel();
504
+ break;
505
+ }
958
506
  }
959
507
  } catch (error) {
960
508
  if (isGzip) throw new Error("Gzip response could not be decompressed.", {
@@ -1297,6 +845,458 @@ module.exports = require("node:net");
1297
845
 
1298
846
  module.exports = require("http");
1299
847
 
848
+ /***/ }),
849
+
850
+ /***/ 804576:
851
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
852
+
853
+ __webpack_require__.r(__webpack_exports__);
854
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
855
+ /* harmony export */ handler: () => (/* binding */ handler),
856
+ /* harmony export */ patchFetch: () => (/* binding */ patchFetch),
857
+ /* harmony export */ routeModule: () => (/* binding */ routeModule),
858
+ /* harmony export */ serverHooks: () => (/* binding */ serverHooks),
859
+ /* harmony export */ workAsyncStorage: () => (/* binding */ workAsyncStorage),
860
+ /* harmony export */ workUnitAsyncStorage: () => (/* binding */ workUnitAsyncStorage)
861
+ /* harmony export */ });
862
+ /* harmony import */ var next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(319225);
863
+ /* 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__);
864
+ /* harmony import */ var next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(684006);
865
+ /* harmony import */ var next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8317);
866
+ /* 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__);
867
+ /* harmony import */ var next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(799373);
868
+ /* 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__);
869
+ /* harmony import */ var next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(434775);
870
+ /* 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__);
871
+ /* harmony import */ var next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(524235);
872
+ /* 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__);
873
+ /* harmony import */ var next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(200261);
874
+ /* 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__);
875
+ /* harmony import */ var next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(754365);
876
+ /* 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__);
877
+ /* harmony import */ var next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(590771);
878
+ /* 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__);
879
+ /* harmony import */ var next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(473461);
880
+ /* 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__);
881
+ /* harmony import */ var next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(767798);
882
+ /* harmony import */ var next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(192280);
883
+ /* harmony import */ var next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(662018);
884
+ /* 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__);
885
+ /* harmony import */ var next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(445696);
886
+ /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(347929);
887
+ /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__);
888
+ /* harmony import */ var next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(986439);
889
+ /* 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__);
890
+ /* harmony import */ var next_dist_server_lib_route_cache_key__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(710246);
891
+ /* 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__);
892
+ /* harmony import */ var next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(137527);
893
+ /* 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__);
894
+
895
+
896
+
897
+
898
+
899
+
900
+
901
+
902
+
903
+
904
+
905
+
906
+
907
+
908
+
909
+
910
+
911
+
912
+ // We inject the nextConfigOutput here so that we can use them in the route
913
+ // module.
914
+ const nextConfigOutput = "standalone"
915
+ const routeModule = new next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__.AppRouteRouteModule({
916
+ definition: {
917
+ kind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
918
+ page: "/api/v1/integrations/gmail/oauth/start/route",
919
+ pathname: "/api/v1/integrations/gmail/oauth/start",
920
+ filename: "route",
921
+ bundlePath: "app/api/v1/integrations/gmail/oauth/start/route"
922
+ },
923
+ distDir: ".next" || 0,
924
+ relativeProjectDir: false || '',
925
+ resolvedPagePath: "/home/runner/work/jarela/jarela/app/api/v1/integrations/gmail/oauth/start/route.ts",
926
+ nextConfigOutput,
927
+ // The lazy require factory ensures that:
928
+ // - In dev: devRequestTimingInternalsEnd is set before userland executes,
929
+ // correctly attributing module load time to application-code rather than
930
+ // framework internals.
931
+ // - In all modes: async modules (route files with top-level await) are
932
+ // handled correctly — require() returns a Promise for such modules, which
933
+ // ensureUserland() awaits before the first request is handled.
934
+ userland: ()=>__webpack_require__(722158),
935
+ // In Turbopack dev mode, also provide a synchronous per-request getter so
936
+ // server HMR updates are picked up without re-executing the entry chunk.
937
+ // Using require() (synchronous) avoids adding async overhead that would be
938
+ // incorrectly attributed to application-code time in devRequestTiming.
939
+ ... false ? 0 : {}
940
+ });
941
+ // Pull out the exports that we need to expose from the module. This should
942
+ // be eliminated when we've moved the other routes to the new format. These
943
+ // are used to hook into the route.
944
+ const { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;
945
+ function patchFetch() {
946
+ return (0,next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__.patchFetch)({
947
+ workAsyncStorage,
948
+ workUnitAsyncStorage
949
+ });
950
+ }
951
+
952
+ async function handler(req, res, ctx) {
953
+ if (ctx.requestMeta) {
954
+ (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.setRequestMeta)(req, ctx.requestMeta);
955
+ }
956
+ if (routeModule.isDev) {
957
+ (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.addRequestMeta)(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());
958
+ }
959
+ let srcPage = "/api/v1/integrations/gmail/oauth/start/route";
960
+ // turbopack doesn't normalize `/index` in the page name
961
+ // so we need to to process dynamic routes properly
962
+ // TODO: fix turbopack providing differing value from webpack
963
+ if (false) {} else if (srcPage === '/index') {
964
+ // we always normalize /index specifically
965
+ srcPage = '/';
966
+ }
967
+ const multiZoneDraftMode = false;
968
+ // Registering `instrumentation.ts` usually installs the tracer provider, so
969
+ // do it before starting the request span. The span is started before
970
+ // `prepare`, so route module preparation is part of the request's trace.
971
+ // When this request triggers registration, the lifecycle spans of
972
+ // `instrumentation.ts` are emitted inside the request span.
973
+ const { instrumentation } = await routeModule.ensureInstrumentation(req, {
974
+ deferSpans: true
975
+ });
976
+ return routeModule.traceRequest(req, {
977
+ tracer: (0,next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.getTracer)(),
978
+ spanName: `${req.method || 'GET'} ${srcPage}`,
979
+ httpTarget: req.url,
980
+ instrumentation
981
+ }, (requestSpan, requestRootSpan)=>handleRequest(req, res, ctx, srcPage, multiZoneDraftMode, requestSpan, requestRootSpan));
982
+ }
983
+ async function handleRequest(req, res, ctx, srcPage, multiZoneDraftMode, requestSpan, requestRootSpan) {
984
+ const prepareResult = await routeModule.prepare(req, res, {
985
+ srcPage,
986
+ multiZoneDraftMode
987
+ });
988
+ if (!prepareResult) {
989
+ res.statusCode = 400;
990
+ res.end('Bad Request');
991
+ ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());
992
+ return null;
993
+ }
994
+ const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest, previewProps } = prepareResult;
995
+ const normalizedSrcPage = (0,next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__.normalizeAppPath)(srcPage);
996
+ // Only this route's prerenders can establish ISR or admit generated params.
997
+ 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]));
998
+ let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || isPrerendered);
999
+ const render404 = async ()=>{
1000
+ // TODO: should route-module itself handle rendering the 404
1001
+ if (routerServerContext == null ? void 0 : routerServerContext.render404) {
1002
+ await routerServerContext.render404(req, res, parsedUrl, false);
1003
+ } else {
1004
+ res.end('This page could not be found');
1005
+ }
1006
+ return null;
1007
+ };
1008
+ if (isIsr && !isDraftMode) {
1009
+ const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];
1010
+ if (prerenderInfo) {
1011
+ if (prerenderInfo.fallback === false && !isPrerendered) {
1012
+ if (nextConfig.adapterPath) {
1013
+ return await render404();
1014
+ }
1015
+ throw new next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError();
1016
+ }
1017
+ }
1018
+ }
1019
+ let cacheKey = null;
1020
+ if (isIsr && !routeModule.isDev && !isDraftMode) {
1021
+ cacheKey = resolvedPathname;
1022
+ // ensure /index and / is normalized to one key
1023
+ cacheKey = cacheKey === '/index' ? '/' : cacheKey;
1024
+ }
1025
+ // Before rendering (which initializes component tree modules), we have to
1026
+ // set the reference manifests to our global store so Server Action's
1027
+ // encryption util can access to them at the top level of the page module.
1028
+ if (serverActionsManifest && clientReferenceManifest) {
1029
+ (0,next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__.setManifestsSingleton)({
1030
+ page: srcPage,
1031
+ clientReferenceManifest,
1032
+ serverActionsManifest
1033
+ });
1034
+ }
1035
+ const method = req.method || 'GET';
1036
+ const tracer = (0,next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.getTracer)();
1037
+ const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);
1038
+ const isMinimalMode = Boolean((0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'minimalMode'));
1039
+ const incrementalCache = (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, previewProps, prerenderManifest, isMinimalMode);
1040
+ incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();
1041
+ globalThis.__incrementalCache = incrementalCache;
1042
+ const context = {
1043
+ params,
1044
+ previewProps,
1045
+ renderOpts: {
1046
+ experimental: {
1047
+ authInterrupts: Boolean(nextConfig.experimental.authInterrupts),
1048
+ useCacheTimeout: nextConfig.experimental.useCacheTimeout,
1049
+ durableUseCacheEntries: Boolean(nextConfig.experimental.durableUseCacheEntries)
1050
+ },
1051
+ cacheComponents: Boolean(nextConfig.cacheComponents),
1052
+ validationLevel: nextConfig.experimental.instantInsights.validationLevel,
1053
+ isDraftMode,
1054
+ incrementalCache,
1055
+ hmrRefreshHash: (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'hmrRefreshHash'),
1056
+ cacheLifeProfiles: nextConfig.cacheLife,
1057
+ staticPageGenerationTimeout: nextConfig.staticPageGenerationTimeout,
1058
+ waitUntil: ctx.waitUntil,
1059
+ onClose: (cb)=>{
1060
+ res.on('close', cb);
1061
+ },
1062
+ onAfterTaskError: undefined
1063
+ },
1064
+ sharedContext: {
1065
+ buildId,
1066
+ deploymentId
1067
+ }
1068
+ };
1069
+ const nodeNextReq = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextRequest(req);
1070
+ const nodeNextRes = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextResponse(res);
1071
+ 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));
1072
+ const responseGenerator = async ({ previousCacheEntry })=>{
1073
+ try {
1074
+ if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {
1075
+ res.statusCode = 404;
1076
+ // on-demand revalidate always sets this header
1077
+ res.setHeader('x-nextjs-cache', 'REVALIDATED');
1078
+ res.end('This page could not be found');
1079
+ return null;
1080
+ }
1081
+ const response = cacheKey === null ? await routeModule.handle(nextReq, context) : await routeModule.prerender(nextReq, context);
1082
+ req.fetchMetrics = context.renderOpts.fetchMetrics;
1083
+ let pendingWaitUntil = context.renderOpts.pendingWaitUntil;
1084
+ // Attempt using provided waitUntil if available
1085
+ // if it's not we fallback to sendResponse's handling
1086
+ if (pendingWaitUntil) {
1087
+ if (ctx.waitUntil) {
1088
+ ctx.waitUntil(pendingWaitUntil);
1089
+ pendingWaitUntil = undefined;
1090
+ }
1091
+ }
1092
+ const cacheTags = context.renderOpts.collectedTags;
1093
+ // If the request is for a static response, we can cache it so long
1094
+ // as it's not edge.
1095
+ if (isIsr) {
1096
+ const blob = await response.blob();
1097
+ // Copy the headers from the response.
1098
+ const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.toNodeOutgoingHttpHeaders)(response.headers);
1099
+ if (cacheTags) {
1100
+ headers[next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER] = cacheTags;
1101
+ }
1102
+ if (!headers['content-type'] && blob.type) {
1103
+ headers['content-type'] = blob.type;
1104
+ }
1105
+ const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;
1106
+ 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
1107
+ // explicit `expire` (e.g. via `cacheLife`). This mirrors the
1108
+ // build-time fallback in `build/index.ts` so cache entries
1109
+ // and the response Cache-Control header agree on the route's
1110
+ // effective expire. Routes that opt out of revalidation
1111
+ // (`revalidate: false`) or that are dynamic (`revalidate: 0`)
1112
+ // keep `expire: undefined`.
1113
+ revalidate !== false && revalidate > 0 ? nextConfig.expireTime : undefined : context.renderOpts.collectedExpire;
1114
+ // Create the cache entry for the response.
1115
+ const cacheEntry = {
1116
+ value: {
1117
+ kind: next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__.CachedRouteKind.APP_ROUTE,
1118
+ status: response.status,
1119
+ body: Buffer.from(await blob.arrayBuffer()),
1120
+ headers
1121
+ },
1122
+ cacheControl: {
1123
+ revalidate,
1124
+ expire
1125
+ }
1126
+ };
1127
+ return cacheEntry;
1128
+ } else {
1129
+ // send response without caching if not ISR
1130
+ await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, response, pendingWaitUntil);
1131
+ return null;
1132
+ }
1133
+ } catch (err) {
1134
+ // if this is a background revalidate we need to report
1135
+ // the request error here as it won't be bubbled
1136
+ if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {
1137
+ const silenceLog = false;
1138
+ await routeModule.onRequestError(req, err, {
1139
+ routerKind: 'App Router',
1140
+ routePath: srcPage,
1141
+ routeType: 'route',
1142
+ revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
1143
+ isStaticGeneration: cacheKey !== null,
1144
+ isOnDemandRevalidate
1145
+ })
1146
+ }, silenceLog, routerServerContext);
1147
+ }
1148
+ throw err;
1149
+ }
1150
+ };
1151
+ const handleResponse = async (currentSpan)=>{
1152
+ try {
1153
+ var _cacheEntry_value;
1154
+ const cacheEntry = await routeModule.handleResponse({
1155
+ req,
1156
+ nextConfig,
1157
+ cacheKey,
1158
+ routeKind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
1159
+ isFallback: false,
1160
+ previewProps,
1161
+ prerenderManifest,
1162
+ isRoutePPREnabled: false,
1163
+ isOnDemandRevalidate,
1164
+ revalidateOnlyGenerated,
1165
+ responseGenerator,
1166
+ waitUntil: ctx.waitUntil,
1167
+ isMinimalMode
1168
+ });
1169
+ if (cacheEntry !== null && 'error' in cacheEntry) {
1170
+ throw cacheEntry.error;
1171
+ }
1172
+ // we don't create a cacheEntry for ISR
1173
+ if (!isIsr) {
1174
+ return;
1175
+ }
1176
+ 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) {
1177
+ var _cacheEntry_value1;
1178
+ throw new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`);
1179
+ }
1180
+ if (!isMinimalMode) {
1181
+ res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');
1182
+ }
1183
+ // Draft mode should never be cached
1184
+ if (isDraftMode) {
1185
+ res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');
1186
+ }
1187
+ const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers);
1188
+ if (!(isMinimalMode && isIsr)) {
1189
+ headers.delete(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER);
1190
+ }
1191
+ // If cache control is already set on the response we don't
1192
+ // override it to allow users to customize it via next.config
1193
+ if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {
1194
+ headers.set('Cache-Control', (0,next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__.getCacheControlHeader)(cacheEntry.cacheControl));
1195
+ }
1196
+ 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'.
1197
+ new Response(cacheEntry.value.body, {
1198
+ headers,
1199
+ status: cacheEntry.value.status || 200
1200
+ }));
1201
+ return;
1202
+ } catch (err) {
1203
+ if (!(err instanceof next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError)) {
1204
+ const silenceLog = false;
1205
+ await routeModule.onRequestError(req, err, {
1206
+ routerKind: 'App Router',
1207
+ routePath: normalizedSrcPage,
1208
+ routeType: 'route',
1209
+ revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
1210
+ isStaticGeneration: cacheKey !== null,
1211
+ isOnDemandRevalidate
1212
+ })
1213
+ }, silenceLog, routerServerContext);
1214
+ }
1215
+ // rethrow so that we can handle serving error page
1216
+ // If this is during static generation, throw the error again.
1217
+ if (isIsr) throw err;
1218
+ // Otherwise, send a 500 response unless the original response has
1219
+ // already committed. In that case, preserve its status code for
1220
+ // telemetry while still recording the failure and terminating a response
1221
+ // that the failed pipeline left open.
1222
+ if (res.headersSent) {
1223
+ if (currentSpan) {
1224
+ const error = err instanceof Error ? err : new Error('Unknown app route error');
1225
+ currentSpan.recordException(error);
1226
+ currentSpan.setStatus({
1227
+ code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR,
1228
+ message: error.message
1229
+ });
1230
+ currentSpan.setAttribute('error.type', error.name);
1231
+ }
1232
+ if (!res.writableEnded && !res.destroyed) {
1233
+ res.end();
1234
+ }
1235
+ } else {
1236
+ await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, new Response(null, {
1237
+ status: 500
1238
+ }));
1239
+ }
1240
+ return;
1241
+ } finally{
1242
+ ;
1243
+ (()=>{
1244
+ if (!currentSpan) {
1245
+ return;
1246
+ }
1247
+ let statusCode = res.statusCode;
1248
+ currentSpan.setAttributes({
1249
+ 'http.status_code': statusCode,
1250
+ 'next.rsc': false
1251
+ });
1252
+ if (statusCode && statusCode >= 500) {
1253
+ // For 5xx status codes: SHOULD be set to 'Error' span status.
1254
+ // x-ref: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
1255
+ currentSpan.setStatus({
1256
+ code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR
1257
+ });
1258
+ // For span status 'Error', SHOULD set 'error.type' attribute.
1259
+ currentSpan.setAttribute('error.type', statusCode.toString());
1260
+ }
1261
+ const rootSpanAttributes = tracer.getRootSpanAttributes();
1262
+ // We were unable to get attributes, probably OTEL is not enabled
1263
+ if (!rootSpanAttributes) {
1264
+ return;
1265
+ }
1266
+ if (rootSpanAttributes.get('next.span_type') !== next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest) {
1267
+ console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);
1268
+ return;
1269
+ }
1270
+ const route = rootSpanAttributes.get('next.route') || normalizedSrcPage;
1271
+ const name = `${method} ${route}`;
1272
+ currentSpan.setAttributes({
1273
+ 'next.route': route,
1274
+ 'http.route': route,
1275
+ 'next.span_name': name
1276
+ });
1277
+ currentSpan.updateName(name);
1278
+ // Propagate http.route to the request's root span if it isn't the
1279
+ // request span (e.g. a platform-created HTTP span in adapter
1280
+ // deployments).
1281
+ if (requestRootSpan && requestRootSpan !== currentSpan) {
1282
+ requestRootSpan.setAttribute('http.route', route);
1283
+ requestRootSpan.updateName(name);
1284
+ }
1285
+ })();
1286
+ }
1287
+ };
1288
+ // When invoked directly, the request span was started before `prepare`;
1289
+ // record the request target as normalized by it. next-server's request span
1290
+ // already has it.
1291
+ if (!isWrappedByNextServer && req.url !== undefined) {
1292
+ requestSpan == null ? void 0 : requestSpan.setAttribute('http.target', req.url);
1293
+ }
1294
+ await handleResponse(requestSpan);
1295
+ }
1296
+
1297
+ //# sourceMappingURL=app-route.js.map
1298
+
1299
+
1300
1300
  /***/ }),
1301
1301
 
1302
1302
  /***/ 848161:
@@ -1436,7 +1436,7 @@ module.exports = require("next/dist/shared/lib/no-fallback-error.external");
1436
1436
  var __webpack_require__ = require("../../../../../../../webpack-runtime.js");
1437
1437
  __webpack_require__.C(exports);
1438
1438
  var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
1439
- var __webpack_exports__ = __webpack_require__.X(0, [2970,7377,1813,4891,4992,1244], () => (__webpack_exec__(167467)));
1439
+ var __webpack_exports__ = __webpack_require__.X(0, [2970,7377,1813,4891,4992,1244], () => (__webpack_exec__(804576)));
1440
1440
  module.exports = __webpack_exports__;
1441
1441
 
1442
1442
  })();