@timber-js/app 0.2.0-alpha.221 → 0.2.0-alpha.223

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 (380) hide show
  1. package/agent-skill.md +21 -5
  2. package/dist/_chunks/{actions-BDqn4Oxj.js → actions-7dTXYJfu.js} +53 -24
  3. package/dist/_chunks/actions-7dTXYJfu.js.map +1 -0
  4. package/dist/_chunks/{als-registry-BZqHCtq-.js → als-registry-DpygwCp0.js} +2 -3
  5. package/dist/_chunks/{als-registry-BZqHCtq-.js.map → als-registry-DpygwCp0.js.map} +1 -1
  6. package/dist/_chunks/{als-slots-BEEIPKYm.js → als-slots-kbQrHTzm.js} +2 -3
  7. package/dist/_chunks/{als-slots-BEEIPKYm.js.map → als-slots-kbQrHTzm.js.map} +1 -1
  8. package/dist/_chunks/{base-path-DaQrzbez.js → base-path-DDIx0FXe.js} +2 -3
  9. package/dist/_chunks/{base-path-DaQrzbez.js.map → base-path-DDIx0FXe.js.map} +1 -1
  10. package/dist/_chunks/{build-manifest-DWppEdLB.js → build-manifest-Y4jl7nwU.js} +2 -3
  11. package/dist/_chunks/{build-manifest-DWppEdLB.js.map → build-manifest-Y4jl7nwU.js.map} +1 -1
  12. package/dist/_chunks/{build-output-helper-RV_BRcF1.js → build-output-helper-B7wWGTfR.js} +14 -10
  13. package/dist/_chunks/build-output-helper-B7wWGTfR.js.map +1 -0
  14. package/dist/_chunks/{cache-api-GE4AOe2H.js → cache-api-TDZ4hlDc.js} +237 -37
  15. package/dist/_chunks/cache-api-TDZ4hlDc.js.map +1 -0
  16. package/dist/_chunks/{canonicalize-BAWkWiKK.js → canonicalize-CqK135BN.js} +29 -4
  17. package/dist/_chunks/{canonicalize-BAWkWiKK.js.map → canonicalize-CqK135BN.js.map} +1 -1
  18. package/dist/_chunks/chains-CwOr3Myj.js +1 -0
  19. package/dist/_chunks/{chains-e_Buf9vg.js → chains-Dgm3PrMe.js} +3 -4
  20. package/dist/_chunks/{chains-e_Buf9vg.js.map → chains-Dgm3PrMe.js.map} +1 -1
  21. package/dist/_chunks/{classify-2Yp3xJY1.js → classify--_kINHQV.js} +4 -5
  22. package/dist/_chunks/{classify-2Yp3xJY1.js.map → classify--_kINHQV.js.map} +1 -1
  23. package/dist/_chunks/{cli-check-DDwCkeDY.js → cli-check-Dv3f8d2j.js} +5 -6
  24. package/dist/_chunks/{cli-check-DDwCkeDY.js.map → cli-check-Dv3f8d2j.js.map} +1 -1
  25. package/dist/_chunks/{cli-context-_mPttGGY.js → cli-context-CbZp32SK.js} +3 -4
  26. package/dist/_chunks/{cli-context-_mPttGGY.js.map → cli-context-CbZp32SK.js.map} +1 -1
  27. package/dist/_chunks/cli-context-n5hmkdla.js +1 -0
  28. package/dist/_chunks/cli-dev-status-prPMLU8G.js +138 -0
  29. package/dist/_chunks/cli-dev-status-prPMLU8G.js.map +1 -0
  30. package/dist/_chunks/cli-init-BoXOYYil.js +196 -0
  31. package/dist/_chunks/cli-init-BoXOYYil.js.map +1 -0
  32. package/dist/_chunks/{cli-schema-sync-BdIebmk3.js → cli-schema-sync-DIPurq7X.js} +4 -5
  33. package/dist/_chunks/{cli-schema-sync-BdIebmk3.js.map → cli-schema-sync-DIPurq7X.js.map} +1 -1
  34. package/dist/_chunks/{cli-schema-sync-CLNfXQDK.js → cli-schema-sync-uq72EZmD.js} +1 -1
  35. package/dist/_chunks/{client-dep-entries-BOkpKjj1.js → client-dep-entries-CP7AkMCM.js} +4 -5
  36. package/dist/_chunks/{client-dep-entries-BOkpKjj1.js.map → client-dep-entries-CP7AkMCM.js.map} +1 -1
  37. package/dist/_chunks/{cloudflare-Byxl8FWP.js → cloudflare-B75X6u4O.js} +10 -13
  38. package/dist/_chunks/{cloudflare-Byxl8FWP.js.map → cloudflare-B75X6u4O.js.map} +1 -1
  39. package/dist/_chunks/{codec-registry-oOUxugz3.js → codec-registry-CPc6bjVl.js} +2 -3
  40. package/dist/_chunks/{codec-registry-oOUxugz3.js.map → codec-registry-CPc6bjVl.js.map} +1 -1
  41. package/dist/_chunks/{codegen-Bps1sLKJ.js → codegen-B9oWkWGf.js} +5 -8
  42. package/dist/_chunks/{codegen-Bps1sLKJ.js.map → codegen-B9oWkWGf.js.map} +1 -1
  43. package/dist/_chunks/{convention-lint-ByKJ6aqD.js → convention-lint-hZwz5wd4.js} +8 -11
  44. package/dist/_chunks/{convention-lint-ByKJ6aqD.js.map → convention-lint-hZwz5wd4.js.map} +1 -1
  45. package/dist/_chunks/dev-discovery-YnabkCKD.js +238 -0
  46. package/dist/_chunks/dev-discovery-YnabkCKD.js.map +1 -0
  47. package/dist/_chunks/{dev-server-DIy-SY-J.js → dev-server-C61GWpGg.js} +409 -51
  48. package/dist/_chunks/dev-server-C61GWpGg.js.map +1 -0
  49. package/dist/_chunks/dev-server-CBvvM7Lr.js +1 -0
  50. package/dist/_chunks/{dev-store-BOa304m_.js → dev-store-BvdqtHvK.js} +82 -38
  51. package/dist/_chunks/dev-store-BvdqtHvK.js.map +1 -0
  52. package/dist/_chunks/{dist-DtrJyBbw.js → dist-C1Rjlo6s.js} +3 -5
  53. package/dist/_chunks/{dist-DtrJyBbw.js.map → dist-C1Rjlo6s.js.map} +1 -1
  54. package/dist/_chunks/{error-boundary-Bc8QPZuq.js → error-boundary-DRQXGWCp.js} +20 -27
  55. package/dist/_chunks/{error-boundary-Bc8QPZuq.js.map → error-boundary-DRQXGWCp.js.map} +1 -1
  56. package/dist/_chunks/{fast-hash-C-tVYrLb.js → fast-hash-DddxkU5Y.js} +2 -3
  57. package/dist/_chunks/{fast-hash-C-tVYrLb.js.map → fast-hash-DddxkU5Y.js.map} +1 -1
  58. package/dist/_chunks/{flight-source-node-HptmGMT8.js → flight-source-node-0Tp6evlz.js} +6 -8
  59. package/dist/_chunks/flight-source-node-0Tp6evlz.js.map +1 -0
  60. package/dist/_chunks/{format-BKclgVbk.js → format-DuPOoXUP.js} +2 -3
  61. package/dist/_chunks/{format-BKclgVbk.js.map → format-DuPOoXUP.js.map} +1 -1
  62. package/dist/_chunks/{fs-identity-BRKuL215.js → fs-identity-BmQ_Agg-.js} +3 -5
  63. package/dist/_chunks/{fs-identity-BRKuL215.js.map → fs-identity-BmQ_Agg-.js.map} +1 -1
  64. package/dist/_chunks/global-context-DbxNWeBP.js +47 -0
  65. package/dist/_chunks/global-context-DbxNWeBP.js.map +1 -0
  66. package/dist/_chunks/{graph-cache-CYiUS2aS.js → graph-cache-B1LAg4t7.js} +5 -89
  67. package/dist/_chunks/graph-cache-B1LAg4t7.js.map +1 -0
  68. package/dist/_chunks/{href-validation-BIrxavIy.js → href-validation-CEZy1V-k.js} +4 -7
  69. package/dist/_chunks/{href-validation-BIrxavIy.js.map → href-validation-CEZy1V-k.js.map} +1 -1
  70. package/dist/_chunks/{json-lossy-check-C8zBY2uZ.js → json-lossy-check-DVkLUlfC.js} +3 -4
  71. package/dist/_chunks/{json-lossy-check-C8zBY2uZ.js.map → json-lossy-check-DVkLUlfC.js.map} +1 -1
  72. package/dist/_chunks/{live-graph-tSWrv8eH.js → live-graph-BcVjQ1Te.js} +6 -7
  73. package/dist/_chunks/{live-graph-tSWrv8eH.js.map → live-graph-BcVjQ1Te.js.map} +1 -1
  74. package/dist/_chunks/{logger-CbLdcy-W.js → logger-CWk44DLp.js} +97 -47
  75. package/dist/_chunks/logger-CWk44DLp.js.map +1 -0
  76. package/dist/_chunks/{metadata-routes-B3XJNyIH.js → metadata-routes-BL26HCDd.js} +2 -3
  77. package/dist/_chunks/{metadata-routes-B3XJNyIH.js.map → metadata-routes-BL26HCDd.js.map} +1 -1
  78. package/dist/_chunks/{navigation-root-BQfo1-kG.js → navigation-root-M3B2ZrdO.js} +6 -10
  79. package/dist/_chunks/{navigation-root-BQfo1-kG.js.map → navigation-root-M3B2ZrdO.js.map} +1 -1
  80. package/dist/_chunks/{node-response-rkQqcFGq.js → node-response-B9aviPDa.js} +43 -9
  81. package/dist/_chunks/node-response-B9aviPDa.js.map +1 -0
  82. package/dist/_chunks/{param-value-C8TNYchQ.js → param-value-DqlGfF57.js} +2 -3
  83. package/dist/_chunks/{param-value-C8TNYchQ.js.map → param-value-DqlGfF57.js.map} +1 -1
  84. package/dist/_chunks/{plugin-context-uDHFqHHJ.js → plugin-context-BfSRKJfz.js} +1 -1
  85. package/dist/_chunks/{plugin-context-DxMMvjUt.js → plugin-context-FCkaNLUB.js} +4 -6
  86. package/dist/_chunks/plugin-context-FCkaNLUB.js.map +1 -0
  87. package/dist/_chunks/{poison-rules-DoEhbqaY.js → poison-rules-Bmz-lCPi.js} +2 -3
  88. package/dist/_chunks/{poison-rules-DoEhbqaY.js.map → poison-rules-Bmz-lCPi.js.map} +1 -1
  89. package/dist/_chunks/{poison-scan-C4FgMxFl.js → poison-scan-DJYxZc_7.js} +4 -5
  90. package/dist/_chunks/{poison-scan-C4FgMxFl.js.map → poison-scan-DJYxZc_7.js.map} +1 -1
  91. package/dist/_chunks/{purge-store-WZaxu-3m.js → purge-store-8BqLAYZ1.js} +2 -3
  92. package/dist/_chunks/{purge-store-WZaxu-3m.js.map → purge-store-8BqLAYZ1.js.map} +1 -1
  93. package/dist/_chunks/{render-timeout-joFhz4KH.js → render-timeout-MrrqD1wd.js} +20 -4
  94. package/dist/_chunks/{render-timeout-joFhz4KH.js.map → render-timeout-MrrqD1wd.js.map} +1 -1
  95. package/dist/_chunks/{resolve-schema-CBR6Lm4i.js → resolve-schema-B-aCuTu3.js} +3 -4
  96. package/dist/_chunks/{resolve-schema-CBR6Lm4i.js.map → resolve-schema-B-aCuTu3.js.map} +1 -1
  97. package/dist/_chunks/{rsc-cache-key-ClUiXQnK.js → rsc-cache-key-D0cb0Gmc.js} +2 -3
  98. package/dist/_chunks/{rsc-cache-key-ClUiXQnK.js.map → rsc-cache-key-D0cb0Gmc.js.map} +1 -1
  99. package/dist/_chunks/{rsc-media-type-DDc7duTD.js → rsc-media-type-m8jz9u6_.js} +2 -3
  100. package/dist/_chunks/{rsc-media-type-DDc7duTD.js.map → rsc-media-type-m8jz9u6_.js.map} +1 -1
  101. package/dist/_chunks/{rsc-payload-path-dffcs4jp.js → rsc-payload-path-EphpDB-J.js} +2 -3
  102. package/dist/_chunks/{rsc-payload-path-dffcs4jp.js.map → rsc-payload-path-EphpDB-J.js.map} +1 -1
  103. package/dist/_chunks/{scan-BoP17W3w.js → scan-CyizcBiX.js} +2 -3
  104. package/dist/_chunks/{scan-BoP17W3w.js.map → scan-CyizcBiX.js.map} +1 -1
  105. package/dist/_chunks/{scanner-Cb3fSjAC.js → scanner-CJC-ScJU.js} +15 -23
  106. package/dist/_chunks/{scanner-Cb3fSjAC.js.map → scanner-CJC-ScJU.js.map} +1 -1
  107. package/dist/_chunks/{schema-bridge-C83xa9lT.js → schema-bridge-DyRs3cqy.js} +61 -25
  108. package/dist/_chunks/schema-bridge-DyRs3cqy.js.map +1 -0
  109. package/dist/_chunks/{segment-classify-C539Pa2O.js → segment-classify-Ho8jXWeC.js} +3 -5
  110. package/dist/_chunks/{segment-classify-C539Pa2O.js.map → segment-classify-Ho8jXWeC.js.map} +1 -1
  111. package/dist/_chunks/{segment-context-xtPUGfdq.js → segment-context-CYiGTi3K.js} +6 -12
  112. package/dist/_chunks/segment-context-CYiGTi3K.js.map +1 -0
  113. package/dist/_chunks/{segment-keys-D5hu1hz4.js → segment-keys-Y60KNc8C.js} +2 -3
  114. package/dist/_chunks/{segment-keys-D5hu1hz4.js.map → segment-keys-Y60KNc8C.js.map} +1 -1
  115. package/dist/_chunks/{singleflight-BeVMMKi0.js → singleflight-BChPMjwH.js} +2 -3
  116. package/dist/_chunks/{singleflight-BeVMMKi0.js.map → singleflight-BChPMjwH.js.map} +1 -1
  117. package/dist/_chunks/{sizeof-QPE5nd3u.js → sizeof-DG4W40lv.js} +3 -4
  118. package/dist/_chunks/{sizeof-QPE5nd3u.js.map → sizeof-DG4W40lv.js.map} +1 -1
  119. package/dist/_chunks/{ssr-data-nA3I70_n.js → ssr-data-9hPtcNOr.js} +3 -4
  120. package/dist/_chunks/{ssr-data-nA3I70_n.js.map → ssr-data-9hPtcNOr.js.map} +1 -1
  121. package/dist/_chunks/{state-BhNGPsdi.js → state-B-EBjeER.js} +2 -3
  122. package/dist/_chunks/{state-BhNGPsdi.js.map → state-B-EBjeER.js.map} +1 -1
  123. package/dist/_chunks/{status-page-marker-BRX9Ib-d.js → status-page-marker-XIQXlTOb.js} +8 -13
  124. package/dist/_chunks/{status-page-marker-BRX9Ib-d.js.map → status-page-marker-XIQXlTOb.js.map} +1 -1
  125. package/dist/_chunks/{tree-match-6yihorhk.js → tree-match-Bqdr9szG.js} +2 -3
  126. package/dist/_chunks/{tree-match-6yihorhk.js.map → tree-match-Bqdr9szG.js.map} +1 -1
  127. package/dist/_chunks/{use-query-states-I3JMng6J.js → use-query-states-pkDV-jSg.js} +4 -7
  128. package/dist/_chunks/{use-query-states-I3JMng6J.js.map → use-query-states-pkDV-jSg.js.map} +1 -1
  129. package/dist/_chunks/{walkers-qu8TpiLh.js → walkers-DIE203ir.js} +6 -8
  130. package/dist/_chunks/{walkers-qu8TpiLh.js.map → walkers-DIE203ir.js.map} +1 -1
  131. package/dist/_chunks/{write-file-atomic-D1qWqHb4.js → write-file-atomic-DW8m_Atv.js} +2 -3
  132. package/dist/_chunks/{write-file-atomic-D1qWqHb4.js.map → write-file-atomic-DW8m_Atv.js.map} +1 -1
  133. package/dist/adapters/build-output-helper.d.ts +10 -1
  134. package/dist/adapters/build-output-helper.d.ts.map +1 -1
  135. package/dist/adapters/cloudflare-dev.js +2 -3
  136. package/dist/adapters/cloudflare-kv-cache.js +3 -4
  137. package/dist/adapters/cloudflare.d.ts.map +1 -1
  138. package/dist/adapters/cloudflare.js +1 -1
  139. package/dist/adapters/nitro-presets.d.ts +6 -0
  140. package/dist/adapters/nitro-presets.d.ts.map +1 -1
  141. package/dist/adapters/nitro-preview.d.ts.map +1 -1
  142. package/dist/adapters/nitro.d.ts.map +1 -1
  143. package/dist/adapters/nitro.js +94 -57
  144. package/dist/adapters/nitro.js.map +1 -1
  145. package/dist/analyze/crawl-entry.js +7 -9
  146. package/dist/analyze/crawl-entry.js.map +1 -1
  147. package/dist/analyze/graph-command.d.ts.map +1 -1
  148. package/dist/analyze/graph-command.js +19 -105
  149. package/dist/analyze/graph-command.js.map +1 -1
  150. package/dist/cache/guarded-read.d.ts +29 -0
  151. package/dist/cache/guarded-read.d.ts.map +1 -0
  152. package/dist/cache/index.js +3 -3
  153. package/dist/cache/key-discipline.d.ts +61 -0
  154. package/dist/cache/key-discipline.d.ts.map +1 -0
  155. package/dist/cache/stores/cloudflare-kv.js +1 -2
  156. package/dist/cache/stores/memory.js +2 -3
  157. package/dist/cache/stores/redis.js +1 -2
  158. package/dist/cache/stores/vercel.js +1 -2
  159. package/dist/cache/timber-cache.d.ts +5 -1
  160. package/dist/cache/timber-cache.d.ts.map +1 -1
  161. package/dist/cdn/cloudflare-purge.js +1 -2
  162. package/dist/cdn/fastly-purge.js +1 -2
  163. package/dist/cdn/index.js +2 -3
  164. package/dist/cdn/workers-cache-purge.js +3 -5
  165. package/dist/cdn/workers-cache-purge.js.map +1 -1
  166. package/dist/cli-dev-status.d.ts +75 -0
  167. package/dist/cli-dev-status.d.ts.map +1 -0
  168. package/dist/cli-init.d.ts +72 -0
  169. package/dist/cli-init.d.ts.map +1 -0
  170. package/dist/cli.d.ts +4 -12
  171. package/dist/cli.d.ts.map +1 -1
  172. package/dist/cli.js +27 -54
  173. package/dist/cli.js.map +1 -1
  174. package/dist/client/error-boundary.d.ts.map +1 -1
  175. package/dist/client/error-boundary.js +1 -1
  176. package/dist/client/global-context.d.ts +21 -1
  177. package/dist/client/global-context.d.ts.map +1 -1
  178. package/dist/client/index.js +23 -44
  179. package/dist/client/index.js.map +1 -1
  180. package/dist/client/internal.js +13 -18
  181. package/dist/client/internal.js.map +1 -1
  182. package/dist/client/navigation-context.d.ts.map +1 -1
  183. package/dist/client/params-context.d.ts.map +1 -1
  184. package/dist/client/slot-context.d.ts +2 -2
  185. package/dist/client/slot-context.d.ts.map +1 -1
  186. package/dist/client/use-cookie.d.ts +18 -5
  187. package/dist/client/use-cookie.d.ts.map +1 -1
  188. package/dist/codec.js +2 -3
  189. package/dist/config-types.d.ts +22 -5
  190. package/dist/config-types.d.ts.map +1 -1
  191. package/dist/config-validation.d.ts.map +1 -1
  192. package/dist/cookies/define-cookie.d.ts.map +1 -1
  193. package/dist/cookies/index.js +40 -67
  194. package/dist/cookies/index.js.map +1 -1
  195. package/dist/cookies/json-cookie.d.ts +4 -4
  196. package/dist/index.js +266 -229
  197. package/dist/index.js.map +1 -1
  198. package/dist/params/index.js +3 -4
  199. package/dist/plugin-context.d.ts +7 -0
  200. package/dist/plugin-context.d.ts.map +1 -1
  201. package/dist/plugins/dev-discovery.d.ts +69 -5
  202. package/dist/plugins/dev-discovery.d.ts.map +1 -1
  203. package/dist/plugins/dev-hostname.d.ts +152 -0
  204. package/dist/plugins/dev-hostname.d.ts.map +1 -0
  205. package/dist/plugins/dev-server.d.ts +6 -2
  206. package/dist/plugins/dev-server.d.ts.map +1 -1
  207. package/dist/plugins/dev-store-clear.d.ts +83 -0
  208. package/dist/plugins/dev-store-clear.d.ts.map +1 -0
  209. package/dist/plugins/graph-endpoint.d.ts +4 -2
  210. package/dist/plugins/graph-endpoint.d.ts.map +1 -1
  211. package/dist/plugins/prebuilt.d.ts.map +1 -1
  212. package/dist/routing/index.js +4 -4
  213. package/dist/rsc-runtime/rsc.d.ts +2 -1
  214. package/dist/rsc-runtime/rsc.d.ts.map +1 -1
  215. package/dist/rsc-runtime/server-references.d.ts +8 -0
  216. package/dist/rsc-runtime/server-references.d.ts.map +1 -0
  217. package/dist/schema-bridge.d.ts +28 -19
  218. package/dist/schema-bridge.d.ts.map +1 -1
  219. package/dist/search-params/define.d.ts +1 -1
  220. package/dist/search-params/define.d.ts.map +1 -1
  221. package/dist/search-params/index.js +11 -14
  222. package/dist/search-params/index.js.map +1 -1
  223. package/dist/search-params/wrappers.d.ts +3 -3
  224. package/dist/server/access-gate.d.ts +12 -0
  225. package/dist/server/access-gate.d.ts.map +1 -1
  226. package/dist/server/canonicalize.d.ts +21 -0
  227. package/dist/server/canonicalize.d.ts.map +1 -1
  228. package/dist/server/cookie-context.d.ts +8 -1
  229. package/dist/server/cookie-context.d.ts.map +1 -1
  230. package/dist/server/flight-source-node.d.ts.map +1 -1
  231. package/dist/server/flight-source.d.ts.map +1 -1
  232. package/dist/server/index.d.ts +1 -1
  233. package/dist/server/index.d.ts.map +1 -1
  234. package/dist/server/index.js +8 -13
  235. package/dist/server/index.js.map +1 -1
  236. package/dist/server/interception-gates.d.ts +49 -0
  237. package/dist/server/interception-gates.d.ts.map +1 -0
  238. package/dist/server/internal.js +1080 -959
  239. package/dist/server/internal.js.map +1 -1
  240. package/dist/server/logger.d.ts +26 -0
  241. package/dist/server/logger.d.ts.map +1 -1
  242. package/dist/server/param-coercion.d.ts +8 -0
  243. package/dist/server/param-coercion.d.ts.map +1 -1
  244. package/dist/server/pipeline-interception.d.ts +34 -4
  245. package/dist/server/pipeline-interception.d.ts.map +1 -1
  246. package/dist/server/pipeline-metadata-route.d.ts +24 -0
  247. package/dist/server/pipeline-metadata-route.d.ts.map +1 -0
  248. package/dist/server/pipeline-metadata.d.ts +3 -2
  249. package/dist/server/pipeline-metadata.d.ts.map +1 -1
  250. package/dist/server/pipeline-phases.d.ts +9 -3
  251. package/dist/server/pipeline-phases.d.ts.map +1 -1
  252. package/dist/server/pipeline.d.ts +18 -0
  253. package/dist/server/pipeline.d.ts.map +1 -1
  254. package/dist/server/prebuilt/dev-store.d.ts +68 -22
  255. package/dist/server/prebuilt/dev-store.d.ts.map +1 -1
  256. package/dist/server/prebuilt/overlay.d.ts +17 -3
  257. package/dist/server/prebuilt/overlay.d.ts.map +1 -1
  258. package/dist/server/prebuilt-runtime.d.ts.map +1 -1
  259. package/dist/server/primitives.d.ts +13 -0
  260. package/dist/server/primitives.d.ts.map +1 -1
  261. package/dist/server/render-utils.d.ts +21 -0
  262. package/dist/server/render-utils.d.ts.map +1 -1
  263. package/dist/server/request-context.d.ts +14 -0
  264. package/dist/server/request-context.d.ts.map +1 -1
  265. package/dist/server/route-element-builder.d.ts.map +1 -1
  266. package/dist/server/route-handler.d.ts +7 -0
  267. package/dist/server/route-handler.d.ts.map +1 -1
  268. package/dist/server/route-matcher.d.ts +14 -3
  269. package/dist/server/route-matcher.d.ts.map +1 -1
  270. package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
  271. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  272. package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
  273. package/dist/server/signal-identity.d.ts +6 -0
  274. package/dist/server/signal-identity.d.ts.map +1 -1
  275. package/dist/server/traced-access.d.ts +18 -0
  276. package/dist/server/traced-access.d.ts.map +1 -0
  277. package/dist/server/tracing.d.ts.map +1 -1
  278. package/dist/server/types.d.ts +5 -4
  279. package/dist/server/types.d.ts.map +1 -1
  280. package/dist/shims/font-google.js +1 -2
  281. package/dist/shims/font-local.js +1 -2
  282. package/dist/shims/headers.d.ts +11 -4
  283. package/dist/shims/headers.d.ts.map +1 -1
  284. package/docs/api/30-api-server.mdx +3 -1
  285. package/docs/api/32-api-cache.mdx +1 -1
  286. package/docs/api/33-api-search-params.mdx +3 -1
  287. package/docs/api/34-api-config.mdx +22 -0
  288. package/docs/api/36-cli.mdx +72 -6
  289. package/docs/learn/01-quick-start.mdx +1 -1
  290. package/docs/learn/06-typed-params.mdx +4 -4
  291. package/docs/learn/10-caching.mdx +26 -5
  292. package/llms.txt +1 -1
  293. package/package.json +12 -12
  294. package/src/adapters/build-output-helper.ts +26 -4
  295. package/src/adapters/cloudflare.ts +1 -0
  296. package/src/adapters/nitro-presets.ts +15 -0
  297. package/src/adapters/nitro-preview.ts +66 -34
  298. package/src/adapters/nitro.ts +14 -6
  299. package/src/analyze/graph-command.ts +25 -133
  300. package/src/cache/guarded-read.ts +44 -0
  301. package/src/cache/key-discipline.ts +218 -0
  302. package/src/cache/timber-cache.ts +46 -7
  303. package/src/cli-dev-status.ts +196 -0
  304. package/src/cli-init.ts +278 -0
  305. package/src/cli.ts +33 -79
  306. package/src/client/error-boundary.tsx +19 -2
  307. package/src/client/global-context.ts +42 -14
  308. package/src/client/navigation-context.ts +4 -11
  309. package/src/client/params-context.ts +5 -17
  310. package/src/client/segment-update-context.ts +1 -1
  311. package/src/client/slot-content-cache-context.ts +1 -1
  312. package/src/client/slot-context.ts +6 -17
  313. package/src/client/use-cookie.ts +33 -21
  314. package/src/config-types.ts +22 -5
  315. package/src/config-validation.ts +17 -0
  316. package/src/cookies/define-cookie.ts +10 -46
  317. package/src/cookies/json-cookie.ts +4 -4
  318. package/src/plugin-context.ts +7 -0
  319. package/src/plugins/dev-discovery.ts +216 -6
  320. package/src/plugins/dev-hostname.ts +322 -0
  321. package/src/plugins/dev-server.ts +130 -37
  322. package/src/plugins/dev-store-clear.ts +145 -0
  323. package/src/plugins/graph-endpoint.ts +15 -3
  324. package/src/plugins/prebuilt.ts +9 -0
  325. package/src/rsc-runtime/rsc.ts +7 -3
  326. package/src/rsc-runtime/server-references.ts +73 -0
  327. package/src/rsc-runtime/vendor-types.d.ts +17 -0
  328. package/src/schema-bridge.ts +93 -38
  329. package/src/search-params/define.ts +5 -6
  330. package/src/search-params/wrappers.ts +3 -3
  331. package/src/server/access-gate.tsx +32 -20
  332. package/src/server/action-handler.ts +58 -36
  333. package/src/server/canonicalize.ts +27 -0
  334. package/src/server/cookie-context.ts +11 -3
  335. package/src/server/flight-source-node.ts +5 -2
  336. package/src/server/flight-source.ts +4 -3
  337. package/src/server/index.ts +6 -1
  338. package/src/server/interception-gates.ts +94 -0
  339. package/src/server/logger.ts +32 -0
  340. package/src/server/param-coercion.ts +22 -0
  341. package/src/server/pipeline-interception.ts +64 -4
  342. package/src/server/pipeline-metadata-route.ts +242 -0
  343. package/src/server/pipeline-metadata.ts +7 -5
  344. package/src/server/pipeline-phases.ts +71 -131
  345. package/src/server/pipeline.ts +20 -2
  346. package/src/server/prebuilt/dev-store.ts +113 -34
  347. package/src/server/prebuilt/overlay.ts +32 -4
  348. package/src/server/prebuilt-runtime.ts +63 -45
  349. package/src/server/primitives.ts +14 -0
  350. package/src/server/render-utils.ts +25 -0
  351. package/src/server/request-context.ts +27 -3
  352. package/src/server/route-element-builder.ts +15 -2
  353. package/src/server/route-handler.ts +3 -2
  354. package/src/server/route-matcher.ts +48 -33
  355. package/src/server/rsc-entry/api-handler.ts +2 -33
  356. package/src/server/rsc-entry/index.ts +8 -3
  357. package/src/server/rsc-entry/rsc-stream.ts +7 -1
  358. package/src/server/signal-identity.ts +30 -12
  359. package/src/server/traced-access.ts +50 -0
  360. package/src/server/tracing.ts +18 -1
  361. package/src/server/types.ts +5 -4
  362. package/src/shims/headers.ts +12 -4
  363. package/dist/_chunks/actions-BDqn4Oxj.js.map +0 -1
  364. package/dist/_chunks/build-output-helper-RV_BRcF1.js.map +0 -1
  365. package/dist/_chunks/cache-api-GE4AOe2H.js.map +0 -1
  366. package/dist/_chunks/chains-CDK1AWZQ.js +0 -1
  367. package/dist/_chunks/cli-context-BJQB6rtF.js +0 -1
  368. package/dist/_chunks/dev-server-BiWNMBVU.js +0 -1
  369. package/dist/_chunks/dev-server-DIy-SY-J.js.map +0 -1
  370. package/dist/_chunks/dev-store-BOa304m_.js.map +0 -1
  371. package/dist/_chunks/flight-source-node-HptmGMT8.js.map +0 -1
  372. package/dist/_chunks/graph-cache-CYiUS2aS.js.map +0 -1
  373. package/dist/_chunks/logger-CbLdcy-W.js.map +0 -1
  374. package/dist/_chunks/node-response-rkQqcFGq.js.map +0 -1
  375. package/dist/_chunks/plugin-context-DxMMvjUt.js.map +0 -1
  376. package/dist/_chunks/schema-bridge-C83xa9lT.js.map +0 -1
  377. package/dist/_chunks/segment-context-xtPUGfdq.js.map +0 -1
  378. package/dist/server/prebuilt/key-discipline.d.ts +0 -52
  379. package/dist/server/prebuilt/key-discipline.d.ts.map +0 -1
  380. package/src/server/prebuilt/key-discipline.ts +0 -122
@@ -15,7 +15,7 @@
15
15
 
16
16
  import { DenySignal, RedirectSignal } from './primitives.ts';
17
17
  import { isDenySignal, isRedirectSignal } from './signal-identity.ts';
18
- import { withSpan, setSpanAttribute } from './tracing.ts';
18
+ import { runTracedAccess } from './traced-access.ts';
19
19
  import { isDebug } from './debug.ts';
20
20
  import type { DenyPageEntry } from './deny-boundary.ts';
21
21
  import { handleCaughtDeny, setFirstDeniedSegmentIndex } from './deny-boundary.ts';
@@ -79,6 +79,15 @@ export interface AccessGateProps {
79
79
  * return rscErrorEnvelope for a client hard-navigate.
80
80
  */
81
81
  skippedSegment?: boolean;
82
+ /**
83
+ * When true, this gate guards a segment of the URL's own route that is not
84
+ * in the rendered tree — an intercepted navigation renders one for each
85
+ * (TIM-1607). On deny it marks the signal `_leaveSpa` and rethrows: no
86
+ * deny page of that segment can render here, so the client leaves the SPA
87
+ * and the document request answers. Never set with `denyPages` or
88
+ * `segmentIndex`, which describe positions in the rendered chain.
89
+ */
90
+ outsideTree?: boolean;
82
91
  children: ReactNode;
83
92
  }
84
93
 
@@ -128,10 +137,21 @@ export interface SlotAccessGateProps {
128
137
  * in-tree — the client's cached layout chrome would wrap them incorrectly.
129
138
  * Instead, the deny is recorded in ALS and rethrown so the response path
130
139
  * can return rscErrorEnvelope for a client hard-navigate.
140
+ *
141
+ * For a segment outside the rendered tree (outsideTree=true), see
142
+ * `DenySignal._leaveSpa`.
131
143
  */
132
144
  export function AccessGate(props: AccessGateProps): Promise<ReactNode> {
133
- const { accessFn, segmentName, segmentKey, segmentIndex, denyPages, skippedSegment, children } =
134
- props;
145
+ const {
146
+ accessFn,
147
+ segmentName,
148
+ segmentKey,
149
+ segmentIndex,
150
+ denyPages,
151
+ skippedSegment,
152
+ outsideTree,
153
+ children,
154
+ } = props;
135
155
 
136
156
  return accessGateFallback(
137
157
  accessFn,
@@ -140,6 +160,7 @@ export function AccessGate(props: AccessGateProps): Promise<ReactNode> {
140
160
  segmentIndex,
141
161
  skippedSegment ? undefined : denyPages,
142
162
  skippedSegment,
163
+ outsideTree,
143
164
  children
144
165
  );
145
166
  }
@@ -155,32 +176,23 @@ async function accessGateFallback(
155
176
  segmentIndex: AccessGateProps['segmentIndex'],
156
177
  denyPages: DenyPageEntry[] | undefined,
157
178
  skippedSegment: boolean | undefined,
179
+ outsideTree: boolean | undefined,
158
180
  children: ReactNode
159
181
  ): Promise<ReactNode> {
160
182
  try {
161
- await withSpan('timber.access', { 'timber.segment': segmentName ?? 'unknown' }, async () => {
162
- try {
163
- await accessFn();
164
- await setSpanAttribute('timber.result', 'pass');
165
- } catch (error: unknown) {
166
- if (isDenySignal(error)) {
167
- await setSpanAttribute('timber.result', 'deny');
168
- await setSpanAttribute('timber.deny_status', error.status);
169
- if (error.sourceFile) {
170
- await setSpanAttribute('timber.deny_file', error.sourceFile);
171
- }
172
- } else if (isRedirectSignal(error)) {
173
- await setSpanAttribute('timber.result', 'redirect');
174
- }
175
- throw error;
176
- }
177
- });
183
+ await runTracedAccess(accessFn, segmentName);
178
184
  } catch (error: unknown) {
179
185
  if (isDenySignal(error)) {
180
186
  if (segmentIndex !== undefined) {
181
187
  setFirstDeniedSegmentIndex(segmentIndex);
182
188
  }
183
189
 
190
+ if (outsideTree) {
191
+ error._hardNavigate = true;
192
+ error._leaveSpa = true;
193
+ throw error;
194
+ }
195
+
184
196
  if (skippedSegment) {
185
197
  error._hardNavigate = true;
186
198
  throw error;
@@ -37,7 +37,7 @@ import type { ReactFormState } from 'react-dom/client';
37
37
  import { encodeErrorDigest } from '../shared/error-digest.ts';
38
38
  import { clientErrorMessage } from './client-error-message.ts';
39
39
  import { checkVersionSkew, applyReloadHeaders } from './version-skew.ts';
40
- import { logActionError, swallow } from './logger.ts';
40
+ import { logActionError, logActionRejected, swallow } from './logger.ts';
41
41
  import { fireOnRequestError } from './pipeline-helpers.ts';
42
42
  import { withTimeout, RenderTimeoutError, DEFAULT_RENDER_TIMEOUT_MS } from './render-timeout.ts';
43
43
  import { canonicalize } from './canonicalize.ts';
@@ -268,29 +268,29 @@ async function reportRevalidationErrors(req: Request, errors: readonly unknown[]
268
268
  }
269
269
 
270
270
  /**
271
- * Answer an action request that failed before the action ran with a bare
272
- * status, never a 200 action-error payload: a fabricated action id must not
273
- * look like an action that ran (tests/e2e/security.test.ts). Either way it
274
- * is logged and reported to `onRequestError` as phase `'action'` (TIM-1537).
271
+ * Answer an action request the client got wrong with a bare 400, never a 200
272
+ * action-error payload: a fabricated action id must not look like an action
273
+ * that ran (tests/e2e/security.test.ts). The request is wrong in a way the
274
+ * handler can see for itself: the reference names no server function, or the
275
+ * body will not parse, decode, or decode to an argument list.
275
276
  *
276
- * The status is chosen by what failed, not by matching error messages:
277
- * - **400**: the request is wrong in a way the handler can see for itself.
278
- * The body will not parse or decode, or the reference resolves to
279
- * something that is not a function.
280
- * - **500**: loading the action module failed. plugin-rsc rejects the same
281
- * way for an unknown reference and for a real module that fails to import
282
- * or evaluate, and the second is a server fault, so the load failure keeps
283
- * the 5xx it had before this change. The no-JS path cannot make this
284
- * split (`decodeAction` decodes and loads in one call) and answers 400;
285
- * see `handleFormAction`.
277
+ * Any client can send these, so they are logged at warn with the reason and
278
+ * no stack, and are not reported to `onRequestError`: an error tracker would
279
+ * otherwise record whatever a client makes up (TIM-1601). A known action
280
+ * module that fails to load is the server's fault, and `decodeRscActionCall`
281
+ * answers it with a 500 and reports it. Two loads cannot be split that way
282
+ * and land here: a server function passed as an argument, which
283
+ * `decodeReply` loads, and the no-JS action, which `decodeAction` loads.
284
+ * Their module's error is still the logged reason.
286
285
  */
287
- async function rejectActionRequest(
288
- req: Request,
289
- error: unknown,
290
- status: 400 | 500
291
- ): Promise<Response> {
292
- await reportActionError(req, error);
293
- return new Response(null, { status });
286
+ function rejectActionRequest(req: Request, reason: unknown): Response {
287
+ logActionRejected({
288
+ method: req.method,
289
+ path: new URL(req.url).pathname,
290
+ status: 400,
291
+ reason: reason instanceof Error ? reason.message : String(reason),
292
+ });
293
+ return new Response(null, { status: 400 });
294
294
  }
295
295
 
296
296
  /**
@@ -321,11 +321,28 @@ async function rejectedActionResponse(req: Request, error: unknown): Promise<Res
321
321
  );
322
322
  }
323
323
 
324
+ /** The tag React's `registerServerReference` stamps on a server function. */
325
+ const SERVER_REFERENCE_TAG = Symbol.for('react.server.reference');
326
+
327
+ /**
328
+ * Whether a loaded value is a function a `'use server'` module registered.
329
+ * Being a function is not enough: in a build, plugin-rsc looks the reference
330
+ * up in plain objects, so `<id>#constructor` loads `Object` and `constructor`
331
+ * as a module ID loads it too. Only the use-server transform's exports carry
332
+ * React's tag, so the tag is the allowlist.
333
+ */
334
+ function isServerReference(value: unknown): value is (...args: unknown[]) => Promise<unknown> {
335
+ return (
336
+ typeof value === 'function' && '$$typeof' in value && value.$$typeof === SERVER_REFERENCE_TAG
337
+ );
338
+ }
339
+
324
340
  /**
325
341
  * Load the action by reference ID and decode its args from the request body
326
342
  * (RSC wire format). Returns a Response for a request that fails before the
327
- * action can run: see `rejectActionRequest` for the status, and the field
328
- * limit for its own.
343
+ * action can run: a 400 for the client's mistakes (`rejectActionRequest`),
344
+ * a 500 for a known action module that fails to load, and the field limit's
345
+ * own status.
329
346
  */
330
347
  async function decodeRscActionCall(
331
348
  req: Request,
@@ -336,13 +353,17 @@ async function decodeRscActionCall(
336
353
  try {
337
354
  loaded = await loadServerAction(actionId);
338
355
  } catch (error) {
339
- return rejectActionRequest(req, error, 500);
356
+ // The module exists but failed to import or evaluate: a server fault.
357
+ // An unknown module does not get here; it loads as undefined (below).
358
+ await reportActionError(req, error);
359
+ return new Response(null, { status: 500 });
340
360
  }
341
- if (typeof loaded !== 'function') {
342
- // The module loaded but has no such export: a reference the client made up.
343
- return rejectActionRequest(req, new Error(`Unknown server action "${actionId}"`), 400);
361
+ if (!isServerReference(loaded)) {
362
+ // No such module or export, or not a server function: a reference the
363
+ // client made up.
364
+ return rejectActionRequest(req, `Unknown server action "${actionId}"`);
344
365
  }
345
- const actionFn = loaded as (...args: unknown[]) => Promise<unknown>;
366
+ const actionFn = loaded;
346
367
 
347
368
  let decoded: unknown;
348
369
  try {
@@ -361,13 +382,13 @@ async function decodeRscActionCall(
361
382
  decoded = await decodeReply(await req.text());
362
383
  }
363
384
  } catch (error) {
364
- return rejectActionRequest(req, error, 400);
385
+ return rejectActionRequest(req, error);
365
386
  }
366
387
  // The client always encodes an argument list. Anything else would fail
367
388
  // when `executeAction` spreads it, inside the action's own catch, and
368
389
  // come back as a 200 INTERNAL_ERROR for what is the caller's mistake.
369
390
  if (!Array.isArray(decoded)) {
370
- return rejectActionRequest(req, new Error('Server action body is not an argument list'), 400);
391
+ return rejectActionRequest(req, 'Server action body is not an argument list');
371
392
  }
372
393
  return { actionFn, args: decoded };
373
394
  }
@@ -604,7 +625,7 @@ async function handleFormAction(
604
625
  try {
605
626
  formData = await req.clone().formData();
606
627
  } catch (error) {
607
- return rejectActionRequest(req, error, 400);
628
+ return rejectActionRequest(req, error);
608
629
  }
609
630
 
610
631
  // Enforce field count limit after parsing FormData.
@@ -625,10 +646,11 @@ async function handleFormAction(
625
646
  // decodeAction both decodes the form's `$ACTION_REF_` metadata and loads
626
647
  // the module, and React does not say which failed. On a no-JS POST that
627
648
  // metadata is written by React into the form, so a failure is almost
628
- // always a forged or truncated request: 400. A module that genuinely
629
- // fails to import also breaks the RSC render of the page holding the
630
- // form, which surfaces it as a 500 there.
631
- return rejectActionRequest(req, error, 400);
649
+ // always a forged or truncated request: 400, logged at warn with the
650
+ // error as the reason. A module that genuinely fails to import also
651
+ // breaks the RSC render of a page that imports it, which reports it; an
652
+ // action module only a client component imports gets the warning alone.
653
+ return rejectActionRequest(req, error);
632
654
  }
633
655
  if (!actionFn) {
634
656
  return null;
@@ -120,3 +120,30 @@ export function canonicalRequestPath(rawPathname: string, stripTrailingSlash = t
120
120
  }
121
121
  return pathname;
122
122
  }
123
+
124
+ /**
125
+ * Build a request's URL from its origin and its raw request target, or
126
+ * return null when the result is not a URL (the caller answers 400).
127
+ *
128
+ * An origin-form target (`/path`) is concatenated, not resolved against the
129
+ * origin: resolved as a relative reference, `//evil.com/` names another host,
130
+ * and the pipeline would see `/` instead of the path it must redirect to
131
+ * `/evil.com` (TIM-1571). Any other form is resolved against the origin:
132
+ * the asterisk-form `OPTIONS *` becomes `/*`, and an absolute-form target
133
+ * (`GET http://host/a`) keeps only its path and query. Its scheme and
134
+ * authority are the client's word, not the connection's: they would stand in
135
+ * for the Host that the dev server's allowedHosts check and CSRF read, and a
136
+ * non-http scheme (`foo://x/`) makes an opaque origin the pipeline cannot
137
+ * build URLs from, so that is null too.
138
+ *
139
+ * Shared by the dev server and the Nitro preview server (which ships this
140
+ * file as `_canonicalize.mjs`), so the two cannot disagree about which path a
141
+ * request target names. Production adapters build the URL in their own
142
+ * runtime (srvx for Nitro).
143
+ */
144
+ export function requestTargetUrl(origin: string, target: string): URL | null {
145
+ if (target.startsWith('/')) return URL.parse(origin + target);
146
+ const resolved = URL.parse(target, origin);
147
+ if (resolved?.protocol !== 'http:' && resolved?.protocol !== 'https:') return null;
148
+ return URL.parse(origin + resolved.pathname + resolved.search);
149
+ }
@@ -185,7 +185,7 @@ export function getCookieJar(): RequestCookies {
185
185
  }
186
186
  },
187
187
 
188
- delete(name: string, options?: Pick<CookieOptions, 'path' | 'domain'>): void {
188
+ delete(name: string, options?: CookieDeleteOptions): void {
189
189
  assertMutable(store, 'delete');
190
190
  // Validate the name even though delete writes an empty value — a
191
191
  // smuggled name (`;` or CR/LF) would corrupt the Set-Cookie header
@@ -208,7 +208,7 @@ export function getCookieJar(): RequestCookies {
208
208
  expires: new Date(0),
209
209
  };
210
210
  // delete() is a jar entry point like set() — caller-supplied
211
- // path/domain are serialized verbatim into the Set-Cookie header,
211
+ // attributes are serialized verbatim into the Set-Cookie header,
212
212
  // so they must pass the same attribute-injection guard. See
213
213
  // design/29-cookies.md §"Cookie Attribute Validation" (TIM-1026).
214
214
  assertValidCookieOptions(opts);
@@ -300,6 +300,14 @@ export interface CookieOptions {
300
300
  partitioned?: boolean;
301
301
  }
302
302
 
303
+ /**
304
+ * Options for deleting a cookie: every attribute but the lifetime, which
305
+ * delete() forces to the past. Pass the attributes the cookie was set with —
306
+ * a partitioned cookie is only removed by a deletion that is also
307
+ * `Partitioned`, since browsers keep it in a separate jar (TIM-1606).
308
+ */
309
+ export type CookieDeleteOptions = Omit<CookieOptions, 'maxAge' | 'expires'>;
310
+
303
311
  /**
304
312
  * Cookie accessor returned by `getCookies()`.
305
313
  *
@@ -340,7 +348,7 @@ export interface RequestCookies {
340
348
  */
341
349
  setFromHeaders(headers: Headers): void;
342
350
  /** Delete a cookie. Only available in mutable contexts. */
343
- delete(name: string, options?: Pick<CookieOptions, 'path' | 'domain'>): void;
351
+ delete(name: string, options?: CookieDeleteOptions): void;
344
352
  /** Delete all cookies. Only available in mutable contexts. */
345
353
  clear(): void;
346
354
  /** Serialize cookies as a Cookie header string. */
@@ -21,6 +21,7 @@ import { NodeBodyResponse } from './node-body-response.ts';
21
21
  import { DEFAULT_MAX_BUFFER_BYTES, teeBufferExceeded } from './stream-utils.ts';
22
22
  import { onAbortUntil } from './abort-scope.ts';
23
23
  import { RenderTimeoutError } from './render-timeout.ts';
24
+ import { releaseReason } from './render-utils.ts';
24
25
 
25
26
  // `String.prototype.toWellFormed` ships in every Node timber supports
26
27
  // (engines: >=22.18) but is ES2024, past the project's ES2022 lib; this file
@@ -110,8 +111,10 @@ export function pipeFlightToNode(
110
111
  destroy(error, callback) {
111
112
  scope.abort();
112
113
  clearTimeout(timer);
113
- // A no-op once Flight has finished (it ignores abort after close).
114
- flight.abort(error ?? undefined);
114
+ // A no-op once Flight has finished (it ignores abort after close). A
115
+ // release without a reason aborts with an AbortError, so the render's
116
+ // onError does not log the abort (releaseReason, TIM-1597).
117
+ flight.abort(releaseReason(error));
115
118
  callback(error);
116
119
  },
117
120
  });
@@ -23,6 +23,7 @@
23
23
 
24
24
  import type { Readable } from 'node:stream';
25
25
  import { nodeStreamsPlatform } from './node-streams-platform.ts';
26
+ import { releaseReason } from './render-utils.ts';
26
27
  import {
27
28
  concatBytes,
28
29
  drainWithDeadline,
@@ -157,7 +158,7 @@ export function openFlightReader(source: FlightSource): FlightReader {
157
158
  return {
158
159
  read: () => reader.read(),
159
160
  takeBuffered: () => [],
160
- cancel: (reason) => void reader.cancel(reason).catch(() => {}),
161
+ cancel: (reason) => void reader.cancel(releaseReason(reason)).catch(() => {}),
161
162
  };
162
163
  }
163
164
  const { destroyNodeFlight } = requireNodeFlight();
@@ -186,7 +187,7 @@ export function openFlightReader(source: FlightSource): FlightReader {
186
187
  /** Release a source nothing will read, aborting the render behind it. */
187
188
  export function cancelFlightSource(source: FlightSource, reason?: unknown): void {
188
189
  if (source.kind === 'web') {
189
- source.stream.cancel(reason).catch(() => {});
190
+ source.stream.cancel(releaseReason(reason)).catch(() => {});
190
191
  return;
191
192
  }
192
193
  requireNodeFlight().destroyNodeFlight(source.stream, reason);
@@ -281,7 +282,7 @@ export function peekFlight(source: FlightSource): FlightPeek {
281
282
  else controller.enqueue(result.value);
282
283
  },
283
284
  cancel(reason) {
284
- return reader.cancel(reason);
285
+ return reader.cancel(releaseReason(reason));
285
286
  },
286
287
  });
287
288
  return { ready, source: { kind: 'web', stream } };
@@ -18,7 +18,12 @@ export type { ReadonlyHeaders } from './request-context.ts';
18
18
  // Cookie Context — ALS-backed getCookieJar() escape hatch
19
19
  // Design doc: design/29-cookies.md
20
20
  export { getCookieJar } from './cookie-context.ts';
21
- export type { RequestCookies, CookieOptions, SetCookieOptions } from './cookie-context.ts';
21
+ export type {
22
+ RequestCookies,
23
+ CookieOptions,
24
+ CookieDeleteOptions,
25
+ SetCookieOptions,
26
+ } from './cookie-context.ts';
22
27
 
23
28
  // Runtime primitives
24
29
  export {
@@ -0,0 +1,94 @@
1
+ /**
2
+ * The URL's own access gates in an intercepted tree (TIM-1607).
3
+ *
4
+ * An intercepted navigation renders a different route than its URL names —
5
+ * the source route with the target in a slot, or the owner's chain through
6
+ * its intercepting child. The response is still for the URL, so the URL's
7
+ * whole `access.ts` chain gates it, in the one render, as one group of gates
8
+ * at the top of the tree:
9
+ *
10
+ * ```
11
+ * [Gate(/) → Gate(secret) → Gate(secret/[id])] → root layout → … → Gate(feed) → …
12
+ * ```
13
+ *
14
+ * The whole chain, shared segments included, for two reasons:
15
+ *
16
+ * - **Params.** Each gate must read the URL's params. A shared segment's
17
+ * in-tree gate reads the rendered route's, and in the modal shape those come
18
+ * from re-matching `interceptingPrefix`, a pattern — a shared `[org]` reads
19
+ * the literal `'[org]'`, not `'acme'`.
20
+ * - **Coverage.** Nothing renders outside the top of the tree. Placed any
21
+ * lower, the gates miss whatever an ancestor layout renders beside them —
22
+ * a modal slot is a prop of its owner's layout, and the rendered chain can
23
+ * continue past the owner through a route group the target shares
24
+ * (`app/@modal/(.)secret/[id]` over `app/(main)/page.tsx`).
25
+ *
26
+ * The shared segments' in-tree gates are dropped (`sharedCount`), so each
27
+ * access.ts still runs once, outer → inner: the URL's chain, then the gates
28
+ * only the rendered chain has.
29
+ *
30
+ * Each gate is marked `outsideTree`: the URL's deny pages, and the layouts
31
+ * they render in, are not this tree's, so a deny leaves the SPA for the URL's
32
+ * document instead of being placed here. See `DenySignal._leaveSpa`,
33
+ * design/07-routing.md §"Intercepting Routes".
34
+ */
35
+
36
+ import type React from 'react';
37
+ import { AccessGate } from './access-gate.tsx';
38
+ import type { RouteMatch } from './pipeline.ts';
39
+ import { runWithRouteParams } from './pipeline-interception.ts';
40
+ import { loadModule } from './safe-load.ts';
41
+
42
+ export interface InterceptionGates {
43
+ /**
44
+ * How many segments, from the root, the rendered chain shares with the
45
+ * URL's route. Their access.ts runs in the group; the builder gives them no
46
+ * gate of their own.
47
+ */
48
+ sharedCount: number;
49
+ /** Wrap the whole tree in the URL's gates, outermost first. */
50
+ wrap(
51
+ element: React.ReactElement,
52
+ h: (...args: unknown[]) => React.ReactElement
53
+ ): React.ReactElement;
54
+ }
55
+
56
+ /** The gates an intercepted match needs, or null when it is not intercepted. */
57
+ export async function loadInterceptionGates(match: RouteMatch): Promise<InterceptionGates | null> {
58
+ const canonical = match.canonical;
59
+ if (!canonical) return null;
60
+
61
+ // Both chains are paths from the manifest root through one tree, so the
62
+ // segments they share are exactly a common prefix.
63
+ const rendered = match.segments;
64
+ let sharedCount = 0;
65
+ while (
66
+ sharedCount < rendered.length &&
67
+ sharedCount < canonical.segments.length &&
68
+ rendered[sharedCount] === canonical.segments[sharedCount]
69
+ ) {
70
+ sharedCount++;
71
+ }
72
+
73
+ const gates: Array<{ segmentName: string; accessFn: () => unknown }> = [];
74
+ for (const segment of canonical.segments) {
75
+ if (!segment.access) continue;
76
+ const mod = await loadModule(segment.access);
77
+ const accessFn = mod.default as (() => unknown) | undefined;
78
+ if (!accessFn) continue;
79
+ gates.push({
80
+ segmentName: segment.segmentName,
81
+ accessFn: () => runWithRouteParams(canonical, accessFn),
82
+ });
83
+ }
84
+
85
+ return {
86
+ sharedCount,
87
+ wrap(element, h) {
88
+ for (let i = gates.length - 1; i >= 0; i--) {
89
+ element = h(AccessGate, { ...gates[i], outsideTree: true, children: element });
90
+ }
91
+ return element;
92
+ },
93
+ };
94
+ }
@@ -178,6 +178,21 @@ export function logActionError(data: {
178
178
  _logger.error('unhandled server action error', withTraceContext(data));
179
179
  }
180
180
 
181
+ /**
182
+ * Log a server action request rejected as the client's mistake before the
183
+ * action ran: a reference that does not exist, a body that will not decode.
184
+ * Level: warn, with the reason but no stack — any client can send these, so
185
+ * they must not read as server faults (TIM-1601).
186
+ */
187
+ export function logActionRejected(data: {
188
+ method: string;
189
+ path: string;
190
+ status: number;
191
+ reason: string;
192
+ }): void {
193
+ _logger.warn('server action request rejected', withTraceContext(data));
194
+ }
195
+
181
196
  /** Log unhandled error in route handler. Level: error. */
182
197
  export function logRouteError(data: { method: string; path: string; error: unknown }): void {
183
198
  if (isControlFlowSignal(data.error)) return;
@@ -199,6 +214,14 @@ export function logWaitUntilRejected(data: { error: unknown }): void {
199
214
  _logger.warn('waitUntil() promise rejected', withTraceContext(data));
200
215
  }
201
216
 
217
+ /**
218
+ * Log a cached value computed from request context its key leaves out
219
+ * (design/45 §Enforcement). Level: error.
220
+ */
221
+ export function logKeyDisciplineViolation(event: string, data: Record<string, unknown>): void {
222
+ _logger.error(event, withTraceContext(data));
223
+ }
224
+
202
225
  /** Log staleWhileRevalidate refetch failure. Level: warn. */
203
226
  export function logSwrRefetchFailed(data: { cacheKey: string; error: unknown }): void {
204
227
  _logger.warn('staleWhileRevalidate refetch failed', withTraceContext(data));
@@ -220,6 +243,15 @@ export function logCacheMiss(data: { cacheKey: string }): void {
220
243
  _logger.debug('timber.cache MISS', withTraceContext(data));
221
244
  }
222
245
 
246
+ /**
247
+ * Log a cache read that threw or timed out and was served as a miss.
248
+ * Level: warn — the request still succeeds, but a failing store (Redis down,
249
+ * KV erroring) means every read is paying for a live fetch.
250
+ */
251
+ export function logCacheReadFailed(data: { cacheKey: string; error: unknown }): void {
252
+ _logger.warn('cache read failed — treating as a miss', withTraceContext(data));
253
+ }
254
+
223
255
  // ─── Swallow Helper ───────────────────────────────────────────────────────
224
256
 
225
257
  /**
@@ -28,6 +28,28 @@ export class ParamCoercionError extends Error {
28
28
  this.name = 'ParamCoercionError';
29
29
  }
30
30
  }
31
+
32
+ /**
33
+ * The dev diagnostic for a match whose params a codec rejected; the caller
34
+ * answers 404. Shared by page/route.ts matches and metadata routes, so a
35
+ * silent coercion 404 explains itself the same way on either.
36
+ */
37
+ export function warnParamCoercionFailure(
38
+ method: string,
39
+ pathname: string,
40
+ segments: readonly { segmentName: string }[],
41
+ error: ParamCoercionError
42
+ ): void {
43
+ if (!isDebug()) return;
44
+ const segmentChain = segments.map((s) => s.segmentName || '/').join(' → ');
45
+ console.warn(
46
+ `[timber] Param coercion failed for ${method} ${pathname} — responding with 404\n` +
47
+ ` Matched segments: ${segmentChain}\n` +
48
+ ` Error: ${error.message}\n` +
49
+ ` This usually means a codec in app/schema.ts rejected the URL value.\n` +
50
+ ` Check the codec for the bracket key of the segment named above.`
51
+ );
52
+ }
31
53
  import { isDebug } from './debug.ts';
32
54
 
33
55
  // ---------------------------------------------------------------------------