@tdacorp/hyle-sdk 0.17.0 → 0.22.2

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 (92) hide show
  1. package/README.md +261 -42
  2. package/dist/check-routes-bin.js +190 -53
  3. package/dist/{chunk-6VOHFFA5.js → chunk-7T5EEJHK.js} +2 -2
  4. package/dist/chunk-DUPT6XLB.js +57 -0
  5. package/dist/chunk-IW3TUD4G.js +841 -0
  6. package/dist/{chunk-MGSUQBDW.js → chunk-KU7LWK4E.js} +249 -24
  7. package/dist/{chunk-BUJFMR3M.js → chunk-QVYQM5R2.js} +15 -6
  8. package/dist/chunk-SFFBZFEN.js +178 -0
  9. package/dist/chunk-U74B7AUG.js +398 -0
  10. package/dist/chunk-ZIW6FDU2.js +1126 -0
  11. package/dist/client-BGjmEWhN.d.cts +207 -0
  12. package/dist/client-D0LTpr3Y.d.ts +207 -0
  13. package/dist/code-copy.cjs +74 -0
  14. package/dist/code-copy.d.cts +18 -0
  15. package/dist/code-copy.d.ts +18 -0
  16. package/dist/code-copy.js +50 -0
  17. package/dist/comments.cjs +738 -280
  18. package/dist/comments.d.cts +66 -3
  19. package/dist/comments.d.ts +66 -3
  20. package/dist/comments.js +419 -331
  21. package/dist/{diagram-viewer-FJPED4SN.js → diagram-viewer-XY3CG75U.js} +62 -21
  22. package/dist/docs-enhance.cjs +7 -4
  23. package/dist/docs-enhance.d.cts +5 -3
  24. package/dist/docs-enhance.d.ts +5 -3
  25. package/dist/docs-enhance.js +8 -5
  26. package/dist/{embed-DNTZ2UXv.d.ts → embed-CbtsbZs3.d.cts} +5 -3
  27. package/dist/{embed-BmdwA2G9.d.cts → embed-Cf_2ZR5x.d.ts} +5 -3
  28. package/dist/fragment-alias.cjs +51 -0
  29. package/dist/fragment-alias.d.cts +7 -0
  30. package/dist/fragment-alias.d.ts +7 -0
  31. package/dist/fragment-alias.js +27 -0
  32. package/dist/html.cjs +886 -0
  33. package/dist/html.d.cts +20 -0
  34. package/dist/html.d.ts +20 -0
  35. package/dist/html.js +45 -0
  36. package/dist/index.cjs +244 -24
  37. package/dist/index.d.cts +22 -68
  38. package/dist/index.d.ts +22 -68
  39. package/dist/index.js +12 -2
  40. package/dist/{labels-nmukKYgL.d.cts → labels-CrA-iqTN.d.cts} +9 -0
  41. package/dist/{labels-nmukKYgL.d.ts → labels-CrA-iqTN.d.ts} +9 -0
  42. package/dist/mermaid-diagram.cjs +441 -125
  43. package/dist/mermaid-diagram.d.cts +23 -7
  44. package/dist/mermaid-diagram.d.ts +23 -7
  45. package/dist/mermaid-diagram.js +213 -51
  46. package/dist/mermaid-image.cjs +137 -60
  47. package/dist/mermaid-image.d.cts +4 -3
  48. package/dist/mermaid-image.d.ts +4 -3
  49. package/dist/mermaid-image.js +27 -28
  50. package/dist/next.cjs +836 -304
  51. package/dist/next.d.cts +45 -20
  52. package/dist/next.d.ts +45 -20
  53. package/dist/next.js +151 -40
  54. package/dist/print-coordinator.cjs +157 -0
  55. package/dist/print-coordinator.d.cts +27 -0
  56. package/dist/print-coordinator.d.ts +27 -0
  57. package/dist/print-coordinator.js +83 -0
  58. package/dist/react.cjs +603 -240
  59. package/dist/react.d.cts +148 -30
  60. package/dist/react.d.ts +148 -30
  61. package/dist/react.js +26 -4
  62. package/dist/reactions.cjs +653 -0
  63. package/dist/reactions.d.cts +27 -0
  64. package/dist/reactions.d.ts +27 -0
  65. package/dist/reactions.js +364 -0
  66. package/dist/{resolve-euZ4-aC9.d.cts → resolve-BnIv7aB7.d.cts} +2 -2
  67. package/dist/{resolve-Ae7UFjsQ.d.ts → resolve-BysHtZ_i.d.ts} +2 -2
  68. package/dist/revalidation-callback-BQl77tQR.d.cts +75 -0
  69. package/dist/revalidation-callback-BQl77tQR.d.ts +75 -0
  70. package/dist/sanitize-BpY_AdZh.d.cts +23 -0
  71. package/dist/sanitize-BpY_AdZh.d.ts +23 -0
  72. package/dist/styles.css +100 -29
  73. package/dist/toc-spy.cjs +60 -0
  74. package/dist/toc-spy.d.cts +15 -0
  75. package/dist/toc-spy.d.ts +15 -0
  76. package/dist/toc-spy.js +36 -0
  77. package/dist/{types-Czt887Iv.d.cts → types-D09Z072G.d.cts} +57 -2
  78. package/dist/{types-Czt887Iv.d.ts → types-D09Z072G.d.ts} +57 -2
  79. package/dist/use-cache.cjs +89 -13
  80. package/dist/use-cache.d.cts +12 -5
  81. package/dist/use-cache.d.ts +12 -5
  82. package/dist/use-cache.js +8 -8
  83. package/dist/youtube-facade.cjs +50 -0
  84. package/dist/youtube-facade.d.cts +17 -0
  85. package/dist/youtube-facade.d.ts +17 -0
  86. package/dist/youtube-facade.js +26 -0
  87. package/package.json +16 -3
  88. package/dist/chunk-67IOIAVW.js +0 -35
  89. package/dist/chunk-DMK4XQLU.js +0 -1556
  90. package/dist/chunk-PJMJMP66.js +0 -63
  91. package/dist/revalidation-callback-D7Ms_Puz.d.cts +0 -42
  92. package/dist/revalidation-callback-D7Ms_Puz.d.ts +0 -42
package/dist/next.d.cts CHANGED
@@ -1,11 +1,12 @@
1
1
  import { ReactElement } from 'react';
2
- import { A as ArticleRef, O as OgImage, J as JsonLdConfig, H as HyleComponents, a as HyleSlots, E as EngagementConfig, b as EmbedHeading } from './embed-BmdwA2G9.cjs';
3
- export { c as HyleCommentsFallback } from './embed-BmdwA2G9.cjs';
4
- import { F as FetchResolverOptions, H as HyleResolver } from './resolve-euZ4-aC9.cjs';
5
- export { f as fetchResolver, w as workspaceTags } from './resolve-euZ4-aC9.cjs';
2
+ import { A as ArticleRef, O as OgImage, J as JsonLdConfig, H as HyleComponents, a as HyleSlots, E as EngagementConfig, b as EmbedHeading } from './embed-CbtsbZs3.cjs';
3
+ export { c as HyleCommentsFallback } from './embed-CbtsbZs3.cjs';
4
+ import { F as FetchResolverOptions, H as HyleResolver } from './resolve-BnIv7aB7.cjs';
5
+ export { f as fetchResolver, w as workspaceTags } from './resolve-BnIv7aB7.cjs';
6
6
  import { MetadataRoute, ResolvingMetadata, Metadata } from 'next';
7
- import { a as RevalidationCallbackRoute } from './revalidation-callback-D7Ms_Puz.cjs';
8
- import './types-Czt887Iv.cjs';
7
+ import { R as RevalidationCallbackOptions, b as RevalidationCallbackRoute } from './revalidation-callback-BQl77tQR.cjs';
8
+ import { c as HyleCredential } from './client-BGjmEWhN.cjs';
9
+ import './types-D09Z072G.cjs';
9
10
 
10
11
  type RouteParams = Record<string, string | string[] | undefined>;
11
12
  interface CommonOptions {
@@ -108,16 +109,16 @@ interface CommonOptions {
108
109
  * `"searchParams"` makes list pages paginate: `?cursor=` is read, sent to hyle, and an "Older posts" link is built from
109
110
  * `next_cursor`. Default off, and the trade-off is real: reading `searchParams` makes the route dynamic, so it can no longer
110
111
  * be statically generated or served from ISR (hyle's fetch cache still applies). Leave it off when one page of `listLimit`
111
- * items is enough. A malformed `cursor` is ignored (the first page is shown); one that is well-formed but unknown to hyle is a 404.
112
+ * items is enough. A malformed `cursor` is ignored (the first page is shown); one that is well-formed but rejected by hyle is a 404.
112
113
  */
113
114
  readonly paginate?: "searchParams";
114
115
  /**
115
- * Opt-in custom UI for transient or operational hyle failures (network error, timeout, 5xx, 401, 403, 429, a malformed
116
+ * Opt-in custom UI for hyle failures (network error, timeout, 5xx, any 4xx that is not hyle's NOT_FOUND, a malformed
116
117
  * response, a refused redirect target). Without it `hylePage` rethrows them, so Next keeps serving the last good ISR page
117
118
  * when a revalidation fails (and a failure on a first render is an uncached 500). With it, the returned element is a NORMAL
118
119
  * render: it is cached for the revalidate window and replaces the last good page for that long, so prefer a boundary
119
120
  * (`error.tsx`) unless you want that. The `error` can carry `Cp1ClientError.message` and `requestId`: never render it.
120
- * Only its name is logged. A 4xx rejection of the request (400, 404, ...) is always `notFound()` and never reaches this, and
121
+ * Only its name is logged. A not-found answer from hyle (or a `cursor` it refuses) is always `notFound()` and never reaches this, and
121
122
  * `notFound()` and redirects are Next control flow that always propagate.
122
123
  */
123
124
  readonly onError?: (error: unknown) => ReactElement;
@@ -145,8 +146,8 @@ interface PageProps {
145
146
  * in front, and 301 maps to permanentRedirect (308) while 307 maps to redirect (temporary). A target equal to the current
146
147
  * URL would loop, so it is treated as not found.
147
148
  *
148
- * Failure: a 4xx rejection of the request (400, 404, ...) is `notFound()`. Every other failure (network error, timeout, 5xx,
149
- * 401, 403, 429, a malformed response, a refused redirect target) is RETHROWN, so under ISR Next keeps serving the last good
149
+ * Failure: only hyle's own not-found answer (or its refusal of the visitor's `cursor`) is `notFound()`. Every other failure (network error, timeout, 5xx, any other
150
+ * 4xx, a malformed response, a refused redirect target) is RETHROWN, so under ISR Next keeps serving the last good
150
151
  * page when a revalidation fails, and a first-render failure is an uncached 500 rather than a cached soft 200. `onError`
151
152
  * opts in to a custom element instead (see its docs). `notFound()` and redirects always propagate (`unstable_rethrow`).
152
153
  *
@@ -193,8 +194,8 @@ declare function hyleFeedLink(options: HyleNextOptions, locale?: string): {
193
194
  * when there is one). A list page canonicals to itself; with `paginate` a cursor page canonicals to its own `?cursor=` URL (never to the
194
195
  * first page) and its title gets an "Older posts" suffix. Open Graph titles are always the bare title.
195
196
  * Canonical and hreflang URLs are ABSOLUTE when `siteOrigin` is a bare https origin, else relative paths (set `metadataBase` in the host's root layout).
196
- * Redirects, 404s and a switched-off read surface produce no metadata; `hylePage` handles those. A 4xx rejection of the request
197
- * gives no metadata; any other failure (network, timeout, 5xx, 401, 403, 429) is rethrown, so a transient outage is not
197
+ * Redirects, 404s and a switched-off read surface produce no metadata; `hylePage` handles those. hyle's own not-found
198
+ * gives no metadata; any other failure (network, timeout, 5xx, any other 4xx) is rethrown, so an outage is not
198
199
  * cached as a page; Next control flow is rethrown.
199
200
  */
200
201
  declare function hyleMetadata(options: HyleNextOptions): (props: PageProps, parent?: ResolvingMetadata) => Promise<Metadata>;
@@ -218,6 +219,8 @@ interface RevalidateRouteOptions {
218
219
  readonly workspaceId: string | undefined;
219
220
  /** Current signing secret first, previous ones after during rotation (HYLE_WEBHOOK_SECRET). */
220
221
  readonly secrets: readonly (string | undefined)[];
222
+ /** Comment notifications, see `RevalidationCallbackOptions.onCommentEvent`. */
223
+ readonly onCommentEvent?: RevalidationCallbackOptions["onCommentEvent"];
221
224
  /** Environment to read the site switch from. Default process.env. */
222
225
  readonly env?: Readonly<Record<string, string | undefined>>;
223
226
  }
@@ -233,7 +236,7 @@ declare function createRevalidateRoute(options: RevalidateRouteOptions): Revalid
233
236
  /**
234
237
  * One workspace of a root catch-all: the options of `hylePage` without `basePath` (the mount prefix comes from hyle's mounts)
235
238
  * and without `resolver` (the mounts are read through Next's fetch cache, so `baseUrl`, `token` and `workspaceId` are required).
236
- * `revalidate` (default 300) also bounds the mounts fetch.
239
+ * `revalidate` (default 86400, a safety net behind tag webhooks) also bounds the mounts fetch.
237
240
  */
238
241
  type HyleRootConfig = Omit<Extract<HyleNextOptions, {
239
242
  resolver?: undefined;
@@ -256,8 +259,8 @@ declare const MOUNTS_MAX_STALE_MS: number;
256
259
  * entries: `notFound()` with ZERO resolve calls, so junk URLs and bot probes never reach hyle;
257
260
  * - otherwise the request is served by `hylePage` with `basePath` = the matched prefix (same locale, redirect and error rules).
258
261
  *
259
- * Failure of the mounts fetch: a 4xx or the kill switch means nothing is served (404). A transient failure (network, timeout,
260
- * 5xx, 429, malformed body) uses the last mounts read successfully for up to 15 minutes, so a hyle outage keeps
262
+ * Failure of the mounts fetch: the kill switch means nothing is served (404); 401 and 403 are rethrown at once. Any other
263
+ * failure (network, timeout, 5xx, any other 4xx, malformed body) uses the last mounts read successfully for up to 15 minutes, so a hyle outage keeps
261
264
  * unmatched URLs a plain 404 and mounted pages on their last good render; with no such copy (a cold server) it is RETHROWN,
262
265
  * because the URL might be a mounted page: Next keeps the last good ISR page, or a first render is an uncached 500. A host
263
266
  * route never depends on this at all: Next matches it first. With a ROOT mount and no copy, every unmatched URL errors
@@ -299,7 +302,7 @@ interface MarkdownRoute {
299
302
  * `hyleRootPage`. It serves the markdown source of a page the mounts serve (same mount matching, reserved paths, `locale`,
300
303
  * `localePrefix`, fetch cache and tags as the page itself): `text/markdown; charset=utf-8` with `X-Robots-Tag: noindex`, asset links
301
304
  * rewritten to the host's asset route. A redirect (301 becomes 308, 307 stays) goes to the target's `.md` twin; a list, an unknown
302
- * path or a rejected request is 404; any other failure is 502 with no body. Reached by `markdownRewritePath` in the host's middleware.
305
+ * path or hyle's not-found is 404; any other failure is 502 with no body. Reached by `markdownRewritePath` in the host's middleware.
303
306
  * For a locale-prefixed site put the route under `[locale]` (`app/api/hyle/md/[locale]/[...path]/route.ts`) so `locale(params)` sees it.
304
307
  */
305
308
  declare function createMarkdownRoute(options: Configs): MarkdownRoute;
@@ -372,11 +375,17 @@ interface AssetRoute {
372
375
  * `img-src 'self'` (and `media-src 'self'`) CSP needs no change. hyle serves only assets that a currently published page of this
373
376
  * workspace references, so an unpublished or other workspace's asset is a 404 here too.
374
377
  *
375
- * Safety: the only input is the `file` segment, matched against `<uuid>[.<ext>]` before anything is sent, so this is not an open
378
+ * The same route serves the workspace's theme stylesheet as `theme-<scope>-<sha256>.css` (see `serveTheme`), which `<HyleTheme>` links.
379
+ *
380
+ * Safety: the only input is the `file` segment, matched against `<uuid>[.<ext>]` or the theme name before anything is sent, so this is not an open
376
381
  * proxy. The browser's cookies and authorization header are never forwarded; only `Range`, `If-Range` and `If-None-Match` are.
377
382
  * The response headers are built here (no upstream header is copied blindly), the content type must be on the asset allowlist,
378
383
  * the body is size-capped and time-bounded, and every failure is an empty 404 or 502 that says nothing about hyle.
379
384
  * The site switch `HYLE_CONTENT_ENABLED=0`/`false`, or missing configuration, answers 404.
385
+ *
386
+ * Draft preview (hyle ADR 0037): `?hyle_preview=<token>`, which the preview page puts on its own images, is sent to hyle as a
387
+ * header so that draft's assets load; every such answer is `no-store`. The token is never sent for the theme stylesheet,
388
+ * which is the credential's own with or without it. No other query parameter is read.
380
389
  */
381
390
  declare function createAssetRoute(options: AssetRouteOptions): AssetRoute;
382
391
 
@@ -464,7 +473,8 @@ interface EngagementRouteOptions {
464
473
  readonly allowedOrigins?: readonly string[];
465
474
  /**
466
475
  * Called for every matched request before any work (after the allowlist and CSRF checks), with the action name:
467
- * "session", "comments.list", "comments.create", "comments.edit", "comments.delete", "reactions.add" or "reactions.remove".
476
+ * "session", "comments.list", "comments.create", "comments.edit", "comments.delete", "reactions.add", "reactions.remove",
477
+ * "votes.set" or "votes.remove".
468
478
  * Return a Response (for example a 429 from your own rate limiter) to answer instead; return nothing to continue. A throw is a 502.
469
479
  * hyle rate-limits too, but every anonymous read reaches your server first: limit /api/hyle/engage in your own middleware or here.
470
480
  */
@@ -509,4 +519,19 @@ declare const ENGAGE_CSRF_HEADER = "x-hyle-engage";
509
519
  */
510
520
  declare function createEngagementRoute(options: EngagementRouteOptions): EngagementRoute;
511
521
 
512
- export { type AssetRoute, type AssetRouteOptions, ENGAGE_CSRF_HEADER, type EngageReader, type EngagementRoute, type EngagementRouteOptions, FetchResolverOptions, HyleArticle, type HyleArticleProps, HyleComments, type HyleCommentsProps, type HyleFeedOptions, HyleList, type HyleListProps, type HyleNextOptions, HyleResolver, type HyleRootConfig, type HyleRootSitemapOptions, type HyleSitemapOptions, type LlmsTxtOptions, MOUNTS_MAX_STALE_MS, type MarkdownRoute, type OgImageRoute, type PageProps, type RevalidateRouteOptions, type RouteParams, createAssetRoute, createEngagementRoute, createLlmsTxtRoute, createMarkdownRoute, createOgImageRoute, createRevalidateRoute, hyleFeed, hyleFeedLink, hyleMetadata, hylePage, hyleRootMetadata, hyleRootPage, hyleRootSitemap, hyleSitemap, markdownRewritePath };
522
+ /** The credential and base URL of `createHyleClient`, plus how your article pages are drawn. */
523
+ type HylePreviewPageOptions = HyleCredential & {
524
+ readonly baseUrl: string;
525
+ } & Pick<CommonOptions, "components" | "slots" | "layout" | "localePrefix">;
526
+ /** `export const metadata = hylePreviewMetadata`, next to `hylePreviewPage`. The page also renders both tags itself. */
527
+ declare const hylePreviewMetadata: Metadata;
528
+ /**
529
+ * The page behind hyle's "Open on site" (ADR 0037): `export default hylePreviewPage({ baseUrl, token })` in
530
+ * `app/hyle-preview/page.tsx`. It draws the draft behind `?token=` with your article components; a missing, wrong or
531
+ * expired token is `notFound()`. The page opens with an "Unpublished draft preview" banner. Nothing is cached (it reads
532
+ * `searchParams` and fetches `no-store`), the page is noindex with no referrer, and the token is never logged. Keep
533
+ * analytics off this route: its URL carries the token.
534
+ */
535
+ declare function hylePreviewPage(options: HylePreviewPageOptions): (props: PageProps) => Promise<ReactElement>;
536
+
537
+ export { type AssetRoute, type AssetRouteOptions, ENGAGE_CSRF_HEADER, type EngageReader, type EngagementRoute, type EngagementRouteOptions, FetchResolverOptions, HyleArticle, type HyleArticleProps, HyleComments, type HyleCommentsProps, type HyleFeedOptions, HyleList, type HyleListProps, type HyleNextOptions, type HylePreviewPageOptions, HyleResolver, type HyleRootConfig, type HyleRootSitemapOptions, type HyleSitemapOptions, type LlmsTxtOptions, MOUNTS_MAX_STALE_MS, type MarkdownRoute, type OgImageRoute, type PageProps, type RevalidateRouteOptions, type RouteParams, createAssetRoute, createEngagementRoute, createLlmsTxtRoute, createMarkdownRoute, createOgImageRoute, createRevalidateRoute, hyleFeed, hyleFeedLink, hyleMetadata, hylePage, hylePreviewMetadata, hylePreviewPage, hyleRootMetadata, hyleRootPage, hyleRootSitemap, hyleSitemap, markdownRewritePath };
package/dist/next.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import { ReactElement } from 'react';
2
- import { A as ArticleRef, O as OgImage, J as JsonLdConfig, H as HyleComponents, a as HyleSlots, E as EngagementConfig, b as EmbedHeading } from './embed-DNTZ2UXv.js';
3
- export { c as HyleCommentsFallback } from './embed-DNTZ2UXv.js';
4
- import { F as FetchResolverOptions, H as HyleResolver } from './resolve-Ae7UFjsQ.js';
5
- export { f as fetchResolver, w as workspaceTags } from './resolve-Ae7UFjsQ.js';
2
+ import { A as ArticleRef, O as OgImage, J as JsonLdConfig, H as HyleComponents, a as HyleSlots, E as EngagementConfig, b as EmbedHeading } from './embed-Cf_2ZR5x.js';
3
+ export { c as HyleCommentsFallback } from './embed-Cf_2ZR5x.js';
4
+ import { F as FetchResolverOptions, H as HyleResolver } from './resolve-BysHtZ_i.js';
5
+ export { f as fetchResolver, w as workspaceTags } from './resolve-BysHtZ_i.js';
6
6
  import { MetadataRoute, ResolvingMetadata, Metadata } from 'next';
7
- import { a as RevalidationCallbackRoute } from './revalidation-callback-D7Ms_Puz.js';
8
- import './types-Czt887Iv.js';
7
+ import { R as RevalidationCallbackOptions, b as RevalidationCallbackRoute } from './revalidation-callback-BQl77tQR.js';
8
+ import { c as HyleCredential } from './client-D0LTpr3Y.js';
9
+ import './types-D09Z072G.js';
9
10
 
10
11
  type RouteParams = Record<string, string | string[] | undefined>;
11
12
  interface CommonOptions {
@@ -108,16 +109,16 @@ interface CommonOptions {
108
109
  * `"searchParams"` makes list pages paginate: `?cursor=` is read, sent to hyle, and an "Older posts" link is built from
109
110
  * `next_cursor`. Default off, and the trade-off is real: reading `searchParams` makes the route dynamic, so it can no longer
110
111
  * be statically generated or served from ISR (hyle's fetch cache still applies). Leave it off when one page of `listLimit`
111
- * items is enough. A malformed `cursor` is ignored (the first page is shown); one that is well-formed but unknown to hyle is a 404.
112
+ * items is enough. A malformed `cursor` is ignored (the first page is shown); one that is well-formed but rejected by hyle is a 404.
112
113
  */
113
114
  readonly paginate?: "searchParams";
114
115
  /**
115
- * Opt-in custom UI for transient or operational hyle failures (network error, timeout, 5xx, 401, 403, 429, a malformed
116
+ * Opt-in custom UI for hyle failures (network error, timeout, 5xx, any 4xx that is not hyle's NOT_FOUND, a malformed
116
117
  * response, a refused redirect target). Without it `hylePage` rethrows them, so Next keeps serving the last good ISR page
117
118
  * when a revalidation fails (and a failure on a first render is an uncached 500). With it, the returned element is a NORMAL
118
119
  * render: it is cached for the revalidate window and replaces the last good page for that long, so prefer a boundary
119
120
  * (`error.tsx`) unless you want that. The `error` can carry `Cp1ClientError.message` and `requestId`: never render it.
120
- * Only its name is logged. A 4xx rejection of the request (400, 404, ...) is always `notFound()` and never reaches this, and
121
+ * Only its name is logged. A not-found answer from hyle (or a `cursor` it refuses) is always `notFound()` and never reaches this, and
121
122
  * `notFound()` and redirects are Next control flow that always propagate.
122
123
  */
123
124
  readonly onError?: (error: unknown) => ReactElement;
@@ -145,8 +146,8 @@ interface PageProps {
145
146
  * in front, and 301 maps to permanentRedirect (308) while 307 maps to redirect (temporary). A target equal to the current
146
147
  * URL would loop, so it is treated as not found.
147
148
  *
148
- * Failure: a 4xx rejection of the request (400, 404, ...) is `notFound()`. Every other failure (network error, timeout, 5xx,
149
- * 401, 403, 429, a malformed response, a refused redirect target) is RETHROWN, so under ISR Next keeps serving the last good
149
+ * Failure: only hyle's own not-found answer (or its refusal of the visitor's `cursor`) is `notFound()`. Every other failure (network error, timeout, 5xx, any other
150
+ * 4xx, a malformed response, a refused redirect target) is RETHROWN, so under ISR Next keeps serving the last good
150
151
  * page when a revalidation fails, and a first-render failure is an uncached 500 rather than a cached soft 200. `onError`
151
152
  * opts in to a custom element instead (see its docs). `notFound()` and redirects always propagate (`unstable_rethrow`).
152
153
  *
@@ -193,8 +194,8 @@ declare function hyleFeedLink(options: HyleNextOptions, locale?: string): {
193
194
  * when there is one). A list page canonicals to itself; with `paginate` a cursor page canonicals to its own `?cursor=` URL (never to the
194
195
  * first page) and its title gets an "Older posts" suffix. Open Graph titles are always the bare title.
195
196
  * Canonical and hreflang URLs are ABSOLUTE when `siteOrigin` is a bare https origin, else relative paths (set `metadataBase` in the host's root layout).
196
- * Redirects, 404s and a switched-off read surface produce no metadata; `hylePage` handles those. A 4xx rejection of the request
197
- * gives no metadata; any other failure (network, timeout, 5xx, 401, 403, 429) is rethrown, so a transient outage is not
197
+ * Redirects, 404s and a switched-off read surface produce no metadata; `hylePage` handles those. hyle's own not-found
198
+ * gives no metadata; any other failure (network, timeout, 5xx, any other 4xx) is rethrown, so an outage is not
198
199
  * cached as a page; Next control flow is rethrown.
199
200
  */
200
201
  declare function hyleMetadata(options: HyleNextOptions): (props: PageProps, parent?: ResolvingMetadata) => Promise<Metadata>;
@@ -218,6 +219,8 @@ interface RevalidateRouteOptions {
218
219
  readonly workspaceId: string | undefined;
219
220
  /** Current signing secret first, previous ones after during rotation (HYLE_WEBHOOK_SECRET). */
220
221
  readonly secrets: readonly (string | undefined)[];
222
+ /** Comment notifications, see `RevalidationCallbackOptions.onCommentEvent`. */
223
+ readonly onCommentEvent?: RevalidationCallbackOptions["onCommentEvent"];
221
224
  /** Environment to read the site switch from. Default process.env. */
222
225
  readonly env?: Readonly<Record<string, string | undefined>>;
223
226
  }
@@ -233,7 +236,7 @@ declare function createRevalidateRoute(options: RevalidateRouteOptions): Revalid
233
236
  /**
234
237
  * One workspace of a root catch-all: the options of `hylePage` without `basePath` (the mount prefix comes from hyle's mounts)
235
238
  * and without `resolver` (the mounts are read through Next's fetch cache, so `baseUrl`, `token` and `workspaceId` are required).
236
- * `revalidate` (default 300) also bounds the mounts fetch.
239
+ * `revalidate` (default 86400, a safety net behind tag webhooks) also bounds the mounts fetch.
237
240
  */
238
241
  type HyleRootConfig = Omit<Extract<HyleNextOptions, {
239
242
  resolver?: undefined;
@@ -256,8 +259,8 @@ declare const MOUNTS_MAX_STALE_MS: number;
256
259
  * entries: `notFound()` with ZERO resolve calls, so junk URLs and bot probes never reach hyle;
257
260
  * - otherwise the request is served by `hylePage` with `basePath` = the matched prefix (same locale, redirect and error rules).
258
261
  *
259
- * Failure of the mounts fetch: a 4xx or the kill switch means nothing is served (404). A transient failure (network, timeout,
260
- * 5xx, 429, malformed body) uses the last mounts read successfully for up to 15 minutes, so a hyle outage keeps
262
+ * Failure of the mounts fetch: the kill switch means nothing is served (404); 401 and 403 are rethrown at once. Any other
263
+ * failure (network, timeout, 5xx, any other 4xx, malformed body) uses the last mounts read successfully for up to 15 minutes, so a hyle outage keeps
261
264
  * unmatched URLs a plain 404 and mounted pages on their last good render; with no such copy (a cold server) it is RETHROWN,
262
265
  * because the URL might be a mounted page: Next keeps the last good ISR page, or a first render is an uncached 500. A host
263
266
  * route never depends on this at all: Next matches it first. With a ROOT mount and no copy, every unmatched URL errors
@@ -299,7 +302,7 @@ interface MarkdownRoute {
299
302
  * `hyleRootPage`. It serves the markdown source of a page the mounts serve (same mount matching, reserved paths, `locale`,
300
303
  * `localePrefix`, fetch cache and tags as the page itself): `text/markdown; charset=utf-8` with `X-Robots-Tag: noindex`, asset links
301
304
  * rewritten to the host's asset route. A redirect (301 becomes 308, 307 stays) goes to the target's `.md` twin; a list, an unknown
302
- * path or a rejected request is 404; any other failure is 502 with no body. Reached by `markdownRewritePath` in the host's middleware.
305
+ * path or hyle's not-found is 404; any other failure is 502 with no body. Reached by `markdownRewritePath` in the host's middleware.
303
306
  * For a locale-prefixed site put the route under `[locale]` (`app/api/hyle/md/[locale]/[...path]/route.ts`) so `locale(params)` sees it.
304
307
  */
305
308
  declare function createMarkdownRoute(options: Configs): MarkdownRoute;
@@ -372,11 +375,17 @@ interface AssetRoute {
372
375
  * `img-src 'self'` (and `media-src 'self'`) CSP needs no change. hyle serves only assets that a currently published page of this
373
376
  * workspace references, so an unpublished or other workspace's asset is a 404 here too.
374
377
  *
375
- * Safety: the only input is the `file` segment, matched against `<uuid>[.<ext>]` before anything is sent, so this is not an open
378
+ * The same route serves the workspace's theme stylesheet as `theme-<scope>-<sha256>.css` (see `serveTheme`), which `<HyleTheme>` links.
379
+ *
380
+ * Safety: the only input is the `file` segment, matched against `<uuid>[.<ext>]` or the theme name before anything is sent, so this is not an open
376
381
  * proxy. The browser's cookies and authorization header are never forwarded; only `Range`, `If-Range` and `If-None-Match` are.
377
382
  * The response headers are built here (no upstream header is copied blindly), the content type must be on the asset allowlist,
378
383
  * the body is size-capped and time-bounded, and every failure is an empty 404 or 502 that says nothing about hyle.
379
384
  * The site switch `HYLE_CONTENT_ENABLED=0`/`false`, or missing configuration, answers 404.
385
+ *
386
+ * Draft preview (hyle ADR 0037): `?hyle_preview=<token>`, which the preview page puts on its own images, is sent to hyle as a
387
+ * header so that draft's assets load; every such answer is `no-store`. The token is never sent for the theme stylesheet,
388
+ * which is the credential's own with or without it. No other query parameter is read.
380
389
  */
381
390
  declare function createAssetRoute(options: AssetRouteOptions): AssetRoute;
382
391
 
@@ -464,7 +473,8 @@ interface EngagementRouteOptions {
464
473
  readonly allowedOrigins?: readonly string[];
465
474
  /**
466
475
  * Called for every matched request before any work (after the allowlist and CSRF checks), with the action name:
467
- * "session", "comments.list", "comments.create", "comments.edit", "comments.delete", "reactions.add" or "reactions.remove".
476
+ * "session", "comments.list", "comments.create", "comments.edit", "comments.delete", "reactions.add", "reactions.remove",
477
+ * "votes.set" or "votes.remove".
468
478
  * Return a Response (for example a 429 from your own rate limiter) to answer instead; return nothing to continue. A throw is a 502.
469
479
  * hyle rate-limits too, but every anonymous read reaches your server first: limit /api/hyle/engage in your own middleware or here.
470
480
  */
@@ -509,4 +519,19 @@ declare const ENGAGE_CSRF_HEADER = "x-hyle-engage";
509
519
  */
510
520
  declare function createEngagementRoute(options: EngagementRouteOptions): EngagementRoute;
511
521
 
512
- export { type AssetRoute, type AssetRouteOptions, ENGAGE_CSRF_HEADER, type EngageReader, type EngagementRoute, type EngagementRouteOptions, FetchResolverOptions, HyleArticle, type HyleArticleProps, HyleComments, type HyleCommentsProps, type HyleFeedOptions, HyleList, type HyleListProps, type HyleNextOptions, HyleResolver, type HyleRootConfig, type HyleRootSitemapOptions, type HyleSitemapOptions, type LlmsTxtOptions, MOUNTS_MAX_STALE_MS, type MarkdownRoute, type OgImageRoute, type PageProps, type RevalidateRouteOptions, type RouteParams, createAssetRoute, createEngagementRoute, createLlmsTxtRoute, createMarkdownRoute, createOgImageRoute, createRevalidateRoute, hyleFeed, hyleFeedLink, hyleMetadata, hylePage, hyleRootMetadata, hyleRootPage, hyleRootSitemap, hyleSitemap, markdownRewritePath };
522
+ /** The credential and base URL of `createHyleClient`, plus how your article pages are drawn. */
523
+ type HylePreviewPageOptions = HyleCredential & {
524
+ readonly baseUrl: string;
525
+ } & Pick<CommonOptions, "components" | "slots" | "layout" | "localePrefix">;
526
+ /** `export const metadata = hylePreviewMetadata`, next to `hylePreviewPage`. The page also renders both tags itself. */
527
+ declare const hylePreviewMetadata: Metadata;
528
+ /**
529
+ * The page behind hyle's "Open on site" (ADR 0037): `export default hylePreviewPage({ baseUrl, token })` in
530
+ * `app/hyle-preview/page.tsx`. It draws the draft behind `?token=` with your article components; a missing, wrong or
531
+ * expired token is `notFound()`. The page opens with an "Unpublished draft preview" banner. Nothing is cached (it reads
532
+ * `searchParams` and fetches `no-store`), the page is noindex with no referrer, and the token is never logged. Keep
533
+ * analytics off this route: its URL carries the token.
534
+ */
535
+ declare function hylePreviewPage(options: HylePreviewPageOptions): (props: PageProps) => Promise<ReactElement>;
536
+
537
+ export { type AssetRoute, type AssetRouteOptions, ENGAGE_CSRF_HEADER, type EngageReader, type EngagementRoute, type EngagementRouteOptions, FetchResolverOptions, HyleArticle, type HyleArticleProps, HyleComments, type HyleCommentsProps, type HyleFeedOptions, HyleList, type HyleListProps, type HyleNextOptions, type HylePreviewPageOptions, HyleResolver, type HyleRootConfig, type HyleRootSitemapOptions, type HyleSitemapOptions, type LlmsTxtOptions, MOUNTS_MAX_STALE_MS, type MarkdownRoute, type OgImageRoute, type PageProps, type RevalidateRouteOptions, type RouteParams, createAssetRoute, createEngagementRoute, createLlmsTxtRoute, createMarkdownRoute, createOgImageRoute, createRevalidateRoute, hyleFeed, hyleFeedLink, hyleMetadata, hylePage, hylePreviewMetadata, hylePreviewPage, hyleRootMetadata, hyleRootPage, hyleRootSitemap, hyleSitemap, markdownRewritePath };