@kayjs/kay 1.107.0 → 1.109.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 (576) hide show
  1. package/dist/eslint.js +1875 -3815
  2. package/editors/zed/extension.toml +2 -2
  3. package/llms/action-protection.md +1 -1
  4. package/llms/actions-from-islands.md +5 -5
  5. package/llms/actions-refused-fields.md +4 -4
  6. package/llms/api-from-islands.md +6 -6
  7. package/llms/browser-only.md +2 -2
  8. package/llms/cdn-caching.md +1 -1
  9. package/llms/checks.md +1 -1
  10. package/llms/code-lints.md +1 -2
  11. package/llms/component-libraries.md +1 -1
  12. package/llms/component-library-conventions.md +1 -1
  13. package/llms/components.md +4 -4
  14. package/llms/deprecated-lints.md +1 -7
  15. package/llms/effects.md +1 -1
  16. package/llms/errors.md +2 -2
  17. package/llms/events.md +1 -1
  18. package/llms/guards.md +1 -1
  19. package/llms/head.md +1 -1
  20. package/llms/hooks.md +2 -2
  21. package/llms/images.md +1 -1
  22. package/llms/island-and-form-lints.md +2 -1
  23. package/llms/island-sources.md +1 -1
  24. package/llms/islands-state-to-ids.md +2 -2
  25. package/llms/islands.md +5 -3
  26. package/llms/lints.md +1 -1
  27. package/llms/live-values.md +3 -3
  28. package/llms/local-collections.md +1 -1
  29. package/llms/locales.md +1 -1
  30. package/llms/mcp.md +2 -2
  31. package/llms/metrics.md +1 -1
  32. package/llms/navigation-from-code.md +6 -6
  33. package/llms/prerendering.md +1 -0
  34. package/llms/production.md +2 -2
  35. package/llms/project-new-and-add.md +1 -1
  36. package/llms/project.md +4 -4
  37. package/llms/proxy-and-security.md +1 -1
  38. package/llms/queues.md +1 -1
  39. package/llms/rate-limits.md +4 -4
  40. package/llms/rendering.md +1 -1
  41. package/llms/server-islands.md +2 -2
  42. package/llms/server.md +1 -1
  43. package/llms/stores.md +1 -1
  44. package/llms/styles-and-assets.md +1 -1
  45. package/llms/testing-mount.md +49 -0
  46. package/llms/testing.md +4 -45
  47. package/llms/upgrading-1-105-config.md +13 -13
  48. package/llms/upgrading-archive.md +42 -82
  49. package/llms/upgrading.md +92 -58
  50. package/llms/whats-new-archive.md +36 -1
  51. package/llms/whats-new.md +18 -39
  52. package/llms.txt +6 -7
  53. package/package.json +6 -10
  54. package/src/build/client.ts +7 -6
  55. package/src/build/icon-slots.ts +140 -0
  56. package/src/build/libraries.ts +24 -2
  57. package/src/build/plugin.ts +10 -0
  58. package/src/build/route-sizes.ts +2 -3
  59. package/src/build/runtime-chunk.ts +2 -2
  60. package/src/build/source-files.ts +8 -3
  61. package/src/build/variants.ts +90 -1
  62. package/src/check/browser-global-reads.ts +2 -2
  63. package/src/check/config-objects.ts +1 -1
  64. package/src/check/diagnose.ts +0 -22
  65. package/src/check/export-homes.ts +1 -1
  66. package/src/check/guards.ts +3 -3
  67. package/src/check/index.ts +2 -7
  68. package/src/check/moved-keys.ts +1 -1
  69. package/src/check/project.ts +4 -9
  70. package/src/check/renamed-packages.ts +3 -63
  71. package/src/check/shadow-types.ts +4 -104
  72. package/src/commands/check.ts +2 -2
  73. package/src/commands/env.ts +25 -3
  74. package/src/compiler/ast.ts +18 -16
  75. package/src/compiler/browser.ts +2 -14
  76. package/src/compiler/class-items.ts +16 -0
  77. package/src/compiler/codegen.ts +8 -8
  78. package/src/compiler/dead-code.ts +22 -0
  79. package/src/compiler/deprecated-library.ts +0 -12
  80. package/src/compiler/deprecated-lints.ts +4 -505
  81. package/src/compiler/deprecated-ui-props.ts +5 -5
  82. package/src/compiler/dom-property.ts +23 -0
  83. package/src/compiler/dom.ts +15 -15
  84. package/src/compiler/errors.ts +2 -2
  85. package/src/compiler/fence-checks.ts +2 -121
  86. package/src/compiler/hand-parts.ts +55 -0
  87. package/src/compiler/helper-imports.ts +2 -2
  88. package/src/compiler/image-attributes.ts +1 -3
  89. package/src/compiler/index.ts +20 -21
  90. package/src/compiler/island-arguments.ts +8 -95
  91. package/src/compiler/island-cause.ts +7 -7
  92. package/src/compiler/island-declaration.ts +2 -8
  93. package/src/compiler/island-lints.ts +12 -0
  94. package/src/compiler/island-marker.ts +3 -3
  95. package/src/compiler/island-problems.ts +25 -0
  96. package/src/compiler/jsx-class.ts +1 -25
  97. package/src/compiler/jsx.ts +2 -2
  98. package/src/compiler/kay-exports.ts +0 -2
  99. package/src/compiler/link-flags.ts +9 -38
  100. package/src/compiler/lints.ts +7 -14
  101. package/src/compiler/markup.ts +23 -26
  102. package/src/compiler/module-signals.ts +2 -2
  103. package/src/compiler/names.ts +1 -1
  104. package/src/compiler/page-settings.ts +11 -0
  105. package/src/compiler/parser.ts +6 -8
  106. package/src/compiler/plan.ts +1 -3
  107. package/src/compiler/rewrite.ts +3 -18
  108. package/src/compiler/script-server.ts +8 -3
  109. package/src/compiler/validate.ts +3 -8
  110. package/src/config-loader.ts +14 -4
  111. package/src/config-resolve.ts +18 -142
  112. package/src/config-shape.ts +44 -34
  113. package/src/config.ts +10 -114
  114. package/src/dev/preload.ts +4 -1
  115. package/src/lsp/server.ts +4 -0
  116. package/src/migrate/markup.ts +4 -1
  117. package/src/package-names.ts +1 -1
  118. package/src/runtime/action-call.ts +39 -335
  119. package/src/runtime/action-encode.ts +26 -0
  120. package/src/runtime/action-error.ts +3 -11
  121. package/src/runtime/action-protection.ts +2 -2
  122. package/src/runtime/action-run.ts +332 -0
  123. package/src/runtime/action-shared.ts +14 -37
  124. package/src/runtime/action-stream.ts +0 -1
  125. package/src/runtime/action.ts +1 -1
  126. package/src/runtime/call-result.ts +2 -10
  127. package/src/runtime/checks.ts +11 -11
  128. package/src/runtime/client.ts +2 -2
  129. package/src/runtime/core.ts +5 -23
  130. package/src/runtime/dom.ts +1 -1
  131. package/src/runtime/html.ts +1 -1
  132. package/src/runtime/i18n.client.ts +1 -4
  133. package/src/runtime/i18n.server.ts +1 -4
  134. package/src/runtime/i18n.ts +3 -3
  135. package/src/runtime/index.ts +2 -2
  136. package/src/runtime/island.server.ts +18 -5
  137. package/src/runtime/live-resource.server.ts +0 -1
  138. package/src/runtime/live-value.server.ts +2 -2
  139. package/src/runtime/live-value.shared.ts +7 -20
  140. package/src/runtime/live.ts +1 -12
  141. package/src/runtime/local-types.ts +1 -11
  142. package/src/runtime/local.ts +4 -14
  143. package/src/runtime/navigate-api.ts +2 -5
  144. package/src/runtime/navigation-state.ts +0 -12
  145. package/src/runtime/page-swap.ts +6 -6
  146. package/src/runtime/persist.ts +11 -3
  147. package/src/runtime/persisted.ts +4 -30
  148. package/src/runtime/presence.ts +6 -7
  149. package/src/runtime/query-param.ts +20 -12
  150. package/src/runtime/reactive.ts +3 -1
  151. package/src/runtime/refuse.ts +3 -17
  152. package/src/runtime/store-base.ts +4 -6
  153. package/src/runtime/swap-fetch.ts +1 -1
  154. package/src/runtime/values.ts +40 -23
  155. package/src/runtime/with-query.ts +9 -0
  156. package/src/server/action-hooks.ts +8 -8
  157. package/src/server/actions.ts +13 -14
  158. package/src/server/api-modules.ts +2 -3
  159. package/src/server/app-stages.ts +15 -33
  160. package/src/server/app.ts +10 -5
  161. package/src/server/auth-mails.ts +0 -2
  162. package/src/server/env-state.ts +40 -10
  163. package/src/server/flash.ts +1 -1
  164. package/src/server/guard-requirement.ts +4 -4
  165. package/src/server/image.ts +2 -2
  166. package/src/server/index.ts +0 -2
  167. package/src/server/job-context.ts +3 -3
  168. package/src/server/jobs-page.ts +1 -1
  169. package/src/server/jobs.ts +5 -9
  170. package/src/server/kept-exports.ts +0 -2
  171. package/src/server/kv.ts +11 -14
  172. package/src/server/library.ts +1 -3
  173. package/src/server/live.ts +2 -2
  174. package/src/server/mcp.ts +3 -9
  175. package/src/server/metrics.ts +2 -4
  176. package/src/server/page-settings.ts +10 -19
  177. package/src/server/prerender.ts +19 -2
  178. package/src/server/protection.ts +15 -18
  179. package/src/server/queue.ts +3 -6
  180. package/src/server/rate-limit.ts +0 -3
  181. package/src/server/render-document.ts +1 -1
  182. package/src/server/routes.ts +7 -3
  183. package/src/server/scope.ts +3 -2
  184. package/src/server/session.ts +5 -6
  185. package/src/server/setup.ts +1 -1
  186. package/src/server/signals.ts +17 -7
  187. package/src/server/signed.ts +1 -3
  188. package/src/server/source.ts +20 -4
  189. package/src/server/speculation.ts +1 -1
  190. package/src/server/storage.ts +3 -8
  191. package/src/server/validate.ts +1 -1
  192. package/src/server/vitals.ts +1 -3
  193. package/src/server/work-scope.ts +2 -4
  194. package/src/server/work.ts +1 -1
  195. package/src/server/workflow.ts +1 -1
  196. package/src/test/index.ts +2 -1
  197. package/src/test/site-actions.ts +16 -6
  198. package/src/test/site-keys.ts +10 -15
  199. package/src/test/site-socket.ts +1 -2
  200. package/src/test/site-types.ts +0 -8
  201. package/types/build/client.d.ts +1 -1
  202. package/types/build/client.d.ts.map +1 -1
  203. package/types/build/icon-slots.d.ts +7 -0
  204. package/types/build/icon-slots.d.ts.map +1 -0
  205. package/types/build/libraries.d.ts +2 -0
  206. package/types/build/libraries.d.ts.map +1 -1
  207. package/types/build/plugin.d.ts +1 -0
  208. package/types/build/plugin.d.ts.map +1 -1
  209. package/types/build/route-sizes.d.ts.map +1 -1
  210. package/types/build/source-files.d.ts.map +1 -1
  211. package/types/build/variants.d.ts.map +1 -1
  212. package/types/check/diagnose.d.ts.map +1 -1
  213. package/types/check/index.d.ts +1 -2
  214. package/types/check/index.d.ts.map +1 -1
  215. package/types/check/project.d.ts.map +1 -1
  216. package/types/check/renamed-packages.d.ts +0 -3
  217. package/types/check/renamed-packages.d.ts.map +1 -1
  218. package/types/check/shadow-types.d.ts.map +1 -1
  219. package/types/commands/env.d.ts.map +1 -1
  220. package/types/compiler/ast.d.ts +1 -2
  221. package/types/compiler/ast.d.ts.map +1 -1
  222. package/types/compiler/browser.d.ts.map +1 -1
  223. package/types/compiler/class-items.d.ts +7 -0
  224. package/types/compiler/class-items.d.ts.map +1 -0
  225. package/types/compiler/dead-code.d.ts +9 -0
  226. package/types/compiler/dead-code.d.ts.map +1 -0
  227. package/types/compiler/deprecated-library.d.ts.map +1 -1
  228. package/types/compiler/deprecated-lints.d.ts +0 -560
  229. package/types/compiler/deprecated-lints.d.ts.map +1 -1
  230. package/types/compiler/deprecated-ui-props.d.ts +1 -8
  231. package/types/compiler/deprecated-ui-props.d.ts.map +1 -1
  232. package/types/compiler/dom-property.d.ts +9 -0
  233. package/types/compiler/dom-property.d.ts.map +1 -0
  234. package/types/compiler/dom.d.ts +1 -0
  235. package/types/compiler/dom.d.ts.map +1 -1
  236. package/types/compiler/errors.d.ts +2 -2
  237. package/types/compiler/errors.d.ts.map +1 -1
  238. package/types/compiler/fence-checks.d.ts +0 -1
  239. package/types/compiler/fence-checks.d.ts.map +1 -1
  240. package/types/compiler/hand-parts.d.ts +7 -0
  241. package/types/compiler/hand-parts.d.ts.map +1 -0
  242. package/types/compiler/image-attributes.d.ts +0 -1
  243. package/types/compiler/image-attributes.d.ts.map +1 -1
  244. package/types/compiler/index.d.ts.map +1 -1
  245. package/types/compiler/island-arguments.d.ts +2 -11
  246. package/types/compiler/island-arguments.d.ts.map +1 -1
  247. package/types/compiler/island-cause.d.ts +1 -1
  248. package/types/compiler/island-cause.d.ts.map +1 -1
  249. package/types/compiler/island-declaration.d.ts +1 -3
  250. package/types/compiler/island-declaration.d.ts.map +1 -1
  251. package/types/compiler/island-lints.d.ts +10 -0
  252. package/types/compiler/island-lints.d.ts.map +1 -0
  253. package/types/compiler/island-problems.d.ts +7 -0
  254. package/types/compiler/island-problems.d.ts.map +1 -0
  255. package/types/compiler/jsx-class.d.ts +1 -2
  256. package/types/compiler/jsx-class.d.ts.map +1 -1
  257. package/types/compiler/kay-exports.d.ts.map +1 -1
  258. package/types/compiler/link-flags.d.ts +0 -6
  259. package/types/compiler/link-flags.d.ts.map +1 -1
  260. package/types/compiler/lints.d.ts +11 -572
  261. package/types/compiler/lints.d.ts.map +1 -1
  262. package/types/compiler/markup.d.ts +1 -1
  263. package/types/compiler/markup.d.ts.map +1 -1
  264. package/types/compiler/module-signals.d.ts.map +1 -1
  265. package/types/compiler/names.d.ts.map +1 -1
  266. package/types/compiler/page-settings.d.ts +4 -0
  267. package/types/compiler/page-settings.d.ts.map +1 -1
  268. package/types/compiler/parser.d.ts.map +1 -1
  269. package/types/compiler/plan.d.ts.map +1 -1
  270. package/types/compiler/script-server.d.ts.map +1 -1
  271. package/types/compiler/validate.d.ts.map +1 -1
  272. package/types/config-loader.d.ts.map +1 -1
  273. package/types/config-resolve.d.ts.map +1 -1
  274. package/types/config-shape.d.ts +1 -1
  275. package/types/config-shape.d.ts.map +1 -1
  276. package/types/config.d.ts +5 -105
  277. package/types/config.d.ts.map +1 -1
  278. package/types/dev/preload.d.ts.map +1 -1
  279. package/types/lsp/server.d.ts.map +1 -1
  280. package/types/migrate/markup.d.ts.map +1 -1
  281. package/types/runtime/action-call.d.ts.map +1 -1
  282. package/types/runtime/action-encode.d.ts +1 -0
  283. package/types/runtime/action-encode.d.ts.map +1 -1
  284. package/types/runtime/action-error.d.ts +1 -2
  285. package/types/runtime/action-error.d.ts.map +1 -1
  286. package/types/runtime/action-run.d.ts +23 -0
  287. package/types/runtime/action-run.d.ts.map +1 -0
  288. package/types/runtime/action-shared.d.ts +1 -27
  289. package/types/runtime/action-shared.d.ts.map +1 -1
  290. package/types/runtime/action-stream.d.ts.map +1 -1
  291. package/types/runtime/action.d.ts +1 -1
  292. package/types/runtime/action.d.ts.map +1 -1
  293. package/types/runtime/call-result.d.ts +0 -10
  294. package/types/runtime/call-result.d.ts.map +1 -1
  295. package/types/runtime/checks.d.ts +6 -9
  296. package/types/runtime/checks.d.ts.map +1 -1
  297. package/types/runtime/core.d.ts +2 -20
  298. package/types/runtime/core.d.ts.map +1 -1
  299. package/types/runtime/dom.d.ts +1 -1
  300. package/types/runtime/dom.d.ts.map +1 -1
  301. package/types/runtime/html.d.ts +1 -1
  302. package/types/runtime/html.d.ts.map +1 -1
  303. package/types/runtime/i18n.client.d.ts +0 -1
  304. package/types/runtime/i18n.client.d.ts.map +1 -1
  305. package/types/runtime/i18n.d.ts +1 -1
  306. package/types/runtime/i18n.d.ts.map +1 -1
  307. package/types/runtime/i18n.server.d.ts +0 -1
  308. package/types/runtime/i18n.server.d.ts.map +1 -1
  309. package/types/runtime/index.d.ts +2 -2
  310. package/types/runtime/index.d.ts.map +1 -1
  311. package/types/runtime/island.server.d.ts +1 -0
  312. package/types/runtime/island.server.d.ts.map +1 -1
  313. package/types/runtime/live-resource.server.d.ts.map +1 -1
  314. package/types/runtime/live-value.shared.d.ts +7 -15
  315. package/types/runtime/live-value.shared.d.ts.map +1 -1
  316. package/types/runtime/live.d.ts +0 -11
  317. package/types/runtime/live.d.ts.map +1 -1
  318. package/types/runtime/local-types.d.ts +0 -14
  319. package/types/runtime/local-types.d.ts.map +1 -1
  320. package/types/runtime/navigate-api.d.ts +0 -4
  321. package/types/runtime/navigate-api.d.ts.map +1 -1
  322. package/types/runtime/navigation-state.d.ts +0 -4
  323. package/types/runtime/navigation-state.d.ts.map +1 -1
  324. package/types/runtime/page-swap.d.ts.map +1 -1
  325. package/types/runtime/persist.d.ts +1 -0
  326. package/types/runtime/persist.d.ts.map +1 -1
  327. package/types/runtime/persisted.d.ts +0 -15
  328. package/types/runtime/persisted.d.ts.map +1 -1
  329. package/types/runtime/presence.d.ts +0 -2
  330. package/types/runtime/presence.d.ts.map +1 -1
  331. package/types/runtime/query-param.d.ts.map +1 -1
  332. package/types/runtime/reactive.d.ts +2 -1
  333. package/types/runtime/reactive.d.ts.map +1 -1
  334. package/types/runtime/refuse.d.ts +0 -7
  335. package/types/runtime/refuse.d.ts.map +1 -1
  336. package/types/runtime/store-base.d.ts +1 -2
  337. package/types/runtime/store-base.d.ts.map +1 -1
  338. package/types/runtime/values.d.ts +2 -1
  339. package/types/runtime/values.d.ts.map +1 -1
  340. package/types/runtime/with-query.d.ts +2 -0
  341. package/types/runtime/with-query.d.ts.map +1 -1
  342. package/types/server/action-hooks.d.ts +4 -4
  343. package/types/server/action-hooks.d.ts.map +1 -1
  344. package/types/server/actions.d.ts.map +1 -1
  345. package/types/server/api-modules.d.ts +0 -1
  346. package/types/server/api-modules.d.ts.map +1 -1
  347. package/types/server/app-stages.d.ts +5 -13
  348. package/types/server/app-stages.d.ts.map +1 -1
  349. package/types/server/app.d.ts +3 -8
  350. package/types/server/app.d.ts.map +1 -1
  351. package/types/server/auth-mails.d.ts +0 -5
  352. package/types/server/auth-mails.d.ts.map +1 -1
  353. package/types/server/env-state.d.ts +1 -0
  354. package/types/server/env-state.d.ts.map +1 -1
  355. package/types/server/guard-requirement.d.ts +0 -1
  356. package/types/server/guard-requirement.d.ts.map +1 -1
  357. package/types/server/image.d.ts +0 -1
  358. package/types/server/image.d.ts.map +1 -1
  359. package/types/server/index.d.ts +0 -2
  360. package/types/server/index.d.ts.map +1 -1
  361. package/types/server/job-context.d.ts +1 -1
  362. package/types/server/job-context.d.ts.map +1 -1
  363. package/types/server/jobs.d.ts +0 -4
  364. package/types/server/jobs.d.ts.map +1 -1
  365. package/types/server/kept-exports.d.ts.map +1 -1
  366. package/types/server/kv.d.ts +4 -4
  367. package/types/server/kv.d.ts.map +1 -1
  368. package/types/server/library.d.ts +1 -3
  369. package/types/server/library.d.ts.map +1 -1
  370. package/types/server/mcp.d.ts +0 -1
  371. package/types/server/mcp.d.ts.map +1 -1
  372. package/types/server/metrics.d.ts +0 -5
  373. package/types/server/metrics.d.ts.map +1 -1
  374. package/types/server/page-settings.d.ts +3 -3
  375. package/types/server/page-settings.d.ts.map +1 -1
  376. package/types/server/prerender.d.ts.map +1 -1
  377. package/types/server/protection.d.ts +6 -6
  378. package/types/server/protection.d.ts.map +1 -1
  379. package/types/server/queue.d.ts +1 -3
  380. package/types/server/queue.d.ts.map +1 -1
  381. package/types/server/rate-limit.d.ts +0 -2
  382. package/types/server/rate-limit.d.ts.map +1 -1
  383. package/types/server/routes.d.ts +1 -1
  384. package/types/server/routes.d.ts.map +1 -1
  385. package/types/server/scope.d.ts.map +1 -1
  386. package/types/server/session.d.ts +1 -1
  387. package/types/server/session.d.ts.map +1 -1
  388. package/types/server/signals.d.ts.map +1 -1
  389. package/types/server/signed.d.ts +0 -2
  390. package/types/server/signed.d.ts.map +1 -1
  391. package/types/server/source.d.ts +1 -1
  392. package/types/server/source.d.ts.map +1 -1
  393. package/types/server/storage.d.ts +0 -4
  394. package/types/server/storage.d.ts.map +1 -1
  395. package/types/server/vitals.d.ts +0 -1
  396. package/types/server/vitals.d.ts.map +1 -1
  397. package/types/server/work-scope.d.ts +0 -2
  398. package/types/server/work-scope.d.ts.map +1 -1
  399. package/types/server/workflow.d.ts +1 -1
  400. package/types/server/workflow.d.ts.map +1 -1
  401. package/types/test/index.d.ts.map +1 -1
  402. package/types/test/site-actions.d.ts +1 -1
  403. package/types/test/site-actions.d.ts.map +1 -1
  404. package/types/test/site-keys.d.ts +1 -1
  405. package/types/test/site-keys.d.ts.map +1 -1
  406. package/types/test/site-socket.d.ts +1 -1
  407. package/types/test/site-socket.d.ts.map +1 -1
  408. package/types/test/site-types.d.ts +0 -8
  409. package/types/test/site-types.d.ts.map +1 -1
  410. package/llms/deprecated-lints-1-105-libraries.md +0 -32
  411. package/llms/deprecated-lints-1-105.md +0 -58
  412. package/src/check/action-readers.ts +0 -115
  413. package/src/check/action-type.ts +0 -44
  414. package/src/check/ai-language.ts +0 -56
  415. package/src/check/app-hooks.ts +0 -90
  416. package/src/check/auth-methods.ts +0 -85
  417. package/src/check/auth-rate-limits.ts +0 -99
  418. package/src/check/call-result.ts +0 -242
  419. package/src/check/client-keys.ts +0 -10
  420. package/src/check/cms-options.ts +0 -81
  421. package/src/check/config-groups.ts +0 -22
  422. package/src/check/config-switches.ts +0 -38
  423. package/src/check/context-import.ts +0 -51
  424. package/src/check/env-files.ts +0 -31
  425. package/src/check/format-duration.ts +0 -75
  426. package/src/check/guard-options.ts +0 -58
  427. package/src/check/handler-events.ts +0 -149
  428. package/src/check/hook-context.ts +0 -94
  429. package/src/check/hook-names.ts +0 -104
  430. package/src/check/i18n-keys.ts +0 -50
  431. package/src/check/images-keys.ts +0 -54
  432. package/src/check/job-shapes.ts +0 -273
  433. package/src/check/link-flag-tests.ts +0 -130
  434. package/src/check/live-api.ts +0 -137
  435. package/src/check/mail-api.ts +0 -67
  436. package/src/check/one-state-api.ts +0 -357
  437. package/src/check/pages-options.ts +0 -35
  438. package/src/check/rate-enforce.ts +0 -53
  439. package/src/check/refusal-calls.ts +0 -185
  440. package/src/check/retired-lints.ts +0 -49
  441. package/src/check/route-keys.ts +0 -166
  442. package/src/check/secret-keys.ts +0 -83
  443. package/src/check/socket-frames.ts +0 -102
  444. package/src/check/source-readers.ts +0 -257
  445. package/src/check/store-ms.ts +0 -72
  446. package/src/check/store-names.ts +0 -88
  447. package/src/check/test-helpers.ts +0 -98
  448. package/src/check/ttl-names.ts +0 -142
  449. package/src/compiler/deprecated-ai-labels.ts +0 -97
  450. package/src/compiler/deprecated-ai-links.ts +0 -63
  451. package/src/compiler/deprecated-allow.ts +0 -50
  452. package/src/compiler/deprecated-auth-lints.ts +0 -14
  453. package/src/compiler/deprecated-auth-signed.ts +0 -29
  454. package/src/compiler/deprecated-children.ts +0 -66
  455. package/src/compiler/deprecated-image.ts +0 -116
  456. package/src/compiler/deprecated-island.ts +0 -155
  457. package/src/compiler/deprecated-lints-1-105.ts +0 -41
  458. package/src/compiler/deprecated-page.ts +0 -125
  459. package/src/compiler/deprecated-parts.ts +0 -22
  460. package/src/compiler/deprecated-typed-lints.ts +0 -23
  461. package/src/compiler/deprecated-ui-callbacks.ts +0 -66
  462. package/src/compiler/deprecated-ui-input.ts +0 -97
  463. package/src/compiler/deprecated-ui-items.ts +0 -47
  464. package/src/compiler/old-parts.ts +0 -84
  465. package/src/runtime/mount.compat.ts +0 -8
  466. package/src/server/moved-exports.ts +0 -17
  467. package/types/check/action-readers.d.ts +0 -3
  468. package/types/check/action-readers.d.ts.map +0 -1
  469. package/types/check/action-type.d.ts +0 -3
  470. package/types/check/action-type.d.ts.map +0 -1
  471. package/types/check/ai-language.d.ts +0 -3
  472. package/types/check/ai-language.d.ts.map +0 -1
  473. package/types/check/app-hooks.d.ts +0 -3
  474. package/types/check/app-hooks.d.ts.map +0 -1
  475. package/types/check/auth-methods.d.ts +0 -3
  476. package/types/check/auth-methods.d.ts.map +0 -1
  477. package/types/check/auth-rate-limits.d.ts +0 -3
  478. package/types/check/auth-rate-limits.d.ts.map +0 -1
  479. package/types/check/call-result.d.ts +0 -7
  480. package/types/check/call-result.d.ts.map +0 -1
  481. package/types/check/client-keys.d.ts +0 -3
  482. package/types/check/client-keys.d.ts.map +0 -1
  483. package/types/check/cms-options.d.ts +0 -3
  484. package/types/check/cms-options.d.ts.map +0 -1
  485. package/types/check/config-groups.d.ts +0 -3
  486. package/types/check/config-groups.d.ts.map +0 -1
  487. package/types/check/config-switches.d.ts +0 -3
  488. package/types/check/config-switches.d.ts.map +0 -1
  489. package/types/check/context-import.d.ts +0 -3
  490. package/types/check/context-import.d.ts.map +0 -1
  491. package/types/check/env-files.d.ts +0 -3
  492. package/types/check/env-files.d.ts.map +0 -1
  493. package/types/check/format-duration.d.ts +0 -5
  494. package/types/check/format-duration.d.ts.map +0 -1
  495. package/types/check/guard-options.d.ts +0 -3
  496. package/types/check/guard-options.d.ts.map +0 -1
  497. package/types/check/handler-events.d.ts +0 -9
  498. package/types/check/handler-events.d.ts.map +0 -1
  499. package/types/check/hook-context.d.ts +0 -3
  500. package/types/check/hook-context.d.ts.map +0 -1
  501. package/types/check/hook-names.d.ts +0 -3
  502. package/types/check/hook-names.d.ts.map +0 -1
  503. package/types/check/i18n-keys.d.ts +0 -3
  504. package/types/check/i18n-keys.d.ts.map +0 -1
  505. package/types/check/images-keys.d.ts +0 -3
  506. package/types/check/images-keys.d.ts.map +0 -1
  507. package/types/check/job-shapes.d.ts +0 -6
  508. package/types/check/job-shapes.d.ts.map +0 -1
  509. package/types/check/link-flag-tests.d.ts +0 -4
  510. package/types/check/link-flag-tests.d.ts.map +0 -1
  511. package/types/check/live-api.d.ts +0 -3
  512. package/types/check/live-api.d.ts.map +0 -1
  513. package/types/check/mail-api.d.ts +0 -3
  514. package/types/check/mail-api.d.ts.map +0 -1
  515. package/types/check/one-state-api.d.ts +0 -9
  516. package/types/check/one-state-api.d.ts.map +0 -1
  517. package/types/check/pages-options.d.ts +0 -3
  518. package/types/check/pages-options.d.ts.map +0 -1
  519. package/types/check/rate-enforce.d.ts +0 -3
  520. package/types/check/rate-enforce.d.ts.map +0 -1
  521. package/types/check/refusal-calls.d.ts +0 -3
  522. package/types/check/refusal-calls.d.ts.map +0 -1
  523. package/types/check/retired-lints.d.ts +0 -3
  524. package/types/check/retired-lints.d.ts.map +0 -1
  525. package/types/check/route-keys.d.ts +0 -3
  526. package/types/check/route-keys.d.ts.map +0 -1
  527. package/types/check/secret-keys.d.ts +0 -3
  528. package/types/check/secret-keys.d.ts.map +0 -1
  529. package/types/check/socket-frames.d.ts +0 -3
  530. package/types/check/socket-frames.d.ts.map +0 -1
  531. package/types/check/source-readers.d.ts +0 -3
  532. package/types/check/source-readers.d.ts.map +0 -1
  533. package/types/check/store-ms.d.ts +0 -3
  534. package/types/check/store-ms.d.ts.map +0 -1
  535. package/types/check/store-names.d.ts +0 -3
  536. package/types/check/store-names.d.ts.map +0 -1
  537. package/types/check/test-helpers.d.ts +0 -3
  538. package/types/check/test-helpers.d.ts.map +0 -1
  539. package/types/check/ttl-names.d.ts +0 -3
  540. package/types/check/ttl-names.d.ts.map +0 -1
  541. package/types/compiler/deprecated-ai-labels.d.ts +0 -5
  542. package/types/compiler/deprecated-ai-labels.d.ts.map +0 -1
  543. package/types/compiler/deprecated-ai-links.d.ts +0 -5
  544. package/types/compiler/deprecated-ai-links.d.ts.map +0 -1
  545. package/types/compiler/deprecated-allow.d.ts +0 -5
  546. package/types/compiler/deprecated-allow.d.ts.map +0 -1
  547. package/types/compiler/deprecated-auth-lints.d.ts +0 -12
  548. package/types/compiler/deprecated-auth-lints.d.ts.map +0 -1
  549. package/types/compiler/deprecated-auth-signed.d.ts +0 -5
  550. package/types/compiler/deprecated-auth-signed.d.ts.map +0 -1
  551. package/types/compiler/deprecated-children.d.ts +0 -4
  552. package/types/compiler/deprecated-children.d.ts.map +0 -1
  553. package/types/compiler/deprecated-image.d.ts +0 -5
  554. package/types/compiler/deprecated-image.d.ts.map +0 -1
  555. package/types/compiler/deprecated-island.d.ts +0 -9
  556. package/types/compiler/deprecated-island.d.ts.map +0 -1
  557. package/types/compiler/deprecated-lints-1-105.d.ts +0 -39
  558. package/types/compiler/deprecated-lints-1-105.d.ts.map +0 -1
  559. package/types/compiler/deprecated-page.d.ts +0 -4
  560. package/types/compiler/deprecated-page.d.ts.map +0 -1
  561. package/types/compiler/deprecated-parts.d.ts +0 -3
  562. package/types/compiler/deprecated-parts.d.ts.map +0 -1
  563. package/types/compiler/deprecated-typed-lints.d.ts +0 -21
  564. package/types/compiler/deprecated-typed-lints.d.ts.map +0 -1
  565. package/types/compiler/deprecated-ui-callbacks.d.ts +0 -5
  566. package/types/compiler/deprecated-ui-callbacks.d.ts.map +0 -1
  567. package/types/compiler/deprecated-ui-input.d.ts +0 -5
  568. package/types/compiler/deprecated-ui-input.d.ts.map +0 -1
  569. package/types/compiler/deprecated-ui-items.d.ts +0 -5
  570. package/types/compiler/deprecated-ui-items.d.ts.map +0 -1
  571. package/types/compiler/old-parts.d.ts +0 -9
  572. package/types/compiler/old-parts.d.ts.map +0 -1
  573. package/types/runtime/mount.compat.d.ts +0 -7
  574. package/types/runtime/mount.compat.d.ts.map +0 -1
  575. package/types/server/moved-exports.d.ts +0 -12
  576. package/types/server/moved-exports.d.ts.map +0 -1
@@ -35,7 +35,7 @@ import { kayLog } from '../runtime/log'
35
35
  import { BUILD_HEADER, DRAFT_ROUTE } from '../runtime/swap'
36
36
  import { registerActionRoutes } from './actions'
37
37
  import { serveApi } from './api'
38
- import { apiPathOf, FORMER_MCP_PATH, mcpInstructions, mcpRateLimit, RESOURCE_METADATA, sharedGuards } from './api-modules'
38
+ import { apiPathOf, mcpInstructions, mcpRateLimit, RESOURCE_METADATA, sharedGuards } from './api-modules'
39
39
  import { hookLifecycle, hookRequests } from './app-hooks'
40
40
  import { rebaseCss, rebaseRedirects } from './base'
41
41
  import { DEFAULT_BODY_LIMIT, limitBodies, mountLimits } from './body'
@@ -66,7 +66,7 @@ import { liveConnections, serveLive } from './live'
66
66
  import { warnOfLocalFiles } from './local-files'
67
67
  import { announceStart, loggerOf, logRequests, pathOf, requestRefusalLogger, useLogger } from './log'
68
68
  import { mcpBodyLimit, receiveDispatched, serveMcp, serveToolCallsThrough } from './mcp'
69
- import { FORMER_METRICS_PATH, METRICS_PATH, metricsOf, serveMetrics } from './metrics'
69
+ import { METRICS_PATH, metricsOf, serveMetrics } from './metrics'
70
70
  import { newTabStyles } from './new-tab'
71
71
  import { countMissing, knowRedirects } from './not-found'
72
72
  import { INSTALL_OFFER, serveServiceWorker } from './offline'
@@ -178,15 +178,10 @@ interface BootInput {
178
178
  late: LateApp
179
179
  mcpAt: string | undefined
180
180
  mcpKey: string | false | undefined
181
- // What `requireGuards` came to once the routes were scanned.
181
+ // What `guards.default` came to once the routes were scanned.
182
182
  required: GuardRequirement
183
183
  }
184
184
 
185
- // The paths a request for the MCP endpoint may come in at: its own, and the former one while it redirects.
186
- function mcpEndpoints(at: string | undefined, former: Claim | undefined, served: ServedPaths): string[] {
187
- return [...at === undefined ? [] : [at], ...former !== undefined && served.holds(former) ? [former.path] : []]
188
- }
189
-
190
185
  // What every stage shares, worked out from the setup before the first hook.
191
186
  export function bootOf(input: BootInput) {
192
187
  const { env, project: { config: options }, setup: { client, scripts, styles, locales } } = input
@@ -199,10 +194,6 @@ export function bootOf(input: BootInput) {
199
194
  // Offered, so an app file at the path keeps it; only a running server counts, as `kay dev` restarts on every change and an export serves nothing.
200
195
  const metricsConfig = env.serving ? metricsOf(options.ops?.metrics) : undefined
201
196
  const metrics: Claim | undefined = metricsConfig && { path: options.endpoints?.metrics ?? METRICS_PATH, owner: 'the metrics route', kind: 'kay' }
202
- // Where the MCP endpoint was served before 1.105, answered in place until 2.0 by an app that did not move it, unless an app file serves something there.
203
- const formerMcp: Claim | undefined = input.mcpAt !== undefined && options.endpoints?.mcp === undefined ? { path: FORMER_MCP_PATH, owner: '`mcp`', kind: 'kay', method: 'ALL' } : undefined
204
- // Where the metrics were served before 1.105, answered as well until 1.108 by an app that did not move them, unless an app file serves something there.
205
- const formerMetrics: Claim | undefined = metrics && options.endpoints?.metrics === undefined ? { path: FORMER_METRICS_PATH, owner: 'the metrics route', kind: 'kay' } : undefined
206
197
  // Offered, so an app file at the path keeps it; the check is served once every claim is in, and only where it still holds the path.
207
198
  const health: Claim | undefined = options.ops?.health === false ? undefined : { path: options.endpoints?.health ?? HEALTH_PATH, owner: 'the health check', kind: 'kay' }
208
199
  const log = loggerOf(options.ops?.observe?.log, env.production)
@@ -222,9 +213,6 @@ export function bootOf(input: BootInput) {
222
213
  lifecycle: { draining: false },
223
214
  hasPreview: options.preview !== undefined && options.preview !== false,
224
215
  metrics,
225
- formerMetrics,
226
- // Where the MCP endpoint was served before 1.105, answered as the endpoint is until 2.0 by an app that did not move it, unless an app file serves something there.
227
- formerMcp,
228
216
  health,
229
217
  registered,
230
218
  // Maps a browser's stack back to the source, for the error reports and the dev tool.
@@ -270,9 +258,8 @@ export function knowPages({ app, env, options, setup: { matchers }, routes, tabl
270
258
  }
271
259
 
272
260
  // Only a kept page reads the count, so a build keeping none registers no hook for it.
273
- export function keptPageWrites({ app, setup: { client }, mcpAt, formerMcp, served }: Boot): Writes {
274
- // The former path is exempt only where kay serves it: a route of the app at `/mcp` keeps counting.
275
- const own = () => [...mcpAt === undefined ? [] : [mcpAt], ...formerMcp !== undefined && served.holds(formerMcp) ? [formerMcp.path] : []]
261
+ export function keptPageWrites({ app, setup: { client }, mcpAt }: Boot): Writes {
262
+ const own = () => mcpAt === undefined ? [] : [mcpAt]
276
263
 
277
264
  return [...client.pages.values()].some(page => page.kept === true) ? countWrites(app, own) : NO_WRITES
278
265
  }
@@ -310,7 +297,7 @@ function hostsToAnswer(setting: SecurityConfig | boolean | undefined, site: stri
310
297
 
311
298
  // Who the request is from and whether it may come, as the steps of `receive`: the proxy it came through, the server's own mark, the proxy key, the dev hosts, the hosts; then the security headers on every answer.
312
299
  // The steps run in kay's pipeline, which Elysia's first `onRequest` hook hands every request to while the routes are not on kay's table.
313
- export function trustRequests({ app, kay, env, options, project, served, security, filePaths, setup, mcpAt, mcpKey, metrics, formerMetrics, formerMcp, log, health }: Boot): void {
300
+ export function trustRequests({ app, kay, env, options, project, served, security, filePaths, setup, mcpAt, mcpKey, metrics, log, health }: Boot): void {
314
301
  const { receive } = kay.pipeline.phases
315
302
 
316
303
  setRequestIdHeader(options.ops?.observe?.requestIdHeader)
@@ -321,7 +308,7 @@ export function trustRequests({ app, kay, env, options, project, served, securit
321
308
  receiveInternal(request)
322
309
  })
323
310
 
324
- const key = requireProxyKey(checkProxy(options.proxy), { root: setup.source.runtimeRoot(project.root), dev: env.dev, exported: env.exported, base: env.base, health: health?.path, endpoint: mcpKey === undefined ? undefined : () => mcpEndpoints(mcpAt, formerMcp, served), metrics: () => [metrics, formerMetrics].flatMap(claim => claim !== undefined && served.holds(claim) ? [claim.path] : []), logRefused: requestRefusalLogger(log), security })
311
+ const key = requireProxyKey(checkProxy(options.proxy), { root: setup.source.runtimeRoot(project.root), dev: env.dev, exported: env.exported, base: env.base, health: health?.path, endpoint: mcpKey === undefined ? undefined : () => mcpAt === undefined ? [] : [mcpAt], metrics: () => metrics !== undefined && served.holds(metrics) ? [metrics.path] : [], logRefused: requestRefusalLogger(log), security })
325
312
  const foreign = refuseForeignHosts(setup.site, security)
326
313
  const hosts = hostsToAnswer(options.security, setup.site, env)
327
314
 
@@ -407,7 +394,7 @@ export function identifyRequests({ app, env, setup: { client } }: Boot): void {
407
394
  }
408
395
 
409
396
  // kay's endpoints answered ahead of the extensions: the health check, the metrics and the public env, with the jobs page's path claimed. Returns the jobs page, served after the extensions whose values its guard reads.
410
- export function kayEndpoints({ app, env, options, project, setup, served, lifecycle, health, metrics, formerMetrics, security }: Boot, publicModules: string[]) {
397
+ export function kayEndpoints({ app, env, options, project, setup, served, lifecycle, health, metrics, security }: Boot, publicModules: string[]) {
411
398
  if (health) {
412
399
  served.offer(health)
413
400
  // Before the extension servers, whose hooks it answers ahead of; it answers only where the claims, known once all are in, leave it the path.
@@ -423,10 +410,7 @@ export function kayEndpoints({ app, env, options, project, setup, served, lifecy
423
410
  if (metrics) {
424
411
  served.offer(metrics)
425
412
 
426
- if (formerMetrics)
427
- served.offer(formerMetrics)
428
-
429
- serveMetrics(app, { root: setup.source.runtimeRoot(project.root), path: metrics.path, base: env.base, proxy: checkProxy(options.proxy), token: metricsOf(options.ops?.metrics)?.token, health: health?.path, holds: () => served.holds(metrics), former: formerMetrics && { path: formerMetrics.path, holds: () => served.holds(formerMetrics) }, connections: liveConnections })
413
+ serveMetrics(app, { root: setup.source.runtimeRoot(project.root), path: metrics.path, base: env.base, proxy: checkProxy(options.proxy), token: metricsOf(options.ops?.metrics)?.token, health: health?.path, holds: () => served.holds(metrics), connections: liveConnections })
430
414
  }
431
415
 
432
416
  if (options.publicEnv)
@@ -591,7 +575,7 @@ type Served = Awaited<ReturnType<typeof appRoutes>>
591
575
  // The rules a redirect added while the site runs is checked against, the API's claims and the body limits of every route. Returns where the OpenAPI document and the MCP metadata go.
592
576
  // Not async, as the closures the runtime redirects keep past the app would hold an async function's parameters, the app among them.
593
577
  export function limitBodiesAndClaimApi(boot: Boot, { actionLimits, api, endpointLimits }: Served, servers: unknown[]) {
594
- const { app, env, options, served, setup: { client }, table, hasPreview, mcpAt, formerMcp } = boot
578
+ const { app, env, options, served, setup: { client }, table, hasPreview, mcpAt } = boot
595
579
  // Claimed before kay's own files, which give way to them.
596
580
  const openapi = openApiSettings(options.openapi)
597
581
  const apiAt = apiPathOf(options.endpoints?.api)
@@ -618,15 +602,13 @@ export function limitBodiesAndClaimApi(boot: Boot, { actionLimits, api, endpoint
618
602
  }
619
603
  }
620
604
 
621
- const formerAt = formerMcp && served.offer(formerMcp) ? formerMcp.path : undefined
622
-
623
- limitBodies(app, options.limits?.body ?? DEFAULT_BODY_LIMIT, new Map([...actionLimits, ...hasPreview ? [[DRAFT_ROUTE, DRAFT_BODY_LIMIT] as const] : [], ...mcpAt === undefined ? [] : [[mcpAt, mcpBodyLimit] as const], ...formerAt === undefined ? [] : [[formerAt, mcpBodyLimit] as const]]), mountLimits(api.limits, options.extensions, options.limits?.byPath, servers), [...api.routeLimits, ...endpointLimits])
605
+ limitBodies(app, options.limits?.body ?? DEFAULT_BODY_LIMIT, new Map([...actionLimits, ...hasPreview ? [[DRAFT_ROUTE, DRAFT_BODY_LIMIT] as const] : [], ...mcpAt === undefined ? [] : [[mcpAt, mcpBodyLimit] as const]]), mountLimits(api.limits, options.extensions, options.limits?.byPath, servers), [...api.routeLimits, ...endpointLimits])
624
606
 
625
- return { openapi, apiAt, servesOpenApi, metadataPaths, formerAt }
607
+ return { openapi, apiAt, servesOpenApi, metadataPaths }
626
608
  }
627
609
 
628
610
  // The OpenAPI document and the MCP endpoint, registered last before the pages.
629
- export async function apiDocuments(boot: Boot, { toolActions, apiModules, api }: Served, actionOptions: ActionOptions, { openapi, apiAt, servesOpenApi, metadataPaths, formerAt }: ReturnType<typeof limitBodiesAndClaimApi>): Promise<void> {
611
+ export async function apiDocuments(boot: Boot, { toolActions, apiModules, api }: Served, actionOptions: ActionOptions, { openapi, apiAt, servesOpenApi, metadataPaths }: ReturnType<typeof limitBodiesAndClaimApi>): Promise<void> {
630
612
  const { app, env, options, required, setup: { locales }, project: { paths }, mcpAt, mcpKey } = boot
631
613
 
632
614
  // The actions that opted in to being tools are in the document beside the routes, and the MCP endpoint reads its tools from it.
@@ -642,7 +624,7 @@ export async function apiDocuments(boot: Boot, { toolActions, apiModules, api }:
642
624
  serveOpenApi(app, document, openapi, await covering(false), actionOptions, apiAt, options.endpoints?.openapi)
643
625
 
644
626
  if (mcpAt !== undefined && document) {
645
- serveMcp(app, document, { title: (document.info as { title: string }).title, version: (document.info as { version: string }).version, base: env.base, guards: await covering(true), actions: actionOptions, metadataPaths, path: mcpAt, former: formerAt, rateLimit: mcpRateLimit(options.mcp), instructions: mcpInstructions(options.mcp), key: mcpKey, dev: env.dev, outputs: actionOptions.toolOutputs })
627
+ serveMcp(app, document, { title: (document.info as { title: string }).title, version: (document.info as { version: string }).version, base: env.base, guards: await covering(true), actions: actionOptions, metadataPaths, path: mcpAt, rateLimit: mcpRateLimit(options.mcp), instructions: mcpInstructions(options.mcp), key: mcpKey, dev: env.dev, outputs: actionOptions.toolOutputs })
646
628
  }
647
629
  }
648
630
 
@@ -665,7 +647,7 @@ export function reports({ app, options, setup: { i18n, site, collections }, hasP
665
647
  // The paths the config names resolve where the server runs, and development serves WebP, so a page's first load does not wait on AVIF encoding.
666
648
  // What `images.resolve` runs behind: the `guards` given, none when they are `false`, and a refusal when the app gave none, as every feature reading private files closes.
667
649
  function imageGuard(images: NonNullable<KayConfig['assets']>['images']): Guard | undefined {
668
- const given = images?.guards ?? images?.guard
650
+ const given = images?.guards
669
651
 
670
652
  if (given === false)
671
653
  return undefined
package/src/server/app.ts CHANGED
@@ -12,6 +12,7 @@ import type { Scanned } from './setup'
12
12
  import { join } from 'node:path'
13
13
  import { Elysia } from 'elysia'
14
14
  import { KayError } from '../compiler/errors'
15
+ import { CONFIG_KEYS } from '../config-shape'
15
16
  import { refuseFeedsWithoutSite } from '../content/server'
16
17
  import { mcpInstructions, mcpPath, mcpRateLimit } from './api-modules'
17
18
  import { actionOptionsOf, apiDocuments, appRoutes, bootOf, bootWarnings, buildFiles, compressAnswers, files, hookLifecycleOf, hookRequestsOf, identifyRequests, kayEndpoints, keptPageWrites, knowPages, lateApp, limitBodiesAndClaimApi, logAnswers, pageRoutes, reports, rewriteAnswers, serveDevRoutes, serverMode, siteFiles, stopOnSignals, trustRequests, useExtensions } from './app-stages'
@@ -38,8 +39,8 @@ import { ServedPaths } from './served-paths'
38
39
  import { setupPages } from './setup'
39
40
  import { projectSource } from './source'
40
41
 
41
- // The options of `pages()` and `testSite()`: `config` holds what wins over the project's `kay.config.ts`, key by key, one bag level deep. The config's keys written beside `root` instead work until 1.108, as `deprecated-pages-options` rewrites them.
42
- export interface PagesOptions extends ConfigInput {
42
+ // The options of `pages()` and `testSite()`: `config` holds what wins over the project's `kay.config.ts`, key by key, one bag level deep.
43
+ export interface PagesOptions {
43
44
  // Config laid over the project's `kay.config.ts`, as `kay.config.ts` writes it: `pages({ config: { client: { navigation: false } } })`.
44
45
  config?: ConfigInput | undefined
45
46
  // Project root: island ids and `.kay/` output are relative to it. Defaults to the working directory.
@@ -50,9 +51,13 @@ export interface PagesOptions extends ConfigInput {
50
51
  prebuilt?: boolean | undefined
51
52
  }
52
53
 
53
- // The options with the keys of `config` laid over those written beside it, the way an app wrote them before 1.105, so what reads the options sees the config's keys at one level; a key given in both is the one of `config`.
54
- export function flatOptions<Options extends PagesOptions>(options: Options): Omit<Options, 'config'> {
54
+ // The options with the keys of `config` laid at one level beside the others, so what reads the options sees the config's keys together. A config key written beside `root` is refused.
55
+ export function flatOptions<Options extends PagesOptions>(options: Options): Omit<Options, 'config'> & ConfigInput {
55
56
  const { config, ...rest } = options
57
+ const beside = Object.keys(rest).filter(key => CONFIG_KEYS.has(key))
58
+
59
+ if (beside.length > 0)
60
+ throw new KayError('config-invalid', `kay: the options have config keys beside \`root\`: ${beside.map(key => `\`${key}\``).join(', ')}; write them in \`config\``)
56
61
 
57
62
  return config === undefined ? rest : { ...rest, ...Object.fromEntries(Object.entries(config).filter(([, value]) => value !== undefined)) }
58
63
  }
@@ -182,7 +187,7 @@ export async function pagesApp(project: Project<ServedOptions>, loadClient: () =
182
187
  const setup = await setupPages(project, loadClient, false, late.spell, scanned => refuseScanned(project, scanned), exported)
183
188
  const { served, table, publicServed, redirects, mcpAt } = setup.claimed
184
189
 
185
- // The API modules are read here, as an unset `requireGuards` comes to what the app's own routes, endpoints and API modules guard.
190
+ // The API modules are read here, as an unset `guards.default` comes to what the app's own routes, endpoints and API modules guard.
186
191
  const required = guardRequirement(requiredBy(options), setup.routes, setup.endpoints, await setup.api)
187
192
  const routes = await servedRoutes(setup.routes, setup.claimed.routes, required)
188
193
  const app = new Elysia({ name: 'kay/pages', seed: root })
@@ -21,8 +21,6 @@ export interface AuthMailData {
21
21
  locale: string
22
22
  // How long the mail's link and its code work, for the ones it carries, as durations: `{ link: '24h', code: '10m' }`. `lifetime(duration, locale)` words them.
23
23
  ttl?: { link?: Duration, code?: Duration } | undefined
24
- /** @deprecated Written `ttl`; `deprecated-ttl-names` rewrites it. Removed in 1.108. */
25
- maxAge?: { link?: Duration, code?: Duration } | undefined
26
24
  }
27
25
 
28
26
  const LINK = 'https://example.com/auth?token=sample'
@@ -1,13 +1,18 @@
1
- import { existsSync, readFileSync, statSync } from 'node:fs'
2
- import { dirname, join } from 'node:path'
1
+ import { existsSync, readFileSync, realpathSync, statSync } from 'node:fs'
2
+ import { dirname, join, sep } from 'node:path'
3
3
 
4
4
  // What the environment loader and the commands that run without it share, apart from `./env` so `kay check` and the editor load no Elysia.
5
5
  // On the global object, so a copy of kay the app loads beside the CLI's sees it too.
6
6
  const BUILDING = Symbol.for('kay.building')
7
+ const LISTED = Symbol.for('kay.envListed')
7
8
 
8
9
  // `kay build` renders pages, and `kay check` reads content and messages, without the server's environment: from then on a variable missing or refused fails the page reading it rather than the module declaring it.
9
10
  export function buildingWithoutEnv(): void {
10
- (globalThis as { [BUILDING]?: boolean })[BUILDING] = true
11
+ const holder = globalThis as { [BUILDING]?: boolean, [LISTED]?: DeclaredEnv[] }
12
+
13
+ holder[BUILDING] = true
14
+ // The calls of `defineEnv` from here on are kept, so a module the config imports, which `kay env` cannot import again, still lists.
15
+ holder[LISTED] ??= []
11
16
  }
12
17
 
13
18
  const LOADING = Symbol.for('kay.loading')
@@ -22,9 +27,10 @@ export function loading(): boolean {
22
27
  return (globalThis as { [LOADING]?: boolean })[LOADING] === true
23
28
  }
24
29
 
25
- const LISTED = Symbol.for('kay.envListed')
26
30
  // The caller's file in a stack frame such as `at /app/src/env.ts:3:20` or `at env (file:///app/src/env.ts:3:20)`.
27
31
  const FRAME_FILE = /^at (?:.*? \()?(?:file:\/\/)?(\/[^():]+):\d+:\d+\)?$/
32
+ // A module imported under a query to read it again is the file before it.
33
+ const QUERY = /\?.*$/
28
34
  // A library of kay declares its variables for the app that builds it, so the app's module is the one to list them under.
29
35
  const KAY_LIBRARY = /^@kayjs\/(?!kay(?:\/|$))/
30
36
  const libraries = new Map<string, boolean>()
@@ -38,13 +44,11 @@ export interface DeclaredEnv {
38
44
  file?: string | undefined
39
45
  }
40
46
 
41
- // `kay env` loads the modules calling `defineEnv` and takes each schema as it is declared: from then on every call is recorded.
47
+ // Every call of `defineEnv` since a command began building without the environment, the config's own imports included, as `kay env` cannot import a module the config already loaded again. The listing takes the calls of its project and reads the modules calling `defineEnv` that are left.
42
48
  export function listingEnv(): DeclaredEnv[] {
43
- const found: DeclaredEnv[] = []
49
+ const holder = globalThis as { [LISTED]?: DeclaredEnv[] }
44
50
 
45
- ;(globalThis as { [LISTED]?: DeclaredEnv[] })[LISTED] = found
46
-
47
- return found
51
+ return holder[LISTED] ??= []
48
52
  }
49
53
 
50
54
  export function recordEnv(schema: EnvSchemaRecord, declaredBy: (...args: never[]) => unknown): void {
@@ -56,6 +60,32 @@ export function recordEnv(schema: EnvSchemaRecord, declaredBy: (...args: never[]
56
60
  found.push({ schema, file: callerFile(declaredBy) })
57
61
  }
58
62
 
63
+ function realOf(path: string): string {
64
+ try {
65
+ return realpathSync(path)
66
+ }
67
+ catch {
68
+ return path
69
+ }
70
+ }
71
+
72
+ // A module read again declares afresh: what it declared before is dropped, whatever the stack of each load. A folder drops every module under it, a path through a link matches the file it leads to, and a file that no longer loads or exists is dropped all the same.
73
+ export function forgetEnvCalls(path: string): void {
74
+ const found = (globalThis as { [LISTED]?: DeclaredEnv[] })[LISTED]
75
+
76
+ if (found === undefined)
77
+ return
78
+
79
+ const target = realOf(path.replace(QUERY, ''))
80
+
81
+ for (let index = found.length - 1; index >= 0; index--) {
82
+ const file = found[index]!.file
83
+
84
+ if (file !== undefined && (realOf(file) === target || realOf(file).startsWith(`${target}${sep}`)))
85
+ found.splice(index, 1)
86
+ }
87
+ }
88
+
59
89
  // The file that called `declaredBy`, a library of kay's call counted as its caller's: the frames above `declaredBy` are left out, so the first one left is whoever called it.
60
90
  export function callerFile(declaredBy: (...args: never[]) => unknown): string | undefined {
61
91
  const holder: { stack?: string } = {}
@@ -64,7 +94,7 @@ export function callerFile(declaredBy: (...args: never[]) => unknown): string |
64
94
 
65
95
  const files = (holder.stack ?? '').split('\n').map(line => FRAME_FILE.exec(line.trim())?.[1])
66
96
 
67
- return files.find(file => file !== undefined && !inLibrary(file))
97
+ return files.find(file => file !== undefined && !inLibrary(file))?.replace(QUERY, '')
68
98
  }
69
99
 
70
100
  // Whether `file` belongs to a package of kay's libraries, by the name in the nearest package.json.
@@ -48,7 +48,7 @@ export function handedOverFlash(request: Request): Flash | undefined {
48
48
  return id === null ? undefined : handedOver.get(id)
49
49
  }
50
50
 
51
- // The page the browser goes back to reads it through `succeeded()`, unless it cannot be carried there.
51
+ // The page the browser goes back to reads it through `data()`, unless it cannot be carried there.
52
52
  export function writeSuccess(cookies: CookieMap, success: SuccessFlash, secure = false, base = ''): void {
53
53
  const refusal = setFlash(cookies, success, secure, base)
54
54
 
@@ -1,11 +1,11 @@
1
1
  // What a start does with a route no guard covers: `true` refuses every page, layout with actions, endpoint and API module of the app, `'routes'` only its pages, endpoints and API modules, `false` none.
2
2
  export type GuardRequirement = boolean | 'routes'
3
3
 
4
- // What `guards: { default }` says of the app's routes, `'closed'` being `requireGuards: true` and `'open'` `requireGuards: false`; `requireGuards` stays until 1.108, and `guards.default` wins when both are set. Undefined leaves it to what the routes guard.
5
- export function requiredBy(config: { guards?: { default?: 'open' | 'closed' | undefined } | undefined, requireGuards?: boolean | undefined }): boolean | undefined {
4
+ // What `guards: { default }` says of the app's routes, `'closed'` refusing every route no guard covers and `'open'` none. Undefined leaves it to what the routes guard.
5
+ export function requiredBy(config: { guards?: { default?: 'open' | 'closed' | undefined } | undefined }): boolean | undefined {
6
6
  const given = config.guards?.default
7
7
 
8
- return given === undefined ? config.requireGuards : given === 'closed'
8
+ return given === undefined ? undefined : given === 'closed'
9
9
  }
10
10
 
11
11
  interface Access {
@@ -13,7 +13,7 @@ interface Access {
13
13
  guards: readonly unknown[]
14
14
  }
15
15
 
16
- // What `requireGuards` comes to once the routes are scanned: a setting is taken as it is, and an unset one refuses the routes no guard covers on a site that guards some of its own, which a site with no guard at all (a brochure) leaves open.
16
+ // What `guards.default` comes to once the routes are scanned: a setting is taken as it is, and an unset one refuses the routes no guard covers on a site that guards some of its own, which a site with no guard at all (a brochure) leaves open.
17
17
  // Guards a library mounts on its own routes say nothing of the app's: those routes are `open`, and only the app's own guarded routes mark a site that has started to guard.
18
18
  export function guardRequirement(configured: boolean | undefined, ...routes: Iterable<Access>[]): GuardRequirement {
19
19
  if (configured !== undefined)
@@ -732,10 +732,10 @@ export function sourceFile(whole: string, options: ImageRouteOptions): { path: s
732
732
  }
733
733
 
734
734
  // `images.maxDensity`, `images.widths`, `images.aspects`, `images.remote`, `images.placeholder` and whether `images.resolve` is set, checked and set for every image this process renders, served or prerendered; `inlineStyles` is whether the site's CSP lets an element carry a `style` attribute. Returns the density.
735
- export async function applyImageConfig(images: { maxDensity?: number | undefined, widths?: number[] | undefined, aspects?: string[] | undefined, remote?: { hosts?: string[] | undefined } | undefined, placeholder?: boolean | undefined, resolve?: unknown, guards?: unknown, guard?: unknown } | undefined, inlineStyles = true): Promise<number> {
735
+ export async function applyImageConfig(images: { maxDensity?: number | undefined, widths?: number[] | undefined, aspects?: string[] | undefined, remote?: { hosts?: string[] | undefined } | undefined, placeholder?: boolean | undefined, resolve?: unknown, guards?: unknown } | undefined, inlineStyles = true): Promise<number> {
736
736
  const maxDensity = images?.maxDensity ?? DEFAULT_MAX_DENSITY
737
737
 
738
- if ((images?.guards ?? images?.guard) !== undefined && images?.resolve === undefined)
738
+ if (images?.guards !== undefined && images?.resolve === undefined)
739
739
  throw new KayError('image-invalid', 'kay: images.guards admits the images images.resolve looks up, and images.resolve is not set')
740
740
 
741
741
  if (!(maxDensity >= 1))
@@ -53,8 +53,6 @@ export { shutdown } from './lifecycle'
53
53
  export type { LogEntry, Logger, MessageEntry, RequestEntry } from './log'
54
54
  export type { ToolCall } from './mcp'
55
55
  export { toolCall } from './mcp'
56
- export type { RateLimit, RateLimitRefusal } from './moved-exports'
57
- export { s, sqliteCache } from './moved-exports'
58
56
  export type { Inbox, Notification, NotificationRow, NotificationStore, NotifyOptions, StoredNotification } from './notifications'
59
57
  export { memoryNotifications, notifications, notify, sqliteNotifications } from './notifications'
60
58
  export type { PageHook, RenderedPage } from './page-hook'
@@ -22,11 +22,11 @@ export interface JobContext<Progress = unknown> {
22
22
  locale: Locale
23
23
  }
24
24
 
25
- // The context of a run as the handler is handed it: the run's own signal carrying the fields, so a handler written `(payload, signal, job)` before 1.105 still reads a signal in its second argument.
26
- export function runContext<Progress>(signal: AbortSignal, job: JobRef<Progress>, log: Log): JobContext<Progress> & AbortSignal {
25
+ // The context of a run as the handler is handed it.
26
+ export function runContext<Progress>(signal: AbortSignal, job: JobRef<Progress>, log: Log): JobContext<Progress> {
27
27
  // `Locale` is the app's registered locales where the app declares them, which `siteDefaultLocale()`'s string is not.
28
28
  // eslint-disable-next-line ts/no-unnecessary-type-assertion
29
- return Object.assign(signal, { signal, job, log, locale: siteDefaultLocale() as Locale })
29
+ return { signal, job, log, locale: siteDefaultLocale() as Locale }
30
30
  }
31
31
 
32
32
  // What a run that outlasted its `timeout` fails with, in milliseconds below a second.
@@ -30,7 +30,7 @@ export function jobsPageOf(setting: JobsConfig | undefined, at?: string): JobsPa
30
30
  return undefined
31
31
 
32
32
  const object = typeof setting === 'object' && setting !== null
33
- const given = object ? (setting.guards ?? setting.guard) as unknown : undefined
33
+ const given = object ? setting.guards as unknown : undefined
34
34
 
35
35
  if (given !== undefined && given !== false && !isGuardOption(given))
36
36
  throw new KayError('config-invalid', 'kay: `jobs.guards` takes a guard function, a list of them, `{ load }` returning one, or `false`, such as `jobs: { guards: ctx => ctx.locals.auth.admin.require() }`')
@@ -133,12 +133,8 @@ export type ScheduleCron<Cron extends string = string> = { cron: Cron & CronSche
133
133
  export function schedule<const Every extends Duration>(options: ScheduleEvery<Every>, jobs: Jobs): KayPlugin
134
134
  export function schedule<const Cron extends string>(options: ScheduleCron<Cron>, jobs: Jobs): KayPlugin
135
135
  export function schedule<const Table extends Record<string, Jobs>>(table: Table & { readonly [Key in keyof Table & string]: WhenOf<Key> }, options?: ScheduleOptions): KayPlugin
136
- /** @deprecated `schedule({ cron }, job)` or `schedule({ every }, job)`. Removed in 1.108; `deprecated-schedule-call` rewrites it. */
137
- export function schedule<const Every extends Duration>(every: Every & PositiveDuration<Every>, jobs: Jobs, options?: ScheduleEveryOptions): KayPlugin
138
- /** @deprecated `schedule({ cron }, job)` or `schedule({ every }, job)`. Removed in 1.108; `deprecated-schedule-call` rewrites it. */
139
- export function schedule<const Cron extends string>(cron: Cron & CronSchedule<Cron>, jobs: Jobs, options?: ScheduleOptions): KayPlugin
140
- export function schedule(first: Duration | string | Record<string, Jobs> | ScheduleEvery | ScheduleCron, second?: Jobs | ScheduleOptions, third?: ScheduleOptions) {
141
- const { entries, options } = scheduled(first, second, third)
136
+ export function schedule(first: Record<string, Jobs> | ScheduleEvery | ScheduleCron, second?: Jobs | ScheduleOptions) {
137
+ const { entries, options } = scheduled(first, second)
142
138
 
143
139
  if ('tz' in options)
144
140
  throw new KayError('config-invalid', 'kay: schedule takes timeZone, not tz, which 1.102 dropped')
@@ -164,10 +160,10 @@ export function schedule(first: Duration | string | Record<string, Jobs> | Sched
164
160
  return kayPlugin(plugins.length === 1 ? plugins[0]! : plugins.reduce((app, plugin) => app.use(plugin), new Elysia()))
165
161
  }
166
162
 
167
- // The schedules and the options of a call, whichever of its three shapes it is: an options object with `every` or `cron` and the jobs, a table of schedules to jobs and its options, or, before 1.105, the schedule, the jobs and the options.
168
- function scheduled(first: unknown, second: unknown, third: unknown): { entries: (readonly [Duration | string, Jobs])[], options: ScheduleOptions } {
163
+ // The schedules and the options of a call, whichever of its two shapes it is: an options object with `every` or `cron` and the jobs, or a table of schedules to jobs and its options.
164
+ function scheduled(first: unknown, second: unknown): { entries: (readonly [Duration | string, Jobs])[], options: ScheduleOptions } {
169
165
  if (typeof first !== 'object' || first === null)
170
- return { entries: [[first as Duration | string, second as Jobs]], options: third as ScheduleOptions | undefined ?? {} }
166
+ throw new KayError('config-invalid', 'kay: schedule takes `{ every }`, `{ cron }` or a table of schedules to jobs')
171
167
 
172
168
  if (!('every' in first || 'cron' in first))
173
169
  return { entries: Object.entries(first as Record<string, Jobs>), options: second as ScheduleOptions | undefined ?? {} }
@@ -51,10 +51,8 @@ export const KAY_EXPORTS: Record<string, 'free' | 'request' | 'local'> = {
51
51
  mount: 'free',
52
52
  navigate: 'free',
53
53
  navigation: 'free',
54
- onBeforeNavigate: 'free',
55
54
  onCleanup: 'free',
56
55
  onMount: 'free',
57
- onNavigate: 'free',
58
56
  online: 'free',
59
57
  optimistic: 'free',
60
58
  pageVisible: 'free',
package/src/server/kv.ts CHANGED
@@ -10,26 +10,23 @@ import { inMemory } from './memory-mark'
10
10
  import { onReload } from './reload'
11
11
 
12
12
  // What a library or an app keeps that is a value under a key and nothing else: a flag with an end, a marker, a document fetched once.
13
- // A key holds a string; `ttl` is how long it lives from the write, and a key written without one lives until it is deleted. It is a `Duration` for a store with `durations: true`, and milliseconds for one written before 1.105 (deprecated, kept until 1.108).
13
+ // A key holds a string; `ttl` is how long it lives from the write, and a key written without one lives until it is deleted. It is a `Duration`.
14
14
  export interface KvStore extends StoreBase {
15
15
  get: (key: string) => MaybePromise<string | undefined>
16
- // A store with `durations: true` is given a `Duration`; one written before 1.105 is given milliseconds, until 1.108, and still types as it did: `lengthMs(ttl)` from `kay` reads either.
17
- // eslint-disable-next-line ts/method-signature-style -- method syntax keeps a store written with `number` assignable (bivariance)
18
- set(key: string, value: string, ttl?: Duration | number): MaybePromise<void>
16
+ set: (key: string, value: string, ttl?: Duration) => MaybePromise<void>
19
17
  // Resolves with whether there was a live value.
20
18
  delete: (key: string) => MaybePromise<boolean>
21
19
  // Takes the key for `ttl` when no live value holds it: true for the one call that took it, however many processes ask at once.
22
- // eslint-disable-next-line ts/method-signature-style -- method syntax keeps a store written with `number` assignable (bivariance)
23
- once(key: string, ttl: Duration | number): MaybePromise<boolean>
20
+ once: (key: string, ttl: Duration) => MaybePromise<boolean>
24
21
  }
25
22
 
26
23
  // A `KvStore` under one namespace, which every key is written under so two users of the store never meet.
27
24
  export interface Kv {
28
25
  get: (key: string) => Promise<string | undefined>
29
- // `ttl` is a `Duration`; milliseconds as a number still work until 1.108 (`deprecated-store-ms`).
30
- set: (key: string, value: string, ttl?: Duration | number) => Promise<void>
26
+ // `ttl` is a `Duration`.
27
+ set: (key: string, value: string, ttl?: Duration) => Promise<void>
31
28
  delete: (key: string) => Promise<boolean>
32
- once: (key: string, ttl: Duration | number) => Promise<boolean>
29
+ once: (key: string, ttl: Duration) => Promise<boolean>
33
30
  }
34
31
 
35
32
  const SWEEP_EVERY = 500
@@ -47,7 +44,7 @@ export function memoryKv(max?: number): KvStore {
47
44
 
48
45
  return entry !== undefined && (entry.until === undefined || entry.until > now) ? entry : undefined
49
46
  }
50
- const write = (key: string, value: string, ttl: Duration | number | undefined, now: number) => {
47
+ const write = (key: string, value: string, ttl: Duration | undefined, now: number) => {
51
48
  const ttlMs = ttl === undefined ? undefined : lengthMs(ttl, 'a kv ttl')
52
49
 
53
50
  if (++writes % SWEEP_EVERY === 0) {
@@ -125,7 +122,7 @@ function openKv(path: string) {
125
122
  return {
126
123
  close: () => db.close(),
127
124
  get: (key: string) => select.get(key, Date.now())?.value,
128
- set(key: string, value: string, ttl?: Duration | number) {
125
+ set(key: string, value: string, ttl?: Duration) {
129
126
  const now = Date.now()
130
127
 
131
128
  sweeping(now)
@@ -136,7 +133,7 @@ function openKv(path: string) {
136
133
 
137
134
  return row !== null && (row.expires_at === null || row.expires_at > Date.now())
138
135
  },
139
- once(key: string, ttl: Duration | number) {
136
+ once(key: string, ttl: Duration) {
140
137
  const now = Date.now()
141
138
 
142
139
  sweeping(now)
@@ -205,13 +202,13 @@ export function kv(namespace: string, store?: KvStore): Kv {
205
202
  set: async (key, value, ttl) => {
206
203
  const used = kept()
207
204
 
208
- return used.set(keyed(key), value, ttl === undefined ? undefined : lengthFor(used, lengthMs(ttl, 'a kv ttl')))
205
+ return used.set(keyed(key), value, ttl === undefined ? undefined : lengthFor(lengthMs(ttl, 'a kv ttl')))
209
206
  },
210
207
  delete: async key => kept().delete(keyed(key)),
211
208
  once: async (key, ttl) => {
212
209
  const used = kept()
213
210
 
214
- return used.once(keyed(key), lengthFor(used, lengthMs(ttl, 'a kv ttl')))
211
+ return used.once(keyed(key), lengthFor(lengthMs(ttl, 'a kv ttl')))
215
212
  },
216
213
  }
217
214
  }
@@ -38,7 +38,7 @@ export { escapeHtml } from '../runtime/escape'
38
38
  export { IMPORTED } from '../runtime/image'
39
39
  export { siteLocales } from '../runtime/locale-state'
40
40
  export { delayAfter, LISTENED_IDLE_MS, MAX_IDLE_MS, pollClock } from '../runtime/poll-backoff'
41
- export type { DenyOptions, RefuseOptions } from '../runtime/refuse'
41
+ export type { DenyOptions } from '../runtime/refuse'
42
42
  export { refuse } from '../runtime/refuse'
43
43
  export { safeCode } from '../runtime/safe-code'
44
44
  export { isUrlAttribute, UNSAFE_ATTRIBUTE, UNSAFE_TAGS } from '../runtime/sanitize'
@@ -50,8 +50,6 @@ export { openSqlite } from '../runtime/sqlite.server'
50
50
  export { parseEvents } from '../runtime/sse'
51
51
  export type { MaybePromise } from '../runtime/store-base'
52
52
  export { lengthMs } from '../runtime/store-base'
53
- /** @deprecated Import `defineContext` from `kay/server`; `deprecated-context-import` rewrites it. Removed in 1.108. */
54
- export { defineContext } from '../runtime/template-context'
55
53
  export type { ContextDefinition } from '../runtime/template-context'
56
54
  export { acceptedLocales, matchLocale, validLocale } from './accept-language'
57
55
  export { APP_SQLITE_FILE, appDatabase, defaultSqliteFile } from './app-database'
@@ -84,7 +84,7 @@ const stamped = new Set<string>()
84
84
  // The tags each followed key's value names, kept here as memory may drop the value that knew them: an invalidation of one still reaches the pages following the key.
85
85
  const tagged = new Map<string, readonly string[]>()
86
86
  // The last invalidation time of each key a page followed, which a connection sends first: the declaration gives 0 to a key never invalidated.
87
- const stamps = (live as (initial: (key: string) => number, id: string, name: string) => { set: (key: string, value: number) => void, delete: (key: string) => void })((): number => 0, CACHE_LIVE_ID, 'cache')
87
+ const stamps = (live as (initial: (key: string) => number, id: string, name: string) => { set: (value: number, options: { key: string }) => void, delete: (key: string) => void })((): number => 0, CACHE_LIVE_ID, 'cache')
88
88
 
89
89
  // Runs the render of a request, loads included, so the cached values it reads with `live: true` are the page's to follow.
90
90
  // Who is signed in is asked only for a render that reads a value of each user: the first render of a chain does not know it will, so it runs without, and `missed` is called when it read one, for the render to run again with the user resolved. A chain that read one is resolved before its renders from then on.
@@ -382,7 +382,7 @@ onKeysInvalidated((matches) => {
382
382
  for (const key of stamped) {
383
383
  if (matches(key) || tagged.get(key)?.some(matches) === true) {
384
384
  lastStamp = at
385
- stamps.set(key, at)
385
+ stamps.set(at, { key })
386
386
  into?.add(key)
387
387
  }
388
388
  }
package/src/server/mcp.ts CHANGED
@@ -401,10 +401,8 @@ export interface McpOptions {
401
401
  actions: ActionOptions
402
402
  // The sign-in metadata paths kay serves: one the app serves itself is left out.
403
403
  metadataPaths: string[]
404
- // Where the endpoint is served, `/mcp` by default.
404
+ // Where the endpoint is served, `/_kay/mcp` by default.
405
405
  path: string
406
- // The path before 1.105, answered as `path` is until 2.0, for an app that did not move the endpoint and serves nothing there.
407
- former?: string | undefined
408
406
  // The requests a client may send it in a window, or undefined for no limit.
409
407
  rateLimit: RateWindowMs | undefined
410
408
  // Sent as `instructions` of `initialize`, from `mcp.instructions`.
@@ -568,7 +566,7 @@ function serveResourceMetadata(app: Elysia, name: string, paths: string[], endpo
568
566
  }
569
567
  }
570
568
 
571
- // Serves the tools of `document` at its path over Streamable HTTP: one JSON-RPC message per POST, answered with JSON; `former`, where it was before 1.105, answers POST in place until 2.0.
569
+ // Serves the tools of `document` at its path over Streamable HTTP: one JSON-RPC message per POST, answered with JSON.
572
570
  export function serveMcp(app: Elysia, document: Schema, options: McpOptions): void {
573
571
  const calls = new AsyncLocalStorage<CallContext>()
574
572
  const build = () => {
@@ -645,10 +643,6 @@ export function serveMcp(app: Elysia, document: Schema, options: McpOptions): vo
645
643
  app.get(options.path, notAllowed)
646
644
  app.delete(options.path, notAllowed)
647
645
 
648
- // Only the POST is taken at the former path, so a catch-all or parameter route of the app keeps its GET and DELETE.
649
- if (options.former !== undefined)
650
- app.post(options.former, answer, { parse: 'none' })
651
-
652
646
  serveResourceMetadata(app, options.title, options.metadataPaths, options.path)
653
647
  }
654
648
 
@@ -662,7 +656,7 @@ export interface LibraryTool {
662
656
  // The `label` of the action's `tool`, the words a library shows a visitor for a call to it.
663
657
  label?: string | undefined
664
658
  // Runs the action as the visitor `request` came from, the one being answered unless given, through the whole app: its guards, validation and rate limits apply as on a form post, while the honeypot, minimum time and proof of work, which only a person filling in a form passes, are skipped.
665
- // A request a browser sent from another site is refused, as `/mcp` refuses it, since it carries the visitor's cookies whatever its method.
659
+ // A request a browser sent from another site is refused, as the MCP endpoint refuses it, since it carries the visitor's cookies whatever its method.
666
660
  // A call made once the answer is sent, from a reply streaming on, passes the request it captured while it was answered.
667
661
  call: (args: Record<string, unknown>, request?: Request) => Promise<ToolResult>
668
662
  }
@@ -11,8 +11,6 @@ import { sameText } from './seal'
11
11
  import { checkSecret, readSecret, secretSource, verifying } from './secret'
12
12
 
13
13
  export const METRICS_PATH = '/_kay/metrics'
14
- // Where the metrics were served before 1.105, which answers as well until 1.108 while `endpoints.metrics` is not set.
15
- export const FORMER_METRICS_PATH = '/metrics'
16
14
  const TOKEN_VARIABLE = 'KAY_METRICS_TOKEN'
17
15
  // Seconds, the Prometheus client libraries' default buckets.
18
16
  const BUCKETS = [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10]
@@ -82,7 +80,7 @@ function labelled(value: string): string {
82
80
  }
83
81
 
84
82
  // Counts the requests the server answered and writes them, with the jobs, the cache and the open connections, as the Prometheus text format.
85
- export function serveMetrics(app: Elysia, options: { root: string, path: string, base: string, proxy: ProxyConfig | undefined, token?: MetricsConfig['token'], health: string | undefined, holds: () => boolean, former?: { path: string, holds: () => boolean } | undefined, connections: () => number }): void {
83
+ export function serveMetrics(app: Elysia, options: { root: string, path: string, base: string, proxy: ProxyConfig | undefined, token?: MetricsConfig['token'], health: string | undefined, holds: () => boolean, connections: () => number }): void {
86
84
  const started = Date.now()
87
85
  const token = configuredToken(options.token, options.root)
88
86
  const requests = new Map<string, number>()
@@ -97,7 +95,7 @@ export function serveMetrics(app: Elysia, options: { root: string, path: string,
97
95
  // A trailing slash is the same route, as Elysia routes it, and the path is read with or without the base a proxy keeps.
98
96
  const at = (route: string, holds: () => boolean): boolean => holds() && [pathname, routerPath(pathname, options.base)].some(path => path === route || path === `${route}/`)
99
97
 
100
- return at(options.path, options.holds) || (options.former !== undefined && at(options.former.path, options.former.holds))
98
+ return at(options.path, options.holds)
101
99
  }
102
100
 
103
101
  const lines = (): string => {