@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
@@ -6,7 +6,9 @@ import remarkStringify from "remark-stringify";
6
6
  import { unified } from "unified";
7
7
  const LEADING_WHITESPACE = /^\s+/;
8
8
  const TRAILING_WHITESPACE = /\s+$/;
9
+ const VERSIONED_PATH = /^\/v\d+(?:\/|$)/;
9
10
  const WHITESPACE = /\s+/;
11
+ const markdownFragmentParser = unified().use(remarkParse).use(remarkGfm);
10
12
  // JSX applies props left to right, so a repeated attribute or a later spread
11
13
  // wins at runtime. Read the last literal and distrust it when a spread follows.
12
14
  const findAttribute = (node, name) => {
@@ -38,6 +40,16 @@ function expressionString(node) {
38
40
  }
39
41
  return undefined;
40
42
  }
43
+ const expressionBoolean = (node) => node?.type === "Literal" && typeof node.value === "boolean"
44
+ ? node.value
45
+ : undefined;
46
+ const expressionScalar = (node) => {
47
+ if (node?.type === "Literal" &&
48
+ (typeof node.value === "string" || typeof node.value === "number")) {
49
+ return String(node.value);
50
+ }
51
+ return expressionString(node);
52
+ };
41
53
  const getAttribute = (node, name) => {
42
54
  const attribute = findAttribute(node, name);
43
55
  if (!attribute) {
@@ -95,6 +107,15 @@ const paragraph = (value) => ({
95
107
  children: [{ type: "text", value }],
96
108
  type: "paragraph",
97
109
  });
110
+ const strongParagraph = (value) => ({
111
+ children: [
112
+ {
113
+ children: [{ type: "text", value }],
114
+ type: "strong",
115
+ },
116
+ ],
117
+ type: "paragraph",
118
+ });
98
119
  const inlineCode = (value) => ({
99
120
  type: "inlineCode",
100
121
  value,
@@ -342,6 +363,37 @@ const listItem = (label, nested) => ({
342
363
  spread: false,
343
364
  type: "listItem",
344
365
  });
366
+ const describedListItem = (label, description, nested) => {
367
+ const descriptionBlocks = description
368
+ ? (markdownFragmentParser.parse(description)
369
+ .children ?? [])
370
+ : [];
371
+ const first = descriptionBlocks[0];
372
+ const inlineDescription = first?.type === "paragraph" ? (first.children ?? []) : [];
373
+ const remainingDescription = inlineDescription.length > 0
374
+ ? descriptionBlocks.slice(1)
375
+ : descriptionBlocks;
376
+ return {
377
+ children: [
378
+ {
379
+ children: [
380
+ ...label,
381
+ ...(label.length > 0 && inlineDescription.length > 0
382
+ ? [{ type: "text", value: " " }]
383
+ : []),
384
+ ...inlineDescription,
385
+ ],
386
+ type: "paragraph",
387
+ },
388
+ ...remainingDescription,
389
+ ...(nested.length > 0
390
+ ? [{ children: nested, ordered: false, spread: false, type: "list" }]
391
+ : []),
392
+ ],
393
+ spread: remainingDescription.length > 0,
394
+ type: "listItem",
395
+ };
396
+ };
345
397
  const describedLabel = (label, description) => {
346
398
  if (!description) {
347
399
  return label;
@@ -408,6 +460,89 @@ const propertiesTableNodes = (node) => {
408
460
  ? [{ children: items, ordered: false, spread: false, type: "list" }]
409
461
  : [];
410
462
  };
463
+ const constraintItems = (entry) => objectElements(objectProperty(entry, "constraints")).flatMap((constraint) => {
464
+ const label = expressionString(objectProperty(constraint, "label"));
465
+ const value = expressionScalar(objectProperty(constraint, "value"));
466
+ if (!(label && value)) {
467
+ return [];
468
+ }
469
+ return [
470
+ listItem([
471
+ {
472
+ children: [{ type: "text", value: `${label}:` }],
473
+ type: "strong",
474
+ },
475
+ { type: "text", value: ` ${value}` },
476
+ ], []),
477
+ ];
478
+ });
479
+ const apiVariantItems = (entry) => objectElements(objectProperty(entry, "variants")).flatMap((variant) => {
480
+ const name = expressionString(objectProperty(variant, "name"));
481
+ const description = expressionString(objectProperty(variant, "description"));
482
+ const nested = apiParameterItems(objectElements(objectProperty(variant, "properties")));
483
+ if (!name) {
484
+ return nested;
485
+ }
486
+ return [
487
+ describedListItem([
488
+ {
489
+ children: [{ type: "text", value: name }],
490
+ type: "strong",
491
+ },
492
+ ], description, nested),
493
+ ];
494
+ });
495
+ function apiParameterItems(entries) {
496
+ return entries.flatMap((entry) => {
497
+ const name = expressionString(objectProperty(entry, "name"));
498
+ const type = expressionString(objectProperty(entry, "type"));
499
+ const description = expressionString(objectProperty(entry, "description"));
500
+ const required = expressionBoolean(objectProperty(entry, "required"));
501
+ const deprecated = expressionBoolean(objectProperty(entry, "deprecated"));
502
+ const label = [];
503
+ const optionalName = name && required === false ? `${name}?` : name;
504
+ if (optionalName || type) {
505
+ label.push(inlineCode([optionalName, type].filter(Boolean).join(": ")));
506
+ }
507
+ if (deprecated) {
508
+ label.push({ type: "text", value: label.length > 0 ? " " : "" }, {
509
+ children: [{ type: "text", value: "Deprecated." }],
510
+ type: "strong",
511
+ });
512
+ }
513
+ const nestedProperties = apiParameterItems(objectElements(objectProperty(entry, "properties")));
514
+ const arrayItem = objectProperty(entry, "arrayItems");
515
+ const nestedArrayItem = arrayItem?.type === "ObjectExpression"
516
+ ? apiParameterItems([arrayItem])
517
+ : [];
518
+ const nested = [
519
+ ...constraintItems(entry),
520
+ ...nestedProperties,
521
+ ...nestedArrayItem,
522
+ ...apiVariantItems(entry),
523
+ ];
524
+ if (label.length === 0 && !description) {
525
+ return nested;
526
+ }
527
+ return [describedListItem(label, description, nested)];
528
+ });
529
+ }
530
+ const apiSignatureNodes = (node) => {
531
+ const parameters = objectElements(getAttributeExpression(node, "parameters"));
532
+ if (parameters.length === 0) {
533
+ return endpointNodes(node);
534
+ }
535
+ const title = getAttribute(node, "title");
536
+ return [
537
+ ...(title ? [heading([{ type: "text", value: title }], 2)] : []),
538
+ {
539
+ children: apiParameterItems(parameters),
540
+ ordered: false,
541
+ spread: false,
542
+ type: "list",
543
+ },
544
+ ];
545
+ };
411
546
  const TRIM_NEWLINES = /^\n+|\n+$/g;
412
547
  // `Snippet` renders a copyable command or code line from its `text` prop: a
413
548
  // string, a static template literal, or an array of lines. The page decides
@@ -528,34 +663,87 @@ const filesNodes = (node) => {
528
663
  ? [{ children: items, ordered: false, spread: false, type: "list" }]
529
664
  : [];
530
665
  };
666
+ // True when a prop is written, or a spread could supply it, but its value is
667
+ // not a literal: the rendered value is unknown, so no default may stand in.
668
+ const hasUnreadableAttribute = (node, name, value) => value === undefined &&
669
+ (node.attributes ?? []).some((attribute) => attribute.type === "mdxJsxExpressionAttribute" ||
670
+ (attribute.type === "mdxJsxAttribute" && attribute.name === name));
671
+ const getBooleanAttribute = (node, name) => {
672
+ const attribute = findAttribute(node, name);
673
+ if (!attribute) {
674
+ return undefined;
675
+ }
676
+ if (attribute.value === null) {
677
+ return true;
678
+ }
679
+ return expressionBoolean(getAttributeExpression(node, name));
680
+ };
531
681
  const packageNodes = (node) => {
532
682
  const packageValue = getAttribute(node, "package") ?? getAttribute(node, "packages");
533
683
  const packageExpression = getAttributeExpression(node, "packages");
534
- const packages = packageValue
535
- ? packageValue.split(WHITESPACE).filter(Boolean)
536
- : (packageExpression?.elements ?? [])
537
- .map((entry) => expressionString(entry ?? undefined))
538
- .filter((entry) => Boolean(entry));
684
+ let packages = [];
685
+ if (packageValue) {
686
+ packages = packageValue.split(WHITESPACE).filter(Boolean);
687
+ }
688
+ else if (packageExpression?.type === "ArrayExpression") {
689
+ const entries = packageExpression.elements ?? [];
690
+ const values = entries.map((entry) => expressionString(entry ?? undefined));
691
+ if (values.some((entry) => entry === undefined)) {
692
+ return [];
693
+ }
694
+ packages = values;
695
+ }
539
696
  if (packages.length === 0) {
540
697
  return [];
541
698
  }
699
+ const dev = getBooleanAttribute(node, "dev");
700
+ if (hasUnreadableAttribute(node, "dev", dev)) {
701
+ return [];
702
+ }
542
703
  return [
543
704
  {
544
- children: [
545
- {
546
- children: [{ type: "text", value: "Packages:" }],
547
- type: "strong",
548
- },
549
- { type: "text", value: " " },
550
- ...packages.flatMap((entry, index) => [
551
- ...(index > 0 ? [{ type: "text", value: ", " }] : []),
552
- inlineCode(entry),
553
- ]),
554
- ],
555
- type: "paragraph",
705
+ lang: "bash",
706
+ type: "code",
707
+ value: `pnpm add ${dev ? "-D " : ""}${packages.join(" ")}`,
708
+ },
709
+ ];
710
+ };
711
+ const CODE_LANGUAGES = {
712
+ cURL: "bash",
713
+ JavaScript: "javascript",
714
+ TypeScript: "typescript",
715
+ };
716
+ const codeVariantNodes = (node) => {
717
+ const code = getAttribute(node, "code");
718
+ if (!code) {
719
+ return node.children ?? [];
720
+ }
721
+ const language = getAttribute(node, "language");
722
+ return [
723
+ {
724
+ lang: language
725
+ ? (CODE_LANGUAGES[language] ?? language.toLowerCase())
726
+ : undefined,
727
+ type: "code",
728
+ value: code.replace(TRIM_NEWLINES, ""),
556
729
  },
557
730
  ];
558
731
  };
732
+ const copyPromptNodes = (node) => {
733
+ const title = getAttribute(node, "title");
734
+ const titleIsDynamic = hasUnreadableAttribute(node, "title", title);
735
+ const body = blockChildren(node, true);
736
+ const text = getAttribute(node, "text");
737
+ const content = body.length > 0 ? body : [];
738
+ if (content.length === 0 && text) {
739
+ content.push(paragraph(text));
740
+ }
741
+ const titleNodes = title ? [strongParagraph(title)] : [];
742
+ if (title === undefined && !titleIsDynamic) {
743
+ titleNodes.push(strongParagraph("Prompt for coding agents"));
744
+ }
745
+ return [...titleNodes, ...content];
746
+ };
559
747
  const videoNodes = (node) => {
560
748
  const url = getAttribute(node, "src") ?? getAttribute(node, "url");
561
749
  if (!url) {
@@ -595,6 +783,19 @@ const endpointNodes = (node) => {
595
783
  ? [heading([inlineCode(`${method.toUpperCase()} ${path}`)])]
596
784
  : [];
597
785
  };
786
+ const endpointDisplayNodes = (node) => {
787
+ const method = getAttribute(node, "method");
788
+ const path = getAttribute(node, "path");
789
+ const versionPrefix = getAttribute(node, "versionPrefix");
790
+ if (hasUnreadableAttribute(node, "versionPrefix", versionPrefix)) {
791
+ return [];
792
+ }
793
+ const fullPath = path
794
+ ? `${versionPrefix ?? (VERSIONED_PATH.test(path) ? "" : "/v1")}${path}`
795
+ : undefined;
796
+ const label = method?.toUpperCase() === "DELETE" ? "DEL" : method?.toUpperCase();
797
+ return method && path ? [heading([inlineCode(`${label}${fullPath}`)])] : [];
798
+ };
598
799
  const themeAwareImageNodes = (node) => {
599
800
  const light = getAttributeExpression(node, "light");
600
801
  const dark = getAttributeExpression(node, "dark");
@@ -672,15 +873,17 @@ const buttonNodes = (node) => {
672
873
  const COMPONENT_REPLACERS = {
673
874
  Accordion: (node) => labelledContentNodes(node, ["title"]),
674
875
  APIPage: apiOperationNodes,
675
- APISignature: endpointNodes,
876
+ APISignature: apiSignatureNodes,
676
877
  Button: buttonNodes,
677
878
  ButtonLink: linkNodes,
678
879
  Callout: (node) => [calloutNode(node)],
679
880
  Card: cardNodes,
680
881
  CardPlayer: cardNodes,
681
882
  ChatGeneration: chatGenerationNodes,
883
+ CodeVariant: codeVariantNodes,
884
+ CopyPrompt: copyPromptNodes,
682
885
  Details: (node) => blockChildren(node, true),
683
- EndpointDisplay: endpointNodes,
886
+ EndpointDisplay: endpointDisplayNodes,
684
887
  ExampleLinks: exampleLinksNodes,
685
888
  GithubLink: githubLinkNodes,
686
889
  Image: imageNodes,
@@ -691,6 +894,10 @@ const COMPONENT_REPLACERS = {
691
894
  MDXImage: imageNodes,
692
895
  Mermaid: mermaidNodes,
693
896
  PackageInstall: packageNodes,
897
+ PromptLink: (node) => {
898
+ const text = getAttribute(node, "text");
899
+ return text ? [paragraph(text)] : [];
900
+ },
694
901
  PropertiesTable: propertiesTableNodes,
695
902
  Snippet: snippetNodes,
696
903
  Summary: summaryNodes,
@@ -1 +1 @@
1
- {"version":3,"file":"provider-client.d.ts","sourceRoot":"","sources":["../../src/internal/provider-client.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EACL,KAAK,cAAc,EAKpB,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAKjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAUjD,KAAK,kBAAkB,GAAG,WAAW,CACnC,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC,QAAQ,CAAC,CAC9C,CAAC;AAEF,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,YAAY,CAAC,EAAE,QAAQ,CAAC;IAC3D,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,MAAM,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GAAG;QAC7C,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC;KACjE,CAAC;CACH;AAoFD,eAAO,MAAM,iBAAiB,GAAI,OAAO,sBAAsB,4CAQ9D,CAAC"}
1
+ {"version":3,"file":"provider-client.d.ts","sourceRoot":"","sources":["../../src/internal/provider-client.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EACL,KAAK,cAAc,EAKpB,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAKjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAUjD,KAAK,kBAAkB,GAAG,WAAW,CACnC,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC,QAAQ,CAAC,CAC9C,CAAC;AAEF,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,YAAY,CAAC,EAAE,QAAQ,CAAC;IAC3D,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,MAAM,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GAAG;QAC7C,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC;KACjE,CAAC;CACH;AA+FD,eAAO,MAAM,iBAAiB,GAAI,OAAO,sBAAsB,4CAQ9D,CAAC"}
@@ -17,7 +17,7 @@ const GeistdocsChatShell = lazy(() => import("./chat/shell").then(({ GeistdocsCh
17
17
  })));
18
18
  const GeistdocsProviderInner = ({ config, search, theme: _theme, lang, ...props }) => {
19
19
  const { i18n, i18nProvider } = createGeistdocsI18n(config);
20
- const { enabled, hasBeenOpened, isOpen, setIsOpen } = useGeistdocsChatContext();
20
+ const { enabled, hasBeenOpened, isExpanded, isOpen, setIsExpanded, setIsOpen, } = useGeistdocsChatContext();
21
21
  const isMobile = useIsMobile();
22
22
  useEffect(() => {
23
23
  if (!enabled) {
@@ -26,7 +26,13 @@ const GeistdocsProviderInner = ({ config, search, theme: _theme, lang, ...props
26
26
  const handleKeyDown = (event) => {
27
27
  if (event.key === "Escape" && isOpen) {
28
28
  event.preventDefault();
29
- setIsOpen(false);
29
+ // The first Escape returns an expanded desktop panel to the sidebar.
30
+ if (isExpanded && !isMobile) {
31
+ setIsExpanded(false);
32
+ }
33
+ else {
34
+ setIsOpen(false);
35
+ }
30
36
  return;
31
37
  }
32
38
  if ((event.metaKey || event.ctrlKey) &&
@@ -39,7 +45,7 @@ const GeistdocsProviderInner = ({ config, search, theme: _theme, lang, ...props
39
45
  };
40
46
  document.addEventListener("keydown", handleKeyDown, true);
41
47
  return () => document.removeEventListener("keydown", handleKeyDown, true);
42
- }, [enabled, isOpen, setIsOpen]);
48
+ }, [enabled, isExpanded, isMobile, isOpen, setIsExpanded, setIsOpen]);
43
49
  // fumadocs spreads the provider's `search.options` onto the dialog, which is
44
50
  // how a consumer reaches `tag`. Typed here so it survives the hand-off.
45
51
  const SearchDialogComponent = useCallback((searchProps) => (_jsx(GeistdocsSearchDialog, { basePath: config.basePath, ...searchProps })), [config.basePath]);
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.8.0 so agents can understand the installed package without web access.
3
+ These docs are bundled with `@vercel/geistdocs` 2.9.1 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
package/docs/llms.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  # Geistdocs Package Documentation
2
2
 
3
- These docs are bundled with `@vercel/geistdocs` 2.8.0.
3
+ These docs are bundled with `@vercel/geistdocs` 2.9.1.
4
4
  They describe how to build package-backed Geistdocs sites and how to use the package APIs from generated project adapters.
5
5
 
6
6
  ## Documentation Index
@@ -340,7 +340,7 @@ related:
340
340
 
341
341
  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.
342
342
 
343
- 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.
343
+ 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.
344
344
 
345
345
  ## `AI_GATEWAY_API_KEY`
346
346
 
@@ -374,20 +374,27 @@ When this variable is set, the site does not need `AI_GATEWAY_API_KEY` for Ask A
374
374
 
375
375
  ## `GEISTDOCS_CHAT_PROXY_TOKEN`
376
376
 
377
- An optional bearer token for the chat proxy. Only set this if your proxy requires an `Authorization` header.
377
+ The server-only bearer token that authenticates a Geistdocs site to its chat proxy. The central Geistdocs platform proxy requires this value.
378
378
 
379
- The default Geistdocs platform `/vertex` proxy uses Vercel OIDC and Trusted Sources, so it does not require this token.
379
+ Generate a random token containing at least 32 bytes:
380
+
381
+ ```bash title="Terminal"
382
+ openssl rand -base64 32
383
+ ```
384
+
385
+ 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.
380
386
 
381
387
  ## Vertex-backed proxy setup
382
388
 
383
389
  To route Ask AI through Vertex:
384
390
 
385
- 1. Use or deploy the central Geistdocs platform proxy with its `/vertex` route.
386
- 2. In the Vertex deployment's Deployment Protection settings, add the Geistdocs platform Vercel project as a Trusted Source.
387
- 3. In each Geistdocs site that should use Vertex, set `GEISTDOCS_CHAT_PROXY_URL` to the platform proxy URL, including `/vertex`.
388
- 4. Leave `GEISTDOCS_CHAT_PROXY_TOKEN` unset unless you replace the platform proxy with a custom bearer-authenticated proxy.
391
+ 1. Generate a random token with `openssl rand -base64 32`.
392
+ 2. Set the token as `GEISTDOCS_VERTEX_PROXY_TOKEN` on the platform proxy deployment.
393
+ 3. In the Vertex deployment's Deployment Protection settings, add the Geistdocs platform Vercel project as a Trusted Source.
394
+ 4. In each approved Geistdocs site, set `GEISTDOCS_CHAT_PROXY_URL` to the platform proxy URL, including `/vertex`.
395
+ 5. Set the same token as `GEISTDOCS_CHAT_PROXY_TOKEN` on each approved Geistdocs site.
389
396
 
390
- 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.
397
+ 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"`.
391
398
 
392
399
  ## `GEISTDOCS_CHAT_SECRET`
393
400
 
@@ -487,12 +494,14 @@ To deploy from the Vercel dashboard:
487
494
 
488
495
  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.
489
496
 
490
- 1. Set `GEISTDOCS_CHAT_PROXY_URL` on the Geistdocs site to the platform proxy URL, including `/vertex`.
491
- 2. Leave `GEISTDOCS_CHAT_PROXY_TOKEN` unset unless your proxy requires bearer authentication.
492
- 3. Add the Geistdocs platform Vercel project as a Trusted Source in the Vertex deployment's Deployment Protection settings.
493
- 4. Confirm the platform proxy can forward the Vercel OIDC token to Vertex in `x-vercel-trusted-oidc-idp-token`.
497
+ 1. Generate a random token containing at least 32 bytes with `openssl rand -base64 32`.
498
+ 2. Set the token as `GEISTDOCS_VERTEX_PROXY_TOKEN` on the platform proxy deployment.
499
+ 3. Set `GEISTDOCS_CHAT_PROXY_URL` on the Geistdocs site to the platform proxy URL, including `/vertex`.
500
+ 4. Set the same token as `GEISTDOCS_CHAT_PROXY_TOKEN` on the Geistdocs site.
501
+ 5. Add the Geistdocs platform Vercel project as a Trusted Source in the Vertex deployment's Deployment Protection settings.
502
+ 6. Confirm the platform proxy can forward the Vercel OIDC token to Vertex in `x-vercel-trusted-oidc-idp-token`.
494
503
 
495
- The Geistdocs site does not need Vertex credentials. The platform proxy authenticates to Vertex with Vercel OIDC and Trusted Sources.
504
+ 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.
496
505
 
497
506
 
498
507
  ---
@@ -3872,6 +3881,7 @@ Once open, users can:
3872
3881
  - Ask questions about any part of your documentation
3873
3882
  - View the documentation pages used as sources for each answer
3874
3883
  - Copy an answer as Markdown
3884
+ - Expand the desktop panel to fill the viewport
3875
3885
  - Get step-by-step guidance on complex topics
3876
3886
 
3877
3887
  ## Control Ask AI from your own components
@@ -4125,20 +4135,22 @@ The `model` option only applies in AI Gateway mode. In proxy mode, the Vertex-ba
4125
4135
  Use proxy mode when Ask AI should route model requests through a central Vertex-backed service instead of calling AI Gateway from each site.
4126
4136
 
4127
4137
  1. Deploy or use the central Geistdocs platform proxy that exposes `POST /vertex`.
4128
- 2. Configure the Vertex deployment to trust the Geistdocs platform Vercel project with Deployment Protection Trusted Sources.
4129
- 3. Set `GEISTDOCS_CHAT_PROXY_URL` on the Geistdocs site to the platform proxy URL, including `/vertex`:
4138
+ 2. Generate a random token containing at least 32 bytes with `openssl rand -base64 32`.
4139
+ 3. Set the token as `GEISTDOCS_VERTEX_PROXY_TOKEN` on the platform proxy deployment.
4140
+ 4. Configure the Vertex deployment to trust the Geistdocs platform Vercel project with Deployment Protection Trusted Sources.
4141
+ 5. Set `GEISTDOCS_CHAT_PROXY_URL` on the Geistdocs site to the platform proxy URL, including `/vertex`:
4130
4142
 
4131
4143
  ```txt
4132
4144
  https://<geistdocs-platform-deployment>/vertex
4133
4145
  ```
4134
4146
 
4135
- 4. Leave `GEISTDOCS_CHAT_PROXY_TOKEN` unset unless you are using a custom proxy that requires bearer authentication.
4147
+ 6. Set the same token as `GEISTDOCS_CHAT_PROXY_TOKEN` on the Geistdocs site.
4136
4148
 
4137
4149
  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.
4138
4150
 
4139
4151
  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).
4140
4152
 
4141
- 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.
4153
+ 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.
4142
4154
 
4143
4155
  ### Hosted eve agent mode
4144
4156
 
@@ -4461,6 +4473,8 @@ export const { POST, maxDuration } = createChatRoute({
4461
4473
  });
4462
4474
  ```
4463
4475
 
4476
+ 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.
4477
+
4464
4478
  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`:
4465
4479
 
4466
4480
  ```ts title="app/api/chat/route.ts"
@@ -4542,8 +4556,8 @@ Ask AI accepts text questions only. It does not support file or image attachment
4542
4556
 
4543
4557
  The chat interface adapts to different screen sizes:
4544
4558
 
4545
- - **Desktop**: Slides in from the right side as a sidebar panel
4546
- - **Mobile**: Opens as a bottom drawer.
4559
+ - **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.
4560
+ - **Mobile**: Opens as a bottom drawer. The drawer has no expanded view.
4547
4561
 
4548
4562
  ## Configuration
4549
4563
 
@@ -458,5 +458,5 @@
458
458
  }
459
459
  ],
460
460
  "source": "apps/template/content/docs",
461
- "version": "2.8.0"
461
+ "version": "2.9.1"
462
462
  }
@@ -52,6 +52,7 @@ Once open, users can:
52
52
  - Ask questions about any part of your documentation
53
53
  - View the documentation pages used as sources for each answer
54
54
  - Copy an answer as Markdown
55
+ - Expand the desktop panel to fill the viewport
55
56
  - Get step-by-step guidance on complex topics
56
57
 
57
58
  ## Control Ask AI from your own components
@@ -305,20 +306,22 @@ The `model` option only applies in AI Gateway mode. In proxy mode, the Vertex-ba
305
306
  Use proxy mode when Ask AI should route model requests through a central Vertex-backed service instead of calling AI Gateway from each site.
306
307
 
307
308
  1. Deploy or use the central Geistdocs platform proxy that exposes `POST /vertex`.
308
- 2. Configure the Vertex deployment to trust the Geistdocs platform Vercel project with Deployment Protection Trusted Sources.
309
- 3. Set `GEISTDOCS_CHAT_PROXY_URL` on the Geistdocs site to the platform proxy URL, including `/vertex`:
309
+ 2. Generate a random token containing at least 32 bytes with `openssl rand -base64 32`.
310
+ 3. Set the token as `GEISTDOCS_VERTEX_PROXY_TOKEN` on the platform proxy deployment.
311
+ 4. Configure the Vertex deployment to trust the Geistdocs platform Vercel project with Deployment Protection Trusted Sources.
312
+ 5. Set `GEISTDOCS_CHAT_PROXY_URL` on the Geistdocs site to the platform proxy URL, including `/vertex`:
310
313
 
311
314
  ```txt
312
315
  https://<geistdocs-platform-deployment>/vertex
313
316
  ```
314
317
 
315
- 4. Leave `GEISTDOCS_CHAT_PROXY_TOKEN` unset unless you are using a custom proxy that requires bearer authentication.
318
+ 6. Set the same token as `GEISTDOCS_CHAT_PROXY_TOKEN` on the Geistdocs site.
316
319
 
317
320
  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.
318
321
 
319
322
  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).
320
323
 
321
- 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.
324
+ 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.
322
325
 
323
326
  ### Hosted eve agent mode
324
327
 
@@ -641,6 +644,8 @@ export const { POST, maxDuration } = createChatRoute({
641
644
  });
642
645
  ```
643
646
 
647
+ 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.
648
+
644
649
  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`:
645
650
 
646
651
  ```ts title="app/api/chat/route.ts"
@@ -722,8 +727,8 @@ Ask AI accepts text questions only. It does not support file or image attachment
722
727
 
723
728
  The chat interface adapts to different screen sizes:
724
729
 
725
- - **Desktop**: Slides in from the right side as a sidebar panel
726
- - **Mobile**: Opens as a bottom drawer.
730
+ - **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.
731
+ - **Mobile**: Opens as a bottom drawer. The drawer has no expanded view.
727
732
 
728
733
  ## Configuration
729
734
 
@@ -73,9 +73,11 @@ To deploy from the Vercel dashboard:
73
73
 
74
74
  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.
75
75
 
76
- 1. Set `GEISTDOCS_CHAT_PROXY_URL` on the Geistdocs site to the platform proxy URL, including `/vertex`.
77
- 2. Leave `GEISTDOCS_CHAT_PROXY_TOKEN` unset unless your proxy requires bearer authentication.
78
- 3. Add the Geistdocs platform Vercel project as a Trusted Source in the Vertex deployment's Deployment Protection settings.
79
- 4. Confirm the platform proxy can forward the Vercel OIDC token to Vertex in `x-vercel-trusted-oidc-idp-token`.
80
-
81
- The Geistdocs site does not need Vertex credentials. The platform proxy authenticates to Vertex with Vercel OIDC and Trusted Sources.
76
+ 1. Generate a random token containing at least 32 bytes with `openssl rand -base64 32`.
77
+ 2. Set the token as `GEISTDOCS_VERTEX_PROXY_TOKEN` on the platform proxy deployment.
78
+ 3. Set `GEISTDOCS_CHAT_PROXY_URL` on the Geistdocs site to the platform proxy URL, including `/vertex`.
79
+ 4. Set the same token as `GEISTDOCS_CHAT_PROXY_TOKEN` on the Geistdocs site.
80
+ 5. Add the Geistdocs platform Vercel project as a Trusted Source in the Vertex deployment's Deployment Protection settings.
81
+ 6. Confirm the platform proxy can forward the Vercel OIDC token to Vertex in `x-vercel-trusted-oidc-idp-token`.
82
+
83
+ 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.
package/docs/pages/env.md CHANGED
@@ -16,7 +16,7 @@ related:
16
16
 
17
17
  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.
18
18
 
19
- 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.
19
+ 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.
20
20
 
21
21
  ## `AI_GATEWAY_API_KEY`
22
22
 
@@ -50,20 +50,27 @@ When this variable is set, the site does not need `AI_GATEWAY_API_KEY` for Ask A
50
50
 
51
51
  ## `GEISTDOCS_CHAT_PROXY_TOKEN`
52
52
 
53
- An optional bearer token for the chat proxy. Only set this if your proxy requires an `Authorization` header.
53
+ The server-only bearer token that authenticates a Geistdocs site to its chat proxy. The central Geistdocs platform proxy requires this value.
54
54
 
55
- The default Geistdocs platform `/vertex` proxy uses Vercel OIDC and Trusted Sources, so it does not require this token.
55
+ Generate a random token containing at least 32 bytes:
56
+
57
+ ```bash title="Terminal"
58
+ openssl rand -base64 32
59
+ ```
60
+
61
+ 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.
56
62
 
57
63
  ## Vertex-backed proxy setup
58
64
 
59
65
  To route Ask AI through Vertex:
60
66
 
61
- 1. Use or deploy the central Geistdocs platform proxy with its `/vertex` route.
62
- 2. In the Vertex deployment's Deployment Protection settings, add the Geistdocs platform Vercel project as a Trusted Source.
63
- 3. In each Geistdocs site that should use Vertex, set `GEISTDOCS_CHAT_PROXY_URL` to the platform proxy URL, including `/vertex`.
64
- 4. Leave `GEISTDOCS_CHAT_PROXY_TOKEN` unset unless you replace the platform proxy with a custom bearer-authenticated proxy.
67
+ 1. Generate a random token with `openssl rand -base64 32`.
68
+ 2. Set the token as `GEISTDOCS_VERTEX_PROXY_TOKEN` on the platform proxy deployment.
69
+ 3. In the Vertex deployment's Deployment Protection settings, add the Geistdocs platform Vercel project as a Trusted Source.
70
+ 4. In each approved Geistdocs site, set `GEISTDOCS_CHAT_PROXY_URL` to the platform proxy URL, including `/vertex`.
71
+ 5. Set the same token as `GEISTDOCS_CHAT_PROXY_TOKEN` on each approved Geistdocs site.
65
72
 
66
- 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.
73
+ 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"`.
67
74
 
68
75
  ## `GEISTDOCS_CHAT_SECRET`
69
76
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vercel/geistdocs",
3
3
  "description": "Runtime and CLI for Geistdocs projects.",
4
- "version": "2.8.0",
4
+ "version": "2.9.1",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",