@vercel/geistdocs 2.7.10 → 2.8.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.
- package/dist/assets/icons/icon-thumb-down.d.ts +26 -0
- package/dist/assets/icons/icon-thumb-down.d.ts.map +1 -0
- package/dist/assets/icons/icon-thumb-down.js +25 -0
- package/dist/assets/icons/index.d.ts +1 -0
- package/dist/assets/icons/index.d.ts.map +1 -1
- package/dist/assets/icons/index.js +1 -0
- package/dist/cli/index.js +1 -1
- package/dist/config.d.ts +67 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/controls.d.ts +23 -1
- package/dist/controls.d.ts.map +1 -1
- package/dist/controls.js +44 -3
- package/dist/footer.js +1 -1
- package/dist/internal/chat/activity.d.ts +5 -1
- package/dist/internal/chat/activity.d.ts.map +1 -1
- package/dist/internal/chat/activity.js +11 -4
- package/dist/internal/chat/chat-user.d.ts +12 -0
- package/dist/internal/chat/chat-user.d.ts.map +1 -0
- package/dist/internal/chat/chat-user.js +27 -0
- package/dist/internal/chat/commands.d.ts +91 -0
- package/dist/internal/chat/commands.d.ts.map +1 -0
- package/dist/internal/chat/commands.js +165 -0
- package/dist/internal/chat/context.d.ts +46 -2
- package/dist/internal/chat/context.d.ts.map +1 -1
- package/dist/internal/chat/context.js +50 -4
- package/dist/internal/chat/message-actions.d.ts +15 -0
- package/dist/internal/chat/message-actions.d.ts.map +1 -0
- package/dist/internal/chat/message-actions.js +113 -0
- package/dist/internal/chat/message-feedback.d.ts +68 -0
- package/dist/internal/chat/message-feedback.d.ts.map +1 -0
- package/dist/internal/chat/message-feedback.js +188 -0
- package/dist/internal/chat/message-metadata.d.ts.map +1 -1
- package/dist/internal/chat/message-metadata.js +7 -1
- package/dist/internal/chat/message-text.d.ts +9 -0
- package/dist/internal/chat/message-text.d.ts.map +1 -0
- package/dist/internal/chat/message-text.js +15 -0
- package/dist/internal/chat/message.d.ts +4 -2
- package/dist/internal/chat/message.d.ts.map +1 -1
- package/dist/internal/chat/message.js +8 -1
- package/dist/internal/chat/options.d.ts +94 -0
- package/dist/internal/chat/options.d.ts.map +1 -0
- package/dist/internal/chat/options.js +171 -0
- package/dist/internal/chat/page-attachment.d.ts +12 -0
- package/dist/internal/chat/page-attachment.d.ts.map +1 -0
- package/dist/internal/chat/page-attachment.js +18 -0
- package/dist/internal/chat/session-provider.d.ts +33 -0
- package/dist/internal/chat/session-provider.d.ts.map +1 -0
- package/dist/internal/chat/session-provider.js +138 -0
- package/dist/internal/chat/session.d.ts +60 -0
- package/dist/internal/chat/session.d.ts.map +1 -0
- package/dist/internal/chat/session.js +85 -0
- package/dist/internal/chat/shell.d.ts.map +1 -1
- package/dist/internal/chat/shell.js +81 -157
- package/dist/internal/chat/use-chat-commands.d.ts +28 -0
- package/dist/internal/chat/use-chat-commands.d.ts.map +1 -0
- package/dist/internal/chat/use-chat-commands.js +62 -0
- package/dist/internal/chat/user-avatar.d.ts +7 -0
- package/dist/internal/chat/user-avatar.d.ts.map +1 -0
- package/dist/internal/chat/user-avatar.js +27 -0
- package/dist/internal/eve-agent-session-cookie.d.ts +68 -0
- package/dist/internal/eve-agent-session-cookie.d.ts.map +1 -0
- package/dist/internal/eve-agent-session-cookie.js +164 -0
- package/dist/internal/eve-agent-session.d.ts +9 -7
- package/dist/internal/eve-agent-session.d.ts.map +1 -1
- package/dist/internal/eve-agent-session.js +10 -13
- package/dist/internal/eve-agent.d.ts +96 -24
- package/dist/internal/eve-agent.d.ts.map +1 -1
- package/dist/internal/eve-agent.js +74 -51
- package/dist/internal/feedback-action.d.ts +14 -0
- package/dist/internal/feedback-action.d.ts.map +1 -1
- package/dist/internal/feedback-action.js +37 -5
- package/dist/internal/page-actions-client.d.ts +9 -0
- package/dist/internal/page-actions-client.d.ts.map +1 -1
- package/dist/internal/page-actions-client.js +8 -4
- package/dist/internal/provider-client.d.ts.map +1 -1
- package/dist/internal/provider-client.js +2 -2
- package/dist/internal/use-mobile.d.ts +7 -0
- package/dist/internal/use-mobile.d.ts.map +1 -1
- package/dist/internal/use-mobile.js +17 -1
- package/dist/internal/webmcp-client.d.ts.map +1 -1
- package/dist/internal/webmcp-client.js +13 -3
- package/dist/internal/webmcp.d.ts +5 -1
- package/dist/internal/webmcp.d.ts.map +1 -1
- package/dist/internal/webmcp.js +31 -1
- package/dist/pages/changelog.d.ts.map +1 -1
- package/dist/pages/changelog.js +4 -0
- package/dist/pages/docs.d.ts.map +1 -1
- package/dist/pages/docs.js +2 -0
- package/dist/routes/chat.d.ts +83 -5
- package/dist/routes/chat.d.ts.map +1 -1
- package/dist/routes/chat.js +517 -80
- package/dist/routes/discovery.d.ts +1 -1
- package/dist/routes/discovery.d.ts.map +1 -1
- package/dist/routes/discovery.js +7 -11
- package/dist/routes/openapi.d.ts.map +1 -1
- package/dist/routes/openapi.js +47 -25
- package/docs/agents.md +3 -3
- package/docs/llms.txt +631 -35
- package/docs/manifest.json +3 -3
- package/docs/pages/agent-readiness.md +1 -1
- package/docs/pages/ask-ai.md +567 -24
- package/docs/pages/configuration.md +21 -1
- package/docs/pages/env.md +17 -3
- package/docs/pages/feedback.md +4 -0
- package/docs/pages/webmcp.md +18 -3
- package/docs/sitemap.md +1 -1
- package/package.json +1 -2
- package/template/.env.example +5 -0
- package/template/AGENTS.md +2 -0
- package/template/content/docs/agent-readiness.mdx +1 -1
- package/template/content/docs/ask-ai.cn.mdx +466 -15
- package/template/content/docs/ask-ai.mdx +567 -24
- package/template/content/docs/configuration.cn.mdx +39 -0
- package/template/content/docs/configuration.mdx +21 -1
- package/template/content/docs/env.cn.mdx +15 -1
- package/template/content/docs/env.mdx +18 -4
- package/template/content/docs/feedback.cn.mdx +4 -0
- package/template/content/docs/feedback.mdx +4 -0
- package/template/content/docs/webmcp.mdx +18 -3
- package/template/package.json +1 -2
|
@@ -107,6 +107,45 @@ export const suggestions = [
|
|
|
107
107
|
];
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
+
每个建议可以是字符串,也可以是包含 `text` 和可选 `icon` 的对象。字符串建议不显示图标。`icon` 字段接受任何 React 元素,例如内联 SVG 组件。Ask AI 最多显示前四个不重复且非空的建议:
|
|
111
|
+
|
|
112
|
+
```tsx title="geistdocs.tsx"
|
|
113
|
+
const RocketIcon = () => (
|
|
114
|
+
<svg aria-hidden="true" fill="none" height="16" viewBox="0 0 16 16" width="16">
|
|
115
|
+
<path d="M8 1.5c2.5 1.5 3.5 4 3.5 6.5L8 12 4.5 8c0-2.5 1-5 3.5-6.5Z" stroke="currentColor" />
|
|
116
|
+
</svg>
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
export const suggestions = [
|
|
120
|
+
"How do I get started?",
|
|
121
|
+
{ text: "How do I deploy my site?", icon: <RocketIcon /> },
|
|
122
|
+
];
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### `ai`
|
|
126
|
+
|
|
127
|
+
`ai` 配置还控制聊天面板及其路由:
|
|
128
|
+
|
|
129
|
+
| 选项 | 类型 | 默认值 | 说明 |
|
|
130
|
+
| ----------------------- | --------------------------------------------------- | ------------- | ------------------------------------------------------------------------ |
|
|
131
|
+
| `endpoint` | `string` | `"/api/chat"` | 聊天路由的应用内路径。`basePath` 会自动添加。无效路径会抛出错误。 |
|
|
132
|
+
| `title` | `string` | `"Ask AI"` | 聊天面板的标题和无障碍标签。 |
|
|
133
|
+
| `suggestions` | `(string \| { text: string; icon?: ReactNode })[]` | `[]` | 建议的提示。 |
|
|
134
|
+
| `history.retentionDays` | `number` | `30` | 对话在最近一条消息之后保留的天数。`0` 表示不保存历史,`Infinity` 表示永不过期。 |
|
|
135
|
+
| `messageFeedback` | `boolean` | `false` | 在已完成的回答上显示"赞"和"踩"按钮,并将投票发送到 Geistdocs 反馈服务。 |
|
|
136
|
+
| `toolLabels` | `Record<string, string>` | `{}` | 指定工具运行时显示的活动标签,例如 `{ web_search: "Searching..." }`。其他工具显示 `Running <工具名>...`。 |
|
|
137
|
+
|
|
138
|
+
```tsx title="geistdocs.tsx"
|
|
139
|
+
export const ai = {
|
|
140
|
+
endpoint: "/api/ai-chat",
|
|
141
|
+
title: "Ask Acme AI",
|
|
142
|
+
history: { retentionDays: 7 },
|
|
143
|
+
messageFeedback: true,
|
|
144
|
+
};
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
详情请参阅 [向 AI 提问](/docs/ask-ai)。
|
|
148
|
+
|
|
110
149
|
### `title`
|
|
111
150
|
|
|
112
151
|
设置文档站点的主标题:
|
|
@@ -207,7 +207,27 @@ export const ai = {
|
|
|
207
207
|
|
|
208
208
|
Set `eveAgent.prewarm` only when the agent runs eve 0.59 or newer and allocating an empty durable session as Ask AI loads is appropriate for the site.
|
|
209
209
|
|
|
210
|
-
|
|
210
|
+
The `ai` config also controls the chat panel and its route:
|
|
211
|
+
|
|
212
|
+
| Option | Type | Default | Description |
|
|
213
|
+
| ------------------------ | --------------------------------------------------- | ------------- | ------------------------------------------------------------------------------------------------- |
|
|
214
|
+
| `endpoint` | `string` | `"/api/chat"` | App-local path of the chat route. `basePath` is added automatically. Invalid paths throw. |
|
|
215
|
+
| `title` | `string` | `"Ask AI"` | Chat panel heading and accessible label. |
|
|
216
|
+
| `suggestions` | `(string \| { text: string; icon?: ReactNode })[]` | `[]` | Suggested prompts. The first four distinct prompts are shown, and strings render without an icon. |
|
|
217
|
+
| `history.retentionDays` | `number` | `30` | Days a stored conversation is kept after its most recent message. `0` stores no history, and `Infinity` never expires it. |
|
|
218
|
+
| `messageFeedback` | `boolean` | `false` | Show thumbs up and thumbs down buttons on finished answers and send votes to the Geistdocs feedback service. |
|
|
219
|
+
| `toolLabels` | `Record<string, string>` | `{}` | Activity label shown while a named tool runs, such as `{ web_search: "Searching..." }`. Other tools show `Running <tool name>...`. |
|
|
220
|
+
|
|
221
|
+
```tsx title="geistdocs.tsx"
|
|
222
|
+
export const ai = {
|
|
223
|
+
endpoint: "/api/ai-chat",
|
|
224
|
+
title: "Ask Acme AI",
|
|
225
|
+
history: { retentionDays: 7 },
|
|
226
|
+
messageFeedback: true,
|
|
227
|
+
};
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
See [Ask AI](/docs/ask-ai) for the full eve agent mode behavior, including authentication, for moving the chat route adapter when you set `endpoint`, for what a `messageFeedback` vote sends, and for matching a production Vertex or eve setup with `toolLabels` and the server-only `createChatRoute` options. Read [Improve Ask AI answers with Mixedbread](/docs/mixedbread-retrieval) before enabling semantic retrieval.
|
|
211
231
|
|
|
212
232
|
Use [Versioned docs](/docs/versioned-docs) for versioned source setup and [Proxy and markdown routes](/docs/proxy) for route mappings.
|
|
213
233
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: 环境变量
|
|
3
3
|
description: 了解 Geistdocs 中使用的环境变量
|
|
4
4
|
type: reference
|
|
5
|
-
summary: Geistdocs 所需的 AI
|
|
5
|
+
summary: Geistdocs 所需的 AI 聊天、eve 智能体会话 Cookie 签名和生产 URL 配置环境变量。
|
|
6
6
|
prerequisites:
|
|
7
7
|
- /docs/getting-started
|
|
8
8
|
related:
|
|
@@ -18,6 +18,20 @@ AI 网关的 API 密钥。用于驱动 AI 聊天功能。
|
|
|
18
18
|
|
|
19
19
|
<Callout>部署到 Vercel 时会自动设置此项。</Callout>
|
|
20
20
|
|
|
21
|
+
## `GEISTDOCS_CHAT_SECRET`
|
|
22
|
+
|
|
23
|
+
仅在服务器端使用的密钥,用于对把读者浏览器绑定到其 eve 智能体会话的 httpOnly Cookie 进行签名。配置 `ai.eveAgent` 时请设置此项,这样向 AI 提问才能在多轮对话中沿用同一个 eve 会话,并支持会话预热。聊天路由只会访问由能通过该密钥验证的 Cookie 所指向的会话,因此读者无法让聊天路由访问其他读者的 eve 会话,页面脚本也无法读取会话 ID。
|
|
24
|
+
|
|
25
|
+
密钥长度至少为 32 字节。可以使用以下命令生成:
|
|
26
|
+
|
|
27
|
+
```bash title="Terminal"
|
|
28
|
+
openssl rand -base64 32
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
将其添加到站点 Vercel 项目的 Production 和 Preview 环境变量中,并在本地开发时添加到 `.env.local`。每个文档站点使用单独的密钥。已有的 base64 编码 32 字节密钥(44 个字符)同样可以使用,因为 Geistdocs 会按原样使用该值,并使用自己带版本号的前缀进行签名。轮换密钥会使现有的会话 Cookie 失效,每位读者的下一条消息会创建新的 eve 会话并内联其对话内容。
|
|
32
|
+
|
|
33
|
+
未设置此变量时,eve 智能体模式会在每一轮对话中创建新的 eve 会话并内联之前的对话内容,拒绝预热请求,并在服务器日志中输出警告。长度不足 32 字节的值会在聊天路由加载时抛出错误。也可以通过 `createChatRoute` 的 `eveAgent.secret` 选项提供密钥。不要为其添加 `NEXT_PUBLIC_` 前缀,也不要将其写入 `geistdocs.tsx`。
|
|
34
|
+
|
|
21
35
|
## `NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL`
|
|
22
36
|
|
|
23
37
|
Geistdocs 站点的生产环境 URL。部署到 Vercel 时会自动设置此项。
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: Environment Variables
|
|
3
3
|
description: Learn about the environment variables used in Geistdocs
|
|
4
4
|
type: reference
|
|
5
|
-
summary: Environment variables required by Geistdocs for AI chat, Mixedbread retrieval, proxy mode, and production URL configuration.
|
|
5
|
+
summary: Environment variables required by Geistdocs for AI chat, Mixedbread retrieval, proxy mode, eve agent session cookies, and production URL configuration.
|
|
6
6
|
prerequisites:
|
|
7
7
|
- /docs/getting-started
|
|
8
8
|
related:
|
|
@@ -10,10 +10,10 @@ related:
|
|
|
10
10
|
- /docs/deployment
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
Geistdocs uses environment variables to configure Ask AI, optional Mixedbread retrieval, optional Vertex-backed proxy mode, and production URL behavior.
|
|
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, 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`, 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_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.
|
|
17
17
|
</CopyPrompt>
|
|
18
18
|
|
|
19
19
|
## `AI_GATEWAY_API_KEY`
|
|
@@ -63,6 +63,20 @@ To route Ask AI through Vertex:
|
|
|
63
63
|
|
|
64
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.
|
|
65
65
|
|
|
66
|
+
## `GEISTDOCS_CHAT_SECRET`
|
|
67
|
+
|
|
68
|
+
A server-only secret that signs the httpOnly cookie binding each reader's browser to its eve agent session. Set it when `ai.eveAgent` is configured so Ask AI can continue one eve session across turns and prewarm sessions. The chat route only contacts a session named by a cookie that verifies with this secret, so a reader can't point the chat route at another reader's eve session, and page scripts can't read the session ID.
|
|
69
|
+
|
|
70
|
+
The secret must be at least 32 bytes. Generate one with:
|
|
71
|
+
|
|
72
|
+
```bash title="Terminal"
|
|
73
|
+
openssl rand -base64 32
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Add it to your site's Vercel project environment variables for the Production and Preview environments, and to `.env.local` for local development. Use a separate secret for each docs site. An existing base64-encoded 32-byte secret (44 characters) also works, because Geistdocs uses the value as-is and signs with its own versioned prefix. Rotating the secret invalidates existing session cookies, so each reader's next message starts a new eve session with the conversation inlined.
|
|
77
|
+
|
|
78
|
+
Without this variable, eve agent mode starts a new eve session on every turn with the prior conversation inlined, refuses prewarm requests, and logs a warning. A value shorter than 32 bytes throws when the chat route loads. Pass the `eveAgent.secret` option to `createChatRoute` to supply the secret another way. Never expose it with a `NEXT_PUBLIC_` prefix or put it in `geistdocs.tsx`. Read [Ask AI](/docs/ask-ai#keep-eve-sessions-across-turns-with-geistdocs_chat_secret) for the full behavior.
|
|
79
|
+
|
|
66
80
|
## `NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL`
|
|
67
81
|
|
|
68
82
|
The production URL of the Geistdocs site. Geistdocs uses it for canonical and Open Graph metadata, product JSON-LD, `sitemap.xml`, `robots.txt`, and RSS links. Vercel sets this variable automatically.
|
|
@@ -32,6 +32,10 @@ related:
|
|
|
32
32
|
|
|
33
33
|
每条反馈都会创建一个单独的 issue,便于单独跟踪和解决。
|
|
34
34
|
|
|
35
|
+
### 对 Ask AI 回答的反馈
|
|
36
|
+
|
|
37
|
+
启用 `ai.messageFeedback` 后,读者可以对每个 Ask AI 回答点"赞"或"踩"。Ask AI 回答的投票会发送到同一个反馈服务,并使用相同的 `siteId` 标签。每次投票都会创建一个带有 `thumbs-up` 或 `thumbs-down` 标签的 issue,其 note 以 `[Ask AI]` 开头,便于区分回答反馈和页面反馈。由于 Ask AI 不会询问原因,"踩"的 issue 还会带有 `reason-empty` 标签。每次投票发送的字段请参阅[向 AI 提问](/docs/ask-ai)中的“收集对回答的反馈”一节。
|
|
38
|
+
|
|
35
39
|
## 反馈架构
|
|
36
40
|
|
|
37
41
|
API 接受以下字段:
|
|
@@ -36,6 +36,10 @@ When feedback is submitted:
|
|
|
36
36
|
|
|
37
37
|
Each piece of feedback creates a separate issue, allowing for individual tracking and resolution.
|
|
38
38
|
|
|
39
|
+
### Feedback on Ask AI answers
|
|
40
|
+
|
|
41
|
+
When `ai.messageFeedback` is enabled, readers can rate each Ask AI answer with a thumbs up or thumbs down. Ask AI answer votes go to the same feedback service with the same `siteId` label. Each answer vote creates an issue labeled `thumbs-up` or `thumbs-down`, and its note starts with `[Ask AI]` so you can tell answer feedback from page feedback. Thumbs-down issues also get the `reason-empty` label because Ask AI doesn't ask for a reason. Read [Collect feedback on answers](/docs/ask-ai#collect-feedback-on-answers) for the fields each vote sends.
|
|
42
|
+
|
|
39
43
|
## Feedback Schema
|
|
40
44
|
|
|
41
45
|
The API accepts the following fields:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: WebMCP
|
|
3
|
-
description: Expose documentation search
|
|
3
|
+
description: Expose documentation search, page reading, and Ask AI to browser agents.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
Geistdocs uses [mcp-handler's WebMCP bridge](https://github.com/vercel/mcp-handler/blob/main/docs/WEBMCP.md) for search and
|
|
6
|
+
Geistdocs uses [mcp-handler's WebMCP bridge](https://github.com/vercel/mcp-handler/blob/main/docs/WEBMCP.md) for search, and browser-local tools for reading the current page and, optionally, asking the site's Ask AI chat. Enable `webmcp: { enabled: true }` in `lib/geistdocs/config.tsx` and add `app/api/mcp/route.ts`:
|
|
7
7
|
|
|
8
8
|
```ts
|
|
9
9
|
import { createMcpRoute } from "@vercel/geistdocs/routes/mcp";
|
|
@@ -23,10 +23,23 @@ The canonical template includes this setup. Existing consumers must add the rout
|
|
|
23
23
|
| --- | --- | --- |
|
|
24
24
|
| `search_docs` | Nonblank `query` up to 500 characters; optional configured `locale` | MCP result containing search results as JSON text |
|
|
25
25
|
| `read_current_page` | None | Current page as Markdown |
|
|
26
|
+
| `ask_ai` | `question` of 2 to 2,000 characters after trimming whitespace | Confirmation that the question was submitted to the site's Ask AI chat |
|
|
26
27
|
|
|
27
28
|
The provider loads `/api/mcp?webmcp-script` once through `next/script`. The script discovers the MCP server's tools and registers only `search_docs`. Do not add another copy of the script or register search yourself. Remote MCP clients connect to `/api/mcp` directly. Geistdocs prefixes public paths with `basePath`.
|
|
28
29
|
|
|
29
|
-
Search calls the supplied search handler directly, retaining its visibility filters and request headers/cookies without another network hop. Pass `locale` explicitly for translated results; omitting it selects `defaultLanguage`, even after navigating to another language.
|
|
30
|
+
Search calls the supplied search handler directly, retaining its visibility filters and request headers/cookies without another network hop. Pass `locale` explicitly for translated results; omitting it selects `defaultLanguage`, even after navigating to another language. `search_docs` and `read_current_page` don't modify documentation or send it to an external model.
|
|
31
|
+
|
|
32
|
+
## Let browser agents ask Ask AI
|
|
33
|
+
|
|
34
|
+
`ask_ai` is opt-in. Set `webmcp.askAI` to `true` to register it when Ask AI is enabled:
|
|
35
|
+
|
|
36
|
+
```tsx title="lib/geistdocs/config.tsx"
|
|
37
|
+
webmcp: { enabled: true, askAI: true },
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`ask_ai` opens the site's Ask AI chat and submits the question as a user message, the same way the `ask` action from [`useGeistdocsChat`](/docs/ask-ai#control-ask-ai-from-your-own-components) does. The tool returns as soon as the question is queued and doesn't return the answer, which streams into the chat panel on the page. Questions sent while a response is streaming wait for it to finish. The tool rejects a missing `question`, or one shorter than 2 or longer than 2,000 characters after trimming whitespace, without opening the chat.
|
|
41
|
+
|
|
42
|
+
`ask_ai` isn't registered when `webmcp.askAI` is unset, when `ai.enabled` is `false`, or when `webmcp.enabled` is `false`. Unlike the read-only tools, `ask_ai` sets `readOnlyHint: false` because it changes the page and sends the question to your Ask AI model or agent, which counts toward your usage. Like `read_current_page`, it runs in the browser and isn't part of the `/api/mcp` server, so remote MCP clients and the `?webmcp-script` bridge don't list it.
|
|
30
43
|
|
|
31
44
|
## Lifecycle and safety
|
|
32
45
|
|
|
@@ -51,6 +64,8 @@ agent-browser --session docs-check open http://localhost:3000/docs
|
|
|
51
64
|
agent-browser --session docs-check webmcp list
|
|
52
65
|
agent-browser --session docs-check webmcp invoke search_docs --params '{"query":"configuration","locale":"en"}'
|
|
53
66
|
agent-browser --session docs-check webmcp invoke read_current_page --params '{}'
|
|
67
|
+
# Requires webmcp.askAI: true
|
|
68
|
+
agent-browser --session docs-check webmcp invoke ask_ai --params '{"question":"How do I configure search?"}'
|
|
54
69
|
agent-browser --session docs-check close
|
|
55
70
|
```
|
|
56
71
|
|
package/template/package.json
CHANGED
|
@@ -17,13 +17,12 @@
|
|
|
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.
|
|
20
|
+
"@vercel/geistdocs": "2.8.0",
|
|
21
21
|
"@vercel/speed-insights": "^1.3.1",
|
|
22
22
|
"ai": "^6.0.132",
|
|
23
23
|
"clsx": "^2.1.1",
|
|
24
24
|
"cmdk": "^1.1.1",
|
|
25
25
|
"dexie": "^4.2.1",
|
|
26
|
-
"dexie-react-hooks": "^4.2.0",
|
|
27
26
|
"feed": "^5.1.0",
|
|
28
27
|
"fumadocs-core": "16.2.2",
|
|
29
28
|
"fumadocs-mdx": "14.0.4",
|