@circuitwall/jarela 2.2.1 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (651) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-path-routes-manifest.json +6 -5
  3. package/.next/standalone/.next/build-manifest.json +2 -2
  4. package/.next/standalone/.next/prerender-manifest.json +3 -3
  5. package/.next/standalone/.next/routes-manifest.json +8 -0
  6. package/.next/standalone/.next/server/app/_global-error/page.js +68 -68
  7. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_not-found/page.js +76 -76
  14. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/standalone/.next/server/app/_not-found.html +2 -2
  16. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  17. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  18. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  19. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  20. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  21. package/.next/standalone/.next/server/app/api/v1/access/[identity]/route.js +93 -93
  22. package/.next/standalone/.next/server/app/api/v1/access/route.js +169 -169
  23. package/.next/standalone/.next/server/app/api/v1/agents/[id]/compact/route.js +82 -56
  24. package/.next/standalone/.next/server/app/api/v1/agents/[id]/compact/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/api/v1/agents/[id]/display-filters/route.js +122 -122
  26. package/.next/standalone/.next/server/app/api/v1/agents/[id]/route.js +100 -100
  27. package/.next/standalone/.next/server/app/api/v1/agents/[id]/thread/route.js +753 -753
  28. package/.next/standalone/.next/server/app/api/v1/agents/route.js +65 -65
  29. package/.next/standalone/.next/server/app/api/v1/allowed-sites/[hostname]/route.js +364 -364
  30. package/.next/standalone/.next/server/app/api/v1/allowed-sites/route.js +802 -802
  31. package/.next/standalone/.next/server/app/api/v1/artifacts/lifecycle/route.js +2 -2
  32. package/.next/standalone/.next/server/app/api/v1/attachments/files/route.js +49 -49
  33. package/.next/standalone/.next/server/app/api/v1/attachments/images/route.js +910 -910
  34. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js +589 -16
  35. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/ignores/[remote_jid]/route.js +23 -23
  37. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/ignores/route.js +30 -30
  38. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js +703 -130
  39. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js.nft.json +1 -1
  40. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js +708 -135
  41. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js +802 -229
  43. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/routes/[route_id]/route.js +739 -739
  45. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/routes/route.js +1035 -1035
  46. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js +679 -106
  47. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/api/v1/bridges/kinds/route.js +804 -804
  49. package/.next/standalone/.next/server/app/api/v1/bridges/route.js +700 -700
  50. package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js +9 -9
  51. package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js.nft.json +1 -1
  52. package/.next/standalone/.next/server/app/api/v1/config/route.js +85 -85
  53. package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js +709 -709
  54. package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js.nft.json +1 -1
  55. package/.next/standalone/.next/server/app/api/v1/credentials/route.js +2 -2
  56. package/.next/standalone/.next/server/app/api/v1/credentials/route.js.nft.json +1 -1
  57. package/.next/standalone/.next/server/app/api/v1/dashboard/currency/route.js +10 -10
  58. package/.next/standalone/.next/server/app/api/v1/dashboard/metrics/route.js +784 -784
  59. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing/route.js +23 -23
  60. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js +86 -86
  61. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js.nft.json +1 -1
  62. package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js +57 -57
  63. package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js.nft.json +1 -1
  64. package/.next/standalone/.next/server/app/api/v1/documents/search/route.js +523 -523
  65. package/.next/standalone/.next/server/app/api/v1/documents/settings/route.js +44 -44
  66. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js +65 -65
  67. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js.nft.json +1 -1
  68. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js +122 -122
  69. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js.nft.json +1 -1
  70. package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js +37 -37
  71. package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js.nft.json +1 -1
  72. package/.next/standalone/.next/server/app/api/v1/env/route.js +9 -9
  73. package/.next/standalone/.next/server/app/api/v1/env-sync/allowlist/route.js +368 -368
  74. package/.next/standalone/.next/server/app/api/v1/env-sync/route.js +44 -44
  75. package/.next/standalone/.next/server/app/api/v1/events/route.js +751 -178
  76. package/.next/standalone/.next/server/app/api/v1/events/route.js.nft.json +1 -1
  77. package/.next/standalone/.next/server/app/api/v1/events/test/route.js +77 -77
  78. package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js +763 -763
  79. package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js.nft.json +1 -1
  80. package/.next/standalone/.next/server/app/api/v1/extension/browser/activate/route.js +44 -44
  81. package/.next/standalone/.next/server/app/api/v1/extension/browser/foreground/route.js +9 -9
  82. package/.next/standalone/.next/server/app/api/v1/extension/browser/history/route.js +65 -65
  83. package/.next/standalone/.next/server/app/api/v1/extension/browser/poll/route.js +34 -34
  84. package/.next/standalone/.next/server/app/api/v1/extension/browser/progress/route.js +204 -204
  85. package/.next/standalone/.next/server/app/api/v1/extension/browser/result/route.js +133 -133
  86. package/.next/standalone/.next/server/app/api/v1/extension/browser/retry/route.js +106 -106
  87. package/.next/standalone/.next/server/app/api/v1/extension/browser/status/route.js +114 -114
  88. package/.next/standalone/.next/server/app/api/v1/extension/browser/tabs/route.js +134 -134
  89. package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js +690 -690
  90. package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js.nft.json +1 -1
  91. package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js +93 -93
  92. package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js.nft.json +1 -1
  93. package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js +9 -9
  94. package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js.nft.json +1 -1
  95. package/.next/standalone/.next/server/app/api/v1/extensions/route.js +185 -185
  96. package/.next/standalone/.next/server/app/api/v1/extensions/route.js.nft.json +1 -1
  97. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js +171 -171
  98. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js.nft.json +1 -1
  99. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js +396 -396
  100. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js.nft.json +1 -1
  101. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js +212 -212
  102. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js.nft.json +1 -1
  103. package/.next/standalone/.next/server/app/api/v1/files/[name]/route.js +235 -235
  104. package/.next/standalone/.next/server/app/api/v1/fs/browse/route.js +26 -26
  105. package/.next/standalone/.next/server/app/api/v1/harnesses/[id]/route.js +221 -221
  106. package/.next/standalone/.next/server/app/api/v1/harnesses/default/route.js +58 -58
  107. package/.next/standalone/.next/server/app/api/v1/harnesses/route.js +72 -72
  108. package/.next/standalone/.next/server/app/api/v1/health/probes/route.js +9 -9
  109. package/.next/standalone/.next/server/app/api/v1/health/probes/route.js.nft.json +1 -1
  110. package/.next/standalone/.next/server/app/api/v1/health/route.js +772 -772
  111. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/route.js +133 -133
  112. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js +9 -9
  113. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js.nft.json +1 -1
  114. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/callback/route.js +363 -363
  115. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/start/route.js +233 -233
  116. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/status/route.js +682 -682
  117. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/callback/route.js +879 -879
  118. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/start/route.js +108 -108
  119. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/status/route.js +952 -952
  120. package/.next/standalone/.next/server/app/api/v1/integrations/route.js +216 -216
  121. package/.next/standalone/.next/server/app/api/v1/lifecycle/adoption/route.js +864 -847
  122. package/.next/standalone/.next/server/app/api/v1/lifecycle/adoption/route.js.nft.json +1 -1
  123. package/.next/standalone/.next/server/app/api/v1/local-file/route.js +26 -26
  124. package/.next/standalone/.next/server/app/api/v1/logs/route.js +70 -70
  125. package/.next/standalone/.next/server/app/api/v1/maps/embed/route.js +72 -72
  126. package/.next/standalone/.next/server/app/api/v1/mcp-servers/[name]/route.js +979 -979
  127. package/.next/standalone/.next/server/app/api/v1/mcp-servers/registry/route.js +196 -196
  128. package/.next/standalone/.next/server/app/api/v1/mcp-servers/route.js +2 -2
  129. package/.next/standalone/.next/server/app/api/v1/memory/[namespace]/[key]/route.js +381 -381
  130. package/.next/standalone/.next/server/app/api/v1/memory/policy/route.js +79 -79
  131. package/.next/standalone/.next/server/app/api/v1/memory/route.js +51 -51
  132. package/.next/standalone/.next/server/app/api/v1/memory/search/route.js +131 -131
  133. package/.next/standalone/.next/server/app/api/v1/models/[name]/compact-threads/route.js +374 -369
  134. package/.next/standalone/.next/server/app/api/v1/models/[name]/compact-threads/route.js.nft.json +1 -1
  135. package/.next/standalone/.next/server/app/api/v1/models/[name]/route.js +143 -143
  136. package/.next/standalone/.next/server/app/api/v1/models/route.js +543 -543
  137. package/.next/standalone/.next/server/app/api/v1/packages/catalog/route.js +445 -445
  138. package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js +120 -120
  139. package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js.nft.json +1 -1
  140. package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js +234 -234
  141. package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js.nft.json +1 -1
  142. package/.next/standalone/.next/server/app/api/v1/packages/install/route.js +407 -407
  143. package/.next/standalone/.next/server/app/api/v1/packages/install/route.js.nft.json +1 -1
  144. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js +37 -37
  145. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js.nft.json +1 -1
  146. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js +107 -107
  147. package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js.nft.json +1 -1
  148. package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js +228 -228
  149. package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js.nft.json +1 -1
  150. package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js +9 -9
  151. package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js.nft.json +1 -1
  152. package/.next/standalone/.next/server/app/api/v1/packages/route.js +148 -148
  153. package/.next/standalone/.next/server/app/api/v1/packages/route.js.nft.json +1 -1
  154. package/.next/standalone/.next/server/app/api/v1/page-capture/route.js +787 -787
  155. package/.next/standalone/.next/server/app/api/v1/page-capture/route.js.nft.json +1 -1
  156. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js +507 -507
  157. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js.nft.json +1 -1
  158. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js +181 -181
  159. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js.nft.json +1 -1
  160. package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js +258 -258
  161. package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js.nft.json +1 -1
  162. package/.next/standalone/.next/server/app/api/v1/profile/location/route.js +30 -30
  163. package/.next/standalone/.next/server/app/api/v1/profile/route.js +164 -164
  164. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/models/route.js +44 -44
  165. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/probe/route.js +9 -9
  166. package/.next/standalone/.next/server/app/api/v1/providers/github-copilot/auth/route.js +164 -164
  167. package/.next/standalone/.next/server/app/api/v1/providers/route.js +94 -94
  168. package/.next/standalone/.next/server/app/api/v1/proxy-config/route.js +450 -450
  169. package/.next/standalone/.next/server/app/api/v1/redaction/init/route.js +37 -37
  170. package/.next/standalone/.next/server/app/api/v1/redaction/route.js +58 -58
  171. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/route.js +600 -600
  172. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js +44 -44
  173. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js.nft.json +1 -1
  174. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/route.js +732 -732
  175. package/.next/standalone/.next/server/app/api/v1/security/idle-timeout/route.js +359 -359
  176. package/.next/standalone/.next/server/app/api/v1/security/pin/route.js +197 -197
  177. package/.next/standalone/.next/server/app/api/v1/security/state/route.js +51 -51
  178. package/.next/standalone/.next/server/app/api/v1/security/unlock/route.js +176 -176
  179. package/.next/standalone/.next/server/app/api/v1/security/verify-pin/route.js +190 -190
  180. package/.next/standalone/.next/server/app/api/v1/setup/test-key/route.js +26 -26
  181. package/.next/standalone/.next/server/app/api/v1/skills/[id]/route.js +770 -770
  182. package/.next/standalone/.next/server/app/api/v1/skills/repos/[id]/route.js +115 -115
  183. package/.next/standalone/.next/server/app/api/v1/skills/repos/route.js +327 -327
  184. package/.next/standalone/.next/server/app/api/v1/skills/route.js +870 -870
  185. package/.next/standalone/.next/server/app/api/v1/system/abort/route.js +838 -808
  186. package/.next/standalone/.next/server/app/api/v1/system/restart/route.js +177 -177
  187. package/.next/standalone/.next/server/app/api/v1/system/restart/route.js.nft.json +1 -1
  188. package/.next/standalone/.next/server/app/api/v1/tailscale/route.js +164 -164
  189. package/.next/standalone/.next/server/app/api/v1/tasks/[agent_id]/route.js +115 -115
  190. package/.next/standalone/.next/server/app/api/v1/tasks/route.js +23 -23
  191. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route.js +1429 -0
  192. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route.js.nft.json +1 -0
  193. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route_client-reference-manifest.js +1 -0
  194. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/context-pin/route.js +635 -634
  195. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/context-pin/route.js.nft.json +1 -1
  196. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/route.js +53 -439
  197. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/route.js.nft.json +1 -1
  198. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js +172 -172
  199. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js.nft.json +1 -1
  200. package/.next/standalone/.next/server/app/api/v1/threads/route.js +908 -908
  201. package/.next/standalone/.next/server/app/api/v1/tools/route.js +2 -2
  202. package/.next/standalone/.next/server/app/api/v1/tools/route.js.nft.json +1 -1
  203. package/.next/standalone/.next/server/app/api/v1/update/apply/route.js +17 -17
  204. package/.next/standalone/.next/server/app/api/v1/update/apply/route.js.nft.json +1 -1
  205. package/.next/standalone/.next/server/app/api/v1/update/route.js +570 -570
  206. package/.next/standalone/.next/server/app/api/v1/voice/transcribe/route.js +224 -224
  207. package/.next/standalone/.next/server/app/api/v1/voice/tts/route.js +975 -975
  208. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/route.js +23 -23
  209. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js +72 -72
  210. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js.nft.json +1 -1
  211. package/.next/standalone/.next/server/app/api/v1/watchers/reaction-scripts/route.js +128 -128
  212. package/.next/standalone/.next/server/app/api/v1/watchers/route.js +164 -164
  213. package/.next/standalone/.next/server/app/api/v1/watchers/route.js.nft.json +1 -1
  214. package/.next/standalone/.next/server/app/icon.svg/route.js +62 -62
  215. package/.next/standalone/.next/server/app/manifest.webmanifest/route.js +436 -436
  216. package/.next/standalone/.next/server/app/page.js +1243 -854
  217. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  218. package/.next/standalone/.next/server/app/setup/page.js +91 -91
  219. package/.next/standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  220. package/.next/standalone/.next/server/app-paths-manifest.json +6 -5
  221. package/.next/standalone/.next/server/chunks/{424.js → 1388.js} +335 -986
  222. package/.next/standalone/.next/server/chunks/1433.js +1 -1
  223. package/.next/standalone/.next/server/chunks/1638.js +1 -2
  224. package/.next/standalone/.next/server/chunks/1738.js +1 -1
  225. package/.next/standalone/.next/server/chunks/210.js +6 -6
  226. package/.next/standalone/.next/server/chunks/2151.js +31 -1
  227. package/.next/standalone/.next/server/chunks/2207.js +1 -0
  228. package/.next/standalone/.next/server/chunks/2471.js +28 -28
  229. package/.next/standalone/.next/server/chunks/2504.js +1 -1
  230. package/.next/standalone/.next/server/chunks/2695.js +17 -17
  231. package/.next/standalone/.next/server/chunks/3042.js +14 -8
  232. package/.next/standalone/.next/server/chunks/3399.js +1 -1
  233. package/.next/standalone/.next/server/chunks/3566.js +1 -1
  234. package/.next/standalone/.next/server/chunks/4189.js +946 -0
  235. package/.next/standalone/.next/server/chunks/{9590.js → 423.js} +8 -3
  236. package/.next/standalone/.next/server/chunks/4433.js +146 -146
  237. package/.next/standalone/.next/server/chunks/4508.js +1 -1
  238. package/.next/standalone/.next/server/chunks/4588.js +1 -0
  239. package/.next/standalone/.next/server/chunks/46.js +5 -0
  240. package/.next/standalone/.next/server/chunks/466.js +12 -0
  241. package/.next/standalone/.next/server/chunks/4868.js +206 -206
  242. package/.next/standalone/.next/server/chunks/4992.js +13 -0
  243. package/.next/standalone/.next/server/chunks/5120.js +963 -0
  244. package/.next/standalone/.next/server/chunks/5701.js +1 -1
  245. package/.next/standalone/.next/server/chunks/5900.js +1 -1
  246. package/.next/standalone/.next/server/chunks/6210.js +1 -0
  247. package/.next/standalone/.next/server/chunks/6213.js +1 -1
  248. package/.next/standalone/.next/server/chunks/6649.js +2 -2
  249. package/.next/standalone/.next/server/chunks/6703.js +3 -3
  250. package/.next/standalone/.next/server/chunks/7445.js +1 -0
  251. package/.next/standalone/.next/server/chunks/8067.js +12 -0
  252. package/.next/standalone/.next/server/chunks/8461.js +14 -9
  253. package/.next/standalone/.next/server/chunks/8558.js +1 -1
  254. package/.next/standalone/.next/server/chunks/8724.js +1 -1
  255. package/.next/standalone/.next/server/chunks/8849.js +91 -91
  256. package/.next/standalone/.next/server/chunks/9032.js +6 -5
  257. package/.next/standalone/.next/server/chunks/{2563.js → 9164.js} +33173 -31461
  258. package/.next/standalone/.next/server/chunks/9237.js +396 -396
  259. package/.next/standalone/.next/server/chunks/{9640.js → 9304.js} +1628 -570
  260. package/.next/standalone/.next/server/chunks/9406.js +1 -1
  261. package/.next/standalone/.next/server/chunks/9824.js +98 -98
  262. package/.next/standalone/.next/server/chunks/9826.js +1 -0
  263. package/.next/standalone/.next/server/middleware-build-manifest.js +2 -2
  264. package/.next/standalone/.next/server/middleware.js +415 -397
  265. package/.next/standalone/.next/server/pages/404.html +2 -2
  266. package/.next/standalone/.next/server/pages/500.html +1 -1
  267. package/.next/standalone/.next/server/preview-props.json +3 -3
  268. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  269. package/.next/standalone/.next/static/chunks/{1395-a340fb0a345382a4.js → 1395-e4a99912b8f83044.js} +13 -1
  270. package/.next/standalone/.next/static/chunks/app/_global-error/{page-36cb8b428b38b26a.js → page-6fc5f8e744c81802.js} +1 -1
  271. package/.next/standalone/.next/static/chunks/app/api/v1/access/[identity]/{route-36cb8b428b38b26a.js → route-6fc5f8e744c81802.js} +1 -1
  272. package/.next/standalone/.next/static/chunks/app/api/v1/access/{route-36cb8b428b38b26a.js → route-6fc5f8e744c81802.js} +1 -1
  273. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/compact/{route-36cb8b428b38b26a.js → route-6fc5f8e744c81802.js} +1 -1
  274. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/display-filters/route-6fc5f8e744c81802.js +17 -0
  275. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/route-6fc5f8e744c81802.js +17 -0
  276. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/thread/route-6fc5f8e744c81802.js +17 -0
  277. package/.next/standalone/.next/static/chunks/app/api/v1/agents/route-6fc5f8e744c81802.js +17 -0
  278. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/[hostname]/route-6fc5f8e744c81802.js +17 -0
  279. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/route-6fc5f8e744c81802.js +17 -0
  280. package/.next/standalone/.next/static/chunks/app/api/v1/artifacts/lifecycle/route-6fc5f8e744c81802.js +17 -0
  281. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/files/route-6fc5f8e744c81802.js +17 -0
  282. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/images/route-6fc5f8e744c81802.js +17 -0
  283. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/chats/route-6fc5f8e744c81802.js +17 -0
  284. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/[remote_jid]/route-6fc5f8e744c81802.js +17 -0
  285. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/route-6fc5f8e744c81802.js +17 -0
  286. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/lookup/route-6fc5f8e744c81802.js +17 -0
  287. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/pair/route-6fc5f8e744c81802.js +17 -0
  288. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/route-6fc5f8e744c81802.js +17 -0
  289. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/[route_id]/route-6fc5f8e744c81802.js +17 -0
  290. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/route-6fc5f8e744c81802.js +17 -0
  291. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/status/route-6fc5f8e744c81802.js +17 -0
  292. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/kinds/route-6fc5f8e744c81802.js +17 -0
  293. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/route-6fc5f8e744c81802.js +17 -0
  294. package/.next/standalone/.next/static/chunks/app/api/v1/builtin-tools/route-6fc5f8e744c81802.js +17 -0
  295. package/.next/standalone/.next/static/chunks/app/api/v1/config/route-6fc5f8e744c81802.js +17 -0
  296. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/[id]/route-6fc5f8e744c81802.js +17 -0
  297. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/route-6fc5f8e744c81802.js +17 -0
  298. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/currency/route-6fc5f8e744c81802.js +17 -0
  299. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/metrics/route-6fc5f8e744c81802.js +17 -0
  300. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing/route-6fc5f8e744c81802.js +17 -0
  301. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing-task/route-6fc5f8e744c81802.js +17 -0
  302. package/.next/standalone/.next/static/chunks/app/api/v1/delegations/codex/[job_id]/route-6fc5f8e744c81802.js +17 -0
  303. package/.next/standalone/.next/static/chunks/app/api/v1/documents/search/route-6fc5f8e744c81802.js +17 -0
  304. package/.next/standalone/.next/static/chunks/app/api/v1/documents/settings/route-6fc5f8e744c81802.js +17 -0
  305. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/reindex/route-6fc5f8e744c81802.js +17 -0
  306. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/route-6fc5f8e744c81802.js +17 -0
  307. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/route-6fc5f8e744c81802.js +17 -0
  308. package/.next/standalone/.next/static/chunks/app/api/v1/env/route-6fc5f8e744c81802.js +17 -0
  309. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/allowlist/route-6fc5f8e744c81802.js +17 -0
  310. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/route-6fc5f8e744c81802.js +17 -0
  311. package/.next/standalone/.next/static/chunks/app/api/v1/events/route-6fc5f8e744c81802.js +17 -0
  312. package/.next/standalone/.next/static/chunks/app/api/v1/events/test/route-6fc5f8e744c81802.js +17 -0
  313. package/.next/standalone/.next/static/chunks/app/api/v1/extension/agents/route-6fc5f8e744c81802.js +17 -0
  314. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/activate/route-6fc5f8e744c81802.js +17 -0
  315. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/foreground/route-6fc5f8e744c81802.js +17 -0
  316. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/history/route-6fc5f8e744c81802.js +17 -0
  317. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/poll/route-6fc5f8e744c81802.js +17 -0
  318. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/progress/route-6fc5f8e744c81802.js +17 -0
  319. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/result/route-6fc5f8e744c81802.js +17 -0
  320. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/retry/route-6fc5f8e744c81802.js +17 -0
  321. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/status/route-6fc5f8e744c81802.js +17 -0
  322. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/tabs/route-6fc5f8e744c81802.js +17 -0
  323. package/.next/standalone/.next/static/chunks/app/api/v1/extension/fill/route-6fc5f8e744c81802.js +17 -0
  324. package/.next/standalone/.next/static/chunks/app/api/v1/extension/refine/route-6fc5f8e744c81802.js +17 -0
  325. package/.next/standalone/.next/static/chunks/app/api/v1/extension/turn/route-6fc5f8e744c81802.js +17 -0
  326. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/route-6fc5f8e744c81802.js +17 -0
  327. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/config/route-6fc5f8e744c81802.js +17 -0
  328. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/route-6fc5f8e744c81802.js +17 -0
  329. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/secrets/route-6fc5f8e744c81802.js +17 -0
  330. package/.next/standalone/.next/static/chunks/app/api/v1/files/[name]/route-6fc5f8e744c81802.js +17 -0
  331. package/.next/standalone/.next/static/chunks/app/api/v1/fs/browse/route-6fc5f8e744c81802.js +17 -0
  332. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/[id]/route-6fc5f8e744c81802.js +17 -0
  333. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/default/route-6fc5f8e744c81802.js +17 -0
  334. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/route-6fc5f8e744c81802.js +17 -0
  335. package/.next/standalone/.next/static/chunks/app/api/v1/health/probes/route-6fc5f8e744c81802.js +17 -0
  336. package/.next/standalone/.next/static/chunks/app/api/v1/health/route-6fc5f8e744c81802.js +17 -0
  337. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/route-6fc5f8e744c81802.js +17 -0
  338. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/test/route-6fc5f8e744c81802.js +17 -0
  339. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/callback/route-6fc5f8e744c81802.js +17 -0
  340. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/start/route-6fc5f8e744c81802.js +17 -0
  341. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/status/route-6fc5f8e744c81802.js +17 -0
  342. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/callback/route-6fc5f8e744c81802.js +17 -0
  343. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/start/route-6fc5f8e744c81802.js +17 -0
  344. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/status/route-6fc5f8e744c81802.js +17 -0
  345. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/route-6fc5f8e744c81802.js +17 -0
  346. package/.next/standalone/.next/static/chunks/app/api/v1/lifecycle/adoption/route-6fc5f8e744c81802.js +17 -0
  347. package/.next/standalone/.next/static/chunks/app/api/v1/local-file/route-6fc5f8e744c81802.js +17 -0
  348. package/.next/standalone/.next/static/chunks/app/api/v1/logs/route-6fc5f8e744c81802.js +17 -0
  349. package/.next/standalone/.next/static/chunks/app/api/v1/maps/embed/route-6fc5f8e744c81802.js +17 -0
  350. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/[name]/route-6fc5f8e744c81802.js +17 -0
  351. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/registry/route-6fc5f8e744c81802.js +17 -0
  352. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/route-6fc5f8e744c81802.js +17 -0
  353. package/.next/standalone/.next/static/chunks/app/api/v1/memory/[namespace]/[key]/route-6fc5f8e744c81802.js +17 -0
  354. package/.next/standalone/.next/static/chunks/app/api/v1/memory/policy/route-6fc5f8e744c81802.js +17 -0
  355. package/.next/standalone/.next/static/chunks/app/api/v1/memory/route-6fc5f8e744c81802.js +17 -0
  356. package/.next/standalone/.next/static/chunks/app/api/v1/memory/search/route-6fc5f8e744c81802.js +17 -0
  357. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/compact-threads/route-6fc5f8e744c81802.js +17 -0
  358. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/route-6fc5f8e744c81802.js +17 -0
  359. package/.next/standalone/.next/static/chunks/app/api/v1/models/route-6fc5f8e744c81802.js +17 -0
  360. package/.next/standalone/.next/static/chunks/app/api/v1/packages/catalog/route-6fc5f8e744c81802.js +17 -0
  361. package/.next/standalone/.next/static/chunks/app/api/v1/packages/defaults/[id]/route-6fc5f8e744c81802.js +17 -0
  362. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/[id]/route-6fc5f8e744c81802.js +17 -0
  363. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/route-6fc5f8e744c81802.js +17 -0
  364. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/enabled/route-6fc5f8e744c81802.js +17 -0
  365. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/route-6fc5f8e744c81802.js +17 -0
  366. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/route-6fc5f8e744c81802.js +17 -0
  367. package/.next/standalone/.next/static/chunks/app/api/v1/packages/reload/route-6fc5f8e744c81802.js +17 -0
  368. package/.next/standalone/.next/static/chunks/app/api/v1/packages/route-6fc5f8e744c81802.js +17 -0
  369. package/.next/standalone/.next/static/chunks/app/api/v1/page-capture/route-6fc5f8e744c81802.js +17 -0
  370. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/approve/route-6fc5f8e744c81802.js +17 -0
  371. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/deny/route-6fc5f8e744c81802.js +17 -0
  372. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/route-6fc5f8e744c81802.js +17 -0
  373. package/.next/standalone/.next/static/chunks/app/api/v1/profile/location/route-6fc5f8e744c81802.js +17 -0
  374. package/.next/standalone/.next/static/chunks/app/api/v1/profile/route-6fc5f8e744c81802.js +17 -0
  375. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/models/route-6fc5f8e744c81802.js +17 -0
  376. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/probe/route-6fc5f8e744c81802.js +17 -0
  377. package/.next/standalone/.next/static/chunks/app/api/v1/providers/github-copilot/auth/route-6fc5f8e744c81802.js +17 -0
  378. package/.next/standalone/.next/static/chunks/app/api/v1/providers/route-6fc5f8e744c81802.js +17 -0
  379. package/.next/standalone/.next/static/chunks/app/api/v1/proxy-config/route-6fc5f8e744c81802.js +17 -0
  380. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/init/route-6fc5f8e744c81802.js +17 -0
  381. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/route-6fc5f8e744c81802.js +17 -0
  382. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/route-6fc5f8e744c81802.js +17 -0
  383. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/run/route-6fc5f8e744c81802.js +17 -0
  384. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/route-6fc5f8e744c81802.js +17 -0
  385. package/.next/standalone/.next/static/chunks/app/api/v1/security/idle-timeout/route-6fc5f8e744c81802.js +17 -0
  386. package/.next/standalone/.next/static/chunks/app/api/v1/security/pin/route-6fc5f8e744c81802.js +17 -0
  387. package/.next/standalone/.next/static/chunks/app/api/v1/security/state/route-6fc5f8e744c81802.js +17 -0
  388. package/.next/standalone/.next/static/chunks/app/api/v1/security/unlock/route-6fc5f8e744c81802.js +17 -0
  389. package/.next/standalone/.next/static/chunks/app/api/v1/security/verify-pin/route-6fc5f8e744c81802.js +17 -0
  390. package/.next/standalone/.next/static/chunks/app/api/v1/setup/test-key/route-6fc5f8e744c81802.js +17 -0
  391. package/.next/standalone/.next/static/chunks/app/api/v1/skills/[id]/route-6fc5f8e744c81802.js +17 -0
  392. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/[id]/route-6fc5f8e744c81802.js +17 -0
  393. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/route-6fc5f8e744c81802.js +17 -0
  394. package/.next/standalone/.next/static/chunks/app/api/v1/skills/route-6fc5f8e744c81802.js +17 -0
  395. package/.next/standalone/.next/static/chunks/app/api/v1/system/abort/route-6fc5f8e744c81802.js +17 -0
  396. package/.next/standalone/.next/static/chunks/app/api/v1/system/restart/route-6fc5f8e744c81802.js +17 -0
  397. package/.next/standalone/.next/static/chunks/app/api/v1/tailscale/route-6fc5f8e744c81802.js +17 -0
  398. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/[agent_id]/route-6fc5f8e744c81802.js +17 -0
  399. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/route-6fc5f8e744c81802.js +17 -0
  400. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/activity/route-6fc5f8e744c81802.js +17 -0
  401. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/context-pin/route-6fc5f8e744c81802.js +17 -0
  402. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/route-6fc5f8e744c81802.js +17 -0
  403. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/run/route-6fc5f8e744c81802.js +17 -0
  404. package/.next/standalone/.next/static/chunks/app/api/v1/threads/route-6fc5f8e744c81802.js +17 -0
  405. package/.next/standalone/.next/static/chunks/app/api/v1/tools/route-6fc5f8e744c81802.js +17 -0
  406. package/.next/standalone/.next/static/chunks/app/api/v1/update/apply/route-6fc5f8e744c81802.js +17 -0
  407. package/.next/standalone/.next/static/chunks/app/api/v1/update/route-6fc5f8e744c81802.js +17 -0
  408. package/.next/standalone/.next/static/chunks/app/api/v1/voice/transcribe/route-6fc5f8e744c81802.js +17 -0
  409. package/.next/standalone/.next/static/chunks/app/api/v1/voice/tts/route-6fc5f8e744c81802.js +17 -0
  410. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/route-6fc5f8e744c81802.js +17 -0
  411. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/run/route-6fc5f8e744c81802.js +17 -0
  412. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/reaction-scripts/route-6fc5f8e744c81802.js +17 -0
  413. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/route-6fc5f8e744c81802.js +17 -0
  414. package/.next/standalone/.next/static/chunks/app/manifest.webmanifest/route-6fc5f8e744c81802.js +17 -0
  415. package/.next/standalone/.next/static/chunks/app/{page-7017f07f8a7a083c.js → page-213a623b37226452.js} +1041 -652
  416. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-6fc5f8e744c81802.js +17 -0
  417. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-6fc5f8e744c81802.js +17 -0
  418. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-6fc5f8e744c81802.js +17 -0
  419. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-6fc5f8e744c81802.js +17 -0
  420. package/.next/standalone/.next/static/css/{d80058f0b9b41c09.css → 312542a5725ba0d5.css} +2 -2
  421. package/.next/standalone/docs/adoption/changesets.json +309 -0
  422. package/.next/standalone/lib/skills/builtins/memory-organization/SKILL.md +16 -0
  423. package/.next/standalone/package.json +3 -3
  424. package/CHANGELOG.md +25 -0
  425. package/api/client.ts +9 -0
  426. package/api/types.ts +29 -0
  427. package/app/api/v1/lifecycle/adoption/route.ts +14 -2
  428. package/app/api/v1/models/[name]/compact-threads/route.ts +14 -11
  429. package/app/api/v1/threads/[thread_id]/activity/route.ts +19 -0
  430. package/app/api/v1/threads/[thread_id]/context-pin/route.test.ts +1 -0
  431. package/app/api/v1/threads/[thread_id]/context-pin/route.ts +2 -1
  432. package/app/api/v1/threads/[thread_id]/route.ts +5 -1
  433. package/components/chat/ChatView.tsx +52 -11
  434. package/components/chat/ContextBoundary.test.tsx +68 -1
  435. package/components/chat/ContextBoundary.tsx +92 -13
  436. package/components/chat/MessageList.test.tsx +31 -0
  437. package/components/chat/MessageList.tsx +49 -28
  438. package/components/chat/ToolList.test.tsx +92 -16
  439. package/components/chat/ToolList.tsx +59 -4
  440. package/components/chat/chat-helpers.test.tsx +24 -1
  441. package/components/chat/chat-helpers.ts +47 -4
  442. package/components/chat/useThreadActivity.test.tsx +113 -0
  443. package/components/chat/useThreadActivity.ts +94 -0
  444. package/components/chat/useThreadData.ts +16 -16
  445. package/components/chat/workflow-step-retry.ts +25 -0
  446. package/components/ui/BootScreen.tsx +17 -0
  447. package/components/ui/WorkflowChecklist.tsx +71 -33
  448. package/hooks/useSSE.ts +28 -3
  449. package/lib/agents/compaction-pipeline.test.ts +202 -0
  450. package/lib/agents/compaction-pipeline.ts +483 -0
  451. package/lib/agents/conversation-summary.ts +37 -21
  452. package/lib/agents/prepare/history-window.test.ts +18 -0
  453. package/lib/agents/prepare/history-window.ts +11 -2
  454. package/lib/agents/prepare/request.ts +4 -0
  455. package/lib/agents/prepare/system-prompt.test.ts +39 -0
  456. package/lib/agents/prepare/system-prompt.ts +8 -3
  457. package/lib/agents/prompt-registry.test.ts +5 -140
  458. package/lib/agents/prompt-registry.ts +45 -1
  459. package/lib/agents/prompt-variants.ts +146 -0
  460. package/lib/agents/run-registry.test.ts +22 -0
  461. package/lib/agents/run-registry.ts +29 -0
  462. package/lib/agents/run-thread.retry.test.ts +67 -1
  463. package/lib/agents/run-thread.ts +86 -1
  464. package/lib/agents/thread-activity.test.ts +31 -0
  465. package/lib/agents/thread-activity.ts +27 -0
  466. package/lib/agents/thread-compaction-state.test.ts +82 -0
  467. package/lib/agents/thread-compaction-state.ts +121 -0
  468. package/lib/agents/thread-compaction.test.ts +83 -4
  469. package/lib/agents/thread-compaction.ts +34 -11
  470. package/lib/agents/warm-summary-background.test.ts +219 -5
  471. package/lib/agents/warm-summary-background.ts +325 -142
  472. package/lib/agents/warm-topics.test.ts +37 -0
  473. package/lib/agents/warm-topics.ts +297 -0
  474. package/lib/agents/workflow-step-retry.test.ts +96 -0
  475. package/lib/agents/workflow-step-retry.ts +216 -0
  476. package/lib/api/browser-control.ts +0 -3
  477. package/lib/db/migrations.ts +5 -0
  478. package/lib/env/config.ts +2 -0
  479. package/lib/env/schema.ts +12 -0
  480. package/lib/lifecycle/changeset-build.test.ts +93 -0
  481. package/lib/lifecycle/changeset-build.ts +210 -0
  482. package/lib/lifecycle/changesets.test.ts +101 -0
  483. package/lib/lifecycle/changesets.ts +166 -0
  484. package/lib/lifecycle/surface-collect.test.ts +88 -0
  485. package/lib/lifecycle/surface-collect.ts +64 -0
  486. package/lib/lifecycle/surface-snapshot.test.ts +104 -0
  487. package/lib/lifecycle/surface-snapshot.ts +210 -0
  488. package/lib/memory/record.ts +0 -2
  489. package/lib/providers/external.ts +0 -2
  490. package/lib/skills/builtins/memory-organization/SKILL.md +16 -0
  491. package/lib/stores/threads.test.ts +9 -0
  492. package/lib/stores/threads.ts +21 -11
  493. package/lib/stores/version-adoption.test.ts +96 -0
  494. package/lib/stores/version-adoption.ts +239 -26
  495. package/lib/stores/workflow-progress.ts +3 -0
  496. package/lib/tools/communications/ms-todo.ts +0 -7
  497. package/lib/tools/general/memory.ts +1 -1
  498. package/lib/tools/general/workflow-progress.ts +2 -0
  499. package/lib/tools/runtime/catalog.ts +1 -25
  500. package/lib/triggers/registry.ts +0 -4
  501. package/package.json +3 -3
  502. package/scripts/install-to-system.ps1 +39 -11
  503. package/scripts/install-to-system.sh +37 -3
  504. package/.next/standalone/.next/server/chunks/3979.js +0 -581
  505. package/.next/standalone/.next/server/chunks/5936.js +0 -594
  506. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/display-filters/route-36cb8b428b38b26a.js +0 -17
  507. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/route-36cb8b428b38b26a.js +0 -17
  508. package/.next/standalone/.next/static/chunks/app/api/v1/agents/[id]/thread/route-36cb8b428b38b26a.js +0 -17
  509. package/.next/standalone/.next/static/chunks/app/api/v1/agents/route-36cb8b428b38b26a.js +0 -17
  510. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/[hostname]/route-36cb8b428b38b26a.js +0 -17
  511. package/.next/standalone/.next/static/chunks/app/api/v1/allowed-sites/route-36cb8b428b38b26a.js +0 -17
  512. package/.next/standalone/.next/static/chunks/app/api/v1/artifacts/lifecycle/route-36cb8b428b38b26a.js +0 -17
  513. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/files/route-36cb8b428b38b26a.js +0 -17
  514. package/.next/standalone/.next/static/chunks/app/api/v1/attachments/images/route-36cb8b428b38b26a.js +0 -17
  515. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/chats/route-36cb8b428b38b26a.js +0 -17
  516. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/[remote_jid]/route-36cb8b428b38b26a.js +0 -17
  517. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/ignores/route-36cb8b428b38b26a.js +0 -17
  518. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/lookup/route-36cb8b428b38b26a.js +0 -17
  519. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/pair/route-36cb8b428b38b26a.js +0 -17
  520. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/route-36cb8b428b38b26a.js +0 -17
  521. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/[route_id]/route-36cb8b428b38b26a.js +0 -17
  522. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/routes/route-36cb8b428b38b26a.js +0 -17
  523. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/[id]/status/route-36cb8b428b38b26a.js +0 -17
  524. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/kinds/route-36cb8b428b38b26a.js +0 -17
  525. package/.next/standalone/.next/static/chunks/app/api/v1/bridges/route-36cb8b428b38b26a.js +0 -17
  526. package/.next/standalone/.next/static/chunks/app/api/v1/builtin-tools/route-36cb8b428b38b26a.js +0 -17
  527. package/.next/standalone/.next/static/chunks/app/api/v1/config/route-36cb8b428b38b26a.js +0 -17
  528. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/[id]/route-36cb8b428b38b26a.js +0 -17
  529. package/.next/standalone/.next/static/chunks/app/api/v1/credentials/route-36cb8b428b38b26a.js +0 -17
  530. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/currency/route-36cb8b428b38b26a.js +0 -17
  531. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/metrics/route-36cb8b428b38b26a.js +0 -17
  532. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing/route-36cb8b428b38b26a.js +0 -17
  533. package/.next/standalone/.next/static/chunks/app/api/v1/dashboard/pricing-task/route-36cb8b428b38b26a.js +0 -17
  534. package/.next/standalone/.next/static/chunks/app/api/v1/delegations/codex/[job_id]/route-36cb8b428b38b26a.js +0 -17
  535. package/.next/standalone/.next/static/chunks/app/api/v1/documents/search/route-36cb8b428b38b26a.js +0 -17
  536. package/.next/standalone/.next/static/chunks/app/api/v1/documents/settings/route-36cb8b428b38b26a.js +0 -17
  537. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/reindex/route-36cb8b428b38b26a.js +0 -17
  538. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/[id]/route-36cb8b428b38b26a.js +0 -17
  539. package/.next/standalone/.next/static/chunks/app/api/v1/documents/sources/route-36cb8b428b38b26a.js +0 -17
  540. package/.next/standalone/.next/static/chunks/app/api/v1/env/route-36cb8b428b38b26a.js +0 -17
  541. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/allowlist/route-36cb8b428b38b26a.js +0 -17
  542. package/.next/standalone/.next/static/chunks/app/api/v1/env-sync/route-36cb8b428b38b26a.js +0 -17
  543. package/.next/standalone/.next/static/chunks/app/api/v1/events/route-36cb8b428b38b26a.js +0 -17
  544. package/.next/standalone/.next/static/chunks/app/api/v1/events/test/route-36cb8b428b38b26a.js +0 -17
  545. package/.next/standalone/.next/static/chunks/app/api/v1/extension/agents/route-36cb8b428b38b26a.js +0 -17
  546. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/activate/route-36cb8b428b38b26a.js +0 -17
  547. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/foreground/route-36cb8b428b38b26a.js +0 -17
  548. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/history/route-36cb8b428b38b26a.js +0 -17
  549. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/poll/route-36cb8b428b38b26a.js +0 -17
  550. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/progress/route-36cb8b428b38b26a.js +0 -17
  551. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/result/route-36cb8b428b38b26a.js +0 -17
  552. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/retry/route-36cb8b428b38b26a.js +0 -17
  553. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/status/route-36cb8b428b38b26a.js +0 -17
  554. package/.next/standalone/.next/static/chunks/app/api/v1/extension/browser/tabs/route-36cb8b428b38b26a.js +0 -17
  555. package/.next/standalone/.next/static/chunks/app/api/v1/extension/fill/route-36cb8b428b38b26a.js +0 -17
  556. package/.next/standalone/.next/static/chunks/app/api/v1/extension/refine/route-36cb8b428b38b26a.js +0 -17
  557. package/.next/standalone/.next/static/chunks/app/api/v1/extension/turn/route-36cb8b428b38b26a.js +0 -17
  558. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/route-36cb8b428b38b26a.js +0 -17
  559. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/config/route-36cb8b428b38b26a.js +0 -17
  560. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/route-36cb8b428b38b26a.js +0 -17
  561. package/.next/standalone/.next/static/chunks/app/api/v1/extensions/tools/[name]/secrets/route-36cb8b428b38b26a.js +0 -17
  562. package/.next/standalone/.next/static/chunks/app/api/v1/files/[name]/route-36cb8b428b38b26a.js +0 -17
  563. package/.next/standalone/.next/static/chunks/app/api/v1/fs/browse/route-36cb8b428b38b26a.js +0 -17
  564. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/[id]/route-36cb8b428b38b26a.js +0 -17
  565. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/default/route-36cb8b428b38b26a.js +0 -17
  566. package/.next/standalone/.next/static/chunks/app/api/v1/harnesses/route-36cb8b428b38b26a.js +0 -17
  567. package/.next/standalone/.next/static/chunks/app/api/v1/health/probes/route-36cb8b428b38b26a.js +0 -17
  568. package/.next/standalone/.next/static/chunks/app/api/v1/health/route-36cb8b428b38b26a.js +0 -17
  569. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/route-36cb8b428b38b26a.js +0 -17
  570. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/[name]/test/route-36cb8b428b38b26a.js +0 -17
  571. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/callback/route-36cb8b428b38b26a.js +0 -17
  572. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/start/route-36cb8b428b38b26a.js +0 -17
  573. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/gmail/oauth/status/route-36cb8b428b38b26a.js +0 -17
  574. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/callback/route-36cb8b428b38b26a.js +0 -17
  575. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/start/route-36cb8b428b38b26a.js +0 -17
  576. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/outlook/oauth/status/route-36cb8b428b38b26a.js +0 -17
  577. package/.next/standalone/.next/static/chunks/app/api/v1/integrations/route-36cb8b428b38b26a.js +0 -17
  578. package/.next/standalone/.next/static/chunks/app/api/v1/lifecycle/adoption/route-36cb8b428b38b26a.js +0 -17
  579. package/.next/standalone/.next/static/chunks/app/api/v1/local-file/route-36cb8b428b38b26a.js +0 -17
  580. package/.next/standalone/.next/static/chunks/app/api/v1/logs/route-36cb8b428b38b26a.js +0 -17
  581. package/.next/standalone/.next/static/chunks/app/api/v1/maps/embed/route-36cb8b428b38b26a.js +0 -17
  582. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/[name]/route-36cb8b428b38b26a.js +0 -17
  583. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/registry/route-36cb8b428b38b26a.js +0 -17
  584. package/.next/standalone/.next/static/chunks/app/api/v1/mcp-servers/route-36cb8b428b38b26a.js +0 -17
  585. package/.next/standalone/.next/static/chunks/app/api/v1/memory/[namespace]/[key]/route-36cb8b428b38b26a.js +0 -17
  586. package/.next/standalone/.next/static/chunks/app/api/v1/memory/policy/route-36cb8b428b38b26a.js +0 -17
  587. package/.next/standalone/.next/static/chunks/app/api/v1/memory/route-36cb8b428b38b26a.js +0 -17
  588. package/.next/standalone/.next/static/chunks/app/api/v1/memory/search/route-36cb8b428b38b26a.js +0 -17
  589. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/compact-threads/route-36cb8b428b38b26a.js +0 -17
  590. package/.next/standalone/.next/static/chunks/app/api/v1/models/[name]/route-36cb8b428b38b26a.js +0 -17
  591. package/.next/standalone/.next/static/chunks/app/api/v1/models/route-36cb8b428b38b26a.js +0 -17
  592. package/.next/standalone/.next/static/chunks/app/api/v1/packages/catalog/route-36cb8b428b38b26a.js +0 -17
  593. package/.next/standalone/.next/static/chunks/app/api/v1/packages/defaults/[id]/route-36cb8b428b38b26a.js +0 -17
  594. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/[id]/route-36cb8b428b38b26a.js +0 -17
  595. package/.next/standalone/.next/static/chunks/app/api/v1/packages/install/route-36cb8b428b38b26a.js +0 -17
  596. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/enabled/route-36cb8b428b38b26a.js +0 -17
  597. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/[name]/route-36cb8b428b38b26a.js +0 -17
  598. package/.next/standalone/.next/static/chunks/app/api/v1/packages/manifests/route-36cb8b428b38b26a.js +0 -17
  599. package/.next/standalone/.next/static/chunks/app/api/v1/packages/reload/route-36cb8b428b38b26a.js +0 -17
  600. package/.next/standalone/.next/static/chunks/app/api/v1/packages/route-36cb8b428b38b26a.js +0 -17
  601. package/.next/standalone/.next/static/chunks/app/api/v1/page-capture/route-36cb8b428b38b26a.js +0 -17
  602. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/approve/route-36cb8b428b38b26a.js +0 -17
  603. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/[id]/deny/route-36cb8b428b38b26a.js +0 -17
  604. package/.next/standalone/.next/static/chunks/app/api/v1/pending-actions/route-36cb8b428b38b26a.js +0 -17
  605. package/.next/standalone/.next/static/chunks/app/api/v1/profile/location/route-36cb8b428b38b26a.js +0 -17
  606. package/.next/standalone/.next/static/chunks/app/api/v1/profile/route-36cb8b428b38b26a.js +0 -17
  607. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/models/route-36cb8b428b38b26a.js +0 -17
  608. package/.next/standalone/.next/static/chunks/app/api/v1/providers/[provider]/probe/route-36cb8b428b38b26a.js +0 -17
  609. package/.next/standalone/.next/static/chunks/app/api/v1/providers/github-copilot/auth/route-36cb8b428b38b26a.js +0 -17
  610. package/.next/standalone/.next/static/chunks/app/api/v1/providers/route-36cb8b428b38b26a.js +0 -17
  611. package/.next/standalone/.next/static/chunks/app/api/v1/proxy-config/route-36cb8b428b38b26a.js +0 -17
  612. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/init/route-36cb8b428b38b26a.js +0 -17
  613. package/.next/standalone/.next/static/chunks/app/api/v1/redaction/route-36cb8b428b38b26a.js +0 -17
  614. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/route-36cb8b428b38b26a.js +0 -17
  615. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/[id]/run/route-36cb8b428b38b26a.js +0 -17
  616. package/.next/standalone/.next/static/chunks/app/api/v1/scheduled-tasks/route-36cb8b428b38b26a.js +0 -17
  617. package/.next/standalone/.next/static/chunks/app/api/v1/security/idle-timeout/route-36cb8b428b38b26a.js +0 -17
  618. package/.next/standalone/.next/static/chunks/app/api/v1/security/pin/route-36cb8b428b38b26a.js +0 -17
  619. package/.next/standalone/.next/static/chunks/app/api/v1/security/state/route-36cb8b428b38b26a.js +0 -17
  620. package/.next/standalone/.next/static/chunks/app/api/v1/security/unlock/route-36cb8b428b38b26a.js +0 -17
  621. package/.next/standalone/.next/static/chunks/app/api/v1/security/verify-pin/route-36cb8b428b38b26a.js +0 -17
  622. package/.next/standalone/.next/static/chunks/app/api/v1/setup/test-key/route-36cb8b428b38b26a.js +0 -17
  623. package/.next/standalone/.next/static/chunks/app/api/v1/skills/[id]/route-36cb8b428b38b26a.js +0 -17
  624. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/[id]/route-36cb8b428b38b26a.js +0 -17
  625. package/.next/standalone/.next/static/chunks/app/api/v1/skills/repos/route-36cb8b428b38b26a.js +0 -17
  626. package/.next/standalone/.next/static/chunks/app/api/v1/skills/route-36cb8b428b38b26a.js +0 -17
  627. package/.next/standalone/.next/static/chunks/app/api/v1/system/abort/route-36cb8b428b38b26a.js +0 -17
  628. package/.next/standalone/.next/static/chunks/app/api/v1/system/restart/route-36cb8b428b38b26a.js +0 -17
  629. package/.next/standalone/.next/static/chunks/app/api/v1/tailscale/route-36cb8b428b38b26a.js +0 -17
  630. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/[agent_id]/route-36cb8b428b38b26a.js +0 -17
  631. package/.next/standalone/.next/static/chunks/app/api/v1/tasks/route-36cb8b428b38b26a.js +0 -17
  632. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/context-pin/route-36cb8b428b38b26a.js +0 -17
  633. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/route-36cb8b428b38b26a.js +0 -17
  634. package/.next/standalone/.next/static/chunks/app/api/v1/threads/[thread_id]/run/route-36cb8b428b38b26a.js +0 -17
  635. package/.next/standalone/.next/static/chunks/app/api/v1/threads/route-36cb8b428b38b26a.js +0 -17
  636. package/.next/standalone/.next/static/chunks/app/api/v1/tools/route-36cb8b428b38b26a.js +0 -17
  637. package/.next/standalone/.next/static/chunks/app/api/v1/update/apply/route-36cb8b428b38b26a.js +0 -17
  638. package/.next/standalone/.next/static/chunks/app/api/v1/update/route-36cb8b428b38b26a.js +0 -17
  639. package/.next/standalone/.next/static/chunks/app/api/v1/voice/transcribe/route-36cb8b428b38b26a.js +0 -17
  640. package/.next/standalone/.next/static/chunks/app/api/v1/voice/tts/route-36cb8b428b38b26a.js +0 -17
  641. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/route-36cb8b428b38b26a.js +0 -17
  642. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/[id]/run/route-36cb8b428b38b26a.js +0 -17
  643. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/reaction-scripts/route-36cb8b428b38b26a.js +0 -17
  644. package/.next/standalone/.next/static/chunks/app/api/v1/watchers/route-36cb8b428b38b26a.js +0 -17
  645. package/.next/standalone/.next/static/chunks/app/manifest.webmanifest/route-36cb8b428b38b26a.js +0 -17
  646. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-36cb8b428b38b26a.js +0 -17
  647. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-36cb8b428b38b26a.js +0 -17
  648. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-36cb8b428b38b26a.js +0 -17
  649. package/.next/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-36cb8b428b38b26a.js +0 -17
  650. /package/.next/standalone/.next/static/{NUrC9xax1sp1Q70nlFqS6 → bMRK5y3ruT7c3WtBfCQOG}/_buildManifest.js +0 -0
  651. /package/.next/standalone/.next/static/{NUrC9xax1sp1Q70nlFqS6 → bMRK5y3ruT7c3WtBfCQOG}/_ssgManifest.js +0 -0
@@ -167,1062 +167,1062 @@ module.exports = require("node:child_process");
167
167
 
168
168
  /***/ }),
169
169
 
170
- /***/ 33873:
171
- /***/ ((module) => {
172
-
173
- module.exports = require("path");
174
-
175
- /***/ }),
176
-
177
- /***/ 37067:
178
- /***/ ((module) => {
170
+ /***/ 32587:
171
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
179
172
 
180
- module.exports = require("node:http");
173
+ __webpack_require__.r(__webpack_exports__);
174
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
175
+ /* harmony export */ handler: () => (/* binding */ handler),
176
+ /* harmony export */ patchFetch: () => (/* binding */ patchFetch),
177
+ /* harmony export */ routeModule: () => (/* binding */ routeModule),
178
+ /* harmony export */ serverHooks: () => (/* binding */ serverHooks),
179
+ /* harmony export */ workAsyncStorage: () => (/* binding */ workAsyncStorage),
180
+ /* harmony export */ workUnitAsyncStorage: () => (/* binding */ workUnitAsyncStorage)
181
+ /* harmony export */ });
182
+ /* harmony import */ var next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(19225);
183
+ /* 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__);
184
+ /* harmony import */ var next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84006);
185
+ /* harmony import */ var next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8317);
186
+ /* 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__);
187
+ /* harmony import */ var next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(99373);
188
+ /* 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__);
189
+ /* harmony import */ var next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(34775);
190
+ /* 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__);
191
+ /* harmony import */ var next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(24235);
192
+ /* 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__);
193
+ /* harmony import */ var next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(261);
194
+ /* 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__);
195
+ /* harmony import */ var next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(54365);
196
+ /* 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__);
197
+ /* harmony import */ var next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(90771);
198
+ /* 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__);
199
+ /* harmony import */ var next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(73461);
200
+ /* 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__);
201
+ /* harmony import */ var next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(67798);
202
+ /* harmony import */ var next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(92280);
203
+ /* harmony import */ var next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(62018);
204
+ /* 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__);
205
+ /* harmony import */ var next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(45696);
206
+ /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(47929);
207
+ /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__);
208
+ /* harmony import */ var next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(86439);
209
+ /* 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__);
210
+ /* harmony import */ var next_dist_server_lib_route_cache_key__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(10246);
211
+ /* 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__);
212
+ /* harmony import */ var next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(37527);
213
+ /* 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__);
181
214
 
182
- /***/ }),
183
215
 
184
- /***/ 38522:
185
- /***/ ((module) => {
186
216
 
187
- module.exports = require("node:zlib");
188
217
 
189
- /***/ }),
190
218
 
191
- /***/ 44708:
192
- /***/ ((module) => {
193
219
 
194
- module.exports = require("node:https");
195
220
 
196
- /***/ }),
197
221
 
198
- /***/ 44870:
199
- /***/ ((module) => {
200
222
 
201
- module.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js");
202
223
 
203
- /***/ }),
204
224
 
205
- /***/ 48161:
206
- /***/ ((module) => {
207
225
 
208
- module.exports = require("node:os");
209
226
 
210
- /***/ }),
211
227
 
212
- /***/ 51455:
213
- /***/ ((module) => {
214
228
 
215
- module.exports = require("node:fs/promises");
216
229
 
217
- /***/ }),
218
230
 
219
- /***/ 53638:
220
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
221
231
 
222
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
223
- /* harmony export */ p: () => (/* binding */ parseJsonSafe)
224
- /* harmony export */ });
225
- // JSON.parse with a fallback value when the input is malformed (or empty).
226
- // Used everywhere we read responses from external APIs — they're contractually
227
- // JSON but a transient 502 / proxy interstitial occasionally returns HTML.
228
- function parseJsonSafe(text, fallback) {
229
- try {
230
- return JSON.parse(text);
231
- } catch {
232
- return fallback;
233
- }
232
+ // We inject the nextConfigOutput here so that we can use them in the route
233
+ // module.
234
+ const nextConfigOutput = "standalone"
235
+ const routeModule = new next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__.AppRouteRouteModule({
236
+ definition: {
237
+ kind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
238
+ page: "/api/v1/integrations/outlook/oauth/status/route",
239
+ pathname: "/api/v1/integrations/outlook/oauth/status",
240
+ filename: "route",
241
+ bundlePath: "app/api/v1/integrations/outlook/oauth/status/route"
242
+ },
243
+ distDir: ".next" || 0,
244
+ relativeProjectDir: false || '',
245
+ resolvedPagePath: "/home/runner/work/jarela/jarela/app/api/v1/integrations/outlook/oauth/status/route.ts",
246
+ nextConfigOutput,
247
+ // The lazy require factory ensures that:
248
+ // - In dev: devRequestTimingInternalsEnd is set before userland executes,
249
+ // correctly attributing module load time to application-code rather than
250
+ // framework internals.
251
+ // - In all modes: async modules (route files with top-level await) are
252
+ // handled correctly — require() returns a Promise for such modules, which
253
+ // ensureUserland() awaits before the first request is handled.
254
+ userland: ()=>__webpack_require__(7161),
255
+ // In Turbopack dev mode, also provide a synchronous per-request getter so
256
+ // server HMR updates are picked up without re-executing the entry chunk.
257
+ // Using require() (synchronous) avoids adding async overhead that would be
258
+ // incorrectly attributed to application-code time in devRequestTiming.
259
+ ... false ? 0 : {}
260
+ });
261
+ // Pull out the exports that we need to expose from the module. This should
262
+ // be eliminated when we've moved the other routes to the new format. These
263
+ // are used to hook into the route.
264
+ const { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;
265
+ function patchFetch() {
266
+ return (0,next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__.patchFetch)({
267
+ workAsyncStorage,
268
+ workUnitAsyncStorage
269
+ });
234
270
  }
235
271
 
236
-
237
- /***/ }),
238
-
239
- /***/ 55511:
240
- /***/ ((module) => {
241
-
242
- module.exports = require("crypto");
243
-
244
- /***/ }),
245
-
246
- /***/ 55591:
247
- /***/ ((module) => {
248
-
249
- module.exports = require("https");
250
-
251
- /***/ }),
252
-
253
- /***/ 56362:
254
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
255
-
256
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
257
- /* harmony export */ R: () => (/* binding */ createOAuthFlowStore)
258
- /* harmony export */ });
259
- /* harmony import */ var node_crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(77598);
260
- /* harmony import */ var node_crypto__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(node_crypto__WEBPACK_IMPORTED_MODULE_0__);
261
- /* harmony import */ var _lib_utils_global_state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15559);
262
- // Ephemeral state store for in-app OAuth flows (Gmail, Microsoft, ...).
263
- //
264
- // Why this exists: the user types client_id + client_secret in the
265
- // Integrations panel, we POST to /oauth/start, stash them here keyed by a
266
- // random `state`, and return the provider's authorize URL. The browser
267
- // bounces back to /oauth/callback with `?code&state`, we exchange, and
268
- // persist the integration. Meanwhile the panel polls /oauth/status.
269
- //
270
- // Pinned to globalThis so HMR in dev doesn't lose pending flows.
271
- //
272
- // Same shape used by both gmail-oauth.ts and microsoft-oauth.ts — pass a
273
- // unique `globalKey` per provider so they don't share a Map.
274
-
275
-
276
- const DEFAULT_TTL_MS = 10 * 60 * 1000;
277
- const DEFAULT_MAX_FLOWS = 32;
278
- function createOAuthFlowStore(opts) {
279
- const ttlMs = opts.ttlMs ?? DEFAULT_TTL_MS;
280
- const maxFlows = opts.maxFlows ?? DEFAULT_MAX_FLOWS;
281
- const flows = (0,_lib_utils_global_state__WEBPACK_IMPORTED_MODULE_1__/* .getOrCreateGlobal */ .X)(opts.globalKey, ()=>new Map());
282
- function gc() {
283
- const now = Date.now();
284
- for (const [k, v] of flows){
285
- if (now - v.createdAt > ttlMs) flows.delete(k);
286
- }
287
- // Hard cap so a stuck UI can't grow this unbounded.
288
- if (flows.size > maxFlows) {
289
- const oldest = [
290
- ...flows.entries()
291
- ].sort((a, b)=>a[1].createdAt - b[1].createdAt);
292
- for(let i = 0; i < oldest.length - maxFlows; i++)flows.delete(oldest[i][0]);
293
- }
272
+ async function handler(req, res, ctx) {
273
+ if (ctx.requestMeta) {
274
+ (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.setRequestMeta)(req, ctx.requestMeta);
294
275
  }
295
- return {
296
- create (input) {
297
- gc();
298
- const state = (0,node_crypto__WEBPACK_IMPORTED_MODULE_0__.randomBytes)(16).toString("hex");
299
- const flow = {
300
- createdAt: Date.now(),
301
- status: "pending",
302
- ...input
303
- };
304
- flows.set(state, flow);
305
- return {
306
- state,
307
- flow
308
- };
309
- },
310
- get (state) {
311
- gc();
312
- return flows.get(state);
313
- },
314
- update (state, patch) {
315
- const f = flows.get(state);
316
- if (f) Object.assign(f, patch);
317
- },
318
- delete (state) {
319
- flows.delete(state);
276
+ if (routeModule.isDev) {
277
+ (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.addRequestMeta)(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());
278
+ }
279
+ let srcPage = "/api/v1/integrations/outlook/oauth/status/route";
280
+ // turbopack doesn't normalize `/index` in the page name
281
+ // so we need to to process dynamic routes properly
282
+ // TODO: fix turbopack providing differing value from webpack
283
+ if (false) {} else if (srcPage === '/index') {
284
+ // we always normalize /index specifically
285
+ srcPage = '/';
286
+ }
287
+ const multiZoneDraftMode = false;
288
+ const prepareResult = await routeModule.prepare(req, res, {
289
+ srcPage,
290
+ multiZoneDraftMode
291
+ });
292
+ if (!prepareResult) {
293
+ res.statusCode = 400;
294
+ res.end('Bad Request');
295
+ ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());
296
+ return null;
297
+ }
298
+ const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest, previewProps } = prepareResult;
299
+ const normalizedSrcPage = (0,next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__.normalizeAppPath)(srcPage);
300
+ // Only this route's prerenders can establish ISR or admit generated params.
301
+ 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]));
302
+ let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || isPrerendered);
303
+ const render404 = async ()=>{
304
+ // TODO: should route-module itself handle rendering the 404
305
+ if (routerServerContext == null ? void 0 : routerServerContext.render404) {
306
+ await routerServerContext.render404(req, res, parsedUrl, false);
307
+ } else {
308
+ res.end('This page could not be found');
320
309
  }
310
+ return null;
321
311
  };
322
- }
323
-
324
-
325
- /***/ }),
326
-
327
- /***/ 57075:
328
- /***/ ((module) => {
329
-
330
- module.exports = require("node:stream");
331
-
332
- /***/ }),
333
-
334
- /***/ 57975:
335
- /***/ ((module) => {
336
-
337
- module.exports = require("node:util");
338
-
339
- /***/ }),
340
-
341
- /***/ 63033:
342
- /***/ ((module) => {
343
-
344
- module.exports = require("next/dist/server/app-render/work-unit-async-storage.external.js");
345
-
346
- /***/ }),
347
-
348
- /***/ 73024:
349
- /***/ ((module) => {
350
-
351
- module.exports = require("node:fs");
352
-
353
- /***/ }),
354
-
355
- /***/ 75919:
356
- /***/ ((module) => {
357
-
358
- module.exports = require("node:worker_threads");
359
-
360
- /***/ }),
361
-
362
- /***/ 76760:
363
- /***/ ((module) => {
364
-
365
- module.exports = require("node:path");
366
-
367
- /***/ }),
368
-
369
- /***/ 77598:
370
- /***/ ((module) => {
371
-
372
- module.exports = require("node:crypto");
373
-
374
- /***/ }),
375
-
376
- /***/ 79428:
377
- /***/ ((module) => {
378
-
379
- module.exports = require("buffer");
380
-
381
- /***/ }),
312
+ if (isIsr && !isDraftMode) {
313
+ const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];
314
+ if (prerenderInfo) {
315
+ if (prerenderInfo.fallback === false && !isPrerendered) {
316
+ if (nextConfig.adapterPath) {
317
+ return await render404();
318
+ }
319
+ throw new next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError();
320
+ }
321
+ }
322
+ }
323
+ let cacheKey = null;
324
+ if (isIsr && !routeModule.isDev && !isDraftMode) {
325
+ cacheKey = resolvedPathname;
326
+ // ensure /index and / is normalized to one key
327
+ cacheKey = cacheKey === '/index' ? '/' : cacheKey;
328
+ }
329
+ // Before rendering (which initializes component tree modules), we have to
330
+ // set the reference manifests to our global store so Server Action's
331
+ // encryption util can access to them at the top level of the page module.
332
+ if (serverActionsManifest && clientReferenceManifest) {
333
+ (0,next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__.setManifestsSingleton)({
334
+ page: srcPage,
335
+ clientReferenceManifest,
336
+ serverActionsManifest
337
+ });
338
+ }
339
+ const method = req.method || 'GET';
340
+ const tracer = (0,next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.getTracer)();
341
+ const activeSpan = tracer.getActiveScopeSpan();
342
+ const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);
343
+ const isMinimalMode = Boolean((0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'minimalMode'));
344
+ const incrementalCache = (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, previewProps, prerenderManifest, isMinimalMode);
345
+ incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();
346
+ globalThis.__incrementalCache = incrementalCache;
347
+ const context = {
348
+ params,
349
+ previewProps,
350
+ renderOpts: {
351
+ experimental: {
352
+ authInterrupts: Boolean(nextConfig.experimental.authInterrupts),
353
+ useCacheTimeout: nextConfig.experimental.useCacheTimeout,
354
+ durableUseCacheEntries: Boolean(nextConfig.experimental.durableUseCacheEntries)
355
+ },
356
+ cacheComponents: Boolean(nextConfig.cacheComponents),
357
+ validationLevel: nextConfig.experimental.instantInsights.validationLevel,
358
+ isDraftMode,
359
+ incrementalCache,
360
+ hmrRefreshHash: (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'hmrRefreshHash'),
361
+ cacheLifeProfiles: nextConfig.cacheLife,
362
+ staticPageGenerationTimeout: nextConfig.staticPageGenerationTimeout,
363
+ waitUntil: ctx.waitUntil,
364
+ onClose: (cb)=>{
365
+ res.on('close', cb);
366
+ },
367
+ onAfterTaskError: undefined
368
+ },
369
+ sharedContext: {
370
+ buildId,
371
+ deploymentId
372
+ }
373
+ };
374
+ const nodeNextReq = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextRequest(req);
375
+ const nodeNextRes = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextResponse(res);
376
+ 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));
377
+ const responseGenerator = async ({ previousCacheEntry })=>{
378
+ try {
379
+ if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {
380
+ res.statusCode = 404;
381
+ // on-demand revalidate always sets this header
382
+ res.setHeader('x-nextjs-cache', 'REVALIDATED');
383
+ res.end('This page could not be found');
384
+ return null;
385
+ }
386
+ const response = cacheKey === null ? await routeModule.handle(nextReq, context) : await routeModule.prerender(nextReq, context);
387
+ req.fetchMetrics = context.renderOpts.fetchMetrics;
388
+ let pendingWaitUntil = context.renderOpts.pendingWaitUntil;
389
+ // Attempt using provided waitUntil if available
390
+ // if it's not we fallback to sendResponse's handling
391
+ if (pendingWaitUntil) {
392
+ if (ctx.waitUntil) {
393
+ ctx.waitUntil(pendingWaitUntil);
394
+ pendingWaitUntil = undefined;
395
+ }
396
+ }
397
+ const cacheTags = context.renderOpts.collectedTags;
398
+ // If the request is for a static response, we can cache it so long
399
+ // as it's not edge.
400
+ if (isIsr) {
401
+ const blob = await response.blob();
402
+ // Copy the headers from the response.
403
+ const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.toNodeOutgoingHttpHeaders)(response.headers);
404
+ if (cacheTags) {
405
+ headers[next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER] = cacheTags;
406
+ }
407
+ if (!headers['content-type'] && blob.type) {
408
+ headers['content-type'] = blob.type;
409
+ }
410
+ const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;
411
+ 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
412
+ // explicit `expire` (e.g. via `cacheLife`). This mirrors the
413
+ // build-time fallback in `build/index.ts` so cache entries
414
+ // and the response Cache-Control header agree on the route's
415
+ // effective expire. Routes that opt out of revalidation
416
+ // (`revalidate: false`) or that are dynamic (`revalidate: 0`)
417
+ // keep `expire: undefined`.
418
+ revalidate !== false && revalidate > 0 ? nextConfig.expireTime : undefined : context.renderOpts.collectedExpire;
419
+ // Create the cache entry for the response.
420
+ const cacheEntry = {
421
+ value: {
422
+ kind: next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__.CachedRouteKind.APP_ROUTE,
423
+ status: response.status,
424
+ body: Buffer.from(await blob.arrayBuffer()),
425
+ headers
426
+ },
427
+ cacheControl: {
428
+ revalidate,
429
+ expire
430
+ }
431
+ };
432
+ return cacheEntry;
433
+ } else {
434
+ // send response without caching if not ISR
435
+ await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, response, pendingWaitUntil);
436
+ return null;
437
+ }
438
+ } catch (err) {
439
+ // if this is a background revalidate we need to report
440
+ // the request error here as it won't be bubbled
441
+ if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {
442
+ const silenceLog = false;
443
+ await routeModule.onRequestError(req, err, {
444
+ routerKind: 'App Router',
445
+ routePath: srcPage,
446
+ routeType: 'route',
447
+ revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
448
+ isStaticGeneration: cacheKey !== null,
449
+ isOnDemandRevalidate
450
+ })
451
+ }, silenceLog, routerServerContext);
452
+ }
453
+ throw err;
454
+ }
455
+ };
456
+ const handleResponse = async (currentSpan, parentSpan)=>{
457
+ try {
458
+ var _cacheEntry_value;
459
+ const cacheEntry = await routeModule.handleResponse({
460
+ req,
461
+ nextConfig,
462
+ cacheKey,
463
+ routeKind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
464
+ isFallback: false,
465
+ previewProps,
466
+ prerenderManifest,
467
+ isRoutePPREnabled: false,
468
+ isOnDemandRevalidate,
469
+ revalidateOnlyGenerated,
470
+ responseGenerator,
471
+ waitUntil: ctx.waitUntil,
472
+ isMinimalMode
473
+ });
474
+ if (cacheEntry !== null && 'error' in cacheEntry) {
475
+ throw cacheEntry.error;
476
+ }
477
+ // we don't create a cacheEntry for ISR
478
+ if (!isIsr) {
479
+ return;
480
+ }
481
+ 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) {
482
+ var _cacheEntry_value1;
483
+ throw new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`);
484
+ }
485
+ if (!isMinimalMode) {
486
+ res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');
487
+ }
488
+ // Draft mode should never be cached
489
+ if (isDraftMode) {
490
+ res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');
491
+ }
492
+ const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers);
493
+ if (!(isMinimalMode && isIsr)) {
494
+ headers.delete(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER);
495
+ }
496
+ // If cache control is already set on the response we don't
497
+ // override it to allow users to customize it via next.config
498
+ if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {
499
+ headers.set('Cache-Control', (0,next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__.getCacheControlHeader)(cacheEntry.cacheControl));
500
+ }
501
+ 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'.
502
+ new Response(cacheEntry.value.body, {
503
+ headers,
504
+ status: cacheEntry.value.status || 200
505
+ }));
506
+ return;
507
+ } catch (err) {
508
+ if (!(err instanceof next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError)) {
509
+ const silenceLog = false;
510
+ await routeModule.onRequestError(req, err, {
511
+ routerKind: 'App Router',
512
+ routePath: normalizedSrcPage,
513
+ routeType: 'route',
514
+ revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
515
+ isStaticGeneration: cacheKey !== null,
516
+ isOnDemandRevalidate
517
+ })
518
+ }, silenceLog, routerServerContext);
519
+ }
520
+ // rethrow so that we can handle serving error page
521
+ // If this is during static generation, throw the error again.
522
+ if (isIsr) throw err;
523
+ // Otherwise, send a 500 response unless the original response has
524
+ // already committed. In that case, preserve its status code for
525
+ // telemetry while still recording the failure and terminating a response
526
+ // that the failed pipeline left open.
527
+ if (res.headersSent) {
528
+ if (currentSpan) {
529
+ const error = err instanceof Error ? err : new Error('Unknown app route error');
530
+ currentSpan.recordException(error);
531
+ currentSpan.setStatus({
532
+ code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR,
533
+ message: error.message
534
+ });
535
+ currentSpan.setAttribute('error.type', error.name);
536
+ }
537
+ if (!res.writableEnded && !res.destroyed) {
538
+ res.end();
539
+ }
540
+ } else {
541
+ await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, new Response(null, {
542
+ status: 500
543
+ }));
544
+ }
545
+ return;
546
+ } finally{
547
+ ;
548
+ (()=>{
549
+ if (!currentSpan) {
550
+ return;
551
+ }
552
+ let statusCode = res.statusCode;
553
+ currentSpan.setAttributes({
554
+ 'http.status_code': statusCode,
555
+ 'next.rsc': false
556
+ });
557
+ if (statusCode && statusCode >= 500) {
558
+ // For 5xx status codes: SHOULD be set to 'Error' span status.
559
+ // x-ref: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
560
+ currentSpan.setStatus({
561
+ code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR
562
+ });
563
+ // For span status 'Error', SHOULD set 'error.type' attribute.
564
+ currentSpan.setAttribute('error.type', statusCode.toString());
565
+ }
566
+ const rootSpanAttributes = tracer.getRootSpanAttributes();
567
+ // We were unable to get attributes, probably OTEL is not enabled
568
+ if (!rootSpanAttributes) {
569
+ return;
570
+ }
571
+ if (rootSpanAttributes.get('next.span_type') !== next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest) {
572
+ console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);
573
+ return;
574
+ }
575
+ const route = rootSpanAttributes.get('next.route') || normalizedSrcPage;
576
+ const name = `${method} ${route}`;
577
+ currentSpan.setAttributes({
578
+ 'next.route': route,
579
+ 'http.route': route,
580
+ 'next.span_name': name
581
+ });
582
+ currentSpan.updateName(name);
583
+ // Propagate http.route to the parent span if one exists (e.g.
584
+ // a platform-created HTTP span in adapter deployments).
585
+ if (parentSpan && parentSpan !== currentSpan) {
586
+ parentSpan.setAttribute('http.route', route);
587
+ parentSpan.updateName(name);
588
+ }
589
+ })();
590
+ }
591
+ };
592
+ // TODO: activeSpan code path is for when wrapped by
593
+ // next-server can be removed when this is no longer used
594
+ if (isWrappedByNextServer && activeSpan) {
595
+ await handleResponse(activeSpan, undefined);
596
+ } else {
597
+ let parentSpan = tracer.getActiveScopeSpan();
598
+ await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest, {
599
+ spanName: `${method} ${srcPage}`,
600
+ kind: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanKind.SERVER,
601
+ attributes: {
602
+ 'http.method': method,
603
+ 'http.target': req.url
604
+ }
605
+ }, (span)=>handleResponse(span, parentSpan)), undefined, !isWrappedByNextServer);
606
+ }
607
+ }
382
608
 
383
- /***/ 80099:
384
- /***/ ((module) => {
609
+ //# sourceMappingURL=app-route.js.map
385
610
 
386
- module.exports = require("node:sqlite");
387
611
 
388
612
  /***/ }),
389
613
 
390
- /***/ 80481:
614
+ /***/ 33873:
391
615
  /***/ ((module) => {
392
616
 
393
- module.exports = require("node:readline");
617
+ module.exports = require("path");
394
618
 
395
619
  /***/ }),
396
620
 
397
- /***/ 81630:
621
+ /***/ 37067:
398
622
  /***/ ((module) => {
399
623
 
400
- module.exports = require("http");
624
+ module.exports = require("node:http");
401
625
 
402
626
  /***/ }),
403
627
 
404
- /***/ 86439:
628
+ /***/ 38522:
405
629
  /***/ ((module) => {
406
630
 
407
- module.exports = require("next/dist/shared/lib/no-fallback-error.external");
631
+ module.exports = require("node:zlib");
408
632
 
409
633
  /***/ }),
410
634
 
411
- /***/ 89080:
412
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
635
+ /***/ 44708:
636
+ /***/ ((module) => {
413
637
 
414
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
415
- /* harmony export */ Ah: () => (/* binding */ updateFlow),
416
- /* harmony export */ Dd: () => (/* binding */ exchangeCode),
417
- /* harmony export */ F8: () => (/* binding */ createFlow),
418
- /* harmony export */ i8: () => (/* binding */ getMicrosoftAccessToken),
419
- /* harmony export */ jG: () => (/* binding */ resolveMicrosoftAuth),
420
- /* harmony export */ lv: () => (/* binding */ getFlow),
421
- /* harmony export */ op: () => (/* binding */ graphPaged),
422
- /* harmony export */ xj: () => (/* binding */ buildAuthorizeUrl),
423
- /* harmony export */ z$: () => (/* binding */ graphFetch)
424
- /* harmony export */ });
425
- /* unused harmony export MICROSOFT_SCOPES */
426
- /* harmony import */ var _lib_stores_integrations__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(78228);
427
- /* harmony import */ var _lib_utils_oauth_flow_store__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(56362);
428
- /* harmony import */ var _lib_utils_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(53638);
429
- /* harmony import */ var _lib_utils_error__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(22032);
430
- /* harmony import */ var _lib_utils_oauth_input__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(22632);
431
- // Ephemeral state store + shared auth helpers for the in-app Microsoft OAuth
432
- // flow. Mirrors lib/integrations/gmail-oauth.ts but targets the Microsoft
433
- // identity platform (v2.0 endpoint, common tenant by default) and Microsoft
434
- // Graph as the downstream API surface (Outlook Mail + Calendar in v1).
435
- //
436
- // The user types client_id + client_secret in the Integrations panel and
437
- // clicks "Connect Outlook". We POST those to /oauth/start, which stashes
438
- // them here keyed by a random `state` token and returns the Microsoft
439
- // authorize URL. The browser opens that URL; MS bounces back to
440
- // /oauth/callback with `?code&state`, which exchanges the code for a
441
- // refresh_token (granted because we asked for `offline_access`) and
442
- // persists the integration. The panel polls /oauth/status separately.
443
- //
444
- // Pinned to globalThis so HMR in dev doesn't lose pending flows.
638
+ module.exports = require("node:https");
445
639
 
640
+ /***/ }),
446
641
 
642
+ /***/ 44870:
643
+ /***/ ((module) => {
447
644
 
645
+ module.exports = require("next/dist/compiled/next-server/app-route.runtime.prod.js");
448
646
 
647
+ /***/ }),
449
648
 
450
- const flowStore = (0,_lib_utils_oauth_flow_store__WEBPACK_IMPORTED_MODULE_1__/* .createOAuthFlowStore */ .R)({
451
- globalKey: "__msOauthFlows"
452
- });
453
- const createFlow = flowStore.create;
454
- const getFlow = flowStore.get;
455
- const updateFlow = flowStore.update;
456
- // Tenant selector. `common` accepts both personal Microsoft accounts
457
- // (@outlook.com, @hotmail.com, @live.com) and work/school M365 accounts.
458
- // Switch to `consumers` to lock to personal only, or `organizations` for
459
- // work/school only. We expose this as an env override for power users but
460
- // don't surface it in the UI yet.
461
- const TENANT = process.env.OUTLOOK_TENANT?.trim() || "common";
462
- // Delegated Graph scopes the agent needs. Keep narrow:
463
- // - offline_access → required for a refresh_token (MS counterpart of
464
- // Google's access_type=offline).
465
- // - User.Read → used by the test endpoint to call /me.
466
- // - Mail.ReadWrite → search/read mail, create drafts, mark read,
467
- // move to folders (incl. DeletedItems).
468
- // - Mail.Send → send mail when the user explicitly asks for it.
469
- // - Calendars.ReadWrite → list/get/create/update/delete events on the
470
- // user's existing calendars.
471
- // - Tasks.ReadWrite → list/get/create/update/complete/delete Microsoft
472
- // To Do tasks and lists (ms_todo_* tools).
473
- // - People.Read → resolve "who is X" / frequent contacts via
474
- // /me/people (ms_people_resolve tool).
475
- const MICROSOFT_SCOPES = [
476
- "offline_access",
477
- "User.Read",
478
- "Mail.ReadWrite",
479
- "Mail.Send",
480
- "Calendars.ReadWrite",
481
- "Tasks.ReadWrite",
482
- "People.Read"
483
- ];
484
- function buildAuthorizeUrl(opts) {
485
- const p = new URLSearchParams({
486
- client_id: opts.clientId,
487
- redirect_uri: opts.redirectUri,
488
- response_type: "code",
489
- response_mode: "query",
490
- scope: MICROSOFT_SCOPES.join(" "),
491
- // Force consent so a returning user actually re-grants any newly-added
492
- // scope (otherwise MS silently reuses the prior grant minus the new bit).
493
- prompt: "consent",
494
- state: opts.state
495
- });
496
- return `https://login.microsoftonline.com/${TENANT}/oauth2/v2.0/authorize?${p.toString()}`;
497
- }
498
- // NOTE: Unlike Google, MS v2 endpoint **requires** the `scope` parameter on
499
- // every grant_type call (both authorization_code and refresh_token). Leaving
500
- // it out yields `AADSTS900144: The request body must contain the following
501
- // parameter: 'scope'.`. We always pass the full scope set.
502
- async function exchangeCode(opts) {
503
- const clientId = (0,_lib_utils_oauth_input__WEBPACK_IMPORTED_MODULE_2__/* .sanitizeOAuthInput */ .d)(opts.clientId) ?? "";
504
- const clientSecret = (0,_lib_utils_oauth_input__WEBPACK_IMPORTED_MODULE_2__/* .sanitizeOAuthInput */ .d)(opts.clientSecret) ?? "";
505
- const body = new URLSearchParams({
506
- code: opts.code,
507
- client_id: clientId,
508
- client_secret: clientSecret,
509
- redirect_uri: opts.redirectUri,
510
- grant_type: "authorization_code",
511
- scope: MICROSOFT_SCOPES.join(" ")
512
- });
513
- const res = await fetch(`https://login.microsoftonline.com/${TENANT}/oauth2/v2.0/token`, {
514
- method: "POST",
515
- headers: {
516
- "Content-Type": "application/x-www-form-urlencoded"
517
- },
518
- body: body.toString(),
519
- signal: AbortSignal.timeout(30000)
520
- });
521
- const text = await res.text();
522
- const parsed = (0,_lib_utils_json__WEBPACK_IMPORTED_MODULE_3__/* .parseJsonSafe */ .p)(text, {});
523
- if (!res.ok) {
524
- const err = parsed["error_description"] || parsed["error"] || text || `HTTP ${res.status}`;
525
- console.error(`[microsoft-oauth] token exchange rejected (${res.status}): ${err} | client_id ${(0,_lib_utils_oauth_input__WEBPACK_IMPORTED_MODULE_2__/* .secretFingerprint */ .n)(clientId)} | client_secret ${(0,_lib_utils_oauth_input__WEBPACK_IMPORTED_MODULE_2__/* .secretFingerprint */ .n)(clientSecret)}`);
526
- throw new Error(err);
527
- }
528
- return parsed;
529
- }
530
- function resolveMicrosoftAuth() {
531
- const envId = process.env.OUTLOOK_CLIENT_ID;
532
- const envSecret = process.env.OUTLOOK_CLIENT_SECRET;
533
- const envRefresh = process.env.OUTLOOK_REFRESH_TOKEN;
534
- if (envId && envSecret && envRefresh) {
535
- return {
536
- client_id: envId,
537
- client_secret: envSecret,
538
- refresh_token: envRefresh
539
- };
540
- }
541
- const saved = (0,_lib_stores_integrations__WEBPACK_IMPORTED_MODULE_0__/* .getIntegrationRaw */ .$G)("outlook");
542
- if (saved?.client_id && saved.client_secret && saved.refresh_token) {
543
- return {
544
- client_id: saved.client_id,
545
- client_secret: saved.client_secret,
546
- refresh_token: saved.refresh_token
547
- };
548
- }
549
- return {
550
- error: "Microsoft account not connected. Open the gear menu → Integrations tab → " + "Outlook card and click Connect Outlook to authorize Mail, Mail.Send, Calendar, Tasks, and People access."
551
- };
552
- }
553
- const accessTokenCache = new Map();
554
- function cacheKey(auth) {
555
- return auth.refresh_token.slice(0, 20);
556
- }
557
- // Force-evict a cached access token (e.g. after a 401). The next call to
558
- // getMicrosoftAccessToken will refresh against the v2 token endpoint.
559
- function bustAccessToken(auth) {
560
- accessTokenCache.delete(cacheKey(auth));
561
- }
562
- async function getMicrosoftAccessToken(auth) {
563
- const key = cacheKey(auth);
564
- const cached = accessTokenCache.get(key);
565
- if (cached && cached.expires_at > Date.now() + 60000) return cached.token;
566
- const body = new URLSearchParams({
567
- client_id: auth.client_id,
568
- client_secret: auth.client_secret,
569
- refresh_token: auth.refresh_token,
570
- grant_type: "refresh_token",
571
- // Required on the v2 endpoint even for refresh_token grants.
572
- scope: MICROSOFT_SCOPES.join(" ")
573
- });
574
- try {
575
- const res = await fetch(`https://login.microsoftonline.com/${TENANT}/oauth2/v2.0/token`, {
576
- method: "POST",
577
- headers: {
578
- "Content-Type": "application/x-www-form-urlencoded"
579
- },
580
- body: body.toString(),
581
- signal: AbortSignal.timeout(30000)
582
- });
583
- const text = await res.text();
584
- if (!res.ok) {
585
- accessTokenCache.delete(key);
586
- return {
587
- error: `Microsoft OAuth refresh failed (${res.status}): ${text.slice(0, 300)}`
588
- };
589
- }
590
- const parsed = JSON.parse(text);
591
- if (!parsed.access_token) return {
592
- error: "OAuth response missing access_token"
593
- };
594
- const expires_at = Date.now() + (parsed.expires_in ?? 3000) * 1000;
595
- accessTokenCache.set(key, {
596
- token: parsed.access_token,
597
- expires_at
598
- });
599
- return parsed.access_token;
600
- } catch (err) {
601
- return {
602
- error: `Microsoft OAuth refresh threw: ${(0,_lib_utils_error__WEBPACK_IMPORTED_MODULE_4__/* .errorMessage */ .g)(err)}`
603
- };
604
- }
605
- }
606
- // Path-prefix → required Graph scope. Used to render helpful 403 messages
607
- // pointing the user at the exact scope they need to reconnect with.
608
- const SCOPE_HINTS = [
609
- {
610
- prefix: "/me/messages",
611
- scope: "Mail.ReadWrite"
612
- },
613
- {
614
- prefix: "/me/mailFolders",
615
- scope: "Mail.ReadWrite"
616
- },
617
- {
618
- prefix: "/me/sendMail",
619
- scope: "Mail.Send"
620
- },
621
- {
622
- prefix: "/me/events",
623
- scope: "Calendars.ReadWrite"
624
- },
625
- {
626
- prefix: "/me/calendar",
627
- scope: "Calendars.ReadWrite"
628
- },
629
- {
630
- prefix: "/me/calendars",
631
- scope: "Calendars.ReadWrite"
632
- },
633
- {
634
- prefix: "/me/todo",
635
- scope: "Tasks.ReadWrite"
636
- },
637
- {
638
- prefix: "/me/people",
639
- scope: "People.Read"
640
- },
641
- {
642
- prefix: "/me/contacts",
643
- scope: "Contacts.Read"
644
- },
645
- {
646
- prefix: "/me/drive",
647
- scope: "Files.Read"
648
- },
649
- {
650
- prefix: "/me/insights",
651
- scope: "Sites.Read.All"
652
- },
653
- {
654
- prefix: "/search/query",
655
- scope: "Mail.Read Files.Read.All"
656
- },
657
- {
658
- prefix: "/me",
659
- scope: "User.Read"
660
- }
661
- ];
662
- function scopeHintFor(path) {
663
- const p = path.startsWith("http") ? new URL(path).pathname.replace(/^\/v1\.0/, "") : path;
664
- for (const { prefix, scope } of SCOPE_HINTS){
665
- if (p.startsWith(prefix)) return scope;
649
+ /***/ 48161:
650
+ /***/ ((module) => {
651
+
652
+ module.exports = require("node:os");
653
+
654
+ /***/ }),
655
+
656
+ /***/ 51455:
657
+ /***/ ((module) => {
658
+
659
+ module.exports = require("node:fs/promises");
660
+
661
+ /***/ }),
662
+
663
+ /***/ 53638:
664
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
665
+
666
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
667
+ /* harmony export */ p: () => (/* binding */ parseJsonSafe)
668
+ /* harmony export */ });
669
+ // JSON.parse with a fallback value when the input is malformed (or empty).
670
+ // Used everywhere we read responses from external APIs — they're contractually
671
+ // JSON but a transient 502 / proxy interstitial occasionally returns HTML.
672
+ function parseJsonSafe(text, fallback) {
673
+ try {
674
+ return JSON.parse(text);
675
+ } catch {
676
+ return fallback;
666
677
  }
667
- return null;
668
- }
669
- function parseRetryAfter(headerVal) {
670
- if (!headerVal) return 0;
671
- const secs = Number.parseInt(headerVal, 10);
672
- if (Number.isFinite(secs) && secs >= 0) return Math.min(secs, 30) * 1000;
673
- const ts = Date.parse(headerVal);
674
- if (!Number.isNaN(ts)) return Math.max(0, Math.min(ts - Date.now(), 30000));
675
- return 0;
676
- }
677
- function backoffFor(attempt) {
678
- return Math.min(500 * 2 ** attempt, 4000);
679
678
  }
680
- // Shared Graph fetch helper. Used by lib/tools/outlook.ts,
681
- // lib/tools/outlook-calendar.ts, lib/tools/ms-todo.ts, lib/tools/ms-graph.ts.
682
- // Returns parsed JSON or { error: string, url? }. 204 No Content returns
683
- // { ok: true }.
679
+
680
+
681
+ /***/ }),
682
+
683
+ /***/ 55511:
684
+ /***/ ((module) => {
685
+
686
+ module.exports = require("crypto");
687
+
688
+ /***/ }),
689
+
690
+ /***/ 55591:
691
+ /***/ ((module) => {
692
+
693
+ module.exports = require("https");
694
+
695
+ /***/ }),
696
+
697
+ /***/ 56362:
698
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
699
+
700
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
701
+ /* harmony export */ R: () => (/* binding */ createOAuthFlowStore)
702
+ /* harmony export */ });
703
+ /* harmony import */ var node_crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(77598);
704
+ /* harmony import */ var node_crypto__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(node_crypto__WEBPACK_IMPORTED_MODULE_0__);
705
+ /* harmony import */ var _lib_utils_global_state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15559);
706
+ // Ephemeral state store for in-app OAuth flows (Gmail, Microsoft, ...).
684
707
  //
685
- // Built-in resilience:
686
- // - 401 Unauthorized → drop the cached access token and retry once with a
687
- // freshly refreshed one (covers token-revoked-mid-cache edge cases).
688
- // - 429 / 503 → honour the `Retry-After` header (capped at 30s) or fall
689
- // back to exponential backoff. Retries up to 3 times.
690
- // - 403 Forbidden → surface a scope hint ("reconnect with X") so the
691
- // operator knows what to grant.
692
- async function graphFetch(auth, path, init) {
693
- const url = path.startsWith("http") ? path : `https://graph.microsoft.com/v1.0${path}`;
694
- let attempt = 0;
695
- let triedReauth = false;
696
- while(true){
697
- const token = await getMicrosoftAccessToken(auth);
698
- if (typeof token !== "string") return token;
699
- let res;
700
- try {
701
- res = await fetch(url, {
702
- ...init,
703
- headers: {
704
- Authorization: `Bearer ${token}`,
705
- Accept: "application/json",
706
- "Content-Type": "application/json",
707
- ...init?.headers ?? {}
708
- },
709
- signal: AbortSignal.timeout(30000)
710
- });
711
- } catch (err) {
712
- return {
713
- error: `Graph fetch threw: ${(0,_lib_utils_error__WEBPACK_IMPORTED_MODULE_4__/* .errorMessage */ .g)(err)}`,
714
- url
715
- };
716
- }
717
- if (res.status === 204) return {
718
- ok: true
719
- };
720
- if (res.status === 401 && !triedReauth) {
721
- triedReauth = true;
722
- bustAccessToken(auth);
723
- continue;
708
+ // Why this exists: the user types client_id + client_secret in the
709
+ // Integrations panel, we POST to /oauth/start, stash them here keyed by a
710
+ // random `state`, and return the provider's authorize URL. The browser
711
+ // bounces back to /oauth/callback with `?code&state`, we exchange, and
712
+ // persist the integration. Meanwhile the panel polls /oauth/status.
713
+ //
714
+ // Pinned to globalThis so HMR in dev doesn't lose pending flows.
715
+ //
716
+ // Same shape used by both gmail-oauth.ts and microsoft-oauth.ts — pass a
717
+ // unique `globalKey` per provider so they don't share a Map.
718
+
719
+
720
+ const DEFAULT_TTL_MS = 10 * 60 * 1000;
721
+ const DEFAULT_MAX_FLOWS = 32;
722
+ function createOAuthFlowStore(opts) {
723
+ const ttlMs = opts.ttlMs ?? DEFAULT_TTL_MS;
724
+ const maxFlows = opts.maxFlows ?? DEFAULT_MAX_FLOWS;
725
+ const flows = (0,_lib_utils_global_state__WEBPACK_IMPORTED_MODULE_1__/* .getOrCreateGlobal */ .X)(opts.globalKey, ()=>new Map());
726
+ function gc() {
727
+ const now = Date.now();
728
+ for (const [k, v] of flows){
729
+ if (now - v.createdAt > ttlMs) flows.delete(k);
724
730
  }
725
- if ((res.status === 429 || res.status === 503) && attempt < 3) {
726
- const waitMs = parseRetryAfter(res.headers.get("Retry-After")) ?? backoffFor(attempt);
727
- attempt += 1;
728
- await new Promise((r)=>setTimeout(r, waitMs));
729
- continue;
731
+ // Hard cap so a stuck UI can't grow this unbounded.
732
+ if (flows.size > maxFlows) {
733
+ const oldest = [
734
+ ...flows.entries()
735
+ ].sort((a, b)=>a[1].createdAt - b[1].createdAt);
736
+ for(let i = 0; i < oldest.length - maxFlows; i++)flows.delete(oldest[i][0]);
730
737
  }
731
- const text = await res.text();
732
- if (!res.ok) {
733
- let msg = `Graph ${res.status}: ${text.slice(0, 500)}`;
734
- if (res.status === 403) {
735
- const hint = scopeHintFor(path);
736
- if (hint) {
737
- msg += ` — reconnect the Microsoft integration with scope: ${hint}`;
738
- }
739
- }
738
+ }
739
+ return {
740
+ create (input) {
741
+ gc();
742
+ const state = (0,node_crypto__WEBPACK_IMPORTED_MODULE_0__.randomBytes)(16).toString("hex");
743
+ const flow = {
744
+ createdAt: Date.now(),
745
+ status: "pending",
746
+ ...input
747
+ };
748
+ flows.set(state, flow);
740
749
  return {
741
- error: msg,
742
- url
750
+ state,
751
+ flow
743
752
  };
753
+ },
754
+ get (state) {
755
+ gc();
756
+ return flows.get(state);
757
+ },
758
+ update (state, patch) {
759
+ const f = flows.get(state);
760
+ if (f) Object.assign(f, patch);
761
+ },
762
+ delete (state) {
763
+ flows.delete(state);
744
764
  }
745
- try {
746
- return JSON.parse(text);
747
- } catch {
748
- return text;
749
- }
750
- }
751
- }
752
- // Follow @odata.nextLink across pages and concatenate `value` arrays.
753
- // Stops at `maxPages` (default 5) to bound context cost. Returns the same
754
- // shape as graphFetch (object with `.value`) but with the merged array, or
755
- // the original error shape if any page errored.
756
- async function graphPaged(auth, path, opts) {
757
- const maxPages = opts?.maxPages ?? 5;
758
- let current = path;
759
- const merged = [];
760
- let pages = 0;
761
- while(current && pages < maxPages){
762
- const page = await graphFetch(auth, current, opts?.init);
763
- if (page && typeof page === "object" && "error" in page) return page;
764
- const body = page;
765
- if (Array.isArray(body.value)) merged.push(...body.value);
766
- current = typeof body["@odata.nextLink"] === "string" ? body["@odata.nextLink"] : null;
767
- pages += 1;
768
- }
769
- return {
770
- value: merged,
771
- pages
772
765
  };
773
766
  }
774
767
 
775
768
 
776
769
  /***/ }),
777
770
 
778
- /***/ 94735:
771
+ /***/ 57075:
779
772
  /***/ ((module) => {
780
773
 
781
- module.exports = require("events");
774
+ module.exports = require("node:stream");
775
+
776
+ /***/ }),
777
+
778
+ /***/ 57975:
779
+ /***/ ((module) => {
780
+
781
+ module.exports = require("node:util");
782
+
783
+ /***/ }),
784
+
785
+ /***/ 63033:
786
+ /***/ ((module) => {
787
+
788
+ module.exports = require("next/dist/server/app-render/work-unit-async-storage.external.js");
789
+
790
+ /***/ }),
791
+
792
+ /***/ 73024:
793
+ /***/ ((module) => {
794
+
795
+ module.exports = require("node:fs");
796
+
797
+ /***/ }),
798
+
799
+ /***/ 75919:
800
+ /***/ ((module) => {
801
+
802
+ module.exports = require("node:worker_threads");
803
+
804
+ /***/ }),
805
+
806
+ /***/ 76760:
807
+ /***/ ((module) => {
808
+
809
+ module.exports = require("node:path");
810
+
811
+ /***/ }),
812
+
813
+ /***/ 77598:
814
+ /***/ ((module) => {
815
+
816
+ module.exports = require("node:crypto");
817
+
818
+ /***/ }),
819
+
820
+ /***/ 79428:
821
+ /***/ ((module) => {
822
+
823
+ module.exports = require("buffer");
782
824
 
783
825
  /***/ }),
784
826
 
785
- /***/ 97937:
786
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
787
-
788
- __webpack_require__.r(__webpack_exports__);
789
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
790
- /* harmony export */ handler: () => (/* binding */ handler),
791
- /* harmony export */ patchFetch: () => (/* binding */ patchFetch),
792
- /* harmony export */ routeModule: () => (/* binding */ routeModule),
793
- /* harmony export */ serverHooks: () => (/* binding */ serverHooks),
794
- /* harmony export */ workAsyncStorage: () => (/* binding */ workAsyncStorage),
795
- /* harmony export */ workUnitAsyncStorage: () => (/* binding */ workUnitAsyncStorage)
796
- /* harmony export */ });
797
- /* harmony import */ var next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(19225);
798
- /* 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__);
799
- /* harmony import */ var next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84006);
800
- /* harmony import */ var next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8317);
801
- /* 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__);
802
- /* harmony import */ var next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(99373);
803
- /* 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__);
804
- /* harmony import */ var next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(34775);
805
- /* 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__);
806
- /* harmony import */ var next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(24235);
807
- /* 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__);
808
- /* harmony import */ var next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(261);
809
- /* 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__);
810
- /* harmony import */ var next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(54365);
811
- /* 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__);
812
- /* harmony import */ var next_dist_server_web_spec_extension_adapters_next_request__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(90771);
813
- /* 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__);
814
- /* harmony import */ var next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(73461);
815
- /* 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__);
816
- /* harmony import */ var next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(67798);
817
- /* harmony import */ var next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(92280);
818
- /* harmony import */ var next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(62018);
819
- /* 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__);
820
- /* harmony import */ var next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(45696);
821
- /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(47929);
822
- /* harmony import */ var next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__);
823
- /* harmony import */ var next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(86439);
824
- /* 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__);
825
- /* harmony import */ var next_dist_server_lib_route_cache_key__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(10246);
826
- /* 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__);
827
- /* harmony import */ var next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(37527);
828
- /* 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__);
827
+ /***/ 80099:
828
+ /***/ ((module) => {
829
829
 
830
+ module.exports = require("node:sqlite");
830
831
 
832
+ /***/ }),
831
833
 
834
+ /***/ 80481:
835
+ /***/ ((module) => {
832
836
 
837
+ module.exports = require("node:readline");
833
838
 
839
+ /***/ }),
834
840
 
841
+ /***/ 81630:
842
+ /***/ ((module) => {
835
843
 
844
+ module.exports = require("http");
836
845
 
846
+ /***/ }),
837
847
 
848
+ /***/ 86439:
849
+ /***/ ((module) => {
838
850
 
851
+ module.exports = require("next/dist/shared/lib/no-fallback-error.external");
839
852
 
853
+ /***/ }),
840
854
 
855
+ /***/ 89080:
856
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
841
857
 
858
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
859
+ /* harmony export */ Ah: () => (/* binding */ updateFlow),
860
+ /* harmony export */ Dd: () => (/* binding */ exchangeCode),
861
+ /* harmony export */ F8: () => (/* binding */ createFlow),
862
+ /* harmony export */ i8: () => (/* binding */ getMicrosoftAccessToken),
863
+ /* harmony export */ jG: () => (/* binding */ resolveMicrosoftAuth),
864
+ /* harmony export */ lv: () => (/* binding */ getFlow),
865
+ /* harmony export */ op: () => (/* binding */ graphPaged),
866
+ /* harmony export */ xj: () => (/* binding */ buildAuthorizeUrl),
867
+ /* harmony export */ z$: () => (/* binding */ graphFetch)
868
+ /* harmony export */ });
869
+ /* unused harmony export MICROSOFT_SCOPES */
870
+ /* harmony import */ var _lib_stores_integrations__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(78228);
871
+ /* harmony import */ var _lib_utils_oauth_flow_store__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(56362);
872
+ /* harmony import */ var _lib_utils_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(53638);
873
+ /* harmony import */ var _lib_utils_error__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(22032);
874
+ /* harmony import */ var _lib_utils_oauth_input__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(22632);
875
+ // Ephemeral state store + shared auth helpers for the in-app Microsoft OAuth
876
+ // flow. Mirrors lib/integrations/gmail-oauth.ts but targets the Microsoft
877
+ // identity platform (v2.0 endpoint, common tenant by default) and Microsoft
878
+ // Graph as the downstream API surface (Outlook Mail + Calendar in v1).
879
+ //
880
+ // The user types client_id + client_secret in the Integrations panel and
881
+ // clicks "Connect Outlook". We POST those to /oauth/start, which stashes
882
+ // them here keyed by a random `state` token and returns the Microsoft
883
+ // authorize URL. The browser opens that URL; MS bounces back to
884
+ // /oauth/callback with `?code&state`, which exchanges the code for a
885
+ // refresh_token (granted because we asked for `offline_access`) and
886
+ // persists the integration. The panel polls /oauth/status separately.
887
+ //
888
+ // Pinned to globalThis so HMR in dev doesn't lose pending flows.
842
889
 
843
890
 
844
891
 
845
892
 
846
893
 
847
- // We inject the nextConfigOutput here so that we can use them in the route
848
- // module.
849
- const nextConfigOutput = "standalone"
850
- const routeModule = new next_dist_server_route_modules_app_route_module_compiled__WEBPACK_IMPORTED_MODULE_0__.AppRouteRouteModule({
851
- definition: {
852
- kind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
853
- page: "/api/v1/integrations/outlook/oauth/status/route",
854
- pathname: "/api/v1/integrations/outlook/oauth/status",
855
- filename: "route",
856
- bundlePath: "app/api/v1/integrations/outlook/oauth/status/route"
857
- },
858
- distDir: ".next" || 0,
859
- relativeProjectDir: false || '',
860
- resolvedPagePath: "/home/runner/work/jarela/jarela/app/api/v1/integrations/outlook/oauth/status/route.ts",
861
- nextConfigOutput,
862
- // The lazy require factory ensures that:
863
- // - In dev: devRequestTimingInternalsEnd is set before userland executes,
864
- // correctly attributing module load time to application-code rather than
865
- // framework internals.
866
- // - In all modes: async modules (route files with top-level await) are
867
- // handled correctly — require() returns a Promise for such modules, which
868
- // ensureUserland() awaits before the first request is handled.
869
- userland: ()=>__webpack_require__(7161),
870
- // In Turbopack dev mode, also provide a synchronous per-request getter so
871
- // server HMR updates are picked up without re-executing the entry chunk.
872
- // Using require() (synchronous) avoids adding async overhead that would be
873
- // incorrectly attributed to application-code time in devRequestTiming.
874
- ... false ? 0 : {}
894
+ const flowStore = (0,_lib_utils_oauth_flow_store__WEBPACK_IMPORTED_MODULE_1__/* .createOAuthFlowStore */ .R)({
895
+ globalKey: "__msOauthFlows"
875
896
  });
876
- // Pull out the exports that we need to expose from the module. This should
877
- // be eliminated when we've moved the other routes to the new format. These
878
- // are used to hook into the route.
879
- const { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;
880
- function patchFetch() {
881
- return (0,next_dist_server_lib_patch_fetch__WEBPACK_IMPORTED_MODULE_2__.patchFetch)({
882
- workAsyncStorage,
883
- workUnitAsyncStorage
897
+ const createFlow = flowStore.create;
898
+ const getFlow = flowStore.get;
899
+ const updateFlow = flowStore.update;
900
+ // Tenant selector. `common` accepts both personal Microsoft accounts
901
+ // (@outlook.com, @hotmail.com, @live.com) and work/school M365 accounts.
902
+ // Switch to `consumers` to lock to personal only, or `organizations` for
903
+ // work/school only. We expose this as an env override for power users but
904
+ // don't surface it in the UI yet.
905
+ const TENANT = process.env.OUTLOOK_TENANT?.trim() || "common";
906
+ // Delegated Graph scopes the agent needs. Keep narrow:
907
+ // - offline_access → required for a refresh_token (MS counterpart of
908
+ // Google's access_type=offline).
909
+ // - User.Read → used by the test endpoint to call /me.
910
+ // - Mail.ReadWrite → search/read mail, create drafts, mark read,
911
+ // move to folders (incl. DeletedItems).
912
+ // - Mail.Send → send mail when the user explicitly asks for it.
913
+ // - Calendars.ReadWrite → list/get/create/update/delete events on the
914
+ // user's existing calendars.
915
+ // - Tasks.ReadWrite → list/get/create/update/complete/delete Microsoft
916
+ // To Do tasks and lists (ms_todo_* tools).
917
+ // - People.Read → resolve "who is X" / frequent contacts via
918
+ // /me/people (ms_people_resolve tool).
919
+ const MICROSOFT_SCOPES = [
920
+ "offline_access",
921
+ "User.Read",
922
+ "Mail.ReadWrite",
923
+ "Mail.Send",
924
+ "Calendars.ReadWrite",
925
+ "Tasks.ReadWrite",
926
+ "People.Read"
927
+ ];
928
+ function buildAuthorizeUrl(opts) {
929
+ const p = new URLSearchParams({
930
+ client_id: opts.clientId,
931
+ redirect_uri: opts.redirectUri,
932
+ response_type: "code",
933
+ response_mode: "query",
934
+ scope: MICROSOFT_SCOPES.join(" "),
935
+ // Force consent so a returning user actually re-grants any newly-added
936
+ // scope (otherwise MS silently reuses the prior grant minus the new bit).
937
+ prompt: "consent",
938
+ state: opts.state
884
939
  });
940
+ return `https://login.microsoftonline.com/${TENANT}/oauth2/v2.0/authorize?${p.toString()}`;
885
941
  }
886
-
887
- async function handler(req, res, ctx) {
888
- if (ctx.requestMeta) {
889
- (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.setRequestMeta)(req, ctx.requestMeta);
890
- }
891
- if (routeModule.isDev) {
892
- (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.addRequestMeta)(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());
893
- }
894
- let srcPage = "/api/v1/integrations/outlook/oauth/status/route";
895
- // turbopack doesn't normalize `/index` in the page name
896
- // so we need to to process dynamic routes properly
897
- // TODO: fix turbopack providing differing value from webpack
898
- if (false) {} else if (srcPage === '/index') {
899
- // we always normalize /index specifically
900
- srcPage = '/';
901
- }
902
- const multiZoneDraftMode = false;
903
- const prepareResult = await routeModule.prepare(req, res, {
904
- srcPage,
905
- multiZoneDraftMode
942
+ // NOTE: Unlike Google, MS v2 endpoint **requires** the `scope` parameter on
943
+ // every grant_type call (both authorization_code and refresh_token). Leaving
944
+ // it out yields `AADSTS900144: The request body must contain the following
945
+ // parameter: 'scope'.`. We always pass the full scope set.
946
+ async function exchangeCode(opts) {
947
+ const clientId = (0,_lib_utils_oauth_input__WEBPACK_IMPORTED_MODULE_2__/* .sanitizeOAuthInput */ .d)(opts.clientId) ?? "";
948
+ const clientSecret = (0,_lib_utils_oauth_input__WEBPACK_IMPORTED_MODULE_2__/* .sanitizeOAuthInput */ .d)(opts.clientSecret) ?? "";
949
+ const body = new URLSearchParams({
950
+ code: opts.code,
951
+ client_id: clientId,
952
+ client_secret: clientSecret,
953
+ redirect_uri: opts.redirectUri,
954
+ grant_type: "authorization_code",
955
+ scope: MICROSOFT_SCOPES.join(" ")
906
956
  });
907
- if (!prepareResult) {
908
- res.statusCode = 400;
909
- res.end('Bad Request');
910
- ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());
911
- return null;
912
- }
913
- const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest, previewProps } = prepareResult;
914
- const normalizedSrcPage = (0,next_dist_shared_lib_router_utils_app_paths__WEBPACK_IMPORTED_MODULE_6__.normalizeAppPath)(srcPage);
915
- // Only this route's prerenders can establish ISR or admit generated params.
916
- 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]));
917
- let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || isPrerendered);
918
- const render404 = async ()=>{
919
- // TODO: should route-module itself handle rendering the 404
920
- if (routerServerContext == null ? void 0 : routerServerContext.render404) {
921
- await routerServerContext.render404(req, res, parsedUrl, false);
922
- } else {
923
- res.end('This page could not be found');
924
- }
925
- return null;
926
- };
927
- if (isIsr && !isDraftMode) {
928
- const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];
929
- if (prerenderInfo) {
930
- if (prerenderInfo.fallback === false && !isPrerendered) {
931
- if (nextConfig.adapterPath) {
932
- return await render404();
933
- }
934
- throw new next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError();
935
- }
936
- }
937
- }
938
- let cacheKey = null;
939
- if (isIsr && !routeModule.isDev && !isDraftMode) {
940
- cacheKey = resolvedPathname;
941
- // ensure /index and / is normalized to one key
942
- cacheKey = cacheKey === '/index' ? '/' : cacheKey;
957
+ const res = await fetch(`https://login.microsoftonline.com/${TENANT}/oauth2/v2.0/token`, {
958
+ method: "POST",
959
+ headers: {
960
+ "Content-Type": "application/x-www-form-urlencoded"
961
+ },
962
+ body: body.toString(),
963
+ signal: AbortSignal.timeout(30000)
964
+ });
965
+ const text = await res.text();
966
+ const parsed = (0,_lib_utils_json__WEBPACK_IMPORTED_MODULE_3__/* .parseJsonSafe */ .p)(text, {});
967
+ if (!res.ok) {
968
+ const err = parsed["error_description"] || parsed["error"] || text || `HTTP ${res.status}`;
969
+ console.error(`[microsoft-oauth] token exchange rejected (${res.status}): ${err} | client_id ${(0,_lib_utils_oauth_input__WEBPACK_IMPORTED_MODULE_2__/* .secretFingerprint */ .n)(clientId)} | client_secret ${(0,_lib_utils_oauth_input__WEBPACK_IMPORTED_MODULE_2__/* .secretFingerprint */ .n)(clientSecret)}`);
970
+ throw new Error(err);
943
971
  }
944
- // Before rendering (which initializes component tree modules), we have to
945
- // set the reference manifests to our global store so Server Action's
946
- // encryption util can access to them at the top level of the page module.
947
- if (serverActionsManifest && clientReferenceManifest) {
948
- (0,next_dist_server_app_render_manifests_singleton__WEBPACK_IMPORTED_MODULE_5__.setManifestsSingleton)({
949
- page: srcPage,
950
- clientReferenceManifest,
951
- serverActionsManifest
952
- });
972
+ return parsed;
973
+ }
974
+ function resolveMicrosoftAuth() {
975
+ const envId = process.env.OUTLOOK_CLIENT_ID;
976
+ const envSecret = process.env.OUTLOOK_CLIENT_SECRET;
977
+ const envRefresh = process.env.OUTLOOK_REFRESH_TOKEN;
978
+ if (envId && envSecret && envRefresh) {
979
+ return {
980
+ client_id: envId,
981
+ client_secret: envSecret,
982
+ refresh_token: envRefresh
983
+ };
953
984
  }
954
- const method = req.method || 'GET';
955
- const tracer = (0,next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.getTracer)();
956
- const activeSpan = tracer.getActiveScopeSpan();
957
- const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);
958
- const isMinimalMode = Boolean((0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'minimalMode'));
959
- const incrementalCache = (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, previewProps, prerenderManifest, isMinimalMode);
960
- incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();
961
- globalThis.__incrementalCache = incrementalCache;
962
- const context = {
963
- params,
964
- previewProps,
965
- renderOpts: {
966
- experimental: {
967
- authInterrupts: Boolean(nextConfig.experimental.authInterrupts),
968
- useCacheTimeout: nextConfig.experimental.useCacheTimeout,
969
- durableUseCacheEntries: Boolean(nextConfig.experimental.durableUseCacheEntries)
970
- },
971
- cacheComponents: Boolean(nextConfig.cacheComponents),
972
- validationLevel: nextConfig.experimental.instantInsights.validationLevel,
973
- isDraftMode,
974
- incrementalCache,
975
- hmrRefreshHash: (0,next_dist_server_request_meta__WEBPACK_IMPORTED_MODULE_3__.getRequestMeta)(req, 'hmrRefreshHash'),
976
- cacheLifeProfiles: nextConfig.cacheLife,
977
- staticPageGenerationTimeout: nextConfig.staticPageGenerationTimeout,
978
- waitUntil: ctx.waitUntil,
979
- onClose: (cb)=>{
980
- res.on('close', cb);
981
- },
982
- onAfterTaskError: undefined
983
- },
984
- sharedContext: {
985
- buildId,
986
- deploymentId
987
- }
985
+ const saved = (0,_lib_stores_integrations__WEBPACK_IMPORTED_MODULE_0__/* .getIntegrationRaw */ .$G)("outlook");
986
+ if (saved?.client_id && saved.client_secret && saved.refresh_token) {
987
+ return {
988
+ client_id: saved.client_id,
989
+ client_secret: saved.client_secret,
990
+ refresh_token: saved.refresh_token
991
+ };
992
+ }
993
+ return {
994
+ error: "Microsoft account not connected. Open the gear menu → Integrations tab → " + "Outlook card and click Connect Outlook to authorize Mail, Mail.Send, Calendar, Tasks, and People access."
988
995
  };
989
- const nodeNextReq = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextRequest(req);
990
- const nodeNextRes = new next_dist_server_base_http_node__WEBPACK_IMPORTED_MODULE_7__.NodeNextResponse(res);
991
- 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));
992
- const responseGenerator = async ({ previousCacheEntry })=>{
993
- try {
994
- if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {
995
- res.statusCode = 404;
996
- // on-demand revalidate always sets this header
997
- res.setHeader('x-nextjs-cache', 'REVALIDATED');
998
- res.end('This page could not be found');
999
- return null;
1000
- }
1001
- const response = cacheKey === null ? await routeModule.handle(nextReq, context) : await routeModule.prerender(nextReq, context);
1002
- req.fetchMetrics = context.renderOpts.fetchMetrics;
1003
- let pendingWaitUntil = context.renderOpts.pendingWaitUntil;
1004
- // Attempt using provided waitUntil if available
1005
- // if it's not we fallback to sendResponse's handling
1006
- if (pendingWaitUntil) {
1007
- if (ctx.waitUntil) {
1008
- ctx.waitUntil(pendingWaitUntil);
1009
- pendingWaitUntil = undefined;
1010
- }
1011
- }
1012
- const cacheTags = context.renderOpts.collectedTags;
1013
- // If the request is for a static response, we can cache it so long
1014
- // as it's not edge.
1015
- if (isIsr) {
1016
- const blob = await response.blob();
1017
- // Copy the headers from the response.
1018
- const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.toNodeOutgoingHttpHeaders)(response.headers);
1019
- if (cacheTags) {
1020
- headers[next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER] = cacheTags;
1021
- }
1022
- if (!headers['content-type'] && blob.type) {
1023
- headers['content-type'] = blob.type;
1024
- }
1025
- const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;
1026
- 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
1027
- // explicit `expire` (e.g. via `cacheLife`). This mirrors the
1028
- // build-time fallback in `build/index.ts` so cache entries
1029
- // and the response Cache-Control header agree on the route's
1030
- // effective expire. Routes that opt out of revalidation
1031
- // (`revalidate: false`) or that are dynamic (`revalidate: 0`)
1032
- // keep `expire: undefined`.
1033
- revalidate !== false && revalidate > 0 ? nextConfig.expireTime : undefined : context.renderOpts.collectedExpire;
1034
- // Create the cache entry for the response.
1035
- const cacheEntry = {
1036
- value: {
1037
- kind: next_dist_server_response_cache__WEBPACK_IMPORTED_MODULE_17__.CachedRouteKind.APP_ROUTE,
1038
- status: response.status,
1039
- body: Buffer.from(await blob.arrayBuffer()),
1040
- headers
1041
- },
1042
- cacheControl: {
1043
- revalidate,
1044
- expire
1045
- }
1046
- };
1047
- return cacheEntry;
1048
- } else {
1049
- // send response without caching if not ISR
1050
- await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, response, pendingWaitUntil);
1051
- return null;
1052
- }
1053
- } catch (err) {
1054
- // if this is a background revalidate we need to report
1055
- // the request error here as it won't be bubbled
1056
- if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {
1057
- const silenceLog = false;
1058
- await routeModule.onRequestError(req, err, {
1059
- routerKind: 'App Router',
1060
- routePath: srcPage,
1061
- routeType: 'route',
1062
- revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
1063
- isStaticGeneration: cacheKey !== null,
1064
- isOnDemandRevalidate
1065
- })
1066
- }, silenceLog, routerServerContext);
1067
- }
1068
- throw err;
996
+ }
997
+ const accessTokenCache = new Map();
998
+ function cacheKey(auth) {
999
+ return auth.refresh_token.slice(0, 20);
1000
+ }
1001
+ // Force-evict a cached access token (e.g. after a 401). The next call to
1002
+ // getMicrosoftAccessToken will refresh against the v2 token endpoint.
1003
+ function bustAccessToken(auth) {
1004
+ accessTokenCache.delete(cacheKey(auth));
1005
+ }
1006
+ async function getMicrosoftAccessToken(auth) {
1007
+ const key = cacheKey(auth);
1008
+ const cached = accessTokenCache.get(key);
1009
+ if (cached && cached.expires_at > Date.now() + 60000) return cached.token;
1010
+ const body = new URLSearchParams({
1011
+ client_id: auth.client_id,
1012
+ client_secret: auth.client_secret,
1013
+ refresh_token: auth.refresh_token,
1014
+ grant_type: "refresh_token",
1015
+ // Required on the v2 endpoint even for refresh_token grants.
1016
+ scope: MICROSOFT_SCOPES.join(" ")
1017
+ });
1018
+ try {
1019
+ const res = await fetch(`https://login.microsoftonline.com/${TENANT}/oauth2/v2.0/token`, {
1020
+ method: "POST",
1021
+ headers: {
1022
+ "Content-Type": "application/x-www-form-urlencoded"
1023
+ },
1024
+ body: body.toString(),
1025
+ signal: AbortSignal.timeout(30000)
1026
+ });
1027
+ const text = await res.text();
1028
+ if (!res.ok) {
1029
+ accessTokenCache.delete(key);
1030
+ return {
1031
+ error: `Microsoft OAuth refresh failed (${res.status}): ${text.slice(0, 300)}`
1032
+ };
1069
1033
  }
1070
- };
1071
- const handleResponse = async (currentSpan, parentSpan)=>{
1034
+ const parsed = JSON.parse(text);
1035
+ if (!parsed.access_token) return {
1036
+ error: "OAuth response missing access_token"
1037
+ };
1038
+ const expires_at = Date.now() + (parsed.expires_in ?? 3000) * 1000;
1039
+ accessTokenCache.set(key, {
1040
+ token: parsed.access_token,
1041
+ expires_at
1042
+ });
1043
+ return parsed.access_token;
1044
+ } catch (err) {
1045
+ return {
1046
+ error: `Microsoft OAuth refresh threw: ${(0,_lib_utils_error__WEBPACK_IMPORTED_MODULE_4__/* .errorMessage */ .g)(err)}`
1047
+ };
1048
+ }
1049
+ }
1050
+ // Path-prefix → required Graph scope. Used to render helpful 403 messages
1051
+ // pointing the user at the exact scope they need to reconnect with.
1052
+ const SCOPE_HINTS = [
1053
+ {
1054
+ prefix: "/me/messages",
1055
+ scope: "Mail.ReadWrite"
1056
+ },
1057
+ {
1058
+ prefix: "/me/mailFolders",
1059
+ scope: "Mail.ReadWrite"
1060
+ },
1061
+ {
1062
+ prefix: "/me/sendMail",
1063
+ scope: "Mail.Send"
1064
+ },
1065
+ {
1066
+ prefix: "/me/events",
1067
+ scope: "Calendars.ReadWrite"
1068
+ },
1069
+ {
1070
+ prefix: "/me/calendar",
1071
+ scope: "Calendars.ReadWrite"
1072
+ },
1073
+ {
1074
+ prefix: "/me/calendars",
1075
+ scope: "Calendars.ReadWrite"
1076
+ },
1077
+ {
1078
+ prefix: "/me/todo",
1079
+ scope: "Tasks.ReadWrite"
1080
+ },
1081
+ {
1082
+ prefix: "/me/people",
1083
+ scope: "People.Read"
1084
+ },
1085
+ {
1086
+ prefix: "/me/contacts",
1087
+ scope: "Contacts.Read"
1088
+ },
1089
+ {
1090
+ prefix: "/me/drive",
1091
+ scope: "Files.Read"
1092
+ },
1093
+ {
1094
+ prefix: "/me/insights",
1095
+ scope: "Sites.Read.All"
1096
+ },
1097
+ {
1098
+ prefix: "/search/query",
1099
+ scope: "Mail.Read Files.Read.All"
1100
+ },
1101
+ {
1102
+ prefix: "/me",
1103
+ scope: "User.Read"
1104
+ }
1105
+ ];
1106
+ function scopeHintFor(path) {
1107
+ const p = path.startsWith("http") ? new URL(path).pathname.replace(/^\/v1\.0/, "") : path;
1108
+ for (const { prefix, scope } of SCOPE_HINTS){
1109
+ if (p.startsWith(prefix)) return scope;
1110
+ }
1111
+ return null;
1112
+ }
1113
+ function parseRetryAfter(headerVal) {
1114
+ if (!headerVal) return 0;
1115
+ const secs = Number.parseInt(headerVal, 10);
1116
+ if (Number.isFinite(secs) && secs >= 0) return Math.min(secs, 30) * 1000;
1117
+ const ts = Date.parse(headerVal);
1118
+ if (!Number.isNaN(ts)) return Math.max(0, Math.min(ts - Date.now(), 30000));
1119
+ return 0;
1120
+ }
1121
+ function backoffFor(attempt) {
1122
+ return Math.min(500 * 2 ** attempt, 4000);
1123
+ }
1124
+ // Shared Graph fetch helper. Used by lib/tools/outlook.ts,
1125
+ // lib/tools/outlook-calendar.ts, lib/tools/ms-todo.ts, lib/tools/ms-graph.ts.
1126
+ // Returns parsed JSON or { error: string, url? }. 204 No Content returns
1127
+ // { ok: true }.
1128
+ //
1129
+ // Built-in resilience:
1130
+ // - 401 Unauthorized → drop the cached access token and retry once with a
1131
+ // freshly refreshed one (covers token-revoked-mid-cache edge cases).
1132
+ // - 429 / 503 → honour the `Retry-After` header (capped at 30s) or fall
1133
+ // back to exponential backoff. Retries up to 3 times.
1134
+ // - 403 Forbidden → surface a scope hint ("reconnect with X") so the
1135
+ // operator knows what to grant.
1136
+ async function graphFetch(auth, path, init) {
1137
+ const url = path.startsWith("http") ? path : `https://graph.microsoft.com/v1.0${path}`;
1138
+ let attempt = 0;
1139
+ let triedReauth = false;
1140
+ while(true){
1141
+ const token = await getMicrosoftAccessToken(auth);
1142
+ if (typeof token !== "string") return token;
1143
+ let res;
1072
1144
  try {
1073
- var _cacheEntry_value;
1074
- const cacheEntry = await routeModule.handleResponse({
1075
- req,
1076
- nextConfig,
1077
- cacheKey,
1078
- routeKind: next_dist_server_route_kind__WEBPACK_IMPORTED_MODULE_1__.RouteKind.APP_ROUTE,
1079
- isFallback: false,
1080
- previewProps,
1081
- prerenderManifest,
1082
- isRoutePPREnabled: false,
1083
- isOnDemandRevalidate,
1084
- revalidateOnlyGenerated,
1085
- responseGenerator,
1086
- waitUntil: ctx.waitUntil,
1087
- isMinimalMode
1145
+ res = await fetch(url, {
1146
+ ...init,
1147
+ headers: {
1148
+ Authorization: `Bearer ${token}`,
1149
+ Accept: "application/json",
1150
+ "Content-Type": "application/json",
1151
+ ...init?.headers ?? {}
1152
+ },
1153
+ signal: AbortSignal.timeout(30000)
1088
1154
  });
1089
- if (cacheEntry !== null && 'error' in cacheEntry) {
1090
- throw cacheEntry.error;
1091
- }
1092
- // we don't create a cacheEntry for ISR
1093
- if (!isIsr) {
1094
- return;
1095
- }
1096
- 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) {
1097
- var _cacheEntry_value1;
1098
- throw new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`);
1099
- }
1100
- if (!isMinimalMode) {
1101
- res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');
1102
- }
1103
- // Draft mode should never be cached
1104
- if (isDraftMode) {
1105
- res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');
1106
- }
1107
- const headers = (0,next_dist_server_web_utils__WEBPACK_IMPORTED_MODULE_12__.fromNodeOutgoingHttpHeaders)(cacheEntry.value.headers);
1108
- if (!(isMinimalMode && isIsr)) {
1109
- headers.delete(next_dist_lib_constants__WEBPACK_IMPORTED_MODULE_14__.NEXT_CACHE_TAGS_HEADER);
1110
- }
1111
- // If cache control is already set on the response we don't
1112
- // override it to allow users to customize it via next.config
1113
- if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {
1114
- headers.set('Cache-Control', (0,next_dist_server_lib_cache_control__WEBPACK_IMPORTED_MODULE_13__.getCacheControlHeader)(cacheEntry.cacheControl));
1115
- }
1116
- 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'.
1117
- new Response(cacheEntry.value.body, {
1118
- headers,
1119
- status: cacheEntry.value.status || 200
1120
- }));
1121
- return;
1122
1155
  } catch (err) {
1123
- if (!(err instanceof next_dist_shared_lib_no_fallback_error_external__WEBPACK_IMPORTED_MODULE_15__.NoFallbackError)) {
1124
- const silenceLog = false;
1125
- await routeModule.onRequestError(req, err, {
1126
- routerKind: 'App Router',
1127
- routePath: normalizedSrcPage,
1128
- routeType: 'route',
1129
- revalidateReason: (0,next_dist_server_instrumentation_utils__WEBPACK_IMPORTED_MODULE_10__.getRevalidateReason)({
1130
- isStaticGeneration: cacheKey !== null,
1131
- isOnDemandRevalidate
1132
- })
1133
- }, silenceLog, routerServerContext);
1134
- }
1135
- // rethrow so that we can handle serving error page
1136
- // If this is during static generation, throw the error again.
1137
- if (isIsr) throw err;
1138
- // Otherwise, send a 500 response unless the original response has
1139
- // already committed. In that case, preserve its status code for
1140
- // telemetry while still recording the failure and terminating a response
1141
- // that the failed pipeline left open.
1142
- if (res.headersSent) {
1143
- if (currentSpan) {
1144
- const error = err instanceof Error ? err : new Error('Unknown app route error');
1145
- currentSpan.recordException(error);
1146
- currentSpan.setStatus({
1147
- code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR,
1148
- message: error.message
1149
- });
1150
- currentSpan.setAttribute('error.type', error.name);
1151
- }
1152
- if (!res.writableEnded && !res.destroyed) {
1153
- res.end();
1156
+ return {
1157
+ error: `Graph fetch threw: ${(0,_lib_utils_error__WEBPACK_IMPORTED_MODULE_4__/* .errorMessage */ .g)(err)}`,
1158
+ url
1159
+ };
1160
+ }
1161
+ if (res.status === 204) return {
1162
+ ok: true
1163
+ };
1164
+ if (res.status === 401 && !triedReauth) {
1165
+ triedReauth = true;
1166
+ bustAccessToken(auth);
1167
+ continue;
1168
+ }
1169
+ if ((res.status === 429 || res.status === 503) && attempt < 3) {
1170
+ const waitMs = parseRetryAfter(res.headers.get("Retry-After")) ?? backoffFor(attempt);
1171
+ attempt += 1;
1172
+ await new Promise((r)=>setTimeout(r, waitMs));
1173
+ continue;
1174
+ }
1175
+ const text = await res.text();
1176
+ if (!res.ok) {
1177
+ let msg = `Graph ${res.status}: ${text.slice(0, 500)}`;
1178
+ if (res.status === 403) {
1179
+ const hint = scopeHintFor(path);
1180
+ if (hint) {
1181
+ msg += ` — reconnect the Microsoft integration with scope: ${hint}`;
1154
1182
  }
1155
- } else {
1156
- await (0,next_dist_server_send_response__WEBPACK_IMPORTED_MODULE_11__/* .sendResponse */ .I)(nodeNextReq, nodeNextRes, new Response(null, {
1157
- status: 500
1158
- }));
1159
1183
  }
1160
- return;
1161
- } finally{
1162
- ;
1163
- (()=>{
1164
- if (!currentSpan) {
1165
- return;
1166
- }
1167
- let statusCode = res.statusCode;
1168
- currentSpan.setAttributes({
1169
- 'http.status_code': statusCode,
1170
- 'next.rsc': false
1171
- });
1172
- if (statusCode && statusCode >= 500) {
1173
- // For 5xx status codes: SHOULD be set to 'Error' span status.
1174
- // x-ref: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
1175
- currentSpan.setStatus({
1176
- code: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanStatusCode.ERROR
1177
- });
1178
- // For span status 'Error', SHOULD set 'error.type' attribute.
1179
- currentSpan.setAttribute('error.type', statusCode.toString());
1180
- }
1181
- const rootSpanAttributes = tracer.getRootSpanAttributes();
1182
- // We were unable to get attributes, probably OTEL is not enabled
1183
- if (!rootSpanAttributes) {
1184
- return;
1185
- }
1186
- if (rootSpanAttributes.get('next.span_type') !== next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest) {
1187
- console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);
1188
- return;
1189
- }
1190
- const route = rootSpanAttributes.get('next.route') || normalizedSrcPage;
1191
- const name = `${method} ${route}`;
1192
- currentSpan.setAttributes({
1193
- 'next.route': route,
1194
- 'http.route': route,
1195
- 'next.span_name': name
1196
- });
1197
- currentSpan.updateName(name);
1198
- // Propagate http.route to the parent span if one exists (e.g.
1199
- // a platform-created HTTP span in adapter deployments).
1200
- if (parentSpan && parentSpan !== currentSpan) {
1201
- parentSpan.setAttribute('http.route', route);
1202
- parentSpan.updateName(name);
1203
- }
1204
- })();
1184
+ return {
1185
+ error: msg,
1186
+ url
1187
+ };
1205
1188
  }
1206
- };
1207
- // TODO: activeSpan code path is for when wrapped by
1208
- // next-server can be removed when this is no longer used
1209
- if (isWrappedByNextServer && activeSpan) {
1210
- await handleResponse(activeSpan, undefined);
1211
- } else {
1212
- let parentSpan = tracer.getActiveScopeSpan();
1213
- await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(next_dist_server_lib_trace_constants__WEBPACK_IMPORTED_MODULE_9__.BaseServerSpan.handleRequest, {
1214
- spanName: `${method} ${srcPage}`,
1215
- kind: next_dist_server_lib_trace_tracer__WEBPACK_IMPORTED_MODULE_4__.SpanKind.SERVER,
1216
- attributes: {
1217
- 'http.method': method,
1218
- 'http.target': req.url
1219
- }
1220
- }, (span)=>handleResponse(span, parentSpan)), undefined, !isWrappedByNextServer);
1189
+ try {
1190
+ return JSON.parse(text);
1191
+ } catch {
1192
+ return text;
1193
+ }
1194
+ }
1195
+ }
1196
+ // Follow @odata.nextLink across pages and concatenate `value` arrays.
1197
+ // Stops at `maxPages` (default 5) to bound context cost. Returns the same
1198
+ // shape as graphFetch (object with `.value`) but with the merged array, or
1199
+ // the original error shape if any page errored.
1200
+ async function graphPaged(auth, path, opts) {
1201
+ const maxPages = opts?.maxPages ?? 5;
1202
+ let current = path;
1203
+ const merged = [];
1204
+ let pages = 0;
1205
+ while(current && pages < maxPages){
1206
+ const page = await graphFetch(auth, current, opts?.init);
1207
+ if (page && typeof page === "object" && "error" in page) return page;
1208
+ const body = page;
1209
+ if (Array.isArray(body.value)) merged.push(...body.value);
1210
+ current = typeof body["@odata.nextLink"] === "string" ? body["@odata.nextLink"] : null;
1211
+ pages += 1;
1221
1212
  }
1213
+ return {
1214
+ value: merged,
1215
+ pages
1216
+ };
1222
1217
  }
1223
1218
 
1224
- //# sourceMappingURL=app-route.js.map
1225
1219
 
1220
+ /***/ }),
1221
+
1222
+ /***/ 94735:
1223
+ /***/ ((module) => {
1224
+
1225
+ module.exports = require("events");
1226
1226
 
1227
1227
  /***/ }),
1228
1228
 
@@ -1240,7 +1240,7 @@ module.exports = import("@huggingface/transformers");;
1240
1240
  var __webpack_require__ = require("../../../../../../../webpack-runtime.js");
1241
1241
  __webpack_require__.C(exports);
1242
1242
  var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
1243
- var __webpack_exports__ = __webpack_require__.X(0, [2970,7377,1813,7981,4992,46], () => (__webpack_exec__(97937)));
1243
+ var __webpack_exports__ = __webpack_require__.X(0, [2970,7377,1813,7981,4992,46], () => (__webpack_exec__(32587)));
1244
1244
  module.exports = __webpack_exports__;
1245
1245
 
1246
1246
  })();