@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
@@ -324,7 +324,7 @@
324
324
  }
325
325
  },
326
326
  "if": {
327
- "match": "^[ \\t]*(else[ \\t]+if|if)[ \\t]+(.*?)(?:[ \\t]+(as(?=[ \\t]+[a-z_$])|then)[ \\t]+([\\p{L}_$][\\p{L}\\p{M}\\p{N}_$]*))?[ \\t]*$",
327
+ "match": "^[ \\t]*(else[ \\t]+if|if)[ \\t]+(.*?)(?:[ \\t]+(then)[ \\t]+([\\p{L}_$][\\p{L}\\p{M}\\p{N}_$]*))?[ \\t]*$",
328
328
  "captures": {
329
329
  "1": {
330
330
  "name": "keyword.control.conditional.kay"
@@ -1,14 +1,14 @@
1
1
  id = "kay"
2
2
  name = "Kay"
3
3
  description = "Highlighting and the kay language server for .kay components"
4
- version = "1.104.3"
4
+ version = "1.105.0"
5
5
  schema_version = 1
6
6
  authors = [ "Kaynooo" ]
7
7
  repository = "https://github.com/Kayno0o/kayjs"
8
8
 
9
9
  [grammars.kay]
10
10
  repository = "https://github.com/Kayno0o/kayjs"
11
- rev = "v1.104.3"
11
+ rev = "v1.105.0"
12
12
  path = "editors/tree-sitter-kay"
13
13
 
14
14
  [language_servers.kay]
@@ -57,7 +57,7 @@ See [Rate limits](rate-limits.md#limit-attempts-in-a-guard-or-an-api-route).
57
57
  - It is hidden by a `style` attribute, which a `csp` dropping `style-src 'unsafe-inline'` would leave visible.
58
58
  - A page writing the field itself as well renders it twice, which still posts empty.
59
59
  - A form inside an island renders it itself, as its markup is claimed node by node when it hydrates: `div(style="position:absolute;left:-9999px" aria-hidden="true" inert)` around `input(name="website" tabindex="-1" autocomplete="off" data-1p-ignore data-lpignore="true" data-bwignore)`, and `kay check` takes it as one of the form's fields.
60
- - `honeypot: { field: 'website', pretend: true }` answers a bot filling it in as if its post went through instead, a call with no result and a plain form post going back to its page with `add.succeeded()` holding `data: undefined`, so the bot learns nothing to adjust.
60
+ - `honeypot: { field: 'website', pretend: true }` answers a bot filling it in as if its post went through instead, a call with no result and a plain form post going back to its page with `add.data()` holding `undefined`, so the bot learns nothing to adjust.
61
61
 
62
62
  #### Minimum time
63
63
 
@@ -65,7 +65,7 @@ See [Rate limits](rate-limits.md#limit-attempts-in-a-guard-or-an-api-route).
65
65
  - A form posting to the action renders a hidden `kay_since` field by itself, a stamp of when it rendered bound to the action and signed with a key derived from [the app secret](environment.md#the-app-secret) (so an app without sessions needs no `session()` for one), else a key of the process, which a restart changes: a production server refuses to start on it unless `KAY_EPHEMERAL_SECRET=1`; a test server never does.
66
66
  - A plain form post whose stamp is missing, forged, another action's or older than `maxAge`, a day by default, fails the same way, and the page it answers keeps the stamp the form rendered with, so the visitor does not wait again from zero.
67
67
  - A prerendered page holding such a form is still rendered once: the server signs a fresh stamp into it on every visit, as it splices in an inline server island, so the page goes out gzipped rather than in brotli and kept by no cache.
68
- - `minTime: { after: '3s', maxAge: '1h', pretend: true }` answers a post sent too soon as `honeypot`'s `pretend` does.
68
+ - `minTime: { after: '3s', ttl: '1h', pretend: true }` answers a post sent too soon as `honeypot`'s `pretend` does.
69
69
  - A form the server renders inside an island carries its honeypot and stamp like any other. A form an island builds in the browser (a branch shown after a click) asks `/_kay/fields/` plus the action's path, a GET answering `{ html }`, the same markup with a stamp signed at that moment, when it takes focus or is posted, and adds it to the form before the post reads its fields: it costs no request on page load, no code on a page without such a form, and for a form of an action with neither check one cached request per action and no field. The stamp is dated from that first focus or post, not from when the form appeared, so a button-only form with `minTime: '3s'` clicked at once is refused as `early`: `plain: true` leaves a form the script posts unchecked. A form post with no stamp is refused; a call from kay's script without one goes through, a stamp it sends still checked.
70
70
  - `minTime: { after: '3s', plain: true }` checks only a form the browser posts itself, without kay's script: the page swap's post and an island's call go through, for a form whose script already proves something, such as a `data-kay-work` field below: the header marking the swap's post proves nothing, so a script sending it skips `minTime`.
71
71
  - `site.submit` from a `Visit` sends its form's stamp, and `setSystemTime` from `bun:test` moves the clock past `minTime`.
@@ -74,10 +74,10 @@ See [Rate limits](rate-limits.md#limit-attempts-in-a-guard-or-an-api-route).
74
74
 
75
75
  - `tool` on the third argument offers the action as an MCP tool when `mcp: true` is set in kay.config.ts: `tool: true`, `tool: 'Create a note'` (its description) or `tool: { name: 'create_note', description: 'Create a note' }`. Without it an action is never offered.
76
76
  - `tool: { label: 'Read the home' }` words the action's calls for a visitor: kayjs-ai's `Chat` shows it in place of the tool's name, and an agent never reads it ([Chat](../../ai/llms/chat.md)).
77
- - `tool: { readOnly: true }` says the action only reads, so `/mcp` lists it with `readOnlyHint: true` and a client may approve it without a prompt, and kayjs-ai's `ask` runs it unasked while it holds every other tool for the visitor's yes ([Actions as tools](../../ai/llms/tools.md#allowing-a-write)).
77
+ - `tool: { readOnly: true }` says the action only reads, so `/_kay/mcp` lists it with `readOnlyHint: true` and a client may approve it without a prompt, and kayjs-ai's `ask` runs it unasked while it holds every other tool for the visitor's yes ([Actions as tools](../../ai/llms/tools.md#allowing-a-write)).
78
78
  - `tool: { text: notes => notes.map(note => note.title).join('\n') }` words the agent's answer from what the action returned (typed as it): the agent reads that text alone, with no JSON and no `structuredContent`, while the page and any other caller still get the object. A `text` that throws is the agent's refusal. Without it an object is sent as JSON in the text and as `structuredContent`, so a client reading either finds it. A route's `detail.tool` takes `text` too.
79
79
  - `tool: { output: t.Object({ count: t.Number(), at: t.String() }) }` lists the tool's `outputSchema`, so a client knows what a call answers before it calls (an API route's object `response` does the same; a route's `detail.tool` takes no `output`). It is an object schema, `t.Object` or `t.Record`: the types refuse a union, an array or a primitive, which is not listed. It is the JSON the agent receives, so a `Date` is `t.String()`, a bigint a string, a `Map` an object and a `Set` an array, and `kay check` refuses an `output` the handler's return value does not fit. With one, the answer is always sent as `structuredContent`, beside the `text` when there is one; without it, `text` alone sends no `structuredContent`, and with neither the JSON text and `structuredContent` both go. Under `kay dev` an action's answer that does not match, or an action with an `output` that answers nothing, logs one warning naming the tool and the first path that differs, for a library's tool (`actionTool()`) served by the app as for the app's own; production checks nothing, and a route's `response` is validated by Elysia as it always was.
80
- - An action that declares no `output` is listed with the `outputSchema` of its handler's return type, with nothing to declare: `kay build` reads it through tsgo (one declaration emit, only when a tool action asks for one and a source, config, lockfile or linked workspace package changed since the last (a file the build cannot see, such as a relative import out of the project, is read again by `--no-cache`), kept in `.kay/cache`, which `--no-cache` empties; recorded as `tool-outputs.json` in the build output, so `kay start` runs no tsgo) and `kay dev` records it in the background after each type check, which `/mcp` lists at its next request. It is the JSON wire form (`Date` and bigint strings, `Map` an object, `Set` an array, a property that may be `undefined` optional), an object only: a string, array or union answer, a tool with `text` (which sends that text alone), a stream, `unknown`/`any` and a type that cannot be written as plain data list none, and a property of such a type is any value. A declared `output` wins, a build that cannot run tsgo lists none (a failed `kay dev` run keeps the last record), an executable (`--compile`) holds the record, and a library's `actionTool()` carries no `outputSchema`, as a model's tool call takes none. An action whose options are a variable, or spread a `tool`, is probed too, whether or not it is a tool. `NaN` and `Infinity`, which JSON writes as `null`, are described as numbers.
80
+ - An action that declares no `output` is listed with the `outputSchema` of its handler's return type, with nothing to declare: `kay build` reads it through tsgo (one declaration emit, only when a tool action asks for one and a source, config, lockfile or linked workspace package changed since the last (a file the build cannot see, such as a relative import out of the project, is read again by `--no-cache`), kept in `.kay/cache`, which `--no-cache` empties; recorded as `tool-outputs.json` in the build output, so `kay start` runs no tsgo) and `kay dev` records it in the background after each type check, which `/_kay/mcp` lists at its next request. It is the JSON wire form (`Date` and bigint strings, `Map` an object, `Set` an array, a property that may be `undefined` optional), an object only: a string, array or union answer, a tool with `text` (which sends that text alone), a stream, `unknown`/`any` and a type that cannot be written as plain data list none, and a property of such a type is any value. A declared `output` wins, a build that cannot run tsgo lists none (a failed `kay dev` run keeps the last record), an executable (`--compile`) holds the record, and a library's `actionTool()` carries no `outputSchema`, as a model's tool call takes none. An action whose options are a variable, or spread a `tool`, is probed too, whether or not it is a tool. `NaN` and `Infinity`, which JSON writes as `null`, are described as numbers.
81
81
  - The tool takes the action's schema as its input and runs the action as a call would, its guards, `rateLimit`, body limit and `ctx.locals` included; `honeypot`, `minTime` and `proofOfWork` are skipped. An action with a file in its schema is not offered.
82
82
  - `kay check` warns (`unguarded-tool`) of such an action with one of those three and no guard; a guard or a `rateLimit` keeps it in hand. See [API routes](mcp.md).
83
83
 
@@ -85,7 +85,7 @@ See [Rate limits](rate-limits.md#limit-attempts-in-a-guard-or-an-api-route).
85
85
 
86
86
  - The refusals of these limits, and the one for a post over `maxSize`, read in English unless the site words them once for every action under `kay.protection.*` and `kay.action.*` in its catalogs ([Locales](locales-texts.md)), or `messages` gives an action's own, as a schema's `error` does for a field: `` messages: { honeypot: 'Laissez ce champ vide', minTime: reason => reason === 'early' ? 'Un instant, puis renvoyez-le' : 'Ce formulaire a expiré, renvoyez-le', rateLimit: wait => `Réessayez dans ${wait} s`, maxSize: bytes => `${bytes} octets au plus` } ``.
87
87
  - `rateLimit` is given the seconds to wait.
88
- - `minTime` is given `early` for a post sent too soon or `expired` for a stamp missing, forged or past `maxAge`, as a page from before a restart sends.
88
+ - `minTime` is given `early` for a post sent too soon or `expired` for a stamp missing, forged or past `ttl`, as a page from before a restart sends.
89
89
  - `proofOfWork` is given `missing`, `expired` or `wrong` as below.
90
90
  - `maxSize` is given the most bytes a post may send, as a number whatever size `maxSize` was written as.
91
91
  - Each is a string or a function; `serverError` is given the error and the action's `ctx` (see [Refused posts](actions.md#refused-posts)). A function runs in the request's locale, so it may word the refusal with `t()`; `serverError` may be async.
@@ -96,10 +96,10 @@ See [Rate limits](rate-limits.md#limit-attempts-in-a-guard-or-an-api-route).
96
96
  - The page carries a challenge for each action its forms post to, the hash of a random salt and a number up to the difficulty, signed as the `minTime` stamp is and bound to the action.
97
97
  - kay's script solves it in a worker, a same-origin file the browser build ships, from the moment one of those forms takes focus, then sends the solution with the post in an `x-kay-work` header.
98
98
  - `proofOfWork: 300_000` sets the difficulty, 100,000 by default: the browser hashes half of it on average, some tens of milliseconds on a laptop, more on an old phone.
99
- - `{ difficulty, maxAge: '1h', pretend: true, store }` sets how long a challenge stays good, a day by default.
99
+ - `{ difficulty, ttl: '1h', pretend: true, store }` sets how long a challenge stays good, a day by default.
100
100
  - `pretend` answers a wrong number or a solution sent twice as `honeypot`'s `pretend` does.
101
101
  - `store` keeps the solutions already used, each going through once, a `RateStore` as `rateLimit` takes, `sqliteRates(path)` sharing them between the processes of a machine, this process's memory by default.
102
- - A post without a solution, or to a challenge past `maxAge`, another action's or signed before a restart, fails with 422 and `errors['']` carrying a fresh challenge in the same header: an island's call, a script's with no form on the page included, solves it and goes again by itself, the call waiting on it then.
102
+ - A post without a solution, or to a challenge past `ttl`, another action's or signed before a restart, fails with 422 and `errors['']` carrying a fresh challenge in the same header: an island's call, a script's with no form on the page included, solves it and goes again by itself, the call waiting on it then.
103
103
  - A form posted without JavaScript sends none and is refused, unless the action sets `minTime` too: a post without JavaScript is then checked by `minTime` alone, so the pair stops no script that waits it out.
104
104
  - A form posted with `navigation: false` and no island has no script either, nor does one with `data-reload` or a `target`, which the swap leaves to the browser.
105
105
  - A prerendered page gets a fresh challenge on every visit, as a stamp.
@@ -107,9 +107,9 @@ See [Rate limits](rate-limits.md#limit-attempts-in-a-guard-or-an-api-route).
107
107
 
108
108
  #### Proof of work checked in code
109
109
 
110
- - `workChallenge(scope, { difficulty, maxAge })` from `kay/server` signs a challenge bound to `scope` rather than to an action, for code checking it itself, as kayjs-auth's CAPTCHA does: `input(type="hidden" name="proof" data-kay-work={workChallenge('contact')})` posts its solution as the field's value, kay's script solving it from the moment the form takes focus.
110
+ - `workChallenge(scope, { difficulty, ttl })`, `ttl` a day by default, from `kay/server` signs a challenge bound to `scope` rather than to an action, for code checking it itself, as kayjs-auth's CAPTCHA does: `input(type="hidden" name="proof" data-kay-work={workChallenge('contact')})` posts its solution as the field's value, kay's script solving it from the moment the form takes focus.
111
111
  - `await verifyWork(input.proof, 'contact', { difficulty, store })` from `kay/server` answers `undefined` once for each solution, else `missing`, `expired` (past `maxAge`, another scope's, signed before a restart, or easier than `difficulty`) or `wrong`. The solutions used are kept in `store`, else the app store's `rates`, else this process's memory.
112
- - The difficulty is signed into the challenge, so a scope asking more refuses one handed out before, the page then signing a harder one; `difficulty` is 100,000 by default and `maxAge` a day.
112
+ - The difficulty is signed into the challenge, so a scope asking more refuses one handed out before, the page then signing a harder one; `difficulty` is 100,000 by default and `ttl` a day.
113
113
  - A prerendered page gets a fresh challenge in the field on every visit, as a stamp; `site.submit` solves the field unless the test gives its value.
114
114
 
115
115
  ### Body limit
@@ -117,6 +117,6 @@ See [Rate limits](rate-limits.md#limit-attempts-in-a-guard-or-an-api-route).
117
117
  - A request with a body to any route, a library's, an extension's or the jobs page included, sends at most `limits.body`, 1 MB unless kay.config.ts sets another: `limits: { body: '4mb' }`, a size as `budget` takes it (`'800b'`, `'512kb'`, `'1.5mb'`) or a number of bytes.
118
118
  - An action raises or lowers it for itself, `action(schema, handler, { maxSize: '20mb' })`, and an API module for its routes, `api({ maxSize })`, a size or a function kay reads when it mounts the module (a library reading its own settings).
119
119
  - A bigger request is refused before anything reads it, from its `Content-Length`, or, sent in chunks without one, as soon as it passes the limit.
120
- - A plain form post goes back to its page with `errors['']` saying the most it may send, an island's call throws `ActionError` with status 413 and that error, and an API route answers 413.
120
+ - A plain form post goes back to its page with `errors['']` saying the most it may send, an island's call answers `{ ok: false }` with status 413 and that error (`.orThrow()` throws an `ActionError`), and an API route answers 413.
121
121
  - A route of an extension raises its own through the extension's `maxSize` ([Component libraries](component-libraries.md)); a route you add with `new Elysia().post()` has the app's, and `limits: { byPath: { '/upload': '50mb' } }` in kay.config.ts sets one for a path (the route and what is under it, the `base` left out) without raising the rest. For the path of an `api()` module it wins over the module's `maxSize` (the module's own cors grant stays on the 413), while a route's `detail.maxSize` still wins over both.
122
122
  - Bun's own cap, 128 MB unless `new Elysia({ serve: { maxRequestBodySize } })` sets another, still holds over any `maxSize`.
@@ -8,28 +8,24 @@
8
8
 
9
9
  ### Call an action from an island
10
10
 
11
- An island imports the action from the page and calls it, catching `ActionError` to show the schema's messages:
11
+ An island imports the action from the page and calls it. The call answers `{ ok: true, data }` or `{ ok: false, error }` and never throws for a refusal, so the schema's messages show through `add.form.error()` with no `try`; `.orThrow()` is the throwing style:
12
12
 
13
13
  ```kay
14
14
  ---
15
- import { ActionError, signal } from 'kay'
15
+ import { signal } from 'kay'
16
16
  import { add } from '../routes/index.kay'
17
17
 
18
18
  const title = signal('')
19
19
 
20
20
  async function save() {
21
- try {
22
- await add({ title: title() })
21
+ const result = await add({ title: title() })
22
+
23
+ if (result.ok)
23
24
  title = ''
24
- }
25
- catch (error) {
26
- if (!(error instanceof ActionError))
27
- throw error
28
- }
29
25
  }
30
26
  ---
31
- input(bind:value={title} aria-invalid={add.error('title') ? 'true' : undefined})
32
- if add.error('title') then message
27
+ input(bind:value={title} aria-invalid={add.form.error('title') ? 'true' : undefined})
28
+ if add.form.error('title') then message
33
29
  p.error {message}
34
30
  button(onClick={save} disabled={add.pending()}) Add
35
31
  ```
@@ -40,13 +36,13 @@ A page or layout with a `--- server` fence passes an action it declares or impor
40
36
 
41
37
  A production build carries the code reviving an action only when the app's own sources call `action(` (or import it as another name) or use a kay library. A page handing an island an action created only in a package outside the app fails with an error naming this; call `action(` in one of the app's files, as `export const greet = action(...)` in a route, to keep it.
42
38
 
43
- Type the prop with `Action` from `kay` (`ServerAction` counts too): `Action<never, unknown>` takes any action, `NoInputAction<unknown>` any declared without a schema, and `Action<{ name: string }, string>` keeps its input and output types (the output is the success one, so a handler that can `ctx.fail` fits: `Action<{ dossier: string }, AsyncGenerator<string>>`). The type is only for the types: an island typing the prop as a plain function, `(input: { name: string }) => Promise<string>`, is handed the action all the same, the code reviving it loading in the browser only for a page that passes an island one, and shipped only by an app that calls `action(` in its own sources or uses a kay library: an action declared by a package outside the app that is no kay library makes the page fail, as above. The action crosses as its URL, so it must be an export of a route module, declared in the page or imported. `move.with({ id })` and an action no route exports fail the render: pass the plain action, the fields as input.
39
+ Type the prop with `Action` from `kay` (`ServerAction` counts too): `Action`, with no parameters, takes any action, `NoInputAction<unknown>` any declared without a schema, and `Action<{ name: string }, string>` keeps its input and output types (`Action<never, unknown>`, the old spelling of the bare one, works until 1.108 and `deprecated-action-type` rewrites it) (the output is the success one, so a handler that can `ctx.fail` fits: `Action<{ dossier: string }, AsyncGenerator<string>>`). The type is only for the types: an island typing the prop as a plain function, `(input: { name: string }) => Promise<string>`, is handed the action all the same, the code reviving it loading in the browser only for a page that passes an island one, and shipped only by an app that calls `action(` in its own sources or uses a kay library: an action declared by a package outside the app that is no kay library makes the page fail, as above. The action crosses as its URL, so it must be an export of a route module, declared in the page or imported; one no route exports fails the render. `move.with({ id })` crosses with its fields: the island's calls and its `track()` send them over the input they are given, as a form posting to it does, while its `pending()`, `error()` and every other reading are those of the action, as is its queue: `queue: 'latest'` on a call of `move.with({ id: 1 })` drops one of `move.with({ id: 2 })` still running. Typed `Action` as any other.
44
40
 
45
41
  ```kay
46
42
  ---
47
43
  import type { Action, NoInputAction } from 'kay'
48
44
 
49
- const { signOut, run } = props<{ signOut: NoInputAction<unknown>, run: Action<never, unknown> }>()
45
+ const { signOut, run } = props<{ signOut: NoInputAction<unknown>, run: Action }>()
50
46
  ---
51
47
  form(action={signOut})
52
48
  button Sign out
@@ -97,8 +93,8 @@ import { count } from '../routes/index.kay'
97
93
 
98
94
  const answer = signal<ActionStream<number> | undefined>(undefined)
99
95
  ---
100
- button(onClick={async () => answer = await count({ to: 10 })}) Count
101
- p {answer()?.last()}
96
+ button(onClick={async () => answer = await count({ to: 10 }).orThrow()}) Count
97
+ p {answer()?.data()}
102
98
  ```
103
99
 
104
100
  ### Show a change before the server answers
@@ -121,30 +117,31 @@ p {column()}
121
117
 
122
118
  ### Calling from an island
123
119
 
124
- - An island imports the action from the page and calls it, as in [Call an action from an island](#call-an-action-from-an-island): `const id = await add({ title })`.
120
+ - An island imports the action from the page and calls it, as in [Call an action from an island](#call-an-action-from-an-island): `const { ok, data, error } = await add({ title })`, or `const id = await add({ title }).orThrow()` to throw the failure.
125
121
  - An `s.Optional` field takes `undefined` as the field left out, `exactOptionalPropertyTypes` or not: `resize({ file, width: max ?? undefined })`. A wrong field is reported at that field, not against the `FormData` form of the call.
126
- - Once a call went through, the page shows what it changed, its loads run again as `refresh()` runs them, where the page swap runs: islands whose props did not change keep their state.
127
- - `add({ title }, { refresh: false })` leaves the page as it is, so a frequent write from an island (a vote, an undo) needs no API route to avoid the refresh; `const save = add.track()` then `await save(input, { refresh: false })` also answers a refusal as a result.
122
+ - Once a call went through, the page shows what it changed, its loads run again as `refresh()` runs them, where the page swap runs: islands whose props did not change keep their state. A page with `liveRefresh: true` in its [settings](routing.md#page-settings) is left alone when every cached key the handler invalidated (`cached(..., { live: true })`) is one the page or a `resource()` follows: its live connection, once open, shows them a moment after the answer (`x-kay-invalidated` names the keys on the answer; a streaming action's end event names them, as it goes on invalidating until the stream ends). One key not followed, more than 20 keys or a connection that is down load the page as before, and `refresh: true` always does.
123
+ - `add({ title }, { refresh: false })` leaves the page as it is, so a frequent write from an island (a vote, an undo) needs no API route to avoid the refresh; `add` answers a refusal as a result, as `await add(input, { refresh: false })` does.
128
124
  - `await add.settled()` resolves once no call to `add` is in flight, whichever way they went (a stream counts until it ends; it never rejects), so an island that fired writes without awaiting them waits for them there; `save.settled()` does the same for the calls made through a `track()` handle.
129
125
  - `add.pending()` reads, reactively, whether a call the page made is still in flight, and `add.progress()` how much of a call carrying files the browser sent, from 0 to 1: `button(disabled={add.pending()})`.
130
- - `await move({ id, to }, { optimistic: () => tiers = moved })` shows the change at once: if the call fails, or the function throws, each signal the function wrote goes back to what it held, those another optimistic call made inside it wrote included, a `selection` among them with its `is(key)` flags, unless something wrote it since, while that call's `pending()` follows its own request, and the call throws as any does.
126
+ - `await move({ id, to }, { optimistic: () => tiers = moved })` shows the change at once: if the call fails, or the function throws, each signal the function wrote goes back to what it held, those another optimistic call made inside it wrote included, a `selection` among them with its `is(key)` flags, unless something wrote it since, while that call's `pending()` follows its own request, and the call answers its failure as any does.
131
127
  - Calls over one signal each put it back to what it held before them when they fail, whichever order they fail in: a failure found overwritten by a later call still in flight hands that call the earlier value, so it ends where it began if it fails too.
132
128
  - A call takes `queue: 'parallel' | 'serial' | 'latest'`: `serial` posts a call once the earlier ones of the action settled (a stream counts settled once it started), `latest` aborts the earlier calls still in flight, which reject with an `AbortError` and put their `optimistic` change back, with no `onError`. `add.track({ queue })` gives the handle's own calls that default, ordered apart from the action's, and an abort is no failure of the handle.
133
- - `timeout: '5s'` aborts a post unanswered that long (counted from the post, not from the wait in a queue): the call rejects with a `TimeoutError`, `pending()` clears, `track()` records it as a failure with status 0, and the page refreshes as after an abort once sent.
129
+ - `timeout: '5s'` aborts a post unanswered that long (counted from the post, not from the wait in a queue): the call answers a failure with status 0, `pending()` clears, `track()` records it as a failure, `.orThrow()` rejects with that `ApiError` (status 0, its `cause` the `TimeoutError`), and the page refreshes as after an abort once sent.
134
130
  - `keepalive: true` sends the post with `fetch`'s `keepalive`, so a call made from `pagehide` or `beforeunload` outlives the page: `save(state, { keepalive: true })`. A browser caps a keepalive body at 64 KB, so a JSON body over it is sent as a plain post instead of failing, as is a call carrying files or a form. The cap is shared by every keepalive request of the page in flight, so a call that would pass it with the ones kay sent is posted plain too; kay's own error reports count against it unseen, so a save can still be refused beside them; a page holding a proof-of-work challenge loads its solver first, which an unloading page may not finish.
135
131
  - `retry: 2` or `retry: { times, delay, when }` posts again after a 503 or a post that failed before it was sent (`delay` defaults to `'500ms'` and doubles; `when(error)` takes an `ApiError` and decides alone for the rest). A timeout, a 504 and a network failure after the send need a `when`, as the handler may have run; a redirect and an abort are never tried again, and a TypeError thrown before the post is no failure of it. Every try sends one `Idempotency-Key` header (32 hex characters, an own `headers` entry wins), read from `ctx.request`, so a handler tells a repeat from a new call.
136
132
  - `onStart({ input })`, `onSuccess({ data })`, `onError({ error })` (an `ApiError`) and `onSettled({ data, error })` observe a call; none runs `onError` for an abort or a redirect, `onSettled` runs for every ending (an abort's `error` is the abort), `onSuccess` of a stream runs as it starts, `latest` never aborts a stream already started, and a hook that throws or rejects is logged and never fails the call.
137
133
  - `refresh` also takes a `resource()` or a list of them (anything with a `refresh()`): those are refreshed in place of the page's loads, with or without the page swap.
138
134
  - `refresh: 'cart'` names a load of the page instead, the binding of a top-level `const cart = await ...` in the page's or a layout's server fence (a destructuring names each of its bindings; a `const total = cart.total * 2` names the load it reads): the page runs as a whole, but only the elements reading that load are sent and swapped, and what shows the others stays as it is. `refresh: ['cart', wishlist]` mixes names and `resource()`s, and `refresh()` from `kay` takes the same names: [rendering](rendering.md#refreshing-some-loads).
139
- - A `form(action={add})` posting in place fires `kay:action-start` on the form (bubbling, `detail: { action, data }` with the fields) before the post, then `kay:action-success` (`detail: { action }`) or `kay:action-error` (`detail: { action, status, errors }`, status 0 and no errors for a failure with no answer) while the form is still on the page, typed on `listen`'s targets. An island shows a change with `listen(() => form, 'kay:action-start', ...)` and `optimistic(change)` from `kay`, which gives `{ undo, keep }`, and calls `undo()` on the error and `keep()` on success.
135
+ - A `form(action={add})` posting in place tells an island how it goes with the hooks of the action: `add.onStart(({ input }) => ...)` before the post (`input` the fields as `FormData`), then `add.onData(({ input }) => ...)` once it went through or `add.onError(({ error, input }) => ...)` when it did not (`error` an `ApiError` with the `status` and the `errors` per field, status 0 and none for a failure with no answer), while the form is still on the page. Each returns what removes it and ends with the island; they hear the posts of every form of that action, `.with()` ones included, and not the calls of `add(...)`, which take `onStart`, `onSuccess` and `onError` as options. An island shows a change with `add.onStart` and `optimistic(change)` from `kay`, which gives `{ undo, keep }`, and calls `undo()` on the error and `keep()` on success. They are the function form of the `kay:action-start`, `kay:action-success` and `kay:action-error` events the form fires on itself (bubbling, `detail: { action, data }`, then `{ action, data }` and `{ action, status, errors, data }`), which a plain script listens to; `listen(() => form, 'kay:action-start', ...)` in an island is `deprecated-island-events`. [Events](events.md) maps each event to its hook.
140
136
  - Once it went through, the refresh brings what the server kept, which a `linked` signal then takes.
141
137
  - `{ signal }` aborts a call: it rejects with the signal's reason, what `optimistic` showed goes back, and the action records no outcome.
142
138
  - `{ headers }` sends extra request headers with the call, which the handler reads from `ctx.request`; the ones kay sets itself win.
143
139
  - A call aborted once sent may still have run, so the page refreshes as after one that went through, unless `refresh: false`.
144
- - The call is typed, `ctx.fail` results excluded, and throws `ActionError` from `kay` with `status`, `errors` and `data` when it fails, its `message` being the string given to `ctx.fail`, else the form-wide message, the schema's field messages joined, or `data.message`, so `error.message` is what to show; it extends `ApiError`, so one `instanceof ApiError` catches a refused action and a refused `call()`.
145
- - `const save = add.track()` is a handle for one component, row or button: `save.pending()` reads, reactively, only the calls made through it, where `add.pending()` reads every call of the page; `save.status()` (`idle`, `loading`, `ready`, `failed`), `save.error()` (the last failure as an `ApiError`, a call that got no answer included, kept until a call succeeds) and `save.retry()` (repeats the call that failed, with the same arguments as they were, gives no result back, and ignores a redirect) read the same way ([Island sources](island-sources.md)). `add.track({ onSuccess: ({ data, input }) => ..., onError: ({ error, input }) => ... })` takes callbacks for every call of the handle, and the handle has them as methods too (`save.onError(({ error }) => toast.error(error.message))`, returning what stops it): `onSuccess` runs when a call succeeds (for a stream, once it is open), `onError` when it fails, a call that got no answer included, never for an abort or a redirect; `input` is what the call was given ([Island sources](island-sources.md#hooks)). `call.track(module, path, hooks)` takes the same two.
146
- - `await save(input, options)` takes what `add` does and resolves with `{ ok: true, data }` or, for any non-2xx answer of the server, `{ ok: false, status, message, errors, data, error }` (`error` repeats the four), `message` the text to show, `errors` per field and `data` typed as `add.refused` types it, so no `try` or `ActionError` check is needed; a failure with no answer, a network error, an abort or a redirect, still throws, `pending()` clearing either way; an action with no input is called `save()`.
147
- - The same `{ ok, status, message, errors, data }` (an `ErrorShape` when not ok) is what `call.track(module, path)` gives for an API route ([API from islands](api-from-islands.md)), so one result handler serves both.
140
+ - The call is typed, `ctx.deny` results excluded: it answers `{ ok: true, data }` for what the handler returned, else `{ ok: false, status, message, errors, data, error }`, `error` repeating the four as an `ActionError` from `kay`, its `message` being the one given to `ctx.deny`, else the form-wide message, the schema's field messages joined, or `data.message`, so `result.message` is what to show; `data` is typed as `add.refused` types it. It never throws for a visitor's mistake, a refusal (4xx), a handler that threw (5xx), a network failure or a timeout (status 0) alike, `pending()` clearing either way; an abort rejects with its reason and a redirect with an `ActionRedirectError`, as they are no failure of the call.
141
+ - `await add(input).orThrow()` is the throwing style: it resolves with the data and throws the `ActionError` (an `ApiError`, so one `instanceof ApiError` catches a refused action and a refused `call()`), or for a failure with no answer the `ApiError` of status 0 that `result.error` holds, its `cause` the browser's `TypeError` or the `TimeoutError`.
142
+ - `const save = add.track()` is a handle for one component, row or button: `save.pending()` reads, reactively, only the calls made through it, where `add.pending()` reads every call of the page; `save.status()` (`idle`, `loading`, `ready`, `failed`), `save.error()` (the last failure as an `ApiError`, a call that got no answer included, kept until a call succeeds) and `save.retry()` (repeats the call that failed, with the same arguments as they were, gives no result back, and ignores a redirect) read the same way ([Island sources](island-sources.md)). `add.track({ onData: ({ value, input }) => ..., onError: ({ error, input }) => ... })` takes callbacks for every call of the handle, and the handle has them as methods too (`save.onError(({ error }) => toast.error(error.message))`, returning what stops it): `onData` runs when a call succeeds, `value` what it answered (for a stream, once it is open; `onSuccess({ data })` works until 1.108), `onError` when it fails, a call that got no answer included, never for an abort or a redirect; `input` is what the call was given ([Island sources](island-sources.md#hooks)). `call.track(module, path, hooks)` takes the same two.
143
+ - `await save(input, options)` takes what `add` does and answers the same result, a handle's calls only counting in its own `pending()`; an action with no input is called `save()`.
144
+ - The same `{ ok, status, message, errors, data }` (an `ErrorShape` when not ok) is what `call(module, path)` and `call.track(module, path)` give for an API route ([API from islands](api-from-islands.md)), so one result handler serves both.
148
145
  - `add.refused(error)` tells a refusal of a call to `add` from any other error, a redirect's included, and types its `data` as the handler passes it to `ctx.fail`, with no cast: `if (add.refused(error)) shown = error.data?.message`.
149
146
  - `data` is undefined for a call refused before the handler ran, by the schema or a limit.
150
147
  - Its input, its result and that `data` cross as island props do, Dates, Maps, Sets and bigints included; a result holding a function or a class instance answers 500, logging where it sits.
@@ -155,12 +152,12 @@ p {column()}
155
152
 
156
153
  ### Streaming actions
157
154
 
158
- - A handler returning an async iterable answers a call from an island with server-sent events: `await reply({ prompt })` resolves once the first value is there with an `ActionStream<T>` from `kay`, typed from what it yields, whose `last()`, `status()`, `onData()` and `close()` read as `stream()`'s do (it is the same `Connection` type); it never reconnects by itself, but `retry()` on one that failed calls the action again with the same input and reads the new answer into the same stream (`pending()` while it is sent, `onOpen({ reconnected: true })` once it opens, `last()` forgotten), and a refused retry fails it again. `await answer.ended()` reads it to its end with no polling: it resolves with the last value once the stream ran to its end (undefined for none), and rejects with an `ActionError` of status 500 when it failed, as a throw before the first value does, or an `AbortError` when it was closed first, which a stream closing with its block or with a visit to another path is, so code awaiting it there catches that. It is a method rather than the stream being awaitable, as `await reply()` would then wait for the end and hand back the value instead of the stream. `Answer<Output>` from `kay` is what a call resolves with for a given output, an `ActionStream` for an iterable, for a library typing a callback that receives it.
159
- - Guards, the schema, `rateLimit`, the cross-site check and the bot protections run before the handler, and what the iterable throws before its first value, a `ctx.redirect`, a `ctx.deny` or an error, answers as the handler's would, the call throwing `ActionError` or redirecting; the cookies it set by then go out with the stream.
155
+ - A handler returning an async iterable answers a call from an island with server-sent events: `await reply({ prompt })` resolves `{ ok: true, data }` once the first value is there, `data` an `ActionStream<T>` from `kay`, typed from what it yields, whose `last()`, `status()`, `onData()` and `close()` read as `stream()`'s do (it is the same `Connection` type); it never reconnects by itself, but `retry()` on one that failed calls the action again with the same input and reads the new answer into the same stream (`pending()` while it is sent, `onOpen({ reconnected: true })` once it opens, `last()` forgotten), and a refused retry fails it again. `await answer.ended()` reads it to its end with no polling: it resolves with the last value once the stream ran to its end (undefined for none), and rejects with an `ActionError` of status 500 when it failed (a call that failed before the first value answered `{ ok: false }` instead), or an `AbortError` when it was closed first, which a stream closing with its block or with a visit to another path is, so code awaiting it there catches that. It is a method rather than the stream being awaitable, as `await reply()` would then wait for the end and hand back the value instead of the stream. `Answer<Output>` from `kay` is what a call resolves with for a given output, an `ActionStream` for an iterable, for a library typing a callback that receives it.
156
+ - Guards, the schema, `rateLimit`, the cross-site check and the bot protections run before the handler, and what the iterable throws before its first value, a `ctx.redirect`, a `ctx.deny` or an error, answers as the handler's would, the call answering `{ ok: false }` or redirecting; the cookies it set by then go out with the stream.
160
157
  - A throw past the first value is logged, `onError` included, and ends the stream `failed`.
161
- - `pending()` stays true until the stream ends; once it ran to its end the page refreshes, unless `refresh: false`, and `succeeded()` reads its last value.
158
+ - `pending()` stays true until the stream ends; once it ran to its end the page refreshes, unless `refresh: false`, and `data()` reads its last value.
162
159
  - `close()` stops the handler's iterable, its `finally` running, as does the visitor going away; a stream called from an island's setup, an element's event handler or a `listen` callback closes with the enclosing block or component (the nearest still alive for a row playing its leave phase, or for a block the call's own result removes, as `reply = await ask()` flipping the `if` its button sits in, as long as the block goes in the task the answer arrived in), so a `persist` island's stays open across pages, and an effect running again closes the one it called; a stream called under no owner (after an `await` in a handler, or from a timer, or from a handler of an element whose whole owner chain is already disposed) closes once the visitor goes to another path, not at once. An `effect()` or `onCleanup()` called in a `listen` callback attaches to the island's owner and builds up per event, as in an element's handler, so keep them out of it; the callback is called with no `this`, so a `function` callback reads the target as `event.currentTarget`.
163
160
  - `rateLimit` with `count: 'succeeded'` counts a stream once its first value is there, and a drained post once its iterable ended.
164
161
  - A `pretend` bot protection answering an island's `FormData` call resolves `undefined`, not an `ActionStream`, as the handler never ran.
165
162
  - `on()` added right after the call resolves gets every value, `last()` only the latest: a reply yields the text so far rather than the piece added, so `last()` is all an island reads.
166
- - A plain form post, a page swap's post and an MCP tool call read the iterable to its end and get its last value, as from a handler returning it: `reply.succeeded()?.data`.
163
+ - A plain form post, a page swap's post and an MCP tool call read the iterable to its end and get its last value, as from a handler returning it: `reply.data()`.
@@ -8,20 +8,34 @@
8
8
 
9
9
  ### Refused fields and their messages
10
10
 
11
- - A form posting to an action shows a refused post again by itself: each `input`, `textarea` and `select` in it whose `name`, and `type` if any, are written out takes the value the post sent in place of the one the template gives, a checkbox or radio button whether it was ticked, a field named like a secret (a password), a file, the honeypot and the form's own callback fields excepted. Forms posting to one action share one refused post. A component inside the form reads the same post with `postedValue(name, fallback?)`, `postedChecked(name, value?, fallback?)` and `postedValues(name, fallback?)` from `kay` (undefined outside a refused post and for a secret; in the browser they read what the server rendered, answering only a value that differs from `fallback`), which is how the kayjs-ui controls refill; a list field posts back as `name[]`, and a literal field named `foo[]` is not a list. The same components read the form's messages with `formErrors()` from `kay`, called in the script and answering `(field) => action.error(field)` of the form being rendered (nothing outside one), which is how a FormField shows `add.error('title')` with no `issue` prop; a component given an `action` (kayjs-ui's `Form`) is that form for its content: the kayjs-ui controls and the page's own `input`s in it refill and take `aria-invalid` on the server as in a `form(action)` (in the browser a component's `input` is its own). An island's own template does not know a `form(action)` of the page around it: its FormField shows nothing by name, so give the island the action (`Form(action={add})` inside it) or an `issue` prop.
11
+ - A form posting to an action shows a refused post again by itself: each `input`, `textarea` and `select` in it whose `name`, and `type` if any, are written out takes the value the post sent in place of the one the template gives, a checkbox or radio button whether it was ticked, a field named like a secret (a password), a file, the honeypot and the form's own callback fields excepted. Forms posting to one action share one refused post. A component inside the form reads the same post with `postedValue(name, fallback?)`, `postedChecked(name, value?, fallback?)` and `postedValues(name, fallback?)` from `kay` (undefined outside a refused post and for a secret; in the browser they read what the server rendered, answering only a value that differs from `fallback`), which is how the kayjs-ui controls refill; a list field posts back as `name[]`, and a literal field named `foo[]` is not a list. The same components read the form's messages with `formErrors()` from `kay`, called in the script and answering `(field) => action.form.error(field)` of the form being rendered (nothing outside one), which is how a FormField shows `add.form.error('title')` with no `issue` prop; a component given an `action` (kayjs-ui's `Form`) is that form for its content: the kayjs-ui controls and the page's own `input`s in it refill and take `aria-invalid` on the server as in a `form(action)` (in the browser a component's `input` is its own). An island's own template does not know a `form(action)` of the page around it: its FormField shows nothing by name, so give the island the action (`Form(action={add})` inside it) or an `issue` prop.
12
12
  - Each field the post was refused for gets `aria-invalid="true"`, and `aria-describedby` naming the element showing its message, so a screen reader reads the message with the field. In an island the mark goes once the field is no longer refused, unless a component still marks it through `markInvalid` (see [Islands](navigation.md#forms-posting-in-place)), such as a kayjs-ui `FormField` showing a message of its own.
13
13
  - An `error title` line inside the form shows that message: `p.error`, with the id `add-title-error`, while the post is refused for `title`, nothing otherwise.
14
14
  - `error.text-sm title` adds classes.
15
15
  - A quoted name such as `error "first-name"` takes any field, and the name is typed from the schema.
16
- - A bare `error` shows the form's own message, `add.error()`, its `form` described by it.
16
+ - A bare `error` shows the form's own message, `add.form.error()`, its `form` described by it.
17
17
  - One inside a `for` renders without an id and describes nothing.
18
18
  - A `pending` block inside the form shows its lines only while that form posts, with no JavaScript of your own and none added to the page: the runtime that posts the form in place unhides it, and hides it again once the page the answer leads to (a redirect's included) is in; when the answer ends in a document that replaces the page (a redirect to another origin, a reload), it stays shown while that loads (ten seconds at most), and a page restored from the cache hides it. It is hidden in the render, after the answer or a refused post, and without JavaScript.
19
19
  - In an island the block shows as well while a call of the form's action is in flight, from `onSubmit`, an `onClick` or anywhere else (`add.pending()`, so every call of the action, `add.with(...)` included: the forms of a list sharing one action all show their block; a `track()` handle is no action a form can post to), and while an `onSubmit` returns a promise.
20
20
  - The block is a `slot` laid out as its contents, so it takes no place of its own in a flex or grid form and needs no class. No style rule is involved, so a strict `style-src` leaves it working.
21
21
  - Its text is announced through a live region the runtime writes outside the form, as the form's `aria-busy` may hold back a region inside it.
22
- - Without an `error` line, the field is described by the element an `if add.error('title')` block shows first, or one holding `{add.error('title')}`, written outside a `for` in the file holding a form that posts to `add`, which keeps its own `id` or gets one such as `add-title-error`.
23
- - The form likewise is described by the element showing `add.error()`.
22
+ - Without an `error` line, the field is described by the element an `if add.form.error('title')` block shows first, or one holding `{add.form.error('title')}`, written outside a `for` in the file holding a form that posts to `add`, which keeps its own `id` or gets one such as `add-title-error`.
23
+ - The form likewise is described by the element showing `add.form.error()`.
24
24
  - A static `aria-describedby` the template writes, such as a hint, is kept and the error's id added after it; a bound one is left as it is.
25
25
  - A message rendered any other way, through a component, a `for` over `errors` or another file, describes nothing, and the field is then announced as invalid without it.
26
26
  - A field with a `bind:`, a spread, `disabled` or `multiple` keeps what the template gives, and one the page renders through another component is not the form's own.
27
27
  - On a page posting no refused form, every field renders as written.
28
+
29
+ ### Reading the outcome
30
+
31
+ - `add.form.failed()`, `add.data()`, `add.status()` and `add.form.error('title')` read the outcome from any template, layout, component or island, and from the server fence. What a form shows is read from `add.form` (`failed()`, `error(field)`, `validate(form, field)`), apart from the call state on `add` itself (`pending()`, `status()`, `data()`, `progress()`, `settled()`, `track()`); `failed()`, `error()` and `validate()` on `add` work until 1.108 and `deprecated-action-readers` rewrites them.
32
+ - `form.error()` without a field is the form-wide message, `errors['']`.
33
+ - The field name is typed from the schema.
34
+ - An island reads them in the browser too, as its server render did, but for `values`, which stay on the server, so no field the server cannot tell is a secret reaches the page's source: the fields hold what was sent.
35
+ - Once the page shown called the action, they read how its last call went instead, reactively, a call clearing them as it starts: an island calling `add({ title })` gets `{ ok: false }` and `add.form.error('title')` shows the message, the field marked invalid.
36
+ - `await add.form.validate(form, field?)` checks a form against the action's schema, writing what it refuses into `add.form.error(field)` and `add.form.failed()` in place of the last outcome (`data()` too), for every field or `field` alone; it resolves whether it is accepted, posts nothing, and accepts a form with no schema on the page (a client-only island's). kayjs-ui's `Form`, `SaveForm` and `FormDialog` take `validate="submit" | "blur"`.
37
+ - A post that succeeds goes back to the page with what the handler returned: `add.data()` returns it, typed from the action, or `undefined`, on that one render only; `add.status()` is `ready` then. `succeeded()`, which wrapped it in `{ data }`, works until 1.108 and `kay check` rewrites it.
38
+ - `data` travels in a cookie, sealed (AES-GCM under a key derived from [the app secret](environment.md#the-app-secret), else a key of the process, which a restart changes), so a secret shown once, such as a new API token, can be neither read nor altered in it.
39
+ - Data too big for it, over about 3.5 KB sealed, is left out with a warning, and `data()` returns `undefined`, as it does for a cookie that does not open, forged or sealed before a restart.
40
+ - A prerendered page reads both too: the request carrying that cookie renders it afresh, see [Prerendering](prerendering.md#prerendering).
41
+ - The cookie carrying `succeeded()` back is `HttpOnly`, `SameSite=Lax`, and `Secure` when the request came over https, `X-Forwarded-Proto` included, as is every request in production when `site` is https.
package/llms/actions.md CHANGED
@@ -36,7 +36,7 @@ export const rename = action(
36
36
  s.Object({ name: s.String({ minLength: 1, maxLength: 80, error: 'Write a name' }) }),
37
37
  async ({ name }, ctx) => {
38
38
  if (name === 'admin')
39
- return ctx.fail(409, 'That name is taken')
39
+ return ctx.deny(409, { message: 'That name is taken' })
40
40
 
41
41
  return name
42
42
  },
@@ -63,9 +63,11 @@ form(action={subscribe})
63
63
  p Subscribing...
64
64
  ```
65
65
 
66
+ In a snippet or a child component, `error` and `pending` follow the form that renders it (the form around a snippet's declaration when there is one), so a field row holds its own. The values behind them, `add.form.error('title')` and, in an island, `add.pending()`, read from any expression.
67
+
66
68
  ### Show what a post returned
67
69
 
68
- The handler's result comes back on the next render of the page, once, through `createToken.succeeded()`:
70
+ The handler's result comes back on the next render of the page, once, through `createToken.data()`:
69
71
 
70
72
  ```kay
71
73
  --- server
@@ -73,10 +75,10 @@ import { s, action } from 'kay'
73
75
 
74
76
  export const createToken = action(s.Object({ label: s.String({ maxLength: 80 }) }), async () => crypto.randomUUID())
75
77
 
76
- const done = createToken.succeeded()
78
+ const done = createToken.data()
77
79
  ---
78
80
  if done
79
- p Your token: {done.data}
81
+ p Your token: {done}
80
82
  form(action={createToken})
81
83
  input(field="label")
82
84
  button Create
@@ -137,7 +139,7 @@ const newTodo = s.Object({
137
139
 
138
140
  export const add = action(newTodo, async ({ title }, ctx) => {
139
141
  if ((await listTodos()).some(todo => todo.title === title))
140
- return ctx.fail(409, { message: 'Already on the list' })
142
+ return ctx.deny(409, { message: 'Already on the list', data: { listed: true } })
141
143
 
142
144
  return (await addTodo(title)).id
143
145
  })
@@ -150,7 +152,7 @@ ul
150
152
  form(action={add})
151
153
  input(field="title" placeholder="New todo")
152
154
  error title
153
- if add.failed()?.data then data
155
+ if add.form.failed()?.data then data
154
156
  p.error {data.message}
155
157
  button Add
156
158
  ```
@@ -162,8 +164,8 @@ form(action={add})
162
164
  - `s.String({ format: 'email' })` accepts one plain address, the same check in the browser, on the server, in kayjs-auth and in kayjs-mail: letters and digits of any script, `+tag`, an internationalised domain; a local part up to 64 characters, labels up to 63, no quotes, comments, IP domain, name with angle brackets, list, line break or space around it, 254 characters at most, a host typed as is (no soft hyphen, zero-width space, fullwidth letter or ideographic full stop). Non-ASCII local parts and IDN domains pass for every app field; kayjs-auth alone also refuses a Latin, Cyrillic or Greek mix. `isEmail(value)` from `kay` is that check, `normalizeAddress(value)` from `kay/library` the form to store (trimmed, lower case, punycode domain).
163
165
  - A string field with no `maxLength` of its own is refused past 10,000 characters, with the error of a declared `maxLength`, and carries that bound to the form's `maxlength` and to the tool's schema; whatever builder wrote it, `t.Record` values, tuples and a string in an API route's `body` included. A field with an `enum`, a `const`, or a secret name such as `password` keeps none. Declare a tighter one for a name, an email or a title, which `kay check` warns of (`unbounded-string`), and a longer one for a field that takes more.
164
166
  - `s` from `kay` builds the schema. A schema shared by API modules, server fences and islands, and the types an island reads off it, are in [Schemas](schemas.md).
165
- - The handler's second argument is the request context every route shares (see routing, "The request context"), `request`, `url`, `locale`, `params`, `cookies`, `locals`, `headers`, `redirect`, `notFound` and `deny`, with `status(code)` and `fail(status, data)`, whose status is an error status, 400 to 599.
166
- - `ctx.redirect`, `ctx.notFound()` and `ctx.deny()` throw, as in a page, and a handler writes `return ctx.redirect(...)`, as a guard does; a call or a form post is answered with the redirect, a 404 or the denial as plain text, `redirect` with 303 unless given.
167
+ - The handler's second argument is the request context every route shares (see routing, "The request context"), `request`, `url`, `locale`, `params`, `cookies`, `locals`, `headers`, `redirect`, `notFound` and `deny`, with `status(code)`.
168
+ - `ctx.redirect`, `ctx.notFound()` and `ctx.deny()` throw, as in a page, and a handler writes `return ctx.redirect(...)`, as a guard does; a call or a form post is answered with the redirect or a 404 as plain text, `redirect` with 303 unless given. `ctx.deny(status, { message, errors, data })` fails the post as in the next lines when it holds `data` or `errors` (400 to 599); `deny(status, { message })` alone, and `deny(status, 'text')` until 1.108, stop with plain text.
167
169
  - Its `url` is the page's the post came from, as its guards read it, and its `locale` that page's, or the site's `lang` without `i18n`.
168
170
  - A location outside ASCII, such as `/blog/日本語`, goes out percent-encoded, from pages and guards too.
169
171
  - A location holding a control character, or a scheme other than `http:` and `https:`, such as `javascript:`, throws.
@@ -179,7 +181,7 @@ form(action={add})
179
181
  - Once kay's script runs it sets `novalidate` on every form posting to an action and checks the form against the schema itself, so the schema's `error` messages show rather than the browser's, then the constraints the template wrote itself. `validate` (or `validate="blur"`) on the `form` shows them as text instead, in the `data-field="<name>"` elements outside islands (a FormField's); `blur` checks each field as it loses focus too.
180
182
  - An island renders its fields without the constraints, kay's check covering them.
181
183
  - `form(action={move.with({ id, to: 2 })})` posts those fields as hidden inputs would, with or without JavaScript, from a page or an island, with no input for them in the form: they travel in the form's action URL, `?kay_with=` holding them URL-encoded, and the server reads them as the form's own fields, coerced by the schema, standing over a posted field of the same name.
182
- - `with` takes the schema's fields, text, numbers, booleans, dates or lists of them, `undefined` and `null` left out; a call from an island sends its input as it is and reads none of it.
184
+ - `with` takes the schema's fields, text, numbers, booleans, dates or lists of them, `undefined` and `null` left out; a call from an island sends the fixed fields over its input. The browser can change them as it could hidden inputs, so a handler checks what an id names (ownership, permission) as for any posted field.
183
185
  - `with` on a `with` adds to its fields; they are in the URL, so in logs and referrers: no secrets.
184
186
  - An `_actions.kay` is served for the pages at or below its directory, so it sits at or above a page.
185
187
  - A button alone is one such form: `form(action={move.with({ id, to: 2 })}) button(aria-label="Move up") ↑`.
@@ -204,23 +206,40 @@ form(action={add})
204
206
  - The handler checks the same rules from a module both import, so the form holds without JavaScript too.
205
207
  - See [Forms](site.md#forms) for the whole form.
206
208
 
209
+ ### Fill a form from a record
210
+
211
+ - `form(action={save} values={todo})` starts every field the form names from the record's property of the same name, so an edit form writes each field once: a text or a number fills `input` and `textarea`, a `Date` fills `type="date"` as its local day (`2026-03-04`), `datetime-local` as its local minute (`2026-03-04T13:05`) and `time` as `13:05`, in the zone of whoever renders it (the server's, or the browser's in an island), `true` ticks a checkbox, a list ticks the checkboxes whose `value` it holds, a text or a number ticks the radio or picks the `option` it equals, and a `null`, a missing property or a function leaves the field as written. Any other truthy value, `'yes'` or `1`, ticks no checkbox.
212
+ - A refused post's values win over the record, so a visitor's edits and blanks survive the refusal; a refusal that read no field leaves the fields and boxes blank.
213
+ - Forms sharing one action, such as an edit form per row, each write a hidden `kay_form` field (kept for a post of the form that has `values`), and a refusal refills only the form that posted, `site.submit` naming it with `kay_form`; a post naming none refills them all.
214
+ - An `input` or checkbox that writes its own `value` or `checked` keeps it over the record; a `select` and a `textarea` take the record over their own `selected` option or text, on the server and in an island alike.
215
+ - In an island the record fills a field until the visitor edits it, so a record that changes later leaves what was typed: the field's default is what moves, and a form `reset` goes back to it.
216
+ - A hidden, password, file or disabled field, a `select multiple`, a field with a spread or a `bind:` on its value is left as written.
217
+ - Each field reads `values` on its own, so a call with arguments in it is a compile error (`form-misuse`): compute it once in the script and pass the name; a signal read, `todo()`, is fine, and any `(` followed by something else, a parenthesised group included, is refused. The key of a form is its place in the template and its count in the page, so a refusal finds it when the page renders the same forms again. A form an island builds in the browser writes no `kay_form` key, so a refused post re-shows its refusal and values in every such form.
218
+ - A `Form(action={save} values={todo})` component fills the fields written in its content on the server only.
219
+
220
+ ### Name a field once
221
+
222
+ - A `FormField` (kayjs-ui's, or your own under that name) given `field="title"` inside a `form(action={save})` names the control written bare in its content: `FormField(label="Title" field="title")` around an `input` with no `name` or `field` gives the input `name="title"`, the schema's constraints and the `aria-*` of `input(field="title")`, the record's value and a refused post's. A control that writes its own `name` or `field`, any nested `form`, a component that is a form itself and one given a computed `field={...}` end it. It takes `field` or `name`, not both. Any other component keeps its `field` prop to itself.
223
+ - `label(field="name")` writes the label's `for` and the `id` of the one control of that field in the form, `<action>-<field>` (`save-name`), so `label(for="name")` and `input#name(field="name")` become two `field`. It is `form-misuse` when the form has no control of that field or several (a group of radios or boxes: write `for` and `id` yourself), when the label also writes `for`, or when the control writes its own `id`. Forms posting to one action, such as one per row, repeat the id: write `for` and `id` there.
224
+ - `button(action={move.with({ id })})` outside a form posts that action: kay wraps it in a `form(action={...})` that has no box of its own (`display: contents`, set by a hashed `style` rule in the head, so a strict CSP holds), so a static page posts and an island calls it, with the `.with()` arguments; the button is then the only child of its form for `:first-child` and `first:` styles. In a `p` it is `invalid-nesting`. Inside a form it is `form-misuse`: the form's own button posts the form.
225
+
207
226
  ### Refused posts
208
227
 
209
- - `ctx.fail` returns the failure where `ctx.deny`, `ctx.notFound` and `ctx.redirect` throw, so write `return ctx.fail(status, data, errors)` (the same answer as `refuse(message, { errors, data })`, which throws): a statement without `return` does nothing, which `kay check` reports as `unreturned-fail` and `--fix` repairs.
210
- - A post the schema refuses, or whose handler returns `ctx.fail(status, data)`, is answered with the page it came from, rendered with the failure's status, rather than with a redirect.
211
- - There `add.failed()` returns `{ status, message, values, errors, data }`, typed from the action, or `undefined`.
228
+ - `ctx.deny(status, { message, errors, data })` is the one refusal of a guard, a page, an action and an endpoint, `refuse(status, { ... })` throws it from anywhere; `return` it so `form.failed()` types `data`. `ctx.fail` is its old spelling until 1.108 (`unreturned-fail`).
229
+ - A post the schema refuses, or whose handler denies with `ctx.deny(status, { data })`, is answered with the page it came from, rendered with the failure's status, rather than with a redirect.
230
+ - There `add.form.failed()` returns `{ status, message, values, errors, data }`, typed from the action, or `undefined`.
212
231
  - `values` is what the form posted (fields named like a password left out).
213
232
  - `errors` is a message per refused field, the schema's `error` option when set.
214
- - `data` is what `ctx.fail` received.
215
- - `return ctx.fail(409, undefined, { email: 'Already taken' })` puts a message on a field, typed from the schema's keys, with `''` for the form's own (a string `data` is that too), so `error email`, `aria-invalid`, `add.error('email')`, the value re-fill and an island's `ActionError.errors` (and a kayjs-ui `FormField` named `email`) follow it with and without JavaScript.
216
- - A string passed to `ctx.fail` is the form's message too, under `errors['']` where a rate limit's refusal sits: `return ctx.fail(502, 'Not sent; try again later')`, read by `add.error()`.
233
+ - `data` is what `ctx.deny` received.
234
+ - `return ctx.deny(409, { errors: { email: 'Already taken' } })` puts a message on a field, typed from the schema's keys, with `''` for the form's own, so `error email`, `aria-invalid`, `add.form.error('email')`, the value re-fill and an island's `ActionError.errors` (and a kayjs-ui `FormField` named `email`) follow it with and without JavaScript.
235
+ - A rate limit's refusal sits under `errors['']`, read by `add.form.error()`, and a text `data` is that message: `return ctx.deny(502, { data: 'Not sent; try again later' })`.
217
236
  - The page renders as a visit of it would, through the app's plugins and the page's guards, and nothing the visitor typed is lost however long it is.
218
237
  - Reloading it posts again, as after any form a server answers in place.
219
238
  - The page is the one the post was sent from, as `ctx.params` reads it below, the home page when it names none or another site.
220
239
  - Without the page swap the browser shows the action's URL, so the page carries a `base` naming its own URL, and its relative links lead where they did.
221
240
  - Each form on it posting to an action names that page in a `kay_back` query parameter, so a post refused again renders the same page, however many times in a row, and one that goes through goes back to it.
222
241
  - A handler that throws, a mail server down say, is logged as any server error, `onError` included, and answered as a refusal with status 500.
223
- - A plain form post then renders its page with the message under the form and what was typed kept, read by `add.error()`, and a call throws `ActionError` with it in `errors['']`.
242
+ - A plain form post then renders its page with the message under the form and what was typed kept, read by `add.form.error()`, and a call answers `{ ok: false }` with it in `errors['']`.
224
243
  - The message is `Something went wrong on our side; try again later` unless the site words it as `kay.action.serverError` ([Locales](locales-texts.md)) or the action words its own, `action(schema, handler, { messages: { serverError: 'Not sent; write to hello@example.com instead' } })`, so a handler needs no `try`/`catch` of its own to tell the visitor.
225
244
  - `serverError` may be a function given the error and `ctx`, sync or async, to word it from what is loaded per request or the page's `ctx.locale`: `serverError: async () => 'Write to ' + (await settings.one()).email`. Its text is answered with the same status 500; one that throws, or answers a blank text, leaves kay's message (a throw logged beside the handler's error), and a redirect or denial thrown from it is no answer either.
226
245
  - An action past its `timeout` (`serve.timeout` or the action's own) answers 504 the same way, worded `kay.action.timeout` (`This took too long; try again later`) and reported as a server error.
@@ -237,17 +256,7 @@ form(action={add})
237
256
 
238
257
  ### Reading the outcome
239
258
 
240
- - `add.failed()`, `add.succeeded()` and `add.error('title')` read the outcome from any template, layout, component or island, and from the server fence.
241
- - `error()` without a field is the form-wide message, `errors['']`.
242
- - The field name is typed from the schema.
243
- - An island reads them in the browser too, as its server render did, but for `values`, which stay on the server, so no field the server cannot tell is a secret reaches the page's source: the fields hold what was sent.
244
- - Once the page shown called the action, they read how its last call went instead, reactively, a call clearing them as it starts: an island calling `add({ title })` catches the `ActionError` and `add.error('title')` shows the message, the field marked invalid.
245
- - `await add.validate(form, field?)` checks a form against the action's schema, writing what it refuses into `add.error(field)` and `add.failed()` in place of the last outcome (`succeeded()` too), for every field or `field` alone; it resolves whether it is accepted, posts nothing, and accepts a form with no schema on the page (a client-only island's). kayjs-ui's `Form`, `SaveForm` and `FormDialog` take `validate="submit" | "blur"`.
246
- - A post that succeeds goes back to the page with what the handler returned: `add.succeeded()` returns `{ data }`, typed from the action, or `undefined`, on that one render only.
247
- - `data` travels in a cookie, sealed (AES-GCM under a key derived from [the app secret](environment.md#the-app-secret), else a key of the process, which a restart changes), so a secret shown once, such as a new API token, can be neither read nor altered in it.
248
- - Data too big for it, over about 3.5 KB sealed, is left out with a warning, and `succeeded()` returns `undefined`, as it does for a cookie that does not open, forged or sealed before a restart.
249
- - A prerendered page reads both too: the request carrying that cookie renders it afresh, see [Prerendering](prerendering.md#prerendering).
250
- - The cookie carrying `succeeded()` back is `HttpOnly`, `SameSite=Lax`, and `Secure` when the request came over https, `X-Forwarded-Proto` included, as is every request in production when `site` is https.
259
+ - `add.form.failed()`, `add.data()`, `add.status()` and `add.form.error('title')` read how a post or the last call went from any template, component, island or server fence: [Refused fields](actions-refused-fields.md#reading-the-outcome).
251
260
 
252
261
  ### Files
253
262
 
package/llms/analytics.md CHANGED
@@ -27,7 +27,7 @@ import { vitals } from 'kay/analytics'
27
27
 
28
28
  export default defineConfig({
29
29
  store: sqliteData('data/app.sqlite'),
30
- extensions: [vitals({ guard: { load: async () => (await import('./src/auth')).auth.guard({ require: 'admin' }) } })],
30
+ extensions: [vitals({ guards: { load: async () => (await import('./src/auth')).auth.guard({ require: 'admin' }) } })],
31
31
  })
32
32
  ```
33
33