@vercel/geistdocs 2.9.0 → 2.9.1-canary.13e0204
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/cli/index.js +1 -1
- package/dist/internal/chat/message.js +1 -1
- package/dist/internal/page-actions-client.d.ts +1 -1
- package/dist/internal/page-actions-client.d.ts.map +1 -1
- package/dist/internal/page-actions-client.js +5 -3
- package/dist/pages/docs.d.ts.map +1 -1
- package/dist/pages/docs.js +5 -6
- package/docs/agents.md +1 -1
- package/docs/llms.txt +33 -21
- package/docs/manifest.json +1 -1
- package/docs/pages/agent-readiness.md +1 -2
- package/docs/pages/ask-ai.md +9 -5
- package/docs/pages/deployment.md +8 -6
- package/docs/pages/env.md +15 -8
- package/package.json +6 -6
- package/public-foundation.css +0 -2
- package/shared-theme.css +6 -0
- package/template/.env.example +2 -3
- package/template/AGENTS.md +1 -1
- package/template/content/docs/agent-readiness.mdx +1 -2
- package/template/content/docs/ask-ai.mdx +9 -5
- package/template/content/docs/deployment.mdx +8 -6
- package/template/content/docs/env.mdx +16 -9
- package/template/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -4,4 +4,4 @@ import{Option as Rn,program as A}from"commander";import{access as Ke,copyFile as
|
|
|
4
4
|
`);throw new AggregateError(i,`Mixedbread search sync did not complete:
|
|
5
5
|
${a}`)}return r},Ft=async({client:e,file:t,pollIntervalMs:n,pollTimeoutMs:r,sleep:i})=>{let s=t,o=Date.now()+r;for(;s.status==="pending"||s.status==="in_progress";){if(Date.now()>=o)throw new Error(`Mixedbread timed out while indexing file ${t.id}.`);await i(n),s=await e.retrieveStoreFile(t.id)}if(s.status!=="completed")throw new Error(`Mixedbread failed to index file ${t.id} (${s.status}).`);return s},Dt=async({client:e,desired:t,pollIntervalMs:n,pollTimeoutMs:r,sleep:i})=>{let s=await e.uploadFile({content:t.document.content,filename:`${U(t.document.id).slice(0,32)}.md`}),o;try{o=await e.createStoreFile({externalId:t.externalId,fileId:s,metadata:{...t.metadata,[g.rawFileId]:s}})}catch(a){try{await e.deleteFile(s)}catch(d){throw new AggregateError([a,d],`Mixedbread failed to attach and clean up raw file ${s}.`)}throw a}return Ft({client:e,file:o,pollIntervalMs:n,pollTimeoutMs:r,sleep:i})},Ie=async({client:e,concurrency:t=St,manifest:n,pollIntervalMs:r=_t,pollTimeoutMs:i=Tt,revision:s,revisionAncestors:o=[],revisionTimestamp:a,sleep:d=Rt})=>{let c=_e(n);if(c.provider!=="mixedbread")return{deleted:0,skipped:c.documents.length,uploaded:0};let u=c.siteId?.trim();if(!u)throw new Error("Mixedbread retrieval requires a non-empty siteId in geistdocs.tsx.");if(c.documents.length===0)throw new Error("The Geistdocs search export is empty. Refusing to remove indexed documents.");let l=c.documents.map(p=>At(p,u,s,o,a)),m=new Map(l.map(p=>[p.document.id,p])),h=(await be(e)).flatMap(p=>{let y=q(p.metadata);return y?.siteId===u?[{file:p,metadata:y}]:[]}),x=new Map,P=new Set;for(let p of h){W(p.metadata,s,a)&&P.add(p.metadata.documentId);let y=m.get(p.metadata.documentId);y&&p.metadata.contentHash===y.hash&&p.file.status==="completed"&&!x.has(p.metadata.documentId)&&x.set(p.metadata.documentId,p)}let _=l.filter(p=>!(x.has(p.document.id)||P.has(p.document.id)));await Ee(_,t,p=>Dt({client:e,desired:p,pollIntervalMs:r,pollTimeoutMs:i,sleep:d}));let b=(await be(e)).flatMap(p=>{let y=q(p.metadata);return y?.siteId===u?[{file:p,metadata:y}]:[]}),D=new Set(b.filter(({metadata:p})=>W(p,s,a)).map(({metadata:p})=>p.documentId)),ie=new Set;for(let p of l){if(D.has(p.document.id))continue;let ae=b.filter(({file:V,metadata:k})=>V.status==="completed"&&k.documentId===p.document.id&&k.contentHash===p.hash).sort((V,k)=>V.file.id.localeCompare(k.file.id))[0];ae&&ie.add(ae.file.id)}let oe=b.filter(({file:p,metadata:y})=>p.status!=="pending"&&p.status!=="in_progress"&&!W(y,s,a)&&Mt({currentRevision:s,currentRevisionAncestors:o,currentRevisionTimestamp:a,desired:m.get(y.documentId),metadata:y})&&!ie.has(p.id));return await Ee(oe,t,async({file:p,metadata:y})=>{await e.deleteFile(y.rawFileId??p.id),await e.deleteStoreFile(p.id)}),{deleted:oe.length,skipped:l.length-_.length,uploaded:_.length}};var Ot=50,$t=e=>`vercel integration add mixedbread --name docs-${e||"your-site-id"} --environment production`,ve=(e,t)=>kt("git",t,{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim(),Nt=e=>{let t=process.env.VERCEL_GIT_COMMIT_SHA?.trim(),n=[];try{n=ve(e,["rev-list",`--max-count=${Ot+1}`,t||"HEAD"]).split(`
|
|
6
6
|
`).filter(Boolean)}catch{n=[]}let r=t||n[0],i;for(let s of Array.from(new Set([r,"HEAD"].filter(Boolean))))try{let o=Number(ve(e,["show","-s","--format=%ct",s]));if(Number.isFinite(o)){i=o;break}}catch{}return{revision:r,revisionAncestors:n.filter(s=>s!==r),revisionTimestamp:i}},Pe=async({allowNonProduction:e=!1,dir:t=".next"}={})=>{let n=process.cwd();Ct.loadEnvConfig(n,!1);let r=process.env.MXBAI_API_KEY?.trim(),i=process.env.MXBAI_STORE_ID?.trim();if(process.env.VERCEL_ENV!=="production"&&!e){console.log("Geistdocs search sync skipped: this is not a production Vercel build.");return}if(!!r!=!!i)throw new Error("Mixedbread is partially configured. Set both MXBAI_API_KEY and MXBAI_STORE_ID.");let s;try{s=await Te({cwd:n,outputDirectory:t})}catch(a){if(!(r||i)){console.log("Geistdocs search sync skipped: no Mixedbread credentials or static search export were found.");return}throw a}if(s.provider!=="mixedbread"){console.log("Geistdocs search sync skipped: Ask AI uses local retrieval.");return}if(!(r&&i))throw new Error(["Mixedbread retrieval is enabled, but MXBAI_API_KEY or MXBAI_STORE_ID is missing.","From the root of this site's repository, linked to the correct Vercel project, run:",$t(s.siteId)].join(`
|
|
7
|
-
`));let o=await Ie({client:we({apiBaseUrl:process.env.MXBAI_BASE_URL,apiKey:r,storeId:i}),manifest:s,...Nt(n)});console.log(`Geistdocs search sync complete: ${o.uploaded} uploaded, ${o.deleted} deleted, ${o.skipped} unchanged.`)};import{readFileSync as Gt,writeFileSync as Ut}from"fs";import{mkdir as Lt,readFile as Z,writeFile as jt}from"fs/promises";import{dirname as Bt,extname as Vt,relative as Fe,resolve as j}from"path";import{intro as Jt,isCancel as Ht,log as I,multiselect as Xt,outro as L,spinner as Kt}from"@clack/prompts";import{glob as Yt}from"glob";import{Node as F,Project as qt,SyntaxKind as zt}from"ts-morph";var Wt="geistdocs.tsx",Qt="content/docs/**/*.mdx",ee=".translation-cache.json",Q=8,Ae=()=>({version:1,entries:{}}),Zt=async e=>{let t=await Z(e),{createHash:n}=await import("crypto");return n("sha256").update(t).digest("hex")},en=e=>{let t=j(process.cwd(),e);return Gt(t,"utf8")},Me=e=>F.isObjectLiteralExpression(e)?e.getProperties().flatMap(t=>{if(F.isPropertyAssignment(t)){let n=t.getNameNode();if(F.isIdentifier(n)||F.isStringLiteral(n))return[n.getText().replaceAll(/['"]/g,"")]}return[]}).filter(Boolean):[],tn=e=>{try{let t=new qt({compilerOptions:{allowJs:!0,jsx:4,module:99,target:10},skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!0}),n=en(e),s=t.createSourceFile(e,n,{overwrite:!0}).getVariableDeclarations().find(a=>a.getName()==="translations")?.getInitializer();if(!s)return[];if(F.isObjectLiteralExpression(s))return Me(s);let o=s.getFirstDescendantByKind(zt.ObjectLiteralExpression);return o?Me(o):[]}catch(t){let n=t instanceof Error?t.message:`${t}`;return I.warn(`Failed to read locales from ${e}: ${n}`),[]}},nn=async()=>{let e=await Xt({message:"Which locales should be translated?",options:[{value:"cn",label:"Chinese (cn)"},{value:"jp",label:"Japanese (jp)"},{value:"es",label:"Spanish (es)"},{value:"fr",label:"French (fr)"},{value:"de",label:"German (de)"}],required:!0});return Ht(e)&&(L("Translation cancelled"),process.exit(0)),e},rn=async e=>(await Yt(e,{cwd:process.cwd(),absolute:!0,nodir:!0})).sort(),sn=async()=>{let e=j(process.cwd(),ee);try{let t=await Z(e,"utf8"),n=JSON.parse(t);return n.version!==1||!n.entries?Ae():{version:1,entries:n.entries}}catch{return Ae()}},Re=e=>{let t=j(process.cwd(),ee),n=JSON.stringify(e,null,2);Ut(t,n,"utf8")},on=async e=>{let t=await Promise.all(e.map(async n=>[n,await Zt(n)]));return Object.fromEntries(t)},an=(e,t)=>{let n=Vt(e);return`${e.slice(0,-n.length)}.${t}${n}`},De=(e,t)=>`${Fe(process.cwd(),e)}::${t}`,cn=(e,t,n,r,i=!1)=>{let s=[],o=0;for(let a of t){let d=n[a];for(let c of e){let u=an(a,c),l=De(a,c),m=r.entries[l];if(!i&&m?.hash===d){o+=1;continue}s.push({locale:c,sourceFile:a,sourceHash:d,targetFile:u})}}return{tasks:s,skippedCount:o}},dn=async e=>{await Lt(Bt(e),{recursive:!0})},ln=async(e,t,n)=>{let r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,locale:n})});if(!r.ok){let s=await r.text();throw new Error(`API request failed (${r.status}): ${s}`)}let i=await r.json();if(!i.translation)throw new Error("API response did not include a translation");return i.translation},pn=async(e,t,n)=>{let r=await Z(e.sourceFile,"utf8"),i=await ln(t,r,e.locale);await dn(e.targetFile),await jt(e.targetFile,i,"utf8"),n.entries[De(e.sourceFile,e.locale)]={hash:e.sourceHash,updatedAt:new Date().toISOString()}},ke=async(e,t)=>{Jt("Translate MDX content");let n=e??Qt,r=t.url||process.env.GEISTDOCS_TRANSLATE_URL||"https://geistdocs.com/translate",i=tn(t.config??Wt),s=await rn(n);s.length===0&&(I.error(`No MDX files found matching pattern: ${n}`),L("Translation cancelled"),process.exit(1)),I.info(`Found ${s.length} MDX file(s) matching pattern`),i.length===0&&(i=await nn());let o=j(process.cwd(),ee),a=await sn();await Re(a),I.info(`Using cache: ${o}`);let d=await on(s),{tasks:c,skippedCount:u}=cn(i,s,d,a,t.force);if(c.length===0){I.success("All translations are up to date!"),L(`Skipped ${u} file(s) (unchanged)`);return}let l=[];for(let h=0;h<c.length;h+=Q)l.push(c.slice(h,h+Q));I.info(`Processing ${c.length} translation(s) in ${l.length} batch(es) of up to ${Q}`),u>0&&I.info(`Skipped ${u} translation(s) (unchanged)`);let m=Kt();m.start("Translating content...");let f=0;for(let h of l)await Promise.all(h.map(async x=>{await pn(x,r,a),f+=1,m.message(`Translated ${f}/${c.length}: ${Fe(process.cwd(),x.targetFile)}`)})),await Re(a);m.stop("Translation complete!"),L(`Created/updated ${c.length} file(s)`)};import{access as un,copyFile as gn,mkdir as Ne,rm as re}from"fs/promises";import{dirname as mn,join as v}from"path";import{intro as fn,log as w,outro as B,spinner as Ge}from"@clack/prompts";import{glob as hn}from"glob";var wn=["**/*"],yn=["content/docs/**"],te=".geistdocs-tmp",xn=async(e,t)=>{let n=v(e,t);await re(n,{recursive:!0,force:!0}),await Ne(n,{recursive:!0})},ne=async e=>await re(e,{recursive:!0,force:!0}),Ce=async(e,t,n)=>(await hn(e,{cwd:n,nodir:!0,dot:!0,ignore:[".git/**",...t]})).sort(),bn=async e=>{try{return await un(e),!0}catch{return!1}},En=async(e,t,n)=>{let r=v(t,e),i=v(n,e);return await bn(r)?(await gn(r,i),{success:!0}):{success:!1,error:`Source file not found: ${r}`}},Sn=async(e,t)=>{let n=v(t,e);return await re(n,{force:!0}),{success:!0}},Oe=20,$e=async(e,t,n)=>{let r=[];for(let i=0;i<e.length;i+=n){let s=e.slice(i,i+n),o=await Promise.all(s.map(t));r.push(...o)}return r},_n=async(e,t,n,r,i)=>{let s={success:[],deleted:[],failed:[]},o=[...new Set(e.map(d=>mn(v(r,d))))];i.message(`Creating ${o.length} directories...`),await Promise.all(o.map(d=>Ne(d,{recursive:!0}))),i.message(`Updating ${e.length} files...`);let a=await $e(e,async d=>{let c=await En(d,n,r);return{file:d,...c}},Oe);for(let{file:d,success:c,error:u}of a)c?s.success.push(d):s.failed.push({file:d,error:u??"Unknown error"});if(t.length>0){i.message(`Deleting ${t.length} files...`);let d=await $e(t,async c=>{try{return await Sn(c,r),{file:c,success:!0}}catch(u){let l=u instanceof Error?u.message:`${u}`;return{file:c,success:!1,error:l}}},Oe);for(let c of d)c.success?s.deleted.push(c.file):s.failed.push({file:c.file,error:c.error})}return s},Tn=e=>{if(e.success.length>0){w.success(`Successfully updated ${e.success.length} files:`);for(let t of e.success)w.info(` \u2713 ${t}`)}if(e.deleted.length>0){w.success(`Deleted ${e.deleted.length} files:`);for(let t of e.deleted)w.info(` \u{1F5D1} ${t}`)}if(e.failed.length>0){w.warn(`Failed to update ${e.failed.length} files:`);for(let{file:t,error:n}of e.failed)w.error(` \u2717 ${t}: ${n}`)}},In=e=>e.includes("canary")?"canary":"latest",vn=async e=>{let t=await fetch(`https://registry.npmjs.org/${encodeURIComponent(S)}`);if(!t.ok)throw new Error(`Failed to resolve ${S}@${e}`);let r=(await t.json())["dist-tags"]?.[e];if(!r)throw new Error(`Could not find dist-tag ${e} for ${S}`);return r},Pn=async e=>{let t=await M(e),n=J(t,S);if(!n)return{currentVersion:n,nextVersion:void 0,updated:!1};let r=In(n),i=await vn(r);return n===i?{currentVersion:n,nextVersion:i,updateTag:r,updated:!1}:($(t,S,i),await O(e,t),{currentVersion:n,nextVersion:i,updateTag:r,updated:!0})},An=async(e,t,n)=>{let r=await M(e);if(!le(r,S))return!1;t&&t.length>0&&w.warn("Ignoring file patterns for a package-based site. This update will bump the package version instead."),n?.sync&&w.warn("Ignoring --sync for a package-based site. Runtime updates now come from the package version.");let{currentVersion:i,nextVersion:s,updateTag:o,updated:a}=await Pn(e);if(!a)return w.success(i?`@vercel/geistdocs is already at ${s} (${o}).`:"No package version update was needed."),B("Package-based site is already up to date."),!0;w.info(`Bumping ${S} from ${i} to ${s} (${o})`);let d=Ge();return d.start("Installing updated package version..."),await T("pnpm",["install"],{cwd:e}),d.stop("Package update complete!"),B("Please review and test the upgraded package version."),!0},Mn=async(e,t,n,r,i)=>{let s=v(e,te),o=Ge(),a=i?.sync?s:t;o.start("Preparing template snapshot..."),i?.sync&&(await xn(e,te),await N(s)),o.message("Scanning for files...");let d=await Ce(n,r,a),c=[];if(i?.sync){o.message("Comparing with local files...");let l=await Ce(n,r,e),m=new Set(d);c=l.filter(f=>!m.has(f))}if(o.stop(`Found ${d.length} files to update`),d.length===0&&c.length===0){w.warn("No files matched the patterns. Nothing to update."),i?.sync&&await ne(s),B("Update cancelled.");return}w.info(`Patterns: ${n.length}`),w.info(`Files to update: ${d.length}`),i?.sync&&w.info(`Files to delete: ${c.length}`),o.start("Updating files...");let u=await _n(d,c,a,e,o);i?.sync&&(o.message("Cleaning up..."),await ne(s)),o.stop("Update complete!"),Tn(u),B("Please review and test the changes carefully.")},Ue=async(e,t)=>{let n=process.cwd(),r=H(),i=e&&e.length>0?e:wn,s=e&&e.length>0?[]:yn;try{if(fn("Let's update your Geistdocs project!"),await An(n,e,t))return;w.info("Template source: bundled package snapshot"),e&&e.length>0&&w.info(`Updating specific files: ${e.join(", ")}`),t?.sync&&w.info("Sync mode enabled: will delete files removed from template"),await Mn(n,r,i,s,t)}catch(o){let a=o instanceof Error?o.message:`${o}`;try{await ne(v(n,te))}catch{}w.error(`Failed to update project: ${a}`),process.exit(1)}};A.name("geistdocs").description("CLI for Geistdocs projects").version("2.9.0","-v, --version","Output the current version");A.command("init").description("Initialize a new Geistdocs project").option("--name <name>","Name of the project").addOption(new Rn("--brand <brand>","Navbar brand").choices(["vercel","labs"]).default("vercel")).option("--disable-git","Disable git initialization").action(he);A.command("update [files...]").description("Update a Geistdocs project (optionally specify files/patterns to update)").option("--sync","Delete local files that no longer exist in the template").action(Ue);A.command("translate [pattern]").description("Translate MDX file(s) to one or more locales (default: content/docs/**/*.mdx)").option("--config <path>","Path to config file to load locales from (defaults to geistdocs.tsx)").option("--url <url>","Custom translation API URL (defaults to GEISTDOCS_TRANSLATE_URL or https://geistdocs.com/translate)").option("--force","Force re-translation of all files, ignoring cache").action(ke);var Fn=A.command("search").description("Manage the external search index used by Ask AI");Fn.command("sync").description("Sync the latest static docs export to Mixedbread").option("--dir <path>","Next.js output directory",".next").option("--allow-non-production","Run outside a production Vercel build").action(Pe);await A.parseAsync(process.argv).catch(e=>{console.error(e instanceof Error?e.message:e),process.exitCode=1});
|
|
7
|
+
`));let o=await Ie({client:we({apiBaseUrl:process.env.MXBAI_BASE_URL,apiKey:r,storeId:i}),manifest:s,...Nt(n)});console.log(`Geistdocs search sync complete: ${o.uploaded} uploaded, ${o.deleted} deleted, ${o.skipped} unchanged.`)};import{readFileSync as Gt,writeFileSync as Ut}from"fs";import{mkdir as Lt,readFile as Z,writeFile as jt}from"fs/promises";import{dirname as Bt,extname as Vt,relative as Fe,resolve as j}from"path";import{intro as Jt,isCancel as Ht,log as I,multiselect as Xt,outro as L,spinner as Kt}from"@clack/prompts";import{glob as Yt}from"glob";import{Node as F,Project as qt,SyntaxKind as zt}from"ts-morph";var Wt="geistdocs.tsx",Qt="content/docs/**/*.mdx",ee=".translation-cache.json",Q=8,Ae=()=>({version:1,entries:{}}),Zt=async e=>{let t=await Z(e),{createHash:n}=await import("crypto");return n("sha256").update(t).digest("hex")},en=e=>{let t=j(process.cwd(),e);return Gt(t,"utf8")},Me=e=>F.isObjectLiteralExpression(e)?e.getProperties().flatMap(t=>{if(F.isPropertyAssignment(t)){let n=t.getNameNode();if(F.isIdentifier(n)||F.isStringLiteral(n))return[n.getText().replaceAll(/['"]/g,"")]}return[]}).filter(Boolean):[],tn=e=>{try{let t=new qt({compilerOptions:{allowJs:!0,jsx:4,module:99,target:10},skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!0}),n=en(e),s=t.createSourceFile(e,n,{overwrite:!0}).getVariableDeclarations().find(a=>a.getName()==="translations")?.getInitializer();if(!s)return[];if(F.isObjectLiteralExpression(s))return Me(s);let o=s.getFirstDescendantByKind(zt.ObjectLiteralExpression);return o?Me(o):[]}catch(t){let n=t instanceof Error?t.message:`${t}`;return I.warn(`Failed to read locales from ${e}: ${n}`),[]}},nn=async()=>{let e=await Xt({message:"Which locales should be translated?",options:[{value:"cn",label:"Chinese (cn)"},{value:"jp",label:"Japanese (jp)"},{value:"es",label:"Spanish (es)"},{value:"fr",label:"French (fr)"},{value:"de",label:"German (de)"}],required:!0});return Ht(e)&&(L("Translation cancelled"),process.exit(0)),e},rn=async e=>(await Yt(e,{cwd:process.cwd(),absolute:!0,nodir:!0})).sort(),sn=async()=>{let e=j(process.cwd(),ee);try{let t=await Z(e,"utf8"),n=JSON.parse(t);return n.version!==1||!n.entries?Ae():{version:1,entries:n.entries}}catch{return Ae()}},Re=e=>{let t=j(process.cwd(),ee),n=JSON.stringify(e,null,2);Ut(t,n,"utf8")},on=async e=>{let t=await Promise.all(e.map(async n=>[n,await Zt(n)]));return Object.fromEntries(t)},an=(e,t)=>{let n=Vt(e);return`${e.slice(0,-n.length)}.${t}${n}`},De=(e,t)=>`${Fe(process.cwd(),e)}::${t}`,cn=(e,t,n,r,i=!1)=>{let s=[],o=0;for(let a of t){let d=n[a];for(let c of e){let u=an(a,c),l=De(a,c),m=r.entries[l];if(!i&&m?.hash===d){o+=1;continue}s.push({locale:c,sourceFile:a,sourceHash:d,targetFile:u})}}return{tasks:s,skippedCount:o}},dn=async e=>{await Lt(Bt(e),{recursive:!0})},ln=async(e,t,n)=>{let r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,locale:n})});if(!r.ok){let s=await r.text();throw new Error(`API request failed (${r.status}): ${s}`)}let i=await r.json();if(!i.translation)throw new Error("API response did not include a translation");return i.translation},pn=async(e,t,n)=>{let r=await Z(e.sourceFile,"utf8"),i=await ln(t,r,e.locale);await dn(e.targetFile),await jt(e.targetFile,i,"utf8"),n.entries[De(e.sourceFile,e.locale)]={hash:e.sourceHash,updatedAt:new Date().toISOString()}},ke=async(e,t)=>{Jt("Translate MDX content");let n=e??Qt,r=t.url||process.env.GEISTDOCS_TRANSLATE_URL||"https://geistdocs.com/translate",i=tn(t.config??Wt),s=await rn(n);s.length===0&&(I.error(`No MDX files found matching pattern: ${n}`),L("Translation cancelled"),process.exit(1)),I.info(`Found ${s.length} MDX file(s) matching pattern`),i.length===0&&(i=await nn());let o=j(process.cwd(),ee),a=await sn();await Re(a),I.info(`Using cache: ${o}`);let d=await on(s),{tasks:c,skippedCount:u}=cn(i,s,d,a,t.force);if(c.length===0){I.success("All translations are up to date!"),L(`Skipped ${u} file(s) (unchanged)`);return}let l=[];for(let h=0;h<c.length;h+=Q)l.push(c.slice(h,h+Q));I.info(`Processing ${c.length} translation(s) in ${l.length} batch(es) of up to ${Q}`),u>0&&I.info(`Skipped ${u} translation(s) (unchanged)`);let m=Kt();m.start("Translating content...");let f=0;for(let h of l)await Promise.all(h.map(async x=>{await pn(x,r,a),f+=1,m.message(`Translated ${f}/${c.length}: ${Fe(process.cwd(),x.targetFile)}`)})),await Re(a);m.stop("Translation complete!"),L(`Created/updated ${c.length} file(s)`)};import{access as un,copyFile as gn,mkdir as Ne,rm as re}from"fs/promises";import{dirname as mn,join as v}from"path";import{intro as fn,log as w,outro as B,spinner as Ge}from"@clack/prompts";import{glob as hn}from"glob";var wn=["**/*"],yn=["content/docs/**"],te=".geistdocs-tmp",xn=async(e,t)=>{let n=v(e,t);await re(n,{recursive:!0,force:!0}),await Ne(n,{recursive:!0})},ne=async e=>await re(e,{recursive:!0,force:!0}),Ce=async(e,t,n)=>(await hn(e,{cwd:n,nodir:!0,dot:!0,ignore:[".git/**",...t]})).sort(),bn=async e=>{try{return await un(e),!0}catch{return!1}},En=async(e,t,n)=>{let r=v(t,e),i=v(n,e);return await bn(r)?(await gn(r,i),{success:!0}):{success:!1,error:`Source file not found: ${r}`}},Sn=async(e,t)=>{let n=v(t,e);return await re(n,{force:!0}),{success:!0}},Oe=20,$e=async(e,t,n)=>{let r=[];for(let i=0;i<e.length;i+=n){let s=e.slice(i,i+n),o=await Promise.all(s.map(t));r.push(...o)}return r},_n=async(e,t,n,r,i)=>{let s={success:[],deleted:[],failed:[]},o=[...new Set(e.map(d=>mn(v(r,d))))];i.message(`Creating ${o.length} directories...`),await Promise.all(o.map(d=>Ne(d,{recursive:!0}))),i.message(`Updating ${e.length} files...`);let a=await $e(e,async d=>{let c=await En(d,n,r);return{file:d,...c}},Oe);for(let{file:d,success:c,error:u}of a)c?s.success.push(d):s.failed.push({file:d,error:u??"Unknown error"});if(t.length>0){i.message(`Deleting ${t.length} files...`);let d=await $e(t,async c=>{try{return await Sn(c,r),{file:c,success:!0}}catch(u){let l=u instanceof Error?u.message:`${u}`;return{file:c,success:!1,error:l}}},Oe);for(let c of d)c.success?s.deleted.push(c.file):s.failed.push({file:c.file,error:c.error})}return s},Tn=e=>{if(e.success.length>0){w.success(`Successfully updated ${e.success.length} files:`);for(let t of e.success)w.info(` \u2713 ${t}`)}if(e.deleted.length>0){w.success(`Deleted ${e.deleted.length} files:`);for(let t of e.deleted)w.info(` \u{1F5D1} ${t}`)}if(e.failed.length>0){w.warn(`Failed to update ${e.failed.length} files:`);for(let{file:t,error:n}of e.failed)w.error(` \u2717 ${t}: ${n}`)}},In=e=>e.includes("canary")?"canary":"latest",vn=async e=>{let t=await fetch(`https://registry.npmjs.org/${encodeURIComponent(S)}`);if(!t.ok)throw new Error(`Failed to resolve ${S}@${e}`);let r=(await t.json())["dist-tags"]?.[e];if(!r)throw new Error(`Could not find dist-tag ${e} for ${S}`);return r},Pn=async e=>{let t=await M(e),n=J(t,S);if(!n)return{currentVersion:n,nextVersion:void 0,updated:!1};let r=In(n),i=await vn(r);return n===i?{currentVersion:n,nextVersion:i,updateTag:r,updated:!1}:($(t,S,i),await O(e,t),{currentVersion:n,nextVersion:i,updateTag:r,updated:!0})},An=async(e,t,n)=>{let r=await M(e);if(!le(r,S))return!1;t&&t.length>0&&w.warn("Ignoring file patterns for a package-based site. This update will bump the package version instead."),n?.sync&&w.warn("Ignoring --sync for a package-based site. Runtime updates now come from the package version.");let{currentVersion:i,nextVersion:s,updateTag:o,updated:a}=await Pn(e);if(!a)return w.success(i?`@vercel/geistdocs is already at ${s} (${o}).`:"No package version update was needed."),B("Package-based site is already up to date."),!0;w.info(`Bumping ${S} from ${i} to ${s} (${o})`);let d=Ge();return d.start("Installing updated package version..."),await T("pnpm",["install"],{cwd:e}),d.stop("Package update complete!"),B("Please review and test the upgraded package version."),!0},Mn=async(e,t,n,r,i)=>{let s=v(e,te),o=Ge(),a=i?.sync?s:t;o.start("Preparing template snapshot..."),i?.sync&&(await xn(e,te),await N(s)),o.message("Scanning for files...");let d=await Ce(n,r,a),c=[];if(i?.sync){o.message("Comparing with local files...");let l=await Ce(n,r,e),m=new Set(d);c=l.filter(f=>!m.has(f))}if(o.stop(`Found ${d.length} files to update`),d.length===0&&c.length===0){w.warn("No files matched the patterns. Nothing to update."),i?.sync&&await ne(s),B("Update cancelled.");return}w.info(`Patterns: ${n.length}`),w.info(`Files to update: ${d.length}`),i?.sync&&w.info(`Files to delete: ${c.length}`),o.start("Updating files...");let u=await _n(d,c,a,e,o);i?.sync&&(o.message("Cleaning up..."),await ne(s)),o.stop("Update complete!"),Tn(u),B("Please review and test the changes carefully.")},Ue=async(e,t)=>{let n=process.cwd(),r=H(),i=e&&e.length>0?e:wn,s=e&&e.length>0?[]:yn;try{if(fn("Let's update your Geistdocs project!"),await An(n,e,t))return;w.info("Template source: bundled package snapshot"),e&&e.length>0&&w.info(`Updating specific files: ${e.join(", ")}`),t?.sync&&w.info("Sync mode enabled: will delete files removed from template"),await Mn(n,r,i,s,t)}catch(o){let a=o instanceof Error?o.message:`${o}`;try{await ne(v(n,te))}catch{}w.error(`Failed to update project: ${a}`),process.exit(1)}};A.name("geistdocs").description("CLI for Geistdocs projects").version("2.9.1-canary.13e0204","-v, --version","Output the current version");A.command("init").description("Initialize a new Geistdocs project").option("--name <name>","Name of the project").addOption(new Rn("--brand <brand>","Navbar brand").choices(["vercel","labs"]).default("vercel")).option("--disable-git","Disable git initialization").action(he);A.command("update [files...]").description("Update a Geistdocs project (optionally specify files/patterns to update)").option("--sync","Delete local files that no longer exist in the template").action(Ue);A.command("translate [pattern]").description("Translate MDX file(s) to one or more locales (default: content/docs/**/*.mdx)").option("--config <path>","Path to config file to load locales from (defaults to geistdocs.tsx)").option("--url <url>","Custom translation API URL (defaults to GEISTDOCS_TRANSLATE_URL or https://geistdocs.com/translate)").option("--force","Force re-translation of all files, ignoring cache").action(ke);var Fn=A.command("search").description("Manage the external search index used by Ask AI");Fn.command("sync").description("Sync the latest static docs export to Mixedbread").option("--dir <path>","Next.js output directory",".next").option("--allow-non-production","Run outside a production Vercel build").action(Pe);await A.parseAsync(process.argv).catch(e=>{console.error(e instanceof Error?e.message:e),process.exitCode=1});
|
|
@@ -31,7 +31,7 @@ const CHAT_RESPONSE_COMPONENTS = {
|
|
|
31
31
|
code: ({ children, className, node, ...props }) => {
|
|
32
32
|
const inline = node?.position?.start.line === node?.position?.end.line;
|
|
33
33
|
if (inline) {
|
|
34
|
-
return (_jsx("code", { className: cn("rounded bg-gray-100 px-1 py-0.5 font-mono text-sm", className), ...props, children: children }));
|
|
34
|
+
return (_jsx("code", { className: cn("rounded bg-gray-100 px-1 py-0.5 font-mono text-gray-1000 text-sm", className), ...props, children: children }));
|
|
35
35
|
}
|
|
36
36
|
const codeContent = Array.isArray(children)
|
|
37
37
|
? children.join("")
|
|
@@ -5,7 +5,7 @@ interface PageActionsProps {
|
|
|
5
5
|
/**
|
|
6
6
|
* Which variant to render. Defaults to both. Use "desktop" to render only
|
|
7
7
|
* the dropdown (beside the title) and "mobile" to render only the inline
|
|
8
|
-
* action row (below the
|
|
8
|
+
* action row (below the title).
|
|
9
9
|
*/
|
|
10
10
|
only?: "desktop" | "mobile";
|
|
11
11
|
page: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-actions-client.d.ts","sourceRoot":"","sources":["../../src/internal/page-actions-client.tsx"],"names":[],"mappings":"AAIA,OAAO,EAKL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAiBf,OAAO,KAAK,EAA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,CAAC;QACf,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAED,UAAU,oCAAoC;IAC5C,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,aAAa,GAAG,QAAQ,CAAC,CAAC;IACrE,YAAY,EAAE,SAAS,EAAE,CAAC;CAC3B;AAqrBD,eAAO,MAAM,oBAAoB,GAAI,yBAIlC,gBAAgB,mDAgHlB,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAAI,2BAG7C,oCAAoC,4CAiBtC,CAAC"}
|
|
@@ -172,7 +172,7 @@ const FeedbackAction = ({ siteId }) => {
|
|
|
172
172
|
: "text-gray-900 hover:text-gray-1000", onClick: () => setEmotion(entry.name), size: "small", type: "unstyled", typeName: "button", children: [entry.emoji, _jsx("span", { className: "sr-only", children: entry.name })] }, entry.name))) }), _jsx(Button, { disabled: isPending || !emotion || !message, size: "small", typeName: "submit", children: "Send" })] })] })) }) })] }));
|
|
173
173
|
};
|
|
174
174
|
// The mobile action row: three primary actions rendered inline below the
|
|
175
|
-
// page
|
|
175
|
+
// page title.
|
|
176
176
|
const InlinePageActions = ({ askAIEnabled, checked, copyEnabled, onAskAI, onCopy, onPrefetchMarkdown, onViewMarkdown, }) => {
|
|
177
177
|
const CopyStateIcon = checked ? IconCheck : IconCopy;
|
|
178
178
|
let copyLabel = "Copy for LLM";
|
|
@@ -241,8 +241,10 @@ export const GeistdocsPageActions = ({ config, page, only, }) => {
|
|
|
241
241
|
openWithPage({ title: page.title, url: page.url });
|
|
242
242
|
};
|
|
243
243
|
// Desktop variant aligns beside the title (self-end); the mobile variant is
|
|
244
|
-
// rendered below the
|
|
245
|
-
const rootClassName = only === "mobile"
|
|
244
|
+
// rendered below the title and left-aligned.
|
|
245
|
+
const rootClassName = only === "mobile"
|
|
246
|
+
? "@min-[961px]:hidden"
|
|
247
|
+
: "mb-2 self-end @max-[960px]:hidden";
|
|
246
248
|
return (_jsxs("div", { className: rootClassName, onFocusCapture: preloadChat, onPointerEnter: preloadChat, children: [showDesktop ? (_jsx(DesktopPageActions, { askAIEnabled: askAIEnabled, checked: checked, copyEnabled: copyEnabled, editSourceEnabled: editSourceEnabled, editSourceUrl: editSourceUrl, isMobile: isMobile, menuView: menuView, onAskAI: onAskAI, onCopy: handleCopy, onPrefetchMarkdown: prefetchMarkdown, onViewMarkdown: handleViewMarkdown, openInChatEnabled: openInChatEnabled, openInChatRef: openInChatRef, otherProviders: otherProviders, providersBackRef: providersBackRef, query: query, setMenuView: setMenuView, v0Provider: v0Provider })) : null, showMobile && (copyEnabled || askAIEnabled) ? (_jsx(InlinePageActions, { askAIEnabled: askAIEnabled, checked: checked, copyEnabled: copyEnabled, onAskAI: onAskAI, onCopy: handleCopy, onPrefetchMarkdown: prefetchMarkdown, onViewMarkdown: handleViewMarkdown })) : null, _jsx("span", { "aria-live": "polite", className: "sr-only", children: checked ? "Page copied" : "" })] }));
|
|
247
249
|
};
|
|
248
250
|
export const GeistdocsTableOfContentsActions = ({ config, extraActions, }) => {
|
package/dist/pages/docs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/pages/docs.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/pages/docs.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,QAAQ,IAAI,gBAAgB,EAE7B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAErC,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAElB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,KAAK,eAAe,EAA+B,MAAM,WAAW,CAAC;AAgB9E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xB,CAAC,uBAAuB,CAAC,CAAC;CAC5B;AAmDD,eAAO,MAAM,cAAc,GAAI,MAAM,SAAS,cAAc,GAAG,cAAc,EAAE,0MAgB5E,qBAAqB,CAAC,MAAM,CAAC;uBAuOJ;QAAE,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;KAAE;0BAvKlB,MAAM;;oCAqLtC;QACD,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;KACzB,KAAG,OAAO,CAAC,QAAQ,CAAC;CAqDtB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;CAA4B,CAAC"}
|
package/dist/pages/docs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Link from "fumadocs-core/link";
|
|
3
|
-
import { DocsBody as FumadocsDocsBody,
|
|
3
|
+
import { DocsBody as FumadocsDocsBody, DocsPage as FumadocsDocsPage, DocsTitle as FumadocsDocsTitle, } from "fumadocs-ui/layouts/docs/page";
|
|
4
4
|
import { createRelativeLink } from "fumadocs-ui/mdx";
|
|
5
5
|
import { notFound } from "next/navigation";
|
|
6
6
|
import { cache, } from "react";
|
|
@@ -30,15 +30,14 @@ const renderPrefetchedDocsLink = (siteUrl, basePath, { children, className, href
|
|
|
30
30
|
};
|
|
31
31
|
export const resolvePageMarkdownUrl = (options) => resolveInternalPageMarkdownUrl(options);
|
|
32
32
|
/**
|
|
33
|
-
* The page's article parts carry `data-geistdocs-article` (`title`,
|
|
34
|
-
* `
|
|
33
|
+
* The page's visible article parts carry `data-geistdocs-article` (`title`,
|
|
34
|
+
* `body`) so tools that read the rendered HTML (docs
|
|
35
35
|
* crawlers, parity checks against the Markdown route) can select the
|
|
36
36
|
* article without depending on Fumadocs' element ids or on class names.
|
|
37
37
|
* The marked elements hold content only: page actions, breadcrumbs, the
|
|
38
38
|
* table of contents, and the previous/next footer sit outside them.
|
|
39
39
|
*/
|
|
40
40
|
const DocsTitle = ({ className, ...props }) => (_jsx(FumadocsDocsTitle, { className: cn("mb-4 text-balance", className), "data-geistdocs-article": "title", ...props }));
|
|
41
|
-
const DocsDescription = ({ className, ...props }) => (_jsx(FumadocsDocsDescription, { className: cn("text-gray-900", className), "data-geistdocs-article": "description", ...props }));
|
|
42
41
|
const DocsBody = ({ className, ...props }) => (_jsx(FumadocsDocsBody, { className: cn("mx-auto w-full", className), "data-geistdocs-article": "body", ...props }));
|
|
43
42
|
/** App-provided footer content below the table-of-contents actions. */
|
|
44
43
|
const TocFooterSlot = ({ children }) => children ? _jsx("div", { className: "mt-4", children: children }) : null;
|
|
@@ -168,12 +167,12 @@ export const createDocsPage = ({ canViewPage, config, source, mdx, pageActions =
|
|
|
168
167
|
page,
|
|
169
168
|
pageUrl,
|
|
170
169
|
publicPageUrl,
|
|
171
|
-
}), _jsxs("div", { className:
|
|
170
|
+
}), _jsxs("div", { className: "mb-8 flex flex-col-reverse gap-4 md:flex-row md:items-end md:justify-between", children: [_jsx(DocsTitle, { className: "mb-0 min-w-0", children: data.title }), _jsx(GeistdocsPageActions, { config: pageActions.config, only: "desktop", page: {
|
|
172
171
|
markdownUrl,
|
|
173
172
|
path: page.path,
|
|
174
173
|
title: data.title,
|
|
175
174
|
url: publicPageUrl,
|
|
176
|
-
} })] }), _jsx(
|
|
175
|
+
} })] }), _jsx("div", { className: "-mt-6 mb-4 @min-[961px]:hidden", children: _jsx(GeistdocsPageActions, { config: pageActions.config, only: "mobile", page: {
|
|
177
176
|
markdownUrl,
|
|
178
177
|
path: page.path,
|
|
179
178
|
title: data.title,
|
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.9.
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 2.9.1-canary.13e0204 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.9.
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 2.9.1-canary.13e0204.
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
386
|
-
2.
|
|
387
|
-
3. In
|
|
388
|
-
4.
|
|
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
|
|
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.
|
|
491
|
-
2.
|
|
492
|
-
3.
|
|
493
|
-
4.
|
|
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
|
---
|
|
@@ -3799,12 +3808,11 @@ Publishing the document makes `/api/chat` discoverable for programmatic use. Tha
|
|
|
3799
3808
|
|
|
3800
3809
|
## Select the article in rendered HTML
|
|
3801
3810
|
|
|
3802
|
-
Docs pages mark the article
|
|
3811
|
+
Docs pages mark the visible article parts in their HTML, so a tool that reads the rendered page (a crawler, or a check that compares the page with its Markdown route) can select the content without depending on Fumadocs element IDs or class names. The frontmatter description remains available through metadata and AI-readable routes, but is not repeated below the page title.
|
|
3803
3812
|
|
|
3804
3813
|
| Attribute | Element |
|
|
3805
3814
|
| --- | --- |
|
|
3806
3815
|
| `data-geistdocs-article="title"` | The page's `h1` |
|
|
3807
|
-
| `data-geistdocs-article="description"` | The description paragraph, when the page has a description |
|
|
3808
3816
|
| `data-geistdocs-article="body"` | The rendered MDX body |
|
|
3809
3817
|
|
|
3810
3818
|
Page actions, breadcrumbs, the table of contents, and the previous/next links sit outside these elements, so their text never mixes with the article's.
|
|
@@ -3846,7 +3854,7 @@ The AI chat assistant is available in two ways:
|
|
|
3846
3854
|
|
|
3847
3855
|
### 1. Per-Page Quick Access
|
|
3848
3856
|
|
|
3849
|
-
Each documentation page has an "Ask AI about this page" action in the page actions menu beside the title, and in the action row below the
|
|
3857
|
+
Each documentation page has an "Ask AI about this page" action in the page actions menu beside the title, and in the action row below the title on mobile. When a reader selects it, Ask AI:
|
|
3850
3858
|
|
|
3851
3859
|
1. Clears the current conversation, including the history stored in the browser, and opens the chat
|
|
3852
3860
|
2. Shows a card above the prompt input that names the page. Readers can remove the card to ask without the page
|
|
@@ -4126,20 +4134,22 @@ The `model` option only applies in AI Gateway mode. In proxy mode, the Vertex-ba
|
|
|
4126
4134
|
Use proxy mode when Ask AI should route model requests through a central Vertex-backed service instead of calling AI Gateway from each site.
|
|
4127
4135
|
|
|
4128
4136
|
1. Deploy or use the central Geistdocs platform proxy that exposes `POST /vertex`.
|
|
4129
|
-
2.
|
|
4130
|
-
3. Set `
|
|
4137
|
+
2. Generate a random token containing at least 32 bytes with `openssl rand -base64 32`.
|
|
4138
|
+
3. Set the token as `GEISTDOCS_VERTEX_PROXY_TOKEN` on the platform proxy deployment.
|
|
4139
|
+
4. Configure the Vertex deployment to trust the Geistdocs platform Vercel project with Deployment Protection Trusted Sources.
|
|
4140
|
+
5. Set `GEISTDOCS_CHAT_PROXY_URL` on the Geistdocs site to the platform proxy URL, including `/vertex`:
|
|
4131
4141
|
|
|
4132
4142
|
```txt
|
|
4133
4143
|
https://<geistdocs-platform-deployment>/vertex
|
|
4134
4144
|
```
|
|
4135
4145
|
|
|
4136
|
-
|
|
4146
|
+
6. Set the same token as `GEISTDOCS_CHAT_PROXY_TOKEN` on the Geistdocs site.
|
|
4137
4147
|
|
|
4138
4148
|
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.
|
|
4139
4149
|
|
|
4140
4150
|
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).
|
|
4141
4151
|
|
|
4142
|
-
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.
|
|
4152
|
+
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.
|
|
4143
4153
|
|
|
4144
4154
|
### Hosted eve agent mode
|
|
4145
4155
|
|
|
@@ -4462,6 +4472,8 @@ export const { POST, maxDuration } = createChatRoute({
|
|
|
4462
4472
|
});
|
|
4463
4473
|
```
|
|
4464
4474
|
|
|
4475
|
+
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.
|
|
4476
|
+
|
|
4465
4477
|
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`:
|
|
4466
4478
|
|
|
4467
4479
|
```ts title="app/api/chat/route.ts"
|
package/docs/manifest.json
CHANGED
|
@@ -166,12 +166,11 @@ Publishing the document makes `/api/chat` discoverable for programmatic use. Tha
|
|
|
166
166
|
|
|
167
167
|
## Select the article in rendered HTML
|
|
168
168
|
|
|
169
|
-
Docs pages mark the article
|
|
169
|
+
Docs pages mark the visible article parts in their HTML, so a tool that reads the rendered page (a crawler, or a check that compares the page with its Markdown route) can select the content without depending on Fumadocs element IDs or class names. The frontmatter description remains available through metadata and AI-readable routes, but is not repeated below the page title.
|
|
170
170
|
|
|
171
171
|
| Attribute | Element |
|
|
172
172
|
| --- | --- |
|
|
173
173
|
| `data-geistdocs-article="title"` | The page's `h1` |
|
|
174
|
-
| `data-geistdocs-article="description"` | The description paragraph, when the page has a description |
|
|
175
174
|
| `data-geistdocs-article="body"` | The rendered MDX body |
|
|
176
175
|
|
|
177
176
|
Page actions, breadcrumbs, the table of contents, and the previous/next links sit outside these elements, so their text never mixes with the article's.
|
package/docs/pages/ask-ai.md
CHANGED
|
@@ -26,7 +26,7 @@ The AI chat assistant is available in two ways:
|
|
|
26
26
|
|
|
27
27
|
### 1. Per-Page Quick Access
|
|
28
28
|
|
|
29
|
-
Each documentation page has an "Ask AI about this page" action in the page actions menu beside the title, and in the action row below the
|
|
29
|
+
Each documentation page has an "Ask AI about this page" action in the page actions menu beside the title, and in the action row below the title on mobile. When a reader selects it, Ask AI:
|
|
30
30
|
|
|
31
31
|
1. Clears the current conversation, including the history stored in the browser, and opens the chat
|
|
32
32
|
2. Shows a card above the prompt input that names the page. Readers can remove the card to ask without the page
|
|
@@ -306,20 +306,22 @@ The `model` option only applies in AI Gateway mode. In proxy mode, the Vertex-ba
|
|
|
306
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.
|
|
307
307
|
|
|
308
308
|
1. Deploy or use the central Geistdocs platform proxy that exposes `POST /vertex`.
|
|
309
|
-
2.
|
|
310
|
-
3. Set `
|
|
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`:
|
|
311
313
|
|
|
312
314
|
```txt
|
|
313
315
|
https://<geistdocs-platform-deployment>/vertex
|
|
314
316
|
```
|
|
315
317
|
|
|
316
|
-
|
|
318
|
+
6. Set the same token as `GEISTDOCS_CHAT_PROXY_TOKEN` on the Geistdocs site.
|
|
317
319
|
|
|
318
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.
|
|
319
321
|
|
|
320
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).
|
|
321
323
|
|
|
322
|
-
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.
|
|
323
325
|
|
|
324
326
|
### Hosted eve agent mode
|
|
325
327
|
|
|
@@ -642,6 +644,8 @@ export const { POST, maxDuration } = createChatRoute({
|
|
|
642
644
|
});
|
|
643
645
|
```
|
|
644
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
|
+
|
|
645
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`:
|
|
646
650
|
|
|
647
651
|
```ts title="app/api/chat/route.ts"
|
package/docs/pages/deployment.md
CHANGED
|
@@ -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.
|
|
77
|
-
2.
|
|
78
|
-
3.
|
|
79
|
-
4.
|
|
80
|
-
|
|
81
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
62
|
-
2.
|
|
63
|
-
3. In
|
|
64
|
-
4.
|
|
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
|
|
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.9.
|
|
4
|
+
"version": "2.9.1-canary.13e0204",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -295,6 +295,10 @@
|
|
|
295
295
|
"./theme.css": "./theme.css",
|
|
296
296
|
"./package.json": "./package.json"
|
|
297
297
|
},
|
|
298
|
+
"scripts": {
|
|
299
|
+
"build": "rm -rf dist docs template && node ./scripts/bundle-template.mjs && node ./scripts/bundle-docs.mjs && tsc -p tsconfig.runtime.json && tsup --config tsup.config.cli.ts",
|
|
300
|
+
"dev": "tsc -p tsconfig.runtime.json --watch --preserveWatchOutput"
|
|
301
|
+
},
|
|
298
302
|
"dependencies": {
|
|
299
303
|
"@ai-sdk/react": "^3.0.134",
|
|
300
304
|
"@clack/prompts": "^0.11.0",
|
|
@@ -358,9 +362,5 @@
|
|
|
358
362
|
"react-dom": "^19.2.3",
|
|
359
363
|
"tsup": "^8.5.1",
|
|
360
364
|
"typescript": "^5.9.3"
|
|
361
|
-
},
|
|
362
|
-
"scripts": {
|
|
363
|
-
"build": "rm -rf dist docs template && node ./scripts/bundle-template.mjs && node ./scripts/bundle-docs.mjs && tsc -p tsconfig.runtime.json && tsup --config tsup.config.cli.ts",
|
|
364
|
-
"dev": "tsc -p tsconfig.runtime.json --watch --preserveWatchOutput"
|
|
365
365
|
}
|
|
366
|
-
}
|
|
366
|
+
}
|
package/public-foundation.css
CHANGED
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
|
|
package/template/.env.example
CHANGED
|
@@ -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
|
-
#
|
|
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).
|
package/template/AGENTS.md
CHANGED
|
@@ -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
|
-
-
|
|
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
|
|
|
@@ -164,12 +164,11 @@ Publishing the document makes `/api/chat` discoverable for programmatic use. Tha
|
|
|
164
164
|
|
|
165
165
|
## Select the article in rendered HTML
|
|
166
166
|
|
|
167
|
-
Docs pages mark the article
|
|
167
|
+
Docs pages mark the visible article parts in their HTML, so a tool that reads the rendered page (a crawler, or a check that compares the page with its Markdown route) can select the content without depending on Fumadocs element IDs or class names. The frontmatter description remains available through metadata and AI-readable routes, but is not repeated below the page title.
|
|
168
168
|
|
|
169
169
|
| Attribute | Element |
|
|
170
170
|
| --- | --- |
|
|
171
171
|
| `data-geistdocs-article="title"` | The page's `h1` |
|
|
172
|
-
| `data-geistdocs-article="description"` | The description paragraph, when the page has a description |
|
|
173
172
|
| `data-geistdocs-article="body"` | The rendered MDX body |
|
|
174
173
|
|
|
175
174
|
Page actions, breadcrumbs, the table of contents, and the previous/next links sit outside these elements, so their text never mixes with the article's.
|
|
@@ -24,7 +24,7 @@ The AI chat assistant is available in two ways:
|
|
|
24
24
|
|
|
25
25
|
### 1. Per-Page Quick Access
|
|
26
26
|
|
|
27
|
-
Each documentation page has an "Ask AI about this page" action in the page actions menu beside the title, and in the action row below the
|
|
27
|
+
Each documentation page has an "Ask AI about this page" action in the page actions menu beside the title, and in the action row below the title on mobile. When a reader selects it, Ask AI:
|
|
28
28
|
|
|
29
29
|
1. Clears the current conversation, including the history stored in the browser, and opens the chat
|
|
30
30
|
2. Shows a card above the prompt input that names the page. Readers can remove the card to ask without the page
|
|
@@ -304,20 +304,22 @@ The `model` option only applies in AI Gateway mode. In proxy mode, the Vertex-ba
|
|
|
304
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.
|
|
305
305
|
|
|
306
306
|
1. Deploy or use the central Geistdocs platform proxy that exposes `POST /vertex`.
|
|
307
|
-
2.
|
|
308
|
-
3. Set `
|
|
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`:
|
|
309
311
|
|
|
310
312
|
```txt
|
|
311
313
|
https://<geistdocs-platform-deployment>/vertex
|
|
312
314
|
```
|
|
313
315
|
|
|
314
|
-
|
|
316
|
+
6. Set the same token as `GEISTDOCS_CHAT_PROXY_TOKEN` on the Geistdocs site.
|
|
315
317
|
|
|
316
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.
|
|
317
319
|
|
|
318
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).
|
|
319
321
|
|
|
320
|
-
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.
|
|
321
323
|
|
|
322
324
|
### Hosted eve agent mode
|
|
323
325
|
|
|
@@ -640,6 +642,8 @@ export const { POST, maxDuration } = createChatRoute({
|
|
|
640
642
|
});
|
|
641
643
|
```
|
|
642
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
|
+
|
|
643
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`:
|
|
644
648
|
|
|
645
649
|
```ts title="app/api/chat/route.ts"
|
|
@@ -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.
|
|
76
|
-
2.
|
|
77
|
-
3.
|
|
78
|
-
4.
|
|
79
|
-
|
|
80
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
60
|
-
2.
|
|
61
|
-
3. In
|
|
62
|
-
4.
|
|
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
|
|
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
|
|
package/template/package.json
CHANGED
|
@@ -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.9.
|
|
20
|
+
"@vercel/geistdocs": "2.9.1-canary.13e0204",
|
|
21
21
|
"@vercel/speed-insights": "^1.3.1",
|
|
22
22
|
"ai": "^6.0.132",
|
|
23
23
|
"clsx": "^2.1.1",
|