@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.
Files changed (120) hide show
  1. package/dist/assets/icons/icon-thumb-down.d.ts +26 -0
  2. package/dist/assets/icons/icon-thumb-down.d.ts.map +1 -0
  3. package/dist/assets/icons/icon-thumb-down.js +25 -0
  4. package/dist/assets/icons/index.d.ts +1 -0
  5. package/dist/assets/icons/index.d.ts.map +1 -1
  6. package/dist/assets/icons/index.js +1 -0
  7. package/dist/cli/index.js +1 -1
  8. package/dist/config.d.ts +67 -3
  9. package/dist/config.d.ts.map +1 -1
  10. package/dist/controls.d.ts +23 -1
  11. package/dist/controls.d.ts.map +1 -1
  12. package/dist/controls.js +44 -3
  13. package/dist/footer.js +1 -1
  14. package/dist/internal/chat/activity.d.ts +5 -1
  15. package/dist/internal/chat/activity.d.ts.map +1 -1
  16. package/dist/internal/chat/activity.js +11 -4
  17. package/dist/internal/chat/chat-user.d.ts +12 -0
  18. package/dist/internal/chat/chat-user.d.ts.map +1 -0
  19. package/dist/internal/chat/chat-user.js +27 -0
  20. package/dist/internal/chat/commands.d.ts +91 -0
  21. package/dist/internal/chat/commands.d.ts.map +1 -0
  22. package/dist/internal/chat/commands.js +165 -0
  23. package/dist/internal/chat/context.d.ts +46 -2
  24. package/dist/internal/chat/context.d.ts.map +1 -1
  25. package/dist/internal/chat/context.js +50 -4
  26. package/dist/internal/chat/message-actions.d.ts +15 -0
  27. package/dist/internal/chat/message-actions.d.ts.map +1 -0
  28. package/dist/internal/chat/message-actions.js +113 -0
  29. package/dist/internal/chat/message-feedback.d.ts +68 -0
  30. package/dist/internal/chat/message-feedback.d.ts.map +1 -0
  31. package/dist/internal/chat/message-feedback.js +188 -0
  32. package/dist/internal/chat/message-metadata.d.ts.map +1 -1
  33. package/dist/internal/chat/message-metadata.js +7 -1
  34. package/dist/internal/chat/message-text.d.ts +9 -0
  35. package/dist/internal/chat/message-text.d.ts.map +1 -0
  36. package/dist/internal/chat/message-text.js +15 -0
  37. package/dist/internal/chat/message.d.ts +4 -2
  38. package/dist/internal/chat/message.d.ts.map +1 -1
  39. package/dist/internal/chat/message.js +8 -1
  40. package/dist/internal/chat/options.d.ts +94 -0
  41. package/dist/internal/chat/options.d.ts.map +1 -0
  42. package/dist/internal/chat/options.js +171 -0
  43. package/dist/internal/chat/page-attachment.d.ts +12 -0
  44. package/dist/internal/chat/page-attachment.d.ts.map +1 -0
  45. package/dist/internal/chat/page-attachment.js +18 -0
  46. package/dist/internal/chat/session-provider.d.ts +33 -0
  47. package/dist/internal/chat/session-provider.d.ts.map +1 -0
  48. package/dist/internal/chat/session-provider.js +138 -0
  49. package/dist/internal/chat/session.d.ts +60 -0
  50. package/dist/internal/chat/session.d.ts.map +1 -0
  51. package/dist/internal/chat/session.js +85 -0
  52. package/dist/internal/chat/shell.d.ts.map +1 -1
  53. package/dist/internal/chat/shell.js +81 -157
  54. package/dist/internal/chat/use-chat-commands.d.ts +28 -0
  55. package/dist/internal/chat/use-chat-commands.d.ts.map +1 -0
  56. package/dist/internal/chat/use-chat-commands.js +62 -0
  57. package/dist/internal/chat/user-avatar.d.ts +7 -0
  58. package/dist/internal/chat/user-avatar.d.ts.map +1 -0
  59. package/dist/internal/chat/user-avatar.js +27 -0
  60. package/dist/internal/eve-agent-session-cookie.d.ts +68 -0
  61. package/dist/internal/eve-agent-session-cookie.d.ts.map +1 -0
  62. package/dist/internal/eve-agent-session-cookie.js +164 -0
  63. package/dist/internal/eve-agent-session.d.ts +9 -7
  64. package/dist/internal/eve-agent-session.d.ts.map +1 -1
  65. package/dist/internal/eve-agent-session.js +10 -13
  66. package/dist/internal/eve-agent.d.ts +96 -24
  67. package/dist/internal/eve-agent.d.ts.map +1 -1
  68. package/dist/internal/eve-agent.js +74 -51
  69. package/dist/internal/feedback-action.d.ts +14 -0
  70. package/dist/internal/feedback-action.d.ts.map +1 -1
  71. package/dist/internal/feedback-action.js +37 -5
  72. package/dist/internal/page-actions-client.d.ts +9 -0
  73. package/dist/internal/page-actions-client.d.ts.map +1 -1
  74. package/dist/internal/page-actions-client.js +8 -4
  75. package/dist/internal/provider-client.d.ts.map +1 -1
  76. package/dist/internal/provider-client.js +2 -2
  77. package/dist/internal/use-mobile.d.ts +7 -0
  78. package/dist/internal/use-mobile.d.ts.map +1 -1
  79. package/dist/internal/use-mobile.js +17 -1
  80. package/dist/internal/webmcp-client.d.ts.map +1 -1
  81. package/dist/internal/webmcp-client.js +13 -3
  82. package/dist/internal/webmcp.d.ts +5 -1
  83. package/dist/internal/webmcp.d.ts.map +1 -1
  84. package/dist/internal/webmcp.js +31 -1
  85. package/dist/pages/changelog.d.ts.map +1 -1
  86. package/dist/pages/changelog.js +4 -0
  87. package/dist/pages/docs.d.ts.map +1 -1
  88. package/dist/pages/docs.js +2 -0
  89. package/dist/routes/chat.d.ts +83 -5
  90. package/dist/routes/chat.d.ts.map +1 -1
  91. package/dist/routes/chat.js +517 -80
  92. package/dist/routes/discovery.d.ts +1 -1
  93. package/dist/routes/discovery.d.ts.map +1 -1
  94. package/dist/routes/discovery.js +7 -11
  95. package/dist/routes/openapi.d.ts.map +1 -1
  96. package/dist/routes/openapi.js +47 -25
  97. package/docs/agents.md +3 -3
  98. package/docs/llms.txt +631 -35
  99. package/docs/manifest.json +3 -3
  100. package/docs/pages/agent-readiness.md +1 -1
  101. package/docs/pages/ask-ai.md +567 -24
  102. package/docs/pages/configuration.md +21 -1
  103. package/docs/pages/env.md +17 -3
  104. package/docs/pages/feedback.md +4 -0
  105. package/docs/pages/webmcp.md +18 -3
  106. package/docs/sitemap.md +1 -1
  107. package/package.json +1 -2
  108. package/template/.env.example +5 -0
  109. package/template/AGENTS.md +2 -0
  110. package/template/content/docs/agent-readiness.mdx +1 -1
  111. package/template/content/docs/ask-ai.cn.mdx +466 -15
  112. package/template/content/docs/ask-ai.mdx +567 -24
  113. package/template/content/docs/configuration.cn.mdx +39 -0
  114. package/template/content/docs/configuration.mdx +21 -1
  115. package/template/content/docs/env.cn.mdx +15 -1
  116. package/template/content/docs/env.mdx +18 -4
  117. package/template/content/docs/feedback.cn.mdx +4 -0
  118. package/template/content/docs/feedback.mdx +4 -0
  119. package/template/content/docs/webmcp.mdx +18 -3
  120. package/template/package.json +1 -2
@@ -12,7 +12,7 @@ export declare const toPublicUrl: ({ basePath, href, origin, }: {
12
12
  origin: string;
13
13
  }) => string;
14
14
  export declare const toSiteUrl: (config: Pick<GeistdocsConfig, "basePath">, origin: string, href: string) => string;
15
- type SiteOpenApiPathConfig = Pick<GeistdocsConfig, "basePath" | "defaultLanguage" | "translations">;
15
+ type SiteOpenApiPathConfig = Pick<GeistdocsConfig, "ai" | "basePath" | "defaultLanguage" | "translations">;
16
16
  export declare const validateAgentDiscoveryConfig: (config: DiscoveryConfig & SiteOpenApiPathConfig) => void;
17
17
  export declare const validateMcpManifestConfig: (config: DiscoveryConfig) => void;
18
18
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/routes/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EAIrB,MAAM,cAAc,CAAC;AAEtB,KAAK,eAAe,GAAG,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;AAgBtD,eAAO,MAAM,qBAAqB,GAChC,QAAQ,IAAI,CAAC,eAAe,EAAE,iBAAiB,GAAG,cAAc,CAAC,aAMlE,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,6BAI3B;IACD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,WAMA,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,6BAIzB;IACD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,WAMA,CAAC;AAEF,eAAO,MAAM,SA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BhD,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,QAAQ,eAAe,SAahE,CAAC"}
@@ -1,17 +1,9 @@
1
1
  import { getPublicPath, stripBasePath, withBasePath, } from "../config.js";
2
+ import { RESERVED_SITE_PATHS, resolveChatEndpoint, } from "../internal/chat/options.js";
2
3
  const ABSOLUTE_URL_PATTERN = /^[a-z][a-z\d+.-]*:/i;
3
4
  const QUERY_OR_FRAGMENT_PATTERN = /[?#]/;
4
5
  const TRAILING_SLASH_PATTERN = /\/$/;
5
6
  const MARKDOWN_EXTENSION_PATTERN = /\.mdx?$/i;
6
- /** Paths the OpenAPI document already describes; the document cannot live at one of them. */
7
- const RESERVED_SITE_PATHS = new Set([
8
- "/.well-known/mcp.json",
9
- "/agents.md",
10
- "/api/chat",
11
- "/api/search",
12
- "/llms.txt",
13
- "/sitemap.md",
14
- ]);
15
7
  export const getDiscoveryLanguages = (config) => {
16
8
  const defaultLanguage = config.defaultLanguage ?? "en";
17
9
  const languages = Object.keys(config.translations ?? {});
@@ -59,7 +51,7 @@ const assertDiscoveryUrl = (value, field) => {
59
51
  * pathnames by the proxy and echoed as the document's own path, so only a
60
52
  * plain, language-neutral route path that a request can carry is accepted.
61
53
  */
62
- const assertSiteOpenApiPath = (value, { basePath, ...languagesConfig }) => {
54
+ const assertSiteOpenApiPath = (value, { ai, basePath, ...languagesConfig }) => {
63
55
  const field = "agent.api.siteOpenApiUrl";
64
56
  if (ABSOLUTE_URL_PATTERN.test(value)) {
65
57
  throw new Error(`${field} must be a root-relative path.`);
@@ -75,7 +67,11 @@ const assertSiteOpenApiPath = (value, { basePath, ...languagesConfig }) => {
75
67
  if (TRAILING_SLASH_PATTERN.test(value)) {
76
68
  throw new Error(`${field} must not end with a slash.`);
77
69
  }
78
- if (RESERVED_SITE_PATHS.has(appLocalPath)) {
70
+ const reservedPaths = new Set([
71
+ ...RESERVED_SITE_PATHS,
72
+ resolveChatEndpoint(ai?.endpoint),
73
+ ]);
74
+ if (reservedPaths.has(appLocalPath)) {
79
75
  throw new Error(`${field} must not be a path the document already describes (${appLocalPath}).`);
80
76
  }
81
77
  // `.md` and `.mdx` URLs are page-level Markdown everywhere else on the site.
@@ -1 +1 @@
1
- {"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../src/routes/openapi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,KAAK,eAAe,EAA+B,MAAM,WAAW,CAAC;AAO9E,eAAO,MAAM,yBAAyB,kBAAkB,CAAC;AAEzD,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,IAAI,CACV,eAAe,EACb,OAAO,GACP,IAAI,GACJ,UAAU,GACV,SAAS,GACT,iBAAiB,GACjB,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,OAAO,GACP,cAAc,CACjB,CAAC;IACF;;;;;OAKG;IACH,SAAS,CAAC,EAAE;QACV,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;IACF,SAAS,CAAC,EAAE,CACV,QAAQ,EAAE,wBAAwB,EAClC,OAAO,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,KAC9B,OAAO,CAAC,wBAAwB,CAAC,GAAG,wBAAwB,CAAC;CACnE;AAID,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1C,UAAU,gBAAgB;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,E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OAAO,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAChD,IAAI,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC/C;AA6jBD,eAAO,MAAM,kBAAkB,GAAI,mCAIhC,yBAAyB;mBAmBE,WAAW;;;;;CA8BxC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { stripBasePath, withBasePath } from "../config";
2
+ import { resolveChatEndpoint } from "../internal/chat/options.js";
2
3
  import { getDiscoveryLanguages, toSiteUrl, validateAgentDiscoveryConfig, } from "./discovery";
3
4
  export const DEFAULT_SITE_OPENAPI_PATH = "/openapi.json";
4
5
  const OPENAPI_VERSION = "3.1.0";
@@ -43,7 +44,7 @@ const joinList = (parts) => parts.length > 2
43
44
  const describeEndpointFamilies = (endpoints) => {
44
45
  const apiPaths = present([
45
46
  endpoints.search ? "`/api/search`" : undefined,
46
- endpoints.chat ? "`/api/chat`" : undefined,
47
+ endpoints.chat ? `\`${endpoints.chatPath}\`` : undefined,
47
48
  ]);
48
49
  const apiLocaleHints = present([
49
50
  endpoints.search ? "the `locale` parameter" : undefined,
@@ -139,16 +140,24 @@ const buildSearchPath = (config) => {
139
140
  },
140
141
  };
141
142
  };
143
+ const isEveAgentEnabled = (config) => Boolean(config.ai?.eveAgent?.url);
142
144
  /** `createChatRoute` accepts `{ prewarm: true }` only for eve agents with prewarming on. */
143
- const isEveAgentPrewarmEnabled = (config) => Boolean(config.ai?.eveAgent?.url) && config.ai?.eveAgent?.prewarm === true;
145
+ const isEveAgentPrewarmEnabled = (config) => isEveAgentEnabled(config) && config.ai?.eveAgent?.prewarm === true;
146
+ const EVE_AGENT_SESSION_COOKIE_HEADER = {
147
+ "Set-Cookie": {
148
+ description: "An httpOnly, `SameSite=Strict` cookie scoped to this endpoint's path that binds the browser to its assistant session for 7 days. Send it back with later requests to continue the session; it is only set when the site has a session signing secret.",
149
+ schema: { type: "string" },
150
+ },
151
+ };
144
152
  const buildChatPath = (config) => {
153
+ const eveAgent = isEveAgentEnabled(config);
145
154
  const prewarm = isEveAgentPrewarmEnabled(config);
146
155
  return {
147
156
  post: {
148
157
  operationId: "askDocsAssistant",
149
158
  tags: ["Chat"],
150
159
  summary: "Ask the documentation assistant",
151
- description: `Streams an answer from the Ask AI assistant. The assistant searches the documentation before answering and cites the pages it used. The response body is an AI SDK UI message stream sent as server-sent events. This endpoint calls a language model on the site owner's account; use the search endpoint for lookups that do not need an answer written for you.${prewarm ? ' Send `{ "prewarm": true }` instead of a conversation to allocate an assistant session ahead of the first question; the response is the session handle, not an answer.' : ""}`,
160
+ description: `Streams an answer from the Ask AI assistant. The assistant searches the documentation before answering and cites the pages it used. The response body is an AI SDK UI message stream sent as server-sent events. This endpoint calls a language model on the site owner's account; use the search endpoint for lookups that do not need an answer written for you.${eveAgent ? " The assistant keeps one session per browser across turns: the response sets a session cookie, and assistant messages carry the stream position in `metadata.eveAgent`. Send the full conversation, including that metadata, with each request." : ""}${prewarm ? ' Send `{ "prewarm": true }` instead of a conversation to allocate an assistant session ahead of the first question; the response sets the session cookie and contains no answer.' : ""}`,
152
161
  requestBody: {
153
162
  required: true,
154
163
  content: {
@@ -162,14 +171,19 @@ const buildChatPath = (config) => {
162
171
  responses: {
163
172
  "200": {
164
173
  description: "AI SDK UI message stream. The stream starts before the assistant answers, so a failure while generating the answer arrives as an `error` part inside this 200 stream rather than as an HTTP error status.",
174
+ ...(eveAgent ? { headers: EVE_AGENT_SESSION_COOKIE_HEADER } : {}),
165
175
  content: { "text/event-stream": { schema: { type: "string" } } },
166
176
  },
167
177
  ...(prewarm
168
178
  ? {
169
- "202": jsonResponse("An assistant session was allocated for a `prewarm` request. Pass the handle back as `eveAgentSession` with the first conversation to reuse it.", ref("ChatSessionHandle")),
179
+ "202": {
180
+ ...jsonResponse("An assistant session was allocated for a `prewarm` request and bound to the session cookie. The first conversation sent with that cookie reuses the session. Sites without a session signing secret refuse prewarm requests with 400.", ref("ChatPrewarmResponse")),
181
+ headers: EVE_AGENT_SESSION_COOKIE_HEADER,
182
+ },
170
183
  }
171
184
  : {}),
172
- "400": jsonResponse("`messages` is not an array. Sites that route chat to an agent also reject a last message that is not from the user or has no text.", ref("ChatError")),
185
+ "400": jsonResponse("`messages` is not an array, there are more than 200 messages, `pageContext.url` is missing or longer than 2,048 characters, or `pageContext.content` is not a string or is longer than 200,000 characters (site defaults; the site owner can change these limits). Sites that route chat to an agent also reject a last message that is not from the user or has no text.", ref("ChatError")),
186
+ "413": jsonResponse("The request body is larger than 1,000,000 bytes (site default; the site owner can change this limit).", ref("ChatError")),
173
187
  "500": jsonResponse("The body is not valid JSON, or the request context could not be prepared before streaming began.", ref("ChatError")),
174
188
  },
175
189
  },
@@ -309,18 +323,24 @@ const SCHEMAS = {
309
323
  },
310
324
  pageContext: {
311
325
  type: "object",
312
- description: "Content of the current page, used to ground the answer.",
313
- required: ["title", "url", "content"],
326
+ description: "Page to ground the answer in. Send `url` alone to have the site read the page from its own documentation; a `url` that names no page available to Ask AI is ignored and the question is answered without it. Sending `content` (with `title`) instead grounds the answer in the supplied text, as in earlier versions.",
327
+ required: ["url"],
314
328
  properties: {
315
- title: { type: "string" },
316
- url: { type: "string" },
317
- content: { type: "string" },
329
+ url: {
330
+ type: "string",
331
+ maxLength: 2048,
332
+ description: "Site-relative path of the page, with or without the site's base path and including the language prefix for translated pages.",
333
+ },
334
+ title: {
335
+ type: "string",
336
+ description: "Page title. Used only together with `content`.",
337
+ },
338
+ content: {
339
+ type: "string",
340
+ description: "Page text supplied by the caller. When present, the site uses it instead of reading the page.",
341
+ },
318
342
  },
319
343
  },
320
- eveAgentSession: {
321
- ...ref("ChatSessionHandle"),
322
- description: "Session handle returned by a `prewarm` request or carried in a previous assistant message's metadata. Honoured on sites whose assistant is an eve agent; ignored otherwise.",
323
- },
324
344
  },
325
345
  },
326
346
  ChatPrewarmRequest: {
@@ -335,17 +355,14 @@ const SCHEMAS = {
335
355
  },
336
356
  example: { prewarm: true },
337
357
  },
338
- ChatSessionHandle: {
358
+ ChatPrewarmResponse: {
339
359
  type: "object",
340
- required: ["sessionId", "streamIndex"],
360
+ required: ["ok"],
341
361
  properties: {
342
- sessionId: { type: "string" },
343
- streamIndex: {
344
- type: "integer",
345
- minimum: 0,
346
- description: "Number of assistant stream events already consumed.",
347
- },
362
+ ok: { type: "boolean", enum: [true] },
348
363
  },
364
+ description: "The session itself is bound to the `Set-Cookie` response header; the body carries no session identifier.",
365
+ example: { ok: true },
349
366
  },
350
367
  UIMessage: {
351
368
  type: "object",
@@ -415,13 +432,14 @@ const buildDocument = ({ config, endpoints, origin, selfPath, }) => {
415
432
  });
416
433
  }
417
434
  if (endpoints.chat) {
418
- paths["/api/chat"] = buildChatPath(config);
435
+ paths[endpoints.chatPath] = buildChatPath(config);
419
436
  for (const name of [
420
437
  "ChatRequest",
421
438
  "UIMessage",
422
439
  "ChatError",
423
- "ChatSessionHandle",
424
- ...(isEveAgentPrewarmEnabled(config) ? ["ChatPrewarmRequest"] : []),
440
+ ...(isEveAgentPrewarmEnabled(config)
441
+ ? ["ChatPrewarmRequest", "ChatPrewarmResponse"]
442
+ : []),
425
443
  ]) {
426
444
  schemas.add(name);
427
445
  }
@@ -453,9 +471,13 @@ export const createOpenApiRoute = ({ config, endpoints, transform, }) => {
453
471
  const resolvedEndpoints = {
454
472
  search: endpoints?.search ?? config.search?.enabled !== false,
455
473
  chat: endpoints?.chat ?? config.ai?.enabled !== false,
474
+ chatPath: resolveChatEndpoint(config.ai?.endpoint),
456
475
  };
457
476
  // Document paths are relative to the server URL, which carries the base path.
458
477
  const selfPath = stripBasePath(config.agent?.api?.siteOpenApiUrl ?? DEFAULT_SITE_OPENAPI_PATH, config.basePath);
478
+ if (resolvedEndpoints.chat && resolvedEndpoints.chatPath === selfPath) {
479
+ throw new Error(`ai.endpoint must not be the site OpenAPI document path (${selfPath}).`);
480
+ }
459
481
  const GET = async (request) => {
460
482
  if (config.agent?.enabled === false) {
461
483
  return new Response("Not found", { status: 404 });
package/docs/agents.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Geistdocs Package Docs
2
2
 
3
- These docs are bundled with `@vercel/geistdocs` 2.7.10 so agents can understand the installed package without web access.
3
+ These docs are bundled with `@vercel/geistdocs` 2.8.0 so agents can understand the installed package without web access.
4
4
  They are generated from `apps/template/content/docs` during the package build.
5
5
 
6
6
  ## How to use these files
@@ -24,7 +24,7 @@ They are generated from `apps/template/content/docs` during the package build.
24
24
 
25
25
  - [Overview](pages/index.md): Geistdocs is a packaged documentation system for creating Next.js and Fumadocs sites with shared runtime features.
26
26
  - [Getting Started](pages/getting-started.md): Create a Geistdocs project, run it locally, and edit your first documentation page.
27
- - [Environment Variables](pages/env.md): Environment variables required by Geistdocs for AI chat, Mixedbread retrieval, proxy mode, and production URL configuration.
27
+ - [Environment Variables](pages/env.md): Environment variables required by Geistdocs for AI chat, Mixedbread retrieval, proxy mode, eve agent session cookies, and production URL configuration.
28
28
  - [Deploy to Vercel](pages/deployment.md): Deploy a Geistdocs site to Vercel with the required project settings and environment variables.
29
29
  - [Migrate to Geistdocs](pages/migration.md): Move an existing documentation site to @vercel/geistdocs while keeping local content, routing, middleware behavior, and AI-readable surfaces intact.
30
30
  - [Choose a Geistdocs package](pages/packages.md): Use the public package by default and the private package only where restricted Vercel npm dependencies are already available.
@@ -71,4 +71,4 @@ They are generated from `apps/template/content/docs` during the package build.
71
71
  - [Toggle](pages/components/toggle.md): Toggle is the provider-backed replacement for the former Switch export.
72
72
  - [Tooltip](pages/components/tooltip.md): Wrap controls with provider-backed Tooltip content outside MDX.
73
73
  - [Video](pages/components/video.md): Use Video for embedded video sources inside React UI or authored MDX.
74
- - [WebMCP](pages/webmcp.md): Expose documentation search and page reading to browser agents.
74
+ - [WebMCP](pages/webmcp.md): Expose documentation search, page reading, and Ask AI to browser agents.