failproofai 1.0.11-beta.0 → 1.0.11-beta.2

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 (975) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +109 -9
  3. package/.next/standalone/.next/prerender-manifest.json +6 -6
  4. package/.next/standalone/.next/required-server-files.json +17 -2
  5. package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +8 -6
  6. package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +2 -3
  7. package/.next/standalone/.next/server/app/_global-error/page.js +13 -8
  8. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  9. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.rsc +17 -13
  12. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +19 -15
  13. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +17 -13
  14. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +2 -1
  15. package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +8 -6
  16. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +2 -3
  17. package/.next/standalone/.next/server/app/_not-found/page.js +17 -12
  18. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  19. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  20. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  21. package/.next/standalone/.next/server/app/_not-found.rsc +32 -21
  22. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +32 -21
  23. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +37 -27
  24. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +4 -2
  25. package/.next/standalone/.next/server/app/api/audit/invite/route.js +11 -7
  26. package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/api/audit/run/route.js +38 -11
  28. package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/api/audit/status/route.js +6 -4
  30. package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/api/auth/login-request/route.js +10 -6
  32. package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
  33. package/.next/standalone/.next/server/app/api/auth/login-verify/route.js +11 -7
  34. package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/api/auth/logout/route.js +11 -6
  36. package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
  37. package/.next/standalone/.next/server/app/api/auth/status/route.js +11 -6
  38. package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
  39. package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js +6 -4
  40. package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/audit/page/build-manifest.json +8 -6
  42. package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +4 -6
  43. package/.next/standalone/.next/server/app/audit/page.js +26 -19
  44. package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
  45. package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  46. package/.next/standalone/.next/server/app/index.html +1 -1
  47. package/.next/standalone/.next/server/app/index.rsc +30 -20
  48. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +34 -25
  49. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +30 -20
  50. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +3 -2
  51. package/.next/standalone/.next/server/app/page/build-manifest.json +8 -6
  52. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +2 -3
  53. package/.next/standalone/.next/server/app/page.js +20 -14
  54. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  55. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  56. package/.next/standalone/.next/server/app/policies/page/build-manifest.json +8 -6
  57. package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +28 -42
  58. package/.next/standalone/.next/server/app/policies/page.js +30 -21
  59. package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
  60. package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
  61. package/.next/standalone/.next/server/app/project/[name]/page/build-manifest.json +8 -6
  62. package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +2 -3
  63. package/.next/standalone/.next/server/app/project/[name]/page.js +44 -20
  64. package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
  65. package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
  66. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +8 -6
  67. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
  68. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +4 -6
  69. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js +39 -23
  70. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
  71. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
  72. package/.next/standalone/.next/server/app/projects/page/build-manifest.json +8 -6
  73. package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +2 -3
  74. package/.next/standalone/.next/server/app/projects/page.js +24 -16
  75. package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
  76. package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  77. package/.next/standalone/.next/server/app/settings/page/build-manifest.json +8 -6
  78. package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +16 -24
  79. package/.next/standalone/.next/server/app/settings/page.js +30 -22
  80. package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
  81. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  82. package/.next/standalone/.next/server/chunks/1oeh_server_app_api_download_[project]_[session]_route_actions_1is7vs762er-g.js +3 -0
  83. package/.next/standalone/.next/server/chunks/[externals]__08d8xc5bifn8z._.js +3 -0
  84. package/.next/standalone/.next/server/chunks/{[externals]__0h0p9dm._.js → [externals]__0h0p9dmv_e7r7._.js} +1 -1
  85. package/.next/standalone/.next/server/chunks/{[externals]__0hjaw70._.js → [externals]__0hjaw70fchx66._.js} +1 -1
  86. package/.next/standalone/.next/server/chunks/{[externals]__1oenfmn._.js → [externals]__0qkp92tjfvw8r._.js} +1 -1
  87. package/.next/standalone/.next/server/chunks/[externals]__105ihae9i2b_d._.js +3 -0
  88. package/.next/standalone/.next/server/chunks/{[externals]__0sds_16._.js → [externals]__1_407huhlmj1m._.js} +1 -1
  89. package/.next/standalone/.next/server/chunks/[externals]__1k8s9m68ew993._.js +3 -0
  90. package/.next/standalone/.next/server/chunks/{[externals]__0d7i9ea._.js → [externals]__1rlxpymm37wel._.js} +1 -1
  91. package/.next/standalone/.next/server/chunks/{[externals]__1s462yl._.js → [externals]__1s462ylxpc7-5._.js} +1 -1
  92. package/.next/standalone/.next/server/chunks/[externals]_node_net_1yam_zj43-40b._.js +3 -0
  93. package/.next/standalone/.next/server/chunks/{[externals]_node_os_0by37l-._.js → [externals]_node_os_0by37l-11q5ls._.js} +1 -1
  94. package/.next/standalone/.next/server/chunks/[root-of-the-server]__07l68zv0hqdiu._.js +3 -0
  95. package/.next/standalone/.next/server/chunks/[root-of-the-server]__08dchfudh2_4f._.js +3 -0
  96. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_0xu5zkw15bs._.js +3 -0
  97. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0car70pylmvor._.js +3 -0
  98. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0jz5xqu-p_lfc._.js +3 -0
  99. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0spt0kv8azrpl._.js +3 -0
  100. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0swiyzbmvja2d._.js +327 -0
  101. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0u3i025_setk_._.js +3 -0
  102. package/.next/standalone/.next/server/chunks/[root-of-the-server]__10a2f6s636yc7._.js +3 -0
  103. package/.next/standalone/.next/server/chunks/[root-of-the-server]__168oo8wb5n23f._.js +3 -0
  104. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1ey11fel2q2qw._.js +3 -0
  105. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1izwqj_ij_9x_._.js +3 -0
  106. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1qt5u58xrcuk6._.js +3 -0
  107. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1r7kbfkiw2xmu._.js +322 -0
  108. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1ztigqa01tigq._.js +3 -0
  109. package/.next/standalone/.next/server/chunks/[turbopack]_runtime.js +146 -16
  110. package/.next/standalone/.next/server/chunks/_09dz7xva4ce_2._.js +27 -0
  111. package/.next/standalone/.next/server/chunks/_0hf5q4xzyg40j._.js +3 -0
  112. package/.next/standalone/.next/server/chunks/_0p53ge1jmkucy._.js +3 -0
  113. package/.next/standalone/.next/server/chunks/_0tovk6q0miud6._.js +3 -0
  114. package/.next/standalone/.next/server/chunks/_0trp3ycqv17cl._.js +3 -0
  115. package/.next/standalone/.next/server/chunks/_1-2owkp-1_987._.js +3 -0
  116. package/.next/standalone/.next/server/chunks/_13ltj8a9z92o8._.js +3 -0
  117. package/.next/standalone/.next/server/chunks/_15k37au70vjvg._.js +3 -0
  118. package/.next/standalone/.next/server/chunks/_18rfu4__wjhwb._.js +3 -0
  119. package/.next/standalone/.next/server/chunks/_19011-u44143j._.js +3 -0
  120. package/.next/standalone/.next/server/chunks/_1ek68lnh2daur._.js +33 -0
  121. package/.next/standalone/.next/server/chunks/_1fz8m31sndkcu._.js +3 -0
  122. package/.next/standalone/.next/server/chunks/_1ixl-kxq_ctsa._.js +3 -0
  123. package/.next/standalone/.next/server/chunks/_1ogwigfb0163w._.js +3 -0
  124. package/.next/standalone/.next/server/chunks/_1vslkoe35wok6._.js +3 -0
  125. package/.next/standalone/.next/server/chunks/{_next-internal_server_app_api_audit_invite_route_actions_0-2n5sy.js → _next-internal_server_app_api_audit_invite_route_actions_0-2n5sycrn1ab.js} +1 -1
  126. package/.next/standalone/.next/server/chunks/{_next-internal_server_app_api_audit_run_route_actions_1qgp9io.js → _next-internal_server_app_api_audit_run_route_actions_1qgp9iombfpdn.js} +1 -1
  127. package/.next/standalone/.next/server/chunks/{_next-internal_server_app_api_audit_status_route_actions_1f7pjof.js → _next-internal_server_app_api_audit_status_route_actions_1f7pjofwh4n7b.js} +1 -1
  128. package/.next/standalone/.next/server/chunks/{_next-internal_server_app_api_auth_login-request_route_actions_1c49co0.js → _next-internal_server_app_api_auth_login-request_route_actions_1c49co0x3-dl8.js} +1 -1
  129. package/.next/standalone/.next/server/chunks/{_next-internal_server_app_api_auth_login-verify_route_actions_1r3slzk.js → _next-internal_server_app_api_auth_login-verify_route_actions_1r3slzk0v320p.js} +1 -1
  130. package/.next/standalone/.next/server/chunks/{_next-internal_server_app_api_auth_logout_route_actions_0regwyr.js → _next-internal_server_app_api_auth_logout_route_actions_0regwyrnie28t.js} +1 -1
  131. package/.next/standalone/.next/server/chunks/{_next-internal_server_app_api_auth_status_route_actions_1aho9zu.js → _next-internal_server_app_api_auth_status_route_actions_1aho9zu4gx9_5.js} +1 -1
  132. package/.next/standalone/.next/server/chunks/lib_11qmqmccehybz._.js +3 -0
  133. package/.next/standalone/.next/server/chunks/lib_1sezqnatvr8j-._.js +3 -0
  134. package/.next/standalone/.next/server/chunks/lib_antigravity-projects_ts_0hdx6fkrln72c._.js +3 -0
  135. package/.next/standalone/.next/server/chunks/lib_antigravity-sessions_ts_0jayregp7h3h5._.js +3 -0
  136. package/.next/standalone/.next/server/chunks/lib_auth_api-server-client_ts_1r1w6kn8-org8._.js +3 -0
  137. package/.next/standalone/.next/server/chunks/lib_auth_auth-store_ts_03o40zz0emkkg._.js +3 -0
  138. package/.next/standalone/.next/server/chunks/lib_codex-projects_ts_0di6zenec7h7n._.js +3 -0
  139. package/.next/standalone/.next/server/chunks/lib_codex-sessions_ts_17znrhpys8lz9._.js +3 -0
  140. package/.next/standalone/.next/server/chunks/lib_copilot-projects_ts_00-tojoja20ke._.js +3 -0
  141. package/.next/standalone/.next/server/chunks/lib_copilot-sessions_ts_200_qjwcll3_i._.js +3 -0
  142. package/.next/standalone/.next/server/chunks/lib_cursor-projects_ts_1carno5mv3ix_._.js +3 -0
  143. package/.next/standalone/.next/server/chunks/lib_cursor-sessions_ts_1lq8fkhczl3_y._.js +3 -0
  144. package/.next/standalone/.next/server/chunks/lib_devin-sessions_ts_0kirblxnhsnmd._.js +3 -0
  145. package/.next/standalone/.next/server/chunks/lib_factory-projects_ts_1eo_bk-vm4wdz._.js +3 -0
  146. package/.next/standalone/.next/server/chunks/lib_factory-sessions_ts_0lwe8buimuthh._.js +3 -0
  147. package/.next/standalone/.next/server/chunks/lib_goose-sessions_ts_15jnf4alr5isl._.js +3 -0
  148. package/.next/standalone/.next/server/chunks/lib_hermes-profiles_ts_0jki1620x7wxh._.js +3 -0
  149. package/.next/standalone/.next/server/chunks/lib_hermes-projects_ts_0h9ny-woruqft._.js +3 -0
  150. package/.next/standalone/.next/server/chunks/lib_hermes-sessions_ts_1bo14h38efuti._.js +3 -0
  151. package/.next/standalone/.next/server/chunks/lib_log-entries_ts_0e1mnh5npsol1._.js +3 -0
  152. package/.next/standalone/.next/server/chunks/{lib_logger_ts_07e65t5._.js → lib_logger_ts_07e65t5sy13vi._.js} +1 -1
  153. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0faqz9x._.js → lib_openclaw-db_ts_0nax8ld9h9ii8._.js} +5 -5
  154. package/.next/standalone/.next/server/chunks/lib_openclaw-projects_ts_0gc-p24z7gzy8._.js +3 -0
  155. package/.next/standalone/.next/server/chunks/lib_openclaw-sessions_ts_06lc8rgfj4huq._.js +3 -0
  156. package/.next/standalone/.next/server/chunks/lib_opencode-projects_ts_1r-bu98cz4660._.js +3 -0
  157. package/.next/standalone/.next/server/chunks/lib_opencode-sessions_ts_0fdxj6q_np7ll._.js +3 -0
  158. package/.next/standalone/.next/server/chunks/lib_pi-projects_ts_1_cy5lfxd21kv._.js +3 -0
  159. package/.next/standalone/.next/server/chunks/lib_pi-sessions_ts_09ha0x-gi38y1._.js +3 -0
  160. package/.next/standalone/.next/server/chunks/lib_projects_ts_01v279z8xccq4._.js +3 -0
  161. package/.next/standalone/.next/server/chunks/lib_telemetry-id_ts_1k8gj9ot530oy._.js +3 -0
  162. package/.next/standalone/.next/server/chunks/lib_telemetry_ts_0dctyyw_s81oo._.js +3 -0
  163. package/.next/standalone/.next/server/chunks/lib_telemetry_ts_1cx7iwiprqsm6._.js +3 -0
  164. package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_01r25oigsgz07._.js +4 -0
  165. package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_077n_4ip5__fu._.js +3 -0
  166. package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_09z9-p77cu37y._.js +4 -0
  167. package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_0mqvvxcn6v0op._.js +3 -0
  168. package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_0pb7ds5g0vzgn._.js +3 -0
  169. package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_1gasm5xkeqmm3._.js +3 -0
  170. package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_1q1heqmkhh8l4._.js +3 -0
  171. package/.next/standalone/.next/server/chunks/{package_json_[json]_cjs_1nxcc4v._.js → package_json_[json]_cjs_1nxcc4vkpxxu7._.js} +2 -2
  172. package/.next/standalone/.next/server/chunks/src_hooks_1aveq0uhs2t1b._.js +5 -0
  173. package/.next/standalone/.next/server/chunks/src_hooks_1eem5a7cyqlb2._.js +3 -0
  174. package/.next/standalone/.next/server/chunks/src_hooks_custom-hooks-loader_ts_0lnb3n3h94wnn._.js +12 -0
  175. package/.next/standalone/.next/server/chunks/src_hooks_daemon-client_ts_0il_yu1zc0291._.js +3 -0
  176. package/.next/standalone/.next/server/chunks/src_hooks_fp-config_ts_0ow57t1myy6o_._.js +3 -0
  177. package/.next/standalone/.next/server/chunks/src_hooks_fp-home_ts_09kv0bn_4twyh._.js +3 -0
  178. package/.next/standalone/.next/server/chunks/ssr/{[externals]__0ilfh9m._.js → [externals]__0ilfh9mfnzsth._.js} +1 -1
  179. package/.next/standalone/.next/server/chunks/ssr/{[externals]__0ohnuzs._.js → [externals]__0ohnuzsaozaca._.js} +1 -1
  180. package/.next/standalone/.next/server/chunks/ssr/{[externals]__0vmspq5._.js → [externals]__12qr51qgrrt6o._.js} +2 -2
  181. package/.next/standalone/.next/server/chunks/ssr/[externals]_fs_promises_03norioyty3bq._.js +3 -0
  182. package/.next/standalone/.next/server/chunks/ssr/[externals]_node_net_1yam_zj43-40b._.js +3 -0
  183. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__075uro8t92s0_._.js +14 -0
  184. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0888k4s6spfmh._.js +3 -0
  185. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__08ch3staq3ejw._.js +3 -0
  186. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__08t6vt57mg_42._.js +3 -0
  187. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0_bflu046ep5j._.js +3 -0
  188. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0bigvy9xmv2ka._.js +3 -0
  189. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0fdwgktjfhedo._.js +3 -0
  190. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h1jw32uvrhh0._.js +3 -0
  191. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h86bl2qf0k_o._.js +3 -0
  192. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0hvw4ifjuhdn7._.js +3 -0
  193. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0pia5h3p8re4c._.js +3 -0
  194. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0s4deza787asx._.js +3 -0
  195. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0vcyntk4snf0f._.js +3 -0
  196. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1-9s1nsw-5q8o._.js +3 -0
  197. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1-ey9fgesfbc0._.js +3 -0
  198. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11ujqychsg_3_._.js +3 -0
  199. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__123o89o2a1ht0._.js +3 -0
  200. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__13whohpm024qr._.js +3 -0
  201. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__15bi9em2xe0x2._.js +3 -0
  202. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__15usvs-ms-0hf._.js +3 -0
  203. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__16gb3_92zvk5x._.js +3 -0
  204. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__18qe-hu0gwqm4._.js +3 -0
  205. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1_p_9xe520fex._.js +3 -0
  206. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1_xbg2kx30wp-._.js +3 -0
  207. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1avi2kypusyb_._.js +3 -0
  208. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1czstykkitjd8._.js +3 -0
  209. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1fmhm8_s9i4re._.js +3 -0
  210. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1g76awtnmimd1._.js +3 -0
  211. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1l1qgu5mfapkh._.js +3 -0
  212. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ob2uzmms1adf._.js +3 -0
  213. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1pczevlpk5lxh._.js +3 -0
  214. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1r7drlqli-ado._.js +3 -0
  215. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1vxwetblyf8vp._.js +3 -0
  216. package/.next/standalone/.next/server/chunks/ssr/[turbopack]_runtime.js +146 -16
  217. package/.next/standalone/.next/server/chunks/ssr/_0-f9uotv7v2n9._.js +3 -0
  218. package/.next/standalone/.next/server/chunks/ssr/_00e4_rvim31u_._.js +3 -0
  219. package/.next/standalone/.next/server/chunks/ssr/_00qm74p9x8cwt._.js +3 -0
  220. package/.next/standalone/.next/server/chunks/ssr/_0bseae9u7g98r._.js +3 -0
  221. package/.next/standalone/.next/server/chunks/ssr/_0eoura3_9gjb-._.js +25 -0
  222. package/.next/standalone/.next/server/chunks/ssr/_0kqw2_f1ywmpo._.js +3 -0
  223. package/.next/standalone/.next/server/chunks/ssr/_0mouhaflye1ro._.js +3 -0
  224. package/.next/standalone/.next/server/chunks/ssr/_0pedwblqdoh58._.js +3 -0
  225. package/.next/standalone/.next/server/chunks/ssr/_0tfqha481f033._.js +4 -0
  226. package/.next/standalone/.next/server/chunks/ssr/_1_ozgifqv1ssi._.js +3 -0
  227. package/.next/standalone/.next/server/chunks/ssr/_1a516zcgtqius._.js +3 -0
  228. package/.next/standalone/.next/server/chunks/ssr/_1ddpc5gj57uuf._.js +3 -0
  229. package/.next/standalone/.next/server/chunks/ssr/_1djqs9i27e4kg._.js +3 -0
  230. package/.next/standalone/.next/server/chunks/ssr/_1ew6ra24vt-ij._.js +3 -0
  231. package/.next/standalone/.next/server/chunks/ssr/_1gb0ifpkowwub._.js +234 -0
  232. package/.next/standalone/.next/server/chunks/ssr/_1or8gixmrpv5i._.js +3 -0
  233. package/.next/standalone/.next/server/chunks/ssr/_1s8zk-upxzp00._.js +3 -0
  234. package/.next/standalone/.next/server/chunks/ssr/_1u9tpla2o6utw._.js +3 -0
  235. package/.next/standalone/.next/server/chunks/ssr/_1v4_ul3sj2lq_._.js +3 -0
  236. package/.next/standalone/.next/server/chunks/ssr/_1y3xzro8ca8t6._.js +3 -0
  237. package/.next/standalone/.next/server/chunks/ssr/_20hn4gn87nsjc._.js +3 -0
  238. package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_policies_page_actions_1sp2-yo5_vm5f.js +17 -0
  239. package/.next/standalone/.next/server/chunks/ssr/app_087bt9wus25zs._.js +3 -0
  240. package/.next/standalone/.next/server/chunks/ssr/app_0trz6ik19xz5_._.js +3 -0
  241. package/.next/standalone/.next/server/chunks/ssr/app_1fvisnppn1unv._.js +3 -0
  242. package/.next/standalone/.next/server/chunks/ssr/app_209u41o446my6._.js +3 -0
  243. package/.next/standalone/.next/server/chunks/ssr/app_actions_get-scheduled-audit_ts_0ei9snixb5fd-._.js +3 -0
  244. package/.next/standalone/.next/server/chunks/ssr/app_audit_0hku_y73ischw._.js +3 -0
  245. package/.next/standalone/.next/server/chunks/ssr/{app_audit__components_audit-dashboard_tsx_0p9ud47._.js → app_audit__components_audit-dashboard_tsx_0p9ud47q0xq5w._.js} +3 -3
  246. package/.next/standalone/.next/server/chunks/ssr/{app_audit_loading_tsx_1j1kc6j._.js → app_audit_loading_tsx_1j1kc6j4v4-rl._.js} +1 -1
  247. package/.next/standalone/.next/server/chunks/ssr/app_components_project-list_tsx_1ke6anr0vt64h._.js +3 -0
  248. package/.next/standalone/.next/server/chunks/ssr/app_components_sessions-list_tsx_0gysftd_pn1m8._.js +3 -0
  249. package/.next/standalone/.next/server/chunks/ssr/app_error_tsx_15zfp7nrwf_b6._.js +3 -0
  250. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_0w002m_ccu8zg._.js +3 -0
  251. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x33jqb6._.js +3 -0
  252. package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpcz0uxur._.js +8 -0
  253. package/.next/standalone/.next/server/chunks/ssr/app_project_[name]_error_tsx_08qg6ncy93-17._.js +3 -0
  254. package/.next/standalone/.next/server/chunks/ssr/{app_project_[name]_loading_tsx_05-l4uf._.js → app_project_[name]_loading_tsx_05-l4uf5vgzpv._.js} +1 -1
  255. package/.next/standalone/.next/server/chunks/ssr/app_project_[name]_session_[sessionId]_error_tsx_0rf4j1nefwesi._.js +3 -0
  256. package/.next/standalone/.next/server/chunks/ssr/{app_project_[name]_session_[sessionId]_loading_tsx_0l4aixs._.js → app_project_[name]_session_[sessionId]_loading_tsx_0l4aixs89x_2g._.js} +1 -1
  257. package/.next/standalone/.next/server/chunks/ssr/{app_projects_loading_tsx_20-3u8b._.js → app_projects_loading_tsx_20-3u8bb2wqz2._.js} +1 -1
  258. package/.next/standalone/.next/server/chunks/ssr/app_settings_02tf1h47jmhhd._.js +3 -0
  259. package/.next/standalone/.next/server/chunks/ssr/lib_16jvhmthj_k3a._.js +3 -0
  260. package/.next/standalone/.next/server/chunks/ssr/lib_antigravity-projects_ts_0_6zf11xjo990._.js +3 -0
  261. package/.next/standalone/.next/server/chunks/ssr/lib_antigravity-sessions_ts_1xf7so6xrlevb._.js +3 -0
  262. package/.next/standalone/.next/server/chunks/ssr/lib_codex-projects_ts_0pqlw37q6qrb-._.js +3 -0
  263. package/.next/standalone/.next/server/chunks/ssr/lib_copilot-projects_ts_19wl7tpiv2zyg._.js +3 -0
  264. package/.next/standalone/.next/server/chunks/ssr/lib_cursor-projects_ts_18-iwyks4twze._.js +3 -0
  265. package/.next/standalone/.next/server/chunks/ssr/lib_devin-projects_ts_0a64qdyjacs0k._.js +3 -0
  266. package/.next/standalone/.next/server/chunks/ssr/lib_devin-sessions_ts_02u5rpzqjmxdw._.js +3 -0
  267. package/.next/standalone/.next/server/chunks/ssr/lib_factory-projects_ts_1uyaahq_zte1q._.js +3 -0
  268. package/.next/standalone/.next/server/chunks/ssr/lib_factory-sessions_ts_1tx9qelwapqun._.js +3 -0
  269. package/.next/standalone/.next/server/chunks/ssr/lib_format-duration_ts_09vnd_qdginp7._.js +3 -0
  270. package/.next/standalone/.next/server/chunks/ssr/lib_goose-projects_ts_0zkscrisyu15q._.js +3 -0
  271. package/.next/standalone/.next/server/chunks/ssr/lib_goose-sessions_ts_0-aebo0qkd1z9._.js +3 -0
  272. package/.next/standalone/.next/server/chunks/ssr/lib_hermes-profiles_ts_01q9fd6hz34il._.js +3 -0
  273. package/.next/standalone/.next/server/chunks/ssr/lib_hermes-projects_ts_05b8-itvkrig2._.js +3 -0
  274. package/.next/standalone/.next/server/chunks/ssr/lib_hermes-sessions_ts_076dzms3cnx9r._.js +3 -0
  275. package/.next/standalone/.next/server/chunks/ssr/lib_log-entries_ts_0vp7lm0yx4iba._.js +3 -0
  276. package/.next/standalone/.next/server/chunks/ssr/lib_openclaw-projects_ts_0qxq3bp7gsa2t._.js +3 -0
  277. package/.next/standalone/.next/server/chunks/ssr/lib_openclaw-sessions_ts_1f78qf2fle0uv._.js +22 -0
  278. package/.next/standalone/.next/server/chunks/ssr/lib_opencode-db_ts_18dv-h5ry0uo9._.js +3 -0
  279. package/.next/standalone/.next/server/chunks/ssr/lib_opencode-projects_ts_15bjxkmp2wls4._.js +3 -0
  280. package/.next/standalone/.next/server/chunks/ssr/lib_pi-projects_ts_1wikofbccx6w1._.js +3 -0
  281. package/.next/standalone/.next/server/chunks/ssr/lib_projects_ts_0f-jqrg5ftipx._.js +3 -0
  282. package/.next/standalone/.next/server/chunks/ssr/{lib_utils_ts_0az0sfq._.js → lib_utils_ts_0az0sfq5wo-3f._.js} +2 -2
  283. package/.next/standalone/.next/server/chunks/ssr/node_modules_05vgn62--7c5e._.js +3 -0
  284. package/.next/standalone/.next/server/chunks/ssr/node_modules_09s4n108bqreq._.js +3 -0
  285. package/.next/standalone/.next/server/chunks/ssr/node_modules_0dad4au22rq0p._.js +3 -0
  286. package/.next/standalone/.next/server/chunks/ssr/node_modules_0gxlxpuufujz9._.js +33 -0
  287. package/.next/standalone/.next/server/chunks/ssr/node_modules_html-to-image_es_index_15q9vt1a-slcq.js +3 -0
  288. package/.next/standalone/.next/server/chunks/ssr/{node_modules_html-to-image_es_index_1ao30b1.js → node_modules_html-to-image_es_index_1ao30b1e-jmzy.js} +2 -2
  289. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_0zuikgt2xho-v._.js +271 -0
  290. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_0janj0i6dqko7._.js +6 -0
  291. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_158jo-9mwvgad._.js +291 -0
  292. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_19r82zsxo2jj1._.js +291 -0
  293. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_1dupwucoqt5qm._.js +3 -0
  294. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_1et9oq9q9-y3v._.js +3 -0
  295. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_client_components_0wpq8j32_ibz4._.js +3 -0
  296. package/.next/standalone/.next/server/chunks/ssr/{node_modules_next_dist_client_components_builtin_forbidden_0symwr9.js → node_modules_next_dist_client_components_builtin_forbidden_0symwr9mbf-fh.js} +1 -1
  297. package/.next/standalone/.next/server/chunks/ssr/{node_modules_next_dist_client_components_builtin_unauthorized_0l_sp0x.js → node_modules_next_dist_client_components_builtin_unauthorized_0l_sp0xky89qu.js} +1 -1
  298. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_compiled_@edge-runtime_cookies_index_1kiz_an963mbg.js +3 -0
  299. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0-uvagv_giw2o.js +3 -0
  300. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_03c7gi5rntgf9.js +3 -0
  301. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_09p-8omsyjg4b.js +3 -0
  302. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0dwo94s84hht0.js +3 -0
  303. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0v-kfiu0qiy63.js +3 -0
  304. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0xrgzyzq__1k6.js +3 -0
  305. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_1806lsc28_bd0.js +3 -0
  306. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_1j6dd-erq474h.js +3 -0
  307. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_1sa65r-crehoe.js +3 -0
  308. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_shared_lib_03w27x2kh17_8._.js +23 -0
  309. package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_0dagmbznysrc2._.js +3 -0
  310. package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_11bnuznb72p7z._.js +4 -0
  311. package/.next/standalone/.next/server/chunks/ssr/package_json_[json]_cjs_013tntikdft59._.js +3 -0
  312. package/.next/standalone/.next/server/chunks/ssr/src_audit_dashboard-cache_ts_1-v0y_pr_b4vx._.js +3 -0
  313. package/.next/standalone/.next/server/chunks/ssr/src_hooks_0-q0ummbuhlg5._.js +3 -0
  314. package/.next/standalone/.next/server/chunks/ssr/src_hooks_06kzv9ddabn3_._.js +12 -0
  315. package/.next/standalone/.next/server/chunks/ssr/src_hooks_0g194syq7r7ql._.js +3 -0
  316. package/.next/standalone/.next/server/chunks/ssr/src_hooks_1cv9_c4l1tzrm._.js +12 -0
  317. package/.next/standalone/.next/server/chunks/ssr/src_hooks_1kx9e0dx_1-8o._.js +3 -0
  318. package/.next/standalone/.next/server/chunks/ssr/src_hooks_daemon-client_ts_0k41_i7jg6ndv._.js +3 -0
  319. package/.next/standalone/.next/server/chunks/ssr/src_hooks_daemon-service_ts_0ibufora3s_bw._.js +3 -0
  320. package/.next/standalone/.next/server/chunks/ssr/src_hooks_effective-reviewers_ts_1h4wtvo55j16x._.js +5 -0
  321. package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-config_ts_04t589gp4p60j._.js +4 -0
  322. package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-home_ts_0je3xkv_2e7f7._.js +3 -0
  323. package/.next/standalone/.next/server/chunks/ssr/src_hooks_hook-activity-store_ts_178ewqzp9cvrg._.js +3 -0
  324. package/.next/standalone/.next/server/chunks/ssr/src_hooks_pack-cli_ts_0t7me658zqmh_._.js +3 -0
  325. package/.next/standalone/.next/server/chunks/ssr/src_hooks_semantic_pack-policies_ts_0gh_bu_3oswax._.js +3 -0
  326. package/.next/standalone/.next/server/instrumentation.js +1 -1
  327. package/.next/standalone/.next/server/middleware-build-manifest.js +109 -9
  328. package/.next/standalone/.next/server/middleware.js +2 -2
  329. package/.next/standalone/.next/server/pages/404.html +1 -1
  330. package/.next/standalone/.next/server/pages/500.html +1 -1
  331. package/.next/standalone/.next/server/preview-props.json +5 -0
  332. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  333. package/.next/standalone/.next/server/server-reference-manifest.json +54 -85
  334. package/.next/standalone/.next/static/chunks/08fodmjweitv-.js +6 -0
  335. package/.next/standalone/.next/static/chunks/0dr6b-sp478i9.js +1 -0
  336. package/.next/standalone/.next/static/chunks/0m-tv1y6ghhtk.js +1 -0
  337. package/.next/standalone/.next/static/chunks/0qeojb9uu_8_e.js +1 -0
  338. package/.next/standalone/.next/static/chunks/0zw6_ase89dfk.js +1 -0
  339. package/.next/standalone/.next/static/chunks/1024g0jaymm46.js +1 -0
  340. package/.next/standalone/.next/static/chunks/165ezyyx0j1ft.js +22 -0
  341. package/.next/standalone/.next/static/chunks/{1mylcr99gccyz.js → 1v1mi4-0ziecn.js} +2 -2
  342. package/.next/standalone/.next/static/chunks/{3_e_wg5_oay87.css → 26c4gmdpsthv6.css} +1 -1
  343. package/.next/standalone/.next/static/chunks/276ifklxc2-x4.js +1 -0
  344. package/.next/standalone/.next/static/chunks/281u-2vtn53n5.js +1 -0
  345. package/.next/standalone/.next/static/chunks/2_sj5ssr_m_wm.js +1 -0
  346. package/.next/standalone/.next/static/chunks/2cn0x2d6tyiuq.js +31 -0
  347. package/.next/standalone/.next/static/chunks/{34jpdb2xjm-x7.js → 2j5zpvs3pd7mw.js} +1 -1
  348. package/.next/standalone/.next/static/chunks/2l7j1dpmejuqn.js +1 -0
  349. package/.next/standalone/.next/static/chunks/2ojf3r8g4tn7s.js +1 -0
  350. package/.next/standalone/.next/static/chunks/2zyrjasvbmwpq.js +1 -0
  351. package/.next/standalone/.next/static/chunks/31fan-ze541d1.js +1 -0
  352. package/.next/standalone/.next/static/chunks/32s3y34p0t2pe.js +1 -0
  353. package/.next/standalone/.next/static/chunks/36re0fegaocq-.js +1 -0
  354. package/.next/standalone/.next/static/chunks/3fhk60ouw_ae6.js +1 -0
  355. package/.next/standalone/.next/static/chunks/3oin924a_3ohe.js +1 -0
  356. package/.next/standalone/.next/static/chunks/{3zkg2s2vzxc3d.js → 3vpfbqzaue6_i.js} +1 -1
  357. package/.next/standalone/.next/static/chunks/3xhybr6ywsmdf.js +1 -0
  358. package/.next/standalone/.next/static/chunks/turbopack-3-ry682tkyiqk.js +1 -0
  359. package/.next/standalone/fp-cloud-cli/uv.lock +6 -6
  360. package/.next/standalone/hermes-plugin/plugin.yaml +1 -1
  361. package/.next/standalone/node_modules/@next/env/package.json +1 -1
  362. package/.next/standalone/node_modules/next/dist/build/define-env.js +12 -18
  363. package/.next/standalone/node_modules/next/dist/build/next-config-ts/transpile-config.js +1 -5
  364. package/.next/standalone/node_modules/next/dist/build/nft.js +119 -0
  365. package/.next/standalone/node_modules/next/dist/build/segment-config/app/app-segment-config.js +19 -5
  366. package/.next/standalone/node_modules/next/dist/build/segment-config/app/app-segments.js +120 -29
  367. package/.next/standalone/node_modules/next/dist/build/segment-config/app/collect-root-param-keys.js +1 -5
  368. package/.next/standalone/node_modules/next/dist/build/static-paths/app/extract-pathname-route-param-segments-from-loader-tree.js +8 -2
  369. package/.next/standalone/node_modules/next/dist/build/static-paths/app.js +230 -133
  370. package/.next/standalone/node_modules/next/dist/build/static-paths/pages.js +8 -40
  371. package/.next/standalone/node_modules/next/dist/build/static-paths/param-matching.js +200 -0
  372. package/.next/standalone/node_modules/next/dist/build/swc/index.js +92 -162
  373. package/.next/standalone/node_modules/next/dist/build/utils.js +180 -90
  374. package/.next/standalone/node_modules/next/dist/cli/next-test.js +4 -0
  375. package/.next/standalone/node_modules/next/dist/client/app-call-server.js +16 -18
  376. package/.next/standalone/node_modules/next/dist/client/components/app-router-instance.js +43 -187
  377. package/.next/standalone/node_modules/next/dist/client/components/{segment-cache/navigation.js → app-router-state.js} +88 -334
  378. package/.next/standalone/node_modules/next/dist/client/components/app-router-utils.js +1 -5
  379. package/.next/standalone/node_modules/next/dist/client/components/app-router.js +83 -74
  380. package/.next/standalone/node_modules/next/dist/client/components/dev-root-http-access-fallback-boundary.js +1 -5
  381. package/.next/standalone/node_modules/next/dist/client/components/forbidden.js +2 -10
  382. package/.next/standalone/node_modules/next/dist/client/components/handle-isr-error.js +19 -4
  383. package/.next/standalone/node_modules/next/dist/client/components/instant-samples.js +4 -11
  384. package/.next/standalone/node_modules/next/dist/client/components/links.js +6 -7
  385. package/.next/standalone/node_modules/next/dist/client/components/navigation-dynamic-rendering.js +3 -3
  386. package/.next/standalone/node_modules/next/dist/client/components/navigation-untracked.js +1 -2
  387. package/.next/standalone/node_modules/next/dist/client/components/navigation.js +2 -6
  388. package/.next/standalone/node_modules/next/dist/client/components/navigation.react-server.js +1 -5
  389. package/.next/standalone/node_modules/next/dist/client/components/navigator.js +73 -0
  390. package/.next/standalone/node_modules/next/dist/client/components/not-found.js +1 -5
  391. package/.next/standalone/node_modules/next/dist/client/components/prefetch.js +83 -0
  392. package/.next/standalone/node_modules/next/dist/client/components/readonly-url-search-params.js +0 -5
  393. package/.next/standalone/node_modules/next/dist/client/components/redirect.js +3 -15
  394. package/.next/standalone/node_modules/next/dist/client/components/{router-reducer/ppr-navigations.js → render-tree.js} +365 -400
  395. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/compute-changed-path.js +13 -5
  396. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/create-initial-router-state.js +67 -54
  397. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/create-router-cache-key.js +1 -7
  398. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/create-segment-key.js +42 -0
  399. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/fetch-server-response.js +71 -50
  400. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/is-navigating-to-new-root-layout.js +4 -4
  401. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/reducers/hmr-refresh-reducer.js +2 -2
  402. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/reducers/navigate-reducer.js +5 -5
  403. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/reducers/refresh-reducer.js +11 -8
  404. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/reducers/restore-reducer.js +12 -9
  405. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/reducers/server-action-reducer.js +30 -29
  406. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/reducers/server-patch-reducer.js +5 -5
  407. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/router-reducer.js +2 -10
  408. package/.next/standalone/node_modules/next/dist/client/components/segment-cache/bfcache.js +11 -21
  409. package/.next/standalone/node_modules/next/dist/client/components/segment-cache/cache.js +1168 -1181
  410. package/.next/standalone/node_modules/next/dist/client/components/segment-cache/decode-server-response.js +419 -0
  411. package/.next/standalone/node_modules/next/dist/client/components/segment-cache/navigation-testing-lock.js +1 -1
  412. package/.next/standalone/node_modules/next/dist/client/components/segment-cache/optimistic-routes.js +77 -82
  413. package/.next/standalone/node_modules/next/dist/client/components/segment-cache/scheduler.js +464 -425
  414. package/.next/standalone/node_modules/next/dist/client/components/segment-cache/types.js +12 -3
  415. package/.next/standalone/node_modules/next/dist/client/components/segment-cache/vary-path.js +140 -126
  416. package/.next/standalone/node_modules/next/dist/client/components/sequential-router-queue.js +163 -0
  417. package/.next/standalone/node_modules/next/dist/client/components/unauthorized.js +2 -10
  418. package/.next/standalone/node_modules/next/dist/client/components/unstable-rethrow.js +1 -2
  419. package/.next/standalone/node_modules/next/dist/client/components/use-action-queue.js +2 -10
  420. package/.next/standalone/node_modules/next/dist/client/dev/debug-channel.js +6 -323
  421. package/.next/standalone/node_modules/next/dist/client/flight-data-helpers.js +41 -94
  422. package/.next/standalone/node_modules/next/dist/client/route-params.js +34 -12
  423. package/.next/standalone/node_modules/next/dist/client/sequential-call-server.js +45 -0
  424. package/.next/standalone/node_modules/next/dist/compiled/@mswjs/interceptors/ClientRequest/index.js +1 -1
  425. package/.next/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js +203 -59
  426. package/.next/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo.runtime.prod.js +203 -59
  427. package/.next/standalone/node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +5 -3
  428. package/.next/standalone/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +13 -13
  429. package/.next/standalone/node_modules/next/dist/compiled/react-is/package.json +1 -1
  430. package/.next/standalone/node_modules/next/dist/compiled/stacktrace-parser/stack-trace-parser.cjs.js +1 -1
  431. package/.next/standalone/node_modules/next/dist/experimental/testmode/fetch.js +2 -10
  432. package/.next/standalone/node_modules/next/dist/export/helpers/create-incremental-cache.js +21 -16
  433. package/.next/standalone/node_modules/next/dist/export/utils.js +37 -0
  434. package/.next/standalone/node_modules/next/dist/lib/batcher.js +2 -2
  435. package/.next/standalone/node_modules/next/dist/lib/dist-dir.js +88 -0
  436. package/.next/standalone/node_modules/next/dist/lib/download-swc.js +2 -10
  437. package/.next/standalone/node_modules/next/dist/lib/fallback.js +3 -15
  438. package/.next/standalone/node_modules/next/dist/lib/find-pages-dir.js +2 -10
  439. package/.next/standalone/node_modules/next/dist/lib/helpers/get-cache-directory.js +1 -5
  440. package/.next/standalone/node_modules/next/dist/lib/helpers/get-npx-command.js +1 -1
  441. package/.next/standalone/node_modules/next/dist/lib/helpers/get-registry.js +1 -5
  442. package/.next/standalone/node_modules/next/dist/lib/helpers/git.js +52 -7
  443. package/.next/standalone/node_modules/next/dist/lib/inline-static-env.js +1 -5
  444. package/.next/standalone/node_modules/next/dist/lib/is-error.js +3 -15
  445. package/.next/standalone/node_modules/next/dist/lib/is-serializable-props.js +6 -35
  446. package/.next/standalone/node_modules/next/dist/lib/metadata/index.js +18 -0
  447. package/.next/standalone/node_modules/next/dist/lib/metadata/metadata-elements.js +1498 -0
  448. package/.next/standalone/node_modules/next/dist/lib/metadata/metadata-parallel.js +175 -0
  449. package/.next/standalone/node_modules/next/dist/lib/metadata/metadata-resolution-primitives.js +467 -0
  450. package/.next/standalone/node_modules/next/dist/lib/metadata/metadata.js +30 -1516
  451. package/.next/standalone/node_modules/next/dist/lib/metadata/resolve-metadata-parallel.js +632 -0
  452. package/.next/standalone/node_modules/next/dist/lib/metadata/resolve-metadata.js +15 -414
  453. package/.next/standalone/node_modules/next/dist/lib/mkcert.js +4 -20
  454. package/.next/standalone/node_modules/next/dist/lib/patch-incorrect-lockfile.js +4 -8
  455. package/.next/standalone/node_modules/next/dist/lib/picocolors.js +10 -0
  456. package/.next/standalone/node_modules/next/dist/lib/pretty-bytes.js +1 -5
  457. package/.next/standalone/node_modules/next/dist/lib/recursive-delete.js +50 -11
  458. package/.next/standalone/node_modules/next/dist/lib/resolve-build-paths.js +1 -5
  459. package/.next/standalone/node_modules/next/dist/lib/resolve-from.js +2 -10
  460. package/.next/standalone/node_modules/next/dist/lib/static-env.js +1 -5
  461. package/.next/standalone/node_modules/next/dist/lib/typescript/getTypeScriptConfiguration.js +3 -15
  462. package/.next/standalone/node_modules/next/dist/lib/typescript/missingDependencyError.js +1 -5
  463. package/.next/standalone/node_modules/next/dist/lib/typescript/runTypeCheck.js +1 -9
  464. package/.next/standalone/node_modules/next/dist/lib/typescript/runTypeCheckCli.js +0 -1
  465. package/.next/standalone/node_modules/next/dist/lib/typescript/runTypeScriptCli.js +4 -16
  466. package/.next/standalone/node_modules/next/dist/lib/verify-partytown-setup.js +1 -5
  467. package/.next/standalone/node_modules/next/dist/lib/warn-missing-react-dependencies.js +33 -0
  468. package/.next/standalone/node_modules/next/dist/lib/worker.js +1 -5
  469. package/.next/standalone/node_modules/next/dist/server/accept-header.js +3 -15
  470. package/.next/standalone/node_modules/next/dist/server/after/after-context.js +5 -25
  471. package/.next/standalone/node_modules/next/dist/server/after/after.js +1 -5
  472. package/.next/standalone/node_modules/next/dist/server/after/awaiter.js +1 -5
  473. package/.next/standalone/node_modules/next/dist/server/after/run-with-after.js +2 -2
  474. package/.next/standalone/node_modules/next/dist/server/api-utils/index.js +1 -10
  475. package/.next/standalone/node_modules/next/dist/server/api-utils/node/api-resolver.js +10 -50
  476. package/.next/standalone/node_modules/next/dist/server/api-utils/node/parse-body.js +3 -15
  477. package/.next/standalone/node_modules/next/dist/server/app-render/action-async-storage-instance.js +1 -1
  478. package/.next/standalone/node_modules/next/dist/server/app-render/action-handler.js +104 -141
  479. package/.next/standalone/node_modules/next/dist/server/app-render/after-task-async-storage-instance.js +1 -1
  480. package/.next/standalone/node_modules/next/dist/server/app-render/app-render-prerender-utils.js +6 -30
  481. package/.next/standalone/node_modules/next/dist/server/app-render/app-render-render-utils.js +1 -5
  482. package/.next/standalone/node_modules/next/dist/server/app-render/app-render-scheduling.js +3 -15
  483. package/.next/standalone/node_modules/next/dist/server/app-render/app-render.js +1346 -1211
  484. package/.next/standalone/node_modules/next/dist/server/app-render/async-local-storage.js +11 -6
  485. package/.next/standalone/node_modules/next/dist/server/app-render/blocking-route-messages.js +119 -70
  486. package/.next/standalone/node_modules/next/dist/server/app-render/cache-signal.js +61 -35
  487. package/.next/standalone/node_modules/next/dist/server/app-render/collect-segment-data.js +326 -260
  488. package/.next/standalone/node_modules/next/dist/server/app-render/console-async-storage-instance.js +1 -1
  489. package/.next/standalone/node_modules/next/dist/server/app-render/create-component-tree.js +136 -160
  490. package/.next/standalone/node_modules/next/dist/server/app-render/create-error-handler.js +12 -6
  491. package/.next/standalone/node_modules/next/dist/server/app-render/create-transport-tree-from-loader-tree.js +190 -0
  492. package/.next/standalone/node_modules/next/dist/server/app-render/debug-channel-server.web.js +1 -5
  493. package/.next/standalone/node_modules/next/dist/server/app-render/dev-validation-error-delivery.js +1 -10
  494. package/.next/standalone/node_modules/next/dist/server/app-render/dev-validation-scheduler.js +4 -5
  495. package/.next/standalone/node_modules/next/dist/server/app-render/dev-validation-worker-snapshot.js +3 -1
  496. package/.next/standalone/node_modules/next/dist/server/app-render/dynamic-access-async-storage-instance.js +1 -1
  497. package/.next/standalone/node_modules/next/dist/server/app-render/dynamic-access-async-storage.external.js +26 -3
  498. package/.next/standalone/node_modules/next/dist/server/app-render/dynamic-rendering-client.js +124 -0
  499. package/.next/standalone/node_modules/next/dist/server/app-render/dynamic-rendering.js +260 -329
  500. package/.next/standalone/node_modules/next/dist/server/app-render/encryption-utils.js +1 -5
  501. package/.next/standalone/node_modules/next/dist/server/app-render/encryption.js +4 -17
  502. package/.next/standalone/node_modules/next/dist/server/app-render/entry-base.js +1 -6
  503. package/.next/standalone/node_modules/next/dist/server/app-render/instant-validation/boundary-impl.js +3 -12
  504. package/.next/standalone/node_modules/next/dist/server/app-render/instant-validation/boundary-tracking.js +2 -2
  505. package/.next/standalone/node_modules/next/dist/server/app-render/instant-validation/instant-config.js +4 -12
  506. package/.next/standalone/node_modules/next/dist/server/app-render/instant-validation/instant-samples.js +13 -62
  507. package/.next/standalone/node_modules/next/dist/server/app-render/instant-validation/instant-validation.js +145 -206
  508. package/.next/standalone/node_modules/next/dist/server/app-render/instant-validation/stream-utils.js +2 -10
  509. package/.next/standalone/node_modules/next/dist/server/app-render/manifests-singleton.js +110 -38
  510. package/.next/standalone/node_modules/next/dist/server/app-render/module-loading/track-dynamic-import.js +2 -10
  511. package/.next/standalone/node_modules/next/dist/server/app-render/module-loading/track-module-loading.instance.js +1 -1
  512. package/.next/standalone/node_modules/next/dist/server/app-render/parse-and-validate-flight-router-state.js +3 -15
  513. package/.next/standalone/node_modules/next/dist/server/app-render/postponed-state.js +87 -51
  514. package/.next/standalone/node_modules/next/dist/server/app-render/prospective-render-utils.js +2 -6
  515. package/.next/standalone/node_modules/next/dist/server/app-render/render-in-browser.js +27 -0
  516. package/.next/standalone/node_modules/next/dist/server/app-render/required-scripts.js +1 -5
  517. package/.next/standalone/node_modules/next/dist/server/app-render/rsc/taint.js +1 -5
  518. package/.next/standalone/node_modules/next/dist/server/app-render/segment-config/ensure-static.js +206 -0
  519. package/.next/standalone/node_modules/next/dist/server/app-render/staged-rendering.js +46 -54
  520. package/.next/standalone/node_modules/next/dist/server/app-render/stream-ops.node.js +18 -12
  521. package/.next/standalone/node_modules/next/dist/server/app-render/stream-ops.web.js +4 -20
  522. package/.next/standalone/node_modules/next/dist/server/app-render/sync-io-messages.js +2 -10
  523. package/.next/standalone/node_modules/next/dist/server/app-render/types.js +2 -1
  524. package/.next/standalone/node_modules/next/dist/server/app-render/use-flight-response.js +4 -17
  525. package/.next/standalone/node_modules/next/dist/server/app-render/vary-params.js +12 -11
  526. package/.next/standalone/node_modules/next/dist/server/app-render/walk-tree-with-flight-router-state.js +95 -97
  527. package/.next/standalone/node_modules/next/dist/server/app-render/work-async-storage-instance.js +1 -1
  528. package/.next/standalone/node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js +1 -1
  529. package/.next/standalone/node_modules/next/dist/server/app-render/work-unit-async-storage.external.js +36 -26
  530. package/.next/standalone/node_modules/next/dist/server/async-storage/draft-mode-provider.js +1 -5
  531. package/.next/standalone/node_modules/next/dist/server/async-storage/request-store.js +6 -5
  532. package/.next/standalone/node_modules/next/dist/server/async-storage/work-store.js +24 -26
  533. package/.next/standalone/node_modules/next/dist/server/base-http/node.js +1 -5
  534. package/.next/standalone/node_modules/next/dist/server/base-http/web.js +4 -12
  535. package/.next/standalone/node_modules/next/dist/server/base-server.js +346 -155
  536. package/.next/standalone/node_modules/next/dist/server/client-component-renderer-logger.js +129 -28
  537. package/.next/standalone/node_modules/next/dist/server/config-schema.js +61 -9
  538. package/.next/standalone/node_modules/next/dist/server/config-shared.js +26 -4
  539. package/.next/standalone/node_modules/next/dist/server/config.js +154 -332
  540. package/.next/standalone/node_modules/next/dist/server/dev/debug-channel.js +1 -5
  541. package/.next/standalone/node_modules/next/dist/server/dev/dev-validation-worker-pool.js +1 -0
  542. package/.next/standalone/node_modules/next/dist/server/dev/get-source-map-from-file.js +5 -25
  543. package/.next/standalone/node_modules/next/dist/server/dev/hot-middleware.js +27 -1
  544. package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +338 -200
  545. package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-types.js +3 -0
  546. package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-webpack.js +26 -20
  547. package/.next/standalone/node_modules/next/dist/server/dev/messages.js +2 -10
  548. package/.next/standalone/node_modules/next/dist/server/dev/middleware-turbopack.js +4 -20
  549. package/.next/standalone/node_modules/next/dist/server/dev/middleware-webpack.js +2 -10
  550. package/.next/standalone/node_modules/next/dist/server/dev/node-stack-frames.js +2 -19
  551. package/.next/standalone/node_modules/next/dist/server/dev/on-demand-entry-handler.js +12 -12
  552. package/.next/standalone/node_modules/next/dist/server/dev/runtime-error-state.js +220 -0
  553. package/.next/standalone/node_modules/next/dist/server/dev/serialized-errors.js +1 -5
  554. package/.next/standalone/node_modules/next/dist/server/dev/static-paths-worker.js +16 -15
  555. package/.next/standalone/node_modules/next/dist/server/dev/turbopack-utils.js +20 -36
  556. package/.next/standalone/node_modules/next/dist/server/dev/use-cache-probe-pool.js +1 -0
  557. package/.next/standalone/node_modules/next/dist/server/dev/use-cache-probe-worker.js +4 -3
  558. package/.next/standalone/node_modules/next/dist/server/dynamic-rendering-utils.js +298 -55
  559. package/.next/standalone/node_modules/next/dist/server/image-optimizer/detect-content-type.js +229 -0
  560. package/.next/standalone/node_modules/next/dist/server/image-optimizer/extract-etag.js +53 -0
  561. package/.next/standalone/node_modules/next/dist/server/image-optimizer/get-image-size.js +25 -0
  562. package/.next/standalone/node_modules/next/dist/server/image-optimizer/get-max-age.js +41 -0
  563. package/.next/standalone/node_modules/next/dist/server/image-optimizer/get-previously-cached-image-or-null.js +22 -0
  564. package/.next/standalone/node_modules/next/dist/server/image-optimizer/image-error.js +23 -0
  565. package/.next/standalone/node_modules/next/dist/server/image-optimizer/image-type.js +86 -0
  566. package/.next/standalone/node_modules/next/dist/server/image-optimizer/transform.js +227 -0
  567. package/.next/standalone/node_modules/next/dist/server/image-optimizer.js +78 -674
  568. package/.next/standalone/node_modules/next/dist/server/lib/app-info-log.js +19 -9
  569. package/.next/standalone/node_modules/next/dist/server/lib/cache-handlers/default.js +9 -13
  570. package/.next/standalone/node_modules/next/dist/server/lib/chrome-devtools-workspace.js +1 -5
  571. package/.next/standalone/node_modules/next/dist/server/lib/dedupe-fetch.js +1 -5
  572. package/.next/standalone/node_modules/next/dist/server/lib/dev-bundler-service.js +6 -6
  573. package/.next/standalone/node_modules/next/dist/server/lib/generate-agent-files.js +158 -35
  574. package/.next/standalone/node_modules/next/dist/server/lib/i18n-provider.js +1 -5
  575. package/.next/standalone/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js +14 -20
  576. package/.next/standalone/node_modules/next/dist/server/lib/incremental-cache/index.js +19 -29
  577. package/.next/standalone/node_modules/next/dist/server/lib/incremental-cache/memory-cache.external.js +1 -5
  578. package/.next/standalone/node_modules/next/dist/server/lib/lazy-module.js +1 -5
  579. package/.next/standalone/node_modules/next/dist/server/lib/lru-cache.js +1 -5
  580. package/.next/standalone/node_modules/next/dist/server/lib/mock-request.js +24 -120
  581. package/.next/standalone/node_modules/next/dist/server/lib/module-loader/node-module-loader.js +1 -5
  582. package/.next/standalone/node_modules/next/dist/server/lib/module-loader/route-module-loader.js +1 -5
  583. package/.next/standalone/node_modules/next/dist/server/lib/params-utils.js +0 -18
  584. package/.next/standalone/node_modules/next/dist/server/lib/patch-fetch.js +44 -38
  585. package/.next/standalone/node_modules/next/dist/server/lib/postponed-request-body.js +1 -5
  586. package/.next/standalone/node_modules/next/dist/server/lib/render-server.js +2 -10
  587. package/.next/standalone/node_modules/next/dist/server/lib/router-server.js +106 -36
  588. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/build-data-route.js +26 -3
  589. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/cache-life-type-utils.js +14 -45
  590. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/decode-path-params.js +1 -5
  591. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/filesystem.js +212 -31
  592. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/instrumentation-globals.external.js +61 -1
  593. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/instrumentation-node-extensions.js +1 -5
  594. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/normalize-catchall-routes.js +320 -0
  595. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/proxy-request.js +2 -2
  596. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/resolve-routes.js +17 -11
  597. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/strict-route-matching-config.js +28 -0
  598. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/typegen.js +56 -10
  599. package/.next/standalone/node_modules/next/dist/server/lib/start-server.js +48 -38
  600. package/.next/standalone/node_modules/next/dist/server/lib/trace/constants.js +40 -0
  601. package/.next/standalone/node_modules/next/dist/server/lib/trace/request-insights-identity.js +1 -3
  602. package/.next/standalone/node_modules/next/dist/server/lib/trace/tracer.js +10 -10
  603. package/.next/standalone/node_modules/next/dist/server/lib/utils.js +66 -15
  604. package/.next/standalone/node_modules/next/dist/server/lib/worker-utils.js +1 -5
  605. package/.next/standalone/node_modules/next/dist/server/load-components.js +7 -2
  606. package/.next/standalone/node_modules/next/dist/server/load-manifest.external.js +16 -17
  607. package/.next/standalone/node_modules/next/dist/server/mcp/tools/utils/browser-communication.js +2 -10
  608. package/.next/standalone/node_modules/next/dist/server/mcp/tools/utils/format-errors.js +5 -5
  609. package/.next/standalone/node_modules/next/dist/server/next-server.js +130 -124
  610. package/.next/standalone/node_modules/next/dist/server/next.js +25 -37
  611. package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/console-dim.external.js +1 -2
  612. package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/fast-set-immediate.external.js +115 -62
  613. package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/global-behaviors.js +1 -5
  614. package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/io-utils.js +11 -10
  615. package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/process-error-handlers.js +0 -9
  616. package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/unhandled-rejection.external.js +1 -12
  617. package/.next/standalone/node_modules/next/dist/server/normalizers/built/app/app-page-normalizer.js +1 -1
  618. package/.next/standalone/node_modules/next/dist/server/normalizers/request/base-path.js +1 -5
  619. package/.next/standalone/node_modules/next/dist/server/normalizers/request/next-data.js +1 -5
  620. package/.next/standalone/node_modules/next/dist/server/normalizers/request/prefix.js +1 -5
  621. package/.next/standalone/node_modules/next/dist/server/og/cache-image-response.js +2 -7
  622. package/.next/standalone/node_modules/next/dist/server/patch-error-inspect.js +19 -11
  623. package/.next/standalone/node_modules/next/dist/server/pipe-readable.js +42 -30
  624. package/.next/standalone/node_modules/next/dist/server/render-result.js +5 -17
  625. package/.next/standalone/node_modules/next/dist/server/render.js +37 -183
  626. package/.next/standalone/node_modules/next/dist/server/request/cache-stages.js +250 -0
  627. package/.next/standalone/node_modules/next/dist/server/request/connection.js +9 -40
  628. package/.next/standalone/node_modules/next/dist/server/request/cookies.js +11 -46
  629. package/.next/standalone/node_modules/next/dist/server/request/draft-mode.js +14 -60
  630. package/.next/standalone/node_modules/next/dist/server/request/fallback-params.js +23 -9
  631. package/.next/standalone/node_modules/next/dist/server/request/headers.js +10 -44
  632. package/.next/standalone/node_modules/next/dist/server/request/io.js +2 -11
  633. package/.next/standalone/node_modules/next/dist/server/request/params.js +62 -196
  634. package/.next/standalone/node_modules/next/dist/server/request/pathname.js +9 -61
  635. package/.next/standalone/node_modules/next/dist/server/request/root-params.js +25 -81
  636. package/.next/standalone/node_modules/next/dist/server/request/search-params.js +42 -119
  637. package/.next/standalone/node_modules/next/dist/server/request/utils.js +3 -10
  638. package/.next/standalone/node_modules/next/dist/server/response-cache/index.js +54 -32
  639. package/.next/standalone/node_modules/next/dist/server/response-cache/utils.js +1 -5
  640. package/.next/standalone/node_modules/next/dist/server/response-cache/web.js +5 -2
  641. package/.next/standalone/node_modules/next/dist/server/resume-data-cache/cache-store.js +18 -0
  642. package/.next/standalone/node_modules/next/dist/server/resume-data-cache/resume-data-cache.js +51 -49
  643. package/.next/standalone/node_modules/next/dist/server/revalidation-utils.js +15 -13
  644. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/dev-render-context.js +23 -0
  645. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/helpers/prerender-manifest-matcher.js +5 -4
  646. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/module.js +13 -1
  647. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/module.render.js +26 -11
  648. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/parse-request-headers.js +58 -0
  649. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/rsc/entrypoints.js +1 -5
  650. package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/ssr/entrypoints.js +1 -5
  651. package/.next/standalone/node_modules/next/dist/server/route-modules/app-route/helpers/auto-implement-methods.js +1 -5
  652. package/.next/standalone/node_modules/next/dist/server/route-modules/app-route/module.js +399 -432
  653. package/.next/standalone/node_modules/next/dist/server/route-modules/pages/module.render.js +1 -5
  654. package/.next/standalone/node_modules/next/dist/server/route-modules/pages/pages-handler.js +20 -16
  655. package/.next/standalone/node_modules/next/dist/server/route-modules/pages-api/module.js +1 -5
  656. package/.next/standalone/node_modules/next/dist/server/route-modules/route-module.js +57 -61
  657. package/.next/standalone/node_modules/next/dist/server/serve-static.js +1 -5
  658. package/.next/standalone/node_modules/next/dist/server/setup-http-agent-env.js +1 -5
  659. package/.next/standalone/node_modules/next/dist/server/stream-utils/encoded-tags.js +1 -1
  660. package/.next/standalone/node_modules/next/dist/server/stream-utils/node-web-streams-helper.js +7 -11
  661. package/.next/standalone/node_modules/next/dist/server/typescript/constant.js +2 -0
  662. package/.next/standalone/node_modules/next/dist/server/typescript/rules/config.js +29 -2
  663. package/.next/standalone/node_modules/next/dist/server/use-cache/cache-life-profile.js +6 -30
  664. package/.next/standalone/node_modules/next/dist/server/use-cache/cache-life.js +9 -32
  665. package/.next/standalone/node_modules/next/dist/server/use-cache/cache-tag.js +6 -12
  666. package/.next/standalone/node_modules/next/dist/server/use-cache/constants.js +1 -5
  667. package/.next/standalone/node_modules/next/dist/server/use-cache/handlers.js +27 -36
  668. package/.next/standalone/node_modules/next/dist/server/use-cache/tiered-cache-handler.js +6 -4
  669. package/.next/standalone/node_modules/next/dist/server/use-cache/use-cache-errors.js +18 -19
  670. package/.next/standalone/node_modules/next/dist/server/use-cache/use-cache-messages.js +190 -0
  671. package/.next/standalone/node_modules/next/dist/server/use-cache/use-cache-wrapper.js +485 -407
  672. package/.next/standalone/node_modules/next/dist/server/web/adapter.js +14 -35
  673. package/.next/standalone/node_modules/next/dist/server/web/edge-route-module-wrapper.js +6 -7
  674. package/.next/standalone/node_modules/next/dist/server/web/error.js +0 -15
  675. package/.next/standalone/node_modules/next/dist/server/web/globals.js +3 -15
  676. package/.next/standalone/node_modules/next/dist/server/web/next-url.js +1 -5
  677. package/.next/standalone/node_modules/next/dist/server/web/sandbox/context.js +10 -34
  678. package/.next/standalone/node_modules/next/dist/server/web/sandbox/sandbox.js +1 -5
  679. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/adapters/headers.js +0 -5
  680. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/adapters/next-request.js +1 -5
  681. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/adapters/request-cookies.js +0 -5
  682. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/fetch-event.js +2 -10
  683. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/image-response.js +1 -5
  684. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/response.js +2 -10
  685. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/revalidate.js +28 -66
  686. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/unstable-cache.js +14 -22
  687. package/.next/standalone/node_modules/next/dist/server/web/spec-extension/unstable-no-store.js +1 -2
  688. package/.next/standalone/node_modules/next/dist/server/web/utils.js +1 -5
  689. package/.next/standalone/node_modules/next/dist/server/web/web-on-close.js +2 -10
  690. package/.next/standalone/node_modules/next/dist/shared/lib/app-router-types.js +38 -28
  691. package/.next/standalone/node_modules/next/dist/shared/lib/constants.js +5 -0
  692. package/.next/standalone/node_modules/next/dist/shared/lib/deployment-id.js +1 -1
  693. package/.next/standalone/node_modules/next/dist/shared/lib/errors/code-frame.js +3 -2
  694. package/.next/standalone/node_modules/next/dist/shared/lib/errors/empty-generate-static-params-error.js +1 -5
  695. package/.next/standalone/node_modules/next/dist/shared/lib/errors/ensure-static-gsp-errors.js +30 -0
  696. package/.next/standalone/node_modules/next/dist/shared/lib/errors/hard-deprecated-config-error.js +0 -5
  697. package/.next/standalone/node_modules/next/dist/shared/lib/html-context.shared-runtime.js +1 -5
  698. package/.next/standalone/node_modules/next/dist/shared/lib/image-config.js +52 -1
  699. package/.next/standalone/node_modules/next/dist/shared/lib/instant-messages.js +2 -10
  700. package/.next/standalone/node_modules/next/dist/shared/lib/invariant-error.js +0 -5
  701. package/.next/standalone/node_modules/next/dist/shared/lib/lazy-dynamic/react-browser-bailout.js +45 -0
  702. package/.next/standalone/node_modules/next/dist/shared/lib/magic-identifier.js +198 -0
  703. package/.next/standalone/node_modules/next/dist/shared/lib/match-remote-pattern.js +1 -5
  704. package/.next/standalone/node_modules/next/dist/shared/lib/router/routes/app.js +3 -15
  705. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/app-paths.js +6 -1
  706. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/get-dynamic-param.js +4 -12
  707. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/interception-routes.js +63 -20
  708. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/parse-relative-url.js +1 -5
  709. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/prepare-destination.js +1 -5
  710. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/querystring.js +31 -0
  711. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/resolve-param-value.js +1 -5
  712. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/route-matcher.js +1 -5
  713. package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/sorted-routes.js +11 -55
  714. package/.next/standalone/node_modules/next/dist/shared/lib/rsc-transport.js +108 -0
  715. package/.next/standalone/node_modules/next/dist/shared/lib/segment-cache/segment-value-encoding.js +0 -13
  716. package/.next/standalone/node_modules/next/dist/shared/lib/segment-cache/vary-params-decoding.js +48 -27
  717. package/.next/standalone/node_modules/next/dist/shared/lib/segment.js +1 -13
  718. package/.next/standalone/node_modules/next/dist/shared/lib/turbopack/internal-error.js +2 -7
  719. package/.next/standalone/node_modules/next/dist/shared/lib/utils.js +2 -11
  720. package/.next/standalone/node_modules/next/dist/shared/lib/zod.js +2 -6
  721. package/.next/standalone/node_modules/next/dist/telemetry/anonymous-meta.js +1 -1
  722. package/.next/standalone/node_modules/next/dist/telemetry/detached-flush.js +8 -15
  723. package/.next/standalone/node_modules/next/dist/telemetry/events/build.js +1 -2
  724. package/.next/standalone/node_modules/next/dist/telemetry/events/swc-load-failure.js +1 -1
  725. package/.next/standalone/node_modules/next/dist/telemetry/events/version.js +2 -2
  726. package/.next/standalone/node_modules/next/dist/telemetry/post-telemetry-payload.js +1 -5
  727. package/.next/standalone/node_modules/next/dist/telemetry/storage.js +31 -19
  728. package/.next/standalone/node_modules/next/dist/trace/report/index.js +5 -2
  729. package/.next/standalone/node_modules/next/dist/trace/report/to-json-build.js +4 -2
  730. package/.next/standalone/node_modules/next/dist/trace/report/to-json.js +141 -97
  731. package/.next/standalone/node_modules/next/dist/trace/trace.js +14 -9
  732. package/.next/standalone/node_modules/next/package.json +11 -10
  733. package/.next/standalone/package.json +11 -11
  734. package/.next/standalone/sdk/python/uv.lock +30 -115
  735. package/.next/standalone/sdk/typescript/CHANGELOG.md +11 -0
  736. package/.next/standalone/sdk/typescript/integration/fixtures/mastra-1/package-lock.json +16 -4
  737. package/.next/standalone/sdk/typescript/integration/fixtures/mastra-1/package.json +3 -0
  738. package/.next/standalone/server.js +1 -1
  739. package/bin/failproofai.mjs +2 -2
  740. package/dist/cli.mjs +27125 -26785
  741. package/dist/worker.mjs +117 -111
  742. package/hermes-plugin/plugin.yaml +1 -1
  743. package/package.json +11 -11
  744. package/scripts/skew-log-filter.ts +5 -1
  745. package/src/hooks/cloud-connection.ts +86 -17
  746. package/src/hooks/cloud-enrollment.ts +4 -3
  747. package/src/hooks/cloud-managed-policies.ts +15 -11
  748. package/src/hooks/codex-system-hooks.ts +687 -0
  749. package/src/hooks/collector-config.ts +5 -4
  750. package/src/hooks/config-status.ts +47 -114
  751. package/src/hooks/configure-wizard.ts +55 -65
  752. package/src/hooks/credential-recovery.ts +36 -0
  753. package/src/hooks/daemon-service.ts +2 -2
  754. package/src/hooks/delivery-health.ts +20 -9
  755. package/src/hooks/fp-config.ts +17 -5
  756. package/src/hooks/fp-home.ts +1 -1
  757. package/src/hooks/integrations.ts +16 -0
  758. package/src/hooks/manager.ts +62 -2
  759. package/src/hooks/otel-cli.ts +51 -20
  760. package/src/hooks/otel-writers.ts +26 -17
  761. package/src/hooks/uninstall-cli.ts +28 -7
  762. package/.next/standalone/.next/server/chunks/[externals]__1_9ze9b._.js +0 -3
  763. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0--lkk6._.js +0 -3
  764. package/.next/standalone/.next/server/chunks/[root-of-the-server]__03r-lqq._.js +0 -3
  765. package/.next/standalone/.next/server/chunks/[root-of-the-server]__08dchfu._.js +0 -3
  766. package/.next/standalone/.next/server/chunks/[root-of-the-server]__08w4wmd._.js +0 -3
  767. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_0xu5z._.js +0 -3
  768. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0f7mikp._.js +0 -3
  769. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0g6bbuw._.js +0 -3
  770. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ga9hs7._.js +0 -3
  771. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0l3yhx4._.js +0 -160
  772. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0moxohc._.js +0 -22
  773. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o07qi9._.js +0 -3
  774. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0q-v9z2._.js +0 -3
  775. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0q0qzx1._.js +0 -3
  776. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0rv7m0k._.js +0 -3
  777. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0z2ll-a._.js +0 -3
  778. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0zlqo2t._.js +0 -3
  779. package/.next/standalone/.next/server/chunks/[root-of-the-server]__12021ot._.js +0 -3
  780. package/.next/standalone/.next/server/chunks/[root-of-the-server]__17g9wh7._.js +0 -3
  781. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1adacul._.js +0 -165
  782. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1anxb5k._.js +0 -3
  783. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1autwno._.js +0 -3
  784. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1ffkmds._.js +0 -3
  785. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1jm9fw6._.js +0 -3
  786. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1l71g3y._.js +0 -22
  787. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1legmza._.js +0 -3
  788. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1ou2ehh._.js +0 -3
  789. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1qb590j._.js +0 -3
  790. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1shcqgr._.js +0 -3
  791. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1v25n-6._.js +0 -3
  792. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1w9zl9-._.js +0 -3
  793. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1xuedea._.js +0 -3
  794. package/.next/standalone/.next/server/chunks/_09dz7xv._.js +0 -27
  795. package/.next/standalone/.next/server/chunks/_0p53ge1._.js +0 -3
  796. package/.next/standalone/.next/server/chunks/_0tovk6q._.js +0 -3
  797. package/.next/standalone/.next/server/chunks/_0trp3yc._.js +0 -3
  798. package/.next/standalone/.next/server/chunks/_1ek68ln._.js +0 -33
  799. package/.next/standalone/.next/server/chunks/_1fz8m31._.js +0 -3
  800. package/.next/standalone/.next/server/chunks/_1jrv3hg._.js +0 -3
  801. package/.next/standalone/.next/server/chunks/_1nx8fim._.js +0 -3
  802. package/.next/standalone/.next/server/chunks/_1ogwigf._.js +0 -3
  803. package/.next/standalone/.next/server/chunks/_1q27azx._.js +0 -3
  804. package/.next/standalone/.next/server/chunks/_1vslkoe._.js +0 -3
  805. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_download_[project]_[session]_route_actions_1is7vs7.js +0 -3
  806. package/.next/standalone/.next/server/chunks/lib_16xa545._.js +0 -3
  807. package/.next/standalone/.next/server/chunks/lib_factory-projects_ts_1eo_bk-._.js +0 -3
  808. package/.next/standalone/.next/server/chunks/lib_openclaw-projects_ts_0gc-p24._.js +0 -3
  809. package/.next/standalone/.next/server/chunks/lib_telemetry-id_ts_1k8gj9o._.js +0 -3
  810. package/.next/standalone/.next/server/chunks/lib_telemetry_ts_0dctyyw._.js +0 -3
  811. package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_01r25oi._.js +0 -4
  812. package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_09z9-p7._.js +0 -4
  813. package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_0ol5pa3._.js +0 -3
  814. package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_1rqmk27._.js +0 -3
  815. package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_1w7tiq4._.js +0 -3
  816. package/.next/standalone/.next/server/chunks/src_hooks_1aveq0u._.js +0 -5
  817. package/.next/standalone/.next/server/chunks/src_hooks_1eem5a7._.js +0 -3
  818. package/.next/standalone/.next/server/chunks/src_hooks_custom-hooks-loader_ts_0lnb3n3._.js +0 -12
  819. package/.next/standalone/.next/server/chunks/src_hooks_fp-home_ts_09kv0bn._.js +0 -3
  820. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__04usis8._.js +0 -4
  821. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0502lat._.js +0 -3
  822. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0576iuy._.js +0 -3
  823. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__059yza8._.js +0 -3
  824. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__05r_17v._.js +0 -3
  825. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__06pflha._.js +0 -3
  826. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0_gn5iz._.js +0 -4
  827. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0e2l3c1._.js +0 -3
  828. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0eip4_k._.js +0 -22
  829. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0er05u0._.js +0 -3
  830. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0f765xr._.js +0 -4
  831. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h38gzz._.js +0 -3
  832. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0hci7t3._.js +0 -3
  833. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0hoaz1g._.js +0 -4
  834. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0mxmwtx._.js +0 -3
  835. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0p84xee._.js +0 -3
  836. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0qcb0mg._.js +0 -3
  837. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0sjzdjg._.js +0 -3
  838. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0uescqv._.js +0 -3
  839. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__13d-wb6._.js +0 -3
  840. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1484zv2._.js +0 -3
  841. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__19dutr7._.js +0 -14
  842. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1_qv8oh._.js +0 -3
  843. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ab4ifb._.js +0 -3
  844. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1b2dbet._.js +0 -33
  845. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1dinjii._.js +0 -3
  846. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1fbrk56._.js +0 -4
  847. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1kaotix._.js +0 -22
  848. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1pprgri._.js +0 -4
  849. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1py795m._.js +0 -3
  850. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1qapotl._.js +0 -3
  851. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1qiz0e4._.js +0 -3
  852. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1um4yxn._.js +0 -4
  853. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1v185mo._.js +0 -3
  854. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1wb4yt2._.js +0 -4
  855. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1y3n3cn._.js +0 -4
  856. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1zl_r0t._.js +0 -3
  857. package/.next/standalone/.next/server/chunks/ssr/_0-yi74u._.js +0 -3
  858. package/.next/standalone/.next/server/chunks/ssr/_08x1r5t._.js +0 -3
  859. package/.next/standalone/.next/server/chunks/ssr/_0bqoto4._.js +0 -3
  860. package/.next/standalone/.next/server/chunks/ssr/_0lnpwk8._.js +0 -23
  861. package/.next/standalone/.next/server/chunks/ssr/_0uyu3jf._.js +0 -3
  862. package/.next/standalone/.next/server/chunks/ssr/_0wso5d3._.js +0 -3
  863. package/.next/standalone/.next/server/chunks/ssr/_1-3unkg._.js +0 -3
  864. package/.next/standalone/.next/server/chunks/ssr/_15y8myg._.js +0 -3
  865. package/.next/standalone/.next/server/chunks/ssr/_1_ozgif._.js +0 -3
  866. package/.next/standalone/.next/server/chunks/ssr/_1ddpc5g._.js +0 -3
  867. package/.next/standalone/.next/server/chunks/ssr/_1gb0ifp._.js +0 -232
  868. package/.next/standalone/.next/server/chunks/ssr/_1o95rf0._.js +0 -3
  869. package/.next/standalone/.next/server/chunks/ssr/_1q46vxx._.js +0 -22
  870. package/.next/standalone/.next/server/chunks/ssr/_1thr5rf._.js +0 -3
  871. package/.next/standalone/.next/server/chunks/ssr/_1y3xzro._.js +0 -3
  872. package/.next/standalone/.next/server/chunks/ssr/_1ylae7o._.js +0 -3
  873. package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_policies_page_actions_1sp2-yo.js +0 -16
  874. package/.next/standalone/.next/server/chunks/ssr/app_087bt9w._.js +0 -3
  875. package/.next/standalone/.next/server/chunks/ssr/app_1fvisnp._.js +0 -3
  876. package/.next/standalone/.next/server/chunks/ssr/app_209u41o._.js +0 -3
  877. package/.next/standalone/.next/server/chunks/ssr/app_actions_get-scheduled-audit_ts_0ei9sni._.js +0 -3
  878. package/.next/standalone/.next/server/chunks/ssr/app_components_project-list_tsx_1ke6anr._.js +0 -3
  879. package/.next/standalone/.next/server/chunks/ssr/app_error_tsx_15zfp7n._.js +0 -3
  880. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_0w002m_._.js +0 -3
  881. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +0 -3
  882. package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +0 -8
  883. package/.next/standalone/.next/server/chunks/ssr/app_project_[name]_error_tsx_08qg6nc._.js +0 -3
  884. package/.next/standalone/.next/server/chunks/ssr/app_project_[name]_session_[sessionId]_error_tsx_0rf4j1n._.js +0 -3
  885. package/.next/standalone/.next/server/chunks/ssr/app_settings_02tf1h4._.js +0 -3
  886. package/.next/standalone/.next/server/chunks/ssr/lib_1cf5ya2._.js +0 -3
  887. package/.next/standalone/.next/server/chunks/ssr/lib_antigravity-projects_ts_0_6zf11._.js +0 -3
  888. package/.next/standalone/.next/server/chunks/ssr/lib_codex-projects_ts_0pqlw37._.js +0 -3
  889. package/.next/standalone/.next/server/chunks/ssr/lib_copilot-projects_ts_19wl7tp._.js +0 -3
  890. package/.next/standalone/.next/server/chunks/ssr/lib_cursor-projects_ts_18-iwyk._.js +0 -3
  891. package/.next/standalone/.next/server/chunks/ssr/lib_devin-projects_ts_0a64qdy._.js +0 -3
  892. package/.next/standalone/.next/server/chunks/ssr/lib_factory-projects_ts_1uyaahq._.js +0 -3
  893. package/.next/standalone/.next/server/chunks/ssr/lib_goose-projects_ts_0zkscri._.js +0 -3
  894. package/.next/standalone/.next/server/chunks/ssr/lib_hermes-projects_ts_05b8-it._.js +0 -3
  895. package/.next/standalone/.next/server/chunks/ssr/lib_openclaw-projects_ts_0qxq3bp._.js +0 -3
  896. package/.next/standalone/.next/server/chunks/ssr/lib_opencode-projects_ts_15bjxkm._.js +0 -3
  897. package/.next/standalone/.next/server/chunks/ssr/lib_pi-projects_ts_1wikofb._.js +0 -3
  898. package/.next/standalone/.next/server/chunks/ssr/node_modules_1hl81y4._.js +0 -3
  899. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_0aiy-os._.js +0 -131
  900. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_0nkkbfv._.js +0 -6
  901. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_0w6mzq5._.js +0 -151
  902. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_18_d8l1._.js +0 -151
  903. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_1v8aef8._.js +0 -3
  904. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_client_components_0wpq8j3._.js +0 -3
  905. package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_11bnuzn._.js +0 -4
  906. package/.next/standalone/.next/server/chunks/ssr/src_hooks_0-q0umm._.js +0 -3
  907. package/.next/standalone/.next/server/chunks/ssr/src_hooks_06kzv9d._.js +0 -12
  908. package/.next/standalone/.next/server/chunks/ssr/src_hooks_0g194sy._.js +0 -3
  909. package/.next/standalone/.next/server/chunks/ssr/src_hooks_1cv9_c4._.js +0 -12
  910. package/.next/standalone/.next/server/chunks/ssr/src_hooks_1kx9e0d._.js +0 -3
  911. package/.next/standalone/.next/server/chunks/ssr/src_hooks_effective-reviewers_ts_1h4wtvo._.js +0 -5
  912. package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-config_ts_04t589g._.js +0 -4
  913. package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-home_ts_0je3xkv._.js +0 -3
  914. package/.next/standalone/.next/server/chunks/ssr/src_hooks_pack-cli_ts_0t7me65._.js +0 -3
  915. package/.next/standalone/.next/server/chunks/ssr/src_hooks_semantic_pack-policies_ts_0gh_bu_._.js +0 -3
  916. package/.next/standalone/.next/static/chunks/0pra9i676pym1.js +0 -1
  917. package/.next/standalone/.next/static/chunks/1-lpi0m-hc1kb.js +0 -1
  918. package/.next/standalone/.next/static/chunks/17yvyyblr_eb5.js +0 -1
  919. package/.next/standalone/.next/static/chunks/1c6aptmytnu6q.js +0 -1
  920. package/.next/standalone/.next/static/chunks/1eyl7fzkmnkf_.js +0 -1
  921. package/.next/standalone/.next/static/chunks/1wozchtn2etvh.js +0 -1
  922. package/.next/standalone/.next/static/chunks/1xacnwjkbekn7.js +0 -1
  923. package/.next/standalone/.next/static/chunks/23thtelz1a-ur.js +0 -6
  924. package/.next/standalone/.next/static/chunks/2bc17tohgs4bs.js +0 -1
  925. package/.next/standalone/.next/static/chunks/2hg_bp8z_vm2g.js +0 -1
  926. package/.next/standalone/.next/static/chunks/2xq-ejo8kti18.js +0 -1
  927. package/.next/standalone/.next/static/chunks/2yuzx8716maf0.js +0 -1
  928. package/.next/standalone/.next/static/chunks/3-_pth_c9n938.js +0 -1
  929. package/.next/standalone/.next/static/chunks/35fgpd_feci6x.js +0 -1
  930. package/.next/standalone/.next/static/chunks/3n46e45atic-m.js +0 -22
  931. package/.next/standalone/.next/static/chunks/3q7sndqftqhw9.js +0 -1
  932. package/.next/standalone/.next/static/chunks/3qfoeqhy5l10x.js +0 -1
  933. package/.next/standalone/.next/static/chunks/3sg07wnn969xq.js +0 -31
  934. package/.next/standalone/.next/static/chunks/3xpjn3cdgm-7m.js +0 -1
  935. package/.next/standalone/.next/static/chunks/4448_qq7bd963.js +0 -1
  936. package/.next/standalone/.next/static/chunks/turbopack-1opxka4dtjbc5.js +0 -1
  937. package/.next/standalone/node_modules/next/dist/client/components/match-segments.js +0 -32
  938. package/.next/standalone/node_modules/next/dist/client/components/router-reducer/reducers/find-head-in-cache.js +0 -63
  939. package/.next/standalone/node_modules/next/dist/client/components/segment-cache/prefetch.js +0 -32
  940. package/.next/standalone/node_modules/next/dist/lib/detached-promise.js +0 -32
  941. package/.next/standalone/node_modules/next/dist/lib/error-telemetry-utils.js +0 -42
  942. package/.next/standalone/node_modules/next/dist/server/app-render/create-flight-router-state-from-loader-tree.js +0 -154
  943. package/.next/standalone/node_modules/next/dist/server/app-render/rsc/postpone.js +0 -18
  944. package/.next/standalone/node_modules/next/dist/server/lib/experimental/ppr.js +0 -47
  945. package/.next/standalone/node_modules/next/dist/server/lib/router-utils/is-postpone.js +0 -16
  946. package/.next/standalone/node_modules/next/dist/server/route-matcher-managers/default-route-matcher-manager.js +0 -239
  947. package/.next/standalone/node_modules/next/dist/server/route-matcher-managers/dev-route-matcher-manager.js +0 -120
  948. package/.next/standalone/node_modules/next/dist/server/route-matcher-managers/route-matcher-manager.js +0 -6
  949. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/app-page-route-matcher-provider.js +0 -55
  950. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/app-route-route-matcher-provider.js +0 -43
  951. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/dev-app-page-route-matcher-provider.js +0 -91
  952. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/dev-app-route-route-matcher-provider.js +0 -112
  953. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/dev-pages-api-route-matcher-provider.js +0 -77
  954. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/dev-pages-route-matcher-provider.js +0 -77
  955. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/file-cache-route-matcher-provider.js +0 -28
  956. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/helpers/file-reader/batched-file-reader.js +0 -106
  957. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/helpers/file-reader/default-file-reader.js +0 -42
  958. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/helpers/file-reader/file-reader.js +0 -6
  959. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/helpers/cached-route-matcher-provider.js +0 -30
  960. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/helpers/manifest-loaders/manifest-loader.js +0 -6
  961. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/helpers/manifest-loaders/node-manifest-loader.js +0 -34
  962. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/helpers/manifest-loaders/server-manifest-loader.js +0 -20
  963. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/manifest-route-matcher-provider.js +0 -21
  964. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/pages-api-route-matcher-provider.js +0 -55
  965. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/pages-route-matcher-provider.js +0 -64
  966. package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/route-matcher-provider.js +0 -6
  967. package/.next/standalone/node_modules/next/dist/server/route-matchers/app-page-route-matcher.js +0 -18
  968. package/.next/standalone/node_modules/next/dist/server/route-matchers/app-route-route-matcher.js +0 -15
  969. package/.next/standalone/node_modules/next/dist/server/route-matchers/locale-route-matcher.js +0 -68
  970. package/.next/standalone/node_modules/next/dist/server/route-matchers/pages-api-route-matcher.js +0 -30
  971. package/.next/standalone/node_modules/next/dist/server/route-matchers/pages-route-matcher.js +0 -30
  972. package/.next/standalone/node_modules/next/dist/server/route-matchers/route-matcher.js +0 -54
  973. /package/.next/standalone/.next/static/{xtcpqBNBdjQVerPMkI2HI → RrRjb2981tB2X7pKdNBUm}/_buildManifest.js +0 -0
  974. /package/.next/standalone/.next/static/{xtcpqBNBdjQVerPMkI2HI → RrRjb2981tB2X7pKdNBUm}/_clientMiddlewareManifest.js +0 -0
  975. /package/.next/standalone/.next/static/{xtcpqBNBdjQVerPMkI2HI → RrRjb2981tB2X7pKdNBUm}/_ssgManifest.js +0 -0
@@ -7,42 +7,44 @@ Object.defineProperty(exports, "__esModule", {
7
7
  MetadataOnlyRequestTree: null,
8
8
  attemptToFulfillDynamicSegmentFromBFCache: null,
9
9
  attemptToUpgradeSegmentFromBFCache: null,
10
+ bufferPrefetchResponseBody: null,
10
11
  canNewFetchStrategyProvideMoreContent: null,
11
- convertReusedFlightRouterStateToRouteTree: null,
12
+ convertFlightRouterStateToRouteTree: null,
12
13
  convertRootFlightRouterStateToRouteTree: null,
13
14
  convertRouteTreeToFlightRouterState: null,
14
15
  createDetachedSegmentCacheEntry: null,
15
16
  createMetadataRouteTree: null,
16
- createNonTaskyPrefetchResponseStream: null,
17
+ createRootRouteTree: null,
17
18
  deprecated_requestOptimisticRouteCacheEntry: null,
19
+ doesRouteStructureMatch: null,
18
20
  fetchRouteOnCacheMiss: null,
19
- fetchSegmentPrefetchesUsingDynamicRequest: null,
20
- fetchSegmentsOnCacheMiss: null,
21
+ fetchSegmentPrefetchesUsingRuntimeRequest: null,
22
+ fetchSegmentPrefetchesUsingStaticRequest: null,
21
23
  fulfillRouteCacheEntry: null,
22
24
  getCurrentRouteCacheVersion: null,
23
25
  getCurrentSegmentCacheVersion: null,
26
+ getHeadRequestKey: null,
24
27
  getStaleTimeMs: null,
25
28
  invalidateEntirePrefetchCache: null,
26
29
  invalidateRouteCacheEntries: null,
27
30
  invalidateSegmentCacheEntries: null,
28
- markRouteEntryAsDynamicRewrite: null,
29
31
  overwriteRevalidatingSegmentCacheEntry: null,
30
32
  pingInvalidationListeners: null,
31
- processRuntimePrefetchStream: null,
32
33
  readOrCreateRevalidatingSegmentEntry: null,
33
34
  readOrCreateRouteCacheEntry: null,
34
35
  readOrCreateSegmentCacheEntry: null,
35
36
  readRouteCacheEntry: null,
36
37
  readSegmentCacheEntryForNavigation: null,
38
+ rebaseInactiveRouteTree: null,
37
39
  resolveStaleAt: null,
38
40
  segmentCacheMap: null,
41
+ spawnStaticStageCacheWrite: null,
39
42
  stripIsPartialByte: null,
40
43
  upgradeToPendingSegment: null,
41
44
  upsertSegmentEntry: null,
42
45
  waitForSegmentCacheEntry: null,
43
- writeDynamicRenderResponseIntoCache: null,
44
- writePrerenderResponseIntoCache: null,
45
- writeRouteIntoCache: null
46
+ writeRouteIntoCache: null,
47
+ writeRuntimePrefetchStreamIntoCache: null
46
48
  });
47
49
  function _export(target, all) {
48
50
  for(var name in all)Object.defineProperty(target, name, {
@@ -63,11 +65,14 @@ _export(exports, {
63
65
  attemptToUpgradeSegmentFromBFCache: function() {
64
66
  return attemptToUpgradeSegmentFromBFCache;
65
67
  },
68
+ bufferPrefetchResponseBody: function() {
69
+ return bufferPrefetchResponseBody;
70
+ },
66
71
  canNewFetchStrategyProvideMoreContent: function() {
67
72
  return canNewFetchStrategyProvideMoreContent;
68
73
  },
69
- convertReusedFlightRouterStateToRouteTree: function() {
70
- return convertReusedFlightRouterStateToRouteTree;
74
+ convertFlightRouterStateToRouteTree: function() {
75
+ return convertFlightRouterStateToRouteTree;
71
76
  },
72
77
  convertRootFlightRouterStateToRouteTree: function() {
73
78
  return convertRootFlightRouterStateToRouteTree;
@@ -81,20 +86,23 @@ _export(exports, {
81
86
  createMetadataRouteTree: function() {
82
87
  return createMetadataRouteTree;
83
88
  },
84
- createNonTaskyPrefetchResponseStream: function() {
85
- return createNonTaskyPrefetchResponseStream;
89
+ createRootRouteTree: function() {
90
+ return createRootRouteTree;
86
91
  },
87
92
  deprecated_requestOptimisticRouteCacheEntry: function() {
88
93
  return deprecated_requestOptimisticRouteCacheEntry;
89
94
  },
95
+ doesRouteStructureMatch: function() {
96
+ return doesRouteStructureMatch;
97
+ },
90
98
  fetchRouteOnCacheMiss: function() {
91
99
  return fetchRouteOnCacheMiss;
92
100
  },
93
- fetchSegmentPrefetchesUsingDynamicRequest: function() {
94
- return fetchSegmentPrefetchesUsingDynamicRequest;
101
+ fetchSegmentPrefetchesUsingRuntimeRequest: function() {
102
+ return fetchSegmentPrefetchesUsingRuntimeRequest;
95
103
  },
96
- fetchSegmentsOnCacheMiss: function() {
97
- return fetchSegmentsOnCacheMiss;
104
+ fetchSegmentPrefetchesUsingStaticRequest: function() {
105
+ return fetchSegmentPrefetchesUsingStaticRequest;
98
106
  },
99
107
  fulfillRouteCacheEntry: function() {
100
108
  return fulfillRouteCacheEntry;
@@ -105,6 +113,9 @@ _export(exports, {
105
113
  getCurrentSegmentCacheVersion: function() {
106
114
  return getCurrentSegmentCacheVersion;
107
115
  },
116
+ getHeadRequestKey: function() {
117
+ return getHeadRequestKey;
118
+ },
108
119
  getStaleTimeMs: function() {
109
120
  return getStaleTimeMs;
110
121
  },
@@ -117,18 +128,12 @@ _export(exports, {
117
128
  invalidateSegmentCacheEntries: function() {
118
129
  return invalidateSegmentCacheEntries;
119
130
  },
120
- markRouteEntryAsDynamicRewrite: function() {
121
- return markRouteEntryAsDynamicRewrite;
122
- },
123
131
  overwriteRevalidatingSegmentCacheEntry: function() {
124
132
  return overwriteRevalidatingSegmentCacheEntry;
125
133
  },
126
134
  pingInvalidationListeners: function() {
127
135
  return pingInvalidationListeners;
128
136
  },
129
- processRuntimePrefetchStream: function() {
130
- return processRuntimePrefetchStream;
131
- },
132
137
  readOrCreateRevalidatingSegmentEntry: function() {
133
138
  return readOrCreateRevalidatingSegmentEntry;
134
139
  },
@@ -144,12 +149,18 @@ _export(exports, {
144
149
  readSegmentCacheEntryForNavigation: function() {
145
150
  return readSegmentCacheEntryForNavigation;
146
151
  },
152
+ rebaseInactiveRouteTree: function() {
153
+ return rebaseInactiveRouteTree;
154
+ },
147
155
  resolveStaleAt: function() {
148
156
  return resolveStaleAt;
149
157
  },
150
158
  segmentCacheMap: function() {
151
159
  return segmentCacheMap;
152
160
  },
161
+ spawnStaticStageCacheWrite: function() {
162
+ return spawnStaticStageCacheWrite;
163
+ },
153
164
  stripIsPartialByte: function() {
154
165
  return stripIsPartialByte;
155
166
  },
@@ -162,18 +173,16 @@ _export(exports, {
162
173
  waitForSegmentCacheEntry: function() {
163
174
  return waitForSegmentCacheEntry;
164
175
  },
165
- writeDynamicRenderResponseIntoCache: function() {
166
- return writeDynamicRenderResponseIntoCache;
167
- },
168
- writePrerenderResponseIntoCache: function() {
169
- return writePrerenderResponseIntoCache;
170
- },
171
176
  writeRouteIntoCache: function() {
172
177
  return writeRouteIntoCache;
178
+ },
179
+ writeRuntimePrefetchStreamIntoCache: function() {
180
+ return writeRuntimePrefetchStreamIntoCache;
173
181
  }
174
182
  });
175
183
  const _approutertypes = require("../../../shared/lib/app-router-types");
176
184
  const _varyparamsdecoding = require("../../../shared/lib/segment-cache/vary-params-decoding");
185
+ const _rsctransport = require("../../../shared/lib/rsc-transport");
177
186
  const _approuterheaders = require("../app-router-headers");
178
187
  const _fetchserverresponse = require("../router-reducer/fetch-server-response");
179
188
  const _fetch = require("./fetch");
@@ -187,17 +196,49 @@ const _segmentvalueencoding = require("../../../shared/lib/segment-cache/segment
187
196
  const _flightdatahelpers = require("../../flight-data-helpers");
188
197
  const _navigatereducer = require("../router-reducer/reducers/navigate-reducer");
189
198
  const _links = require("../links");
190
- const _segment = require("../../../shared/lib/segment");
191
199
  const _types = require("./types");
192
200
  const _promisewithresolvers = require("../../../shared/lib/promise-with-resolvers");
193
201
  const _bfcache = require("./bfcache");
194
202
  const _optimisticroutes = require("./optimistic-routes");
195
- const _navigation = require("./navigation");
203
+ const _decodeserverresponse = require("./decode-server-response");
196
204
  const _navigationbuildid = require("../../navigation-build-id");
197
205
  const _constants = require("../../../lib/constants");
198
206
  function getStaleTimeMs(staleTimeSeconds) {
199
207
  return Math.max(staleTimeSeconds, 30) * 1000;
200
208
  }
209
+ // How long a rejected cache entry blocks re-fetching before it may be
210
+ // retried (its staleAt is set this far in the future).
211
+ const REJECTION_BACKOFF_MS = 10 * 1000;
212
+ /**
213
+ * The staleAt to reject entries with when a prefetch fails: if we're
214
+ * offline, expire immediately (-1) so the entry is re-fetched once the
215
+ * scheduler is re-pinged after connectivity is restored; otherwise apply a
216
+ * short backoff. (Unlike navigations and server actions, prefetches don't
217
+ * await `waitForConnection`.)
218
+ */ function getPrefetchErrorStaleAt(error) {
219
+ if (process.env.__NEXT_USE_OFFLINE) {
220
+ const { checkOfflineError } = require('../offline');
221
+ if (checkOfflineError(error)) {
222
+ return -1;
223
+ }
224
+ }
225
+ return Date.now() + REJECTION_BACKOFF_MS;
226
+ }
227
+ function createRootRouteTree(tree, head) {
228
+ return {
229
+ tree,
230
+ head
231
+ };
232
+ }
233
+ function doesRouteStructureMatch(currentTree, nextTree) {
234
+ // The request key includes the param names and types, but not the values.
235
+ if (currentTree.requestKey !== nextTree.requestKey) {
236
+ return false;
237
+ }
238
+ // The root request key is always empty (even for global Not Found), so we
239
+ // have to compare the root segment directly.
240
+ return nextTree.requestKey !== _segmentvalueencoding.ROOT_SEGMENT_REQUEST_KEY || currentTree.segment === nextTree.segment;
241
+ }
201
242
  const isOutputExportMode = process.env.NODE_ENV === 'production' && process.env.__NEXT_CONFIG_OUTPUT === 'export';
202
243
  const MetadataOnlyRequestTree = [
203
244
  '',
@@ -226,21 +267,21 @@ function getCurrentRouteCacheVersion() {
226
267
  function getCurrentSegmentCacheVersion() {
227
268
  return currentSegmentCacheVersion;
228
269
  }
229
- function invalidateEntirePrefetchCache(nextUrl, tree) {
270
+ function invalidateEntirePrefetchCache(nextUrl, root) {
230
271
  currentRouteCacheVersion++;
231
272
  currentSegmentCacheVersion++;
232
- (0, _links.pingVisibleLinks)(nextUrl, tree);
233
- pingInvalidationListeners(nextUrl, tree);
273
+ (0, _links.pingVisibleLinks)(nextUrl, root);
274
+ pingInvalidationListeners(nextUrl, root);
234
275
  }
235
- function invalidateRouteCacheEntries(nextUrl, tree) {
276
+ function invalidateRouteCacheEntries(nextUrl, root) {
236
277
  currentRouteCacheVersion++;
237
- (0, _links.pingVisibleLinks)(nextUrl, tree);
238
- pingInvalidationListeners(nextUrl, tree);
278
+ (0, _links.pingVisibleLinks)(nextUrl, root);
279
+ pingInvalidationListeners(nextUrl, root);
239
280
  }
240
- function invalidateSegmentCacheEntries(nextUrl, tree) {
281
+ function invalidateSegmentCacheEntries(nextUrl, root) {
241
282
  currentSegmentCacheVersion++;
242
- (0, _links.pingVisibleLinks)(nextUrl, tree);
243
- pingInvalidationListeners(nextUrl, tree);
283
+ (0, _links.pingVisibleLinks)(nextUrl, root);
284
+ pingInvalidationListeners(nextUrl, root);
244
285
  }
245
286
  function attachInvalidationListener(task) {
246
287
  // This function is called whenever a prefetch task reads a cache entry. If
@@ -276,7 +317,7 @@ function notifyInvalidationListener(task) {
276
317
  }
277
318
  }
278
319
  }
279
- function pingInvalidationListeners(nextUrl, tree) {
320
+ function pingInvalidationListeners(nextUrl, root) {
280
321
  // The rough equivalent of pingVisibleLinks, but for onInvalidate callbacks.
281
322
  // This is called when the Next-Url or the base tree changes, since those
282
323
  // may affect the result of a prefetch task. It's also called after a
@@ -285,7 +326,7 @@ function pingInvalidationListeners(nextUrl, tree) {
285
326
  const tasks = invalidationListeners;
286
327
  invalidationListeners = null;
287
328
  for (const task of tasks){
288
- if ((0, _scheduler.isPrefetchTaskDirty)(task, nextUrl, tree)) {
329
+ if ((0, _scheduler.isPrefetchTaskDirty)(task, nextUrl, root)) {
289
330
  notifyInvalidationListener(task);
290
331
  }
291
332
  }
@@ -346,15 +387,14 @@ function createDetachedRouteCacheEntry() {
346
387
  canonicalUrl: null,
347
388
  status: _cachemap.EntryStatus.Empty,
348
389
  blockedTasks: null,
349
- tree: null,
350
- metadata: null,
390
+ root: null,
351
391
  // This is initialized to true because we don't know yet whether the route
352
392
  // could be intercepted. It's only set to false once we receive a response
353
393
  // from the server.
354
394
  couldBeIntercepted: true,
355
395
  // Similarly, we don't yet know if the route supports PPR.
356
396
  supportsPerSegmentPrefetching: false,
357
- hasDynamicRewrite: false,
397
+ predictedFrom: null,
358
398
  renderedSearch: null,
359
399
  // Map-related fields
360
400
  ref: null,
@@ -428,12 +468,13 @@ function deprecated_requestOptimisticRouteCacheEntry(now, requestedUrl, nextUrl)
428
468
  // route was rewritten to a different search string, then the optimistic
429
469
  // route should be rewritten to the same search string. Otherwise, we use
430
470
  // the requested search string.
431
- const optimisticRenderedSearch = routeWithNoSearchParams.renderedSearch !== '' ? routeWithNoSearchParams.renderedSearch : requestedSearch;
471
+ const optimisticRenderedSearch = routeWithNoSearchParams.renderedSearch !== '' ? routeWithNoSearchParams.renderedSearch : (0, _routeparams.normalizeRenderedSearch)(requestedSearch);
432
472
  const optimisticUrl = new URL(routeWithNoSearchParams.canonicalUrl, location.origin);
433
473
  optimisticUrl.search = optimisticCanonicalSearch;
434
474
  const optimisticCanonicalUrl = (0, _createhreffromurl.createHrefFromUrl)(optimisticUrl);
435
- const optimisticRouteTree = deprecated_createOptimisticRouteTree(routeWithNoSearchParams.tree, optimisticRenderedSearch);
436
- const optimisticMetadataTree = deprecated_createOptimisticRouteTree(routeWithNoSearchParams.metadata, optimisticRenderedSearch);
475
+ const optimisticRouteTree = deprecated_createOptimisticRouteTree(routeWithNoSearchParams.root.tree, optimisticRenderedSearch);
476
+ const baseMetadataTree = routeWithNoSearchParams.root.head;
477
+ const optimisticMetadataTree = createMetadataRouteTree((0, _varypath.cloneVaryPathWithNewSearchParams)(baseMetadataTree.varyPath, optimisticRenderedSearch), baseMetadataTree.prefetchHints, null);
437
478
  // Clone the base route tree, and override the relevant fields with our
438
479
  // optimistic values.
439
480
  const optimisticEntry = {
@@ -441,11 +482,10 @@ function deprecated_requestOptimisticRouteCacheEntry(now, requestedUrl, nextUrl)
441
482
  status: _cachemap.EntryStatus.Fulfilled,
442
483
  // This isn't cloned because it's instance-specific
443
484
  blockedTasks: null,
444
- tree: optimisticRouteTree,
445
- metadata: optimisticMetadataTree,
485
+ root: createRootRouteTree(optimisticRouteTree, optimisticMetadataTree),
446
486
  couldBeIntercepted: routeWithNoSearchParams.couldBeIntercepted,
447
487
  supportsPerSegmentPrefetching: routeWithNoSearchParams.supportsPerSegmentPrefetching,
448
- hasDynamicRewrite: routeWithNoSearchParams.hasDynamicRewrite,
488
+ predictedFrom: null,
449
489
  // Override the rendered search with the optimistic value.
450
490
  renderedSearch: optimisticRenderedSearch,
451
491
  // Map-related fields
@@ -469,28 +509,17 @@ function deprecated_createOptimisticRouteTree(tree, newRenderedSearch) {
469
509
  clonedSlots.set(parallelRouteKey, deprecated_createOptimisticRouteTree(childTree, newRenderedSearch));
470
510
  }
471
511
  }
472
- // We only need to clone the vary path if the route is a page.
473
- if (tree.isPage) {
474
- // The shell vary path Fallbacks search params, so it's unaffected by the
475
- // new rendered search and can be reused as-is.
476
- return {
477
- requestKey: tree.requestKey,
478
- segment: tree.segment,
479
- shellVaryPath: tree.shellVaryPath,
480
- refreshState: tree.refreshState,
481
- varyPath: (0, _varypath.clonePageVaryPathWithNewSearchParams)(tree.varyPath, newRenderedSearch),
482
- isPage: true,
483
- slots: clonedSlots,
484
- prefetchHints: tree.prefetchHints
485
- };
486
- }
512
+ // The shell vary path Fallbacks search params, so it's unaffected by the
513
+ // new rendered search and can be reused as-is.
487
514
  return {
488
515
  requestKey: tree.requestKey,
489
516
  segment: tree.segment,
490
517
  shellVaryPath: tree.shellVaryPath,
491
518
  refreshState: tree.refreshState,
492
- varyPath: tree.varyPath,
493
- isPage: false,
519
+ // Optimistic trees are structure-only. (The input tree comes from the
520
+ // route cache, which never carries render output.)
521
+ data: null,
522
+ varyPath: (0, _varypath.cloneVaryPathWithNewSearchParams)(tree.varyPath, newRenderedSearch),
494
523
  slots: clonedSlots,
495
524
  prefetchHints: tree.prefetchHints
496
525
  };
@@ -583,6 +612,14 @@ map, fetchStrategy, tree) {
583
612
  * strategy content tiers (how much content a strategy can produce), not the
584
613
  * vary-path specificity the eviction docs are concerned with.
585
614
  */ function isExistingSegmentEntryPreferred(existingEntry, candidateEntry) {
615
+ if (existingEntry.status === _cachemap.EntryStatus.Empty) {
616
+ // An Empty entry is a placeholder that carries no data, and its
617
+ // fetchStrategy is a spawn-time default, not a fact about any content —
618
+ // it must never win a precedence comparison. (Without this, a candidate
619
+ // fetched at a tier below the placeholder's default would be discarded
620
+ // in favor of an entry with nothing in it.)
621
+ return false;
622
+ }
586
623
  return(// We fetched the new segment using a different, less specific fetch
587
624
  // strategy than the segment we already have in the cache, so it can't
588
625
  // have more content.
@@ -692,9 +729,10 @@ lookupVaryPath) {
692
729
  * upsert applies at its own keypath — we know we never want to match against
693
730
  * it again, so delete it, making the candidate reachable.
694
731
  *
695
- * Non-settled entries are never evicted here: a Pending entry is owned by an
696
- * in-flight request that will settle it, and an Empty entry is a placeholder
697
- * that a scheduler pass may still claim and upgrade.
732
+ * Pending entries are never evicted here: they're owned by an in-flight
733
+ * request that will settle them. Empty entries ARE evictable — they're
734
+ * unclaimed placeholders with nothing in them, so they must not shadow real
735
+ * data; their blocked tasks are pinged so they re-run against the candidate.
698
736
  */ function evictShadowingSegmentEntries(now, map, lookupVaryPath, candidateEntry) {
699
737
  // There can in principle be multiple shadowing entries at successively less
700
738
  // specific keypaths, so loop until the read returns the candidate (or an
@@ -712,9 +750,13 @@ lookupVaryPath) {
712
750
  // entirely, e.g. because the candidate expired). Done.
713
751
  return;
714
752
  }
715
- if (shadowEntry.status !== _cachemap.EntryStatus.Fulfilled && shadowEntry.status !== _cachemap.EntryStatus.Rejected) {
716
- // Only settled entries may be evicted. A Pending entry is held by an
717
- // in-flight request and will settle on its own.
753
+ if (shadowEntry.status === _cachemap.EntryStatus.Pending) {
754
+ // A Pending entry may not be evicted: it's held by an in-flight
755
+ // request and will settle on its own. (An Empty shadow entry, by
756
+ // contrast, is an unclaimed placeholder with nothing in it — never
757
+ // preferred over the candidate, per isExistingSegmentEntryPreferred —
758
+ // so it falls through to the eviction below, waking any tasks blocked
759
+ // on it so they re-run and find the candidate.)
718
760
  return;
719
761
  }
720
762
  if (isExistingSegmentEntryPreferred(shadowEntry, candidateEntry)) {
@@ -725,8 +767,9 @@ lookupVaryPath) {
725
767
  }
726
768
  // The candidate supersedes the shadowing entry. Evict it. Settled entries
727
769
  // shouldn't have blocked tasks (Fulfilled always has `blockedTasks:
728
- // null`, and Rejected entries were pinged at rejection), but ping
729
- // defensively before deleting, matching the upsert-evict pattern above.
770
+ // null`, and Rejected entries were pinged at rejection), but an Empty
771
+ // entry may have them — ping before deleting, matching the upsert-evict
772
+ // pattern above.
730
773
  pingBlockedTasks(shadowEntry);
731
774
  (0, _cachemap.deleteFromCacheMap)(shadowEntry);
732
775
  }
@@ -758,9 +801,14 @@ function upgradeToPendingSegment(emptyEntry, fetchStrategy) {
758
801
  pendingEntry.status = _cachemap.EntryStatus.Pending;
759
802
  pendingEntry.fetchStrategy = fetchStrategy;
760
803
  if (fetchStrategy === _types.FetchStrategy.Full) {
761
- // We can assume the response will contain the full segment data. Set this
762
- // to false so we know it's OK to omit this segment from any navigation
763
- // requests that may happen while the data is still pending.
804
+ // The Pending-Full convention: pre-set isPartial to false before any
805
+ // data exists. Normally partiality is absolute — anything unresolved in
806
+ // the entry's output makes it true, and a pending entry has no output at
807
+ // all — but a Full response is a complete navigation payload, so this
808
+ // segment may already be omitted from navigation requests that happen
809
+ // while the data is still in flight. That "may be omitted" signal is
810
+ // exactly what isPartial: false means to a navigation, so this
811
+ // deliberately breaks the absolute definition for the pending window.
764
812
  pendingEntry.isPartial = false;
765
813
  }
766
814
  // Set the version here, since this is right before the request is initiated.
@@ -795,7 +843,7 @@ function attemptToFulfillDynamicSegmentFromBFCache(now, segment, tree) {
795
843
  }
796
844
  const pendingSegment = upgradeToPendingSegment(segment, _types.FetchStrategy.Full);
797
845
  const isPartial = false;
798
- return fulfillSegmentCacheEntry(pendingSegment, bfcacheEntry.rsc, dynamicPrefetchStaleAt, isPartial, // bfcache data is concrete, never an ISR fallback.
846
+ return fulfillSegmentCacheEntry(pendingSegment, bfcacheEntry.rsc, dynamicPrefetchStaleAt, isPartial, bfcacheEntry.varyParams, // bfcache data is concrete, never an ISR fallback.
799
847
  false, _types.FetchStrategy.Full);
800
848
  }
801
849
  return null;
@@ -811,7 +859,7 @@ map, tree) {
811
859
  }
812
860
  const pendingSegment = upgradeToPendingSegment(createDetachedSegmentCacheEntry(now), _types.FetchStrategy.Full);
813
861
  const isPartial = false;
814
- const newEntry = fulfillSegmentCacheEntry(pendingSegment, bfcacheEntry.rsc, dynamicPrefetchStaleAt, isPartial, // bfcache data is concrete, never an ISR fallback.
862
+ const newEntry = fulfillSegmentCacheEntry(pendingSegment, bfcacheEntry.rsc, dynamicPrefetchStaleAt, isPartial, bfcacheEntry.varyParams, // bfcache data is concrete, never an ISR fallback.
815
863
  false, _types.FetchStrategy.Full);
816
864
  const segmentVaryPath = (0, _varypath.getSegmentVaryPathForRequest)(_types.FetchStrategy.Full, tree);
817
865
  const upserted = upsertSegmentEntry(now, map, segmentVaryPath, newEntry, // The concrete lookup path this BFCache upgrade applies to. (In
@@ -833,33 +881,87 @@ function pingBlockedTasks(entry) {
833
881
  entry.blockedTasks = null;
834
882
  }
835
883
  }
836
- function createMetadataRouteTree(metadataVaryPath) {
837
- // The Head is not actually part of the route tree, but other than that, it's
838
- // fetched and cached like a segment. Some functions expect a RouteTree
839
- // object, so rather than fork the logic in all those places, we use this
840
- // "fake" one.
884
+ function getHeadRequestKey(pageRequestKey) {
885
+ return pageRequestKey + _segmentvalueencoding.HEAD_REQUEST_KEY;
886
+ }
887
+ function createMetadataRouteTree(metadataVaryPath, // The route root's prefetch hints. The head has no node of its own on the
888
+ // wire, so the route-level hint that applies to it is copied from the root.
889
+ rootPrefetchHints, // The head's payload, with the same lifetimes as a segment node's `data`
890
+ // (see RouteTree): null in the route cache, the response's decoded
891
+ // head on a navigation seed, a CacheNode on the router state.
892
+ data) {
893
+ // The head is a one-node tree beside the route tree (see RootRouteTree). It
894
+ // has no position in the route tree, but it's fetched, cached, compared, and
895
+ // rendered like a segment, so it is a RouteTree node like any other.
841
896
  const metadata = {
842
- requestKey: _segmentvalueencoding.HEAD_REQUEST_KEY,
897
+ // The first entry of the head's vary path (see getHeadRequestKey). The
898
+ // server knows nothing of this key; it is always asked for
899
+ // HEAD_REQUEST_KEY, which is why the segment stays the bare marker.
900
+ requestKey: metadataVaryPath.value,
843
901
  segment: _segmentvalueencoding.HEAD_REQUEST_KEY,
844
902
  shellVaryPath: (0, _varypath.getShellSegmentVaryPath)(metadataVaryPath),
845
903
  refreshState: null,
904
+ data,
846
905
  varyPath: metadataVaryPath,
847
- // The metadata isn't really a "page" (though it isn't really a "segment"
848
- // either) but for the purposes of how this field is used, it behaves like
849
- // one. If this logic ever gets more complex we can change this to an enum.
850
- isPage: true,
851
906
  slots: null,
852
- prefetchHints: 0
907
+ // Only the static-attempt bits apply to the head: it's a route-level
908
+ // fact ("static per-segment responses may exist for this route"), and
909
+ // it's what lets a shell-tier cached head attempt a static head fetch
910
+ // before deopting to a runtime request (see the shell-tier eligibility
911
+ // check in pingSegmentBundle). The other bits describe tree structure
912
+ // the head doesn't participate in.
913
+ prefetchHints: rootPrefetchHints & _approutertypes.StaticAttemptHints
853
914
  };
854
915
  return metadata;
855
916
  }
856
- function fulfillRouteCacheEntry(now, entry, tree, metadataVaryPath, couldBeIntercepted, canonicalUrl, supportsPerSegmentPrefetching) {
857
- // Get the rendered search from the vary path
858
- const renderedSearch = (0, _varypath.getRenderedSearchFromVaryPath)(metadataVaryPath) ?? '';
917
+ /**
918
+ * Returns an equivalent tree with `data: null` at every node, cloning only
919
+ * the subtrees that carry data. Called when a tree is stored in the route
920
+ * cache: route cache entries live indefinitely, so retaining render output
921
+ * there would pin RSC payloads in memory outside the segment cache's eviction
922
+ * control. See the lifecycle note on RouteTree.
923
+ */ function stripDataFromRouteTree(tree) {
924
+ let clonedSlots = null;
925
+ const slots = tree.slots;
926
+ if (slots !== null) {
927
+ for (const [parallelRouteKey, childTree] of slots){
928
+ const strippedChild = stripDataFromRouteTree(childTree);
929
+ if (strippedChild !== childTree && clonedSlots === null) {
930
+ // Sound cast: any copied value that isn't overwritten below is one
931
+ // where stripDataFromRouteTree returned the child unchanged, which
932
+ // means that subtree carries no data.
933
+ clonedSlots = new Map(slots);
934
+ }
935
+ if (clonedSlots !== null) {
936
+ clonedSlots.set(parallelRouteKey, strippedChild);
937
+ }
938
+ }
939
+ }
940
+ if (tree.data === null && clonedSlots === null) {
941
+ // Neither this node nor any descendant carries data. Reuse it as-is.
942
+ // This is the common case for trees that never carried render output
943
+ // (e.g. route tree prefetch responses). Sound cast for the same reason.
944
+ return tree;
945
+ }
946
+ // Sound cast: clonedSlots is null here only if every child subtree was
947
+ // verified data-free by the loop above.
948
+ const strippedSlots = clonedSlots ?? slots;
949
+ return {
950
+ requestKey: tree.requestKey,
951
+ segment: tree.segment,
952
+ shellVaryPath: tree.shellVaryPath,
953
+ refreshState: tree.refreshState,
954
+ data: null,
955
+ varyPath: tree.varyPath,
956
+ slots: strippedSlots,
957
+ prefetchHints: tree.prefetchHints
958
+ };
959
+ }
960
+ function fulfillRouteCacheEntry(now, entry, root, couldBeIntercepted, canonicalUrl, renderedSearch, supportsPerSegmentPrefetching) {
961
+ const tree = root.tree;
859
962
  const fulfilledEntry = entry;
860
963
  fulfilledEntry.status = _cachemap.EntryStatus.Fulfilled;
861
- fulfilledEntry.tree = tree;
862
- fulfilledEntry.metadata = createMetadataRouteTree(metadataVaryPath);
964
+ fulfilledEntry.root = createRootRouteTree(stripDataFromRouteTree(tree), stripDataFromRouteTree(root.head));
863
965
  // Route structure is essentially static — it only changes on deploy.
864
966
  // Always use the static stale time.
865
967
  // NOTE: An exception is rewrites/redirects in middleware or proxy, which can
@@ -879,25 +981,18 @@ function fulfillRouteCacheEntry(now, entry, tree, metadataVaryPath, couldBeInter
879
981
  fulfilledEntry.canonicalUrl = canonicalUrl;
880
982
  fulfilledEntry.renderedSearch = renderedSearch;
881
983
  fulfilledEntry.supportsPerSegmentPrefetching = supportsPerSegmentPrefetching;
882
- fulfilledEntry.hasDynamicRewrite = false;
883
984
  pingBlockedTasks(entry);
884
985
  return fulfilledEntry;
885
986
  }
886
- function writeRouteIntoCache(now, pathname, search, nextUrl, tree, metadataVaryPath, couldBeIntercepted, canonicalUrl, supportsPerSegmentPrefetching) {
987
+ function writeRouteIntoCache(now, pathname, search, nextUrl, root, couldBeIntercepted, canonicalUrl, renderedSearch, supportsPerSegmentPrefetching) {
887
988
  const pendingEntry = createDetachedRouteCacheEntry();
888
- const fulfilledEntry = fulfillRouteCacheEntry(now, pendingEntry, tree, metadataVaryPath, couldBeIntercepted, canonicalUrl, supportsPerSegmentPrefetching);
989
+ const fulfilledEntry = fulfillRouteCacheEntry(now, pendingEntry, root, couldBeIntercepted, canonicalUrl, renderedSearch, supportsPerSegmentPrefetching);
889
990
  const varyPath = (0, _varypath.getFulfilledRouteVaryPath)(pathname, search, nextUrl, couldBeIntercepted);
890
991
  const isRevalidation = false;
891
992
  (0, _cachemap.setInCacheMap)(routeCacheMap, varyPath, fulfilledEntry, isRevalidation);
892
993
  return fulfilledEntry;
893
994
  }
894
- function markRouteEntryAsDynamicRewrite(entry) {
895
- entry.hasDynamicRewrite = true;
896
- // Note: The caller is responsible for also calling invalidateRouteCacheEntries
897
- // to invalidate other entries that may have been derived from this template
898
- // before we knew it had a dynamic rewrite.
899
- }
900
- function fulfillSegmentCacheEntry(segmentCacheEntry, rsc, staleAt, isPartial, // Only static (per-segment PPR) responses can be ISR fallbacks; all other
995
+ function fulfillSegmentCacheEntry(segmentCacheEntry, rsc, staleAt, isPartial, varyParams, // Only static (per-segment PPR) responses can be ISR fallbacks; all other
901
996
  // callers pass false. Always assigned (even when false) so that re-fulfilling
902
997
  // a previously-fallback entry with a concrete response clears the flag and
903
998
  // ends the retry loop.
@@ -906,7 +1001,7 @@ isUpgradeableISRFallback, // The strategy tier describing the CONTENT this entry
906
1001
  // Usually the two agree, but when a response's shell payload IS the full
907
1002
  // response (no shell/full split), shell-spawned entries are fulfilled with
908
1003
  // full-tier content and recorded as such (see the promotion in
909
- // writeSegmentBundleResponse). Always assigned, replacing
1004
+ // writeSegmentDataIntoCache). Always assigned, replacing
910
1005
  // the spawn-time strategy set by upgradeToPendingSegment; the write walks'
911
1006
  // matching and keying decisions all happen against the spawn-time
912
1007
  // strategy, before fulfillment, so they are unaffected. See
@@ -917,6 +1012,7 @@ fetchStrategy) {
917
1012
  fulfilledEntry.rsc = rsc;
918
1013
  fulfilledEntry.staleAt = staleAt;
919
1014
  fulfilledEntry.isPartial = isPartial;
1015
+ fulfilledEntry.varyParams = varyParams;
920
1016
  fulfilledEntry.isUpgradeableISRFallback = isUpgradeableISRFallback;
921
1017
  fulfilledEntry.fetchStrategy = fetchStrategy;
922
1018
  // Resolve any listeners that were waiting for this data.
@@ -946,127 +1042,33 @@ function rejectSegmentCacheEntry(entry, staleAt) {
946
1042
  }
947
1043
  pingBlockedTasks(entry);
948
1044
  }
949
- function convertRootTreePrefetchToRouteTree(rootTree, renderedPathname, renderedSearch, acc) {
950
- // Remove trailing and leading slashes
951
- const pathnameParts = (0, _cachekey.splitPathnameIntoParts)(renderedPathname);
952
- const index = 0;
953
- const rootSegment = _segmentvalueencoding.ROOT_SEGMENT_REQUEST_KEY;
954
- return convertTreePrefetchToRouteTree(rootTree.tree, rootSegment, null, _segmentvalueencoding.ROOT_SEGMENT_REQUEST_KEY, pathnameParts, index, renderedSearch, acc);
955
- }
956
- function convertTreePrefetchToRouteTree(prefetch, segment, partialVaryPath, requestKey, pathnameParts, pathnamePartsIndex, renderedSearch, acc) {
957
- // Converts the route tree sent by the server into the format used by the
958
- // cache. The cached version of the tree includes additional fields, such as a
959
- // cache key for each segment. Since this is frequently accessed, we compute
960
- // it once instead of on every access. This same cache key is also used to
961
- // request the segment from the server.
1045
+ function convertRootFlightRouterStateToRouteTree(flightRouterState, renderedSearch, acc) {
1046
+ return convertFlightRouterStateToRouteTree(flightRouterState, _segmentvalueencoding.ROOT_SEGMENT_REQUEST_KEY, null, renderedSearch, acc);
1047
+ }
1048
+ function rebaseInactiveRouteTree(treeToRebase) {
1049
+ // A parallel route slot that the target route doesn't provide keeps the
1050
+ // slot already active on the current route, under the new parent. The slot
1051
+ // sits at the same route position, so its request keys and vary paths are
1052
+ // unchanged: copy the structure and drop the payloads, which belong to the
1053
+ // previous render and are reused separately by render-tree.
962
1054
  let slots = null;
963
- let isPage;
964
- let varyPath;
965
- const prefetchSlots = prefetch.slots;
966
- if (prefetchSlots !== null) {
967
- isPage = false;
968
- varyPath = (0, _varypath.finalizeLayoutVaryPath)(requestKey, partialVaryPath);
1055
+ if (treeToRebase.slots !== null) {
969
1056
  slots = new Map();
970
- for(let parallelRouteKey in prefetchSlots){
971
- const childPrefetch = prefetchSlots[parallelRouteKey];
972
- const childSegmentName = childPrefetch.name;
973
- const childParam = childPrefetch.param;
974
- let childDoesAppearInURL;
975
- let childSegment;
976
- let childPartialVaryPath;
977
- if (childParam !== null) {
978
- // This segment is parameterized. Get the param from the pathname.
979
- const childParamValue = (0, _routeparams.parseDynamicParamFromURLPart)(childParam.type, pathnameParts, pathnamePartsIndex);
980
- // Assign a cache key to the segment, based on the param value. In the
981
- // pre-Segment Cache implementation, the server computes this and sends
982
- // it in the body of the response. In the Segment Cache implementation,
983
- // the server sends an empty string and we fill it in here.
984
- // TODO: We're intentionally not adding the search param to page
985
- // segments here; it's tracked separately and added back during a read.
986
- // This would clearer if we waited to construct the segment until it's
987
- // read from the cache, since that's effectively what we're
988
- // doing anyway.
989
- const childParamKey = // The server omits this field from the prefetch response when
990
- // cacheComponents is enabled.
991
- childParam.key !== null ? childParam.key : (0, _routeparams.getCacheKeyForDynamicParam)(childParamValue, '');
992
- childPartialVaryPath = (0, _varypath.appendLayoutVaryPath)(partialVaryPath, childParamKey, childSegmentName, // The child's param is a root param iff the child segment is at or
993
- // above the root layout, which the server marks directly.
994
- (childPrefetch.prefetchHints & _approutertypes.PrefetchHint.IsRootLayoutOrAbove) !== 0);
995
- childSegment = [
996
- childSegmentName,
997
- childParamKey,
998
- childParam.type,
999
- childParam.siblings
1000
- ];
1001
- childDoesAppearInURL = true;
1002
- } else {
1003
- // This segment does not have a param. Inherit the partial vary path of
1004
- // the parent.
1005
- childPartialVaryPath = partialVaryPath;
1006
- childSegment = childSegmentName;
1007
- childDoesAppearInURL = (0, _routeparams.doesStaticSegmentAppearInURL)(childSegmentName);
1008
- }
1009
- // Only increment the index if the segment appears in the URL. If it's a
1010
- // "virtual" segment, like a route group, it remains the same.
1011
- const childPathnamePartsIndex = childDoesAppearInURL ? pathnamePartsIndex + 1 : pathnamePartsIndex;
1012
- const childRequestKeyPart = (0, _segmentvalueencoding.createSegmentRequestKeyPart)(childSegment);
1013
- const childRequestKey = (0, _segmentvalueencoding.appendSegmentRequestKeyPart)(requestKey, parallelRouteKey, childRequestKeyPart);
1014
- slots.set(parallelRouteKey, convertTreePrefetchToRouteTree(childPrefetch, childSegment, childPartialVaryPath, childRequestKey, pathnameParts, childPathnamePartsIndex, renderedSearch, acc));
1015
- }
1016
- } else {
1017
- if (requestKey.endsWith(_segment.PAGE_SEGMENT_KEY)) {
1018
- // This is a page segment.
1019
- isPage = true;
1020
- varyPath = (0, _varypath.finalizePageVaryPath)(requestKey, renderedSearch, partialVaryPath);
1021
- // The metadata "segment" is not part the route tree, but it has the same
1022
- // conceptual params as a page segment. Write the vary path into the
1023
- // accumulator object. If there are multiple parallel pages, we use the
1024
- // first one. Which page we choose is arbitrary as long as it's
1025
- // consistently the same one every time every time. See
1026
- // finalizeMetadataVaryPath for more details.
1027
- if (acc.metadataVaryPath === null) {
1028
- acc.metadataVaryPath = (0, _varypath.finalizeMetadataVaryPath)(requestKey, renderedSearch, partialVaryPath);
1029
- }
1030
- } else {
1031
- // This is a layout segment.
1032
- isPage = false;
1033
- varyPath = (0, _varypath.finalizeLayoutVaryPath)(requestKey, partialVaryPath);
1057
+ for (const [parallelRouteKey, child] of treeToRebase.slots){
1058
+ slots.set(parallelRouteKey, rebaseInactiveRouteTree(child));
1034
1059
  }
1035
1060
  }
1036
1061
  return {
1037
- requestKey,
1038
- segment,
1039
- shellVaryPath: (0, _varypath.getShellSegmentVaryPath)(varyPath),
1040
- refreshState: null,
1041
- // TODO: Cheating the type system here a bit because TypeScript can't tell
1042
- // that the type of isPage and varyPath are consistent. The fix would be to
1043
- // create separate constructors and call the appropriate one from each of
1044
- // the branches above. Just seems a bit overkill only for one field so I'll
1045
- // leave it as-is for now. If isPage were wrong it would break the behavior
1046
- // and we'd catch it quickly, anyway.
1047
- varyPath: varyPath,
1048
- isPage: isPage,
1062
+ requestKey: treeToRebase.requestKey,
1063
+ segment: treeToRebase.segment,
1064
+ varyPath: treeToRebase.varyPath,
1065
+ shellVaryPath: treeToRebase.shellVaryPath,
1066
+ refreshState: treeToRebase.refreshState,
1067
+ data: null,
1049
1068
  slots,
1050
- prefetchHints: prefetch.prefetchHints
1069
+ prefetchHints: treeToRebase.prefetchHints
1051
1070
  };
1052
1071
  }
1053
- function convertRootFlightRouterStateToRouteTree(flightRouterState, renderedSearch, acc) {
1054
- return convertFlightRouterStateToRouteTree(flightRouterState, _segmentvalueencoding.ROOT_SEGMENT_REQUEST_KEY, null, renderedSearch, acc);
1055
- }
1056
- function convertReusedFlightRouterStateToRouteTree(parentRouteTree, parallelRouteKey, flightRouterState, renderedSearch, acc) {
1057
- // Create a RouteTree for a FlightRouterState that was reused from an older
1058
- // route. This happens during a navigation when a parallel route slot does not
1059
- // match the target route; we reuse whatever slot was already active.
1060
- // Unlike a FlightRouterState, the RouteTree type contains backreferences to
1061
- // the parent segments. Append the vary path to the parent's vary path.
1062
- const parentPartialVaryPath = parentRouteTree.isPage ? (0, _varypath.getPartialPageVaryPath)(parentRouteTree.varyPath) : (0, _varypath.getPartialLayoutVaryPath)(parentRouteTree.varyPath);
1063
- const segment = flightRouterState[0];
1064
- // And the request key.
1065
- const parentRequestKey = parentRouteTree.requestKey;
1066
- const requestKeyPart = (0, _segmentvalueencoding.createSegmentRequestKeyPart)(segment);
1067
- const requestKey = (0, _segmentvalueencoding.appendSegmentRequestKeyPart)(parentRequestKey, parallelRouteKey, requestKeyPart);
1068
- return convertFlightRouterStateToRouteTree(flightRouterState, requestKey, parentPartialVaryPath, renderedSearch, acc);
1069
- }
1070
1072
  function convertFlightRouterStateToRouteTree(flightRouterState, requestKey, parentPartialVaryPath, parentRenderedSearch, acc) {
1071
1073
  const originalSegment = flightRouterState[0];
1072
1074
  // This segment's param (if any) is a root param iff the segment is at or
@@ -1081,52 +1083,12 @@ function convertFlightRouterStateToRouteTree(flightRouterState, requestKey, pare
1081
1083
  canonicalUrl: compressedRefreshState[0],
1082
1084
  renderedSearch: compressedRefreshState[1]
1083
1085
  } : null;
1086
+ // Use the incoming search params, even if the response has no new data for
1087
+ // this segment. The base tree may still have the previous URL's. History
1088
+ // restores pass in their saved search params instead.
1084
1089
  const renderedSearch = refreshState !== null ? refreshState.renderedSearch : parentRenderedSearch;
1085
- let segment;
1086
- let partialVaryPath;
1087
- let isPage;
1088
- let varyPath;
1089
- if (Array.isArray(originalSegment)) {
1090
- isPage = false;
1091
- const paramCacheKey = originalSegment[1];
1092
- const paramName = originalSegment[0];
1093
- partialVaryPath = (0, _varypath.appendLayoutVaryPath)(parentPartialVaryPath, paramCacheKey, paramName, isRootParam);
1094
- varyPath = (0, _varypath.finalizeLayoutVaryPath)(requestKey, partialVaryPath);
1095
- segment = originalSegment;
1096
- } else {
1097
- // This segment does not have a param. Inherit the partial vary path of
1098
- // the parent.
1099
- partialVaryPath = parentPartialVaryPath;
1100
- if (requestKey.endsWith(_segment.PAGE_SEGMENT_KEY)) {
1101
- // This is a page segment.
1102
- isPage = true;
1103
- // The navigation implementation expects the search params to be included
1104
- // in the segment. However, in the case of a static response, the search
1105
- // params are omitted. So the client needs to add them back in when reading
1106
- // from the Segment Cache.
1107
- //
1108
- // For consistency, we'll do this for dynamic responses, too.
1109
- //
1110
- // TODO: We should move search params out of FlightRouterState and handle
1111
- // them entirely on the client, similar to our plan for dynamic params.
1112
- segment = _segment.PAGE_SEGMENT_KEY;
1113
- varyPath = (0, _varypath.finalizePageVaryPath)(requestKey, renderedSearch, partialVaryPath);
1114
- // The metadata "segment" is not part the route tree, but it has the same
1115
- // conceptual params as a page segment. Write the vary path into the
1116
- // accumulator object. If there are multiple parallel pages, we use the
1117
- // first one. Which page we choose is arbitrary as long as it's
1118
- // consistently the same one every time every time. See
1119
- // finalizeMetadataVaryPath for more details.
1120
- if (acc.metadataVaryPath === null) {
1121
- acc.metadataVaryPath = (0, _varypath.finalizeMetadataVaryPath)(requestKey, renderedSearch, partialVaryPath);
1122
- }
1123
- } else {
1124
- // This is a layout segment.
1125
- isPage = false;
1126
- segment = originalSegment;
1127
- varyPath = (0, _varypath.finalizeLayoutVaryPath)(requestKey, partialVaryPath);
1128
- }
1129
- }
1090
+ const tree = (0, _decodeserverresponse.createRouteTreeNode)(originalSegment, isRootParam, requestKey, parentPartialVaryPath, renderedSearch, refreshState, acc);
1091
+ const partialVaryPath = (0, _varypath.getPartialVaryPath)(tree.varyPath);
1130
1092
  let slots = null;
1131
1093
  const parallelRoutes = flightRouterState[1];
1132
1094
  for(let parallelRouteKey in parallelRoutes){
@@ -1143,22 +1105,9 @@ function convertFlightRouterStateToRouteTree(flightRouterState, requestKey, pare
1143
1105
  }
1144
1106
  slots.set(parallelRouteKey, childTree);
1145
1107
  }
1146
- return {
1147
- requestKey,
1148
- segment,
1149
- shellVaryPath: (0, _varypath.getShellSegmentVaryPath)(varyPath),
1150
- refreshState,
1151
- // TODO: Cheating the type system here a bit because TypeScript can't tell
1152
- // that the type of isPage and varyPath are consistent. The fix would be to
1153
- // create separate constructors and call the appropriate one from each of
1154
- // the branches above. Just seems a bit overkill only for one field so I'll
1155
- // leave it as-is for now. If isPage were wrong it would break the behavior
1156
- // and we'd catch it quickly, anyway.
1157
- varyPath: varyPath,
1158
- isPage: isPage,
1159
- slots,
1160
- prefetchHints: flightRouterState[4] ?? 0
1161
- };
1108
+ tree.slots = slots;
1109
+ tree.prefetchHints = flightRouterState[4] ?? 0;
1110
+ return tree;
1162
1111
  }
1163
1112
  function convertRouteTreeToFlightRouterState(routeTree) {
1164
1113
  const parallelRoutes = {};
@@ -1179,9 +1128,7 @@ function convertRouteTreeToFlightRouterState(routeTree) {
1179
1128
  }
1180
1129
  return flightRouterState;
1181
1130
  }
1182
- async function fetchRouteOnCacheMiss(entry, key, // The spawning task's `PrefetchTask.segmentCacheMap`, for the legacy
1183
- // branch that writes segment data included in the tree response.
1184
- map) {
1131
+ async function fetchRouteOnCacheMiss(entry, key) {
1185
1132
  // This function is allowed to use async/await because it contains the actual
1186
1133
  // fetch that gets issued on a cache miss. Notice it writes the result to the
1187
1134
  // cache entry directly, rather than return data that is then written by
@@ -1247,7 +1194,7 @@ map) {
1247
1194
  //
1248
1195
  // Note that we can't use headResponse.ok here, because
1249
1196
  // Response#ok returns `false` with 3xx responses.
1250
- rejectRouteCacheEntry(entry, Date.now() + 10 * 1000);
1197
+ rejectRouteCacheEntry(entry, Date.now() + REJECTION_BACKOFF_MS);
1251
1198
  return null;
1252
1199
  }
1253
1200
  urlAfterRedirects = headResponse.redirected ? new URL(headResponse.url) : url;
@@ -1263,7 +1210,7 @@ map) {
1263
1210
  if (!response || !response.ok || !response.body) {
1264
1211
  // Server responded with an error, or with a miss. We should still cache
1265
1212
  // the response, but we can try again after 10 seconds.
1266
- rejectRouteCacheEntry(entry, Date.now() + 10 * 1000);
1213
+ rejectRouteCacheEntry(entry, Date.now() + REJECTION_BACKOFF_MS);
1267
1214
  return null;
1268
1215
  }
1269
1216
  // TODO: The canonical URL is the href without the origin. I think
@@ -1291,77 +1238,66 @@ map) {
1291
1238
  // prefetches, which use incremental streaming. Consider removing the
1292
1239
  // `closed` plumbing for buffered prefetch paths.
1293
1240
  const closed = (0, _promisewithresolvers.createPromiseWithResolvers)();
1294
- // This checks whether the response was served from the per-segment cache,
1295
- // rather than the old prefetching flow. If it fails, it implies that PPR
1296
- // is disabled on this route.
1297
- const routeIsPPREnabled = response.headers.get(_approuterheaders.NEXT_DID_POSTPONE_HEADER) === '2' || // In output: "export" mode, we can't rely on response headers. But if we
1298
- // receive a well-formed response, we can assume it's a static response,
1299
- // because all data is static in this mode.
1300
- isOutputExportMode;
1301
- if (routeIsPPREnabled) {
1302
- const { stream: prefetchStream, size: responseSize } = await createNonTaskyPrefetchResponseStream(response.body);
1303
- closed.resolve();
1304
- (0, _cachemap.setSizeInCacheMap)(entry, responseSize);
1305
- const serverData = await (0, _fetchserverresponse.createFromNextReadableStream)(prefetchStream, headers, {
1306
- allowPartialStream: true
1307
- });
1308
- if ((response.headers.get(_constants.NEXT_NAV_DEPLOYMENT_ID_HEADER) ?? serverData.buildId) !== (0, _navigationbuildid.getNavigationBuildId)()) {
1309
- // The server build does not match the client. Treat as a 404. During
1310
- // an actual navigation, the router will trigger an MPA navigation.
1311
- // TODO: We should cache the fact that this is an MPA navigation.
1312
- rejectRouteCacheEntry(entry, Date.now() + 10 * 1000);
1313
- return null;
1314
- }
1315
- // Get the params that were used to render the target page. These may
1316
- // be different from the params in the request URL, if the page
1317
- // was rewritten.
1318
- const renderedPathname = (0, _routeparams.getRenderedPathname)(response);
1319
- const renderedSearch = (0, _routeparams.getRenderedSearch)(response);
1320
- // Convert the server-sent data into the RouteTree format used by the
1321
- // client cache.
1322
- //
1323
- // During this traversal, we accumulate additional data into this
1324
- // "accumulator" object.
1325
- const acc = {
1326
- metadataVaryPath: null,
1327
- treeDivergedFromBase: false
1328
- };
1329
- const routeTree = convertRootTreePrefetchToRouteTree(serverData, renderedPathname, renderedSearch, acc);
1330
- const metadataVaryPath = acc.metadataVaryPath;
1331
- if (metadataVaryPath === null) {
1332
- rejectRouteCacheEntry(entry, Date.now() + 10 * 1000);
1333
- return null;
1334
- }
1335
- (0, _optimisticroutes.discoverKnownRoute)(Date.now(), pathname, search, nextUrl, entry, routeTree, metadataVaryPath, couldBeIntercepted, canonicalUrl, routeIsPPREnabled, false // hasDynamicRewrite
1336
- );
1337
- } else {
1338
- // PPR is not enabled for this route. The server responds with a
1339
- // different format (FlightRouterState) that we need to convert.
1340
- // TODO: We will unify the responses eventually. I'm keeping the types
1341
- // separate for now because FlightRouterState has so many
1342
- // overloaded concerns.
1343
- const { stream: prefetchStream, size: responseSize } = await createNonTaskyPrefetchResponseStream(response.body);
1344
- closed.resolve();
1345
- (0, _cachemap.setSizeInCacheMap)(entry, responseSize);
1346
- const serverData = await (0, _fetchserverresponse.createFromNextReadableStream)(prefetchStream, headers, {
1347
- allowPartialStream: true
1348
- });
1349
- if ((response.headers.get(_constants.NEXT_NAV_DEPLOYMENT_ID_HEADER) ?? serverData.b) !== (0, _navigationbuildid.getNavigationBuildId)()) {
1350
- // The server build does not match the client. Treat as a 404. During
1351
- // an actual navigation, the router will trigger an MPA navigation.
1352
- // TODO: We should cache the fact that this is an MPA navigation.
1353
- rejectRouteCacheEntry(entry, Date.now() + 10 * 1000);
1354
- return null;
1355
- }
1356
- // Read head vary params synchronously (unioning in the response-level
1357
- // root params). Individual segments carry their own iterables in
1358
- // CacheNodeSeedData; the root iterable is threaded down so each segment
1359
- // unions it too.
1360
- const headVaryParams = (0, _varyparamsdecoding.readVaryParams)(serverData.h, serverData.r);
1361
- writeDynamicTreeResponseIntoCache(Date.now(), // The non-PPR response format is what we'd get if we prefetched these segments
1362
- // using the LoadingBoundary fetch strategy, so mark their cache entries accordingly.
1363
- _types.FetchStrategy.LoadingBoundary, response, serverData, entry, couldBeIntercepted, canonicalUrl, routeIsPPREnabled, headVaryParams, serverData.r ?? null, pathname, search, nextUrl, map);
1241
+ // Note this doesn't imply PPR is enabled for the route: fully static
1242
+ // routes serve from the per-segment cache too. What it does tell us is
1243
+ // that per-segment prefetching is supported, which is what the route
1244
+ // entry records below.
1245
+ const supportsPerSegmentPrefetching = wasServedFromPerSegmentCache(response);
1246
+ // Decode the response. Routes that support per-segment prefetching
1247
+ // respond from static storage; other routes respond with a live render
1248
+ // (see the isRouteTreePrefetchRequest branch in
1249
+ // walk-tree-with-flight-router-state). Both are
1250
+ // NavigationFlightResponses carrying a buildId and a structure-only
1251
+ // transport tree — which is all this flow reads — so one decode path
1252
+ // serves both.
1253
+ const buffer = await bufferPrefetchResponseBody(response.body);
1254
+ closed.resolve();
1255
+ (0, _cachemap.setSizeInCacheMap)(entry, buffer.byteLength);
1256
+ const serverData = await (0, _fetchserverresponse.decodeBufferedStage)(buffer, headers);
1257
+ if ((response.headers.get(_constants.NEXT_NAV_DEPLOYMENT_ID_HEADER) ?? serverData.b) !== (0, _navigationbuildid.getNavigationBuildId)()) {
1258
+ // The server build does not match the client. Treat as a 404. During
1259
+ // an actual navigation, the router will trigger an MPA navigation.
1260
+ // TODO: We should cache the fact that this is an MPA navigation.
1261
+ rejectRouteCacheEntry(entry, Date.now() + REJECTION_BACKOFF_MS);
1262
+ return null;
1263
+ }
1264
+ const transportData = serverData.t;
1265
+ if (transportData === undefined || serverData.n !== undefined) {
1266
+ // The response carries no route tree (e.g. it's an MPA navigation), so
1267
+ // there's nothing to cache.
1268
+ rejectRouteCacheEntry(entry, Date.now() + REJECTION_BACKOFF_MS);
1269
+ return null;
1270
+ }
1271
+ // Get the params that were used to render the target page. These may
1272
+ // be different from the params in the request URL, if the page
1273
+ // was rewritten. The rendered pathname is also used to fill in the param
1274
+ // values the server omitted from the response (omitting them keeps the
1275
+ // response cacheable across param values).
1276
+ const renderedPathname = (0, _routeparams.getRenderedPathname)(response);
1277
+ const renderedSearch = (0, _routeparams.getRenderedSearch)(response);
1278
+ // Decode the server-sent tree into the RouteTree format used by the
1279
+ // client cache.
1280
+ //
1281
+ // During this traversal, we accumulate additional data into this
1282
+ // "accumulator" object.
1283
+ const acc = {
1284
+ metadataVaryPath: null,
1285
+ treeDivergedFromBase: false
1286
+ };
1287
+ const routeTree = (0, _decodeserverresponse.decodeTransportTreeIntoRouteTree)(transportData.t, null, // The tree is structure-only (no data nodes), so there are no vary
1288
+ // params to decode...
1289
+ null, // ...and no partiality either; the conservative value is never read.
1290
+ true, renderedPathname, renderedSearch, acc);
1291
+ const metadataVaryPath = acc.metadataVaryPath;
1292
+ if (metadataVaryPath === null) {
1293
+ rejectRouteCacheEntry(entry, Date.now() + REJECTION_BACKOFF_MS);
1294
+ return null;
1364
1295
  }
1296
+ (0, _optimisticroutes.discoverKnownRoute)(Date.now(), pathname, search, nextUrl, entry, {
1297
+ tree: routeTree,
1298
+ head: createMetadataRouteTree(metadataVaryPath, routeTree.prefetchHints, null)
1299
+ }, couldBeIntercepted, canonicalUrl, renderedSearch, supportsPerSegmentPrefetching, false // hasDynamicRewrite
1300
+ );
1365
1301
  if (!couldBeIntercepted) {
1366
1302
  // This route will never be intercepted. So we can use this entry for all
1367
1303
  // requests to this route, regardless of the Next-Url header. This works
@@ -1385,33 +1321,11 @@ map) {
1385
1321
  };
1386
1322
  } catch (error) {
1387
1323
  // Either the connection itself failed, or something bad happened while
1388
- // decoding the response. If we're offline, reject with staleAt=-1 so the
1389
- // entry immediately expires and gets retried once the scheduler is
1390
- // re-pinged after connectivity is restored.
1391
- if (process.env.__NEXT_USE_OFFLINE) {
1392
- const { checkOfflineError } = require('../offline');
1393
- if (checkOfflineError(error)) {
1394
- // Unlike navigations and server actions, prefetches don't await
1395
- // waitForConnection — they just reject the cache entry with an
1396
- // immediate expiration so it gets retried once the scheduler is
1397
- // re-pinged after connectivity is restored.
1398
- rejectRouteCacheEntry(entry, -1);
1399
- return null;
1400
- }
1401
- }
1402
- rejectRouteCacheEntry(entry, Date.now() + 10 * 1000);
1324
+ // decoding the response.
1325
+ rejectRouteCacheEntry(entry, getPrefetchErrorStaleAt(error));
1403
1326
  return null;
1404
1327
  }
1405
1328
  }
1406
- function rejectRemainingSegmentsInBundle(entries, staleAt) {
1407
- let node = entries;
1408
- while(node !== null){
1409
- if (node.entry !== null && node.entry.status === _cachemap.EntryStatus.Pending) {
1410
- rejectSegmentCacheEntry(node.entry, staleAt);
1411
- }
1412
- node = node.parent;
1413
- }
1414
- }
1415
1329
  // When a static (per-segment PPR) prefetch receives an upgradeable fallback
1416
1330
  // shell, the localized retry loop re-issues the same fetch after this delay to
1417
1331
  // pick up the concrete version once the server's background regeneration
@@ -1420,7 +1334,9 @@ const FALLBACK_RETRY_DELAY_MS = 2000;
1420
1334
  // Maximum number of fallback retries per task, to avoid looping indefinitely
1421
1335
  // if the server keeps returning a fallback (e.g. misconfiguration).
1422
1336
  const MAX_FALLBACK_RETRIES = 3;
1423
- async function fetchSegmentsOnCacheMiss(task, route, routeKey, tree, segments, segmentCount, // Which walk spawned the bundle's entries. The request on the wire is
1337
+ async function fetchSegmentPrefetchesUsingStaticRequest(task, route, routeKey, tree, // The pending cache entries this task spawned for the bundle, keyed by
1338
+ // segment request key. The response fulfills them when it arrives.
1339
+ spawnedEntries, // Which walk spawned the bundle's entries. The request on the wire is
1424
1340
  // identical either way; this only decides which payload of the response
1425
1341
  // fulfills the entries.
1426
1342
  fetchStrategy) {
@@ -1431,81 +1347,90 @@ fetchStrategy) {
1431
1347
  //
1432
1348
  // Segment fetches are non-blocking so we don't need to ping the scheduler
1433
1349
  // on completion.
1434
- let result;
1350
+ let isUpgradeableISRFallback;
1435
1351
  try {
1436
- result = await fetchSegmentsOnCacheMissImpl(route, routeKey, tree);
1352
+ isUpgradeableISRFallback = await fetchAndWritePerSegmentPrefetchResponse(task, route, routeKey, tree, spawnedEntries, fetchStrategy, // Write the response even if it's an upgradeable fallback shell — the
1353
+ // fallback content is better than nothing while the retry loop waits
1354
+ // for the concrete version.
1355
+ false);
1437
1356
  } catch (error) {
1438
1357
  // The connection failed, or the response couldn't be decoded. Reject the
1439
- // pending entries so they don't stay Pending forever, and get retried once
1440
- // the entry expires. If we're offline, expire immediately (-1) so the entry
1441
- // is re-fetched once the scheduler is re-pinged on reconnect; otherwise
1442
- // apply a 10s backoff. (Unlike navigations and server actions, prefetches
1443
- // don't await `waitForConnection`.)
1444
- let staleAt = Date.now() + 10 * 1000;
1445
- if (process.env.__NEXT_USE_OFFLINE) {
1446
- const { checkOfflineError } = require('../offline');
1447
- if (checkOfflineError(error)) {
1448
- staleAt = -1;
1449
- }
1450
- }
1451
- rejectRemainingSegmentsInBundle(segments, staleAt);
1358
+ // pending entries so they don't stay Pending forever, and get retried
1359
+ // once the entry expires.
1360
+ rejectSegmentEntriesIfStillPending(spawnedEntries, getPrefetchErrorStaleAt(error));
1452
1361
  return null;
1453
1362
  }
1454
- if (result === null) {
1363
+ if (isUpgradeableISRFallback === null) {
1455
1364
  // The response was fetched but isn't usable yet (server error/miss, empty
1456
1365
  // data, or a build-id mismatch — the server may be transiently unready).
1457
1366
  // Reject with a short backoff so the entries are retried soon.
1458
- rejectRemainingSegmentsInBundle(segments, Date.now() + 10 * 1000);
1367
+ rejectSegmentEntriesIfStillPending(spawnedEntries, Date.now() + REJECTION_BACKOFF_MS);
1459
1368
  return null;
1460
1369
  }
1461
- const { serverResponse, shellResponse, responseSize, closed } = result;
1462
- const now = Date.now();
1463
- writeSegmentBundleResponseVariants(task.segmentCacheMap, serverResponse, shellResponse, responseSize, segments, segmentCount, now, fetchStrategy);
1464
- // If the server served an upgradeable fallback shell, drive a localized
1465
- // retry loop to pick up the concrete version once the server's background
1466
- // regeneration finishes. Only the first such response per task starts a loop
1467
- // (`fallbackRetryStatus === Empty`); once it leaves Empty, no second loop is
1468
- // started — sibling bundle responses that also got a fallback don't, and
1469
- // neither does a re-hover.
1470
- if (serverResponse.isUpgradeableISRFallback && task.fallbackRetryStatus === _cachemap.EntryStatus.Empty && !task.isCanceled) {
1471
- task.fallbackRetryStatus = _cachemap.EntryStatus.Pending;
1472
- // Fire-and-forget: the loop drives itself via timers and pings the task
1473
- // on success.
1474
- void retryUpgradeableFallbackPrefetch(task, route, routeKey, tree, segments, segmentCount, fetchStrategy);
1475
- }
1476
1370
  return {
1477
1371
  value: null,
1478
- closed
1372
+ // The response is fully buffered before it's decoded, so the network
1373
+ // connection is already closed by the time the fetch returns. See TODO
1374
+ // in fetchRouteOnCacheMiss about removing `closed` for buffered
1375
+ // prefetch paths.
1376
+ closed: Promise.resolve()
1479
1377
  };
1480
1378
  }
1481
1379
  /**
1482
- * Issues a single segment-bundle prefetch request, validates it, and decodes
1483
- * the response. Returns the decoded response (see the return type below)
1484
- * on success, or `null` if the response was fetched but isn't usable yet
1485
- * (server error/miss, empty data, or a build-id mismatch — the server may be
1486
- * transiently unready, so it's worth retrying). THROWS if the connection failed
1487
- * or the response couldn't be decoded; re-issuing the identical request won't
1488
- * fix that, so callers should give up rather than retry.
1380
+ * Issues a single segment-bundle prefetch request, validates and decodes the
1381
+ * response, and writes every payload of it into the cache — the full
1382
+ * payload, and, when the response carries a shell byte boundary, a second
1383
+ * decode of the same bytes truncated at that boundary, the segments'
1384
+ * shell-stage variant — through the shared payload-write orchestration
1385
+ * (writeResponsePayloadsIntoCache), which owns which payload fulfills the
1386
+ * spawned entries and the tier each payload is written at.
1387
+ *
1388
+ * Returns whether the response was an upgradeable ISR fallback shell (the
1389
+ * page hadn't been prerendered with concrete params yet), or `null` if the
1390
+ * response was fetched but isn't usable yet (server error/miss, empty data,
1391
+ * or a build-id mismatch — the server may be transiently unready, so it's
1392
+ * worth retrying; nothing is written and no entries are rejected). THROWS if
1393
+ * the connection failed or the response couldn't be decoded; re-issuing the
1394
+ * identical request won't fix that, so callers should give up rather
1395
+ * than retry.
1396
+ *
1397
+ * When the response is an upgradeable fallback shell, this also starts the
1398
+ * task's localized fallback-retry loop (at most one per task, ever), BEFORE
1399
+ * writing the fallback content — see the comment on the transition below.
1489
1400
  *
1490
- * This deliberately does NOT touch the cache — it neither writes the decoded
1491
- * segments nor rejects entries. The caller decides what to do with the result:
1492
- * write it (`fetchSegmentsOnCacheMiss`) or ignore it and try again (the retry
1493
- * loop). Calling this again with the same arguments reproduces the exact same
1494
- * request.
1495
- */ async function fetchSegmentsOnCacheMissImpl(route, routeKey, tree) {
1401
+ * Calling this again with the same arguments reproduces the exact same
1402
+ * request. The retry loop uses that to re-issue the request until the server
1403
+ * has the concrete version, passing `discardFallbackResponse` so a response
1404
+ * that is STILL a fallback isn't pointlessly re-written over the identical
1405
+ * fallback content the initial fetch already cached. (The retry's entries
1406
+ * are already settled, so its writes are all detached upserts.)
1407
+ */ async function fetchAndWritePerSegmentPrefetchResponse(task, route, routeKey, tree, spawnedEntries, fetchStrategy, // When true, a response that is still an upgradeable fallback shell is
1408
+ // discarded instead of written (the fallback-retry loop's re-issued
1409
+ // requests).
1410
+ discardFallbackResponse) {
1496
1411
  // Use the canonical URL to request the segment, not the original URL. These
1497
1412
  // are usually the same, but the canonical URL will be different if the route
1498
1413
  // tree response was redirected. To avoid an extra waterfall on every segment
1499
1414
  // request, we pass the redirected URL instead of the original one.
1500
1415
  const url = new URL(route.canonicalUrl, location.origin);
1501
1416
  const nextUrl = routeKey.nextUrl;
1502
- const requestKey = tree.requestKey;
1503
- const normalizedRequestKey = requestKey === _segmentvalueencoding.ROOT_SEGMENT_REQUEST_KEY ? // handling of these requests, we encode the root segment path as
1504
- // `_index` instead of as an empty string. This should be treated as
1505
- // an implementation detail and not as a stable part of the protocol.
1506
- // It just needs to match the equivalent logic that happens when
1507
- // prerendering the responses. It should not leak outside of Next.js.
1508
- '/_index' : requestKey;
1417
+ let normalizedRequestKey;
1418
+ if (tree.segment === _segmentvalueencoding.HEAD_REQUEST_KEY) {
1419
+ // The head's request key is its client cache identity; the server only
1420
+ // knows the head by its bare marker, which is also the head node's
1421
+ // segment (see createMetadataRouteTree).
1422
+ normalizedRequestKey = _segmentvalueencoding.HEAD_REQUEST_KEY;
1423
+ } else if (tree.requestKey === _segmentvalueencoding.ROOT_SEGMENT_REQUEST_KEY) {
1424
+ // The root segment is a special case. To simplify the server-side
1425
+ // handling of these requests, we encode the root segment path as
1426
+ // `_index` instead of as an empty string. This should be treated as
1427
+ // an implementation detail and not as a stable part of the protocol.
1428
+ // It just needs to match the equivalent logic that happens when
1429
+ // prerendering the responses. It should not leak outside of Next.js.
1430
+ normalizedRequestKey = '/_index';
1431
+ } else {
1432
+ normalizedRequestKey = tree.requestKey;
1433
+ }
1509
1434
  const headers = {
1510
1435
  [_approuterheaders.RSC_HEADER]: '1',
1511
1436
  [_approuterheaders.NEXT_ROUTER_PREFETCH_HEADER]: '1',
@@ -1516,37 +1441,59 @@ fetchStrategy) {
1516
1441
  }
1517
1442
  const requestUrl = isOutputExportMode ? addSegmentPathToUrlInOutputExportMode(url, normalizedRequestKey) : url;
1518
1443
  const response = await fetchPrefetchResponse(requestUrl, headers);
1519
- if (!response || !response.ok || // This checks whether the response was served from the per-segment cache,
1520
- // rather than the old prefetching flow. If it fails, it implies that PPR
1521
- // is disabled on this route. Theoretically this should never happen
1522
- // because we only issue requests for segments once we've verified that
1523
- // the route supports PPR.
1524
- response.headers.get(_approuterheaders.NEXT_DID_POSTPONE_HEADER) !== '2' && // In output: "export" mode, we can't rely on response headers. But if
1525
- // we receive a well-formed response, we can assume it's a static
1526
- // response, because all data is static in this mode.
1527
- !isOutputExportMode || !response.body) {
1444
+ if (!response || !response.ok || // Theoretically this check should never fail, because we only issue
1445
+ // requests for segments once we've verified that the route supports PPR.
1446
+ !wasServedFromPerSegmentCache(response) || !response.body) {
1528
1447
  // Server responded with an error or a miss — fetched but not usable.
1529
1448
  return null;
1530
1449
  }
1531
- // See TODO in fetchRouteOnCacheMiss about removing `closed` for
1532
- // buffered prefetch paths.
1533
- const closed = (0, _promisewithresolvers.createPromiseWithResolvers)();
1534
- const { stream: prefetchStream, size: responseSize, buffer } = await createNonTaskyPrefetchResponseStream(response.body);
1535
- closed.resolve();
1536
- // Parse the response. Always a SegmentPrefetchResponse with a build ID and a
1537
- // data array. A connection drop or malformed stream throws here, which
1538
- // propagates to the caller as a non-retryable failure.
1539
- const serverResponse = await (0, _fetchserverresponse.createFromNextReadableStream)(prefetchStream, headers, {
1540
- allowPartialStream: true
1541
- });
1542
- if (serverResponse.data.length === 0) {
1450
+ const buffer = await bufferPrefetchResponseBody(response.body);
1451
+ // Parse the response. Always a PrefetchFlightResponse. A connection drop
1452
+ // or malformed stream throws here, which propagates to the caller as a
1453
+ // non-retryable failure.
1454
+ const serverResponse = await (0, _fetchserverresponse.decodeBufferedStage)(buffer, headers);
1455
+ if (serverResponse.t === undefined) {
1456
+ // The response carries no segment data at all — not usable.
1457
+ // writeServerResponseIntoCache checks this again, but this fetch-layer
1458
+ // copy is deliberate: it must run before the fallback-retry loop is
1459
+ // started and before the payload writes below, neither of which should
1460
+ // happen for an empty response.
1543
1461
  return null;
1544
1462
  }
1545
- if ((response.headers.get(_constants.NEXT_NAV_DEPLOYMENT_ID_HEADER) ?? serverResponse.buildId) !== (0, _navigationbuildid.getNavigationBuildId)()) {
1463
+ if ((response.headers.get(_constants.NEXT_NAV_DEPLOYMENT_ID_HEADER) ?? serverResponse.b) !== (0, _navigationbuildid.getNavigationBuildId)()) {
1546
1464
  // The server build does not match the client. Treat as a 404. During
1547
1465
  // an actual navigation, the router will trigger an MPA navigation.
1548
1466
  return null;
1549
1467
  }
1468
+ // True if the server served an upgradeable fallback shell (the page hadn't
1469
+ // been prerendered with concrete params yet, but the route can be
1470
+ // upgraded once the server's background regeneration finishes).
1471
+ const isUpgradeableISRFallback = serverResponse.f === true;
1472
+ if (isUpgradeableISRFallback) {
1473
+ if (discardFallbackResponse) {
1474
+ // Still a fallback — the server hasn't finished regenerating. Don't
1475
+ // write it; the retry loop will re-issue the request.
1476
+ return true;
1477
+ }
1478
+ // Drive a localized retry loop to pick up the concrete version once the
1479
+ // server's background regeneration finishes. Only the first fallback
1480
+ // response per task starts a loop (`fallbackRetryStatus === Empty`);
1481
+ // once it leaves Empty, no second loop is started — sibling bundle
1482
+ // responses that also got a fallback don't, and neither does a re-hover.
1483
+ //
1484
+ // The transition to Pending must happen BEFORE the fallback content is
1485
+ // written below: fulfilling an entry pings the tasks blocked on it, and
1486
+ // a scheduler pass that ran before the transition would observe a
1487
+ // fulfilled fallback entry with the retry gate still Empty and spawn a
1488
+ // duplicate revalidation request (see isUpgradeableISRFallbackRetry in
1489
+ // pingSegmentBundle in scheduler.ts).
1490
+ if (task.fallbackRetryStatus === _cachemap.EntryStatus.Empty && !task.isCanceled) {
1491
+ task.fallbackRetryStatus = _cachemap.EntryStatus.Pending;
1492
+ // Fire-and-forget: the loop drives itself via timers and pings the
1493
+ // task on success.
1494
+ void retryUpgradeableFallbackPrefetch(task, route, routeKey, tree, spawnedEntries, fetchStrategy);
1495
+ }
1496
+ }
1550
1497
  // Extract the shell payload, if the response carries a distinct one
1551
1498
  // (positive shell byte offset): decode the buffered bytes a SECOND time,
1552
1499
  // truncated at the boundary. The truncation is what produces the shell
@@ -1556,16 +1503,18 @@ fetchStrategy) {
1556
1503
  // fulfillments past the boundary read as pending in this decode, so a
1557
1504
  // post-shell runtime-data access doesn't mark the shell variant itself as
1558
1505
  // needing a runtime request.
1559
- // (The offset is never legitimately pending or 0 in this decode: the full
1560
- // buffer is present, and the server only ever emits a positive offset or
1561
- // null. Reading 0 — the default for an unfulfilled `a` — therefore means a
1562
- // bug in Next.js itself, and is handled like an error: the response is
1563
- // treated as carrying no shell, and the scheduler skips the affected
1564
- // segments rather than falling back to a runtime request — see the
1565
- // `shellResponse === null` handling in writeSegmentBundleResponseVariants.
1566
- // Failing in that direction costs a shell prefetch but never leaks
1567
- // post-shell content into shell positions.)
1568
- const shellOffset = readFulfilledValue(serverResponse.a, 0);
1506
+ // (A 0 offset means the response carries no shell: the server emits a
1507
+ // fulfilled 0 when the page wasn't staged at all — see the `a` resolution
1508
+ // in collect-segment-data — and 0 is also the default read of an
1509
+ // unfulfilled `a`, which would be a Next.js bug since the full buffer is
1510
+ // present. Both read the same here: no shell, and the scheduler skips the
1511
+ // affected segments rather than falling back to a runtime request — see
1512
+ // the no-shell handling in writeResponsePayloadsIntoCache. Failing in that
1513
+ // direction costs a shell prefetch but never leaks post-shell content into
1514
+ // shell positions. 0 can double as "none" on the wire precisely because
1515
+ // it's never a valid offset — see the `a` field doc on
1516
+ // NavigationFlightResponse.)
1517
+ const shellOffset = serverResponse.a !== undefined ? (0, _rsctransport.readFulfilledValue)(serverResponse.a, 0) : 0;
1569
1518
  let shellResponse;
1570
1519
  if (shellOffset === null) {
1571
1520
  shellResponse = serverResponse;
@@ -1579,273 +1528,55 @@ fetchStrategy) {
1579
1528
  // exists; the full payload is still usable. (For a StaticShell-spawned
1580
1529
  // bundle this means the spawned entries are rejected — the scheduler
1581
1530
  // then skips them rather than issuing a runtime substitute; see the
1582
- // no-shell branch in fetchSegmentsOnCacheMiss.)
1531
+ // no-shell handling in writeResponsePayloadsIntoCache.)
1583
1532
  shellResponse = null;
1584
1533
  }
1585
1534
  }
1586
- return {
1587
- serverResponse,
1588
- responseSize,
1589
- shellResponse,
1590
- closed: closed.promise
1591
- };
1592
- }
1593
- /**
1594
- * Writes every payload of a parsed segment-bundle response into the cache.
1595
- * The bundle's entries are fulfilled by the payload matching the walk that
1596
- * spawned them; the other payload, when distinct, is written with a detached
1597
- * copy of the bundle. The full payload is written first so the shell write's
1598
- * shadow eviction sees the fresh concrete entry.
1599
- *
1600
- * Shared by the initial fetch (`fetchSegmentsOnCacheMiss`) and the localized
1601
- * fallback-retry loop. The retry's bundle entries are already settled, so
1602
- * for that caller every write is a detached upsert and the rejection below
1603
- * is a no-op (it only touches Pending entries).
1604
- */ function writeSegmentBundleResponseVariants(// The map the bundle's entries live in (pinned when the request was
1605
- // spawned).
1606
- map, serverResponse, shellResponse, responseSize, segments, segmentCount, now, // Which walk spawned the bundle's entries; decides which payload fulfills
1607
- // them. See fetchSegmentsOnCacheMiss.
1608
- fetchStrategy) {
1609
- if (fetchStrategy === _types.FetchStrategy.StaticShell) {
1610
- if (shellResponse !== serverResponse) {
1611
- writeSegmentBundleResponse(map, serverResponse, responseSize, detachEntriesFromSegmentBundle(segments), segmentCount, now, _types.FetchStrategy.PPR, _types.FetchStrategy.PPR);
1612
- }
1613
- if (shellResponse === null) {
1614
- // No shell exists. Reject the spawned entries so the task isn't
1615
- // stranded blocking on them. Note the scheduler does NOT fall back to
1616
- // a runtime request for rejected segments — it skips them outright (see
1617
- // the Rejected case in pingSegmentBundle in scheduler.ts), so these
1618
- // segments get no shell prefetch and no runtime substitute until the
1619
- // rejection's backoff expires.
1620
- rejectRemainingSegmentsInBundle(segments, now + 10 * 1000);
1621
- } else {
1622
- writeSegmentBundleResponse(map, shellResponse, responseSize, segments, segmentCount, now, _types.FetchStrategy.StaticShell, // When the shell IS the full response (no shell/full split), the
1623
- // entries this write fulfills carry full-tier content, so PPR is the
1624
- // strategy that describes it.
1625
- shellResponse === serverResponse ? _types.FetchStrategy.PPR : _types.FetchStrategy.StaticShell);
1626
- }
1627
- } else {
1628
- writeSegmentBundleResponse(map, serverResponse, responseSize, segments, segmentCount, now, _types.FetchStrategy.PPR, _types.FetchStrategy.PPR);
1629
- if (shellResponse !== null && shellResponse !== serverResponse) {
1630
- writeSegmentBundleResponse(map, shellResponse, responseSize, detachEntriesFromSegmentBundle(segments), segmentCount, now, _types.FetchStrategy.StaticShell, _types.FetchStrategy.StaticShell);
1631
- }
1632
- }
1633
- }
1634
- /**
1635
- * Writes one payload of a parsed segment-bundle response into the cache:
1636
- * distributes the response size across the bundle, then walks the segments
1637
- * list and the response's `data` array in parallel, fulfilling/upserting
1638
- * each entry. Any segments the server didn't return are rejected so they
1639
- * don't stay Pending forever.
1640
- *
1641
- * `fetchStrategy` says which of the response's payloads this call is
1642
- * writing — StaticShell for the shell payload, PPR for the full payload —
1643
- * which determines the vary paths the entries are keyed at.
1644
- *
1645
- * The walk fulfills any Pending entry in `segments`, so the caller must
1646
- * pass the bundle only to the walk matching the entries' own strategy, and
1647
- * a detached copy to the other. In particular, fulfilling a spawned
1648
- * StaticShell entry with the concrete payload would leak param-dependent
1649
- * content into shell positions: during a navigation, a pending entry can be
1650
- * rendered as a promise that resolves to its eventual value.
1651
- *
1652
- * Shared by the initial fetch and the localized fallback-retry loop (which
1653
- * re-issues the same request and upserts the upgraded result here).
1654
- */ function writeSegmentBundleResponse(map, serverResponse, responseSize, segments, segmentCount, now, fetchStrategy, // The strategy tier that describes this payload's CONTENT, recorded on
1655
- // the entries it fulfills. Differs from `fetchStrategy` (which drives
1656
- // matching and keying) in one case: a StaticShell write whose payload IS
1657
- // the full response (no shell/full split) records PPR — see
1658
- // writeSegmentBundleResponseVariants.
1659
- payloadFetchStrategy) {
1660
- // Distribute the response size evenly across all segments in the bundle.
1661
- // (When a response produces two payload writes, each write distributes the
1662
- // full response size — intentionally double-charging the LRU for one wire
1663
- // response, since it produced two live entries per segment.)
1664
- const averageSize = responseSize / segmentCount;
1665
- let sizeNode = segments;
1666
- while(sizeNode !== null){
1667
- if (sizeNode.entry !== null) {
1668
- (0, _cachemap.setSizeInCacheMap)(sizeNode.entry, averageSize);
1669
- }
1670
- sizeNode = sizeNode.parent;
1671
- }
1672
- const serverDataArray = serverResponse.data;
1673
- // True if the server served an upgradeable fallback shell (page not yet
1674
- // prerendered with concrete params, but the route can be upgraded). Applies
1675
- // to the whole response and is recorded on each fulfilled entry.
1676
- const responseIsUpgradeableISRFallback = serverResponse.isUpgradeableISRFallback;
1677
- // Whether the render that produced this payload accessed runtime data
1678
- // (page-global; combined with each segment's `isPartial` below to decide
1679
- // the tier each entry records). Read from THIS decode's thenable status,
1680
- // which scopes it to the payload being written — see
1681
- // `SegmentPrefetchResponse['needsRuntimeRequest']` for the encoding.
1682
- //
1683
- // Reading it from the same decode that produced the entry's data is what
1684
- // makes the answer rewindable: a truncated shell decode reads a post-shell
1685
- // runtime access as pending, i.e. `false`, because the shell variant itself
1686
- // doesn't need that data.
1687
- //
1688
- // It is load-bearing in one direction only. A false `true` costs a wasted
1689
- // runtime request; a false `false` would record too high a tier and skip a
1690
- // runtime request that had more content.
1691
- const responseNeedsRuntimeRequest = readFulfilledValue(serverResponse.needsRuntimeRequest, false);
1692
- let node = segments;
1693
- let dataIndex = 0;
1694
- while(node !== null && dataIndex < serverDataArray.length){
1695
- const data = serverDataArray[dataIndex];
1696
- // Null data means this segment has prefetching disabled
1697
- // (prefetch: 'force-disabled' — Partial Prefetching segments have static
1698
- // data, so the server emits a real slot for them). Skip it without
1699
- // creating a cache entry.
1700
- if (data === null || node.tree === null) {
1701
- // The server's and the client's prefetch-disabled hints normally agree,
1702
- // so there shouldn't be a spawned entry for a segment the server
1703
- // skipped. But if they disagree, a Pending entry that a task blocked on
1704
- // would otherwise never settle, stranding the task forever. Settle
1705
- // it defensively.
1706
- if (node.entry !== null && node.entry.status === _cachemap.EntryStatus.Pending) {
1707
- rejectSegmentCacheEntry(node.entry, now + 10 * 1000);
1708
- }
1709
- node = node.parent;
1710
- dataIndex++;
1711
- continue;
1712
- }
1713
- // The segment's late-resolving metadata can be read synchronously
1714
- // because the payload was fully buffered before it was decoded (and, for
1715
- // a truncated shell decode, delivered as a single chunk).
1716
- const entryStaleAt = readFulfilledStaleAt(now, data.staleTime);
1717
- // Root params are emitted once at the top level of the response and
1718
- // unioned into each segment's set here, same as for a route-level
1719
- // response.
1720
- const varyParams = (0, _varyparamsdecoding.readVaryParams)(data.varyParams, serverResponse.rootVaryParams);
1721
- const isPartial = readFulfilledIsPartial(data.isPartial);
1722
- // A runtime prefetch can only provide more content than this entry if the
1723
- // render accessed runtime data AND this particular segment has holes — a
1724
- // fully static segment gains nothing from a runtime request no matter
1725
- // what the page accessed.
1726
- const needsRuntimeRequest = responseNeedsRuntimeRequest && isPartial;
1727
- // An entry records the tier of the content that actually satisfied it,
1728
- // which spans both axes: shell-vs-concrete AND static-vs-runtime.
1729
- //
1730
- // When this payload fully satisfied the segment — no runtime request
1731
- // needed — the content is as complete as a RUNTIME response of the same
1732
- // variant would have been, so it records that runtime tier. That's what
1733
- // lets the scheduler decide "would a runtime request return more?" by
1734
- // comparing tiers alone, with no separate signal to consult.
1735
- //
1736
- // Otherwise the content is only as complete as the static tier it was
1737
- // requested at, so a follow-up runtime request can still supersede it.
1738
- const recordedFetchStrategy = !needsRuntimeRequest ? payloadFetchStrategy === _types.FetchStrategy.StaticShell ? _types.FetchStrategy.RuntimeShell : _types.FetchStrategy.PPRRuntime : fetchStrategy;
1739
- // Key the entry by which params the server said this segment depends on.
1740
- // Reusing one copy across param values is the point of the shell, but it
1741
- // requires knowing the content doesn't depend on those params, and the
1742
- // server's report is the direct evidence of that.
1743
- //
1744
- // Without that report, assume every param varies. The exception is a
1745
- // shell variant, which reduces param-dependent content to param
1746
- // fallbacks, so it really is good for any value of them.
1747
- const payloadVaryPath = process.env.__NEXT_VARY_PARAMS && varyParams !== null ? (0, _varypath.getFulfilledSegmentVaryPath)(node.tree.varyPath, varyParams) : (0, _varypath.getSegmentVaryPathForRequest)(payloadFetchStrategy, node.tree);
1748
- const nodeEntry = node.entry;
1749
- if (nodeEntry !== null && nodeEntry.status === _cachemap.EntryStatus.Pending) {
1750
- // We own this entry — fulfill it directly.
1751
- const fulfilledEntry = fulfillSegmentCacheEntry(nodeEntry, data.rsc, entryStaleAt, isPartial, responseIsUpgradeableISRFallback, recordedFetchStrategy);
1752
- // Move the entry to that key. This is load-bearing rather than a no-op:
1753
- // a task spawns its entries before it knows what the response will
1754
- // contain, so the key it guessed can be more reusable than the response
1755
- // turned out to deserve.
1756
- //
1757
- // Pass the concrete lookup path — the most specific path a read for
1758
- // this segment position would use — so that if the entry lands at a
1759
- // more generic key, a stale entry at a more specific one can't shadow
1760
- // it. See evictShadowingSegmentEntries. The upsert (rather than a bare
1761
- // set) applies the usual precedence rules, so a concurrent task's more
1762
- // complete response already in this slot isn't downgraded.
1763
- upsertSegmentEntry(now, map, payloadVaryPath, fulfilledEntry, node.tree.varyPath);
1764
- } else {
1765
- // We don't own this entry. Create a detached entry and attempt to
1766
- // upsert it into this payload's slot.
1767
- const detachedEntry = createDetachedSegmentCacheEntry(now);
1768
- const fulfilledEntry = fulfillSegmentCacheEntry(upgradeToPendingSegment(detachedEntry, fetchStrategy), data.rsc, entryStaleAt, isPartial, responseIsUpgradeableISRFallback, recordedFetchStrategy);
1769
- upsertSegmentEntry(now, map, payloadVaryPath, fulfilledEntry, node.tree.varyPath);
1770
- }
1771
- node = node.parent;
1772
- dataIndex++;
1773
- }
1774
- // If the server returned fewer segments than expected, reject any
1775
- // remaining pending entries so they don't stay Pending forever.
1776
- if (node !== null) {
1777
- rejectRemainingSegmentsInBundle(node, now + 10 * 1000);
1778
- }
1779
- }
1780
- /**
1781
- * Clones a SegmentBundle chain with every `entry` removed, so a write walk
1782
- * over it is pure detached upserts. Used for the payload that does NOT
1783
- * match the bundle's spawned entries (see writeSegmentBundleResponse).
1784
- */ function detachEntriesFromSegmentBundle(segments) {
1785
- const head = {
1786
- tree: segments.tree,
1787
- entry: null,
1788
- parent: null
1789
- };
1790
- let clonedTail = head;
1791
- let node = segments.parent;
1792
- while(node !== null){
1793
- const clonedNode = {
1794
- tree: node.tree,
1795
- entry: null,
1796
- parent: null
1797
- };
1798
- clonedTail.parent = clonedNode;
1799
- clonedTail = clonedNode;
1800
- node = node.parent;
1801
- }
1802
- return head;
1803
- }
1804
- // TODO: Consolidate the read* helpers below with the ones in
1805
- // vary-params-decoding — they all perform a version of the same synchronous
1806
- // read of a buffered decode's late-resolving values.
1807
- /**
1808
- * Reads a segment's partialness from its `isPartial` promise. (Unlike the
1809
- * values read via `readFulfilledValue` below, the fulfillment value here is
1810
- * void — partialness is encoded as the ABSENCE of a fulfillment.) The server
1811
- * fulfills it only for a fully-static segment and leaves it pending for a
1812
- * partial one (see `SegmentPrefetch['isPartial']`), so partial == not
1813
- * fulfilled. The read is synchronous because the response is fully buffered
1814
- * before it's decoded, so a fulfillment is already visible on the thenable's
1815
- * status — the same trick `readVaryParams` uses for the vary params iterables.
1816
- */ function readFulfilledIsPartial(isPartial) {
1817
- const thenable = isPartial;
1818
- // Force Flight to unwrap a received-but-not-yet-settled row. A pending row,
1819
- // or a truncated shell decode whose fulfillment landed past the boundary,
1820
- // stays non-fulfilled — read as partial, which is correct either way.
1821
- thenable.then(noop, noop);
1822
- return thenable.status !== 'fulfilled';
1823
- }
1824
- /**
1825
- * Reads a late-resolving value off a fully-buffered decode's thenable status,
1826
- * using the same trick as above. Returns `valueIfUnresolved` for a row that
1827
- * is pending or absent in this decode — e.g. one whose fulfillment landed
1828
- * past a truncated shell decode's boundary. That's what scopes a response's
1829
- * late-resolving signals to the payload being decoded.
1830
- */ function readFulfilledValue(valueFromServer, valueIfUnresolved) {
1831
- const thenable = valueFromServer;
1832
- // Force Flight to unwrap a received-but-not-yet-settled row.
1833
- thenable.then(noop, noop);
1834
- if (thenable.status === 'fulfilled' && thenable.value !== undefined) {
1835
- return thenable.value;
1836
- }
1837
- return valueIfUnresolved;
1535
+ // The pathname the page was rendered for, derived the same way the route
1536
+ // tree fetch derives it (the rewritten-path header when the request was
1537
+ // rewritten, the request URL otherwise) so the vary paths computed from
1538
+ // this response's decoded tree agree with the ones on the route entry's
1539
+ // tree. In output: "export" mode the response URL has the segment filename
1540
+ // appended to the pathname, so derive it from the page URL instead
1541
+ // (rewrites don't exist on a static host).
1542
+ const renderedPathname = isOutputExportMode ? (0, _routeparams.getPathnameFromRequestURL)(url) : (0, _routeparams.getRenderedPathname)(response);
1543
+ // Write the payloads into the cache. Each payload is decoded like any
1544
+ // other server response — a root-anchored tree plus an optional head, with
1545
+ // no base overlay (the response covers its own spine) — and written
1546
+ // through the same path as a live-render response. Notes on the
1547
+ // arguments:
1548
+ // - Dynamic segments the server sent without a param value (`k: null`) are
1549
+ // parsed from the rendered pathname, and the rendered search is the one
1550
+ // the route tree was built with, so the decoded tree's vary paths agree
1551
+ // with the ones on the route entry's tree.
1552
+ // - The build id was already verified above, so none is passed.
1553
+ // - The response-level staleness is only a fallback, for segments that
1554
+ // don't carry their own staleTime (per-segment responses normally
1555
+ // always do).
1556
+ // - Response-level partiality is unused for per-segment writes — each
1557
+ // segment (and the head) carries its own partiality via the staged
1558
+ // promise encoding, which the decode reads in preference to the
1559
+ // response-level value — so the conservative value (true) is passed.
1560
+ // - The head is keyed at the route's own metadata vary path: the head has
1561
+ // no tree position, so the decode could only derive a vary path for it
1562
+ // from a page node in the payload's own tree. A per-segment response
1563
+ // carries only the spine from the root to the requested segment, so any
1564
+ // response whose terminal isn't a page has no page node to key the head
1565
+ // from; the standalone head response is one such case.
1566
+ const now = Date.now();
1567
+ const metadataVaryPath = route.root.head.varyPath;
1568
+ writeResponsePayloadsIntoCache(now, fetchStrategy, serverResponse, shellResponse, null, // The payloads are root-anchored (no base tree), so there's no
1569
+ // prediction to diverge from.
1570
+ null, renderedPathname, route.renderedSearch, undefined, now + _navigatereducer.STATIC_STALETIME_MS, true, metadataVaryPath, spawnedEntries, buffer.byteLength, task.segmentCacheMap);
1571
+ return isUpgradeableISRFallback;
1838
1572
  }
1839
1573
  /**
1840
1574
  * Reads a stale-at time from the staleTime async iterable of a fully-buffered
1841
- * response — segment bundles and stage decodes, which go through
1842
- * `createNonTaskyPrefetchResponseStream`. Because the bytes are all present,
1843
- * each yielded value is already visible on its chunk's thenable status (the
1844
- * same trick `readVaryParams` uses), so this drains synchronously and takes
1845
- * the last value (the final staleTime, as `resolveStaleAt` does for the
1846
- * async case). A missing iterable, or a truncated shell decode whose value
1847
- * landed past the boundary, reads as absent and falls back to the static
1848
- * stale time.
1575
+ * response — stage decodes, which go through
1576
+ * `bufferPrefetchResponseBody`. Drains synchronously via
1577
+ * `readFulfilledStaleTimeSeconds` (see decode-server-response). A missing
1578
+ * iterable, or a truncated shell decode whose value landed past the
1579
+ * boundary, reads as absent and falls back to the static stale time.
1849
1580
  *
1850
1581
  * For the one response kind that isn't buffered when read — a dynamic `Full`
1851
1582
  * response (fetchStrategy.Full with Partial Prefetching disabled) — use
@@ -1854,76 +1585,60 @@ payloadFetchStrategy) {
1854
1585
  if (staleTime === undefined) {
1855
1586
  return now + _navigatereducer.STATIC_STALETIME_MS;
1856
1587
  }
1857
- const iterator = staleTime[Symbol.asyncIterator]();
1858
- let staleTimeSeconds;
1859
- while(true){
1860
- const chunk = iterator.next();
1861
- chunk.then(noop, noop);
1862
- if (chunk.status !== 'fulfilled' || chunk.value === undefined) {
1863
- break;
1864
- }
1865
- if (chunk.value.done) {
1866
- break;
1867
- }
1868
- staleTimeSeconds = chunk.value.value;
1869
- }
1870
- if (staleTimeSeconds === undefined || isNaN(staleTimeSeconds)) {
1588
+ const staleTimeSeconds = (0, _decodeserverresponse.readFulfilledStaleTimeSeconds)(staleTime);
1589
+ if (staleTimeSeconds === null) {
1871
1590
  return now + _navigatereducer.STATIC_STALETIME_MS;
1872
1591
  }
1873
1592
  return now + getStaleTimeMs(staleTimeSeconds);
1874
1593
  }
1875
- const noop = ()=>{};
1876
1594
  /**
1877
1595
  * The localized retry loop for an upgradeable fallback shell. Re-issues the
1878
- * exact same segment-bundle request (via `fetchSegmentsOnCacheMissImpl`) up to
1879
- * MAX_FALLBACK_RETRIES times, FALLBACK_RETRY_DELAY_MS apart, until the server
1880
- * returns the concrete (upgraded) version. On success it upserts the upgraded
1881
- * segments (so they aren't re-fetched) and pings the task, so the task's
1882
- * *other* fallback segments get re-attempted. If every attempt is still a
1883
- * fallback (or fails), it gives up.
1596
+ * exact same segment-bundle request up to MAX_FALLBACK_RETRIES times,
1597
+ * FALLBACK_RETRY_DELAY_MS apart, until the server returns the concrete
1598
+ * (upgraded) version. The fetch writes the upgraded response through the
1599
+ * same payload writes as the initial fetch, so every slot the initial fetch
1600
+ * wrote — including the shell paths, even when the upgraded response is
1601
+ * fully static (shell === full) — is upgraded; the spawned entries were
1602
+ * already settled by the initial fetch, so every write is a detached upsert
1603
+ * that replaces the fallback. On success the loop pings the task, so the
1604
+ * task's *other* fallback segments get re-attempted. If every attempt is
1605
+ * still a fallback (or fails), it gives up.
1884
1606
  *
1885
- * A loop runs at most once per task, ever (the caller gates on
1886
- * `fallbackRetryStatus === Empty`, set to `Pending` before this runs and never
1887
- * reset to `Empty`). The sleep timer is never `clearTimeout`-ed, so the awaited
1888
- * sleep always settles; the loop simply checks `isCanceled` after waking and
1889
- * bails if the task was canceled in the meantime. On success the status becomes
1890
- * `Fulfilled`; on any non-success exit (exhausted retries, fetch error, or
1891
- * cancel) it becomes `Rejected`.
1892
- */ async function retryUpgradeableFallbackPrefetch(task, route, routeKey, tree, segments, segmentCount, // The strategy the initial fetch wrote its payloads with; the upgraded
1893
- // result is written through the same payload fork so the same cache slots
1894
- // (including the shell paths) are upgraded.
1607
+ * A loop runs at most once per task, ever (fetchAndWritePerSegmentPrefetchResponse
1608
+ * gates on `fallbackRetryStatus === Empty`, set to `Pending` before this runs
1609
+ * and never reset to `Empty`). The sleep timer is never `clearTimeout`-ed, so
1610
+ * the awaited sleep always settles; the loop simply checks `isCanceled` after
1611
+ * waking and bails if the task was canceled in the meantime. On success the
1612
+ * status becomes `Fulfilled`; on any non-success exit (exhausted retries,
1613
+ * fetch error, or cancel) it becomes `Rejected`.
1614
+ */ async function retryUpgradeableFallbackPrefetch(task, route, routeKey, tree, spawnedEntries, // The strategy the initial fetch wrote its payloads with.
1895
1615
  fetchStrategy) {
1896
1616
  for(let attempt = 0; attempt < MAX_FALLBACK_RETRIES; attempt++){
1897
1617
  await new Promise((resolve)=>setTimeout(resolve, FALLBACK_RETRY_DELAY_MS));
1898
1618
  if (task.isCanceled) {
1899
1619
  break;
1900
1620
  }
1901
- let result;
1621
+ let isUpgradeableISRFallback;
1902
1622
  try {
1903
- result = await fetchSegmentsOnCacheMissImpl(route, routeKey, tree);
1623
+ isUpgradeableISRFallback = await fetchAndWritePerSegmentPrefetchResponse(task, route, routeKey, tree, spawnedEntries, fetchStrategy, // A response that is still a fallback shell is discarded rather than
1624
+ // pointlessly re-written over the identical fallback content the
1625
+ // initial fetch already cached.
1626
+ true);
1904
1627
  } catch {
1905
1628
  break;
1906
1629
  }
1907
1630
  if (task.isCanceled) {
1908
1631
  break;
1909
1632
  }
1910
- if (result === null) {
1633
+ if (isUpgradeableISRFallback === null) {
1911
1634
  continue;
1912
1635
  }
1913
- if (result.serverResponse.isUpgradeableISRFallback) {
1636
+ if (isUpgradeableISRFallback) {
1914
1637
  continue;
1915
1638
  }
1916
- // Success: the server returned the concrete (upgraded) version. Write it
1917
- // back through the same payload fork as the initial fetch, so every slot
1918
- // the initial fetch wrote — including the shell paths, even when the
1919
- // upgraded response is fully static (shell === full) — is upgraded. The
1920
- // bundle's entries were already settled by the initial fetch, so every
1921
- // write is a detached upsert that replaces the fallback. Mark the loop
1922
- // fulfilled and ping the task; its other fallback segments are now
1923
- // allowed to revalidate.
1924
- const { serverResponse, shellResponse, responseSize } = result;
1925
- const now = Date.now();
1926
- writeSegmentBundleResponseVariants(task.segmentCacheMap, serverResponse, shellResponse, responseSize, segments, segmentCount, now, fetchStrategy);
1639
+ // Success: the server returned the concrete (upgraded) version, and the
1640
+ // fetch wrote it into the cache. The task's other fallback segments are
1641
+ // now allowed to revalidate.
1927
1642
  task.fallbackRetryStatus = _cachemap.EntryStatus.Fulfilled;
1928
1643
  (0, _scheduler.pingPrefetchTask)(task);
1929
1644
  return;
@@ -1932,17 +1647,27 @@ fetchStrategy) {
1932
1647
  // fetch error, or the task was canceled). It won't run again for this task.
1933
1648
  task.fallbackRetryStatus = _cachemap.EntryStatus.Rejected;
1934
1649
  }
1935
- async function fetchSegmentPrefetchesUsingDynamicRequest(task, route, fetchStrategy, dynamicRequestTree, spawnedEntries) {
1650
+ async function fetchSegmentPrefetchesUsingRuntimeRequest(task, route, fetchStrategy, requestTree, spawnedEntries) {
1936
1651
  const key = task.key;
1937
1652
  const url = new URL(route.canonicalUrl, location.origin);
1938
1653
  const nextUrl = key.nextUrl;
1939
- if (spawnedEntries.size === 1 && spawnedEntries.has(route.metadata.requestKey)) {
1940
- // The only thing pending is the head. Instruct the server to
1941
- // skip over everything else.
1942
- // TODO: Lift this logic into the caller. Or perhaps unify the
1943
- // "request tree" and the spawnedEntries into the same type so they are
1944
- // guaranteed to always been in sync.
1654
+ // When the request tree was derived from a predicted route entry, pass the
1655
+ // node it was predicted from to the write path so the prediction can be
1656
+ // disabled if the server's rendered tree diverges from it. For an entry
1657
+ // the server resolved this is null: a divergence from it says nothing
1658
+ // about route prediction, and its unfulfilled entries take the usual
1659
+ // backoff.
1660
+ let dynamicRequestTree;
1661
+ let predictedFrom;
1662
+ if (spawnedEntries.size === 1 && spawnedEntries.has(route.root.head.requestKey)) {
1663
+ // Only the head is pending, so ask the server for metadata only: it skips
1664
+ // the segments and renders just the head. The stub is not derived from
1665
+ // the route entry, so divergence from it carries no signal.
1945
1666
  dynamicRequestTree = MetadataOnlyRequestTree;
1667
+ predictedFrom = null;
1668
+ } else {
1669
+ dynamicRequestTree = requestTree;
1670
+ predictedFrom = route.predictedFrom;
1946
1671
  }
1947
1672
  const headers = {
1948
1673
  [_approuterheaders.RSC_HEADER]: '1',
@@ -1981,7 +1706,7 @@ async function fetchSegmentPrefetchesUsingDynamicRequest(task, route, fetchStrat
1981
1706
  if (!response || !response.ok || !response.body) {
1982
1707
  // Server responded with an error, or with a miss. We should still cache
1983
1708
  // the response, but we can try again after 10 seconds.
1984
- rejectSegmentEntriesIfStillPending(spawnedEntries, Date.now() + 10 * 1000);
1709
+ rejectSegmentEntriesIfStillPending(spawnedEntries, Date.now() + REJECTION_BACKOFF_MS);
1985
1710
  return null;
1986
1711
  }
1987
1712
  const renderedSearch = (0, _routeparams.getRenderedSearch)(response);
@@ -1993,7 +1718,7 @@ async function fetchSegmentPrefetchesUsingDynamicRequest(task, route, fetchStrat
1993
1718
  // TODO: For now, since this is an edge case, we reject the prefetch, but
1994
1719
  // the proper way to handle this is to evict the stale route tree entry
1995
1720
  // then fill the cache with the new response.
1996
- rejectSegmentEntriesIfStillPending(spawnedEntries, Date.now() + 10 * 1000);
1721
+ rejectSegmentEntriesIfStillPending(spawnedEntries, Date.now() + REJECTION_BACKOFF_MS);
1997
1722
  return null;
1998
1723
  }
1999
1724
  // Track when the network connection closes. Only meaningful for Full
@@ -2001,14 +1726,14 @@ async function fetchSegmentPrefetchesUsingDynamicRequest(task, route, fetchStrat
2001
1726
  // paths, this is resolved immediately — see TODO in fetchRouteOnCacheMiss.
2002
1727
  const closed = (0, _promisewithresolvers.createPromiseWithResolvers)();
2003
1728
  let fulfilledEntries = null;
2004
- let prefetchStream;
2005
1729
  let bufferedResponseSize = null;
1730
+ let serverDataPromise;
2006
1731
  if (fetchStrategy === _types.FetchStrategy.Full) {
2007
1732
  // Full prefetches are dynamic responses stored in the prefetch cache.
2008
1733
  // They don't carry vary params or other cache metadata, so there's no
2009
1734
  // need to buffer them. Use the incremental version to allow data to be
2010
1735
  // processed as it arrives.
2011
- prefetchStream = createIncrementalPrefetchResponseStream(response.body, closed.resolve, function onResponseSizeUpdate(totalBytesReceivedSoFar) {
1736
+ const prefetchStream = createIncrementalPrefetchResponseStream(response.body, closed.resolve, function onResponseSizeUpdate(totalBytesReceivedSoFar) {
2012
1737
  // When processing a dynamic response, we don't know how large each
2013
1738
  // individual segment is, so approximate by assigning each segment
2014
1739
  // the average of the total response size.
@@ -2022,145 +1747,39 @@ async function fetchSegmentPrefetchesUsingDynamicRequest(task, route, fetchStrat
2022
1747
  (0, _cachemap.setSizeInCacheMap)(entry, averageSize);
2023
1748
  }
2024
1749
  });
1750
+ serverDataPromise = (0, _fetchserverresponse.createFromNextReadableStream)(prefetchStream, headers, {
1751
+ allowPartialStream: true
1752
+ });
2025
1753
  } else {
2026
- const { stream, size } = await createNonTaskyPrefetchResponseStream(response.body);
1754
+ const buffer = await bufferPrefetchResponseBody(response.body);
2027
1755
  closed.resolve();
2028
- prefetchStream = stream;
2029
- bufferedResponseSize = size;
1756
+ bufferedResponseSize = buffer.byteLength;
1757
+ serverDataPromise = (0, _fetchserverresponse.decodeBufferedStage)(buffer, headers);
2030
1758
  }
2031
1759
  const [serverData, cacheData] = await Promise.all([
2032
- (0, _fetchserverresponse.createFromNextReadableStream)(prefetchStream, headers, {
2033
- allowPartialStream: true
2034
- }),
1760
+ serverDataPromise,
2035
1761
  response.cacheData
2036
1762
  ]);
2037
1763
  const now = Date.now();
2038
1764
  const staleAt = await resolveStaleAt(now, serverData.s, response);
2039
1765
  const buildId = response.headers.get(_constants.NEXT_NAV_DEPLOYMENT_ID_HEADER) ?? serverData.b;
2040
- // Check if a reusable App Shell can be extracted from the main response.
2041
- let serverDataThatSatisfiesSpawnedEntries;
2042
- // The shell and full response have independent stale times. Track the
2043
- // staleAt that corresponds to whatever payload the spawned entries get
2044
- // filled with below.
2045
- let staleAtForSpawnedEntries = staleAt;
2046
- if (cacheData === null) {
2047
- // No shell can be extracted without cache metadata (only present when
2048
- // Cached Navigations is enabled). For routes without a distinct App Shell
2049
- // the extraction below is a no-op anyway (`resolveShellStageData` returns
2050
- // null), so this just short-circuits that case.
2051
- serverDataThatSatisfiesSpawnedEntries = serverData;
2052
- } else {
2053
- const shellStageData = await (0, _fetchserverresponse.resolveShellStageData)(cacheData, serverData, headers);
2054
- if (shellStageData === null) {
2055
- // No App Shell can be extracted. This usually means the entire response
2056
- // _is_ the App Shell. The other possibility (for now, until the feature
2057
- // is fully stabilized) is that App Shells are not yet enabled. Either
2058
- // way, there's nothing extra for us to do: fulfill the pending entries
2059
- // using the response from the server.
2060
- serverDataThatSatisfiesSpawnedEntries = serverData;
2061
- } else {
2062
- // Successfully extracted an App Shell that is a subset of the main
2063
- // response. Depending on the type of prefetch this is, we need to
2064
- // decide whether to fulfill the pending entries with the shell or with
2065
- // the entire response. In either scenario, we'll be inserting _both_
2066
- // versions of the response into the cache; the extra logic is only
2067
- // here so that we don't fulfill pending shell entries with something
2068
- // that's more concrete than what they expect.
2069
- // TODO: The only reason this matters is because during a navigation,
2070
- // if a segment is still pending, we render a promise that resolves to
2071
- // the eventual value of that segment. But that means we cannot
2072
- // eventually resolve that segment to something more concrete than what
2073
- // was already requested. Hence the extra logic here. A cleaner way to
2074
- // model this, though, is whenever we render a promise that resolves to
2075
- // the result of a pending entry, do one additional cache look-up right
2076
- // after the promise resolves, to ensure we never get a mismatching
2077
- // entry. Leaving this for a follow up.
2078
- // shellStageData is a fully-buffered stage decode, so read staleTime
2079
- // synchronously off the thenable status.
2080
- const shellStaleAt = readFulfilledStaleAt(now, shellStageData.s);
2081
- if (fetchStrategy === _types.FetchStrategy.RuntimeShell) {
2082
- // This is a Shell prefetch, so the pending entries must be fulfilled
2083
- // with the shell.
2084
- serverDataThatSatisfiesSpawnedEntries = shellStageData;
2085
- staleAtForSpawnedEntries = shellStaleAt;
2086
- // Separately, we'll also cache the entire response, by upserting it
2087
- // into the cache.
2088
- writePrerenderResponseIntoCache(now, _types.FetchStrategy.PPR, serverData.f, buildId, serverData.h, serverData.r ?? null, staleAt, dynamicRequestTree, renderedSearch, cacheData.isResponsePartial, task.segmentCacheMap);
2089
- } else {
2090
- // This is _not_ a Shell prefetch, so the pending entries should be
2091
- // fulfilled with the entire response.
2092
- serverDataThatSatisfiesSpawnedEntries = serverData;
2093
- // Additionally, we might as well upsert the extracted Shell into the
2094
- // cache, too.
2095
- // `shellStageData` is only provided in cases where the shell is
2096
- // different from the main response. If they are equivalent, this
2097
- // branch is skipped. So it follows that any shell data reaches
2098
- // this path must be partial -- it does not represent the entire
2099
- // UI of the target page.
2100
- const isShellStagePartial = true;
2101
- writePrerenderResponseIntoCache(now, _types.FetchStrategy.RuntimeShell, shellStageData.f, buildId, shellStageData.h, shellStageData.r ?? null, shellStaleAt, dynamicRequestTree, renderedSearch, isShellStagePartial, task.segmentCacheMap);
2102
- }
2103
- }
2104
- }
2105
- // Read head vary params synchronously (unioning in the response-level root
2106
- // params). Individual segments carry their own iterables in
2107
- // CacheNodeSeedData; the root iterable is threaded down so each segment
2108
- // unions it too.
2109
- const rootVaryParamsIterable = serverDataThatSatisfiesSpawnedEntries.r ?? null;
2110
- const headVaryParams = (0, _varyparamsdecoding.readVaryParams)(serverDataThatSatisfiesSpawnedEntries.h, rootVaryParamsIterable);
2111
- // PPRRuntime and RuntimeShell prefetches are partial when the server
2112
- // marks the response as '~' (Partial). RuntimeShell additionally omits
2113
- // every dynamic suspense boundary below the App Shell, so its segments
2114
- // are always partial regardless of what the server marker says.
2115
- // Full/LoadingBoundary prefetches are always complete.
2116
- const isResponsePartial = fetchStrategy === _types.FetchStrategy.RuntimeShell || fetchStrategy === _types.FetchStrategy.PPRRuntime && (cacheData?.isResponsePartial ?? false);
2117
- const flightDatas = (0, _flightdatahelpers.normalizeFlightData)(serverDataThatSatisfiesSpawnedEntries.f);
2118
- if (typeof flightDatas === 'string') {
2119
- rejectSegmentEntriesIfStillPending(spawnedEntries, Date.now() + 10 * 1000);
2120
- return null;
2121
- }
2122
- const navigationSeed = (0, _navigation.convertServerPatchToFullTree)(now, dynamicRequestTree, flightDatas, renderedSearch, // Not needed for prefetch responses; pass unknown to use the default.
2123
- _bfcache.UnknownDynamicStaleTime);
2124
- if (navigationSeed.treeDivergedFromBase && // A head-only request uses the MetadataOnlyRequestTree stub rather than
2125
- // a tree derived from the route entry, so divergence from it carries
2126
- // no signal.
2127
- // TODO: This special case goes away once convertServerPatchToFullTree
2128
- // diffs against the base RouteTree (route.tree) instead of the
2129
- // request tree.
2130
- dynamicRequestTree !== MetadataOnlyRequestTree) {
2131
- // The server rendered a different route tree than the one we requested:
2132
- // the URL has a rewrite that behaves dynamically, so the params baked
2133
- // into the request are wrong and the server can never fulfill it. Mark
2134
- // the route entry — which doubles as the stored prediction pattern, so
2135
- // this also disables a bad prediction (see matchKnownRoute) that would
2136
- // otherwise be re-derived on every retry — and invalidate entries that
2137
- // were derived from it. This mirrors dispatchRetryDueToTreeMismatch on
2138
- // the navigation path. It can't loop: the refetched route entry is
2139
- // built from the server's response, so it only mismatches again if the
2140
- // rewrite's behavior changes again.
2141
- markRouteEntryAsDynamicRewrite(route);
2142
- invalidateRouteCacheEntries(key.nextUrl, task.treeAtTimeOfPrefetch);
2143
- // Reject with an immediate expiration instead of the usual backoff: the
2144
- // invalidation above triggers a re-prefetch, which per the above does
2145
- // not loop.
2146
- // TODO: Consider also bounding retries with a counter on the task
2147
- // object, so a prefetch that repeatedly fails to settle backs off
2148
- // regardless of the reason.
2149
- rejectSegmentEntriesIfStillPending(spawnedEntries, -1);
2150
- return null;
2151
- }
2152
- // Aside from writing the data into the cache, this function also returns
2153
- // the entries that were fulfilled, so we can streamingly update their sizes
2154
- // in the LRU as more data comes in.
2155
- fulfilledEntries = writeDynamicRenderResponseIntoCache(now, fetchStrategy, flightDatas, buildId, isResponsePartial, headVaryParams, rootVaryParamsIterable, staleAtForSpawnedEntries, navigationSeed, spawnedEntries, task.segmentCacheMap);
2156
- // For buffered responses, update LRU sizes now that we know which
2157
- // entries were fulfilled.
2158
- if (bufferedResponseSize !== null && fulfilledEntries !== null && fulfilledEntries.length > 0) {
2159
- const averageSize = bufferedResponseSize / fulfilledEntries.length;
2160
- for (const entry of fulfilledEntries){
2161
- (0, _cachemap.setSizeInCacheMap)(entry, averageSize);
2162
- }
2163
- }
1766
+ // Extract the response's shell-stage payload, when it carries one. No
1767
+ // shell can be extracted without cache metadata (only present when
1768
+ // Cached Navigations is enabled); for responses without a distinct
1769
+ // shell stage the extraction is a no-op anyway
1770
+ // (`resolveShellStageResponse` returns null), so the null check just
1771
+ // short-circuits that case.
1772
+ const shellResponse = cacheData !== null ? await (0, _fetchserverresponse.resolveShellStageResponse)(cacheData, serverData, headers) : null;
1773
+ // Runtime prefetch responses (PPRRuntime and RuntimeShell requests) are
1774
+ // partial when the server marks the response as '~' (Partial).
1775
+ // Full/LoadingBoundary prefetch responses are always complete.
1776
+ const isFullResponsePartial = (fetchStrategy === _types.FetchStrategy.PPRRuntime || fetchStrategy === _types.FetchStrategy.RuntimeShell) && (cacheData?.isResponsePartial ?? false);
1777
+ // Aside from writing the data into the cache, this also returns the
1778
+ // entries that were fulfilled, so we can streamingly update their sizes
1779
+ // in the LRU as more data comes in (Full responses, which stream).
1780
+ fulfilledEntries = writeResponsePayloadsIntoCache(now, fetchStrategy, serverData, shellResponse, dynamicRequestTree, predictedFrom, // Navigation responses always include the param values in the tree, so
1781
+ // there's no pathname to parse them from (nor a need to).
1782
+ null, renderedSearch, buildId, staleAt, isFullResponsePartial, null, spawnedEntries, bufferedResponseSize, task.segmentCacheMap);
2164
1783
  // Return a promise that resolves when the network connection closes, so
2165
1784
  // the scheduler can track the number of concurrent network connections.
2166
1785
  return {
@@ -2168,143 +1787,349 @@ async function fetchSegmentPrefetchesUsingDynamicRequest(task, route, fetchStrat
2168
1787
  closed: closed.promise
2169
1788
  };
2170
1789
  } catch (error) {
2171
- if (process.env.__NEXT_USE_OFFLINE) {
2172
- const { checkOfflineError } = require('../offline');
2173
- if (checkOfflineError(error)) {
2174
- // Unlike navigations and server actions, prefetches don't await
2175
- // waitForConnection — they just reject the cache entry with an
2176
- // immediate expiration so it gets retried once the scheduler is
2177
- // re-pinged after connectivity is restored.
2178
- rejectSegmentEntriesIfStillPending(spawnedEntries, -1);
2179
- return null;
2180
- }
2181
- }
2182
- rejectSegmentEntriesIfStillPending(spawnedEntries, Date.now() + 10 * 1000);
1790
+ rejectSegmentEntriesIfStillPending(spawnedEntries, getPrefetchErrorStaleAt(error));
2183
1791
  return null;
2184
1792
  }
2185
1793
  }
2186
- function writeDynamicTreeResponseIntoCache(now, fetchStrategy, response, serverData, entry, couldBeIntercepted, canonicalUrl, routeIsPPREnabled, headVaryParams, rootVaryParamsIterable, originalPathname, originalSearch, nextUrl, // The spawning task's `PrefetchTask.segmentCacheMap`.
2187
- map) {
2188
- const renderedSearch = (0, _routeparams.getRenderedSearch)(response);
2189
- const normalizedFlightDataResult = (0, _flightdatahelpers.normalizeFlightData)(serverData.f);
2190
- if (// A string result means navigating to this route will result in an
2191
- // MPA navigation.
2192
- typeof normalizedFlightDataResult === 'string' || normalizedFlightDataResult.length !== 1) {
2193
- rejectRouteCacheEntry(entry, now + 10 * 1000);
2194
- return;
2195
- }
2196
- const flightData = normalizedFlightDataResult[0];
2197
- if (!flightData.isRootRender) {
2198
- // Unexpected response format.
2199
- rejectRouteCacheEntry(entry, now + 10 * 1000);
2200
- return;
2201
- }
2202
- const flightRouterState = flightData.tree;
2203
- // If the response was postponed, segments may contain dynamic holes.
2204
- // The head has its own partiality flag (flightDataEntry.isHeadPartial)
2205
- // which is handled separately in writeDynamicRenderResponseIntoCache.
2206
- const isResponsePartial = response.headers.get(_approuterheaders.NEXT_DID_POSTPONE_HEADER) === '1';
2207
- // Convert the server-sent data into the RouteTree format used by the
2208
- // client cache.
2209
- //
2210
- // During this traversal, we accumulate additional data into this
2211
- // "accumulator" object.
2212
- const acc = {
2213
- metadataVaryPath: null,
2214
- treeDivergedFromBase: false
2215
- };
2216
- const routeTree = convertRootFlightRouterStateToRouteTree(flightRouterState, renderedSearch, acc);
2217
- const metadataVaryPath = acc.metadataVaryPath;
2218
- if (metadataVaryPath === null) {
2219
- rejectRouteCacheEntry(entry, now + 10 * 1000);
2220
- return;
2221
- }
2222
- (0, _optimisticroutes.discoverKnownRoute)(now, originalPathname, originalSearch, nextUrl, entry, routeTree, metadataVaryPath, couldBeIntercepted, canonicalUrl, routeIsPPREnabled, false // hasDynamicRewrite
2223
- );
2224
- // If the server sent segment data as part of the response, we should write
2225
- // it into the cache to prevent a second, redundant prefetch request.
2226
- // TODO: This is a leftover branch from before Client Segment Cache was
2227
- // enabled everywhere. Tree prefetches should never include segment data. We
2228
- // can delete it. Leaving for a subsequent PR.
2229
- const navigationSeed = (0, _navigation.convertServerPatchToFullTree)(now, flightRouterState, normalizedFlightDataResult, renderedSearch, _bfcache.UnknownDynamicStaleTime);
2230
- const buildId = response.headers.get(_constants.NEXT_NAV_DEPLOYMENT_ID_HEADER) ?? serverData.b;
2231
- writeDynamicRenderResponseIntoCache(now, fetchStrategy, normalizedFlightDataResult, buildId, isResponsePartial, headVaryParams, rootVaryParamsIterable, getStaleAtFromHeader(now, response), navigationSeed, null, map);
2232
- }
2233
1794
  function rejectSegmentEntriesIfStillPending(entries, staleAt) {
2234
- const fulfilledEntries = [];
2235
1795
  for (const entry of entries.values()){
2236
1796
  if (entry.status === _cachemap.EntryStatus.Pending) {
2237
1797
  rejectSegmentCacheEntry(entry, staleAt);
2238
- } else if (entry.status === _cachemap.EntryStatus.Fulfilled) {
2239
- fulfilledEntries.push(entry);
1798
+ }
1799
+ }
1800
+ }
1801
+ /**
1802
+ * Writes a prefetch response's payloads into the cache: the full payload,
1803
+ * plus its shell payload when the response carries one. This is the write
1804
+ * orchestration shared by the prefetch response kinds — per-segment
1805
+ * static responses (fetchAndWritePerSegmentPrefetchResponse) and
1806
+ * live-render responses (fetchSegmentPrefetchesUsingRuntimeRequest, and the
1807
+ * embedded runtime prefetch stream via writeRuntimePrefetchStreamIntoCache)
1808
+ * — which differ in how they obtain their payloads but not in what must
1809
+ * happen to them.
1810
+ *
1811
+ * Returns the entries the fulfilling payload's write produced content into
1812
+ * (so the streaming caller can keep updating their LRU sizes as bytes
1813
+ * arrive), or null if nothing entered the cache.
1814
+ */ function writeResponsePayloadsIntoCache(now, // The strategy of the request that produced the response. Decides which
1815
+ // payload fulfills the spawned entries and their keying, and identifies
1816
+ // the response family: PPR/StaticShell are per-segment static responses,
1817
+ // everything else a live-render response.
1818
+ fetchStrategy, fullPayload, // The response's shell payload: null (the response carries no shell),
1819
+ // `fullPayload` itself (the shell IS the full response), or a distinct
1820
+ // stage decode truncated at the shell byte boundary.
1821
+ shellPayload, // The next five are threaded through to every write; see
1822
+ // writeServerResponseIntoCache for their meaning.
1823
+ baseTree, predictedFrom, renderedPathname, renderedSearch, buildId, // Response-level staleness of the full payload. The shell payload's own
1824
+ // staleness is read off the shell decode below (a shell payload is always
1825
+ // fully buffered).
1826
+ staleAt, // Whether anything in the full payload is not fully resolved (dynamic or runtime holes, anything suspended). Shell-tier
1827
+ // writes don't consume it: a shell payload is partial by construction.
1828
+ // (Per-segment payloads encode partiality per node and ignore the
1829
+ // response-level value entirely.)
1830
+ isFullResponsePartial, metadataVaryPath, // The pending entries this response fulfills. Null when the caller owns
1831
+ // none (the embedded runtime prefetch stream), in which case every write
1832
+ // is a detached upsert.
1833
+ spawnedEntries, // The response's size in bytes, distributed across the entries the
1834
+ // fulfilling payload's write produced; null when unknown (streamed Full
1835
+ // responses — the caller sizes those incrementally as bytes
1836
+ // arrive instead).
1837
+ responseByteLength, // The map the work that spawned this response's request is bound to. See
1838
+ // writeServerResponseIntoCache.
1839
+ map) {
1840
+ let fulfilledEntries;
1841
+ if (shellPayload === null || // `FetchStrategy.LoadingBoundary` is not used in Cache Components,
1842
+ // and we only recover shells in Cache Components.
1843
+ fetchStrategy === _types.FetchStrategy.LoadingBoundary) {
1844
+ if (fetchStrategy === _types.FetchStrategy.StaticShell) {
1845
+ // A static shell was requested but the response carries no shell (its
1846
+ // shell byte offset read as 0 — a bug in Next.js itself — or the
1847
+ // shell prefix couldn't be decoded). The full payload is still
1848
+ // usable, so it's written detached at the concrete tier; the spawned
1849
+ // entries are rejected so the task isn't stranded blocking on them.
1850
+ // Note the scheduler does NOT fall back to a runtime request for
1851
+ // rejected segments — it skips them outright (see the Rejected case
1852
+ // in pingSegmentBundle in scheduler.ts), so these segments get no
1853
+ // shell prefetch and no runtime substitute until the rejection's
1854
+ // backoff expires.
1855
+ writeServerResponseIntoCache(now, _types.FetchStrategy.PPR, fullPayload, baseTree, predictedFrom, renderedPathname, renderedSearch, buildId, staleAt, isFullResponsePartial, metadataVaryPath, null, null, map);
1856
+ if (spawnedEntries !== null) {
1857
+ rejectSegmentEntriesIfStillPending(spawnedEntries, now + REJECTION_BACKOFF_MS);
1858
+ }
1859
+ return null;
1860
+ }
1861
+ // This request either:
1862
+ // - didn't allow recovering a shell (no staged rendering),
1863
+ // - or was a (runtime) shell request (that was NOT served by a fully static prerender)
1864
+ // so we already have a shell without recovering anything.
1865
+ // In either case, we don't have anything to consider other than the request itself,
1866
+ // so the payload simply fulfills the spawned entries at the request's own keying.
1867
+ fulfilledEntries = writeServerResponseIntoCache(now, fetchStrategy, fullPayload, baseTree, predictedFrom, renderedPathname, renderedSearch, buildId, staleAt, isFullResponsePartial, metadataVaryPath, spawnedEntries, null, map);
1868
+ } else if (shellPayload === fullPayload) {
1869
+ // The shell IS the full response (reference-equal — a page with nothing
1870
+ // below its shell). One payload fulfills the spawned entries, recording
1871
+ // the strategy that describes the CONTENT — the full payload's tier.
1872
+ // The content tier also drives the entries' keying: content that isn't
1873
+ // shell-grade is param-independent only on the server's vary-params
1874
+ // evidence, so it must not be parked in the shell slot on the strength
1875
+ // of the missing split alone (see the keying derivation in
1876
+ // writeSegmentDataIntoCache).
1877
+ let contentFetchStrategy;
1878
+ switch(fetchStrategy){
1879
+ case _types.FetchStrategy.StaticShell:
1880
+ {
1881
+ // a StaticShell always uses a PPR-tier request, so we need to fulfill
1882
+ // the spawned shell entries at the PPR tier.
1883
+ contentFetchStrategy = _types.FetchStrategy.PPR;
1884
+ break;
1885
+ }
1886
+ case _types.FetchStrategy.RuntimeShell:
1887
+ {
1888
+ // a runtime shell request is not normally rewindable, but fully static pages
1889
+ // the server will return a static prerender result, which *is* rewindable.
1890
+ contentFetchStrategy = _types.FetchStrategy.PPRRuntime;
1891
+ break;
1892
+ }
1893
+ case _types.FetchStrategy.PPR:
1894
+ case _types.FetchStrategy.PPRRuntime:
1895
+ case _types.FetchStrategy.Full:
1896
+ {
1897
+ // No shell was requested, so we don't need to override the fetch strategy.
1898
+ contentFetchStrategy = null;
1899
+ }
1900
+ }
1901
+ fulfilledEntries = writeServerResponseIntoCache(now, fetchStrategy, fullPayload, baseTree, predictedFrom, renderedPathname, renderedSearch, buildId, staleAt, isFullResponsePartial, metadataVaryPath, spawnedEntries, contentFetchStrategy, map);
1902
+ } else {
1903
+ // The shell is a strict prefix of the response. Write both payloads.
1904
+ // The payload matching the tier the spawned entries were requested at
1905
+ // fulfills them; the other is written detached (no owned entries —
1906
+ // every write is an upsert). Fulfilling a spawned shell entry with the
1907
+ // concrete payload would store content that doesn't match the entry's
1908
+ // shell vary path — wrong for every later read at that key, and
1909
+ // immediately observable during a navigation, where a pending entry can
1910
+ // be rendered as a promise that resolves to its eventual value.
1911
+ //
1912
+ // The full payload is written first. The order is not observable: the
1913
+ // two writes key at different tiers, upsert precedence between a full
1914
+ // payload and its own shell payload is order-independent (the full
1915
+ // payload always wins the comparison — a shell segment is never
1916
+ // complete where its full counterpart is partial, see
1917
+ // readFulfilledIsPartial), and fulfillment pings only enqueue scheduler
1918
+ // work that runs after this synchronous block. Full-first is preferred
1919
+ // so the shell write's precedence checks and shadow eviction compare
1920
+ // against the fresh concrete entry rather than whatever stale entry
1921
+ // preceded it.
1922
+ let responseFetchStrategy;
1923
+ let shellFetchStrategy;
1924
+ switch(fetchStrategy){
1925
+ case _types.FetchStrategy.StaticShell:
1926
+ case _types.FetchStrategy.PPR:
1927
+ {
1928
+ // Static request.
1929
+ // a StaticShell fetch strategy performs a request that returns
1930
+ // a PPR-tier response that can be rewound to a StaticShell response,
1931
+ // So we upgrade the full response's strategy to `PPR`.
1932
+ // (A static response's tier may be raised if we know that a static request
1933
+ // would satisfy a runtime request -- see `recordedFetchStrategy` in
1934
+ // `writeSegmentDataIntoCache`)
1935
+ responseFetchStrategy = _types.FetchStrategy.PPR;
1936
+ shellFetchStrategy = _types.FetchStrategy.StaticShell;
1937
+ break;
1938
+ }
1939
+ case _types.FetchStrategy.RuntimeShell:
1940
+ {
1941
+ // A runtime shell request is normally not rewindable -- it only produces
1942
+ // the shell itself. However, if a page is fully static, a runtime shell
1943
+ // will return a static prerender, i.e. the static content with an embedded shell.
1944
+ // The page is static, so we can treat the content as runtime-complete.
1945
+ responseFetchStrategy = _types.FetchStrategy.PPRRuntime;
1946
+ shellFetchStrategy = _types.FetchStrategy.RuntimeShell;
1947
+ break;
1948
+ }
1949
+ case _types.FetchStrategy.PPRRuntime:
1950
+ {
1951
+ // A runtime prefetch response can be rewound into a runtime shell.
1952
+ // (This may also be a fully static response, same as RuntimeShell above,
1953
+ // in which case we also know that the shell is equivalent to a runtime shell)
1954
+ responseFetchStrategy = _types.FetchStrategy.PPRRuntime;
1955
+ shellFetchStrategy = _types.FetchStrategy.RuntimeShell;
1956
+ break;
1957
+ }
1958
+ case _types.FetchStrategy.Full:
1959
+ {
1960
+ // Navigation responses can be rewound into a *static* app shell.
1961
+ // On PPF routes they also contain a runtime prefetch stream which will give us
1962
+ // a runtime shell/prefetch, but that's handled separately from the main response.
1963
+ // (see `writeRuntimePrefetchStreamIntoCache`)
1964
+ responseFetchStrategy = _types.FetchStrategy.Full;
1965
+ shellFetchStrategy = _types.FetchStrategy.StaticShell;
1966
+ break;
1967
+ }
1968
+ }
1969
+ // We have to fulfill the correct pending entries depending on what was requested:
1970
+ // - If we originally needed a shell but and got more content, the spawned entries
1971
+ // should be fulfilled using the shell.
1972
+ // - If we needed a speculative or full request but rewound it into a shell,
1973
+ // the spawned entries should be fulfilled using the full response.
1974
+ const wasShellRequested = fetchStrategy === _types.FetchStrategy.StaticShell || fetchStrategy === _types.FetchStrategy.RuntimeShell;
1975
+ const fullFulfilledEntries = writeServerResponseIntoCache(now, responseFetchStrategy, fullPayload, baseTree, predictedFrom, renderedPathname, renderedSearch, buildId, staleAt, isFullResponsePartial, metadataVaryPath, wasShellRequested ? null : spawnedEntries, null, map);
1976
+ const shellFulfilledEntries = writeServerResponseIntoCache(now, shellFetchStrategy, shellPayload, baseTree, predictedFrom, renderedPathname, renderedSearch, buildId, // The shell payload carries its own staleness, independent of the
1977
+ // full payload's. Shell decodes are fully buffered, so it's read
1978
+ // synchronously; when absent (per-segment responses carry staleTime
1979
+ // per node instead) this falls back to the same static stale time the
1980
+ // per-segment writes use as their response-level fallback.
1981
+ readFulfilledStaleAt(now, shellPayload.s), // A shell payload is a strict subset of the full response, so it does
1982
+ // not represent the entire UI of the target page — it's partial
1983
+ // by construction.
1984
+ true, metadataVaryPath, wasShellRequested ? spawnedEntries : null, null, map);
1985
+ fulfilledEntries = wasShellRequested ? shellFulfilledEntries : fullFulfilledEntries;
1986
+ }
1987
+ // Entries created by a detached write aren't sized: one wire response is
1988
+ // only charged to the LRU once, to the entries it fulfilled.
1989
+ if (responseByteLength !== null && fulfilledEntries !== null && fulfilledEntries.length > 0) {
1990
+ const averageSize = responseByteLength / fulfilledEntries.length;
1991
+ for (const entry of fulfilledEntries){
1992
+ (0, _cachemap.setSizeInCacheMap)(entry, averageSize);
2240
1993
  }
2241
1994
  }
2242
1995
  return fulfilledEntries;
2243
1996
  }
2244
- function writeDynamicRenderResponseIntoCache(now, fetchStrategy, flightDatas, buildId, isResponsePartial, headVaryParams, rootVaryParamsIterable, staleAt, navigationSeed, spawnedEntries, // The map the work that spawned this response's request is bound to: the
1997
+ /**
1998
+ * Writes a decoded server response into the segment cache: decodes the
1999
+ * response's transport tree into a RouteTree — overlaid on `baseTree` when
2000
+ * the response is an overlay over existing client state, root-anchored when
2001
+ * it covers its own spine (per-segment prefetch payloads) — then writes
2002
+ * every rendered segment, plus the head, into the cache. Fulfills the
2003
+ * entries in `spawnedEntries` that the response covers; rejects the rest, so
2004
+ * a task blocked on them isn't stranded. Returns the entries the write
2005
+ * produced content into — fulfilled spawned entries plus installed detached
2006
+ * upserts — for LRU size accounting, or null if nothing entered the cache.
2007
+ *
2008
+ * Serves every response kind: live-render prefetch responses (runtime
2009
+ * prefetches, and Full/LoadingBoundary prefetches in the
2010
+ * non-Partial-Prefetching regime), prerender stage decodes (shell-stage
2011
+ * extraction, cached navigations, the initial payload), embedded runtime
2012
+ * prefetch streams, and the payloads of per-segment prefetch responses.
2013
+ */ function writeServerResponseIntoCache(now, fetchStrategy, // The decoded response payload to write. For a per-segment prefetch
2014
+ // response this is one of its payloads: the full response, or the
2015
+ // truncated shell decode.
2016
+ response, // The base router state the response overlays. Null when the response's
2017
+ // tree is root-anchored (per-segment prefetch payloads).
2018
+ baseTree, // Non-null when `baseTree` was predicted: the node in the known route tree
2019
+ // whose pattern it was predicted from (see matchKnownRoute). The
2020
+ // prediction assumes the URL's rewrite (if any) behaves statically; if the
2021
+ // server's rendered tree diverges from the base, that prediction failed —
2022
+ // the rewrite behaves dynamically, so the params baked into the request
2023
+ // are wrong. The node is marked so the shape is never predicted again, and
2024
+ // the entries that could not be fulfilled are rejected with immediate
2025
+ // expiration so the task retries right away — against the server-resolved
2026
+ // route this time. The response data is still written into the cache: it's
2027
+ // real data keyed by what the server actually rendered, useful regardless
2028
+ // of whether the prediction matched.
2029
+ predictedFrom, // The pathname the response was rendered for, used to resolve dynamic
2030
+ // segments the server sent without a param value (`k: null`). Null for
2031
+ // responses that always carry concrete values (navigation responses).
2032
+ renderedPathname, renderedSearch, buildId, // Response-level staleness; a segment (or the head) with its own
2033
+ // staleTime overrides it.
2034
+ staleAt, // Whether anything in the response is not fully resolved: dynamic holes, runtime holes, anything suspended.
2035
+ // Threaded into the decode, where each segment's (and the head's)
2036
+ // partiality is resolved from it and the wire form (see
2037
+ // createNavigationSeed). Per-segment prefetch responses encode
2038
+ // partiality per node, so their writes pass the conservative value
2039
+ // (true), which is never read.
2040
+ isResponsePartial, // Where to key the head; see createNavigationSeed.
2041
+ metadataVaryPath, spawnedEntries, // The strategy tier describing the CONTENT of the payload being written,
2042
+ // when it differs from `fetchStrategy` (which drives matching and
2043
+ // keying); null when they agree. See the param docs on
2044
+ // writeSegmentDataIntoCache.
2045
+ contentFetchStrategy, // The map the work that spawned this response's request is bound to: the
2245
2046
  // spawning task's `PrefetchTask.segmentCacheMap` for prefetches, the
2246
2047
  // navigation's map for navigation-side writes. Binding the write to the
2247
2048
  // requesting work means a response that lands after a testing-lock scope
2248
2049
  // boundary still writes into the map its entries live in.
2249
2050
  map) {
2051
+ // Which layer owns the buildId check differs by flow. The route and
2052
+ // segment fetch layers check it themselves (see fetchRouteOnCacheMiss and
2053
+ // fetchAndWritePerSegmentPrefetchResponse) because they need the early-out
2054
+ // before side effects this layer can't undo — starting the fallback-retry
2055
+ // loop, writing the second (shell) payload — and then pass no buildId
2056
+ // here. This check owns it for the flows that don't: live-render prefetch
2057
+ // responses and navigation static-stage writes, which pass their
2058
+ // buildId through.
2250
2059
  if (buildId && buildId !== (0, _navigationbuildid.getNavigationBuildId)()) {
2251
2060
  // The server build does not match the client. Treat as a 404. During
2252
2061
  // an actual navigation, the router will trigger an MPA navigation.
2253
2062
  if (spawnedEntries !== null) {
2254
- rejectSegmentEntriesIfStillPending(spawnedEntries, now + 10 * 1000);
2063
+ rejectSegmentEntriesIfStillPending(spawnedEntries, now + REJECTION_BACKOFF_MS);
2255
2064
  }
2256
2065
  return null;
2257
2066
  }
2258
- const routeTree = navigationSeed.routeTree;
2259
- const metadataTree = navigationSeed.metadataVaryPath !== null ? createMetadataRouteTree(navigationSeed.metadataVaryPath) : null;
2260
- for (const flightDataEntry of flightDatas){
2261
- const seedData = flightDataEntry.seedData;
2262
- if (seedData !== null) {
2263
- // The data sent by the server represents only a subtree of the app. We
2264
- // need to find the part of the task tree that matches the response.
2265
- //
2266
- // segmentPath represents the parent path of subtree. It's a repeating
2267
- // pattern of parallel route key and segment:
2268
- //
2269
- // [string, Segment, string, Segment, string, Segment, ...]
2270
- const segmentPath = flightDataEntry.segmentPath;
2271
- let tree = routeTree;
2272
- for(let i = 0; i < segmentPath.length; i += 2){
2273
- const parallelRouteKey = segmentPath[i];
2274
- const childTree = tree?.slots?.get(parallelRouteKey);
2275
- if (childTree !== undefined) {
2276
- tree = childTree;
2277
- } else {
2278
- if (spawnedEntries !== null) {
2279
- rejectSegmentEntriesIfStillPending(spawnedEntries, now + 10 * 1000);
2280
- }
2281
- return null;
2282
- }
2283
- }
2284
- writeSeedDataIntoCache(now, // A response write is bound to the map its entries live in (the
2285
- // spawning task's `PrefetchTask.segmentCacheMap`).
2286
- map, fetchStrategy, tree, staleAt, seedData, isResponsePartial, rootVaryParamsIterable, spawnedEntries);
2067
+ const transportData = response.t;
2068
+ if (transportData === undefined) {
2069
+ // The response carries no tree. Settle anything we own so a task blocked
2070
+ // on it isn't stranded.
2071
+ if (spawnedEntries !== null) {
2072
+ rejectSegmentEntriesIfStillPending(spawnedEntries, now + REJECTION_BACKOFF_MS);
2287
2073
  }
2288
- const head = flightDataEntry.head;
2289
- if (head !== null && metadataTree !== null) {
2290
- // When Cache Components is enabled, the server's `isHeadPartial` flag
2291
- // (isPossiblyPartialHead in app-render.tsx) is unreliable: it's computed
2292
- // before the head is serialized, so it's conservatively `true` for every
2293
- // statically-generated PPR page — even pages whose head is actually
2294
- // complete — and it's `false` for runtime/dynamic responses whose head is
2295
- // actually partial (e.g. a route with an async `generateMetadata`). So we
2296
- // ignore it and derive the head's partiality from whether the response
2297
- // itself was partial, exactly as we do for segments (see
2298
- // `writeSeedDataIntoCache`). A non-partial response carries a complete
2299
- // head; a partial (postponed) one does not.
2300
- //
2301
- // Without Cache Components, the server sends the correct isHeadPartial.
2302
- const isHeadPartial = process.env.__NEXT_CACHE_COMPONENTS ? isResponsePartial : flightDataEntry.isHeadPartial;
2303
- fulfillEntrySpawnedByRuntimePrefetch(now, // A response write is bound to the map its entries live in (the
2304
- // spawning task's `PrefetchTask.segmentCacheMap`).
2305
- map, fetchStrategy, head, isHeadPartial, staleAt, // For head entries, use the head-specific vary params passed as
2306
- // parameter.
2307
- headVaryParams, metadataTree, spawnedEntries);
2074
+ return null;
2075
+ }
2076
+ const navigationSeed = (0, _decodeserverresponse.createNavigationSeed)(now, baseTree, transportData, // Root params are emitted once at the top level of the response; the
2077
+ // decode unions them into the head's and each segment's own set. For
2078
+ // per-segment prefetch responses this must be read from the payload
2079
+ // being written: a truncated shell decode rewinds the response's
2080
+ // late-resolving values to the shell stage.
2081
+ response.r ?? null, // The decode resolves each segment's partiality from this and the wire:
2082
+ // boolean-form nodes resolve to this response-level value; staged
2083
+ // (promise-form) nodes encode partiality per node and ignore it.
2084
+ isResponsePartial, renderedPathname, renderedSearch, metadataVaryPath, // Only navigations consume the seed's dynamicStaleAt; cache writes pass
2085
+ // unknown to use the default.
2086
+ _bfcache.UnknownDynamicStaleTime);
2087
+ const requiresRuntimeCompleteness = (navigationSeed.root.tree.prefetchHints & _approutertypes.PrefetchHint.SubtreeHasPartialPrefetching) !== 0;
2088
+ const treeDivergedFromPrediction = predictedFrom !== null && navigationSeed.treeDivergedFromBase;
2089
+ if (treeDivergedFromPrediction) {
2090
+ predictedFrom.hasDynamicRewrite = true;
2091
+ }
2092
+ // Only static (per-segment) responses can be ISR fallbacks (`f`). A
2093
+ // present `u` means the response carries a stage-scoped runtime-data
2094
+ // verdict — per-segment prefetch responses always emit one, and so does
2095
+ // any prerendered page payload, which embeds the prerender's runtime-data
2096
+ // probe; live renders emit none. A response without one decodes to a null
2097
+ // verdict, and its entries record their request's own strategy unrefined
2098
+ // (see writeSegmentDataIntoCache).
2099
+ // `u` is deliberately read here, off THIS decode's thenable status, rather
2100
+ // than normalized where the response is fetched: the read scopes it to the
2101
+ // payload being written — a truncated shell decode reads a post-shell
2102
+ // runtime access as pending, i.e. `false`, because the shell variant
2103
+ // itself doesn't need that data. The read is load-bearing in one direction
2104
+ // only: a false `true` costs a wasted runtime request; a false `false`
2105
+ // would record too high a tier and skip a runtime request that had more
2106
+ // content. A rejected row (an aborted prerender errors rows that were
2107
+ // still pending at the abort) must therefore read as `true`, matching the
2108
+ // server's own read of the page payload's flag (see the `u` read in
2109
+ // collect-segment-data.tsx).
2110
+ const isUpgradeableISRFallback = response.f === true;
2111
+ const responseNeedsRuntimeRequest = response.u !== undefined ? (0, _rsctransport.readFulfilledValue)(response.u, false, /* rejectedValue */ true) : null;
2112
+ const routeTree = navigationSeed.root.tree;
2113
+ // The route tree carries the render output of every segment the response
2114
+ // included, so a single traversal from the root writes all of it into
2115
+ // the cache.
2116
+ const writtenEntries = [];
2117
+ writeTreeDataIntoCache(now, map, fetchStrategy, routeTree, staleAt, spawnedEntries, contentFetchStrategy, isUpgradeableISRFallback, requiresRuntimeCompleteness, responseNeedsRuntimeRequest, writtenEntries);
2118
+ const metadataTree = navigationSeed.root.head;
2119
+ const headData = metadataTree.data;
2120
+ if (headData !== null && headData.rsc !== null) {
2121
+ // The head follows the same stale-time rules as a segment.
2122
+ const headStaleAt = headData.staleTimeSeconds !== null ? now + getStaleTimeMs(headData.staleTimeSeconds) : staleAt;
2123
+ // A head has no loading boundary. Match the scheduler, which spawns
2124
+ // LoadingBoundary head entries using the concrete Full strategy (see the
2125
+ // head's runtime fetch in pingRootRouteTree).
2126
+ const headFetchStrategy = fetchStrategy === _types.FetchStrategy.LoadingBoundary ? _types.FetchStrategy.Full : fetchStrategy;
2127
+ const writtenHeadEntry = writeSegmentDataIntoCache(now, map, headFetchStrategy, headData.rsc, // The decode already resolved the head's partiality from the wire
2128
+ // form and the response-level value — see the head read in
2129
+ // createNavigationSeed.
2130
+ headData.isPartial, headStaleAt, headData.varyParams, metadataTree, spawnedEntries, contentFetchStrategy, isUpgradeableISRFallback, requiresRuntimeCompleteness, responseNeedsRuntimeRequest);
2131
+ if (writtenHeadEntry !== null) {
2132
+ writtenEntries.push(writtenHeadEntry);
2308
2133
  }
2309
2134
  }
2310
2135
  // Any entry that's still pending was intentionally not rendered by the
@@ -2316,37 +2141,130 @@ map) {
2316
2141
  // somehow that the reason for the rejection is because of a non-PPR prefetch.
2317
2142
  // That way a per-segment prefetch knows to disregard the rejection.
2318
2143
  if (spawnedEntries !== null) {
2319
- const fulfilledEntries = rejectSegmentEntriesIfStillPending(spawnedEntries, now + 10 * 1000);
2320
- return fulfilledEntries;
2144
+ rejectSegmentEntriesIfStillPending(spawnedEntries, // When the response diverged from the prediction, the leftover entries
2145
+ // can never be fulfilled — their keys were derived from the wrong
2146
+ // tree. Reject with an immediate expiration instead of the usual
2147
+ // backoff so the task retries right away. The prediction was disabled
2148
+ // above, so the retry resolves the route on the server instead of
2149
+ // predicting it again.
2150
+ treeDivergedFromPrediction ? -1 : now + REJECTION_BACKOFF_MS);
2151
+ }
2152
+ return writtenEntries.length > 0 ? writtenEntries : null;
2153
+ }
2154
+ function writeTreeDataIntoCache(now, map, fetchStrategy, tree, staleAt, spawnedEntries, contentFetchStrategy, isUpgradeableISRFallback, requiresRuntimeCompleteness, responseNeedsRuntimeRequest, // Accumulates the entries the walk wrote content into (fulfilled spawned
2155
+ // entries and installed detached upserts), for LRU size accounting.
2156
+ writtenEntries) {
2157
+ // Writes the render output embedded in the route tree into the
2158
+ // prefetch cache.
2159
+ const data = tree.data;
2160
+ if (data !== null && data.rsc !== null) {
2161
+ // A segment carries its own staleTime only in per-segment prefetch
2162
+ // responses; everywhere else the response-level staleness governs.
2163
+ const entryStaleAt = data.staleTimeSeconds !== null ? now + getStaleTimeMs(data.staleTimeSeconds) : staleAt;
2164
+ const writtenEntry = writeSegmentDataIntoCache(now, map, fetchStrategy, data.rsc, data.isPartial, entryStaleAt, data.varyParams, tree, spawnedEntries, contentFetchStrategy, isUpgradeableISRFallback, requiresRuntimeCompleteness, responseNeedsRuntimeRequest);
2165
+ if (writtenEntry !== null) {
2166
+ writtenEntries.push(writtenEntry);
2167
+ }
2168
+ } else {
2169
+ // Either the response carried no information for this segment (no data
2170
+ // object — e.g. the identity spine of a per-segment prefetch response,
2171
+ // or a slot reused from the base tree), or it acknowledged the position
2172
+ // without rendering it (a data object with a null rsc — an intermediate
2173
+ // position on the path to a rendered subtree). Nothing to write either
2174
+ // way, but the children may have output, so keep descending.
2321
2175
  }
2322
- return null;
2323
- }
2324
- function writeSeedDataIntoCache(now, map, fetchStrategy, tree, staleAt, seedData, isResponsePartial, rootVaryParamsIterable, entriesOwnedByCurrentTask) {
2325
- // This function is used to write the result of a runtime server request
2326
- // (CacheNodeSeedData) into the prefetch cache.
2327
- const rsc = seedData[0];
2328
- const isPartial = rsc === null || isResponsePartial;
2329
- // Each segment carries its own vary params iterable in the seed data, which
2330
- // drains to the set of params the segment accessed during render. A null
2331
- // iterable means tracking was not enabled (not a prerender). readVaryParams
2332
- // unions in the response-level root params.
2333
- const varyParams = (0, _varyparamsdecoding.readVaryParams)(seedData[4], rootVaryParamsIterable);
2334
- fulfillEntrySpawnedByRuntimePrefetch(now, // A response write is bound to the map its entries live in (the spawning
2335
- // task's `PrefetchTask.segmentCacheMap`).
2336
- map, fetchStrategy, rsc, isPartial, staleAt, varyParams, tree, entriesOwnedByCurrentTask);
2337
2176
  // Recursively write the child data into the cache.
2338
2177
  const slots = tree.slots;
2339
2178
  if (slots !== null) {
2340
- const seedDataChildren = seedData[1];
2341
- for (const [parallelRouteKey, childTree] of slots){
2342
- const childSeedData = seedDataChildren[parallelRouteKey];
2343
- if (childSeedData !== null && childSeedData !== undefined) {
2344
- writeSeedDataIntoCache(now, map, fetchStrategy, childTree, staleAt, childSeedData, isResponsePartial, rootVaryParamsIterable, entriesOwnedByCurrentTask);
2345
- }
2179
+ for (const childTree of slots.values()){
2180
+ writeTreeDataIntoCache(now, map, fetchStrategy, childTree, staleAt, spawnedEntries, contentFetchStrategy, isUpgradeableISRFallback, requiresRuntimeCompleteness, responseNeedsRuntimeRequest, writtenEntries);
2346
2181
  }
2347
2182
  }
2348
2183
  }
2349
- function fulfillEntrySpawnedByRuntimePrefetch(now, map, fetchStrategy, rsc, isPartial, staleAt, segmentVaryParams, tree, entriesOwnedByCurrentTask) {
2184
+ /**
2185
+ * Writes one segment's render output into the cache: fulfills the entry at
2186
+ * the same tree position if this task owns one, otherwise creates one (or
2187
+ * upserts a detached one). Shared by every response kind; responses that
2188
+ * carry a runtime-data verdict (per-segment prefetch responses and
2189
+ * prerendered page payloads) additionally refine the tier the entry
2190
+ * records — see `recordedFetchStrategy` below.
2191
+ *
2192
+ * Returns the entry this write produced content into — the fulfilled spawned
2193
+ * entry, or the detached entry the upsert installed — so the caller can
2194
+ * charge the response's size to it. Null when nothing entered the cache (the
2195
+ * upsert declined a detached candidate).
2196
+ */ function writeSegmentDataIntoCache(now, map, fetchStrategy, rsc, isPartial, staleAt, segmentVaryParams, tree, spawnedEntries, // The strategy tier describing the CONTENT of the payload this write came
2197
+ // from, when it differs from the write's own `fetchStrategy` (which
2198
+ // drives matching and keying); null when they agree. It differs only for
2199
+ // the coincident-shell case: a write that fulfills shell-keyed entries
2200
+ // with a payload that IS the full response passes the full payload's tier
2201
+ // — see writeResponsePayloadsIntoCache.
2202
+ contentFetchStrategy, // Whether the response is an upgradeable fallback shell. Always false for
2203
+ // live-render responses — they are never ISR fallbacks.
2204
+ isUpgradeableISRFallback, // The response's runtime-data verdict: whether the render that produced
2205
+ // this payload accessed runtime data (page-global; combined with the
2206
+ // segment's own `isPartial` to decide the tier the entry records below).
2207
+ // Null when the response carries no verdict (`u`) — live renders emit
2208
+ // none; per-segment prefetch responses and prerendered page payloads
2209
+ // (including the truncated initial payload) do — in which case the entry
2210
+ // records the payload's tier unrefined.
2211
+ requiresRuntimeCompleteness, responseNeedsRuntimeRequest) {
2212
+ // The strategy tier recorded on the entry — the tier of the content that
2213
+ // actually satisfied it, which spans both axes: shell-vs-concrete AND
2214
+ // static-vs-runtime. The payload's content tier (`fetchStrategy`, unless
2215
+ // the caller passed a distinct `contentFetchStrategy`), refined by the
2216
+ // response's runtime-data verdict when it carries one:
2217
+ //
2218
+ // A runtime prefetch can only provide more content than this entry if the
2219
+ // render accessed runtime data AND this particular segment has holes — a
2220
+ // fully static segment gains nothing from a runtime request no matter
2221
+ // what the page accessed. When this payload fully satisfied the segment —
2222
+ // no runtime request needed — the content is as complete as a RUNTIME
2223
+ // response of the same variant would have been, so it records that
2224
+ // runtime tier. That's what lets the scheduler decide "would a runtime
2225
+ // request return more?" by comparing tiers alone, with no separate signal
2226
+ // to consult. Otherwise the content is only as complete as the static
2227
+ // tier it was requested at, so a follow-up runtime request can still
2228
+ // supersede it.
2229
+ let recordedFetchStrategy;
2230
+ if (responseNeedsRuntimeRequest === null) {
2231
+ // The response carries no verdict — a live render's, or the synthesized
2232
+ // initial-payload subset's (see create-initial-router-state): record
2233
+ // the payload's tier as-is. A verdict is honored wherever it appears:
2234
+ // prerendered page payloads carry one too (the prerender's runtime-data
2235
+ // probe), and refining on it is correct — a prerendered response whose
2236
+ // verdict is `false` is genuinely runtime-complete content.
2237
+ recordedFetchStrategy = contentFetchStrategy ?? fetchStrategy;
2238
+ } else if (responseNeedsRuntimeRequest && isPartial) {
2239
+ // A runtime request would provide more than this payload, so no runtime
2240
+ // tier is recorded — but the entry must still honor the payload's
2241
+ // CONTENT grade. In the coincident-shell case the payload that satisfied
2242
+ // a shell-keyed entry IS the full response, whose content grades at the
2243
+ // concrete static tier (`contentFetchStrategy`, PPR — the verdict only
2244
+ // rides static-family responses, so no higher grade can appear here).
2245
+ // The verdict is consistent with that grade: it says the runtime tiers
2246
+ // would provide more, which they would over PPR just as over the shell
2247
+ // tier.
2248
+ recordedFetchStrategy = contentFetchStrategy ?? fetchStrategy;
2249
+ } else {
2250
+ const payloadFetchStrategy = contentFetchStrategy ?? fetchStrategy;
2251
+ if (requiresRuntimeCompleteness) {
2252
+ // The verdict says this payload does not need a runtime request.
2253
+ // If we requested it at a static tier, raise the recorded tier up to the
2254
+ // runtime tier of the same variant.
2255
+ // This also makes the verdict a noop for Full payloads, which matters because
2256
+ // the Full flow decodes incrementally, and synchronously reading `response.u`
2257
+ // is only sound for a buffered payload.
2258
+ recordedFetchStrategy = payloadFetchStrategy === _types.FetchStrategy.StaticShell ? _types.FetchStrategy.RuntimeShell : payloadFetchStrategy === _types.FetchStrategy.PPR ? _types.FetchStrategy.PPRRuntime : payloadFetchStrategy;
2259
+ } else {
2260
+ // Only upgrade static segments to their runtime equivalents if the route
2261
+ // can use runtime requests. Otherwise, when re-using a shell segment across
2262
+ // params, `pingSegmentBundle` for a PPR strategy would see a `ShellRuntime`
2263
+ // shell entry and incorrectly decide that a new PPR request would not
2264
+ // provide more content.
2265
+ recordedFetchStrategy = payloadFetchStrategy;
2266
+ }
2267
+ }
2350
2268
  // Decide whether to re-key the entry under a more generic vary path based on
2351
2269
  // which params the segment actually depends on.
2352
2270
  //
@@ -2358,89 +2276,143 @@ function fulfillEntrySpawnedByRuntimePrefetch(now, map, fetchStrategy, rsc, isPa
2358
2276
  // untrustworthy set could replace concrete params with Fallback and let
2359
2277
  // unrelated URLs read each other's content from the cache.
2360
2278
  //
2361
- // For RuntimeShell prefetches, always re-key to the precomputed shell vary
2362
- // path. A shell entry is spawned at a concrete param path but is reusable
2363
- // across all of them; tree.shellVaryPath (root-param values kept, every other
2364
- // param replaced with Fallback) is exactly the path that shell reads look it
2365
- // up under.
2279
+ // Key the entry by which params the server said this segment depends on
2280
+ // (judged by the payload's CONTENT: contentFetchStrategy differs from
2281
+ // fetchStrategy exactly when a shell request's response turned out to
2282
+ // carry more — the coincident case). Reusing one copy across param values
2283
+ // is the point of the shell, but it requires knowing the content doesn't
2284
+ // depend on those params, and the server's report is the direct evidence
2285
+ // of that.
2286
+ //
2287
+ // Without that report, assume every param varies — a response without a
2288
+ // shell/full split is also what a page fully prerendered at concrete
2289
+ // params looks like, and keying that at the shell path would serve one
2290
+ // slug's content to every sibling. The exception is a shell variant,
2291
+ // which reduces param-dependent content to param fallbacks, so it really
2292
+ // is good for any value of them (its request path below IS the shell
2293
+ // vary path).
2294
+ const payloadStrategy = contentFetchStrategy ?? fetchStrategy;
2366
2295
  let fulfilledVaryPath = null;
2367
- if (process.env.__NEXT_VARY_PARAMS) {
2368
- if (fetchStrategy === _types.FetchStrategy.RuntimeShell) {
2369
- fulfilledVaryPath = tree.shellVaryPath;
2370
- } else if (fetchStrategy !== _types.FetchStrategy.Full && segmentVaryParams !== null) {
2371
- fulfilledVaryPath = (0, _varypath.getFulfilledSegmentVaryPath)(tree.varyPath, segmentVaryParams);
2296
+ // The dependency source the entry records, so a navigation that renders
2297
+ // its content can tell which params that content read. It is the same
2298
+ // evidence the key derivation below trusts, under the same condition, with
2299
+ // the same correction; otherwise null, and consumers assume every param.
2300
+ let recordedVaryParams = null;
2301
+ if (process.env.__NEXT_VARY_PARAMS && payloadStrategy !== _types.FetchStrategy.Full && segmentVaryParams !== null) {
2302
+ // Read the reported set now, when the key is chosen. The payload is fully
2303
+ // buffered by the time it's written, so the source has settled; a read of
2304
+ // null means the report is unavailable and every param varies.
2305
+ let varyParams = (0, _varyparamsdecoding.readVaryParams)(segmentVaryParams);
2306
+ if (varyParams !== null) {
2307
+ if (payloadStrategy === _types.FetchStrategy.RuntimeShell && varyParams.has(_varyparamsdecoding.SEARCH_PARAMS_VARY_ID)) {
2308
+ // SPECIAL CASE: for a RuntimeShell payload, the search params entry
2309
+ // is dropped from the server's vary evidence before deriving the
2310
+ // key, so the search component of the resulting path is marked as
2311
+ // the fallback. This exists ONLY because of a known compromise in
2312
+ // how the server reports search params: accessing `searchParams`
2313
+ // records a dependency on them at access time, even when the render
2314
+ // suspends on that access and cuts the content at the param
2315
+ // fallback. A shell render's page and head segments therefore report
2316
+ // the search params while the emitted bytes contain no
2317
+ // search-dependent content.
2318
+ // Trusting that report would key shell-grade content at a concrete
2319
+ // search value, where shell-restricted reads (which generalize every
2320
+ // non-root param — see getShellSegmentVaryPath) can never find it. A
2321
+ // RuntimeShell payload's search-dependent content is reduced to
2322
+ // fallbacks by construction, so its key must not vary on search
2323
+ // regardless of the over-reported evidence. Every other component of
2324
+ // the evidence is still honored as-is.
2325
+ //
2326
+ // Nothing else should rely on this branch; for every other payload
2327
+ // grade — and every other param — the server's evidence
2328
+ // is authoritative.
2329
+ //
2330
+ // TODO: Reconsider special-casing this on the server instead: don't
2331
+ // report a param access that never resolved past the fallback cut in
2332
+ // the emitted stage. A shell payload's evidence would then be
2333
+ // accurate, and this branch could be deleted.
2334
+ varyParams = new Set(varyParams);
2335
+ varyParams.delete(_varyparamsdecoding.SEARCH_PARAMS_VARY_ID);
2336
+ recordedVaryParams = (0, _varyparamsdecoding.createVaryParams)(varyParams);
2337
+ } else {
2338
+ recordedVaryParams = segmentVaryParams;
2339
+ }
2340
+ fulfilledVaryPath = (0, _varypath.getFulfilledSegmentVaryPath)(tree.varyPath, varyParams);
2372
2341
  }
2373
2342
  }
2343
+ // The canonical path to (re-)key the entry at. When the derivation above
2344
+ // produced a path, use that; otherwise fall back to the payload's own
2345
+ // keying (this is load-bearing for entries spawned as revalidations:
2346
+ // without the re-key they'd stay in their Revalidation slot forever,
2347
+ // invisible to canonical reads, and the partial entry that prompted the
2348
+ // revalidation would keep serving navigations). Full responses are
2349
+ // excluded, matching the varyParams re-key: they're spawned as canonical
2350
+ // entries at their final path, and their vary tracking can't be trusted
2351
+ // for re-keying (see the fulfilledVaryPath derivation above).
2352
+ const canonicalVaryPath = fulfilledVaryPath !== null ? fulfilledVaryPath : payloadStrategy !== _types.FetchStrategy.Full ? (0, _varypath.getSegmentVaryPathForRequest)(payloadStrategy, tree) : null;
2374
2353
  // We should only write into cache entries that are owned by us. Or create
2375
2354
  // a new one and write into that. We must never write over an entry that was
2376
2355
  // created by a different task, because that causes data races.
2377
- const ownedEntry = entriesOwnedByCurrentTask !== null ? entriesOwnedByCurrentTask.get(tree.requestKey) : undefined;
2378
- if (ownedEntry !== undefined) {
2379
- const fulfilledEntry = fulfillSegmentCacheEntry(ownedEntry, rsc, staleAt, isPartial, // Dynamic-request (Full/Runtime) responses are not ISR fallbacks.
2380
- false, fetchStrategy);
2381
- // Re-key the entry at its canonical path. When `varyParams` produced a
2382
- // generalized path above, use that; otherwise fall back to the request's
2383
- // own keying (this is load-bearing for entries spawned as revalidations:
2384
- // without the re-key they'd stay in their Revalidation slot forever,
2385
- // invisible to canonical reads, and the partial entry that prompted the
2386
- // revalidation would keep serving navigations). Full responses are
2387
- // excluded, matching the varyParams re-key: they're spawned as canonical
2388
- // entries at their final path, and their vary tracking can't be trusted
2389
- // for re-keying (see the fulfilledVaryPath derivation above).
2390
- const canonicalVaryPath = fulfilledVaryPath !== null ? fulfilledVaryPath : fetchStrategy !== _types.FetchStrategy.Full ? (0, _varypath.getSegmentVaryPathForRequest)(fetchStrategy, tree) : null;
2391
- if (canonicalVaryPath !== null) {
2392
- const isRevalidation = false;
2393
- (0, _cachemap.setInCacheMap)(map, canonicalVaryPath, fulfilledEntry, isRevalidation);
2394
- // The re-key moved the entry to a more generic path (and, for a spawned
2395
- // revalidation, vacated its Revalidation slot). A stale settled entry
2396
- // at a more specific path — e.g. the partial entry that prompted the
2397
- // revalidation — would shadow every read at the concrete lookup path,
2398
- // causing the scheduler to keep re-reading the stale entry and respawn
2399
- // the revalidation forever. Evict it so the fulfilled entry is
2400
- // reachable. See evictShadowingSegmentEntries.
2401
- evictShadowingSegmentEntries(now, map, tree.varyPath, fulfilledEntry);
2402
- }
2356
+ //
2357
+ // The status check matters for the fallback-retry loop, which re-writes a
2358
+ // response over entries the initial fetch already settled: those writes
2359
+ // must fall through to the detached path below.
2360
+ const ownedEntry = spawnedEntries !== null ? spawnedEntries.get(tree.requestKey) : undefined;
2361
+ const isOwned = ownedEntry !== undefined && ownedEntry.status === _cachemap.EntryStatus.Pending;
2362
+ let fulfilledEntry;
2363
+ let insertVaryPath;
2364
+ if (isOwned) {
2365
+ // We own this entry — fulfill it directly.
2366
+ fulfilledEntry = fulfillSegmentCacheEntry(ownedEntry, rsc, staleAt, isPartial, recordedVaryParams, isUpgradeableISRFallback, recordedFetchStrategy);
2367
+ // Re-key the fulfilled entry at its canonical path. Owned Full entries
2368
+ // are the exception (canonicalVaryPath is null): they were spawned as
2369
+ // canonical entries at their final path, so no re-key happens.
2370
+ insertVaryPath = canonicalVaryPath;
2403
2371
  } else {
2404
- // There's no matching entry. Attempt to create a new one.
2405
- let possiblyNewEntry = (0, _cachemap.getFromCacheMap)(now, getCurrentSegmentCacheVersion(), map, tree.varyPath, false, false);
2406
- if (possiblyNewEntry === null) {
2407
- possiblyNewEntry = insertEmptySegmentCacheEntry(now, map, fetchStrategy, tree);
2408
- }
2409
- if (possiblyNewEntry.status === _cachemap.EntryStatus.Empty) {
2410
- // Confirmed this is a new entry. We can fulfill it.
2411
- const newEntry = possiblyNewEntry;
2412
- const fulfilledEntry = fulfillSegmentCacheEntry(upgradeToPendingSegment(newEntry, fetchStrategy), rsc, staleAt, isPartial, // Dynamic-request (Full/Runtime) responses are not ISR fallbacks.
2413
- false, fetchStrategy);
2414
- if (fulfilledVaryPath !== null) {
2415
- const isRevalidation = false;
2416
- (0, _cachemap.setInCacheMap)(map, fulfilledVaryPath, fulfilledEntry, isRevalidation);
2417
- // Same as the owned-entry re-key above. Usually the entry really is
2418
- // new — the read a moment ago returned nothing at the concrete lookup
2419
- // path, so nothing can shadow it and this is a no-op — but this
2420
- // branch also claims a pre-existing Empty entry, and re-keying that
2421
- // away can expose a stale settled entry at an intermediate path.
2422
- evictShadowingSegmentEntries(now, map, tree.varyPath, fulfilledEntry);
2423
- }
2424
- } else {
2425
- // There was already an entry in the cache. But we may be able to
2426
- // replace it with the new one from the server.
2427
- const newEntry = fulfillSegmentCacheEntry(upgradeToPendingSegment(createDetachedSegmentCacheEntry(now), fetchStrategy), rsc, staleAt, isPartial, // Dynamic-request (Full/Runtime) responses are not ISR fallbacks.
2428
- false, fetchStrategy);
2429
- const varyPath = fulfilledVaryPath !== null ? fulfilledVaryPath : (0, _varypath.getSegmentVaryPathForRequest)(fetchStrategy, tree);
2430
- // Pass the concrete lookup path so that if the entry was re-keyed to
2431
- // a more generic path, any stale settled entry at a more specific path
2432
- // that would shadow it is evicted (the upsert handles this; the other
2433
- // branches above call evictShadowingSegmentEntries themselves).
2434
- upsertSegmentEntry(now, map, varyPath, newEntry, tree.varyPath);
2372
+ // We don't own an entry for this segment. Create a detached one and
2373
+ // attempt to insert it at the canonical path — or, for a Full response
2374
+ // (which has no canonical re-key), at the request's own path.
2375
+ fulfilledEntry = fulfillSegmentCacheEntry(upgradeToPendingSegment(createDetachedSegmentCacheEntry(now), fetchStrategy), rsc, staleAt, isPartial, recordedVaryParams, isUpgradeableISRFallback, recordedFetchStrategy);
2376
+ insertVaryPath = canonicalVaryPath !== null ? canonicalVaryPath : (0, _varypath.getSegmentVaryPathForRequest)(fetchStrategy, tree);
2377
+ }
2378
+ if (insertVaryPath !== null) {
2379
+ // Insert through the upsert so the usual precedence rules apply — an
2380
+ // existing entry with more complete content is never downgraded, and a
2381
+ // shadowed Empty/Pending entry's blocked tasks are pinged. (In the
2382
+ // common case the slot already holds the entry we just fulfilled, which
2383
+ // the upsert replaces in place; but the re-key is load-bearing for
2384
+ // entries whose spawn path differs from the canonical path — e.g.
2385
+ // spawned revalidations, which would otherwise stay in their
2386
+ // Revalidation slot forever, invisible to canonical reads, while the
2387
+ // partial entry that prompted the revalidation kept serving
2388
+ // navigations.)
2389
+ //
2390
+ // The concrete lookup path (tree.varyPath) is passed so that when the
2391
+ // canonical path is more generic, any stale settled entry — or unclaimed
2392
+ // Empty placeholder — at a more specific path that would shadow the
2393
+ // fulfilled entry is evicted. Without this, a shadowed re-keyed entry is
2394
+ // unreachable at the concrete read path: the scheduler would keep
2395
+ // re-reading the stale entry and, for a revalidation, respawn it
2396
+ // forever. See evictShadowingSegmentEntries.
2397
+ const installedEntry = upsertSegmentEntry(now, map, insertVaryPath, fulfilledEntry, tree.varyPath);
2398
+ if (installedEntry === null && !isOwned) {
2399
+ // The upsert declined the detached candidate (an existing entry took
2400
+ // precedence, or the candidate was already expired), so no cache slot
2401
+ // holds this write's content — nothing for the caller to charge to
2402
+ // the LRU. (An owned entry is returned regardless: it was fulfilled
2403
+ // above and stays live for waiters that hold it, whether or not the
2404
+ // re-key installed it.)
2405
+ return null;
2435
2406
  }
2436
2407
  }
2408
+ return fulfilledEntry;
2437
2409
  }
2438
2410
  async function fetchPrefetchResponse(url, headers) {
2439
2411
  const fetchPriority = 'low';
2440
2412
  // When issuing a prefetch request, don't immediately decode the response; we
2441
2413
  // use the lower level `createFromResponse` API instead because we need to do
2442
2414
  // some extra processing of the response stream. See
2443
- // `createNonTaskyPrefetchResponseStream` for more details.
2415
+ // `bufferPrefetchResponseBody` for more details.
2444
2416
  const shouldImmediatelyDecode = false;
2445
2417
  const response = await (0, _fetchserverresponse.createFetch)(url, headers, fetchPriority, shouldImmediatelyDecode);
2446
2418
  if (!response.ok) {
@@ -2461,18 +2433,17 @@ async function fetchPrefetchResponse(url, headers) {
2461
2433
  }
2462
2434
  return response;
2463
2435
  }
2464
- async function createNonTaskyPrefetchResponseStream(body, byteLimit) {
2465
- // Buffer the entire response before passing it to the Flight client. This
2466
- // ensures that when Flight processes the stream, all model data is available
2467
- // synchronously. This is important for readVaryParams, which synchronously
2468
- // checks the thenable status — if data arrived in multiple network chunks,
2469
- // the thenables might not yet be fulfilled.
2470
- //
2471
- // TODO: There are too many intermediate stream transformations in the
2472
- // prefetch response pipeline (e.g. stripIsPartialByte, this function).
2473
- // These could all be consolidated into a single transformation. Refactor
2474
- // once the cached navigations experiment lands.
2475
- //
2436
+ /**
2437
+ * Whether the response was served from the per-segment-capable static
2438
+ * prerender, rather than the old prefetching flow. If this fails, it implies
2439
+ * that PPR is disabled on the route.
2440
+ */ function wasServedFromPerSegmentCache(response) {
2441
+ return response.headers.get(_approuterheaders.NEXT_DID_POSTPONE_HEADER) === '2' || // In output: "export" mode, we can't rely on response headers. But if we
2442
+ // receive a well-formed response, we can assume it's a static response,
2443
+ // because all data is static in this mode.
2444
+ isOutputExportMode;
2445
+ }
2446
+ async function bufferPrefetchResponseBody(body, byteLimit) {
2476
2447
  // Read the response from the network, optionally truncating at byteLimit.
2477
2448
  const reader = body.getReader();
2478
2449
  const chunks = [];
@@ -2501,30 +2472,19 @@ async function createNonTaskyPrefetchResponseStream(body, byteLimit) {
2501
2472
  // PromiseResolveThenableJob from `await` can cause the root to initialize
2502
2473
  // eagerly, scheduling the continuation before remaining chunks (including
2503
2474
  // promise value rows) are processed. A single chunk avoids this.
2504
- let buffer;
2505
2475
  if (chunks.length === 1) {
2506
- buffer = chunks[0];
2476
+ return chunks[0];
2507
2477
  } else if (chunks.length > 1) {
2508
- buffer = new Uint8Array(size);
2478
+ const buffer = new Uint8Array(size);
2509
2479
  let offset = 0;
2510
2480
  for (const chunk of chunks){
2511
2481
  buffer.set(chunk, offset);
2512
2482
  offset += chunk.byteLength;
2513
2483
  }
2484
+ return buffer;
2514
2485
  } else {
2515
- buffer = new Uint8Array(0);
2486
+ return new Uint8Array(0);
2516
2487
  }
2517
- const stream = new ReadableStream({
2518
- start (controller) {
2519
- controller.enqueue(buffer);
2520
- controller.close();
2521
- }
2522
- });
2523
- return {
2524
- stream,
2525
- size,
2526
- buffer
2527
- };
2528
2488
  }
2529
2489
  /**
2530
2490
  * Creates a streaming (non-buffered) prefetch response stream for dynamic/Full
@@ -2596,44 +2556,71 @@ async function resolveStaleAt(now, staleTimeIterable, response) {
2596
2556
  }
2597
2557
  return now + _navigatereducer.STATIC_STALETIME_MS;
2598
2558
  }
2599
- function writePrerenderResponseIntoCache(now, fetchStrategy, flightData, buildId, headVaryParamsIterable, rootVaryParamsIterable, staleAt, baseTree, renderedSearch, isResponsePartial, // The map the work that spawned this response's request is bound to. See
2600
- // writeDynamicRenderResponseIntoCache.
2559
+ function spawnStaticStageCacheWrite(now, response, isResponsePartial, // The navigation response's headers, used to derive the buildId for the
2560
+ // write-layer build check (the deployment header, falling back to the
2561
+ // response's `b` field). Null for the initial payload, which arrived in
2562
+ // the HTML document and has no build-id check.
2563
+ responseHeaders, baseTree, renderedSearch, // The map the work that spawned this response's request is bound to. See
2564
+ // writeServerResponseIntoCache.
2601
2565
  map) {
2602
- // Root params are emitted once at the top level; readVaryParams unions them
2603
- // into the head, and they're threaded down to each segment below.
2604
- const headVaryParams = (0, _varyparamsdecoding.readVaryParams)(headVaryParamsIterable, rootVaryParamsIterable);
2605
- const flightDatas = (0, _flightdatahelpers.normalizeFlightData)(flightData);
2606
- if (typeof flightDatas === 'string') {
2607
- return;
2608
- }
2609
- const navigationSeed = (0, _navigation.convertServerPatchToFullTree)(now, baseTree, flightDatas, renderedSearch, _bfcache.UnknownDynamicStaleTime);
2610
- writeDynamicRenderResponseIntoCache(now, fetchStrategy, flightDatas, buildId, isResponsePartial, headVaryParams, rootVaryParamsIterable, staleAt, navigationSeed, null, map);
2566
+ const buildId = responseHeaders !== null ? responseHeaders.get(_constants.NEXT_NAV_DEPLOYMENT_ID_HEADER) ?? response.b : undefined;
2567
+ resolveStaleAt(now, response.s).then((staleAt)=>{
2568
+ // TODO: This entire write is legacy and will be deleted in a future
2569
+ // PR: caching is organized around the conceptual shell vs not-shell
2570
+ // distinction, not around the static vs runtime render stages, so a
2571
+ // static-stage write has no place in the model. It's kept only until
2572
+ // its removal PR lands — do not extend it (e.g. with shell
2573
+ // extraction).
2574
+ writeServerResponseIntoCache(now, _types.FetchStrategy.PPR, response, baseTree, // The base tree is the navigation's current tree, not a prediction;
2575
+ // divergence from it carries no signal.
2576
+ null, // Navigation responses always include the param values in the tree,
2577
+ // so there's no pathname to parse them from (nor a need to).
2578
+ null, renderedSearch, buildId, staleAt, isResponsePartial, null, // No owned entries; every write is a detached upsert.
2579
+ null, null, map);
2580
+ }).catch(()=>{
2581
+ // The static stage processing failed. Not fatal — the render
2582
+ // completed normally, we just won't write into the cache.
2583
+ });
2611
2584
  }
2612
- async function processRuntimePrefetchStream(now, runtimePrefetchStream, baseTree, renderedSearch) {
2585
+ async function writeRuntimePrefetchStreamIntoCache(now, runtimePrefetchStream, baseTree, renderedSearch, // The map the work that spawned this response's request is bound to. See
2586
+ // writeServerResponseIntoCache.
2587
+ map) {
2613
2588
  const { stream, isPartial } = await stripIsPartialByte(runtimePrefetchStream);
2614
- const serverData = await (0, _fetchserverresponse.createFromNextReadableStream)(stream, undefined, {
2615
- allowPartialStream: true
2616
- });
2617
- // Root params are emitted once at the top level; readVaryParams unions them
2618
- // into the head, and we return the iterable so the caller can union it into
2619
- // each segment too.
2620
- const rootVaryParamsIterable = serverData.r ?? null;
2621
- const headVaryParams = (0, _varyparamsdecoding.readVaryParams)(serverData.h, rootVaryParamsIterable);
2622
- const staleAt = await resolveStaleAt(now, serverData.s);
2623
- const flightDatas = (0, _flightdatahelpers.normalizeFlightData)(serverData.f);
2624
- if (typeof flightDatas === 'string') {
2625
- return null;
2589
+ const buffer = await bufferPrefetchResponseBody(stream);
2590
+ const serverData = await (0, _fetchserverresponse.decodeBufferedStage)(buffer, undefined);
2591
+ // Extract the shell payload, when the response carries one. Same wire
2592
+ // convention as the other live-render responses (see
2593
+ // resolveShellStageResponse): `a` absent means the render wasn't staged —
2594
+ // no shell exists; `null` means the shell IS the full response; a number
2595
+ // is the byte boundary of a distinct shell prefix, which is re-decoded
2596
+ // from a truncated copy of the buffer. An unreadable `a` — pending or
2597
+ // rejected, which only an aborted render produces — conservatively reads
2598
+ // as no shell: the full payload is still written, there's just no shell
2599
+ // stage to extract from it.
2600
+ let shellResponse = null;
2601
+ if (serverData.a !== undefined) {
2602
+ const shellByteLength = (0, _rsctransport.readFulfilledValue)(serverData.a, undefined);
2603
+ if (shellByteLength === null) {
2604
+ shellResponse = serverData;
2605
+ } else if (shellByteLength !== undefined) {
2606
+ try {
2607
+ shellResponse = await (0, _fetchserverresponse.decodeBufferedStage)(buffer.subarray(0, shellByteLength), undefined);
2608
+ } catch {
2609
+ // The truncated prefix couldn't be decoded. Treat it as if no shell
2610
+ // exists; the full payload is still usable.
2611
+ shellResponse = null;
2612
+ }
2613
+ }
2626
2614
  }
2627
- const navigationSeed = (0, _navigation.convertServerPatchToFullTree)(now, baseTree, flightDatas, renderedSearch, _bfcache.UnknownDynamicStaleTime);
2628
- return {
2629
- flightDatas,
2630
- navigationSeed,
2631
- buildId: serverData.b,
2632
- isResponsePartial: isPartial,
2633
- headVaryParams,
2634
- rootVaryParamsIterable,
2635
- staleAt
2636
- };
2615
+ writeResponsePayloadsIntoCache(now, // A runtime prefetch stream is by definition a runtime prefetch.
2616
+ _types.FetchStrategy.PPRRuntime, serverData, shellResponse, baseTree, // The base tree is the navigation's current tree, not a prediction;
2617
+ // divergence from it carries no signal.
2618
+ null, // Navigation responses always include the param values in the tree, so
2619
+ // there's no pathname to parse them from (nor a need to).
2620
+ null, renderedSearch, serverData.b, // The response is fully buffered, so staleTime is read synchronously.
2621
+ readFulfilledStaleAt(now, serverData.s), isPartial, null, // This flow owns no pending entries; every write is a detached upsert.
2622
+ null, // Detached writes aren't sized; see writeResponsePayloadsIntoCache.
2623
+ null, map);
2637
2624
  }
2638
2625
  async function stripIsPartialByte(stream) {
2639
2626
  // When there is no recognized marker byte, the fallback depends on whether