@vercel/geistdocs 2.8.0 → 2.9.1

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/dist/assets/icons/icon-fullscreen-close.d.ts +26 -0
  2. package/dist/assets/icons/icon-fullscreen-close.d.ts.map +1 -0
  3. package/dist/assets/icons/icon-fullscreen-close.js +25 -0
  4. package/dist/assets/icons/icon-fullscreen.d.ts +26 -0
  5. package/dist/assets/icons/icon-fullscreen.d.ts.map +1 -0
  6. package/dist/assets/icons/icon-fullscreen.js +25 -0
  7. package/dist/assets/icons/index.d.ts +2 -0
  8. package/dist/assets/icons/index.d.ts.map +1 -1
  9. package/dist/assets/icons/index.js +2 -0
  10. package/dist/cli/index.js +1 -1
  11. package/dist/internal/chat/context.d.ts +3 -0
  12. package/dist/internal/chat/context.d.ts.map +1 -1
  13. package/dist/internal/chat/context.js +7 -0
  14. package/dist/internal/chat/message.js +1 -1
  15. package/dist/internal/chat/shell.d.ts.map +1 -1
  16. package/dist/internal/chat/shell.js +15 -10
  17. package/dist/internal/mdx-to-markdown.d.ts.map +1 -1
  18. package/dist/internal/mdx-to-markdown.js +226 -19
  19. package/dist/internal/provider-client.d.ts.map +1 -1
  20. package/dist/internal/provider-client.js +9 -3
  21. package/docs/agents.md +1 -1
  22. package/docs/llms.txt +34 -20
  23. package/docs/manifest.json +1 -1
  24. package/docs/pages/ask-ai.md +11 -6
  25. package/docs/pages/deployment.md +8 -6
  26. package/docs/pages/env.md +15 -8
  27. package/package.json +1 -1
  28. package/public-foundation.css +0 -2
  29. package/shared-theme.css +6 -0
  30. package/template/.env.example +2 -3
  31. package/template/AGENTS.md +1 -1
  32. package/template/content/docs/ask-ai.mdx +11 -6
  33. package/template/content/docs/deployment.mdx +8 -6
  34. package/template/content/docs/env.mdx +16 -9
  35. package/template/package.json +1 -1
@@ -1,5 +1,3 @@
1
- @custom-variant dark (&:is(.dark *, .dark-theme *));
2
-
3
1
  @theme inline {
4
2
  /* geist theme tokens */
5
3
 
package/shared-theme.css CHANGED
@@ -1,3 +1,9 @@
1
+ @custom-variant dark (&:where(.dark, .dark *, .dark-theme, .dark-theme *));
2
+
3
+ .dark-theme .shiki:not(.not-fumadocs-codeblock *) code span {
4
+ color: var(--shiki-dark);
5
+ }
6
+
1
7
  @source "node_modules/streamdown/dist/*.js";
2
8
  @source "../../streamdown/dist/*.js";
3
9
 
@@ -10,9 +10,8 @@ MXBAI_STORE_ID=""
10
10
  # Include the /vertex route, for example: https://<geistdocs-platform-deployment>/vertex
11
11
  GEISTDOCS_CHAT_PROXY_URL=""
12
12
 
13
- # Chat proxy bearer token.
14
- # Only set this for a custom proxy that requires Authorization: Bearer <token>.
15
- # The default Geistdocs platform /vertex proxy uses Vercel OIDC and Trusted Sources.
13
+ # Chat proxy bearer token. Required for the Geistdocs platform /vertex proxy.
14
+ # Use the same random value as GEISTDOCS_VERTEX_PROXY_TOKEN on the platform.
16
15
  GEISTDOCS_CHAT_PROXY_TOKEN=""
17
16
 
18
17
  # Signs the eve agent session cookie (ai.eveAgent mode only).
@@ -82,7 +82,7 @@ Use these instructions when an AI coding agent edits this project.
82
82
  - If the app uses `ai` or `@ai-sdk/react` for product code outside Geistdocs, migrate that app code separately or let the package manager install separate versions. Do not downgrade Geistdocs Ask AI to match unrelated app code.
83
83
  - Set `GEISTDOCS_CHAT_PROXY_URL` only when Ask AI should route through the central Vertex-backed proxy. The value must include the `/vertex` route, such as `https://<geistdocs-platform-deployment>/vertex`.
84
84
  - Do not add Vertex credentials to a Geistdocs site. The central platform proxy forwards the Vercel OIDC token in `x-vercel-trusted-oidc-idp-token`; the Vertex deployment should trust the platform Vercel project through Deployment Protection Trusted Sources.
85
- - Use `GEISTDOCS_CHAT_PROXY_TOKEN` only for a custom proxy that requires bearer authentication. The default Geistdocs platform `/vertex` proxy does not require it.
85
+ - Set the server-only `GEISTDOCS_CHAT_PROXY_TOKEN` when using the Geistdocs platform `/vertex` proxy. Its value must match the platform deployment's `GEISTDOCS_VERTEX_PROXY_TOKEN`, which must contain at least 32 bytes. Never expose either token with a `NEXT_PUBLIC_` prefix.
86
86
  - Keep `app/api/chat/route.ts` as a thin adapter around `createChatRoute`. Prefer configuring `GEISTDOCS_CHAT_PROXY_URL` and `GEISTDOCS_CHAT_PROXY_TOKEN` over forking the package chat route.
87
87
  - If custom chat client code uses `DefaultChatTransport.prepareSendMessagesRequest`, preserve `messages` in the returned `body` when adding fields such as `currentRoute`. Returning a custom `body` replaces the AI SDK default request body.
88
88
 
@@ -50,6 +50,7 @@ Once open, users can:
50
50
  - Ask questions about any part of your documentation
51
51
  - View the documentation pages used as sources for each answer
52
52
  - Copy an answer as Markdown
53
+ - Expand the desktop panel to fill the viewport
53
54
  - Get step-by-step guidance on complex topics
54
55
 
55
56
  ## Control Ask AI from your own components
@@ -303,20 +304,22 @@ The `model` option only applies in AI Gateway mode. In proxy mode, the Vertex-ba
303
304
  Use proxy mode when Ask AI should route model requests through a central Vertex-backed service instead of calling AI Gateway from each site.
304
305
 
305
306
  1. Deploy or use the central Geistdocs platform proxy that exposes `POST /vertex`.
306
- 2. Configure the Vertex deployment to trust the Geistdocs platform Vercel project with Deployment Protection Trusted Sources.
307
- 3. Set `GEISTDOCS_CHAT_PROXY_URL` on the Geistdocs site to the platform proxy URL, including `/vertex`:
307
+ 2. Generate a random token containing at least 32 bytes with `openssl rand -base64 32`.
308
+ 3. Set the token as `GEISTDOCS_VERTEX_PROXY_TOKEN` on the platform proxy deployment.
309
+ 4. Configure the Vertex deployment to trust the Geistdocs platform Vercel project with Deployment Protection Trusted Sources.
310
+ 5. Set `GEISTDOCS_CHAT_PROXY_URL` on the Geistdocs site to the platform proxy URL, including `/vertex`:
308
311
 
309
312
  ```txt
310
313
  https://<geistdocs-platform-deployment>/vertex
311
314
  ```
312
315
 
313
- 4. Leave `GEISTDOCS_CHAT_PROXY_TOKEN` unset unless you are using a custom proxy that requires bearer authentication.
316
+ 6. Set the same token as `GEISTDOCS_CHAT_PROXY_TOKEN` on the Geistdocs site.
314
317
 
315
318
  When `GEISTDOCS_CHAT_PROXY_URL` is set, Geistdocs searches local docs on the first user message, injects the attached page (or the current page when no page is attached) and related docs into the final user message, forwards `{ messages, platform: "vercel" }` to the proxy, and streams the AI SDK UI stream response back to the browser. Set [`contextInjection: "page-only"`](#choose-what-context-the-proxy-or-agent-receives) to forward messages as sent and inline only a page the reader attaches.
316
319
 
317
320
  The proxy request also carries the reader's `x-client-ja4` and `x-client-ip` values, read from the incoming `x-vercel-ja4-digest` and `x-forwarded-for` headers, unless `proxy.headers` sets them. `proxy.headers` accepts a static object or a function that receives the incoming chat `Request`; see [Forward per-request values in upstream headers](#forward-per-request-values-in-upstream-headers).
318
321
 
319
- The platform proxy forwards a Vercel OIDC token to Vertex in the `x-vercel-trusted-oidc-idp-token` header. The Vertex deployment should validate the caller through Trusted Sources; the Geistdocs site does not need a Vertex API key.
322
+ The Geistdocs site authenticates to the platform proxy with the server-only bearer token. The platform proxy forwards a Vercel OIDC token to Vertex in the `x-vercel-trusted-oidc-idp-token` header. The Vertex deployment should validate the caller through Trusted Sources; the Geistdocs site does not need a Vertex API key.
320
323
 
321
324
  ### Hosted eve agent mode
322
325
 
@@ -639,6 +642,8 @@ export const { POST, maxDuration } = createChatRoute({
639
642
  });
640
643
  ```
641
644
 
645
+ In Vertex-backed proxy mode, the platform `/vertex` route also limits requests to 1,000,000 bytes and 200 messages. Increasing `maxRequestBytes` or `maxMessages` above those values does not raise the platform limits.
646
+
642
647
  Request size limits don't control how often a client can call the route. `/api/chat` is public, and every accepted request calls a model or agent on your account, so wrap the route with your own rate limiting. For example, install `@vercel/firewall`, create a [Firewall rate limit rule](https://vercel.com/docs/vercel-firewall/vercel-waf/rate-limiting-sdk) with the rate limit ID `ask-ai`, and check it before calling `POST`:
643
648
 
644
649
  ```ts title="app/api/chat/route.ts"
@@ -720,8 +725,8 @@ Ask AI accepts text questions only. It does not support file or image attachment
720
725
 
721
726
  The chat interface adapts to different screen sizes:
722
727
 
723
- - **Desktop**: Slides in from the right side as a sidebar panel
724
- - **Mobile**: Opens as a bottom drawer.
728
+ - **Desktop**: Slides in from the right side as a sidebar panel. Select **Expand chat** in the panel header to fill the viewport, which gives long answers and code blocks more width without losing the conversation. Select **Collapse chat** or press `Escape` to return to the sidebar. Closing the chat also returns it to the sidebar, so the next open starts there.
729
+ - **Mobile**: Opens as a bottom drawer. The drawer has no expanded view.
725
730
 
726
731
  ## Configuration
727
732
 
@@ -72,9 +72,11 @@ To deploy from the Vercel dashboard:
72
72
 
73
73
  If your site routes Ask AI through the central Vertex-backed proxy, configure both the Geistdocs site and the Vertex deployment before testing production chat.
74
74
 
75
- 1. Set `GEISTDOCS_CHAT_PROXY_URL` on the Geistdocs site to the platform proxy URL, including `/vertex`.
76
- 2. Leave `GEISTDOCS_CHAT_PROXY_TOKEN` unset unless your proxy requires bearer authentication.
77
- 3. Add the Geistdocs platform Vercel project as a Trusted Source in the Vertex deployment's Deployment Protection settings.
78
- 4. Confirm the platform proxy can forward the Vercel OIDC token to Vertex in `x-vercel-trusted-oidc-idp-token`.
79
-
80
- The Geistdocs site does not need Vertex credentials. The platform proxy authenticates to Vertex with Vercel OIDC and Trusted Sources.
75
+ 1. Generate a random token containing at least 32 bytes with `openssl rand -base64 32`.
76
+ 2. Set the token as `GEISTDOCS_VERTEX_PROXY_TOKEN` on the platform proxy deployment.
77
+ 3. Set `GEISTDOCS_CHAT_PROXY_URL` on the Geistdocs site to the platform proxy URL, including `/vertex`.
78
+ 4. Set the same token as `GEISTDOCS_CHAT_PROXY_TOKEN` on the Geistdocs site.
79
+ 5. Add the Geistdocs platform Vercel project as a Trusted Source in the Vertex deployment's Deployment Protection settings.
80
+ 6. Confirm the platform proxy can forward the Vercel OIDC token to Vertex in `x-vercel-trusted-oidc-idp-token`.
81
+
82
+ The Geistdocs site does not need Vertex credentials. The site authenticates to the platform proxy with the shared bearer token, and the platform proxy authenticates to Vertex with Vercel OIDC and Trusted Sources.
@@ -12,8 +12,8 @@ related:
12
12
 
13
13
  Geistdocs uses environment variables to configure Ask AI, optional Mixedbread retrieval, optional Vertex-backed proxy mode, eve agent session cookie signing, and production URL behavior.
14
14
 
15
- <CopyPrompt text="Review this Geistdocs project and help me configure the required environment variables. Check whether AI_GATEWAY_API_KEY, MXBAI_API_KEY, MXBAI_STORE_ID, GEISTDOCS_CHAT_PROXY_URL, GEISTDOCS_CHAT_SECRET, and NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL are needed for the features I enabled, then tell me where to set them locally and on Vercel.">
16
- Review this Geistdocs project and help me configure the required environment variables. Check whether `AI_GATEWAY_API_KEY`, `MXBAI_API_KEY`, `MXBAI_STORE_ID`, `GEISTDOCS_CHAT_PROXY_URL`, `GEISTDOCS_CHAT_SECRET`, and `NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL` are needed for the features I enabled, then tell me where to set them locally and on Vercel.
15
+ <CopyPrompt text="Review this Geistdocs project and help me configure the required environment variables. Check whether AI_GATEWAY_API_KEY, MXBAI_API_KEY, MXBAI_STORE_ID, GEISTDOCS_CHAT_PROXY_URL, GEISTDOCS_CHAT_PROXY_TOKEN, GEISTDOCS_CHAT_SECRET, and NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL are needed for the features I enabled, then tell me where to set them locally and on Vercel.">
16
+ Review this Geistdocs project and help me configure the required environment variables. Check whether `AI_GATEWAY_API_KEY`, `MXBAI_API_KEY`, `MXBAI_STORE_ID`, `GEISTDOCS_CHAT_PROXY_URL`, `GEISTDOCS_CHAT_PROXY_TOKEN`, `GEISTDOCS_CHAT_SECRET`, and `NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL` are needed for the features I enabled, then tell me where to set them locally and on Vercel.
17
17
  </CopyPrompt>
18
18
 
19
19
  ## `AI_GATEWAY_API_KEY`
@@ -48,20 +48,27 @@ When this variable is set, the site does not need `AI_GATEWAY_API_KEY` for Ask A
48
48
 
49
49
  ## `GEISTDOCS_CHAT_PROXY_TOKEN`
50
50
 
51
- An optional bearer token for the chat proxy. Only set this if your proxy requires an `Authorization` header.
51
+ The server-only bearer token that authenticates a Geistdocs site to its chat proxy. The central Geistdocs platform proxy requires this value.
52
52
 
53
- The default Geistdocs platform `/vertex` proxy uses Vercel OIDC and Trusted Sources, so it does not require this token.
53
+ Generate a random token containing at least 32 bytes:
54
+
55
+ ```bash title="Terminal"
56
+ openssl rand -base64 32
57
+ ```
58
+
59
+ Set the generated value as `GEISTDOCS_CHAT_PROXY_TOKEN` on each approved Geistdocs site and as `GEISTDOCS_VERTEX_PROXY_TOKEN` on the platform proxy deployment. Never expose either value with a `NEXT_PUBLIC_` prefix.
54
60
 
55
61
  ## Vertex-backed proxy setup
56
62
 
57
63
  To route Ask AI through Vertex:
58
64
 
59
- 1. Use or deploy the central Geistdocs platform proxy with its `/vertex` route.
60
- 2. In the Vertex deployment's Deployment Protection settings, add the Geistdocs platform Vercel project as a Trusted Source.
61
- 3. In each Geistdocs site that should use Vertex, set `GEISTDOCS_CHAT_PROXY_URL` to the platform proxy URL, including `/vertex`.
62
- 4. Leave `GEISTDOCS_CHAT_PROXY_TOKEN` unset unless you replace the platform proxy with a custom bearer-authenticated proxy.
65
+ 1. Generate a random token with `openssl rand -base64 32`.
66
+ 2. Set the token as `GEISTDOCS_VERTEX_PROXY_TOKEN` on the platform proxy deployment.
67
+ 3. In the Vertex deployment's Deployment Protection settings, add the Geistdocs platform Vercel project as a Trusted Source.
68
+ 4. In each approved Geistdocs site, set `GEISTDOCS_CHAT_PROXY_URL` to the platform proxy URL, including `/vertex`.
69
+ 5. Set the same token as `GEISTDOCS_CHAT_PROXY_TOKEN` on each approved Geistdocs site.
63
70
 
64
- The Vertex deployment does not need a Geistdocs-specific environment variable. Access is controlled by Trusted Sources and the OIDC token forwarded by the platform proxy.
71
+ The bearer token authenticates each Geistdocs site to the platform proxy. The platform proxy then authenticates to Vertex with Vercel OIDC and Trusted Sources. The `/vertex` route accepts request bodies up to 1,000,000 bytes, up to 200 messages, and only `platform: "vercel"`.
65
72
 
66
73
  ## `GEISTDOCS_CHAT_SECRET`
67
74
 
@@ -17,7 +17,7 @@
17
17
  "@streamdown/code": "^1.0.1",
18
18
  "@vercel/agent-readability": "^0.7.0",
19
19
  "@vercel/analytics": "^1.6.1",
20
- "@vercel/geistdocs": "2.8.0",
20
+ "@vercel/geistdocs": "2.9.1",
21
21
  "@vercel/speed-insights": "^1.3.1",
22
22
  "ai": "^6.0.132",
23
23
  "clsx": "^2.1.1",