@kayjs/kay 1.104.3 → 1.105.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 (1090) hide show
  1. package/dist/eslint.js +5231 -2529
  2. package/editors/vscode/syntaxes/kay.tmLanguage.json +1 -1
  3. package/editors/zed/extension.toml +2 -2
  4. package/llms/action-protection.md +10 -10
  5. package/llms/actions-from-islands.md +26 -29
  6. package/llms/actions-refused-fields.md +18 -4
  7. package/llms/actions.md +36 -27
  8. package/llms/analytics.md +1 -1
  9. package/llms/api-from-islands.md +14 -15
  10. package/llms/api-routes.md +10 -8
  11. package/llms/browser-only.md +12 -10
  12. package/llms/cdn-caching.md +7 -6
  13. package/llms/check-and-tools.md +6 -6
  14. package/llms/checks.md +1 -1
  15. package/llms/code-lints.md +6 -6
  16. package/llms/commands.md +42 -0
  17. package/llms/component-libraries.md +1 -1
  18. package/llms/component-library-conventions.md +11 -5
  19. package/llms/components.md +14 -14
  20. package/llms/content-markdown-to-caching.md +2 -2
  21. package/llms/deprecated-lints-1-105-libraries.md +30 -0
  22. package/llms/deprecated-lints-1-105.md +58 -0
  23. package/llms/deprecated-lints.md +7 -5
  24. package/llms/dev-tool.md +1 -1
  25. package/llms/eco-design.md +3 -3
  26. package/llms/editor-and-agent-commands.md +1 -1
  27. package/llms/effects.md +7 -7
  28. package/llms/environment.md +6 -5
  29. package/llms/errors-runtime.md +4 -4
  30. package/llms/errors.md +12 -8
  31. package/llms/events.md +15 -12
  32. package/llms/files.md +6 -4
  33. package/llms/guards.md +18 -15
  34. package/llms/head.md +38 -6
  35. package/llms/hooks.md +27 -25
  36. package/llms/images-runtime-and-remote.md +12 -12
  37. package/llms/images.md +29 -29
  38. package/llms/island-and-form-lints.md +8 -8
  39. package/llms/island-sources.md +31 -24
  40. package/llms/islands-state-to-ids.md +8 -10
  41. package/llms/islands.md +16 -14
  42. package/llms/lints.md +1 -1
  43. package/llms/live-values.md +12 -9
  44. package/llms/local-collections.md +11 -11
  45. package/llms/locales-texts.md +1 -1
  46. package/llms/locales.md +12 -11
  47. package/llms/mcp.md +8 -8
  48. package/llms/metrics.md +24 -0
  49. package/llms/navigation-from-code.md +16 -15
  50. package/llms/navigation.md +5 -3
  51. package/llms/prerendering.md +4 -4
  52. package/llms/privacy.md +4 -4
  53. package/llms/production.md +28 -38
  54. package/llms/project-new-and-add.md +2 -2
  55. package/llms/project.md +17 -40
  56. package/llms/proxy-and-security.md +5 -5
  57. package/llms/queues.md +19 -24
  58. package/llms/rate-limits.md +21 -10
  59. package/llms/recipes.md +7 -6
  60. package/llms/rendering.md +8 -7
  61. package/llms/request-values.md +2 -2
  62. package/llms/rooms.md +9 -9
  63. package/llms/routing-endpoints-and-base.md +3 -3
  64. package/llms/routing-special-pages.md +4 -4
  65. package/llms/routing.md +16 -18
  66. package/llms/security-and-i18n-lints.md +1 -1
  67. package/llms/seo-lints.md +1 -1
  68. package/llms/server-islands.md +12 -7
  69. package/llms/server.md +33 -18
  70. package/llms/site.md +12 -10
  71. package/llms/sitemap-search-fonts.md +50 -44
  72. package/llms/stores.md +7 -5
  73. package/llms/styles-and-assets.md +8 -8
  74. package/llms/templates-elements-slots-snippets.md +5 -9
  75. package/llms/templates.md +4 -4
  76. package/llms/testing-browser.md +1 -0
  77. package/llms/testing-requests-jobs-sockets.md +27 -4
  78. package/llms/testing.md +7 -7
  79. package/llms/tracing.md +9 -7
  80. package/llms/upgrading-1-105-config.md +71 -0
  81. package/llms/upgrading-archive.md +74 -114
  82. package/llms/upgrading.md +41 -131
  83. package/llms/whats-new-archive.md +59 -57
  84. package/llms/whats-new.md +32 -54
  85. package/llms/workers.md +2 -2
  86. package/llms.txt +18 -13
  87. package/package.json +9 -9
  88. package/src/add.ts +1 -1
  89. package/src/build/await-alert.ts +34 -0
  90. package/src/build/client.ts +15 -13
  91. package/src/build/compile.ts +9 -6
  92. package/src/build/pipeline.ts +19 -16
  93. package/src/build/server-record.ts +2 -1
  94. package/src/build/sourcemap.ts +1 -1
  95. package/src/build/static.ts +10 -8
  96. package/src/build/styles.ts +7 -1
  97. package/src/build/transform.ts +3 -2
  98. package/src/build/verify.ts +8 -5
  99. package/src/check/action-readers.ts +115 -0
  100. package/src/check/action-type.ts +44 -0
  101. package/src/check/ai-language.ts +56 -0
  102. package/src/check/app-hooks.ts +90 -0
  103. package/src/check/auth-methods.ts +85 -0
  104. package/src/check/auth-rate-limits.ts +99 -0
  105. package/src/check/boot.ts +9 -8
  106. package/src/check/browser-global-reads.ts +4 -4
  107. package/src/check/client-keys.ts +10 -0
  108. package/src/check/cms-options.ts +81 -0
  109. package/src/check/config-groups.ts +22 -0
  110. package/src/check/config-objects.ts +83 -0
  111. package/src/check/config-switches.ts +38 -0
  112. package/src/check/context-import.ts +51 -0
  113. package/src/check/diagnose.ts +16 -6
  114. package/src/check/env-files.ts +31 -0
  115. package/src/check/env-types.ts +10 -8
  116. package/src/check/format-duration.ts +75 -0
  117. package/src/check/generated.ts +23 -4
  118. package/src/check/guard-options.ts +58 -0
  119. package/src/check/guards.ts +4 -4
  120. package/src/check/hook-context.ts +94 -0
  121. package/src/check/hook-names.ts +104 -0
  122. package/src/check/i18n-keys.ts +50 -0
  123. package/src/check/images-keys.ts +54 -0
  124. package/src/check/index.ts +38 -22
  125. package/src/check/job-shapes.ts +273 -0
  126. package/src/check/layout-facts.ts +1 -1
  127. package/src/check/live-api.ts +137 -0
  128. package/src/check/mail-api.ts +67 -0
  129. package/src/check/messages.ts +7 -7
  130. package/src/check/moved-keys.ts +49 -0
  131. package/src/check/one-state-api.ts +357 -0
  132. package/src/check/open-settings.ts +1 -1
  133. package/src/check/output-schema.ts +3 -1
  134. package/src/check/page-heads.ts +31 -5
  135. package/src/check/pages-options.ts +35 -0
  136. package/src/check/project.ts +5 -1
  137. package/src/check/rate-enforce.ts +53 -0
  138. package/src/check/refusal-calls.ts +185 -0
  139. package/src/check/regroup.ts +92 -0
  140. package/src/check/renamed-packages.ts +32 -0
  141. package/src/check/retired-lints.ts +49 -0
  142. package/src/check/route-keys.ts +166 -0
  143. package/src/check/route-shadow.ts +174 -0
  144. package/src/check/secret-keys.ts +70 -0
  145. package/src/check/seo.ts +3 -3
  146. package/src/check/shadow-types.ts +110 -4
  147. package/src/check/shadow.ts +4 -1
  148. package/src/check/socket-frames.ts +102 -0
  149. package/src/check/source-readers.ts +257 -0
  150. package/src/check/store-ms.ts +72 -0
  151. package/src/check/store-names.ts +88 -0
  152. package/src/check/template-hints.ts +70 -6
  153. package/src/check/test-helpers.ts +98 -0
  154. package/src/check/ttl-names.ts +142 -0
  155. package/src/check/unmounted-jobs.ts +2 -2
  156. package/src/commands/a11y.ts +1 -1
  157. package/src/commands/check.ts +4 -2
  158. package/src/commands/env-compare.ts +2 -2
  159. package/src/commands/env-declare.ts +1 -1
  160. package/src/commands/env.ts +19 -16
  161. package/src/commands/explain-island.ts +27 -1
  162. package/src/commands/i18n.ts +2 -2
  163. package/src/commands/routes.ts +23 -17
  164. package/src/compiler/a11y.ts +56 -41
  165. package/src/compiler/aria.ts +1 -1
  166. package/src/compiler/ast.ts +54 -136
  167. package/src/compiler/bound-props.ts +75 -0
  168. package/src/compiler/browser.ts +12 -11
  169. package/src/compiler/button-forms.ts +33 -0
  170. package/src/compiler/codegen.ts +51 -137
  171. package/src/compiler/deprecated-ai-labels.ts +97 -0
  172. package/src/compiler/deprecated-ai-links.ts +63 -0
  173. package/src/compiler/deprecated-allow.ts +50 -0
  174. package/src/compiler/deprecated-auth-lints.ts +14 -0
  175. package/src/compiler/deprecated-auth-signed.ts +29 -0
  176. package/src/compiler/deprecated-children.ts +66 -0
  177. package/src/compiler/deprecated-image.ts +116 -0
  178. package/src/compiler/deprecated-island.ts +155 -0
  179. package/src/compiler/deprecated-library.ts +20 -0
  180. package/src/compiler/deprecated-lints.ts +523 -22
  181. package/src/compiler/deprecated-page.ts +125 -0
  182. package/src/compiler/deprecated-parts.ts +22 -0
  183. package/src/compiler/deprecated-ui-callbacks.ts +66 -0
  184. package/src/compiler/deprecated-ui-input.ts +97 -0
  185. package/src/compiler/deprecated-ui-items.ts +47 -0
  186. package/src/compiler/deprecated-ui-props.ts +3 -3
  187. package/src/compiler/dom-fields.ts +67 -0
  188. package/src/compiler/dom.ts +29 -27
  189. package/src/compiler/errors.ts +37 -27
  190. package/src/compiler/event-modifiers.ts +2 -2
  191. package/src/compiler/fence-checks.ts +29 -69
  192. package/src/compiler/form-action.ts +18 -0
  193. package/src/compiler/form-info.ts +154 -0
  194. package/src/compiler/head-shorthand.ts +118 -0
  195. package/src/compiler/head-tags.ts +64 -0
  196. package/src/compiler/helper-imports.ts +33 -0
  197. package/src/compiler/html-initial.ts +68 -0
  198. package/src/compiler/html-parts.ts +40 -0
  199. package/src/compiler/html.ts +41 -91
  200. package/src/compiler/if-alias.ts +2 -47
  201. package/src/compiler/image-attributes.ts +69 -0
  202. package/src/compiler/index.ts +33 -9
  203. package/src/compiler/island-arguments.ts +38 -10
  204. package/src/compiler/island-cause.ts +5 -5
  205. package/src/compiler/island-declaration.ts +181 -0
  206. package/src/compiler/island-marker.ts +10 -15
  207. package/src/compiler/items.ts +5 -0
  208. package/src/compiler/jsx-class.ts +25 -1
  209. package/src/compiler/jsx-field.ts +58 -0
  210. package/src/compiler/jsx.ts +24 -29
  211. package/src/compiler/kay-exports.ts +2 -0
  212. package/src/compiler/link-flags.ts +106 -0
  213. package/src/compiler/lints.ts +27 -60
  214. package/src/compiler/live-reads.ts +160 -0
  215. package/src/compiler/loop-lints.ts +6 -5
  216. package/src/compiler/markup-fields.ts +34 -0
  217. package/src/compiler/markup.ts +75 -77
  218. package/src/compiler/module-signals.ts +1 -1
  219. package/src/compiler/names.ts +7 -1
  220. package/src/compiler/nesting.ts +7 -0
  221. package/src/compiler/old-parts.ts +84 -0
  222. package/src/compiler/page-settings.ts +2 -0
  223. package/src/compiler/parser.ts +7 -8
  224. package/src/compiler/plan.ts +13 -1
  225. package/src/compiler/rewrite-reads.ts +29 -0
  226. package/src/compiler/rewrite-types.ts +2 -0
  227. package/src/compiler/rewrite.ts +35 -33
  228. package/src/compiler/route-lints.ts +4 -2
  229. package/src/compiler/script-props.ts +34 -5
  230. package/src/compiler/script-server.ts +26 -3
  231. package/src/compiler/script-shared.ts +7 -0
  232. package/src/compiler/script.ts +7 -0
  233. package/src/compiler/server-imports.ts +52 -0
  234. package/src/compiler/slot-types.ts +46 -0
  235. package/src/compiler/style-arguments.ts +20 -0
  236. package/src/compiler/template-walk.ts +72 -0
  237. package/src/compiler/type-parameters.ts +45 -0
  238. package/src/compiler/validate-fields.ts +68 -0
  239. package/src/compiler/validate.ts +51 -45
  240. package/src/config-extensions.ts +53 -6
  241. package/src/config-loader.ts +31 -16
  242. package/src/config-resolve.ts +194 -0
  243. package/src/config-shape.ts +81 -38
  244. package/src/config-switch.ts +14 -0
  245. package/src/config.ts +287 -102
  246. package/src/content/problems.ts +1 -1
  247. package/src/generate-resource.ts +5 -4
  248. package/src/generate.ts +2 -2
  249. package/src/lsp/code-actions.ts +1 -1
  250. package/src/lsp/completions.ts +2 -2
  251. package/src/lsp/diagnostics.ts +4 -2
  252. package/src/lsp/document-links.ts +1 -1
  253. package/src/lsp/navigation.ts +1 -1
  254. package/src/lsp/route-documents.ts +21 -0
  255. package/src/lsp/server.ts +60 -8
  256. package/src/lsp/template-completion.ts +4 -4
  257. package/src/lsp/ui-completion.ts +1 -1
  258. package/src/migrate/astro.ts +1 -1
  259. package/src/migrate/project.ts +1 -1
  260. package/src/project.ts +20 -11
  261. package/src/runtime/action-call.ts +179 -41
  262. package/src/runtime/action-encode.ts +2 -1
  263. package/src/runtime/action-error.ts +2 -1
  264. package/src/runtime/action-form.ts +159 -17
  265. package/src/runtime/action-navigate.ts +19 -0
  266. package/src/runtime/action-owner.ts +2 -0
  267. package/src/runtime/action-post.ts +22 -4
  268. package/src/runtime/action-protection.ts +4 -3
  269. package/src/runtime/action-shared.ts +86 -28
  270. package/src/runtime/action-stream.ts +43 -9
  271. package/src/runtime/action.ts +8 -7
  272. package/src/runtime/api-error-class.ts +1 -1
  273. package/src/runtime/api-url.ts +5 -4
  274. package/src/runtime/await-failed.ts +9 -0
  275. package/src/runtime/await.server.ts +14 -4
  276. package/src/runtime/await.ts +3 -3
  277. package/src/runtime/button-form.ts +5 -0
  278. package/src/runtime/cache-hooks.ts +54 -0
  279. package/src/runtime/cache-live-id.ts +3 -0
  280. package/src/runtime/cache.ts +12 -36
  281. package/src/runtime/call-result.ts +86 -21
  282. package/src/runtime/checks.ts +27 -17
  283. package/src/runtime/consent.ts +3 -2
  284. package/src/runtime/core.ts +99 -27
  285. package/src/runtime/dispatch.ts +11 -0
  286. package/src/runtime/dom-await.ts +39 -9
  287. package/src/runtime/dom-image.ts +2 -2
  288. package/src/runtime/duration-words.ts +2 -1
  289. package/src/runtime/duration.ts +5 -3
  290. package/src/runtime/edit.ts +3 -2
  291. package/src/runtime/env.ts +2 -1
  292. package/src/runtime/forms.ts +15 -5
  293. package/src/runtime/head.ts +3 -1
  294. package/src/runtime/html.ts +10 -6
  295. package/src/runtime/i18n.client.ts +12 -6
  296. package/src/runtime/i18n.server.ts +12 -6
  297. package/src/runtime/i18n.ts +28 -8
  298. package/src/runtime/image.ts +16 -18
  299. package/src/runtime/index.ts +9 -8
  300. package/src/runtime/internal.ts +2 -1
  301. package/src/runtime/invalidated-keys.ts +11 -0
  302. package/src/runtime/island.server.ts +18 -10
  303. package/src/runtime/jsx.ts +6 -1
  304. package/src/runtime/kay-error.ts +29 -0
  305. package/src/runtime/leave.ts +1 -0
  306. package/src/runtime/live-cache.ts +8 -1
  307. package/src/runtime/live-resource.server.ts +1 -0
  308. package/src/runtime/live-revalidate.ts +53 -0
  309. package/src/runtime/live-value.client.ts +36 -3
  310. package/src/runtime/live-value.server.ts +10 -6
  311. package/src/runtime/live-value.shared.ts +50 -10
  312. package/src/runtime/live-value.ts +16 -4
  313. package/src/runtime/live.ts +92 -137
  314. package/src/runtime/local-types.ts +106 -0
  315. package/src/runtime/local.ts +31 -109
  316. package/src/runtime/log.ts +3 -1
  317. package/src/runtime/mount.compat.ts +8 -0
  318. package/src/runtime/navigate-api.ts +17 -8
  319. package/src/runtime/navigation-state.ts +50 -13
  320. package/src/runtime/navigation.ts +3 -3
  321. package/src/runtime/optimistic.ts +1 -1
  322. package/src/runtime/page-swap.ts +11 -6
  323. package/src/runtime/persist.ts +2 -1
  324. package/src/runtime/persisted.ts +43 -38
  325. package/src/runtime/presence.ts +15 -9
  326. package/src/runtime/queue-jobs.ts +2 -1
  327. package/src/runtime/reactive.ts +4 -5
  328. package/src/runtime/refuse.ts +23 -6
  329. package/src/runtime/resource-tags.ts +35 -0
  330. package/src/runtime/route.ts +3 -2
  331. package/src/runtime/sanitize.ts +4 -3
  332. package/src/runtime/schema.client.ts +2 -1
  333. package/src/runtime/schema.ts +2 -1
  334. package/src/runtime/send.ts +2 -1
  335. package/src/runtime/shortcut.ts +10 -3
  336. package/src/runtime/socket-message.ts +26 -0
  337. package/src/runtime/store-base.ts +22 -0
  338. package/src/runtime/swap-fetch.ts +2 -1
  339. package/src/runtime/swap.ts +4 -0
  340. package/src/runtime/template-context.ts +4 -2
  341. package/src/runtime/values.ts +28 -10
  342. package/src/runtime/wire.ts +13 -3
  343. package/src/runtime/with-query.ts +3 -2
  344. package/src/runtime/work.ts +4 -2
  345. package/src/server/action-hooks.ts +15 -8
  346. package/src/server/action-iterable.ts +18 -3
  347. package/src/server/actions.ts +31 -18
  348. package/src/server/address.ts +1 -1
  349. package/src/server/analytics-server.ts +2 -1
  350. package/src/server/api-modules.ts +38 -26
  351. package/src/server/api.ts +17 -96
  352. package/src/server/app-database.ts +11 -0
  353. package/src/server/app-hooks.ts +25 -6
  354. package/src/server/app-stages.ts +91 -60
  355. package/src/server/app.ts +25 -13
  356. package/src/server/auth-mails.ts +2 -0
  357. package/src/server/basic-auth.ts +27 -7
  358. package/src/server/bundle.ts +2 -0
  359. package/src/server/button-form-rule.ts +20 -0
  360. package/src/server/card.ts +2 -2
  361. package/src/server/ceiling.ts +1 -1
  362. package/src/server/client.ts +2 -2
  363. package/src/server/config-error.ts +2 -2
  364. package/src/server/config-limits.ts +37 -17
  365. package/src/server/context-values.ts +4 -3
  366. package/src/server/cookies.ts +4 -2
  367. package/src/server/endpoints.ts +5 -2
  368. package/src/server/entry-drafts.ts +1 -1
  369. package/src/server/errors.ts +4 -3
  370. package/src/server/event-stream.ts +7 -4
  371. package/src/server/favicon.ts +59 -10
  372. package/src/server/fetch-public.ts +4 -3
  373. package/src/server/file-answer.ts +89 -0
  374. package/src/server/forms.ts +1 -1
  375. package/src/server/guard-requirement.ts +7 -0
  376. package/src/server/guards.ts +74 -2
  377. package/src/server/hooks.ts +10 -10
  378. package/src/server/i18n.ts +8 -9
  379. package/src/server/image-limits.ts +4 -3
  380. package/src/server/image.ts +17 -15
  381. package/src/server/index.ts +15 -9
  382. package/src/server/job-context.ts +35 -0
  383. package/src/server/jobs-page.ts +14 -8
  384. package/src/server/jobs.ts +48 -13
  385. package/src/server/kept-exports.ts +3 -1
  386. package/src/server/kv.ts +34 -18
  387. package/src/server/lazy-guard.ts +4 -1
  388. package/src/server/library.ts +5 -2
  389. package/src/server/lifecycle.ts +5 -5
  390. package/src/server/link-schemes.ts +5 -5
  391. package/src/server/live.ts +79 -7
  392. package/src/server/load-budget.ts +2 -2
  393. package/src/server/loader.ts +4 -2
  394. package/src/server/log.ts +18 -3
  395. package/src/server/maintenance.ts +1 -1
  396. package/src/server/mcp-key.ts +27 -24
  397. package/src/server/mcp.ts +21 -8
  398. package/src/server/message-drafts.ts +2 -2
  399. package/src/server/metrics.ts +42 -14
  400. package/src/server/moved-exports.ts +17 -0
  401. package/src/server/not-found-config.ts +4 -3
  402. package/src/server/notifications.ts +2 -2
  403. package/src/server/openapi.ts +9 -13
  404. package/src/server/over-limit.ts +29 -0
  405. package/src/server/page-limits.ts +1 -1
  406. package/src/server/page-routes.ts +2 -2
  407. package/src/server/page-seo.ts +29 -0
  408. package/src/server/page-settings.ts +69 -8
  409. package/src/server/pg-data.ts +3 -2
  410. package/src/server/pg-jobs.ts +3 -2
  411. package/src/server/pg-limit.ts +4 -3
  412. package/src/server/pg-live.ts +3 -1
  413. package/src/server/pg-not-found.ts +2 -1
  414. package/src/server/pg-poll.ts +3 -3
  415. package/src/server/pg-redirects.ts +3 -2
  416. package/src/server/pg-stores.ts +9 -7
  417. package/src/server/prerender.ts +21 -10
  418. package/src/server/preview.ts +3 -1
  419. package/src/server/protection.ts +20 -44
  420. package/src/server/proxy-key.ts +17 -39
  421. package/src/server/pure-page.ts +2 -29
  422. package/src/server/push-crypto.ts +3 -2
  423. package/src/server/push-server.ts +2 -1
  424. package/src/server/push.ts +6 -6
  425. package/src/server/queue-scheduler.ts +5 -0
  426. package/src/server/queue.ts +21 -29
  427. package/src/server/rate-limit.ts +21 -13
  428. package/src/server/rate-windows.ts +14 -0
  429. package/src/server/redirects.ts +29 -2
  430. package/src/server/remote.ts +5 -4
  431. package/src/server/render-document.ts +32 -11
  432. package/src/server/render.ts +6 -6
  433. package/src/server/report.ts +5 -5
  434. package/src/server/request-record.ts +2 -0
  435. package/src/server/resources.ts +2 -1
  436. package/src/server/rooms.ts +177 -23
  437. package/src/server/route-settings.ts +236 -0
  438. package/src/server/routes.ts +25 -195
  439. package/src/server/save-data.ts +1 -1
  440. package/src/server/scope.ts +1 -1
  441. package/src/server/secret.ts +76 -0
  442. package/src/server/security.ts +15 -10
  443. package/src/server/seo.ts +19 -7
  444. package/src/server/served-paths.ts +2 -1
  445. package/src/server/session.ts +39 -18
  446. package/src/server/setup.ts +17 -10
  447. package/src/server/signals.ts +23 -3
  448. package/src/server/signed.ts +7 -4
  449. package/src/server/sitemap.ts +6 -4
  450. package/src/server/socket.ts +371 -0
  451. package/src/server/source.ts +13 -7
  452. package/src/server/sqlite-live.ts +3 -1
  453. package/src/server/storage.ts +21 -48
  454. package/src/server/stream.ts +23 -14
  455. package/src/server/translations.ts +2 -2
  456. package/src/server/uncaught.ts +2 -2
  457. package/src/server/violations.ts +4 -3
  458. package/src/server/vitals-routes/_guard.ts +1 -1
  459. package/src/server/vitals-server.ts +2 -1
  460. package/src/server/vitals.ts +5 -2
  461. package/src/server/words.ts +4 -0
  462. package/src/server/work-scope.ts +4 -2
  463. package/src/server/work.ts +4 -3
  464. package/src/server/workers.ts +2 -1
  465. package/src/server/workflow.ts +19 -11
  466. package/src/server/ws-limits.ts +51 -69
  467. package/src/template-config.ts +1 -1
  468. package/src/template-docker.ts +1 -1
  469. package/src/template-starter.ts +2 -2
  470. package/src/template-styles.ts +1 -1
  471. package/src/template-ws.ts +1 -1
  472. package/src/test/a11y.ts +55 -0
  473. package/src/test/browser.ts +5 -48
  474. package/src/test/index.ts +31 -39
  475. package/src/test/mount.ts +5 -4
  476. package/src/test/outgoing.ts +138 -0
  477. package/src/test/page-types.ts +3 -0
  478. package/src/test/screenshot-match.ts +69 -0
  479. package/src/test/service.ts +11 -5
  480. package/src/test/site-actions.ts +22 -19
  481. package/src/test/site-keys.ts +49 -0
  482. package/src/test/site-socket.ts +42 -38
  483. package/src/test/site-types.ts +41 -12
  484. package/src/test/site-world.ts +86 -0
  485. package/types/build/await-alert.d.ts +4 -0
  486. package/types/build/await-alert.d.ts.map +1 -0
  487. package/types/build/client.d.ts.map +1 -1
  488. package/types/build/compile.d.ts +1 -0
  489. package/types/build/compile.d.ts.map +1 -1
  490. package/types/build/server-record.d.ts.map +1 -1
  491. package/types/build/static.d.ts.map +1 -1
  492. package/types/build/styles.d.ts.map +1 -1
  493. package/types/build/transform.d.ts.map +1 -1
  494. package/types/build/verify.d.ts +3 -2
  495. package/types/build/verify.d.ts.map +1 -1
  496. package/types/check/action-readers.d.ts +3 -0
  497. package/types/check/action-readers.d.ts.map +1 -0
  498. package/types/check/action-type.d.ts +3 -0
  499. package/types/check/action-type.d.ts.map +1 -0
  500. package/types/check/ai-language.d.ts +3 -0
  501. package/types/check/ai-language.d.ts.map +1 -0
  502. package/types/check/app-hooks.d.ts +3 -0
  503. package/types/check/app-hooks.d.ts.map +1 -0
  504. package/types/check/auth-methods.d.ts +3 -0
  505. package/types/check/auth-methods.d.ts.map +1 -0
  506. package/types/check/auth-rate-limits.d.ts +3 -0
  507. package/types/check/auth-rate-limits.d.ts.map +1 -0
  508. package/types/check/boot.d.ts.map +1 -1
  509. package/types/check/client-keys.d.ts +3 -0
  510. package/types/check/client-keys.d.ts.map +1 -0
  511. package/types/check/cms-options.d.ts +3 -0
  512. package/types/check/cms-options.d.ts.map +1 -0
  513. package/types/check/config-groups.d.ts +3 -0
  514. package/types/check/config-groups.d.ts.map +1 -0
  515. package/types/check/config-objects.d.ts +16 -0
  516. package/types/check/config-objects.d.ts.map +1 -0
  517. package/types/check/config-switches.d.ts +3 -0
  518. package/types/check/config-switches.d.ts.map +1 -0
  519. package/types/check/context-import.d.ts +3 -0
  520. package/types/check/context-import.d.ts.map +1 -0
  521. package/types/check/diagnose.d.ts +1 -1
  522. package/types/check/diagnose.d.ts.map +1 -1
  523. package/types/check/env-files.d.ts +3 -0
  524. package/types/check/env-files.d.ts.map +1 -0
  525. package/types/check/env-types.d.ts.map +1 -1
  526. package/types/check/format-duration.d.ts +5 -0
  527. package/types/check/format-duration.d.ts.map +1 -0
  528. package/types/check/generated.d.ts +2 -0
  529. package/types/check/generated.d.ts.map +1 -1
  530. package/types/check/guard-options.d.ts +3 -0
  531. package/types/check/guard-options.d.ts.map +1 -0
  532. package/types/check/hook-context.d.ts +3 -0
  533. package/types/check/hook-context.d.ts.map +1 -0
  534. package/types/check/hook-names.d.ts +3 -0
  535. package/types/check/hook-names.d.ts.map +1 -0
  536. package/types/check/i18n-keys.d.ts +3 -0
  537. package/types/check/i18n-keys.d.ts.map +1 -0
  538. package/types/check/images-keys.d.ts +3 -0
  539. package/types/check/images-keys.d.ts.map +1 -0
  540. package/types/check/index.d.ts +7 -4
  541. package/types/check/index.d.ts.map +1 -1
  542. package/types/check/job-shapes.d.ts +6 -0
  543. package/types/check/job-shapes.d.ts.map +1 -0
  544. package/types/check/live-api.d.ts +3 -0
  545. package/types/check/live-api.d.ts.map +1 -0
  546. package/types/check/mail-api.d.ts +3 -0
  547. package/types/check/mail-api.d.ts.map +1 -0
  548. package/types/check/moved-keys.d.ts +10 -0
  549. package/types/check/moved-keys.d.ts.map +1 -0
  550. package/types/check/one-state-api.d.ts +9 -0
  551. package/types/check/one-state-api.d.ts.map +1 -0
  552. package/types/check/output-schema.d.ts +1 -1
  553. package/types/check/output-schema.d.ts.map +1 -1
  554. package/types/check/page-heads.d.ts.map +1 -1
  555. package/types/check/pages-options.d.ts +3 -0
  556. package/types/check/pages-options.d.ts.map +1 -0
  557. package/types/check/project.d.ts.map +1 -1
  558. package/types/check/rate-enforce.d.ts +3 -0
  559. package/types/check/rate-enforce.d.ts.map +1 -0
  560. package/types/check/refusal-calls.d.ts +3 -0
  561. package/types/check/refusal-calls.d.ts.map +1 -0
  562. package/types/check/regroup.d.ts +8 -0
  563. package/types/check/regroup.d.ts.map +1 -0
  564. package/types/check/renamed-packages.d.ts.map +1 -1
  565. package/types/check/retired-lints.d.ts +3 -0
  566. package/types/check/retired-lints.d.ts.map +1 -0
  567. package/types/check/route-keys.d.ts +3 -0
  568. package/types/check/route-keys.d.ts.map +1 -0
  569. package/types/check/route-shadow.d.ts +12 -0
  570. package/types/check/route-shadow.d.ts.map +1 -0
  571. package/types/check/secret-keys.d.ts +3 -0
  572. package/types/check/secret-keys.d.ts.map +1 -0
  573. package/types/check/seo.d.ts +3 -1
  574. package/types/check/seo.d.ts.map +1 -1
  575. package/types/check/shadow-types.d.ts +1 -0
  576. package/types/check/shadow-types.d.ts.map +1 -1
  577. package/types/check/shadow.d.ts +1 -0
  578. package/types/check/shadow.d.ts.map +1 -1
  579. package/types/check/socket-frames.d.ts +3 -0
  580. package/types/check/socket-frames.d.ts.map +1 -0
  581. package/types/check/source-readers.d.ts +3 -0
  582. package/types/check/source-readers.d.ts.map +1 -0
  583. package/types/check/store-ms.d.ts +3 -0
  584. package/types/check/store-ms.d.ts.map +1 -0
  585. package/types/check/store-names.d.ts +3 -0
  586. package/types/check/store-names.d.ts.map +1 -0
  587. package/types/check/template-hints.d.ts +2 -0
  588. package/types/check/template-hints.d.ts.map +1 -1
  589. package/types/check/test-helpers.d.ts +3 -0
  590. package/types/check/test-helpers.d.ts.map +1 -0
  591. package/types/check/ttl-names.d.ts +3 -0
  592. package/types/check/ttl-names.d.ts.map +1 -0
  593. package/types/commands/check.d.ts.map +1 -1
  594. package/types/commands/env.d.ts.map +1 -1
  595. package/types/commands/explain-island.d.ts.map +1 -1
  596. package/types/commands/routes.d.ts.map +1 -1
  597. package/types/compiler/a11y.d.ts.map +1 -1
  598. package/types/compiler/aria.d.ts +1 -0
  599. package/types/compiler/aria.d.ts.map +1 -1
  600. package/types/compiler/ast.d.ts +13 -16
  601. package/types/compiler/ast.d.ts.map +1 -1
  602. package/types/compiler/bound-props.d.ts +16 -0
  603. package/types/compiler/bound-props.d.ts.map +1 -0
  604. package/types/compiler/browser.d.ts.map +1 -1
  605. package/types/compiler/button-forms.d.ts +3 -0
  606. package/types/compiler/button-forms.d.ts.map +1 -0
  607. package/types/compiler/codegen.d.ts +2 -1
  608. package/types/compiler/codegen.d.ts.map +1 -1
  609. package/types/compiler/deprecated-ai-labels.d.ts +5 -0
  610. package/types/compiler/deprecated-ai-labels.d.ts.map +1 -0
  611. package/types/compiler/deprecated-ai-links.d.ts +5 -0
  612. package/types/compiler/deprecated-ai-links.d.ts.map +1 -0
  613. package/types/compiler/deprecated-allow.d.ts +5 -0
  614. package/types/compiler/deprecated-allow.d.ts.map +1 -0
  615. package/types/compiler/deprecated-auth-lints.d.ts +12 -0
  616. package/types/compiler/deprecated-auth-lints.d.ts.map +1 -0
  617. package/types/compiler/deprecated-auth-signed.d.ts +5 -0
  618. package/types/compiler/deprecated-auth-signed.d.ts.map +1 -0
  619. package/types/compiler/deprecated-children.d.ts +4 -0
  620. package/types/compiler/deprecated-children.d.ts.map +1 -0
  621. package/types/compiler/deprecated-image.d.ts +5 -0
  622. package/types/compiler/deprecated-image.d.ts.map +1 -0
  623. package/types/compiler/deprecated-island.d.ts +9 -0
  624. package/types/compiler/deprecated-island.d.ts.map +1 -0
  625. package/types/compiler/deprecated-library.d.ts +4 -0
  626. package/types/compiler/deprecated-library.d.ts.map +1 -0
  627. package/types/compiler/deprecated-lints.d.ts +527 -20
  628. package/types/compiler/deprecated-lints.d.ts.map +1 -1
  629. package/types/compiler/deprecated-page.d.ts +4 -0
  630. package/types/compiler/deprecated-page.d.ts.map +1 -0
  631. package/types/compiler/deprecated-parts.d.ts +3 -0
  632. package/types/compiler/deprecated-parts.d.ts.map +1 -0
  633. package/types/compiler/deprecated-ui-callbacks.d.ts +5 -0
  634. package/types/compiler/deprecated-ui-callbacks.d.ts.map +1 -0
  635. package/types/compiler/deprecated-ui-input.d.ts +5 -0
  636. package/types/compiler/deprecated-ui-input.d.ts.map +1 -0
  637. package/types/compiler/deprecated-ui-items.d.ts +5 -0
  638. package/types/compiler/deprecated-ui-items.d.ts.map +1 -0
  639. package/types/compiler/deprecated-ui-props.d.ts.map +1 -1
  640. package/types/compiler/dom-fields.d.ts +7 -0
  641. package/types/compiler/dom-fields.d.ts.map +1 -0
  642. package/types/compiler/dom.d.ts +4 -2
  643. package/types/compiler/dom.d.ts.map +1 -1
  644. package/types/compiler/errors.d.ts +43 -18
  645. package/types/compiler/errors.d.ts.map +1 -1
  646. package/types/compiler/fence-checks.d.ts.map +1 -1
  647. package/types/compiler/form-action.d.ts +8 -0
  648. package/types/compiler/form-action.d.ts.map +1 -0
  649. package/types/compiler/form-info.d.ts +29 -0
  650. package/types/compiler/form-info.d.ts.map +1 -0
  651. package/types/compiler/head-shorthand.d.ts +16 -0
  652. package/types/compiler/head-shorthand.d.ts.map +1 -0
  653. package/types/compiler/head-tags.d.ts +7 -0
  654. package/types/compiler/head-tags.d.ts.map +1 -0
  655. package/types/compiler/helper-imports.d.ts +5 -0
  656. package/types/compiler/helper-imports.d.ts.map +1 -0
  657. package/types/compiler/html-initial.d.ts +16 -0
  658. package/types/compiler/html-initial.d.ts.map +1 -0
  659. package/types/compiler/html-parts.d.ts +13 -0
  660. package/types/compiler/html-parts.d.ts.map +1 -0
  661. package/types/compiler/html.d.ts +3 -2
  662. package/types/compiler/html.d.ts.map +1 -1
  663. package/types/compiler/if-alias.d.ts.map +1 -1
  664. package/types/compiler/image-attributes.d.ts +22 -0
  665. package/types/compiler/image-attributes.d.ts.map +1 -0
  666. package/types/compiler/index.d.ts +2 -0
  667. package/types/compiler/index.d.ts.map +1 -1
  668. package/types/compiler/island-arguments.d.ts +6 -1
  669. package/types/compiler/island-arguments.d.ts.map +1 -1
  670. package/types/compiler/island-cause.d.ts +1 -1
  671. package/types/compiler/island-cause.d.ts.map +1 -1
  672. package/types/compiler/island-declaration.d.ts +30 -0
  673. package/types/compiler/island-declaration.d.ts.map +1 -0
  674. package/types/compiler/island-marker.d.ts.map +1 -1
  675. package/types/compiler/items.d.ts +3 -0
  676. package/types/compiler/items.d.ts.map +1 -1
  677. package/types/compiler/jsx-class.d.ts +2 -1
  678. package/types/compiler/jsx-class.d.ts.map +1 -1
  679. package/types/compiler/jsx-field.d.ts +13 -0
  680. package/types/compiler/jsx-field.d.ts.map +1 -0
  681. package/types/compiler/jsx.d.ts +1 -0
  682. package/types/compiler/jsx.d.ts.map +1 -1
  683. package/types/compiler/kay-exports.d.ts.map +1 -1
  684. package/types/compiler/link-flags.d.ts +12 -0
  685. package/types/compiler/link-flags.d.ts.map +1 -0
  686. package/types/compiler/lints.d.ts +562 -54
  687. package/types/compiler/lints.d.ts.map +1 -1
  688. package/types/compiler/live-reads.d.ts +13 -0
  689. package/types/compiler/live-reads.d.ts.map +1 -0
  690. package/types/compiler/loop-lints.d.ts +4 -4
  691. package/types/compiler/loop-lints.d.ts.map +1 -1
  692. package/types/compiler/markup-fields.d.ts +8 -0
  693. package/types/compiler/markup-fields.d.ts.map +1 -0
  694. package/types/compiler/markup.d.ts +9 -5
  695. package/types/compiler/markup.d.ts.map +1 -1
  696. package/types/compiler/module-signals.d.ts.map +1 -1
  697. package/types/compiler/names.d.ts +4 -0
  698. package/types/compiler/names.d.ts.map +1 -1
  699. package/types/compiler/old-parts.d.ts +9 -0
  700. package/types/compiler/old-parts.d.ts.map +1 -0
  701. package/types/compiler/page-settings.d.ts +1 -0
  702. package/types/compiler/page-settings.d.ts.map +1 -1
  703. package/types/compiler/parser.d.ts.map +1 -1
  704. package/types/compiler/plan.d.ts +1 -0
  705. package/types/compiler/plan.d.ts.map +1 -1
  706. package/types/compiler/rewrite-reads.d.ts +8 -0
  707. package/types/compiler/rewrite-reads.d.ts.map +1 -1
  708. package/types/compiler/rewrite-types.d.ts +1 -0
  709. package/types/compiler/rewrite-types.d.ts.map +1 -1
  710. package/types/compiler/rewrite.d.ts.map +1 -1
  711. package/types/compiler/route-lints.d.ts +13 -6
  712. package/types/compiler/route-lints.d.ts.map +1 -1
  713. package/types/compiler/script-props.d.ts.map +1 -1
  714. package/types/compiler/script-server.d.ts.map +1 -1
  715. package/types/compiler/script-shared.d.ts +8 -0
  716. package/types/compiler/script-shared.d.ts.map +1 -1
  717. package/types/compiler/script.d.ts.map +1 -1
  718. package/types/compiler/server-imports.d.ts +4 -0
  719. package/types/compiler/server-imports.d.ts.map +1 -0
  720. package/types/compiler/slot-types.d.ts +13 -0
  721. package/types/compiler/slot-types.d.ts.map +1 -0
  722. package/types/compiler/style-arguments.d.ts +6 -0
  723. package/types/compiler/style-arguments.d.ts.map +1 -0
  724. package/types/compiler/template-walk.d.ts +7 -0
  725. package/types/compiler/template-walk.d.ts.map +1 -0
  726. package/types/compiler/type-parameters.d.ts +3 -0
  727. package/types/compiler/type-parameters.d.ts.map +1 -0
  728. package/types/compiler/validate-fields.d.ts +10 -0
  729. package/types/compiler/validate-fields.d.ts.map +1 -0
  730. package/types/compiler/validate.d.ts.map +1 -1
  731. package/types/config-extensions.d.ts +3 -1
  732. package/types/config-extensions.d.ts.map +1 -1
  733. package/types/config-loader.d.ts +2 -2
  734. package/types/config-loader.d.ts.map +1 -1
  735. package/types/config-resolve.d.ts +3 -0
  736. package/types/config-resolve.d.ts.map +1 -0
  737. package/types/config-shape.d.ts +2 -1
  738. package/types/config-shape.d.ts.map +1 -1
  739. package/types/config-switch.d.ts +10 -0
  740. package/types/config-switch.d.ts.map +1 -0
  741. package/types/config.d.ts +228 -67
  742. package/types/config.d.ts.map +1 -1
  743. package/types/generate-resource.d.ts.map +1 -1
  744. package/types/lsp/diagnostics.d.ts.map +1 -1
  745. package/types/lsp/route-documents.d.ts +4 -0
  746. package/types/lsp/route-documents.d.ts.map +1 -0
  747. package/types/lsp/server.d.ts +3 -0
  748. package/types/lsp/server.d.ts.map +1 -1
  749. package/types/project.d.ts +7 -4
  750. package/types/project.d.ts.map +1 -1
  751. package/types/runtime/action-call.d.ts +11 -3
  752. package/types/runtime/action-call.d.ts.map +1 -1
  753. package/types/runtime/action-encode.d.ts.map +1 -1
  754. package/types/runtime/action-error.d.ts.map +1 -1
  755. package/types/runtime/action-form.d.ts +10 -3
  756. package/types/runtime/action-form.d.ts.map +1 -1
  757. package/types/runtime/action-navigate.d.ts +1 -0
  758. package/types/runtime/action-navigate.d.ts.map +1 -1
  759. package/types/runtime/action-owner.d.ts +1 -0
  760. package/types/runtime/action-owner.d.ts.map +1 -1
  761. package/types/runtime/action-post.d.ts.map +1 -1
  762. package/types/runtime/action-protection.d.ts.map +1 -1
  763. package/types/runtime/action-shared.d.ts +76 -15
  764. package/types/runtime/action-shared.d.ts.map +1 -1
  765. package/types/runtime/action-stream.d.ts +1 -1
  766. package/types/runtime/action-stream.d.ts.map +1 -1
  767. package/types/runtime/action.d.ts +5 -5
  768. package/types/runtime/action.d.ts.map +1 -1
  769. package/types/runtime/api-url.d.ts.map +1 -1
  770. package/types/runtime/await-failed.d.ts +8 -0
  771. package/types/runtime/await-failed.d.ts.map +1 -0
  772. package/types/runtime/await.d.ts +2 -2
  773. package/types/runtime/await.d.ts.map +1 -1
  774. package/types/runtime/await.server.d.ts +6 -3
  775. package/types/runtime/await.server.d.ts.map +1 -1
  776. package/types/runtime/button-form.d.ts +3 -0
  777. package/types/runtime/button-form.d.ts.map +1 -0
  778. package/types/runtime/cache-hooks.d.ts +10 -0
  779. package/types/runtime/cache-hooks.d.ts.map +1 -0
  780. package/types/runtime/cache-live-id.d.ts +3 -0
  781. package/types/runtime/cache-live-id.d.ts.map +1 -1
  782. package/types/runtime/cache.d.ts +1 -5
  783. package/types/runtime/cache.d.ts.map +1 -1
  784. package/types/runtime/call-result.d.ts +18 -9
  785. package/types/runtime/call-result.d.ts.map +1 -1
  786. package/types/runtime/checks.d.ts +13 -10
  787. package/types/runtime/checks.d.ts.map +1 -1
  788. package/types/runtime/consent.d.ts.map +1 -1
  789. package/types/runtime/core.d.ts +48 -9
  790. package/types/runtime/core.d.ts.map +1 -1
  791. package/types/runtime/dispatch.d.ts +8 -0
  792. package/types/runtime/dispatch.d.ts.map +1 -0
  793. package/types/runtime/dom-await.d.ts +1 -1
  794. package/types/runtime/dom-await.d.ts.map +1 -1
  795. package/types/runtime/dom-image.d.ts +1 -1
  796. package/types/runtime/dom-image.d.ts.map +1 -1
  797. package/types/runtime/duration-words.d.ts.map +1 -1
  798. package/types/runtime/duration.d.ts.map +1 -1
  799. package/types/runtime/edit.d.ts.map +1 -1
  800. package/types/runtime/env.d.ts.map +1 -1
  801. package/types/runtime/forms.d.ts.map +1 -1
  802. package/types/runtime/head.d.ts.map +1 -1
  803. package/types/runtime/html.d.ts +3 -2
  804. package/types/runtime/html.d.ts.map +1 -1
  805. package/types/runtime/i18n.client.d.ts +4 -1
  806. package/types/runtime/i18n.client.d.ts.map +1 -1
  807. package/types/runtime/i18n.d.ts +22 -7
  808. package/types/runtime/i18n.d.ts.map +1 -1
  809. package/types/runtime/i18n.server.d.ts +4 -1
  810. package/types/runtime/i18n.server.d.ts.map +1 -1
  811. package/types/runtime/image.d.ts +1 -1
  812. package/types/runtime/image.d.ts.map +1 -1
  813. package/types/runtime/index.d.ts +9 -8
  814. package/types/runtime/index.d.ts.map +1 -1
  815. package/types/runtime/internal.d.ts +2 -1
  816. package/types/runtime/internal.d.ts.map +1 -1
  817. package/types/runtime/invalidated-keys.d.ts +2 -0
  818. package/types/runtime/invalidated-keys.d.ts.map +1 -0
  819. package/types/runtime/island.server.d.ts.map +1 -1
  820. package/types/runtime/jsx.d.ts +7 -0
  821. package/types/runtime/jsx.d.ts.map +1 -1
  822. package/types/runtime/kay-error.d.ts +14 -0
  823. package/types/runtime/kay-error.d.ts.map +1 -0
  824. package/types/runtime/leave.d.ts.map +1 -1
  825. package/types/runtime/live-cache.d.ts +1 -0
  826. package/types/runtime/live-cache.d.ts.map +1 -1
  827. package/types/runtime/live-resource.server.d.ts.map +1 -1
  828. package/types/runtime/live-revalidate.d.ts +9 -0
  829. package/types/runtime/live-revalidate.d.ts.map +1 -0
  830. package/types/runtime/live-value.client.d.ts.map +1 -1
  831. package/types/runtime/live-value.d.ts +3 -0
  832. package/types/runtime/live-value.d.ts.map +1 -1
  833. package/types/runtime/live-value.server.d.ts.map +1 -1
  834. package/types/runtime/live-value.shared.d.ts +38 -6
  835. package/types/runtime/live-value.shared.d.ts.map +1 -1
  836. package/types/runtime/live.d.ts +41 -42
  837. package/types/runtime/live.d.ts.map +1 -1
  838. package/types/runtime/local-types.d.ts +86 -0
  839. package/types/runtime/local-types.d.ts.map +1 -0
  840. package/types/runtime/local.d.ts +1 -70
  841. package/types/runtime/local.d.ts.map +1 -1
  842. package/types/runtime/log.d.ts.map +1 -1
  843. package/types/runtime/mount.compat.d.ts +7 -0
  844. package/types/runtime/mount.compat.d.ts.map +1 -0
  845. package/types/runtime/navigate-api.d.ts +10 -4
  846. package/types/runtime/navigate-api.d.ts.map +1 -1
  847. package/types/runtime/navigation-state.d.ts +19 -0
  848. package/types/runtime/navigation-state.d.ts.map +1 -1
  849. package/types/runtime/page-swap.d.ts.map +1 -1
  850. package/types/runtime/persist.d.ts.map +1 -1
  851. package/types/runtime/persisted.d.ts +25 -29
  852. package/types/runtime/persisted.d.ts.map +1 -1
  853. package/types/runtime/presence.d.ts +6 -3
  854. package/types/runtime/presence.d.ts.map +1 -1
  855. package/types/runtime/queue-jobs.d.ts.map +1 -1
  856. package/types/runtime/reactive.d.ts.map +1 -1
  857. package/types/runtime/refuse.d.ts +8 -1
  858. package/types/runtime/refuse.d.ts.map +1 -1
  859. package/types/runtime/resource-tags.d.ts +4 -0
  860. package/types/runtime/resource-tags.d.ts.map +1 -0
  861. package/types/runtime/route.d.ts.map +1 -1
  862. package/types/runtime/sanitize.d.ts.map +1 -1
  863. package/types/runtime/schema.client.d.ts.map +1 -1
  864. package/types/runtime/schema.d.ts.map +1 -1
  865. package/types/runtime/send.d.ts.map +1 -1
  866. package/types/runtime/shortcut.d.ts +1 -0
  867. package/types/runtime/shortcut.d.ts.map +1 -1
  868. package/types/runtime/socket-message.d.ts +7 -0
  869. package/types/runtime/socket-message.d.ts.map +1 -0
  870. package/types/runtime/store-base.d.ts +4 -0
  871. package/types/runtime/store-base.d.ts.map +1 -1
  872. package/types/runtime/swap-fetch.d.ts.map +1 -1
  873. package/types/runtime/swap.d.ts +2 -0
  874. package/types/runtime/swap.d.ts.map +1 -1
  875. package/types/runtime/template-context.d.ts.map +1 -1
  876. package/types/runtime/values.d.ts.map +1 -1
  877. package/types/runtime/wire.d.ts +1 -0
  878. package/types/runtime/wire.d.ts.map +1 -1
  879. package/types/runtime/with-query.d.ts.map +1 -1
  880. package/types/runtime/work.d.ts.map +1 -1
  881. package/types/server/action-hooks.d.ts +4 -4
  882. package/types/server/action-hooks.d.ts.map +1 -1
  883. package/types/server/action-iterable.d.ts +2 -1
  884. package/types/server/action-iterable.d.ts.map +1 -1
  885. package/types/server/actions.d.ts +3 -2
  886. package/types/server/actions.d.ts.map +1 -1
  887. package/types/server/analytics-server.d.ts.map +1 -1
  888. package/types/server/api-modules.d.ts +16 -13
  889. package/types/server/api-modules.d.ts.map +1 -1
  890. package/types/server/api.d.ts +6 -3
  891. package/types/server/api.d.ts.map +1 -1
  892. package/types/server/app-database.d.ts +2 -0
  893. package/types/server/app-database.d.ts.map +1 -1
  894. package/types/server/app-hooks.d.ts +10 -2
  895. package/types/server/app-hooks.d.ts.map +1 -1
  896. package/types/server/app-stages.d.ts +21 -26
  897. package/types/server/app-stages.d.ts.map +1 -1
  898. package/types/server/app.d.ts +21 -24
  899. package/types/server/app.d.ts.map +1 -1
  900. package/types/server/auth-mails.d.ts +5 -0
  901. package/types/server/auth-mails.d.ts.map +1 -1
  902. package/types/server/basic-auth.d.ts +2 -5
  903. package/types/server/basic-auth.d.ts.map +1 -1
  904. package/types/server/bundle.d.ts +1 -0
  905. package/types/server/bundle.d.ts.map +1 -1
  906. package/types/server/button-form-rule.d.ts +4 -0
  907. package/types/server/button-form-rule.d.ts.map +1 -0
  908. package/types/server/card.d.ts +1 -1
  909. package/types/server/card.d.ts.map +1 -1
  910. package/types/server/config-limits.d.ts +5 -5
  911. package/types/server/config-limits.d.ts.map +1 -1
  912. package/types/server/context-values.d.ts.map +1 -1
  913. package/types/server/cookies.d.ts +2 -2
  914. package/types/server/cookies.d.ts.map +1 -1
  915. package/types/server/endpoints.d.ts.map +1 -1
  916. package/types/server/errors.d.ts +2 -2
  917. package/types/server/errors.d.ts.map +1 -1
  918. package/types/server/event-stream.d.ts +1 -1
  919. package/types/server/event-stream.d.ts.map +1 -1
  920. package/types/server/favicon.d.ts +7 -3
  921. package/types/server/favicon.d.ts.map +1 -1
  922. package/types/server/fetch-public.d.ts.map +1 -1
  923. package/types/server/file-answer.d.ts +17 -0
  924. package/types/server/file-answer.d.ts.map +1 -0
  925. package/types/server/forms.d.ts +1 -1
  926. package/types/server/forms.d.ts.map +1 -1
  927. package/types/server/guard-requirement.d.ts +6 -0
  928. package/types/server/guard-requirement.d.ts.map +1 -1
  929. package/types/server/guards.d.ts +11 -0
  930. package/types/server/guards.d.ts.map +1 -1
  931. package/types/server/hooks.d.ts +8 -8
  932. package/types/server/hooks.d.ts.map +1 -1
  933. package/types/server/i18n.d.ts.map +1 -1
  934. package/types/server/image-limits.d.ts.map +1 -1
  935. package/types/server/image.d.ts +8 -13
  936. package/types/server/image.d.ts.map +1 -1
  937. package/types/server/index.d.ts +12 -8
  938. package/types/server/index.d.ts.map +1 -1
  939. package/types/server/job-context.d.ts +16 -0
  940. package/types/server/job-context.d.ts.map +1 -0
  941. package/types/server/jobs-page.d.ts +1 -1
  942. package/types/server/jobs-page.d.ts.map +1 -1
  943. package/types/server/jobs.d.ts +22 -4
  944. package/types/server/jobs.d.ts.map +1 -1
  945. package/types/server/kept-exports.d.ts.map +1 -1
  946. package/types/server/kv.d.ts +5 -4
  947. package/types/server/kv.d.ts.map +1 -1
  948. package/types/server/lazy-guard.d.ts +2 -1
  949. package/types/server/lazy-guard.d.ts.map +1 -1
  950. package/types/server/library.d.ts +5 -2
  951. package/types/server/library.d.ts.map +1 -1
  952. package/types/server/lifecycle.d.ts +2 -2
  953. package/types/server/lifecycle.d.ts.map +1 -1
  954. package/types/server/link-schemes.d.ts +1 -1
  955. package/types/server/link-schemes.d.ts.map +1 -1
  956. package/types/server/live.d.ts +5 -0
  957. package/types/server/live.d.ts.map +1 -1
  958. package/types/server/loader.d.ts.map +1 -1
  959. package/types/server/log.d.ts +7 -1
  960. package/types/server/log.d.ts.map +1 -1
  961. package/types/server/mcp-key.d.ts +2 -3
  962. package/types/server/mcp-key.d.ts.map +1 -1
  963. package/types/server/mcp.d.ts +1 -0
  964. package/types/server/mcp.d.ts.map +1 -1
  965. package/types/server/metrics.d.ts +9 -2
  966. package/types/server/metrics.d.ts.map +1 -1
  967. package/types/server/moved-exports.d.ts +12 -0
  968. package/types/server/moved-exports.d.ts.map +1 -0
  969. package/types/server/not-found-config.d.ts.map +1 -1
  970. package/types/server/openapi.d.ts +5 -5
  971. package/types/server/openapi.d.ts.map +1 -1
  972. package/types/server/over-limit.d.ts +9 -0
  973. package/types/server/over-limit.d.ts.map +1 -0
  974. package/types/server/page-seo.d.ts +3 -0
  975. package/types/server/page-seo.d.ts.map +1 -0
  976. package/types/server/page-settings.d.ts +5 -1
  977. package/types/server/page-settings.d.ts.map +1 -1
  978. package/types/server/pg-data.d.ts.map +1 -1
  979. package/types/server/pg-jobs.d.ts.map +1 -1
  980. package/types/server/pg-limit.d.ts.map +1 -1
  981. package/types/server/pg-live.d.ts.map +1 -1
  982. package/types/server/pg-not-found.d.ts.map +1 -1
  983. package/types/server/pg-poll.d.ts +2 -2
  984. package/types/server/pg-poll.d.ts.map +1 -1
  985. package/types/server/pg-redirects.d.ts.map +1 -1
  986. package/types/server/pg-stores.d.ts.map +1 -1
  987. package/types/server/prerender.d.ts.map +1 -1
  988. package/types/server/preview.d.ts +1 -1
  989. package/types/server/preview.d.ts.map +1 -1
  990. package/types/server/protection.d.ts +1 -2
  991. package/types/server/protection.d.ts.map +1 -1
  992. package/types/server/proxy-key.d.ts +3 -3
  993. package/types/server/proxy-key.d.ts.map +1 -1
  994. package/types/server/pure-page.d.ts.map +1 -1
  995. package/types/server/push-crypto.d.ts.map +1 -1
  996. package/types/server/push-server.d.ts.map +1 -1
  997. package/types/server/queue-scheduler.d.ts +1 -0
  998. package/types/server/queue-scheduler.d.ts.map +1 -1
  999. package/types/server/queue.d.ts +6 -7
  1000. package/types/server/queue.d.ts.map +1 -1
  1001. package/types/server/rate-limit.d.ts +6 -1
  1002. package/types/server/rate-limit.d.ts.map +1 -1
  1003. package/types/server/rate-windows.d.ts +3 -0
  1004. package/types/server/rate-windows.d.ts.map +1 -0
  1005. package/types/server/redirects.d.ts.map +1 -1
  1006. package/types/server/remote.d.ts.map +1 -1
  1007. package/types/server/render-document.d.ts +1 -0
  1008. package/types/server/render-document.d.ts.map +1 -1
  1009. package/types/server/report.d.ts +3 -3
  1010. package/types/server/report.d.ts.map +1 -1
  1011. package/types/server/request-record.d.ts +1 -0
  1012. package/types/server/request-record.d.ts.map +1 -1
  1013. package/types/server/resources.d.ts.map +1 -1
  1014. package/types/server/rooms.d.ts +34 -4
  1015. package/types/server/rooms.d.ts.map +1 -1
  1016. package/types/server/route-settings.d.ts +9 -0
  1017. package/types/server/route-settings.d.ts.map +1 -0
  1018. package/types/server/routes.d.ts +1 -6
  1019. package/types/server/routes.d.ts.map +1 -1
  1020. package/types/server/secret.d.ts +12 -0
  1021. package/types/server/secret.d.ts.map +1 -0
  1022. package/types/server/security.d.ts +4 -5
  1023. package/types/server/security.d.ts.map +1 -1
  1024. package/types/server/seo.d.ts.map +1 -1
  1025. package/types/server/served-paths.d.ts.map +1 -1
  1026. package/types/server/session.d.ts +8 -2
  1027. package/types/server/session.d.ts.map +1 -1
  1028. package/types/server/setup.d.ts.map +1 -1
  1029. package/types/server/signals.d.ts +3 -1
  1030. package/types/server/signals.d.ts.map +1 -1
  1031. package/types/server/signed.d.ts +2 -0
  1032. package/types/server/signed.d.ts.map +1 -1
  1033. package/types/server/sitemap.d.ts +4 -3
  1034. package/types/server/sitemap.d.ts.map +1 -1
  1035. package/types/server/socket.d.ts +51 -0
  1036. package/types/server/socket.d.ts.map +1 -0
  1037. package/types/server/source.d.ts +4 -3
  1038. package/types/server/source.d.ts.map +1 -1
  1039. package/types/server/sqlite-live.d.ts.map +1 -1
  1040. package/types/server/storage.d.ts +10 -2
  1041. package/types/server/storage.d.ts.map +1 -1
  1042. package/types/server/stream.d.ts +3 -3
  1043. package/types/server/stream.d.ts.map +1 -1
  1044. package/types/server/uncaught.d.ts +2 -2
  1045. package/types/server/uncaught.d.ts.map +1 -1
  1046. package/types/server/violations.d.ts +2 -2
  1047. package/types/server/violations.d.ts.map +1 -1
  1048. package/types/server/vitals-server.d.ts.map +1 -1
  1049. package/types/server/vitals.d.ts +1 -0
  1050. package/types/server/vitals.d.ts.map +1 -1
  1051. package/types/server/words.d.ts +3 -0
  1052. package/types/server/words.d.ts.map +1 -1
  1053. package/types/server/work-scope.d.ts +2 -0
  1054. package/types/server/work-scope.d.ts.map +1 -1
  1055. package/types/server/work.d.ts +2 -2
  1056. package/types/server/work.d.ts.map +1 -1
  1057. package/types/server/workers.d.ts.map +1 -1
  1058. package/types/server/workflow.d.ts +4 -5
  1059. package/types/server/workflow.d.ts.map +1 -1
  1060. package/types/server/ws-limits.d.ts +15 -6
  1061. package/types/server/ws-limits.d.ts.map +1 -1
  1062. package/types/test/a11y.d.ts +3 -0
  1063. package/types/test/a11y.d.ts.map +1 -0
  1064. package/types/test/browser.d.ts.map +1 -1
  1065. package/types/test/index.d.ts +8 -2
  1066. package/types/test/index.d.ts.map +1 -1
  1067. package/types/test/mount.d.ts.map +1 -1
  1068. package/types/test/outgoing.d.ts +12 -0
  1069. package/types/test/outgoing.d.ts.map +1 -0
  1070. package/types/test/page-types.d.ts +2 -0
  1071. package/types/test/page-types.d.ts.map +1 -1
  1072. package/types/test/screenshot-match.d.ts +7 -0
  1073. package/types/test/screenshot-match.d.ts.map +1 -0
  1074. package/types/test/service.d.ts +2 -0
  1075. package/types/test/service.d.ts.map +1 -1
  1076. package/types/test/site-actions.d.ts +2 -2
  1077. package/types/test/site-actions.d.ts.map +1 -1
  1078. package/types/test/site-keys.d.ts +10 -0
  1079. package/types/test/site-keys.d.ts.map +1 -0
  1080. package/types/test/site-socket.d.ts.map +1 -1
  1081. package/types/test/site-types.d.ts +32 -9
  1082. package/types/test/site-types.d.ts.map +1 -1
  1083. package/types/test/site-world.d.ts +11 -0
  1084. package/types/test/site-world.d.ts.map +1 -0
  1085. package/src/check/local-state.ts +0 -132
  1086. package/src/check/persisted-storage.ts +0 -87
  1087. package/types/check/local-state.d.ts +0 -3
  1088. package/types/check/local-state.d.ts.map +0 -1
  1089. package/types/check/persisted-storage.d.ts +0 -3
  1090. package/types/check/persisted-storage.d.ts.map +0 -1
@@ -16,7 +16,7 @@ import { removeTodo, saveTodo } from '../data'
16
16
  export const save = action(s.Object({ id: s.String({ maxLength: 40 }), title: s.String({ minLength: 1, maxLength: 200 }), rev: s.Number() }), async (todo, ctx) => {
17
17
  const held = await saveTodo(todo)
18
18
 
19
- return held.conflict ? ctx.fail(409, held.row) : held.row
19
+ return held.conflict ? ctx.deny(409, { data: held.row }) : held.row
20
20
  })
21
21
  export const remove = action(s.Object({ id: s.String({ maxLength: 40 }) }), async ({ id }) => removeTodo(id))
22
22
  ---
@@ -31,20 +31,20 @@ import { call, local } from 'kay'
31
31
  import { remove, save } from '../routes/todos.kay'
32
32
  import todosApi from '../api/todos'
33
33
 
34
- const todos = local({ key: 'id', read: async signal => call(todosApi, '/', { signal }), put: save, remove })
34
+ const todos = local({ key: 'id', read: async signal => call(todosApi, '/', { signal }).orThrow(), put: save, remove })
35
35
  ---
36
- p {todos.unsynced()} waiting for the server, {todos.syncStatus()}
36
+ p {todos.sync.queued()} waiting for the server, {todos.sync.status()}
37
37
  ul
38
- for todo of todos.rows()
38
+ for todo of todos.data()
39
39
  li {todo.title}
40
40
  button(onClick={() => todos.put({ id: crypto.randomUUID(), title: 'New', rev: 0 })}) Add
41
41
  ```
42
42
 
43
- `todos.put(row)` and `todos.remove(key)` change `todos.rows()` at once and resolve when the browser holds the change. Nothing else is declared: the row type is the `put` action's input.
43
+ `todos.put(row)` and `todos.remove(key)` change `todos.data()` at once and resolve when the browser holds the change. Nothing else is declared: the row type is the `put` action's input.
44
44
 
45
45
  ### Decide a conflict
46
46
 
47
- An action answers `ctx.fail(409, row)` with the row the server holds when a write started from an older one. The default keeps the server's row and puts the fields this write changed on it, then sends that; `conflict` replaces it, and returning `undefined` takes the server's row as it is:
47
+ An action answers `ctx.deny(409, { data: row })` with the row the server holds when a write started from an older one. The default keeps the server's row and puts the fields this write changed on it, then sends that; `conflict` replaces it, and returning `undefined` takes the server's row as it is:
48
48
 
49
49
  ```kay
50
50
  ---
@@ -61,10 +61,10 @@ for issue of todos.issues()
61
61
 
62
62
  ### What a collection is
63
63
 
64
- - `local({ key, read, put, remove?, version?, conflict?, onSync?, onIssue?, onError? })` returns `rows()`, `get(key)`, `put(row)`, `remove(key)`, `unsynced()`, `syncStatus()`, `error()`, `retry()`, `issues()`, `dismiss(id)`, `sync()`, `clear()` and the hooks `onSync`, `onIssue` and `onError` as methods. `rows()`, `unsynced()`, `syncStatus()`, `error()` and `issues()` are reactive; the rows come in key order. `pending()` (the count `unsynced()` reads) and `status()` (`syncStatus()` with `'pending'` for `'unsynced'`) work until 2.0, which gives them the meaning they have on every source, a boolean and `idle|loading|ready|failed`; `deprecated-local-state` flags them.
64
+ - `local({ key, read, put, remove?, version?, conflict?, onData?, onIssue?, onError? })` returns `data()`, `status()`, `pending()`, `error()`, `retry()`, `get(key)`, `put(row)`, `remove(key)`, `issues()`, `dismiss(id)`, `sync`, `clear()` and the hooks `onData`, `onIssue` and `onError` as methods. `data()`, `status()`, `pending()`, `error()`, `sync.status()`, `sync.queued()` and `issues()` are reactive; the rows come in key order. `data()`, `status()`, `pending()`, `error()`, `retry()`, `onData` and `onError` are what every source has ([Island sources](island-sources.md)): `status()` is `loading` until the browser's copy is read, then `ready`, or `failed` while `error()` is set, and `pending()` is true while it loads. What is a collection's own, its sync with the server, is under `sync`: `sync()` sends the queue and reads the server's rows again, `sync.status()` says where it stands and `sync.queued()` counts the writes the server has not taken. Before 1.105 `rows()`, `unsynced()`, `syncStatus()` and `onSync({ rows })` did these, and `pending()` and `status()` meant the count and the sync states; the first four work until 1.108 and `deprecated-source-readers` rewrites them.
65
65
  - `key` names the field identifying a row, a string or a number. `put` is an action taking the row, `remove` an action taking `{ [key]: value }`, and `read` a function giving the server's rows (`call` or `resource`'s route, or any promise): all three are the app's own, so their guards, schemas, rate limits and cross-site checks apply as to any call.
66
66
  - The collection is named by its `put` action's URL, so declare it once per action; two islands declaring it share one mirror.
67
- - On the server, and in a browser without IndexedDB, `local()` gives an empty collection: `syncStatus()` is `'loading'` on the server and `'unavailable'` where the browser keeps nothing, and a write there throws. Nothing loads on a page that does not import it.
67
+ - On the server, and in a browser without IndexedDB, `local()` gives an empty collection: `sync.status()` is `'loading'` on the server and `'unavailable'` where the browser keeps nothing, and a write there throws. Nothing loads on a page that does not import it.
68
68
 
69
69
  ### The mirror
70
70
 
@@ -72,9 +72,9 @@ for issue of todos.issues()
72
72
  - A row crosses as island props do (Dates, Maps and Sets included) and holds no file.
73
73
  - `version: 2` forgets the rows held (they are read again) and keeps the queue; use it when the rows' shape changes. The database itself is versioned by kay.
74
74
  - Tabs share it: a change in one reaches the others through a `BroadcastChannel`, and a lock lets one tab or the worker send the queue at a time.
75
- - `syncStatus()` is `'loading'` until the mirror is read, `'synced'`, `'unsynced'` (writes wait for the server), `'offline'` (the last attempt found no connection, or the last read of the server failed, until one succeeds) or `'signed-out'` (the server answered 401 or sent the visitor to sign in: the queue waits, nothing is lost).
76
- - `error()` is an `ApiError` once a read of the server failed (status 0 for a `read` that threw or got no answer, the thrown `ApiError`'s own status otherwise) or the browser keeps no IndexedDB, kept until a read succeeds; a write waiting for the server is no error, `syncStatus()` says so and a refused one is in `issues()`. `retry()` reads the server and sends the queue now when the last read failed or the server could not be reached, and does nothing while signed out ([Island sources](island-sources.md)); `status()` and `pending()` keep their words until 2.0, `syncStatus()` and `unsynced()` are the ones to read.
77
- - The hooks are options and methods of the same names ([Island sources](island-sources.md#hooks)): `onSync({ rows })` after a read of the server was taken in or the queue was sent and the collection stands `synced`, `onIssue({ issue })` once for each new issue (not for those kept from an earlier visit), `onError({ error })` once for each failed read. `local({ ..., onIssue: ({ issue }) => toast.error(issue.message) })`.
75
+ - `sync.status()` is `'loading'` until the mirror is read, `'synced'`, `'unsynced'` (writes wait for the server), `'offline'` (the last attempt found no connection, or the last read of the server failed, until one succeeds) or `'signed-out'` (the server answered 401 or sent the visitor to sign in: the queue waits, nothing is lost).
76
+ - `error()` is an `ApiError` once a read of the server failed (status 0 for a `read` that threw or got no answer, the thrown `ApiError`'s own status otherwise) or the browser keeps no IndexedDB, kept until a read succeeds; a write waiting for the server is no error, `sync.status()` says so and a refused one is in `issues()`. `retry()` reads the server and sends the queue now when the last read failed or the server could not be reached, and does nothing while signed out ([Island sources](island-sources.md)).
77
+ - The hooks are options and methods of the same names ([Island sources](island-sources.md#hooks)): `onData({ value })` (the rows held) after a read of the server was taken in or the queue was sent and the collection stands `synced`, `onIssue({ issue })` once for each new issue (not for those kept from an earlier visit), `onError({ error })` once for each failed read. `local({ ..., onIssue: ({ issue }) => toast.error(issue.message) })`.
78
78
 
79
79
  ### Sending writes
80
80
 
@@ -15,7 +15,7 @@
15
15
  - A per-action `messages`, a schema's `error` and a component's label prop stay the overrides, and win over the catalog.
16
16
  - A schema refusal without an `error` reads `kay.invalid.<kind>`, Elysia's own wording when the site gives none: `required` (nothing sent), `tooShort` (`{min}`), `tooLong` (`{max}`), `pattern`, `tooSmall` (`{min}`), `tooBig` (`{max}`), `format` (`{format}`, the schema's format such as `email`), `tooFewItems` (`{min}`) and `tooManyItems` (`{max}`) for an array out of its `minItems` and `maxItems`, and `type` for anything else, such as a wrong type, an exclusive bound or a union no branch fits. The browser's form check before a post reads the same keys with the same params in the page's locale, a page with a checked form sending them (only those the catalogs word, so a site without them sends nothing and reads Elysia's English), and a schema's own `error` still wins.
17
17
  - A field of an entry the schema refuses (a CMS save or draft, `kay build`, `kay check`) reads as a sentence naming the field by its label, its schema `title` else its key worded (`publishedAt` gives `Published at`), under `kay.entry.*` with the kinds above, each holding `{field}` as well as its limit: `entry.required` (`{field} is required`), `entry.tooShort` (`{min}`), `entry.tooLong` (`{max}`), `entry.pattern`, `entry.format` (`{format}`), `entry.tooFewItems` (`{min}`), `entry.tooManyItems` (`{max}`), `entry.tooSmall` (`{min}`), `entry.tooBig` (`{max}`) and `entry.type` (`{field} is not valid`); `entry.item` (`{field}, item {n}`) names an item of a list and `entry.data` (`The data`) an entry that is no object. A schema's own `error` on the field still wins. The issue sits on the nested field it concerns (`networks.youtube`), on the line of its top-level field in a build. The editor words them in the request's locale; `kay build` and `kay check` read no request, so they word them in the site's default locale from its catalogs, the English where it gives none.
18
- - The other `kay.*` keys, with their English: `action.serverError` (Something went wrong on our side; try again later), `action.timeout` (This took too long; try again later), `action.invalidFile` (Invalid file type), `action.bodyLimit` (Too large to send; {size} at most, the size written in the page's locale: `1 Mo`, `200 octets`), `link.newTab` ((opens in a new tab), said to screen readers after a link kay opens in a new tab), `offline.title` (Offline) and `offline.text` (This page needs a connection, and none is open.), the page the service worker gives offline for a page it did not keep, in the default locale, `protection.honeypot` (Leave this field empty), `protection.minTime.early` (Sent too fast; take a moment, then send it again), `protection.minTime.expired` and `protection.proofOfWork.expired` (This form has expired; send it again), `protection.proofOfWork.missing` (Turn JavaScript on to send this form), `protection.proofOfWork.wrong` (This form could not be checked; send it again), `protection.rateLimit` (Too many attempts; try again in {seconds} s).
18
+ - The other `kay.*` keys, with their English: `action.serverError` (Something went wrong on our side; try again later), `await.failed` (This could not be loaded; try again later, shown in place of an `await` block with no `catch`), `action.timeout` (This took too long; try again later), `action.invalidFile` (Invalid file type), `action.bodyLimit` (Too large to send; {size} at most, the size written in the page's locale: `1 Mo`, `200 octets`), `link.newTab` ((opens in a new tab), said to screen readers after a link kay opens in a new tab), `offline.title` (Offline) and `offline.text` (This page needs a connection, and none is open.), the page the service worker gives offline for a page it did not keep, in the default locale, `protection.honeypot` (Leave this field empty), `protection.minTime.early` (Sent too fast; take a moment, then send it again), `protection.minTime.expired` and `protection.proofOfWork.expired` (This form has expired; send it again), `protection.proofOfWork.missing` (Turn JavaScript on to send this form), `protection.proofOfWork.wrong` (This form could not be checked; send it again), `protection.rateLimit` (Too many attempts; try again in {seconds} s), `socket.notJson` (A message must be JSON) and `socket.invalid` (The message is not valid), the `fields` of a websocket message refused ([API routes](api-routes.md)).
19
19
  - kayjs-ui's `ui.*` keys are listed in its `llms.txt`. kayjs-ai has one, `ai.chat.disclosure`, the line `Chat` shows that the visitor talks to an AI.
20
20
 
21
21
  ```ts
package/llms/locales.md CHANGED
@@ -8,20 +8,20 @@
8
8
 
9
9
  ```ts
10
10
  export default defineConfig({
11
- i18n: { locales: ['fr', 'en'], defaultLocale: 'fr' },
11
+ i18n: { locales: ['fr', 'en'], default: 'fr' },
12
12
  })
13
13
  ```
14
14
 
15
15
  ### Serve each locale on its own host
16
16
 
17
- `domains` replaces the prefixes with a host per locale:
17
+ `mode: { domains }` replaces the prefixes with a host per locale:
18
18
 
19
19
  ```ts
20
20
  export default defineConfig({
21
21
  i18n: {
22
22
  locales: ['fr', 'en'],
23
- defaultLocale: 'fr',
24
- domains: { fr: 'example.fr', en: 'example.com' },
23
+ default: 'fr',
24
+ mode: { domains: { fr: 'example.fr', en: 'example.com' } },
25
25
  },
26
26
  })
27
27
  ```
@@ -34,7 +34,7 @@ export default defineConfig({
34
34
  export default defineConfig({
35
35
  i18n: {
36
36
  locales: ['fr', 'en'],
37
- defaultLocale: 'fr',
37
+ default: 'fr',
38
38
  paths: { '/a-propos': { en: '/about' }, '/blog/:slug': { en: '/articles/:slug' } },
39
39
  },
40
40
  })
@@ -120,7 +120,7 @@ import { formatBytes, formatDate, formatDuration, formatList, formatNumber, form
120
120
  ---
121
121
  p {formatNumber(1234.5)}
122
122
  p {formatBytes(1536)}
123
- p {formatDuration(7_500_000)}
123
+ p {formatDuration('125m')}
124
124
  p {formatDate(new Date(), { dateStyle: 'long' })}
125
125
  p {formatRelativeTime(new Date(Date.now() - 3 * 86_400_000))}
126
126
  p {formatList(['Ada', 'Grace'])}
@@ -160,10 +160,10 @@ p {target}
160
160
  ### Configuring locales
161
161
 
162
162
  - `i18n` in kay.config.ts serves every page in each locale, the default one unprefixed and the others under their prefix: `/about` and `/en/about`.
163
- - `prefixDefault: true` puts the default locale under its prefix too, `/fr/about`; a path without one then redirects with a 307 to the visitor's locale: the one they last went to, kept in the `kay_locale` cookie once they follow a link of the site to it, then the best match of their browser's `Accept-Language`, then the default.
164
- - Without `prefixDefault` the URL alone decides.
165
- - `domains: { fr: 'example.fr', en: 'example.com' }` serves each locale on its own host instead, with no prefixes; a host not listed serves the default locale, and every locale needs a host.
166
- - `domains` and `prefixDefault` do not go together.
163
+ - `mode: 'always'` puts the default locale under its prefix too, `/fr/about`; a path without one then redirects with a 307 to the visitor's locale: the one they last went to, kept in the `kay_locale` cookie once they follow a link of the site to it, then the best match of their browser's `Accept-Language`, then the default.
164
+ - With the default `mode: 'prefix'` the URL alone decides.
165
+ - `mode: { domains: { fr: 'example.fr', en: 'example.com' } }` serves each locale on its own host instead, with no prefixes; a host not listed serves the default locale, and every locale needs a host.
166
+ - `mode` is `'prefix'`, `'always'` or `{ domains }`, one at a time.
167
167
  - A page cannot sit under a locale's prefix itself, `src/routes/en/`: kay serves every page there already.
168
168
  - A root `[slug].kay` with no `index.kay` would take `/en` as a slug, so give the site an index page.
169
169
  - `paths` names a page its own way in some locales, keyed by the pattern the page is served under: `{ '/a-propos': { en: '/about' }, '/blog/:slug': { en: '/articles/:slug' } }`, the pattern being the default locale's path (`kay check` warns on a translation of the default locale).
@@ -217,7 +217,7 @@ export default defineMessages({
217
217
  - Using it makes the component an island.
218
218
  - `T` renders a message holding markup, such as a link mid-sentence: see [Messages holding markup](#messages-holding-markup).
219
219
  - `formatNumber(value, options)` and `formatDate(value, options)` format through `Intl` for the request's locale, and so do `formatRelativeTime(date)`, a date relative to now in the largest unit it reaches, `3 days ago`, `yesterday` or `in 2 hours`, `formatRelativeTime(2, 'week')` in the unit given, and `formatList(['Ada', 'Grace'])`, `Ada and Grace`. Outside a request, in a job, an alert or a push, these and `direction()` use the site's default locale (`en` when the site names none) instead of throwing, so a page and a mail format the same date alike. Each takes a `locale` among its options (`formatDate(date, { locale: user.locale })`) that wins over the request's, for a mail written in its reader's language. `formatDate` options that name no part of the date (none, a `locale`, a lone `timeZone` or `calendar`) give the medium date, as no options do.
220
- - `formatBytes(1536)` is `1.5 kB` and `formatDuration(7_500_000)`, in milliseconds, is `2 hr 5 min`, each in the page's locale with a `locale` option of its own, `unitDisplay: 'long'` for the unit in full. `timeZone: 'Europe/Paris'` in kay.config.ts is the zone every `formatDate`, a message's date placeholder, `RelativeTime`'s tooltip write in; a chart's labels keep the machine's zone, on the server and in the islands alike, unless a call names its own `timeZone`, so on the server a time of day built from an instant is written in the server's zone until the island rewrites it in the visitor's, and `timeZone()` from `kay/i18n` reads it.
220
+ - `formatBytes(1536)` is `1.5 kB` (a `ByteSize`: bytes or `'1.5kb'`) and `formatDuration('125m')` (a `Duration`, `'7500s'`, `'2h'`) is `2 hr 5 min`, a number of milliseconds being deprecated since 1.105 (`deprecated-format-duration`), each in the page's locale with a `locale` option of its own, `unitDisplay: 'long'` for the unit in full. `timeZone: 'Europe/Paris'` in kay.config.ts is the zone every `formatDate`, a message's date placeholder, `RelativeTime`'s tooltip write in; a chart's labels keep the machine's zone, on the server and in the islands alike, unless a call names its own `timeZone`, so on the server a time of day built from an instant is written in the server's zone until the island rewrites it in the visitor's, and `timeZone()` from `kay/i18n` reads it.
221
221
  - In an island, give `formatRelativeTime` the moment it is relative to, `{ now }`, from the server, so the browser renders what the server did, or use `relativeTime`.
222
222
  - `locales()` is the configured locales in `i18n`'s order, only the page's own without `i18n`; `localeName('fr')` is `Français`, `localeName('pt-BR')` is `Português (Brasil)`, each in its own language through `Intl.DisplayNames`, first letter capitalized, a code `Intl` cannot read as written.
223
223
  - `direction()` is `rtl` or `ltr`, for the request's locale or the one given.
@@ -263,6 +263,7 @@ T(key="intro" name="Ada")
263
263
  ```
264
264
 
265
265
  - Each block gets its tag's text, placeholders filled; the text inside a tag and out is escaped, a value holding `<b>` included.
266
+ - `T('intro', { name: 'Ada', about: text => ... })` is the same call in a script or an expression: the key, then the placeholders and one block per tag in one object. `kay check` types both forms alike: a missing placeholder, an unknown value and a missing or unknown block are errors in the template and in the call, and an island's source naming the key as a literal sends the message to the browser: a key in a variable, or typed as a union, is not sent, as with `t(id)`, and a `string` key is refused by `kay check`.
266
267
  - `kay check` types the key, the placeholders as props and one block per tag of the default locale's message, a tag without its block or a block for no tag being an error, and holds every locale to the default one's tags.
267
268
  - Tags do not nest, and a plural's `count` goes as a prop like any placeholder.
268
269
  - In an island, `T` renders again when a placeholder changes.
package/llms/mcp.md CHANGED
@@ -29,28 +29,28 @@ expect(await site.mcp.call('add_note', { title: 'Milk' })).toMatchObject({ isErr
29
29
 
30
30
  ## Reference
31
31
 
32
- - `mcp: true` serves Streamable HTTP at `/mcp`, or at `mcp: { path: '/tools' }` under the same rules as the OpenAPI paths, its sign-in metadata then at `/.well-known/oauth-protected-resource/tools`: one JSON-RPC message per `POST`, answered with JSON, `initialize`, `ping`, `tools/list` and `tools/call` only, no resources or prompts. `GET` and `DELETE` answer 405, a notification 202.
32
+ - `mcp: true` serves Streamable HTTP at `/_kay/mcp`, or at `endpoints: { mcp: '/tools' }` under the same rules as the OpenAPI paths, its sign-in metadata then at `/.well-known/oauth-protected-resource/tools`: one JSON-RPC message per `POST`, answered with JSON, `initialize`, `ping`, `tools/list` and `tools/call` only, no resources or prompts. `GET` and `DELETE` answer 405, a notification 202.
33
33
  - `mcp: { rateLimit: { max: 60, window: '1m' } }` caps the requests one client may send the endpoint in a window, 120 a minute by default, `false` for none (a bare number, the requests a minute, still works and `kay upgrade` rewrites it), counted in `store.rates` where the app has one so replicas share it; one past it answers 429 with `Retry-After` and `Too many requests; try again in N s`, as an API module does. A call also meets the limits of the action or route it runs.
34
34
  - `mcp: { instructions: 'Read French text through temtem_resolve first.' }` is sent as `instructions` of `initialize`, the MCP spec's field for guidance spanning tools that a client shows its model before any tool description; a non-empty string, else the boot fails. Absent, `initialize` carries none.
35
- - `mcp: { key }` requires `Authorization: Bearer <key>` on every request to the endpoint, for a local agent holding a static key where no OAuth server signs it in: `key: true` reads `KAY_MCP_KEY`, else the trimmed file `KAY_MCP_KEY_FILE` names (a container secret); a string is the key itself; `{ file: 'data/mcp-key' }` reads the environment, else that file, made on first use with a random key (folder `0700`, file `0600`); a relative path is resolved against the project root, and against the working directory in a compiled server (`kay build --compile`), so it lands next to where the executable runs like a relative `sqlite://` path does, and an absolute one is used as given. A key is at least 16 characters, read once at boot, so a rotation is a restart. The check runs after the cross-site check and the rate limit (which refused guesses count against) and before the body is read: `initialize`, `ping`, `tools/list`, calls, notifications and unreadable bodies alike answer 401 with `WWW-Authenticate: Bearer realm="mcp"` and one JSON-RPC error, the same for a missing, malformed or wrong key. The scheme is matched in any case; the key is compared in constant time (both sides hashed first, so its length shows nothing). `GET` and `DELETE` stay 405. A tool call is dispatched by the endpoint after the check, so it needs nothing more, and the bearer is not passed on to the route or action it runs. A production server with `key: true` and no key does not boot; elsewhere, with none given, every request is refused and a warning names the variables. Checked under `kay dev` and `kay/test` too.
36
- - An endpoint with `mcp.key` takes the static key alone: a kayjs-auth OAuth token is refused there, and the bearer is not passed on. With `proxy.key`, a `POST` to it is open to that check by itself (this path only; the rate limit counts the address `proxy` reads, so spoofing needs `hops` or `header` trusted from a caller that can reach the port, and a key of 32 random characters or more, as `{ file }` makes, makes guessing pointless), as its bearer is its credential: no `proxy.open: ['/mcp']` and no app guard. [Proxy and security](proxy-and-security.md).
35
+ - `mcp: { token }` requires `Authorization: Bearer <token>` on every request to the endpoint, for a local agent holding a static key where no OAuth server signs it in: `token: true` reads `KAY_MCP_KEY`, else the trimmed file `KAY_MCP_KEY_FILE` names (a container secret); a string is the token itself; `{ env: 'AGENT_TOKEN' }` reads that variable; `{ file: 'data/mcp-key' }` reads that file alone, made on first use with a random key (folder `0700`, file `0600`); a relative path is resolved against the project root, and against the working directory in a compiled server (`kay build --compile`), so it lands next to where the executable runs like a relative `sqlite://` path does, and an absolute one is used as given. The token is at least 16 characters, read once at boot, so a rotation is a restart. `mcp.key` is the form of before 1.105, which `kay upgrade` renames (it read the environment before a `{ file }`; `token: { file }` does not). The check runs after the cross-site check and the rate limit (which refused guesses count against) and before the body is read: `initialize`, `ping`, `tools/list`, calls, notifications and unreadable bodies alike answer 401 with `WWW-Authenticate: Bearer realm="mcp"` and one JSON-RPC error, the same for a missing, malformed or wrong key. The scheme is matched in any case; the key is compared in constant time (both sides hashed first, so its length shows nothing). `GET` and `DELETE` stay 405. A tool call is dispatched by the endpoint after the check, so it needs nothing more, and the bearer is not passed on to the route or action it runs. A production server with `token: true` or `{ env }` and no token does not boot; elsewhere, with none given, every request is refused and a warning names the variables. Checked under `kay dev` and `kay/test` too.
36
+ - An endpoint with `mcp.token` takes the static key alone: a kayjs-auth OAuth token is refused there, and the bearer is not passed on. With `proxy.key`, a `POST` to it is open to that check by itself (this path only; the rate limit counts the address `proxy` reads, so spoofing needs `hops` or `header` trusted from a caller that can reach the port, and a key of 32 random characters or more, as `{ file }` makes, makes guessing pointless), as its bearer is its credential: no `proxy.open: ['/_kay/mcp']` and no app guard. [Proxy and security](proxy-and-security.md).
37
37
  - A message that is no JSON-RPC request answers 400, a body over `maxSize` 413, a request from another site (`Origin`, `Sec-Fetch-Site`) 403.
38
38
  - A tool per action that sets `tool` and per API route whose `detail` sets `tool`, even with `openapi` off; a route that does not is in the OpenAPI document and no tool: absent from `tools/list`, and a `tools/call` naming it is refused as any unknown name is. Before 1.51 every route not hidden was a tool.
39
39
  - A route's `detail.tool` is `true`, a description, or `{ name, description }`, as an action's. Its tool is named by `tool.name` else its `operationId` (a route setting only `tool.name` takes it as its `operationId`), made a safe name (`users.list` is `users_list`, a clash `_2`), described by `tool`'s description else its `summary` and `description`, its input one JSON Schema of the path params, query and JSON body, merged by name.
40
- - Left out: `detail: { hide: true }` routes, `tool` or not (`hidden-tool` in `kay check`), websockets, a route whose body is files, text or bytes, an action holding a file, an action in a file whose pages have route params (a post from no page cannot name one), and `in: header` parameters. `tools/list` is served behind the API directory's `_guard.ts` as the document is, and with `requireGuards` it is refused (403) unless the guards cover every module; `initialize` and `ping` stay open, and a call runs the guards of its own route.
40
+ - Left out: `detail: { hide: true }` routes, `tool` or not (`hidden-tool` in `kay check`), websockets, a route whose body is files, text or bytes, an action holding a file, an action in a file whose pages have route params (a post from no page cannot name one), and `in: header` parameters. `tools/list` is served behind the API directory's `_guard.ts` as the document is, and with `guards: { default: 'closed' }` it is refused (403) unless the guards cover every module; `initialize` and `ping` stay open, and a call runs the guards of its own route.
41
41
  - A route answering every method, `.all()`, that sets `tool` is a tool per method; a `tool.name` takes the method as a suffix, `echo_get`.
42
42
  - An action is a tool only when its third argument sets `tool`: `true`, a description, or `{ name, description }`; its name is the export in snake case, `addNote` is `add_note`, a clash `add_note_2`, and its input schema is the action's as JSON: `s.Integer()` and `s.Numeric()` read as a number, not also as the text a form sends (which a call still takes), and a top-level body or query field with a `default` is left out of `required`, as a call omitting it gets the default.
43
43
  - A name is made of letters, digits and `_`, at most 64 characters.
44
44
  - A call is dispatched through the whole app as a fetch to the route's or action's URL would be, so its guards, `rateLimit`, body limit, schema validation and `ctx.locals` are the web path's; `ctx.params` and `ctx.url` of an action are read as for a script's post from no page.
45
- - It carries the caller's `Authorization` (not the endpoint's own `mcp.key` bearer), `Cookie`, `Accept-Language` and `User-Agent`, and rate limits count the caller's address as `proxy` reads it, not the server's.
46
- - `toolCall(request)` from `kay/server` answers `{ tool, client }` for a request the endpoint dispatched, `tool` being the tool's name and `client` the address of the agent's client, and `undefined` for any other. It reads a hook registered before `pages()` (`.onRequest`), a guard's `request` and a handler's alike, and a client sending the marker headers itself is no tool call: the marker is a per-process secret. A front guard lets a bearer key reach the tools alone: `if (key && url.pathname !== '/mcp' && !toolCall(request)) deny(403, 'The key opens tools only')`; `/mcp` is let through because `tools/list` runs the API directory's guards as a request to `/mcp`, with no tool call.
45
+ - It carries the caller's `Authorization` (not the endpoint's own `mcp.token` bearer), `Cookie`, `Accept-Language` and `User-Agent`, and rate limits count the caller's address as `proxy` reads it, not the server's.
46
+ - `toolCall(request)` from `kay/server` answers `{ tool, client }` for a request the endpoint dispatched, `tool` being the tool's name and `client` the address of the agent's client, and `undefined` for any other. It reads a hook registered before `pages()` (`.onRequest`), a guard's `request` and a handler's alike, and a client sending the marker headers itself is no tool call: the marker is a per-process secret. A front guard lets a bearer key reach the tools alone: `if (key && url.pathname !== '/_kay/mcp' && !toolCall(request)) deny(403, 'The key opens tools only')`; `/_kay/mcp` is let through because `tools/list` runs the API directory's guards as a request to `/_kay/mcp`, with no tool call.
47
47
  - An `onRequest` hook that throws, the app's own Elysia one, a param matcher, `rewrite` or an extension's, is answered like a handler that throws: logged, handed to `onError`, and a 500 with `Internal Server Error` in production, the message in development, instead of Elysia's 200; a GET asking for HTML gets the routes directory's `_error.kay` (or kay's error page) in the default locale, any other request plain text. A `Response` the hook throws is answered as given, and an `onError` registered before `pages()` answers first. An `_error.kay` drawn for it reads in `ctx.locals` what a `derive` added before it threw.
48
48
  - `honeypot`, `minTime` and `proofOfWork` are skipped, as only a form a person filled in can pass them; a marker only the endpoint sets, a per-process secret no request can send, says so, and `rateLimit` still counts.
49
49
  - A path param is one segment: it is percent-encoded and an empty one, `.` or `..` is refused, so no value reaches another route.
50
50
  - A refused call is a result with `isError`: the schema's field errors, the `ctx.fail` data and status as `{ status, errors, data }` JSON, a route's own refusal text, a redirect naming where it leads. The agent corrects and calls again.
51
51
  - A guard answering 401 makes the endpoint answer 401 with `WWW-Authenticate: Bearer resource_metadata="<site>/.well-known/oauth-protected-resource"`, how a client learns to sign in (kay serves that document when kayjs-auth's OAuth server is on: see its "OAuth server for MCP clients"); any other refusal, 403 included, is a result. Only a guard's 401 does: a route answering 401 itself is a result too. A refused `tools/list` answers the same way (a redirect counting as a 401), as a JSON-RPC error. It keeps the guard's response headers, `Retry-After` of a 429 among them. A `tools/call` of a name no tool has is refused the same way, so names cannot be probed; a call to a tool runs its own guards.
52
52
  - A result is JSON as text, and `structuredContent` when an object; any other type read as its size. A route's object `response` is the tool's `outputSchema`, with no `detail.tool.output` ([action protection](action-protection.md#offering-an-action-to-agents)).
53
- - `/mcp` is claimed like a route: a page, endpoint or file serving it stops the boot, and `kay check` reports it.
53
+ - `/_kay/mcp` (`endpoints.mcp`) is claimed like a route: a page, endpoint or file serving it stops the boot, and `kay check` reports it.
54
54
  - `unguarded-tool` warns, with `mcp`, of a tool action with a `honeypot`, `minTime` or `proofOfWork` that no guard covers: an agent calls it without the form those protections ask of a person. A `...spread` in the options counts as one of them, so it warns; options that are not an object literal, `action(schema, run, options)`, are not read, so the action is not taken for a tool.
55
55
  - `site.mcp.initialize()` resolves with `{ serverInfo, instructions }` of the `initialize` answer, `instructions` being `mcp: { instructions }` or undefined.
56
- - `site.mcp.tools()` lists the tools of an app with `mcp: true`, each `{ name, description, inputSchema }`, and `site.mcp.call('add_note', { title: 'Milk' })` calls one as an agent does, through the cookies of the site so far and the `headers` given, `{ headers: { authorization: 'Bearer token' } }`: it resolves with `{ isError, text, data, status }`, `isError` set when the app refused the call, `data` the answer when it is an object, `status` 401 when a guard asks for a sign-in; a protocol error, such as an unknown tool, throws. With `mcp: { key }`, `testSite({ mcpKey })` sets the key and `site.mcp` sends it as the bearer unless the call or the site's `headers` give an `authorization`; a config with `mcp.key` and no `mcpKey` gets a generated one.
56
+ - `site.mcp.tools()` lists the tools of an app with `mcp: true`, each `{ name, description, inputSchema }`, and `site.mcp.call('add_note', { title: 'Milk' })` calls one as an agent does, through the cookies of the site so far and the `headers` given, `{ headers: { authorization: 'Bearer token' } }`: it resolves with `{ isError, text, data, status }`, `isError` set when the app refused the call, `data` the answer when it is an object, `status` 401 when a guard asks for a sign-in; a protocol error, such as an unknown tool, throws. With `mcp: { token }`, `testSite({ config: { mcp: { token: 'a-token-of-16-chars' } } })` sets the token and `site.mcp` sends it as the bearer unless the call or the site's `headers` give an `authorization`; a config with `mcp.token` and no literal one gets a generated one. `testSite({ mcpKey })` is the form of before 1.105.
@@ -0,0 +1,24 @@
1
+ # Metrics for a collector
2
+
3
+ Part of [Running in production](production.md).
4
+
5
+ ## Common tasks
6
+
7
+ ### Serve metrics to a collector
8
+
9
+ ```ts
10
+ export default defineConfig({
11
+ ops: { metrics: { token: true } },
12
+ })
13
+ ```
14
+
15
+ Prometheus or any compatible collector scrapes `/_kay/metrics` with `Authorization: Bearer <token>`, the token read from `KAY_METRICS_TOKEN`. Without `token`, only a request from this machine or a private network is answered.
16
+
17
+ ## Reference
18
+
19
+ - `ops: { metrics: true }` in kay.config.ts serves `/_kay/metrics` in the Prometheus text format, for Prometheus or any compatible collector (Grafana Alloy, the OpenTelemetry collector's Prometheus receiver): `endpoints: { metrics: '/_internal/metrics' }` moves it. Before 1.105 it was `/metrics`, which answers as well until 1.108 while `endpoints.metrics` is not set (unless the app serves something there). It is off by default, and a server run by `kay dev` or a static export serves none.
20
+ - It holds `kay_http_requests_total{method,route,status}` and the histogram `kay_http_request_duration_seconds{method,route}`, `kay_queue_runs_total{queue,result}` (`ok`, `retried`, `failed`; a workflow is `workflow:<name>`), `kay_job_runs_total{schedule,result}` (`ok`, `failed`, `skipped` when another process held the lock), `kay_session_events_total{event}` (`created`, `destroyed`), `kay_file_events_total{event}` (`written`, `deleted`), `kay_cache_reads_total{result}` (`hit` or `miss` of `cached` and `cache`), `kay_live_connections`, `kay_process_resident_memory_bytes` and `kay_process_uptime_seconds`.
21
+ - A page counts under its pattern, `/shop/:item`, an API route under its route, and a path nothing serves under `unmatched`, so a scan adds no series; at most 500 routes are kept, the rest read `other`. The scrape itself and the health route are not counted, nor a request an earlier hook answers (a redirect, a refusal by `proxy.key`), and a method no server knows reads `OTHER`.
22
+ - It is never public by default: only a request that reached the socket from this machine or a private network (a collector in the same compose network, a sidecar) and carries no `X-Forwarded-*`, `X-Real-IP`, `Forwarded`, `Via` or `CF-Connecting-IP` header, nor the headers `proxy.header` and `proxy.key.header` name, is answered; every other gets 403, a trailing slash, a query or the `base` in the path included. Do not forward the path from the reverse proxy: one that adds none of those headers cannot be told from a collector.
23
+ - With a token, only a request with `Authorization: Bearer <token>` is answered, from any address, for a collector reaching the server across networks: `ops: { metrics: { token: true } }` reads `KAY_METRICS_TOKEN`, `token: { env: 'COLLECTOR_TOKEN' }` another variable, `token: { file: '/run/secrets/metrics' }` a file (trimmed), a string is the token itself; a setting that gives none stops a production server, and elsewhere warns and refuses every request; a relative `{ file }` is read from the project folder. Without `token`, `KAY_METRICS_TOKEN` still counts. With no token the boot always logs a warning, as any peer on a private network reads the metrics, and a proxy on this host that forwards the path unmarked reads as a collector. `kay routes` lists the route and `kay env` the variable.
24
+ - `proxy.key` lets a request on this path past the key, as it does the health route, since the collector does not go through the proxy; the rules above still apply. An app file or page at `/metrics` keeps the path, and kay serves none there.
@@ -15,13 +15,13 @@ button(onClick={() => navigate('/todos')}) Todos
15
15
 
16
16
  ### Show a loader, cancel or react while a page loads
17
17
 
18
- kayjs-ui's `NavigationProgress` is that top bar, once in the layout ([page layout](../../ui/llms/page-layout-palette-and-trees.md)). `navigation` from `kay` follows the swap, so a bar of your own is a few lines in an island, and the link followed (a GET form too) carries `data-pending` until the swap ends, so `a[data-pending]` styles it with no script:
18
+ kayjs-ui's `NavigationProgress` is that top bar, once in the layout ([page layout](../../ui/llms/page-layout-palette-and-trees.md)). `navigation` from `kay` follows the swap, and holds its hooks as methods, so a bar of your own is a few lines in an island, and the link followed (a GET form too) carries `data-pending` until the swap ends, so `a[data-pending]` styles it with no script:
19
19
 
20
20
  ```kay
21
21
  ---
22
- import { navigation, onBeforeNavigate } from 'kay'
22
+ import { navigation } from 'kay'
23
23
 
24
- onBeforeNavigate(({ url }) => !dirty() || confirm(`Leave for ${url.pathname}?`))
24
+ navigation.onBeforeNavigate(({ url }) => !dirty() || confirm(`Leave for ${url.pathname}?`))
25
25
  ---
26
26
  if navigation.pending()
27
27
  .top-bar
@@ -31,10 +31,10 @@ if navigation.error()
31
31
 
32
32
  ### Render a component on a page kay does not serve
33
33
 
34
- With `"kay/bun"` listed under `[serve.static] plugins` in `bunfig.toml`, `mount` from `kay` (also `kay/mount`) renders one into an element and returns what disposes it:
34
+ With `"kay/bun"` listed under `[serve.static] plugins` in `bunfig.toml`, `mount` from `kay` renders one into an element and returns what disposes it:
35
35
 
36
36
  ```ts
37
- import { mount } from 'kay/mount'
37
+ import { mount } from 'kay'
38
38
  import Panel from './panel.kay'
39
39
 
40
40
  const dispose = mount(Panel, document.querySelector('#panel')!, { title: 'Tickets' })
@@ -45,8 +45,8 @@ const dispose = mount(Panel, document.querySelector('#panel')!, { title: 'Ticket
45
45
  ### Navigating from code
46
46
 
47
47
  - `navigate('/todos/1')`, imported from `kay`, goes to a page as a link would (the mount point and the current locale's prefix put on as on any `href`, `/todos/1` on a French page going to `/fr/todos/1`, a path already prefixed or another site's URL left as written; a module that gets `navigate` through a dynamic `import('kay')` is not covered, so import it statically), `{ replace: true }` taking the current history entry's place, `{ scroll: 'keep' }` leaving the window scrolled where it is instead of going to the top, `{ transition: false }` swapping without a view transition; another site's page loads, so a `?next=` param goes through `localPath()` as a redirect's does, and a `javascript:` URL throws, as it would run in the page; `mailto:`, `tel:` and other schemes go to the browser as a link would. A link or `navigate()` that a redirect takes to another site loads that page fully rather than swapping it in.
48
- - `navigate({ query: { sort: 'name', page: null } })` goes to the current page with those params set and a null, undefined or empty one dropped, the others and the path kept and the hash left out, keeping the scroll and the focus as `refresh()` does: a filter or a sort picked in place.
49
- - `withQuery({ page: 2, sort: null })` from `kay`, in a server fence, a template or an island (where it follows the address, so the link is built again after each `navigate({ query })`, swap, Back and `persisted` query write), returns the path of the current page with those params set by the rule of `navigate({ query })`, the other params kept and the hash left out, to link to it with one filter changed: `a(href={withQuery({ page: 2 })}) Next`. The path is the site's own, so `base`, `trailingSlash` and the locale prefix are put on by the link as on any `href`; in a fence it reads the request, so it throws in a page rendered once at build time.
48
+ - `navigate.query({ sort: 'name', page: null })` goes to the current page with those params set and a null, undefined or empty one dropped, the others and the path kept and the hash left out, keeping the scroll and the focus as `refresh()` does: a filter or a sort picked in place. It takes the options of `navigate()` and resolves as it does. `navigate({ query })`, which did this under the name that goes to a page, works until 1.108, `kay upgrade` rewriting it (`deprecated-navigate-query`). A query that is state of the page, not a one-off change, is a `queryParam` signal ([state](islands-state-to-ids.md#shared-and-persisted-state)).
49
+ - `withQuery({ page: 2, sort: null })` from `kay`, in a server fence, a template or an island (where it follows the address, so the link is built again after each `navigate.query()`, swap, Back and `queryParam` write), returns the path of the current page with those params set by the rule of `navigate.query()`, the other params kept and the hash left out, to link to it with one filter changed: `a(href={withQuery({ page: 2 })}) Next`. The path is the site's own, so `base`, `trailingSlash` and the locale prefix are put on by the link as on any `href`; in a fence it reads the request, so it throws in a page rendered once at build time.
50
50
  - `refresh()` from `kay` runs the current page's loads again and shows what they return, keeping the scroll, the focus and every island whose props did not change, as a call to an action does by itself once it went through.
51
51
  - `refresh('cart')` or `refresh(['cart', 'user'])` sends and swaps only the elements of the page reading the loads of its fence that bind those names, and leaves the rest of the page as it is: [rendering](rendering.md#refreshing-some-loads).
52
52
  - An island calls `refresh()` once something else changed what the page shows, or polls with it, `every('3s', refresh, { while: () => issuing })`.
@@ -72,11 +72,12 @@ const dispose = mount(Panel, document.querySelector('#panel')!, { title: 'Ticket
72
72
  - `navigation.status()` from `kay`, read in an island, a template or an effect, is `'loading'` while the next page is fetched, `'swapping'` while it is put in place and `'idle'` otherwise; `navigation.to()` is the URL being navigated to (the site's own, with `base`, `trailingSlash` and the locale prefix on, as the swap fetches it) until `'idle'`, `navigation.pending()` whether `status()` is not `'idle'`, and `navigation.error()` the `ApiError` of the last swap that gave up, kept until the next navigation starts: `status` 0 as no answer came, kay's own message (`kay: <url> could not be fetched`, `did not answer in time`, `could not be put in place`) and the browser's error as `cause`. The server and a page that never navigates read `'idle'`. It is a source like the others an island reads ([Island sources](island-sources.md)).
73
73
  - It covers a link, `navigate()` (a query change too), Back and Forward and the redirect of a form post; a `refresh()` and a refused post, shown in place, are no navigation and leave the state `'idle'`. A navigation superseded by a later one moves `to()` to the later URL without passing through `'idle'`.
74
74
  - A swap that gives up (the fetch fails, the page does not answer in 10 seconds, or it cannot be put in place) sets `error()` and fires `kay:navigate-error`, then the browser loads the page in full as before; a leave refused by a guard or a handler starts nothing.
75
- - `onBeforeNavigate(({ url, from }) => ...)`, called in an island's script, is asked with the URL going to and the page left before a link of the app, `navigate()` or going back or forward leaves the page, for as long as the island lives, and returns what removes it sooner. Returning `false`, or a promise of it, keeps the page (`navigate()` resolves `false`, a refused Back or Forward is undone as under `guardLeave`); anything else lets it go. A handler that throws, here and in `onNavigate`, is logged and the navigation goes on, as a browser hook is never a security boundary. It answers before the `guardLeave` guards, which are not asked when it refuses.
75
+ - `navigation.onBeforeNavigate(({ url, from }) => ...)`, called in an island's script, is asked with the URL going to and the page left before a link of the app, `navigate()` or going back or forward leaves the page, for as long as the island lives, and returns what removes it sooner. Returning `false`, or a promise of it, keeps the page (`navigate()` resolves `false`, a refused Back or Forward is undone as under `guardLeave`); anything else lets it go. A handler that throws, here and in `onNavigate`, is logged and the navigation goes on, as a browser hook is never a security boundary. It answers before the `guardLeave` guards, which are not asked when it refuses.
76
76
  - It is asked for a navigation kay swaps in place only: not for a post's redirect, a form's or an island action's (the `guardLeave` guards still ask), as the action already ran, nor for a refresh, a link or `navigate()` to another site, an API or `/_kay` path or a site with `navigation: false` (loaded fully), nor a reload.
77
77
  - While a handler is registered, every Back and Forward goes back to the page left first, as under a guard holding changes, and is made again once the handlers allow it: two history traversals, the scroll restored as for any traversal.
78
- - `onNavigate(({ url }) => ...)` runs with the URL of each page a swap shows, once it is in place, for as long as the island lives, returning what removes it sooner; it is `kay:navigate` for an island, and fires for a refresh as that does.
79
- - `kay:navigate-start` fires on `document` when a swap to another page begins, with `event.detail.url`; `kay:navigate-error` when it gives up, with `event.detail.url` and `event.detail.error` (an `Error` with kay's message and the browser's as `cause`); `kay:navigate` (see [Navigation](navigation.md#navigation)) when the page is in place. A refresh fires `kay:navigate` alone.
78
+ - `navigation.onNavigate(({ url }) => ...)` runs with the URL of each page a swap shows, once it is in place, for as long as the island lives, returning what removes it sooner; it is `kay:navigate` for an island, and fires for a refresh as that does. The two hooks are the methods of `navigation`, as `resource` has `onData`, taking one object and returning what removes them; the functions `navigation.onBeforeNavigate` and `onNavigate` of `kay`, which did the same, work until 1.108 and `kay upgrade` rewrites them (`deprecated-navigation-hooks`).
79
+ - `navigation.onStart(({ url }) => ...)` runs when a swap to another page begins, `navigation.onError(({ url, error }) => ...)` when it gives up (`error` an `ApiError` of status 0 with kay's message and the browser's as `cause`, as `error()` reads it) and `navigation.onStall(({ url }) => ...)` when a streamed page sent nothing for `pageTimeout`; with `onNavigate` they take one object, end with the island and return what removes them. They are the island's form of the `kay:navigate-start`, `kay:navigate-error`, `kay:navigate-stall` and `kay:navigate` events on `document` (`detail.url`, and `detail.error`, an `Error`), which a plain script listens to (see [Navigation](navigation.md#navigation)); `listen(() => document, 'kay:navigate', ...)` in an island is `deprecated-island-events`, which rewrites a handler with no parameter. A refresh fires `kay:navigate` alone.
80
+ - `guardLeave(dirty, { confirm })` is the preset of `navigation.onBeforeNavigate` for unsaved changes: it asks `confirm(url)`, `window.confirm` by default, while `dirty()` holds, where the hook is asked for every leave; it also covers what no hook is asked for (a reload, closing the tab, a form's or an action's redirect), and is the one to write for that case.
80
81
 
81
82
  ### Full loads and prefetching
82
83
 
@@ -84,18 +85,18 @@ const dispose = mount(Panel, document.querySelector('#panel')!, { title: 'Ticket
84
85
  - The code posting and checking forms is fetched once a form takes focus or is submitted.
85
86
  - A link clicked before the code arrived is swapped once it has, and if it cannot load, the link and the form load pages fully as without JavaScript.
86
87
  - A link or a form with `data-reload`, or inside an element with it, loads the next page fully.
87
- - A form with `method="get"` (or none) to a page of the app navigates in place as a link does, its fields serialized into the query as the browser writes them, a submit button's `formaction` and `formmethod` read: a search or a filter keeps the islands marked `persist`, the view transition, scroll and focus. It is a change of the query when the path stays, which keeps the scroll and the focused field, else a visit. `data-keep-scroll`, `data-no-transition` and `data-reload` on the form or around it act as for a link, and the leave guards and `onBeforeNavigate` are asked. A submit with `Ctrl`, `Cmd` or `Shift` held goes to the browser, as a link does. The handler loads with the page's forms: a submit before it has loaded is held and swapped once it has, as a post to an action is, and goes to the browser only if it cannot load. A form with `target`, one to another site, an `/api` or `/_kay` path, or whose submit a handler cancelled, is the browser's.
88
+ - A form with `method="get"` (or none) to a page of the app navigates in place as a link does, its fields serialized into the query as the browser writes them, a submit button's `formaction` and `formmethod` read: a search or a filter keeps the islands marked `persist`, the view transition, scroll and focus. It is a change of the query when the path stays, which keeps the scroll and the focused field, else a visit. `data-scroll`, `data-transition` and `data-reload` on the form or around it act as for a link, and the leave guards and `navigation.onBeforeNavigate` are asked. A submit with `Ctrl`, `Cmd` or `Shift` held goes to the browser, as a link does. The handler loads with the page's forms: a submit before it has loaded is held and swapped once it has, as a post to an action is, and goes to the browser only if it cannot load. A form with `target`, one to another site, an `/api` or `/_kay` path, or whose submit a handler cancelled, is the browser's.
88
89
  - So do a link with `target` or `download`, one to another site, `/api` and `/_kay` paths, and modified clicks.
89
90
  - A page in another locale, or one built against another client build, loads fully too, as does a page setting `reload: true` in its `page` or its layout's, and one whose cross-origin isolation differs from the current page's, which a document cannot change in place.
90
- - Such a page still swaps itself in place: a link to it with another query, `navigate({ query })` and `refresh()` on it.
91
+ - Such a page still swaps itself in place: a link to it with another query, `navigate.query()` and `refresh()` on it.
91
92
  - The swap prefetches as the speculation rules would, on the timing the `prefetch` setting gives (see [Project setup](project.md#project-setup)), and a page loading it carries that setting alone, not the rules, so each page is fetched once: a hovered link's page is kept for 30 seconds and taken as the link is followed.
92
- - `data-no-prefetch` or `data-prefetch="false"`, on the link or a container, opts a link out; `data-prefetch="eager|moderate|conservative"` gives it its own level, read by the swap's code only (a page without kay's script keeps the page's level). `eager` fetches the links scrolled into view, three at a time, from the page's load on, those added later by an island, a stream or a scroll included. The nearest `data-prefetch` wins, and it does nothing under `prefetch: false`, which ships no prefetch code.
93
+ - `data-prefetch="false"`, on the link or a container, opts a link out (`data-no-prefetch` does until 1.108, `deprecated-link-flags`); `data-prefetch="eager|moderate|conservative"` gives it its own level, read by the swap's code only (a page without kay's script keeps the page's level). `eager` fetches the links scrolled into view, three at a time, from the page's load on, those added later by an island, a stream or a scroll included. The nearest `data-prefetch` wins, and it does nothing under `prefetch: false`, which ships no prefetch code.
93
94
  - A visitor asking for less data (`Save-Data: on`) gets a lighter site with no setting: the image route answers the next width down of the ladder (see [Images](images.md#responsive-images)), font preloads, speculation rules and any other `rel="preload" as="font"` link leave the page, its fonts show only when cached (`font-display: optional`), and the swap prefetches nothing. In the browser, `prefers-reduced-data: reduce` and `navigator.connection.saveData` stop the swap's prefetch alone, as no media query can drop a preload.
94
95
  - Pages say `Vary: Save-Data`, so a cache or CDN keeps the two copies apart; a prerendered page is served to that visitor from its plain HTML, not the compressed copies the build wrote, its head changed on the way out. A static export has no header to read: the prefetch and the islands' wait still follow the browser, but the preloads stay.
95
96
  - Islands wait too: those with no `hydrate` hydrate once they scroll near, and the page preloads none of their chunks when the request says `Save-Data` (see [Islands](islands.md#hydration)).
96
97
  - A page streaming `await` blocks is swapped in once its first part is in, with the `pending` branches: `navigation.status()` is `'idle'` and `kay:navigate` fires then, once, while blocks may still be arriving, and each block replaces its branch in place later, firing nothing, its islands hydrating as it lands. A navigation to another page ends the stream. If the stream sends no byte for `pageTimeout` (the server writes a keep-alive every 5 s, so keep it above that) the blocks still pending stay as they are, the console gets a warning and `kay:navigate-stall` fires on `document` with `event.detail.url`, once, for an app to offer a retry; the page is not requested again, and `kay:navigate-error` is not fired.
97
98
  - `client: { saveData: false }` in `kay.config.ts` or `pages()` gives everyone the same page and image, with no `Vary`.
98
- - A link, or one inside an element, with `data-keep-scroll` swaps without scrolling to the top, and with `data-no-transition` without a view transition, as `navigate()`'s `scroll: 'keep'` and `transition: false` do; going back still restores the position saved, and a hash in the URL is not scrolled to while the scroll is kept. The nearest `data-keep-scroll` to the link decides, so `data-keep-scroll="false"` on a link, or on an element between it and a keeping one, scrolls to the top as a plain link does.
99
+ - A link, or one inside an element, with `data-scroll="keep"` swaps without scrolling to the top, and with `data-transition="false"` without a view transition, named as `navigate()`'s `scroll: 'keep'` and `transition: false` are; going back still restores the position saved, and a hash in the URL is not scrolled to while the scroll is kept. The nearest `data-scroll` to the link decides, so `data-scroll="top"` on a link, or on an element between it and a keeping one, scrolls to the top as a plain link does, and the nearest `data-transition` likewise (`data-transition` alone turns it back on inside a `"false"`). `data-scroll`, `data-transition`, `data-prefetch` and `data-reload` are typed on every element, a value outside their words a `kay check` error, and a `data-` name one letter from one of them (`data-prefech`) is the `unknown-link-flag` error. `data-keep-scroll`, `data-no-transition` and `data-no-prefetch` work until 1.108, `kay check --fix` writing the new names (`deprecated-link-flags`).
99
100
  - A stylesheet holding `@view-transition { navigation: auto; }` animates the swap where the browser has view transitions, as it animates full loads, the rule standing at the top level or inside an `@media` or `@supports` that holds.
100
101
  - A visitor asking for reduced motion (`prefers-reduced-motion: reduce`) gets no animation from the swap whatever the stylesheet says; a full load animates for them unless the rule sits in `@media (prefers-reduced-motion: no-preference)`, as the one `kay new` writes does.
101
102
  - `client: { navigation: false }` in `kay.config.ts` or `pages()` turns it off: pages load fully, and only pages with islands ship a script.
@@ -105,7 +106,7 @@ const dispose = mount(Panel, document.querySelector('#panel')!, { title: 'Ticket
105
106
 
106
107
  - A page another server or tool bundles, such as an HTML file `Bun.serve` imports, renders `.kay` components too.
107
108
  - The plugin `kay` from `kay/bun` compiles them, for the browser in a browser build: list `"kay/bun"` under `[serve.static] plugins` in `bunfig.toml`, which `Bun.serve` reads from the directory it starts in, or pass `kay({ root })` to `Bun.build`'s `plugins`, `root` being where `.kay/` goes, the working directory by default.
108
- - `mount(Component, element, props)` from `kay` (`kay/mount` is the same function) renders one into an element, as an island renders but with no server markup to hydrate, and returns a handle, which disposes it when called, ending its effects and removing only the nodes it rendered, so several components mounted into one element are disposed one at a time and the rest of the element stays as it was.
109
+ - `mount(Component, element, props)` from `kay` (`kay/mount` still exports it until 1.108, `deprecated-import-path` moving the import) renders one into an element, as an island renders but with no server markup to hydrate, and returns a handle, which disposes it when called, ending its effects and removing only the nodes it rendered, so several components mounted into one element are disposed one at a time and the rest of the element stays as it was.
109
110
  - `props` may be left out for a component taking none.
110
111
  - The handle is `{ update(props), dispose }` as well as the disposer: `handle.update({ title: 'Done' })` gives the mounted component its next props, which it reads reactively as an island does (a prop left out reads `undefined`), and `handle.dispose()` is `handle()`. `update` after a dispose does nothing.
111
112
  - `props` may be a function, `mount(Panel, el, () => ({ title: title() }))`, read as an effect reads: the mount follows the signals it uses, so a widget keeps current with no `update` call; an `update` on such a mount holds until a signal the function reads changes. The component reads a copy of the props, one getter each, not the object passed, and a function that throws on the first read throws out of `mount` with nothing left in the element. A prop changes when it is another value (`Object.is`).
@@ -50,6 +50,8 @@ form(ref={element => form = element} onSubmit={event => event.preventDefault()})
50
50
  input(aria-label="Title")
51
51
  ```
52
52
 
53
+ A handler of your own on Enter in a text field starts with `if (composing(event)) return` (`composing` from `kay`): the Enter that confirms an IME candidate, which Safari sends with `keyCode` 229 after `isComposing` is already false, is not yours to act on. `shortcut` and the `.enter` modifier already skip it on keydown.
54
+
53
55
  ## Reference
54
56
 
55
57
  ### Navigation
@@ -74,7 +76,7 @@ form(ref={element => form = element} onSubmit={event => event.preventDefault()})
74
76
  - After a swap the focus goes to the element the URL's `#fragment` points at, when the page has one (a section, or a link or field as it stands), its `tabindex="-1"` held only until it blurs, else to the page's `[autofocus]` field, heading or `main`; the new title is announced either way. Back and Forward to a position the entry saved leave the focus on the heading, as they leave the scroll.
75
77
  - A link to the page being rendered gets `aria-current="page"`, which screen readers announce and a stylesheet can light up, `aria-[current=page]:font-bold` with Tailwind: an `a` whose `href` is a path of the site, a trailing slash or not, and holds no query or fragment.
76
78
  - A link writing its own `aria-current` keeps it. The links of an island are marked in the server HTML the same way, and a swap keeping the island (`persist`) carries the next page's marks over to its links, matched by place and `href`; a link the island renders on its own after hydrating is its own to mark. A link marked with `section`, `a(href="/docs" section)`, or `section={isDocs}` for a boolean that decides it, also gets `aria-current="true"` on the pages below it (`/docs/guide`, not `/docs-old`), which a stylesheet lights up with `aria-[current=true]:font-bold`; the attribute is never written out, the site's home (`/` or a locale's own) is never marked that way, and it holds under `base`, `trailingSlash` and a locale prefix. A link not marked `section`, such as a pagination `prev` or a breadcrumb's parent, is lit on its own page only.
77
- - A link whose `href` leaves the site gets `target="_blank" rel="noopener"`: in a template, an island, `renderMarkdown` and a collection's Markdown body, an absolute `http(s)` URL of another origin or one starting `//`, compared with the `site` origin on the server (with no `site`, any absolute `http(s)` link) and `location.origin` in an island. A relative or root-relative path, `#hash`, `mailto:`, `tel:` and a same-origin absolute link stay in the same tab, as does a link writing its own `target` (an empty one too, and a `target={expr}` even when it gives `undefined`: spread `{...cond ? { target: '_blank' } : {}}` instead); one writing its own `rel` keeps it. `links: { outside: 'same-tab' }` in `kay.config.ts` or `pages()` writes none. The swap never follows a link with a `target`, so it never meets one. `markdownHtml` (a user's text, server and island) does the same with `rel="nofollow ugc noopener"`. Each such link also gets `data-new-tab`, which a rule in the page's head (`a[data-new-tab]::after`) turns into a visually hidden "(opens in a new tab)" for screen readers, worded under `kay.link.newTab` ([Locales](locales-texts.md)); an app adds an icon with CSS on `a[data-new-tab]`.
79
+ - A link whose `href` leaves the site gets `target="_blank" rel="noopener"`: in a template, an island, `renderMarkdown` and a collection's Markdown body, an absolute `http(s)` URL of another origin or one starting `//`, compared with the `site` origin on the server (with no `site`, any absolute `http(s)` link) and `location.origin` in an island. A relative or root-relative path, `#hash`, `mailto:`, `tel:` and a same-origin absolute link stay in the same tab, as does a link writing its own `target` (an empty one too, and a `target={expr}` even when it gives `undefined`: spread `{...cond ? { target: '_blank' } : {}}` instead); one writing its own `rel` keeps it. `client: { links: { outside: 'same-tab' } }` in `kay.config.ts` or `pages()` writes none. The swap never follows a link with a `target`, so it never meets one. `markdownHtml` (a user's text, server and island) does the same with `rel="nofollow ugc noopener"`. Each such link also gets `data-new-tab`, which a rule in the page's head (`a[data-new-tab]::after`) turns into a visually hidden "(opens in a new tab)" for screen readers, worded under `kay.link.newTab` ([Locales](locales-texts.md)); an app adds an icon with CSS on `a[data-new-tab]`.
78
80
 
79
81
  ### Islands kept across pages
80
82
 
@@ -91,12 +93,12 @@ form(ref={element => form = element} onSubmit={event => event.preventDefault()})
91
93
 
92
94
  ### Forms posting in place
93
95
 
94
- - A form posting to an action posts without a reload, then shows the page the post leads to, as the browser would: `failed()` and `succeeded()` of an action read as after a full post.
96
+ - A form posting to an action posts without a reload, then shows the page the post leads to, as the browser would: `form.failed()` and `data()` of an action read as after a full post.
95
97
  - A post going back to the same page, or refused and rendering it again, keeps the scroll position and the focused field.
96
98
  - A refused post moves focus to the form's first field marked `aria-invalid`, which a screen reader reads with the message describing it (see [Actions](actions.md)).
97
99
  - With no field marked, the message describing the form itself is announced and the control that posted it, such as a submit button, is focused again.
98
100
  - A refused post focusing its field reveals it as `focusInvalid` does.
99
- - An island calling an action moves no focus: what it shows on an `ActionError` is its own to focus.
101
+ - An island calling an action moves no focus: what it shows on a refusal is its own to focus.
100
102
  - `focusInvalid(root)` from `kay` does that once its writes rendered: it runs the effects they left pending, as `flush()` does, then focuses the first field marked `aria-invalid="true"` (or a `role="group"` marked `data-invalid`, whose first control takes the focus) under `root`, the whole document without one, that takes focus, such as one on a tab the write just showed, and resolves to whether one did, so the island needs no `requestAnimationFrame`.
101
103
  - `announce(text, within?)` from `kay` says `text` to a screen reader through the one polite live region kay keeps in `<body>` (in the open modal `dialog` holding `within`, the focused element by default, as the rest of the page is inert then): a text said twice in a row is read again, and the region (`data-kay-announce`, also `data-kui-announce`) is kept through page swaps. kay's pending blocks and its page swaps use it, and kayjs-ui's `announce` is the same function.
102
104
  - `markInvalid(element, by, invalid)` from `kay` marks a field `aria-invalid="true"` (a `role="group"`, which takes none, `data-invalid`) for `by`, any value naming the source, while `invalid`, and takes the mark off once no source holds it, kay's own mark of a refused field included, leaving one the page wrote before any source; a form field marking the control its parent writes calls it from an effect, so the field stays invalid while either it or the action refuses it.
@@ -25,7 +25,7 @@ h1 {post.title}
25
25
 
26
26
  ```kay
27
27
  --- server
28
- export const page = { prerender: true, ttl: '1h' }
28
+ export const page = { prerender: true, cache: '1h' }
29
29
  ---
30
30
  h1 Blog
31
31
  ```
@@ -86,7 +86,7 @@ h1 {post.title}
86
86
 
87
87
  #### Revalidating
88
88
 
89
- - `ttl: '1h'` beside `prerender` in `page` keeps a prerendered page fresh: once it is older than that, a string such as `'1h'`, the next request still gets it as it is, and starts rendering it again in the background, the way `kay build` does.
89
+ - `cache: '1h'` beside `prerender` in `page` (`ttl` before 1.105) keeps a prerendered page fresh: once it is older than that, a string such as `'1h'`, the next request still gets it as it is, and starts rendering it again in the background, the way `kay build` does.
90
90
  - It also tells a CDN in front how long to keep the page: [a CDN in front](cdn-caching.md).
91
91
  - Every request after that render lands gets the new page, with a new ETag and compressed copies.
92
92
  - One render runs at a time per path.
@@ -153,8 +153,8 @@ export const pageWeight: KayExtension = {
153
153
  - Every compressible file has its `.br` and `.gz` copy beside it, for a server sending them as they are (nginx's `gzip_static`), and asset names carry their hash, so the files of `_kay/` can be cached forever, except `search.json` and `THIRD-PARTY-LICENSES.txt`, which keep their name between builds and must revalidate. A server without brotli (the scaffold's `nginxinc/nginx-unprivileged`) drops the `.br` copies.
154
154
  - `_headers` (read by Netlify and Cloudflare Pages) and `headers.nginx.conf` (`add_header` lines for an nginx `include`, without HSTS) hold the security headers a server would send every response, the app's `security` settings applied, `_headers` also the `cache-control` of a page with a `ttl` ([a CDN in front](cdn-caching.md)). A page's own `security` setting is not carried (the build warns naming those routes), nor is the CSP report endpoint of `reports: true`, and a `public/_headers` keeps its rules, kay's block following them without a header the file names. The scaffold's Dockerfile moves the include to `/etc/nginx/kay-headers.conf`, and its `nginx.conf` includes it at server level and in every `location` with an `add_header` of its own, as nginx drops the inherited ones there.
155
155
  - Imported images link the variants the build writes, `/_kay/images/hero-640.webp`, `hero-640-16x9.webp` cut, `hero-96.webp` for a width under 320 a page asks for and `hero-card.jpg` for the share card, since no image route answers.
156
- - An image from `images.dirs` is not exported, and one from `images.remote` is downloaded by the build, its variants written as `/_kay/images/remote-<hash of its URL>-640.webp`, the build failing if the host does not answer.
156
+ - An image from `assets.images.dirs` is not exported, and one from `assets.images.remote` is downloaded by the build, its variants written as `/_kay/images/remote-<hash of its URL>-640.webp`, the build failing if the host does not answer.
157
157
  - A redirect without params becomes a page sending the browser on with `<meta http-equiv="refresh">`; every redirect also goes to `_redirects`, read by hosts such as Netlify and Cloudflare Pages.
158
- - With `i18n.prefixDefault`, each unprefixed path sends the browser to the default locale's copy.
158
+ - With `i18n.mode: 'always'`, each unprefixed path sends the browser to the default locale's copy.
159
159
  - Locales by domain need a server.
160
160
  - The directory is cleared first, only when the last export wrote it: kay refuses one holding other files, and the project itself.
package/llms/privacy.md CHANGED
@@ -41,7 +41,7 @@ For a script that needs the visitor's browser, such as a tracker that sets cooki
41
41
  ---
42
42
  import { persisted, effect } from 'kay'
43
43
 
44
- const consent = persisted('consent', '')
44
+ const consent = persisted.cookie('consent', '')
45
45
 
46
46
  effect(() => {
47
47
  if (consent() === 'yes')
@@ -112,7 +112,7 @@ export async function archive(scan: File) {
112
112
  - `theme` (kayjs-ui `ThemeToggle`, `themeMode`, `scheme`, or the name given to their `cookie`): `system`, `light` or `dark`, readable by scripts so the server renders the scheme the visitor picked; a preference, so necessary, a year.
113
113
  - `kay_push_device` (`push()`): a hash naming the push subscription this browser made, `httpOnly`, set when it subscribes, so sign-out drops that device alone; necessary, a year.
114
114
  - `kay_local_clear` (`local()`): a random value at sign-out, or at sign-in a hash of the person's id (kayjs-auth, or `forgetLocalMirrors(request, person)`), readable by scripts, derived from the app's secret; the next page using a collection empties the browser's mirror and queue when it changed, which another person's sign-in does and a sign-in again by the same person does not, so after a session expires the mirror stays readable on that browser until the next sign-in; necessary, a year, names no one.
115
- - Each `persisted(name, ...)` signal keeps its value in a cookie of that name for a year, or its `maxAge`, or in `localStorage` (`persisted.local()`) or `sessionStorage` (`persisted.session()`, dropped when the tab closes); what it holds is the app's choice, so a preference is necessary and anything else waits for consent.
115
+ - Each `persisted.cookie(name, ...)` signal keeps its value in a cookie of that name for a year, or its `maxAge`, or in `localStorage` (`persisted.local()`) or `sessionStorage` (`persisted.session()`, dropped when the tab closes); what it holds is the app's choice, so a preference is necessary and anything else waits for consent.
116
116
 
117
117
  ### Browser storage
118
118
 
@@ -129,7 +129,7 @@ export async function archive(scan: File) {
129
129
  - `sessionStorage` under the `remember` key of kayjs-ai's `Chat` and `ChatLauncher` (none unless named): the conversation's text, up to 200,000 characters, what the visitor wrote included; the tab's life, nothing without `remember`.
130
130
  - `localStorage` `kai:chat-conversation:<action URL>` (kayjs-ai's `ChatLauncher` with `keepOnServer` or `conversations`, or a `Chat` with `conversationIn="browser"`): the id of the conversation shown, which reads nothing without the visitor's session; necessary, until a new conversation.
131
131
  - `localStorage` under the `listWidthKey` of kayjs-ui's `SplitLayout` (none unless named): the list's width, a preference.
132
- - With `offline`, the service worker and its Cache Storage `kay-w<version>`: the pages `offline.pages` names (the public prerendered ones by default) and the files, and the public pages and files it fetched later that answered 200 without `private` or `no-store`; each copy changes with the build and the cache stays until `offline` is turned off or the worker's version changes. A page of `offline.pages` that holds a visitor's render is kept as it was served, so list only public ones.
132
+ - With `offline`, the service worker and its Cache Storage `kay-w<version>`: the pages `client.offline.pages` names (the public prerendered ones by default) and the files, and the public pages and files it fetched later that answered 200 without `private` or `no-store`; each copy changes with the build and the cache stays until `offline` is turned off or the worker's version changes. A page of `offline.pages` that holds a visitor's render is kept as it was served, so list only public ones.
133
133
 
134
134
  ### What the server keeps
135
135
 
@@ -143,7 +143,7 @@ export async function archive(scan: File) {
143
143
  - A queue keeps a waiting job's payload until it runs and a failed one's for `failedTtl`, 30 days by default from when its last attempt was due, or for good with `false`.
144
144
  - `queue.remove(id)` removes one job, and `queue.remove(match)` every waiting or failed job whose payload `match` returns true for, resolving with how many went; an app's own `JobStore` takes a function only when it has `jobs(queue)`.
145
145
  - kayjs-mail keeps an address that bounced or complained, with the reason, where it was reported and when, in `kay_mail_suppressions` until `mail.unsuppress(address)` or `mail.erase(address)`, so a person's address is not mailed again; it is the record of that refusal, kept as long as the address could be mailed.
146
- - kayjs-mail's mailing lists keep each subscriber's address, language, confirmation date and the proof of consent (the page of the form and the id of the notice it showed) in `data/mail-list.sqlite` until they unsubscribe or `mail.erase(address)` (which also removes the mails queued for it); an address nobody confirmed is dropped after 7 days, a broadcast and its deliveries (random ids, no address) 30 days after it finished.
146
+ - kayjs-mail's mailing lists keep each subscriber's address, language, confirmation date and the proof of consent (the page of the form and the id of the notice it showed) in the app's database (else `data/app.sqlite`) until they unsubscribe or `mail.erase(address)` (which also removes the mails queued for it); an address nobody confirmed is dropped after 7 days, a broadcast and its deliveries (random ids, no address) 30 days after it finished.
147
147
  - Notifications (`notify()`, [Notifications](notifications.md)) live 90 days, or the `ttl` given, in `store.notifications` (memory without a store), the newest 200 per user; `notifications.erase(userId)` deletes a person's, and the devices they subscribed to push in `store.push` (`push()`, [Notifications](notifications.md#push-to-a-persons-devices)), kept until no push reaches one for 180 days (`push({ keep })`); kayjs-auth's account export lists them.
148
148
  - The paths a production server counted 404s at (in the app's `store` database, SQLite or Postgres, else `data/not-found.sqlite`) are forgotten 90 days after the last visit, with their referrers, checked on opening, with the writes and every hour by a timer, so a log nobody adds to is swept too; the redirects stored beside them stay.
149
149
  - `sqliteRooms` from `kay/server` keeps a room's messages 30 seconds, for the processes sharing it to read.