@shoalrun/cli 0.1.0-alpha.18 → 0.1.0-alpha.19

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 (35) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +52 -27
  3. package/agent-docs/.well-known/shoalrun/navigation/project-updates-50f26fe22670.txt +3 -1
  4. package/agent-docs/SNAPSHOT.json +5 -5
  5. package/agent-docs/changelog/branding-security.md +66 -0
  6. package/agent-docs/changelog.md +8 -0
  7. package/agent-docs/chat/host.md +20 -2
  8. package/agent-docs/chat/settings.md +1 -1
  9. package/agent-docs/chat/settings.sections/configure-chat.md +1 -1
  10. package/agent-docs/config/examples.md +2 -2
  11. package/agent-docs/config/examples.sections/feature-showcase.md +2 -2
  12. package/agent-docs/config/examples.sections/minimal-site.md +1 -1
  13. package/agent-docs/config/examples.sections/multilingual-help-center.md +1 -1
  14. package/agent-docs/config/examples.sections/parcel-api-documentation.md +1 -1
  15. package/agent-docs/config/examples.sections/related-reading.md +1 -1
  16. package/agent-docs/config/examples.sections/shared-company-preset.md +1 -1
  17. package/agent-docs/configuration.md +1 -1
  18. package/agent-docs/configuration.sections/start-with-one-working-file.md +1 -1
  19. package/agent-docs/documents.json +158 -64
  20. package/agent-docs/provenance.json +6 -6
  21. package/agent-docs/search-index.json +1 -1
  22. package/agent-docs/start.md +1 -1
  23. package/agent-docs/start.sections/start-your-own-project.md +1 -1
  24. package/assets/ask-widget.js +1 -1
  25. package/dist/ask-function.js +5 -2
  26. package/dist/chat-config.d.ts +2 -0
  27. package/dist/chat-config.js +10 -2
  28. package/dist/cli.js +2 -2
  29. package/dist/turnstile-policy.d.ts +2 -0
  30. package/dist/turnstile-policy.js +23 -0
  31. package/dist/turnstile.d.ts +7 -0
  32. package/dist/turnstile.js +29 -2
  33. package/dist/vercel-function.js +1 -1
  34. package/package.json +1 -1
  35. package/skills/shoalrun-brand/SKILL.md +52 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.0-alpha.19 — 2026-11-05
4
+
5
+ - Give your coding agent the `shoalrun-brand` skill to match a documentation
6
+ site to your brand. It guides the agent through choosing colors and fonts,
7
+ adding your logo, and applying theme settings and CSS. It also checks search
8
+ results, menus, buttons, keyboard focus, and mobile layouts for readability.
9
+ Read it with `shoalrun skills read shoalrun-brand`.
10
+ - Make hosted chat verify where a visitor check came from. Turnstile responses
11
+ must match a trusted hostname and, when configured, the expected action.
12
+ A session pass from a different hostname/action policy no longer skips the
13
+ check, even when the deployments share a secret. Changing the policy
14
+ invalidates existing passes. Upgrade the CLI, then rebuild and
15
+ redeploy hosted chat to apply these protections.
16
+ - Keep local and hosted test previews working with Turnstile's published test
17
+ keys. Local preview checks the actual dummy-token response; the documentation
18
+ site's hosted preview requires test credentials and a separate usage store.
19
+ - Check development dependencies as well as production dependencies in both
20
+ repositories during a coordinated release. Update the documentation site's
21
+ browser tools and affected dependencies to remove the identified security
22
+ advisories without forcing incompatible package versions.
23
+ - Add security headers to the documentation site that restrict framing to the
24
+ same origin and set an explicit referrer policy. Deployment checks now reject
25
+ responses missing the required headers. A broader Content Security Policy
26
+ starts in report-only mode so browser violations can be reviewed before
27
+ enforcement; it doesn't yet block scripts. These are site-owned settings,
28
+ not new defaults imposed on customer sites.
29
+ - Refresh the repository and package READMEs with product versions, customer
30
+ editions, branding, application content delivery, and agent workflows. Update
31
+ the hosted-chat guide with hostname checks, optional actions, session passes,
32
+ and preview configuration.
33
+
3
34
  ## 0.1.0-alpha.18 — 2026-11-04
4
35
 
5
36
  - Add authored page availability ranges with `since` and `through` version
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Shoalrun
2
2
 
3
- Shoalrun turns Markdown and MDX into a documentation website and Markdown pages from the same content. People can browse the site; agents can read the Markdown. Native components such as steps, tabs, and API references preserve their content in both formats.
3
+ Shoalrun builds a documentation website, Markdown pages, and application content from the same Markdown and MDX source. People can browse the site; applications and agents can read stable documents, sections, and snippet instances. Native components keep essential instructions and API details readable in both HTML and Markdown.
4
4
 
5
5
  This package provides the `shoalrun` CLI, starter projects, agent skills, and offline documentation. It requires Node.js 22.12 or newer. This alpha is distributed through the public npm registry. Installation requires no npm account or package token.
6
6
 
@@ -9,17 +9,9 @@ This package provides the `shoalrun` CLI, starter projects, agent skills, and of
9
9
  From the project where you want to keep your documentation:
10
10
 
11
11
  ```sh
12
- npm install --save-dev --save-exact @shoalrun/cli@0.1.0-alpha.18
12
+ npm install --save-dev --save-exact @shoalrun/cli@0.1.0-alpha.19
13
13
  ```
14
14
 
15
- If you previously used the private GitHub Packages alpha, check `npm config get @shoalrun:registry`. Remove or replace any `@shoalrun:registry=https://npm.pkg.github.com` entry in your project or user `.npmrc`. You can explicitly select the public registry for the upgrade:
16
-
17
- ```sh
18
- npm install --save-dev --save-exact @shoalrun/cli@0.1.0-alpha.18 --@shoalrun:registry=https://registry.npmjs.org
19
- ```
20
-
21
- Commit the updated package manifest and lockfile together. Check that the lockfile resolves `@shoalrun/cli` from `registry.npmjs.org`. Keep any credentials needed by other private dependencies; Shoalrun itself no longer needs a package token.
22
-
23
15
  ## Create and preview a site
24
16
 
25
17
  Run these commands from the directory where you installed the package:
@@ -38,11 +30,34 @@ npx --no-install shoalrun dev my-docs/docs.config.yaml my-docs/site-dist --port
38
30
 
39
31
  Stop the existing preview with Ctrl-C before starting the development server on the same port. Choose **Explore the starter**, the first item in the left navigation, to find component examples, diagrams, reader views, themes, and generated API references. The service and API hosts are fictional; replace them before sending requests. Choose `--starter minimal` for a smaller starting point or `--starter api-docs` for a focused OpenAPI example. All three starters build without provider credentials.
40
32
 
33
+ ## What you can build
34
+
35
+ The [features overview](https://www.shoalrun.com/features) describes the complete authoring and delivery workflow. Start with the part you need:
36
+
37
+ | Need | Capability |
38
+ | --- | --- |
39
+ | A documentation site | Pages, navigation, local preview, themes, palettes, fonts, and project CSS. |
40
+ | Reusable procedures | Recipes, shared ingredients, and cookbooks that help readers choose a complete task. |
41
+ | API reference | OpenAPI operation pages, code examples, focused contracts, and an explicit source-review gate. |
42
+ | Several product releases | Independent product versions and defaults, publication routes, and a header publication selector. |
43
+ | Customer editions | External profiles, SKU revisions, feature grants, and conditional pages or sections. |
44
+ | Application help | HTML and Markdown exports, stable page/section/snippet references, static and REST clients, and instance-safe mounting. |
45
+ | Agent discovery | Markdown twins, compact linked indexes, read-only MCP tools, bundled skills, and offline references. |
46
+ | Search and answers | Browser keyword search, optional semantic retrieval, and hosted documentation chat with shared limits. |
47
+
48
+ Local builds and keyword search need no provider credentials. Semantic retrieval and generated answers use separately configured services; credentials stay server-side. Reader filters are browsing controls, not authorization. Customer profiles select output during compilation; private-edition hosting remains your responsibility.
49
+
50
+ ## Match your brand
51
+
52
+ Use `site.logo`, `site.favicon`, and header settings for site identity. Choose a theme preset and configure `theme.palette`, `theme.mode`, and `theme.fonts`. Use `site.customCss` for changes beyond those settings. Customer profiles can supply deployment-owned branding without storing customer records in the shared source.
53
+
54
+ Check controls and interactive states as well as article text: a dark header can contain light inputs, menus, and search results. Palette validation doesn't check arbitrary project CSS. See [themes and fonts](https://www.shoalrun.com/styling/themes), the [CSS reference](https://www.shoalrun.com/author/css), and [deployment profiles](DEPLOYMENT-PROFILES.md).
55
+
41
56
  ## Independently versioned products
42
57
 
43
58
  Projects can give each product its own version catalog and default version. Product publications carry a product, channel, version, and language; routes, document links, navigation, search, and content exports retain that scope. Existing projects without product catalogs keep their publication identities and routes.
44
59
 
45
- Available since `0.1.0-alpha.18`.
60
+ Product catalogs and profile-aware development preview are available since `0.1.0-alpha.18`. The product names and versions below are an example configuration.
46
61
 
47
62
  The header publication dropdown groups the published releases by product. It hides language labels when the edition has one language; set `site.publicationSelector.showLanguage: true` or `false` to override that display without changing publication identity.
48
63
 
@@ -87,7 +102,7 @@ publications:
87
102
  The shared configuration must declare `profiles.manifest`, which defines the known features and SKU revisions. Each selected publication must be enabled by that configuration. Preview the customer edition directly:
88
103
 
89
104
  ```sh
90
- npx --no-install shoalrun dev docs.config.yaml site-dist --profile customers/acme.yaml --port 8770
105
+ npx --no-install shoalrun dev docs.config.yaml site-dist --profile customers/example.yaml --port 8770
91
106
  ```
92
107
 
93
108
  The development server compiles the selected edition and watches its profile, SKU manifest, and declared assets, including files outside the project. Editing the profile rebuilds the edition and removes output that is no longer selected. The preview identifies the last successful edition. If a rebuild fails, it keeps that output and displays the failure on existing and newly opened pages. Reader views remain browsing controls; customer profile selection applies during compilation to HTML, Markdown, navigation, and indexes.
@@ -96,7 +111,7 @@ Agents can discover product scopes through MCP `get_publications` before searchi
96
111
 
97
112
  ## Work with an agent
98
113
 
99
- Shoalrun works with your existing coding agent. Its packaged skills explain how to set up a site, edit pages, and develop components:
114
+ Shoalrun works with your existing coding agent. Its packaged skills cover setup, page authoring, components, recipes, and walkthroughs. Use `skills list` to discover the skills included with your installed version:
100
115
 
101
116
  ```sh
102
117
  npx --no-install shoalrun skills list
@@ -105,7 +120,7 @@ npx --no-install shoalrun skills read shoalrun-setup
105
120
 
106
121
  Ask your agent to read the skill for the task. `skills list` returns names, descriptions, and local instruction-file paths. These commands read the skills; installing the npm package does not automatically install them into your agent.
107
122
 
108
- The usual editing workflow is to capture a baseline, edit source files, validate the changes, then review a local preview. From your documentation project directory:
123
+ The editing workflow is to capture a baseline, edit source files, validate the changes, then review a local preview. From your documentation project directory:
109
124
 
110
125
  ```sh
111
126
  npx --no-install shoalrun docs baseline --out .shoalrun/task-baseline.json
@@ -113,7 +128,7 @@ npx --no-install shoalrun docs baseline --out .shoalrun/task-baseline.json
113
128
  npx --no-install shoalrun docs validate --baseline .shoalrun/task-baseline.json
114
129
  ```
115
130
 
116
- Validation returns a report path. Pass that path to `shoalrun docs review` and `shoalrun docs preview`. Snapshot validation can render affected draft pages while preserving their draft access; ordinary site builds exclude drafts. Supply your own project writing and review requirements—the starter does not define them for you.
131
+ Validation returns a report path. Pass that path to `shoalrun docs review` and `shoalrun docs preview`. Snapshot validation can render affected draft pages while preserving their draft access; ordinary site builds exclude drafts. Supply your own project writing and review requirements. Configured checks and custom plugins execute trusted project code; a validation copy is not an operating-system sandbox.
117
132
 
118
133
  ## Find documentation
119
134
 
@@ -297,18 +312,6 @@ The limit applies to each index response, not an entire multi-step reading sessi
297
312
  An individual title or summary too large to fit an index produces an explicit
298
313
  build error rather than silently dropping content.
299
314
 
300
- ## Status and development
301
-
302
- This alpha may change configuration and output formats between releases. No compatibility promise or maintained older release line is offered yet. Creating and previewing a basic site does not require a model provider or Chrome. Optional provider-backed features require their own configuration.
303
-
304
- Shoalrun is maintainer-led and does not accept unsolicited pull requests at this time. The [repository development instructions](https://github.com/shoalrun/shoalrun#develop-the-framework) explain how to build and test your own checkout or fork.
305
-
306
- Pin an exact package version and read the [changelog](CHANGELOG.md) before upgrading. Rebuild and check HTML, Markdown, links, and any application consuming exported content before deploying. See the [contribution policy](https://github.com/shoalrun/shoalrun/blob/main/CONTRIBUTING.md) and [security policy](https://github.com/shoalrun/shoalrun/blob/main/SECURITY.md) for reporting problems and project trust boundaries.
307
-
308
- ## License
309
-
310
- Copyright 2026 Casey Smith. This package is licensed under [Apache-2.0](LICENSE). Your authored site content keeps its own license. Built sites contain runtime assets and may contain copied template text; retain applicable licenses and third-party notices when distributing them.
311
-
312
315
  ## Verification dates
313
316
 
314
317
  Set `verified` only after checking a page's technical claims. It is separate from
@@ -327,3 +330,25 @@ in HTML only; Markdown and manifest metadata retain it. Set
327
330
  `frontmatter.defaults.showVerified: false` in project configuration for a shared
328
331
  default, then override it with `showVerified: true` on individual pages. A layout
329
332
  with a Hero replaces the standard page header and does not display its dates.
333
+
334
+ ## Upgrade from the earlier private registry
335
+
336
+ If you previously used the private GitHub Packages alpha, check `npm config get @shoalrun:registry`. Remove or replace any `@shoalrun:registry=https://npm.pkg.github.com` entry in your project or user `.npmrc`. You can explicitly select the public registry for the upgrade:
337
+
338
+ ```sh
339
+ npm install --save-dev --save-exact @shoalrun/cli@0.1.0-alpha.19 --@shoalrun:registry=https://registry.npmjs.org
340
+ ```
341
+
342
+ Commit the updated package manifest and lockfile together. Check that the lockfile resolves `@shoalrun/cli` from `registry.npmjs.org`. Keep any credentials needed by other private dependencies; Shoalrun itself no longer needs a package token.
343
+
344
+ ## Status and development
345
+
346
+ This alpha may change configuration and output formats between releases. No compatibility promise or maintained older release line is offered yet. Creating and previewing a basic site does not require a model provider or Chrome. Optional provider-backed features require their own configuration.
347
+
348
+ Shoalrun is maintainer-led and does not accept unsolicited pull requests at this time. The [repository development instructions](https://github.com/shoalrun/shoalrun#develop-the-framework) explain how to build and test your own checkout or fork.
349
+
350
+ Pin an exact package version and read the [changelog](CHANGELOG.md) before upgrading. Rebuild and check HTML, Markdown, links, and any application consuming exported content before deploying. See the [contribution policy](https://github.com/shoalrun/shoalrun/blob/main/CONTRIBUTING.md) and [security policy](https://github.com/shoalrun/shoalrun/blob/main/SECURITY.md) for reporting problems and project trust boundaries.
351
+
352
+ ## License
353
+
354
+ Copyright 2026 Casey Smith. This package is licensed under [Apache-2.0](LICENSE). Your authored site content keeps its own license. Built sites contain runtime assets and may contain copied template text; retain applicable licenses and third-party notices when distributing them.
@@ -24,13 +24,15 @@ Full-page token counts use cl100k_base. Navigation section ID: project-updates.
24
24
 
25
25
  - [Smaller hosted search and Ask functions](https://www.shoalrun.com/changelog/2026-11-04-runtime-packaging.md) — ID: change.2026-11-04-runtime-packaging. changelog-entry; 647 tokens. Rebuild hosted docs with alpha.17 to reduce deployment files while keeping semantic search and Ask available.
26
26
 
27
+ - [Branding guidance and safer hosted chat](https://www.shoalrun.com/changelog/branding-security.md) — ID: change.branding-security. changelog-entry; 936 tokens. Match your documentation to your brand with an agent skill, and bind hosted-chat visitor checks to the intended site.
28
+
27
29
  - [Authoring snapshot previews and review reports](https://www.shoalrun.com/changelog/authoring-preview.md) — ID: change.authoring-preview. changelog-entry; 554 tokens. Snapshot previews with coverage and freshness reports.
28
30
 
29
31
  - [Agent authoring, search, and documentation answers](https://www.shoalrun.com/changelog/authoring-search.md) — ID: change.authoring-search. changelog-entry; 468 tokens. Reviewed agent drafts, search improvements, and answer context.
30
32
 
31
33
  - [Working-tree authoring tools](https://www.shoalrun.com/changelog/authoring-tools.md) — ID: change.authoring-tools. changelog-entry; 384 tokens. Project discovery and captured working-tree validation.
32
34
 
33
- - [Changelog](https://www.shoalrun.com/changelog.md) — ID: reference.changelog. reference; 1337 tokens. Compiler, CLI, and reader changes.
35
+ - [Changelog](https://www.shoalrun.com/changelog.md) — ID: reference.changelog. reference; 1407 tokens. Compiler, CLI, and reader changes.
34
36
 
35
37
  - [MCP hosting, analytics, and component improvements](https://www.shoalrun.com/changelog/2026-10-17-mcp-hosting.md) — ID: change.mcp-hosting. changelog-entry; 1147 tokens. MCP hosting, analytics, and shared component content.
36
38
 
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "sourceRepository": "https://github.com/shoalrun/docs",
4
- "sourceCommit": "201a4e562b70414e26ecba7c2488ba899550f06b",
5
- "siteBuildId": "41390a172a8dbd578761e016a1c5890718f0b06c37f90b40769f585f75fd71ec",
6
- "manifestDigest": "b0996def2c34eaafbb41b5ab5b3ca0e78a370a620ffb4b8bfe53bc6248300d05",
7
- "indexDigest": "ed3b6ccce7e13cb3d038707a22430a76367522344d879a166d2764d445c16e06",
8
- "packageIntegrity": "sha512-91enZzr2NCzCFo8OXfEZWjI7SQD+FVlFtEwRD30UKaMD3OBjgVY0wBgZyvVULXMUoZkdbyOj/OpdfDw/Tkk1ww=="
4
+ "sourceCommit": "27e393134027da5587c4102f6d4a4e9598f2bed5",
5
+ "siteBuildId": "3ca70f64a4b3562b2c51fd6a4a6beceb3578705d2fc545b7788589aebd0e6ff5",
6
+ "manifestDigest": "2fb2a205cf322384919c7546e0626c42de82c34cfcdc2f5e244c92968993fd03",
7
+ "indexDigest": "66cbcb506a60f1a1588e76135ab195c1491cb69337526f21979aed936d4478c5",
8
+ "packageIntegrity": "sha512-UMknmhUPoDv6tSOUlIjfeEuOHANy/+pEouq8wGEXlAxN9uRaVqcO/bSRcXQkLZvWLIolLcqkFDRjAUzVNimFDA=="
9
9
  }
@@ -0,0 +1,66 @@
1
+ ---
2
+ id: change.branding-security
3
+ title: Branding guidance and safer hosted chat
4
+ summary: Match your documentation to your brand with an agent skill, and bind
5
+ hosted-chat visitor checks to the intended site.
6
+ type: changelog-entry
7
+ area:
8
+ - appearance
9
+ - discovery
10
+ - project
11
+ subarea:
12
+ - appearance-themes
13
+ - discovery-chat
14
+ - project-releases
15
+ canonical: /changelog/branding-security
16
+ date: 2026-11-05
17
+ releaseVersion: 0.1.0-alpha.19
18
+ ---
19
+
20
+ # Branding guidance and safer hosted chat
21
+
22
+ > Documentation index: [llms.min.txt](https://www.shoalrun.com/llms.min.txt) · Document manifest: [documents.json](https://www.shoalrun.com/documents.json)
23
+
24
+ Navigation section: [Project](https://www.shoalrun.com/.well-known/shoalrun/navigation/project-updates-50f26fe22670.txt) (ID: project-updates). [All sections and pages](https://www.shoalrun.com/llms.min.txt)
25
+
26
+ Breadcrumbs: [Project](https://www.shoalrun.com/status.md) > Changelog > alpha.19: Branding and security
27
+
28
+ **Published: 2026-11-05.**
29
+
30
+ **Version: 0.1.0-alpha.19.**
31
+
32
+ Give your coding agent the `shoalrun-brand` skill to match a documentation site to your brand. It guides the agent through colors, fonts, logos, theme settings, and CSS, then checks menus, search results, buttons, keyboard focus, and mobile layouts for readability.
33
+
34
+ Upgrade to CLI `0.1.0-alpha.19`. Rebuild and redeploy hosted chat to apply its new visitor checks. You don't need provider credentials to read the skill or brand a local site.
35
+
36
+ ## Match a documentation site to your brand
37
+
38
+ Ask your agent to read the skill:
39
+
40
+ ```sh
41
+ npx --no-install shoalrun skills read shoalrun-brand
42
+ ```
43
+
44
+ The skill works from a supplied website, brand guide, or assets. It uses supported configuration first and project CSS where needed. It keeps brand assets in your project and preserves the documentation, navigation, and routes. It checks both the page and interactive surfaces: a dark header can contain light inputs, dropdowns, and search results that need their own text colors.
45
+
46
+ The agent builds and previews the result for review. See [themes and fonts](https://www.shoalrun.com/styling/themes.md) and the [CSS reference](https://www.shoalrun.com/author/css.md) for the configuration it uses.
47
+
48
+ ## Keep visitor checks tied to the intended site
49
+
50
+ Hosted chat checks the hostname returned by Turnstile rather than accepting a successful response alone. By default, the accepted names come from the site's trusted deployment addresses. You can supply an exact `chat.challenge.hostnames` list and an optional `action` for this operation.
51
+
52
+ A session pass is now tied to the hostname/action policy as well as the caller. A pass from a different policy can't skip the check, even when deployments share a secret. Changing the policy invalidates existing passes; the next required check gives the visitor a new one.
53
+
54
+ Local public preview handles the published dummy-token response separately from production verification. Hosted test previews need matching test credentials and a separate usage store. See [Host and limit documentation chat](https://www.shoalrun.com/chat/host.md) for the settings and preview behavior.
55
+
56
+ ## Check dependencies and hosting policy
57
+
58
+ Coordinated releases now check both the framework and documentation dependency graphs, including development tools. The documentation site's browser tools and affected dependencies are updated without forcing an incompatible package version.
59
+
60
+ The documentation site also restricts framing to the same origin, sets an explicit referrer policy, and checks the required headers after deployment. Its broader Content Security Policy starts in report-only mode: browser violations can be reviewed before enforcement, and that policy doesn't yet block scripts. These settings belong to this site; they aren't compiler defaults for customer sites.
61
+
62
+ The repository and package READMEs now cover product versions, customer editions, branding, application content delivery, and agent workflows.
63
+
64
+ ## HTML, Markdown, and agents
65
+
66
+ Branding changes the HTML site's appearance and interaction states. Markdown retains the documentation and examples without fonts, colors, menus, or focus styles. Agents read the packaged skill and bundled references, edit project source, validate the result, and share a local preview. A successful build doesn't replace visual checks of the browser output.
@@ -22,6 +22,14 @@ Updates to Shoalrun and its documentation. Each entry identifies the affected ve
22
22
 
23
23
  ## Latest changes
24
24
 
25
+ - 2026-11-05
26
+
27
+ Version 0.1.0-alpha.19
28
+
29
+ [Branding guidance and safer hosted chat](https://www.shoalrun.com/changelog/branding-security.md)
30
+
31
+ Match your documentation to your brand with an agent skill, and bind hosted-chat visitor checks to the intended site.
32
+
25
33
  - 2026-11-04
26
34
 
27
35
  Version 0.1.0-alpha.17
@@ -116,6 +116,22 @@ chat:
116
116
 
117
117
  The site key is public and goes in the config. The secret goes in the environment variable. A check that fails, times out, or has no secret refuses the request, so an outage can't let scripts through. Without `chat.challenge`, the function logs a warning, because only the daily caps then stand in the way of a script.
118
118
 
119
+ The function also checks the hostname returned by Cloudflare. By default, it accepts the trusted site and deployment hostnames described above, without their ports. Set `hostnames` to an explicit list to narrow that check. Names are exact: don't include a scheme, path, port, or wildcard. Keep the widget's allowed domains in Cloudflare consistent with the addresses you intend to use.
120
+
121
+ Use `action` when the widget needs to identify this operation. The browser sends it when requesting a token, and the server requires the same value in Cloudflare's verification response:
122
+
123
+ ```yaml title="docs.config.yaml"
124
+ chat:
125
+ challenge:
126
+ provider: turnstile
127
+ siteKey: 0x4AAAAAAAexample
128
+ secretEnv: TURNSTILE_SECRET_KEY
129
+ hostnames: [docs.example.com]
130
+ action: documentation_chat
131
+ ```
132
+
133
+ A missing or mismatched hostname, or a missing or mismatched configured action, refuses the request before answering. Adding a hostname here doesn't authorize incoming requests from that host; the function's host checks still apply.
134
+
119
135
  The default `adaptive` mode requests a challenge when usage crosses a threshold:
120
136
 
121
137
  - A caller is asked once they have used `freeQuestions` model answers in a day. The default is 3.
@@ -124,15 +140,17 @@ The default `adaptive` mode requests a challenge when usage crosses a threshold:
124
140
 
125
141
  When challenged, the panel runs the check and resends the question. It shows `Checking that you are a person…` while waiting.
126
142
 
127
- A successful check creates a signed, browser-script-inaccessible cookie tied to the caller’s address. The signing key is derived from the Turnstile secret. The pass lasts 15 minutes, so follow-up questions need no new challenge during that time.
143
+ A successful check creates a signed, browser-script-inaccessible cookie tied to the caller’s address and the hostname/action policy. The signing key is derived from the Turnstile secret and that policy. Changing the policy invalidates existing passes. The pass lasts 15 minutes, so follow-up questions need no new challenge during that time.
128
144
 
129
145
  | Setting | What it does |
130
146
  | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
147
+ | `hostnames` | Exact hostnames accepted from token verification. Defaults to the trusted runtime hostnames; an explicit list must be nonempty. |
148
+ | `action` | Optional operation name sent by the widget and checked by the server. Use 1–32 letters, digits, underscores, or hyphens. |
131
149
  | `when` | `adaptive` (the default) asks only when needed. `always` checks every conversation. It runs in the background when the panel opens, so the first question doesn't wait. |
132
150
  | `freeQuestions` | Model answers a caller gets before being asked. The default is 3. |
133
151
  | `busyShare` | The share of the daily budget at which everyone is asked. A number above 0 and at most 1. The default is 0.5. |
134
152
 
135
- Cloudflare publishes test keys for development. They work on any address and accept only their own test token, so a test site key needs the matching test secret. Use them for preview deployments, so you never have to register preview addresses.
153
+ Cloudflare publishes test keys for development. A test site key needs the matching test secret. Test responses use synthetic hostname metadata and don't prove a production domain or action. `serve --ask --public-preview` configures its local test expectations for you. For hosted previews with real verification, register the preview hostname in the widget and include it among the function's trusted hosts. Keep test keys and test grants out of production.
136
154
 
137
155
  ### Record questions
138
156
 
@@ -98,7 +98,7 @@ Add these fields to `chat` when the corresponding capability is needed. Scorer-d
98
98
  | `fallback` | A list of one to five other models to try, in order, when the main one fails. See [Use more than one model](#use-more-than-one-model). |
99
99
  | `escalate` | A second model to ask when the checks flag an answer, with an optional `when` list. See [Use more than one model](#use-more-than-one-model). |
100
100
  | `budget` | Daily caps on questions that reach the model. See [Cap the daily spend](https://www.shoalrun.com/chat/host.md). |
101
- | `challenge` | A Turnstile check for a hosted chat. See [Host the chat on Vercel](https://www.shoalrun.com/chat/host.md). |
101
+ | `challenge` | A Turnstile check for hosted chat, with verified hostnames and an optional action. See [Host the chat on Vercel](https://www.shoalrun.com/chat/host.md). |
102
102
  | `log` | Records questions on a hosted chat. See [Host the chat on Vercel](https://www.shoalrun.com/chat/host.md). |
103
103
  | `cache` | Keeps clean answers so a repeated question costs nothing. `maxEntries` (default 500) and `ttlMinutes` (default 1,440) set the size and the age. See [Reuse answers](https://www.shoalrun.com/chat/checks.md). |
104
104
  | `cards` | Needs `rerank: jev`. Serves answers written ahead of time. `threshold` (default 0.75) shortlists a card by similarity, and `confirm` (default 0.9) is the Jev score that must confirm it. See [Prepared answers](https://www.shoalrun.com/chat/prepared-answers.md). |
@@ -66,7 +66,7 @@ Add these fields to `chat` when the corresponding capability is needed. Scorer-d
66
66
  | `fallback` | A list of one to five other models to try, in order, when the main one fails. See [Use more than one model](https://www.shoalrun.com/chat/settings.md#use-more-than-one-model). |
67
67
  | `escalate` | A second model to ask when the checks flag an answer, with an optional `when` list. See [Use more than one model](https://www.shoalrun.com/chat/settings.md#use-more-than-one-model). |
68
68
  | `budget` | Daily caps on questions that reach the model. See [Cap the daily spend](https://www.shoalrun.com/chat/host.md). |
69
- | `challenge` | A Turnstile check for a hosted chat. See [Host the chat on Vercel](https://www.shoalrun.com/chat/host.md). |
69
+ | `challenge` | A Turnstile check for hosted chat, with verified hostnames and an optional action. See [Host the chat on Vercel](https://www.shoalrun.com/chat/host.md). |
70
70
  | `log` | Records questions on a hosted chat. See [Host the chat on Vercel](https://www.shoalrun.com/chat/host.md). |
71
71
  | `cache` | Keeps clean answers so a repeated question costs nothing. `maxEntries` (default 500) and `ttlMinutes` (default 1,440) set the size and the age. See [Reuse answers](https://www.shoalrun.com/chat/checks.md). |
72
72
  | `cards` | Needs `rerank: jev`. Serves answers written ahead of time. `threshold` (default 0.75) shortlists a card by similarity, and `confirm` (default 0.9) is the Jev score that must confirm it. See [Prepared answers](https://www.shoalrun.com/chat/prepared-answers.md). |
@@ -27,7 +27,7 @@ Install Node.js 22.12 or newer and npm before running these commands.
27
27
  mkdir my-docs
28
28
  cd my-docs
29
29
  npm init -y
30
- npm install --save-exact @shoalrun/cli@0.1.0-alpha.18
30
+ npm install --save-exact @shoalrun/cli@0.1.0-alpha.19
31
31
  npx --no-install shoalrun init . --starter minimal
32
32
  npx --no-install shoalrun build docs.config.yaml site-dist
33
33
  npx --no-install shoalrun serve site-dist
@@ -52,7 +52,7 @@ The `showcase` starter provides 18 connected pages. Its component examples cover
52
52
  mkdir my-handbook
53
53
  cd my-handbook
54
54
  npm init -y
55
- npm install --save-exact @shoalrun/cli@0.1.0-alpha.18
55
+ npm install --save-exact @shoalrun/cli@0.1.0-alpha.19
56
56
  npx --no-install shoalrun init . --starter showcase
57
57
  npx --no-install shoalrun build docs.config.yaml site-dist
58
58
  npx --no-install shoalrun serve site-dist
@@ -29,7 +29,7 @@ Install Node.js 22.12 or newer and npm before running these commands.
29
29
  mkdir my-docs
30
30
  cd my-docs
31
31
  npm init -y
32
- npm install --save-exact @shoalrun/cli@0.1.0-alpha.18
32
+ npm install --save-exact @shoalrun/cli@0.1.0-alpha.19
33
33
  npx --no-install shoalrun init . --starter minimal
34
34
  npx --no-install shoalrun build docs.config.yaml site-dist
35
35
  npx --no-install shoalrun serve site-dist
@@ -54,7 +54,7 @@ The `showcase` starter provides 18 connected pages. Its component examples cover
54
54
  mkdir my-handbook
55
55
  cd my-handbook
56
56
  npm init -y
57
- npm install --save-exact @shoalrun/cli@0.1.0-alpha.18
57
+ npm install --save-exact @shoalrun/cli@0.1.0-alpha.19
58
58
  npx --no-install shoalrun init . --starter showcase
59
59
  npx --no-install shoalrun build docs.config.yaml site-dist
60
60
  npx --no-install shoalrun serve site-dist
@@ -29,7 +29,7 @@ Install Node.js 22.12 or newer and npm before running these commands.
29
29
  mkdir my-docs
30
30
  cd my-docs
31
31
  npm init -y
32
- npm install --save-exact @shoalrun/cli@0.1.0-alpha.18
32
+ npm install --save-exact @shoalrun/cli@0.1.0-alpha.19
33
33
  npx --no-install shoalrun init . --starter minimal
34
34
  npx --no-install shoalrun build docs.config.yaml site-dist
35
35
  npx --no-install shoalrun serve site-dist
@@ -29,7 +29,7 @@ Install Node.js 22.12 or newer and npm before running these commands.
29
29
  mkdir my-docs
30
30
  cd my-docs
31
31
  npm init -y
32
- npm install --save-exact @shoalrun/cli@0.1.0-alpha.18
32
+ npm install --save-exact @shoalrun/cli@0.1.0-alpha.19
33
33
  npx --no-install shoalrun init . --starter minimal
34
34
  npx --no-install shoalrun build docs.config.yaml site-dist
35
35
  npx --no-install shoalrun serve site-dist
@@ -29,7 +29,7 @@ Install Node.js 22.12 or newer and npm before running these commands.
29
29
  mkdir my-docs
30
30
  cd my-docs
31
31
  npm init -y
32
- npm install --save-exact @shoalrun/cli@0.1.0-alpha.18
32
+ npm install --save-exact @shoalrun/cli@0.1.0-alpha.19
33
33
  npx --no-install shoalrun init . --starter minimal
34
34
  npx --no-install shoalrun build docs.config.yaml site-dist
35
35
  npx --no-install shoalrun serve site-dist
@@ -29,7 +29,7 @@ Install Node.js 22.12 or newer and npm before running these commands.
29
29
  mkdir my-docs
30
30
  cd my-docs
31
31
  npm init -y
32
- npm install --save-exact @shoalrun/cli@0.1.0-alpha.18
32
+ npm install --save-exact @shoalrun/cli@0.1.0-alpha.19
33
33
  npx --no-install shoalrun init . --starter minimal
34
34
  npx --no-install shoalrun build docs.config.yaml site-dist
35
35
  npx --no-install shoalrun serve site-dist
@@ -29,7 +29,7 @@ Install Node.js 22.12 or newer and npm before running these commands.
29
29
  mkdir my-docs
30
30
  cd my-docs
31
31
  npm init -y
32
- npm install --save-exact @shoalrun/cli@0.1.0-alpha.18
32
+ npm install --save-exact @shoalrun/cli@0.1.0-alpha.19
33
33
  npx --no-install shoalrun init . --starter minimal
34
34
  npx --no-install shoalrun build docs.config.yaml site-dist
35
35
  npx --no-install shoalrun serve site-dist
@@ -59,7 +59,7 @@ CONFIG_DEMO="$(mktemp -d)"
59
59
  mkdir "$CONFIG_DEMO/site"
60
60
  cd "$CONFIG_DEMO/site"
61
61
  npm init -y
62
- npm install --save-exact @shoalrun/cli@0.1.0-alpha.18
62
+ npm install --save-exact @shoalrun/cli@0.1.0-alpha.19
63
63
  npx --no-install shoalrun init . --starter minimal
64
64
  ```
65
65
 
@@ -40,7 +40,7 @@ CONFIG_DEMO="$(mktemp -d)"
40
40
  mkdir "$CONFIG_DEMO/site"
41
41
  cd "$CONFIG_DEMO/site"
42
42
  npm init -y
43
- npm install --save-exact @shoalrun/cli@0.1.0-alpha.18
43
+ npm install --save-exact @shoalrun/cli@0.1.0-alpha.19
44
44
  npx --no-install shoalrun init . --starter minimal
45
45
  ```
46
46