nuxt-ai-ready 2.5.2 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (282) hide show
  1. package/README.md +13 -12
  2. package/dist/chunks/agent-skills.mjs +35 -12
  3. package/dist/chunks/prerender.mjs +35 -24
  4. package/dist/cli.mjs +5 -2
  5. package/dist/module.d.mts +4 -0
  6. package/dist/module.json +2 -2
  7. package/dist/module.mjs +8 -4
  8. package/dist/runtime/app/index.d.ts +3 -0
  9. package/dist/runtime/app/index.js +2 -0
  10. package/dist/runtime/cache-control.d.ts +2 -0
  11. package/dist/runtime/cache-control.js +11 -0
  12. package/dist/runtime/llms-txt-utils.js +1 -1
  13. package/dist/runtime/server/db/context.d.ts +13 -0
  14. package/dist/runtime/server/db/drizzle/client.d.ts +6 -7
  15. package/dist/runtime/server/db/drizzle/client.js +13 -2
  16. package/dist/runtime/server/db/drizzle/providers/bun.d.ts +2 -2
  17. package/dist/runtime/server/db/drizzle/providers/bun.js +2 -2
  18. package/dist/runtime/server/db/drizzle/providers/d1.d.ts +2 -2
  19. package/dist/runtime/server/db/drizzle/providers/d1.js +3 -2
  20. package/dist/runtime/server/db/drizzle/providers/libsql.d.ts +2 -2
  21. package/dist/runtime/server/db/drizzle/providers/libsql.js +2 -2
  22. package/dist/runtime/server/db/drizzle/providers/neon.d.ts +2 -2
  23. package/dist/runtime/server/db/drizzle/providers/neon.js +2 -2
  24. package/dist/runtime/server/db/drizzle/providers/node-sqlite.d.ts +2 -2
  25. package/dist/runtime/server/db/drizzle/providers/node-sqlite.js +2 -2
  26. package/dist/runtime/server/db/drizzle/providers/postgres.d.ts +2 -2
  27. package/dist/runtime/server/db/drizzle/providers/postgres.js +2 -2
  28. package/dist/runtime/server/db/drizzle/queries.d.ts +27 -27
  29. package/dist/runtime/server/db/drizzle/queries.js +6 -5
  30. package/dist/runtime/server/db/drizzle/raw.d.ts +2 -6
  31. package/dist/runtime/server/db/index.d.ts +1 -1
  32. package/dist/runtime/server/db/index.js +1 -1
  33. package/dist/runtime/server/db/queries.d.ts +36 -36
  34. package/dist/runtime/server/db/queries.js +8 -9
  35. package/dist/runtime/server/db/seed.d.ts +2 -2
  36. package/dist/runtime/server/db/seed.js +4 -3
  37. package/dist/runtime/server/db/shared.d.ts +8 -0
  38. package/dist/runtime/server/db/shared.js +8 -2
  39. package/dist/runtime/server/index.d.ts +2 -0
  40. package/dist/runtime/server/index.js +17 -0
  41. package/dist/runtime/server/mcp/tools/get-page-markdown.js +1 -1
  42. package/dist/runtime/server/mcp/tools/list-pages.js +1 -1
  43. package/dist/runtime/server/mcp/tools/search-pages.js +1 -1
  44. package/dist/runtime/server/middleware/markdown.js +3 -3
  45. package/dist/runtime/server/middleware/markdown.prerender.js +1 -1
  46. package/dist/runtime/server/plugins/db-lifecycle-nitro3.d.ts +2 -0
  47. package/dist/runtime/server/plugins/db-lifecycle-nitro3.js +16 -0
  48. package/dist/runtime/server/plugins/html-capture.prerender.js +6 -4
  49. package/dist/runtime/server/plugins/link-header-nitro3.d.ts +2 -0
  50. package/dist/runtime/server/plugins/link-header-nitro3.js +20 -0
  51. package/dist/runtime/server/plugins/link-header.d.ts +6 -0
  52. package/dist/runtime/server/plugins/link-header.js +7 -11
  53. package/dist/runtime/server/plugins/markdown-negotiation.js +8 -1
  54. package/dist/runtime/server/plugins/sitemap-seeder.js +3 -3
  55. package/dist/runtime/server/routes/agent-skills-artifact.d.ts +1 -1
  56. package/dist/runtime/server/routes/agent-skills-artifact.js +10 -10
  57. package/dist/runtime/server/routes/agent-skills-index.d.ts +1 -1
  58. package/dist/runtime/server/routes/agent-skills-index.js +7 -6
  59. package/dist/runtime/server/routes/ai-catalog.d.ts +2 -1
  60. package/dist/runtime/server/routes/ai-catalog.js +7 -8
  61. package/dist/runtime/server/routes/api-catalog.d.ts +3 -1
  62. package/dist/runtime/server/routes/api-catalog.js +12 -12
  63. package/dist/runtime/server/routes/llms-full.txt.get.js +1 -1
  64. package/dist/runtime/server/routes/mcp-server-card.d.ts +1 -1
  65. package/dist/runtime/server/routes/mcp-server-card.js +7 -8
  66. package/dist/runtime/server/utils/checkStale.d.ts +2 -2
  67. package/dist/runtime/server/utils/cloudflare-prerendered.d.ts +3 -0
  68. package/dist/runtime/server/utils/cloudflare-prerendered.js +23 -0
  69. package/dist/runtime/server/utils/cloudflare.d.ts +5 -5
  70. package/dist/runtime/server/utils/cloudflare.js +31 -7
  71. package/dist/runtime/server/utils/content-negotiation.d.ts +5 -3
  72. package/dist/runtime/server/utils/content-negotiation.js +8 -7
  73. package/dist/runtime/server/utils/context.d.ts +3 -3
  74. package/dist/runtime/server/utils/context.js +1 -1
  75. package/dist/runtime/server/utils/discovery-response.d.ts +2 -0
  76. package/dist/runtime/server/utils/link-header.d.ts +5 -3
  77. package/dist/runtime/server/utils/link-header.js +26 -2
  78. package/dist/runtime/server/utils/markdown-request.d.ts +4 -3
  79. package/dist/runtime/server/utils/markdown-request.js +15 -13
  80. package/dist/runtime/server/utils/negotiation-decision.d.ts +4 -0
  81. package/dist/runtime/server/utils/negotiation-decision.js +6 -5
  82. package/dist/runtime/server/utils/negotiation-response.d.ts +1 -1
  83. package/dist/runtime/server/utils/negotiation-response.js +63 -23
  84. package/dist/runtime/server/utils/prerender-html.d.ts +2 -1
  85. package/dist/runtime/server/utils/prerender-html.js +3 -1
  86. package/dist/runtime/types.d.ts +15 -7
  87. package/dist/shared/nuxt-ai-ready.B3hAuOLQ.mjs +29 -0
  88. package/dist/shared/{nuxt-ai-ready.CLSWou20.mjs → nuxt-ai-ready.C34F0LJo.mjs} +560 -219
  89. package/package.json +85 -20
  90. package/skills/nuxt-ai-ready/SKILL.md +26 -12
  91. package/skills/nuxt-ai-ready/references/runtime-indexing.md +7 -6
  92. package/dist/runtime/server/db/drizzle/providers/sqlite.d.ts +0 -8
  93. package/dist/runtime/server/db/drizzle/providers/sqlite.js +0 -15
  94. package/node_modules/@mdream/js/LICENSE.md +0 -9
  95. package/node_modules/@mdream/js/README.md +0 -792
  96. package/node_modules/@mdream/js/bin/mdream.mjs +0 -2
  97. package/node_modules/@mdream/js/dist/_chunks/const.mjs +0 -134
  98. package/node_modules/@mdream/js/dist/_chunks/index.d.mts +0 -9
  99. package/node_modules/@mdream/js/dist/_chunks/markdown-processor.mjs +0 -1968
  100. package/node_modules/@mdream/js/dist/_chunks/minimal.d.mts +0 -6
  101. package/node_modules/@mdream/js/dist/_chunks/parse.mjs +0 -2756
  102. package/node_modules/@mdream/js/dist/_chunks/plugins.mjs +0 -725
  103. package/node_modules/@mdream/js/dist/_chunks/resolve-plugins.mjs +0 -44
  104. package/node_modules/@mdream/js/dist/_chunks/stream.mjs +0 -37
  105. package/node_modules/@mdream/js/dist/_chunks/types.d.mts +0 -473
  106. package/node_modules/@mdream/js/dist/cli.d.mts +0 -1
  107. package/node_modules/@mdream/js/dist/cli.mjs +0 -32
  108. package/node_modules/@mdream/js/dist/core.d.mts +0 -15
  109. package/node_modules/@mdream/js/dist/core.mjs +0 -28
  110. package/node_modules/@mdream/js/dist/index.d.mts +0 -4
  111. package/node_modules/@mdream/js/dist/index.mjs +0 -58
  112. package/node_modules/@mdream/js/dist/llms-txt.d.mts +0 -86
  113. package/node_modules/@mdream/js/dist/llms-txt.mjs +0 -308
  114. package/node_modules/@mdream/js/dist/negotiate.d.mts +0 -35
  115. package/node_modules/@mdream/js/dist/negotiate.mjs +0 -121
  116. package/node_modules/@mdream/js/dist/parse.d.mts +0 -90
  117. package/node_modules/@mdream/js/dist/parse.mjs +0 -2
  118. package/node_modules/@mdream/js/dist/plugins.d.mts +0 -85
  119. package/node_modules/@mdream/js/dist/plugins.mjs +0 -2
  120. package/node_modules/@mdream/js/dist/preset/minimal.d.mts +0 -2
  121. package/node_modules/@mdream/js/dist/preset/minimal.mjs +0 -33
  122. package/node_modules/@mdream/js/dist/splitter.d.mts +0 -18
  123. package/node_modules/@mdream/js/dist/splitter.mjs +0 -194
  124. package/node_modules/@mdream/js/package.json +0 -103
  125. package/node_modules/cac/LICENSE +0 -21
  126. package/node_modules/cac/README.md +0 -492
  127. package/node_modules/cac/dist/index.d.ts +0 -196
  128. package/node_modules/cac/dist/index.js +0 -638
  129. package/node_modules/cac/package.json +0 -72
  130. package/node_modules/mdream/LICENSE.md +0 -9
  131. package/node_modules/mdream/README.md +0 -1091
  132. package/node_modules/mdream/bin/mdream.mjs +0 -46
  133. package/node_modules/mdream/dist/browser.d.mts +0 -105
  134. package/node_modules/mdream/dist/browser.mjs +0 -262
  135. package/node_modules/mdream/dist/edge.d.mts +0 -100
  136. package/node_modules/mdream/dist/edge.mjs +0 -250
  137. package/node_modules/mdream/dist/iife.js +0 -605
  138. package/node_modules/mdream/dist/index.d.mts +0 -89
  139. package/node_modules/mdream/dist/index.mjs +0 -184
  140. package/node_modules/mdream/dist/wasm.d.mts +0 -100
  141. package/node_modules/mdream/dist/wasm.mjs +0 -140
  142. package/node_modules/mdream/dist/worker.d.mts +0 -101
  143. package/node_modules/mdream/dist/worker.mjs +0 -217
  144. package/node_modules/mdream/napi/index.d.mts +0 -127
  145. package/node_modules/mdream/napi/index.d.ts +0 -127
  146. package/node_modules/mdream/napi/index.mjs +0 -725
  147. package/node_modules/mdream/napi/rust.android-arm-eabi.node +0 -0
  148. package/node_modules/mdream/napi/rust.android-arm64.node +0 -0
  149. package/node_modules/mdream/napi/rust.darwin-arm64.node +0 -0
  150. package/node_modules/mdream/napi/rust.darwin-x64.node +0 -0
  151. package/node_modules/mdream/napi/rust.freebsd-x64.node +0 -0
  152. package/node_modules/mdream/napi/rust.linux-arm-gnueabihf.node +0 -0
  153. package/node_modules/mdream/napi/rust.linux-arm64-gnu.node +0 -0
  154. package/node_modules/mdream/napi/rust.linux-arm64-musl.node +0 -0
  155. package/node_modules/mdream/napi/rust.linux-x64-gnu.node +0 -0
  156. package/node_modules/mdream/napi/rust.linux-x64-musl.node +0 -0
  157. package/node_modules/mdream/napi/rust.wasi.cjs +0 -2144
  158. package/node_modules/mdream/napi/rust.wasm32-wasi.wasm +0 -0
  159. package/node_modules/mdream/napi/rust.win32-arm64-msvc.node +0 -0
  160. package/node_modules/mdream/napi/rust.win32-x64-msvc.node +0 -0
  161. package/node_modules/mdream/node_modules/@emnapi/core/LICENSE +0 -21
  162. package/node_modules/mdream/node_modules/@emnapi/core/README.md +0 -1
  163. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.d.ts +0 -392
  164. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.full.d.ts +0 -392
  165. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.full.js +0 -8351
  166. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.js +0 -7268
  167. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/async-work.d.ts +0 -5
  168. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/async-work.js +0 -843
  169. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/index.d.ts +0 -4
  170. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/index.js +0 -3
  171. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/threadsafe-function.d.ts +0 -5
  172. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/threadsafe-function.js +0 -1010
  173. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/v8.d.ts +0 -5
  174. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/v8.js +0 -1446
  175. package/node_modules/mdream/node_modules/@emnapi/core/package.json +0 -39
  176. package/node_modules/mdream/node_modules/@emnapi/core/rollup.config.js +0 -60
  177. package/node_modules/mdream/node_modules/@emnapi/runtime/LICENSE +0 -21
  178. package/node_modules/mdream/node_modules/@emnapi/runtime/README.md +0 -1
  179. package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.d.ts +0 -833
  180. package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.js +0 -2306
  181. package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.js.map +0 -1
  182. package/node_modules/mdream/node_modules/@emnapi/runtime/index.cjs +0 -63
  183. package/node_modules/mdream/node_modules/@emnapi/runtime/package.json +0 -39
  184. package/node_modules/mdream/node_modules/@emnapi/runtime/rollup.config.js +0 -25
  185. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/LICENSE +0 -21
  186. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/README.md +0 -203
  187. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.ts +0 -236
  188. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js +0 -1086
  189. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/package.json +0 -35
  190. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/rollup.config.js +0 -6
  191. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/emnapi-plugins.cjs +0 -1472
  192. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/emnapi-plugins.js +0 -1470
  193. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/fs-proxy.cjs +0 -237
  194. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/fs.js +0 -18260
  195. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/fs-proxy.js +0 -317
  196. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/package.json +0 -67
  197. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/runtime.cjs +0 -39
  198. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/runtime.js +0 -36
  199. package/node_modules/mdream/node_modules/@tybys/wasm-util/LICENSE +0 -21
  200. package/node_modules/mdream/node_modules/@tybys/wasm-util/README.md +0 -193
  201. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/tsdoc-metadata.json +0 -11
  202. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.d.ts +0 -423
  203. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm-bundler.js +0 -2932
  204. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm.js +0 -2932
  205. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm.min.js +0 -1
  206. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.js +0 -2954
  207. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.min.js +0 -1
  208. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/asyncify.js +0 -158
  209. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/index.js +0 -13
  210. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/jspi.js +0 -46
  211. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/load.js +0 -97
  212. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/memory.js +0 -35
  213. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/error.js +0 -103
  214. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/fd.js +0 -268
  215. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/fs.js +0 -3
  216. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/index.js +0 -192
  217. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/path.js +0 -316
  218. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/preview1.js +0 -1599
  219. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/rights.js +0 -141
  220. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/types.js +0 -220
  221. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/util.js +0 -128
  222. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/webassembly.js +0 -13
  223. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/asyncify.mjs +0 -153
  224. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/index.mjs +0 -9
  225. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/jspi.mjs +0 -39
  226. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/load.mjs +0 -89
  227. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/memory.mjs +0 -28
  228. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/error.mjs +0 -97
  229. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/fd.mjs +0 -256
  230. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/fs.mjs +0 -1
  231. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/index.mjs +0 -186
  232. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/path.mjs +0 -310
  233. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/preview1.mjs +0 -1593
  234. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/rights.mjs +0 -135
  235. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/types.mjs +0 -216
  236. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/util.mjs +0 -113
  237. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/webassembly.mjs +0 -9
  238. package/node_modules/mdream/node_modules/@tybys/wasm-util/package.json +0 -58
  239. package/node_modules/mdream/node_modules/tslib/CopyrightNotice.txt +0 -15
  240. package/node_modules/mdream/node_modules/tslib/LICENSE.txt +0 -12
  241. package/node_modules/mdream/node_modules/tslib/README.md +0 -164
  242. package/node_modules/mdream/node_modules/tslib/SECURITY.md +0 -41
  243. package/node_modules/mdream/node_modules/tslib/modules/index.d.ts +0 -38
  244. package/node_modules/mdream/node_modules/tslib/modules/index.js +0 -70
  245. package/node_modules/mdream/node_modules/tslib/modules/package.json +0 -3
  246. package/node_modules/mdream/node_modules/tslib/package.json +0 -47
  247. package/node_modules/mdream/node_modules/tslib/tslib.d.ts +0 -460
  248. package/node_modules/mdream/node_modules/tslib/tslib.es6.html +0 -1
  249. package/node_modules/mdream/node_modules/tslib/tslib.es6.js +0 -402
  250. package/node_modules/mdream/node_modules/tslib/tslib.es6.mjs +0 -401
  251. package/node_modules/mdream/node_modules/tslib/tslib.html +0 -1
  252. package/node_modules/mdream/node_modules/tslib/tslib.js +0 -484
  253. package/node_modules/mdream/package.json +0 -110
  254. package/node_modules/mdream/skills/mdream/SKILL.md +0 -124
  255. package/node_modules/mdream/skills/mdream/references/runtimes.md +0 -49
  256. package/node_modules/mdream/wasm/mdream_edge.d.ts +0 -90
  257. package/node_modules/mdream/wasm/mdream_edge.js +0 -517
  258. package/node_modules/mdream/wasm/mdream_edge_bg.wasm +0 -0
  259. package/node_modules/mdream/wasm/mdream_edge_bg.wasm.d.ts +0 -20
  260. package/node_modules/mdream/wasm/package.json +0 -17
  261. package/node_modules/mdream/wasm-bundler/mdream_edge.d.ts +0 -45
  262. package/node_modules/mdream/wasm-bundler/mdream_edge.js +0 -13
  263. package/node_modules/mdream/wasm-bundler/mdream_edge_bg.js +0 -413
  264. package/node_modules/mdream/wasm-bundler/mdream_edge_bg.wasm +0 -0
  265. package/node_modules/mdream/wasm-bundler/mdream_edge_bg.wasm.d.ts +0 -20
  266. package/node_modules/mdream/wasm-bundler/package.json +0 -19
  267. package/node_modules/pathe/LICENSE +0 -70
  268. package/node_modules/pathe/README.md +0 -73
  269. package/node_modules/pathe/dist/index.cjs +0 -39
  270. package/node_modules/pathe/dist/index.d.cts +0 -47
  271. package/node_modules/pathe/dist/index.d.mts +0 -47
  272. package/node_modules/pathe/dist/index.d.ts +0 -47
  273. package/node_modules/pathe/dist/index.mjs +0 -19
  274. package/node_modules/pathe/dist/shared/pathe.BSlhyZSM.cjs +0 -266
  275. package/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +0 -249
  276. package/node_modules/pathe/dist/utils.cjs +0 -82
  277. package/node_modules/pathe/dist/utils.d.cts +0 -32
  278. package/node_modules/pathe/dist/utils.d.mts +0 -32
  279. package/node_modules/pathe/dist/utils.d.ts +0 -32
  280. package/node_modules/pathe/dist/utils.mjs +0 -77
  281. package/node_modules/pathe/package.json +0 -61
  282. package/node_modules/pathe/utils.d.ts +0 -1
@@ -1,6 +1,7 @@
1
- export const CONTENT_NEGOTIATION_VARY = "Accept, Sec-Fetch-Dest, User-Agent";
2
- const NEGOTIATION_CACHE_HEADERS = CONTENT_NEGOTIATION_VARY.split(",").map((header) => header.trim().toLowerCase());
3
- function cachesWithoutNegotiationVariation(cache) {
1
+ export function getContentNegotiationVary(botNegotiation = false) {
2
+ return botNegotiation ? "Accept, Sec-Fetch-Dest, User-Agent" : "Accept";
3
+ }
4
+ function cachesWithoutNegotiationVariation(cache, botNegotiation) {
4
5
  if (!cache)
5
6
  return false;
6
7
  if (typeof cache !== "object")
@@ -8,16 +9,16 @@ function cachesWithoutNegotiationVariation(cache) {
8
9
  if (cache.headersOnly)
9
10
  return false;
10
11
  const varies = new Set(cache.varies?.map((header) => header.toLowerCase()));
11
- return NEGOTIATION_CACHE_HEADERS.some((header) => !varies.has(header));
12
+ return getContentNegotiationVary(botNegotiation).split(",").some((header) => !varies.has(header.trim().toLowerCase()));
12
13
  }
13
14
  export function resolveContentNegotiation(input) {
14
15
  if (input.policy === "enabled")
15
- return { _tag: "enabled", source: "explicit" };
16
+ return { _tag: "enabled", source: "explicit", vary: getContentNegotiationVary(input.botNegotiation) };
16
17
  if (input.policy === "disabled")
17
18
  return { _tag: "disabled", source: "explicit" };
18
19
  if (input.routeRule.isr)
19
20
  return { _tag: "disabled", source: "isr" };
20
- if (cachesWithoutNegotiationVariation(input.routeRule.cache))
21
+ if (cachesWithoutNegotiationVariation(input.routeRule.cache, input.botNegotiation === true))
21
22
  return { _tag: "disabled", source: "route-cache" };
22
- return { _tag: "enabled", source: "default" };
23
+ return { _tag: "enabled", source: "default", vary: getContentNegotiationVary(input.botNegotiation) };
23
24
  }
@@ -1,4 +1,4 @@
1
- import type { H3Event } from '#nuxtseo/h3';
1
+ import type { AiReadyDatabaseEvent } from '../db/context.js';
2
2
  export interface UniversalContext {
3
3
  /** Site URL from nuxt-site-config */
4
4
  siteUrl: string | undefined;
@@ -10,8 +10,8 @@ export interface UniversalContext {
10
10
  * In request context: uses H3Event and nuxt-site-config middleware
11
11
  * In scheduled task: rebuilds from build-time site-config stack
12
12
  */
13
- export declare function createUniversalContext(event: H3Event | undefined): UniversalContext;
13
+ export declare function createUniversalContext(event: AiReadyDatabaseEvent | undefined): UniversalContext;
14
14
  /**
15
15
  * Get site URL from context, throwing if not configured
16
16
  */
17
- export declare function requireSiteUrl(event: H3Event | undefined): string;
17
+ export declare function requireSiteUrl(event: AiReadyDatabaseEvent | undefined): string;
@@ -1,7 +1,7 @@
1
1
  import { createSiteConfigStack } from "site-config-stack";
2
2
  import { useRuntimeConfig } from "#nuxtseo/nitro";
3
3
  export function createUniversalContext(event) {
4
- const runtimeConfig = useRuntimeConfig(event);
4
+ const runtimeConfig = useRuntimeConfig();
5
5
  let siteUrl = runtimeConfig.site?.url || runtimeConfig.public?.site?.url;
6
6
  if (!siteUrl) {
7
7
  const siteConfigRuntime = runtimeConfig["nuxt-site-config"];
@@ -4,6 +4,8 @@ export interface AiCatalog {
4
4
  specVersion: '1.0';
5
5
  entries: Array<{
6
6
  identifier: string;
7
+ displayName: string;
8
+ description?: string;
7
9
  type: typeof MCP_SERVER_CARD_MEDIA_TYPE;
8
10
  url: string;
9
11
  }>;
@@ -16,8 +16,10 @@ interface LinkHeaderConfig {
16
16
  describedby?: boolean;
17
17
  i18n?: RuntimeI18nConfig | null;
18
18
  }
19
- /**
20
- * Build a comma-joined Link header value with the standard alternates plus i18n hreflang variants.
21
- */
22
19
  export declare function buildLinkHeader(path: string, variant: 'html' | 'markdown', config: LinkHeaderConfig, resolveUrl?: LinkUrlResolver, routeContext?: RuntimeRouteContext): string;
20
+ /** Resolve request-specific URLs once for both success and error responses. */
21
+ export declare function buildStatusAwareLinkHeaders(path: string, variant: 'html' | 'markdown', config: LinkHeaderConfig, resolveUrl?: LinkUrlResolver, routeContext?: RuntimeRouteContext): {
22
+ error: string;
23
+ success: string;
24
+ };
23
25
  export {};
@@ -14,7 +14,7 @@ function resolveHeaderUrl(path, resolveUrl) {
14
14
  return path;
15
15
  }
16
16
  }
17
- export function buildLinkHeader(path, variant, config, resolveUrl, routeContext = {}) {
17
+ function buildBaseParts(path, variant, config, resolveUrl) {
18
18
  const parts = [];
19
19
  if (variant === "html") {
20
20
  const href = resolveHeaderUrl(toMarkdownPath(path), resolveUrl);
@@ -28,6 +28,9 @@ export function buildLinkHeader(path, variant, config, resolveUrl, routeContext
28
28
  const href = resolveHeaderUrl(LLMS_TXT_PATH, resolveUrl);
29
29
  parts.push(`<${encodePathForHeader(href)}>; rel="describedby"`);
30
30
  }
31
+ return parts;
32
+ }
33
+ function appendLocaleParts(parts, path, variant, config, resolveUrl, routeContext) {
31
34
  if (config.i18n) {
32
35
  const alternates = computeLocaleAlternates(path, config.i18n, routeContext);
33
36
  for (const alt of alternates) {
@@ -39,8 +42,29 @@ export function buildLinkHeader(path, variant, config, resolveUrl, routeContext
39
42
  parts.push(`<${encodePathForHeader(href)}>; rel="alternate"; hreflang="${alt.hreflang}"`);
40
43
  }
41
44
  }
45
+ }
46
+ function appendCatalogPart(parts, config) {
42
47
  if (config.apiCatalog) {
43
- parts.push(`<${encodePathForHeader(config.apiCatalog.href)}>; rel="api-catalog"`);
48
+ const catalog = `<${encodePathForHeader(config.apiCatalog.href)}>; rel="api-catalog"`;
49
+ parts.push(catalog);
50
+ return catalog;
44
51
  }
52
+ }
53
+ export function buildLinkHeader(path, variant, config, resolveUrl, routeContext = {}) {
54
+ const parts = buildBaseParts(path, variant, config, resolveUrl);
55
+ appendLocaleParts(parts, path, variant, config, resolveUrl, routeContext);
56
+ appendCatalogPart(parts, config);
45
57
  return parts.join(", ");
46
58
  }
59
+ export function buildStatusAwareLinkHeaders(path, variant, config, resolveUrl, routeContext = {}) {
60
+ const parts = buildBaseParts(path, variant, config, resolveUrl);
61
+ const safeParts = parts.slice();
62
+ const catalog = appendCatalogPart(safeParts, config);
63
+ const error = safeParts.join(", ");
64
+ if (!config.i18n)
65
+ return { error, success: error };
66
+ appendLocaleParts(parts, path, variant, config, resolveUrl, routeContext);
67
+ if (catalog)
68
+ parts.push(catalog);
69
+ return { error, success: parts.join(", ") };
70
+ }
@@ -13,11 +13,12 @@ export interface MarkdownRequest {
13
13
  isPrerender: boolean;
14
14
  }
15
15
  export declare function toMarkdownRequest(event: H3Event, isPrerender?: boolean): MarkdownRequest;
16
- export declare function negotiateRequestRepresentation(request: MarkdownRequest): ContentNegotiationResult;
17
- export declare function negotiateRepresentation(event: H3Event): ContentNegotiationResult;
16
+ export declare function negotiateRequestRepresentation(request: MarkdownRequest, botNegotiation?: boolean): ContentNegotiationResult;
17
+ export declare function negotiateRepresentation(event: H3Event, botNegotiation?: boolean): ContentNegotiationResult;
18
18
  export type MarkdownRequestMode = {
19
19
  _tag: 'runtime';
20
20
  contentNegotiation: boolean;
21
+ botNegotiation?: boolean;
21
22
  } | {
22
23
  _tag: 'prerender';
23
24
  };
@@ -30,4 +31,4 @@ export type MarkdownRenderInfo = {
30
31
  } | null;
31
32
  export declare function getRequestRenderInfo(request: MarkdownRequest, mode?: MarkdownRequestMode): MarkdownRenderInfo;
32
33
  export declare function getMarkdownRenderInfo(event: H3Event, mode?: MarkdownRequestMode): MarkdownRenderInfo;
33
- export declare function clientPrefersMarkdown(event: H3Event): boolean;
34
+ export declare function clientPrefersMarkdown(event: H3Event, botNegotiation?: boolean): boolean;
@@ -1,4 +1,4 @@
1
- import { negotiateContent } from "@mdream/js/negotiate";
1
+ import { negotiateContent, parseAcceptHeader } from "@mdream/js/negotiate";
2
2
  import { getBotInfo } from "@nuxtjs/robots/util";
3
3
  import { getHeaders } from "#nuxtseo/h3";
4
4
  import { isReservedPath } from "../../markdown-path.js";
@@ -6,22 +6,24 @@ const RE_MD_EXT = /\.md$/;
6
6
  export function toMarkdownRequest(event, isPrerender = !!import.meta.prerender) {
7
7
  return { path: event.path, headers: getHeaders(event), isPrerender };
8
8
  }
9
- export function negotiateRequestRepresentation(request) {
9
+ export function negotiateRequestRepresentation(request, botNegotiation = false) {
10
10
  if (request.isPrerender || request.headers["x-nitro-prerender"])
11
11
  return "html";
12
12
  const accept = request.headers.accept;
13
- const secFetchDest = request.headers["sec-fetch-dest"];
14
- if (negotiateContent(accept) === "markdown")
15
- return "markdown";
16
- if (secFetchDest === "document")
17
- return "html";
13
+ const preference = negotiateContent(accept);
14
+ if (!botNegotiation || preference !== "html" || request.headers["sec-fetch-dest"] === "document")
15
+ return preference;
16
+ const entries = parseAcceptHeader(accept?.toLowerCase() || "");
17
+ const matching = ["text/markdown", "text/*", "*/*"].map((type) => entries.filter((entry) => entry.type === type)).find((group) => group.length > 0);
18
+ if (matching && matching.every((entry) => entry.q === 0))
19
+ return preference;
18
20
  const botInfo = getBotInfo(request.headers);
19
21
  if (botInfo?.category === "ai")
20
22
  return "markdown";
21
- return negotiateContent(accept, secFetchDest);
23
+ return preference;
22
24
  }
23
- export function negotiateRepresentation(event) {
24
- return negotiateRequestRepresentation(toMarkdownRequest(event));
25
+ export function negotiateRepresentation(event, botNegotiation = false) {
26
+ return negotiateRequestRepresentation(toMarkdownRequest(event), botNegotiation);
25
27
  }
26
28
  export function getRequestRenderInfo(request, mode = { _tag: "runtime", contentNegotiation: true }) {
27
29
  const queryIndex = request.path.indexOf("?");
@@ -41,7 +43,7 @@ export function getRequestRenderInfo(request, mode = { _tag: "runtime", contentN
41
43
  const extension = hasExtension ? lastSegment.substring(lastSegment.lastIndexOf(".")) : "";
42
44
  if (hasExtension && extension !== ".md")
43
45
  return null;
44
- const negotiation = isPrerender ? "markdown" : mode.contentNegotiation ? negotiateRequestRepresentation(request) : "html";
46
+ const negotiation = isPrerender ? "markdown" : mode.contentNegotiation ? negotiateRequestRepresentation(request, mode.botNegotiation) : "html";
45
47
  if (isExplicit) {
46
48
  const path = normalizePath(originalPath.slice(0, -3));
47
49
  return { path, isExplicit: true, negotiation: "markdown" };
@@ -58,6 +60,6 @@ function normalizePath(path) {
58
60
  return path.slice(0, -5) || "/";
59
61
  return path;
60
62
  }
61
- export function clientPrefersMarkdown(event) {
62
- return negotiateRepresentation(event) === "markdown";
63
+ export function clientPrefersMarkdown(event, botNegotiation = false) {
64
+ return negotiateRepresentation(event, botNegotiation) === "markdown";
63
65
  }
@@ -1,6 +1,7 @@
1
1
  import type { ContentNegotiationPolicy } from '../../types.js';
2
2
  import type { ContentNegotiationResolution, NegotiationRouteRule } from './content-negotiation.js';
3
3
  import type { MarkdownRequest } from './markdown-request.js';
4
+ import { getContentNegotiationVary } from './content-negotiation.js';
4
5
  /** Marks an internal HTML fetch that must bypass content negotiation. */
5
6
  export declare const INTERNAL_HEADER = "x-ai-ready-internal";
6
7
  /**
@@ -13,6 +14,7 @@ export interface NegotiationInput {
13
14
  request: MarkdownRequest;
14
15
  routeRule: NegotiationRouteRule;
15
16
  policy: ContentNegotiationPolicy;
17
+ botNegotiation?: boolean;
16
18
  /**
17
19
  * Routes that already serve a Markdown file verbatim, such as an agent skill
18
20
  * alias. They are answered by their own handler, never rendered.
@@ -24,6 +26,7 @@ export type NegotiationDecision = {
24
26
  reason: 'well-known' | 'internal' | 'artifact' | 'not-a-page' | 'deferred';
25
27
  } | {
26
28
  _tag: 'not-acceptable';
29
+ vary: ReturnType<typeof getContentNegotiationVary>;
27
30
  } | {
28
31
  _tag: 'html';
29
32
  path: string;
@@ -31,6 +34,7 @@ export type NegotiationDecision = {
31
34
  } | {
32
35
  _tag: 'redirect';
33
36
  path: string;
37
+ vary: ReturnType<typeof getContentNegotiationVary>;
34
38
  } | {
35
39
  _tag: 'render';
36
40
  path: string;
@@ -1,4 +1,4 @@
1
- import { resolveContentNegotiation } from "./content-negotiation.js";
1
+ import { getContentNegotiationVary, resolveContentNegotiation } from "./content-negotiation.js";
2
2
  import { getRequestRenderInfo } from "./markdown-request.js";
3
3
  export const INTERNAL_HEADER = "x-ai-ready-internal";
4
4
  export function resolveNegotiationDecision(input) {
@@ -10,20 +10,21 @@ export function resolveNegotiationDecision(input) {
10
10
  return { _tag: "skip", reason: "artifact" };
11
11
  if (request.headers[INTERNAL_HEADER])
12
12
  return { _tag: "skip", reason: "internal" };
13
- const negotiation = resolveContentNegotiation({ policy: input.policy, routeRule: input.routeRule });
13
+ const negotiation = resolveContentNegotiation({ policy: input.policy, routeRule: input.routeRule, botNegotiation: input.botNegotiation });
14
14
  const renderInfo = getRequestRenderInfo(request, {
15
15
  _tag: "runtime",
16
- contentNegotiation: negotiation._tag === "enabled"
16
+ contentNegotiation: negotiation._tag === "enabled",
17
+ botNegotiation: input.botNegotiation
17
18
  });
18
19
  if (!renderInfo)
19
20
  return { _tag: "skip", reason: "not-a-page" };
20
21
  if ("notAcceptable" in renderInfo)
21
- return { _tag: "not-acceptable" };
22
+ return { _tag: "not-acceptable", vary: getContentNegotiationVary(input.botNegotiation) };
22
23
  if (renderInfo.isExplicit) {
23
24
  return stage === "early" ? { _tag: "skip", reason: "deferred" } : { _tag: "render", path: renderInfo.path };
24
25
  }
25
26
  if (renderInfo.negotiation === "markdown")
26
- return { _tag: "redirect", path: renderInfo.path };
27
+ return { _tag: "redirect", path: renderInfo.path, vary: getContentNegotiationVary(input.botNegotiation) };
27
28
  return { _tag: "html", path: renderInfo.path, negotiation };
28
29
  }
29
30
  function withoutQuery(path) {
@@ -17,7 +17,7 @@ type NegotiationResponse = Awaited<ReturnType<typeof sendRedirect>> | undefined;
17
17
  export declare function setLinkHeader(event: H3Event, ctx: NegotiationContext, variant: 'html' | 'markdown'): void;
18
18
  export declare function setStatusAwareHeader(event: H3Event, ctx: NegotiationContext, variant: 'html' | 'markdown'): void;
19
19
  export declare function setUncacheableHeaders(event: H3Event): void;
20
- export declare function setMarkdownHeaders(event: H3Event, ctx: NegotiationContext): void;
20
+ export declare function setMarkdownHeaders(event: H3Event, ctx: NegotiationContext, sourceHeaders?: Headers): void;
21
21
  /**
22
22
  * Site config is set up by a Nitro middleware. The early negotiation handler
23
23
  * runs in front of that middleware, so it must run the setup itself before it
@@ -1,14 +1,14 @@
1
1
  import { createNitroRouteRuleMatcher } from "nuxtseo-shared/server";
2
2
  import { localAgentSkillArtifacts } from "#ai-ready-virtual/agent-skills.mjs";
3
- import { appendHeader, createError, getRequestHost, getResponseHeader, sendRedirect, setHeader } from "#nuxtseo/h3";
3
+ import { appendHeader, createError, getHeader, getRequestHost, getRequestURL, getResponseHeader, sendRedirect, setHeader } from "#nuxtseo/h3";
4
4
  import { useRuntimeConfig } from "#nuxtseo/nitro";
5
- import { withSiteUrl } from "#site-config/server/composables/utils";
6
- import initSiteConfig from "#site-config/server/middleware/init";
5
+ import * as siteConfigUtils from "#site-config/server/composables/utils";
6
+ import { initRequestSiteConfig } from "#site-config/server/init";
7
+ import { mergeVaryHeader } from "../../cache-control.js";
7
8
  import { toMarkdownPath } from "../../markdown-path.js";
8
9
  import { toDeployedRoute } from "../../route-path.js";
9
10
  import { setStatusAwareLinkHeader } from "../plugins/link-header.js";
10
- import { CONTENT_NEGOTIATION_VARY } from "./content-negotiation.js";
11
- import { buildLinkHeader } from "./link-header.js";
11
+ import { buildLinkHeader, buildStatusAwareLinkHeaders } from "./link-header.js";
12
12
  import { toMarkdownRequest } from "./markdown-request.js";
13
13
  import { resolveNegotiationDecision } from "./negotiation-decision.js";
14
14
  const APPLIED_KEY = "nuxt-ai-ready:negotiation-applied";
@@ -17,17 +17,25 @@ export function agentSkillArtifactPaths() {
17
17
  artifactPaths ??= new Set(Object.keys(localAgentSkillArtifacts));
18
18
  return artifactPaths;
19
19
  }
20
+ function createHeaderUrlResolver(event, ctx) {
21
+ if (!siteConfigUtils.createSitePathResolver)
22
+ return ctx.resolveUrl;
23
+ let resolveUrl;
24
+ return (path) => {
25
+ resolveUrl ??= siteConfigUtils.createSitePathResolver(event, { absolute: true, withBase: true });
26
+ return resolveUrl(ctx.resolvePath(path));
27
+ };
28
+ }
20
29
  export function setLinkHeader(event, ctx, variant) {
21
- setHeader(event, "link", buildLinkHeader(ctx.path, variant, ctx.config, ctx.resolveUrl, ctx.routeContext));
30
+ setHeader(event, "link", buildLinkHeader(ctx.path, variant, ctx.config, createHeaderUrlResolver(event, ctx), ctx.routeContext));
22
31
  }
23
32
  export function setStatusAwareHeader(event, ctx, variant) {
24
- const successHeader = buildLinkHeader(ctx.path, variant, ctx.config, ctx.resolveUrl, ctx.routeContext);
25
33
  if (!ctx.config.i18n) {
26
- setHeader(event, "link", successHeader);
34
+ setLinkHeader(event, ctx, variant);
27
35
  return;
28
36
  }
29
- const safeHeader = buildLinkHeader(ctx.path, variant, { ...ctx.config, i18n: null }, ctx.resolveUrl, ctx.routeContext);
30
- setStatusAwareLinkHeader(event, safeHeader, successHeader);
37
+ const headers = buildStatusAwareLinkHeaders(ctx.path, variant, ctx.config, createHeaderUrlResolver(event, ctx), ctx.routeContext);
38
+ setStatusAwareLinkHeader(event, headers.error, headers.success);
31
39
  }
32
40
  export function setUncacheableHeaders(event) {
33
41
  setHeader(event, "cache-control", "private, no-store");
@@ -42,9 +50,26 @@ export function setUncacheableHeaders(event) {
42
50
  setHeader(event, header, "no-store");
43
51
  }
44
52
  }
45
- export function setMarkdownHeaders(event, ctx) {
53
+ export function setMarkdownHeaders(event, ctx, sourceHeaders) {
46
54
  setHeader(event, "content-type", "text/markdown; charset=utf-8");
55
+ const vary = [getResponseHeader(event, "vary"), sourceHeaders?.get("vary")].filter(Boolean).join(", ");
56
+ setHeader(event, "vary", mergeVaryHeader(vary, "Accept"));
47
57
  setLinkHeader(event, ctx, "markdown");
58
+ const privateResponse = [
59
+ "cache-control",
60
+ "cdn-cache-control",
61
+ "cloudflare-cdn-cache-control",
62
+ "netlify-cdn-cache-control",
63
+ "vercel-cdn-cache-control",
64
+ "surrogate-control"
65
+ ].some((header) => {
66
+ const value = `${getResponseHeader(event, header) || ""},${sourceHeaders?.get(header) || ""}`;
67
+ return /(?:^|,)\s*(?:private|no-store|no-cache)\s*(?:,|=|$)/i.test(value);
68
+ });
69
+ if (getHeader(event, "cookie") || getHeader(event, "authorization") || getResponseHeader(event, "set-cookie") || sourceHeaders?.has("set-cookie") || privateResponse) {
70
+ setUncacheableHeaders(event);
71
+ return;
72
+ }
48
73
  const cacheHeaders = ctx.config.markdownCacheHeaders;
49
74
  if (cacheHeaders) {
50
75
  const { maxAge, swr } = cacheHeaders;
@@ -53,7 +78,7 @@ export function setMarkdownHeaders(event, ctx) {
53
78
  }
54
79
  export async function ensureSiteConfig(event) {
55
80
  if (!event.context._initedSiteConfig)
56
- await initSiteConfig(event);
81
+ await initRequestSiteConfig(event, getRequestURL(event, { xForwardedHost: true, xForwardedProto: true }).origin, createNitroRouteRuleMatcher(useRuntimeConfig(event))(event.path));
57
82
  }
58
83
  export function buildNegotiationContext(event, path) {
59
84
  const runtimeConfig = useRuntimeConfig(event);
@@ -63,10 +88,11 @@ export function buildNegotiationContext(event, path) {
63
88
  config: runtimeConfig["nuxt-ai-ready"],
64
89
  path,
65
90
  resolvePath,
66
- resolveUrl: (target) => withSiteUrl(event, resolvePath(target)),
91
+ resolveUrl: (target) => siteConfigUtils.withSiteUrl(event, resolvePath(target), { withBase: true }),
67
92
  routeContext: { host: getRequestHost(event, { xForwardedHost: true }) }
68
93
  };
69
94
  }
95
+ const REQUEST_DECISION = Symbol("nuxt-ai-ready:negotiation");
70
96
  let matcherCache;
71
97
  function getRouteRuleMatcher(runtimeConfig) {
72
98
  if (matcherCache?.config !== runtimeConfig)
@@ -76,13 +102,27 @@ function getRouteRuleMatcher(runtimeConfig) {
76
102
  export function decideNegotiation(event, stage) {
77
103
  const runtimeConfig = useRuntimeConfig(event);
78
104
  const config = runtimeConfig["nuxt-ai-ready"];
79
- return resolveNegotiationDecision({
80
- stage,
81
- request: toMarkdownRequest(event),
82
- routeRule: getRouteRuleMatcher(runtimeConfig)(event.path),
83
- policy: config.contentNegotiation,
84
- artifactPaths: agentSkillArtifactPaths()
85
- });
105
+ const context = event.context;
106
+ const owner = event.node?.req ?? event.req ?? event;
107
+ let cached = context[REQUEST_DECISION];
108
+ if (!cached || cached.owner !== owner || cached.path !== event.path || cached.policy !== config.contentNegotiation || cached.botNegotiation !== config.botNegotiation) {
109
+ cached = {
110
+ owner,
111
+ path: event.path,
112
+ policy: config.contentNegotiation,
113
+ botNegotiation: config.botNegotiation,
114
+ decision: resolveNegotiationDecision({
115
+ stage: "middleware",
116
+ request: toMarkdownRequest(event),
117
+ routeRule: getRouteRuleMatcher(runtimeConfig)(event.path),
118
+ policy: config.contentNegotiation,
119
+ botNegotiation: config.botNegotiation,
120
+ artifactPaths: agentSkillArtifactPaths()
121
+ })
122
+ };
123
+ context[REQUEST_DECISION] = cached;
124
+ }
125
+ return stage === "early" && cached.decision._tag === "render" ? { _tag: "skip", reason: "deferred" } : cached.decision;
86
126
  }
87
127
  export async function applyNegotiation(event, decision) {
88
128
  if (decision._tag === "skip" || decision._tag === "render")
@@ -92,7 +132,7 @@ export async function applyNegotiation(event, decision) {
92
132
  return;
93
133
  context[APPLIED_KEY] = true;
94
134
  if (decision._tag === "not-acceptable") {
95
- appendHeader(event, "vary", CONTENT_NEGOTIATION_VARY);
135
+ appendHeader(event, "vary", decision.vary);
96
136
  setUncacheableHeaders(event);
97
137
  throw createError({
98
138
  statusCode: 406,
@@ -104,11 +144,11 @@ export async function applyNegotiation(event, decision) {
104
144
  const ctx = buildNegotiationContext(event, decision.path);
105
145
  if (decision._tag === "html") {
106
146
  if (decision.negotiation._tag === "enabled")
107
- appendHeader(event, "vary", CONTENT_NEGOTIATION_VARY);
147
+ appendHeader(event, "vary", decision.negotiation.vary);
108
148
  setStatusAwareHeader(event, ctx, "html");
109
149
  return;
110
150
  }
111
- appendHeader(event, "vary", CONTENT_NEGOTIATION_VARY);
151
+ appendHeader(event, "vary", decision.vary);
112
152
  setLinkHeader(event, ctx, "html");
113
153
  setUncacheableHeaders(event);
114
154
  return sendRedirect(event, ctx.resolvePath(toMarkdownPath(decision.path)), 307);
@@ -1,2 +1,3 @@
1
- export declare function storePrerenderedHtml(path: string, html: string): void;
1
+ import type { NuxtRenderHTMLContext } from 'nuxt/app';
2
+ export declare function storePrerenderedHtml(path: string, html: string | NuxtRenderHTMLContext): void;
2
3
  export declare function consumePrerenderedHtml(path: string): string | undefined;
@@ -9,5 +9,7 @@ export function consumePrerenderedHtml(path) {
9
9
  const key = normalizeHtmlCachePath(path);
10
10
  const html = htmlByPath.get(key);
11
11
  htmlByPath.delete(key);
12
- return html;
12
+ if (!html || typeof html === "string")
13
+ return html;
14
+ return `<!DOCTYPE html><html ${html.htmlAttrs.join(" ")}><head>${html.head.join("")}</head><body ${html.bodyAttrs.join(" ")}>${html.bodyPrepend.join("")}${html.body.join("")}${html.bodyAppend.join("")}</body></html>`;
13
15
  }
@@ -76,11 +76,10 @@ export interface AgentSkillsConfig {
76
76
  */
77
77
  skills?: AgentSkillConfig[];
78
78
  /**
79
- * Directory scanned for `<name>/SKILL.md` in the project root and in every
80
- * layer inside it. Each match is published as a local skill and also served
81
- * at `/<dir>/<name>/SKILL.md`, mirroring the repository path. `false` turns
82
- * discovery off.
83
- * @default 'skills'
79
+ * Explicit directory scanned for `<name>/SKILL.md` in the project root and its layers.
80
+ * By default, only `skills/<name>/SKILL.md` inside their resolved public directories is discovered.
81
+ * Public skills are also served at `/skills/<name>/SKILL.md`.
82
+ * An explicit directory uses `/<dir>/<name>/SKILL.md`. `false` disables discovery.
84
83
  */
85
84
  dir?: string | false;
86
85
  /**
@@ -129,12 +128,21 @@ export interface ModuleOptions {
129
128
  */
130
129
  debug?: boolean;
131
130
  /**
132
- * Negotiate Markdown on HTML routes through Accept and User-Agent headers.
131
+ * Negotiate Markdown on HTML routes through Accept headers.
133
132
  * Disable when a deployment cache cannot vary responses by request headers.
134
133
  * Explicit .md routes remain available.
134
+ * On Cloudflare Workers, true also routes prerendered HTML through the Worker.
135
+ * Automatic negotiation preserves the existing Cloudflare asset routing.
135
136
  * @default Automatic per route
136
137
  */
137
138
  contentNegotiation?: boolean;
139
+ /**
140
+ * Offer Markdown to AI bots even when their Accept header prefers HTML.
141
+ * Requires cache variation on Accept, Sec-Fetch-Dest, and User-Agent.
142
+ * Disable to avoid fragmenting caches by raw User-Agent strings.
143
+ * @default false
144
+ */
145
+ botNegotiation?: boolean;
138
146
  /**
139
147
  * Publish an RFC 9727 API Catalog at `/.well-known/api-catalog`.
140
148
  * Relative entry URLs resolve against the configured site URL and app base URL.
@@ -286,7 +294,7 @@ export interface ModuleOptions {
286
294
  /**
287
295
  * Database type - auto-detected if not specified
288
296
  * - 'none': No database. Build time generation only.
289
- * - 'sqlite': Local SQLite via node:sqlite or better-sqlite3 (default for Node.js)
297
+ * - 'sqlite': Local SQLite via node:sqlite (default for Node.js)
290
298
  * - 'd1': Cloudflare D1 (auto-detected on Cloudflare)
291
299
  * - 'bun': Bun SQLite via bun:sqlite (auto-detected on Bun) [experimental]
292
300
  * - 'libsql': Turso/LibSQL [experimental]
@@ -0,0 +1,29 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { readFile } from 'node:fs/promises';
3
+ import { findPackageJSON } from 'node:module';
4
+ import { isAbsolute, join } from 'node:path';
5
+ import { pathToFileURL } from 'node:url';
6
+
7
+ function resolvePackageMetadataPath(specifier, base, options) {
8
+ if (options) {
9
+ const candidate = join(options.searchDirectory, specifier, "package.json");
10
+ if (existsSync(candidate))
11
+ return candidate;
12
+ }
13
+ const input = isAbsolute(specifier) ? pathToFileURL(specifier) : specifier;
14
+ const path = findPackageJSON(input, base && pathToFileURL(join(base, "package.json")));
15
+ if (!path)
16
+ throw new Error(`Could not find package metadata for ${specifier}.`);
17
+ return path;
18
+ }
19
+ async function readPackageMetadata(specifier, base, options) {
20
+ const metadata = JSON.parse(await readFile(resolvePackageMetadataPath(specifier, base, options), "utf8"));
21
+ if (typeof metadata !== "object" || metadata === null)
22
+ throw new Error(`Invalid package metadata for ${specifier}.`);
23
+ const version = "version" in metadata ? metadata.version : void 0;
24
+ const peers = "peerDependencies" in metadata ? metadata.peerDependencies : void 0;
25
+ const peerDependencies = typeof peers === "object" && peers !== null ? Object.fromEntries(Object.entries(peers).filter((entry) => typeof entry[1] === "string")) : {};
26
+ return typeof version === "string" ? { version, peerDependencies } : { peerDependencies };
27
+ }
28
+
29
+ export { resolvePackageMetadataPath as a, readPackageMetadata as r };